PageSourceSearch

https://ridemtu.com/assets/transit-vXAH360j.js

js ridemtu.com collected 2026-09-27 13:01:30 UTC 1,387,199 bytes, 967 lines download raw bytes

1var U2=Object.defineProperty;var $2=(l,a,h)=>a in l?U2(l,a,{enumerable:!0,configurable:!0,writable:!0,value:h}):l[a]=h;var kt=(l,a,h)=>$2(l,typeof a!="symbol"?a+"":a,h);import{r as we,j as Re,G as yx,R as q2,c as G2,b as _x,O as Z2,C as W2,w as H2,f as X2,e as Y2}from"./chunk-LFPYN7LY-BYCOceFh.js";import{c as Dg}from"./client-BLYx_TBV.js";import{h as K2,p as D0,i as J2,j as Q2,d as eT,k as L0,l as tT,a as R0,u as vx,R as Om,m as rT,M as nT}from"./MapControlContext-CaZ7lMlQ.js";import{H as ca,u as Lg,F as iT,j as aT,k as oT,l as sT,o as lT,p as cT,q as uT,r as hT,h as pT,s as dT,b as fT,T as mT}from"./alerts-mA4EJBuF.js";import{r as xx}from"./index-DAESeoaZ.js";import{a as z0,t as gT,s as Rg,f as bx}from"./time-DAo_j7jH.js";import{T as $r,B as fr,u as Nc,a as yT,g as _T}from"./index-B19M7xEA.js";import{V as vT}from"./VehiclePassengerLoad-CKWApWX_.js";import{V as co}from"./v-stack-C2JudPXh.js";import{n as xT,b as wx}from"./GeolocationPermissionContext-BNsxlLYQ.js";import{b as F0}from"./mapRouteStopsStore-CBj7cgaO.js";import{I as Rd}from"./icon-BoqpEvxL.js";import{f as Oa,u as Tx,o as zg,c as ei,a as kc,n as Sx,m as bT,d as Ex,r as wT,D as Bm}from"./use-style-config-ZxeY2J_M.js";import{m as Qo,d as Px,B as TT}from"./button-LMyeCesN.js";import{D as ST,a as ET}from"./nearbyStopsService-D1T8Cnfb.js";import{u as Wd}from"./EnvironmentContext-X49McUcm.js";import{I as og,F as PT}from"./flex-BcGX1xZc.js";import{a as zd,b as sg,u as MT}from"./use-update-effect-NPvO9y9c.js";import{c as Fg,S as IT}from"./spinner-WEkHiO-h.js";import{a as Hd,b as AT,c as CT,d as kT,p as DT}from"./pick-CJSl3uuF.js";import{c as Ho,a as LT}from"./call-all-DDzecCnU.js";import{m as Mx,A as RT}from"./proxy-Cqc5MAPz.js";import{P as zT}from"./portal-Ty30PHP7.js";import"./create-icon-CgxNfmBl.js";function FT(l){var a;return((a=Ix(l))==null?void 0:a.defaultView)??window}function Ix(l){return Hd(l)?l.ownerDocument:document}function OT(l){return Ix(l).activeElement}const Ax=l=>l.hasAttribute("tabindex"),BT=l=>Ax(l)&&l.tabIndex===-1;function NT(l){if(!Hd(l)||AT(l)||CT(l))return!1;const{localName:a}=l;if(["input","select","textarea","button"].indexOf(a)>=0)return!0;const y={a:()=>l.hasAttribute("href"),audio:()=>l.hasAttribute("controls"),video:()=>l.hasAttribute("controls")};return a in y?y[a]():kT(l)?!0:Ax(l)}function jT(l){return l?Hd(l)&&NT(l)&&!BT(l):!1}function VT(l){const{wasSelected:a,enabled:h,isSelected:y,mode:x="unmount"}=l;return!!(!h||y||x==="keepMounted"&&a)}function UT(l){const a=l.ownerDocument.defaultView||window,{overflow:h,overflowX:y,overflowY:x}=a.getComputedStyle(l);return/auto|scroll|overlay|hidden/.test(h+x+y)}function $T(l){return l.localName==="html"?l:l.assignedSlot||l.parentElement||l.ownerDocument.documentElement}function Cx(l){return["html","body","#document"].includes(l.localName)?l.ownerDocument.body:Hd(l)&&UT(l)?l:Cx($T(l))}function Sd(l,a,h,y){const x=zd(h);return we.useEffect(()=>{const T=typeof l=="function"?l():l??document;if(!(!h||!T))return T.addEventListener(a,x,y),()=>{T.removeEventListener(a,x,y)}},[a,l,y,x,h]),()=>{const T=typeof l=="function"?l():l??document;T==null||T.removeEventListener(a,x,y)}}function qT(l){const{isOpen:a,ref:h}=l,[y,x]=we.useState(a),[T,v]=we.useState(!1);return we.useEffect(()=>{T||(x(a),v(!0))},[a,T,y]),Sd(()=>h.current,"animationend",()=>{x(a)}),{present:!(a?!1:!y),onComplete(){var O;const I=FT(h.current),L=new I.CustomEvent("animationend",{bubbles:!0});(O=h.current)==null||O.dispatchEvent(L)}}}function kx(l={}){const{onClose:a,onOpen:h,isOpen:y,id:x}=l,T=zd(h),v=zd(a),[s,I]=we.useState(l.defaultIsOpen||!1),L=y!==void 0?y:s,O=y!==void 0,H=we.useId(),J=x??`disclosure-${H}`,ee=we.useCallback(()=>{O||I(!1),v==null||v()},[O,v]),ue=we.useCallback(()=>{O||I(!0),T==null||T()},[O,T]),fe=we.useCallback(()=>{L?ee():ue()},[L,ue,ee]);function te(Ae={}){return{...Ae,"aria-expanded":L,"aria-controls":J,onClick(De){var xe;(xe=Ae.onClick)==null||xe.call(Ae,De),fe()}}}function Be(Ae={}){return{...Ae,hidden:!L,id:J}}return{isOpen:L,onOpen:ue,onClose:ee,onToggle:fe,isControlled:O,getButtonProps:te,getDisclosureProps:Be}}function GT(l){const a=l.current;if(!a)return!1;const h=OT(a);return!h||a.contains(h)?!1:!!jT(h)}function ZT(l,a){const{visible:h,focusRef:y}=a,x=!h;sg(()=>{if(!x||GT(l))return;const T=(y==null?void 0:y.current)||l.current;let v;if(T)return v=requestAnimationFrame(()=>{T.focus({preventScroll:!0})}),()=>{cancelAnimationFrame(v)}},[x,l,y])}function WT(l,a){const h=we.useId();return we.useMemo(()=>
1l||[a,h].filter(Boolean).join("-"),[l,a,h])}function HT(l,...a){const h=WT(l);return we.useMemo(()=>a.map(y=>`${y}-${h}`),[h,a])}function XT(l){const{ref:a,handler:h,enabled:y=!0}=l,x=zd(h),v=we.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;we.useEffect(()=>{if(!y)return;const s=H=>{Nm(H,a)&&(v.isPointerDown=!0)},I=H=>{if(v.ignoreEmulatedMouseEvents){v.ignoreEmulatedMouseEvents=!1;return}v.isPointerDown&&h&&Nm(H,a)&&(v.isPointerDown=!1,x(H))},L=H=>{v.ignoreEmulatedMouseEvents=!0,h&&v.isPointerDown&&Nm(H,a)&&(v.isPointerDown=!1,x(H))},O=Dx(a.current);return O.addEventListener("mousedown",s,!0),O.addEventListener("mouseup",I,!0),O.addEventListener("touchstart",s,!0),O.addEventListener("touchend",L,!0),()=>{O.removeEventListener("mousedown",s,!0),O.removeEventListener("mouseup",I,!0),O.removeEventListener("touchstart",s,!0),O.removeEventListener("touchend",L,!0)}},[h,a,x,v,y])}function Nm(l,a){var y,x;const h=((y=l.composedPath)==null?void 0:y.call(l)[0])??l.target;return h&&!Dx(h).contains(h)?!1:!((x=a.current)!=null&&x.contains(h))}function Dx(l){return(l==null?void 0:l.ownerDocument)??document}function YT(l,a,h){var y,x;return((x=(y=l.__cssMap)==null?void 0:y[`${a}.${h}`])==null?void 0:x.varRef)??h}function O0(l){return l.sort((a,h)=>{const y=a.compareDocumentPosition(h);if(y&Node.DOCUMENT_POSITION_FOLLOWING||y&Node.DOCUMENT_POSITION_CONTAINED_BY)return-1;if(y&Node.DOCUMENT_POSITION_PRECEDING||y&Node.DOCUMENT_POSITION_CONTAINS)return 1;if(y&Node.DOCUMENT_POSITION_DISCONNECTED||y&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC)throw Error("Cannot sort the given nodes.");return 0})}const KT=l=>typeof l=="object"&&"nodeType"in l&&l.nodeType===Node.ELEMENT_NODE;function B0(l,a,h){let y=l+1;return h&&y>=a&&(y=0),y}function N0(l,a,h){let y=l-1;return h&&y<0&&(y=a),y}const jm=typeof window<"u"?we.useLayoutEffect:we.useEffect,j0=l=>l;var JT=Object.defineProperty,QT=(l,a,h)=>a in l?JT(l,a,{enumerable:!0,configurable:!0,writable:!0,value:h}):l[a]=h,pn=(l,a,h)=>(QT(l,typeof a!="symbol"?a+"":a,h),h);class eS{constructor(){pn(this,"descendants",new Map),pn(this,"register",a=>{if(a!=null)return KT(a)?this.registerNode(a):h=>{this.registerNode(h,a)}}),pn(this,"unregister",a=>{this.descendants.delete(a);const h=O0(Array.from(this.descendants.keys()));this.assignIndex(h)}),pn(this,"destroy",()=>{this.descendants.clear()}),pn(this,"assignIndex",a=>
1{this.descendants.forEach(h=>{const y=a.indexOf(h.node);h.index=y,h.node.dataset.index=h.index.toString()})}),pn(this,"count",()=>this.descendants.size),pn(this,"enabledCount",()=>this.enabledValues().length),pn(this,"values",()=>Array.from(this.descendants.values()).sort((h,y)=>h.index-y.index)),pn(this,"enabledValues",()=>this.values().filter(a=>!a.disabled)),pn(this,"item",a=>{if(this.count()!==0)return this.values()[a]}),pn(this,"enabledItem",a=>{if(this.enabledCount()!==0)return this.enabledValues()[a]}),pn(this,"first",()=>this.item(0)),pn(this,"firstEnabled",()=>this.enabledItem(0)),pn(this,"last",()=>this.item(this.descendants.size-1)),pn(this,"lastEnabled",()=>{const a=this.enabledValues().length-1;return this.enabledItem(a)}),pn(this,"indexOf",a=>{var h;return a?((h=this.descendants.get(a))==null?void 0:h.index)??-1:-1}),pn(this,"enabledIndexOf",a=>a==null?-1:this.enabledValues().findIndex(h=>h.node.isSameNode(a))),pn(this,"next",(a,h=!0)=>{const y=B0(a,this.count(),h);return this.item(y)}),pn(this,"nextEnabled",(a,h=!0)=>{const y=this.item(a);if(!y)return;const x=this.enabledIndexOf(y.node),T=B0(x,this.enabledCount(),h);return this.enabledItem(T)}),pn(this,"prev",(a,h=!0)=>{const y=N0(a,this.count()-1,h);return this.item(y)}),pn(this,"prevEnabled",(a,h=!0)=>{const y=this.item(a);if(!y)return;const x=this.enabledIndexOf(y.node),T=N0(x,this.enabledCount()-1,h);return this.enabledItem(T)}),pn(this,"registerNode",(a,h)=>{if(!a||this.descendants.has(a))return;const y=Array.from(this.descendants.keys()).concat(a),x=O0(y);h!=null&&h.disabled&&(h.disabled=!!h.disabled);const T={node:a,index:-1,...h};this.descendants.set(a,T),this.assignIndex(x)})}}function tS(){const[l,a]=Fg({name:"DescendantsProvider",errorMessage:"useDescendantsContext must be used within DescendantsProvider"});return[l,a,()=>{const x=we.useRef(new eS);return jm(()=>()=>x.current.destroy()),x.current},x=>{const T=a(),[v,s]=we.useState(-1),I=we.useRef(null);jm(()=>()=>{I.current&&T.unregister(I.current)},[]),jm(()=>{if(!I.current)return;const O=Number(I.current.dataset.index);v!=O&&!Number.isNaN(O)&&s(O)});const L=j0(x?T.register(x):T.register);return{descendants:T,index:v,enabledIndex:T.enabledIndexOf(I.current),register:Qo(L,I)}}]}function rS(l){const{loading:a,src:h,srcSet:y,onLoad:x,onError:T,crossOrigin:v,sizes:s,ignoreFallback:I}=l,[L,O]=we.useState("pending");we.useEffect(()=>{O(h?"loading":"pending")},[h]);const H=we.useRef(null),J=we.useCallback(()=>{if(!h)return;ee();const ue=new Image;ue.src=h,v&&(ue.crossOrigin=v),y&&(ue.srcset=y),s&&(ue.sizes=s),a&&(ue.loading=a),ue.onload=fe=>{ee(),O("loaded"),x==null||x(fe)},ue.onerror=fe=>{ee(),O("failed"),T==null||T(fe)},H.current=ue},[h,v,y,s,x,T,a]),ee=()=>{H.current&&(H.current.onload=null,H.current.onerror=null,H.current=null)};return MT(()=>{if(!I)return L==="loading"&&J(),()=>{ee()}},[L,J,I]),I?"loaded":L}const nS=(l,a)=>l!=="loaded"&&a==="beforeLoadOrError"||l==="failed"&&a==="onError",lg=Oa(function(a,h){const y=Tx("Code",a),{className:x,...T}=zg(a);return Re.jsx(ei.code,{ref:h,className:kc("chakra-code",a.className),...T,__css:{display:"inline-block",...y}})});lg.displayName="Code";const cg=Oa(function(a,h){const{htmlWidth:y,htmlHeight:x,alt:T,...v}=a;return Re.jsx("img",{width:y,height:x,ref:h,alt:T,...v})});cg.displayName="NativeImage";const Lx=Oa(function(a,h){const{fallbackSrc:y,fallback:x,src:T,srcSet:v,align:s,fit:I,loading:L,ignoreFallback:O,crossOrigin:H,fallbackStrategy:J="beforeLoadOrError",referrerPolicy:ee,...ue}=a,fe=y!==void 0||x!==void 0,te=L!=null||O||!fe,Be=rS({...a,crossOrigin:H,ignoreFallback:te}),Ae=nS(Be,J),De={ref:h,objectFit:I,objectPosition:s,...te?ue:Sx(ue,["onError","onLoad"])};return Ae?x||Re.jsx(ei.img,{as:cg,className:"chakra-image__placeholder",src:y,...De}):Re.jsx(ei.img,{as:cg,src:T,srcSet:v,crossOrigin:H,loading:L,referrerPolicy:ee,className:"chakra-image",...De})});Lx.displayName="Image";function iS(l,a,h,y){if(a==null)return y;if(!y)return l.find(v=>h(v).toLowerCase().startsWith(a.toLowerCase()));const x=l.filter(T=>h(T).toLowerCase().startsWith(a.toLowerCase()));if(x.length>0){let T;return x.includes(y)?(T=x.indexOf(y)+1,T===x.length&&(T=0),x[T]):(T=l.indexOf(x[
10]),l[T])}return y}function aS(l){const{key:a}=l;return a.length===1||a.length>1&&/[^a-zA-Z0-9]/.test(a)}function oS(l={}){const{timeout:a=300,preventDefault:h=()=>!0}=l,[y,x]=we.useState([]),T=we.useRef(void 0),v=()=>{T.current&&(clearTimeout(T.current),T.current=null)},s=()=>{v(),T.current=setTimeout(()=>{x([]),T.current=null},a)};we.useEffect(()=>v,[]);function I(L){return O=>{if(O.key==="Backspace"){const H=[...y];H.pop(),x(H);return}if(aS(O)){const H=y.concat(O.key);h(O)&&(O.preventDefault(),O.stopPropagation()),x(H),L(H.join("")),s()}}}return I}var xi="top",Yi="bottom",Ki="right",bi="left",Og="auto",Ah=[xi,Yi,Ki,bi],Dc="start",yh="end",sS="clippingParents",Rx="viewport",ih="popper",lS="reference",V0=Ah.reduce(function(l,a){return l.concat([a+"-"+Dc,a+"-"+yh])},[]),zx=[].concat(Ah,[Og]).reduce(function(l,a){return l.concat([a,a+"-"+Dc,a+"-"+yh])},[]),cS="beforeRead",uS="read",hS="afterRead",pS="beforeMain",dS="main",fS="afterMain",mS="beforeWrite",gS="write",yS="afterWrite",_S=[cS,uS,hS,pS,dS,fS,mS,gS,yS];function Fa(l){return l?(l.nodeName||"").toLowerCase():null}function ji(l){if(l==null)return window;if(l.toString()!=="[object Window]"){var a=l.ownerDocument;return a&&a.defaultView||window}return l}function dl(l){var a=ji(l).Element;return l instanceof a||l instanceof Element}function Xi(l){var a=ji(l).HTMLElement;return l instanceof a||l instanceof HTMLElement}function Bg(l){if(typeof ShadowRoot>"u")return!1;var a=ji(l).ShadowRoot;return l instanceof a||l instanceof ShadowRoot}function vS(l){var a=l.state;Object.keys(a.elements).forEach(function(h){var y=a.styles[h]||{},x=a.attributes[h]||{},T=a.elements[h];!Xi(T)||!Fa(T)||(Object.assign(T.style,y),Object.keys(x).forEach(function(v){var s=x[v];s===!1?T.removeAttribute(v):T.setAttribute(v,s===!0?"":s)}))})}function xS(l){var a=l.state,h={popper:{position:a.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(a.elements.popper.style,h.popper),a.styles=h,a.elements.arrow&&Object.assign(a.elements.arrow.style,h.arrow),function(){Object.keys(a.elements).forEach(function(y){var x=a.elements[y],T=a.attributes[y]||{},v=Object.keys(a.styles.hasOwnProperty(y)?a.styles[y]:h[y]),s=v.reduce(function(I,L){return I[L]="",I},{});!Xi(x)||!Fa(x)||(Object.assign(x.style,s),Object.keys(T).forEach(function(I){x.removeAttribute(I)}))})}}const bS={name:"applyStyles",enabled:!0,phase:"write",fn:vS,effect:xS,requires:["computeStyles"]};function ka(l){return l.split("-")[0]}var sl=Math.max,Fd=Math.min,Lc=Math.round;function ug(){var l=navigator.userAgentData;return l!=null&&l.brands&&Array.isArray(l.brands)?l.brands.map(function(a){return a.brand+"/"+a.version}).join(" "):navigator.userAgent}function Fx(){return!/^((?!chrome|android).)*safari/i.test(ug())}function Rc(l,a,h){a===void 0&&(a=!1),h===void 0&&(h=!1);var y=l.getBoundingClientRect(),x=1,T=1;a&&Xi(l)&&(x=l.offsetWidth>0&&Lc(y.width)/l.offsetWidth||1,T=l.offsetHeight>0&&Lc(y.height)/l.offsetHeight||1);
vendor: 17,336 bytes, line 1
1var v=dl(l)?ji(l):window,s=v.visualViewport,I=!Fx()&&h,L=(y.left+(I&&s?s.offsetLeft:0))/x,O=(y.top+(I&&s?s.offsetTop:0))/T,H=y.width/x,J=y.height/T;return{width:H,height:J,top:O,right:L+H,bottom:O+J,left:L,x:L,y:O}}function Ng(l){var a=Rc(l),h=l.offsetWidth,y=l.offsetHeight;return Math.abs(a.width-h)<=1&&(h=a.width),Math.abs(a.height-y)<=1&&(y=a.height),{x:l.offsetLeft,y:l.offsetTop,width:h,height:y}}function Ox(l,a){var h=a.getRootNode&&a.getRootNode();if(l.contains(a))return!0;if(h&&Bg(h)){var y=a;do{if(y&&l.isSameNode(y))return!0;y=y.parentNode||y.host}while(y)}return!1}function po(l){return ji(l).getComputedStyle(l)}function wS(l){return["table","td","th"].indexOf(Fa(l))>=0}function ts(l){return((dl(l)?l.ownerDocument:l.document)||window.document).documentElement}function Xd(l){return Fa(l)==="html"?l:l.assignedSlot||l.parentNode||(Bg(l)?l.host:null)||ts(l)}function U0(l){return!Xi(l)||po(l).position==="fixed"?null:l.offsetParent}function TS(l){var a=/firefox/i.test(ug()),h=/Trident/i.test(ug());if(h&&Xi(l)){var y=po(l);if(y.position==="fixed")return null}var x=Xd(l);for(Bg(x)&&(x=x.host);Xi(x)&&["html","body"].indexOf(Fa(x))<0;){var T=po(x);if(T.transform!=="none"||T.perspective!=="none"||T.contain==="paint"||["transform","perspective"].indexOf(T.willChange)!==-1||a&&T.willChange==="filter"||a&&T.filter&&T.filter!=="none")return x;x=x.parentNode}return null}function Ch(l){for(var a=ji(l),h=U0(l);h&&wS(h)&&po(h).position==="static";)h=U0(h);return h&&(Fa(h)==="html"||Fa(h)==="body"&&po(h).position==="static")?a:h||TS(l)||a}function jg(l){return["top","bottom"].indexOf(l)>=0?"x":"y"}function hh(l,a,h){return sl(l,Fd(a,h))}function SS(l,a,h){var y=hh(l,a,h);return y>h?h:y}function Bx(){return{top:0,right:0,bottom:0,left:0}}function Nx(l){return Object.assign({},Bx(),l)}function jx(l,a){return a.reduce(function(h,y){return h[y]=l,h},{})}var ES=function(a,h){return a=typeof a=="function"?a(Object.assign({},h.rects,{placement:h.placement})):a,Nx(typeof a!="number"?a:jx(a,Ah))};function PS(l){var a,h=l.state,y=l.name,x=l.options,T=h.elements.arrow,v=h.modifiersData.popperOffsets,s=ka(h.placement),I=jg(s),L=[bi,Ki].indexOf(s)>=0,O=L?"height":"width";if(!(!T||!v)){var H=ES(x.padding,h),J=Ng(T),ee=I==="y"?xi:bi,ue=I==="y"?Yi:Ki,fe=h.rects.reference[O]+h.rects.reference[I]-v[I]-h.rects.popper[O],te=v[I]-h.rects.reference[I],Be=Ch(T),Ae=Be?I==="y"?Be.clientHeight||0:Be.clientWidth||0:0,De=fe/2-te/2,xe=H[ee],ye=Ae-J[O]-H[ue],Se=Ae/2-J[O]/2+De,Ie=hh(xe,Se,ye),Ze=I;h.modifiersData[y]=(a={},a[Ze]=Ie,a.centerOffset=Ie-Se,a)}}function MS(l){var a=l.state,h=l.options,y=h.element,x=y===void 0?"[data-popper-arrow]":y;x!=null&&(typeof x=="string"&&(x=a.elements.popper.querySelector(x),!x)||Ox(a.elements.popper,x)&&(a.elements.arrow=x))}const IS={name:"arrow",enabled:!0,phase:"main",fn:PS,effect:MS,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function zc(l){return l.split("-")[1]}var AS={top:"auto",right:"auto",bottom:"auto",left:"auto"};function CS(l,a){var h=l.x,y=l.y,x=a.devicePixelRatio||1;return{x:Lc(h*x)/x||0,y:Lc(y*x)/x||0}}function $0(l){var a,h=l.popper,y=l.popperRect,x=l.placement,T=l.variation,v=l.offsets,s=l.position,I=l.gpuAcceleration,L=l.adaptive,O=l.roundOffsets,H=l.isFixed,J=v.x,ee=J===void 0?0:J,ue=v.y,fe=ue===void 0?0:ue,te=typeof O=="function"?O({x:ee,y:fe}):{x:ee,y:fe};ee=te.x,fe=te.y;var Be=v.hasOwnProperty("x"),Ae=v.hasOwnProperty("y"),De=bi,xe=xi,ye=window;if(L){var Se=Ch(h),Ie="clientHeight",Ze="clientWidth";if(Se===ji(h)&&(Se=ts(h),po(Se).position!=="static"&&s==="absolute"&&(Ie="scrollHeight",Ze="scrollWidth")),Se=Se,x===xi||(x===bi||x===Ki)&&T===yh){xe=Yi;var Je=H&&Se===ye&&ye.visualViewport?ye.visualViewport.height:Se[Ie];fe-=Je-y.height,fe*=I?1:-1}if(x===bi||(x===xi||x===Yi)&&T===yh){De=Ki;var Ve=H&&Se===ye&&ye.visualViewport?ye.visualViewport.width:Se[Ze];ee-=Ve-y.width,ee*=I?1:-1}}var ft=Object.assign({position:s},L&&AS),vt=O===!0?CS({x:ee,y:fe},ji(h)):{x:ee,y:fe};if(ee=vt.x,fe=vt.y,I){var nt;return Object.assign({},ft,(nt={},nt[xe]=Ae?"0":"",nt[De]=Be?"0":"",nt.transform=(ye.devicePixelRatio||1)<=1?"translate("+ee+"px, "+fe+"px)":"translate3d("+ee+"px, "+fe+"px, 0)",nt))}return Object.assign({},ft,(a={},a[xe]=Ae?fe+"px":"",a[De]=Be?ee+"px":"",a.transform="",a))}function kS(l){var a=l.state,h=l.options,y=h.gpuAcceleration,x=y===void 0?!0:y,T=h.adaptive,v=T===void 0?!0:T,s=h.roundOffsets,I=s===void 0?!0:s,L={placement:ka(a.placement),variation:zc(a.placement),popper:a.elements.popper,popperRect:a.rects.popper,gpuAcceleration:x,isFixed:a.options.strategy==="fixed"};a.modifiersData.popperOffsets!=null&&(a.styles.popper=Object.assign({},a.styles.popper,$0(Object.assign({},L,{offsets:a.modifiersData.popperOffsets,position:a.options.strategy,adaptive:v,roundOffsets:I})))),a.modifiersData.arrow!=null&&(a.styles.arrow=Object.assign({},a.styles.arrow,$0(Object.assign({},L,{offsets:a.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:I})))),a.attributes.popper=Object.assign({},a.attributes.popper,{"data-popper-placement":a.placement})}const DS={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:kS,data:{}};var pd={passive:!0};function LS(l){var a=l.state,h=l.instance,y=l.options,x=y.scroll,T=x===void 0?!0:x,v=y.resize,s=v===void 0?!0:v,I=ji(a.elements.popper),L=[].concat(a.scrollParents.reference,a.scrollParents.popper);return T&&L.forEach(function(O){O.addEventListener("scroll",h.update,pd)}),s&&I.addEventListener("resize",h.update,pd),function(){T&&L.forEach(function(O){O.removeEventListener("scroll",h.update,pd)}),s&&I.removeEventListener("resize",h.update,pd)}}const RS={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:LS,data:{}};var zS={left:"right",right:"left",bottom:"top",top:"bottom"};function Ed(l){return l.replace(/left|right|bottom|top/g,function(a){return zS[a]})}var FS={start:"end",end:"start"};function q0(l){return l.replace(/start|end/g,function(a){return FS[a]})}function Vg(l){var a=ji(l),h=a.pageXOffset,y=a.pageYOffset;return{scrollLeft:h,scrollTop:y}}function Ug(l){return Rc(ts(l)).left+Vg(l).scrollLeft}function OS(l,a){var h=ji(l),y=ts(l),x=h.visualViewport,T=y.clientWidth,v=y.clientHeight,s=0,I=0;if(x){T=x.width,v=x.height;var L=Fx();(L||!L&&a==="fixed")&&(s=x.offsetLeft,I=x.offsetTop)}return{width:T,height:v,x:s+Ug(l),y:I}}function BS(l){var a,h=ts(l),y=Vg(l),x=(a=l.ownerDocument)==null?void 0:a.body,T=sl(h.scrollWidth,h.clientWidth,x?x.scrollWidth:0,x?x.clientWidth:0),v=sl(h.scrollHeight,h.clientHeight,x?x.scrollHeight:0,x?x.clientHeight:0),s=-y.scrollLeft+Ug(l),I=-y.scrollTop;return po(x||h).direction==="rtl"&&(s+=sl(h.clientWidth,x?x.clientWidth:0)-T),{width:T,height:v,x:s,y:I}}function $g(l){var a=po(l),h=a.overflow,y=a.overflowX,x=a.overflowY;return/auto|scroll|overlay|hidden/.test(h+x+y)}function Vx(l){return["html","body","#document"].indexOf(Fa(l))>=0?l.ownerDocument.body:Xi(l)&&$g(l)?l:Vx(Xd(l))}function ph(l,a){var h;a===void 0&&(a=[]);var y=Vx(l),x=y===((h=l.ownerDocument)==null?void 0:h.body),T=ji(y),v=x?[T].concat(T.visualViewport||[],$g(y)?y:[]):y,s=a.concat(v);return x?s:s.concat(ph(Xd(v)))}function hg(l){return Object.assign({},l,{left:l.x,top:l.y,right:l.x+l.width,bottom:l.y+l.height})}function NS(l,a){var h=Rc(l,!1,a==="fixed");return h.top=h.top+l.clientTop,h.left=h.left+l.clientLeft,h.bottom=h.top+l.clientHeight,h.right=h.left+l.clientWidth,h.width=l.clientWidth,h.height=l.clientHeight,h.x=h.left,h.y=h.top,h}function G0(l,a,h){return a===Rx?hg(OS(l,h)):dl(a)?NS(a,h):hg(BS(ts(l)))}function jS(l){var a=ph(Xd(l)),h=["absolute","fixed"].indexOf(po(l).position)>=0,y=h&&Xi(l)?Ch(l):l;return dl(y)?a.filter(function(x){return dl(x)&&Ox(x,y)&&Fa(x)!=="body"}):[]}function VS(l,a,h,y){var x=a==="clippingParents"?jS(l):[].concat(a),T=[].concat(x,[h]),v=T[0],s=T.reduce(function(I,L){var O=G0(l,L,y);return I.top=sl(O.top,I.top),I.right=Fd(O.right,I.right),I.bottom=Fd(O.bottom,I.bottom),I.left=sl(O.left,I.left),I},G0(l,v,y));return s.width=s.right-s.left,s.height=s.bottom-s.top,s.x=s.left,s.y=s.top,s}function Ux(l){var a=l.reference,h=l.element,y=l.placement,x=y?ka(y):null,T=y?zc(y):null,v=a.x+a.width/2-h.width/2,s=a.y+a.height/2-h.height/2,I;switch(x){case xi:I={x:v,y:a.y-h.height};break;case Yi:I={x:v,y:a.y+a.height};break;case Ki:I={x:a.x+a.width,y:s};break;case bi:I={x:a.x-h.width,y:s};break;default:I={x:a.x,y:a.y}}var L=x?jg(x):null;if(L!=null){var O=L==="y"?"height":"width";switch(T){case Dc:I[L]=I[L]-(a[O]/2-h[O]/2);break;case yh:I[L]=I[L]+(a[O]/2-h[O]/2);break}}return I}function _h(l,a){a===void 0&&(a={});var h=a,y=h.placement,x=y===void 0?l.placement:y,T=h.strategy,v=T===void 0?l.strategy:T,s=h.boundary,I=s===void 0?sS:s,L=h.rootBoundary,O=L===void 0?Rx:L,H=h.elementContext,J=H===void 0?ih:H,ee=h.altBoundary,ue=ee===void 0?!1:ee,fe=h.padding,te=fe===void 0?0:fe,Be=Nx(typeof te!="number"?te:jx(te,Ah)),Ae=J===ih?lS:ih,De=l.rects.popper,xe=l.elements[ue?Ae:J],ye=VS(dl(xe)?xe:xe.contextElement||ts(l.elements.popper),I,O,v),Se=Rc(l.elements.reference),Ie=Ux({reference:Se,element:De,placement:x}),Ze=hg(Object.assign({},De,Ie)),Je=J===ih?Ze:Se,Ve={top:ye.top-Je.top+Be.top,bottom:Je.bottom-ye.bottom+Be.bottom,left:ye.left-Je.left+Be.left,right:Je.right-ye.right+Be.right},ft=l.modifiersData.offset;if(J===ih&&ft){var vt=ft[x];Object.keys(Ve).forEach(function(nt){var ct=[Ki,Yi].indexOf(nt)>=0?1:-1,Dt=[xi,Yi].indexOf(nt)>=0?"y":"x";Ve[nt]+=vt[Dt]*ct})}return Ve}function US(l,a){a===void 0&&(a={});var h=a,y=h.placement,x=h.boundary,T=h.rootBoundary,v=h.padding,s=h.flipVariations,I=h.allowedAutoPlacements,L=I===void 0?zx:I,O=zc(y),H=O?s?V0:V0.filter(function(ue){return zc(ue)===O}):Ah,J=H.filter(function(ue){return L.indexOf(ue)>=0});J.length===0&&(J=H);var ee=J.reduce(function(ue,fe){return ue[fe]=_h(l,{placement:fe,boundary:x,rootBoundary:T,padding:v})[ka(fe)],ue},{});return Object.keys(ee).sort(function(ue,fe){return ee[ue]-ee[fe]})}function $S(l){if(ka(l)===Og)return[];var a=Ed(l);return[q0(l),a,q0(a)]}function qS(l){var a=l.state,h=l.options,y=l.name;if(!a.modifiersData[y]._skip){for(var x=h.mainAxis,T=x===void 0?!0:x,v=h.altAxis,s=v===void 0?!0:v,I=h.fallbackPlacements,L=h.padding,O=h.boundary,H=h.rootBoundary,J=h.altBoundary,ee=h.flipVariations,ue=ee===void 0?!0:ee,fe=h.allowedAutoPlacements,te=a.options.placement,Be=ka(te),Ae=Be===te,De=I||(Ae||!ue?[Ed(te)]:$S(te)),xe=[te].concat(De).reduce(function(Xt,Tt){return Xt.concat(ka(Tt)===Og?US(a,{placement:Tt,boundary:O,rootBoundary:H,padding:L,flipVariations:ue,allowedAutoPlacements:fe}):Tt)},[]),ye=a.rects.reference,Se=a.rects.popper,Ie=new Map,Ze=!0,Je=xe[0],Ve=0;Ve<xe.length;Ve++){var ft=xe[Ve],vt=ka(ft),nt=zc(ft)===Dc,ct=[xi,Yi].indexOf(vt)>=0,Dt=ct?"width":"height",Pt=_h(a,{placement:ft,boundary:O,rootBoundary:H,altBoundary:J,padding:L}),We=ct?nt?Ki:bi:nt?Yi:xi;ye[Dt]>Se[Dt]&&(We=Ed(We));var Ut=Ed(We),pt=[];if(T&&pt.push(Pt[vt]<=0),s&&pt.push(Pt[We]<=0,Pt[Ut]<=0),pt.every(function(Xt){return Xt})){Je=ft,Ze=!1;break}Ie.set(ft,pt)}if(Ze)for(var Ht=ue?3:1,ar=function(Tt){var Yt=xe.find(function(pr){var $t=Ie.get(pr);if($t)return $t.slice(0,Tt).every(function(en){return en})});if(Yt)return Je=Yt,"break"},mr=Ht;mr>0;mr--){var Rt=ar(mr);if(Rt==="break")break}a.placement!==Je&&(a.modifiersData[y]._skip=!0,a.placement=Je,a.reset=!0)}}const GS={name:"flip",enabled:!0,phase:"main",fn:qS,requiresIfExists:["offset"],data:{_skip:!1}};function Z0(l,a,h){return h===void 0&&(h={x:0,y:0}),{top:l.top-a.height-h.y,right:l.right-a.width+h.x,bottom:l.bottom-a.height+h.y,left:l.left-a.width-h.x}}function W0(l){return[xi,Ki,Yi,bi].some(function(a){return l[a]>=0})}function ZS(l){var a=l.state,h=l.name,y=a.rects.reference,x=a.rects.popper,T=a.modifiersData.preventOverflow,v=_h(a,{elementContext:"reference"}),s=_h(a,{altBoundary:!0}),I=Z0(v,y),L=Z0(s,x,T),O=W0(I),H=W0(L);a.modifiersData[h]={referenceClippingOffsets:I,popperEscapeOffsets:L,isReferenceHidden:O,hasPopperEscaped:H},a.attributes.popper=Object.assign({},a.attributes.popper,{"data-popper-reference-hidden":O,"data-popper-escaped":H})}const WS={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:ZS};function HS(l,a,h){var y=ka(l),x=[bi,xi].indexOf(y)>=0?-1:1,T=typeof h=="function"?h(Object.assign({},a,{placement:l})):h,v=T[0],s=T[1];return v=v||0,s=(s||0)*x,[bi,Ki].indexOf(y)>=0?{x:s,y:v}:{x:v,y:s}}function XS(l){var a=l.state,h=l.options,y=l.name,x=h.offset,T=x===void 0?[0,0]:x,v=zx.reduce(function(O,H){return O[H]=HS(H,a.rects,T),O},{}),s=v[a.placement],I=s.x,L=s.y;a.modifiersData.popperOffsets!=null&&(a.modifiersData.popperOffsets.x+=I,a.modifiersData.popperOffsets.y+=L),a.modifiersData[y]=v}const YS={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:XS};function KS(l){var a=l.state,h=l.name;a.modifiersData[h]=Ux({reference:a.rects.reference,element:a.rects.popper,placement:a.placement})}const JS={name:"popperOffsets",enabled:!0,phase:"read",fn:KS,data:{}};function QS(l){return l==="x"?"y":"x"}function eE(l){var a=l.state,h=l.options,y=l.name,x=h.mainAxis,T=x===void 0?!0:x,v=h.altAxis,s=v===void 0?!1:v,I=h.boundary,L=h.rootBoundary,O=h.altBoundary,H=h.padding,J=h.tether,ee=J===void 0?!0:J,ue=h.tetherOffset,fe=ue===void 0?0:ue,te=_h(a,{boundary:I,rootBoundary:L,padding:H,altBoundary:O}),Be=ka(a.placement),Ae=zc(a.placement),De=!Ae,xe=jg(Be),ye=QS(xe),Se=a.modifiersData.popperOffsets,Ie=a.rects.reference,Ze=a.rects.popper,Je=typeof fe=="function"?fe(Object.assign({},a.rects,{placement:a.placement})):fe,Ve=typeof Je=="number"?{mainAxis:Je,altAxis:Je}:Object.assign({mainAxis:0,altAxis:0},Je),ft=a.modifiersData.offset?a.modifiersData.offset[a.placement]:null,vt={x:0,y:0};if(Se){if(T){var nt,ct=xe==="y"?xi:bi,Dt=xe==="y"?Yi:Ki,Pt=xe==="y"?"height":"width",We=Se[xe],Ut=We+te[ct],pt=We-te[Dt],Ht=ee?-Ze[Pt]/2:0,ar=Ae===Dc?Ie[Pt]:Ze[Pt],mr=Ae===Dc?-Ze[Pt]:-Ie[Pt],Rt=a.elements.arrow,Xt=ee&&Rt?Ng(Rt):{width:0,height:0},Tt=a.modifiersData["arrow#persistent"]?a.modifiersData["arrow#persistent"].padding:Bx(),Yt=Tt[ct],pr=Tt[Dt],$t=hh(0,Ie[Pt],Xt[Pt]),en=De?Ie[Pt]/2-Ht-$t-Yt-Ve.mainAxis:ar-$t-Yt-Ve.mainAxis,an=De?-Ie[Pt]/2+Ht+$t+pr+Ve.mainAxis:mr+$t+pr+Ve.mainAxis,kn=a.elements.arrow&&Ch(a.elements.arrow),jt=kn?xe==="y"?kn.clientTop||0:kn.clientLeft||0:0,Lr=(nt=ft==null?void 0:ft[xe])!=null?nt:0,ur=We+en-Lr-jt,qr=We+an-Lr,or=hh(ee?Fd(Ut,ur):Ut,We,ee?sl(pt,qr):pt);Se[xe]=or,vt[xe]=or-We}if(s){var Kt,fn=xe==="x"?xi:bi,ti=xe==="x"?Yi:Ki,yn=Se[ye],In=ye==="y"?"height":"width",_n=yn+te[fn],hi=yn-te[ti],On=[xi,bi].indexOf(Be)!==-1,on=(Kt=ft==null?void 0:ft[ye])!=null?Kt:0,Ee=On?_n:yn-Ie[In]-Ze[In]-on+Ve.altAxis,q=On?yn+Ie[In]+Ze[In]-on-Ve.altAxis:hi,V=ee&&On?SS(Ee,yn,q):hh(ee?Ee:_n,yn,ee?q:hi);Se[ye]=V,vt[ye]=V-yn}a.modifiersData[y]=vt}}const tE={name:"preventOverflow",enabled:!0,phase:"main",fn:eE,requiresIfExists:["offset"]};function rE(l){return{scrollLeft:l.scrollLeft,scrollTop:l.scrollTop}}function nE(l){return l===ji(l)||!Xi(l)?Vg(l):rE(l)}function iE(l){var a=l.getBoundingClientRect(),h=Lc(a.width)/l.offsetWidth||1,y=Lc(a.height)/l.offsetHeight||1;return h!==1||y!==1}function aE(l,a,h){h===void 0&&(h=!1);var y=Xi(a),x=Xi(a)&&iE(a),T=ts(a),v=Rc(l,x,h),s={scrollLeft:0,scrollTop:0},I={x:0,y:0};return(y||!y&&!h)&&((Fa(a)!=="body"||$g(T))&&(s=nE(a)),Xi(a)?(I=Rc(a,!0),I.x+=a.clientLeft,I.y+=a.clientTop):T&&(I.x=Ug(T))),{x:v.left+s.scrollLeft-I.x,y:v.top+s.scrollTop-I.y,width:v.width,height:v.height}}function oE(l){var a=new Map,h=new Set,y=[];l.forEach(function(T){a.set(T.name,T)});function x(T){h.add(T.name);var v=[].concat(T.requires||[],T.requiresIfExists||[]);v.forEach(function(s){if(!h.has(s)){var I=a.get(s);I&&x(I)}}),y.push(T)}return l.forEach(function(T){h.has(T.name)||x(T)}),y}function sE(l){var a=oE(l);return _S.reduce(function(h,y){return h.concat(a.filter(function(x){return x.phase===y}))},[])}function lE(l){var a;return function(){return a||(a=new Promise(function(h){Promise.resolve().then(function(){a=void 0,h(l())})})),a}}function cE(l){var a=l.reduce(function(h,y){var x=h[y.name];return h[y.name]=x?Object.assign({},x,y,{options:Object.assign({},x.options,y.options),data:Object.assign({},x.data,y.data)}):y,h},{});return Object.keys(a).map(function(h){return a[h]})}var H0={placement:"bottom",modifiers:[],strategy:"absolute"};function X0(){for(var l=arguments.length,a=new Array(l),h=0;h<l;h++)a[h]=arguments[h];return!a.some(function(y){return!(y&&typeof y.getBoundingClientRect=="function")})}function uE(l){l===void 0&&(l={});var a=l,h=a.defaultModifiers,y=h===void 0?[]:h,x=a.defaultOptions,T=x===void 0?H0:x;return function(s,I,L){L===void 0&&(L=T);var O={placement:"bottom",orderedModifiers:[],options:Object.assign({},H0,T),modifiersData:{},elements:{reference:s,popper:I},attributes:{},styles:{}},H=[],J=!1,ee={state:O,setOptions:function(Be){var Ae=typeof Be=="function"?Be(O.options):Be;fe(),O.options=Object.assign({},T,O.options,Ae),O.scrollParents={reference:dl(s)?ph(s):s.contextElement?ph(s.contextElement):[],popper:ph(I)};var De=sE(cE([].concat(y,O.options.modifiers)));return O.orderedModifiers=De.filter(function(xe){return xe.enabled}),ue(),ee.update()},forceUpdate:function(){if(!J){var Be=O.elements,Ae=Be.reference,De=Be.popper;if(X0(Ae,De)){O.rects={reference:aE(Ae,Ch(De),O.options.strategy==="fixed"),popper:Ng(De)},O.reset=!1,O.placement=O.options.placement,O.orderedModifiers.forEac
1h(function(Ve){return O.modifiersData[Ve.name]=Object.assign({},Ve.data)});for(var xe=0;xe<O.orderedModifiers.length;xe++){if(O.reset===!0){O.reset=!1,xe=-1;continue}var ye=O.orderedModifiers[xe],Se=ye.fn,Ie=ye.options,Ze=Ie===void 0?{}:Ie,Je=ye.name;typeof Se=="function"&&(O=Se({state:O,options:Ze,name:Je,instance:ee})||O)}}}},update:lE(function(){return new Promise(function(te){ee.forceUpdate(),te(O)})}),destroy:function(){fe(),J=!0}};if(!X0(s,I))return ee;ee.setOptions(L).then(function(te){!J&&L.onFirstUpdate&&L.onFirstUpdate(te)});function ue(){O.orderedModifiers.forEach(function(te){var Be=te.name,Ae=te.options,De=Ae===void 0?{}:Ae,xe=te.effect;if(typeof xe=="function"){var ye=xe({state:O,name:Be,instance:ee,options:De}),Se=function(){};H.push(ye||Se)}})}function fe(){H.forEach(function(te){return te()}),H=[]}return ee}}var hE=[RS,JS,DS,bS,YS,GS,tE,IS,WS],pE=uE({defaultModifiers:hE});const wc=(l,a)=>({var:l,varRef:a?`var(${l}, ${a})`:`var(${l})`}),Hn={arrowShadowColor:wc("--popper-arrow-shadow-color"),arrowSize:wc("--popper-arrow-size","8px"),arrowSizeHalf:wc("--popper-arrow-size-half"),arrowBg:wc("--popper-arrow-bg"),transformOrigin:wc("--popper-transform-origin"),arrowOffset:wc("--popper-arrow-offset")};function dE(l){if(l.includes("top"))return"1px 1px 0px 0 var(--popper-arrow-shadow-color)";if(l.includes("bottom"))return"-1px -1px 0px 0 var(--popper-arrow-shadow-color)";if(l.includes("right"))return"-1px 1px 0px 0 var(--popper-arrow-shadow-color)";if(l.includes("left"))return"1px -1px 0px 0 var(--popper-arrow-shadow-color)"}const fE={top:"bottom center","top-start":"bottom left","top-end":"bottom right",bottom:"top center","bottom-start":"top left","bottom-end":"top right",left:"right center","left-start":"right top","left-end":"right bottom",right:"left center","right-start":"left top","right-end":"left bottom"},mE=l=>fE[l],Y0={scroll:!0,resize:!0};function gE(l){let a;return typeof l=="object"?a={enabled:!0,options:{...Y0,...l}}:a={enabled:l,options:Y0},a}const yE={name:"matchWidth",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:({state:l})=>{l.styles.popper.width=`${l.rects.reference.width}px`},effect:({state:l})=>()=>{const a=l.elements.reference;l.elements.popper.style.width=`${a.offsetWidth}px`}},_E={name:"transformOrigin",enabled:!0,phase:"write",fn:({state:l})=>{K0(l)},effect:({state:l})=>()=>{K0(l)}},K0=l=>{l.elements.popper.style.setProperty(Hn.transformOrigin.var,mE(l.placement))},vE={name:"positionArrow",enabled:!0,phase:"afterWrite",fn:({state:l})=>{xE(l)}},xE=l=>{var h;if(!l.placement)return;const a=bE(l.placement);if((h=l.elements)!=null&&h.arrow&&a){Object.assign(l.elements.arrow.style,{[a.property]:a.value,width:Hn.arrowSize.varRef,height:Hn.arrowSize.varRef,zIndex:-1});const y={[Hn.arrowSizeHalf.var]:`calc(${Hn.arrowSize.varRef} / 2 - 1px)`,[Hn.arrowOffset.var]:`calc(${Hn.arrowSizeHalf.varRef} * -1)`};for(const x in y)l.elements.arrow.style.setProperty(x,y[x])}},bE=l=>{if(l.startsWith("top"))return{property:"bottom",value:Hn.arrowOffset.varRef};if(l.startsWith("bottom"))return{property:"top",value:Hn.arrowOffset.varRef};if(l.startsWith("left"))return{property:"right",value:Hn.arrowOffset.varRef};if(l.startsWith("right"))return{property:"left",value:Hn.arrowOffset.varRef}},wE={name:"innerArrow",enabled:!0,phase:"main",requires:["arrow"],fn:({state:l})=>{J0(l)},effect:({state:l})=>()=>{J0(l)}},J0=l=>{if(!l.elements.arrow)return;const a=l.elements.arrow.querySelector("[data-popper-arrow-inner]");if(!a)return;const h=dE(l.placement);h&&a.style.setProperty("--popper-arrow-default-shadow",h),Object.assign(a.style,{transform:"rotate(45deg)",background:Hn.arrowBg.varRef,top:0,left:0,width:"100%",height:"100%",position:"absolute",zIndex:"inherit",boxShadow:"var(--popper-arrow-shadow, var(--popper-arrow-default-shadow))"})},TE={"start-start":{ltr:"left-start",rtl:"right-start"},"start-end":{ltr:"left-end",rtl:"right-end"},"end-start":{ltr:"right-start",rtl:"left-start"},"end-end":{ltr:"right-end",rtl:"left-end"},start:{ltr:"left",rtl:"right"},end:{ltr:"right",rtl:"left"}}
1,SE={"auto-start":"auto-end","auto-end":"auto-start","top-start":"top-end","top-end":"top-start","bottom-start":"bottom-end","bottom-end":"bottom-start"};function EE(l,a="ltr"){var y;const h=((y=TE[l])==null?void 0:y[a])||l;return a==="ltr"?h:SE[l]??h}function $x(l={}){const{enabled:a=!0,modifiers:h,placement:y="bottom",strategy:x="absolute",arrowPadding:T=8,eventListeners:v=!0,offset:s,gutter:I=8,flip:L=!0,boundary:O="clippingParents",preventOverflow:H=!0,matchWidth:J,direction:ee="ltr"}=l,ue=we.useRef(null),fe=we.useRef(null),te=we.useRef(null),Be=EE(y,ee),Ae=we.useRef(()=>{}),De=we.useCallback(()=>{var Ve;!a||!ue.current||!fe.current||((Ve=Ae.current)==null||Ve.call(Ae),te.current=pE(ue.current,fe.current,{placement:Be,modifiers:[wE,vE,_E,{...yE,enabled:!!J},{name:"eventListeners",...gE(v)},{name:"arrow",options:{padding:T}},{name:"offset",options:{offset:s??[0,I]}},{name:"flip",enabled:!!L,options:{padding:8}},{name:"preventOverflow",enabled:!!H,options:{boundary:O}},...h??[]],strategy:x}),te.current.forceUpdate(),Ae.current=te.current.destroy)},[Be,a,h,J,v,T,s,I,L,H,O,x]);we.useEffect(()=>()=>{var Ve;!ue.current&&!fe.current&&((Ve=te.current)==null||Ve.destroy(),te.current=null)},[]);const xe=we.useCallback(Ve=>{ue.current=Ve,De()},[De]),ye=we.useCallback((Ve={},ft=null)=>({...Ve,ref:Qo(xe,ft)}),[xe]),Se=we.useCallback(Ve=>{fe.current=Ve,De()},[De]),Ie=we.useCallback((Ve={},ft=null)=>({...Ve,ref:Qo(Se,ft),style:{...Ve.style,position:x,minWidth:J?void 0:"max-content",inset:"0 auto auto 0"}}),[x,Se,J]),Ze=we.useCallback((Ve={},ft=null)=>{const{size:vt,shadowColor:nt,bg:ct,style:Dt,...Pt}=Ve;return{...Pt,ref:ft,"data-popper-arrow":"",style:PE(Ve)}},[]),Je=we.useCallback((Ve={},ft=null)=>({...Ve,ref:ft,"data-popper-arrow-inner":""}),[]);return{update(){var Ve;(Ve=te.current)==null||Ve.update()},forceUpdate(){var Ve;(Ve=te.current)==null||Ve.forceUpdate()},transformOrigin:Hn.transformOrigin.varRef,referenceRef:xe,popperRef:Se,getPopperProps:Ie,getArrowProps:Ze,getArrowInnerProps:Je,getReferenceProps:ye}}function PE(l){const{size:a,shadowColor:h,bg:y,style:x}=l,T={...x,position:"absolute"};return a&&(T["--popper-arrow-size"]=a),h&&(T["--popper-arrow-shadow-color"]=h),y&&(T["--popper-arrow-bg"]=y),T}function ME(){const l=we.useRef(new Map),a=l.current,h=we.useCallback((x,T,v,s)=>{l.current.set(v,{type:T,el:x,options:s}),x.addEventListener(T,v,s)},[]),y=we.useCallback((x,T,v,s)=>{x.removeEventListener(T,v,s),l.current.delete(v)},[]);return we.useEffect(()=>()=>{a.forEach((x,T)=>{y(x.el,x.type,T,x.options)})},[y,a]),{add:h,remove:y}}function Vm(l){var x,T;const a=((T=(x=l.composedPath)==null?void 0:x.call(l))==null?void 0:T[0])??l.target,{tagName:h,isContentEditable:y}=a;return h!=="INPUT"&&h!=="TEXTAREA"&&y!==!0}function IE(l={}){const{ref:a,isDisabled:h,isFocusable:y,clickOnEnter:x=!0,clickOnSpace:T=!0,onMouseDown:v,onMouseUp:s,onClick:I,onKeyDown:L,onKeyUp:O,tabIndex:H,onMouseOver:J,onMouseLeave:ee,...ue}=l,[fe,te]=we.useState(!0),[Be,Ae]=we.useState(!1),De=ME(),xe=We=>{We&&We.tagName!=="BUTTON"&&te(!1)},ye=fe?H:H||0,Se=h&&!y,Ie=we.useCallback(We=>{if(h){We.stopPropagation(),We.preventDefault();return}We.currentTarget.focus(),I==null||I(We)},[h,I]),Ze=we.useCallback(We=>{Be&&Vm(We)&&(We.preventDefault(),We.stopPropagation(),Ae(!1),De.remove(document,"keyup",Ze,!1))},[Be,De]),Je=we.useCallback(We=>{if(L==null||L(We),h||We.defaultPrevented||We.metaKey||!Vm(We.nativeEvent)||fe)return;const Ut=x&&We.key==="Enter";T&&We.key===" "&&(We.preventDefault(),Ae(!0)),Ut&&(We.preventDefault(),We.currentTarget.click()),De.add(document,"keyup",Ze,!1)},[h,fe,L,x,T,De,Ze]),Ve=we.useCallback(We=>{if(O==null||O(We),h||We.defaultPrevented||We.metaKey||!Vm(We.nativeEvent)||fe)return;T&&We.key===" "&&(We.preventDefault(),Ae(!1),We.currentTarget.click())},[T,fe,h,O]),ft=we.useCallback(We=>{We.button===0&&(Ae(!1),De.remove(document,"mouseup",ft,!1))},[De]),vt=we.useCallback(We=>{if(We.button!==0)return;if(h){We.stopPropagation(),We.preventDefault();return}fe||Ae(!0),We.currentTarget.focus({preventScroll:!0}),De.add(document,"mouseup",ft,!1),v==null||v(We)},[h,fe,v,De,ft]),nt=we.useCallback(We=>{We.button===0&&(fe||Ae(!1),s==null||s(We))},[s,fe]),ct=we.useCallback(We=>{if(h){We.preventDefault();return}J==null||J(We)},[h,J]),Dt=we.useCallback(We=>{Be&&(We.preventDefault(),Ae(!1)),ee==null||ee(We)},[Be,ee]),Pt=Qo(a,xe);return fe?{...ue,ref:Pt,type:"button","aria-disabled":Se?void 0:h,disabled:Se,onClick:Ie,onMouseDown:v,onMouseUp:s,onKeyUp:O,onKeyDown:L,onMouseOver:J,onMouseLeave:ee}:{...ue,ref:Pt,role:"button","data-active":Px(Be),"aria-disabled":h?"true":void 0,tabIndex:Se?void 0:ye,onClick:Ie,onMouseDown:vt,onMouseUp:nt,onKeyUp:Ve,onKeyDown:Je,onMouseOver:ct,onMouseLeave:Dt}}const[AE,CE,kE,DE]=tS(),[LE,kh]=Fg({strict:!1,name:"MenuContext"});function qx(l){return(l==null?void 0:l.ownerDocument)??document}function RE(l){return qx(l).activeElement===l}function zE(l={}){const{id:a,closeOnSelect:h=!0,closeOnBlur:y=!0,initialFocusRef:x,autoSelect:T=!0,isLazy:v,isOpen:s,defaultIsOpen:I,onClose:L,onOpen:O,placement:H="bottom-start",lazyBehavior:J="unmount",direction:ee,computePositionOnMount:ue=!1,...fe}=l,te=we.useRef(null),Be=we.useRef(null),Ae=we.useRef(!0),De=kE(),xe=we.useCallback(()=>{requestAnimationFrame(()=>{var Rt;(Rt=te.current)==null||Rt.focus({preventScroll:!1})})},[]),ye=we.useCallback(()=>{const Rt=setTimeout(()=>{var Xt,Tt;if(x)(Xt=x.current)==null||Xt.focus();else if(!De.count())(Tt=te.current)==null||Tt.focus({preventScroll:!1});else{const Yt=De.firstEnabled();Yt&&ct(Yt.index)}});pt.current.add(Rt)},[De,x]),Se=we.useCallback(()=>{const Rt=setTimeout(()=>{var Xt;if(!De.count())(Xt=te.current)==null||Xt.focus({preventScroll:!1});else{const Tt=De.lastEnabled();Tt&&ct(Tt.index)}});pt.current.add(Rt)},[De]),Ie=we.useCallback(()=>{O==null||O(),T?ye():xe()},[T,ye,xe,O]),{isOpen:Ze,onOpen:Je,onClose:Ve,onToggle:ft}=kx({isOpen:s,defaultIsOpen:I,onClose:L,onOpen:Ie});XT({enabled:Ze&&y,ref:te,handler:Rt=>{var Tt,Yt,pr;const Xt=((Yt=(Tt=Rt.composedPath)==null?void 0:Tt.call(Rt))==null?void 0:Yt[0])??Rt.target;(pr=Be.current)!=null&&pr.contains(Xt)||Ve()}});const vt=$x({...fe,enabled:Ze||ue,placement:H,direction:ee}),[nt,ct]=we.useState(-1);ZT(te,{focusRef:Be,visible:Ze});const Dt=qT({isOpen:Ze,ref:te}),[Pt,We]=HT(a,"menu-button","menu-list"),Ut=we.useCallback(()=>{Je(),xe()},[Je,xe]),pt=we.useRef(new Set([]));we.useEffect(()=>{const Rt=pt.current;return()=>{Rt.forEach(Xt=>clearTimeout(Xt)),Rt.clear()}},[]),sg(()=>{var Rt;Ze||(ct(-1),(Rt=te.current)==null||Rt.scrollTo(0,0))},[Ze]),sg(()=>{Ze&&nt===-1&&xe()},[nt,Ze]),we.useEffect(()=>{var Xt;if(!Ze)return;const Rt=De.item(nt);(Xt=Rt==null?void 0:Rt.node)==null||Xt.focus({preventScroll:!Ae.current})},[De,nt,Ze]);const Ht=we.useCallback(()=>{Je(),ye()},[ye,Je]),ar=we.useCallback(()=>{Ae.current=!0,Je(),Se()},[Je,Se]),mr=we.useCallback(()=>{var pr,$t;const Rt=qx(te.current),Xt=(pr=te.current)==null?void 0:pr.contains(Rt.activeElement);if(!(Ze&&!Xt))return;const Yt=($t=De.item(nt))==null?void 0:$t.node;
1Yt==null||Yt.focus({preventScroll:!Ae.current})},[Ze,nt,De]);return{openAndFocusMenu:Ut,openAndFocusFirstItem:Ht,openAndFocusLastItem:ar,onTransitionEnd:mr,unstable__animationState:Dt,descendants:De,popper:vt,buttonId:Pt,menuId:We,forceUpdate:vt.forceUpdate,orientation:"vertical",isOpen:Ze,onToggle:ft,onOpen:Je,onClose:Ve,menuRef:te,buttonRef:Be,focusedIndex:nt,closeOnSelect:h,closeOnBlur:y,autoSelect:T,setFocusedIndex:ct,isLazy:v,lazyBehavior:J,initialFocusRef:x,scrollIntoViewRef:Ae}}function FE(l={},a=null){const h=kh(),{onToggle:y,popper:x,openAndFocusFirstItem:T,openAndFocusLastItem:v,scrollIntoViewRef:s}=h,I=we.useCallback(L=>{const O=L.key,J={Enter:T,ArrowDown:T,ArrowUp:v}[O];J&&(s.current=!0,L.preventDefault(),L.stopPropagation(),J(L))},[T,v,s]);return{...l,ref:Qo(h.buttonRef,a,x.referenceRef),id:h.buttonId,"data-active":Px(h.isOpen),"aria-expanded":h.isOpen,"aria-haspopup":"menu","aria-controls":h.menuId,onClick:Ho(l.onClick,y),onKeyDown:Ho(l.onKeyDown,I)}}function pg(l){var a;return jE(l)&&!!((a=l==null?void 0:l.getAttribute("role"))!=null&&a.startsWith("menuitem"))}function OE(l={},a=null){const h=kh();if(!h)throw new Error("useMenuContext: context is undefined. Seems you forgot to wrap component within <Menu>");const{focusedIndex:y,setFocusedIndex:x,menuRef:T,isOpen:v,onClose:s,menuId:I,isLazy:L,lazyBehavior:O,scrollIntoViewRef:H,unstable__animationState:J}=h,ee=CE(),ue=oS({preventDefault:Ae=>Ae.key!==" "&&pg(Ae.target)}),fe=we.useCallback(Ae=>{if(!Ae.currentTarget.contains(Ae.target))return;const De=Ae.key,ye={Tab:Ie=>Ie.preventDefault(),Escape:Ie=>{Ie.stopPropagation(),s()},ArrowDown:()=>{H.current=!0;const Ie=ee.nextEnabled(y)??ee.firstEnabled();Ie&&x(Ie.index)},ArrowUp:()=>{H.current=!0;const Ie=ee.prevEnabled(y)??ee.firstEnabled();Ie&&x(Ie.index)}}[De];if(ye){Ae.preventDefault(),ye(Ae);return}const Se=ue(Ie=>{const Ze=iS(ee.values(),Ie,Je=>{var Ve;return((Ve=Je==null?void 0:Je.node)==null?void 0:Ve.textContent)??""},ee.item(y));if(Ze){const Je=ee.indexOf(Ze.node);x(Je)}});pg(Ae.target)&&Se(Ae)},[ee,y,ue,s,x,H]),te=we.useRef(!1);v&&(te.current=!0);const Be=VT({wasSelected:te.current,enabled:L,mode:O,isSelected:J.present});return{...l,ref:Qo(T,a),children:Be?l.children:null,tabIndex:-1,role:"menu",id:I,style:{...l.style,transformOrigin:"var(--popper-transform-origin)"},"aria-orientation":"vertical",onKeyDown:Ho(l.onKeyDown,fe)}}function BE(l={}){const{popper:a,isOpen:h}=kh();return a.getPopperProps({...l,style:{visibility:h?"visible":"hidden",...l.style}})}function NE(l={},a=null){const{onMouseEnter:h,onMouseMove:y,onMouseLeave:x,onClick:T,onFocus:v,isDisabled:s,isFocusable:I,closeOnSelect:L,type:O,...H}=l,J=kh(),{setFocusedIndex:ee,focusedIndex:ue,closeOnSelect:fe,onClose:te,menuId:Be,scrollIntoViewRef:Ae}=J,De=we.useRef(null),xe=`${Be}-menuitem-${we.useId()}`,{index:ye,register:Se}=DE({disabled:s&&!I}),Ie=we.useCallback(ct=>{h==null||h(ct),!s&&(Ae.current=!1,ee(ye))},[ee,ye,s,h,Ae]),Ze=we.useCallback(ct=>{y==null||y(ct),De.current&&!RE(De.current)&&Ie(ct)},[Ie,y]),Je=we.useCallback(ct=>{x==null||x(ct),!s&&ee(-1)},[ee,s,x]),Ve=we.useCallback(ct=>{T==null||T(ct),pg(ct.currentTarget)&&(L??fe)&&te()},[te,T,fe,L]),ft=we.useCallback(ct=>{v==null||v(ct),ee(ye)},[ee,v,ye]),vt=ye===ue,nt=IE({onClick:Ve,onFocus:ft,onMouseEnter:Ie,onMouseMove:Ze,onMouseLeave:Je,ref:Qo(Se,De,a),isDisabled:s,isFocusable:I});return{...H,...nt,type:O??nt.type,id:xe,role:"menuitem",tabIndex:vt?0:-1}}function jE(l){if(!VE(l))return!1;const a=l.ownerDocument.defaultView??window;return l instanceof a.HTMLElement}function VE(l){return l!=null&&typeof l=="object"&&"nodeType"in l&&l.nodeType===Node.ELEMENT_NODE}const[UE,Dh]=Fg({name:"MenuStylesContext",errorMessage:`useMenuStyles returned is 'undefined'. Seems you forgot to wrap the components in "<Menu />" `}),qg=l=>{const{children:a}=l,h=bT("Menu",l),y=zg(l),{direction:x}=Ex(),{descendants:T,...v}=zE({...y,direction:x}),s=we.useMemo(()=>v,[v]),{isOpen:I,onClose:L,forceUpdate:O}=s;return Re.jsx(AE,{value:T,children:Re.jsx(LE,{value:s,children:Re.jsx(UE,{value:h,children:wT(a,{isOpen:I,onClose:L,forceUpdate:O})})})})};qg.displayName="Menu";const $E=Oa((l,a)=>{const h=Dh();return Re.jsx(ei.button,{ref:a,...l,__css:{display:"inline-flex",appearance:"none",alignItems:"center",outline:0,...h.button}})}),Gg=Oa((l,a)=>{const{children:h,as:y,...x}=l,T=FE(x,a),v=y||$E;return Re.jsx(v,{...T,className:kc("chakra-menu__menu-button",l.className),children:Re.jsx(ei.span,{__css:{pointerEvents:"none",flex:"1 1 auto",minW:0},children:l.children})})});Gg.displayName="MenuButton";const Gx=Oa((l,a)=>{const h=Dh();return Re.jsx(ei.span,{ref:a,...l,__css:h.command,className:"chakra-menu__command"})});Gx.displayName="MenuCommand";const Zx=l=>{const{className:a,children:h,...y}=l,x=Dh(),T=we.Children.only(h),v=we.isValidElement(T)?we.cloneElement(T,{focusable:"false","aria-hidden":!0,
1className:kc("chakra-menu__icon",T.props.className)}):null,s=kc("chakra-menu__icon-wrapper",a);return Re.jsx(ei.span,{className:s,...y,__css:x.icon,children:v})};Zx.displayName="MenuIcon";const qE=Oa((l,a)=>{const{type:h,...y}=l,x=Dh(),T=y.as||h?h??void 0:"button",v=we.useMemo(()=>({textDecoration:"none",color:"inherit",userSelect:"none",display:"flex",width:"100%",alignItems:"center",textAlign:"start",flex:"0 0 auto",outline:0,...x.item}),[x.item]);return Re.jsx(ei.button,{ref:a,type:T,...y,__css:v})}),Zg=Oa((l,a)=>{const{icon:h,iconSpacing:y="0.75rem",command:x,commandSpacing:T="0.75rem",children:v,...s}=l,I=NE(s,a),O=h||x?Re.jsx("span",{style:{pointerEvents:"none",flex:1},children:v}):v;return Re.jsxs(qE,{...I,className:kc("chakra-menu__menuitem",I.className),children:[h&&Re.jsx(Zx,{fontSize:"0.8em",marginEnd:y,children:h}),O,x&&Re.jsx(Gx,{marginStart:T,children:x})]})});Zg.displayName="MenuItem";const GE={enter:{visibility:"visible",opacity:1,scale:1,transition:{duration:.2,ease:[.4,0,.2,1]}},exit:{transitionEnd:{visibility:"hidden"},opacity:0,scale:.8,transition:{duration:.1,easings:"easeOut"}}},ZE=ei(Mx.div),Wg=Oa(function(a,h){var J;const{rootProps:y,motionProps:x,...T}=a,{isOpen:v,onTransitionEnd:s,unstable__animationState:I}=kh(),L=OE(T,h),O=BE(y),H=Dh();return Re.jsx(ei.div,{...O,__css:{zIndex:a.zIndex??((J=H.list)==null?void 0:J.zIndex)},children:Re.jsx(ZE,{variants:GE,initial:!1,animate:v?"enter":"exit",__css:{outline:0,...H.list},...x,...L,className:kc("chakra-menu__menu-list",L.className),onUpdate:s,onAnimationComplete:LT(I.onComplete,L.onAnimationComplete)})})});Wg.displayName="MenuList";function WE(l){var h;const a=we.version;return typeof a!="string"||a.startsWith("18.")?l==null?void 0:l.ref:(h=l==null?void 0:l.props)==null?void 0:h.ref}const HE={exit:{scale:.85,opacity:0,transition:{opacity:{duration:.15,easings:"easeInOut"},scale:{duration:.2,easings:"easeInOut"}}},enter:{scale:1,opacity:1,transition:{opacity:{easings:"easeOut",duration:.2},scale:{duration:.2,ease:[.175,.885,.4,1.1]}}}},dg=l=>{var a;return((a=l.current)==null?void 0:a.ownerDocument)||document},Pd=l=>{var a,h;return((h=(a=l.current)==null?void 0:a.ownerDocument)==null?void 0:h.defaultView)||window};function XE(l={}){const{openDelay:a=0,closeDelay:h=0,closeOnClick:y=!0,closeOnMouseDown:x,closeOnScroll:T,closeOnPointerDown:v=x,closeOnEsc:s=!0,onOpen:I,onClose:L,placement:O,id:H,isOpen:J,defaultIsOpen:ee,arrowSize:ue=10,arrowShadowColor:fe,arrowPadding:te,modifiers:Be,isDisabled:Ae,gutter:De,offset:xe,direction:ye,...Se}=l,{isOpen:Ie,onOpen:Ze,onClose:Je}=kx({isOpen:J,defaultIsOpen:ee,onOpen:I,onClose:L}),{referenceRef:Ve,getPopperProps:ft,getArrowInnerProps:vt,getArrowProps:nt}=$x({enabled:Ie,placement:O,arrowPadding:te,modifiers:Be,gutter:De,offset:xe,direction:ye}),ct=we.useId(),Pt=`tooltip-${H??ct}`,We=we.useRef(null),Ut=we.useRef(void 0),pt=we.useCallback(()=>{Ut.current&&(clearTimeout(Ut.current),Ut.current=void 0)},[]),Ht=we.useRef(void 0),ar=we.useCallback(()=>{Ht.current&&(clearTimeout(Ht.current),Ht.current=void 0)},[]),mr=we.useCallback(()=>{ar(),Je()},[Je,ar]),Rt=YE(We,mr),Xt=we.useCallback(()=>{if(!Ae&&!Ut.current){Ie&&Rt();const jt=Pd(We);Ut.current=jt.setTimeout(Ze,a)}},[Rt,Ae,Ie,Ze,a]),Tt=we.useCallback(()=>{pt();const jt=Pd(We);Ht.current=jt.setTimeout(mr,h)},[h,mr,pt]),Yt=we.useCallback(()=>{Ie&&y&&Tt()},[y,Tt,Ie]),pr=we.useCallback(()=>{Ie&&v&&Tt()},[v,Tt,Ie]),$t=we.useCallback(jt=>{Ie&&jt.key==="Escape"&&Tt()},[Ie,Tt]);Sd(()=>dg(We),"keydown",s?$t:void 0),Sd(()=>{if(!T)return null;const jt=We.current;if(!jt)return null;const Lr=Cx(jt);return Lr.localName==="body"?Pd(We):Lr},"scroll",()=>{Ie&&T&&mr()},{passive:!0,capture:!0}),we.useEffect(()=>{Ae&&(pt(),Ie&&Je())},[Ae,Ie,Je,pt]),we.useEffect(()=>()=>{pt(),ar()},[pt,ar]),Sd(()=>We.current,"pointerleave",Tt);const en=we.useCallback((jt={},Lr=null)=>({...jt,ref:Qo(We,Lr,Ve),onPointerEnter:Ho(jt.onPointerEnter,qr=>{qr.pointerType!=="touch"&&Xt()}),onClick:Ho(jt.onClick,Yt),onPointerDown:Ho(jt.onPointerDown,pr),onFocus:Ho(jt.onFocus,Xt),onBlur:Ho(jt.onBlur,Tt),"aria-describedby":Ie?Pt:void 0}),[Xt,Tt,pr,Ie,Pt,Yt,Ve]),an=we.useCallback((jt={},Lr=null)=>ft({...jt,style:{...jt.style,[Hn.arrowSize.var]:ue?`${ue}px`:void 0,[Hn.arrowShadowColor.var]:fe}},Lr),[ft,ue,fe]),kn=we.useCallback((jt={},Lr=null)=>{const ur={...jt.style,position:"relative",transformOrigin:Hn.transformOrigin.varRef};return{ref:Lr,...Se,...jt,id:Pt,role:"tooltip",style:ur}},[Se,Pt]);return{isOpen:Ie,show:Xt,hide:Tt,getTriggerProps:en,getTooltipProps:kn,getTooltipPositionerProps:an,getArrowProps:nt,getArrowInnerProps:vt}}const Um="chakra-ui:close-tooltip";function YE(l,a){return we.useEffect(()=>{const h=dg(l);return h.addEventListener(Um,a),()=>h.removeEventListener(Um,a)},[a,l]),()=>{const h=dg(l),y=Pd(l);h.dispatchEvent(new y.CustomEvent(Um))}}const KE=ei(Mx.div),Wx=Oa((l,a)=>{const h=Tx("Tooltip",l),y=zg(l),x=Ex(),{children:T,label:v,shouldWrapChildren:s,"aria-label":I,hasArrow:L,bg:O,portalProps:H,background:J,backgroundColor:ee,bgColor:ue,motionProps:fe,animatePresenceProps:te,...Be}=y,Ae=J??ee??O??ue;if(Ae){h.bg=Ae;const Ve=YT(x,"colors",Ae);h[Hn.arrowBg.var]=Ve}const De=XE({...Be,direction:x.direction}),xe=!we.isValidElement(T)||s;let ye;if(xe)ye=Re.jsx(ei.span,{display:"inline-block",tabIndex:0,...De.getTr
1iggerProps(),children:T});else{const Ve=we.Children.only(T);ye=we.cloneElement(Ve,De.getTriggerProps(Ve.props,WE(Ve)))}const Se=!!I,Ie=De.getTooltipProps({},a),Ze=Se?Sx(Ie,["role","id"]):Ie,Je=DT(Ie,["role","id"]);return v?Re.jsxs(Re.Fragment,{children:[ye,Re.jsx(RT,{...te,children:De.isOpen&&Re.jsx(zT,{...H,children:Re.jsx(ei.div,{...De.getTooltipPositionerProps(),__css:{zIndex:h.zIndex,pointerEvents:"none"},children:Re.jsxs(KE,{variants:HE,initial:"exit",animate:"enter",exit:"exit",...fe,...Ze,__css:h,children:[v,Se&&Re.jsx(ei.span,{srOnly:!0,...Je,children:I}),L&&Re.jsx(ei.div,{"data-popper-arrow":!0,className:"chakra-tooltip__arrow-wrapper",children:Re.jsx(ei.div,{"data-popper-arrow-inner":!0,className:"chakra-tooltip__arrow",__css:{bg:h.bg}})})]})})})})]}):Re.jsx(Re.Fragment,{children:T})});Wx.displayName="Tooltip";var Md={exports:{}};/**
2 * MapLibre GL JS
3 * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v5.16.0/LICENSE.txt
4 */var JE=Md.exports,Q0;function QE(){return Q0||(Q0=1,(function(l,a){(function(h,y){l.exports=y()})(JE,(function(){var h={},y={};function x(v,s,I){if(y[v]=I,v==="index"){var L="var sharedModule = {}; ("+y.shared+")(sharedModule); ("+y.worker+")(sharedModule);",O={};return y.shared(O),y.index(h,O),typeof window<"u"&&h.setWorkerUrl(window.URL.createObjectURL(new Blob([L],{type:"text/javascript"}))),h}}x("shared",["exports"],(function(v){function s(n,e,r,o){return new(r||(r=Promise))((function(u,d){function f(E){try{w(o.next(E))}catch(M){d(M)}}function _(E){try{w(o.throw(E))}catch(M){d(M)}}function w(E){var M;E.done?u(E.value):(M=E.value,M instanceof r?M:new r((function(C){C(M)}))).then(f,_)}w((o=o.apply(n,e||[])).next())}))}function I(n,e){this.x=n,this.y=e}function L(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var O,H;typeof SuppressedError=="function"&&SuppressedError,I.prototype={clone(){return new I(this.x,this.y)},add(n){return this.clone()._add(n)},sub(n){return this.clone()._sub(n)},multByPoint(n){return this.clone()._multByPoint(n)},divByPoint(n){return this.clone()._divByPoint(n)},mult(n){return this.clone()._mult(n)},div(n){return this.clone()._div(n)},rotate(n){return this.clone()._rotate(n)},rotateAround(n,e){return this.clone()._rotateAround(n,e)},matMult(n){return this.clone()._matMult(n)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(n){return this.x===n.x&&this.y===n.y},dist(n){return Math.sqrt(this.distSqr(n))},distSqr(n){const e=n.x-this.x,r=n.y-this.y;return e*e+r*r},angle(){return Math.atan2(this.y,this.x)},angleTo(n){return Math.atan2(this.y-n.y,this.x-n.x)},angleWith(n){return this.angleWithSep(n.x,n.y)},angleWithSep(n,e){return Math.atan2(this.x*e-this.y*n,this.x*n+this.y*e)},_matMult(n){const e=n[2]*this.x+n[3]*this.y;return this.x=n[0]*this.x+n[1]*this.y,this.y=e,this},_add(n){return this.x+=n.x,this.y+=n.y,this},_sub(n){return this.x-=n.x,this.y-=n.y,this},_mult(n){return this.x*=n,this.y*=n,this},_div(n){return this.x/=n,this.y/=n,this},_multByPoint(n){return this.x*=n.x,this.y*=n.y,this},_divByPoint(n){return this.x/=n.x,this.y/=n.y,this},_unit(){return this._div(this.mag()),this},_perp(){const n=this.y;return this.y=this.x,this.x=-n,this},_rotate(n){const e=Math.cos(n),r=Math.sin(n),o=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=o,this},_rotateAround(n,e){const r=Math.cos(n),o=Math.sin(n),u=e.y+o*(this.x-e.x)+r*(this.y-e.y);
vendor: 13,657 bytes, line 4
4return this.x=e.x+r*(this.x-e.x)-o*(this.y-e.y),this.y=u,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:I},I.convert=function(n){if(n instanceof I)return n;if(Array.isArray(n))return new I(+n[0],+n[1]);if(n.x!==void 0&&n.y!==void 0)return new I(+n.x,+n.y);throw new Error("Expected [x, y] or {x, y} point format")};var J=(function(){if(H)return O;function n(e,r,o,u){this.cx=3*e,this.bx=3*(o-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(u-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=r,this.p2x=o,this.p2y=u}return H=1,O=n,n.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,r){if(r===void 0&&(r=1e-6),e<0)return 0;if(e>1)return 1;for(var o=e,u=0;u<8;u++){var d=this.sampleCurveX(o)-e;if(Math.abs(d)<r)return o;var f=this.sampleCurveDerivativeX(o);if(Math.abs(f)<1e-6)break;o-=d/f}var _=0,w=1;for(o=e,u=0;u<20&&(d=this.sampleCurveX(o),!(Math.abs(d-e)<r));u++)e>d?_=o:w=o,o=.5*(w-_)+_;return o},solve:function(e,r){return this.sampleCurveY(this.solveCurveX(e,r))}},O})(),ee=L(J);let ue,fe;function te(){return ue==null&&(ue=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),ue}function Be(){if(fe==null&&(fe=!1,te())){const e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let o=0;o<25;o++){const u=4*o;e.fillStyle=`rgb(${u},${u+1},${u+2})`,e.fillRect(o%5,Math.floor(o/5),1,1)}const r=e.getImageData(0,0,5,5).data;for(let o=0;o<100;o++)if(o%4!=3&&r[o]!==o){fe=!0;break}}}return fe||!1}var Ae=1e-6,De=typeof Float32Array<"u"?Float32Array:Array;function xe(){var n=new De(9);return De!=Float32Array&&(n[1]=0,n[2]=0,n[3]=0,n[5]=0,n[6]=0,n[7]=0),n[0]=1,n[4]=1,n[8]=1,n}function ye(n){return n[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n}function Se(){var n=new De(3);return De!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n}function Ie(n){var e=n[0],r=n[1],o=n[2];return Math.sqrt(e*e+r*r+o*o)}function Ze(n,e,r){var o=new De(3);return o[0]=n,o[1]=e,o[2]=r,o}function Je(n,e,r){return n[0]=e[0]+r[0],n[1]=e[1]+r[1],n[2]=e[2]+r[2],n}function Ve(n,e,r){return n[0]=e[0]*r,n[1]=e[1]*r,n[2]=e[2]*r,n}function ft(n,e,r){var o=e[0],u=e[1],d=e[2],f=r[0],_=r[1],w=r[2];return n[0]=u*w-d*_,n[1]=d*f-o*w,n[2]=o*_-u*f,n}var vt,nt=Ie;function ct(n,e,r){var o=e[0],u=e[1],d=e[2],f=e[3];return n[0]=r[0]*o+r[4]*u+r[8]*d+r[12]*f,n[1]=r[1]*o+r[5]*u+r[9]*d+r[13]*f,n[2]=r[2]*o+r[6]*u+r[10]*d+r[14]*f,n[3]=r[3]*o+r[7]*u+r[11]*d+r[15]*f,n}function Dt(){var n=new De(4);return De!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n[3]=1,n}function Pt(n,e,r,o){var u=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"zyx",d=Math.PI/360;e*=d,o*=d,r*=d;var f=Math.sin(e),_=Math.cos(e),w=Math.sin(r),E=Math.cos(r),M=Math.sin(o),C=Math.cos(o);switch(u){case"xyz":n[0]=f*E*C+_*w*M,n[1]=_*w*C-f*E*M,n[2]=_*E*M+f*w*C,n[3]=_*E*C-f*w*M;break;case"xzy":n[0]=f*E*C-_*w*M,n[1]=_*w*C-f*E*M,n[2]=_*E*M+f*w*C,n[3]=_*E*C+f*w*M;break;case"yxz":n[0]=f*E*C+_*w*M,n[1]=_*w*C-f*E*M,n[2]=_*E*M-f*w*C,n[3]=_*E*C+f*w*M;break;case"yzx":n[0]=f*E*C+_*w*M,n[1]=_*w*C+f*E*M,n[2]=_*E*M-f*w*C,n[3]=_*E*C-f*w*M;break;case"zxy":n[0]=f*E*C-_*w*M,n[1]=_*w*C+f*E*M,n[2]=_*E*M+f*w*C,n[3]=_*E*C-f*w*M;break;case"zyx":n[0]=f*E*C-_*w*M,n[1]=_*w*C+f*E*M,n[2]=_*E*M-f*w*C,n[3]=_*E*C+f*w*M;break;default:throw new Error("Unknown angle order "+u)}return n}function We(){var n=new De(2);return De!=Float32Array&&(n[0]=0,n[1]=0),n}function Ut(n,e){var r=new De(2);return r[0]=n,r[1]=e,r}Se(),vt=new De(4),De!=Float32Array&&(vt[0]=0,vt[1]=0,vt[2]=0,vt[3]=0),Se(),Ze(1,0,0),Ze(0,1,0),Dt(),Dt(),xe(),We();const pt=8192;function Ht(n,e,r){return e*(pt/(n.tileSize*Math.pow(2,r-n.tileID.overscaledZ)))}function ar(n,e){return(n%e+e)%e}function mr(n,e,r){return n*(1-r)+e*r}function Rt(n){if(n<=0)return 0;if(n>=1)return 1;const e=n*n,r=e*n;return 4*(n<.5?r:3*(n-e)+r-.75)}function Xt(n,e,r,o){const u=new ee(n,e,r,o);return d=>u.solve(d)}const Tt=Xt(.25,.1,.25,1);function Yt(n,e,r){return Math.min(r,Math.max(e,n))}function pr(n,e,r){const o=r-e,u=((n-e)%o+o)%o+e;return u===e?r:u}function $t(n,...e){for(const r of e)for(const o in r)n[o]=r[o];return n}let en=1;function an(n,e,r){const o={};for(const u in n)o[u]=e.call(this,n[u],u,n);return o}function kn(n,e,r){const o={};for(const u in n)e.call(this,n[u],u,n)&&(o[u]=n[u]);return o}function jt(n){return Array.isArray(n)?n.map(jt):typeof n=="object"&&n?an(n,jt):n}const Lr={};function ur(n){Lr[n]||(typeof console<"u"&&console.warn(n),Lr[n]=!0)}function qr(n,e,r){return(r.y-n.y)*(e.x-n.x)>(e.y-n.y)*(r.x-n.x)}function or(n){return typeof WorkerGlobalScope<"u"&&n!==void 0&&n instanceof WorkerGlobalScope}let Kt=null;function fn(n){return typeof ImageBitmap<"u"&&n instanceof ImageBitmap}const ti="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function yn(n,e,r,o,u){return s(this,void 0,void 0,(function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const d=new VideoFrame(n,{timestamp:0});try{const f=d==null?void 0:d.format;if(!f||!f.startsWith("BGR")&&!f.startsWith("RGB"))throw new Error(`Unrecognized format ${f}`);const _=f.startsWith("BGR"),w=new Uint8ClampedArray(o*u*4);if(yield d.copyTo(w,(function(E,M,C,D,R){const B=4*Math.max(-M,0),N=(Math.max(0,C)-C)*D*4+B,U=4*D,Z=Math.max(0,M),ae=Math.max(0,C);return{rect:{x:Z,y:ae,width:Math.min(E.width,M+D)-Z,height:Math.min(E.height,C+R)-ae},layout:[{offset:N,stride:U}]}})(n,e,r,o,u)),_)for(let E=0;E<w.length;E+=4){const M=w[E];w[E]=w[E+2],w[E+2]=M}return w}finally{d.close()}}))}let In,_n;function hi(n,e,r,o){return n.addEventListener(e,r,o),{unsubscribe:()=>{n.removeEventListener(e,r,o)}}}function On(n){return n*Math.PI/180}function on(n){return n/Math.PI*180}const Ee={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},q={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},V="AbortError";class $ extends Error{constructor(e=V){super(e instanceof Error?e.message:e),this.name=V,e instanceof Error&&e.stack&&(this.stack=e.stack)}}function re(n){return n.name===V}const se={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function _e(n){return se.REGISTERED_PROTOCOLS[n.substring(0,n.indexOf("://"))]}const me="global-dispatcher";class ne extends Error{constructor(e,r,o,u){super(`AJAXError: ${r} (${e}): ${o}`),this.status=e,this.statusText=r,this.url=o,this.body=u}}const be=()=>or(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,je=function(n,e){if(/:\/\//.test(n.url)&&!/^https?:|^file:/.test(n.url)){const o=_e(n.url);if(o)return o(n,e);if(or(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:n,targetMapId:me},e)}if(!(/^file:/.test(r=n.url)||/^file:/.test(be())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return(function(o,u){return s(this,void 0,void 0,(function*(){const d=new Request(o.url,{method:o.method||"GET",body:o.body,credentials:o.credentials,headers:o.headers,cache:o.cache,referrer:be(),signal:u.signal});let f,_;o.type!=="json"||d.headers.has("Accept")||d.headers.set("Accept","application/json");try{f=yield fetch(d)}catch(E){throw re(E)?E:new ne(0,E.message,o.url,new Blob)}if(!f.ok){const E=yield f.blob();throw new ne(f.status,f.statusText,o.url,E)}_=o.type==="arrayBuffer"||o.type==="image"?f.arrayBuffer():o.type==="json"?f.json():f.text();const w=yield _;return u.signal.throwIfAborted(),{data:w,cacheControl:f.headers.get("Cache-Control"),expires:f.headers.get("Expires")}}))})(n,e);if(or(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:n,mustQueue:!0,targetMapId:me},e)}var r;return(function(o,u){return new Promise(((d,f)=>{var _;const w=new XMLHttpRequest;w.open(o.method||"GET",o.url,!0),o.type!=="arrayBuffer"&&o.type!=="image"||(w.responseType="arraybuffer");for(const E in o.headers)w.setRequestHeader(E,o.headers[E]);o.type==="json"&&(w.responseType="text",!((_=o.headers)===null||_===void 0)&&_.Accept||w.setRequestHeader("Accept","application/json")),w.withCredentials=o.credentials==="include",w.onerror=()=>{f(new Error(w.statusText))},w.onload=()=>{if(!u.signal.aborted)if((w.status>=200&&w.status<300||w.status===0)&&w.response!==null){let E=w.response;if(o.type==="json")try{E=JSON.parse(w.response)}catch(M){return void f(M)}d({data:E,cacheControl:w.getResponseHeader("Cache-Control"),expires:w.getResponseHeader("Expires")})}else{const E=new Blob([w.response],{type:w.getResponseHeader("Content-Type")});f(new ne(w.status,w.statusText,o.url,E))}},u.signal.addEventListener("abort",(()=>{w.abort(),f(new $(u.signal.reason))})),w.send(o.body)}))})(n,e)};function Pe(n){if(!n||n.indexOf("://")<=0||n.indexOf("data:image/")===0||n.indexOf("blob:")===0)return!0;const e=new URL(n),r=window.location;return e.protocol===r.protocol&&e.host===r.host}function Ye(n,e,r){r[n]&&r[n].indexOf(e)!==-1||(r[n]=r[n]||[],r[n].push(e))}function it(n,e,r){if(r&&r[n]){const o=r[n].indexOf(e);o!==-1&&r[n].splice(o,1)}}class rt{constructor(e,r={}){$t(this,r),this.type=e}}class At extends rt{constructor(e,r={}){super("error",$t({error:e},r))}}class St{on(e,r){return this._listeners=this._listeners||{},Ye(e,r,this._listeners),{unsubscribe:()=>{this.off(e,r)}}}off(e,r){return it(e,r,this._listeners),it(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},Ye(e,r,this._oneTimeListeners),this):new Promise((o=>this.once(e,o)))}fire(e,r){typeof e=="string"&&(e=new rt(e,r||{}));const o=e.type;if(this.listens(o)){e.target=this;const u=this._listeners&&this._listeners[o]?this._listeners[o].slice():[];for(const _ of u)_.call(this,e);const d=this._oneTimeListeners&&this._oneTimeListeners[o]?this._oneTimeListeners[o].slice():[];for(const _ of d)it(o,_,this._oneTimeListeners),_.call(this,e);const f=this._eventedParent;f&&($t(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),f.fire(e))}else e instanceof At&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,r){return this._eventedParent=e,this._eventedParentData=r,this}}var Te={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},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"},"font-faces":{type:"fontFaces"},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},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{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:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0}
vendor: 3,280 bytes, line 4
4,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",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-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",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-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",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-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",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-
vendor: 8,538 bytes, line 4
4constant"}},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",
vendor: 6,583 bytes, line 4
4expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},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:"expression_name",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","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
vendor: 8,689 bytes, line 4
4"},"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","feature"]},"property-type":"cross-faded-data-driven"},"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"},
vendor: 5,130 bytes, line 4
4"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:"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"}},"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"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}};const Et=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Lt(n,e){const r={};for(const o in n)o!=="ref"&&(r[o]=n[o]);return Et.forEach((o=>{o in e&&(r[o]=e[o])})),r}function yt(n,e){if(Array.isArray(n)){if(!Array.isArray(e)||n.length!==e.length)return!1;for(let r=0;r<n.length;r++)if(!yt(n[r],e[r]))return!1;return!0}if(typeof n=="object"&&n!==null&&e!==null){if(typeof e!="object"||Object.keys(n).length!==Object.keys(e).length)return!1;for(const r in n)if(!yt(n[r],e[r]))return!1;return!0}return n===e}function tr(n,e){n.push(e)}function sn(n,e,r){tr(r,{command:"addSource",args:[n,e[n]]})}function Er(n,e,r){tr(e,{command:"removeSource",args:[n]}),r[n]=!0}function Or(n,e,r,o){Er(n,r,o),sn(n,e,r)}function gr(n,e,r){let o;for(o in n[r])if(Object.prototype.hasOwnProperty.call(n[r],o)&&o!=="data"&&!yt(n[r][o],e[r][o]))return!1;for(o in e[r])if(Object.prototype.hasOwnProperty.call(e[r],o)&&o!=="data"&&!yt(n[r][o],e[r][o]))return!1;return!0}function ln(n,e,r,o,u,d){n=n||{},e=e||{};for(const f in n)Object.prototype.hasOwnProperty.call(n,f)&&(yt(n[f],e[f])||r.push({command:d,args:[o,f,e[f],u]}));for(const f in e)Object.prototype.hasOwnProperty.call(e,f)&&!Object.prototype.hasOwnProperty.call(n,f)&&(yt(n[f],e[f])||r.push({command:d,args:[o,f,e[f],u]}))}function ns(n){return n.id}function is(n,e){return n[e.id]=e,n}class He{constructor(e,r,o,u){this.message=(e?`${e}: `:"")+o,u&&(this.identifier=u),r!=null&&r.__line__&&(this.line=r.__line__)}}function Bn(n,...e){for(const r of e)for(const o in r)n[o]=r[o];return n}
vendor: 16,230 bytes, line 4
4class Nn extends Error{constructor(e,r){super(r),this.message=r,this.key=e}}class ml{constructor(e,r=[]){this.parent=e,this.bindings={};for(const[o,u]of r)this.bindings[o]=u}concat(e){return new ml(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const pi={kind:"null"},ot={kind:"number"},Ot={kind:"string"},Bt={kind:"boolean"},ri={kind:"color"},gl={kind:"projectionDefinition"},Ji={kind:"object"},zt={kind:"value"},as={kind:"collator"},os={kind:"formatted"},yl={kind:"padding"},mo={kind:"colorArray"},ss={kind:"numberArray"},go={kind:"resolvedImage"},ls={kind:"variableAnchorOffsetCollection"};function jn(n,e){return{kind:"array",itemType:n,N:e}}function hr(n){if(n.kind==="array"){const e=hr(n.itemType);return typeof n.N=="number"?`array<${e}, ${n.N}>`:n.itemType.kind==="value"?"array":`array<${e}>`}return n.kind}const _l=[pi,ot,Ot,Bt,ri,gl,os,Ji,jn(zt),yl,ss,mo,go,ls];function yo(n,e){if(e.kind==="error")return null;if(n.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!yo(n.itemType,e.itemType))&&(typeof n.N!="number"||n.N===e.N))return null}else{if(n.kind===e.kind)return null;if(n.kind==="value"){for(const r of _l)if(!yo(r,e))return null}}return`Expected ${hr(n)} but found ${hr(e)} instead.`}function cs(n,e){return e.some((r=>r.kind===n.kind))}function Ba(n,e){return e.some((r=>r==="null"?n===null:r==="array"?Array.isArray(n):r==="object"?n&&!Array.isArray(n)&&typeof n=="object":r===typeof n))}function wi(n,e){return n.kind==="array"&&e.kind==="array"?n.itemType.kind===e.itemType.kind&&typeof n.N=="number":n.kind===e.kind}const Oh=.96422,Na=.82521,vl=4/29,Br=6/29,Bh=3*Br*Br,Nh=Br*Br*Br,us=Math.PI/180,jh=180/Math.PI;function Vh(n){return(n%=360)<0&&(n+=360),n}function Uh([n,e,r,o]){let u,d;const f=$c((.2225045*(n=xl(n))+.7168786*(e=xl(e))+.0606169*(r=xl(r)))/1);n===e&&e===r?u=d=f:(u=$c((.4360747*n+.3850649*e+.1430804*r)/Oh),d=$c((.0139322*n+.0971045*e+.7141733*r)/Na));const _=116*f-16;return[_<0?0:_,500*(u-f),200*(f-d),o]}function xl(n){return n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function $c(n){return n>Nh?Math.pow(n,1/3):n/Bh+vl}function qc([n,e,r,o]){let u=(n+16)/116,d=isNaN(e)?u:u+e/500,f=isNaN(r)?u:u-r/200;return u=1*Zc(u),d=Oh*Zc(d),f=Na*Zc(f),[Gc(3.1338561*d-1.6168667*u-.4906146*f),Gc(-.9787684*d+1.9161415*u+.033454*f),Gc(.0719453*d-.2289914*u+1.4052427*f),o]}function Gc(n){return(n=n<=.00304?12.92*n:1.055*Math.pow(n,1/2.4)-.055)<0?0:n>1?1:n}function Zc(n){return n>Br?n*n*n:Bh*(n-vl)}const df=Object.hasOwn||function(n,e){return Object.prototype.hasOwnProperty.call(n,e)};function hs(n,e){return df(n,e)?n[e]:void 0}function bl(n){return parseInt(n.padEnd(2,n),16)/255}function $h(n,e){return _o(e?n/100:n,0,1)}function _o(n,e,r){return Math.min(Math.max(e,n),r)}function Wc(n){return!n.some(Number.isNaN)}const ps={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],olive:[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 ma(n,e,r){return n+r*(e-n)}function vo(n,e,r){return n.map(((o,u)=>ma(o,e[u],r)))}class Nt{constructor(e,r,o,u=1,d=!0){this.r=e,this.g=r,this.b=o,this.a=u,d||(this.r*=u,this.g*=u,this.b*=u,u||this.overwriteGetter("rgb",[e,r,o,u]))}static parse(e){if(e instanceof Nt)return e;if(typeof e!="string")return;const r=(function(o){if((o=o.toLowerCase().trim())==="transparent")return[0,0,0,0];const u=hs(ps,o);if(u){const[f,_,w]=u;return[f/255,_/255,w/255,1]}if(o.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(o)){const f=o.length<6?1:2;let _=1;return[bl(o.slice(_,_+=f)),bl(o.slice(_,_+=f)),bl(o.slice(_,_+=f)),bl(o.slice(_,_+f)||"ff")]}if(o.startsWith("rgb")){const f=o.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(f){const[_,w,E,M,C,D,R,B,N,U,Z,ae]=f,W=[M||" ",R||" ",U].join("");if(W==="  "||W==="  /"||W===",,"||W===",,,"){const X=[E,D,N].join(""),le=X==="%%%"?100:X===""?255:0;if(le){const pe=[_o(+w/le,0,1),_o(+C/le,0,1),_o(+B/le,0,1),Z?$h(+Z,ae):1];if(Wc(pe))return pe}}return}}const d=o.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(d){const[f,_,w,E,M,C,D,R,B]=d,N=[w||" ",M||" ",D].join("");if(N==="  "||N==="  /"||N===",,"||N===",,,"){const U=[+_,_o(+E,0,100),_o(+C,0,100),R?$h(+R,B):1];if(Wc(U))return(function([Z,ae,W,X]){function le(pe){const Me=(pe+Z/30)%12,Ue=ae*Math.min(W,1-W);return W-Ue*Math.max(-1,Math.min(Me-3,9-Me,1))}return Z=Vh(Z),ae/=100,W/=100,[le(0),le(8),le(4),X]})(U)}}})(e);return r?new Nt(...r,!1):void 0}get rgb(){const{r:e,g:r,b:o,a:u}=this,d=u||1/0;return this.overwriteGetter("rgb",[e/d,r/d,o/d,u])}get hcl(){return this.overwriteGetter("hcl",(function(e){const[r,o,u,d]=Uh(e),f=Math.sqrt(o*o+u*u);return[Math.round(1e4*f)?Vh(Math.atan2(u,o)*jh):NaN,f,r,d]})(this.rgb))}get lab(){return this.overwriteGetter("lab",Uh(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){const[e,r,o,u]=this.rgb;return`rgba(${[e,r,o].map((d=>Math.round(255*d))).join(",")},${u})`}static interpolate(e,r,o,u="rgb"){switch(u){case"rgb":{const[d,f,_,w]=vo(e.rgb,r.rgb,o);return new Nt(d,f,_,w,!1)}case"hcl":{const[d,f,_,w]=e.hcl,[E,M,C,D]=r.hcl;let R,B;if(isNaN(d)||isNaN(E))isNaN(d)?isNaN(E)?R=NaN:(R=E,_!==1&&_!==0||(B=M)):(R=d,C!==1&&C!==0||(B=f));else{let W=E-d;E>d&&W>180?W-=360:E<d&&d-E>180&&(W+=360),R=d+o*W}const[N,U,Z,ae]=(function([W,X,le,pe]){return W=isNaN(W)?0:W*us,qc([le,Math.cos(W)*X,Math.sin(W)*X,pe])})([R,B??ma(f,M,o),ma(_,C,o),ma(w,D,o)]);return new Nt(N,U,Z,ae,!1)}case"lab":{const[d,f,_,w]=qc(vo(e.lab,r.lab,o));return new Nt(d,f,_,w,!1)}}}}Nt.black=new Nt(0,0,0,1),Nt.white=new Nt(1,1,1,1),Nt.transparent=new Nt(0,0,0,0),Nt.red=new Nt(1,0,0,1);class Hc{constructor(e,r,o){this.sensitivity=e?r?"variant":"case":r?"accent":"base",this.locale=o,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,r){return this.collator.compare(e,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const ff=["bottom","center","top"];class Xc{constructor(e,r,o,u,d,f){this.text=e,this.image=r,this.scale=o,this.fontStack=u,this.textColor=d,this.verticalAlign=f}}class Xn{constructor(e){this.sections=e}static fromString(e){return new Xn([new Xc(e,null,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some((e=>e.text.length!==0||e.image&&e.image.name.length!==0))}static factory(e){return e instanceof Xn?e:Xn.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map((e=>e.text)).join("")}}class Dn{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Dn)return e;if(typeof e=="number")return new Dn([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const r of e)if(typeof r!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new Dn(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,o){return new Dn(vo(e.values,r.values,o))}}class Rr{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Rr)return e;if(typeof e=="number")return new Rr([e]);if(Array.isArray(e)){for(const r of e)if(typeof r!="number")return;return new Rr(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,o){return new Rr(vo(e.values,r.values,o))}}class Mt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Mt)return e;if(typeof e=="string"){const o=Nt.parse(e);return o?new Mt([o]):void 0}if(!Array.isArray(e))return;const r=[];for(const o of e){if(typeof o!="string")return;const u=Nt.parse(o);if(!u)return;r.push(u)}return new Mt(r)}toString(){return JSON.stringify(this.values)}static interpolate(e,r,o,u="rgb"){const d=[];if(e.values.length!=r.values.length)throw new Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${r.values.length}), cannot interpolate.`);for(let f=0;f<e.values.length;f++)d.push(Nt.interpolate(e.values[f],r.values[f],o,u));return new Mt(d)}}class yr extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}}const ga=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Vn{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Vn)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let r=0;r<e.length;r+=2){const o=e[r],u=e[r+1];if(typeof o!="string"||!ga.has(o)||!Array.isArray(u)||u.length!==2||typeof u[0]!="number"||typeof u[1]!="number")return}return new Vn(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,o){const u=e.values,d=r.values;if(u.length!==d.length)throw new yr(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${r.toString()}`);const f=[];for(let _=0;_<u.length;_+=2){if(u[_]!==d[_])throw new yr(`Cannot interpolate values containing mismatched anchors. from[${_}]: ${u[_]}, to[${_}]: ${d[_]}`);f.push(u[_]);const[w,E]=u[_+1],[M,C]=d[_+1];f.push([ma(w,M,o),ma(E,C,o)])}return new Vn(f)}}class ni{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new ni({name:e,available:!1}):null}}class Un{constructor(e,r,o){this.from=e,this.to=r,this.transition=o}static interpolate(e,r,o){return new Un(e,r,o)}static parse(e){return e instanceof Un?e:Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number"?new Un(e[0],e[1],e[2]):typeof e=="object"&&typeof e.from=="string"&&typeof e.to=="string"&&typeof e.transition=="number"?new Un(e.from,e.to,e.transition):typeof e=="string"?new Un(e,e,1):void 0}}function xo(n,e,r,o){return typeof n=="number"&&n>=0&&n<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?o===void 0||typeof o=="number"&&o>=0&&o<=1?null:`Invalid rgba value [${[n,e,r,o].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof o=="number"?[n,e,r,o]:[n,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function ya(n){if(n===null||typeof n=="string"||typeof n=="boolean"||typeof n=="number"||n instanceof Un||n instanceof Nt||n instanceof Hc||n instanceof Xn||n instanceof Dn||n instanceof Rr||n instanceof Mt||n instanceof Vn||n instanceof ni)return!0;if(Array.isArray(n)){for(const e of n)if(!ya(e))return!1;return!0}if(typeof n=="object"){for(const e in n)if(!ya(n[e]))return!1;return!0}return!1}function Gr(n){if(n===null)return pi;if(typeof n=="string")return Ot;if(typeof n=="boolean")return Bt;if(typeof n=="number")return ot;if(n instanceof Nt)return ri;if(n instanceof Un)return gl;if(n instanceof Hc)return as;if(n instanceof Xn)return os;if(n instanceof Dn)return yl;if(n instanceof Rr)return ss;if(n instanceof Mt)return mo;if(n instanceof Vn)return ls;if(n instanceof ni)return go;if(Array.isArray(n)){const e=n.length;let r;for(const o of n){const u=Gr(o);if(r){if(r===u)continue;r=zt;break}r=u}return jn(r||zt,e)}return Ji}function ja(n){const e=typeof n;return n===null?"":e==="string"||e==="number"||e==="boolean"?String(n):n instanceof Nt||n instanceof Un||n instanceof Xn||n instanceof Dn||n instanceof Rr||n instanceof Mt||n instanceof Vn||n instanceof ni?n.toString():JSON.stringify(n)}class Ui{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!ya(e[1]))return r.error("invalid value");const o=e[1];let u=Gr(o);const d=r.expectedType;return u.kind!=="array"||u.N!==0||!d||d.kind!=="array"||typeof d.N=="number"&&d.N!==0||(u=d),new Ui(u,o)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const wl={string:Ot,number:ot,boolean:Bt,object:Ji};class Yn{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let o,u=1;const d=e[0];if(d==="array"){let _,w;if(e.length>2){const E=e[1];if(typeof E!="string"||!(E in wl)||E==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);_=wl[E],u++}else _=zt;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error('The length argument to "array" must be a positive integer literal',2);w=e[2],u++}o=jn(_,w)}else{if(!wl[d])throw new Error(`Types doesn't contain name = ${d}`);o=wl[d]}const f=[];for(;u<e.length;u++){const _=r.parse(e[u],u,zt);if(!_)return null;f.push(_)}return new Yn(o,f)}evaluate(e){for(let r=0;r<this.args.length;r++){const o=this.args[r].evaluate(e);if(!yo(this.type,Gr(o)))return o;if(r===this.args.length-1)throw new yr(`Expected value to be of type ${hr(this.t
4ype)}, but found ${hr(Gr(o))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}const Va={"to-boolean":Bt,"to-color":ri,"to-number":ot,"to-string":Ot};class Qi{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const o=e[0];if(!Va[o])throw new Error(`Can't parse ${o} as it is not part of the known types`);if((o==="to-boolean"||o==="to-string")&&e.length!==2)return r.error("Expected one argument.");const u=Va[o],d=[];for(let f=1;f<e.length;f++){const _=r.parse(e[f],f,zt);if(!_)return null;d.push(_)}return new Qi(u,d)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let r,o;for(const u of this.args){if(r=u.evaluate(e),o=null,r instanceof Nt)return r;if(typeof r=="string"){const d=e.parseColor(r);if(d)return d}else if(Array.isArray(r)&&(o=r.length<3||r.length>4?`Invalid rgba value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:xo(r[0],r[1],r[2],r[3]),!o))return new Nt(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new yr(o||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"padding":{let r;for(const o of this.args){r=o.evaluate(e);const u=Dn.parse(r);if(u)return u}throw new yr(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"numberArray":{let r;for(const o of this.args){r=o.evaluate(e);const u=Rr.parse(r);if(u)return u}throw new yr(`Could not parse numberArray from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"colorArray":{let r;for(const o of this.args){r=o.evaluate(e);const u=Mt.parse(r);if(u)return u}throw new yr(`Could not parse colorArray from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"variableAnchorOffsetCollection":{let r;for(const o of this.args){r=o.evaluate(e);const u=Vn.parse(r);if(u)return u}throw new yr(`Could not parse variableAnchorOffsetCollection from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"number":{let r=null;for(const o of this.args){if(r=o.evaluate(e),r===null)return 0;const u=Number(r);if(!isNaN(u))return u}throw new yr(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return Xn.fromString(ja(this.args[0].evaluate(e)));case"resolvedImage":return ni.fromString(ja(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return ja(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}const qh=["Unknown","Point","LineString","Polygon"];class Yc{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"?qh[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(e){let r=this._parseColorCache.get(e);return r||(r=Nt.parse(e),this._parseColorCache.set(e,r)),r}}class Ua{constructor(e,r,o=[],u,d=new ml,f=[]){this.registry=e,this.path=o,this.key=o.map((_=>`[${_}]`)).join(""),this.scope=d,this.errors=f,this.expectedType=u,this._isConstant=r}parse(e,r,o,u,d={}){return r?this.concat(r,o,u)._parse(e,d):this._parse(e,d)}_parse(e,r){function o(u,d,f){return f==="assert"?new Yn(d,[u]):f==="coerce"?new Qi(d,[u]):u}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const u=e[0];if(typeof u!="string")return this.error(`Expression name must be a string, but found ${typeof u} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const d=this.registry[u];if(d){let f=d.parse(e,this);if(!f)return null;if(this.expectedType){const _=this.expectedType,w=f.type;if(_.kind!=="string"&&_.kind!=="number"&&_.kind!=="boolean"&&_.kind!=="object"&&_.kind!=="array"||w.kind!=="value"){if(_.kind==="projectionDefinition"&&["string","array"].includes(w.kind)||["color","formatted","resolvedImage"].includes(_.kind)&&["value","string"].includes(w.kind)||["padding","numberArray"].includes(_.kind)&&["value","number","array"].includes(w.kind)||_.kind==="colorArray"&&["value","string","array"].includes(w.kind)||_.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(w.kind))f=o(f,_,r.typeAnnotation||"coerce");else if(this.checkSubtype(_,w))return null}else f=o(f,_,r.typeAnnotation||"assert")}if(!(f instanceof Ui)&&f.type.kind!=="resolvedImage"&&this._isConstant(f)){const _=new Yc;
vendor: 65,872 bytes, lines 4-5
4try{f=new Ui(f.type,f.evaluate(_))}catch(w){return this.error(w.message),null}}return f}return this.error(`Unknown expression "${u}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,r,o){const u=typeof e=="number"?this.path.concat(e):this.path,d=o?this.scope.concat(o):this.scope;return new Ua(this.registry,this._isConstant,u,r||null,d,this.errors)}error(e,...r){const o=`${this.key}${r.map((u=>`[${u}]`)).join("")}`;this.errors.push(new Nn(o,e))}checkSubtype(e,r){const o=yo(e,r);return o&&this.error(o),o}}class _r{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const o=[];for(let d=1;d<e.length-1;d+=2){const f=e[d];if(typeof f!="string")return r.error(`Expected string, but found ${typeof f} instead.`,d);if(/[^a-zA-Z0-9_]/.test(f))return r.error("Variable names must contain only alphanumeric characters or '_'.",d);const _=r.parse(e[d+1],d+1);if(!_)return null;o.push([f,_])}const u=r.parse(e[e.length-1],e.length-1,r.expectedType,o);return u?new _r(o,u):null}outputDefined(){return this.result.outputDefined()}}class bo{constructor(e,r){this.type=r.type,this.name=e,this.boundExpression=r}static parse(e,r){if(e.length!==2||typeof e[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");const o=e[1];return r.scope.has(o)?new bo(o,r.scope.get(o)):r.error(`Unknown variable "${o}". Make sure "${o}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class Qt{constructor(e,r,o){this.type=e,this.index=r,this.input=o}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const o=r.parse(e[1],1,ot),u=r.parse(e[2],2,jn(r.expectedType||zt));return o&&u?new Qt(u.type.itemType,o,u):null}evaluate(e){const r=this.index.evaluate(e),o=this.input.evaluate(e);if(r<0)throw new yr(`Array index out of bounds: ${r} < 0.`);if(r>=o.length)throw new yr(`Array index out of bounds: ${r} > ${o.length-1}.`);if(r!==Math.floor(r))throw new yr(`Array index must be an integer, but found ${r} instead.`);return o[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class Ft{constructor(e,r){this.type=Bt,this.needle=e,this.haystack=r}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const o=r.parse(e[1],1,zt),u=r.parse(e[2],2,zt);return o&&u?cs(o.type,[Bt,Ot,ot,pi,zt])?new Ft(o,u):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${hr(o.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),o=this.haystack.evaluate(e);if(!o)return!1;if(!Ba(r,["boolean","string","number","null"]))throw new yr(`Expected first argument to be of type boolean, string, number or null, but found ${hr(Gr(r))} instead.`);if(!Ba(o,["string","array"]))throw new yr(`Expected second argument to be of type array or string, but found ${hr(Gr(o))} instead.`);return o.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class wo{constructor(e,r,o){this.type=ot,this.needle=e,this.haystack=r,this.fromIndex=o}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const o=r.parse(e[1],1,zt),u=r.parse(e[2],2,zt);if(!o||!u)return null;if(!cs(o.type,[Bt,Ot,ot,pi,zt]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${hr(o.type)} instead`);if(e.length===4){const d=r.parse(e[3],3,ot);return d?new wo(o,u,d):null}return new wo(o,u)}evaluate(e){const r=this.needle.evaluate(e),o=this.haystack.evaluate(e);if(!Ba(r,["boolean","string","number","null"]))throw new yr(`Expected first argument to be of type boolean, string, number or null, but found ${hr(Gr(r))} instead.`);let u;if(this.fromIndex&&(u=this.fromIndex.evaluate(e)),Ba(o,["string"])){const d=o.indexOf(r,u);return d===-1?-1:[...o.slice(0,d)].length}if(Ba(o,["array"]))return o.indexOf(r,u);throw new yr(`Expected second argument to be of type array or string, but found ${hr(Gr(o))} instead.`)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class rr{constructor(e,r,o,u,d,f){this.inputType=e,this.type=r,this.input=o,this.cases=u,this.outputs=d,this.otherwise=f}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return r.error("Expected an even number of arguments.");let o,u;r.expectedType&&r.expectedType.kind!=="value"&&(u=r.expectedType);const d={},f=[];for(let E=2;E<e.length-1;E+=2){let M=e[E];const C=e[E+1];Array.isArray(M)||(M=[M]);const D=r.concat(E);if(M.length===0)return D.error("Expected at least one branch label.");for(const B of M){if(typeof B!="number"&&typeof B!="string")return D.error("Branch labels must be numbers or strings.");if(typeof B=="number"&&Math.abs(B)>Number.MAX_SAFE_INTEGER)return D.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof B=="number"&&Math.floor(B)!==B)return D.error("Numeric branch labels must be integer values.");if(o){if(D.checkSubtype(o,Gr(B)))return null}else o=Gr(B);if(d[String(B)]!==void 0)return D.error("Branch labels must be unique.");d[String(B)]=f.length}const R=r.parse(C,E,u);if(!R)return null;u=u||R.type,f.push(R)}const _=r.parse(e[1],1,zt);if(!_)return null;const w=r.parse(e[e.length-1],e.length-1,u);return w?_.type.kind!=="value"&&r.concat(1).checkSubtype(o,_.type)?null:new rr(o,u,_,d,f,w):null}evaluate(e){const r=this.input.evaluate(e);return(Gr(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))&&this.otherwise.outputDefined()}}class ds{constructor(e,r,o){this.type=e,this.branches=r,this.otherwise=o}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return r.error("Expected an odd number of arguments.");let o;r.expectedType&&r.expectedType.kind!=="value"&&(o=r.expectedType);const u=[];for(let f=1;f<e.length-1;f+=2){const _=r.parse(e[f],f,Bt);if(!_)return null;const w=r.parse(e[f+1],f+1,o);if(!w)return null;u.push([_,w]),o=o||w.type}const d=r.parse(e[e.length-1],e.length-1,o);if(!d)return null;if(!o)throw new Error("Can't infer output type");return new ds(o,u,d)}evaluate(e){for(const[r,o]of this.branches)if(r.evaluate(e))return o.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[r,o]of this.branches)e(r),e(o);e(this.otherwise)}outputDefined(){return this.branches.every((([e,r])=>r.outputDefined()))&&this.otherwise.outputDefined()}}class di{constructor(e,r,o,u){this.type=e,this.input=r,this.beginIndex=o,this.endIndex=u}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const o=r.parse(e[1],1,zt),u=r.parse(e[2],2,ot);if(!o||!u)return null;if(!cs(o.type,[jn(zt),Ot,zt]))return r.error(`Expected first argument to be of type array or string, but found ${hr(o.type)} instead`);if(e.length===4){const d=r.parse(e[3],3,ot);return d?new di(o.type,o,u,d):null}return new di(o.type,o,u)}evaluate(e){const r=this.input.evaluate(e),o=this.beginIndex.evaluate(e);let u;if(this.endIndex&&(u=this.endIndex.evaluate(e)),Ba(r,["string"]))return[...r].slice(o,u).join("");if(Ba(r,["array"]))return r.slice(o,u);throw new yr(`Expected first argument to be of type array or string, but found ${hr(Gr(r))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function To(n,e){const r=n.length-1;let o,u,d=0,f=r,_=0;for(;d<=f;)if(_=Math.floor((d+f)/2),o=n[_],u=n[_+1],o<=e){if(_===r||e<u)return _;d=_+1}else{if(!(o>e))throw new yr("Input is not a number.");f=_-1}return 0}class _a{constructor(e,r,o){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(const[u,d]of o)this.labels.push(u),this.outputs.push(d)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");const o=r.parse(e[1],1,ot);if(!o)return null;const u=[];let d=null;r.expectedType&&r.expectedType.kind!=="value"&&(d=r.expectedType);for(let f=1;f<e.length;f+=2){const _=f===1?-1/0:e[f],w=e[f+1],E=f,M=f+1;if(typeof _!="number")return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',E);if(u.length&&u[u.length-1][0]>=_)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',E);const C=r.parse(w,M,d);if(!C)return null;d=d||C.type,u.push([_,C])}return new _a(d,o,u)}evaluate(e){const r=this.labels,o=this.outputs;if(r.length===1)return o[0].evaluate(e);const u=this.input.evaluate(e);if(u<=r[0])return o[0].evaluate(e);const d=r.length;return u>=r[d-1]?o[d-1].evaluate(e):o[To(r,u)].evaluate(e)}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function Gh(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var fs,Kc,mf=(function(){if(Kc)return fs;function n(e,r,o,u){this.cx=3*e,this.bx=3*(o-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(u-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=r,this.p2x=o,this.p2y=u}return Kc=1,fs=n,n.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,r){if(r===void 0&&(r=1e-6),e<0)return 0;if(e>1)return 1;for(var o=e,u=0;u<8;u++){var d=this.sampleCurveX(o)-e;if(Math.abs(d)<r)return o;var f=this.sampleCurveDerivativeX(o);if(Math.abs(f)<1e-6)break;o-=d/f}var _=0,w=1;for(o=e,u=0;u<20&&(d=this.sampleCurveX(o),!(Math.abs(d-e)<r));u++)e>d?_=o:w=o,o=.5*(w-_)+_;return o},solve:function(e,r){return this.sampleCurveY(this.solveCurveX(e,r))}},fs})(),Zh=Gh(mf);class $n{constructor(e,r,o,u,d){this.type=e,this.operator=r,this.interpolation=o,this.input=u,this.labels=[],this.outputs=[];for(const[f,_]of d)this.labels.push(f),this.outputs.push(_)}static interpolationFactor(e,r,o,u){let d=0;if(e.name==="exponential")d=$i(r,e.base,o,u);else if(e.name==="linear")d=$i(r,1,o,u);else if(e.name==="cubic-bezier"){const f=e.controlPoints;d=new Zh(f[0],f[1],f[2],f[3]).solve($i(r,1,o,u))}return d}static parse(e,r){let[o,u,d,...f]=e;if(!Array.isArray(u)||u.length===0)return r.error("Expected an interpolation type expression.",1);if(u[0]==="linear")u={name:"linear"};else if(u[0]==="exponential"){const E=u[1];if(typeof E!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);u={name:"exponential",base:E}}else{if(u[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(u[0])}`,1,0);{const E=u.slice(1);if(E.length!==4||E.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);u={name:"cubic-bezier",controlPoints:E}}}if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(d=r.parse(d,2,ot),!d)return null;const _=[];let w=null;o!=="interpolate-hcl"&&o!=="interpolate-lab"||r.expectedType==mo?r.expectedType&&r.expectedType.kind!=="value"&&(w=r.expectedType):w=ri;for(let E=0;E<f.length;E+=2){const M=f[E],C=f[E+1],D=E+3,R=E+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.',D);if(_.length&&_[_.length-1][0]>=M)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',D);const B=r.parse(C,R,w);if(!B)return null;w=w||B.type,_.push([M,B])}return wi(w,ot)||wi(w,gl)||wi(w,ri)||wi(w,yl)||wi(w,ss)||wi(w,mo)||wi(w,ls)||wi(w,jn(ot))?new $n(w,o,u,d,_):r.error(`Type ${hr(w)} is not interpolatable.`)}evaluate(e){const r=this.labels,o=this.outputs;if(r.length===1)return o[0].evaluate(e);const u=this.input.evaluate(e);if(u<=r[0])return o[0].evaluate(e);const d=r.length;if(u>=r[d-1])return o[d-1].evaluate(e);const f=To(r,u),_=$n.interpolationFactor(this.interpolation,u,r[f],r[f+1]),w=o[f].evaluate(e),E=o[f+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return ma(w,E,_);case"color":return Nt.interpolate(w,E,_);case"padding":return Dn.interpolate(w,E,_);case"colorArray":return Mt.interpolate(w,E,_);case"numberArray":return Rr.interpolate(w,E,_);case"variableAnchorOffsetCollection":return Vn.interpolate(w,E,_);case"array":return vo(w,E,_);case"projectionDefinition":return Un.interpolate(w,E,_)}case"interpolate-hcl":switch(this.type.kind){case"color":return Nt.interpolate(w,E,_,"hcl");case"colorArray":return Mt.interpolate(w,E,_,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return Nt.interpolate(w,E,_,"lab");case"colorArray":return Mt.interpolate(w,E,_,"lab")}}}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function $i(n,e,r,o){const u=o-r,d=n-r;return u===0?0:e===1?d/u:(Math.pow(e,d)-1)/(Math.pow(e,u)-1)}const Ir={color:Nt.interpolate,number:ma,padding:Dn.interpolate,numberArray:Rr.interpolate,colorArray:Mt.interpolate,variableAnchorOffsetCollection:Vn.interpolate,array:vo};class $a{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let o=null;const u=r.expectedType;u&&u.kind!=="value"&&(o=u);const d=[];for(const _ of e.slice(1)){const w=r.parse(_,1+d.length,o,void 0,{typeAnnotation:"omit"});if(!w)return null;o=o||w.type,d.push(w)}if(!o)throw new Error("No output type");const f=u&&d.some((_=>yo(u,_.type)));return new $a(f?zt:o,d)}evaluate(e){let r,o=null,u=0;for(const d of this.args)if(u++,o=d.evaluate(e),o&&o instanceof ni&&!o.available&&(r||(r=o.name),o=null,u===this.args.length&&(o=r)),o!==null)break;return o}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}function Jc(n,e){return n==="=="||n==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function ms(n,e,r,o){return o.compare(e,r)===0}function Nr(n,e,r){const o=n!=="=="&&n!=="!=";return class Hx{constructor(d,f,_){this.type=Bt,this.lhs=d,this.rhs=f,this.collator=_,this.hasUntypedArgument=d.type.kind==="value"||f.type.kind==="value"}static parse(d,f){if(d.length!==3&&d.length!==4)return f.error("Expected two or three arguments.");const _=d[0];let w=f.parse(d[1],1,zt);if(!w)return null;if(!Jc(_,w.type))return f.concat(1).error(`"${_}" comparisons are not supported for type '${hr(w.type)}'.`);let E=f.parse(d[2],2,zt);if(!E)return null;if(!Jc(_,E.type))return f.concat(2).error(`"${_}" comparisons are not supported for type '${hr(E.type)}'.`);if(w.type.kind!==E.type.kind&&w.type.kind!=="value"&&E.type.kind!=="value")return f.error(`Cannot compare types '${hr(w.type)}' and '${hr(E.type)}'.`);o&&(w.type.kind==="value"&&E.type.kind!=="value"?w=new Yn(E.type,[w]):w.type.kind!=="value"&&E.type.kind==="value"&&(E=new Yn(w.type,[E])));let M=null;if(d.length===4){if(w.type.kind!=="string"&&E.type.kind!=="string"&&w.type.kind!=="value"&&E.type.kind!=="value")return f.error("Cannot use collator to compare non-string types.");if(M=f.parse(d[3],3,as),!M)return null}return new Hx(w,E,M)}evaluate(d){const f=this.lhs.evaluate(d),_=this.rhs.evaluate(d);if(o&&this.hasUntypedArgument){const w=Gr(f),E=Gr(_);if(w.kind!==E.kind||w.kind!=="string"&&w.kind!=="number")throw new yr(`Expected arguments for "${n}" to be (string, string) or (number, number), but found (${w.kind}, ${E.kind}) instead.`)}if(this.collator&&!o&&this.hasUntypedArgument){const w=Gr(f),E=Gr(_);if(w.kind!=="string"||E.kind!=="string")return e(d,f,_)}return this.collator?r(d,f,_,this.collator.evaluate(d)):e(d,f,_)}eachChild(d){d(this.lhs),d(this.rhs),this.collator&&d(this.collator)}outputDefined(){return!0}}}const Wh=Nr("==",(function(n,e,r){return e===r}),ms),Qc=Nr("!=",(function(n,e,r){return e!==r}),(function(n,e,r,o){return!ms(0,e,r,o)})),Hh=Nr("<",(function(n,e,r){return e<r}),(function(n,e,r,o){return o.compare(e,r)<0})),gf=Nr(">",(function(n,e,r){return e>r}),(function(n,e,r,o){return o.compare(e,r)>0})),So=Nr("<=",(function(n,e,r){return e<=r}),(function(n,e,r,o){return o.compare(e,r)<=0})),Tl=Nr(">=",(function(n,e,r){return e>=r}),(function(n,e,r,o){return o.compare(e,r)>=0}));class Eo{constructor(e,r,o){this.type=as,this.locale=o,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");const o=e[1];if(typeof o!="object"||Array.isArray(o))return r.error("Collator options argument must be an object.");const u=r.parse(o["case-sensitive"]!==void 0&&o["case-sensitive"],1,Bt);if(!u)return null;const d=r.parse(o["diacritic-sensitive"]!==void 0&&o["diacritic-sensitive"],1,Bt);if(!d)return null;let f=null;return o.locale&&(f=r.parse(o.locale,1,Ot),!f)?null:new Eo(u,d,f)}evaluate(e){return new Hc(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}class eu{constructor(e,r,o,u,d){this.type=Ot,this.number=e,this.locale=r,this.currency=o,this.minFractionDigits=u,this.maxFractionDigits=d}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");const o=r.parse(e[1],1,ot);if(!o)return null;const u=e[2];if(typeof u!="object"||Array.isArray(u))return r.error("NumberFormat options argument must be an object.");let d=null;if(u.locale&&(d=r.parse(u.locale,1,Ot),!d))return null;let f=null;if(u.currency&&(f=r.parse(u.currency,1,Ot),!f))return null;let _=null;if(u["min-fraction-digits"]&&(_=r.parse(u["min-fraction-digits"],1,ot),!_))return null;let w=null;return u["max-fraction-digits"]&&(w=r.parse(u["max-fraction-digits"],1,ot),!w)?null:new eu(o,d,f,_,w)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class gs{constructor(e){this.type=os,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const o=e[1];if(!Array.isArray(o)&&typeof o=="object")return r.error("First argument must be an image or text section.");const u=[];let d=!1;for(let f=1;f<=e.length-1;++f){const _=e[f];if(d&&typeof _=="object"&&!Array.isArray(_)){d=!1;let w=null;if(_["font-scale"]&&(w=r.parse(_["font-scale"],1,ot),!w))return null;let E=null;if(_["text-font"]&&(E=r.parse(_["text-font"],1,jn(Ot)),!E))return null;let M=null;if(_["text-color"]&&(M=r.parse(_["text-color"],1,ri),!M))return null;let C=null;if(_["vertical-align"]){if(typeof _["vertical-align"]=="string"&&!ff.includes(_["vertical-align"]))return r.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${_["vertical-align"]}' instead.`);if(C=r.parse(_["vertical-align"],1,Ot),!C)return null}const D=u[u.length-1];D.scale=w,D.font=E,D.textColor=M,D.verticalAlign=C}else{const w=r.parse(e[f],1,zt);if(!w)return null;const E=w.type.kind;if(E!=="string"&&E!=="value"&&E!=="null"&&E!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");d=!0,u.push({content:w,scale:null,font:null,textColor:null,verticalAlign:null})}}return new gs(u)}evaluate(e){return new Xn(this.sections.map((r=>{const o=r.content.evaluate(e);return Gr(o)===go?new Xc("",o,null,null,null,r.verticalAlign?r.verticalAlign.evaluate(e):null):new Xc(ja(o),null,r.scale?r.scale.evaluate(e):null,r.font?r.font.evaluate(e).join(","):null,r.textColor?r.textColor.evaluate(e):null,r.verticalAlign?r.verticalAlign.evaluate(e):null)})))}eachChild(e){for(const r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor),r.verticalAlign&&e(r.verticalAlign)}outputDefined(){return!1}}class Po{constructor(e){this.type=go,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const o=r.parse(e[1],1,Ot);return o?new Po(o):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),o=ni.fromString(r);return o&&e.availableImages&&(o.available=e.availableImages.indexOf(r)>-1),o}eachChild(e){e(this.input)}outputDefined(){return!1}}class Mo{constructor(e){this.type=ot,this.input=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);const o=r.parse(e[1],1);return o?o.type.kind!=="array"&&o.type.kind!=="string"&&o.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${hr(o.type)} instead.`):new Mo(o):null}evaluate(e){const r=this.input.evaluate(e);if(typeof r=="string")return[...r].length;if(Array.isArray(r))return r.length;throw new yr(`Expected value to be of type string or array, but found ${hr(Gr(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const cn=8192;function Xh(n,e){const r=(180+n[0])/360,o=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+n[1]*Math.PI/360)))/360,u=Math.pow(2,e.z);return[Math.round(r*u*cn),Math.round(o*u*cn)]}function Io(n,e){const r=Math.pow(2,e.z);return[(u=(n[0]/cn+e.x)/r,360*u-180),(o=(n[1]/cn+e.y)/r,360/Math.PI*Math.atan(Math.exp((180-360*o)*Math.PI/180))-90)];var o,u}function ys(n,e){n[0]=Math.min(n[0],e[0]),n[1]=Math.min(n[1],e[1]),n[2]=Math.max(n[2],e[0]),n[3]=Math.max(n[3],e[1])}function qa(n,e){return!(n[0]<=e[0]||n[2]>=e[2]||n[1]<=e[1]||n[3]>=e[3])}function yf(n,e,r){const o=n[0]-e[0],u=n[1]-e[1],d=n[0]-r[0],f=n[1]-r[1];return o*f-d*u==0&&o*d<=0&&u*f<=0}function Sl(n,e,r,o){return(u=[o[0]-r[0],o[1]-r[1]])[0]*(d=[e[0]-n[0],e[1]-n[1]])[1]-u[1]*d[0]!=0&&!(!tu(n,e,r,o)||!tu(r,o,n,e));var u,d}function _f(n,e,r){for(const o of r)for(let u=0;u<o.length-1;++u)if(Sl(n,e,o[u],o[u+1]))return!0;return!1}function Ao(n,e,r=!1){let o=!1;for(const _ of e)for(let w=0;w<_.length-1;w++){if(yf(n,_[w],_[w+1]))return r;(d=_[w])[1]>(u=n)[1]!=(f=_[w+1])[1]>u[1]&&u[0]<(f[0]-d[0])*(u[1]-d[1])/(f[1]-d[1])+d[0]&&(o=!o)}var u,d,f;return o}function El(n,e){for(const r of e)if(Ao(n,r))return!0;return!1}function Yh(n,e){for(const r of n)if(!Ao(r,e))return!1;for(let r=0;r<n.length-1;++r)if(_f(n[r],n[r+1],e))return!1;return!0}function Kh(n,e){for(const r of e)if(Yh(n,r))return!0;return!1}function tu(n,e,r,o){const u=o[0]-r[0],d=o[1]-r[1],f=(n[0]-r[0])*d-u*(n[1]-r[1]),_=(e[0]-r[0])*d-u*(e[1]-r[1]);return f>0&&_<0||f<0&&_>0}function ru(n,e,r){const o=[];for(let u=0;u<n.length;u++){const d=[];for(let f=0;f<n[u].length;f++){const _=Xh(n[u][f],r);ys(e,_),d.push(_)}o.push(d)}return o}function nu(n,e,r){const o=[];for(let u=0;u<n.length;u++){const d=ru(n[u],e,r);o.push(d)}return o}function Jh(n,e,r,o){if(n[0]<r[0]||n[0]>r[2]){const u=.5*o;let d=n[0]-r[0]>u?-o:r[0]-n[0]>u?o:0;d===0&&(d=n[0]-r[2]>u?-o:r[2]-n[0]>u?o:0),n[0]+=d}ys(e,n)}function Qh(n,e,r,o){const u=Math.pow(2,o.z)*cn,d=[o.x*cn,o.y*cn],f=[];for(const _ of n)for(const w of _){const E=[w.x+d[0],w.y+d[1]];Jh(E,e,r,u),f.push(E)}return f}function ep(n,e,r,o){const u=Math.pow(2,o.z)*cn,d=[o.x*cn,o.y*cn],f=[];for(const w of n){const E=[];for(const M of w){const C=[M.x+d[0],M.y+d[1]];ys(e,C),E.push(C)}f.push(E)}if(e[2]-e[0]<=u/2){(_=e)[0]=_[1]=1/0,_[2]=_[3]=-1/0;for(const w of f)for(const E of w)Jh(E,e,r,u)}var _;return f}class Ga{constructor(e,r){this.type=Bt,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(ya(e[1])){const o=e[1];if(o.type==="FeatureCollection"){const u=[];for(const d of o.features){const{type:f,coordinates:_}=d.geometry;f==="Polygon"&&u.push(_),f==="MultiPolygon"&&u.push(..._)}if(u.length)return new Ga(o,{type:"MultiPolygon",coordinates:u})}else if(o.type==="Feature"){const u=o.geometry.type;if(u==="Polygon"||u==="MultiPolygon")return new Ga(o,o.geometry)}else if(o.type==="Polygon"||o.type==="MultiPolygon")return new Ga(o,o)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return(function(r,o){const u=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],f=r.canonicalID();if(o.type==="Polygon"){const _=ru(o.coordinates,d,f),w=Qh(r.geometry(),u,d,f);if(!qa(u,d))return!1;for(const E of w)if(!Ao(E,_))return!1}if(o.type==="MultiPolygon"){const _=nu(o.coordinates,d,f),w=Qh(r.geometry(),u,d,f);if(!qa(u,d))return!1;for(const E of w)if(!El(E,_))return!1}return!0})(e,this.geometries);if(e.geometryType()==="LineString")return(function(r,o){const u=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],f=r.canonicalID();if(o.type==="Polygon"){const _=ru(o.coordinates,d,f),w=ep(r.geometry(),u,d,f);if(!qa(u,d))return!1;for(const E of w)if(!Yh(E,_))return!1}if(o.type==="MultiPolygon"){const _=nu(o.coordinates,d,f),w=ep(r.geometry(),u,d,f);if(!qa(u,d))return!1;for(const E of w)if(!Kh(E,_))return!1}return!0})(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let tp=class{constructor(n=[],e=(r,o)=>r<o?-1:r>o?1:0){if(this.data=n,this.length=this.data.length,this.compare=e,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(n){this.data.push(n),this._up(this.length++)}pop(){if(this.length===0)return;const n=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),n}peek(){return this.data[0]}_up(n){const{data:e,compare:r}=this,o=e[n];for(;n>0;){const u=n-1>>1,d=e[u];if(r(o,d)>=0)break;e[n]=d,n=u}e[n]=o}_down(n){const{data:e,compare:r}=this,o=this.length>>1,u=e[n];for(;n<o;){let d=1+(n<<1);const f=d+1;if(f<this.length&&r(e[f],e[d])<0&&(d=f),r(e[d],u)>=0)break;e[n]=e[d],n=d}e[n]=u}};function iu(n,e,r=0,o=n.length-1,u=rp){for(;o>r;){if(o-r>600){const w=o-r+1,E=e-r+1,M=Math.log(w),C=.5*Math.exp(2*M/3),D=.5*Math.sqrt(M*C*(w-C)/w)*(E-w/2<0?-1:1);iu(n,e,Math.max(r,Math.floor(e-E*C/w+D)),Math.min(o,Math.floor(e+(w-E)*C/w+D)),u)}const d=n[e];let f=r,_=o;for(Co(n,r,e),u(n[o],d)>0&&Co(n,r,o);f<_;){for(Co(n,f,_),f++,_--;u(n[f],d)<0;)f++;for(;u(n[_],d)>0;)_--}u(n[r],d)===0?Co(n,r,_):(_++,Co(n,_,o)),_<=e&&(r=_+1),e<=_&&(o=_-1)}}function Co(n,e,r){const o=n[e];n[e]=n[r],n[r]=o}function rp(n,e){return n<e?-1:n>e?1:0}function Pl(n,e){if(n.length<=1)return[n];const r=[];let o,u;for(const d of n){const f=xf(d);f!==0&&(d.area=Math.abs(f),u===void 0&&(u=f<0),u===f<0?(o&&r.push(o),o=[d]):o.push(d))}if(o&&r.push(o),e>1)for(let d=0;d<r.length;d++)r[d].length<=e||(iu(r[d],e,1,r[d].length-1,vf),r[d]=r[d].slice(0,e));return r}function vf(n,e){return e.area-n.area}function xf(n){let e=0;for(let r,o,u=0,d=n.length,f=d-1;u<d;f=u++)r=n[u],o=n[f],e+=(o.x-r.x)*(r.y+o.y);return e}const np=1/298.257223563,_s=np*(2-np),ip=Math.PI/180;class au{constructor(e){const r=6378.137*ip*1e3,o=Math.cos(e*ip),u=1/(1-_s*(1-o*o)),d=Math.sqrt(u);this.kx=r*d*o,this.ky=r*d*u*(1-_s)}distance(e,r){const o=this.wrap(e[0]-r[0])*this.kx,u=(e[1]-r[1])*this.ky;return Math.sqrt(o*o+u*u)}pointOnLine(e,r){let o,u,d,f,_=1/0;for(let w=0;w<e.length-1;w++){let E=e[w][0],M=e[w][1],C=this.wrap(e[w+1][0]-E)*this.kx,D=(e[w+1][1]-M)*this.ky,R=0;C===0&&D===0||(R=(this.wrap(r[0]-E)*this.kx*C+(r[1]-M)*this.ky*D)/(C*C+D*D),R>1?(E=e[w+1][0],M=e[w+1][1]):R>0&&(E+=C/this.kx*R,M+=D/this.ky*R)),C=this.wrap(r[0]-E)*this.kx,D=(r[1]-M)*this.ky;const B=C*C+D*D;B<_&&(_=B,o=E,u=M,d=w,f=R)}return{point:[o,u],index:d,t:Math.max(0,Math.min(1,f))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}}function ap(n,e){return e[0]-n[0]}function Ml(n){return n[1]-n[0]+1}function Ti(n,e){return n[1]>=n[0]&&n[1]<e}function Il(n,e){if(n[0]>n[1])return[null,null];const r=Ml(n);if(e){if(r===2)return[n,null];const u=Math.floor(r/2);return[[n[0],n[0]+u],[n[0]+u,n[1]]]}if(r===1)return[n,null];const o=Math.floor(r/2)-1;return[[n[0],n[0]+o],[n[0]+o+1,n[1]]]}function ou(n,e){if(!Ti(e,n.length))return[1/0,1/0,-1/0,-1/0];const r=[1/0,1/0,-1/0,-1/0];for(let o=e[0];o<=e[1];++o)ys(r,n[o]);return r}function su(n){const e=[1/0,1/0,-1/0,-1/0];for(const r of n)for(const o of r)ys(e,o);return e}function lu(n){return n[0]!==-1/0&&n[1]!==-1/0&&n[2]!==1/0&&n[3]!==1/0}function Al(n,e,r){if(!lu(n)||!lu(e))return NaN;let o=0,u=0;return n[2]<e[0]&&(o=e[0]-n[2]),n[0]>e[2]&&(o=n[0]-e[2]),n[1]>e[3]&&(u=n[1]-e[3]),n[3]<e[1]&&(u=e[1]-n[3]),r.distance([0,0],[o,u])}function Za(n,e,r){const o=r.pointOnLine(e,n);return r.distance(n,o.point)}function cu(n,e,r,o,u){const d=Math.min(Za(n,[r,o],u),Za(e,[r,o],u)),f=Math.min(Za(r,[n,e],u),Za(o,[n,e],u));return Math.min(d,f)}function bf(n,e,r,o,u){if(!Ti(e,n.length)||!Ti(o,r.length))return 1/0;let d=1/0;for(let f=e[0];f<e[1];++f){const _=n[f],w=n[f+1];for(let E=o[0];E<o[1];++E){const M=r[E],C=r[E+1];if(Sl(_,w,M,C))return 0;d=Math.min(d,cu(_,w,M,C,u))}}return d}function op(n,e,r,o,u){if(!Ti(e,n.length)||!Ti(o,r.length))return NaN;let d=1/0;for(let f=e[0];f<=e[1];++f)for(let _=o[0];_<=o[1];++_)if(d=Math.min(d,u.distance(n[f],r[_])),d===0)return d;return d}function wf(n,e,r){if(Ao(n,e,!0))return 0;let o=1/0;for(const u of e){const d=u[0],f=u[u.length-1];if(d!==f&&(o=Math.min(o,Za(n,[f,d],r)),o===0))return o;const _=r.pointOnLine(u,n);if(o=Math.min(o,r.distance(n,_.point)),o===0)return o}return o}function Tf(n,e,r,o){if(!Ti(e,n.length))return NaN;for(let d=e[0];d<=e[1];++d)if(Ao(n[d],r,!0))return 0;let u=1/0;for(let d=e[0];d<e[1];++d){const f=n[d],_=n[d+1];for(const w of r)for(let E=0,M=w.length,C=M-1;E<M;C=E++){const D=w[C],R=w[E];if(Sl(f,_,D,R))return 0;u=Math.min(u,cu(f,_,D,R,o))}}return u}function sp(n,e){for(const r of n)for(const o of r)if(Ao(o,e,!0))return!0;return!1}function Sf(n,e,r,o=1/0){const u=su(n),d=su(e);if(o!==1/0&&Al(u,d,r)>=o)return o;if(qa(u,d)){if(sp(n,e))return 0}else if(sp(e,n))return 0;let f=1/0;for(const _ of n)for(let w=0,E=_.length,M=E-1;w<E;M=w++){const C=_[M],D=_[w];for(const R of e)for(let B=0,N=R.length,U=N-1;B<N;U=B++){const Z=R[U],ae=R[B];if(Sl(C,D,Z,ae))return 0;f=Math.min(f,cu(C,D,Z,ae,r))}}return f}function ir(n,e,r,o,u,d){if(!d)return;const f=Al(ou(o,d),u,r);f<e&&n.push([f,d,[0,0]])}function Cl(n,e,r,o,u,d,f){if(!d||!f)return;const _=Al(ou(o,d),ou(u,f),r);_<e&&n.push([_,d,f])}function kl(n,e,r,o,u=1/0){let d=Math.min(o.distance(n[0],r[0][0]),u);if(d===0)return d;const f=new tp([[0,[0,n.length-1],[0,0]]],ap),_=su(r);for(;f.length>0;){const w=f.pop();if(w[0]>=d)continue;const E=w[1],M=e?50:100;if(Ml(E)<=M){if(!Ti(E,n.length))return NaN;if(e){const C=Tf(n,E,r,o);if(isNaN(C)||C===0)return C;d=Math.min(d,C)}else for(let C=E[0];C<=E[1];++C){const D=wf(n[C],r,o);if(d=Math.min(d,D),d===0)return 0}}else{const C=Il(E,e);ir(f,d,o,n,_,C[0]),ir(f,d,o,n,_,C[1])}}return d}function Dl(n,e,r,o,u,d=1/0){let f=Math.min(d,u.distance(n[0],r[0]));if(f===0)return f;const _=new tp([[0,[0,n.length-1],[0,r.length-1]]],ap);for(;_.length>0;){const w=_.pop();if(w[0]>=f)continue;const E=w[1],M=w[2],C=e?50:100,D=o?50:100;if(Ml(E)<=C&&Ml(M)<=D){if(!Ti(E,n.length)&&Ti(M,r.length))return NaN;let R;if(e&&o)R=bf(n,E,r,M,u),f=Math.min(f,R);else if(e&&!o){const B=n.slice(E[0],E[1]+1);for(let N=M[0];N<=M[1];++N)if(R=Za(r[N],B,u),f=Math.min(f,R),f===0)return f}else if(!e&&o){const B=r.slice(M[0],M[1]+1);for(let N=E[0];N<=E[1];++N)if(R=Za(n[N],B,u),f=Math.min(f,R),f===0)return f}else R=op(n,E,r,M,u),f=Math.min(f,R)}else{const R=Il(E,e),B=Il(M,o);Cl(_,f,u,n,r,R[0],B[0]),Cl(_,f,u,n,r,R[0],B[1]),Cl(_,f,u,n,r,R[1],B[0]),Cl(_,f,u,n,r,R[1],B[1])}}return f}function uu(n){return n.type==="MultiPolygon"?n.coordinates.map((e=>({type:"Polygon",coordinates:e}))):n.type==="MultiLineString"?n.coordinates.map((e=>({type:"LineString",coordinates:e}))):n.type==="MultiPoint"?n.coordinates.map((e=>({type:"Point",coordinates:e}))):[n]}class Wa{constructor(e,r){this.type=ot,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(ya(e[1])){const o=e[1];if(o.type==="FeatureCollection")return new Wa(o,o.features.map((u=>uu(u.geometry))).flat());if(o.type==="Feature")return new Wa(o,uu(o.geometry));if("type"in o&&"coordinates"in o)return new Wa(o,uu(o))}return r.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return(function(r,o){const u=r.geometry(),d=u.flat().map((w=>Io([w.x,w.y],r.canonical)));if(u.length===0)return NaN;const f=new au(d[0][1]);let _=1/0;for(const w of o){switch(w.type){case"Point":_=Math.min(_,Dl(d,!1,[w.coordinates],!1,f,_));break;case"LineString":_=Math.min(_,Dl(d,!1,w.coordinates,!0,f,_));break;case"Polygon":_=Math.min(_,kl(d,!1,w.coordinates,f,_))}if(_===0)return _}return _})(e,this.geometries);if(e.geometryType()==="LineString")return(function(r,o){const u=r.geometry(),d=u.flat().map((w=>Io([w.x,w.y],r.canonical)));if(u.length===0)return NaN;const f=new au(d[0][1]);let _=1/0;for(const w of o){switch(w.type){case"Point":_=Math.min(_,Dl(d,!0,[w.coordinates],!1,f,_));break;case"LineString":_=Math.min(_,Dl(d,!0,w.coordinates,!0,f,_));break;case"Polygon":_=Math.min(_,kl(d,!0,w.coordinates,f,_))}if(_===0)return _}return _})(e,this.geometries);if(e.geometryType()==="Polygon")return(function(r,o){const u=r.geometry();if(u.length===0||u[0].length===0)return NaN;const d=Pl(u,0).map((w=>w.map((E=>E.map((M=>Io([M.x,M.y],r.canonical))))))),f=new au(d[0][0][0][1]);let _=1/0;for(const w of o)for(const E of d){switch(w.type){case"Point":_=Math.min(_,kl([w.coordinates],!1,E,f,_));break;case"LineString":_=Math.min(_,kl(w.coordinates,!0,E,f,_));break;case"Polygon":_=Math.min(_,Sf(E,w.coordinates,f,_))}if(_===0)return _}return _})(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class vs{constructor(e){this.type=zt,this.key=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);const o=e[1];return o==null?r.error("Global state property must be defined."):typeof o!="string"?r.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new vs(o)}evaluate(e){var r;const o=(r=e.globals)===null||r===void 0?void 0:r.globalState;return o&&Object.keys(o).length!==0?hs(o,this.key):null}eachChild(){}outputDefined(){return!1}}const ko={"==":Wh,"!=":Qc,">":gf,"<":Hh,">=":Tl,"<=":So,array:Yn,at:Qt,boolean:Yn,case:ds,coalesce:$a,collator:Eo,format:gs,image:Po,in:Ft,"index-of":wo,interpolate:$n,"interpolate-hcl":$n,"interpolate-lab":$n,length:Mo,let:_r,literal:Ui,match:rr,number:Yn,"number-format":eu,object:Yn,slice:di,step:_a,string:Yn,"to-boolean":Qi,"to-color":Qi,"to-number":Qi,"to-string":Qi,var:bo,within:Ga,distance:Wa,"global-state":vs};class fi{constructor(e,r,o,u){this.name=e,this.type=r,this._evaluate=o,this.args=u}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){const o=e[0],u=fi.definitions[o];if(!u)return r.error(`Unknown expression "${o}". If you wanted a literal array, use ["literal", [...]].`,0);const d=Array.isArray(u)?u[0]:u.type,f=Array.isArray(u)?[[u[1],u[2]]]:u.overloads,_=f.filter((([E])=>!Array.isArray(E)||E.length===e.length-1));let w=null;for(const[E,M]of _){w=new Ua(r.registry,Ll,r.path,null,r.scope);const C=[];let D=!1;for(let R=1;R<e.length;R++){const B=e[R],N=Array.isArray(E)?E[R-1]:E.type,U=w.parse(B,1+C.length,N);if(!U){D=!0;break}C.push(U)}if(!D)if(Array.isArray(E)&&E.length!==C.length)w.error(`Expected ${E.length} arguments, but found ${C.length} instead.`);else{for(let R=0;R<C.length;R++){const B=Array.isArray(E)?E[R]:E.type,N=C[R];w.concat(R+1).checkSubtype(B,N.type)}if(w.errors.length===0)return new fi(o,d,M,C)}}if(_.length===1)r.errors.push(...w.errors);else{const E=(_.length?_:f).map((([C])=>{return D=C,Array.isArray(D)?`(${D.map(hr).join(", ")})`:`(${hr(D.type)}...)`;var D})).join(" | "),M=[];for(let C=1;C<e.length;C++){const D=r.parse(e[C],1+M.length);if(!D)return null;M.push(hr(D.type))}r.error(`Expected arguments of type ${E}, but found (${M.join(", ")}) instead.`)}return null}static register(e,r){fi.definitions=r;for(const o in r)e[o]=fi}}function lp(n,[e,r,o,u]){e=e.evaluate(n),r=r.evaluate(n),o=o.evaluate(n);const d=u?u.evaluate(n):1,f=xo(e,r,o,d);if(f)throw new yr(f);return new Nt(e/255,r/255,o/255,d,!1)}function cp(n,e){return n in e}function hu(n,e){const r=e[n];return r===void 0?null:r}function Ha(n){return{type:n}}function Ll(n){if(n instanceof bo)return Ll(n.boundExpression);if(n instanceof fi&&n.name==="error"||n instanceof Eo||n instanceof Ga||n instanceof Wa||n instanceof vs)return!1;const e=n instanceof Qi||n instanceof Yn;let r=!0;return n.eachChild((o=>{r=e?r&&Ll(o):r&&o instanceof Ui})),!!r&&Rl(n)&&zl(n,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function Rl(n){if(n instanceof fi&&(n.name==="get"&&n.args.length===1||n.name==="feature-state"||n.name==="has"&&n.args.length===1||n.name==="properties"||n.name==="geometry-type"||n.name==="id"||/^filter-/.test(n.name))||n instanceof Ga||n instanceof Wa)return!1;let e=!0;return n.eachChild((r=>{e&&!Rl(r)&&(e=!1)})),e}function xs(n){if(n instanceof fi&&n.name==="feature-state")return!1;let e=!0;return n.eachChild((r=>{e&&!xs(r)&&(e=!1)})),e}function zl(n,e){if(n instanceof fi&&e.indexOf(n.name)>=0)return!1;let r=!0;return n.eachChild((o=>{r&&!zl(o,e)&&(r=!1)})),r}function up(n){return{result:"success",value:n}}function Do(n){return{result:"error",value:n}}function Lo(n){return n["property-type"]==="data-driven"||n["property-type"]==="cross-faded-data-driven"}function hp(n){return!!n.expression&&n.expression.parameters.indexOf("zoom")>-1}function pu(n){return!!n.expression&&n.expression.interpolated}function Vt(n){return n instanceof Number?"number":n instanceof String?"string":n instanceof Boolean?"boolean":Array.isArray(n)?"array":n===null?"null":typeof n}function Fl(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)&&Gr(n)===Ji}function Ef(n){return n}function pp(n,e){const r=n.stops&&typeof n.stops[0][0]=="object",o=r||!(r||n.property!==void 0),u=n.type||(pu(e)?"exponential":"interval"),d=(function(M){switch(M.type){case"color":return Nt.parse;case"padding":return Dn.parse;case"numberArray":return Rr.parse;case"colorArray":return Mt.parse;default:return null}})(e);if(d&&((n=Bn({},n)).stops&&(n.stops=n.stops.map((M=>[M[0],d(M[1])]))),n.default=d(n.default?n.default:e.default)),n.colorSpace&&(f=n.colorSpace)!=="rgb"&&f!=="hcl"&&f!=="lab")throw new Error(`Unknown color space: "${n.colorSpace}"`);var f;const _=(function(M){switch(M){case"exponential":return dp;case"interval":return Mf;case"categorical":return Pf;case"identity":return If;default:throw new Error(`Unknown function type "${M}"`)}})(u);let w,E;if(u==="categorical"){w=Object.create(null);for(const M of n.stops)w[M[0]]=M[1];E=typeof n.stops[0][0]}if(r){const M={},C=[];for(let B=0;B<n.stops.length;B++){const N=n.stops[B],U=N[0].zoom;M[U]===void 0&&(M[U]={zoom:U,type:n.type,property:n.property,default:n.default,stops:[]},C.push(U)),M[U].stops.push([N[0].value,N[1]])}const D=[];for(const B of C)D.push([M[B].zoom,pp(M[B],e)]);const R={name:"linear"};return{kind:"composite",interpolationType:R,interpolationFactor:$n.interpolationFactor.bind(void 0,R),zoomStops:D.map((B=>B[0])),evaluate:({zoom:B},N)=>dp({stops:D,base:n.base},e,B).evaluate(B,N)}}if(o){const M=u==="exponential"?{name:"exponential",base:n.base!==void 0?n.base:1}:null;return{kind:"camera",interpolationType:M,interpolationFactor:$n.interpolationFactor.bind(void 0,M),zoomStops:n.stops.map((C=>C[0])),evaluate:({zoom:C})=>_(n,e,C,w,E)}}return{kind:"source",evaluate(M,C){const D=C&&C.properties?C.properties[n.property]:void 0;return D===void 0?bs(n.default,e.default):_(n,e,D,w,E)}}}function bs(n,e,r){return n!==void 0?n:e!==void 0?e:r!==void 0?r:void 0}function Pf(n,e,r,o,u){return bs(typeof r===u?o[r]:void 0,n.default,e.default)}function Mf(n,e,r){if(Vt(r)!=="number")return bs(n.default,e.default);const o=n.stops.length;if(o===1||r<=n.stops[0][0])return n.stops[0][1];if(r>=n.stops[o-1][0])return n.stops[o-1][1];const u=To(n.stops.map((d=>d[0])),r);return n.stops[u][1]}function dp(n,e,r){const o=n.base!==void 0?n.base:1;if(Vt(r)!=="number")return bs(n.default,e.default);const u=n.stops.length;if(u===1||r<=n.stops[0][0])return n.stops[0][1];if(r>=n.stops[u-1][0])return n.stops[u-1][1];const d=To(n.stops.map((M=>M[0])),r),f=(function(M,C,D,R){const B=R-D,N=M-D;return B===0?0:C===1?N/B:(Math.pow(C,N)-1)/(Math.pow(C,B)-1)})(r,o,n.stops[d][0],n.stops[d+1][0]),_=n.stops[d][1],w=n.stops[d+1][1],E=Ir[e.type]||Ef;return typeof _.evaluate=="function"?{evaluate(...M){const C=_.evaluate.apply(void 0,M),D=w.evaluate.apply(void 0,M);if(C!==void 0&&D!==void 0)return E(C,D,f,n.colorSpace)}}:E(_,w,f,n.colorSpace)}function If(n,e,r){switch(e.type){case"color":r=Nt.parse(r);break;case"formatted":r=Xn.fromString(r.toString());break;case"resolvedImage":r=ni.fromString(r.toString());break;case"padding":r=Dn.parse(r);break;case"colorArray":r=Mt.parse(r);break;case"numberArray":r=Rr.parse(r);break;default:Vt(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0)}return bs(r,n.default,e.default)}fi.register(ko,{error:[{kind:"error"},[Ot],(n,[e])=>{throw new yr(e.evaluate(n))}],typeof:[Ot,[zt],(n,[e])=>hr(Gr(e.evaluate(n)))],"to-rgba":[jn(ot,4),[ri],(n,[e])=>{const[r,o,u,d]=e.evaluate(n).rgb;return[255*r,255*o,255*u,d]}],rgb:[ri,[ot,ot,ot],lp],rgba:[ri,[ot,ot,ot,ot],lp],has:{type:Bt,overloads:[[[Ot],(n,[e])=>cp(e.evaluate(n),n.properties())],[[Ot,Ji],(n,[e,r])=>cp(e.evaluate(n),r.evaluate(n))]]},get:{type:zt,overloads:[[[Ot],(n,[e])=>hu(e.evaluate(n),n.properties())],[[Ot,Ji],(n,[e,r])=>hu(e.evaluate(n),r.evaluate(n))]]},"feature-state":[zt,[Ot],(n,[e])=>hu(e.evaluate(n),n.featureState||{})],properties:[Ji,[],n=>n.properties()],"geometry-type":[Ot,[],n=>n.geometryType()],id:[zt,[],n=>n.id()],zoom:[ot,[],n=>n.globals.zoom],"heatmap-density":[ot,[],n=>n.globals.heatmapDensity||0],elevation:[ot,[],n=>n.globals.elevation||0],"line-progress":[ot,[],n=>n.globals.lineProgress||0],accumulated:[zt,[],n=>n.globals.accumulated===void 0?null:n.globals.accumulated],"+":[ot,Ha(ot),(n,e)=>{let r=0;for(const o of e)r+=o.evaluate(n);return r}],"*":[ot,Ha(ot),(n,e)=>{let r=1;for(const o of e)r*=o.evaluate(n);return r}],"-":{type:ot,overloads:[[[ot,ot],(n,[e,r])=>e.evaluate(n)-r.evaluate(n)],[[ot],(n,[e])=>-e.evaluate(n)]]},"/":[ot,[ot,ot],(n,[e,r])=>e.evaluate(n)/r.evaluate(n)],"%":[ot,[ot,ot],(n,[e,r])=>e.evaluate(n)%r.evaluate(n)],ln2:[ot,[],()=>Math.LN2],pi:[ot,[],()=>Math.PI],e:[ot,[],()=>Math.E],"^":[ot,[ot,ot],(n,[e,r])=>Math.pow(e.evaluate(n),r.evaluate(n))],sqrt:[ot,[ot],(n,[e])=>Math.sqrt(e.evaluate(n))],log10:[ot,[ot],(n,[e])=>Math.log(e.evaluate(n))/Math.LN10],ln:[ot,[ot],(n,[e])=>Math.log(e.evaluate(n))],log2:[ot,[ot],(n,[e])=>Math.log(e.evaluate(n))/Math.LN2],sin:[ot,[ot],(n,[e])=>Math.sin(e.evaluate(n))],cos:[ot,[ot],(n,[e])=>Math.cos(e.evaluate(n))],tan:[ot,[ot],(n,[e])=>Math.tan(e.evaluate(n))],asin:[ot,[ot],(n,[e])=>Math.asin(e.evaluate(n))],acos:[ot,[ot],(n,[e])=>Math.acos(e.evaluate(n))],atan:[ot,[ot],(n,[e])=>Math.atan(e.evaluate(n))],min:[ot,Ha(ot),(n,e)=>Math.min(...e.map((r=>r.evaluate(n))))],max:[ot,Ha(ot),(n,e)=>Math.max(...e.map((r=>r.evaluate(n))))],abs:[ot,[ot],(n,[e])=>Math.abs(e.evaluate(n))],round:[ot,[ot],(n,[e])=>{const r=e.evaluate(n);return r<0?-Math.round(-r):Math.round(r)}],floor:[ot,[ot],(n,[e])=>Math.floor(e.evaluate(n))],ceil:[ot,[ot],(n,[e])=>Math.ceil(e.evaluate(n))],"filter-==":[Bt,[Ot,zt],(n,[e,r])=>n.properties()[e.value]===r.value],"filter-id-==":[Bt,[zt],(n,[e])=>n.id()===e.value],"filter-type-==":[Bt,[Ot],(n,[e])=>n.geometryType()===e.value],"filter-<":[Bt,[Ot,zt],(n,[e,r])=>{const o=n.properties()[e.value],u=r.value;return typeof o==typeof u&&o<u}],"filter-id-<":[Bt,[zt],(n,[e])=>{const r=n.id(),o=e.value;return typeof r==typeof o&&r<o}],"filter->":[Bt,[Ot,zt],(n,[e,r])=>{const o=n.properties()[e.value],u=r.value;return typeof o==typeof u&&o>u}],"filter-id->":[Bt,[zt],(n,[e])=>{const r=n.id(),o=e.value;return typeof r==typeof o&&r>o}],"filter-<=":[Bt,[Ot,zt],(n,[e,r])=>{const o=n.properties()[e.value],u=r.value;return typeof o==typeof u&&o<=u}],"filter-id-<=":[Bt,[zt],(n,[e])=>{const r=n.id(),o=e.value;return typeof r==typeof o&&r<=o}],"filter->=":[Bt,[Ot,zt],(n,[e,r])=>{const o=n.properties()[e.value],u=r.value;return typeof o==typeof u&&o>=u}],"filter-id->=":[Bt,[zt],(n,[e])=>{const r=n.id(),o=e.value;return typeof r==typeof o&&r>=o}],"filter-has":[Bt,[zt],(n,[e])=>e.value in n.properties()],"filter-has-id":[Bt,[],n=>n.id()!==null&&n.id()!==void 0],"filter-type-in":[Bt,[jn(Ot)],(n,[e])=>e.value.indexOf(n.geometryType())>=0],"filter-id-in":[Bt,[jn(zt)],(n,[e])=>e.value.indexOf(n.id())>=0],"filter-in-small":[Bt,[Ot,jn(zt)],(n,[e,r])=>r.value.indexOf(n.properties()[e.value])>=0],"filter-in-large":[Bt,[Ot,jn(zt)],(n,[e,r])=>(function(o,u,d,f){for(;d<=f;){const _=d+f>>1;if(u[_]===o)return!0;u[_]>o?f=_-1:d=_+1}return!1})(n.properties()[e.value],r.value,0,r.value.length-1)],all:{type:Bt,overloads:[[[Bt,Bt],(n,[e,r])=>e.evaluate(n)&&r.evaluate(n)],[Ha(Bt),(n,e)=>{for(const r of e)if(!r.evaluate(n))return!1;return!0}]]},any:{type:Bt,overloads:[[[Bt,Bt],(n,[e,r])=>e.evaluate(n)||r.evaluate(n)],[Ha(Bt),(n,e)=>{for(const r of e)if(r.evaluate(n))return!0;return!1}]]},"!":[Bt,[Bt],(n,[e])=>!e.evaluate(n)],"is-supported-script":[Bt,[Ot],(n,[e])=>{const r=n.globals&&n.globals.isSupportedScript;return!r||r(e.evaluate(n))}],upcase:[Ot,[Ot],(n,[e])=>e.evaluate(n).toUpperCase()],downcase:[Ot,[Ot],(n,[e])=>e.evaluate(n).toLowerCase()],concat:[Ot,Ha(zt),(n,e)=>e.map((r=>ja(r.evaluate(n)))).join("")],"resolved-locale":[Ot,[as],(n,[e])=>e.evaluate(n).resolvedLocale()]});class du{constructor(e,r,o){this.expression=e,this._warningHistory={},this._evaluator=new Yc,this._defaultValue=r?(function(u){if(u.type==="color"&&Fl(u.default))return new Nt(0,0,0,0);switch(u.type){case"color":return Nt.parse(u.default)||null;case"padding":return Dn.parse(u.default)||null;case"numberArray":return Rr.parse(u.default)||null;case"colorArray":return Mt.parse(u.default)||null;case"variableAnchorOffsetCollection":return Vn.parse(u.default)||null;case"projectionDefinition":return Un.parse(u.default)||null;default:return u.default===void 0?null:u.default}})(r):null,this._enumValues=r&&r.type==="enum"?r.values:null,this._globalState=o}evaluateWithoutErrorHandling(e,r,o,u,d,f){return this._globalState&&(e=Xa(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=o,this._evaluator.canonical=u,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=f,this.expression.evaluate(this._evaluator)}evaluate(e,r,o,u,d,f){this._globalState&&(e=Xa(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=o||null,this._evaluator.canonical=u,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=f||null;try{const _=this.expression.evaluate(this._evaluator);if(_==null||typeof _=="number"&&_!=_)return this._defaultValue;if(this._enumValues&&!(_ in this._enumValues))throw new yr(`Expected value to be one of ${Object.keys(this._enumValues).map((w=>JSON.stringify(w))).join(", ")}, but found ${JSON.stringify(_)} instead.`);return _}catch(_){return this._warningHistory[_.message]||(this._warningHistory[_.message]=!0,typeof console<"u"&&console.warn(_.message)),this._defaultValue}}}function Ro(n){return Array.isArray(n)&&n.length>0&&typeof n[0]=="string"&&n[0]in ko}function ws(n,e,r){const o=new Ua(ko,Ll,[],e?(function(d){const f={color:ri,string:Ot,number:ot,enum:Ot,boolean:Bt,formatted:os,padding:yl,numberArray:ss,colorArray:mo,projectionDefinition:gl,resolvedImage:go,variableAnchorOffsetCollection:ls};return d.type==="array"?jn(f[d.value]||zt,d.length):f[d.type]})(e):void 0),u=o.parse(n,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return u?up(new du(u,e,r)):Do(o.errors)}class Ol{constructor(e,r,o){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!xs(r.expression),this.globalStateRefs=va(r.expression),this._globalState=o}evaluateWithoutErrorHandling(e,r,o,u,d,f){return this._globalState&&(e=Xa(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,r,o,u,d,f)}evaluate(e,r,o,u,d,f){return this._globalState&&(e=Xa(e,this._globalState)),this._styleExpression.evaluate(e,r,o,u,d,f)}}class fu{constructor(e,r,o,u,d){this.kind=e,this.zoomStops=o,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!xs(r.expression),this.globalStateRefs=va(r.expression),this.interpolationType=u,this._globalState=d}evaluateWithoutErrorHandling(e,r,o,u,d,f){return this._globalState&&(e=Xa(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,r,o,u,d,f)}evaluate(e,r,o,u,d,f){return this._globalState&&(e=Xa(e,this._globalState)),this._styleExpression.evaluate(e,r,o,u,d,f)}interpolationFactor(e,r,o){return this.interpolationType?$n.interpolationFactor(this.interpolationType,e,r,o):0}}function mu(n,e,r){const o=ws(n,e,r);if(o.result==="error")return o;const u=o.value.expression,d=Rl(u);if(!d&&!Lo(e))return Do([new Nn("","data expressions not supported")]);const f=zl(u,["zoom"]);if(!f&&!hp(e))return Do([new Nn("","zoom expressions not supported")]);const _=Nl(u);return _||f?_ instanceof Nn?Do([_]):_ instanceof $n&&!pu(e)?Do([new Nn("",'"interpolate" expressions cannot be used with this property')]):up(_?new fu(d?"camera":"composite",o.value,_.labels,_ instanceof $n?_.interpolation:void 0,r):new Ol(d?"constant":"source",o.value,r)):Do([new Nn("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Bl{constructor(e,r){this._parameters=e,this._specification=r,Bn(this,pp(this._parameters,this._specification))}static deserialize(e){return new Bl(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Nl(n){let e=null;if(n instanceof _r)e=Nl(n.result);else if(n instanceof $a){for(const r of n.args)if(e=Nl(r),e)break}else(n instanceof _a||n instanceof $n)&&n.input instanceof fi&&n.input.name==="zoom"&&(e=n);return e instanceof Nn||n.eachChild((r=>{const o=Nl(r);o instanceof Nn?e=o:!e&&o?e=new Nn("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&o&&e!==o&&(e=new Nn("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function va(n,e=new Set){return n instanceof vs&&e.add(n.key),n.eachChild((r=>{va(r,e)})),e}function Xa(n,e){const{zoom:r,heatmapDensity:o,elevation:u,lineProgress:d,isSupportedScript:f,accumulated:_}=n??{};return{zoom:r,heatmapDensity:o,elevation:u,lineProgress:d,isSupportedScript:f,accumulated:_,globalState:e}}function gu(n){if(n===!0||n===!1)return!0;if(!Array.isArray(n)||n.length===0)return!1;switch(n[0]){case"has":return n.length>=2&&n[1]!=="$id"&&n[1]!=="$type";case"in":return n.length>=3&&(typeof n[1]!="string"||Array.isArray(n[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return n.length!==3||Array.isArray(n[1])||Array.isArray(n[2]);case"any":case"all":for(const e of n.slice(1))if(!gu(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const Af={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Ts(n,e){if(n==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};gu(n)||(n=Ss(n));const r=ws(n,Af,e);if(r.result==="error")throw new Error(r.value.map((o=>`${o.key}: ${o.message}`)).join(", "));return{filter:(o,u,d)=>r.value.evaluate(o,u,{},d),needGeometry:fp(n),getGlobalStateRefs:()=>va(r.value.expression)}}function Cf(n,e){return n<e?-1:n>e?1:0}function fp(n){if(!Array.isArray(n))return!1;if(n[0]==="within"||n[0]==="distance")return!0;for(let e=1;e<n.length;e++)if(fp(n[e]))return!0;return!1}function Ss(n){if(!n)return!0;const e=n[0];return n.length<=1?e!=="any":e==="=="?jl(n[1],n[2],"=="):e==="!="?Es(jl(n[1],n[2],"==")):e==="<"||e===">"||e==="<="||e===">="?jl(n[1],n[2],e):e==="any"?(r=n.slice(1),["any"].concat(r.map(Ss))):e==="all"?["all"].concat(n.slice(1).map(Ss)):e==="none"?["all"].concat(n.slice(1).map(Ss).map(Es)):e==="in"?mp(n[1],n.slice(2)):e==="!in"?Es(mp(n[1],n.slice(2))):e==="has"?gp(n[1]):e!=="!has"||Es(gp(n[1]));var r}function jl(n,e,r){switch(n){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,n,e]}}function mp(n,e){if(e.length===0)return!1;switch(n){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((r=>typeof r!=typeof e[0]))?["filter-in-large",n,["literal",e.sort(Cf)]]:["filter-in-small",n,["literal",e]]}}function gp(n){switch(n){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",n]}}function Es(n){return["!",n]}function Vl(n){const e=typeof n;if(e==="number"||e==="boolean"||e==="string"||n==null)return JSON.stringify(n);if(Array.isArray(n)){let u="[";for(const d of n)u+=`${Vl(d)},`;return`${u}]`}const r=Object.keys(n).sort();let o="{";for(let u=0;u<r.length;u++)o+=`${JSON.stringify(r[u])}:${Vl(n[r[u]])},`;return`${o}}`}function yp(n){let e="";for(const r of Et)e+=`/${Vl(n[r])}`;return e}function _p(n){const e=n.value;return e?[new He(n.key,e,"constants have been deprecated as of v8")]:[]}function Zr(n){return n instanceof Number||n instanceof String||n instanceof Boolean?n.valueOf():n}function Ya(n){if(Array.isArray(n))return n.map(Ya);if(n instanceof Object&&!(n instanceof Number||n instanceof String||n instanceof Boolean)){const e={};for(const r in n)e[r]=Ya(n[r]);return e}return Zr(n)}function ii(n){const e=n.key,r=n.value,o=n.valueSpec||{},u=n.objectElementValidators||{},d=n.style,f=n.styleSpec,_=n.validateSpec;let w=[];const E=Vt(r);if(E!=="object")return[new He(e,r,`object expected, ${E} found`)];for(const M in r){const C=M.split(".")[0],D=hs(o,C)||o["*"];let R;if(hs(u,C))R=u[C];else if(hs(o,C)){if(r[M]===void 0)continue;R=_}else if(u["*"])R=u["*"];else{if(!o["*"]){w.push(new He(e,r[M],`unknown property "${M}"`));continue}R=_}w=w.concat(R({key:(e&&`${e}.`)+M,value:r[M],valueSpec:D,style:d,styleSpec:f,object:r,objectKey:M,validateSpec:_},r))}for(const M in o)u[M]||o[M].required&&o[M].default===void 0&&r[M]===void 0&&w.push(new He(e,r,`missing required property "${M}"`));return w}function Ul(n){const e=n.value,r=n.valueSpec,o=n.style,u=n.styleSpec,d=n.key,f=n.arrayElementValidator||n.validateSpec;if(Vt(e)!=="array")return[new He(d,e,`array expected, ${Vt(e)} found`)];if(r.length&&e.length!==r.length)return[new He(d,e,`array length ${r.length} expected, length ${e.length} found`)];let _={type:r.value,values:r.values};u.$version<7&&(_.function=r.function),Vt(r.value)==="object"&&(_=r.value);let w=[];for(let E=0;E<e.length;E++)w=w.concat(f({array:e,arrayIndex:E,value:e[E],valueSpec:_,validateSpec:n.validateSpec,style:o,styleSpec:u,key:`${d}[${E}]`}));return w}function Ps(n){const e=n.key,r=n.value,o=n.valueSpec;let u=Vt(r);return u==="number"&&r!=r&&(u="NaN"),u!=="number"?[new He(e,r,`number expected, ${u} found`)]:"minimum"in o&&r<o.minimum?[new He(e,r,`${r} is less than the minimum value ${o.minimum}`)]:"maximum"in o&&r>o.maximum?[new He(e,r,`${r} is greater than the maximum value ${o.maximum}`)]:[]}function $l(n){const e=n.valueSpec,r=Zr(n.value.type);let o,u,d,f={};const _=r!=="categorical"&&n.value.property===void 0,w=!_,E=Vt(n.value.stops)==="array"&&Vt(n.value.stops[0])==="array"&&Vt(n.value.stops[0][0])==="object",M=ii({key:n.key,value:n.value,valueSpec:n.styleSpec.function,validateSpec:n.validateSpec,style:n.style,styleSpec:n.styleSpec,objectElementValidators:{stops:function(R){if(r==="identity")return[new He(R.key,R.value,'identity function may not have a "stops" property')];let B=[];const N=R.value;return B=B.concat(Ul({key:R.key,value:N,valueSpec:R.valueSpec,validateSpec:R.validateSpec,style:R.style,styleSpec:R.styleSpec,arrayElementValidator:C})),Vt(N)==="array"&&N.length===0&&B.push(new He(R.key,N,"array must have at least one stop")),B},default:function(R){return R.validateSpec({key:R.key,value:R.value,valueSpec:e,validateSpec:R.validateSpec,style:R.style,styleSpec:R.styleSpec})}}});return r==="identity"&&_&&M.push(new He(n.key,n.value,'missing required property "property"')),r==="identity"||n.value.stops||M.push(new He(n.key,n.value,'missing required property "stops"')),r==="exponential"&&n.valueSpec.expression&&!pu(n.valueSpec)&&M.push(new He(n.key,n.value,"exponential functions not supported")),n.styleSpec.$version>=8&&(w&&!Lo(n.valueSpec)?M.push(new He(n.key,n.value,"property functions not supported")):_&&!hp(n.valueSpec)&&M.push(new He(n.key,n.value,"zoom functions not supported"))),r!=="categorical"&&!E||n.value.property!==void 0||M.push(new He(n.key,n.value,'"property" property is required')),M;function C(R){let B=[];const N=R.value,U=R.key;if(Vt(N)!=="array")return[new He(U,N,`array expected, ${Vt(N)} found`)];if(N.length!==2)return[new He(U,N,`array length 2 expected, length ${N.length} found`)];if(E){if(Vt(N[0])!=="object")return[new He(U,N,`object expected, ${Vt(N[0])} found`)];if(N[0].zoom===void 0)return[new He(U,N,"object stop key must have zoom")];if(N[0].value===void 0)return[new He(U,N,"object stop key must have value")];if(d&&d>Zr(N[0].zoom))return[new He(U,N[0].zoom,"stop zoom values must appear in ascending order")];Zr(N[0].zoom)!==d&&(d=Zr(N[0].zoom),u=void 0,f={}),B=B.concat(ii({key:`${U}[0]`,value:N[0],valueSpec:{zoom:{}},validateSpec:R.validateSpec,style:R.style,styleSpec:R.styleSpec,objectElementValidators:{zoom:Ps,value:D}}))}else B=B.concat(D({key:`${U}[0]`,value:N[0],validateSpec:R.validateSpec,style:R.style,styleSpec:R.styleSpec},N));return Ro(Ya(N[1]))?B.concat([new He(`${U}[1]`,N[1],"expressions are not allowed in function stops.")]):B.concat(R.validateSpec({key:`${U}[1]`,value:N[1],valueSpec:e,validateSpec:R.validateSpec,style:R.style,styleSpec:R.styleSpec}))}function D(R,B){const N=Vt(R.value),U=Zr(R.value),Z=R.value!==null?R.value:B;if(o){if(N!==o)return[new He(R.key,Z,`${N} stop domain type must match previous stop domain type ${o}`)]}else o=N;if(N!=="number"&&N!=="string"&&N!=="boolean")return[new He(R.key,Z,"stop domain value must be a number, string, or boolean")];if(N!=="number"&&r!=="categorical"){let ae=`number expected, ${N} found`;return Lo(e)&&r===void 0&&(ae+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new He(R.key,Z,ae)]}return r!=="categorical"||N!=="number"||isFinite(U)&&Math.floor(U)===U?r!=="categorical"&&N==="number"&&u!==void 0&&U<u?[new He(R.key,Z,"stop domain values must appear in ascending order")]:(u=U,r==="categorical"&&U in f?[new He(R.key,Z,"stop domain values must be unique")]:(f[U]=!0,[])):[new He(R.key,Z,`integer expected, found ${U}`)]}}function xa(n){const e=(n.expressionContext==="property"?mu:ws)(Ya(n.value),n.valueSpec);if(e.result==="error")return e.value.map((o=>new He(`${n.key}${o.key}`,n.value,o.message)));const r=e.value.expression||e.value._styleExpression.expression;if(n.expressionContext==="property"&&n.propertyKey==="text-font"&&!r.outputDefined())return[new He(n.key,n.value,`Invalid data expression for "${n.propertyKey}". Output values must be contained as literals within the expression.`)];if(n.expressionContext==="property"&&n.propertyType==="layout"&&!xs(r))return[new He(n.key,n.value,'"feature-state" data expressions are not supported with layout properties.')];if(n.expressionContext==="filter"&&!xs(r))return[new He(n.key,n.value,'"feature-state" data expressions are not supported with filters.')];if(n.expressionContext&&n.expressionContext.indexOf("cluster")===0){if(!zl(r,["zoom","feature-state"]))return[new He(n.key,n.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(n.expressionContext==="cluster-initial"&&!Rl(r))return[new He(n.key,n.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Ms(n){const e=n.key,r=n.value,o=Vt(r);return o!=="string"?[new He(e,r,`color expected, ${o} found`)]:Nt.parse(String(r))?[]:[new He(e,r,`color expected, "${r}" found`)]}function Ka(n){const e=n.key,r=n.value,o=n.valueSpec,u=[];return Array.isArray(o.values)?o.values.indexOf(Zr(r))===-1&&u.push(new He(e,r,`expected one of [${o.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(o.values).indexOf(Zr(r))===-1&&u.push(new He(e,r,`expected one of [${Object.keys(o.values).join(", ")}], ${JSON.stringify(r)} found`)),u}function zo(n){return gu(Ya(n.value))?xa(Bn({},n,{expressionContext:"filter",valueSpec:{value:"boolean"}})):vp(n)}function vp(n){const e=n.value,r=n.key;if(Vt(e)!=="array")return[new He(r,e,`array expected, ${Vt(e)} found`)];const o=n.styleSpec;let u,d=[];if(e.length<1)return[new He(r,e,"filter array must have at least 1 element")];switch(d=d.concat(Ka({key:`${r}[0]`,value:e[0],valueSpec:o.filter_operator,style:n.style,styleSpec:n.styleSpec})),Zr(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&Zr(e[1])==="$type"&&d.push(new He(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&d.push(new He(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(u=Vt(e[1]),u!=="string"&&d.push(new He(`${r}[1]`,e[1],`string expected, ${u} found`)));for(let f=2;f<e.length;f++)u=Vt(e[f]),Zr(e[1])==="$type"?d=d.concat(Ka({key:`${r}[${f}]`,value:e[f],valueSpec:o.geometry_type,style:n.style,styleSpec:n.styleSpec})):u!=="string"&&u!=="number"&&u!=="boolean"&&d.push(new He(`${r}[${f}]`,e[f],`string, number, or boolean expected, ${u} found`));break;case"any":case"all":case"none":for(let f=1;f<e.length;f++)d=d.concat(vp({key:`${r}[${f}]`,value:e[f],style:n.style,styleSpec:n.styleSpec}));break;case"has":case"!has":u=Vt(e[1]),e.length!==2?d.push(new He(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):u!=="string"&&d.push(new He(`${r}[1]`,e[1],`string expected, ${u} found`))}return d}function xp(n,e){const r=n.key,o=n.validateSpec,u=n.style,d=n.styleSpec,f=n.value,_=n.objectKey,w=d[`${e}_${n.layerType}`];if(!w)return[];const E=_.match(/^(.*)-transition$/);if(e==="paint"&&E&&w[E[1]]&&w[E[1]].transition)return o({key:r,value:f,valueSpec:d.transition,style:u,styleSpec:d});const M=n.valueSpec||w[_];if(!M)return[new He(r,f,`unknown property "${_}"`)];let C;if(Vt(f)==="string"&&Lo(M)&&!M.tokens&&(C=/^{([^}]+)}$/.exec(f)))return[new He(r,f,`"${_}" does not support interpolation syntax
5Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(C[1])} }\`.`)];const D=[];return n.layerType==="symbol"&&_==="text-font"&&Fl(Ya(f))&&Zr(f.type)==="identity"&&D.push(new He(r,f,'"text-font" does not support identity functions')),D.concat(o({key:n.key,value:f,valueSpec:M,style:u,styleSpec:d,expressionContext:"property",propertyType:e,propertyKey:_}))}function bp(n){return xp(n,"paint")}function wp(n){return xp(n,"layout")}function Tp(n){let e=[];const r=n.value,o=n.key,u=n.style,d=n.styleSpec;if(Vt(r)!=="object")return[new He(o,r,`object expected, ${Vt(r)} found`)];r.type||r.ref||e.push(new He(o,r,'either "type" or "ref" is required'));let f=Zr(r.type);const _=Zr(r.ref);if(r.id){const w=Zr(r.id);for(let E=0;E<n.arrayIndex;E++){const M=u.layers[E];Zr(M.id)===w&&e.push(new He(o,r.id,`duplicate layer id "${r.id}", previously used at line ${M.id.__line__}`))}}if("ref"in r){let w;["type","source","source-layer","filter","layout"].forEach((E=>{E in r&&e.push(new He(o,r[E],`"${E}" is prohibited for ref layers`))})),u.layers.forEach((E=>{Zr(E.id)===_&&(w=E)})),w?w.ref?e.push(new He(o,r.ref,"ref cannot reference another ref layer")):f=Zr(w.type):e.push(new He(o,r.ref,`ref layer "${_}" not found`))}else if(f!=="background")if(r.source){const w=u.sources&&u.sources[r.source],E=w&&Zr(w.type);w?E==="vector"&&f==="raster"?e.push(new He(o,r.source,`layer "${r.id}" requires a raster source`)):E!=="raster-dem"&&f==="hillshade"||E!=="raster-dem"&&f==="color-relief"?e.push(new He(o,r.source,`layer "${r.id}" requires a raster-dem source`)):E==="raster"&&f!=="raster"?e.push(new He(o,r.source,`layer "${r.id}
5" requires a vector source`)):E!=="vector"||r["source-layer"]?E==="raster-dem"&&f!=="hillshade"&&f!=="color-relief"?e.push(new He(o,r.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):f!=="line"||!r.paint||!r.paint["line-gradient"]||E==="geojson"&&w.lineMetrics||e.push(new He(o,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new He(o,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new He(o,r.source,`source "${r.source}" not found`))}else e.push(new He(o,r,'missing required property "source"'));return e=e.concat(ii({key:o,value:r,valueSpec:d.layer,style:n.style,styleSpec:n.styleSpec,validateSpec:n.validateSpec,objectElementValidators:{"*":()=>[],type:()=>n.validateSpec({key:`${o}.type`,value:r.type,valueSpec:d.layer.type,style:n.style,styleSpec:n.styleSpec,validateSpec:n.validateSpec,object:r,objectKey:"type"}),filter:zo,layout:w=>ii({layer:r,key:w.key,value:w.value,style:w.style,styleSpec:w.styleSpec,validateSpec:w.validateSpec,objectElementValidators:{"*":E=>wp(Bn({layerType:f},E))}}),paint:w=>ii({layer:r,key:w.key,value:w.value,style:w.style,styleSpec:w.styleSpec,validateSpec:w.validateSpec,objectElementValidators:{"*":E=>bp(Bn({layerType:f},E))}})}})),e}function ba(n){const e=n.value,r=n.key,o=Vt(e);return o!=="string"?[new He(r,e,`string expected, ${o} found`)]:[]}const yu={promoteId:function({key:n,value:e}){if(Vt(e)==="string")return ba({key:n,value:e});{const r=[];for(const o in e)r.push(...ba({key:`${n}.${o}`,value:e[o]}));return r}}};function _u(n){const e=n.value,r=n.key,o=n.styleSpec,u=n.style,d=n.validateSpec;if(!e.type)return[new He(r,e,'"type" is required')];const f=Zr(e.type);let _;switch(f){case"vector":case"raster":return _=ii({key:r,value:e,valueSpec:o[`source_${f.replace("-","_")}`],style:n.style,styleSpec:o,objectElementValidators:yu,validateSpec:d}),_;case"raster-dem":return _=(function(w){var E;const M=(E=w.sourceName)!==null&&E!==void 0?E:"",C=w.value,D=w.styleSpec,R=D.source_raster_dem,B=w.style;let N=[];const U=Vt(C);if(C===void 0)return N;if(U!=="object")return N.push(new He("source_raster_dem",C,`object expected, ${U} found`)),N;const Z=Zr(C.encoding)==="custom",ae=["redFactor","greenFactor","blueFactor","baseShift"],W=w.value.encoding?`"${w.value.encoding}"`:"Default";for(const X in C)!Z&&ae.includes(X)?N.push(new He(X,C[X],`In "${M}": "${X}" is only valid when "encoding" is set to "custom". ${W} encoding found`)):R[X]?N=N.concat(w.validateSpec({key:X,value:C[X],valueSpec:R[X],validateSpec:w.validateSpec,style:B,styleSpec:D})):N.push(new He(X,C[X],`unknown property "${X}"`));return N})({sourceName:r,value:e,style:n.style,styleSpec:o,validateSpec:d}),_;case"geojson":if(_=ii({key:r,value:e,valueSpec:o.source_geojson,style:u,styleSpec:o,validateSpec:d,objectElementValidators:yu}),e.cluster)for(const w in e.clusterProperties){const[E,M]=e.clusterProperties[w],C=typeof E=="string"?[E,["accumulated"],["get",w]]:E;_.push(...xa({key:`${r}.${w}.map`,value:M,expressionContext:"cluster-map"})),_.push(...xa({key:`${r}.${w}.reduce`,value:C,expressionContext:"cluster-reduce"}))}return _;case"video":return ii({key:r,value:e,valueSpec:o.source_video,style:u,validateSpec:d,styleSpec:o});case"image":return ii({key:r,value:e,valueSpec:o.source_image,style:u,validateSpec:d,styleSpec:o});case"canvas":return[new He(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Ka({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function Is(n){const e=n.value,r=n.styleSpec,o=r.light,u=n.style;let d=[];const f=Vt(e);if(e===void 0)return d;if(f!=="object")return d=d.concat([new He("light",e,`object expected, ${f} found`)]),d;for(const _ in e){const w=_.match(/^(.*)-transition$/);d=d.concat(w&&o[w[1]]&&o[w[1]].transition?n.validateSpec({key:_,value:e[_],valueSpec:r.transition,validateSpec:n.validateSpec,style:u,styleSpec:r}):o[_]?n.validateSpec({key:_,value:e[_],valueSpec:o[_],validateSpec:n.validateSpec,style:u,styleSpec:r}):[new He(_,e[_],`unknown property "${_}"`)])}return d}function Sp(n){const e=n.value,r=n.styleSpec,o=r.sky,u=n.style,d=Vt(e);if(e===void 0)return[];if(d!=="object")return[new He("sky",e,`object expected, ${d} found`)];let f=[];for(const _ in e)f=f.concat(o[_]?n.validateSpec({key:_,value:e[_],valueSpec:o[_],style:u,styleSpec:r}):[new He(_,e[_],`unknown property "${_}"`)]);return f}function vu(n){const e=n.value,r=n.styleSpec,o=r.terrain,u=n.style;let d=[];const f=Vt(e);if(e===void 0)return d;if(f!=="object")return d=d.concat([new He("terrain",e,`object expected, ${f} found`)]),d;for(const _ in e)d=d.concat(o[_]?n.validateSpec({key:_,value:e[_],valueSpec:o[_],validateSpec:n.validateSpec,style:u,styleSpec:r}):[new He(_,e[_],`unknown property "${_}"`)]);return d}function xu(n){let e=[];const r=n.value,o=n.key;if(Array.isArray(r)){const u=[],d=[];for(const f in r)r[f].id&&u.includes(r[f].id)&&e.push(new He(o,r,`all the sprites' ids must be unique, but ${r[f].id} is duplicated`)),u.push(r[f].id),r[f].url&&d.includes(r[f].url)&&e.push(new He(o,r,`all the sprites' URLs must be unique, but ${r[f].url} is duplicated`)),d.push(r[f].url),e=e.concat(ii({key:`${o}[${f}]`,value:r[f],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:n.validateSpec}));return e}return ba({key:o,value:r})}function Ep(n){return!!n&&n.constructor===Object}function bu(n){return Ep(n.value)?[]:[new He(n.key,n.value,`object expected, ${Vt(n.value)} found`)]}const wu={"*":()=>[],array:Ul,boolean:function(n){const e=n.value,r=n.key,o=Vt(e);return o!=="boolean"?[new He(r,e,`boolean expected, ${o} found`)]:[]},number:Ps,color:Ms,constants:_p,enum:Ka,filter:zo,function:$l,layer:Tp,object:ii,source:_u,light:Is,sky:Sp,terrain:vu,projection:function(n){const e=n.value,r=n.styleSpec,o=r.projection,u=n.style,d=Vt(e);if(e===void 0)return[];if(d!=="object")return[new He("projection",e,`object expected, ${d} found`)];let f=[];for(const _ in e)f=f.concat(o[_]?n.validateSpec({key:_,value:e[_],valueSpec:o[_],style:u,styleSpec:r}):[new He(_,e[_],`unknown property "${_}"`)]);return f},projectionDefinition:function(n){const e=n.key;let r=n.value;r=r instanceof String?r.valueOf():r;const o=Vt(r);return o!=="array"||(function(u){return Array.isArray(u)&&u.length===3&&typeof u[0]=="string"&&typeof u[1]=="string"&&typeof u[2]=="number"})(r)||(function(u){return!!["interpolate","step","literal"].includes(u[0])})(r)?["array","string"].includes(o)?[]:[new He(e,r,`projection expected, invalid type "${o}" found`)]:[new He(e,r,`projection expected, invalid array ${JSON.stringify(r)} found`)]},string:ba,formatted:function(n){return ba(n).length===0?[]:xa(n)},resolvedImage:function(n){return ba(n).length===0?[]:xa(n)},padding:function(n){const e=n.key,r=n.value;if(Vt(r)==="array"){if(r.length<1||r.length>4)return[new He(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];const o={type:"number"};let u=[];for(let d=0;d<r.length;d++)u=u.concat(n.validateSpec({key:`${e}[${d}
5]`,value:r[d],validateSpec:n.validateSpec,valueSpec:o}));return u}return Ps({key:e,value:r,valueSpec:{}})},numberArray:function(n){const e=n.key,r=n.value;if(Vt(r)==="array"){const o={type:"number"};if(r.length<1)return[new He(e,r,"array length at least 1 expected, length 0 found")];let u=[];for(let d=0;d<r.length;d++)u=u.concat(n.validateSpec({key:`${e}[${d}]`,value:r[d],validateSpec:n.validateSpec,valueSpec:o}));return u}return Ps({key:e,value:r,valueSpec:{}})},colorArray:function(n){const e=n.key,r=n.value;if(Vt(r)==="array"){if(r.length<1)return[new He(e,r,"array length at least 1 expected, length 0 found")];let o=[];for(let u=0;u<r.length;u++)o=o.concat(Ms({key:`${e}[${u}]`,value:r[u]}));return o}return Ms({key:e,value:r})},variableAnchorOffsetCollection:function(n){const e=n.key,r=n.value,o=Vt(r),u=n.styleSpec;if(o!=="array"||r.length<1||r.length%2!=0)return[new He(e,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let d=[];for(let f=0;f<r.length;f+=2)d=d.concat(Ka({key:`${e}[${f}]`,value:r[f],valueSpec:u.layout_symbol["text-anchor"]})),d=d.concat(Ul({key:`${e}[${f+1}]`,value:r[f+1],valueSpec:{length:2,value:"number"},validateSpec:n.validateSpec,style:n.style,styleSpec:u}));return d},sprite:xu,state:bu,fontFaces:function(n){const e=n.key,r=n.value,o=n.validateSpec,u=n.styleSpec,d=n.style;if(!Ep(r))return[new He(e,r,`object expected, ${Vt(r)} found`)];const f=[];for(const _ in r){const w=r[_],E=Vt(w);if(E==="string")f.push(...ba({key:`${e}.${_}`,value:w}));else if(E==="array"){const M={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(const[C,D]of w.entries())f.push(...ii({key:`${e}.${_}[${C}]`,value:D,valueSpec:M,styleSpec:u,style:d,validateSpec:o}))}else f.push(new He(`${e}.${_}`,w,`string or array expected, ${E} found`))}return f}};function wa(n){const e=n.value,r=n.valueSpec,o=n.styleSpec;return n.validateSpec=wa,r.expression&&Fl(Zr(e))?$l(n):r.expression&&Ro(Ya(e))?xa(n):r.type&&wu[r.type]?wu[r.type](n):ii(Bn({},n,{valueSpec:r.type?o[r.type]:r}))}function Pp(n){const e=n.value,r=n.key,o=ba(n);return o.length||(e.indexOf("{fontstack}")===-1&&o.push(new He(r,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&o.push(new He(r,e,'"glyphs" url must include a "{range}" token'))),o}function mi(n,e=Te){let r=[];return r=r.concat(wa({key:"",value:n,valueSpec:e.$root,styleSpec:e,style:n,validateSpec:wa,objectElementValidators:{glyphs:Pp,"*":()=>[]}})),n.constants&&(r=r.concat(_p({key:"constants",value:n.constants}))),Mp(r)}function Si(n){return function(e){return n(Object.assign({},e,{validateSpec:wa}))}}function Mp(n){return[].concat(n).sort(((e,r)=>e.line-r.line))}function Ei(n){return function(...e){return Mp(n.apply(this,e))}}mi.source=Ei(Si(_u)),mi.sprite=Ei(Si(xu)),mi.glyphs=Ei(Si(Pp)),mi.light=Ei(Si(Is)),mi.sky=Ei(Si(Sp)),mi.terrain=Ei(Si(vu)),mi.state=Ei(Si(bu)),mi.layer=Ei(Si(Tp)),mi.filter=Ei(Si(zo)),mi.paintProperty=Ei(Si(bp)),mi.layoutProperty=Ei(Si(wp));const kf={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"};class As{constructor(e,r){this._globalState=r,this.setValue(e)}evaluate(){var e;return(e=this._literalValue)!==null&&e!==void 0?e:this._compiledValue.evaluate({})}setValue(e){if(e==null||e==="visible"||e==="none")return this._literalValue=e==="none"?"none":"visible",this._compiledValue=void 0,void(this._globalStateRefs=new Set);const r=ws(e,kf,this._globalState);if(r.result==="error")throw this._literalValue="visible",this._compiledValue=void 0,new Error(r.value.map((o=>`${o.key}: ${o.message}`)).join(", "));this._literalValue=void 0,this._compiledValue=r.value,this._globalStateRefs=va(r.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}}const Cs=Te,vn=mi,ks=vn.light,Ip=vn.sky,Df=vn.paintProperty,Lf=vn.layoutProperty;function Fo(n,e){let r=!1;if(e&&e.length)for(const o of e)n.fire(new At(new Error(o.message))),r=!0;return r}class Oo{constructor(e,r,o){const u=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const f=new Int32Array(this.arrayBuffer);e=f[0],this.d=(r=f[1])+2*(o=f[2]);for(let w=0;w<this.d*this.d;w++){const E=f[3+w],M=f[3+w+1];u.push(E===M?null:f.subarray(E,M))}const _=f[3+u.length+1];this.keys=f.subarray(f[3+u.length],_),this.bboxes=f.subarray(_),this.insert=this._insertReadonly}else{this.d=r+2*o;for(let f=0;f<this.d*this.d;f++)u.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=e,this.padding=o,this.scale=r/e,this.uid=0;const d=o/r*e;this.min=-d,this.max=e+d}
vendor: 20,304 bytes, line 5
5insert(e,r,o,u,d){this._forEachCell(r,o,u,d,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(r),this.bboxes.push(o),this.bboxes.push(u),this.bboxes.push(d)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,r,o,u,d,f){this.cells[d].push(f)}query(e,r,o,u,d){const f=this.min,_=this.max;if(e<=f&&r<=f&&_<=o&&_<=u&&!d)return Array.prototype.slice.call(this.keys);{const w=[];return this._forEachCell(e,r,o,u,this._queryCell,w,{},d),w}}_queryCell(e,r,o,u,d,f,_,w){const E=this.cells[d];if(E!==null){const M=this.keys,C=this.bboxes;for(let D=0;D<E.length;D++){const R=E[D];if(_[R]===void 0){const B=4*R;(w?w(C[B+0],C[B+1],C[B+2],C[B+3]):e<=C[B+2]&&r<=C[B+3]&&o>=C[B+0]&&u>=C[B+1])?(_[R]=!0,f.push(M[R])):_[R]=!1}}}}_forEachCell(e,r,o,u,d,f,_,w){const E=this._convertToCellCoord(e),M=this._convertToCellCoord(r),C=this._convertToCellCoord(o),D=this._convertToCellCoord(u);for(let R=E;R<=C;R++)for(let B=M;B<=D;B++){const N=this.d*B+R;if((!w||w(this._convertFromCellCoord(R),this._convertFromCellCoord(B),this._convertFromCellCoord(R+1),this._convertFromCellCoord(B+1)))&&d.call(this,e,r,o,u,N,f,_,w))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,r=3+this.cells.length+1+1;let o=0;for(let f=0;f<this.cells.length;f++)o+=this.cells[f].length;const u=new Int32Array(r+o+this.keys.length+this.bboxes.length);u[0]=this.extent,u[1]=this.n,u[2]=this.padding;let d=r;for(let f=0;f<e.length;f++){const _=e[f];u[3+f]=d,u.set(_,d),d+=_.length}return u[3+e.length]=d,u.set(this.keys,d),d+=this.keys.length,u[3+e.length+1]=d,u.set(this.bboxes,d),d+=this.bboxes.length,u.buffer}static serialize(e,r){const o=e.toArrayBuffer();return r&&r.push(o),{buffer:o}}static deserialize(e){return new Oo(e.buffer)}}const Pi={};function ht(n,e,r={}){if(Pi[n])throw new Error(`${n} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:n,writeable:!1}),Pi[n]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}ht("Object",Object),ht("Set",Set),ht("TransferableGridIndex",Oo),ht("Color",Nt),ht("Error",Error),ht("AJAXError",ne),ht("ResolvedImage",ni),ht("StylePropertyFunction",Bl),ht("StyleExpression",du,{omit:["_evaluator"]}),ht("ZoomDependentExpression",fu),ht("ZoomConstantExpression",Ol),ht("CompoundExpression",fi,{omit:["_evaluate"]});for(const n in ko)ko[n]._classRegistryKey||ht(`Expression_${n}`,ko[n]);function ql(n){return n&&typeof ArrayBuffer<"u"&&(n instanceof ArrayBuffer||n.constructor&&n.constructor.name==="ArrayBuffer")}function Tu(n){return n.$name||n.constructor._classRegistryKey}function Bo(n){return!(function(e){if(e===null||typeof e!="object")return!1;const r=Tu(e);return!(!r||r==="Object")})(n)&&(n==null||typeof n=="boolean"||typeof n=="number"||typeof n=="string"||n instanceof Boolean||n instanceof Number||n instanceof String||n instanceof Date||n instanceof RegExp||n instanceof Blob||n instanceof Error||ql(n)||fn(n)||ArrayBuffer.isView(n)||n instanceof ImageData)}function Ds(n,e){if(Bo(n))return(ql(n)||fn(n))&&e&&e.push(n),ArrayBuffer.isView(n)&&e&&e.push(n.buffer),n instanceof ImageData&&e&&e.push(n.data.buffer),n;if(Array.isArray(n)){const d=[];for(const f of n)d.push(Ds(f,e));return d}if(typeof n!="object")throw new Error("can't serialize object of type "+typeof n);const r=Tu(n);if(!r)throw new Error(`can't serialize object of unregistered class ${n.constructor.name}`);if(!Pi[r])throw new Error(`${r} is not registered.`);const{klass:o}=Pi[r],u=o.serialize?o.serialize(n,e):{};if(o.serialize){if(e&&u===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const d in n){if(!n.hasOwnProperty(d)||Pi[r].omit.indexOf(d)>=0)continue;const f=n[d];u[d]=Pi[r].shallow.indexOf(d)>=0?f:Ds(f,e)}n instanceof Error&&(u.message=n.message)}if(u.$name)throw new Error("$name property is reserved for worker serialization logic.");return r!=="Object"&&(u.$name=r),u}function Ls(n){if(Bo(n))return n;if(Array.isArray(n))return n.map(Ls);if(typeof n!="object")throw new Error("can't deserialize object of type "+typeof n);const e=Tu(n)||"Object";if(!Pi[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=Pi[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(n);const o=Object.create(r.prototype);for(const u of Object.keys(n)){if(u==="$name")continue;const d=n[u];o[u]=Pi[e].shallow.indexOf(u)>=0?d:Ls(d)}return o}class Su{constructor(){this.first=!0}update(e,r){const o=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=o,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=o,!0):(this.lastFloorZoom>o?(this.lastIntegerZoom=o+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<o&&(this.lastIntegerZoom=o,this.lastIntegerZoomTime=r),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=o,!0))}}function Rs(n){return/[\u02EA\u02EB\u2E80-\u2FDF\u2FF0-\u303F\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FD-\u30FF\u3105-\u312F\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(n))}function Eu(n){return/[\u02EA\u02EB\u1100-\u11FF\u1400-\u167F\u18B0-\u18F5\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u3007\u3012\u3013\u3020-\u302F\u3031-\u303F\u3041-\u3096\u309D-\u30FB\u30FD-\u30FF\u3105-\u312F\u3131-\u318E\u3190-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE48\uFE50-\uFE57\uFE5F-\uFE62\uFE67-\uFE6F\uFF00-\uFF07\uFF0A-\uFF0C\uFF0E-\uFF19\uFF1F-\uFF3A\uFF3C\uFF3E\uFF40-\uFF5A\uFFE0-\uFFE2\uFFE4-\uFFE7]|\uD802[\uDD80-\uDD9F]|\uD805[\uDD80-\uDDFF]|\uD806[\uDE00-\uDEBF]|\uD811[\uDC00-\uDE7F]|\uD81B[\uDFE0-\uDFE4\uDFF0-\uDFF6]|[\uD81C-\uD822\uD83D\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD30-\uDEFB]|\uD833[\uDEC0-\uDFCF]|\uD834[\uDC00-\uDDFF\uDEE0-\uDF7F]|\uD836[\uDC00-\uDEAF]|\uD83C[\uDC00-\uDE00\uDF00-\uDFFF]|\uD83E[\uDD00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(n))}function Ap(n){return/\s/u.test(String.fromCodePoint(n))}function No(n){for(const e of n)if(Eu(e.codePointAt(0)))return!0;return!1}function Rf(n){for(const e of n)if(!Cp(e.codePointAt(0)))return!1;return!0}function Gl(n){const e=n.map((r=>{try{return new RegExp(`\\p{sc=${r}}`,"u").source}catch{return null}})).filter((r=>r));return new RegExp(e.join("|"),"u")}const Zl=Gl(["Arab","Dupl","Mong","Ougr","Syrc"]);function Cp(n){return!Zl.test(String.fromCodePoint(n))}function Pu(n){return!(Eu(n)||(e=n,/[\xA7\xA9\xAE\xB1\xBC-\xBE\xD7\xF7\u2016\u2020\u2021\u2030\u2031\u203B\u203C\u2042\u2047-\u2049\u2051\u2100-\u218F\u221E\u2234\u2235\u2300-\u2307\u230C-\u231F\u2324-\u2328\u232B\u237D-\u239A\u23BE-\u23CD\u23CF\u23D1-\u23DB\u23E2-\u2422\u2424-\u24FF\u25A0-\u2619\u2620-\u2767\u2776-\u2793\u2B12-\u2B2F\u2B50-\u2B59\u2BB8-\u2BEB\u3000-\u303F\u30A0-\u30FF\uE000-\uF8FF\uFE30-\uFE6F\uFF00-\uFFEF\uFFFC\uFFFD]|[\uDB80-\uDBFF][\uDC00-\uDFFF]/gim.test(String.fromCodePoint(e))));var e}const kp=Gl(["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 Mu(n){return kp.test(String.fromCodePoint(n))}function Iu(n,e){return!(!e&&Mu(n)||/[\u0900-\u0DFF\u0F00-\u109F\u1780-\u17FF]/gim.test(String.fromCodePoint(n)))}function Dp(n){for(const e of n)if(Mu(e.codePointAt(0)))return!0;return!1}const Ta=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(n){this.pluginStatus=n.pluginStatus,this.pluginURL=n.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(n){if(Ta.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=n.applyArabicShaping,this.processBidirectionalText=n.processBidirectionalText,this.processStyledBidirectionalText=n.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}syncState(n,e){return s(this,void 0,void 0,(function*(){if(this.isParsed())return this.getState();if(n.pluginStatus!=="loading")return this.setState(n),n;const r=n.pluginURL,o=new Promise((d=>{this.loadScriptResolve=d}));e(r);const u=new Promise((d=>setTimeout((()=>d()),this.TIMEOUT)));if(yield Promise.race([o,u]),this.isParsed()){const d={pluginStatus:"loaded",pluginURL:r};return this.setState(d),d}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${r}`)}))}};class dr{constructor(e,r){this.isSupportedScript=zf,this.zoom=e,r?(this.now=r.now||0,this.fadeDuration=r.fadeDuration||0,this.zoomHistory=r.zoomHistory||new Su,this.transition=r.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Su,this.transition={})}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,r=e-Math.floor(e),o=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*o}:{fromScale:.5,toScale:1,t:1-(1-o)*r}}}function zf(n){return(function(e,r){for(const o of e)if(!Iu(o.codePointAt(0),r))return!1;return!0})(n,Ta.getRTLTextPluginStatus()==="loaded")}const zs="-transition";class Wl{constructor(e,r,o){this.property=e,this.value=r,this.expression=(function(u,d,f){if(Fl(u))return new Bl(u,d);if(Ro(u)){const _=mu(u,d,f);if(_.result==="error")throw new Error(_.value.map((w=>`${w.key}: ${w.message}`)).join(", "));return _.value}{let _=u;return d.type==="color"&&typeof u=="string"?_=Nt.parse(u):d.type!=="padding"||typeof u!="number"&&!Array.isArray(u)?d.type!=="numberArray"||typeof u!="number"&&!Array.isArray(u)?d.type!=="colorArray"||typeof u!="string"&&!Array.isArray(u)?d.type==="variableAnchorOffsetCollection"&&Array.isArray(u)?_=Vn.parse(u):d.type==="projectionDefinition"&&typeof u=="string"&&(_=Un.parse(u)):_=Mt.parse(u):_=Rr.parse(u):_=Dn.parse(u),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>_}}})(r===void 0?e.specification.default:r,e.specification,o)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(e,r,o){return this.property.possiblyEvaluate(this,e,r,o)}}class Hl{constructor(e,r){this.property=e,this.value=new Wl(e,void 0,r)}transitioned(e,r){return new Lp(this.property,this.value,r,$t({},e.transition,this.transition),e.now)}untransitioned(){return new Lp(this.property,this.value,null,{},0)}}class Au{constructor(e,r){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._globalState=r}getValue(e){return jt(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Hl(this._values[e].property,this._globalState)),this._values[e].value=new Wl(this._values[e].property,r===null?void 0:jt(r),this._globalState)}getTransition(e){return jt(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Hl(this._values[e].property,this._globalState)),this._values[e].transition=jt(r)||void 0}serialize(){const e={};for(const r of Object.keys(this._values)){const o=this.getValue(r);o!==void 0&&(e[r]=o);const u=this.getTransition(r);u!==void 0&&(e[`${r}${zs}`]=u)}return e}transitioned(e,r){const o=new Rp(this._properties);for(const u of Object.keys(this._values))o._values[u]=this._values[u].transitioned(e,r._values[u]);return o}untransitioned(){const e=new Rp(this._properties);for(const r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}}class Lp{constructor(e,r,o,u,d){this.property=e,this.value=r,this.begin=d+u.delay||0,this.end=this.begin+u.duration||0,e.specification.transition&&(u.delay||u.duration)&&(this.prior=o)}possiblyEvaluate(e,r,o){const u=e.now||0,d=this.value.possiblyEvaluate(e,r,o),f=this.prior;if(f){if(u>this.end)return this.prior=null,d;if(this.value.isDataDriven())return this.prior=null,d;if(u<this.begin)return f.possiblyEvaluate(e,r,o);{const _=(u-this.begin)/(this.end-this.begin);return this.property.interpolate(f.possiblyEvaluate(e,r,o),d,Rt(_))}}return d}}class Rp{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,o){const u=new Fs(this._properties);for(const d of Object.keys(this._values))u._values[d]=this._values[d].possiblyEvaluate(e,r,o);return u}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class zp{constructor(e,r){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._globalState=r}hasValue(e){return this._values[e].value!==void 0}getValue(e){return jt(this._values[e].value)}setValue(e,r){this._values[e]=new Wl(this._values[e].property,r===null?void 0:jt(r),this._globalState)}serialize(){const e={};for(const r of Object.keys(this._values)){const o=this.getValue(r);o!==void 0&&(e[r]=o)}return e}possiblyEvaluate(e,r,o){const u=new Fs(this._properties);for(const d of Object.keys(this._values))u._values[d]=this._values[d].possiblyEvaluate(e,r,o);return u}}class Mi{constructor(e,r,o){this.property=e,this.value=r,this.parameters=o}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,r,o,u){return this.property.evaluate(this.value,this.parameters,e,r,o,u)}}class Fs{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class gt{constructor(e){this.specification=e}possiblyEvaluate(e,r){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(r)}interpolate(e,r,o){const u=Ir[this.specification.type];return u?u(e,r,o):e}}class bt{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,o,u){return new Mi(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(r,null,{},o,u)}:e.expression,r)}interpolate(e,r,o){if(e.value.kind!=="constant"||r.value.kind!=="constant")return e;if(e.value.value===void 0||r.value.value===void 0)return new Mi(this,{kind:"constant",value:void 0},e.parameters);const u=Ir[this.specification.type];if(u){const d=u(e.value.value,r.value.value,o);return new Mi(this,{kind:"constant",value:d},e.parameters)}return e}evaluate(e,r,o,u,d,f){return e.kind==="constant"?e.value:e.evaluate(r,o,u,d,f)}}class Os extends bt{possiblyEvaluate(e,r,o,u){if(e.value===void 0)return new Mi(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){const d=e.expression.evaluate(r,null,{},o,u),f=e.property.specification.type==="resolvedImage"&&typeof d!="string"?d.name:d,_=this._calculate(f,f,f,r);return new Mi(this,{kind:"constant",value:_},r)}if(e.expression.kind==="camera"){const d=this._calculate(e.expression.evaluate({zoom:r.zoom-1}),e.expression.evaluate({zoom:r.zoom}),e.expression.evaluate({zoom:r.zoom+1}),r);return new Mi(this,{kind:"constant",value:d},r)}return new Mi(this,e.expression,r)}evaluate(e,r,o,u,d,f){if(e.kind==="source"){const _=e.evaluate(r,o,u,d,f);return this._calculate(_,_,_,r)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(r.zoom)-1},o,u),e.evaluate({zoom:Math.floor(r.zoom)},o,u),e.evaluate({zoom:Math.floor(r.zoom)+1},o,u),r):e.value}_calculate(e,r,o,u){return u.zoom>u.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:o,to:r}}interpolate(e){return e}}class Xl{constructor(e){this.specification=e}possiblyEvaluate(e,r,o,u){if(e.value!==void 0){if(e.expression.kind==="constant"){const d=e.expression.evaluate(r,null,{},o,u);return this._calculate(d,d,d,r)}return this._calculate(e.expression.evaluate(new dr(Math.floor(r.zoom-1),r)),e.expression.evaluate(new dr(Math.floor(r.zoom),r)),e.expression.evaluate(new dr(Math.floor(r.zoom+1),r)),r)}}_calculate(e,r,o,u){return u.zoom>u.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:o,to:r}}interpolate(e){return e}}class Yl{constructor(e){this.specification=e}possiblyEvaluate(e,r,o,u){return!!e.expression.evaluate(r,null,{},o,u)}interpolate(){return!1}}class qn{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in e){const o=e[r];o.specification.overridable&&this.overridableProperties.push(r);const u=this.defaultPropertyValues[r]=new Wl(o,void 0,void 0),d=this.defaultTransitionablePropertyValues[r]=new Hl(o,void 0);this.defaultTransitioningPropertyValues[r]=d.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=u.possiblyEvaluate({})}}}ht("DataDrivenProperty",bt),ht("DataConstantProperty",gt),ht("CrossFadedDataDrivenProperty",Os),ht("CrossFadedProperty",Xl),ht("ColorRampProperty",Yl);class gi extends St{constructor(e,r,o){if(super(),this.id=e.id,this.type=e.type,this._globalState=o,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=(function(u,d){return new As(u,d)})(this.visibility,o),e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter,this._featureFilter=Ts(e.filter,o)),r.layout&&(this._unevaluatedLayout=new zp(r.layout,o)),r.paint)){this._transitionablePaint=new Au(r.paint,o);for(const u in e.paint)this.setPaintProperty(u,e.paint[u],{validate:!1});for(const u in e.layout)this.setLayoutProperty(u,e.layout[u],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Fs(r.paint)}}setFilter(e){this.filter=e,this._featureFilter=Ts(e,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}getLayoutAffectingGlobalStateRefs(){const e=new Set;for(const r of this._visibilityExpression.getGlobalStateRefs())e.add(r);if(this._unevaluatedLayout)for(const r in this._unevaluatedLayout._values){const o=this._unevaluatedLayout._values[r];for(const u of o.getGlobalStateRefs())e.add(u)}for(const r of this._featureFilter.getGlobalStateRefs())e.add(r);return e}getPaintAffectingGlobalStateRefs(){var e;const r=new globalThis.Map;if(this._transitionablePaint)for(const o in this._transitionablePaint._values){const u=this._transitionablePaint._values[o].value;for(const d of u.getGlobalStateRefs()){const f=(e=r.get(d))!==null&&e!==void 0?e:[];f.push({name:o,value:u.value}),r.set(d,f)}}return r}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(e,r,o={}
5){if(r==null||!this._validate(Lf,`layers.${this.id}.layout.${e}`,e,r,o))return e==="visibility"?(this.visibility=r,this._visibilityExpression.setValue(r),void this.recalculateVisibility()):void this._unevaluatedLayout.setValue(e,r)}getPaintProperty(e){return e.endsWith(zs)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,o={}){if(r!=null&&this._validate(Df,`layers.${this.id}.paint.${e}`,e,r,o))return!1;if(e.endsWith(zs))return this._transitionablePaint.setTransition(e.slice(0,-11),r||void 0),!1;{const u=this._transitionablePaint._values[e],d=u.property.specification["property-type"]==="cross-faded-data-driven",f=u.value.isDataDriven(),_=u.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);const w=this._transitionablePaint._values[e].value;return w.isDataDriven()||f||d||this._handleOverridablePaintPropertyUpdate(e,_,w)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,o){return!1}isHidden(e=this.minzoom,r=!1){return!!(this.minzoom&&e<(r?Math.floor(this.minzoom):this.minzoom))||!!(this.maxzoom&&e>=this.maxzoom)||this._evaluatedVisibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}recalculate(e,r){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,r)}
vendor: 102,708 bytes, line 5
5serialize(){const e={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&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),kn(e,((r,o)=>!(r===void 0||o==="layout"&&!Object.keys(r).length||o==="paint"&&!Object.keys(r).length)))}_validate(e,r,o,u,d={}){return(!d||d.validate!==!1)&&Fo(this,e.call(vn,{key:r,layerType:this.type,objectKey:o,value:u,styleSpec:Te,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const r=this.paint.get(e);if(r instanceof Mi&&Lo(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}let Cu;var Fp={get paint(){return Cu=Cu||new qn({"raster-opacity":new gt(Te.paint_raster["raster-opacity"]),"raster-hue-rotate":new gt(Te.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new gt(Te.paint_raster["raster-brightness-min"]),"raster-brightness-max":new gt(Te.paint_raster["raster-brightness-max"]),"raster-saturation":new gt(Te.paint_raster["raster-saturation"]),"raster-contrast":new gt(Te.paint_raster["raster-contrast"]),"raster-resampling":new gt(Te.paint_raster["raster-resampling"]),"raster-fade-duration":new gt(Te.paint_raster["raster-fade-duration"])})}};class Ff extends gi{constructor(e,r){super(e,Fp,r)}}const Of={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Bs{constructor(e,r){this._structArray=e,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class zr{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,r){return e._trim(),r&&(e.isTransferred=!0,r.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const r=Object.create(this.prototype);return r.arrayBuffer=e.arrayBuffer,r.length=e.length,r.capacity=e.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(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Wr(n,e=1){let r=0,o=0;return{members:n.map((u=>{const d=Of[u.type].BYTES_PER_ELEMENT,f=r=Ja(r,Math.max(e,d)),_=u.components||1;return o=Math.max(o,d),r+=d*_,{name:u.name,type:u.type,components:_,offset:f}})),size:Ja(r,Math.max(o,e)),alignment:e}}function Ja(n,e){return Math.ceil(n/e)*e}class Ns extends zr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){const o=this.length;return this.resize(o+1),this.emplace(o,e,r)}emplace(e,r,o){const u=2*e;return this.int16[u+0]=r,this.int16[u+1]=o,e}}Ns.prototype.bytesPerElement=4,ht("StructArrayLayout2i4",Ns);class Kl extends zr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,o)}emplace(e,r,o,u){const d=3*e;return this.int16[d+0]=r,this.int16[d+1]=o,this.int16[d+2]=u,e}}Kl.prototype.bytesPerElement=6,ht("StructArrayLayout3i6",Kl);class ku extends zr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,u){const d=this.length;return this.resize(d+1),this.emplace(d,e,r,o,u)}emplace(e,r,o,u,d){const f=4*e;return this.int16[f+0]=r,this.int16[f+1]=o,this.int16[f+2]=u,this.int16[f+3]=d,e}}ku.prototype.bytesPerElement=8,ht("StructArrayLayout4i8",ku);class Jl extends zr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,u,d,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,r,o,u,d,f)}emplace(e,r,o,u,d,f,_){const w=6*e;return this.int16[w+0]=r,this.int16[w+1]=o,this.int16[w+2]=u,this.int16[w+3]=d,this.int16[w+4]=f,this.int16[w+5]=_,e}}Jl.prototype.bytesPerElement=12,ht("StructArrayLayout2i4i12",Jl);class Du extends zr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,u,d,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,r,o,u,d,f)}emplace(e,r,o,u,d,f,_){const w=4*e,E=8*e;return this.int16[w+0]=r,this.int16[w+1]=o,this.uint8[E+4]=u,this.uint8[E+5]=d,this.uint8[E+6]=f,this.uint8[E+7]=_,e}}Du.prototype.bytesPerElement=8,ht("StructArrayLayout2i4ub8",Du);class js extends zr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){const o=this.length;return this.resize(o+1),this.emplace(o,e,r)}emplace(e,r,o){const u=2*e;return this.float32[u+0]=r,this.float32[u+1]=o,e}}js.prototype.bytesPerElement=8,ht("StructArrayLayout2f8",js);class ea extends zr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o,u,d,f,_,w,E,M){const C=this.length;return this.resize(C+1),this.emplace(C,e,r,o,u,d,f,_,w,E,M)}emplace(e,r,o,u,d,f,_,w,E,M,C){const D=10*e;return this.uint16[D+0]=r,this.uint16[D+1]=o,this.uint16[D+2]=u,this.uint16[D+3]=d,this.uint16[D+4]=f,this.uint16[D+5]=_,this.uint16[D+6]=w,this.uint16[D+7]=E,this.uint16[D+8]=M,this.uint16[D+9]=C,e}}ea.prototype.bytesPerElement=20,ht("StructArrayLayout10ui20",ea);class Ql extends zr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o,u,d,f,_,w){const E=this.length;return this.resize(E+1),this.emplace(E,e,r,o,u,d,f,_,w)}emplace(e,r,o,u,d,f,_,w,E){const M=8*e;return this.uint16[M+0]=r,this.uint16[M+1]=o,this.uint16[M+2]=u,this.uint16[M+3]=d,this.uint16[M+4]=f,this.uint16[M+5]=_,this.uint16[M+6]=w,this.uint16[M+7]=E,e}}Ql.prototype.bytesPerElement=16,ht("StructArrayLayout8ui16",Ql);class Vs extends zr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o,u,d,f,_,w,E,M,C,D){const R=this.length;return this.resize(R+1),this.emplace(R,e,r,o,u,d,f,_,w,E,M,C,D)}emplace(e,r,o,u,d,f,_,w,E,M,C,D,R){const B=12*e;return this.int16[B+0]=r,this.int16[B+1]=o,this.int16[B+2]=u,this.int16[B+3]=d,this.uint16[B+4]=f,this.uint16[B+5]=_,this.uint16[B+6]=w,this.uint16[B+7]=E,this.int16[B+8]=M,this.int16[B+9]=C,this.int16[B+10]=D,this.int16[B+11]=R,e}}Vs.prototype.bytesPerElement=24,ht("StructArrayLayout4i4ui4i24",Vs);class ec extends zr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,o){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,o)}emplace(e,r,o,u){const d=3*e;return this.float32[d+0]=r,this.float32[d+1]=o,this.float32[d+2]=u,e}}ec.prototype.bytesPerElement=12,ht("StructArrayLayout3f12",ec);class Us extends zr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint32[1*e+0]=r,e}}Us.prototype.bytesPerElement=4,ht("StructArrayLayout1ul4",Us);class Lu extends zr{_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(e,r,o,u,d,f,_,w,E){const M=this.length;return this.resize(M+1),this.emplace(M,e,r,o,u,d,f,_,w,E)}emplace(e,r,o,u,d,f,_,w,E,M){const C=10*e,D=5*e;return this.int16[C+0]=r,this.int16[C+1]=o,this.int16[C+2]=u,this.int16[C+3]=d,this.int16[C+4]=f,this.int16[C+5]=_,this.uint32[D+3]=w,this.uint16[C+8]=E,this.uint16[C+9]=M,e}}Lu.prototype.bytesPerElement=20,ht("StructArrayLayout6i1ul2ui20",Lu);class jo extends zr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,u,d,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,r,o,u,d,f)}emplace(e,r,o,u,d,f,_){const w=6*e;return this.int16[w+0]=r,this.int16[w+1]=o,this.int16[w+2]=u,this.int16[w+3]=d,this.int16[w+4]=f,this.int16[w+5]=_,e}}jo.prototype.bytesPerElement=12,ht("StructArrayLayout2i2i2i12",jo);class Qa extends zr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,u,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,o,u,d)}emplace(e,r,o,u,d,f){const _=4*e,w=8*e;return this.float32[_+0]=r,this.float32[_+1]=o,this.float32[_+2]=u,this.int16[w+6]=d,this.int16[w+7]=f,e}}Qa.prototype.bytesPerElement=16,ht("StructArrayLayout2f1f2i16",Qa);class Ru extends zr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,u,d,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,r,o,u,d,f)}emplace(e,r,o,u,d,f,_){const w=16*e,E=4*e,M=8*e;return this.uint8[w+0]=r,this.uint8[w+1]=o,this.float32[E+1]=u,this.float32[E+2]=d,this.int16[M+6]=f,this.int16[M+7]=_,e}}Ru.prototype.bytesPerElement=16,ht("StructArrayLayout2ub2f2i16",Ru);class $s extends zr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,o)}emplace(e,r,o,u){const d=3*e;return this.uint16[d+0]=r,this.uint16[d+1]=o,this.uint16[d+2]=u,e}}$s.prototype.bytesPerElement=6,ht("StructArrayLayout3ui6",$s);class eo extends zr{_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(e,r,o,u,d,f,_,w,E,M,C,D,R,B,N,U,Z){const ae=this.length;return this.resize(ae+1),this.emplace(ae,e,r,o,u,d,f,_,w,E,M,C,D,R,B,N,U,Z)}emplace(e,r,o,u,d,f,_,w,E,M,C,D,R,B,N,U,Z,ae){const W=24*e,X=12*e,le=48*e;return this.int16[W+0]=r,this.int16[W+1]=o,this.uint16[W+2]=u,this.uint16[W+3]=d,this.uint32[X+2]=f,this.uint32[X+3]=_,this.uint32[X+4]=w,this.uint16[W+10]=E,this.uint16[W+11]=M,this.uint16[W+12]=C,this.float32[X+7]=D,this.float32[X+8]=R,this.uint8[le+36]=B,this.uint8[le+37]=N,this.uint8[le+38]=U,this.uint32[X+10]=Z,this.int16[W+22]=ae,e}}eo.prototype.bytesPerElement=48,ht("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",eo);class zu extends zr{_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(e,r,o,u,d,f,_,w,E,M,C,D,R,B,N,U,Z,ae,W,X,le,pe,Me,Ue,Oe,$e,Qe,Ge){const Ne=this.length;return this.resize(Ne+1),this.emplace(Ne,e,r,o,u,d,f,_,w,E,M,C,D,R,B,N,U,Z,ae,W,X,le,pe,Me,Ue,Oe,$e,Qe,Ge)}emplace(e,r,o,u,d,f,_,w,E,M,C,D,R,B,N,U,Z,ae,W,X,le,pe,Me,Ue,Oe,$e,Qe,Ge,Ne){const ze=32*e,ut=16*e;return this.int16[ze+0]=r,this.int16[ze+1]=o,this.int16[ze+2]=u,this.int16[ze+3]=d,this.int16[ze+4]=f,this.int16[ze+5]=_,this.int16[ze+6]=w,this.int16[ze+7]=E,this.uint16[ze+8]=M,this.uint16[ze+9]=C,this.uint16[ze+10]=D,this.uint16[ze+11]=R,this.uint16[ze+12]=B,this.uint16[ze+13]=N,this.uint16[ze+14]=U,this.uint16[ze+15]=Z,this.uint16[ze+16]=ae,this.uint16[ze+17]=W,this.uint16[ze+18]=X,this.uint16[ze+19]=le,this.uint16[ze+20]=pe,this.uint16[ze+21]=Me,this.uint16[ze+22]=Ue,this.uint32[ut+12]=Oe,this.float32[ut+13]=$e,this.float32[ut+14]=Qe,this.uint16[ze+30]=Ge,this.uint16[ze+31]=Ne,e}}zu.prototype.bytesPerElement=64,ht("StructArrayLayout8i15ui1ul2f2ui64",zu);class tc extends zr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.float32[1*e+0]=r,e}}tc.prototype.bytesPerElement=4,ht("StructArrayLayout1f4",tc);class rc extends zr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,o){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,o)}emplace(e,r,o,u){const d=3*e;return this.uint16[6*e+0]=r,this.float32[d+1]=o,this.float32[d+2]=u,e}}rc.prototype.bytesPerElement=12,ht("StructArrayLayout1ui2f12",rc);class Fu extends zr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,o)}emplace(e,r,o,u){const d=4*e;return this.uint32[2*e+0]=r,this.uint16[d+2]=o,this.uint16[d+3]=u,e}}Fu.prototype.bytesPerElement=8,ht("StructArrayLayout1ul2ui8",Fu);class m extends zr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){const o=this.length;return this.resize(o+1),this.emplace(o,e,r)}emplace(e,r,o){const u=2*e;return this.uint16[u+0]=r,this.uint16[u+1]=o,e}}m.prototype.bytesPerElement=4,ht("StructArrayLayout2ui4",m);class t extends zr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint16[1*e+0]=r,e}}t.prototype.bytesPerElement=2,ht("StructArrayLayout1ui2",t);class i extends zr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,o,u){const d=this.length;return this.resize(d+1),this.emplace(d,e,r,o,u)}emplace(e,r,o,u,d){const f=4*e;return this.float32[f+0]=r,this.float32[f+1]=o,this.float32[f+2]=u,this.float32[f+3]=d,e}}i.prototype.bytesPerElement=16,ht("StructArrayLayout4f16",i);class c extends Bs{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new I(this.anchorPointX,this.anchorPointY)}}c.prototype.size=20;class p extends Lu{get(e){return new c(this,e)}}ht("CollisionBoxArray",p);class g extends Bs{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(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}g.prototype.size=48;class b extends eo{get(e){return new g(this,e)}}ht("PlacedSymbolArray",b);class S extends Bs{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(e){this._structArray.uint32[this._pos4+12]=e}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]}}S.prototype.size=64;class P extends zu{get(e){return new S(this,e)}}ht("SymbolInstanceArray",P);class A extends tc{getoffsetX(e){return this.float32[1*e+0]}}ht("GlyphOffsetArray",A);class k extends Kl{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}ht("SymbolLineVertexArray",k);class F extends Bs{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]}}F.prototype.size=12;class z extends rc{get(e){return new F(this,e)}}ht("TextAnchorOffsetArray",z);class j extends Bs{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]}}j.prototype.size=8;class G extends Fu{get(e){return new j(this,e)}}ht("FeatureIndexArray",G);class Y extends Ns{}class Q extends Ns{}class K extends Ns{}class oe extends Jl{}class de extends Du{}class ie extends js{}class he extends ea{}class ge extends Ql{}class ce extends Vs{}class ve extends ec{}class Fe extends Us{}class Ce extends jo{}class ke extends Ru{}class Le extends $s{}class Xe extends m{}const Ke=Wr([{name:"a_pos",components:2,type:"Int16"}],4),{members:qe}=Ke;class tt{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=e}prepareSegment(e,r,o,u){const d=this.segments[this.segments.length-1];return e>tt.MAX_VERTEX_ARRAY_LENGTH&&ur(`Max vertices per segment is ${tt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${tt.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!d||d.vertexLength+e>tt.MAX_VERTEX_ARRAY_LENGTH||d.sortKey!==u?this.createNewSegment(r,o,u):d}createNewSegment(e,r,o){const u={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0,vaos:{}};return o!==void 0&&(u.sortKey=o),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(u),u}getOrCreateLatestSegment(e,r,o){return this.prepareSegment(0,e,r,o)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(const e of this.segments)for(const r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,o,u){return new tt([{vertexOffset:e,primitiveOffset:r,vertexLength:o,primitiveLength:u,vaos:{},sortKey:0}])}}function Ct(n,e){return 256*(n=Yt(Math.floor(n),0,255))+Yt(Math.floor(e),0,255)}tt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,ht("SegmentVector",tt);const cr=Wr([{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"}]),Pr=Wr([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]);var vr,Ar,xr,jr={exports:{}},Cr={exports:{}},xn={exports:{}},tn=(function(){if(xr)return jr.exports;xr=1;var n=(vr||(vr=1,Cr.exports=function(r,o){var u,d,f,_,w,E,M,C;for(d=r.length-(u=3&r.length),f=o,w=3432918353,E=461845907,C=0;C<d;)M=255&r.charCodeAt(C)|(255&r.charCodeAt(++C))<<8|(255&r.charCodeAt(++C))<<16|(255&r.charCodeAt(++C))<<24,++C,f=27492+(65535&(_=5*(65535&(f=(f^=M=(65535&(M=(M=(65535&M)*w+(((M>>>16)*w&65535)<<16)&4294967295)<<15|M>>>17))*E+(((M>>>16)*E&65535)<<16)&4294967295)<<13|f>>>19))+((5*(f>>>16)&65535)<<16)&4294967295))+((58964+(_>>>16)&65535)<<16);switch(M=0,u){case 3:M^=(255&r.charCodeAt(C+2))<<16;case 2:M^=(255&r.charCodeAt(C+1))<<8;case 1:f^=M=(65535&(M=(M=(65535&(M^=255&r.charCodeAt(C)))*w+(((M>>>16)*w&65535)<<16)&4294967295)<<15|M>>>17))*E+(((M>>>16)*E&65535)<<16)&4294967295}return f^=r.length,f=2246822507*(65535&(f^=f>>>16))+((2246822507*(f>>>16)&65535)<<16)&4294967295,f=3266489909*(65535&(f^=f>>>13))+((3266489909*(f>>>16)&65535)<<16)&4294967295,(f^=f>>>16)>>>0}),Cr.exports),e=(Ar||(Ar=1,xn.exports=function(r,o){for(var u,d=r.length,f=o^d,_=0;d>=4;)u=1540483477*(65535&(u=255&r.charCodeAt(_)|(255&r.charCodeAt(++_))<<8|(255&r.charCodeAt(++_))<<16|(255&r.charCodeAt(++_))<<24))+((1540483477*(u>>>16)&65535)<<16),f=1540483477*(65535&f)+((1540483477*(f>>>16)&65535)<<16)^(u=1540483477*(65535&(u^=u>>>24))+((1540483477*(u>>>16)&65535)<<16)),d-=4,++_;switch(d){case 3:f^=(255&r.charCodeAt(_+2))<<16;case 2:f^=(255&r.charCodeAt(_+1))<<8;case 1:f=1540483477*(65535&(f^=255&r.charCodeAt(_)))+((1540483477*(f>>>16)&65535)<<16)}return f=1540483477*(65535&(f^=f>>>13))+((1540483477*(f>>>16)&65535)<<16),(f^=f>>>15)>>>0}),xn.exports);return jr.exports=n,jr.exports.murmur3=n,jr.exports.murmur2=e,jr.exports})(),Hr=L(tn);class An{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,o,u){this.ids.push(Sa(e)),this.positions.push(r,o,u)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=Sa(e);let o=0,u=this.ids.length-1;for(;o<u;){const f=o+u>>1;this.ids[f]>=r?u=f:o=f+1}const d=[];for(;this.ids[o]===r;)d.push({index:this.positions[3*o],start:this.positions[3*o+1],end:this.positions[3*o+2]}),o++;return d}static serialize(e,r){const o=new Float64Array(e.ids),u=new Uint32Array(e.positions);return ta(o,u,0,o.length-1),r&&r.push(o.buffer,u.buffer),{ids:o,positions:u}}static deserialize(e){const r=new An;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function Sa(n){const e=+n;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:Hr(String(n))}function ta(n,e,r,o){for(;r<o;){const u=n[r+o>>1];let d=r-1,f=o+1;for(;;){do d++;while(n[d]<u);do f--;while(n[f]>u);if(d>=f)break;qi(n,d,f),qi(e,3*d,3*f),qi(e,3*d+1,3*f+1),qi(e,3*d+2,3*f+2)}f-r<o-f?(ta(n,e,r,f),r=f+1):(ta(n,e,f+1,o),o=f)}}function qi(n,e,r){const o=n[e];n[e]=n[r],n[r]=o}ht("FeaturePositionMap",An);class Kn{constructor(e,r){this.gl=e.gl,this.location=r}}class to extends Kn{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class qs extends Kn{constructor(e,r){super(e,r),this.current=[0,0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]&&e[3]===this.current[3]||(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}}class ro extends Kn{constructor(e,r){super(e,r),this.current=Nt.transparent}set(e){e.r===this.current.r&&e.g===this.current.g&&e.b===this.current.b&&e.a===this.current.a||(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}}const yi=new Float32Array(16);function Gi(n){return[Ct(255*n.r,255*n.g),Ct(255*n.b,255*n.a)]}class Ii{constructor(e,r,o){this.value=e,this.uniformNames=r.map((u=>`u_${u}`)),this.type=o}setUniform(e,r,o){e.set(o.constantOr(this.value))}getBinding(e,r,o){return this.type==="color"?new ro(e,r):new to(e,r)}}class Ai{constructor(e,r){this.uniformNames=r.map((o=>`u_${o}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=e.tlbr}setConstantDashPositions(e,r){this.dashTo=[0,e.y,e.height,e.width],this.dashFrom=[0,r.y,r.height,r.width]}setUniform(e,r,o,u){let d=null;u==="u_pattern_to"?d=this.patternTo:u==="u_pattern_from"?d=this.patternFrom:u==="u_dasharray_to"?d=this.dashTo:u==="u_dasharray_from"?d=this.dashFrom:u==="u_pixel_ratio_to"?d=this.pixelRatioTo:u==="u_pixel_ratio_from"&&(d=this.pixelRatioFrom),d!==null&&e.set(d)}getBinding(e,r,o){return o.substr(0,9)==="u_pattern"||o.substr(0,12)==="u_dasharray_"?new qs(e,r):new to(e,r)}}class Tr{constructor(e,r,o,u){this.expression=e,this.type=o,this.maxValue=0,this.paintVertexAttributes=r.map((d=>({name:`a_${d}`,type:"Float32",components:o==="color"?2:1,offset:0}))),this.paintVertexArray=new u}populatePaintArray(e,r,o){const u=this.paintVertexArray.length,d=this.expression.evaluate(new dr(0,o),r,{},o.canonical,[],o.formattedSection);this.paintVertexArray.resize(e),this._setPaintValue(u,e,d)}updatePaintArray(e,r,o,u,d){const f=this.expression.evaluate(new dr(0,d),o,u);this._setPaintValue(e,r,f)}_setPaintValue(e,r,o){if(this.type==="color"){const u=Gi(o);for(let d=e;d<r;d++)this.paintVertexArray.emplace(d,u[0],u[1])}else{for(let u=e;u<r;u++)this.paintVertexArray.emplace(u,o);this.maxValue=Math.max(this.maxValue,Math.abs(o))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class br{constructor(e,r,o,u,d,f){this.expression=e,this.uniformNames=r.map((_=>`u_${_}_t`)),this.type=o,this.useIntegerZoom=u,this.zoom=d,this.maxValue=0,this.paintVertexAttributes=r.map((_=>({name:`a_${_}`,type:"Float32",components:o==="color"?4:2,offset:0}))),this.paintVertexArray=new f}populatePaintArray(e,r,o){const u=this.expression.evaluate(new dr(this.zoom,o),r,{},o.canonical,[],o.formattedSection),d=this.expression.evaluate(new dr(this.zoom+1,o),r,{},o.canonical,[],o.formattedSection),f=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(f,e,u,d)}updatePaintArray(e,r,o,u,d){const f=this.expression.evaluate(new dr(this.zoom,d),o,u),_=this.expression.evaluate(new dr(this.zoom+1,d),o,u);this._setPaintValue(e,r,f,_)}_setPaintValue(e,r,o,u){if(this.type==="color"){const d=Gi(o),f=Gi(u);for(let _=e;_<r;_++)this.paintVertexArray.emplace(_,d[0],d[1],f[0],f[1])}else{for(let d=e;d<r;d++)this.paintVertexArray.emplace(d,o,u);this.maxValue=Math.max(this.maxValue,Math.abs(o),Math.abs(u))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,r){const o=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,u=Yt(this.expression.interpolationFactor(o,this.zoom,this.zoom+1),0,1);e.set(u)}getBinding(e,r,o){return new to(e,r)}}class mn{constructor(e,r,o,u,d,f){this.expression=e,this.type=r,this.useIntegerZoom=o,this.zoom=u,this.layerId=f,this.zoomInPaintVertexArray=new d,this.zoomOutPaintVertexArray=new d}populatePaintArray(e,r,o){const u=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(u,e,this.getPositionIds(r),o)}updatePaintArray(e,r,o,u,d){this._setPaintValues(e,r,this.getPositionIds(o),d)}_setPaintValues(e,r,o,u){const d=this.getPositions(u);if(!d||!o)return;const f=d[o.min],_=d[o.mid],w=d[o.max];if(f&&_&&w)for(let E=e;E<r;E++)this.emplace(this.zoomInPaintVertexArray,E,_,f),this.emplace(this.zoomOutPaintVertexArray,E,_,w)}upload(e){if(this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer){const r=this.getVertexAttributes();this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,r,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,r,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class gn extends mn{getPositions(e){return e.imagePositions}getPositionIds(e){return e.patterns&&e.patterns[this.layerId]}getVertexAttributes(){return cr.members}emplace(e,r,o,u){e.emplace(r,o.tlbr[0],o.tlbr[1],o.tlbr[2],o.tlbr[3],u.tlbr[0],u.tlbr[1],u.tlbr[2],u.tlbr[3],o.pixelRatio,u.pixelRatio)}}class Op extends mn{getPositions(e){return e.dashPositions}getPositionIds(e){return e.dashes&&e.dashes[this.layerId]}getVertexAttributes(){return Pr.members}emplace(e,r,o,u){e.emplace(r,0,o.y,o.height,o.width,0,u.y,u.height,u.width)}}class Bp{constructor(e,r,o){this.binders={},this._buffers=[];const u=[];for(const d in e.paint._values){if(!o(d))continue;const f=e.paint.get(d);if(!(f instanceof Mi&&Lo(f.property.specification)))continue;const _=Bf(d,e.type),w=f.value,E=f.property.specification.type,M=f.property.useIntegerZoom,C=f.property.specification["property-type"],D=C==="cross-faded"||C==="cross-faded-data-driven";if(w.kind==="constant")this.binders[d]=D?new Ai(w.value,_):new Ii(w.value,_,E),u.push(`/u_${d}`);else if(w.kind==="source"||D){const R=Np(d,E,"source");this.binders[d]=D?d==="line-dasharray"?new Op(w,E,M,r,R,e.id):new gn(w,E,M,r,R,e.id):new Tr(w,_,E,R),u.push(`/a_${d}`)}else{const R=Np(d,E,"composite");this.binders[d]=new br(w,_,E,M,r,R),u.push(`/z_${d}`)}}this.cacheKey=u.sort().join("")}getMaxValue(e){const r=this.binders[e];return r instanceof Tr||r instanceof br?r.maxValue:0}populatePaintArrays(e,r,o){for(const u in this.binders){const d=this.binders[u];(d instanceof Tr||d instanceof br||d instanceof mn)&&d.populatePaintArray(e,r,o)}}setConstantPatternPositions(e,r){for(const o in this.binders){const u=this.binders[o];u instanceof Ai&&u.setConstantPatternPositions(e,r)}}setConstantDashPositions(e,r){for(const o in this.binders){const u=this.binders[o];u instanceof Ai&&u.setConstantDashPositions(e,r)}}updatePaintArrays(e,r,o,u,d){let f=!1;for(const _ in e){const w=r.getPositions(_);for(const E of w){const M=o.feature(E.index);for(const C in this.binders){const D=this.binders[C];if((D instanceof Tr||D instanceof br||D instanceof mn)&&D.expression.isStateDependent===!0){const R=u.paint.get(C);D.expression=R.value,D.updatePaintArray(E.start,E.end,M,e[_],d),f=!0}}}}return f}defines(){const e=[];for(const r in this.binders){const o=this.binders[r];(o instanceof Ii||o instanceof Ai)&&e.push(...o.uniformNames.map((u=>`#define HAS_UNIFORM_${u}`)))}return e}getBinderAttributes(){const e=[];for(const r in this.binders){const o=this.binders[r];if(o instanceof Tr||o instanceof br)for(let u=0;u<o.paintVertexAttributes.length;u++)e.push(o.paintVertexAttributes[u].name);else if(o instanceof mn){const u=o.getVertexAttributes();for(const d of u)e.push(d.name)}}return e}getBinderUniforms(){const e=[];for(const r in this.binders){const o=this.binders[r];if(o instanceof Ii||o instanceof Ai||o instanceof br)for(const u of o.uniformNames)e.push(u)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,r){const o=[];for(const u in this.binders){const d=this.binders[u];if(d instanceof Ii||d instanceof Ai||d instanceof br){for(const f of d.uniformNames)if(r[f]){const _=d.getBinding(e,r[f],f);o.push({name:f,property:u,binding:_})}}}return o}setUniforms(e,r,o,u){for(const{name:d,property:f,binding:_}of r)this.binders[f].setUniform(_,u,o.get(f),d)}updatePaintBuffers(e){this._buffers=[];for(const r in this.binders){const o=this.binders[r];if(e&&o instanceof mn){const u=e.fromScale===2?o.zoomInPaintVertexBuffer:o.zoomOutPaintVertexBuffer;u&&this._buffers.push(u)}else(o instanceof Tr||o instanceof br)&&o.paintVertexBuffer&&this._buffers.push(o.paintVertexBuffer)}}upload(e){for(const r in this.binders){const o=this.binders[r];(o instanceof Tr||o instanceof br||o instanceof mn)&&o.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const r=this.binders[e];(r instanceof Tr||r instanceof br||r instanceof mn)&&r.destroy()}}}class no{constructor(e,r,o=()=>!0){this.programConfigurations={};for(const u of e)this.programConfigurations[u.id]=new Bp(u,r,o);this.needsUpload=!1,this._featureMap=new An,this._bufferOffset=0}populatePaintArrays(e,r,o,u){for(const d in this.programConfigurations)this.programConfigurations[d].populatePaintArrays(e,r,u);r.id!==void 0&&this._featureMap.add(r.id,o,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,r,o,u){for(const d of o)this.needsUpload=this.programConfigurations[d.id].updatePaintArrays(e,this._featureMap,r,d,u)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function Bf(n,e){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-dasharray":["dasharray_to","dasharray_from"],"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"]}[n]||[n.replace(`${e}-`,"").replace(/-/g,"_")]}function Np(n,e,r){const o={color:{source:js,composite:i},number:{source:tc,composite:js}},u=(function(d){return{"line-pattern":{source:he,composite:he},"fill-pattern":{source:he,composite:he},"fill-extrusion-pattern":{source:he,composite:he},"line-dasharray":{source:ge,composite:ge}}[d]})(n);return u&&u[r]||o[e][r]}ht("ConstantBinder",Ii),ht("CrossFadedConstantBinder",Ai),ht("SourceExpressionBinder",Tr),ht("CrossFadedPatternBinder",gn),ht("CrossFadedDasharrayBinder",Op),ht("CompositeExpressionBinder",br),ht("ProgramConfiguration",Bp,{omit:["_buffers"]}),ht("ProgramConfigurationSet",no);const Ou=Math.pow(2,14)-1,Ea=-Ou-1;function Pa(n){const e=pt/n.extent,r=n.loadGeometry();for(let o=0;o<r.length;o++){const u=r[o];for(let d=0;d<u.length;d++){const f=u[d],_=Math.round(f.x*e),w=Math.round(f.y*e);f.x=Yt(_,Ea,Ou),f.y=Yt(w,Ea,Ou),(_<f.x||_>f.x+1||w<f.y||w>f.y+1)&&ur("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function Ma(n,e){return{type:n.type,id:n.id,properties:n.properties,geometry:e?Pa(n):[]}}const Bu=-32768;function Nu(n,e,r,o,u){n.emplaceBack(Bu+8*e+o,Bu+8*r+u)}class nc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((r=>r.id)),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new Q,this.indexArray=new Le,this.segments=new tt,this.programConfigurations=new no(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter((r=>r.isStateDependent())).map((r=>r.id))}populate(e,r,o){const u=this.layers[0],d=[];let f=null,_=!1,w=u.type==="heatmap";if(u.type==="circle"){const M=u;f=M.layout.get("circle-sort-key"),_=!f.isConstant(),w=w||M.paint.get("circle-pitch-alignment")==="map"}const E=w?r.subdivisionGranularity.circle:1;for(const{feature:M,id:C,index:D,sourceLayerIndex:R}of e){const B=this.layers[0]._featureFilter.needGeometry,N=Ma(M,B);if(!this.layers[0]._featureFilter.filter(new dr(this.zoom),N,o))continue;const U=_?f.evaluate(N,{},o):void 0,Z={id:C,properties:M.properties,type:M.type,sourceLayerIndex:R,index:D,geometry:B?N.geometry:Pa(M),patterns:{},sortKey:U};d.push(Z)}_&&d.sort(((M,C)=>M.sortKey-C.sortKey));for(const M of d){const{geometry:C,index:D,sourceLayerIndex:R}=M,B=e[D].feature;this.addFeature(M,C,D,o,E),r.featureIndex.insert(B,C,D,R,this.index)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,{imagePositions:o})}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,qe),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,r,o,u,d=1){let f;switch(d){case 1:f=[0,7];break;case 3:f=[0,2,5,7];break;case 5:f=[0,1,3,4,6,7];break;case 7:f=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${d}; valid values are 1, 3, 5, 7.`)}const _=f.length;for(const w of r)for(const E of w){const M=E.x,C=E.y;if(M<0||M>=pt||C<0||C>=pt)continue;const D=this.segments.prepareSegment(_*_,this.layoutVertexArray,this.indexArray,e.sortKey),R=D.vertexLength;for(let B=0;B<_;B++)for(let N=0;N<_;N++)Nu(this.layoutVertexArray,M,C,f[N],f[B]);for(let B=0;B<_-1;B++)for(let N=0;N<_-1;N++){const U=R+B*_+N,Z=R+(B+1)*_+N;this.indexArray.emplaceBack(U,Z+1,U+1),this.indexArray.emplaceBack(U,Z,Z+1)}D.vertexLength+=_*_,D.primitiveLength+=(_-1)*(_-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,{imagePositions:{},canonical:u})}}function ic(n,e){for(let r=0;r<n.length;r++)if(ac(e,n[r]))return!0;for(let r=0;r<e.length;r++)if(ac(n,e[r]))return!0;return!!Nf(n,e)}function jp(n,e,r){return!!ac(n,e)||!!jf(e,n,r)}function by(n,e){if(n.length===1)return Ty(e,n[0]);for(let r=0;r<e.length;r++){const o=e[r];for(let u=0;u<o.length;u++)if(ac(n,o[u]))return!0}for(let r=0;r<n.length;r++)if(Ty(e,n[r]))return!0;for(let r=0;r<e.length;r++)if(Nf(n,e[r]))return!0;return!1}function _1(n,e,r){if(n.length>1){if(Nf(n,e))return!0;for(let o=0;o<e.length;o++)if(jf(e[o],n,r))return!0}for(let o=0;o<n.length;o++)if(jf(n[o],e,r))return!0;return!1}function Nf(n,e){if(n.length===0||e.length===0)return!1;for(let r=0;r<n.length-1;r++){const o=n[r],u=n[r+1];for(let d=0;d<e.length-1;d++)if(v1(o,u,e[d],e[d+1]))return!0}return!1}function v1(n,e,r,o){return qr(n,r,o)!==qr(e,r,o)&&qr(n,e,r)!==qr(n,e,o)}function jf(n,e,r){const o=r*r;if(e.length===1)return n.distSqr(e[0])<o;for(let u=1;u<e.length;u++)if(wy(n,e[u-1],e[u])<o)return!0;return!1}function wy(n,e,r){const o=e.distSqr(r);if(o===0)return n.distSqr(e);const u=((n.x-e.x)*(r.x-e.x)+(n.y-e.y)*(r.y-e.y))/o;return n.distSqr(u<0?e:u>1?r:r.sub(e)._mult(u)._add(e))}function Ty(n,e){let r,o,u,d=!1;for(let f=0;f<n.length;f++){r=n[f];for(let _=0,w=r.length-1;_<r.length;w=_++)o=r[_],u=r[w],o.y>e.y!=u.y>e.y&&e.x<(u.x-o.x)*(e.y-o.y)/(u.y-o.y)+o.x&&(d=!d)}return d}function ac(n,e){let r=!1;for(let o=0,u=n.length-1;o<n.length;u=o++){const d=n[o],f=n[u];d.y>e.y!=f.y>e.y&&e.x<(f.x-d.x)*(e.y-d.y)/(f.y-d.y)+d.x&&(r=!r)}return r}function x1(n,e,r){const o=r[0],u=r[2];if(n.x<o.x&&e.x<o.x||n.x>u.x&&e.x>u.x||n.y<o.y&&e.y<o.y||n.y>u.y&&e.y>u.y)return!1;const d=qr(n,e,r[0]);return d!==qr(n,e,r[1])||d!==qr(n,e,r[2])||d!==qr(n,e,r[3])}function oc(n,e,r){const o=e.paint.get(n).value;return o.kind==="constant"?o.value:r.programConfigurations.get(e.id).getMaxValue(n)}function Vp(n){return Math.sqrt(n[0]*n[0]+n[1]*n[1])}function Up(n,e,r,o,u){if(!e[0]&&!e[1])return n;const d=I.convert(e)._mult(u);r==="viewport"&&d._rotate(-o);const f=[];for(let _=0;_<n.length;_++)f.push(n[_].sub(d));return f}function b1(n){const e=[];for(let r=0;r<n.length;r++){const o=n[r],u=e.at(-1);(r===0||u&&!o.equals(u))&&e.push(o)}return e}function w1({queryGeometry:n,size:e},r){return jp(n,r,e)}function T1({queryGeometry:n,size:e,transform:r,unwrappedTileID:o,getElevation:u},d){return jp(n,d,e*(r.projectTileCoordinates(d.x,d.y,o,u).signedDistanceFromCamera/r.cameraToCenterDistance))}function S1({queryGeometry:n,size:e,transform:r,unwrappedTileID:o,getElevation:u},d){const f=r.projectTileCoordinates(d.x,d.y,o,u).signedDistanceFromCamera,_=e*(r.cameraToCenterDistance/f);return jp(n,Vf(d,r,o,u),_)}function E1({queryGeometry:n,size:e,transform:r,unwrappedTileID:o,getElevation:u},d){return jp(n,Vf(d,r,o,u),e)}function Sy({queryGeometry:n,size:e,transform:r,unwrappedTileID:o,getElevation:u,pitchAlignment:d="map",pitchScale:f="map"},_){const w=d==="map"?f==="map"?w1:T1:f==="map"?S1:E1,E={queryGeometry:n,size:e,transform:r,unwrappedTileID:o,getElevation:u};for(const M of _)for(const C of M)if(w(E,C))return!0;return!1}function Vf(n,e,r,o){const u=e.projectTileCoordinates(n.x,n.y,r,o).point;return new I((.5*u.x+.5)*e.width,(.5*-u.y+.5)*e.height)}let Ey,Py;ht("CircleBucket",nc,{omit:["layers"]});var P1={get paint(){return Py=Py||new qn({"circle-radius":new bt(Te.paint_circle["circle-radius"]),"circle-color":new bt(Te.paint_circle["circle-color"]),"circle-blur":new bt(Te.paint_circle["circle-blur"]),"circle-opacity":new bt(Te.paint_circle["circle-opacity"]),"circle-translate":new gt(Te.paint_circle["circle-translate"]),"circle-translate-anchor":new gt(Te.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new gt(Te.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new gt(Te.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new bt(Te.paint_circle["circle-stroke-width"]),"circle-stroke-color":new bt(Te.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new bt(Te.paint_circle["circle-stroke-opacity"])})},get layout(){return Ey=Ey||new qn({"circle-sort-key":new bt(Te.layout_circle["circle-sort-key"])})}};class M1 extends gi{constructor(e,r){super(e,P1,r)}createBucket(e){return new nc(e)}queryRadius(e){const r=e;return oc("circle-radius",this,r)+oc("circle-stroke-width",this,r)+Vp(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:e,feature:r,featureState:o,geometry:u,transform:d,pixelsToTileUnits:f,unwrappedTileID:_,getElevation:w}){const E=Up(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-d.bearingInRadians,f),M=this.paint.get("circle-radius").evaluate(r,o)+this.paint.get("circle-stroke-width").evaluate(r,o),C=this.paint.get("circle-pitch-scale"),D=this.paint.get("circle-pitch-alignment");let R,B;return D==="map"?(R=E,B=M*f):(R=(function(N,U,Z,ae){return N.map((W=>Vf(W,U,Z,ae)))})(E,d,_,w),B=M),Sy({queryGeometry:R,size:B,transform:d,unwrappedTileID:_,getElevation:w,pitchAlignment:D,pitchScale:C},u)}}class My extends nc{}let Iy;ht("HeatmapBucket",My,{omit:["layers"]});var I1={get paint(){return Iy=Iy||new qn({"heatmap-radius":new bt(Te.paint_heatmap["heatmap-radius"]),"heatmap-weight":new bt(Te.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new gt(Te.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Yl(Te.paint_heatmap["heatmap-color"]),"heatmap-opacity":new gt(Te.paint_heatmap["heatmap-opacity"])})}};function Uf(n,{width:e,height:r},o,u){if(u){if(u instanceof Uint8ClampedArray)u=new Uint8Array(u.buffer);else if(u.length!==e*r*o)throw new RangeError(`mismatched image size. expected: ${u.length} but got: ${e*r*o}`)}else u=new Uint8Array(e*r*o);return n.width=e,n.height=r,n.data=u,n}function Ay(n,{width:e,height:r},o){if(e===n.width&&r===n.height)return;const u=Uf({},{width:e,height:r},o);$f(n,u,{x:0,y:0},{x:0,y:0},{width:Math.min(n.width,e),height:Math.min(n.height,r)},o),n.width=e,n.height=r,n.data=u.data}function $f(n,e,r,o,u,d){if(u.width===0||u.height===0)return e;if(u.width>n.width||u.height>n.height||r.x>n.width-u.width||r.y>n.height-u.height)throw new RangeError("out of range source coordinates for image copy");if(u.width>e.width||u.height>e.height||o.x>e.width-u.width||o.y>e.height-u.height)throw new RangeError("out of range destination coordinates for image copy");const f=n.data,_=e.data;if(f===_)throw new Error("srcData equals dstData, so image is already copied");for(let w=0;w<u.height;w++){const E=((r.y+w)*n.width+r.x)*d,M=((o.y+w)*e.width+o.x)*d;for(let C=0;C<u.width*d;C++)_[M+C]=f[E+C]}return e}class ju{constructor(e,r){Uf(this,e,1,r)}resize(e){Ay(this,e,1)}clone(){return new ju({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,o,u,d){$f(e,r,o,u,d,1)}}class ai{constructor(e,r){Uf(this,e,4,r)}resize(e){Ay(this,e,4)}replace(e,r){r?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new ai({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,o,u,d){$f(e,r,o,u,d,4)}setPixel(e,r,o){const u=4*(e*this.width+r);this.data[u+0]=Math.round(255*o.r/o.a),this.data[u+1]=Math.round(255*o.g/o.a),this.data[u+2]=Math.round(255*o.b/o.a),this.data[u+3]=Math.round(255*o.a)}}function Cy(n){const e={},r=n.resolution||256,o=n.clips?n.clips.length:1,u=n.image||new ai({width:r,height:o});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const d=(f,_,w)=>{e[n.evaluationKey]=w;const E=n.expression.evaluate(e);u.setPixel(f/4/r,_/4,E)};if(n.clips)for(let f=0,_=0;f<o;++f,_+=4*r)for(let w=0,E=0;w<r;w++,E+=4){const M=w/(r-1),{start:C,end:D}=n.clips[f];d(_,E,C*(1-M)+D*M)}else for(let f=0,_=0;f<r;f++,_+=4)d(0,_,f/(r-1));return u}ht("AlphaImage",ju),ht("RGBAImage",ai);const qf="big-fb";class A1 extends gi{createBucket(e){return new My(e)}constructor(e,r){super(e,I1,r),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Cy({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(qf)&&this.heatmapFbos.delete(qf)}queryRadius(e){return oc("heatmap-radius",this,e)}queryIntersectsFeature({queryGeometry:e,feature:r,featureState:o,geometry:u,transform:d,pixelsToTileUnits:f,unwrappedTileID:_,getElevation:w}){return Sy({queryGeometry:e,size:this.paint.get("heatmap-radius").evaluate(r,o)*f,transform:d,unwrappedTileID:_,getElevation:w},u)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&!this.isHidden()}}let ky;var C1={get paint(){return ky=ky||new qn({"hillshade-illumination-direction":new gt(Te.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new gt(Te.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new gt(Te.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new gt(Te.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new gt(Te.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new gt(Te.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new gt(Te.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new gt(Te.paint_hillshade["hillshade-method"])})}};class k1 extends gi{constructor(e,r){super(e,C1,r),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let e=this.paint.get("hillshade-illumination-direction").values,r=this.paint.get("hillshade-illumination-altitude").values,o=this.paint.get("hillshade-highlight-color").values,u=this.paint.get("hillshade-shadow-color").values;const d=Math.max(e.length,r.length,o.length,u.length);e=e.concat(Array(d-e.length).fill(e.at(-1))),r=r.concat(Array(d-r.length).fill(r.at(-1))),o=o.concat(Array(d-o.length).fill(o.at(-1))),u=u.concat(Array(d-u.length).fill(u.at(-1)));const f=r.map(On);return{directionRadians:e.map(On),altitudeRadians:f,shadowColor:u,highlightColor:o}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&!this.isHidden()}}let Dy;var D1={get paint(){return Dy=Dy||new qn({"color-relief-opacity":new gt(Te["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new Yl(Te["paint_color-relief"]["color-relief-color"])})}};class Gf{constructor(e,r,o,u){this.context=e,this.format=o,this.texture=e.gl.createTexture(),this.update(r,u)}update(e,r,o){const{width:u,height:d}=e,f=!(this.size&&this.size[0]===u&&this.size[1]===d||o),{context:_}=this,{gl:w}=_;if(this.useMipmap=!!(r&&r.useMipmap),w.bindTexture(w.TEXTURE_2D,this.texture),_.pixelStoreUnpackFlipY.set(!1),_.pixelStoreUnpack.set(1),_.pixelStoreUnpackPremultiplyAlpha.set(this.format===w.RGBA&&(!r||r.premultiply!==!1)),f)this.size=[u,d],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||fn(e)?w.texImage2D(w.TEXTURE_2D,0,this.format,this.format,w.UNSIGNED_BYTE,e):w.texImage2D(w.TEXTURE_2D,0,this.format,u,d,0,this.format,w.UNSIGNED_BYTE,e.data);else{const{x:E,y:M}=o||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||fn(e)?w.texSubImage2D(w.TEXTURE_2D,0,E,M,w.RGBA,w.UNSIGNED_BYTE,e):w.texSubImage2D(w.TEXTURE_2D,0,E,M,u,d,w.RGBA,w.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&w.generateMipmap(w.TEXTURE_2D),_.pixelStoreUnpackFlipY.setDefault(),_.pixelStoreUnpack.setDefault(),_.pixelStoreUnpackPremultiplyAlpha.setDefault()}bind(e,r,o){const{context:u}=this,{gl:d}=u;d.bindTexture(d.TEXTURE_2D,this.texture),o!==d.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(o=d.LINEAR),e!==this.filter&&(d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,e),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,o||e),this.filter=e),r!==this.wrap&&(d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,r),d.texParameteri(d.TEXTURE_2D,d.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:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class Ly{constructor(e,r,o,u=1,d=1,f=1,_=0){if(this.uid=e,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(o&&!["mapbox","terrarium","custom"].includes(o))return void ur(`"${o}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=r.height;const w=this.dim=r.height-2;switch(this.data=new Uint32Array(r.data.buffer),o){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=u,this.greenFactor=d,this.blueFactor=f,this.baseShift=_;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let E=0;E<w;E++)this.data[this._idx(-1,E)]=this.data[this._idx(0,E)],this.data[this._idx(w,E)]=this.data[this._idx(w-1,E)],this.data[this._idx(E,-1)]=this.data[this._idx(E,0)],this.data[this._idx(E,w)]=this.data[this._idx(E,w-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(w,-1)]=this.data[this._idx(w-1,0)],this.data[this._idx(-1,w)]=this.data[this._idx(0,w-1)],this.data[this._idx(w,w)]=this.data[this._idx(w-1,w-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let E=0;E<w;E++)for(let M=0;M<w;M++){const C=this.get(E,M);C>this.max&&(this.max=C),C<this.min&&(this.min=C)}}get(e,r){const o=new Uint8Array(this.data.buffer),u=4*this._idx(e,r);return this.unpack(o[u],o[u+1],o[u+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,r){if(e<-1||e>=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError(`Out of range source coordinates for DEM data. x: ${e}, y: ${r}, dim: ${this.dim}`);return(r+1)*this.stride+(e+1)}unpack(e,r,o){return e*this.redFactor+r*this.greenFactor+o*this.blueFactor-this.baseShift}pack(e){return Ry(e,this.getUnpackVector())}getPixels(){return new ai({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,r,o){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let u=r*this.dim,d=r*this.dim+this.dim,f=o*this.dim,_=o*this.dim+this.dim;switch(r){case-1:u=d-1;break;case 1:d=u+1}switch(o){case-1:f=_-1;break;case 1:_=f+1}const w=-r*this.dim,E=-o*this.dim;for(let M=f;M<_;M++)for(let C=u;C<d;C++)this.data[this._idx(C,M)]=e.data[this._idx(C+w,M+E)]}}function Ry(n,e){const r=e[0],o=e[1],u=e[2],d=e[3],f=Math.min(r,o,u),_=Math.round((n+d)/f);return{r:Math.floor(_*f/r)%256,g:Math.floor(_*f/o)%256,b:Math.floor(_*f/u)%256}}ht("DEMData",Ly);class L1 extends gi{constructor(e,r){super(e,D1,r)}_createColorRamp(e){const r={elevationStops:[],colorStops:[]},o=this._transitionablePaint._values["color-relief-color"].value.expression;if(o instanceof Ol&&o._styleExpression.expression instanceof $n){this.colorRampExpression=o;const f=o._styleExpression.expression;r.elevationStops=f.labels,r.colorStops=[];for(const _ of r.elevationStops)r.colorStops.push(f.evaluate({globals:{elevation:_}}))}if(r.elevationStops.length<1&&(r.elevationStops=[0],r.colorStops=[Nt.transparent]),r.elevationStops.length<2&&(r.elevationStops.push(r.elevationStops[0]+1),r.colorStops.push(r.colorStops[0])),r.elevationStops.length<=e)return r;const u={elevationStops:[],colorStops:[]},d=(r.elevationStops.length-1)/(e-1);for(let f=0;f<r.elevationStops.length-.5;f+=d)u.elevationStops.push(r.elevationStops[Math.round(f)]),u.colorStops.push(r.colorStops[Math.round(f)]);return ur(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${e}, provided: ${r.elevationStops.length}`),u}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(e,r,o){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;const u=this._createColorRamp(r),d=new ai({width:u.colorStops.length,height:1}),f=new ai({width:u.colorStops.length,height:1});for(let _=0;_<u.elevationStops.length;_++){const w=Ry(u.elevationStops[_],o);f.setPixel(0,_,new Nt(w.r/255,w.g/255,w.b/255,1)),d.setPixel(0,_,u.colorStops[_])}return this.colorRampTextures={elevationTexture:new Gf(e,f,e.gl.RGBA),colorTexture:new Gf(e,d,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}}const R1=Wr([{name:"a_pos",components:2,type:"Int16"}],4),{members:z1}=R1;function $p(n,e,r){const o=r.patternDependencies;let u=!1;for(const d of e){const f=d.paint.get(`${n}-pattern`);f.isConstant()||(u=!0);const _=f.constantOr(null);_&&(u=!0,o[_.to]=!0,o[_.from]=!0)}return u}function Zf(n,e,r,o,u){const{zoom:d}=o,f=u.patternDependencies;for(const _ of e){const w=_.paint.get(`${n}-pattern`).value;if(w.kind!=="constant"){let E=w.evaluate({zoom:d-1},r,{},u.availableImages),M=w.evaluate({zoom:d},r,{},u.availableImages),C=w.evaluate({zoom:d+1},r,{},u.availableImages);E=E&&E.name?E.name:E,M=M&&M.name?M.name:M,C=C&&C.name?C.name:C,f[E]=!0,f[M]=!0,f[C]=!0,r.patterns[_.id]={min:E,mid:M,max:C}}}return r}function zy(n,e,r,o,u){let d;if(u===(function(f,_,w,E){let M=0;for(let C=_,D=w-E;C<w;C+=E)M+=(f[D]-f[C])*(f[C+1]+f[D+1]),D=C;return M})(n,e,r,o)>0)for(let f=e;f<r;f+=o)d=Ny(f/o|0,n[f],n[f+1],d);else for(let f=r-o;f>=e;f-=o)d=Ny(f/o|0,n[f],n[f+1],d);return d&&sc(d,d.next)&&(qu(d),d=d.next),d}function Gs(n,e){if(!n)return n;e||(e=n);let r,o=n;do if(r=!1,o.steiner||!sc(o,o.next)&&rn(o.prev,o,o.next)!==0)o=o.next;else{if(qu(o),o=e=o.prev,o===o.next)break;r=!0}while(r||o!==e);return e}function Vu(n,e,r,o,u,d,f){if(!n)return;!f&&d&&(function(w,E,M,C){let D=w;do D.z===0&&(D.z=Wf(D.x,D.y,E,M,C)),D.prevZ=D.prev,D.nextZ=D.next,D=D.next;while(D!==w);D.prevZ.nextZ=null,D.prevZ=null,(function(R){let B,N=1;do{let U,Z=R;R=null;let ae=null;for(B=0;Z;){B++;let W=Z,X=0;for(let pe=0;pe<N&&(X++,W=W.nextZ,W);pe++);let le=N;for(;X>0||le>0&&W;)X!==0&&(le===0||!W||Z.z<=W.z)?(U=Z,Z=Z.nextZ,X--):(U=W,W=W.nextZ,le--),ae?ae.nextZ=U:R=U,U.prevZ=ae,ae=U;Z=W}ae.nextZ=null,N*=2}while(B>1)})(D)})(n,o,u,d);let _=n;for(;n.prev!==n.next;){const w=n.prev,E=n.next;if(d?O1(n,o,u,d):F1(n))e.push(w.i,n.i,E.i),qu(n),n=E.next,_=E.next;else if((n=E)===_){f?f===1?Vu(n=B1(Gs(n),e),e,r,o,u,d,2):f===2&&N1(n,e,r,o,u,d):Vu(Gs(n),e,r,o,u,d,1);break}}}function F1(n){const e=n.prev,r=n,o=n.next;if(rn(e,r,o)>=0)return!1;const u=e.x,d=r.x,f=o.x,_=e.y,w=r.y,E=o.y,M=Math.min(u,d,f),C=Math.min(_,w,E),D=Math.max(u,d,f),R=Math.max(_,w,E);let B=o.next;for(;B!==e;){if(B.x>=M&&B.x<=D&&B.y>=C&&B.y<=R&&Uu(u,_,d,w,f,E,B.x,B.y)&&rn(B.prev,B,B.next)>=0)return!1;B=B.next}return!0}function O1(n,e,r,o){const u=n.prev,d=n,f=n.next;if(rn(u,d,f)>=0)return!1;const _=u.x,w=d.x,E=f.x,M=u.y,C=d.y,D=f.y,R=Math.min(_,w,E),B=Math.min(M,C,D),N=Math.max(_,w,E),U=Math.max(M,C,D),Z=Wf(R,B,e,r,o),ae=Wf(N,U,e,r,o);let W=n.prevZ,X=n.nextZ;for(;W&&W.z>=Z&&X&&X.z<=ae;){if(W.x>=R&&W.x<=N&&W.y>=B&&W.y<=U&&W!==u&&W!==f&&Uu(_,M,w,C,E,D,W.x,W.y)&&rn(W.prev,W,W.next)>=0||(W=W.prevZ,X.x>=R&&X.x<=N&&X.y>=B&&X.y<=U&&X!==u&&X!==f&&Uu(_,M,w,C,E,D,X.x,X.y)&&rn(X.prev,X,X.next)>=0))return!1;X=X.nextZ}for(;W&&W.z>=Z;){if(W.x>=R&&W.x<=N&&W.y>=B&&W.y<=U&&W!==u&&W!==f&&Uu(_,M,w,C,E,D,W.x,W.y)&&rn(W.prev,W,W.next)>=0)return!1;W=W.prevZ}for(;X&&X.z<=ae;){if(X.x>=R&&X.x<=N&&X.y>=B&&X.y<=U&&X!==u&&X!==f&&Uu(_,M,w,C,E,D,X.x,X.y)&&rn(X.prev,X,X.next)>=0)return!1;X=X.nextZ}return!0}function B1(n,e){let r=n;do{const o=r.prev,u=r.next.next;!sc(o,u)&&Oy(o,r,r.next,u)&&$u(o,u)&&$u(u,o)&&(e.push(o.i,r.i,u.i),qu(r),qu(r.next),r=n=u),r=r.next}while(r!==n);return Gs(r)}function N1(n,e,r,o,u,d){let f=n;do{let _=f.next.next;for(;_!==f.prev;){if(f.i!==_.i&&q1(f,_)){let w=By(f,_);return f=Gs(f,f.next),w=Gs(w,w.next),Vu(f,e,r,o,u,d,0),void Vu(w,e,r,o,u,d,0)}_=_.next}f=f.next}while(f!==n)}function j1(n,e){let r=n.x-e.x;return r===0&&(r=n.y-e.y,r===0)&&(r=(n.next.y-n.y)/(n.next.x-n.x)-(e.next.y-e.y)/(e.next.x-e.x)),r}function V1(n,e){const r=(function(u,d){let f=d;const _=u.x,w=u.y;let E,M=-1/0;if(sc(u,f))return f;do{if(sc(u,f.next))return f.next;if(w<=f.y&&w>=f.next.y&&f.next.y!==f.y){const N=f.x+(w-f.y)*(f.next.x-f.x)/(f.next.y-f.y);if(N<=_&&N>M&&(M=N,E=f.x<f.next.x?f:f.next,N===_))return E}f=f.next}while(f!==d);if(!E)return null;const C=E,D=E.x,R=E.y;let B=1/0;f=E;do{if(_>=f.x&&f.x>=D&&_!==f.x&&Fy(w<R?_:M,w,D,R,w<R?M:_,w,f.x,f.y)){const N=Math.abs(w-f.y)/(_-f.x);$u(f,u)&&(N<B||N===B&&(f.x>E.x||f.x===E.x&&U1(E,f)))&&(E=f,B=N)}f=f.next}while(f!==C);return E})(n,e);if(!r)return e;const o=By(r,n);return Gs(o,o.next),Gs(r,r.next)}function U1(n,e){return rn(n.prev,n,e.prev)<0&&rn(e.next,n,n.next)<0}function Wf(n,e,r,o,u){return(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-r)*u|0)|n<<8))|n<<4))|n<<2))|n<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-o)*u|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function $1(n){let e=n,r=n;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==n);return r}function Fy(n,e,r,o,u,d,f,_){return(u-f)*(e-_)>=(n-f)*(d-_)&&(n-f)*(o-_)>=(r-f)*(e-_)&&(r-f)*(d-_)>=(u-f)*(o-_)}function Uu(n,e,r,o,u,d,f,_){return!(n===f&&e===_)&&Fy(n,e,r,o,u,d,f,_)}function q1(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!(function(r,o){let u=r;do{if(u.i!==r.i&&u.next.i!==r.i&&u.i!==o.i&&u.next.i!==o.i&&Oy(u,u.next,r,o))return!0;u=u.next}while(u!==r);return!1})(n,e)&&($u(n,e)&&$u(e,n)&&(function(r,o){let u=r,d=!1;const f=(r.x+o.x)/2,_=(r.y+o.y)/2;do u.y>_!=u.next.y>_&&u.next.y!==u.y&&f<(u.next.x-u.x)*(_-u.y)/(u.next.y-u.y)+u.x&&(d=!d),u=u.next;while(u!==r);return d})(n,e)&&(rn(n.prev,n,e.prev)||rn(n,e.prev,e))||sc(n,e)&&rn(n.prev,n,n.next)>0&&rn(e.prev,e,e.next)>0)}function rn(n,e,r){return(e.y-n.y)*(r.x-e.x)-(e.x-n.x)*(r.y-e.y)}function sc(n,e){return n.x===e.x&&n.y===e.y}function Oy(n,e,r,o){const u=Gp(rn(n,e,r)),d=Gp(rn(n,e,o)),f=Gp(rn(r,o,n)),_=Gp(rn(r,o,e));return u!==d&&f!==_||!(u!==0||!qp(n,r,e))||!(d!==0||!qp(n,o,e))||!(f!==0||!qp(r,n,o))||!(_!==0||!qp(r,e,o))}function qp(n,e,r){return e.x<=Math.max(n.x,r.x)&&e.x>=Math.min(n.x,r.x)&&e.y<=Math.max(n.y,r.y)&&e.y>=Math.min(n.y,r.y)}function Gp(n){return n>0?1:n<0?-1:0}function $u(n,e){return rn(n.prev,n,n.next)<0?rn(n,e,n.next)>=0&&rn(n,n.prev,e)>=0:rn(n,e,n.prev)<0||rn(n,n.next,e)<0}function By(n,e){const r=Hf(n.i,n.x,n.y),o=Hf(e.i,e.x,e.y),u=n.next,d=e.prev;return n.next=e,e.prev=n,r.next=u,u.prev=r,o.next=r,r.prev=o,d.next=o,o.prev=d,o}function Ny(n,e,r,o){const u=Hf(n,e,r);return o?(u.next=o.next,u.prev=o,o.next.prev=u,o.next=u):(u.prev=u,u.next=u),u}function qu(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function Hf(n,e,r){return{i:n,x:e,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class lc{constructor(e,r){if(r>e)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=e,this._minGranularity=r}getGranularityForZoomLevel(e){return Math.max(Math.floor(this._baseZoomGranularity/(1<<e)),this._minGranularity,1)}}class Zp{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}}Zp.noSubdivision=new Zp({fill:new lc(0,0),line:new lc(0,0),tile:new lc(0,0),stencil:new lc(0,0),circle:1}),ht("SubdivisionGranularityExpression",lc),ht("SubdivisionGranularitySetting",Zp);const cc=-32768,Gu=32767;class G1{constructor(e,r){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=e,this._granularityCellSize=pt/e,this._canonical=r}_getKey(e,r){return(e+=32768)<<16|r+32768}_vertexToIndex(e,r){if(e<-32768||r<-32768||e>32767||r>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const o=0|Math.round(e),u=0|Math.round(r),d=this._getKey(o,u);if(this._vertexDictionary.has(d))return this._vertexDictionary.get(d);const f=this._vertexBuffer.length/2;return this._vertexDictionary.set(d,f),this._vertexBuffer.push(o,u),f}_subdivideTrianglesScanline(e){if(this._granularity<2)return(function(u,d){const f=[];for(let _=0;_<d.length;_+=3){const w=d[_],E=d[_+1],M=d[_+2],C=u[2*w],D=u[2*w+1];(u[2*E]-C)*(u[2*M+1]-D)-(u[2*E+1]-D)*(u[2*M]-C)>0?(f.push(w),f.push(M),f.push(E)):(f.push(w),f.push(E),f.push(M))}return f})(this._vertexBuffer,e);const r=[],o=e.length;for(let u=0;u<o;u+=3){const d=[e[u+0],e[u+1],e[u+2]],f=[this._vertexBuffer[2*e[u+0]+0],this._vertexBuffer[2*e[u+0]+1],this._vertexBuffer[2*e[u+1]+0],this._vertexBuffer[2*e[u+1]+1],this._vertexBuffer[2*e[u+2]+0],this._vertexBuffer[2*e[u+2]+1]];let _=1/0,w=1/0,E=-1/0,M=-1/0;for(let N=0;N<3;N++){const U=f[2*N],Z=f[2*N+1];_=Math.min(_,U),E=Math.max(E,U),w=Math.min(w,Z),M=Math.max(M,Z)}if(_===E||w===M)continue;const C=Math.floor(_/this._granularityCellSize),D=Math.ceil(E/this._granularityCellSize),R=Math.floor(w/this._granularityCellSize),B=Math.ceil(M/this._granularityCellSize);if(C!==D||R!==B)for(let N=R;N<B;N++){const U=this._scanlineGenerateVertexRingForCellRow(N,f,d);Z1(this._vertexBuffer,U,r)}else r.push(...d)}return r}_scanlineGenerateVertexRingForCellRow(e,r,o){const u=e*this._granularityCellSize,d=u+this._granularityCellSize,f=[];for(let _=0;_<3;_++){const w=r[2*_],E=r[2*_+1],M=r[2*(_+1)%6],C=r[(2*(_+1)+1)%6],D=r[2*(_+2)%6],R=r[(2*(_+2)+1)%6],B=M-w,N=C-E,U=B===0,Z=N===0,ae=(u-E)/N,W=(d-E)/N,X=Math.min(ae,W),le=Math.max(ae,W);if(!Z&&(X>=1||le<=0)||Z&&(E<u||E>d)){C>=u&&C<=d&&f.push(o[(_+1)%3]);continue}!Z&&X>0&&f.push(this._vertexToIndex(w+B*X,E+N*X));const pe=w+B*Math.max(X,0),Me=w+B*Math.min(le,1);U||this._generateIntraEdgeVertices(f,w,E,M,C,pe,Me),!Z&&le<1&&f.push(this._vertexToIndex(w+B*le,E+N*le)),(Z||C>=u&&C<=d)&&f.push(o[(_+1)%3]),!Z&&(C<=u||C>=d)&&this._generateInterEdgeVertices(f,w,E,M,C,D,R,Me,u,d)}return f}_generateIntraEdgeVertices(e,r,o,u,d,f,_){const w=u-r,E=d-o,M=E===0,C=M?Math.min(r,u):Math.min(f,_),D=M?Math.max(r,u):Math.max(f,_),R=Math.floor(C/this._granularityCellSize)+1,B=Math.ceil(D/this._granularityCellSize)-1;if(M?r<u:f<_)for(let N=R;N<=B;N++){const U=N*this._granularityCellSize;e.push(this._vertexToIndex(U,o+E*(U-r)/w))}else for(let N=B;N>=R;N--){const U=N*this._granularityCellSize;e.push(this._vertexToIndex(U,o+E*(U-r)/w))}}_generateInterEdgeVertices(e,r,o,u,d,f,_,w,E,M){const C=d-o,D=f-u,R=_-d,B=(E-d)/R,N=(M-d)/R,U=Math.min(B,N),Z=Math.max(B,N),ae=u+D*U;let W=Math.floor(Math.min(ae,w)/this._granularityCellSize)+1,X=Math.ceil(Math.max(ae,w)/this._granularityCellSize)-1,le=w<ae;const pe=R===0;if(pe&&(_===E||_===M))return;if(pe||U>=1||Z<=0){const Ue=o-_,Oe=f+(r-f)*Math.min((E-_)/Ue,(M-_)/Ue);W=Math.floor(Math.min(Oe,w)/this._granularityCellSize)+1,X=Math.ceil(Math.max(Oe,w)/this._granularityCellSize)-1,le=w<Oe}const Me=C>0?M:E;if(le)for(let Ue=W;Ue<=X;Ue++)e.push(this._vertexToIndex(Ue*this._granularityCellSize,Me));else for(let Ue=X;Ue>=W;Ue--)e.push(this._vertexToIndex(Ue*this._granularityCellSize,Me))}_generateOutline(e){const r=[];for(const o of e){const u=Zs(o,this._granularity,!0),d=this._pointArrayToIndices(u),f=[];for(let _=1;_<d.length;_++)f.push(d[_-1]),f.push(d[_]);r.push(f)}return r}_handlePoles(e){let r=!1,o=!1;this._canonical&&(this._canonical.y===0&&(r=!0),this._canonical.y===(1<<this._canonical.z)-1&&(o=!0)),(r||o)&&this._fillPoles(e,r,o)}_ensureNoPoleVertices(){const e=this._vertexBuffer;for(let r=0;r<e.length;r+=2){const o=e[r+1];o===cc&&(e[r+1]=-32767),o===Gu&&(e[r+1]=32766)}}_generatePoleQuad(e,r,o,u,d,f){u>d!=(f===cc)?(e.push(r),e.push(o),e.push(this._vertexToIndex(u,f)),e.push(o),e.push(this._vertexToIndex(d,f)),e.push(this._vertexToIndex(u,f))):(e.push(o),e.push(r),e.push(this._vertexToIndex(u,f)),e.push(this._vertexToIndex(d,f)),e.push(o),e.push(this._vertexToIndex(u,f)))}_fillPoles(e,r,o){const u=this._vertexBuffer,d=pt,f=e.length;for(let _=2;_<f;_+=3){const w=e[_-2],E=e[_-1],M=e[_],C=u[2*w],D=u[2*w+1],R=u[2*E],B=u[2*E+1],N=u[2*M],U=u[2*M+1];r&&(D===0&&B===0&&this._generatePoleQuad(e,w,E,C,R,cc),B===0&&U===0&&this._generatePoleQuad(e,E,M,R,N,cc),U===0&&D===0&&this._generatePoleQuad(e,M,w,N,C,cc)),o&&(D===d&&B===d&&this._generatePoleQuad(e,w,E,C,R,Gu),B===d&&U===d&&this._generatePoleQuad(e,E,M,R,N,Gu),U===d&&D===d&&this._generatePoleQuad(e,M,w,N,C,Gu))}}_initializeVertices(e){for(let r=0;r<e.length;r+=2)this._vertexToIndex(e[r],e[r+1])}subdividePolygonInternal(e,r){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:o,holeIndices:u}=(function(_){const w=[],E=[];for(const M of _)if(M.length!==0){M!==_[0]&&w.push(E.length/2);for(let C=0;C<M.length;C++)E.push(M[C].x),E.push(M[C].y)}return{flattened:E,holeIndices:w}})(e);let d;this._initializeVertices(o);try{const _=(function(E,M,C=2){const D=M&&M.length,R=D?M[0]*C:E.length;let B=zy(E,0,R,C,!0);const N=[];if(!B||B.next===B.prev)return N;let U,Z,ae;if(D&&(B=(function(W,X,le,pe){const Me=[];for(let Ue=0,Oe=X.length;Ue<Oe;Ue++){const $e=zy(W,X[Ue]*pe,Ue<Oe-1?X[Ue+1]*pe:W.length,pe,!1);$e===$e.next&&($e.steiner=!0),Me.push($1($e))}Me.sort(j1);for(let Ue=0;Ue<Me.length;Ue++)le=V1(Me[Ue],le);return le})(E,M,B,C)),E.length>80*C){U=E[0],Z=E[1];let W=U,X=Z;for(let le=C;le<R;le+=C){const pe=E[le],Me=E[le+1];pe<U&&(U=pe),Me<Z&&(Z=Me),pe>W&&(W=pe),Me>X&&(X=Me)}ae=Math.max(W-U,X-Z),ae=ae!==0?32767/ae:0}return Vu(B,N,C,U,Z,ae,0),N})(o,u),w=this._convertIndices(o,_);d=this._subdivideTrianglesScanline(w)}catch(_){console.error(_)}let f=[];return r&&(f=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(d),{verticesFlattened:this._vertexBuffer,indicesTriangles:d,indicesLineList:f}}_convertIndices(e,r){const o=[];for(let u=0;u<r.length;u++)o.push(this._vertexToIndex(e[2*r[u]],e[2*r[u]+1]));return o}_pointArrayToIndices(e){const r=[];for(let o=0;o<e.length;o++){const u=e[o];r.push(this._vertexToIndex(u.x,u.y))}return r}}function jy(n,e,r,o=!0){return new G1(r,e).subdividePolygonInternal(n,o)}function Zs(n,e,r=!1){if(!n||n.length<1)return[];if(n.length<2)return[];const o=n[0],u=n[n.length-1],d=r&&(o.x!==u.x||o.y!==u.y);if(e<2)return d?[...n,n[0]]:[...n];const f=Math.floor(pt/e),_=[];_.push(new I(n[0].x,n[0].y));const w=n.length,E=d?w:w-1;for(let M=0;M<E;M++){const C=n[M],D=M<w-1?n[M+1]:n[0],R=C.x,B=C.y,N=D.x,U=D.y,Z=R!==N,ae=B!==U;if(!Z&&!ae)continue;const W=N-R,X=U-B,le=Math.abs(W),pe=Math.abs(X);let Me=R,Ue=B;for(;;){const $e=W>0?(Math.floor(Me/f)+1)*f:(Math.ceil(Me/f)-1)*f,Qe=X>0?(Math.floor(Ue/f)+1)*f:(Math.ceil(Ue/f)-1)*f,Ge=Math.abs(Me-$e),Ne=Math.abs(Ue-Qe),ze=Math.abs(Me-N),ut=Math.abs(Ue-U),st=Z?Ge/le:Number.POSITIVE_INFINITY,dt=ae?Ne/pe:Number.POSITIVE_INFINITY;if((ze<=Ge||!Z)&&(ut<=Ne||!ae))break;if(st<dt&&Z||!ae){Me=$e,Ue+=X*st;const at=new I(Me,Math.round(Ue));_[_.length-1].x===at.x&&_[_.length-1].y===at.y||_.push(at)}else{Me+=W*dt,Ue=Qe;const at=new I(Math.round(Me),Ue);_[_.length-1].x===at.x&&_[_.length-1].y===at.y||_.push(at)}}const Oe=new I(N,U);_[_.length-1].x===Oe.x&&_[_.length-1].y===Oe.y||_.push(Oe)}return _}function Z1(n,e,r){if(e.length===0)throw new Error("Subdivision vertex ring is empty.");let o=0,u=n[2*e[0]];for(let w=1;w<e.length;w++){const E=n[2*e[w]];E<u&&(u=E,o=w)}const d=e.length;let f=o,_=(f+1)%d;for(;;){const w=f-1>=0?f-1:d-1,E=(_+1)%d,M=n[2*e[w]],C=n[2*e[E]],D=n[2*e[f]],R=n[2*e[f]+1],B=n[2*e[_]+1];let N=!1;if(M<C)N=!0;else if(M>C)N=!1;else{const U=B-R,Z=-(n[2*e[_]]-D),ae=R<B?1:-1;((M-D)*U+(n[2*e[w]+1]-R)*Z)*ae>((C-D)*U+(n[2*e[E]+1]-R)*Z)*ae&&(N=!0)}if(N){const U=e[w],Z=e[f],ae=e[_];U!==Z&&U!==ae&&Z!==ae&&r.push(ae,Z,U),f--,f<0&&(f=d-1)}else{const U=e[E],Z=e[f],ae=e[_];U!==Z&&U!==ae&&Z!==ae&&r.push(ae,Z,U),_++,_>=d&&(_=0)}if(w===E)break}}function Vy(n,e,r,o,u,d,f,_,w){const E=u.length/2,M=f&&_&&w;if(E<tt.MAX_VERTEX_ARRAY_LENGTH){const C=e.prepareSegment(E,r,o),D=C.vertexLength;for(let N=0;N<d.length;N+=3)o.emplaceBack(D+d[N],D+d[N+1],D+d[N+2]);let R,B;C.vertexLength+=E,C.primitiveLength+=d.length/3,M&&(B=f.prepareSegment(E,r,_),R=B.vertexLength,B.vertexLength+=E);for(let N=0;N<u.length;N+=2)n(u[N],u[N+1]);if(M)for(let N=0;N<w.length;N++){const U=w[N];for(let Z=1;Z<U.length;Z+=2)_.emplaceBack(R+U[Z-1],R+U[Z]);B.primitiveLength+=U.length/2}}else(function(C,D,R,B,N,U){const Z=[];for(let pe=0;pe<B.length/2;pe++)Z.push(-1);const ae={count:0};let W=0,X=C.getOrCreateLatestSegment(D,R),le=X.vertexLength;for(let pe=2;pe<N.length;pe+=3){const Me=N[pe-2],Ue=N[pe-1],Oe=N[pe];let $e=Z[Me]<W,Qe=Z[Ue]<W,Ge=Z[Oe]<W;X.vertexLength+(($e?1:0)+(Qe?1:0)+(Ge?1:0))>tt.MAX_VERTEX_ARRAY_LENGTH&&(X=C.createNewSegment(D,R),W=ae.count,$e=!0,Qe=!0,Ge=!0,le=0);const Ne=Zu(Z,B,U,ae,Me,$e,X),ze=Zu(Z,B,U,ae,Ue,Qe,X),ut=Zu(Z,B,U,ae,Oe,Ge,X);R.emplaceBack(le+Ne-W,le+ze-W,le+ut-W),X.primitiveLength++}})(e,r,o,u,d,n),M&&(function(C,D,R,B,N,U){const Z=[];for(let pe=0;pe<B.length/2;pe++)Z.push(-1);const ae={count:0};let W=0,X=C.getOrCreateLatestSegment(D,R),le=X.vertexLength;for(let pe=0;pe<N.length;pe++){const Me=N[pe];for(let Ue=1;Ue<N[pe].length;Ue+=2){const Oe=Me[Ue-1],$e=Me[Ue];let Qe=Z[Oe]<W,Ge=Z[$e]<W;X.vertexLength+((Qe?1:0)+(Ge?1:0))>tt.MAX_VERTEX_ARRAY_LENGTH&&(X=C.createNewSegment(D,R),W=ae.count,Qe=!0,Ge=!0,le=0);const Ne=Zu(Z,B,U,ae,Oe,Qe,X),ze=Zu(Z,B,U,ae,$e,Ge,X);R.emplaceBack(le+Ne-W,le+ze-W),X.primitiveLength++}}})(f,r,_,u,w,n),e.forceNewSegmentOnNextPrepare(),f==null||f.forceNewSegmentOnNextPrepare()}function Zu(n,e,r,o,u,d,f){if(d){const _=o.count;return r(e[2*u],e[2*u+1]),n[u]=o.count,o.count++,f.vertexLength++,_}return n[u]}class Xf{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((r=>r.id)),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.layoutVertexArray=new K,this.indexArray=new Le,this.indexArray2=new Xe,this.programConfigurations=new no(e.layers,e.zoom),this.segments=new tt,this.segments2=new tt,this.stateDependentLayerIds=this.layers.filter((r=>r.isStateDependent())).map((r=>r.id))}populate(e,r,o){this.hasDependencies=$p("fill",this.layers,r);const u=this.layers[0].layout.get("fill-sort-key"),d=!u.isConstant(),f=[];for(const{feature:_,id:w,index:E,sourceLayerIndex:M}of e){const C=this.layers[0]._featureFilter.needGeometry,D=Ma(_,C);if(!this.layers[0]._featureFilter.filter(new dr(this.zoom),D,o))continue;const R=d?u.evaluate(D,{},o,r.availableImages):void 0,B={id:w,properties:_.properties,type:_.type,sourceLayerIndex:M,index:E,geometry:C?D.geometry:Pa(_),patterns:{},sortKey:R};f.push(B)}d&&f.sort(((_,w)=>_.sortKey-w.sortKey));for(const _ of f){const{geometry:w,index:E,sourceLayerIndex:M}=_;if(this.hasDependencies){const C=Zf("fill",this.layers,_,{zoom:this.zoom},r);this.patternFeatures.push(C)}else this.addFeature(_,w,E,o,{},r.subdivisionGranularity);r.featureIndex.insert(e[E].feature,w,E,M,this.index)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,{imagePositions:o})}addFeatures(e,r,o){for(const u of this.patternFeatures)this.addFeature(u,u.geometry,u.index,r,o,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,z1),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),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(e,r,o,u,d,f){for(const _ of Pl(r,500)){const w=jy(_,u,f.fill.getGranularityForZoomLevel(u.z)),E=this.layoutVertexArray;Vy(((M,C)=>{E.emplaceBack(M,C)}),this.segments,this.layoutVertexArray,this.indexArray,w.verticesFlattened,w.indicesTriangles,this.segments2,this.indexArray2,w.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,{imagePositions:d,canonical:u})}}let Uy,$y;ht("FillBucket",Xf,{omit:["layers","patternFeatures"]});var W1={get paint(){return $y=$y||new qn({"fill-antialias":new gt(Te.paint_fill["fill-antialias"]),"fill-opacity":new bt(Te.paint_fill["fill-opacity"]),"fill-color":new bt(Te.paint_fill["fill-color"]),"fill-outline-color":new bt(Te.paint_fill["fill-outline-color"]),"fill-translate":new gt(Te.paint_fill["fill-translate"]),"fill-translate-anchor":new gt(Te.paint_fill["fill-translate-anchor"]),"fill-pattern":new Os(Te.paint_fill["fill-pattern"])})},get layout(){return Uy=Uy||new qn({"fill-sort-key":new bt(Te.layout_fill["fill-sort-key"])})}};class H1 extends gi{constructor(e,r){super(e,W1,r)}recalculate(e,r){super.recalculate(e,r);const o=this.paint._values["fill-outline-color"];o.value.kind==="constant"&&o.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new Xf(e)}queryRadius(){return Vp(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:r,transform:o,pixelsToTileUnits:u}){return by(Up(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-o.bearingInRadians,u),r)}isTileClipped(){return!0}}const X1=Wr([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Y1=Wr([{name:"a_centroid",components:2,type:"Int16"}],4),{members:K1}=X1;class Wu{constructor(e,r,o,u,d){this.properties={},this.extent=o,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=u,this._values=d,e.readFields(J1,this,r)}loadGeometry(){const e=this._pbf;e.pos=this._geometry;const r=e.readVarint()+e.pos,o=[];let u,d=1,f=0,_=0,w=0;for(;e.pos<r;){if(f<=0){const E=e.readVarint();d=7&E,f=E>>3}if(f--,d===1||d===2)_+=e.readSVarint(),w+=e.readSVarint(),d===1&&(u&&o.push(u),u=[]),u&&u.push(new I(_,w));else{if(d!==7)throw new Error(`unknown command ${d}`);u&&u.push(u[0].clone())}}return u&&o.push(u),o}bbox(){const e=this._pbf;e.pos=this._geometry;const r=e.readVarint()+e.pos;let o=1,u=0,d=0,f=0,_=1/0,w=-1/0,E=1/0,M=-1/0;for(;e.pos<r;){if(u<=0){const C=e.readVarint();o=7&C,u=C>>3}if(u--,o===1||o===2)d+=e.readSVarint(),f+=e.readSVarint(),d<_&&(_=d),d>w&&(w=d),f<E&&(E=f),f>M&&(M=f);else if(o!==7)throw new Error(`unknown command ${o}`)}return[_,E,w,M]}toGeoJSON(e,r,o){const u=this.extent*Math.pow(2,o),d=this.extent*e,f=this.extent*r,_=this.loadGeometry();function w(D){return[360*(D.x+d)/u-180,360/Math.PI*Math.atan(Math.exp((1-2*(D.y+f)/u)*Math.PI))-90]}function E(D){return D.map(w)}let M;if(this.type===1){const D=[];for(const B of _)D.push(B[0]);const R=E(D);M=D.length===1?{type:"Point",coordinates:R[0]}:{type:"MultiPoint",coordinates:R}}else if(this.type===2){const D=_.map(E);M=D.length===1?{type:"LineString",coordinates:D[0]}:{type:"MultiLineString",coordinates:D}}else{if(this.type!==3)throw new Error("unknown feature type");{const D=qy(_),R=[];for(const B of D)R.push(B.map(E));M=R.length===1?{type:"Polygon",coordinates:R[0]}:{type:"MultiPolygon",coordinates:R}}}const C={type:"Feature",geometry:M,properties:this.properties};return this.id!=null&&(C.id=this.id),C}}function J1(n,e,r){n===1?e.id=r.readVarint():n===2?(function(o,u){const d=o.readVarint()+o.pos;for(;o.pos<d;){const f=u._keys[o.readVarint()],_=u._values[o.readVarint()];u.properties[f]=_}})(r,e):n===3?e.type=r.readVarint():n===4&&(e._geometry=r.pos)}function qy(n){const e=n.length;if(e<=1)return[n];const r=[];let o,u;for(let d=0;d<e;d++){const f=Q1(n[d]);f!==0&&(u===void 0&&(u=f<0),u===f<0?(o&&r.push(o),o=[n[d]]):o&&o.push(n[d]))}return o&&r.push(o),r}function Q1(n){let e=0;for(let r,o,u=0,d=n.length,f=d-1;u<d;f=u++)r=n[u],o=n[f],e+=(o.x-r.x)*(r.y+o.y);return e}Wu.types=["Unknown","Point","LineString","Polygon"];class ew{constructor(e,r){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(tw,this,r),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];const r=this._pbf.readVarint()+this._pbf.pos;return new Wu(this._pbf,r,this.extent,this._keys,this._values)}}function tw(n,e,r){n===15?e.version=r.readVarint():n===1?e.name=r.readString():n===5?e.extent=r.readVarint():n===2?e._features.push(r.pos):n===3?e._keys.push(r.readString()):n===4&&e._values.push((function(o){let u=null;const d=o.readVarint()+o.pos;for(;o.pos<d;){const f=o.readVarint()>>3;u=f===1?o.readString():f===2?o.readFloat():f===3?o.readDouble():f===4?o.readVarint64():f===5?o.readVarint():f===6?o.readSVarint():f===7?o.readBoolean():null}if(u==null)throw new Error("unknown feature value");return u})(r))}class Gy{constructor(e,r){this.layers=e.readFields(rw,{},r)}}function rw(n,e,r){if(n===3){const o=new ew(r,r.readVarint()+r.pos);o.length&&(e[o.name]=o)}}const Yf=Math.pow(2,13);function Hu(n,e,r,o,u,d,f,_){n.emplaceBack(e,r,2*Math.floor(o*Yf)+f,u*Yf*2,d*Yf*2,Math.round(_))}class Kf{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((r=>r.id)),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new oe,this.centroidVertexArray=new Y,this.indexArray=new Le,this.programConfigurations=new no(e.layers,e.zoom),this.segments=new tt,this.stateDependentLayerIds=this.layers.filter((r=>r.isStateDependent())).map((r=>r.id))}populate(e,r,o){this.features=[],this.hasDependencies=$p("fill-extrusion",this.layers,r);for(const{feature:u,id:d,index:f,sourceLayerIndex:_}of e){const w=this.layers[0]._featureFilter.needGeometry,E=Ma(u,w);if(!this.layers[0]._featureFilter.filter(new dr(this.zoom),E,o))continue;const M={id:d,sourceLayerIndex:_,index:f,geometry:w?E.geometry:Pa(u),properties:u.properties,type:u.type,patterns:{}};this.hasDependencies?this.features.push(Zf("fill-extrusion",this.layers,M,{zoom:this.zoom},r)):this.addFeature(M,M.geometry,f,o,{},r.subdivisionGranularity),r.featureIndex.insert(u,M.geometry,f,_,this.index,!0)}}addFeatures(e,r,o){for(const u of this.features){const{geometry:d}=u;this.addFeature(u,d,u.index,r,o,e.subdivisionGranularity)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,{imagePositions:o})}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,K1),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Y1.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,r,o,u,d,f){for(const _ of Pl(r,500)){const w={x:0,y:0,sampleCount:0},E=this.layoutVertexArray.length;this.processPolygon(w,u,e,_,f);const M=this.layoutVertexArray.length-E,C=Math.floor(w.x/w.sampleCount),D=Math.floor(w.y/w.sampleCount);for(let R=0;R<M;R++)this.centroidVertexArray.emplaceBack(C,D)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,{imagePositions:d,canonical:u})}processPolygon(e,r,o,u,d){if(u.length<1||Zy(u[0]))return;for(const C of u)C.length!==0&&nw(e,C);const f={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},_=d.fill.getGranularityForZoomLevel(r.z),w=Wu.types[o.type]==="Polygon";for(const C of u){if(C.length===0||Zy(C))continue;const D=Zs(C,_,w);this._generateSideFaces(D,f)}if(!w)return;const E=jy(u,r,_,!1),M=this.layoutVertexArray;Vy(((C,D)=>{Hu(M,C,D,0,0,1,1,0)}),this.segments,this.layoutVertexArray,this.indexArray,E.verticesFlattened,E.indicesTriangles)}_generateSideFaces(e,r){let o=0;for(let u=1;u<e.length;u++){const d=e[u],f=e[u-1];if(iw(d,f))continue;r.segment.vertexLength+4>tt.MAX_VERTEX_ARRAY_LENGTH&&(r.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const _=d.sub(f)._perp()._unit(),w=f.dist(d);o+w>32768&&(o=0),Hu(this.layoutVertexArray,d.x,d.y,_.x,_.y,0,0,o),Hu(this.layoutVertexArray,d.x,d.y,_.x,_.y,0,1,o),o+=w,Hu(this.layoutVertexArray,f.x,f.y,_.x,_.y,0,0,o),Hu(this.layoutVertexArray,f.x,f.y,_.x,_.y,0,1,o);const E=r.segment.vertexLength;this.indexArray.emplaceBack(E,E+2,E+1),this.indexArray.emplaceBack(E+1,E+2,E+3),r.segment.vertexLength+=4,r.segment.primitiveLength+=2}}}function nw(n,e){for(let r=0;r<e.length;r++){const o=e[r];r===e.length-1&&e[0].x===o.x&&e[0].y===o.y||(n.x+=o.x,n.y+=o.y,n.sampleCount++)}}function iw(n,e){return n.x===e.x&&(n.x<0||n.x>pt)||n.y===e.y&&(n.y<0||n.y>pt)}function Zy(n){return n.every((e=>e.x<0))||n.every((e=>e.x>pt))||n.every((e=>e.y<0))||n.every((e=>e.y>pt))}let Wy;ht("FillExtrusionBucket",Kf,{omit:["layers","features"]});var aw={get paint(){return Wy=Wy||new qn({"fill-extrusion-opacity":new gt(Te["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new bt(Te["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new gt(Te["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new gt(Te["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Os(Te["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new bt(Te["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new bt(Te["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new gt(Te["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class ow extends gi{constructor(e,r){super(e,aw,r)}createBucket(e){return new Kf(e)}queryRadius(){return Vp(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:r,featureState:o,geometry:u,transform:d,pixelsToTileUnits:f,pixelPosMatrix:_}){const w=Up(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-d.bearingInRadians,f),E=this.paint.get("fill-extrusion-height").evaluate(r,o),M=this.paint.get("fill-extrusion-base").evaluate(r,o),C=(function(R,B){const N=[];for(const U of R){const Z=[U.x,U.y,0,1];ct(Z,Z,B),N.push(new I(Z[0]/Z[3],Z[1]/Z[3]))}return N})(w,_),D=(function(R,B,N,U){const Z=[],ae=[],W=U[8]*B,X=U[9]*B,le=U[10]*B,pe=U[11]*B,Me=U[8]*N,Ue=U[9]*N,Oe=U[10]*N,$e=U[11]*N;for(const Qe of R){const Ge=[],Ne=[];for(const ze of Qe){const ut=ze.x,st=ze.y,dt=U[0]*ut+U[4]*st+U[12],at=U[1]*ut+U[5]*st+U[13],_t=U[2]*ut+U[6]*st+U[14],nr=U[3]*ut+U[7]*st+U[15],qt=_t+le,kr=nr+pe,zn=dt+Me,un=at+Ue,Dr=_t+Oe,Mr=nr+$e,sr=new I((dt+W)/kr,(at+X)/kr);sr.z=qt/kr,Ge.push(sr);const Vr=new I(zn/Mr,un/Mr);Vr.z=Dr/Mr,Ne.push(Vr)}Z.push(Ge),ae.push(Ne)}return[Z,ae]})(u,M,E,_);return(function(R,B,N){let U=1/0;by(N,B)&&(U=Hy(N,B[0]));for(let Z=0;Z<B.length;Z++){const ae=B[Z],W=R[Z];for(let X=0;X<ae.length-1;X++){const le=ae[X],pe=[le,ae[X+1],W[X+1],W[X],le];ic(N,pe)&&(U=Math.min(U,Hy(N,pe)))}}return U!==1/0&&U})(D[0],D[1],C)}}function Xu(n,e){return n.x*e.x+n.y*e.y}function Hy(n,e){if(n.length===1){let r=0;const o=e[r++];let u;for(;!u||o.equals(u);)if(u=e[r++],!u)return 1/0;for(;r<e.length;r++){const d=e[r],f=n[0],_=u.sub(o),w=d.sub(o),E=f.sub(o),M=Xu(_,_),C=Xu(_,w),D=Xu(w,w),R=Xu(E,_),B=Xu(E,w),N=M*D-C*C,U=(D*R-C*B)/N,Z=(M*B-C*R)/N,ae=o.z*(1-U-Z)+u.z*U+d.z*Z;if(isFinite(ae))return ae}return 1/0}{let r=1/0;for(const o of e)r=Math.min(r,o.z);return r}}const sw=Wr([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:lw}=sw,cw=Wr([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:uw}=cw,hw=Math.cos(Math.PI/180*37.5),Xy=Math.pow(2,14)/.5;class Jf{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((r=>r.id)),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((r=>{this.gradients[r.id]={}})),this.layoutVertexArray=new de,this.layoutVertexArray2=new ie,this.indexArray=new Le,this.programConfigurations=new no(e.layers,e.zoom),this.segments=new tt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((r=>r.isStateDependent())).map((r=>r.id))}populate(e,r,o){this.hasDependencies=$p("line",this.layers,r)||this.hasLineDasharray(this.layers);const u=this.layers[0].layout.get("line-sort-key"),d=!u.isConstant(),f=[];for(const{feature:_,id:w,index:E,sourceLayerIndex:M}of e){const C=this.layers[0]._featureFilter.needGeometry,D=Ma(_,C);if(!this.layers[0]._featureFilter.filter(new dr(this.zoom),D,o))continue;const R=d?u.evaluate(D,{},o):void 0,B={id:w,properties:_.properties,type:_.type,sourceLayerIndex:M,index:E,geometry:C?D.geometry:Pa(_),patterns:{},dashes:{},sortKey:R};f.push(B)}d&&f.sort(((_,w)=>_.sortKey-w.sortKey));for(const _ of f){const{geometry:w,index:E,sourceLayerIndex:M}=_;this.hasDependencies?($p("line",this.layers,r)?Zf("line",this.layers,_,{zoom:this.zoom},r):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,_,this.zoom,r),this.patternFeatures.push(_)):this.addFeature(_,w,E,o,{},{},r.subdivisionGranularity),r.featureIndex.insert(e[E].feature,w,E,M,this.index)}}update(e,r,o,u){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,{imagePositions:o,dashPositions:u})}addFeatures(e,r,o,u){for(const d of this.patternFeatures)this.addFeature(d,d.geometry,d.index,r,o,u,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,uw)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,lw),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,r,o,u,d,f,_){const w=this.layers[0].layout,E=w.get("line-join").evaluate(e,{}),M=w.get("line-cap"),C=w.get("line-miter-limit"),D=w.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const R of r)this.addLine(R,e,E,M,C,D,u,_);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,{imagePositions:d,dashPositions:f,canonical:u})}addLine(e,r,o,u,d,f,_,w){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,e=Zs(e,_?w.line.getGranularityForZoomLevel(_.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let W=0;W<e.length-1;W++)this.totalDistance+=e[W].dist(e[W+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const E=Wu.types[r.type]==="Polygon";let M=e.length;for(;M>=2&&e[M-1].equals(e[M-2]);)M--;let C=0;for(;C<M-1&&e[C].equals(e[C+1]);)C++;if(M<(E?3:2))return;o==="bevel"&&(d=1.05);const D=this.overscaling<=16?122880/(512*this.overscaling):0,R=this.segments.prepareSegment(10*M,this.layoutVertexArray,this.indexArray);let B,N,U,Z,ae;this.e1=this.e2=-1,E&&(B=e[M-2],ae=e[C].sub(B)._unit()._perp());for(let W=C;W<M;W++){if(U=W===M-1?E?e[C+1]:void 0:e[W+1],U&&e[W].equals(U))continue;ae&&(Z=ae),B&&(N=B),B=e[W],ae=U?U.sub(B)._unit()._perp():Z,Z=Z||ae;let X=Z.add(ae);X.x===0&&X.y===0||X._unit();const le=Z.x*ae.x+Z.y*ae.y,pe=X.x*ae.x+X.y*ae.y,Me=pe!==0?1/pe:1/0,Ue=2*Math.sqrt(2-2*pe),Oe=pe<hw&&N&&U,$e=Z.x*ae.y-Z.y*ae.x>0;if(Oe&&W>C){const Ne=B.dist(N);if(Ne>2*D){const ze=B.sub(B.sub(N)._mult(D/Ne)._round());this.updateDistance(N,ze),this.addCurrentVertex(ze,Z,0,0,R),N=ze}}const Qe=N&&U;let Ge=Qe?o:E?"butt":u;if(Qe&&Ge==="round"&&(Me<f?Ge="miter":Me<=2&&(Ge="fakeround")),Ge==="miter"&&Me>d&&(Ge="bevel"),Ge==="bevel"&&(Me>2&&(Ge="flipbevel"),Me<d&&(Ge="miter")),N&&this.updateDistance(N,B),Ge==="miter")X._mult(Me),this.addCurrentVertex(B,X,0,0,R);else if(Ge==="flipbevel"){if(Me>100)X=ae.mult(-1);else{const Ne=Me*Z.add(ae).mag()/Z.sub(ae).mag();X._perp()._mult(Ne*($e?-1:1))}this.addCurrentVertex(B,X,0,0,R),this.addCurrentVertex(B,X.mult(-1),0,0,R)}else if(Ge==="bevel"||Ge==="fakeround"){const Ne=-Math.sqrt(Me*Me-1),ze=$e?Ne:0,ut=$e?0:Ne;if(N&&this.addCurrentVertex(B,Z,ze,ut,R),Ge==="fakeround"){const st=Math.round(180*Ue/Math.PI/20);for(let dt=1;dt<st;dt++){let at=dt/st;if(at!==.5){const nr=at-.5;at+=at*nr*(at-1)*((1.0904+le*(le*(3.55645-1.43519*le)-3.2452))*nr*nr+(.848013+le*(.215638*le-1.06021)))}const _t=ae.sub(Z)._mult(at)._add(Z)._unit()._mult($e?-1:1);this.addHalfVertex(B,_t.x,_t.y,!1,$e,0,R)}}U&&this.addCurrentVertex(B,ae,-ze,-ut,R)}else if(Ge==="butt")this.addCurrentVertex(B,X,0,0,R);else if(Ge==="square"){const Ne=N?1:-1;this.addCurrentVertex(B,X,Ne,Ne,R)}else Ge==="round"&&(N&&(this.addCurrentVertex(B,Z,0,0,R),this.addCurrentVertex(B,Z,1,1,R,!0)),U&&(this.addCurrentVertex(B,ae,-1,-1,R,!0),this.addCurrentVertex(B,ae,0,0,R)));if(Oe&&W<M-1){const Ne=B.dist(U);if(Ne>2*D){const ze=B.add(U.sub(B)._mult(D/Ne)._round());this.updateDistance(B,ze),this.addCurrentVertex(ze,ae,0,0,R),B=ze}}}}addCurrentVertex(e,r,o,u,d,f=!1){const _=r.y*u-r.x,w=-r.y-r.x*u;this.addHalfVertex(e,r.x+r.y*o,r.y-r.x*o,f,!1,o,d),this.addHalfVertex(e,_,w,f,!0,-u,d),this.distance>Xy/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,r,o,u,d,f))}addHalfVertex({x:e,y:r},o,u,d,f,_,w){const E=.5*(this.lineClips?this.scaledDistance*(Xy-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(d?1:0),(r<<1)+(f?1:0),Math.round(63*o)+128,Math.round(63*u)+128,1+(_===0?0:_<0?-1:1)|(63&E)<<2,E>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const M=w.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,M,this.e2),w.primitiveLength++),f?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(e,r){this.distance+=e.dist(r),this.updateScaledDistance()}hasLineDasharray(e){for(const r of e){const o=r.paint.get("line-dasharray");if(o&&!o.isConstant())return!0}return!1}addLineDashDependencies(e,r,o,u){for(const d of e){const f=d.paint.get("line-dasharray");if(!f||f.value.kind==="constant")continue;const _=d.layout.get("line-cap")==="round",w={dasharray:f.value.evaluate({zoom:o-1},r,{}),round:_},E={dasharray:f.value.evaluate({zoom:o},r,{}),round:_},M={dasharray:f.value.evaluate({zoom:o+1},r,{}),round:_},C=`${w.dasharray.join(",")},${w.round}`,D=`${E.dasharray.join(",")},${E.round}`,R=`${M.dasharray.join(",")},${M.round}`;u.dashDependencies[C]=w,u.dashDependencies[D]=E,u.dashDependencies[R]=M,r.dashes[d.id]={min:C,mid:D,max:R}}}}let Yy,Ky;ht("LineBucket",Jf,{omit:["layers","patternFeatures"]});var Jy={get paint(){return Ky=Ky||new qn({"line-opacity":new bt(Te.paint_line["line-opacity"]),"line-color":new bt(Te.paint_line["line-color"]),"line-translate":new gt(Te.paint_line["line-translate"]),"line-translate-anchor":new gt(Te.paint_line["line-translate-anchor"]),"line-width":new bt(Te.paint_line["line-width"]),"line-gap-width":new bt(Te.paint_line["line-gap-width"]),"line-offset":new bt(Te.paint_line["line-offset"]),"line-blur":new bt(Te.paint_line["line-blur"]),"line-dasharray":new Os(Te.paint_line["line-dasharray"]),"line-pattern":new Os(Te.paint_line["line-pattern"]),"line-gradient":new Yl(Te.paint_line["line-gradient"])})},get layout(){return Yy=Yy||new qn({"line-cap":new gt(Te.layout_line["line-cap"]),"line-join":new bt(Te.layout_line["line-join"]),"line-miter-limit":new gt(Te.layout_line["line-miter-limit"]),"line-round-limit":new gt(Te.layout_line["line-round-limit"]),"line-sort-key":new bt(Te.layout_line["line-sort-key"])})}};class pw extends bt{possiblyEvaluate(e,r){return r=new dr(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(e,r)}evaluate(e,r,o,u){return r=$t({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(e,r,o,u)}}let Wp;class dw extends gi{constructor(e,r){super(e,Jy,r),this.gradientVersion=0,Wp||(Wp=new pw(Jy.paint.properties["line-width"].specification),Wp.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){const r=this.gradientExpression();this.stepInterpolant=!!(function(o){return o._styleExpression!==void 0})(r)&&r._styleExpression.expression instanceof _a,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,r){super.recalculate(e,r),this.paint._values["line-floorwidth"]=Wp.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new Jf(e)}queryRadius(e){const r=e,o=Qy(oc("line-width",this,r),oc("line-gap-width",this,r)),u=oc("line-offset",this,r);return o/2+Math.abs(u)+Vp(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:r,featureState:o,geometry:u,transform:d,pixelsToTileUnits:f}){const _=Up(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-d.bearingInRadians,f),w=f/2*Qy(this.paint.get("line-width").evaluate(r,o),this.paint.get("line-gap-width").evaluate(r,o)),E=this.paint.get("line-offset").evaluate(r,o);return E&&(u=(function(M,C){const D=[];for(let R=0;R<M.length;R++){const B=b1(M[R]),N=[];for(let U=0;U<B.length;U++){const Z=B[U],ae=B[U-1],W=B[U+1],X=U===0?new I(0,0):Z.sub(ae)._unit()._perp(),le=U===B.length-1?new I(0,0):W.sub(Z)._unit()._perp(),pe=X._add(le)._unit(),Me=pe.x*le.x+pe.y*le.y;Me!==0&&pe._mult(1/Me),N.push(pe._mult(C)._add(Z))}D.push(N)}return D})(u,E*f)),(function(M,C,D){for(let R=0;R<C.length;R++){const B=C[R];if(M.length>=3){for(let N=0;N<B.length;N++)if(ac(M,B[N]))return!0}if(_1(M,B,D))return!0}return!1})(_,u,w)}isTileClipped(){return!0}}function Qy(n,e){return e>0?e+2*n:n}const fw=Wr([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),mw=Wr([{name:"a_projected_pos",components:3,type:"Float32"}],4);Wr([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const gw=Wr([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);Wr([{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 e_=Wr([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),yw=Wr([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function _w(n,e,r){return n.sections.forEach((o=>{o.text=(function(u,d,f){const _=d.layout.get("text-transform").evaluate(f,{});return _==="uppercase"?u=u.toLocaleUpperCase():_==="lowercase"&&(u=u.toLocaleLowerCase()),Ta.applyArabicShaping&&(u=Ta.applyArabicShaping(u)),u})(o.text,e,r)})),n}Wr([{name:"triangle",components:3,type:"Uint16"}]),Wr([{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"}]),Wr([{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"}]),Wr([{type:"Float32",name:"offsetX"}]),Wr([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Wr([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var bn=24;const Yu={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","⋯":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},vw={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},xw={40:!0};
5function t_(n,e,r,o,u,d){if("fontStack"in e){const f=r[e.fontStack],_=f&&f[n];return _?_.metrics.advance*e.scale+u:0}{const f=o[e.imageName];return f?f.displaySize[0]*e.scale*bn/d+u:0}}function r_(n,e,r,o){const u=Math.pow(n-e,2);return o?n<e?u/2:2*u:u+Math.abs(r)*r}function bw(n,e,r){let o=0;return n===10&&(o-=1e4),r&&(o+=150),n!==40&&n!==65288||(o+=50),e!==41&&e!==65289||(o+=50),o}function n_(n,e,r,o,u,d){let f=null,_=r_(e,r,u,d);for(const w of o){const E=r_(e-w.x,r,u,d)+w.badness;E<=_&&(f=w,_=E)}return{index:n,x:e,priorBreak:f,badness:_}}function i_(n){return n?i_(n.priorBreak).concat(n.index):[]}class uc{constructor(e="",r=[],o=[]){this.text=e,this.sections=r,this.sectionIndex=o,this.imageSectionID=null}static fromFeature(e,r){const o=new uc;for(let u=0;u<e.sections.length;u++){const d=e.sections[u];d.image?o.addImageSection(d):o.addTextSection(d,r)}return o}length(){return[...this.text].length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}verticalizePunctuation(){this.text=(function(e){let r="",o={premature:!0,value:void 0};const u=e[Symbol.iterator]();let d=u.next();const f=e[Symbol.iterator]();f.next();let _=f.next();for(;!d.done;)r+=!_.done&&Pu(_.value.codePointAt(0))&&!Yu[_.value]||!o.premature&&Pu(o.value.codePointAt(0))&&!Yu[o.value]||!Yu[d.value]?d.value:Yu[d.value],o={value:d.value,premature:!1},d=u.next(),_=f.next();return r})(this.text)}hasZeroWidthSpaces(){return this.text.includes("​")}trim(){const e=this.text.match(/^\s*/),r=e?e[0].length:0,o=this.text.match(/\S\s*$/),u=o?o[0].length-1:0;this.text=this.text.substring(r,this.text.length-u),this.sectionIndex=this.sectionIndex.slice(r,this.sectionIndex.length-u)}substring(e,r){const o=[...this.text].slice(e,r).join(""),u=this.sectionIndex.slice(e,r);return new uc(o,this.sections,u)}toCodeUnitIndex(e){return[...this.text].slice(0,e).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((e,r)=>Math.max(e,this.sections[r].scale)),0)}getMaxImageSize(e){let r=0,o=0;for(let u=0;u<this.length();u++){const d=this.getSection(u);if("imageName"in d){const f=e[d.imageName];if(!f)continue;const _=f.displaySize;r=Math.max(r,_[0]),o=Math.max(o,_[1])}}return{maxImageWidth:r,maxImageHeight:o}}addTextSection(e,r){this.text+=e.text,this.sections.push({scale:e.scale||1,verticalAlign:e.verticalAlign||"bottom",fontStack:e.fontStack||r});const o=this.sections.length-1;this.sectionIndex.push(...[...e.text].map((()=>o)))}addImageSection(e){const r=e.image?e.image.name:"";if(r.length===0)return void ur("Can't add FormattedSection with an empty image.");const o=this.getNextImageSectionCharCode();o?(this.text+=String.fromCharCode(o),this.sections.push({scale:1,verticalAlign:e.verticalAlign||"bottom",imageName:r}),this.sectionIndex.push(this.sections.length-1)):ur("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(e,r,o,u,d){const f=[],_=this.determineAverageLineWidth(e,r,o,u,d),w=this.hasZeroWidthSpaces();let E=0,M=0;const C=this.text[Symbol.iterator]();let D=C.next();const R=this.text[Symbol.iterator]();R.next();let B=R.next();const N=this.text[Symbol.iterator]();N.next(),N.next();let U=N.next();for(;!D.done;){const Z=this.getSection(M),ae=D.value.codePointAt(0);if(Ap(ae)||(E+=t_(ae,Z,o,u,e,d)),!B.done){const W=Rs(ae),X=B.value.codePointAt(0);(vw[ae]||W||"imageName"in Z||!U.done&&xw[X])&&f.push(n_(M+1,E,_,f,bw(ae,X,W&&w),!1))}M++,D=C.next(),B=R.next(),U=N.next()}return i_(n_(this.length(),E,_,f,0,!0))}determineAverageLineWidth(e,r,o,u,d){let f=0,_=0;for(const w of this.text){const E=this.getSection(_);f+=t_(w.codePointAt(0),E,o,u,e,d),_++}return f/Math.max(1,Math.ceil(f/r))}}const Qf=4294967296,a_=1/Qf,o_=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");class Hp{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,r,o=this.length){for(;this.pos<o;){const u=this.readVarint(),d=u>>3,f=this.pos;this.type=7&u,e(d,r,this),this.pos===f&&this.skip(u)}return r}readMessage(e,r){return this.readFields(e,r,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Qf;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Qf;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const r=this.buf;let o,u;return u=r[this.pos++],o=127&u,u<128?o:(u=r[this.pos++],o|=(127&u)<<7,u<128?o:(u=r[this.pos++],o|=(127&u)<<14,u<128?o:(u=r[this.pos++],o|=(127&u)<<21,u<128?o:(u=r[this.pos],o|=(15&u)<<28,(function(d,f,_){const w=_.buf;let E,M;if(M=w[_.pos++],E=(112&M)>>4,M<128||(M=w[_.pos++],E|=(127&M)<<3,M<128)||(M=w[_.pos++],E|=(127&M)<<10,M<128)||(M=w[_.pos++],E|=(127&M)<<17,M<128)||(M=w[_.pos++],E|=(127&M)<<24,M<128)||(M=w[_.pos++],E|=(1&M)<<31,M<128))return hc(d,E,f);throw new Error("Expected varint not more than 10 bytes")})(o,e,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){const e=this.readVarint()+this.pos,r=this.pos;return this.pos=e,e-r>=12&&o_?o_.decode(this.buf.subarray(r,e)):(function(o,u,d){let f="",_=u;for(;_<d;){const w=o[_];let E,M,C,D=null,R=w>239?4:w>223?3:w>191?2:1;if(_+R>d)break;
vendor: 7,686 bytes, line 5
5R===1?w<128&&(D=w):R===2?(E=o[_+1],(192&E)==128&&(D=(31&w)<<6|63&E,D<=127&&(D=null))):R===3?(E=o[_+1],M=o[_+2],(192&E)==128&&(192&M)==128&&(D=(15&w)<<12|(63&E)<<6|63&M,(D<=2047||D>=55296&&D<=57343)&&(D=null))):R===4&&(E=o[_+1],M=o[_+2],C=o[_+3],(192&E)==128&&(192&M)==128&&(192&C)==128&&(D=(15&w)<<18|(63&E)<<12|(63&M)<<6|63&C,(D<=65535||D>=1114112)&&(D=null))),D===null?(D=65533,R=1):D>65535&&(D-=65536,f+=String.fromCharCode(D>>>10&1023|55296),D=56320|1023&D),f+=String.fromCharCode(D),_+=R}return f})(this.buf,r,e)}readBytes(){const e=this.readVarint()+this.pos,r=this.buf.subarray(this.pos,e);return this.pos=e,r}readPackedVarint(e=[],r){const o=this.readPackedEnd();for(;this.pos<o;)e.push(this.readVarint(r));return e}readPackedSVarint(e=[]){const r=this.readPackedEnd();for(;this.pos<r;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const r=this.readPackedEnd();for(;this.pos<r;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const r=this.readPackedEnd();for(;this.pos<r;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const r=this.readPackedEnd();for(;this.pos<r;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const r=this.readPackedEnd();for(;this.pos<r;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const r=this.readPackedEnd();for(;this.pos<r;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const r=this.readPackedEnd();for(;this.pos<r;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const r=this.readPackedEnd();for(;this.pos<r;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}skip(e){const r=7&e;if(r===0)for(;this.buf[this.pos++]>127;);else if(r===2)this.pos=this.readVarint()+this.pos;else if(r===5)this.pos+=4;else{if(r!==1)throw new Error(`Unimplemented type: ${r}`);this.pos+=8}}writeTag(e,r){this.writeVarint(e<<3|r)}realloc(e){let r=this.length||16;for(;r<this.pos+e;)r*=2;if(r!==this.length){const o=new Uint8Array(r);o.set(this.buf),this.buf=o,this.dataView=new DataView(o.buffer),this.length=r}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*a_),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*a_),!0),this.pos+=8}writeVarint(e){(e=+e||0)>268435455||e<0?(function(r,o){let u,d;if(r>=0?(u=r%4294967296|0,d=r/4294967296|0):(u=~(-r%4294967296),d=~(-r/4294967296),4294967295^u?u=u+1|0:(u=0,d=d+1|0)),r>=18446744073709552e3||r<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");o.realloc(10),(function(f,_,w){w.buf[w.pos++]=127&f|128,f>>>=7,w.buf[w.pos++]=127&f|128,f>>>=7,w.buf[w.pos++]=127&f|128,f>>>=7,w.buf[w.pos++]=127&f|128,w.buf[w.pos]=127&(f>>>=7)})(u,0,o),(function(f,_){const w=(7&f)<<4;_.buf[_.pos++]|=w|((f>>>=3)?128:0),f&&(_.buf[_.pos++]=127&f|((f>>>=7)?128:0),f&&(_.buf[_.pos++]=127&f|((f>>>=7)?128:0),f&&(_.buf[_.pos++]=127&f|((f>>>=7)?128:0),f&&(_.buf[_.pos++]=127&f|((f>>>=7)?128:0),f&&(_.buf[_.pos++]=127&f)))))})(d,o)})(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))}writeSVarint(e){this.writeVarint(e<0?2*-e-1:2*e)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(4*e.length),this.pos++;const r=this.pos;this.pos=(function(u,d,f){for(let _,w,E=0;E<d.length;E++){if(_=d.charCodeAt(E),_>55295&&_<57344){if(!w){_>56319||E+1===d.length?(u[f++]=239,u[f++]=191,u[f++]=189):w=_;continue}if(_<56320){u[f++]=239,u[f++]=191,u[f++]=189,w=_;continue}_=w-55296<<10|_-56320|65536,w=null}else w&&(u[f++]=239,u[f++]=191,u[f++]=189,w=null);_<128?u[f++]=_:(_<2048?u[f++]=_>>6|192:(_<65536?u[f++]=_>>12|224:(u[f++]=_>>18|240,u[f++]=_>>12&63|128),u[f++]=_>>6&63|128),u[f++]=63&_|128)}return f})(this.buf,e,this.pos);const o=this.pos-r;o>=128&&s_(r,o,this),this.pos=r-1,this.writeVarint(o),this.pos+=o}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){const r=e.length;this.writeVarint(r),this.realloc(r);for(let o=0;o<r;o++)this.buf[this.pos++]=e[o]}writeRawMessage(e,r){this.pos++;const o=this.pos;e(r,this);const u=this.pos-o;u>=128&&s_(o,u,this),this.pos=o-1,this.writeVarint(u),this.pos+=u}writeMessage(e,r,o){this.writeTag(e,2),this.writeRawMessage(r,o)}writePackedVarint(e,r){r.length&&this.writeMessage(e,ww,r)}writePackedSVarint(e,r){r.length&&this.writeMessage(e,Tw,r)}writePackedBoolean(e,r){r.length&&this.writeMessage(e,Pw,r)}writePackedFloat(e,r){r.length&&this.writeMessage(e,Sw,r)}writePackedDouble(e,r){r.length&&this.writeMessage(e,Ew,r)}writePackedFixed32(e,r){r.length&&this.writeMessage(e,Mw,r)}writePackedSFixed32(e,r){r.length&&this.writeMessage(e,Iw,r)}writePackedFixed64(e,r){r.length&&this.writeMessage(e,Aw,r)}writePackedSFixed64(e,r){r.length&&this.writeMessage(e,Cw,r)}writeBytesField(e,r){this.writeTag(e,2),this.writeBytes(r)}writeFixed32Field(e,r){this.writeTag(e,5),this.writeFixed32(r)}writeSFixed32Field(e,r){this.writeTag(e,5),this.writeSFixed32(r)}writeFixed64Field(e,r){this.writeTag(e,1),this.writeFixed64(r)}writeSFixed64Field(e,r){this.writeTag(e,1),this.writeSFixed64(r)}writeVarintField(e,r){this.writeTag(e,0),this.writeVarint(r)}writeSVarintField(e,r){this.writeTag(e,0),this.writeSVarint(r)}writeStringField(e,r){this.writeTag(e,2),this.writeString(r)}writeFloatField(e,r){this.writeTag(e,5),this.writeFloat(r)}writeDoubleField(e,r){this.writeTag(e,1),this.writeDouble(r)}writeBooleanField(e,r){this.writeVarintField(e,+r)}}function hc(n,e,r){return r?4294967296*e+(n>>>0):4294967296*(e>>>0)+(n>>>0)}function s_(n,e,r){const o=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(o);for(let u=r.pos-1;u>=n;u--)r.buf[u+o]=r.buf[u]}function ww(n,e){for(let r=0;r<n.length;r++)e.writeVarint(n[r])}function Tw(n,e){for(let r=0;r<n.length;r++)e.writeSVarint(n[r])}function Sw(n,e){for(let r=0;r<n.length;r++)e.writeFloat(n[r])}function Ew(n,e){for(let r=0;r<n.length;r++)e.writeDouble(n[r])}function Pw(n,e){for(let r=0;r<n.length;r++)e.writeBoolean(n[r])}function Mw(n,e){for(let r=0;r<n.length;r++)e.writeFixed32(n[r])}function Iw(n,e){for(let r=0;r<n.length;r++)e.writeSFixed32(n[r])}function Aw(n,e){for(let r=0;r<n.length;r++)e.writeFixed64(n[r])}function Cw(n,e){for(let r=0;r<n.length;r++)e.writeSFixed64(n[r])}function kw(n,e,r){n===1&&r.readMessage(Dw,e)}function Dw(n,e,r){if(n===3){const{id:o,bitmap:u,width:d,height:f,left:_,top:w,advance:E}=r.readMessage(Lw,{});e.push({id:o,bitmap:new ju({width:d+6,height:f+6},u),metrics:{width:d,height:f,left:_,top:w,advance:E}})}}function Lw(n,e,r){n===1?e.id=r.readVarint():n===2?e.bitmap=r.readBytes():n===3?e.width=r.readVarint():n===4?e.height=r.readVarint():n===5?e.left=r.readSVarint():n===6?e.top=r.readSVarint():n===7&&(e.advance=r.readVarint())}function l_(n){let e=0,r=0;for(const f of n)e+=f.w*f.h,r=Math.max(r,f.w);n.sort(((f,_)=>_.h-f.h));const o=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let u=0,d=0;for(const f of n)for(let _=o.length-1;_>=0;_--){const w=o[_];if(!(f.w>w.w||f.h>w.h)){if(f.x=w.x,f.y=w.y,d=Math.max(d,f.y+f.h),u=Math.max(u,f.x+f.w),f.w===w.w&&f.h===w.h){const E=o.pop();
5E&&_<o.length&&(o[_]=E)}else f.h===w.h?(w.x+=f.w,w.w-=f.w):f.w===w.w?(w.y+=f.h,w.h-=f.h):(o.push({x:w.x+f.w,y:w.y,w:w.w-f.w,h:f.h}),w.y+=f.h,w.h-=f.h);break}}return{w:u,h:d,fill:e/(u*d)||0}}class em{constructor(e,{pixelRatio:r,version:o,stretchX:u,stretchY:d,content:f,textFitWidth:_,textFitHeight:w}){this.paddedRect=e,this.pixelRatio=r,this.stretchX=u,this.stretchY=d,this.content=f,this.version=o,this.textFitWidth=_,this.textFitHeight=w}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 c_{constructor(e,r){const o={},u={};this.haveRenderCallbacks=[];const d=[];this.addImages(e,o,d),this.addImages(r,u,d);const{w:f,h:_}=l_(d),w=new ai({width:f||1,height:_||1});for(const E in e){const M=e[E],C=o[E].paddedRect;ai.copy(M.data,w,{x:0,y:0},{x:C.x+1,y:C.y+1},M.data)}for(const E in r){const M=r[E],C=u[E].paddedRect,D=C.x+1,R=C.y+1,B=M.data.width,N=M.data.height;ai.copy(M.data,w,{x:0,y:0},{x:D,y:R},M.data),ai.copy(M.data,w,{x:0,y:N-1},{x:D,y:R-1},{width:B,height:1}),ai.copy(M.data,w,{x:0,y:0},{x:D,y:R+N},{width:B,height:1}),ai.copy(M.data,w,{x:B-1,y:0},{x:D-1,y:R},{width:1,height:N}),ai.copy(M.data,w,{x:0,y:0},{x:D+B,y:R},{width:1,height:N})}this.image=w,this.iconPositions=o,this.patternPositions=u}addImages(e,r,o){for(const u in e){const d=e[u],f={x:0,y:0,w:d.data.width+2,h:d.data.height+2};o.push(f),r[u]=new em(f,d),d.hasRenderCallback&&this.haveRenderCallbacks.push(u)}}patchUpdatedImages(e,r){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const o in e.updatedImages)this.patchUpdatedImage(this.iconPositions[o],e.getImage(o),r),this.patchUpdatedImage(this.patternPositions[o],e.getImage(o),r)}patchUpdatedImage(e,r,o){if(!e||!r||e.version===r.version)return;e.version=r.version;const[u,d]=e.tl;o.update(r.data,void 0,{x:u,y:d})}}var Vo;function Xp(n,e,r,o,u,d,f,_,w,E,M,C,D,R,B){const N=uc.fromFeature(n,u);let U;C===v.az.vertical&&N.verticalizePunctuation();let Z=N.determineLineBreaks(E,d,e,o,R);const{processBidirectionalText:ae,processStyledBidirectionalText:W}=Ta;if(ae&&N.sections.length===1){U=[],Z=Z.map((Me=>N.toCodeUnitIndex(Me)));const pe=ae(N.toString(),Z);for(const Me of pe){const Ue=[...Me].map((()=>0));U.push(new uc(Me,N.sections,Ue))}}else if(W){U=[],Z=Z.map((Oe=>N.toCodeUnitIndex(Oe)));let pe=0;const Me=[];for(const Oe of N.text)Me.push(...Array(Oe.length).fill(N.sectionIndex[pe])),pe++;const Ue=W(N.text,Me,Z);for(const Oe of Ue){const $e=[];let Qe="";for(const Ge of Oe[0])$e.push(Oe[1][Qe.length]),Qe+=Ge;U.push(new uc(Oe[0],N.sections,$e))}}else U=(function(pe,Me){const Ue=[];let Oe=0;for(const $e of Me)Ue.push(pe.substring(Oe,$e)),Oe=$e;return Oe<pe.length()&&Ue.push(pe.substring(Oe,pe.length())),Ue})(N,Z);const X=[],le={positionedLines:X,text:N.toString(),top:M[1],bottom:M[1],left:M[0],right:M[0],writingMode:C,iconsInText:!1,verticalizable:!1};return(function(pe,Me,Ue,Oe,$e,Qe,Ge,Ne,ze,ut,st,dt){let at=0,_t=0,nr=0,qt=0;const kr=Ne==="right"?1:Ne==="left"?0:.5,zn=bn/dt;let un=0;for(const sr of $e){sr.trim();const Vr=sr.getMaxScale(),Xr={positionedGlyphs:[],lineOffset:0};pe.positionedLines[un]=Xr;const Sr=Xr.positionedGlyphs;let oi=0;if(!sr.length()){_t+=Qe,++un;continue}const Fn=Rw(Oe,sr,zn);let si=0;for(const Sn of sr.text){const Fr=sr.getSection(si),hn=Sn.codePointAt(0),Ur=zw(ze,st,hn),En={glyph:hn,imageName:null,x:at,y:_t+-17,vertical:Ur,scale:1,fontStack:"",sectionIndex:sr.getSectionIndex(si),metrics:null,rect:null};let oo;if("fontStack"in Fr){if(oo=Fw(Fr,hn,Ur,Fn,Me,Ue),!oo)continue;En.fontStack=Fr.fontStack}else{if(pe.iconsInText=!0,Fr.scale*=zn,oo=Ow(Fr,Ur,Vr,Fn,Oe),!oo)continue;oi=Math.max(oi,oo.imageOffset),En.imageName=Fr.imageName}const{rect:ia,metrics:nh,baselineOffset:Zo}=oo;En.y+=Zo,En.scale=Fr.scale,En.metrics=nh,En.rect=ia,Sr.push(En),Ur?(pe.verticalizable=!0,at+=("imageName"in Fr?nh.advance:bn)*Fr.scale+ut):at+=nh.advance*Fr.scale+ut,si++}Sr.length!==0&&(nr=Math.max(at-ut,nr),Bw(Sr,0,Sr.length-1,kr)),at=0,Xr.lineOffset=Math.max(oi,(Vr-1)*bn);const Zi=Qe*Vr+oi;_t+=Zi,qt=Math.max(Zi,qt),++un}const{horizontalAlign:Dr,verticalAlign:Mr}=tm(Ge);(function(sr,Vr,Xr,Sr,oi,Fn,si,Zi,Sn){const Fr=(Vr-Xr)*oi;let hn=0;hn=Fn!==si?-Zi*Sr- -17:-Sr*Sn*si+.5*si;for(const Ur of sr)for(const En of Ur.positionedGlyphs)En.x+=Fr,En.y+=hn})(pe.positionedLines,kr,Dr,Mr,nr,qt,Qe,_t,$e.length),pe.top+=-Mr*_t,pe.bottom=pe.top+_t,pe.left+=-Dr*nr,pe.right=pe.left+nr})(le,e,r,o,U,f,_,w,C,E,D,B),!(function(pe){for(const Me of pe)if(Me.positionedGlyphs.length!==0)return!1;return!0})(X)&&le}function tm(n){let e=.5,r=.5;switch(n){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(n){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}function Rw(n,e,r){const o=e.getMaxScale()*bn,{maxImageWidth:u,max
vendor: 27,085 bytes, line 5
5ImageHeight:d}=e.getMaxImageSize(n),f=Math.max(o,d*r);return{verticalLineContentWidth:Math.max(o,u*r),horizontalLineContentHeight:f}}function u_(n){switch(n){case"top":return 0;case"center":return .5;default:return 1}}function zw(n,e,r){return!(n===v.az.horizontal||!e&&!Eu(r)||e&&(Ap(r)||(o=r,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(o)))));var o}function Fw(n,e,r,o,u,d){const f=d[n.fontStack],_=(function(E,M,C,D){if(E&&E.rect)return E;const R=M[C.fontStack],B=R&&R[D];return B?{rect:null,metrics:B.metrics}:null})(f&&f[e],u,n,e);if(_===null)return null;let w;if(r)w=o.verticalLineContentWidth-n.scale*bn;else{const E=u_(n.verticalAlign);w=(o.horizontalLineContentHeight-n.scale*bn)*E}return{rect:_.rect,metrics:_.metrics,baselineOffset:w}}function Ow(n,e,r,o,u){const d=u[n.imageName];if(!d)return null;const f=d.paddedRect,_=d.displaySize,w={width:_[0],height:_[1],left:1,top:-3,advance:e?_[1]:_[0]};let E;if(e)E=o.verticalLineContentWidth-_[1]*n.scale;else{const M=u_(n.verticalAlign);E=(o.horizontalLineContentHeight-_[1]*n.scale)*M}return{rect:f,metrics:w,baselineOffset:E,imageOffset:(e?_[0]:_[1])*n.scale-bn*r}}function Bw(n,e,r,o){if(o===0)return;const u=n[r],d=(n[r].x+u.metrics.advance*u.scale)*o;for(let f=e;f<=r;f++)n[f].x-=d}function Nw(n,e,r){const{horizontalAlign:o,verticalAlign:u}=tm(r),d=e[0]-n.displaySize[0]*o,f=e[1]-n.displaySize[1]*u;return{image:n,top:f,bottom:f+n.displaySize[1],left:d,right:d+n.displaySize[0]}}function h_(n){var e,r;let o=n.left,u=n.top,d=n.right-o,f=n.bottom-u;const _=(e=n.image.textFitWidth)!==null&&e!==void 0?e:"stretchOrShrink",w=(r=n.image.textFitHeight)!==null&&r!==void 0?r:"stretchOrShrink",E=(n.image.content[2]-n.image.content[0])/(n.image.content[3]-n.image.content[1]);if(w==="proportional"){if(_==="stretchOnly"&&d/f<E||_==="proportional"){const M=Math.ceil(f*E);o*=M/d,d=M}}else if(_==="proportional"&&w==="stretchOnly"&&E!==0&&d/f>E){const M=Math.ceil(d/E);u*=M/f,f=M}return{x1:o,y1:u,x2:o+d,y2:u+f}}function p_(n,e,r,o,u,d){const f=n.image;let _;if(f.content){const U=f.content,Z=f.pixelRatio||1;_=[U[0]/Z,U[1]/Z,f.displaySize[0]-U[2]/Z,f.displaySize[1]-U[3]/Z]}const w=e.left*d,E=e.right*d;let M,C,D,R;r==="width"||r==="both"?(R=u[0]+w-o[3],C=u[0]+E+o[1]):(R=u[0]+(w+E-f.displaySize[0])/2,C=R+f.displaySize[0]);const B=e.top*d,N=e.bottom*d;return r==="height"||r==="both"?(M=u[1]+B-o[0],D=u[1]+N+o[2]):(M=u[1]+(B+N-f.displaySize[1])/2,D=M+f.displaySize[1]),{image:f,top:M,right:C,bottom:D,left:R,collisionPadding:_}}ht("ImagePosition",em),ht("ImageAtlas",c_),v.az=void 0,(Vo=v.az||(v.az={}))[Vo.none=0]="none",Vo[Vo.horizontal=1]="horizontal",Vo[Vo.vertical=2]="vertical",Vo[Vo.horizontalOnly=3]="horizontalOnly";const io=128,Uo=32640;function d_(n,e){const{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new dr(n+1))};if(r.kind==="source")return{kind:"source"};{const{zoomStops:o,interpolationType:u}=r;let d=0;for(;d<o.length&&o[d]<=n;)d++;d=Math.max(0,d-1);let f=d;for(;f<o.length&&o[f]<n+1;)f++;f=Math.min(o.length-1,f);const _=o[d],w=o[f];return r.kind==="composite"?{kind:"composite",minZoom:_,maxZoom:w,interpolationType:u}:{kind:"camera",minZoom:_,maxZoom:w,minSize:r.evaluate(new dr(_)),maxSize:r.evaluate(new dr(w)),interpolationType:u}}}function rm(n,e,r){let o="never";const u=n.get(e);return u?o=u:n.get(r)&&(o="always"),o}const jw=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Yp(n,e,r,o,u,d,f,_,w,E,M,C,D){const R=_?Math.min(Uo,Math.round(_[0])):0,B=_?Math.min(Uo,Math.round(_[1])):0;n.emplaceBack(e,r,Math.round(32*o),Math.round(32*u),d,f,(R<<1)+(w?1:0),B,16*E,16*M,256*C,256*D)}function nm(n,e,r){n.emplaceBack(e.x,e.y,r),n.emplaceBack(e.x,e.y,r),n.emplaceBack(e.x,e.y,r),n.emplaceBack(e.x,e.y,r)}function Vw(n){for(const e of n.sections)if(Dp(e.text))return!0;return!1}class im{constructor(e){this.layoutVertexArray=new ce,this.indexArray=new Le,this.programConfigurations=e,this.segments=new tt,this.dynamicLayoutVertexArray=new ve,this.opacityVertexArray=new Fe,this.hasVisibleVertices=!1,this.placedSymbolArray=new b}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,r,o,u){this.isEmpty()||(o&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,fw.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,mw.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,jw,!0),this.opacityVertexBuffer.itemSize=1),(o||u)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}ht("SymbolBuffers",im);class am{constructor(e,r,o){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new o,this.segments=new tt,this.collisionVertexArray=new ke}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,gw.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}ht("CollisionBuffers",am);class pc{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((f=>f.id)),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasDependencies=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=d_(this.zoom,r["text-size"]),this.iconSizeData=d_(this.zoom,r["icon-size"]);const o=this.layers[0].layout,u=o.get("symbol-sort-key"),d=o.get("symbol-z-order");this.canOverlap=rm(o,"text-overlap","text-allow-overlap")!=="never"||rm(o,"icon-overlap","icon-allow-overlap")!=="never"||o.get("text-ignore-placement")||o.get("icon-ignore-placement"),this.sortFeaturesByKey=d!=="viewport-y"&&!u.isConstant(),this.sortFeaturesByY=(d==="viewport-y"||d==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,o.get("symbol-placement")==="point"&&(this.writingModes=o.get("text-writing-mode").map((f=>v.az[f]))),this.stateDependentLayerIds=this.layers.filter((f=>f.isStateDependent())).map((f=>f.id)),this.sourceID=e.sourceID}createArrays(){this.text=new im(new no(this.layers,this.zoom,(e=>/^text/.test(e)))),this.icon=new im(new no(this.layers,this.zoom,(e=>/^icon/.test(e)))),this.glyphOffsetArray=new A,this.lineVertexArray=new k,this.symbolInstances=new P,this.textAnchorOffsets=new z}calculateGlyphDependencies(e,r,o,u,d){for(const f of e)if(r[f.codePointAt(0)]=!0,(o||u)&&d){const _=Yu[f];_&&(r[_.codePointAt(0)]=!0)}}populate(e,r,o){const u=this.layers[0],d=u.layout,f=d.get("text-font"),_=d.get("text-field"),w=d.get("icon-image"),E=(_.value.kind!=="constant"||_.value.value instanceof Xn&&!_.value.value.isEmpty()||_.value.value.toString().length>0)&&(f.value.kind!=="constant"||f.value.value.length>0),M=w.value.kind!=="constant"||!!w.value.value||Object.keys(w.parameters).length>0,C=d.get("symbol-sort-key");if(this.features=[],!E&&!M)return;const D=r.iconDependencies,R=r.glyphDependencies,B=r.availableImages,N=new dr(this.zoom);for(const{feature:U,id:Z,index:ae,sourceLayerIndex:W}of e){const X=u._featureFilter.needGeometry,le=Ma(U,X);if(!u._featureFilter.filter(N,le,o))continue;let pe,Me;if(X||(le.geometry=Pa(U)),E){const Oe=u.getValueAndResolveTokens("text-field",le,o,B),$e=Xn.factory(Oe),Qe=this.hasRTLText=this.hasRTLText||Vw($e);(!Qe||Ta.getRTLTextPluginStatus()==="unavailable"||Qe&&Ta.isParsed())&&(pe=_w($e,u,le))}if(M){const Oe=u.getValueAndResolveTokens("icon-image",le,o,B);Me=Oe instanceof ni?Oe:ni.fromString(Oe)}if(!pe&&!Me)continue;const Ue=this.sortFeaturesByKey?C.evaluate(le,{},o):void 0;if(this.features.push({id:Z,text:pe,icon:Me,index:ae,sourceLayerIndex:W,geometry:le.geometry,properties:U.properties,type:Wu.types[U.type],sortKey:Ue}),Me&&(D[Me.name]=!0),pe){const Oe=f.evaluate(le,{},o).join(","),$e=d.get("text-rotation-alignment")!=="viewport"&&d.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(v.az.vertical)>=0;for(const Qe of pe.sections)if(Qe.image)D[Qe.image.name]=!0;else{const Ge=No(pe.toString()),Ne=Qe.fontStack||Oe,ze=R[Ne]=R[Ne]||{};this.calculateGlyphDependencies(Qe.text,ze,$e,this.allowVerticalPlacement,Ge)}}}d.get("symbol-placement")==="line"&&(this.features=(function(U){const Z={},ae={},W=[];let X=0;function le(Oe){W.push(U[Oe]),X++}function pe(Oe,$e,Qe){const Ge=ae[Oe];return delete ae[Oe],ae[$e]=Ge,W[Ge].geometry[0].pop(),W[Ge].geometry[0]=W[Ge].geometry[0].concat(Qe[0]),Ge}function Me(Oe,$e,Qe){const Ge=Z[$e];return delete Z[$e],Z[Oe]=Ge,W[Ge].geometry[0].shift(),W[Ge].geometry[0]=Qe[0].concat(W[Ge].geometry[0]),Ge}function Ue(Oe,$e,Qe){const Ge=Qe?$e[0][$e[0].length-1]:$e[0][0];return`${Oe}:${Ge.x}:${Ge.y}`}for(let Oe=0;Oe<U.length;Oe++){const $e=U[Oe],Qe=$e.geometry,Ge=$e.text?$e.text.toString():null;if(!Ge){le(Oe);continue}const Ne=Ue(Ge,Qe),ze=Ue(Ge,Qe,!0);if(Ne in ae&&ze in Z&&ae[Ne]!==Z[ze]){const ut=Me(Ne,ze,Qe),st=pe(Ne,ze,W[ut].geometry);delete Z[Ne],delete ae[ze],ae[Ue(Ge,W[st].geometry,!0)]=st,W[ut].geometry=null}else Ne in ae?pe(Ne,ze,Qe):ze in Z?Me(Ne,ze,Qe):(le(Oe),Z[Ne]=X-1,ae[ze]=X-1)}return W.filter((Oe=>Oe.geometry))})(this.features)),this.sortFeaturesByKey&&this.features.sort(((U,Z)=>U.sortKey-Z.sortKey))}update(e,r,o){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,r,this.layers,{imagePositions:o}),this.icon.programConfigurations.updatePaintArrays(e,r,this.layers,{imagePositions:o}))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,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(e,r){const o=this.lineVertexArray.length;if(e.segment!==void 0){let u=e.dist(r[e.segment+1]),d=e.dist(r[e.segment]);const f={};for(let _=e.segment+1;_<r.length;_++)f[_]={x:r[_].x,y:r[_].y,tileUnitDistanceFromAnchor:u},_<r.length-1&&(u+=r[_+1].dist(r[_]));for(let _=e.segment||0;_>=0;_--)f[_]={x:r[_].x,y:r[_].y,tileUnitDistanceFromAnchor:d},_>0&&(d+=r[_-1].dist(r[_]));for(let _=0;_<r.length;_++){const w=f[_];this.lineVertexArray.emplaceBack(w.x,w.y,w.tileUnitDistanceFromAnchor)}}return{lineStartIndex:o,lineLength:this.lineVertexArray.length-o}}addSymbols(e,r,o,u,d,f,_,w,E,M,C,D){const R=e.indexArray,B=e.layoutVertexArray,N=e.segments.prepareSegment(4*r.length,B,R,this.canOverlap?f.sortKey:void 0),U=this.glyphOffsetArray.length,Z=N.vertexLength,ae=this.allowVerticalPlacement&&_===v.az.vertical?Math.PI/2:0,W=f.text&&f.text.sections;for(let X=0;X<r.length;X++){const{tl:le,tr:pe,bl:Me,br:Ue,tex:Oe,pixelOffsetTL:$e,pixelOffsetBR:Qe,minFontScaleX:Ge,minFontScaleY:Ne,glyphOffset:ze,isSDF:ut,sectionIndex:st}=r[X],dt=N.vertexLength,at=ze[1];Yp(B,w.x,w.y,le.x,at+le.y,Oe.x,Oe.y,o,ut,$e.x,$e.y,Ge,Ne),Yp(B,w.x,w.y,pe.x,at+pe.y,Oe.x+Oe.w,Oe.y,o,ut,Qe.x,$e.y,Ge,Ne),Yp(B,w.x,w.y,Me.x,at+Me.y,Oe.x,Oe.y+Oe.h,o,ut,$e.x,Qe.y,Ge,Ne),Yp(B,w.x,w.y,Ue.x,at+Ue.y,Oe.x+Oe.w,Oe.y+Oe.h,o,ut,Qe.x,Qe.y,Ge,Ne),nm(e.dynamicLayoutVertexArray,w,ae),R.emplaceBack(dt,dt+2,dt+1),R.emplaceBack(dt+1,dt+2,dt+3),N.vertexLength+=4,N.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(ze[0]),X!==r.length-1&&st===r[X+1].sectionIndex||e.programConfigurations.populatePaintArrays(B.length,f,f.index,{imagePositions:{},canonical:D,formattedSection:W&&W[st]})}e.placedSymbolArray.emplaceBack(w.x,w.y,U,this.glyphOffsetArray.length-U,Z,E,M,w.segment,o?o[0]:0,o?o[1]:0,u[0],u[1],_,0,!1,0,C)}_addCollisionDebugVertex(e,r,o,u,d,f){return r.emplaceBack(0,0),e.emplaceBack(o.x,o.y,u,d,Math.round(f.x),Math.round(f.y))}addCollisionDebugVertices(e,r,o,u,d,f,_){const w=d.segments.prepareSegment(4,d.layoutVertexArray,d.indexArray),E=w.vertexLength,M=d.layoutVertexArray,C=d.collisionVertexArray,D=_.anchorX,R=_.anchorY;this._addCollisionDebugVertex(M,C,f,D,R,new I(e,r)),this._addCollisionDebugVertex(M,C,f,D,R,new I(o,r)),this._addCollisionDebugVertex(M,C,f,D,R,new I(o,u)),this._addCollisionDebugVertex(M,C,f,D,R,new I(e,u)),w.vertexLength+=4;const B=d.indexArray;B.emplaceBack(E,E+1),B.emplaceBack(E+1,E+2),B.emplaceBack(E+2,E+3),B.emplaceBack(E+3,E),w.primitiveLength+=4}addDebugCollisionBoxes(e,r,o,u){for(let d=e;d<r;d++){const f=this.collisionBoxArray.get(d);this.addCollisionDebugVertices(f.x1,f.y1,f.x2,f.y2,u?this.textCollisionBox:this.iconCollisionBox,f.anchorPoint,o)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new am(Ce,e_.members,Xe),this.iconCollisionBox=new am(Ce,e_.members,Xe);for(let e=0;e<this.symbolInstances.length;e++){const r=this.symbolInstances.get(e);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(e,r,o,u,d,f,_,w,E){const M={};for(let C=r;C<o;C++){const D=e.get(C);M.textBox={x1:D.x1,y1:D.y1,x2:D.x2,y2:D.y2,anchorPointX:D.anchorPointX,anchorPointY:D.anchorPointY},M.textFeatureIndex=D.featureIndex;break}for(let C=u;C<d;C++){const D=e.get(C);M.verticalTextBox={x1:D.x1,y1:D.y1,x2:D.x2,y2:D.y2,anchorPointX:D.anchorPointX,anchorPointY:D.anchorPointY},M.verticalTextFeatureIndex=D.featureIndex;break}for(let C=f;C<_;C++){const D=e.get(C);M.iconBox={x1:D.x1,y1:D.y1,x2:D.x2,y2:D.y2,anchorPointX:D.anchorPointX,anchorPointY:D.anchorPointY},M.iconFeatureIndex=D.featureIndex;break}for(let C=w;C<E;C++){const D=e.get(C);M.verticalIconBox={x1:D.x1,y1:D.y1,x2:D.x2,y2:D.y2,anchorPointX:D.anchorPointX,anchorPointY:D.anchorPointY},M.verticalIconFeatureIndex=D.featureIndex;break}return M}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){const o=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,o.textBoxStartIndex,o.textBoxEndIndex,o.verticalTextBoxStartIndex,o.verticalTextBoxEndIndex,o.iconBoxStartIndex,o.iconBoxEndIndex,o.verticalIconBoxStartIndex,o.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(e,r){const o=e.placedSymbolArray.get(r),u=o.vertexStartIndex+4*o.numGlyphs;for(let d=o.vertexStartIndex;d<u;d+=4)e.indexArray.emplaceBack(d,d+2,d+1),e.indexArray.emplaceBack(d+1,d+2,d+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const r=Math.sin(e),o=Math.cos(e),u=[],d=[],f=[];for(let _=0;_<this.symbolInstances.length;++_){f.push(_);const w=this.symbolInstances.get(_);u.push(0|Math.round(r*w.anchorX+o*w.anchorY)),d.push(w.featureIndex)}return f.sort(((_,w)=>u[_]-u[w]||d[w]-d[_])),f}addToSortKeyRanges(e,r){const o=this.sortKeyRanges[this.sortKeyRanges.length-1];o&&o.sortKey===r?o.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const r of this.symbolInstanceIndexes){const o=this.symbolInstances.get(r);this.featureSortOrder.push(o.featureIndex),[o.rightJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.leftJustifiedTextSymbolIndex].forEach(((u,d,f)=>{u>=0&&f.indexOf(u)===d&&this.addIndicesForPlacedSymbol(this.text,u)})),o.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,o.verticalPlacedTextSymbolIndex),o.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,o.placedIconSymbolIndex),o.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,o.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let f_,m_;ht("SymbolBucket",pc,{omit:["layers","collisionBoxArray","features","compareText"]}),pc.MAX_GLYPHS=65535,pc.addDynamicAttributes=nm;var om={get paint(){return m_=m_||new qn({"icon-opacity":new bt(Te.paint_symbol["icon-opacity"]),"icon-color":new bt(Te.paint_symbol["icon-color"]),"icon-halo-color":new bt(Te.paint_symbol["icon-halo-color"]),"icon-halo-width":new bt(Te.paint_symbol["icon-halo-width"]),"icon-halo-blur":new bt(Te.paint_symbol["icon-halo-blur"]),"icon-translate":new gt(Te.paint_symbol["icon-translate"]),"icon-translate-anchor":new gt(Te.paint_symbol["icon-translate-anchor"]),"text-opacity":new bt(Te.paint_symbol["text-opacity"]),"text-color":new bt(Te.paint_symbol["text-color"],{runtimeType:ri,getOverride:n=>n.textColor,hasOverride:n=>!!n.textColor}),"text-halo-color":new bt(Te.paint_symbol["text-halo-color"]),"text-halo-width":new bt(Te.paint_symbol["text-halo-width"]),"text-halo-blur":new bt(Te.paint_symbol["text-halo-blur"]),"text-translate":new gt(Te.paint_symbol["text-translate"]),"text-translate-anchor":new gt(Te.paint_symbol["text-translate-anchor"])})},get layout(){return f_=f_||new qn({"symbol-placement":new gt(Te.layout_symbol["symbol-placement"]),"symbol-spacing":new gt(Te.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new gt(Te.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new bt(Te.layout_symbol["symbol-sort-key"]),"symbol-z-order":new gt(Te.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new gt(Te.layout_symbol["icon-allow-overlap"]),"icon-overlap":new gt(Te.layout_symbol["icon-overlap"]),"icon-ignore-placement":new gt(Te.layout_symbol["icon-ignore-placement"]),"icon-optional":new gt(Te.layout_symbol["icon-optional"]),"icon-rotation-alignment":new gt(Te.layout_symbol["icon-rotation-alignment"]),"icon-size":new bt(Te.layout_symbol["icon-size"]),"icon-text-fit":new gt(Te.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new gt(Te.layout_symbol["icon-text-fit-padding"]),"icon-image":new bt(Te.layout_symbol["icon-image"]),"icon-rotate":new bt(Te.layout_symbol["icon-rotate"]),"icon-padding":new bt(Te.layout_symbol["icon-padding"]),"icon-keep-upright":new gt(Te.layout_symbol["icon-keep-upright"]),"icon-offset":new bt(Te.layout_symbol["icon-offset"]),"icon-anchor":new bt(Te.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new gt(Te.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new gt(Te.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new gt(Te.layout_symbol["text-rotation-alignment"]),"text-field":new bt(Te.layout_symbol["text-field"]),"text-font":new bt(Te.layout_symbol["text-font"]),"text-size":new bt(Te.layout_symbol["text-size"]),"text-max-width":new bt(Te.layout_symbol["text-max-width"]),"text-line-height":new gt(Te.layout_symbol["text-line-height"]),"text-letter-spacing":new bt(Te.layout_symbol["text-letter-spacing"]),"text-justify":new bt(Te.layout_symbol["text-justify"]),"text-radial-offset":new bt(Te.layout_symbol["text-radial-offset"]),"text-variable-anchor":new gt(Te.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new bt(Te.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new bt(Te.layout_symbol["text-anchor"]),"text-max-angle":new gt(Te.layout_symbol["text-max-angle"]),"text-writing-mode":new gt(Te.layout_symbol["text-writing-mode"]),"text-rotate":new bt(Te.layout_symbol["text-rotate"]),"text-padding":new gt(Te.layout_symbol["text-padding"]),"text-keep-upright":new gt(Te.layout_symbol["text-keep-upright"]),"text-transform":new bt(Te.layout_symbol["text-transform"]),"text-offset":new bt(Te.layout_symbol["text-offset"]),"text-allow-overlap":new gt(Te.layout_symbol["text-allow-overlap"]),"text-overlap":new gt(Te.layout_symbol["text-overlap"]),"text-ignore-placement":new gt(Te.layout_symbol["text-ignore-placement"]),"text-optional":new gt(Te.layout_symbol["text-optional"])})}};class g_{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:pi,this.defaultValue=e}evaluate(e){if(e.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(e.formattedSection))return r.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}ht("FormatSectionOverride",g_,{omit:["defaultValue"]});class Kp extends gi{constructor(e,r){super(e,om,r)}recalculate(e,r){if(super.recalculate(e,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 o=this.layout.get("text-writing-mode");if(o){const u=[];for(const d of o)u.indexOf(d)<0&&u.push(d);this.layout._values["text-writing-mode"]=u}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,o,u){const d=this.layout.get(e).evaluate(r,{},o,u),f=this._unevaluatedLayout._values[e];return f.isDataDriven()||Ro(f.value)||!d?d:(function(_,w){return w.replace(/{([^{}]+)}/g,((E,M)=>_&&M in _?String(_[M]):""))})(r.properties,d)}createBucket(e){return new pc(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of om.paint.overridableProperties){if(!Kp.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),o=new g_(r),u=new du(o,r.property.specification);let d=null;d=r.value.kind==="constant"||r.value.kind==="source"?new Ol("source",u):new fu("composite",u,r.value.zoomStops),this.paint._values[e]=new Mi(r.property,d,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,o){return!(!this.layout||r.isDataDriven()||o.isDataDriven())&&Kp.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const o=e.get("text-field"),u=om.paint.properties[r];let d=!1;const f=_=>{for(const w of _)if(u.overrides&&u.overrides.hasOverride(w))return void(d=!0)};if(o.value.kind==="constant"&&o.value.value instanceof Xn)f(o.value.value.sections);else if(o.value.kind==="source"||o.value.kind==="composite"){const _=E=>{d||(E instanceof Ui&&Gr(E.value)===os?f(E.value.sections):E instanceof gs?f(E.sections):E.eachChild(_))},w=o.value;w._styleExpression&&_(w._styleExpression.expression)}return d}}let y_;var Uw={get paint(){return y_=y_||new qn({"background-color":new gt(Te.paint_background["background-color"]),"background-pattern":new Xl(Te.paint_background["background-pattern"]),"background-opacity":new gt(Te.paint_background["background-opacity"])})}};class $w extends gi{constructor(e,r){super(e,Uw,r)}}class qw extends gi{constructor(e,r){super(e,{},r),this.onAdd=o=>{this.implementation.onAdd&&this.implementation.onAdd(o,o.painter.context.gl)},this.onRemove=o=>{this.implementation.onRemove&&this.implementation.onRemove(o,o.painter.context.gl)},this.implementation=e}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 Gw{constructor(e){this._methodToThrottle=e,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 Zw={once:!0},sm=63710088e-1;class $o{constructor(e,r){if(isNaN(e)||isNaN(r))throw new Error(`Invalid LngLat object: (${e}, ${r})`);if(this.lng=+e,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 $o(pr(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const r=Math.PI/180,o=this.lat*r,u=e.lat*r,d=Math.sin(o)*Math.sin(u)+Math.cos(o)*Math.cos(u)*Math.cos((e.lng-this.lng)*r);return sm*Math.acos(Math.min(d,1))}static convert(e){if(e instanceof $o)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new $o(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new $o(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const __=2*Math.PI*sm;function v_(n){return __*Math.cos(n*Math.PI/180)}function x_(n){return(180+n)/360}function b_(n){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+n*Math.PI/360)))/360}function w_(n,e){return n/v_(e)}function T_(n){return 360*n-180}function Jp(n){return 360/Math.PI*Math.atan(Math.exp((180-360*n)*Math.PI/180)
5)-90}function S_(n,e){return n*v_(Jp(e))}class Ku{constructor(e,r,o=0){this.x=+e,this.y=+r,this.z=+o}static fromLngLat(e,r=0){const o=$o.convert(e);return new Ku(x_(o.lng),b_(o.lat),w_(r,o.lat))}toLngLat(){return new $o(T_(this.x),Jp(this.y))}toAltitude(){return S_(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/__*(e=Jp(this.y),1/Math.cos(e*Math.PI/180));var e}}function E_(n,e,r){var o=2*Math.PI*6378137/256/Math.pow(2,r);return[n*o-2*Math.PI*6378137/2,e*o-2*Math.PI*6378137/2]}class lm{constructor(e,r,o){if(!(function(u,d,f){return!(u<0||u>25||f<0||f>=Math.pow(2,u)||d<0||d>=Math.pow(2,u))})(e,r,o))throw new Error(`x=${r}, y=${o}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=r,this.y=o,this.key=dc(0,e,e,r,o)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,r,o){const u=(function(f,_,w){var E=E_(256*f,256*(_=Math.pow(2,w)-_-1),w),M=E_(256*(f+1),256*(_+1),w);return E[0]+","+E[1]+","+M[0]+","+M[1]})(this.x,this.y,this.z),d=(function(f,_,w){let E,M="";for(let C=f;C>0;C--)E=1<<C-1,M+=(_&E?1:0)+(w&E?2:0);return M})(this.z,this.x,this.y);return e[(this.x+this.y)%e.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(o==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,d).replace(/{bbox-epsg-3857}/g,u)}isChildOf(e){const r=this.z-e.z;return r>0&&e.x===this.x>>r&&e.y===this.y>>r}getTilePoint(e){const r=Math.pow(2,this.z);return new I((e.x*r-this.x)*pt,(e.y*r-this.y)*pt)}toString(){return`${this.z}/${this.x}/${this.y}`}}class P_{constructor(e,r){this.wrap=e,this.canonical=r,this.key=dc(e,r.z,r.z,r.x,r.y)}}class Ci{constructor(e,r,o,u,d){if(this.terrainRttPosMatrix32f=null,e<o)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${o}`);this.overscaledZ=e,this.wrap=r,this.canonical=new lm(o,+u,+d),this.key=dc(r,e,o,u,d)}clone(){return new Ci(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-e;return e>this.canonical.z?new Ci(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Ci(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(e,r){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const o=this.canonical.z-e;return e>this.canonical.z?dc(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):dc(this.wrap*+r,e,e,this.canonical.x>>o,this.canonical.y>>o)}isChildOf(e){if(e.wrap!==this.wrap||this.overscaledZ-e.overscaledZ<=0)return!1;if(e.overscaledZ===0)return this.overscaledZ>0;const r=this.canonical.z-e.canonical.z;return!(r<0)&&e.canonical.x===this.canonical.x>>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new Ci(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,o=2*this.canonical.x,u=2*this.canonical.y;return[new Ci(r,this.wrap,r,o,u),new Ci(r,this.wrap,r,o+1,u),new Ci(r,this.wrap,r,o,u+1),new Ci(r,this.wrap,r,o+1,u+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new Ci(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Ci(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new P_(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new Ku(e.x-this.wrap,e.y))}}function dc(n,e,r,o,u){(n*=2)<0&&(n=-1*n-1);const d=1<<r;return(d*d*n+d*u+o).toString(36)+r.toString(36)+e.toString(36)}function cm(n,e){return e?n.properties[e]:n.id}function Ww(n,e){const r={id:n.id};if(e.removeAllProperties&&(delete n.removeProperties,delete n.addOrUpdateProperties,delete e.removeProperties),e.removeProperties)for(const o of e.removeProperties){const u=n.addOrUpdateProperties.findIndex((d=>d.key===o));u>-1&&n.addOrUpdateProperties.splice(u,1)}return(n.removeAllProperties||e.removeAllProperties)&&(r.removeAllProperties=!0),(n.removeProperties||e.removeProperties)&&(r.removeProperties=[...n.removeProperties||[],...e.removeProperties||[]]),(n.addOrUpdateProperties||e.addOrUpdateProperties)&&(r.addOrUpdateProperties=[...n.addOrUpdateProperties||[],...e.addOrUpdateProperties||[]]),(n.newGeometry||e.newGeometry)&&(r.newGeometry=e.newGeometry||n.newGeometry),r}function M_(n){var e,r;if(!n)return{};const o={};
5return o.removeAll=n.removeAll,o.remove=new Set(n.remove||[]),o.add=new Map((e=n.add)===null||e===void 0?void 0:e.map((u=>[u.id,u]))),o.update=new Map((r=n.update)===null||r===void 0?void 0:r.map((u=>[u.id,u]))),o}ht("CanonicalTileID",lm),ht("OverscaledTileID",Ci,{omit:["terrainRttPosMatrix32f"]});class Ws{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(e){return this.minX=Math.min(this.minX,e.x),this.minY=Math.min(this.minY,e.y),this.maxX=Math.max(this.maxX,e.x),this.maxY=Math.max(this.maxY,e.y),this}expandBy(e){return this.minX-=e,this.minY-=e,this.maxX+=e,this.maxY+=e,(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(e){return this.expandBy(-e)}map(e){const r=new Ws;return r.extend(e(new I(this.minX,this.minY))),r.extend(e(new I(this.maxX,this.minY))),r.extend(e(new I(this.minX,this.maxY))),r.extend(e(new I(this.maxX,this.maxY))),r}static fromPoints(e){const r=new Ws;for(const o of e)r.extend(o);return r}contains(e){return e.x>=this.minX&&e.x<=this.maxX&&e.y>=this.minY&&e.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(e){return!this.empty()&&!e.empty()&&e.minX>=this.minX&&e.maxX<=this.maxX&&e.minY>=this.minY&&e.maxY<=this.maxY}intersects(e){return!this.empty()&&!e.empty()&&e.minX<=this.maxX&&e.maxX>=this.minX&&e.minY<=this.maxY&&e.maxY>=this.minY}}class I_{constructor(e){this._stringToNumber={},this._numberToString=[];for(let r=0;r<e.length;r++){const o=e[r];this._stringToNumber[o]=r,this._numberToString[r]=o}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class A_{constructor(e,r,o,u,d){this.type="Feature",this._vectorTileFeature=e,this._x=o,this._y=u,this._z=r,this.properties=e.properties,this.id=d}projectPoint(e,r,o,u){return[360*(e.x+r)/u-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+o)/u)*Math.PI))-90]}projectLine(e,r,o,u){return e.map((d=>this.projectPoint(d,r,o,u)))}get geometry(){if(this._geometry)return this._geometry;const e=this._vectorTileFeature,r=e.extent*Math.pow(2,this._z),o=e.extent*this._x,u=e.extent*this._y,d=e.loadGeometry();switch(e.type){case 1:{const f=[];for(const w of d)f.push(w[0]);const _=this.projectLine(f,o,u,r);this._geometry=f.length===1?{type:"Point",coordinates:_[0]}:{type:"MultiPoint",coordinates:_};break}case 2:{const f=d.map((_=>this.projectLine(_,o,u,r)));this._geometry=f.length===1?{type:"LineString",coordinates:f[0]}:{type:"MultiLineString",coordinates:f};break}case 3:{const f=qy(d),_=[];for(const w of f)_.push(w.map((E=>this.projectLine(E,o,u,r))));this._geometry=_.length===1?{type:"Polygon",coordinates:_[0]}:{type:"MultiPolygon",coordinates:_};break}default:throw new Error(`unknown feature type: ${e.type}`)}return this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&r!=="_x"&&r!=="_y"&&r!=="_z"&&(e[r]=this[r]);return e}}class fc{constructor(e,r,o){kt(this,"_name");kt(this,"dataBuffer");kt(this,"nullabilityBuffer");kt(this,"_size");this._name=e,this.dataBuffer=r,typeof o=="number"?this._size=o:(this.nullabilityBuffer=o,this._size=o.size())}getValue(e){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(e)?null:this.getValueFromBuffer(e)}has(e){return this.nullabilityBuffer&&this.nullabilityBuffer.get(e)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}}class Qp extends fc{}class um extends Qp{getValueFromBuffer(e){return this.dataBuffer[e]}}class hm extends Qp{getValueFromBuffer(e){return this.dataBuffer[e]}}class C_ extends fc{constructor(r,o,u,d){super(r,o,d);kt(this,"delta");this.delta=u}}class pm extends C_{constructor(e,r,o,u){super(e,Int32Array.of(r),o,u)}getValueFromBuffer(e){return this.dataBuffer[0]+e*this.delta}}class dm extends fc{constructor(e,r,o){super(e,Int32Array.of(r),o)}getValueFromBuffer(e){return this.dataBuffer[0]}}class Hw{constructor(e,r,o,u,d=4096){kt(this,"_name");kt(this,"_geometryVector");kt(this,"_idVector");kt(this,"_propertyVectors");kt(this,"_extent");kt(this,"propertyVectorsMap");this._name=e,this._geometryVector=r,this._idVector=o,this._propertyVectors=u,this._extent=d}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors}getPropertyVector(e){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this._propertyVectors.map((r=>[r.name,r])))),this.propertyVectorsMap.get(e)}*[Symbol.iterator](){const e=this.geometryVector[Symbol.iterator]();let r=0;for(;r<this.numFeatures;){let o;this.idVector&&(o=this.containsMaxSaveIntegerValues(this.idVector)?Number(this.idVector.getValue(r)):this.idVector.getValue(r));const u=e==null?void 0:e.next().value,d={};
vendor: 3,261 bytes, line 5
5for(const f of this.propertyVectors){if(!f)continue;const _=f.name,w=f.getValue(r);w!==null&&(d[_]=w)}r++,yield{id:o,geometry:u,properties:d}}}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){const e=[],r=this.geometryVector.getGeometries();for(let o=0;o<this.numFeatures;o++){let u;this.idVector&&(u=this.containsMaxSaveIntegerValues(this.idVector)?Number(this.idVector.getValue(o)):this.idVector.getValue(o));const d={coordinates:r[o],type:this.geometryVector.geometryType(o)},f={};for(const _ of this.propertyVectors){if(!_)continue;const w=_.name,E=_.getValue(o);E!==null&&(f[w]=E)}e.push({id:u,geometry:d,properties:f})}return e}containsMaxSaveIntegerValues(e){return e instanceof um||e instanceof dm&&e instanceof pm||e instanceof hm}}class Xw{constructor(e){kt(this,"value");this.value=e}get(){return this.value}set(e){this.value=e}increment(){return this.value++}add(e){this.value+=e}}var Zt,ao,Ln,ra,Hs,_i,wn,Tn,k_,ki;function Cn(n,e,r){const o=new Int32Array(r);let u=0,d=e.get();for(let f=0;f<o.length;f++){let _=n[d++],w=127&_;_<128||(_=n[d++],w|=(127&_)<<7,_<128||(_=n[d++],w|=(127&_)<<14,_<128||(_=n[d++],w|=(127&_)<<21,_<128||(_=n[d++],w|=(15&_)<<28)))),o[u++]=w}return e.set(d),o}function ed(n,e,r){const o=new BigInt64Array(r);for(let u=0;u<o.length;u++)o[u]=Kw(n,e);return o}function Yw(n,e){let r,o;return o=n[e.get()],e.increment(),r=127&o,o<128?r:(o=n[e.get()],e.increment(),r|=(127&o)<<7,o<128?r:(o=n[e.get()],e.increment(),r|=(127&o)<<14,o<128?r:(o=n[e.get()],e.increment(),r|=(127&o)<<21,o<128?r:(o=n[e.get()],r|=(15&o)<<28,(function(u,d,f){let _,w;if(w=d[f.get()],f.increment(),_=(112&w)>>4,w<128||(w=d[f.get()],f.increment(),_|=(127&w)<<3,w<128)||(w=d[f.get()],f.increment(),_|=(127&w)<<10,w<128)||(w=d[f.get()],f.increment(),_|=(127&w)<<17,w<128)||(w=d[f.get()],f.increment(),_|=(127&w)<<24,w<128)||(w=d[f.get()],f.increment(),_|=(1&w)<<31,w<128))return 4294967296*_+(u>>>0);throw new Error("Expected varint not more than 10 bytes")})(r,n,e)))))}function D_(n,e,r,o){throw new Error("FastPFor is not implemented yet.")}function Xs(n){return n>>>1^-(1&n)}function mc(n){return n>>1n^-(1n&n)}function Kw(n,e){let r=0n,o=0,u=e.get();for(;u<n.length;){const d=n[u++];if(r|=BigInt(127&d)<<BigInt(o),!(128&d))break;if(o+=7,o>=64)throw new Error("Varint too long")}return e.set(u),r}function L_(n,e,r){const o=new Int32Array(r);let u=0;for(let d=0;d<e;d++){const f=n[d];o.fill(n[d+e],u,u+f),u+=f}return o}function R_(n,e,r){const o=new BigInt64Array(r);let u=0;for(let d=0;d<e;d++){const f=Number(n[d]);o.fill(n[d+e],u,u+f),u+=f}return o}function z_(n,e,r){const o=new Float64Array(r);let u=0;for(let d=0;d<e;d++){const f=n[d];o.fill(n[d+e],u,u+f),u+=f}return o}function fm(n){const e=n.length/4*4;let r=1;if(e>=4)for(let o=n[0];r<e-4;r+=4)o=n[r]+=o,o=n[r+1]+=o,o=n[r+2]+=o,o=n[r+3]+=o;for(;r!=n.length;)n[r]+=n[r-1],++r}function F_(n){n[0]=n[0]>>>1^-(1&n[0]),n[1]=n[1]>>>1^-(1&n[1]);const e=n.length/4*4;let r=2;if(e>=4)for(;r<e-4;r+=4){const o=n[r],u=n[r+1],d=n[r+2],f=n[r+3];n[r]=(o>>>1^-(1&o))+n[r-2],n[r+1]=(u>>>1^-(1&u))+n[r-1],n[r+2]=(d>>>1^-(1&d))+n[r],n[r+3]=(f>>>1^-(1&f))+n[r+1]}for(;r!=n.length;r+=2)n[r]=(n[r]>>>1^-(1&n[r]))+n[r-2],n[r+1]=(n[r+1]>>>1^-(1&n[r+1]))+n[r-1]}
5(function(n){n.NONE="NONE",n.DELTA="DELTA",n.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",n.RLE="RLE",n.MORTON="MORTON",n.PDE="PDE"})(Zt||(Zt={})),(function(n){n.NONE="NONE",n.FAST_PFOR="FAST_PFOR",n.VARINT="VARINT",n.ALP="ALP"})(ao||(ao={})),(function(n){n.PRESENT="PRESENT",n.DATA="DATA",n.OFFSET="OFFSET",n.LENGTH="LENGTH"})(Ln||(Ln={}));class mm{constructor(e,r,o){kt(this,"_dictionaryType");kt(this,"_offsetType");kt(this,"_lengthType");this._dictionaryType=e,this._offsetType=r,this._lengthType=o}get dictionaryType(){return this._dictionaryType}get offsetType(){return this._offsetType}get lengthType(){return this._lengthType}}function Jn(n,e){const r=(function(o,u){const d=o[u.get()],f=Object.values(Ln)[d>>4];let _=null;switch(f){case Ln.DATA:_=new mm(Object.values(ra)[15&d]);break;case Ln.OFFSET:_=new mm(null,Object.values(Hs)[15&d]);break;case Ln.LENGTH:_=new mm(null,null,Object.values(_i)[15&d])}u.increment();const w=o[u.get()],E=Object.values(Zt)[w>>5],M=Object.values(Zt)[w>>2&7],C=Object.values(ao)[3&w];u.increment();const D=Cn(o,u,2),R=D[0];return{physicalStreamType:f,logicalStreamType:_,logicalLevelTechnique1:E,logicalLevelTechnique2:M,physicalLevelTechnique:C,numValues:R,byteLength:D[1],decompressedCount:R}})(n,e);return r.logicalLevelTechnique1===Zt.MORTON?(function(o,u,d){const f=Cn(u,d,2);return{physicalStreamType:o.physicalStreamType,logicalStreamType:o.logicalStreamType,logicalLevelTechnique1:o.logicalLevelTechnique1,logicalLevelTechnique2:o.logicalLevelTechnique2,physicalLevelTechnique:o.physicalLevelTechnique,numValues:o.numValues,byteLength:o.byteLength,decompressedCount:o.decompressedCount,numBits:f[0],coordinateShift:f[1]}})(r,n,e):Zt.RLE!==r.logicalLevelTechnique1&&Zt.RLE!==r.logicalLevelTechnique2||ao.NONE===r.physicalLevelTechnique?r:(function(o,u,d){const f=Cn(u,d,2);return{physicalStreamType:o.physicalStreamType,logicalStreamType:o.logicalStreamType,logicalLevelTechnique1:o.logicalLevelTechnique1,logicalLevelTechnique2:o.logicalLevelTechnique2,physicalLevelTechnique:o.physicalLevelTechnique,numValues:o.numValues,byteLength:o.byteLength,decompressedCount:f[1],runs:f[0],numRleValues:f[1]}})(r,n,e)}
vendor: 6,955 bytes, line 5
5(function(n){n.NONE="NONE",n.SINGLE="SINGLE",n.SHARED="SHARED",n.VERTEX="VERTEX",n.MORTON="MORTON",n.FSST="FSST"})(ra||(ra={})),(function(n){n.VERTEX="VERTEX",n.INDEX="INDEX",n.STRING="STRING",n.KEY="KEY"})(Hs||(Hs={})),(function(n){n.VAR_BINARY="VAR_BINARY",n.GEOMETRIES="GEOMETRIES",n.PARTS="PARTS",n.RINGS="RINGS",n.TRIANGLES="TRIANGLES",n.SYMBOL="SYMBOL",n.DICTIONARY="DICTIONARY"})(_i||(_i={})),(function(n){n[n.FLAT=0]="FLAT",n[n.CONST=1]="CONST",n[n.SEQUENCE=2]="SEQUENCE",n[n.DICTIONARY=3]="DICTIONARY",n[n.FSST_DICTIONARY=4]="FSST_DICTIONARY"})(wn||(wn={}));class na{constructor(e,r){kt(this,"values");kt(this,"_size");this.values=e,this._size=r}get(e){const r=Math.floor(e/8);return(this.values[r]>>e%8&1)==1}set(e,r){const o=Math.floor(e/8);this.values[o]=this.values[o]|(r?1:0)<<e%8}getInt(e){const r=Math.floor(e/8);return this.values[r]>>e%8&1}size(){return this._size}getBuffer(){return this.values}}function Qn(n,e,r,o,u){return(function(d,f,_){switch(f.logicalLevelTechnique1){case Zt.DELTA:return f.logicalLevelTechnique2===Zt.RLE?(function(w,E,M){const C=new Int32Array(M);let D=0,R=0;for(let B=0;B<E;B++){const N=w[B],U=Xs(w[B+E]);for(let Z=0;Z<N;Z++)R+=U,C[D++]=R}return C})(d,f.runs,f.numRleValues):((function(w){w[0]=w[0]>>>1^-(1&w[0]);const E=w.length/4*4;let M=1;if(E>=4)for(;M<E-4;M+=4){const C=w[M],D=w[M+1],R=w[M+2],B=w[M+3];w[M]=(C>>>1^-(1&C))+w[M-1],w[M+1]=(D>>>1^-(1&D))+w[M],w[M+2]=(R>>>1^-(1&R))+w[M+1],w[M+3]=(B>>>1^-(1&B))+w[M+2]}for(;M!=w.length;++M)w[M]=(w[M]>>>1^-(1&w[M]))+w[M-1]})(d),d);case Zt.RLE:return(function(w,E,M){return M?(function(C,D,R){const B=new Int32Array(R);let N=0;for(let U=0;U<D;U++){const Z=C[U];let ae=C[U+D];ae=ae>>>1^-(1&ae),B.fill(ae,N,N+Z),N+=Z}return B})(w,E.runs,E.numRleValues):L_(w,E.runs,E.numRleValues)})(d,f,_);case Zt.MORTON:return fm(d),d;case Zt.COMPONENTWISE_DELTA:return F_(d),d;case Zt.NONE:return _&&(function(w){for(let E=0;E<w.length;E++){const M=w[E];w[E]=M>>>1^-(1&M)}})(d),d;default:throw new Error(`The specified Logical level technique is not supported: ${f.logicalLevelTechnique1}`)}})(td(n,e,r),r,o)}function qo(n,e,r){return(function(o,u){if(u.logicalLevelTechnique1===Zt.DELTA&&u.logicalLevelTechnique2===Zt.NONE)return(function(f){const _=new Int32Array(f.length+1);_[0]=0,_[1]=Xs(f[0]);let w=_[1],E=2;for(;E!=_.length;++E){const M=f[E-1];w+=M>>>1^-(1&M),_[E]=_[E-1]+w}return _})(o);if(u.logicalLevelTechnique1===Zt.RLE&&u.logicalLevelTechnique2===Zt.NONE)return(function(f,_,w){const E=new Int32Array(w+1);E[0]=0;let M=1,C=E[0];for(let D=0;D<_;D++){const R=f[D],B=f[D+_];for(let N=M;N<M+R;N++)E[N]=B+C,C=E[N];M+=R}return E})(o,u.runs,u.numRleValues);if(u.logicalLevelTechnique1===Zt.NONE&&u.logicalLevelTechnique2===Zt.NONE){(function(f){let _=0;for(let w=0;w<f.length;w++)f[w]+=_,_=f[w]})(o);const d=new Int32Array(u.numValues+1);return d[0]=0,d.set(o,1),d}if(u.logicalLevelTechnique1===Zt.DELTA&&u.logicalLevelTechnique2===Zt.RLE){const d=(function(f,_,w){const E=new Int32Array(w+1);E[0]=0;let M=1,C=E[0];for(let D=0;D<_;D++){const R=f[D];let B=f[D+_];B=B>>>1^-(1&B);for(let N=M;N<M+R;N++)E[N]=B+C,C=E[N];M+=R}return E})(o,u.runs,u.numRleValues);return fm(d),d}throw new Error("Only delta encoding is supported for transforming length to offset streams yet.")})(td(n,e,r),r)}function td(n,e,r){const o=r.physicalLevelTechnique;if(o===ao.FAST_PFOR)return D_();if(o===ao.VARINT)return Cn(n,e,r.numValues);if(o===ao.NONE){const u=e.get();e.add(r.byteLength);const d=n.subarray(u,e.get());return new Int32Array(d)}throw new Error("Specified physicalLevelTechnique is not supported (yet).")}function gm(n,e,r,o){const u=td(n,e,r);if(u.length===1){const d=u[0];return o?Xs(d):d}return o?(function(d){return Xs(d[1])})(u):(function(d){return d[1]})(u)}function O_(n,e,r){return(function(o){if(o.length==2){const u=Xs(o[1]);return[u,u]}return[Xs(o[2]),Xs(o[3])]})(td(n,e,r))}function B_(n,e,r){return(function(o){if(o.length==2){const u=mc(o[1]);return[u,u]}return[mc(o[2]),mc(o[3])]})(ed(n,e,r.numValues))}function N_(n,e,r,o){return(function(u,d,f){switch(d.logicalLevelTechnique1){case Zt.DELTA:return d.logicalLevelTechnique2===Zt.RLE?(function(_,w,E){const M=new BigInt64Array(E);let C=0,D=0n;for(let R=0;R<w;R++){const B=Number(_[R]),N=mc(_[R+w]);for(let U=0;U<B;U++)D+=N,M[C++]=D}return M})(u,d.runs,d.numRleValues):((function(_){_[0]=_[0]>>1n^-(1n&_[0]);const w=_.length/4*4;let E=1;if(w>=4)for(;E<w-4;E+=4){const M=_[E],C=_[E+1],D=_[E+2],R=_[E+3];_[E]=(M>>1n^-(1n&M))+_[E-1],_[E+1]=(C>>1n^-(1n&C))+_[E],_[E+2]=(D>>1n^-(1n&D))+_[E+1],_[E+3]=(R>>1n^-(1n&R))+_[E+2]}for(;E!=_.length;++E)_[E]=(_[E]>>1n^-(1n&_[E]))+_[E-1]})(u),u);case Zt.RLE:return(function(_,w,E){return E?(function(M,C,D){const R=new BigInt64Array(D);let B=0;for(let N=0;N<C;N++){const U=Number(M[N]);let Z=M[N+C];Z=Z>>1n^-(1n&Z),R.fill(Z,B,B+U),B+=U}return R})(_,w.runs,w.numRleValues):R_(_,w.runs,w.numRleValues)})(u,d,f);case Zt.NONE:return f&&(function(_){for(let w=0;w<_.length;w++){const E=_[w];_[w]=E>>1n^-(1n&E)}})(u),u;default:throw new Error(`The specified Logical level technique is not supported: ${d.logicalLevelTechnique1}`)}})(ed(n,e,r.numValues),r,o)}function j_(n,e,r,o){const u=ed(n,e,r.numValues);if(u.length===1){const d=u[0];return o?mc(d):d}return o?(function(d){return mc(d[1])})(u):(function(d){return d[1]})(u)}function ym(n,e,r,o,u){return(function(d,f,_,w){switch(f.logicalLevelTechnique1){case Zt.DELTA:return f.logicalLevelTechnique2===Zt.RLE&&(d=L_(d,f.runs,f.numRleValues)),(function(E,M){const C=new Int32Array(E.size());let D=0;E.get(0)?(C[0]=E.get(0)?M[0]>>>1^-(1&M[0]):0,D=1):C[0]=0;let R=1;for(;R!=C.length;++R)C[R]=E.get(R)?C[R-1]+(M[D]>>>1^-(1&M[D++])):C[R-1];return C})(w,d);case Zt.RLE:return(function(E,M,C,D){const R=M;return C?(function(B,N,U){const Z=new Int32Array(B.size());let ae=0;for(let W=0;W<U;W++){const X=N[W];let le=N[W+U];le=le>>>1^-(1&le);for(let pe=ae;pe<ae+X;pe++)B.get(pe)?Z[pe]=le:(Z[pe]=0,ae++);ae+=X}return Z})(D,E,R.runs):(function(B,N,U){const Z=new Int32Array(B.size());let ae=0;for(let W=0;W<U;W++){const X=N[W],le=N[W+U];for(let pe=ae;pe<ae+X;pe++)B.get(pe)?Z[pe]=le:(Z[pe]=0,ae++);ae+=X}return Z})(D,E,R.runs)})(d,f,_,w);case Zt.MORTON:return fm(d),d;case Zt.COMPONENTWISE_DELTA:return F_(d),d;case Zt.NONE:return d=_?(function(E,M){const C=new Int32Array(E.size());let D=0,R=0;for(;R!=C.length;++R)if(E.get(R)){const B=M[D++];C[R]=B>>>1^-(1&B)}else C[R]=0;return C})(w,d):(function(E,M){const C=new Int32Array(E.size());let D=0,R=0;for(;R!=C.length;++R)C[R]=E.get(R)?M[D++]:0;return C})(w,d),d;default:throw new Error("The specified Logical level technique is not supported")}})(r.physicalLevelTechnique===ao.FAST_PFOR?D_():Cn(n,e,r.numValues),r,o,u)}function rd(n,e,r,o){const u=n.logicalLevelTechnique1;if(u===Zt.RLE)return n.runs===1?wn.CONST:wn.FLAT;const d=e instanceof na?e.size():e;if(u===Zt.DELTA&&n.logicalLevelTechnique2===Zt.RLE){const f=n.runs,_=2;if(n.numRleValues!==d)return wn.FLAT;if(f===1)return wn.SEQUENCE;
5if(f===2){const w=o.get();let E;if(n.physicalLevelTechnique===ao.VARINT)E=Cn(r,o,4);else{const M=o.get();E=new Int32Array(r.buffer,r.byteOffset+M,4)}if(o.set(w),E[2]===_&&E[3]===_)return wn.SEQUENCE}}return n.numValues===1?wn.CONST:wn.FLAT}class V_ extends Qp{getValueFromBuffer(e){return this.dataBuffer[e]}}class U_ extends C_{constructor(e,r,o,u){super(e,BigInt64Array.of(r),o,u)}getValueFromBuffer(e){return this.dataBuffer[0]+BigInt(e)*this.delta}}class gc{constructor(e,r,o){kt(this,"_geometryOffsets");kt(this,"_partOffsets");kt(this,"_ringOffsets");this._geometryOffsets=e,this._partOffsets=r,this._ringOffsets=o}get geometryOffsets(){return this._geometryOffsets}get partOffsets(){return this._partOffsets}get ringOffsets(){return this._ringOffsets}}function _m(n,e,r){return{x:$_(n,e)-r,y:$_(n>>1,e)-r}}function $_(n,e){let r=0;for(let o=0;o<e;o++)r|=(n&1<<2*o)>>o;return r}(function(n){n[n.POINT=0]="POINT",n[n.LINESTRING=1]="LINESTRING",n[n.POLYGON=2]="POLYGON",n[n.MULTIPOINT=3]="MULTIPOINT",n[n.MULTILINESTRING=4]="MULTILINESTRING",n[n.MULTIPOLYGON=5]="MULTIPOLYGON"})(Tn||(Tn={})),(function(n){n[n.POINT=0]="POINT",n[n.LINESTRING=1]="LINESTRING",n[n.POLYGON=2]="POLYGON"})(k_||(k_={})),(function(n){n[n.MORTON=0]="MORTON",n[n.VEC_2=1]="VEC_2",n[n.VEC_3=2]="VEC_3"})(ki||(ki={}));class Jw{createPoint(e){return[[e]]}createMultiPoint(e){return e.map((r=>[r]))}createLineString(e){return[e]}createMultiLineString(e){return e}createPolygon(e,r){return[e].concat(r)}createMultiPolygon(e){return e.flat()}}function q_(n){const e=new Array(n.numGeometries);let r=1,o=1,u=1,d=0;const f=new Jw;let _=0,w=0;const E=n.mortonSettings,M=n.topologyVector,C=M.geometryOffsets,D=M.partOffsets,R=M.ringOffsets,B=n.vertexOffsets,N=n.containsPolygonGeometry(),U=n.vertexBuffer;for(let Z=0;Z<n.numGeometries;Z++){const ae=n.geometryType(Z);if(ae===Tn.POINT){if(B&&B.length!==0)if(n.vertexBufferType===ki.VEC_2){const W=2*B[w++],X=new I(U[W],U[W+1]);e[d++]=f.createPoint(X)}else{const W=_m(U[B[w++]],E.numBits,E.coordinateShift),X=new I(W.x,W.y);e[d++]=f.createPoint(X)}else{const W=new I(U[_++],U[_++]);e[d++]=f.createPoint(W)}C&&u++,D&&r++,R&&o++}else if(ae===Tn.MULTIPOINT){const W=C[u]-C[u-1];u++;const X=new Array(W);if(B&&B.length!==0){for(let le=0;le<W;le++){const pe=2*B[w++];X[le]=new I(U[pe],U[pe+1])}e[d++]=f.createMultiPoint(X)}else{for(let le=0;le<W;le++){const pe=U[_++],Me=U[_++];X[le]=new I(pe,Me)}e[d++]=f.createMultiPoint(X)}}else if(ae===Tn.LINESTRING){let W,X=0;N?(X=R[o]-R[o-1],o++):X=D[r]-D[r-1],r++,B&&B.length!==0?(W=n.vertexBufferType===ki.VEC_2?xm(U,B,w,X,!1):bm(U,B,w,X,!1,E),w+=X):(W=vm(U,_,X,!1),_+=2*X),e[d++]=f.createLineString(W),C&&u++}else if(ae===Tn.POLYGON){const W=D[r]-D[r-1];r++;const X=new Array(W-1);let le=R[o]-R[o-1];if(o++,B&&B.length!==0){const pe=n.vertexBufferType===ki.VEC_2?id(U,B,w,le):ad(U,B,w,le,0,E);w+=le;for(let Me=0;Me<X.length;Me++)le=R[o]-R[o-1],o++,X[Me]=n.vertexBufferType===ki.VEC_2?id(U,B,w,le):ad(U,B,w,le,0,E),w+=le;e[d++]=f.createPolygon(pe,X)}else{const pe=nd(U,_,le);_+=2*le;for(let Me=0;Me<X.length;Me++)le=R[o]-R[o-1],o++,X[Me]=nd(U,_,le),_+=2*le;e[d++]=f.createPolygon(pe,X)}C&&u++}else if(ae===Tn.MULTILINESTRING){const W=C[u]-C[u-1];u++;const X=new Array(W);if(B&&B.length!==0){for(let le=0;le<W;le++){let pe=0;N?(pe=R[o]-R[o-1],o++):pe=D[r]-D[r-1],r++;const Me=n.vertexBufferType===ki.VEC_2?xm(U,B,w,pe,!1):bm(U,B,w,pe,!1,E);X[le]=Me,w+=pe}e[d++]=f.createMultiLineString(X)}else{for(let le=0;le<W;le++){let pe=0;N?(pe=R[o]-R[o-1],o++):pe=D[r]-D[r-1],r++,X[le]=vm(U,_,pe,!1),_+=2*pe}e[d++]=f.createMultiLineString(X)}}else{if(ae!==Tn.MULTIPOLYGON)throw new Error("The specified geometry type is currently not supported.");{const W=C[u]-C[u-1];u++;const X=new Array(W);let le=0;if(B&&B.length!==0){for(let pe=0;pe<W;pe++){const Me=D[r]-D[r-1];r++;const Ue=new Array(Me-1);le=R[o]-R[o-1],o++;const Oe=n.vertexBufferType===ki.VEC_2?id(U,B,w,le):ad(U,B,w,le,0,E);w+=le;for(let $e=0;$e<Ue.length;$e++)le=R[o]-R[o-1],o++,Ue[$e]=n.vertexBufferType===ki.VEC_2?id(U,B,w,le):ad(U,B,w,le,0,E),w+=le;X[pe]=f.createPolygon(Oe,Ue)}e[d++]=f.createMultiPolygon(X)}else{for(let pe=0;pe<W;pe++){const Me=D[r]-D[r-1];r++;const Ue=new Array(Me-1);le=R[o]-R[o-1],o++;const Oe=nd(U,_,le);_+=2*le;for(let $e=0;$e<Ue.length;$e++){const Qe=R[o]-R[o-1];o++,Ue[$e]=nd(U,_,Qe),_+=2*Qe}X[pe]=f.createPolygon(Oe,Ue)}e[d++]=f.createMultiPolygon(X)}}}}return e}
5function nd(n,e,r){return vm(n,e,r,!0)}function id(n,e,r,o){return xm(n,e,r,o,!0)}function ad(n,e,r,o,u,d){return bm(n,e,r,o,!0,d)}function vm(n,e,r,o){const u=new Array(o?r+1:r);for(let d=0;d<2*r;d+=2)u[d/2]=new I(n[e+d],n[e+d+1]);return o&&(u[u.length-1]=u[0]),u}function xm(n,e,r,o,u){const d=new Array(u?o+1:o);for(let f=0;f<2*o;f+=2){const _=2*e[r+f/2];d[f/2]=new I(n[_],n[_+1])}return u&&(d[d.length-1]=d[0]),d}function bm(n,e,r,o,u,d){const f=new Array(u?o+1:o);for(let _=0;_<o;_++){const w=_m(n[e[r+_]],d.numBits,d.coordinateShift);f[_]=new I(w.x,w.y)}return u&&(f[f.length-1]=f[0]),f}class G_{constructor(e,r,o,u,d){kt(this,"_vertexBufferType");kt(this,"_topologyVector");kt(this,"_vertexOffsets");kt(this,"_vertexBuffer");kt(this,"_mortonSettings");this._vertexBufferType=e,this._topologyVector=r,this._vertexOffsets=o,this._vertexBuffer=u,this._mortonSettings=d}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}*[Symbol.iterator](){const e=q_(this);let r=0;for(;r<this.numGeometries;)yield{coordinates:e[r],type:this.geometryType(r)},r++}getSimpleEncodedVertex(e){const r=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[r],this.vertexBuffer[r+1]]}getVertex(e){if(this.vertexOffsets&&this.mortonSettings){const o=_m(this.vertexBuffer[this.vertexOffsets[e]],this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[o.x,o.y]}const r=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[r],this.vertexBuffer[r+1]]}getGeometries(){return q_(this)}get mortonSettings(){return this._mortonSettings}}class Z_ extends G_{constructor(r,o,u,d,f,_,w){super(u,d,f,_,w);kt(this,"_numGeometries");kt(this,"_geometryType");this._numGeometries=r,this._geometryType=o}geometryType(r){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===Tn.POLYGON||this._geometryType===Tn.MULTIPOLYGON}containsSingleGeometryType(){return!0}}class W_ extends G_{constructor(r,o,u,d,f,_){super(r,u,d,f,_);kt(this,"_geometryTypes");this._geometryTypes=o}geometryType(r){return this._geometryTypes[r]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let r=0;r<this.numGeometries;r++)if(this.geometryType(r)===Tn.POLYGON||this.geometryType(r)===Tn.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}}class H_{constructor(e,r,o,u){kt(this,"_triangleOffsets");kt(this,"_indexBuffer");kt(this,"_vertexBuffer");kt(this,"_topologyVector");this._triangleOffsets=e,this._indexBuffer=r,this._vertexBuffer=o,this._topologyVector=u}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw new Error("Cannot convert GpuVector to coordinates without topology information");const e=new Array(this.numGeometries),r=this._topologyVector,o=r.partOffsets,u=r.ringOffsets,d=r.geometryOffsets;let f=0,_=1,w=1,E=1;for(let M=0;M<this.numGeometries;M++)switch(this.geometryType(M)){case Tn.POLYGON:{const C=o[_]-o[_-1];_++;const D=[];for(let R=0;R<C;R++){const B=u[w]-u[w-1];w++;const N=[];for(let U=0;U<B;U++){const Z=this._vertexBuffer[f++],ae=this._vertexBuffer[f++];N.push(new I(Z,ae))}N.length>0&&N.push(N[0]),D.push(N)}e[M]=D,d&&E++}break;case Tn.MULTIPOLYGON:{const C=d[E]-d[E-1];E++;const D=[];for(let R=0;R<C;R++){const B=o[_]-o[_-1];_++;for(let N=0;N<B;N++){const U=u[w]-u[w-1];w++;const Z=[];for(let ae=0;ae<U;ae++){const W=this._vertexBuffer[f++],X=this._vertexBuffer[f++];Z.push(new I(W,X))}Z.length>0&&Z.push(Z[0]),D.push(Z)}}e[M]=D}}return e}[Symbol.iterator](){return null}}function X_(n,e,r,o,u,d){return new Qw(n,e,r,o,u,d)}class Qw extends H_{constructor(r,o,u,d,f,_){super(u,d,f,_);kt(this,"_numGeometries");kt(this,"_geometryType");this._numGeometries=r,this._geometryType=o}geometryType(r){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}}function Y_(n,e,r,o,u){return new e2(n,e,r,o,u)}class e2 extends H_{constructor(r,o,u,d,f){super(o,u,d,f);kt(this,"_geometryTypes");this._geometryTypes=r}geometryType(r){return this._geometryTypes[r]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}}function t2(n,e,r,o,u){const d=Jn(n,r);let f=null,_=null,w=null,E=null,M=null,C=null,D=null,R=null;if(rd(d,o,n,r)===wn.CONST){const N=gm(n,r,d,!1);for(let U=0;U<e-1;U++){const Z=Jn(n,r);switch(Z.physicalStreamType){case Ln.LENGTH:switch(Z.logicalStreamType.lengthType){case _i.GEOMETRIES:f=qo(n,r,Z);break;case _i.PARTS:_=qo(n,r,Z);break;case _i.RINGS:w=qo(n,r,Z);break;case _i.TRIANGLES:D=qo(n,r,Z)}break;case Ln.OFFSET:switch(Z.logicalStreamType.offsetType){case Hs.VERTEX:E=Qn(n,r,Z,!1);break;case Hs.INDEX:R=Qn(n,r,Z,!1)}break;case Ln.DATA:ra.VERTEX===Z.logicalStreamType.dictionaryType?M=Qn(n,r,Z,!0):(C={numBits:Z.numBits,coordinateShift:Z.coordinateShift},M=Qn(n,r,Z,!1))}}return R!==null?f!=null||_!=null?X_(o,N,D,R,M,new gc(f,_,w)):X_(o,N,D,R,M):C===null?(function(U,Z,ae,W,X){return new Z_(U,Z,ki.VEC_2,ae,W,X)})(o,N,new gc(f,_,w),E,M):(function(U,Z,ae,W,X,le){return new Z_(U,Z,ki.MORTON,ae,W,X,le)})(o,N,new gc(f,_,w),E,M,C)}const B=Qn(n,r,d,!1);for(let N=0;N<e-1;N++){const U=Jn(n,r);switch(U.physicalStreamType){case Ln.LENGTH:switch(U.logicalStreamType.lengthType){case _i.GEOMETRIES:f=Qn(n,r,U,!1);break;case _i.PARTS:_=Qn(n,r,U,!1);break;case _i.RINGS:w=Qn(n,r,U,!1);break;case _i.TRIANGLES:D=qo(n,r,U)}break;case Ln.OFFSET:switch(U.logicalStreamType.offsetType){case Hs.VERTEX:E=Qn(n,r,U,!1);break;case Hs.INDEX:R=Qn(n,r,U,!1)}break;case Ln.DATA:ra.VERTEX===U.logicalStreamType.dictionaryType?M=Qn(n,r,U,!0):(C={numBits:U.numBits,coordinateShift:U.coordinateShift},M=Qn(n,r,U,!1))}}return R!==null&&_===null?Y_(B,D,R,M):(f!==null?(f=wm(B,f,2),_!==null&&w!==null?(_=K_(B,f,_,!1),w=(function(N,U,Z,ae){const W=new Int32Array(Z[Z.length-1]+1);let X=0;W[0]=X;let le=1,pe=1,Me=0;for(let Ue=0;Ue<N.length;Ue++){const Oe=N[Ue],$e=U[Ue+1]-U[Ue];if(Oe!==0&&Oe!==3)for(let Qe=0;Qe<$e;Qe++){const Ge=Z[le]-Z[le-1];le++;for(let Ne=0;Ne<Ge;Ne++)X=W[pe++]=X+ae[Me++]}else for(let Qe=0;Qe<$e;Qe++)W[pe++]=++X,le++}return W})(B,f,_,w)):_!==null&&(_=(function(N,U,Z){const ae=new Int32Array(U[U.length-1]+1);let W=0;ae[0]=W;let X=1,le=0;for(let pe=0;pe<N.length;pe++){const Me=N[pe],Ue=U[pe+1]-U[pe];if(Me===4||Me===1)for(let Oe=0;Oe<Ue;Oe++)W=ae[X++]=W+Z[le++];else for(let Oe=0;Oe<Ue;Oe++)ae[X++]=++W}return ae})(B,f,_))):_!==null&&w!==null?(_=wm(B,_,1),w=K_(B,_,w,!0)):_!==null&&(_=wm(B,_,0)),R!==null?Y_(B,D,R,M,new gc(f,_,w)):C===null?(function(N,U,Z,ae){return new W_(ki.VEC_2,N,U,Z,ae)})(B,new gc(f,_,w),E,M):(function(N,U,Z,ae,W){return new W_(ki.MORTON,N,U,Z,ae,W)})(B,new gc(f,_,w),E,M,C))}function wm(n,e,r){const o=new Int32Array(n.length+1);let u=0;o[0]=u;let d=0;for(let f=0;f<n.length;f++)u=o[f+1]=u+(n[f]>r?e[d++]:1);return o}function K_(n,e,r,o){const u=new Int32Array(e[e.length-1]+1);let d=0;u[0]=d;let f=1,_=0;for(let w=0;w<n.length;w++){const E=n[w],M=e[w+1]-e[w];if(E===5||E===2||o&&(E===4||E===1))for(let C=0;C<M;C++)d=u[f++]=d+r[_++];else for(let C=0;C<M;C++)u[f++]=++d}return u}class r2 extends fc{constructor(r,o,u){super(r,o.getBuffer(),u);kt(this,"dataVector");this.dataVector=o}getValueFromBuffer(r){return this.dataVector.get(r)}}class n2 extends Qp{getValueFromBuffer(e){return this.dataBuffer[e]}}class J_ extends fc{constructor(e,r,o){super(e,BigInt64Array.of(r),o)}getValueFromBuffer(e){return this.dataBuffer[0]}}function Ju(n,e,r){return Q_(n,Math.ceil(e/8),r)}function Q_(n,e,r){const o=new Uint8Array(e);let u=0;for(;u<e;){const d=n[r.increment()];if(d<=127){const f=d+3,_=n[r.increment()],w=u+f;o.fill(_,u,w),u=w}else{const f=256-d;for(let _=0;_<f;_++)o[u++]=n[r.increment()]}}return o}
vendor: 5,951 bytes, line 5
5const i2=new TextDecoder;function Tm(n,e,r){return r-e>=12?i2.decode(n.subarray(e,r)):(function(o,u,d){let f="",_=u;for(;_<d;){const w=o[_];let E,M,C,D=null,R=w>239?4:w>223?3:w>191?2:1;if(_+R>d)break;R===1?w<128&&(D=w):R===2?(E=o[_+1],(192&E)==128&&(D=(31&w)<<6|63&E,D<=127&&(D=null))):R===3?(E=o[_+1],M=o[_+2],(192&E)==128&&(192&M)==128&&(D=(15&w)<<12|(63&E)<<6|63&M,(D<=2047||D>=55296&&D<=57343)&&(D=null))):R===4&&(E=o[_+1],M=o[_+2],C=o[_+3],(192&E)==128&&(192&M)==128&&(192&C)==128&&(D=(15&w)<<18|(63&E)<<12|(63&M)<<6|63&C,(D<=65535||D>=1114112)&&(D=null))),D===null?(D=65533,R=1):D>65535&&(D-=65536,f+=String.fromCharCode(D>>>10&1023|55296),D=56320|1023&D),f+=String.fromCharCode(D),_+=R}return f})(n,e,r)}class Sm extends fc{constructor(r,o,u,d){super(r,u,d);kt(this,"offsetBuffer");this.offsetBuffer=o}}class e0 extends Sm{constructor(r,o,u,d){super(r,o,u,d??o.length-1);kt(this,"textEncoder");this.textEncoder=new TextEncoder}getValueFromBuffer(r){return Tm(this.dataBuffer,this.offsetBuffer[r],this.offsetBuffer[r+1])}}class yc extends Sm{constructor(r,o,u,d,f){super(r,u,d,f??o.length);kt(this,"indexBuffer");kt(this,"textEncoder");this.indexBuffer=o,this.indexBuffer=o,this.textEncoder=new TextEncoder}getValueFromBuffer(r){const o=this.indexBuffer[r];return Tm(this.dataBuffer,this.offsetBuffer[o],this.offsetBuffer[o+1])}}class t0 extends Sm{constructor(r,o,u,d,f,_,w){super(r,u,d,w);kt(this,"indexBuffer");kt(this,"symbolOffsetBuffer");kt(this,"symbolTableBuffer");kt(this,"textEncoder");kt(this,"symbolLengthBuffer");kt(this,"lengthBuffer");kt(this,"decodedDictionary");this.indexBuffer=o,this.symbolOffsetBuffer=f,this.symbolTableBuffer=_,this.textEncoder=new TextEncoder}getValueFromBuffer(r){this.decodedDictionary==null&&(this.symbolLengthBuffer==null&&(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer),this.lengthBuffer=this.offsetToLengthBuffer(this.offsetBuffer)),this.decodedDictionary=(function(u,d,f){const _=[],w=new Array(d.length).fill(0);for(let E=1;E<d.length;E++)w[E]=w[E-1]+d[E-1];for(let E=0;E<f.length;E++)if(f[E]===255)_.push(f[++E]);else{const M=d[f[E]],C=w[f[E]];for(let D=0;D<M;D++)_.push(u[C+D])}return new Uint8Array(_)})(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer));const o=this.indexBuffer[r];return Tm(this.decodedDictionary,this.offsetBuffer[o],this.offsetBuffer[o+1])}offsetToLengthBuffer(r){const o=new Uint32Array(r.length-1);let u=r[0];for(let d=1;d<r.length;d++){const f=r[d];o[d-1]=f-u,u=f}return o}}function a2(n,e,r,o,u,d){return r.type==="scalarType"?(function(f,_,w,E,M,C){let D=null,R=0;if(f===0)return null;if(C.nullable){const N=Jn(_,w);R=N.numValues;const U=w.get(),Z=Ju(_,R,w);w.set(U+N.byteLength),D=new na(Z,N.numValues)}const B=D??E;switch(M.physicalType){case 4:case 3:return(function(N,U,Z,ae,W){const X=Jn(N,U),le=rd(X,W,N,U),pe=ae.physicalType===3;if(le===wn.FLAT){const Me=Qu(W)?ym(N,U,X,pe,W):Qn(N,U,X,pe);return new um(Z.name,Me,W)}if(le===wn.SEQUENCE){const Me=O_(N,U,X);return new pm(Z.name,Me[0],Me[1],X.numRleValues)}{const Me=gm(N,U,X,pe);return new dm(Z.name,Me,W)}})(_,w,C,M,B);case 9:return(function(N,U,Z,ae,W){let X=null,le=null,pe=null,Me=null,Ue=null,Oe=null,$e=null,Qe=null;for(let Ge=0;Ge<ae;Ge++){const Ne=Jn(U,Z);if(Ne.byteLength!==0)switch(Ne.physicalStreamType){case Ln.PRESENT:{const ze=Ju(U,Ne.numValues,Z);Oe=new na(ze,Ne.numValues);break}case Ln.OFFSET:le=W!=null||Oe!=null?ym(U,Z,Ne,!1,W??Oe):Qn(U,Z,Ne,!1);break;case Ln.LENGTH:{const ze=qo(U,Z,Ne);_i.DICTIONARY===Ne.logicalStreamType.lengthType?X=ze:_i.SYMBOL===Ne.logicalStreamType.lengthType?Me=ze:$e=ze;break}case Ln.DATA:{const ze=U.subarray(Z.get(),Z.get()+Ne.byteLength);Z.add(Ne.byteLength);const ut=Ne.logicalStreamType.dictionaryType;ra.FSST===ut?Ue=ze:ra.SINGLE===ut||ra.SHARED===ut?pe=ze:ra.NONE===ut&&(Qe=ze);break}}}return(function(Ge,Ne,ze,ut,st,dt,at){return Ne?new t0(Ge,ze,ut,st,dt,Ne,at):null})(N,Ue,le,X,pe,Me,W??Oe)??(function(Ge,Ne,ze,ut,st){return Ne?st?new yc(Ge,ze,ut,Ne,st):new yc(Ge,ze,ut,Ne):null})(N,pe,le,X,W??Oe)??(function(Ge,Ne,ze,ut,st){if(!Ne||!ze)return null;if(ut)return st?new yc(Ge,ut,Ne,ze,st):new yc(Ge,ut,Ne,ze);if(st&&st.size()!==Ne.length-1){const dt=new Int32Array(st.size());let at=0;for(let _t=0;_t<st.size();_t++)dt[_t]=st.get(_t)?at++:0;return new yc(Ge,dt,Ne,ze,st)}return st?new e0(Ge,Ne,ze,st):new e0(Ge,Ne,ze)})(N,$e,Qe,le,W??Oe)})(C.name,_,w,C.nullable?f-1:f,D);case 0:return(function(N,U,Z,ae,W){const X=Jn(N,U),le=X.numValues,pe=U.get(),Me=Qu(W)?(function(Oe,$e,Qe,Ge){const Ne=Q_(Oe,Math.ceil($e/8),Qe),ze=new na(Ne,$e),ut=Ge.size(),st=new na(new Uint8Array(ut),ut);let dt=0;for(let at=0;at<Ge.size();at++){const _t=!!Ge.get(at)&&ze.get(dt++);st.set(at,_t)}return st.getBuffer()})(N,le,U,W):Ju(N,le,U);U.set(pe+X.byteLength);const Ue=new na(Me,le);return new r2(Z.name,Ue,W)})(_,w,C,0,B);case 6:case 5:return(function(N,U,Z,ae,W){const X=Jn(N,U),le=rd(X,ae,N,U),pe=W.physicalType===5;if(le===wn.FLAT){const Me=Qu(ae)?(function(Ue,Oe,$e,Qe,Ge){return(function(Ne,ze,ut,st){switch(ze.logicalLevelTechnique1){case Zt.DELTA:return ze.logicalLevelTechnique2===Zt.RLE&&(Ne=R_(Ne,ze.runs,ze.numRleValues)),(function(dt,at){const _t=new BigInt64Array(dt.size());let nr=0;dt.get(0)?(_t[0]=dt.get(0)?at[0]>>1n^-(1n&at[0]):0n,nr=1):_t[0]=0n;let qt=1;for(;qt!=_t.length;++qt)_t[qt]=dt.get(qt)?_t[qt-1]+(at[nr]>>1n^-(1n&at[nr++])):_t[qt-1];return _t})(st,Ne);case Zt.RLE:return(function(dt,at,_t,nr){const qt=at;return _t?(function(kr,zn,un){const Dr=new BigInt64Array(kr.size());let Mr=0;for(let sr=0;sr<un;sr++){const Vr=Number(zn[sr]);let Xr=zn[sr+un];Xr=Xr>>1n^-(1n&Xr);for(let Sr=Mr;Sr<Mr+Vr;Sr++)kr.get(Sr)?Dr[Sr]=Xr:(Dr[Sr]=0n,Mr++);Mr+=Vr}return Dr})(nr,dt,qt.runs):(function(kr,zn,un){const Dr=new BigInt64Array(kr.size());let Mr=0;for(let sr=0;sr<un;sr++){const Vr=Number(zn[sr]),Xr=zn[sr+un];for(let Sr=Mr;Sr<Mr+Vr;Sr++)kr.get(Sr)?Dr[Sr]=Xr:(Dr[Sr]=0n,Mr++);Mr+=Vr}return Dr})(nr,dt,qt.runs)})(Ne,ze,ut,st);
5case Zt.NONE:return Ne=ut?(function(dt,at){const _t=new BigInt64Array(dt.size());let nr=0,qt=0;for(;qt!=_t.length;++qt)if(dt.get(qt)){const kr=at[nr++];_t[qt]=kr>>1n^-(1n&kr)}else _t[qt]=0n;return _t})(st,Ne):(function(dt,at){const _t=new BigInt64Array(dt.size());let nr=0,qt=0;for(;qt!=_t.length;++qt)_t[qt]=dt.get(qt)?at[nr++]:0n;return _t})(st,Ne),Ne;default:throw new Error("The specified Logical level technique is not supported")}})(ed(Ue,Oe,$e.numValues),$e,Qe,Ge)})(N,U,X,pe,ae):N_(N,U,X,pe);return new V_(Z.name,Me,ae)}if(le===wn.SEQUENCE){const Me=B_(N,U,X);return new U_(Z.name,Me[0],Me[1],X.numRleValues)}{const Me=j_(N,U,X,pe);return new J_(Z.name,Me,ae)}})(_,w,C,B,M);case 7:return(function(N,U,Z,ae){const W=Jn(N,U),X=Qu(ae)?(function(le,pe,Me,Ue){const Oe=pe.get(),$e=Oe+Ue*Float32Array.BYTES_PER_ELEMENT,Qe=new Uint8Array(le.subarray(Oe,$e)).buffer,Ge=new Float32Array(Qe);pe.set($e);const Ne=Me.size(),ze=new Float32Array(Ne);let ut=0;for(let st=0;st<Ne;st++)ze[st]=Me.get(st)?Ge[ut++]:0;return ze})(N,U,ae,W.numValues):(function(le,pe,Me){const Ue=pe.get(),Oe=Ue+Me*Float32Array.BYTES_PER_ELEMENT,$e=new Uint8Array(le.subarray(Ue,Oe)).buffer,Qe=new Float32Array($e);return pe.set(Oe),Qe})(N,U,W.numValues);return new n2(Z.name,X,ae)})(_,w,C,B);case 8:return(function(N,U,Z,ae){const W=Jn(N,U),X=Qu(ae)?(function(le,pe,Me,Ue){const Oe=pe.get(),$e=Oe+Ue*Float64Array.BYTES_PER_ELEMENT,Qe=new Uint8Array(le.subarray(Oe,$e)).buffer,Ge=new Float64Array(Qe);pe.set($e);const Ne=Me.size(),ze=new Float64Array(Ne);let ut=0;for(let st=0;st<Ne;st++)ze[st]=Me.get(st)?Ge[ut++]:0;return ze})(N,U,ae,W.numValues):(function(le,pe,Me){const Ue=pe.get(),Oe=Ue+Me*Float64Array.BYTES_PER_ELEMENT,$e=new Uint8Array(le.subarray(Ue,Oe)).buffer,Qe=new Float64Array($e);return pe.set(Oe),Qe})(N,U,W.numValues);return new hm(Z.name,X,ae)})(_,w,C,B);default:throw new Error(`The specified data type for the field is currently not supported: ${M}`)}})(o,n,e,u,r.scalarType,r):o!=1?null:(function(f,_,w,E){let M=null,C=null,D=null,R=null,B=!1;for(;!B;){const ae=Jn(f,_);switch(ae.physicalStreamType){case Ln.LENGTH:_i.DICTIONARY===ae.logicalStreamType.lengthType?M=qo(f,_,ae):D=qo(f,_,ae);break;case Ln.DATA:ra.SINGLE===ae.logicalStreamType.dictionaryType||ra.SHARED===ae.logicalStreamType.dictionaryType?(C=f.subarray(_.get(),_.get()+ae.byteLength),B=!0):R=f.subarray(_.get(),_.get()+ae.byteLength),_.add(ae.byteLength)}}const N=w.complexType.children,U=[];let Z=0;for(const ae of N){const W=Cn(f,_,1)[0];if(W==0)continue;const X=`${w.name}${ae.name==="default"?"":":"+ae.name}`;if(W!==2||ae.type!=="scalarField"||ae.scalarField.physicalType!==9)throw new Error("Currently only optional string fields are implemented for a struct.");const le=Jn(f,_),pe=Ju(f,le.numValues,_),Me=Jn(f,_),Ue=Me.decompressedCount!==E?ym(f,_,Me,!1,new na(pe,le.numValues)):Qn(f,_,Me,!1);U[Z++]=R?new t0(X,Ue,M,C,D,R,new na(pe,le.numValues)):new yc(X,Ue,M,C,new na(pe,le.numValues))}return U})(n,e,r,u)}function Qu(n){return n instanceof na}function o2(n){if(n.name==="id")return!1;if(n.type==="scalarType"){const e=n.scalarType;if(e.type==="physicalType")switch(e.physicalType){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:default:return!1;case 9:return!0}else if(e.type==="logicalType")return!1}else if(n.type==="complexType"){const e=n.complexType;if(e.type==="physicalType")switch(e.physicalType){case 0:case 1:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",n),!1}const s2=new TextDecoder;function r0(n,e){const r=Cn(n,e,1)[0];if(r===0)return"";const o=e.get(),u=n.subarray(o,o+r);return e.add(r),s2.decode(u)}function n0(n,e){const r=Cn(n,e,1)[0]>>>0,o=!!(4&r),u=!!(2&r),d=Cn(n,e,1)[0]>>>0,f={};if(1&r&&(f.nullable=!0),u){const _={};if(o?(_.type="logicalType",_.logicalType=d):(_.type="physicalType",_.physicalType=d),8&r){const w=Cn(n,e,1)[0]>>>0;_.children=new Array(w);for(let E=0;E<w;E++)_.children[E]=n0(n,e)}f.type="complexField",f.complexField=_}else{const _={};o?(_.type="logicalType",_.logicalType=d):(_.type="physicalType",_.physicalType=d),f.type="scalarField",f.scalarField=_}return f}function l2(n,e){const r=Cn(n,e,1)[0]>>>0,o=(function(u){switch(u){case 0:case 1:case 2:case 3:{const d={};d.nullable=!!(1&u),d.columnScope=0;const f={};return f.physicalType=u>1?6:4,f.type="physicalType",d.scalarType=f,d.type="scalarType",d}
5case 4:{const d={nullable:!1,columnScope:0},f={type:"physicalType",physicalType:0};return d.type="complexType",d.complexType=f,d}case 30:{const d={nullable:!1,columnScope:0},f={type:"physicalType",physicalType:1};return d.type="complexType",d.complexType=f,d}default:return(function(d){let f=null;switch(d){case 10:case 11:f=0;break;case 12:case 13:f=1;break;case 14:case 15:f=2;break;case 16:case 17:f=3;break;case 18:case 19:f=4;break;case 20:case 21:f=5;break;case 22:case 23:f=6;break;case 24:case 25:f=7;break;case 26:case 27:f=8;break;case 28:case 29:f=9;break;default:return null}const _={};_.nullable=!!(1&d),_.columnScope=0;const w={type:"physicalType"};return w.physicalType=f,_.type="scalarType",_.scalarType=w,_})(u)}})(r);if(!o)throw new Error(`Unsupported column type code: ${r}`);if((function(u){return u>=10})(r)?o.name=r0(n,e):r>=0&&r<=3?o.name="id":r===4&&(o.name="geometry"),(function(u){return u===30})(r)){const u=Cn(n,e,1)[0]>>>0,d=o.complexType;d.children=new Array(u);for(let f=0;f<u;f++)d.children[f]=n0(n,e)}return o}function c2(n,e){const r={featureTables:[]},o={};o.name=r0(n,e);const u=Cn(n,e,1)[0]>>>0,d=Cn(n,e,1)[0]>>>0;o.columns=new Array(d);for(let f=0;f<d;f++)o.columns[f]=l2(n,e);return r.featureTables.push(o),[r,u]}function u2(n,e,r,o,u,d,f=!1){const _=e.scalarType.physicalType,w=rd(u,d,n,r);if(_===4)switch(w){case wn.FLAT:{const E=Qn(n,r,u,!1);return new um(o,E,d)}case wn.SEQUENCE:{const E=O_(n,r,u);return new pm(o,E[0],E[1],u.numRleValues)}case wn.CONST:{const E=gm(n,r,u,!1);return new dm(o,E,d)}}else switch(w){case wn.FLAT:{if(f){const M=(function(C,D,R,B){const N=(function(U,Z,ae){const W=new Float64Array(Z);for(let X=0;X<Z;X++)W[X]=Yw(U,ae);return W})(C,R.numValues,D);return(function(U,Z,ae){switch(Z.logicalLevelTechnique1){case Zt.DELTA:return Z.logicalLevelTechnique2===Zt.RLE&&(U=z_(U,Z.runs,Z.numRleValues)),(function(W){W[0]=W[0]%2==1?(W[0]+1)/-2:W[0]/2;const X=W.length/4*4;let le=1;if(X>=4)for(;le<X-4;le+=4){const pe=W[le],Me=W[le+1],Ue=W[le+2],Oe=W[le+3];W[le]=(pe%2==1?(pe+1)/-2:pe/2)+W[le-1],W[le+1]=(Me%2==1?(Me+1)/-2:Me/2)+W[le],W[le+2]=(Ue%2==1?(Ue+1)/-2:Ue/2)+W[le+1],W[le+3]=(Oe%2==1?(Oe+1)/-2:Oe/2)+W[le+2]}for(;le!=W.length;++le)W[le]=(W[le]%2==1?(W[le]+1)/-2:W[le]/2)+W[le-1]})(U),U;case Zt.RLE:return(function(W,X,le){return z_(W,X.runs,X.numRleValues)})(U,Z);case Zt.NONE:return U;default:throw new Error(`The specified Logical level technique is not supported: ${Z.logicalLevelTechnique1}`)}})(N,R)})(n,r,u);return new hm(o,M,d)}const E=N_(n,r,u,!1);return new V_(o,E,d)}case wn.SEQUENCE:{const E=B_(n,r,u);return new U_(o,E[0],E[1],u.numRleValues)}case wn.CONST:{const E=j_(n,r,u,!1);return new J_(o,E,d)}}throw new Error("Vector type not supported for id column.")}class h2{constructor(e,r){var o;switch(this._featureData=e,this.properties=this._featureData.properties||{},(o=this._featureData.geometry)===null||o===void 0?void 0:o.type){case Tn.POINT:case Tn.MULTIPOINT:this.type=1;break;case Tn.LINESTRING:case Tn.MULTILINESTRING:this.type=2;break;case Tn.POLYGON:case Tn.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=r,this.id=Number(this._featureData.id)}loadGeometry(){const e=[];for(const r of this._featureData.geometry.coordinates){const o=[];for(const u of r)o.push(new I(u.x,u.y));e.push(o)}return e}}class p2{constructor(e){this.features=[],this.featureTable=e,this.name=e.name,this.extent=e.extent,this.version=2,this.features=e.getFeatures(),this.length=this.features.length}feature(e){return new h2(this.features[e],this.extent)}}class i0{constructor(e){this.layers={};const r=(function(o,u,d=!0){const f=new Xw(0),_=[];for(;f.get()<o.length;){const w=Cn(o,f,1)[0]>>>0,E=f.get()+w;if(E>o.length)throw new Error(`Block overruns tile: ${E} > ${o.length}`);if(Cn(o,f,1)[0]>>>0!=1){f.set(E);continue}const M=c2(o,f),C=M[1],D=M[0].featureTables[0];let R=null,B=null;const N=[];let U=0;for(const ae of D.columns){const W=ae.name;if(W==="id"){let X=null;if(ae.nullable){const pe=Jn(o,f),Me=f.get(),Ue=Ju(o,pe.numValues,f);f.set(Me+pe.byteLength),X=new na(Ue,pe.numValues)}const le=Jn(o,f);U=le.decompressedCount,R=u2(o,ae,f,W,le,X??U,d)}else if(W==="geometry"){const X=Cn(o,f,1)[0];if(U===0){const le=f.get();U=Jn(o,f).decompressedCount,f.set(le)}B=t2(o,X,f,U)}
vendor: 27,869 bytes, line 5
5else{const X=o2(ae)?Cn(o,f,1)[0]:1;if(X===0&&ae.type==="scalarType")continue;const le=a2(o,f,ae,X,U);if(le)if(Array.isArray(le))for(const pe of le)N.push(pe);else N.push(le)}}const Z=new Hw(D.name,B,R,N,C);_.push(Z),f.set(E)}return _})(new Uint8Array(e));this.layers=r.reduce(((o,u)=>Object.assign(Object.assign({},o),{[u.name]:new p2(u)})),{})}}class d2{constructor(e,r){this.feature=e,this.type=e.type,this.properties=e.tags?e.tags:{},this.extent=r,"id"in e&&(typeof e.id=="string"?this.id=parseInt(e.id,10):typeof e.id!="number"||isNaN(e.id)||(this.id=e.id))}loadGeometry(){const e=[],r=this.feature.type===1?[this.feature.geometry]:this.feature.geometry;for(const o of r){const u=[];for(const d of o)u.push(new I(d[0],d[1]));e.push(u)}return e}}const eh="_geojsonTileLayer";function f2(n,e){e.writeVarintField(15,n.version||1),e.writeStringField(1,n.name||""),e.writeVarintField(5,n.extent||4096);const r={keys:[],values:[],keycache:{},valuecache:{}};for(let d=0;d<n.length;d++)r.feature=n.feature(d),e.writeMessage(2,m2,r);const o=r.keys;for(const d of o)e.writeStringField(3,d);const u=r.values;for(const d of u)e.writeMessage(4,_2,d)}function m2(n,e){if(!n.feature)return;const r=n.feature;r.id!==void 0&&e.writeVarintField(1,r.id),e.writeMessage(2,g2,n),e.writeVarintField(3,r.type),e.writeMessage(4,y2,r)}function g2(n,e){var r;for(const o in(r=n.feature)==null?void 0:r.properties){let u=n.feature.properties[o],d=n.keycache[o];if(u==null)continue;d===void 0&&(n.keys.push(o),d=n.keys.length-1,n.keycache[o]=d),e.writeVarint(d),typeof u!="string"&&typeof u!="boolean"&&typeof u!="number"&&(u=JSON.stringify(u));const f=typeof u+":"+u;let _=n.valuecache[f];_===void 0&&(n.values.push(u),_=n.values.length-1,n.valuecache[f]=_),e.writeVarint(_)}}function Em(n,e){return(e<<3)+(7&n)}function a0(n){return n<<1^n>>31}function y2(n,e){const r=n.loadGeometry(),o=n.type;let u=0,d=0;for(const f of r){let _=1;o===1&&(_=f.length),e.writeVarint(Em(1,_));const w=o===3?f.length-1:f.length;for(let E=0;E<w;E++){E===1&&o!==1&&e.writeVarint(Em(2,w-1));const M=f[E].x-u,C=f[E].y-d;e.writeVarint(a0(M)),e.writeVarint(a0(C)),u+=M,d+=C}n.type===3&&e.writeVarint(Em(7,1))}}function _2(n,e){const r=typeof n;r==="string"?e.writeStringField(1,n):r==="boolean"?e.writeBooleanField(7,n):r==="number"&&(n%1!=0?e.writeDoubleField(3,n):n<0?e.writeSVarintField(6,n):e.writeVarintField(5,n))}class o0{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Oo(pt,16,0),this.grid3D=new Oo(pt,16,0),this.featureIndexArray=new G,this.promoteId=r}insert(e,r,o,u,d,f){const _=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(o,u,d);const w=f?this.grid3D:this.grid;for(let E=0;E<r.length;E++){const M=r[E],C=[1/0,1/0,-1/0,-1/0];for(let D=0;D<M.length;D++){const R=M[D];C[0]=Math.min(C[0],R.x),C[1]=Math.min(C[1],R.y),C[2]=Math.max(C[2],R.x),C[3]=Math.max(C[3],R.y)}C[0]<pt&&C[1]<pt&&C[2]>=0&&C[3]>=0&&w.insert(_,C[0],C[1],C[2],C[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=this.encoding!=="mlt"?new Gy(new Hp(this.rawTileData)).layers:new i0(this.rawTileData).layers,this.sourceLayerCoder=new I_(this.vtLayers?Object.keys(this.vtLayers).sort():[eh])),this.vtLayers}query(e,r,o,u){this.loadVTLayers();const d=e.params,f=pt/e.tileSize/e.scale,_=Ts(d.filter,d.globalState),w=e.queryGeometry,E=e.queryPadding*f,M=Ws.fromPoints(w),C=this.grid.query(M.minX-E,M.minY-E,M.maxX+E,M.maxY+E),D=Ws.fromPoints(e.cameraQueryGeometry).expandBy(E),R=this.grid3D.query(D.minX,D.minY,D.maxX,D.maxY,((U,Z,ae,W)=>(function(X,le,pe,Me,Ue){for(const $e of X)if(le<=$e.x&&pe<=$e.y&&Me>=$e.x&&Ue>=$e.y)return!0;const Oe=[new I(le,pe),new I(le,Ue),new I(Me,Ue),new I(Me,pe)];if(X.length>2){for(const $e of Oe)if(ac(X,$e))return!0}for(let $e=0;$e<X.length-1;$e++)if(x1(X[$e],X[$e+1],Oe))return!0;return!1})(e.cameraQueryGeometry,U-E,Z-E,ae+E,W+E)));for(const U of R)C.push(U);C.sort(v2);const B={};let N;for(let U=0;U<C.length;U++){const Z=C[U];if(Z===N)continue;N=Z;const ae=this.featureIndexArray.get(Z);let W=null;this.loadMatchingFeature(B,ae.bucketIndex,ae.sourceLayerIndex,ae.featureIndex,_,d.layers,d.availableImages,r,o,u,((X,le,pe)=>(W||(W=Pa(X)),le.queryIntersectsFeature({queryGeometry:w,feature:X,featureState:pe,geometry:W,zoom:this.z,transform:e.transform,pixelsToTileUnits:f,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation}))))}return B}loadMatchingFeature(e,r,o,u,d,f,_,w,E,M,C){const D=this.bucketLayerIDs[r];if(f&&!D.some((U=>f.has(U))))return;const R=this.sourceLayerCoder.decode(o),B=this.vtLayers[R].feature(u);if(d.needGeometry){const U=Ma(B,!0);if(!d.filter(new dr(this.tileID.overscaledZ),U,this.tileID.canonical))return}else if(!d.filter(new dr(this.tileID.overscaledZ),B))return;const N=this.getId(B,R);for(let U=0;U<D.length;U++){const Z=D[U];if(f&&!f.has(Z))continue;const ae=w[Z];if(!ae)continue;let W={};N&&M&&(W=M.getState(ae.sourceLayer||eh,N));const X=$t({},E[Z]);X.paint=s0(X.paint,ae.paint,B,W,_),X.layout=s0(X.layout,ae.layout,B,W,_);const le=!C||C(B,ae,W);if(!le)continue;const pe=new A_(B,this.z,this.x,this.y,N);pe.layer=X;let Me=e[Z];Me===void 0&&(Me=e[Z]=[]),Me.push({featureIndex:u,feature:pe,intersectionZ:le})}}lookupSymbolFeatures(e,r,o,u,d,f,_,w){const E={};this.loadVTLayers();const M=Ts(d.filterSpec,d.globalState);for(const C of e)this.loadMatchingFeature(E,o,u,C,M,f,_,w,r);return E}hasLayer(e){for(const r of this.bucketLayerIDs)for(const o of r)if(e===o)return!0;return!1}getId(e,r){var o;let u=e.id;return this.promoteId&&(u=e.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],typeof u=="boolean"&&(u=Number(u)),u===void 0&&(!((o=e.properties)===null||o===void 0)&&o.cluster)&&this.promoteId&&(u=Number(e.properties.cluster_id))),u}}function s0(n,e,r,o,u){return an(n,((d,f)=>{const _=e instanceof Fs?e.get(f):null;return _&&_.evaluate?_.evaluate(r,o,u):_}))}function v2(n,e){return e-n}function l0(n,e,r,o,u){const d=[];for(let f=0;f<n.length;f++){const _=n[f];let w;for(let E=0;E<_.length-1;E++){let M=_[E],C=_[E+1];M.x<e&&C.x<e||(M.x<e?M=new I(e,M.y+(e-M.x)/(C.x-M.x)*(C.y-M.y))._round():C.x<e&&(C=new I(e,M.y+(e-M.x)/(C.x-M.x)*(C.y-M.y))._round()),M.y<r&&C.y<r||(M.y<r?M=new I(M.x+(r-M.y)/(C.y-M.y)*(C.x-M.x),r)._round():C.y<r&&(C=new I(M.x+(r-M.y)/(C.y-M.y)*(C.x-M.x),r)._round()),M.x>=o&&C.x>=o||(M.x>=o?M=new I(o,M.y+(o-M.x)/(C.x-M.x)*(C.y-M.y))._round():C.x>=o&&(C=new I(o,M.y+(o-M.x)/(C.x-M.x)*(C.y-M.y))._round()),M.y>=u&&C.y>=u||(M.y>=u?M=new I(M.x+(u-M.y)/(C.y-M.y)*(C.x-M.x),u)._round():C.y>=u&&(C=new I(M.x+(u-M.y)/(C.y-M.y)*(C.x-M.x),u)._round()),w&&M.equals(w[w.length-1])||(w=[M],d.push(w)),w.push(C)))))}}return d}function c0(n,e,r,o,u){switch(e){case 1:return(function(d,f,_,w){const E=[];for(const M of d)for(const C of M){const D=w===0?C.x:C.y;D>=f&&D<=_&&E.push([C])}return E})(n,r,o,u);case 2:return u0(n,r,o,u,!1);case 3:return u0(n,r,o,u,!0)}return[]}function x2(n,e,r,o,u){const d=o===0?b2:w2;let f=[];const _=[];for(let M=0;M<n.length-1;M++){const C=n[M],D=n[M+1],R=o===0?C.x:C.y,B=o===0?D.x:D.y;let N=!1;R<e?B>e&&f.push(d(C,D,e)):R>r?B<r&&f.push(d(C,D,r)):f.push(C),B<e&&R>=e&&(f.push(d(C,D,e)),N=!0),B>r&&R<=r&&(f.push(d(C,D,r)),N=!0),!u&&N&&(_.push(f),f=[])}const w=n.length-1,E=o===0?n[w].x:n[w].y;return E>=e&&E<=r&&f.push(n[w]),u&&f.length>0&&!f[0].equals(f[f.length-1])&&f.push(new I(f[0].x,f[0].y)),f.length>0&&_.push(f),_}function u0(n,e,r,o,u){const d=[];for(const f of n){const _=x2(f,e,r,o,u);_.length>0&&d.push(..._)}return d}function b2(n,e,r){return new I(r,n.y+(r-n.x)/(e.x-n.x)*(e.y-n.y))}function w2(n,e,r){return new I(n.x+(r-n.y)/(e.y-n.y)*(e.x-n.x),r)}ht("FeatureIndex",o0,{omit:["rawTileData","sourceLayerCoder"]});class Go extends I{constructor(e,r,o,u){super(e,r),this.angle=o,u!==void 0&&(this.segment=u)}clone(){return new Go(this.x,this.y,this.angle,this.segment)}}function h0(n,e,r,o,u){if(e.segment===void 0||r===0)return!0;let d=e,f=e.segment+1,_=0;for(;_>-r/2;){if(f--,f<0)return!1;_-=n[f].dist(d),d=n[f]}_+=n[f].dist(n[f+1]),f++;const w=[];let E=0;for(;_<r/2;){const M=n[f],C=n[f+1];if(!C)return!1;let D=n[f-1].angleTo(M)-M.angleTo(C);for(D=Math.abs((D+3*Math.PI)%(2*Math.PI)-Math.PI),w.push({distance:_,angleDelta:D}),E+=D;_-w[0].distance>o;)E-=w.shift().angleDelta;if(E>u)return!1;f++,_+=M.dist(C)}return!0}function p0(n){let e=0;for(let r=0;r<n.length-1;r++)e+=n[r].dist(n[r+1]);return e}function d0(n,e,r){return n?.6*e*r:0}function f0(n,e){return Math.max(n?n.right-n.left:0,e?e.right-e.left:0)}function T2(n,e,r,o,u,d){const f=d0(r,u,d),_=f0(r,o)*d;let w=0;const E=p0(n)/2;for(let M=0;M<n.length-1;M++){const C=n[M],D=n[M+1],R=C.dist(D);if(w+R>E){const B=(E-w)/R,N=Ir.number(C.x,D.x,B),U=Ir.number(C.y,D.y,B),Z=new Go(N,U,D.angleTo(C),M);return Z._round(),!f||h0(n,Z,_,f,e)?Z:void 0}w+=R}}function S2(n,e,r,o,u,d,f,_,w){const E=d0(o,d,f),M=f0(o,u),C=M*f,D=n[0].x===0||n[0].x===w||n[0].y===0||n[0].y===w;return e-C<e/4&&(e=C+e/4),m0(n,D?e/2*_%e:(M/2+2*d)*f*_%e,e,E,r,C,D,!1,w)}function m0(n,e,r,o,u,d,f,_,w){const E=d/2,M=p0(n);let C=0,D=e-r,R=[];for(let B=0;B<n.length-1;B++){const N=n[B],U=n[B+1],Z=N.dist(U),ae=U.angleTo(N);for(;D+r<C+Z;){D+=r;const W=(D-C)/Z,X=Ir.number(N.x,U.x,W),le=Ir.number(N.y,U.y,W);if(X>=0&&X<w&&le>=0&&le<w&&D-E>=0&&D+E<=M){const pe=new Go(X,le,ae,B);pe._round(),o&&!h0(n,pe,d,o,u)||R.push(pe)}}C+=Z}return _||R.length||f||(R=m0(n,C/2,r,o,u,d,f,!0,w)),R}function g0(n,e,r,o){const u=[],d=n.image,f=d.pixelRatio,_=d.paddedRect.w-2,w=d.paddedRect.h-2;let E={x1:n.left,y1:n.top,x2:n.right,y2:n.bottom};const M=d.stretchX||[[0,_]],C=d.stretchY||[[0,w]],D=(ze,ut)=>ze+ut[1]-ut[0],R=M.reduce(D,0),B=C.reduce(D,0),N=_-R,U=w-B;let Z=0,ae=R,W=0,X=B,le=0,pe=N,Me=0,Ue=U;if(d.content&&o){const ze=d.content,ut=ze[2]-ze[0],st=ze[3]-ze[1];(d.textFitWidth||d.textFitHeight)&&(E=h_(n)),Z=od(M,0,ze[0]),W=od(C,0,ze[1]),ae=od(M,ze[0],ze[2]),X=od(C,ze[1],ze[3]),le=ze[0]-Z,Me=ze[1]-W,pe=ut-ae,Ue=st-X}const Oe=E.x1,$e=E.y1,Qe=E.x2-Oe,Ge=E.y2-$e,Ne=(ze,ut,st,dt)=>{const at=sd(ze.stretch-Z,ae,Qe,Oe),_t=ld(ze.fixed-le,pe,ze.stretch,R),nr=sd(ut.stretch-W,X,Ge,$e),qt=ld(ut.fixed-Me,Ue,ut.stretch,B),kr=sd(st.stretch-Z,ae,Qe,Oe),zn=ld(st.fixed-le,pe,st.stretch,R),un=sd(dt.stretch-W,X,Ge,$e),Dr=ld(dt.fixed-Me,Ue,dt.stretch,B),Mr=new I(at,nr),sr=new I(kr,nr),Vr=new I(kr,un),Xr=new I(at,un),Sr=new I(_t/f,qt/f),oi=new I(zn/f,Dr/f),Fn=e*Math.PI/180;if(Fn){const Sn=Math.sin(Fn),Fr=Math.cos(Fn),hn=[Fr,-Sn,Sn,Fr];Mr._matMult(hn),sr._matMult(hn),Xr._matMult(hn),Vr._matMult(hn)}const si=ze.stretch+ze.fixed,Zi=ut.stretch+ut.fixed;return{tl:Mr,tr:sr,bl:Xr,br:Vr,tex:{x:d.paddedRect.x+1+si,y:d.paddedRect.y+1+Zi,w:st.stretch+st.fixed-si,h:dt.stretch+dt.fixed-Zi},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Sr,pixelOffsetBR:oi,minFontScaleX:pe/f/Qe,minFontScaleY:Ue/f/Ge,isSDF:r}};if(o&&(d.stretchX||d.stretchY)){const ze=y0(M,N,R),ut=y0(C,U,B);for(let st=0;st<ze.length-1;st++){const dt=ze[st],at=ze[st+1];for(let _t=0;_t<ut.length-1;_t++)u.push(Ne(dt,ut[_t],at,ut[_t+1]))}}else u.push(Ne({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:_+1},{fixed:0,stretch:w+1}));return u}function od(n,e,r){let o=0;for(const u of n)o+=Math.max(e,Math.min(r,u[1]))-Math.max(e,Math.min(r,u[0]));return o}function y0(n,e,r){const o=[{fixed:-1,stretch:0}];for(const[u,d]of n){const f=o[o.length-1];o.push({fixed:u-f.stretch,stretch:f.stretch}),o.push({fixed:u-f.stretch,stretch:f.stretch+(d-u)})}return o.push({fixed:e+1,stretch:r}),o}function sd(n,e,r,o){return n/e*r+o}function ld(n,e,r,o){return n-e*r/o}ht("Anchor",Go);class cd{constructor(e,r,o,u,d,f,_,w,E,M){var C;if(this.boxStartIndex=e.length,E){let D=f.top,R=f.bottom;const B=f.collisionPadding;B&&(D-=B[1],R+=B[3]);let N=R-D;N>0&&(N=Math.max(10,N),this.circleDiameter=N)}else{const D=!((C=f.image)===null||C===void 0)&&C.content&&(f.image.textFitWidth||f.image.textFitHeight)?h_(f):{x1:f.left,y1:f.top,x2:f.right,y2:f.bottom};D.y1=D.y1*_-w[0],D.y2=D.y2*_+w[2],D.x1=D.x1*_-w[3],D.x2=D.x2*_+w[1];const R=f.collisionPadding;if(R&&(D.x1-=R[0]*_,D.y1-=R[1]*_,D.x2+=R[2]*_,D.y2+=R[3]*_),M){const B=new I(D.x1,D.y1),N=new I(D.x2,D.y1),U=new I(D.x1,D.y2),Z=new I(D.x2,D.y2),ae=M*Math.PI/180;B._rotate(ae),N._rotate(ae),U._rotate(ae),Z._rotate(ae),D.x1=Math.min(B.x,N.x,U.x,Z.x),D.x2=Math.max(B.x,N.x,U.x,Z.x),D.y1=Math.min(B.y,N.y,U.y,Z.y),D.y2=Math.max(B.y,N.y,U.y,Z.y)}e.emplaceBack(r.x,r.y,D.x1,D.y1,D.x2,D.y2,o,u,d)}this.boxEndIndex=e.length}}class E2{constructor(e=[],r=(o,u)=>o<u?-1:o>u?1:0){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let o=(this.length>>1)-1;o>=0;o--)this._down(o)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:r,compare:o}=this,u=r[e];for(;e>0;){const d=e-1>>1,f=r[d];if(o(u,f)>=0)break;r[e]=f,e=d}r[e]=u}_down(e){const{data:r,compare:o}=this,u=this.length>>1,d=r[e];for(;e<u;){let f=1+(e<<1);const _=f+1;if(_<this.length&&o(r[_],r[f])<0&&(f=_),o(r[f],d)>=0)break;r[e]=r[f],e=f}r[e]=d}}function P2(n,e=1,r=!1){const o=Ws.fromPoints(n[0]),u=Math.min(o.width(),o.height());let d=u/2;const f=new E2([],M2),{minX:_,minY:w,maxX:E,maxY:M}=o;if(u===0)return new I(_,w);for(let R=_;R<E;R+=u)for(let B=w;B<M;B+=u)f.push(new _c(R+d,B+d,d,n));let C=(function(R){let B=0,N=0,U=0;const Z=R[0];for(let ae=0,W=Z.length,X=W-1;ae<W;X=ae++){const le=Z[ae],pe=Z[X],Me=le.x*pe.y-pe.x*le.y;N+=(le.x+pe.x)*Me,U+=(le.y+pe.y)*Me,B+=3*Me}return new _c(N/B,U/B,0,R)})(n),D=f.length;for(;f.length;){const R=f.pop();(R.d>C.d||!C.d)&&(C=R,r&&console.log("found best %d after %d probes",Math.round(1e4*R.d)/1e4,D)),R.max-C.d<=e||(d=R.h/2,f.push(new _c(R.p.x-d,R.p.y-d,d,n)),f.push(new _c(R.p.x+d,R.p.y-d,d,n)),f.push(new _c(R.p.x-d,R.p.y+d,d,n)),f.push(new _c(R.p.x+d,R.p.y+d,d,n)),D+=4)}return r&&(console.log(`num probes: ${D}`),console.log(`best distance: ${C.d}`)),C.p}function M2(n,e){return e.max-n.max}function _c(n,e,r,o){this.p=new I(n,e),this.h=r,this.d=(function(u,d){let f=!1,_=1/0;for(let w=0;w<d.length;w++){const E=d[w];for(let M=0,C=E.length,D=C-1;M<C;D=M++){const R=E[M],B=E[D];R.y>u.y!=B.y>u.y&&u.x<(B.x-R.x)*(u.y-R.y)/(B.y-R.y)+R.x&&(f=!f),_=Math.min(_,wy(u,R,B))}}return(f?1:-1)*Math.sqrt(_)})(this.p,o),this.max=this.d+this.h*Math.SQRT2}var Rn;v.aP=void 0,(Rn=v.aP||(v.aP={}))[Rn.center=1]="center",Rn[Rn.left=2]="left",Rn[Rn.right=3]="right",Rn[Rn.top=4]="top",Rn[Rn.bottom=5]="bottom",Rn[Rn["top-left"]=6]="top-left",Rn[Rn["top-right"]=7]="top-right",Rn[Rn["bottom-left"]=8]="bottom-left",Rn[Rn["bottom-right"]=9]="bottom-right";const Pm=Number.POSITIVE_INFINITY;function _0(n,e){return e[1]!==Pm?(function(r,o,u){let d=0,f=0;switch(o=Math.abs(o),u=Math.abs(u),r){case"top-right":case"top-left":case"top":f=u-7;break;case"bottom-right":case"bottom-left":case"bottom":f=7-u}switch(r){case"top-right":case"bottom-right":case"right":d=-o;break;case"top-left":case"bottom-left":case"left":d=o}return[d,f]})(n,e[0],e[1]):(function(r,o){let u=0,d=0;o<0&&(o=0);const f=o/Math.SQRT2;switch(r){case"top-right":case"top-left":d=f-7;break;case"bottom-right":case"bottom-left":d=7-f;break;case"bottom":d=7-o;break;case"top":d=o-7}switch(r){case"top-right":case"bottom-right":u=-f;break;case"top-left":case"bottom-left":u=f;break;case"left":u=o;break;case"right":u=-o}return[u,d]})(n,e[0])}function v0(n,e,r){var o;const u=n.layout,d=(o=u.get("text-variable-anchor-offset"))===null||o===void 0?void 0:o.evaluate(e,{},r);if(d){const _=d.values,w=[];for(let E=0;E<_.length;E+=2){const M=w[E]=_[E],C=_[E+1].map((D=>D*bn));M.startsWith("top")?C[1]-=7:M.startsWith("bottom")&&(C[1]+=7),w[E+1]=C}return new Vn(w)}const f=u.get("text-variable-anchor");if(f){let _;_=n._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[u.get("text-radial-offset").evaluate(e,{},r)*bn,Pm]:u.get("text-offset").evaluate(e,{},r).map((E=>E*bn));const w=[];for(const E of f)w.push(E,_0(E,_));return new Vn(w)}return null}function Mm(n){switch(n){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function I2(n,e,r,o,u,d,f,_,w,E,M,C){let D=d.textMaxSize.evaluate(e,{});D===void 0&&(D=f);const R=n.layers[0].layout,B=R.get("icon-offset").evaluate(e,{},M),N=b0(r.horizontal),U=f/24,Z=n.tilePixelRatio*U,ae=n.tilePixelRatio*D/24,W=n.tilePixelRatio*_,X=n.tilePixelRatio*R.get("symbol-spacing"),le=R.get("text-padding")*n.tilePixelRatio,pe=(function(st,dt,at,_t=1){const nr=st.get("icon-padding").evaluate(dt,{},at),qt=nr&&nr.values;return[qt[0]*_t,qt[1]*_t,qt[2]*_t,qt[3]*_t]})(R,e,M,n.tilePixelRatio),Me=R.get("text-max-angle")/180*Math.PI,Ue=R.get("text-rotation-alignment")!=="viewport"&&R.get("symbol-placement")!=="point",Oe=R.get("icon-rotation-alignment")==="map"&&R.get("symbol-placement")!=="point",$e=R.get("symbol-placement"),Qe=X/2,Ge=R.get("icon-text-fit");let Ne;o&&Ge!=="none"&&(n.allowVerticalPlacement&&r.vertical&&(Ne=p_(o,r.vertical,Ge,R.get("icon-text-fit-padding"),B,U)),N&&(o=p_(o,N,Ge,R.get("icon-text-fit-padding"),B,U)));const ze=M?C.line.getGranularityForZoomLevel(M.z):1,ut=(st,dt)=>{dt.x<0||dt.x>=pt||dt.y<0||dt.y>=pt||(function(at,_t,nr,qt,kr,zn,un,Dr,Mr,sr,Vr,Xr,Sr,oi,Fn,si,Zi,Sn,Fr,hn,Ur,En,oo,ia,nh){const Zo=at.addToLineVertexArray(_t,nr);let Ys,vc,xc,bc,E0=0,P0=0,M0=0,I0=0,zm=-1,Fm=-1;const so={};let A0=Hr("");if(at.allowVerticalPlacement&&qt.vertical){const Gn=Dr.layout.get("text-rotate").evaluate(Ur,{},ia)+90;xc=new cd(Mr,_t,sr,Vr,Xr,qt.vertical,Sr,oi,Fn,Gn),un&&(bc=new cd(Mr,_t,sr,Vr,Xr,un,Zi,Sn,Fn,Gn))}if(kr){const Gn=Dr.layout.get("icon-rotate").evaluate(Ur,{}),Di=Dr.layout.get("icon-text-fit")!=="none",Ks=g0(kr,Gn,oo,Di),oa=un?g0(un,Gn,oo,Di):void 0;vc=new cd(Mr,_t,sr,Vr,Xr,kr,Zi,Sn,!1,Gn),E0=4*Ks.length;const Js=at.iconSizeData;let Ia=null;Js.kind==="source"?(Ia=[io*Dr.layout.get("icon-size").evaluate(Ur,{})],Ia[0]>Uo&&ur(`${at.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):Js.kind==="composite"&&(Ia=[io*En.compositeIconSizes[0].evaluate(Ur,{},ia),io*En.compositeIconSizes[1].evaluate(Ur,{},ia)],(Ia[0]>Uo||Ia[1]>Uo)&&ur(`${at.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),at.addSymbols(at.icon,Ks,Ia,hn,Fr,Ur,v.az.none,_t,Zo.lineStartIndex,Zo.lineLength,-1,ia),zm=at.icon.placedSymbolArray.length-1,oa&&(P0=4*oa.length,at.addSymbols(at.icon,oa,Ia,hn,Fr,Ur,v.az.vertical,_t,Zo.lineStartIndex,Zo.lineLength,-1,ia),Fm=at.icon.placedSymbolArray.length-1)}const C0=Object.keys(qt.horizontal);for(const Gn of C0){const Di=qt.horizontal[Gn];if(!Ys){A0=Hr(Di.text);const oa=Dr.layout.get("text-rotate").evaluate(Ur,{},ia);Ys=new cd(Mr,_t,sr,Vr,Xr,Di,Sr,oi,Fn,oa)}const Ks=Di.positionedLines.length===1;if(M0+=x0(at,_t,Di,zn,Dr,Fn,Ur,si,Zo,qt.vertical?v.az.horizontal:v.az.horizontalOnly,Ks?C0:[Gn],so,zm,En,ia),Ks)break}qt.vertical&&(I0+=x0(at,_t,qt.vertical,zn,Dr,Fn,Ur,si,Zo,v.az.vertical,["vertical"],so,Fm,En,ia));const k2=Ys?Ys.boxStartIndex:at.collisionBoxArray.length,D2=Ys?Ys.boxEndIndex:at.collisionBoxArray.length,L2=xc?xc.boxStartIndex:at.collisionBoxArray.length,R2=xc?xc.boxEndIndex:at.collisionBoxArray.length,z2=vc?vc.boxStartIndex:at.collisionBoxArray.length,F2=vc?vc.boxEndIndex:at.collisionBoxArray.length,O2=bc?bc.boxStartIndex:at.collisionBoxArray.length,B2=bc?bc.boxEndIndex:at.collisionBoxArray.length;let aa=-1;const hd=(Gn,Di)=>Gn&&Gn.circleDiameter?Math.max(Gn.circleDiameter,Di):Di;aa=hd(Ys,aa),aa=hd(xc,aa),aa=hd(vc,aa),aa=hd(bc,aa);const k0=aa>-1?1:0;k0&&(aa*=nh/bn),at.glyphOffsetArray.length>=pc.MAX_GLYPHS&&ur("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Ur.sortKey!==void 0&&at.addToSortKeyRanges(at.symbolInstances.length,Ur.sortKey);const N2=v0(Dr,Ur,ia),[j2,V2]=(function(Gn,Di){const Ks=Gn.length,oa=Di==null?void 0:Di.values;if((oa==null?void 0:oa.length)>0)for(let Js=0;Js<oa.length;Js+=2){const Ia=oa[Js+1];Gn.emplaceBack(v.aP[oa[Js]],Ia[0],Ia[1])}return[Ks,Gn.length]})(at.textAnchorOffsets,N2);at.symbolInstances.emplaceBack(_t.x,_t.y,so.right>=0?so.right:-1,so.center>=0?so.center:-1,so.left>=0?so.left:-1,so.vertical||-1,zm,Fm,A0,k2,D2,L2,R2,z2,F2,O2,B2,sr,M0,I0,E0,P0,k0,0,Sr,aa,j2,V2)})(n,dt,st,r,o,u,Ne,n.layers[0],n.collisionBoxArray,e.index,e.sourceLayerIndex,n.index,Z,[le,le,le,le],Ue,w,W,pe,Oe,B,e,d,E,M,f)};if($e==="line")for(const st of l0(e.geometry,0,0,pt,pt)){const dt=Zs(st,ze),at=S2(dt,X,Me,r.vertical||N,o,24,ae,n.overscaling,pt);for(const _t of at)N&&A2(n,N.text,Qe,_t)||ut(dt,_t)}else if($e==="line-center"){for(const st of e.geometry)if(st.length>1){const dt=Zs(st,ze),at=T2(dt,Me,r.vertical||N,o,24,ae);at&&ut(dt,at)}}else if(e.type==="Polygon")for(const st of Pl(e.geometry,0)){const dt=P2(st,16);ut(Zs(st[0],ze,!0),new Go(dt.x,dt.y,0))}else if(e.type==="LineString")for(const st of e.geometry){const dt=Zs(st,ze);ut(dt,new Go(dt[0].x,dt[0].y,0))}else if(e.type==="Point")for(const st of e.geometry)for(const dt of st)ut([dt],new Go(dt.x,dt.y,0))}function x0(n,e,r,o,u,d,f,_,w,E,M,C,D,R,B){const N=(function(ae,W,X,le,pe,Me,Ue,Oe){const $e=le.layout.get("text-rotate").evaluate(Me,{})*Math.PI/180,Qe=[];for(const Ge of W.positionedLines)for(const Ne of Ge.positionedGlyphs){if(!Ne.rect)continue;const ze=Ne.rect||{};let ut=4,st=!0,dt=1,at=0;const _t=(pe||Oe)&&Ne.vertical,nr=Ne.metrics.advance*Ne.scale/2;if(Oe&&W.verticalizable&&(at=Ge.lineOffset/2-(Ne.imageName?-(bn-Ne.metrics.width*Ne.scale)/2:(Ne.scale-1)*bn)),Ne.imageName){const Sn=Ue[Ne.imageName];st=Sn.sdf,dt=Sn.pixelRatio,ut=1/dt}const qt=pe?[Ne.x+nr,Ne.y]:[0,0];let kr=pe?[0,0]:[Ne.x+nr+X[0],Ne.y+X[1]-at],zn=[0,0];_t&&(zn=kr,kr=[0,0]);const un=Ne.metrics.isDoubleResolution?2:1,Dr=(Ne.metrics.left-ut)*Ne.scale-nr+kr[0],Mr=(-Ne.metrics.top-ut)*Ne.scale+kr[1],sr=Dr+ze.w/un*Ne.scale/dt,Vr=Mr+ze.h/un*Ne.scale/dt,Xr=new I(Dr,Mr),Sr=new I(sr,Mr),oi=new I(Dr,Vr),Fn=new I(sr,Vr);if(_t){const Sn=new I(-nr,nr- -17),Fr=-Math.PI/2,hn=12-nr,Ur=new I(22-hn,-(Ne.imageName?hn:0)),En=new I(...zn);Xr._rotateAround(Fr,Sn)._add(Ur)._add(En),Sr._rotateAround(Fr,Sn)._add(Ur)._add(En),oi._rotateAround(Fr,Sn)._add(Ur)._add(En),Fn._rotateAround(Fr,Sn)._add(Ur)._add(En)}if($e){const Sn=Math.sin($e),Fr=Math.cos($e),hn=[Fr,-Sn,Sn,Fr];Xr._matMult(hn),Sr._matMult(hn),oi._matMult(hn),Fn._matMult(hn)}const si=new I(0,0),Zi=new I(0,0);Qe.push({tl:Xr,tr:Sr,bl:oi,br:Fn,tex:ze,writingMode:W.writingMode,glyphOffset:qt,sectionIndex:Ne.sectionIndex,isSDF:st,pixelOffsetTL:si,pixelOffsetBR:Zi,minFontScaleX:0,minFontScaleY:0})}return Qe})(0,r,_,u,d,f,o,n.allowVerticalPlacement),U=n.textSizeData;let Z=null;U.kind==="source"?(Z=[io*u.layout.get("text-size").evaluate(f,{})],Z[0]>Uo&&ur(`${n.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):U.kind==="composite"&&(Z=[io*R.compositeTextSizes[0].evaluate(f,{},B),io*R.compositeTextSizes[1].evaluate(f,{},B)],(Z[0]>Uo||Z[1]>Uo)&&ur(`${n.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),n.addSymbols(n.text,N,Z,_,d,f,E,e,w.lineStartIndex,w.lineLength,D,B);for(const ae of M)C[ae]=n.text.placedSymbolArray.length-1;return 4*N.length}function b0(n){for(const e in n)return n[e];return null}function A2(n,e,r,o){const u=n.compareText;if(e in u){const d=u[e];for(let f=d.length-1;f>=0;f--)if(o.dist(d[f])<r)return!0}else u[e]=[];return u[e].push(o),!1}const w0=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Im{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[r,o]=new Uint8Array(e,0,2);if(r!==219)throw new Error("Data does not appear to be in a KDBush format.");const u=o>>4;if(u!==1)throw new Error(`Got v${u} data when expected v1.`);const d=w0[15&o];if(!d)throw new Error("Unrecognized array type.");const[f]=new Uint16Array(e,2,1),[_]=new Uint32Array(e,4,1);return new Im(_,f,d,e)}constructor(e,r=64,o=Float64Array,u){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=o,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const d=w0.indexOf(this.ArrayType),f=2*e*this.ArrayType.BYTES_PER_ELEMENT,_=e*this.IndexArrayType.BYTES_PER_ELEMENT,w=(8-_%8)%8;if(d<0)throw new Error(`Unexpected typed array class: ${o}.`);u&&u instanceof ArrayBuffer?(this.data=u,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+_+w,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+f+_+w),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+_+w,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+d]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=e)}add(e,r){const o=this._pos>>1;return this.ids[o]=o,this.coords[this._pos++]=e,this.coords[this._pos++]=r,o}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return Am(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,r,o,u){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:d,coords:f,nodeSize:_}=this,w=[0,d.length-1,0],E=[];for(;w.length;){const M=w.pop()||0,C=w.pop()||0,D=w.pop()||0;if(C-D<=_){for(let U=D;U<=C;U++){const Z=f[2*U],ae=f[2*U+1];Z>=e&&Z<=o&&ae>=r&&ae<=u&&E.push(d[U])}continue}const R=D+C>>1,B=f[2*R],N=f[2*R+1];B>=e&&B<=o&&N>=r&&N<=u&&E.push(d[R]),(M===0?e<=B:r<=N)&&(w.push(D),w.push(R-1),w.push(1-M)),(M===0?o>=B:u>=N)&&(w.push(R+1),w.push(C),w.push(1-M))}return E}within(e,r,o){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:u,coords:d,nodeSize:f}=this,_=[0,u.length-1,0],w=[],E=o*o;for(;_.length;){const M=_.pop()||0,C=_.pop()||0,D=_.pop()||0;if(C-D<=f){for(let U=D;U<=C;U++)S0(d[2*U],d[2*U+1],e,r)<=E&&w.push(u[U]);continue}const R=D+C>>1,B=d[2*R],N=d[2*R+1];S0(B,N,e,r)<=E&&w.push(u[R]),(M===0?e-o<=B:r-o<=N)&&(_.push(D),_.push(R-1),_.push(1-M)),(M===0?e+o>=B:r+o>=N)&&(_.push(R+1),_.push(C),_.push(1-M))}return w}}function Am(n,e,r,o,u,d){if(u-o<=r)return;const f=o+u>>1;T0(n,e,f,o,u,d),Am(n,e,r,o,f-1,1-d),Am(n,e,r,f+1,u,1-d)}function T0(n,e,r,o,u,d){for(;u>o;){if(u-o>600){const E=u-o+1,M=r-o+1,C=Math.log(E),D=.5*Math.exp(2*C/3),R=.5*Math.sqrt(C*D*(E-D)/E)*(M-E/2<0?-1:1);T0(n,e,r,Math.max(o,Math.floor(r-M*D/E+R)),Math.min(u,Math.floor(r+(E-M)*D/E+R)),d)}const f=e[2*r+d];let _=o,w=u;for(th(n,e,o,r),e[2*u+d]>f&&th(n,e,o,u);_<w;){for(th(n,e,_,w),_++,w--;e[2*_+d]<f;)_++;for(;e[2*w+d]>f;)w--}e[2*o+d]===f?th(n,e,o,w):(w++,th(n,e,w,u)),w<=r&&(o=w+1),r<=w&&(u=w-1)}}function th(n,e,r,o){Cm(n,r,o),Cm(e,2*r,2*o),Cm(e,2*r+1,2*o+1)}function Cm(n,e,r){const o=n[e];n[e]=n[r],n[r]=o}function S0(n,e,r,o){const u=n-r,d=e-o;return u*u+d*d}var km;v.cH=void 0,(km=v.cH||(v.cH={})).create="create",km.load="load",km.fullLoad="fullLoad";let ud=null,rh=[];const Dm=1e3/60,Lm="loadTime",Rm="fullLoadTime",C2={mark(n){performance.mark(n)},frame(n){const e=n;ud!=null&&rh.push(e-ud),ud=e},clearMetrics(){ud=null,rh=[],performance.clearMeasures(Lm),performance.clearMeasures(Rm);for(const n in v.cH)performance.clearMarks(v.cH[n])},getPerformanceMetrics(){performance.measure(Lm,v.cH.create,v.cH.load),performance.measure(Rm,v.cH.create,v.cH.fullLoad);const n=performance.getEntriesByName(Lm)[0].duration,e=performance.getEntriesByName(Rm)[0].duration,r=rh.length,o=1/(rh.reduce(((d,f)=>d+f),0)/r/1e3),u=rh.filter((d=>d>Dm)).reduce(((d,f)=>d+(f-Dm)/Dm),0);return{loadTime:n,fullLoadTime:e,fps:o,percentDroppedFrames:u/(r+u)*100,totalFrames:r}}};v.$=te,v.A=De,v.B=Fo,v.C=vn,v.D=gt,v.E=St,v.F=function([n,e,r]){return e+=90,e*=Math.PI/180,r*=Math.PI/180,{x:n*Math.cos(e)*Math.sin(r),y:n*Math.sin(e)*Math.sin(r),z:n*Math.cos(r)}
5},v.G=Ir,v.H=dr,v.I=em,v.J=Ip,v.K=function(n){if(Kt==null){const e=n.navigator?n.navigator.userAgent:null;Kt=!!n.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return Kt},v.L=class{constructor(n,e){this.target=n,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Gw((()=>this.process())),this.subscription=hi(this.target,"message",(r=>this.receive(r)),!1),this.globalScope=or(self)?n:window}registerMessageHandler(n,e){this.messageHandlers[n]=e}unregisterMessageHandler(n){delete this.messageHandlers[n]}sendAsync(n,e){return new Promise(((r,o)=>{const u=Math.round(1e18*Math.random()).toString(36).substring(0,10),d=e?hi(e.signal,"abort",(()=>{d==null||d.unsubscribe(),delete this.resolveRejects[u];const w={id:u,type:"<cancel>",origin:location.origin,targetMapId:n.targetMapId,sourceMapId:this.mapId};this.target.postMessage(w)}),Zw):null;this.resolveRejects[u]={resolve:w=>{d==null||d.unsubscribe(),r(w)},reject:w=>{d==null||d.unsubscribe(),o(w)}};const f=[],_=Object.assign(Object.assign({},n),{id:u,sourceMapId:this.mapId,origin:location.origin,data:Ds(n.data,f)});this.target.postMessage(_,{transfer:f})}))}receive(n){const e=n.data,r=e.id;if(!(e.origin!=="file://"&&location.origin!=="file://"&&e.origin!=="resource://android"&&location.origin!=="resource://android"&&e.origin!==location.origin||e.targetMapId&&this.mapId!==e.targetMapId)){if(e.type==="<cancel>"){delete this.tasks[r];const o=this.abortControllers[r];return delete this.abortControllers[r],void(o&&o.abort())}if(or(self)||e.mustQueue)return this.tasks[r]=e,this.taskQueue.push(r),void this.invoker.trigger();this.processTask(r,e)}}process(){if(this.taskQueue.length===0)return;const n=this.taskQueue.shift(),e=this.tasks[n];delete this.tasks[n],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(n,e)}processTask(n,e){return s(this,void 0,void 0,(function*(){if(e.type==="<response>"){const u=this.resolveRejects[n];return delete this.resolveRejects[n],u?void(e.error?u.reject(Ls(e.error)):u.resolve(Ls(e.data))):void 0}if(!this.messageHandlers[e.type])return void this.completeTask(n,new Error(`Could not find a registered handler for ${e.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const r=Ls(e.data),o=new AbortController;this.abortControllers[n]=o;try{const u=yield this.messageHandlers[e.type](e.sourceMapId,r,o);this.completeTask(n,null,u)}catch(u){this.completeTask(n,u)}}))}completeTask(n,e,r){const o=[];delete this.abortControllers[n];const u={id:n,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:e?Ds(e):null,data:Ds(r,o)};this.target.postMessage(u,{transfer:o})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},v.M=me,v.N=function(){var n=new De(16);return De!=Float32Array&&(n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0),n[0]=1,n[5]=1,n[10]=1,n[15]=1,n},v.O=function(n,e,r){var o,u,d,f,_,w,E,M,C,D,R,B,N=r[0],U=r[1],Z=r[2];return e===n?(n[12]=e[0]*N+e[4]*U+e[8]*Z+e[12],n[13]=e[1]*N+e[5]*U+e[9]*Z+e[13],n[14]=e[2]*N+e[6]*U+e[10]*Z+e[14],n[15]=e[3]*N+e[7]*U+e[11]*Z+e[15]):(u=e[1],d=e[2],f=e[3],_=e[4],w=e[5],E=e[6],M=e[7],C=e[8],D=e[9],R=e[10],B=e[11],n[0]=o=e[0],n[1]=u,n[2]=d,n[3]=f,n[4]=_,n[5]=w,n[6]=E,n[7]=M,n[8]=C,n[9]=D,n[10]=R,n[11]=B,n[12]=o*N+_*U+C*Z+e[12],n[13]=u*N+w*U+D*Z+e[13],n[14]=d*N+E*U+R*Z+e[14],n[15]=f*N+M*U+B*Z+e[15]),n},v.P=I,v.Q=function(n,e,r){var o=r[0],u=r[1],d=r[2];return n[0]=e[0]*o,n[1]=e[1]*o,n[2]=e[2]*o,n[3]=e[3]*o,n[4]=e[4]*u,n[5]=e[5]*u,n[6]=e[6]*u,n[7]=e[7]*u,n[8]=e[8]*d,n[9]=e[9]*d,n[10]=e[10]*d,n[11]=e[11]*d,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n},v.R=ai,v.S=function(n,e,r){var o=e[0],u=e[1],d=e[2],f=e[3],_=e[4],w=e[5],E=e[6],M=e[7],C=e[8],D=e[9],R=e[10],B=e[11],N=e[12],U=e[13],Z=e[14],ae=e[15],W=r[0],X=r[1],le=r[2],pe=r[3];return n[0]=W*o+X*_+le*C+pe*N,n[1]=W*u+X*w+le*D+pe*U,n[2]=W*d+X*E+le*R+pe*Z,n[3]=W*f+X*M+le*B+pe*ae,n[4]=(W=r[4])*o+(X=r[5])*_+(le=r[6])*C+(pe=r[7])*N,n[5]=W*u+X*w+le*D+pe*U,n[6]=W*d+X*E+le*R+pe*Z,n[7]=W*f+X*M+le*B+pe*ae,n[8]=(W=r[8])*o+(X=r[9])*_+(le=r[10])*C+(pe=r[11])*N,n[9]=W*u+X*w+le*D+pe*U,n[10]=W*d+X*E+le*R+pe*Z,n[11]=W*f+X*M+le*B+pe*ae,n[12]=(W=r[12])*o+(X=r[13])*_+(le=r[14])*C+(pe=r[15])*N,n[13]=W*u+X*w+le*D+pe*U,n[14]=W*d+X*E+le*R+pe*Z,n[15]=W*f+X*M+le*B+pe*ae,n},v.T=Gf,v.U=function(n,e){const r={};for(let o=0;o<e.length;o++){const u=e[o];u in n&&(r[u]=n[u])}return r},v.V=$o,v.W=pr,v.X=b_,v.Y=x_,v.Z=re,v._=s,v.a=$,v.a$=Ve,v.a0=Be,v.a1=yn,v.a2=Ci,v.a3=T_,v.a4=Jp,v.a5=pt,v.a6=function(n,e,r){if(!n)return e||{};if(!e)return n||{};const o=M_(n),u=M_(e);(function(f,_){_.removeAll&&(f.add.clear(),f.update.clear(),f.remove.clear(),_.remove.clear());for(const w of _.remove)f.add.delete(w),f.update.delete(w);for(const[w,E]of _.update){const M=f.update.get(w);M&&(_.update.set(w,Ww(M,E)),f.update.delete(w))}})(o,u);const d={};
5if((o.removeAll||u.removeAll)&&(d.removeAll=!0),d.remove=new Set([...o.remove,...u.remove]),d.add=new Map([...o.add,...u.add]),d.update=new Map([...o.update,...u.update]),d.remove.size&&d.add.size)for(const f of d.add.keys())d.remove.delete(f);return(function(f){const _={};return f.removeAll&&(_.removeAll=f.removeAll),f.remove&&(_.remove=Array.from(f.remove)),f.add&&(_.add=Array.from(f.add.values())),f.update&&(_.update=Array.from(f.update.values())),_})(d)},v.a7=function(n,e){const r=new Map;if(n==null||n.type==null)return r;if(n.type==="Feature"){const o=cm(n,e);return o==null?void 0:(r.set(o,n),r)}if(n.type==="FeatureCollection"){const o=new Set;for(const u of n.features){const d=cm(u,e);if(d==null||o.has(d))return;o.add(d),r.set(d,u)}return r}},v.a8=function(n,e,r){var o,u;const d=[];if(e.removeAll)n.clear();else if(e.remove)for(const f of e.remove){const _=n.get(f);_&&(d.push(_.geometry),n.delete(f))}if(e.add)for(const f of e.add){const _=cm(f,r);if(_==null)continue;const w=n.get(_);w&&d.push(w.geometry),d.push(f.geometry),n.set(_,f)}if(e.update)for(const f of e.update){const _=n.get(f.id);if(!_)continue;const w=!!f.newGeometry,E=f.removeAllProperties||((o=f.removeProperties)===null||o===void 0?void 0:o.length)>0||((u=f.addOrUpdateProperties)===null||u===void 0?void 0:u.length)>0;if(!w&&!E)continue;d.push(_.geometry);const M=Object.assign({},_);if(n.set(f.id,M),w&&(d.push(f.newGeometry),M.geometry=f.newGeometry),E){if(M.properties=f.removeAllProperties?{}:Object.assign({},M.properties||{}),f.removeProperties)for(const C of f.removeProperties)delete M.properties[C];if(f.addOrUpdateProperties)for(const{key:C,value:D}of f.addOrUpdateProperties)M.properties[C]=D}}return d},v.a9=Ku,v.aA=function(n,{uSize:e,uSizeT:r},{lowerSize:o,upperSize:u}){return n.kind==="source"?o/io:n.kind==="composite"?Ir.number(o/io,u/io,r):e},v.aB=function(n,e){var r=e[0],o=e[1],u=e[2],d=e[3],f=e[4],_=e[5],w=e[6],E=e[7],M=e[8],C=e[9],D=e[10],R=e[11],B=e[12],N=e[13],U=e[14],Z=e[15],ae=r*_-o*f,W=r*w-u*f,X=r*E-d*f,le=o*w-u*_,pe=o*E-d*_,Me=u*E-d*w,Ue=M*N-C*B,Oe=M*U-D*B,$e=M*Z-R*B,Qe=C*U-D*N,Ge=C*Z-R*N,Ne=D*Z-R*U,ze=ae*Ne-W*Ge+X*Qe+le*$e-pe*Oe+Me*Ue;return ze?(n[0]=(_*Ne-w*Ge+E*Qe)*(ze=1/ze),n[1]=(u*Ge-o*Ne-d*Qe)*ze,n[2]=(N*Me-U*pe+Z*le)*ze,n[3]=(D*pe-C*Me-R*le)*ze,n[4]=(w*$e-f*Ne-E*Oe)*ze,n[5]=(r*Ne-u*$e+d*Oe)*ze,n[6]=(U*X-B*Me-Z*W)*ze,n[7]=(M*Me-D*X+R*W)*ze,n[8]=(f*Ge-_*$e+E*Ue)*ze,n[9]=(o*$e-r*Ge-d*Ue)*ze,n[10]=(B*pe-N*X+Z*ae)*ze,n[11]=(C*X-M*pe-R*ae)*ze,n[12]=(_*Oe-f*Qe-w*Ue)*ze,n[13]=(r*Qe-o*Oe+u*Ue)*ze,n[14]=(N*W-B*le-U*ae)*ze,n[15]=(M*le-C*W+D*ae)*ze,n):null},v.aC=We,v.aD=function(n){var e=n[0],r=n[1];return Math.sqrt(e*e+r*r)},v.aE=function(n){return n[0]=0,n[1]=0,n},v.aF=function(n,e,r){return n[0]=e[0]*r,n[1]=e[1]*r,n},v.aG=nm,v.aH=ct,v.aI=function(n,e,r,o){const u=e.y-n.y,d=e.x-n.x,f=o.y-r.y,_=o.x-r.x,w=f*d-_*u;if(w===0)return null;const E=(_*(n.y-r.y)-f*(n.x-r.x))/w;return new I(n.x+E*d,n.y+E*u)},v.aJ=l0,v.aK=ic,v.aL=function(n){let e=1/0,r=1/0,o=-1/0,u=-1/0;for(const d of n)e=Math.min(e,d.x),r=Math.min(r,d.y),o=Math.max(o,d.x),u=Math.max(u,d.y);return[e,r,o,u]},v.aM=bn,v.aN=Ht,v.aO=function(n,e,r,o,u=!1){if(!r[0]&&!r[1])return[0,0];const d=u?o==="map"?-n.bearingInRadians:0:o==="viewport"?n.bearingInRadians:0;if(d){const f=Math.sin(d),_=Math.cos(d);r=[r[0]*_-r[1]*f,r[0]*f+r[1]*_]}return[u?r[0]:Ht(e,r[0],n.zoom),u?r[1]:Ht(e,r[1],n.zoom)]},v.aQ=rm,v.aR=Mm,v.aS=tm,v.aT=Im,v.aU=Wr,v.aV=Zp,v.aW=Y,v.aX=tt,v.aY=Le,v.aZ=on,v.a_=S_,v.aa=Ws,v.ab=25,v.ac=lm,v.ad=n=>{const e=window.document.createElement("video");return e.muted=!0,new Promise((r=>{e.onloadstart=()=>{r(e)};for(const o of n){const u=window.document.createElement("source");Pe(o)||(e.crossOrigin="Anonymous"),u.src=o,e.appendChild(u)}}))},v.ae=He,v.af=function(){return en++},v.ag=p,v.ah=pc,v.ai=eh,v.aj=Ts,v.ak=Ma,v.al=A_,v.am=function(n){const e={};if(n.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((r,o,u,d)=>{const f=u||d;return e[o]=!f||f.toLowerCase(),""})),e["max-age"]){const r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e},v.an=Yt,v.ao=85.051129,v.ap=On,v.aq=function(n){return Math.pow(2,n)},v.ar=ye,v.as=w_,v.at=function(n){return Math.log(n)/Math.LN2},v.au=function(n){var e=n[0],r=n[1];return e*e+r*r},v.av=function(n){if(!n.length)return new Set;const e=Math.max(...n.map((w=>w.canonical.z)));let r=1/0,o=-1/0,u=1/0,d=-1/0;const f=[];for(const w of n){const{x:E,y:M,z:C}
vendor: 99,287 bytes, line 5
5=w.canonical,D=Math.pow(2,e-C),R=E*D,B=M*D;f.push({id:w,x:R,y:B}),R<r&&(r=R),R>o&&(o=R),B<u&&(u=B),B>d&&(d=B)}const _=new Set;for(const w of f)w.x!==r&&w.x!==o&&w.y!==u&&w.y!==d||_.add(w.id);return _},v.aw=function(n,e){const r=Math.abs(2*n.wrap)-+(n.wrap<0),o=Math.abs(2*e.wrap)-+(e.wrap<0);return n.overscaledZ-e.overscaledZ||o-r||e.canonical.y-n.canonical.y||e.canonical.x-n.canonical.x},v.ax=class{constructor(n,e){this.max=n,this.onRemove=e,this.reset()}reset(){for(const n in this.data)for(const e of this.data[n])e.timeout&&clearTimeout(e.timeout),this.onRemove(e.value);return this.data={},this.order=[],this}add(n,e,r){const o=n.wrapped().key;this.data[o]===void 0&&(this.data[o]=[]);const u={value:e,timeout:void 0};if(r!==void 0&&(u.timeout=setTimeout((()=>{this.remove(n,u)}),r)),this.data[o].push(u),this.order.push(o),this.order.length>this.max){const d=this._getAndRemoveByKey(this.order[0]);d&&this.onRemove(d)}return this}has(n){return n.wrapped().key in this.data}getAndRemove(n){return this.has(n)?this._getAndRemoveByKey(n.wrapped().key):null}_getAndRemoveByKey(n){const e=this.data[n].shift();return e.timeout&&clearTimeout(e.timeout),this.data[n].length===0&&delete this.data[n],this.order.splice(this.order.indexOf(n),1),e.value}getByKey(n){const e=this.data[n];return e?e[0].value:null}get(n){return this.has(n)?this.data[n.wrapped().key][0].value:null}remove(n,e){if(!this.has(n))return this;const r=n.wrapped().key,o=e===void 0?0:this.data[r].indexOf(e),u=this.data[r][o];return this.data[r].splice(o,1),u.timeout&&clearTimeout(u.timeout),this.data[r].length===0&&delete this.data[r],this.onRemove(u.value),this.order.splice(this.order.indexOf(r),1),this}setMaxSize(n){for(this.max=n;this.order.length>this.max;){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(n){const e=[];for(const r in this.data)for(const o of this.data[r])n(o.value)||e.push(o);for(const r of e)this.remove(r.value.tileID,r)}},v.ay=function(n,e){let r=0,o=0;if(n.kind==="constant")o=n.layoutSize;else if(n.kind!=="source"){const{interpolationType:u,minZoom:d,maxZoom:f}=n,_=u?Yt($n.interpolationFactor(u,e,d,f),0,1):0;n.kind==="camera"?o=Ir.number(n.minSize,n.maxSize,_):r=_}return{uSizeT:r,uSize:o}},v.b=fn,v.b$=ro,v.b0=Je,v.b1=function(n){var e=new De(3);return e[0]=n[0],e[1]=n[1],e[2]=n[2],e},v.b2=function(n,e,r){return n[0]=e[0]-r[0],n[1]=e[1]-r[1],n[2]=e[2]-r[2],n},v.b3=function(n,e){var r=e[0],o=e[1],u=e[2],d=r*r+o*o+u*u;return d>0&&(d=1/Math.sqrt(d)),n[0]=e[0]*d,n[1]=e[1]*d,n[2]=e[2]*d,n},v.b4=ft,v.b5=function(n,e){return n[0]*e[0]+n[1]*e[1]+n[2]*e[2]},v.b6=function(n,e,r){return n[0]=e[0]*r[0],n[1]=e[1]*r[1],n[2]=e[2]*r[2],n[3]=e[3]*r[3],n},v.b7=Ie,v.b8=function(n,e,r){const o=e[0]*r[0]+e[1]*r[1]+e[2]*r[2];return o===0?null:(-(n[0]*r[0]+n[1]*r[1]+n[2]*r[2])-r[3])/o},v.b9=nt,v.bA=function(n,e,r,o){return n[0]=e[0]+r[0]*o,n[1]=e[1]+r[1]*o,n[2]=e[2]+r[2]*o,n},v.bB=Pt,v.bC=function(n,e,r){var o=r[0],u=r[1],d=r[2],f=r[3],_=e[0],w=e[1],E=e[2],M=u*E-d*w,C=d*_-o*E,D=o*w-u*_;return n[0]=_+f*(M+=M)+u*(D+=D)-d*(C+=C),n[1]=w+f*C+d*M-o*D,n[2]=E+f*D+o*C-u*M,n},v.bD=function(n,e,r){const o=(function(w){var E=w[3],M=w[4],C=w[5],D=w[6],R=w[7],B=w[8];return w[0]*(B*M-C*R)+w[1]*(-B*E+C*D)+w[2]*(R*E-M*D)})([n[0],n[1],n[2],e[0],e[1],e[2],r[0],r[1],r[2]]);if(o===0)return null;const u=ft([],[e[0],e[1],e[2]],[r[0],r[1],r[2]]),d=ft([],[r[0],r[1],r[2]],[n[0],n[1],n[2]]),f=ft([],[n[0],n[1],n[2]],[e[0],e[1],e[2]]),_=Ve([],u,-n[3]);return Je(_,_,Ve([],d,-e[3])),Je(_,_,Ve([],f,-r[3])),Ve(_,_,1/o),_},v.bE=sm,v.bF=function(){return new Float64Array(4)},v.bG=function(n,e,r,o){var u=[],d=[];return u[0]=e[0]-r[0],u[1]=e[1]-r[1],u[2]=e[2]-r[2],d[0]=u[0]*Math.cos(o)-u[1]*Math.sin(o),d[1]=u[0]*Math.sin(o)+u[1]*Math.cos(o),d[2]=u[2],n[0]=d[0]+r[0],n[1]=d[1]+r[1],n[2]=d[2]+r[2],n},v.bH=function(n,e,r,o){var u=[],d=[];return u[0]=e[0]-r[0],u[1]=e[1]-r[1],u[2]=e[2]-r[2],d[0]=u[0],d[1]=u[1]*Math.cos(o)-u[2]*Math.sin(o),d[2]=u[1]*Math.sin(o)+u[2]*Math.cos(o),n[0]=d[0]+r[0],n[1]=d[1]+r[1],n[2]=d[2]+r[2],n},v.bI=function(n,e,r,o){var u=[],d=[];return u[0]=e[0]-r[0],u[1]=e[1]-r[1],u[2]=e[2]-r[2],d[0]=u[2]*Math.sin(o)+u[0]*Math.cos(o),d[1]=u[1],d[2]=u[2]*Math.cos(o)-u[0]*Math.sin(o),n[0]=d[0]+r[0],n[1]=d[1]+r[1],n[2]=d[2]+r[2],n},v.bJ=function(n,e,r){var o=Math.sin(r),u=Math.cos(r),d=e[0],f=e[1],_=e[2],w=e[3],E=e[8],M=e[9],C=e[10],D=e[11];return e!==n&&(n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15]),n[0]=d*u-E*o,n[1]=f*u-M*o,n[2]=_*u-C*o,n[3]=w*u-D*o,n[8]=d*o+E*u,n[9]=f*o+M*u,n[10]=_*o+C*u,n[11]=w*o+D*u,n},v.bK=function(n,e){const r=ar(n,360),o=ar(e,360),u=o-r,d=o>r?u-360:u+360;return Math.abs(u)<Math.abs(d)?u:d},v.bL=function(n){return n[0]=0,n[1]=0,n[2]=0,n},v.bM=function(n,e,r,o){const u=Math.sqrt(n*n+e*e),d=Math.sqrt(r*r+o*o);n/=u,e/=u,r/=d,o/=d;const f=Math.acos(n*r+e*o);return-e*r+n*o>0?f:-f},v.bN=function(n,e){const r=ar(n,2*Math.PI),o=ar(e,2*Math.PI);return Math.min(Math.abs(r-o),Math.abs(r-o+2*Math.PI),Math.abs(r-o-2*Math.PI))},v.bO=function(){const n={},e=Te.$version;for(const r in Te.$root){const o=Te.$root[r];if(o.required){let u=null;u=r==="version"?e:o.type==="array"?[]:{},u!=null&&(n[r]=u)}}return n},v.bP=be,v.bQ=Su,v.bR=function n(e,r){if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(let o=0;o<e.length;o++)if(!n(e[o],r[o]))return!1;return!0}if(typeof e=="object"&&e!==null&&r!==null){if(typeof r!="object"||Object.keys(e).length!==Object.keys(r).length)return!1;for(const o in e)if(!n(e[o],r[o]))return!1;return!0}return e===r},v.bS=function(n){n=n.slice();const e=Object.create(null);for(let r=0;r<n.length;r++)e[n[r].id]=n[r];for(let r=0;r<n.length;r++)"ref"in n[r]&&(n[r]=Lt(n[r],e[n[r].ref]));return n},v.bT=function(n,e){if(n.type==="custom")return new qw(n,e);switch(n.type){case"background":return new $w(n,e);case"circle":return new M1(n,e);case"color-relief":return new L1(n,e);case"fill":return new H1(n,e);case"fill-extrusion":return new ow(n,e);case"heatmap":return new A1(n,e);case"hillshade":return new k1(n,e);case"line":return new dw(n,e);case"raster":return new Ff(n,e);case"symbol":return new Kp(n,e)}},v.bU=n=>n.type==="raster",v.bV=jt,v.bW=function(n,e){if(!n)return[{command:"setStyle",args:[e]}];let r=[];try{if(!yt(n.version,e.version))return[{command:"setStyle",args:[e]}];yt(n.center,e.center)||r.push({command:"setCenter",args:[e.center]}),yt(n.state,e.state)||r.push({command:"setGlobalState",args:[e.state]}),yt(n.centerAltitude,e.centerAltitude)||r.push({command:"setCenterAltitude",args:[e.centerAltitude]}),yt(n.zoom,e.zoom)||r.push({command:"setZoom",args:[e.zoom]}),yt(n.bearing,e.bearing)||r.push({command:"setBearing",args:[e.bearing]}),yt(n.pitch,e.pitch)||r.push({command:"setPitch",args:[e.pitch]}),yt(n.roll,e.roll)||r.push({command:"setRoll",args:[e.roll]}),yt(n.sprite,e.sprite)||r.push({command:"setSprite",args:[e.sprite]}),yt(n.glyphs,e.glyphs)||r.push({command:"setGlyphs",args:[e.glyphs]}),yt(n.transition,e.transition)||r.push({command:"setTransition",args:[e.transition]}),yt(n.light,e.light)||r.push({command:"setLight",args:[e.light]}),yt(n.terrain,e.terrain)||r.push({command:"setTerrain",args:[e.terrain]}),yt(n.sky,e.sky)||r.push({command:"setSky",args:[e.sky]}),yt(n.projection,e.projection)||r.push({command:"setProjection",args:[e.projection]});const o={},u=[];(function(f,_,w,E){let M;for(M in _=_||{},f=f||{})Object.prototype.hasOwnProperty.call(f,M)&&(Object.prototype.hasOwnProperty.call(_,M)||Er(M,w,E));for(M in _)Object.prototype.hasOwnProperty.call(_,M)&&(Object.prototype.hasOwnProperty.call(f,M)?yt(f[M],_[M])||(f[M].type==="geojson"&&_[M].type==="geojson"&&gr(f,_,M)?tr(w,{command:"setGeoJSONSourceData",args:[M,_[M].data]}):Or(M,_,w,E)):sn(M,_,w))})(n.sources,e.sources,u,o);const d=[];n.layers&&n.layers.forEach((f=>{"source"in f&&o[f.source]?r.push({command:"removeLayer",args:[f.id]}):d.push(f)})),r=r.concat(u),(function(f,_,w){_=_||[];const E=(f=f||[]).map(ns),M=_.map(ns),C=f.reduce(is,{}),D=_.reduce(is,{}),R=E.slice(),B=Object.create(null);let N,U,Z,ae,W;for(let X=0,le=0;X<E.length;X++)N=E[X],Object.prototype.hasOwnProperty.call(D,N)?le++:(tr(w,{command:"removeLayer",args:[N]}),R.splice(R.indexOf(N,le),1));for(let X=0,le=0;X<M.length;X++)N=M[M.length-1-X],R[R.length-1-X]!==N&&(Object.prototype.hasOwnProperty.call(C,N)?(tr(w,{command:"removeLayer",args:[N]}),R.splice(R.lastIndexOf(N,R.length-le),1)):le++,ae=R[R.length-X],tr(w,{command:"addLayer",args:[D[N],ae]}),R.splice(R.length-X,0,N),B[N]=!0);for(let X=0;X<M.length;X++)if(N=M[X],U=C[N],Z=D[N],!B[N]&&!yt(U,Z))if(yt(U.source,Z.source)&&yt(U["source-layer"],Z["source-layer"])&&yt(U.type,Z.type)){for(W in ln(U.layout,Z.layout,w,N,null,"setLayoutProperty"),ln(U.paint,Z.paint,w,N,null,"setPaintProperty"),yt(U.filter,Z.filter)||tr(w,{command:"setFilter",args:[N,Z.filter]}),yt(U.minzoom,Z.minzoom)&&yt(U.maxzoom,Z.maxzoom)||tr(w,{command:"setLayerZoomRange",args:[N,Z.minzoom,Z.maxzoom]}),U)Object.prototype.hasOwnProperty.call(U,W)&&W!=="layout"&&W!=="paint"&&W!=="filter"&&W!=="metadata"&&W!=="minzoom"&&W!=="maxzoom"&&(W.indexOf("paint.")===0?ln(U[W],Z[W],w,N,W.slice(6),"setPaintProperty"):yt(U[W],Z[W])||tr(w,{command:"setLayerProperty",args:[N,W,Z[W]]}));for(W in Z)Object.prototype.hasOwnProperty.call(Z,W)&&!Object.prototype.hasOwnProperty.call(U,W)&&W!=="layout"&&W!=="paint"&&W!=="filter"&&W!=="metadata"&&W!=="minzoom"&&W!=="maxzoom"&&(W.indexOf("paint.")===0?ln(U[W],Z[W],w,N,W.slice(6),"setPaintProperty"):yt(U[W],Z[W])||tr(w,{command:"setLayerProperty",args:[N,W,Z[W]]}))}else tr(w,{command:"removeLayer",args:[N]}),ae=R[R.lastIndexOf(N)+1],tr(w,{command:"addLayer",args:[Z,ae]})})(d,e.layers,r)}catch(o){console.warn("Unable to compute style diff:",o),r=[{command:"setStyle",args:[e]}]}return r},v.bX=function(n){const e=[],r=n.id;return r===void 0&&e.push({message:`layers.${r}: missing required property "id"`}),n.render===void 0&&e.push({message:`layers.${r}: missing required method "render"`}),n.renderingMode&&n.renderingMode!=="2d"&&n.renderingMode!=="3d"&&e.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),e},v.bY=an,v.bZ=kn,v.b_=class extends Kn{constructor(n,e){super(n,e),this.current=0}set(n){this.current!==n&&(this.current=n,this.gl.uniform1i(this.location,n))}},v.ba=function(n,e,r){return n[0]=e[0]*r,n[1]=e[1]*r,n[2]=e[2]*r,n[3]=e[3]*r,n},v.bb=function(n,e){return n[0]*e[0]+n[1]*e[1]+n[2]*e[2]+n[3]},v.bc=P_,v.bd=dc,v.be=function(n,e,r,o,u){var d=1/Math.tan(e/2);if(n[0]=d/r,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=d,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[11]=-1,n[12]=0,n[13]=0,n[15]=0,u!=null&&u!==1/0){var f=1/(o-u);n[10]=(u+o)*f,n[14]=2*u*o*f}else n[10]=-1,n[14]=-2*o;return n},v.bf=function(n){var e=new De(16);return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],e},v.bg=function(n,e,r){var o=Math.sin(r),u=Math.cos(r),d=e[0],f=e[1],_=e[2],w=e[3],E=e[4],M=e[5],C=e[6],D=e[7];return e!==n&&(n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15]),n[0]=d*u+E*o,n[1]=f*u+M*o,n[2]=_*u+C*o,n[3]=w*u+D*o,n[4]=E*u-d*o,n[5]=M*u-f*o,n[6]=C*u-_*o,n[7]=D*u-w*o,n},v.bh=function(n,e,r){var o=Math.sin(r),u=Math.cos(r),d=e[4],f=e[5],_=e[6],w=e[7],E=e[8],M=e[9],C=e[10],D=e[11];return e!==n&&(n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15]),n[4]=d*u+E*o,n[5]=f*u+M*o,n[6]=_*u+C*o,n[7]=w*u+D*o,n[8]=E*u-d*o,n[9]=M*u-f*o,n[10]=C*u-_*o,n[11]=D*u-w*o,n},v.bi=function(){const n=new Float32Array(16);return ye(n),n},v.bj=function(){const n=new Float64Array(16);return ye(n),n},v.bk=function(){return new Float64Array(16)},v.bl=function(n,e,r){const o=new Float64Array(4);return Pt(o,n,e-90,r),o},v.bm=function(n,e,r,o){var u,d,f,_,w,E=e[0],M=e[1],C=e[2],D=e[3],R=r[0],B=r[1],N=r[2],U=r[3];return(d=E*R+M*B+C*N+D*U)<0&&(d=-d,R=-R,B=-B,N=-N,U=-U),1-d>Ae?(u=Math.acos(d),f=Math.sin(u),_=Math.sin((1-o)*u)/f,w=Math.sin(o*u)/f):(_=1-o,w=o),n[0]=_*E+w*R,n[1]=_*M+w*B,n[2]=_*C+w*N,n[3]=_*D+w*U,n},v.bn=function(n){const e=new Float64Array(9);(function(d,f){var _=f[0],w=f[1],E=f[2],M=f[3],C=_+_,D=w+w,R=E+E,B=_*C,N=w*C,U=w*D,Z=E*C,ae=E*D,W=E*R,X=M*C,le=M*D,pe=M*R;d[0]=1-U-W,d[3]=N-pe,d[6]=Z+le,d[1]=N+pe,d[4]=1-B-W,d[7]=ae-X,d[2]=Z-le,d[5]=ae+X,d[8]=1-B-U})(e,n);const r=on(-Math.asin(Yt(e[2],-1,1)));let o,u;return Math.hypot(e[5],e[8])<.001?(o=0,u=-on(Math.atan2(e[3],e[4]))):(o=on(e[5]===0&&e[8]===0?0:Math.atan2(e[5],e[8])),u=on(e[1]===0&&e[0]===0?0:Math.atan2(e[1],e[0]))),{roll:o,pitch:r+90,bearing:u}},v.bo=function(n,e){return n.roll==e.roll&&n.pitch==e.pitch&&n.bearing==e.bearing},v.bp=Nt,v.bq=to,v.br=cc,v.bs=Gu,v.bt=lc,v.bu=mr,v.bv=Rt,v.bw=Un,v.bx=function(n,e,r,o,u){return mr(o,u,Yt((n-e)/(r-e),0,1))},v.by=ar,v.bz=function(){return new Float64Array(3)},v.c=se,v.c$=function(n,e,r,o,u){return s(this,void 0,void 0,(function*(){if(Be())try{return yield yn(n,e,r,o,u)}catch{}return(function(d,f,_,w,E){const M=d.width,C=d.height;In&&_n||(In=new OffscreenCanvas(M,C),_n=In.getContext("2d",{willReadFrequently:!0})),In.width=M,In.height=C,_n.drawImage(d,0,0,M,C);const D=_n.getImageData(f,_,w,E);return _n.clearRect(0,0,M,C),D.data})(n,e,r,o,u)}))},v.c0=class extends Kn{constructor(n,e){super(n,e),this.current=yi}set(n){if(n[12]!==this.current[12]||n[0]!==this.current[0])return this.current=n,void this.gl.uniformMatrix4fv(this.location,!1,n);for(let e=1;e<16;e++)if(n[e]!==this.current[e]){this.current=n,this.gl.uniformMatrix4fv(this.location,!1,n);break}}},v.c1=qs,v.c2=class extends Kn{constructor(n,e){super(n,e),this.current=[0,0,0]}set(n){n[0]===this.current[0]&&n[1]===this.current[1]&&n[2]===this.current[2]||(this.current=n,this.gl.uniform3f(this.location,n[0],n[1],n[2]))}},v.c3=class extends Kn{constructor(n,e){super(n,e),this.current=[0,0]}set(n){n[0]===this.current[0]&&n[1]===this.current[1]||(this.current=n,this.gl.uniform2f(this.location,n[0],n[1]))}},v.c4=xe,v.c5=function(n,e){var r=Math.sin(e),o=Math.cos(e);return n[0]=o,n[1]=r,n[2]=0,n[3]=-r,n[4]=o,n[5]=0,n[6]=0,n[7]=0,n[8]=1,n},v.c6=function(n,e,r){var o=e[0],u=e[1],d=e[2];return n[0]=o*r[0]+u*r[3]+d*r[6],n[1]=o*r[1]+u*r[4]+d*r[7],n[2]=o*r[2]+u*r[5]+d*r[8],n},v.c7=function(n,e,r,o,u,d,f){var _=1/(e-r),w=1/(o-u),E=1/(d-f);return n[0]=-2*_,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=-2*w,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=2*E,n[11]=0,n[12]=(e+r)*_,n[13]=(u+o)*w,n[14]=(f+d)*E,n[15]=1,n},v.c8=class extends Kn{constructor(n,e){super(n,e),this.current=new Array}set(n){if(n!=this.current){this.current=n;const e=new Float32Array(4*n.length);for(let r=0;r<n.length;r++)e[4*r]=n[r].r,e[4*r+1]=n[r].g,e[4*r+2]=n[r].b,e[4*r+3]=n[r].a;this.gl.uniform4fv(this.location,e)}}},v.c9=class extends Kn{constructor(n,e){super(n,e),this.current=new Array}set(n){if(n!=this.current){this.current=n;const e=new Float32Array(n);this.gl.uniform1fv(this.location,e)}}},v.cA=function(n,e){return Ee[e]&&"touches"in n},v.cB=function(n){return Ee[n]||q[n]},v.cC=function(n,e,r){var o=e[0],u=e[1];return n[0]=r[0]*o+r[4]*u+r[12],n[1]=r[1]*o+r[5]*u+r[13],n},v.cD=function(n,e){const{x:r,y:o}=Ku.fromLngLat(e);return!(n<0||n>25||o<0||o>=1||r<0||r>=1)},v.cE=function(n,e){return n[0]=e[0],n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=e[1],n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=e[2],n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n},v.cF=class extends Kl{},v.cG=C2,v.cI=ne,v.cJ=function(n,e){se.REGISTERED_PROTOCOLS[n]=e},v.cK=function(n){delete se.REGISTERED_PROTOCOLS[n]},v.cL=function(n,e){const r={};for(let u=0;u<n.length;u++){const d=e&&e[n[u].id]||yp(n[u]);e&&(e[n[u].id]=d);let f=r[d];f||(f=r[d]=[]),f.push(n[u])}const o=[];for(const u in r)o.push(r[u]);return o},v.cM=ht,v.cN=I_,v.cO=o0,v.cP=c_,v.cQ=function(n){n.bucket.createArrays(),n.bucket.tilePixelRatio=pt/(512*n.bucket.overscaling),n.bucket.compareText={},n.bucket.iconsNeedLinear=!1;const e=n.bucket.layers[0],r=e.layout,o=e._unevaluatedLayout._values,u={layoutIconSize:o["icon-size"].possiblyEvaluate(new dr(n.bucket.zoom+1),n.canonical),layoutTextSize:o["text-size"].possiblyEvaluate(new dr(n.bucket.zoom+1),n.canonical),textMaxSize:o["text-size"].possiblyEvaluate(new dr(18))};if(n.bucket.textSizeData.kind==="composite"){const{minZoom:E,maxZoom:M}=n.bucket.textSizeData;u.compositeTextSizes=[o["text-size"].possiblyEvaluate(new dr(E),n.canonical),o["text-size"].possiblyEvaluate(new dr(M),n.canonical)]}if(n.bucket.iconSizeData.kind==="composite"){const{minZoom:E,maxZoom:M}=n.bucket.iconSizeData;u.compositeIconSizes=[o["icon-size"].possiblyEvaluate(new dr(E),n.canonical),o["icon-size"].possiblyEvaluate(new dr(M),n.canonical)]}const d=r.get("text-line-height")*bn,f=r.get("text-rotation-alignment")!=="viewport"&&r.get("symbol-placement")!=="point",_=r.get("text-keep-upright"),w=r.get("text-size");for(const E of n.bucket.features){const M=r.get("text-font").evaluate(E,{},n.canonical).join(","),C=w.evaluate(E,{},n.canonical),D=u.layoutTextSize.evaluate(E,{},n.canonical),R=u.layoutIconSize.evaluate(E,{},n.canonical),B={horizontal:{},vertical:void 0},N=E.text;let U,Z=[0,0];if(N){const X=N.toString(),le=r.get("text-letter-spacing").evaluate(E,{},n.canonical)*bn,pe=Rf(X)?le:0,Me=r.get("text-anchor").evaluate(E,{},n.canonical),Ue=v0(e,E,n.canonical);if(!Ue){const Ge=r.get("text-radial-offset").evaluate(E,{},n.canonical);Z=Ge?_0(Me,[Ge*bn,Pm]):r.get("text-offset").evaluate(E,{},n.canonical).map((Ne=>Ne*bn))}let Oe=f?"center":r.get("text-justify").evaluate(E,{},n.canonical);const $e=r.get("symbol-placement")==="point"?r.get("text-max-width").evaluate(E,{},n.canonical)*bn:1/0,Qe=()=>{n.bucket.allowVerticalPlacement&&No(X)&&(B.vertical=Xp(N,n.glyphMap,n.glyphPositions,n.imagePositions,M,$e,d,Me,"left",pe,Z,v.az.vertical,!0,D,C))};if(!f&&Ue){const Ge=new Set;if(Oe==="auto")for(let ze=0;ze<Ue.values.length;ze+=2)Ge.add(Mm(Ue.values[ze]));else Ge.add(Oe);let Ne=!1;for(const ze of Ge)if(!B.horizontal[ze])if(Ne)B.horizontal[ze]=B.horizontal[0];else{const ut=Xp(N,n.glyphMap,n.glyphPositions,n.imagePositions,M,$e,d,"center",ze,pe,Z,v.az.horizontal,!1,D,C);ut&&(B.horizontal[ze]=ut,Ne=ut.positionedLines.length===1)}Qe()}else{Oe==="auto"&&(Oe=Mm(Me));const Ge=Xp(N,n.glyphMap,n.glyphPositions,n.imagePositions,M,$e,d,Me,Oe,pe,Z,v.az.horizontal,!1,D,C);Ge&&(B.horizontal[Oe]=Ge),Qe(),No(X)&&f&&_&&(B.vertical=Xp(N,n.glyphMap,n.glyphPositions,n.imagePositions,M,$e,d,Me,Oe,pe,Z,v.az.vertical,!1,D,C))}}let ae=!1;if(E.icon&&E.icon.name){const X=n.imageMap[E.icon.name];X&&(U=Nw(n.imagePositions[E.icon.name],r.get("icon-offset").evaluate(E,{},n.canonical),r.get("icon-anchor").evaluate(E,{},n.canonical)),ae=!!X.sdf,n.bucket.sdfIcons===void 0?n.bucket.sdfIcons=ae:n.bucket.sdfIcons!==ae&&ur("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(X.pixelRatio!==n.bucket.pixelRatio||r.get("icon-rotate").constantOr(1)!==0)&&(n.bucket.iconsNeedLinear=!0))}const W=b0(B.horizontal)||B.vertical;n.bucket.iconsInText=!!W&&W.iconsInText,(W||U)&&I2(n.bucket,E,B,U,n.imageMap,u,D,R,Z,ae,n.canonical,n.subdivisionGranularity)}n.showCollisionBoxes&&n.bucket.generateCollisionDebugBuffers()},v.cR=Xf,v.cS=Kf,v.cT=Jf,v.cU=function(n){const e=new Hp;return(function(r,o){for(const u in r.layers)o.writeMessage(3,f2,r.layers[u])})(n,e),e.finish()},v.cV=function(n,e,r,o,u,d){let f=c0(n,e,r,u,0);return f=c0(f,e,o,d,1),f},v.cW=class{constructor(n){this.maxEntries=n,this.map=new Map}get(n){const e=this.map.get(n);return e!==void 0&&(this.map.delete(n),this.map.set(n,e)),e}set(n,e){if(this.map.has(n))this.map.delete(n);else if(this.map.size>=this.maxEntries){const r=this.map.keys().next().value;this.map.delete(r)}this.map.set(n,e)}clear(){this.map.clear()}},v.cX=Gy,v.cY=Hp,v.cZ=i0,v.c_=class{constructor(n){this._marks={start:[n.url,"start"].join("#"),end:[n.url,"end"].join("#"),measure:n.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let n=performance.getEntriesByName(this._marks.measure);return n.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),n=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),n}},v.ca=class extends Qa{},v.cb=yw,v.cc=class extends $s{},v.cd=qf,v.ce=function(n){return n<=1?1:Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))},v.cf=Cy,v.cg=function(n,e,r){var o=e[0],u=e[1],d=e[2],f=r[3]*o+r[7]*u+r[11]*d+r[15];return n[0]=(r[0]*o+r[4]*u+r[8]*d+r[12])/(f=f||1),n[1]=(r[1]*o+r[5]*u+r[9]*d+r[13])/f,n[2]=(r[2]*o+r[6]*u+r[10]*d+r[14])/f,n},v.ch=class extends ku{},v.ci=class extends t{},v.cj=function(n,e){return n[0]===e[0]&&n[1]===e[1]&&n[2]===e[2]&&n[3]===e[3]&&n[4]===e[4]&&n[5]===e[5]&&n[6]===e[6]&&n[7]===e[7]&&n[8]===e[8]&&n[9]===e[9]&&n[10]===e[10]&&n[11]===e[11]&&n[12]===e[12]&&n[13]===e[13]&&n[14]===e[14]&&n[15]===e[15]},v.ck=function(n,e){var r=n[0],o=n[1],u=n[2],d=n[3],f=n[4],_=n[5],w=n[6],E=n[7],M=n[8],C=n[9],D=n[10],R=n[11],B=n[12],N=n[13],U=n[14],Z=n[15],ae=e[0],W=e[1],X=e[2],le=e[3],pe=e[4],Me=e[5],Ue=e[6],Oe=e[7],$e=e[8],Qe=e[9],Ge=e[10],Ne=e[11],ze=e[12],ut=e[13],st=e[14],dt=e[15];return Math.abs(r-ae)<=Ae*Math.max(1,Math.abs(r),Math.abs(ae))&&Math.abs(o-W)<=Ae*Math.max(1,Math.abs(o),Math.abs(W))&&Math.abs(u-X)<=Ae*Math.max(1,Math.abs(u),Math.abs(X))&&Math.abs(d-le)<=Ae*Math.max(1,Math.abs(d),Math.abs(le))&&Math.abs(f-pe)<=Ae*Math.max(1,Math.abs(f),Math.abs(pe))&&Math.abs(_-Me)<=Ae*Math.max(1,Math.abs(_),Math.abs(Me))&&Math.abs(w-Ue)<=Ae*Math.max(1,Math.abs(w),Math.abs(Ue))&&Math.abs(E-Oe)<=Ae*Math.max(1,Math.abs(E),Math.abs(Oe))&&Math.abs(M-$e)<=Ae*Math.max(1,Math.abs(M),Math.abs($e))&&Math.abs(C-Qe)<=Ae*Math.max(1,Math.abs(C),Math.abs(Qe))&&Math.abs(D-Ge)<=Ae*Math.max(1,Math.abs(D),Math.abs(Ge))&&Math.abs(R-Ne)<=Ae*Math.max(1,Math.abs(R),Math.abs(Ne))&&Math.abs(B-ze)<=Ae*Math.max(1,Math.abs(B),Math.abs(ze))&&Math.abs(N-ut)<=Ae*Math.max(1,Math.abs(N),Math.abs(ut))&&Math.abs(U-st)<=Ae*Math.max(1,Math.abs(U),Math.abs(st))&&Math.abs(Z-dt)<=Ae*Math.max(1,Math.abs(Z),Math.abs(dt))},v.cl=function(n,e){return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n},v.cm=n=>n.type==="symbol",v.cn=n=>n.type==="circle",v.co=n=>n.type==="heatmap",v.cp=n=>n.type==="line",v.cq=n=>n.type==="fill",v.cr=n=>n.type==="fill-extrusion",v.cs=n=>n.type==="hillshade",v.ct=n=>n.type==="color-relief",v.cu=n=>n.type==="background",v.cv=n=>n.type==="custom",v.cw=Xt,v.cx=function(n,e,r){const o=Ut(e.x-r.x,e.y-r.y),u=Ut(n.x-r.x,n.y-r.y),d=Math.atan2(o[0]*u[1]-o[1]*u[0],(function(f,_){return f[0]*_[0]+f[1]*_[1]})(o,u));return on(d)},v.cy=Tt,v.cz=function(n,e){return q[e]&&(n instanceof MouseEvent||n instanceof WheelEvent)},v.d=Pe,v.d0=Ly,v.d1=L,v.d2=class{constructor(n,e){this.layers={[eh]:this},this.name=eh,this.version=e?e.version:1,this.extent=e?e.extent:4096,this.length=n.length,this.features=n}feature(n){return new d2(this.features[n],this.extent)}},v.d3=ws,v.d4=Ta,v.e=$t,v.f=n=>s(void 0,void 0,void 0,(function*(){if(n.byteLength===0)return createImageBitmap(new ImageData(1,1));const e=new Blob([new Uint8Array(n)],{type:"image/png"});try{return createImageBitmap(e)}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.`)}})),v.g=_e,v.h=n=>new Promise(((e,r)=>{const o=new Image;o.onload=()=>{e(o),URL.revokeObjectURL(o.src),o.onload=null,window.requestAnimationFrame((()=>{o.src=ti}))},o.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 u=new Blob([new Uint8Array(n)],{type:"image/png"});o.src=n.byteLength?URL.createObjectURL(u):ti})),v.i=or,v.j=(n,e)=>je($t(n,{type:"json"}),e),v.k=At,v.l=rt,v.m=je,v.n=(n,e)=>je($t(n,{type:"arrayBuffer"}),e),v.o=function(n){return new Hp(n).readFields(kw,[])},v.p=l_,v.q=function(n){return/[\u02EA\u02EB\u1100-\u11FF\u2E80-\u2FDF\u3000-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(n))},v.r=ju,v.s=hi,v.t=qn,v.u=Te,v.v=Cs,v.w=ur,v.x=Au,v.y=ks,v.z=zs})),x("worker",["./shared"],(function(v){class s{constructor(q,V){this.keyCache={},q&&this.replace(q,V)}replace(q,V){this._layerConfigs={},this._layers={},this.update(q,[],V)}update(q,V,$){for(const se of q){this._layerConfigs[se.id]=se;const _e=this._layers[se.id]=v.bT(se,$);_e._featureFilter=v.aj(_e.filter,$),this.keyCache[se.id]&&delete this.keyCache[se.id]}for(const se of V)delete this.keyCache[se],delete this._layerConfigs[se],delete this._layers[se];this.familiesBySource={};const re=v.cL(Object.values(this._layerConfigs),this.keyCache);for(const se of re){const _e=se.map((Ye=>this._layers[Ye.id])),me=_e[0];if(me.isHidden())continue;const ne=me.source||"";let be=this.familiesBySource[ne];be||(be=this.familiesBySource[ne]={});const je=me.sourceLayer||v.ai;let Pe=be[je];Pe||(Pe=be[je]=[]),Pe.push(_e)}}}class I{constructor(q){const V={},$=[];for(const me in q){const ne=q[me],be=V[me]={};for(const je in ne){const Pe=ne[+je];if(!Pe||Pe.bitmap.width===0||Pe.bitmap.height===0)continue;const Ye={x:0,y:0,w:Pe.bitmap.width+2,h:Pe.bitmap.height+2};$.push(Ye),be[je]={rect:Ye,metrics:Pe.metrics}}}const{w:re,h:se}=v.p($),_e=new v.r({width:re||1,height:se||1});for(const me in q){const ne=q[me];for(const be in ne){const je=ne[+be];if(!je||je.bitmap.width===0||je.bitmap.height===0)continue;const Pe=V[me][be].rect;v.r.copy(je.bitmap,_e,{x:0,y:0},{x:Pe.x+1,y:Pe.y+1},je.bitmap)}}this.image=_e,this.positions=V}}v.cM("GlyphAtlas",I);class L{constructor(q){this.tileID=new v.a2(q.tileID.overscaledZ,q.tileID.wrap,q.tileID.canonical.z,q.tileID.canonical.x,q.tileID.canonical.y),this.uid=q.uid,this.zoom=q.zoom,this.pixelRatio=q.pixelRatio,this.tileSize=q.tileSize,this.source=q.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=q.showCollisionBoxes,this.collectResourceTiming=!!q.collectResourceTiming,this.returnDependencies=!!q.returnDependencies,this.promoteId=q.promoteId,this.inFlightDependencies=[]}parse(q,V,$,re,se){return v._(this,void 0,void 0,(function*(){this.status="parsing",this.data=q,this.collisionBoxArray=new v.ag;const _e=new v.cN(Object.keys(q.layers).sort()),me=new v.cO(this.tileID,this.promoteId);me.bucketLayerIDs=[];const ne={},be={featureIndex:me,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:$,subdivisionGranularity:se},je=V.familiesBySource[this.source];for(const gr in je){const ln=q.layers[gr];if(!ln)continue;ln.version===1&&v.w(`Vector tile source "${this.source}" layer "${gr}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const ns=_e.encode(gr),is=[];for(let He=0;He<ln.length;He++){const Bn=ln.feature(He),Nn=me.getId(Bn,gr);is.push({feature:Bn,id:Nn,index:He,sourceLayerIndex:ns})}for(const He of je[gr]){const Bn=He[0];Bn.source!==this.source&&v.w(`layer.source = ${Bn.source} does not equal this.source = ${this.source}`),Bn.isHidden(this.zoom,!0)||(O(He,this.zoom,$),(ne[Bn.id]=Bn.createBucket({index:me.bucketLayerIDs.length,layers:He,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:ns,sourceID:this.source})).populate(is,be,this.tileID.canonical),me.bucketLayerIDs.push(He.map((Nn=>Nn.id))))}}const Pe=v.bY(be.glyphDependencies,(gr=>Object.keys(gr).map(Number)));this.inFlightDependencies.forEach((gr=>gr==null?void 0:gr.abort())),this.inFlightDependencies=[];let Ye=Promise.resolve({});if(Object.keys(Pe).length){const gr=new AbortController;this.inFlightDependencies.push(gr),Ye=re.sendAsync({type:"GG",data:{stacks:Pe,source:this.source,tileID:this.tileID,type:"glyphs"}},gr)}const it=Object.keys(be.iconDependencies);let rt=Promise.resolve({});if(it.length){const gr=new AbortController;this.inFlightDependencies.push(gr),rt=re.sendAsync({type:"GI",data:{icons:it,source:this.source,tileID:this.tileID,type:"icons"}},gr)}const At=Object.keys(be.patternDependencies);let St=Promise.resolve({});if(At.length){const gr=new AbortController;this.inFlightDependencies.push(gr),St=re.sendAsync({type:"GI",data:{icons:At,source:this.source,tileID:this.tileID,type:"patterns"}},gr)}const Te=be.dashDependencies;let Et=Promise.resolve({});if(Object.keys(Te).length){const gr=new AbortController;this.inFlightDependencies.push(gr),Et=re.sendAsync({type:"GDA",data:{dashes:Te}},gr)}const[Lt,yt,tr,sn]=yield Promise.all([Ye,rt,St,Et]),Er=new I(Lt),Or=new v.cP(yt,tr);for(const gr in ne){const ln=ne[gr];ln instanceof v.ah?(O(ln.layers,this.zoom,$),v.cQ({bucket:ln,glyphMap:Lt,glyphPositions:Er.positions,imageMap:yt,imagePositions:Or.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:be.subdivisionGranularity})):ln.hasDependencies&&(ln instanceof v.cR||ln instanceof v.cS||ln instanceof v.cT)&&(O(ln.layers,this.zoom,$),ln.addFeatures(be,this.tileID.canonical,Or.patternPositions,sn))}return this.status="done",{buckets:Object.values(ne).filter((gr=>!gr.isEmpty())),featureIndex:me,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Er.image,imageAtlas:Or,dashPositions:sn,glyphMap:this.returnDependencies?Lt:null,iconMap:this.returnDependencies?yt:null,glyphPositions:this.returnDependencies?Er.positions:null}}))}}function O(Ee,q,V){const $=new v.H(q);for(const re of Ee)re.recalculate($,V)}class H{constructor(q,V,$,re,se){this.type=q,this.properties=$||{},this.extent=se,this.pointsArray=V,this.id=re}loadGeometry(){return this.pointsArray.map((q=>q.map((V=>new v.P(V.x,V.y)))))}}class J{constructor(q,V,$){this.version=2,this._myFeatures=q,this.name=V,this.length=q.length,this.extent=$}feature(q){return this._myFeatures[q]}}class ee{constructor(){this.layers={}}addLayer(q){this.layers[q.name]=q}}function ue(Ee){let q=v.cU(Ee);return q.byteOffset===0&&q.byteLength===q.buffer.byteLength||(q=new Uint8Array(q)),{vectorTile:Ee,rawData:q.buffer}}function fe(Ee,q,V){const{extent:$}=Ee,re=Math.pow(2,V.z-q.z),se=(V.x-q.x*re)*$,_e=(V.y-q.y*re)*$,me=[];for(let ne=0;ne<Ee.length;ne++){const be=Ee.feature(ne);let je=be.loadGeometry();for(const Ye of je)for(const it of Ye)it.x=it.x*re-se,it.y=it.y*re-_e;const Pe=128;je=v.cV(je,be.type,-Pe,-Pe,$+Pe,$+Pe),je.length!==0&&me.push(new H(be.type,je,be.properties,be.id,$))}return new J(me,Ee.name,$)}class te{constructor(q,V,$){this.actor=q,this.layerIndex=V,this.availableImages=$,this.fetching={},this.loading={},this.loaded={},this.overzoomedTileResultCache=new v.cW(1e3)}loadVectorTile(q,V){return v._(this,void 0,void 0,(function*(){const $=yield v.n(q.request,V);try{return{vectorTile:q.encoding!=="mlt"?new v.cX(new v.cY($.data)):new v.cZ($.data),rawData:$.data,cacheControl:$.cacheControl,expires:$.expires}}catch(re){const se=new Uint8Array($.data);let _e=`Unable to parse the tile at ${q.request.url}, `;throw _e+=se[0]===31&&se[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${re.message}`,new Error(_e)}}))}loadTile(q){return v._(this,void 0,void 0,(function*(){const{uid:V,overzoomParameters:$}=q;$&&(q.request=$.overzoomRequest);const re=!!(q&&q.request&&q.request.collectResourceTiming)&&new v.c_(q.request),se=new L(q);this.loading[V]=se;const _e=new AbortController;se.abort=_e;try{const me=yield this.loadVectorTile(q,_e);if(delete this.loading[V],!me)return null;if($){const Ye=this._getOverzoomTile(q,me.vectorTile);me.rawData=Ye.rawData,me.vectorTile=Ye.vectorTile}const ne=me.rawData,be={};me.expires&&(be.expires=me.expires),me.cacheControl&&(be.cacheControl=me.cacheControl);const je={};if(re){const Ye=re.finish();Ye&&(je.resourceTiming=JSON.parse(JSON.stringify(Ye)))}se.vectorTile=me.vectorTile;const Pe=se.parse(me.vectorTile,this.layerIndex,this.availableImages,this.actor,q.subdivisionGranularity);this.loaded[V]=se,this.fetching[V]={rawTileData:ne,cacheControl:be,resourceTiming:je};try{const Ye=yield Pe;return v.e({rawTileData:ne.slice(0),encoding:q.encoding},Ye,be,je)}finally{delete this.fetching[V]}}catch(me){throw delete this.loading[V],se.status="done",this.loaded[V]=se,me}}))}_getOverzoomTile(q,V){const{tileID:$,source:re,overzoomParameters:se}=q,{maxZoomTileID:_e}=se,me=`${_e.key}_${$.key}`,ne=this.overzoomedTileResultCache.get(me);if(ne)return ne;const be=new ee,je=this.layerIndex.familiesBySource[re];for(const Ye in je){const it=V.layers[Ye];if(!it)continue;const rt=fe(it,_e,$.canonical);rt.length>0&&be.addLayer(rt)}const Pe=ue(be);return this.overzoomedTileResultCache.set(me,Pe),Pe}reloadTile(q){return v._(this,void 0,void 0,(function*(){const V=q.uid;if(!this.loaded||!this.loaded[V])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const $=this.loaded[V];if($.showCollisionBoxes=q.showCollisionBoxes,$.status==="parsing"){const re=yield $.parse($.vectorTile,this.layerIndex,this.availableImages,this.actor,q.subdivisionGranularity);let se;if(this.fetching[V]){const{rawTileData:_e,cacheControl:me,resourceTiming:ne}=this.fetching[V];delete this.fetching[V],se=v.e({rawTileData:_e.slice(0),encoding:q.encoding},re,me,ne)}else se=re;return se}if($.status==="done"&&$.vectorTile)return $.parse($.vectorTile,this.layerIndex,this.availableImages,this.actor,q.subdivisionGranularity)}))}abortTile(q){return v._(this,void 0,void 0,(function*(){const V=this.loading,$=q.uid;V&&V[$]&&V[$].abort&&(V[$].abort.abort(),delete V[$])}))}removeTile(q){return v._(this,void 0,void 0,(function*(){this.loaded&&this.loaded[q.uid]&&delete this.loaded[q.uid]}))}}class Be{constructor(){this.loaded={}}loadTile(q){return v._(this,void 0,void 0,(function*(){const{uid:V,encoding:$,rawImageData:re,redFactor:se,greenFactor:_e,blueFactor:me,baseShift:ne}=q,be=re.width+2,je=re.height+2,Pe=v.b(re)?new v.R({width:be,height:je},yield v.c$(re,-1,-1,be,je)):re,Ye=new v.d0(V,Pe,$,se,_e,me,ne);return this.loaded=this.loaded||{},this.loaded[V]=Ye,Ye}))}removeTile(q){const V=this.loaded,$=q.uid;V&&V[$]&&delete V[$]}}var Ae,De,xe=(function(){if(De)return Ae;function Ee(V,$){if(V.length!==0){q(V[0],$);for(var re=1;re<V.length;re++)q(V[re],!$)}}function q(V,$){for(var re=0,se=0,_e=0,me=V.length,ne=me-1;_e<me;ne=_e++){var be=(V[_e][0]-V[ne][0])*(V[ne][1]+V[_e][1]),je=re+be;se+=Math.abs(re)>=Math.abs(be)?re-je+be:be-je+re,re=je}re+se>=0!=!!$&&V.reverse()}return De=1,Ae=function V($,re){var se,_e=$&&$.type;if(_e==="FeatureCollection")for(se=0;se<$.features.length;se++)V($.features[se],re);else if(_e==="GeometryCollection")for(se=0;se<$.geometries.length;se++)V($.geometries[se],re);else if(_e==="Feature")V($.geometry,re);else if(_e==="Polygon")Ee($.coordinates,re);else if(_e==="MultiPolygon")for(se=0;se<$.coordinates.length;se++)Ee($.coordinates[se],re);return $}})(),ye=v.d1(xe);const Se={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:Ee=>Ee},Ie=Math.fround||(Ze=new Float32Array(1),Ee=>(Ze[0]=+Ee,Ze[0]));var Ze;class Je{constructor(q){this.options=Object.assign(Object.create(Se),q),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(q){const{log:V,minZoom:$,maxZoom:re}=this.options;V&&console.time("total time");const se=`prepare ${q.length} points`;V&&console.time(se),this.points=q;const _e=[];for(let ne=0;ne<q.length;ne++){const be=q[ne];if(!be.geometry)continue;const[je,Pe]=be.geometry.coordinates,Ye=Ie(vt(je)),it=Ie(nt(Pe));_e.push(Ye,it,1/0,ne,-1,1),this.options.reduce&&_e.push(0)}let me=this.trees[re+1]=this._createTree(_e);V&&console.timeEnd(se);for(let ne=re;ne>=$;ne--){const be=+Date.now();me=this.trees[ne]=this._createTree(this._cluster(me,ne)),V&&console.log("z%d: %d clusters in %dms",ne,me.numItems,+Date.now()-be)}return V&&console.timeEnd("total time"),this}getClusters(q,V){let $=((q[0]+180)%360+360)%360-180;const re=Math.max(-90,Math.min(90,q[1]));let se=q[2]===180?180:((q[2]+180)%360+360)%360-180;const _e=Math.max(-90,Math.min(90,q[3]));if(q[2]-q[0]>=360)$=-180,se=180;else if($>se){const Pe=this.getClusters([$,re,180,_e],V),Ye=this.getClusters([-180,re,se,_e],V);return Pe.concat(Ye)}const me=this.trees[this._limitZoom(V)],ne=me.range(vt($),nt(_e),vt(se),nt(re)),be=me.data,je=[];for(const Pe of ne){const Ye=this.stride*Pe;je.push(be[Ye+5]>1?Ve(be,Ye,this.clusterProps):this.points[be[Ye+3]])}return je}getChildren(q){const V=this._getOriginId(q),$=this._getOriginZoom(q),re="No cluster with the specified id.",se=this.trees[$];if(!se)throw new Error(re);const _e=se.data;if(V*this.stride>=_e.length)throw new Error(re);const me=this.options.radius/(this.options.extent*Math.pow(2,$-1)),ne=se.within(_e[V*this.stride],_e[V*this.stride+1],me),be=[];for(const je of ne){const Pe=je*this.stride;_e[Pe+4]===q&&be.push(_e[Pe+5]>1?Ve(_e,Pe,this.clusterProps):this.points[_e[Pe+3]])}if(be.length===0)throw new Error(re);return be}getLeaves(q,V,$){const re=[];return this._appendLeaves(re,q,V=V||10,$=$||0,0),re}getTile(q,V,$){const re=this.trees[this._limitZoom(q)],se=Math.pow(2,q),{extent:_e,radius:me}=this.options,ne=me/_e,be=($-ne)/se,je=($+1+ne)/se,Pe={features:[]};return this._addTileFeatures(re.range((V-ne)/se,be,(V+1+ne)/se,je),re.data,V,$,se,Pe),V===0&&this._addTileFeatures(re.range(1-ne/se,be,1,je),re.data,se,$,se,Pe),V===se-1&&this._addTileFeatures(re.range(0,be,ne/se,je),re.data,-1,$,se,Pe),Pe.features.length?Pe:null}getClusterExpansionZoom(q){let V=this._getOriginZoom(q)-1;for(;V<=this.options.maxZoom;){const $=this.getChildren(q);if(V++,$.length!==1)break;q=$[0].properties.cluster_id}return V}_appendLeaves(q,V,$,re,se){const _e=this.getChildren(V);for(const me of _e){const ne=me.properties;if(ne&&ne.cluster?se+ne.point_count<=re?se+=ne.point_count:se=this._appendLeaves(q,ne.cluster_id,$,re,se):se<re?se++:q.push(me),q.length===$)break}return se}_createTree(q){const V=new v.aT(q.length/this.stride|0,this.options.nodeSize,Float32Array);for(let $=0;$<q.length;$+=this.stride)V.add(q[$],q[$+1]);return V.finish(),V.data=q,V}_addTileFeatures(q,V,$,re,se,_e){for(const me of q){const ne=me*this.stride,be=V[ne+5]>1;let je,Pe,Ye;if(be)je=ft(V,ne,this.clusterProps),Pe=V[ne],Ye=V[ne+1];else{const At=this.points[V[ne+3]];je=At.properties;const[St,Te]=At.geometry.coordinates;Pe=vt(St),Ye=nt(Te)}const it={type:1,geometry:[[Math.round(this.options.extent*(Pe*se-$)),Math.round(this.options.extent*(Ye*se-re))]],tags:je};let rt;rt=be||this.options.generateId?V[ne+3]:this.points[V[ne+3]].id,rt!==void 0&&(it.id=rt),_e.features.push(it)}}_limitZoom(q){return Math.max(this.options.minZoom,Math.min(Math.floor(+q),this.options.maxZoom+1))}_cluster(q,V){const{radius:$,extent:re,reduce:se,minPoints:_e}=this.options,me=$/(re*Math.pow(2,V)),ne=q.data,be=[],je=this.stride;for(let Pe=0;Pe<ne.length;Pe+=je){if(ne[Pe+2]<=V)continue;ne[Pe+2]=V;const Ye=ne[Pe],it=ne[Pe+1],rt=q.within(ne[Pe],ne[Pe+1],me),At=ne[Pe+5];let St=At;for(const Te of rt){const Et=Te*je;ne[Et+2]>V&&(St+=ne[Et+5])}if(St>At&&St>=_e){let Te,Et=Ye*At,Lt=it*At,yt=-1;const tr=(Pe/je<<5)+(V+1)+this.points.length;for(const sn of rt){const Er=sn*je;if(ne[Er+2]<=V)continue;ne[Er+2]=V;const Or=ne[Er+5];Et+=ne[Er]*Or,Lt+=ne[Er+1]*Or,ne[Er+4]=tr,se&&(Te||(Te=this._map(ne,Pe,!0),yt=this.clusterProps.length,this.clusterProps.push(Te)),se(Te,this._map(ne,Er)))}ne[Pe+4]=tr,be.push(Et/St,Lt/St,1/0,tr,-1,St),se&&be.push(yt)}else{for(let Te=0;Te<je;Te++)be.push(ne[Pe+Te]);if(St>1)for(const Te of rt){const Et=Te*je;if(!(ne[Et+2]<=V)){ne[Et+2]=V;for(let Lt=0;Lt<je;Lt++)be.push(ne[Et+Lt])}}}}return be}_getOriginId(q){return q-this.points.length>>5}_getOriginZoom(q){return(q-this.points.length)%32}_map(q,V,$){if(q[V+5]>1){const _e=this.clusterProps[q[V+6]];return $?Object.assign({},_e):_e}const re=this.points[q[V+3]].properties,se=this.options.map(re);return $&&se===re?Object.assign({},se):se}}function Ve(Ee,q,V){return{type:"Feature",id:Ee[q+3],properties:ft(Ee,q,V),geometry:{type:"Point",coordinates:[($=Ee[q],360*($-.5)),ct(Ee[q+1])]}};var $}function ft(Ee,q,V){const $=Ee[q+5],re=$>=1e4?`${Math.round($/1e3)}k`:$>=1e3?Math.round($/100)/10+"k":$,se=Ee[q+6],_e=se===-1?{}:Object.assign({},V[se]);return Object.assign(_e,{cluster:!0,cluster_id:Ee[q+3],point_count:$,point_count_abbreviated:re})}function vt(Ee){return Ee/360+.5}function nt(Ee){const q=Math.sin(Ee*Math.PI/180),V=.5-.25*Math.log((1+q)/(1-q))/Math.PI;return V<0?0:V>1?1:V}function ct(Ee){const q=(180-360*Ee)*Math.PI/180;return 360*Math.atan(Math.exp(q))/Math.PI-90}function Dt(Ee,q,V,$){let re=$;const se=q+(V-q>>1);let _e,me=V-q;const ne=Ee[q],be=Ee[q+1],je=Ee[V],Pe=Ee[V+1];for(let Ye=q+3;Ye<V;Ye+=3){const it=Pt(Ee[Ye],Ee[Ye+1],ne,be,je,Pe);if(it>re)_e=Ye,re=it;else if(it===re){const rt=Math.abs(Ye-se);rt<me&&(_e=Ye,me=rt)}}re>$&&(_e-q>3&&Dt(Ee,q,_e,$),Ee[_e+2]=re,V-_e>3&&Dt(Ee,_e,V,$))}function Pt(Ee,q,V,$,re,se){let _e=re-V,me=se-$;if(_e!==0||me!==0){const ne=((Ee-V)*_e+(q-$)*me)/(_e*_e+me*me);ne>1?(V=re,$=se):ne>0&&(V+=_e*ne,$+=me*ne)}return _e=Ee-V,me=q-$,_e*_e+me*me}function We(Ee,q,V,$){const re={id:Ee??null,type:q,geometry:V,tags:$,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(q==="Point"||q==="MultiPoint"||q==="LineString")Ut(re,V);else if(q==="Polygon")Ut(re,V[0]);else if(q==="MultiLineString")for(const se of V)Ut(re,se);else if(q==="MultiPolygon")for(const se of V)Ut(re,se[0]);return re}function Ut(Ee,q){for(let V=0;V<q.length;V+=3)Ee.minX=Math.min(Ee.minX,q[V]),Ee.minY=Math.min(Ee.minY,q[V+1]),Ee.maxX=Math.max(Ee.maxX,q[V]),Ee.maxY=Math.max(Ee.maxY,q[V+1])}function pt(Ee,q,V,$){if(!q.geometry)return;const re=q.geometry.coordinates;if(re&&re.length===0)return;const se=q.geometry.type,_e=Math.pow(V.tolerance/((1<<V.maxZoom)*V.extent),2);let me=[],ne=q.id;if(V.promoteId?ne=q.properties[V.promoteId]:V.generateId&&(ne=$||0),se==="Point")Ht(re,me);else if(se==="MultiPoint")for(const be of re)Ht(be,me);else if(se==="LineString")ar(re,me,_e,!1);else if(se==="MultiLineString"){if(V.lineMetrics){for(const be of re)me=[],ar(be,me,_e,!1),Ee.push(We(ne,"LineString",me,q.properties));return}mr(re,me,_e,!1)}else if(se==="Polygon")mr(re,me,_e,!0);else{if(se!=="MultiPolygon"){if(se==="GeometryCollection"){for(const be of q.geometry.geometries)pt(Ee,{id:ne,geometry:be,properties:q.properties},V,$);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const be of re){const je=[];mr(be,je,_e,!0),me.push(je)}}Ee.push(We(ne,se,me,q.properties))}function Ht(Ee,q){q.push(Rt(Ee[0]),Xt(Ee[1]),0)}function ar(Ee,q,V,$){let re,se,_e=0;for(let ne=0;ne<Ee.length;ne++){const be=Rt(Ee[ne][0]),je=Xt(Ee[ne][1]);q.push(be,je,0),ne>0&&(_e+=$?(re*je-be*se)/2:Math.sqrt(Math.pow(be-re,2)+Math.pow(je-se,2))),re=be,se=je}const me=q.length-3;q[2]=1,Dt(q,0,me,V),q[me+2]=1,q.size=Math.abs(_e),q.start=0,q.end=q.size}function mr(Ee,q,V,$){for(let re=0;re<Ee.length;re++){const se=[];ar(Ee[re],se,V,$),q.push(se)}}function Rt(Ee){return Ee/360+.5}function Xt(Ee){const q=Math.sin(Ee*Math.PI/180),V=.5-.25*Math.log((1+q)/(1-q))/Math.PI;return V<0?0:V>1?1:V}function Tt(Ee,q,V,$,re,se,_e,me){if($/=q,se>=(V/=q)&&_e<$)return Ee;if(_e<V||se>=$)return null;const ne=[];for(const be of Ee){const je=be.geometry;let Pe=be.type;const Ye=re===0?be.minX:be.minY,it=re===0?be.maxX:be.maxY;if(Ye>=V&&it<$){ne.push(be);continue}if(it<V||Ye>=$)continue;let rt=[];if(Pe==="Point"||Pe==="MultiPoint")Yt(je,rt,V,$,re);else if(Pe==="LineString")pr(je,rt,V,$,re,!1,me.lineMetrics);else if(Pe==="MultiLineString")en(je,rt,V,$,re,!1);else if(Pe==="Polygon")en(je,rt,V,$,re,!0);else if(Pe==="MultiPolygon")for(const At of je){const St=[];en(At,St,V,$,re,!0),St.length&&rt.push(St)}if(rt.length){if(me.lineMetrics&&Pe==="LineString"){for(const At of rt)ne.push(We(be.id,Pe,At,be.tags));continue}Pe!=="LineString"&&Pe!=="MultiLineString"||(rt.length===1?(Pe="LineString",rt=rt[0]):Pe="MultiLineString"),Pe!=="Point"&&Pe!=="MultiPoint"||(Pe=rt.length===3?"Point":"MultiPoint"),ne.push(We(be.id,Pe,rt,be.tags))}}return ne.length?ne:null}function Yt(Ee,q,V,$,re){for(let se=0;se<Ee.length;se+=3){const _e=Ee[se+re];_e>=V&&_e<=$&&an(q,Ee[se],Ee[se+1],Ee[se+2])}}function pr(Ee,q,V,$,re,se,_e){let me=$t(Ee);const ne=re===0?kn:jt;let be,je,Pe=Ee.start;for(let St=0;St<Ee.length-3;St+=3){const Te=Ee[St],Et=Ee[St+1],Lt=Ee[St+2],yt=Ee[St+3],tr=Ee[St+4],sn=re===0?Te:Et,Er=re===0?yt:tr;let Or=!1;_e&&(be=Math.sqrt(Math.pow(Te-yt,2)+Math.pow(Et-tr,2))),sn<V?Er>V&&(je=ne(me,Te,Et,yt,tr,V),_e&&(me.start=Pe+be*je)):sn>$?Er<$&&(je=ne(me,Te,Et,yt,tr,$),_e&&(me.start=Pe+be*je)):an(me,Te,Et,Lt),Er<V&&sn>=V&&(je=ne(me,Te,Et,yt,tr,V),Or=!0),Er>$&&sn<=$&&(je=ne(me,Te,Et,yt,tr,$),Or=!0),!se&&Or&&(_e&&(me.end=Pe+be*je),q.push(me),me=$t(Ee)),_e&&(Pe+=be)}let Ye=Ee.length-3;const it=Ee[Ye],rt=Ee[Ye+1],At=re===0?it:rt;At>=V&&At<=$&&an(me,it,rt,Ee[Ye+2]),Ye=me.length-3,se&&Ye>=3&&(me[Ye]!==me[0]||me[Ye+1]!==me[1])&&an(me,me[0],me[1],me[2]),me.length&&q.push(me)}function $t(Ee){const q=[];return q.size=Ee.size,q.start=Ee.start,q.end=Ee.end,q}function en(Ee,q,V,$,re,se){for(const _e of Ee)pr(_e,q,V,$,re,se,!1)}function an(Ee,q,V,$){Ee.push(q,V,$)}function kn(Ee,q,V,$,re,se){const _e=(se-q)/($-q);return an(Ee,se,V+(re-V)*_e,1),_e}function jt(Ee,q,V,$,re,se){const _e=(se-V)/(re-V);return an(Ee,q+($-q)*_e,se,1),_e}function Lr(Ee,q){const V=[];for(let $=0;$<Ee.length;$++){const re=Ee[$],se=re.type;let _e;if(se==="Point"||se==="MultiPoint"||se==="LineString")_e=ur(re.geometry,q);else if(se==="MultiLineString"||se==="Polygon"){_e=[];for(const me of re.geometry)_e.push(ur(me,q))}else if(se==="MultiPolygon"){_e=[];for(const me of re.geometry){const ne=[];for(const be of me)ne.push(ur(be,q));_e.push(ne)}}V.push(We(re.id,se,_e,re.tags))}return V}function ur(Ee,q){const V=[];V.size=Ee.size,Ee.start!==void 0&&(V.start=Ee.start,V.end=Ee.end);for(let $=0;$<Ee.length;$+=3)V.push(Ee[$]+q,Ee[$+1],Ee[$+2]);return V}function qr(Ee,q){if(Ee.transformed)return Ee;const V=1<<Ee.z,$=Ee.x,re=Ee.y;for(const se of Ee.features){const _e=se.geometry,me=se.type;if(se.geometry=[],me===1)for(let ne=0;ne<_e.length;ne+=2)se.geometry.push(or(_e[ne],_e[ne+1],q,V,$,re));else for(let ne=0;ne<_e.length;ne++){const be=[];for(let je=0;je<_e[ne].length;je+=2)be.push(or(_e[ne][je],_e[ne][je+1],q,V,$,re));se.geometry.push(be)}}return Ee.transformed=!0,Ee}function or(Ee,q,V,$,re,se){return[Math.round(V*(Ee*$-re)),Math.round(V*(q*$-se))]}function Kt(Ee,q,V,$,re){const se=q===re.maxZoom?0:re.tolerance/((1<<q)*re.extent),_e={features:[],numPoints:0,numSimplified:0,numFeatures:Ee.length,source:null,x:V,y:$,z:q,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const me of Ee)fn(_e,me,se,re);return _e}function fn(Ee,q,V,$){const re=q.geometry,se=q.type,_e=[];if(Ee.minX=Math.min(Ee.minX,q.minX),Ee.minY=Math.min(Ee.minY,q.minY),Ee.maxX=Math.max(Ee.maxX,q.maxX),Ee.maxY=Math.max(Ee.maxY,q.maxY),se==="Point"||se==="MultiPoint")for(let me=0;me<re.length;me+=3)_e.push(re[me],re[me+1]),Ee.numPoints++,Ee.numSimplified++;else if(se==="LineString")ti(_e,re,Ee,V,!1,!1);else if(se==="MultiLineString"||se==="Polygon")for(let me=0;me<re.length;me++)ti(_e,re[me],Ee,V,se==="Polygon",me===0);else if(se==="MultiPolygon")for(let me=0;me<re.length;me++){const ne=re[me];for(let be=0;be<ne.length;be++)ti(_e,ne[be],Ee,V,!0,be===0)}if(_e.length){let me=q.tags||null;if(se==="LineString"&&$.lineMetrics){me={};for(const be in q.tags)me[be]=q.tags[be];me.mapbox_clip_start=re.start/re.size,me.mapbox_clip_end=re.end/re.size}const ne={geometry:_e,type:se==="Polygon"||se==="MultiPolygon"?3:se==="LineString"||se==="MultiLineString"?2:1,tags:me};q.id!==null&&(ne.id=q.id),Ee.features.push(ne)}}function ti(Ee,q,V,$,re,se){const _e=$*$;if($>0&&q.size<(re?_e:$))return void(V.numPoints+=q.length/3);const me=[];for(let ne=0;ne<q.length;ne+=3)($===0||q[ne+2]>_e)&&(V.numSimplified++,me.push(q[ne],q[ne+1])),V.numPoints++;re&&(function(ne,be){let je=0;for(let Pe=0,Ye=ne.length,it=Ye-2;Pe<Ye;it=Pe,Pe+=2)je+=(ne[Pe]-ne[it])*(ne[Pe+1]+ne[it+1]);if(je>0===be)for(let Pe=0,Ye=ne.length;Pe<Ye/2;Pe+=2){const it=ne[Pe],rt=ne[Pe+1];ne[Pe]=ne[Ye-2-Pe],ne[Pe+1]=ne[Ye-1-Pe],ne[Ye-2-Pe]=it,ne[Ye-1-Pe]=rt}})(me,se),Ee.push(me)}const yn={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class In{constructor(q,V){const $=(V=this.options=(function(se,_e){for(const me in _e)se[me]=_e[me];return se})(Object.create(yn),V)).debug;if($&&console.time("preprocess data"),V.maxZoom<0||V.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(V.promoteId&&V.generateId)throw new Error("promoteId and generateId cannot be used together.");let re=(function(se,_e){const me=[];if(se.type==="FeatureCollection")for(let ne=0;ne<se.features.length;ne++)pt(me,se.features[ne],_e,ne);else pt(me,se.type==="Feature"?se:{geometry:se},_e);return me})(q,V);this.tiles={},this.tileCoords=[],$&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",V.indexMaxZoom,V.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),re=(function(se,_e){const me=_e.buffer/_e.extent;let ne=se;const be=Tt(se,1,-1-me,me,0,-1,2,_e),je=Tt(se,1,1-me,2+me,0,-1,2,_e);return(be||je)&&(ne=Tt(se,1,-me,1+me,0,-1,2,_e)||[],be&&(ne=Lr(be,1).concat(ne)),je&&(ne=ne.concat(Lr(je,-1)))),ne})(re,V),re.length&&this.splitTile(re,0,0,0),$&&(re.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(q,V,$,re,se,_e,me){const ne=[q,V,$,re],be=this.options,je=be.debug;for(;ne.length;){re=ne.pop(),$=ne.pop(),V=ne.pop(),q=ne.pop();const Pe=1<<V,Ye=_n(V,$,re);let it=this.tiles[Ye];if(!it&&(je>1&&console.time("creation"),it=this.tiles[Ye]=Kt(q,V,$,re,be),this.tileCoords.push({z:V,x:$,y:re}),je)){je>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",V,$,re,it.numFeatures,it.numPoints,it.numSimplified),console.timeEnd("creation"));const Or=`z${V}`;this.stats[Or]=(this.stats[Or]||0)+1,this.total++}if(it.source=q,se==null){if(V===be.indexMaxZoom||it.numPoints<=be.indexMaxPoints)continue}else{if(V===be.maxZoom||V===se)continue;if(se!=null){const Or=se-V;if($!==_e>>Or||re!==me>>Or)continue}}if(it.source=null,q.length===0)continue;je>1&&console.time("clipping");const rt=.5*be.buffer/be.extent,At=.5-rt,St=.5+rt,Te=1+rt;let Et=null,Lt=null,yt=null,tr=null,sn=Tt(q,Pe,$-rt,$+St,0,it.minX,it.maxX,be),Er=Tt(q,Pe,$+At,$+Te,0,it.minX,it.maxX,be);q=null,sn&&(Et=Tt(sn,Pe,re-rt,re+St,1,it.minY,it.maxY,be),Lt=Tt(sn,Pe,re+At,re+Te,1,it.minY,it.maxY,be),sn=null),Er&&(yt=Tt(Er,Pe,re-rt,re+St,1,it.minY,it.maxY,be),tr=Tt(Er,Pe,re+At,re+Te,1,it.minY,it.maxY,be),Er=null),je>1&&console.timeEnd("clipping"),ne.push(Et||[],V+1,2*$,2*re),ne.push(Lt||[],V+1,2*$,2*re+1),ne.push(yt||[],V+1,2*$+1,2*re),ne.push(tr||[],V+1,2*$+1,2*re+1)}}getTile(q,V,$){q=+q,V=+V,$=+$;const re=this.options,{extent:se,debug:_e}=re;if(q<0||q>24)return null;const me=1<<q,ne=_n(q,V=V+me&me-1,$);if(this.tiles[ne])return qr(this.tiles[ne],se);_e>1&&console.log("drilling down to z%d-%d-%d",q,V,$);let be,je=q,Pe=V,Ye=$;for(;!be&&je>0;)je--,Pe>>=1,Ye>>=1,be=this.tiles[_n(je,Pe,Ye)];return be&&be.source?(_e>1&&(console.log("found parent tile z%d-%d-%d",je,Pe,Ye),console.time("drilling down")),this.splitTile(be.source,je,Pe,Ye,q,V,$),_e>1&&console.timeEnd("drilling down"),this.tiles[ne]?qr(this.tiles[ne],se):null):null}}function _n(Ee,q,V){return 32*((1<<Ee)*V+q)+Ee}class hi extends te{constructor(q,V,$,re=On){super(q,V,$),this._dataUpdateable=new Map,this._createGeoJSONIndex=re}loadVectorTile(q,V){return v._(this,void 0,void 0,(function*(){const $=q.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const re=this._geoJSONIndex.getTile($.z,$.x,$.y);return re?ue(new v.d2(re.features,{version:2,extent:v.a5})):null}))}loadData(q){return v._(this,void 0,void 0,(function*(){var V;(V=this._pendingRequest)===null||V===void 0||V.abort();const $=this._startPerformance(q);this._pendingRequest=new AbortController;try{(!this._pendingData||q.request||q.data||q.dataDiff)&&(this._pendingData=this.loadAndProcessGeoJSON(q,this._pendingRequest));const re=yield this._pendingData;this._geoJSONIndex=this._createGeoJSONIndex(re,q),this.loaded={};const se={};return q.request&&(se.data=re),this._finishPerformance($,q,se),se}catch(re){if(delete this._pendingRequest,v.Z(re))return{abandoned:!0};throw re}}))}_startPerformance(q){var V;if(!((V=q==null?void 0:q.request)===null||V===void 0)&&V.collectResourceTiming)return new v.c_(q.request)}_finishPerformance(q,V,$){if(!q)return;const re=q.finish();re&&($.resourceTiming={},$.resourceTiming[V.source]=JSON.parse(JSON.stringify(re)))}getData(){return v._(this,void 0,void 0,(function*(){return this._pendingData}))}reloadTile(q){const V=this.loaded;return V&&V[q.uid]?super.reloadTile(q):this.loadTile(q)}loadAndProcessGeoJSON(q,V){return v._(this,void 0,void 0,(function*(){let $;if(q.request?$=yield this.loadGeoJSONFromUrl(q.request,q.promoteId,V):q.data?$=this._loadGeoJSONFromObject(q.data,q.promoteId):q.dataDiff&&($=this._loadGeoJSONFromDiff(q.dataDiff,q.promoteId,q.source)),delete this._pendingRequest,typeof $!="object")throw new Error(`Input data given to '${q.source}' is not a valid GeoJSON object.`);return ye($,!0),q.filter&&($=this._filterGeoJSON($,q.filter)),$}))}loadGeoJSONFromUrl(q,V,$){return v._(this,void 0,void 0,(function*(){const re=yield v.j(q,$);return this._dataUpdateable=v.a7(re.data,V),re.data}))}_loadGeoJSONFromObject(q,V){return this._dataUpdateable=v.a7(q,V),q}_loadGeoJSONFromDiff(q,V,$){if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${$}`);v.a8(this._dataUpdateable,q,V);const re=Array.from(this._dataUpdateable.values());return this._toFeatureCollection(re)}_filterGeoJSON(q,V){const $=v.d3(V,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if($.result==="error")throw new Error($.value.map((se=>`${se.key}: ${se.message}`)).join(", "));const re=q.features.filter((se=>$.value.evaluate({zoom:0},se)));return this._toFeatureCollection(re)}_toFeatureCollection(q){return{type:"FeatureCollection",features:q}}removeSource(q){return v._(this,void 0,void 0,(function*(){this._pendingRequest&&this._pendingRequest.abort()}))}getClusterExpansionZoom(q){return this._geoJSONIndex.getClusterExpansionZoom(q.clusterId)}getClusterChildren(q){return this._geoJSONIndex.getChildren(q.clusterId)}getClusterLeaves(q){return this._geoJSONIndex.getLeaves(q.clusterId,q.limit,q.offset)}}function On(Ee,q){return q.cluster?new Je((function({superclusterOptions:V,clusterProperties:$}){if(!$||!V)return V;const re={},se={},_e={accumulated:null,zoom:0},me={properties:null},ne=Object.keys($);for(const be of ne){const[je,Pe]=$[be],Ye=v.d3(Pe),it=v.d3(typeof je=="string"?[je,["accumulated"],["get",be]]:je);re[be]=Ye.value,se[be]=it.value}return V.map=be=>{me.properties=be;const je={};for(const Pe of ne)je[Pe]=re[Pe].evaluate(_e,me);return je},V.reduce=(be,je)=>{me.properties=je;for(const Pe of ne)_e.accumulated=be[Pe],be[Pe]=se[Pe].evaluate(_e,me)},V})(q)).load(Ee.features):(function(V,$){return new In(V,$)})(Ee,q.geojsonVtOptions)}class on{constructor(q){this.self=q,this.actor=new v.L(q),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.globalStates=new Map,this.self.registerWorkerSource=(V,$)=>{if(this.externalWorkerSourceTypes[V])throw new Error(`Worker source with name "${V}" already registered.`);this.externalWorkerSourceTypes[V]=$},this.self.addProtocol=v.cJ,this.self.removeProtocol=v.cK,this.self.registerRTLTextPlugin=V=>{v.d4.setMethods(V)},this.actor.registerMessageHandler("LDT",((V,$)=>this._getDEMWorkerSource(V,$.source).loadTile($))),this.actor.registerMessageHandler("RDT",((V,$)=>v._(this,void 0,void 0,(function*(){this._getDEMWorkerSource(V,$.source).removeTile($)})))),this.actor.registerMessageHandler("GCEZ",((V,$)=>v._(this,void 0,void 0,(function*(){return this._getWorkerSource(V,$.type,$.source).getClusterExpansionZoom($)})))),this.actor.registerMessageHandler("GCC",((V,$)=>v._(this,void 0,void 0,(function*(){return this._getWorkerSource(V,$.type,$.source).getClusterChildren($)})))),this.actor.registerMessageHandler("GCL",((V,$)=>v._(this,void 0,void 0,(function*(){return this._getWorkerSource(V,$.type,$.source).getClusterLeaves($)})))),this.actor.registerMessageHandler("LD",((V,$)=>this._getWorkerSource(V,$.type,$.source).loadData($))),this.actor.registerMessageHandler("GD",((V,$)=>this._getWorkerSource(V,$.type,$.source).getData())),this.actor.registerMessageHandler("LT",((V,$)=>this._getWorkerSource(V,$.type,$.source).loadTile($))),this.actor.registerMessageHandler("RT",((V,$)=>this._getWorkerSource(V,$.type,$.source).reloadTile($))),this.actor.registerMessageHandler("AT",((V,$)=>this._getWorkerSource(V,$.type,$.source).abortTile($))),this.actor.registerMessageHandler("RMT",((V,$)=>this._getWorkerSource(V,$.type,$.source).removeTile($))),this.actor.registerMessageHandler("RS",((V,$)=>v._(this,void 0,void 0,(function*(){if(!this.workerSources[V]||!this.workerSources[V][$.type]||!this.workerSources[V][$.type][$.source])return;const re=this.workerSources[V][$.type][$.source];delete this.workerSources[V][$.type][$.source],re.removeSource!==void 0&&re.removeSource($)})))),this.actor.registerMessageHandler("RM",(V=>v._(this,void 0,void 0,(function*(){delete this.layerIndexes[V],delete this.availableImages[V],delete this.workerSources[V],delete this.demWorkerSources[V],this.globalStates.delete(V)})))),this.actor.registerMessageHandler("SR",((V,$)=>v._(this,void 0,void 0,(function*(){this.referrer=$})))),this.actor.registerMessageHandler("SRPS",((V,$)=>this._syncRTLPluginState(V,$))),this.actor.registerMessageHandler("IS",((V,$)=>v._(this,void 0,void 0,(function*(){this.self.importScripts($)})))),this.actor.registerMessageHandler("SI",((V,$)=>this._setImages(V,$))),this.actor.registerMessageHandler("UL",((V,$)=>v._(this,void 0,void 0,(function*(){this._getLayerIndex(V).update($.layers,$.removedIds,this._getGlobalState(V))})))),this.actor.registerMessageHandler("UGS",((V,$)=>v._(this,void 0,void 0,(function*(){const re=this._getGlobalState(V);for(const se in $)re[se]=$[se]})))),this.actor.registerMessageHandler("SL",((V,$)=>v._(this,void 0,void 0,(function*(){this._getLayerIndex(V).replace($,this._getGlobalState(V))}))))}_getGlobalState(q){let V=this.globalStates.get(q);return V||(V={},this.globalStates.set(q,V)),V}_setImages(q,V){return v._(this,void 0,void 0,(function*(){this.availableImages[q]=V;for(const $ in this.workerSources[q]){const re=this.workerSources[q][$];for(const se in re)re[se].availableImages=V}}))}_syncRTLPluginState(q,V){return v._(this,void 0,void 0,(function*(){return yield v.d4.syncState(V,this.self.importScripts)}))}_getAvailableImages(q){let V=this.availableImages[q];return V||(V=[]),V}_getLayerIndex(q){let V=this.layerIndexes[q];return V||(V=this.layerIndexes[q]=new s),V}_getWorkerSource(q,V,$){if(this.workerSources[q]||(this.workerSources[q]={}),this.workerSources[q][V]||(this.workerSources[q][V]={}),!this.workerSources[q][V][$]){const re={sendAsync:(se,_e)=>(se.targetMapId=q,this.actor.sendAsync(se,_e))};switch(V){case"vector":this.workerSources[q][V][$]=new te(re,this._getLayerIndex(q),this._getAvailableImages(q));break;case"geojson":this.workerSources[q][V][$]=new hi(re,this._getLayerIndex(q),this._getAvailableImages(q));break;default:this.workerSources[q][V][$]=new this.externalWorkerSourceTypes[V](re,this._getLayerIndex(q),this._getAvailableImages(q))}}return this.workerSources[q][V][$]}_getDEMWorkerSource(q,V){return this.demWorkerSources[q]||(this.demWorkerSources[q]={}),this.demWorkerSources[q][V]||(this.demWorkerSources[q][V]=new Be),this.demWorkerSources[q][V]}}return v.i(self)&&(self.worker=new on(self)),on})),x("index",["exports","./shared"],(function(v,s){var I="5.16.0";function L(){var m=new s.A(4);return s.A!=Float32Array&&(m[1]=0,m[2]=0),m[0]=1,m[3]=1,m}let O,H,J;const ee={frame(m,t,i){const c=requestAnimationFrame((g=>{p(),t(g)})),{unsubscribe:p}=s.s(m.signal,"abort",(()=>{p(),cancelAnimationFrame(c),i(new s.a(m.signal.reason))}),!1)},frameAsync(m){return new Promise(((t,i)=>{this.frame(m,t,i)}))},getImageData(m,t=0){return this.getImageCanvasContext(m).getImageData(-t,-t,m.width+2*t,m.height+2*t)},getImageCanvasContext(m){const t=window.document.createElement("canvas"),i=t.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("failed to create canvas 2d context");return t.width=m.width,t.height=m.height,i.drawImage(m,0,0,m.width,m.height),i},resolveURL:m=>(O||(O=document.createElement("a")),O.href=m,O.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return J!==void 0?J:!!matchMedia&&(H==null&&(H=matchMedia("(prefers-reduced-motion: reduce)")),H.matches)},set prefersReducedMotion(m){J=m}},ue=new class{constructor(){this._realTime=typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),this._frozenAt=null}getCurrentTime(){return this._frozenAt!==null?this._frozenAt:this._realTime()}setNow(m){this._frozenAt=m}restoreNow(){this._frozenAt=null}isFrozen(){return this._frozenAt!==null}};function fe(){return ue.getCurrentTime()}class te{static testProp(t){if(!te.docStyle)return t[0];for(let i=0;i<t.length;i++)if(t[i]in te.docStyle)return t[i];return t[0]}static create(t,i,c){const p=window.document.createElement(t);return i!==void 0&&(p.className=i),c&&c.appendChild(p),p}static createNS(t,i){return window.document.createElementNS(t,i)}static disableDrag(){te.docStyle&&te.selectProp&&(te.userSelect=te.docStyle[te.selectProp],te.docStyle[te.selectProp]="none")}static enableDrag(){te.docStyle&&te.selectProp&&(te.docStyle[te.selectProp]=te.userSelect)}static setTransform(t,i){t.style[te.transformProp]=i}static addEventListener(t,i,c,p={}){t.addEventListener(i,c,"passive"in p?p:p.capture)}static removeEventListener(t,i,c,p={}){t.removeEventListener(i,c,"passive"in p?p:p.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",te.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",te.suppressClickInternal,!0),window.setTimeout((()=>{window.removeEventListener("click",te.suppressClickInternal,!0)}),0)}static getScale(t){const i=t.getBoundingClientRect();return{x:i.width/t.offsetWidth||1,y:i.height/t.offsetHeight||1,boundingClientRect:i}}static getPoint(t,i,c){const p=i.boundingClientRect;return new s.P((c.clientX-p.left)/i.x-t.clientLeft,(c.clientY-p.top)/i.y-t.clientTop)}static mousePos(t,i){const c=te.getScale(t);return te.getPoint(t,c,i)}static touchPos(t,i){const c=[],p=te.getScale(t);for(let g=0;g<i.length;g++)c.push(te.getPoint(t,p,i[g]));return c}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}static sanitize(t){const i=new DOMParser().parseFromString(t,"text/html").body||document.createElement("body"),c=i.querySelectorAll("script");for(const p of c)p.remove();return te.clean(i),i.innerHTML}static isPossiblyDangerous(t,i){const c=i.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(t)||!c.includes("javascript:")&&!c.includes("data:"))||!!t.startsWith("on")||void 0}static clean(t){const i=t.children;for(const c of i)te.removeAttributes(c),te.clean(c)}static removeAttributes(t){for(const{name:i,value:c}of t.attributes)te.isPossiblyDangerous(i,c)&&t.removeAttribute(i)}}te.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,te.selectProp=te.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),te.transformProp=te.testProp(["transform","WebkitTransform"]);const Be={supported:!1,testSupport:function(m){!xe&&De&&(ye?Se(m):Ae=m)}};let Ae,De,xe=!1,ye=!1;function Se(m){const t=m.createTexture();m.bindTexture(m.TEXTURE_2D,t);try{if(m.texImage2D(m.TEXTURE_2D,0,m.RGBA,m.RGBA,m.UNSIGNED_BYTE,De),m.isContextLost())return;Be.supported=!0}catch{}m.deleteTexture(t),xe=!0}var Ie;typeof document<"u"&&(De=document.createElement("img"),De.onload=()=>{Ae&&Se(Ae),Ae=null,ye=!0},De.onerror=()=>{xe=!0,Ae=null},De.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),(function(m){let t,i,c,p;m.resetRequestQueue=()=>{t=[],i=0,c=0,p={}},m.addThrottleControl=P=>{const A=c++;return p[A]=P,A},m.removeThrottleControl=P=>{delete p[P],b()},m.getImage=(P,A,k=!0)=>new Promise(((F,z)=>{Be.supported&&(P.headers||(P.headers={}),P.headers.accept="image/webp,*/*"),s.e(P,{type:"image"}),t.push({abortController:A,requestParameters:P,supportImageRefresh:k,state:"queued",onError:j=>{z(j)},onSuccess:j=>{F(j)}}),b()}));const g=P=>s._(this,void 0,void 0,(function*(){P.state="running";const{requestParameters:A,supportImageRefresh:k,onError:F,onSuccess:z,abortController:j}=P,G=k===!1&&!s.i(self)&&!s.g(A.url)&&(!A.headers||Object.keys(A.headers).reduce(((K,oe)=>K&&oe==="accept"),!0));i++;const Y=G?S(A,j):s.m(A,j);try{const K=yield Y;delete P.abortController,P.state="completed",K.data instanceof HTMLImageElement||s.b(K.data)?z(K):K.data&&z({data:yield(Q=K.data,typeof createImageBitmap=="function"?s.f(Q):s.h(Q)),cacheControl:K.cacheControl,expires:K.expires})}catch(K){delete P.abortController,F(K)}finally{i--,b()}var Q})),b=()=>{const P=(()=>{for(const A of Object.keys(p))if(p[A]())return!0;return!1})()?s.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:s.c.MAX_PARALLEL_IMAGE_REQUESTS;for(let A=i;A<P&&t.length>0;A++){const k=t.shift();k.abortController.signal.aborted?A--:g(k)}},S=(P,A)=>new Promise(((k,F)=>{const z=new Image,j=P.url,G=P.credentials;G&&G==="include"?z.crossOrigin="use-credentials":(G&&G==="same-origin"||!s.d(j))&&(z.crossOrigin="anonymous"),A.signal.addEventListener("abort",(()=>{z.src="",F(new s.a(A.signal.reason))})),z.fetchPriority="high",z.onload=()=>{z.onerror=z.onload=null,k({data:z})},z.onerror=()=>{z.onerror=z.onload=null,A.signal.aborted||F(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."))},z.src=j}))})(Ie||(Ie={})),Ie.resetRequestQueue();class Ze{constructor(t){this._transformRequestFn=t??null}transformRequest(t,i){return this._transformRequestFn&&this._transformRequestFn(t,i)||{url:t}}setTransformRequest(t){this._transformRequestFn=t}}function Je(m){const t=[];if(typeof m=="string")t.push({id:"default",url:m});else if(m&&m.length>0){const i=[];for(const{id:c,url:p}of m){const g=`${c}${p}`;i.indexOf(g)===-1&&(i.push(g),t.push({id:c,url:p}))}}return t}function Ve(m,t,i){try{const c=new URL(m);return c.pathname+=`${t}${i}`,c.toString()}catch{throw new Error(`Invalid sprite URL "${m}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}function ft(m){const{userImage:t}=m;return!!(t&&t.render&&t.render())&&(m.data.replace(new Uint8Array(t.data.buffer)),!0)}class vt extends s.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new s.R({width:1,height:1}),this.dirty=!0}destroy(){this.atlasTexture&&(this.atlasTexture.destroy(),this.atlasTexture=null);for(const t of Object.keys(this.images))this.removeImage(t);this.patterns={},this.atlasImage=new s.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:i,promiseResolve:c}of this.requestors)c(this._getImagesForIds(i));this.requestors=[]}}getImage(t){const i=this.images[t];if(i&&!i.data&&i.spriteData){const c=i.spriteData;i.data=new s.R({width:c.width,height:c.height},c.context.getImageData(c.x,c.y,c.width,c.height).data),i.spriteData=null}return i}addImage(t,i){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,i)&&(this.images[t]=i)}_validate(t,i){let c=!0;const p=i.data||i.spriteData;return this._validateStretch(i.stretchX,p&&p.width)||(this.fire(new s.k(new Error(`Image "${t}" has invalid "stretchX" value`))),c=!1),this._validateStretch(i.stretchY,p&&p.height)||(this.fire(new s.k(new Error(`Image "${t}" has invalid "stretchY" value`))),c=!1),this._validateContent(i.content,i)||(this.fire(new s.k(new Error(`Image "${t}" has invalid "content" value`))),c=!1),c}_validateStretch(t,i){if(!t)return!0;let c=0;for(const p of t){if(p[0]<c||p[1]<p[0]||i<p[1])return!1;c=p[1]}return!0}_validateContent(t,i){if(!t)return!0;if(t.length!==4)return!1;const c=i.spriteData,p=c&&c.width||i.data.width,g=c&&c.height||i.data.height;return!(t[0]<0||p<t[0]||t[1]<0||g<t[1]||t[2]<0||p<t[2]||t[3]<0||g<t[3]||t[2]<t[0]||t[3]<t[1])}updateImage(t,i,c=!0){const p=this.getImage(t);if(c&&(p.data.width!==i.data.width||p.data.height!==i.data.height))throw new Error(`size mismatch between old image (${p.data.width}x${p.data.height}) and new image (${i.data.width}x${i.data.height}).`);i.version=p.version+1,this.images[t]=i,this.updatedImages[t]=!0}removeImage(t){const i=this.images[t];delete this.images[t],delete this.patterns[t],i.userImage&&i.userImage.onRemove&&i.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t){return new Promise(((i,c)=>{let p=!0;if(!this.isLoaded())for(const g of t)this.images[g]||(p=!1);this.isLoaded()||p?i(this._getImagesForIds(t)):this.requestors.push({ids:t,promiseResolve:i})}))}_getImagesForIds(t){const i={};for(const c of t){let p=this.getImage(c);p||(this.fire(new s.l("styleimagemissing",{id:c})),p=this.getImage(c)),p?i[c]={data:p.data.clone(),pixelRatio:p.pixelRatio,sdf:p.sdf,version:p.version,stretchX:p.stretchX,stretchY:p.stretchY,content:p.content,textFitWidth:p.textFitWidth,textFitHeight:p.textFitHeight,hasRenderCallback:!!(p.userImage&&p.userImage.render)}:s.w(`Image "${c}" 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:t,height:i}=this.atlasImage;return{width:t,height:i}}getPattern(t){const i=this.patterns[t],c=this.getImage(t);if(!c)return null;if(i&&i.position.version===c.version)return i.position;if(i)i.position.version=c.version;else{const p={w:c.data.width+2,h:c.data.height+2,x:0,y:0},g=new s.I(p,c);this.patterns[t]={bin:p,position:g}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const i=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new s.T(t,this.atlasImage,i.RGBA),this.atlasTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const g in this.patterns)t.push(this.patterns[g].bin);const{w:i,h:c}=s.p(t),p=this.atlasImage;p.resize({width:i||1,height:c||1});for(const g in this.patterns){const{bin:b}=this.patterns[g],S=b.x+1,P=b.y+1,A=this.getImage(g).data,k=A.width,F=A.height;s.R.copy(A,p,{x:0,y:0},{x:S,y:P},{width:k,height:F}),s.R.copy(A,p,{x:0,y:F-1},{x:S,y:P-1},{width:k,height:1}),s.R.copy(A,p,{x:0,y:0},{x:S,y:P+F},{width:k,height:1}),s.R.copy(A,p,{x:k-1,y:0},{x:S-1,y:P},{width:1,height:F}),s.R.copy(A,p,{x:0,y:0},{x:S+k,y:P},{width:1,height:F})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const i of t){if(this.callbackDispatchedThisFrame[i])continue;this.callbackDispatchedThisFrame[i]=!0;const c=this.getImage(i);c||s.w(`Image with ID: "${i}" was not found`),ft(c)&&this.updateImage(i,c)}}cloneImages(){const t={};for(const i in this.images){const c=this.images[i];t[i]=Object.assign(Object.assign({},c),{data:c.data?c.data.clone():null})}return t}}const nt=1e20;function ct(m,t,i,c,p,g,b,S,P){for(let A=t;A<t+c;A++)Dt(m,i*g+A,g,p,b,S,P);for(let A=i;A<i+p;A++)Dt(m,A*g+t,1,c,b,S,P)}function Dt(m,t,i,c,p,g,b){g[0]=0,b[0]=-nt,b[1]=nt,p[0]=m[t];for(let S=1,P=0,A=0;S<c;S++){p[S]=m[t+S*i];const k=S*S;do{const F=g[P];A=(p[S]-p[F]+k-F*F)/(S-F)/2}while(A<=b[P]&&--P>-1);P++,g[P]=S,b[P]=A,b[P+1]=nt}for(let S=0,P=0;S<c;S++){for(;b[P+1]<S;)P++;const A=g[P],k=S-A;m[t+S*i]=p[A]+k*k}}const Pt=s.v.layout_symbol["text-font"].default.join(",");class We{constructor(t,i,c){this.requestManager=t,this.localIdeographFontFamily=i,this.entries={},this.lang=c}setURL(t){this.url=t}getGlyphs(t){return s._(this,void 0,void 0,(function*(){const i=[];for(const g in t)for(const b of t[g])i.push(this._getAndCacheGlyphsPromise(g,b));const c=yield Promise.all(i),p={};for(const{stack:g,id:b,glyph:S}of c)p[g]||(p[g]={}),p[g][b]=S&&{id:S.id,bitmap:S.bitmap.clone(),metrics:S.metrics};return p}))}_getAndCacheGlyphsPromise(t,i){return s._(this,void 0,void 0,(function*(){let c=this.entries[t];c||(c=this.entries[t]={glyphs:{},requests:{},ranges:{}});let p=c.glyphs[i];return p!==void 0?{stack:t,id:i,glyph:p}:!this.url||this._charUsesLocalIdeographFontFamily(i)?(p=c.glyphs[i]=this._drawGlyph(c,t,i),{stack:t,id:i,glyph:p}):yield this._downloadAndCacheRangePromise(t,i)}))}_downloadAndCacheRangePromise(t,i){return s._(this,void 0,void 0,(function*(){const c=this.entries[t],p=Math.floor(i/256);if(c.ranges[p])return{stack:t,id:i,glyph:null};if(!c.requests[p]){const g=We.loadGlyphRange(t,p,this.url,this.requestManager);c.requests[p]=g}try{const g=yield c.requests[p];for(const b in g)c.glyphs[+b]=g[+b];return c.ranges[p]=!0,{stack:t,id:i,glyph:g[i]||null}}catch(g){const b=c.glyphs[i]=this._drawGlyph(c,t,i);return this._warnOnMissingGlyphRange(b,p,i,g),{stack:t,id:i,glyph:b}}}))}_warnOnMissingGlyphRange(t,i,c,p){const g=256*i,b=g+255,S=c.toString(16).padStart(4,"0").toUpperCase();s.w(`Unable to load glyph range ${i}, ${g}-${b}. Rendering codepoint U+${S} locally instead. ${p}`)}_charUsesLocalIdeographFontFamily(t){return!!this.localIdeographFontFamily&&s.q(t)}_drawGlyph(t,i,c){const p=i===Pt&&this.localIdeographFontFamily!==""&&this._charUsesLocalIdeographFontFamily(c),g=p?"ideographTinySDF":"tinySDF";t[g]||(t[g]=this._createTinySDF(p?this.localIdeographFontFamily:i));const b=t[g].draw(String.fromCodePoint(c)),S=new RegExp("^\\p{gc=Cf}+$","u").test(String.fromCodePoint(c));return{id:c,bitmap:new s.r({width:b.width||60,height:b.height||60},b.data),metrics:{width:S?0:b.glyphWidth/2||24,height:b.glyphHeight/2||24,left:b.glyphLeft/2+.5||0,top:b.glyphTop/2-27.5||-8,advance:S?0:b.glyphAdvance/2||24,isDoubleResolution:!0}}}_createTinySDF(t){const i=t?t.split(","):[];i.push("sans-serif");const c=i.map((p=>/[-\w]+/.test(p)?p:`'${CSS.escape(p)}'`)).join(",");return new We.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:c,fontWeight:this._fontWeight(i[0]),fontStyle:this._fontStyle(i[0]),lang:this.lang})}_fontStyle(t){return/italic/i.test(t)?"italic":/oblique/i.test(t)?"oblique":"normal"}_fontWeight(t){const i={thin:100,hairline:100,"extra light":200,"ultra light":200,light:300,normal:400,regular:400,medium:500,semibold:600,demibold:600,bold:700,"extra bold":800,"ultra bold":800,black:900,heavy:900,"extra black":950,"ultra black":950};let c;for(const[p,g]of Object.entries(i))new RegExp(`\\b${p}\\b`,"i").test(t)&&(c=`${g}`);return c}destroy(){for(const t in this.entries){const i=this.entries[t];i.tinySDF&&(i.tinySDF=null),i.ideographTinySDF&&(i.ideographTinySDF=null),i.glyphs={},i.requests={},i.ranges={}}this.entries={}}}We.loadGlyphRange=function(m,t,i,c){return s._(this,void 0,void 0,(function*(){const p=256*t,g=p+255,b=c.transformRequest(i.replace("{fontstack}",m).replace("{range}",`${p}-${g}`),"Glyphs"),S=yield s.n(b,new AbortController);if(!S||!S.data)throw new Error(`Could not load glyph range. range: ${t}, ${p}-${g}`);const P={};for(const A of s.o(S.data))P[A.id]=A;return P}))},We.TinySDF=class{constructor({fontSize:m=24,buffer:t=3,radius:i=8,cutoff:c=.25,fontFamily:p="sans-serif",fontWeight:g="normal",fontStyle:b="normal",lang:S=null}={}){this.buffer=t,this.cutoff=c,this.radius=i,this.lang=S;const P=this.size=m+4*t,A=this._createCanvas(P),k=this.ctx=A.getContext("2d",{willReadFrequently:!0});k.font=`${b} ${g} ${m}px ${p}`,k.textBaseline="alphabetic",k.textAlign="left",k.fillStyle="black",this.gridOuter=new Float64Array(P*P),this.gridInner=new Float64Array(P*P),this.f=new Float64Array(P),this.z=new Float64Array(P+1),this.v=new Uint16Array(P)}_createCanvas(m){const t=document.createElement("canvas");return t.width=t.height=m,t}draw(m){const{width:t,actualBoundingBoxAscent:i,actualBoundingBoxDescent:c,actualBoundingBoxLeft:p,actualBoundingBoxRight:g}=this.ctx.measureText(m),b=Math.ceil(i),S=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(g-p))),P=Math.min(this.size-this.buffer,b+Math.ceil(c)),A=S+2*this.buffer,k=P+2*this.buffer,F=Math.max(A*k,0),z=new Uint8ClampedArray(F),j={data:z,width:A,height:k,glyphWidth:S,glyphHeight:P,glyphTop:b,glyphLeft:0,glyphAdvance:t};if(S===0||P===0)return j;const{ctx:G,buffer:Y,gridInner:Q,gridOuter:K}=this;this.lang&&(G.lang=this.lang),G.clearRect(Y,Y,S,P),G.fillText(m,Y,Y+b);const oe=G.getImageData(Y,Y,S,P);K.fill(nt,0,F),Q.fill(0,0,F);for(let de=0;de<P;de++)for(let ie=0;ie<S;ie++){const he=oe.data[4*(de*S+ie)+3]/255;if(he===0)continue;const ge=(de+Y)*A+ie+Y;if(he===1)K[ge]=0,Q[ge]=nt;else{const ce=.5-he;K[ge]=ce>0?ce*ce:0,Q[ge]=ce<0?ce*ce:0}}ct(K,0,0,A,k,A,this.f,this.v,this.z),ct(Q,Y,Y,S,P,A,this.f,this.v,this.z);for(let de=0;de<F;de++){const ie=Math.sqrt(K[de])-Math.sqrt(Q[de]);z[de]=Math.round(255-255*(ie/this.radius+this.cutoff))}return j}};class Ut{constructor(){this.specification=s.u.light.position}possiblyEvaluate(t,i){return s.F(t.expression.evaluate(i))}interpolate(t,i,c){return{x:s.G.number(t.x,i.x,c),y:s.G.number(t.y,i.y,c),z:s.G.number(t.z,i.z,c)}}}let pt;class Ht extends s.E{constructor(t){super(),pt=pt||new s.t({anchor:new s.D(s.u.light.anchor),position:new Ut,color:new s.D(s.u.light.color),intensity:new s.D(s.u.light.intensity)}),this._transitionable=new s.x(pt,void 0),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,i={}){if(!this._validate(s.y,t,i))for(const c in t){const p=t[c];c.endsWith(s.z)?this._transitionable.setTransition(c.slice(0,-s.z.length),p):this._transitionable.setValue(c,p)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,i,c){return(!c||c.validate!==!1)&&s.B(this,t.call(s.C,{value:i,style:{glyphs:!0,sprite:!0},styleSpec:s.u}))}}const ar=new s.t({"sky-color":new s.D(s.u.sky["sky-color"]),"horizon-color":new s.D(s.u.sky["horizon-color"]),"fog-color":new s.D(s.u.sky["fog-color"]),"fog-ground-blend":new s.D(s.u.sky["fog-ground-blend"]),"horizon-fog-blend":new s.D(s.u.sky["horizon-fog-blend"]),"sky-horizon-blend":new s.D(s.u.sky["sky-horizon-blend"]),"atmosphere-blend":new s.D(s.u.sky["atmosphere-blend"])});class mr extends s.E{constructor(t){super(),this._transitionable=new s.x(ar,void 0),this.setSky(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new s.H(0))}setSky(t,i={}){if(!this._validate(s.J,t,i)){t||(t={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const c in t){const p=t[c];c.endsWith(s.z)?this._transitionable.setTransition(c.slice(0,-s.z.length),p):this._transitionable.setValue(c,p)}}}getSky(){return this._transitionable.serialize()}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,i,c={}){return(c==null?void 0:c.validate)!==!1&&s.B(this,t.call(s.C,s.e({value:i,style:{glyphs:!0,sprite:!0},styleSpec:s.u})))}calculateFogBlendOpacity(t){return t<60?0:t<70?(t-60)/10:1}}class Rt{constructor(t,i){this.width=t,this.height=i,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,i){const c=t.join(",")+String(i);return this.dashEntry[c]||(this.dashEntry[c]=this.addDash(t,i)),this.dashEntry[c]}getDashRanges(t,i,c){const p=[];let g=t.length%2==1?-t[t.length-1]*c:0,b=t[0]*c,S=!0;p.push({left:g,right:b,isDash:S,zeroLength:t[0]===0});let P=t[0];for(let A=1;A<t.length;A++){S=!S;const k=t[A];g=P*c,P+=k,b=P*c,p.push({left:g,right:b,isDash:S,zeroLength:k===0})}return p}addRoundDash(t,i,c){const p=i/2;for(let g=-c;g<=c;g++){const b=this.width*(this.nextRow+c+g);let S=0,P=t[S];for(let A=0;A<this.width;A++){A/P.right>1&&(P=t[++S]);const k=Math.abs(A-P.left),F=Math.abs(A-P.right),z=Math.min(k,F);let j;const G=g/c*(p+1);if(P.isDash){const Y=p-Math.abs(G);j=Math.sqrt(z*z+Y*Y)}else j=p-Math.sqrt(z*z+G*G);this.data[b+A]=Math.max(0,Math.min(255,j+128))}}}addRegularDash(t){for(let S=t.length-1;S>=0;--S){const P=t[S],A=t[S+1];P.zeroLength?t.splice(S,1):A&&A.isDash===P.isDash&&(A.left=P.left,t.splice(S,1))}const i=t[0],c=t[t.length-1];i.isDash===c.isDash&&(i.left=c.left-this.width,c.right=i.right+this.width);const p=this.width*this.nextRow;let g=0,b=t[g];for(let S=0;S<this.width;S++){S/b.right>1&&(b=t[++g]);const P=Math.abs(S-b.left),A=Math.abs(S-b.right),k=Math.min(P,A);this.data[p+S]=Math.max(0,Math.min(255,(b.isDash?k:-k)+128))}}addDash(t,i){const c=i?7:0,p=2*c+1;if(this.nextRow+p>this.height)return s.w("LineAtlas out of space"),null;let g=0;for(let S=0;S<t.length;S++)g+=t[S];if(g!==0){const S=this.width/g,P=this.getDashRanges(t,this.width,S);i?this.addRoundDash(P,S,c):this.addRegularDash(P)}const b={y:this.nextRow+c,height:2*c,width:g};return this.nextRow+=p,this.dirty=!0,b}bind(t){const i=t.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 Xt="maplibre_preloaded_worker_pool";class Tt{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<Tt.workerCount;)this.workers.push(new Worker(s.c.WORKER_URL));return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],this.numActive()===0&&(this.workers.forEach((i=>{i.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[Xt]}numActive(){return Object.keys(this.active).length}}const Yt=Math.floor(ee.hardwareConcurrency/2);let pr,$t;function en(){return pr||(pr=new Tt),pr}Tt.workerCount=s.K(globalThis)?Math.max(Math.min(Yt,3),1):1;class an{constructor(t,i){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=i;const c=this.workerPool.acquire(i);for(let p=0;p<c.length;p++){const g=new s.L(c[p],i);g.name=`Worker ${p}`,this.actors.push(g)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,i){const c=[];for(const p of this.actors)c.push(p.sendAsync({type:t,data:i}));return Promise.all(c)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){this.actors.forEach((i=>{i.remove()})),this.actors=[],t&&this.workerPool.release(this.id)}registerMessageHandler(t,i){for(const c of this.actors)c.registerMessageHandler(t,i)}unregisterMessageHandler(t){for(const i of this.actors)i.unregisterMessageHandler(t)}}function kn(){return $t||($t=new an(en(),s.M),$t.registerMessageHandler("GR",((m,t,i)=>s.m(t,i)))),$t}function jt(m,t){const i=s.N();return s.O(i,i,[1,1,0]),s.Q(i,i,[.5*m.width,.5*m.height,1]),m.calculatePosMatrix?s.S(i,i,m.calculatePosMatrix(t.toUnwrapped())):i}function Lr(m,t,i,c,p,g,b){var S;const P=(function(z,j,G){if(z)for(const Y of z){const Q=j[Y];if(Q&&Q.source===G&&Q.type==="fill-extrusion")return!0}else for(const Y in j){const Q=j[Y];if(Q.source===G&&Q.type==="fill-extrusion")return!0}return!1})((S=p==null?void 0:p.layers)!==null&&S!==void 0?S:null,t,m.id),A=g.maxPitchScaleFactor(),k=m.tilesIn(c,A,P);k.sort(ur);const F=[];for(const z of k)F.push({wrappedTileID:z.tileID.wrapped().key,queryResults:z.tile.queryRenderedFeatures(t,i,m.getState(),z.queryGeometry,z.cameraQueryGeometry,z.scale,p,g,A,jt(g,z.tileID),b?(j,G)=>b(z.tileID,j,G):void 0)});return(function(z,j){for(const G in z)for(const Y of z[G])qr(Y,j);return z})((function(z){const j={},G={};for(const Y of z){const Q=Y.queryResults,K=Y.wrappedTileID,oe=G[K]=G[K]||{};for(const de in Q){const ie=Q[de],he=oe[de]=oe[de]||{},ge=j[de]=j[de]||[];for(const ce of ie)he[ce.featureIndex]||(he[ce.featureIndex]=!0,ge.push(ce))}}return j})(F),m)}function ur(m,t){const i=m.tileID,c=t.tileID;return i.overscaledZ-c.overscaledZ||i.canonical.y-c.canonical.y||i.wrap-c.wrap||i.canonical.x-c.canonical.x}function qr(m,t){const i=m.feature,c=t.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=c}function or(m,t,i){return s._(this,void 0,void 0,(function*(){let c=m;if(m.url?c=(yield s.j(t.transformRequest(m.url,"Source"),i)).data:yield ee.frameAsync(i),!c)return null;const p=s.U(s.e(c,m),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in c&&c.vector_layers&&(p.vectorLayerIds=c.vector_layers.map((g=>g.id))),p}))}class Kt{constructor(t,i){t&&(i?this.setSouthWest(t).setNorthEast(i):Array.isArray(t)&&(t.length===4?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof s.V?new s.V(t.lng,t.lat):s.V.convert(t),this}setSouthWest(t){return this._sw=t instanceof s.V?new s.V(t.lng,t.lat):s.V.convert(t),this}extend(t){const i=this._sw,c=this._ne;let p,g;if(t instanceof s.V)p=t,g=t;else{if(!(t instanceof Kt))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(Kt.convert(t)):this.extend(s.V.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(s.V.convert(t)):this;if(p=t._sw,g=t._ne,!p||!g)return this}return i||c?(i.lng=Math.min(p.lng,i.lng),i.lat=Math.min(p.lat,i.lat),c.lng=Math.max(g.lng,c.lng),c.lat=Math.max(g.lat,c.lat)):(this._sw=new s.V(p.lng,p.lat),this._ne=new s.V(g.lng,g.lat)),this}getCenter(){return new s.V((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 s.V(this.getWest(),this.getNorth())}getSouthEast(){return new s.V(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(t){const{lng:i,lat:c}=s.V.convert(t);let p=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(p=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=c&&c<=this._ne.lat&&p}intersects(t){if(!((t=Kt.convert(t)).getNorth()>=this.getSouth()&&t.getSouth()<=this.getNorth()))return!1;const i=Math.abs(this.getEast()-this.getWest()),c=Math.abs(t.getEast()-t.getWest());if(i>=360||c>=360)return!0;const p=s.W(this.getWest(),-180,180),g=s.W(this.getEast(),-180,180),b=s.W(t.getWest(),-180,180),S=s.W(t.getEast(),-180,180),P=p>=g,A=b>=S;return!(!P||!A)||(P?S>=p||b<=g:A?g>=b||p<=S:b<=g&&S>=p)}static convert(t){return t instanceof Kt?t:t&&new Kt(t)}static fromLngLat(t,i=0){const c=360*i/40075017,p=c/Math.cos(Math.PI/180*t.lat);return new Kt(new s.V(t.lng-p,t.lat-c),new s.V(t.lng+p,t.lat+c))}adjustAntiMeridian(){const t=new s.V(this._sw.lng,this._sw.lat),i=new s.V(this._ne.lng,this._ne.lat);return new Kt(t,t.lng>i.lng?new s.V(i.lng+360,i.lat):i)}}class fn{constructor(t,i,c){this.bounds=Kt.convert(this.validateBounds(t)),this.minzoom=i||0,this.maxzoom=c||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){const i=Math.pow(2,t.z),c=Math.floor(s.Y(this.bounds.getWest())*i),p=Math.floor(s.X(this.bounds.getNorth())*i),g=Math.ceil(s.Y(this.bounds.getEast())*i),b=Math.ceil(s.X(this.bounds.getSouth())*i);return t.x>=c&&t.x<g&&t.y>=p&&t.y<b}}class ti extends s.E{constructor(t,i,c,p){if(super(),this.id=t,this.dispatcher=c,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,s.e(this,s.U(i,["url","scheme","tileSize","promoteId","encoding"])),this._options=s.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(p)}load(){return s._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new s.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const t=yield or(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.tileManagers[this.id].clearTiles(),t&&(s.e(this,t),t.bounds&&(this.tileBounds=new fn(t.bounds,this.minzoom,this.maxzoom)),this.fire(new s.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.l("data",{dataType:"source",sourceDataType:"content"})))}catch(t){this._tileJSONRequest=null,this._loaded=!0,s.Z(t)||this.fire(new s.k(t))}}))}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.abort(),t(),this.load()}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t})),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return s.e({},this._options)}loadTile(t){return s._(this,void 0,void 0,(function*(){const i=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),c={request:this.map._requestManager.transformRequest(i,"Tile"),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,encoding:this.encoding,overzoomParameters:this._getOverzoomParameters(t)};c.request.collectResourceTiming=this._collectResourceTiming;let p="RT";if(t.actor&&t.state!=="expired"){if(t.state==="loading")return new Promise(((g,b)=>{t.reloadPromise={resolve:g,reject:b}}))}else t.actor=this.dispatcher.getActor(),p="LT";t.abortController=new AbortController;try{const g=yield t.actor.sendAsync({type:p,data:c},t.abortController);if(delete t.abortController,t.aborted)return;this._afterTileLoadWorkerResponse(t,g)}catch(g){if(delete t.abortController,t.aborted)return;if(g&&g.status!==404)throw g;this._afterTileLoadWorkerResponse(t,null)}}))}_getOverzoomParameters(t){if(t.tileID.canonical.z<=this.maxzoom||this.map._zoomLevelsToOverscale===void 0)return;const i=t.tileID.scaledTo(this.maxzoom).canonical,c=i.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:i,overzoomRequest:this.map._requestManager.transformRequest(c,"Tile")}}_afterTileLoadWorkerResponse(t,i){if(i&&i.resourceTiming&&(t.resourceTiming=i.resourceTiming),i&&this.map._refreshExpiredTiles&&t.setExpiryData(i),t.loadVectorData(i,this.map.painter),t.reloadPromise){const c=t.reloadPromise;t.reloadPromise=null,this.loadTile(t).then(c.resolve).catch(c.reject)}}abortTile(t){return s._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.actor&&(yield t.actor.sendAsync({type:"AT",data:{uid:t.uid,type:this.type,source:this.id}}))}))}unloadTile(t){return s._(this,void 0,void 0,(function*(){t.unloadVectorData(),t.actor&&(yield t.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}}))}))}hasTransition(){return!1}}class yn extends s.E{constructor(t,i,c,p){super(),this.id=t,this.dispatcher=c,this.setEventedParent(p),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=s.e({type:"raster"},i),s.e(this,s.U(i,["url","scheme","tileSize"]))}load(){return s._(this,arguments,void 0,(function*(t=!1){this._loaded=!1,this.fire(new s.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const i=yield or(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,i&&(s.e(this,i),i.bounds&&(this.tileBounds=new fn(i.bounds,this.minzoom,this.maxzoom)),this.fire(new s.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.l("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:t})))}catch(i){this._tileJSONRequest=null,this._loaded=!0,s.Z(i)||this.fire(new s.k(i))}}))}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(t){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),t(),this.load(!0)}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t})),this}serialize(){return s.e({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t){return s._(this,void 0,void 0,(function*(){const i=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.abortController=new AbortController;try{const c=yield Ie.getImage(this.map._requestManager.transformRequest(i,"Tile"),t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(c&&c.data){this.map._refreshExpiredTiles&&(c.cacheControl||c.expires)&&t.setExpiryData({cacheControl:c.cacheControl,expires:c.expires});const p=this.map.painter.context,g=p.gl,b=c.data;t.texture=this.map.painter.getTileTexture(b.width),t.texture?t.texture.update(b,{useMipmap:!0}):(t.texture=new s.T(p,b,g.RGBA,{useMipmap:!0}),t.texture.bind(g.LINEAR,g.CLAMP_TO_EDGE,g.LINEAR_MIPMAP_NEAREST)),t.state="loaded"}}catch(c){if(delete t.abortController,t.aborted)t.state="unloaded";else if(c)throw t.state="errored",c}}))}abortTile(t){return s._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController)}))}unloadTile(t){return s._(this,void 0,void 0,(function*(){t.texture&&this.map.painter.saveTileTexture(t.texture)}))}hasTransition(){return!1}}class In extends yn{constructor(t,i,c,p){super(t,i,c,p),this.type="raster-dem",this.maxzoom=22,this._options=s.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(t){return s._(this,void 0,void 0,(function*(){const i=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),c=this.map._requestManager.transformRequest(i,"Tile");t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{const p=yield Ie.getImage(c,t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(p&&p.data){const g=p.data;this.map._refreshExpiredTiles&&(p.cacheControl||p.expires)&&t.setExpiryData({cacheControl:p.cacheControl,expires:p.expires});const b=s.b(g)&&s.$()?g:yield this.readImageNow(g),S={type:this.type,uid:t.uid,source:this.id,rawImageData:b,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!t.actor||t.state==="expired"){t.actor=this.dispatcher.getActor();const P=yield t.actor.sendAsync({type:"LDT",data:S});t.dem=P,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded"}}}catch(p){if(delete t.abortController,t.aborted)t.state="unloaded";else if(p)throw t.state="errored",p}}))}readImageNow(t){return s._(this,void 0,void 0,(function*(){if(typeof VideoFrame<"u"&&s.a0()){const i=t.width+2,c=t.height+2;try{return new s.R({width:i,height:c},yield s.a1(t,-1,-1,i,c))}catch{}}return ee.getImageData(t,1)}))}_getNeighboringTiles(t){const i=t.canonical,c=Math.pow(2,i.z),p=(i.x-1+c)%c,g=i.x===0?t.wrap-1:t.wrap,b=(i.x+1+c)%c,S=i.x+1===c?t.wrap+1:t.wrap,P={};return P[new s.a2(t.overscaledZ,g,i.z,p,i.y).key]={backfilled:!1},P[new s.a2(t.overscaledZ,S,i.z,b,i.y).key]={backfilled:!1},i.y>0&&(P[new s.a2(t.overscaledZ,g,i.z,p,i.y-1).key]={backfilled:!1},P[new s.a2(t.overscaledZ,t.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},P[new s.a2(t.overscaledZ,S,i.z,b,i.y-1).key]={backfilled:!1}),i.y+1<c&&(P[new s.a2(t.overscaledZ,g,i.z,p,i.y+1).key]={backfilled:!1},P[new s.a2(t.overscaledZ,t.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},P[new s.a2(t.overscaledZ,S,i.z,b,i.y+1).key]={backfilled:!1}),P}unloadTile(t){return s._(this,void 0,void 0,(function*(){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&(yield t.actor.sendAsync({type:"RDT",data:{type:this.type,uid:t.uid,source:this.id}}))}))}}function _n(m){return m.type==="GeometryCollection"?m.geometries.map((t=>t.coordinates)).flat(1/0):m.coordinates.flat(1/0)}function hi(m){const t=new Kt;let i;switch(m.type){case"FeatureCollection":i=m.features.map((c=>_n(c.geometry))).flat(1/0);break;case"Feature":i=_n(m.geometry);break;default:i=_n(m)}if(i.length==0)return t;for(let c=0;c<i.length-1;c+=2)t.extend([i[c],i[c+1]]);return t}class On extends s.E{constructor(t,i,c,p){super(),this.id=t,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._isUpdatingWorker=!1,this._pendingWorkerUpdate={data:i.data},this.actor=c.getActor(),this.setEventedParent(p),this._data=typeof i.data=="str
5ing"?{url:i.data}:{geojson:i.data},this._options=s.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&&s.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${i.clusterMaxZoom}".`),this.workerOptions=s.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:s.a5,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:s.a5,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)}_hasPendingWorkerUpdate(){return this._pendingWorkerUpdate.data!==void 0||this._pendingWorkerUpdate.diff!==void 0||this._pendingWorkerUpdate.optionsChanged}_pixelsToTileUnits(t){return t*(s.a5/this.tileSize)}_getClusterMaxZoom(t){const i=t?Math.round(t):this.maxzoom-1;return Number.isInteger(t)||t===void 0||s.w(`Integer expected for option 'clusterMaxZoom': provided value "${t}" rounded to "${i}"`),i}load(){return s._(this,void 0,void 0,(function*(){yield this._updateWorkerData()}))}onAdd(t){this.map=t,this.load()}setData(t,i){this._data=typeof t=="string"?{url:t}:{geojson:t},this._pendingWorkerUpdate={data:t};const c=this._updateWorkerData();return i?c:this}updateData(t,i){this._pendingWorkerUpdate.diff=s.a6(this._pendingWorkerUpdate.diff,t);const c=this._updateWorkerData();return i?c:this}getData(){return s._(this,void 0,void 0,(function*(){const t=s.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:t})}))}getBounds(){return s._(this,void 0,void 0,(function*(){return hi(yield this.getData())}))}setClusterOptions(t){return this.workerOptions.cluster=t.cluster,t.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=this._pixelsToTileUnits(t.clusterRadius)),t.clusterMa
5xZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=this._getClusterMaxZoom(t.clusterMaxZoom)),this._pendingWorkerUpdate.optionsChanged=!0,this._updateWorkerData(),this}getClusterExpansionZoom(t){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:t,source:this.id}})}getClusterChildren(t){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:t,source:this.id}})}getClusterLeaves(t,i,c){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:t,limit:i,offset:c}})}_updateWorkerData(){return s._(this,void 0,void 0,(function*(){if(this._isUpdatingWorker)return;if(!this._hasPendingWorkerUpdate())return void s.w(`No pending worker updates for GeoJSONSource ${this.id}.`);const{data:t,diff:i}=this._pendingWorkerUpdate,c=s.e({type:this.type},this.workerOptions);t!==void 0?(typeof t=="string"?(c.request=this.map._requestManager.transformRequest(ee.resolveURL(t),"Source"),c.request.collectResourceTiming=this._collectResourceTiming):c.data=t,this._pendingWorkerUpdate.data=void 0):i&&(c.dataDiff=i,this._pendingWorkerUpdate.diff=void 0),this._pendingWorkerUpdate.optionsChanged=void 0,this._isUpdatingWorker=!0,this.fire(new s.l("dataloading",{dataType:"source"}));try{const p=yield this.actor.sendAsync({type:"LD",data:c});if(this._isUpdatingWorker=!1,this._removed||p.abandoned)return void this.fire(new s.l("dataabort",{dataType:"source"}));p.data&&(this._data={geojson:p.data});const g=this._applyDiffToSource(i),b=this._getShouldReloadTileOptions(g);let S=null;p.resourceTiming&&p.resourceTiming[this.id]&&(S=p.resourceTiming[this.id].slice(0));const P={dataType:"source"};this._collectResourceTiming&&S&&S.length>0&&s.e(P,{resourceTiming:S}),this.fire(new s.l("data",Object.assign(Object.assign({},P),{sourceDataType:"metadata"}))),this.fire(new s.l("data",Object.assign(Object.assign({},P),{sourceDataType:"content",shouldReloadTileOptions:b})))}catch(p){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new s.l("dataabort",{dataType:"source"}));this.fire(new s.k(p))}finally{this._hasPendingWorkerUpdate()&&this._updateWorkerData()}}))}_applyDiffToSource(t){if(!t)return;const i=typeof this.promoteId=="string"?this.promoteId:void 0;if(!this._data.url&&!this._data.updateable){const p=s.a7(this._data.geojson,i);if(!p)throw new Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);this._data={updateable:p}}if(!this._data.updateable)return;const c=s.a8(this._data.updateable,t,i);return t.removeAll||this._options.cluster?void 0:c}_getShouldReloadTileOptions(t){if(t)return{affectedBounds:t.filter(Boolean).map((i=>hi(i)))}}shouldReloadTile(t,{affectedBounds:i}){if(t.state==="loading")return!0;if(t.state==="unloaded")return!1;const{buffer:c,extent:p}=this.workerOptions.geojsonVtOptions,g=(function({x:b,y:S,z:P},A=0){const k=s.a3((b-A)/Math.pow(2,P)),F=s.a4((S+1+A)/Math.pow(2,P)),z=s.a3((b+1+A)/Math.pow(2,P)),j=s.a4((S-A)/Math.pow(2,P));return new Kt([k,F],[z,j])})(t.tileID.canonical,c/p);for(const b of i)if(g.intersects(b))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}loadTile(t){return s._(this,void 0,void 0,(function*(){const i=t.actor?"RT":"LT";t.actor=this.actor;const c={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.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};t.abortController=new AbortController;const p=yield this.actor.sendAsync({type:i,data:c},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(p,this.map.painter,i==="RT")}))}abortTile(t){return s._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.aborted=!0}))}unloadTile(t){return s._(this,void 0,void 0,(function*(){t.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.t
vendor: 8,437 bytes, line 5
5ype,source:this.id}})}))}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return s.e({},this._options,{type:this.type,data:this._data.updateable?{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}:this._data.url||this._data.geojson})}hasTransition(){return!1}}class on extends s.E{constructor(t,i,c,p){super(),this.flippedWindingOrder=!1,this.id=t,this.dispatcher=c,this.coordinates=i.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(p),this.options=i}load(t){return s._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new s.l("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const i=yield Ie.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,i&&i.data&&(this.image=i.data,t&&(this.coordinates=t),this._finishLoading())}catch(i){this._request=null,this._loaded=!0,s.Z(i)||this.fire(new s.k(i))}}))}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=t.url,this.load(t.coordinates).finally((()=>{this.texture=null})),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new s.l("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(t){this.coordinates=t;const i=t.map(s.a9.fromLngLat);var c;return this.tileID=(function(p){const g=s.aa.fromPoints(p),b=g.width(),S=g.height(),P=Math.max(b,S),A=Math.max(0,Math.floor(-Math.log(P)/Math.LN2)),k=Math.pow(2,A);return new s.ac(A,Math.floor((g.minX+g.maxX)/2*k),Math.floor((g.minY+g.maxY)/2*k))})(i),this.terrainTileRanges=this._getOverlappingTileRanges(i),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=i.map((p=>this.tileID.getTilePoint(p)._round())),this.flippedWindingOrder=((c=this.tileCoords)[1].x-c[0].x)*(c[2].y-c[0].y)-(c[1].y-c[0].y)*(c[2].x-c[0].x)<0,this.fire(new s.l("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const t=this.map.painter.context,i=t.gl;this.texture||(this.texture=new s.T(t,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let c=!1;for(const p in this.tiles){const g=this.tiles[p];g.state!=="loaded"&&(g.state="loaded",g.texture=this.texture,c=!0)}c&&this.fire(new s.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t){return s._(this,void 0,void 0,(function*(){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={}):t.state="errored"}))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(t){const{minX:i,minY:c,maxX:p,maxY:g}=s.aa.fromPoints(t),b={};for(let S=0;S<=s.ab;S++){const P=Math.pow(2,S),A=Math.floor(i*P),k=Math.floor(c*P),F=Math.floor(p*P),z=Math.floor(g*P),j=(A%P+P)%P,G=F%P,Y=Math.floor(A/P),Q=Math.floor(F/P);b[S]={minWrap:Y,maxWrap:Q,minTileXWrapped:j,maxTileXWrapped:G,minTileY:k,maxTileY:z}}return b}}class Ee extends on{constructor(t,i,c,p){super(t,i,c,p),this.roundZoom=!0,this.type="video",this.options=i}load(){return s._(this,void 0,void 0,(function*(){this._loaded=!1;const t=this.options;this.urls=[];for(const i of t.urls)this.urls.push(this.map._requestManager.transformRequest(i,"Source").url);try{const i=yield s.ad(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 s.k(i))}}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const i=this.video.seekable;t<i.start(0)||t>i.end(0)?this.fire(new s.k(new s.ae(`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=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,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 t=this.map.painter.context,i=t.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 s.T(t,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let c=!1;for(const p in this.tiles){const g=this.tiles[p];g.state!=="loaded"&&(g.state="loaded",g.texture=this.texture,c=!0)}c&&this.fire(new s.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 q extends on{constructor(t,i,c,p){super(t,i,c,p),i.coordinates?Array.isArray(i.coordinates)&&i.coordinates.length===4&&!i.coordinates.some((g=>!Array.isArray(g)||g.length!==2||g.some((b=>typeof b!="number"))))||this.fire(new s.k(new s.ae(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new s.k(new s.ae(`sources.${t}`,null,'missing required property "coordinates"'))),i.animate&&typeof i.animate!="boolean"&&this.fire(new s.k(new s.ae(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),i.canvas?typeof i.canvas=="string"||i.canvas instanceof HTMLCanvasElement||this.fire(new s.k(new s.ae(`sources.${t}`,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 s.k(new s.ae(`sources.${t}`,null,'missing required property "canvas"'))),this.options=i,this.animate=i.animate===void 0||i.animate}load(){return s._(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 s.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(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const i=this.map.painter.context,c=i.gl;this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):(this.texture=new s.T(i,this.canvas,c.RGBA,{premultiply:!0}),this.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE));let p=!1;for(const g in this.tiles){const b=this.tiles[g];b.state!=="loaded"&&(b.state="loaded",b.texture=this.texture,p=!0)}p&&this.fire(new s.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",animate:this.animate,canvas:this.options.canvas,coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const V={},$=m=>{switch(m){case"geojson":return On;case"image":return on;case"raster":return yn;case"raster-dem":return In;case"vector":return ti;case"video":return Ee;case"canvas":return q}return V[m]},re="RTLPluginLoaded";class se extends s.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=kn()}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch((i=>{throw this.status="error",i}))}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(t){return s._(this,arguments,void 0,(function*(i,c=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=ee.resolveURL(i),!this.url)throw new Error(`requested url ${i}
5 is invalid`);if(this.status==="unavailable"){if(!c)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()}))}_requestImport(){return s._(this,void 0,void 0,(function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new s.l(re))}))}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let _e=null;function me(){return _e||(_e=new se),_e}var ne,be;(function(m){m[m.Base=0]="Base",m[m.Parent=1]="Parent"})(ne||(ne={})),(function(m){m[m.Departing=0]="Departing",m[m.Incoming=1]="Incoming"})(be||(be={}));class je{constructor(t,i){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=t,this.uid=s.af(),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"}isRenderable(t){return this.hasData()&&(!this.fadeEndTime||this.fadeOpacity>0)&&(t||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:t,fadingDirection:i,fadingParentID:c,fadeEndTime:p}){this.resetFadeLogic(),this.fadingRole=t,this.fadingDirection=i,this.fadingParentID=c,this.fadeEndTime=p}setSelfFadeLogic(t){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=t}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=fe(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(t,i,c){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData,this.latestFeatureIndex.encoding=t.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=(function(p,g){const b={};if(!g)return b;for(const S of p){const P=S.layerIds.map((A=>g.getLayer(A))).filter(Boolean);if(P.length!==0){S.layers=P,S.stateDependentLayerIds&&(S.stateDependentLayers=S.stateDependentLayerIds.map((A=>P.filter((k=>k.id===A))[0])));for(const A of P)b[A.id]=S}}return b})(t.buckets,i==null?void 0:i.style),this.hasSymbolBuckets=!1;for(const p in this.buckets){const g=this.buckets[p];if(g instanceof s.ah){if(this.hasSymbolBuckets=!0,!c)break;g.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const p in this.buckets){const g=this.buckets[p];if(g instanceof s.ah&&g.hasRTLText){this.hasRTLText=!0,me().lazyLoad();break}}this.queryPadding=0;for(const p in this.buckets){const g=this.buckets[p];this.queryPadding=Math.max(this.queryPadding,i.style.getLayer(p).queryRadius(g))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),this.dashPositions=t.dashPositions}else this.collisionBoxArray=new s.ag}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.dashPositions&&(this.dashPositions=null),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const c in this.buckets){const p=this.buckets[c];p.uploadPending()&&p.upload(t)}const i=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new s.T(t,this.imageAtlas.image,i.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new s.T(t,this.glyphAtlasImage,i.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,i,c,p,g,b,S,P,A,k,F){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:p,cameraQueryGeometry:g,
vendor: 7,628 bytes, line 5
5scale:b,tileSize:this.tileSize,pixelPosMatrix:k,transform:P,params:S,queryPadding:this.queryPadding*A,getElevation:F},t,i,c):{}}querySourceFeatures(t,i){const c=this.latestFeatureIndex;if(!c||!c.rawTileData)return;const p=c.loadVTLayers(),g=i&&i.sourceLayer?i.sourceLayer:"",b=p[s.ai]||p[g];if(!b)return;const S=s.aj(i==null?void 0:i.filter,i==null?void 0:i.globalState),{z:P,x:A,y:k}=this.tileID.canonical,F={z:P,x:A,y:k};for(let z=0;z<b.length;z++){const j=b.feature(z);if(S.needGeometry){const Q=s.ak(j,!0);if(!S.filter(new s.H(this.tileID.overscaledZ),Q,this.tileID.canonical))continue}else if(!S.filter(new s.H(this.tileID.overscaledZ),j))continue;const G=c.getId(j,g),Y=new s.al(j,P,A,k,G);Y.tile=F,t.push(Y)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const i=this.expirationTime;if(t.cacheControl){const c=s.am(t.cacheControl);c["max-age"]&&(this.expirationTime=Date.now()+1e3*c["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const c=Date.now();let p=!1;if(this.expirationTime>c)p=!1;else if(i)if(this.expirationTime<i)p=!0;else{const g=this.expirationTime-i;g?this.expirationTime=c+Math.max(g,3e4):p=!0}else p=!0;p?(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(t,i){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(t).length===0)return;const c=this.latestFeatureIndex.loadVTLayers();for(const p in this.buckets){if(!i.style.hasLayer(p))continue;const g=this.buckets[p],b=g.layers[0].sourceLayer||s.ai,S=c[b],P=t[b];if(!S||!P||Object.keys(P).length===0)continue;g.update(P,S,this.imageAtlas&&this.imageAtlas.patternPositions||{},this.dashPositions||{});const A=i&&i.style&&i.style.getLayer(p);A&&(this.queryPadding=Math.max(this.queryPadding,A.queryRadius(g)))}}holdingForSymbolFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<fe()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(t){this.symbolFadeHoldUntil=fe()+t}setDependencies(t,i){const c={};for(const p of i)c[p]=!0;this.dependencies[t]=c}hasDependency(t,i){for(const c of t){const p=this.dependencies[c];if(p){for(const g of i)if(p[g])return!0}}return!1}}class Pe{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,i,c){const p=String(i);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][p]=this.stateChanges[t][p]||{},s.e(this.stateChanges[t][p],c),this.deletedStates[t]===null){this.deletedStates[t]={};for(const g in this.state[t])g!==p&&(this.deletedStates[t][g]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][p]===null){this.deletedStates[t][p]={};for(const g in this.state[t][p])c[g]||(this.deletedStates[t][p][g]=null)}else for(const g in c)this.deletedStates[t]&&this.deletedStates[t][p]&&this.deletedStates[t][p][g]===null&&delete this.deletedStates[t][p][g]}removeFeatureState(t,i,c){if(this.deletedStates[t]===null)return;const p=String(i);if(this.deletedStates[t]=this.deletedStates[t]||{},c&&i!==void 0)this.deletedStates[t][p]!==null&&(this.deletedStates[t][p]=this.deletedStates[t][p]||{},this.deletedStates[t][p][c]=null);else if(i!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][p])for(c in this.deletedStates[t][p]={},this.stateChanges[t][p])this.deletedStates[t][p][c]=null;else this.deletedStates[t][p]=null;else this.deletedStates[t]=null}getState(t,i){const c=String(i),p=s.e({},(this.state[t]||{})[c],(this.stateChanges[t]||{})[c]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const g=this.deletedStates[t][i];if(g===null)return{};for(const b in g)delete p[b]}return p}initializeTileState(t,i){t.setFeatureState(this.state,i)}coalesceChanges(t,i){const c={};for(const p in this.stateChanges){this.state[p]=this.state[p]||{};const g={};for(const b in this.stateChanges[p])this.state[p][b]||(this.state[p][b]={}),s.e(this.state[p][b],this.stateChanges[p][b]),g[b]=this.state[p][b];c[p]=g}for(const p in this.deletedStates){this.state[p]=this.state[p]||{};const g={};if(this.deletedStates[p]===null)for(const b in this.state[p])g[b]={},this.state[p][b]={};else for(const b in this.deletedStates[p]){if(this.deletedStates[p][b]===null)this.state[p][b]={};else for(const S of Object.keys(this.deletedStates[p][b]))delete this.state[p][b][S];g[b]=this.state[p][b]}c[p]=c[p]||{},s.e(c[p],g)}this.stateChanges={},this.deletedStates={},Object.keys(c).length!==0&&t.setFeatureState(c,i)}}const Ye=89.25;function it(m,t){const i=s.an(t.lat,-s.ao,s.ao);return new s.P(s.Y(t.lng)*m,s.X(i)*m)}function rt(m,t){return new s.a9(t.x/m,t.y/m).toLngLat()}function At(m){return m.cameraToCenterDistance*Math.min(.85*Math.tan(s.ap(90-m.pitch)),Math.tan(s.ap(Ye-m.pitch)))}function St(m,t){const i=m.canonical,c=t/s.aq(i.z),p=i.x+Math.pow(2,i.z)*m.wrap,g=s.ar(new Float64Array(16));return s.O(g,g,[p*c,i.y*c,0]),s.Q(g,g,[c/s.a5,c/s.a5,1]),g}function Te(m,t,i,c,p){const g=s.a9.fromLngLat(m,t),b=p*s.as(1,m.lat),{x:S,y:P,z:A}=Et(i,c);return new s.a9(g.x+b*-S,g.y+b*-P,g.z+b*-A)}function Et(m,t){const i=s.ap(m),c=s.ap(t),p=Math.cos(-i),g=Math.sin(i);return{x:g*Math.sin(c),y:-g*Math.cos(c),z:p}}function Lt(m,t,i){const c=t.intersectsFrustum(m);if(!i||c===0)return c;const p=t.intersectsPlane(i);return p===0?0:c===2&&p===2?2:1}function yt(m,t,i){let c=0;const p=(i-t)/10;for(let g=0;g<10;g++)c+=p*Math.pow(Math.cos(t+(g+.5)/10*(i-t)),m);return c}function tr(m,t){return function(i,c,p,g,b){const S=2*((m-1)/s.at(Math.cos(s.ap(Ye-b))/Math.cos(s.ap(Ye)))-1),P=Math.acos(p/g),A=2*yt(S-1,0,s.ap(b/2)),k=Math.min(s.ap(Ye),P+s.ap(b/2)),F=yt(S-1,Math.min(k,P-s.ap(b/2)),k),z=Math.atan(c/p),j=Math.hypot(c,p);let G=i;return G+=s.at(g/j/Math.max(.5,Math.cos(s.ap(b/2)))),G+=S*s.at(Math.cos(z))/2,G-=s.at(Math.max(1,F/A/t))/2,G}}const sn=tr(9.314,3);function Er(m,t){const i=(t.roundZoom?Math.round:Math.floor)(m.zoom+s.at(m.tileSize/t.tileSize));return Math.max(0,i)}function Or(m,t){const i=m.getCameraFrustum(),c=m.getClippingPlane(),p=m.screenPointToMercatorCoordinate(m.getCameraPoint()),g=s.a9.fromLngLat(m.center,m.elevation);p.z=g.z+Math.cos(m.pitchInRadians)*m.cameraToCenterDistance/m.worldSize;const b=m.getCoveringTilesDetailsProvider(),S=b.allowVariableZoom(m,t),P=Er(m,t),A=t.minzoom||0,k=t.maxzoom!==void 0?t.maxzoom:m.maxZoom,F=Math.min(Math.max(0,P),k),z=Math.pow(2,F),j=[z*p.x,z*p.y,0],G=[z*g.x,z*g.y,0],Y=Math.hypot(g.x-p.x,g.y-p.y),Q=Math.abs(g.z-p.z),K=Math.hypot(Y,Q),oe=he=>({zoom:0,x:0,y:0,wrap:he,fullyVisible:!1}),de=[],ie=[];if(m.renderWorldCopies&&b.allowWorldCopies())for(let he=1;he<=3;he++)de.push(oe(-he)),de.push(oe(he));for(de.push(oe(0));de.length>0;){const he=de.pop(),ge=he.x,ce=he.y;let ve=he.fullyVisible;const Fe={x:ge,y:ce,z:he.zoom},Ce=b.getTileBoundingVolume(Fe,he.wrap,m.elevation,t);if(!ve){const Ke=Lt(i,Ce,c);if(Ke===0)continue;ve=Ke===2}const ke=b.distanceToTile2d(p.x,p.y,Fe,Ce);let Le=P;S&&(Le=(t.calculateTileZoom||sn)(m.zoom+s.at(m.tileSize/t.tileSize),ke,Q,K,m.fov)),Le=(t.roundZoom?Math.round:Math.floor)(Le),Le=Math.max(0,Le);const Xe=Math.min(Le,k);if(he.wrap=b.getWrap(g,Fe,he.wrap),he.zoom>=Xe){if(he.zoom<A)continue;const Ke=F-he.zoom,qe=j[0]-.5-(ge<<Ke),tt=j[1]-.5-(ce<<Ke),Ct=t.reparseOverscaled?Math.max(he.zoom,Le):he.zoom;
5ie.push({tileID:new s.a2(he.zoom===k?Ct:he.zoom,he.wrap,he.zoom,ge,ce),distanceSq:s.au([G[0]-.5-ge,G[1]-.5-ce]),tileDistanceToCamera:Math.sqrt(qe*qe+tt*tt)})}else for(let Ke=0;Ke<4;Ke++)de.push({zoom:he.zoom+1,x:(ge<<1)+Ke%2,y:(ce<<1)+(Ke>>1),wrap:he.wrap,fullyVisible:ve})}return ie.sort(((he,ge)=>he.distanceSq-ge.distanceSq)).map((he=>he.tileID))}const gr=s.aa.fromPoints([new s.P(0,0),new s.P(s.a5,s.a5)]);function ln(m){return m==="raster"||m==="image"||m==="video"}function ns(m,t,i,c,p,g,b){if(!t.hasData())return!1;const{tileID:S,fadingRole:P,fadingDirection:A,fadingParentID:k}=t;if(P===ne.Base&&A===be.Incoming&&k)return i[k.key]=k,!0;const F=Math.max(S.overscaledZ-p,g);for(let z=S.overscaledZ-1;z>=F;z--){const j=S.scaledTo(z),G=m.getLoadedTile(j);if(G)return t.setCrossFadeLogic({fadingRole:ne.Base,fadingDirection:be.Incoming,fadingParentID:G.tileID,fadeEndTime:c+b}),G.setCrossFadeLogic({fadingRole:ne.Parent,fadingDirection:be.Departing,fadeEndTime:c+b}),i[j.key]=j,!0}return!1}function is(m,t,i,c,p,g){if(!t.hasData())return!1;const b=t.tileID.children(p);let S=He(m,t,b,i,c,p,g);if(S)return!0;for(const P of b)He(m,t,P.children(p),i,c,p,g)&&(S=!0);return S}function He(m,t,i,c,p,g,b){if(i[0].overscaledZ>=g)return!1;let S=!1;for(const P of i){const A=m.getLoadedTile(P);if(!A)continue;const{fadingRole:k,fadingDirection:F,fadingParentID:z}=A;k===ne.Base&&F===be.Departing&&z||(A.setCrossFadeLogic({fadingRole:ne.Base,fadingDirection:be.Departing,fadingParentID:t.tileID,fadeEndTime:p+b}),t.setCrossFadeLogic({fadingRole:ne.Parent,fadingDirection:be.Incoming,fadeEndTime:p+b})),c[P.key]=P,S=!0}return S}function Bn(m,t,i,c){const p=m.tileID;return!!m.selfFading||!m.hasData()&&!!t.has(p)&&(m.setSelfFadeLogic(i+c),!0)}function Nn(m,t){var i;m.needsHillshadePrepare=!0,m.needsTerrainPrepare=!0;let c=t.tileID.canonical.x-m.tileID.canonical.x;const p=t.tileID.canonical.y-m.tileID.canonical.y,g=Math.pow(2,m.tileID.canonical.z),b=t.tileID.key;c===0&&p===0||Math.abs(p)>1||(Math.abs(c)>1&&(Math.abs(c+g)===1?c+=g:Math.abs(c-g)===1&&(c-=g)),t.dem&&m.dem&&(m.dem.backfillBorder(t.dem,c,p),!((i=m.neighboringTiles)===null||i===void 0)&&i[b]&&(m.neighboringTiles[b].backfilled=!0)))}class ml{constructor(){this._tiles={}}handleWrapJump(t){const i={};for(const c in this._tiles){const p=this._tiles[c];p.tileID=p.tileID.unwrapTo(p.tileID.wrap+t),i[p.tileID.key]=p}this._tiles=i}setFeatureState(t,i){for(const c in this._tiles)this._tiles[c].setFeatureState(t,i)}getAllTiles(){return Object.values(this._tiles)}getAllIds(t=!1){return t?Object.values(this._tiles).map((i=>i.tileID)).sort(s.aw).map((i=>i.key)):Object.keys(this._tiles)}getTileById(t){return this._tiles[t]}setTile(t,i){this._tiles[t]=i}deleteTileById(t){delete this._tiles[t]}getLoadedTile(t){const i=this.getTileById(t.key);return i!=null&&i.hasData()?i:null}isIdRenderable(t,i=!1){var c;return(c=this.getTileById(t))===null||c===void 0?void 0:c.isRenderable(i)}getRenderableIds(t=0,i){const c=[];for(const p of this.getAllIds())this.isIdRenderable(p,i)&&c.push(this.getTileById(p));return i?c.sort(((p,g)=>{const b=p.tileID,S=g.tileID,P=new s.P(b.canonical.x,b.canonical.y)._rotate(-t),A=new s.P(S.canonical.x,S.canonical.y)._rotate(-t);return b.overscaledZ-S.overscaledZ||A.y-P.y||A.x-P.x})).map((p=>p.tileID.key)):c.map((p=>p.tileID)).sort(s.aw).map((p=>p.key))}}class pi extends s.E{constructor(t,i,c){super(),this.id=t,this.dispatcher=c,this.on("data",(p=>this._dataHandler(p))),this.on("dataloading",(()=>{this._sourceErrored=!1})),this.on("error",(()=>{this._sourceErrored=this._source.loaded()})),this._source=((p,g,b,S)=>{const P=new($(g.type))(p,g,b,S);if(P.id!==p)throw new Error(`Expected Source id to be ${p} instead of ${P.id}`);return P})(t,i,c,this),this._inViewTiles=new ml,this._outOfViewCache=new s.ax(0,(p=>this._unloadTile(p))),this._timers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new Pe,this._didEmitContent=!1,this._updated=!1}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileC
5acheZoomLevels=t?t._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){for(const i of this._inViewTiles.getAllTiles())i.unloadVectorData();this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t),this._inViewTiles=new ml}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 t of this._inViewTiles.getAllTiles())if(t.state!=="loaded"&&t.state!=="errored")return!1;return!0}getSource(){return this._source}getState(){return this._state}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,i,c){return s._(this,void 0,void 0,(function*(){try{yield this._source.loadTile(t),this._tileLoaded(t,i,c)}catch(p){t.state="errored",p.status!==404?this._source.fire(new s.k(p,{tile:t})):this.update(this.transform,this.terrain)}}))}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new s.l("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._inViewTiles,this.map?this.map.painter:null);for(const i of this._inViewTiles.getAllTiles())i.upload(t),i.prepare(this.map.style.imageManager)}getIds(){return this._inViewTiles.getAllIds(!0)}getRenderableIds(t){var i;return this._inViewTiles.getRenderableIds((i=this.transform)===null||i===void 0?void 0:i.bearingInRadians,t)}hasRenderableParent(t){const i=t.overscaledZ-1;if(i>=this._source.minzoom){const c=this.getLoadedTile(t.scaledTo(i));if(c)return this._inViewTiles.isIdRenderable(c.tileID.key)}return!1}reload(t,i=void 0){if(this._paused)this._shouldReloadOnResume=!0;else{this._outOfViewCache.reset();for(const c of this._inViewTiles.getAllIds()){const p=this._inViewTiles.getTileById(c);i&&!this._source.shouldReloadTile(p,i)||(t?this._reloadTile(c,"expired"):p.state!=="errored"&&this._reloadTile(c,"reloading"))}}}_reloadTile(t,i){return s._(this,void 0,void 0,(function*(){const c=this._inViewTiles.getTileById(t);c&&(c.state!=="loading"&&(c.state=i),yield this._loadTile(c,t,i))}))}_tileLoaded(t,i,c){t.timeAdded=fe(),t.selfFading&&(t.fadeEndTime=t.timeAdded+this._rasterFadeDuration),c==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(i,t),this.getSource().type==="raster-dem"&&t.dem&&(function(p,g){var b,S;const P=g.getRenderableIds();for(const A of P){if(!p.neighboringTiles||!p.neighboringTiles[A])continue;const k=g.getTileById(A);p.neighboringTiles[A].backfilled||Nn(p,k),!((S=(b=k.neighboringTiles)===null||b===void 0?void 0:b[p.tileID.key])===null||S===void 0)&&S.backfilled||Nn(k,p)}})(t,this._inViewTiles),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new s.l("data",{dataType:"source",tile:t,coord:t.tileID}))}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._inViewTiles.getTileById(t)}_retainLoadedChildren(t,i){const c=this._getLoadedDescendents(i),p=new Set;for(const g of i){const b=c[g.key];if(!(b!=null&&b.length)){p.add(g);continue}const S=g.overscaledZ+pi.maxOverzooming,P=b.filter((F=>F.tileID.overscaledZ<=S));if(!P.length){p.add(g);continue}const A=Math.min(...P.map((F=>F.tileID.overscaledZ))),k=P.filter((F=>F.tileID.overscaledZ===A)).map((F=>F.tileID));for(const F of k)t[F.key]=F;this._areDescendentsComplete(k,A,g.overscaledZ)||p.add(g)}return p}_getLoadedDescendents(t){var i;const c={};for(const p of this._inViewTiles.getAllTiles().filter((g=>g.hasData())))for(const g of t)p.tileID.isChildOf(g)&&(c[i=g.key]||(c[i]=[])).push(p);return c}_areDescendentsComplete(t,i,c){return t.length===1&&t[0].isOverscaled()?t[0].overscaledZ===i:Math.pow(4,i-c)===t.length}getLoadedTile(t){return this._inViewTiles.getLoadedTile(t)}updateCacheSize(t){const i=Math.ceil(t.width/this._source.tileSize)+1,c=Math.ceil(t.height/this._source.tileSize)+1,p=Math.floor(i*c*(this._maxTileC
5acheZoomLevels===null?s.c.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),g=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,p):p;this._outOfViewCache.setMaxSize(g)}handleWrapJump(t){const i=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);this._prevLng=t,i&&(this._inViewTiles.handleWrapJump(i),this._resetTileReloadTimers())}update(t,i){if(!this._sourceLoaded||this._paused)return;let c;this.transform=t,this.terrain=i,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this.used||this.usedForTerrain?this._source.tileID?c=t.getVisibleUnwrappedCoordinates(this._source.tileID).map((P=>new s.a2(P.canonical.z,P.wrap,P.canonical.z,P.canonical.x,P.canonical.y))):(c=Or(t,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.type==="vector"&&this.map._zoomLevelsToOverscale!==void 0?t.maxZoom-this.map._zoomLevelsToOverscale:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:i,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(c=c.filter((P=>this._source.hasTile(P))))):c=[],this.usedForTerrain&&(c=this._addTerrainIdealTiles(c));const p=c.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,p&&this.fire(new s.l("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const g=Er(t,this._source),b=this._updateRetainedTiles(c,g),S=ln(this._source.type);S&&this._rasterFadeDuration>0&&!i&&(function(P,A,k,F,z,j,G){const Y=fe(),Q=s.av(A);for(const K of A){const oe=P.getTileById(K.key);oe.fadingDirection!==be.Departing&&oe.fadeOpacity!==0||oe.resetFadeLogic(),ns(P,oe,k,Y,F,z,G)||is(P,oe,k,Y,j,G)||Bn(oe,Q,Y,G)||oe.resetFadeLogic()}})(this._inViewTiles,c,b,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),S?this._cleanUpRasterTiles(b):this._cleanUpVectorTiles(b)}_cleanUpRasterTiles(t){for(const i of this._inViewTiles.getAllIds())t[i]||this._removeTile(i)}_cleanUpVectorTiles(t){for(const i of this._inViewTiles.getAllIds()){const c=this._inViewTiles.getTileById(i);t[i]?c.clearSymbolFadeHold():c.hasSymbolBuckets?c.holdingForSymbolFade()?c.symbolFadeFinished()&&this._removeTile(i):c.setSymbolHoldDuration(this.map._fadeDuration):this._removeTile(i)}}_addTerrainIdealTiles(t){const i=[];for(const c of t)if(c.canonical.z>this._source.minzoom){const p=c.scaledTo(c.canonical.z-1);i.push(p);const g=c.scaledTo(Math.max(this._source.minzoom,Math.min(c.canonical.z,5)));i.push(g)}return t.concat(i)}releaseSymbolFadeTiles(){for(const t of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(t).holdingForSymbolFade()&&this._removeTile(t)}_updateRetainedTiles(t,i){var c;const p=new Set;for(const A of t)this._addTile(A).hasData()||p.add(A);const g=t.reduce(((A,k)=>(A[k.key]=k,A)),{}),b=this._retainLoadedChildren(g,p),S={},P=Math.max(i-pi.maxUnderzooming,this._source.minzoom);for(const A of b){let k=this._inViewTiles.getTileById(A.key),F=k==null?void 0:k.wasRequested();for(let z=A.overscaledZ-1;z>=P;--z){const j=A.scaledTo(z);if(S[j.key])break;if(S[j.key]=!0,k=this.getTile(j),!k&&F&&(k=this._addTile(j)),k){const G=k.hasData();if((G||!(!((c=this.map)===null||c===void 0)&&c.cancelPendingTileRequestsWhileZooming)||F)&&(g[j.key]=j),F=k.wasRequested(),G)break}}}return g}_addTile(t){let i=this._inViewTiles.getTileById(t.key);if(i)return i;i=this._outOfViewCache.getAndRemove(t),i&&(i.resetFadeLogic(),this._setTileReloadTimer(t.key,i),i.tileID=t,this._state.initializeTileState(i,this.map?this.map.painter:null));const c=i;return i||(i=new je(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(i,t.key,i.state)),i.uses++,this._inViewTiles.setTile(t.key,i),c||this._source.fire(new s.l("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i}_setTileReloadTimer(t,i){this._clearTileReloadTimer(t);const c=i.getExpiryTimeout();c&&(this._timers[t]=setTimeout((()=>{this._reloadTile(t,"expired"),delete this._timers[t]}),c))}_clearTileReloadTimer(t){const i=this._timers[t];i&&(clearTimeout(i),delete this._timers[t])}_resetTileReloadTimers(){for(const t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(const t of this._inViewTiles.getAllIds()){const i=this._inViewTiles.getTileById(t);this._setTileReloadTimer(t,i)}}refreshTiles(t){for(const i of this._inViewTiles.getAllIds()){const c=this._inViewTiles.getTileById(i);(this._inViewTiles.isIdRenderable(i)||c.state=="errored")&&t.some((p=>p.equals(c.tileID.canonical)))&&this._reloadTile(i,"expired")}}_removeTile(t){const i=this._inViewTiles.getTileById(t);i&&(i.uses--,this._inViewTiles.deleteTileById(t),this._clearTileReloadTimer(t),i.uses>0||(i.hasData()&&i.state!=="reloading"?this._outOfViewCache.add(i.tileID,i,i.getExpiryTimeout()):(i.aborted=!0,this._abortTile(i),this._unloadTile(i))))}_dataHandler(t){t.dataType==="source"&&(t.sourceDataType!=="metadata"?t.sourceDataType==="content"&&this._sourceLoaded&&!this._paused&&(this.reload(t.sourceDataChanged,t.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0):this._sourceLoaded=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t of this._inViewTiles.getAllIds())this._removeTile(t);this._outOfViewCache.reset()}tilesIn(t,i,c){const p=[],g=this.transform;if(!g)return p;const b=g.getCoveringTilesDetailsProvider().allowWorldCopies(),S=c?g.getCameraQueryGeometry(t):t,P=j=>g.screenPointToMercatorCoordinate(j,this.terrain),A=this.transformBbox(t,P,!b),k=this.transformBbox(S,P,!b),F=this.getIds(),z=s.aa.fromPoints(k);for(let j=0;j<F.length;j++){const G=this._inViewTiles.getTileById(F[j]);if(G.holdingForSymbolFade())continue;const Y=b?[G.tileID]:[G.tileID.unwrapTo(-1),G.tileID.unwrapTo(0)],Q=Math.pow(2,g.zoom-G.tileID.overscaledZ
5),K=i*G.queryPadding*s.a5/G.tileSize/Q;for(const oe of Y){const de=z.map((ie=>oe.getTilePoint(new s.a9(ie.x,ie.y))));if(de.expandBy(K),de.intersects(gr)){const ie=A.map((ge=>oe.getTilePoint(ge))),he=k.map((ge=>oe.getTilePoint(ge)));p.push({tile:G,tileID:b?oe:oe.unwrapTo(0),queryGeometry:ie,cameraQueryGeometry:he,scale:Q})}}}return p}transformBbox(t,i,c){let p=t.map(i);if(c){const g=s.aa.fromPoints(t);g.shrinkBy(.001*Math.min(g.width(),g.height()));const b=g.map(i);s.aa.fromPoints(p).covers(b)||(p=p.map((S=>S.x>.5?new s.a9(S.x-1,S.y,S.z):S)))}return p}getVisibleCoordinates(t){const i=this.getRenderableIds(t).map((c=>this._inViewTiles.getTileById(c).tileID));return this.transform&&this.transform.populateCache(i),i}hasTransition(){return!!this._source.hasTransition()||!(!ln(this._source.type)||!(function(t,i){if(i<=0)return!1;const c=fe();for(const p of t.getAllTiles())if(p.fadeEndTime>=c)return!0;return!1})(this._inViewTiles,this._rasterFadeDuration))}setRasterFadeDuration(t){this._rasterFadeDuration=t}setFeatureState(t,i,c){this._state.updateState(t=t||s.ai,i,c)}removeFeatureState(t,i,c){this._state.removeFeatureState(t=t||s.ai,i,c)}getFeatureState(t,i){return this._state.getState(t=t||s.ai,i)}setDependencies(t,i,c){const p=this._inViewTiles.getTileById(t);p&&p.setDependencies(i,c)}reloadTilesForDependencies(t,i){for(const c of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(c).hasDependency(t,i)&&this._reloadTile(c,"reloading");this._outOfViewCache.filter((c=>!c.hasDependency(t,i)))}areTilesLoaded(){for(const t of this._inViewTiles.getAllTiles())if(t.state!=="loaded"&&t.state!=="errored")return!1;return!0}}pi.maxUnderzooming=10,pi.maxOverzooming=3;class ot{constructor(t,i){this.reset(t,i)}reset(t,i){this.points=t||[],this._distances=[0];for(let c=1;c<this.points.length;c++)this._distances[c]=this._distances[c-1]+this.points[c].dist(this.points[c-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(i||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=s.an(t,0,1);let i=1,c=this._distances[i];const p=t*this.paddedLength+this.padding;for(;c<p&&i<this._distances.length;)c=this._distances[++i];const g=i-1,b=this._distances[g],S=c-b,P=S>0?(p-b)/S:0;return this.points[g].mult(1-P).add(this.points[i].mult(P))}}function Ot(m,t){let i=!0;return m==="always"||m!=="never"&&t!=="never"||(i=!1),i}class Bt{constructor(t,i,c){const p=this.boxCells=[],g=this.circleCells=[];this.xCellCount=Math.ceil(t/c),this.yCellCount=Math.ceil(i/c);for(let b=0;b<this.xCellCount*this.yCellCount;b++)p.push([]),g.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=i,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/i,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,i,c,p,g){this._forEachCell(i,c,p,g,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(i),this.bboxes.push(c),this.bboxes.push(p),this.bboxes.push(g)}
vendor: 42,359 bytes, lines 5-32
5insertCircle(t,i,c,p){this._forEachCell(i-p,c-p,i+p,c+p,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(i),this.circles.push(c),this.circles.push(p)}_insertBoxCell(t,i,c,p,g,b){this.boxCells[g].push(b)}_insertCircleCell(t,i,c,p,g,b){this.circleCells[g].push(b)}_query(t,i,c,p,g,b,S){if(c<0||t>this.width||p<0||i>this.height)return[];const P=[];if(t<=0&&i<=0&&this.width<=c&&this.height<=p){if(g)return[{key:null,x1:t,y1:i,x2:c,y2:p}];for(let A=0;A<this.boxKeys.length;A++)P.push({key:this.boxKeys[A],x1:this.bboxes[4*A],y1:this.bboxes[4*A+1],x2:this.bboxes[4*A+2],y2:this.bboxes[4*A+3]});for(let A=0;A<this.circleKeys.length;A++){const k=this.circles[3*A],F=this.circles[3*A+1],z=this.circles[3*A+2];P.push({key:this.circleKeys[A],x1:k-z,y1:F-z,x2:k+z,y2:F+z})}}else this._forEachCell(t,i,c,p,this._queryCell,P,{hitTest:g,overlapMode:b,seenUids:{box:{},circle:{}}},S);return P}query(t,i,c,p){return this._query(t,i,c,p,!1,null)}hitTest(t,i,c,p,g,b){return this._query(t,i,c,p,!0,g,b).length>0}hitTestCircle(t,i,c,p,g){const b=t-c,S=t+c,P=i-c,A=i+c;if(S<0||b>this.width||A<0||P>this.height)return!1;const k=[];return this._forEachCell(b,P,S,A,this._queryCellCircle,k,{hitTest:!0,overlapMode:p,circle:{x:t,y:i,radius:c},seenUids:{box:{},circle:{}}},g),k.length>0}_queryCell(t,i,c,p,g,b,S,P){const{seenUids:A,hitTest:k,overlapMode:F}=S,z=this.boxCells[g];if(z!==null){const G=this.bboxes;for(const Y of z)if(!A.box[Y]){A.box[Y]=!0;const Q=4*Y,K=this.boxKeys[Y];if(t<=G[Q+2]&&i<=G[Q+3]&&c>=G[Q+0]&&p>=G[Q+1]&&(!P||P(K))&&(!k||!Ot(F,K.overlapMode))&&(b.push({key:K,x1:G[Q],y1:G[Q+1],x2:G[Q+2],y2:G[Q+3]}),k))return!0}}const j=this.circleCells[g];if(j!==null){const G=this.circles;for(const Y of j)if(!A.circle[Y]){A.circle[Y]=!0;const Q=3*Y,K=this.circleKeys[Y];if(this._circleAndRectCollide(G[Q],G[Q+1],G[Q+2],t,i,c,p)&&(!P||P(K))&&(!k||!Ot(F,K.overlapMode))){const oe=G[Q],de=G[Q+1],ie=G[Q+2];if(b.push({key:K,x1:oe-ie,y1:de-ie,x2:oe+ie,y2:de+ie}),k)return!0}}}return!1}_queryCellCircle(t,i,c,p,g,b,S,P){const{circle:A,seenUids:k,overlapMode:F}=S,z=this.boxCells[g];if(z!==null){const G=this.bboxes;for(const Y of z)if(!k.box[Y]){k.box[Y]=!0;const Q=4*Y,K=this.boxKeys[Y];if(this._circleAndRectCollide(A.x,A.y,A.radius,G[Q+0],G[Q+1],G[Q+2],G[Q+3])&&(!P||P(K))&&!Ot(F,K.overlapMode))return b.push(!0),!0}}const j=this.circleCells[g];if(j!==null){const G=this.circles;for(const Y of j)if(!k.circle[Y]){k.circle[Y]=!0;const Q=3*Y,K=this.circleKeys[Y];if(this._circlesCollide(G[Q],G[Q+1],G[Q+2],A.x,A.y,A.radius)&&(!P||P(K))&&!Ot(F,K.overlapMode))return b.push(!0),!0}}}_forEachCell(t,i,c,p,g,b,S,P){const A=this._convertToXCellCoord(t),k=this._convertToYCellCoord(i),F=this._convertToXCellCoord(c),z=this._convertToYCellCoord(p);for(let j=A;j<=F;j++)for(let G=k;G<=z;G++)if(g.call(this,t,i,c,p,this.xCellCount*G+j,b,S,P))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,i,c,p,g,b){const S=p-t,P=g-i,A=c+b;return A*A>S*S+P*P}_circleAndRectCollide(t,i,c,p,g,b,S){const P=(b-p)/2,A=Math.abs(t-(p+P));if(A>P+c)return!1;const k=(S-g)/2,F=Math.abs(i-(g+k));if(F>k+c)return!1;if(A<=P||F<=k)return!0;const z=A-P,j=F-k;return z*z+j*j<=c*c}}function ri(m,t,i){const c=s.N();if(!m){const{vecSouth:F,vecEast:z}=Ji(t),j=L();j[0]=z[0],j[1]=z[1],j[2]=F[0],j[3]=F[1],p=j,(k=(b=(g=j)[0])*(A=g[3])-(P=g[2])*(S=g[1]))&&(p[0]=A*(k=1/k),p[1]=-S*k,p[2]=-P*k,p[3]=b*k),c[0]=j[0],c[1]=j[1],c[4]=j[2],c[5]=j[3]}var p,g,b,S,P,A,k;return s.Q(c,c,[1/i,1/i,1]),c}function gl(m,t,i,c){if(m){const p=s.N();if(!t){const{vecSouth:g,vecEast:b}=Ji(i);p[0]=b[0],p[1]=b[1],p[4]=g[0],p[5]=g[1]}return s.Q(p,p,[c,c,1]),p}return i.pixelsToClipSpaceMatrix}function Ji(m){const t=Math.cos(m.rollInRadians),i=Math.sin(m.rollInRadians),c=Math.cos(m.pitchInRadians),p=Math.cos(m.bearingInRadians),g=Math.sin(m.bearingInRadians),b=s.aC();b[0]=-p*c*i-g*t,b[1]=-g*c*i+p*t;const S=s.aD(b);S<1e-9?s.aE(b):s.aF(b,b,1/S);const P=s.aC();P[0]=p*c*t-g*i,P[1]=g*c*t+p*i;const A=s.aD(P);return A<1e-9?s.aE(P):s.aF(P,P,1/A),{vecEast:P,vecSouth:b}}function zt(m,t,i,c){let p;c?(p=[m,t,c(m,t),1],s.aH(p,p,i)):(p=[m,t,0,1],vl(p,p,i));const g=p[3];return{point:new s.P(p[0]/g,p[1]/g),signedDistanceFromCamera:g,isOccluded:!1}}function as(m,t){return .5+m/t*.5}function os(m,t){return m.x>=-t[0]&&m.x<=t[0]&&m.y>=-t[1]&&m.y<=t[1]}function yl(m,t,i,c,p,g,b,S,P,A,k,F,z){const j=i?m.textSizeData:m.iconSizeData,G=s.ay(j,t.transform.zoom),Y=[256/t.width*2+1,256/t.height*2+1],Q=i?m.text.dynamicLayoutVertexArray:m.icon.dynamicLayoutVertexArray;Q.clear();const K=m.lineVertexArray,oe=i?m.text.placedSymbolArray:m.icon.placedSymbolArray,de=t.transform.width/t.transform.height;let ie=!1;for(let he=0;he<oe.length;he++){const ge=oe.get(he);if(ge.hidden||ge.writingMode===s.az.vertical&&!ie){Na(ge.numGlyphs,Q);continue}ie=!1;const ce=new s.P(ge.anchorX,ge.anchorY),ve={getElevation:z,pitchedLabelPlaneMatrix:c,lineVertexArray:K,pitchWithMap:g,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:t.transform,tileAnchorPoint:ce,unwrappedTileID:P,width:A,height:k,translation:F},Fe=yo(ge.anchorX,ge.anchorY,ve);if(!os(Fe.point,Y)){Na(ge.numGlyphs,Q);continue}const Ce=as(t.transform.cameraToCenterDistance,Fe.signedDistanceFromCamera),ke=s.aA(j,G,ge),Le=g?ke*t.transform.getPitchedTextCorrection(ge.anchorX,ge.anchorY,P)/Ce:ke*Ce,Xe=go({projectionContext:ve,pitchedLabelPlaneMatrixInverse:p,symbol:ge,fontSize:Le,flip:!1,keepUpright:b,glyphOffsetArray:m.glyphOffsetArray,dynamicLayoutVertexArray:Q,aspectRatio:de,rotateToLine:S});ie=Xe.useVertical,(Xe.notEnoughRoom||ie||Xe.needsFlipping&&go({projectionContext:ve,pitchedLabelPlaneMatrixInverse:p,symbol:ge,fontSize:Le,flip:!0,keepUpright:b,glyphOffsetArray:m.glyphOffsetArray,dynamicLayoutVertexArray:Q,aspectRatio:de,rotateToLine:S}).notEnoughRoom)&&Na(ge.numGlyphs,Q)}i?m.text.dynamicLayoutVertexBuffer.updateData(Q):m.icon.dynamicLayoutVertexBuffer.updateData(Q)}function mo(m,t,i,c,p,g,b,S){const P=g.glyphStartIndex+g.numGlyphs,A=g.lineStartIndex,k=g.lineStartIndex+g.lineLength,F=t.getoffsetX(g.glyphStartIndex),z=t.getoffsetX(P-1),j=wi(m*F,i,c,p,g.segment,A,k,S,b);if(!j)return null;const G=wi(m*z,i,c,p,g.segment,A,k,S,b);return G?S.projectionCache.anyProjectionOccluded?null:{first:j,last:G}:null}function ss(m,t,i,c){return m===s.az.horizontal&&Math.abs(i.y-t.y)>Math.abs(i.x-t.x)*c?{useVertical:!0}:(m===s.az.vertical?t.y<i.y:t.x>i.x)?{needsFlipping:!0}:null}function go(m){const{projectionContext:t,pitchedLabelPlaneMatrixInverse:i,symbol:c,fontSize:p,flip:g,keepUpright:b,glyphOffsetArray:S,dynamicLayoutVertexArray:P,aspectRatio:A,rotateToLine:k}=m,F=p/24,z=c.lineOffsetX*F,j=c.lineOffsetY*F;let G;if(c.numGlyphs>1){const Y=c.glyphStartIndex+c.numGlyphs,Q=c.lineStartIndex,K=c.lineStartIndex+c.lineLength,oe=mo(F,S,z,j,g,c,k,t);if(!oe)return{notEnoughRoom:!0};const de=_l(oe.first.point.x,oe.first.point.y,t,i),ie=_l(oe.last.point.x,oe.last.point.y,t,i);if(b&&!g){const he=ss(c.writingMode,de,ie,A);if(he)return he}G=[oe.first];for(let he=c.glyphStartIndex+1;he<Y-1;he++){const ge=wi(F*S.getoffsetX(he),z,j,g,c.segment,Q,K,t,k);if(!ge)return{notEnoughRoom:!0};G.push(ge)}G.push(oe.last)}else{if(b&&!g){const Q=hr(t.tileAnchorPoint.x,t.tileAnchorPoint.y,t).point,K=c.lineStartIndex+c.segment+1,oe=new s.P(t.lineVertexArray.getx(K),t.lineVertexArray.gety(K)),de=hr(oe.x,oe.y,t),ie=de.signedDistanceFromCamera>0?de.point:ls(t.tileAnchorPoint,oe,Q,1,t),he=_l(Q.x,Q.y,t,i),ge=_l(ie.x,ie.y,t,i),ce=ss(c.writingMode,he,ge,A);if(ce)return ce}const Y=wi(F*S.getoffsetX(c.glyphStartIndex),z,j,g,c.segment,c.lineStartIndex,c.lineStartIndex+c.lineLength,t,k);if(!Y||t.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};G=[Y]}for(const Y of G)s.aG(P,Y.point,Y.angle);return{}}function ls(m,t,i,c,p){const g=m.add(m.sub(t)._unit()),b=hr(g.x,g.y,p).point,S=i.sub(b);return i.add(S._mult(c/S.mag()))}function jn(m,t,i){const c=t.projectionCache;if(c.projections[m])return c.projections[m];const p=new s.P(t.lineVertexArray.getx(m),t.lineVertexArray.gety(m)),g=hr(p.x,p.y,t);if(g.signedDistanceFromCamera>0)return c.projections[m]=g.point,c.anyProjectionOccluded=c.anyProjectionOccluded||g.isOccluded,g.point;const b=m-i.direction;return ls(i.distanceFromAnchor===0?t.tileAnchorPoint:new s.P(t.lineVertexArray.getx(b),t.lineVertexArray.gety(b)),p,i.previousVertex,i.absOffsetX-i.distanceFromAnchor+1,t)}function hr(m,t,i){const c=m+i.translation[0],p=t+i.translation[1];let g;return i.pitchWithMap?(g=zt(c,p,i.pitchedLabelPlaneMatrix,i.getElevation),g.isOccluded=!1):(g=i.transform.projectTileCoordinates(c,p,i.unwrappedTileID,i.getElevation),g.point.x=(.5*g.point.x+.5)*i.width,g.point.y=(.5*-g.point.y+.5)*i.height),g}function _l(m,t,i,c){if(i.pitchWithMap){const p=[m,t,0,1];return s.aH(p,p,c),i.transform.projectTileCoordinates(p[0]/p[3],p[1]/p[3],i.unwrappedTileID,i.getElevation).point}return{x:m/i.width*2-1,y:1-t/i.height*2}}function yo(m,t,i){return i.transform.projectTileCoordinates(m,t,i.unwrappedTileID,i.getElevation)}function cs(m,t,i){return m._unit()._perp()._mult(t*i)}function Ba(m,t,i,c,p,g,b,S,P){if(S.projectionCache.offsets[m])return S.projectionCache.offsets[m];const A=i.add(t);if(m+P.direction<c||m+P.direction>=p)return S.projectionCache.offsets[m]=A,A;const k=jn(m+P.direction,S,P),F=cs(k.sub(i),b,P.direction),z=i.add(F),j=k.add(F);return S.projectionCache.offsets[m]=s.aI(g,A,z,j)||A,S.projectionCache.offsets[m]}function wi(m,t,i,c,p,g,b,S,P){const A=c?m-t:m+t;let k=A>0?1:-1,F=0;c&&(k*=-1,F=Math.PI),k<0&&(F+=Math.PI);let z,j=k>0?g+p:g+p+1;S.projectionCache.cachedAnchorPoint?z=S.projectionCache.cachedAnchorPoint:(z=hr(S.tileAnchorPoint.x,S.tileAnchorPoint.y,S).point,S.projectionCache.cachedAnchorPoint=z);let G,Y,Q=z,K=z,oe=0,de=0;const ie=Math.abs(A),he=[];let ge;for(;oe+de<=ie;){if(j+=k,j<g||j>=b)return null;oe+=de,K=Q,Y=G;const Fe={absOffsetX:ie,direction:k,distanceFromAnchor:oe,previousVertex:K};if(Q=jn(j,S,Fe),i===0)he.push(K),ge=Q.sub(K);else{let Ce;const ke=Q.sub(K);Ce=ke.mag()===0?cs(jn(j+k,S,Fe).sub(Q),i,k):cs(ke,i,k),Y||(Y=K.add(Ce)),G=Ba(j,Ce,Q,g,b,Y,i,S,Fe),he.push(Y),ge=G.sub(Y)}de=ge.mag()}const ce=ge._mult((ie-oe)/de)._add(Y||K),ve=F+Math.atan2(Q.y-K.y,Q.x-K.x);return he.push(ce),{point:ce,angle:P?ve:0,path:he}}const Oh=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Na(m,t){for(let i=0;i<m;i++){const c=t.length;t.resize(c+4),t.float32.set(Oh,3*c)}}function vl(m,t,i){const c=t[0],p=t[1];return m[0]=i[0]*c+i[4]*p+i[12],m[1]=i[1]*c+i[5]*p+i[13],m[3]=i[3]*c+i[7]*p+i[15],m}const Br=100;class Bh{constructor(t,i=new Bt(t.width+200,t.height+200,25),c=new Bt(t.width+200,t.height+200,25)){this.transform=t,this.grid=i,this.ignoredGrid=c,this.pitchFactor=Math.cos(t.pitch*Math.PI/180)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+Br,this.screenBottomBoundary=t.height+Br,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,i,c,p,g,b,S,P,A,k,F,z){const j=this.projectAndGetPerspectiveRatio(t.anchorPointX+P[0],t.anchorPointY+P[1],g,k,z),G=c*j.perspectiveRatio;let Y;if(b||S)Y=this._projectCollisionBox(t,G,p,g,b,S,P,j,k,F,z);else{const ge=j.x+(F?F.x*G:0),ce=j.y+(F?F.y*G:0);Y={allPointsOccluded:!1,box:[ge+t.x1*G,ce+t.y1*G,ge+t.x2*G,ce+t.y2*G]}}const[Q,K,oe,de]=Y.box,ie=b?Y.allPointsOccluded:j.isOccluded;let he=ie;return he||(he=j.perspectiveRatio<this.perspectiveRatioCutoff),he||(he=!this.isInsideGrid(Q,K,oe,de)),he||i!=="always"&&this.grid.hitTest(Q,K,oe,de,i,A)?{box:[Q,K,oe,de],placeable:!1,offscreen:!1,occluded:ie}:{box:[Q,K,oe,de],placeable:!0,offscreen:this.isOffscreen(Q,K,oe,de),occluded:ie}}placeCollisionCircles(t,i,c,p,g,b,S,P,A,k,F,z,j,G){const Y=[],Q=new s.P(i.anchorX,i.anchorY),K=this.getPerspectiveRatio(Q.x,Q.y,b,G),oe=(A?g*this.transform.getPitchedTextCorrection(i.anchorX,i.anchorY,b)/K:g*K)/s.aM,de={getElevation:G,pitchedLabelPlaneMatrix:S,lineVertexArray:c,pitchWithMap:A,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:Q,unwrappedTileID:b,width:this.transform.width,height:this.transform.height,translation:j},ie=mo(oe,p,i.lineOffsetX*oe,i.lineOffsetY*oe,!1,i,!1,de);let he=!1,ge=!1,ce=!0;if(ie){const ve=.5*F*K+z,Fe=new s.P(-100,-100),Ce=new s.P(this.screenRightBoundary,this.screenBottomBoundary),ke=new ot,Le=ie.first,Xe=ie.last;let Ke=[];for(let Ct=Le.path.length-1;Ct>=1;Ct--)Ke.push(Le.path[Ct]);for(let Ct=1;Ct<Xe.path.length;Ct++)Ke.push(Xe.path[Ct]);const qe=2.5*ve;if(A){const Ct=this.projectPathToScreenSpace(Ke,de);Ke=Ct.some((cr=>cr.signedDistanceFromCamera<=0))?[]:Ct.map((cr=>cr.point))}let tt=[];if(Ke.length>0){const Ct=Ke[0].clone(),cr=Ke[0].clone();for(let Pr=1;Pr<Ke.length;Pr++)Ct.x=Math.min(Ct.x,Ke[Pr].x),Ct.y=Math.min(Ct.y,Ke[Pr].y),cr.x=Math.max(cr.x,Ke[Pr].x),cr.y=Math.max(cr.y,Ke[Pr].y);tt=Ct.x>=Fe.x&&cr.x<=Ce.x&&Ct.y>=Fe.y&&cr.y<=Ce.y?[Ke]:cr.x<Fe.x||Ct.x>Ce.x||cr.y<Fe.y||Ct.y>Ce.y?[]:s.aJ([Ke],Fe.x,Fe.y,Ce.x,Ce.y)}for(const Ct of tt){ke.reset(Ct,.25*ve);let cr=0;cr=ke.length<=.5*ve?1:Math.ceil(ke.paddedLength/qe)+1;for(let Pr=0;Pr<cr;Pr++){const vr=Pr/Math.max(cr-1,1),Ar=ke.lerp(vr),xr=Ar.x+Br,jr=Ar.y+Br;Y.push(xr,jr,ve,0);const Cr=xr-ve,xn=jr-ve,tn=xr+ve,Hr=jr+ve;if(ce=ce&&this.isOffscreen(Cr,xn,tn,Hr),ge=ge||this.isInsideGrid(Cr,xn,tn,Hr),t!=="always"&&this.grid.hitTestCircle(xr,jr,ve,t,k)&&(he=!0,!P))return{circles:[],offscreen:!1,collisionDetected:he}}}}return{circles:!P&&he||!ge||K<this.perspectiveRatioCutoff?[]:Y,offscreen:ce,collisionDetected:he}}projectPathToScreenSpace(t,i){const c=(function(p,g){const b=s.N();return s.aB(b,g.pitchedLabelPlaneMatrix),p.map((S=>{const P=zt(S.x,S.y,b,g.getElevation),A=g.transform.projectTileCoordinates(P.point.x,P.point.y,g.unwrappedTileID,g.getElevation);return A.point.x=(.5*A.point.x+.5)*g.width,A.point.y=(.5*-A.point.y+.5)*g.height,A}))})(t,i);return(function(p){let g=0,b=0,S=0,P=0;for(let A=0;A<p.length;A++)p[A].isOccluded?(S=A+1,P=0):(P++,P>b&&(b=P,g=S));return p.slice(g,g+b)})(c)}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const i=[],c=new s.aa;for(const F of t){const z=new s.P(F.x+Br,F.y+Br);c.extend(z),i.push(z)}const{minX:p,minY:g,maxX:b,maxY:S}=c,P=this.grid.query(p,g,b,S).concat(this.ignoredGrid.query(p,g,b,S)),A={},k={};for(const F of P){const z=F.key;if(A[z.bucketInstanceId]===void 0&&(A[z.bucketInstanceId]={}),A[z.bucketInstanceId][z.featureIndex])continue;const j=[new s.P(F.x1,F.y1),new s.P(F.x2,F.y1),new s.P(F.x2,F.y2),new s.P(F.x1,F.y2)];s.aK(i,j)&&(A[z.bucketInstanceId][z.featureIndex]=!0,k[z.bucketInstanceId]===void 0&&(k[z.bucketInstanceId]=[]),k[z.bucketInstanceId].push(z.featureIndex))}return k}insertCollisionBox(t,i,c,p,g,b){(c?this.ignoredGrid:this.grid).insert({bucketInstanceId:p,featureIndex:g,collisionGroupID:b,overlapMode:i},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,i,c,p,g,b){const S=c?this.ignoredGrid:this.grid,P={bucketInstanceId:p,featureIndex:g,collisionGroupID:b,overlapMode:i};for(let A=0;A<t.length;A+=4)S.insertCircle(P,t[A],t[A+1],t[A+2])}projectAndGetPerspectiveRatio(t,i,c,p,g){if(g){let b;p?(b=[t,i,p(t,i),1],s.aH(b,b,g)):(b=[t,i,0,1],vl(b,b,g));const S=b[3];return{x:(b[0]/S+1)/2*this.transform.width+Br,y:(-b[1]/S+1)/2*this.transform.height+Br,perspectiveRatio:.5+this.transform.cameraToCenterDistance/S*.5,isOccluded:!1,signedDistanceFromCamera:S}}{const b=this.transform.projectTileCoordinates(t,i,c,p);return{x:(b.point.x+1)/2*this.transform.width+Br,y:(1-b.point.y)/2*this.transform.height+Br,perspectiveRatio:.5+this.transform.cameraToCenterDistance/b.signedDistanceFromCamera*.5,isOccluded:b.isOccluded,signedDistanceFromCamera:b.signedDistanceFromCamera}}}getPerspectiveRatio(t,i,c,p){const g=this.transform.projectTileCoordinates(t,i,c,p);return .5+this.transform.cameraToCenterDistance/g.signedDistanceFromCamera*.5}isOffscreen(t,i,c,p){return c<Br||t>=this.screenRightBoundary||p<Br||i>this.screenBottomBoundary}isInsideGrid(t,i,c,p){return c>=0&&t<this.gridRightBoundary&&p>=0&&i<this.gridBottomBoundary}getViewportMatrix(){const t=s.ar([]);return s.O(t,t,[-100,-100,0]),t}_projectCollisionBox(t,i,c,p,g,b,S,P,A,k,F){let z=1,j=0,G=0,Y=1;const Q=t.anchorPointX+S[0],K=t.anchorPointY+S[1];if(b&&!g){const Ke=this.projectAndGetPerspectiveRatio(Q+1,K,p,A,F),qe=Ke.x-P.x,tt=Math.atan((Ke.y-P.y)/qe)+(qe<0?Math.PI:0),Ct=Math.sin(tt),cr=Math.cos(tt);z=cr,j=Ct,G=-Ct,Y=cr}else if(!b&&g){const Ke=Ji(this.transform);z=Ke.vecEast[0],j=Ke.vecEast[1],G=Ke.vecSouth[0],Y=Ke.vecSouth[1]}let oe=P.x,de=P.y,ie=i;g&&(oe=Q,de=K,ie=Math.pow(2,-(this.transform.zoom-c.overscaledZ)),ie*=this.transform.getPitchedTextCorrection(Q,K,p),k||(ie*=s.an(.5+P.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),k&&(oe+=z*k.x*ie+G*k.y*ie,de+=j*k.x*ie+Y*k.y*ie);const he=t.x1*ie,ge=t.x2*ie,ce=(he+ge)/2,ve=t.y1*ie,Fe=t.y2*ie,Ce=(ve+Fe)/2,ke=[{offsetX:he,offsetY:ve},{offsetX:ce,offsetY:ve},{offsetX:ge,offsetY:ve},{offsetX:ge,offsetY:Ce},{offsetX:ge,offsetY:Fe},{offsetX:ce,offsetY:Fe},{offsetX:he,offsetY:Fe},{offsetX:he,offsetY:Ce}];let Le=[];for(const{offsetX:Ke,offsetY:qe}of ke)Le.push(new s.P(oe+z*Ke+G*qe,de+j*Ke+Y*qe));let Xe=!1;if(g){const Ke=Le.map((qe=>this.projectAndGetPerspectiveRatio(qe.x,qe.y,p,A,F)));Xe=Ke.some((qe=>!qe.isOccluded)),Le=Ke.map((qe=>new s.P(qe.x,qe.y)))}else Xe=!0;return{box:s.aL(Le),allPointsOccluded:!Xe}}}class Nh{constructor(t,i,c,p){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?i:-i))):p&&c?1:0,this.placed=c}isHidden(){return this.opacity===0&&!this.placed}}class us{constructor(t,i,c,p,g){this.text=new Nh(t?t.text:null,i,c,g),this.icon=new Nh(t?t.icon:null,i,p,g)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class jh{constructor(t,i,c){this.text=t,this.icon=i,this.skipFade=c}}class Vh{constructor(t,i,c,p,g){this.bucketInstanceId=t,this.featureIndex=i,this.sourceLayerIndex=c,this.bucketIndex=p,this.tileID=g}}class Uh{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const i=++this.maxGroupID;this.collisionGroups[t]={ID:i,predicate:c=>c.collisionGroupID===i}}return this.collisionGroups[t]}}function xl(m,t,i,c,p){const{horizontalAlign:g,verticalAlign:b}=s.aS(m);return new s.P(-(g-.5)*t+c[0]*p,-(b-.5)*i+c[1]*p)}class $c{constructor(t,i,c,p,g){this.transform=t.clone(),this.terrain=i,this.collisionIndex=new Bh(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=c,this.retainedQueryData={},this.collisionGroups=new Uh(p),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=g,g&&(g.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(t){const i=this.terrain;return i?(c,p)=>i.getElevation(t,c,p):null}getBucketParts(t,i,c,p){const g=c.getBucket(i),b=c.latestFeatureIndex;if(!g||!b||i.id!==g.layerIds[0])return;const S=c.collisionBoxArray,P=g.layers[0].layout,A=g.layers[0].paint,k=Math.pow(2,this.transform.zoom-c.tileID.overscaledZ),F=c.tileSize/s.a5,z=c.tileID.toUnwrapped(),j=P.get("text-rotation-alignment")==="map",G=s.aN(c,1,this.transform.zoom),Y=s.aO(this.collisionIndex.transform,c,A.get("text-translate"),A.get("text-translate-anchor")),Q=s.aO(this.collisionIndex.transform,c,A.get("icon-translate"),A.get("icon-translate-anchor")),K=ri(j,this.transform,G);this.retainedQueryData[g.bucketInstanceId]=new Vh(g.bucketInstanceId,b,g.sourceLayerIndex,g.index,c.tileID);const oe={bucket:g,layout:P,translationText:Y,translationIcon:Q,unwrappedTileID:z,pitchedLabelPlaneMatrix:K,scale:k,textPixelRatio:F,holdingForFade:c.holdingForSymbolFade(),collisionBoxArray:S,partiallyEvaluatedTextSize:s.ay(g.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(g.sourceID)};if(p)for(const de of g.sortKeyRanges){const{sortKey:ie,symbolInstanceStart:he,symbolInstanceEnd:ge}=de;t.push({sortKey:ie,symbolInstanceStart:he,symbolInstanceEnd:ge,parameters:oe})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:g.symbolInstances.length,parameters:oe})}attemptAnchorPlacement(t,i,c,p,g,b,S,P,A,k,F,z,j,G,Y,Q,K,oe,de,ie){const he=s.aP[t.textAnchor],ge=[t.textOffset0,t.textOffset1],ce=xl(he,c,p,ge,g),ve=this.collisionIndex.placeCollisionBox(i,z,P,A,k,S,b,Q,F.predicate,de,ce,ie);if((!oe||this.collisionIndex.placeCollisionBox(oe,z,P,A,k,S,b,K,F.predicate,de,ce,ie).placeable)&&ve.placeable){let Fe;if(this.prevPlacement&&this.prevPlacement.variableOffsets[j.crossTileID]&&this.prevPlacement.placements[j.crossTileID]&&this.prevPlacement.placements[j.crossTileID].text&&(Fe=this.prevPlacement.variableOffsets[j.crossTileID].anchor),j.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[j.crossTileID]={textOffset:ge,width:c,height:p,anchor:he,textBoxScale:g,prevAnchor:Fe},this.markUsedJustification(G,he,j,Y),G.allowVerticalPlacement&&(this.markUsedOrientation(G,Y,j),this.placedOrientations[j.crossTileID]=Y),{shift:ce,placedGlyphBoxes:ve}}}placeLayerBucketPart(t,i,c){const{bucket:p,layout:g,translationText:b,translationIcon:S,unwrappedTileID:P,pitchedLabelPlaneMatrix:A,textPixelRatio:k,holdingForFade:F,collisionBoxArray:z,partiallyEvaluatedTextSize:j,collisionGroup:G}=t.parameters,Y=g.get("text-optional"),Q=g.get("icon-optional"),K=s.aQ(g,"text-overlap","text-allow-overlap"),oe=K==="always",de=s.aQ(g,"icon-overlap","icon-allow-overlap"),ie=de==="always",he=g.get("text-rotation-alignment")==="map",ge=g.get("text-pitch-alignment")==="map",ce=g.get("icon-text-fit")!=="none",ve=g.get("symbol-z-order")==="viewport-y",Fe=oe&&(ie||!p.hasIconData()||Q),Ce=ie&&(oe||!p.hasTextData()||Y);!p.collisionArrays&&z&&p.deserializeCollisionBoxes(z);const ke=this.retainedQueryData[p.bucketInstanceId].tileID,Le=this._getTerrainElevationFunc(ke),Xe=this.transform.getFastPathSimpleProjectionMatrix(ke),Ke=(qe,tt,Ct)=>{var cr,Pr;if(i[qe.crossTileID])return;if(F)return void(this.placements[qe.crossTileID]=new jh(!1,!1,!1));let vr=!1,Ar=!1,xr=!0,jr=null,Cr={box:null,placeable:!1,offscreen:null,occluded:!1},xn={placeable:!1},tn=null,Hr=null,An=null,Sa=0,ta=0,qi=0;tt.textFeatureIndex?Sa=tt.textFeatureIndex:qe.useRuntimeCollisionCircles&&(Sa=qe.featureIndex),tt.verticalTextFeatureIndex&&(ta=tt.verticalTextFeatureIndex);const Kn=tt.textBox;if(Kn){const yi=Tr=>{let br=s.az.horizontal;if(p.allowVerticalPlacement&&!Tr&&this.prevPlacement){const mn=this.prevPlacement.placedOrientations[qe.crossTileID];mn&&(this.placedOrientations[qe.crossTileID]=mn,br=mn,this.markUsedOrientation(p,br,qe))}return br},Gi=(Tr,br)=>{if(p.allowVerticalPlacement&&qe.numVerticalGlyphVertices>0&&tt.verticalTextBox){for(const mn of p.writingModes)if(mn===s.az.vertical?(Cr=br(),xn=Cr):Cr=Tr(),Cr&&Cr.placeable)break}else Cr=Tr()},Ii=qe.textAnchorOffsetStartIndex,Ai=qe.textAnchorOffsetEndIndex;if(Ai===Ii){const Tr=(br,mn)=>{const gn=this.collisionIndex.placeCollisionBox(br,K,k,ke,P,ge,he,b,G.predicate,Le,void 0,Xe);return gn&&gn.placeable&&(this.markUsedOrientation(p,mn,qe),this.placedOrientations[qe.crossTileID]=mn),gn};Gi((()=>Tr(Kn,s.az.horizontal)),(()=>{const br=tt.verticalTextBox;return p.allowVerticalPlacement&&qe.numVerticalGlyphVertices>0&&br?Tr(br,s.az.vertical):{box:null,offscreen:null}})),yi(Cr&&Cr.placeable)}else{let Tr=s.aP[(Pr=(cr=this.prevPlacement)===null||cr===void 0?void 0:cr.variableOffsets[qe.crossTileID])===null||Pr===void 0?void 0:Pr.anchor];const br=(gn,Op,Bp)=>{const no=gn.x2-gn.x1,Bf=gn.y2-gn.y1,Np=qe.textBoxScale,Ou=ce&&de==="never"?Op:null;let Ea=null,Pa=K==="never"?1:2,Ma="never";Tr&&Pa++;for(let Bu=0;Bu<Pa;Bu++){for(let Nu=Ii;Nu<Ai;Nu++){const nc=p.textAnchorOffsets.get(Nu);if(Tr&&nc.textAnchor!==Tr)continue;const ic=this.attemptAnchorPlacement(nc,gn,no,Bf,Np,he,ge,k,ke,P,G,Ma,qe,p,Bp,b,S,Ou,Le);if(ic&&(Ea=ic.placedGlyphBoxes,Ea&&Ea.placeable))return vr=!0,jr=ic.shift,Ea}Tr?Tr=null:Ma=K}return c&&!Ea&&(Ea={box:this.collisionIndex.placeCollisionBox(Kn,"always",k,ke,P,ge,he,b,G.predicate,Le,void 0,Xe).box,offscreen:!1,placeable:!1,occluded:!1}),Ea};Gi((()=>br(Kn,tt.iconBox,s.az.horizontal)),(()=>{const gn=tt.verticalTextBox;return p.allowVerticalPlacement&&(!Cr||!Cr.placeable)&&qe.numVerticalGlyphVertices>0&&gn?br(gn,tt.verticalIconBox,s.az.vertical):{box:null,occluded:!0,offscreen:null}})),Cr&&(vr=Cr.placeable,xr=Cr.offscreen);const mn=yi(Cr&&Cr.placeable);if(!vr&&this.prevPlacement){const gn=this.prevPlacement.variableOffsets[qe.crossTileID];gn&&(this.variableOffsets[qe.crossTileID]=gn,this.markUsedJustification(p,gn.anchor,qe,mn))}}}if(tn=Cr,vr=tn&&tn.placeable,xr=tn&&tn.offscreen,qe.useRuntimeCollisionCircles&&qe.centerJustifiedTextSymbolIndex>=0){const yi=p.text.placedSymbolArray.get(qe.centerJustifiedTextSymbolIndex),Gi=s.aA(p.textSizeData,j,yi),Ii=g.get("text-padding");Hr=this.collisionIndex.placeCollisionCircles(K,yi,p.lineVertexArray,p.glyphOffsetArray,Gi,P,A,c,ge,G.predicate,qe.collisionCircleDiameter,Ii,b,Le),Hr.circles.length&&Hr.collisionDetected&&!c&&s.w("Collisions detected, but collision boxes are not shown"),vr=oe||Hr.circles.length>0&&!Hr.collisionDetected,xr=xr&&Hr.offscreen}if(tt.iconFeatureIndex&&(qi=tt.iconFeatureIndex),tt.iconBox){const yi=Gi=>this.collisionIndex.placeCollisionBox(Gi,de,k,ke,P,ge,he,S,G.predicate,Le,ce&&jr?jr:void 0,Xe);xn&&xn.placeable&&tt.verticalIconBox?(An=yi(tt.verticalIconBox),Ar=An.placeable):(An=yi(tt.iconBox),Ar=An.placeable),xr=xr&&An.offscreen}const to=Y||qe.numHorizontalGlyphVertices===0&&qe.numVerticalGlyphVertices===0,qs=Q||qe.numIconVertices===0;to||qs?qs?to||(Ar=Ar&&vr):vr=Ar&&vr:Ar=vr=Ar&&vr;const ro=Ar&&An.placeable;if(vr&&tn.placeable&&this.collisionIndex.insertCollisionBox(tn.box,K,g.get("text-ignore-placement"),p.bucketInstanceId,xn&&xn.placeable&&ta?ta:Sa,G.ID),ro&&this.collisionIndex.insertCollisionBox(An.box,de,g.get("icon-ignore-placement"),p.bucketInstanceId,qi,G.ID),Hr&&vr&&this.collisionIndex.insertCollisionCircles(Hr.circles,K,g.get("text-ignore-placement"),p.bucketInstanceId,Sa,G.ID),c&&this.storeCollisionData(p.bucketInstanceId,Ct,tt,tn,An,Hr),qe.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(p.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[qe.crossTileID]=new jh((vr||Fe)&&!(tn!=null&&tn.occluded),(Ar||Ce)&&!(An!=null&&An.occluded),xr||p.justReloaded),i[qe.crossTileID]=!0};if(ve){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const qe=p.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let tt=qe.length-1;tt>=0;--tt){const Ct=qe[tt];Ke(p.symbolInstances.get(Ct),p.collisionArrays[Ct],Ct)}}else for(let qe=t.symbolInstanceStart;qe<t.symbolInstanceEnd;qe++)Ke(p.symbolInstances.get(qe),p.collisionArrays[qe],qe);p.justReloaded=!1}storeCollisionData(t,i,c,p,g,b){if(c.textBox||c.iconBox){let S,P;this.collisionBoxArrays.has(t)?S=this.collisionBoxArrays.get(t):(S=new Map,this.collisionBoxArrays.set(t,S)),S.has(i)?P=S.get(i):(P={text:null,icon:null},S.set(i,P)),c.textBox&&(P.text=p.box),c.iconBox&&(P.icon=g.box)}if(b){let S=this.collisionCircleArrays[t];S===void 0&&(S=this.collisionCircleArrays[t]=[]);for(let P=0;P<b.circles.length;P+=4)S.push(b.circles[P+0]-Br),S.push(b.circles[P+1]-Br),S.push(b.circles[P+2]),S.push(b.collisionDetected?1:0)}}markUsedJustification(t,i,c,p){let g;g=p===s.az.vertical?c.verticalPlacedTextSymbolIndex:{left:c.leftJustifiedTextSymbolIndex,center:c.centerJustifiedTextSymbolIndex,right:c.rightJustifiedTextSymbolIndex}[s.aR(i)];const b=[c.leftJustifiedTextSymbolIndex,c.centerJustifiedTextSymbolIndex,c.rightJustifiedTextSymbolIndex,c.verticalPlacedTextSymbolIndex];for(const S of b)S>=0&&(t.text.placedSymbolArray.get(S).crossTileID=g>=0&&S!==g?0:c.crossTileID)}markUsedOrientation(t,i,c){const p=i===s.az.horizontal||i===s.az.horizontalOnly?i:0,g=i===s.az.vertical?i:0,b=[c.leftJustifiedTextSymbolIndex,c.centerJustifiedTextSymbolIndex,c.rightJustifiedTextSymbolIndex];for(const S of b)t.text.placedSymbolArray.get(S).placedOrientation=p;c.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(c.verticalPlacedTextSymbolIndex).placedOrientation=g)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const i=this.prevPlacement;let c=!1;this.prevZoomAdjustment=i?i.zoomAdjustment(this.transform.zoom):0;const p=i?i.symbolFadeChange(t):1,g=i?i.opacities:{},b=i?i.variableOffsets:{},S=i?i.placedOrientations:{};for(const P in this.placements){const A=this.placements[P],k=g[P];k?(this.opacities[P]=new us(k,p,A.text,A.icon),c=c||A.text!==k.text.placed||A.icon!==k.icon.placed):(this.opacities[P]=new us(null,p,A.text,A.icon,A.skipFade),c=c||A.text||A.icon)}for(const P in g){const A=g[P];if(!this.opacities[P]){const k=new us(A,p,!1,!1);k.isHidden()||(this.opacities[P]=k,c=c||A.text.placed||A.icon.placed)}}for(const P in b)this.variableOffsets[P]||!this.opacities[P]||this.opacities[P].isHidden()||(this.variableOffsets[P]=b[P]);for(const P in S)this.placedOrientations[P]||!this.opacities[P]||this.opacities[P].isHidden()||(this.placedOrientations[P]=S[P]);if(i&&i.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");c?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=i?i.lastPlacementChangeTime:t)}updateLayerOpacities(t,i){const c={};for(const p of i){const g=p.getBucket(t);g&&p.latestFeatureIndex&&t.id===g.layerIds[0]&&this.updateBucketOpacities(g,p.tileID,c,p.collisionBoxArray)}}updateBucketOpacities(t,i,c,p){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const g=t.layers[0],b=g.layout,S=new us(null,0,!1,!1,!0),P=b.get("text-allow-overlap"),A=b.get("icon-allow-overlap"),k=g._unevaluatedLayout.hasValue("text-variable-anchor")||g._unevaluatedLayout.hasValue("text-variable-anchor-offset"),F=b.get("text-rotation-alignment")==="map",z=b.get("text-pitch-alignment")==="map",j=b.get("icon-text-fit")!=="none",G=new us(null,0,P&&(A||!t.hasIconData()||b.get("icon-optional")),A&&(P||!t.hasTextData()||b.get("text-optional")),!0);!t.collisionArrays&&p&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(p);const Y=(K,oe,de)=>{for(let ie=0;ie<oe/4;ie++)K.opacityVertexArray.emplaceBack(de);K.hasVisibleVertices=K.hasVisibleVertices||de!==ps},Q=this.collisionBoxArrays.get(t.bucketInstanceId);for(let K=0;K<t.symbolInstances.length;K++){const oe=t.symbolInstances.get(K),{numHorizontalGlyphVertices:de,numVerticalGlyphVertices:ie,crossTileID:he}=oe;let ge=this.opacities[he];c[he]?ge=S:ge||(ge=G,this.opacities[he]=ge),c[he]=!0;const ce=oe.numIconVertices>0,ve=this.placedOrientations[oe.crossTileID],Fe=ve===s.az.vertical,Ce=ve===s.az.horizontal||ve===s.az.horizontalOnly;if(de>0||ie>0){const Le=Wc(ge.text);Y(t.text,de,Fe?ps:Le),Y(t.text,ie,Ce?ps:Le);const Xe=ge.text.isHidden();[oe.rightJustifiedTextSymbolIndex,oe.centerJustifiedTextSymbolIndex,oe.leftJustifiedTextSymbolIndex].forEach((tt=>{tt>=0&&(t.text.placedSymbolArray.get(tt).hidden=Xe||Fe?1:0)})),oe.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(oe.verticalPlacedTextSymbolIndex).hidden=Xe||Ce?1:0);const Ke=this.variableOffsets[oe.crossTileID];Ke&&this.markUsedJustification(t,Ke.anchor,oe,ve);const qe=this.placedOrientations[oe.crossTileID];qe&&(this.markUsedJustification(t,"left",oe,qe),this.markUsedOrientation(t,qe,oe))}if(ce){const Le=Wc(ge.icon),Xe=!(j&&oe.verticalPlacedIconSymbolIndex&&Fe);oe.placedIconSymbolIndex>=0&&(Y(t.icon,oe.numIconVertices,Xe?Le:ps),t.icon.placedSymbolArray.get(oe.placedIconSymbolIndex).hidden=ge.icon.isHidden()),oe.verticalPlacedIconSymbolIndex>=0&&(Y(t.icon,oe.numVerticalIconVertices,Xe?ps:Le),t.icon.placedSymbolArray.get(oe.verticalPlacedIconSymbolIndex).hidden=ge.icon.isHidden())}const ke=Q&&Q.has(K)?Q.get(K):{text:null,icon:null};if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const Le=t.collisionArrays[K];if(Le){let Xe=new s.P(0,0);if(Le.textBox||Le.verticalTextBox){let Ke=!0;if(k){const qe=this.variableOffsets[he];qe?(Xe=xl(qe.anchor,qe.width,qe.height,qe.textOffset,qe.textBoxScale),F&&Xe._rotate(z?-this.transform.bearingInRadians:this.transform.bearingInRadians)):Ke=!1}if(Le.textBox||Le.verticalTextBox){let qe;Le.textBox&&(qe=Fe),Le.verticalTextBox&&(qe=Ce),qc(t.textCollisionBox.collisionVertexArray,ge.text.placed,!Ke||qe,ke.text,Xe.x,Xe.y)}}if(Le.iconBox||Le.verticalIconBox){const Ke=!!(!Ce&&Le.verticalIconBox);let qe;Le.iconBox&&(qe=Ke),Le.verticalIconBox&&(qe=!Ke),qc(t.iconCollisionBox.collisionVertexArray,ge.icon.placed,qe,ke.icon,j?Xe.x:0,j?Xe.y:0)}}}}if(t.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);t.bucketInstanceId in this.collisionCircleArrays&&(t.collisionCircleArray=this.collisionCircleArrays[t.bucketInstanceId],delete this.collisionCircleArrays[t.bucketInstanceId])}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,i){const c=this.zoomAtLastRecencyCheck===i?1-this.zoomAdjustment(i):1;return this.zoomAtLastRecencyCheck=i,this.commitTime+this.fadeDuration*c>t}setStale(){this.stale=!0}}function qc(m,t,i,c,p,g){c&&c.length!==0||(c=[0,0,0,0]);const b=c[0]-Br,S=c[1]-Br,P=c[2]-Br,A=c[3]-Br;m.emplaceBack(t?1:0,i?1:0,p||0,g||0,b,S),m.emplaceBack(t?1:0,i?1:0,p||0,g||0,P,S),m.emplaceBack(t?1:0,i?1:0,p||0,g||0,P,A),m.emplaceBack(t?1:0,i?1:0,p||0,g||0,b,A)}const Gc=Math.pow(2,25),Zc=Math.pow(2,24),df=Math.pow(2,17),hs=Math.pow(2,16),bl=Math.pow(2,9),$h=Math.pow(2,8),_o=Math.pow(2,1);function Wc(m){if(m.opacity===0&&!m.placed)return 0;if(m.opacity===1&&m.placed)return 4294967295;const t=m.placed?1:0,i=Math.floor(127*m.opacity);return i*Gc+t*Zc+i*df+t*hs+i*bl+t*$h+i*_o+t}const ps=0;class ma{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,i,c,p,g){const b=this._bucketParts;for(;this._currentTileIndex<t.length;)if(i.getBucketParts(b,p,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,g())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,b.sort(((S,P)=>S.sortKey-P.sortKey)));this._currentPartIndex<b.length;)if(i.placeLayerBucketPart(b[this._currentPartIndex],this._seenCrossTileIDs,c),this._currentPartIndex++,g())return!0;return!1}}class vo{constructor(t,i,c,p,g,b,S,P){this.placement=new $c(t,i,b,S,P),this._currentPlacementIndex=c.length-1,this._forceFullPlacement=p,this._showCollisionBoxes=g,this._done=!1}isDone(){return this._done}continuePlacement(t,i,c){const p=fe(),g=()=>!this._forceFullPlacement&&fe()-p>2;for(;this._currentPlacementIndex>=0;){const b=i[t[this._currentPlacementIndex]],S=this.placement.collisionIndex.transform.zoom;if(b.type==="symbol"&&(!b.minzoom||b.minzoom<=S)&&(!b.maxzoom||b.maxzoom>S)){if(this._inProgressLayer||(this._inProgressLayer=new ma(b)),this._inProgressLayer.continuePlacement(c[b.source],this.placement,this._showCollisionBoxes,b,g))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Nt=512/s.a5/2;class Hc{constructor(t,i,c){this.tileID=t,this.bucketInstanceId=c,this._symbolsByKey={};const p=new Map;for(let g=0;g<i.length;g++){const b=i.get(g),S=b.key,P=p.get(S);P?P.push(b):p.set(S,[b])}for(const[g,b]of p){const S={positions:b.map((P=>({x:Math.floor(P.anchorX*Nt),y:Math.floor(P.anchorY*Nt)}))),crossTileIDs:b.map((P=>P.crossTileID))};if(S.positions.length>128){const P=new s.aT(S.positions.length,16,Uint16Array);for(const{x:A,y:k}of S.positions)P.add(A,k);P.finish(),delete S.positions,S.index=P}this._symbolsByKey[g]=S}}getScaledCoordinates(t,i){const{x:c,y:p,z:g}=this.tileID.canonical,{x:b,y:S,z:P}=i.canonical,A=Nt/Math.pow(2,P-g),k=(S*s.a5+t.anchorY)*A,F=p*s.a5*Nt;return{x:Math.floor((b*s.a5+t.anchorX)*A-c*s.a5*Nt),y:Math.floor(k-F)}}findMatches(t,i,c){const p=this.tileID.canonical.z<i.canonical.z?1:Math.pow(2,this.tileID.canonical.z-i.canonical.z);for(let g=0;g<t.length;g++){const b=t.get(g);if(b.crossTileID)continue;const S=this._symbolsByKey[b.key];if(!S)continue;const P=this.getScaledCoordinates(b,i);if(S.index){const A=S.index.range(P.x-p,P.y-p,P.x+p,P.y+p).sort();for(const k of A){const F=S.crossTileIDs[k];if(!c[F]){c[F]=!0,b.crossTileID=F;break}}}else if(S.positions)for(let A=0;A<S.positions.length;A++){const k=S.positions[A],F=S.crossTileIDs[A];if(Math.abs(k.x-P.x)<=p&&Math.abs(k.y-P.y)<=p&&!c[F]){c[F]=!0,b.crossTileID=F;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map((({crossTileIDs:t})=>t))}}class ff{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Xc{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const i=Math.round((t-this.lng)/360);if(i!==0)for(const c in this.indexes){const p=this.indexes[c],g={};for(const b in p){const S=p[b];S.tileID=S.tileID.unwrapTo(S.tileID.wrap+i),g[S.tileID.key]=S}this.indexes[c]=g}this.lng=t}addBucket(t,i,c){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===i.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let g=0;g<i.symbolInstances.length;g++)i.symbolInstances.get(g).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const p=this.usedCrossTileIDs[t.overscaledZ];for(const g in this.indexes){const b=this.indexes[g];if(Number(g)>t.overscaledZ)for(const S in b){const P=b[S];P.tileID.isChildOf(t)&&P.findMatches(i.symbolInstances,t,p)}else{const S=b[t.scaledTo(Number(g)).key];S&&S.findMatches(i.symbolInstances,t,p)}}for(let g=0;g<i.symbolInstances.length;g++){const b=i.symbolInstances.get(g);b.crossTileID||(b.crossTileID=c.generate(),p[b.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new Hc(t,i.symbolInstances,i.bucketInstanceId),!0}removeBucketCrossTileIDs(t,i){for(const c of i.getCrossTileIDsLists())for(const p of c)delete this.usedCrossTileIDs[t][p]}removeStaleBuckets(t){let i=!1;for(const c in this.indexes){const p=this.indexes[c];for(const g in p)t[p[g].bucketInstanceId]||(this.removeBucketCrossTileIDs(c,p[g]),delete p[g],i=!0)}return i}}class Xn{constructor(){this.layerIndexes={},this.crossTileIDs=new ff,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,i,c){let p=this.layerIndexes[t.id];p===void 0&&(p=this.layerIndexes[t.id]=new Xc);let g=!1;const b={};p.handleWrapJump(c);for(const S of i){const P=S.getBucket(t);P&&t.id===P.layerIds[0]&&(P.bucketInstanceId||(P.bucketInstanceId=++this.maxBucketInstanceId),p.addBucket(S.tileID,P,this.crossTileIDs)&&(g=!0),b[P.bucketInstanceId]=!0)}return p.removeStaleBuckets(b)&&(g=!0),g}pruneUnusedLayers(t){const i={};t.forEach((c=>{i[c]=!0}));for(const c in this.layerIndexes)i[c]||delete this.layerIndexes[c]}}var Dn="void main() {fragColor=vec4(1.0);}";const Rr={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(Dn,"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(Dn,`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 lowp float u_lineatlas_width;uniform sampler2D u_image;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
543#pragma mapbox: define mediump vec4 dasharray_from
544#pragma mapbox: define mediump vec4 dasharray_to
545void main() {
546#pragma mapbox: initialize highp vec4 color
547#pragma mapbox: initialize lowp float blur
548#pragma mapbox: initialize lowp float opacity
549#pragma mapbox: initialize mediump float width
550#pragma mapbox: initialize lowp float floorwidth
551#pragma mapbox: initialize mediump vec4 dasharray_from
552#pragma mapbox: initialize mediump vec4 dasharray_to
553float 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);
553float sdfgamma=(u_lineatlas_width/256.0/u_device_pixel_ratio)/min(dasharray_from.w,dasharray_to.w);alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);
554#ifdef GLOBE
555if (v_depth > 1.0) {discard;}
556#endif
557#ifdef OVERDRAW_INSPECTOR
558fragColor=vec4(1.0);
559#endif
560}`,`
561#define scale 0.015873016
562#define LINE_DISTANCE_SCALE 2.0
563in 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_units_to_pixels;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;
564#ifdef GLOBE
565out float v_depth;
566#endif
567#pragma mapbox: define highp vec4 color
568#pragma mapbox: define lowp float blur
569#pragma mapbox: define lowp float opacity
570#pragma mapbox: define mediump float gapwidth
571#pragma mapbox: define lowp float offset
572#pragma mapbox: define mediump float width
573#pragma mapbox: define lowp float floorwidth
574#pragma mapbox: define mediump vec4 dasharray_from
575#pragma mapbox: define mediump vec4 dasharray_to
576void main() {
577#pragma mapbox: initialize highp vec4 color
578#pragma mapbox: initialize lowp float blur
579#pragma mapbox: initialize lowp float opacity
580#pragma mapbox: initialize mediump float gapwidth
581#pragma mapbox: initialize lowp float offset
582#pragma mapbox: initialize mediump float width
583#pragma mapbox: initialize lowp float floorwidth
584#pragma mapbox: initialize mediump vec4 dasharray_from
585#pragma mapbox: initialize mediump vec4 dasharray_to
586float 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;
587#ifdef GLOBE
588v_depth=gl_Position.z/gl_Position.w;
589#endif
590#ifdef TERRAIN3D
591v_gamma_scale=1.0;
592#else
593float 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;
594#endif
595float u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}`),lineGradientSDF:Mt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform sampler2D u_image_dash;uniform float u_mix;uniform lowp float u_lineatlas_width;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;in highp vec2 v_uv;
596#ifdef GLOBE
597in float v_depth;
598#endif
599#pragma mapbox: define lowp float blur
600#pragma mapbox: define lowp float opacity
601#pragma mapbox: define mediump float width
602#pragma mapbox: define lowp float floorwidth
603#pragma mapbox: define mediump vec4 dasharray_from
604#pragma mapbox: define mediump vec4 dasharray_to
605void main() {
606#pragma mapbox: initialize lowp float blur
607#pragma mapbox: initialize lowp float opacity
608#pragma mapbox: initialize mediump float width
609#pragma mapbox: initialize lowp float floorwidth
610#pragma mapbox: initialize mediump vec4 dasharray_from
611#pragma mapbox: initialize mediump vec4 dasharray_to
612float 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);float sdfdist_a=texture(u_image_dash,v_tex_a).a;float sdfdist_b=texture(u_image_dash,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);
612float sdfgamma=(u_lineatlas_width/256.0)/min(dasharray_from.w,dasharray_to.w);float dash_alpha=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*dash_alpha*opacity);
613#ifdef GLOBE
614if (v_depth > 1.0) {discard;}
615#endif
616#ifdef OVERDRAW_INSPECTOR
617fragColor=vec4(1.0);
618#endif
619}`,`
620#define scale 0.015873016
621#define LINE_DISTANCE_SCALE 2.0
622in 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;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;out vec2 v_tex_a;out vec2 v_tex_b;
623#ifdef GLOBE
624out float v_depth;
625#endif
626#pragma mapbox: define lowp float blur
627#pragma mapbox: define lowp float opacity
628#pragma mapbox: define mediump float gapwidth
629#pragma mapbox: define lowp float offset
630#pragma mapbox: define mediump float width
631#pragma mapbox: define lowp float floorwidth
632#pragma mapbox: define mediump vec4 dasharray_from
633#pragma mapbox: define mediump vec4 dasharray_to
634void main() {
635#pragma mapbox: initialize lowp float blur
636#pragma mapbox: initialize lowp float opacity
637#pragma mapbox: initialize mediump float gapwidth
638#pragma mapbox: initialize lowp float offset
639#pragma mapbox: initialize mediump float width
640#pragma mapbox: initialize lowp float floorwidth
641#pragma mapbox: initialize mediump vec4 dasharray_from
642#pragma mapbox: initialize mediump vec4 dasharray_to
643float 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;float texel_height=1.0/u_image_height;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;
644#ifdef GLOBE
645v_depth=gl_Position.z/gl_Position.w;
646#endif
647#ifdef TERRAIN3D
648v_gamma_scale=1.0;
649#else
650float 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;
651#endif
652float u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);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);
653#ifdef OVERDRAW_INSPECTOR
654fragColor=vec4(1.0);
655#endif
656}`,`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;
657#ifdef GLOBE
658if (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}
659#endif
660v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),symbolIcon:Mt(`uniform sampler2D u_texture;in vec2 v_tex;in float v_fade_opacity;
661#pragma mapbox: define lowp float opacity
662void main() {
663#pragma mapbox: initialize lowp float opacity
664lowp float alpha=opacity*v_fade_opacity;fragColor=texture(u_texture,v_tex)*alpha;
665#ifdef OVERDRAW_INSPECTOR
666fragColor=vec4(1.0);
667#endif
668}`,`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;
669#pragma mapbox: define lowp float opacity
670void main() {
671#pragma mapbox: initialize lowp float opacity
672vec2 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 ?
673camera_to_anchor_distance/u_camera_to_center_distance :
674u_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;
675#ifdef GLOBE
676if(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);}
677#endif
678vec4 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));}
678`),symbolSDF:Mt(`#define SDF_PX 8.0
679uniform 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;
680#pragma mapbox: define highp vec4 fill_color
681#pragma mapbox: define highp vec4 halo_color
682#pragma mapbox: define lowp float opacity
683#pragma mapbox: define lowp float halo_width
684#pragma mapbox: define lowp float halo_blur
685void main() {
686#pragma mapbox: initialize highp vec4 fill_color
687#pragma mapbox: initialize highp vec4 halo_color
688#pragma mapbox: initialize lowp float opacity
689#pragma mapbox: initialize lowp float halo_width
690#pragma mapbox: initialize lowp float halo_blur
691float 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);
692#ifdef OVERDRAW_INSPECTOR
693fragColor=vec4(1.0);
694#endif
695}`,`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;
696#pragma mapbox: define highp vec4 fill_color
697#pragma mapbox: define highp vec4 halo_color
698#pragma mapbox: define lowp float opacity
699#pragma mapbox: define lowp float halo_width
700#pragma mapbox: define lowp float halo_blur
701void main() {
702#pragma mapbox: initialize highp vec4 fill_color
703#pragma mapbox: initialize highp vec4 halo_color
704#pragma mapbox: initialize lowp float opacity
705#pragma mapbox: initialize lowp float halo_width
706#pragma mapbox: initialize lowp float halo_blur
707vec2 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 ?
708camera_to_anchor_distance/u_camera_to_center_distance :
709u_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;
710#ifdef GLOBE
711if(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);}
712#endif
713vec4 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
714#define SDF 1.0
715#define ICON 0.0
716uniform 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;
717#pragma mapbox: define highp vec4 fill_color
718#pragma mapbox: define highp vec4 halo_color
719#pragma mapbox: define lowp float opacity
720#pragma mapbox: define lowp float halo_width
721#pragma mapbox: define lowp float halo_blur
722void main() {
723#pragma mapbox: initialize highp vec4 fill_color
724#pragma mapbox: initialize highp vec4 halo_color
725#pragma mapbox: initialize lowp float opacity
726#pragma mapbox: initialize lowp float halo_width
727#pragma mapbox: initialize lowp float halo_blur
728float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;
728fragColor=texture(u_texture_icon,tex_icon)*alpha;
729#ifdef OVERDRAW_INSPECTOR
730fragColor=vec4(1.0);
731#endif
732return;}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);
733#ifdef OVERDRAW_INSPECTOR
734fragColor=vec4(1.0);
735#endif
736}`,`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;
737#pragma mapbox: define highp vec4 fill_color
738#pragma mapbox: define highp vec4 halo_color
739#pragma mapbox: define lowp float opacity
740#pragma mapbox: define lowp float halo_width
741#pragma mapbox: define lowp float halo_blur
742void main() {
743#pragma mapbox: initialize highp vec4 fill_color
744#pragma mapbox: initialize highp vec4 halo_color
745#pragma mapbox: initialize lowp float opacity
746#pragma mapbox: initialize lowp float halo_width
747#pragma mapbox: initialize lowp float halo_blur
748vec2 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 ?
749camera_to_anchor_distance/u_camera_to_center_distance :
750u_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;
751#ifdef GLOBE
752if(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);}
753#endif
754vec4 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);
754float 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(`#ifdef GL_ES
755precision highp float;
756#endif
757in 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
758);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);}")};
vendor: 129,668 bytes, lines 758-809
758function Mt(m,t){const i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,c=t.match(/in ([\w]+) ([\w]+)/g),p=m.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),g=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),b=g?g.concat(p):p,S={};return{fragmentSource:m=m.replace(i,((P,A,k,F,z)=>(S[z]=!0,A==="define"?`
759#ifndef HAS_UNIFORM_u_${z}
760in ${k} ${F} ${z};
761#else
762uniform ${k} ${F} u_${z};
763#endif
764`:`
765#ifdef HAS_UNIFORM_u_${z}
766    ${k} ${F} ${z} = u_${z};
767#endif
768`))),vertexSource:t=t.replace(i,((P,A,k,F,z)=>{const j=F==="float"?"vec2":"vec4",G=z.match(/color/)?"color":j;return S[z]?A==="define"?`
769#ifndef HAS_UNIFORM_u_${z}
770uniform lowp float u_${z}_t;
771in ${k} ${j} a_${z};
772out ${k} ${F} ${z};
773#else
774uniform ${k} ${F} u_${z};
775#endif
776`:G==="vec4"?`
777#ifndef HAS_UNIFORM_u_${z}
778    ${z} = a_${z};
779#else
780    ${k} ${F} ${z} = u_${z};
781#endif
782`:`
783#ifndef HAS_UNIFORM_u_${z}
784    ${z} = unpack_mix_${G}(a_${z}, u_${z}_t);
785#else
786    ${k} ${F} ${z} = u_${z};
787#endif
788`:A==="define"?`
789#ifndef HAS_UNIFORM_u_${z}
790uniform lowp float u_${z}_t;
791in ${k} ${j} a_${z};
792#else
793uniform ${k} ${F} u_${z};
794#endif
795`:G==="vec4"?`
796#ifndef HAS_UNIFORM_u_${z}
797    ${k} ${F} ${z} = a_${z};
798#else
799    ${k} ${F} ${z} = u_${z};
800#endif
801`:`
802#ifndef HAS_UNIFORM_u_${z}
803    ${k} ${F} ${z} = unpack_mix_${G}(a_${z}, u_${z}_t);
804#else
805    ${k} ${F} ${z} = u_${z};
806#endif
807`})),staticAttributes:c,staticUniforms:b}}class yr{constructor(t,i,c){this.vertexBuffer=t,this.indexBuffer=i,this.segments=c}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var ga=s.aU([{name:"a_pos",type:"Int16",components:2}]);const Vn="#define PROJECTION_MERCATOR",ni="mercator";class Un{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return ni}get shaderDefine(){return Vn}get shaderPreludeCode(){return Rr.projectionMercator}get vertexShaderPreludeCode(){return Rr.projectionMercator.vertexSource}get subdivisionGranularity(){return s.aV.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(t){}getMeshFromTileID(t,i,c,p,g){if(this._cachedMesh)return this._cachedMesh;const b=new s.aW;b.emplaceBack(0,0),b.emplaceBack(s.a5,0),b.emplaceBack(0,s.a5),b.emplaceBack(s.a5,s.a5);const S=t.createVertexBuffer(b,ga.members),P=s.aX.simpleSegment(0,0,4,2),A=new s.aY;A.emplaceBack(1,0,2),A.emplaceBack(1,2,3);const k=t.createIndexBuffer(A);return this._cachedMesh=new yr(S,k,P),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(t){}}class xo{constructor(t=0,i=0,c=0,p=0){if(isNaN(t)||t<0||isNaN(i)||i<0||isNaN(c)||c<0||isNaN(p)||p<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=i,this.left=c,this.right=p}interpolate(t,i,c){return i.top!=null&&t.top!=null&&(this.top=s.G.number(t.top,i.top,c)),i.bottom!=null&&t.bottom!=null&&(this.bottom=s.G.number(t.bottom,i.bottom,c)),i.left!=null&&t.left!=null&&(this.left=s.G.number(t.left,i.left,c)),i.right!=null&&t.right!=null&&(this.right=s.G.number(t.right,i.right,c)),this}getCenter(t,i){const c=s.an((this.left+t-this.right)/2,0,t),p=s.an((this.top+i-this.bottom)/2,0,i);return new s.P(c,p)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new xo(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function ya(m,t){if(!m.renderWorldCopies||m.lngRange)return;const i=t.lng-m.center.lng;t.lng+=i>180?-360:i<-180?360:0}function Gr(m){return Math.max(0,Math.floor(m))}class ja{constructor(t,i){var c;this.applyConstrain=(p,g)=>this._constrainOverride!==null?this._constrainOverride(p,g):this._callbacks.defaultConstrain(p,g),this._callbacks=t,this._tileSize=512,this._renderWorldCopies=(i==null?void 0:i.renderWorldCopies)===void 0||!!(i!=null&&i.renderWorldCopies),this._minZoom=(i==null?void 0:i.minZoom)||0,this._maxZoom=(i==null?void 0:i.maxZoom)||22,this._minPitch=(i==null?void 0:i.minPitch)==null?0:i==null?void 0:i.minPitch,this._maxPitch=(i==null?void 0:i.maxPitch)==null?60:i==null?void 0:i.maxPitch,this._constrainOverride=(c=i==null?void 0:i.constrainOverride)!==null&&c!==void 0?c:null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new s.V(0,0),this._elevation=0,this._zoom=0,this._tileZoom=Gr(this._zoom),this._scale=s.aq(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new xo,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(t,i,c){this._constrainOverride=t.constrainOverride,this._latRange=t.latRange,this._lngRange=t.lngRange,this._width=t.width,this._height=t.height,this._center=t.center,this._elevation=t.elevation,this._minElevationForCurrentTile=t.minElevationForCurrentTile,this._zoom=t.zoom,this._tileZoom=Gr(this._zoom),this._scale=s.aq(this._zoom),this._bearingInRadians=t.bearingInRadians,this._fovInRadians=t.fovInRadians,this._pitchInRadians=t.pitchInRadians,this._rollInRadians=t.rollInRadians,this._unmodified=t.unmodified,this._edgeInsets=new xo(t.padding.top,t.padding.bottom,t.padding.left,t.padding.right),this._minZoom=t.minZoom,this._maxZoom=t.maxZoom,this._minPitch=t.minPitch,this._maxPitch=t.maxPitch,this._renderWorldCopies=t.renderWorldCopies,this._cameraToCenterDistance=t.cameraToCenterDistance,this._nearZ=t.nearZ,this._farZ=t.farZ,this._autoCalculateNearFarZ=!c&&t.autoCalculateNearFarZ,i&&this.constrainInternal(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(t){this._minElevationForCurrentTile=t}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(t){this._minZoom!==t&&(this._minZoom=t,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(t){this._minPitch!==t&&(this._minPitch=t,this.setPitch(Math.max(this.pitch,t)))}get maxPitch(){return this._maxPitch}setMaxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.setPitch(Math.min(this.pitch,t)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get constrainOverride(){return this._constrainOverride}setConstrainOverride(t){t===void 0&&(t=null),this._constrainOverride!==t&&(this._constrainOverride=t,this.constrainInternal(),this._calcMatrices())}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new s.P(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(t){const i=s.W(t,-180,180)*Math.PI/180;var c,p,g,b,S,P,A,k,F;this._bearingInRadians!==i&&(this._unmodified=!1,this._bearingInRadians=i,this._calcMatrices(),this._rotationMatrix=L(),c=this._rotationMatrix,g=-this._bearingInRadians,b=(p=this._rotationMatrix)[0],S=p[1],P=p[2],A=p[3],k=Math.sin(g),F=Math.cos(g),c[0]=b*F+P*k,c[1]=S*F+A*k,c[2]=b*-k+P*F,c[3]=S*-k+A*F)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(t){const i=s.an(t,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(t){const i=t/180*Math.PI;this._rollInRadians!==i&&(this._unmodified=!1,this._rollInRadians=i,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return s.aZ(this._fovInRadians)}setFov(t){t=s.an(t,.1,150),this.fov!==t&&(this._unmodified=!1,this._fovInRadians=s.ap(t),this._calcMatrices())}get zoom(){return this._zoom}setZoom(t){const i=this.applyConstrain(this._center,t).zoom;this._zoom!==i&&(this._unmodified=!1,this._zoom=i,this._tileZoom=Math.max(0,Math.floor(i)),this._scale=s.aq(i),this.constrainInternal(),this._calcMatrices())}get center(){return this._center}setCenter(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this.constrainInternal(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(t){t!==this._elevation&&(this._elevation=t,this.constrainInternal(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,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(t,i){this._autoCalculateNearFarZ=!1,this._nearZ=t,this._farZ=i,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,i,c){this._unmodified=!1,this._edgeInsets.interpolate(t,i,c),this.constrainInternal(),this._calcMatrices()}resize(t,i,c=!0){this._width=t,this._height=i,c&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){return this._latRange&&this._latRange.length===2&&this._lngRange&&this._lngRange.length===2?new Kt([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]]):null}setMaxBounds(t){t?(this._lngRange=[t.getWest(),t.getEast()],this._latRange=[t.getSouth(),t.getNorth()],this.constrainInternal()):(this._lngRange=null,this._latRange=[-s.ao,s.ao])}getCameraQueryGeometry(t,i){if(i.length===1)return[i[0],t];{const{minX:c,minY:p,maxX:g,maxY:b}=s.aa.fromPoints(i).extend(t);return[new s.P(c,p),new s.P(g,p),new s.P(g,b),new s.P(c,b),new s.P(c,p)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;const t=this._unmodified,{center:i,zoom:c}=this.applyConstrain(this.center,this.zoom);this.setCenter(i),this.setZoom(c),this._unmodified=t,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let t=s.ar(new Float64Array(16));s.Q(t,t,[this._width/2,-this._height/2,1]),s.O(t,t,[1,-1,0]),this._clipSpaceToPixelsMatrix=t,t=s.ar(new Float64Array(16)),s.Q(t,t,[1,-1,1]),s.O(t,t,[-1,-1,0]),s.Q(t,t,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=t,this._cameraToCenterDistance=.5/Math.tan(this.fovInRadians/2)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(t,i,c,p){const g=c!==void 0?c:this.bearing,b=p=p!==void 0?p:this.pitch,{distanceToCenter:S,clampedElevation:P}=this._distanceToCenterFromAltElevationPitch(i,this.elevation,b),{x:A,y:k}=Et(b,g),F=s.a9.fromLngLat(t,i);let z,j,G=s.a_(1,F.y),Y=0;do{if(Y+=1,Y>10)break;j=S/G,z=new s.a9(F.x+A*j,F.y+k*j),G=1/z.meterInMercatorCoordinateUnits()}while(Math.abs(S-j*G)>1e-12);return{center:z.toLngLat(),elevation:P,zoom:s.at(this.height/2/Math.tan(this.fovInRadians/2)/j/this.tileSize)}}recalculateZoomAndCenter(t){if(this.elevation-t==0)return;const i=1/this.worldSize,c=s.as(1,this.center.lat)*this.worldSize,p=s.a9.fromLngLat(this.center,this.elevation),g=p.x/i,b=p.y/i,S=p.z/i,P=this.pitch,A=this.bearing,{x:k,y:F,z}=Et(P,A),j=this.cameraToCenterDistance,G=g+j*-k,Y=b+j*-F,Q=S+j*z,{distanceToCenter:K,clampedElevation:oe}=this._distanceToCenterFromAltElevationPitch(Q/c,t,P),de=K*c,ie=new s.a9((G+k*de)*i,(Y+F*de)*i,0).toLngLat(),he=s.as(1,ie.lat),ge=s.at(this.height/2/Math.tan(this.fovInRadians/2)/K/he/this.tileSize);this._elevation=oe,this._center=ie,this.setZoom(ge)}_distanceToCenterFromAltElevationPitch(t,i,c){const p=-Math.cos(s.ap(c)),g=t-i;let b,S=i;return p*g>=0||Math.abs(p)<.1?(b=1e4,S=t+b*p):b=-g/p,{distanceToCenter:b,clampedElevation:S}}getCameraPoint(){const t=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new s.P(t*Math.sin(this.rollInRadians),t*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){const t=s.as(1,this.center.lat)*this.worldSize;return Te(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/t).toLngLat()}getMercatorTileCoordinates(t){if(!t)return[0,0,1,1];const i=t.canonical.z>=0?1<<t.canonical.z:Math.pow(2,t.canonical.z);return[t.canonical.x/i,t.canonical.y/i,1/i/s.a5,1/i/s.a5]}}class Ui{constructor(t,i){this.min=t,this.max=i,this.center=s.a$([],s.b0([],this.min,this.max),.5)}quadrant(t){const i=[t%2==0,t<2],c=s.b1(this.min),p=s.b1(this.max);for(let g=0;g<i.length;g++)c[g]=i[g]?this.min[g]:this.center[g],p[g]=i[g]?this.center[g]:this.max[g];return p[2]=this.max[2],new Ui(c,p)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersectsFrustum(t){let i=!0;for(let c=0;c<t.planes.length;c++){const p=this.intersectsPlane(t.planes[c]);if(p===0)return 0;p===1&&(i=!1)}return i?2:t.aabb.min[0]>this.max[0]||t.aabb.min[1]>this.max[1]||t.aabb.min[2]>this.max[2]||t.aabb.max[0]<this.min[0]||t.aabb.max[1]<this.min[1]||t.aabb.max[2]<this.min[2]?0:1}intersectsPlane(t){let i=t[3],c=t[3];for(let p=0;p<3;p++)t[p]>0?(i+=t[p]*this.min[p],c+=t[p]*this.max[p]):(c+=t[p]*this.min[p],i+=t[p]*this.max[p]);return i>=0?2:c<0?0:1}}class wl{distanceToTile2d(t,i,c,p){const g=p.distanceX([t,i]),b=p.distanceY([t,i]);return Math.hypot(g,b)}getWrap(t,i,c){return c}getTileBoundingVolume(t,i,c,p){var g,b;let S=0,P=0;if(p!=null&&p.terrain){const k=new s.a2(t.z,i,t.z,t.x,t.y),F=p.terrain.getMinMaxElevation(k);S=(g=F.minElevation)!==null&&g!==void 0?g:Math.min(0,c),P=(b=F.maxElevation)!==null&&b!==void 0?b:Math.max(0,c)}const A=1<<t.z;return new Ui([i+t.x/A,t.y/A,S],[i+(t.x+1)/A,(t.y+1)/A,P])}allowVariableZoom(t,i){const c=t.fov*(Math.abs(Math.cos(t.rollInRadians))*t.height+Math.abs(Math.sin(t.rollInRadians))*t.width)/t.height,p=s.an(78.5-c/2,0,60);return!!i.terrain||t.pitch>p}allowWorldCopies(){return!0}prepareNextFrame(){}}class Yn{constructor(t,i,c){this.points=t,this.planes=i,this.aabb=c}static fromInvProjectionMatrix(t,i=1,c=0,p,g){const b=g?[[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]],S=Math.pow(2,c),P=[[-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((z=>(function(j,G,Y,Q){const K=s.aH([],j,G),oe=1/K[3]/Y*Q;return s.b6(K,K,[oe,oe,1/K[3],oe])})(z,t,i,S)));p&&(function(z,j,G,Y){const Q=Y?4:0,K=Y?0:4;let oe=0;const de=[],ie=[];for(let ce=0;ce<4;ce++){const ve=s.b2([],z[ce+K],z[ce+Q]),Fe=s.b7(ve);s.a$(ve,ve,1/Fe),de.push(Fe),ie.push(ve)}for(let ce=0;ce<4;ce++){const ve=s.b8(z[ce+Q],ie[ce],G);oe=ve!==null&&ve>=0?Math.max(oe,ve):Math.max(oe,de[ce])}const he=(function(ce,ve){const Fe=s.b2([],ce[ve[0]],ce[ve[1]]),Ce=s.b2([],ce[ve[2]],ce[ve[1]]),ke=[0,0,0,0];return s.b3(ke,s.b4([],Fe,Ce)),ke[3]=-s.b5(ke,ce[ve[0]]),ke})(z,j),ge=(function(ce,ve){const Fe=s.b9(ce),Ce=s.ba([],ce,1/Fe),ke=s.b2([],ve,s.a$([],Ce,s.b5(ve,Ce))),Le=s.b9(ke);if(Le>0){const Xe=Math.sqrt(1-Ce[3]*Ce[3]),Ke=s.a$([],Ce,-Ce[3]),qe=s.b0([],Ke,s.a$([],ke,Xe/Le));return s.bb(ve,qe)}return null})(G,he);if(ge!==null){const ce=ge/s.b5(ie[0],he);oe=Math.min(oe,ce)}for(let ce=0;ce<4;ce++){const ve=Math.min(oe,de[ce]);z[ce+K]=[z[ce+Q][0]+ie[ce][0]*ve,z[ce+Q][1]+ie[ce][1]*ve,z[ce+Q][2]+ie[ce][2]*ve,1]}})(P,b[0],p,g);const A=b.map((z=>{const j=s.b2([],P[z[0]],P[z[1]]),G=s.b2([],P[z[2]],P[z[1]]),Y=s.b3([],s.b4([],j,G)),Q=-s.b5(Y,P[z[1]]);return Y.concat(Q)})),k=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],F=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(const z of P)for(let j=0;j<3;j++)k[j]=Math.min(k[j],z[j]),F[j]=Math.max(F[j],z[j]);return new Yn(P,A,new Ui(k,F))}}class Va{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(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,i,c){return this._helper.interpolatePadding(t,i,c)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,i,c=!0){this._helper.resize(t,i,c)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,i){this._helper.overrideNearFarZ(t,i)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}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 constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t,i){}constructor(t){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this.defaultConstrain=(i,c)=>{c=s.an(+c,this.minZoom,this.maxZoom);const p={center:new s.V(i.lng,i.lat),zoom:c};let g=this._helper._lngRange;if(!this._helper._renderWorldCopies&&g===null){const ie=179.9999999999;g=[-ie,ie]}const b=this.tileSize*s.aq(p.zoom);let S=0,P=b,A=0,k=b,F=0,z=0;const{x:j,y:G}=this.size;if(this._helper._latRange){const ie=this._helper._latRange;S=s.X(ie[1])*b,P=s.X(ie[0])*b,P-S<G&&(F=G/(P-S))}g&&(A=s.W(s.Y(g[0])*b,0,b),k=s.W(s.Y(g[1])*b,0,b),k<A&&(k+=b),k-A<j&&(z=j/(k-A)));const{x:Y,y:Q}=it(b,i);let K,oe;const de=Math.max(z||0,F||0);if(de){const ie=new s.P(z?(k+A)/2:Y,F?(P+S)/2:Q);return p.center=rt(b,ie).wrap(),p.zoom+=s.at(de),p}if(this._helper._latRange){const ie=G/2;Q-ie<S&&(oe=S+ie),Q+ie>P&&(oe=P-ie)}if(g){const ie=(A+k)/2;let he=Y;this._helper._renderWorldCopies&&(he=s.W(Y,ie-b/2,ie+b/2));const ge=j/2;he-ge<A&&(K=A+ge),he+ge>k&&(K=k-ge)}if(K!==void 0||oe!==void 0){const ie=new s.P(K??Y,oe??Q);p.center=rt(b,ie).wrap()}return p},this.applyConstrain=(i,c)=>this._helper.applyConstrain(i,c),this._helper=new ja({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(i,c)=>this.defaultConstrain(i,c)},t),this._coveringTilesDetailsProvider=new wl}clone(){const t=new Va;return t.apply(this,!1),t}apply(t,i,c){this._helper.apply(t,i,c)}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(t){const i=[new s.bc(0,t)];if(this._helper._renderWorldCopies){const c=this.screenPointToMercatorCoordinate(new s.P(0,0)),p=this.screenPointToMercatorCoordinate(new s.P(this._helper._width,0)),g=this.screenPointToMercatorCoordinate(new s.P(this._helper._width,this._helper._height)),b=this.screenPointToMercatorCoordinate(new s.P(0,this._helper._height)),S=Math.floor(Math.min(c.x,p.x,g.x,b.x)),P=Math.floor(Math.max(c.x,p.x,g.x,b.x)),A=1;for(let k=S-A;k<=P+A;k++)k!==0&&i.push(new s.bc(k,t))}return i}getCameraFrustum(){return Yn.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){const i=this.screenPointToLocation(this.centerPoint,t),c=t?t.getElevationForLngLatZoom(i,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(c)}setLocationAtPoint(t,i){const c=s.as(this.elevation,this.center.lat),p=this.screenPointToMercatorCoordinateAtZ(i,c),g=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,c),b=s.a9.fromLngLat(t),S=new s.a9(b.x-(p.x-g.x),b.y-(p.y-g.y));this.setCenter(S==null?void 0:S.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(t,i){return i?this.coordinatePoint(s.a9.fromLngLat(t),i.getElevationForLngLat(t,this),this._pixelMatrix3D):this.coordinatePoint(s.a9.fromLngLat(t))}screenPointToLocation(t,i){var c;return(c=this.screenPointToMercatorCoordinate(t,i))===null||c===void 0?void 0:c.toLngLat()}screenPointToMercatorCoordinate(t,i){if(i){const c=i.pointCoordinate(t);if(c!=null)return c}return this.screenPointToMercatorCoordinateAtZ(t)}screenPointToMercatorCoordinateAtZ(t,i){const c=i||0,p=[t.x,t.y,0,1],g=[t.x,t.y,1,1];s.aH(p,p,this._pixelMatrixInverse),s.aH(g,g,this._pixelMatrixInverse);const b=p[3],S=g[3],P=p[1]/b,A=g[1]/S,k=p[2]/b,F=g[2]/S,z=k===F?0:(c-k)/(F-k);return new s.a9(s.G.number(p[0]/b,g[0]/S,z)/this.worldSize,s.G.number(P,A,z)/this.worldSize,c)}coordinatePoint(t,i=0,c=this._pixelMatrix){const p=[t.x*this.worldSize,t.y*this.worldSize,i,1];return s.aH(p,p,c),new s.P(p[0]/p[3],p[1]/p[3])}getBounds(){const t=Math.max(0,this._helper._height/2-At(this));return new Kt().extend(this.screenPointToLocation(new s.P(0,t))).extend(this.screenPointToLocation(new s.P(this._helper._width,t))).extend(this.screenPointToLocation(new s.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new s.P(0,this._helper._height)))}isPointOnMapSurface(t,i){return i?i.pointCoordinate(t)!=null:t.y>this.height/2-At(this)}calculatePosMatrix(t,i=!1,c){var p;const g=(p=t.key)!==null&&p!==void 0?p:s.bd(t.wrap,t.canonical.z,t.canonical.z,t.canonical.x,t.canonical.y),b=i?this._alignedPosMatrixCache:this._posMatrixCache;if(b.has(g)){const A=b.get(g);return c?A.f32:A.f64}const S=St(t,this.worldSize);s.S(S,i?this._alignedProjMatrix:this._viewProjMatrix,S);const P={f64:S,f32:new Float32Array(S)};return b.set(g,P),c?P.f32:P.f64}calculateFogMatrix(t){const i=t.key,c=this._fogMatrixCacheF32;if(c.has(i))return c.get(i);const p=St(t,this.worldSize);return s.S(p,this._fogMatrix,p),c.set(i,new Float32Array(p)),c.get(i)}calculateCenterFromCameraLngLatAlt(t,i,c,p){return this._helper.calculateCenterFromCameraLngLatAlt(t,i,c,p)}_calculateNearFarZIfNeeded(t,i,c){if(!this._helper.autoCalculateNearFarZ)return;const p=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),g=t-p*this._helper._pixelPerMeter/Math.cos(i),b=p<0?g:t,S=Math.PI/2+this.pitchInRadians,P=s.ap(this.fov)*(Math.abs(Math.cos(s.ap(this.roll)))*this.height+Math.abs(Math.sin(s.ap(this.roll)))*this.width)/this.height*(.5+c.y/this.height),A=Math.sin(P)*b/Math.sin(s.an(Math.PI-S-P,.01,Math.PI-.01)),k=At(this),F=Math.atan(k/this._helper.cameraToCenterDistance),z=s.ap(.75),j=F>z?2*F*(.5+c.y/(2*k)):z,G=Math.sin(j)*b/Math.sin(s.an(Math.PI-S-j,.01,Math.PI-.01)),Y=Math.min(A,G);this._helper._farZ=1.01*(Math.cos(Math.PI/2-i)*Y+b),this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;const t=this.centerOffset,i=it(this.worldSize,this.center),c=i.x,p=i.y;this._helper._pixelPerMeter=s.as(1,this.center.lat)*this.worldSize;const g=s.ap(Math.min(this.pitch,Ye)),b=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(g));let S;this._calculateNearFarZIfNeeded(b,g,t),S=new Float64Array(16),s.be(S,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),s.aB(this._invProjMatrix,S),S[8]=2*-t.x/this._helper._width,S[9]=2*t.y/this._helper._height,this._projectionMatrix=s.bf(S),s.Q(S,S,[1,-1,1]),s.O(S,S,[0,0,-this._helper.cameraToCenterDistance]),s.bg(S,S,-this.rollInRadians),s.bh(S,S,this.pitchInRadians),s.bg(S,S,-this.bearingInRadians),s.O(S,S,[-c,-p,0]),this._mercatorMatrix=s.Q([],S,[this.worldSize,this.worldSize,this.worldSize]),s.Q(S,S,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=s.S(new Float64Array(16),this.clipSpaceToPixelsMatrix,S),s.O(S,S,[0,0,-this.elevation]),this._viewProjMatrix=S,this._invViewProjMatrix=s.aB([],S);const P=[0,0,-1,1];s.aH(P,P,this._invViewProjMatrix),this._cameraPosition=[P[0]/P[3],P[1]/P[3],P[2]/P[3]],this._fogMatrix=new Float64Array(16),s.be(this._fogMatrix,this.fovInRadians,this.width/this.height,b,this._helper._farZ),this._fogMatrix[8]=2*-t.x/this.width,this._fogMatrix[9]=2*t.y/this.height,s.Q(this._fogMatrix,this._fogMatrix,[1,-1,1]),s.O(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),s.bg(this._fogMatrix,this._fogMatrix,-this.rollInRadians),s.bh(this._fogMatrix,this._fogMatrix,this.pitchInRadians),s.bg(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),s.O(this._fogMatrix,this._fogMatrix,[-c,-p,0]),s.Q(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),s.O(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=s.S(new Float64Array(16),this.clipSpaceToPixelsMatrix,S);const A=this._helper._width%2/2,k=this._helper._height%2/2,F=Math.cos(this.bearingInRadians),z=Math.sin(-this.bearingInRadians),j=c-Math.round(c)+F*A+z*k,G=p-Math.round(p)+F*k+z*A,Y=new Float64Array(S);if(s.O(Y,Y,[j>.5?j-1:j,G>.5?G-1:G,0]),this._alignedProjMatrix=Y,S=s.aB(new Float64Array(16),this._pixelMatrix),!S)throw new Error("failed to invert matrix");this._pixelMatrixInverse=S,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;const t=this.screenPointToMercatorCoordinate(new s.P(0,0)),i=[t.x*this.worldSize,t.y*this.worldSize,0,1];return s.aH(i,i,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){const t=s.as(1,this.center.lat)*this.worldSize;return Te(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/t).toLngLat()}lngLatToCameraDepth(t,i){const c=s.a9.fromLngLat(t),p=[c.x*this.worldSize,c.y*this.worldSize,i,1];return s.aH(p,p,this._viewProjMatrix),p[2]/p[3]}getProjectionData(t){const{overscaledTileID:i,aligned:c,applyTerrainMatrix:p}=t,g=this._helper.getMercatorTileCoordinates(i),b=i?this.calculatePosMatrix(i,c,!0):null;let S;return S=i&&i.terrainRttPosMatrix32f&&p?i.terrainRttPosMatrix32f:b||s.bi(),{mainMatrix:S,tileMercatorCoords:g,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:S}}isLocationOccluded(t){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(t,i,c){return 1}transformLightDirection(t){return s.b1(t)}getRayDirectionFromPixel(t){throw new Error("Not implemented.")}projectTileCoordinates(t,i,c,p){const g=this.calculatePosMatrix(c);let b;p?(b=[t,i,p(t,i),1],s.aH(b,b,g)):(b=[t,i,0,1],vl(b,b,g));const S=b[3];return{point:new s.P(b[0]/S,b[1]/S),signedDistanceFromCamera:S,isOccluded:!1}}populateCache(t){for(const i of t)this.calculatePosMatrix(i)}getMatrixForModel(t,i){const c=s.a9.fromLngLat(t,i),p=c.meterInMercatorCoordinateUnits(),g=s.bj();return s.O(g,g,[c.x,c.y,c.z]),s.bg(g,g,Math.PI),s.bh(g,g,Math.PI/2),s.Q(g,g,[-p,p,p]),g}getProjectionDataForCustomLayer(t=!0){const i=new s.a2(0,0,0,0,0),c=this.getProjectionData({overscaledTileID:i,applyGlobeMatrix:t}),p=St(i,this.worldSize);s.S(p,this._viewProjMatrix,p),c.tileMercatorCoords=[0,0,1,1];const g=[s.a5,s.a5,this.worldSize/this._helper.pixelsPerMeter],b=s.bk();return s.Q(b,p,g),c.fallbackMatrix=b,c.mainMatrix=b,c}getFastPathSimpleProjectionMatrix(t){return this.calculatePosMatrix(t)}}function Qi(){s.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function qh(m){if(m.useSlerp)if(m.k<1){const t=s.bl(m.startEulerAngles.roll,m.startEulerAngles.pitch,m.startEulerAngles.bearing),i=s.bl(m.endEulerAngles.roll,m.endEulerAngles.pitch,m.endEulerAngles.bearing),c=new Float64Array(4);s.bm(c,t,i,m.k);const p=s.bn(c);m.tr.setRoll(p.roll),m.tr.setPitch(p.pitch),m.tr.setBearing(p.bearing)}else m.tr.setRoll(m.endEulerAngles.roll),m.tr.setPitch(m.endEulerAngles.pitch),m.tr.setBearing(m.endEulerAngles.bearing);else m.tr.setRoll(s.G.number(m.startEulerAngles.roll,m.endEulerAngles.roll,m.k)),m.tr.setPitch(s.G.number(m.startEulerAngles.pitch,m.endEulerAngles.pitch,m.k)),m.tr.setBearing(s.G.number(m.startEulerAngles.bearing,m.endEulerAngles.bearing,m.k))}function Yc(m,t,i,c,p){const g=p.padding,b=it(p.worldSize,i.getNorthWest()),S=it(p.worldSize,i.getNorthEast()),P=it(p.worldSize,i.getSouthEast()),A=it(p.worldSize,i.getSouthWest()),k=s.ap(-c),F=b.rotate(k),z=S.rotate(k),j=P.rotate(k),G=A.rotate(k),Y=new s.P(Math.max(F.x,z.x,G.x,j.x),Math.max(F.y,z.y,G.y,j.y)),Q=new s.P(Math.min(F.x,z.x,G.x,j.x),Math.min(F.y,z.y,G.y,j.y)),K=Y.sub(Q),oe=(p.width-(g.left+g.right+t.left+t.right))/K.x,de=(p.height-(g.top+g.bottom+t.top+t.bottom))/K.y;if(de<0||oe<0)return void Qi();const ie=Math.min(s.at(p.scale*Math.min(oe,de)),m.maxZoom),he=s.P.convert(m.offset),ge=new s.P((t.left-t.right)/2,(t.top-t.bottom)/2).rotate(s.ap(c)),ce=he.add(ge).mult(p.scale/s.aq(ie));return{center:rt(p.worldSize,b.add(P).div(2).sub(ce)),zoom:ie,bearing:c}}class Ua{get useGlobeControls(){return!1}handlePanInertia(t,i){const c=t.mag(),p=Math.abs(At(i));return{easingOffset:t.mult(Math.min(.75*p/c,1)),easingCenter:i.center}}handleMapControlsRollPitchBearingZoom(t,i){t.bearingDelta&&i.setBearing(i.bearing+t.bearingDelta),t.pitchDelta&&i.setPitch(i.pitch+t.pitchDelta),t.rollDelta&&i.setRoll(i.roll+t.rollDelta),t.zoomDelta&&i.setZoom(i.zoom+t.zoomDelta)}handleMapControlsPan(t,i,c){t.around.distSqr(i.centerPoint)<.01||i.setLocationAtPoint(c,t.around)}cameraForBoxAndBearing(t,i,c,p,g){return Yc(t,i,c,p,g)}handleJumpToCenterZoom(t,i){t.zoom!==(i.zoom!==void 0?+i.zoom:t.zoom)&&t.setZoom(+i.zoom),i.center!==void 0&&t.setCenter(s.V.convert(i.center))}handleEaseTo(t,i){const c=t.zoom,p=t.padding,g={roll:t.roll,pitch:t.pitch,bearing:t.bearing},b={roll:i.roll===void 0?t.roll:i.roll,pitch:i.pitch===void 0?t.pitch:i.pitch,bearing:i.bearing===void 0?t.bearing:i.bearing},S=i.zoom!==void 0,P=!t.isPaddingEqual(i.padding);let A=!1;const k=S?+i.zoom:t.zoom;let F=t.centerPoint.add(i.offsetAsPoint);const z=t.screenPointToLocation(F),{center:j,zoom:G}=t.applyConstrain(s.V.convert(i.center||z),k??c);ya(t,j);const Y=it(t.worldSize,z),Q=it(t.worldSize,j).sub(Y),K=s.aq(G-c);return A=G!==c,{easeFunc:oe=>{if(A&&t.setZoom(s.G.number(c,G,oe)),s.bo(g,b)||qh({startEulerAngles:g,endEulerAngles:b,tr:t,k:oe,useSlerp:g.roll!=b.roll}),P&&(t.interpolatePadding(p,i.padding,oe),F=t.centerPoint.add(i.offsetAsPoint)),i.around)t.setLocationAtPoint(i.around,i.aroundPoint);else{const de=s.aq(t.zoom-c),ie=G>c?Math.min(2,K):Math.max(.5,K),he=Math.pow(ie,1-oe),ge=rt(t.worldSize,Y.add(Q.mult(oe*he)).mult(de));t.setLocationAtPoint(t.renderWorldCopies?ge.wrap():ge,F)}},isZooming:A,elevationCenter:j}}handleFlyTo(t,i){const c=i.zoom!==void 0,p=t.zoom,g=t.applyConstrain(s.V.convert(i.center||i.locationAtOffset),c?+i.zoom:p),b=g.center,S=g.zoom;ya(t,b);const P=it(t.worldSize,i.locationAtOffset),A=it(t.worldSize,b).sub(P),k=A.mag(),F=s.aq(S-p);let z;if(i.minZoom!==void 0){const j=Math.min(+i.minZoom,p,S),G=t.applyConstrain(b,j).zoom;z=s.aq(G-p)}return{easeFunc:(j,G,Y,Q)=>{t.setZoom(j===1?S:p+s.at(G));const K=j===1?b:rt(t.worldSize,P.add(A.mult(Y)).mult(G));t.setLocationAtPoint(t.renderWorldCopies?K.wrap():K,Q)},scaleOfZoom:F,targetCenter:b,scaleOfMinZoom:z,pixelPathLength:k}}}class _r{constructor(t,i,c){this.blendFunction=t,this.blendColor=i,this.mask=c}}_r.Replace=[1,0],_r.disabled=new _r(_r.Replace,s.bp.transparent,[!1,!1,!1,!1]),_r.unblended=new _r(_r.Replace,s.bp.transparent,[!0,!0,!0,!0]),_r.alphaBlended=new _r([1,771],s.bp.transparent,[!0,!0,!0,!0]);const bo=2305;class Qt{constructor(t,i,c){this.enable=t,this.mode=i,this.frontFace=c}}Qt.disabled=new Qt(!1,1029,bo),Qt.backCCW=new Qt(!0,1029,bo),Qt.frontCCW=new Qt(!0,1028,bo);class Ft{constructor(t,i,c){this.func=t,this.mask=i,this.range=c}}Ft.ReadOnly=!1,Ft.ReadWrite=!0,Ft.disabled=new Ft(519,Ft.ReadOnly,[0,1]);const wo=7680;class rr{constructor(t,i,c,p,g,b){this.test=t,this.ref=i,this.mask=c,this.fail=p,this.depthFail=g,this.pass=b}}rr.disabled=new rr({func:519,mask:0},0,0,wo,wo,wo);const ds=new WeakMap;function di(m){var t;if(ds.has(m))return ds.get(m);{const i=(t=m.getParameter(m.VERSION))===null||t===void 0?void 0:t.startsWith("WebGL 2.0");return ds.set(m,i),i}}class To{get awaitingQuery(){return!!this._readbackQueue}constructor(t){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=t;const i=t.context,c=i.gl;this._texFormat=c.RGBA,this._texType=c.UNSIGNED_BYTE;const p=new s.aW;p.emplaceBack(-1,-1),p.emplaceBack(2,-1),p.emplaceBack(-1,2);const g=new s.aY;g.emplaceBack(0,1,2),this._fullscreenTriangle=new yr(i.createVertexBuffer(p,ga.members),i.createIndexBuffer(g),s.aX.simpleSegment(0,0,p.length,g.length)),this._resultBuffer=new Uint8Array(4),i.activeTexture.set(c.TEXTURE1);const b=c.createTexture();c.bindTexture(c.TEXTURE_2D,b),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST),c.texImage2D(c.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(b),di(c)&&(this._pbo=c.createBuffer(),c.bindBuffer(c.PIXEL_PACK_BUFFER,this._pbo),c.bufferData(c.PIXEL_PACK_BUFFER,4,c.STREAM_READ),c.bindBuffer(c.PIXEL_PACK_BUFFER,null))}destroy(){const t=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),t.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(t,i){const c=this._updateCount;return this._readbackQueue?c>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():c>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(t,i),this._updateCount++,this._measuredError}_bindFramebuffer(){const t=this._cachedRenderContext.context,i=t.gl;t.activeTexture.set(i.TEXTURE1),i.bindTexture(i.TEXTURE_2D,this._fbo.colorAttachment.get()),t.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(t,i){const c=this._cachedRenderContext.context,p=c.gl;if(this._bindFramebuffer(),c.viewport.set([0,0,this._texWidth,this._texHeight]),c.clear({color:s.bp.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(c,p.TRIANGLES,Ft.disabled,rr.disabled,_r.unblended,Qt.disabled,((g,b)=>({u_input:g,u_output_expected:b}))(t,i),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&di(p)){p.bindBuffer(p.PIXEL_PACK_BUFFER,this._pbo),p.readBuffer(p.COLOR_ATTACHMENT0),p.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),p.bindBuffer(p.PIXEL_PACK_BUFFER,null);const g=p.fenceSync(p.SYNC_GPU_COMMANDS_COMPLETE,0);p.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:g}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){const t=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&di(t)){const i=t.clientWaitSync(this._readbackQueue.sync,0,0);if(i===t.WAIT_FAILED)return s.w("WebGL2 clientWaitSync failed."),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(i===t.TIMEOUT_EXPIRED)return;t.bindBuffer(t.PIXEL_PACK_BUFFER,this._pbo),t.getBufferSubData(t.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),t.bindBuffer(t.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),t.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=To._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(t){let i=0;return i+=t[0]/256,i+=t[1]/65536,i+=t[2]/16777216,t[3]<127&&(i=-i),i/128}}const _a=s.a5/128;function Gh(m,t){const i=m.granularity!==void 0?Math.max(m.granularity,1):1,c=i+(m.generateBorders?2:0),p=i+(m.extendToNorthPole||m.generateBorders?1:0)+(m.extendToSouthPole||m.generateBorders?1:0),g=c+1,b=p+1,S=m.generateBorders?-1:0,P=m.generateBorders||m.extendToNorthPole?-1:0,A=i+(m.generateBorders?1:0),k=i+(m.generateBorders||m.extendToSouthPole?1:0),F=g*b,z=c*p*6,j=g*b>65536;if(j&&t==="16bit")throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");const G=j||t==="32bit",Y=new Int16Array(2*F);let Q=0;for(let de=P;de<=k;de++)for(let ie=S;ie<=A;ie++){let he=ie/i*s.a5;ie===-1&&(he=-_a),ie===i+1&&(he=s.a5+_a);let ge=de/i*s.a5;de===-1&&(ge=m.extendToNorthPole?s.br:-_a),de===i+1&&(ge=m.extendToSouthPole?s.bs:s.a5+_a),Y[Q++]=he,Y[Q++]=ge}const K=G?new Uint32Array(z):new Uint16Array(z);let oe=0;for(let de=0;de<p;de++)for(let ie=0;ie<c;ie++){const he=ie+1+de*g,ge=ie+(de+1)*g,ce=ie+1+(de+1)*g;K[oe++]=ie+de*g,K[oe++]=ge,K[oe++]=he,K[oe++]=he,K[oe++]=ge,K[oe++]=ce}return{vertices:Y.buffer.slice(0),indices:K.buffer.slice(0),uses32bitIndices:G}}const fs=new s.aV({fill:new s.bt(128,2),line:new s.bt(512,0),tile:new s.bt(128,32),stencil:new s.bt(128,1),circle:3});class Kc{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 Rr.projectionGlobe}get vertexShaderPreludeCode(){return Rr.projectionMercator.vertexSource}get subdivisionGranularity(){return fs}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(t){this._errorMeasurement||(this._errorMeasurement=new To(t));const i=s.X(this._errorQueryLatitudeDegrees),c=2*Math.atan(Math.exp(Math.PI-i*Math.PI*2))-.5*Math.PI,p=this._errorMeasurement.updateErrorLoop(i,c),g=fe();p!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=p,this._errorMeasurementLastChangeTime=g);const b=Math.min(Math.max((g-this._errorMeasurementLastChangeTime)/1e3/.5,0),1);this._errorCorrectionUsable=s.bu(this._errorCorrectionPreviousValue,-this._errorMeasurementLastValue,s.bv(b))}_getMeshKey(t){return`${t.granularity.toString(36)}_${t.generateBorders?"b":""}${t.extendToNorthPole?"n":""}${t.extendToSouthPole?"s":""}`}getMeshFromTileID(t,i,c,p,g){const b=(g==="stencil"?fs.stencil:fs.tile).getGranularityForZoomLevel(i.z);return this._getMesh(t,{granularity:b,generateBorders:c,extendToNorthPole:i.y===0&&p,extendToSouthPole:i.y===(1<<i.z)-1&&p})}_getMesh(t,i){const c=this._getMeshKey(i);if(c in this._tileMeshCache)return this._tileMeshCache[c];const p=(function(g,b){const S=Gh(b,"16bit"),P=s.aW.deserialize({arrayBuffer:S.vertices,length:S.vertices.byteLength/2/2}),A=s.aY.deserialize({arrayBuffer:S.indices,length:S.indices.byteLength/2/3});return new yr(g.createVertexBuffer(P,ga.members),g.createIndexBuffer(A),s.aX.simpleSegment(0,0,P.length,A.length))})(t,i);return this._tileMeshCache[c]=p,p}recalculate(t){}hasTransition(){const t=fe();let i=!1;return i=i||(t-this._errorMeasurementLastChangeTime)/1e3<.7,i=i||this._errorMeasurement&&this._errorMeasurement.awaitingQuery,i}setErrorQueryLatitudeDegrees(t){this._errorQueryLatitudeDegrees=t}}const mf=new s.t({type:new s.D(s.u.projection.type)});class Zh extends s.E{constructor(t){super(),this._transitionable=new s.x(mf,void 0),this.setProjection(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new s.H(0)),this._mercatorProjection=new Un,this._verticalPerspectiveProjection=new Kc}get transitionState(){const t=this.properties.get("type");if(typeof t=="string"&&t==="mercator")return 0;if(typeof t=="string"&&t==="vertical-perspective")return 1;if(t instanceof s.bw){if(t.from==="vertical-perspective"&&t.to==="mercator")return 1-t.transition;if(t.from==="mercator"&&t.to==="vertical-perspective")return t.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(t){this._mercatorProjection.updateGPUdependent(t),this._verticalPerspectiveProjection.updateGPUdependent(t)}getMeshFromTileID(t,i,c,p,g){return this.currentProjection.getMeshFromTileID(t,i,c,p,g)}setProjection(t){this._transitionable.setValue("type",(t==null?void 0:t.type)||"mercator")}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}setErrorQueryLatitudeDegrees(t){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(t),this._mercatorProjection.setErrorQueryLatitudeDegrees(t)}}function $n(m){const t=$a(m.worldSize,m.center.lat);return 2*Math.PI*t}function $i(m,t,i,c,p){const g=1/(1<<p),b=t/s.a5*g+c*g,S=s.by((m/s.a5*g+i*g)*Math.PI*2+Math.PI,2*Math.PI),P=2*Math.atan(Math.exp(Math.PI-b*Math.PI*2))-.5*Math.PI,A=Math.cos(P),k=new Float64Array(3);return k[0]=Math.sin(S)*A,k[1]=Math.sin(P),k[2]=Math.cos(S)*A,k}function Ir(m){return(function(t,i){const c=Math.cos(i),p=new Float64Array(3);return p[0]=Math.sin(t)*c,p[1]=Math.sin(i),p[2]=Math.cos(t)*c,p})(m.lng*Math.PI/180,m.lat*Math.PI/180)}function $a(m,t){return m/(2*Math.PI)/Math.cos(t*Math.PI/180)}function Jc(m){const t=Math.asin(m[1])/Math.PI*180,i=Math.sqrt(m[0]*m[0]+m[2]*m[2]);if(i>1e-6){const c=m[0]/i,p=Math.acos(m[2]/i),g=(c>0?p:-p)/Math.PI*180;return new s.V(s.W(g,-180,180),t)}return new s.V(0,t)}function ms(m){return Math.cos(m*Math.PI/180)}function Nr(m,t){const i=ms(m),c=ms(t);return s.at(c/i)}function Wh(m,t){const i=m.rotate(t.bearingInRadians),c=t.zoom+Nr(t.center.lat,0),p=s.bu(1/ms(t.center.lat),1/ms(Math.min(Math.abs(t.center.lat),60)),s.bx(c,7,3,0,1)),g=360/$n({worldSize:t.worldSize,center:{lat:t.center.lat}});return new s.V(t.center.lng-i.x*g*p,s.an(t.center.lat+i.y*g,-s.ao,s.ao))}function Qc(m){const t=.5*m,i=Math.sin(t),c=Math.cos(t);return Math.log(i+c)-Math.log(c-i)}function Hh(m,t,i,c){const p=m.lat+i*c;if(Math.abs(i)>1){const g=(Math.sign(m.lat+i)!==Math.sign(m.lat)?-Math.abs(m.lat):Math.abs(m.lat))*Math.PI/180,b=Math.abs(m.lat+i)*Math.PI/180,S=Qc(g+c*(b-g)),P=Qc(g),A=Qc(b);return new s.V(m.lng+t*((S-P)/(A-P)),p)}return new s.V(m.lng+t*c,p)}class gf{constructor(t){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=t}swapBuffers(){if(!this._hadAnyChanges)return;const t=this._cachePrevious;this._cachePrevious=this._cache,this._cache=t,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(t,i,c,p){const g=`${t.z}_${t.x}_${t.y}_${p!=null&&p.terrain?"t":""}`,b=this._cache.get(g);if(b)return b;const S=this._cachePrevious.get(g);if(S)return this._cache.set(g,S),S;const P=this._boundingVolumeFactory(t,i,c,p);return this._cache.set(g,P),this._hadAnyChanges=!0,P}}class So{constructor(t,i,c,p){this.min=c,this.max=p,this.points=t,this.planes=i}static fromAabb(t,i){const c=[];for(let p=0;p<8;p++)c.push([1&~p?t[0]:i[0],(p>>1&1)==1?i[1]:t[1],(p>>2&1)==1?i[2]:t[2]]);return new So(c,[[-1,0,0,i[0]],[1,0,0,-t[0]],[0,-1,0,i[1]],[0,1,0,-t[1]],[0,0,-1,i[2]],[0,0,1,-t[2]]],t,i)}static fromCenterSizeAngles(t,i,c){const p=s.bB([],c[0],c[1],c[2]),g=s.bC([],[i[0],0,0],p),b=s.bC([],[0,i[1],0],p),S=s.bC([],[0,0,i[2]],p),P=[...t],A=[...t];for(let F=0;F<8;F++)for(let z=0;z<3;z++){const j=t[z]+g[z]*(1&~F?-1:1)+b[z]*((F>>1&1)==1?1:-1)+S[z]*((F>>2&1)==1?1:-1);P[z]=Math.min(P[z],j),A[z]=Math.max(A[z],j)}const k=[];for(let F=0;F<8;F++){const z=[...t];s.b0(z,z,s.a$([],g,1&~F?-1:1)),s.b0(z,z,s.a$([],b,(F>>1&1)==1?1:-1)),s.b0(z,z,s.a$([],S,(F>>2&1)==1?1:-1)),k.push(z)}return new So(k,[[...g,-s.b5(g,k[0])],[...b,-s.b5(b,k[0])],[...S,-s.b5(S,k[0])],[-g[0],-g[1],-g[2],-s.b5(g,k[7])],[-b[0],-b[1],-b[2],-s.b5(b,k[7])],[-S[0],-S[1],-S[2],-s.b5(S,k[7])]],P,A)}intersectsFrustum(t){let i=!0;const c=this.points.length,p=this.planes.length,g=t.planes.length,b=t.points.length;for(let S=0;S<g;S++){const P=t.planes[S];let A=0;for(let k=0;k<c;k++){const F=this.points[k];P[0]*F[0]+P[1]*F[1]+P[2]*F[2]+P[3]>=0&&A++}if(A===0)return 0;A<c&&(i=!1)}if(i)return 2;for(let S=0;S<p;S++){const P=this.planes[S];let A=0;for(let k=0;k<b;k++){const F=t.points[k];P[0]*F[0]+P[1]*F[1]+P[2]*F[2]+P[3]>=0&&A++}if(A===0)return 0}return 1}intersectsPlane(t){const i=this.points.length;let c=0;for(let p=0;p<i;p++){const g=this.points[p];t[0]*g[0]+t[1]*g[1]+t[2]*g[2]+t[3]>=0&&c++}return c===i?2:c===0?0:1}}function Tl(m,t,i){const c=m-t;return c<0?-c:Math.max(0,c-i)}function Eo(m,t,i,c,p){const g=m-i;let b;return b=g<0?Math.min(-g,1+g-p):g>1?Math.min(Math.max(g-p,0),1-g):0,Math.max(b,Tl(t,c,p))}class eu{constructor(){this._boundingVolumeCache=new gf(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(t,i,c,p){const g=1<<c.z,b=1/g,S=c.x/g,P=c.y/g;let A=2;return A=Math.min(A,Eo(t,i,S,P,b)),A=Math.min(A,Eo(t,i,S+.5,-P-b,b)),A=Math.min(A,Eo(t,i,S+.5,2-P-b,b)),A}getWrap(t,i,c){const p=1<<i.z,g=1/p,b=i.x/p,S=Tl(t.x,b,g),P=Tl(t.x,b-1,g),A=Tl(t.x,b+1,g),k=Math.min(S,P,A);return k===A?1:k===P?-1:0}allowVariableZoom(t,i){return Er(t,i)>4}allowWorldCopies(){return!1}getTileBoundingVolume(t,i,c,p){return this._boundingVolumeCache.getTileBoundingVolume(t,i,c,p)}_computeTileBoundingVolume(t,i,c,p){var g,b;let S=0,P=0;if(p!=null&&p.terrain){const A=new s.a2(t.z,i,t.z,t.x,t.y),k=p.terrain.getMinMaxElevation(A);S=(g=k.minElevation)!==null&&g!==void 0?g:Math.min(0,c),P=(b=k.maxElevation)!==null&&b!==void 0?b:Math.max(0,c)}if(S/=s.bE,P/=s.bE,S+=1,P+=1,t.z<=0)return So.fromAabb([-P,-P,-P],[P,P,P]);if(t.z===1)return So.fromAabb([t.x===0?-P:0,t.y===0?0:-P,-P],[t.x===0?0:P,t.y===0?P:0,P]);{const A=[$i(0,0,t.x,t.y,t.z),$i(s.a5,0,t.x,t.y,t.z),$i(s.a5,s.a5,t.x,t.y,t.z),$i(0,s.a5,t.x,t.y,t.z)],k=[];for(const ke of A)k.push(s.a$([],ke,P));if(P!==S)for(const ke of A)k.push(s.a$([],ke,S));t.y===0&&k.push([0,1,0]),t.y===(1<<t.z)-1&&k.push([0,-1,0]);const F=[1,1,1],z=[-1,-1,-1];for(const ke of k)for(let Le=0;Le<3;Le++)F[Le]=Math.min(F[Le],ke[Le]),z[Le]=Math.max(z[Le],ke[Le]);const j=$i(s.a5/2,s.a5/2,t.x,t.y,t.z),G=s.b4([],[0,1,0],j);s.b3(G,G);const Y=s.b4([],j,G);s.b3(Y,Y);const Q=s.b4([],A[2],A[1]);s.b3(Q,Q);const K=s.b4([],A[0],A[3]);s.b3(K,K),k.push(s.a$([],j,P)),t.y>=(1<<t.z)/2&&k.push(s.a$([],$i(s.a5/2,0,t.x,t.y,t.z),P)),t.y<(1<<t.z)/2&&k.push(s.a$([],$i(s.a5/2,s.a5,t.x,t.y,t.z),P));const oe=gs(j,k),de=gs(Y,k),ie=[-j[0],-j[1],-j[2],oe.max],he=[j[0],j[1],j[2],-oe.min],ge=[-Y[0],-Y[1],-Y[2],de.max],ce=[Y[0],Y[1],Y[2],-de.min],ve=[...Q,0],Fe=[...K,0],Ce=[];return t.y===0?Ce.push(s.bD(Fe,ve,ie),s.bD(Fe,ve,he)):Ce.push(s.bD(ge,ve,ie),s.bD(ge,ve,he),s.bD(ge,Fe,ie),s.bD(ge,Fe,he)),t.y===(1<<t.z)-1?Ce.push(s.bD(Fe,ve,ie),s.bD(Fe,ve,he)):Ce.push(s.bD(ce,ve,ie),s.bD(ce,ve,he),s.bD(ce,Fe,ie),s.bD(ce,Fe,he)),new So(Ce,[ie,he,ge,ce,ve,Fe],F,z)}}}function gs(m,t){let i=1/0,c=-1/0;for(const p of t){const g=s.b5(m,p);i=Math.min(i,g),c=Math.max(c,g)}return{min:i,max:c}}class Po{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(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,i,c){return this._helper.interpolatePadding(t,i,c)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,i){this._helper.resize(t,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,i){this._helper.overrideNearFarZ(t,i)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}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 constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t){}constructor(t){this._cachedClippingPlane=s.bF(),this._projectionMatrix=s.bj(),this._globeViewProjMatrix32f=s.bi(),this._globeViewProjMatrixNoCorrection=s.bj(),this._globeViewProjMatrixNoCorrectionInverted=s.bj(),this._globeProjMatrixInverted=s.bj(),this._cameraPosition=s.bz(),this._globeLatitudeErrorCorrectionRadians=0,this.defaultConstrain=(i,c)=>{const p=s.an(i.lat,-s.ao,s.ao),g=s.an(+c,this.minZoom+Nr(0,p),this.maxZoom);return{center:new s.V(i.lng,p),zoom:g}},this.applyConstrain=(i,c)=>this._helper.applyConstrain(i,c),this._helper=new ja({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(i,c)=>this.defaultConstrain(i,c)},t),this._coveringTilesDetailsProvider=new eu}clone(){const t=new Po;return t.apply(this,!1),t}apply(t,i,c){this._globeLatitudeErrorCorrectionRadians=c||0,this._helper.apply(t,i)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){const t=s.bz();return t[0]=this._cameraPosition[0],t[1]=this._cameraPosition[1],t[2]=this._cameraPosition[2],t}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(t){const{overscaledTileID:i,applyGlobeMatrix:c}=t,p=this._helper.getMercatorTileCoordinates(i);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:p,clippingPlane:this._cachedClippingPlane,projectionTransition:c?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(t){const i=this.pitchInRadians,c=this.cameraToCenterDistance/t,p=Math.sin(i)*c,g=Math.cos(i)*c+1,b=1/Math.sqrt(p*p+g*g)*1;let S=-p,P=g;const A=Math.sqrt(S*S+P*P);S/=A,P/=A;const k=[0,S,P];s.bG(k,k,[0,0,0],-this.bearingInRadians),s.bH(k,k,[0,0,0],-1*this.center.lat*Math.PI/180),s.bI(k,k,[0,0,0],this.center.lng*Math.PI/180);const F=1/s.b7(k);return s.a$(k,k,F),[...k,-b*F]}isLocationOccluded(t){return!this.isSurfacePointVisible(Ir(t))}transformLightDirection(t){const i=this._helper._center.lng*Math.PI/180,c=this._helper._center.lat*Math.PI/180,p=Math.cos(c),g=[Math.sin(i)*p,Math.sin(c),Math.cos(i)*p],b=[g[2],0,-g[0]],S=[0,0,0];s.b4(S,b,g),s.b3(b,b),s.b3(S,S);const P=[0,0,0];return s.b3(P,[b[0]*t[0]+S[0]*t[1]+g[0]*t[2],b[1]*t[0]+S[1]*t[1]+g[1]*t[2],b[2]*t[0]+S[2]*t[1]+g[2]*t[2]]),P}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(t,i,c){const p=(function(S,P,A){const k=1/(1<<A.z);return new s.a9(S/s.a5*k+A.x*k,P/s.a5*k+A.y*k)})(t,i,c.canonical),g=(b=p.y,[s.by(p.x*Math.PI*2+Math.PI,2*Math.PI),2*Math.atan(Math.exp(Math.PI-b*Math.PI*2))-.5*Math.PI]);var b;return this.getCircleRadiusCorrection()/Math.cos(g[1])}projectTileCoordinates(t,i,c,p){const g=c.canonical,b=$i(t,i,g.x,g.y,g.z),S=1+(p?p(t,i):0)/s.bE,P=[b[0]*S,b[1]*S,b[2]*S,1];s.aH(P,P,this._globeViewProjMatrixNoCorrection);const A=this._cachedClippingPlane,k=A[0]*b[0]+A[1]*b[1]+A[2]*b[2]+A[3]<0;return{point:new s.P(P[0]/P[3],P[1]/P[3]),signedDistanceFromCamera:P[3],isOccluded:k}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;const t=$a(this.worldSize,this.center.lat),i=s.bk(),c=s.bk();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*t),s.be(i,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);const p=this.centerOffset;i[8]=2*-p.x/this._helper._width,i[9]=2*p.y/this._helper._height,this._projectionMatrix=s.bf(i),this._globeProjMatrixInverted=s.bk(),s.aB(this._globeProjMatrixInverted,i),s.O(i,i,[0,0,-this.cameraToCenterDistance]),s.bg(i,i,this.rollInRadians),s.bh(i,i,-this.pitchInRadians),s.bg(i,i,this.bearingInRadians),s.O(i,i,[0,0,-t]);const g=s.bz();g[0]=t,g[1]=t,g[2]=t,s.bh(c,i,this.center.lat*Math.PI/180),s.bJ(c,c,-this.center.lng*Math.PI/180),s.Q(c,c,g),this._globeViewProjMatrixNoCorrection=c,s.bh(i,i,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),s.bJ(i,i,-this.center.lng*Math.PI/180),s.Q(i,i,g),this._globeViewProjMatrix32f=new Float32Array(i),this._globeViewProjMatrixNoCorrectionInverted=s.bk(),s.aB(this._globeViewProjMatrixNoCorrectionInverted,c);const b=s.bz();this._cameraPosition=s.bz(),this._cameraPosition[2]=this.cameraToCenterDistance/t,s.bG(this._cameraPosition,this._cameraPosition,b,-this.rollInRadians),s.bH(this._cameraPosition,this._cameraPosition,b,this.pitchInRadians),s.bG(this._cameraPosition,this._cameraPosition,b,-this.bearingInRadians),s.b0(this._cameraPosition,this._cameraPosition,[0,0,1]),s.bH(this._cameraPosition,this._cameraPosition,b,-this.center.lat*Math.PI/180),s.bI(this._cameraPosition,this._cameraPosition,b,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(t);const S=s.bf(this._globeViewProjMatrixNoCorrectionInverted);s.Q(S,S,[1,1,-1]),this._cachedFrustum=Yn.fromInvProjectionMatrix(S,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(t){s.w("calculateFogMatrix is not supported on globe projection.");const i=s.bk();return s.ar(i),i}getVisibleUnwrappedCoordinates(t){return[new s.bc(0,t)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){t&&s.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(t,i){if(!this._globeViewProjMatrixNoCorrection)return 1;const c=Ir(t);s.a$(c,c,1+i/s.bE);const p=s.bF();return s.aH(p,[c[0],c[1],c[2],1],this._globeViewProjMatrixNoCorrection),p[2]/p[3]}populateCache(t){}getBounds(){const t=.5*this.width,i=.5*this.height,c=[new s.P(0,0),new s.P(t,0),new s.P(this.width,0),new s.P(this.width,i),new s.P(this.width,this.height),new s.P(t,this.height),new s.P(0,this.height),new s.P(0,i)],p=[];for(const F of c)p.push(this.unprojectScreenPoint(F));let g=0,b=0,S=0,P=0;const A=this.center;for(const F of p){const z=s.bK(A.lng,F.lng),j=s.bK(A.lat,F.lat);z<b&&(b=z),z>g&&(g=z),j<P&&(P=j),j>S&&(S=j)}const k=[A.lng+b,A.lat+P,A.lng+g,A.lat+S];return this.isSurfacePointOnScreen([0,1,0])&&(k[3]=90,k[0]=-180,k[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(k[1]=-90,k[0]=-180,k[2]=180),new Kt(k)}calculateCenterFromCameraLngLatAlt(t,i,c,p){return this._helper.calculateCenterFromCameraLngLatAlt(t,i,c,p)}setLocationAtPoint(t,i){const c=Ir(this.unprojectScreenPoint(i)),p=Ir(t),g=s.bz();s.bL(g);const b=s.bz();s.bI(b,c,g,-this.center.lng*Math.PI/180),s.bH(b,b,g,this.center.lat*Math.PI/180);const S=p[0]*p[0]+p[2]*p[2],P=b[0]*b[0];if(S<P)return;const A=Math.sqrt(S-P),k=-A,F=s.bM(p[0],p[2],b[0],A),z=s.bM(p[0],p[2],b[0],k),j=s.bz();s.bI(j,p,g,-F);const G=s.bM(j[1],j[2],b[1],b[2]),Y=s.bz();s.bI(Y,p,g,-z);const Q=s.bM(Y[1],Y[2],b[1],b[2]),K=.5*Math.PI,oe=G>=-K&&G<=K,de=Q>=-K&&Q<=K;let ie,he;if(oe&&de){const Fe=this.center.lng*Math.PI/180,Ce=this.center.lat*Math.PI/180;s.bN(F,Fe)+s.bN(G,Ce)<s.bN(z,Fe)+s.bN(Q,Ce)?(ie=F,he=G):(ie=z,he=Q)}else if(oe)ie=F,he=G;else{if(!de)return;ie=z,he=Q}const ge=ie/Math.PI*180,ce=he/Math.PI*180,ve=this.center.lat;this.setCenter(new s.V(ge,s.an(ce,-90,90))),this.setZoom(this.zoom+Nr(ve,this.center.lat))}locationToScreenPoint(t,i){const c=Ir(t);if(i){const p=i.getElevationForLngLatZoom(t,this._helper._tileZoom);s.a$(c,c,1+p/s.bE)}return this._projectSurfacePointToScreen(c)}_projectSurfacePointToScreen(t){const i=s.bF();return s.aH(i,[...t,1],this._globeViewProjMatrixNoCorrection),i[0]/=i[3],i[1]/=i[3],new s.P((.5*i[0]+.5)*this.width,(.5*-i[1]+.5)*this.height)}screenPointToMercatorCoordinate(t,i){if(i){const c=i.pointCoordinate(t);if(c)return c}return s.a9.fromLngLat(this.unprojectScreenPoint(t))}screenPointToLocation(t,i){var c;return(c=this.screenPointToMercatorCoordinate(t,i))===null||c===void 0?void 0:c.toLngLat()}isPointOnMapSurface(t,i){const c=this._cameraPosition,p=this.getRayDirectionFromPixel(t);return!!this.rayPlanetIntersection(c,p)}getRayDirectionFromPixel(t){const i=s.bF();i[0]=t.x/this.width*2-1,i[1]=-1*(t.y/this.height*2-1),i[2]=1,i[3]=1,s.aH(i,i,this._globeViewProjMatrixNoCorrectionInverted),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3];const c=s.bz();c[0]=i[0]-this._cameraPosition[0],c[1]=i[1]-this._cameraPosition[1],c[2]=i[2]-this._cameraPosition[2];const p=s.bz();return s.b3(p,c),p}isSurfacePointVisible(t){const i=this._cachedClippingPlane;return i[0]*t[0]+i[1]*t[1]+i[2]*t[2]+i[3]>=0}isSurfacePointOnScreen(t){if(!this.isSurfacePointVisible(t))return!1;const i=s.bF();return s.aH(i,[...t,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(t,i){const c=s.b5(t,i),p=s.bz(),g=s.bz();s.a$(g,i,c),s.b2(p,t,g);const b=1-s.b5(p,p);if(b<0)return null;const S=s.b5(t,t)-1,P=-c+(c<0?1:-1)*Math.sqrt(b),A=S/P,k=P;return{tMin:Math.min(A,k),tMax:Math.max(A,k)}}unprojectScreenPoint(t){const i=this._cameraPosition,c=this.getRayDirectionFromPixel(t),p=this.rayPlanetIntersection(i,c);if(p){const k=s.bz();s.b0(k,i,[c[0]*p.tMin,c[1]*p.tMin,c[2]*p.tMin]);const F=s.bz();return s.b3(F,k),Jc(F)}const g=this._cachedClippingPlane,b=g[0]*c[0]+g[1]*c[1]+g[2]*c[2],S=-s.bb(g,i)/b,P=s.bz();if(S>0)s.b0(P,i,[c[0]*S,c[1]*S,c[2]*S]);else{const k=s.bz();s.b0(k,i,[2*c[0],2*c[1],2*c[2]]);const F=s.bb(this._cachedClippingPlane,k);s.b2(P,k,[this._cachedClippingPlane[0]*F,this._cachedClippingPlane[1]*F,this._cachedClippingPlane[2]*F])}const A=(function(k){const F=s.bz();return F[0]=k[0]*-k[3],F[1]=k[1]*-k[3],F[2]=k[2]*-k[3],{center:F,radius:Math.sqrt(1-k[3]*k[3])}})(g);return Jc((function(k,F,z){const j=s.bz();s.b2(j,z,k);const G=s.bz();return s.bA(G,k,j,F/s.b9(j)),G})(A.center,A.radius,P))}getMatrixForModel(t,i){const c=s.V.convert(t),p=1/s.bE,g=s.bj();return s.bJ(g,g,c.lng/180*Math.PI),s.bh(g,g,-c.lat/180*Math.PI),s.O(g,g,[0,0,1+i/s.bE]),s.bh(g,g,.5*Math.PI),s.Q(g,g,[p,p,p]),g}getProjectionDataForCustomLayer(t=!0){const i=this.getProjectionData({overscaledTileID:new s.a2(0,0,0,0,0),applyGlobeMatrix:t});return i.tileMercatorCoords=[0,0,1,1],i}getFastPathSimpleProjectionMatrix(t){}}class Mo{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(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,i,c){return this._helper.interpolatePadding(t,i,c)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,i,c=!0){this._helper.resize(t,i,c)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,i){this._helper.overrideNearFarZ(t,i)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}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 constrainOverride(){return this._helper.constrainOverride}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(t,i){this._globeness=t,this._globeLatitudeErrorCorrectionRadians=i,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(t){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this.defaultConstrain=(i,c)=>this.currentTransform.defaultConstrain(i,c),this.applyConstrain=(i,c)=>this._helper.applyConstrain(i,c),this._helper=new ja({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(i,c)=>this.defaultConstrain(i,c)},t),this._globeness=1,this._mercatorTransform=new Va,this._verticalPerspectiveTransform=new Po}clone(){const t=new Mo;return t._globeness=this._globeness,t._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,t.apply(this,!1),t}apply(t,i){this._helper.apply(t,i),this._mercatorTransform.apply(this,!1),this._verticalPerspectiveTransform.apply(this,!1,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(t){const i=this._mercatorTransform.getProjectionData(t),c=this._verticalPerspectiveTransform.getProjectionData(t);return{mainMatrix:this.isGlobeRendering?c.mainMatrix:i.mainMatrix,clippingPlane:c.clippingPlane,tileMercatorCoords:c.tileMercatorCoords,projectionTransition:t.applyGlobeMatrix?this._globeness:0,fallbackMatrix:i.fallbackMatrix}}isLocationOccluded(t){return this.currentTransform.isLocationOccluded(t)}transformLightDirection(t){return this.currentTransform.transformLightDirection(t)}getPixelScale(){return s.bu(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return s.bu(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(t,i,c){const p=this._mercatorTransform.getPitchedTextCorrection(t,i,c),g=this._verticalPerspectiveTransform.getPitchedTextCorrection(t,i,c);return s.bu(p,g,this._globeness)}projectTileCoordinates(t,i,c,p){return this.currentTransform.projectTileCoordinates(t,i,c,p)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,!1,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(t){return this.currentTransform.calculateFogMatrix(t)}getVisibleUnwrappedCoordinates(t){return this.currentTransform.getVisibleUnwrappedCoordinates(t)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(t){this._mercatorTransform.recalculateZoomAndCenter(t),this._verticalPerspectiveTransform.recalculateZoomAndCenter(t)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,i){return this.currentTransform.lngLatToCameraDepth(t,i)}populateCache(t){this._mercatorTransform.populateCache(t),this._verticalPerspectiveTransform.populateCache(t)}getBounds(){return this.currentTransform.getBounds()}calculateCenterFromCameraLngLatAlt(t,i,c,p){return this._helper.calculateCenterFromCameraLngLatAlt(t,i,c,p)}setLocationAtPoint(t,i){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(t,i),void this.apply(this._mercatorTransform,!1);this._verticalPerspectiveTransform.setLocationAtPoint(t,i),this.apply(this._verticalPerspectiveTransform,!1)}locationToScreenPoint(t,i){return this.currentTransform.locationToScreenPoint(t,i)}screenPointToMercatorCoordinate(t,i){return this.currentTransform.screenPointToMercatorCoordinate(t,i)}screenPointToLocation(t,i){return this.currentTransform.screenPointToLocation(t,i)}isPointOnMapSurface(t,i){return this.currentTransform.isPointOnMapSurface(t,i)}getRayDirectionFromPixel(t){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(t)}getMatrixForModel(t,i){return this.currentTransform.getMatrixForModel(t,i)}getProjectionDataForCustomLayer(t=!0){const i=this._mercatorTransform.getProjectionDataForCustomLayer(t);if(!this.isGlobeRendering)return i;const c=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(t);return c.fallbackMatrix=i.mainMatrix,c}getFastPathSimpleProjectionMatrix(t){return this.currentTransform.getFastPathSimpleProjectionMatrix(t)}}class cn{get useGlobeControls(){return!0}handlePanInertia(t,i){const c=Wh(t,i);return Math.abs(c.lng-i.center.lng)>180&&(c.lng=i.center.lng+179.5*Math.sign(c.lng-i.center.lng)),{easingCenter:c,easingOffset:new s.P(0,0)}}handleMapControlsRollPitchBearingZoom(t,i){const c=t.around,p=i.screenPointToLocation(c);t.bearingDelta&&i.setBearing(i.bearing+t.bearingDelta),t.pitchDelta&&i.setPitch(i.pitch+t.pitchDelta),t.rollDelta&&i.setRoll(i.roll+t.rollDelta);const g=i.zoom;t.zoomDelta&&i.setZoom(i.zoom+t.zoomDelta);const b=i.zoom-g;if(b===0)return;const S=s.bK(i.center.lng,p.lng),P=S/(Math.abs(S/180)+1),A=s.bK(i.center.lat,p.lat),k=i.getRayDirectionFromPixel(c),F=i.cameraPosition,z=-1*s.b5(F,k),j=s.bz();s.b0(j,F,[k[0]*z,k[1]*z,k[2]*z]);const G=s.b7(j)-1,Y=Math.exp(.5*-Math.max(G-.3,0)),Q=$a(i.worldSize,i.center.lat)/Math.min(i.width,i.height),K=s.bx(Q,.9,.5,1,.25),oe=(1-s.aq(-b))*Math.min(Y,K),de=i.center.lat,ie=i.zoom,he=new s.V(i.center.lng+P*oe,s.an(i.center.lat+A*oe,-s.ao,s.ao));i.setLocationAtPoint(p,c);const ge=i.center,ce=s.bx(Math.abs(S),45,85,0,1),ve=s.bx(Q,.75,.35,0,1),Fe=Math.pow(Math.max(ce,ve),.25),Ce=s.bK(ge.lng,he.lng),ke=s.bK(ge.lat,he.lat);i.setCenter(new s.V(ge.lng+Ce*Fe,ge.lat+ke*Fe).wrap()),i.setZoom(ie+Nr(de,i.center.lat))}handleMapControlsPan(t,i,c){if(!t.panDelta)return;const p=i.center.lat,g=i.zoom;i.setCenter(Wh(t.panDelta,i).wrap()),i.setZoom(g+Nr(p,i.center.lat))}cameraForBoxAndBearing(t,i,c,p,g){const b=Yc(t,i,c,p,g),S=i.left/g.width*2-1,P=(g.width-i.right)/g.width*2-1,A=i.top/g.height*-2+1,k=(g.height-i.bottom)/g.height*-2+1,F=s.bK(c.getWest(),c.getEast())<0,z=F?c.getEast():c.getWest(),j=F?c.getWest():c.getEast(),G=Math.max(c.getNorth(),c.getSouth()),Y=Math.min(c.getNorth(),c.getSouth()),Q=z+.5*s.bK(z,j),K=G+.5*s.bK(G,Y),oe=g.clone();oe.setCenter(b.center),oe.setBearing(b.bearing),oe.setPitch(0),oe.setRoll(0),oe.setZoom(b.zoom);const de=oe.modelViewProjectionMatrix,ie=[Ir(c.getNorthWest()),Ir(c.getNorthEast()),Ir(c.getSouthWest()),Ir(c.getSouthEast()),Ir(new s.V(j,K)),Ir(new s.V(z,K)),Ir(new s.V(Q,G)),Ir(new s.V(Q,Y))],he=Ir(b.center);let ge=Number.POSITIVE_INFINITY;for(const ce of ie)S<0&&(ge=cn.getLesserNonNegativeNonNull(ge,cn.solveVectorScale(ce,he,de,"x",S))),P>0&&(ge=cn.getLesserNonNegativeNonNull(ge,cn.solveVectorScale(ce,he,de,"x",P))),A>0&&(ge=cn.getLesserNonNegativeNonNull(ge,cn.solveVectorScale(ce,he,de,"y",A))),k<0&&(ge=cn.getLesserNonNegativeNonNull(ge,cn.solveVectorScale(ce,he,de,"y",k)));if(Number.isFinite(ge)&&ge!==0)return b.zoom=oe.zoom+s.at(ge),b;Qi()}handleJumpToCenterZoom(t,i){const c=t.center.lat,p=t.applyConstrain(i.center?s.V.convert(i.center):t.center,t.zoom).center;t.setCenter(p.wrap());const g=i.zoom!==void 0?+i.zoom:t.zoom+Nr(c,p.lat);t.zoom!==g&&t.setZoom(g)}handleEaseTo(t,i){const c=t.zoom,p=t.center,g=t.padding,b={roll:t.roll,pitch:t.pitch,bearing:t.bearing},S={roll:i.roll===void 0?t.roll:i.roll,pitch:i.pitch===void 0?t.pitch:i.pitch,bearing:i.bearing===void 0?t.bearing:i.bearing},P=i.zoom!==void 0,A=!t.isPaddingEqual(i.padding);let k=!1;const F=i.center?s.V.convert(i.center):p,z=t.applyConstrain(F,c).center;ya(t,z);const j=t.clone();j.setCenter(z),j.setZoom(P?+i.zoom:c+Nr(p.lat,F.lat)),j.setBearing(i.bearing);const G=new s.P(s.an(t.centerPoint.x+i.offsetAsPoint.x,0,t.width),s.an(t.centerPoint.y+i.offsetAsPoint.y,0,t.height));j.setLocationAtPoint(z,G);const Y=(i.offset&&i.offsetAsPoint.mag())>0?j.center:z,Q=P?+i.zoom:c+Nr(p.lat,Y.lat),K=c+Nr(p.lat,0),oe=Q+Nr(Y.lat,0),de=s.bK(p.lng,Y.lng),ie=s.bK(p.lat,Y.lat),he=s.aq(oe-K);return k=Q!==c,{easeFunc:ge=>{if(s.bo(b,S)||qh({startEulerAngles:b,endEulerAngles:S,tr:t,k:ge,useSlerp:b.roll!=S.roll}),A&&t.interpolatePadding(g,i.padding,ge),i.around)s.w("Easing around a point is not supported under globe projection."),t.setLocationAtPoint(i.around,i.aroundPoint);else{const ce=oe>K?Math.min(2,he):Math.max(.5,he),ve=Math.pow(ce,1-ge),Fe=Hh(p,de,ie,ge*ve);t.setCenter(Fe.wrap())}if(k){const ce=s.G.number(K,oe,ge)+Nr(0,t.center.lat);t.setZoom(ce)}},isZooming:k,elevationCenter:Y}}handleFlyTo(t,i){const c=i.zoom!==void 0,p=t.center,g=t.zoom,b=t.padding,S=!t.isPaddingEqual(i.padding),P=t.applyConstrain(s.V.convert(i.center||i.locationAtOffset),g).center,A=c?+i.zoom:t.zoom+Nr(t.center.lat,P.lat),k=t.clone();k.setCenter(P),k.setZoom(A),k.setBearing(i.bearing);const F=new s.P(s.an(t.centerPoint.x+i.offsetAsPoint.x,0,t.width),s.an(t.centerPoint.y+i.offsetAsPoint.y,0,t.height));k.setLocationAtPoint(P,F);const z=k.center;ya(t,z);const j=(function(ie,he,ge){const ce=Ir(he),ve=Ir(ge),Fe=s.b5(ce,ve),Ce=Math.acos(Fe),ke=$n(ie);return Ce/(2*Math.PI)*ke})(t,p,z),G=g+Nr(p.lat,0),Y=A+Nr(z.lat,0),Q=s.aq(Y-G);let K;if(typeof i.minZoom=="number"){const ie=+i.minZoom+Nr(z.lat,0),he=Math.min(ie,G,Y)+Nr(0,z.lat),ge=t.applyConstrain(z,he).zoom+Nr(z.lat,0);K=s.aq(ge-G)}const oe=s.bK(p.lng,z.lng),de=s.bK(p.lat,z.lat);return{easeFunc:(ie,he,ge,ce)=>{const ve=Hh(p,oe,de,ge);S&&t.interpolatePadding(b,i.padding,ie);const Fe=ie===1?z:ve;t.setCenter(Fe.wrap());const Ce=G+s.at(he);t.setZoom(ie===1?A:Ce+Nr(0,Fe.lat))},scaleOfZoom:Q,targetCenter:z,scaleOfMinZoom:K,pixelPathLength:j}}static solveVectorScale(t,i,c,p,g){const b=p==="x"?[c[0],c[4],c[8],c[12]]:[c[1],c[5],c[9],c[13]],S=[c[3],c[7],c[11],c[15]],P=t[0]*b[0]+t[1]*b[1]+t[2]*b[2],A=t[0]*S[0]+t[1]*S[1]+t[2]*S[2],k=i[0]*b[0]+i[1]*b[1]+i[2]*b[2],F=i[0]*S[0]+i[1]*S[1]+i[2]*S[2];return k+g*A===P+g*F||S[3]*(P-k)+b[3]*(F-A)+P*F==k*A?null:(k+b[3]-g*F-g*S[3])/(k-P-g*F+g*A)}static getLesserNonNegativeNonNull(t,i){return i!==null&&i>=0&&i<t?i:t}}class Xh{constructor(t){this._globe=t,this._mercatorCameraHelper=new Ua,this._verticalPerspectiveCameraHelper=new cn}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(t,i){return this.currentHelper.handlePanInertia(t,i)}handleMapControlsRollPitchBearingZoom(t,i){return this.currentHelper.handleMapControlsRollPitchBearingZoom(t,i)}handleMapControlsPan(t,i,c){this.currentHelper.handleMapControlsPan(t,i,c)}cameraForBoxAndBearing(t,i,c,p,g){return this.currentHelper.cameraForBoxAndBearing(t,i,c,p,g)}handleJumpToCenterZoom(t,i){this.currentHelper.handleJumpToCenterZoom(t,i)}handleEaseTo(t,i){return this.currentHelper.handleEaseTo(t,i)}handleFlyTo(t,i){return this.currentHelper.handleFlyTo(t,i)}}const Io=(m,t)=>s.B(m,t&&t.filter((i=>i.identifier!=="source.canvas"))),ys=s.bO();class qa extends s.E{constructor(t,i={}){var c,p;super(),this._rtlPluginLoaded=()=>{for(const b in this.tileManagers){const S=this.tileManagers[b].getSource().type;S!=="vector"&&S!=="geojson"||this.tileManagers[b].reload()}},this.map=t,this.dispatcher=new an(en(),t._getMapId()),this.dispatcher.registerMessageHandler("GG",((b,S)=>this.getGlyphs(b,S))),this.dispatcher.registerMessageHandler("GI",((b,S)=>this.getImages(b,S))),this.dispatcher.registerMessageHandler("GDA",((b,S)=>this.getDashes(b,S))),this.imageManager=new vt,this.imageManager.setEventedParent(this);const g=((c=t._container)===null||c===void 0?void 0:c.lang)||typeof document<"u"&&((p=document.documentElement)===null||p===void 0?void 0:p.lang)||void 0;this.glyphManager=new We(t._requestManager,i.localIdeographFontFamily,g),this.lineAtlas=new Rt(256,512),this.crossTileSymbolIndex=new Xn,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast("SR",s.bP()),me().on(re,this._rtlPluginLoaded),this.on("data",(b=>{if(b.dataType!=="source"||b.sourceDataType!=="metadata")return;const S=this.tileManagers[b.sourceId];if(!S)return;const P=S.getSource();if(P&&P.vectorLayerIds)for(const A in this._layers){const k=this._layers[A];k.source===P.id&&this._validateLayer(k)}}))}_setInitialValues(){var t;this._spritesImagesIds={},this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new s.bQ,this._availableImages=[],this._globalState={},this._serializedLayers={},this.stylesheet=null,this.light=null,this.sky=null,this.projection&&(this.projection.destroy(),delete this.projection),this._loaded=!1,this._changed=!1,this._updatedLayers={},this._updatedSources={},this._changedImages={},this._glyphsDidChange=!1,this._updatedPaintProps={},this._layerOrderChanged=!1,this.crossTileSymbolIndex=new(((t=this.crossTileSymbolIndex)===null||t===void 0?void 0:t.constructor)||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}setGlobalStateProperty(t,i){var c,p,g;this._checkLoaded();const b=i===null?(g=(p=(c=this.stylesheet.state)===null||c===void 0?void 0:c[t])===null||p===void 0?void 0:p.default)!==null&&g!==void 0?g:null:i;if(s.bR(b,this._globalState[t]))return this;this._globalState[t]=b,this._applyGlobalStateChanges([t])}getGlobalState(){return this._globalState}setGlobalState(t){this._checkLoaded();const i=[];for(const c in t)!s.bR(this._globalState[c],t[c].default)&&(i.push(c),this._globalState[c]=t[c].default);this._applyGlobalStateChanges(i)}_applyGlobalStateChanges(t){if(t.length===0)return;const i=new Set,c={};for(const p of t){c[p]=this._globalState[p];for(const g in this._layers){const b=this._layers[g],S=b.getLayoutAffectingGlobalStateRefs(),P=b.getPaintAffectingGlobalStateRefs(),A=b.getVisibilityAffectingGlobalStateRefs();if(S.has(p)&&i.add(b.source),P.has(p))for(const{name:k,value:F}of P.get(p))this._updatePaintProperty(b,k,F);A!=null&&A.has(p)&&(b.recalculateVisibility(),this._updateLayer(b))}}this.dispatcher.broadcast("UGS",c);for(const p in this.tileManagers)i.has(p)&&(this._reloadSource(p),this._changed=!0)}loadURL(t,i={},c){this.fire(new s.l("dataloading",{dataType:"style"})),i.validate=typeof i.validate!="boolean"||i.validate;const p=this.map._requestManager.transformRequest(t,"Style");this._loadStyleRequest=new AbortController;const g=this._loadStyleRequest;s.j(p,this._loadStyleRequest).then((b=>{this._loadStyleRequest=null,this._load(b.data,i,c)})).catch((b=>{this._loadStyleRequest=null,b&&!g.signal.aborted&&this.fire(new s.k(b))}))}loadJSON(t,i={},c){this.fire(new s.l("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,ee.frameAsync(this._frameRequest).then((()=>{this._frameRequest=null,i.validate=i.validate!==!1,this._load(t,i,c)})).catch((()=>{}))}loadEmpty(){this.fire(new s.l("dataloading",{dataType:"style"})),this._load(ys,{validate:!1})}_load(t,i,c){var p,g;let b=i.transformStyle?i.transformStyle(c,t):t;if(!i.validate||!Io(this,s.C(b))){b=Object.assign({},b),this._loaded=!0,this.stylesheet=b;for(const S in b.sources)this.addSource(S,b.sources[S],{validate:!1});b.sprite?this._loadSprite(b.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(b.glyphs),this._createLayers(),this.light=new Ht(this.stylesheet.light),this._setProjectionInternal(((p=this.stylesheet.projection)===null||p===void 0?void 0:p.type)||"mercator"),this.sky=new mr(this.stylesheet.sky),this.map.setTerrain((g=this.stylesheet.terrain)!==null&&g!==void 0?g:null),this.fire(new s.l("data",{dataType:"style"})),this.fire(new s.l("style.load"))}}_createLayers(){var t,i,c;const p=s.bS(this.stylesheet.layers);this.setGlobalState((t=this.stylesheet.state)!==null&&t!==void 0?t:null),this.dispatcher.broadcast("SL",p),this._order=p.map((g=>g.id)),this._layers={},this._serializedLayers=null;for(const g of p){const b=s.bT(g,this._globalState);if(b.setEventedParent(this,{layer:{id:g.id}}),this._layers[g.id]=b,s.bU(b)&&this.tileManagers[b.source]){const S=(c=(i=g.paint)===null||i===void 0?void 0:i["raster-fade-duration"])!==null&&c!==void 0?c:b.paint.get("raster-fade-duration");this.tileManagers[b.source].setRasterFadeDuration(S)}}}_loadSprite(t,i=!1,c=void 0){this.imageManager.setLoaded(!1);const p=new AbortController;let g;this._spriteRequest=p,(function(b,S,P,A){return s._(this,void 0,void 0,(function*(){const k=Je(b),F=P>1?"@2x":"",z={},j={};for(const{id:G,url:Y}of k){const Q=S.transformRequest(Ve(Y,F,".json"),"SpriteJSON");z[G]=s.j(Q,A);const K=S.transformRequest(Ve(Y,F,".png"),"SpriteImage");j[G]=Ie.getImage(K,A)}return yield Promise.all([...Object.values(z),...Object.values(j)]),(function(G,Y){return s._(this,void 0,void 0,(function*(){const Q={};for(const K in G){Q[K]={};const oe=ee.getImageCanvasContext((yield Y[K]).data),de=(yield G[K]).data;for(const ie in de){const{width:he,height:ge,x:ce,y:ve,sdf:Fe,pixelRatio:Ce,stretchX:ke,stretchY:Le,content:Xe,textFitWidth:Ke,textFitHeight:qe}=de[ie];Q[K][ie]={data:null,pixelRatio:Ce,sdf:Fe,stretchX:ke,stretchY:Le,content:Xe,textFitWidth:Ke,textFitHeight:qe,spriteData:{width:he,height:ge,x:ce,y:ve,context:oe}}}}return Q}))})(z,j)}))})(t,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then((b=>{if(this._spriteRequest=null,b)for(const S in b){this._spritesImagesIds[S]=[];const P=this._spritesImagesIds[S]?this._spritesImagesIds[S].filter((A=>!(A in b))):[];for(const A of P)this.imageManager.removeImage(A),this._changedImages[A]=!0;for(const A in b[S]){const k=S==="default"?A:`${S}:${A}`;this._spritesImagesIds[S].push(k),k in this.imageManager.images?this.imageManager.updateImage(k,b[S][A],!1):this.imageManager.addImage(k,b[S][A]),i&&(this._changedImages[k]=!0)}}})).catch((b=>{this._spriteRequest=null,g=b,p.signal.aborted||this.fire(new s.k(g))})).finally((()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),i&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new s.l("data",{dataType:"style"})),c&&c(g)}))}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new s.l("data",{dataType:"style"}))}_validateLayer(t){const i=this.tileManagers[t.source];if(!i)return;const c=t.sourceLayer;if(!c)return;const p=i.getSource();(p.type==="geojson"||p.vectorLayerIds&&p.vectorLayerIds.indexOf(c)===-1)&&this.fire(new s.k(new Error(`Source layer "${c}" does not exist on source "${p.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const t in this.tileManagers)if(!this.tileManagers[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t,i=!1){const c=this._serializedAllLayers();if(!t||t.length===0)return Object.values(i?s.bV(c):c);const p=[];for(const g of t)if(c[g]){const b=i?s.bV(c[g]):c[g];p.push(b)}return p}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const i=Object.keys(this._layers);for(const c of i){const p=this._layers[c];p.type!=="custom"&&(t[c]=p.serialize())}return t}hasTransitions(){var t,i,c;if(!((t=this.light)===null||t===void 0)&&t.hasTransition()||!((i=this.sky)===null||i===void 0)&&i.hasTransition()||!((c=this.projection)===null||c===void 0)&&c.hasTransition())return!0;for(const p in this.tileManagers)if(this.tileManagers[p].hasTransition())return!0;for(const p in this._layers)if(this._layers[p].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const i=this._changed;if(i){const p=Object.keys(this._updatedLayers),g=Object.keys(this._removedLayers);(p.length||g.length)&&this._updateWorkerLayers(p,g);for(const b in this._updatedSources){const S=this._updatedSources[b];if(S==="reload")this._reloadSource(b);else{if(S!=="clear")throw new Error(`Invalid action ${S}`);this._clearSource(b)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const b in this._updatedPaintProps)this._layers[b].updateTransitions(t);this.light.updateTransitions(t),this.sky.updateTransitions(t),this._resetUpdates()}const c={};for(const p in this.tileManagers){const g=this.tileManagers[p];c[p]=g.used,g.used=!1}for(const p of this._order){const g=this._layers[p];g.recalculate(t,this._availableImages),!g.isHidden(t.zoom)&&g.source&&(this.tileManagers[g.source].used=!0)}for(const p in c){const g=this.tileManagers[p];!!c[p]!=!!g.used&&g.fire(new s.l("data",{sourceDataType:"visibility",dataType:"source",sourceId:p}))}this.light.recalculate(t),this.sky.recalculate(t),this.projection.recalculate(t),this.z=t.zoom,i&&this.fire(new s.l("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const i in this.tileManagers)this.tileManagers[i].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.tileManagers)this.tileManagers[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,i){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(t,!1),removedIds:i})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,i={}){var c;this._checkLoaded();const p=this.serialize();if(t=i.transformStyle?i.transformStyle(p,t):t,((c=i.validate)===null||c===void 0||c)&&Io(this,s.C(t)))return!1;(t=s.bV(t)).layers=s.bS(t.layers);const g=s.bW(p,t),b=this._getOperationsToPerform(g);if(b.unimplemented.length>0)throw new Error(`Unimplemented: ${b.unimplemented.join(", ")}.`);if(b.operations.length===0)return!1;for(const S of b.operations)S();return this.stylesheet=t,this._serializedLayers=null,this.fire(new s.l("style.load",{style:this})),!0}_getOperationsToPerform(t){const i=[],c=[];for(const p of t)switch(p.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":i.push((()=>this.addLayer.apply(this,p.args)));break;case"removeLayer":i.push((()=>this.removeLayer.apply(this,p.args)));break;case"setPaintProperty":i.push((()=>this.setPaintProperty.apply(this,p.args)));break;case"setLayoutProperty":i.push((()=>this.setLayoutProperty.apply(this,p.args)));break;case"setFilter":i.push((()=>this.setFilter.apply(this,p.args)));break;case"addSource":i.push((()=>this.addSource.apply(this,p.args)));break;case"removeSource":i.push((()=>this.removeSource.apply(this,p.args)));break;case"setLayerZoomRange":i.push((()=>this.setLayerZoomRange.apply(this,p.args)));break;case"setLight":i.push((()=>this.setLight.apply(this,p.args)));break;case"setGeoJSONSourceData":i.push((()=>this.setGeoJSONSourceData.apply(this,p.args)));break;case"setGlyphs":i.push((()=>this.setGlyphs.apply(this,p.args)));break;case"setSprite":i.push((()=>this.setSprite.apply(this,p.args)));break;case"setTerrain":i.push((()=>this.map.setTerrain.apply(this,p.args)));break;case"setSky":i.push((()=>this.setSky.apply(this,p.args)));break;case"setProjection":this.setProjection.apply(this,p.args);break;case"setGlobalState":i.push((()=>this.setGlobalState.apply(this,p.args)));break;case"setTransition":i.push((()=>{}));break;default:c.push(p.command)}return{operations:i,unimplemented:c}}addImage(t,i){if(this.getImage(t))return this.fire(new s.k(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,i),this._afterImageUpdated(t)}updateImage(t,i){this.imageManager.updateImage(t,i)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new s.k(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new s.l("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,i,c={}){if(this._checkLoaded(),this.tileManagers[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!i.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(s.C.source,`sources.${t}`,i,null,c))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const p=this.tileManagers[t]=new pi(t,i,this.dispatcher);p.style=this,p.setEventedParent(this,(()=>({isSourceLoaded:p.loaded(),source:p.serialize(),sourceId:t}))),p.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.tileManagers[t]===void 0)throw new Error("There is no source with this ID");for(const c in this._layers)if(this._layers[c].source===t)return this.fire(new s.k(new Error(`Source "${t}" cannot be removed while layer "${c}" is using it.`)));const i=this.tileManagers[t];delete this.tileManagers[t],delete this._updatedSources[t],i.fire(new s.l("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),i.setEventedParent(null),i.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,i){if(this._checkLoaded(),this.tileManagers[t]===void 0)throw new Error(`There is no source with this ID=${t}`);const c=this.tileManagers[t].getSource();if(c.type!=="geojson")throw new Error(`geojsonSource.type is ${c.type}, which is !== 'geojson`);c.setData(i),this._changed=!0}getSource(t){return this.tileManagers[t]&&this.tileManagers[t].getSource()}addLayer(t,i,c={}){this._checkLoaded();const p=t.id;if(this.getLayer(p))return void this.fire(new s.k(new Error(`Layer "${p}" already exists on this map.`)));let g;if(t.type==="custom"){if(Io(this,s.bX(t)))return;g=s.bT(t,this._globalState)}else{if("source"in t&&typeof t.source=="object"&&(this.addSource(p,t.source),t=s.bV(t),t=s.e(t,{source:p})),this._validate(s.C.layer,`layers.${p}`,t,{arrayIndex:-1},c))return;g=s.bT(t,this._globalState),this._validateLayer(g),g.setEventedParent(this,{layer:{id:p}})}const b=i?this._order.indexOf(i):this._order.length;if(i&&b===-1)this.fire(new s.k(new Error(`Cannot add layer "${p}" before non-existing layer "${i}".`)));else{if(this._order.splice(b,0,p),this._layerOrderChanged=!0,this._layers[p]=g,this._removedLayers[p]&&g.source&&g.type!=="custom"){const S=this._removedLayers[p];delete this._removedLayers[p],S.type!==g.type?this._updatedSources[g.source]="clear":(this._updatedSources[g.source]="reload",this.tileManagers[g.source].pause())}this._updateLayer(g),g.onAdd&&g.onAdd(this.map)}}moveLayer(t,i){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new s.k(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===i)return;const c=this._order.indexOf(t);this._order.splice(c,1);const p=i?this._order.indexOf(i):this._order.length;i&&p===-1?this.fire(new s.k(new Error(`Cannot move layer "${t}" before non-existing layer "${i}".`))):(this._order.splice(p,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const i=this._layers[t];if(!i)return void this.fire(new s.k(new Error(`Cannot remove non-existing layer "${t}".`)));i.setEventedParent(null);const c=this._order.indexOf(t);this._order.splice(c,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=i,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],i.onRemove&&i.onRemove(this.map)}getLayer(t){return this._layers[t]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,i,c){this._checkLoaded();const p=this.getLayer(t);p?p.minzoom===i&&p.maxzoom===c||(i!=null&&(p.minzoom=i),c!=null&&(p.maxzoom=c),this._updateLayer(p)):this.fire(new s.k(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,i,c={}){this._checkLoaded();const p=this.getLayer(t);if(p){if(!s.bR(p.filter,i))return i==null?(p.setFilter(void 0),void this._updateLayer(p)):void(this._validate(s.C.filter,`layers.${p.id}.filter`,i,null,c)||(p.setFilter(s.bV(i)),this._updateLayer(p)))}else this.fire(new s.k(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return s.bV(this.getLayer(t).filter)}setLayoutProperty(t,i,c,p={}){this._checkLoaded();const g=this.getLayer(t);g?s.bR(g.getLayoutProperty(i),c)||(g.setLayoutProperty(i,c,p),this._updateLayer(g)):this.fire(new s.k(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,i){const c=this.getLayer(t);if(c)return c.getLayoutProperty(i);this.fire(new s.k(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,i,c,p={}){this._checkLoaded();const g=this.getLayer(t);g?s.bR(g.getPaintProperty(i),c)||this._updatePaintProperty(g,i,c,p):this.fire(new s.k(new Error(`Cannot style non-existing layer "${t}".`)))}_updatePaintProperty(t,i,c,p={}){t.setPaintProperty(i,c,p)&&this._updateLayer(t),s.bU(t)&&i==="raster-fade-duration"&&this.tileManagers[t.source].setRasterFadeDuration(c),this._changed=!0,this._updatedPaintProps[t.id]=!0,this._serializedLayers=null}getPaintProperty(t,i){return this.getLayer(t).getPaintProperty(i)}setFeatureState(t,i){this._checkLoaded();const c=t.source,p=t.sourceLayer,g=this.tileManagers[c];if(g===void 0)return void this.fire(new s.k(new Error(`The source '${c}' does not exist in the map's style.`)));const b=g.getSource().type;b==="geojson"&&p?this.fire(new s.k(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):b!=="vector"||p?(t.id===void 0&&this.fire(new s.k(new Error("The feature id parameter must be provided."))),g.setFeatureState(p,t.id,i)):this.fire(new s.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,i){this._checkLoaded();const c=t.source,p=this.tileManagers[c];if(p===void 0)return void this.fire(new s.k(new Error(`The source '${c}' does not exist in the map's style.`)));const g=p.getSource().type,b=g==="vector"?t.sourceLayer:void 0;g!=="vector"||b?i&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new s.k(new Error("A feature id is required to remove its specific state property."))):p.removeFeatureState(b,t.id,i):this.fire(new s.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const i=t.source,c=t.sourceLayer,p=this.tileManagers[i];if(p!==void 0)return p.getSource().type!=="vector"||c?(t.id===void 0&&this.fire(new s.k(new Error("The feature id parameter must be provided."))),p.getFeatureState(c,t.id)):void this.fire(new s.k(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new s.k(new Error(`The source '${i}' does not exist in the map's style.`)))}getTransition(){return s.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const t=s.bY(this.tileManagers,(g=>g.serialize())),i=this._serializeByIds(this._order,!0),c=this.map.getTerrain()||void 0,p=this.stylesheet;return s.bZ({version:p.version,name:p.name,metadata:p.metadata,light:p.light,sky:p.sky,center:p.center,zoom:p.zoom,bearing:p.bearing,pitch:p.pitch,sprite:p.sprite,glyphs:p.glyphs,transition:p.transition,projection:p.projection,sources:t,layers:i,terrain:c},(g=>g!==void 0))}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.tileManagers[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.tileManagers[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){const i=b=>this._layers[b].type==="fill-extrusion",c={},p=[];for(let b=this._order.length-1;b>=0;b--){const S=this._order[b];if(i(S)){c[S]=b;for(const P of t){const A=P[S];if(A)for(const k of A)p.push(k)}}}p.sort(((b,S)=>S.intersectionZ-b.intersectionZ));const g=[];for(let b=this._order.length-1;b>=0;b--){const S=this._order[b];if(i(S))for(let P=p.length-1;P>=0;P--){const A=p[P].feature;if(c[A.layer.id]<b)break;g.push(A),p.pop()}else for(const P of t){const A=P[S];if(A)for(const k of A)g.push(k.feature)}}return g}queryRenderedFeatures(t,i,c){i&&i.filter&&this._validate(s.C.filter,"queryRenderedFeatures.filter",i.filter,null,i);const p={};if(i&&i.layers){if(!(Array.isArray(i.layers)||i.layers instanceof Set))return this.fire(new s.k(new Error("parameters.layers must be an Array or a Set of strings"))),[];for(const A of i.layers){const k=this._layers[A];if(!k)return this.fire(new s.k(new Error(`The layer '${A}' does not exist in the map's style and cannot be queried for features.`))),[];p[k.source]=!0}}const g=[];i.availableImages=this._availableImages;const b=this._serializedAllLayers(),S=i.layers instanceof Set?i.layers:Array.isArray(i.layers)?new Set(i.layers):null,P=Object.assign(Object.assign({},i),{layers:S,globalState:this._globalState});for(const A in this.tileManagers)i.layers&&!p[A]||g.push(Lr(this.tileManagers[A],this._layers,b,t,P,c,this.map.terrain?(k,F,z)=>this.map.terrain.getElevation(k,F,z):void 0));return this.placement&&g.push((function(A,k,F,z,j,G,Y){const Q={},K=G.queryRenderedSymbols(z),oe=[];for(const de of Object.keys(K).map(Number))oe.push(Y[de]);oe.sort(ur);for(const de of oe){const ie=de.featureIndex.lookupSymbolFeatures(K[de.bucketInstanceId],k,de.bucketIndex,de.sourceLayerIndex,{filterSpec:j.filter,globalState:j.globalState},j.layers,j.availableImages,A);for(const he in ie){const ge=Q[he]=Q[he]||[],ce=ie[he];ce.sort(((ve,Fe)=>{const Ce=de.featureSortOrder;if(Ce){const ke=Ce.indexOf(ve.featureIndex);return Ce.indexOf(Fe.featureIndex)-ke}return Fe.featureIndex-ve.featureIndex}));for(const ve of ce)ge.push(ve)}}return(function(de,ie,he){for(const ge in de)for(const ce of de[ge])qr(ce,he[ie[ge].source]);return de})(Q,A,F)})(this._layers,b,this.tileManagers,t,P,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(g)}querySourceFeatures(t,i){i!=null&&i.filter&&this._validate(s.C.filter,"querySourceFeatures.filter",i.filter,null,i);const c=this.tileManagers[t];return c?(function(p,g){const b=p.getRenderableIds().map((A=>p.getTileByID(A))),S=[],P={};for(let A=0;A<b.length;A++){const k=b[A],F=k.tileID.canonical.key;P[F]||(P[F]=!0,k.querySourceFeatures(S,g))}return S})(c,i?Object.assign(Object.assign({},i),{globalState:this._globalState}):{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(t,i={}){this._checkLoaded();const c=this.light.getLight();let p=!1;for(const b in t)if(!s.bR(t[b],c[b])){p=!0;break}if(!p)return;const g={now:fe(),transition:s.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,i),this.light.updateTransitions(g)}getProjection(){var t;return(t=this.stylesheet)===null||t===void 0?void 0:t.projection}setProjection(t){if(this._checkLoaded(),this.projection){if(this.projection.name===t.type)return;this.projection.destroy(),delete this.projection}this.stylesheet.projection=t,this._setProjectionInternal(t.type)}getSky(){var t;return(t=this.stylesheet)===null||t===void 0?void 0:t.sky}setSky(t,i={}){this._checkLoaded();const c=this.getSky();let p=!1;if(!t&&!c)return;if(t&&!c)p=!0;else if(!t&&c)p=!0;else for(const b in t)if(!s.bR(t[b],c[b])){p=!0;break}if(!p)return;const g={now:fe(),transition:s.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=t,this.sky.setSky(t,i),this.sky.updateTransitions(g)}_setProjectionInternal(t){const i=(function(c,p){const g={constrainOverride:p};if(Array.isArray(c)){const b=new Zh({type:c});return{projection:b,transform:new Mo(g),cameraHelper:new Xh(b)}}switch(c){case"mercator":return{projection:new Un,transform:new Va(g),cameraHelper:new Ua};case"globe":{const b=new Zh({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:b,transform:new Mo(g),cameraHelper:new Xh(b)}}case"vertical-perspective":return{projection:new Kc,transform:new Po(g),cameraHelper:new cn};default:return s.w(`Unknown projection name: ${c}. Falling back to mercator projection.`),{projection:new Un,transform:new Va(g),cameraHelper:new Ua}}})(t,this.map.transformConstrain);this.projection=i.projection,this.map.migrateProjection(i.transform,i.cameraHelper);for(const c in this.tileManagers)this.tileManagers[c].reload()}_validate(t,i,c,p,g={}){return(!g||g.validate!==!1)&&Io(this,t.call(s.C,s.e({key:i,style:this.serialize(),value:c,styleSpec:s.u},p)))}_remove(t=!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),me().off(re,this._rtlPluginLoaded);for(const i in this._layers)this._layers[i].setEventedParent(null);for(const i in this.tileManagers){const c=this.tileManagers[i];c.setEventedParent(null),c.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),t&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(t)}_clearSource(t){this.tileManagers[t].clearTiles()}_reloadSource(t){this.tileManagers[t].resume(),this.tileManagers[t].reload()}_updateSources(t){for(const i in this.tileManagers)this.tileManagers[i].update(t,this.map.terrain)}_generateCollisionBoxes(){for(const t in this.tileManagers)this._reloadSource(t)}_updatePlacement(t,i,c,p,g=!1){let b=!1,S=!1;const P={};for(const A of this._order){const k=this._layers[A];if(k.type!=="symbol")continue;if(!P[k.source]){const z=this.tileManagers[k.source];P[k.source]=z.getRenderableIds(!0).map((j=>z.getTileByID(j))).sort(((j,G)=>G.tileID.overscaledZ-j.tileID.overscaledZ||(j.tileID.isLessThan(G.tileID)?-1:1)))}const F=this.crossTileSymbolIndex.addLayer(k,P[k.source],t.center.lng);b=b||F}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((g=g||this._layerOrderChanged||c===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(fe(),t.zoom))&&(this.pauseablePlacement=new vo(t,this.map.terrain,this._order,g,i,c,p,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,P),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(fe()),S=!0),b&&this.pauseablePlacement.placement.setStale()),S||b)for(const A of this._order){const k=this._layers[A];k.type==="symbol"&&this.placement.updateLayerOpacities(k,P[k.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(fe())}_releaseSymbolFadeTiles(){for(const t in this.tileManagers)this.tileManagers[t].releaseSymbolFadeTiles()}getImages(t,i){return s._(this,void 0,void 0,(function*(){const c=yield this.imageManager.getImages(i.icons);this._updateTilesForChangedImages();const p=this.tileManagers[i.source];return p&&p.setDependencies(i.tileID.key,i.type,i.icons),c}))}getGlyphs(t,i){return s._(this,void 0,void 0,(function*(){const c=yield this.glyphManager.getGlyphs(i.stacks),p=this.tileManagers[i.source];return p&&p.setDependencies(i.tileID.key,i.type,[""]),c}))}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,i={}){this._checkLoaded(),t&&this._validate(s.C.glyphs,"glyphs",t,null,i)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}getDashes(t,i){return s._(this,void 0,void 0,(function*(){const c={};for(const[p,g]of Object.entries(i.dashes))c[p]=this.lineAtlas.getDash(g.dasharray,g.round);return c}))}addSprite(t,i,c={},p){this._checkLoaded();const g=[{id:t,url:i}],b=[...Je(this.stylesheet.sprite),...g];this._validate(s.C.sprite,"sprite",b,null,c)||(this.stylesheet.sprite=b,this._loadSprite(g,!0,p))}removeSprite(t){this._checkLoaded();const i=Je(this.stylesheet.sprite);if(i.find((c=>c.id===t))){if(this._spritesImagesIds[t])for(const c of this._spritesImagesIds[t])this.imageManager.removeImage(c),this._changedImages[c]=!0;i.splice(i.findIndex((c=>c.id===t)),1),this.stylesheet.sprite=i.length>0?i:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new s.l("data",{dataType:"style"}))}else this.fire(new s.k(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return Je(this.stylesheet.sprite)}setSprite(t,i={},c){this._checkLoaded(),t&&this._validate(s.C.sprite,"sprite",t,null,i)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,c):(this._unloadSprite(),c&&c(null)))}destroy(){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null);for(const t in this.tileManagers){const i=this.tileManagers[t];i.setEventedParent(null),i.onRemove(this.map)}this.tileManagers={},this.imageManager&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this._availableImages=[],this._spritesImagesIds={}),this.glyphManager&&this.glyphManager.destroy();for(const t in this._layers){const i=this._layers[t];i.setEventedParent(null),i.onRemove&&i.onRemove(this.map)}this._setInitialValues(),this.setEventedParent(null),this.dispatcher.unregisterMessageHandler("GG"),this.dispatcher.unregisterMessageHandler("GI"),this.dispatcher.unregisterMessageHandler("GDA"),this.dispatcher.remove(!0),this._listeners={},this._oneTimeListeners={}}}var yf=s.aU([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Sl{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,i,c,p,g,b,S,P,A){this.context=t;let k=this.boundPaintVertexBuffers.length!==p.length;for(let F=0;!k&&F<p.length;F++)this.boundPaintVertexBuffers[F]!==p[F]&&(k=!0);!this.vao||this.boundProgram!==i||this.boundLayoutVertexBuffer!==c||k||this.boundIndexBuffer!==g||this.boundVertexOffset!==b||this.boundDynamicVertexBuffer!==S||this.boundDynamicVertexBuffer2!==P||this.boundDynamicVertexBuffer3!==A?this.freshBind(i,c,p,g,b,S,P,A):(t.bindVertexArray.set(this.vao),S&&S.bind(),g&&g.dynamicDraw&&g.bind(),P&&P.bind(),A&&A.bind())}freshBind(t,i,c,p,g,b,S,P){const A=t.numAttributes,k=this.context,F=k.gl;this.vao&&this.destroy(),this.vao=k.createVertexArray(),k.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=i,this.boundPaintVertexBuffers=c,this.boundIndexBuffer=p,this.boundVertexOffset=g,this.boundDynamicVertexBuffer=b,this.boundDynamicVertexBuffer2=S,this.boundDynamicVertexBuffer3=P,i.enableAttributes(F,t);for(const z of c)z.enableAttributes(F,t);b&&b.enableAttributes(F,t),S&&S.enableAttributes(F,t),P&&P.enableAttributes(F,t),i.bind(),i.setVertexAttribPointers(F,t,g);for(const z of c)z.bind(),z.setVertexAttribPointers(F,t,g);b&&(b.bind(),b.setVertexAttribPointers(F,t,g)),p&&p.bind(),S&&(S.bind(),S.setVertexAttribPointers(F,t,g)),P&&(P.bind(),P.setVertexAttribPointers(F,t,g)),k.currentNumAttributes=A}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const _f=(m,t,i,c,p)=>({u_texture:0,u_ele_delta:m,u_fog_matrix:t,u_fog_color:i?i.properties.get("fog-color"):s.bp.white,u_fog_ground_blend:i?i.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:p?0:i?i.calculateFogBlendOpacity(c):0,u_horizon_color:i?i.properties.get("horizon-color"):s.bp.white,u_horizon_fog_blend:i?i.properties.get("horizon-fog-blend"):1,u_is_globe_mode:p?1:0}),Ao={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 El(m){const t=[];for(let i=0;i<m.length;i++){if(m[i]===null)continue;const c=m[i].split(" ");t.push(c.pop())}return t}class Yh{constructor(t,i,c,p,g,b,S,P,A=[]){const k=t.gl;this.program=k.createProgram();const F=El(i.staticAttributes),z=c?c.getBinderAttributes():[],j=F.concat(z),G=Rr.prelude.staticUniforms?El(Rr.prelude.staticUniforms):[],Y=S.staticUniforms?El(S.staticUniforms):[],Q=i.staticUniforms?El(i.staticUniforms):[],K=c?c.getBinderUniforms():[],oe=G.concat(Y).concat(Q).concat(K),de=[];for(const Ce of oe)de.indexOf(Ce)<0&&de.push(Ce);const ie=c?c.defines():[];di(k)&&ie.unshift("#version 300 es"),g&&ie.push("#define OVERDRAW_INSPECTOR;"),b&&ie.push("#define TERRAIN3D;"),P&&ie.push(P),A&&ie.push(...A);let he=ie.concat(Rr.prelude.fragmentSource,S.fragmentSource,i.fragmentSource).join(`
808`),ge=ie.concat(Rr.prelude.vertexSource,S.vertexSource,i.vertexSource).join(`
809`);di(k)||(he=(function(Ce){return Ce.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")})(he),ge=(function(Ce){return Ce.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")})(ge));const ce=k.createShader(k.FRAGMENT_SHADER);if(k.isContextLost())return void(this.failedToCreate=!0);if(k.shaderSource(ce,he),k.compileShader(ce),!k.getShaderParameter(ce,k.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${k.getShaderInfoLog(ce)}`);k.attachShader(this.program,ce);const ve=k.createShader(k.VERTEX_SHADER);if(k.isContextLost())return void(this.failedToCreate=!0);if(k.shaderSource(ve,ge),k.compileShader(ve),!k.getShaderParameter(ve,k.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${k.getShaderInfoLog(ve)}`);k.attachShader(this.program,ve),this.attributes={};const Fe={};this.numAttributes=j.length;for(let Ce=0;Ce<this.numAttributes;Ce++)j[Ce]&&(k.bindAttribLocation(this.program,Ce,j[Ce]),this.attributes[j[Ce]]=Ce);if(k.linkProgram(this.program),!k.getProgramParameter(this.program,k.LINK_STATUS))throw new Error(`Program failed to link: ${k.getProgramInfoLog(this.program)}`);k.deleteShader(ve),k.deleteShader(ce);for(let Ce=0;Ce<de.length;Ce++){const ke=de[Ce];if(ke&&!Fe[ke]){const Le=k.getUniformLocation(this.program,ke);Le&&(Fe[ke]=Le)}}this.fixedUniforms=p(t,Fe),this.terrainUniforms=((Ce,ke)=>({u_depth:new s.b_(Ce,ke.u_depth),u_terrain:new s.b_(Ce,ke.u_terrain),u_terrain_dim:new s.bq(Ce,ke.u_terrain_dim),u_terrain_matrix:new s.c0(Ce,ke.u_terrain_matrix),u_terrain_unpack:new s.c1(Ce,ke.u_terrain_unpack),u_terrain_exaggeration:new s.bq(Ce,ke.u_terrain_exaggeration)}))(t,Fe),this.projectionUniforms=((Ce,ke)=>({u_projection_matrix:new s.c0(Ce,ke.u_projection_matrix),u_projection_tile_mercator_coords:new s.c1(Ce,ke.u_projection_tile_mercator_coords),u_projection_clipping_plane:new s.c1(Ce,ke.u_projection_clipping_plane),u_projection_transition:new s.bq(Ce,ke.u_projection_transition),u_projection_fallback_matrix:new s.c0(Ce,ke.u_projection_fallback_matrix)}))(t,Fe),this.binderUniforms=c?c.getUniforms(t,Fe):[]}draw(t,i,c,p,g,b,S,P,A,k,F,z,j,G,Y,Q,K,oe,de){const ie=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(c),t.setStencilMode(p),t.setColorMode(g),t.setCullFace(b),P){t.activeTexture.set(ie.TEXTURE2),ie.bindTexture(ie.TEXTURE_2D,P.depthTexture),t.activeTexture.set(ie.TEXTURE3),ie.bindTexture(ie.TEXTURE_2D,P.texture);for(const ge in this.terrainUniforms)this.terrainUniforms[ge].set(P[ge])}if(A)for(const ge in A)this.projectionUniforms[Ao[ge]].set(A[ge]);if(S)for(const ge in this.fixedUniforms)this.fixedUniforms[ge].set(S[ge]);Q&&Q.setUniforms(t,this.binderUniforms,G,{zoom:Y});let he=0;switch(i){case ie.LINES:he=2;break;case ie.TRIANGLES:he=3;break;case ie.LINE_STRIP:he=1}for(const ge of j.get()){const ce=ge.vaos||(ge.vaos={});(ce[k]||(ce[k]=new Sl)).bind(t,this,F,Q?Q.getPaintVertexBuffers():[],z,ge.vertexOffset,K,oe,de),ie.drawElements(i,ge.primitiveLength*he,ie.UNSIGNED_SHORT,ge.primitiveOffset*he*2)}}}function Kh(m,t,i){const c=1/s.aN(i,1,t.transform.tileZoom),p=Math.pow(2,i.tileID.overscaledZ),g=i.tileSize*Math.pow(2,t.transform.tileZoom)/p,b=g*(i.tileID.canonical.x+i.tileID.wrap*p),S=g*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[c,m.fromScale,m.toScale],u_fade:m.t,u_pixel_coord_upper:[b>>16,S>>16],u_pixel_coord_lower:[65535&b,65535&S]}}const tu=(m,t,i,c)=>{const p=m.style.light,g=p.properties.get("position"),b=[g.x,g.y,g.z],S=s.c4();p.properties.get("anchor")==="viewport"&&s.c5(S,m.transform.bearingInRadians),s.c6(b,b,S);const P=m.transform.transformLightDirection(b),A=p.properties.get("color");return{u_lightpos:b,u_lightpos_globe:P,u_lightintensity:p.properties.get("intensity"),u_lightcolor:[A.r,A.g,A.b],u_vertical_gradient:+t,u_opacity:i,u_fill_translate:c}},ru=(m,t,i,c,p,g,b)=>s.e(tu(m,t,i,c),Kh(g,m,b),{u_height_factor:-Math.pow(2,p.overscaledZ)/b.tileSize/8}),nu=(m,t,i,c)=>s.e(Kh(t,m,i),{u_fill_translate:c}),Jh=(m,t)=>({u_world:m,u_fill_translate:t}),Qh=(m,t,i,c,p)=>s.e(nu(m,t,i,p),{u_world:c}),ep=(m,t,i,c,p)=>{const g=m.transform;let b,S,P=0;if(i.paint.get("circle-pitch-alignment")==="map"){const A=s.aN(t,1,g.zoom);b=!0,S=[A,A],P=A/(s.a5*Math.pow(2,t.tileID.overscaledZ))*2*Math.PI*p}else b=!1,S=g.pixelsToGLUnits;return{u_camera_to_center_distance:g.cameraToCenterDistance,u_scale_with_map:+(i.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+b,u_device_pixel_ratio:m.pixelRatio,u_extrude_scale:S,u_globe_extrude_scale:P,u_translate:c}},Ga=m=>({u_pixel_extrude_scale:[1/m.width,1/m.height]}),tp=m=>({u_viewport_size:[m.width,m.height]}),iu=(m,t=1)=>({u_color:m,u_overlay:0,u_overlay_scale:t}),Co=(m,t,i,c)=>{const p=s.aN(m,1,t)/(s.a5*Math.pow(2,m.tileID.overscaledZ))*2*Math.PI*c;return{u_extrude_scale:s.aN(m,1,t),u_intensity:i,u_globe_extrude_scale:p}},rp=(m,t,i,c)=>{const p=s.N();s.c7(p,0,m.width,m.height,0,0,1);const g=m.context.gl;return{u_matrix:p,u_world:[g.drawingBufferWidth,g.drawingBufferHeight],u_image:i,u_color_ramp:c,u_opacity:t.paint.get("heatmap-opacity")}},Pl=(m,t,i)=>{const c=i.paint.get("hillshade-accent-color");let p;switch(i.paint.get("hillshade-method")){case"basic":p=4;break;case"combined":p=1;break;case"igor":p=2;break;case"multidirectional":p=3;break;default:p=0}const g=i.getIlluminationProperties();for(let b=0;b<g.directionRadians.length;b++)i.paint.get("hillshade-illumination-anchor")==="viewport"&&(g.directionRadians[b]+=m.transform.bearingInRadians);return{u_image:0,u_latrange:xf(0,t.tileID),u_exaggeration:i.paint.get("hillshade-exaggeration"),u_altitudes:g.altitudeRadians,u_azimuths:g.directionRadians,u_accent:c,u_method:p,u_highlights:g.highlightColor,u_shadows:g.shadowColor}},vf=(m,t)=>{const i=t.stride,c=s.N();return s.c7(c,0,s.a5,-s.a5,0,0,1),s.O(c,c,[0,-s.a5,0]),{u_matrix:c,u_image:1,u_dimension:[i,i],u_zoom:m.overscaledZ,u_unpack:t.getUnpackVector()}};function xf(m,t){const i=Math.pow(2,t.canonical.z),c=t.canonical.y;return[new s.a9(0,c/i).toLngLat().lat,new s.a9(0,(c+1)/i).toLngLat().lat]}const np=(m,t,i=0)=>({u_image:0,u_unpack:t.getUnpackVector(),u_dimension:[t.stride,t.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:i,u_opacity:m.paint.get("color-relief-opacity")}),_s=(m,t,i,c)=>{const p=m.transform;return{u_translation:Il(m,t,i),u_ratio:c/s.aN(t,1,p.zoom),u_device_pixel_ratio:m.pixelRatio,u_units_to_pixels:[1/p.pixelsToGLUnits[0],1/p.pixelsToGLUnits[1]]}},ip=(m,t,i,c,p)=>s.e(_s(m,t,i,c),{u_image:0,u_image_height:p}),au=(m,t,i,c,p)=>{const g=m.transform,b=Ti(t,g);return{u_translation:Il(m,t,i),u_texsize:t.imageAtlasTexture.size,u_ratio:c/s.aN(t,1,g.zoom),u_device_pixel_ratio:m.pixelRatio,u_image:0,u_scale:[b,p.fromScale,p.toScale],u_fade:p.t,u_units_to_pixels:[1/g.pixelsToGLUnits[0],1/g.pixelsToGLUnits[1]]}},ap=(m,t,i,c,p)=>{const g=Ti(t,m.transform);return s.e(_s(m,t,i,c),{u_tileratio:g,u_crossfade_from:p.fromScale,u_crossfade_to:p.toScale,u_image:0,u_mix:p.t,u_lineatlas_width:m.lineAtlas.width,u_lineatlas_height:m.lineAtlas.height})},Ml=(m,t,i,c,p,g)=>{const b=Ti(t,m.transform);return s.e(_s(m,t,i,c),{u_image:0,u_image_height:g,u_tileratio:b,u_crossfade_from:p.fromScale,u_crossfade_to:p.toScale,u_image_dash:1,u_mix:p.t,u_lineatlas_width:m.lineAtlas.width,u_lineatlas_height:m.lineAtlas.height})};function Ti(m,t){return 1/s.aN(m,1,t.tileZoom)}function Il(m,t,i){return s.aO(m.transform,t,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const ou=(m,t,i,c,p)=>{return{u_tl_parent:m,u_scale_parent:t,u_buffer_scale:1,u_fade_t:i.mix,u_opacity:i.opacity*c.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:c.paint.get("raster-brightness-min"),u_brightness_high:c.paint.get("raster-brightness-max"),u_saturation_factor:(b=c.paint.get("raster-saturation"),b>0?1-1/(1.001-b):-b),u_contrast_factor:(g=c.paint.get("raster-contrast"),g>0?1/(1-g):1+g),u_spin_weights:su(c.paint.get("raster-hue-rotate")),u_coords_top:[p[0].x,p[0].y,p[1].x,p[1].y],u_coords_bottom:[p[3].x,p[3].y,p[2].x,p[2].y]};var g,b};function su(m){m*=Math.PI/180;const t=Math.sin(m),i=Math.cos(m);return[(2*i+1)/3,(-Math.sqrt(3)*t-i+1)/3,(Math.sqrt(3)*t-i+1)/3]}const lu=(m,t,i,c,p,g,b,S,P,A,k,F,z)=>{const j=b.transform;return{u_is_size_zoom_constant:+(m==="constant"||m==="source"),u_is_size_feature_constant:+(m==="constant"||m==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:j.cameraToCenterDistance,u_pitch:j.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:j.width/j.height,u_fade_change:b.options.fadeDuration?b.symbolFadeChange:1,u_label_plane_matrix:S,u_coord_matrix:P,u_is_text:+k,u_pitch_with_map:+c,u_is_along_line:p,u_is_variable_anchor:g,u_texsize:F,u_texture:0,u_translation:A,u_pitched_scale:z}},Al=(m,t,i,c,p,g,b,S,P,A,k,F,z,j)=>{const G=b.transform;return s.e(lu(m,t,i,c,p,g,b,S,P,A,k,F,j),{u_gamma_scale:c?Math.cos(G.pitch*Math.PI/180)*G.cameraToCenterDistance:1,u_device_pixel_ratio:b.pixelRatio,u_is_halo:1})},Za=(m,t,i,c,p,g,b,S,P,A,k,F,z)=>s.e(Al(m,t,i,c,p,g,b,S,P,A,!0,k,0,z),{u_texsize_icon:F,u_texture_icon:1}),cu=(m,t)=>({u_opacity:m,u_color:t}),bf=(m,t,i,c,p)=>s.e((function(g,b,S,P){const A=S.imageManager.getPattern(g.from.toString()),k=S.imageManager.getPattern(g.to.toString()),{width:F,height:z}=S.imageManager.getPixelSize(),j=Math.pow(2,P.tileID.overscaledZ),G=P.tileSize*Math.pow(2,S.transform.tileZoom)/j,Y=G*(P.tileID.canonical.x+P.tileID.wrap*j),Q=G*P.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:A.tl,u_pattern_br_a:A.br,u_pattern_tl_b:k.tl,u_pattern_br_b:k.br,u_texsize:[F,z],u_mix:b.t,u_pattern_size_a:A.displaySize,u_pattern_size_b:k.displaySize,u_scale_a:b.fromScale,u_scale_b:b.toScale,u_tile_units_to_pixels:1/s.aN(P,1,S.transform.tileZoom),u_pixel_coord_upper:[Y>>16,Q>>16],u_pixel_coord_lower:[65535&Y,65535&Q]}})(i,p,t,c),{u_opacity:m}),op=(m,t)=>{},wf={fillExtrusion:(m,t)=>({u_lightpos:new s.c2(m,t.u_lightpos),u_lightpos_globe:new s.c2(m,t.u_lightpos_globe),u_lightintensity:new s.bq(m,t.u_lightintensity),u_lightcolor:new s.c2(m,t.u_lightcolor),u_vertical_gradient:new s.bq(m,t.u_vertical_gradient),u_opacity:new s.bq(m,t.u_opacity),u_fill_translate:new s.c3(m,t.u_fill_translate)}),fillExtrusionPattern:(m,t)=>({u_lightpos:new s.c2(m,t.u_lightpos),u_lightpos_globe:new s.c2(m,t.u_lightpos_globe),u_lightintensity:new s.bq(m,t.u_lightintensity),u_lightcolor:new s.c2(m,t.u_lightcolor),u_vertical_gradient:new s.bq(m,t.u_vertical_gradient),u_height_factor:new s.bq(m,t.u_height_factor),u_opacity:new s.bq(m,t.u_opacity),u_fill_translate:new s.c3(m,t.u_fill_translate),u_image:new s.b_(m,t.u_image),u_texsize:new s.c3(m,t.u_texsize),u_pixel_coord_upper:new s.c3(m,t.u_pixel_coord_upper),u_pixel_coord_lower:new s.c3(m,t.u_pixel_coord_lower),u_scale:new s.c2(m,t.u_scale),u_fade:new s.bq(m,t.u_fade)}),fill:(m,t)=>({u_fill_translate:new s.c3(m,t.u_fill_translate)}),fillPattern:(m,t)=>({u_image:new s.b_(m,t.u_image),u_texsize:new s.c3(m,t.u_texsize),u_pixel_coord_upper:new s.c3(m,t.u_pixel_coord_upper),u_pixel_coord_lower:new s.c3(m,t.u_pixel_coord_lower),u_scale:new s.c2(m,t.u_scale),u_fade:new s.bq(m,t.u_fade),u_fill_translate:new s.c3(m,t.u_fill_translate)}),fillOutline:(m,t)=>({u_world:new s.c3(m,t.u_world),u_fill_translate:new s.c3(m,t.u_fill_translate)}),fillOutlinePattern:(m,t)=>({u_world:new s.c3(m,t.u_world),u_image:new s.b_(m,t.u_image),u_texsize:new s.c3(m,t.u_texsize),u_pixel_coord_upper:new s.c3(m,t.u_pixel_coord_upper),u_pixel_coord_lower:new s.c3(m,t.u_pixel_coord_lower),u_scale:new s.c2(m,t.u_scale),u_fade:new s.bq(m,t.u_fade),u_fill_translate:new s.c3(m,t.u_fill_translate)}),circle:(m,t)=>({u_camera_to_center_distance:new s.bq(m,t.u_camera_to_center_distance),u_scale_with_map:new s.b_(m,t.u_scale_with_map),u_pitch_with_map:new s.b_(m,t.u_pitch_with_map),u_extrude_scale:new s.c3(m,t.u_extrude_scale),u_device_pixel_ratio:new s.bq(m,t.u_device_pixel_ratio),u_globe_extrude_scale:new s.bq(m,t.u_globe_extrude_scale),u_translate:new s.c3(m,t.u_translate)}),collisionBox:(m,t)=>({u_pixel_extrude_scale:new s.c3(m,t.u_pixel_extrude_scale)}),collisionCircle:(m,t)=>({u_viewport_size:new s.c3(m,t.u_viewport_size)}),debug:(m,t)=>({u_color:new s.b$(m,t.u_color),u_overlay:new s.b_(m,t.u_overlay),u_overlay_scale:new s.bq(m,t.u_overlay_scale)}),depth:op,clippingMask:op,heatmap:(m,t)=>({u_extrude_scale:new s.bq(m,t.u_extrude_scale),u_intensity:new s.bq(m,t.u_intensity),u_globe_extrude_scale:new s.bq(m,t.u_globe_extrude_scale)}),heatmapTexture:(m,t)=>({u_matrix:new s.c0(m,t.u_matrix),u_world:new s.c3(m,t.u_world),u_image:new s.b_(m,t.u_image),u_color_ramp:new s.b_(m,t.u_color_ramp),u_opacity:new s.bq(m,t.u_opacity)}),hillshade:(m,t)=>({u_image:new s.b_(m,t.u_image),u_latrange:new s.c3(m,t.u_latrange),u_exaggeration:new s.bq(m,t.u_exaggeration),u_altitudes:new s.c9(m,t.u_altitudes),u_azimuths:new s.c9(m,t.u_azimuths),u_accent:new s.b$(m,t.u_accent),u_method:new s.b_(m,t.u_method),u_shadows:new s.c8(m,t.u_shadows),u_highlights:new s.c8(m,t.u_highlights)}),hillshadePrepare:(m,t)=>({u_matrix:new s.c0(m,t.u_matrix),u_image:new s.b_(m,t.u_image),u_dimension:new s.c3(m,t.u_dimension),u_zoom:new s.bq(m,t.u_zoom),u_unpack:new s.c1(m,t.u_unpack)}),colorRelief:(m,t)=>({u_image:new s.b_(m,t.u_image),u_unpack:new s.c1(m,t.u_unpack),u_dimension:new s.c3(m,t.u_dimension),u_elevation_stops:new s.b_(m,t.u_elevation_stops),u_color_stops:new s.b_(m,t.u_color_stops),u_color_ramp_size:new s.b_(m,t.u_color_ramp_size),u_opacity:new s.bq(m,t.u_opacity)}),line:(m,t)=>({u_translation:new s.c3(m,t.u_translation),u_ratio:new s.bq(m,t.u_ratio),u_device_pixel_ratio:new s.bq(m,t.u_device_pixel_ratio),u_units_to_pixels:new s.c3(m,t.u_units_to_pixels)}),lineGradient:(m,t)=>({u_translation:new s.c3(m,t.u_translation),u_ratio:new s.bq(m,t.u_ratio),u_device_pixel_ratio:new s.bq(m,t.u_device_pixel_ratio),u_units_to_pixels:new s.c3(m,t.u_units_to_pixels),u_image:new s.b_(m,t.u_image),u_image_height:new s.bq(m,t.u_image_height)}),linePattern:(m,t)=>({u_translation:new s.c3(m,t.u_translation),u_texsize:new s.c3(m,t.u_texsize),u_ratio:new s.bq(m,t.u_ratio),u_device_pixel_ratio:new s.bq(m,t.u_device_pixel_ratio),u_image:new s.b_(m,t.u_image),u_units_to_pixels:new s.c3(m,t.u_units_to_pixels),u_scale:new s.c2(m,t.u_scale),u_fade:new s.bq(m,t.u_fade)}),lineSDF:(m,t)=>({u_translation:new s.c3(m,t.u_translation),u_ratio:new s.bq(m,t.u_ratio),u_device_pixel_ratio:new s.bq(m,t.u_device_pixel_ratio),u_units_to_pixels:new s.c3(m,t.u_units_to_pixels),u_image:new s.b_(m,t.u_image),u_mix:new s.bq(m,t.u_mix),u_tileratio:new s.bq(m,t.u_tileratio),u_crossfade_from:new s.bq(m,t.u_crossfade_from),u_crossfade_to:new s.bq(m,t.u_crossfade_to),u_lineatlas_width:new s.bq(m,t.u_lineatlas_width),u_lineatlas_height:new s.bq(m,t.u_lineatlas_height)}),lineGradientSDF:(m,t)=>({u_translation:new s.c3(m,t.u_translation),u_ratio:new s.bq(m,t.u_ratio),u_device_pixel_ratio:new s.bq(m,t.u_device_pixel_ratio),u_units_to_pixels:new s.c3(m,t.u_units_to_pixels),u_image:new s.b_(m,t.u_image),u_image_height:new s.bq(m,t.u_image_height),u_tileratio:new s.bq(m,t.u_tileratio),u_crossfade_from:new s.bq(m,t.u_crossfade_from),u_crossfade_to:new s.bq(m,t.u_crossfade_to),u_image_dash:new s.b_(m,t.u_image_dash),u_mix:new s.bq(m,t.u_mix),u_lineatlas_width:new s.bq(m,t.u_lineatlas_width),u_lineatlas_height:new s.bq(m,t.u_lineatlas_height)}),raster:(m,t)=>({u_tl_parent:new s.c3(m,t.u_tl_parent),u_scale_parent:new s.bq(m,t.u_scale_parent),u_buffer_scale:new s.bq(m,t.u_buffer_scale),u_fade_t:new s.bq(m,t.u_fade_t),u_opacity:new s.bq(m,t.u_opacity),u_image0:new s.b_(m,t.u_image0),u_image1:new s.b_(m,t.u_image1),u_brightness_low:new s.bq(m,t.u_brightness_low),u_brightness_high:new s.bq(m,t.u_brightness_high),u_saturation_factor:new s.bq(m,t.u_saturation_factor),u_contrast_factor:new s.bq(m,t.u_contrast_factor),u_spin_weights:new s.c2(m,t.u_spin_weights),u_coords_top:new s.c1(m,t.u_coords_top),u_coords_bottom:new s.c1(m,t.u_coords_bottom)}),symbolIcon:(m,t)=>
809({u_is_size_zoom_constant:new s.b_(m,t.u_is_size_zoom_constant),u_is_size_feature_constant:new s.b_(m,t.u_is_size_feature_constant),u_size_t:new s.bq(m,t.u_size_t),u_size:new s.bq(m,t.u_size),u_camera_to_center_distance:new s.bq(m,t.u_camera_to_center_distance),u_pitch:new s.bq(m,t.u_pitch),u_rotate_symbol:new s.b_(m,t.u_rotate_symbol),u_aspect_ratio:new s.bq(m,t.u_aspect_ratio),u_fade_change:new s.bq(m,t.u_fade_change),u_label_plane_matrix:new s.c0(m,t.u_label_plane_matrix),u_coord_matrix:new s.c0(m,t.u_coord_matrix),u_is_text:new s.b_(m,t.u_is_text),u_pitch_with_map:new s.b_(m,t.u_pitch_with_map),u_is_along_line:new s.b_(m,t.u_is_along_line),u_is_variable_anchor:new s.b_(m,t.u_is_variable_anchor),u_texsize:new s.c3(m,t.u_texsize),u_texture:new s.b_(m,t.u_texture),u_translation:new s.c3(m,t.u_translation),u_pitched_scale:new s.bq(m,t.u_pitched_scale)}),symbolSDF:(m,t)=>({u_is_size_zoom_constant:new s.b_(m,t.u_is_size_zoom_constant),u_is_size_feature_constant:new s.b_(m,t.u_is_size_feature_constant),u_size_t:new s.bq(m,t.u_size_t),u_size:new s.bq(m,t.u_size),u_camera_to_center_distance:new s.bq(m,t.u_camera_to_center_distance),u_pitch:new s.bq(m,t.u_pitch),u_rotate_symbol:new s.b_(m,t.u_rotate_symbol),u_aspect_ratio:new s.bq(m,t.u_aspect_ratio),u_fade_change:new s.bq(m,t.u_fade_change),u_label_plane_matrix:new s.c0(m,t.u_label_plane_matrix),u_coord_matrix:new s.c0(m,t.u_coord_matrix),u_is_text:new s.b_(m,t.u_is_text),u_pitch_with_map:new s.b_(m,t.u_pitch_with_map),u_is_along_line:new s.b_(m,t.u_is_along_line),u_is_variable_anchor:new s.b_(m,t.u_is_variable_anchor),u_texsize:new s.c3(m,t.u_texsize),u_texture:new s.b_(m,t.u_texture),u_gamma_scale:new s.bq(m,t.u_gamma_scale),u_device_pixel_ratio:new s.bq(m,t.u_device_pixel_ratio),u_is_halo:new s.b_(m,t.u_is_halo),u_translation:new s.c3(m,t.u_translation),u_pitched_scale:new s.bq(m,t.u_pitched_scale)}),symbolTextAndIcon:(m,t)=>({u_is_size_zoom_constant:new s.b_(m,t.u_is_size_zoom_constant),u_is_size_feature_constant:new s.b_(m,t.u_is_size_feature_constant),u_size_t:new s.bq(m,t.u_size_t),u_size:new s.bq(m,t.u_size),u_camera_to_center_distance:new s.bq(m,t.u_camera_to_center_distance),u_pitch:new s.bq(m,t.u_pitch),u_rotate_symbol:new s.b_(m,t.u_rotate_symbol),u_aspect_ratio:new s.bq(m,t.u_aspect_ratio),u_fade_change:new s.bq(m,t.u_fade_change),u_label_plane_matrix:new s.c0(m,t.u_label_plane_matrix),u_coord_matrix:new s.c0(m,t.u_coord_matrix),u_is_text:new s.b_(m,t.u_is_text),u_pitch_with_map:new s.b_(m,t.u_pitch_with_map),u_is_along_line:new s.b_(m,t.u_is_along_line),u_is_variable_anchor:new s.b_(m,t.u_is_variable_anchor),u_texsize:new s.c3(m,t.u_texsize),u_texsize_icon:new s.c3(m,t.u_texsize_icon),u_texture:new s.b_(m,t.u_texture),u_texture_icon:new s.b_(m,t.u_texture_icon),u_gamma_scale:new s.bq(m,t.u_gamma_scale),u_device_pixel_ratio:new s.bq(m,t.u_device_pixel_ratio),u_is_halo:new s.b_(m,t.u_is_halo),u_translation:new s.c3(m,t.u_translation),u_pitched_scale:new s.bq(m,t.u_pitched_scale)}),background:(m,t)=>({u_opacity:new s.bq(m,t.u_opacity),u_color:new s.b$(m,t.u_color)}),backgroundPattern:(m,t)=>({u_opacity:new s.bq(m,t.u_opacity),u_image:new s.b_(m,t.u_image),u_pattern_tl_a:new s.c3(m,t.u_pattern_tl_a),u_pattern_br_a:new s.c3(m,t.u_pattern_br_a),u_pattern_tl_b:new s.c3(m,t.u_pattern_tl_b),u_pattern_br_b:new s.c3(m,t.u_pattern_br_b),u_texsize:new s.c3(m,t.u_texsize),u_mix:new s.bq(m,t.u_mix),u_pattern_size_a:new s.c3(m,t.u_pattern_size_a),u_pattern_size_b:new s.c3(m,t.u_pattern_size_b),u_scale_a:new s.bq(m,t.u_scale_a),u_scale_b:new s.bq(m,t.u_scale_b),u_pixel_coord_upper:new s.c3(m,t.u_pixel_coord_upper),u_pixel_coord_lower:new s.c3(m,t.u_pixel_coord_lower),u_tile_units_to_pixels:new s.bq(m,t.u_tile_units_to_pixels)}),terrain:(m,t)=>({u_texture:new s.b_(m,t.u_texture),u_ele_delta:new s.bq(m,t.u_ele_delta),u_fog_matrix:new s.c0(m,t.u_fog_matrix),u_fog_color:new s.b$(m,t.u_fog_color),u_fog_ground_blend:new s.bq(m,t.u_fog_ground_blend),u_fog_ground_blend_opacity:new s.bq(m,t.u_fog_ground_blend_opacity),u_horizon_color:new s.b$(m,t.u_horizon_color),u_horizon_fog_blend:new s.bq(m,t.u_horizon_fog_blend),u_is_globe_mode:new s.bq(m,t.u_is_globe_mode)}),terrainDepth:(m,t)=>
vendor: 119,843 bytes, lines 809-811
809({u_ele_delta:new s.bq(m,t.u_ele_delta)}),terrainCoords:(m,t)=>({u_texture:new s.b_(m,t.u_texture),u_terrain_coords_id:new s.bq(m,t.u_terrain_coords_id),u_ele_delta:new s.bq(m,t.u_ele_delta)}),projectionErrorMeasurement:(m,t)=>({u_input:new s.bq(m,t.u_input),u_output_expected:new s.bq(m,t.u_output_expected)}),atmosphere:(m,t)=>({u_sun_pos:new s.c2(m,t.u_sun_pos),u_atmosphere_blend:new s.bq(m,t.u_atmosphere_blend),u_globe_position:new s.c2(m,t.u_globe_position),u_globe_radius:new s.bq(m,t.u_globe_radius),u_inv_proj_matrix:new s.c0(m,t.u_inv_proj_matrix)}),sky:(m,t)=>({u_sky_color:new s.b$(m,t.u_sky_color),u_horizon_color:new s.b$(m,t.u_horizon_color),u_horizon:new s.c3(m,t.u_horizon),u_horizon_normal:new s.c3(m,t.u_horizon_normal),u_sky_horizon_blend:new s.bq(m,t.u_sky_horizon_blend),u_sky_blend:new s.bq(m,t.u_sky_blend)})};class Tf{constructor(t,i,c){this.context=t;const p=t.gl;this.buffer=p.createBuffer(),this.dynamicDraw=!!c,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),p.bufferData(p.ELEMENT_ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?p.DYNAMIC_DRAW:p.STATIC_DRAW),this.dynamicDraw||delete i.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){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,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const sp={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Sf{constructor(t,i,c,p){this.length=i.length,this.attributes=c,this.itemSize=i.bytesPerElement,this.dynamicDraw=p,this.context=t;const g=t.gl;this.buffer=g.createBuffer(),t.bindVertexBuffer.set(this.buffer),g.bufferData(g.ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?g.DYNAMIC_DRAW:g.STATIC_DRAW),this.dynamicDraw||delete i.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const i=this.context.gl;this.bind(),i.bufferSubData(i.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,i){for(let c=0;c<this.attributes.length;c++){const p=i.attributes[this.attributes[c].name];p!==void 0&&t.enableVertexAttribArray(p)}}setVertexAttribPointers(t,i,c){for(let p=0;p<this.attributes.length;p++){const g=this.attributes[p],b=i.attributes[g.name];b!==void 0&&t.vertexAttribPointer(b,g.components,t[sp[g.type]],!1,this.itemSize,g.offset+this.itemSize*(c||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class ir{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Cl extends ir{getDefault(){return s.bp.transparent}set(t){const i=this.current;(t.r!==i.r||t.g!==i.g||t.b!==i.b||t.a!==i.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class kl extends ir{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Dl extends ir{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class uu extends ir{getDefault(){return[!0,!0,!0,!0]}set(t){const i=this.current;(t[0]!==i[0]||t[1]!==i[1]||t[2]!==i[2]||t[3]!==i[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Wa extends ir{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class vs extends ir{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class ko extends ir{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const i=this.current;(t.func!==i.func||t.ref!==i.ref||t.mask!==i.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class fi extends ir{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const i=this.current;(t[0]!==i[0]||t[1]!==i[1]||t[2]!==i[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class lp extends ir{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const i=this.gl;t?i.enable(i.STENCIL_TEST):i.disable(i.STENCIL_TEST),this.current=t,this.dirty=!1}}class cp extends ir{getDefault(){return[0,1]}set(t){const i=this.current;(t[0]!==i[0]||t[1]!==i[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class hu extends ir{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const i=this.gl;t?i.enable(i.DEPTH_TEST):i.disable(i.DEPTH_TEST),this.current=t,this.dirty=!1}}class Ha extends ir{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class Ll extends ir{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const i=this.gl;t?i.enable(i.BLEND):i.disable(i.BLEND),this.current=t,this.dirty=!1}}class Rl extends ir{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const i=this.current;(t[0]!==i[0]||t[1]!==i[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class xs extends ir{getDefault(){return s.bp.transparent}set(t){const i=this.current;(t.r!==i.r||t.g!==i.g||t.b!==i.b||t.a!==i.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class zl extends ir{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class up extends ir{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const i=this.gl;t?i.enable(i.CULL_FACE):i.disable(i.CULL_FACE),this.current=t,this.dirty=!1}}class Do extends ir{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class Lo extends ir{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class hp extends ir{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class pu extends ir{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class Vt extends ir{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const i=this.current;(t[0]!==i[0]||t[1]!==i[1]||t[2]!==i[2]||t[3]!==i[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Fl extends ir{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const i=this.gl;i.bindFramebuffer(i.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class Ef extends ir{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const i=this.gl;i.bindRenderbuffer(i.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class pp extends ir{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const i=this.gl;i.bindTexture(i.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class bs extends ir{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const i=this.gl;i.bindBuffer(i.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Pf extends ir{getDefault(){return null}set(t){const i=this.gl;i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Mf extends ir{getDefault(){return null}set(t){var i;if(t===this.current&&!this.dirty)return;const c=this.gl;di(c)?c.bindVertexArray(t):(i=c.getExtension("OES_vertex_array_object"))===null||i===void 0||i.bindVertexArrayOES(t),this.current=t,this.dirty=!1}}class dp extends ir{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const i=this.gl;i.pixelStorei(i.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class If extends ir{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const i=this.gl;i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class du extends ir{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const i=this.gl;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class Ro extends ir{constructor(t,i){super(t),this.context=t,this.parent=i}getDefault(){return null}}class ws extends Ro{setDirty(){this.dirty=!0}set(t){if(t===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,t,0),this.current=t,this.dirty=!1}}class Ol extends Ro{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const i=this.gl;i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class fu extends Ro{set(t){if(t===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,t),this.current=t,this.dirty=!1}}const mu="Framebuffer is not complete";class Bl{constructor(t,i,c,p,g){this.context=t,this.width=i,this.height=c;const b=t.gl,S=this.framebuffer=b.createFramebuffer();if(this.colorAttachment=new ws(t,S),p)this.depthAttachment=g?new fu(t,S):new Ol(t,S);else if(g)throw new Error("Stencil cannot be set without depth");if(b.checkFramebufferStatus(b.FRAMEBUFFER)!==b.FRAMEBUFFER_COMPLETE)throw new Error(mu)}destroy(){const t=this.context.gl,i=this.colorAttachment.get();if(i&&t.deleteTexture(i),this.depthAttachment){const c=this.depthAttachment.get();c&&t.deleteRenderbuffer(c)}t.deleteFramebuffer(this.framebuffer)}}class Nl{constructor(t){var i,c;if(this.gl=t,this.clearColor=new Cl(this),this.clearDepth=new kl(this),this.clearStencil=new Dl(this),this.colorMask=new uu(this),this.depthMask=new Wa(this),this.stencilMask=new vs(this),this.stencilFunc=new ko(this),this.stencilOp=new fi(this),this.stencilTest=new lp(this),this.depthRange=new cp(this),this.depthTest=new hu(this),this.depthFunc=new Ha(this),this.blend=new Ll(this),this.blendFunc=new Rl(this),this.blendColor=new xs(this),this.blendEquation=new zl(this),this.cullFace=new up(this),this.cullFaceSide=new Do(this),this.frontFace=new Lo(this),this.program=new hp(this),this.activeTexture=new pu(this),this.viewport=new Vt(this),this.bindFramebuffer=new Fl(this),this.bindRenderbuffer=new Ef(this),this.bindTexture=new pp(this),this.bindVertexBuffer=new bs(this),this.bindElementBuffer=new Pf(this),this.bindVertexArray=new Mf(this),this.pixelStoreUnpack=new dp(this),this.pixelStoreUnpackPremultiplyAlpha=new If(this),this.pixelStoreUnpackFlipY=new du(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),di(t)){this.HALF_FLOAT=t.HALF_FLOAT;const p=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(i=t.RGBA16F)!==null&&i!==void 0?i:p==null?void 0:p.RGBA16F_EXT,this.RGB16F=(c=t.RGB16F)!==null&&c!==void 0?c:p==null?void 0:p.RGB16F_EXT,t.getExtension("EXT_color_buffer_float")}else{t.getExtension("EXT_color_buffer_half_float"),t.getExtension("OES_texture_half_float_linear");const p=t.getExtension("OES_texture_half_float");this.HALF_FLOAT=p==null?void 0:p.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(t,i){return new Tf(this,t,i)}createVertexBuffer(t,i,c){return new Sf(this,t,i,c)}createRenderbuffer(t,i,c){const p=this.gl,g=p.createRenderbuffer();return this.bindRenderbuffer.set(g),p.renderbufferStorage(p.RENDERBUFFER,t,i,c),this.bindRenderbuffer.set(null),g}createFramebuffer(t,i,c,p){return new Bl(this,t,i,c,p)}clear({color:t,depth:i,stencil:c}){const p=this.gl;let g=0;t&&(g|=p.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),i!==void 0&&(g|=p.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(i),this.depthMask.set(!0)),c!==void 0&&(g|=p.STENCIL_BUFFER_BIT,this.clearStencil.set(c),this.stencilMask.set(255)),p.clear(g)}setCullFace(t){t.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){s.bR(t.blendFunction,_r.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}createVertexArray(){var t;return di(this.gl)?this.gl.createVertexArray():(t=this.gl.getExtension("OES_vertex_array_object"))===null||t===void 0?void 0:t.createVertexArrayOES()}deleteVertexArray(t){var i;return di(this.gl)?this.gl.deleteVertexArray(t):(i=this.gl.getExtension("OES_vertex_array_object"))===null||i===void 0?void 0:i.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null)}}let va;function Xa(m,t,i,c,p){const g=m.context,b=m.transform,S=g.gl,P=m.useProgram("collisionBox"),A=[];let k=0,F=0;for(let K=0;K<c.length;K++){const oe=c[K],de=t.getTile(oe).getBucket(i);if(!de)continue;const ie=p?de.textCollisionBox:de.iconCollisionBox,he=de.collisionCircleArray;he.length>0&&(A.push({circleArray:he,circleOffset:F,coord:oe}),k+=he.length/4,F=k),ie&&P.draw(g,S.LINES,Ft.disabled,rr.disabled,m.colorModeForRenderPass(),Qt.disabled,Ga(m.transform),m.style.map.terrain&&m.style.map.terrain.getTerrainData(oe),b.getProjectionData({overscaledTileID:oe,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),i.id,ie.layoutVertexBuffer,ie.indexBuffer,ie.segments,null,m.transform.zoom,null,null,ie.collisionVertexBuffer)}if(!p||!A.length)return;const z=m.useProgram("collisionCircle"),j=new s.ca;j.resize(4*k),j._trim();let G=0;for(const K of A)for(let oe=0;oe<K.circleArray.length/4;oe++){const de=4*oe,ie=K.circleArray[de+0],he=K.circleArray[de+1],ge=K.circleArray[de+2],ce=K.circleArray[de+3];j.emplace(G++,ie,he,ge,ce,0),j.emplace(G++,ie,he,ge,ce,1),j.emplace(G++,ie,he,ge,ce,2),j.emplace(G++,ie,he,ge,ce,3)}(!va||va.length<2*k)&&(va=(function(K){const oe=2*K,de=new s.cc;de.resize(oe),de._trim();for(let ie=0;ie<oe;ie++){const he=6*ie;de.uint16[he+0]=4*ie+0,de.uint16[he+1]=4*ie+1,de.uint16[he+2]=4*ie+2,de.uint16[he+3]=4*ie+2,de.uint16[he+4]=4*ie+3,de.uint16[he+5]=4*ie+0}return de})(k));const Y=g.createIndexBuffer(va,!0),Q=g.createVertexBuffer(j,s.cb.members,!0);for(const K of A){const oe=tp(m.transform);z.draw(g,S.TRIANGLES,Ft.disabled,rr.disabled,m.colorModeForRenderPass(),Qt.disabled,oe,m.style.map.terrain&&m.style.map.terrain.getTerrainData(K.coord),null,i.id,Q,Y,s.aX.simpleSegment(0,2*K.circleOffset,K.circleArray.length,K.circleArray.length/2),null,m.transform.zoom,null,null,null)}Q.destroy(),Y.destroy()}const gu=s.ar(new Float32Array(16));function Af(m,t,i,c,p,g){const{horizontalAlign:b,verticalAlign:S}=s.aS(m);return new s.P((-(b-.5)*t/p+c[0])*g,(-(S-.5)*i/p+c[1])*g)}function Ts(m,t,i,c,p,g){const b=t.tileAnchorPoint.add(new s.P(t.translation[0],t.translation[1]));if(t.pitchWithMap){let S=c.mult(g);i||(S=S.rotate(-p));const P=b.add(S);return zt(P.x,P.y,t.pitchedLabelPlaneMatrix,t.getElevation).point}if(i){const S=hr(t.tileAnchorPoint.x+1,t.tileAnchorPoint.y,t).point.sub(m),P=Math.atan(S.y/S.x)+(S.x<0?Math.PI:0);return m.add(c.rotate(P))}return m.add(c)}function Cf(m,t,i,c,p,g,b,S,P,A,k,F){const z=m.text.placedSymbolArray,j=m.text.dynamicLayoutVertexArray,G=m.icon.dynamicLayoutVertexArray,Y={};j.clear();for(let Q=0;Q<z.length;Q++){const K=z.get(Q),oe=K.hidden||!K.crossTileID||m.allowVerticalPlacement&&!K.placedOrientation?null:c[K.crossTileID];if(oe){const de=new s.P(K.anchorX,K.anchorY),ie={getElevation:F,width:p.width,height:p.height,pitchedLabelPlaneMatrix:g,pitchWithMap:i,transform:p,tileAnchorPoint:de,translation:A,unwrappedTileID:k},he=i?yo(de.x,de.y,ie):hr(de.x,de.y,ie),ge=as(p.cameraToCenterDistance,he.signedDistanceFromCamera);let ce=s.aA(m.textSizeData,S,K)*ge/s.aM;i&&(ce*=m.tilePixelRatio/b);const{width:ve,height:Fe,anchor:Ce,textOffset:ke,textBoxScale:Le}=oe,Xe=Af(Ce,ve,Fe,ke,Le,ce),Ke=p.getPitchedTextCorrection(de.x+A[0],de.y+A[1],k),qe=Ts(he.point,ie,t,Xe,-p.bearingInRadians,Ke),tt=m.allowVerticalPlacement&&K.placedOrientation===s.az.vertical?Math.PI/2:0;for(let Ct=0;Ct<K.numGlyphs;Ct++)s.aG(j,qe,tt);P&&K.associatedIconIndex>=0&&(Y[K.associatedIconIndex]={shiftedAnchor:qe,angle:tt})}else Na(K.numGlyphs,j)}if(P){G.clear();const Q=m.icon.placedSymbolArray;for(let K=0;K<Q.length;K++){const oe=Q.get(K);if(oe.hidden)Na(oe.numGlyphs,G);else{const de=Y[K];if(de)for(let ie=0;ie<oe.numGlyphs;ie++)s.aG(G,de.shiftedAnchor,de.angle);else Na(oe.numGlyphs,G)}}m.icon.dynamicLayoutVertexBuffer.updateData(G)}m.text.dynamicLayoutVertexBuffer.updateData(j)}function fp(m,t,i){return i.iconsInText&&t?"symbolTextAndIcon":m?"symbolSDF":"symbolIcon"}function Ss(m,t,i,c,p,g,b,S,P,A,k,F,z){const j=m.context,G=j.gl,Y=m.transform,Q=S==="map",K=P==="map",oe=S!=="viewport"&&i.layout.get("symbol-placement")!=="point",de=Q&&!K&&!oe,ie=!i.layout.get("symbol-sort-key").isConstant();let he=!1;const ge=m.getDepthModeForSublayer(0,Ft.ReadOnly),ce=i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"),ve=[],Fe=Y.getCircleRadiusCorrection();for(const Ce of c){const ke=t.getTile(Ce),Le=ke.getBucket(i);if(!Le)continue;const Xe=p?Le.text:Le.icon;if(!Xe||!Xe.segments.get().length||!Xe.hasVisibleVertices)continue;const Ke=Xe.programConfigurations.get(i.id),qe=p||Le.sdfIcons,tt=p?Le.textSizeData:Le.iconSizeData,Ct=K||Y.pitch!==0,cr=m.useProgram(fp(qe,p,Le),Ke),Pr=s.ay(tt,Y.zoom),vr=m.style.map.terrain&&m.style.map.terrain.getTerrainData(Ce);let Ar,xr,jr,Cr,xn=[0,0],tn=null;if(p)xr=ke.glyphAtlasTexture,jr=G.LINEAR,Ar=ke.glyphAtlasTexture.size,Le.iconsInText&&(xn=ke.imageAtlasTexture.size,tn=ke.imageAtlasTexture,Cr=Ct||m.options.rotating||m.options.zooming||tt.kind==="composite"||tt.kind==="camera"?G.LINEAR:G.NEAREST);else{const Tr=i.layout.get("icon-size").constantOr(0)!==1||Le.iconsNeedLinear;xr=ke.imageAtlasTexture,jr=qe||m.options.rotating||m.options.zooming||Tr||Ct?G.LINEAR:G.NEAREST,Ar=ke.imageAtlasTexture.size}const Hr=s.aN(ke,1,m.transform.zoom),An=ri(Q,m.transform,Hr),Sa=s.N();s.aB(Sa,An);const ta=gl(K,Q,m.transform,Hr),qi=s.aO(Y,ke,g,b),Kn=Y.getProjectionData({overscaledTileID:Ce,applyGlobeMatrix:!z,applyTerrainMatrix:!0}),to=ce&&Le.hasTextData(),qs=i.layout.get("icon-text-fit")!=="none"&&to&&Le.hasIconData();if(oe){const Tr=m.style.map.terrain?(mn,gn)=>m.style.map.terrain.getElevation(Ce,mn,gn):null,br=i.layout.get("text-rotation-alignment")==="map";yl(Le,m,p,An,Sa,K,A,br,Ce.toUnwrapped(),Y.width,Y.height,qi,Tr)}const ro=p&&ce||qs,yi=oe||ro?gu:K?An:m.transform.clipSpaceToPixelsMatrix,Gi=qe&&i.paint.get(p?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Ii;Ii=qe?Le.iconsInText?Za(tt.kind,Pr,de,K,oe,ro,m,yi,ta,qi,Ar,xn,Fe):Al(tt.kind,Pr,de,K,oe,ro,m,yi,ta,qi,p,Ar,0,Fe):lu(tt.kind,Pr,de,K,oe,ro,m,yi,ta,qi,p,Ar,Fe);const Ai={program:cr,buffers:Xe,uniformValues:Ii,projectionData:Kn,atlasTexture:xr,atlasTextureIcon:tn,atlasInterpolation:jr,atlasInterpolationIcon:Cr,isSDF:qe,hasHalo:Gi};if(ie&&Le.canOverlap){he=!0;const Tr=Xe.segments.get();for(const br of Tr)ve.push({segments:new s.aX([br]),sortKey:br.sortKey,state:Ai,terrainData:vr})}else ve.push({segments:Xe.segments,sortKey:0,state:Ai,terrainData:vr})}he&&ve.sort(((Ce,ke)=>Ce.sortKey-ke.sortKey));for(const Ce of ve){const ke=Ce.state;if(j.activeTexture.set(G.TEXTURE0),ke.atlasTexture.bind(ke.atlasInterpolation,G.CLAMP_TO_EDGE),ke.atlasTextureIcon&&(j.activeTexture.set(G.TEXTURE1),ke.atlasTextureIcon&&ke.atlasTextureIcon.bind(ke.atlasInterpolationIcon,G.CLAMP_TO_EDGE)),ke.isSDF){const Le=ke.uniformValues;ke.hasHalo&&(Le.u_is_halo=1,jl(ke.buffers,Ce.segments,i,m,ke.program,ge,k,F,Le,ke.projectionData,Ce.terrainData)),Le.u_is_halo=0}jl(ke.buffers,Ce.segments,i,m,ke.program,ge,k,F,ke.uniformValues,ke.projectionData,Ce.terrainData)}}function jl(m,t,i,c,p,g,b,S,P,A,k){const F=c.context;p.draw(F,F.gl.TRIANGLES,g,b,S,Qt.backCCW,P,k,A,i.id,m.layoutVertexBuffer,m.indexBuffer,t,i.paint,c.transform.zoom,m.programConfigurations.get(i.id),m.dynamicLayoutVertexBuffer,m.opacityVertexBuffer)}function mp(m,t,i,c,p){const g=m.context,b=g.gl,S=rr.disabled,P=new _r([b.ONE,b.ONE],s.bp.transparent,[!0,!0,!0,!0]),A=t.getBucket(i);if(!A)return;const k=c.key;let F=i.heatmapFbos.get(k);F||(F=Es(g,t.tileSize,t.tileSize),i.heatmapFbos.set(k,F)),g.bindFramebuffer.set(F.framebuffer),g.viewport.set([0,0,t.tileSize,t.tileSize]),g.clear({color:s.bp.transparent});const z=A.programConfigurations.get(i.id),j=m.useProgram("heatmap",z,!p),G=m.transform.getProjectionData({overscaledTileID:t.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),Y=m.style.map.terrain.getTerrainData(c);j.draw(g,b.TRIANGLES,Ft.disabled,S,P,Qt.disabled,Co(t,m.transform.zoom,i.paint.get("heatmap-intensity"),1),Y,G,i.id,A.layoutVertexBuffer,A.indexBuffer,A.segments,i.paint,m.transform.zoom,z)}function gp(m,t,i,c,p){const g=m.context,b=g.gl,S=m.transform;g.setColorMode(m.colorModeForRenderPass());const P=Vl(g,t),A=i.key,k=t.heatmapFbos.get(A);if(!k)return;g.activeTexture.set(b.TEXTURE0),b.bindTexture(b.TEXTURE_2D,k.colorAttachment.get()),g.activeTexture.set(b.TEXTURE1),P.bind(b.LINEAR,b.CLAMP_TO_EDGE);const F=S.getProjectionData({overscaledTileID:i,applyTerrainMatrix:p,applyGlobeMatrix:!c});m.useProgram("heatmapTexture").draw(g,b.TRIANGLES,Ft.disabled,rr.disabled,m.colorModeForRenderPass(),Qt.disabled,rp(m,t,0,1),null,F,t.id,m.rasterBoundsBuffer,m.quadTriangleIndexBuffer,m.rasterBoundsSegments,t.paint,S.zoom),k.destroy(),t.heatmapFbos.delete(A)}function Es(m,t,i){var c,p;const g=m.gl,b=g.createTexture();g.bindTexture(g.TEXTURE_2D,b),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_S,g.CLAMP_TO_EDGE),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_T,g.CLAMP_TO_EDGE),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MIN_FILTER,g.LINEAR),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MAG_FILTER,g.LINEAR);const S=(c=m.HALF_FLOAT)!==null&&c!==void 0?c:g.UNSIGNED_BYTE,P=(p=m.RGBA16F)!==null&&p!==void 0?p:g.RGBA;g.texImage2D(g.TEXTURE_2D,0,P,t,i,0,g.RGBA,S,null);const A=m.createFramebuffer(t,i,!1,!1);return A.colorAttachment.set(b),A}function Vl(m,t){return t.colorRampTexture||(t.colorRampTexture=new s.T(m,t.colorRamp,m.gl.RGBA)),t.colorRampTexture}function yp(m,t,i,c,p,g,b,S){let P=256;if(p.stepInterpolant){const A=t.getSource().maxzoom,k=b.canonical.z===A?Math.ceil(1<<m.transform.maxZoom-b.canonical.z):1;P=s.an(s.ce(g.maxLineLength/s.a5*1024*k),256,i.maxTextureSize)}return S.gradient=s.cf({expression:p.gradientExpression(),evaluationKey:"lineProgress",resolution:P,image:S.gradient||void 0,clips:g.lineClipsArray}),S.texture?S.texture.update(S.gradient):S.texture=new s.T(i,S.gradient,c.RGBA),S.version=p.gradientVersion,S.texture}function _p(m,t,i,c,p){m.activeTexture.set(t.TEXTURE0),i.imageAtlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE),c.updatePaintBuffers(p)}function Zr(m,t,i,c,p,g){(p||m.lineAtlas.dirty)&&(t.activeTexture.set(i.TEXTURE0),m.lineAtlas.bind(t)),c.updatePaintBuffers(g)}function Ya(m,t,i,c,p,g,b){const S=g.gradients[p.id];let P=S.texture;p.gradientVersion!==S.version&&(P=yp(m,t,i,c,p,g,b,S)),i.activeTexture.set(c.TEXTURE0),P.bind(p.stepInterpolant?c.NEAREST:c.LINEAR,c.CLAMP_TO_EDGE)}function ii(m,t,i,c,p,g,b,S,P){const A=g.gradients[p.id];let k=A.texture;p.gradientVersion!==A.version&&(k=yp(m,t,i,c,p,g,b,A)),i.activeTexture.set(c.TEXTURE0),k.bind(p.stepInterpolant?c.NEAREST:c.LINEAR,c.CLAMP_TO_EDGE),i.activeTexture.set(c.TEXTURE1),m.lineAtlas.bind(i),S.updatePaintBuffers(P)}function Ul(m,t,i,c,p){if(!i||!c||!c.imageAtlas)return;const g=c.imageAtlas.patternPositions;let b=g[i.to.toString()],S=g[i.from.toString()];if(!b&&S&&(b=S),!S&&b&&(S=b),!b||!S){const P=p.getPaintProperty(t);b=g[P],S=g[P]}b&&S&&m.setConstantPatternPositions(b,S)}function Ps(m,t,i,c,p,g,b,S){const P=m.context.gl,A="fill-pattern",k=i.paint.get(A),F=k&&k.constantOr(1),z=i.getCrossfadeParameters();let j,G,Y,Q,K;const oe=m.transform,de=i.paint.get("fill-translate"),ie=i.paint.get("fill-translate-anchor");b?(G=F&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",j=P.LINES):(G=F?"fillPattern":"fill",j=P.TRIANGLES);const he=k.constantOr(null);for(const ge of c){const ce=t.getTile(ge);if(F&&!ce.patternsLoaded())continue;const ve=ce.getBucket(i);if(!ve)continue;const Fe=ve.programConfigurations.get(i.id),Ce=m.useProgram(G,Fe),ke=m.style.map.terrain&&m.style.map.terrain.getTerrainData(ge);F&&(m.context.activeTexture.set(P.TEXTURE0),ce.imageAtlasTexture.bind(P.LINEAR,P.CLAMP_TO_EDGE),Fe.updatePaintBuffers(z)),Ul(Fe,A,he,ce,i);const Le=oe.getProjectionData({overscaledTileID:ge,applyGlobeMatrix:!S,applyTerrainMatrix:!0}),Xe=s.aO(oe,ce,de,ie);if(b){Q=ve.indexBuffer2,K=ve.segments2;const qe=[P.drawingBufferWidth,P.drawingBufferHeight];Y=G==="fillOutlinePattern"&&F?Qh(m,z,ce,qe,Xe):Jh(qe,Xe)}else Q=ve.indexBuffer,K=ve.segments,Y=F?nu(m,z,ce,Xe):{u_fill_translate:Xe};const Ke=m.stencilModeForClipping(ge);Ce.draw(m.context,j,p,Ke,g,Qt.backCCW,Y,ke,Le,i.id,ve.layoutVertexBuffer,Q,K,i.paint,m.transform.zoom,Fe)}}function $l(m,t,i,c,p,g,b,S){const P=m.context,A=P.gl,k="fill-extrusion-pattern",F=i.paint.get(k),z=F.constantOr(1),j=i.getCrossfadeParameters(),G=i.paint.get("fill-extrusion-opacity"),Y=F.constantOr(null),Q=m.transform;for(const K of c){const oe=t.getTile(K),de=oe.getBucket(i);if(!de)continue;const ie=m.style.map.terrain&&m.style.map.terrain.getTerrainData(K),he=de.programConfigurations.get(i.id),ge=m.useProgram(z?"fillExtrusionPattern":"fillExtrusion",he);z&&(m.context.activeTexture.set(A.TEXTURE0),oe.imageAtlasTexture.bind(A.LINEAR,A.CLAMP_TO_EDGE),he.updatePaintBuffers(j));const ce=Q.getProjectionData({overscaledTileID:K,applyGlobeMatrix:!S,applyTerrainMatrix:!0});Ul(he,k,Y,oe,i);const ve=s.aO(Q,oe,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),Fe=i.paint.get("fill-extrusion-vertical-gradient"),Ce=z?ru(m,Fe,G,ve,K,j,oe):tu(m,Fe,G,ve);ge.draw(P,P.gl.TRIANGLES,p,g,b,Qt.backCCW,Ce,ie,ce,i.id,de.layoutVertexBuffer,de.indexBuffer,de.segments,i.paint,m.transform.zoom,he,m.style.map.terrain&&de.centroidVertexBuffer)}}function xa(m,t,i,c,p,g,b,S,P){var A;const k=m.style.projection,F=m.context,z=m.transform,j=F.gl,G=[`#define NUM_ILLUMINATION_SOURCES ${i.paint.get("hillshade-highlight-color").values.length}`],Y=m.useProgram("hillshade",null,!1,G),Q=!m.options.moving;for(const K of c){const oe=t.getTile(K),de=oe.fbo;if(!de)continue;const ie=k.getMeshFromTileID(F,K.canonical,S,!0,"raster"),he=(A=m.style.map.terrain)===null||A===void 0?void 0:A.getTerrainData(K);F.activeTexture.set(j.TEXTURE0),j.bindTexture(j.TEXTURE_2D,de.colorAttachment.get());const ge=z.getProjectionData({overscaledTileID:K,aligned:Q,applyGlobeMatrix:!P,applyTerrainMatrix:!0});Y.draw(F,j.TRIANGLES,g,p[K.overscaledZ],b,Qt.backCCW,Pl(m,oe,i),he,ge,i.id,ie.vertexBuffer,ie.indexBuffer,ie.segments)}}function Ms(m,t,i,c,p,g,b,S,P){var A;const k=m.style.projection,F=m.context,z=m.transform,j=F.gl,G=m.useProgram("colorRelief"),Y=!m.options.moving;let Q=!0,K=0;for(const oe of c){const de=t.getTile(oe),ie=de.dem;if(Q){const Ce=j.getParameter(j.MAX_TEXTURE_SIZE),{elevationTexture:ke,colorTexture:Le}=i.getColorRampTextures(F,Ce,ie.getUnpackVector());F.activeTexture.set(j.TEXTURE1),ke.bind(j.NEAREST,j.CLAMP_TO_EDGE),F.activeTexture.set(j.TEXTURE4),Le.bind(j.LINEAR,j.CLAMP_TO_EDGE),Q=!1,K=ke.size[0]}if(!ie||!ie.data)continue;const he=ie.stride,ge=ie.getPixels();if(F.activeTexture.set(j.TEXTURE0),F.pixelStoreUnpackPremultiplyAlpha.set(!1),de.demTexture=de.demTexture||m.getTileTexture(he),de.demTexture){const Ce=de.demTexture;Ce.update(ge,{premultiply:!1}),Ce.bind(j.LINEAR,j.CLAMP_TO_EDGE)}else de.demTexture=new s.T(F,ge,j.RGBA,{premultiply:!1}),de.demTexture.bind(j.LINEAR,j.CLAMP_TO_EDGE);const ce=k.getMeshFromTileID(F,oe.canonical,S,!0,"raster"),ve=(A=m.style.map.terrain)===null||A===void 0?void 0:A.getTerrainData(oe),Fe=z.getProjectionData({overscaledTileID:oe,aligned:Y,applyGlobeMatrix:!P,applyTerrainMatrix:!0});G.draw(F,j.TRIANGLES,g,p[oe.overscaledZ],b,Qt.backCCW,np(i,de.dem,K),ve,Fe,i.id,ce.vertexBuffer,ce.indexBuffer,ce.segments)}}const Ka=[new s.P(0,0),new s.P(s.a5,0),new s.P(s.a5,s.a5),new s.P(0,s.a5)];function zo(m,t,i,c,p,g,b,S,P=!1,A=!1){const k=c[c.length-1].overscaledZ,F=m.context,z=F.gl,j=m.useProgram("raster"),G=m.transform,Y=m.style.projection,Q=m.colorModeForRenderPass(),K=!m.options.moving,oe=i.paint.get("raster-opacity"),de=i.paint.get("raster-resampling"),ie=i.paint.get("raster-fade-duration"),he=!!m.style.map.terrain;for(const ge of c){const ce=m.getDepthModeForSublayer(ge.overscaledZ-k,oe===1?Ft.ReadWrite:Ft.ReadOnly,z.LESS),ve=t.getTile(ge),Fe=de==="nearest"?z.NEAREST:z.LINEAR;F.activeTexture.set(z.TEXTURE0),ve.texture.bind(Fe,z.CLAMP_TO_EDGE,z.LINEAR_MIPMAP_NEAREST),F.activeTexture.set(z.TEXTURE1);const{parentTile:Ce,parentScaleBy:ke,parentTopLeft:Le,fadeValues:Xe}=vp(ve,t,ie,he);ve.fadeOpacity=Xe.tileOpacity,Ce?(Ce.fadeOpacity=Xe.parentTileOpacity,Ce.texture.bind(Fe,z.CLAMP_TO_EDGE,z.LINEAR_MIPMAP_NEAREST)):ve.texture.bind(Fe,z.CLAMP_TO_EDGE,z.LINEAR_MIPMAP_NEAREST),ve.texture.useMipmap&&F.extTextureFilterAnisotropic&&m.transform.pitch>20&&z.texParameterf(z.TEXTURE_2D,F.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,F.extTextureFilterAnisotropicMax);const Ke=m.style.map.terrain&&m.style.map.terrain.getTerrainData(ge),qe=G.getProjectionData({overscaledTileID:ge,aligned:K,applyGlobeMatrix:!A,applyTerrainMatrix:!0}),tt=ou(Le,ke,Xe.fadeMix,i,S),Ct=Y.getMeshFromTileID(F,ge.canonical,g,b,"raster");j.draw(F,z.TRIANGLES,ce,p?p[ge.overscaledZ]:rr.disabled,Q,P?Qt.frontCCW:Qt.backCCW,tt,Ke,qe,i.id,Ct.vertexBuffer,Ct.indexBuffer,Ct.segments)}}function vp(m,t,i,c){const p={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(i===0||c)return p;if(m.fadingParentID){const g=t.getLoadedTile(m.fadingParentID);if(!g)return p;const b=Math.pow(2,g.tileID.overscaledZ-m.tileID.overscaledZ),S=[m.tileID.canonical.x*b%1,m.tileID.canonical.y*b%1],P=(function(A,k,F){const z=fe(),j=(z-k.timeAdded)/F,G=A.fadingDirection===be.Incoming,Y=s.an((z-A.timeAdded)/F,0,1),Q=s.an(1-j,0,1),K=G?Y:Q;return{tileOpacity:K,parentTileOpacity:G?Q:Y,fadeMix:{opacity:1,mix:1-K}}})(m,g,i);return{parentTile:g,parentScaleBy:b,parentTopLeft:S,fadeValues:P}}if(m.selfFading){const g=(function(b,S){const P=(fe()-b.timeAdded)/S,A=s.an(P,0,1);return{tileOpacity:A,fadeMix:{opacity:A,mix:0}}})(m,i);return{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:g}}return p}const xp=new s.bp(1,0,0,1),bp=new s.bp(0,1,0,1),wp=new s.bp(0,0,1,1),Tp=new s.bp(1,0,1,1),ba=new s.bp(0,1,1,1);function yu(m,t,i,c){Is(m,0,t+i/2,m.transform.width,i,c)}function _u(m,t,i,c){Is(m,t-i/2,0,i,m.transform.height,c)}function Is(m,t,i,c,p,g){const b=m.context,S=b.gl;S.enable(S.SCISSOR_TEST),S.scissor(t*m.pixelRatio,i*m.pixelRatio,c*m.pixelRatio,p*m.pixelRatio),b.clear({color:g}),S.disable(S.SCISSOR_TEST)}function Sp(m,t,i){const c=m.context,p=c.gl,g=m.useProgram("debug"),b=Ft.disabled,S=rr.disabled,P=m.colorModeForRenderPass(),A="$debug",k=m.style.map.terrain&&m.style.map.terrain.getTerrainData(i);c.activeTexture.set(p.TEXTURE0);const F=t.getTileByID(i.key).latestRawTileData,z=Math.floor((F&&F.byteLength||0)/1024),j=t.getTile(i).tileSize,G=512/Math.min(j,512)*(i.overscaledZ/m.transform.zoom)*.5;let Y=i.canonical.toString();i.overscaledZ!==i.canonical.z&&(Y+=` => ${i.overscaledZ}`),(function(K,oe){K.initDebugOverlayCanvas();const de=K.debugOverlayCanvas,ie=K.context.gl,he=K.debugOverlayCanvas.getContext("2d");he.clearRect(0,0,de.width,de.height),he.shadowColor="white",he.shadowBlur=2,he.lineWidth=1.5,he.strokeStyle="white",he.textBaseline="top",he.font="bold 36px Open Sans, sans-serif",he.fillText(oe,5,5),he.strokeText(oe,5,5),K.debugOverlayTexture.update(de),K.debugOverlayTexture.bind(ie.LINEAR,ie.CLAMP_TO_EDGE)})(m,`${Y} ${z}kB`);const Q=m.transform.getProjectionData({overscaledTileID:i,applyGlobeMatrix:!0,applyTerrainMatrix:!0});g.draw(c,p.TRIANGLES,b,S,_r.alphaBlended,Qt.disabled,iu(s.bp.transparent,G),null,Q,A,m.debugBuffer,m.quadTriangleIndexBuffer,m.debugSegments),g.draw(c,p.LINE_STRIP,b,S,P,Qt.disabled,iu(s.bp.red),k,Q,A,m.debugBuffer,m.tileBorderIndexBuffer,m.debugSegments)}function vu(m,t,i,c){const{isRenderingGlobe:p}=c,g=m.context,b=g.gl,S=m.transform,P=m.colorModeForRenderPass(),A=m.getDepthModeFor3D(),k=m.useProgram("terrain");g.bindFramebuffer.set(null),g.viewport.set([0,0,m.width,m.height]);for(const F of i){const z=t.getTerrainMesh(F.tileID),j=m.renderToTexture.getTexture(F),G=t.getTerrainData(F.tileID);g.activeTexture.set(b.TEXTURE0),b.bindTexture(b.TEXTURE_2D,j.texture);const Y=t.getMeshFrameDelta(S.zoom),Q=S.calculateFogMatrix(F.tileID.toUnwrapped()),K=_f(Y,Q,m.style.sky,S.pitch,p),oe=S.getProjectionData({overscaledTileID:F.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});k.draw(g,b.TRIANGLES,A,rr.disabled,P,Qt.backCCW,K,G,oe,"terrain",z.vertexBuffer,z.indexBuffer,z.segments)}}function xu(m,t){if(!t.mesh){const i=new s.aW;i.emplaceBack(-1,-1),i.emplaceBack(1,-1),i.emplaceBack(1,1),i.emplaceBack(-1,1);const c=new s.aY;c.emplaceBack(0,1,2),c.emplaceBack(0,2,3),t.mesh=new yr(m.createVertexBuffer(i,ga.members),m.createIndexBuffer(c),s.aX.simpleSegment(0,0,i.length,c.length))}return t.mesh}class Ep{constructor(t,i){this.context=new Nl(t),this.transform=i,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:s.ar(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=pi.maxOverzooming+pi.maxUnderzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Xn}resize(t,i,c){if(this.width=Math.floor(t*c),this.height=Math.floor(i*c),this.pixelRatio=c,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const p of this.style._order)this.style._layers[p].resize()}setup(){const t=this.context,i=new s.aW;i.emplaceBack(0,0),i.emplaceBack(s.a5,0),i.emplaceBack(0,s.a5),i.emplaceBack(s.a5,s.a5),this.tileExtentBuffer=t.createVertexBuffer(i,ga.members),this.tileExtentSegments=s.aX.simpleSegment(0,0,4,2);const c=new s.aW;c.emplaceBack(0,0),c.emplaceBack(s.a5,0),c.emplaceBack(0,s.a5),c.emplaceBack(s.a5,s.a5),this.debugBuffer=t.createVertexBuffer(c,ga.members),this.debugSegments=s.aX.simpleSegment(0,0,4,5);const p=new s.ch;p.emplaceBack(0,0,0,0),p.emplaceBack(s.a5,0,s.a5,0),p.emplaceBack(0,s.a5,0,s.a5),p.emplaceBack(s.a5,s.a5,s.a5,s.a5),this.rasterBoundsBuffer=t.createVertexBuffer(p,yf.members),this.rasterBoundsSegments=s.aX.simpleSegment(0,0,4,2);const g=new s.aW;g.emplaceBack(0,0),g.emplaceBack(s.a5,0),g.emplaceBack(0,s.a5),g.emplaceBack(s.a5,s.a5),this.rasterBoundsBufferPosOnly=t.createVertexBuffer(g,ga.members),this.rasterBoundsSegmentsPosOnly=s.aX.simpleSegment(0,0,4,5);const b=new s.aW;b.emplaceBack(0,0),b.emplaceBack(1,0),b.emplaceBack(0,1),b.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(b,ga.members),this.viewportSegments=s.aX.simpleSegment(0,0,4,2);const S=new s.ci;S.emplaceBack(0),S.emplaceBack(1),S.emplaceBack(3),S.emplaceBack(2),S.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(S);const P=new s.aY;P.emplaceBack(1,0,2),P.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(P);const A=this.context.gl;this.stencilClearMode=new rr({func:A.ALWAYS,mask:0},0,255,A.ZERO,A.ZERO,A.ZERO),this.tileExtentMesh=new yr(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){const t=this.context,i=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const c=s.N();s.c7(c,0,this.width,this.height,0,0,1),s.Q(c,c,[i.drawingBufferWidth,i.drawingBufferHeight,0]);const p={mainMatrix:c,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:c};this.useProgram("clippingMask",null,!0).draw(t,i.TRIANGLES,Ft.disabled,this.stencilClearMode,_r.disabled,Qt.disabled,null,null,p,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,i,c){if(this.currentStencilSource===t.source||!t.isTileClipped()||!i||!i.length)return;this.currentStencilSource=t.source,this.nextStencilID+i.length>256&&this.clearStencil();const p=this.context;p.setColorMode(_r.disabled),p.setDepthMode(Ft.disabled);const g={};for(const b of i)g[b.key]=this.nextStencilID++;this._renderTileMasks(g,i,c,!0),this._renderTileMasks(g,i,c,!1),this._tileClippingMaskIDs=g}_renderTileMasks(t,i,c,p){const g=this.context,b=g.gl,S=this.style.projection,P=this.transform,A=this.useProgram("clippingMask");for(const k of i){const F=t[k.key],z=this.style.map.terrain&&this.style.map.terrain.getTerrainData(k),j=S.getMeshFromTileID(this.context,k.canonical,p,!0,"stencil"),G=P.getProjectionData({overscaledTileID:k,applyGlobeMatrix:!c,applyTerrainMatrix:!0});A.draw(g,b.TRIANGLES,Ft.disabled,new rr({func:b.ALWAYS,mask:0},F,255,b.KEEP,b.KEEP,b.REPLACE),_r.disabled,c?Qt.disabled:Qt.backCCW,null,z,G,"$clipping",j.vertexBuffer,j.indexBuffer,j.segments)}}_renderTilesDepthBuffer(){const t=this.context,i=t.gl,c=this.style.projection,p=this.transform,g=this.useProgram("depth"),b=this.getDepthModeFor3D(),S=Or(p,{tileSize:p.tileSize});for(const P of S){const A=this.style.map.terrain&&this.style.map.terrain.getTerrainData(P),k=c.getMeshFromTileID(this.context,P.canonical,!0,!0,"raster"),F=p.getProjectionData({overscaledTileID:P,applyGlobeMatrix:!0,applyTerrainMatrix:!0});g.draw(t,i.TRIANGLES,b,rr.disabled,_r.disabled,Qt.backCCW,null,A,F,"$clipping",k.vertexBuffer,k.indexBuffer,k.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,i=this.context.gl;return new rr({func:i.NOTEQUAL,mask:255},t,255,i.KEEP,i.KEEP,i.REPLACE)}stencilModeForClipping(t){const i=this.context.gl;return new rr({func:i.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,i.KEEP,i.KEEP,i.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(t){const i=this.context.gl,c=t.sort(((b,S)=>S.overscaledZ-b.overscaledZ)),p=c[c.length-1].overscaledZ,g=c[0].overscaledZ-p+1;if(g>1){this.currentStencilSource=void 0,this.nextStencilID+g>256&&this.clearStencil();const b={};for(let S=0;S<g;S++)b[S+p]=new rr({func:i.GEQUAL,mask:255},S+this.nextStencilID,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID+=g,[b,c]}return[{[p]:rr.disabled},c]}stencilConfigForOverlapTwoPass(t){const i=this.context.gl,c=t.sort(((b,S)=>S.overscaledZ-b.overscaledZ)),p=c[c.length-1].overscaledZ,g=c[0].overscaledZ-p+1;if(this.clearStencil(),g>1){const b={},S={};for(let P=0;P<g;P++)b[P+p]=new rr({func:i.GREATER,mask:255},g+1+P,255,i.KEEP,i.KEEP,i.REPLACE),S[P+p]=new rr({func:i.GREATER,mask:255},1+P,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID=2*g+1,[b,S,c]}return this.nextStencilID=3,[{[p]:new rr({func:i.GREATER,mask:255},2,255,i.KEEP,i.KEEP,i.REPLACE)},{[p]:new rr({func:i.GREATER,mask:255},1,255,i.KEEP,i.KEEP,i.REPLACE)},c]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new _r([t.CONSTANT_COLOR,t.ONE],new s.bp(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?_r.unblended:_r.alphaBlended}getDepthModeForSublayer(t,i,c){if(!this.opaquePassEnabledForLayer())return Ft.disabled;const p=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new Ft(c||this.context.gl.LEQUAL,i,[p,p])}getDepthModeFor3D(){return new Ft(this.context.gl.LEQUAL,Ft.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,i){var c,p;this.style=t,this.options=i,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(fe()),this.imageManager.beginFrame();const g=this.style._order,b=this.style.tileManagers,S={},P={},A={},k={isRenderingToTexture:!1,isRenderingGlobe:((c=t.projection)===null||c===void 0?void 0:c.transitionState)>0};for(const z in b){const j=b[z];j.used&&j.prepare(this.context),S[z]=j.getVisibleCoordinates(!1),P[z]=S[z].slice().reverse(),A[z]=j.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let z=0;z<g.length;z++)if(this.style._layers[g[z]].is3D()){this.opaquePassCutoff=z;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const z of g){const j=this.style._layers[z];if(!j.hasOffscreenPass()||j.isHidden(this.transform.zoom))continue;const G=P[j.source];(j.type==="custom"||G.length)&&this.renderLayer(this,b[j.source],j,G,k)}if((p=this.style.projection)===null||p===void 0||p.updateGPUdependent({context:this.context,useProgram:z=>this.useProgram(z)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:i.showOverdrawInspector?s.bp.black:s.bp.transparent,depth:1}),this.clearStencil(),this.style.sky&&(function(z,j){const G=z.context,Y=G.gl,Q=((ge,ce,ve)=>{const Fe=Math.cos(ce.rollInRadians),Ce=Math.sin(ce.rollInRadians),ke=At(ce),Le=ce.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:ge.properties.get("sky-color"),u_horizon_color:ge.properties.get("horizon-color"),u_horizon:[(ce.width/2-ke*Ce)*ve,(ce.height/2+ke*Fe)*ve],u_horizon_normal:[-Ce,Fe],u_sky_horizon_blend:ge.properties.get("sky-horizon-blend")*ce.height/2*ve,u_sky_blend:Le}})(j,z.style.map.transform,z.pixelRatio),K=new Ft(Y.LEQUAL,Ft.ReadWrite,[0,1]),oe=rr.disabled,de=z.colorModeForRenderPass(),ie=z.useProgram("sky"),he=xu(G,j);ie.draw(G,Y.TRIANGLES,K,oe,de,Qt.disabled,Q,null,void 0,"sky",he.vertexBuffer,he.indexBuffer,he.segments)})(this,this.style.sky),this._showOverdrawInspector=i.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=g.length-1;this.currentLayer>=0;this.currentLayer--){const z=this.style._layers[g[this.currentLayer]],j=b[z.source],G=S[z.source];this._renderTileClippingMasks(z,G,!1),this.renderLayer(this,j,z,G,k)}this.renderPass="translucent";let F=!1;for(this.currentLayer=0;this.currentLayer<g.length;this.currentLayer++){const z=this.style._layers[g[this.currentLayer]],j=b[z.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(z,k))continue;this.opaquePassEnabledForLayer()||F||(F=!0,k.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const G=(z.type==="symbol"?A:P)[z.source];this._renderTileClippingMasks(z,S[z.source],!!this.renderToTexture),this.renderLayer(this,j,z,G,k)}if(k.isRenderingGlobe&&(function(z,j,G){const Y=z.context,Q=Y.gl,K=z.useProgram("atmosphere"),oe=new Ft(Q.LEQUAL,Ft.ReadOnly,[0,1]),de=z.transform,ie=(function(Le,Xe){const Ke=Le.properties.get("position"),qe=[-Ke.x,-Ke.y,-Ke.z],tt=s.ar(new Float64Array(16));return Le.properties.get("anchor")==="map"&&(s.bg(tt,tt,Xe.rollInRadians),s.bh(tt,tt,-Xe.pitchInRadians),s.bg(tt,tt,Xe.bearingInRadians),s.bh(tt,tt,Xe.center.lat*Math.PI/180),s.bJ(tt,tt,-Xe.center.lng*Math.PI/180)),s.cg(qe,qe,tt),qe})(G,z.transform),he=de.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),ge=j.properties.get("atmosphere-blend")*he.projectionTransition;if(ge===0)return;const ce=$a(de.worldSize,de.center.lat),ve=de.inverseProjectionMatrix,Fe=new Float64Array(4);Fe[3]=1,s.aH(Fe,Fe,de.modelViewProjectionMatrix),Fe[0]/=Fe[3],Fe[1]/=Fe[3],Fe[2]/=Fe[3],Fe[3]=1,s.aH(Fe,Fe,ve),Fe[0]/=Fe[3],Fe[1]/=Fe[3],Fe[2]/=Fe[3],Fe[3]=1;const Ce=((Le,Xe,Ke,qe,tt)=>({u_sun_pos:Le,u_atmosphere_blend:Xe,u_globe_position:Ke,u_globe_radius:qe,u_inv_proj_matrix:tt}))(ie,ge,[Fe[0],Fe[1],Fe[2]],ce,ve),ke=xu(Y,j);K.draw(Y,Q.TRIANGLES,oe,rr.disabled,_r.alphaBlended,Qt.disabled,Ce,null,null,"atmosphere",ke.vertexBuffer,ke.indexBuffer,ke.segments)})(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const z=(function(j,G){let Y=null;const Q=Object.values(j._layers).flatMap((ie=>ie.source&&!ie.isHidden(G)?[j.tileManagers[ie.source]]:[])),K=Q.filter((ie=>ie.getSource().type==="vector")),oe=Q.filter((ie=>ie.getSource().type!=="vector")),de=ie=>{(!Y||Y.getSource().maxzoom<ie.getSource().maxzoom)&&(Y=ie)};return K.forEach((ie=>de(ie))),Y||oe.forEach((ie=>de(ie))),Y})(this.style,this.transform.zoom);z&&(function(j,G,Y){for(let Q=0;Q<Y.length;Q++)Sp(j,G,Y[Q])})(this,z,z.getVisibleCoordinates())}this.options.showPadding&&(function(z){const j=z.transform.padding;yu(z,z.transform.height-(j.top||0),3,xp),yu(z,j.bottom||0,3,bp),_u(z,j.left||0,3,wp),_u(z,z.transform.width-(j.right||0),3,Tp);const G=z.transform.centerPoint;(function(Y,Q,K,oe){Is(Y,Q-1,K-10,2,20,oe),Is(Y,Q-10,K-1,20,2,oe)})(z,G.x,z.transform.height-G.y,ba)})(this),this.context.setDefault()}maybeDrawDepthAndCoords(t){if(!this.style||!this.style.map||!this.style.map.terrain)return;const i=this.terrainFacilitator.matrix,c=this.transform.modelViewProjectionMatrix;let p=this.terrainFacilitator.dirty;p||(p=t?!s.cj(i,c):!s.ck(i,c)),p||(p=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime)),p&&(s.cl(i,c),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,(function(g,b){const S=g.context,P=S.gl,A=g.transform,k=_r.unblended,F=new Ft(P.LEQUAL,Ft.ReadWrite,[0,1]),z=b.tileManager.getRenderableTiles(),j=g.useProgram("terrainDepth");S.bindFramebuffer.set(b.getFramebuffer("depth").framebuffer),S.viewport.set([0,0,g.width/devicePixelRatio,g.height/devicePixelRatio]),S.clear({color:s.bp.transparent,depth:1});for(const G of z){const Y=b.getTerrainMesh(G.tileID),Q=b.getTerrainData(G.tileID),K=A.getProjectionData({overscaledTileID:G.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),oe={u_ele_delta:b.getMeshFrameDelta(A.zoom)};j.draw(S,P.TRIANGLES,F,rr.disabled,k,Qt.backCCW,oe,Q,K,"terrain",Y.vertexBuffer,Y.indexBuffer,Y.segments)}S.bindFramebuffer.set(null),S.viewport.set([0,0,g.width,g.height])})(this,this.style.map.terrain),(function(g,b){const S=g.context,P=S.gl,A=g.transform,k=_r.unblended,F=new Ft(P.LEQUAL,Ft.ReadWrite,[0,1]),z=b.getCoordsTexture(),j=b.tileManager.getRenderableTiles(),G=g.useProgram("terrainCoords");S.bindFramebuffer.set(b.getFramebuffer("coords").framebuffer),S.viewport.set([0,0,g.width/devicePixelRatio,g.height/devicePixelRatio]),S.clear({color:s.bp.transparent,depth:1}),b.coordsIndex=[];for(const Y of j){const Q=b.getTerrainMesh(Y.tileID),K=b.getTerrainData(Y.tileID);S.activeTexture.set(P.TEXTURE0),P.bindTexture(P.TEXTURE_2D,z.texture);const oe={u_terrain_coords_id:(255-b.coordsIndex.length)/255,u_texture:0,u_ele_delta:b.getMeshFrameDelta(A.zoom)},de=A.getProjectionData({overscaledTileID:Y.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});G.draw(S,P.TRIANGLES,F,rr.disabled,k,Qt.backCCW,oe,K,de,"terrain",Q.vertexBuffer,Q.indexBuffer,Q.segments),b.coordsIndex.push(Y.tileID.key)}S.bindFramebuffer.set(null),S.viewport.set([0,0,g.width,g.height])})(this,this.style.map.terrain))}renderLayer(t,i,c,p,g){c.isHidden(this.transform.zoom)||(c.type==="background"||c.type==="custom"||(p||[]).length)&&(this.id=c.id,s.cm(c)?(function(b,S,P,A,k,F){if(b.renderPass!=="translucent")return;const{isRenderingToTexture:z}=F,j=rr.disabled,G=b.colorModeForRenderPass();(P._unevaluatedLayout.hasValue("text-variable-anchor")||P._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&(function(Y,Q,K,oe,de,ie,he,ge,ce){const ve=Q.transform,Fe=Q.style.map.terrain,Ce=de==="map",ke=ie==="map";for(const Le of Y){const Xe=oe.getTile(Le),Ke=Xe.getBucket(K);if(!Ke||!Ke.text||!Ke.text.segments.get().length)continue;const qe=s.ay(Ke.textSizeData,ve.zoom),tt=s.aN(Xe,1,Q.transform.zoom),Ct=ri(Ce,Q.transform,tt),cr=K.layout.get("icon-text-fit")!=="none"&&Ke.hasIconData();if(qe){const Pr=Math.pow(2,ve.zoom-Xe.tileID.overscaledZ),vr=Fe?(Ar,xr)=>Fe.getElevation(Le,Ar,xr):null;Cf(Ke,Ce,ke,ce,ve,Ct,Pr,qe,cr,s.aO(ve,Xe,he,ge),Le.toUnwrapped(),vr)}}})(A,b,P,S,P.layout.get("text-rotation-alignment"),P.layout.get("text-pitch-alignment"),P.paint.get("text-translate"),P.paint.get("text-translate-anchor"),k),P.paint.get("icon-opacity").constantOr(1)!==0&&Ss(b,S,P,A,!1,P.paint.get("icon-translate"),P.paint.get("icon-translate-anchor"),P.layout.get("icon-rotation-alignment"),P.layout.get("icon-pitch-alignment"),P.layout.get("icon-keep-upright"),j,G,z),P.paint.get("text-opacity").constantOr(1)!==0&&Ss(b,S,P,A,!0,P.paint.get("text-translate"),P.paint.get("text-translate-anchor"),P.layout.get("text-rotation-alignment"),P.layout.get("text-pitch-alignment"),P.layout.get("text-keep-upright"),j,G,z),S.map.showCollisionBoxes&&(Xa(b,S,P,A,!0),Xa(b,S,P,A,!1))})(t,i,c,p,this.style.placement.variableOffsets,g):s.cn(c)?(function(b,S,P,A,k){if(b.renderPass!=="translucent")return;const{isRenderingToTexture:F}=k,z=P.paint.get("circle-opacity"),j=P.paint.get("circle-stroke-width"),G=P.paint.get("circle-stroke-opacity"),Y=!P.layout.get("circle-sort-key").isConstant();if(z.constantOr(1)===0&&(j.constantOr(1)===0||G.constantOr(1)===0))return;const Q=b.context,K=Q.gl,oe=b.transform,de=b.getDepthModeForSublayer(0,Ft.ReadOnly),ie=rr.disabled,he=b.colorModeForRenderPass(),ge=[],ce=oe.getCircleRadiusCorrection();for(let ve=0;ve<A.length;ve++){const Fe=A[ve],Ce=S.getTile(Fe),ke=Ce.getBucket(P);if(!ke)continue;const Le=P.paint.get("circle-translate"),Xe=P.paint.get("circle-translate-anchor"),Ke=s.aO(oe,Ce,Le,Xe),qe=ke.programConfigurations.get(P.id),tt=b.useProgram("circle",qe),Ct=ke.layoutVertexBuffer,cr=ke.indexBuffer,Pr=b.style.map.terrain&&b.style.map.terrain.getTerrainData(Fe),vr={programConfiguration:qe,program:tt,layoutVertexBuffer:Ct,indexBuffer:cr,uniformValues:ep(b,Ce,P,Ke,ce),terrainData:Pr,projectionData:oe.getProjectionData({overscaledTileID:Fe,applyGlobeMatrix:!F,applyTerrainMatrix:!0})};if(Y){const Ar=ke.segments.get();for(const xr of Ar)ge.push({segments:new s.aX([xr]),sortKey:xr.sortKey,state:vr})}else ge.push({segments:ke.segments,sortKey:0,state:vr})}Y&&ge.sort(((ve,Fe)=>ve.sortKey-Fe.sortKey));for(const ve of ge){const{programConfiguration:Fe,program:Ce,layoutVertexBuffer:ke,indexBuffer:Le,uniformValues:Xe,terrainData:Ke,projectionData:qe}=ve.state;Ce.draw(Q,K.TRIANGLES,de,ie,he,Qt.backCCW,Xe,Ke,qe,P.id,ke,Le,ve.segments,P.paint,b.transform.zoom,Fe)}})(t,i,c,p,g):s.co(c)?(function(b,S,P,A,k){if(P.paint.get("heatmap-opacity")===0)return;const F=b.context,{isRenderingToTexture:z,isRenderingGlobe:j}=k;if(b.style.map.terrain){for(const G of A){const Y=S.getTile(G);S.hasRenderableParent(G)||(b.renderPass==="offscreen"?mp(b,Y,P,G,j):b.renderPass==="translucent"&&gp(b,P,G,z,j))}F.viewport.set([0,0,b.width,b.height])}else b.renderPass==="offscreen"?(function(G,Y,Q,K){const oe=G.context,de=oe.gl,ie=G.transform,he=rr.disabled,ge=new _r([de.ONE,de.ONE],s.bp.transparent,[!0,!0,!0,!0]);(function(ce,ve,Fe){const Ce=ce.gl;ce.activeTexture.set(Ce.TEXTURE1),ce.viewport.set([0,0,ve.width/4,ve.height/4]);let ke=Fe.heatmapFbos.get(s.cd);ke?(Ce.bindTexture(Ce.TEXTURE_2D,ke.colorAttachment.get()),ce.bindFramebuffer.set(ke.framebuffer)):(ke=Es(ce,ve.width/4,ve.height/4),Fe.heatmapFbos.set(s.cd,ke))})(oe,G,Q),oe.clear({color:s.bp.transparent});for(let ce=0;ce<K.length;ce++){const ve=K[ce];if(Y.hasRenderableParent(ve))continue;const Fe=Y.getTile(ve),Ce=Fe.getBucket(Q);if(!Ce)continue;const ke=Ce.programConfigurations.get(Q.id),Le=G.useProgram("heatmap",ke),Xe=ie.getProjectionData({overscaledTileID:ve,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),Ke=ie.getCircleRadiusCorrection();Le.draw(oe,de.TRIANGLES,Ft.disabled,he,ge,Qt.backCCW,Co(Fe,ie.zoom,Q.paint.get("heatmap-intensity"),Ke),null,Xe,Q.id,Ce.layoutVertexBuffer,Ce.indexBuffer,Ce.segments,Q.paint,ie.zoom,ke)}oe.viewport.set([0,0,G.width,G.height])})(b,S,P,A):b.renderPass==="translucent"&&(function(G,Y){const Q=G.context,K=Q.gl;Q.setColorMode(G.colorModeForRenderPass());const oe=Y.heatmapFbos.get(s.cd);oe&&(Q.activeTexture.set(K.TEXTURE0),K.bindTexture(K.TEXTURE_2D,oe.colorAttachment.get()),Q.activeTexture.set(K.TEXTURE1),Vl(Q,Y).bind(K.LINEAR,K.CLAMP_TO_EDGE),G.useProgram("heatmapTexture").draw(Q,K.TRIANGLES,Ft.disabled,rr.disabled,G.colorModeForRenderPass(),Qt.disabled,rp(G,Y,0,1),null,null,Y.id,G.viewportBuffer,G.quadTriangleIndexBuffer,G.viewportSegments,Y.paint,G.transform.zoom))})(b,P)})(t,i,c,p,g):s.cp(c)?(function(b,S,P,A,k){if(b.renderPass!=="translucent")return;const{isRenderingToTexture:F}=k,z=P.paint.get("line-opacity"),j=P.paint.get("line-width");if(z.constantOr(1)===0||j.constantOr(1)===0)return;const G=b.getDepthModeForSublayer(0,Ft.ReadOnly),Y=b.colorModeForRenderPass(),Q=P.paint.get("line-dasharray"),K=Q.constantOr(1),oe=P.paint.get("line-pattern"),de=oe.constantOr(1),ie=P.paint.get("line-gradient"),he=P.getCrossfadeParameters();let ge;ge=de?"linePattern":K&&ie?"lineGradientSDF":K?"lineSDF":ie?"lineGradient":"line";const ce=b.context,ve=ce.gl,Fe=b.transform;let Ce=!0;for(const ke of A){const Le=S.getTile(ke);if(de&&!Le.patternsLoaded())continue;const Xe=Le.getBucket(P);if(!Xe)continue;const Ke=Xe.programConfigurations.get(P.id),qe=b.context.program.get(),tt=b.useProgram(ge,Ke),Ct=Ce||tt.program!==qe,cr=b.style.map.terrain&&b.style.map.terrain.getTerrainData(ke),Pr=oe.constantOr(null),vr=Q&&Q.constantOr(null);if(Pr&&Le.imageAtlas){const xn=Le.imageAtlas,tn=xn.patternPositions[Pr.to.toString()],Hr=xn.patternPositions[Pr.from.toString()];tn&&Hr&&Ke.setConstantPatternPositions(tn,Hr)}else if(vr){const xn=P.layout.get("line-cap")==="round",tn=b.lineAtlas.getDash(vr.to,xn),Hr=b.lineAtlas.getDash(vr.from,xn);Ke.setConstantDashPositions(tn,Hr)}const Ar=Fe.getProjectionData({overscaledTileID:ke,applyGlobeMatrix:!F,applyTerrainMatrix:!0}),xr=Fe.getPixelScale();let jr;de?(jr=au(b,Le,P,xr,he),_p(ce,ve,Le,Ke,he)):K&&ie?(jr=Ml(b,Le,P,xr,he,Xe.lineClipsArray.length),ii(b,S,ce,ve,P,Xe,ke,Ke,he)):K?(jr=ap(b,Le,P,xr,he),Zr(b,ce,ve,Ke,Ct,he)):ie?(jr=ip(b,Le,P,xr,Xe.lineClipsArray.length),Ya(b,S,ce,ve,P,Xe,ke)):jr=_s(b,Le,P,xr);const Cr=b.stencilModeForClipping(ke);tt.draw(ce,ve.TRIANGLES,G,Cr,Y,Qt.disabled,jr,cr,Ar,P.id,Xe.layoutVertexBuffer,Xe.indexBuffer,Xe.segments,P.paint,b.transform.zoom,Ke,Xe.layoutVertexBuffer2),Ce=!1}})(t,i,c,p,g):s.cq(c)?(function(b,S,P,A,k){const F=P.paint.get("fill-color"),z=P.paint.get("fill-opacity");if(z.constantOr(1)===0)return;const{isRenderingToTexture:j}=k,G=b.colorModeForRenderPass(),Y=P.paint.get("fill-pattern"),Q=b.opaquePassEnabledForLayer()&&!Y.constantOr(1)&&F.constantOr(s.bp.transparent).a===1&&z.constantOr(0)===1?"opaque":"translucent";if(b.renderPass===Q){const K=b.getDepthModeForSublayer(1,b.renderPass==="opaque"?Ft.ReadWrite:Ft.ReadOnly);Ps(b,S,P,A,K,G,!1,j)}if(b.renderPass==="translucent"&&P.paint.get("fill-antialias")){const K=b.getDepthModeForSublayer(P.getPaintProperty("fill-outline-color")?2:0,Ft.ReadOnly);Ps(b,S,P,A,K,G,!0,j)}})(t,i,c,p,g):s.cr(c)?(function(b,S,P,A,k){const F=P.paint.get("fill-extrusion-opacity");if(F===0)return;const{isRenderingToTexture:z}=k;if(b.renderPass==="translucent"){const j=new Ft(b.context.gl.LEQUAL,Ft.ReadWrite,b.depthRangeFor3D);if(F!==1||P.paint.get("fill-extrusion-pattern").constantOr(1))$l(b,S,P,A,j,rr.disabled,_r.disabled,z),$l(b,S,P,A,j,b.stencilModeFor3D(),b.colorModeForRenderPass(),z);else{const G=b.colorModeForRenderPass();$l(b,S,P,A,j,rr.disabled,G,z)}}})(t,i,c,p,g):s.cs(c)?(function(b,S,P,A,k){if(b.renderPass!=="offscreen"&&b.renderPass!=="translucent")return;const{isRenderingToTexture:F}=k,z=b.context,j=b.style.projection.useSubdivision,G=b.getDepthModeForSublayer(0,Ft.ReadOnly),Y=b.colorModeForRenderPass();if(b.renderPass==="offscreen")(function(Q,K,oe,de,ie,he,ge){const ce=Q.context,ve=ce.gl;for(const Fe of oe){const Ce=K.getTile(Fe),ke=Ce.dem;if(!ke||!ke.data||!Ce.needsHillshadePrepare)continue;const Le=ke.dim,Xe=ke.stride,Ke=ke.getPixels();if(ce.activeTexture.set(ve.TEXTURE1),ce.pixelStoreUnpackPremultiplyAlpha.set(!1),Ce.demTexture=Ce.demTexture||Q.getTileTexture(Xe),Ce.demTexture){const tt=Ce.demTexture;tt.update(Ke,{premultiply:!1}),tt.bind(ve.NEAREST,ve.CLAMP_TO_EDGE)}else Ce.demTexture=new s.T(ce,Ke,ve.RGBA,{premultiply:!1}),Ce.demTexture.bind(ve.NEAREST,ve.CLAMP_TO_EDGE);ce.activeTexture.set(ve.TEXTURE0);let qe=Ce.fbo;if(!qe){const tt=new s.T(ce,{width:Le,height:Le,data:null},ve.RGBA);tt.bind(ve.LINEAR,ve.CLAMP_TO_EDGE),qe=Ce.fbo=ce.createFramebuffer(Le,Le,!0,!1),qe.colorAttachment.set(tt.texture)}ce.bindFramebuffer.set(qe.framebuffer),ce.viewport.set([0,0,Le,Le]),Q.useProgram("hillshadePrepare").draw(ce,ve.TRIANGLES,ie,he,ge,Qt.disabled,vf(Ce.tileID,ke),null,null,de.id,Q.rasterBoundsBuffer,Q.quadTriangleIndexBuffer,Q.rasterBoundsSegments),Ce.needsHillshadePrepare=!1}})(b,S,A,P,G,rr.disabled,Y),z.viewport.set([0,0,b.width,b.height]);else if(b.renderPass==="translucent")if(j){const[Q,K,oe]=b.stencilConfigForOverlapTwoPass(A);xa(b,S,P,oe,Q,G,Y,!1,F),xa(b,S,P,oe,K,G,Y,!0,F)}else{const[Q,K]=b.getStencilConfigForOverlapAndUpdateStencilID(A);xa(b,S,P,K,Q,G,Y,!1,F)}})(t,i,c,p,g):s.ct(c)?(function(b,S,P,A,k){if(b.renderPass!=="translucent"||!A.length)return;const{isRenderingToTexture:F}=k,z=b.style.projection.useSubdivision,j=b.getDepthModeForSublayer(0,Ft.ReadOnly),G=b.colorModeForRenderPass();if(z){const[Y,Q,K]=b.stencilConfigForOverlapTwoPass(A);Ms(b,S,P,K,Y,j,G,!1,F),Ms(b,S,P,K,Q,j,G,!0,F)}else{const[Y,Q]=b.getStencilConfigForOverlapAndUpdateStencilID(A);Ms(b,S,P,Q,Y,j,G,!1,F)}})(t,i,c,p,g):s.bU(c)?(function(b,S,P,A,k){if(b.renderPass!=="translucent"||P.paint.get("raster-opacity")===0||!A.length)return;const{isRenderingToTexture:F}=k,z=S.getSource(),j=b.style.projection.useSubdivision;if(z instanceof on)zo(b,S,P,A,null,!1,!1,z.tileCoords,z.flippedWindingOrder,F);else if(j){const[G,Y,Q]=b.stencilConfigForOverlapTwoPass(A);zo(b,S,P,Q,G,!1,!0,Ka,!1,F),zo(b,S,P,Q,Y,!0,!0,Ka,!1,F)}else{const[G,Y]=b.getStencilConfigForOverlapAndUpdateStencilID(A);zo(b,S,P,Y,G,!1,!0,Ka,!1,F)}})(t,i,c,p,g):s.cu(c)?(function(b,S,P,A,k){const F=P.paint.get("background-color"),z=P.paint.get("background-opacity");if(z===0)return;const{isRenderingToTexture:j}=k,G=b.context,Y=G.gl,Q=b.style.projection,K=b.transform,oe=K.tileSize,de=P.paint.get("background-pattern");if(b.isPatternMissing(de))return;const ie=!de&&F.a===1&&z===1&&b.opaquePassEnabledForLayer()?"opaque":"translucent";if(b.renderPass!==ie)return;const he=rr.disabled,ge=b.getDepthModeForSublayer(0,ie==="opaque"?Ft.ReadWrite:Ft.ReadOnly),ce=b.colorModeForRenderPass(),ve=b.useProgram(de?"backgroundPattern":"background"),Fe=A||Or(K,{tileSize:oe,terrain:b.style.map.terrain});de&&(G.activeTexture.set(Y.TEXTURE0),b.imageManager.bind(b.context));const Ce=P.getCrossfadeParameters();for(const ke of Fe){const Le=K.getProjectionData({overscaledTileID:ke,applyGlobeMatrix:!j,applyTerrainMatrix:!0}),Xe=de?bf(z,b,de,{tileID:ke,tileSize:oe},Ce):cu(z,F),Ke=b.style.map.terrain&&b.style.map.terrain.getTerrainData(ke),qe=Q.getMeshFromTileID(G,ke.canonical,!1,!0,"raster");ve.draw(G,Y.TRIANGLES,ge,he,ce,Qt.backCCW,Xe,Ke,Le,P.id,qe.vertexBuffer,qe.indexBuffer,qe.segments)}})(t,0,c,p,g):s.cv(c)&&(function(b,S,P,A){const{isRenderingGlobe:k}=A,F=b.context,z=P.implementation,j=b.style.projection,G=b.transform,Y=G.getProjectionDataForCustomLayer(k),Q={farZ:G.farZ,nearZ:G.nearZ,fov:G.fov*Math.PI/180,modelViewProjectionMatrix:G.modelViewProjectionMatrix,projectionMatrix:G.projectionMatrix,shaderData:{variantName:j.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;
810uniform mat4 u_projection_matrix;
811${j.shaderPreludeCode.vertexSource}`,define:j.shaderDefine},defaultProjectionData:Y},K=z.renderingMode?z.renderingMode:"2d";if(b.renderPass==="offscreen"){const oe=z.prerender;oe&&(b.setCustomLayerDefaults(),F.setColorMode(b.colorModeForRenderPass()),oe.call(z,F.gl,Q),F.setDirty(),b.setBaseState())}else if(b.renderPass==="translucent"){b.setCustomLayerDefaults(),F.setColorMode(b.colorModeForRenderPass()),F.setStencilMode(rr.disabled);const oe=K==="3d"?b.getDepthModeFor3D():b.getDepthModeForSublayer(0,Ft.ReadOnly);F.setDepthMode(oe),z.render(F.gl,Q),F.setDirty(),b.setBaseState(),F.bindFramebuffer.set(null)}})(t,0,c,g))}saveTileTexture(t){const i=this._tileTextures[t.size[0]];i?i.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const i=this._tileTextures[t];return i&&i.length>0?i.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const i=this.imageManager.getPattern(t.from.toString()),c=this.imageManager.getPattern(t.to.toString());return!i||!c}useProgram(t,i,c=!1,p=[]){this.cache=this.cache||{};const g=!!this.style.map.terrain,b=this.style.projection,S=c?Rr.projectionMercator:b.shaderPreludeCode,P=c?Vn:b.shaderDefine,A=t+(i?i.cacheKey:"")+`/${c?ni:b.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(g?"/terrain":"")+(p?`/${p.join("/")}`:"");return this.cache[A]||(this.cache[A]=new Yh(this.context,Rr[t],i,wf[t],this._showOverdrawInspector,g,S,P,p)),this.cache[A]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new s.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){var t,i;if(this._tileTextures){for(const c in this._tileTextures){const p=this._tileTextures[c];if(p)for(const g of p)g.destroy()}this._tileTextures={}}if(this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&((t=this.tileExtentMesh.vertexBuffer)===null||t===void 0||t.destroy()),this.tileExtentMesh&&((i=this.tileExtentMesh.indexBuffer)===null||i===void 0||i.destroy()),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.cache){for(const c in this.cache){const p=this.cache[c];p&&p.program&&this.context.gl.deleteProgram(p.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:i}=this.context.gl;return this.width!==t||this.height!==i}}function bu(m,t){let i,c=!1,p=null,g=null;const b=()=>{p=null,c&&(m.apply(g,i),p=setTimeout(b,t),c=!1)};return(...S)=>(c=!0,g=this,i=S,p||b(),p)}class wu{constructor(t){this._getCurrentHash=()=>{const i=window.location.hash.replace("#","");if(this._hashName){let c;return i.split("&").map((p=>p.split("="))).forEach((p=>{p[0]===this._hashName&&(c=p)})),(c&&c[1]||"").split("/")}return i.split("/")},this._onHashChange=()=>{const i=this._getCurrentHash();if(!this._isValidHash(i))return!1;const c=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:c,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 c=i.join("/");let p=c;p.split("&").length>0&&(p=p.split("&")[0]),this._hashName&&(p=`${this._hashName}=${c}`);let g=window.location.hash.replace(p,"");g.startsWith("#&")?g=g.slice(0,1)+g.slice(2):g==="#"&&(g="");let b=window.location.href.replace(/(#.+)?$/,g);b=b.replace("&&","&"),window.history.replaceState(window.history.state,null,b)},this._updateHash=bu(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,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(t){const i=this._map.getCenter(),c=Math.round(100*this._map.getZoom())/100,p=Math.ceil((c*Math.LN2+Math.log(512/360/.5))/Math.LN10),g=Math.pow(10,p),b=Math.round(i.lng*g)/g,S=Math.round(i.lat*g)/g,P=this._map.getBearing(),A=this._map.getPitch();let k="";if(k+=t?`/${b}/${S}/${c}`:`${c}/${S}/${b}`,(P||A)&&(k+="/"+Math.round(10*P)/10),A&&(k+=`/${Math.round(A)}`),this._hashName){const F=this._hashName;let z=!1;const j=window.location.hash.slice(1).split("&").map((G=>{const Y=G.split("=")[0];return Y===F?(z=!0,`${Y}=${k}`):G})).filter((G=>G));return z||j.push(`${F}=${k}`),`#${j.join("&")}`}return`#${k}`}_isValidHash(t){if(t.length<3||t.some(isNaN))return!1;try{new s.V(+t[2],+t[1])}catch{return!1}const i=+t[0],c=+(t[3]||0),p=+(t[4]||0);return i>=this._map.getMinZoom()&&i<=this._map.getMaxZoom()&&c>=-180&&c<=180&&p>=this._map.getMinPitch()&&p<=this._map.getMaxPitch()}}const wa={linearity:.3,easing:s.cw(0,0,.3,1)},Pp=s.e({deceleration:2500,maxSpeed:1400},wa),mi=s.e({deceleration:20,maxSpeed:1400},wa),Si=s.e({deceleration:1e3,maxSpeed:360},wa),Mp=s.e({deceleration:1e3,maxSpeed:90},wa),Ei=s.e({deceleration:1e3,maxSpeed:360},wa);class kf{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:fe(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,i=fe();for(;t.length>0&&i-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,roll:0,pan:new s.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:g}of this._inertiaBuffer)i.zoom+=g.zoomDelta||0,i.bearing+=g.bearingDelta||0,i.pitch+=g.pitchDelta||0,i.roll+=g.rollDelta||0,g.panDelta&&i.pan._add(g.panDelta),g.around&&(i.around=g.around),g.pinchAround&&(i.pinchAround=g.pinchAround);const c=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,p={};if(i.pan.mag()){const g=Cs(i.pan.mag(),c,s.e({},Pp,t||{})),b=i.pan.mult(g.amount/i.pan.mag()),S=this._map.cameraHelper.handlePanInertia(b,this._map.transform);p.center=S.easingCenter,p.offset=S.easingOffset,As(p,g)}if(i.zoom){const g=Cs(i.zoom,c,mi);p.zoom=this._map.transform.zoom+g.amount,As(p,g)}if(i.bearing){const g=Cs(i.bearing,c,Si);p.bearing=this._map.transform.bearing+s.an(g.amount,-179,179),As(p,g)}if(i.pitch){const g=Cs(i.pitch,c,Mp);p.pitch=this._map.transform.pitch+g.amount,As(p,g)}if(i.roll){const g=Cs(i.roll,c,Ei);p.roll=this._map.transform.roll+s.an(g.amount,-179,179),As(p,g)}if(p.zoom||p.bearing){const g=i.pinchAround===void 0?i.around:i.pinchAround;p.around=g?this._map.unproject(g):this._map.getCenter()}return this.clear(),s.e(p,{noMoveStart:!0})}}function As(m,t){(!m.duration||m.duration<t.duration)&&(m.duration=t.duration,m.easing=t.easing)}function Cs(m,t,i){const{maxSpeed:c,linearity:p,deceleration:g}=i,b=s.an(m*p/(t/1e3),-c,c),S=Math.abs(b)/(g*p);return{easing:i.easing,duration:1e3*S,amount:b*(S/2)}}class vn extends s.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,i,c,p={}){c=c instanceof MouseEvent?c:new MouseEvent(t,c);const g=te.mousePos(i.getCanvas(),c),b=i.unproject(g);super(t,s.e({point:g,lngLat:b,originalEvent:c},p)),this._defaultPrevented=!1,this.target=i}}class ks extends s.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,i,c){const p=t==="touchend"?c.changedTouches:c.touches,g=te.touchPos(i.getCanvasContainer(),p),b=g.map((P=>i.unproject(P))),S=g.reduce(((P,A,k,F)=>P.add(A.div(F.length))),new s.P(0,0));super(t,{points:g,point:S,lngLats:b,lngLat:i.unproject(S),originalEvent:c}),this._defaultPrevented=!1}}class Ip extends s.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,i,c){super(t,{originalEvent:c}),this._defaultPrevented=!1}}class Df{constructor(t,i){this._map=t,this._clickTolerance=i.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new Ip(t.type,this._map,t))}mousedown(t,i){return this._mousedownPos=i,this._firePreventable(new vn(t.type,this._map,t))}mouseup(t){this._map.fire(new vn(t.type,this._map,t))}click(t,i){this._mousedownPos&&this._mousedownPos.dist(i)>=this._clickTolerance||this._map.fire(new vn(t.type,this._map,t))}dblclick(t){return this._firePreventable(new vn(t.type,this._map,t))}mouseover(t){this._map.fire(new vn(t.type,this._map,t))}mouseout(t){this._map.fire(new vn(t.type,this._map,t))}touchstart(t){return this._firePreventable(new ks(t.type,this._map,t))}touchmove(t){this._map.fire(new ks(t.type,this._map,t))}touchend(t){this._map.fire(new ks(t.type,this._map,t))}touchcancel(t){this._map.fire(new ks(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Lf{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new vn(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new vn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new vn(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Fo{constructor(t){this._map=t}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(t){return this.transform.screenPointToLocation(s.P.convert(t),this._map.terrain)}}class Oo{constructor(t,i){this._map=t,this._tr=new Fo(t),this._el=t.getCanvasContainer(),this._container=t.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(t,i){this.isEnabled()&&t.shiftKey&&t.button===0&&(te.disableDrag(),this._startPos=this._lastPos=i,this._active=!0)}mousemoveWindow(t,i){if(!this._active)return;const c=i;if(this._lastPos.equals(c)||!this._box&&c.dist(this._startPos)<this._clickTolerance)return;const p=this._startPos;this._lastPos=c,this._box||(this._box=te.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const g=Math.min(p.x,c.x),b=Math.max(p.x,c.x),S=Math.min(p.y,c.y),P=Math.max(p.y,c.y);te.setTransform(this._box,`translate(${g}px,${S}px)`),this._box.style.width=b-g+"px",this._box.style.height=P-S+"px"}mouseupWindow(t,i){if(!this._active||t.button!==0)return;const c=this._startPos,p=i;if(this.reset(),te.suppressClick(),c.x!==p.x||c.y!==p.y)return this._map.fire(new s.l("boxzoomend",{originalEvent:t})),{cameraAnimation:g=>g.fitScreenCoordinates(c,p,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(te.remove(this._box),this._box=null),te.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,i){return this._map.fire(new s.l(t,{originalEvent:i}))}}function Pi(m,t){if(m.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${m.length}, points ${t.length}`);const i={};for(let c=0;c<m.length;c++)i[m[c].identifier]=t[c];return i}class ht{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,i,c){(this.centroid||c.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),c.length===this.numTouches&&(this.centroid=(function(p){const g=new s.P(0,0);for(const b of p)g._add(b);return g.div(p.length)})(i),this.touches=Pi(c,i)))}touchmove(t,i,c){if(this.aborted||!this.centroid)return;const p=Pi(c,i);for(const g in this.touches){const b=p[g];(!b||b.dist(this.touches[g])>30)&&(this.aborted=!0)}}touchend(t,i,c){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),c.length===0){const p=!this.aborted&&this.centroid;if(this.reset(),p)return p}}}class ql{constructor(t){this.singleTap=new ht(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,i,c){this.singleTap.touchstart(t,i,c)}touchmove(t,i,c){this.singleTap.touchmove(t,i,c)}touchend(t,i,c){const p=this.singleTap.touchend(t,i,c);if(p){const g=t.timeStamp-this.lastTime<500,b=!this.lastTap||this.lastTap.dist(p)<30;if(g&&b||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=p,this.count===this.numTaps)return this.reset(),p}}}class Tu{constructor(t){this._tr=new Fo(t),this._zoomIn=new ql({numTouches:1,numTaps:2}),this._zoomOut=new ql({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,i,c){this._zoomIn.touchstart(t,i,c),this._zoomOut.touchstart(t,i,c)}touchmove(t,i,c){this._zoomIn.touchmove(t,i,c),this._zoomOut.touchmove(t,i,c)}touchend(t,i,c){const p=this._zoomIn.touchend(t,i,c),g=this._zoomOut.touchend(t,i,c),b=this._tr;return p?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:S=>S.easeTo({duration:300,zoom:b.zoom+1,around:b.unproject(p)},{originalEvent:t})}):g?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:S=>S.easeTo({duration:300,zoom:b.zoom-1,around:b.unproject(g)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Bo{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){const i=this._moveFunction(...t);if(i.bearingDelta||i.pitchDelta||i.rollDelta||i.around||i.panDelta)return this._active=!0,i}dragStart(t,i){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=Array.isArray(i)?i[0]:i,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,i){if(!this.isEnabled())return;const c=this._lastPoint;if(!c)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const p=Array.isArray(i)?i[0]:i;return!this._moved&&p.dist(c)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=p,this._move(c,p))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&te.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const Ds=0,Ls=2,Su={[Ds]:1,[Ls]:2};class Rs{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){const i=te.mouseButton(t);this._eventButton=i}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!(function(i,c){const p=Su[c];return i.buttons===void 0||(i.buttons&p)!==p})(t,this._eventButton)}isValidEndEvent(t){return te.mouseButton(t)===this._eventButton}}class Eu{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return t.targetTouches.length===1}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){this._firstTouch=t.targetTouches[0].identifier}endMove(t){delete this._firstTouch}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}}class Ap{constructor(t=new Rs({checkCorrectEvent:()=>!0}),i=new Eu){this.mouseMoveStateManager=t,this.oneFingerTouchMoveStateManager=i}_executeRelevantHandler(t,i,c){return t instanceof MouseEvent?i(t):typeof TouchEvent<"u"&&t instanceof TouchEvent?c(t):void 0}startMove(t){this._executeRelevantHandler(t,(i=>this.mouseMoveStateManager.startMove(i)),(i=>this.oneFingerTouchMoveStateManager.startMove(i)))}endMove(t){this._executeRelevantHandler(t,(i=>this.mouseMoveStateManager.endMove(i)),(i=>this.oneFingerTouchMoveStateManager.endMove(i)))}isValidStartEvent(t){return this._executeRelevantHandler(t,(i=>this.mouseMoveStateManager.isValidStartEvent(i)),(i=>this.oneFingerTouchMoveStateManager.isValidStartEvent(i)))}isValidMoveEvent(t){return this._executeRelevantHandler(t,(i=>this.mouseMoveStateManager.isValidMoveEvent(i)),(i=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(i)))}isValidEndEvent(t){return this._executeRelevantHandler(t,(i=>this.mouseMoveStateManager.isValidEndEvent(i)),(i=>this.oneFingerTouchMoveStateManager.isValidEndEvent(i)))}}const No=m=>{m.mousedown=m.dragStart,m.mousemoveWindow=m.dragMove,m.mouseup=m.dragEnd,m.contextmenu=t=>{t.preventDefault()}};class Rf{constructor(t,i){this._clickTolerance=t.clickTolerance||1,this._map=i,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new s.P(0,0)}_shouldBePrevented(t){return t<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(t,i,c){return this._calculateTransform(t,i,c)}touchmove(t,i,c){if(this._active){if(!this._shouldBePrevented(c.length))return t.preventDefault(),this._calculateTransform(t,i,c);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",t)}}touchend(t,i,c){this._calculateTransform(t,i,c),this._active&&this._shouldBePrevented(c.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,i,c){c.length>0&&(this._active=!0);const p=Pi(c,i),g=new s.P(0,0),b=new s.P(0,0);let S=0;for(const A in p){const k=p[A],F=this._touches[A];F&&(g._add(k),b._add(k.sub(F)),S++,p[A]=k)}if(this._touches=p,this._shouldBePrevented(S)||!b.mag())return;const P=b.div(S);return this._sum._add(P),this._sum.mag()<this._clickTolerance?void 0:{around:g.div(S),panDelta:P}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Gl{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,i,c){this._firstTwoTouches||c.length<2||(this._firstTwoTouches=[c[0].identifier,c[1].identifier],this._start([i[0],i[1]]))}touchmove(t,i,c){if(!this._firstTwoTouches)return;t.preventDefault();const[p,g]=this._firstTwoTouches,b=Zl(c,i,p),S=Zl(c,i,g);if(!b||!S)return;const P=this._aroundCenter?null:b.add(S).div(2);return this._move([b,S],P,t)}touchend(t,i,c){if(!this._firstTwoTouches)return;const[p,g]=this._firstTwoTouches,b=Zl(c,i,p),S=Zl(c,i,g);b&&S||(this._active&&te.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&t.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function Zl(m,t,i){for(let c=0;c<m.length;c++)if(m[c].identifier===i)return t[c]}function Cp(m,t){return Math.log(m/t)/Math.LN2}class Pu extends Gl{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,i){const c=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(Cp(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Cp(this._distance,c),pinchAround:i}}}function kp(m,t){return 180*m.angleWith(t)/Math.PI}class Mu extends Gl{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,i,c){const p=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:kp(this._vector,p),pinchAround:i}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const i=25/(Math.PI*this._minDiameter)*360,c=kp(t,this._startVector);return Math.abs(c)<i}}function Iu(m){return Math.abs(m.y)>Math.abs(m.x)}class Dp extends Gl{constructor(t){super(),this._currentTouchCount=0,this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,i,c){super.touchstart(t,i,c),this._currentTouchCount=c.length}_start(t){this._lastPoints=t,Iu(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,i,c){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const p=t[0].sub(this._lastPoints[0]),g=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(p,g,c.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(p.y+g.y)/2*-.5}):void 0}gestureBeginsVertically(t,i,c){if(this._valid!==void 0)return this._valid;const p=t.mag()>=2,g=i.mag()>=2;if(!p&&!g)return;if(!p||!g)return this._firstMove===void 0&&(this._firstMove=c),c-this._firstMove<100&&void 0;const b=t.y>0==i.y>0;return Iu(t)&&Iu(i)&&b}}const Ta={panStep:100,bearingStep:15,pitchStep:10};class dr{constructor(t){this._tr=new Fo(t);const i=Ta;this._panStep=i.panStep,this._bearingStep=i.bearingStep,this._pitchStep=i.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let i=0,c=0,p=0,g=0,b=0;switch(t.keyCode){case 61:case 107:case 171:case 187:i=1;break;case 189:case 109:case 173:i=-1;break;case 37:t.shiftKey?c=-1:(t.preventDefault(),g=-1);break;case 39:t.shiftKey?c=1:(t.preventDefault(),g=1);break;case 38:t.shiftKey?p=1:(t.preventDefault(),b=-1);break;case 40:t.shiftKey?p=-1:(t.preventDefault(),b=1);break;default:return}return this._rotationDisabled&&(c=0,p=0),{cameraAnimation:S=>{const P=this._tr;S.easeTo({duration:300,easeId:"keyboardHandler",easing:zf,zoom:i?Math.round(P.zoom)+i*(t.shiftKey?2:1):P.zoom,bearing:P.bearing+c*this._bearingStep,pitch:P.pitch+p*this._pitchStep,offset:[-g*this._panStep,-b*this._panStep],center:P.center},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function zf(m){return m*(2-m)}const zs=4.000244140625,Wl=1/450;class Hl{constructor(t,i){this._onTimeout=c=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(c)},this._map=t,this._tr=new Fo(t),this._triggerRenderFrame=i,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=Wl}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(t){return!!this._map.cooperativeGestures.isEnabled()&&!(t.ctrlKey||this._map.cooperativeGestures.isBypassed(t))}wheel(t){if(!this.isEnabled())return;if(this._shouldBePrevented(t))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",t);let i=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const c=fe(),p=c-(this._lastWheelEventTime||0);this._lastWheelEventTime=c,i!==0&&i%zs==0?this._type="wheel":i!==0&&Math.abs(i)<4?this._type="trackpad":p>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(p*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),t.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=t,this._delta-=i,this._active||this._start(t)),t.preventDefault()}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const i=te.mousePos(this._map.getCanvas(),t),c=this._tr;this._aroundPoint=this._aroundCenter?c.transform.locationToScreenPoint(s.V.convert(c.center)):i,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){const S=t.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=S),typeof this._targetZoom=="number"&&(this._targetZoom+=S)}if(this._delta!==0){const S=this._type==="wheel"&&Math.abs(this._delta)>zs?this._wheelZoomRate:this._defaultZoomRate;let P=2/(1+Math.exp(-Math.abs(this._delta*S)));this._delta<0&&P!==0&&(P=1/P);const A=typeof this._targetZoom!="number"?t.scale:s.aq(this._targetZoom);this._targetZoom=t.applyConstrain(t.getCameraLngLat(),s.at(A*P)).zoom,this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const i=typeof this._targetZoom!="number"?t.zoom:this._targetZoom,c=this._startZoom,p=this._easing;let g,b=!1;if(this._type==="wheel"&&c&&p){const S=fe()-this._lastWheelEventTime,P=Math.min((S+5)/200,1),A=p(P);g=s.G.number(c,i,A),P<1?this._frameId||(this._frameId=!0):b=!0}else g=i,b=!0;return this._active=!0,b&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout}),200)),this._lastExpectedZoom=g,{noInertia:!0,needsRenderFrame:!b,zoomDelta:g-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let i=s.cy;if(this._prevEase){const c=this._prevEase,p=(fe()-c.start)/c.duration,g=c.easing(p+.01)-c.easing(p),b=.27/Math.sqrt(g*g+1e-4)*.01,S=Math.sqrt(.0729-b*b);i=s.cw(b,S,.25,1)}return this._prevEase={start:fe(),duration:t,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 Au{constructor(t,i){this._clickZoom=t,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 Lp{constructor(t){this._tr=new Fo(t),this.reset()}reset(){this._active=!1}dblclick(t,i){return t.preventDefault(),{cameraAnimation:c=>{c.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(i)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Rp{constructor(){this._tap=new ql({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(t,i,c){if(!this._swipePoint)if(this._tapTime){const p=i[0],g=t.timeStamp-this._tapTime<500,b=this._tapPoint.dist(p)<30;g&&b?c.length>0&&(this._swipePoint=p,this._swipeTouch=c[0].identifier):this.reset()}else this._tap.touchstart(t,i,c)}touchmove(t,i,c){if(this._tapTime){if(this._swipePoint){if(c[0].identifier!==this._swipeTouch)return;const p=i[0],g=p.y-this._swipePoint.y;return this._swipePoint=p,t.preventDefault(),this._active=!0,{zoomDelta:g/128}}}else this._tap.touchmove(t,i,c)}touchend(t,i,c){if(this._tapTime)this._swipePoint&&c.length===0&&this.reset();else{const p=this._tap.touchend(t,i,c);p&&(this._tapTime=t.timeStamp,this._tapPoint=p)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class zp{constructor(t,i,c){this._el=t,this._mousePan=i,this._touchPan=c}enable(t){this._inertiaOptions=t||{},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 Mi{constructor(t,i,c,p){this._pitchWithRotate=t.pitchWithRotate,this._rollEnabled=t.rollEnabled,this._mouseRotate=i,this._mousePitch=c,this._mouseRoll=p}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 Fs{constructor(t,i,c,p){this._el=t,this._touchZoom=i,this._touchRotate=c,this._tapDragZoom=p,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("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 gt{constructor(t,i){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=t,this._options=i,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=te.create("div","maplibregl-cooperative-gesture-screen",t);let i=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(i=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const c=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),p=document.createElement("div");p.className="maplibregl-desktop-message",p.textContent=i,this._container.appendChild(p);const g=document.createElement("div");g.className="maplibregl-mobile-message",g.textContent=c,this._container.appendChild(g),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(te.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(t){return t[this._bypassKey]}notifyGestureBlocked(t,i){this._enabled&&(this._map.fire(new s.l("cooperativegestureprevented",{gestureType:t,originalEvent:i})),this._container.classList.add("maplibregl-show"),setTimeout((()=>{this._container.classList.remove("maplibregl-show")}),100))}}const bt=m=>m.zoom||m.drag||m.roll||m.pitch||m.rotate;class Os extends s.l{}function Xl(m){return m.panDelta&&m.panDelta.mag()||m.zoomDelta||m.bearingDelta||m.pitchDelta||m.rollDelta}class Yl{constructor(t,i){this.handleWindowEvent=p=>{this.handleEvent(p,`${p.type}Window`)},this.handleEvent=(p,g)=>{if(p.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const b=p.type==="renderFrame"?void 0:p,S={needsRenderFrame:!1},P={},A={};for(const{handlerName:z,handler:j,allowed:G}of this._handlers){if(!j.isEnabled())continue;let Y;if(this._blockedByActive(A,G,z))j.reset();else if(j[g||p.type]){if(s.cz(p,g||p.type)){const Q=te.mousePos(this._map.getCanvas(),p);Y=j[g||p.type](p,Q)}else if(s.cA(p,g||p.type)){const Q=this._getMapTouches(p.touches),K=te.touchPos(this._map.getCanvas(),Q);Y=j[g||p.type](p,K,Q)}else s.cB(g||p.type)||(Y=j[g||p.type](p));this.mergeHandlerResult(S,P,Y,z,b),Y&&Y.needsRenderFrame&&this._triggerRenderFrame()}(Y||j.isActive())&&(A[z]=j)}const k={};for(const z in this._previousActiveHandlers)A[z]||(k[z]=b);this._previousActiveHandlers=A,(Object.keys(k).length||Xl(S))&&(this._changes.push([S,P,k]),this._triggerRenderFrame()),(Object.keys(A).length||Xl(S))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:F}=S;F&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],F(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new kf(t),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i);const c=this._el;this._listeners=[[c,"touchstart",{passive:!0}],[c,"touchmove",{passive:!1}],[c,"touchend",void 0],[c,"touchcancel",void 0],[c,"mousedown",void 0],[c,"mousemove",void 0],[c,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[c,"mouseover",void 0],[c,"mouseout",void 0],[c,"dblclick",void 0],[c,"click",void 0],[c,"keydown",{capture:!1}],[c,"keyup",void 0],[c,"wheel",{passive:!1}],[c,"contextmenu",void 0],[window,"blur",void 0]];for(const[p,g,b]of this._listeners)te.addEventListener(p,g,p===document?this.handleWindowEvent:this.handleEvent,b)}destroy(){for(const[t,i,c]of this._listeners)te.removeEventListener(t,i,t===document?this.handleWindowEvent:this.handleEvent,c)}_addDefaultHandlers(t){const i=this._map,c=i.getCanvasContainer();this._add("mapEvent",new Df(i,t));const p=i.boxZoom=new Oo(i,t);this._add("boxZoom",p),t.interactive&&t.boxZoom&&p.enable();const g=i.cooperativeGestures=new gt(i,t.cooperativeGestures);this._add("cooperativeGestures",g),t.cooperativeGestures&&g.enable();const b=new Tu(i),S=new Lp(i);i.doubleClickZoom=new Au(S,b),this._add("tapZoom",b),this._add("clickZoom",S),t.interactive&&t.doubleClickZoom&&i.doubleClickZoom.enable();const P=new Rp;this._add("tapDragZoom",P);const A=i.touchPitch=new Dp(i);this._add("touchPitch",A),t.interactive&&t.touchPitch&&i.touchPitch.enable(t.touchPitch);const k=()=>i.project(i.getCenter()),F=(function({enable:ie,clickTolerance:he,aroundCenter:ge=!0,minPixelCenterThreshold:ce=100,rotateDegreesPerPixelMoved:ve=.8},Fe){const Ce=new Rs({checkCorrectEvent:ke=>te.mouseButton(ke)===0&&ke.ctrlKey||te.mouseButton(ke)===2&&!ke.ctrlKey});return new Bo({clickTolerance:he,move:(ke,Le)=>{const Xe=Fe();if(ge&&Math.abs(Xe.y-ke.y)>ce)return{bearingDelta:s.cx(new s.P(ke.x,Le.y),Le,Xe)};let Ke=(Le.x-ke.x)*ve;return ge&&Le.y<Xe.y&&(Ke=-Ke),{bearingDelta:Ke}},moveStateManager:Ce,enable:ie,assignEvents:No})})(t,k),z=(function({enable:ie,clickTolerance:he,pitchDegreesPerPixelMoved:ge=-.5}){const ce=new Rs({checkCorrectEvent:ve=>te.mouseButton(ve)===0&&ve.ctrlKey||te.mouseButton(ve)===2});return new Bo({clickTolerance:he,move:(ve,Fe)=>({pitchDelta:(Fe.y-ve.y)*ge}),moveStateManager:ce,enable:ie,assignEvents:No})})(t),j=(function({enable:ie,clickTolerance:he,rollDegreesPerPixelMoved:ge=.3},ce){const ve=new Rs({checkCorrectEvent:Fe=>te.mouseButton(Fe)===2&&Fe.ctrlKey});return new Bo({clickTolerance:he,move:(Fe,Ce)=>{const ke=ce();let Le=(Ce.x-Fe.x)*ge;return Ce.y<ke.y&&(Le=-Le),{rollDelta:Le}},moveStateManager:ve,enable:ie,assignEvents:No})})(t,k);i.dragRotate=new Mi(t,F,z,j),this._add("mouseRotate",F,["mousePitch"]),this._add("mousePitch",z,["mouseRotate","mouseRoll"]),this._add("mouseRoll",j,["mousePitch"]),t.interactive&&t.dragRotate&&i.dragRotate.enable();const G=(function({enable:ie,clickTolerance:he}){const ge=new Rs({checkCorrectEvent:ce=>te.mouseButton(ce)===0&&!ce.ctrlKey});return new Bo({clickTolerance:he,move:(ce,ve)=>({around:ve,panDelta:ve.sub(ce)}),activateOnStart:!0,moveStateManager:ge,enable:ie,assignEvents:No})})(t),Y=new Rf(t,i);i.dragPan=new zp(c,G,Y),this._add("mousePan",G),this._add("touchPan",Y,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&i.dragPan.enable(t.dragPan);const Q=new Mu,K=new Pu;i.touchZoomRotate=new Fs(c,K,Q,P),this._add("touchRotate",Q,["touchPan","touchZoom"]),this._add("touchZoom",K,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&i.touchZoomRotate.enable(t.touchZoomRotate),this._add("blockableMapEvent",new Lf(i));const oe=i.scrollZoom=new Hl(i,(()=>this._triggerRenderFrame()));this._add("scrollZoom",oe,["mousePan"]),t.interactive&&t.scrollZoom&&i.scrollZoom.enable(t.scrollZoom);const de=i.keyboard=new dr(i);this._add("keyboard",de),t.interactive&&t.keyboard&&i.keyboard.enable()}_add(t,i,c){this._handlers.push({handlerName:t,handler:i,allowed:c}),this._handlersById[t]=i}stop(t){if(!this._updatingCamera){for(const{handler:i}of this._handlers)i.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!bt(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,i,c){for(const p in t)if(p!==c&&(!i||i.indexOf(p)<0))return!0;return!1}_getMapTouches(t){const i=[];for(const c of t)this._el.contains(c.target)&&i.push(c);return i}mergeHandlerResult(t,i,c,p,g){if(!c)return;s.e(t,c);const b={handlerName:p,originalEvent:c.originalEvent||g};c.zoomDelta!==void 0&&(i.zoom=b),c.panDelta!==void 0&&(i.drag=b),c.rollDelta!==void 0&&(i.roll=b),c.pitchDelta!==void 0&&(i.pitch=b),c.bearingDelta!==void 0&&(i.rotate=b)}_applyChanges(){const t={},i={},c={};for(const[p,g,b]of this._changes)p.panDelta&&(t.panDelta=(t.panDelta||new s.P(0,0))._add(p.panDelta)),p.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+p.zoomDelta),p.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+p.bearingDelta),p.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+p.pitchDelta),p.rollDelta&&(t.rollDelta=(t.rollDelta||0)+p.rollDelta),p.around!==void 0&&(t.around=p.around),p.pinchAround!==void 0&&(t.pinchAround=p.pinchAround),p.noInertia&&(t.noInertia=p.noInertia),s.e(i,g),s.e(c,b);this._updateMapTransform(t,i,c),this._changes=[]}_updateMapTransform(t,i,c){const p=this._map,g=p._getTransformForUpdate(),b=p.terrain;if(!(Xl(t)||b&&this._terrainMovement))return this._fireEvents(i,c,!0);p._stop(!0);let{panDelta:S,zoomDelta:P,bearingDelta:A,pitchDelta:k,rollDelta:F,around:z,pinchAround:j}=t;j!==void 0&&(z=j),z=z||p.transform.centerPoint,b&&!g.isPointOnMapSurface(z)&&(z=g.centerPoint);const G={panDelta:S,zoomDelta:P,rollDelta:F,pitchDelta:k,bearingDelta:A,around:z};this._map.cameraHelper.useGlobeControls&&!g.isPointOnMapSurface(z)&&(z=g.centerPoint);const Y=z.distSqr(g.centerPoint)<.01?g.center:g.screenPointToLocation(S?z.sub(S):z);this._handleMapControls({terrain:b,tr:g,deltasForHelper:G,preZoomAroundLoc:Y,combinedEventsInProgress:i,panDelta:S}),p._applyUpdatedTransform(g),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(i,c,!0)}_handleMapControls({terrain:t,tr:i,deltasForHelper:c,preZoomAroundLoc:p,combinedEventsInProgress:g,panDelta:b}){const S=this._map.cameraHelper;if(S.handleMapControlsRollPitchBearingZoom(c,i),t)return S.useGlobeControls?(this._terrainMovement||!g.drag&&!g.zoom||(this._terrainMovement=!0,this._map._elevationFreeze=!0),void S.handleMapControlsPan(c,i,p)):this._terrainMovement||!g.drag&&!g.zoom?void(g.drag&&this._terrainMovement&&b?i.setCenter(i.screenPointToLocation(i.centerPoint.sub(b))):S.handleMapControlsPan(c,i,p)):(this._terrainMovement=!0,this._map._elevationFreeze=!0,void S.handleMapControlsPan(c,i,p));S.handleMapControlsPan(c,i,p)}_fireEvents(t,i,c){const p=bt(this._eventsInProgress),g=bt(t),b={};for(const F in t){const{originalEvent:z}=t[F];this._eventsInProgress[F]||(b[`${F}start`]=z),this._eventsInProgress[F]=t[F]}!p&&g&&this._fireEvent("movestart",g.originalEvent);for(const F in b)this._fireEvent(F,b[F]);g&&this._fireEvent("move",g.originalEvent);for(const F in t){const{originalEvent:z}=t[F];this._fireEvent(F,z)}const S={};let P;for(const F in this._eventsInProgress){const{handlerName:z,originalEvent:j}=this._eventsInProgress[F];this._handlersById[z].isActive()||(delete this._eventsInProgress[F],P=i[z]||j,S[`${F}end`]=P)}for(const F in S)this._fireEvent(F,S[F]);const A=bt(this._eventsInProgress),k=(p||g)&&!A;if(k&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const F=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&F.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(F)}if(c&&k){this._updatingCamera=!0;const F=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),z=j=>j!==0&&-this._bearingSnap<j&&j<this._bearingSnap;!F||!F.essential&&ee.prefersReducedMotion?(this._map.fire(new s.l("moveend",{originalEvent:P})),z(this._map.getBearing())&&this._map.resetNorth()):(z(F.bearing||this._map.getBearing())&&(F.bearing=0),F.freezeElevation=!0,this._map.easeTo(F,{originalEvent:P})),this._updatingCamera=!1}}_fireEvent(t,i){this._map.fire(new s.l(t,i?{originalEvent:i}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((t=>{delete this._frameId,this.handleEvent(new Os("renderFrame",{timeStamp:t})),this._applyChanges()}))}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class qn extends s.E{constructor(t,i,c){super(),this._renderFrameCallback=()=>{const p=Math.min((fe()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(p)),p<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=c.bearingSnap,this.cameraHelper=i,this.on("moveend",(()=>{delete this._requestedCameraState}))}migrateProjection(t,i){t.apply(this.transform,!0),this.transform=t,this.cameraHelper=i}getCenter(){return new s.V(this.transform.center.lng,this.transform.center.lat)}setCenter(t,i){return this.jumpTo({center:t},i)}getCenterElevation(){return this.transform.elevation}setCenterElevation(t,i){return this.jumpTo({elevation:t},i),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(t){this._centerClampedToGround=t}panBy(t,i,c){return t=s.P.convert(t).mult(-1),this.panTo(this.transform.center,s.e({offset:t},i),c)}panTo(t,i,c){return this.easeTo(s.e({center:t},i),c)}getZoom(){return this.transform.zoom}setZoom(t,i){return this.jumpTo({zoom:t},i),this}zoomTo(t,i,c){return this.easeTo(s.e({zoom:t},i),c)}zoomIn(t,i){return this.zoomTo(this.getZoom()+1,t,i),this}zoomOut(t,i){return this.zoomTo(this.getZoom()-1,t,i),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(t,i){return t!=this.transform.fov&&(this.transform.setFov(t),this.fire(new s.l("movestart",i)).fire(new s.l("move",i)).fire(new s.l("moveend",i))),this}getBearing(){return this.transform.bearing}setBearing(t,i){return this.jumpTo({bearing:t},i),this}getPadding(){return this.transform.padding}setPadding(t,i){return this.jumpTo({padding:t},i),this}rotateTo(t,i,c){return this.easeTo(s.e({bearing:t},i),c)}resetNorth(t,i){return this.rotateTo(0,s.e({duration:1e3},t),i),this}resetNorthPitch(t,i){return this.easeTo(s.e({bearing:0,pitch:0,roll:0,duration:1e3},t),i),this}snapToNorth(t,i){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,i):this}getPitch(){return this.transform.pitch}setPitch(t,i){return this.jumpTo({pitch:t},i),this}getRoll(){return this.transform.roll}setRoll(t,i){return this.jumpTo({roll:t},i),this}cameraForBounds(t,i){t=Kt.convert(t).adjustAntiMeridian();const c=i&&i.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),c,i)}_cameraForBoxAndBearing(t,i,c,p){const g={top:0,bottom:0,right:0,left:0};if(typeof(p=s.e({padding:g,offset:[0,0],maxZoom:this.transform.maxZoom},p)).padding=="number"){const A=p.padding;p.padding={top:A,bottom:A,right:A,left:A}}const b=s.e(g,p.padding);p.padding=b;const S=this.transform,P=new Kt(t,i);return this.cameraHelper.cameraForBoxAndBearing(p,b,P,c,S)}fitBounds(t,i,c){return this._fitInternal(this.cameraForBounds(t,i),i,c)}fitScreenCoordinates(t,i,c,p,g){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(s.P.convert(t)),this.transform.screenPointToLocation(s.P.convert(i)),c,p),p,g)}_fitInternal(t,i,c){return t?(delete(i=s.e(t,i)).padding,i.linear?this.easeTo(i,c):this.flyTo(i,c)):this}jumpTo(t,i){this.stop();const c=this._getTransformForUpdate();let p=!1,g=!1,b=!1;const S=c.zoom;this.cameraHelper.handleJumpToCenterZoom(c,t);const P=c.zoom!==S;return"elevation"in t&&c.elevation!==+t.elevation&&c.setElevation(+t.elevation),"bearing"in t&&c.bearing!==+t.bearing&&(p=!0,c.setBearing(+t.bearing)),"pitch"in t&&c.pitch!==+t.pitch&&(g=!0,c.setPitch(+t.pitch)),"roll"in t&&c.roll!==+t.roll&&(b=!0,c.setRoll(+t.roll)),t.padding==null||c.isPaddingEqual(t.padding)||c.setPadding(t.padding),this._applyUpdatedTransform(c),this.fire(new s.l("movestart",i)).fire(new s.l("move",i)),P&&this.fire(new s.l("zoomstart",i)).fire(new s.l("zoom",i)).fire(new s.l("zoomend",i)),p&&this.fire(new s.l("rotatestart",i)).fire(new s.l("rotate",i)).fire(new s.l("rotateend",i)),g&&this.fire(new s.l("pitchstart",i)).fire(new s.l("pitch",i)).fire(new s.l("pitchend",i)),b&&this.fire(new s.l("rollstart",i)).fire(new s.l("roll",i)).fire(new s.l("rollend",i)),this.fire(new s.l("moveend",i))}calculateCameraOptionsFromTo(t,i,c,p=0){const g=s.a9.fromLngLat(t,i),b=s.a9.fromLngLat(c,p),S=b.x-g.x,P=b.y-g.y,A=b.z-g.z,k=Math.hypot(S,P,A);if(k===0)throw new Error("Can't calculate camera options with same From and To");const F=Math.hypot(S,P),z=s.at(this.transform.cameraToCenterDistance/k/this.transform.tileSize),j=180*Math.atan2(S,-P)/Math.PI;let G=180*Math.acos(F/k)/Math.PI;return G=A<0?90-G:90+G,{center:b.toLngLat(),elevation:p,zoom:z,pitch:G,bearing:j}}calculateCameraOptionsFromCameraLngLatAltRotation(t,i,c,p,g){const b=this.transform.calculateCenterFromCameraLngLatAlt(t,i,c,p);return{center:b.center,elevation:b.elevation,zoom:b.zoom,bearing:c,pitch:p,roll:g}}easeTo(t,i){this._stop(!1,t.easeId),((t=s.e({offset:[0,0],duration:500,easing:s.cy},t)).animate===!1||!t.essential&&ee.prefersReducedMotion)&&(t.duration=0);const c=this._getTransformForUpdate(),p=this.getBearing(),g=c.pitch,b=c.roll,S="bearing"in t?this._normalizeBearing(t.bearing,p):p,P="pitch"in t?+t.pitch:g,A="roll"in t?this._normalizeBearing(t.roll,b):b,k="padding"in t?t.padding:c.padding,F=s.P.convert(t.offset);let z,j;t.around&&(z=s.V.convert(t.around),j=c.locationToScreenPoint(z));const G={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},Y=this.cameraHelper.handleEaseTo(c,{bearing:S,pitch:P,roll:A,padding:k,around:z,aroundPoint:j,offsetAsPoint:F,offset:t.offset,zoom:t.zoom,center:t.center});return this._rotating=this._rotating||p!==S,this._pitching=this._pitching||P!==g,this._rolling=this._rolling||A!==b,this._padding=!c.isPaddingEqual(k),this._zooming=this._zooming||Y.isZooming,this._easeId=t.easeId,this._prepareEase(i,t.noMoveStart,G),this.terrain&&this._prepareElevation(Y.elevationCenter),this._ease((Q=>{Y.easeFunc(Q),this.terrain&&!t.freezeElevation&&this._updateElevation(Q),this._applyUpdatedTransform(c),this._fireMoveEvents(i)}),(Q=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(i,Q)}),t),this}_prepareEase(t,i,c={}){this._moving=!0,i||c.moving||this.fire(new s.l("movestart",t)),this._zooming&&!c.zooming&&this.fire(new s.l("zoomstart",t)),this._rotating&&!c.rotating&&this.fire(new s.l("rotatestart",t)),this._pitching&&!c.pitching&&this.fire(new s.l("pitchstart",t)),this._rolling&&!c.rolling&&this.fire(new s.l("rollstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this._elevationStart!==void 0&&this._elevationCenter!==void 0||this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const i=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&i!==this._elevationTarget){const c=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(c-(i-(c*t+this._elevationStart))/(1-t)),this._elevationTarget=i}this.transform.setElevation(s.G.number(this._elevationStart,this._elevationTarget,t))}_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(t){if(!this.terrain&&t.elevation>=0&&t.pitch<=90)return{};const i=t.getCameraLngLat(),c=t.getCameraAltitude(),p=this.terrain?this.terrain.getElevationForLngLatZoom(i,t.zoom):0;if(c<p){const g=this.calculateCameraOptionsFromTo(i,p,t.center,t.elevation);return{pitch:g.pitch,zoom:g.zoom}}return{}}_applyUpdatedTransform(t){const i=[];if(i.push((p=>this._elevateCameraIfInsideTerrain(p))),this.transformCameraUpdate&&i.push((p=>this.transformCameraUpdate(p))),!i.length)return;const c=t.clone();for(const p of i){const g=c.clone(),{center:b,zoom:S,roll:P,pitch:A,bearing:k,elevation:F}=p(g);b&&g.setCenter(b),F!==void 0&&g.setElevation(F),S!==void 0&&g.setZoom(S),P!==void 0&&g.setRoll(P),A!==void 0&&g.setPitch(A),k!==void 0&&g.setBearing(k),c.apply(g,!1)}this.transform.apply(c,!1)}_fireMoveEvents(t){this.fire(new s.l("move",t)),this._zooming&&this.fire(new s.l("zoom",t)),this._rotating&&this.fire(new s.l("rotate",t)),this._pitching&&this.fire(new s.l("pitch",t)),this._rolling&&this.fire(new s.l("roll",t))}_afterEase(t,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;const c=this._zooming,p=this._rotating,g=this._pitching,b=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,c&&this.fire(new s.l("zoomend",t)),p&&this.fire(new s.l("rotateend",t)),g&&this.fire(new s.l("pitchend",t)),b&&this.fire(new s.l("rollend",t)),this.fire(new s.l("moveend",t))}flyTo(t,i){if(!t.essential&&ee.prefersReducedMotion){const Le=s.U(t,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(Le,i)}this.stop(),t=s.e({offset:[0,0],speed:1.2,curve:1.42,easing:s.cy},t);const c=this._getTransformForUpdate(),p=c.bearing,g=c.pitch,b=c.roll,S=c.padding,P="bearing"in t?this._normalizeBearing(t.bearing,p):p,A="pitch"in t?+t.pitch:g,k="roll"in t?this._normalizeBearing(t.roll,b):b,F="padding"in t?t.padding:c.padding,z=s.P.convert(t.offset);let j=c.centerPoint.add(z);const G=c.screenPointToLocation(j),Y=this.cameraHelper.handleFlyTo(c,{bearing:P,pitch:A,roll:k,padding:F,locationAtOffset:G,offsetAsPoint:z,center:t.center,minZoom:t.minZoom,zoom:t.zoom});let Q=t.curve;const K=Math.max(c.width,c.height),oe=K/Y.scaleOfZoom,de=Y.pixelPathLength;typeof Y.scaleOfMinZoom=="number"&&(Q=Math.sqrt(K/Y.scaleOfMinZoom/de*2));const ie=Q*Q;function he(Le){const Xe=(oe*oe-K*K+(Le?-1:1)*ie*ie*de*de)/(2*(Le?oe:K)*ie*de);return Math.log(Math.sqrt(Xe*Xe+1)-Xe)}function ge(Le){return(Math.exp(Le)-Math.exp(-Le))/2}function ce(Le){return(Math.exp(Le)+Math.exp(-Le))/2}const ve=he(!1);let Fe=function(Le){return ce(ve)/ce(ve+Q*Le)},Ce=function(Le){return K*((ce(ve)*(ge(Xe=ve+Q*Le)/ce(Xe))-ge(ve))/ie)/de;var Xe},ke=(he(!0)-ve)/Q;if(Math.abs(de)<2e-6||!isFinite(ke)){if(Math.abs(K-oe)<1e-6)return this.easeTo(t,i);const Le=oe<K?-1:1;ke=Math.abs(Math.log(oe/K))/Q,Ce=()=>0,Fe=Xe=>Math.exp(Le*Q*Xe)}return t.duration="duration"in t?+t.duration:1e3*ke/("screenSpeed"in t?+t.screenSpeed/Q:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=p!==P,this._pitching=A!==g,this._rolling=k!==b,this._padding=!c.isPaddingEqual(F),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(Y.targetCenter),this._ease((Le=>{const Xe=Le*ke,Ke=1/Fe(Xe),qe=Ce(Xe);this._rotating&&c.setBearing(s.G.number(p,P,Le)),this._pitching&&c.setPitch(s.G.number(g,A,Le)),this._rolling&&c.setRoll(s.G.number(b,k,Le)),this._padding&&(c.interpolatePadding(S,F,Le),j=c.centerPoint.add(z)),Y.easeFunc(Le,Ke,qe,j),this.terrain&&!t.freezeElevation&&this._updateElevation(Le),this._applyUpdatedTransform(c),this._fireMoveEvents(i)}),(()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(i)}),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,i){var c;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const p=this._onEaseEnd;delete this._onEaseEnd,p.call(this,i)}return t||(c=this.handlers)===null||c===void 0||c.stop(!1),this}_ease(t,i,c){c.animate===!1||c.duration===0?(t(1),i()):(this._easeStart=fe(),this._easeOptions=c,this._onEaseFrame=t,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,i){t=s.W(t,-180,180);const c=Math.abs(t-i);return Math.abs(t-360-i)<c&&(t-=360),Math.abs(t+360-i)<c&&(t+=360),t}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLat(s.V.convert(t),this.transform):null}}const gi={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Cu{constructor(t=gi){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=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options.compact,this._container=te.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=te.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=te.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(){te.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(t,i){const c=this._map._getUIString(`AttributionControl.${i}`);t.title=c,t.setAttribute("aria-label",c)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map((p=>typeof p!="string"?"":p))):typeof this.options.customAttribution=="str
811ing"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const p=this._map.style.stylesheet;this.styleOwner=p.owner,this.styleId=p.id}const i=this._map.style.tileManagers;for(const p in i){const g=i[p];if(g.used||g.usedForTerrain){const b=g.getSource();b.attribution&&t.indexOf(b.attribution)<0&&t.push(b.attribution)}}t=t.filter((p=>String(p).trim())),t.sort(((p,g)=>p.length-g.length)),t=t.filter(((p,g)=>{for(let b=g+1;b<t.length;b++)if(t[b].indexOf(p)>=0)return!1;return!0}));const c=t.join(" | ");c!==this._attribHTML&&(this._attribHTML=c,t.length?(this._innerContainer.innerHTML=te.sanitize(c),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Fp{constructor(t={}){this._updateCompact=()=>{const i=this._container.children;if(i.length){const c=i[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&c.classList.add("maplibregl-compact"):c.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=te.create("div","maplibregl-ctrl");const i=te.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(){te.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Ff{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const i=++this._id;return this._queue.push({callback:t,id:i,cancelled:!1}),i}remove(t){const i=this._currentlyRunning,c=i?this._queue.concat(i):this._queue;for(const p of c)if(p.id===t)return void(p.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const i=this._currentlyRunning=this._queue;this._queue=[];for(const c of i)if(!c.cancelled&&(c.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Of=s.aU([{name:"a_pos3d",type:"Int16",components:3}]);class Bs extends s.E{constructor(t){super(),this._lastTilesetChange=fe(
vendor: 39,515 bytes, line 811
811),this.tileManager=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=t._source.tileSize*2**this.deltaZoom,t.usedForTerrain=!0,t.tileSize=this.tileSize}destruct(){this.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null}getSource(){return this.tileManager._source}update(t,i){this.tileManager.update(t,i),this._renderableTilesKeys=[];const c={};for(const p of Or(t,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i,calculateTileZoom:this.tileManager._source.calculateTileZoom}))c[p.key]=!0,this._renderableTilesKeys.push(p.key),this._tiles[p.key]||(p.terrainRttPosMatrix32f=new Float64Array(16),s.c7(p.terrainRttPosMatrix32f,0,s.a5,s.a5,0,0,1),this._tiles[p.key]=new je(p,this.tileSize),this._lastTilesetChange=fe());for(const p in this._tiles)c[p]||delete this._tiles[p]}freeRtt(t){for(const i in this._tiles){const c=this._tiles[i];(!t||c.tileID.equals(t)||c.tileID.isChildOf(t)||t.isChildOf(c.tileID))&&(c.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map((t=>this.getTileByID(t)))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t,i){return i?this._getTerrainCoordsForTileRanges(t,i):this._getTerrainCoordsForRegularTile(t)}_getTerrainCoordsForRegularTile(t){const i={};for(const c of this._renderableTilesKeys){const p=this._tiles[c].tileID,g=t.clone(),b=s.bk();if(p.canonical.equals(t.canonical))s.c7(b,0,s.a5,s.a5,0,0,1);else if(p.canonical.isChildOf(t.canonical)){const S=p.canonical.z-t.canonical.z,P=p.canonical.x-(p.canonical.x>>S<<S),A=p.canonical.y-(p.canonical.y>>S<<S),k=s.a5>>S;s.c7(b,0,k,k,0,0,1),s.O(b,b,[-P*k,-A*k,0])}else{if(!t.canonical.isChildOf(p.canonical))continue;{const S=t.canonical.z-p.canonical.z,P=t.canonical.x-(t.canonical.x>>S<<S),A=t.canonical.y-(t.canonical.y>>S<<S),k=s.a5>>S;s.c7(b,0,s.a5,s.a5,0,0,1),s.O(b,b,[P*k,A*k,0]),s.Q(b,b,[1/2**S,1/2**S,0])}}g.terrainRttPosMatrix32f=new Float32Array(b),i[c]=g}return i}_getTerrainCoordsForTileRanges(t,i){const c={};for(const p of this._renderableTilesKeys){const g=this._tiles[p].tileID;if(!this._isWithinTileRanges(g,i))continue;const b=t.clone(),S=s.bk();if(g.canonical.z===t.canonical.z){const P=t.canonical.x-g.canonical.x+t.wrap*(1<<t.canonical.z),A=t.canonical.y-g.canonical.y;s.c7(S,0,s.a5,s.a5,0,0,1),s.O(S,S,[P*s.a5,A*s.a5,0])}else if(g.canonical.z>t.canonical.z){const P=g.canonical.z-t.canonical.z,A=g.canonical.x-(g.canonical.x>>P<<P)+t.wrap*(1<<g.canonical.z),k=g.canonical.y-(g.canonical.y>>P<<P),F=t.canonical.x-(g.canonical.x>>P),z=t.canonical.y-(g.canonical.y>>P),j=s.a5>>P;s.c7(S,0,j,j,0,0,1),s.O(S,S,[-A*j+F*s.a5,-k*j+z*s.a5,0])}else{const P=t.canonical.z-g.canonical.z,A=t.canonical.x-(t.canonical.x>>P<<P)+t.wrap*(1<<t.canonical.z),k=t.canonical.y-(t.canonical.y>>P<<P),F=(t.canonical.x>>P)-g.canonical.x,z=(t.canonical.y>>P)-g.canonical.y,j=s.a5<<P;s.c7(S,0,j,j,0,0,1),s.O(S,S,[A*s.a5+F*j,k*s.a5+z*j,0])}b.terrainRttPosMatrix32f=new Float32Array(S),c[p]=b}return c}getSourceTile(t,i){const c=this.tileManager._source;let p=t.overscaledZ-this.deltaZoom;if(p>c.maxzoom&&(p=c.maxzoom),p<c.minzoom)return;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(p).key);let g=this.findTileInCaches(this._sourceTileCache[t.key]);if(!(g!=null&&g.dem)&&i)for(;p>=c.minzoom&&!(g!=null&&g.dem);)g=this.findTileInCaches(t.scaledTo(p--).key);return g}findTileInCaches(t){let i=this.tileManager.getTileByID(t);return i||(i=this.tileManager._outOfViewCache.getByKey(t),i)}anyTilesAfterTime(t=Date.now()){return this._lastTilesetChange>=t}_isWithinTileRanges(t,i){const c=i[t.canonical.z];return!!c&&(t.wrap>c.minWrap||t.wrap<c.maxWrap||t.canonical.x>=c.minTileXWrapped&&t.canonical.x<=c.maxTileXWrapped&&t.canonical.y>=c.minTileY&&t.canonical.y<=c.maxTileY)}}class zr{constructor(t,i,c){this._meshCache={},this.painter=t,this.tileManager=new Bs(i),this.options=c,this.exaggeration=typeof c.exaggeration=="number"?c.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,i,c,p=s.a5){var g;if(!(i>=0&&i<p&&c>=0&&c<p))return 0;const b=this.getTerrainData(t),S=(g=b.tile)===null||g===void 0?void 0:g.dem;if(!S)return 0;const P=s.cC([],[i/p*s.a5,c/p*s.a5],b.u_terrain_matrix),A=[P[0]*S.dim,P[1]*S.dim],k=Math.floor(A[0]),F=Math.floor(A[1]),z=A[0]-k,j=A[1]-F;return S.get(k,F)*(1-z)*(1-j)+S.get(k+1,F)*z*(1-j)+S.get(k,F+1)*(1-z)*j+S.get(k+1,F+1)*z*j}getElevationForLngLatZoom(t,i){if(!s.cD(i,t.wrap()))return 0;const{tileID:c,mercatorX:p,mercatorY:g}=this._getOverscaledTileIDFromLngLatZoom(t,i);return this.getElevation(c,p%s.a5,g%s.a5,s.a5)}getElevationForLngLat(t,i){const c=Or(i,{maxzoom:this.tileManager.maxzoom,minzoom:this.tileManager.minzoom,tileSize:512,terrain:this});let p=0;for(const g of c)g.canonical.z>p&&(p=Math.min(g.canonical.z,this.tileManager.maxzoom));return this.getElevationForLngLatZoom(t,p)}getElevation(t,i,c,p=s.a5){return this.getDEMElevation(t,i,c,p)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){const p=this.painter.context,g=new s.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new s.T(p,g,p.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new s.T(p,new s.R({width:1,height:1}),p.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(p.gl.NEAREST,p.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=s.ar([])}const i=this.tileManager.getSourceTile(t,!0);if(i&&i.dem&&(!i.demTexture||i.needsTerrainPrepare)){const p=this.painter.context;i.demTexture=this.painter.getTileTexture(i.dem.stride),i.demTexture?i.demTexture.update(i.dem.getPixels(),{premultiply:!1}):i.demTexture=new s.T(p,i.dem.getPixels(),p.gl.RGBA,{premultiply:!1}),i.demTexture.bind(p.gl.NEAREST,p.gl.CLAMP_TO_EDGE),i.needsTerrainPrepare=!1}const c=i&&i.toString()+i.tileID.key+t.key;if(c&&!this._demMatrixCache[c]){const p=this.tileManager.getSource().maxzoom;let g=t.canonical.z-i.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=p?g=t.canonical.z-p:s.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const b=t.canonical.x-(t.canonical.x>>g<<g),S=t.canonical.y-(t.canonical.y>>g<<g),P=s.cE(new Float64Array(16),[1/(s.a5<<g),1/(s.a5<<g),0]);s.O(P,P,[b*s.a5,S*s.a5,0]),this._demMatrixCache[t.key]={matrix:P,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:i&&i.dem&&i.dem.dim||1,u_terrain_matrix:c?this._demMatrixCache[t.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(t){const i=this.painter,c=i.width/devicePixelRatio,p=i.height/devicePixelRatio;return!this._fbo||this._fbo.width===c&&this._fbo.height===p||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new s.T(i.context,{width:c,height:p,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 s.T(i.context,{width:c,height:p,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(c,p,!0,!1),this._fbo.depthAttachment.set(i.context.createRenderbuffer(i.context.gl.DEPTH_COMPONENT16,c,p))),this._fbo.colorAttachment.set(t==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const t=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const i=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let g=0,b=0;g<this._coordsTextureSize;g++)for(let S=0;S<this._coordsTextureSize;S++,b+=4)i[b+0]=255&S,i[b+1]=255&g,i[b+2]=S>>8<<4|g>>8,i[b+3]=0;const c=new s.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),p=new s.T(t,c,t.gl.RGBA,{premultiply:!1});return p.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=p,p}pointCoordinate(t){this.painter.maybeDrawDepthAndCoords(!0);const i=new Uint8Array(4),c=this.painter.context,p=c.gl,g=Math.round(t.x*this.painter.pixelRatio/devicePixelRatio),b=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),S=Math.round(this.painter.height/devicePixelRatio);c.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),p.readPixels(g,S-b-1,1,1,p.RGBA,p.UNSIGNED_BYTE,i),c.bindFramebuffer.set(null);const P=i[0]+(i[2]>>4<<8),A=i[1]+((15&i[2])<<8),k=this.coordsIndex[255-i[3]],F=k&&this.tileManager.getTileByID(k);if(!F)return null;const z=this._coordsTextureSize,j=(1<<F.tileID.canonical.z)*z;return new s.a9((F.tileID.canonical.x*z+P)/j+F.tileID.wrap,(F.tileID.canonical.y*z+A)/j,this.getElevation(F.tileID,P,A,z))}depthAtPoint(t){const i=new Uint8Array(4),c=this.painter.context,p=c.gl;return c.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),p.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,p.RGBA,p.UNSIGNED_BYTE,i),c.bindFramebuffer.set(null),(i[0]/16777216+i[1]/65536+i[2]/256+i[3])/256}getTerrainMesh(t){var i;const c=((i=this.painter.style.projection)===null||i===void 0?void 0:i.transitionState)>0,p=c&&t.canonical.y===0,g=c&&t.canonical.y===(1<<t.canonical.z)-1,b=`m_${p?"n":""}_${g?"s":""}`;if(this._meshCache[b])return this._meshCache[b];const S=this.painter.context,P=new s.cF,A=new s.aY,k=this.meshSize,F=s.a5/k,z=k*k;for(let ce=0;ce<=k;ce++)for(let ve=0;ve<=k;ve++)P.emplaceBack(ve*F,ce*F,0);for(let ce=0;ce<z;ce+=k+1)for(let ve=0;ve<k;ve++)A.emplaceBack(ve+ce,k+ve+ce+1,k+ve+ce+2),A.emplaceBack(ve+ce,k+ve+ce+2,ve+ce+1);const j=P.length,G=j+(k+1),Y=(k+1)*k,Q=p?s.br:0,K=p?0:1,oe=g?s.bs:s.a5,de=g?0:1;for(let ce=0;ce<=k;ce++)P.emplaceBack(ce*F,Q,K);for(let ce=0;ce<=k;ce++)P.emplaceBack(ce*F,oe,de);for(let ce=0;ce<k;ce++)A.emplaceBack(Y+ce,G+ce,G+ce+1),A.emplaceBack(Y+ce,G+ce+1,Y+ce+1),A.emplaceBack(0+ce,j+ce+1,j+ce),A.emplaceBack(0+ce,0+ce+1,j+ce+1);const ie=P.length,he=ie+2*(k+1);for(const ce of[0,1])for(let ve=0;ve<=k;ve++)for(const Fe of[0,1])P.emplaceBack(ce*s.a5,ve*F,Fe);for(let ce=0;ce<2*k;ce+=2)A.emplaceBack(ie+ce,ie+ce+1,ie+ce+3),A.emplaceBack(ie+ce,ie+ce+3,ie+ce+2),A.emplaceBack(he+ce,he+ce+3,he+ce+1),A.emplaceBack(he+ce,he+ce+2,he+ce+3);const ge=new yr(S.createVertexBuffer(P,Of.members),S.createIndexBuffer(A),s.aX.simpleSegment(0,0,P.length,A.length));return this._meshCache[b]=ge,ge}getMeshFrameDelta(t){return 2*Math.PI*s.bE/Math.pow(2,Math.max(t,0))/5}getMinTileElevationForLngLatZoom(t,i){var c;if(!s.cD(i,t.wrap()))return 0;const{tileID:p}=this._getOverscaledTileIDFromLngLatZoom(t,i);return(c=this.getMinMaxElevation(p).minElevation)!==null&&c!==void 0?c:0}getMinMaxElevation(t){const i=this.getTerrainData(t).tile,c={minElevation:null,maxElevation:null};return i&&i.dem&&(c.minElevation=i.dem.min*this.exaggeration,c.maxElevation=i.dem.max*this.exaggeration),c}_getOverscaledTileIDFromLngLatZoom(t,i){const c=s.a9.fromLngLat(t.wrap()),p=(1<<i)*s.a5,g=c.x*p,b=c.y*p,S=Math.floor(g/s.a5),P=Math.floor(b/s.a5);return{tileID:new s.a2(i,0,i,S,P),mercatorX:g,mercatorY:b}}}class Wr{constructor(t,i,c){this._context=t,this._size=i,this._tileSize=c,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){const i=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),c=new s.T(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return c.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(c.texture),{id:t,fbo:i,texture:c,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter((i=>t.id!==i)),this._recentlyUsed.push(t.id)}stampObject(t){t.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 t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length<this._size)&&this._objects.some((t=>!t.inUse))===!1}}const Ja={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};class Ns{constructor(t,i){this.painter=t,this.terrain=i,this.pool=new Wr(t.context,30,i.tileManager.tileSize*i.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,i){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=t._order.filter((c=>!t._layers[c].isHidden(i))),this._coordsAscending={};for(const c in t.tileManagers){this._coordsAscending[c]={};const p=t.tileManagers[c].getVisibleCoordinates(),g=t.tileManagers[c].getSource(),b=g instanceof on?g.terrainTileRanges:null;for(const S of p){const P=this.terrain.tileManager.getTerrainCoords(S,b);for(const A in P)this._coordsAscending[c][A]||(this._coordsAscending[c][A]=[]),this._coordsAscending[c][A].push(P[A])}}this._coordsAscendingStr={};for(const c of t._order){const p=t._layers[c],g=p.source;if(Ja[p.type]&&!this._coordsAscendingStr[g]){this._coordsAscendingStr[g]={};for(const b in this._coordsAscending[g])this._coordsAscendingStr[g][b]=this._coordsAscending[g][b].map((S=>S.key)).sort().join()}}for(const c of this._renderableTiles)for(const p in this._coordsAscendingStr){const g=this._coordsAscendingStr[p][c.tileID.key];g&&g!==c.rttCoords[p]&&(c.rtt=[])}}renderLayer(t,i){if(t.isHidden(this.painter.transform.zoom))return!1;const c=Object.assign(Object.assign({},i),{isRenderingToTexture:!0}),p=t.type,g=this.painter,b=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(Ja[p]&&(this._prevType&&Ja[this._prevType]||this._stacks.push([]),this._prevType=p,this._stacks[this._stacks.length-1].push(t.id),!b))return!0;if(Ja[this._prevType]||Ja[p]&&b){this._prevType=p;const S=this._stacks.length-1,P=this._stacks[S]||[];for(const A of this._renderableTiles){if(this.pool.isFull()&&(vu(this.painter,this.terrain,this._rttTiles,c),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(A),A.rtt[S]){const F=this.pool.getObjectForId(A.rtt[S].id);if(F.stamp===A.rtt[S].stamp){this.pool.useObject(F);continue}}const k=this.pool.getOrCreateFreeObject();this.pool.useObject(k),this.pool.stampObject(k),A.rtt[S]={id:k.id,stamp:k.stamp},g.context.bindFramebuffer.set(k.fbo.framebuffer),g.context.clear({color:s.bp.transparent,stencil:0}),g.currentStencilSource=void 0;for(let F=0;F<P.length;F++){const z=g.style._layers[P[F]],j=z.source?this._coordsAscending[z.source][A.tileID.key]:[A.tileID];g.context.viewport.set([0,0,k.fbo.width,k.fbo.height]),g._renderTileClippingMasks(z,j,!0),g.renderLayer(g,g.style.tileManagers[z.source],z,j,c),z.source&&(A.rttCoords[z.source]=this._coordsAscendingStr[z.source][A.tileID.key])}}return vu(this.painter,this.terrain,this._rttTiles,c),this._rttTiles=[],this.pool.freeAllObjects(),Ja[p]}return!1}}const Kl={"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"},ku=I,Jl={hash:!1,interactive:!0,bearingSnap:7,attributionControl:gi,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:s.c.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,reduceMotion:void 0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,experimentalZoomLevelsToOverscale:void 0},Du={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class js{constructor(t,i,c=!1){this.mousedown=g=>{this.startMove(g,te.mousePos(this.element,g)),te.addEventListener(window,"mousemove",this.mousemove),te.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=g=>{this.move(g,te.mousePos(this.element,g))},this.mouseup=g=>{this._rotatePitchHandler.dragEnd(g),this.offTemp()},this.touchstart=g=>{g.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=te.touchPos(this.element,g.targetTouches)[0],this.startMove(g,this._startPos),te.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),te.addEventListener(window,"touchend",this.touchend))},this.touchmove=g=>{g.targetTouches.length!==1?this.reset():(this._lastPos=te.touchPos(this.element,g.targetTouches)[0],this.move(g,this._lastPos))},this.touchend=g=>{g.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._rotatePitchHandler.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=i;const p=new Ap;this._rotatePitchHandler=new Bo({clickTolerance:3,move:(g,b)=>{const S=i.getBoundingClientRect(),P=new s.P((S.bottom-S.top)/2,(S.right-S.left)/2);return{bearingDelta:s.cx(new s.P(g.x,b.y),b,P),pitchDelta:c?-.5*(b.y-g.y):void 0}},moveStateManager:p,enable:!0,assignEvents:()=>{}}),this.map=t,te.addEventListener(i,"mousedown",this.mousedown),te.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),te.addEventListener(i,"touchcancel",this.reset)}startMove(t,i){this._rotatePitchHandler.dragStart(t,i),te.disableDrag()}move(t,i){const c=this.map,{bearingDelta:p,pitchDelta:g}=this._rotatePitchHandler.dragMove(t,i)||{};p&&c.setBearing(c.getBearing()+p),g&&c.setPitch(c.getPitch()+g)}off(){const t=this.element;te.removeEventListener(t,"mousedown",this.mousedown),te.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),te.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),te.removeEventListener(window,"touchend",this.touchend),te.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){te.enableDrag(),te.removeEventListener(window,"mousemove",this.mousemove),te.removeEventListener(window,"mouseup",this.mouseup),te.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),te.removeEventListener(window,"touchend",this.touchend)}}let ea;function Ql(m,t,i,c=!1){if(c||!i.getCoveringTilesDetailsProvider().allowWorldCopies())return m==null?void 0:m.wrap();const p=new s.V(m.lng,m.lat);if(m=new s.V(m.lng,m.lat),t){const g=new s.V(m.lng-360,m.lat),b=new s.V(m.lng+360,m.lat),S=i.locationToScreenPoint(m).distSqr(t);i.locationToScreenPoint(g).distSqr(t)<S?m=g:i.locationToScreenPoint(b).distSqr(t)<S&&(m=b)}for(;Math.abs(m.lng-i.center.lng)>180;){const g=i.locationToScreenPoint(m);if(g.x>=0&&g.y>=0&&g.x<=i.width&&g.y<=i.height)break;m.lng>i.center.lng?m.lng-=360:m.lng+=360}return m.lng!==p.lng&&i.isPointOnMapSurface(i.locationToScreenPoint(m))?m:p}const Vs={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 ec(m,t,i){const c=m.classList;for(const p in Vs)c.remove(`maplibregl-${i}-anchor-${p}`);c.add(`maplibregl-${i}-anchor-${t}`)}class Us extends s.E{constructor(t){if(super(),this._onKeyPress=i=>{const c=i.code,p=i.charCode||i.keyCode;c!=="Space"&&c!=="Enter"&&p!==32&&p!==13||this.togglePopup()},this._onMapClick=i=>{const c=i.originalEvent.target,p=this._element;this._popup&&(c===p||p.contains(c))&&this.togglePopup()},this._update=i=>{if(!this._map)return;const c=this._map.loaded()&&!this._map.isMoving();((i==null?void 0:i.type)==="terrain"||(i==null?void 0:i.type)==="render"&&!c)&&this._map.once("render",this._update),this._lngLat=Ql(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 p="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?p=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(p=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let g="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?g="rotateX(0deg)":this._pitchAlignment==="map"&&(g=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||i&&i.type!=="moveend"||(this._pos=this._pos.round()),te.setTransform(this._element,`${Vs[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${g} ${p}`),ee.frameAsync(new AbortController).then((()=>{this._updateOpacity(i&&i.type==="moveend")})).catch((()=>{}))},this._onMove=i=>{if(!this._isDragging){const c=this._clickTolerance||this._map._clickTolerance;this._isDragging=i.point.dist(this._pointerdownPos)>=c}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 s.l("dragstart"))),this.fire(new s.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 s.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=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._subpixelPositioning=t&&t.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,this.setOpacity(t==null?void 0:t.opacity,t==null?void 0:t.opacityWhenCovered),t&&t.element)this._element=t.element,this._offset=s.P.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=te.create("div");const i=te.createNS("http://www.w3.org/2000/svg","svg"),c=41,p=27;i.setAttributeNS(null,"display","block"),i.setAttributeNS(null,"height",`${c}px`),i.setAttributeNS(null,"width",`${p}px`),i.setAttributeNS(null,"viewBox",`0 0 ${p} ${c}`);const g=te.createNS("http://www.w3.org/2000/svg","g");g.setAttributeNS(null,"stroke","none"),g.setAttributeNS(null,"stroke-width","1"),g.setAttributeNS(null,"fill","none"),g.setAttributeNS(null,"fill-rule","evenodd");const b=te.createNS("http://www.w3.org/2000/svg","g");b.setAttributeNS(null,"fill-rule","nonzero");const S=te.createNS("http://www.w3.org/2000/svg","g");S.setAttributeNS(null,"transform","translate(3.0, 29.0)"),S.setAttributeNS(null,"fill","#000000");const P=[{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 K of P){const oe=te.createNS("http://www.w3.org/2000/svg","ellipse");oe.setAttributeNS(null,"opacity","0.04"),oe.setAttributeNS(null,"cx","10.5"),oe.setAttributeNS(null,"cy","5.80029008"),oe.setAttributeNS(null,"rx",K.rx),oe.setAttributeNS(null,"ry",K.ry),S.appendChild(oe)}const A=te.createNS("http://www.w3.org/2000/svg","g");A.setAttributeNS(null,"fill",this._color);const k=te.createNS("http://www.w3.org/2000/svg","path");k.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"),A.appendChild(k);const F=te.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"opacity","0.25"),F.setAttributeNS(null,"fill","#000000");const z=te.createNS("http://www.w3.org/2000/svg","path");z.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"),F.appendChild(z);const j=te.createNS("http://www.w3.org/2000/svg","g");j.setAttributeNS(null,"transform","translate(6.0, 7.0)"),j.setAttributeNS(null,"fill","#FFFFFF");const G=te.createNS("http://www.w3.org/2000/svg","g");G.setAttributeNS(null,"transform","translate(8.0, 8.0)");const Y=te.createNS("http://www.w3.org/2000/svg","circle");Y.setAttributeNS(null,"fill","#000000"),Y.setAttributeNS(null,"opacity","0.25"),Y.setAttributeNS(null,"cx","5.5"),Y.setAttributeNS(null,"cy","5.5"),Y.setAttributeNS(null,"r","5.4999962");const Q=te.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"),G.appendChild(Y),G.appendChild(Q),b.appendChild(S),b.appendChild(A),b.appendChild(F),b.appendChild(j),b.appendChild(G),i.appendChild(b),i.setAttributeNS(null,"height",c*this._scale+"px"),i.setAttributeNS(null,"width",p*this._scale+"px"),this._element.appendChild(i),this._offset=s.P.convert(t&&t.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",(i=>{i.preventDefault()})),this._element.addEventListener("mousedown",(i=>{i.preventDefault()})),ec(this._element,this._anchor,"marker"),t&&t.className)for(const i of t.className.split(" "))this._element.classList.add(i);this._popup=null}addTo(t){return this.remove(),this._map=t,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",t._getUIString("Marker.Title")),this._element.hasAttribute("role")||this._element.setAttribute("role","button"),t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),t.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),te.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=s.V.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const p=Math.abs(13.5)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[p,-1*(38.1-13.5+p)],"bottom-right":[-p,-1*(38.1-13.5+p)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(t){return this._subpixelPositioning=t,this}getPopup(){return this._popup}togglePopup(){const t=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:t?(t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map)),this):this}_updateOpacity(t=!1){var i,c;const p=(i=this._map)===null||i===void 0?void 0:i.terrain,g=this._map.transform.isLocationOccluded(this._lngLat);if(!p||g){const j=g?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==j&&(this._element.style.opacity=j))}if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout((()=>{this._opacityTimeout=null}),100)}const b=this._map,S=b.terrain.depthAtPoint(this._pos),P=b.terrain.getElevationForLngLat(this._lngLat,b.transform);if(b.transform.lngLatToCameraDepth(this._lngLat,P)-S<.006)return void(this._element.style.opacity=this._opacity);const A=-this._offset.y/b.transform.pixelsPerMeter,k=Math.sin(b.getPitch()*Math.PI/180)*A,F=b.terrain.depthAtPoint(new s.P(this._pos.x,this._pos.y-this._offset.y)),z=b.transform.lngLatToCameraDepth(this._lngLat,P+k)-F>.006;!((c=this._popup)===null||c===void 0)&&c.isOpen()&&z&&this._popup.remove(),this._element.style.opacity=z?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(t){return this._offset=s.P.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(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(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,i){return(this._opacity===void 0||t===void 0&&i===void 0)&&(this._opacity="1",this._opacityWhenCovered="0.2"),t!==void 0&&(this._opacity=t),i!==void 0&&(this._opacityWhenCovered=i),this._map&&this._updateOpacity(!0),this}}const Lu={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let jo=0,Qa=!1;const Ru={maxWidth:100,unit:"metric"};function $s(m,t,i){const c=i&&i.maxWidth||100,p=m._container.clientHeight/2,g=m._container.clientWidth/2,b=m.unproject([g-c/2,p]),S=m.unproject([g+c/2,p]),P=Math.round(m.project(S).x-m.project(b).x),A=Math.min(c,P,m._container.clientWidth),k=b.distanceTo(S);if(i&&i.unit==="imperial"){const F=3.2808*k;F>5280?eo(t,A,F/5280,m._getUIString("ScaleControl.Miles")):eo(t,A,F,m._getUIString("ScaleControl.Feet"))}else i&&i.unit==="nautical"?eo(t,A,k/1852,m._getUIString("ScaleControl.NauticalMiles")):k>=1e3?eo(t,A,k/1e3,m._getUIString("ScaleControl.Kilometers")):eo(t,A,k,m._getUIString("ScaleControl.Meters"))}function eo(m,t,i,c){const p=(function(g){const b=Math.pow(10,`${Math.floor(g)}`.length-1);let S=g/b;return S=S>=10?10:S>=5?5:S>=3?3:S>=2?2:S>=1?1:(function(P){const A=Math.pow(10,Math.ceil(-Math.log(P)/Math.LN10));return Math.round(P*A)/A})(S),b*S})(i);m.style.width=t*(p/i)+"px",m.innerHTML=`${p}&nbsp;${c}`}const zu={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0,padding:void 0},tc=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function rc(m){if(m){if(typeof m=="number"){const t=Math.round(Math.abs(m)/Math.SQRT2);return{center:new s.P(0,0),top:new s.P(0,m),"top-left":new s.P(t,t),"top-right":new s.P(-t,t),bottom:new s.P(0,-m),"bottom-left":new s.P(t,-t),"bottom-right":new s.P(-t,-t),left:new s.P(m,0),right:new s.P(-m,0)}}if(m instanceof s.P||Array.isArray(m)){const t=s.P.convert(m);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:s.P.convert(m.center||[0,0]),top:s.P.convert(m.top||[0,0]),"top-left":s.P.convert(m["top-left"]||[0,0]),"top-right":s.P.convert(m["top-right"]||[0,0]),bottom:s.P.convert(m.bottom||[0,0]),"bottom-left":s.P.convert(m["bottom-left"]||[0,0]),"bottom-right":s.P.convert(m["bottom-right"]||[0,0]),left:s.P.convert(m.left||[0,0]),right:s.P.convert(m.right||[0,0])}}return rc(new s.P(0,0))}const Fu=I;v.AJAXError=s.cI,v.Event=s.l,v.Evented=s.E,v.LngLat=s.V,v.MercatorCoordinate=s.a9,v.Point=s.P,v.addProtocol=s.cJ,v.config=s.c,v.removeProtocol=s.cK,v.AttributionControl=Cu,v.BoxZoomHandler=Oo,v.CanvasSource=q,v.CooperativeGesturesHandler=gt,v.DoubleClickZoomHandler=Au,v.DragPanHandler=zp,v.DragRotateHandler=Mi,v.EdgeInsets=xo,v.FullscreenControl=class extends s.E{constructor(m={}){super(),this._onFullscreenChange=()=>{var t;let i=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((t=i==null?void 0:i.shadowRoot)===null||t===void 0)&&t.fullscreenElement;)i=i.shadowRoot.fullscreenElement;i===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,m&&m.container&&(m.container instanceof HTMLElement?this._container=m.container:s.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(m){return this._map=m,this._container||(this._container=this._map.getContainer()),this._controlContainer=te.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){te.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const m=this._fullscreenButton=te.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);te.create("span","maplibregl-ctrl-icon",m).setAttribute("aria-hidden","true"),m.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const m=this._getTitle();this._fullscreenButton.setAttribute("aria-label",m),this._fullscreenButton.title=m}_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 s.l("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new s.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()}},v.GeoJSONSource=On,v.GeolocateControl=class extends s.E{constructor(m){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new s.l("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_E
811RROR":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(t),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new s.l("geolocate",t)),this._finish()}},this._updateCamera=t=>{const i=new s.V(t.coords.longitude,t.coords.latitude),c=t.coords.accuracy,p=this._map.getBearing(),g=s.e({bearing:p},this.options.fitBoundsOptions),b=Kt.fromLngLat(i,c);this._map.fitBounds(b,g,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const i=new s.V(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=t.coords.accuracy,this._updateCircleRadiusIfNeeded()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onUpdate=()=>{this._updateCircleRadiusIfNeeded()},this._onError=t=>{if(this._map){if(t.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(t.code===3&&Qa)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new s.l("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this._geolocateButton=te.create("button","maplibregl-ctrl-geolocate",this._container),te.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=t=>{if(this._map){if(t===!1){s.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=te.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Us({element:this._dotElement}),this._circleElement=te.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Us({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onUpdate),this._map.on("move",this._onUpdate),this._map.on("rotate",this._onUpdate),this._map.on("pitch",this._onUpdate)),this._geolocateButton.addEventListener("click",(()=>this.trigger())),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(i=>{const c=(i==null?void 0:i[0])instanceof ResizeObserverEntry;i.geolocateSource||this._watchState!=="ACTIVE_LOCK"||c||this._map.isZooming()||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new s.l("trackuserlocationend")),this.fire(new s.l("userlocationlostfocus")))}))}},this.options=s.e({},Lu,m)}onAdd(m){return this._map=m,this._container=te.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),(function(){return s._(this,arguments,void 0,(function*(t=!1){if(ea!==void 0&&!t)return ea;if(window.navigator.permissions===void 0)return ea=!!window.navigator.geolocation,ea;try{ea=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{ea=!!window.navigator.geolocation}return ea}))})().then((t=>this._finishSetupUI(t))),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(),te.remove(this._container),this._map.off("zoom",this._onUpdate),this._map.off("move",this._onUpdate),this._map.off("rotate",this._onUpdate),this._map.off("pitch",this._onUpdate),this._map=void 0,jo=0,Qa=!1}_isOutOfMapMaxBounds(m){const t=this._map.getMaxBounds(),i=m.coords;return t&&(i.longitude<t.getWest()||i.longitude>t.getEast()||i.latitude<t.getSouth()||i.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_E
811RROR",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":case"BACKGROUND_ERROR":case"OFF":case void 0:break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadiusIfNeeded(){const m=this._userLocationDotMarker.getLngLat();if(!(this.options.showUserLocation&&this.options.showAccuracyCircle&&this._accuracy&&m))return;const t=this._map.project(m),i=this._map.unproject([t.x+100,t.y]),c=m.distanceTo(i)/100,p=2*this._accuracy/c;this._circleElement.style.width=`${p.toFixed(2)}px`,this._circleElement.style.height=`${p.toFixed(2)}px`}trigger(){if(!this._setup)return s.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 s.l("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":jo--,Qa=!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 s.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 s.l("trackuserlocationstart")),this.fire(new s.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 m;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),jo++,jo>1?(m={maximumAge:6e5,timeout:0},Qa=!0):(m=this.options.positionOptions,Qa=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,m)}}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)}},v.GlobeControl=class{constructor(){this._toggleProjection=()=>{var m;const t=(m=this._map.getProjection())===null||m===void 0?void 0:m.type;this._map.setProjection(t!=="mercator"&&t?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var m;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),((m=this._map.getProjection())===null||m===void 0?void 0:m.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(m){return this._map=m,this._container=te.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=te.create("button","maplibregl-ctrl-globe",this._container),te.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(){te.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}}
vendor: 22,963 bytes, line 811
811,v.Hash=wu,v.ImageSource=on,v.KeyboardHandler=dr,v.LngLatBounds=Kt,v.LogoControl=Fp,v.Map=class extends qn{constructor(m){var t,i;s.cG.mark(s.cH.create);const c=Object.assign(Object.assign(Object.assign({},Jl),m),{canvasContextAttributes:Object.assign(Object.assign({},Jl.canvasContextAttributes),m.canvasContextAttributes)});if(c.minZoom!=null&&c.maxZoom!=null&&c.minZoom>c.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(c.minPitch!=null&&c.maxPitch!=null&&c.minPitch>c.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(c.minPitch!=null&&c.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(c.maxPitch!=null&&c.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const p=new Va,g=new Ua;if(c.minZoom!==void 0&&p.setMinZoom(c.minZoom),c.maxZoom!==void 0&&p.setMaxZoom(c.maxZoom),c.minPitch!==void 0&&p.setMinPitch(c.minPitch),c.maxPitch!==void 0&&p.setMaxPitch(c.maxPitch),c.renderWorldCopies!==void 0&&p.setRenderWorldCopies(c.renderWorldCopies),c.transformConstrain!==null&&p.setConstrainOverride(c.transformConstrain),super(p,g,{bearingSnap:c.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Ff,this._controls=[],this._mapId=s.af(),this._lostContextStyle={style:null,images:null},this._contextLost=S=>{S.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.painter.destroy();for(const P of Object.values(this.style._layers))if(P.type==="custom"&&console.warn(`Custom layer with id '${P.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),P._listeners)for(const[A]of Object.entries(P._listeners))console.warn(`Custom layer with id '${P.id}' had event listeners for event '${A}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);this._lostContextStyle=this._getStyleAndImages(),this.style.destroy(),this.style=null,this.fire(new s.l("webglcontextlost",{originalEvent:S}))},this._contextRestored=S=>{this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&(this.style.imageManager.images=this._lostContextStyle.images),this._lostContextStyle={style:null,images:null},this._setupPainter(),this.resize(),this._update(),this._resizeInternal(),this.fire(new s.l("webglcontextrestored",{originalEvent:S}))},this._onMapScroll=S=>{if(S.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=c.interactive,this._maxTileCacheSize=c.maxTileCacheSize,this._maxTileCacheZoomLevels=c.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},c.canvasContextAttributes),this._trackResize=c.trackResize===!0,this._bearingSnap=c.bearingSnap,this._centerClampedToGround=c.centerClampedToGround,this._refreshExpiredTiles=c.refreshExpiredTiles===!0,this._fadeDuration=c.fadeDuration,this._crossSourceCollisions=c.crossSourceCollisions===!0,this._collectResourceTiming=c.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},Kl),c.locale),this._clickTolerance=c.clickTolerance,this._overridePixelRatio=c.pixelRatio,this._maxCanvasSize=c.maxCanvasSize,this._zoomLevelsToOverscale=c.experimentalZoomLevelsToOverscale,this.transformCameraUpdate=c.transformCameraUpdate,this.transformConstrain=c.transformConstrain,this.cancelPendingTileRequestsWhileZooming=c.cancelPendingTileRequestsWhileZooming===!0,c.reduceMotion!==void 0&&(ee.prefersReducedMotion=c.reduceMotion),this._imageQueueHandle=Ie.addThrottleControl((()=>this.isMoving())),this._requestManager=new Ze(c.transformRequest),typeof c.container=="string"){if(this._container=document.getElementById(c.container),!this._container)throw new Error(`Container '${c.container}' not found.`)}else{if(!(c.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=c.container}if(c.maxBounds&&this.setMaxBounds(c.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 S=!1;const P=bu((A=>{this._trackResize&&!this._removed&&(this.resize(A),this.redraw())}),50);this._resizeObserver=new ResizeObserver((A=>{S?P(A):S=!0})),this._resizeObserver.observe(this._container)}this.handlers=new Yl(this,c),this._hash=c.hash&&new wu(typeof c.hash=="string"&&c.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:c.center,elevation:c.elevation,zoom:c.zoom,bearing:c.bearing,pitch:c.pitch,roll:c.roll}),c.bounds&&(this.resize(),this.fitBounds(c.bounds,s.e({},c.fitBoundsOptions,{duration:0}))));const b=typeof c.style=="string"||((i=(t=c.style)===null||t===void 0?void 0:t.projection)===null||i===void 0?void 0:i.type)!=="globe";this.resize(null,b),this._localIdeographFontFamily=c.localIdeographFontFamily,this._validateStyle=c.validateStyle,c.style&&this.setStyle(c.style,{localIdeographFontFamily:c.localIdeographFontFamily}),c.attributionControl&&this.addControl(new Cu(typeof c.attributionControl=="boolean"?void 0:c.attributionControl)),c.maplibreLogo&&this.addControl(new Fp,c.logoPosition),this.on("style.load",(()=>{if(b||this._resizeTransform(),this.transform.unmodified){const S=s.U(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(S)}})),this.on("data",(S=>{this._update(S.dataType==="style"),this.fire(new s.l(`${S.dataType}data`,S))})),this.on("dataloading",(S=>{this.fire(new s.l(`${S.dataType}dataloading`,S))})),this.on("dataabort",(S=>{this.fire(new s.l("sourcedataabort",S))}))}_getMapId(){return this._mapId}setGlobalStateProperty(m,t){return this.style.setGlobalStateProperty(m,t),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(m,t){if(t===void 0&&(t=m.getDefaultPosition?m.getDefaultPosition():"top-right"),!m||!m.onAdd)return this.fire(new s.k(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const i=m.onAdd(this);this._controls.push(m);const c=this._controlPositions[t];return t.indexOf("bottom")!==-1?c.insertBefore(i,c.firstChild):c.appendChild(i),this}removeControl(m){if(!m||!m.onRemove)return this.fire(new s.k(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(m);return t>-1&&this._controls.splice(t,1),m.onRemove(this),this}hasControl(m){return this._controls.indexOf(m)>-1}coveringTiles(m){return Or(this.transform,m)}calculateCameraOptionsFromTo(m,t,i,c){return c==null&&this.terrain&&(c=this.terrain.getElevationForLngLat(i,this.transform)),super.calculateCameraOptionsFromTo(m,t,i,c)}resize(m,t=!0){if(this._lostContextStyle.style!==null)return this;this._resizeInternal(t);const i=!this._moving;return i&&(this.stop(),this.fire(new s.l("movestart",m)).fire(new s.l("move",m))),this.fire(new s.l("resize",m)),i&&this.fire(new s.l("moveend",m)),this}_resizeInternal(m=!0){const[t,i]=this._containerDimensions(),c=this._getClampedPixelRatio(t,i);if(this._resizeCanvas(t,i,c),this.painter.resize(t,i,c),this.painter.overLimit()){const p=this.painter.context.gl;this._maxCanvasSize=[p.drawingBufferWidth,p.drawingBufferHeight];const g=this._getClampedPixelRatio(t,i);this._resizeCanvas(t,i,g),this.painter.resize(t,i,g)}this._resizeTransform(m)}_resizeTransform(m=!0){var t;const[i,c]=this._containerDimensions();this.transform.resize(i,c,m),(t=this._requestedCameraState)===null||t===void 0||t.resize(i,c,m)}_getClampedPixelRatio(m,t){const{0:i,1:c}=this._maxCanvasSize,p=this.getPixelRatio(),g=m*p,b=t*p;return Math.min(g>i?i/g:1,b>c?c/b:1)*p}getPixelRatio(){var m;return(m=this._overridePixelRatio)!==null&&m!==void 0?m:devicePixelRatio}setPixelRatio(m){this._overridePixelRatio=m,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(m){return this.transform.setMaxBounds(Kt.convert(m)),this._update()}setMinZoom(m){if((m=m??-2)>=-2&&m<=this.transform.maxZoom){const t=this._getTransformForUpdate();return t.setMinZoom(m),this._applyUpdatedTransform(t),this._update(),this}throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(m){if((m=m??22)>=this.transform.minZoom){const t=this._getTransformForUpdate();return t.setMaxZoom(m),this._applyUpdatedTransform(t),this._update(),this}throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(m){if((m=m??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(m>=0&&m<=this.transform.maxPitch)return this.transform.setMinPitch(m),this._update(),this.getPitch()<m&&this.setPitch(m),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(m){if((m=m??60)>180)throw new Error("maxPitch must be less than or equal to 180");if(m>=this.transform.minPitch)return this.transform.setMaxPitch(m),this._update(),this.getPitch()>m&&this.setPitch(m),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(m){return this.transform.setRenderWorldCopies(m),this._update()}setTransformConstrain(m){return this.transform.setConstrainOverride(m),this._update()}project(m){return this.transform.locationToScreenPoint(s.V.convert(m),this.style&&this.terrain)}unproject(m){return this.transform.screenPointToLocation(s.P.convert(m),this.terrain)}isMoving(){var m;return this._moving||((m=this.handlers)===null||m===void 0?void 0:m.isMoving())}isZooming(){var m;return this._zooming||((m=this.handlers)===null||m===void 0?void 0:m.isZooming())}isRotating(){var m;return this._rotating||((m=this.handlers)===null||m===void 0?void 0:m.isRotating())}_createDelegatedListener(m,t,i){if(m==="mouseenter"||m==="mouseover"){let c=!1;return{layers:t,listener:i,delegates:{mousemove:g=>{const b=t.filter((P=>this.getLayer(P))),S=b.length!==0?this.queryRenderedFeatures(g.point,{layers:b}):[];S.length?c||(c=!0,i.call(this,new vn(m,this,g.originalEvent,{features:S}))):c=!1},mouseout:()=>{c=!1}}}}if(m==="mouseleave"||m==="mouseout"){let c=!1;return{layers:t,listener:i,delegates:{mousemove:b=>{const S=t.filter((P=>this.getLayer(P)));(S.length!==0?this.queryRenderedFeatures(b.point,{layers:S}):[]).length?c=!0:c&&(c=!1,i.call(this,new vn(m,this,b.originalEvent)))},mouseout:b=>{c&&(c=!1,i.call(this,new vn(m,this,b.originalEvent)))}}}}{const c=p=>{const g=t.filter((S=>this.getLayer(S))),b=g.length!==0?this.queryRenderedFeatures(p.point,{layers:g}):[];b.length&&(p.features=b,i.call(this,p),delete p.features)};return{layers:t,listener:i,delegates:{[m]:c}}}}_saveDelegatedListener(m,t){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[m]=this._delegatedListeners[m]||[],this._delegatedListeners[m].push(t)}_removeDelegatedListener(m,t,i){if(!this._delegatedListeners||!this._delegatedListeners[m])return;const c=this._delegatedListeners[m];for(let p=0;p<c.length;p++){const g=c[p];if(g.listener===i&&g.layers.length===t.length&&g.layers.every((b=>t.includes(b)))){for(const b in g.delegates)this.off(b,g.delegates[b]);return void c.splice(p,1)}}}on(m,t,i){if(i===void 0)return super.on(m,t);const c=typeof t=="string"?[t]:t,p=this._createDelegatedListener(m,c,i);this._saveDelegatedListener(m,p);for(const g in p.delegates)this.on(g,p.delegates[g]);return{unsubscribe:()=>{this._removeDelegatedListener(m,c,i)}}}once(m,t,i){if(i===void 0)return super.once(m,t);const c=typeof t=="string"?[t]:t,p=this._createDelegatedListener(m,c,i);for(const g in p.delegates){const b=p.delegates[g];p.delegates[g]=(...S)=>{this._removeDelegatedListener(m,c,i),b(...S)}}this._saveDelegatedListener(m,p);for(const g in p.delegates)this.once(g,p.delegates[g]);return this}off(m,t,i){return i===void 0?super.off(m,t):(this._removeDelegatedListener(m,typeof t=="string"?[t]:t,i),this)}queryRenderedFeatures(m,t){if(!this.style)return[];let i;const c=m instanceof s.P||Array.isArray(m),p=c?m:[[0,0],[this.transform.width,this.transform.height]];if(t=t||(c?{}:m)||{},p instanceof s.P||typeof p[0]=="number")i=[s.P.convert(p)];else{const g=s.P.convert(p[0]),b=s.P.convert(p[1]);i=[g,new s.P(b.x,g.y),b,new s.P(g.x,b.y),g]}return this.style.queryRenderedFeatures(i,t,this.transform)}querySourceFeatures(m,t){return this.style.querySourceFeatures(m,t)}setStyle(m,t){return(t=s.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},t)).diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&m?(this._diffStyle(m,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(m,t))}setTransformRequest(m){return this._requestManager.setTransformRequest(m),this}_getUIString(m){const t=this._locale[m];if(t==null)throw new Error(`Missing UI string '${m}'`);return t}_updateStyle(m,t){var i,c;if(t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",(()=>this._updateStyle(m,t)));const p=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!m)),m?(this.style=new qa(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof m=="string"?this.style.loadURL(m,t,p):this.style.loadJSON(m,t,p),this):((c=(i=this.style)===null||i===void 0?void 0:i.projection)===null||c===void 0||c.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new qa(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(m,t){if(typeof m=="string"){const i=this._requestManager.transformRequest(m,"Style");s.j(i,new AbortController).then((c=>{this._updateDiff(c.data,t)})).catch((c=>{c&&this.fire(new s.k(c))}))}else typeof m=="object"&&this._updateDiff(m,t)}_updateDiff(m,t){try{this.style.setState(m,t)&&this._update(!0)}catch(i){s.w(`Unable to perform style diff: ${i.message||i.error||i}.  Rebuilding the style from scratch.`),this._updateStyle(m,t)}}getStyle(){if(this.style)return this.style.serialize()}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){return this.style?this.style.loaded():s.w("There is no style added to the map.")}addSource(m,t){return this._lazyInitEmptyStyle(),this.style.addSource(m,t),this._update(!0)}isSourceLoaded(m){const t=this.style&&this.style.tileManagers[m];if(t!==void 0)return t.loaded();this.fire(new s.k(new Error(`There is no tile manager with ID '${m}'`)))}setTerrain(m){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),m){const t=this.style.tileManagers[m.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${m.source}`);this.terrain===null&&t.reload();for(const i in this.style._layers){const c=this.style._layers[i];c.type==="hillshade"&&c.source===m.source&&s.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."),c.type==="color-relief"&&c.source===m.source&&s.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 zr(this.painter,t,m),this.painter.renderToTexture=new Ns(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 c;i.dataType==="style"?this.terrain.tileManager.freeRtt():i.dataType==="source"&&i.tile&&(i.sourceId!==m.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))),((c=i.source)===null||c===void 0?void 0:c.type)==="image"?this.terrain.tileManager.freeRtt():this.terrain.tileManager.freeRtt(i.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.tileManager.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 s.l("terrain",{terrain:m})),this}getTerrain(){var m,t;return(t=(m=this.terrain)===null||m===void 0?void 0:m.options)!==null&&t!==void 0?t:null}areTilesLoaded(){const m=this.style&&this.style.tileManagers;for(const t of Object.values(m))if(!t.areTilesLoaded())return!1;return!0}removeSource(m){return this.style.removeSource(m),this._update(!0)}getSource(m){return this.style.getSource(m)}setSourceTileLodParams(m,t,i){if(i){const c=this.getSource(i);if(!c)throw new Error(`There is no source with ID "${i}", cannot set LOD parameters`);c.calculateTileZoom=tr(Math.max(1,m),Math.max(1,t))}else for(const c in this.style.tileManagers)this.style.tileManagers[c].getSource().calculateTileZoom=tr(Math.max(1,m),Math.max(1,t));return this._update(!0),this}refreshTiles(m,t){const i=this.style.tileManagers[m];if(!i)throw new Error(`There is no tile manager with ID "${m}", cannot refresh tile`);t===void 0?i.reload(!0):i.refreshTiles(t.map((c=>new s.ac(c.z,c.x,c.y))))}addImage(m,t,i={}){const{pixelRatio:c=1,sdf:p=!1,stretchX:g,stretchY:b,content:S,textFitWidth:P,textFitHeight:A}=i;if(this._lazyInitEmptyStyle(),!(t instanceof HTMLImageElement||s.b(t))){if(t.width===void 0||t.height===void 0)return this.fire(new s.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:k,height:F,data:z}=t,j=t;return this.style.addImage(m,{data:new s.R({width:k,height:F},new Uint8Array(z)),pixelRatio:c,stretchX:g,stretchY:b,content:S,textFitWidth:P,textFitHeight:A,sdf:p,version:0,userImage:j}),j.onAdd&&j.onAdd(this,m),this}}{const{width:k,height:F,data:z}=ee.getImageData(t);this.style.addImage(m,{data:new s.R({width:k,height:F},z),pixelRatio:c,stretchX:g,stretchY:b,content:S,textFitWidth:P,textFitHeight:A,sdf:p,version:0})}}updateImage(m,t){const i=this.style.getImage(m);if(!i)return this.fire(new s.k(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const c=t instanceof HTMLImageElement||s.b(t)?ee.getImageData(t):t,{width:p,height:g,data:b}=c;if(p===void 0||g===void 0)return this.fire(new s.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(p!==i.data.width||g!==i.data.height)return this.fire(new s.k(new Error("The width and height of the updated image must be that same as the previous version of the image")));const S=!(t instanceof HTMLImageElement||s.b(t));return i.data.replace(b,S),this.style.updateImage(m,i),this}getImage(m){return this.style.getImage(m)}hasImage(m){return m?!!this.style.getImage(m):(this.fire(new s.k(new Error("Missing required image id"))),!1)}removeImage(m){this.style.removeImage(m)}loadImage(m){return Ie.getImage(this._requestManager.transformRequest(m,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(m,t){return this._lazyInitEmptyStyle(),this.style.addLayer(m,t),this._update(!0)}moveLayer(m,t){return this.style.moveLayer(m,t),this._update(!0)}removeLayer(m){return this.style.removeLayer(m),this._update(!0)}getLayer(m){return this.style.getLayer(m)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(m,t,i){return this.style.setLayerZoomRange(m,t,i),this._update(!0)}setFilter(m,t,i={}){return this.style.setFilter(m,t,i),this._update(!0)}getFilter(m){return this.style.getFilter(m)}setPaintProperty(m,t,i,c={}){return this.style.setPaintProperty(m,t,i,c),this._update(!0)}getPaintProperty(m,t){return this.style.getPaintProperty(m,t)}setLayoutProperty(m,t,i,c={}){return this.style.setLayoutProperty(m,t,i,c),this._update(!0)}getLayoutProperty(m,t){return this.style.getLayoutProperty(m,t)}setGlyphs(m,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(m,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(m,t,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(m,t,i,(c=>{c||this._update(!0)})),this}removeSprite(m){return this._lazyInitEmptyStyle(),this.style.removeSprite(m),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(m,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(m,t,(i=>{i||this._update(!0)})),this}setLight(m,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(m,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(m,t={}){return this._lazyInitEmptyStyle(),this.style.setSky(m,t),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(m,t){return this.style.setFeatureState(m,t),this._update()}removeFeatureState(m,t){return this.style.removeFeatureState(m,t),this._update()}getFeatureState(m){return this.style.getFeatureState(m)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let m=0,t=0;return this._container&&(m=this._container.clientWidth||400,t=this._container.clientHeight||300),[m,t]}_setupContainer(){const m=this._container;m.classList.add("maplibregl-map");const t=this._canvasContainer=te.create("div","maplibregl-canvas-container",m);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=te.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","regi
811on");const i=this._containerDimensions(),c=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],c);const p=this._controlContainer=te.create("div","maplibregl-control-container",m),g=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((b=>{g[b]=te.create("div",`maplibregl-ctrl-${b} `,p)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(m,t,i){this._canvas.width=Math.floor(i*m),this._canvas.height=Math.floor(i*t),this._canvas.style.width=`${m}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const m=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let t=null;this._canvas.addEventListener("webglcontextcreationerror",(c=>{t={requestedAttributes:m},c&&(t.statusMessage=c.statusMessage,t.type=c.type)}),{once:!0});let i=null;if(i=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,m):this._canvas.getContext("webgl2",m)||this._canvas.getContext("webgl",m),!i){const c="Failed to initialize WebGL";throw t?(t.message=c,new Error(JSON.stringify(t))):new Error(c)}this.painter=new Ep(i,this.transform),Be.testSupport(i)}migrateProjection(m,t){super.migrateProjection(m,t),this.painter.transform=m,this.fire(new s.l("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(m){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||m,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(m){return this._update(),this._renderTaskQueue.add(m)}_cancelRenderFrame(m){this._renderTaskQueue.remove(m)}_render(m){var t,i,c,p,g;const b=this._idleTriggered?this._fadeDuration:0,S=((t=this.style.projection)===null||t===void 0?void 0:t.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(m),this._removed)return;let P=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const F=this.transform.zoom,z=fe();this.style.zoomHistory.update(F,z);const j=new s.H(F,{now:z,fadeDuration:b,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),G=j.crossFadingFactor();G===1&&G===this._crossFadingFactor||(P=!0,this._crossFadingFactor=G),this.style.update(j)}const A=((i=this.style.projection)===null||i===void 0?void 0:i.transitionState)>0!==S;(c=this.style.projection)===null||c===void 0||c.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState((p=this.style.projection)===null||p===void 0?void 0:p.transitionState,(g=this.style.projection)===null||g===void 0?void 0:g.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||A)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.tileManager.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,b,this._crossSourceCollisions,A),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:b,showPadding:this.showPadding}),this.fire(new s.l("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,s.cG.mark(s.cH.load),this.fire(new s.l("load"))),this.style&&(this.style.hasTransitions()||P)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const k=this._sourcesDirty||this._styleDirty||this._placementDirty;return k||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new s.l("idle")),!this._loaded||this._fullyLoaded||k||(this._fullyLoaded=!0,s.cG.mark(s.cH.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var m;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),Ie.removeThrottleControl(this._imageQueueHandle),(m=this._resizeObserver)===null||m===void 0||m.disconnect();const t=this.painter.context.gl.getExtension("WEBGL_lose_context");t!=null&&t.loseContext&&t.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),te.remove(this._canvasContainer),te.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),s.cG.clearMetrics(),this._removed=!0,this.fire(new s.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,ee.frame(this._frameRequest,(m=>{s.cG.frame(m),this._frameRequest=null;try{this._render(m)}catch(t){if(!s.Z(t)&&!(function(i){return i.message===mu})(t))throw t}}),(()=>{})))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(m){this._showTileBoundaries!==m&&(this._showTileBoundaries=m,this._update())}get showPadding(){return!!this._showPadding}set showPadding(m){this._showPadding!==m&&(this._showPadding=m,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(m){this._showCollisionBoxes!==m&&(this._showCollisionBoxes=m,m?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(m){this._showOverdrawInspector!==m&&(this._showOverdrawInspector=m,this._update())}get repaint(){return!!this._repaint}set repaint(m){this._repaint!==m&&(this._repaint=m,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(m){this._vertices=m,this._update()}get version(){return ku}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(m){return this._lazyInitEmptyStyle(),this.style.setProjection(m),this._update(!0)}},v.MapMouseEvent=vn,v.MapTouchEvent=ks,v.MapWheelEvent=Ip,v.Marker=Us,v.NavigationControl
vendor: 11,793 bytes, line 811
811=class{constructor(m){this._updateZoomButtons=()=>{const t=this._map.getZoom(),i=t===this._map.getMaxZoom(),c=t===this._map.getMinZoom();this._zoomInButton.disabled=i,this._zoomOutButton.disabled=c,this._zoomInButton.setAttribute("aria-disabled",i.toString()),this._zoomOutButton.setAttribute("aria-disabled",c.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=(t,i)=>{const c=this._map._getUIString(`NavigationControl.${i}`);t.title=c,t.setAttribute("aria-label",c)},this.options=s.e({},Du,m),this._container=te.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",(t=>this._map.zoomIn({},{originalEvent:t}))),te.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",(t=>this._map.zoomOut({},{originalEvent:t}))),te.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",(t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})})),this._compassIcon=te.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(m){return this._map=m,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 js(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){te.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(m,t){const i=te.create("button",m,this._container);return i.type="button",i.addEventListener("click",t),i}},v.Popup=class extends s.E{constructor(m){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&&te.remove(this._content),this._container&&(te.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 s.l("close"))),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=te.create("div","maplibregl-popup",this._map.getContainer()),this._tip=te.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const b of this.options.className.split(" "))this._container.classList.add(b);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=Ql(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),this._trackPointer&&!t)return;const i=this._flatPos=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&t?t:this._map.transform.locationToScreenPoint(this._lngLat));let c=this.options.anchor;const p=rc(this.options.offset);if(!c){const b=this._container.offsetWidth,S=this._container.offsetHeight,P=(function(k){var F,z,j,G;return k?{top:(F=k.top)!==null&&F!==void 0?F:0,right:(z=k.right)!==null&&z!==void 0?z:0,bottom:(j=k.bottom)!==null&&j!==void 0?j:0,left:(G=k.left)!==null&&G!==void 0?G:0}:{top:0,right:0,bottom:0,left:0}})(this.options.padding);let A;A=i.y+p.bottom.y<S+P.top?["top"]:i.y>this._map.transform.height-S-P.bottom?["bottom"]:[],i.x<b/2+P.left?A.push("left"):i.x>this._map.transform.width-b/2-P.right&&A.push("right"),c=A.length===0?"bottom":A.join("-")}let g=i.add(p[c]);this.options.subpixelPositioning||(g=g.round()),te.setTransform(this._container,`${Vs[c]} translate(${g.x}px,${g.y}px)`),ec(this._container,c,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=s.e(Object.create(zu),m)}addTo(m){return this._map&&this.remove(),this._map=m,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 s.l("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(m){return this._lngLat=s.V.convert(m),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(m){return this.setDOMContent(document.createTextNode(m))}setHTML(m){const t=document.createDocumentFragment(),i=document.createElement("body");let c;for(i.innerHTML=m;c=i.firstChild,c;)t.appendChild(c);return this.setDOMContent(t)}getMaxWidth(){var m;return(m=this._container)===null||m===void 0?void 0:m.style.maxWidth}setMaxWidth(m){return this.options.maxWidth=m,this._update(),this}setDOMContent(m){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=te.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(m),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(m){return this._container&&this._container.classList.add(m),this}removeClassName(m){return this._container&&this._container.classList.remove(m),this}setOffset(m){return this.options.offset=m,this._update(),this}toggleClassName(m){if(this._container)return this._container.classList.toggle(m)}setSubpixelPositioning(m){this.options.subpixelPositioning=m}setPadding(m){this.options.padding=m,this._update()}_createCloseButton(){this.options.closeButton&&(this._closeButton=te.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const m=this._container.querySelector(tc);m&&m.focus()}},v.RasterDEMTileSource=In,v.RasterTileSource=yn,v.ScaleControl=class{constructor(m){this._onMove=()=>{$s(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,$s(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Ru),m)}getDefaultPosition(){return"bottom-left"}onAdd(m){return this._map=m,this._container=te.create("div","maplibregl-ctrl maplibregl-ctrl-scale",m.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){te.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},v.ScrollZoomHandler=Hl,v.Style=qa,v.TerrainControl=class{constructor(m){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=m}onAdd(m){return this._map=m,this._container=te.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=te.create("button","maplibregl-ctrl-terrain",this._container),te.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(){te.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},v.TwoFingersTouchPitchHandler=Dp,v.TwoFingersTouchRotateHandler=Mu,v.TwoFingersTouchZoomHandler=Pu,v.TwoFingersTouchZoomRotateHandler=Fs,v.VectorTileSource=ti,v.VideoSource=Ee,v.addSourceType=(m,t)=>s._(void 0,void 0,void 0,(function*(){if($(m))throw new Error(`A source type called "${m}" already exists.`);((i,c)=>{V[i]=c})(m,t)})),v.clearPrewarmedResources=function(){const m=pr;m&&(m.isPreloaded()&&m.numActive()===1?(m.release(Xt),pr=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()"))},v.createTileMesh=Gh,v.getMaxParallelImageRequests=function(){return s.c.MAX_PARALLEL_IMAGE_REQUESTS},v.getRTLTextPluginStatus=function(){return me().getRTLTextPluginStatus()},v.getVersion=function(){return Fu},v.getWorkerCount=function(){return Tt.workerCount},v.getWorkerUrl=function(){return s.c.WORKER_URL}
811,v.importScriptInWorkers=function(m){return kn().broadcast("IS",m)},v.isTimeFrozen=function(){return ue.isFrozen()},v.now=fe,v.prewarm=function(){en().acquire(Xt)},v.restoreNow=function(){ue.restoreNow()},v.setMaxParallelImageRequests=function(m){s.c.MAX_PARALLEL_IMAGE_REQUESTS=m},v.setNow=function(m){ue.setNow(m)},v.setRTLTextPlugin=function(m,t){return me().setRTLTextPlugin(m,t)},v.setWorkerCount=function(m){Tt.workerCount=m},v.setWorkerUrl=function(m){s.c.WORKER_URL=m}}));var T=h;return T}))})(Md)),Md.exports}var eP=QE();const xt=yx(eP),Xx="3.7.8",tP=Xx,jc=typeof Buffer=="function",ev=typeof TextDecoder=="function"?new TextDecoder:void 0,tv=typeof TextEncoder=="function"?new TextEncoder:void 0,rP="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",sh=Array.prototype.slice.call(rP),dd=(l=>{let a={};return l.forEach((h,y)=>a[h]=y),a})(sh),nP=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,Wn=String.fromCharCode.bind(String),rv=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):l=>new Uint8Array(Array.prototype.slice.call(l,0)),Yx=l=>l.replace(/=/g,"").replace(/[+\/]/g,a=>a=="+"?"-":"_"),Kx=l=>l.replace(/[^A-Za-z0-9\+\/]/g,""),Jx=l=>{let a,h,y,x,T="";const v=l.length%3;for(let s=0;s<l.length;){if((h=l.charCodeAt(s++))>255||(y=l.charCodeAt(s++))>255||(x=l.charCodeAt(s++))>255)throw new TypeError("invalid character found");a=h<<16|y<<8|x,T+=sh[a>>18&63]+sh[a>>12&63]+sh[a>>6&63]+sh[a&63]}return v?T.slice(0,v-3)+"===".substring(v):T},Hg=typeof btoa=="function"?l=>btoa(l):jc?l=>Buffer.from(l,"binary").toString("base64"):Jx,fg=jc?l=>Buffer.from(l).toString("base64"):l=>{let h=[];for(let y=0,x=l.length;y<x;y+=4096)h.push(Wn.apply(null,l.subarray(y,y+4096)));return Hg(h.join(""))},Id=(l,a=!1)=>a?Yx(fg(l)):fg(l),iP=l=>{if(l.length<2){var a=l.charCodeAt(0);return a<128?l:a<2048?Wn(192|a>>>6)+Wn(128|a&63):Wn(224|a>>>12&15)+Wn(128|a>>>6&63)+Wn(128|a&63)}else{var a=65536+(l.charCodeAt(0)-55296)*1024+(l.charCodeAt(1)-56320);return Wn(240|a>>>18&7)+Wn(128|a>>>12&63)+Wn(128|a>>>6&63)+Wn(128|a&63)}},aP=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Qx=l=>l.replace(aP,iP),nv=jc?l=>Buffer.from(l,"utf8").toString("base64"):tv?l=>fg(tv.encode(l)):l=>Hg(Qx(l)),Mc=(l,a=!1)=>a?Yx(nv(l)):nv(l),iv=l=>Mc(l,!0),oP=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,sP=l=>{switch(l.length){case 4:var a=(7&l.charCodeAt(0))<<18|(63&l.charCodeAt(1))<<12|(63&l.charCodeAt(2))<<6|63&l.charCodeAt(3),h=a-65536;return Wn((h>>>10)+55296)+Wn((h&1023)+56320);case 3:return Wn((15&l.charCodeAt(0))<<12|(63&l.charCodeAt(1))<<6|63&l.charCodeAt(2));default:return Wn((31&l.charCodeAt(0))<<6|63&l.charCodeAt(1))}},eb=l=>l.replace(oP,sP),tb=l=>{if(l=l.replace(/\s+/g,""),!nP.test(l))throw new TypeError("malformed base64.");l+="==".slice(2-(l.length&3));let a,h,y,x=[];for(let T=0;T<l.length;)a=dd[l.charAt(T++)]<<18|dd[l.charAt(T++)]<<12|(h=dd[l.charAt(T++)])<<6|(y=dd[l.charAt(T++)]),h===64?x.push(Wn(a>>16&255)):y===64?x.push(Wn(a>>16&255,a>>8&255)):x.push(Wn(a>>16&255,a>>8&255,a&255));return x.join("")},Xg=typeof atob=="function"?l=>atob(Kx(l)):jc?l=>Buffer.from(l,"base64").toString("binary"):tb,rb=jc?l=>rv(Buffer.from(l,"base64")):l=>rv(Xg(l).split("").map(a=>a.charCodeAt(0))),nb=l=>rb(ib(l)),lP=jc?l=>Buffer.from(l,"base64").toString("utf8"):ev?l=>ev.decode(rb(l)):l=>eb(Xg(l)),ib=l=>Kx(l.replace(/[-_]/g,a=>a=="-"?"+":"/")),mg=l=>lP(ib(l)),cP=l=>{if(typeof l!="string")return!1;const a=l.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(a)||!/[^\s0-9a-zA-Z\-_]/.test(a)},ab=l=>({value:l,enumerable:!1,writable:!0,configurable:!0}),ob=function(){const l=(a,h)=>Object.defineProperty(String.prototype,a,ab(h));l("fromBase64",function(){return mg(this)}),l("toBase64",function(a){return Mc(this,a)}),l("toBase64URI",function(){return Mc(this,!0)}),l("toBase64URL",function(){return Mc(this,!0)}),l("toUint8Array",function(){return nb(this)})},sb=function(){const l=(a,h)=>Object.defineProperty(Uint8Array.prototype,a,ab(h));l("toBase64",function(a){return Id(this,a)}),l("toBase64URI",function(){return Id(this,!0)}),l("toBase64URL",function(){return Id(this,!0)})},uP=()=>{ob(),sb()},hP={version:Xx,VERSION:tP,atob:Xg,atobPolyfill:tb,btoa:Hg,btoaPolyfill:Jx,fromBase64:mg,toBase64:Mc,encode:Mc,encodeURI:iv,encodeURL:iv,utob:Qx,btou:eb,decode:mg,isValid:cP,fromUint8Array:Id,toUint8Array:nb,extendString:ob,extendUint8Array:sb,extendBuiltins:uP};var fd={exports:{}},av;function pP(){if(av)return fd.exports;av=1;var l=typeof Reflect=="object"?Reflect:null,a=l&&typeof l.apply=="function"?l.apply:function(ye,Se,Ie){return Function.prototype.apply.call(ye,Se,Ie)},h;l&&typeof l.ownKeys=="function"?h=l.ownKeys:Object.getOwnPropertySymbols?h=function(ye){return Object.getOwnPropertyNames(ye).concat(Object.getOwnPropertySymbols(ye))}:h=function(ye){return Object.getOwnPropertyNames(ye)};function y(xe){console&&console.warn&&console.warn(xe)}var x=Number.isNaN||function(ye){return ye!==ye};function T(){T.init.call(this)}fd.exports=T,fd.exports.once=Be,T.EventEmitter=T,T.prototype._events=void 0,T.prototype._eventsCount=0,T.prototype._maxListeners=void 0;var v=10;function s(xe){if(typeof xe!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof xe)}Object.defineProperty(T,"defaultMaxListeners",{enumerable:!0,get:function(){return v},set:function(xe){if(typeof xe!="number"||xe<0||x(xe))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+xe+".");v=xe}}),T.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},T.prototype.setMaxListeners=function(ye){if(typeof ye!="number"||ye<0||x(ye))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+ye+".");return this._maxListeners=ye,this};function I(xe){return xe._maxListeners===void 0?T.defaultMaxListeners:xe._maxListeners}T.prototype.getMaxListeners=function(){return I(this)},T.prototype.emit=function(ye){for(var Se=[],Ie=1;Ie<arguments.length;Ie++)Se.push(arguments[Ie]);var Ze=ye==="error",Je=this._events;if(Je!==void 0)Ze=Ze&&Je.error===void 0;else if(!Ze)return!1;if(Ze){var Ve;if(Se.length>0&&(Ve=Se[0]),Ve instanceof Error)throw Ve;var ft=new Error("Unhandled error."+(Ve?" ("+Ve.message+")":""));throw ft.context=Ve,ft}var vt=Je[ye];if(vt===void 0)return!1;if(typeof vt=="function")a(vt,this,Se);else for(var nt=vt.length,ct=ue(vt,nt),Ie=0;Ie<nt;++Ie)a(ct[Ie],this,Se);return!0};function L(xe,ye,Se,Ie){var Ze,Je,Ve;if(s(Se),Je=xe._events,Je===void 0?(Je=xe._events=Object.create(null),xe._eventsCount=0):(Je.newListener!==void 0&&(xe.emit("newListener",ye,Se.listener?Se.listener:Se),Je=xe._events),Ve=Je[ye]),Ve===void 0)Ve=Je[ye]=Se,++xe._eventsCount;else if(typeof Ve=="function"?Ve=Je[ye]=Ie?[Se,Ve]:[Ve,Se]:Ie?Ve.unshift(Se):Ve.push(Se),Ze=I(xe),Ze>0&&Ve.length>Ze&&!Ve.warned){Ve.warned=!0;var ft=new Error("Possible EventEmitter memory leak detected. "+Ve.length+" "+String(ye)+" listeners added. Use emitter.setMaxListeners() to increase limit");ft.name="MaxListenersExceededWarning",ft.emitter=xe,ft.type=ye,ft.count=Ve.length,y(ft)}return xe}T.prototype.addListener=function(ye,Se){return L(this,ye,Se,!1)},T.prototype.on=T.prototype.addListener,T.prototype.prependListener=function(ye,Se){return L(this,ye,Se,!0)};function O(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function H(xe,ye,Se){var Ie={fired:!1,wrapFn:void 0,target:xe,type:ye,listener:Se},Ze=O.bind(Ie);return Ze.listener=Se,Ie.wrapFn=Ze,Ze}T.prototype.once=function(ye,Se){return s(Se),this.on(ye,H(this,ye,Se)),this},T.prototype.prependOnceListener=function(ye,Se){return s(Se),this.prependListener(ye,H(this,ye,Se)),this},T.prototype.removeListener=function(ye,Se){var Ie,Ze,Je,Ve,ft;if(s(Se),Ze=this._events,Ze===void 0)return this;if(Ie=Ze[ye],Ie===void 0)return this;if(Ie===Se||Ie.listener===Se)--this._eventsCount===0?this._events=Object.create(null):(delete Ze[ye],Ze.removeListener&&this.emit
811("removeListener",ye,Ie.listener||Se));else if(typeof Ie!="function"){for(Je=-1,Ve=Ie.length-1;Ve>=0;Ve--)if(Ie[Ve]===Se||Ie[Ve].listener===Se){ft=Ie[Ve].listener,Je=Ve;break}if(Je<0)return this;Je===0?Ie.shift():fe(Ie,Je),Ie.length===1&&(Ze[ye]=Ie[0]),Ze.removeListener!==void 0&&this.emit("removeListener",ye,ft||Se)}return this},T.prototype.off=T.prototype.removeListener,T.prototype.removeAllListeners=function(ye){var Se,Ie,Ze;if(Ie=this._events,Ie===void 0)return this;if(Ie.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):Ie[ye]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete Ie[ye]),this;if(arguments.length===0){var Je=Object.keys(Ie),Ve;for(Ze=0;Ze<Je.length;++Ze)Ve=Je[Ze],Ve!=="removeListener"&&this.removeAllListeners(Ve);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(Se=Ie[ye],typeof Se=="function")this.removeListener(ye,Se);else if(Se!==void 0)for(Ze=Se.length-1;Ze>=0;Ze--)this.removeListener(ye,Se[Ze]);return this};function J(xe,ye,Se){var Ie=xe._events;if(Ie===void 0)return[];var Ze=Ie[ye];return Ze===void 0?[]:typeof Ze=="function"?Se?[Ze.listener||Ze]:[Ze]:Se?te(Ze):ue(Ze,Ze.length)}T.prototype.listeners=function(ye){return J(this,ye,!0)},T.prototype.rawListeners=function(ye){return J(this,ye,!1)},T.listenerCount=function(xe,ye){return typeof xe.listenerCount=="function"?xe.listenerCount(ye):ee.call(xe,ye)},T.prototype.listenerCount=ee;function ee(xe){var ye=this._events;if(ye!==void 0){var Se=ye[xe];if(typeof Se=="function")return 1;if(Se!==void 0)return Se.length}return 0}T.prototype.eventNames=function(){return this._eventsCount>0?h(this._events):[]};function ue(xe,ye){for(var Se=new Array(ye),Ie=0;Ie<ye;++Ie)Se[Ie]=xe[Ie];return Se}function fe(xe,ye){for(;ye+1<xe.length;ye++)xe[ye]=xe[ye+1];xe.pop()}function te(xe){for(var ye=new Array(xe.length),Se=0;Se<ye.length;++Se)ye[Se]=xe[Se].listener||xe[Se];return ye}function Be(xe,ye){return new Promise(function(Se,Ie){function Ze(Ve){xe.removeListener(ye,Je),Ie(Ve)}function Je(){typeof xe.removeListener=="function"&&xe.removeListener("error",Ze),Se([].slice.call(arguments))}De(xe,ye,Je,{once:!0}),ye!=="error"&&Ae(xe,Ze,{once:!0})})}function Ae(xe,ye,Se){typeof xe.on=="function"&&De(xe,"error",ye,Se)}function De(xe,ye,Se,Ie){if(typeof xe.on=="function")Ie.once?xe.once(ye,Se):xe.on(ye,Se);else if(typeof xe.addEventListener=="function")xe.addEventListener(ye,function Ze(Je){Ie.once&&xe.removeEventListener(ye,Ze),Se(Je)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof xe)}return fd.exports}var dP=pP();const fP=yx(dP);function mP(){return typeof self<"u"?fetch.bind(self):typeof global<"u"&&global.fetch?global.fetch:null}class gP{constructor(){this._apiKey="",this._fetch=mP(),this.tileCacheSize=200}set apiKey(a){this._apiKey=a}get apiKey(){return this._apiKey}set fetch(a){this._fetch=a}get fetch(){return this._fetch}}const Ic=new gP,yP={AUTO:{code:null,flag:"auto",name:"Auto",latin:!1,isMode:!0,geocoding:!0},LATIN:{code:"latin",flag:"name:latin",name:"Latin",latin:!0,isMode:!1,geocoding:!1},NON_LATIN:{code:"nonlatin",flag:"name:nonlatin",name:"Non Latin",latin:!1,isMode:!1,geocoding:!1},LOCAL:{code:null,flag:"name",name:"Local",latin:!0,isMode:!1,geocoding:!1}},_P={ALBANIAN:{code:"sq",flag:"name:sq",name:"Albanian",latin:!0,isMode:!1,geocoding:!0},AMHARIC:{code:"am",flag:"name:am",name:"Amharic",latin:!1,isMode:!1,geocoding:!0},ARABIC:{code:"ar",flag:"name:ar",name:"Arabic",latin:!1,isMode:!1,geocoding:!0},ARMENIAN:{code:"hy",flag:"name:hy",name:"Armenian",latin:!1,isMode:!1,geocoding:!0},AZERBAIJANI:{code:"az",flag:"name:az",name:"Azerbaijani",latin:!0,isMode:!1,geocoding:!0},BASQUE:{code:"eu",flag:"name:eu",name:"Basque",latin:!0,isMode:!1,geocoding:!0},BELARUSIAN:{code:"be",flag:"name:be",name:"Belarusian",latin:!1,isMode:!1,geocoding:!0},BENGALI:{code:"bn",flag:"name:bn",name:"Bengali",latin:!0,isMode:!1,geocoding:!0},BOSNIAN:{code:"bs",flag:"name:bs",name:"Bosnian",latin:!0,isMode:!1,geocoding:!0},BRETON:{code:"br",flag:"name:br",name:"Breton",latin:!0,isMode:!1,geocoding:!0},BULGARIAN:{code:"bg",flag:"bg",name:"Bulgarian",latin:!1,isMode:!1,geocoding:!0},CATALAN:{code:"ca",flag:"name:ca",name:"Catalan",latin:!0,isMode:!1,geocoding:!0},CHINESE:{code:"zh",flag:"name:zh",name:"Chinese",latin:!1,isMode:!1,geocoding:!0},TRADITIONAL_CHINESE:{code:"zh-Hant",flag:"name:zh-Hant",name:"Chinese (traditional)",latin:!1,isMode:!1,geocoding:!1},SIMPLIFIED_CHINESE:{code:"zh-Hans",flag:"name:zh-Hans",name:"Chinese (simplified)",latin:!1,isMode:!1,geocoding:!1},CORSICAN:{code:"co",flag:"name:co",name:"Corsican",latin:!0,isMode:!1,geocoding:!0},CROATIAN:{code:"hr",flag:"name:hr",name:"Croatian",latin:!0,isMode:!1,geocoding:!0},CZECH:{code:"cs",flag:"name:cs",name:"Czech",latin:!0,isMode:!1,geocoding:!0},DANISH:{code:"da",flag:"name:da",name:"Danish",latin:!0,isMode:!1,geocoding:!0},DUTCH:{code:"nl",flag:"name:nl",name:"Dutch",latin:!0,isMode:!1,geocoding:!0},GERMAN:{code:"de",flag:"name:de",name:"German",latin:!0,isMode:!1,geocoding:!0},GREEK:{code:"el",flag:"name:el",name:"Greek",latin:!1,isMode:!1,geocoding:!0},ENGLISH:{code:"en",flag:"name:en",name:"English",latin:!0,isMode:!1,geocoding:!0},ESPERANTO:{code:"eo",flag:"name:eo",name:"Esperanto",latin:!0,isMode:!1,geocoding:!0}
811,ESTONIAN:{code:"et",flag:"name:et",name:"Estonian",latin:!0,isMode:!1,geocoding:!0},FINNISH:{code:"fi",flag:"name:fi",name:"Finnish",latin:!0,isMode:!1,geocoding:!0},FRENCH:{code:"fr",flag:"name:fr",name:"French",latin:!0,isMode:!1,geocoding:!0},FRISIAN:{code:"fy",flag:"name:fy",name:"Frisian (West)",latin:!0,isMode:!1,geocoding:!0},GEORGIAN:{code:"ka",flag:"name:ka",name:"Georgian",latin:!1,isMode:!1,geocoding:!0},HEBREW:{code:"he",flag:"name:he",name:"Hebrew",latin:!1,isMode:!1,geocoding:!0},HINDI:{code:"hi",flag:"name:hi",name:"Hindi",latin:!1,isMode:!1,geocoding:!0},HUNGARIAN:{code:"hu",flag:"name:hu",name:"Hungarian",latin:!0,isMode:!1,geocoding:!0},ICELANDIC:{code:"is",flag:"name:is",name:"Icelandic",latin:!0,isMode:!1,geocoding:!0},INDONESIAN:{code:"id",flag:"name:id",name:"Indonesian",latin:!0,isMode:!1,geocoding:!0},IRISH:{code:"ga",flag:"name:ga",name:"Irish",latin:!0,isMode:!1,geocoding:!0},ITALIAN:{code:"it",flag:"name:it",name:"Italian",latin:!0,isMode:!1,geocoding:!0},JAPANESE:{code:"ja",flag:"name:ja",name:"Japanese",latin:!1,isMode:!1,geocoding:!0},JAPANESE_HIRAGANA:{code:"ja-Hira",flag:"name:ja-Hira",name:"Japanese Hiragana form",latin:!1,isMode:!1,geocoding:!1},JAPANESE_2018:{code:"ja-Latn",flag:"name:ja-Latn",name:"Japanese (Latin 2018)",latin:!0,isMode:!1,geocoding:!1},JAPANESE_KANA:{code:"ja_kana",flag:"name:ja_kana",name:"Japanese (Kana)",latin:!1,isMode:!1,geocoding:!1},JAPANESE_LATIN:{code:"ja_rm",flag:"name:ja_rm",name:"Japanese (Latin script)",latin:!0,isMode:!1,geocoding:!1},KANNADA:{code:"kn",flag:"name:kn",name:"Kannada",latin:!0,isMode:!1,geocoding:!0},KAZAKH:{code:"kk",flag:"name:kk",name:"Kazakh",latin:!1,isMode:!1,geocoding:!0},KOREAN:{code:"ko",flag:"name:ko",name:"Korean",latin:!1,isMode:!1,geocoding:!0},KOREAN_LATIN:{code:"ko-Latn",flag:"name:ko-Latn",name:"Korean (Latin script)",latin:!0,isMode:!1,geocoding:!1},KURDISH:{code:"ku",flag:"name:ku",name:"Kurdish",latin:!0,isMode:!1,geocoding:!0},CLASSICAL_LATIN:{code:"la",flag:"name:la",name:"Latin",latin:!0,isMode:!1,geocoding:!0},LATVIAN:{code:"lv",flag:"name:lv",name:"Latvian",latin:!0,isMode:!1,geocoding:!0},LITHUANIAN:{code:"lt",flag:"name:lt",name:"Lithuanian",latin:!0,isMode:!1,geocoding:!0},LUXEMBOURGISH:{code:"lb",flag:"name:lb",name:"Luxembourgish",latin:!0,isMode:!1,geocoding:!0},MACEDONIAN:{code:"mk",flag:"name:mk",name:"Macedonian",latin:!1,isMode:!1,geocoding:!0},MALAYALAM:{code:"ml",flag:"name:ml",name:"Malayalam",latin:!1,isMode:!1,geocoding:!0},MALTESE:{code:"mt",flag:"name:mt",name:"Maltese",latin:!0,isMode:!1,geocoding:!0},NORWEGIAN:{code:"no",flag:"name:no",name:"Norwegian",latin:!0,isMode:!1,geocoding:!0},OCCITAN:{code:"oc",flag:"name:oc",name:"Occitan",latin:!0,isMode:!1,geocoding:!0},PERSIAN:{code:"fa",flag:"name:fa",name:"Persian",latin:!1,isMode:!1,geocoding:!0},POLISH:{code:"pl",flag:"name:pl",name:"Polish",latin:!0,isMode:!1,geocoding:!0},PORTUGUESE:{code:"pt",flag:"name:pt",name:"Portuguese",latin:!0,isMode:!1,geocoding:!0},PUNJABI:{code:"pa",flag:"name:pa",name:"Punjabi",latin:!1,isMode:!1,geocoding:!0},WESTERN_PUNJABI:{code:"pnb",flag:"name:pnb",name:"Western Punjabi",latin:!1,isMode:!1,geocoding:!1},ROMANIAN:{code:"ro",flag:"name:ro",name:"Romanian",latin:!0,isMode:!1,geocoding:!0},ROMANSH:{code:"rm",flag:"name:rm",name:"Romansh",latin:!0,isMode:!1,geocoding:!0},RUSSIAN:{code:"ru",flag:"name:ru",name:"Russian",latin:!1,isMode:!1,geocoding:!0},SERBIAN_CYRILLIC:{code:"sr",flag:"name:sr",name:"Serbian (Cyrillic script)",latin:!1,isMode:!1,geocoding:!0},SERBIAN_LATIN:{code:"sr-Latn",flag:"name:sr-Latn",name:"Serbian (Latin script)",latin:!0,isMode:!1,geocoding:!1},SCOTTISH_GAELIC:{code:"gd",flag:"name:gd",name:"Scottish Gaelic",latin:!0,isMode:!1,geocoding:!0},SLOVAK:{code:"sk",flag:"name:sk",name:"Slovak",latin:!0,isMode:!1,geocoding:!0},SLOVENE:{code:"sl",flag:"name:sl",name:"Slovene",latin:!0,isMode:!1,geocoding:!0},SPANISH:{code:"es",flag:"name:es",name:"Spanish",latin:!0,isMode:!1,geocoding:!0},SWEDISH:{code:"sv",flag:"name:sv",name:"Swedish",latin:!0,isMode:!1,geocoding:!0},TAMIL:{code:"ta",flag:"name:ta",name:"Tamil",latin:!1,isMode:!1,geocoding:!0},TELUGU:{code:"te",flag:"name:te",name:"Telugu",latin:!1,isMode:!1,geocoding:!0},THAI:{code:"th",flag:"name:th",name:"Thai",latin:!1,isMode:!1,geocoding:!0},TURKISH:{code:"tr",flag:"name:tr",name:"Turkish",latin:!0,isMode:!1,geocoding:!0},UKRAINIAN:{code:"uk",flag:"name:uk",name:"Ukrainian",latin:!1,isMode:!1,geocoding:!0},VIETNAMESE:{code:"vi",flag:"name:vi",name:"Vietnamese (Latin script)",latin:!0,isMode:!1,geocoding:!0},WELSH:{code:"cy",flag:"name:cy",name:"Welsh",latin:!0,isMode:!1,geocoding:!0}},Lh={...yP,..._P};function vP(l,a=Lh){return l in a?l[l]:null}
811function gg(l,a=Lh){for(const h of Object.values(a))if(h.code===l)return h;return null}function yg(l,a=Lh){for(const h of Object.values(a))if(h.flag===l)return h;return null}function xP(l){return l!==null&&typeof l=="object"&&"code"in l&&"flag"in l&&"name"in l&&"latin"in l&&"isMode"in l&&"geocoding"in l&&(typeof l.code=="string"||l.code===null)&&typeof l.flag=="string"&&typeof l.name=="string"&&typeof l.latin=="boolean"&&typeof l.isMode=="boolean"&&typeof l.geocoding=="boolean"}function ov(l,a=Lh){return xP(l)?yg(l.flag,a):typeof l!="string"?null:vP(l,a)||gg(l,a)||yg(l,a)||null}async function bP(l,a={}){if(Ic.fetch===null)throw new Error("The fetch function was not found. If on NodeJS < 18 please specify the fetch function with config.fetch");if(new URL(l).searchParams.get("key").trim()==="")throw new Error("The MapTiler Cloud API key is missing. Set it in `config.apiKey` or get one for free at https://maptiler.com");return Ic.fetch(l,a)}const lb={maptilerApiURL:"https://api.maptiler.com/",mapStyle:"streets-v2"};Object.freeze(lb);class wP extends Error{constructor(a,h=""){super(`Call to enpoint ${a.url} failed with the status code ${a.status}. ${h}`),this.res=a}}const sv={403:"Key is missing, invalid or restricted"};async function TP(l={}){const a=new URL("geolocation/ip.json",lb.maptilerApiURL);a.searchParams.set("key",l.apiKey??Ic.apiKey),"elevation"in l&&a.searchParams.set("elevation",l.elevation?"true":"false");const h=a.toString(),y=await bP(h);if(!y.ok)throw new wP(y,y.status in sv?sv[y.status]:"");return await y.json()}const lv={info:TP};function cb(l){const a=/^maptiler:\/\/(.*)/;let h;const y=l.trim();let x;return y.startsWith("http://")||y.startsWith("https://")?x=y:(h=a.exec(y))!==null?x=`https://api.maptiler.com/maps/${h[1]}/style.json`:x=`https://api.maptiler.com/maps/${y}/style.json`,x}
811class ub{constructor(a,h,y,x,T,v,s=!1,I){this.name=a,this.variantType=h,this.id=y,this.referenceStyle=x,this.description=T,this.imageURL=v,this.deprecated=s,this.deprecationMessage=I}getName(){return this.name}getFullName(){return`${this.referenceStyle.getName()} ${this.name}`}getType(){return this.variantType}getId(){return this.id}getDescription(){return this.description}getReferenceStyle(){return this.referenceStyle}hasVariant(a){return this.referenceStyle.hasVariant(a)}getVariant(a){const h=this.referenceStyle.getVariant(a);return this.warnIfDeprecated(h),h}getVariants(){return this.referenceStyle.getVariants().filter(a=>a!==this).map(a=>(this.warnIfDeprecated(a),a))}getImageURL(){return this.imageURL}getExpandedStyleURL(){return cb(this.getId())}warnIfDeprecated(a=this){if(!a.deprecated)return a;if(a.deprecationMessage)console.warn(a.deprecationMessage);else{const h=a.getFullName();console.warn(`Style "${h}" is deprecated and will be removed in a future version.`)}return a}}class hb{constructor(a,h){this.name=a,this.id=h,this.variants={},this.orderedVariants=[]}getName(){return this.name}getId(){return this.id}addVariant(a){this.variants[a.getType()]=a,this.orderedVariants.push(a)}hasVariant(a){return a in this.variants}getVariant(a){return a in this.variants?this.variants[a]:this.orderedVariants[0]}getVariants(){return Object.values(this.variants)}getDefaultVariant(){return this.orderedVariants[0].warnIfDeprecated()}}const SP=[{referenceStyleID:"STREETS_V2",name:"Streets",description:"",variants:[{id:"streets-v2",name:"Default v2",variantType:"DEFAULT",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"streets-v2" is deprecated, use "streets-v4" instead'},{id:"streets-v2-dark",name:"Dark v2",variantType:"DARK",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"streets-v2-dark" is deprecated, use "streets-v4-dark" instead'},{id:"streets-v2-light",name:"Light v2",variantType:"LIGHT",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"streets-v2-light" is deprecated, use "streets-v4-light" instead'},{id:"streets-v2-night",name:"Night v2",variantType:"NIGHT",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"streets-v2-night" is deprecated, use "streets-v4-night" instead'},{id:"streets-v2-pastel",name:"Pastel v2",variantType:"PASTEL",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"streets-v2-pastel" is deprecated, use "streets-v4-pastel" instead'}]},{referenceStyleID:"STREETS_V4",name:"Streets",description:"",variants:[{id:"streets-v4",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"streets-v4-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"streets-v4-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""}]},{referenceStyleID:"BASE_V4",name:"Base",description:"",variants:[{id:"base-v4",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"base-v4-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"base-v4-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""},{id:"base-v4-ai",name:"Base AI",variantType:"AI",description:"",imageURL:""}]},{referenceStyleID:"OUTDOOR",name:"Outdoor",description:"",variants:[{id:"outdoor-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"outdoor-v2" is deprecated, use "outdoor-v4" instead'},{id:"outdoor-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"outdoor-v2-dark" is deprecated, use "outdoor-v4-dark" instead'}]},{referenceStyleID:"WINTER_V2",name:"Winter",description:"",variants:[{id:"winter-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"winter-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""}]},{referenceStyleID:"WINTER_V4",name:"Winter",description:"",variants:[{id:"winter-v4",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"winter-v4-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""}]},{referenceStyleID:"SATELLITE_V2",name:"Satellite",description:"",variants:[{id:"satellite",name:"Default",variantType:"DEFAULT",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"satellite" is deprecated, use "satellite-v4" instead'}]},{referenceStyleID:"HYBRID_V2",name:"Hybrid",description:"",variants:[{id:"hybrid",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"HYBRID_V4",name:"Hybrid",description:"",variants:[{id:"hybrid-v4",name:"Default",variantType:"DEFAULT",imageURL:""},{id:"hybrid-v4-dark",name:"Dark",variantType:"DARK",imageURL:""}]},{referenceStyleID:"BASIC_V2",name:"Basic",description:"",variants:[{id:"basic-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"basic-v2" is deprecated, use "base-v4" instead'}
811,{id:"basic-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:"",deprecationMessage:'"basic-v2" is deprecated, use "base-v4" instead'},{id:"basic-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"basic-v2" is deprecated, use "base-v4" instead'}]},{referenceStyleID:"BRIGHT",name:"Bright",description:"",variants:[{id:"bright-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"bright-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"bright-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""},{id:"bright-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""}]},{referenceStyleID:"OPENSTREETMAP_V2",name:"OpenStreetMap",description:"",variants:[{id:"openstreetmap",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"openstreetmap-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""}]},{referenceStyleID:"TOPO_V2",name:"Topo",description:"",variants:[{id:"topo-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"topo-v2" is deprecated, use "topo-v4" instead'},{id:"topo-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"topo-v2-dark" is deprecated, use "topo-v4-dark" instead'},{id:"topo-v2-shiny",name:"Shiny",variantType:"SHINY",description:"",imageURL:"",deprecated:!0},{id:"topo-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"topo-v2-pastel" is deprecated, use "topo-v4-pastel" instead'},{id:"topo-v2-topographique",name:"Topographique",variantType:"TOPOGRAPHIQUE",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"topo-v2-topographique" is deprecated, use "topo-v4-topographique" instead'}]},{referenceStyleID:"VOYAGER_V2",name:"Voyager",description:"",variants:[{id:"voyager-v2",name:"Default",deprecated:!0,variantType:"DEFAULT",description:"",imageURL:""},{id:"voyager-v2-darkmatter",name:"Darkmatter",deprecated:!0,variantType:"DARK",description:"",imageURL:""},{id:"voyager-v2-positron",name:"Positron",deprecated:!0,variantType:"LIGHT",description:"",imageURL:""},{id:"voyager-v2-vintage",name:"Vintage",deprecated:!0,variantType:"VINTAGE",description:"",imageURL:""}]},{referenceStyleID:"TONER_V2",name:"Toner",description:"",deprecated:!0,deprecationMessage:'"toner-v2" is deprecated, and will be no longer be a default style in the future',variants:[{id:"toner-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"toner-v2" is deprecated, and may be removed in future versions.'},{id:"toner-v2-background",name:"Background",variantType:"BACKGROUND",deprecated:!0,description:"",imageURL:"",deprecationMessage:'"toner-v2-background" is deprecated, and may be removed in future versions.'},{id:"toner-v2-lite",name:"Lite",variantType:"LITE",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"toner-v2-lite" is deprecated, and may be removed in future versions.'},{id:"toner-v2-lines",name:"Lines",variantType:"LINES",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"toner-v2-lines" is deprecated, and may be removed in future versions.'}]},{referenceStyleID:"DATAVIZ_V2",name:"Dataviz",description:"",variants:[{id:"dataviz",name:"Default",variantType:"DEFAULT",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"dataviz" is deprecated, use "dataviz-v4" instead'},{id:"dataviz-dark",name:"Dark",variantType:"DARK",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"dataviz-dark" is deprecated, use "dataviz-v4-dark" instead'},{id:"dataviz-light",name:"Light",variantType:"LIGHT",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"dataviz-light" is deprecated, use "dataviz-v4-light" instead'}]},{referenceStyleID:"BACKDROP_V2",name:"Backdrop",description:"",variants:[{id:"backdrop",name:"Default",variantType:"DEFAULT",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"backdrop" is deprecated, use "backdrop-v4" instead'}
811,{id:"backdrop-dark",name:"Dark",variantType:"DARK",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"backdrop-dark" is deprecated, use "backdrop-v4-dark" instead'},{id:"backdrop-light",name:"Light",variantType:"LIGHT",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"backdrop-light" is deprecated, use "backdrop-v4-light" instead'}]},{referenceStyleID:"OCEAN_V2",name:"Ocean",description:"",variants:[{id:"ocean",name:"Default",variantType:"DEFAULT",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"ocean" is deprecated, use "ocean-v4" instead'}]},{referenceStyleID:"AQUARELLE_V2",name:"Aquarelle",description:"Watercolor map for creative use",variants:[{id:"aquarelle",name:"Default",variantType:"DEFAULT",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"aquarelle" is deprecated, use "aquarelle-v4" instead'},{id:"aquarelle-dark",name:"Dark",variantType:"DARK",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"aquarelle-dark" is deprecated, use "aquarelle-v4-dark" instead'},{id:"aquarelle-vivid",name:"Vivid",variantType:"VIVID",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"aquarelle-vivid" is deprecated, use "aquarelle-v4-vivid" instead'}]},{referenceStyleID:"LANDSCAPE_V2",name:"Landscape",description:"Terrain map for data overlays and visualisations",variants:[{id:"landscape",name:"Default",variantType:"DEFAULT",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"landscape" is deprecated, use "landscape-v4" instead'},{id:"landscape-dark",name:"Dark",variantType:"DARK",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"landscape-dark" is deprecated, use "landscape-v4-dark" instead'},{id:"landscape-vivid",name:"Vivid",variantType:"VIVID",description:"",imageURL:"",deprecated:!0,deprecationMessage:'"landscape-vivid" is deprecated, use "landscape-v4-vivid" instead'}]},{referenceStyleID:"LANDSCAPE_V4",name:"Landscape",description:"Terrain map for data overlays and visualisations",variants:[{id:"landscape-v4",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"landscape-v4-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"landscape-v4-vivid",name:"Vivid",variantType:"VIVID",description:"",imageURL:""}]},{referenceStyleID:"SATELLITE_V4",name:"Satellite v4",description:"",variants:[{id:"satellite-v4",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"satellite-v4-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""}]},{referenceStyleID:"DATAVIZ_V4",name:"Dataviz",description:"",variants:[{id:"dataviz-v4",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"dataviz-v4-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"dataviz-v4-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"OUTDOOR_V4",name:"Outdoor",description:"",variants:[{id:"outdoor-v4",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"outdoor-v4-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""}]},{referenceStyleID:"BACKDROP_V4",name:"Backdrop",description:"",variants:[{id:"backdrop-v4",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"backdrop-v4-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"backdrop-v4-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"AQUARELLE_V4",name:"Aquarelle",description:"Watercolor map for creative use",variants:[{id:"aquarelle-v4",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"aquarelle-v4-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"aquarelle-v4-vivid",name:"Vivid",variantType:"VIVID",description:"",imageURL:""}]},{referenceStyleID:"OCEAN_V4",name:"Ocean",description:"",variants:[{id:"ocean-v4",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"ocean-v4-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""}]},{referenceStyleID:"TOPO_V4",name:"Topo",description:"",variants:[{id:"topo-v4",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}
811,{id:"topo-v4-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"topo-v4-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""},{id:"topo-v4-topographique",name:"Topographique",variantType:"TOPOGRAPHIQUE",description:"",imageURL:""}]}],EP={STREETS:"STREETS_V2",BASIC:"BASIC_V2",LANDSCAPE:"LANDSCAPE_V2",AQUARELLE:"AQUARELLE_V2",SATELLITE:"SATELLITE_V2",WINTER:"WINTER_V2",HYBRID:"HYBRID_V2",OCEAN:"OCEAN_V2",TONER:"TONER_V2",TOPO:"TOPO_V2",OPENSTREETMAP:"OPENSTREETMAP_V2",DATAVIZ:"DATAVIZ_V2",BACKDROP:"BACKDROP_V2",VOYAGER:"VOYAGER_V2"},Ko=[...SP];function PP(l,a){Ko.find(x=>x.referenceStyleID===l)&&console.warn(`Default reference style ${l} already exists, it will be overwritten...`);const h=Ko.find(x=>x.referenceStyleID===a);if(!h)throw new Error(`Versioned map style not found for reference style: ${a}`);const y={...h,referenceStyleID:l};Ko.push(y)}Object.entries(EP).forEach(([l,a])=>{PP(l,a)});function MP(l){return new Proxy(l,{get(a,h,y){return a.hasVariant(h)?a.getVariant(h):h.toString().toUpperCase()===h?l.getDefaultVariant():Reflect.get(a,h,y)}})}function IP(){const l={};for(let a=0;a<Ko.length;a+=1){const h=Ko[a],y=MP(new hb(h.name,h.referenceStyleID));for(let x=0;x<h.variants.length;x+=1){const T=h.variants[x],v=new ub(T.name,T.variantType,T.id,y,T.description,T.imageURL,T.deprecated);y.addVariant(v)}l[h.referenceStyleID]=y}return l}const dh=IP(),Zn=[];for(let l=0;l<256;++l)Zn.push((l+256).toString(16).slice(1));function AP(l,a=0){return(Zn[l[a+0]]+Zn[l[a+1]]+Zn[l[a+2]]+Zn[l[a+3]]+"-"+Zn[l[a+4]]+Zn[l[a+5]]+"-"+Zn[l[a+6]]+Zn[l[a+7]]+"-"+Zn[l[a+8]]+Zn[l[a+9]]+"-"+Zn[l[a+10]]+Zn[l[a+11]]+Zn[l[a+12]]+Zn[l[a+13]]+Zn[l[a+14]]+Zn[l[a+15]]).toLowerCase()}let $m;const CP=new Uint8Array(16);function kP(){if(!$m){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");$m=crypto.getRandomValues.bind(crypto)}return $m(CP)}const DP=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),cv={randomUUID:DP};function LP(l,a,h){var x;if(cv.randomUUID&&!l)return cv.randomUUID();l=l||{};const y=l.random??((x=l.rng)==null?void 0:x.call(l))??kP();if(y.length<16)throw new Error("Random bytes length must be >= 16");return y[6]=y[6]&15|64,y[8]=y[8]&63|128,AP(y)}var RP=Object.defineProperty,pb=l=>{throw TypeError(l)},zP=(l,a,h)=>a in l?RP(l,a,{enumerable:!0,configurable:!0,writable:!0,value:h}):l[a]=h,mt=(l,a,h)=>zP(l,typeof a!="symbol"?a+"":a,h),Yg=(l,a,h)=>a.has(l)||pb("Cannot "+h),wt=(l,a,h)=>(Yg(l,a,"read from private field"),h?h.call(l):a.get(l)),vi=(l,a,h)=>a.has(l)?pb("Cannot add the same private member more than once"):a instanceof WeakSet?a.add(l):a.set(l,h),Fi=(l,a,h,y)=>(Yg(l,a,"write to private field"),a.set(l,h),h),Ri=(l,a,h)=>(Yg(l,a,"access private method"),h);(function(){typeof window>"u"||(window.requestIdleCallback=window.requestIdleCallback||function(l){const a=Date.now();return setTimeout(function(){l({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-a))}})},1)},window.cancelIdleCallback=window.cancelIdleCallback||function(l){clearTimeout(l)})})();let db=class extends xt.Marker{addTo(l){return super.addTo(l)}};class fb extends xt.Popup{addTo(a){return super.addTo(a)}}class k5 extends xt.Style{constructor(a,h={}){super(a,h)}}class D5 extends xt.CanvasSource{onAdd(a){super.onAdd(a)}}class L5 extends xt.GeoJSONSource{onAdd(a){super.onAdd(a)}}class R5 extends xt.ImageSource{onAdd(a){super.onAdd(a)}}class z5 extends xt.RasterTileSource{onAdd(a){super.onAdd(a)}}class F5 extends xt.RasterDEMTileSource{onAdd(a){super.onAdd(a)}}class O5 extends xt.VectorTileSource{onAdd(a){super.onAdd(a)}}class B5 extends xt.VideoSource{onAdd(a){super.onAdd(a)}}class mb extends xt.NavigationControl{onAdd(a){return super.onAdd(a)}}class gb extends xt.GeolocateControl{onAdd(a){return super.onAdd(a)}}class N5 extends xt.AttributionControl{onAdd(a){return super.onAdd(a)}}class FP extends xt.LogoControl{onAdd(a){return super.onAdd(a)}}class OP extends xt.ScaleControl{onAdd(a){return super.onAdd(a)}}class BP extends xt.FullscreenControl{onAdd(a){return super.onAdd(a)}}class j5 extends xt.TerrainControl{onAdd(a){return super.onAdd(a)}}class V5 extends xt.BoxZoomHandler{constructor(a,h){super(a,h)}}class U5 extends xt.ScrollZoomHandler{constructor(a,h){super(a,h)}}class $5 extends xt.CooperativeGesturesHandler{constructor(a,h){super(a,h)}}
811class q5 extends xt.KeyboardHandler{constructor(a){super(a)}}class G5 extends xt.TwoFingersTouchPitchHandler{constructor(a){super(a)}}class Z5 extends xt.MapWheelEvent{constructor(a,h,y){super(a,h,y)}}class W5 extends xt.MapTouchEvent{constructor(a,h,y){super(a,h,y)}}class H5 extends xt.MapMouseEvent{constructor(a,h,y,x={}){super(a,h,y,x)}}const lr={VISITOR:{code:null,flag:"visitor",name:"Visitor",latin:!0,isMode:!0,geocoding:!1},VISITOR_ENGLISH:{code:null,flag:"visitor_en",name:"Visitor English",latin:!0,isMode:!0,geocoding:!1},STYLE:{code:null,flag:"style",name:"Style",latin:!1,isMode:!0,geocoding:!1},STYLE_LOCK:{code:null,flag:"style_lock",name:"Style Lock",latin:!1,isMode:!0,geocoding:!1},...Lh};function uv(){if(typeof navigator>"u"){const l=Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0];return gg(l)||lr.ENGLISH}return Array.from(new Set(navigator.languages.map(l=>l.split("-")[0]))).map(l=>gg(l)).filter(l=>l)[0]??lr.LOCAL}const ui={maptilerLogoURL:"https://api.maptiler.com/resources/logo.svg",maptilerURL:"https://www.maptiler.com/",maptilerApiHost:"api.maptiler.com",telemetryURL:"https://api.maptiler.com/metrics",rtlPluginURL:"https://cdn.maptiler.com/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.min.js",primaryLanguage:lr.STYLE,secondaryLanguage:lr.LOCAL,terrainSourceURL:"https://api.maptiler.com/tiles/terrain-rgb-v2/tiles.json",terrainSourceId:"maptiler-terrain"};Object.freeze(ui);const Kg=LP();class NP extends fP{constructor(){super(...arguments),mt(this,"primaryLanguage",ui.primaryLanguage),mt(this,"secondaryLanguage"),mt(this,"session",!0),mt(this,"caching",!0),mt(this,"telemetry",!0),mt(this,"_unit","metric"),mt(this,"_apiKey","")}set unit(a){this._unit=a,this.emit("unit",a)}get unit(){return this._unit}set apiKey(a){this._apiKey=a,Ic.apiKey=a,this.emit("apiKey",a)}get apiKey(){return this._apiKey}set fetch(a){Ic.fetch=a}get fetch(){return Ic.fetch}}const Pn=new NP;class hv extends FP{constructor(a={}){super(a),mt(this,"logoURL",""),mt(this,"linkURL",""),this.logoURL=a.logoURL??ui.maptilerLogoURL,this.linkURL=a.linkURL??ui.maptilerURL}onAdd(a){this._map=a,this._compact=this.options.compact??!1,this._container=window.document.createElement("div"),this._container.className="maplibregl-ctrl";const h=window.document.createElement("a");return h.style.backgroundRepeat="no-repeat",h.style.cursor="pointer",h.style.display="block",h.style.height="23px",h.style.margin="0 0 -4px -4px",h.style.overflow="hidden",h.style.width="88px",h.style.backgroundImage=`url(${this.logoURL})`,h.style.backgroundSize="100px 30px",h.style.width="100px",h.style.height="30px",h.target="_blank",h.rel="noopener",h.href=this.linkURL,h.setAttribute("aria-label","MapTiler logo"),h.setAttribute("rel","noopener"),this._container.appendChild(h),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}}const _g="localcache_source",vg="localcache",jP="maptiler_sdk",VP=1e3,UP=100,xg=typeof caches<"u",{addProtocol:pv}=xt;function $P(l,a){if(xg&&Pn.caching&&Pn.session&&l.host===ui.maptilerApiHost){if(a==="Source"&&l.href.includes("tiles.json"))return l.href.replace("https://",`${_g}://`);if(a==="Tile"||a==="Glyphs")return l.href.replace("https://",`${vg}://`)}return l.href}let qm;async function yb(){return qm||(qm=await caches.open(jP)),qm}let dv=0;async function qP(){const l=await yb(),a=await l.keys(),h=a.slice(0,Math.max(a.length-VP,0));for(const y of h)l.delete(y)}function GP(){pv(_g,async(l,a)=>{if(!l.url)throw new Error("");l.url=l.url.replace(`${_g}://`,"https://");const h=l;h.signal=a.signal;const y=await fetch(l.url,h),x=await y.json();return x.tiles&&x.tiles.length>0&&(x.tiles[0]+=`&last-modified=${y.headers.get("Last-Modified")}`),{data:x,cacheControl:y.headers.get("Cache-Control"),expires:y.headers.get("Expires")}}),pv(vg,async(l,a)=>{if(!l.url)throw new Error("");l.url=l.url.replace(`${vg}://`,"https://");const h=new URL(l.url),y=new URL(h);y.searchParams.delete("mtsid"),y.searchParams.delete("key");const x=y.toString(),T=new URL(h);T.searchParams.delete("last-modified");const v=T.toString(),s=async J=>({data:await J.arrayBuffer(),cacheControl:J.headers.get("Cache-Control"),expires:J.headers.get("Expires")}),I=await yb(),L=await I.match(x);if(L)return s(L);const O=l;O.signal=a.signal;const H=await fetch(v,O);return H.status>=200&&H.status<300&&(I.put(x,H.clone()).catch(()=>{}),++dv>UP&&(qP(),dv=0)),s(H)})}async function ZP(l){if(typeof window>"u")return;const a=xt.getRTLTextPluginStatus();if(a==="unavailable"||a==="requested")try{await xt.setRTLTextPlugin(l??ui.rtlPluginURL,!0)}catch(h){console.error("Error enabling RTL plugin. It is enabled by default and cannot be unset after. Are you attempting to enable it twice?",h)}}
811function WP(l,a){for(const h of l)typeof a[h]=="function"&&(a[h]=a[h].bind(a))}function fv(l,a){let h=null;try{h=new URL(l)}catch{return{url:l}}return h.host===ui.maptilerApiHost&&(h.searchParams.has("key")||h.searchParams.append("key",Pn.apiKey),Pn.session&&h.searchParams.append("mtsid",Kg)),{url:$P(h,a)}}function mv(l){return(a,h)=>{if(l!=null){const y=l(a,h),x=fv((y==null?void 0:y.url)??"",h);return{...y,...x}}return fv(a,h)}}function HP(){return document.createElement("canvas").getContext("webgl2")?null:typeof WebGL2RenderingContext<"u"?"Graphic rendering with WebGL2 has been disabled or is not supported by your graphic card. The map cannot be displayed.":"Your browser does not support graphic rendering with WebGL2. The map cannot be displayed."}function XP(l){const a=HP();if(!a)return;let h=null;if(typeof l=="string"?h=document.getElementById(l):l instanceof HTMLElement&&(h=l),!h)throw new Error("The Map container must be provided.");const y=document.createElement("div");throw y.innerHTML=a,y.classList.add("webgl-warning-div"),h.appendChild(y),new Error(a)}function gv(l,a){return!(!Array.isArray(l)||l.length!==2||l[0]!=="get"||typeof l[1]!="string"||a&&!l[1].startsWith("name:")||!a&&l[1]!=="name")}function YP(l,a,h){const y=structuredClone(l),x=T=>{if(typeof T!="string")for(let v=0;v<T.length;v+=1)gv(T[v],h)?T[v]=structuredClone(a):x(T[v])};return gv(y,h)?a:(x(y),y)}function KP(l,a){const h=a?/\{name:\S+\}/:/\{name\}/;return{contains:h.test(l),exactMatch:new RegExp(`^${h.source}$`).test(l)}}function JP(l,a,h){const y=h?/\{name:\S+\}/:/\{name\}/,x=l.split(y);return["concat",...x.flatMap((T,v)=>v===x.length-1?[T]:[T,a])]}function QP(l){var a;const h=/\{name(?::(?<language>\S+))?\}/g,y=[];for(;;){const x=h.exec(l);if(!x)break;const T=((a=x.groups)==null?void 0:a.language)??null;y.push(T)}return y}function eM(l){return!Array.isArray(l)||l.length!==2||l[0]!=="get"||typeof l[1]!="string"?null:l[1].trim()==="name"?{isLanguage:!0,localization:null}:l[1].trim().startsWith("name:")?{isLanguage:!0,localization:l[1].trim().split(":").pop()}:null}function tM(l){const a=[],h=structuredClone(l),y=x=>{if(typeof x!="string")for(let T=0;T<x.length;T+=1){const v=eM(x[T]);v?a.push(v.localization):y(x[T])}};return y([h]),a}function rM(l,a){const h=[];for(const T of l){if(T.type!=="symbol")continue;const v=T,{id:s,layout:I}=v;if(!I||!("text-field"in I))continue;const L=a.getLayoutProperty(s,"text-field");if(L)if(typeof L=="string"){const O=QP(L);h.push(O)}else{const O=tM(L);h.push(O)}}const y=h.flat(),x={unlocalized:0,localized:{}};for(const T of y)T===null?x.unlocalized+=1:(T in x.localized||(x.localized[T]=0),x.localized[T]+=1);return x}var nM=8,iM={version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},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"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},aM={"*":{type:"source"}},oM=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],sM={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},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},lM={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:{}}
vendor: 4,107 bytes, line 811
811,default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},cM={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:"*"}},uM={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:"filter"},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"}},hM={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"}}},pM={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"}}},dM={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"}},fM=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],mM={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},gM={"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},yM={"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},_M={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},vM={"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",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},xM=
vendor: 8,512 bytes, line 811
811{"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",
vendor: 12,198 bytes, line 811
811expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},bM={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},wM={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},TM={type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},SM={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},EM={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},PM={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},MM={type:"array",value:"expression_name",minimum:1},IM={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}},AM={"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}},CM={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},kM={type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},DM=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],LM={"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"}},RM={"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","feature"]},"property-type":"cross-faded-data-driven"},"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"}},zM={"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"}},FM={"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"}},OM={"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"}},BM={"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}
811,"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"}},NM={"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"}},jM={"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"}},VM={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},UM={"*":{type:"string"}},$M={type:"array",value:"interpolation_name",minimum:1},qM={type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}},GM={$version:nM,$root:iM,sources:aM,source:oM,source_vector:sM,source_raster:lM,source_raster_dem:cM,source_geojson:uM,source_video:hM,source_image:pM,layer:dM,layout:fM,layout_background:mM,layout_fill:gM,layout_circle:yM,layout_heatmap:_M,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:vM,layout_symbol:xM,layout_raster:bM,layout_hillshade:wM,"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:TM,filter_operator:SM,geometry_type:EM,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:PM,expression:MM,light:IM,sky:AM,terrain:CM,projection:kM,paint:DM,paint_fill:LM,"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:RM,paint_circle:zM,paint_heatmap:FM,paint_symbol:OM,paint_raster:BM,paint_hillshade:NM,"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:jM,transition:VM,"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:UM,interpolation:$M,interpolation_name:qM};class et{constructor(a,h,y,x){this.message=(a?`${a}: `:"")+y,x&&(this.identifier=x),h!=null&&h.__line__&&(this.line=h.__line__)}}function Od(l,...a){for(const h of a)for(const y in h)l[y]=h[y];return l}
811class Ca extends Error{constructor(a,h){super(h),this.message=h,this.key=a}}class Jg{constructor(a,h=[]){this.parent=a,this.bindings={};for(const[y,x]of h)this.bindings[y]=x}concat(a){return new Jg(this,a)}get(a){if(this.bindings[a])return this.bindings[a];if(this.parent)return this.parent.get(a);throw new Error(`${a} not found in scope.`)}has(a){return this.bindings[a]?!0:this.parent?this.parent.has(a):!1}}const Yd={kind:"null"},lt={kind:"number"},Jt={kind:"string"},Wt={kind:"boolean"},Da={kind:"color"},Kd={kind:"projectionDefinition"},ll={kind:"object"},Gt={kind:"value"},ZM={kind:"error"},Jd={kind:"collator"},Qd={kind:"formatted"},ef={kind:"padding"},vh={kind:"colorArray"},tf={kind:"numberArray"},Rh={kind:"resolvedImage"},rf={kind:"variableAnchorOffsetCollection"};function Oi(l,a){return{kind:"array",itemType:l,N:a}}function Yr(l){if(l.kind==="array"){const a=Yr(l.itemType);return typeof l.N=="number"?`array<${a}, ${l.N}>`:l.itemType.kind==="value"?"array":`array<${a}>`}else return l.kind}const WM=[Yd,lt,Jt,Wt,Da,Kd,Qd,ll,Oi(Gt),ef,tf,vh,Rh,rf];function xh(l,a){if(a.kind==="error")return null;if(l.kind==="array"){if(a.kind==="array"&&(a.N===0&&a.itemType.kind==="value"||!xh(l.itemType,a.itemType))&&(typeof l.N!="number"||l.N===a.N))return null}else{if(l.kind===a.kind)return null;if(l.kind==="value"){for(const h of WM)if(!xh(h,a))return null}}return`Expected ${Yr(l)} but found ${Yr(a)} instead.`}function Qg(l,a){return a.some(h=>h.kind===l.kind)}function cl(l,a){return a.some(h=>h==="null"?l===null:h==="array"?Array.isArray(l):h==="object"?l&&!Array.isArray(l)&&typeof l=="object":h===typeof l)}function Wo(l,a){return l.kind==="array"&&a.kind==="array"?l.itemType.kind===a.itemType.kind&&typeof l.N=="number":l.kind===a.kind}const _b=.96422,vb=1,xb=.82521,bb=4/29,Ac=6/29,wb=3*Ac*Ac,HM=Ac*Ac*Ac,XM=Math.PI/180,YM=180/Math.PI;function Tb(l){return l=l%360,l<0&&(l+=360),l}function Sb([l,a,h,y]){l=Gm(l),a=Gm(a),h=Gm(h);let x,T;const v=Zm((.2225045*l+.7168786*a+.0606169*h)/vb);l===a&&a===h?x=T=v:(x=Zm((.4360747*l+.3850649*a+.1430804*h)/_b),T=Zm((.0139322*l+.0971045*a+.7141733*h)/xb));const s=116*v-16;return[s<0?0:s,500*(x-v),200*(v-T),y]}function Gm(l){return l<=.04045?l/12.92:Math.pow((l+.055)/1.055,2.4)}function Zm(l){return l>HM?Math.pow(l,1/3):l/wb+bb}function Eb([l,a,h,y]){let x=(l+16)/116,T=isNaN(a)?x:x+a/500,v=isNaN(h)?x:x-h/200;return x=vb*Hm(x),T=_b*Hm(T),v=xb*Hm(v),[Wm(3.1338561*T-1.6168667*x-.4906146*v),Wm(-.9787684*T+1.9161415*x+.033454*v),Wm(.0719453*T-.2289914*x+1.4052427*v),y]}function Wm(l){return l=l<=.00304?12.92*l:1.055*Math.pow(l,1/2.4)-.055,l<0?0:l>1?1:l}function Hm(l){return l>Ac?l*l*l:wb*(l-bb)}function KM(l){const[a,h,y,x]=Sb(l),T=Math.sqrt(h*h+y*y);return[Math.round(T*1e4)?Tb(Math.atan2(y,h)*YM):NaN,T,a,x]}function JM([l,a,h,y]){return l=isNaN(l)?0:l*XM,Eb([h,Math.cos(l)*a,Math.sin(l)*a,y])}function QM([l,a,h,y]){l=Tb(l),a/=100,h/=100;function x(T){const v=(T+l/30)%12,s=a*Math.min(h,1-h);return h-s*Math.max(-1,Math.min(v-3,9-v,1))}return[x(0),x(8),x(4),y]}const eI=Object.hasOwn||function(l,a){return Object.prototype.hasOwnProperty.call(l,a)};function fh(l,a){return eI(l,a)?l[a]:void 0}function tI(l){if(l=l.toLowerCase().trim(),l==="transparent")return[0,0,0,0];const a=fh(rI,l);if(a){const[x,T,v]=a;return[x/255,T/255,v/255,1]}if(l.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(l)){const x=l.length<6?1:2;let T=1;return[md(l.slice(T,T+=x)),md(l.slice(T,T+=x)),md(l.slice(T,T+=x)),md(l.slice(T,T+x)||"ff")]}if(l.startsWith("rgb")){const x=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,T=l.match(x);if(T){const[v,s,I,L,O,H,J,ee,ue,fe,te,Be]=T,Ae=[L||" ",J||" ",fe].join("");if(Ae==="  "||Ae==="  /"||Ae===",,"||Ae===",,,"){const De=[I,H,ue].join(""),xe=De==="%%%"?100:De===""?255:0;if(xe){const ye=[Sc(+s/xe,0,1),Sc(+O/xe,0,1),Sc(+ee/xe,0,1),te?yv(+te,Be):1];if(_v(ye))return ye}}return}}const h=/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,y=l.match(h);if(y){const[x,T,v,s,I,L,O,H,J]=y,ee=[v||" ",I||" ",O].join("");if(ee==="  "||ee==="  /"||ee===",,"||ee===",,,"){const ue=[+T,Sc(+s,0,100),Sc(+L,0,100),H?yv(+H,J):1];if(_v(ue))return QM(ue)}}}function md(l){return parseInt(l.padEnd(2,l),16)/255}function yv(l,a){return Sc(a?l/100:l,0,1)}function Sc(l,a,h){return Math.min(Math.max(a,l),h)}function _v(l){return!l.some(Number.isNaN)}const rI={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
811ive:[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 ul(l,a,h){return l+h*(a-l)}function bh(l,a,h){return l.map((y,x)=>ul(y,a[x],h))}class wr{constructor(a,h,y,x=1,T=!0){this.r=a,this.g=h,this.b=y,this.a=x,T||(this.r*=x,this.g*=x,this.b*=x,x||this.overwriteGetter("rgb",[a,h,y,x]))}static parse(a){if(a instanceof wr)return a;
811if(typeof a!="string")return;const h=tI(a);if(h)return new wr(...h,!1)}get rgb(){const{r:a,g:h,b:y,a:x}=this,T=x||1/0;return this.overwriteGetter("rgb",[a/T,h/T,y/T,x])}get hcl(){return this.overwriteGetter("hcl",KM(this.rgb))}get lab(){return this.overwriteGetter("lab",Sb(this.rgb))}overwriteGetter(a,h){return Object.defineProperty(this,a,{value:h}),h}toString(){const[a,h,y,x]=this.rgb;return`rgba(${[a,h,y].map(T=>Math.round(T*255)).join(",")},${x})`}static interpolate(a,h,y,x="rgb"){switch(x){case"rgb":{const[T,v,s,I]=bh(a.rgb,h.rgb,y);return new wr(T,v,s,I,!1)}case"hcl":{const[T,v,s,I]=a.hcl,[L,O,H,J]=h.hcl;let ee,ue;if(!isNaN(T)&&!isNaN(L)){let De=L-T;L>T&&De>180?De-=360:L<T&&T-L>180&&(De+=360),ee=T+y*De}else isNaN(T)?isNaN(L)?ee=NaN:(ee=L,(s===1||s===0)&&(ue=O)):(ee=T,(H===1||H===0)&&(ue=v));const[fe,te,Be,Ae]=JM([ee,ue??ul(v,O,y),ul(s,H,y),ul(I,J,y)]);return new wr(fe,te,Be,Ae,!1)}case"lab":{const[T,v,s,I]=Eb(bh(a.lab,h.lab,y));return new wr(T,v,s,I,!1)}}}}wr.black=new wr(0,0,0,1);wr.white=new wr(1,1,1,1);wr.transparent=new wr(0,0,0,0);wr.red=new wr(1,0,0,1);class ey{constructor(a,h,y){a?this.sensitivity=h?"variant":"case":this.sensitivity=h?"accent":"base",this.locale=y,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(a,h){return this.collator.compare(a,h)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const nI=["bottom","center","top"];class bg{constructor(a,h,y,x,T,v){this.text=a,this.image=h,this.scale=y,this.fontStack=x,this.textColor=T,this.verticalAlign=v}}class uo{constructor(a){this.sections=a}static fromString(a){return new uo([new bg(a,null,null,null,null,null)])}isEmpty(){return this.sections.length===0?!0:!this.sections.some(a=>a.text.length!==0||a.image&&a.image.name.length!==0)}static factory(a){return a instanceof uo?a:uo.fromString(a)}toString(){return this.sections.length===0?"":this.sections.map(a=>a.text).join("")}}class ua{constructor(a){this.values=a.slice()}static parse(a){if(a instanceof ua)return a;if(typeof a=="number")return new ua([a,a,a,a]);if(Array.isArray(a)&&!(a.length<1||a.length>4)){for(const h of a)if(typeof h!="number")return;switch(a.length){case 1:a=[a[0],a[0],a[0],a[0]];break;case 2:a=[a[0],a[1],a[0],a[1]];break;case 3:a=[a[0],a[1],a[2],a[1]];break}return new ua(a)}}toString(){return JSON.stringify(this.values)}static interpolate(a,h,y){return new ua(bh(a.values,h.values,y))}}class ha{constructor(a){this.values=a.slice()}static parse(a){if(a instanceof ha)return a;if(typeof a=="number")return new ha([a]);if(Array.isArray(a)){for(const h of a)if(typeof h!="number")return;return new ha(a)}}toString(){return JSON.stringify(this.values)}static interpolate(a,h,y){return new ha(bh(a.values,h.values,y))}}class Bi{constructor(a){this.values=a.slice()}static parse(a){if(a instanceof Bi)return a;if(typeof a=="string"){const y=wr.parse(a);return y?new Bi([y]):void 0}if(!Array.isArray(a))return;const h=[];for(const y of a){if(typeof y!="string")return;const x=wr.parse(y);if(!x)return;h.push(x)}return new Bi(h)}toString(){return JSON.stringify(this.values)}static interpolate(a,h,y,x="rgb"){const T=[];if(a.values.length!=h.values.length)throw new Error(`colorArray: Arrays have mismatched length (${a.values.length} vs. ${h.values.length}), cannot interpolate.`);for(let v=0;v<a.values.length;v++)T.push(wr.interpolate(a.values[v],h.values[v],y,x));return new Bi(T)}}
811class nn extends Error{constructor(a){super(a),this.name="RuntimeError"}toJSON(){return this.message}}const iI=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class La{constructor(a){this.values=a.slice()}static parse(a){if(a instanceof La)return a;if(!(!Array.isArray(a)||a.length<1||a.length%2!==0)){for(let h=0;h<a.length;h+=2){const y=a[h],x=a[h+1];if(typeof y!="string"||!iI.has(y)||!Array.isArray(x)||x.length!==2||typeof x[0]!="number"||typeof x[1]!="number")return}return new La(a)}}toString(){return JSON.stringify(this.values)}static interpolate(a,h,y){const x=a.values,T=h.values;if(x.length!==T.length)throw new nn(`Cannot interpolate values of different length. from: ${a.toString()}, to: ${h.toString()}`);const v=[];for(let s=0;s<x.length;s+=2){if(x[s]!==T[s])throw new nn(`Cannot interpolate values containing mismatched anchors. from[${s}]: ${x[s]}, to[${s}]: ${T[s]}`);v.push(x[s]);const[I,L]=x[s+1],[O,H]=T[s+1];v.push([ul(I,O,y),ul(L,H,y)])}return new La(v)}}class rs{constructor(a){this.name=a.name,this.available=a.available}toString(){return this.name}static fromString(a){return a?new rs({name:a,available:!1}):null}}class sa{constructor(a,h,y){this.from=a,this.to=h,this.transition=y}static interpolate(a,h,y){return new sa(a,h,y)}static parse(a){if(a instanceof sa)return a;if(Array.isArray(a)&&a.length===3&&typeof a[0]=="string"&&typeof a[1]=="string"&&typeof a[2]=="number")return new sa(a[0],a[1],a[2]);if(typeof a=="object"&&typeof a.from=="string"&&typeof a.to=="string"&&typeof a.transition=="number")return new sa(a.from,a.to,a.transition);if(typeof a=="string")return new sa(a,a,1)}}function Pb(l,a,h,y){return typeof l=="number"&&l>=0&&l<=255&&typeof a=="number"&&a>=0&&a<=255&&typeof h=="number"&&h>=0&&h<=255?typeof y>"u"||typeof y=="number"&&y>=0&&y<=1?null:`Invalid rgba value [${[l,a,h,y].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof y=="number"?[l,a,h,y]:[l,a,h]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function wh(l){if(l===null||typeof l=="string"||typeof l=="boolean"||typeof l=="number"||l instanceof sa||l instanceof wr||l instanceof ey||l instanceof uo||l instanceof ua||l instanceof ha||l instanceof Bi||l instanceof La||l instanceof rs)return!0;if(Array.isArray(l)){for(const a of l)if(!wh(a))return!1;return!0}else if(typeof l=="object"){for(const a in l)if(!wh(l[a]))return!1;return!0}else return!1}function Mn(l){if(l===null)return Yd;if(typeof l=="string")return Jt;if(typeof l=="boolean")return Wt;if(typeof l=="number")return lt;if(l instanceof wr)return Da;if(l instanceof sa)return Kd;if(l instanceof ey)return Jd;if(l instanceof uo)return Qd;if(l instanceof ua)return ef;if(l instanceof ha)return tf;if(l instanceof Bi)return vh;if(l instanceof La)return rf;if(l instanceof rs)return Rh;if(Array.isArray(l)){const a=l.length;let h;for(const y of l){const x=Mn(y);if(!h)h=x;else{if(h===x)continue;h=Gt;break}}return Oi(h||Gt,a)}else return ll}function mh(l){const a=typeof l;return l===null?"":a==="string"||a==="number"||a==="boolean"?String(l):l instanceof wr||l instanceof sa||l instanceof uo||l instanceof ua||l instanceof ha||l instanceof Bi||l instanceof La||l instanceof rs?l.toString():JSON.stringify(l)}class Fc{constructor(a,h){this.type=a,this.value=h}static parse(a,h){if(a.length!==2)return h.error(`'literal' expression requires exactly one argument, but found ${a.length-1} instead.`);if(!wh(a[1]))return h.error("invalid value");const y=a[1];let x=Mn(y);const T=h.expectedType;return x.kind==="array"&&x.N===0&&T&&T.kind==="array"&&(typeof T.N!="number"||T.N===0)&&(x=T),new Fc(x,y)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const gd={string:Jt,number:lt,boolean:Wt,object:ll};class la{constructor(a,h){this.type=a,this.args=h}static parse(a,h){if(a.length<2)return h.error("Expected at least one argument.");let y=1,x;const T=a[0];if(T==="array"){let s;if(a.length>2){const L=a[1];if(typeof L!="string"||!(L in gd)||L==="object")return h.error('The item type argument of "array" must be one of string, number, boolean',1);s=gd[L],y++}else s=Gt;let I;if(a.length>3){if(a[2]!==null&&(typeof a[2]!="number"||a[2]<0||a[2]!==Math.floor(a[2])))return h.error('The length argument to "array" must be a positive integer literal',2);I=a[2],y++}x=Oi(s,I)}else{if(!gd[T])throw new Error(`Types doesn't contain name = ${T}`);x=gd[T]}const v=[];for(;y<a.length;y++){const s=h.parse(a[y],y,Gt);if(!s)return null;v.push(s)}return new la(x,v)}evaluate(a){for(let h=0;h<this.args.length;h++){const y=this.args[h].evaluate(a);if(xh(this.type,Mn(y))){if(h===this.args.length-1)throw new nn(`Expected value to be of type ${Yr(this.type)}, but found ${Yr(Mn(y))} instead.`)}else return y}throw new Error}
811eachChild(a){this.args.forEach(a)}outputDefined(){return this.args.every(a=>a.outputDefined())}}const vv={"to-boolean":Wt,"to-color":Da,"to-number":lt,"to-string":Jt};class Xo{constructor(a,h){this.type=a,this.args=h}static parse(a,h){if(a.length<2)return h.error("Expected at least one argument.");const y=a[0];if(!vv[y])throw new Error(`Can't parse ${y} as it is not part of the known types`);if((y==="to-boolean"||y==="to-string")&&a.length!==2)return h.error("Expected one argument.");const x=vv[y],T=[];for(let v=1;v<a.length;v++){const s=h.parse(a[v],v,Gt);if(!s)return null;T.push(s)}return new Xo(x,T)}evaluate(a){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(a);case"color":{let h,y;for(const x of this.args){if(h=x.evaluate(a),y=null,h instanceof wr)return h;if(typeof h=="string"){const T=a.parseColor(h);if(T)return T}else if(Array.isArray(h)&&(h.length<3||h.length>4?y=`Invalid rgba value ${JSON.stringify(h)}: expected an array containing either three or four numeric values.`:y=Pb(h[0],h[1],h[2],h[3]),!y))return new wr(h[0]/255,h[1]/255,h[2]/255,h[3])}throw new nn(y||`Could not parse color from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"padding":{let h;for(const y of this.args){h=y.evaluate(a);const x=ua.parse(h);if(x)return x}throw new nn(`Could not parse padding from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"numberArray":{let h;for(const y of this.args){h=y.evaluate(a);const x=ha.parse(h);if(x)return x}throw new nn(`Could not parse numberArray from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"colorArray":{let h;for(const y of this.args){h=y.evaluate(a);const x=Bi.parse(h);if(x)return x}throw new nn(`Could not parse colorArray from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"variableAnchorOffsetCollection":{let h;for(const y of this.args){h=y.evaluate(a);const x=La.parse(h);if(x)return x}throw new nn(`Could not parse variableAnchorOffsetCollection from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"number":{let h=null;for(const y of this.args){if(h=y.evaluate(a),h===null)return 0;const x=Number(h);if(!isNaN(x))return x}throw new nn(`Could not convert ${JSON.stringify(h)} to number.`)}case"formatted":return uo.fromString(mh(this.args[0].evaluate(a)));case"resolvedImage":return rs.fromString(mh(this.args[0].evaluate(a)));case"projectionDefinition":return this.args[0].evaluate(a);default:return mh(this.args[0].evaluate(a))}}eachChild(a){this.args.forEach(a)}outputDefined(){return this.args.every(a=>a.outputDefined())}}const aI=["Unknown","Point","LineString","Polygon"];class Mb{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"?aI[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(a){let h=this._parseColorCache.get(a);return h||(h=wr.parse(a),this._parseColorCache.set(a,h)),h}}class nf{constructor(a,h,y=[],x,T=new Jg,v=[]){this.registry=a,this.path=y,this.key=y.map(s=>`[${s}]`).join(""),this.scope=T,this.errors=v,this.expectedType=x,this._isConstant=h}parse(a,h,y,x,T={}){return h?this.concat(h,y,x)._parse(a,T):this._parse(a,T)}_parse(a,h){(a===null||typeof a=="string"||typeof a=="boolean"||typeof a=="number")&&(a=["literal",a]);function y(x,T,v){return v==="assert"?new la(T,[x]):v==="coerce"?new Xo(T,[x]):x}if(Array.isArray(a)){if(a.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const x=a[0];if(typeof x!="string")return this.error(`Expression name must be a string, but found ${typeof x} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const T=this.registry[x];if(T){let v=T.parse(a,this);if(!v)return null;if(this.expectedType){const s=this.expectedType,I=v.type;
811if((s.kind==="string"||s.kind==="number"||s.kind==="boolean"||s.kind==="object"||s.kind==="array")&&I.kind==="value")v=y(v,s,h.typeAnnotation||"assert");else if(s.kind==="projectionDefinition"&&["string","array"].includes(I.kind)||["color","formatted","resolvedImage"].includes(s.kind)&&["value","string"].includes(I.kind)||["padding","numberArray"].includes(s.kind)&&["value","number","array"].includes(I.kind)||s.kind==="colorArray"&&["value","string","array"].includes(I.kind)||s.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(I.kind))v=y(v,s,h.typeAnnotation||"coerce");else if(this.checkSubtype(s,I))return null}if(!(v instanceof Fc)&&v.type.kind!=="resolvedImage"&&this._isConstant(v)){const s=new Mb;try{v=new Fc(v.type,v.evaluate(s))}catch(I){return this.error(I.message),null}}return v}return this.error(`Unknown expression "${x}". If you wanted a literal array, use ["literal", [...]].`,0)}else return typeof a>"u"?this.error("'undefined' value invalid. Use null instead."):typeof a=="object"?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof a} instead.`)}concat(a,h,y){const x=typeof a=="number"?this.path.concat(a):this.path,T=y?this.scope.concat(y):this.scope;return new nf(this.registry,this._isConstant,x,h||null,T,this.errors)}error(a,...h){const y=`${this.key}${h.map(x=>`[${x}]`).join("")}`;this.errors.push(new Ca(y,a))}checkSubtype(a,h){const y=xh(a,h);return y&&this.error(y),y}}class af{constructor(a,h){this.type=h.type,this.bindings=[].concat(a),this.result=h}evaluate(a){return this.result.evaluate(a)}eachChild(a){for(const h of this.bindings)a(h[1]);a(this.result)}static parse(a,h){if(a.length<4)return h.error(`Expected at least 3 arguments, but found ${a.length-1} instead.`);const y=[];for(let T=1;T<a.length-1;T+=2){const v=a[T];if(typeof v!="string")return h.error(`Expected string, but found ${typeof v} instead.`,T);
811if(/[^a-zA-Z0-9_]/.test(v))return h.error("Variable names must contain only alphanumeric characters or '_'.",T);const s=h.parse(a[T+1],T+1);if(!s)return null;y.push([v,s])}const x=h.parse(a[a.length-1],a.length-1,h.expectedType,y);return x?new af(y,x):null}outputDefined(){return this.result.outputDefined()}}class of{constructor(a,h){this.type=h.type,this.name=a,this.boundExpression=h}static parse(a,h){if(a.length!==2||typeof a[1]!="string")return h.error("'var' expression requires exactly one string literal argument.");const y=a[1];return h.scope.has(y)?new of(y,h.scope.get(y)):h.error(`Unknown variable "${y}". Make sure "${y}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(a){return this.boundExpression.evaluate(a)}eachChild(){}outputDefined(){return!1}}class ty{constructor(a,h,y){this.type=a,this.index=h,this.input=y}static parse(a,h){if(a.length!==3)return h.error(`Expected 2 arguments, but found ${a.length-1} instead.`);const y=h.parse(a[1],1,lt),x=h.parse(a[2],2,Oi(h.expectedType||Gt));if(!y||!x)return null;const T=x.type;return new ty(T.itemType,y,x)}evaluate(a){const h=this.index.evaluate(a),y=this.input.evaluate(a);if(h<0)throw new nn(`Array index out of bounds: ${h} < 0.`);if(h>=y.length)throw new nn(`Array index out of bounds: ${h} > ${y.length-1}.`);if(h!==Math.floor(h))throw new nn(`Array index must be an integer, but found ${h} instead.`);return y[h]}eachChild(a){a(this.index),a(this.input)}outputDefined(){return!1}}class ry{constructor(a,h){this.type=Wt,this.needle=a,this.haystack=h}static parse(a,h){if(a.length!==3)return h.error(`Expected 2 arguments, but found ${a.length-1} instead.`);const y=h.parse(a[1],1,Gt),x=h.parse(a[2],2,Gt);return!y||!x?null:Qg(y.type,[Wt,Jt,lt,Yd,Gt])?new ry(y,x):h.error(`Expected first argument to be of type boolean, string, number or null, but found ${Yr(y.type)} instead`)}evaluate(a){const h=this.needle.evaluate(a),y=this.haystack.evaluate(a);if(!y)return!1;if(!cl(h,["boolean","string","number","null"]))throw new nn(`Expected first argument to be of type boolean, string, number or null, but found ${Yr(Mn(h))} instead.`);if(!cl(y,["string","array"]))throw new nn(`Expected second argument to be of type array or string, but found ${Yr(Mn(y))} instead.`);return y.indexOf(h)>=0}eachChild(a){a(this.needle),a(this.haystack)}outputDefined(){return!0}}class Bd{constructor(a,h,y){this.type=lt,this.needle=a,this.haystack=h,this.fromIndex=y}static parse(a,h){if(a.length<=2||a.length>=5)return h.error(`Expected 2 or 3 arguments, but found ${a.length-1} instead.`);const y=h.parse(a[1],1,Gt),x=h.parse(a[2],2,Gt);if(!y||!x)return null;if(!Qg(y.type,[Wt,Jt,lt,Yd,Gt]))return h.error(`Expected first argument to be of type boolean, string, number or null, but found ${Yr(y.type)} instead`);if(a.length===4){const T=h.parse(a[3],3,lt);return T?new Bd(y,x,T):null}else return new Bd(y,x)}evaluate(a){const h=this.needle.evaluate(a),y=this.haystack.evaluate(a);if(!cl(h,["boolean","string","number","null"]))throw new nn(`Expected first argument to be of type boolean, string, number or null, but found ${Yr(Mn(h))} instead.`);let x;if(this.fromIndex&&(x=this.fromIndex.evaluate(a)),cl(y,["string"])){const T=y.indexOf(h,x);return T===-1?-1:[...y.slice(0,T)].length}else{if(cl(y,["array"]))return y.indexOf(h,x);throw new nn(`Expected second argument to be of type array or string, but found ${Yr(Mn(y))} instead.`)}}eachChild(a){a(this.needle),a(this.haystack),this.fromIndex&&a(this.fromIndex)}outputDefined(){return!1}}class ny{constructor(a,h,y,x,T,v){this.inputType=a,this.type=h,this.input=y,this.cases=x,this.outputs=T,this.otherwise=v}static parse(a,h){if(a.length<5)return h.error(`Expected at least 4 arguments, but found only ${a.length-1}.`);if(a.length%2!==1)return h.error("Expected an even number of arguments.");let y,x;h.expectedType&&h.expectedType.kind!=="value"&&(x=h.expectedType);const T={},v=[];for(let L=2;L<a.length-1;L+=2){let O=a[L];const H=a[L+1];Array.isArray(O)||(O=[O]);const J=h.concat(L);if(O.length===0)return J.error("Expected at least one branch label.");for(const ue of O){if(typeof ue!="number"&&typeof ue!="string")return J.error("Branch labels must be numbers or strings.");if(typeof ue=="number"&&Math.abs(ue)>Number.MAX_SAFE_INTEGER)return J.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof ue=="number"&&Math.floor(ue)!==ue)return J.error("Numeric branch labels must be integer values.");if(!y)y=Mn(ue);else if(J.checkSubtype(y,Mn(ue)))return null;if(typeof T[String(ue)]<"u")return J.error("Branch labels must be unique.");T[String(ue)]=v.length}const ee=h.parse(H,L,x);if(!ee)return null;x=x||ee.type,v.push(ee)}const s=h.parse(a[1],1,Gt);if(!s)return null;const I=h.parse(a[a.length-1],a.length-1,x);return!I||s.type.kind!=="value"&&h.concat(1).checkSubtype(y,s.type)?null:new ny(y,x,s,T,v,I)}evaluate(a){const h=this.input.evaluate(a);return(Mn(h)===this.inputType&&this.outputs[this.cases[h]]||this.otherwise).evaluate(a)}
811eachChild(a){a(this.input),this.outputs.forEach(a),a(this.otherwise)}outputDefined(){return this.outputs.every(a=>a.outputDefined())&&this.otherwise.outputDefined()}}class iy{constructor(a,h,y){this.type=a,this.branches=h,this.otherwise=y}static parse(a,h){if(a.length<4)return h.error(`Expected at least 3 arguments, but found only ${a.length-1}.`);if(a.length%2!==0)return h.error("Expected an odd number of arguments.");let y;h.expectedType&&h.expectedType.kind!=="value"&&(y=h.expectedType);const x=[];for(let v=1;v<a.length-1;v+=2){const s=h.parse(a[v],v,Wt);if(!s)return null;const I=h.parse(a[v+1],v+1,y);if(!I)return null;x.push([s,I]),y=y||I.type}const T=h.parse(a[a.length-1],a.length-1,y);if(!T)return null;if(!y)throw new Error("Can't infer output type");return new iy(y,x,T)}evaluate(a){for(const[h,y]of this.branches)if(h.evaluate(a))return y.evaluate(a);return this.otherwise.evaluate(a)}eachChild(a){for(const[h,y]of this.branches)a(h),a(y);a(this.otherwise)}outputDefined(){return this.branches.every(([a,h])=>h.outputDefined())&&this.otherwise.outputDefined()}}class Nd{constructor(a,h,y,x){this.type=a,this.input=h,this.beginIndex=y,this.endIndex=x}static parse(a,h){if(a.length<=2||a.length>=5)return h.error(`Expected 2 or 3 arguments, but found ${a.length-1} instead.`);const y=h.parse(a[1],1,Gt),x=h.parse(a[2],2,lt);if(!y||!x)return null;if(!Qg(y.type,[Oi(Gt),Jt,Gt]))return h.error(`Expected first argument to be of type array or string, but found ${Yr(y.type)} instead`);if(a.length===4){const T=h.parse(a[3],3,lt);return T?new Nd(y.type,y,x,T):null}else return new Nd(y.type,y,x)}evaluate(a){const h=this.input.evaluate(a),y=this.beginIndex.evaluate(a);let x;if(this.endIndex&&(x=this.endIndex.evaluate(a)),cl(h,["string"]))return[...h].slice(y,x).join("");if(cl(h,["array"]))return h.slice(y,x);throw new nn(`Expected first argument to be of type array or string, but found ${Yr(Mn(h))} instead.`)}eachChild(a){a(this.input),a(this.beginIndex),this.endIndex&&a(this.endIndex)}outputDefined(){return!1}}function Ib(l,a){const h=l.length-1;let y=0,x=h,T=0,v,s;for(;y<=x;)if(T=Math.floor((y+x)/2),v=l[T],s=l[T+1],v<=a){if(T===h||a<s)return T;y=T+1}else if(v>a)x=T-1;else throw new nn("Input is not a number.");return 0}class sf{constructor(a,h,y){this.type=a,this.input=h,this.labels=[],this.outputs=[];for(const[x,T]of y)this.labels.push(x),this.outputs.push(T)}static parse(a,h){if(a.length-1<4)return h.error(`Expected at least 4 arguments, but found only ${a.length-1}.`);if((a.length-1)%2!==0)return h.error("Expected an even number of arguments.");const y=h.parse(a[1],1,lt);if(!y)return null;const x=[];let T=null;h.expectedType&&h.expectedType.kind!=="value"&&(T=h.expectedType);for(let v=1;v<a.length;v+=2){const s=v===1?-1/0:a[v],I=a[v+1],L=v,O=v+1;if(typeof s!="number")return h.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',L);if(x.length&&x[x.length-1][0]>=s)return h.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',L);const H=h.parse(I,O,T);if(!H)return null;T=T||H.type,x.push([s,H])}return new sf(T,y,x)}evaluate(a){const h=this.labels,y=this.outputs;if(h.length===1)return y[0].evaluate(a);const x=this.input.evaluate(a);if(x<=h[0])return y[0].evaluate(a);const T=h.length;if(x>=h[T-1])return y[T-1].evaluate(a);const v=Ib(h,x);return y[v].evaluate(a)}eachChild(a){a(this.input);for(const h of this.outputs)a(h)}outputDefined(){return this.outputs.every(a=>a.outputDefined())}}function oI(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var Xm,xv;function sI(){if(xv)return Xm;xv=1,Xm=l;function l(a,h,y,x){this.cx=3*a,this.bx=3*(y-a)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*h,this.by=3*(x-h)-this.cy,this.ay=1-this.cy-this.by,this.p1x=a,this.p1y=h,this.p2x=y,this.p2y=x}return l.prototype={sampleCurveX:function(a){return((this.ax*a+this.bx)*a+this.cx)*a},sampleCurveY:function(a){return((this.ay*a+this.by)*a+this.cy)*a},sampleCurveDerivativeX:function(a){return(3*this.ax*a+2*this.bx)*a+this.cx}
811,solveCurveX:function(a,h){if(h===void 0&&(h=1e-6),a<0)return 0;if(a>1)return 1;for(var y=a,x=0;x<8;x++){var T=this.sampleCurveX(y)-a;if(Math.abs(T)<h)return y;var v=this.sampleCurveDerivativeX(y);if(Math.abs(v)<1e-6)break;y=y-T/v}var s=0,I=1;for(y=a,x=0;x<20&&(T=this.sampleCurveX(y),!(Math.abs(T-a)<h));x++)a>T?s=y:I=y,y=(I-s)*.5+s;return y},solve:function(a,h){return this.sampleCurveY(this.solveCurveX(a,h))}},Xm}var lI=sI(),cI=oI(lI);class Ra{constructor(a,h,y,x,T){this.type=a,this.operator=h,this.interpolation=y,this.input=x,this.labels=[],this.outputs=[];for(const[v,s]of T)this.labels.push(v),this.outputs.push(s)}static interpolationFactor(a,h,y,x){let T=0;if(a.name==="exponential")T=Ym(h,a.base,y,x);else if(a.name==="linear")T=Ym(h,1,y,x);else if(a.name==="cubic-bezier"){const v=a.controlPoints;T=new cI(v[0],v[1],v[2],v[3]).solve(Ym(h,1,y,x))}return T}static parse(a,h){let[y,x,T,...v]=a;if(!Array.isArray(x)||x.length===0)return h.error("Expected an interpolation type expression.",1);if(x[0]==="linear")x={name:"linear"};else if(x[0]==="exponential"){const L=x[1];if(typeof L!="number")return h.error("Exponential interpolation requires a numeric base.",1,1);x={name:"exponential",base:L}}else if(x[0]==="cubic-bezier"){const L=x.slice(1);if(L.length!==4||L.some(O=>typeof O!="number"||O<0||O>1))return h.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);x={name:"cubic-bezier",controlPoints:L}}else return h.error(`Unknown interpolation type ${String(x[0])}`,1,0);if(a.length-1<4)return h.error(`Expected at least 4 arguments, but found only ${a.length-1}.`);if((a.length-1)%2!==0)return h.error("Expected an even number of arguments.");if(T=h.parse(T,2,lt),!T)return null;const s=[];let I=null;(y==="interpolate-hcl"||y==="interpolate-lab")&&h.expectedType!=vh?I=Da:h.expectedType&&h.expectedType.kind!=="value"&&(I=h.expectedType);for(let L=0;L<v.length;L+=2){const O=v[L],H=v[L+1],J=L+3,ee=L+4;if(typeof O!="number")return h.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',J);if(s.length&&s[s.length-1][0]>=O)return h.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',J);const ue=h.parse(H,ee,I);if(!ue)return null;I=I||ue.type,s.push([O,ue])}return!Wo(I,lt)&&!Wo(I,Kd)&&!Wo(I,Da)&&!Wo(I,ef)&&!Wo(I,tf)&&!Wo(I,vh)&&!Wo(I,rf)&&!Wo(I,Oi(lt))?h.error(`Type ${Yr(I)} is not interpolatable.`):new Ra(I,y,x,T,s)}evaluate(a){const h=this.labels,y=this.outputs;if(h.length===1)return y[0].evaluate(a);const x=this.input.evaluate(a);if(x<=h[0])return y[0].evaluate(a);const T=h.length;if(x>=h[T-1])return y[T-1].evaluate(a);const v=Ib(h,x),s=h[v],I=h[v+1],L=Ra.interpolationFactor(this.interpolation,x,s,I),O=y[v].evaluate(a),H=y[v+1].evaluate(a);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return ul(O,H,L);case"color":return wr.interpolate(O,H,L);case"padding":return ua.interpolate(O,H,L);case"colorArray":return Bi.interpolate(O,H,L);case"numberArray":return ha.interpolate(O,H,L);case"variableAnchorOffsetCollection":return La.interpolate(O,H,L);case"array":return bh(O,H,L);case"projectionDefinition":return sa.interpolate(O,H,L)}case"interpolate-hcl":switch(this.type.kind){case"color":return wr.interpolate(O,H,L,"hcl");case"colorArray":return Bi.interpolate(O,H,L,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return wr.interpolate(O,H,L,"lab");case"colorArray":return Bi.interpolate(O,H,L,"lab")}}}eachChild(a){a(this.input);for(const h of this.outputs)a(h)}outputDefined(){return this.outputs.every(a=>a.outputDefined())}}function Ym(l,a,h,y){const x=y-h,T=l-h;return x===0?0:a===1?T/x:(Math.pow(a,T)-1)/(Math.pow(a,x)-1)}class Th{constructor(a,h){this.type=a,this.args=h}static parse(a,h){if(a.length<2)return h.error("Expected at least one argument.");let y=null;const x=h.expectedType;x&&x.kind!=="value"&&(y=x);const T=[];for(const v of a.slice(1)){const s=h.parse(v,1+T.length,y,void 0,{typeAnnotation:"omit"});if(!s)return null;y=y||s.type,T.push(s)}if(!y)throw new Error("No output type");return x&&T.some(v=>xh(x,v.type))?new Th(Gt,T):new Th(y,T)}evaluate(a){let h=null,y=0,x;for(const T of this.args)if(y++,h=T.evaluate(a),h&&h instanceof rs&&!h.available&&(x||(x=h.name),h=null,y===this.args.length&&(h=x)),h!==null)break;return h}
811eachChild(a){this.args.forEach(a)}outputDefined(){return this.args.every(a=>a.outputDefined())}}function bv(l,a){return l==="=="||l==="!="?a.kind==="boolean"||a.kind==="string"||a.kind==="number"||a.kind==="null"||a.kind==="value":a.kind==="string"||a.kind==="number"||a.kind==="value"}function uI(l,a,h){return a===h}function hI(l,a,h){return a!==h}function pI(l,a,h){return a<h}function dI(l,a,h){return a>h}function fI(l,a,h){return a<=h}function mI(l,a,h){return a>=h}function Ab(l,a,h,y){return y.compare(a,h)===0}function gI(l,a,h,y){return!Ab(l,a,h,y)}function yI(l,a,h,y){return y.compare(a,h)<0}function _I(l,a,h,y){return y.compare(a,h)>0}function vI(l,a,h,y){return y.compare(a,h)<=0}function xI(l,a,h,y){return y.compare(a,h)>=0}function Vc(l,a,h){const y=l!=="=="&&l!=="!=";return class Cb{constructor(T,v,s){this.type=Wt,this.lhs=T,this.rhs=v,this.collator=s,this.hasUntypedArgument=T.type.kind==="value"||v.type.kind==="value"}static parse(T,v){if(T.length!==3&&T.length!==4)return v.error("Expected two or three arguments.");const s=T[0];let I=v.parse(T[1],1,Gt);if(!I)return null;if(!bv(s,I.type))return v.concat(1).error(`"${s}" comparisons are not supported for type '${Yr(I.type)}'.`);let L=v.parse(T[2],2,Gt);if(!L)return null;if(!bv(s,L.type))return v.concat(2).error(`"${s}" comparisons are not supported for type '${Yr(L.type)}'.`);if(I.type.kind!==L.type.kind&&I.type.kind!=="value"&&L.type.kind!=="value")return v.error(`Cannot compare types '${Yr(I.type)}' and '${Yr(L.type)}'.`);y&&(I.type.kind==="value"&&L.type.kind!=="value"?I=new la(L.type,[I]):I.type.kind!=="value"&&L.type.kind==="value"&&(L=new la(I.type,[L])));let O=null;if(T.length===4){if(I.type.kind!=="string"&&L.type.kind!=="string"&&I.type.kind!=="value"&&L.type.kind!=="value")return v.error("Cannot use collator to compare non-string types.");if(O=v.parse(T[3],3,Jd),!O)return null}return new Cb(I,L,O)}evaluate(T){const v=this.lhs.evaluate(T),s=this.rhs.evaluate(T);if(y&&this.hasUntypedArgument){const I=Mn(v),L=Mn(s);if(I.kind!==L.kind||!(I.kind==="string"||I.kind==="number"))throw new nn(`Expected arguments for "${l}" to be (string, string) or (number, number), but found (${I.kind}, ${L.kind}) instead.`)}if(this.collator&&!y&&this.hasUntypedArgument){const I=Mn(v),L=Mn(s);if(I.kind!=="string"||L.kind!=="string")return a(T,v,s)}return this.collator?h(T,v,s,this.collator.evaluate(T)):a(T,v,s)}eachChild(T){T(this.lhs),T(this.rhs),this.collator&&T(this.collator)}outputDefined(){return!0}}}const bI=Vc("==",uI,Ab),wI=Vc("!=",hI,gI),TI=Vc("<",pI,yI),SI=Vc(">",dI,_I),EI=Vc("<=",fI,vI),PI=Vc(">=",mI,xI);class lf{constructor(a,h,y){this.type=Jd,this.locale=y,this.caseSensitive=a,this.diacriticSensitive=h}static parse(a,h){if(a.length!==2)return h.error("Expected one argument.");const y=a[1];if(typeof y!="object"||Array.isArray(y))return h.error("Collator options argument must be an object.");const x=h.parse(y["case-sensitive"]===void 0?!1:y["case-sensitive"],1,Wt);if(!x)return null;const T=h.parse(y["diacritic-sensitive"]===void 0?!1:y["diacritic-sensitive"],1,Wt);if(!T)return null;let v=null;return y.locale&&(v=h.parse(y.locale,1,Jt),!v)?null:new lf(x,T,v)}evaluate(a){return new ey(this.caseSensitive.evaluate(a),this.diacriticSensitive.evaluate(a),this.locale?this.locale.evaluate(a):null)}eachChild(a){a(this.caseSensitive),a(this.diacriticSensitive),this.locale&&a(this.locale)}outputDefined(){return!1}}class ay{constructor(a,h,y,x,T){this.type=Jt,this.number=a,this.locale=h,this.currency=y,this.minFractionDigits=x,this.maxFractionDigits=T}static parse(a,h){if(a.length!==3)return h.error("Expected two arguments.");const y=h.parse(a[1],1,lt);if(!y)return null;const x=a[2];if(typeof x!="object"||Array.isArray(x))return h.error("NumberFormat options argument must be an object.");let T=null;if(x.locale&&(T=h.parse(x.locale,1,Jt),!T))return null;let v=null;if(x.currency&&(v=h.parse(x.currency,1,Jt),!v))return null;let s=null;if(x["min-fraction-digits"]&&(s=h.parse(x["min-fraction-digits"],1,lt),!s))return null;let I=null;return x["max-fraction-digits"]&&(I=h.parse(x["max-fraction-digits"],1,lt),!I)?null:new ay(y,T,v,s,I)}evaluate(a){return new Intl.NumberFormat(this.locale?this.locale.evaluate(a):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(a):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(a):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(a):void 0}).format(this.number.evaluate(a))}eachChild(a){a(this.number),this.locale&&a(this.locale),this.currency&&a(this.currency),this.minFractionDigits&&a(this.minFractionDigits),this.maxFractionDigits&&a(this.maxFractionDigits)}outputDefined(){return!1}}class oy{constructor(a){this.type=Qd,this.sections=a}static parse(a,h){if(a.length<2)return h.error("Expected at least one argument.");const y=a[1];if(!Array.isArray(y)&&typeof y=="object")return h.error("First argument must be an image or text section.");const x=[];let T=!1;for(let v=1;v<=a.length-1;++v){const s=a[v];if(T&&typeof s=="object"&&!Array.isArray(s)){T=!1;let I=null;if(s["font-scale"]&&(I=h.parse(s["font-scale"],1,lt),!I))return null;let L=null;if(s["text-font"]&&(L=h.parse(s["text-font"],1,Oi(Jt)),!L))return null;let O=null;if(s["text-color"]&&(O=h.parse(s["text-color"],1,Da),!O))return null;let H=null;if(s["vertical-align"]){if(typeof s["vertical-align"]=="string"&&!nI.includes(s["vertical-align"]))return h.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${s["vertical-align"]}' instead.`);if(H=h.parse(s["vertical-align"],1,Jt),!H)return null}const J=x[x.length-1];J.scale=I,J.font=L,J.textColor=O,J.verticalAlign=H}else{const I=h.parse(a[v],1,Gt);if(!I)return null;const L=I.type.kind;
811if(L!=="string"&&L!=="value"&&L!=="null"&&L!=="resolvedImage")return h.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");T=!0,x.push({content:I,scale:null,font:null,textColor:null,verticalAlign:null})}}return new oy(x)}evaluate(a){const h=y=>{const x=y.content.evaluate(a);return Mn(x)===Rh?new bg("",x,null,null,null,y.verticalAlign?y.verticalAlign.evaluate(a):null):new bg(mh(x),null,y.scale?y.scale.evaluate(a):null,y.font?y.font.evaluate(a).join(","):null,y.textColor?y.textColor.evaluate(a):null,y.verticalAlign?y.verticalAlign.evaluate(a):null)};return new uo(this.sections.map(h))}eachChild(a){for(const h of this.sections)a(h.content),h.scale&&a(h.scale),h.font&&a(h.font),h.textColor&&a(h.textColor),h.verticalAlign&&a(h.verticalAlign)}outputDefined(){return!1}}class sy{constructor(a){this.type=Rh,this.input=a}static parse(a,h){if(a.length!==2)return h.error("Expected two arguments.");const y=h.parse(a[1],1,Jt);return y?new sy(y):h.error("No image name provided.")}evaluate(a){const h=this.input.evaluate(a),y=rs.fromString(h);return y&&a.availableImages&&(y.available=a.availableImages.indexOf(h)>-1),y}eachChild(a){a(this.input)}outputDefined(){return!1}}class ly{constructor(a){this.type=lt,this.input=a}static parse(a,h){if(a.length!==2)return h.error(`Expected 1 argument, but found ${a.length-1} instead.`);const y=h.parse(a[1],1);return y?y.type.kind!=="array"&&y.type.kind!=="string"&&y.type.kind!=="value"?h.error(`Expected argument of type string or array, but found ${Yr(y.type)} instead.`):new ly(y):null}evaluate(a){const h=this.input.evaluate(a);if(typeof h=="string")return[...h].length;if(Array.isArray(h))return h.length;throw new nn(`Expected value to be of type string or array, but found ${Yr(Mn(h))} instead.`)}eachChild(a){a(this.input)}outputDefined(){return!1}}const za=8192;function MI(l,a){const h=II(l[0]),y=CI(l[1]),x=Math.pow(2,a.z);return[Math.round(h*x*za),Math.round(y*x*za)]}function cy(l,a){const h=Math.pow(2,a.z),y=(l[0]/za+a.x)/h,x=(l[1]/za+a.y)/h;return[AI(y),kI(x)]}function II(l){return(180+l)/360}function AI(l){return l*360-180}function CI(l){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+l*Math.PI/360)))/360}function kI(l){return 360/Math.PI*Math.atan(Math.exp((180-l*360)*Math.PI/180))-90}function zh(l,a){l[0]=Math.min(l[0],a[0]),l[1]=Math.min(l[1],a[1]),l[2]=Math.max(l[2],a[0]),l[3]=Math.max(l[3],a[1])}function Sh(l,a){return!(l[0]<=a[0]||l[2]>=a[2]||l[1]<=a[1]||l[3]>=a[3])}function DI(l,a,h){return a[1]>l[1]!=h[1]>l[1]&&l[0]<(h[0]-a[0])*(l[1]-a[1])/(h[1]-a[1])+a[0]}function LI(l,a,h){const y=l[0]-a[0],x=l[1]-a[1],T=l[0]-h[0],v=l[1]-h[1];return y*v-T*x===0&&y*T<=0&&x*v<=0}function cf(l,a,h,y){const x=[a[0]-l[0],a[1]-l[1]],T=[y[0]-h[0],y[1]-h[1]];return OI(T,x)===0?!1:!!(wv(l,a,h,y)&&wv(h,y,l,a))}function RI(l,a,h){for(const y of h)for(let x=0;x<y.length-1;++x)if(cf(l,a,y[x],y[x+1]))return!0;return!1}function Uc(l,a,h=!1){let y=!1;for(const x of a)for(let T=0;T<x.length-1;T++){if(LI(l,x[T],x[T+1]))return h;DI(l,x[T],x[T+1])&&(y=!y)}return y}function zI(l,a){for(const h of a)if(Uc(l,h))return!0;return!1}function kb(l,a){for(const h of l)if(!Uc(h,a))return!1;for(let h=0;h<l.length-1;++h)if(RI(l[h],l[h+1],a))return!1;return!0}function FI(l,a){for(const h of a)if(kb(l,h))return!0;return!1}function OI(l,a){return l[0]*a[1]-l[1]*a[0]}function wv(l,a,h,y){const x=l[0]-h[0],T=l[1]-h[1],v=a[0]-h[0],s=a[1]-h[1],I=y[0]-h[0],L=y[1]-h[1],O=x*L-I*T,H=v*L-I*s;return O>0&&H<0||O<0&&H>0}function uy(l,a,h){const y=[];for(let x=0;x<l.length;x++){const T=[];for(let v=0;v<l[x].length;v++){const s=MI(l[x][v],h);zh(a,s),T.push(s)}y.push(T)}return y}function Db(l,a,h){const y=[];for(let x=0;x<l.length;x++){const T=uy(l[x],a,h);y.push(T)}return y}function Lb(l,a,h,y){if(l[0]<h[0]||l[0]>h[2]){const x=y*.5;let T=l[0]-h[0]>x?-y:h[0]-l[0]>x?y:0;T===0&&(T=l[0]-h[2]>x?-y:h[2]-l[0]>x?y:0),l[0]+=T}zh(a,l)}function BI(l){l[0]=l[1]=1/0,l[2]=l[3]=-1/0}function Tv(l,a,h,y){const x=Math.pow(2,y.z)*za,T=[y.x*za,y.y*za],v=[];for(const s of l)for(const I of s){const L=[I.x+T[0],I.y+T[1]];Lb(L,a,h,x),v.push(L)}return v}function Sv(l,a,h,y){const x=Math.pow(2,y.z)*za,T=[y.x*za,y.y*za],v=[];for(const s of l){const I=[];for(const L of s){const O=[L.x+T[0],L.y+T[1]];zh(a,O),I.push(O)}v.push(I)}if(a[2]-a[0]<=x/2){BI(a);for(const s of v)for(const I of s)Lb(I,a,h,x)}return v}function NI(l,a){const h=[1/0,1/0,-1/0,-1/0],y=[1/0,1/0,-1/0,-1/0],x=l.canonicalID();if(a.type==="Polygon"){const T=uy(a.coordinates,y,x),v=Tv(l.geometry(),h,y,x);if(!Sh(h,y))return!1;for(const s of v)if(!Uc(s,T))return!1}if(a.type==="MultiPolygon"){const T=Db(a.coordinates,y,x),v=Tv(l.geometry(),h,y,x);if(!Sh(h,y))return!1;for(const s of v)if(!zI(s,T))return!1}return!0}function jI(l,a){const h=[1/0,1/0,-1/0,-1/0],y=[1/0,1/0,-1/0,-1/0],x=l.canonicalID();if(a.type==="Polygon"){const T=uy(a.coordinates,y,x),v=Sv(l.geometry(),h,y,x);if(!Sh(h,y))return!1;for(const s of v)if(!kb(s,T))return!1}if(a.type==="MultiPolygon"){const T=Db(a.coordinates,y,x),v=Sv(l.geometry(),h,y,x);if(!Sh(h,y))return!1;for(const s of v)if(!FI(s,T))return!1}return!0}class hl{constructor(a,h){this.type=Wt,this.geojson=a,this.geometries=h}static parse(a,h){if(a.length!==2)return h.error(`'within' expression requires exactly one argument, but found ${a.length-1} instead.`);if(wh(a[1])){const y=a[1];if(y.type==="FeatureCollection"){const x=[];for(const T of y.features){const{type:v,coordinates:s}=T.geometry;v==="Polygon"&&x.push(s),v==="MultiPolygon"&&x.push(...s)}if(x.length){const T={type:"MultiPolygon",coordinates:x};return new hl(y,T)}}else if(y.type==="Feature"){const x=y.geometry.type;if(x==="Polygon"||x==="MultiPolygon")return new hl(y,y.geometry)}else if(y.type==="Polygon"||y.type==="MultiPolygon")return new hl(y,y)}return h.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(a){if(a.geometry()!=null&&a.canonicalID()!=null){if(a.geometryType()==="Point")return NI(a,this.geometries);if(a.geometryType()==="LineString")return jI(a,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class Rb{constructor(a=[],h=(y,x)=>y<x?-1:y>x?1:0){if(this.data=a,this.length=this.data.length,this.compare=h,this.length>0)for(let y=(this.length>>1)-1;y>=0;y--)this._down(y)}push(a){this.data.push(a),this._up(this.length++)}pop(){if(this.length===0)return;const a=this.data[0],h=this.data.pop();return--this.length>0&&(this.data[0]=h,this._down(0)),a}peek(){return this.data[0]}_up(a){const{data:h,compare:y}=this,x=h[a];for(;a>0;){const T=a-1>>1,v=h[T];if(y(x,v)>=0)break;h[a]=v,a=T}h[a]=x}_down(a){const{data:h,compare:y}=this,x=this.length>>1,T=h[a];for(;a<x;){let v=(a<<1)+1;const s=v+1;if(s<this.length&&y(h[s],h[v])<0&&(v=s),y(h[v],T)>=0)break;h[a]=h[v],a=v}h[a]=T}}function VI(l,a){if(l.length<=1)return[l];const h=[];let y,x;for(const T of l){const v=UI(T);v!==0&&(T.area=Math.abs(v),x===void 0&&(x=v<0),x===v<0?(y&&h.push(y),y=[T]):y.push(T))}return y&&h.push(y),h}function UI(l){let a=0;for(let h=0,y=l.length,x=y-1,T,v;h<y;x=h++)T=l[h],v=l[x],a+=(v.x-T.x)*(T.y+v.y);return a}const $I=6378.137,Ev=1/298.257223563,Pv=Ev*(2-Ev),Mv=Math.PI/180;class hy{constructor(a){const h=Mv*$I*1e3,y=Math.cos(a*Mv),x=1/(1-Pv*(1-y*y)),T=Math.sqrt(x);this.kx=h*T*y,this.ky=h*T*x*(1-Pv)}distance(a,h){const y=this.wrap(a[0]-h[0])*this.kx,x=(a[1]-h[1])*this.ky;return Math.sqrt(y*y+x*x)}pointOnLine(a,h){let y=1/0,x,T,v,s;for(let I=0;I<a.length-1;I++){let L=a[I][0],O=a[I][1],H=this.wrap(a[I+1][0]-L)*this.kx,J=(a[I+1][1]-O)*this.ky,ee=0;(H!==0||J!==0)&&(ee=(this.wrap(h[0]-L)*this.kx*H+(h[1]-O)*this.ky*J)/(H*H+J*J),ee>1?(L=a[I+1][0],O=a[I+1][1]):ee>0&&(L+=H/this.kx*ee,O+=J/this.ky*ee)),H=this.wrap(h[0]-L)*this.kx,J=(h[1]-O)*this.ky;const ue=H*H+J*J;ue<y&&(y=ue,x=L,T=O,v=I,s=ee)}
vendor: 6,686 bytes, line 811
811return{point:[x,T],index:v,t:Math.max(0,Math.min(1,s))}}wrap(a){for(;a<-180;)a+=360;for(;a>180;)a-=360;return a}}const wg=100,Tg=50;function zb(l,a){return a[0]-l[0]}function jd(l){return l[1]-l[0]+1}function fo(l,a){return l[1]>=l[0]&&l[1]<a}function Sg(l,a){if(l[0]>l[1])return[null,null];const h=jd(l);if(a){if(h===2)return[l,null];const x=Math.floor(h/2);return[[l[0],l[0]+x],[l[0]+x,l[1]]]}if(h===1)return[l,null];const y=Math.floor(h/2)-1;return[[l[0],l[0]+y],[l[0]+y+1,l[1]]]}function Eg(l,a){if(!fo(a,l.length))return[1/0,1/0,-1/0,-1/0];const h=[1/0,1/0,-1/0,-1/0];for(let y=a[0];y<=a[1];++y)zh(h,l[y]);return h}function Pg(l){const a=[1/0,1/0,-1/0,-1/0];for(const h of l)for(const y of h)zh(a,y);return a}function Iv(l){return l[0]!==-1/0&&l[1]!==-1/0&&l[2]!==1/0&&l[3]!==1/0}function py(l,a,h){if(!Iv(l)||!Iv(a))return NaN;let y=0,x=0;return l[2]<a[0]&&(y=a[0]-l[2]),l[0]>a[2]&&(y=l[0]-a[2]),l[1]>a[3]&&(x=l[1]-a[3]),l[3]<a[1]&&(x=a[1]-l[3]),h.distance([0,0],[y,x])}function ol(l,a,h){const y=h.pointOnLine(a,l);return h.distance(l,y.point)}function dy(l,a,h,y,x){const T=Math.min(ol(l,[h,y],x),ol(a,[h,y],x)),v=Math.min(ol(h,[l,a],x),ol(y,[l,a],x));return Math.min(T,v)}function qI(l,a,h,y,x){if(!(fo(a,l.length)&&fo(y,h.length)))return 1/0;let T=1/0;for(let v=a[0];v<a[1];++v){const s=l[v],I=l[v+1];for(let L=y[0];L<y[1];++L){const O=h[L],H=h[L+1];if(cf(s,I,O,H))return 0;T=Math.min(T,dy(s,I,O,H,x))}}return T}function GI(l,a,h,y,x){if(!(fo(a,l.length)&&fo(y,h.length)))return NaN;let T=1/0;for(let v=a[0];v<=a[1];++v)for(let s=y[0];s<=y[1];++s)if(T=Math.min(T,x.distance(l[v],h[s])),T===0)return T;return T}function ZI(l,a,h){if(Uc(l,a,!0))return 0;let y=1/0;for(const x of a){const T=x[0],v=x[x.length-1];if(T!==v&&(y=Math.min(y,ol(l,[v,T],h)),y===0))return y;const s=h.pointOnLine(x,l);if(y=Math.min(y,h.distance(l,s.point)),y===0)return y}return y}function WI(l,a,h,y){if(!fo(a,l.length))return NaN;for(let T=a[0];T<=a[1];++T)if(Uc(l[T],h,!0))return 0;let x=1/0;for(let T=a[0];T<a[1];++T){const v=l[T],s=l[T+1];for(const I of h)for(let L=0,O=I.length,H=O-1;L<O;H=L++){const J=I[H],ee=I[L];if(cf(v,s,J,ee))return 0;x=Math.min(x,dy(v,s,J,ee,y))}}return x}function Av(l,a){for(const h of l)for(const y of h)if(Uc(y,a,!0))return!0;return!1}function HI(l,a,h,y=1/0){const x=Pg(l),T=Pg(a);if(y!==1/0&&py(x,T,h)>=y)return y;if(Sh(x,T)){if(Av(l,a))return 0}else if(Av(a,l))return 0;let v=1/0;for(const s of l)for(let I=0,L=s.length,O=L-1;I<L;O=I++){const H=s[O],J=s[I];for(const ee of a)for(let ue=0,fe=ee.length,te=fe-1;ue<fe;te=ue++){const Be=ee[te],Ae=ee[ue];if(cf(H,J,Be,Ae))return 0;v=Math.min(v,dy(H,J,Be,Ae,h))}}return v}function Cv(l,a,h,y,x,T){if(!T)return;const v=py(Eg(y,T),x,h);v<a&&l.push([v,T,[0,0]])}function yd(l,a,h,y,x,T,v){if(!T||!v)return;const s=py(Eg(y,T),Eg(x,v),h);s<a&&l.push([s,T,v])}function Vd(l,a,h,y,x=1/0){let T=Math.min(y.distance(l[0],h[0][0]),x);if(T===0)return T;const v=new Rb([[0,[0,l.length-1],[0,0]]],zb),s=Pg(h);for(;v.length>0;){const I=v.pop();if(I[0]>=T)continue;const L=I[1],O=a?Tg:wg;if(jd(L)<=O){if(!fo(L,l.length))return NaN;if(a){const H=WI(l,L,h,y);if(isNaN(H)||H===0)return H;T=Math.min(T,H)}else for(let H=L[0];H<=L[1];++H){const J=ZI(l[H],h,y);if(T=Math.min(T,J),T===0)return 0}}else{const H=Sg(L,a);Cv(v,T,y,l,s,H[0]),Cv(v,T,y,l,s,H[1])}}return T}function Ud(l,a,h,y,x,T=1/0){let v=Math.min(T,x.distance(l[0],h[0]));if(v===0)return v;const s=new Rb([[0,[0,l.length-1],[0,h.length-1]]],zb);for(;s.length>0;){const I=s.pop();if(I[0]>=v)continue;const L=I[1],O=I[2],H=a?Tg:wg,J=y?Tg:wg;if(jd(L)<=H&&jd(O)<=J){if(!fo(L,l.length)&&fo(O,h.length))return NaN;let ee;if(a&&y)ee=qI(l,L,h,O,x),v=Math.min(v,ee);else if(a&&!y){const ue=l.slice(L[0],L[1]+1);for(let fe=O[0];fe<=O[1];++fe)if(ee=ol(h[fe],ue,x),v=Math.min(v,ee),v===0)return v}else if(!a&&y){const ue=h.slice(O[0],O[1]+1);for(let fe=L[0];fe<=L[1];++fe)if(ee=ol(l[fe],ue,x),v=Math.min(v,ee),v===0)return v}else ee=GI(l,L,h,O,x),v=Math.min(v,ee)}else{const ee=Sg(L,a),ue=Sg(O,y);yd(s,v,x,l,h,ee[0],ue[0]),yd(s,v,x,l,h,ee[0],ue[1]),yd(s,v,x,l,h,ee[1],ue[0]),yd(s,v,x,l,h,ee[1],ue[1])}}return v}function XI(l,a){const h=l.geometry(),y=h.flat().map(v=>cy([v.x,v.y],l.canonical));if(h.length===0)return NaN;const x=new hy(y[0][1]);let T=1/0;for(const v of a){switch(v.type){case"Point":T=Math.min(T,Ud(y,!1,[v.coordinates],!1,x,T));break;case"LineString":T=Math.min(T,Ud(y,!1,v.coordinates,!0,x,T));break;case"Polygon":T=Math.min(T,Vd(y,!1,v.coordinates,x,T));break}if(T===0)return T}return T}function YI(l,a){const h=l.geometry(),y=h.flat().map(v=>cy([v.x,v.y],l.canonical));if(h.length===0)return NaN;const x=new hy(y[0][1]);let T=1/0;for(const v of a){switch(v.type){case"Point":T=Math.min(T,Ud(y,!0,[v.coordinates],!1,x,T));break;case"LineString":T=Math.min(T,Ud(y,!0,v.coordinates,!0,x,T));break;case"Polygon":T=Math.min(T,Vd(y,!0,v.coordinates,x,T));break}if(T===0)return T}return T}function KI(l,a){const h=l.geometry();if(h.length===0||h[0].length===0)return NaN;const y=VI(h).map(v=>v.map(s=>s.map(I=>cy([I.x,I.y],l.canonical)))),x=new hy(y[0][0][0][1]);let T=1/0;for(const v of a)for(const s of y){switch(v.type){case"Point":T=Math.min(T,Vd([v.coordinates],!1,s,x,T));break;case"LineString":T=Math.min(T,Vd(v.coordinates,!0,s,x,T));break;case"Polygon":T=Math.min(T,HI(s,v.coordinates,x,T));break}if(T===0)return T}return T}function Km(l){return l.type==="MultiPolygon"?l.coordinates.map(a=>({type:"Polygon",coordinates:a})):l.type==="MultiLineString"?l.coordinates.map(a=>({type:"LineString",coordinates:a})):l.type==="MultiPoint"?l.coordinates.map(a=>({type:"Point",coordinates:a})):[l]}class pl{constructor(a,h){this.type=lt,this.geojson=a,this.geometries=h}static parse(a,h){if(a.length!==2)return h.error(`'distance' expression requires exactly one argument, but found ${a.length-1} instead.`);if(wh(a[1])){const y=a[1];if(y.type==="FeatureCollection")return new pl(y,y.features.map(x=>Km(x.geometry)).flat());if(y.type==="Feature")return new pl(y,Km(y.geometry));if("type"in y&&"coordinates"in y)return new pl(y,Km(y))}return h.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(a){if(a.geometry()!=null&&a.canonicalID()!=null){if(a.geometryType()==="Point")return XI(a,this.geometries);if(a.geometryType()==="LineString")return YI(a,this.geometries);if(a.geometryType()==="Polygon")return KI(a,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class Fh{constructor(a){this.type=Gt,this.key=a}static parse(a,h){if(a.length!==2)return h.error(`Expected 1 argument, but found ${a.length-1} instead.`);const y=a[1];return y==null?h.error("Global state property must be defined."):typeof y!="str
811ing"?h.error(`Global state property must be string, but found ${typeof a[1]} instead.`):new Fh(y)}evaluate(a){var h;const y=(h=a.globals)===null||h===void 0?void 0:h.globalState;return!y||Object.keys(y).length===0?null:fh(y,this.key)}eachChild(){}outputDefined(){return!1}}const fy={"==":bI,"!=":wI,">":SI,"<":TI,">=":PI,"<=":EI,array:la,at:ty,boolean:la,case:iy,coalesce:Th,collator:lf,format:oy,image:sy,in:ry,"index-of":Bd,interpolate:Ra,"interpolate-hcl":Ra,"interpolate-lab":Ra,length:ly,let:af,literal:Fc,match:ny,number:la,"number-format":ay,object:la,slice:Nd,step:sf,string:la,"to-boolean":Xo,"to-color":Xo,"to-number":Xo,"to-string":Xo,var:of,within:hl,distance:pl,"global-state":Fh};class pa{constructor(a,h,y,x){this.name=a,this.type=h,this._evaluate=y,this.args=x}evaluate(a){return this._evaluate(a,this.args)}eachChild(a){this.args.forEach(a)}outputDefined(){return!1}static parse(a,h){const y=a[0],x=pa.definitions[y];if(!x)return h.error(`Unknown expression "${y}". If you wanted a literal array, use ["literal", [...]].`,0);const T=Array.isArray(x)?x[0]:x.type,v=Array.isArray(x)?[[x[1],x[2]]]:x.overloads,s=v.filter(([L])=>!Array.isArray(L)||L.length===a.length-1);let I=null;for(const[L,O]of s){I=new nf(h.registry,$d,h.path,null,h.scope);const H=[];let J=!1;for(let ee=1;ee<a.length;ee++){const ue=a[ee],fe=Array.isArray(L)?L[ee-1]:L.type,te=I.parse(ue,1+H.length,fe);if(!te){J=!0;break}H.push(te)}if(!J){if(Array.isArray(L)&&L.length!==H.length){I.error(`Expected ${L.length} arguments, but found ${H.length} instead.`);continue}for(let ee=0;ee<H.length;ee++){const ue=Array.isArray(L)?L[ee]:L.type,fe=H[ee];I.concat(ee+1).checkSubtype(ue,fe.type)}if(I.errors.length===0)return new pa(y,T,O,H)}}if(s.length===1)h.errors.push(...I.errors);else{const L=(s.length?s:v).map(([H])=>QI(H)).join(" | "),O=[];for(let H=1;H<a.length;H++){const J=h.parse(a[H],1+O.length);if(!J)return null;O.push(Yr(J.type))}h.error(`Expected arguments of type ${L}, but found (${O.join(", ")}) instead.`)}return null}static register(a,h){pa.definitions=h;for(const y in h)a[y]=pa}}function kv(l,[a,h,y,x]){a=a.evaluate(l),h=h.evaluate(l),y=y.evaluate(l);const T=x?x.evaluate(l):1,v=Pb(a,h,y,T);if(v)throw new nn(v);return new wr(a/255,h/255,y/255,T,!1)}function Dv(l,a){return l in a}function Jm(l,a){const h=a[l];return typeof h>"u"?null:h}function JI(l,a,h,y){for(;h<=y;){const x=h+y>>1;if(a[x]===l)return!0;a[x]>l?y=x-1:h=x+1}return!1}function Qs(l){return{type:l}}pa.register(fy,{error:[ZM,[Jt],(l,[a])=>{throw new nn(a.evaluate(l))}],typeof:[Jt,[Gt],(l,[a])=>Yr(Mn(a.evaluate(l)))],"to-rgba":[Oi(lt,4),[Da],(l,[a])=>{const[h,y,x,T]=a.evaluate(l).rgb;return[h*255,y*255,x*255,T]}],rgb:[Da,[lt,lt,lt],kv],rgba:[Da,[lt,lt,lt,lt],kv],has:{type:Wt,overloads:[[[Jt],(l,[a])=>Dv(a.evaluate(l),l.properties())],[[Jt,ll],(l,[a,h])=>Dv(a.evaluate(l),h.evaluate(l))]]},get:{type:Gt,overloads:[[[Jt],(l,[a])=>Jm(a.evaluate(l),l.properties())],[[Jt,ll],(l,[a,h])=>Jm(a.evaluate(l),h.evaluate(l))]]},"feature-state":[Gt,[Jt],(l,[a])=>Jm(a.evaluate(l),l.featureState||{})],properties:[ll,[],l=>l.properties()],"geometry-type":[Jt,[],l=>l.geometryType()],id:[Gt,[],l=>l.id()],zoom:[lt,[],l=>l.globals.zoom],"heatmap-density":[lt,[],l=>l.globals.heatmapDensity||0],elevation:[lt,[],l=>l.globals.elevation||0],"line-progress":[lt,[],l=>l.globals.lineProgress||0],accumulated:[Gt,[],l=>l.globals.accumulated===void 0?null:l.globals.accumulated],"+":[lt,Qs(lt),(l,a)=>{let h=0;for(const y of a)h+=y.evaluate(l);return h}],"*":[lt,Qs(lt),(l,a)=>{let h=1;for(const y of a)h*=y.evaluate(l);return h}],"-":{type:lt,overloads:[[[lt,lt],(l,[a,h])=>a.evaluate(l)-h.evaluate(l)],[[lt],(l,[a])=>-a.evaluate(l)]]},"/":[lt,[lt,lt],(l,[a,h])=>a.evaluate(l)/h.evaluate(l)],"%":[lt,[lt,lt],(l,[a,h])=>a.evaluate(l)%h.evaluate(l)],ln2:[lt,[],()=>Math.LN2],pi:[lt,[],()=>Math.PI],e:[lt,[],()=>Math.E],"^":[lt,[lt,lt],(l,[a,h])=>Math.pow(a.evaluate(l),h.evaluate(l))],sqrt:[lt,[lt],(l,[a])=>Math.sqrt(a.evaluate(l))],log10:[lt,[lt],(l,[a])=>Math.log(a.evaluate(l))/Math.LN10],ln:[lt,[lt],(l,[a])=>Math.log(a.evaluate(l))],log2:[lt,[lt],(l,[a])=>Math.log(a.evaluate(l))/Math.LN2],sin:[lt,[lt],(l,[a])=>Math.sin(a.evaluate(l))],cos:[lt,[lt],(l,[a])=>Math.cos(a.evaluate(l))],tan:[lt,[lt],(l,[a])=>Math.tan(a.evaluate(l))],asin:[lt,[lt],(l,[a])=>Math.asin(a.evaluate(l))],acos:[lt,[lt],(l,[a])=>Math.acos(a.evaluate(l))],atan:[lt,[lt],(l,[a])=>Math.atan(a.evaluate(l))],min:[lt,Qs(lt),(l,a)=>Math.min(...a.map(h=>h.evaluate(l)))],max:[lt,Qs(lt),(l,a)=>Math.max(...a.map(h=>h.evaluate(l)))],abs:[lt,[lt],(l,[a])=>Math.abs(a.evaluate(l))],round:[lt,[lt],(l,[a])=>{const h=a.evaluate(l);return h<0?-Math.round(-h):Math.round(h)}],floor:[lt,[lt],(l,[a])=>Math.floor(a.evaluate(l))],ceil:[lt,[lt],(l,[a])=>Math.ceil(a.evaluate(l))],"filter-==":[Wt,[Jt,Gt],(l,[a,h])=>l.properties()[a.value]===h.value],"filter-id-==":[Wt,[Gt],(l,[a])=>l.id()===a.value],"filter-type-==":[Wt,[Jt],(l,[a])=>l.geometryType()===a.value],"filter-<":[Wt,[Jt,Gt],(l,[a,h])=>{const y=l.properties()[a.value],x=h.value;return typeof y==typeof x&&y<x}],"filter-id-<":[Wt,[Gt],(l,[a])=>{const h=l.id(),y=a.value;return typeof h==typeof y&&h<y}],"filter->":[Wt,[Jt,Gt],(l,[a,h])=>{const y=l.properties()[a.value],x=h.value;return typeof y==typeof x&&y>x}],"filter-id->":[Wt,[Gt],(l,[a])=>{const h=l.id(),y=a.value;return typeof h==typeof y&&h>y}],"filter-<=":[Wt,[Jt,Gt],(l,[a,h])=>{const y=l.properties()[a.value],x=h.value;return typeof y==typeof x&&y<=x}],"filter-id-<=":[Wt,[Gt],(l,[a])=>{const h=l.id(),y=a.value;return typeof h==typeof y&&h<=y}],"filter->=":[Wt,[Jt,Gt],(l,[a,h])=>{const y=l.properties()[a.value],x=h.value;return typeof y==typeof x&&y>=x}],"filter-id->=":[Wt,[Gt],(l,[a])=>{const h=l.id(),y=a.value;return typeof h==typeof y&&h>=y}],"filter-has":[Wt,[Gt],(l,[a])=>a.value in l.properties()],"filter-has-id":[Wt,[],l=>l.id()!==null&&l.id()!==void 0],"filter-type-in":[Wt,[Oi(Jt)],(l,[a])=>a.value.indexOf(l.geometryType())>=0],"filter-id-in":[Wt,[Oi(Gt)],(l,[a])=>a.value.indexOf(l.id())>=0],"filter-in-small":[Wt,[Jt,Oi(Gt)],(l,[a,h])=>h.value.indexOf(l.properties()[a.value])>=0],"filter-in-large":[Wt,[Jt,Oi(Gt)],(l,[a,h])=>JI(l.properties()[a.value],h.value,0,h.value.length-1)],all:{type:Wt,overloads:[[[Wt,Wt],(l,[a,h])=>a.evaluate(l)&&h.evaluate(l)],[Qs(Wt),(l,a)=>{for(const h of a)if(!h.evaluate(l))return!1;return!0}]]},any:{type:Wt,overloads:[[[Wt,Wt],(l,[a,h])=>a.evaluate(l)||h.evaluate(l)],[Qs(Wt),(l,a)=>{for(const h of a)if(h.evaluate(l))return!0;return!1}]]},"!":[Wt,[Wt],(l,[a])=>!a.evaluate(l)],"is-supported-script":[Wt,[Jt],(l,[a])=>{const h=l.globals&&l.globals.isSupportedScript;return h?h(a.evaluate(l)):!0}],upcase:[Jt,[Jt],(l,[a])=>a.evaluate(l).toUpperCase()],downcase:[Jt,[Jt],(l,[a])=>a.evaluate(l).toLowerCase()],concat:[Jt,Qs(Gt),(l,a)=>a.map(h=>mh(h.evaluate(l))).join("")],"resolved-locale":[Jt,[Jd],(l,[a])=>a.evaluate(l).resolvedLocale()]});function QI(l){return Array.isArray(l)?`(${l.map(Yr).join(", ")})`:`(${Yr(l.type)}...)`}function $d(l){if(l instanceof of)return $d(l.boundExpression);if(l instanceof pa&&l.name==="error"||l instanceof lf||l instanceof hl||l instanceof pl||l instanceof Fh)return!1;const a=l instanceof Xo||l instanceof la;let h=!0;return l.eachChild(y=>{a?h=h&&$d(y):h=h&&y instanceof Fc}),h?uf(l)&&hf(l,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function uf(l){if(l instanceof pa&&(l.name==="get"&&l.args.length===1||l.name==="feature-state"||l.name==="has"&&l.args.length===1||l.name==="properties"||l.name==="geometry-type"||l.name==="id"||/^filter-/.test(l.name))||l instanceof hl||l instanceof pl)return!1;let a=!0;return l.eachChild(h=>{a&&!uf(h)&&(a=!1)}),a}function Eh(l){if(l instanceof pa&&l.name==="feature-state")return!1;let a=!0;return l.eachChild(h=>{a&&!Eh(h)&&(a=!1)}),a}
811function hf(l,a){if(l instanceof pa&&a.indexOf(l.name)>=0)return!1;let h=!0;return l.eachChild(y=>{h&&!hf(y,a)&&(h=!1)}),h}function Mg(l){return{result:"success",value:l}}function Ec(l){return{result:"error",value:l}}function qd(l){return l["property-type"]==="data-driven"||l["property-type"]==="cross-faded-data-driven"}function Fb(l){return!!l.expression&&l.expression.parameters.indexOf("zoom")>-1}function Ob(l){return!!l.expression&&l.expression.interpolated}function er(l){return l instanceof Number?"number":l instanceof String?"string":l instanceof Boolean?"boolean":Array.isArray(l)?"array":l===null?"null":typeof l}function my(l){return typeof l=="object"&&l!==null&&!Array.isArray(l)&&Mn(l)===ll}class eA{constructor(a,h,y){this.expression=a,this._warningHistory={},this._evaluator=new Mb,this._defaultValue=h?nA(h):null,this._enumValues=h&&h.type==="enum"?h.values:null,this._globalState=y}evaluateWithoutErrorHandling(a,h,y,x,T,v){return this._globalState&&(a=Oc(a,this._globalState)),this._evaluator.globals=a,this._evaluator.feature=h,this._evaluator.featureState=y,this._evaluator.canonical=x,this._evaluator.availableImages=T||null,this._evaluator.formattedSection=v,this.expression.evaluate(this._evaluator)}evaluate(a,h,y,x,T,v){this._globalState&&(a=Oc(a,this._globalState)),this._evaluator.globals=a,this._evaluator.feature=h||null,this._evaluator.featureState=y||null,this._evaluator.canonical=x,this._evaluator.availableImages=T||null,this._evaluator.formattedSection=v||null;try{const s=this.expression.evaluate(this._evaluator);if(s==null||typeof s=="number"&&s!==s)return this._defaultValue;if(this._enumValues&&!(s in this._enumValues))throw new nn(`Expected value to be one of ${Object.keys(this._enumValues).map(I=>JSON.stringify(I)).join(", ")}, but found ${JSON.stringify(s)} instead.`);return s}catch(s){return this._warningHistory[s.message]||(this._warningHistory[s.message]=!0,typeof console<"u"&&console.warn(s.message)),this._defaultValue}}}function Bb(l){return Array.isArray(l)&&l.length>0&&typeof l[0]=="string"&&l[0]in fy}function Nb(l,a,h){const y=new nf(fy,$d,[],a?rA(a):void 0),x=y.parse(l,void 0,void 0,void 0,a&&a.type==="string"?{typeAnnotation:"coerce"}:void 0);return x?Mg(new eA(x,a,h)):Ec(y.errors)}class Lv{constructor(a,h,y){this.kind=a,this._styleExpression=h,this.isStateDependent=a!=="constant"&&!Eh(h.expression),this.globalStateRefs=gy(h.expression),this._globalState=y}evaluateWithoutErrorHandling(a,h,y,x,T,v){return this._globalState&&(a=Oc(a,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(a,h,y,x,T,v)}evaluate(a,h,y,x,T,v){return this._globalState&&(a=Oc(a,this._globalState)),this._styleExpression.evaluate(a,h,y,x,T,v)}}class Rv{constructor(a,h,y,x,T){this.kind=a,this.zoomStops=y,this._styleExpression=h,this.isStateDependent=a!=="camera"&&!Eh(h.expression),this.globalStateRefs=gy(h.expression),this.interpolationType=x,this._globalState=T}evaluateWithoutErrorHandling(a,h,y,x,T,v){return this._globalState&&(a=Oc(a,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(a,h,y,x,T,v)}evaluate(a,h,y,x,T,v){return this._globalState&&(a=Oc(a,this._globalState)),this._styleExpression.evaluate(a,h,y,x,T,v)}interpolationFactor(a,h,y){return this.interpolationType?Ra.interpolationFactor(this.interpolationType,a,h,y):0}}function tA(l,a,h){const y=Nb(l,a,h);if(y.result==="error")return y;const x=y.value.expression,T=uf(x);if(!T&&!qd(a))return Ec([new Ca("","data expressions not supported")]);const v=hf(x,["zoom"]);if(!v&&!Fb(a))return Ec([new Ca("","zoom expressions not supported")]);const s=Ad(x);if(!s&&!v)return Ec([new Ca("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(s instanceof Ca)return Ec([s]);if(s instanceof Ra&&!Ob(a))return Ec([new Ca("",'"interpolate" expressions cannot be used with this property')]);if(!s)return Mg(T?new Lv("constant",y.value,h):new Lv("source",y.value,h));const I=s instanceof Ra?s.interpolation:void 0;return Mg(T?new Rv("camera",y.value,s.labels,I,h):new Rv("composite",y.value,s.labels,I,h))}function Ad(l){let a=null;if(l instanceof af)a=Ad(l.result);else if(l instanceof Th){for(const h of l.args)if(a=Ad(h),a)break}else(l instanceof sf||l instanceof Ra)&&l.input instanceof pa&&l.input.name==="zoom"&&(a=l);return a instanceof Ca||l.eachChild(h=>{const y=Ad(h);y instanceof Ca?a=y:!a&&y?a=new Ca("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):a&&y&&a!==y&&(a=new Ca("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),a}
811function gy(l,a=new Set){return l instanceof Fh&&a.add(l.key),l.eachChild(h=>{gy(h,a)}),a}function rA(l){const a={color:Da,string:Jt,number:lt,enum:Jt,boolean:Wt,formatted:Qd,padding:ef,numberArray:tf,colorArray:vh,projectionDefinition:Kd,resolvedImage:Rh,variableAnchorOffsetCollection:rf};return l.type==="array"?Oi(a[l.value]||Gt,l.length):a[l.type]}function nA(l){if(l.type==="color"&&my(l.default))return new wr(0,0,0,0);switch(l.type){case"color":return wr.parse(l.default)||null;case"padding":return ua.parse(l.default)||null;case"numberArray":return ha.parse(l.default)||null;case"colorArray":return Bi.parse(l.default)||null;case"variableAnchorOffsetCollection":return La.parse(l.default)||null;case"projectionDefinition":return sa.parse(l.default)||null;default:return l.default===void 0?null:l.default}}function Oc(l,a){const{zoom:h,heatmapDensity:y,elevation:x,lineProgress:T,isSupportedScript:v,accumulated:s}=l??{};return{zoom:h,heatmapDensity:y,elevation:x,lineProgress:T,isSupportedScript:v,accumulated:s,globalState:a}}function jb(l){if(l===!0||l===!1)return!0;if(!Array.isArray(l)||l.length===0)return!1;switch(l[0]){case"has":return l.length>=2&&l[1]!=="$id"&&l[1]!=="$type";case"in":return l.length>=3&&(typeof l[1]!="string"||Array.isArray(l[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return l.length!==3||Array.isArray(l[1])||Array.isArray(l[2]);case"any":case"all":for(const a of l.slice(1))if(!jb(a)&&typeof a!="boolean")return!1;return!0;default:return!0}}function Vb(l){const a=l.key,h=l.value;return h?[new et(a,h,"constants have been deprecated as of v8")]:[]}function dn(l){return l instanceof Number||l instanceof String||l instanceof Boolean?l.valueOf():l}function fl(l){if(Array.isArray(l))return l.map(fl);if(l instanceof Object&&!(l instanceof Number||l instanceof String||l instanceof Boolean)){const a={};for(const h in l)a[h]=fl(l[h]);return a}return dn(l)}function Ni(l){const a=l.key,h=l.value,y=l.valueSpec||{},x=l.objectElementValidators||{},T=l.style,v=l.styleSpec,s=l.validateSpec;let I=[];const L=er(h);if(L!=="object")return[new et(a,h,`object expected, ${L} found`)];for(const O in h){const H=O.split(".")[0],J=fh(y,H)||y["*"];let ee;if(fh(x,H))ee=x[H];else if(fh(y,H)){if(h[O]===void 0)continue;ee=s}else if(x["*"])ee=x["*"];else if(y["*"])ee=s;else{I.push(new et(a,h[O],`unknown property "${O}"`));continue}I=I.concat(ee({key:(a&&`${a}.`)+O,value:h[O],valueSpec:J,style:T,styleSpec:v,object:h,objectKey:O,validateSpec:s},h))}for(const O in y)x[O]||y[O].required&&y[O].default===void 0&&h[O]===void 0&&I.push(new et(a,h,`missing required property "${O}"`));return I}function yy(l){const a=l.value,h=l.valueSpec,y=l.validateSpec,x=l.style,T=l.styleSpec,v=l.key,s=l.arrayElementValidator||y;
vendor: 3,974 bytes, line 811
811if(er(a)!=="array")return[new et(v,a,`array expected, ${er(a)} found`)];if(h.length&&a.length!==h.length)return[new et(v,a,`array length ${h.length} expected, length ${a.length} found`)];let I={type:h.value,values:h.values};T.$version<7&&(I.function=h.function),er(h.value)==="object"&&(I=h.value);let L=[];for(let O=0;O<a.length;O++)L=L.concat(s({array:a,arrayIndex:O,value:a[O],valueSpec:I,validateSpec:l.validateSpec,style:x,styleSpec:T,key:`${v}[${O}]`}));return L}function pf(l){const a=l.key,h=l.value,y=l.valueSpec;let x=er(h);return x==="number"&&h!==h&&(x="NaN"),x!=="number"?[new et(a,h,`number expected, ${x} found`)]:"minimum"in y&&h<y.minimum?[new et(a,h,`${h} is less than the minimum value ${y.minimum}`)]:"maximum"in y&&h>y.maximum?[new et(a,h,`${h} is greater than the maximum value ${y.maximum}`)]:[]}function Ub(l){const a=l.valueSpec,h=dn(l.value.type);let y,x={},T,v;const s=h!=="categorical"&&l.value.property===void 0,I=!s,L=er(l.value.stops)==="array"&&er(l.value.stops[0])==="array"&&er(l.value.stops[0][0])==="object",O=Ni({key:l.key,value:l.value,valueSpec:l.styleSpec.function,validateSpec:l.validateSpec,style:l.style,styleSpec:l.styleSpec,objectElementValidators:{stops:H,default:ue}});return h==="identity"&&s&&O.push(new et(l.key,l.value,'missing required property "property"')),h!=="identity"&&!l.value.stops&&O.push(new et(l.key,l.value,'missing required property "stops"')),h==="exponential"&&l.valueSpec.expression&&!Ob(l.valueSpec)&&O.push(new et(l.key,l.value,"exponential functions not supported")),l.styleSpec.$version>=8&&(I&&!qd(l.valueSpec)?O.push(new et(l.key,l.value,"property functions not supported")):s&&!Fb(l.valueSpec)&&O.push(new et(l.key,l.value,"zoom functions not supported"))),(h==="categorical"||L)&&l.value.property===void 0&&O.push(new et(l.key,l.value,'"property" property is required')),O;function H(fe){if(h==="identity")return[new et(fe.key,fe.value,'identity function may not have a "stops" property')];let te=[];const Be=fe.value;return te=te.concat(yy({key:fe.key,value:Be,valueSpec:fe.valueSpec,validateSpec:fe.validateSpec,style:fe.style,styleSpec:fe.styleSpec,arrayElementValidator:J})),er(Be)==="array"&&Be.length===0&&te.push(new et(fe.key,Be,"array must have at least one stop")),te}function J(fe){let te=[];const Be=fe.value,Ae=fe.key;if(er(Be)!=="array")return[new et(Ae,Be,`array expected, ${er(Be)} found`)];if(Be.length!==2)return[new et(Ae,Be,`array length 2 expected, length ${Be.length} found`)];if(L){if(er(Be[0])!=="object")return[new et(Ae,Be,`object expected, ${er(Be[0])} found`)];if(Be[0].zoom===void 0)return[new et(Ae,Be,"object stop key must have zoom")];if(Be[0].value===void 0)return[new et(Ae,Be,"object stop key must have value")];if(v&&v>dn(Be[0].zoom))return[new et(Ae,Be[0].zoom,"stop zoom values must appear in ascending order")];dn(Be[0].zoom)!==v&&(v=dn(Be[0].zoom),T=void 0,x={}),te=te.concat(Ni({key:`${Ae}[0]`,value:Be[0],valueSpec:{zoom:{}},validateSpec:fe.validateSpec,style:fe.style,styleSpec:fe.styleSpec,objectElementValidators:{zoom:pf,value:ee}}))}else te=te.concat(ee({key:`${Ae}[0]`,value:Be[0],validateSpec:fe.validateSpec,style:fe.style,styleSpec:fe.styleSpec},Be));return Bb(fl(Be[1]))?te.concat([new et(`${Ae}[1]`,Be[1],"expressions are not allowed in function stops.")]):te.concat(fe.validateSpec({key:`${Ae}[1]`,value:Be[1],valueSpec:a,validateSpec:fe.validateSpec,style:fe.style,styleSpec:fe.styleSpec}))}function ee(fe,te){const Be=er(fe.value),Ae=dn(fe.value),De=fe.value!==null?fe.value:te;if(!y)y=Be;else if(Be!==y)return[new et(fe.key,De,`${Be} stop domain type must match previous stop domain type ${y}`)];if(Be!=="number"&&Be!=="string"&&Be!=="boolean")return[new et(fe.key,De,"stop domain value must be a number, string, or boolean")];if(Be!=="number"&&h!=="categorical"){let xe=`number expected, ${Be} found`;return qd(a)&&h===void 0&&(xe+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new et(fe.key,De,xe)]}
811return h==="categorical"&&Be==="number"&&(!isFinite(Ae)||Math.floor(Ae)!==Ae)?[new et(fe.key,De,`integer expected, found ${Ae}`)]:h!=="categorical"&&Be==="number"&&T!==void 0&&Ae<T?[new et(fe.key,De,"stop domain values must appear in ascending order")]:(T=Ae,h==="categorical"&&Ae in x?[new et(fe.key,De,"stop domain values must be unique")]:(x[Ae]=!0,[]))}function ue(fe){return fe.validateSpec({key:fe.key,value:fe.value,valueSpec:a,validateSpec:fe.validateSpec,style:fe.style,styleSpec:fe.styleSpec})}}function Bc(l){const a=(l.expressionContext==="property"?tA:Nb)(fl(l.value),l.valueSpec);if(a.result==="error")return a.value.map(y=>new et(`${l.key}${y.key}`,l.value,y.message));const h=a.value.expression||a.value._styleExpression.expression;if(l.expressionContext==="property"&&l.propertyKey==="text-font"&&!h.outputDefined())return[new et(l.key,l.value,`Invalid data expression for "${l.propertyKey}". Output values must be contained as literals within the expression.`)];if(l.expressionContext==="property"&&l.propertyType==="layout"&&!Eh(h))return[new et(l.key,l.value,'"feature-state" data expressions are not supported with layout properties.')];if(l.expressionContext==="filter"&&!Eh(h))return[new et(l.key,l.value,'"feature-state" data expressions are not supported with filters.')];if(l.expressionContext&&l.expressionContext.indexOf("cluster")===0){if(!hf(h,["zoom","feature-state"]))return[new et(l.key,l.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(l.expressionContext==="cluster-initial"&&!uf(h))return[new et(l.key,l.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function iA(l){const a=l.value,h=l.key,y=er(a);return y!=="boolean"?[new et(h,a,`boolean expected, ${y} found`)]:[]}function Ig(l){const a=l.key,h=l.value,y=er(h);return y!=="string"?[new et(a,h,`color expected, ${y} found`)]:wr.parse(String(h))?[]:[new et(a,h,`color expected, "${h}" found`)]}function Ph(l){const a=l.key,h=l.value,y=l.valueSpec,x=[];return Array.isArray(y.values)?y.values.indexOf(dn(h))===-1&&x.push(new et(a,h,`expected one of [${y.values.join(", ")}], ${JSON.stringify(h)} found`)):Object.keys(y.values).indexOf(dn(h))===-1&&x.push(new et(a,h,`expected one of [${Object.keys(y.values).join(", ")}], ${JSON.stringify(h)} found`)),x}function _y(l){return jb(fl(l.value))?Bc(Od({},l,{expressionContext:"filter",valueSpec:{value:"boolean"}})):$b(l)}function $b(l){const a=l.value,h=l.key;
811if(er(a)!=="array")return[new et(h,a,`array expected, ${er(a)} found`)];const y=l.styleSpec;let x,T=[];if(a.length<1)return[new et(h,a,"filter array must have at least 1 element")];switch(T=T.concat(Ph({key:`${h}[0]`,value:a[0],valueSpec:y.filter_operator,style:l.style,styleSpec:l.styleSpec})),dn(a[0])){case"<":case"<=":case">":case">=":a.length>=2&&dn(a[1])==="$type"&&T.push(new et(h,a,`"$type" cannot be use with operator "${a[0]}"`));case"==":case"!=":a.length!==3&&T.push(new et(h,a,`filter array for operator "${a[0]}" must have 3 elements`));case"in":case"!in":a.length>=2&&(x=er(a[1]),x!=="string"&&T.push(new et(`${h}[1]`,a[1],`string expected, ${x} found`)));for(let v=2;v<a.length;v++)x=er(a[v]),dn(a[1])==="$type"?T=T.concat(Ph({key:`${h}[${v}]`,value:a[v],valueSpec:y.geometry_type,style:l.style,styleSpec:l.styleSpec})):x!=="string"&&x!=="number"&&x!=="boolean"&&T.push(new et(`${h}[${v}]`,a[v],`string, number, or boolean expected, ${x} found`));break;case"any":case"all":case"none":for(let v=1;v<a.length;v++)T=T.concat($b({key:`${h}[${v}]`,value:a[v],style:l.style,styleSpec:l.styleSpec}));break;case"has":case"!has":x=er(a[1]),a.length!==2?T.push(new et(h,a,`filter array for "${a[0]}" operator must have 2 elements`)):x!=="string"&&T.push(new et(`${h}[1]`,a[1],`string expected, ${x} found`));break}return T}function qb(l,a){const h=l.key,y=l.validateSpec,x=l.style,T=l.styleSpec,v=l.value,s=l.objectKey,I=T[`${a}_${l.layerType}`];if(!I)return[];const L=s.match(/^(.*)-transition$/);if(a==="paint"&&L&&I[L[1]]&&I[L[1]].transition)return y({key:h,value:v,valueSpec:T.transition,style:x,styleSpec:T});const O=l.valueSpec||I[s];if(!O)return[new et(h,v,`unknown property "${s}"`)];let H;if(er(v)==="string"&&qd(O)&&!O.tokens&&(H=/^{([^}]+)}$/.exec(v)))return[new et(h,v,`"${s}" does not support interpolation syntax
812Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(H[1])} }\`.`)];const J=[];return l.layerType==="symbol"&&s==="text-font"&&my(fl(v))&&dn(v.type)==="identity"&&J.push(new et(h,v,'"text-font" does not support identity functions')),J.concat(y({key:l.key,value:v,valueSpec:O,style:x,styleSpec:T,expressionContext:"property",propertyType:a,propertyKey:s}))}function Gb(l){return qb(l,"paint")}function Zb(l){return qb(l,"layout")}function Wb(l){let a=[];const h=l.value,y=l.key,x=l.style,T=l.styleSpec;if(er(h)!=="object")return[new et(y,h,`object expected, ${er(h)} found`)];!h.type&&!h.ref&&a.push(new et(y,h,'either "type" or "ref" is required'));let v=dn(h.type);const s=dn(h.ref);if(h.id){const I=dn(h.id);for(let L=0;L<l.arrayIndex;L++){const O=x.layers[L];dn(O.id)===I&&a.push(new et(y,h.id,`duplicate layer id "${h.id}", previously used at line ${O.id.__line__}`))}}if("ref"in h){["type","source","source-layer","filter","layout"].forEach(L=>{L in h&&a.push(new et(y,h[L],`"${L}" is prohibited for ref layers`))});let I;x.layers.forEach(L=>{dn(L.id)===s&&(I=L)}),I?I.ref?a.push(new et(y,h.ref,"ref cannot reference another ref layer")):v=dn(I.type):a.push(new et(y,h.ref,`ref layer "${s}" not found`))}else if(v!=="background")if(!h.source)a.push(new et(y,h,'missing required property "source"'));else{const I=x.sources&&x.sources[h.source],L=I&&dn(I.type);I?L==="vector"&&v==="raster"?a.push(new et(y,h.source,`layer "${h.id}" requires a raster source`)):L!=="raster-dem"&&v==="hillshade"?a.push(new et(y,h.source,`layer "${h.id}" requires a raster-dem source`)):L!=="raster-dem"&&v==="color-relief"?a.push(new et(y,h.source,`layer "${h.id}" requires a raster-dem source`)):L==="raster"&&v!=="raster"?a.push(new et(y,h.source,`layer "${h.id}" requires a vector source`)):L==="vector"&&!h["source-layer"]?a.push(new et(y,h,`layer "${h.id}" must specify a "source-layer"`)):L==="raster-dem"&&v!=="hillshade"&&v!=="color-relief"?a.push(new et(y,h.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):v==="line"&&h.paint&&h.paint["line-gradient"]&&(L!=="geojson"||!I.lineMetrics)&&a.push(new et(y,h,`layer "${h.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):a.push(new et(y,h.source,`source "${h.source}" not found`))}return a=a.concat(Ni({key:y,value:h,valueSpec:T.layer,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(){return[]},type(){return l.validateSpec({key:`${y}.type`,value:h.type,valueSpec:T.layer.type,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,object:h,objectKey:"type"})},filter:_y,layout(I){return Ni({layer:h,key:I.key,value:I.value,style:I.style,styleSpec:I.styleSpec,validateSpec:I.validateSpec,objectElementValidators:{"*"(L){return Zb(Od({layerType:v},L))}}})},paint(I){return Ni({layer:h,key:I.key,value:I.value,style:I.style,styleSpec:I.styleSpec,validateSpec:I.validateSpec,objectElementValidators:{"*"(L){return Gb(Od({layerType:v},L))}}})}}})),a}function es(l){const a=l.value,h=l.key,y=er(a);return y!=="string"?[new et(h,a,`string expected, ${y} found`)]:[]}function aA(l){var a;const h=(a=l.sourceName)!==null&&a!==void 0?a:"",y=l.value,x=l.styleSpec,T=x.source_raster_dem,v=l.style;let s=[];const I=er(y);if(y===void 0)return s;if(I!=="object")return s.push(new et("source_raster_dem",y,`object expected, ${I} found`)),s;const L=dn(y.encoding)==="custom",O=["redFactor","greenFactor","blueFactor","baseShift"],H=l.value.encoding?`"${l.value.encoding}"`:"Default";
812for(const J in y)!L&&O.includes(J)?s.push(new et(J,y[J],`In "${h}": "${J}" is only valid when "encoding" is set to "custom". ${H} encoding found`)):T[J]?s=s.concat(l.validateSpec({key:J,value:y[J],valueSpec:T[J],validateSpec:l.validateSpec,style:v,styleSpec:x})):s.push(new et(J,y[J],`unknown property "${J}"`));return s}const zv={promoteId:oA};function Hb(l){const a=l.value,h=l.key,y=l.styleSpec,x=l.style,T=l.validateSpec;if(!a.type)return[new et(h,a,'"type" is required')];const v=dn(a.type);let s;switch(v){case"vector":case"raster":return s=Ni({key:h,value:a,valueSpec:y[`source_${v.replace("-","_")}`],style:l.style,styleSpec:y,objectElementValidators:zv,validateSpec:T}),s;case"raster-dem":return s=aA({sourceName:h,value:a,style:l.style,styleSpec:y,validateSpec:T}),s;case"geojson":if(s=Ni({key:h,value:a,valueSpec:y.source_geojson,style:x,styleSpec:y,validateSpec:T,objectElementValidators:zv}),a.cluster)for(const I in a.clusterProperties){const[L,O]=a.clusterProperties[I],H=typeof L=="string"?[L,["accumulated"],["get",I]]:L;s.push(...Bc({key:`${h}.${I}.map`,value:O,expressionContext:"cluster-map"})),s.push(...Bc({key:`${h}.${I}.reduce`,value:H,expressionContext:"cluster-reduce"}))}return s;case"video":return Ni({key:h,value:a,valueSpec:y.source_video,style:x,validateSpec:T,styleSpec:y});case"image":return Ni({key:h,value:a,valueSpec:y.source_image,style:x,validateSpec:T,styleSpec:y});case"canvas":return[new et(h,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Ph({key:`${h}.type`,value:a.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function oA({key:l,value:a}){if(er(a)==="string")return es({key:l,value:a});{const h=[];for(const y in a)h.push(...es({key:`${l}.${y}`,value:a[y]}));return h}}function Xb(l){const a=l.value,h=l.styleSpec,y=h.light,x=l.style;let T=[];const v=er(a);if(a===void 0)return T;if(v!=="object")return T=T.concat([new et("light",a,`object expected, ${v} found`)]),T;for(const s in a){const I=s.match(/^(.*)-transition$/);I&&y[I[1]]&&y[I[1]].transition?T=T.concat(l.validateSpec({key:s,value:a[s],valueSpec:h.transition,validateSpec:l.validateSpec,style:x,styleSpec:h})):y[s]?T=T.concat(l.validateSpec({key:s,value:a[s],valueSpec:y[s],validateSpec:l.validateSpec,style:x,styleSpec:h})):T=T.concat([new et(s,a[s],`unknown property "${s}"`)])}return T}function Yb(l){const a=l.value,h=l.styleSpec,y=h.sky,x=l.style,T=er(a);if(a===void 0)return[];if(T!=="object")return[new et("sky",a,`object expected, ${T} found`)];let v=[];for(const s in a)y[s]?v=v.concat(l.validateSpec({key:s,value:a[s],valueSpec:y[s],style:x,styleSpec:h})):v=v.concat([new et(s,a[s],`unknown property "${s}"`)]);return v}function Kb(l){const a=l.value,h=l.styleSpec,y=h.terrain,x=l.style;let T=[];const v=er(a);if(a===void 0)return T;if(v!=="object")return T=T.concat([new et("terrain",a,`object expected, ${v} found`)]),T;for(const s in a)y[s]?T=T.concat(l.validateSpec({key:s,value:a[s],valueSpec:y[s],validateSpec:l.validateSpec,style:x,styleSpec:h})):T=T.concat([new et(s,a[s],`unknown property "${s}"`)]);return T}function sA(l){return es(l).length===0?[]:Bc(l)}function lA(l){return es(l).length===0?[]:Bc(l)}function cA(l){const a=l.key,h=l.value;if(er(h)==="array"){if(h.length<1||h.length>4)return[new et(a,h,`padding requires 1 to 4 values; ${h.length} values found`)];const y={type:"number"};let x=[];for(let T=0;T<h.length;T++)x=x.concat(l.validateSpec({key:`${a}[${T}]`,value:h[T],validateSpec:l.validateSpec,valueSpec:y}));return x}else return pf({key:a,value:h,valueSpec:{}})}function uA(l){const a=l.key,h=l.value;if(er(h)==="array"){const y={type:"number"};if(h.length<1)return[new et(a,h,"array length at least 1 expected, length 0 found")];let x=[];for(let T=0;T<h.length;T++)x=x.concat(l.validateSpec({key:`${a}[${T}]`,value:h[T],validateSpec:l.validateSpec,valueSpec:y}));return x}else return pf({key:a,value:h,valueSpec:{}})}function hA(l){const a=l.key,h=l.value;if(er(h)==="array"){if(h.length<1)return[new et(a,h,"array length at least 1 expected, length 0 found")];let y=[];for(let x=0;x<h.length;x++)y=y.concat(Ig({key:`${a}[${x}]`,value:h[x]}));return y}else return Ig({key:a,value:h})}function pA(l){const a=l.key,h=l.value,y=er(h),x=l.styleSpec;if(y!=="array"||h.length<1||h.length%2!==0)return[new et(a,h,"variableAnchorOffsetCollection requires a non-empty array of even length")];let T=[];for(let v=0;v<h.length;v+=2)T=T.concat(Ph({key:`${a}[${v}]`,value:h[v],valueSpec:x.layout_symbol["text-anchor"]})),T=T.concat(yy({key:`${a}[${v+1}]`,value:h[v+1],valueSpec:{length:2,value:"number"},validateSpec:l.validateSpec,style:l.style,styleSpec:x}));return T}function Jb(l){let a=[];const h=l.value,y=l.key;if(Array.isArray(h)){const x=[],T=[];
812for(const v in h){h[v].id&&x.includes(h[v].id)&&a.push(new et(y,h,`all the sprites' ids must be unique, but ${h[v].id} is duplicated`)),x.push(h[v].id),h[v].url&&T.includes(h[v].url)&&a.push(new et(y,h,`all the sprites' URLs must be unique, but ${h[v].url} is duplicated`)),T.push(h[v].url);const s={id:{type:"string",required:!0},url:{type:"string",required:!0}};a=a.concat(Ni({key:`${y}[${v}]`,value:h[v],valueSpec:s,validateSpec:l.validateSpec}))}return a}else return es({key:y,value:h})}function dA(l){const a=l.value,h=l.styleSpec,y=h.projection,x=l.style,T=er(a);if(a===void 0)return[];if(T!=="object")return[new et("projection",a,`object expected, ${T} found`)];let v=[];for(const s in a)y[s]?v=v.concat(l.validateSpec({key:s,value:a[s],valueSpec:y[s],style:x,styleSpec:h})):v=v.concat([new et(s,a[s],`unknown property "${s}"`)]);return v}function fA(l){const a=l.key;let h=l.value;h=h instanceof String?h.valueOf():h;const y=er(h);return y==="array"&&!gA(h)&&!mA(h)?[new et(a,h,`projection expected, invalid array ${JSON.stringify(h)} found`)]:["array","string"].includes(y)?[]:[new et(a,h,`projection expected, invalid type "${y}" found`)]}function mA(l){return!!["interpolate","step","literal"].includes(l[0])}function gA(l){return Array.isArray(l)&&l.length===3&&typeof l[0]=="string"&&typeof l[1]=="string"&&typeof l[2]=="number"}function Qb(l){return!!l&&l.constructor===Object}function e1(l){return Qb(l.value)?[]:[new et(l.key,l.value,`object expected, ${er(l.value)} found`)]}function yA(l){const a=l.key,h=l.value,y=l.validateSpec,x=l.styleSpec,T=l.style;if(!Qb(h))return[new et(a,h,`object expected, ${er(h)} found`)];const v=[];for(const s in h){const I=h[s],L=er(I);if(L==="string")v.push(...es({key:`${a}.${s}`,value:I}));else if(L==="array"){const O={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(const[H,J]of I.entries())v.push(...Ni({key:`${a}.${s}[${H}]`,value:J,valueSpec:O,styleSpec:x,style:T,validateSpec:y}))}else v.push(new et(`${a}.${s}`,I,`string or array expected, ${L} found`))}return v}const Fv={"*"(){return[]},array:yy,boolean:iA,number:pf,color:Ig,constants:Vb,enum:Ph,filter:_y,function:Ub,layer:Wb,object:Ni,source:Hb,light:Xb,sky:Yb,terrain:Kb,projection:dA,projectionDefinition:fA,string:es,formatted:sA,resolvedImage:lA,padding:cA,numberArray:uA,colorArray:hA,variableAnchorOffsetCollection:pA,sprite:Jb,state:e1,fontFaces:yA};function Gd(l){const a=l.value,h=l.valueSpec,y=l.styleSpec;return l.validateSpec=Gd,h.expression&&my(dn(a))?Ub(l):h.expression&&Bb(fl(a))?Bc(l):h.type&&Fv[h.type]?Fv[h.type](l):Ni(Od({},l,{valueSpec:h.type?y[h.type]:h}))}function t1(l){const a=l.value,h=l.key,y=es(l);return y.length||(a.indexOf("{fontstack}")===-1&&y.push(new et(h,a,'"glyphs" url must include a "{fontstack}" token')),a.indexOf("{range}")===-1&&y.push(new et(h,a,'"glyphs" url must include a "{range}" token'))),y}function Vi(l,a=GM){let h=[];return h=h.concat(Gd({key:"",value:l,valueSpec:a.$root,styleSpec:a,style:l,validateSpec:Gd,objectElementValidators:{glyphs:t1,"*"(){return[]}}})),l.constants&&(h=h.concat(Vb({key:"constants",value:l.constants}))),r1(h)}Vi.source=fa(da(Hb));Vi.sprite=fa(da(Jb));Vi.glyphs=fa(da(t1));Vi.light=fa(da(Xb));Vi.sky=fa(da(Yb));Vi.terrain=fa(da(Kb));Vi.state=fa(da(e1));Vi.layer=fa(da(Wb));Vi.filter=fa(da(_y));Vi.paintProperty=fa(da(Gb));Vi.layoutProperty=fa(da(Zb));function da(l){return function(a){return l(Object.assign({},a,{validateSpec:Gd}))}}function r1(l){return[].concat(l).sort((a,h)=>a.line-h.line)}function fa(l){return function(...a){return r1(l.apply(this,a))}}function Ov(l){if(!l)return{style:dh[Ko[0].referenceStyleID].getDefaultVariant().getExpandedStyleURL(),requiresUrlMonitoring:!1,isFallback:!0};if(typeof l=="string"){const a=vA(l);return a.isValidStyle?{style:a.styleObject,requiresUrlMonitoring:!1,isFallback:!1}:a.isValidJSON?{style:dh[Ko[0].referenceStyleID].getDefaultVariant().getExpandedStyleURL(),requiresUrlMonitoring:!1,isFallback:!0}:l.startsWith("http")?{style:l,requiresUrlMonitoring:!0,isFallback:!1}:l.toLowerCase().includes(".json")?{style:_A(l),requiresUrlMonitoring:!0,isFallback:!1}:{style:cb(l),requiresUrlMonitoring:!0,isFallback:!1}}return l instanceof ub?{style:l.getExpandedStyleURL(),requiresUrlMonitoring:!1,isFallback:!1}:l instanceof hb?{style:l.getDefaultVariant().getExpandedStyleURL(),requiresUrlMonitoring:!1,isFallback:!1}:Vi(l).length===0?{style:l,requiresUrlMonitoring:!1,isFallback:!1,isJSON:!0}:{style:dh[Ko[0].referenceStyleID].getDefaultVariant().getExpandedStyleURL(),requiresUrlMonitoring:!1,isFallback:!0}}function _A(l){try{return new URL(l).href}catch{}return new URL(l,location.origin).href}function vA(l){try{const a=JSON.parse(l),h=Vi(a);return{isValidJSON:!0,isValidStyle:h.length===0,styleObject:h.length===0?a:null}}catch{return{isValidJSON:!1,isValidStyle:!1,styleObject:null}}}function ho(l,a,h){const y=window.document.createElement(l);return a!==void 0&&(y.className=a),h&&h.appendChild(y),y}function Mh(l){l.parentNode&&l.parentNode.removeChild(l)}class xA{constructor(){mt(this,"_map"),mt(this,"_container"),mt(this,"_terrainButton"),WP(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(a){return this._map=a,this._container=ho("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=ho("button","maplibregl-ctrl-terrain",this._container),ho("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.t
812ype="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){Mh(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){n1(this._map),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.hasTerrain()?(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"))}}function n1(l){l.hasTerrain()?l.disableTerrain():l.enableTerrain()}class bA extends mb{constructor(a={}){super({showCompass:a.showCompass??!0,showZoom:a.showZoom??!0,visualizePitch:a.visualizePitch??!0}),mt(this,"_rotateCompassArrow",()=>{const h=this._map.getBearing(),y=this._map.getPitch(),x=this.options.visualizePitch?`scale(${Math.min(1.5,1/Math.cos(y*(Math.PI/180))**.5)}) rotateX(${Math.min(70,y)}deg) rotateZ(${-h}deg)`:`rotate(${-h}deg)`;this._compassIcon.style.transform=x}),this._compass&&(this._compass.removeEventListener("click",this._compass.clickFunction),this._compass.addEventListener("click",h=>{this._map.getPitch()===0?this._map.easeTo({pitch:Math.min(this._map.getMaxPitch(),80)}):this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:h}):this._map.resetNorth({},{originalEvent:h})}))}_createButton(a,h){const y=super._createButton(a,h);return y.clickFunction=h,y}}const Bv=xt.Marker,Nv=xt.LngLat,wA=xt.LngLatBounds;class TA extends gb{constructor(){super(...arguments),mt(this,"lastUpdatedCenter",new Nv(0,0)),mt(this,"_updateCamera",a=>{var h;const y=new Nv(a.coords.longitude,a.coords.latitude),x=a.coords.accuracy,T={bearing:this._map.getBearing(),...this.options.fitBoundsOptions,linear:!0},v=this._map.getZoom();v>(((h=this.options.fitBoundsOptions)==null?void 0:h.maxZoom)??30)&&(T.zoom=v),this._map.fitBounds(wA.fromLngLat(y,x),T,{geolocateSource:!0});let s=!1;const I=()=>{s=!0};this._map.once("click",I),this._map.once("dblclick",I),this._map.once("dragstart",I),this._map.once("mousedown",I),this._map.once("touchstart",I),this._map.once("wheel",I),this._map.once("moveend",()=>{this._map.off("click",I),this._map.off("dblclick",I),this._map.off("dragstart",I),this._map.off("mousedown",I),this._map.off("touchstart",I),this._map.off("wheel",I),!s&&(this.lastUpdatedCenter=this._map.getCenter())})}),mt(this,"_finishSetupUI",a=>{if(this._map){if(a===!1){const h=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=h,this._geolocateButton.setAttribute("aria-label",h)}else{const h=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=h,this._geolocateButton.setAttribute("aria-label",h)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=ho("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Bv({element:this._dotElement}),this._circleElement=ho("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Bv({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("move",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("moveend",h=>{const y=h.originalEvent&&h.originalEvent.type==="resize",x=this.lastUpdatedCenter.distanceTo(this._map.getCenter());!h.geolocateSource&&this._watchState==="ACTIVE_LOCK"&&!y&&x>1&&(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new Event("trackuserlocationend")))})}}),mt(this,"_onZoom",()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()})}_updateCircleRadius(){if(this._watchState!=="BACKGROUND"&&this._watchState!=="ACTIVE_LOCK")return;const a=[this._lastKnownPosition.coords.longitude,this._lastKnownPosition.coords.latitude],h=this._map.project(a),y=this._map.unproject([h.x,h.y]),x=this._map.unproject([h.x+20,h.y]),T=y.distanceTo(x)/20,v=Math.ceil(2*this._accuracy/T);this._circleElement.style.width=`${v}px`,this._circleElement.style.height=`${v}px`}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_E
812RROR",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;case"BACKGROUND_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}}var el,Li,tl,rl,lh;class SA{constructor(a,h,y){if(vi(this,el),vi(this,Li),vi(this,tl),vi(this,rl),vi(this,lh),typeof a=="string"){const x=document.querySelector(a);if(!x)throw new Error(`No element has been found with selector "${a}" when creating an external control.`);Fi(this,Li,x)}else Fi(this,Li,a);h&&Fi(this,tl,x=>{h(wt(this,el),wt(this,Li),x)}),y&&Fi(this,rl,x=>{y(wt(this,el),wt(this,Li),x)}),Fi(this,lh,wt(this,Li).parentElement)}onAdd(a){return Fi(this,el,a),wt(this,tl)&&wt(this,Li).addEventListener("click",wt(this,tl)),wt(this,rl)&&wt(this,el).on("render",wt(this,rl)),Mh(wt(this,Li)),wt
812(this,Li)}onRemove(){wt(this,tl)&&wt(this,Li).removeEventListener("click",wt(this,tl)),wt(this,rl)&&wt(this,el).off("render",wt(this,rl)),wt(this,lh)?wt(this,lh).appendChild(wt(this,Li)):Mh(wt(this,Li))}}el=new WeakMap,Li=new WeakMap,tl=new WeakMap,rl=new WeakMap,lh=new WeakMap;class EA{constructor(){mt(this,"map"),mt(this,"container"),mt(this,"projectionButton")}onAdd(a){return this.map=a,this.container=ho("div","maplibregl-ctrl maplibregl-ctrl-group"),this.projectionButton=ho("button","maplibregl-ctrl-projection",this.container),ho("span","maplibregl-ctrl-icon",this.projectionButton).setAttribute("aria-hidden","true"),this.projectionButton.type="button",this.projectionButton.addEventListener("click",this.toggleProjection.bind(this)),a.on("projectiontransition",this.updateProjectionIcon.bind(this)),this.updateProjectionIcon(),this.container}onRemove(){Mh(this.container),this.map.off("projectiontransition",this.updateProjectionIcon),this.map=void 0}toggleProjection(){i1(this.map),this.updateProjectionIcon()}updateProjectionIcon(){this.projectionButton.classList.remove("maplibregl-ctrl-projection-globe"),this.projectionButton.classList.remove("maplibregl-ctrl-projection-mercator"),this.map.isGlobeProjection()?(this.projectionButton.classList.add("maplibregl-ctrl-projection-mercator"),this.projectionButton.title="Enable Mercator projection"):(this.projectionButton.classList.add("maplibregl-ctrl-projection-globe"),this.projectionButton.title="Enable Globe projection")}}function i1(l){l.getProjection()===void 0&&l.setProjection({type:"mercator"}),l.isGlobeProjection()?l.setProjection("mercator",{persist:!0}):l.setProjection("globe",{persist:!0})}const ch={"zoom-in":l=>l.zoomIn(),"zoom-out":l=>l.zoomOut(),"toggle-projection":i1,"toggle-terrain":n1,"reset-view":l=>{l.getPitch()===0?l.easeTo({pitch:Math.min(l.getMaxPitch(),80)}):l.resetNorthPitch()},"reset-bearing":l=>{l.rotateTo(0)},"reset-pitch":l=>{l.setPitch(0)},"reset-roll":l=>{l.setRoll(0)}};var Cd,uh;class Ag extends SA{constructor(a,h){if(h&&!(h in ch))throw new Error(`data-maptiler-control value "${h}" is invalid.`);super(a,h&&ch[h]),vi(this,Cd),vi(this,uh,new Map)}onAdd(a){return Fi(this,Cd,a),super.onAdd(a)}onRemove(){for(const[a,h]of wt(this,uh)){const y=a.deref();y&&y.removeEventListener("click",h)}wt(this,uh).clear(),super.onRemove()}configureGroupItem(a,h){if(!h)return;if(!(h in ch))throw new Error(`data-maptiler-control value "${h}" is invalid.`);const y=x=>{ch[h](wt(this,Cd),a,x)};a.addEventListener("click",y),wt(this,uh).set(new WeakRef(a),y)}}Cd=new WeakMap,uh=new WeakMap,mt(Ag,"controlCallbacks",ch);var zi,Aa,nl,il,Wi,kd,ci,a1,Hi,o1;class Qm{constructor(a,h){vi(this,ci),vi(this,zi),mt(this,"map"),vi(this,Aa),vi(this,nl),vi(this,il),vi(this,Wi,!1),vi(this,kd),a.style!==void 0&&Fi(this,Wi,!0),Fi(this,zi,{zoomAdjust:-4,position:"top-right",...h,forceNoAttributionControl:!0,attributionControl:!1,navigationControl:!1,geolocateControl:!1,maptilerLogo:!1,minimap:!1,hash:!1,pitchAdjust:!1,...a,containerStyle:{border:"1px solid #000",width:"400px",height:"300px",...a.containerStyle??{}}}),a.lockZoom!==void 0&&(wt(this,zi).minZoom=a.lockZoom,wt(this,zi).maxZoom=a.lockZoom)}setStyle(a,h){wt(this,Wi)||this.map.setStyle(a,h),Ri(this,ci,Hi).call(this)}addLayer(a,h){return wt(this,Wi)||this.map.addLayer(a,h),Ri(this,ci,Hi).call(this),this.map}moveLayer(a,h){return wt(this,Wi)||this.map.moveLayer(a,h),Ri(this,ci,Hi).call(this),this.map}removeLayer(a){return wt(this,Wi)||this.map.removeLayer(a),Ri(this,ci,Hi).call(this),this}setLayerZoomRange(a,h,y){return wt(this,Wi)||this.map.setLayerZoomRange(a,h,y),Ri(this,ci,Hi).call(this),this}setFilter(a,h,y){return wt(this,Wi)||this.map.setFilter(a,h,y),Ri(this,ci,Hi).call(this),this}setPaintProperty(a,h,y,x){return wt(this,Wi)||this.map.setPaintProperty(a,h,y,x),Ri(this,ci,Hi).call(this),this}setLayoutProperty(a,h,y,x){return wt(this,Wi)||this.map.setLayoutProperty(a,h,y,x),Ri(this,ci,Hi).call(this),this}setGlyphs(a,h){return wt(this,Wi)||this.map.setGlyphs(a,h),Ri(this,ci,Hi).call(this),this}onAdd(a){Fi(this,Aa,a),Fi(this,nl,ho("div","maplibregl-ctrl maplibregl-ctrl-group"));for(const[h,y]of Object.entries(wt(this,zi).containerStyle))wt(this,nl).style.setProperty(h,y);return wt(this,zi).container=wt(this,nl),wt(this,zi).zoom=a.getZoom()+wt(this,zi).zoomAdjust,this.map=new c1(wt(this,zi)),this.map.once("style.load",()=>{this.map.resize()}),this.map.once("load",()=>{Ri(this,ci,a1).call(this,wt(this,zi).parentRect),Fi(this,kd,Ri(this,ci,o1).call(this))}),wt(this,nl)}onRemove(){var a;(a=wt(this,kd))==null||a.call(this),Mh(wt(this,nl))}}zi=new WeakMap,Aa=new WeakMap,nl=new WeakMap,il=new WeakMap,Wi=new WeakMap,kd=new WeakMap,ci=new WeakSet,a1=function(l){l===void 0||l.linePaint===void 0&&l.fillPaint===void 0||(Fi(this,il,{type:"Feature",properties:{name:"parentRect"},geometry:{type:"Polygon",coordinates:[[[],[],[],[],[]]]}}),this.map.addSource("parentRect",{type:"geojson",data:wt(this,il)}),(l.lineLayout!==void 0||l.linePaint!==void 0)&&this.map.addLayer({id:"parentRectOutline",type:"line",source:"parentRect",layout:{...l.lineLayout},paint:{"line-color":"#FFF","line-width":1,"line-opacity":.85,...l.linePaint}}),l.fillPaint!==void 0&&this.map.addLayer({id:"parentRectFill",type:"fill",s
812ource:"parentRect",layout:{},paint:{"fill-color":"#08F","fill-opacity":.135,...l.fillPaint}}),Ri(this,ci,Hi).call(this))},Hi=function(){if(wt(this,il)===void 0)return;const{devicePixelRatio:l}=window,a=wt(this,Aa).getCanvas(),h=a.width/l,y=a.height/l,x=wt(this,Aa).unproject.bind(wt(this,Aa)),T=x([0,0]),v=x([h,0]),s=x([0,y]),I=x([h,y]);wt(this,il).geometry.coordinates=[[s.toArray(),I.toArray(),v.toArray(),T.toArray(),s.toArray()]];const L=this.map.getSource("parentRect");L!==void 0&&L.setData(wt(this,il))},o1=function(){const{pitchAdjust:l}=wt(this,zi),a=()=>{T("parent")},h=()=>{T("minimap")},y=()=>{wt(this,Aa).on("move",a),this.map.on("move",h)},x=()=>{wt(this,Aa).off("move",a),this.map.off("move",h)},T=v=>{x();const s=v==="parent"?wt(this,Aa):this.map,I=v==="parent"?this.map:wt(this,Aa),L=s.getCenter(),O=s.getZoom()+wt(this,zi).zoomAdjust*(v==="parent"?1:-1),H=s.getBearing(),J=s.getPitch();I.jumpTo({center:L,zoom:O,bearing:H,pitch:l?J:0}),Ri(this,ci,Hi).call(this),y()};return y(),()=>{x()}};class PA{constructor(a,h=2e3){mt(this,"map"),mt(this,"registeredModules",new Set),mt(this,"viewerType"),this.map=a,this.viewerType="Map",setTimeout(async()=>{if(!Pn.telemetry)return;const y=this.preparePayload();try{(await fetch(y,{method:"POST"})).ok||console.warn("The metrics could not be sent to MapTiler Cloud")}catch(x){console.warn("The metrics could not be sent to MapTiler Cloud",x)}},Math.max(1e3,h))}registerModule(a,h){this.registeredModules.add(`${a}:${h}`)}registerViewerType(a="Map"){this.viewerType=a}preparePayload(){const a=new URL(ui.telemetryURL);return a.searchParams.append("sdk",h1()),a.searchParams.append("key",Pn.apiKey),a.searchParams.append("mtsid",Kg),a.searchParams.append("session",Pn.session?"1":"0"),a.searchParams.append("caching",Pn.caching?"1":"0"),a.searchParams.append("lang-updated",this.map.isLanguageUpdated()?"1":"0"),a.searchParams.append("terrain",this.map.getTerrain()?"1":"0"),a.searchParams.append("globe",this.map.isGlobeProjection()?"1":"0"),a.searchParams.append("viewerType",this.viewerType),this.registeredModules.size>0&&a.searchParams.append("modules",Array.from(this.registeredModules).join("|")),a.href}}var Ih=typeof Float32Array<"u"?Float32Array:Array;function gh(){var l=new Ih(16);return Ih!=Float32Array&&(l[1]=0,l[2]=0,l[3]=0,l[4]=0,l[6]=0,l[7]=0,l[8]=0,l[9]=0,l[11]=0,l[12]=0,l[13]=0,l[14]=0),l[0]=1,l[5]=1,l[10]=1,l[15]=1,l}function MA(l,a,h,y,x,T,v,s,I,L,O,H,J,ee,ue,fe,te){return l[0]=a,l[1]=h,l[2]=y,l[3]=x,l[4]=T,l[5]=v,l[6]=s,l[7]=I,l[8]=L,l[9]=O,l[10]=H,l[11]=J,l[12]=ee,l[13]=ue,l[14]=fe,l[15]=te,l}function IA(l,a,h){var y=a[0],x=a[1],T=a[2],v=a[3],s=a[4],I=a[5],L=a[6],O=a[7],H=a[8],J=a[9],ee=a[10],ue=a[11],fe=a[12],te=a[13],Be=a[14],Ae=a[15],De=h[0],xe=h[1],ye=h[2],Se=h[3];return l[0]=De*y+xe*s+ye*H+Se*fe,l[1]=De*x+xe*I+ye*J+Se*te,l[2]=De*T+xe*L+ye*ee+Se*Be,l[3]=De*v+xe*O+ye*ue+Se*Ae,De=h[4],xe=h[5],ye=h[6],Se=h[7],l[4]=De*y+xe*s+ye*H+Se*fe,l[5]=De*x+xe*I+ye*J+Se*te,l[6]=De*T+xe*L+ye*ee+Se*Be,l[7]=De*v+xe*O+ye*ue+Se*Ae,De=h[8],xe=h[9],ye=h[10],Se=h[11],l[8]=De*y+xe*s+ye*H+Se*fe,l[9]=De*x+xe*I+ye*J+Se*te,l[10]=De*T+xe*L+ye*ee+Se*Be,l[11]=De*v+xe*O+ye*ue+Se*Ae,De=h[12],xe=h[13],ye=h[14],Se=h[15],l[12]=De*y+xe*s+ye*H+Se*fe,l[13]=De*x+xe*I+ye*J+Se*te,l[14]=De*T+xe*L+ye*ee+Se*Be,l[15]=De*v+xe*O+ye*ue+Se*Ae,l}function AA(l,a,h){var y=h[0],x=h[1],T=h[2];return l[0]=a[0]*y,l[1]=a[1]*y,l[2]=a[2]*y,l[3]=a[3]*y,l[4]=a[4]*x,l[5]=a[5]*x,l[6]=a[6]*x,l[7]=a[7]*x,l[8]=a[8]*T,l[9]=a[9]*T,l[10]=a[10]*T,l[11]=a[11]*T,l[12]=a[12],l[13]=a[13],l[14]=a[14],l[15]=a[15],l}function jv(l,a,h){var y=Math.sin(h),x=Math.cos(h),T=a[4],v=a[5],s=a[6],I=a[7],L=a[8],O=a[9],H=a[10],J=a[11];return a!==l&&(l[0]=a[0],l[1]=a[1],l[2]=a[2],l[3]=a[3],l[12]=a[12],l[13]=a[13],l[14]=a[14],l[15]=a[15]),l[4]=T*x+L*y,l[5]=v*x+O*y,l[6]=s*x+H*y,l[7]=I*x+J*y,l[8]=L*x-T*y,l[9]=O*x-v*y,l[10]=H*x-s*y,l[11]=J*x-I*y,l}function CA(l,a,h){var y=Math.sin(h),x=Math.cos(h),T=a[0],v=a[1],s=a[2],I=a[3],L=a[8],O=a[9],H=a[10],J=a[11];return a!==l&&(l[4]=a[4],l[5]=a[5],l[6]=a[6],l[7]=a[7],l[12]=a[12],l[13]=a[13],l[14]=a[14],l[15]=a[15]),l[0]=T*x-L*y,l[1]=v*x-O*y,l[2]=s*x-H*y,l[3]=I*x-J*y,l[8]=T*y+L*x,l[9]=v*y+O*x,l[10]=s*y+H*x,l[11]=I*y+J*x,l}function Vv(l,a,h){var y=Math.sin(h),x=Math.cos(h),T=a[0],v=a[1],s=a[2],I=a[3],L=a[4],O=a[5],H=a[6],J=a[7];return a!==l&&(l[8]=a[8],l[9]=a[9],l[10]=a[10],l[11]=a[11],l[12]=a[12],l[13]=a[13],l[14]=a[14],l[15]=a[15]),l[0]=T*x+L*y,l[1]=v*x+O*y,l[2]=s*x+H*y,l[3]=I*x+J*y,l[4]=L*x-T*y,l[5]=O*x-v*y,l[6]=H*x-s*y,l[7]=J*x-I*y,l}function kA(l,a,h,y,x){var T=1/Math.tan(a/2);if(l[0]=T/h,l[1]=0,l[2]=0,l[3]=0,l[4]=0,l[5]=T,l[6]=0,l[7]=0,l[8]=0,l[9]=0,l[11]=-1,l[12]=0,l[13]=0,l[15]=0,x!=null&&x!==1/0){var v=1/(y-x);l[10]=(x+y)*v,l[14]=2*x*y*v}
812else l[10]=-1,l[14]=-2*y;return l}var DA=kA;function Dd(){var l=new Ih(3);return Ih!=Float32Array&&(l[0]=0,l[1]=0,l[2]=0),l}function LA(l,a,h){var y=new Ih(3);return y[0]=l,y[1]=a,y[2]=h,y}function eg(l,a){var h=a[0],y=a[1],x=a[2],T=h*h+y*y+x*x;return T>0&&(T=1/Math.sqrt(T)),l[0]=a[0]*T,l[1]=a[1]*T,l[2]=a[2]*T,l}function Uv(l,a,h){var y=a[0],x=a[1],T=a[2],v=h[0],s=h[1],I=h[2];return l[0]=x*I-T*s,l[1]=T*v-y*I,l[2]=y*s-x*v,l}(function(){var l=Dd();return function(a,h,y,x,T,v){var s,I;for(h||(h=3),y||(y=0),x?I=Math.min(x*h+y,a.length):I=a.length,s=y;s<I;s+=h)l[0]=a[s],l[1]=a[s+1],l[2]=a[s+2],T(l,l,v),a[s]=l[0],a[s+1]=l[1],a[s+2]=l[2];return a}})();function RA(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var $v,qv;function zA(){return qv||(qv=1,$v={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],olive:[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]}),$v}var tg,Gv;function s1(){if(Gv)return tg;Gv=1;const l=zA(),a={};for(const x of Object.keys(l))a[l[x]]=x;const h={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};tg=h;for(const x of Object.keys(h)){if(!("channels"in h[x]))throw new Error("missing channels property: "+x);if(!("labels"in h[x]))throw new Error("missing channel labels property: "+x);if(h[x].labels.length!==h[x].channels)throw new Error("channel and label counts mismatch: "+x);const{channels:T,labels:v}=h[x];delete h[x].channels,delete h[x].labels,Object.defineProperty(h[x],"channels",{value:T}),Object.defineProperty(h[x],"labels",{value:v})}h.rgb.hsl=function(x){const T=x[0]/255,v=x[1]/255,s=x[2]/255,I=Math.min(T,v,s),L=Math.max(T,v,s),O=L-I;let H,J;L===I?H=0:T===L?H=(v-s)/O:v===L?H=2+(s-T)/O:s===L&&(H=4+(T-v)/O),H=Math.min(H*60,360),H<0&&(H+=360);const ee=(I+L)/2;return L===I?J=0:ee<=.5?J=O/(L+I):J=O/(2-L-I),[H,J*100,ee*100]},h.rgb.hsv=function(x){let T,v,s,I,L;const O=x[0]/255,H=x[1]/255,J=x[2]/255,ee=Math.max(O,H,J),ue=ee-Math.min(O,H,J),fe=function(te){return(ee-te)/6/ue+1/2};
vendor: 4,455 bytes, line 812
812return ue===0?(I=0,L=0):(L=ue/ee,T=fe(O),v=fe(H),s=fe(J),O===ee?I=s-v:H===ee?I=1/3+T-s:J===ee&&(I=2/3+v-T),I<0?I+=1:I>1&&(I-=1)),[I*360,L*100,ee*100]},h.rgb.hwb=function(x){const T=x[0],v=x[1];let s=x[2];const I=h.rgb.hsl(x)[0],L=1/255*Math.min(T,Math.min(v,s));return s=1-1/255*Math.max(T,Math.max(v,s)),[I,L*100,s*100]},h.rgb.cmyk=function(x){const T=x[0]/255,v=x[1]/255,s=x[2]/255,I=Math.min(1-T,1-v,1-s),L=(1-T-I)/(1-I)||0,O=(1-v-I)/(1-I)||0,H=(1-s-I)/(1-I)||0;return[L*100,O*100,H*100,I*100]};function y(x,T){return(x[0]-T[0])**2+(x[1]-T[1])**2+(x[2]-T[2])**2}return h.rgb.keyword=function(x){const T=a[x];if(T)return T;let v=1/0,s;for(const I of Object.keys(l)){const L=l[I],O=y(x,L);O<v&&(v=O,s=I)}return s},h.keyword.rgb=function(x){return l[x]},h.rgb.xyz=function(x){let T=x[0]/255,v=x[1]/255,s=x[2]/255;T=T>.04045?((T+.055)/1.055)**2.4:T/12.92,v=v>.04045?((v+.055)/1.055)**2.4:v/12.92,s=s>.04045?((s+.055)/1.055)**2.4:s/12.92;const I=T*.4124+v*.3576+s*.1805,L=T*.2126+v*.7152+s*.0722,O=T*.0193+v*.1192+s*.9505;return[I*100,L*100,O*100]},h.rgb.lab=function(x){const T=h.rgb.xyz(x);let v=T[0],s=T[1],I=T[2];v/=95.047,s/=100,I/=108.883,v=v>.008856?v**(1/3):7.787*v+16/116,s=s>.008856?s**(1/3):7.787*s+16/116,I=I>.008856?I**(1/3):7.787*I+16/116;const L=116*s-16,O=500*(v-s),H=200*(s-I);return[L,O,H]},h.hsl.rgb=function(x){const T=x[0]/360,v=x[1]/100,s=x[2]/100;let I,L,O;if(v===0)return O=s*255,[O,O,O];s<.5?I=s*(1+v):I=s+v-s*v;const H=2*s-I,J=[0,0,0];for(let ee=0;ee<3;ee++)L=T+1/3*-(ee-1),L<0&&L++,L>1&&L--,6*L<1?O=H+(I-H)*6*L:2*L<1?O=I:3*L<2?O=H+(I-H)*(2/3-L)*6:O=H,J[ee]=O*255;return J},h.hsl.hsv=function(x){const T=x[0];let v=x[1]/100,s=x[2]/100,I=v;const L=Math.max(s,.01);s*=2,v*=s<=1?s:2-s,I*=L<=1?L:2-L;const O=(s+v)/2,H=s===0?2*I/(L+I):2*v/(s+v);return[T,H*100,O*100]},h.hsv.rgb=function(x){const T=x[0]/60,v=x[1]/100;let s=x[2]/100;const I=Math.floor(T)%6,L=T-Math.floor(T),O=255*s*(1-v),H=255*s*(1-v*L),J=255*s*(1-v*(1-L));switch(s*=255,I){case 0:return[s,J,O];case 1:return[H,s,O];case 2:return[O,s,J];case 3:return[O,H,s];case 4:return[J,O,s];case 5:return[s,O,H]}},h.hsv.hsl=function(x){const T=x[0],v=x[1]/100,s=x[2]/100,I=Math.max(s,.01);let L,O;O=(2-v)*s;const H=(2-v)*I;return L=v*I,L/=H<=1?H:2-H,L=L||0,O/=2,[T,L*100,O*100]},h.hwb.rgb=function(x){const T=x[0]/360;let v=x[1]/100,s=x[2]/100;const I=v+s;let L;I>1&&(v/=I,s/=I);const O=Math.floor(6*T),H=1-s;L=6*T-O,(O&1)!==0&&(L=1-L);const J=v+L*(H-v);let ee,ue,fe;switch(O){default:case 6:case 0:ee=H,ue=J,fe=v;break;case 1:ee=J,ue=H,fe=v;break;case 2:ee=v,ue=H,fe=J;break;case 3:ee=v,ue=J,fe=H;break;case 4:ee=J,ue=v,fe=H;break;case 5:ee=H,ue=v,fe=J;break}return[ee*255,ue*255,fe*255]},h.cmyk.rgb=function(x){const T=x[0]/100,v=x[1]/100,s=x[2]/100,I=x[3]/100,L=1-Math.min(1,T*(1-I)+I),O=1-Math.min(1,v*(1-I)+I),H=1-Math.min(1,s*(1-I)+I);return[L*255,O*255,H*255]},h.xyz.rgb=function(x){const T=x[0]/100,v=x[1]/100,s=x[2]/100;let I,L,O;return I=T*3.2406+v*-1.5372+s*-.4986,L=T*-.9689+v*1.8758+s*.0415,O=T*.0557+v*-.204+s*1.057,I=I>.0031308?1.055*I**(1/2.4)-.055:I*12.92,L=L>.0031308?1.055*L**(1/2.4)-.055:L*12.92,O=O>.0031308?1.055*O**(1/2.4)-.055:O*12.92,I=Math.min(Math.max(0,I),1),L=Math.min(Math.max(0,L),1),O=Math.min(Math.max(0,O),1),[I*255,L*255,O*255]},h.xyz.lab=function(x){let T=x[0],v=x[1],s=x[2];T/=95.047,v/=100,s/=108.883,T=T>.008856?T**(1/3):7.787*T+16/116,v=v>.008856?v**(1/3):7.787*v+16/116,s=s>.008856?s**(1/3):7.787*s+16/116;const I=116*v-16,L=500*(T-v),O=200*(v-s);return[I,L,O]},h.lab.xyz=function(x){const T=x[0],v=x[1],s=x[2];let I,L,O;L=(T+16)/116,I=v/500+L,O=L-s/200;const H=L**3,J=I**3,ee=O**3;return L=H>.008856?H:(L-16/116)/7.787,I=J>.008856?J:(I-16/116)/7.787,O=ee>.008856?ee:(O-16/116)/7.787,I*=95.047,L*=100,O*=108.883,[I,L,O]},h.lab.lch=function(x){const T=x[0],v=x[1],s=x[2];let I;I=Math.atan2(s,v)*360/2/Math.PI,I<0&&(I+=360);const L=Math.sqrt(v*v+s*s);return[T,L,I]},h.lch.lab=function(x){const T=x[0],v=x[1],s=x[2]/360*2*Math.PI,I=v*Math.cos(s),L=v*Math.sin(s);return[T,I,L]},h.rgb.ansi16=function(x,T=null){const[v,s,I]=x;let L=T===null?h.rgb.hsv(x)[2]:T;if(L=Math.round(L/50),L===0)return 30;let O=30+(Math.round(I/255)<<2|Math.round(s/255)<<1|Math.round(v/255));return L===2&&(O+=60),O},h.hsv.ansi16=function(x){return h.rgb.ansi16(h.hsv.rgb(x),x[2])},h.rgb.ansi256=function(x){const T=x[0],v=x[1],s=x[2];return T===v&&v===s?T<8?16:T>248?231:Math.round((T-8)/247*24)+232:16+36*Math.round(T/255*5)+6*Math.round(v/255*5)+Math.round(s/255*5)}
vendor: 4,194 bytes, line 812
812,h.ansi16.rgb=function(x){let T=x%10;if(T===0||T===7)return x>50&&(T+=3.5),T=T/10.5*255,[T,T,T];const v=(~~(x>50)+1)*.5,s=(T&1)*v*255,I=(T>>1&1)*v*255,L=(T>>2&1)*v*255;return[s,I,L]},h.ansi256.rgb=function(x){if(x>=232){const L=(x-232)*10+8;return[L,L,L]}x-=16;let T;const v=Math.floor(x/36)/5*255,s=Math.floor((T=x%36)/6)/5*255,I=T%6/5*255;return[v,s,I]},h.rgb.hex=function(x){const T=(((Math.round(x[0])&255)<<16)+((Math.round(x[1])&255)<<8)+(Math.round(x[2])&255)).toString(16).toUpperCase();return"000000".substring(T.length)+T},h.hex.rgb=function(x){const T=x.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!T)return[0,0,0];let v=T[0];T[0].length===3&&(v=v.split("").map(H=>H+H).join(""));const s=parseInt(v,16),I=s>>16&255,L=s>>8&255,O=s&255;return[I,L,O]},h.rgb.hcg=function(x){const T=x[0]/255,v=x[1]/255,s=x[2]/255,I=Math.max(Math.max(T,v),s),L=Math.min(Math.min(T,v),s),O=I-L;let H,J;return O<1?H=L/(1-O):H=0,O<=0?J=0:I===T?J=(v-s)/O%6:I===v?J=2+(s-T)/O:J=4+(T-v)/O,J/=6,J%=1,[J*360,O*100,H*100]},h.hsl.hcg=function(x){const T=x[1]/100,v=x[2]/100,s=v<.5?2*T*v:2*T*(1-v);let I=0;return s<1&&(I=(v-.5*s)/(1-s)),[x[0],s*100,I*100]},h.hsv.hcg=function(x){const T=x[1]/100,v=x[2]/100,s=T*v;let I=0;return s<1&&(I=(v-s)/(1-s)),[x[0],s*100,I*100]},h.hcg.rgb=function(x){const T=x[0]/360,v=x[1]/100,s=x[2]/100;if(v===0)return[s*255,s*255,s*255];const I=[0,0,0],L=T%1*6,O=L%1,H=1-O;let J=0;switch(Math.floor(L)){case 0:I[0]=1,I[1]=O,I[2]=0;break;case 1:I[0]=H,I[1]=1,I[2]=0;break;case 2:I[0]=0,I[1]=1,I[2]=O;break;case 3:I[0]=0,I[1]=H,I[2]=1;break;case 4:I[0]=O,I[1]=0,I[2]=1;break;default:I[0]=1,I[1]=0,I[2]=H}return J=(1-v)*s,[(v*I[0]+J)*255,(v*I[1]+J)*255,(v*I[2]+J)*255]},h.hcg.hsv=function(x){const T=x[1]/100,v=x[2]/100,s=T+v*(1-T);let I=0;return s>0&&(I=T/s),[x[0],I*100,s*100]},h.hcg.hsl=function(x){const T=x[1]/100,v=x[2]/100*(1-T)+.5*T;let s=0;return v>0&&v<.5?s=T/(2*v):v>=.5&&v<1&&(s=T/(2*(1-v))),[x[0],s*100,v*100]},h.hcg.hwb=function(x){const T=x[1]/100,v=x[2]/100,s=T+v*(1-T);return[x[0],(s-T)*100,(1-s)*100]},h.hwb.hcg=function(x){const T=x[1]/100,v=1-x[2]/100,s=v-T;let I=0;return s<1&&(I=(v-s)/(1-s)),[x[0],s*100,I*100]},h.apple.rgb=function(x){return[x[0]/65535*255,x[1]/65535*255,x[2]/65535*255]},h.rgb.apple=function(x){return[x[0]/255*65535,x[1]/255*65535,x[2]/255*65535]},h.gray.rgb=function(x){return[x[0]/100*255,x[0]/100*255,x[0]/100*255]},h.gray.hsl=function(x){return[0,0,x[0]]},h.gray.hsv=h.gray.hsl,h.gray.hwb=function(x){return[0,100,x[0]]},h.gray.cmyk=function(x){return[0,0,0,x[0]]},h.gray.lab=function(x){return[x[0],0,0]},h.gray.hex=function(x){const T=Math.round(x[0]/100*255)&255,v=((T<<16)+(T<<8)+T).toString(16).toUpperCase();return"000000".substring(v.length)+v},h.rgb.gray=function(x){return[(x[0]+x[1]+x[2])/3/255*100]},tg}var rg,Zv;function FA(){if(Zv)return rg;Zv=1;const l=s1();function a(){const T={},v=Object.keys(l);for(let s=v.length,I=0;I<s;I++)T[v[I]]={distance:-1,parent:null};return T}function h(T){const v=a(),s=[T];for(v[T].distance=0;s.length;){const I=s.pop(),L=Object.keys(l[I]);for(let O=L.length,H=0;H<O;H++){const J=L[H],ee=v[J];ee.distance===-1&&(ee.distance=v[I].distance+1,ee.parent=I,s.unshift(J))}}return v}function y(T,v){return function(s){return v(T(s))}}function x(T,v){const s=[v[T].parent,T];let I=l[v[T].parent][T],L=v[T].parent;for(;v[L].parent;)s.unshift(v[L].parent),I=y(l[v[L].parent][L],I),L=v[L].parent;return I.conversion=s,I}return rg=function(T){const v=h(T),s={},I=Object.keys(v);for(let L=I.length,O=0;O<L;O++){const H=I[O];v[H].parent!==null&&(s[H]=x(H,v))}return s},rg}var ng,Wv;function OA(){if(Wv)return ng;Wv=1;const l=s1(),a=FA(),h={},y=Object.keys(l);function x(v){const s=function(...I){const L=I[0];return L==null?L:(L.length>1&&(I=L),v(I))};return"conversion"in v&&(s.conversion=v.conversion),s}function T(v){const s=function(...I){const L=I[0];if(L==null)return L;L.length>1&&(I=L);const O=v(I);if(typeof O=="object")for(let H=O.length,J=0;J<H;J++)O[J]=Math.round(O[J]);return O};return"conversion"in v&&(s.conversion=v.conversion),s}return y.forEach(v=>{h[v]={},Object.defineProperty(h[v],"channels",{value:l[v].channels}),Object.defineProperty(h[v],"labels",{value:l[v].labels});const s=a(v);
812Object.keys(s).forEach(I=>{const L=s[I];h[v][I]=T(L),h[v][I].raw=x(L)})}),ng=h,ng}var BA=OA();const NA=RA(BA);function Hv({gl:l,type:a,source:h}){const y=l.createShader(a);if(y===null)throw new Error("Cannot create shader");if(l.shaderSource(y,h),l.compileShader(y),!l.getShaderParameter(y,l.COMPILE_STATUS))throw console.error("Shader compilation error:",l.getShaderInfoLog(y)),l.deleteShader(y),new Error("Cannot compile shader");return y}function jA({gl:l,vertexShaderSource:a,fragmentShaderSource:h}){const y=Hv({gl:l,type:l.VERTEX_SHADER,source:a}),x=Hv({gl:l,type:l.FRAGMENT_SHADER,source:h}),T=l.createProgram();if(l.attachShader(T,y),l.attachShader(T,x),l.linkProgram(T),!l.getProgramParameter(T,l.LINK_STATUS))throw console.error("Error: ",l.getProgramInfoLog(T)),new Error("Cannot link shader program");return T}function VA(l,a,h){const y=l.getUniformLocation(a,h);if(y===null)throw new Error(`Cannot get uniform location for ${h}`);return y}function l1({gl:l,vertexShaderSource:a,fragmentShaderSource:h,attributesKeys:y,uniformsKeys:x,vertices:T,indices:v}){const s=jA({gl:l,vertexShaderSource:a,fragmentShaderSource:h}),I=y.reduce((ee,ue)=>(ee[ue]=l.getAttribLocation(s,`a_${ue}`),ee),{}),L=x.reduce((ee,ue)=>(ee[ue]=VA(l,s,`u_${ue}`),ee),{}),O=l.createBuffer();l.bindBuffer(l.ARRAY_BUFFER,O),l.bufferData(l.ARRAY_BUFFER,new Float32Array(T),l.STATIC_DRAW);let H,J;return v!==void 0&&(H=l.createBuffer(),J=v.length,l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,H),l.bufferData(l.ELEMENT_ARRAY_BUFFER,new Uint16Array(v),l.STATIC_DRAW)),{shaderProgram:s,programInfo:{attributesLocations:I,uniformsLocations:L},positionBuffer:O,indexBuffer:H,indexBufferLength:J}}function Ld(l){if(!l)return[1,1,1,0];if(l==="transparent")return[1,1,1,0];try{const a=UA(l),h=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i.exec(a);if(h!=null&&h.length){const x=!!h[4];return[...NA.hex.rgb(a).map(T=>T/255),x?parseInt(h[4],16)/255:1]}const y=a.match(/(\d\.\d(\d+)?|\d{3}|\d{2}|\d{1})/gi)??["0","0","0"];if(a.includes("rgb")){const x=a.includes("rgba"),T=[...y.map(v=>parseFloat(v)).map((v,s)=>s<3?v/255:v)];return x||T.push(1),T}}catch{}return console.warn([`[parseColorStringToVec4]: Color ${l} is either not a valid color or its type is not supported, defaulting to black`]),[0,0,0,1]}let ah;function UA(l){return ah=ah??document.createElement("canvas").getContext("2d"),ah?(ah.fillStyle=l,ah.fillStyle):"#000000"}const vy=1,Kr=vy/2,Jr=vy/2,Qr=vy/2,$A=[-Kr,-Jr,Qr,Kr,-Jr,Qr,Kr,Jr,Qr,-Kr,Jr,Qr],qA=[-Kr,-Jr,-Qr,-Kr,Jr,-Qr,Kr,Jr,-Qr,Kr,-Jr,-Qr],GA=[-Kr,Jr,-Qr,-Kr,Jr,Qr,Kr,Jr,Qr,Kr,Jr,-Qr],ZA=[-Kr,-Jr,-Qr,Kr,-Jr,-Qr,Kr,-Jr,Qr,-Kr,-Jr,Qr],WA=[Kr,-Jr,-Qr,Kr,Jr,-Qr,Kr,Jr,Qr,Kr,-Jr,Qr],HA=[-Kr,-Jr,-Qr,-Kr,-Jr,Qr,-Kr,Jr,Qr,-Kr,Jr,-Qr],XA=[...$A,...qA,...GA,...ZA,...WA,...HA],YA=[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23],KA=`attribute vec3 a_vertexPosition;
813varying vec3 vTextureCoord;
814
815uniform mat4 u_projectionMatrix;
816uniform mat4 u_modelViewMatrix;
817  
818void main(void) {
819  vTextureCoord = vec3(-a_vertexPosition.x, a_vertexPosition.y, a_vertexPosition.z);
820  gl_Position = u_projectionMatrix * u_modelViewMatrix * vec4(a_vertexPosition, 1.0
820);
821}
822`,Xv=`precision mediump float;
823
824varying vec3 vTextureCoord;
825
826%USE_TEXTURE_MACRO_MARKER%
827
828# ifdef USE_TEXTURE
829uniform samplerCube u_cubeSampler;
830uniform float u_fadeOpacity;
831# endif
832
833uniform vec4 u_bgColor;
834
835void main(void) {
836  #ifdef USE_TEXTURE
837  vec4 texColor = textureCube(u_cubeSampler, vTextureCoord);
838
839    gl_FragColor = mix(
840      u_bgColor,
841      texColor,
842      min(texColor.a, u_fadeOpacity)
843    );
844
845    gl_FragColor.a = max(gl_FragColor.a, u_fadeOpacity);
846
847  #else
848  gl_FragColor = u_bgColor;
849  #endif
850}
851`,Jo={stars:{color:"hsl(233,100%,92%)",preset:"stars"},space:{color:"hsl(210, 100%, 4%)",preset:"space"},milkyway:{color:"hsl(233,100%,92%)",preset:"milkyway"},"milkyway-subtle":{color:"hsl(233,100%,92%)",preset:"milkyway-subtle"},"milkyway-bright":{color:"hsl(233,100%,92%)",preset:"milkyway-bright"},"milkyway-colored":{color:"black",preset:"milkyway-colored"}};var al=(l=>(l.POSITIVE_X="pX",l.NEGATIVE_X="nX",l.POSITIVE_Y="pY",l.NEGATIVE_Y="nY",l.POSITIVE_Z="pZ",l.NEGATIVE_Z="nZ",l))(al||{});const Pc=new Map;function JA(l){const a=Pc.get(l);a&&(Pc.delete(l),l.deleteTexture(a))}const Yv=new Map;let Kv;function QA({gl:l,faces:a,onReady:h,forceRefresh:y}){if(Pc.get(l)&&!y&&Kv===JSON.stringify(a)){h(Pc.get(l),Yv.get(l));return}Kv=JSON.stringify(a);const x=Pc.get(l)??l.createTexture();if(l.bindTexture(l.TEXTURE_CUBE_MAP,x),!a){console.warn("[CubemapLayer][loadCubemapTexture]: Faces are null");return}const T=Object.keys(a).length;if(T!==6){console.warn(`[CubemapLayer][loadCubemapTexture]: Faces should contain exactly 6 images, but found ${T}`);return}const v=Object.entries(a).map(([s,I])=>new Promise((L,O)=>{const H=s;if(I===void 0){O(new Error(`[CubemapLayer][loadCubemapTexture]: Face ${s} is undefined`));return}const J=new Image;J.crossOrigin="anonymous";const ee=()=>{L({image:J,key:H})};J.src=I,J.complete&&J.naturalWidth>0?ee():J.onload=ee,J.onerror=()=>{O(new Error(`[CubemapLayer][loadCubemapTexture]: Error loading image ${I}`))}}));Promise.all(v).then(s=>{for(let L=0;L<s.length;L++){const O=l.RGBA,H=l.RGBA,J=l.UNSIGNED_BYTE,{image:ee,key:ue}=s[L]??{};if(!ee||!ue){console.warn("[CubemapLayer][loadCubemapTexture]: Image or key is null");continue}const fe=eC(l,ue);l.bindTexture(l.TEXTURE_CUBE_MAP,x),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_MAG_FILTER,l.LINEAR),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_MIN_FILTER,l.LINEAR),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texImage2D(fe,0,O,H,J,ee)}l.bindTexture(l.TEXTURE_CUBE_MAP,x),l.generateMipmap(l.TEXTURE_CUBE_MAP),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_MIN_FILTER,l.LINEAR_MIPMAP_LINEAR),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_MAG_FILTER,l.LINEAR);const I=s.map(L=>L.image);h(x,I),Yv.set(l,I),Pc.set(l,x)}).catch(s=>{console.error("[CubemapLayer][loadCubemapTexture]: Error loading cubemap texture",s)})}function eC(l,a){if(a===al.POSITIVE_X)return l.TEXTURE_CUBE_MAP_POSITIVE_X;if(a===al.NEGATIVE_X)return l.TEXTURE_CUBE_MAP_NEGATIVE_X;if(a===al.POSITIVE_Y)return l.TEXTURE_CUBE_MAP_POSITIVE_Y;if(a===al.NEGATIVE_Y)return l.TEXTURE_CUBE_MAP_NEGATIVE_Y;if(a===al.POSITIVE_Z)return l.TEXTURE_CUBE_MAP_POSITIVE_Z;if(a===al.NEGATIVE_Z)return l.TEXTURE_CUBE_MAP_NEGATIVE_Z;throw new Error(`[CubemapLayer][loadCubemapTexture]: Invalid key ${a}`)}function tC(l,a,h){return[Yo(l[0],a[0],h),Yo(l[1],a[1],h),Yo(l[2],a[2],h),Yo(l[3],a[3],h)]}function Yo(l,a,h){return l+(a-l)*h}function Zd(l){if(!l)return{};const a=Object.keys(l).sort().map(h=>[h,l[h]]);return Object.fromEntries(a)}const Tc="https://api.maptiler.com/resources/space",rC=["vertexPosition"],nC=["projectionMatrix","modelViewMatrix","cubeSampler","bgColor","fadeOpacity"],Jv="%USE_TEXTURE_MACRO_MARKER%",iC="#define USE_TEXTURE",Qv=Jo.stars;function aC(l,a){if(!Cg(l))return{color:"transparent"};if(l===!0)return a;const h={...l};if(l.faces||l.path)return delete h.preset,h;const y=l.preset;if(y!==void 0&&!(y in Jo))throw new Error(`[CubemapLayer]: Invalid preset "${y}". Available presets: ${Object.keys(Jo).join(", ")}`);return{...h,color:h.color??Jo[y].color??"hsl(233,100%,92%)"}}class _d{constructor(a){mt(this,"id","Cubemap Layer"),mt(this,"type","custom"),mt(this,"renderingMode","3d"),mt(this,"map"),mt(this,"faces"),mt(this,"useCubemapTexture",!0),mt(this,"currentFadeOpacity",0),mt(this,"cubeMapNeedsUpdate",!1),mt(this,"bgColor"),mt(this,"previousBgColor",[0,0,0,0]),mt(this,"targetBgColor",[0,0,0,0]),mt(this,"transitionDelta",0),mt(this,"gl"),mt(this,"cubemap"),mt(this,"texture"),mt(this,"currentFacesDefinitionKey",""),mt(this,"options"),mt(this,"animationActive",!0),mt(this,"imageIsAnimating",!1),mt(this,"imageFadeInDelta",0);const h=Cg(a);if(h.length>0)throw new Error(`[CubemapLayer]: Invalid cubemap specification:
852- ${h.join(`
853 - `)}`);const y=aC(a,Qv);this.options=y,this.currentFacesDefinitionKey=JSON.stringify(y.faces??y.preset??y.path),this.bgColor=[0,0,0,0],this.targetBgColor=Ld(y.color),this.faces=ex(y),this.useCubemapTexture=this.faces!==null}updateCubemap({facesNeedUpdate:a}={facesNeedUpdate:!0}){this.useCubemapTexture=this.faces!==null;const h=nC.filter(y=>y==="cubeSampler"||y==="fadeOpacity"?this.useCubemapTexture:!0);this.cubemap=l1({gl:this.gl,vertexShaderSource:KA,fragmentShaderSource:this.useCubemapTexture?Xv.replace(Jv,iC):Xv.replace(Jv,""),attributesKeys:rC,uniformsKeys:h,vertices:XA,indices:YA}),this.cubeMapNeedsUpdate=a,this.useCubemapTexture&&this.updateTexture(this.gl,this.faces),this.animateColorChange()}onAdd(a,h){this.map=a,this.gl=h,this.updateCubemap()}onRemove(a,h){this.cubemap&&(this.texture&&(JA(h),this.texture=void 0),h.deleteProgram(this.cubemap.shaderProgram),h.deleteBuffer(this.cubemap.positionBuffer))}updateTexture(a,h){if(this.cubeMapNeedsUpdate===!0&&!this.imageIsAnimating){if(this.cubeMapNeedsUpdate=!1,!this.useCubemapTexture)return;QA({gl:a,faces:h,onReady:y=>{this.texture=y,this.animateIn()}})}}prerender(a,h){this.faces&&this.updateTexture(this.gl,this.faces)}animateColorChange(){const a=()=>{this.transitionDelta<1&&(requestAnimationFrame(a),this.bgColor=tC(this.previousBgColor,this.targetBgColor,this.transitionDelta),this.transitionDelta+=.075,this.map.triggerRepaint())};requestAnimationFrame(a)}async animateIn(){if(!this.imageIsAnimating){if(!this.animationActive){this.currentFadeOpacity=1,this.imageFadeInDelta=1,this.map.triggerRepaint();return}return new Promise(a=>{this.imageIsAnimating=!0;const h=()=>
853{if(this.imageFadeInDelta=Math.min(this.imageFadeInDelta+.05,1),this.currentFadeOpacity=Yo(0,1,this.imageFadeInDelta),this.map.triggerRepaint(),this.imageFadeInDelta<1){requestAnimationFrame(h);return}this.imageIsAnimating=!1,this.imageFadeInDelta=0,a()};requestAnimationFrame(h)})}}async animateOut(){if(!(this.imageIsAnimating||!this.animationActive))return new Promise(a=>{const h=()=>{if(this.imageFadeInDelta=Math.min(this.imageFadeInDelta+.05,1),this.currentFadeOpacity=Yo(1,0,this.imageFadeInDelta),this.map.triggerRepaint(),this.imageFadeInDelta>=1){this.imageIsAnimating=!1,this.imageFadeInDelta=0,a();return}requestAnimationFrame(h)};requestAnimationFrame(h)})}setAnimationActive(a){this.animationActive=a}render(a,h){if(!this.map.isGlobeProjection())return;if(this.map===void 0)throw new Error("[CubemapLayer]: Map is undefined");if(this.cubemap===void 0)throw new Error("[CubemapLayer]: Cubemap is undefined");this.texture,a.disable(a.DEPTH_TEST),a.enable(a.BLEND),a.blendFunc(a.SRC_ALPHA,a.DST_ALPHA),a.useProgram(this.cubemap.shaderProgram),a.bindBuffer(a.ARRAY_BUFFER,this.cubemap.positionBuffer),a.vertexAttribPointer(this.cubemap.programInfo.attributesLocations.vertexPosition,3,a.FLOAT,!1,0,0),a.enableVertexAttribArray(this.cubemap.programInfo.attributesLocations.vertexPosition);const y=.1,x=1e4,T=a.canvas,v=T.clientWidth/T.clientHeight,s=this.map.transform,I=s.fov*(Math.PI/180),L=gh();DA(L,I,v,y,x),Vv(L,L,s.rollInRadians),jv(L,L,-s.pitchInRadians),Vv(L,L,s.bearingInRadians);const O=s.center.lat*Math.PI/180,H=s.center.lng*Math.PI/180;jv(L,L,O),CA(L,L,-H),a.uniformMatrix4fv(this.cubemap.programInfo.uniformsLocations.projectionMatrix,!1,L);const J=gh();if(a.uniformMatrix4fv(this.cubemap.programInfo.uniformsLocations.modelViewMatrix,!1,J),a.uniform4fv(this.cubemap.programInfo.uniformsLocations.bgColor,new Float32Array(this.bgColor)),a.uniform1f(this.cubemap.programInfo.uniformsLocations.fadeOpacity,this.currentFadeOpacity),this.useCubemapTexture&&this.texture&&(a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_CUBE_MAP,this.texture),a.uniform1i(this.cubemap.programInfo.uniformsLocations.cubeSampler,0)),this.cubemap.indexBuffer===void 0)throw new Error("Index buffer is undefined");if(this.cubemap.indexBufferLength===void 0)throw new Error("Index buffer length is undefined");a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this.cubemap.indexBuffer),a.drawElements(a.TRIANGLES,this.cubemap.indexBufferLength,a.UNSIGNED_SHORT,0)}setBgColor(a){this.targetBgColor=a,this.previousBgColor=this.bgColor,this.transitionDelta=0}getConfig(){return this.options}shouldUpdate(a){const h=this.getConfig();if(a===void 0&&h)return!0;const y=typeof a=="boolean"?a:Zd(a),x=Zd(h);return JSON.stringify(y)!==JSON.stringify(x)}async setCubemapFaces(a){if(await this.animateOut(),!a.faces&&!a.preset&&!a.path){this.faces=null,this.useCubemapTexture=!1,this.currentFacesDefinitionKey="empty",await this.animateIn();return}this.faces=ex(a),this.currentFacesDefinitionKey=JSON.stringify(a.faces??a.preset??a.path)}async setCubemap(a){const h=Cg(a);if(h.length>0)throw new Error(`[CubemapLayer]: Invalid cubemap specification:
854- ${h.join(`
855 - `)}`);const y=typeof a=="boolean"?Qv:a;this.options=y;const x=JSON.stringify(y.faces??y.preset??y.path),T=this.currentFacesDefinitionKey!==x;T&&(await this.setCubemapFaces(y),this.cubeMapNeedsUpdate=!0);const v=Ld(y.color);if(y.color&&this.targetBgColor.toString()!==v.toString())this.setBgColor(v);else if(!y.color&&y.preset&&y.preset in Jo){const s=Jo[y.preset];this.setBgColor(Ld(s.color))}this.updateCubemap({facesNeedUpdate:T})}show(){this.map.setLayoutProperty(this.id,"visibility","visible")}hide(){this.map.setLayoutProperty(this.id,"visibility","none")}}function Cg(l){const a=[];if(typeof l>"u")return a.push("Space specification is undefined."),a;if(typeof l=="boolean")return[];if(Object.keys(l).length===0)return a.push("Space specification is an empty object."),a;const h=["color","preset","path","faces"],y=Object.keys(l).filter(T=>!h.includes(T));if(y.length>0)return a.push(`Space specification contains unsupported properties: ${y.map(T=>`\`${T}\``).join(", ")}. Supported properties: \`color\`, \`preset\`, \`path\`, \`faces\`.`),a;if(!l.path&&!l.preset&&!l.faces&&!l.color)return a.push("Space specification contains 
855neither a path, preset, faces, nor color."),a;l.preset&&!(l.preset in Jo)&&a.push(`Space preset "${l.preset}" is not a valid preset. Available presets: ${Object.keys(Jo).join(", ")}`);const x=Object.keys(l).filter(T=>T!=="color").filter(T=>T==="preset"||T==="path"||T==="faces");return x.length>1&&a.push(`Space specification contains multiple properties for cubemap definition: ${x.join(", ")}. Only one of \`path\`, \`preset\`, or \`faces\` should be defined.`),l.faces&&(!l.faces.pX||!l.faces.nX||!l.faces.pY||!l.faces.nY||!l.faces.pZ||!l.faces.nZ)&&a.push("Space specification contains faces but one or more of the faces are undefined."),l.faces&&Object.values(l.faces).every(T=>typeof T!="string")&&a.push("Space specification contains faces but one or more of the faces are not strings."),a}function ex(l){if(l.faces)return l.faces;if(l.preset)return{pX:`${Tc}/${l.preset}/px.webp`,nX:`${Tc}/${l.preset}/nx.webp`,pY:`${Tc}/${l.preset}/py.webp`,nY:`${Tc}/${l.preset}/ny.webp`,pZ:`${Tc}/${l.preset}/pz.webp`,nZ:`${Tc}/${l.preset}/nz.webp`};if(l.path){const a=l.path.baseUrl,h=l.path.format??"png";return{pX:`${a}/px.${h}`,nX:`${a}/nx.${h}`,pY:`${a}/py.${h}`,nY:`${a}/ny.${h}`,pZ:`${a}/pz.${h}`,nZ:`${a}/nz.${h}`}}return null}const oC=`attribute vec3 a_position;
856
857uniform mat4 u_matrix;
858uniform mat4 u_rotationMatrix;
859
860uniform float u_scale;
861
862varying vec2 v_pos;
863varying float v_scale;
864
865void main() {
866  v_scale = u_scale;
867  v_pos = a_position.xy * u_scale;
868  gl_Position = u_matrix * u_rotationMatrix * vec4(a_position, 1.0);
869}
870`,sC=`precision mediump float;
871varying vec2 v_pos;
872      
873uniform int u_stopsNumber;
874uniform float u_stops[100];
875uniform vec4 u_colors[100];
876uniform float u_maxDistance;
877
878varying float v_scale;
879
880const float EPSILON = 0.000001;
881
882vec2 center = vec2(0.0, 0.0);
883void main() {
884  float rawDistance = distance(center, v_pos);
885  float distanceFromGlobeEdge = rawDistance - 1.0;
886
887    vec4 color = u_colors[0];
888
889  // if we're further than the max distance, we should not render anything.
890  // This is to always render a circle, otherwise we end up rendering
891  // to the corners of the plane.
892  if (distance(center, v_pos) > u_maxDistance * v_scale) {
893    discard;
894  }
895
896  for (int i = 1; i < 100; i++) {
897    // if we're past the last stop
898    // we should fill to the end with the last stop color
899    if (i >= u_stopsNumber) {
900      color = u_colors[i - 1];
901      break;
902    }
903
904    float scaledStopPosition = u_stops[i] * pow(v_scale, 1.6);
905    float lastStopValue = u_stops[i - 1];
906    float thisStopValue = u_stops[i];
907
908    // this is to avoid blending errors when the stops are the same
909    // eg when you would want a sharp edge between two stops.
910    // \`numbersAreEqual\` will be 1.0 if the numbers are equal, 0.0 if they are not.
911    // We then subtract EPSILON from the last stop making the stop value _almost_ equal
912    // to the next stop but not enough to cause blending issues.
913    // It's more efficient to do this than an if / else statement.
914    float numbersAreEqual = 1.0 - step(EPSILON, abs(lastStopValue - thisStopValue));
915    lastStopValue = lastStopValue - numbersAreEqual * EPSILON;
916
917    float lastScaledStopPosition = lastStopValue * pow(v_scale, 1.6);
918
919    if (distanceFromGlobeEdge <= scaledStopPosition) {
920      float stopBlendFactor = (distanceFromGlobeEdge - lastScaledStopPosition) / (scaledStopPosition - lastScaledStopPosition);
921      color = mix(u_colors[i - 1], u_colors[i], stopBlendFactor);
922      break;
923    }
924  }
925  
926  // gl_FragColor = color;
927  gl_FragColor = vec4(color.rgb * color.a, color.a);
928}
929`,lo=2,lC=["position"],cC=["matrix","rotationMatrix","stopsNumber","stops","colors","maxDistance","scale"],uC=[-lo,-lo,0,lo,-lo,0,-lo,lo,0,lo,lo,0],vd=[[0,"rgba(176, 208, 240, 1)"],[.1,"rgba(98, 168, 229, 0.3)"],[.2,"rgba(98, 168, 229, 0.0)"]],xd=.9,tx=.06;class bd{constructor(a){if(mt(this,"id","Halo Layer"),mt(this,"type","custom"),mt(this,"renderingMode","3d"),mt(this,"gradient"),mt(this,"scale",0),mt(this,"animationDelta",0),mt(this,"map"),mt(this,"plane"),mt(this,"animationActive",!0),typeof a=="boolean"){this.gradient={scale:xd,stops:vd};return}const h=rx(a);if(h.length>0)throw new Error(`[RadialGradientLayer]: Invalid Halo specification:
930 - ${h.join(`
931 - `)}
932    `);this.gradient={scale:a.scale??xd,stops:a.stops??vd}}onAdd(a,h){this.map=a,this.plane=l1({gl:h,vertexShaderSource:oC,fragmentShaderSource:sC,attributesKeys:lC,uniformsKeys:cC,vertices:uC}),this.animateIn()}getConfig(){return this.gradient}shouldUpdate(a){const h=this.getConfig();if(a===void 0&&h)return!0;const y=typeof a=="boolean"?a:Zd(a),x=Zd(h);return JSON.stringify(y)!==JSON.stringify(x)}async animateIn(){if(!this.animationActive){this.scale=this.gradient.scale,this.animationDelta=1,this.map.triggerRepaint();return}return new Promise(a=>{this.animationDelta=0;const h=()=>
932{if(this.animationDelta<=1){this.scale=Yo(0,this.gradient.scale,this.animationDelta),this.animationDelta+=tx,this.map.triggerRepaint(),requestAnimationFrame(h);return}a()};requestAnimationFrame(h)})}async animateOut(){if(this.animationActive)return this.animationDelta=0,new Promise(a=>{const h=()=>{if(this.animationDelta<1){this.scale=Yo(this.gradient.scale,0,this.animationDelta),this.animationDelta+=tx,this.map.triggerRepaint(),requestAnimationFrame(h);return}a()};h()})}onRemove(a,h){this.plane!==void 0&&(h.deleteProgram(this.plane.shaderProgram),h.deleteBuffer(this.plane.positionBuffer))}prerender(a,h){}render(a,h){if(this.map===void 0)throw new Error("[RadialGradientLayer]: Map is undefined");if(!this.map.isGlobeProjection())return;if(this.plane===void 0)throw new Error("[RadialGradientLayer]: Plane is undefined");a.disable(a.DEPTH_TEST),a.enable(a.BLEND),a.useProgram(this.plane.shaderProgram),a.bindBuffer(a.ARRAY_BUFFER,this.plane.positionBuffer);const y=this.plane.programInfo.attributesLocations.position;a.enableVertexAttribArray(y),a.vertexAttribPointer(y,3,a.FLOAT,!1,0,0);const x=gh(),T=this.scale;AA(x,x,[T,T,T]);const v=gh();IA(v,h.defaultProjectionData.mainMatrix,x);const s=this.plane.programInfo.uniformsLocations.matrix;a.uniformMatrix4fv(s,!1,v);const I=gh(),L=this.map.transform.cameraPosition,O=eg(Dd(),L),H=LA(0,1,0),J=Dd();Uv(J,H,O),eg(J,J);const ee=Dd();Uv(ee,O,J),eg(ee,ee),MA(I,J[0],J[1],J[2],0,ee[0],ee[1],ee[2],0,O[0],O[1],O[2],0,0,0,0,1);const ue=this.plane.programInfo.uniformsLocations.rotationMatrix;a.uniformMatrix4fv(ue,!1,I);const fe=this.gradient.stops.length,te=[],Be=[];for(let Ae=0;Ae<=fe;Ae++)if(Ae<fe){te[Ae]=this.gradient.stops[Ae][0];const De=Ld(this.gradient.stops[Ae][1]);Be.push(...De)}a.uniform1i(this.plane.programInfo.uniformsLocations.stopsNumber,fe),a.uniform1fv(this.plane.programInfo.uniformsLocations.stops,new Float32Array(te)),a.uniform4fv(this.plane.programInfo.uniformsLocations.colors,new Float32Array(Be)),a.uniform1f(this.plane.programInfo.uniformsLocations.maxDistance,lo),a.uniform1f(this.plane.programInfo.uniformsLocations.scale,T),a.drawArrays(a.TRIANGLE_STRIP,0,4)}async setGradient(a){if(a===!1){await this.animateOut();return}await this.animateOut();const h=rx(a);if(h.length>0)throw new Error(`[RadialGradientLayer]: Invalid Halo specification:
933 - ${h.join(`
934 - `)}
935    `);a===!0?(this.gradient.scale=xd,this.gradient.stops=vd):(this.gradient.scale=a.scale??xd,this.gradient.stops=a.stops??vd),await this.animateIn()}setAnimationActive(a){this.animationActive=a}show(){this.map.setLayoutProperty(this.id,"visibility","visible")}hide(){this.map.setLayoutProperty(this.id,"visibility","none")}}const hC=["scale","stops"];function rx(l){var a;const h=[];if(typeof l=="boolean")return[];try{const y=Object.keys(l).filter(x=>!hC.includes(x));y.length>0&&h.push(`Properties ${y.map(x=>`\`${x}\``).join(", ")} are not supported.`)}catch{h.push("Halo specification is not an object.")}return typeof l.scale!="number"&&h.push("Halo `scale` property is not a number."),!l.stops||l.stops.length===0||!Array.isArray(l.stops)?(h.push("Halo `stops` property is not an array."),h):((a=l.stops)!=null&&a.some(y=>typeof y[0]!="number"||typeof y[1]!="string")&&h.push("Halo `stops` property is not an array of [number, string]"),h)}function pC(){const l="color: #3A1888; background: white; padding: 5px 0; font-weight: bold;",a="color: #FBC935; background: white; padding: 5px; font-weight: bold;",h="color: #F1175D; background: white; padding: 5px 0; font-weight: bold;";console.info(`%c❖%c❖%c❖ %cMapTiler SDK JS v${h1()} %c❖%c❖%c❖`,a+"padding-right: 0;",l,h,"color: #333; background: white; padding: 5px 0; font-weight: bold;",h,l,a+"padding-left: 0;")}const dC={POINT:"POINT",COUNTRY:"COUNTRY"};let c1=class u1 extends xt.Map{constructor(a){a.logSDKVersion!==!1&&pC(),XP(a.container),a.apiKey&&(Pn.apiKey=a.apiKey);const{style:h,requiresUrlMonitoring:y,isFallback:x}=Ov(a.style);x&&console.warn("Invalid style. A style must be a valid URL to a style.json, a JSON string representing a valid StyleSpecification or a valid StyleSpecification object. Fallback to default MapTiler style."),Pn.apiKey||console.warn("MapTiler Cloud API key is not set. Visit https://maptiler.com and try Cloud for free!");const T=location.hash;let v={compact:!1};a.customAttribution?v.customAttribution=a.customAttribution:a.attributionControl&&typeof a.attributionControl
935=="object"&&(v={...v,...a.attributionControl});const s={...a,style:h,maplibreLogo:!1,transformRequest:mv(a.transformRequest),attributionControl:a.forceNoAttributionControl===!0?!1:v};delete s.style,super(s),mt(this,"telemetry"),mt(this,"space"),mt(this,"halo"),mt(this,"options"),mt(this,"isTerrainEnabled",!1),mt(this,"terrainExaggeration",1),mt(this,"primaryLanguage"),mt(this,"terrainGrowing",!1),mt(this,"terrainFlattening",!1),mt(this,"minimap"),mt(this,"forceLanguageUpdate"),mt(this,"languageAlwaysBeenStyle"),mt(this,"isReady",!1),mt(this,"terrainAnimationDuration",1e3),mt(this,"monitoredStyleUrls"),mt(this,"styleInProcess",!1),mt(this,"curentProjection"),mt(this,"originalLabelStyle",new window.Map),mt(this,"isStyleLocalized",!1),mt(this,"languageIsUpdated",!1),mt(this,"spaceboxLoadingState",{styleLoadCallbackSet:!1,styleLoadedCallbackFired:!1}),this.options=a,this.setStyle(h),y&&this.monitorStyleUrl(h);const I=()=>{let ee="The distant style could not be loaded.";this.getStyle()?ee+=" Leaving the style as is.":(this.setStyle(dh.STREETS),ee+=`Loading default MapTiler Cloud style "${dh.STREETS.getDefaultVariant().getId()}" as a fallback.`),console.warn(ee)};if(this.on("style.load",()=>
935{this.styleInProcess=!1,(typeof a.rtlTextPlugin=="string"||typeof a.rtlTextPlugin>"u")&&ZP(a.rtlTextPlugin)}),this.on("error",ee=>{if(ee.error instanceof xt.AJAXError){const ue=ee.error.url,fe=new URL(ue);fe.search="";const te=fe.href;this.monitoredStyleUrls&&this.monitoredStyleUrls.has(te)&&(this.monitoredStyleUrls.delete(te),I());return}if(this.styleInProcess){I();return}}),Pn.caching&&!xg&&console.warn("The cache API is only available in secure contexts. More info at https://developer.mozilla.org/en-US/docs/Web/API/Cache"),Pn.caching&&xg&&GP(),typeof a.language>"u")this.primaryLanguage=Pn.primaryLanguage;else{const ee=ov(a.language,lr);this.primaryLanguage=ee??Pn.primaryLanguage}this.forceLanguageUpdate=!(this.primaryLanguage===lr.STYLE||this.primaryLanguage===lr.STYLE_LOCK),this.languageAlwaysBeenStyle=this.primaryLanguage===lr.STYLE,this.terrainExaggeration=a.terrainExaggeration??this.terrainExaggeration,this.curentProjection=a.projection,this.on("style.load",ee=>{this.curentProjection==="mercator"?this.setProjection({type:"mercator"}):this.curentProjection==="globe"&&this.setProjection({type:"globe"})}),this.once("styledata",async()=>{if(!a.geolocate||a.center||a.hash&&T)return;try{if(a.geolocate===dC.COUNTRY){await this.fitToIpBounds();return}}catch(ue){console.warn(ue.message)}let ee;try{await this.centerOnIpPoint(a.zoom),ee=this.getCameraHash()}catch(ue){console.warn(ue.message)}(await navigator.permissions.query({name:"geolocation"})).state==="granted"&&navigator.geolocation.getCurrentPosition(ue=>{ee===this.getCameraHash()&&(this.terrain?this.easeTo({center:[ue.coords.longitude,ue.coords.latitude],zoom:a.zoom||12,duration:2e3}):this.once("terrain",()=>{this.easeTo({center:[ue.coords.longitude,ue.coords.latitude],zoom:a.zoom||12,duration:2e3})}))},null,{maximumAge:24*3600*1e3,timeout:5e3,enableHighAccuracy:!1})}),this.on("styledata",()=>{this.setPrimaryLanguage(this.primaryLanguage)}),this.on("styledata",()=>{this.getTerrain()===null&&this.isTerrainEnabled&&this.enableTerrain(this.terrainExaggeration)}),this.once("load",async()=>{let ee={logo:null};try{const ue=Object.keys(this.style.tileManagers).map(te=>this.getSource(te)).filter(te=>te&&"url"in te&&typeof te.url=="string"&&te.url.includes("tiles.json")),fe=new URL(ue[0].url);fe.searchParams.has("key")||fe.searchParams.append("key",Pn.apiKey),ee=await(await fetch(fe.href)).json()}catch{}if(a.customControls){const ue="[data-maptiler-control-group]",fe="[data-maptiler-control]",te=ye=>{let Se=ye.dataset.maptilerControl;return(Se==="true"||Se==="")&&(Se=void 0),Se},Be=ye=>ye.dataset.maptilerPosition;let Ae=[...this._container.ownerDocument.querySelectorAll(ue)],De=[...this._container.ownerDocument.querySelectorAll(fe)].filter(ye=>ye.closest(ue)===null);if(typeof a.customControls=="string"){const ye=a.customControls;Ae=Ae.filter(Se=>Se.matches(ye)||Se.closest(ye)!==null),De=De.filter(Se=>Se.matches(ye)||Se.closest(ye)!==null)}for(const ye of Ae){const Se=new Ag(ye);this.addControl(Se,Be(ye));for(const Ie of ye.querySelectorAll(fe))Se.configureGroupItem(Ie,te(Ie))}for(const ye of De)this.addControl(new Ag(ye,te(ye)),Be(ye));const xe=()=>{const{lng:ye,lat:Se}=this.getCenter();this._container.style.setProperty("--maptiler-center-lng",String(ye)),this._container.style.setProperty("--maptiler-center-lat",String(Se)),this._container.style.setProperty("--maptiler-zoom",String(this.getZoom())),this._container.style.setProperty("--maptiler-bearing",String(this.getBearing())),this._container.style.setProperty("--maptiler-pitch",String(this.getPitch())),this._container.style.setProperty("--maptiler-roll",String(this.getRoll())),this._container.style.setProperty("--maptiler-is-globe-projection",String(this.isGlobeProjection())),this._container.style.setProperty("--maptiler-has-terrain",String(this.hasTerrain()))};xe(),this.on("render",xe)}if(a.forceNoAttributionControl!==!0)if("logo"in ee&&ee.logo){const ue=ee.logo;this.addControl(new hv({logoURL:ue}),a.logoPosition)}else a.maptilerLogo&&this.addControl(new hv,a.logoPosition);if(a.scaleControl){const ue=a.scaleControl===!0||a.scaleControl===void 0?"bottom-right":a.scaleControl,fe=new OP({unit:Pn.unit});this.addControl(fe,ue),Pn.on("unit",te=>{fe.setUnit(te)})}
935if(a.navigationControl!==!1){const ue=a.navigationControl===!0||a.navigationControl===void 0?"top-right":a.navigationControl;this.addControl(new bA,ue)}if(a.geolocateControl!==!1){const ue=a.geolocateControl===!0||a.geolocateControl===void 0?"top-right":a.geolocateControl;this.addControl(new TA({positionOptions:{enableHighAccuracy:!0,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!0,showAccuracyCircle:!0,showUserLocation:!0}),ue)}if(a.terrainControl){const ue=a.terrainControl===!0||a.terrainControl===void 0?"top-right":a.terrainControl;this.addControl(new xA,ue)}if(a.projectionControl){const ue=a.projectionControl===!0||a.projectionControl===void 0?"top-right":a.projectionControl;this.addControl(new EA,ue)}if(a.fullscreenControl){const ue=a.fullscreenControl===!0||a.fullscreenControl===void 0?"top-right":a.fullscreenControl;this.addControl(new BP({}),ue)}this.isReady=!0,this.fire("ready",{target:this})});let L=!1,O=!1,H;this.once("ready",()=>{L=!0,O&&this.fire("loadWithTerrain",H)}),this.once("style.load",()=>{const{minimap:ee}=a;if(typeof ee=="object"){const{zoom:ue,center:fe,style:te,language:Be,apiKey:Ae,maptilerLogo:De,canvasContextAttributes:xe,refreshExpiredTiles:ye,maxBounds:Se,scrollZoom:Ie,minZoom:Ze,maxZoom:Je,boxZoom:Ve,locale:ft,fadeDuration:vt,crossSourceCollisions:nt,clickTolerance:ct,bounds:Dt,fitBoundsOptions:Pt,pixelRatio:We,validateStyle:Ut}=a;this.minimap=new Qm(ee,{zoom:ue,center:fe,style:te,language:Be,apiKey:Ae,container:"null",maptilerLogo:De,canvasContextAttributes:xe,refreshExpiredTiles:ye,maxBounds:Se,scrollZoom:Ie,minZoom:Ze,maxZoom:Je,boxZoom:Ve,locale:ft,fadeDuration:vt,crossSourceCollisions:nt,clickTolerance:ct,bounds:Dt,fitBoundsOptions:Pt,pixelRatio:We,validateStyle:Ut}),this.addControl(this.minimap,ee.position??"bottom-left")}else ee===!0?(this.minimap=new Qm({},a),this.addControl(this.minimap,"bottom-left")):ee!==void 0&&ee!==!1&&(this.minimap=new Qm({},a),this.addControl(this.minimap,ee))});const J=ee=>{ee.terrain&&(O=!0,H={type:"loadWithTerrain",target:this,terrain:ee.terrain},this.off("terrain",J),L&&this.fire("loadWithTerrain",H))};this.on("terrain",J),a.terrain&&this.enableTerrain(a.terrainExaggeration??this.terrainExaggeration),this.once("load",()=>{this.getCanvas().addEventListener("webglcontextlost",ue=>{if(this._removed===!0){console.warn("[webglcontextlost]","WebGL context lost after map removal. This is harmless.");return}console.warn("[webglcontextlost]","Unexpected loss of WebGL context!"),this.fire("webglContextLost",ue)});const ee=this.getLayersOrder()[0];a.space&&this.initSpace({options:a,before:ee}),a.halo&&this.initHalo({options:a,before:ee})}),this.telemetry=new PA(this)}getSpace(){return this.space}setSpace(a,h=!0){if(h&&(this.options.space=a),a===!1){this.space=void 0;return}if(this.space){this.space.setCubemap(a),this.getLayer(this.space.id)||this.addLayer(this.space,this.getLayersOrder()[0]);return}this.space=new _d(a),this.once("load",()=>{const y=this.getLayersOrder()[0];this.space&&this.addLayer(this.space,y)})}enableSpaceAnimations(){this.setSpaceAnimationActive(!0)}disableSpaceAnimations(){this.setSpaceAnimationActive(!1)}enableHaloAnimations(){this.setHaloAnimationActive(!0)}disableHaloAnimations(){this.setHaloAnimationActive(!1)}setHaloAnimationActive(a){this.halo?this.halo.setAnimationActive(a):this.once("load",()=>{var h;(h=this.halo)==null||h.setAnimationActive(a)})}setSpaceAnimationActive(a){this.space?this.space.setAnimationActive(a):this.once("load",()=>{var h;(h=this.space)==null||h.setAnimationActive(a)})}setSpaceFromStyle({style:a}){var h,y,x;if(this.options.space!==!0&&typeof this.options.space<"u"){this.setSpace(this.options.space);return}const T=(y=(h=a.metadata)==null?void 0:h.maptiler)==null?void 0:y.space;if(!this.options.space&&!T){this.setSpace(!1,!1);return}if(JSON.stringify((x=this.space)==null?void 0:x.getConfig())===JSON.stringify(T)){if(this.space&&!this.getLayer(this.space.id)){const v=this.getLayersOrder()[0];this.addLayer(this.space,v)}return}if(this.options.space===!0){this.setSpace(T??!0);return}
935if(this.space&&this.isGlobeProjection()){if(!this.getLayer(this.space.id)){const v=this.getLayersOrder()[0];this.addLayer(this.space,v)}this.space.setCubemap(T)}}setHaloFromStyle({style:a}){var h,y,x;if(this.options.halo===!1)return;const T=(h=a.metadata)==null?void 0:h.maptiler;if(JSON.stringify((y=this.halo)==null?void 0:y.getConfig())===JSON.stringify(T==null?void 0:T.halo)){if(this.halo&&!this.getLayer(this.halo.id)){const v=this.getLayersOrder().indexOf(((x=this.space)==null?void 0:x.id)??"")+1,s=this.getLayersOrder()[v];this.addLayer(this.halo,s)}return}if(!(T!=null&&T.halo)&&!this.options.halo){this.setHalo({stops:[[0,"transparent"],[.01,"transparent"]],scale:1});return}(()=>{var v;if(this.halo){if(!this.getLayer(this.halo.id)){const I=this.getLayersOrder().indexOf(((v=this.space)==null?void 0:v.id)??"")+1,L=this.getLayersOrder()[I];this.addLayer(this.halo,L)}const s=(T==null?void 0:T.halo)??this.options.halo;s&&this.halo.setGradient(s)}})()}initSpace({options:a=this.options,before:h,spec:y}){if(this.space){this.getLayer(this.space.id)||this.addLayer(this.space,h);return}if(a.space===!1)return;if(a.space&&a.space!==!0){this.space=new _d(a.space),this.addLayer(this.space,h);return}const x=y;x&&(this.space=new _d(x),this.addLayer(this.space,h)),this.options.space===!0&&(this.space=new _d(!0),this.addLayer(this.space,h))}initHalo({options:a=this.options,before:h,spec:y}){if(this.halo&&this.getLayer(this.halo.id)||a.halo===!1)return;const x=y;if(a.halo&&a.halo!==!0){this.halo=new bd(a.halo),this.addLayer(this.halo,h);return}if(x&&(this.halo=new bd(x),this.addLayer(this.halo,h)),this.options.halo===!0){this.halo=new bd(!0),this.addLayer(this.halo,h);return}}getHalo(){return this.halo}setHalo(a){if(this.options.halo=a,!!this.isGlobeProjection()){if(this.halo){this.halo.setGradient(a);return}this.halo=new bd(a),this.once("load",()=>{var h;const y=this.getLayersOrder(),x=y[0],T=y.indexOf(((h=this.space)==null?void 0:h.id)??"")+2,v=y[T];this.halo&&this.addLayer(this.halo,this.space?v:x)})}}recreate(){const a={center:this.getCenter(),zoom:this.getZoom(),bearing:this.getBearing(),pitch:this.getPitch()};this.remove(),Object.assign(this,new u1({...this.options})),this.once("load",()=>{this.jumpTo(a)})}setTerrainAnimationDuration(a){this.terrainAnimationDuration=Math.max(a,0)}async onLoadAsync(){return new Promise(a=>{if(this.loaded()){a(this);return}this.once("load",()=>{a(this)})})}async onReadyAsync(){return new Promise(a=>{if(this.isReady){a(this);return}this.once("ready",()=>{a(this)})})}async onLoadWithTerrainAsync(){return new Promise(a=>{if(this.isReady&&this.terrain){a(this);return}this.once("loadWithTerrain",()=>{a(this)})})}monitorStyleUrl(a){typeof this.monitoredStyleUrls>"u"&&(this.monitoredStyleUrls=new Set);const h=new URL(a);h.search="",this.monitoredStyleUrls.add(h.href)}setStyle(a,h){var y,x,T,v,s;this.originalLabelStyle.clear(),(y=this.minimap)==null||y.setStyle(a),this.forceLanguageUpdate=!0,this.once("idle",()=>{this.forceLanguageUpdate=!1});const I=Ov(a);if(I.requiresUrlMonitoring&&this.monitorStyleUrl(I.style),I.isFallback){if(this.getStyle())return console.warn("[Map.setStyle]: Invalid style. A style must be a valid URL to a style.json, a JSON string representing a valid StyleSpecification or a valid StyleSpecification object. Keeping the curent style instead."),this;console.warn("[Map.setStyle]: Invalid style. A style must be a valid URL to a style.json, a JSON string representing a valid StyleSpecification or a valid StyleSpecification object. Fallback to default MapTiler style.")}this.spaceboxLoadingState.styleLoadedCallbackFired=!1,this.spaceboxLoadingState.styleLoadCallbackSet=!1;const L=this.getStyle(),O=I.style;try{super.setStyle(I.style,{...h,diff:typeof I.style!="string"}),this.styleInProcess=!0}catch(ee){this.styleInProcess=!1,console.error("[Map.setStyle]: Error while setting style:",ee)}const H=()=>{const ee=I.style;if(!ee.projection||ee.projection.type==="mercator"){console.warn("[Map.setStyle]: Neither space nor halo is supported for mercator projection. Ignoring...");return}this.setSpaceFromStyle({style:I.style}),this.setHaloFromStyle({style:I.style})},J=ee=>{var ue,fe,te,Be;const Ae=(ee==null?void 0:ee.target.getStyle())??I.style;if(!this.spaceboxLoadingState.styleLoadedCallbackFired&&(this.spaceboxLoadingState.styleLoadedCallbackFired=!0,this.spaceboxLoadingState.styleLoadCallbackSet=!1,typeof Ae!="string"))try{const De=this.getLayersOrder()[0];this.space?this.setSpaceFromStyle({style:Ae}):this.initSpace({before:De,spec:(fe=(ue=Ae.metadata)==null?void 0:ue.maptiler)==null?void 0:fe.space}),this.halo?this.setHaloFromStyle({style:Ae}):this.initHalo({before:De,spec:(Be=(te=Ae.metadata)==null?void 0:te.maptiler)==null?void 0:Be.halo})}catch(De){console.error(De)}};return typeof I.style=="string"||I.requiresUrlMonitoring?(this.once("style.load",J),this):(requestIdleCallback(()=>{try{J()}catch(ee){console.error(ee)}}),this.spaceboxLoadingState.styleLoadCallbackSet?((x=L==null?void 0:L.terrain)==null?void 0:x.source)!==((T=O==null?void 0:O.terrain)==null?void 0:T.source)||((v=L==null?void 0:L.terrain)==null?void 0:v.exaggeration)!==((s=O==null?void 0:O.terrain)==null?void 0:s.exaggeration)?(this.once("terrain",H),this):this:(this.once("style.load",J),this.once("projection.change",J),this.spaceboxLoadingState.styleLoadCallbackSet=!0,this))}addLayer(a,h){var y;return(y=this.minimap)==null||y.addLayer(a,h),super.addLayer(a,h)}moveLayer(a,h){var y;return(y=this.minimap)==null||y.moveLayer(a,h),super.moveLayer(a,h)}removeLayer(a){var h;
935return(h=this.minimap)==null||h.removeLayer(a),super.removeLayer(a)}setLayerZoomRange(a,h,y){var x;return(x=this.minimap)==null||x.setLayerZoomRange(a,h,y),super.setLayerZoomRange(a,h,y)}setFilter(a,h,y){var x;return(x=this.minimap)==null||x.setFilter(a,h,y),super.setFilter(a,h,y)}setPaintProperty(a,h,y,x){var T;return(T=this.minimap)==null||T.setPaintProperty(a,h,y,x),super.setPaintProperty(a,h,y,x)}setLayoutProperty(a,h,y,x){var T;return(T=this.minimap)==null||T.setLayoutProperty(a,h,y,x),super.setLayoutProperty(a,h,y,x)}setGlyphs(a,h){var y;return(y=this.minimap)==null||y.setGlyphs(a,h),super.setGlyphs(a,h)}getStyleLanguage(){return!this.style||!this.style.stylesheet||!this.style.stylesheet.metadata||typeof this.style.stylesheet.metadata!="object"?null:"maptiler:language"in this.style.stylesheet.metadata&&typeof this.style.stylesheet.metadata["maptiler:language"]=="string"?yg(this.style.stylesheet.metadata["maptiler:language"]):null}setLanguage(a){var h;(h=this.minimap)==null||h.map.setLanguage(a),this.onStyleReady(()=>{this.setPrimaryLanguage(a)})}setPrimaryLanguage(a){const h=this.getStyleLanguage(),y=ov(a,lr);if(!y){console.warn(`The language "${y}" is not supported.`);return}if(!(y.flag===lr.STYLE.flag&&h&&(h.flag===lr.AUTO.flag||h.flag===lr.VISITOR.flag))&&(y.flag!==lr.STYLE.flag&&(this.languageAlwaysBeenStyle=!1),this.languageAlwaysBeenStyle||this.primaryLanguage===y&&!this.forceLanguageUpdate))return;if(this.primaryLanguage.flag===lr.STYLE_LOCK.flag){console.warn("The language cannot be changed because this map has been instantiated with the STYLE_LOCK language flag.");return}this.primaryLanguage=y;let x=y;if(y.flag===lr.STYLE.flag){if(!h){console.warn("The style has no default languages or has an invalid one.");return}x=h}let T=lr.LOCAL.flag,v=["get",T];x.flag===lr.VISITOR.flag?(T=uv().flag,v=["case",["all",["has",T],["has",lr.LOCAL.flag]],["case",["==",["get",T],["get",lr.LOCAL.flag]],["get",lr.LOCAL.flag],["format",["get",T],{"font-scale":.8},`
936`,["get",lr.LOCAL.flag],{"font-scale":1.1}]],["get",lr.LOCAL.flag]]):x.flag===lr.VISITOR_ENGLISH.flag?(T=lr.ENGLISH.flag,v=["case",["all",["has",T],["has",lr.LOCAL.flag]],["case",["==",["get",T],["get",lr.LOCAL.flag]],["get",lr.LOCAL.flag],["format",["get",T],{"font-scale":.8},`
937`,["get",lr.LOCAL.flag],{"font-scale":1.1}]],["get",lr.LOCAL.flag]]):x.flag===lr.AUTO.flag?(T=uv().flag,v=["coalesce",["get",T],["get",lr.LOCAL.flag]]):x===lr.LOCAL?(T=lr.LOCAL.flag,v=["get",T]):(T=x.flag,v=["coalesce",["get",T],["get",lr.LOCAL.flag]]);const{layers:s}=this.getStyle(),I=this.originalLabelStyle.size===0;if(I){const L=rM(s,this);this.isStyleLocalized=Object.keys(L.localized).length>0}for(const L of s){if(L.type!=="symbol")continue;const O=L,H=this.getSource(O.source);if(!H||!("url"in H&&typeof H.url=="string")||new URL(H.url).host!==ui.maptilerApiHost)continue;const{id:J,layout:ee}=O;if(!ee||!("text-field"in ee))continue;let ue;if(I?(ue=this.getLayoutProperty(J,"text-field"),this.originalLabelStyle.set(J,ue)):ue=this.originalLabelStyle.get(J),typeof ue=="string"){const{contains:fe,exactMatch:te}=KP(ue,this.isStyleLocalized);if(!fe)continue;if(te)this.setLayoutProperty(J,"text-field",v);else{const Be=JP(ue,v,this.isStyleLocalized);this.setLayoutProperty(J,"text-field",Be)}}else{const fe=YP(ue,v,this.isStyleLocalized);this.setLayoutProperty(J,"text-field",fe)}}this.languageIsUpdated=!0}getPrimaryLanguage(){return this.primaryLanguage}getTerrainExaggeration(){return this.terrainExaggeration}hasTerrain(){return this.isTerrainEnabled}growTerrain(a){if(!this.terrain)return;const h=performance.now(),y=this.terrain.exaggeration,x=a-y,T=()=>{if(!this.terrain||this.terrainFlattening)return;const v=(performance.now()-h)/this.terrainAnimationDuration;if(v<.99){const s=1-(1-v)**4,I=y+s*x;this.terrain.exaggeration=I,requestAnimationFrame(T)}else this.terrainGrowing=!1,this.terrainFlattening=!1,this.terrain.exaggeration=a,this.fire("terrainAnimationStop",{terrain:this.terrain});this._elevationFreeze=!1,this.triggerRepaint()};!this.terrainGrowing&&!this.terrainFlattening&&this.fire("terrainAnimationStart",{terrain:this.terrain}),this.terrainGrowing=!0,this.terrainFlattening=!1,requestAnimationFrame(T)}enableTerrain(a=this.terrainExaggeration){if(a<0){console.warn("Terrain exaggeration cannot be negative.");return}const h=x=>{!this.terrain||x.type!=="data"||x.dataType!=="source"||!("source"in x)||x.sourceId!=="maptiler-terrain"||x.source.type!=="raster-dem"||x.isSourceLoaded&&(this.off("data",h),this.growTerrain(a))},y=()=>{this.isTerrainEnabled=!0,this.terrainExaggeration=a,this.on("data",h),this.addSource(ui.terrainSourceId,{type:"raster-dem",url:ui.terrainSourceURL}),this.setTerrain({source:ui.terrainSourceId,exaggeration:0})};if(this.getTerrain()){this.isTerrainEnabled=!0,this.growTerrain(a);return}if(this.loaded()||this.isTerrainEnabled)y();else{const x=()=>
937{this.getTerrain()&&this.getSource(ui.terrainSourceId)||y()};this.once("load",()=>{x()}),this.once("moveend",()=>{x()})}}disableTerrain(){if(!this.terrain)return;this.isTerrainEnabled=!1;const a=performance.now(),h=this.terrain.exaggeration,y=()=>{if(!this.terrain||this.terrainGrowing)return;const x=(performance.now()-a)/this.terrainAnimationDuration;if(this._elevationFreeze=!1,x<.99){const T=(1-x)**4,v=h*T;this.terrain.exaggeration=v,requestAnimationFrame(y)}else this.terrain.exaggeration=0,this.terrainGrowing=!1,this.terrainFlattening=!1,this.setTerrain(),this.getSource(ui.terrainSourceId)&&this.removeSource(ui.terrainSourceId),this.fire("terrainAnimationStop",{terrain:null});this.triggerRepaint()};!this.terrainGrowing&&!this.terrainFlattening&&this.fire("terrainAnimationStart",{terrain:this.terrain}),this.terrainGrowing=!1,this.terrainFlattening=!0,requestAnimationFrame(y)}setTerrainExaggeration(a,h=!0){!h&&this.terrain?(this.terrainExaggeration=a,this.terrain.exaggeration=a,this.triggerRepaint()):this.enableTerrain(a)}onStyleReady(a){this.isStyleLoaded()?a():this.once("styledata",()=>{a()})}async fitToIpBounds(){const a=await lv.info();this.fitBounds(a.country_bounds,{duration:0,padding:100})}async centerOnIpPoint(a){const h=await lv.info();this.jumpTo({center:[h.longitude??0,h.latitude??0],zoom:a||11})}getCameraHash(){const a=new Float32Array(5),h=this.getCenter();return a[0]=h.lng,a[1]=h.lat,a[2]=this.getZoom(),a[3]=this.getPitch(),a[4]=this.getBearing(),hP.fromUint8Array(new Uint8Array(a.buffer))}getSdkConfig(){return Pn}getMaptilerSessionId(){return Kg}setTransformRequest(a){return super.setTransformRequest(mv(a)),this}getProjection(){const a=this.style.getProjection();return a===void 0&&this.style.projection?{type:this.style.projection.name}:a}isGlobeProjection(){const a=this.getProjection();return a?a.type==="globe":!1}enableGlobeProjection(){this.curentProjection="globe",this.isGlobeProjection()!==!0&&this.setProjection({type:"globe"})}enableMercatorProjection(){this.curentProjection="mercator",this.isGlobeProjection()!==!1&&this.setProjection({type:"mercator"})}setProjection(a,h){return typeof a=="string"&&(a={type:a}),(a.type==="mercator"||a.type==="globe")&&h!=null&&h.persist&&(this.curentProjection=a.type),this.fire("projection.change",{target:this,projection:a}),super.setProjection(a)}forgetPersistedProjection(){return this.curentProjection=void 0,this}isLanguageUpdated(){return this.languageIsUpdated}};const{Evented:X5}=xt,{Evented:Y5}=xt;function wd(l){const a=l.toString(16);return a.length===1?`0${a}`:a}function fC(l){return`#${wd(l[0])}${wd(l[1])}${wd(l[2])}${l.length===4?wd(l[3]):""}`}class It extends Array{constructor(a={}){super(),mt(this,"min",0),mt(this,"max",1),"min"in a&&(this.min=a.min),"max"in a&&(this.max=a.max),"stops"in a&&this.setStops(a.stops,{clone:!1})}static fromArrayDefinition(a){return new It({stops:a.map(h=>({value:h[0],color:h[1]}))})}setStops(a,h={clone:!0}){const y=h.clone?this.clone():this;y.length=0;let x=Number.POSITIVE_INFINITY,T=Number.NEGATIVE_INFINITY;for(let v=0;v<a.length;v+=1)x=Math.min(x,a[v].value),T=Math.max(T,a[v].value),y.push({value:a[v].value,color:a[v].color.slice()});return y.sort((v,s)=>v.value<s.value?-1:1),this.min=x,this.max=T,y}scale(a,h,y={clone:!0}){const x=y.clone,T=this[0].value,v=this.at(-1).value-T,s=h-a,I=[];for(let L=0;L<this.length;L+=1){const O=(this[L].value-T)/v*s+a;x?I.push({value:O,color:this[L].color.slice()}):this[L].value=O}return x?new It({stops:I}):this}at(a){return a<0?this[this.length+a]:this[a]}clone(){return new It({stops:this.getRawColorStops()})}getRawColorStops(){const a=[];for(let h=0;h<this.length;h+=1)a.push({value:this[h].value,color:this[h].color});return a}reverse(a={clone:!0}){const h=a.clone?this.clone():this;for(let y=0;y<~~(h.length/2);y+=1){const x=h[y].color;h[y].color=h.at(-(y+1)).color,h.at(-(y+1)).color=x}return h}getBounds(){return{min:this.min,max:this.max}}getColor(a,h={smooth:!0}){if(a<=this[0].value)return this[0].color;if(a>=this.at(-1).value)return this.at(-1).color;for(let y=0;y<this.length-1;y+=1){if(a>this[y+1].value)continue;const x=this[y].color;if(!h.smooth)return x.slice();const T=this[y].value,v=this[y+1].value,s=this[y+1].color,I=(v-a)/(v-T);return x.map((L,O)=>Math.round(L*I+s[O]*(1-I)))}return[0,0,0]}getColorHex(a,h={smooth:!0,withAlpha:!1}){return fC(this.getColor(a,h))}getColorRelative(a,h={smooth:!0}){const y=this.getBounds();return this.getColor(y.min+a*(y.max-y.min),h)}getCanvasStrip(a={horizontal:!0,size:512,smooth:!0}){const h=document.createElement("canvas");h.width=a.horizontal?a.size:1,h.height=a.horizontal?1:a.size;const y=h.getContext("2d");if(!y)throw new Error("Canvs context is missing");const x=y.getImageData(0,0,h.width,h.height),T=x.data,v=a.size,s=this[0].value,I=(this.at(-1).value-s)/v;for(let L=0;L<v;L+=1){const O=this.getColor(s+L*I,{smooth:a.smooth});T[L*4]=O[0],T[L*4+1]=O[1],T[L*4+2]=O[2],T[L*4+3]=O.length>3?O[3]:255}return y.putImageData(x,0,0),h}resample(a,h=15){const y=this.getBounds(),x=this.scale(0,1),T=1/(h-1);let v;if(a==="ease-in-square")v=Array.from({length:h},(s,I)=>{const L=I*T,O=L**2,H=x.getColor(O);return{value:L,color:H}});
937else if(a==="ease-out-square")v=Array.from({length:h},(s,I)=>{const L=I*T,O=1-(1-L)**2,H=x.getColor(O);return{value:L,color:H}});else if(a==="ease-out-sqrt")v=Array.from({length:h},(s,I)=>{const L=I*T,O=L**.5,H=x.getColor(O);return{value:L,color:H}});else if(a==="ease-in-sqrt")v=Array.from({length:h},(s,I)=>{const L=I*T,O=1-(1-L)**.5,H=x.getColor(O);return{value:L,color:H}});else if(a==="ease-out-exp")v=Array.from({length:h},(s,I)=>{const L=I*T,O=1-2**(-10*L),H=x.getColor(O);return{value:L,color:H}});else if(a==="ease-in-exp")v=Array.from({length:h},(s,I)=>{const L=I*T,O=2**(10*L-10),H=x.getColor(O);return{value:L,color:H}});else throw new Error("Invalid ressampling method.");return new It({stops:v}).scale(y.min,y.max)}transparentStart(){const a=this.getRawColorStops();a.unshift({value:a[0].value,color:a[0].color.slice()}),a[1].value+=.001;for(const h of a)h.color.length===3&&h.color.push(255);return a[0].color[3]=0,new It({stops:a})}hasTransparentStart(){return this[0].color.length===4&&this[0].color[3]===0}}new It({stops:[{value:0,color:[0,0,0,0]},{value:1,color:[0,0,0,0]}]}),new It({stops:[{value:0,color:[0,0,0]},{value:1,color:[255,255,255]}]}),new It({stops:[{value:0,color:[0,0,131]},{value:.125,color:[0,60,170]},{value:.375,color:[5,255,255]},{value:.625,color:[255,255,0]},{value:.875,color:[250,0,0]},{value:1,color:[128,0,0]}]}),new It({stops:[{value:0,color:[255,0,0]},{value:.169,color:[253,255,2]},{value:.173,color:[247,255,2]},{value:.337,color:[0,252,4]},{value:.341,color:[0,252,10]},{value:.506,color:[1,249,255]},{value:.671,color:[2,0,253]},{value:.675,color:[8,0,253]},{value:.839,color:[255,0,251]},{value:.843,color:[255,0,245]},{value:1,color:[255,0,6]}]}),new It({stops:[{value:0,color:[0,0,0]},{value:.3,color:[230,0,0]},{value:.6,color:[255,210,0]},{value:1,color:[255,255,255]}]}),new It({stops:[{value:0,color:[255,0,255]},{value:1,color:[255,255,0]}]}),new It({stops:[{value:0,color:[0,128,102]},{value:1,color:[255,255,102]}]}),new It({stops:[{value:0,color:[255,0,0]},{value:1,color:[255,255,0]}]}),new It({stops:[{value:0,color:[0,0,255]},{value:1,color:[0,255,128]}]}),new It({stops:[{value:0,color:[0,0,0]},{value:.376,color:[84,84,116]},{value:.753,color:[169,200,200]},{value:1,color:[255,255,255]}]}),new It({stops:[{value:0,color:[0,0,0]},{value:.804,color:[255,160,102]},{value:1,color:[255,199,127]}]}),new It({stops:[{value:0,color:[0,0,0]},{value:1,color:[255,255,255]}]}),new It({stops:[{value:0,color:[8,29,88]},{value:.125,color:[37,52,148]},{value:.25,color:[34,94,168]},{value:.375,color:[29,145,192]},{value:.5,color:[65,182,196]},{value:.625,color:[127,205,187]},{value:.75,color:[199,233,180]},{value:.875,color:[237,248,217]},{value:1,color:[255,255,217]}]}),new It({stops:[{value:0,color:[0,68,27]},{value:.125,color:[0,109,44]},{value:.25,color:[35,139,69]},{value:.375,color:[65,171,93]},{value:.5,color:[116,196,118]},{value:.625,color:[161,217,155]},{value:.75,color:[199,233,192]},{value:.875,color:[229,245,224]},{value:1,color:[247,252,245]}]}),new It({stops:[{value:0,color:[128,0,38]},{value:.125,color:[189,0,38]},{value:.25,color:[227,26,28]},{value:.375,color:[252,78,42]},{value:.5,color:[253,141,60]},{value:.625,color:[254,178,76]},{value:.75,color:[254,217,118]},{value:.875,color:[255,237,160]},{value:1,color:[255,255,204]}]}),new It({stops:[{value:0,color:[0,0,255]},{value:1,color:[255,0,0]}]}),new It({stops:[{value:0,color:[5,10,172]},{value:.35,color:[106,137,247]},{value:.5,color:[190,190,190]},{value:.6,color:[220,170,132]},{value:.7,color:[230,145,90]},{value:1,color:[178,10,28]}]}),new It({stops:[{value:0,color:[0,0,255]},{value:.1,color:[51,153,255]},{value:.2,color:[102,204,255]},{value:.3,color:[153,204,255]},{value:.4,color:[204,204,255]},{value:.5,color:[255,255,255]},{value:.6,color:[255,204,255]},{value:.7,color:[255,153,255]},{value:.8,color:[255,102,204]},{value:.9,color:[255,102,102]},{value:1,color:[255,0,0]}]}),new It({stops:[{value:0,color:[150,0,90]},{value:.125,color:[0,0,200]},{value:.25,color:[0,25,255]},{value:.375,color:[0,152,255]},{value:.5,color:[44,255,150]},{value:.625,color:[151,255,0]}
937,{value:.75,color:[255,234,0]},{value:.875,color:[255,111,0]},{value:1,color:[255,0,0]}]}),new It({stops:[{value:0,color:[12,51,131]},{value:.25,color:[10,136,186]},{value:.5,color:[242,211,56]},{value:.75,color:[242,143,56]},{value:1,color:[217,30,30]}]}),new It({stops:[{value:0,color:[0,0,0]},{value:.2,color:[230,0,0]},{value:.4,color:[230,210,0]},{value:.7,color:[255,255,255]},{value:1,color:[160,200,255]}]}),new It({stops:[{value:0,color:[0,0,130]},{value:.1,color:[0,180,180]},{value:.2,color:[40,210,40]},{value:.4,color:[230,230,50]},{value:.6,color:[120,70,20]},{value:1,color:[255,255,255]}]}),new It({stops:[{value:0,color:[0,0,0]},{value:.15,color:[30,0,100]},{value:.4,color:[120,0,100]},{value:.6,color:[160,90,0]},{value:.8,color:[230,200,0]},{value:1,color:[255,250,220]}]}),new It({stops:[{value:0,color:[68,1,84]},{value:.13,color:[71,44,122]},{value:.25,color:[59,81,139]},{value:.38,color:[44,113,142]},{value:.5,color:[33,144,141]},{value:.63,color:[39,173,129]},{value:.75,color:[92,200,99]},{value:.88,color:[170,220,50]},{value:1,color:[253,231,37]}]}),new It({stops:[{value:0,color:[0,0,4]},{value:.13,color:[31,12,72]},{value:.25,color:[85,15,109]},{value:.38,color:[136,34,106]},{value:.5,color:[186,54,85]},{value:.63,color:[227,89,51]},{value:.75,color:[249,140,10]},{value:.88,color:[249,201,50]},{value:1,color:[252,255,164]}]}),new It({stops:[{value:0,color:[0,0,4]},{value:.13,color:[28,16,68]},{value:.25,color:[79,18,123]},{value:.38,color:[129,37,129]},{value:.5,color:[181,54,122]},{value:.63,color:[229,80,100]},{value:.75,color:[251,135,97]},{value:.88,color:[254,194,135]},{value:1,color:[252,253,191]}]}),new It({stops:[{value:0,color:[13,8,135]},{value:.13,color:[75,3,161]},{value:.25,color:[125,3,168]},{value:.38,color:[168,34,150]},{value:.5,color:[203,70,121]},{value:.63,color:[229,107,93]},{value:.75,color:[248,148,65]},{value:.88,color:[253,195,40]},{value:1,color:[240,249,33]}]}),new It({stops:[{value:0,color:[125,0,179]},{value:.13,color:[172,0,187]},{value:.25,color:[219,0,170]},{value:.38,color:[255,0,130]},{value:.5,color:[255,63,74]},{value:.63,color:[255,123,0]},{value:.75,color:[234,176,0]},{value:.88,color:[190,228,0]},{value:1,color:[147,255,0]}]}),new It({stops:[{value:0,color:[125,0,179]},{value:.13,color:[116,0,218]},{value:.25,color:[98,74,237]},{value:.38,color:[68,146,231]},{value:.5,color:[0,204,197]},{value:.63,color:[0,247,146]},{value:.75,color:[0,255,88]},{value:.88,color:[40,255,8]},{value:1,color:[147,255,0]}]}),new It({stops:[{value:0,color:[125,0,179]},{value:.1,color:[199,0,180]},{value:.2,color:[255,0,121]},{value:.3,color:[255,108,0]},{value:.4,color:[222,194,0]},{value:.5,color:[150,255,0]},{value:.6,color:[0,255,55]},{value:.7,color:[0,246,150]},{value:.8,color:[50,167,222]},{value:.9,color:[103,51,235]},{value:1,color:[124,0,186]}]}),new It({stops:[{value:0,color:[40,26,44]},{value:.13,color:[59,49,90]},{value:.25,color:[64,76,139]},{value:.38,color:[63,110,151]},{value:.5,color:[72,142,158]},{value:.63,color:[85,174,163]},{value:.75,color:[120,206,163]},{value:.88,color:[187,230,172]},{value:1,color:[253,254,204]}]}),new It({stops:[{value:0,color:[47,15,62]},{value:.13,color:[87,23,86]},{value:.25,color:[130,28,99]},{value:.38,color:[171,41,96]},{value:.5,color:[206,67,86]},{value:.63,color:[230,106,84]},{value:.75,color:[242,149,103]},{value:.88,color:[249,193,135]},{value:1,color:[254,237,176]}]}),new It({stops:[{value:0,color:[18,36,20]},{value:.13,color:[25,63,41]},{value:.25,color:[24,91,59]},{value:.38,color:[13,119,72]},{value:.5,color:[18,148,80]},{value:.63,color:[80,173,89]},{value:.75,color:[132,196,122]},{value:.88,color:[175,221,162]},{value:1,color:[215,249,208]}]}),new It({stops:[{value:0,color:[54,14,36]},{value:.13,color:[89,23,80]},{value:.25,color:[110,45,132]},{value:.38,color:[120,77,178]},{value:.5,color:[120,113,213]},{value:.63,color:[115,151,228]},{value:.75,color:[134,185,227]},{value:.88,color:[177,214,227]},{value:1,color:[230,241,241]}]}),new It({stops:[{value:0,color:[30,4,110]},{value:.13,color:[47,14,176]},{value:.25,color:[41,45,236]},{value:.38,color:[25,99,212]},{value:.5,color:[68,131,200]},{value:.63,color:[114,156,197]}
937,{value:.75,color:[157,181,203]},{value:.88,color:[200,208,216]},{value:1,color:[241,237,236]}]}),new It({stops:[{value:0,color:[60,9,18]},{value:.13,color:[100,17,27]},{value:.25,color:[142,20,29]},{value:.38,color:[177,43,27]},{value:.5,color:[192,87,63]},{value:.63,color:[205,125,105]},{value:.75,color:[216,162,148]},{value:.88,color:[227,199,193]},{value:1,color:[241,237,236]}]}),new It({stops:[{value:0,color:[64,5,5]},{value:.13,color:[106,6,15]},{value:.25,color:[144,26,7]},{value:.38,color:[168,64,3]},{value:.5,color:[188,100,4]},{value:.63,color:[206,136,11]},{value:.75,color:[220,174,25]},{value:.88,color:[231,215,44]},{value:1,color:[248,254,105]}]}),new It({stops:[{value:0,color:[51,20,24]},{value:.13,color:[90,32,35]},{value:.25,color:[129,44,34]},{value:.38,color:[159,68,25]},{value:.5,color:[182,99,19]},{value:.63,color:[199,134,22]},{value:.75,color:[212,171,35]},{value:.88,color:[221,210,54]},{value:1,color:[225,253,75]}]}),new It({stops:[{value:0,color:[145,105,18]},{value:.13,color:[184,71,38]},{value:.25,color:[186,58,115]},{value:.38,color:[160,71,185]},{value:.5,color:[110,97,218]},{value:.63,color:[50,123,164]},{value:.75,color:[31,131,110]},{value:.88,color:[77,129,34]},{value:1,color:[145,105,18]}]}),new It({stops:[{value:0,color:[42,24,108]},{value:.13,color:[33,50,162]},{value:.25,color:[15,90,145]},{value:.38,color:[40,118,137]},{value:.5,color:[59,146,135]},{value:.63,color:[79,175,126]},{value:.75,color:[120,203,104]},{value:.88,color:[193,221,100]},{value:1,color:[253,239,154]}]}),new It({stops:[{value:0,color:[4,35,51]},{value:.13,color:[23,51,122]},{value:.25,color:[85,59,157]},{value:.38,color:[129,79,143]},{value:.5,color:[175,95,130]},{value:.63,color:[222,112,101]},{value:.75,color:[249,146,66]},{value:.88,color:[249,196,65]},{value:1,color:[232,250,91]}]}),new It({stops:[{value:0,color:[34,31,27]},{value:.13,color:[65,50,41]},{value:.25,color:[98,69,52]},{value:.38,color:[131,89,57]},{value:.5,color:[161,112,59]},{value:.63,color:[185,140,66]},{value:.75,color:[202,174,88]},{value:.88,color:[216,209,126]},{value:1,color:[233,246,171]}]}),new It({stops:[{value:0,color:[17,32,64]},{value:.13,color:[35,52,116]},{value:.25,color:[29,81,156]},{value:.38,color:[31,113,162]},{value:.5,color:[50,144,169]},{value:.63,color:[87,173,176]},{value:.75,color:[149,196,189]},{value:.88,color:[203,221,211]},{value:1,color:[254,251,230]}]}),new It({stops:[{value:0,color:[23,35,19]},{value:.13,color:[24,64,38]},{value:.25,color:[11,95,45]},{value:.38,color:[39,123,35]},{value:.5,color:[95,146,12]},{value:.63,color:[152,165,18]},{value:.75,color:[201,186,69]},{value:.88,color:[233,216,137]},{value:1,color:[255,253,205]}]}),new It({stops:[{value:0,color:[0,0,0]},{value:.07,color:[22,5,59]},{value:.13,color:[60,4,105]},{value:.2,color:[109,1,135]},{value:.27,color:[161,0,147]},{value:.33,color:[210,2,142]},{value:.4,color:[251,11,123]},{value:.47,color:[255,29,97]},{value:.53,color:[255,54,69]},{value:.6,color:[255,85,46]},{value:.67,color:[255,120,34]},{value:.73,color:[255,157,37]},{value:.8,color:[241,191,57]},{value:.87,color:[224,220,93]},{value:.93,color:[218,241,142]},{value:1,color:[227,253,198]}]}),new It({stops:[{value:0,color:[0,32,77,255]},{value:.125,color:[5,54,110,255]},{value:.25,color:[65,77,108,255]},{value:.375,color:[97,100,111,255]},{value:.5,color:[125,124,121,255]},{value:.625,color:[156,149,120,255]},{value:.75,color:[190,175,111,255]},{value:.875,color:[225,204,94,255]},{value:1,color:[255,235,70,255]}]}),new It({stops:[{value:0,color:[48,18,59,255]},{value:.125,color:[70,107,227,255]},{value:.25,color:[40,187,236,255]},{value:.375,color:[49,242,153,255]},{value:.5,color:[162,252,60,255]},{value:.625,color:[237,208,58,255]},{value:.75,color:[251,128,34,255]},{value:.875,color:[210,49,5,255]},{value:1,color:[122,4,3,255]}]}),new It({stops:[{value:0,color:[250,235,221,0]},{value:.133,color:[250,235,221,255]},{value:.266,color:[246,170,130,255]},{value:.4,color:[240,96,67,255]},{value:.533,color:[203,27,79,255]},{value:.666,color:[132,30,90,255]},{value:.8,color:[63,27,68,255]},{value:1,color:[3,5,26,255]}]}),new It({stops:[{value:0,color:[11,4,5,255]},{value:.125,color:[43,28,53,255]},{value:.25,color:[62,53,107,255]},{value:.375,color:[59,86,152,255]},{value:.5,color:[53,123,162,255]},{value:.625,color:[53,158,170,255]}
937,{value:.75,color:[73,193,173,255]},{value:.875,color:[150,221,181,255]},{value:1,color:[222,245,229,255]}]});new Array;function h1(){return"3.11.1"}xt.Map;xt.Marker;xt.Popup;xt.Style;xt.CanvasSource;xt.GeoJSONSource;xt.ImageSource;xt.RasterTileSource;xt.RasterDEMTileSource;xt.VectorTileSource;xt.VideoSource;xt.NavigationControl;xt.GeolocateControl;xt.AttributionControl;xt.LogoControl;xt.ScaleControl;xt.FullscreenControl;xt.TerrainControl;xt.BoxZoomHandler;xt.ScrollZoomHandler;xt.CooperativeGesturesHandler;xt.KeyboardHandler;xt.TwoFingersTouchPitchHandler;xt.MapWheelEvent;xt.MapTouchEvent;xt.MapMouseEvent;xt.config;xt.getVersion;const{setRTLTextPlugin:K5,getRTLTextPluginStatus:J5,LngLat:Q5,LngLatBounds:oh,MercatorCoordinate:ek,Evented:tk,AJAXError:rk,prewarm:nk,clearPrewarmedResources:ik,Hash:ak,Point:ok,EdgeInsets:sk,DragRotateHandler:lk,DragPanHandler:ck,TwoFingersTouchZoomRotateHandler:uk,DoubleClickZoomHandler:hk,TwoFingersTouchZoomHandler:pk,TwoFingersTouchRotateHandler:dk,getWorkerCount:fk,setWorkerCount:mk,getMaxParallelImageRequests:gk,setMaxParallelImageRequests:yk,getWorkerUrl:_k,setWorkerUrl:vk,addSourceType:xk,importScriptInWorkers:bk,addProtocol:wk,removeProtocol:Tk}=xt,xy={errorMessage:"",arrivals:[],index:0,pattern:[],vehicleGroup:[],stopArrivals:[]};function mC(l,a){var h;switch(a.type){case"get_vehicles":{if(l.vehicleGroup.length===a.payload.length){let x=!0;for(let T=0;T<l.vehicleGroup.length;T++){const v=l.vehicleGroup[T],s=a.payload[T];if(!v||!s||v.id!==s.id||v.lat!==s.lat||v.lon!==s.lon||v.headingDegrees!==s.headingDegrees||v.name!==s.name||v.lastUpdated!==s.lastUpdated||v.passengerLoad!==s.passengerLoad){x=!1;break}}if(x)return l}return{...l,vehicleGroup:a.payload}}case"get_stop_arrivals":return{...l,stopArrivals:a.payload};case"add_error":return{...l,errorMessage:String(((h=a.payload)==null?void 0:h.message)||a.payload)};case"clear":return xy;default:return l}}const p1=we.createContext(void 0);function gC({children:l}){const[a,h]=we.useReducer(mC,xy),y=we.useMemo(()=>({...a,dispatch:h}),[a]);return Re.jsx(p1.Provider,{value:y,children:l})}let nx=!1;function d1(){const l=we.useContext(p1);return l||(!nx&&typeof window<"u"&&(nx=!0,console.warn("[ArrivalsContext] useArrivals called outside ArrivalsProvider. Returning safe defaults to avoid crash.")),{...xy,dispatch:()=>{}})}function kg(l,a=6e4){if(l==null||l==="")return!1;let h;if(typeof l=="number")h=l<1e12?l*1e3:l;else{const y=Date.parse(l);if(Number.isNaN(y))return!0;h=y}return Date.now()-h>a}const ix=18,ax=17,f1="#ED08FB",yC=-90;function _C({backgroundColor:l=f1,sizePx:a,className:h}){const y=a*ix/ax,x=a;return Re.jsxs("svg",{className:h,width:y,height:x,viewBox:`0 0 ${ix} ${ax}`,overflow:"visible",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0,children:[Re.jsx("path",{fill:"#2C3242",fillRule:"evenodd",d:"M9.3296375 0C9.9537325 0 10.559591 0.22763409 11.049275 0.64610517L16.524572 6.8877459C17.159227 7.8701458 17.157724 9.1012774 16.524572 9.9679575C16.466585 10.047332 14.642725 12.172218 11.052992 16.342619C10.561167 16.768162 9.9500799 17 9.32024 17L2.7737782 17C1.2418628 17 0 15.656855 0 14L0 3C0 1.3431457 1.2418628 0 2.7737782 0L9.3296375 0Z"}),Re.jsx("g",{transform:"translate(1 1)",children:Re.jsx("path",{fill:l,fillRule:"evenodd",d:"M9.3501606 0.36555532C9.0499077 0.12681998 8.6932554 0 8.3296375 0L1.7737782 0C0.81242025 0 0 0.8786791 0 2L0 13C0 14.121321 0.81242025 15 1.7737782 15L8.32024 15C8.6869926 15 9.046587 14.870982 9.3483343 14.628391C12.667263 10.772531 14.686259 8.4202681 14.717096 8.3780565C15.088514 7.8696475 15.099526 7.1182046 14.719635 6.4865627L9.3501606 0.36555532Z"})}),Re.jsx("g",{transform:"translate(4 4)",children:Re.jsx("path",{fill:"#ffffff",d:"M5 0L8.5119295 4.4924536L5 8.9849072L5 9L0 9L0 8.9849072L3.511929 4.4924536L0 0L5 0Z"})})]})}const vC=q2.memo(function({color:a=f1,rotationDeg:h,baseSizePx:y,label:x}){return Re.jsx("div",{"aria-label":`Vehicle ${x}`,style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%"},children:Re.jsx("div",{style:{transform:`rotate(${h}deg)`,transformOrigin:"center center",display:"flex",alignItems:"center",justifyContent:"center"},children:Re.jsx("div",{style:{transform:`rotate(${yC}deg)`,transformOrigin:"center center",display:"flex",alignItems:"center",justifyContent:"center"},children:Re.jsx(_C,{backgroundColor:a,sizePx:y})})})})});class xC{constructor(a){kt(this,"map");this.map=a}setCenter(a){this.map.setCenter([a.lng,a.lat])}setZoom(a){this.map.setZoom(a)}fitBounds(a,h){this.map.fitBounds(a,h)}addMarker(a){const h=new db({element:a.element,anchor:a.anchor||"center"}).setLngLat([a.lngLat.lng,a.lngLat.lat]).addTo(this.map);return new bC(h)}remove(){this.map.remove()}isReady(){return!!this.map}}class bC{constructor(a){kt(this,"marker");this.marker=a}remove(){this.marker.remove()}setLngLat(a){this.marker.setLngLat([a.lng,a.lat])}getLngLat(){const a=this.marker.getLngLat();if(a)return{lng:a.lng,lat:a.lat}}getElement(){return this.marker.getElement()}}function ox(l){const a=we.useRef(new Map),h=x=>
937{if(!l||!l.isReady())return;const T=new Set(a.current.keys()),v=new Set(x.map(s=>s.id));for(const s of T)if(!v.has(s)){const I=a.current.get(s);I==null||I.remove(),a.current.delete(s)}for(const s of x){const I=a.current.get(s.id);if(I)I.setLngLat(s.position),s.zIndex!==void 0&&(s.element.style.zIndex=s.zIndex.toString());else{const L=l.addMarker({element:s.element,lngLat:s.position,anchor:s.anchor});s.zIndex!==void 0&&(s.element.style.zIndex=s.zIndex.toString()),a.current.set(s.id,L)}}},y=()=>{a.current.forEach(x=>x.remove()),a.current.clear()};return we.useEffect(()=>()=>{y()},[]),{markers:a.current,updateMarkers:h,clearMarkers:y,getMarker:x=>a.current.get(x)}}function wC(l,a,h,y){const x=l*Math.PI/180,T=h*Math.PI/180,v=(y-a)*Math.PI/180,s=Math.sin(v)*Math.cos(T),I=Math.cos(x)*Math.sin(T)-Math.sin(x)*Math.cos(T)*Math.cos(v);return(Math.atan2(s,I)*180/Math.PI%360+360)%360}function sx(l,a){let h=Math.abs(l-a)%360;return h>180&&(h=360-h),h}function m1(l){let a=l%360;return a<0&&(a+=360),a}function TC(l){const a=[],h=T=>{Array.isArray(T)&&T.length>=2&&a.push(T)},y=T=>{if(T!=null&&T.type){if(T.type==="LineString")h(T.coordinates);else if(T.type==="MultiLineString"){const v=T.coordinates;if(Array.isArray(v))for(const s of v)h(s)}}},x=l;if(!x)return a;if(x.type==="Feature")y(x.geometry);else if(x.type==="FeatureCollection")for(const T of x.features||[])y(T.geometry);else y(x);return a}function SC(l,a,h,y,x,T){const v=x-h,s=T-y,I=l-h,L=a-y,O=v*v+s*s;if(O<1e-20)return I*I+L*L;let H=(I*v+L*s)/O;H=Math.max(0,Math.min(1,H));const J=h+H*v,ee=y+H*s,ue=l-J,fe=a-ee;return ue*ue+fe*fe}function EC(l,a,h,y){const x=TC(h);let T=1/0,v=0;for(const L of x)for(let O=0;O<L.length-1;O++){const H=L[O],J=L[O+1],ee=SC(l,a,H[0],H[1],J[0],J[1]);ee<T&&(T=ee,v=wC(H[1],H[0],J[1],J[0]))}if(T===1/0)return null;const s=typeof y=="number"&&Number.isFinite(y)?m1(y):null;if(s==null)return v;const I=(v+180)%360;return sx(v,s)<=sx(I,s)?v:I}function PC(l){return typeof l!="number"||Number.isNaN(l)?0:m1(l)}const MC={version:8,sources:{osm:{type:"raster",tiles:["https://a.tile.openstreetmap.org/{z}/{x}/{y}.png","https://b.tile.openstreetmap.org/{z}/{x}/{y}.png","https://c.tile.openstreetmap.org/{z}/{x}/{y}.png"],tileSize:256,attribution:'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'}},layers:[{id:"osm-tiles",type:"raster",source:"osm",minzoom:0,maxzoom:19}]},lx=new Map;function cx(l){return l&1?~(l>>1):l>>1}function IC(l){if(!l||typeof l!="string")return[];const a=lx.get(l);if(a)return a.latlon;let h=0,y=0,x=0;const T=[],v=l.length;for(;h<v;){let I=0,L=0,O;do O=l.charCodeAt(h++)-63,I|=(O&31)<<L,L+=5;while(O>=32);y+=cx(I),I=0,L=0;do O=l.charCodeAt(h++)-63,I|=(O&31)<<L,L+=5;while(O>=32);x+=cx(I),T.push([y/1e5,x/1e5])}const s=T.map(([I,L])=>({latitude:I,longitude:L}));return lx.set(l,{latlon:T,coords:s}),T}function ux(l,a={}){const h=[];for(const y of l){const x=IC(y);x.length>1&&h.push(x.map(([T,v])=>[v,T]))}return{type:"Feature",properties:{...a},geometry:{type:"MultiLineString",coordinates:h}}}function AC(l,a){const h=typeof l=="number"?l:Number(l),y=typeof a=="number"?a:Number(a);return Number.isFinite(h)&&Number.isFinite(y)?h>y:String(l)>String(a)}function CC(l,a){const h=new Map;for(const y of l){const x=String(y.rtpiNumber??"").trim(),T=a&&x!=="",v=T?`rtpi:${x}`:`id:${String(y.id)}`,s=h.get(v);(!T||!s||AC(y.id,s.id))&&h.set(v,y)}return[...h.values()]}function kC(l){const a=l.getLngLat();if(a)try{l.setLngLat(a)}catch{}}function g1(l){requestAnimationFrame(()=>{requestAnimationFrame(()=>{kC(l)})})}function hx(l,a){if(l.current){try{l.current.unmount()}catch{}l.current=null,a.current=null}}const DC=150;function LC(){const l=we.useRef(null),a=we.useRef(null),h=we.useRef(null),y=we.useRef(null),x=we.useRef(null),T=we.useRef(null),v=we.useRef(0),s=we.useRef(null),I=we.useRef(null),L=we.useCallback(()=>{const ue=I.current;ue&&(ue.el.removeEventListener("mouseenter",ue.onEnter),ue.el.removeEventListener("mouseleave",ue.onLeave),I.current=null)},[]),O=we.useCallback(()=>{s.current!=null&&(window.clearTimeout(s.current),s.current=null)},[]),H=we.useCallback(()=>{var ue,fe;O(),L(),hx(a,h),hx(x,T);try{(ue=l.current)==null||ue.remove()}catch{}try{(fe=y.current)==null||fe.remove()}catch{}},[O,L]),J=we.useCallback(()=>{O(),s.current=window.setTimeout(()=>{s.current=null,H()},DC)},[O,H]),ee=we.useCallback(ue=>{L();const fe=()=>
937O(),te=()=>H();ue.addEventListener("mouseenter",fe),ue.addEventListener("mouseleave",te),I.current={el:ue,onEnter:fe,onLeave:te}},[O,L,H]);return we.useMemo(()=>({stopPopupRef:l,stopPopupRootRef:a,stopPopupContainerRef:h,vehiclePopupRef:y,vehiclePopupRootRef:x,vehiclePopupContainerRef:T,pendingOpenTokenRef:v,closeAllPopups:H,cancelDismissSchedule:O,scheduleDismissPopups:J,registerPopupHoverTarget:ee}),[H,O,J,ee])}function RC({lastUpdated:l,prefix:a,...h}){const[y,x]=we.useState(()=>Date.now());we.useEffect(()=>{if(x(Date.now()),l==null)return;const v=window.setInterval(()=>{x(Date.now())},1e3);return()=>window.clearInterval(v)},[l]),new Date().toISOString();let T="";return typeof l=="string"?T=z0(gT(l)):typeof l=="number"?T=z0(l):T="-",Re.jsxs($r,{fontSize:"12px",lineHeight:"14px",...h,children:[a," ",T]})}function zC({vehicle:l,upcomingStops:a,passengerLoad:h,showCapacity:y=!1}){var O,H,J,ee,ue,fe,te,Be,Ae;const x=(H=(O=a==null?void 0:a[0])==null?void 0:O.arrival)==null?void 0:H.route,T=(x==null?void 0:x.color)??"#1976D2",v=(x==null?void 0:x.shortName)??(x==null?void 0:x.name)??"",s=((J=l.name)==null?void 0:J.trim())||String(l.id),I=((fe=(ue=(ee=a==null?void 0:a[0])==null?void 0:ee.arrival)==null?void 0:ue.pattern)==null?void 0:fe.direction)||((Ae=(Be=(te=a==null?void 0:a[0])==null?void 0:te.arrival)==null?void 0:Be.pattern)==null?void 0:Ae.directionType)||"",L=De=>De.trim().length>0;return Re.jsxs(co,{spacing:"9px",align:"left",minW:"280px",children:[Re.jsx(fr,{children:Re.jsxs(ca,{spacing:"8px",justifyContent:"space-between",children:[Re.jsxs($r,{fontSize:"12px",fontWeight:"bold",lineHeight:"14px",children:["Vehicle: ",s]}),v?Re.jsxs(ca,{children:[Re.jsx(fr,{borderRadius:"4px",backgroundColor:T,height:"16px",display:"flex",alignItems:"center",justifyItems:"center",padding:"0 4px",title:(x==null?void 0:x.name)??"",children:Re.jsx($r,{fontSize:"12px",isTruncated:!0,whiteSpace:"nowrap",maxW:"120px",children:v})}),L(I)&&Re.jsx($r,{fontSize:"12px",children:I})]}):null]})}),Re.jsxs(ca,{justifyContent:"space-between",alignItems:"start",children:[Re.jsx(fr,{children:Re.jsx(RC,{prefix:"Location updated:",lastUpdated:l.lastUpdated??void 0})}),y&&Re.jsx(vT,{value:h||0,color:"white"})]}),Re.jsx(fr,{children:Re.jsx($r,{fontSize:"12px",fontWeight:"bold",lineHeight:"14px",children:"Next stops"})}),Re.jsxs(co,{spacing:"4px",width:"100%",children:[(a??[]).map((De,xe)=>{const ye=Rg(De.arrival.secondsToArrival),Se=De.arrival.schedulePrediction,Ie=bx({time:ye,schedulePrediction:Se,showLabel:!0});return Re.jsxs(ca,{spacing:"8px",minH:"16px",align:"stretch",w:"100%",children:[Re.jsx(fr,{backgroundColor:"#6E7581",alignSelf:"start",h:"16px",lineHeight:"16px",rounded:"4px",paddingLeft:"6px",paddingRight:"6px",display:"flex",alignItems:"center",whiteSpace:"nowrap",children:Re.jsx($r,{fontSize:"12px",lineHeight:"14px",children:Ie})}),Re.jsx(co,{spacing:"2px",align:"left",children:Re.jsx($r,{fontSize:"12px",lineHeight:"14px",children:De.stopName??"-"})})]},`${De.stopId}_${xe}`)}),(!a||a.length===0)&&Re.jsx(fr,{textAlign:"left",width:"100%",children:Re.jsx($r,{fontSize:"12px",lineHeight:"14px",opacity:.8,children:"No upcoming stops available"})})]})]})}const li=[0,0],ig=-8,ag=8,FC={center:li,left:li,right:li,top:[li[0],li[1]+ag],"top-left":[li[0],li[1]+ag],"top-right":[li[0],li[1]+ag],bottom:[li[0],li[1]+ig],"bottom-left":[li[0],li[1]+ig],"bottom-right":[li[0],li[1]+ig]},y1={closeButton:!1,closeOnClick:!0,maxWidth:"400px",className:"gmv-map-popup",offset:FC};function OC(l){const{mapRef:a,isClient:h,mapReady:y,coordination:x,latestVehiclesRef:T,showCapacity:v}=l,{vehiclePopupRef:s,vehiclePopupRootRef:I,vehiclePopupContainerRef:L,pendingOpenTokenRef:O,closeAllPopups:H,registerPopupHoverTarget:J}=x,{themeName:ee}=Nc(),ue=we.useRef(ee);ue.current=ee;const fe=we.useRef(v);return fe.current=v,we.useEffect(()=>{!h||!a.current||!y||s.current||(s.current=new fb(y1))},[h,y,a,s]),{openVehiclePopover:we.useCallback(async Be=>{var We,Ut;const{vehicleId:Ae,fallbackVehicle:De,lngLat:xe}=Be,ye=++O.current;if(!a.current||!s.current)return;H();const Se=((We=T.current)==null?void 0:We.get(Ae))??De;if(xe==null||!Number.isFinite(xe.lng)||!Number.isFinite(xe.lat))return;let Ie=[];try{Ie=await K2(Ae)||[]}catch(pt){console.warn("[MapPlaceholder] Failed to fetch vehicle arrivals:",{vehicleId:Ae,err:pt}),Ie=[]}if(O.current!==ye)return;const Ze=document.createElement("div");Ze.classList.add("gmv-map-popup");const Je=Dg.createRoot(Ze);L.current=Ze,I.current=Je;
937const Ve=((Se==null?void 0:Se.passengerLoad)??0)*100,ft=new Map,vt=Ie.slice(0,3);for(const pt of vt){const Ht=Rg(pt.secondsToArrival);if(!Ht)continue;const ar=Date.parse(Ht);if(!Number.isFinite(ar))continue;const mr=String(pt.stop.id),Rt=ft.get(mr);(!Rt||ar<Rt.ts)&&ft.set(mr,{stopId:pt.stop.id,stopName:pt.stop.name??void 0,arrival:pt,ts:ar})}const nt=Array.from(ft.values()).sort((pt,Ht)=>pt.ts-Ht.ts).slice(0,3).map(({stopId:pt,stopName:Ht,arrival:ar})=>({stopId:pt,stopName:Ht,arrival:ar})),ct=ue.current;xx.flushSync(()=>{Je.render(Re.jsx(yT,{defaultTheme:ct,children:Re.jsx(zC,{vehicle:Se,upcomingStops:nt,passengerLoad:Ve,showCapacity:fe.current})},ct))});const Dt=s.current;Dt.setDOMContent(Ze).setLngLat([xe.lng,xe.lat]).addTo(a.current);const Pt=(Ut=Dt.getElement)==null?void 0:Ut.call(Dt);J(Pt instanceof HTMLElement?Pt:Ze),g1(Dt)},[H,T,a,O,J,L,s,I])}}const BC=({arrivalSummary:l})=>{const a=y=>y.trim().length>0,h=l.name??l.shortName??String(l.routeId);return Re.jsxs(ca,{spacing:"8px",minH:"16px",align:"stretch",w:"100%",children:[Re.jsx(fr,{width:"4px",borderRadius:"2px",backgroundColor:l.color}),Re.jsx(co,{spacing:"8px",top:"-2px",position:"relative",align:"left",w:"100%",children:l.directions.map(y=>Re.jsxs(co,{spacing:"2px",align:"left",w:"100%",children:[Re.jsxs(ca,{spacing:"4px",children:[Re.jsx($r,{fontSize:12,fontWeight:"bold",textTransform:"uppercase",children:h}),a(y.directionLabel)&&Re.jsxs($r,{as:"span",fontSize:12,whiteSpace:"nowrap",children:[" | ",y.directionLabel]})]}),y.arrivals.slice(0,2).map(x=>{var s;const T=typeof x.secondsToArrival=="number"?Rg(x.secondsToArrival):null,v=x.schedulePrediction;return Re.jsx(fr,{backgroundColor:"#6E7581",alignSelf:"start",h:"16px",lineHeight:"16px",rounded:"4px",paddingLeft:"6px",paddingRight:"6px",display:"flex",alignItems:"center",children:Re.jsx($r,{fontSize:"12px",lineHeight:"14px",children:bx({time:T,schedulePrediction:v,showLabel:!0})})},`${x.route.id}_${((s=x.vehicle)==null?void 0:s.id)??T??""}`)})]},`${l.routeId}_${y.directionLabel}`))})]})};function NC({stop:l,arrivals:a}){return Re.jsxs(co,{spacing:"8px",align:"left",children:[Re.jsx(fr,{children:Re.jsxs($r,{fontSize:"12px",fontWeight:700,lineHeight:"15px",children:["Stop: ",l.name]})}),(l==null?void 0:l.stopCode)&&Re.jsx(fr,{children:Re.jsxs($r,{fontSize:"12px",fontWeight:500,lineHeight:"15px",children:["Stop #",l.stopCode]})}),Re.jsx(fr,{children:Re.jsx($r,{fontSize:"12px",fontWeight:700,lineHeight:"15px",children:"Served By:"})}),Re.jsx(co,{spacing:"4px",children:a==null?void 0:a.map((h,y)=>Re.jsx(BC,{arrivalSummary:h},`${h.routeId}_${y}`))})]})}function Cc(l){if(l==null)return;const a=String(l).trim();return a.length>0?a:void 0}function Td(...l){return l.find(a=>a!=null)}function jC(l){const a=l.route??{};return{id:Td(a.id,l.routeId),shortName:Cc(Td(a.shortName,l.routeShortName)),name:Cc(Td(a.name,l.routeName)),color:Cc(Td(a.color,l.color))}}function VC(l){var h;const a=l.route??((h=l.pattern)==null?void 0:h.route);return{id:a==null?void 0:a.id,shortName:Cc(a==null?void 0:a.shortName),name:Cc(a==null?void 0:a.name),color:Cc(a==null?void 0:a.color)}}function px(l){let a=Number.POSITIVE_INFINITY;for(const h of l.directions)for(const y of h.arrivals)typeof y.secondsToArrival=="number"&&y.secondsToArrival<a&&(a=y.secondsToArrival);return a}function dx(l,a){if(a.id==null)return null;const h=String(a.id),y=l.get(h);
937if(y)return y.shortName??(y.shortName=a.shortName),y.name??(y.name=a.name),y.color??(y.color=a.color),y;const x={routeId:a.id,shortName:a.shortName,name:a.name,color:a.color,directions:[]};return l.set(h,x),x}function fx(l,a){const h=a.trim().toLocaleLowerCase(),y=l.directions.find(T=>T.directionLabel.trim().toLocaleLowerCase()===h);if(y)return y;const x={directionLabel:a,arrivals:[]};return l.directions.push(x),x}function UC(l){const a=new Map;for(const h of l.patterns??[]){const y=jC(h),x=dx(a,y);x&&fx(x,D0(h))}for(const h of l.arrivals??[]){const y=VC(h),x=dx(a,y);if(!x)continue;fx(x,D0(h.pattern)).arrivals.push(h)}return Array.from(a.values()).map(h=>({...h,directions:h.directions.map(y=>({...y,arrivals:[...y.arrivals].sort((x,T)=>x.secondsToArrival-T.secondsToArrival)})).sort((y,x)=>{var s,I;const T=(s=y.arrivals[0])==null?void 0:s.secondsToArrival,v=(I=x.arrivals[0])==null?void 0:I.secondsToArrival;return T==null&&v==null?0:(T??Number.POSITIVE_INFINITY)-(v??Number.POSITIVE_INFINITY)})})).sort((h,y)=>{const x=px(h),T=px(y);return x===Number.POSITIVE_INFINITY&&T===Number.POSITIVE_INFINITY?0:x-T})}function $C(l){var ee;const{mapRef:a,isClient:h,mapReady:y,coordination:x,configuration:T}=l,{stopPopupRef:v,stopPopupRootRef:s,stopPopupContainerRef:I,pendingOpenTokenRef:L,closeAllPopups:O,registerPopupHoverTarget:H}=x;return we.useEffect(()=>{!h||!a.current||!y||v.current||(v.current=new fb(y1))},[h,y,a,v]),{openStopPopover:we.useCallback(async ue=>{var Ze,Je;const{stop:fe,lng:te,lat:Be}=ue,Ae=++L.current;if(!a.current||!v.current)return;O();let De=null;try{const Ve=!!((Ze=T==null?void 0:T.settings)!=null&&Ze.rtpiNumbersAreUniqueToStop)&&!!fe.rtpiNumber,[ft,vt]=await Promise.allSettled([J2(fe.id),Ve?Q2(fe.rtpiNumber):eT(fe.id)]);ft.status==="rejected"&&console.warn("[MapPlaceholder] Failed to fetch stop patterns for popup:",ft.reason),vt.status==="rejected"&&console.warn("[MapPlaceholder] Failed to fetch stop arrivals for popup:",vt.reason),De=UC({patterns:ft.status==="fulfilled"?ft.value:[],arrivals:vt.status==="fulfilled"?vt.value:[]})}catch(Ve){console.warn("[MapPlaceholder] Failed to prepare stop popup:",Ve)}if(L.current!==Ae)return;const xe=document.createElement("div");xe.classList.add("gmv-map-popup");const ye=Dg.createRoot(xe);I.current=xe,s.current=ye,xx.flushSync(()=>{ye.render(Re.jsx(NC,{stop:fe,arrivals:De}))});const Se=v.current;Se.setDOMContent(xe).setLngLat([te,Be]).addTo(a.current);const Ie=(Je=Se.getElement)==null?void 0:Je.call(Se);H(Ie instanceof HTMLElement?Ie:xe),g1(Se)},[(ee=T==null?void 0:T.settings)==null?void 0:ee.rtpiNumbersAreUniqueToStop,O,a,L,H,I,v,s])}}function qC(l){return l?[l.lng,l.lat]:[139.753,35.6844]}const mx=30;function GC({height:l="100vh",initialCenter:a,selectedRoutes:h,services:y,focusedRoute:x,focusedStopId:T,centerToServiceRegionTrigger:v,centerOnLocationTrigger:s,fitRouteBoundsTrigger:I}){var Ee,q;const{maptilerApiKey:L,configuration:O}=Lg(),H=we.useRef(null),J=we.useRef(null),[ee,ue]=we.useState(null),{updateMarkers:fe,clearMarkers:te,getMarker:Be}=ox(ee),{updateMarkers:Ae,clearMarkers:De,getMarker:xe}=ox(ee),[ye,Se]=we.useState(!1),[Ie,Ze]=we.useState(!1),[Je]=we.useState(12),[Ve,ft]=we.useState(0),vt=we.useRef(new Map);function nt(V,$){vt.current.set(String(V),$),ft(re=>re+1)}const ct=we.useRef(new Set),[Dt,Pt]=we.useState(0),We=we.useRef(new Map),Ut=we.useRef([]),pt=we.useRef(null),Ht=we.useRef(null);we.useEffect(()=>{const V="stop-pulse-animation";if(!document.getElementById(V)){const $=document.createElement("style");$.id=V,$.textContent=`
938                @keyframes stopPulse {
939                    0%, 100% {
940                        transform: scale(1);
941                        opacity: 1;
942                    }
943                    50% {
944                        transform: scale(1.15);
945                        opacity: 0.9;
946                    }
947                }
948            `,document.head.appendChild($)}},[]);function ar(V){return(y??[]).flatMap(re=>re.routes||[]).find(re=>String(re.id)===V)}function mr(V){const $=ar(V);return($==null?void 0:$.color)||"#3366FF"}function Rt(V){const $=ar(V);return($==null?void 0:$.color)||"#000000"}function Xt(V,$){if($&&typeof $=="object"&&$.type&&($.type==="Feature"||$.type==="FeatureCollection"))return $;if(Array.isArray($)){const re=[];for(const se of $){const _e=(se==null?void 0:se.points)||(se==null?void 0:se.path)||(se==null?void 0:se.coordinates)||[],me=[];
948if(Array.isArray(_e)&&_e.length){for(const ne of _e){const be=ne.lat??ne.latitude,je=ne.lon??ne.lng??ne.longitude;typeof be=="number"&&typeof je=="number"&&me.push([je,be])}me.length>1&&re.push({type:"Feature",properties:{id:V},geometry:{type:"LineString",coordinates:me}})}}return{type:"FeatureCollection",features:re}}return{type:"FeatureCollection",features:[]}}function Tt(V){const $=new oh,re=se=>{typeof se[0]=="number"&&typeof se[1]=="number"&&isFinite(se[0])&&isFinite(se[1])&&$.extend(se)};try{if(V.type==="Feature"){const me=V.geometry;if((me==null?void 0:me.type)==="LineString")for(const ne of me.coordinates||[])re(ne);else if((me==null?void 0:me.type)==="MultiLineString")for(const ne of me.coordinates||[])for(const be of ne)re(be)}else if(V.type==="FeatureCollection")for(const me of V.features||[]){const ne=me.geometry;if((ne==null?void 0:ne.type)==="LineString")for(const be of ne.coordinates||[])re(be);else if((ne==null?void 0:ne.type)==="MultiLineString")for(const be of ne.coordinates||[])for(const je of be)re(je)}
948const se=$.getSouthWest(),_e=$.getNorthEast();return se&&_e&&(se.lng!==_e.lng||se.lat!==_e.lat)?$:null}catch{return null}}function Yt(V,$){try{const re=$,se=new oh(re.getSouthWest(),re.getNorthEast());for(const _e of Ut.current){if(String(_e)===String(V))continue;const me=vt.current.get(String(_e));if(!me)continue;const ne=Tt(me);if(!ne)continue;const be=ne;se.extend(be.getSouthWest()),se.extend(be.getNorthEast())}return se}catch{return null}}function pr(){if(J.current&&h&&!T){if(h.length===0){J.current.flyTo({center:[a.lng,a.lat],zoom:12,duration:1500});return}try{const V=new oh;for(const $ of h){const re=vt.current.get($);if(re){const se=Tt(re);se&&V.extend(se)}}try{J.current.fitBounds(V,{padding:100,duration:1200})}catch{try{const $=V.getCenter();J.current.flyTo({center:$,zoom:13,duration:1200})}catch{}}}catch{}}}function $t(V){if(T)return;const $=V;pt.current?(pt.current.extend($.getSouthWest()),pt.current.extend($.getNorthEast())):pt.current=new oh($.getSouthWest(),$.getNorthEast()),Ht.current&&clearTimeout(Ht.current),Ht.current=setTimeout(()=>{if(J.current&&pt.current){try{J.current.fitBounds(pt.current,{padding:60,duration:1200})}catch{try{const se=pt.current.getCenter();J.current.flyTo({center:se,zoom:13,duration:1200})}catch{}}pt.current=null}},500)}we.useEffect(()=>{Se(!0)},[]);const en=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");we.useEffect(()=>{if(ye&&typeof window<"u"){if(Pn.session=!0,!en&&!L)return;L&&(Pn.apiKey=L)}},[ye,en,L]),we.useEffect(()=>{if(!ye||J.current||!H.current)return;const V=setTimeout(()=>{if(H.current)try{const re=en?MC:`https://api.maptiler.com/maps/081934ab-2c1a-4b26-87d5-49302acdf958/style.json?key=${L}`;J.current=new c1({container:H.current,style:re,center:qC(a),zoom:Je,navigationControl:!1,geolocateControl:!1,pitchWithRotate:!1,touchPitch:!1}),J.current.addControl(new mb,"top-right");const se=new gb({positionOptions:{enableHighAccuracy:!0,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!0,showAccuracyCircle:!0,showUserLocation:!0});se.on("geolocate",_e=>{const me=_e.coords;me&&xT({lat:me.latitude,lng:me.longitude})}),J.current.addControl(se,"top-right"),ue(new xC(J.current)),J.current.on("load",()=>{Ze(!0)})}catch{}},100);return()=>{clearTimeout(V)}},[ye,en,a,Je,L]),we.useEffect(()=>{!ye||!J.current||!Ie||!v||J.current.flyTo({center:[a.lng,a.lat],zoom:12,duration:1500})},[ye,Ie,v]),we.useEffect(()=>{!ye||!J.current||!Ie||!s||J.current.flyTo({center:[s.lng,s.lat],zoom:s.zoom,duration:1500})},[ye,Ie,s==null?void 0:s.key]),we.useEffect(()=>{if(!ye||!J.current||!Ie||!x||T||I!==void 0&&(!I||I===0))return;(async()=>{try{let $=vt.current.get(String(x));if(!$){const me=(await L0(Number(x))||[]).filter(ne=>ne&&typeof ne.shape=="string"&&ne.shape.length>0).map(ne=>ne.shape);$=ux(me,{routeId:x}),nt(x,$)}if(!($!=null&&$.geometry))return;const re=new oh;let se=!1;$.geometry.type==="MultiLineString"&&Array.isArray($.geometry.coordinates)?$.geometry.coordinates.forEach(_e=>{_e.forEach(me=>{re.extend(me),se=!0})}):$.geometry.type==="LineString"&&Array.isArray($.geometry.coordinates)&&$.geometry.coordinates.forEach(_e=>{re.extend(_e),se=!0}),se&&J.current&&J.current.fitBounds(re,{padding:{top:100,bottom:100,left:100,right:100},duration:1500})}catch{}})()},[ye,Ie,x,T,I]);function an(V){return V.color||(V.routeId?mr(String(V.routeId)):"#1976D2")}function kn(V){var re;const $=(re=V.name)==null?void 0:re.trim();return $||String(V.id)}const jt=we.useRef(null),Lr=we.useRef(new Map),ur=we.useRef(new Map),qr=we.useRef(new Map),or=LC(),{cancelDismissSchedule:Kt,scheduleDismissPopups:fn}=or,{openVehiclePopover:ti}=OC({mapRef:J,isClient:ye,mapReady:Ie,coordination:or,latestVehiclesRef:qr,showCapacity:(Ee=O==null?void 0:O.settings)==null?void 0:Ee.showCapacity}),{openStopPopover:yn}=$C({mapRef:J,isClient:ye,mapReady:Ie,coordination:or,configuration:O});function In(V){const $=V.routeId!=null?String(V.routeId):"";if($){const re=vt.current.get($);if(re){const se=EC(V.lon,V.lat,re,V.headingDegrees);if(se!=null)return se}}return PC(V.headingDegrees)}const{vehicleGroup:_n,stopArrivals:hi}=d1();we.useEffect(()=>{if(!ye||!J.current||!Ie||!ee)return;const V=Pe=>Pe.map(Ye=>
948Ye.vehicle).filter(Boolean),$=[];for(const Pe of _n||[])Pe&&!kg(Pe.lastUpdated)&&$.push(Pe);for(const Pe of V(hi||[]))Pe&&!kg(Pe.lastUpdated)&&$.push(Pe);const re=new Map;for(const Pe of $)re.set(Pe.id,Pe);const se=new Set(h||[]),_e=[];re.forEach(Pe=>{Pe.routeId&&se.has(String(Pe.routeId))&&_e.push(Pe)}),qr.current=new Map(_e.map(Pe=>[Pe.id,Pe]));const me=ur.current,ne=20,be=_e.map(Pe=>{const Ye=an(Pe),it=In(Pe),rt=Pe.id,At=kn(Pe);let St;const Te=xe(rt),Et=Lt=>{Lt.style.width=`${mx}px`,Lt.style.height=`${mx}px`,Lt.style.overflow="visible",Lt.style.display="flex",Lt.style.alignItems="center",Lt.style.justifyContent="center",Lt.style.pointerEvents="auto",Lt.style.zIndex="10";let yt=me.get(rt);yt||(yt=Dg.createRoot(Lt),me.set(rt,yt)),yt.render(Re.jsx(vC,{color:Ye,rotationDeg:it,baseSizePx:ne,label:At}))};return Te?(St=Te.getElement(),Et(St)):(St=document.createElement("div"),St.style.cursor="pointer",Et(St),St.addEventListener("mouseenter",()=>{var yt;Kt();const Lt=((yt=xe(rt))==null?void 0:yt.getLngLat())??{lng:Pe.lon,lat:Pe.lat};ti({vehicleId:rt,fallbackVehicle:Pe,lngLat:Lt})}),St.addEventListener("mouseleave",fn)),{id:rt,position:{lat:Pe.lat,lng:Pe.lon},element:St,zIndex:10}});Ae(be);const je=new Set(be.map(Pe=>Pe.id));return me.forEach((Pe,Ye)=>{je.has(Ye)||queueMicrotask(()=>{Pe.unmount(),me.delete(Ye)})}),()=>{}},[ye,Ie,ee,Ve,JSON.stringify(h??[]),JSON.stringify((_n||[]).map(V=>({id:V.id,lat:V.lat,lon:V.lon,h:V.headingDegrees,nm:V.name}))),JSON.stringify((hi||[]).map(V=>V.vehicle?{id:V.vehicle.id,lat:V.vehicle.lat,lon:V.vehicle.lon,h:V.vehicle.headingDegrees,nm:V.vehicle.name}:null)),h]),we.useEffect(()=>{if(!ye||!J.current||!Ie||!ee)return;const $=(h||[]).map(_e=>String(_e)).filter(_e=>ct.current.has(_e));if($.length===0){te(),Lr.current.clear();return}let re=!1;return(async()=>{var _e;try{const me=new Map,ne=await Promise.allSettled($.map(async rt=>{const At=Rt(rt),St=We.current.get(rt),Te=St||await R0(Number(rt))||[];We.current.set(rt,Te);const Et=new Set;return Te.forEach(Lt=>{const yt=String(Lt.id);if(Et.has(yt))return;Et.add(yt),me.get(yt)===void 0?me.set(yt,At):me.set(yt,null)}),Te})),be=ne.map((rt,At)=>rt.status==="fulfilled"?rt.value:($[At],rt.reason,[]));if(re)return;ne.forEach((rt,At)=>{rt.status==="fulfilled"&&F0($[At],rt.value)});const je=be.flat(),Pe=!!((_e=O==null?void 0:O.settings)!=null&&_e.rtpiNumbersAreUniqueToStop),Ye=CC(je,Pe);Lr.current.clear(),Ye.forEach(rt=>{Lr.current.set(String(rt.id),rt.name)});const it=Ye.map(rt=>{const At=rt.lon??rt.lng,St=rt.lat;if(!At||!St)return null;const Te=me.get(String(rt.id)),Et=document.createElement("div");return Et.style.width="10px",Et.style.height="10px",Te===null?Et.innerHTML=`
949                <svg xmlns="http://www.w3.org/2000/svg"
950                    width="10"
951                    height="10"
952                    viewBox="0 0 1 1">
953                  <circle
954                    cx="0.5"
955                    cy="0.5"
956                    r="0.5"
957                    fill="#000000"
958                  />
959                  <circle
960                    cx="0.5"
961                    cy="0.5"
962                    r="0.125"
963                    fill="#ffffff"
964                  />
965                </svg>
966              `:Et.style.backgroundColor=Te??"#000000",Et.style.border="none",Et.style.borderRadius="50%",Et.style.boxShadow="none",Et.style.pointerEvents="auto",Et.style.cursor="pointer",Et.style.zIndex="1",Et.addEventListener("mouseenter",()=>{Kt(),yn({stop:rt,lng:At,lat:St})}),Et.addEventListener("mouseleave",fn),{id:rt.id,position:{lat:St,lng:At},element:Et}}).filter(Boolean);fe(it)}catch{}})(),()=>{re=!0,te()}},[ye,Ie,h&&h.join(","),Dt,x,ee,fe,(q=O==null?void 0:O.settings)==null?void 0:q.rtpiNumbersAreUniqueToStop]);const On=we.useRef(null);we.useEffect(()=>{if(!ye||!J.current||!Ie||(On.current&&(On.current.remove(),On.current=null),!T))return;let $=Be(T)||null;if(!$){const me=typeof T=="string"?Number(T):String(T);$=Be(me)||null}if(!$)return;const re=$.getLngLat();if(!re)return;const se="#3366FF",_e=()=>{if(!J.current)return;const me=document.createElement("div");me.style.width="28px",me.style.height="28px",me.style.backgroundColor=se,me.style.border="4px solid white",me.style.borderRadius="50%",me.style.boxShadow="0 0 0 4px rgba(255, 255, 255, 0.5), 0 4px 8px rgba(0,0,0,0.5)",me.style.pointerEvents="none",me.style.zIndex="1000",me.style.animation="stopPulse 2s ease-in-out infinite";const ne=new db({element:me,anchor:"center"}).setLngLat([re.lng,re.lat]).addTo(J.current);On.current=ne};return J.current.once("idle",_e),()=>{J.current&&J.current.off("idle",_e)}},[ye,Ie,T]),we.useEffect(()=>()=>{var V,$;De(),te(),ur.current.forEach(re=>{try{re.unmount()}catch{}}),ur.current.clear();try{(V=or.stopPopupRef.current)==null||V.remove()}catch{}or.stopPopupRef.current=null;try{($=or.vehiclePopupRef.current)==null||$.remove()}catch{}if(or.vehiclePopupRef.current=null,or.stopPopupRootRef.current){try{or.stopPopupRootRef.current.unmount()}catch{}or.stopPopupRootRef.current=null,or.stopPopupContainerRef.current=null}if(or.vehiclePopupRootRef.current){try{or.vehiclePopupRootRef.current.unmount()}catch{}or.vehiclePopupRootRef.current=null,or.vehiclePopupContainerRef.current=null}if(jt.current){try{jt.current.marker.remove()}catch{}jt.current=null}},[]),we.useEffect(()=>()=>{Ht.current&&clearTimeout(Ht.current)},[]);const on=we.useRef(null);return we.useEffect(()=>{const V=x??null;V!==on.current&&(Ut.current=[],pt.current=null,Ht.current&&clearTimeout(Ht.current),on.current=V)},[x]),we.useEffect(()=>{if(!ye||!J.current||!Ie)return;if(!h||h.length===0){const ne=ct.current.size>0;ct.current.forEach(be=>{const je=`route-layer-${be}`,Pe=`route-source-${be}`;J.current.getLayer(je)&&J.current.removeLayer(je),J.current.getSource(Pe)&&J.current.removeSource(Pe)}),ct.current.clear(),ne&&Pt(be=>be+1),Ut.current=[],pr();return}const V=new Set(Ut.current),$=h.filter(ne=>!V.has(ne)),re=$.length>0;re&&(pt.current=null,Ht.current&&clearTimeout(Ht.current));const se=new Set(h);let _e=!1;ct.current.forEach(ne=>{if(!se.has(ne)){_e=!0;const be=`route-layer-${ne}`,je=`route-source-${ne}`;J.current.getLayer(be)&&J.current.removeLayer(be),J.current.getSource(je)&&J.current.removeSource(je),ct.current.delete(ne)}}),_e&&Pt(ne=>ne+1),_e&&pr();const me=(ne,be)=>{const je=`route-source-${ne}`,Pe=`route-layer-${ne}`,Ye=ct.current.has(ne),it=J.current.getSource(je);it?it.setData(be):J.current.addSource(je,{type:"geojson",data:be}),J.current.getLayer(Pe)||J.current.addLayer({id:Pe,type:"line",source:je,paint:{"line-color":mr(ne),"line-width":3,"line-opacity":.9},layout:{"line-join":"round","line-cap":"round"}}),ct.current.add(ne),Ye||Pt(rt=>rt+1)};se.forEach(async ne=>{const be=ct.current.has(ne),je=vt.current.has(ne);if(be&&je){if(re&&$.includes(ne)||x&&String(ne)===String(x)){const Ye=vt.current.get(String(ne));if(Ye){const it=Tt(Ye);it&&(re&&$.length,(re&&$.length>1||!x)&&$.includes(ne)&&$t(it))}}return}const Pe=vt.current.get(String(ne));if(Pe){me(ne,Pe);const Ye=Tt(Pe);if(Ye){const it=re&&$.length===1,rt=re&&$.length>1;if(it&&!x){const At=Yt(ne,Ye);At&&$t(At)}(rt||!x)&&$.includes(ne)&&$t(Ye)}return}try{const it=(await L0(ne)||[]).filter(Lt=>Lt&&typeof Lt.shape=="string"&&Lt.shape.length>0).map(Lt=>Lt.shape),rt=ux(it,{routeId:ne});if(Array.isArray(rt.geometry.coordinates)&&rt.geometry.coordinates.length>0){nt(ne,rt),me(ne,rt);const Lt=Tt(rt);
966if(Lt){const yt=re&&$.length===1,tr=re&&$.length>1;if(yt&&!x){const sn=Yt(ne,Lt);sn&&$t(sn)}(tr||!x)&&$.includes(ne)&&$t(Lt)}return}const St=await tT(ne),Te=Xt(ne,St);nt(ne,Te),me(ne,Te);const Et=Tt(Te);if(Et){const Lt=re&&$.length===1,yt=re&&$.length>1;if(Lt&&!x){const tr=Yt(ne,Et);tr&&$t(tr)}(yt||!x)&&$.includes(ne)&&$t(Et)}}catch{try{const Ye=Number(ne),it=await R0(Ye);if(F0(ne,it||[]),it&&it.length>1){const At={type:"Feature",geometry:{type:"LineString",coordinates:it.map(Te=>[Te.lon,Te.lat])},properties:{id:ne}};nt(ne,At),me(ne,At);const St=Tt(At);if(St){const Te=re&&$.length===1,Et=re&&$.length>1;if(Te&&!x){const Lt=Yt(ne,St);Lt&&$t(Lt)}(Et||!x)&&$.includes(ne)&&$t(St)}}}catch{}}}),Ut.current=h},[ye,Ie,y,h&&h.join(",")]),ye?Re.jsx(fr,{ref:H,position:"relative",height:l,width:"100%",minHeight:"400px",bg:Ie?"transparent":"gray.200",overflow:"hidden",children:!Ie&&Re.jsx(fr,{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",color:"gray.500",children:"Initializing map..."})}):Re.jsx(fr,{position:"relative",height:l,width:"100%",minHeight:"400px",bg:"gray.200",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center",children:Re.jsx(fr,{color:"gray.500",children:"Loading map..."})})}function ZC({title:l,message:a,errorCode:h,onRetry:y,details:x}){const{theme:T}=Nc();return Re.jsx(fr,{bg:T.colors.status.error.bg,border:"2px solid",borderColor:T.colors.status.error.border,borderRadius:T.radii.md,p:4,mb:4,children:Re.jsxs(co,{align:"stretch",spacing:3,children:[Re.jsxs(ca,{spacing:2,children:[Re.jsx(Rd,{as:iT,color:T.colors.status.error.icon,boxSize:5}),Re.jsx($r,{fontSize:"md",fontWeight:"bold",color:T.colors.status.error.text,children:l})]}),Re.jsx($r,{fontSize:"sm",color:T.colors.status.error.text,children:a}),h&&Re.jsxs(fr,{children:[Re.jsx($r,{fontSize:"xs",color:T.colors.text.secondary,mb:1,children:"Error Code:"}),Re.jsx(lg,{colorScheme:"red",fontSize:"xs",p:2,borderRadius:T.radii.md,children:h})]}),x&&Re.jsxs(fr,{children:[Re.jsx($r,{fontSize:"xs",color:T.colors.text.secondary,mb:1,children:"Details:"}),Re.jsx(lg,{colorScheme:"red",fontSize:"xs",p:2,borderRadius:T.radii.md,whiteSpace:"pre-wrap",children:x})]}),y&&Re.jsx(TT,{size:"sm",leftIcon:Re.jsx(Rd,{as:aT}),colorScheme:"red",variant:"outline",onClick:y,mt:2,children:"Retry"})]})})}function WC(l){const a=l.length>1&&l.endsWith("/")?l.slice(0,-1):l,h=a.match(/^\/route\/([^/]+)\/direction\/([^/]+)\/stop\/([^/]+)\/arrivals$/);if(h)return`/route/${h[1]}/direction/${h[2]}`;const y=a.match(/^\/route\/([^/]+)\/direction\/([^/]+)$/);return y?`/route/${y[1]}`:a.match(/^\/route\/([^/]+)$/)?"/":null}function HC(l){var h;return[...((h=l==null?void 0:l.information)==null?void 0:h.infoLinks)??[]].sort((y,x)=>(y.order??0)-(x.order??0))}function gx({label:l,isActive:a=!1,onClick:h,mb:y=2,ariaLabel:x}){var s;const{theme:T}=Nc(),v=(s=T.components.menu)==null?void 0:s.item;return Re.jsx(Zg,{onClick:h,"aria-label":x??l,"aria-current":a?"page":void 0,w:(v==null?void 0:v.width)||"194px",minH:(v==null?void 0:v.height)||"32px",borderRadius:(v==null?void 0:v.borderRadius)||T.radii.sm,bg:a?T.colors.background.surfaceHover:v==null?void 0:v.backgroundColor,color:v==null?void 0:v.color,fontFamily:(v==null?void 0:v.fontFamily)||T.typography.fontFamily.heading,fontSize:(v==null?void 0:v.fontSize)||T.typography.fontSize.md,fontWeight:(v==null?void 0:v.fontWeight)||T.typography.fontWeight.bold,lineHeight:T.typography.lineHeight.tight,_hover:{bg:T.colors.background.surfaceHover},mb:y,children:l})}function XC({isMobile:l=!1,hideHeader:a=!1,onHomePageChange:h}){var We,Ut,pt,Ht,ar,mr,Rt,Xt,Tt,Yt,pr,$t,en,an,kn,jt,Lr,ur,qr,or;const{currentEnvironment:y}=Wd(),x=Lg(),T=vx(),{theme:v}=Nc(),s=G2(),I=_x();(We=y.customer)!=null&&We.displayName;const{alerts:L,messages:O,stops:H,services:J,selectedRoutes:ee,configuration:ue,isLoading:fe,error:te,isRefetching:Be,onRouteToggle:Ae,onBulkRouteToggle:De,onRetry:xe,onRefresh:ye}=x,{setFocusedRoute:Se,setFocusedStop:Ie,centerToServiceRegion:Ze,centerOnLocation:Je}=T,Ve=((Ut=ue==null?void 0:ue.theme)==null?void 0:Ut.title)??"",ft=I.pathname==="/";we.useEffect(()=>{h==null||h(ft)},[ft,h]);const vt=Kt=>
966{const fn=Kt.replace("#",""),ti=parseInt(fn.substr(0,2),16),yn=parseInt(fn.substr(2,2),16),In=parseInt(fn.substr(4,2),16);return(.299*ti+.587*yn+.114*In)/255>.5?"#2D3748":"#FFFFFF"},nt=((pt=ue==null?void 0:ue.theme)==null?void 0:pt.secondaryColor)||"white",ct=(Ht=ue==null?void 0:ue.theme)!=null&&Ht.secondaryColor?vt(ue.theme.secondaryColor):"gray.600",[Dt,Pt]=we.useState({});return Re.jsxs(fr,{display:"flex",flexDirection:"column",height:"100%",bg:v.colors.components.sidebar.bg,color:v.colors.text.primary,children:[Re.jsx(fr,{borderBottom:"1px solid",borderColor:v.colors.border.default,flexShrink:0,display:a?"none":"",children:Re.jsxs(ca,{align:"center",spacing:2,p:3,bg:nt,children:[Re.jsx(ca,{spacing:2,minW:"36px",justify:"flex-start",children:Dt.showBack&&Re.jsx(og,{"aria-label":"Go back",icon:((ar=v.components.navigation)==null?void 0:ar.backIconType)==="chevron"?Re.jsx(oT,{}):Re.jsx(sT,{}),variant:"ghost",color:ct,size:((mr=v.components.navigation)==null?void 0:mr.backIconSize)||"sm",onClick:()=>{const Kt=WC(I.pathname);if(Kt!==null){s(Kt);return}window.history.length>1?window.history.back():s("/")},_hover:{bg:(Rt=ue==null?void 0:ue.theme)!=null&&Rt.secondaryColor?"whiteAlpha.200":"gray.100"}})}),Re.jsx(fr,{type:"button",as:"button","aria-label":"Home",flex:"1",textAlign:"center",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",onClick:()=>{s("/"),Ze()},_hover:{opacity:.8},transition:"opacity 0.2s",children:(Xt=ue==null?void 0:ue.theme)!=null&&Xt.logo?Re.jsx(Lx,{src:ue.theme.logo,alt:Ve,title:Ve,maxH:"40px",maxW:"100%",objectFit:"contain",fallback:Re.jsx($r,{fontSize:l?"md":"lg",fontWeight:"bold",color:ct,noOfLines:1,children:Ve})},`${(Tt=y.customer)==null?void 0:Tt.customerId}-${ue.theme.logo}`):Re.jsx($r,{fontSize:l?"md":"lg",fontWeight:"bold",color:ct,noOfLines:1,children:Ve})}),Re.jsx(ca,{spacing:2,minW:"36px",justify:"flex-end",children:Re.jsxs(qg,{children:[Re.jsx(Gg,{as:og,"aria-label":"Options",icon:((Yt=v.components.menu)==null?void 0:Yt.iconType)==="hamburger"?Re.jsx(lT,{}):Re.jsx(cT,{}),variant:"ghost",color:ct,size:((pr=v.components.navigation)==null?void 0:pr.menuIconSize)||"sm",display:"flex",_hover:{bg:($t=ue==null?void 0:ue.theme)!=null&&$t.secondaryColor?"whiteAlpha.200":"gray.100"},_active:{bg:(en=ue==null?void 0:ue.theme)!=null&&en.secondaryColor?"whiteAlpha.200":"gray.100"}}),Re.jsxs(Wg,{w:((an=v.components.menu)==null?void 0:an.width)||"224px",h:(kn=v.components.menu)==null?void 0:kn.height,boxShadow:((jt=v.components.menu)==null?void 0:jt.shadow)||v.shadows.md,borderRadius:((Lr=v.components.menu)==null?void 0:Lr.borderRadius)||v.radii.md,bg:((ur=v.components.menu)==null?void 0:ur.backgroundColor)||v.colors.background.surface,p:3,minW:((qr=v.components.menu)==null?void 0:qr.width)||"224px",children:[Re.jsx(gx,{label:"Alerts",ariaLabel:"Alerts",isActive:I.pathname==="/announcements",onClick:()=>s("/announcements")}),HC(ue).map((Kt,fn)=>Re.jsx(gx,{label:Kt.title,ariaLabel:`${Kt.title} (opens in new tab)`,onClick:()=>window.open(Kt.url,"_blank")},fn))]})]})})]})}),Re.jsxs(fr,{position:"relative",flex:1,overflow:"hidden",children:[Be&&Re.jsxs(fr,{position:"absolute",top:0,left:0,right:0,bottom:0,bg:v.colors.background.overlay,zIndex:100,display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",gap:4,children:[Re.jsx(IT,{size:"xl",color:v.colors.components.loading.spinner,thickness:"4px"}),Re.jsx($r,{color:v.colors.components.loading.text,fontSize:"lg",fontWeight:"medium",children:"Refreshing data..."})]}),Re.jsx(fr,{position:"absolute",top:0,left:0,right:0,bottom:0,overflowY:"auto",overflowX:"hidden",children:Re.jsx(fr,{p:l?4:6,pb:l?24:6,w:"100%",children:Re.jsxs(co,{spacing:l?4:6,align:"stretch",w:"100%",children:[fe&&!te&&Re.jsx(ST,{accessibilityText:`Loading ${y.displayName} data...`}),te&&!fe&&Re.jsx(ZC,{title:"Failed to Load Transit Data",message:te instanceof Om?te.message:`Unable to fetch data for ${y.displayName}. Please check your connection and try again.`,errorCode:te instanceof Om&&te.statusCode?`HTTP ${te.statusCode}`:"FETCH_ERROR",details:te instanceof Om?`Customer: ${((or=y.customer)==null?void 0:or.name)||"Unknown"}
967Environment: ${y.type}`:te.message,onRetry:xe}),Re.jsx(Z2,{context:{setNavConfig:Pt,isMobile:l}})]})})})]})]})}function YC(l,a,h){var s,I;const{hideSidebar:y=!1,hideMap:x=!1,fullScreen:T=!1}=h,v={bg:a.colors.components.sidebar.bg,color:a.colors.text.primary,flexShrink:0};return l?{...v,height:T?"100%":"50%",borderTopRadius:T?0:((s=a.components.bottomSheet)==null?void 0:s.borderRadius)??"xl",boxShadow:((I=a.components.bottomSheet)==null?void 0:I.shadow)??"0 -4px 20px rgba(0, 0, 0, 0.15)",overflowY:"auto",overflowX:"hidden",
967w:"100%",position:"relative",sx:{WebkitOverflowScrolling:"touch",touchAction:"pan-y",paddingBottom:"max(env(safe-area-inset-bottom), 16px)","&::-webkit-scrollbar":{width:"4px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:a.colors.border.default,borderRadius:"full"}}}:{...v,flex:x?1:0,w:a.components.sidebar.width.desktop,minW:a.components.sidebar.width.desktop,h:"100vh",display:y?"none":"flex",flexDirection:"column",borderLeft:"1px solid",borderColor:a.colors.components.sidebar.border,boxShadow:a.components.sidebar.shadow||"none"}}function KC({isMobile:l,hideSidebar:a=!1,hideMap:h=!1,fullScreen:y=!1,onHomePageChange:x}){const{theme:T}=Nc();return Re.jsx(fr,{...YC(l,T,{hideSidebar:a,hideMap:h,fullScreen:y}),children:Re.jsx(XC,{isMobile:l,onHomePageChange:x,hideHeader:h})})}function JC(){const{isDevelopment:l}=Wd(),{theme:a,themeName:h,setThemeName:y}=Nc(),x=_T(),T=Bm("white","gray.800"),v=Bm("gray.800","white"),s=Bm("gray.100","gray.700");return l?Re.jsxs(qg,{closeOnSelect:!1,children:[Re.jsx(Wx,{label:"Debug Menu",placement:"right",hasArrow:!0,children:Re.jsx(Gg,{as:og,"aria-label":"Debug menu",icon:Re.jsx(uT,{}),variant:"solid",size:"md",colorScheme:"red",_hover:{bg:"red.600"},boxShadow:"md"})}),Re.jsxs(Wg,{bg:T,color:v,borderColor:"red.500",borderWidth:"2px",boxShadow:"lg",minW:"280px",py:0,children:[Re.jsx(fr,{px:4,py:3,borderBottom:"3px solid",borderColor:"red.500",display:"flex",alignItems:"center",justifyContent:"center",minH:"48px",children:Re.jsx($r,{fontSize:"sm",fontWeight:"bold",color:"red.500",lineHeight:"1",children:"DEBUG MENU"})}),Re.jsxs(fr,{px:4,py:3,children:[Re.jsxs(ca,{spacing:2,children:[Re.jsx(Rd,{as:hT,color:"gray.500",boxSize:3}),Re.jsx($r,{fontSize:"xs",fontWeight:"bold",color:"gray.500",children:"THEME"})]}),Re.jsxs($r,{fontSize:"xs",color:"gray.600",mt:1,children:["Current: ",a.displayName]})]}),x.map(I=>Re.jsxs(Zg,{onClick:()=>y(I.name),_hover:{bg:s},display:"flex",justifyContent:"space-between",alignItems:"center",children:[Re.jsx($r,{fontSize:"sm",children:I.displayName}),h===I.name&&Re.jsx(Rd,{as:pT,color:"gray.600",boxSize:3})]},I.name)),Re.jsx(fr,{pb:2})]})]}):null}function QC(){const[l,a]=we.useState(!1);return we.useEffect(()=>{if(typeof window>"u")return;const h=window.matchMedia("(max-width: 61.99em)");a(h.matches);const y=x=>{a(x.matches)};return h.addEventListener("change",y),()=>{h.removeEventListener("change",y)}},[]),l}const e5=["/","/announcements","/info"];function t5(l){return e5.includes(l)}const r5={lat:39.8333,lng:-98.5833};function n5(){var vt;const{currentEnvironment:l}=Wd(),{services:a,selectedRoutes:h,configuration:y,onBulkRouteToggle:x}=Lg(),{focusedRoute:T,focusedStopId:v,centerToServiceRegionTrigger:s,centerOnLocationTrigger:I}=vx(),L=QC();wx();const O=_x(),[H,J]=we.useState(!0),[ee]=W2(),ue=t5(O.pathname),fe=y!=null&&y.settings&&typeof y.settings.homeLatitude=="number"&&typeof y.settings.homeLongitude=="number"?{lat:y.settings.homeLatitude,lng:y.settings.homeLongitude}:r5,te=we.useRef(!1);we.useEffect(()=>{y!=null&&y.settings&&typeof y.settings.homeLatitude=="number"&&typeof y.settings.homeLongitude=="number"&&!te.current&&(te.current=!0)},[y==null?void 0:y.settings]);const Be=O.pathname==="/announcements",Ae=Be?ee.get("route"):null,De=Ae?Ae.split(",").map(nt=>nt.trim()).filter(Boolean):[],xe=De.length===1?De[0]:null,ye=xe??T,Se=ye?a.map(nt=>{var ct;return{...nt,routes:((ct=nt.routes)==null?void 0:ct.filter(Dt=>String(Dt.id)===String(ye)))||[]}}).filter(nt=>nt.routes.length>0):a,Ie=ye?[ye]:h,Ze=Array.from(ee.keys()).find(nt=>nt.toLowerCase()==="showheader"),Je=Ze!=null&&ee.get(Ze)=="0",Ve=Je&&!Be,ft=Je&&Be;return we.useEffect(()=>{if(!Ve||!x||a.length===0)return;const nt=ee.get("route"),ct=nt?nt.split(",").map(We=>We.trim()).filter(Boolean):null,Dt=ct&&ct.length>0?ct.map(String):a.flatMap(We=>We.routes||[]).map(We=>String(We.id));if(Dt.length===0)return;Dt.every(We=>h.includes(String(We)))||x(Dt)},[Ve,a,ee,x,h]),Re.jsxs(PT,{h:"100dvh",overflow:"hidden",direction:L?"column":"row",position:"relative",children:[(!L||!ue||Ve)&&Re.jsxs(fr,{flex:L?"none":"1",position:"relative",height:L?Ve?"100%":"50%":"100dvh",width:"100%",overflow:"hidden",display:ft?"none":"",flexShrink:0,tabIndex:5e3,children:[Re.jsx(GC,{height:"100%",initialCenter:fe,selectedRoutes:Ie,services:Se,focu
967sedRoute:ye??void 0,focusedStopId:xe?void 0:v??void 0,centerToServiceRegionTrigger:s,fitRouteBoundsTrigger:xe?1:void 0,centerOnLocationTrigger:I},`${l.type}-${((vt=l.customer)==null?void 0:vt.customerId)||"default"}`),Re.jsx(fr,{position:"absolute",top:0,left:0,right:0,zIndex:10,children:Re.jsx(JC,{})})]}),(!L||!Ve)&&Re.jsx(KC,{isMobile:L,hideSidebar:Ve,hideMap:ft,fullScreen:ue,onHomePageChange:J})]})}function i5(l,a={}){const{dispatch:h}=d1(),y=we.useRef(null),{intervalMs:x=4e3}=a;we.useEffect(()=>{if(!l||l.length===0){h({type:"get_vehicles",payload:[]});return}const T=async()=>{try{const v=l.map(O=>rT(O)),L=(await Promise.allSettled(v)).flatMap(O=>O.status==="fulfilled"?O.value:[]).filter(O=>!kg(O.lastUpdated));h({type:"get_vehicles",payload:L})}catch(v){console.warn("[useRouteVehiclesPolling] Polling error",v)}};return T(),y.current=window.setInterval(T,x),()=>{y.current&&(window.clearInterval(y.current),y.current=null)}},[JSON.stringify(l),a.intervalMs])}function a5({selectedRoutes:l,focusedRoute:a}){return i5(a?[a]:l,{intervalMs:3e4}),null}const Sk=H2(function(){const{isDevelopment:a}=Wd(),h=wx(),y=X2(),x=Y2(),T=we.useMemo(()=>dT(y.messages??[]),[y.messages]),v=we.useMemo(()=>{const nt=new Date;return T.filter(ct=>{const Dt=new Date(ct.start),Pt=new Date(ct.end);return nt>=Dt&&nt<=Pt})},[T]),[s,I]=we.useState([]),[L,O]=we.useState([]),[H,J]=we.useState([]),[ee,ue]=we.useState(null),[fe,te]=we.useState(null),[Be,Ae]=we.useState(0),[De,xe]=we.useState(void 0),ye=x.state==="loading",Se=()=>x.revalidate();we.useEffect(()=>{if(h==null){O([]);return}const nt=y.services??[];if(nt.length===0){O([]);return}const ct={lat:h.lat,lon:h.lng};(async()=>{try{if(nt.flatMap(Ut=>Ut.routes||[]).length===0){O([]);return}const We=await ET(ct,3);O(We)}catch(Pt){console.error("[TransitPage] Failed to load nearby stops:",Pt),O([])}})()},[h==null?void 0:h.lat,h==null?void 0:h.lng,y.services]),we.useEffect(()=>{const nt=v.map(ct=>({id:String(ct.id),message:fT(ct),severity:"warning",active:!0}));I(nt)},[v]);const Ie=nt=>{J(ct=>ct.includes(nt)?ct.filter(Dt=>Dt!==nt):[...ct,nt])},Ze=nt=>{J(ct=>{if(nt.every(Pt=>ct.includes(Pt)))return ct.filter(Pt=>!nt.includes(Pt));{const Pt=nt.filter(We=>!ct.includes(We));return[...ct,...Pt]}})},Je=()=>Se(),Ve=()=>Se(),ft=()=>{Ae(nt=>nt+1)},vt=(nt,ct,Dt=17)=>{xe({lat:nt,lng:ct,zoom:Dt,key:Date.now()})};return Re.jsx(gC,{children:Re.jsx(mT,{alerts:s,messages:T,stops:L,services:y.services??[],configuration:y.configuration??void 0,maptilerApiKey:y.maptilerApiKey,selectedRoutes:H,isLoading:!1,isRefetching:ye,error:null,onRouteToggle:Ie,onBulkRouteToggle:Ze,onRetry:Je,onRefresh:Ve,children:Re.jsxs(nT,{focusedRoute:ee,focusedStopId:fe,centerToServiceRegionTrigger:Be,centerOnLocationTrigger:De,onFocusedRouteChange:ue,onFocusedStopChange:te,onCenterToServiceRegion:ft,onCenterOnLocation:vt,children:[Re.jsx(a5,{selectedRoutes:H,focusedRoute:ee}),Re.jsx(n5,{})]})})})});export{Sk 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.