@local-logic/sdks-app 1.0.0-beta.46 → 1.0.0-beta.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/index.3baa3a87.js +769 -0
- package/dist/assets/index.946206d5.js +889 -0
- package/dist/assets/list.e8b8e16a.svg +5 -0
- package/dist/index.html +1 -1
- package/dist/types/constants/routes.d.ts +1 -2
- package/dist/types/constants/routes.d.ts.map +1 -1
- package/dist/types/constants/routes.js +0 -1
- package/dist/types/constants/routes.js.map +1 -1
- package/dist/types/context/stateManager/defaultState.d.ts +4 -1
- package/dist/types/context/stateManager/defaultState.d.ts.map +1 -1
- package/dist/types/context/stateManager/defaultState.js +7 -2
- package/dist/types/context/stateManager/defaultState.js.map +1 -1
- package/dist/types/context/stateManager/index.d.ts.map +1 -1
- package/dist/types/context/stateManager/index.js +1 -3
- package/dist/types/context/stateManager/index.js.map +1 -1
- package/dist/types/sdks/LocalContent/Map/Markers/index.d.ts.map +1 -1
- package/dist/types/sdks/LocalContent/Map/Markers/index.js +9 -1
- package/dist/types/sdks/LocalContent/Map/Markers/index.js.map +1 -1
- package/dist/types/sdks/LocalContent/Map/MobileScores/CategoryScores/index.d.ts +8 -0
- package/dist/types/sdks/LocalContent/Map/MobileScores/CategoryScores/index.d.ts.map +1 -0
- package/dist/types/sdks/LocalContent/Map/MobileScores/CategoryScores/index.js +37 -0
- package/dist/types/sdks/LocalContent/Map/MobileScores/CategoryScores/index.js.map +1 -0
- package/dist/types/sdks/LocalContent/Map/MobileScores/CategoryScores/styles.d.ts +6 -0
- package/dist/types/sdks/LocalContent/Map/MobileScores/CategoryScores/styles.d.ts.map +1 -0
- package/dist/types/sdks/LocalContent/Map/MobileScores/CategoryScores/styles.js +45 -0
- package/dist/types/sdks/LocalContent/Map/MobileScores/CategoryScores/styles.js.map +1 -0
- package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreInfo/styles.d.ts.map +1 -1
- package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreInfo/styles.js +4 -0
- package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreInfo/styles.js.map +1 -1
- package/dist/types/sdks/LocalContent/Map/MobileScores/index.d.ts.map +1 -1
- package/dist/types/sdks/LocalContent/Map/MobileScores/index.js +18 -5
- package/dist/types/sdks/LocalContent/Map/MobileScores/index.js.map +1 -1
- package/dist/types/sdks/LocalContent/Map/MobileScores/styles.d.ts +1 -1
- package/dist/types/sdks/LocalContent/Map/MobileScores/styles.d.ts.map +1 -1
- package/dist/types/sdks/LocalContent/Map/MobileScores/styles.js +4 -6
- package/dist/types/sdks/LocalContent/Map/MobileScores/styles.js.map +1 -1
- package/dist/types/sdks/LocalContent/Map/index.d.ts.map +1 -1
- package/dist/types/sdks/LocalContent/Map/index.js +5 -4
- package/dist/types/sdks/LocalContent/Map/index.js.map +1 -1
- package/dist/types/sdks/LocalContent/Map/styles.d.ts +3 -1
- package/dist/types/sdks/LocalContent/Map/styles.d.ts.map +1 -1
- package/dist/types/sdks/LocalContent/Map/styles.js +7 -4
- package/dist/types/sdks/LocalContent/Map/styles.js.map +1 -1
- package/dist/types/sdks/LocalContent/context.d.ts.map +1 -1
- package/dist/types/sdks/LocalContent/context.js +23 -10
- package/dist/types/sdks/LocalContent/context.js.map +1 -1
- package/dist/types/sdks/LocalContent/defaultState.d.ts +4 -1
- package/dist/types/sdks/LocalContent/defaultState.d.ts.map +1 -1
- package/dist/types/sdks/LocalContent/defaultState.js.map +1 -1
- package/package.json +4 -4
- package/dist/assets/index.5fab9b7a.js +0 -743
- package/dist/assets/index.a0f74ea9.js +0 -715
- package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreCategory/index.d.ts +0 -8
- package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreCategory/index.d.ts.map +0 -1
- package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreCategory/index.js +0 -46
- package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreCategory/index.js.map +0 -1
- package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreCategory/styles.d.ts +0 -5
- package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreCategory/styles.d.ts.map +0 -1
- package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreCategory/styles.js +0 -30
- package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreCategory/styles.js.map +0 -1
|
@@ -0,0 +1,769 @@
|
|
|
1
|
+
import{S as Gf,s as Fh,n as Zf,i as Oh,a as $h,t as qf,f as jf,c as Xf,r as Uh,b as Wf,d as sa,e as de,u as Hf,p as Kf,R as st,g as ld,j as Ee,h as ua,_ as Jf,k as eu,l as Co,m as da,o as kl,q as tu,v as Yf,w as Ft,C as mt,F as Dl,x as Ri,y as Vc,z as os,A as Bi,$ as Qf,U as cd,B as ud,D as Ll,E as tr,G as Tl,H as El,I as em,J as aa,K as Il,L as tm,M as im,N as rm,O as nm}from"./index.946206d5.js";var la=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};class om extends Gf{constructor(v,T){super(),this.client=v,this.options=T,this.trackedProps=new Set,this.selectError=null,this.bindMethods(),this.setOptions(T)}bindMethods(){this.remove=this.remove.bind(this),this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.length===1&&(this.currentQuery.addObserver(this),Vh(this.currentQuery,this.options)&&this.executeFetch(),this.updateTimers())}onUnsubscribe(){this.listeners.length||this.destroy()}shouldFetchOnReconnect(){return Xc(this.currentQuery,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Xc(this.currentQuery,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=[],this.clearStaleTimeout(),this.clearRefetchInterval(),this.currentQuery.removeObserver(this)}setOptions(v,T){const A=this.options,k=this.currentQuery;if(this.options=this.client.defaultQueryOptions(v),Fh(A,this.options)||this.client.getQueryCache().notify({type:"observerOptionsUpdated",query:this.currentQuery,observer:this}),typeof this.options.enabled!="undefined"&&typeof this.options.enabled!="boolean")throw new Error("Expected enabled to be a boolean");this.options.queryKey||(this.options.queryKey=A.queryKey),this.updateQuery();const B=this.hasListeners();B&&Nh(this.currentQuery,k,this.options,A)&&this.executeFetch(),this.updateResult(T),B&&(this.currentQuery!==k||this.options.enabled!==A.enabled||this.options.staleTime!==A.staleTime)&&this.updateStaleTimeout();const J=this.computeRefetchInterval();B&&(this.currentQuery!==k||this.options.enabled!==A.enabled||J!==this.currentRefetchInterval)&&this.updateRefetchInterval(J)}getOptimisticResult(v){const T=this.client.getQueryCache().build(this.client,v);return this.createResult(T,v)}getCurrentResult(){return this.currentResult}trackResult(v){const T={};return Object.keys(v).forEach(A=>{Object.defineProperty(T,A,{configurable:!1,enumerable:!0,get:()=>(this.trackedProps.add(A),v[A])})}),T}getCurrentQuery(){return this.currentQuery}remove(){this.client.getQueryCache().remove(this.currentQuery)}refetch({refetchPage:v,...T}={}){return this.fetch({...T,meta:{refetchPage:v}})}fetchOptimistic(v){const T=this.client.defaultQueryOptions(v),A=this.client.getQueryCache().build(this.client,T);return A.isFetchingOptimistic=!0,A.fetch().then(()=>this.createResult(A,T))}fetch(v){var T;return this.executeFetch({...v,cancelRefetch:(T=v.cancelRefetch)!=null?T:!0}).then(()=>(this.updateResult(),this.currentResult))}executeFetch(v){this.updateQuery();let T=this.currentQuery.fetch(this.options,v);return v!=null&&v.throwOnError||(T=T.catch(Zf)),T}updateStaleTimeout(){if(this.clearStaleTimeout(),Oh||this.currentResult.isStale||!$h(this.options.staleTime))return;const T=qf(this.currentResult.dataUpdatedAt,this.options.staleTime)+1;this.staleTimeoutId=setTimeout(()=>{this.currentResult.isStale||this.updateResult()},T)}computeRefetchInterval(){var v;return typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.currentResult.data,this.currentQuery):(v=this.options.refetchInterval)!=null?v:!1}updateRefetchInterval(v){this.clearRefetchInterval(),this.currentRefetchInterval=v,!(Oh||this.options.enabled===!1||!$h(this.currentRefetchInterval)||this.currentRefetchInterval===0)&&(this.refetchIntervalId=setInterval(()=>{(this.options.refetchIntervalInBackground||jf.isFocused())&&this.executeFetch()},this.currentRefetchInterval))}updateTimers(){this.updateStaleTimeout(),this.updateRefetchInterval(this.computeRefetchInterval())}clearStaleTimeout(){this.staleTimeoutId&&(clearTimeout(this.staleTimeoutId),this.staleTimeoutId=void 0)}clearRefetchInterval(){this.refetchIntervalId&&(clearInterval(this.refetchIntervalId),this.refetchIntervalId=void 0)}createResult(v,T){const A=this.currentQuery,k=this.options,B=this.currentResult,J=this.currentResultState,a=this.currentResultOptions,W=v!==A,K=W?v.state:this.currentQueryInitialState,ce=W?this.currentResult:this.previousQueryResult,{state:oe}=v;let{dataUpdatedAt:ee,error:Re,errorUpdatedAt:Fe,fetchStatus:Me,status:Ze}=oe,Ke=!1,Je=!1,tt;if(T._optimisticResults){const rt=this.hasListeners(),Ut=!rt&&Vh(v,T),Wt=rt&&Nh(v,A,T,k);(Ut||Wt)&&(Me=Xf(v.options.networkMode)?"fetching":"paused",ee||(Ze="loading")),T._optimisticResults==="isRestoring"&&(Me="idle")}if(T.keepPreviousData&&!oe.dataUpdateCount&&ce!=null&&ce.isSuccess&&Ze!=="error")tt=ce.data,ee=ce.dataUpdatedAt,Ze=ce.status,Ke=!0;else if(T.select&&typeof oe.data!="undefined")if(B&&oe.data===(J==null?void 0:J.data)&&T.select===this.selectFn)tt=this.selectResult;else try{this.selectFn=T.select,tt=T.select(oe.data),tt=Uh(B==null?void 0:B.data,tt,T),this.selectResult=tt,this.selectError=null}catch(rt){this.selectError=rt}else tt=oe.data;if(typeof T.placeholderData!="undefined"&&typeof tt=="undefined"&&Ze==="loading"){let rt;if(B!=null&&B.isPlaceholderData&&T.placeholderData===(a==null?void 0:a.placeholderData))rt=B.data;else if(rt=typeof T.placeholderData=="function"?T.placeholderData():T.placeholderData,T.select&&typeof rt!="undefined")try{rt=T.select(rt),rt=Uh(B==null?void 0:B.data,rt,T),this.selectError=null}catch(Ut){this.selectError=Ut}typeof rt!="undefined"&&(Ze="success",tt=rt,Je=!0)}this.selectError&&(Re=this.selectError,tt=this.selectResult,Fe=Date.now(),Ze="error");const gt=Me==="fetching";return{status:Ze,fetchStatus:Me,isLoading:Ze==="loading",isSuccess:Ze==="success",isError:Ze==="error",data:tt,dataUpdatedAt:ee,error:Re,errorUpdatedAt:Fe,failureCount:oe.fetchFailureCount,errorUpdateCount:oe.errorUpdateCount,isFetched:oe.dataUpdateCount>0||oe.errorUpdateCount>0,isFetchedAfterMount:oe.dataUpdateCount>K.dataUpdateCount||oe.errorUpdateCount>K.errorUpdateCount,isFetching:gt,isRefetching:gt&&Ze!=="loading",isLoadingError:Ze==="error"&&oe.dataUpdatedAt===0,isPaused:Me==="paused",isPlaceholderData:Je,isPreviousData:Ke,isRefetchError:Ze==="error"&&oe.dataUpdatedAt!==0,isStale:iu(v,T),refetch:this.refetch,remove:this.remove}}updateResult(v){const T=this.currentResult,A=this.createResult(this.currentQuery,this.options);if(this.currentResultState=this.currentQuery.state,this.currentResultOptions=this.options,Fh(A,T))return;this.currentResult=A;const k={cache:!0},B=()=>{if(!T)return!0;const{notifyOnChangeProps:J}=this.options;if(J==="all"||!J&&!this.trackedProps.size)return!0;const a=new Set(J!=null?J:this.trackedProps);return this.options.useErrorBoundary&&a.add("error"),Object.keys(this.currentResult).some(W=>{const K=W;return this.currentResult[K]!==T[K]&&a.has(K)})};(v==null?void 0:v.listeners)!==!1&&B()&&(k.listeners=!0),this.notify({...k,...v})}updateQuery(){const v=this.client.getQueryCache().build(this.client,this.options);if(v===this.currentQuery)return;const T=this.currentQuery;this.currentQuery=v,this.currentQueryInitialState=v.state,this.previousQueryResult=this.currentResult,this.hasListeners()&&(T==null||T.removeObserver(this),v.addObserver(this))}onQueryUpdate(v){const T={};v.type==="success"?T.onSuccess=!v.manual:v.type==="error"&&!Wf(v.error)&&(T.onError=!0),this.updateResult(T),this.hasListeners()&&this.updateTimers()}notify(v){sa.batch(()=>{if(v.onSuccess){var T,A,k,B;(T=(A=this.options).onSuccess)==null||T.call(A,this.currentResult.data),(k=(B=this.options).onSettled)==null||k.call(B,this.currentResult.data,null)}else if(v.onError){var J,a,W,K;(J=(a=this.options).onError)==null||J.call(a,this.currentResult.error),(W=(K=this.options).onSettled)==null||W.call(K,void 0,this.currentResult.error)}v.listeners&&this.listeners.forEach(ce=>{ce(this.currentResult)}),v.cache&&this.client.getQueryCache().notify({query:this.currentQuery,type:"observerResultsUpdated"})})}}function sm(x,v){return v.enabled!==!1&&!x.state.dataUpdatedAt&&!(x.state.status==="error"&&v.retryOnMount===!1)}function Vh(x,v){return sm(x,v)||x.state.dataUpdatedAt>0&&Xc(x,v,v.refetchOnMount)}function Xc(x,v,T){if(v.enabled!==!1){const A=typeof T=="function"?T(x):T;return A==="always"||A!==!1&&iu(x,v)}return!1}function Nh(x,v,T,A){return T.enabled!==!1&&(x!==v||A.enabled===!1)&&(!T.suspense||x.state.status!=="error")&&iu(x,T)}function iu(x,v){return x.isStaleByTime(v.staleTime)}const hd=de.exports.createContext(!1),am=()=>de.exports.useContext(hd);hd.Provider;var dd={exports:{}},pd={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* use-sync-external-store-shim.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var ss=de.exports;function lm(x,v){return x===v&&(x!==0||1/x===1/v)||x!==x&&v!==v}var cm=typeof Object.is=="function"?Object.is:lm,um=ss.useState,hm=ss.useEffect,dm=ss.useLayoutEffect,pm=ss.useDebugValue;function fm(x,v){var T=v(),A=um({inst:{value:T,getSnapshot:v}}),k=A[0].inst,B=A[1];return dm(function(){k.value=T,k.getSnapshot=v,Nc(k)&&B({inst:k})},[x,T,v]),hm(function(){return Nc(k)&&B({inst:k}),x(function(){Nc(k)&&B({inst:k})})},[x]),pm(T),T}function Nc(x){var v=x.getSnapshot;x=x.value;try{var T=v();return!cm(x,T)}catch{return!0}}function mm(x,v){return v()}var gm=typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"?mm:fm;pd.useSyncExternalStore=ss.useSyncExternalStore!==void 0?ss.useSyncExternalStore:gm;dd.exports=pd;function _m(){let x=!1;return{clearReset:()=>{x=!1},reset:()=>{x=!0},isReset:()=>x}}const ym=de.exports.createContext(_m()),xm=()=>de.exports.useContext(ym);function vm(x,v){return typeof x=="function"?x(...v):!!x}function bm(x,v){const T=Hf({context:x.context}),A=am(),k=xm(),B=T.defaultQueryOptions(x);B._optimisticResults=A?"isRestoring":"optimistic",B.onError&&(B.onError=sa.batchCalls(B.onError)),B.onSuccess&&(B.onSuccess=sa.batchCalls(B.onSuccess)),B.onSettled&&(B.onSettled=sa.batchCalls(B.onSettled)),B.suspense&&typeof B.staleTime!="number"&&(B.staleTime=1e3),(B.suspense||B.useErrorBoundary)&&(k.isReset()||(B.retryOnMount=!1));const[J]=de.exports.useState(()=>new v(T,B)),a=J.getOptimisticResult(B);if(dd.exports.useSyncExternalStore(de.exports.useCallback(W=>A?()=>{}:J.subscribe(sa.batchCalls(W)),[J,A]),()=>J.getCurrentResult(),()=>J.getCurrentResult()),de.exports.useEffect(()=>{k.clearReset()},[k]),de.exports.useEffect(()=>{J.setOptions(B,{listeners:!1})},[B,J]),B.suspense&&a.isLoading&&a.isFetching&&!A)throw J.fetchOptimistic(B).then(({data:W})=>{B.onSuccess==null||B.onSuccess(W),B.onSettled==null||B.onSettled(W,null)}).catch(W=>{k.clearReset(),B.onError==null||B.onError(W),B.onSettled==null||B.onSettled(void 0,W)});if(a.isError&&!k.isReset()&&!a.isFetching&&vm(B.useErrorBoundary,[a.error,J.getCurrentQuery()]))throw a.error;return B.notifyOnChangeProps?a:J.trackResult(a)}function ru(x,v,T){const A=Kf(x,v,T);return bm(A,om)}const fd=st.createContext({}),gn=()=>de.exports.useContext(fd),wm=(x,v)=>{switch(v.type){case"CATEGORY":return{...x,activeCategory:v.value};case"SCORE":{const T=ua.find(A=>v.value===""?A.value===x.activeCategory:A.scores.includes(v.value)).value;return{activeCategory:T,activeScoreByCategory:{...x.activeScoreByCategory,[T]:v.value}}}}},Tm=({children:x})=>{const[v,T]=de.exports.useState(!1),A=window.innerWidth<ld.screenSizes.mobileL?{activeCategory:"commute",activeScoreByCategory:{commute:"pedestrian_friendly",amenities:"groceries",character:"vibrant",nature:"parks",education:"high_schools"}}:{activeCategory:"commute",activeScoreByCategory:{commute:"",amenities:"",character:"",nature:"",education:""}},[k,B]=de.exports.useReducer(wm,A),[J,a]=de.exports.useState(),[W,K]=de.exports.useState(),{activeCategory:ce}=k,oe=k.activeScoreByCategory[ce],ee=Me=>{B({type:"SCORE",value:Me})},Re=Me=>{B({type:"CATEGORY",value:Me})},Fe=de.exports.useMemo(()=>({activeScore:oe,setActiveScore:ee,activeCategory:ce,setActiveCategory:Re,activePOI:J,setActivePOI:a,hoveredPOI:W,setHoveredPOI:K,showMobileList:v,setShowMobileList:T}),[oe,ee,ce,Re,J,a,W,K,v,T]);return Ee(fd.Provider,{value:Fe,children:x})},Em=de.exports.createContext(null);function Sm(x){const v=x.clone();return v.pixelsToGLUnits=x.pixelsToGLUnits,v}function Gh(x){return{longitude:x.center.lng,latitude:x.center.lat,zoom:x.zoom,pitch:x.pitch,bearing:x.bearing,padding:x.padding}}function Zh(x,v){const T=v.viewState||v;let A=!1;if("longitude"in T&&"latitude"in T){const k=x.center;x.center=new k.constructor(T.longitude,T.latitude),A=A||k!==x.center}if("zoom"in T){const k=x.zoom;x.zoom=T.zoom,A=A||k!==x.zoom}if("bearing"in T){const k=x.bearing;x.bearing=T.bearing,A=A||k!==x.bearing}if("pitch"in T){const k=x.pitch;x.pitch=T.pitch,A=A||k!==x.pitch}return T.padding&&!x.isPaddingEqual(T.padding)&&(A=!0,x.padding=T.padding),A}const Im=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function qh(x){if(!x)return null;if(typeof x=="string"||("toJS"in x&&(x=x.toJS()),!x.layers))return x;const v={};for(const A of x.layers)v[A.id]=A;const T=x.layers.map(A=>{const k=v[A.ref];let B=null;if("interactive"in A&&(B={...A},delete B.interactive),k){B=B||{...A},delete B.ref;for(const J of Im)J in k&&(B[J]=k[J])}return B||A});return{...x,layers:T}}function Cm(x,v){const T=Array.isArray(x)?x[0]:x?x.x:0,A=Array.isArray(x)?x[1]:x?x.y:0,k=Array.isArray(v)?v[0]:v?v.x:0,B=Array.isArray(v)?v[1]:v?v.y:0;return T===k&&A===B}function qn(x,v){if(x===v)return!0;if(!x||!v)return!1;if(Array.isArray(x)){if(!Array.isArray(v)||x.length!==v.length)return!1;for(let T=0;T<x.length;T++)if(!qn(x[T],v[T]))return!1;return!0}else if(Array.isArray(v))return!1;if(typeof x=="object"&&typeof v=="object"){const T=Object.keys(x),A=Object.keys(v);if(T.length!==A.length)return!1;for(const k of T)if(!v.hasOwnProperty(k)||!qn(x[k],v[k]))return!1;return!0}return!1}const jh={mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",click:"onClick",dblclick:"onDblClick",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mouseout:"onMouseOut",contextmenu:"onContextMenu",touchstart:"onTouchStart",touchend:"onTouchEnd",touchmove:"onTouchMove",touchcancel:"onTouchCancel"},Gc={movestart:"onMoveStart",move:"onMove",moveend:"onMoveEnd",dragstart:"onDragStart",drag:"onDrag",dragend:"onDragEnd",zoomstart:"onZoomStart",zoom:"onZoom",zoomend:"onZoomEnd",rotatestart:"onRotateStart",rotate:"onRotate",rotateend:"onRotateEnd",pitchstart:"onPitchStart",pitch:"onPitch",pitchend:"onPitchEnd"},Xh={wheel:"onWheel",boxzoomstart:"onBoxZoomStart",boxzoomend:"onBoxZoomEnd",boxzoomcancel:"onBoxZoomCancel",resize:"onResize",load:"onLoad",render:"onRender",idle:"onIdle",remove:"onRemove",data:"onData",styledata:"onStyleData",sourcedata:"onSourceData",error:"onError"},Am=["minZoom","maxZoom","minPitch","maxPitch","maxBounds","projection","renderWorldCopies"],Mm=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"];class as{constructor(v,T,A){this._map=null,this._internalUpdate=!1,this._inRender=!1,this._hoveredFeatures=null,this._deferredEvents={move:!1,zoom:!1,pitch:!1,rotate:!1},this._onEvent=k=>{const B=this.props[Xh[k.type]];B&&B(k)},this._onPointerEvent=k=>{(k.type==="mousemove"||k.type==="mouseout")&&this._updateHover(k);const B=this.props[jh[k.type]];if(B){if(this.props.interactiveLayerIds&&k.type!=="mouseover"&&k.type!=="mouseout"){const J=this._hoveredFeatures||this._map.queryRenderedFeatures(k.point,{layers:this.props.interactiveLayerIds});k.features=J}B(k),delete k.features}},this._onCameraEvent=k=>{if(!this._internalUpdate){const B=this.props[Gc[k.type]];B&&B(k)}k.type in this._deferredEvents&&(this._deferredEvents[k.type]=!1)},this._MapClass=v,this.props=T,this._initialize(A)}get map(){return this._map}get transform(){return this._renderTransform}setProps(v){const T=this.props;this.props=v;const A=this._updateSettings(v,T);A&&this._createShadowTransform(this._map);const k=this._updateSize(v),B=this._updateViewState(v,!0);this._updateStyle(v,T),this._updateStyleComponents(v,T),this._updateHandlers(v,T),(A||k||B&&!this._map.isMoving())&&this.redraw()}static reuse(v,T){const A=as.savedMaps.pop();if(!A)return null;const k=A.map,B=k.getContainer();for(T.className=B.className;B.childNodes.length>0;)T.appendChild(B.childNodes[0]);k._container=T,A.setProps({...v,styleDiffing:!1}),k.resize();const{initialViewState:J}=v;return J&&(J.bounds?k.fitBounds(J.bounds,{...J.fitBoundsOptions,duration:0}):A._updateViewState(J,!1)),k.isStyleLoaded()?k.fire("load"):k.once("styledata",()=>k.fire("load")),A}_initialize(v){const{props:T}=this,A={...T,...T.initialViewState,accessToken:T.mapboxAccessToken||Pm()||null,container:v,style:qh(T.mapStyle)},k=A.initialViewState||A.viewState||A;if(Object.assign(A,{center:[k.longitude||0,k.latitude||0],zoom:k.zoom||0,pitch:k.pitch||0,bearing:k.bearing||0}),T.gl){const K=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=K,T.gl)}const B=new this._MapClass(A);k.padding&&B.setPadding(k.padding),T.cursor&&(B.getCanvas().style.cursor=T.cursor),this._createShadowTransform(B);const J=B._render;B._render=K=>{this._inRender=!0,J.call(B,K),this._inRender=!1};const a=B._renderTaskQueue.run;B._renderTaskQueue.run=K=>{a.call(B._renderTaskQueue,K),this._onBeforeRepaint()},B.on("render",()=>this._onAfterRepaint());const W=B.fire;B.fire=this._fireEvent.bind(this,W),B.on("resize",()=>{this._renderTransform.resize(B.transform.width,B.transform.height)}),B.on("styledata",()=>this._updateStyleComponents(this.props,{})),B.on("sourcedata",()=>this._updateStyleComponents(this.props,{}));for(const K in jh)B.on(K,this._onPointerEvent);for(const K in Gc)B.on(K,this._onCameraEvent);for(const K in Xh)B.on(K,this._onEvent);this._map=B}recycle(){as.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){const v=this._map;!this._inRender&&v.style&&(v._frame&&(v._frame.cancel(),v._frame=null),v._render())}_createShadowTransform(v){const T=Sm(v.transform);v.painter.transform=T,this._renderTransform=T}_updateSize(v){const{viewState:T}=v;if(T){const A=this._map;if(T.width!==A.transform.width||T.height!==A.transform.height)return A.resize(),!0}return!1}_updateViewState(v,T){if(this._internalUpdate)return!1;const A=this._map,k=this._renderTransform,{zoom:B,pitch:J,bearing:a}=k,W=A.isMoving();W&&(k.cameraElevationReference="sea");const K=Zh(k,{...Gh(A.transform),...v});if(W&&(k.cameraElevationReference="ground"),K&&T){const ce=this._deferredEvents;ce.move=!0,ce.zoom||(ce.zoom=B!==k.zoom),ce.rotate||(ce.rotate=a!==k.bearing),ce.pitch||(ce.pitch=J!==k.pitch)}return W||Zh(A.transform,v),K}_updateSettings(v,T){const A=this._map;let k=!1;for(const B of Am)B in v&&!qn(v[B],T[B])&&(k=!0,A[`set${B[0].toUpperCase()}${B.slice(1)}`](v[B]));return k}_updateStyle(v,T){if(v.cursor!==T.cursor&&(this._map.getCanvas().style.cursor=v.cursor),v.mapStyle!==T.mapStyle){const A={diff:v.styleDiffing};return"localIdeographFontFamily"in v&&(A.localIdeographFontFamily=v.localIdeographFontFamily),this._map.setStyle(qh(v.mapStyle),A),!0}return!1}_updateStyleComponents(v,T){const A=this._map;let k=!1;return A.style.loaded()&&("light"in v&&!qn(v.light,T.light)&&(k=!0,A.setLight(v.light)),"fog"in v&&!qn(v.fog,T.fog)&&(k=!0,A.setFog(v.fog)),"terrain"in v&&!qn(v.terrain,T.terrain)&&(!v.terrain||A.getSource(v.terrain.source))&&(k=!0,A.setTerrain(v.terrain))),k}_updateHandlers(v,T){const A=this._map;let k=!1;for(const B of Mm){const J=v[B];qn(J,T[B])||(k=!0,J?A[B].enable(J):A[B].disable())}return k}_updateHover(v){var T;const{props:A}=this;if(A.interactiveLayerIds&&(A.onMouseMove||A.onMouseEnter||A.onMouseLeave)){const B=v.type,J=((T=this._hoveredFeatures)===null||T===void 0?void 0:T.length)>0;let a;if(B==="mousemove")try{a=this._map.queryRenderedFeatures(v.point,{layers:A.interactiveLayerIds})}catch{a=[]}else a=[];const W=a.length>0;!W&&J&&(v.type="mouseleave",this._onPointerEvent(v)),this._hoveredFeatures=a,W&&!J&&(v.type="mouseenter",this._onPointerEvent(v)),v.type=B}else this._hoveredFeatures=null}_fireEvent(v,T,A){const k=this._map,B=k.transform,J=typeof T=="string"?T:T.type;return J==="move"&&this._updateViewState(this.props,!1),J in Gc&&(typeof T=="object"&&(T.viewState=Gh(B)),this._map.isMoving())?(k.transform=this._renderTransform,v.call(k,T,A),k.transform=B,k):(v.call(k,T,A),k)}_onBeforeRepaint(){const v=this._map;this._internalUpdate=!0;for(const A in this._deferredEvents)this._deferredEvents[A]&&v.fire(A);this._internalUpdate=!1;const T=this._map.transform;this._map.transform=this._renderTransform,this._onAfterRepaint=()=>{this._map.transform=T}}}as.savedMaps=[];function Pm(){let x=null;if(typeof location!="undefined"){const v=/access_token=([^&\/]*)/.exec(location.search);x=v&&v[1]}try{x=x||{}.MapboxAccessToken}catch{}try{x=x||{}.REACT_APP_MAPBOX_ACCESS_TOKEN}catch{}return x}const zm=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];function km(x,v){if(!x)return null;const T=x.map,A={getMap:()=>T,getCenter:()=>x.transform.center,getZoom:()=>x.transform.zoom,getBearing:()=>x.transform.bearing,getPitch:()=>x.transform.pitch,getPadding:()=>x.transform.padding,getBounds:()=>x.transform.getBounds(),project:k=>x.transform.locationPoint(v.LngLat.convert(k)),unproject:k=>x.transform.pointLocation(v.Point.convert(k)),queryTerrainElevation:(k,B)=>{const J=T.transform;T.transform=x.transform;const a=T.queryTerrainElevation(k,B);return T.transform=J,a}};for(const k of Dm(T))!(k in A)&&!zm.includes(k)&&(A[k]=T[k].bind(T));return A}function Dm(x){const v=new Set;let T=x;for(;T;){for(const A of Object.getOwnPropertyNames(T))A[0]!=="_"&&typeof x[A]=="function"&&A!=="fire"&&A!=="setEventedParent"&&v.add(A);T=Object.getPrototypeOf(T)}return Array.from(v)}const Lm=typeof document!="undefined"?de.exports.useLayoutEffect:de.exports.useEffect,Rm=["baseApiUrl","maxParallelImageRequests","workerClass","workerCount","workerUrl"];function Bm(x,v){for(const T of Rm)T in v&&(x[T]=v[T]);v.RTLTextPlugin&&x.getRTLTextPluginStatus&&x.getRTLTextPluginStatus()==="unavailable"&&x.setRTLTextPlugin(v.RTLTextPlugin,T=>{T&&console.error(T)},!1)}const Rl=de.exports.createContext(null),Fm={minZoom:0,maxZoom:22,minPitch:0,maxPitch:60,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,mapStyle:{version:8,sources:{},layers:[]},styleDiffing:!0,projection:"mercator",renderWorldCopies:!0,onError:x=>console.error(x.error),RTLTextPlugin:"https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js"},nu=de.exports.forwardRef((x,v)=>{const T=de.exports.useContext(Em),[A,k]=de.exports.useState(null),B=de.exports.useRef(),{current:J}=de.exports.useRef({mapLib:null,map:null});de.exports.useEffect(()=>{const W=x.mapLib;let K=!0,ce;return Promise.resolve(W||Jf(()=>import("./index.c629d6a1.js").then(function(oe){return oe.i}),[])).then(oe=>{if(!!K){if(oe.Map||(oe=oe.default),!oe||!oe.Map)throw new Error("Invalid mapLib");if(oe.supported(x))Bm(oe,x),x.reuseMaps&&(ce=as.reuse(x,B.current)),ce||(ce=new as(oe.Map,x,B.current)),J.map=km(ce,oe),J.mapLib=oe,k(ce),T==null||T.onMapMount(J.map,x.id);else throw new Error("Map is not supported by this browser")}}).catch(oe=>{x.onError({type:"error",target:null,originalEvent:null,error:oe})}),()=>{K=!1,ce&&(T==null||T.onMapUnmount(x.id),x.reuseMaps?ce.recycle():ce.destroy())}},[]),Lm(()=>{A&&A.setProps(x)}),de.exports.useImperativeHandle(v,()=>J.map,[A]);const a=de.exports.useMemo(()=>({position:"relative",width:"100%",height:"100%",...x.style}),[x.style]);return de.exports.createElement("div",{id:x.id,ref:B,style:a},A&&de.exports.createElement(Rl.Provider,{value:J},x.children))});nu.displayName="Map";nu.defaultProps=Fm;const Om=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function Ao(x,v){if(!x||!v)return;const T=x.style;for(const A in v){const k=v[A];Number.isFinite(k)&&!Om.test(A)?T[A]=`${k}px`:T[A]=k}}const $m={draggable:!1,popup:null,rotation:0,rotationAlignment:"auto",pitchAlignment:"auto"};function md(x){const{map:v,mapLib:T}=de.exports.useContext(Rl),A=de.exports.useRef({props:x});A.current.props=x;const k=de.exports.useMemo(()=>{let B=!1;de.exports.Children.forEach(x.children,W=>{W&&(B=!0)});const J={...x,element:B?document.createElement("div"):null},a=new T.Marker(J).setLngLat([x.longitude,x.latitude]);return a.getElement().addEventListener("click",W=>{var K,ce;(ce=(K=A.current.props).onClick)===null||ce===void 0||ce.call(K,{type:"click",target:a,originalEvent:W})}),a.on("dragstart",W=>{var K,ce;const oe=W;oe.lngLat=k.getLngLat(),(ce=(K=A.current.props).onDragStart)===null||ce===void 0||ce.call(K,oe)}),a.on("drag",W=>{var K,ce;const oe=W;oe.lngLat=k.getLngLat(),(ce=(K=A.current.props).onDrag)===null||ce===void 0||ce.call(K,oe)}),a.on("dragend",W=>{var K,ce;const oe=W;oe.lngLat=k.getLngLat(),(ce=(K=A.current.props).onDragEnd)===null||ce===void 0||ce.call(K,oe)}),a},[]);return de.exports.useEffect(()=>(k.addTo(v.getMap()),()=>{k.remove()}),[]),de.exports.useEffect(()=>{Ao(k.getElement(),x.style)},[x.style]),(k.getLngLat().lng!==x.longitude||k.getLngLat().lat!==x.latitude)&&k.setLngLat([x.longitude,x.latitude]),x.offset&&!Cm(k.getOffset(),x.offset)&&k.setOffset(x.offset),k.isDraggable()!==x.draggable&&k.setDraggable(x.draggable),k.getRotation()!==x.rotation&&k.setRotation(x.rotation),k.getRotationAlignment()!==x.rotationAlignment&&k.setRotationAlignment(x.rotationAlignment),k.getPitchAlignment()!==x.pitchAlignment&&k.setPitchAlignment(x.pitchAlignment),k.getPopup()!==x.popup&&k.setPopup(x.popup),eu.exports.createPortal(x.children,k.getElement())}md.defaultProps=$m;var Wc=de.exports.memo(md);function Wh(x){return new Set(x?x.trim().split(/\s+/):[])}function Um(x){const{map:v,mapLib:T}=de.exports.useContext(Rl),A=de.exports.useMemo(()=>document.createElement("div"),[]),k=de.exports.useRef({props:x});k.current.props=x;const B=de.exports.useMemo(()=>{const J={...x},a=new T.Popup(J).setLngLat([x.longitude,x.latitude]);return a.once("open",W=>{var K,ce;(ce=(K=k.current.props).onOpen)===null||ce===void 0||ce.call(K,W)}),a},[]);if(de.exports.useEffect(()=>{const J=a=>{var W,K;(K=(W=k.current.props).onClose)===null||K===void 0||K.call(W,a)};return B.on("close",J),B.setDOMContent(A).addTo(v.getMap()),()=>{B.off("close",J),B.isOpen()&&B.remove()}},[]),de.exports.useEffect(()=>{Ao(B.getElement(),x.style)},[x.style]),B.isOpen()&&((B.getLngLat().lng!==x.longitude||B.getLngLat().lat!==x.latitude)&&B.setLngLat([x.longitude,x.latitude]),x.offset&&!qn(B.options.offset,x.offset)&&B.setOffset(x.offset),(B.options.anchor!==x.anchor||B.options.maxWidth!==x.maxWidth)&&(B.options.anchor=x.anchor,B.setMaxWidth(x.maxWidth)),B.options.className!==x.className)){const J=Wh(B.options.className),a=Wh(x.className);for(const W of J)a.has(W)||B.removeClassName(W);for(const W of a)J.has(W)||B.addClassName(W);B.options.className=x.className}return eu.exports.createPortal(x.children,A)}de.exports.memo(Um);function pa(x,v,T,A){const k=de.exports.useContext(Rl),B=de.exports.useMemo(()=>x(k),[]);return de.exports.useEffect(()=>{const J=A||T||v,a=typeof v=="function"&&typeof T=="function"?v:null,W=typeof T=="function"?T:typeof v=="function"?v:null,{map:K}=k;return K.hasControl(B)||(K.addControl(B,J==null?void 0:J.position),a&&a(k)),()=>{W&&W(k),K.hasControl(B)&&K.removeControl(B)}},[]),B}function Vm(x){const v=pa(({mapLib:T})=>new T.AttributionControl(x),{position:x.position});return de.exports.useEffect(()=>{Ao(v._container,x.style)},[x.style]),null}de.exports.memo(Vm);function Nm(x){const v=pa(({mapLib:T})=>new T.FullscreenControl({container:x.containerId&&document.getElementById(x.containerId)}),{position:x.position});return de.exports.useEffect(()=>{Ao(v._controlContainer,x.style)},[x.style]),null}de.exports.memo(Nm);const gd=de.exports.forwardRef((x,v)=>{const T=de.exports.useRef({props:x}),A=pa(({mapLib:k})=>{const B=new k.GeolocateControl(x),J=B._setupUI;return B._setupUI=a=>{B._container.hasChildNodes()||J(a)},B.on("geolocate",a=>{var W,K;(K=(W=T.current.props).onGeolocate)===null||K===void 0||K.call(W,a)}),B.on("error",a=>{var W,K;(K=(W=T.current.props).onError)===null||K===void 0||K.call(W,a)}),B.on("outofmaxbounds",a=>{var W,K;(K=(W=T.current.props).onOutOfMaxBounds)===null||K===void 0||K.call(W,a)}),B.on("trackuserlocationstart",a=>{var W,K;(K=(W=T.current.props).onTrackUserLocationStart)===null||K===void 0||K.call(W,a)}),B.on("trackuserlocationend",a=>{var W,K;(K=(W=T.current.props).onTrackUserLocationEnd)===null||K===void 0||K.call(W,a)}),B},{position:x.position});return T.current.props=x,de.exports.useImperativeHandle(v,()=>({trigger:()=>A.trigger()}),[]),de.exports.useEffect(()=>{Ao(A._container,x.style)},[x.style]),null});gd.displayName="GeolocateControl";de.exports.memo(gd);function Gm(x){const v=pa(({mapLib:T})=>new T.NavigationControl(x),{position:x.position});return de.exports.useEffect(()=>{Ao(v._container,x.style)},[x.style]),null}var Zm=de.exports.memo(Gm);const qm={unit:"metric",maxWidth:100};function _d(x){const v=pa(({mapLib:T})=>new T.ScaleControl(x),{position:x.position});return(v.options.unit!==x.unit||v.options.maxWidth!==x.maxWidth)&&(v.options.maxWidth=x.maxWidth,v.setUnit(x.unit)),de.exports.useEffect(()=>{Ao(v._container,x.style)},[x.style]),null}_d.defaultProps=qm;de.exports.memo(_d);var yd={exports:{}};(function(x,v){(function(T,A){x.exports=A()})(la,function(){var T,A,k;function B(a,W){if(!T)T=W;else if(!A)A=W;else{var K="var sharedChunk = {}; ("+T+")(sharedChunk); ("+A+")(sharedChunk);",ce={};T(ce),k=W(ce),typeof window!="undefined"&&(k.workerUrl=window.URL.createObjectURL(new Blob([K],{type:"text/javascript"})))}}B(["exports"],function(a){var W=K;function K(i,e,r,o){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(o-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=o}function ce(i,e,r,o){const c=new W(i,e,r,o);return function(h){return c.solve(h)}}K.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,e){if(e===void 0&&(e=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,o=0;o<8;o++){var c=this.sampleCurveX(r)-i;if(Math.abs(c)<e)return r;var h=this.sampleCurveDerivativeX(r);if(Math.abs(h)<1e-6)break;r-=c/h}var p=0,m=1;for(r=i,o=0;o<20&&(c=this.sampleCurveX(r),!(Math.abs(c-i)<e));o++)i>c?p=r:m=r,r=.5*(m-p)+p;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};const oe=ce(.25,.1,.25,1);function ee(i,e,r){return Math.min(r,Math.max(e,i))}function Re(i,e,r){const o=r-e,c=((i-e)%o+o)%o+e;return c===e?r:c}function Fe(i,...e){for(const r of e)for(const o in r)i[o]=r[o];return i}let Me=1;function Ze(i,e){i.forEach(r=>{e[r]&&(e[r]=e[r].bind(e))})}function Ke(i,e,r){const o={};for(const c in i)o[c]=e.call(r||this,i[c],c,i);return o}function Je(i,e,r){const o={};for(const c in i)e.call(r||this,i[c],c,i)&&(o[c]=i[c]);return o}function tt(i){return Array.isArray(i)?i.map(tt):typeof i=="object"&&i?Ke(i,tt):i}const gt={};function ct(i){gt[i]||(typeof console!="undefined"&&console.warn(i),gt[i]=!0)}function rt(i,e,r){return(r.y-i.y)*(e.x-i.x)>(e.y-i.y)*(r.x-i.x)}function Ut(i){let e=0;for(let r,o,c=0,h=i.length,p=h-1;c<h;p=c++)r=i[c],o=i[p],e+=(o.x-r.x)*(r.y+o.y);return e}function Wt(){return typeof WorkerGlobalScope!="undefined"&&typeof self!="undefined"&&self instanceof WorkerGlobalScope}function ur(i){const e={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,o,c,h)=>{const p=c||h;return e[o]=!p||p.toLowerCase(),""}),e["max-age"]){const r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e}let Wi,hr,At=null;function wi(i){if(At==null){const e=i.navigator?i.navigator.userAgent:null;At=!!i.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return At}function pi(i){return typeof ImageBitmap!="undefined"&&i instanceof ImageBitmap}const ii={now:typeof performance!="undefined"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(i){const e=requestAnimationFrame(i);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(i,e=0){const r=window.document.createElement("canvas"),o=r.getContext("2d");if(!o)throw new Error("failed to create canvas 2d context");return r.width=i.width,r.height=i.height,o.drawImage(i,0,0,i.width,i.height),o.getImageData(-e,-e,i.width+2*e,i.height+2*e)},resolveURL:i=>(Wi||(Wi=document.createElement("a")),Wi.href=i,Wi.href),hardwareConcurrency:typeof navigator!="undefined"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(hr==null&&(hr=matchMedia("(prefers-reduced-motion: reduce)")),hr.matches)}};var et=Ti;function Ti(i,e){this.x=i,this.y=e}Ti.prototype={clone:function(){return new Ti(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,e){return this.clone()._rotateAround(i,e)},matMult:function(i){return this.clone()._matMult(i)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var e=i.x-this.x,r=i.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,e){return Math.atan2(this.x*e-this.y*i,this.x*i+this.y*e)},_matMult:function(i){var e=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=e,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var e=Math.cos(i),r=Math.sin(i),o=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=o,this},_rotateAround:function(i,e){var r=Math.cos(i),o=Math.sin(i),c=e.y+o*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-o*(this.y-e.y),this.y=c,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Ti.convert=function(i){return i instanceof Ti?i:Array.isArray(i)?new Ti(i[0],i[1]):i};const Hi={MAX_PARALLEL_IMAGE_REQUESTS:16,REGISTERED_PROTOCOLS:{}},Ai="mapbox-tiles";let ir,Kr,_n=500,yn=50;function xn(){typeof caches=="undefined"||ir||(ir=caches.open(Ai))}let dr=1/0;const Dr={supported:!1,testSupport:function(i){!Mi&&Rr&&(vn?jn(i):Lr=i)}};let Lr,Rr,Mi=!1,vn=!1;function jn(i){const e=i.createTexture();i.bindTexture(i.TEXTURE_2D,e);try{if(i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,Rr),i.isContextLost())return;Dr.supported=!0}catch{}i.deleteTexture(e),Mi=!0}typeof document!="undefined"&&(Rr=document.createElement("img"),Rr.onload=function(){Lr&&jn(Lr),Lr=null,vn=!0},Rr.onerror=function(){Mi=!0,Lr=null},Rr.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const br={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};typeof Object.freeze=="function"&&Object.freeze(br);class Fi extends Error{constructor(e,r,o,c){super(`AJAXError: ${r} (${e}): ${o}`),this.status=e,this.statusText=r,this.url=o,this.body=c}}const Xn=Wt()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href;function Br(i,e){const r=new AbortController,o=new Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,referrer:Xn(),signal:r.signal});let c=!1,h=!1;return i.type==="json"&&o.headers.set("Accept","application/json"),((p,m,g)=>{if(h)return;const b=Date.now();fetch(o).then(S=>S.ok?((C,z,L)=>{(i.type==="arrayBuffer"?C.arrayBuffer():i.type==="json"?C.json():C.text()).then(R=>{h||(z&&L&&function(q,Z,ne){if(xn(),!ir)return;const he={status:Z.status,statusText:Z.statusText,headers:new Headers};Z.headers.forEach((le,ve)=>he.headers.set(ve,le));const re=ur(Z.headers.get("Cache-Control")||"");re["no-store"]||(re["max-age"]&&he.headers.set("Expires",new Date(ne+1e3*re["max-age"]).toUTCString()),new Date(he.headers.get("Expires")).getTime()-ne<42e4||function(le,ve){if(Kr===void 0)try{new Response(new ReadableStream),Kr=!0}catch{Kr=!1}Kr?ve(le.body):le.blob().then(ve)}(Z,le=>{const ve=new Response(le,he);xn(),ir&&ir.then(xe=>xe.put(function(Ue){const Ge=Ue.indexOf("?");return Ge<0?Ue:Ue.slice(0,Ge)}(q.url),ve)).catch(xe=>ct(xe.message))}))}(o,z,L),c=!0,e(null,R,C.headers.get("Cache-Control"),C.headers.get("Expires")))}).catch(R=>{h||e(new Error(R.message))})})(S,null,b):S.blob().then(C=>e(new Fi(S.status,S.statusText,i.url,C)))).catch(S=>{S.code!==20&&e(new Error(S.message))})})(),{cancel:()=>{h=!0,c||r.abort()}}}const bn=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){if(Wt()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e);if(!Wt()){const o=i.url.substring(0,i.url.indexOf("://"));return(Hi.REGISTERED_PROTOCOLS[o]||Br)(i,e)}}if(!(/^file:/.test(r=i.url)||/^file:/.test(Xn())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return Br(i,e);if(Wt()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e,void 0,!0)}var r;return function(o,c){const h=new XMLHttpRequest;h.open(o.method||"GET",o.url,!0),o.type==="arrayBuffer"&&(h.responseType="arraybuffer");for(const p in o.headers)h.setRequestHeader(p,o.headers[p]);return o.type==="json"&&(h.responseType="text",h.setRequestHeader("Accept","application/json")),h.withCredentials=o.credentials==="include",h.onerror=()=>{c(new Error(h.statusText))},h.onload=()=>{if((h.status>=200&&h.status<300||h.status===0)&&h.response!==null){let p=h.response;if(o.type==="json")try{p=JSON.parse(h.response)}catch(m){return c(m)}c(null,p,h.getResponseHeader("Cache-Control"),h.getResponseHeader("Expires"))}else{const p=new Blob([h.response],{type:h.getResponseHeader("Content-Type")});c(new Fi(h.status,h.statusText,o.url,p))}},h.send(o.body),{cancel:()=>h.abort()}}(i,e)},wn=function(i,e){return bn(Fe(i,{type:"arrayBuffer"}),e)};function Wn(i){const e=window.document.createElement("a");return e.href=i,e.protocol===window.document.location.protocol&&e.host===window.document.location.host}const vt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let pr,Fr;pr=[],Fr=0;const Or=function(i,e){if(Dr.supported&&(i.headers||(i.headers={}),i.headers.accept="image/webp,*/*"),Fr>=Hi.MAX_PARALLEL_IMAGE_REQUESTS){const h={requestParameters:i,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return pr.push(h),h}Fr++;let r=!1;const o=()=>{if(!r)for(r=!0,Fr--;pr.length&&Fr<Hi.MAX_PARALLEL_IMAGE_REQUESTS;){const h=pr.shift(),{requestParameters:p,callback:m,cancelled:g}=h;g||(h.cancel=Or(p,m).cancel)}},c=wn(i,(h,p,m,g)=>{o(),h?e(h):p&&function(b,S){typeof createImageBitmap=="function"?function(C,z){const L=new Blob([new Uint8Array(C)],{type:"image/png"});createImageBitmap(L).then(R=>{z(null,R)}).catch(R=>{z(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.`))})}(b,S):function(C,z){const L=new Image;L.onload=()=>{z(null,L),URL.revokeObjectURL(L.src),L.onload=null,window.requestAnimationFrame(()=>{L.src=vt})},L.onerror=()=>z(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 R=new Blob([new Uint8Array(C)],{type:"image/png"});L.src=C.byteLength?URL.createObjectURL(R):vt}(b,S)}(p,(b,S)=>{b!=null?e(b):S!=null&&e(null,S,{cacheControl:m,expires:g})})});return{cancel:()=>{c.cancel(),o()}}};function Hn(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function wr(i,e,r){if(r&&r[i]){const o=r[i].indexOf(e);o!==-1&&r[i].splice(o,1)}}class Tr{constructor(e,r={}){Fe(this,r),this.type=e}}class Tn extends Tr{constructor(e,r={}){super("error",Fe({error:e},r))}}class Er{on(e,r){return this._listeners=this._listeners||{},Hn(e,r,this._listeners),this}off(e,r){return wr(e,r,this._listeners),wr(e,r,this._oneTimeListeners),this}once(e,r){return this._oneTimeListeners=this._oneTimeListeners||{},Hn(e,r,this._oneTimeListeners),this}fire(e,r){typeof e=="string"&&(e=new Tr(e,r||{}));const o=e.type;if(this.listens(o)){e.target=this;const c=this._listeners&&this._listeners[o]?this._listeners[o].slice():[];for(const m of c)m.call(this,e);const h=this._oneTimeListeners&&this._oneTimeListeners[o]?this._oneTimeListeners[o].slice():[];for(const m of h)wr(o,m,this._oneTimeListeners),m.call(this,e);const p=this._eventedParent;p&&(Fe(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),p.fire(e))}else e instanceof Tn&&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 ye={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1},elevationOffset:{type:"number",default:450}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};class Pe{constructor(e,r,o,c){this.message=(e?`${e}: `:"")+o,c&&(this.identifier=c),r!=null&&r.__line__&&(this.line=r.__line__)}}function Jr(i){const e=i.value;return e?[new Pe(i.key,e,"constants have been deprecated as of v8")]:[]}function rr(i,...e){for(const r of e)for(const o in r)i[o]=r[o];return i}function bt(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function Ki(i){if(Array.isArray(i))return i.map(Ki);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){const e={};for(const r in i)e[r]=Ki(i[r]);return e}return bt(i)}class Oi extends Error{constructor(e,r){super(r),this.message=r,this.key=e}}class $i{constructor(e,r=[]){this.parent=e,this.bindings={};for(const[o,c]of r)this.bindings[o]=c}concat(e){return new $i(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 $r={kind:"null"},Ie={kind:"number"},ut={kind:"string"},at={kind:"boolean"},fi={kind:"color"},Ur={kind:"object"},ot={kind:"value"},Sr={kind:"collator"},si={kind:"formatted"},En={kind:"padding"},Yt={kind:"resolvedImage"};function Ei(i,e){return{kind:"array",itemType:i,N:e}}function zt(i){if(i.kind==="array"){const e=zt(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const Sn=[$r,Ie,ut,at,fi,si,Ur,Ei(ot),En,Yt];function fr(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!fr(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const r of Sn)if(!fr(r,e))return null}}return`Expected ${zt(i)} but found ${zt(e)} instead.`}function Yr(i,e){return e.some(r=>r.kind===i.kind)}function Qr(i,e){return e.some(r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i)}var In,en={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function $(i){return(i=Math.round(i))<0?0:i>255?255:i}function E(i){return $(i[i.length-1]==="%"?parseFloat(i)/100*255:parseInt(i))}function M(i){return(e=i[i.length-1]==="%"?parseFloat(i)/100:parseFloat(i))<0?0:e>1?1:e;var e}function F(i,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?i+(e-i)*r*6:2*r<1?e:3*r<2?i+(e-i)*(2/3-r)*6:i}try{In={}.parseCSSColor=function(i){var e,r=i.replace(/ /g,"").toLowerCase();if(r in en)return en[r].slice();if(r[0]==="#")return r.length===4?(e=parseInt(r.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:r.length===7&&(e=parseInt(r.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var o=r.indexOf("("),c=r.indexOf(")");if(o!==-1&&c+1===r.length){var h=r.substr(0,o),p=r.substr(o+1,c-(o+1)).split(","),m=1;switch(h){case"rgba":if(p.length!==4)return null;m=M(p.pop());case"rgb":return p.length!==3?null:[E(p[0]),E(p[1]),E(p[2]),m];case"hsla":if(p.length!==4)return null;m=M(p.pop());case"hsl":if(p.length!==3)return null;var g=(parseFloat(p[0])%360+360)%360/360,b=M(p[1]),S=M(p[2]),C=S<=.5?S*(b+1):S+b-S*b,z=2*S-C;return[$(255*F(z,C,g+1/3)),$(255*F(z,C,g)),$(255*F(z,C,g-1/3)),m];default:return null}}return null}}catch{}class O{constructor(e,r,o,c=1){this.r=e,this.g=r,this.b=o,this.a=c}static parse(e){if(!e)return;if(e instanceof O)return e;if(typeof e!="string")return;const r=In(e);return r?new O(r[0]/255*r[3],r[1]/255*r[3],r[2]/255*r[3],r[3]):void 0}toString(){const[e,r,o,c]=this.toArray();return`rgba(${Math.round(e)},${Math.round(r)},${Math.round(o)},${c})`}toArray(){const{r:e,g:r,b:o,a:c}=this;return c===0?[0,0,0,0]:[255*e/c,255*r/c,255*o/c,c]}}O.black=new O(0,0,0,1),O.white=new O(1,1,1,1),O.transparent=new O(0,0,0,0),O.red=new O(1,0,0,1);class j{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}}class Q{constructor(e,r,o,c,h){this.text=e,this.image=r,this.scale=o,this.fontStack=c,this.textColor=h}}class H{constructor(e){this.sections=e}static fromString(e){return new H([new Q(e,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 H?e:H.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class X{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof X)return e;if(typeof e=="number")return new X([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 X(e)}}toString(){return JSON.stringify(this.values)}}class te{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new te({name:e,available:!1}):null}}function fe(i,e,r,o){return typeof i=="number"&&i>=0&&i<=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 [${[i,e,r,o].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof o=="number"?[i,e,r,o]:[i,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function be(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof O||i instanceof j||i instanceof H||i instanceof X||i instanceof te)return!0;if(Array.isArray(i)){for(const e of i)if(!be(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!be(i[e]))return!1;return!0}return!1}function pe(i){if(i===null)return $r;if(typeof i=="string")return ut;if(typeof i=="boolean")return at;if(typeof i=="number")return Ie;if(i instanceof O)return fi;if(i instanceof j)return Sr;if(i instanceof H)return si;if(i instanceof X)return En;if(i instanceof te)return Yt;if(Array.isArray(i)){const e=i.length;let r;for(const o of i){const c=pe(o);if(r){if(r===c)continue;r=ot;break}r=c}return Ei(r||ot,e)}return Ur}function Ne(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof O||i instanceof H||i instanceof X||i instanceof te?i.toString():JSON.stringify(i)}class qe{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(!be(e[1]))return r.error("invalid value");const o=e[1];let c=pe(o);const h=r.expectedType;return c.kind!=="array"||c.N!==0||!h||h.kind!=="array"||typeof h.N=="number"&&h.N!==0||(c=h),new qe(c,o)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Be{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const Ye={string:ut,number:Ie,boolean:at,object:Ur};class it{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,c=1;const h=e[0];if(h==="array"){let m,g;if(e.length>2){const b=e[1];if(typeof b!="string"||!(b in Ye)||b==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);m=Ye[b],c++}else m=ot;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);g=e[2],c++}o=Ei(m,g)}else{if(!Ye[h])throw new Error(`Types doesn't contain name = ${h}`);o=Ye[h]}const p=[];for(;c<e.length;c++){const m=r.parse(e[c],c,ot);if(!m)return null;p.push(m)}return new it(o,p)}evaluate(e){for(let r=0;r<this.args.length;r++){const o=this.args[r].evaluate(e);if(!fr(this.type,pe(o)))return o;if(r===this.args.length-1)throw new Be(`Expected value to be of type ${zt(this.type)}, but found ${zt(pe(o))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const wt={"to-boolean":at,"to-color":fi,"to-number":Ie,"to-string":ut};class nt{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(!wt[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 c=wt[o],h=[];for(let p=1;p<e.length;p++){const m=r.parse(e[p],p,ot);if(!m)return null;h.push(m)}return new nt(c,h)}evaluate(e){if(this.type.kind==="boolean")return Boolean(this.args[0].evaluate(e));if(this.type.kind==="color"){let r,o;for(const c of this.args){if(r=c.evaluate(e),o=null,r instanceof O)return r;if(typeof r=="string"){const h=e.parseColor(r);if(h)return h}else if(Array.isArray(r)&&(o=r.length<3||r.length>4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:fe(r[0],r[1],r[2],r[3]),!o))return new O(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new Be(o||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}if(this.type.kind==="padding"){let r;for(const o of this.args){r=o.evaluate(e);const c=X.parse(r);if(c)return c}throw new Be(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}if(this.type.kind==="number"){let r=null;for(const o of this.args){if(r=o.evaluate(e),r===null)return 0;const c=Number(r);if(!isNaN(c))return c}throw new Be(`Could not convert ${JSON.stringify(r)} to number.`)}return this.type.kind==="formatted"?H.fromString(Ne(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?te.fromString(Ne(this.args[0].evaluate(e))):Ne(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const ht=["Unknown","Point","LineString","Polygon"];class Tt{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?ht[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[e];return r||(r=this._parseColorCache[e]=O.parse(e)),r}}class Dt{constructor(e,r,o,c){this.name=e,this.type=r,this._evaluate=o,this.args=c}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],c=Dt.definitions[o];if(!c)return r.error(`Unknown expression "${o}". If you wanted a literal array, use ["literal", [...]].`,0);const h=Array.isArray(c)?c[0]:c.type,p=Array.isArray(c)?[[c[1],c[2]]]:c.overloads,m=p.filter(([b])=>!Array.isArray(b)||b.length===e.length-1);let g=null;for(const[b,S]of m){g=new Mn(r.registry,r.path,null,r.scope);const C=[];let z=!1;for(let L=1;L<e.length;L++){const R=e[L],q=Array.isArray(b)?b[L-1]:b.type,Z=g.parse(R,1+C.length,q);if(!Z){z=!0;break}C.push(Z)}if(!z)if(Array.isArray(b)&&b.length!==C.length)g.error(`Expected ${b.length} arguments, but found ${C.length} instead.`);else{for(let L=0;L<C.length;L++){const R=Array.isArray(b)?b[L]:b.type,q=C[L];g.concat(L+1).checkSubtype(R,q.type)}if(g.errors.length===0)return new Dt(o,h,S,C)}}if(m.length===1)r.errors.push(...g.errors);else{const b=(m.length?m:p).map(([C])=>{return z=C,Array.isArray(z)?`(${z.map(zt).join(", ")})`:`(${zt(z.type)}...)`;var z}).join(" | "),S=[];for(let C=1;C<e.length;C++){const z=r.parse(e[C],1+S.length);if(!z)return null;S.push(zt(z.type))}r.error(`Expected arguments of type ${b}, but found (${S.join(", ")}) instead.`)}return null}static register(e,r){Dt.definitions=r;for(const o in r)e[o]=Dt}}class ai{constructor(e,r,o){this.type=Sr,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 c=r.parse(o["case-sensitive"]!==void 0&&o["case-sensitive"],1,at);if(!c)return null;const h=r.parse(o["diacritic-sensitive"]!==void 0&&o["diacritic-sensitive"],1,at);if(!h)return null;let p=null;return o.locale&&(p=r.parse(o.locale,1,ut),!p)?null:new ai(c,h,p)}evaluate(e){return new j(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}}const Vt=8192;function _i(i,e){i[0]=Math.min(i[0],e[0]),i[1]=Math.min(i[1],e[1]),i[2]=Math.max(i[2],e[0]),i[3]=Math.max(i[3],e[1])}function Cn(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function Kn(i,e){const r=(180+i[0])/360,o=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,c=Math.pow(2,e.z);return[Math.round(r*c*Vt),Math.round(o*c*Vt)]}function Lt(i,e,r){const o=i[0]-e[0],c=i[1]-e[1],h=i[0]-r[0],p=i[1]-r[1];return o*p-h*c==0&&o*h<=0&&c*p<=0}function ls(i,e){let r=!1;for(let p=0,m=e.length;p<m;p++){const g=e[p];for(let b=0,S=g.length;b<S-1;b++){if(Lt(i,g[b],g[b+1]))return!1;(c=g[b])[1]>(o=i)[1]!=(h=g[b+1])[1]>o[1]&&o[0]<(h[0]-c[0])*(o[1]-c[1])/(h[1]-c[1])+c[0]&&(r=!r)}}var o,c,h;return r}function cs(i,e){for(let r=0;r<e.length;r++)if(ls(i,e[r]))return!0;return!1}function ga(i,e,r,o){const c=o[0]-r[0],h=o[1]-r[1],p=(i[0]-r[0])*h-c*(i[1]-r[1]),m=(e[0]-r[0])*h-c*(e[1]-r[1]);return p>0&&m<0||p<0&&m>0}function _a(i,e,r){for(const b of r)for(let S=0;S<b.length-1;++S)if((m=[(p=b[S+1])[0]-(h=b[S])[0],p[1]-h[1]])[0]*(g=[(c=e)[0]-(o=i)[0],c[1]-o[1]])[1]-m[1]*g[0]!=0&&ga(o,c,h,p)&&ga(h,p,o,c))return!0;var o,c,h,p,m,g;return!1}function us(i,e){for(let r=0;r<i.length;++r)if(!ls(i[r],e))return!1;for(let r=0;r<i.length-1;++r)if(_a(i[r],i[r+1],e))return!1;return!0}function Fl(i,e){for(let r=0;r<e.length;r++)if(us(i,e[r]))return!0;return!1}function Mo(i,e,r){const o=[];for(let c=0;c<i.length;c++){const h=[];for(let p=0;p<i[c].length;p++){const m=Kn(i[c][p],r);_i(e,m),h.push(m)}o.push(h)}return o}function hs(i,e,r){const o=[];for(let c=0;c<i.length;c++){const h=Mo(i[c],e,r);o.push(h)}return o}function ya(i,e,r,o){if(i[0]<r[0]||i[0]>r[2]){const c=.5*o;let h=i[0]-r[0]>c?-o:r[0]-i[0]>c?o:0;h===0&&(h=i[0]-r[2]>c?-o:r[2]-i[0]>c?o:0),i[0]+=h}_i(e,i)}function xa(i,e,r,o){const c=Math.pow(2,o.z)*Vt,h=[o.x*Vt,o.y*Vt],p=[];for(const m of i)for(const g of m){const b=[g.x+h[0],g.y+h[1]];ya(b,e,r,c),p.push(b)}return p}function va(i,e,r,o){const c=Math.pow(2,o.z)*Vt,h=[o.x*Vt,o.y*Vt],p=[];for(const g of i){const b=[];for(const S of g){const C=[S.x+h[0],S.y+h[1]];_i(e,C),b.push(C)}p.push(b)}if(e[2]-e[0]<=c/2){(m=e)[0]=m[1]=1/0,m[2]=m[3]=-1/0;for(const g of p)for(const b of g)ya(b,e,r,c)}var m;return p}class tn{constructor(e,r){this.type=at,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(be(e[1])){const o=e[1];if(o.type==="FeatureCollection")for(let c=0;c<o.features.length;++c){const h=o.features[c].geometry.type;if(h==="Polygon"||h==="MultiPolygon")return new tn(o,o.features[c].geometry)}else if(o.type==="Feature"){const c=o.geometry.type;if(c==="Polygon"||c==="MultiPolygon")return new tn(o,o.geometry)}else if(o.type==="Polygon"||o.type==="MultiPolygon")return new tn(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 c=[1/0,1/0,-1/0,-1/0],h=[1/0,1/0,-1/0,-1/0],p=r.canonicalID();if(o.type==="Polygon"){const m=Mo(o.coordinates,h,p),g=xa(r.geometry(),c,h,p);if(!Cn(c,h))return!1;for(const b of g)if(!ls(b,m))return!1}if(o.type==="MultiPolygon"){const m=hs(o.coordinates,h,p),g=xa(r.geometry(),c,h,p);if(!Cn(c,h))return!1;for(const b of g)if(!cs(b,m))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(r,o){const c=[1/0,1/0,-1/0,-1/0],h=[1/0,1/0,-1/0,-1/0],p=r.canonicalID();if(o.type==="Polygon"){const m=Mo(o.coordinates,h,p),g=va(r.geometry(),c,h,p);if(!Cn(c,h))return!1;for(const b of g)if(!us(b,m))return!1}if(o.type==="MultiPolygon"){const m=hs(o.coordinates,h,p),g=va(r.geometry(),c,h,p);if(!Cn(c,h))return!1;for(const b of g)if(!Fl(b,m))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}function Jn(i){if(i instanceof Dt&&(i.name==="get"&&i.args.length===1||i.name==="feature-state"||i.name==="has"&&i.args.length===1||i.name==="properties"||i.name==="geometry-type"||i.name==="id"||/^filter-/.test(i.name))||i instanceof tn)return!1;let e=!0;return i.eachChild(r=>{e&&!Jn(r)&&(e=!1)}),e}function An(i){if(i instanceof Dt&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!An(r)&&(e=!1)}),e}function Po(i,e){if(i instanceof Dt&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(o=>{r&&!Po(o,e)&&(r=!1)}),r}class zo{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 zo(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 Mn{constructor(e,r=[],o,c=new $i,h=[]){this.registry=e,this.path=r,this.key=r.map(p=>`[${p}]`).join(""),this.scope=c,this.errors=h,this.expectedType=o}parse(e,r,o,c,h={}){return r?this.concat(r,o,c)._parse(e,h):this._parse(e,h)}_parse(e,r){function o(c,h,p){return p==="assert"?new it(h,[c]):p==="coerce"?new nt(h,[c]):c}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 c=e[0];if(typeof c!="string")return this.error(`Expression name must be a string, but found ${typeof c} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const h=this.registry[c];if(h){let p=h.parse(e,this);if(!p)return null;if(this.expectedType){const m=this.expectedType,g=p.type;if(m.kind!=="string"&&m.kind!=="number"&&m.kind!=="boolean"&&m.kind!=="object"&&m.kind!=="array"||g.kind!=="value")if(m.kind!=="color"&&m.kind!=="formatted"&&m.kind!=="resolvedImage"||g.kind!=="value"&&g.kind!=="string")if(m.kind!=="padding"||g.kind!=="value"&&g.kind!=="number"&&g.kind!=="array"){if(this.checkSubtype(m,g))return null}else p=o(p,m,r.typeAnnotation||"coerce");else p=o(p,m,r.typeAnnotation||"coerce");else p=o(p,m,r.typeAnnotation||"assert")}if(!(p instanceof qe)&&p.type.kind!=="resolvedImage"&&ds(p)){const m=new Tt;try{p=new qe(p.type,p.evaluate(m))}catch(g){return this.error(g.message),null}}return p}return this.error(`Unknown expression "${c}". 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 c=typeof e=="number"?this.path.concat(e):this.path,h=o?this.scope.concat(o):this.scope;return new Mn(this.registry,c,r||null,h,this.errors)}error(e,...r){const o=`${this.key}${r.map(c=>`[${c}]`).join("")}`;this.errors.push(new Oi(o,e))}checkSubtype(e,r){const o=fr(e,r);return o&&this.error(o),o}}function ds(i){if(i instanceof zo)return ds(i.boundExpression);if(i instanceof Dt&&i.name==="error"||i instanceof ai||i instanceof tn)return!1;const e=i instanceof nt||i instanceof it;let r=!0;return i.eachChild(o=>{r=e?r&&ds(o):r&&o instanceof qe}),!!r&&Jn(i)&&Po(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function ko(i,e){const r=i.length-1;let o,c,h=0,p=r,m=0;for(;h<=p;)if(m=Math.floor((h+p)/2),o=i[m],c=i[m+1],o<=e){if(m===r||e<c)return m;h=m+1}else{if(!(o>e))throw new Be("Input is not a number.");p=m-1}return 0}class Yn{constructor(e,r,o){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(const[c,h]of o)this.labels.push(c),this.outputs.push(h)}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,Ie);if(!o)return null;const c=[];let h=null;r.expectedType&&r.expectedType.kind!=="value"&&(h=r.expectedType);for(let p=1;p<e.length;p+=2){const m=p===1?-1/0:e[p],g=e[p+1],b=p,S=p+1;if(typeof m!="number")return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',b);if(c.length&&c[c.length-1][0]>=m)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',b);const C=r.parse(g,S,h);if(!C)return null;h=h||C.type,c.push([m,C])}return new Yn(h,o,c)}evaluate(e){const r=this.labels,o=this.outputs;if(r.length===1)return o[0].evaluate(e);const c=this.input.evaluate(e);if(c<=r[0])return o[0].evaluate(e);const h=r.length;return c>=r[h-1]?o[h-1].evaluate(e):o[ko(r,c)].evaluate(e)}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function Nt(i,e,r){return i*(1-r)+e*r}var Qn=Object.freeze({__proto__:null,number:Nt,color:function(i,e,r){return new O(Nt(i.r,e.r,r),Nt(i.g,e.g,r),Nt(i.b,e.b,r),Nt(i.a,e.a,r))},array:function(i,e,r){return i.map((o,c)=>Nt(o,e[c],r))},padding:function(i,e,r){const o=i.values,c=e.values;return new X([Nt(o[0],c[0],r),Nt(o[1],c[1],r),Nt(o[2],c[2],r),Nt(o[3],c[3],r)])}});const ba=.95047,wa=1.08883,ps=4/29,Do=6/29,Ta=3*Do*Do,Ol=Math.PI/180,$l=180/Math.PI;function fs(i){return i>.008856451679035631?Math.pow(i,1/3):i/Ta+ps}function ms(i){return i>Do?i*i*i:Ta*(i-ps)}function gs(i){return 255*(i<=.0031308?12.92*i:1.055*Math.pow(i,1/2.4)-.055)}function _s(i){return(i/=255)<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function St(i){const e=_s(i.r),r=_s(i.g),o=_s(i.b),c=fs((.4124564*e+.3575761*r+.1804375*o)/ba),h=fs((.2126729*e+.7151522*r+.072175*o)/1);return{l:116*h-16,a:500*(c-h),b:200*(h-fs((.0193339*e+.119192*r+.9503041*o)/wa)),alpha:i.a}}function Ea(i){let e=(i.l+16)/116,r=isNaN(i.a)?e:e+i.a/500,o=isNaN(i.b)?e:e-i.b/200;return e=1*ms(e),r=ba*ms(r),o=wa*ms(o),new O(gs(3.2404542*r-1.5371385*e-.4985314*o),gs(-.969266*r+1.8760108*e+.041556*o),gs(.0556434*r-.2040259*e+1.0572252*o),i.alpha)}function Ul(i,e,r){const o=e-i;return i+r*(o>180||o<-180?o-360*Math.round(o/360):o)}const eo={forward:St,reverse:Ea,interpolate:function(i,e,r){return{l:Nt(i.l,e.l,r),a:Nt(i.a,e.a,r),b:Nt(i.b,e.b,r),alpha:Nt(i.alpha,e.alpha,r)}}},to={forward:function(i){const{l:e,a:r,b:o}=St(i),c=Math.atan2(o,r)*$l;return{h:c<0?c+360:c,c:Math.sqrt(r*r+o*o),l:e,alpha:i.a}},reverse:function(i){const e=i.h*Ol,r=i.c;return Ea({l:i.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:i.alpha})},interpolate:function(i,e,r){return{h:Ul(i.h,e.h,r),c:Nt(i.c,e.c,r),l:Nt(i.l,e.l,r),alpha:Nt(i.alpha,e.alpha,r)}}};var Sa=Object.freeze({__proto__:null,lab:eo,hcl:to});class Ui{constructor(e,r,o,c,h){this.type=e,this.operator=r,this.interpolation=o,this.input=c,this.labels=[],this.outputs=[];for(const[p,m]of h)this.labels.push(p),this.outputs.push(m)}static interpolationFactor(e,r,o,c){let h=0;if(e.name==="exponential")h=ys(r,e.base,o,c);else if(e.name==="linear")h=ys(r,1,o,c);else if(e.name==="cubic-bezier"){const p=e.controlPoints;h=new W(p[0],p[1],p[2],p[3]).solve(ys(r,1,o,c))}return h}static parse(e,r){let[o,c,h,...p]=e;if(!Array.isArray(c)||c.length===0)return r.error("Expected an interpolation type expression.",1);if(c[0]==="linear")c={name:"linear"};else if(c[0]==="exponential"){const b=c[1];if(typeof b!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);c={name:"exponential",base:b}}else{if(c[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(c[0])}`,1,0);{const b=c.slice(1);if(b.length!==4||b.some(S=>typeof S!="number"||S<0||S>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);c={name:"cubic-bezier",controlPoints:b}}}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(h=r.parse(h,2,Ie),!h)return null;const m=[];let g=null;o==="interpolate-hcl"||o==="interpolate-lab"?g=fi:r.expectedType&&r.expectedType.kind!=="value"&&(g=r.expectedType);for(let b=0;b<p.length;b+=2){const S=p[b],C=p[b+1],z=b+3,L=b+4;if(typeof S!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',z);if(m.length&&m[m.length-1][0]>=S)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',z);const R=r.parse(C,L,g);if(!R)return null;g=g||R.type,m.push([S,R])}return g.kind==="number"||g.kind==="color"||g.kind==="padding"||g.kind==="array"&&g.itemType.kind==="number"&&typeof g.N=="number"?new Ui(g,o,c,h,m):r.error(`Type ${zt(g)} is not interpolatable.`)}evaluate(e){const r=this.labels,o=this.outputs;if(r.length===1)return o[0].evaluate(e);const c=this.input.evaluate(e);if(c<=r[0])return o[0].evaluate(e);const h=r.length;if(c>=r[h-1])return o[h-1].evaluate(e);const p=ko(r,c),m=Ui.interpolationFactor(this.interpolation,c,r[p],r[p+1]),g=o[p].evaluate(e),b=o[p+1].evaluate(e);return this.operator==="interpolate"?Qn[this.type.kind.toLowerCase()](g,b,m):this.operator==="interpolate-hcl"?to.reverse(to.interpolate(to.forward(g),to.forward(b),m)):eo.reverse(eo.interpolate(eo.forward(g),eo.forward(b),m))}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function ys(i,e,r,o){const c=o-r,h=i-r;return c===0?0:e===1?h/c:(Math.pow(e,h)-1)/(Math.pow(e,c)-1)}class Lo{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expectected at least one argument.");let o=null;const c=r.expectedType;c&&c.kind!=="value"&&(o=c);const h=[];for(const m of e.slice(1)){const g=r.parse(m,1+h.length,o,void 0,{typeAnnotation:"omit"});if(!g)return null;o=o||g.type,h.push(g)}if(!o)throw new Error("No output type");const p=c&&h.some(m=>fr(c,m.type));return new Lo(p?ot:o,h)}evaluate(e){let r,o=null,c=0;for(const h of this.args)if(c++,o=h.evaluate(e),o&&o instanceof te&&!o.available&&(r||(r=o.name),o=null,c===this.args.length&&(o=r)),o!==null)break;return o}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}class Ro{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 h=1;h<e.length-1;h+=2){const p=e[h];if(typeof p!="string")return r.error(`Expected string, but found ${typeof p} instead.`,h);if(/[^a-zA-Z0-9_]/.test(p))return r.error("Variable names must contain only alphanumeric characters or '_'.",h);const m=r.parse(e[h+1],h+1);if(!m)return null;o.push([p,m])}const c=r.parse(e[e.length-1],e.length-1,r.expectedType,o);return c?new Ro(o,c):null}outputDefined(){return this.result.outputDefined()}}class xs{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,Ie),c=r.parse(e[2],2,Ei(r.expectedType||ot));return o&&c?new xs(c.type.itemType,o,c):null}evaluate(e){const r=this.index.evaluate(e),o=this.input.evaluate(e);if(r<0)throw new Be(`Array index out of bounds: ${r} < 0.`);if(r>=o.length)throw new Be(`Array index out of bounds: ${r} > ${o.length-1}.`);if(r!==Math.floor(r))throw new Be(`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 vs{constructor(e,r){this.type=at,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,ot),c=r.parse(e[2],2,ot);return o&&c?Yr(o.type,[at,ut,Ie,$r,ot])?new vs(o,c):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${zt(o.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),o=this.haystack.evaluate(e);if(!o)return!1;if(!Qr(r,["boolean","string","number","null"]))throw new Be(`Expected first argument to be of type boolean, string, number or null, but found ${zt(pe(r))} instead.`);if(!Qr(o,["string","array"]))throw new Be(`Expected second argument to be of type array or string, but found ${zt(pe(o))} instead.`);return o.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Bo{constructor(e,r,o){this.type=Ie,this.needle=e,this.haystack=r,this.fromIndex=o}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const o=r.parse(e[1],1,ot),c=r.parse(e[2],2,ot);if(!o||!c)return null;if(!Yr(o.type,[at,ut,Ie,$r,ot]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${zt(o.type)} instead`);if(e.length===4){const h=r.parse(e[3],3,Ie);return h?new Bo(o,c,h):null}return new Bo(o,c)}evaluate(e){const r=this.needle.evaluate(e),o=this.haystack.evaluate(e);if(!Qr(r,["boolean","string","number","null"]))throw new Be(`Expected first argument to be of type boolean, string, number or null, but found ${zt(pe(r))} instead.`);if(!Qr(o,["string","array"]))throw new Be(`Expected second argument to be of type array or string, but found ${zt(pe(o))} instead.`);if(this.fromIndex){const c=this.fromIndex.evaluate(e);return o.indexOf(r,c)}return o.indexOf(r)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class bs{constructor(e,r,o,c,h,p){this.inputType=e,this.type=r,this.input=o,this.cases=c,this.outputs=h,this.otherwise=p}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,c;r.expectedType&&r.expectedType.kind!=="value"&&(c=r.expectedType);const h={},p=[];for(let b=2;b<e.length-1;b+=2){let S=e[b];const C=e[b+1];Array.isArray(S)||(S=[S]);const z=r.concat(b);if(S.length===0)return z.error("Expected at least one branch label.");for(const R of S){if(typeof R!="number"&&typeof R!="string")return z.error("Branch labels must be numbers or strings.");if(typeof R=="number"&&Math.abs(R)>Number.MAX_SAFE_INTEGER)return z.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof R=="number"&&Math.floor(R)!==R)return z.error("Numeric branch labels must be integer values.");if(o){if(z.checkSubtype(o,pe(R)))return null}else o=pe(R);if(h[String(R)]!==void 0)return z.error("Branch labels must be unique.");h[String(R)]=p.length}const L=r.parse(C,b,c);if(!L)return null;c=c||L.type,p.push(L)}const m=r.parse(e[1],1,ot);if(!m)return null;const g=r.parse(e[e.length-1],e.length-1,c);return g?m.type.kind!=="value"&&r.concat(1).checkSubtype(o,m.type)?null:new bs(o,c,m,h,p,g):null}evaluate(e){const r=this.input.evaluate(e);return(pe(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 ws{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 c=[];for(let p=1;p<e.length-1;p+=2){const m=r.parse(e[p],p,at);if(!m)return null;const g=r.parse(e[p+1],p+1,o);if(!g)return null;c.push([m,g]),o=o||g.type}const h=r.parse(e[e.length-1],e.length-1,o);if(!h)return null;if(!o)throw new Error("Can't infer output type");return new ws(o,c,h)}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 Fo{constructor(e,r,o,c){this.type=e,this.input=r,this.beginIndex=o,this.endIndex=c}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const o=r.parse(e[1],1,ot),c=r.parse(e[2],2,Ie);if(!o||!c)return null;if(!Yr(o.type,[Ei(ot),ut,ot]))return r.error(`Expected first argument to be of type array or string, but found ${zt(o.type)} instead`);if(e.length===4){const h=r.parse(e[3],3,Ie);return h?new Fo(o.type,o,c,h):null}return new Fo(o.type,o,c)}evaluate(e){const r=this.input.evaluate(e),o=this.beginIndex.evaluate(e);if(!Qr(r,["string","array"]))throw new Be(`Expected first argument to be of type array or string, but found ${zt(pe(r))} instead.`);if(this.endIndex){const c=this.endIndex.evaluate(e);return r.slice(o,c)}return r.slice(o)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Ia(i,e){return i==="=="||i==="!="?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 Ca(i,e,r,o){return o.compare(e,r)===0}function Pn(i,e,r){const o=i!=="=="&&i!=="!=";return class xd{constructor(h,p,m){this.type=at,this.lhs=h,this.rhs=p,this.collator=m,this.hasUntypedArgument=h.type.kind==="value"||p.type.kind==="value"}static parse(h,p){if(h.length!==3&&h.length!==4)return p.error("Expected two or three arguments.");const m=h[0];let g=p.parse(h[1],1,ot);if(!g)return null;if(!Ia(m,g.type))return p.concat(1).error(`"${m}" comparisons are not supported for type '${zt(g.type)}'.`);let b=p.parse(h[2],2,ot);if(!b)return null;if(!Ia(m,b.type))return p.concat(2).error(`"${m}" comparisons are not supported for type '${zt(b.type)}'.`);if(g.type.kind!==b.type.kind&&g.type.kind!=="value"&&b.type.kind!=="value")return p.error(`Cannot compare types '${zt(g.type)}' and '${zt(b.type)}'.`);o&&(g.type.kind==="value"&&b.type.kind!=="value"?g=new it(b.type,[g]):g.type.kind!=="value"&&b.type.kind==="value"&&(b=new it(g.type,[b])));let S=null;if(h.length===4){if(g.type.kind!=="string"&&b.type.kind!=="string"&&g.type.kind!=="value"&&b.type.kind!=="value")return p.error("Cannot use collator to compare non-string types.");if(S=p.parse(h[3],3,Sr),!S)return null}return new xd(g,b,S)}evaluate(h){const p=this.lhs.evaluate(h),m=this.rhs.evaluate(h);if(o&&this.hasUntypedArgument){const g=pe(p),b=pe(m);if(g.kind!==b.kind||g.kind!=="string"&&g.kind!=="number")throw new Be(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${g.kind}, ${b.kind}) instead.`)}if(this.collator&&!o&&this.hasUntypedArgument){const g=pe(p),b=pe(m);if(g.kind!=="string"||b.kind!=="string")return e(h,p,m)}return this.collator?r(h,p,m,this.collator.evaluate(h)):e(h,p,m)}eachChild(h){h(this.lhs),h(this.rhs),this.collator&&h(this.collator)}outputDefined(){return!0}}}const Vl=Pn("==",function(i,e,r){return e===r},Ca),Nl=Pn("!=",function(i,e,r){return e!==r},function(i,e,r,o){return!Ca(0,e,r,o)}),Gl=Pn("<",function(i,e,r){return e<r},function(i,e,r,o){return o.compare(e,r)<0}),Zl=Pn(">",function(i,e,r){return e>r},function(i,e,r,o){return o.compare(e,r)>0}),ql=Pn("<=",function(i,e,r){return e<=r},function(i,e,r,o){return o.compare(e,r)<=0}),jl=Pn(">=",function(i,e,r){return e>=r},function(i,e,r,o){return o.compare(e,r)>=0});class Ts{constructor(e,r,o,c,h){this.type=ut,this.number=e,this.locale=r,this.currency=o,this.minFractionDigits=c,this.maxFractionDigits=h}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");const o=r.parse(e[1],1,Ie);if(!o)return null;const c=e[2];if(typeof c!="object"||Array.isArray(c))return r.error("NumberFormat options argument must be an object.");let h=null;if(c.locale&&(h=r.parse(c.locale,1,ut),!h))return null;let p=null;if(c.currency&&(p=r.parse(c.currency,1,ut),!p))return null;let m=null;if(c["min-fraction-digits"]&&(m=r.parse(c["min-fraction-digits"],1,Ie),!m))return null;let g=null;return c["max-fraction-digits"]&&(g=r.parse(c["max-fraction-digits"],1,Ie),!g)?null:new Ts(o,h,p,m,g)}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 Oo{constructor(e){this.type=si,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 c=[];let h=!1;for(let p=1;p<=e.length-1;++p){const m=e[p];if(h&&typeof m=="object"&&!Array.isArray(m)){h=!1;let g=null;if(m["font-scale"]&&(g=r.parse(m["font-scale"],1,Ie),!g))return null;let b=null;if(m["text-font"]&&(b=r.parse(m["text-font"],1,Ei(ut)),!b))return null;let S=null;if(m["text-color"]&&(S=r.parse(m["text-color"],1,fi),!S))return null;const C=c[c.length-1];C.scale=g,C.font=b,C.textColor=S}else{const g=r.parse(e[p],1,ot);if(!g)return null;const b=g.type.kind;if(b!=="string"&&b!=="value"&&b!=="null"&&b!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");h=!0,c.push({content:g,scale:null,font:null,textColor:null})}}return new Oo(c)}evaluate(e){return new H(this.sections.map(r=>{const o=r.content.evaluate(e);return pe(o)===Yt?new Q("",o,null,null,null):new Q(Ne(o),null,r.scale?r.scale.evaluate(e):null,r.font?r.font.evaluate(e).join(","):null,r.textColor?r.textColor.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)}outputDefined(){return!1}}class Es{constructor(e){this.type=Yt,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const o=r.parse(e[1],1,ut);return o?new Es(o):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),o=te.fromString(r);return o&&e.availableImages&&(o.available=e.availableImages.indexOf(r)>-1),o}eachChild(e){e(this.input)}outputDefined(){return!1}}class Ss{constructor(e){this.type=Ie,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 ${zt(o.type)} instead.`):new Ss(o):null}evaluate(e){const r=this.input.evaluate(e);if(typeof r=="string"||Array.isArray(r))return r.length;throw new Be(`Expected value to be of type string or array, but found ${zt(pe(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const zn={"==":Vl,"!=":Nl,">":Zl,"<":Gl,">=":jl,"<=":ql,array:it,at:xs,boolean:it,case:ws,coalesce:Lo,collator:ai,format:Oo,image:Es,in:vs,"index-of":Bo,interpolate:Ui,"interpolate-hcl":Ui,"interpolate-lab":Ui,length:Ss,let:Ro,literal:qe,match:bs,number:it,"number-format":Ts,object:it,slice:Fo,step:Yn,string:it,"to-boolean":nt,"to-color":nt,"to-number":nt,"to-string":nt,var:zo,within:tn};function Aa(i,[e,r,o,c]){e=e.evaluate(i),r=r.evaluate(i),o=o.evaluate(i);const h=c?c.evaluate(i):1,p=fe(e,r,o,h);if(p)throw new Be(p);return new O(e/255*h,r/255*h,o/255*h,h)}function Ma(i,e){return i in e}function $o(i,e){const r=e[i];return r===void 0?null:r}function rn(i){return{type:i}}function Pa(i){return{result:"success",value:i}}function kn(i){return{result:"error",value:i}}function Ot(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function za(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function yt(i){return!!i.expression&&i.expression.interpolated}function It(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function Bt(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Gt(i){return i}function io(i,e){const r=e.type==="color",o=i.stops&&typeof i.stops[0][0]=="object",c=o||!(o||i.property!==void 0),h=i.type||(yt(e)?"exponential":"interval");if(r||e.type==="padding"){const b=r?O.parse:X.parse;(i=rr({},i)).stops&&(i.stops=i.stops.map(S=>[S[0],b(S[1])])),i.default=b(i.default?i.default:e.default)}if(i.colorSpace&&i.colorSpace!=="rgb"&&!Sa[i.colorSpace])throw new Error(`Unknown color space: ${i.colorSpace}`);let p,m,g;if(h==="exponential")p=ka;else if(h==="interval")p=Wl;else if(h==="categorical"){p=Xl,m=Object.create(null);for(const b of i.stops)m[b[0]]=b[1];g=typeof i.stops[0][0]}else{if(h!=="identity")throw new Error(`Unknown function type "${h}"`);p=Hl}if(o){const b={},S=[];for(let L=0;L<i.stops.length;L++){const R=i.stops[L],q=R[0].zoom;b[q]===void 0&&(b[q]={zoom:q,type:i.type,property:i.property,default:i.default,stops:[]},S.push(q)),b[q].stops.push([R[0].value,R[1]])}const C=[];for(const L of S)C.push([b[L].zoom,io(b[L],e)]);const z={name:"linear"};return{kind:"composite",interpolationType:z,interpolationFactor:Ui.interpolationFactor.bind(void 0,z),zoomStops:C.map(L=>L[0]),evaluate:({zoom:L},R)=>ka({stops:C,base:i.base},e,L).evaluate(L,R)}}if(c){const b=h==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:b,interpolationFactor:Ui.interpolationFactor.bind(void 0,b),zoomStops:i.stops.map(S=>S[0]),evaluate:({zoom:S})=>p(i,e,S,m,g)}}return{kind:"source",evaluate(b,S){const C=S&&S.properties?S.properties[i.property]:void 0;return C===void 0?Dn(i.default,e.default):p(i,e,C,m,g)}}}function Dn(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function Xl(i,e,r,o,c){return Dn(typeof r===c?o[r]:void 0,i.default,e.default)}function Wl(i,e,r){if(It(r)!=="number")return Dn(i.default,e.default);const o=i.stops.length;if(o===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[o-1][0])return i.stops[o-1][1];const c=ko(i.stops.map(h=>h[0]),r);return i.stops[c][1]}function ka(i,e,r){const o=i.base!==void 0?i.base:1;if(It(r)!=="number")return Dn(i.default,e.default);const c=i.stops.length;if(c===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[c-1][0])return i.stops[c-1][1];const h=ko(i.stops.map(S=>S[0]),r),p=function(S,C,z,L){const R=L-z,q=S-z;return R===0?0:C===1?q/R:(Math.pow(C,q)-1)/(Math.pow(C,R)-1)}(r,o,i.stops[h][0],i.stops[h+1][0]),m=i.stops[h][1],g=i.stops[h+1][1];let b=Qn[e.type]||Gt;if(i.colorSpace&&i.colorSpace!=="rgb"){const S=Sa[i.colorSpace];b=(C,z)=>S.reverse(S.interpolate(S.forward(C),S.forward(z),p))}return typeof m.evaluate=="function"?{evaluate(...S){const C=m.evaluate.apply(void 0,S),z=g.evaluate.apply(void 0,S);if(C!==void 0&&z!==void 0)return b(C,z,p)}}:b(m,g,p)}function Hl(i,e,r){switch(e.type){case"color":r=O.parse(r);break;case"formatted":r=H.fromString(r.toString());break;case"resolvedImage":r=te.fromString(r.toString());break;case"padding":r=X.parse(r);break;default:It(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0)}return Dn(r,i.default,e.default)}Dt.register(zn,{error:[{kind:"error"},[ut],(i,[e])=>{throw new Be(e.evaluate(i))}],typeof:[ut,[ot],(i,[e])=>zt(pe(e.evaluate(i)))],"to-rgba":[Ei(Ie,4),[fi],(i,[e])=>e.evaluate(i).toArray()],rgb:[fi,[Ie,Ie,Ie],Aa],rgba:[fi,[Ie,Ie,Ie,Ie],Aa],has:{type:at,overloads:[[[ut],(i,[e])=>Ma(e.evaluate(i),i.properties())],[[ut,Ur],(i,[e,r])=>Ma(e.evaluate(i),r.evaluate(i))]]},get:{type:ot,overloads:[[[ut],(i,[e])=>$o(e.evaluate(i),i.properties())],[[ut,Ur],(i,[e,r])=>$o(e.evaluate(i),r.evaluate(i))]]},"feature-state":[ot,[ut],(i,[e])=>$o(e.evaluate(i),i.featureState||{})],properties:[Ur,[],i=>i.properties()],"geometry-type":[ut,[],i=>i.geometryType()],id:[ot,[],i=>i.id()],zoom:[Ie,[],i=>i.globals.zoom],"heatmap-density":[Ie,[],i=>i.globals.heatmapDensity||0],"line-progress":[Ie,[],i=>i.globals.lineProgress||0],accumulated:[ot,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[Ie,rn(Ie),(i,e)=>{let r=0;for(const o of e)r+=o.evaluate(i);return r}],"*":[Ie,rn(Ie),(i,e)=>{let r=1;for(const o of e)r*=o.evaluate(i);return r}],"-":{type:Ie,overloads:[[[Ie,Ie],(i,[e,r])=>e.evaluate(i)-r.evaluate(i)],[[Ie],(i,[e])=>-e.evaluate(i)]]},"/":[Ie,[Ie,Ie],(i,[e,r])=>e.evaluate(i)/r.evaluate(i)],"%":[Ie,[Ie,Ie],(i,[e,r])=>e.evaluate(i)%r.evaluate(i)],ln2:[Ie,[],()=>Math.LN2],pi:[Ie,[],()=>Math.PI],e:[Ie,[],()=>Math.E],"^":[Ie,[Ie,Ie],(i,[e,r])=>Math.pow(e.evaluate(i),r.evaluate(i))],sqrt:[Ie,[Ie],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[Ie,[Ie],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[Ie,[Ie],(i,[e])=>Math.log(e.evaluate(i))],log2:[Ie,[Ie],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[Ie,[Ie],(i,[e])=>Math.sin(e.evaluate(i))],cos:[Ie,[Ie],(i,[e])=>Math.cos(e.evaluate(i))],tan:[Ie,[Ie],(i,[e])=>Math.tan(e.evaluate(i))],asin:[Ie,[Ie],(i,[e])=>Math.asin(e.evaluate(i))],acos:[Ie,[Ie],(i,[e])=>Math.acos(e.evaluate(i))],atan:[Ie,[Ie],(i,[e])=>Math.atan(e.evaluate(i))],min:[Ie,rn(Ie),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[Ie,rn(Ie),(i,e)=>Math.max(...e.map(r=>r.evaluate(i)))],abs:[Ie,[Ie],(i,[e])=>Math.abs(e.evaluate(i))],round:[Ie,[Ie],(i,[e])=>{const r=e.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[Ie,[Ie],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[Ie,[Ie],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[at,[ut,ot],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[at,[ot],(i,[e])=>i.id()===e.value],"filter-type-==":[at,[ut],(i,[e])=>i.geometryType()===e.value],"filter-<":[at,[ut,ot],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o<c}],"filter-id-<":[at,[ot],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r<o}],"filter->":[at,[ut,ot],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o>c}],"filter-id->":[at,[ot],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r>o}],"filter-<=":[at,[ut,ot],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o<=c}],"filter-id-<=":[at,[ot],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r<=o}],"filter->=":[at,[ut,ot],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o>=c}],"filter-id->=":[at,[ot],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r>=o}],"filter-has":[at,[ot],(i,[e])=>e.value in i.properties()],"filter-has-id":[at,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[at,[Ei(ut)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[at,[Ei(ot)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[at,[ut,Ei(ot)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[at,[ut,Ei(ot)],(i,[e,r])=>function(o,c,h,p){for(;h<=p;){const m=h+p>>1;if(c[m]===o)return!0;c[m]>o?p=m-1:h=m+1}return!1}(i.properties()[e.value],r.value,0,r.value.length-1)],all:{type:at,overloads:[[[at,at],(i,[e,r])=>e.evaluate(i)&&r.evaluate(i)],[rn(at),(i,e)=>{for(const r of e)if(!r.evaluate(i))return!1;return!0}]]},any:{type:at,overloads:[[[at,at],(i,[e,r])=>e.evaluate(i)||r.evaluate(i)],[rn(at),(i,e)=>{for(const r of e)if(r.evaluate(i))return!0;return!1}]]},"!":[at,[at],(i,[e])=>!e.evaluate(i)],"is-supported-script":[at,[ut],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[ut,[ut],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[ut,[ut],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[ut,rn(ot),(i,e)=>e.map(r=>Ne(r.evaluate(i))).join("")],"resolved-locale":[ut,[Sr],(i,[e])=>e.evaluate(i).resolvedLocale()]});class Uo{constructor(e,r){this.expression=e,this._warningHistory={},this._evaluator=new Tt,this._defaultValue=r?function(o){return o.type==="color"&&Bt(o.default)?new O(0,0,0,0):o.type==="color"?O.parse(o.default)||null:o.type==="padding"?X.parse(o.default)||null:o.default===void 0?null:o.default}(r):null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,o,c,h,p){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=o,this._evaluator.canonical=c,this._evaluator.availableImages=h||null,this._evaluator.formattedSection=p,this.expression.evaluate(this._evaluator)}evaluate(e,r,o,c,h,p){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=o||null,this._evaluator.canonical=c,this._evaluator.availableImages=h||null,this._evaluator.formattedSection=p||null;try{const m=this.expression.evaluate(this._evaluator);if(m==null||typeof m=="number"&&m!=m)return this._defaultValue;if(this._enumValues&&!(m in this._enumValues))throw new Be(`Expected value to be one of ${Object.keys(this._enumValues).map(g=>JSON.stringify(g)).join(", ")}, but found ${JSON.stringify(m)} instead.`);return m}catch(m){return this._warningHistory[m.message]||(this._warningHistory[m.message]=!0,typeof console!="undefined"&&console.warn(m.message)),this._defaultValue}}}function ro(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in zn}function no(i,e){const r=new Mn(zn,[],e?function(c){const h={color:fi,string:ut,number:Ie,enum:ut,boolean:at,formatted:si,padding:En,resolvedImage:Yt};return c.type==="array"?Ei(h[c.value]||ot,c.length):h[c.type]}(e):void 0),o=r.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return o?Pa(new Uo(o,e)):kn(r.errors)}class oo{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!An(r.expression)}evaluateWithoutErrorHandling(e,r,o,c,h,p){return this._styleExpression.evaluateWithoutErrorHandling(e,r,o,c,h,p)}evaluate(e,r,o,c,h,p){return this._styleExpression.evaluate(e,r,o,c,h,p)}}class Is{constructor(e,r,o,c){this.kind=e,this.zoomStops=o,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!An(r.expression),this.interpolationType=c}evaluateWithoutErrorHandling(e,r,o,c,h,p){return this._styleExpression.evaluateWithoutErrorHandling(e,r,o,c,h,p)}evaluate(e,r,o,c,h,p){return this._styleExpression.evaluate(e,r,o,c,h,p)}interpolationFactor(e,r,o){return this.interpolationType?Ui.interpolationFactor(this.interpolationType,e,r,o):0}}function Da(i,e){const r=no(i,e);if(r.result==="error")return r;const o=r.value.expression,c=Jn(o);if(!c&&!Ot(e))return kn([new Oi("","data expressions not supported")]);const h=Po(o,["zoom"]);if(!h&&!za(e))return kn([new Oi("","zoom expressions not supported")]);const p=No(o);return p||h?p instanceof Oi?kn([p]):p instanceof Ui&&!yt(e)?kn([new Oi("",'"interpolate" expressions cannot be used with this property')]):Pa(p?new Is(c?"camera":"composite",r.value,p.labels,p instanceof Ui?p.interpolation:void 0):new oo(c?"constant":"source",r.value)):kn([new Oi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Vo{constructor(e,r){this._parameters=e,this._specification=r,rr(this,io(this._parameters,this._specification))}static deserialize(e){return new Vo(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function No(i){let e=null;if(i instanceof Ro)e=No(i.result);else if(i instanceof Lo){for(const r of i.args)if(e=No(r),e)break}else(i instanceof Yn||i instanceof Ui)&&i.input instanceof Dt&&i.input.name==="zoom"&&(e=i);return e instanceof Oi||i.eachChild(r=>{const o=No(r);o instanceof Oi?e=o:!e&&o?e=new Oi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&o&&e!==o&&(e=new Oi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function nr(i){const e=i.key,r=i.value,o=i.valueSpec||{},c=i.objectElementValidators||{},h=i.style,p=i.styleSpec;let m=[];const g=It(r);if(g!=="object")return[new Pe(e,r,`object expected, ${g} found`)];for(const b in r){const S=b.split(".")[0],C=o[S]||o["*"];let z;if(c[S])z=c[S];else if(o[S])z=Ni;else if(c["*"])z=c["*"];else{if(!o["*"]){m.push(new Pe(e,r[b],`unknown property "${b}"`));continue}z=Ni}m=m.concat(z({key:(e&&`${e}.`)+b,value:r[b],valueSpec:C,style:h,styleSpec:p,object:r,objectKey:b},r))}for(const b in o)c[b]||o[b].required&&o[b].default===void 0&&r[b]===void 0&&m.push(new Pe(e,r,`missing required property "${b}"`));return m}function La(i){const e=i.value,r=i.valueSpec,o=i.style,c=i.styleSpec,h=i.key,p=i.arrayElementValidator||Ni;if(It(e)!=="array")return[new Pe(h,e,`array expected, ${It(e)} found`)];if(r.length&&e.length!==r.length)return[new Pe(h,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new Pe(h,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let m={type:r.value,values:r.values};c.$version<7&&(m.function=r.function),It(r.value)==="object"&&(m=r.value);let g=[];for(let b=0;b<e.length;b++)g=g.concat(p({array:e,arrayIndex:b,value:e[b],valueSpec:m,style:o,styleSpec:c,key:`${h}[${b}]`}));return g}function Cs(i){const e=i.key,r=i.value,o=i.valueSpec;let c=It(r);return c==="number"&&r!=r&&(c="NaN"),c!=="number"?[new Pe(e,r,`number expected, ${c} found`)]:"minimum"in o&&r<o.minimum?[new Pe(e,r,`${r} is less than the minimum value ${o.minimum}`)]:"maximum"in o&&r>o.maximum?[new Pe(e,r,`${r} is greater than the maximum value ${o.maximum}`)]:[]}function Ra(i){const e=i.valueSpec,r=bt(i.value.type);let o,c,h,p={};const m=r!=="categorical"&&i.value.property===void 0,g=!m,b=It(i.value.stops)==="array"&&It(i.value.stops[0])==="array"&&It(i.value.stops[0][0])==="object",S=nr({key:i.key,value:i.value,valueSpec:i.styleSpec.function,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(L){if(r==="identity")return[new Pe(L.key,L.value,'identity function may not have a "stops" property')];let R=[];const q=L.value;return R=R.concat(La({key:L.key,value:q,valueSpec:L.valueSpec,style:L.style,styleSpec:L.styleSpec,arrayElementValidator:C})),It(q)==="array"&&q.length===0&&R.push(new Pe(L.key,q,"array must have at least one stop")),R},default:function(L){return Ni({key:L.key,value:L.value,valueSpec:e,style:L.style,styleSpec:L.styleSpec})}}});return r==="identity"&&m&&S.push(new Pe(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||S.push(new Pe(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!yt(i.valueSpec)&&S.push(new Pe(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(g&&!Ot(i.valueSpec)?S.push(new Pe(i.key,i.value,"property functions not supported")):m&&!za(i.valueSpec)&&S.push(new Pe(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!b||i.value.property!==void 0||S.push(new Pe(i.key,i.value,'"property" property is required')),S;function C(L){let R=[];const q=L.value,Z=L.key;if(It(q)!=="array")return[new Pe(Z,q,`array expected, ${It(q)} found`)];if(q.length!==2)return[new Pe(Z,q,`array length 2 expected, length ${q.length} found`)];if(b){if(It(q[0])!=="object")return[new Pe(Z,q,`object expected, ${It(q[0])} found`)];if(q[0].zoom===void 0)return[new Pe(Z,q,"object stop key must have zoom")];if(q[0].value===void 0)return[new Pe(Z,q,"object stop key must have value")];if(h&&h>bt(q[0].zoom))return[new Pe(Z,q[0].zoom,"stop zoom values must appear in ascending order")];bt(q[0].zoom)!==h&&(h=bt(q[0].zoom),c=void 0,p={}),R=R.concat(nr({key:`${Z}[0]`,value:q[0],valueSpec:{zoom:{}},style:L.style,styleSpec:L.styleSpec,objectElementValidators:{zoom:Cs,value:z}}))}else R=R.concat(z({key:`${Z}[0]`,value:q[0],valueSpec:{},style:L.style,styleSpec:L.styleSpec},q));return ro(Ki(q[1]))?R.concat([new Pe(`${Z}[1]`,q[1],"expressions are not allowed in function stops.")]):R.concat(Ni({key:`${Z}[1]`,value:q[1],valueSpec:e,style:L.style,styleSpec:L.styleSpec}))}function z(L,R){const q=It(L.value),Z=bt(L.value),ne=L.value!==null?L.value:R;if(o){if(q!==o)return[new Pe(L.key,ne,`${q} stop domain type must match previous stop domain type ${o}`)]}else o=q;if(q!=="number"&&q!=="string"&&q!=="boolean")return[new Pe(L.key,ne,"stop domain value must be a number, string, or boolean")];if(q!=="number"&&r!=="categorical"){let he=`number expected, ${q} found`;return Ot(e)&&r===void 0&&(he+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Pe(L.key,ne,he)]}return r!=="categorical"||q!=="number"||isFinite(Z)&&Math.floor(Z)===Z?r!=="categorical"&&q==="number"&&c!==void 0&&Z<c?[new Pe(L.key,ne,"stop domain values must appear in ascending order")]:(c=Z,r==="categorical"&&Z in p?[new Pe(L.key,ne,"stop domain values must be unique")]:(p[Z]=!0,[])):[new Pe(L.key,ne,`integer expected, found ${Z}`)]}}function nn(i){const e=(i.expressionContext==="property"?Da:no)(Ki(i.value),i.valueSpec);if(e.result==="error")return e.value.map(o=>new Pe(`${i.key}${o.key}`,i.value,o.message));const r=e.value.expression||e.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new Pe(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!An(r))return[new Pe(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!An(r))return[new Pe(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!Po(r,["zoom","feature-state"]))return[new Pe(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!Jn(r))return[new Pe(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function so(i){const e=i.key,r=i.value,o=i.valueSpec,c=[];return Array.isArray(o.values)?o.values.indexOf(bt(r))===-1&&c.push(new Pe(e,r,`expected one of [${o.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(o.values).indexOf(bt(r))===-1&&c.push(new Pe(e,r,`expected one of [${Object.keys(o.values).join(", ")}], ${JSON.stringify(r)} found`)),c}function Ln(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const e of i.slice(1))if(!Ln(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const Kl={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Go(i){if(i==null)return{filter:()=>!0,needGeometry:!1};Ln(i)||(i=ao(i));const e=no(i,Kl);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,o,c)=>e.value.evaluate(r,o,{},c),needGeometry:Fa(i)}}function Ba(i,e){return i<e?-1:i>e?1:0}function Fa(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let e=1;e<i.length;e++)if(Fa(i[e]))return!0;return!1}function ao(i){if(!i)return!0;const e=i[0];return i.length<=1?e!=="any":e==="=="?As(i[1],i[2],"=="):e==="!="?Rn(As(i[1],i[2],"==")):e==="<"||e===">"||e==="<="||e===">="?As(i[1],i[2],e):e==="any"?(r=i.slice(1),["any"].concat(r.map(ao))):e==="all"?["all"].concat(i.slice(1).map(ao)):e==="none"?["all"].concat(i.slice(1).map(ao).map(Rn)):e==="in"?Zo(i[1],i.slice(2)):e==="!in"?Rn(Zo(i[1],i.slice(2))):e==="has"?lo(i[1]):e==="!has"?Rn(lo(i[1])):e!=="within"||i;var r}function As(i,e,r){switch(i){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,i,e]}}function Zo(i,e){if(e.length===0)return!1;switch(i){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",i,["literal",e.sort(Ba)]]:["filter-in-small",i,["literal",e]]}}function lo(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function Rn(i){return["!",i]}function co(i){return Ln(Ki(i.value))?nn(rr({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Oa(i)}function Oa(i){const e=i.value,r=i.key;if(It(e)!=="array")return[new Pe(r,e,`array expected, ${It(e)} found`)];const o=i.styleSpec;let c,h=[];if(e.length<1)return[new Pe(r,e,"filter array must have at least 1 element")];switch(h=h.concat(so({key:`${r}[0]`,value:e[0],valueSpec:o.filter_operator,style:i.style,styleSpec:i.styleSpec})),bt(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&bt(e[1])==="$type"&&h.push(new Pe(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&h.push(new Pe(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(c=It(e[1]),c!=="string"&&h.push(new Pe(`${r}[1]`,e[1],`string expected, ${c} found`)));for(let p=2;p<e.length;p++)c=It(e[p]),bt(e[1])==="$type"?h=h.concat(so({key:`${r}[${p}]`,value:e[p],valueSpec:o.geometry_type,style:i.style,styleSpec:i.styleSpec})):c!=="string"&&c!=="number"&&c!=="boolean"&&h.push(new Pe(`${r}[${p}]`,e[p],`string, number, or boolean expected, ${c} found`));break;case"any":case"all":case"none":for(let p=1;p<e.length;p++)h=h.concat(Oa({key:`${r}[${p}]`,value:e[p],style:i.style,styleSpec:i.styleSpec}));break;case"has":case"!has":c=It(e[1]),e.length!==2?h.push(new Pe(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):c!=="string"&&h.push(new Pe(`${r}[1]`,e[1],`string expected, ${c} found`));break;case"within":c=It(e[1]),e.length!==2?h.push(new Pe(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):c!=="object"&&h.push(new Pe(`${r}[1]`,e[1],`object expected, ${c} found`))}return h}function uo(i,e){const r=i.key,o=i.style,c=i.styleSpec,h=i.value,p=i.objectKey,m=c[`${e}_${i.layerType}`];if(!m)return[];const g=p.match(/^(.*)-transition$/);if(e==="paint"&&g&&m[g[1]]&&m[g[1]].transition)return Ni({key:r,value:h,valueSpec:c.transition,style:o,styleSpec:c});const b=i.valueSpec||m[p];if(!b)return[new Pe(r,h,`unknown property "${p}"`)];let S;if(It(h)==="string"&&Ot(b)&&!b.tokens&&(S=/^{([^}]+)}$/.exec(h)))return[new Pe(r,h,`"${p}" does not support interpolation syntax
|
|
10
|
+
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(S[1])} }\`.`)];const C=[];return i.layerType==="symbol"&&(p==="text-field"&&o&&!o.glyphs&&C.push(new Pe(r,h,'use of "text-field" requires a style "glyphs" property')),p==="text-font"&&Bt(Ki(h))&&bt(h.type)==="identity"&&C.push(new Pe(r,h,'"text-font" does not support identity functions'))),C.concat(Ni({key:i.key,value:h,valueSpec:b,style:o,styleSpec:c,expressionContext:"property",propertyType:e,propertyKey:p}))}function $a(i){return uo(i,"paint")}function Ua(i){return uo(i,"layout")}function Va(i){let e=[];const r=i.value,o=i.key,c=i.style,h=i.styleSpec;r.type||r.ref||e.push(new Pe(o,r,'either "type" or "ref" is required'));let p=bt(r.type);const m=bt(r.ref);if(r.id){const g=bt(r.id);for(let b=0;b<i.arrayIndex;b++){const S=c.layers[b];bt(S.id)===g&&e.push(new Pe(o,r.id,`duplicate layer id "${r.id}", previously used at line ${S.id.__line__}`))}}if("ref"in r){let g;["type","source","source-layer","filter","layout"].forEach(b=>{b in r&&e.push(new Pe(o,r[b],`"${b}" is prohibited for ref layers`))}),c.layers.forEach(b=>{bt(b.id)===m&&(g=b)}),g?g.ref?e.push(new Pe(o,r.ref,"ref cannot reference another ref layer")):p=bt(g.type):e.push(new Pe(o,r.ref,`ref layer "${m}" not found`))}else if(p!=="background")if(r.source){const g=c.sources&&c.sources[r.source],b=g&&bt(g.type);g?b==="vector"&&p==="raster"?e.push(new Pe(o,r.source,`layer "${r.id}" requires a raster source`)):b==="raster"&&p!=="raster"?e.push(new Pe(o,r.source,`layer "${r.id}" requires a vector source`)):b!=="vector"||r["source-layer"]?b==="raster-dem"&&p!=="hillshade"?e.push(new Pe(o,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):p!=="line"||!r.paint||!r.paint["line-gradient"]||b==="geojson"&&g.lineMetrics||e.push(new Pe(o,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new Pe(o,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new Pe(o,r.source,`source "${r.source}" not found`))}else e.push(new Pe(o,r,'missing required property "source"'));return e=e.concat(nr({key:o,value:r,valueSpec:h.layer,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Ni({key:`${o}.type`,value:r.type,valueSpec:h.layer.type,style:i.style,styleSpec:i.styleSpec,object:r,objectKey:"type"}),filter:co,layout:g=>nr({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,objectElementValidators:{"*":b=>Ua(rr({layerType:p},b))}}),paint:g=>nr({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,objectElementValidators:{"*":b=>$a(rr({layerType:p},b))}})}})),e}function Bn(i){const e=i.value,r=i.key,o=It(e);return o!=="string"?[new Pe(r,e,`string expected, ${o} found`)]:[]}const Na={promoteId:function({key:i,value:e}){if(It(e)==="string")return Bn({key:i,value:e});{const r=[];for(const o in e)r.push(...Bn({key:`${i}.${o}`,value:e[o]}));return r}}};function ho(i){const e=i.value,r=i.key,o=i.styleSpec,c=i.style;if(!e.type)return[new Pe(r,e,'"type" is required')];const h=bt(e.type);let p;switch(h){case"vector":case"raster":case"raster-dem":return p=nr({key:r,value:e,valueSpec:o[`source_${h.replace("-","_")}`],style:i.style,styleSpec:o,objectElementValidators:Na}),p;case"geojson":if(p=nr({key:r,value:e,valueSpec:o.source_geojson,style:c,styleSpec:o,objectElementValidators:Na}),e.cluster)for(const m in e.clusterProperties){const[g,b]=e.clusterProperties[m],S=typeof g=="string"?[g,["accumulated"],["get",m]]:g;p.push(...nn({key:`${r}.${m}.map`,value:b,expressionContext:"cluster-map"})),p.push(...nn({key:`${r}.${m}.reduce`,value:S,expressionContext:"cluster-reduce"}))}return p;case"video":return nr({key:r,value:e,valueSpec:o.source_video,style:c,styleSpec:o});case"image":return nr({key:r,value:e,valueSpec:o.source_image,style:c,styleSpec:o});case"canvas":return[new Pe(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return so({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:c,styleSpec:o})}}function po(i){const e=i.value,r=i.styleSpec,o=r.light,c=i.style;let h=[];const p=It(e);if(e===void 0)return h;if(p!=="object")return h=h.concat([new Pe("light",e,`object expected, ${p} found`)]),h;for(const m in e){const g=m.match(/^(.*)-transition$/);h=h.concat(g&&o[g[1]]&&o[g[1]].transition?Ni({key:m,value:e[m],valueSpec:r.transition,style:c,styleSpec:r}):o[m]?Ni({key:m,value:e[m],valueSpec:o[m],style:c,styleSpec:r}):[new Pe(m,e[m],`unknown property "${m}"`)])}return h}function Vi(i){const e=i.value,r=i.styleSpec,o=r.terrain,c=i.style;let h=[];const p=It(e);if(e===void 0)return h;if(p!=="object")return h=h.concat([new Pe("terrain",e,`object expected, ${p} found`)]),h;for(const m in e)h=h.concat(o[m]?Ni({key:m,value:e[m],valueSpec:o[m],style:c,styleSpec:r}):[new Pe(m,e[m],`unknown property "${m}"`)]);return h}const fo={"*":()=>[],array:La,boolean:function(i){const e=i.value,r=i.key,o=It(e);return o!=="boolean"?[new Pe(r,e,`boolean expected, ${o} found`)]:[]},number:Cs,color:function(i){const e=i.key,r=i.value,o=It(r);return o!=="string"?[new Pe(e,r,`color expected, ${o} found`)]:In(r)===null?[new Pe(e,r,`color expected, "${r}" found`)]:[]},constants:Jr,enum:so,filter:co,function:Ra,layer:Va,object:nr,source:ho,light:po,terrain:Vi,string:Bn,formatted:function(i){return Bn(i).length===0?[]:nn(i)},resolvedImage:function(i){return Bn(i).length===0?[]:nn(i)},padding:function(i){const e=i.key,r=i.value;if(It(r)==="array"){if(r.length<1||r.length>4)return[new Pe(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];const o={type:"number"};let c=[];for(let h=0;h<r.length;h++)c=c.concat(Ni({key:`${e}[${h}]`,value:r[h],valueSpec:o}));return c}return Cs({key:e,value:r,valueSpec:{}})}};function Ni(i){const e=i.value,r=i.valueSpec,o=i.styleSpec;return r.expression&&Bt(bt(e))?Ra(i):r.expression&&ro(Ki(e))?nn(i):r.type&&fo[r.type]?fo[r.type](i):nr(rr({},i,{valueSpec:r.type?o[r.type]:r}))}function Jl(i){const e=i.value,r=i.key,o=Bn(i);return o.length||(e.indexOf("{fontstack}")===-1&&o.push(new Pe(r,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&o.push(new Pe(r,e,'"glyphs" url must include a "{range}" token'))),o}function Vr(i,e=ye){let r=[];return r=r.concat(Ni({key:"",value:i,valueSpec:e.$root,styleSpec:e,style:i,objectElementValidators:{glyphs:Jl,"*":()=>[]}})),i.constants&&(r=r.concat(Jr({key:"constants",value:i.constants,style:i,styleSpec:e}))),Ga(r)}function Ga(i){return[].concat(i).sort((e,r)=>e.line-r.line)}function Ir(i){return function(...e){return Ga(i.apply(this,e))}}Vr.source=Ir(ho),Vr.light=Ir(po),Vr.terrain=Ir(Vi),Vr.layer=Ir(Va),Vr.filter=Ir(co),Vr.paintProperty=Ir($a),Vr.layoutProperty=Ir(Ua);const mo=Vr,Ms=mo.light,Yl=mo.paintProperty,Ql=mo.layoutProperty;function qo(i,e){let r=!1;if(e&&e.length)for(const o of e)i.fire(new Tn(new Error(o.message))),r=!0;return r}class go{constructor(e,r,o){const c=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const p=new Int32Array(this.arrayBuffer);e=p[0],this.d=(r=p[1])+2*(o=p[2]);for(let g=0;g<this.d*this.d;g++){const b=p[3+g],S=p[3+g+1];c.push(b===S?null:p.subarray(b,S))}const m=p[3+c.length+1];this.keys=p.subarray(p[3+c.length],m),this.bboxes=p.subarray(m),this.insert=this._insertReadonly}else{this.d=r+2*o;for(let p=0;p<this.d*this.d;p++)c.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=e,this.padding=o,this.scale=r/e,this.uid=0;const h=o/r*e;this.min=-h,this.max=e+h}insert(e,r,o,c,h){this._forEachCell(r,o,c,h,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(r),this.bboxes.push(o),this.bboxes.push(c),this.bboxes.push(h)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,r,o,c,h,p){this.cells[h].push(p)}query(e,r,o,c,h){const p=this.min,m=this.max;if(e<=p&&r<=p&&m<=o&&m<=c&&!h)return Array.prototype.slice.call(this.keys);{const g=[];return this._forEachCell(e,r,o,c,this._queryCell,g,{},h),g}}_queryCell(e,r,o,c,h,p,m,g){const b=this.cells[h];if(b!==null){const S=this.keys,C=this.bboxes;for(let z=0;z<b.length;z++){const L=b[z];if(m[L]===void 0){const R=4*L;(g?g(C[R+0],C[R+1],C[R+2],C[R+3]):e<=C[R+2]&&r<=C[R+3]&&o>=C[R+0]&&c>=C[R+1])?(m[L]=!0,p.push(S[L])):m[L]=!1}}}}_forEachCell(e,r,o,c,h,p,m,g){const b=this._convertToCellCoord(e),S=this._convertToCellCoord(r),C=this._convertToCellCoord(o),z=this._convertToCellCoord(c);for(let L=b;L<=C;L++)for(let R=S;R<=z;R++){const q=this.d*R+L;if((!g||g(this._convertFromCellCoord(L),this._convertFromCellCoord(R),this._convertFromCellCoord(L+1),this._convertFromCellCoord(R+1)))&&h.call(this,e,r,o,c,q,p,m,g))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 p=0;p<this.cells.length;p++)o+=this.cells[p].length;const c=new Int32Array(r+o+this.keys.length+this.bboxes.length);c[0]=this.extent,c[1]=this.n,c[2]=this.padding;let h=r;for(let p=0;p<e.length;p++){const m=e[p];c[3+p]=h,c.set(m,h),h+=m.length}return c[3+e.length]=h,c.set(this.keys,h),h+=this.keys.length,c[3+e.length+1]=h,c.set(this.bboxes,h),h+=this.bboxes.length,c.buffer}static serialize(e,r){const o=e.toArrayBuffer();return r&&r.push(o),{buffer:o}}static deserialize(e){return new go(e.buffer)}}const Cr={};function Ve(i,e,r={}){if(Cr[i])throw new Error(`${i} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:i,writeable:!1}),Cr[i]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}Ve("Object",Object),Ve("TransferableGridIndex",go),Ve("Color",O),Ve("Error",Error),Ve("AJAXError",Fi),Ve("ResolvedImage",te),Ve("StylePropertyFunction",Vo),Ve("StyleExpression",Uo,{omit:["_evaluator"]}),Ve("ZoomDependentExpression",Is),Ve("ZoomConstantExpression",oo),Ve("CompoundExpression",Dt,{omit:["_evaluate"]});for(const i in zn)zn[i]._classRegistryKey||Ve(`Expression_${i}`,zn[i]);function Za(i){return i&&typeof ArrayBuffer!="undefined"&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}function on(i,e){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob)return i;if(Za(i)||pi(i))return e&&e.push(i),i;if(ArrayBuffer.isView(i)){const r=i;return e&&e.push(r.buffer),r}if(i instanceof ImageData)return e&&e.push(i.data.buffer),i;if(Array.isArray(i)){const r=[];for(const o of i)r.push(on(o,e));return r}if(typeof i=="object"){const r=i.constructor,o=r._classRegistryKey;if(!o)throw new Error("can't serialize object of unregistered class");if(!Cr[o])throw new Error(`${o} is not registered.`);const c=r.serialize?r.serialize(i,e):{};if(r.serialize){if(e&&c===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const h in i){if(!i.hasOwnProperty(h)||Cr[o].omit.indexOf(h)>=0)continue;const p=i[h];c[h]=Cr[o].shallow.indexOf(h)>=0?p:on(p,e)}i instanceof Error&&(c.message=i.message)}if(c.$name)throw new Error("$name property is reserved for worker serialization logic.");return o!=="Object"&&(c.$name=o),c}throw new Error("can't serialize object of type "+typeof i)}function Nr(i){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob||Za(i)||pi(i)||ArrayBuffer.isView(i)||i instanceof ImageData)return i;if(Array.isArray(i))return i.map(Nr);if(typeof i=="object"){const e=i.$name||"Object";if(!Cr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=Cr[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(i);const o=Object.create(r.prototype);for(const c of Object.keys(i)){if(c==="$name")continue;const h=i[c];o[c]=Cr[e].shallow.indexOf(c)>=0?h:Nr(h)}return o}throw new Error("can't deserialize object of type "+typeof i)}class Ps{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))}}const ke={"Latin-1 Supplement":i=>i>=128&&i<=255,Arabic:i=>i>=1536&&i<=1791,"Arabic Supplement":i=>i>=1872&&i<=1919,"Arabic Extended-A":i=>i>=2208&&i<=2303,"Hangul Jamo":i=>i>=4352&&i<=4607,"Unified Canadian Aboriginal Syllabics":i=>i>=5120&&i<=5759,Khmer:i=>i>=6016&&i<=6143,"Unified Canadian Aboriginal Syllabics Extended":i=>i>=6320&&i<=6399,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"CJK Radicals Supplement":i=>i>=11904&&i<=12031,"Kangxi Radicals":i=>i>=12032&&i<=12255,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Hiragana:i=>i>=12352&&i<=12447,Katakana:i=>i>=12448&&i<=12543,Bopomofo:i=>i>=12544&&i<=12591,"Hangul Compatibility Jamo":i=>i>=12592&&i<=12687,Kanbun:i=>i>=12688&&i<=12703,"Bopomofo Extended":i=>i>=12704&&i<=12735,"CJK Strokes":i=>i>=12736&&i<=12783,"Katakana Phonetic Extensions":i=>i>=12784&&i<=12799,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"CJK Unified Ideographs Extension A":i=>i>=13312&&i<=19903,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"CJK Unified Ideographs":i=>i>=19968&&i<=40959,"Yi Syllables":i=>i>=40960&&i<=42127,"Yi Radicals":i=>i>=42128&&i<=42191,"Hangul Jamo Extended-A":i=>i>=43360&&i<=43391,"Hangul Syllables":i=>i>=44032&&i<=55215,"Hangul Jamo Extended-B":i=>i>=55216&&i<=55295,"Private Use Area":i=>i>=57344&&i<=63743,"CJK Compatibility Ideographs":i=>i>=63744&&i<=64255,"Arabic Presentation Forms-A":i=>i>=64336&&i<=65023,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Arabic Presentation Forms-B":i=>i>=65136&&i<=65279,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function jo(i){for(const e of i)if(ks(e.charCodeAt(0)))return!0;return!1}function ec(i){for(const e of i)if(!zs(e.charCodeAt(0)))return!1;return!0}function zs(i){return!(ke.Arabic(i)||ke["Arabic Supplement"](i)||ke["Arabic Extended-A"](i)||ke["Arabic Presentation Forms-A"](i)||ke["Arabic Presentation Forms-B"](i))}function ks(i){return!(i!==746&&i!==747&&(i<4352||!(ke["Bopomofo Extended"](i)||ke.Bopomofo(i)||ke["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||ke["CJK Compatibility Ideographs"](i)||ke["CJK Compatibility"](i)||ke["CJK Radicals Supplement"](i)||ke["CJK Strokes"](i)||!(!ke["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||ke["CJK Unified Ideographs Extension A"](i)||ke["CJK Unified Ideographs"](i)||ke["Enclosed CJK Letters and Months"](i)||ke["Hangul Compatibility Jamo"](i)||ke["Hangul Jamo Extended-A"](i)||ke["Hangul Jamo Extended-B"](i)||ke["Hangul Jamo"](i)||ke["Hangul Syllables"](i)||ke.Hiragana(i)||ke["Ideographic Description Characters"](i)||ke.Kanbun(i)||ke["Kangxi Radicals"](i)||ke["Katakana Phonetic Extensions"](i)||ke.Katakana(i)&&i!==12540||!(!ke["Halfwidth and Fullwidth Forms"](i)||i===65288||i===65289||i===65293||i>=65306&&i<=65310||i===65339||i===65341||i===65343||i>=65371&&i<=65503||i===65507||i>=65512&&i<=65519)||!(!ke["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||ke["Unified Canadian Aboriginal Syllabics"](i)||ke["Unified Canadian Aboriginal Syllabics Extended"](i)||ke["Vertical Forms"](i)||ke["Yijing Hexagram Symbols"](i)||ke["Yi Syllables"](i)||ke["Yi Radicals"](i))))}function qa(i){return!(ks(i)||function(e){return!!(ke["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||ke["General Punctuation"](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||ke["Letterlike Symbols"](e)||ke["Number Forms"](e)||ke["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||ke["Control Pictures"](e)&&e!==9251||ke["Optical Character Recognition"](e)||ke["Enclosed Alphanumerics"](e)||ke["Geometric Shapes"](e)||ke["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||ke["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||ke["CJK Symbols and Punctuation"](e)||ke.Katakana(e)||ke["Private Use Area"](e)||ke["CJK Compatibility Forms"](e)||ke["Small Form Variants"](e)||ke["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(i))}function ja(i){return i>=1424&&i<=2303||ke["Arabic Presentation Forms-A"](i)||ke["Arabic Presentation Forms-B"](i)}function tc(i,e){return!(!e&&ja(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||ke.Khmer(i))}function Xa(i){for(const e of i)if(ja(e.charCodeAt(0)))return!0;return!1}const Ds="deferred",Ls="loading",Rs="loaded";let Bs=null,Pi="unavailable",Gr=null;const Wa=function(i){i&&typeof i=="string"&&i.indexOf("NetworkError")>-1&&(Pi="error"),Bs&&Bs(i)};function Fn(){Fs.fire(new Tr("pluginStateChange",{pluginStatus:Pi,pluginURL:Gr}))}const Fs=new Er,_o=function(){return Pi},Ha=function(){if(Pi!==Ds||!Gr)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Pi=Ls,Fn(),Gr&&wn({url:Gr},i=>{i?Wa(i):(Pi=Rs,Fn())})},Ji={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Pi===Rs||Ji.applyArabicShaping!=null,isLoading:()=>Pi===Ls,setState(i){if(!Wt())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");Pi=i.pluginStatus,Gr=i.pluginURL},isParsed(){if(!Wt())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return Ji.applyArabicShaping!=null&&Ji.processBidirectionalText!=null&&Ji.processStyledBidirectionalText!=null},getPluginURL(){if(!Wt())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return Gr}};class Zt{constructor(e,r){this.zoom=e,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Ps,this.transition={})}isSupportedScript(e){return function(r,o){for(const c of r)if(!tc(c.charCodeAt(0),o))return!1;return!0}(e,Ji.isLoaded())}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}}}class yo{constructor(e,r){this.property=e,this.value=r,this.expression=function(o,c){if(Bt(o))return new Vo(o,c);if(ro(o)){const h=Da(o,c);if(h.result==="error")throw new Error(h.value.map(p=>`${p.key}: ${p.message}`).join(", "));return h.value}{let h=o;return c.type==="color"&&typeof o=="string"?h=O.parse(o):c.type!=="padding"||typeof o!="number"&&!Array.isArray(o)||(h=X.parse(o)),{kind:"constant",evaluate:()=>h}}}(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,r,o){return this.property.possiblyEvaluate(this,e,r,o)}}class Xo{constructor(e){this.property=e,this.value=new yo(e,void 0)}transitioned(e,r){return new Ja(this.property,this.value,r,Fe({},e.transition,this.transition),e.now)}untransitioned(){return new Ja(this.property,this.value,null,{},0)}}class Ka{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return tt(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Xo(this._values[e].property)),this._values[e].value=new yo(this._values[e].property,r===null?void 0:tt(r))}getTransition(e){return tt(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Xo(this._values[e].property)),this._values[e].transition=tt(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 c=this.getTransition(r);c!==void 0&&(e[`${r}-transition`]=c)}return e}transitioned(e,r){const o=new Ya(this._properties);for(const c of Object.keys(this._values))o._values[c]=this._values[c].transitioned(e,r._values[c]);return o}untransitioned(){const e=new Ya(this._properties);for(const r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}}class Ja{constructor(e,r,o,c,h){this.property=e,this.value=r,this.begin=h+c.delay||0,this.end=this.begin+c.duration||0,e.specification.transition&&(c.delay||c.duration)&&(this.prior=o)}possiblyEvaluate(e,r,o){const c=e.now||0,h=this.value.possiblyEvaluate(e,r,o),p=this.prior;if(p){if(c>this.end)return this.prior=null,h;if(this.value.isDataDriven())return this.prior=null,h;if(c<this.begin)return p.possiblyEvaluate(e,r,o);{const m=(c-this.begin)/(this.end-this.begin);return this.property.interpolate(p.possiblyEvaluate(e,r,o),h,function(g){if(g<=0)return 0;if(g>=1)return 1;const b=g*g,S=b*g;return 4*(g<.5?S:3*(g-b)+S-.75)}(m))}}return h}}class Ya{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,o){const c=new xo(this._properties);for(const h of Object.keys(this._values))c._values[h]=this._values[h].possiblyEvaluate(e,r,o);return c}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class ic{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}getValue(e){return tt(this._values[e].value)}setValue(e,r){this._values[e]=new yo(this._values[e].property,r===null?void 0:tt(r))}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 c=new xo(this._properties);for(const h of Object.keys(this._values))c._values[h]=this._values[h].possiblyEvaluate(e,r,o);return c}}class mr{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,c){return this.property.evaluate(this.value,this.parameters,e,r,o,c)}}class xo{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class je{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 c=Qn[this.specification.type];return c?c(e,r,o):e}}class Qe{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,o,c){return new mr(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(r,null,{},o,c)}: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 mr(this,{kind:"constant",value:void 0},e.parameters);const c=Qn[this.specification.type];return c?new mr(this,{kind:"constant",value:c(e.value.value,r.value.value,o)},e.parameters):e}evaluate(e,r,o,c,h,p){return e.kind==="constant"?e.value:e.evaluate(r,o,c,h,p)}}class On extends Qe{possiblyEvaluate(e,r,o,c){if(e.value===void 0)return new mr(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){const h=e.expression.evaluate(r,null,{},o,c),p=e.property.specification.type==="resolvedImage"&&typeof h!="string"?h.name:h,m=this._calculate(p,p,p,r);return new mr(this,{kind:"constant",value:m},r)}if(e.expression.kind==="camera"){const h=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 mr(this,{kind:"constant",value:h},r)}return new mr(this,e.expression,r)}evaluate(e,r,o,c,h,p){if(e.kind==="source"){const m=e.evaluate(r,o,c,h,p);return this._calculate(m,m,m,r)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(r.zoom)-1},o,c),e.evaluate({zoom:Math.floor(r.zoom)},o,c),e.evaluate({zoom:Math.floor(r.zoom)+1},o,c),r):e.value}_calculate(e,r,o,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:o,to:r}}interpolate(e){return e}}class Os{constructor(e){this.specification=e}possiblyEvaluate(e,r,o,c){if(e.value!==void 0){if(e.expression.kind==="constant"){const h=e.expression.evaluate(r,null,{},o,c);return this._calculate(h,h,h,r)}return this._calculate(e.expression.evaluate(new Zt(Math.floor(r.zoom-1),r)),e.expression.evaluate(new Zt(Math.floor(r.zoom),r)),e.expression.evaluate(new Zt(Math.floor(r.zoom+1),r)),r)}}_calculate(e,r,o,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:o,to:r}}interpolate(e){return e}}class Zr{constructor(e){this.specification=e}possiblyEvaluate(e,r,o,c){return!!e.expression.evaluate(r,null,{},o,c)}interpolate(){return!1}}class mi{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 c=this.defaultPropertyValues[r]=new yo(o,void 0),h=this.defaultTransitionablePropertyValues[r]=new Xo(o);this.defaultTransitioningPropertyValues[r]=h.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=c.possiblyEvaluate({})}}}Ve("DataDrivenProperty",Qe),Ve("DataConstantProperty",je),Ve("CrossFadedDataDrivenProperty",On),Ve("CrossFadedProperty",Os),Ve("ColorRampProperty",Zr);const qr="-transition";class gr extends Er{constructor(e,r){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},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),r.layout&&(this._unevaluatedLayout=new ic(r.layout)),r.paint)){this._transitionablePaint=new Ka(r.paint);for(const o in e.paint)this.setPaintProperty(o,e.paint[o],{validate:!1});for(const o in e.layout)this.setLayoutProperty(o,e.layout[o],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new xo(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,r,o={}){r!=null&&this._validate(Ql,`layers.${this.id}.layout.${e}`,e,r,o)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,r):this.visibility=r)}getPaintProperty(e){return e.endsWith(qr)?this._transitionablePaint.getTransition(e.slice(0,-qr.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,o={}){if(r!=null&&this._validate(Yl,`layers.${this.id}.paint.${e}`,e,r,o))return!1;if(e.endsWith(qr))return this._transitionablePaint.setTransition(e.slice(0,-qr.length),r||void 0),!1;{const c=this._transitionablePaint._values[e],h=c.property.specification["property-type"]==="cross-faded-data-driven",p=c.value.isDataDriven(),m=c.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);const g=this._transitionablePaint._values[e].value;return g.isDataDriven()||p||h||this._handleOverridablePaintPropertyUpdate(e,m,g)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,o){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,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)}serialize(){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),Je(e,(r,o)=>!(r===void 0||o==="layout"&&!Object.keys(r).length||o==="paint"&&!Object.keys(r).length))}_validate(e,r,o,c,h={}){return(!h||h.validate!==!1)&&qo(this,e.call(mo,{key:r,layerType:this.type,objectKey:o,value:c,styleSpec:ye,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 mr&&Ot(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const Qa={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class jr{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 Ht{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 Qt(i,e=1){let r=0,o=0;return{members:i.map(c=>{const h=Qa[c.type].BYTES_PER_ELEMENT,p=r=$s(r,Math.max(e,h)),m=c.components||1;return o=Math.max(o,h),r+=h*m,{name:c.name,type:c.type,components:m,offset:p}}),size:$s(r,Math.max(o,e)),alignment:e}}function $s(i,e){return Math.ceil(i/e)*e}class sn extends Ht{_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 c=2*e;return this.int16[c+0]=r,this.int16[c+1]=o,e}}sn.prototype.bytesPerElement=4,Ve("StructArrayLayout2i4",sn);class l extends Ht{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,c){const h=this.length;return this.resize(h+1),this.emplace(h,e,r,o,c)}emplace(e,r,o,c,h){const p=4*e;return this.int16[p+0]=r,this.int16[p+1]=o,this.int16[p+2]=c,this.int16[p+3]=h,e}}l.prototype.bytesPerElement=8,Ve("StructArrayLayout4i8",l);class t extends Ht{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,p){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,o,c,h,p)}emplace(e,r,o,c,h,p,m){const g=6*e;return this.int16[g+0]=r,this.int16[g+1]=o,this.int16[g+2]=c,this.int16[g+3]=h,this.int16[g+4]=p,this.int16[g+5]=m,e}}t.prototype.bytesPerElement=12,Ve("StructArrayLayout2i4i12",t);class n extends Ht{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,p){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,o,c,h,p)}emplace(e,r,o,c,h,p,m){const g=4*e,b=8*e;return this.int16[g+0]=r,this.int16[g+1]=o,this.uint8[b+4]=c,this.uint8[b+5]=h,this.uint8[b+6]=p,this.uint8[b+7]=m,e}}n.prototype.bytesPerElement=8,Ve("StructArrayLayout2i4ub8",n);class s extends Ht{_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 c=2*e;return this.float32[c+0]=r,this.float32[c+1]=o,e}}s.prototype.bytesPerElement=8,Ve("StructArrayLayout2f8",s);class u extends Ht{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,p,m,g,b,S){const C=this.length;return this.resize(C+1),this.emplace(C,e,r,o,c,h,p,m,g,b,S)}emplace(e,r,o,c,h,p,m,g,b,S,C){const z=10*e;return this.uint16[z+0]=r,this.uint16[z+1]=o,this.uint16[z+2]=c,this.uint16[z+3]=h,this.uint16[z+4]=p,this.uint16[z+5]=m,this.uint16[z+6]=g,this.uint16[z+7]=b,this.uint16[z+8]=S,this.uint16[z+9]=C,e}}u.prototype.bytesPerElement=20,Ve("StructArrayLayout10ui20",u);class d extends Ht{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,p,m,g,b,S,C,z){const L=this.length;return this.resize(L+1),this.emplace(L,e,r,o,c,h,p,m,g,b,S,C,z)}emplace(e,r,o,c,h,p,m,g,b,S,C,z,L){const R=12*e;return this.int16[R+0]=r,this.int16[R+1]=o,this.int16[R+2]=c,this.int16[R+3]=h,this.uint16[R+4]=p,this.uint16[R+5]=m,this.uint16[R+6]=g,this.uint16[R+7]=b,this.int16[R+8]=S,this.int16[R+9]=C,this.int16[R+10]=z,this.int16[R+11]=L,e}}d.prototype.bytesPerElement=24,Ve("StructArrayLayout4i4ui4i24",d);class f extends Ht{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,o){const c=this.length;return this.resize(c+1),this.emplace(c,e,r,o)}emplace(e,r,o,c){const h=3*e;return this.float32[h+0]=r,this.float32[h+1]=o,this.float32[h+2]=c,e}}f.prototype.bytesPerElement=12,Ve("StructArrayLayout3f12",f);class _ extends Ht{_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}}_.prototype.bytesPerElement=4,Ve("StructArrayLayout1ul4",_);class y extends Ht{_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,c,h,p,m,g,b){const S=this.length;return this.resize(S+1),this.emplace(S,e,r,o,c,h,p,m,g,b)}emplace(e,r,o,c,h,p,m,g,b,S){const C=10*e,z=5*e;return this.int16[C+0]=r,this.int16[C+1]=o,this.int16[C+2]=c,this.int16[C+3]=h,this.int16[C+4]=p,this.int16[C+5]=m,this.uint32[z+3]=g,this.uint16[C+8]=b,this.uint16[C+9]=S,e}}y.prototype.bytesPerElement=20,Ve("StructArrayLayout6i1ul2ui20",y);class w extends Ht{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,p){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,o,c,h,p)}emplace(e,r,o,c,h,p,m){const g=6*e;return this.int16[g+0]=r,this.int16[g+1]=o,this.int16[g+2]=c,this.int16[g+3]=h,this.int16[g+4]=p,this.int16[g+5]=m,e}}w.prototype.bytesPerElement=12,Ve("StructArrayLayout2i2i2i12",w);class I extends Ht{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h){const p=this.length;return this.resize(p+1),this.emplace(p,e,r,o,c,h)}emplace(e,r,o,c,h,p){const m=4*e,g=8*e;return this.float32[m+0]=r,this.float32[m+1]=o,this.float32[m+2]=c,this.int16[g+6]=h,this.int16[g+7]=p,e}}I.prototype.bytesPerElement=16,Ve("StructArrayLayout2f1f2i16",I);class P extends Ht{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,o,c){const h=this.length;return this.resize(h+1),this.emplace(h,e,r,o,c)}emplace(e,r,o,c,h){const p=12*e,m=3*e;return this.uint8[p+0]=r,this.uint8[p+1]=o,this.float32[m+1]=c,this.float32[m+2]=h,e}}P.prototype.bytesPerElement=12,Ve("StructArrayLayout2ub2f12",P);class D extends Ht{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o){const c=this.length;return this.resize(c+1),this.emplace(c,e,r,o)}emplace(e,r,o,c){const h=3*e;return this.uint16[h+0]=r,this.uint16[h+1]=o,this.uint16[h+2]=c,e}}D.prototype.bytesPerElement=6,Ve("StructArrayLayout3ui6",D);class N extends Ht{_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,c,h,p,m,g,b,S,C,z,L,R,q,Z,ne){const he=this.length;return this.resize(he+1),this.emplace(he,e,r,o,c,h,p,m,g,b,S,C,z,L,R,q,Z,ne)}emplace(e,r,o,c,h,p,m,g,b,S,C,z,L,R,q,Z,ne,he){const re=24*e,le=12*e,ve=48*e;return this.int16[re+0]=r,this.int16[re+1]=o,this.uint16[re+2]=c,this.uint16[re+3]=h,this.uint32[le+2]=p,this.uint32[le+3]=m,this.uint32[le+4]=g,this.uint16[re+10]=b,this.uint16[re+11]=S,this.uint16[re+12]=C,this.float32[le+7]=z,this.float32[le+8]=L,this.uint8[ve+36]=R,this.uint8[ve+37]=q,this.uint8[ve+38]=Z,this.uint32[le+10]=ne,this.int16[re+22]=he,e}}N.prototype.bytesPerElement=48,Ve("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",N);class U extends Ht{_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,c,h,p,m,g,b,S,C,z,L,R,q,Z,ne,he,re,le,ve,xe,Ue,Ge,De,Ae,Se,Le){const ze=this.length;return this.resize(ze+1),this.emplace(ze,e,r,o,c,h,p,m,g,b,S,C,z,L,R,q,Z,ne,he,re,le,ve,xe,Ue,Ge,De,Ae,Se,Le)}emplace(e,r,o,c,h,p,m,g,b,S,C,z,L,R,q,Z,ne,he,re,le,ve,xe,Ue,Ge,De,Ae,Se,Le,ze){const Te=34*e,He=17*e;return this.int16[Te+0]=r,this.int16[Te+1]=o,this.int16[Te+2]=c,this.int16[Te+3]=h,this.int16[Te+4]=p,this.int16[Te+5]=m,this.int16[Te+6]=g,this.int16[Te+7]=b,this.uint16[Te+8]=S,this.uint16[Te+9]=C,this.uint16[Te+10]=z,this.uint16[Te+11]=L,this.uint16[Te+12]=R,this.uint16[Te+13]=q,this.uint16[Te+14]=Z,this.uint16[Te+15]=ne,this.uint16[Te+16]=he,this.uint16[Te+17]=re,this.uint16[Te+18]=le,this.uint16[Te+19]=ve,this.uint16[Te+20]=xe,this.uint16[Te+21]=Ue,this.uint16[Te+22]=Ge,this.uint32[He+12]=De,this.float32[He+13]=Ae,this.float32[He+14]=Se,this.float32[He+15]=Le,this.float32[He+16]=ze,e}}U.prototype.bytesPerElement=68,Ve("StructArrayLayout8i15ui1ul4f68",U);class V extends Ht{_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}}V.prototype.bytesPerElement=4,Ve("StructArrayLayout1f4",V);class Y extends Ht{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o){const c=this.length;return this.resize(c+1),this.emplace(c,e,r,o)}emplace(e,r,o,c){const h=3*e;return this.int16[h+0]=r,this.int16[h+1]=o,this.int16[h+2]=c,e}}Y.prototype.bytesPerElement=6,Ve("StructArrayLayout3i6",Y);class ie extends Ht{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o){const c=this.length;return this.resize(c+1),this.emplace(c,e,r,o)}emplace(e,r,o,c){const h=4*e;return this.uint32[2*e+0]=r,this.uint16[h+2]=o,this.uint16[h+3]=c,e}}ie.prototype.bytesPerElement=8,Ve("StructArrayLayout1ul2ui8",ie);class se extends Ht{_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 c=2*e;return this.uint16[c+0]=r,this.uint16[c+1]=o,e}}se.prototype.bytesPerElement=4,Ve("StructArrayLayout2ui4",se);class G extends Ht{_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}}G.prototype.bytesPerElement=2,Ve("StructArrayLayout1ui2",G);class ue extends Ht{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,o,c){const h=this.length;return this.resize(h+1),this.emplace(h,e,r,o,c)}emplace(e,r,o,c,h){const p=4*e;return this.float32[p+0]=r,this.float32[p+1]=o,this.float32[p+2]=c,this.float32[p+3]=h,e}}ue.prototype.bytesPerElement=16,Ve("StructArrayLayout4f16",ue);class ae extends jr{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 et(this.anchorPointX,this.anchorPointY)}}ae.prototype.size=20;class ge extends y{get(e){return new ae(this,e)}}Ve("CollisionBoxArray",ge);class _e extends jr{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]}}_e.prototype.size=48;class we extends N{get(e){return new _e(this,e)}}Ve("PlacedSymbolArray",we);class me extends jr{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 textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}}me.prototype.size=68;class Oe extends U{get(e){return new me(this,e)}}Ve("SymbolInstanceArray",Oe);class Ce extends V{getoffsetX(e){return this.float32[1*e+0]}}Ve("GlyphOffsetArray",Ce);class $e extends Y{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}Ve("SymbolLineVertexArray",$e);class lt extends jr{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]}}lt.prototype.size=8;class dt extends ie{get(e){return new lt(this,e)}}Ve("FeatureIndexArray",dt);class We extends sn{}class Mt extends sn{}class Pt extends sn{}class xt extends t{}class Et extends n{}class kt extends s{}class li extends u{}class _r extends d{}class or extends f{}class yr extends _{}class Xr extends w{}class Yi extends P{}class zi extends D{}class Ar extends se{}const Wo=Qt([{name:"a_pos",components:2,type:"Int16"}],4),{members:ri}=Wo;class ft{constructor(e=[]){this.segments=e}prepareSegment(e,r,o,c){let h=this.segments[this.segments.length-1];return e>ft.MAX_VERTEX_ARRAY_LENGTH&&ct(`Max vertices per segment is ${ft.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!h||h.vertexLength+e>ft.MAX_VERTEX_ARRAY_LENGTH||h.sortKey!==c)&&(h={vertexOffset:r.length,primitiveOffset:o.length,vertexLength:0,primitiveLength:0},c!==void 0&&(h.sortKey=c),this.segments.push(h)),h}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,c){return new ft([{vertexOffset:e,primitiveOffset:r,vertexLength:o,primitiveLength:c,vaos:{},sortKey:0}])}}function Ct(i,e){return 256*(i=ee(Math.floor(i),0,255))+ee(Math.floor(e),0,255)}ft.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Ve("SegmentVector",ft);const ci=Qt([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var ui={exports:{}},qt={exports:{}};qt.exports=function(i,e){var r,o,c,h,p,m,g,b;for(o=i.length-(r=3&i.length),c=e,p=3432918353,m=461845907,b=0;b<o;)g=255&i.charCodeAt(b)|(255&i.charCodeAt(++b))<<8|(255&i.charCodeAt(++b))<<16|(255&i.charCodeAt(++b))<<24,++b,c=27492+(65535&(h=5*(65535&(c=(c^=g=(65535&(g=(g=(65535&g)*p+(((g>>>16)*p&65535)<<16)&4294967295)<<15|g>>>17))*m+(((g>>>16)*m&65535)<<16)&4294967295)<<13|c>>>19))+((5*(c>>>16)&65535)<<16)&4294967295))+((58964+(h>>>16)&65535)<<16);switch(g=0,r){case 3:g^=(255&i.charCodeAt(b+2))<<16;case 2:g^=(255&i.charCodeAt(b+1))<<8;case 1:c^=g=(65535&(g=(g=(65535&(g^=255&i.charCodeAt(b)))*p+(((g>>>16)*p&65535)<<16)&4294967295)<<15|g>>>17))*m+(((g>>>16)*m&65535)<<16)&4294967295}return c^=i.length,c=2246822507*(65535&(c^=c>>>16))+((2246822507*(c>>>16)&65535)<<16)&4294967295,c=3266489909*(65535&(c^=c>>>13))+((3266489909*(c>>>16)&65535)<<16)&4294967295,(c^=c>>>16)>>>0};var Qi={exports:{}};Qi.exports=function(i,e){for(var r,o=i.length,c=e^o,h=0;o>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(h)|(255&i.charCodeAt(++h))<<8|(255&i.charCodeAt(++h))<<16|(255&i.charCodeAt(++h))<<24))+((1540483477*(r>>>16)&65535)<<16),c=1540483477*(65535&c)+((1540483477*(c>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),o-=4,++h;switch(o){case 3:c^=(255&i.charCodeAt(h+2))<<16;case 2:c^=(255&i.charCodeAt(h+1))<<8;case 1:c=1540483477*(65535&(c^=255&i.charCodeAt(h)))+((1540483477*(c>>>16)&65535)<<16)}return c=1540483477*(65535&(c^=c>>>13))+((1540483477*(c>>>16)&65535)<<16),(c^=c>>>15)>>>0};var an=qt.exports,Us=Qi.exports;ui.exports=an,ui.exports.murmur3=an,ui.exports.murmur2=Us;class $n{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,o,c){this.ids.push(el(e)),this.positions.push(r,o,c)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=el(e);let o=0,c=this.ids.length-1;for(;o<c;){const p=o+c>>1;this.ids[p]>=r?c=p:o=p+1}const h=[];for(;this.ids[o]===r;)h.push({index:this.positions[3*o],start:this.positions[3*o+1],end:this.positions[3*o+2]}),o++;return h}static serialize(e,r){const o=new Float64Array(e.ids),c=new Uint32Array(e.positions);return Vs(o,c,0,o.length-1),r&&r.push(o.buffer,c.buffer),{ids:o,positions:c}}static deserialize(e){const r=new $n;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function el(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:ui.exports(String(i))}function Vs(i,e,r,o){for(;r<o;){const c=i[r+o>>1];let h=r-1,p=o+1;for(;;){do h++;while(i[h]<c);do p--;while(i[p]>c);if(h>=p)break;Wr(i,h,p),Wr(e,3*h,3*p),Wr(e,3*h+1,3*p+1),Wr(e,3*h+2,3*p+2)}p-r<o-p?(Vs(i,e,r,p),r=p+1):(Vs(i,e,p+1,o),o=p)}}function Wr(i,e,r){const o=i[e];i[e]=i[r],i[r]=o}Ve("FeaturePositionMap",$n);class ln{constructor(e,r){this.gl=e.gl,this.location=r}}class cn extends ln{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class Ho extends ln{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 mu extends ln{constructor(e,r){super(e,r),this.current=O.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 ep=new Float32Array(16);function rc(i){return[Ct(255*i.r,255*i.g),Ct(255*i.b,255*i.a)]}class Ns{constructor(e,r,o){this.value=e,this.uniformNames=r.map(c=>`u_${c}`),this.type=o}setUniform(e,r,o){e.set(o.constantOr(this.value))}getBinding(e,r,o){return this.type==="color"?new mu(e,r):new cn(e,r)}}class Ko{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}setUniform(e,r,o,c){const h=c==="u_pattern_to"?this.patternTo:c==="u_pattern_from"?this.patternFrom:c==="u_pixel_ratio_to"?this.pixelRatioTo:c==="u_pixel_ratio_from"?this.pixelRatioFrom:null;h&&e.set(h)}getBinding(e,r,o){return o.substr(0,9)==="u_pattern"?new Ho(e,r):new cn(e,r)}}class un{constructor(e,r,o,c){this.expression=e,this.type=o,this.maxValue=0,this.paintVertexAttributes=r.map(h=>({name:`a_${h}`,type:"Float32",components:o==="color"?2:1,offset:0})),this.paintVertexArray=new c}populatePaintArray(e,r,o,c,h){const p=this.paintVertexArray.length,m=this.expression.evaluate(new Zt(0),r,{},c,[],h);this.paintVertexArray.resize(e),this._setPaintValue(p,e,m)}updatePaintArray(e,r,o,c){const h=this.expression.evaluate({zoom:0},o,c);this._setPaintValue(e,r,h)}_setPaintValue(e,r,o){if(this.type==="color"){const c=rc(o);for(let h=e;h<r;h++)this.paintVertexArray.emplace(h,c[0],c[1])}else{for(let c=e;c<r;c++)this.paintVertexArray.emplace(c,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 Mr{constructor(e,r,o,c,h,p){this.expression=e,this.uniformNames=r.map(m=>`u_${m}_t`),this.type=o,this.useIntegerZoom=c,this.zoom=h,this.maxValue=0,this.paintVertexAttributes=r.map(m=>({name:`a_${m}`,type:"Float32",components:o==="color"?4:2,offset:0})),this.paintVertexArray=new p}populatePaintArray(e,r,o,c,h){const p=this.expression.evaluate(new Zt(this.zoom),r,{},c,[],h),m=this.expression.evaluate(new Zt(this.zoom+1),r,{},c,[],h),g=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(g,e,p,m)}updatePaintArray(e,r,o,c){const h=this.expression.evaluate({zoom:this.zoom},o,c),p=this.expression.evaluate({zoom:this.zoom+1},o,c);this._setPaintValue(e,r,h,p)}_setPaintValue(e,r,o,c){if(this.type==="color"){const h=rc(o),p=rc(c);for(let m=e;m<r;m++)this.paintVertexArray.emplace(m,h[0],h[1],p[0],p[1])}else{for(let h=e;h<r;h++)this.paintVertexArray.emplace(h,o,c);this.maxValue=Math.max(this.maxValue,Math.abs(o),Math.abs(c))}}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,c=ee(this.expression.interpolationFactor(o,this.zoom,this.zoom+1),0,1);e.set(c)}getBinding(e,r,o){return new cn(e,r)}}class Un{constructor(e,r,o,c,h,p){this.expression=e,this.type=r,this.useIntegerZoom=o,this.zoom=c,this.layerId=p,this.zoomInPaintVertexArray=new h,this.zoomOutPaintVertexArray=new h}populatePaintArray(e,r,o){const c=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(c,e,r.patterns&&r.patterns[this.layerId],o)}updatePaintArray(e,r,o,c,h){this._setPaintValues(e,r,o.patterns&&o.patterns[this.layerId],h)}_setPaintValues(e,r,o,c){if(!c||!o)return;const{min:h,mid:p,max:m}=o,g=c[h],b=c[p],S=c[m];if(g&&b&&S)for(let C=e;C<r;C++)this.zoomInPaintVertexArray.emplace(C,b.tl[0],b.tl[1],b.br[0],b.br[1],g.tl[0],g.tl[1],g.br[0],g.br[1],b.pixelRatio,g.pixelRatio),this.zoomOutPaintVertexArray.emplace(C,b.tl[0],b.tl[1],b.br[0],b.br[1],S.tl[0],S.tl[1],S.br[0],S.br[1],b.pixelRatio,S.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,ci.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,ci.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class gu{constructor(e,r,o){this.binders={},this._buffers=[];const c=[];for(const h in e.paint._values){if(!o(h))continue;const p=e.paint.get(h);if(!(p instanceof mr&&Ot(p.property.specification)))continue;const m=tp(h,e.type),g=p.value,b=p.property.specification.type,S=p.property.useIntegerZoom,C=p.property.specification["property-type"],z=C==="cross-faded"||C==="cross-faded-data-driven";if(g.kind==="constant")this.binders[h]=z?new Ko(g.value,m):new Ns(g.value,m,b),c.push(`/u_${h}`);else if(g.kind==="source"||z){const L=_u(h,b,"source");this.binders[h]=z?new Un(g,b,S,r,L,e.id):new un(g,m,b,L),c.push(`/a_${h}`)}else{const L=_u(h,b,"composite");this.binders[h]=new Mr(g,m,b,S,r,L),c.push(`/z_${h}`)}}this.cacheKey=c.sort().join("")}getMaxValue(e){const r=this.binders[e];return r instanceof un||r instanceof Mr?r.maxValue:0}populatePaintArrays(e,r,o,c,h){for(const p in this.binders){const m=this.binders[p];(m instanceof un||m instanceof Mr||m instanceof Un)&&m.populatePaintArray(e,r,o,c,h)}}setConstantPatternPositions(e,r){for(const o in this.binders){const c=this.binders[o];c instanceof Ko&&c.setConstantPatternPositions(e,r)}}updatePaintArrays(e,r,o,c,h){let p=!1;for(const m in e){const g=r.getPositions(m);for(const b of g){const S=o.feature(b.index);for(const C in this.binders){const z=this.binders[C];if((z instanceof un||z instanceof Mr||z instanceof Un)&&z.expression.isStateDependent===!0){const L=c.paint.get(C);z.expression=L.value,z.updatePaintArray(b.start,b.end,S,e[m],h),p=!0}}}}return p}defines(){const e=[];for(const r in this.binders){const o=this.binders[r];(o instanceof Ns||o instanceof Ko)&&e.push(...o.uniformNames.map(c=>`#define HAS_UNIFORM_${c}`))}return e}getBinderAttributes(){const e=[];for(const r in this.binders){const o=this.binders[r];if(o instanceof un||o instanceof Mr)for(let c=0;c<o.paintVertexAttributes.length;c++)e.push(o.paintVertexAttributes[c].name);else if(o instanceof Un)for(let c=0;c<ci.members.length;c++)e.push(ci.members[c].name)}return e}getBinderUniforms(){const e=[];for(const r in this.binders){const o=this.binders[r];if(o instanceof Ns||o instanceof Ko||o instanceof Mr)for(const c of o.uniformNames)e.push(c)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,r){const o=[];for(const c in this.binders){const h=this.binders[c];if(h instanceof Ns||h instanceof Ko||h instanceof Mr){for(const p of h.uniformNames)if(r[p]){const m=h.getBinding(e,r[p],p);o.push({name:p,property:c,binding:m})}}}return o}setUniforms(e,r,o,c){for(const{name:h,property:p,binding:m}of r)this.binders[p].setUniform(m,c,o.get(p),h)}updatePaintBuffers(e){this._buffers=[];for(const r in this.binders){const o=this.binders[r];if(e&&o instanceof Un){const c=e.fromScale===2?o.zoomInPaintVertexBuffer:o.zoomOutPaintVertexBuffer;c&&this._buffers.push(c)}else(o instanceof un||o instanceof Mr)&&o.paintVertexBuffer&&this._buffers.push(o.paintVertexBuffer)}}upload(e){for(const r in this.binders){const o=this.binders[r];(o instanceof un||o instanceof Mr||o instanceof Un)&&o.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const r=this.binders[e];(r instanceof un||r instanceof Mr||r instanceof Un)&&r.destroy()}}}class vo{constructor(e,r,o=()=>!0){this.programConfigurations={};for(const c of e)this.programConfigurations[c.id]=new gu(c,r,o);this.needsUpload=!1,this._featureMap=new $n,this._bufferOffset=0}populatePaintArrays(e,r,o,c,h,p){for(const m in this.programConfigurations)this.programConfigurations[m].populatePaintArrays(e,r,c,h,p);r.id!==void 0&&this._featureMap.add(r.id,o,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,r,o,c){for(const h of o)this.needsUpload=this.programConfigurations[h.id].updatePaintArrays(e,this._featureMap,r,h,c)||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 tp(i,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-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[i]||[i.replace(`${e}-`,"").replace(/-/g,"_")]}function _u(i,e,r){const o={color:{source:s,composite:ue},number:{source:V,composite:s}},c=function(h){return{"line-pattern":{source:li,composite:li},"fill-pattern":{source:li,composite:li},"fill-extrusion-pattern":{source:li,composite:li}}[h]}(i);return c&&c[r]||o[e][r]}Ve("ConstantBinder",Ns),Ve("CrossFadedConstantBinder",Ko),Ve("SourceExpressionBinder",un),Ve("CrossFadedCompositeBinder",Un),Ve("CompositeExpressionBinder",Mr),Ve("ProgramConfiguration",gu,{omit:["_buffers"]}),Ve("ProgramConfigurationSet",vo);var ni=8192;const nc=Math.pow(2,14)-1,yu=-nc-1;function bo(i){const e=ni/i.extent,r=i.loadGeometry();for(let o=0;o<r.length;o++){const c=r[o];for(let h=0;h<c.length;h++){const p=c[h],m=Math.round(p.x*e),g=Math.round(p.y*e);p.x=ee(m,yu,nc),p.y=ee(g,yu,nc),(m<p.x||m>p.x+1||g<p.y||g>p.y+1)&&ct("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function wo(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?bo(i):[]}}function tl(i,e,r,o,c){i.emplaceBack(2*e+(o+1)/2,2*r+(c+1)/2)}class oc{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.hasPattern=!1,this.layoutVertexArray=new Mt,this.indexArray=new zi,this.segments=new ft,this.programConfigurations=new vo(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){const c=this.layers[0],h=[];let p=null,m=!1;c.type==="circle"&&(p=c.layout.get("circle-sort-key"),m=!p.isConstant());for(const{feature:g,id:b,index:S,sourceLayerIndex:C}of e){const z=this.layers[0]._featureFilter.needGeometry,L=wo(g,z);if(!this.layers[0]._featureFilter.filter(new Zt(this.zoom),L,o))continue;const R=m?p.evaluate(L,{},o):void 0,q={id:b,properties:g.properties,type:g.type,sourceLayerIndex:C,index:S,geometry:z?L.geometry:bo(g),patterns:{},sortKey:R};h.push(q)}m&&h.sort((g,b)=>g.sortKey-b.sortKey);for(const g of h){const{geometry:b,index:S,sourceLayerIndex:C}=g,z=e[S].feature;this.addFeature(g,b,S,o),r.featureIndex.insert(z,b,S,C,this.index)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,o)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ri),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,c){for(const h of r)for(const p of h){const m=p.x,g=p.y;if(m<0||m>=ni||g<0||g>=ni)continue;const b=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),S=b.vertexLength;tl(this.layoutVertexArray,m,g,-1,-1),tl(this.layoutVertexArray,m,g,1,-1),tl(this.layoutVertexArray,m,g,1,1),tl(this.layoutVertexArray,m,g,-1,1),this.indexArray.emplaceBack(S,S+1,S+2),this.indexArray.emplaceBack(S,S+3,S+2),b.vertexLength+=4,b.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,{},c)}}function xu(i,e){for(let r=0;r<i.length;r++)if(Jo(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(Jo(i,e[r]))return!0;return!!sc(i,e)}function ip(i,e,r){return!!Jo(i,e)||!!ac(e,i,r)}function vu(i,e){if(i.length===1)return wu(e,i[0]);for(let r=0;r<e.length;r++){const o=e[r];for(let c=0;c<o.length;c++)if(Jo(i,o[c]))return!0}for(let r=0;r<i.length;r++)if(wu(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(sc(i,e[r]))return!0;return!1}function rp(i,e,r){if(i.length>1){if(sc(i,e))return!0;for(let o=0;o<e.length;o++)if(ac(e[o],i,r))return!0}for(let o=0;o<i.length;o++)if(ac(i[o],e,r))return!0;return!1}function sc(i,e){if(i.length===0||e.length===0)return!1;for(let r=0;r<i.length-1;r++){const o=i[r],c=i[r+1];for(let h=0;h<e.length-1;h++)if(np(o,c,e[h],e[h+1]))return!0}return!1}function np(i,e,r,o){return rt(i,r,o)!==rt(e,r,o)&&rt(i,e,r)!==rt(i,e,o)}function ac(i,e,r){const o=r*r;if(e.length===1)return i.distSqr(e[0])<o;for(let c=1;c<e.length;c++)if(bu(i,e[c-1],e[c])<o)return!0;return!1}function bu(i,e,r){const o=e.distSqr(r);if(o===0)return i.distSqr(e);const c=((i.x-e.x)*(r.x-e.x)+(i.y-e.y)*(r.y-e.y))/o;return i.distSqr(c<0?e:c>1?r:r.sub(e)._mult(c)._add(e))}function wu(i,e){let r,o,c,h=!1;for(let p=0;p<i.length;p++){r=i[p];for(let m=0,g=r.length-1;m<r.length;g=m++)o=r[m],c=r[g],o.y>e.y!=c.y>e.y&&e.x<(c.x-o.x)*(e.y-o.y)/(c.y-o.y)+o.x&&(h=!h)}return h}function Jo(i,e){let r=!1;for(let o=0,c=i.length-1;o<i.length;c=o++){const h=i[o],p=i[c];h.y>e.y!=p.y>e.y&&e.x<(p.x-h.x)*(e.y-h.y)/(p.y-h.y)+h.x&&(r=!r)}return r}function op(i,e,r){const o=r[0],c=r[2];if(i.x<o.x&&e.x<o.x||i.x>c.x&&e.x>c.x||i.y<o.y&&e.y<o.y||i.y>c.y&&e.y>c.y)return!1;const h=rt(i,e,r[0]);return h!==rt(i,e,r[1])||h!==rt(i,e,r[2])||h!==rt(i,e,r[3])}function Gs(i,e,r){const o=e.paint.get(i).value;return o.kind==="constant"?o.value:r.programConfigurations.get(e.id).getMaxValue(i)}function il(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function rl(i,e,r,o,c){if(!e[0]&&!e[1])return i;const h=et.convert(e)._mult(c);r==="viewport"&&h._rotate(-o);const p=[];for(let m=0;m<i.length;m++)p.push(i[m].sub(h));return p}Ve("CircleBucket",oc,{omit:["layers"]});const sp=new mi({"circle-sort-key":new Qe(ye.layout_circle["circle-sort-key"])});var ap={paint:new mi({"circle-radius":new Qe(ye.paint_circle["circle-radius"]),"circle-color":new Qe(ye.paint_circle["circle-color"]),"circle-blur":new Qe(ye.paint_circle["circle-blur"]),"circle-opacity":new Qe(ye.paint_circle["circle-opacity"]),"circle-translate":new je(ye.paint_circle["circle-translate"]),"circle-translate-anchor":new je(ye.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new je(ye.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new je(ye.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Qe(ye.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Qe(ye.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Qe(ye.paint_circle["circle-stroke-opacity"])}),layout:sp},ki=1e-6,Di=typeof Float32Array!="undefined"?Float32Array:Array;function Tu(){var i=new Di(9);return Di!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[5]=0,i[6]=0,i[7]=0),i[0]=1,i[4]=1,i[8]=1,i}function lc(i){return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function Eu(i,e,r){var o=e[0],c=e[1],h=e[2],p=e[3],m=e[4],g=e[5],b=e[6],S=e[7],C=e[8],z=e[9],L=e[10],R=e[11],q=e[12],Z=e[13],ne=e[14],he=e[15],re=r[0],le=r[1],ve=r[2],xe=r[3];return i[0]=re*o+le*m+ve*C+xe*q,i[1]=re*c+le*g+ve*z+xe*Z,i[2]=re*h+le*b+ve*L+xe*ne,i[3]=re*p+le*S+ve*R+xe*he,i[4]=(re=r[4])*o+(le=r[5])*m+(ve=r[6])*C+(xe=r[7])*q,i[5]=re*c+le*g+ve*z+xe*Z,i[6]=re*h+le*b+ve*L+xe*ne,i[7]=re*p+le*S+ve*R+xe*he,i[8]=(re=r[8])*o+(le=r[9])*m+(ve=r[10])*C+(xe=r[11])*q,i[9]=re*c+le*g+ve*z+xe*Z,i[10]=re*h+le*b+ve*L+xe*ne,i[11]=re*p+le*S+ve*R+xe*he,i[12]=(re=r[12])*o+(le=r[13])*m+(ve=r[14])*C+(xe=r[15])*q,i[13]=re*c+le*g+ve*z+xe*Z,i[14]=re*h+le*b+ve*L+xe*ne,i[15]=re*p+le*S+ve*R+xe*he,i}Math.hypot||(Math.hypot=function(){for(var i=0,e=arguments.length;e--;)i+=arguments[e]*arguments[e];return Math.sqrt(i)});var Zs,lp=Eu;function Su(){var i=new Di(3);return Di!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i}function Iu(i,e,r){var o=new Di(3);return o[0]=i,o[1]=e,o[2]=r,o}function nl(i,e,r){var o=e[0],c=e[1],h=e[2],p=e[3];return i[0]=r[0]*o+r[4]*c+r[8]*h+r[12]*p,i[1]=r[1]*o+r[5]*c+r[9]*h+r[13]*p,i[2]=r[2]*o+r[6]*c+r[10]*h+r[14]*p,i[3]=r[3]*o+r[7]*c+r[11]*h+r[15]*p,i}function Cu(){var i=new Di(4);return Di!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i[3]=1,i}function Au(i,e){const r=nl([],[i.x,i.y,0,1],e);return new et(r[0]/r[3],r[1]/r[3])}Su(),Zs=new Di(4),Di!=Float32Array&&(Zs[0]=0,Zs[1]=0,Zs[2]=0,Zs[3]=0),Su(),Iu(1,0,0),Iu(0,1,0),Cu(),Cu(),Tu(),function(){var i;i=new Di(2),Di!=Float32Array&&(i[0]=0,i[1]=0)}();class Mu extends oc{}Ve("HeatmapBucket",Mu,{omit:["layers"]});var cp={paint:new mi({"heatmap-radius":new Qe(ye.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Qe(ye.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new je(ye.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Zr(ye.paint_heatmap["heatmap-color"]),"heatmap-opacity":new je(ye.paint_heatmap["heatmap-opacity"])})};function cc(i,{width:e,height:r},o,c){if(c){if(c instanceof Uint8ClampedArray)c=new Uint8Array(c.buffer);else if(c.length!==e*r*o)throw new RangeError(`mismatched image size. expected: ${c.length} but got: ${e*r*o}`)}else c=new Uint8Array(e*r*o);return i.width=e,i.height=r,i.data=c,i}function Pu(i,{width:e,height:r},o){if(e===i.width&&r===i.height)return;const c=cc({},{width:e,height:r},o);uc(i,c,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,e),height:Math.min(i.height,r)},o),i.width=e,i.height=r,i.data=c.data}function uc(i,e,r,o,c,h){if(c.width===0||c.height===0)return e;if(c.width>i.width||c.height>i.height||r.x>i.width-c.width||r.y>i.height-c.height)throw new RangeError("out of range source coordinates for image copy");if(c.width>e.width||c.height>e.height||o.x>e.width-c.width||o.y>e.height-c.height)throw new RangeError("out of range destination coordinates for image copy");const p=i.data,m=e.data;if(p===m)throw new Error("srcData equals dstData, so image is already copied");for(let g=0;g<c.height;g++){const b=((r.y+g)*i.width+r.x)*h,S=((o.y+g)*e.width+o.x)*h;for(let C=0;C<c.width*h;C++)m[S+C]=p[b+C]}return e}class qs{constructor(e,r){cc(this,e,1,r)}resize(e){Pu(this,e,1)}clone(){return new qs({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,o,c,h){uc(e,r,o,c,h,1)}}class sr{constructor(e,r){cc(this,e,4,r)}resize(e){Pu(this,e,4)}replace(e,r){r?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new sr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,o,c,h){uc(e,r,o,c,h,4)}}function zu(i){const e={},r=i.resolution||256,o=i.clips?i.clips.length:1,c=i.image||new sr({width:r,height:o});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const h=(p,m,g)=>{e[i.evaluationKey]=g;const b=i.expression.evaluate(e);c.data[p+m+0]=Math.floor(255*b.r/b.a),c.data[p+m+1]=Math.floor(255*b.g/b.a),c.data[p+m+2]=Math.floor(255*b.b/b.a),c.data[p+m+3]=Math.floor(255*b.a)};if(i.clips)for(let p=0,m=0;p<o;++p,m+=4*r)for(let g=0,b=0;g<r;g++,b+=4){const S=g/(r-1),{start:C,end:z}=i.clips[p];h(m,b,C*(1-S)+z*S)}else for(let p=0,m=0;p<r;p++,m+=4)h(0,m,p/(r-1));return c}Ve("AlphaImage",qs),Ve("RGBAImage",sr);var up={paint:new mi({"hillshade-illumination-direction":new je(ye.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new je(ye.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new je(ye.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new je(ye.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new je(ye.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new je(ye.paint_hillshade["hillshade-accent-color"])})};const hp=Qt([{name:"a_pos",components:2,type:"Int16"}],4),{members:dp}=hp;var ol={exports:{}};function sl(i,e,r){r=r||2;var o,c,h,p,m,g,b,S=e&&e.length,C=S?e[0]*r:i.length,z=ku(i,0,C,r,!0),L=[];if(!z||z.next===z.prev)return L;if(S&&(z=function(q,Z,ne,he){var re,le,ve,xe=[];for(re=0,le=Z.length;re<le;re++)(ve=ku(q,Z[re]*he,re<le-1?Z[re+1]*he:q.length,he,!1))===ve.next&&(ve.steiner=!0),xe.push(vp(ve));for(xe.sort(_p),re=0;re<xe.length;re++)ne=yp(xe[re],ne);return ne}(i,e,z,r)),i.length>80*r){o=h=i[0],c=p=i[1];for(var R=r;R<C;R+=r)(m=i[R])<o&&(o=m),(g=i[R+1])<c&&(c=g),m>h&&(h=m),g>p&&(p=g);b=(b=Math.max(h-o,p-c))!==0?32767/b:0}return js(z,L,r,o,c,b,0),L}function ku(i,e,r,o,c){var h,p;if(c===pc(i,e,r,o)>0)for(h=e;h<r;h+=o)p=Ru(h,i[h],i[h+1],p);else for(h=r-o;h>=e;h-=o)p=Ru(h,i[h],i[h+1],p);return p&&al(p,p.next)&&(Ws(p),p=p.next),p}function To(i,e){if(!i)return i;e||(e=i);var r,o=i;do if(r=!1,o.steiner||!al(o,o.next)&&Jt(o.prev,o,o.next)!==0)o=o.next;else{if(Ws(o),(o=e=o.prev)===o.next)break;r=!0}while(r||o!==e);return e}function js(i,e,r,o,c,h,p){if(i){!p&&h&&function(S,C,z,L){var R=S;do R.z===0&&(R.z=hc(R.x,R.y,C,z,L)),R.prevZ=R.prev,R.nextZ=R.next,R=R.next;while(R!==S);R.prevZ.nextZ=null,R.prevZ=null,function(q){var Z,ne,he,re,le,ve,xe,Ue,Ge=1;do{for(ne=q,q=null,le=null,ve=0;ne;){for(ve++,he=ne,xe=0,Z=0;Z<Ge&&(xe++,he=he.nextZ);Z++);for(Ue=Ge;xe>0||Ue>0&&he;)xe!==0&&(Ue===0||!he||ne.z<=he.z)?(re=ne,ne=ne.nextZ,xe--):(re=he,he=he.nextZ,Ue--),le?le.nextZ=re:q=re,re.prevZ=le,le=re;ne=he}le.nextZ=null,Ge*=2}while(ve>1)}(R)}(i,o,c,h);for(var m,g,b=i;i.prev!==i.next;)if(m=i.prev,g=i.next,h?fp(i,o,c,h):pp(i))e.push(m.i/r|0),e.push(i.i/r|0),e.push(g.i/r|0),Ws(i),i=g.next,b=g.next;else if((i=g)===b){p?p===1?js(i=mp(To(i),e,r),e,r,o,c,h,2):p===2&&gp(i,e,r,o,c,h):js(To(i),e,r,o,c,h,1);break}}}function pp(i){var e=i.prev,r=i,o=i.next;if(Jt(e,r,o)>=0)return!1;for(var c=e.x,h=r.x,p=o.x,m=e.y,g=r.y,b=o.y,S=c<h?c<p?c:p:h<p?h:p,C=m<g?m<b?m:b:g<b?g:b,z=c>h?c>p?c:p:h>p?h:p,L=m>g?m>b?m:b:g>b?g:b,R=o.next;R!==e;){if(R.x>=S&&R.x<=z&&R.y>=C&&R.y<=L&&Yo(c,m,h,g,p,b,R.x,R.y)&&Jt(R.prev,R,R.next)>=0)return!1;R=R.next}return!0}function fp(i,e,r,o){var c=i.prev,h=i,p=i.next;if(Jt(c,h,p)>=0)return!1;for(var m=c.x,g=h.x,b=p.x,S=c.y,C=h.y,z=p.y,L=m<g?m<b?m:b:g<b?g:b,R=S<C?S<z?S:z:C<z?C:z,q=m>g?m>b?m:b:g>b?g:b,Z=S>C?S>z?S:z:C>z?C:z,ne=hc(L,R,e,r,o),he=hc(q,Z,e,r,o),re=i.prevZ,le=i.nextZ;re&&re.z>=ne&&le&&le.z<=he;){if(re.x>=L&&re.x<=q&&re.y>=R&&re.y<=Z&&re!==c&&re!==p&&Yo(m,S,g,C,b,z,re.x,re.y)&&Jt(re.prev,re,re.next)>=0||(re=re.prevZ,le.x>=L&&le.x<=q&&le.y>=R&&le.y<=Z&&le!==c&&le!==p&&Yo(m,S,g,C,b,z,le.x,le.y)&&Jt(le.prev,le,le.next)>=0))return!1;le=le.nextZ}for(;re&&re.z>=ne;){if(re.x>=L&&re.x<=q&&re.y>=R&&re.y<=Z&&re!==c&&re!==p&&Yo(m,S,g,C,b,z,re.x,re.y)&&Jt(re.prev,re,re.next)>=0)return!1;re=re.prevZ}for(;le&&le.z<=he;){if(le.x>=L&&le.x<=q&&le.y>=R&&le.y<=Z&&le!==c&&le!==p&&Yo(m,S,g,C,b,z,le.x,le.y)&&Jt(le.prev,le,le.next)>=0)return!1;le=le.nextZ}return!0}function mp(i,e,r){var o=i;do{var c=o.prev,h=o.next.next;!al(c,h)&&Du(c,o,o.next,h)&&Xs(c,h)&&Xs(h,c)&&(e.push(c.i/r|0),e.push(o.i/r|0),e.push(h.i/r|0),Ws(o),Ws(o.next),o=i=h),o=o.next}while(o!==i);return To(o)}function gp(i,e,r,o,c,h){var p=i;do{for(var m=p.next.next;m!==p.prev;){if(p.i!==m.i&&bp(p,m)){var g=Lu(p,m);return p=To(p,p.next),g=To(g,g.next),js(p,e,r,o,c,h,0),void js(g,e,r,o,c,h,0)}m=m.next}p=p.next}while(p!==i)}function _p(i,e){return i.x-e.x}function yp(i,e){var r=function(c,h){var p,m=h,g=c.x,b=c.y,S=-1/0;do{if(b<=m.y&&b>=m.next.y&&m.next.y!==m.y){var C=m.x+(b-m.y)*(m.next.x-m.x)/(m.next.y-m.y);if(C<=g&&C>S&&(S=C,p=m.x<m.next.x?m:m.next,C===g))return p}m=m.next}while(m!==h);if(!p)return null;var z,L=p,R=p.x,q=p.y,Z=1/0;m=p;do g>=m.x&&m.x>=R&&g!==m.x&&Yo(b<q?g:S,b,R,q,b<q?S:g,b,m.x,m.y)&&(z=Math.abs(b-m.y)/(g-m.x),Xs(m,c)&&(z<Z||z===Z&&(m.x>p.x||m.x===p.x&&xp(p,m)))&&(p=m,Z=z)),m=m.next;while(m!==L);return p}(i,e);if(!r)return e;var o=Lu(r,i);return To(o,o.next),To(r,r.next)}function xp(i,e){return Jt(i.prev,i,e.prev)<0&&Jt(e.next,i,i.next)<0}function hc(i,e,r,o,c){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-r)*c|0)|i<<8))|i<<4))|i<<2))|i<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-o)*c|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function vp(i){var e=i,r=i;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==i);return r}function Yo(i,e,r,o,c,h,p,m){return(c-p)*(e-m)>=(i-p)*(h-m)&&(i-p)*(o-m)>=(r-p)*(e-m)&&(r-p)*(h-m)>=(c-p)*(o-m)}function bp(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!function(r,o){var c=r;do{if(c.i!==r.i&&c.next.i!==r.i&&c.i!==o.i&&c.next.i!==o.i&&Du(c,c.next,r,o))return!0;c=c.next}while(c!==r);return!1}(i,e)&&(Xs(i,e)&&Xs(e,i)&&function(r,o){var c=r,h=!1,p=(r.x+o.x)/2,m=(r.y+o.y)/2;do c.y>m!=c.next.y>m&&c.next.y!==c.y&&p<(c.next.x-c.x)*(m-c.y)/(c.next.y-c.y)+c.x&&(h=!h),c=c.next;while(c!==r);return h}(i,e)&&(Jt(i.prev,i,e.prev)||Jt(i,e.prev,e))||al(i,e)&&Jt(i.prev,i,i.next)>0&&Jt(e.prev,e,e.next)>0)}function Jt(i,e,r){return(e.y-i.y)*(r.x-e.x)-(e.x-i.x)*(r.y-e.y)}function al(i,e){return i.x===e.x&&i.y===e.y}function Du(i,e,r,o){var c=cl(Jt(i,e,r)),h=cl(Jt(i,e,o)),p=cl(Jt(r,o,i)),m=cl(Jt(r,o,e));return c!==h&&p!==m||!(c!==0||!ll(i,r,e))||!(h!==0||!ll(i,o,e))||!(p!==0||!ll(r,i,o))||!(m!==0||!ll(r,e,o))}function ll(i,e,r){return e.x<=Math.max(i.x,r.x)&&e.x>=Math.min(i.x,r.x)&&e.y<=Math.max(i.y,r.y)&&e.y>=Math.min(i.y,r.y)}function cl(i){return i>0?1:i<0?-1:0}function Xs(i,e){return Jt(i.prev,i,i.next)<0?Jt(i,e,i.next)>=0&&Jt(i,i.prev,e)>=0:Jt(i,e,i.prev)<0||Jt(i,i.next,e)<0}function Lu(i,e){var r=new dc(i.i,i.x,i.y),o=new dc(e.i,e.x,e.y),c=i.next,h=e.prev;return i.next=e,e.prev=i,r.next=c,c.prev=r,o.next=r,r.prev=o,h.next=o,o.prev=h,o}function Ru(i,e,r,o){var c=new dc(i,e,r);return o?(c.next=o.next,c.prev=o,o.next.prev=c,o.next=c):(c.prev=c,c.next=c),c}function Ws(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function dc(i,e,r){this.i=i,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function pc(i,e,r,o){for(var c=0,h=e,p=r-o;h<r;h+=o)c+=(i[p]-i[h])*(i[h+1]+i[p+1]),p=h;return c}function wp(i,e,r,o,c){Bu(i,e,r||0,o||i.length-1,c||Tp)}function Bu(i,e,r,o,c){for(;o>r;){if(o-r>600){var h=o-r+1,p=e-r+1,m=Math.log(h),g=.5*Math.exp(2*m/3),b=.5*Math.sqrt(m*g*(h-g)/h)*(p-h/2<0?-1:1);Bu(i,e,Math.max(r,Math.floor(e-p*g/h+b)),Math.min(o,Math.floor(e+(h-p)*g/h+b)),c)}var S=i[e],C=r,z=o;for(Hs(i,r,e),c(i[o],S)>0&&Hs(i,r,o);C<z;){for(Hs(i,C,z),C++,z--;c(i[C],S)<0;)C++;for(;c(i[z],S)>0;)z--}c(i[r],S)===0?Hs(i,r,z):Hs(i,++z,o),z<=e&&(r=z+1),e<=z&&(o=z-1)}}function Hs(i,e,r){var o=i[e];i[e]=i[r],i[r]=o}function Tp(i,e){return i<e?-1:i>e?1:0}function fc(i,e){const r=i.length;if(r<=1)return[i];const o=[];let c,h;for(let p=0;p<r;p++){const m=Ut(i[p]);m!==0&&(i[p].area=Math.abs(m),h===void 0&&(h=m<0),h===m<0?(c&&o.push(c),c=[i[p]]):c.push(i[p]))}if(c&&o.push(c),e>1)for(let p=0;p<o.length;p++)o[p].length<=e||(wp(o[p],e,1,o[p].length-1,Ep),o[p]=o[p].slice(0,e));return o}function Ep(i,e){return e.area-i.area}function mc(i,e,r){const o=r.patternDependencies;let c=!1;for(const h of e){const p=h.paint.get(`${i}-pattern`);p.isConstant()||(c=!0);const m=p.constantOr(null);m&&(c=!0,o[m.to]=!0,o[m.from]=!0)}return c}function gc(i,e,r,o,c){const h=c.patternDependencies;for(const p of e){const m=p.paint.get(`${i}-pattern`).value;if(m.kind!=="constant"){let g=m.evaluate({zoom:o-1},r,{},c.availableImages),b=m.evaluate({zoom:o},r,{},c.availableImages),S=m.evaluate({zoom:o+1},r,{},c.availableImages);g=g&&g.name?g.name:g,b=b&&b.name?b.name:b,S=S&&S.name?S.name:S,h[g]=!0,h[b]=!0,h[S]=!0,r.patterns[p.id]={min:g,mid:b,max:S}}}return r}ol.exports=sl,ol.exports.default=sl,sl.deviation=function(i,e,r,o){var c=e&&e.length,h=Math.abs(pc(i,0,c?e[0]*r:i.length,r));if(c)for(var p=0,m=e.length;p<m;p++)h-=Math.abs(pc(i,e[p]*r,p<m-1?e[p+1]*r:i.length,r));var g=0;for(p=0;p<o.length;p+=3){var b=o[p]*r,S=o[p+1]*r,C=o[p+2]*r;g+=Math.abs((i[b]-i[C])*(i[S+1]-i[b+1])-(i[b]-i[S])*(i[C+1]-i[b+1]))}return h===0&&g===0?0:Math.abs((g-h)/h)},sl.flatten=function(i){for(var e=i[0][0].length,r={vertices:[],holes:[],dimensions:e},o=0,c=0;c<i.length;c++){for(var h=0;h<i[c].length;h++)for(var p=0;p<e;p++)r.vertices.push(i[c][h][p]);c>0&&r.holes.push(o+=i[c-1].length)}return r};class _c{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.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Pt,this.indexArray=new zi,this.indexArray2=new Ar,this.programConfigurations=new vo(e.layers,e.zoom),this.segments=new ft,this.segments2=new ft,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){this.hasPattern=mc("fill",this.layers,r);const c=this.layers[0].layout.get("fill-sort-key"),h=!c.isConstant(),p=[];for(const{feature:m,id:g,index:b,sourceLayerIndex:S}of e){const C=this.layers[0]._featureFilter.needGeometry,z=wo(m,C);if(!this.layers[0]._featureFilter.filter(new Zt(this.zoom),z,o))continue;const L=h?c.evaluate(z,{},o,r.availableImages):void 0,R={id:g,properties:m.properties,type:m.type,sourceLayerIndex:S,index:b,geometry:C?z.geometry:bo(m),patterns:{},sortKey:L};p.push(R)}h&&p.sort((m,g)=>m.sortKey-g.sortKey);for(const m of p){const{geometry:g,index:b,sourceLayerIndex:S}=m;if(this.hasPattern){const C=gc("fill",this.layers,m,this.zoom,r);this.patternFeatures.push(C)}else this.addFeature(m,g,b,o,{});r.featureIndex.insert(e[b].feature,g,b,S,this.index)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,o)}addFeatures(e,r,o){for(const c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,r,o)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,dp),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,c,h){for(const p of fc(r,500)){let m=0;for(const L of p)m+=L.length;const g=this.segments.prepareSegment(m,this.layoutVertexArray,this.indexArray),b=g.vertexLength,S=[],C=[];for(const L of p){if(L.length===0)continue;L!==p[0]&&C.push(S.length/2);const R=this.segments2.prepareSegment(L.length,this.layoutVertexArray,this.indexArray2),q=R.vertexLength;this.layoutVertexArray.emplaceBack(L[0].x,L[0].y),this.indexArray2.emplaceBack(q+L.length-1,q),S.push(L[0].x),S.push(L[0].y);for(let Z=1;Z<L.length;Z++)this.layoutVertexArray.emplaceBack(L[Z].x,L[Z].y),this.indexArray2.emplaceBack(q+Z-1,q+Z),S.push(L[Z].x),S.push(L[Z].y);R.vertexLength+=L.length,R.primitiveLength+=L.length}const z=ol.exports(S,C);for(let L=0;L<z.length;L+=3)this.indexArray.emplaceBack(b+z[L],b+z[L+1],b+z[L+2]);g.vertexLength+=m,g.primitiveLength+=z.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,h,c)}}Ve("FillBucket",_c,{omit:["layers","patternFeatures"]});const Sp=new mi({"fill-sort-key":new Qe(ye.layout_fill["fill-sort-key"])});var Ip={paint:new mi({"fill-antialias":new je(ye.paint_fill["fill-antialias"]),"fill-opacity":new Qe(ye.paint_fill["fill-opacity"]),"fill-color":new Qe(ye.paint_fill["fill-color"]),"fill-outline-color":new Qe(ye.paint_fill["fill-outline-color"]),"fill-translate":new je(ye.paint_fill["fill-translate"]),"fill-translate-anchor":new je(ye.paint_fill["fill-translate-anchor"]),"fill-pattern":new On(ye.paint_fill["fill-pattern"])}),layout:Sp};const Cp=Qt([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Ap=Qt([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Mp}=Cp;var Vn={},Pp=et,Fu=Qo;function Qo(i,e,r,o,c){this.properties={},this.extent=r,this.type=0,this._pbf=i,this._geometry=-1,this._keys=o,this._values=c,i.readFields(zp,this,e)}function zp(i,e,r){i==1?e.id=r.readVarint():i==2?function(o,c){for(var h=o.readVarint()+o.pos;o.pos<h;){var p=c._keys[o.readVarint()],m=c._values[o.readVarint()];c.properties[p]=m}}(r,e):i==3?e.type=r.readVarint():i==4&&(e._geometry=r.pos)}function kp(i){for(var e,r,o=0,c=0,h=i.length,p=h-1;c<h;p=c++)o+=((r=i[p]).x-(e=i[c]).x)*(e.y+r.y);return o}Qo.types=["Unknown","Point","LineString","Polygon"],Qo.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var e,r=i.readVarint()+i.pos,o=1,c=0,h=0,p=0,m=[];i.pos<r;){if(c<=0){var g=i.readVarint();o=7&g,c=g>>3}if(c--,o===1||o===2)h+=i.readSVarint(),p+=i.readSVarint(),o===1&&(e&&m.push(e),e=[]),e.push(new Pp(h,p));else{if(o!==7)throw new Error("unknown command "+o);e&&e.push(e[0].clone())}}return e&&m.push(e),m},Qo.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var e=i.readVarint()+i.pos,r=1,o=0,c=0,h=0,p=1/0,m=-1/0,g=1/0,b=-1/0;i.pos<e;){if(o<=0){var S=i.readVarint();r=7&S,o=S>>3}if(o--,r===1||r===2)(c+=i.readSVarint())<p&&(p=c),c>m&&(m=c),(h+=i.readSVarint())<g&&(g=h),h>b&&(b=h);else if(r!==7)throw new Error("unknown command "+r)}return[p,g,m,b]},Qo.prototype.toGeoJSON=function(i,e,r){var o,c,h=this.extent*Math.pow(2,r),p=this.extent*i,m=this.extent*e,g=this.loadGeometry(),b=Qo.types[this.type];function S(L){for(var R=0;R<L.length;R++){var q=L[R];L[R]=[360*(q.x+p)/h-180,360/Math.PI*Math.atan(Math.exp((180-360*(q.y+m)/h)*Math.PI/180))-90]}}switch(this.type){case 1:var C=[];for(o=0;o<g.length;o++)C[o]=g[o][0];S(g=C);break;case 2:for(o=0;o<g.length;o++)S(g[o]);break;case 3:for(g=function(L){var R=L.length;if(R<=1)return[L];for(var q,Z,ne=[],he=0;he<R;he++){var re=kp(L[he]);re!==0&&(Z===void 0&&(Z=re<0),Z===re<0?(q&&ne.push(q),q=[L[he]]):q.push(L[he]))}return q&&ne.push(q),ne}(g),o=0;o<g.length;o++)for(c=0;c<g[o].length;c++)S(g[o][c])}g.length===1?g=g[0]:b="Multi"+b;var z={type:"Feature",geometry:{type:b,coordinates:g},properties:this.properties};return"id"in this&&(z.id=this.id),z};var Dp=Fu,Ou=$u;function $u(i,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=i,this._keys=[],this._values=[],this._features=[],i.readFields(Lp,this,e),this.length=this._features.length}function Lp(i,e,r){i===15?e.version=r.readVarint():i===1?e.name=r.readString():i===5?e.extent=r.readVarint():i===2?e._features.push(r.pos):i===3?e._keys.push(r.readString()):i===4&&e._values.push(function(o){for(var c=null,h=o.readVarint()+o.pos;o.pos<h;){var p=o.readVarint()>>3;c=p===1?o.readString():p===2?o.readFloat():p===3?o.readDouble():p===4?o.readVarint64():p===5?o.readVarint():p===6?o.readSVarint():p===7?o.readBoolean():null}return c}(r))}$u.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var e=this._pbf.readVarint()+this._pbf.pos;return new Dp(this._pbf,e,this.extent,this._keys,this._values)};var Rp=Ou;function Bp(i,e,r){if(i===3){var o=new Rp(r,r.readVarint()+r.pos);o.length&&(e[o.name]=o)}}Vn.VectorTile=function(i,e){this.layers=i.readFields(Bp,{},e)},Vn.VectorTileFeature=Fu,Vn.VectorTileLayer=Ou;const Fp=Vn.VectorTileFeature.types,yc=Math.pow(2,13);function Ks(i,e,r,o,c,h,p,m){i.emplaceBack(e,r,2*Math.floor(o*yc)+p,c*yc*2,h*yc*2,Math.round(m))}class xc{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.hasPattern=!1,this.layoutVertexArray=new xt,this.centroidVertexArray=new We,this.indexArray=new zi,this.programConfigurations=new vo(e.layers,e.zoom),this.segments=new ft,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){this.features=[],this.hasPattern=mc("fill-extrusion",this.layers,r);for(const{feature:c,id:h,index:p,sourceLayerIndex:m}of e){const g=this.layers[0]._featureFilter.needGeometry,b=wo(c,g);if(!this.layers[0]._featureFilter.filter(new Zt(this.zoom),b,o))continue;const S={id:h,sourceLayerIndex:m,index:p,geometry:g?b.geometry:bo(c),properties:c.properties,type:c.type,patterns:{}};this.hasPattern?this.features.push(gc("fill-extrusion",this.layers,S,this.zoom,r)):this.addFeature(S,S.geometry,p,o,{}),r.featureIndex.insert(c,S.geometry,p,m,this.index,!0)}}addFeatures(e,r,o){for(const c of this.features){const{geometry:h}=c;this.addFeature(c,h,c.index,r,o)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,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,Mp),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Ap.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,c,h){const p={x:0,y:0,vertexCount:0};for(const m of fc(r,500)){let g=0;for(const R of m)g+=R.length;let b=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const R of m){if(R.length===0||$p(R))continue;let q=0;for(let Z=0;Z<R.length;Z++){const ne=R[Z];if(Z>=1){const he=R[Z-1];if(!Op(ne,he)){b.vertexLength+4>ft.MAX_VERTEX_ARRAY_LENGTH&&(b=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const re=ne.sub(he)._perp()._unit(),le=he.dist(ne);q+le>32768&&(q=0),Ks(this.layoutVertexArray,ne.x,ne.y,re.x,re.y,0,0,q),Ks(this.layoutVertexArray,ne.x,ne.y,re.x,re.y,0,1,q),p.x+=2*ne.x,p.y+=2*ne.y,p.vertexCount+=2,q+=le,Ks(this.layoutVertexArray,he.x,he.y,re.x,re.y,0,0,q),Ks(this.layoutVertexArray,he.x,he.y,re.x,re.y,0,1,q),p.x+=2*he.x,p.y+=2*he.y,p.vertexCount+=2;const ve=b.vertexLength;this.indexArray.emplaceBack(ve,ve+2,ve+1),this.indexArray.emplaceBack(ve+1,ve+2,ve+3),b.vertexLength+=4,b.primitiveLength+=2}}}}if(b.vertexLength+g>ft.MAX_VERTEX_ARRAY_LENGTH&&(b=this.segments.prepareSegment(g,this.layoutVertexArray,this.indexArray)),Fp[e.type]!=="Polygon")continue;const S=[],C=[],z=b.vertexLength;for(const R of m)if(R.length!==0){R!==m[0]&&C.push(S.length/2);for(let q=0;q<R.length;q++){const Z=R[q];Ks(this.layoutVertexArray,Z.x,Z.y,0,0,1,1,0),p.x+=Z.x,p.y+=Z.y,p.vertexCount+=1,S.push(Z.x),S.push(Z.y)}}const L=ol.exports(S,C);for(let R=0;R<L.length;R+=3)this.indexArray.emplaceBack(z+L[R],z+L[R+2],z+L[R+1]);b.primitiveLength+=L.length/3,b.vertexLength+=g}for(let m=0;m<p.vertexCount;m++)this.centroidVertexArray.emplaceBack(Math.floor(p.x/p.vertexCount),Math.floor(p.y/p.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,h,c)}}function Op(i,e){return i.x===e.x&&(i.x<0||i.x>ni)||i.y===e.y&&(i.y<0||i.y>ni)}function $p(i){return i.every(e=>e.x<0)||i.every(e=>e.x>ni)||i.every(e=>e.y<0)||i.every(e=>e.y>ni)}Ve("FillExtrusionBucket",xc,{omit:["layers","features"]});var Up={paint:new mi({"fill-extrusion-opacity":new je(ye["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Qe(ye["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new je(ye["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new je(ye["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new On(ye["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Qe(ye["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Qe(ye["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new je(ye["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function Js(i,e){return i.x*e.x+i.y*e.y}function Uu(i,e){if(i.length===1){let r=0;const o=e[r++];let c;for(;!c||o.equals(c);)if(c=e[r++],!c)return 1/0;for(;r<e.length;r++){const h=e[r],p=i[0],m=c.sub(o),g=h.sub(o),b=p.sub(o),S=Js(m,m),C=Js(m,g),z=Js(g,g),L=Js(b,m),R=Js(b,g),q=S*z-C*C,Z=(z*L-C*R)/q,ne=(S*R-C*L)/q,he=o.z*(1-Z-ne)+c.z*Z+h.z*ne;if(isFinite(he))return he}return 1/0}{let r=1/0;for(const o of e)r=Math.min(r,o.z);return r}}const Vp=Qt([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Np}=Vp,Gp=Qt([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Zp}=Gp,qp=Vn.VectorTileFeature.types,jp=Math.cos(Math.PI/180*37.5),Vu=Math.pow(2,14)/.5;class vc{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.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new Et,this.layoutVertexArray2=new kt,this.indexArray=new zi,this.programConfigurations=new vo(e.layers,e.zoom),this.segments=new ft,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){this.hasPattern=mc("line",this.layers,r);const c=this.layers[0].layout.get("line-sort-key"),h=!c.isConstant(),p=[];for(const{feature:m,id:g,index:b,sourceLayerIndex:S}of e){const C=this.layers[0]._featureFilter.needGeometry,z=wo(m,C);if(!this.layers[0]._featureFilter.filter(new Zt(this.zoom),z,o))continue;const L=h?c.evaluate(z,{},o):void 0,R={id:g,properties:m.properties,type:m.type,sourceLayerIndex:S,index:b,geometry:C?z.geometry:bo(m),patterns:{},sortKey:L};p.push(R)}h&&p.sort((m,g)=>m.sortKey-g.sortKey);for(const m of p){const{geometry:g,index:b,sourceLayerIndex:S}=m;if(this.hasPattern){const C=gc("line",this.layers,m,this.zoom,r);this.patternFeatures.push(C)}else this.addFeature(m,g,b,o,{});r.featureIndex.insert(e[b].feature,g,b,S,this.index)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,o)}addFeatures(e,r,o){for(const c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,r,o)}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,Zp)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Np),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,c,h){const p=this.layers[0].layout,m=p.get("line-join").evaluate(e,{}),g=p.get("line-cap"),b=p.get("line-miter-limit"),S=p.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const C of r)this.addLine(C,e,m,g,b,S);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,h,c)}addLine(e,r,o,c,h,p){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let ne=0;ne<e.length-1;ne++)this.totalDistance+=e[ne].dist(e[ne+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const m=qp[r.type]==="Polygon";let g=e.length;for(;g>=2&&e[g-1].equals(e[g-2]);)g--;let b=0;for(;b<g-1&&e[b].equals(e[b+1]);)b++;if(g<(m?3:2))return;o==="bevel"&&(h=1.05);const S=this.overscaling<=16?122880/(512*this.overscaling):0,C=this.segments.prepareSegment(10*g,this.layoutVertexArray,this.indexArray);let z,L,R,q,Z;this.e1=this.e2=-1,m&&(z=e[g-2],Z=e[b].sub(z)._unit()._perp());for(let ne=b;ne<g;ne++){if(R=ne===g-1?m?e[b+1]:void 0:e[ne+1],R&&e[ne].equals(R))continue;Z&&(q=Z),z&&(L=z),z=e[ne],Z=R?R.sub(z)._unit()._perp():q,q=q||Z;let he=q.add(Z);he.x===0&&he.y===0||he._unit();const re=q.x*Z.x+q.y*Z.y,le=he.x*Z.x+he.y*Z.y,ve=le!==0?1/le:1/0,xe=2*Math.sqrt(2-2*le),Ue=le<jp&&L&&R,Ge=q.x*Z.y-q.y*Z.x>0;if(Ue&&ne>b){const Se=z.dist(L);if(Se>2*S){const Le=z.sub(z.sub(L)._mult(S/Se)._round());this.updateDistance(L,Le),this.addCurrentVertex(Le,q,0,0,C),L=Le}}const De=L&&R;let Ae=De?o:m?"butt":c;if(De&&Ae==="round"&&(ve<p?Ae="miter":ve<=2&&(Ae="fakeround")),Ae==="miter"&&ve>h&&(Ae="bevel"),Ae==="bevel"&&(ve>2&&(Ae="flipbevel"),ve<h&&(Ae="miter")),L&&this.updateDistance(L,z),Ae==="miter")he._mult(ve),this.addCurrentVertex(z,he,0,0,C);else if(Ae==="flipbevel"){if(ve>100)he=Z.mult(-1);else{const Se=ve*q.add(Z).mag()/q.sub(Z).mag();he._perp()._mult(Se*(Ge?-1:1))}this.addCurrentVertex(z,he,0,0,C),this.addCurrentVertex(z,he.mult(-1),0,0,C)}else if(Ae==="bevel"||Ae==="fakeround"){const Se=-Math.sqrt(ve*ve-1),Le=Ge?Se:0,ze=Ge?0:Se;if(L&&this.addCurrentVertex(z,q,Le,ze,C),Ae==="fakeround"){const Te=Math.round(180*xe/Math.PI/20);for(let He=1;He<Te;He++){let Xe=He/Te;if(Xe!==.5){const $t=Xe-.5;Xe+=Xe*$t*(Xe-1)*((1.0904+re*(re*(3.55645-1.43519*re)-3.2452))*$t*$t+(.848013+re*(.215638*re-1.06021)))}const pt=Z.sub(q)._mult(Xe)._add(q)._unit()._mult(Ge?-1:1);this.addHalfVertex(z,pt.x,pt.y,!1,Ge,0,C)}}R&&this.addCurrentVertex(z,Z,-Le,-ze,C)}else if(Ae==="butt")this.addCurrentVertex(z,he,0,0,C);else if(Ae==="square"){const Se=L?1:-1;this.addCurrentVertex(z,he,Se,Se,C)}else Ae==="round"&&(L&&(this.addCurrentVertex(z,q,0,0,C),this.addCurrentVertex(z,q,1,1,C,!0)),R&&(this.addCurrentVertex(z,Z,-1,-1,C,!0),this.addCurrentVertex(z,Z,0,0,C)));if(Ue&&ne<g-1){const Se=z.dist(R);if(Se>2*S){const Le=z.add(R.sub(z)._mult(S/Se)._round());this.updateDistance(z,Le),this.addCurrentVertex(Le,Z,0,0,C),z=Le}}}}addCurrentVertex(e,r,o,c,h,p=!1){const m=r.y*c-r.x,g=-r.y-r.x*c;this.addHalfVertex(e,r.x+r.y*o,r.y-r.x*o,p,!1,o,h),this.addHalfVertex(e,m,g,p,!0,-c,h),this.distance>Vu/2&&this.totalDistance===0&&(this.distance=0,this.addCurrentVertex(e,r,o,c,h,p))}addHalfVertex({x:e,y:r},o,c,h,p,m,g){const b=.5*(this.lineClips?this.scaledDistance*(Vu-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(h?1:0),(r<<1)+(p?1:0),Math.round(63*o)+128,Math.round(63*c)+128,1+(m===0?0:m<0?-1:1)|(63&b)<<2,b>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const S=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,S),g.primitiveLength++),p?this.e2=S:this.e1=S}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()}}Ve("LineBucket",vc,{omit:["layers","patternFeatures"]});const Xp=new mi({"line-cap":new je(ye.layout_line["line-cap"]),"line-join":new Qe(ye.layout_line["line-join"]),"line-miter-limit":new je(ye.layout_line["line-miter-limit"]),"line-round-limit":new je(ye.layout_line["line-round-limit"]),"line-sort-key":new Qe(ye.layout_line["line-sort-key"])});var Nu={paint:new mi({"line-opacity":new Qe(ye.paint_line["line-opacity"]),"line-color":new Qe(ye.paint_line["line-color"]),"line-translate":new je(ye.paint_line["line-translate"]),"line-translate-anchor":new je(ye.paint_line["line-translate-anchor"]),"line-width":new Qe(ye.paint_line["line-width"]),"line-gap-width":new Qe(ye.paint_line["line-gap-width"]),"line-offset":new Qe(ye.paint_line["line-offset"]),"line-blur":new Qe(ye.paint_line["line-blur"]),"line-dasharray":new Os(ye.paint_line["line-dasharray"]),"line-pattern":new On(ye.paint_line["line-pattern"]),"line-gradient":new Zr(ye.paint_line["line-gradient"])}),layout:Xp};const Gu=new class extends Qe{possiblyEvaluate(i,e){return e=new Zt(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(i,e)}evaluate(i,e,r,o){return e=Fe({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(i,e,r,o)}}(Nu.paint.properties["line-width"].specification);function Zu(i,e){return e>0?e+2*i:i}Gu.useIntegerZoom=!0;const Wp=Qt([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Hp=Qt([{name:"a_projected_pos",components:3,type:"Float32"}],4);Qt([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Kp=Qt([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Qt([{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 qu=Qt([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Jp=Qt([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Yp(i,e,r){return i.sections.forEach(o=>{o.text=function(c,h,p){const m=h.layout.get("text-transform").evaluate(p,{});return m==="uppercase"?c=c.toLocaleUpperCase():m==="lowercase"&&(c=c.toLocaleLowerCase()),Ji.applyArabicShaping&&(c=Ji.applyArabicShaping(c)),c}(o.text,e,r)}),i}Qt([{name:"triangle",components:3,type:"Uint16"}]),Qt([{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"}]),Qt([{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",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),Qt([{type:"Float32",name:"offsetX"}]),Qt([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const Ys={"!":"\uFE15","#":"\uFF03",$:"\uFF04","%":"\uFF05","&":"\uFF06","(":"\uFE35",")":"\uFE36","*":"\uFF0A","+":"\uFF0B",",":"\uFE10","-":"\uFE32",".":"\u30FB","/":"\uFF0F",":":"\uFE13",";":"\uFE14","<":"\uFE3F","=":"\uFF1D",">":"\uFE40","?":"\uFE16","@":"\uFF20","[":"\uFE47","\\":"\uFF3C","]":"\uFE48","^":"\uFF3E",_:"\uFE33","`":"\uFF40","{":"\uFE37","|":"\u2015","}":"\uFE38","~":"\uFF5E","\xA2":"\uFFE0","\xA3":"\uFFE1","\xA5":"\uFFE5","\xA6":"\uFFE4","\xAC":"\uFFE2","\xAF":"\uFFE3","\u2013":"\uFE32","\u2014":"\uFE31","\u2018":"\uFE43","\u2019":"\uFE44","\u201C":"\uFE41","\u201D":"\uFE42","\u2026":"\uFE19","\u2027":"\u30FB","\u20A9":"\uFFE6","\u3001":"\uFE11","\u3002":"\uFE12","\u3008":"\uFE3F","\u3009":"\uFE40","\u300A":"\uFE3D","\u300B":"\uFE3E","\u300C":"\uFE41","\u300D":"\uFE42","\u300E":"\uFE43","\u300F":"\uFE44","\u3010":"\uFE3B","\u3011":"\uFE3C","\u3014":"\uFE39","\u3015":"\uFE3A","\u3016":"\uFE17","\u3017":"\uFE18","\uFF01":"\uFE15","\uFF08":"\uFE35","\uFF09":"\uFE36","\uFF0C":"\uFE10","\uFF0D":"\uFE32","\uFF0E":"\u30FB","\uFF1A":"\uFE13","\uFF1B":"\uFE14","\uFF1C":"\uFE3F","\uFF1E":"\uFE40","\uFF1F":"\uFE16","\uFF3B":"\uFE47","\uFF3D":"\uFE48","\uFF3F":"\uFE33","\uFF5B":"\uFE37","\uFF5C":"\u2015","\uFF5D":"\uFE38","\uFF5F":"\uFE35","\uFF60":"\uFE36","\uFF61":"\uFE12","\uFF62":"\uFE41","\uFF63":"\uFE42"};var gi=24,bc=Rt,ju=function(i,e,r,o,c){var h,p,m=8*c-o-1,g=(1<<m)-1,b=g>>1,S=-7,C=r?c-1:0,z=r?-1:1,L=i[e+C];for(C+=z,h=L&(1<<-S)-1,L>>=-S,S+=m;S>0;h=256*h+i[e+C],C+=z,S-=8);for(p=h&(1<<-S)-1,h>>=-S,S+=o;S>0;p=256*p+i[e+C],C+=z,S-=8);if(h===0)h=1-b;else{if(h===g)return p?NaN:1/0*(L?-1:1);p+=Math.pow(2,o),h-=b}return(L?-1:1)*p*Math.pow(2,h-o)},Xu=function(i,e,r,o,c,h){var p,m,g,b=8*h-c-1,S=(1<<b)-1,C=S>>1,z=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,L=o?0:h-1,R=o?1:-1,q=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(m=isNaN(e)?1:0,p=S):(p=Math.floor(Math.log(e)/Math.LN2),e*(g=Math.pow(2,-p))<1&&(p--,g*=2),(e+=p+C>=1?z/g:z*Math.pow(2,1-C))*g>=2&&(p++,g/=2),p+C>=S?(m=0,p=S):p+C>=1?(m=(e*g-1)*Math.pow(2,c),p+=C):(m=e*Math.pow(2,C-1)*Math.pow(2,c),p=0));c>=8;i[r+L]=255&m,L+=R,m/=256,c-=8);for(p=p<<c|m,b+=c;b>0;i[r+L]=255&p,L+=R,p/=256,b-=8);i[r+L-R]|=128*q};function Rt(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}Rt.Varint=0,Rt.Fixed64=1,Rt.Bytes=2,Rt.Fixed32=5;var Nn,wc=4294967296,Wu=1/wc,Hu=typeof TextDecoder=="undefined"?null:new TextDecoder("utf8");function hn(i){return i.type===Rt.Bytes?i.readVarint()+i.pos:i.pos+1}function es(i,e,r){return r?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function Ku(i,e,r){var o=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(o);for(var c=r.pos-1;c>=i;c--)r.buf[c+o]=r.buf[c]}function Qp(i,e){for(var r=0;r<i.length;r++)e.writeVarint(i[r])}function ef(i,e){for(var r=0;r<i.length;r++)e.writeSVarint(i[r])}function tf(i,e){for(var r=0;r<i.length;r++)e.writeFloat(i[r])}function rf(i,e){for(var r=0;r<i.length;r++)e.writeDouble(i[r])}function nf(i,e){for(var r=0;r<i.length;r++)e.writeBoolean(i[r])}function of(i,e){for(var r=0;r<i.length;r++)e.writeFixed32(i[r])}function sf(i,e){for(var r=0;r<i.length;r++)e.writeSFixed32(i[r])}function af(i,e){for(var r=0;r<i.length;r++)e.writeFixed64(i[r])}function lf(i,e){for(var r=0;r<i.length;r++)e.writeSFixed64(i[r])}function ul(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+16777216*i[e+3]}function ts(i,e,r){i[r]=e,i[r+1]=e>>>8,i[r+2]=e>>>16,i[r+3]=e>>>24}function Ju(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}function cf(i,e,r){i===1&&r.readMessage(uf,e)}function uf(i,e,r){if(i===3){const{id:o,bitmap:c,width:h,height:p,left:m,top:g,advance:b}=r.readMessage(hf,{});e.push({id:o,bitmap:new qs({width:h+6,height:p+6},c),metrics:{width:h,height:p,left:m,top:g,advance:b}})}}function hf(i,e,r){i===1?e.id=r.readVarint():i===2?e.bitmap=r.readBytes():i===3?e.width=r.readVarint():i===4?e.height=r.readVarint():i===5?e.left=r.readSVarint():i===6?e.top=r.readSVarint():i===7&&(e.advance=r.readVarint())}function Yu(i){let e=0,r=0;for(const p of i)e+=p.w*p.h,r=Math.max(r,p.w);i.sort((p,m)=>m.h-p.h);const o=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let c=0,h=0;for(const p of i)for(let m=o.length-1;m>=0;m--){const g=o[m];if(!(p.w>g.w||p.h>g.h)){if(p.x=g.x,p.y=g.y,h=Math.max(h,p.y+p.h),c=Math.max(c,p.x+p.w),p.w===g.w&&p.h===g.h){const b=o.pop();m<o.length&&(o[m]=b)}else p.h===g.h?(g.x+=p.w,g.w-=p.w):p.w===g.w?(g.y+=p.h,g.h-=p.h):(o.push({x:g.x+p.w,y:g.y,w:g.w-p.w,h:p.h}),g.y+=p.h,g.h-=p.h);break}}return{w:c,h,fill:e/(c*h)||0}}Rt.prototype={destroy:function(){this.buf=null},readFields:function(i,e,r){for(r=r||this.length;this.pos<r;){var o=this.readVarint(),c=o>>3,h=this.pos;this.type=7&o,i(c,e,this),this.pos===h&&this.skip(o)}return e},readMessage:function(i,e){return this.readFields(i,e,this.readVarint()+this.pos)},readFixed32:function(){var i=ul(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=Ju(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=ul(this.buf,this.pos)+ul(this.buf,this.pos+4)*wc;return this.pos+=8,i},readSFixed64:function(){var i=ul(this.buf,this.pos)+Ju(this.buf,this.pos+4)*wc;return this.pos+=8,i},readFloat:function(){var i=ju(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=ju(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var e,r,o=this.buf;return e=127&(r=o[this.pos++]),r<128?e:(e|=(127&(r=o[this.pos++]))<<7,r<128?e:(e|=(127&(r=o[this.pos++]))<<14,r<128?e:(e|=(127&(r=o[this.pos++]))<<21,r<128?e:function(c,h,p){var m,g,b=p.buf;if(m=(112&(g=b[p.pos++]))>>4,g<128||(m|=(127&(g=b[p.pos++]))<<3,g<128)||(m|=(127&(g=b[p.pos++]))<<10,g<128)||(m|=(127&(g=b[p.pos++]))<<17,g<128)||(m|=(127&(g=b[p.pos++]))<<24,g<128)||(m|=(1&(g=b[p.pos++]))<<31,g<128))return es(c,m,h);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=o[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var i=this.readVarint()+this.pos,e=this.pos;return this.pos=i,i-e>=12&&Hu?function(r,o,c){return Hu.decode(r.subarray(o,c))}(this.buf,e,i):function(r,o,c){for(var h="",p=o;p<c;){var m,g,b,S=r[p],C=null,z=S>239?4:S>223?3:S>191?2:1;if(p+z>c)break;z===1?S<128&&(C=S):z===2?(192&(m=r[p+1]))==128&&(C=(31&S)<<6|63&m)<=127&&(C=null):z===3?(g=r[p+2],(192&(m=r[p+1]))==128&&(192&g)==128&&((C=(15&S)<<12|(63&m)<<6|63&g)<=2047||C>=55296&&C<=57343)&&(C=null)):z===4&&(g=r[p+2],b=r[p+3],(192&(m=r[p+1]))==128&&(192&g)==128&&(192&b)==128&&((C=(15&S)<<18|(63&m)<<12|(63&g)<<6|63&b)<=65535||C>=1114112)&&(C=null)),C===null?(C=65533,z=1):C>65535&&(C-=65536,h+=String.fromCharCode(C>>>10&1023|55296),C=56320|1023&C),h+=String.fromCharCode(C),p+=z}return h}(this.buf,e,i)},readBytes:function(){var i=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,i);return this.pos=i,e},readPackedVarint:function(i,e){if(this.type!==Rt.Bytes)return i.push(this.readVarint(e));var r=hn(this);for(i=i||[];this.pos<r;)i.push(this.readVarint(e));return i},readPackedSVarint:function(i){if(this.type!==Rt.Bytes)return i.push(this.readSVarint());var e=hn(this);for(i=i||[];this.pos<e;)i.push(this.readSVarint());return i},readPackedBoolean:function(i){if(this.type!==Rt.Bytes)return i.push(this.readBoolean());var e=hn(this);for(i=i||[];this.pos<e;)i.push(this.readBoolean());return i},readPackedFloat:function(i){if(this.type!==Rt.Bytes)return i.push(this.readFloat());var e=hn(this);for(i=i||[];this.pos<e;)i.push(this.readFloat());return i},readPackedDouble:function(i){if(this.type!==Rt.Bytes)return i.push(this.readDouble());var e=hn(this);for(i=i||[];this.pos<e;)i.push(this.readDouble());return i},readPackedFixed32:function(i){if(this.type!==Rt.Bytes)return i.push(this.readFixed32());var e=hn(this);for(i=i||[];this.pos<e;)i.push(this.readFixed32());return i},readPackedSFixed32:function(i){if(this.type!==Rt.Bytes)return i.push(this.readSFixed32());var e=hn(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed32());return i},readPackedFixed64:function(i){if(this.type!==Rt.Bytes)return i.push(this.readFixed64());var e=hn(this);for(i=i||[];this.pos<e;)i.push(this.readFixed64());return i},readPackedSFixed64:function(i){if(this.type!==Rt.Bytes)return i.push(this.readSFixed64());var e=hn(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed64());return i},skip:function(i){var e=7&i;if(e===Rt.Varint)for(;this.buf[this.pos++]>127;);else if(e===Rt.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Rt.Fixed32)this.pos+=4;else{if(e!==Rt.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(i,e){this.writeVarint(i<<3|e)},realloc:function(i){for(var e=this.length||16;e<this.pos+i;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(i){this.realloc(4),ts(this.buf,i,this.pos),this.pos+=4},writeSFixed32:function(i){this.realloc(4),ts(this.buf,i,this.pos),this.pos+=4},writeFixed64:function(i){this.realloc(8),ts(this.buf,-1&i,this.pos),ts(this.buf,Math.floor(i*Wu),this.pos+4),this.pos+=8},writeSFixed64:function(i){this.realloc(8),ts(this.buf,-1&i,this.pos),ts(this.buf,Math.floor(i*Wu),this.pos+4),this.pos+=8},writeVarint:function(i){(i=+i||0)>268435455||i<0?function(e,r){var o,c;if(e>=0?(o=e%4294967296|0,c=e/4294967296|0):(c=~(-e/4294967296),4294967295^(o=~(-e%4294967296))?o=o+1|0:(o=0,c=c+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(h,p,m){m.buf[m.pos++]=127&h|128,h>>>=7,m.buf[m.pos++]=127&h|128,h>>>=7,m.buf[m.pos++]=127&h|128,h>>>=7,m.buf[m.pos++]=127&h|128,m.buf[m.pos]=127&(h>>>=7)}(o,0,r),function(h,p){var m=(7&h)<<4;p.buf[p.pos++]|=m|((h>>>=3)?128:0),h&&(p.buf[p.pos++]=127&h|((h>>>=7)?128:0),h&&(p.buf[p.pos++]=127&h|((h>>>=7)?128:0),h&&(p.buf[p.pos++]=127&h|((h>>>=7)?128:0),h&&(p.buf[p.pos++]=127&h|((h>>>=7)?128:0),h&&(p.buf[p.pos++]=127&h)))))}(c,r)}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?2*-i-1:2*i)},writeBoolean:function(i){this.writeVarint(Boolean(i))},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var e=this.pos;this.pos=function(o,c,h){for(var p,m,g=0;g<c.length;g++){if((p=c.charCodeAt(g))>55295&&p<57344){if(!m){p>56319||g+1===c.length?(o[h++]=239,o[h++]=191,o[h++]=189):m=p;continue}if(p<56320){o[h++]=239,o[h++]=191,o[h++]=189,m=p;continue}p=m-55296<<10|p-56320|65536,m=null}else m&&(o[h++]=239,o[h++]=191,o[h++]=189,m=null);p<128?o[h++]=p:(p<2048?o[h++]=p>>6|192:(p<65536?o[h++]=p>>12|224:(o[h++]=p>>18|240,o[h++]=p>>12&63|128),o[h++]=p>>6&63|128),o[h++]=63&p|128)}return h}(this.buf,i,this.pos);var r=this.pos-e;r>=128&&Ku(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),Xu(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Xu(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var e=i.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=i[r]},writeRawMessage:function(i,e){this.pos++;var r=this.pos;i(e,this);var o=this.pos-r;o>=128&&Ku(r,o,this),this.pos=r-1,this.writeVarint(o),this.pos+=o},writeMessage:function(i,e,r){this.writeTag(i,Rt.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,Qp,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,ef,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,nf,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,tf,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,rf,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,of,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,sf,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,af,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,lf,e)},writeBytesField:function(i,e){this.writeTag(i,Rt.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,Rt.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,Rt.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,Rt.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,Rt.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,Rt.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,Rt.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,Rt.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,Rt.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,Rt.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,Boolean(e))}};class Tc{constructor(e,{pixelRatio:r,version:o,stretchX:c,stretchY:h,content:p}){this.paddedRect=e,this.pixelRatio=r,this.stretchX=c,this.stretchY=h,this.content=p,this.version=o}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 Qu{constructor(e,r){const o={},c={};this.haveRenderCallbacks=[];const h=[];this.addImages(e,o,h),this.addImages(r,c,h);const{w:p,h:m}=Yu(h),g=new sr({width:p||1,height:m||1});for(const b in e){const S=e[b],C=o[b].paddedRect;sr.copy(S.data,g,{x:0,y:0},{x:C.x+1,y:C.y+1},S.data)}for(const b in r){const S=r[b],C=c[b].paddedRect,z=C.x+1,L=C.y+1,R=S.data.width,q=S.data.height;sr.copy(S.data,g,{x:0,y:0},{x:z,y:L},S.data),sr.copy(S.data,g,{x:0,y:q-1},{x:z,y:L-1},{width:R,height:1}),sr.copy(S.data,g,{x:0,y:0},{x:z,y:L+q},{width:R,height:1}),sr.copy(S.data,g,{x:R-1,y:0},{x:z-1,y:L},{width:1,height:q}),sr.copy(S.data,g,{x:0,y:0},{x:z+R,y:L},{width:1,height:q})}this.image=g,this.iconPositions=o,this.patternPositions=c}addImages(e,r,o){for(const c in e){const h=e[c],p={x:0,y:0,w:h.data.width+2,h:h.data.height+2};o.push(p),r[c]=new Tc(p,h),h.hasRenderCallback&&this.haveRenderCallbacks.push(c)}}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[c,h]=e.tl;o.update(r.data,void 0,{x:c,y:h})}}Ve("ImagePosition",Tc),Ve("ImageAtlas",Qu),a.WritingMode=void 0,(Nn=a.WritingMode||(a.WritingMode={}))[Nn.none=0]="none",Nn[Nn.horizontal=1]="horizontal",Nn[Nn.vertical=2]="vertical",Nn[Nn.horizontalOnly=3]="horizontalOnly";const hl=-17;class Qs{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,r){const o=new Qs;return o.scale=e||1,o.fontStack=r,o}static forImage(e){const r=new Qs;return r.imageName=e,r}}class is{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,r){const o=new is;for(let c=0;c<e.sections.length;c++){const h=e.sections[c];h.image?o.addImageSection(h):o.addTextSection(h,r)}return o}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}getCharCode(e){return this.text.charCodeAt(e)}verticalizePunctuation(){this.text=function(e){let r="";for(let o=0;o<e.length;o++){const c=e.charCodeAt(o+1)||null,h=e.charCodeAt(o-1)||null;r+=c&&qa(c)&&!Ys[e[o+1]]||h&&qa(h)&&!Ys[e[o-1]]||!Ys[e[o]]?e[o]:Ys[e[o]]}return r}(this.text)}trim(){let e=0;for(let o=0;o<this.text.length&&pl[this.text.charCodeAt(o)];o++)e++;let r=this.text.length;for(let o=this.text.length-1;o>=0&&o>=e&&pl[this.text.charCodeAt(o)];o--)r--;this.text=this.text.substring(e,r),this.sectionIndex=this.sectionIndex.slice(e,r)}substring(e,r){const o=new is;return o.text=this.text.substring(e,r),o.sectionIndex=this.sectionIndex.slice(e,r),o.sections=this.sections,o}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}addTextSection(e,r){this.text+=e.text,this.sections.push(Qs.forText(e.scale,e.fontStack||r));const o=this.sections.length-1;for(let c=0;c<e.text.length;++c)this.sectionIndex.push(o)}addImageSection(e){const r=e.image?e.image.name:"";if(r.length===0)return void ct("Can't add FormattedSection with an empty image.");const o=this.getNextImageSectionCharCode();o?(this.text+=String.fromCharCode(o),this.sections.push(Qs.forImage(r)),this.sectionIndex.push(this.sections.length-1)):ct("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function dl(i,e,r,o,c,h,p,m,g,b,S,C,z,L,R,q){const Z=is.fromFeature(i,c);let ne;C===a.WritingMode.vertical&&Z.verticalizePunctuation();const{processBidirectionalText:he,processStyledBidirectionalText:re}=Ji;if(he&&Z.sections.length===1){ne=[];const xe=he(Z.toString(),Ec(Z,b,h,e,o,L,R));for(const Ue of xe){const Ge=new is;Ge.text=Ue,Ge.sections=Z.sections;for(let De=0;De<Ue.length;De++)Ge.sectionIndex.push(0);ne.push(Ge)}}else if(re){ne=[];const xe=re(Z.text,Z.sectionIndex,Ec(Z,b,h,e,o,L,R));for(const Ue of xe){const Ge=new is;Ge.text=Ue[0],Ge.sectionIndex=Ue[1],Ge.sections=Z.sections,ne.push(Ge)}}else ne=function(xe,Ue){const Ge=[],De=xe.text;let Ae=0;for(const Se of Ue)Ge.push(xe.substring(Ae,Se)),Ae=Se;return Ae<De.length&&Ge.push(xe.substring(Ae,De.length)),Ge}(Z,Ec(Z,b,h,e,o,L,R));const le=[],ve={positionedLines:le,text:Z.toString(),top:S[1],bottom:S[1],left:S[0],right:S[0],writingMode:C,iconsInText:!1,verticalizable:!1};return function(xe,Ue,Ge,De,Ae,Se,Le,ze,Te,He,Xe,pt){let $t=0,jt=hl,oi=0,lr=0;const yi=ze==="right"?1:ze==="left"?0:.5;let ei=0;for(const ti of Ae){ti.trim();const vi=ti.getMaxScale(),Ii=(vi-1)*gi,Li={positionedGlyphs:[],lineOffset:0};xe.positionedLines[ei]=Li;const Zi=Li.positionedGlyphs;let qi=0;if(!ti.length()){jt+=Se,++ei;continue}for(let di=0;di<ti.length();di++){const _t=ti.getSection(di),er=ti.getSectionIndex(di),bi=ti.getCharCode(di);let Ci=0,xr=null,Pr=null,zr=null,pn=gi;const vr=!(Te===a.WritingMode.horizontal||!Xe&&!ks(bi)||Xe&&(pl[bi]||(hi=bi,ke.Arabic(hi)||ke["Arabic Supplement"](hi)||ke["Arabic Extended-A"](hi)||ke["Arabic Presentation Forms-A"](hi)||ke["Arabic Presentation Forms-B"](hi))));if(_t.imageName){const cr=De[_t.imageName];if(!cr)continue;zr=_t.imageName,xe.iconsInText=xe.iconsInText||!0,Pr=cr.paddedRect;const ji=cr.displaySize;_t.scale=_t.scale*gi/pt,xr={width:ji[0],height:ji[1],left:1,top:-3,advance:vr?ji[1]:ji[0]},Ci=Ii+(gi-ji[1]*_t.scale),pn=xr.advance;const fn=vr?ji[0]*_t.scale-gi*vi:ji[1]*_t.scale-gi*vi;fn>0&&fn>qi&&(qi=fn)}else{const cr=Ge[_t.fontStack],ji=cr&&cr[bi];if(ji&&ji.rect)Pr=ji.rect,xr=ji.metrics;else{const fn=Ue[_t.fontStack],ia=fn&&fn[bi];if(!ia)continue;xr=ia.metrics}Ci=(vi-_t.scale)*gi}vr?(xe.verticalizable=!0,Zi.push({glyph:bi,imageName:zr,x:$t,y:jt+Ci,vertical:vr,scale:_t.scale,fontStack:_t.fontStack,sectionIndex:er,metrics:xr,rect:Pr}),$t+=pn*_t.scale+He):(Zi.push({glyph:bi,imageName:zr,x:$t,y:jt+Ci,vertical:vr,scale:_t.scale,fontStack:_t.fontStack,sectionIndex:er,metrics:xr,rect:Pr}),$t+=xr.advance*_t.scale+He)}Zi.length!==0&&(oi=Math.max($t-He,oi),ff(Zi,0,Zi.length-1,yi,qi)),$t=0;const Xt=Se*vi+qi;Li.lineOffset=Math.max(qi,Ii),jt+=Xt,lr=Math.max(Xt,lr),++ei}var hi;const xi=jt-hl,{horizontalAlign:Si,verticalAlign:Gi}=Sc(Le);(function(ti,vi,Ii,Li,Zi,qi,Xt,di,_t){const er=(vi-Ii)*Zi;let bi=0;bi=qi!==Xt?-di*Li-hl:(-Li*_t+.5)*Xt;for(const Ci of ti)for(const xr of Ci.positionedGlyphs)xr.x+=er,xr.y+=bi})(xe.positionedLines,yi,Si,Gi,oi,lr,Se,xi,Ae.length),xe.top+=-Gi*xi,xe.bottom=xe.top+xi,xe.left+=-Si*oi,xe.right=xe.left+oi}(ve,e,r,o,ne,p,m,g,C,b,z,q),!function(xe){for(const Ue of xe)if(Ue.positionedGlyphs.length!==0)return!1;return!0}(le)&&ve}const pl={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},df={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function eh(i,e,r,o,c,h){if(e.imageName){const p=o[e.imageName];return p?p.displaySize[0]*e.scale*gi/h+c:0}{const p=r[e.fontStack],m=p&&p[i];return m?m.metrics.advance*e.scale+c:0}}function th(i,e,r,o){const c=Math.pow(i-e,2);return o?i<e?c/2:2*c:c+Math.abs(r)*r}function pf(i,e,r){let o=0;return i===10&&(o-=1e4),r&&(o+=150),i!==40&&i!==65288||(o+=50),e!==41&&e!==65289||(o+=50),o}function ih(i,e,r,o,c,h){let p=null,m=th(e,r,c,h);for(const g of o){const b=th(e-g.x,r,c,h)+g.badness;b<=m&&(p=g,m=b)}return{index:i,x:e,priorBreak:p,badness:m}}function rh(i){return i?rh(i.priorBreak).concat(i.index):[]}function Ec(i,e,r,o,c,h,p){if(h!=="point")return[];if(!i)return[];const m=[],g=function(z,L,R,q,Z,ne){let he=0;for(let re=0;re<z.length();re++){const le=z.getSection(re);he+=eh(z.getCharCode(re),le,q,Z,L,ne)}return he/Math.max(1,Math.ceil(he/R))}(i,e,r,o,c,p),b=i.text.indexOf("\u200B")>=0;let S=0;for(let z=0;z<i.length();z++){const L=i.getSection(z),R=i.getCharCode(z);if(pl[R]||(S+=eh(R,L,o,c,e,p)),z<i.length()-1){const q=!((C=R)<11904||!(ke["Bopomofo Extended"](C)||ke.Bopomofo(C)||ke["CJK Compatibility Forms"](C)||ke["CJK Compatibility Ideographs"](C)||ke["CJK Compatibility"](C)||ke["CJK Radicals Supplement"](C)||ke["CJK Strokes"](C)||ke["CJK Symbols and Punctuation"](C)||ke["CJK Unified Ideographs Extension A"](C)||ke["CJK Unified Ideographs"](C)||ke["Enclosed CJK Letters and Months"](C)||ke["Halfwidth and Fullwidth Forms"](C)||ke.Hiragana(C)||ke["Ideographic Description Characters"](C)||ke["Kangxi Radicals"](C)||ke["Katakana Phonetic Extensions"](C)||ke.Katakana(C)||ke["Vertical Forms"](C)||ke["Yi Radicals"](C)||ke["Yi Syllables"](C)));(df[R]||q||L.imageName)&&m.push(ih(z+1,S,g,m,pf(R,i.getCharCode(z+1),q&&b),!1))}}var C;return rh(ih(i.length(),S,g,m,0,!0))}function Sc(i){let e=.5,r=.5;switch(i){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(i){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}function ff(i,e,r,o,c){if(!o&&!c)return;const h=i[r],p=(i[r].x+h.metrics.advance*h.scale)*o;for(let m=e;m<=r;m++)i[m].x-=p,i[m].y+=c}function mf(i,e,r){const{horizontalAlign:o,verticalAlign:c}=Sc(r),h=e[0]-i.displaySize[0]*o,p=e[1]-i.displaySize[1]*c;return{image:i,top:p,bottom:p+i.displaySize[1],left:h,right:h+i.displaySize[0]}}function nh(i,e,r,o,c,h){const p=i.image;let m;if(p.content){const Z=p.content,ne=p.pixelRatio||1;m=[Z[0]/ne,Z[1]/ne,p.displaySize[0]-Z[2]/ne,p.displaySize[1]-Z[3]/ne]}const g=e.left*h,b=e.right*h;let S,C,z,L;r==="width"||r==="both"?(L=c[0]+g-o[3],C=c[0]+b+o[1]):(L=c[0]+(g+b-p.displaySize[0])/2,C=L+p.displaySize[0]);const R=e.top*h,q=e.bottom*h;return r==="height"||r==="both"?(S=c[1]+R-o[0],z=c[1]+q+o[2]):(S=c[1]+(R+q-p.displaySize[1])/2,z=S+p.displaySize[1]),{image:p,top:S,right:C,bottom:z,left:L,collisionPadding:m}}const dn=128;function oh(i,e){const{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new Zt(i+1))};if(r.kind==="source")return{kind:"source"};{const{zoomStops:o,interpolationType:c}=r;let h=0;for(;h<o.length&&o[h]<=i;)h++;h=Math.max(0,h-1);let p=h;for(;p<o.length&&o[p]<i+1;)p++;p=Math.min(o.length-1,p);const m=o[h],g=o[p];return r.kind==="composite"?{kind:"composite",minZoom:m,maxZoom:g,interpolationType:c}:{kind:"camera",minZoom:m,maxZoom:g,minSize:r.evaluate(new Zt(m)),maxSize:r.evaluate(new Zt(g)),interpolationType:c}}}class Gn extends et{constructor(e,r,o,c){super(e,r),this.angle=o,c!==void 0&&(this.segment=c)}clone(){return new Gn(this.x,this.y,this.angle,this.segment)}}function sh(i,e,r,o,c){if(e.segment===void 0)return!0;let h=e,p=e.segment+1,m=0;for(;m>-r/2;){if(p--,p<0)return!1;m-=i[p].dist(h),h=i[p]}m+=i[p].dist(i[p+1]),p++;const g=[];let b=0;for(;m<r/2;){const S=i[p],C=i[p+1];if(!C)return!1;let z=i[p-1].angleTo(S)-S.angleTo(C);for(z=Math.abs((z+3*Math.PI)%(2*Math.PI)-Math.PI),g.push({distance:m,angleDelta:z}),b+=z;m-g[0].distance>o;)b-=g.shift().angleDelta;if(b>c)return!1;p++,m+=S.dist(C)}return!0}function ah(i){let e=0;for(let r=0;r<i.length-1;r++)e+=i[r].dist(i[r+1]);return e}function lh(i,e,r){return i?.6*e*r:0}function ch(i,e){return Math.max(i?i.right-i.left:0,e?e.right-e.left:0)}function gf(i,e,r,o,c,h){const p=lh(r,c,h),m=ch(r,o)*h;let g=0;const b=ah(i)/2;for(let S=0;S<i.length-1;S++){const C=i[S],z=i[S+1],L=C.dist(z);if(g+L>b){const R=(b-g)/L,q=Nt(C.x,z.x,R),Z=Nt(C.y,z.y,R),ne=new Gn(q,Z,z.angleTo(C),S);return ne._round(),!p||sh(i,ne,m,p,e)?ne:void 0}g+=L}}function _f(i,e,r,o,c,h,p,m,g){const b=lh(o,h,p),S=ch(o,c),C=S*p,z=i[0].x===0||i[0].x===g||i[0].y===0||i[0].y===g;return e-C<e/4&&(e=C+e/4),uh(i,z?e/2*m%e:(S/2+2*h)*p*m%e,e,b,r,C,z,!1,g)}function uh(i,e,r,o,c,h,p,m,g){const b=h/2,S=ah(i);let C=0,z=e-r,L=[];for(let R=0;R<i.length-1;R++){const q=i[R],Z=i[R+1],ne=q.dist(Z),he=Z.angleTo(q);for(;z+r<C+ne;){z+=r;const re=(z-C)/ne,le=Nt(q.x,Z.x,re),ve=Nt(q.y,Z.y,re);if(le>=0&&le<g&&ve>=0&&ve<g&&z-b>=0&&z+b<=S){const xe=new Gn(le,ve,he,R);xe._round(),o&&!sh(i,xe,h,o,c)||L.push(xe)}}C+=ne}return m||L.length||p||(L=uh(i,C/2,r,o,c,h,p,!0,g)),L}function hh(i,e,r,o,c){const h=[];for(let p=0;p<i.length;p++){const m=i[p];let g;for(let b=0;b<m.length-1;b++){let S=m[b],C=m[b+1];S.x<e&&C.x<e||(S.x<e?S=new et(e,S.y+(e-S.x)/(C.x-S.x)*(C.y-S.y))._round():C.x<e&&(C=new et(e,S.y+(e-S.x)/(C.x-S.x)*(C.y-S.y))._round()),S.y<r&&C.y<r||(S.y<r?S=new et(S.x+(r-S.y)/(C.y-S.y)*(C.x-S.x),r)._round():C.y<r&&(C=new et(S.x+(r-S.y)/(C.y-S.y)*(C.x-S.x),r)._round()),S.x>=o&&C.x>=o||(S.x>=o?S=new et(o,S.y+(o-S.x)/(C.x-S.x)*(C.y-S.y))._round():C.x>=o&&(C=new et(o,S.y+(o-S.x)/(C.x-S.x)*(C.y-S.y))._round()),S.y>=c&&C.y>=c||(S.y>=c?S=new et(S.x+(c-S.y)/(C.y-S.y)*(C.x-S.x),c)._round():C.y>=c&&(C=new et(S.x+(c-S.y)/(C.y-S.y)*(C.x-S.x),c)._round()),g&&S.equals(g[g.length-1])||(g=[S],h.push(g)),g.push(C)))))}}return h}function dh(i,e,r,o){const c=[],h=i.image,p=h.pixelRatio,m=h.paddedRect.w-2,g=h.paddedRect.h-2,b=i.right-i.left,S=i.bottom-i.top,C=h.stretchX||[[0,m]],z=h.stretchY||[[0,g]],L=(Se,Le)=>Se+Le[1]-Le[0],R=C.reduce(L,0),q=z.reduce(L,0),Z=m-R,ne=g-q;let he=0,re=R,le=0,ve=q,xe=0,Ue=Z,Ge=0,De=ne;if(h.content&&o){const Se=h.content;he=fl(C,0,Se[0]),le=fl(z,0,Se[1]),re=fl(C,Se[0],Se[2]),ve=fl(z,Se[1],Se[3]),xe=Se[0]-he,Ge=Se[1]-le,Ue=Se[2]-Se[0]-re,De=Se[3]-Se[1]-ve}const Ae=(Se,Le,ze,Te)=>{const He=ml(Se.stretch-he,re,b,i.left),Xe=gl(Se.fixed-xe,Ue,Se.stretch,R),pt=ml(Le.stretch-le,ve,S,i.top),$t=gl(Le.fixed-Ge,De,Le.stretch,q),jt=ml(ze.stretch-he,re,b,i.left),oi=gl(ze.fixed-xe,Ue,ze.stretch,R),lr=ml(Te.stretch-le,ve,S,i.top),yi=gl(Te.fixed-Ge,De,Te.stretch,q),ei=new et(He,pt),hi=new et(jt,pt),xi=new et(jt,lr),Si=new et(He,lr),Gi=new et(Xe/p,$t/p),ti=new et(oi/p,yi/p),vi=e*Math.PI/180;if(vi){const Zi=Math.sin(vi),qi=Math.cos(vi),Xt=[qi,-Zi,Zi,qi];ei._matMult(Xt),hi._matMult(Xt),Si._matMult(Xt),xi._matMult(Xt)}const Ii=Se.stretch+Se.fixed,Li=Le.stretch+Le.fixed;return{tl:ei,tr:hi,bl:Si,br:xi,tex:{x:h.paddedRect.x+1+Ii,y:h.paddedRect.y+1+Li,w:ze.stretch+ze.fixed-Ii,h:Te.stretch+Te.fixed-Li},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Gi,pixelOffsetBR:ti,minFontScaleX:Ue/p/b,minFontScaleY:De/p/S,isSDF:r}};if(o&&(h.stretchX||h.stretchY)){const Se=ph(C,Z,R),Le=ph(z,ne,q);for(let ze=0;ze<Se.length-1;ze++){const Te=Se[ze],He=Se[ze+1];for(let Xe=0;Xe<Le.length-1;Xe++)c.push(Ae(Te,Le[Xe],He,Le[Xe+1]))}}else c.push(Ae({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:m+1},{fixed:0,stretch:g+1}));return c}function fl(i,e,r){let o=0;for(const c of i)o+=Math.max(e,Math.min(r,c[1]))-Math.max(e,Math.min(r,c[0]));return o}function ph(i,e,r){const o=[{fixed:-1,stretch:0}];for(const[c,h]of i){const p=o[o.length-1];o.push({fixed:c-p.stretch,stretch:p.stretch}),o.push({fixed:c-p.stretch,stretch:p.stretch+(h-c)})}return o.push({fixed:e+1,stretch:r}),o}function ml(i,e,r,o){return i/e*r+o}function gl(i,e,r,o){return i-e*r/o}Ve("Anchor",Gn);class _l{constructor(e,r,o,c,h,p,m,g,b,S){if(this.boxStartIndex=e.length,b){let C=p.top,z=p.bottom;const L=p.collisionPadding;L&&(C-=L[1],z+=L[3]);let R=z-C;R>0&&(R=Math.max(10,R),this.circleDiameter=R)}else{let C=p.top*m-g[0],z=p.bottom*m+g[2],L=p.left*m-g[3],R=p.right*m+g[1];const q=p.collisionPadding;if(q&&(L-=q[0]*m,C-=q[1]*m,R+=q[2]*m,z+=q[3]*m),S){const Z=new et(L,C),ne=new et(R,C),he=new et(L,z),re=new et(R,z),le=S*Math.PI/180;Z._rotate(le),ne._rotate(le),he._rotate(le),re._rotate(le),L=Math.min(Z.x,ne.x,he.x,re.x),R=Math.max(Z.x,ne.x,he.x,re.x),C=Math.min(Z.y,ne.y,he.y,re.y),z=Math.max(Z.y,ne.y,he.y,re.y)}e.emplaceBack(r.x,r.y,L,C,R,z,o,c,h)}this.boxEndIndex=e.length}}class yf{constructor(e=[],r=xf){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.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:r,compare:o}=this,c=r[e];for(;e>0;){const h=e-1>>1,p=r[h];if(o(c,p)>=0)break;r[e]=p,e=h}r[e]=c}_down(e){const{data:r,compare:o}=this,c=this.length>>1,h=r[e];for(;e<c;){let p=1+(e<<1),m=r[p];const g=p+1;if(g<this.length&&o(r[g],m)<0&&(p=g,m=r[g]),o(m,h)>=0)break;r[e]=m,e=p}r[e]=h}}function xf(i,e){return i<e?-1:i>e?1:0}function vf(i,e=1,r=!1){let o=1/0,c=1/0,h=-1/0,p=-1/0;const m=i[0];for(let L=0;L<m.length;L++){const R=m[L];(!L||R.x<o)&&(o=R.x),(!L||R.y<c)&&(c=R.y),(!L||R.x>h)&&(h=R.x),(!L||R.y>p)&&(p=R.y)}const g=Math.min(h-o,p-c);let b=g/2;const S=new yf([],bf);if(g===0)return new et(o,c);for(let L=o;L<h;L+=g)for(let R=c;R<p;R+=g)S.push(new rs(L+b,R+b,b,i));let C=function(L){let R=0,q=0,Z=0;const ne=L[0];for(let he=0,re=ne.length,le=re-1;he<re;le=he++){const ve=ne[he],xe=ne[le],Ue=ve.x*xe.y-xe.x*ve.y;q+=(ve.x+xe.x)*Ue,Z+=(ve.y+xe.y)*Ue,R+=3*Ue}return new rs(q/R,Z/R,0,L)}(i),z=S.length;for(;S.length;){const L=S.pop();(L.d>C.d||!C.d)&&(C=L,r&&console.log("found best %d after %d probes",Math.round(1e4*L.d)/1e4,z)),L.max-C.d<=e||(b=L.h/2,S.push(new rs(L.p.x-b,L.p.y-b,b,i)),S.push(new rs(L.p.x+b,L.p.y-b,b,i)),S.push(new rs(L.p.x-b,L.p.y+b,b,i)),S.push(new rs(L.p.x+b,L.p.y+b,b,i)),z+=4)}return r&&(console.log(`num probes: ${z}`),console.log(`best distance: ${C.d}`)),C.p}function bf(i,e){return e.max-i.max}function rs(i,e,r,o){this.p=new et(i,e),this.h=r,this.d=function(c,h){let p=!1,m=1/0;for(let g=0;g<h.length;g++){const b=h[g];for(let S=0,C=b.length,z=C-1;S<C;z=S++){const L=b[S],R=b[z];L.y>c.y!=R.y>c.y&&c.x<(R.x-L.x)*(c.y-L.y)/(R.y-L.y)+L.x&&(p=!p),m=Math.min(m,bu(c,L,R))}}return(p?1:-1)*Math.sqrt(m)}(this.p,o),this.max=this.d+this.h*Math.SQRT2}const Ic=Number.POSITIVE_INFINITY;function fh(i,e){return e[1]!==Ic?function(r,o,c){let h=0,p=0;switch(o=Math.abs(o),c=Math.abs(c),r){case"top-right":case"top-left":case"top":p=c-7;break;case"bottom-right":case"bottom-left":case"bottom":p=7-c}switch(r){case"top-right":case"bottom-right":case"right":h=-o;break;case"top-left":case"bottom-left":case"left":h=o}return[h,p]}(i,e[0],e[1]):function(r,o){let c=0,h=0;o<0&&(o=0);const p=o/Math.sqrt(2);switch(r){case"top-right":case"top-left":h=p-7;break;case"bottom-right":case"bottom-left":h=7-p;break;case"bottom":h=7-o;break;case"top":h=o-7}switch(r){case"top-right":case"bottom-right":c=-p;break;case"top-left":case"bottom-left":c=p;break;case"left":c=o;break;case"right":c=-o}return[c,h]}(i,e[0])}function Cc(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function wf(i,e,r,o,c,h,p,m,g,b,S){let C=h.textMaxSize.evaluate(e,{});C===void 0&&(C=p);const z=i.layers[0].layout,L=z.get("icon-offset").evaluate(e,{},S),R=gh(r.horizontal),q=p/24,Z=i.tilePixelRatio*q,ne=i.tilePixelRatio*C/24,he=i.tilePixelRatio*m,re=i.tilePixelRatio*z.get("symbol-spacing"),le=z.get("text-padding")*i.tilePixelRatio,ve=function(Te,He,Xe,pt=1){const $t=Te.get("icon-padding").evaluate(He,{},Xe),jt=$t&&$t.values;return[jt[0]*pt,jt[1]*pt,jt[2]*pt,jt[3]*pt]}(z,e,S,i.tilePixelRatio),xe=z.get("text-max-angle")/180*Math.PI,Ue=z.get("text-rotation-alignment")!=="viewport"&&z.get("symbol-placement")!=="point",Ge=z.get("icon-rotation-alignment")==="map"&&z.get("symbol-placement")!=="point",De=z.get("symbol-placement"),Ae=re/2,Se=z.get("icon-text-fit");let Le;o&&Se!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(Le=nh(o,r.vertical,Se,z.get("icon-text-fit-padding"),L,q)),R&&(o=nh(o,R,Se,z.get("icon-text-fit-padding"),L,q)));const ze=(Te,He)=>{He.x<0||He.x>=ni||He.y<0||He.y>=ni||function(Xe,pt,$t,jt,oi,lr,yi,ei,hi,xi,Si,Gi,ti,vi,Ii,Li,Zi,qi,Xt,di,_t,er,bi,Ci,xr){const Pr=Xe.addToLineVertexArray(pt,$t);let zr,pn,vr,cr,ji=0,fn=0,ia=0,kh=0,Fc=-1,Oc=-1;const mn={};let Dh=ui.exports(""),$c=0,Uc=0;if(ei._unevaluatedLayout.getValue("text-radial-offset")===void 0?[$c,Uc]=ei.layout.get("text-offset").evaluate(_t,{},Ci).map(Xi=>Xi*gi):($c=ei.layout.get("text-radial-offset").evaluate(_t,{},Ci)*gi,Uc=Ic),Xe.allowVerticalPlacement&&jt.vertical){const Xi=ei.layout.get("text-rotate").evaluate(_t,{},Ci)+90;vr=new _l(hi,pt,xi,Si,Gi,jt.vertical,ti,vi,Ii,Xi),yi&&(cr=new _l(hi,pt,xi,Si,Gi,yi,Zi,qi,Ii,Xi))}if(oi){const Xi=ei.layout.get("icon-rotate").evaluate(_t,{}),Hr=ei.layout.get("icon-text-fit")!=="none",ra=dh(oi,Xi,bi,Hr),na=yi?dh(yi,Xi,bi,Hr):void 0;pn=new _l(hi,pt,xi,Si,Gi,oi,Zi,qi,!1,Xi),ji=4*ra.length;const Bh=Xe.iconSizeData;let So=null;Bh.kind==="source"?(So=[dn*ei.layout.get("icon-size").evaluate(_t,{})],So[0]>Zn&&ct(`${Xe.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):Bh.kind==="composite"&&(So=[dn*er.compositeIconSizes[0].evaluate(_t,{},Ci),dn*er.compositeIconSizes[1].evaluate(_t,{},Ci)],(So[0]>Zn||So[1]>Zn)&&ct(`${Xe.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),Xe.addSymbols(Xe.icon,ra,So,di,Xt,_t,a.WritingMode.none,pt,Pr.lineStartIndex,Pr.lineLength,-1,Ci),Fc=Xe.icon.placedSymbolArray.length-1,na&&(fn=4*na.length,Xe.addSymbols(Xe.icon,na,So,di,Xt,_t,a.WritingMode.vertical,pt,Pr.lineStartIndex,Pr.lineLength,-1,Ci),Oc=Xe.icon.placedSymbolArray.length-1)}const Lh=Object.keys(jt.horizontal);for(const Xi of Lh){const Hr=jt.horizontal[Xi];if(!zr){Dh=ui.exports(Hr.text);const na=ei.layout.get("text-rotate").evaluate(_t,{},Ci);zr=new _l(hi,pt,xi,Si,Gi,Hr,ti,vi,Ii,na)}const ra=Hr.positionedLines.length===1;if(ia+=mh(Xe,pt,Hr,lr,ei,Ii,_t,Li,Pr,jt.vertical?a.WritingMode.horizontal:a.WritingMode.horizontalOnly,ra?Lh:[Xi],mn,Fc,er,Ci),ra)break}jt.vertical&&(kh+=mh(Xe,pt,jt.vertical,lr,ei,Ii,_t,Li,Pr,a.WritingMode.vertical,["vertical"],mn,Oc,er,Ci));const Rf=zr?zr.boxStartIndex:Xe.collisionBoxArray.length,Bf=zr?zr.boxEndIndex:Xe.collisionBoxArray.length,Ff=vr?vr.boxStartIndex:Xe.collisionBoxArray.length,Of=vr?vr.boxEndIndex:Xe.collisionBoxArray.length,$f=pn?pn.boxStartIndex:Xe.collisionBoxArray.length,Uf=pn?pn.boxEndIndex:Xe.collisionBoxArray.length,Vf=cr?cr.boxStartIndex:Xe.collisionBoxArray.length,Nf=cr?cr.boxEndIndex:Xe.collisionBoxArray.length;let kr=-1;const wl=(Xi,Hr)=>Xi&&Xi.circleDiameter?Math.max(Xi.circleDiameter,Hr):Hr;kr=wl(zr,kr),kr=wl(vr,kr),kr=wl(pn,kr),kr=wl(cr,kr);const Rh=kr>-1?1:0;Rh&&(kr*=xr/gi),Xe.glyphOffsetArray.length>=ns.MAX_GLYPHS&&ct("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),_t.sortKey!==void 0&&Xe.addToSortKeyRanges(Xe.symbolInstances.length,_t.sortKey),Xe.symbolInstances.emplaceBack(pt.x,pt.y,mn.right>=0?mn.right:-1,mn.center>=0?mn.center:-1,mn.left>=0?mn.left:-1,mn.vertical||-1,Fc,Oc,Dh,Rf,Bf,Ff,Of,$f,Uf,Vf,Nf,xi,ia,kh,ji,fn,Rh,0,ti,$c,Uc,kr)}(i,He,Te,r,o,c,Le,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,Z,[le,le,le,le],Ue,g,he,ve,Ge,L,e,h,b,S,p)};if(De==="line")for(const Te of hh(e.geometry,0,0,ni,ni)){const He=_f(Te,re,xe,r.vertical||R,o,24,ne,i.overscaling,ni);for(const Xe of He){const pt=R;pt&&Tf(i,pt.text,Ae,Xe)||ze(Te,Xe)}}else if(De==="line-center"){for(const Te of e.geometry)if(Te.length>1){const He=gf(Te,xe,r.vertical||R,o,24,ne);He&&ze(Te,He)}}else if(e.type==="Polygon")for(const Te of fc(e.geometry,0)){const He=vf(Te,16);ze(Te[0],new Gn(He.x,He.y,0))}else if(e.type==="LineString")for(const Te of e.geometry)ze(Te,new Gn(Te[0].x,Te[0].y,0));else if(e.type==="Point")for(const Te of e.geometry)for(const He of Te)ze([He],new Gn(He.x,He.y,0))}const Zn=32640;function mh(i,e,r,o,c,h,p,m,g,b,S,C,z,L,R){const q=function(he,re,le,ve,xe,Ue,Ge,De){const Ae=ve.layout.get("text-rotate").evaluate(Ue,{})*Math.PI/180,Se=[];for(const Le of re.positionedLines)for(const ze of Le.positionedGlyphs){if(!ze.rect)continue;const Te=ze.rect||{};let He=4,Xe=!0,pt=1,$t=0;const jt=(xe||De)&&ze.vertical,oi=ze.metrics.advance*ze.scale/2;if(De&&re.verticalizable){const Xt=(ze.scale-1)*gi,di=(gi-ze.metrics.width*ze.scale)/2;$t=Le.lineOffset/2-(ze.imageName?-di:Xt)}if(ze.imageName){const Xt=Ge[ze.imageName];Xe=Xt.sdf,pt=Xt.pixelRatio,He=1/pt}const lr=xe?[ze.x+oi,ze.y]:[0,0];let yi=xe?[0,0]:[ze.x+oi+le[0],ze.y+le[1]-$t],ei=[0,0];jt&&(ei=yi,yi=[0,0]);const hi=(ze.metrics.left-He)*ze.scale-oi+yi[0],xi=(-ze.metrics.top-He)*ze.scale+yi[1],Si=hi+Te.w*ze.scale/pt,Gi=xi+Te.h*ze.scale/pt,ti=new et(hi,xi),vi=new et(Si,xi),Ii=new et(hi,Gi),Li=new et(Si,Gi);if(jt){const Xt=new et(-oi,oi-hl),di=-Math.PI/2,_t=12-oi,er=new et(22-_t,-(ze.imageName?_t:0)),bi=new et(...ei);ti._rotateAround(di,Xt)._add(er)._add(bi),vi._rotateAround(di,Xt)._add(er)._add(bi),Ii._rotateAround(di,Xt)._add(er)._add(bi),Li._rotateAround(di,Xt)._add(er)._add(bi)}if(Ae){const Xt=Math.sin(Ae),di=Math.cos(Ae),_t=[di,-Xt,Xt,di];ti._matMult(_t),vi._matMult(_t),Ii._matMult(_t),Li._matMult(_t)}const Zi=new et(0,0),qi=new et(0,0);Se.push({tl:ti,tr:vi,bl:Ii,br:Li,tex:Te,writingMode:re.writingMode,glyphOffset:lr,sectionIndex:ze.sectionIndex,isSDF:Xe,pixelOffsetTL:Zi,pixelOffsetBR:qi,minFontScaleX:0,minFontScaleY:0})}return Se}(0,r,m,c,h,p,o,i.allowVerticalPlacement),Z=i.textSizeData;let ne=null;Z.kind==="source"?(ne=[dn*c.layout.get("text-size").evaluate(p,{})],ne[0]>Zn&&ct(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):Z.kind==="composite"&&(ne=[dn*L.compositeTextSizes[0].evaluate(p,{},R),dn*L.compositeTextSizes[1].evaluate(p,{},R)],(ne[0]>Zn||ne[1]>Zn)&&ct(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),i.addSymbols(i.text,q,ne,m,h,p,b,e,g.lineStartIndex,g.lineLength,z,R);for(const he of S)C[he]=i.text.placedSymbolArray.length-1;return 4*q.length}function gh(i){for(const e in i)return i[e];return null}function Tf(i,e,r,o){const c=i.compareText;if(e in c){const h=c[e];for(let p=h.length-1;p>=0;p--)if(o.dist(h[p])<r)return!0}else c[e]=[];return c[e].push(o),!1}const Ef=Vn.VectorTileFeature.types,Sf=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function yl(i,e,r,o,c,h,p,m,g,b,S,C,z){const L=m?Math.min(Zn,Math.round(m[0])):0,R=m?Math.min(Zn,Math.round(m[1])):0;i.emplaceBack(e,r,Math.round(32*o),Math.round(32*c),h,p,(L<<1)+(g?1:0),R,16*b,16*S,256*C,256*z)}function Ac(i,e,r){i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r)}function If(i){for(const e of i.sections)if(Xa(e.text))return!0;return!1}class Mc{constructor(e){this.layoutVertexArray=new _r,this.indexArray=new zi,this.programConfigurations=e,this.segments=new ft,this.dynamicLayoutVertexArray=new or,this.opacityVertexArray=new yr,this.placedSymbolArray=new we}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,r,o,c){this.isEmpty()||(o&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Wp.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Hp.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,Sf,!0),this.opacityVertexBuffer.itemSize=1),(o||c)&&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())}}Ve("SymbolBuffers",Mc);class Pc{constructor(e,r,o){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new o,this.segments=new ft,this.collisionVertexArray=new Yi}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Kp.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Ve("CollisionBuffers",Pc);class ns{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(p=>p.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=lc([]),this.placementViewportMatrix=lc([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=oh(this.zoom,r["text-size"]),this.iconSizeData=oh(this.zoom,r["icon-size"]);const o=this.layers[0].layout,c=o.get("symbol-sort-key"),h=o.get("symbol-z-order");this.canOverlap=kc(o,"text-overlap","text-allow-overlap")!=="never"||kc(o,"icon-overlap","icon-allow-overlap")!=="never"||o.get("text-ignore-placement")||o.get("icon-ignore-placement"),this.sortFeaturesByKey=h!=="viewport-y"&&!c.isConstant(),this.sortFeaturesByY=(h==="viewport-y"||h==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,o.get("symbol-placement")==="point"&&(this.writingModes=o.get("text-writing-mode").map(p=>a.WritingMode[p])),this.stateDependentLayerIds=this.layers.filter(p=>p.isStateDependent()).map(p=>p.id),this.sourceID=e.sourceID}createArrays(){this.text=new Mc(new vo(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new Mc(new vo(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Ce,this.lineVertexArray=new $e,this.symbolInstances=new Oe}calculateGlyphDependencies(e,r,o,c,h){for(let p=0;p<e.length;p++)if(r[e.charCodeAt(p)]=!0,(o||c)&&h){const m=Ys[e.charAt(p)];m&&(r[m.charCodeAt(0)]=!0)}}populate(e,r,o){const c=this.layers[0],h=c.layout,p=h.get("text-font"),m=h.get("text-field"),g=h.get("icon-image"),b=(m.value.kind!=="constant"||m.value.value instanceof H&&!m.value.value.isEmpty()||m.value.value.toString().length>0)&&(p.value.kind!=="constant"||p.value.value.length>0),S=g.value.kind!=="constant"||!!g.value.value||Object.keys(g.parameters).length>0,C=h.get("symbol-sort-key");if(this.features=[],!b&&!S)return;const z=r.iconDependencies,L=r.glyphDependencies,R=r.availableImages,q=new Zt(this.zoom);for(const{feature:Z,id:ne,index:he,sourceLayerIndex:re}of e){const le=c._featureFilter.needGeometry,ve=wo(Z,le);if(!c._featureFilter.filter(q,ve,o))continue;let xe,Ue;if(le||(ve.geometry=bo(Z)),b){const De=c.getValueAndResolveTokens("text-field",ve,o,R),Ae=H.factory(De);If(Ae)&&(this.hasRTLText=!0),(!this.hasRTLText||_o()==="unavailable"||this.hasRTLText&&Ji.isParsed())&&(xe=Yp(Ae,c,ve))}if(S){const De=c.getValueAndResolveTokens("icon-image",ve,o,R);Ue=De instanceof te?De:te.fromString(De)}if(!xe&&!Ue)continue;const Ge=this.sortFeaturesByKey?C.evaluate(ve,{},o):void 0;if(this.features.push({id:ne,text:xe,icon:Ue,index:he,sourceLayerIndex:re,geometry:ve.geometry,properties:Z.properties,type:Ef[Z.type],sortKey:Ge}),Ue&&(z[Ue.name]=!0),xe){const De=p.evaluate(ve,{},o).join(","),Ae=h.get("text-rotation-alignment")!=="viewport"&&h.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(a.WritingMode.vertical)>=0;for(const Se of xe.sections)if(Se.image)z[Se.image.name]=!0;else{const Le=jo(xe.toString()),ze=Se.fontStack||De,Te=L[ze]=L[ze]||{};this.calculateGlyphDependencies(Se.text,Te,Ae,this.allowVerticalPlacement,Le)}}}h.get("symbol-placement")==="line"&&(this.features=function(Z){const ne={},he={},re=[];let le=0;function ve(De){re.push(Z[De]),le++}function xe(De,Ae,Se){const Le=he[De];return delete he[De],he[Ae]=Le,re[Le].geometry[0].pop(),re[Le].geometry[0]=re[Le].geometry[0].concat(Se[0]),Le}function Ue(De,Ae,Se){const Le=ne[Ae];return delete ne[Ae],ne[De]=Le,re[Le].geometry[0].shift(),re[Le].geometry[0]=Se[0].concat(re[Le].geometry[0]),Le}function Ge(De,Ae,Se){const Le=Se?Ae[0][Ae[0].length-1]:Ae[0][0];return`${De}:${Le.x}:${Le.y}`}for(let De=0;De<Z.length;De++){const Ae=Z[De],Se=Ae.geometry,Le=Ae.text?Ae.text.toString():null;if(!Le){ve(De);continue}const ze=Ge(Le,Se),Te=Ge(Le,Se,!0);if(ze in he&&Te in ne&&he[ze]!==ne[Te]){const He=Ue(ze,Te,Se),Xe=xe(ze,Te,re[He].geometry);delete ne[ze],delete he[Te],he[Ge(Le,re[Xe].geometry,!0)]=Xe,re[He].geometry=null}else ze in he?xe(ze,Te,Se):Te in ne?Ue(ze,Te,Se):(ve(De),ne[ze]=le-1,he[Te]=le-1)}return re.filter(De=>De.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((Z,ne)=>Z.sortKey-ne.sortKey)}update(e,r,o){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,r,this.layers,o),this.icon.programConfigurations.updatePaintArrays(e,r,this.layers,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 c=e.dist(r[e.segment+1]),h=e.dist(r[e.segment]);const p={};for(let m=e.segment+1;m<r.length;m++)p[m]={x:r[m].x,y:r[m].y,tileUnitDistanceFromAnchor:c},m<r.length-1&&(c+=r[m+1].dist(r[m]));for(let m=e.segment||0;m>=0;m--)p[m]={x:r[m].x,y:r[m].y,tileUnitDistanceFromAnchor:h},m>0&&(h+=r[m-1].dist(r[m]));for(let m=0;m<r.length;m++){const g=p[m];this.lineVertexArray.emplaceBack(g.x,g.y,g.tileUnitDistanceFromAnchor)}}return{lineStartIndex:o,lineLength:this.lineVertexArray.length-o}}addSymbols(e,r,o,c,h,p,m,g,b,S,C,z){const L=e.indexArray,R=e.layoutVertexArray,q=e.segments.prepareSegment(4*r.length,R,L,this.canOverlap?p.sortKey:void 0),Z=this.glyphOffsetArray.length,ne=q.vertexLength,he=this.allowVerticalPlacement&&m===a.WritingMode.vertical?Math.PI/2:0,re=p.text&&p.text.sections;for(let le=0;le<r.length;le++){const{tl:ve,tr:xe,bl:Ue,br:Ge,tex:De,pixelOffsetTL:Ae,pixelOffsetBR:Se,minFontScaleX:Le,minFontScaleY:ze,glyphOffset:Te,isSDF:He,sectionIndex:Xe}=r[le],pt=q.vertexLength,$t=Te[1];yl(R,g.x,g.y,ve.x,$t+ve.y,De.x,De.y,o,He,Ae.x,Ae.y,Le,ze),yl(R,g.x,g.y,xe.x,$t+xe.y,De.x+De.w,De.y,o,He,Se.x,Ae.y,Le,ze),yl(R,g.x,g.y,Ue.x,$t+Ue.y,De.x,De.y+De.h,o,He,Ae.x,Se.y,Le,ze),yl(R,g.x,g.y,Ge.x,$t+Ge.y,De.x+De.w,De.y+De.h,o,He,Se.x,Se.y,Le,ze),Ac(e.dynamicLayoutVertexArray,g,he),L.emplaceBack(pt,pt+1,pt+2),L.emplaceBack(pt+1,pt+2,pt+3),q.vertexLength+=4,q.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Te[0]),le!==r.length-1&&Xe===r[le+1].sectionIndex||e.programConfigurations.populatePaintArrays(R.length,p,p.index,{},z,re&&re[Xe])}e.placedSymbolArray.emplaceBack(g.x,g.y,Z,this.glyphOffsetArray.length-Z,ne,b,S,g.segment,o?o[0]:0,o?o[1]:0,c[0],c[1],m,0,!1,0,C)}_addCollisionDebugVertex(e,r,o,c,h,p){return r.emplaceBack(0,0),e.emplaceBack(o.x,o.y,c,h,Math.round(p.x),Math.round(p.y))}addCollisionDebugVertices(e,r,o,c,h,p,m){const g=h.segments.prepareSegment(4,h.layoutVertexArray,h.indexArray),b=g.vertexLength,S=h.layoutVertexArray,C=h.collisionVertexArray,z=m.anchorX,L=m.anchorY;this._addCollisionDebugVertex(S,C,p,z,L,new et(e,r)),this._addCollisionDebugVertex(S,C,p,z,L,new et(o,r)),this._addCollisionDebugVertex(S,C,p,z,L,new et(o,c)),this._addCollisionDebugVertex(S,C,p,z,L,new et(e,c)),g.vertexLength+=4;const R=h.indexArray;R.emplaceBack(b,b+1),R.emplaceBack(b+1,b+2),R.emplaceBack(b+2,b+3),R.emplaceBack(b+3,b),g.primitiveLength+=4}addDebugCollisionBoxes(e,r,o,c){for(let h=e;h<r;h++){const p=this.collisionBoxArray.get(h);this.addCollisionDebugVertices(p.x1,p.y1,p.x2,p.y2,c?this.textCollisionBox:this.iconCollisionBox,p.anchorPoint,o)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Pc(Xr,qu.members,Ar),this.iconCollisionBox=new Pc(Xr,qu.members,Ar);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,c,h,p,m,g,b){const S={};for(let C=r;C<o;C++){const z=e.get(C);S.textBox={x1:z.x1,y1:z.y1,x2:z.x2,y2:z.y2,anchorPointX:z.anchorPointX,anchorPointY:z.anchorPointY},S.textFeatureIndex=z.featureIndex;break}for(let C=c;C<h;C++){const z=e.get(C);S.verticalTextBox={x1:z.x1,y1:z.y1,x2:z.x2,y2:z.y2,anchorPointX:z.anchorPointX,anchorPointY:z.anchorPointY},S.verticalTextFeatureIndex=z.featureIndex;break}for(let C=p;C<m;C++){const z=e.get(C);S.iconBox={x1:z.x1,y1:z.y1,x2:z.x2,y2:z.y2,anchorPointX:z.anchorPointX,anchorPointY:z.anchorPointY},S.iconFeatureIndex=z.featureIndex;break}for(let C=g;C<b;C++){const z=e.get(C);S.verticalIconBox={x1:z.x1,y1:z.y1,x2:z.x2,y2:z.y2,anchorPointX:z.anchorPointX,anchorPointY:z.anchorPointY},S.verticalIconFeatureIndex=z.featureIndex;break}return S}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),c=o.vertexStartIndex+4*o.numGlyphs;for(let h=o.vertexStartIndex;h<c;h+=4)e.indexArray.emplaceBack(h,h+1,h+2),e.indexArray.emplaceBack(h+1,h+2,h+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const r=Math.sin(e),o=Math.cos(e),c=[],h=[],p=[];for(let m=0;m<this.symbolInstances.length;++m){p.push(m);const g=this.symbolInstances.get(m);c.push(0|Math.round(r*g.anchorX+o*g.anchorY)),h.push(g.featureIndex)}return p.sort((m,g)=>c[m]-c[g]||h[g]-h[m]),p}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((c,h,p)=>{c>=0&&p.indexOf(c)===h&&this.addIndicesForPlacedSymbol(this.text,c)}),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)}}}Ve("SymbolBucket",ns,{omit:["layers","collisionBoxArray","features","compareText"]}),ns.MAX_GLYPHS=65535,ns.addDynamicAttributes=Ac;const Cf=new mi({"symbol-placement":new je(ye.layout_symbol["symbol-placement"]),"symbol-spacing":new je(ye.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new je(ye.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Qe(ye.layout_symbol["symbol-sort-key"]),"symbol-z-order":new je(ye.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new je(ye.layout_symbol["icon-allow-overlap"]),"icon-overlap":new je(ye.layout_symbol["icon-overlap"]),"icon-ignore-placement":new je(ye.layout_symbol["icon-ignore-placement"]),"icon-optional":new je(ye.layout_symbol["icon-optional"]),"icon-rotation-alignment":new je(ye.layout_symbol["icon-rotation-alignment"]),"icon-size":new Qe(ye.layout_symbol["icon-size"]),"icon-text-fit":new je(ye.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new je(ye.layout_symbol["icon-text-fit-padding"]),"icon-image":new Qe(ye.layout_symbol["icon-image"]),"icon-rotate":new Qe(ye.layout_symbol["icon-rotate"]),"icon-padding":new Qe(ye.layout_symbol["icon-padding"]),"icon-keep-upright":new je(ye.layout_symbol["icon-keep-upright"]),"icon-offset":new Qe(ye.layout_symbol["icon-offset"]),"icon-anchor":new Qe(ye.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new je(ye.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new je(ye.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new je(ye.layout_symbol["text-rotation-alignment"]),"text-field":new Qe(ye.layout_symbol["text-field"]),"text-font":new Qe(ye.layout_symbol["text-font"]),"text-size":new Qe(ye.layout_symbol["text-size"]),"text-max-width":new Qe(ye.layout_symbol["text-max-width"]),"text-line-height":new je(ye.layout_symbol["text-line-height"]),"text-letter-spacing":new Qe(ye.layout_symbol["text-letter-spacing"]),"text-justify":new Qe(ye.layout_symbol["text-justify"]),"text-radial-offset":new Qe(ye.layout_symbol["text-radial-offset"]),"text-variable-anchor":new je(ye.layout_symbol["text-variable-anchor"]),"text-anchor":new Qe(ye.layout_symbol["text-anchor"]),"text-max-angle":new je(ye.layout_symbol["text-max-angle"]),"text-writing-mode":new je(ye.layout_symbol["text-writing-mode"]),"text-rotate":new Qe(ye.layout_symbol["text-rotate"]),"text-padding":new je(ye.layout_symbol["text-padding"]),"text-keep-upright":new je(ye.layout_symbol["text-keep-upright"]),"text-transform":new Qe(ye.layout_symbol["text-transform"]),"text-offset":new Qe(ye.layout_symbol["text-offset"]),"text-allow-overlap":new je(ye.layout_symbol["text-allow-overlap"]),"text-overlap":new je(ye.layout_symbol["text-overlap"]),"text-ignore-placement":new je(ye.layout_symbol["text-ignore-placement"]),"text-optional":new je(ye.layout_symbol["text-optional"])});var zc={paint:new mi({"icon-opacity":new Qe(ye.paint_symbol["icon-opacity"]),"icon-color":new Qe(ye.paint_symbol["icon-color"]),"icon-halo-color":new Qe(ye.paint_symbol["icon-halo-color"]),"icon-halo-width":new Qe(ye.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Qe(ye.paint_symbol["icon-halo-blur"]),"icon-translate":new je(ye.paint_symbol["icon-translate"]),"icon-translate-anchor":new je(ye.paint_symbol["icon-translate-anchor"]),"text-opacity":new Qe(ye.paint_symbol["text-opacity"]),"text-color":new Qe(ye.paint_symbol["text-color"],{runtimeType:fi,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new Qe(ye.paint_symbol["text-halo-color"]),"text-halo-width":new Qe(ye.paint_symbol["text-halo-width"]),"text-halo-blur":new Qe(ye.paint_symbol["text-halo-blur"]),"text-translate":new je(ye.paint_symbol["text-translate"]),"text-translate-anchor":new je(ye.paint_symbol["text-translate-anchor"])}),layout:Cf};class _h{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:$r,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}}Ve("FormatSectionOverride",_h,{omit:["defaultValue"]});class xl extends gr{constructor(e){super(e,zc)}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 c=[];for(const h of o)c.indexOf(h)<0&&c.push(h);this.layout._values["text-writing-mode"]=c}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,o,c){const h=this.layout.get(e).evaluate(r,{},o,c),p=this._unevaluatedLayout._values[e];return p.isDataDriven()||ro(p.value)||!h?h:function(m,g){return g.replace(/{([^{}]+)}/g,(b,S)=>S in m?String(m[S]):"")}(r.properties,h)}createBucket(e){return new ns(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of zc.paint.overridableProperties){if(!xl.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),o=new _h(r),c=new Uo(o,r.property.specification);let h=null;h=r.value.kind==="constant"||r.value.kind==="source"?new oo("source",c):new Is("composite",c,r.value.zoomStops),this.paint._values[e]=new mr(r.property,h,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,o){return!(!this.layout||r.isDataDriven()||o.isDataDriven())&&xl.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const o=e.get("text-field"),c=zc.paint.properties[r];let h=!1;const p=m=>{for(const g of m)if(c.overrides&&c.overrides.hasOverride(g))return void(h=!0)};if(o.value.kind==="constant"&&o.value.value instanceof H)p(o.value.value.sections);else if(o.value.kind==="source"){const m=b=>{h||(b instanceof qe&&pe(b.value)===si?p(b.value.sections):b instanceof Oo?p(b.sections):b.eachChild(m))},g=o.value;g._styleExpression&&m(g._styleExpression.expression)}return h}}function kc(i,e,r){let o="never";const c=i.get(e);return c?o=c:i.get(r)&&(o="always"),o}var Af={paint:new mi({"background-color":new je(ye.paint_background["background-color"]),"background-pattern":new Os(ye.paint_background["background-pattern"]),"background-opacity":new je(ye.paint_background["background-opacity"])})},Mf={paint:new mi({"raster-opacity":new je(ye.paint_raster["raster-opacity"]),"raster-hue-rotate":new je(ye.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new je(ye.paint_raster["raster-brightness-min"]),"raster-brightness-max":new je(ye.paint_raster["raster-brightness-max"]),"raster-saturation":new je(ye.paint_raster["raster-saturation"]),"raster-contrast":new je(ye.paint_raster["raster-contrast"]),"raster-resampling":new je(ye.paint_raster["raster-resampling"]),"raster-fade-duration":new je(ye.paint_raster["raster-fade-duration"])})};class Pf extends gr{constructor(e){super(e,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=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")}}const zf={circle:class extends gr{constructor(i){super(i,ap)}createBucket(i){return new oc(i)}queryRadius(i){const e=i;return Gs("circle-radius",this,e)+Gs("circle-stroke-width",this,e)+il(this.paint.get("circle-translate"))}queryIntersectsFeature(i,e,r,o,c,h,p,m){const g=rl(i,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),h.angle,p),b=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),S=this.paint.get("circle-pitch-alignment")==="map",C=S?g:function(L,R){return L.map(q=>Au(q,R))}(g,m),z=S?b*p:b;for(const L of o)for(const R of L){const q=S?R:Au(R,m);let Z=z;const ne=nl([],[R.x,R.y,0,1],m);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?Z*=ne[3]/h.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(Z*=h.cameraToCenterDistance/ne[3]),ip(C,q,Z))return!0}return!1}},heatmap:class extends gr{constructor(i){super(i,cp),this._updateColorRamp()}createBucket(i){return new Mu(i)}_handleSpecialPaintPropertyUpdate(i){i==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=zu({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}},hillshade:class extends gr{constructor(i){super(i,up)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}},fill:class extends gr{constructor(i){super(i,Ip)}recalculate(i,e){super.recalculate(i,e);const r=this.paint._values["fill-outline-color"];r.value.kind==="constant"&&r.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(i){return new _c(i)}queryRadius(){return il(this.paint.get("fill-translate"))}queryIntersectsFeature(i,e,r,o,c,h,p){return vu(rl(i,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),h.angle,p),o)}isTileClipped(){return!0}},"fill-extrusion":class extends gr{constructor(i){super(i,Up)}createBucket(i){return new xc(i)}queryRadius(){return il(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(i,e,r,o,c,h,p,m){const g=rl(i,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),h.angle,p),b=this.paint.get("fill-extrusion-height").evaluate(e,r),S=this.paint.get("fill-extrusion-base").evaluate(e,r),C=function(L,R,q,Z){const ne=[];for(const he of L){const re=[he.x,he.y,0,1];nl(re,re,R),ne.push(new et(re[0]/re[3],re[1]/re[3]))}return ne}(g,m),z=function(L,R,q,Z){const ne=[],he=[],re=Z[8]*R,le=Z[9]*R,ve=Z[10]*R,xe=Z[11]*R,Ue=Z[8]*q,Ge=Z[9]*q,De=Z[10]*q,Ae=Z[11]*q;for(const Se of L){const Le=[],ze=[];for(const Te of Se){const He=Te.x,Xe=Te.y,pt=Z[0]*He+Z[4]*Xe+Z[12],$t=Z[1]*He+Z[5]*Xe+Z[13],jt=Z[2]*He+Z[6]*Xe+Z[14],oi=Z[3]*He+Z[7]*Xe+Z[15],lr=jt+ve,yi=oi+xe,ei=pt+Ue,hi=$t+Ge,xi=jt+De,Si=oi+Ae,Gi=new et((pt+re)/yi,($t+le)/yi);Gi.z=lr/yi,Le.push(Gi);const ti=new et(ei/Si,hi/Si);ti.z=xi/Si,ze.push(ti)}ne.push(Le),he.push(ze)}return[ne,he]}(o,S,b,m);return function(L,R,q){let Z=1/0;vu(q,R)&&(Z=Uu(q,R[0]));for(let ne=0;ne<R.length;ne++){const he=R[ne],re=L[ne];for(let le=0;le<he.length-1;le++){const ve=he[le],xe=[ve,he[le+1],re[le+1],re[le],ve];xu(q,xe)&&(Z=Math.min(Z,Uu(q,xe)))}}return Z!==1/0&&Z}(z[0],z[1],C)}},line:class extends gr{constructor(i){super(i,Nu),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(i){i==="line-gradient"&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof Yn,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER)}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(i,e){super.recalculate(i,e),this.paint._values["line-floorwidth"]=Gu.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,i)}createBucket(i){return new vc(i)}queryRadius(i){const e=i,r=Zu(Gs("line-width",this,e),Gs("line-gap-width",this,e)),o=Gs("line-offset",this,e);return r/2+Math.abs(o)+il(this.paint.get("line-translate"))}queryIntersectsFeature(i,e,r,o,c,h,p){const m=rl(i,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),h.angle,p),g=p/2*Zu(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),b=this.paint.get("line-offset").evaluate(e,r);return b&&(o=function(S,C){const z=[];for(let L=0;L<S.length;L++){const R=S[L],q=[];for(let Z=0;Z<R.length;Z++){const ne=R[Z-1],he=R[Z],re=R[Z+1],le=Z===0?new et(0,0):he.sub(ne)._unit()._perp(),ve=Z===R.length-1?new et(0,0):re.sub(he)._unit()._perp(),xe=le._add(ve)._unit(),Ue=xe.x*ve.x+xe.y*ve.y;Ue!==0&&xe._mult(1/Ue),q.push(xe._mult(C)._add(he))}z.push(q)}return z}(o,b*p)),function(S,C,z){for(let L=0;L<C.length;L++){const R=C[L];if(S.length>=3){for(let q=0;q<R.length;q++)if(Jo(S,R[q]))return!0}if(rp(S,R,z))return!0}return!1}(m,o,g)}isTileClipped(){return!0}},symbol:xl,background:class extends gr{constructor(i){super(i,Af)}},raster:class extends gr{constructor(i){super(i,Mf)}}};class kf{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel!="undefined"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}const yh=63710088e-1;class Kt{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 Kt(Re(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,c=e.lat*r,h=Math.sin(o)*Math.sin(c)+Math.cos(o)*Math.cos(c)*Math.cos((e.lng-this.lng)*r);return yh*Math.acos(Math.min(h,1))}toBounds(e=0){const r=360*e/40075017,o=r/Math.cos(Math.PI/180*this.lat);return new Eo(new Kt(this.lng-o,this.lat-r),new Kt(this.lng+o,this.lat+r))}static convert(e){if(e instanceof Kt)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Kt(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Kt(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}class Eo{constructor(e,r){e&&(r?this.setSouthWest(e).setNorthEast(r):e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1]))}setNorthEast(e){return this._ne=e instanceof Kt?new Kt(e.lng,e.lat):Kt.convert(e),this}setSouthWest(e){return this._sw=e instanceof Kt?new Kt(e.lng,e.lat):Kt.convert(e),this}extend(e){const r=this._sw,o=this._ne;let c,h;if(e instanceof Kt)c=e,h=e;else{if(!(e instanceof Eo))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(Eo.convert(e)):this.extend(Kt.convert(e)):this;if(c=e._sw,h=e._ne,!c||!h)return this}return r||o?(r.lng=Math.min(c.lng,r.lng),r.lat=Math.min(c.lat,r.lat),o.lng=Math.max(h.lng,o.lng),o.lat=Math.max(h.lat,o.lat)):(this._sw=new Kt(c.lng,c.lat),this._ne=new Kt(h.lng,h.lat)),this}getCenter(){return new Kt((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 Kt(this.getWest(),this.getNorth())}getSouthEast(){return new Kt(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:r,lat:o}=Kt.convert(e);let c=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(c=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=o&&o<=this._ne.lat&&c}static convert(e){return e instanceof Eo?e:e&&new Eo(e)}}const xh=2*Math.PI*yh;function vh(i){return xh*Math.cos(i*Math.PI/180)}function bh(i){return(180+i)/360}function wh(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function Th(i,e){return i/vh(e)}function Dc(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class vl{constructor(e,r,o=0){this.x=+e,this.y=+r,this.z=+o}static fromLngLat(e,r=0){const o=Kt.convert(e);return new vl(bh(o.lng),wh(o.lat),Th(r,o.lat))}toLngLat(){return new Kt(360*this.x-180,Dc(this.y))}toAltitude(){return this.z*vh(Dc(this.y))}meterInMercatorCoordinateUnits(){return 1/xh*(e=Dc(this.y),1/Math.cos(e*Math.PI/180));var e}}function Eh(i,e,r){var o=2*Math.PI*6378137/256/Math.pow(2,r);return[i*o-2*Math.PI*6378137/2,e*o-2*Math.PI*6378137/2]}class Lc{constructor(e,r,o){if(e<0||e>25||o<0||o>=Math.pow(2,e)||r<0||r>=Math.pow(2,e))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=ea(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 c=(p=this.y,m=this.z,g=Eh(256*(h=this.x),256*(p=Math.pow(2,m)-p-1),m),b=Eh(256*(h+1),256*(p+1),m),g[0]+","+g[1]+","+b[0]+","+b[1]);var h,p,m,g,b;const S=function(C,z,L){let R,q="";for(let Z=C;Z>0;Z--)R=1<<Z-1,q+=(z&R?1:0)+(L&R?2:0);return q}(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,S).replace(/{bbox-epsg-3857}/g,c)}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 et((e.x*r-this.x)*ni,(e.y*r-this.y)*ni)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Sh{constructor(e,r){this.wrap=e,this.canonical=r,this.key=ea(e,r.z,r.z,r.x,r.y)}}class ar{constructor(e,r,o,c,h){if(e<o)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${o}`);this.overscaledZ=e,this.wrap=r,this.canonical=new Lc(o,+c,+h),this.key=ea(r,e,o,c,h)}clone(){return new ar(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 ar(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ar(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}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?ea(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):ea(this.wrap*+r,e,e,this.canonical.x>>o,this.canonical.y>>o)}isChildOf(e){if(e.wrap!==this.wrap)return!1;const r=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.x===this.canonical.x>>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new ar(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,c=2*this.canonical.y;return[new ar(r,this.wrap,r,o,c),new ar(r,this.wrap,r,o+1,c),new ar(r,this.wrap,r,o,c+1),new ar(r,this.wrap,r,o+1,c+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 ar(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new ar(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 Sh(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new vl(e.x-this.wrap,e.y))}}function ea(i,e,r,o,c){(i*=2)<0&&(i=-1*i-1);const h=1<<r;return(h*h*i+h*c+o).toString(36)+r.toString(36)+e.toString(36)}Ve("CanonicalTileID",Lc),Ve("OverscaledTileID",ar,{omit:["posMatrix"]});class Ih{constructor(e,r,o){if(this.uid=e,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(o&&o!=="mapbox"&&o!=="terrarium")return void ct(`"${o}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=r.height;const c=this.dim=r.height-2;this.data=new Uint32Array(r.data.buffer),this.encoding=o||"mapbox";for(let h=0;h<c;h++)this.data[this._idx(-1,h)]=this.data[this._idx(0,h)],this.data[this._idx(c,h)]=this.data[this._idx(c-1,h)],this.data[this._idx(h,-1)]=this.data[this._idx(h,0)],this.data[this._idx(h,c)]=this.data[this._idx(h,c-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(c,-1)]=this.data[this._idx(c-1,0)],this.data[this._idx(-1,c)]=this.data[this._idx(0,c-1)],this.data[this._idx(c,c)]=this.data[this._idx(c-1,c-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let h=0;h<c;h++)for(let p=0;p<c;p++){const m=this.get(h,p);m>this.max&&(this.max=m),m<this.min&&(this.min=m)}}get(e,r){const o=new Uint8Array(this.data.buffer),c=4*this._idx(e,r);return(this.encoding==="terrarium"?this._unpackTerrarium:this._unpackMapbox)(o[c],o[c+1],o[c+2])}getUnpackVector(){return this.encoding==="terrarium"?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]}_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");return(r+1)*this.stride+(e+1)}_unpackMapbox(e,r,o){return(256*e*256+256*r+o)/10-1e4}_unpackTerrarium(e,r,o){return 256*e+r+o/256-32768}getPixels(){return new sr({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 c=r*this.dim,h=r*this.dim+this.dim,p=o*this.dim,m=o*this.dim+this.dim;switch(r){case-1:c=h-1;break;case 1:h=c+1}switch(o){case-1:p=m-1;break;case 1:m=p+1}const g=-r*this.dim,b=-o*this.dim;for(let S=p;S<m;S++)for(let C=c;C<h;C++)this.data[this._idx(C,S)]=e.data[this._idx(C+g,S+b)]}}Ve("DEMData",Ih);class Ch{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 Ah{constructor(e,r,o,c,h){this.type="Feature",this._vectorTileFeature=e,e._z=r,e._x=o,e._y=c,this.properties=e.properties,this.id=h}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(e[r]=this[r]);return e}}class Mh{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new go(ni,16,0),this.grid3D=new go(ni,16,0),this.featureIndexArray=new dt,this.promoteId=r}insert(e,r,o,c,h,p){const m=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(o,c,h);const g=p?this.grid3D:this.grid;for(let b=0;b<r.length;b++){const S=r[b],C=[1/0,1/0,-1/0,-1/0];for(let z=0;z<S.length;z++){const L=S[z];C[0]=Math.min(C[0],L.x),C[1]=Math.min(C[1],L.y),C[2]=Math.max(C[2],L.x),C[3]=Math.max(C[3],L.y)}C[0]<ni&&C[1]<ni&&C[2]>=0&&C[3]>=0&&g.insert(m,C[0],C[1],C[2],C[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Vn.VectorTile(new bc(this.rawTileData)).layers,this.sourceLayerCoder=new Ch(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,o,c){this.loadVTLayers();const h=e.params||{},p=ni/e.tileSize/e.scale,m=Go(h.filter),g=e.queryGeometry,b=e.queryPadding*p,S=zh(g),C=this.grid.query(S.minX-b,S.minY-b,S.maxX+b,S.maxY+b),z=zh(e.cameraQueryGeometry),L=this.grid3D.query(z.minX-b,z.minY-b,z.maxX+b,z.maxY+b,(Z,ne,he,re)=>function(le,ve,xe,Ue,Ge){for(const Ae of le)if(ve<=Ae.x&&xe<=Ae.y&&Ue>=Ae.x&&Ge>=Ae.y)return!0;const De=[new et(ve,xe),new et(ve,Ge),new et(Ue,Ge),new et(Ue,xe)];if(le.length>2){for(const Ae of De)if(Jo(le,Ae))return!0}for(let Ae=0;Ae<le.length-1;Ae++)if(op(le[Ae],le[Ae+1],De))return!0;return!1}(e.cameraQueryGeometry,Z-b,ne-b,he+b,re+b));for(const Z of L)C.push(Z);C.sort(Df);const R={};let q;for(let Z=0;Z<C.length;Z++){const ne=C[Z];if(ne===q)continue;q=ne;const he=this.featureIndexArray.get(ne);let re=null;this.loadMatchingFeature(R,he.bucketIndex,he.sourceLayerIndex,he.featureIndex,m,h.layers,h.availableImages,r,o,c,(le,ve,xe)=>(re||(re=bo(le)),ve.queryIntersectsFeature(g,le,xe,re,this.z,e.transform,p,e.pixelPosMatrix)))}return R}loadMatchingFeature(e,r,o,c,h,p,m,g,b,S,C){const z=this.bucketLayerIDs[r];if(p&&!function(Z,ne){for(let he=0;he<Z.length;he++)if(ne.indexOf(Z[he])>=0)return!0;return!1}(p,z))return;const L=this.sourceLayerCoder.decode(o),R=this.vtLayers[L].feature(c);if(h.needGeometry){const Z=wo(R,!0);if(!h.filter(new Zt(this.tileID.overscaledZ),Z,this.tileID.canonical))return}else if(!h.filter(new Zt(this.tileID.overscaledZ),R))return;const q=this.getId(R,L);for(let Z=0;Z<z.length;Z++){const ne=z[Z];if(p&&p.indexOf(ne)<0)continue;const he=g[ne];if(!he)continue;let re={};q&&S&&(re=S.getState(he.sourceLayer||"_geojsonTileLayer",q));const le=Fe({},b[ne]);le.paint=Ph(le.paint,he.paint,R,re,m),le.layout=Ph(le.layout,he.layout,R,re,m);const ve=!C||C(R,he,re);if(!ve)continue;const xe=new Ah(R,this.z,this.x,this.y,q);xe.layer=le;let Ue=e[ne];Ue===void 0&&(Ue=e[ne]=[]),Ue.push({featureIndex:c,feature:xe,intersectionZ:ve})}}lookupSymbolFeatures(e,r,o,c,h,p,m,g){const b={};this.loadVTLayers();const S=Go(h);for(const C of e)this.loadMatchingFeature(b,o,c,C,S,p,m,g,r);return b}hasLayer(e){for(const r of this.bucketLayerIDs)for(const o of r)if(e===o)return!0;return!1}getId(e,r){let o=e.id;return this.promoteId&&(o=e.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],typeof o=="boolean"&&(o=Number(o))),o}}function Ph(i,e,r,o,c){return Ke(i,(h,p)=>{const m=e instanceof xo?e.get(p):null;return m&&m.evaluate?m.evaluate(r,o,c):m})}function zh(i){let e=1/0,r=1/0,o=-1/0,c=-1/0;for(const h of i)e=Math.min(e,h.x),r=Math.min(r,h.y),o=Math.max(o,h.x),c=Math.max(c,h.y);return{minX:e,minY:r,maxX:o,maxY:c}}function Df(i,e){return e-i}var Rc;Ve("FeatureIndex",Mh,{omit:["rawTileData","sourceLayerCoder"]}),a.PerformanceMarkers=void 0,(Rc=a.PerformanceMarkers||(a.PerformanceMarkers={})).create="create",Rc.load="load",Rc.fullLoad="fullLoad";let bl=null,ta=[];const Bc=1e3/30,Lf={mark(i){performance.mark(i)},frame(i){const e=i;bl!=null&&ta.push(e-bl),bl=e},clearMetrics(){bl=null,ta=[],performance.clearMeasures("loadTime"),performance.clearMeasures("fullLoadTime");for(const i in a.PerformanceMarkers)performance.clearMarks(a.PerformanceMarkers[i])},getPerformanceMetrics(){performance.measure("loadTime",a.PerformanceMarkers.create,a.PerformanceMarkers.load),performance.measure("fullLoadTime",a.PerformanceMarkers.create,a.PerformanceMarkers.fullLoad);const i=performance.getEntriesByName("loadTime")[0].duration,e=performance.getEntriesByName("fullLoadTime")[0].duration,r=ta.length,o=1/(ta.reduce((h,p)=>h+p,0)/r/1e3),c=ta.filter(h=>h>Bc).reduce((h,p)=>h+(p-Bc)/Bc,0);return{loadTime:i,fullLoadTime:e,fps:o,percentDroppedFrames:c/(r+c)*100}}};a.AJAXError=Fi,a.ARRAY_TYPE=Di,a.Actor=class{constructor(i,e,r){this.target=i,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},Ze(["receive","process"],this),this.invoker=new kf(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=Wt()?i:window}send(i,e,r,o,c=!1){const h=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[h]=r);const p=wi(this.globalScope)?void 0:[];return this.target.postMessage({id:h,type:i,hasCallback:!!r,targetMapId:o,mustQueue:c,sourceMapId:this.mapId,data:on(e,p)},p),{cancel:()=>{r&&delete this.callbacks[h],this.target.postMessage({id:h,type:"<cancel>",targetMapId:o,sourceMapId:this.mapId})}}}receive(i){const e=i.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if(e.type==="<cancel>"){delete this.tasks[r];const o=this.cancelCallbacks[r];delete this.cancelCallbacks[r],o&&o()}else Wt()||e.mustQueue?(this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,e)}process(){if(!this.taskQueue.length)return;const i=this.taskQueue.shift(),e=this.tasks[i];delete this.tasks[i],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(i,e)}processTask(i,e){if(e.type==="<response>"){const r=this.callbacks[i];delete this.callbacks[i],r&&(e.error?r(Nr(e.error)):r(null,Nr(e.data)))}else{let r=!1;const o=wi(this.globalScope)?void 0:[],c=e.hasCallback?(m,g)=>{r=!0,delete this.cancelCallbacks[i],this.target.postMessage({id:i,type:"<response>",sourceMapId:this.mapId,error:m?on(m):null,data:on(g,o)},o)}:m=>{r=!0};let h=null;const p=Nr(e.data);if(this.parent[e.type])h=this.parent[e.type](e.sourceMapId,p,c);else if(this.parent.getWorkerSource){const m=e.type.split(".");h=this.parent.getWorkerSource(e.sourceMapId,m[0],p.source)[m[1]](p,c)}else c(new Error(`Could not find function ${e.type}`));!r&&h&&h.cancel&&(this.cancelCallbacks[i]=h.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},a.AlphaImage=qs,a.CanonicalTileID=Lc,a.CollisionBoxArray=ge,a.CollisionCircleLayoutArray=class extends I{},a.Color=O,a.DEMData=Ih,a.DataConstantProperty=je,a.DictionaryCoder=Ch,a.EXTENT=ni,a.ErrorEvent=Tn,a.EvaluationParameters=Zt,a.Event=Tr,a.Evented=Er,a.FeatureIndex=Mh,a.FillBucket=_c,a.FillExtrusionBucket=xc,a.GeoJSONFeature=Ah,a.ImageAtlas=Qu,a.ImagePosition=Tc,a.LineBucket=vc,a.LineStripIndexArray=class extends G{},a.LngLat=Kt,a.LngLatBounds=Eo,a.MercatorCoordinate=vl,a.ONE_EM=gi,a.OverscaledTileID=ar,a.PerformanceUtils=Lf,a.PosArray=We,a.Properties=mi,a.QuadTriangleArray=class extends D{},a.RGBAImage=sr,a.RasterBoundsArray=class extends l{},a.RequestPerformance=class{constructor(i){this._marks={start:[i.url,"start"].join("#"),end:[i.url,"end"].join("#"),measure:i.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let i=performance.getEntriesByName(this._marks.measure);return i.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),i=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),i}},a.ResourceType=br,a.SegmentVector=ft,a.SymbolBucket=ns,a.Transitionable=Ka,a.TriangleIndexArray=zi,a.Uniform1f=cn,a.Uniform1i=class extends ln{constructor(i,e){super(i,e),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},a.Uniform2f=class extends ln{constructor(i,e){super(i,e),this.current=[0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1]))}},a.Uniform3f=class extends ln{constructor(i,e){super(i,e),this.current=[0,0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2]))}},a.Uniform4f=Ho,a.UniformColor=mu,a.UniformMatrix4f=class extends ln{constructor(i,e){super(i,e),this.current=ep}set(i){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let e=1;e<16;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}},a.UnwrappedTileID=Sh,a.ValidationError=Pe,a.ZoomHistory=Ps,a.add=function(i,e,r){return i[0]=e[0]+r[0],i[1]=e[1]+r[1],i[2]=e[2]+r[2],i},a.addDynamicAttributes=Ac,a.asyncAll=function(i,e,r){if(!i.length)return r(null,[]);let o=i.length;const c=new Array(i.length);let h=null;i.forEach((p,m)=>{e(p,(g,b)=>{g&&(h=g),c[m]=b,--o==0&&r(h,c)})})},a.bezier=ce,a.bindAll=Ze,a.cacheEntryPossiblyAdded=function(i){dr++,dr>yn&&(i.getActor().send("enforceCacheSizeLimit",_n),dr=0)},a.clamp=ee,a.clearTileCache=function(i){const e=caches.delete(Ai);i&&e.catch(i).then(()=>i())},a.clipLine=hh,a.clone=function(i){var e=new Di(16);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},a.clone$1=tt,a.clone$2=function(i){var e=new Di(3);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e},a.collisionCircleLayout=Jp,a.config=Hi,a.copy=function(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},a.create=function(){var i=new Di(16);return Di!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},a.create$1=Tu,a.createExpression=no,a.createFilter=Go,a.createLayout=Qt,a.createStyleLayer=function(i){return i.type==="custom"?new Pf(i):new zf[i.type](i)},a.cross=function(i,e,r){var o=e[0],c=e[1],h=e[2],p=r[0],m=r[1],g=r[2];return i[0]=c*g-h*m,i[1]=h*p-o*g,i[2]=o*m-c*p,i},a.dot=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]},a.dot$1=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]*e[3]},a.ease=oe,a.emitValidationErrors=qo,a.enforceCacheSizeLimit=function(i){xn(),ir&&ir.then(e=>{e.keys().then(r=>{for(let o=0;o<r.length-i;o++)e.delete(r[o])})})},a.equals=function(i,e){var r=i[0],o=i[1],c=i[2],h=i[3],p=i[4],m=i[5],g=i[6],b=i[7],S=i[8],C=i[9],z=i[10],L=i[11],R=i[12],q=i[13],Z=i[14],ne=i[15],he=e[0],re=e[1],le=e[2],ve=e[3],xe=e[4],Ue=e[5],Ge=e[6],De=e[7],Ae=e[8],Se=e[9],Le=e[10],ze=e[11],Te=e[12],He=e[13],Xe=e[14],pt=e[15];return Math.abs(r-he)<=ki*Math.max(1,Math.abs(r),Math.abs(he))&&Math.abs(o-re)<=ki*Math.max(1,Math.abs(o),Math.abs(re))&&Math.abs(c-le)<=ki*Math.max(1,Math.abs(c),Math.abs(le))&&Math.abs(h-ve)<=ki*Math.max(1,Math.abs(h),Math.abs(ve))&&Math.abs(p-xe)<=ki*Math.max(1,Math.abs(p),Math.abs(xe))&&Math.abs(m-Ue)<=ki*Math.max(1,Math.abs(m),Math.abs(Ue))&&Math.abs(g-Ge)<=ki*Math.max(1,Math.abs(g),Math.abs(Ge))&&Math.abs(b-De)<=ki*Math.max(1,Math.abs(b),Math.abs(De))&&Math.abs(S-Ae)<=ki*Math.max(1,Math.abs(S),Math.abs(Ae))&&Math.abs(C-Se)<=ki*Math.max(1,Math.abs(C),Math.abs(Se))&&Math.abs(z-Le)<=ki*Math.max(1,Math.abs(z),Math.abs(Le))&&Math.abs(L-ze)<=ki*Math.max(1,Math.abs(L),Math.abs(ze))&&Math.abs(R-Te)<=ki*Math.max(1,Math.abs(R),Math.abs(Te))&&Math.abs(q-He)<=ki*Math.max(1,Math.abs(q),Math.abs(He))&&Math.abs(Z-Xe)<=ki*Math.max(1,Math.abs(Z),Math.abs(Xe))&&Math.abs(ne-pt)<=ki*Math.max(1,Math.abs(ne),Math.abs(pt))},a.evaluateSizeForFeature=function(i,{uSize:e,uSizeT:r},{lowerSize:o,upperSize:c}){return i.kind==="source"?o/dn:i.kind==="composite"?Nt(o/dn,c/dn,r):e},a.evaluateSizeForZoom=function(i,e){let r=0,o=0;if(i.kind==="constant")o=i.layoutSize;else if(i.kind!=="source"){const{interpolationType:c,minZoom:h,maxZoom:p}=i,m=c?ee(Ui.interpolationFactor(c,e,h,p),0,1):0;i.kind==="camera"?o=Nt(i.minSize,i.maxSize,m):r=m}return{uSizeT:r,uSize:o}},a.evaluateVariableOffset=fh,a.evented=Fs,a.exported=ii,a.exported$1=Dr,a.extend=Fe,a.filterObject=Je,a.fromRotation=function(i,e){var r=Math.sin(e),o=Math.cos(e);return i[0]=o,i[1]=r,i[2]=0,i[3]=-r,i[4]=o,i[5]=0,i[6]=0,i[7]=0,i[8]=1,i},a.fromScaling=function(i,e){return i[0]=e[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=e[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=e[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},a.getAnchorAlignment=Sc,a.getAnchorJustification=Cc,a.getArrayBuffer=wn,a.getImage=Or,a.getJSON=function(i,e){return bn(Fe(i,{type:"json"}),e)},a.getOverlapMode=kc,a.getRTLTextPluginStatus=_o,a.getReferrer=Xn,a.getVideo=function(i,e){const r=window.document.createElement("video");r.muted=!0,r.onloadstart=function(){e(null,r)};for(let o=0;o<i.length;o++){const c=window.document.createElement("source");Wn(i[o])||(r.crossOrigin="Anonymous"),c.src=i[o],r.appendChild(c)}return{cancel:()=>{}}},a.identity=lc,a.invert=function(i,e){var r=e[0],o=e[1],c=e[2],h=e[3],p=e[4],m=e[5],g=e[6],b=e[7],S=e[8],C=e[9],z=e[10],L=e[11],R=e[12],q=e[13],Z=e[14],ne=e[15],he=r*m-o*p,re=r*g-c*p,le=r*b-h*p,ve=o*g-c*m,xe=o*b-h*m,Ue=c*b-h*g,Ge=S*q-C*R,De=S*Z-z*R,Ae=S*ne-L*R,Se=C*Z-z*q,Le=C*ne-L*q,ze=z*ne-L*Z,Te=he*ze-re*Le+le*Se+ve*Ae-xe*De+Ue*Ge;return Te?(i[0]=(m*ze-g*Le+b*Se)*(Te=1/Te),i[1]=(c*Le-o*ze-h*Se)*Te,i[2]=(q*Ue-Z*xe+ne*ve)*Te,i[3]=(z*xe-C*Ue-L*ve)*Te,i[4]=(g*Ae-p*ze-b*De)*Te,i[5]=(r*ze-c*Ae+h*De)*Te,i[6]=(Z*le-R*Ue-ne*re)*Te,i[7]=(S*Ue-z*le+L*re)*Te,i[8]=(p*Le-m*Ae+b*Ge)*Te,i[9]=(o*Ae-r*Le-h*Ge)*Te,i[10]=(R*xe-q*le+ne*he)*Te,i[11]=(C*le-S*xe-L*he)*Te,i[12]=(m*De-p*Se-g*Ge)*Te,i[13]=(r*Se-o*De+c*Ge)*Te,i[14]=(q*re-R*ve-Z*he)*Te,i[15]=(S*ve-C*re+z*he)*Te,i):null},a.isImageBitmap=pi,a.isSafari=wi,a.isWorker=Wt,a.keysDifference=function(i,e){const r=[];for(const o in i)o in e||r.push(o);return r},a.lazyLoadRTLTextPlugin=function(){Ji.isLoading()||Ji.isLoaded()||_o()!=="deferred"||Ha()},a.makeRequest=bn,a.mapObject=Ke,a.mercatorXfromLng=bh,a.mercatorYfromLat=wh,a.mercatorZfromAltitude=Th,a.mul=lp,a.mul$1=function(i,e,r){return i[0]=e[0]*r[0],i[1]=e[1]*r[1],i[2]=e[2]*r[2],i[3]=e[3]*r[3],i},a.multiply=Eu,a.nextPowerOfTwo=function(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))},a.normalize=function(i,e){var r=e[0],o=e[1],c=e[2],h=r*r+o*o+c*c;return h>0&&(h=1/Math.sqrt(h)),i[0]=e[0]*h,i[1]=e[1]*h,i[2]=e[2]*h,i},a.number=Nt,a.ortho=function(i,e,r,o,c,h,p){var m=1/(e-r),g=1/(o-c),b=1/(h-p);return i[0]=-2*m,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*g,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*b,i[11]=0,i[12]=(e+r)*m,i[13]=(c+o)*g,i[14]=(p+h)*b,i[15]=1,i},a.parseCacheControl=ur,a.parseGlyphPbf=function(i){return new bc(i).readFields(cf,[])},a.pbf=bc,a.performSymbolLayout=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=ni/(512*i.bucket.overscaling),i.bucket.compareText={},i.bucket.iconsNeedLinear=!1;const e=i.bucket.layers[0].layout,r=i.bucket.layers[0]._unevaluatedLayout._values,o={layoutIconSize:r["icon-size"].possiblyEvaluate(new Zt(i.bucket.zoom+1),i.canonical),layoutTextSize:r["text-size"].possiblyEvaluate(new Zt(i.bucket.zoom+1),i.canonical),textMaxSize:r["text-size"].possiblyEvaluate(new Zt(18))};if(i.bucket.textSizeData.kind==="composite"){const{minZoom:g,maxZoom:b}=i.bucket.textSizeData;o.compositeTextSizes=[r["text-size"].possiblyEvaluate(new Zt(g),i.canonical),r["text-size"].possiblyEvaluate(new Zt(b),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){const{minZoom:g,maxZoom:b}=i.bucket.iconSizeData;o.compositeIconSizes=[r["icon-size"].possiblyEvaluate(new Zt(g),i.canonical),r["icon-size"].possiblyEvaluate(new Zt(b),i.canonical)]}const c=e.get("text-line-height")*gi,h=e.get("text-rotation-alignment")!=="viewport"&&e.get("symbol-placement")!=="point",p=e.get("text-keep-upright"),m=e.get("text-size");for(const g of i.bucket.features){const b=e.get("text-font").evaluate(g,{},i.canonical).join(","),S=m.evaluate(g,{},i.canonical),C=o.layoutTextSize.evaluate(g,{},i.canonical),z=o.layoutIconSize.evaluate(g,{},i.canonical),L={horizontal:{},vertical:void 0},R=g.text;let q,Z=[0,0];if(R){const re=R.toString(),le=e.get("text-letter-spacing").evaluate(g,{},i.canonical)*gi,ve=ec(re)?le:0,xe=e.get("text-anchor").evaluate(g,{},i.canonical),Ue=e.get("text-variable-anchor");if(!Ue){const Le=e.get("text-radial-offset").evaluate(g,{},i.canonical);Z=Le?fh(xe,[Le*gi,Ic]):e.get("text-offset").evaluate(g,{},i.canonical).map(ze=>ze*gi)}let Ge=h?"center":e.get("text-justify").evaluate(g,{},i.canonical);const De=e.get("symbol-placement"),Ae=De==="point"?e.get("text-max-width").evaluate(g,{},i.canonical)*gi:0,Se=()=>{i.bucket.allowVerticalPlacement&&jo(re)&&(L.vertical=dl(R,i.glyphMap,i.glyphPositions,i.imagePositions,b,Ae,c,xe,"left",ve,Z,a.WritingMode.vertical,!0,De,C,S))};if(!h&&Ue){const Le=Ge==="auto"?Ue.map(Te=>Cc(Te)):[Ge];let ze=!1;for(let Te=0;Te<Le.length;Te++){const He=Le[Te];if(!L.horizontal[He])if(ze)L.horizontal[He]=L.horizontal[0];else{const Xe=dl(R,i.glyphMap,i.glyphPositions,i.imagePositions,b,Ae,c,"center",He,ve,Z,a.WritingMode.horizontal,!1,De,C,S);Xe&&(L.horizontal[He]=Xe,ze=Xe.positionedLines.length===1)}}Se()}else{Ge==="auto"&&(Ge=Cc(xe));const Le=dl(R,i.glyphMap,i.glyphPositions,i.imagePositions,b,Ae,c,xe,Ge,ve,Z,a.WritingMode.horizontal,!1,De,C,S);Le&&(L.horizontal[Ge]=Le),Se(),jo(re)&&h&&p&&(L.vertical=dl(R,i.glyphMap,i.glyphPositions,i.imagePositions,b,Ae,c,xe,Ge,ve,Z,a.WritingMode.vertical,!1,De,C,S))}}let ne=!1;if(g.icon&&g.icon.name){const re=i.imageMap[g.icon.name];re&&(q=mf(i.imagePositions[g.icon.name],e.get("icon-offset").evaluate(g,{},i.canonical),e.get("icon-anchor").evaluate(g,{},i.canonical)),ne=!!re.sdf,i.bucket.sdfIcons===void 0?i.bucket.sdfIcons=ne:i.bucket.sdfIcons!==ne&&ct("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(re.pixelRatio!==i.bucket.pixelRatio||e.get("icon-rotate").constantOr(1)!==0)&&(i.bucket.iconsNeedLinear=!0))}const he=gh(L.horizontal)||L.vertical;i.bucket.iconsInText=!!he&&he.iconsInText,(he||q)&&wf(i.bucket,g,L,q,i.imageMap,o,C,z,Z,ne,i.canonical)}i.showCollisionBoxes&&i.bucket.generateCollisionDebugBuffers()},a.perspective=function(i,e,r,o,c){var h,p=1/Math.tan(e/2);return i[0]=p/r,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=p,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,c!=null&&c!==1/0?(i[10]=(c+o)*(h=1/(o-c)),i[14]=2*c*o*h):(i[10]=-1,i[14]=-2*o),i},a.pick=function(i,e){const r={};for(let o=0;o<e.length;o++){const c=e[o];c in i&&(r[c]=i[c])}return r},a.plugin=Ji,a.pointGeometry=et,a.polygonIntersectsPolygon=xu,a.potpack=Yu,a.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],a.register=Ve,a.registerForPluginStateChange=function(i){return i({pluginStatus:Pi,pluginURL:Gr}),Fs.on("pluginStateChange",i),i},a.renderColorRamp=zu,a.rotateX=function(i,e,r){var o=Math.sin(r),c=Math.cos(r),h=e[4],p=e[5],m=e[6],g=e[7],b=e[8],S=e[9],C=e[10],z=e[11];return e!==i&&(i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[4]=h*c+b*o,i[5]=p*c+S*o,i[6]=m*c+C*o,i[7]=g*c+z*o,i[8]=b*c-h*o,i[9]=S*c-p*o,i[10]=C*c-m*o,i[11]=z*c-g*o,i},a.rotateZ=function(i,e,r){var o=Math.sin(r),c=Math.cos(r),h=e[0],p=e[1],m=e[2],g=e[3],b=e[4],S=e[5],C=e[6],z=e[7];return e!==i&&(i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[0]=h*c+b*o,i[1]=p*c+S*o,i[2]=m*c+C*o,i[3]=g*c+z*o,i[4]=b*c-h*o,i[5]=S*c-p*o,i[6]=C*c-m*o,i[7]=z*c-g*o,i},a.scale=function(i,e,r){var o=r[0],c=r[1],h=r[2];return i[0]=e[0]*o,i[1]=e[1]*o,i[2]=e[2]*o,i[3]=e[3]*o,i[4]=e[4]*c,i[5]=e[5]*c,i[6]=e[6]*c,i[7]=e[7]*c,i[8]=e[8]*h,i[9]=e[9]*h,i[10]=e[10]*h,i[11]=e[11]*h,i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},a.scale$1=function(i,e,r){return i[0]=e[0]*r,i[1]=e[1]*r,i[2]=e[2]*r,i},a.setCacheLimits=function(i,e){_n=i,yn=e},a.setRTLTextPlugin=function(i,e,r=!1){if(Pi===Ds||Pi===Ls||Pi===Rs)throw new Error("setRTLTextPlugin cannot be called multiple times.");Gr=ii.resolveURL(i),Pi=Ds,Bs=e,Fn(),r||Ha()},a.spec=ye,a.sphericalToCartesian=function([i,e,r]){return e+=90,e*=Math.PI/180,r*=Math.PI/180,{x:i*Math.cos(e)*Math.sin(r),y:i*Math.sin(e)*Math.sin(r),z:i*Math.cos(r)}},a.sqrLen=function(i){var e=i[0],r=i[1];return e*e+r*r},a.sub=function(i,e,r){return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],i},a.toEvaluationFeature=wo,a.transformMat3=function(i,e,r){var o=e[0],c=e[1],h=e[2];return i[0]=o*r[0]+c*r[3]+h*r[6],i[1]=o*r[1]+c*r[4]+h*r[7],i[2]=o*r[2]+c*r[5]+h*r[8],i},a.transformMat4=nl,a.transformMat4$1=function(i,e,r){var o=e[0],c=e[1];return i[0]=r[0]*o+r[4]*c+r[12],i[1]=r[1]*o+r[5]*c+r[13],i},a.translate=function(i,e,r){var o,c,h,p,m,g,b,S,C,z,L,R,q=r[0],Z=r[1],ne=r[2];return e===i?(i[12]=e[0]*q+e[4]*Z+e[8]*ne+e[12],i[13]=e[1]*q+e[5]*Z+e[9]*ne+e[13],i[14]=e[2]*q+e[6]*Z+e[10]*ne+e[14],i[15]=e[3]*q+e[7]*Z+e[11]*ne+e[15]):(c=e[1],h=e[2],p=e[3],m=e[4],g=e[5],b=e[6],S=e[7],C=e[8],z=e[9],L=e[10],R=e[11],i[0]=o=e[0],i[1]=c,i[2]=h,i[3]=p,i[4]=m,i[5]=g,i[6]=b,i[7]=S,i[8]=C,i[9]=z,i[10]=L,i[11]=R,i[12]=o*q+m*Z+C*ne+e[12],i[13]=c*q+g*Z+z*ne+e[13],i[14]=h*q+b*Z+L*ne+e[14],i[15]=p*q+S*Z+R*ne+e[15]),i},a.triggerPluginCompletionEvent=Wa,a.unicodeBlockLookup=ke,a.uniqueId=function(){return Me++},a.validateCustomStyleLayer=function(i){const e=[],r=i.id;return r===void 0&&e.push({message:`layers.${r}: missing required property "id"`}),i.render===void 0&&e.push({message:`layers.${r}: missing required method "render"`}),i.renderingMode&&i.renderingMode!=="2d"&&i.renderingMode!=="3d"&&e.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),e},a.validateLight=Ms,a.validateStyle=mo,a.vectorTile=Vn,a.warnOnce=ct,a.wrap=Re}),B(["./shared"],function(a){function W($){const E=typeof $;if(E==="number"||E==="boolean"||E==="string"||$==null)return JSON.stringify($);if(Array.isArray($)){let O="[";for(const j of $)O+=`${W(j)},`;return`${O}]`}const M=Object.keys($).sort();let F="{";for(let O=0;O<M.length;O++)F+=`${JSON.stringify(M[O])}:${W($[M[O]])},`;return`${F}}`}function K($){let E="";for(const M of a.refProperties)E+=`/${W($[M])}`;return E}class ce{constructor(E){this.keyCache={},E&&this.replace(E)}replace(E){this._layerConfigs={},this._layers={},this.update(E,[])}update(E,M){for(const O of E){this._layerConfigs[O.id]=O;const j=this._layers[O.id]=a.createStyleLayer(O);j._featureFilter=a.createFilter(j.filter),this.keyCache[O.id]&&delete this.keyCache[O.id]}for(const O of M)delete this.keyCache[O],delete this._layerConfigs[O],delete this._layers[O];this.familiesBySource={};const F=function(O,j){const Q={};for(let X=0;X<O.length;X++){const te=j&&j[O[X].id]||K(O[X]);j&&(j[O[X].id]=te);let fe=Q[te];fe||(fe=Q[te]=[]),fe.push(O[X])}const H=[];for(const X in Q)H.push(Q[X]);return H}(Object.values(this._layerConfigs),this.keyCache);for(const O of F){const j=O.map(be=>this._layers[be.id]),Q=j[0];if(Q.visibility==="none")continue;const H=Q.source||"";let X=this.familiesBySource[H];X||(X=this.familiesBySource[H]={});const te=Q.sourceLayer||"_geojsonTileLayer";let fe=X[te];fe||(fe=X[te]=[]),fe.push(j)}}}class oe{constructor(E){const M={},F=[];for(const H in E){const X=E[H],te=M[H]={};for(const fe in X){const be=X[+fe];if(!be||be.bitmap.width===0||be.bitmap.height===0)continue;const pe={x:0,y:0,w:be.bitmap.width+2,h:be.bitmap.height+2};F.push(pe),te[fe]={rect:pe,metrics:be.metrics}}}const{w:O,h:j}=a.potpack(F),Q=new a.AlphaImage({width:O||1,height:j||1});for(const H in E){const X=E[H];for(const te in X){const fe=X[+te];if(!fe||fe.bitmap.width===0||fe.bitmap.height===0)continue;const be=M[H][te].rect;a.AlphaImage.copy(fe.bitmap,Q,{x:0,y:0},{x:be.x+1,y:be.y+1},fe.bitmap)}}this.image=Q,this.positions=M}}a.register("GlyphAtlas",oe);class ee{constructor(E){this.tileID=new a.OverscaledTileID(E.tileID.overscaledZ,E.tileID.wrap,E.tileID.canonical.z,E.tileID.canonical.x,E.tileID.canonical.y),this.uid=E.uid,this.zoom=E.zoom,this.pixelRatio=E.pixelRatio,this.tileSize=E.tileSize,this.source=E.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=E.showCollisionBoxes,this.collectResourceTiming=!!E.collectResourceTiming,this.returnDependencies=!!E.returnDependencies,this.promoteId=E.promoteId}parse(E,M,F,O,j){this.status="parsing",this.data=E,this.collisionBoxArray=new a.CollisionBoxArray;const Q=new a.DictionaryCoder(Object.keys(E.layers).sort()),H=new a.FeatureIndex(this.tileID,this.promoteId);H.bucketLayerIDs=[];const X={},te={featureIndex:H,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:F},fe=M.familiesBySource[this.source];for(const nt in fe){const ht=E.layers[nt];if(!ht)continue;ht.version===1&&a.warnOnce(`Vector tile source "${this.source}" layer "${nt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Tt=Q.encode(nt),Dt=[];for(let ai=0;ai<ht.length;ai++){const Vt=ht.feature(ai),_i=H.getId(Vt,nt);Dt.push({feature:Vt,id:_i,index:ai,sourceLayerIndex:Tt})}for(const ai of fe[nt]){const Vt=ai[0];Vt.source!==this.source&&a.warnOnce(`layer.source = ${Vt.source} does not equal this.source = ${this.source}`),Vt.minzoom&&this.zoom<Math.floor(Vt.minzoom)||Vt.maxzoom&&this.zoom>=Vt.maxzoom||Vt.visibility!=="none"&&(Re(ai,this.zoom,F),(X[Vt.id]=Vt.createBucket({index:H.bucketLayerIDs.length,layers:ai,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Tt,sourceID:this.source})).populate(Dt,te,this.tileID.canonical),H.bucketLayerIDs.push(ai.map(_i=>_i.id)))}}let be,pe,Ne,qe;const Be=a.mapObject(te.glyphDependencies,nt=>Object.keys(nt).map(Number));Object.keys(Be).length?O.send("getGlyphs",{uid:this.uid,stacks:Be},(nt,ht)=>{be||(be=nt,pe=ht,wt.call(this))}):pe={};const Ye=Object.keys(te.iconDependencies);Ye.length?O.send("getImages",{icons:Ye,source:this.source,tileID:this.tileID,type:"icons"},(nt,ht)=>{be||(be=nt,Ne=ht,wt.call(this))}):Ne={};const it=Object.keys(te.patternDependencies);function wt(){if(be)return j(be);if(pe&&Ne&&qe){const nt=new oe(pe),ht=new a.ImageAtlas(Ne,qe);for(const Tt in X){const Dt=X[Tt];Dt instanceof a.SymbolBucket?(Re(Dt.layers,this.zoom,F),a.performSymbolLayout({bucket:Dt,glyphMap:pe,glyphPositions:nt.positions,imageMap:Ne,imagePositions:ht.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Dt.hasPattern&&(Dt instanceof a.LineBucket||Dt instanceof a.FillBucket||Dt instanceof a.FillExtrusionBucket)&&(Re(Dt.layers,this.zoom,F),Dt.addFeatures(te,this.tileID.canonical,ht.patternPositions))}this.status="done",j(null,{buckets:Object.values(X).filter(Tt=>!Tt.isEmpty()),featureIndex:H,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:nt.image,imageAtlas:ht,glyphMap:this.returnDependencies?pe:null,iconMap:this.returnDependencies?Ne:null,glyphPositions:this.returnDependencies?nt.positions:null})}}it.length?O.send("getImages",{icons:it,source:this.source,tileID:this.tileID,type:"patterns"},(nt,ht)=>{be||(be=nt,qe=ht,wt.call(this))}):qe={},wt.call(this)}}function Re($,E,M){const F=new a.EvaluationParameters(E);for(const O of $)O.recalculate(F,M)}function Fe($,E){const M=a.getArrayBuffer($.request,(F,O,j,Q)=>{F?E(F):O&&E(null,{vectorTile:new a.vectorTile.VectorTile(new a.pbf(O)),rawData:O,cacheControl:j,expires:Q})});return()=>{M.cancel(),E()}}class Me{constructor(E,M,F,O){this.actor=E,this.layerIndex=M,this.availableImages=F,this.loadVectorData=O||Fe,this.loading={},this.loaded={}}loadTile(E,M){const F=E.uid;this.loading||(this.loading={});const O=!!(E&&E.request&&E.request.collectResourceTiming)&&new a.RequestPerformance(E.request),j=this.loading[F]=new ee(E);j.abort=this.loadVectorData(E,(Q,H)=>{if(delete this.loading[F],Q||!H)return j.status="done",this.loaded[F]=j,M(Q);const X=H.rawData,te={};H.expires&&(te.expires=H.expires),H.cacheControl&&(te.cacheControl=H.cacheControl);const fe={};if(O){const be=O.finish();be&&(fe.resourceTiming=JSON.parse(JSON.stringify(be)))}j.vectorTile=H.vectorTile,j.parse(H.vectorTile,this.layerIndex,this.availableImages,this.actor,(be,pe)=>{if(be||!pe)return M(be);M(null,a.extend({rawTileData:X.slice(0)},pe,te,fe))}),this.loaded=this.loaded||{},this.loaded[F]=j})}reloadTile(E,M){const F=this.loaded,O=E.uid,j=this;if(F&&F[O]){const Q=F[O];Q.showCollisionBoxes=E.showCollisionBoxes;const H=(X,te)=>{const fe=Q.reloadCallback;fe&&(delete Q.reloadCallback,Q.parse(Q.vectorTile,j.layerIndex,this.availableImages,j.actor,fe)),M(X,te)};Q.status==="parsing"?Q.reloadCallback=H:Q.status==="done"&&(Q.vectorTile?Q.parse(Q.vectorTile,this.layerIndex,this.availableImages,this.actor,H):H())}}abortTile(E,M){const F=this.loading,O=E.uid;F&&F[O]&&F[O].abort&&(F[O].abort(),delete F[O]),M()}removeTile(E,M){const F=this.loaded,O=E.uid;F&&F[O]&&delete F[O],M()}}class Ze{constructor(){this.loaded={}}loadTile(E,M){const{uid:F,encoding:O,rawImageData:j}=E,Q=a.isImageBitmap(j)?this.getImageData(j):j,H=new a.DEMData(F,Q,O);this.loaded=this.loaded||{},this.loaded[F]=H,M(null,H)}getImageData(E){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(E.width,E.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=E.width,this.offscreenCanvas.height=E.height,this.offscreenCanvasContext.drawImage(E,0,0,E.width,E.height);const M=this.offscreenCanvasContext.getImageData(-1,-1,E.width+2,E.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new a.RGBAImage({width:M.width,height:M.height},M.data)}removeTile(E){const M=this.loaded,F=E.uid;M&&M[F]&&delete M[F]}}var Ke=function $(E,M){var F,O=E&&E.type;if(O==="FeatureCollection")for(F=0;F<E.features.length;F++)$(E.features[F],M);else if(O==="GeometryCollection")for(F=0;F<E.geometries.length;F++)$(E.geometries[F],M);else if(O==="Feature")$(E.geometry,M);else if(O==="Polygon")Je(E.coordinates,M);else if(O==="MultiPolygon")for(F=0;F<E.coordinates.length;F++)Je(E.coordinates[F],M);return E};function Je($,E){if($.length!==0){tt($[0],E);for(var M=1;M<$.length;M++)tt($[M],!E)}}function tt($,E){for(var M=0,F=0,O=0,j=$.length,Q=j-1;O<j;Q=O++){var H=($[O][0]-$[Q][0])*($[Q][1]+$[O][1]),X=M+H;F+=Math.abs(M)>=Math.abs(H)?M-X+H:H-X+M,M=X}M+F>=0!=!!E&&$.reverse()}const gt=a.vectorTile.VectorTileFeature.prototype.toGeoJSON;class ct{constructor(E){this._feature=E,this.extent=a.EXTENT,this.type=E.type,this.properties=E.tags,"id"in E&&!isNaN(E.id)&&(this.id=parseInt(E.id,10))}loadGeometry(){if(this._feature.type===1){const E=[];for(const M of this._feature.geometry)E.push([new a.pointGeometry(M[0],M[1])]);return E}{const E=[];for(const M of this._feature.geometry){const F=[];for(const O of M)F.push(new a.pointGeometry(O[0],O[1]));E.push(F)}return E}}toGeoJSON(E,M,F){return gt.call(this,E,M,F)}}class rt{constructor(E){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=a.EXTENT,this.length=E.length,this._features=E}feature(E){return new ct(this._features[E])}}var Ut={exports:{}},Wt=a.pointGeometry,ur=a.vectorTile.VectorTileFeature,Wi=hr;function hr($,E){this.options=E||{},this.features=$,this.length=$.length}function At($,E){this.id=typeof $.id=="number"?$.id:void 0,this.type=$.type,this.rawGeometry=$.type===1?[$.geometry]:$.geometry,this.properties=$.tags,this.extent=E||4096}hr.prototype.feature=function($){return new At(this.features[$],this.options.extent)},At.prototype.loadGeometry=function(){var $=this.rawGeometry;this.geometry=[];for(var E=0;E<$.length;E++){for(var M=$[E],F=[],O=0;O<M.length;O++)F.push(new Wt(M[O][0],M[O][1]));this.geometry.push(F)}return this.geometry},At.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var $=this.geometry,E=1/0,M=-1/0,F=1/0,O=-1/0,j=0;j<$.length;j++)for(var Q=$[j],H=0;H<Q.length;H++){var X=Q[H];E=Math.min(E,X.x),M=Math.max(M,X.x),F=Math.min(F,X.y),O=Math.max(O,X.y)}return[E,F,M,O]},At.prototype.toGeoJSON=ur.prototype.toGeoJSON;var wi=a.pbf,pi=Wi;function ii($){var E=new wi;return function(M,F){for(var O in M.layers)F.writeMessage(3,et,M.layers[O])}($,E),E.finish()}function et($,E){var M;E.writeVarintField(15,$.version||1),E.writeStringField(1,$.name||""),E.writeVarintField(5,$.extent||4096);var F={keys:[],values:[],keycache:{},valuecache:{}};for(M=0;M<$.length;M++)F.feature=$.feature(M),E.writeMessage(2,Ti,F);var O=F.keys;for(M=0;M<O.length;M++)E.writeStringField(3,O[M]);var j=F.values;for(M=0;M<j.length;M++)E.writeMessage(4,_n,j[M])}function Ti($,E){var M=$.feature;M.id!==void 0&&E.writeVarintField(1,M.id),E.writeMessage(2,Hi,$),E.writeVarintField(3,M.type),E.writeMessage(4,Kr,M)}function Hi($,E){var M=$.feature,F=$.keys,O=$.values,j=$.keycache,Q=$.valuecache;for(var H in M.properties){var X=M.properties[H],te=j[H];if(X!==null){te===void 0&&(F.push(H),j[H]=te=F.length-1),E.writeVarint(te);var fe=typeof X;fe!=="string"&&fe!=="boolean"&&fe!=="number"&&(X=JSON.stringify(X));var be=fe+":"+X,pe=Q[be];pe===void 0&&(O.push(X),Q[be]=pe=O.length-1),E.writeVarint(pe)}}}function Ai($,E){return(E<<3)+(7&$)}function ir($){return $<<1^$>>31}function Kr($,E){for(var M=$.loadGeometry(),F=$.type,O=0,j=0,Q=M.length,H=0;H<Q;H++){var X=M[H],te=1;F===1&&(te=X.length),E.writeVarint(Ai(1,te));for(var fe=F===3?X.length-1:X.length,be=0;be<fe;be++){be===1&&F!==1&&E.writeVarint(Ai(2,fe-1));var pe=X[be].x-O,Ne=X[be].y-j;E.writeVarint(ir(pe)),E.writeVarint(ir(Ne)),O+=pe,j+=Ne}F===3&&E.writeVarint(Ai(7,1))}}function _n($,E){var M=typeof $;M==="string"?E.writeStringField(1,$):M==="boolean"?E.writeBooleanField(7,$):M==="number"&&($%1!=0?E.writeDoubleField(3,$):$<0?E.writeSVarintField(6,$):E.writeVarintField(5,$))}function yn($,E,M,F,O,j){if(O-F<=M)return;const Q=F+O>>1;xn($,E,Q,F,O,j%2),yn($,E,M,F,Q-1,j+1),yn($,E,M,Q+1,O,j+1)}function xn($,E,M,F,O,j){for(;O>F;){if(O-F>600){const te=O-F+1,fe=M-F+1,be=Math.log(te),pe=.5*Math.exp(2*be/3),Ne=.5*Math.sqrt(be*pe*(te-pe)/te)*(fe-te/2<0?-1:1);xn($,E,M,Math.max(F,Math.floor(M-fe*pe/te+Ne)),Math.min(O,Math.floor(M+(te-fe)*pe/te+Ne)),j)}const Q=E[2*M+j];let H=F,X=O;for(dr($,E,F,M),E[2*O+j]>Q&&dr($,E,F,O);H<X;){for(dr($,E,H,X),H++,X--;E[2*H+j]<Q;)H++;for(;E[2*X+j]>Q;)X--}E[2*F+j]===Q?dr($,E,F,X):(X++,dr($,E,X,O)),X<=M&&(F=X+1),M<=X&&(O=X-1)}}function dr($,E,M,F){Dr($,M,F),Dr(E,2*M,2*F),Dr(E,2*M+1,2*F+1)}function Dr($,E,M){const F=$[E];$[E]=$[M],$[M]=F}function Lr($,E,M,F){const O=$-M,j=E-F;return O*O+j*j}Ut.exports=ii,Ut.exports.fromVectorTileJs=ii,Ut.exports.fromGeojsonVt=function($,E){E=E||{};var M={};for(var F in $)M[F]=new pi($[F].features,E),M[F].name=F,M[F].version=E.version,M[F].extent=E.extent;return ii({layers:M})},Ut.exports.GeoJSONWrapper=pi;const Rr=$=>$[0],Mi=$=>$[1];class vn{constructor(E,M=Rr,F=Mi,O=64,j=Float64Array){this.nodeSize=O,this.points=E;const Q=E.length<65536?Uint16Array:Uint32Array,H=this.ids=new Q(E.length),X=this.coords=new j(2*E.length);for(let te=0;te<E.length;te++)H[te]=te,X[2*te]=M(E[te]),X[2*te+1]=F(E[te]);yn(H,X,O,0,H.length-1,0)}range(E,M,F,O){return function(j,Q,H,X,te,fe,be){const pe=[0,j.length-1,0],Ne=[];let qe,Be;for(;pe.length;){const Ye=pe.pop(),it=pe.pop(),wt=pe.pop();if(it-wt<=be){for(let Tt=wt;Tt<=it;Tt++)qe=Q[2*Tt],Be=Q[2*Tt+1],qe>=H&&qe<=te&&Be>=X&&Be<=fe&&Ne.push(j[Tt]);continue}const nt=Math.floor((wt+it)/2);qe=Q[2*nt],Be=Q[2*nt+1],qe>=H&&qe<=te&&Be>=X&&Be<=fe&&Ne.push(j[nt]);const ht=(Ye+1)%2;(Ye===0?H<=qe:X<=Be)&&(pe.push(wt),pe.push(nt-1),pe.push(ht)),(Ye===0?te>=qe:fe>=Be)&&(pe.push(nt+1),pe.push(it),pe.push(ht))}return Ne}(this.ids,this.coords,E,M,F,O,this.nodeSize)}within(E,M,F){return function(O,j,Q,H,X,te){const fe=[0,O.length-1,0],be=[],pe=X*X;for(;fe.length;){const Ne=fe.pop(),qe=fe.pop(),Be=fe.pop();if(qe-Be<=te){for(let ht=Be;ht<=qe;ht++)Lr(j[2*ht],j[2*ht+1],Q,H)<=pe&&be.push(O[ht]);continue}const Ye=Math.floor((Be+qe)/2),it=j[2*Ye],wt=j[2*Ye+1];Lr(it,wt,Q,H)<=pe&&be.push(O[Ye]);const nt=(Ne+1)%2;(Ne===0?Q-X<=it:H-X<=wt)&&(fe.push(Be),fe.push(Ye-1),fe.push(nt)),(Ne===0?Q+X>=it:H+X>=wt)&&(fe.push(Ye+1),fe.push(qe),fe.push(nt))}return be}(this.ids,this.coords,E,M,F,this.nodeSize)}}const jn={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:$=>$},br=Math.fround||(Fi=new Float32Array(1),$=>(Fi[0]=+$,Fi[0]));var Fi;class Xn{constructor(E){this.options=Or(Object.create(jn),E),this.trees=new Array(this.options.maxZoom+1)}load(E){const{log:M,minZoom:F,maxZoom:O,nodeSize:j}=this.options;M&&console.time("total time");const Q=`prepare ${E.length} points`;M&&console.time(Q),this.points=E;let H=[];for(let X=0;X<E.length;X++)E[X].geometry&&H.push(bn(E[X],X));this.trees[O+1]=new vn(H,Hn,wr,j,Float32Array),M&&console.timeEnd(Q);for(let X=O;X>=F;X--){const te=+Date.now();H=this._cluster(H,X),this.trees[X]=new vn(H,Hn,wr,j,Float32Array),M&&console.log("z%d: %d clusters in %dms",X,H.length,+Date.now()-te)}return M&&console.timeEnd("total time"),this}getClusters(E,M){let F=((E[0]+180)%360+360)%360-180;const O=Math.max(-90,Math.min(90,E[1]));let j=E[2]===180?180:((E[2]+180)%360+360)%360-180;const Q=Math.max(-90,Math.min(90,E[3]));if(E[2]-E[0]>=360)F=-180,j=180;else if(F>j){const fe=this.getClusters([F,O,180,Q],M),be=this.getClusters([-180,O,j,Q],M);return fe.concat(be)}const H=this.trees[this._limitZoom(M)],X=H.range(vt(F),pr(Q),vt(j),pr(O)),te=[];for(const fe of X){const be=H.points[fe];te.push(be.numPoints?wn(be):this.points[be.index])}return te}getChildren(E){const M=this._getOriginId(E),F=this._getOriginZoom(E),O="No cluster with the specified id.",j=this.trees[F];if(!j)throw new Error(O);const Q=j.points[M];if(!Q)throw new Error(O);const H=this.options.radius/(this.options.extent*Math.pow(2,F-1)),X=j.within(Q.x,Q.y,H),te=[];for(const fe of X){const be=j.points[fe];be.parentId===E&&te.push(be.numPoints?wn(be):this.points[be.index])}if(te.length===0)throw new Error(O);return te}getLeaves(E,M,F){const O=[];return this._appendLeaves(O,E,M=M||10,F=F||0,0),O}getTile(E,M,F){const O=this.trees[this._limitZoom(E)],j=Math.pow(2,E),{extent:Q,radius:H}=this.options,X=H/Q,te=(F-X)/j,fe=(F+1+X)/j,be={features:[]};return this._addTileFeatures(O.range((M-X)/j,te,(M+1+X)/j,fe),O.points,M,F,j,be),M===0&&this._addTileFeatures(O.range(1-X/j,te,1,fe),O.points,j,F,j,be),M===j-1&&this._addTileFeatures(O.range(0,te,X/j,fe),O.points,-1,F,j,be),be.features.length?be:null}getClusterExpansionZoom(E){let M=this._getOriginZoom(E)-1;for(;M<=this.options.maxZoom;){const F=this.getChildren(E);if(M++,F.length!==1)break;E=F[0].properties.cluster_id}return M}_appendLeaves(E,M,F,O,j){const Q=this.getChildren(M);for(const H of Q){const X=H.properties;if(X&&X.cluster?j+X.point_count<=O?j+=X.point_count:j=this._appendLeaves(E,X.cluster_id,F,O,j):j<O?j++:E.push(H),E.length===F)break}return j}_addTileFeatures(E,M,F,O,j,Q){for(const H of E){const X=M[H],te=X.numPoints;let fe,be,pe;if(te)fe=Wn(X),be=X.x,pe=X.y;else{const Be=this.points[X.index];fe=Be.properties,be=vt(Be.geometry.coordinates[0]),pe=pr(Be.geometry.coordinates[1])}const Ne={type:1,geometry:[[Math.round(this.options.extent*(be*j-F)),Math.round(this.options.extent*(pe*j-O))]],tags:fe};let qe;te?qe=X.id:this.options.generateId?qe=X.index:this.points[X.index].id&&(qe=this.points[X.index].id),qe!==void 0&&(Ne.id=qe),Q.features.push(Ne)}}_limitZoom(E){return Math.max(this.options.minZoom,Math.min(Math.floor(+E),this.options.maxZoom+1))}_cluster(E,M){const F=[],{radius:O,extent:j,reduce:Q,minPoints:H}=this.options,X=O/(j*Math.pow(2,M));for(let te=0;te<E.length;te++){const fe=E[te];if(fe.zoom<=M)continue;fe.zoom=M;const be=this.trees[M+1],pe=be.within(fe.x,fe.y,X),Ne=fe.numPoints||1;let qe=Ne;for(const Be of pe){const Ye=be.points[Be];Ye.zoom>M&&(qe+=Ye.numPoints||1)}if(qe>Ne&&qe>=H){let Be=fe.x*Ne,Ye=fe.y*Ne,it=Q&&Ne>1?this._map(fe,!0):null;const wt=(te<<5)+(M+1)+this.points.length;for(const nt of pe){const ht=be.points[nt];if(ht.zoom<=M)continue;ht.zoom=M;const Tt=ht.numPoints||1;Be+=ht.x*Tt,Ye+=ht.y*Tt,ht.parentId=wt,Q&&(it||(it=this._map(fe,!0)),Q(it,this._map(ht)))}fe.parentId=wt,F.push(Br(Be/qe,Ye/qe,wt,qe,it))}else if(F.push(fe),qe>1)for(const Be of pe){const Ye=be.points[Be];Ye.zoom<=M||(Ye.zoom=M,F.push(Ye))}}return F}_getOriginId(E){return E-this.points.length>>5}_getOriginZoom(E){return(E-this.points.length)%32}_map(E,M){if(E.numPoints)return M?Or({},E.properties):E.properties;const F=this.points[E.index].properties,O=this.options.map(F);return M&&O===F?Or({},O):O}}function Br($,E,M,F,O){return{x:br($),y:br(E),zoom:1/0,id:M,parentId:-1,numPoints:F,properties:O}}function bn($,E){const[M,F]=$.geometry.coordinates;return{x:br(vt(M)),y:br(pr(F)),zoom:1/0,index:E,parentId:-1}}function wn($){return{type:"Feature",id:$.id,properties:Wn($),geometry:{type:"Point",coordinates:[(E=$.x,360*(E-.5)),Fr($.y)]}};var E}function Wn($){const E=$.numPoints,M=E>=1e4?`${Math.round(E/1e3)}k`:E>=1e3?Math.round(E/100)/10+"k":E;return Or(Or({},$.properties),{cluster:!0,cluster_id:$.id,point_count:E,point_count_abbreviated:M})}function vt($){return $/360+.5}function pr($){const E=Math.sin($*Math.PI/180),M=.5-.25*Math.log((1+E)/(1-E))/Math.PI;return M<0?0:M>1?1:M}function Fr($){const E=(180-360*$)*Math.PI/180;return 360*Math.atan(Math.exp(E))/Math.PI-90}function Or($,E){for(const M in E)$[M]=E[M];return $}function Hn($){return $.x}function wr($){return $.y}function Tr($,E,M,F){for(var O,j=F,Q=M-E>>1,H=M-E,X=$[E],te=$[E+1],fe=$[M],be=$[M+1],pe=E+3;pe<M;pe+=3){var Ne=Tn($[pe],$[pe+1],X,te,fe,be);if(Ne>j)O=pe,j=Ne;else if(Ne===j){var qe=Math.abs(pe-Q);qe<H&&(O=pe,H=qe)}}j>F&&(O-E>3&&Tr($,E,O,F),$[O+2]=j,M-O>3&&Tr($,O,M,F))}function Tn($,E,M,F,O,j){var Q=O-M,H=j-F;if(Q!==0||H!==0){var X=(($-M)*Q+(E-F)*H)/(Q*Q+H*H);X>1?(M=O,F=j):X>0&&(M+=Q*X,F+=H*X)}return(Q=$-M)*Q+(H=E-F)*H}function Er($,E,M,F){var O={id:$===void 0?null:$,type:E,geometry:M,tags:F,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(j){var Q=j.geometry,H=j.type;if(H==="Point"||H==="MultiPoint"||H==="LineString")ye(j,Q);else if(H==="Polygon"||H==="MultiLineString")for(var X=0;X<Q.length;X++)ye(j,Q[X]);else if(H==="MultiPolygon")for(X=0;X<Q.length;X++)for(var te=0;te<Q[X].length;te++)ye(j,Q[X][te])}(O),O}function ye($,E){for(var M=0;M<E.length;M+=3)$.minX=Math.min($.minX,E[M]),$.minY=Math.min($.minY,E[M+1]),$.maxX=Math.max($.maxX,E[M]),$.maxY=Math.max($.maxY,E[M+1])}function Pe($,E,M,F){if(E.geometry){var O=E.geometry.coordinates,j=E.geometry.type,Q=Math.pow(M.tolerance/((1<<M.maxZoom)*M.extent),2),H=[],X=E.id;if(M.promoteId?X=E.properties[M.promoteId]:M.generateId&&(X=F||0),j==="Point")Jr(O,H);else if(j==="MultiPoint")for(var te=0;te<O.length;te++)Jr(O[te],H);else if(j==="LineString")rr(O,H,Q,!1);else if(j==="MultiLineString"){if(M.lineMetrics){for(te=0;te<O.length;te++)rr(O[te],H=[],Q,!1),$.push(Er(X,"LineString",H,E.properties));return}bt(O,H,Q,!1)}else if(j==="Polygon")bt(O,H,Q,!0);else{if(j!=="MultiPolygon"){if(j==="GeometryCollection"){for(te=0;te<E.geometry.geometries.length;te++)Pe($,{id:X,geometry:E.geometry.geometries[te],properties:E.properties},M,F);return}throw new Error("Input data is not a valid GeoJSON object.")}for(te=0;te<O.length;te++){var fe=[];bt(O[te],fe,Q,!0),H.push(fe)}}$.push(Er(X,j,H,E.properties))}}function Jr($,E){E.push(Ki($[0])),E.push(Oi($[1])),E.push(0)}function rr($,E,M,F){for(var O,j,Q=0,H=0;H<$.length;H++){var X=Ki($[H][0]),te=Oi($[H][1]);E.push(X),E.push(te),E.push(0),H>0&&(Q+=F?(O*te-X*j)/2:Math.sqrt(Math.pow(X-O,2)+Math.pow(te-j,2))),O=X,j=te}var fe=E.length-3;E[2]=1,Tr(E,0,fe,M),E[fe+2]=1,E.size=Math.abs(Q),E.start=0,E.end=E.size}function bt($,E,M,F){for(var O=0;O<$.length;O++){var j=[];rr($[O],j,M,F),E.push(j)}}function Ki($){return $/360+.5}function Oi($){var E=Math.sin($*Math.PI/180),M=.5-.25*Math.log((1+E)/(1-E))/Math.PI;return M<0?0:M>1?1:M}function $i($,E,M,F,O,j,Q,H){if(F/=E,j>=(M/=E)&&Q<F)return $;if(Q<M||j>=F)return null;for(var X=[],te=0;te<$.length;te++){var fe=$[te],be=fe.geometry,pe=fe.type,Ne=O===0?fe.minX:fe.minY,qe=O===0?fe.maxX:fe.maxY;if(Ne>=M&&qe<F)X.push(fe);else if(!(qe<M||Ne>=F)){var Be=[];if(pe==="Point"||pe==="MultiPoint")$r(be,Be,M,F,O);else if(pe==="LineString")Ie(be,Be,M,F,O,!1,H.lineMetrics);else if(pe==="MultiLineString")at(be,Be,M,F,O,!1);else if(pe==="Polygon")at(be,Be,M,F,O,!0);else if(pe==="MultiPolygon")for(var Ye=0;Ye<be.length;Ye++){var it=[];at(be[Ye],it,M,F,O,!0),it.length&&Be.push(it)}if(Be.length){if(H.lineMetrics&&pe==="LineString"){for(Ye=0;Ye<Be.length;Ye++)X.push(Er(fe.id,pe,Be[Ye],fe.tags));continue}pe!=="LineString"&&pe!=="MultiLineString"||(Be.length===1?(pe="LineString",Be=Be[0]):pe="MultiLineString"),pe!=="Point"&&pe!=="MultiPoint"||(pe=Be.length===3?"Point":"MultiPoint"),X.push(Er(fe.id,pe,Be,fe.tags))}}}return X.length?X:null}function $r($,E,M,F,O){for(var j=0;j<$.length;j+=3){var Q=$[j+O];Q>=M&&Q<=F&&(E.push($[j]),E.push($[j+1]),E.push($[j+2]))}}function Ie($,E,M,F,O,j,Q){for(var H,X,te=ut($),fe=O===0?Ur:ot,be=$.start,pe=0;pe<$.length-3;pe+=3){var Ne=$[pe],qe=$[pe+1],Be=$[pe+2],Ye=$[pe+3],it=$[pe+4],wt=O===0?Ne:qe,nt=O===0?Ye:it,ht=!1;Q&&(H=Math.sqrt(Math.pow(Ne-Ye,2)+Math.pow(qe-it,2))),wt<M?nt>M&&(X=fe(te,Ne,qe,Ye,it,M),Q&&(te.start=be+H*X)):wt>F?nt<F&&(X=fe(te,Ne,qe,Ye,it,F),Q&&(te.start=be+H*X)):fi(te,Ne,qe,Be),nt<M&&wt>=M&&(X=fe(te,Ne,qe,Ye,it,M),ht=!0),nt>F&&wt<=F&&(X=fe(te,Ne,qe,Ye,it,F),ht=!0),!j&&ht&&(Q&&(te.end=be+H*X),E.push(te),te=ut($)),Q&&(be+=H)}var Tt=$.length-3;Ne=$[Tt],qe=$[Tt+1],Be=$[Tt+2],(wt=O===0?Ne:qe)>=M&&wt<=F&&fi(te,Ne,qe,Be),Tt=te.length-3,j&&Tt>=3&&(te[Tt]!==te[0]||te[Tt+1]!==te[1])&&fi(te,te[0],te[1],te[2]),te.length&&E.push(te)}function ut($){var E=[];return E.size=$.size,E.start=$.start,E.end=$.end,E}function at($,E,M,F,O,j){for(var Q=0;Q<$.length;Q++)Ie($[Q],E,M,F,O,j,!1)}function fi($,E,M,F){$.push(E),$.push(M),$.push(F)}function Ur($,E,M,F,O,j){var Q=(j-E)/(F-E);return $.push(j),$.push(M+(O-M)*Q),$.push(1),Q}function ot($,E,M,F,O,j){var Q=(j-M)/(O-M);return $.push(E+(F-E)*Q),$.push(j),$.push(1),Q}function Sr($,E){for(var M=[],F=0;F<$.length;F++){var O,j=$[F],Q=j.type;if(Q==="Point"||Q==="MultiPoint"||Q==="LineString")O=si(j.geometry,E);else if(Q==="MultiLineString"||Q==="Polygon"){O=[];for(var H=0;H<j.geometry.length;H++)O.push(si(j.geometry[H],E))}else if(Q==="MultiPolygon")for(O=[],H=0;H<j.geometry.length;H++){for(var X=[],te=0;te<j.geometry[H].length;te++)X.push(si(j.geometry[H][te],E));O.push(X)}M.push(Er(j.id,Q,O,j.tags))}return M}function si($,E){var M=[];M.size=$.size,$.start!==void 0&&(M.start=$.start,M.end=$.end);for(var F=0;F<$.length;F+=3)M.push($[F]+E,$[F+1],$[F+2]);return M}function En($,E){if($.transformed)return $;var M,F,O,j=1<<$.z,Q=$.x,H=$.y;for(M=0;M<$.features.length;M++){var X=$.features[M],te=X.geometry,fe=X.type;if(X.geometry=[],fe===1)for(F=0;F<te.length;F+=2)X.geometry.push(Yt(te[F],te[F+1],E,j,Q,H));else for(F=0;F<te.length;F++){var be=[];for(O=0;O<te[F].length;O+=2)be.push(Yt(te[F][O],te[F][O+1],E,j,Q,H));X.geometry.push(be)}}return $.transformed=!0,$}function Yt($,E,M,F,O,j){return[Math.round(M*($*F-O)),Math.round(M*(E*F-j))]}function Ei($,E,M,F,O){for(var j=E===O.maxZoom?0:O.tolerance/((1<<E)*O.extent),Q={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:M,y:F,z:E,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},H=0;H<$.length;H++){Q.numFeatures++,zt(Q,$[H],j,O);var X=$[H].minX,te=$[H].minY,fe=$[H].maxX,be=$[H].maxY;X<Q.minX&&(Q.minX=X),te<Q.minY&&(Q.minY=te),fe>Q.maxX&&(Q.maxX=fe),be>Q.maxY&&(Q.maxY=be)}return Q}function zt($,E,M,F){var O=E.geometry,j=E.type,Q=[];if(j==="Point"||j==="MultiPoint")for(var H=0;H<O.length;H+=3)Q.push(O[H]),Q.push(O[H+1]),$.numPoints++,$.numSimplified++;else if(j==="LineString")Sn(Q,O,$,M,!1,!1);else if(j==="MultiLineString"||j==="Polygon")for(H=0;H<O.length;H++)Sn(Q,O[H],$,M,j==="Polygon",H===0);else if(j==="MultiPolygon")for(var X=0;X<O.length;X++){var te=O[X];for(H=0;H<te.length;H++)Sn(Q,te[H],$,M,!0,H===0)}if(Q.length){var fe=E.tags||null;if(j==="LineString"&&F.lineMetrics){for(var be in fe={},E.tags)fe[be]=E.tags[be];fe.mapbox_clip_start=O.start/O.size,fe.mapbox_clip_end=O.end/O.size}var pe={geometry:Q,type:j==="Polygon"||j==="MultiPolygon"?3:j==="LineString"||j==="MultiLineString"?2:1,tags:fe};E.id!==null&&(pe.id=E.id),$.features.push(pe)}}function Sn($,E,M,F,O,j){var Q=F*F;if(F>0&&E.size<(O?Q:F))M.numPoints+=E.length/3;else{for(var H=[],X=0;X<E.length;X+=3)(F===0||E[X+2]>Q)&&(M.numSimplified++,H.push(E[X]),H.push(E[X+1])),M.numPoints++;O&&function(te,fe){for(var be=0,pe=0,Ne=te.length,qe=Ne-2;pe<Ne;qe=pe,pe+=2)be+=(te[pe]-te[qe])*(te[pe+1]+te[qe+1]);if(be>0===fe)for(pe=0,Ne=te.length;pe<Ne/2;pe+=2){var Be=te[pe],Ye=te[pe+1];te[pe]=te[Ne-2-pe],te[pe+1]=te[Ne-1-pe],te[Ne-2-pe]=Be,te[Ne-1-pe]=Ye}}(H,j),$.push(H)}}function fr($,E){var M=(E=this.options=function(O,j){for(var Q in j)O[Q]=j[Q];return O}(Object.create(this.options),E)).debug;if(M&&console.time("preprocess data"),E.maxZoom<0||E.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(E.promoteId&&E.generateId)throw new Error("promoteId and generateId cannot be used together.");var F=function(O,j){var Q=[];if(O.type==="FeatureCollection")for(var H=0;H<O.features.length;H++)Pe(Q,O.features[H],j,H);else Pe(Q,O.type==="Feature"?O:{geometry:O},j);return Q}($,E);this.tiles={},this.tileCoords=[],M&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",E.indexMaxZoom,E.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),F=function(O,j){var Q=j.buffer/j.extent,H=O,X=$i(O,1,-1-Q,Q,0,-1,2,j),te=$i(O,1,1-Q,2+Q,0,-1,2,j);return(X||te)&&(H=$i(O,1,-Q,1+Q,0,-1,2,j)||[],X&&(H=Sr(X,1).concat(H)),te&&(H=H.concat(Sr(te,-1)))),H}(F,E),F.length&&this.splitTile(F,0,0,0),M&&(F.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)))}function Yr($,E,M){return 32*((1<<$)*M+E)+$}function Qr($,E){const M=$.tileID.canonical;if(!this._geoJSONIndex)return E(null,null);const F=this._geoJSONIndex.getTile(M.z,M.x,M.y);if(!F)return E(null,null);const O=new rt(F.features);let j=Ut.exports(O);j.byteOffset===0&&j.byteLength===j.buffer.byteLength||(j=new Uint8Array(j)),E(null,{vectorTile:O,rawData:j.buffer})}fr.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},fr.prototype.splitTile=function($,E,M,F,O,j,Q){for(var H=[$,E,M,F],X=this.options,te=X.debug;H.length;){F=H.pop(),M=H.pop(),E=H.pop(),$=H.pop();var fe=1<<E,be=Yr(E,M,F),pe=this.tiles[be];if(!pe&&(te>1&&console.time("creation"),pe=this.tiles[be]=Ei($,E,M,F,X),this.tileCoords.push({z:E,x:M,y:F}),te)){te>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",E,M,F,pe.numFeatures,pe.numPoints,pe.numSimplified),console.timeEnd("creation"));var Ne="z"+E;this.stats[Ne]=(this.stats[Ne]||0)+1,this.total++}if(pe.source=$,O){if(E===X.maxZoom||E===O)continue;var qe=1<<O-E;if(M!==Math.floor(j/qe)||F!==Math.floor(Q/qe))continue}else if(E===X.indexMaxZoom||pe.numPoints<=X.indexMaxPoints)continue;if(pe.source=null,$.length!==0){te>1&&console.time("clipping");var Be,Ye,it,wt,nt,ht,Tt=.5*X.buffer/X.extent,Dt=.5-Tt,ai=.5+Tt,Vt=1+Tt;Be=Ye=it=wt=null,nt=$i($,fe,M-Tt,M+ai,0,pe.minX,pe.maxX,X),ht=$i($,fe,M+Dt,M+Vt,0,pe.minX,pe.maxX,X),$=null,nt&&(Be=$i(nt,fe,F-Tt,F+ai,1,pe.minY,pe.maxY,X),Ye=$i(nt,fe,F+Dt,F+Vt,1,pe.minY,pe.maxY,X),nt=null),ht&&(it=$i(ht,fe,F-Tt,F+ai,1,pe.minY,pe.maxY,X),wt=$i(ht,fe,F+Dt,F+Vt,1,pe.minY,pe.maxY,X),ht=null),te>1&&console.timeEnd("clipping"),H.push(Be||[],E+1,2*M,2*F),H.push(Ye||[],E+1,2*M,2*F+1),H.push(it||[],E+1,2*M+1,2*F),H.push(wt||[],E+1,2*M+1,2*F+1)}}},fr.prototype.getTile=function($,E,M){var F=this.options,O=F.extent,j=F.debug;if($<0||$>24)return null;var Q=1<<$,H=Yr($,E=(E%Q+Q)%Q,M);if(this.tiles[H])return En(this.tiles[H],O);j>1&&console.log("drilling down to z%d-%d-%d",$,E,M);for(var X,te=$,fe=E,be=M;!X&&te>0;)te--,fe=Math.floor(fe/2),be=Math.floor(be/2),X=this.tiles[Yr(te,fe,be)];return X&&X.source?(j>1&&console.log("found parent tile z%d-%d-%d",te,fe,be),j>1&&console.time("drilling down"),this.splitTile(X.source,te,fe,be,$,E,M),j>1&&console.timeEnd("drilling down"),this.tiles[H]?En(this.tiles[H],O):null):null};class In extends Me{constructor(E,M,F,O){super(E,M,F,Qr),O&&(this.loadGeoJSON=O)}loadData(E,M){var F;(F=this._pendingRequest)===null||F===void 0||F.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const O=!!(E&&E.request&&E.request.collectResourceTiming)&&new a.RequestPerformance(E.request);this._pendingCallback=M,this._pendingRequest=this.loadGeoJSON(E,(j,Q)=>{if(delete this._pendingCallback,delete this._pendingRequest,j||!Q)return M(j);if(typeof Q!="object")return M(new Error(`Input data given to '${E.source}' is not a valid GeoJSON object.`));{Ke(Q,!0);try{if(E.filter){const X=a.createExpression(E.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(X.result==="error")throw new Error(X.value.map(fe=>`${fe.key}: ${fe.message}`).join(", "));const te=Q.features.filter(fe=>X.value.evaluate({zoom:0},fe));Q={type:"FeatureCollection",features:te}}this._geoJSONIndex=E.cluster?new Xn(function({superclusterOptions:X,clusterProperties:te}){if(!te||!X)return X;const fe={},be={},pe={accumulated:null,zoom:0},Ne={properties:null},qe=Object.keys(te);for(const Be of qe){const[Ye,it]=te[Be],wt=a.createExpression(it),nt=a.createExpression(typeof Ye=="string"?[Ye,["accumulated"],["get",Be]]:Ye);fe[Be]=wt.value,be[Be]=nt.value}return X.map=Be=>{Ne.properties=Be;const Ye={};for(const it of qe)Ye[it]=fe[it].evaluate(pe,Ne);return Ye},X.reduce=(Be,Ye)=>{Ne.properties=Ye;for(const it of qe)pe.accumulated=Be[it],Be[it]=be[it].evaluate(pe,Ne)},X}(E)).load(Q.features):function(X,te){return new fr(X,te)}(Q,E.geojsonVtOptions)}catch(X){return M(X)}this.loaded={};const H={};if(O){const X=O.finish();X&&(H.resourceTiming={},H.resourceTiming[E.source]=JSON.parse(JSON.stringify(X)))}M(null,H)}})}reloadTile(E,M){const F=this.loaded;return F&&F[E.uid]?super.reloadTile(E,M):this.loadTile(E,M)}loadGeoJSON(E,M){if(E.request)return a.getJSON(E.request,M);if(typeof E.data=="string")try{M(null,JSON.parse(E.data))}catch{M(new Error(`Input data given to '${E.source}' is not a valid GeoJSON object.`))}else M(new Error(`Input data given to '${E.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}}removeSource(E,M){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),M()}getClusterExpansionZoom(E,M){try{M(null,this._geoJSONIndex.getClusterExpansionZoom(E.clusterId))}catch(F){M(F)}}getClusterChildren(E,M){try{M(null,this._geoJSONIndex.getChildren(E.clusterId))}catch(F){M(F)}}getClusterLeaves(E,M){try{M(null,this._geoJSONIndex.getLeaves(E.clusterId,E.limit,E.offset))}catch(F){M(F)}}}class en{constructor(E){this.self=E,this.actor=new a.Actor(E,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:Me,geojson:In},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(M,F)=>{if(this.workerSourceTypes[M])throw new Error(`Worker source with name "${M}" already registered.`);this.workerSourceTypes[M]=F},this.self.registerRTLTextPlugin=M=>{if(a.plugin.isParsed())throw new Error("RTL text plugin already registered.");a.plugin.applyArabicShaping=M.applyArabicShaping,a.plugin.processBidirectionalText=M.processBidirectionalText,a.plugin.processStyledBidirectionalText=M.processStyledBidirectionalText}}setReferrer(E,M){this.referrer=M}setImages(E,M,F){this.availableImages[E]=M;for(const O in this.workerSources[E]){const j=this.workerSources[E][O];for(const Q in j)j[Q].availableImages=M}F()}setLayers(E,M,F){this.getLayerIndex(E).replace(M),F()}updateLayers(E,M,F){this.getLayerIndex(E).update(M.layers,M.removedIds),F()}loadTile(E,M,F){this.getWorkerSource(E,M.type,M.source).loadTile(M,F)}loadDEMTile(E,M,F){this.getDEMWorkerSource(E,M.source).loadTile(M,F)}reloadTile(E,M,F){this.getWorkerSource(E,M.type,M.source).reloadTile(M,F)}abortTile(E,M,F){this.getWorkerSource(E,M.type,M.source).abortTile(M,F)}removeTile(E,M,F){this.getWorkerSource(E,M.type,M.source).removeTile(M,F)}removeDEMTile(E,M){this.getDEMWorkerSource(E,M.source).removeTile(M)}removeSource(E,M,F){if(!this.workerSources[E]||!this.workerSources[E][M.type]||!this.workerSources[E][M.type][M.source])return;const O=this.workerSources[E][M.type][M.source];delete this.workerSources[E][M.type][M.source],O.removeSource!==void 0?O.removeSource(M,F):F()}loadWorkerSource(E,M,F){try{this.self.importScripts(M.url),F()}catch(O){F(O.toString())}}syncRTLPluginState(E,M,F){try{a.plugin.setState(M);const O=a.plugin.getPluginURL();if(a.plugin.isLoaded()&&!a.plugin.isParsed()&&O!=null){this.self.importScripts(O);const j=a.plugin.isParsed();F(j?void 0:new Error(`RTL Text Plugin failed to import scripts from ${O}`),j)}}catch(O){F(O.toString())}}getAvailableImages(E){let M=this.availableImages[E];return M||(M=[]),M}getLayerIndex(E){let M=this.layerIndexes[E];return M||(M=this.layerIndexes[E]=new ce),M}getWorkerSource(E,M,F){if(this.workerSources[E]||(this.workerSources[E]={}),this.workerSources[E][M]||(this.workerSources[E][M]={}),!this.workerSources[E][M][F]){const O={send:(j,Q,H)=>{this.actor.send(j,Q,H,E)}};this.workerSources[E][M][F]=new this.workerSourceTypes[M](O,this.getLayerIndex(E),this.getAvailableImages(E))}return this.workerSources[E][M][F]}getDEMWorkerSource(E,M){return this.demWorkerSources[E]||(this.demWorkerSources[E]={}),this.demWorkerSources[E][M]||(this.demWorkerSources[E][M]=new Ze),this.demWorkerSources[E][M]}enforceCacheSizeLimit(E,M){a.enforceCacheSizeLimit(M)}}return a.isWorker()&&(self.worker=new en(self)),en}),B(["./shared"],function(a){var W=K;function K(l){return!function(t){return typeof window=="undefined"||typeof document=="undefined"?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var s,u,d=new Blob([""],{type:"text/javascript"}),f=URL.createObjectURL(d);try{u=new Worker(f),s=!0}catch{s=!1}return u&&u.terminate(),URL.revokeObjectURL(f),s}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var s=document.createElement("canvas");s.width=s.height=1;var u=s.getContext("2d");if(!u)return!1;var d=u.getImageData(0,0,1,1);return d&&d.width===s.width}()?(ce[n=t&&t.failIfMajorPerformanceCaveat]===void 0&&(ce[n]=function(s){var u,d=function(f){var _=document.createElement("canvas"),y=Object.create(K.webGLContextAttributes);return y.failIfMajorPerformanceCaveat=f,_.getContext("webgl",y)||_.getContext("experimental-webgl",y)}(s);if(!d)return!1;try{u=d.createShader(d.VERTEX_SHADER)}catch{return!1}return!(!u||d.isContextLost())&&(d.shaderSource(u,"void main() {}"),d.compileShader(u),d.getShaderParameter(u,d.COMPILE_STATUS)===!0)}(n)),ce[n]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var n}(l)}var ce={};function oe(l,t){if(Array.isArray(l)){if(!Array.isArray(t)||l.length!==t.length)return!1;for(let n=0;n<l.length;n++)if(!oe(l[n],t[n]))return!1;return!0}if(typeof l=="object"&&l!==null&&t!==null){if(typeof t!="object"||Object.keys(l).length!==Object.keys(t).length)return!1;for(const n in l)if(!oe(l[n],t[n]))return!1;return!0}return l===t}K.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};class ee{static testProp(t){if(!ee.docStyle)return t[0];for(let n=0;n<t.length;n++)if(t[n]in ee.docStyle)return t[n];return t[0]}static create(t,n,s){const u=window.document.createElement(t);return n!==void 0&&(u.className=n),s&&s.appendChild(u),u}static createNS(t,n){return window.document.createElementNS(t,n)}static disableDrag(){ee.docStyle&&ee.selectProp&&(ee.userSelect=ee.docStyle[ee.selectProp],ee.docStyle[ee.selectProp]="none")}static enableDrag(){ee.docStyle&&ee.selectProp&&(ee.docStyle[ee.selectProp]=ee.userSelect)}static setTransform(t,n){t.style[ee.transformProp]=n}static addEventListener(t,n,s,u={}){t.addEventListener(n,s,"passive"in u?u:u.capture)}static removeEventListener(t,n,s,u={}){t.removeEventListener(n,s,"passive"in u?u:u.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",ee.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",ee.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",ee.suppressClickInternal,!0)},0)}static mousePos(t,n){const s=t.getBoundingClientRect();return new a.pointGeometry(n.clientX-s.left-t.clientLeft,n.clientY-s.top-t.clientTop)}static touchPos(t,n){const s=t.getBoundingClientRect(),u=[];for(let d=0;d<n.length;d++)u.push(new a.pointGeometry(n[d].clientX-s.left-t.clientLeft,n[d].clientY-s.top-t.clientTop));return u}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}}ee.docStyle=typeof window!="undefined"&&window.document&&window.document.documentElement.style,ee.selectProp=ee.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),ee.transformProp=ee.testProp(["transform","WebkitTransform"]);class Re{constructor(t){this._transformRequestFn=t}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}normalizeSpriteURL(t,n,s){const u=function(d){const f=d.match(Fe);if(!f)throw new Error(`Unable to parse URL "${d}"`);return{protocol:f[1],authority:f[2],path:f[3]||"/",params:f[4]?f[4].split("&"):[]}}(t);return u.path+=`${n}${s}`,function(d){const f=d.params.length?`?${d.params.join("&")}`:"";return`${d.protocol}://${d.authority}${d.path}${f}`}(u)}setTransformRequest(t){this._transformRequestFn=t}}const Fe=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;class Me{constructor(t,n,s,u){this.context=t,this.format=s,this.texture=t.gl.createTexture(),this.update(n,u)}update(t,n,s){const{width:u,height:d}=t,f=!(this.size&&this.size[0]===u&&this.size[1]===d||s),{context:_}=this,{gl:y}=_;if(this.useMipmap=Boolean(n&&n.useMipmap),y.bindTexture(y.TEXTURE_2D,this.texture),_.pixelStoreUnpackFlipY.set(!1),_.pixelStoreUnpack.set(1),_.pixelStoreUnpackPremultiplyAlpha.set(this.format===y.RGBA&&(!n||n.premultiply!==!1)),f)this.size=[u,d],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||a.isImageBitmap(t)?y.texImage2D(y.TEXTURE_2D,0,this.format,this.format,y.UNSIGNED_BYTE,t):y.texImage2D(y.TEXTURE_2D,0,this.format,u,d,0,this.format,y.UNSIGNED_BYTE,t.data);else{const{x:w,y:I}=s||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||a.isImageBitmap(t)?y.texSubImage2D(y.TEXTURE_2D,0,w,I,y.RGBA,y.UNSIGNED_BYTE,t):y.texSubImage2D(y.TEXTURE_2D,0,w,I,u,d,y.RGBA,y.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&y.generateMipmap(y.TEXTURE_2D)}bind(t,n,s){const{context:u}=this,{gl:d}=u;d.bindTexture(d.TEXTURE_2D,this.texture),s!==d.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(s=d.LINEAR),t!==this.filter&&(d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,t),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,s||t),this.filter=t),n!==this.wrap&&(d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,n),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,n),this.wrap=n)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}function Ze(l){const{userImage:t}=l;return!!(t&&t.render&&t.render())&&(l.data.replace(new Uint8Array(t.data.buffer)),!0)}class Ke extends a.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new a.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:n,callback:s}of this.requestors)this._notify(n,s);this.requestors=[]}}getImage(t){return this.images[t]}addImage(t,n){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,n)&&(this.images[t]=n)}_validate(t,n){let s=!0;return this._validateStretch(n.stretchX,n.data&&n.data.width)||(this.fire(new a.ErrorEvent(new Error(`Image "${t}" has invalid "stretchX" value`))),s=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new a.ErrorEvent(new Error(`Image "${t}" has invalid "stretchY" value`))),s=!1),this._validateContent(n.content,n)||(this.fire(new a.ErrorEvent(new Error(`Image "${t}" has invalid "content" value`))),s=!1),s}_validateStretch(t,n){if(!t)return!0;let s=0;for(const u of t){if(u[0]<s||u[1]<u[0]||n<u[1])return!1;s=u[1]}return!0}_validateContent(t,n){return!(t&&(t.length!==4||t[0]<0||n.data.width<t[0]||t[1]<0||n.data.height<t[1]||t[2]<0||n.data.width<t[2]||t[3]<0||n.data.height<t[3]||t[2]<t[0]||t[3]<t[1]))}updateImage(t,n){const s=this.images[t];if(s.data.width!==n.data.width||s.data.height!==n.data.height)throw new Error(`size mismatch between old image (${s.data.width}x${s.data.height}) and new image (${n.data.width}x${n.data.height}).`);n.version=s.version+1,this.images[t]=n,this.updatedImages[t]=!0}removeImage(t){const n=this.images[t];delete this.images[t],delete this.patterns[t],n.userImage&&n.userImage.onRemove&&n.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t,n){let s=!0;if(!this.isLoaded())for(const u of t)this.images[u]||(s=!1);this.isLoaded()||s?this._notify(t,n):this.requestors.push({ids:t,callback:n})}_notify(t,n){const s={};for(const u of t){this.images[u]||this.fire(new a.Event("styleimagemissing",{id:u}));const d=this.images[u];d?s[u]={data:d.data.clone(),pixelRatio:d.pixelRatio,sdf:d.sdf,version:d.version,stretchX:d.stretchX,stretchY:d.stretchY,content:d.content,hasRenderCallback:Boolean(d.userImage&&d.userImage.render)}:a.warnOnce(`Image "${u}" 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.`)}n(null,s)}getPixelSize(){const{width:t,height:n}=this.atlasImage;return{width:t,height:n}}getPattern(t){const n=this.patterns[t],s=this.getImage(t);if(!s)return null;if(n&&n.position.version===s.version)return n.position;if(n)n.position.version=s.version;else{const u={w:s.data.width+2,h:s.data.height+2,x:0,y:0},d=new a.ImagePosition(u,s);this.patterns[t]={bin:u,position:d}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const n=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new Me(t,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const d in this.patterns)t.push(this.patterns[d].bin);const{w:n,h:s}=a.potpack(t),u=this.atlasImage;u.resize({width:n||1,height:s||1});for(const d in this.patterns){const{bin:f}=this.patterns[d],_=f.x+1,y=f.y+1,w=this.images[d].data,I=w.width,P=w.height;a.RGBAImage.copy(w,u,{x:0,y:0},{x:_,y},{width:I,height:P}),a.RGBAImage.copy(w,u,{x:0,y:P-1},{x:_,y:y-1},{width:I,height:1}),a.RGBAImage.copy(w,u,{x:0,y:0},{x:_,y:y+P},{width:I,height:1}),a.RGBAImage.copy(w,u,{x:I-1,y:0},{x:_-1,y},{width:1,height:P}),a.RGBAImage.copy(w,u,{x:0,y:0},{x:_+I,y},{width:1,height:P})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const n of t){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;const s=this.images[n];s||a.warnOnce(`Image with ID: "${n}" was not found`),Ze(s)&&this.updateImage(n,s)}}}const Je=1e20;function tt(l,t,n,s,u,d,f,_,y){for(let w=t;w<t+s;w++)gt(l,n*d+w,d,u,f,_,y);for(let w=n;w<n+u;w++)gt(l,w*d+t,1,s,f,_,y)}function gt(l,t,n,s,u,d,f){d[0]=0,f[0]=-Je,f[1]=Je,u[0]=l[t];for(let _=1,y=0,w=0;_<s;_++){u[_]=l[t+_*n];const I=_*_;do{const P=d[y];w=(u[_]-u[P]+I-P*P)/(_-P)/2}while(w<=f[y]&&--y>-1);y++,d[y]=_,f[y]=w,f[y+1]=Je}for(let _=0,y=0;_<s;_++){for(;f[y+1]<_;)y++;const w=d[y],I=_-w;l[t+_*n]=u[w]+I*I}}class ct{constructor(t,n){this.requestManager=t,this.localIdeographFontFamily=n,this.entries={}}setURL(t){this.url=t}getGlyphs(t,n){const s=[];for(const u in t)for(const d of t[u])s.push({stack:u,id:d});a.asyncAll(s,({stack:u,id:d},f)=>{let _=this.entries[u];_||(_=this.entries[u]={glyphs:{},requests:{},ranges:{}});let y=_.glyphs[d];if(y!==void 0)return void f(null,{stack:u,id:d,glyph:y});if(y=this._tinySDF(_,u,d),y)return _.glyphs[d]=y,void f(null,{stack:u,id:d,glyph:y});const w=Math.floor(d/256);if(256*w>65535)return void f(new Error("glyphs > 65535 not supported"));if(_.ranges[w])return void f(null,{stack:u,id:d,glyph:y});let I=_.requests[w];I||(I=_.requests[w]=[],ct.loadGlyphRange(u,w,this.url,this.requestManager,(P,D)=>{if(D){for(const N in D)this._doesCharSupportLocalGlyph(+N)||(_.glyphs[+N]=D[+N]);_.ranges[w]=!0}for(const N of I)N(P,D);delete _.requests[w]})),I.push((P,D)=>{P?f(P):D&&f(null,{stack:u,id:d,glyph:D[d]||null})})},(u,d)=>{if(u)n(u);else if(d){const f={};for(const{stack:_,id:y,glyph:w}of d)(f[_]||(f[_]={}))[y]=w&&{id:w.id,bitmap:w.bitmap.clone(),metrics:w.metrics};n(null,f)}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(a.unicodeBlockLookup["CJK Unified Ideographs"](t)||a.unicodeBlockLookup["Hangul Syllables"](t)||a.unicodeBlockLookup.Hiragana(t)||a.unicodeBlockLookup.Katakana(t))}_tinySDF(t,n,s){const u=this.localIdeographFontFamily;if(!u||!this._doesCharSupportLocalGlyph(s))return;let d=t.tinySDF;if(!d){let _="400";/bold/i.test(n)?_="900":/medium/i.test(n)?_="500":/light/i.test(n)&&(_="200"),d=t.tinySDF=new ct.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:u,fontWeight:_})}const f=d.draw(String.fromCharCode(s));return{id:s,bitmap:new a.AlphaImage({width:f.width||30,height:f.height||30},f.data),metrics:{width:f.glyphWidth||24,height:f.glyphHeight||24,left:f.glyphLeft||0,top:f.glyphTop-27||-8,advance:f.glyphAdvance||24}}}}ct.loadGlyphRange=function(l,t,n,s,u){const d=256*t,f=d+255,_=s.transformRequest(n.replace("{fontstack}",l).replace("{range}",`${d}-${f}`),a.ResourceType.Glyphs);a.getArrayBuffer(_,(y,w)=>{if(y)u(y);else if(w){const I={};for(const P of a.parseGlyphPbf(w))I[P.id]=P;u(null,I)}})},ct.TinySDF=class{constructor({fontSize:l=24,buffer:t=3,radius:n=8,cutoff:s=.25,fontFamily:u="sans-serif",fontWeight:d="normal",fontStyle:f="normal"}={}){this.buffer=t,this.cutoff=s,this.radius=n;const _=this.size=l+4*t,y=this._createCanvas(_),w=this.ctx=y.getContext("2d",{willReadFrequently:!0});w.font=`${f} ${d} ${l}px ${u}`,w.textBaseline="alphabetic",w.textAlign="left",w.fillStyle="black",this.gridOuter=new Float64Array(_*_),this.gridInner=new Float64Array(_*_),this.f=new Float64Array(_),this.z=new Float64Array(_+1),this.v=new Uint16Array(_)}_createCanvas(l){const t=document.createElement("canvas");return t.width=t.height=l,t}draw(l){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:s,actualBoundingBoxLeft:u,actualBoundingBoxRight:d}=this.ctx.measureText(l),f=Math.ceil(n),_=Math.min(this.size-this.buffer,Math.ceil(d-u)),y=Math.min(this.size-this.buffer,f+Math.ceil(s)),w=_+2*this.buffer,I=y+2*this.buffer,P=Math.max(w*I,0),D=new Uint8ClampedArray(P),N={data:D,width:w,height:I,glyphWidth:_,glyphHeight:y,glyphTop:f,glyphLeft:0,glyphAdvance:t};if(_===0||y===0)return N;const{ctx:U,buffer:V,gridInner:Y,gridOuter:ie}=this;U.clearRect(V,V,_,y),U.fillText(l,V,V+f);const se=U.getImageData(V,V,_,y);ie.fill(Je,0,P),Y.fill(0,0,P);for(let G=0;G<y;G++)for(let ue=0;ue<_;ue++){const ae=se.data[4*(G*_+ue)+3]/255;if(ae===0)continue;const ge=(G+V)*w+ue+V;if(ae===1)ie[ge]=0,Y[ge]=Je;else{const _e=.5-ae;ie[ge]=_e>0?_e*_e:0,Y[ge]=_e<0?_e*_e:0}}tt(ie,0,0,w,I,w,this.f,this.v,this.z),tt(Y,V,V,_,y,w,this.f,this.v,this.z);for(let G=0;G<P;G++){const ue=Math.sqrt(ie[G])-Math.sqrt(Y[G]);D[G]=Math.round(255-255*(ue/this.radius+this.cutoff))}return N}};const rt=new a.Properties({anchor:new a.DataConstantProperty(a.spec.light.anchor),position:new class{constructor(){this.specification=a.spec.light.position}possiblyEvaluate(l,t){return a.sphericalToCartesian(l.expression.evaluate(t))}interpolate(l,t,n){return{x:a.number(l.x,t.x,n),y:a.number(l.y,t.y,n),z:a.number(l.z,t.z,n)}}},color:new a.DataConstantProperty(a.spec.light.color),intensity:new a.DataConstantProperty(a.spec.light.intensity)}),Ut="-transition";class Wt extends a.Evented{constructor(t){super(),this._transitionable=new a.Transitionable(rt),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n={}){if(!this._validate(a.validateLight,t,n))for(const s in t){const u=t[s];s.endsWith(Ut)?this._transitionable.setTransition(s.slice(0,-Ut.length),u):this._transitionable.setValue(s,u)}}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,n,s){return(!s||s.validate!==!1)&&a.emitValidationErrors(this,t.call(a.validateStyle,a.extend({value:n,style:{glyphs:!0,sprite:!0},styleSpec:a.spec})))}}class ur{constructor(t,n){this.width=t,this.height=n,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,n){const s=t.join(",")+String(n);return this.dashEntry[s]||(this.dashEntry[s]=this.addDash(t,n)),this.dashEntry[s]}getDashRanges(t,n,s){const u=[];let d=t.length%2==1?-t[t.length-1]*s:0,f=t[0]*s,_=!0;u.push({left:d,right:f,isDash:_,zeroLength:t[0]===0});let y=t[0];for(let w=1;w<t.length;w++){_=!_;const I=t[w];d=y*s,y+=I,f=y*s,u.push({left:d,right:f,isDash:_,zeroLength:I===0})}return u}addRoundDash(t,n,s){const u=n/2;for(let d=-s;d<=s;d++){const f=this.width*(this.nextRow+s+d);let _=0,y=t[_];for(let w=0;w<this.width;w++){w/y.right>1&&(y=t[++_]);const I=Math.abs(w-y.left),P=Math.abs(w-y.right),D=Math.min(I,P);let N;const U=d/s*(u+1);if(y.isDash){const V=u-Math.abs(U);N=Math.sqrt(D*D+V*V)}else N=u-Math.sqrt(D*D+U*U);this.data[f+w]=Math.max(0,Math.min(255,N+128))}}}addRegularDash(t){for(let _=t.length-1;_>=0;--_){const y=t[_],w=t[_+1];y.zeroLength?t.splice(_,1):w&&w.isDash===y.isDash&&(w.left=y.left,t.splice(_,1))}const n=t[0],s=t[t.length-1];n.isDash===s.isDash&&(n.left=s.left-this.width,s.right=n.right+this.width);const u=this.width*this.nextRow;let d=0,f=t[d];for(let _=0;_<this.width;_++){_/f.right>1&&(f=t[++d]);const y=Math.abs(_-f.left),w=Math.abs(_-f.right),I=Math.min(y,w);this.data[u+_]=Math.max(0,Math.min(255,(f.isDash?I:-I)+128))}}addDash(t,n){const s=n?7:0,u=2*s+1;if(this.nextRow+u>this.height)return a.warnOnce("LineAtlas out of space"),null;let d=0;for(let _=0;_<t.length;_++)d+=t[_];if(d!==0){const _=this.width/d,y=this.getDashRanges(t,this.width,_);n?this.addRoundDash(y,_,s):this.addRegularDash(y)}const f={y:(this.nextRow+s+.5)/this.height,height:2*s/this.height,width:d};return this.nextRow+=u,this.dirty=!0,f}bind(t){const n=t.gl;this.texture?(n.bindTexture(n.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,n.texSubImage2D(n.TEXTURE_2D,0,0,0,this.width,this.height,n.ALPHA,n.UNSIGNED_BYTE,this.data))):(this.texture=n.createTexture(),n.bindTexture(n.TEXTURE_2D,this.texture),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texImage2D(n.TEXTURE_2D,0,n.ALPHA,this.width,this.height,0,n.ALPHA,n.UNSIGNED_BYTE,this.data))}}class Wi{constructor(t,n){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=a.uniqueId();const s=this.workerPool.acquire(this.id);for(let u=0;u<s.length;u++){const d=new Wi.Actor(s[u],n,this.id);d.name=`Worker ${u}`,this.actors.push(d)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,n,s){a.asyncAll(this.actors,(u,d)=>{u.send(t,n,d)},s=s||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(t=>{t.remove()}),this.actors=[],this.workerPool.release(this.id)}}function hr(l,t,n){const s=function(u,d){if(u)return n(u);if(d){const f=a.pick(a.extend(d,l),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);d.vector_layers&&(f.vectorLayers=d.vector_layers,f.vectorLayerIds=f.vectorLayers.map(_=>_.id)),n(null,f)}};return l.url?a.getJSON(t.transformRequest(l.url,a.ResourceType.Source),s):a.exported.frame(()=>s(null,l))}Wi.Actor=a.Actor;class At{constructor(t,n,s){this.bounds=a.LngLatBounds.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=s||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 n=Math.pow(2,t.z),s=Math.floor(a.mercatorXfromLng(this.bounds.getWest())*n),u=Math.floor(a.mercatorYfromLat(this.bounds.getNorth())*n),d=Math.ceil(a.mercatorXfromLng(this.bounds.getEast())*n),f=Math.ceil(a.mercatorYfromLat(this.bounds.getSouth())*n);return t.x>=s&&t.x<d&&t.y>=u&&t.y<f}}class wi extends a.Evented{constructor(t,n,s,u){if(super(),this.id=t,this.dispatcher=s,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,a.extend(this,a.pick(n,["url","scheme","tileSize","promoteId"])),this._options=a.extend({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(u)}load(){this._loaded=!1,this.fire(new a.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=hr(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),t?this.fire(new a.ErrorEvent(t)):n&&(a.extend(this,n),n.bounds&&(this.tileBounds=new At(n.bounds,this.minzoom,this.maxzoom)),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"content"})))})}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.cancel(),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.cancel(),this._tileJSONRequest=null)}serialize(){return a.extend({},this._options)}loadTile(t,n){const s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),u={request:this.map._requestManager.transformRequest(s,a.ResourceType.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};function d(f,_){return delete t.request,t.aborted?n(null):f&&f.status!==404?n(f):(_&&_.resourceTiming&&(t.resourceTiming=_.resourceTiming),this.map._refreshExpiredTiles&&_&&t.setExpiryData(_),t.loadVectorData(_,this.map.painter),a.cacheEntryPossiblyAdded(this.dispatcher),n(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}u.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired"?t.state==="loading"?t.reloadCallback=n:t.request=t.actor.send("reloadTile",u,d.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",u,d.bind(this)))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0)}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class pi extends a.Evented{constructor(t,n,s,u){super(),this.id=t,this.dispatcher=s,this.setEventedParent(u),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=a.extend({type:"raster"},n),a.extend(this,a.pick(n,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new a.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=hr(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,t?this.fire(new a.ErrorEvent(t)):n&&(a.extend(this,n),n.bounds&&(this.tileBounds=new At(n.bounds,this.minzoom,this.maxzoom)),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return a.extend({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,n){const s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.request=a.getImage(this.map._requestManager.transformRequest(s,a.ResourceType.Tile),(u,d,f)=>{if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(u)t.state="errored",n(u);else if(d){this.map._refreshExpiredTiles&&t.setExpiryData(f);const _=this.map.painter.context,y=_.gl;t.texture=this.map.painter.getTileTexture(d.width),t.texture?t.texture.update(d,{useMipmap:!0}):(t.texture=new Me(_,d,y.RGBA,{useMipmap:!0}),t.texture.bind(y.LINEAR,y.CLAMP_TO_EDGE,y.LINEAR_MIPMAP_NEAREST),_.extTextureFilterAnisotropic&&y.texParameterf(y.TEXTURE_2D,_.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,_.extTextureFilterAnisotropicMax)),t.state="loaded",a.cacheEntryPossiblyAdded(this.dispatcher),n(null)}})}abortTile(t,n){t.request&&(t.request.cancel(),delete t.request),n()}unloadTile(t,n){t.texture&&this.map.painter.saveTileTexture(t.texture),n()}hasTransition(){return!1}}let ii;class et extends pi{constructor(t,n,s,u){super(t,n,s,u),this.type="raster-dem",this.maxzoom=22,this._options=a.extend({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox"}serialize(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(t,n){const s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function u(d,f){d&&(t.state="errored",n(d)),f&&(t.dem=f,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded",n(null))}t.request=a.getImage(this.map._requestManager.transformRequest(s,a.ResourceType.Tile),function(d,f){if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(d)t.state="errored",n(d);else if(f){this.map._refreshExpiredTiles&&t.setExpiryData(f),delete f.cacheControl,delete f.expires;const _=a.isImageBitmap(f)&&(ii==null&&(ii=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),ii)?f:a.exported.getImageData(f,1),y={uid:t.uid,coord:t.tileID,source:this.id,rawImageData:_,encoding:this.encoding};t.actor&&t.state!=="expired"||(t.actor=this.dispatcher.getActor(),t.actor.send("loadDEMTile",y,u.bind(this)))}}.bind(this)),t.neighboringTiles=this._getNeighboringTiles(t.tileID)}_getNeighboringTiles(t){const n=t.canonical,s=Math.pow(2,n.z),u=(n.x-1+s)%s,d=n.x===0?t.wrap-1:t.wrap,f=(n.x+1+s)%s,_=n.x+1===s?t.wrap+1:t.wrap,y={};return y[new a.OverscaledTileID(t.overscaledZ,d,n.z,u,n.y).key]={backfilled:!1},y[new a.OverscaledTileID(t.overscaledZ,_,n.z,f,n.y).key]={backfilled:!1},n.y>0&&(y[new a.OverscaledTileID(t.overscaledZ,d,n.z,u,n.y-1).key]={backfilled:!1},y[new a.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},y[new a.OverscaledTileID(t.overscaledZ,_,n.z,f,n.y-1).key]={backfilled:!1}),n.y+1<s&&(y[new a.OverscaledTileID(t.overscaledZ,d,n.z,u,n.y+1).key]={backfilled:!1},y[new a.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},y[new a.OverscaledTileID(t.overscaledZ,_,n.z,f,n.y+1).key]={backfilled:!1}),y}unloadTile(t){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&&t.actor.send("removeDEMTile",{uid:t.uid,source:this.id})}}class Ti extends a.Evented{constructor(t,n,s,u){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._pendingLoads=0,this.actor=s.getActor(),this.setEventedParent(u),this._data=n.data,this._options=a.extend({},n),this._collectResourceTiming=n.collectResourceTiming,n.maxzoom!==void 0&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId;const d=a.EXTENT/this.tileSize;this.workerOptions=a.extend({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(n.buffer!==void 0?n.buffer:128)*d,tolerance:(n.tolerance!==void 0?n.tolerance:.375)*d,extent:a.EXTENT,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:n.clusterMaxZoom!==void 0?n.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,n.clusterMinPoints||2),extent:a.EXTENT,radius:(n.clusterRadius||50)*d,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions)}load(){this._updateWorkerData("metadata")}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData("content"),this}getClusterExpansionZoom(t,n){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},n),this}getClusterChildren(t,n){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},n),this}getClusterLeaves(t,n,s,u){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:n,offset:s},u),this}_updateWorkerData(t){const n=a.extend({},this.workerOptions),s=this._data;typeof s=="string"?(n.request=this.map._requestManager.transformRequest(a.exported.resolveURL(s),a.ResourceType.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(s),this._pendingLoads++,this.fire(new a.Event("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,n,(u,d)=>{if(this._pendingLoads--,this._removed||d&&d.abandoned)return void this.fire(new a.Event("dataabort",{dataType:"source",sourceDataType:t}));let f=null;if(d&&d.resourceTiming&&d.resourceTiming[this.id]&&(f=d.resourceTiming[this.id].slice(0)),u)return void this.fire(new a.ErrorEvent(u));const _={dataType:"source",sourceDataType:t};this._collectResourceTiming&&f&&f.length>0&&a.extend(_,{resourceTiming:f}),this.fire(new a.Event("data",_))})}loaded(){return this._pendingLoads===0}loadTile(t,n){const s=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const u={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};t.request=this.actor.send(s,u,(d,f)=>(delete t.request,t.unloadVectorData(),t.aborted?n(null):d?n(d):(t.loadVectorData(f,this.map.painter,s==="reloadTile"),n(null))))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0}unloadTile(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}serialize(){return a.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var Hi=a.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Ai extends a.Evented{constructor(t,n,s,u){super(),this.id=t,this.dispatcher=s,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(u),this.options=n}load(t,n){this._loaded=!1,this.fire(new a.Event("dataloading",{dataType:"source"})),this.url=this.options.url,a.getImage(this.map._requestManager.transformRequest(this.url,a.ResourceType.Image),(s,u)=>{this._loaded=!0,s?this.fire(new a.ErrorEvent(s)):u&&(this.image=u,t&&(this.coordinates=t),n&&n(),this._finishLoading())})}loaded(){return this._loaded}updateImage(t){return this.image&&t.url?(this.options.url=t.url,this.load(t.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}setCoordinates(t){this.coordinates=t;const n=t.map(a.MercatorCoordinate.fromLngLat);this.tileID=function(u){let d=1/0,f=1/0,_=-1/0,y=-1/0;for(const D of u)d=Math.min(d,D.x),f=Math.min(f,D.y),_=Math.max(_,D.x),y=Math.max(y,D.y);const w=Math.max(_-d,y-f),I=Math.max(0,Math.floor(-Math.log(w)/Math.LN2)),P=Math.pow(2,I);return new a.CanonicalTileID(I,Math.floor((d+_)/2*P),Math.floor((f+y)/2*P))}(n),this.minzoom=this.maxzoom=this.tileID.z;const s=n.map(u=>this.tileID.getTilePoint(u)._round());return this._boundsArray=new a.RasterBoundsArray,this._boundsArray.emplaceBack(s[0].x,s[0].y,0,0),this._boundsArray.emplaceBack(s[1].x,s[1].y,a.EXTENT,0),this._boundsArray.emplaceBack(s[3].x,s[3].y,0,a.EXTENT),this._boundsArray.emplaceBack(s[2].x,s[2].y,a.EXTENT,a.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,Hi.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Me(t,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));for(const s in this.tiles){const u=this.tiles[s];u.state!=="loaded"&&(u.state="loaded",u.texture=this.texture)}}loadTile(t,n){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},n(null)):(t.state="errored",n(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class ir extends Ai{constructor(t,n,s,u){super(t,n,s,u),this.roundZoom=!0,this.type="video",this.options=n}load(){this._loaded=!1;const t=this.options;this.urls=[];for(const n of t.urls)this.urls.push(this.map._requestManager.transformRequest(n,a.ResourceType.Source).url);a.getVideo(this.urls,(n,s)=>{this._loaded=!0,n?this.fire(new a.ErrorEvent(n)):s&&(this.video=s,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const n=this.video.seekable;t<n.start(0)||t>n.end(0)?this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=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,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,Hi.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new Me(t,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));for(const s in this.tiles){const u=this.tiles[s];u.state!=="loaded"&&(u.state="loaded",u.texture=this.texture)}}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class Kr extends Ai{constructor(t,n,s,u){super(t,n,s,u),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some(d=>!Array.isArray(d)||d.length!==2||d.some(f=>typeof f!="number"))||this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${t}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new a.ErrorEvent(new a.ValidationError(`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 a.ErrorEvent(new a.ValidationError(`sources.${t}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new a.ErrorEvent(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 n=this.map.painter.context,s=n.gl;this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,Hi.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Me(n,this.canvas,s.RGBA,{premultiply:!0});for(const u in this.tiles){const d=this.tiles[u];d.state!=="loaded"&&(d.state="loaded",d.texture=this.texture)}}serialize(){return{type:"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 _n={vector:wi,raster:pi,"raster-dem":et,geojson:Ti,video:ir,image:Ai,canvas:Kr};function yn(l,t){const n=a.create();return a.translate(n,n,[1,1,0]),a.scale(n,n,[.5*l.width,.5*l.height,1]),a.multiply(n,n,l.calculatePosMatrix(t.toUnwrapped()))}function xn(l,t,n,s,u,d){const f=function(P,D,N){if(P)for(const U of P){const V=D[U];if(V&&V.source===N&&V.type==="fill-extrusion")return!0}else for(const U in D){const V=D[U];if(V.source===N&&V.type==="fill-extrusion")return!0}return!1}(u&&u.layers,t,l.id),_=d.maxPitchScaleFactor(),y=l.tilesIn(s,_,f);y.sort(dr);const w=[];for(const P of y)w.push({wrappedTileID:P.tileID.wrapped().key,queryResults:P.tile.queryRenderedFeatures(t,n,l._state,P.queryGeometry,P.cameraQueryGeometry,P.scale,u,d,_,yn(l.transform,P.tileID))});const I=function(P){const D={},N={};for(const U of P){const V=U.queryResults,Y=U.wrappedTileID,ie=N[Y]=N[Y]||{};for(const se in V){const G=V[se],ue=ie[se]=ie[se]||{},ae=D[se]=D[se]||[];for(const ge of G)ue[ge.featureIndex]||(ue[ge.featureIndex]=!0,ae.push(ge))}}return D}(w);for(const P in I)I[P].forEach(D=>{const N=D.feature,U=l.getFeatureState(N.layer["source-layer"],N.id);N.source=N.layer.source,N.layer["source-layer"]&&(N.sourceLayer=N.layer["source-layer"]),N.state=U});return I}function dr(l,t){const n=l.tileID,s=t.tileID;return n.overscaledZ-s.overscaledZ||n.canonical.y-s.canonical.y||n.wrap-s.wrap||n.canonical.x-s.canonical.x}class Dr{constructor(t,n){this.tileID=t,this.uid=a.uniqueId(),this.uses=0,this.tileSize=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.textures=[],this.textureCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(t){const n=t+this.timeAdded;n<a.exported.now()||this.fadeEndTime&&n<this.fadeEndTime||(this.fadeEndTime=n)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.textures.forEach(n=>t.saveTileTexture(n)),this.demTexture=null,this.textures=[],this.textureCoords={}}loadVectorData(t,n,s){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.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(u,d){const f={};if(!d)return f;for(const _ of u){const y=_.layerIds.map(w=>d.getLayer(w)).filter(Boolean);if(y.length!==0){_.layers=y,_.stateDependentLayerIds&&(_.stateDependentLayers=_.stateDependentLayerIds.map(w=>y.filter(I=>I.id===w)[0]));for(const w of y)f[w.id]=_}}return f}(t.buckets,n.style),this.hasSymbolBuckets=!1;for(const u in this.buckets){const d=this.buckets[u];if(d instanceof a.SymbolBucket){if(this.hasSymbolBuckets=!0,!s)break;d.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const u in this.buckets){const d=this.buckets[u];if(d instanceof a.SymbolBucket&&d.hasRTLText){this.hasRTLText=!0,a.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const u in this.buckets){const d=this.buckets[u];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(u).queryRadius(d))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new a.CollisionBoxArray}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.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const s in this.buckets){const u=this.buckets[s];u.uploadPending()&&u.upload(t)}const n=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Me(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Me(t,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,n,s,u,d,f,_,y,w,I){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:u,cameraQueryGeometry:d,scale:f,tileSize:this.tileSize,pixelPosMatrix:I,transform:y,params:_,queryPadding:this.queryPadding*w},t,n,s):{}}querySourceFeatures(t,n){const s=this.latestFeatureIndex;if(!s||!s.rawTileData)return;const u=s.loadVTLayers(),d=n?n.sourceLayer:"",f=u._geojsonTileLayer||u[d];if(!f)return;const _=a.createFilter(n&&n.filter),{z:y,x:w,y:I}=this.tileID.canonical,P={z:y,x:w,y:I};for(let D=0;D<f.length;D++){const N=f.feature(D);if(_.needGeometry){const Y=a.toEvaluationFeature(N,!0);if(!_.filter(new a.EvaluationParameters(this.tileID.overscaledZ),Y,this.tileID.canonical))continue}else if(!_.filter(new a.EvaluationParameters(this.tileID.overscaledZ),N))continue;const U=s.getId(N,d),V=new a.GeoJSONFeature(N,y,w,I,U);V.tile=P,t.push(V)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const n=this.expirationTime;if(t.cacheControl){const s=a.parseCacheControl(t.cacheControl);s["max-age"]&&(this.expirationTime=Date.now()+1e3*s["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const s=Date.now();let u=!1;if(this.expirationTime>s)u=!1;else if(n)if(this.expirationTime<n)u=!0;else{const d=this.expirationTime-n;d?this.expirationTime=s+Math.max(d,3e4):u=!0}else u=!0;u?(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,n){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(t).length===0)return;const s=this.latestFeatureIndex.loadVTLayers();for(const u in this.buckets){if(!n.style.hasLayer(u))continue;const d=this.buckets[u],f=d.layers[0].sourceLayer||"_geojsonTileLayer",_=s[f],y=t[f];if(!_||!y||Object.keys(y).length===0)continue;d.update(y,_,this.imageAtlas&&this.imageAtlas.patternPositions||{});const w=n&&n.style&&n.style.getLayer(u);w&&(this.queryPadding=Math.max(this.queryPadding,w.queryRadius(d)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<a.exported.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=a.exported.now()+t}setDependencies(t,n){const s={};for(const u of n)s[u]=!0;this.dependencies[t]=s}hasDependency(t,n){for(const s of t){const u=this.dependencies[s];if(u){for(const d of n)if(u[d])return!0}}return!1}}class Lr{constructor(t,n){this.max=t,this.onRemove=n,this.reset()}reset(){for(const t in this.data)for(const n of this.data[t])n.timeout&&clearTimeout(n.timeout),this.onRemove(n.value);return this.data={},this.order=[],this}add(t,n,s){const u=t.wrapped().key;this.data[u]===void 0&&(this.data[u]=[]);const d={value:n,timeout:void 0};if(s!==void 0&&(d.timeout=setTimeout(()=>{this.remove(t,d)},s)),this.data[u].push(d),this.order.push(u),this.order.length>this.max){const f=this._getAndRemoveByKey(this.order[0]);f&&this.onRemove(f)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const n=this.data[t].shift();return n.timeout&&clearTimeout(n.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),n.value}getByKey(t){const n=this.data[t];return n?n[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,n){if(!this.has(t))return this;const s=t.wrapped().key,u=n===void 0?0:this.data[s].indexOf(n),d=this.data[s][u];return this.data[s].splice(u,1),d.timeout&&clearTimeout(d.timeout),this.data[s].length===0&&delete this.data[s],this.onRemove(d.value),this.order.splice(this.order.indexOf(s),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n)}return this}filter(t){const n=[];for(const s in this.data)for(const u of this.data[s])t(u.value)||n.push(u);for(const s of n)this.remove(s.value.tileID,s)}}class Rr{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,s){const u=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][u]=this.stateChanges[t][u]||{},a.extend(this.stateChanges[t][u],s),this.deletedStates[t]===null){this.deletedStates[t]={};for(const d in this.state[t])d!==u&&(this.deletedStates[t][d]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][u]===null){this.deletedStates[t][u]={};for(const d in this.state[t][u])s[d]||(this.deletedStates[t][u][d]=null)}else for(const d in s)this.deletedStates[t]&&this.deletedStates[t][u]&&this.deletedStates[t][u][d]===null&&delete this.deletedStates[t][u][d]}removeFeatureState(t,n,s){if(this.deletedStates[t]===null)return;const u=String(n);if(this.deletedStates[t]=this.deletedStates[t]||{},s&&n!==void 0)this.deletedStates[t][u]!==null&&(this.deletedStates[t][u]=this.deletedStates[t][u]||{},this.deletedStates[t][u][s]=null);else if(n!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][u])for(s in this.deletedStates[t][u]={},this.stateChanges[t][u])this.deletedStates[t][u][s]=null;else this.deletedStates[t][u]=null;else this.deletedStates[t]=null}getState(t,n){const s=String(n),u=a.extend({},(this.state[t]||{})[s],(this.stateChanges[t]||{})[s]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const d=this.deletedStates[t][n];if(d===null)return{};for(const f in d)delete u[f]}return u}initializeTileState(t,n){t.setFeatureState(this.state,n)}coalesceChanges(t,n){const s={};for(const u in this.stateChanges){this.state[u]=this.state[u]||{};const d={};for(const f in this.stateChanges[u])this.state[u][f]||(this.state[u][f]={}),a.extend(this.state[u][f],this.stateChanges[u][f]),d[f]=this.state[u][f];s[u]=d}for(const u in this.deletedStates){this.state[u]=this.state[u]||{};const d={};if(this.deletedStates[u]===null)for(const f in this.state[u])d[f]={},this.state[u][f]={};else for(const f in this.deletedStates[u]){if(this.deletedStates[u][f]===null)this.state[u][f]={};else for(const _ of Object.keys(this.deletedStates[u][f]))delete this.state[u][f][_];d[f]=this.state[u][f]}s[u]=s[u]||{},a.extend(s[u],d)}if(this.stateChanges={},this.deletedStates={},Object.keys(s).length!==0)for(const u in t)t[u].setFeatureState(s,n)}}class Mi extends a.Evented{constructor(t,n,s){super(),this.id=t,this.dispatcher=s,this.on("data",u=>{u.dataType==="source"&&u.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&u.dataType==="source"&&u.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain))}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=function(u,d,f,_){const y=new _n[d.type](u,d,f,_);if(y.id!==u)throw new Error(`Expected Source id to be ${u} instead of ${y.id}`);return a.bindAll(["load","abort","unload","serialize","prepare"],y),y}(t,n,s,this),this._tiles={},this._cache=new Lr(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Rr}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const t in this._tiles){const n=this._tiles[t];if(n.state!=="loaded"&&n.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,n){return this._source.loadTile(t,n)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,()=>{})}_abortTile(t){this._source.abortTile&&this._source.abortTile(t,()=>{}),this._source.fire(new a.Event("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._tiles,this.map?this.map.painter:null);for(const n in this._tiles){const s=this._tiles[n];s.upload(t),s.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(vn).map(t=>t.key)}getRenderableIds(t){const n=[];for(const s in this._tiles)this._isIdRenderable(s,t)&&n.push(this._tiles[s]);return t?n.sort((s,u)=>{const d=s.tileID,f=u.tileID,_=new a.pointGeometry(d.canonical.x,d.canonical.y)._rotate(this.transform.angle),y=new a.pointGeometry(f.canonical.x,f.canonical.y)._rotate(this.transform.angle);return d.overscaledZ-f.overscaledZ||y.y-_.y||y.x-_.x}).map(s=>s.tileID.key):n.map(s=>s.tileID).sort(vn).map(s=>s.key)}hasRenderableParent(t){const n=this.findLoadedParent(t,0);return!!n&&this._isIdRenderable(n.tileID.key)}_isIdRenderable(t,n){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(n||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&&this._reloadTile(t,"reloading")}}_reloadTile(t,n){const s=this._tiles[t];s&&(s.state!=="loading"&&(s.state=n),this._loadTile(s,this._tileLoaded.bind(this,s,t,n)))}_tileLoaded(t,n,s,u){if(u)return t.state="errored",void(u.status!==404?this._source.fire(new a.ErrorEvent(u,{tile:t})):this.update(this.transform,this.terrain));t.timeAdded=a.exported.now(),s==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),this.getSource().type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new a.Event("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const n=this.getRenderableIds();for(let u=0;u<n.length;u++){const d=n[u];if(t.neighboringTiles&&t.neighboringTiles[d]){const f=this.getTileByID(d);s(t,f),s(f,t)}}function s(u,d){u.needsHillshadePrepare=!0,u.needsTerrainPrepare=!0;let f=d.tileID.canonical.x-u.tileID.canonical.x;const _=d.tileID.canonical.y-u.tileID.canonical.y,y=Math.pow(2,u.tileID.canonical.z),w=d.tileID.key;f===0&&_===0||Math.abs(_)>1||(Math.abs(f)>1&&(Math.abs(f+y)===1?f+=y:Math.abs(f-y)===1&&(f-=y)),d.dem&&u.dem&&(u.dem.backfillBorder(d.dem,f,_),u.neighboringTiles&&u.neighboringTiles[w]&&(u.neighboringTiles[w].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,n,s,u){for(const d in this._tiles){let f=this._tiles[d];if(u[d]||!f.hasData()||f.tileID.overscaledZ<=n||f.tileID.overscaledZ>s)continue;let _=f.tileID;for(;f&&f.tileID.overscaledZ>n+1;){const w=f.tileID.scaledTo(f.tileID.overscaledZ-1);f=this._tiles[w.key],f&&f.hasData()&&(_=w)}let y=_;for(;y.overscaledZ>n;)if(y=y.scaledTo(y.overscaledZ-1),t[y.key]){u[_.key]=_;break}}}findLoadedParent(t,n){if(t.key in this._loadedParentTiles){const s=this._loadedParentTiles[t.key];return s&&s.tileID.overscaledZ>=n?s:null}for(let s=t.overscaledZ-1;s>=n;s--){const u=t.scaledTo(s),d=this._getLoadedTile(u);if(d)return d}}_getLoadedTile(t){const n=this._tiles[t.key];return n&&n.hasData()?n:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const n=Math.ceil(t.width/this._source.tileSize)+1,s=Math.ceil(t.height/this._source.tileSize)+1,u=Math.floor(n*s*5),d=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,u):u;this._cache.setMaxSize(d)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,n){const s={};for(const u in this._tiles){const d=this._tiles[u];d.tileID=d.tileID.unwrapTo(d.tileID.wrap+n),s[d.tileID.key]=d}this._tiles=s;for(const u in this._timers)clearTimeout(this._timers[u]),delete this._timers[u];for(const u in this._tiles)this._setTileReloadTimer(u,this._tiles[u])}}update(t,n){if(this.transform=t,this.terrain=n,!this._sourceLoaded||this._paused)return;let s;this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?s=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(w=>new a.OverscaledTileID(w.canonical.z,w.wrap,w.canonical.z,w.canonical.x,w.canonical.y)):(s=t.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:n}),this._source.hasTile&&(s=s.filter(w=>this._source.hasTile(w)))):s=[];const u=t.coveringZoomLevel(this._source),d=Math.max(u-Mi.maxOverzooming,this._source.minzoom),f=Math.max(u+Mi.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const w={};for(const I of s)if(I.canonical.z>this._source.minzoom){const P=I.scaledTo(I.canonical.z-1);w[P.key]=P;const D=I.scaledTo(Math.max(this._source.minzoom,Math.min(I.canonical.z,5)));w[D.key]=D}s=s.concat(Object.values(w))}const _=this._updateRetainedTiles(s,u);if(jn(this._source.type)){const w={},I={},P=Object.keys(_);for(const D of P){const N=_[D],U=this._tiles[D];if(!U||U.fadeEndTime&&U.fadeEndTime<=a.exported.now())continue;const V=this.findLoadedParent(N,d);V&&(this._addTile(V.tileID),w[V.tileID.key]=V.tileID),I[D]=N}this._retainLoadedChildren(I,u,f,_);for(const D in w)_[D]||(this._coveredTiles[D]=!0,_[D]=w[D]);if(n){const D={},N={};for(const U of s)this._tiles[U.key].hasData()?D[U.key]=U:N[U.key]=U;for(const U in N){const V=N[U].children(this._source.maxzoom);this._tiles[V[0].key]&&this._tiles[V[1].key]&&this._tiles[V[2].key]&&this._tiles[V[3].key]&&(D[V[0].key]=_[V[0].key]=V[0],D[V[1].key]=_[V[1].key]=V[1],D[V[2].key]=_[V[2].key]=V[2],D[V[3].key]=_[V[3].key]=V[3],delete N[U])}for(const U in N){const V=this.findLoadedParent(N[U],this._source.minzoom);if(V){D[V.tileID.key]=_[V.tileID.key]=V.tileID;for(const Y in D)D[Y].isChildOf(V.tileID)&&delete D[Y]}}for(const U in this._tiles)D[U]||(this._coveredTiles[U]=!0)}}for(const w in _)this._tiles[w].clearFadeHold();const y=a.keysDifference(this._tiles,_);for(const w of y){const I=this._tiles[w];I.hasSymbolBuckets&&!I.holdingForFade()?I.setHoldDuration(this.map._fadeDuration):I.hasSymbolBuckets&&!I.symbolFadeFinished()||this._removeTile(w)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,n){const s={},u={},d=Math.max(n-Mi.maxOverzooming,this._source.minzoom),f=Math.max(n+Mi.maxUnderzooming,this._source.minzoom),_={};for(const y of t){const w=this._addTile(y);s[y.key]=y,w.hasData()||n<this._source.maxzoom&&(_[y.key]=y)}this._retainLoadedChildren(_,n,f,s);for(const y of t){let w=this._tiles[y.key];if(w.hasData())continue;if(n+1>this._source.maxzoom){const P=y.children(this._source.maxzoom)[0],D=this.getTile(P);if(D&&D.hasData()){s[P.key]=P;continue}}else{const P=y.children(this._source.maxzoom);if(s[P[0].key]&&s[P[1].key]&&s[P[2].key]&&s[P[3].key])continue}let I=w.wasRequested();for(let P=y.overscaledZ-1;P>=d;--P){const D=y.scaledTo(P);if(u[D.key]||(u[D.key]=!0,w=this.getTile(D),!w&&I&&(w=this._addTile(D)),w&&(s[D.key]=D,I=w.wasRequested(),w.hasData())))break}}return s}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const n=[];let s,u=this._tiles[t].tileID;for(;u.overscaledZ>0;){if(u.key in this._loadedParentTiles){s=this._loadedParentTiles[u.key];break}n.push(u.key);const d=u.scaledTo(u.overscaledZ-1);if(s=this._getLoadedTile(d),s)break;u=d}for(const d of n)this._loadedParentTiles[d]=s}}_addTile(t){let n=this._tiles[t.key];if(n)return n;n=this._cache.getAndRemove(t),n&&(this._setTileReloadTimer(t.key,n),n.tileID=t,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,n)));const s=n;return n||(n=new Dr(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(n,this._tileLoaded.bind(this,n,t.key,n.state))),n.uses++,this._tiles[t.key]=n,s||this._source.fire(new a.Event("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(t,n){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const s=n.getExpiryTimeout();s&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},s))}_removeTile(t){const n=this._tiles[t];n&&(n.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),n.uses>0||(n.hasData()&&n.state!=="reloading"?this._cache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,n,s){const u=[],d=this.transform;if(!d)return u;const f=s?d.getCameraQueryGeometry(t):t,_=t.map(U=>d.pointCoordinate(U,this.terrain)),y=f.map(U=>d.pointCoordinate(U,this.terrain)),w=this.getIds();let I=1/0,P=1/0,D=-1/0,N=-1/0;for(const U of y)I=Math.min(I,U.x),P=Math.min(P,U.y),D=Math.max(D,U.x),N=Math.max(N,U.y);for(let U=0;U<w.length;U++){const V=this._tiles[w[U]];if(V.holdingForFade())continue;const Y=V.tileID,ie=Math.pow(2,d.zoom-V.tileID.overscaledZ),se=n*V.queryPadding*a.EXTENT/V.tileSize/ie,G=[Y.getTilePoint(new a.MercatorCoordinate(I,P)),Y.getTilePoint(new a.MercatorCoordinate(D,N))];if(G[0].x-se<a.EXTENT&&G[0].y-se<a.EXTENT&&G[1].x+se>=0&&G[1].y+se>=0){const ue=_.map(ge=>Y.getTilePoint(ge)),ae=y.map(ge=>Y.getTilePoint(ge));u.push({tile:V,tileID:Y,queryGeometry:ue,cameraQueryGeometry:ae,scale:ie})}}return u}getVisibleCoordinates(t){const n=this.getRenderableIds(t).map(s=>this._tiles[s].tileID);for(const s of n)s.posMatrix=this.transform.calculatePosMatrix(s.toUnwrapped());return n}hasTransition(){if(this._source.hasTransition())return!0;if(jn(this._source.type))for(const t in this._tiles){const n=this._tiles[t];if(n.fadeEndTime!==void 0&&n.fadeEndTime>=a.exported.now())return!0}return!1}setFeatureState(t,n,s){this._state.updateState(t=t||"_geojsonTileLayer",n,s)}removeFeatureState(t,n,s){this._state.removeFeatureState(t=t||"_geojsonTileLayer",n,s)}getFeatureState(t,n){return this._state.getState(t=t||"_geojsonTileLayer",n)}setDependencies(t,n,s){const u=this._tiles[t];u&&u.setDependencies(n,s)}reloadTilesForDependencies(t,n){for(const s in this._tiles)this._tiles[s].hasDependency(t,n)&&this._reloadTile(s,"reloading");this._cache.filter(s=>!s.hasDependency(t,n))}}function vn(l,t){const n=Math.abs(2*l.wrap)-+(l.wrap<0),s=Math.abs(2*t.wrap)-+(t.wrap<0);return l.overscaledZ-t.overscaledZ||s-n||t.canonical.y-l.canonical.y||t.canonical.x-l.canonical.x}function jn(l){return l==="raster"||l==="image"||l==="video"}Mi.maxOverzooming=10,Mi.maxUnderzooming=3;const br="mapboxgl_preloaded_worker_pool";class Fi{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<Fi.workerCount;)this.workers.push(new Worker(sn.workerUrl));return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],this.numActive()===0&&(this.workers.forEach(n=>{n.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[br]}numActive(){return Object.keys(this.active).length}}const Xn=Math.floor(a.exported.hardwareConcurrency/2);let Br;function bn(){return Br||(Br=new Fi),Br}function wn(l,t){const n={};for(const s in l)s!=="ref"&&(n[s]=l[s]);return a.refProperties.forEach(s=>{s in t&&(n[s]=t[s])}),n}function Wn(l){l=l.slice();const t=Object.create(null);for(let n=0;n<l.length;n++)t[l[n].id]=l[n];for(let n=0;n<l.length;n++)"ref"in l[n]&&(l[n]=wn(l[n],t[l[n].ref]));return l}Fi.workerCount=Math.max(Math.min(Xn,6),1);const vt={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};function pr(l,t,n){n.push({command:vt.addSource,args:[l,t[l]]})}function Fr(l,t,n){t.push({command:vt.removeSource,args:[l]}),n[l]=!0}function Or(l,t,n,s){Fr(l,n,s),pr(l,t,n)}function Hn(l,t,n){let s;for(s in l[n])if(Object.prototype.hasOwnProperty.call(l[n],s)&&s!=="data"&&!oe(l[n][s],t[n][s]))return!1;for(s in t[n])if(Object.prototype.hasOwnProperty.call(t[n],s)&&s!=="data"&&!oe(l[n][s],t[n][s]))return!1;return!0}function wr(l,t,n,s,u,d){let f;for(f in t=t||{},l=l||{})Object.prototype.hasOwnProperty.call(l,f)&&(oe(l[f],t[f])||n.push({command:d,args:[s,f,t[f],u]}));for(f in t)Object.prototype.hasOwnProperty.call(t,f)&&!Object.prototype.hasOwnProperty.call(l,f)&&(oe(l[f],t[f])||n.push({command:d,args:[s,f,t[f],u]}))}function Tr(l){return l.id}function Tn(l,t){return l[t.id]=t,l}class Er{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],this._distances=[0];for(let s=1;s<this.points.length;s++)this._distances[s]=this._distances[s-1]+this.points[s].dist(this.points[s-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(n||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=a.clamp(t,0,1);let n=1,s=this._distances[n];const u=t*this.paddedLength+this.padding;for(;s<u&&n<this._distances.length;)s=this._distances[++n];const d=n-1,f=this._distances[d],_=s-f,y=_>0?(u-f)/_:0;return this.points[d].mult(1-y).add(this.points[n].mult(y))}}function ye(l,t){let n=!0;return l==="always"||l!=="never"&&t!=="never"||(n=!1),n}class Pe{constructor(t,n,s){const u=this.boxCells=[],d=this.circleCells=[];this.xCellCount=Math.ceil(t/s),this.yCellCount=Math.ceil(n/s);for(let f=0;f<this.xCellCount*this.yCellCount;f++)u.push([]),d.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=n,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/n,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,n,s,u,d){this._forEachCell(n,s,u,d,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(n),this.bboxes.push(s),this.bboxes.push(u),this.bboxes.push(d)}insertCircle(t,n,s,u){this._forEachCell(n-u,s-u,n+u,s+u,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(n),this.circles.push(s),this.circles.push(u)}_insertBoxCell(t,n,s,u,d,f){this.boxCells[d].push(f)}_insertCircleCell(t,n,s,u,d,f){this.circleCells[d].push(f)}_query(t,n,s,u,d,f,_){if(s<0||t>this.width||u<0||n>this.height)return[];const y=[];if(t<=0&&n<=0&&this.width<=s&&this.height<=u){if(d)return[{key:null,x1:t,y1:n,x2:s,y2:u}];for(let w=0;w<this.boxKeys.length;w++)y.push({key:this.boxKeys[w],x1:this.bboxes[4*w],y1:this.bboxes[4*w+1],x2:this.bboxes[4*w+2],y2:this.bboxes[4*w+3]});for(let w=0;w<this.circleKeys.length;w++){const I=this.circles[3*w],P=this.circles[3*w+1],D=this.circles[3*w+2];y.push({key:this.circleKeys[w],x1:I-D,y1:P-D,x2:I+D,y2:P+D})}}else this._forEachCell(t,n,s,u,this._queryCell,y,{hitTest:d,overlapMode:f,seenUids:{box:{},circle:{}}},_);return y}query(t,n,s,u){return this._query(t,n,s,u,!1,null)}hitTest(t,n,s,u,d,f){return this._query(t,n,s,u,!0,d,f).length>0}hitTestCircle(t,n,s,u,d){const f=t-s,_=t+s,y=n-s,w=n+s;if(_<0||f>this.width||w<0||y>this.height)return!1;const I=[];return this._forEachCell(f,y,_,w,this._queryCellCircle,I,{hitTest:!0,overlapMode:u,circle:{x:t,y:n,radius:s},seenUids:{box:{},circle:{}}},d),I.length>0}_queryCell(t,n,s,u,d,f,_,y){const{seenUids:w,hitTest:I,overlapMode:P}=_,D=this.boxCells[d];if(D!==null){const U=this.bboxes;for(const V of D)if(!w.box[V]){w.box[V]=!0;const Y=4*V,ie=this.boxKeys[V];if(t<=U[Y+2]&&n<=U[Y+3]&&s>=U[Y+0]&&u>=U[Y+1]&&(!y||y(ie))&&(!I||!ye(P,ie.overlapMode))&&(f.push({key:ie,x1:U[Y],y1:U[Y+1],x2:U[Y+2],y2:U[Y+3]}),I))return!0}}const N=this.circleCells[d];if(N!==null){const U=this.circles;for(const V of N)if(!w.circle[V]){w.circle[V]=!0;const Y=3*V,ie=this.circleKeys[V];if(this._circleAndRectCollide(U[Y],U[Y+1],U[Y+2],t,n,s,u)&&(!y||y(ie))&&(!I||!ye(P,ie.overlapMode))){const se=U[Y],G=U[Y+1],ue=U[Y+2];if(f.push({key:ie,x1:se-ue,y1:G-ue,x2:se+ue,y2:G+ue}),I)return!0}}}return!1}_queryCellCircle(t,n,s,u,d,f,_,y){const{circle:w,seenUids:I,overlapMode:P}=_,D=this.boxCells[d];if(D!==null){const U=this.bboxes;for(const V of D)if(!I.box[V]){I.box[V]=!0;const Y=4*V,ie=this.boxKeys[V];if(this._circleAndRectCollide(w.x,w.y,w.radius,U[Y+0],U[Y+1],U[Y+2],U[Y+3])&&(!y||y(ie))&&!ye(P,ie.overlapMode))return f.push(!0),!0}}const N=this.circleCells[d];if(N!==null){const U=this.circles;for(const V of N)if(!I.circle[V]){I.circle[V]=!0;const Y=3*V,ie=this.circleKeys[V];if(this._circlesCollide(U[Y],U[Y+1],U[Y+2],w.x,w.y,w.radius)&&(!y||y(ie))&&!ye(P,ie.overlapMode))return f.push(!0),!0}}}_forEachCell(t,n,s,u,d,f,_,y){const w=this._convertToXCellCoord(t),I=this._convertToYCellCoord(n),P=this._convertToXCellCoord(s),D=this._convertToYCellCoord(u);for(let N=w;N<=P;N++)for(let U=I;U<=D;U++)if(d.call(this,t,n,s,u,this.xCellCount*U+N,f,_,y))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,n,s,u,d,f){const _=u-t,y=d-n,w=s+f;return w*w>_*_+y*y}_circleAndRectCollide(t,n,s,u,d,f,_){const y=(f-u)/2,w=Math.abs(t-(u+y));if(w>y+s)return!1;const I=(_-d)/2,P=Math.abs(n-(d+I));if(P>I+s)return!1;if(w<=y||P<=I)return!0;const D=w-y,N=P-I;return D*D+N*N<=s*s}}function Jr(l,t,n,s,u){const d=a.create();return t?(a.scale(d,d,[1/u,1/u,1]),n||a.rotateZ(d,d,s.angle)):a.multiply(d,s.labelPlaneMatrix,l),d}function rr(l,t,n,s,u){if(t){const d=a.clone(l);return a.scale(d,d,[u,u,1]),n||a.rotateZ(d,d,-s.angle),d}return s.glCoordMatrix}function bt(l,t,n){let s;n?(s=[l.x,l.y,n(l.x,l.y),1],a.transformMat4(s,s,t)):(s=[l.x,l.y,0,1],Sr(s,s,t));const u=s[3];return{point:new a.pointGeometry(s[0]/u,s[1]/u),signedDistanceFromCamera:u}}function Ki(l,t){return .5+l/t*.5}function Oi(l,t){const n=l[0]/l[3],s=l[1]/l[3];return n>=-t[0]&&n<=t[0]&&s>=-t[1]&&s<=t[1]}function $i(l,t,n,s,u,d,f,_,y,w){const I=s?l.textSizeData:l.iconSizeData,P=a.evaluateSizeForZoom(I,n.transform.zoom),D=[256/n.width*2+1,256/n.height*2+1],N=s?l.text.dynamicLayoutVertexArray:l.icon.dynamicLayoutVertexArray;N.clear();const U=l.lineVertexArray,V=s?l.text.placedSymbolArray:l.icon.placedSymbolArray,Y=n.transform.width/n.transform.height;let ie=!1;for(let se=0;se<V.length;se++){const G=V.get(se);if(G.hidden||G.writingMode===a.WritingMode.vertical&&!ie){ot(G.numGlyphs,N);continue}let ue;if(ie=!1,w?(ue=[G.anchorX,G.anchorY,w(G.anchorX,G.anchorY),1],a.transformMat4(ue,ue,t)):(ue=[G.anchorX,G.anchorY,0,1],Sr(ue,ue,t)),!Oi(ue,D)){ot(G.numGlyphs,N);continue}const ae=Ki(n.transform.cameraToCenterDistance,ue[3]),ge=a.evaluateSizeForFeature(I,P,G),_e=f?ge/ae:ge*ae,we=new a.pointGeometry(G.anchorX,G.anchorY),me=bt(we,u,w).point,Oe={},Ce=ut(G,_e,!1,_,t,u,d,l.glyphOffsetArray,U,N,me,we,Oe,Y,y,w);ie=Ce.useVertical,(Ce.notEnoughRoom||ie||Ce.needsFlipping&&ut(G,_e,!0,_,t,u,d,l.glyphOffsetArray,U,N,me,we,Oe,Y,y,w).notEnoughRoom)&&ot(G.numGlyphs,N)}s?l.text.dynamicLayoutVertexBuffer.updateData(N):l.icon.dynamicLayoutVertexBuffer.updateData(N)}function $r(l,t,n,s,u,d,f,_,y,w,I,P,D){const N=_.glyphStartIndex+_.numGlyphs,U=_.lineStartIndex,V=_.lineStartIndex+_.lineLength,Y=t.getoffsetX(_.glyphStartIndex),ie=t.getoffsetX(N-1),se=fi(l*Y,n,s,u,d,f,_.segment,U,V,y,w,I,P,D);if(!se)return null;const G=fi(l*ie,n,s,u,d,f,_.segment,U,V,y,w,I,P,D);return G?{first:se,last:G}:null}function Ie(l,t,n,s){return l===a.WritingMode.horizontal&&Math.abs(n.y-t.y)>Math.abs(n.x-t.x)*s?{useVertical:!0}:(l===a.WritingMode.vertical?t.y<n.y:t.x>n.x)?{needsFlipping:!0}:null}function ut(l,t,n,s,u,d,f,_,y,w,I,P,D,N,U,V){const Y=t/24,ie=l.lineOffsetX*Y,se=l.lineOffsetY*Y;let G;if(l.numGlyphs>1){const ue=l.glyphStartIndex+l.numGlyphs,ae=l.lineStartIndex,ge=l.lineStartIndex+l.lineLength,_e=$r(Y,_,ie,se,n,I,P,l,y,d,D,U,V);if(!_e)return{notEnoughRoom:!0};const we=bt(_e.first.point,f,V).point,me=bt(_e.last.point,f,V).point;if(s&&!n){const Oe=Ie(l.writingMode,we,me,N);if(Oe)return Oe}G=[_e.first];for(let Oe=l.glyphStartIndex+1;Oe<ue-1;Oe++)G.push(fi(Y*_.getoffsetX(Oe),ie,se,n,I,P,l.segment,ae,ge,y,d,D,U,V));G.push(_e.last)}else{if(s&&!n){const ae=bt(P,u,V).point,ge=l.lineStartIndex+l.segment+1,_e=new a.pointGeometry(y.getx(ge),y.gety(ge)),we=bt(_e,u,V),me=we.signedDistanceFromCamera>0?we.point:at(P,_e,ae,1,u,V),Oe=Ie(l.writingMode,ae,me,N);if(Oe)return Oe}const ue=fi(Y*_.getoffsetX(l.glyphStartIndex),ie,se,n,I,P,l.segment,l.lineStartIndex,l.lineStartIndex+l.lineLength,y,d,D,U,V);if(!ue)return{notEnoughRoom:!0};G=[ue]}for(const ue of G)a.addDynamicAttributes(w,ue.point,ue.angle);return{}}function at(l,t,n,s,u,d){const f=bt(l.add(l.sub(t)._unit()),u,d).point,_=n.sub(f);return n.add(_._mult(s/_.mag()))}function fi(l,t,n,s,u,d,f,_,y,w,I,P,D,N){const U=s?l-t:l+t;let V=U>0?1:-1,Y=0;s&&(V*=-1,Y=Math.PI),V<0&&(Y+=Math.PI);let ie=V>0?_+f:_+f+1,se=u,G=u,ue=0,ae=0;const ge=Math.abs(U),_e=[];for(;ue+ae<=ge;){if(ie+=V,ie<_||ie>=y)return null;if(G=se,_e.push(se),se=P[ie],se===void 0){const $e=new a.pointGeometry(w.getx(ie),w.gety(ie)),lt=bt($e,I,N);if(lt.signedDistanceFromCamera>0)se=P[ie]=lt.point;else{const dt=ie-V;se=at(ue===0?d:new a.pointGeometry(w.getx(dt),w.gety(dt)),$e,G,ge-ue+1,I,N)}}ue+=ae,ae=G.dist(se)}const we=(ge-ue)/ae,me=se.sub(G),Oe=me.mult(we)._add(G);Oe._add(me._unit()._perp()._mult(n*V));const Ce=Y+Math.atan2(se.y-G.y,se.x-G.x);return _e.push(Oe),{point:Oe,angle:D?Ce:0,path:_e}}const Ur=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ot(l,t){for(let n=0;n<l;n++){const s=t.length;t.resize(s+4),t.float32.set(Ur,3*s)}}function Sr(l,t,n){const s=t[0],u=t[1];return l[0]=n[0]*s+n[4]*u+n[12],l[1]=n[1]*s+n[5]*u+n[13],l[3]=n[3]*s+n[7]*u+n[15],l}const si=100;class En{constructor(t,n=new Pe(t.width+200,t.height+200,25),s=new Pe(t.width+200,t.height+200,25)){this.transform=t,this.grid=n,this.ignoredGrid=s,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+si,this.screenBottomBoundary=t.height+si,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,n,s,u,d,f){const _=this.projectAndGetPerspectiveRatio(u,t.anchorPointX,t.anchorPointY,f),y=s*_.perspectiveRatio,w=t.x1*y+_.point.x,I=t.y1*y+_.point.y,P=t.x2*y+_.point.x,D=t.y2*y+_.point.y;return!this.isInsideGrid(w,I,P,D)||n!=="always"&&this.grid.hitTest(w,I,P,D,n,d)||_.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[w,I,P,D],offscreen:this.isOffscreen(w,I,P,D)}}placeCollisionCircles(t,n,s,u,d,f,_,y,w,I,P,D,N,U){const V=[],Y=new a.pointGeometry(n.anchorX,n.anchorY),ie=bt(Y,f,U),se=Ki(this.transform.cameraToCenterDistance,ie.signedDistanceFromCamera),G=(I?d/se:d*se)/a.ONE_EM,ue=bt(Y,_,U).point,ae=$r(G,u,n.lineOffsetX*G,n.lineOffsetY*G,!1,ue,Y,n,s,_,{},!1,U);let ge=!1,_e=!1,we=!0;if(ae){const me=.5*D*se+N,Oe=new a.pointGeometry(-100,-100),Ce=new a.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),$e=new Er,lt=ae.first,dt=ae.last;let We=[];for(let xt=lt.path.length-1;xt>=1;xt--)We.push(lt.path[xt]);for(let xt=1;xt<dt.path.length;xt++)We.push(dt.path[xt]);const Mt=2.5*me;if(y){const xt=We.map(Et=>bt(Et,y,U));We=xt.some(Et=>Et.signedDistanceFromCamera<=0)?[]:xt.map(Et=>Et.point)}let Pt=[];if(We.length>0){const xt=We[0].clone(),Et=We[0].clone();for(let kt=1;kt<We.length;kt++)xt.x=Math.min(xt.x,We[kt].x),xt.y=Math.min(xt.y,We[kt].y),Et.x=Math.max(Et.x,We[kt].x),Et.y=Math.max(Et.y,We[kt].y);Pt=xt.x>=Oe.x&&Et.x<=Ce.x&&xt.y>=Oe.y&&Et.y<=Ce.y?[We]:Et.x<Oe.x||xt.x>Ce.x||Et.y<Oe.y||xt.y>Ce.y?[]:a.clipLine([We],Oe.x,Oe.y,Ce.x,Ce.y)}for(const xt of Pt){$e.reset(xt,.25*me);let Et=0;Et=$e.length<=.5*me?1:Math.ceil($e.paddedLength/Mt)+1;for(let kt=0;kt<Et;kt++){const li=kt/Math.max(Et-1,1),_r=$e.lerp(li),or=_r.x+si,yr=_r.y+si;V.push(or,yr,me,0);const Xr=or-me,Yi=yr-me,zi=or+me,Ar=yr+me;if(we=we&&this.isOffscreen(Xr,Yi,zi,Ar),_e=_e||this.isInsideGrid(Xr,Yi,zi,Ar),t!=="always"&&this.grid.hitTestCircle(or,yr,me,t,P)&&(ge=!0,!w))return{circles:[],offscreen:!1,collisionDetected:ge}}}}return{circles:!w&&ge||!_e||se<this.perspectiveRatioCutoff?[]:V,offscreen:we,collisionDetected:ge}}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const n=[];let s=1/0,u=1/0,d=-1/0,f=-1/0;for(const I of t){const P=new a.pointGeometry(I.x+si,I.y+si);s=Math.min(s,P.x),u=Math.min(u,P.y),d=Math.max(d,P.x),f=Math.max(f,P.y),n.push(P)}const _=this.grid.query(s,u,d,f).concat(this.ignoredGrid.query(s,u,d,f)),y={},w={};for(const I of _){const P=I.key;if(y[P.bucketInstanceId]===void 0&&(y[P.bucketInstanceId]={}),y[P.bucketInstanceId][P.featureIndex])continue;const D=[new a.pointGeometry(I.x1,I.y1),new a.pointGeometry(I.x2,I.y1),new a.pointGeometry(I.x2,I.y2),new a.pointGeometry(I.x1,I.y2)];a.polygonIntersectsPolygon(n,D)&&(y[P.bucketInstanceId][P.featureIndex]=!0,w[P.bucketInstanceId]===void 0&&(w[P.bucketInstanceId]=[]),w[P.bucketInstanceId].push(P.featureIndex))}return w}insertCollisionBox(t,n,s,u,d,f){(s?this.ignoredGrid:this.grid).insert({bucketInstanceId:u,featureIndex:d,collisionGroupID:f,overlapMode:n},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,n,s,u,d,f){const _=s?this.ignoredGrid:this.grid,y={bucketInstanceId:u,featureIndex:d,collisionGroupID:f,overlapMode:n};for(let w=0;w<t.length;w+=4)_.insertCircle(y,t[w],t[w+1],t[w+2])}projectAndGetPerspectiveRatio(t,n,s,u){let d;return u?(d=[n,s,u(n,s),1],a.transformMat4(d,d,t)):(d=[n,s,0,1],Sr(d,d,t)),{point:new a.pointGeometry((d[0]/d[3]+1)/2*this.transform.width+si,(-d[1]/d[3]+1)/2*this.transform.height+si),perspectiveRatio:.5+this.transform.cameraToCenterDistance/d[3]*.5}}isOffscreen(t,n,s,u){return s<si||t>=this.screenRightBoundary||u<si||n>this.screenBottomBoundary}isInsideGrid(t,n,s,u){return s>=0&&t<this.gridRightBoundary&&u>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const t=a.identity([]);return a.translate(t,t,[-100,-100,0]),t}}function Yt(l,t,n){return t*(a.EXTENT/(l.tileSize*Math.pow(2,n-l.tileID.overscaledZ)))}class Ei{constructor(t,n,s,u){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?n:-n))):u&&s?1:0,this.placed=s}isHidden(){return this.opacity===0&&!this.placed}}class zt{constructor(t,n,s,u,d){this.text=new Ei(t?t.text:null,n,s,d),this.icon=new Ei(t?t.icon:null,n,u,d)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Sn{constructor(t,n,s){this.text=t,this.icon=n,this.skipFade=s}}class fr{constructor(){this.invProjMatrix=a.create(),this.viewportMatrix=a.create(),this.circles=[]}}class Yr{constructor(t,n,s,u,d){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=s,this.bucketIndex=u,this.tileID=d}}class Qr{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 n=++this.maxGroupID;this.collisionGroups[t]={ID:n,predicate:s=>s.collisionGroupID===n}}return this.collisionGroups[t]}}function In(l,t,n,s,u){const{horizontalAlign:d,verticalAlign:f}=a.getAnchorAlignment(l),_=-(d-.5)*t,y=-(f-.5)*n,w=a.evaluateVariableOffset(l,s);return new a.pointGeometry(_+w[0]*u,y+w[1]*u)}function en(l,t,n,s,u,d){const{x1:f,x2:_,y1:y,y2:w,anchorPointX:I,anchorPointY:P}=l,D=new a.pointGeometry(t,n);return s&&D._rotate(u?d:-d),{x1:f+D.x,y1:y+D.y,x2:_+D.x,y2:w+D.y,anchorPointX:I,anchorPointY:P}}class ${constructor(t,n,s,u,d){this.transform=t.clone(),this.terrain=n,this.collisionIndex=new En(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=s,this.retainedQueryData={},this.collisionGroups=new Qr(u),this.collisionCircleArrays={},this.prevPlacement=d,d&&(d.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,n,s,u){const d=s.getBucket(n),f=s.latestFeatureIndex;if(!d||!f||n.id!==d.layerIds[0])return;const _=s.collisionBoxArray,y=d.layers[0].layout,w=Math.pow(2,this.transform.zoom-s.tileID.overscaledZ),I=s.tileSize/a.EXTENT,P=this.transform.calculatePosMatrix(s.tileID.toUnwrapped()),D=y.get("text-pitch-alignment")==="map",N=y.get("text-rotation-alignment")==="map",U=Yt(s,1,this.transform.zoom),V=Jr(P,D,N,this.transform,U);let Y=null;if(D){const se=rr(P,D,N,this.transform,U);Y=a.multiply([],this.transform.labelPlaneMatrix,se)}this.retainedQueryData[d.bucketInstanceId]=new Yr(d.bucketInstanceId,f,d.sourceLayerIndex,d.index,s.tileID);const ie={bucket:d,layout:y,posMatrix:P,textLabelPlaneMatrix:V,labelToScreenMatrix:Y,scale:w,textPixelRatio:I,holdingForFade:s.holdingForFade(),collisionBoxArray:_,partiallyEvaluatedTextSize:a.evaluateSizeForZoom(d.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(d.sourceID)};if(u)for(const se of d.sortKeyRanges){const{sortKey:G,symbolInstanceStart:ue,symbolInstanceEnd:ae}=se;t.push({sortKey:G,symbolInstanceStart:ue,symbolInstanceEnd:ae,parameters:ie})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:d.symbolInstances.length,parameters:ie})}attemptAnchorPlacement(t,n,s,u,d,f,_,y,w,I,P,D,N,U,V,Y){const ie=[D.textOffset0,D.textOffset1],se=In(t,s,u,ie,d),G=this.collisionIndex.placeCollisionBox(en(n,se.x,se.y,f,_,this.transform.angle),P,y,w,I.predicate,Y);if((!V||this.collisionIndex.placeCollisionBox(en(V,se.x,se.y,f,_,this.transform.angle),P,y,w,I.predicate,Y).box.length!==0)&&G.box.length>0){let ue;if(this.prevPlacement&&this.prevPlacement.variableOffsets[D.crossTileID]&&this.prevPlacement.placements[D.crossTileID]&&this.prevPlacement.placements[D.crossTileID].text&&(ue=this.prevPlacement.variableOffsets[D.crossTileID].anchor),D.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[D.crossTileID]={textOffset:ie,width:s,height:u,anchor:t,textBoxScale:d,prevAnchor:ue},this.markUsedJustification(N,t,D,U),N.allowVerticalPlacement&&(this.markUsedOrientation(N,U,D),this.placedOrientations[D.crossTileID]=U),{shift:se,placedGlyphBoxes:G}}}placeLayerBucketPart(t,n,s){const{bucket:u,layout:d,posMatrix:f,textLabelPlaneMatrix:_,labelToScreenMatrix:y,textPixelRatio:w,holdingForFade:I,collisionBoxArray:P,partiallyEvaluatedTextSize:D,collisionGroup:N}=t.parameters,U=d.get("text-optional"),V=d.get("icon-optional"),Y=a.getOverlapMode(d,"text-overlap","text-allow-overlap"),ie=Y==="always",se=a.getOverlapMode(d,"icon-overlap","icon-allow-overlap"),G=se==="always",ue=d.get("text-rotation-alignment")==="map",ae=d.get("text-pitch-alignment")==="map",ge=d.get("icon-text-fit")!=="none",_e=d.get("symbol-z-order")==="viewport-y",we=ie&&(G||!u.hasIconData()||V),me=G&&(ie||!u.hasTextData()||U);!u.collisionArrays&&P&&u.deserializeCollisionBoxes(P);const Oe=(Ce,$e)=>{if(n[Ce.crossTileID])return;if(I)return void(this.placements[Ce.crossTileID]=new Sn(!1,!1,!1));let lt=!1,dt=!1,We=!0,Mt=null,Pt={box:null,offscreen:null},xt={box:null,offscreen:null},Et=null,kt=null,li=null,_r=0,or=0,yr=0;$e.textFeatureIndex?_r=$e.textFeatureIndex:Ce.useRuntimeCollisionCircles&&(_r=Ce.featureIndex),$e.verticalTextFeatureIndex&&(or=$e.verticalTextFeatureIndex);const Xr=this.retainedQueryData[u.bucketInstanceId].tileID,Yi=this.terrain?(ri,ft)=>this.terrain.getElevation(Xr,ri,ft):null;for(const ri of["textBox","verticalTextBox","iconBox","verticalIconBox"]){const ft=$e[ri];ft&&(ft.elevation=Yi?Yi(ft.anchorPointX,ft.anchorPointY):0)}const zi=$e.textBox;if(zi){const ri=Ct=>{let ci=a.WritingMode.horizontal;if(u.allowVerticalPlacement&&!Ct&&this.prevPlacement){const ui=this.prevPlacement.placedOrientations[Ce.crossTileID];ui&&(this.placedOrientations[Ce.crossTileID]=ui,ci=ui,this.markUsedOrientation(u,ci,Ce))}return ci},ft=(Ct,ci)=>{if(u.allowVerticalPlacement&&Ce.numVerticalGlyphVertices>0&&$e.verticalTextBox){for(const ui of u.writingModes)if(ui===a.WritingMode.vertical?(Pt=ci(),xt=Pt):Pt=Ct(),Pt&&Pt.box&&Pt.box.length)break}else Pt=Ct()};if(d.get("text-variable-anchor")){let Ct=d.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[Ce.crossTileID]){const qt=this.prevPlacement.variableOffsets[Ce.crossTileID];Ct.indexOf(qt.anchor)>0&&(Ct=Ct.filter(Qi=>Qi!==qt.anchor),Ct.unshift(qt.anchor))}const ci=(qt,Qi,an)=>{const Us=qt.x2-qt.x1,$n=qt.y2-qt.y1,el=Ce.textBoxScale,Vs=ge&&se==="never"?Qi:null;let Wr={box:[],offscreen:!1};const ln=Y!=="never"?2*Ct.length:Ct.length;for(let cn=0;cn<ln;++cn){const Ho=this.attemptAnchorPlacement(Ct[cn%Ct.length],qt,Us,$n,el,ue,ae,w,f,N,cn>=Ct.length?Y:"never",Ce,u,an,Vs,Yi);if(Ho&&(Wr=Ho.placedGlyphBoxes,Wr&&Wr.box&&Wr.box.length)){lt=!0,Mt=Ho.shift;break}}return Wr};ft(()=>ci(zi,$e.iconBox,a.WritingMode.horizontal),()=>{const qt=$e.verticalTextBox;return u.allowVerticalPlacement&&!(Pt&&Pt.box&&Pt.box.length)&&Ce.numVerticalGlyphVertices>0&&qt?ci(qt,$e.verticalIconBox,a.WritingMode.vertical):{box:null,offscreen:null}}),Pt&&(lt=Pt.box,We=Pt.offscreen);const ui=ri(Pt&&Pt.box);if(!lt&&this.prevPlacement){const qt=this.prevPlacement.variableOffsets[Ce.crossTileID];qt&&(this.variableOffsets[Ce.crossTileID]=qt,this.markUsedJustification(u,qt.anchor,Ce,ui))}}else{const Ct=(ci,ui)=>{const qt=this.collisionIndex.placeCollisionBox(ci,Y,w,f,N.predicate,Yi);return qt&&qt.box&&qt.box.length&&(this.markUsedOrientation(u,ui,Ce),this.placedOrientations[Ce.crossTileID]=ui),qt};ft(()=>Ct(zi,a.WritingMode.horizontal),()=>{const ci=$e.verticalTextBox;return u.allowVerticalPlacement&&Ce.numVerticalGlyphVertices>0&&ci?Ct(ci,a.WritingMode.vertical):{box:null,offscreen:null}}),ri(Pt&&Pt.box&&Pt.box.length)}}if(Et=Pt,lt=Et&&Et.box&&Et.box.length>0,We=Et&&Et.offscreen,Ce.useRuntimeCollisionCircles){const ri=u.text.placedSymbolArray.get(Ce.centerJustifiedTextSymbolIndex),ft=a.evaluateSizeForFeature(u.textSizeData,D,ri),Ct=d.get("text-padding");kt=this.collisionIndex.placeCollisionCircles(Y,ri,u.lineVertexArray,u.glyphOffsetArray,ft,f,_,y,s,ae,N.predicate,Ce.collisionCircleDiameter,Ct,Yi),kt.circles.length&&kt.collisionDetected&&!s&&a.warnOnce("Collisions detected, but collision boxes are not shown"),lt=ie||kt.circles.length>0&&!kt.collisionDetected,We=We&&kt.offscreen}if($e.iconFeatureIndex&&(yr=$e.iconFeatureIndex),$e.iconBox){const ri=ft=>{const Ct=ge&&Mt?en(ft,Mt.x,Mt.y,ue,ae,this.transform.angle):ft;return this.collisionIndex.placeCollisionBox(Ct,se,w,f,N.predicate,Yi)};xt&&xt.box&&xt.box.length&&$e.verticalIconBox?(li=ri($e.verticalIconBox),dt=li.box.length>0):(li=ri($e.iconBox),dt=li.box.length>0),We=We&&li.offscreen}const Ar=U||Ce.numHorizontalGlyphVertices===0&&Ce.numVerticalGlyphVertices===0,Wo=V||Ce.numIconVertices===0;if(Ar||Wo?Wo?Ar||(dt=dt&<):lt=dt&<:dt=lt=dt&<,lt&&Et&&Et.box&&this.collisionIndex.insertCollisionBox(Et.box,Y,d.get("text-ignore-placement"),u.bucketInstanceId,xt&&xt.box&&or?or:_r,N.ID),dt&&li&&this.collisionIndex.insertCollisionBox(li.box,se,d.get("icon-ignore-placement"),u.bucketInstanceId,yr,N.ID),kt&&(lt&&this.collisionIndex.insertCollisionCircles(kt.circles,Y,d.get("text-ignore-placement"),u.bucketInstanceId,_r,N.ID),s)){const ri=u.bucketInstanceId;let ft=this.collisionCircleArrays[ri];ft===void 0&&(ft=this.collisionCircleArrays[ri]=new fr);for(let Ct=0;Ct<kt.circles.length;Ct+=4)ft.circles.push(kt.circles[Ct+0]),ft.circles.push(kt.circles[Ct+1]),ft.circles.push(kt.circles[Ct+2]),ft.circles.push(kt.collisionDetected?1:0)}if(Ce.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(u.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[Ce.crossTileID]=new Sn(lt||we,dt||me,We||u.justReloaded),n[Ce.crossTileID]=!0};if(_e){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Ce=u.getSortedSymbolIndexes(this.transform.angle);for(let $e=Ce.length-1;$e>=0;--$e){const lt=Ce[$e];Oe(u.symbolInstances.get(lt),u.collisionArrays[lt])}}else for(let Ce=t.symbolInstanceStart;Ce<t.symbolInstanceEnd;Ce++)Oe(u.symbolInstances.get(Ce),u.collisionArrays[Ce]);if(s&&u.bucketInstanceId in this.collisionCircleArrays){const Ce=this.collisionCircleArrays[u.bucketInstanceId];a.invert(Ce.invProjMatrix,f),Ce.viewportMatrix=this.collisionIndex.getViewportMatrix()}u.justReloaded=!1}markUsedJustification(t,n,s,u){let d;d=u===a.WritingMode.vertical?s.verticalPlacedTextSymbolIndex:{left:s.leftJustifiedTextSymbolIndex,center:s.centerJustifiedTextSymbolIndex,right:s.rightJustifiedTextSymbolIndex}[a.getAnchorJustification(n)];const f=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex,s.verticalPlacedTextSymbolIndex];for(const _ of f)_>=0&&(t.text.placedSymbolArray.get(_).crossTileID=d>=0&&_!==d?0:s.crossTileID)}markUsedOrientation(t,n,s){const u=n===a.WritingMode.horizontal||n===a.WritingMode.horizontalOnly?n:0,d=n===a.WritingMode.vertical?n:0,f=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex];for(const _ of f)t.text.placedSymbolArray.get(_).placedOrientation=u;s.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(s.verticalPlacedTextSymbolIndex).placedOrientation=d)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let s=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const u=n?n.symbolFadeChange(t):1,d=n?n.opacities:{},f=n?n.variableOffsets:{},_=n?n.placedOrientations:{};for(const y in this.placements){const w=this.placements[y],I=d[y];I?(this.opacities[y]=new zt(I,u,w.text,w.icon),s=s||w.text!==I.text.placed||w.icon!==I.icon.placed):(this.opacities[y]=new zt(null,u,w.text,w.icon,w.skipFade),s=s||w.text||w.icon)}for(const y in d){const w=d[y];if(!this.opacities[y]){const I=new zt(w,u,!1,!1);I.isHidden()||(this.opacities[y]=I,s=s||w.text.placed||w.icon.placed)}}for(const y in f)this.variableOffsets[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.variableOffsets[y]=f[y]);for(const y in _)this.placedOrientations[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.placedOrientations[y]=_[y]);if(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");s?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n){const s={};for(const u of n){const d=u.getBucket(t);d&&u.latestFeatureIndex&&t.id===d.layerIds[0]&&this.updateBucketOpacities(d,s,u.collisionBoxArray)}}updateBucketOpacities(t,n,s){t.hasTextData()&&t.text.opacityVertexArray.clear(),t.hasIconData()&&t.icon.opacityVertexArray.clear(),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const u=t.layers[0].layout,d=new zt(null,0,!1,!1,!0),f=u.get("text-allow-overlap"),_=u.get("icon-allow-overlap"),y=u.get("text-variable-anchor"),w=u.get("text-rotation-alignment")==="map",I=u.get("text-pitch-alignment")==="map",P=u.get("icon-text-fit")!=="none",D=new zt(null,0,f&&(_||!t.hasIconData()||u.get("icon-optional")),_&&(f||!t.hasTextData()||u.get("text-optional")),!0);!t.collisionArrays&&s&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(s);const N=(U,V,Y)=>{for(let ie=0;ie<V/4;ie++)U.opacityVertexArray.emplaceBack(Y)};for(let U=0;U<t.symbolInstances.length;U++){const V=t.symbolInstances.get(U),{numHorizontalGlyphVertices:Y,numVerticalGlyphVertices:ie,crossTileID:se}=V;let G=this.opacities[se];n[se]?G=d:G||(G=D,this.opacities[se]=G),n[se]=!0;const ue=V.numIconVertices>0,ae=this.placedOrientations[V.crossTileID],ge=ae===a.WritingMode.vertical,_e=ae===a.WritingMode.horizontal||ae===a.WritingMode.horizontalOnly;if(Y>0||ie>0){const we=te(G.text);N(t.text,Y,ge?fe:we),N(t.text,ie,_e?fe:we);const me=G.text.isHidden();[V.rightJustifiedTextSymbolIndex,V.centerJustifiedTextSymbolIndex,V.leftJustifiedTextSymbolIndex].forEach($e=>{$e>=0&&(t.text.placedSymbolArray.get($e).hidden=me||ge?1:0)}),V.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(V.verticalPlacedTextSymbolIndex).hidden=me||_e?1:0);const Oe=this.variableOffsets[V.crossTileID];Oe&&this.markUsedJustification(t,Oe.anchor,V,ae);const Ce=this.placedOrientations[V.crossTileID];Ce&&(this.markUsedJustification(t,"left",V,Ce),this.markUsedOrientation(t,Ce,V))}if(ue){const we=te(G.icon),me=!(P&&V.verticalPlacedIconSymbolIndex&&ge);V.placedIconSymbolIndex>=0&&(N(t.icon,V.numIconVertices,me?we:fe),t.icon.placedSymbolArray.get(V.placedIconSymbolIndex).hidden=G.icon.isHidden()),V.verticalPlacedIconSymbolIndex>=0&&(N(t.icon,V.numVerticalIconVertices,me?fe:we),t.icon.placedSymbolArray.get(V.verticalPlacedIconSymbolIndex).hidden=G.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const we=t.collisionArrays[U];if(we){let me=new a.pointGeometry(0,0);if(we.textBox||we.verticalTextBox){let Ce=!0;if(y){const $e=this.variableOffsets[se];$e?(me=In($e.anchor,$e.width,$e.height,$e.textOffset,$e.textBoxScale),w&&me._rotate(I?this.transform.angle:-this.transform.angle)):Ce=!1}we.textBox&&E(t.textCollisionBox.collisionVertexArray,G.text.placed,!Ce||ge,me.x,me.y),we.verticalTextBox&&E(t.textCollisionBox.collisionVertexArray,G.text.placed,!Ce||_e,me.x,me.y)}const Oe=Boolean(!_e&&we.verticalIconBox);we.iconBox&&E(t.iconCollisionBox.collisionVertexArray,G.icon.placed,Oe,P?me.x:0,P?me.y:0),we.verticalIconBox&&E(t.iconCollisionBox.collisionVertexArray,G.icon.placed,!Oe,P?me.x:0,P?me.y:0)}}}if(t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.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`);if(t.bucketInstanceId in this.collisionCircleArrays){const U=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=U.invProjMatrix,t.placementViewportMatrix=U.viewportMatrix,t.collisionCircleArray=U.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,n){const s=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*s>t}setStale(){this.stale=!0}}function E(l,t,n,s,u){l.emplaceBack(t?1:0,n?1:0,s||0,u||0),l.emplaceBack(t?1:0,n?1:0,s||0,u||0),l.emplaceBack(t?1:0,n?1:0,s||0,u||0),l.emplaceBack(t?1:0,n?1:0,s||0,u||0)}const M=Math.pow(2,25),F=Math.pow(2,24),O=Math.pow(2,17),j=Math.pow(2,16),Q=Math.pow(2,9),H=Math.pow(2,8),X=Math.pow(2,1);function te(l){if(l.opacity===0&&!l.placed)return 0;if(l.opacity===1&&l.placed)return 4294967295;const t=l.placed?1:0,n=Math.floor(127*l.opacity);return n*M+t*F+n*O+t*j+n*Q+t*H+n*X+t}const fe=0;class be{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,n,s,u,d){const f=this._bucketParts;for(;this._currentTileIndex<t.length;)if(n.getBucketParts(f,u,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,d())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,f.sort((_,y)=>_.sortKey-y.sortKey));this._currentPartIndex<f.length;)if(n.placeLayerBucketPart(f[this._currentPartIndex],this._seenCrossTileIDs,s),this._currentPartIndex++,d())return!0;return!1}}class pe{constructor(t,n,s,u,d,f,_,y){this.placement=new $(t,n,f,_,y),this._currentPlacementIndex=s.length-1,this._forceFullPlacement=u,this._showCollisionBoxes=d,this._done=!1}isDone(){return this._done}continuePlacement(t,n,s){const u=a.exported.now(),d=()=>{const f=a.exported.now()-u;return!this._forceFullPlacement&&f>2};for(;this._currentPlacementIndex>=0;){const f=n[t[this._currentPlacementIndex]],_=this.placement.collisionIndex.transform.zoom;if(f.type==="symbol"&&(!f.minzoom||f.minzoom<=_)&&(!f.maxzoom||f.maxzoom>_)){if(this._inProgressLayer||(this._inProgressLayer=new be(f)),this._inProgressLayer.continuePlacement(s[f.source],this.placement,this._showCollisionBoxes,f,d))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Ne=512/a.EXTENT/2;class qe{constructor(t,n,s){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=s;for(let u=0;u<n.length;u++){const d=n.get(u),f=d.key;this.indexedSymbolInstances[f]||(this.indexedSymbolInstances[f]=[]),this.indexedSymbolInstances[f].push({crossTileID:d.crossTileID,coord:this.getScaledCoordinates(d,t)})}}getScaledCoordinates(t,n){const s=Ne/Math.pow(2,n.canonical.z-this.tileID.canonical.z);return{x:Math.floor((n.canonical.x*a.EXTENT+t.anchorX)*s),y:Math.floor((n.canonical.y*a.EXTENT+t.anchorY)*s)}}findMatches(t,n,s){const u=this.tileID.canonical.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z);for(let d=0;d<t.length;d++){const f=t.get(d);if(f.crossTileID)continue;const _=this.indexedSymbolInstances[f.key];if(!_)continue;const y=this.getScaledCoordinates(f,n);for(const w of _)if(Math.abs(w.coord.x-y.x)<=u&&Math.abs(w.coord.y-y.y)<=u&&!s[w.crossTileID]){s[w.crossTileID]=!0,f.crossTileID=w.crossTileID;break}}}}class Be{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Ye{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const s in this.indexes){const u=this.indexes[s],d={};for(const f in u){const _=u[f];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+n),d[_.tileID.key]=_}this.indexes[s]=d}this.lng=t}addBucket(t,n,s){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let d=0;d<n.symbolInstances.length;d++)n.symbolInstances.get(d).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const u=this.usedCrossTileIDs[t.overscaledZ];for(const d in this.indexes){const f=this.indexes[d];if(Number(d)>t.overscaledZ)for(const _ in f){const y=f[_];y.tileID.isChildOf(t)&&y.findMatches(n.symbolInstances,t,u)}else{const _=f[t.scaledTo(Number(d)).key];_&&_.findMatches(n.symbolInstances,t,u)}}for(let d=0;d<n.symbolInstances.length;d++){const f=n.symbolInstances.get(d);f.crossTileID||(f.crossTileID=s.generate(),u[f.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new qe(t,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(t,n){for(const s in n.indexedSymbolInstances)for(const u of n.indexedSymbolInstances[s])delete this.usedCrossTileIDs[t][u.crossTileID]}removeStaleBuckets(t){let n=!1;for(const s in this.indexes){const u=this.indexes[s];for(const d in u)t[u[d].bucketInstanceId]||(this.removeBucketCrossTileIDs(s,u[d]),delete u[d],n=!0)}return n}}class it{constructor(){this.layerIndexes={},this.crossTileIDs=new Be,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,n,s){let u=this.layerIndexes[t.id];u===void 0&&(u=this.layerIndexes[t.id]=new Ye);let d=!1;const f={};u.handleWrapJump(s);for(const _ of n){const y=_.getBucket(t);y&&t.id===y.layerIds[0]&&(y.bucketInstanceId||(y.bucketInstanceId=++this.maxBucketInstanceId),u.addBucket(_.tileID,y,this.crossTileIDs)&&(d=!0),f[y.bucketInstanceId]=!0)}return u.removeStaleBuckets(f)&&(d=!0),d}pruneUnusedLayers(t){const n={};t.forEach(s=>{n[s]=!0});for(const s in this.layerIndexes)n[s]||delete this.layerIndexes[s]}}var wt=a.createLayout([{name:"a_pos",type:"Int16",components:2}]);class nt extends a.Evented{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.renderHistory=[],this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,this.renderHistorySize=t._cache.max,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null;for(const t in this._tiles){const n=this._tiles[t];n.textures.forEach(s=>s.destroy()),n.textures=[]}}update(t,n){this.sourceCache.update(t,n),this._renderableTilesKeys=[];for(const s of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n}))this._renderableTilesKeys.push(s.key),this._tiles[s.key]||(s.posMatrix=new Float64Array(16),a.ortho(s.posMatrix,0,a.EXTENT,0,a.EXTENT,0,1),this._tiles[s.key]=new Dr(s,this.tileSize))}removeOutdated(t){const n={};this.renderHistory=this.renderHistory.filter((s,u)=>this.renderHistory.indexOf(s)===u).slice(0,this.renderHistorySize);for(const s of this._renderableTilesKeys)n[s]=!0;for(const s of this.renderHistory)n[s]=!0;for(const s in this._tiles)n[s]||(this._tiles[s].clearTextures(t),delete this._tiles[s])}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const n={};for(const s of this._renderableTilesKeys){const u=this._tiles[s].tileID;if(u.canonical.equals(t.canonical)){const d=t.clone();d.posMatrix=new Float64Array(16),a.ortho(d.posMatrix,0,a.EXTENT,0,a.EXTENT,0,1),n[s]=d}else if(u.canonical.isChildOf(t.canonical)){const d=t.clone();d.posMatrix=new Float64Array(16);const f=u.canonical.z-t.canonical.z,_=u.canonical.x-(u.canonical.x>>f<<f),y=u.canonical.y-(u.canonical.y>>f<<f),w=a.EXTENT>>f;a.ortho(d.posMatrix,0,w,0,w,0,1),a.translate(d.posMatrix,d.posMatrix,[-_*w,-y*w,0]),n[s]=d}else if(t.canonical.isChildOf(u.canonical)){const d=t.clone();d.posMatrix=new Float64Array(16);const f=t.canonical.z-u.canonical.z,_=t.canonical.x-(t.canonical.x>>f<<f),y=t.canonical.y-(t.canonical.y>>f<<f),w=a.EXTENT>>f;a.ortho(d.posMatrix,0,a.EXTENT,0,a.EXTENT,0,1),a.translate(d.posMatrix,d.posMatrix,[_*w,y*w,0]),a.scale(d.posMatrix,d.posMatrix,[1/2**f,1/2**f,0]),n[s]=d}}return n}getSourceTile(t,n){const s=this.sourceCache._source;let u=t.overscaledZ-this.deltaZoom;if(u>s.maxzoom&&(u=s.maxzoom),u<s.minzoom)return null;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(u).key);let d=this.sourceCache.getTileByID(this._sourceTileCache[t.key]);if((!d||!d.dem)&&n)for(;u>=s.minzoom&&(!d||!d.dem);)d=this.sourceCache.getTileByID(t.scaledTo(u--).key);return d}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(n=>n.timeLoaded>=t)}}class ht{constructor(t,n,s){this.style=t,this.sourceCache=new nt(n),this.options=s,this.exaggeration=typeof s.exaggeration=="number"?s.exaggeration:1,this.elevationOffset=typeof s.elevationOffset=="number"?s.elevationOffset:450,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024,this.clearRerenderCache()}getDEMElevation(t,n,s,u=a.EXTENT){if(!(n>=0&&n<u&&s>=0&&s<u))return this.elevationOffset;let d=0;const f=this.getTerrainData(t);if(f.tile&&f.tile.dem){const _=a.transformMat4$1([],[n/u*a.EXTENT,s/u*a.EXTENT],f.u_terrain_matrix),y=[_[0]*f.tile.dem.dim,_[1]*f.tile.dem.dim],w=[Math.floor(y[0]),Math.floor(y[1])],I=f.tile.dem.get(w[0],w[1]),P=f.tile.dem.get(w[0],w[1]+1),D=f.tile.dem.get(w[0]+1,w[1]),N=f.tile.dem.get(w[0]+1,w[1]+1);d=a.number(a.number(I,P,y[0]-w[0]),a.number(D,N,y[0]-w[0]),y[1]-w[1])}return d}rememberForRerender(t,n){for(const s in this.sourceCache._tiles){const u=this.sourceCache._tiles[s];(u.tileID.equals(n)||u.tileID.isChildOf(n))&&(t===this.sourceCache.sourceCache.id&&(u.timeLoaded=Date.now()),this._rerender[t]=this._rerender[t]||{},this._rerender[t][u.tileID.key]=!0)}}needsRerender(t,n){return this._rerender[t]&&this._rerender[t][n.key]}clearRerenderCache(){this._rerender={}}getElevation(t,n,s,u=a.EXTENT){return(this.getDEMElevation(t,n,s,u)+this.elevationOffset)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){const u=this.style.map.painter.context,d=new a.RGBAImage({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new Me(u,d,u.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new Me(u,new a.RGBAImage({width:1,height:1}),u.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(u.gl.NEAREST,u.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=a.identity([])}const n=this.sourceCache.getSourceTile(t,!0);if(n&&n.dem&&(!n.demTexture||n.needsTerrainPrepare)){const u=this.style.map.painter.context;n.demTexture=this.style.map.painter.getTileTexture(n.dem.stride),n.demTexture?n.demTexture.update(n.dem.getPixels(),{premultiply:!1}):n.demTexture=new Me(u,n.dem.getPixels(),u.gl.RGBA,{premultiply:!1}),n.demTexture.bind(u.gl.NEAREST,u.gl.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}const s=n&&n+n.tileID.key+t.key;if(s&&!this._demMatrixCache[s]){const u=this.sourceCache.sourceCache._source.maxzoom;let d=t.canonical.z-n.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=u?d=t.canonical.z-u:a.warnOnce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const f=t.canonical.x-(t.canonical.x>>d<<d),_=t.canonical.y-(t.canonical.y>>d<<d),y=a.fromScaling(new Float64Array(16),[1/(a.EXTENT<<d),1/(a.EXTENT<<d),0]);a.translate(y,y,[f*a.EXTENT,_*a.EXTENT,0]),this._demMatrixCache[t.key]={matrix:y,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:n&&n.dem&&n.dem.dim||1,u_terrain_matrix:s?this._demMatrixCache[t.key].matrix:this._emptyDemMatrix,u_terrain_unpack:n&&n.dem&&n.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_offset:this.elevationOffset,u_terrain_exaggeration:this.exaggeration,texture:(n&&n.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:n}}getRTTFramebuffer(){const t=this.style.map.painter;if(!this._rttFramebuffer){const n=this.sourceCache.tileSize*this.qualityFactor;this._rttFramebuffer=t.context.createFramebuffer(n,n,!0),this._rttFramebuffer.depthAttachment.set(t.context.createRenderbuffer(t.context.gl.DEPTH_COMPONENT16,n,n))}return this._rttFramebuffer}getFramebuffer(t){const n=this.style.map.painter,s=n.width/devicePixelRatio,u=n.height/devicePixelRatio;return!this._fbo||this._fbo.width===s&&this._fbo.height===u||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new Me(n.context,{width:s,height:u,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new Me(n.context,{width:s,height:u,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=n.context.createFramebuffer(s,u,!0),this._fbo.depthAttachment.set(n.context.createRenderbuffer(n.context.gl.DEPTH_COMPONENT16,s,u))),this._fbo.colorAttachment.set(t==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const t=this.style.map.painter.context;if(this._coordsTexture)return this._coordsTexture;const n=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let d=0,f=0;d<this._coordsTextureSize;d++)for(let _=0;_<this._coordsTextureSize;_++,f+=4)n[f+0]=255&_,n[f+1]=255&d,n[f+2]=_>>8<<4|d>>8,n[f+3]=0;const s=new a.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),u=new Me(t,s,t.gl.RGBA,{premultiply:!1});return u.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=u,u}pointCoordinate(t){const n=new Uint8Array(4),s=this.style.map.painter,u=s.context,d=u.gl;u.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),d.readPixels(t.x,s.height/devicePixelRatio-t.y-1,1,1,d.RGBA,d.UNSIGNED_BYTE,n),u.bindFramebuffer.set(null);const f=n[0]+(n[2]>>4<<8),_=n[1]+((15&n[2])<<8),y=this.coordsIndex[255-n[3]],w=y&&this.sourceCache.getTileByID(y);if(!w)return null;const I=this._coordsTextureSize,P=(1<<w.tileID.canonical.z)*I;return new a.MercatorCoordinate((w.tileID.canonical.x*I+f)/P,(w.tileID.canonical.y*I+_)/P,this.getElevation(w.tileID,f,_,I))}getTerrainMesh(){if(this._mesh)return this._mesh;const t=this.style.map.painter.context,n=new a.PosArray,s=new a.TriangleIndexArray,u=this.meshSize,d=a.EXTENT/u,f=u*u;for(let _=0;_<=u;_++)for(let y=0;y<=u;y++)n.emplaceBack(y*d,_*d);for(let _=0;_<f;_+=u+1)for(let y=0;y<u;y++)s.emplaceBack(y+_,u+y+_+1,u+y+_+2),s.emplaceBack(y+_,u+y+_+2,y+_+1);return this._mesh={indexBuffer:t.createIndexBuffer(s),vertexBuffer:t.createVertexBuffer(n,wt.members),segments:a.SegmentVector.simpleSegment(0,0,n.length,s.length)},this._mesh}getMinMaxElevation(t){const n=this.getTerrainData(t).tile,s={minElevation:null,maxElevation:null};return n&&n.dem&&(s.minElevation=(n.dem.min+this.elevationOffset)*this.exaggeration,s.maxElevation=(n.dem.max+this.elevationOffset)*this.exaggeration),s}}const Tt=(l,t)=>a.emitValidationErrors(l,t&&t.filter(n=>n.identifier!=="source.canvas")),Dt=a.pick(vt,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),ai=a.pick(vt,["setCenter","setZoom","setBearing","setPitch"]),Vt=function(){const l={},t=a.spec.$version;for(const n in a.spec.$root){const s=a.spec.$root[n];if(s.required){let u=null;u=n==="version"?t:s.type==="array"?[]:{},u!=null&&(l[n]=u)}}return l}();class _i extends a.Evented{constructor(t,n={}){super(),this.map=t,this.dispatcher=new Wi(bn(),this),this.imageManager=new Ke,this.imageManager.setEventedParent(this),this.glyphManager=new ct(t._requestManager,n.localIdeographFontFamily),this.lineAtlas=new ur(256,512),this.crossTileSymbolIndex=new it,this._layers={},this._serializedLayers={},this._order=[],this.sourceCaches={},this.zoomHistory=new a.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",a.getReferrer());const s=this;this._rtlTextPluginCallback=_i.registerForPluginStateChange(u=>{s.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:u.pluginStatus,pluginURL:u.pluginURL},(d,f)=>{if(a.triggerPluginCompletionEvent(d),f&&f.every(_=>_))for(const _ in s.sourceCaches)s.sourceCaches[_].reload()})}),this.on("data",u=>{if(u.dataType!=="source"||u.sourceDataType!=="metadata")return;const d=this.sourceCaches[u.sourceId];if(!d)return;const f=d.getSource();if(f&&f.vectorLayerIds)for(const _ in this._layers){const y=this._layers[_];y.source===f.id&&this._validateLayer(y)}})}loadURL(t,n={}){this.fire(new a.Event("dataloading",{dataType:"style"}));const s=typeof n.validate!="boolean"||n.validate,u=this.map._requestManager.transformRequest(t,a.ResourceType.Style);this._request=a.getJSON(u,(d,f)=>{this._request=null,d?this.fire(new a.ErrorEvent(d)):f&&this._load(f,s)})}loadJSON(t,n={}){this.fire(new a.Event("dataloading",{dataType:"style"})),this._request=a.exported.frame(()=>{this._request=null,this._load(t,n.validate!==!1)})}loadEmpty(){this.fire(new a.Event("dataloading",{dataType:"style"})),this._load(Vt,!1)}_load(t,n){if(n&&Tt(this,a.validateStyle(t)))return;this._loaded=!0,this.stylesheet=t;for(const u in t.sources)this.addSource(u,t.sources[u],{validate:!1});t.sprite?this._loadSprite(t.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(t.glyphs);const s=Wn(this.stylesheet.layers);this._order=s.map(u=>u.id),this._layers={},this._serializedLayers={};for(let u of s)u=a.createStyleLayer(u),u.setEventedParent(this,{layer:{id:u.id}}),this._layers[u.id]=u,this._serializedLayers[u.id]=u.serialize();this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new Wt(this.stylesheet.light),this.setTerrain(this.stylesheet.terrain),this.fire(new a.Event("data",{dataType:"style"})),this.fire(new a.Event("style.load"))}_loadSprite(t){this._spriteRequest=function(n,s,u,d){let f,_,y;const w=u>1?"@2x":"";let I=a.getJSON(s.transformRequest(s.normalizeSpriteURL(n,w,".json"),a.ResourceType.SpriteJSON),(N,U)=>{I=null,y||(y=N,f=U,D())}),P=a.getImage(s.transformRequest(s.normalizeSpriteURL(n,w,".png"),a.ResourceType.SpriteImage),(N,U)=>{P=null,y||(y=N,_=U,D())});function D(){if(y)d(y);else if(f&&_){const N=a.exported.getImageData(_),U={};for(const V in f){const{width:Y,height:ie,x:se,y:G,sdf:ue,pixelRatio:ae,stretchX:ge,stretchY:_e,content:we}=f[V],me=new a.RGBAImage({width:Y,height:ie});a.RGBAImage.copy(N,me,{x:se,y:G},{x:0,y:0},{width:Y,height:ie}),U[V]={data:me,pixelRatio:ae,sdf:ue,stretchX:ge,stretchY:_e,content:we}}d(null,U)}}return{cancel(){I&&(I.cancel(),I=null),P&&(P.cancel(),P=null)}}}(t,this.map._requestManager,this.map.getPixelRatio(),(n,s)=>{if(this._spriteRequest=null,n)this.fire(new a.ErrorEvent(n));else if(s)for(const u in s)this.imageManager.addImage(u,s[u]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new a.Event("data",{dataType:"style"}))})}_validateLayer(t){const n=this.sourceCaches[t.source];if(!n)return;const s=t.sourceLayer;if(!s)return;const u=n.getSource();(u.type==="geojson"||u.vectorLayerIds&&u.vectorLayerIds.indexOf(s)===-1)&&this.fire(new a.ErrorEvent(new Error(`Source layer "${s}" does not exist on source "${u.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(t){const n=[];for(const s of t){const u=this._layers[s];u.type!=="custom"&&n.push(u.serialize())}return n}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const n=this._changed;if(this._changed){const u=Object.keys(this._updatedLayers),d=Object.keys(this._removedLayers);(u.length||d.length)&&this._updateWorkerLayers(u,d);for(const f in this._updatedSources){const _=this._updatedSources[f];if(_==="reload")this._reloadSource(f);else{if(_!=="clear")throw new Error(`Invalid action ${_}`);this._clearSource(f)}}this._updateTilesForChangedImages();for(const f in this._updatedPaintProps)this._layers[f].updateTransitions(t);this.light.updateTransitions(t),this._resetUpdates()}const s={};for(const u in this.sourceCaches){const d=this.sourceCaches[u];s[u]=d.used,d.used=!1}for(const u of this._order){const d=this._layers[u];d.recalculate(t,this._availableImages),!d.isHidden(t.zoom)&&d.source&&(this.sourceCaches[d.source].used=!0)}for(const u in s){const d=this.sourceCaches[u];s[u]!==d.used&&d.fire(new a.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:u}))}this.light.recalculate(t),this.z=t.zoom,n&&this.fire(new a.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const n in this.sourceCaches)this.sourceCaches[n].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateWorkerLayers(t,n){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(t),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setTerrain(t){if(this._checkLoaded(),this._terrainDataCallback&&this.off("data",this._terrainDataCallback),this._terrainfreezeElevationCallback&&this.map.off("freezeElevation",this._terrainfreezeElevationCallback),t){const n=this.sourceCaches[t.source];if(!n)throw new Error(`cannot load terrain, because there exists no source with ID: ${t.source}`);this.terrain=new ht(this,n,t),this.map.transform.updateElevation(this.terrain),this._terrainfreezeElevationCallback=s=>{s.freeze?this.map.transform.freezeElevation=!0:(this.map.transform.freezeElevation=!1,this.map.transform.recalculateZoom(this.terrain))},this._terrainDataCallback=s=>{s.tile&&(s.sourceId===t.source?(this.map.transform.updateElevation(this.terrain),this.terrain.rememberForRerender(s.sourceId,s.tile.tileID)):s.source.type==="geojson"&&this.terrain.rememberForRerender(s.sourceId,s.tile.tileID))},this.on("data",this._terrainDataCallback),this.map.on("freezeElevation",this._terrainfreezeElevationCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.map.transform.updateElevation(this.terrain);this.map.fire(new a.Event("terrain",{terrain:t}))}setState(t){if(this._checkLoaded(),Tt(this,a.validateStyle(t)))return!1;(t=a.clone$1(t)).layers=Wn(t.layers);const n=function(u,d){if(!u)return[{command:vt.setStyle,args:[d]}];let f=[];try{if(!oe(u.version,d.version))return[{command:vt.setStyle,args:[d]}];oe(u.center,d.center)||f.push({command:vt.setCenter,args:[d.center]}),oe(u.zoom,d.zoom)||f.push({command:vt.setZoom,args:[d.zoom]}),oe(u.bearing,d.bearing)||f.push({command:vt.setBearing,args:[d.bearing]}),oe(u.pitch,d.pitch)||f.push({command:vt.setPitch,args:[d.pitch]}),oe(u.sprite,d.sprite)||f.push({command:vt.setSprite,args:[d.sprite]}),oe(u.glyphs,d.glyphs)||f.push({command:vt.setGlyphs,args:[d.glyphs]}),oe(u.transition,d.transition)||f.push({command:vt.setTransition,args:[d.transition]}),oe(u.light,d.light)||f.push({command:vt.setLight,args:[d.light]});const _={},y=[];(function(I,P,D,N){let U;for(U in P=P||{},I=I||{})Object.prototype.hasOwnProperty.call(I,U)&&(Object.prototype.hasOwnProperty.call(P,U)||Fr(U,D,N));for(U in P)Object.prototype.hasOwnProperty.call(P,U)&&(Object.prototype.hasOwnProperty.call(I,U)?oe(I[U],P[U])||(I[U].type==="geojson"&&P[U].type==="geojson"&&Hn(I,P,U)?D.push({command:vt.setGeoJSONSourceData,args:[U,P[U].data]}):Or(U,P,D,N)):pr(U,P,D))})(u.sources,d.sources,y,_);const w=[];u.layers&&u.layers.forEach(I=>{_[I.source]?f.push({command:vt.removeLayer,args:[I.id]}):w.push(I)}),f=f.concat(y),function(I,P,D){P=P||[];const N=(I=I||[]).map(Tr),U=P.map(Tr),V=I.reduce(Tn,{}),Y=P.reduce(Tn,{}),ie=N.slice(),se=Object.create(null);let G,ue,ae,ge,_e,we,me;for(G=0,ue=0;G<N.length;G++)ae=N[G],Object.prototype.hasOwnProperty.call(Y,ae)?ue++:(D.push({command:vt.removeLayer,args:[ae]}),ie.splice(ie.indexOf(ae,ue),1));for(G=0,ue=0;G<U.length;G++)ae=U[U.length-1-G],ie[ie.length-1-G]!==ae&&(Object.prototype.hasOwnProperty.call(V,ae)?(D.push({command:vt.removeLayer,args:[ae]}),ie.splice(ie.lastIndexOf(ae,ie.length-ue),1)):ue++,we=ie[ie.length-G],D.push({command:vt.addLayer,args:[Y[ae],we]}),ie.splice(ie.length-G,0,ae),se[ae]=!0);for(G=0;G<U.length;G++)if(ae=U[G],ge=V[ae],_e=Y[ae],!se[ae]&&!oe(ge,_e))if(oe(ge.source,_e.source)&&oe(ge["source-layer"],_e["source-layer"])&&oe(ge.type,_e.type)){for(me in wr(ge.layout,_e.layout,D,ae,null,vt.setLayoutProperty),wr(ge.paint,_e.paint,D,ae,null,vt.setPaintProperty),oe(ge.filter,_e.filter)||D.push({command:vt.setFilter,args:[ae,_e.filter]}),oe(ge.minzoom,_e.minzoom)&&oe(ge.maxzoom,_e.maxzoom)||D.push({command:vt.setLayerZoomRange,args:[ae,_e.minzoom,_e.maxzoom]}),ge)Object.prototype.hasOwnProperty.call(ge,me)&&me!=="layout"&&me!=="paint"&&me!=="filter"&&me!=="metadata"&&me!=="minzoom"&&me!=="maxzoom"&&(me.indexOf("paint.")===0?wr(ge[me],_e[me],D,ae,me.slice(6),vt.setPaintProperty):oe(ge[me],_e[me])||D.push({command:vt.setLayerProperty,args:[ae,me,_e[me]]}));for(me in _e)Object.prototype.hasOwnProperty.call(_e,me)&&!Object.prototype.hasOwnProperty.call(ge,me)&&me!=="layout"&&me!=="paint"&&me!=="filter"&&me!=="metadata"&&me!=="minzoom"&&me!=="maxzoom"&&(me.indexOf("paint.")===0?wr(ge[me],_e[me],D,ae,me.slice(6),vt.setPaintProperty):oe(ge[me],_e[me])||D.push({command:vt.setLayerProperty,args:[ae,me,_e[me]]}))}else D.push({command:vt.removeLayer,args:[ae]}),we=ie[ie.lastIndexOf(ae)+1],D.push({command:vt.addLayer,args:[_e,we]})}(w,d.layers,f)}catch(_){console.warn("Unable to compute style diff:",_),f=[{command:vt.setStyle,args:[d]}]}return f}(this.serialize(),t).filter(u=>!(u.command in ai));if(n.length===0)return!1;const s=n.filter(u=>!(u.command in Dt));if(s.length>0)throw new Error(`Unimplemented: ${s.map(u=>u.command).join(", ")}.`);return n.forEach(u=>{u.command!=="setTransition"&&this[u.command].apply(this,u.args)}),this.stylesheet=t,!0}addImage(t,n){if(this.getImage(t))return this.fire(new a.ErrorEvent(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,n),this._afterImageUpdated(t)}updateImage(t,n){this.imageManager.updateImage(t,n)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new a.ErrorEvent(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("setImages",this._availableImages),this.fire(new a.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,n,s={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(a.validateStyle.source,`sources.${t}`,n,null,s))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const u=this.sourceCaches[t]=new Mi(t,n,this.dispatcher);u.style=this,u.setEventedParent(this,()=>({isSourceLoaded:this.loaded(),source:u.serialize(),sourceId:t})),u.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error("There is no source with this ID");for(const s in this._layers)if(this._layers[s].source===t)return this.fire(new a.ErrorEvent(new Error(`Source "${t}" cannot be removed while layer "${s}" is using it.`)));const n=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],n.fire(new a.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,n){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error(`There is no source with this ID=${t}`);const s=this.sourceCaches[t].getSource();if(s.type!=="geojson")throw new Error(`geojsonSource.type is ${s.type}, which is !== 'geojson`);s.setData(n),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,n,s={}){this._checkLoaded();const u=t.id;if(this.getLayer(u))return void this.fire(new a.ErrorEvent(new Error(`Layer "${u}" already exists on this map.`)));let d;if(t.type==="custom"){if(Tt(this,a.validateCustomStyleLayer(t)))return;d=a.createStyleLayer(t)}else{if(typeof t.source=="object"&&(this.addSource(u,t.source),t=a.clone$1(t),t=a.extend(t,{source:u})),this._validate(a.validateStyle.layer,`layers.${u}`,t,{arrayIndex:-1},s))return;d=a.createStyleLayer(t),this._validateLayer(d),d.setEventedParent(this,{layer:{id:u}}),this._serializedLayers[d.id]=d.serialize()}const f=n?this._order.indexOf(n):this._order.length;if(n&&f===-1)this.fire(new a.ErrorEvent(new Error(`Cannot add layer "${u}" before non-existing layer "${n}".`)));else{if(this._order.splice(f,0,u),this._layerOrderChanged=!0,this._layers[u]=d,this._removedLayers[u]&&d.source&&d.type!=="custom"){const _=this._removedLayers[u];delete this._removedLayers[u],_.type!==d.type?this._updatedSources[d.source]="clear":(this._updatedSources[d.source]="reload",this.sourceCaches[d.source].pause())}this._updateLayer(d),d.onAdd&&d.onAdd(this.map)}}moveLayer(t,n){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new a.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===n)return;const s=this._order.indexOf(t);this._order.splice(s,1);const u=n?this._order.indexOf(n):this._order.length;n&&u===-1?this.fire(new a.ErrorEvent(new Error(`Cannot move layer "${t}" before non-existing layer "${n}".`))):(this._order.splice(u,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const n=this._layers[t];if(!n)return void this.fire(new a.ErrorEvent(new Error(`Cannot remove non-existing layer "${t}".`)));n.setEventedParent(null);const s=this._order.indexOf(t);this._order.splice(s,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=n,delete this._layers[t],delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],n.onRemove&&n.onRemove(this.map)}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,n,s){this._checkLoaded();const u=this.getLayer(t);u?u.minzoom===n&&u.maxzoom===s||(n!=null&&(u.minzoom=n),s!=null&&(u.maxzoom=s),this._updateLayer(u)):this.fire(new a.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,n,s={}){this._checkLoaded();const u=this.getLayer(t);if(u){if(!oe(u.filter,n))return n==null?(u.filter=void 0,void this._updateLayer(u)):void(this._validate(a.validateStyle.filter,`layers.${u.id}.filter`,n,null,s)||(u.filter=a.clone$1(n),this._updateLayer(u)))}else this.fire(new a.ErrorEvent(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return a.clone$1(this.getLayer(t).filter)}setLayoutProperty(t,n,s,u={}){this._checkLoaded();const d=this.getLayer(t);d?oe(d.getLayoutProperty(n),s)||(d.setLayoutProperty(n,s,u),this._updateLayer(d)):this.fire(new a.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,n){const s=this.getLayer(t);if(s)return s.getLayoutProperty(n);this.fire(new a.ErrorEvent(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,s,u={}){this._checkLoaded();const d=this.getLayer(t);d?oe(d.getPaintProperty(n),s)||(d.setPaintProperty(n,s,u)&&this._updateLayer(d),this._changed=!0,this._updatedPaintProps[t]=!0):this.fire(new a.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,n){return this.getLayer(t).getPaintProperty(n)}setFeatureState(t,n){this._checkLoaded();const s=t.source,u=t.sourceLayer,d=this.sourceCaches[s];if(d===void 0)return void this.fire(new a.ErrorEvent(new Error(`The source '${s}' does not exist in the map's style.`)));const f=d.getSource().type;f==="geojson"&&u?this.fire(new a.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):f!=="vector"||u?(t.id===void 0&&this.fire(new a.ErrorEvent(new Error("The feature id parameter must be provided."))),d.setFeatureState(u,t.id,n)):this.fire(new a.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,n){this._checkLoaded();const s=t.source,u=this.sourceCaches[s];if(u===void 0)return void this.fire(new a.ErrorEvent(new Error(`The source '${s}' does not exist in the map's style.`)));const d=u.getSource().type,f=d==="vector"?t.sourceLayer:void 0;d!=="vector"||f?n&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new a.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):u.removeFeatureState(f,t.id,n):this.fire(new a.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const n=t.source,s=t.sourceLayer,u=this.sourceCaches[n];if(u!==void 0)return u.getSource().type!=="vector"||s?(t.id===void 0&&this.fire(new a.ErrorEvent(new Error("The feature id parameter must be provided."))),u.getFeatureState(s,t.id)):void this.fire(new a.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new a.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return a.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){return a.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:a.mapObject(this.sourceCaches,t=>t.serialize()),layers:this._serializeLayers(this._order)},t=>t!==void 0)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.sourceCaches[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._changed=!0}_flattenAndSortRenderedFeatures(t){const n=f=>this._layers[f].type==="fill-extrusion",s={},u=[];for(let f=this._order.length-1;f>=0;f--){const _=this._order[f];if(n(_)){s[_]=f;for(const y of t){const w=y[_];if(w)for(const I of w)u.push(I)}}}u.sort((f,_)=>_.intersectionZ-f.intersectionZ);const d=[];for(let f=this._order.length-1;f>=0;f--){const _=this._order[f];if(n(_))for(let y=u.length-1;y>=0;y--){const w=u[y].feature;if(s[w.layer.id]<f)break;d.push(w),u.pop()}else for(const y of t){const w=y[_];if(w)for(const I of w)d.push(I.feature)}}return d}queryRenderedFeatures(t,n,s){n&&n.filter&&this._validate(a.validateStyle.filter,"queryRenderedFeatures.filter",n.filter,null,n);const u={};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new a.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(const f of n.layers){const _=this._layers[f];if(!_)return this.fire(new a.ErrorEvent(new Error(`The layer '${f}' does not exist in the map's style and cannot be queried for features.`))),[];u[_.source]=!0}}const d=[];n.availableImages=this._availableImages;for(const f in this.sourceCaches)n.layers&&!u[f]||d.push(xn(this.sourceCaches[f],this._layers,this._serializedLayers,t,n,s));return this.placement&&d.push(function(f,_,y,w,I,P,D){const N={},U=P.queryRenderedSymbols(w),V=[];for(const Y of Object.keys(U).map(Number))V.push(D[Y]);V.sort(dr);for(const Y of V){const ie=Y.featureIndex.lookupSymbolFeatures(U[Y.bucketInstanceId],_,Y.bucketIndex,Y.sourceLayerIndex,I.filter,I.layers,I.availableImages,f);for(const se in ie){const G=N[se]=N[se]||[],ue=ie[se];ue.sort((ae,ge)=>{const _e=Y.featureSortOrder;if(_e){const we=_e.indexOf(ae.featureIndex);return _e.indexOf(ge.featureIndex)-we}return ge.featureIndex-ae.featureIndex});for(const ae of ue)G.push(ae)}}for(const Y in N)N[Y].forEach(ie=>{const se=ie.feature,G=y[f[Y].source].getFeatureState(se.layer["source-layer"],se.id);se.source=se.layer.source,se.layer["source-layer"]&&(se.sourceLayer=se.layer["source-layer"]),se.state=G});return N}(this._layers,this._serializedLayers,this.sourceCaches,t,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(d)}querySourceFeatures(t,n){n&&n.filter&&this._validate(a.validateStyle.filter,"querySourceFeatures.filter",n.filter,null,n);const s=this.sourceCaches[t];return s?function(u,d){const f=u.getRenderableIds().map(w=>u.getTileByID(w)),_=[],y={};for(let w=0;w<f.length;w++){const I=f[w],P=I.tileID.canonical.key;y[P]||(y[P]=!0,I.querySourceFeatures(_,d))}return _}(s,n):[]}addSourceType(t,n,s){return _i.getSourceType(t)?s(new Error(`A source type called "${t}" already exists.`)):(_i.setSourceType(t,n),n.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:n.workerSourceURL},s):s(null,null))}getLight(){return this.light.getLight()}setLight(t,n={}){this._checkLoaded();const s=this.light.getLight();let u=!1;for(const f in t)if(!oe(t[f],s[f])){u=!0;break}if(!u)return;const d={now:a.exported.now(),transition:a.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,n),this.light.updateTransitions(d)}_validate(t,n,s,u,d={}){return(!d||d.validate!==!1)&&Tt(this,t.call(a.validateStyle,a.extend({key:n,style:this.serialize(),value:s,styleSpec:a.spec},u)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),a.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const t in this._layers)this._layers[t].setEventedParent(null);for(const t in this.sourceCaches){const n=this.sourceCaches[t];n.setEventedParent(null),n.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(const n in this.sourceCaches)this.sourceCaches[n].update(t,this.terrain)}_generateCollisionBoxes(){for(const t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(t,n,s,u,d=!1){let f=!1,_=!1;const y={};for(const w of this._order){const I=this._layers[w];if(I.type!=="symbol")continue;if(!y[I.source]){const D=this.sourceCaches[I.source];y[I.source]=D.getRenderableIds(!0).map(N=>D.getTileByID(N)).sort((N,U)=>U.tileID.overscaledZ-N.tileID.overscaledZ||(N.tileID.isLessThan(U.tileID)?-1:1))}const P=this.crossTileSymbolIndex.addLayer(I,y[I.source],t.center.lng);f=f||P}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((d=d||this._layerOrderChanged||s===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(a.exported.now(),t.zoom))&&(this.pauseablePlacement=new pe(t,this.terrain,this._order,d,n,s,u,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,y),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(a.exported.now()),_=!0),f&&this.pauseablePlacement.placement.setStale()),_||f)for(const w of this._order){const I=this._layers[w];I.type==="symbol"&&this.placement.updateLayerOpacities(I,y[I.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(a.exported.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,n,s){this.imageManager.getImages(n.icons,s),this._updateTilesForChangedImages();const u=this.sourceCaches[n.source];u&&u.setDependencies(n.tileID.key,n.type,n.icons)}getGlyphs(t,n,s){this.glyphManager.getGlyphs(n.stacks,s)}getResource(t,n,s){return a.makeRequest(n,s)}}_i.getSourceType=function(l){return _n[l]},_i.setSourceType=function(l,t){_n[l]=t},_i.registerForPluginStateChange=a.registerForPluginStateChange;var Cn="attribute vec2 a_pos;uniform mat4 u_matrix;varying vec2 v_texture_pos;varying float v_depth;void main() {v_texture_pos=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);v_depth=gl_Position.z/gl_Position.w;}";const Kn={prelude:Lt(`#ifdef GL_ES
|
|
11
|
+
precision mediump float;
|
|
12
|
+
#else
|
|
13
|
+
#if !defined(lowp)
|
|
14
|
+
#define lowp
|
|
15
|
+
#endif
|
|
16
|
+
#if !defined(mediump)
|
|
17
|
+
#define mediump
|
|
18
|
+
#endif
|
|
19
|
+
#if !defined(highp)
|
|
20
|
+
#define highp
|
|
21
|
+
#endif
|
|
22
|
+
#endif`,`#ifdef GL_ES
|
|
23
|
+
precision highp float;
|
|
24
|
+
#else
|
|
25
|
+
#if !defined(lowp)
|
|
26
|
+
#define lowp
|
|
27
|
+
#endif
|
|
28
|
+
#if !defined(mediump)
|
|
29
|
+
#define mediump
|
|
30
|
+
#endif
|
|
31
|
+
#if !defined(highp)
|
|
32
|
+
#define highp
|
|
33
|
+
#endif
|
|
34
|
+
#endif
|
|
35
|
+
vec2 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
|
|
36
|
+
);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}
|
|
37
|
+
#ifdef TERRAIN3D
|
|
38
|
+
uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_offset;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;
|
|
39
|
+
#endif
|
|
40
|
+
const 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) {
|
|
41
|
+
#ifdef TERRAIN3D
|
|
42
|
+
highp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));
|
|
43
|
+
#else
|
|
44
|
+
return 1.0;
|
|
45
|
+
#endif
|
|
46
|
+
}float calculate_visibility(vec4 pos) {
|
|
47
|
+
#ifdef TERRAIN3D
|
|
48
|
+
vec3 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;
|
|
49
|
+
#else
|
|
50
|
+
return 1.0;
|
|
51
|
+
#endif
|
|
52
|
+
}float ele(vec2 pos) {
|
|
53
|
+
#ifdef TERRAIN3D
|
|
54
|
+
vec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
|
|
55
|
+
#else
|
|
56
|
+
return 0.0;
|
|
57
|
+
#endif
|
|
58
|
+
}float get_elevation(vec2 pos) {
|
|
59
|
+
#ifdef TERRAIN3D
|
|
60
|
+
vec2 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_offset)*u_terrain_exaggeration;
|
|
61
|
+
#else
|
|
62
|
+
return 0.0;
|
|
63
|
+
#endif
|
|
64
|
+
}`),background:Lt(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;
|
|
65
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
66
|
+
gl_FragColor=vec4(1.0);
|
|
67
|
+
#endif
|
|
68
|
+
}`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:Lt(`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;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;
|
|
69
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
70
|
+
gl_FragColor=vec4(1.0);
|
|
71
|
+
#endif
|
|
72
|
+
}`,"uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:Lt(`varying vec3 v_data;varying float v_visibility;
|
|
73
|
+
#pragma mapbox: define highp vec4 color
|
|
74
|
+
#pragma mapbox: define mediump float radius
|
|
75
|
+
#pragma mapbox: define lowp float blur
|
|
76
|
+
#pragma mapbox: define lowp float opacity
|
|
77
|
+
#pragma mapbox: define highp vec4 stroke_color
|
|
78
|
+
#pragma mapbox: define mediump float stroke_width
|
|
79
|
+
#pragma mapbox: define lowp float stroke_opacity
|
|
80
|
+
void main() {
|
|
81
|
+
#pragma mapbox: initialize highp vec4 color
|
|
82
|
+
#pragma mapbox: initialize mediump float radius
|
|
83
|
+
#pragma mapbox: initialize lowp float blur
|
|
84
|
+
#pragma mapbox: initialize lowp float opacity
|
|
85
|
+
#pragma mapbox: initialize highp vec4 stroke_color
|
|
86
|
+
#pragma mapbox: initialize mediump float stroke_width
|
|
87
|
+
#pragma mapbox: initialize lowp float stroke_opacity
|
|
88
|
+
vec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);
|
|
89
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
90
|
+
gl_FragColor=vec4(1.0);
|
|
91
|
+
#endif
|
|
92
|
+
}`,`uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility;
|
|
93
|
+
#pragma mapbox: define highp vec4 color
|
|
94
|
+
#pragma mapbox: define mediump float radius
|
|
95
|
+
#pragma mapbox: define lowp float blur
|
|
96
|
+
#pragma mapbox: define lowp float opacity
|
|
97
|
+
#pragma mapbox: define highp vec4 stroke_color
|
|
98
|
+
#pragma mapbox: define mediump float stroke_width
|
|
99
|
+
#pragma mapbox: define lowp float stroke_opacity
|
|
100
|
+
void main(void) {
|
|
101
|
+
#pragma mapbox: initialize highp vec4 color
|
|
102
|
+
#pragma mapbox: initialize mediump float radius
|
|
103
|
+
#pragma mapbox: initialize lowp float blur
|
|
104
|
+
#pragma mapbox: initialize lowp float opacity
|
|
105
|
+
#pragma mapbox: initialize highp vec4 stroke_color
|
|
106
|
+
#pragma mapbox: initialize mediump float stroke_width
|
|
107
|
+
#pragma mapbox: initialize lowp float stroke_opacity
|
|
108
|
+
vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:Lt("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:Lt(`uniform highp float u_intensity;varying vec2 v_extrude;
|
|
109
|
+
#pragma mapbox: define highp float weight
|
|
110
|
+
#define GAUSS_COEF 0.3989422804014327
|
|
111
|
+
void main() {
|
|
112
|
+
#pragma mapbox: initialize highp float weight
|
|
113
|
+
float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);
|
|
114
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
115
|
+
gl_FragColor=vec4(1.0);
|
|
116
|
+
#endif
|
|
117
|
+
}`,`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;
|
|
118
|
+
#pragma mapbox: define highp float weight
|
|
119
|
+
#pragma mapbox: define mediump float radius
|
|
120
|
+
const highp float ZERO=1.0/255.0/16.0;
|
|
121
|
+
#define GAUSS_COEF 0.3989422804014327
|
|
122
|
+
void main(void) {
|
|
123
|
+
#pragma mapbox: initialize highp float weight
|
|
124
|
+
#pragma mapbox: initialize mediump float radius
|
|
125
|
+
vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}`),heatmapTexture:Lt(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;
|
|
126
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
127
|
+
gl_FragColor=vec4(0.0);
|
|
128
|
+
#endif
|
|
129
|
+
}`,"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:Lt("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:Lt("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:Lt("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"),fill:Lt(`#pragma mapbox: define highp vec4 color
|
|
130
|
+
#pragma mapbox: define lowp float opacity
|
|
131
|
+
void main() {
|
|
132
|
+
#pragma mapbox: initialize highp vec4 color
|
|
133
|
+
#pragma mapbox: initialize lowp float opacity
|
|
134
|
+
gl_FragColor=color*opacity;
|
|
135
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
136
|
+
gl_FragColor=vec4(1.0);
|
|
137
|
+
#endif
|
|
138
|
+
}`,`attribute vec2 a_pos;uniform mat4 u_matrix;
|
|
139
|
+
#pragma mapbox: define highp vec4 color
|
|
140
|
+
#pragma mapbox: define lowp float opacity
|
|
141
|
+
void main() {
|
|
142
|
+
#pragma mapbox: initialize highp vec4 color
|
|
143
|
+
#pragma mapbox: initialize lowp float opacity
|
|
144
|
+
gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:Lt(`varying vec2 v_pos;
|
|
145
|
+
#pragma mapbox: define highp vec4 outline_color
|
|
146
|
+
#pragma mapbox: define lowp float opacity
|
|
147
|
+
void main() {
|
|
148
|
+
#pragma mapbox: initialize highp vec4 outline_color
|
|
149
|
+
#pragma mapbox: initialize lowp float opacity
|
|
150
|
+
float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);
|
|
151
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
152
|
+
gl_FragColor=vec4(1.0);
|
|
153
|
+
#endif
|
|
154
|
+
}`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;
|
|
155
|
+
#pragma mapbox: define highp vec4 outline_color
|
|
156
|
+
#pragma mapbox: define lowp float opacity
|
|
157
|
+
void main() {
|
|
158
|
+
#pragma mapbox: initialize highp vec4 outline_color
|
|
159
|
+
#pragma mapbox: initialize lowp float opacity
|
|
160
|
+
gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:Lt(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
|
|
161
|
+
#pragma mapbox: define lowp float opacity
|
|
162
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
163
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
164
|
+
void main() {
|
|
165
|
+
#pragma mapbox: initialize lowp float opacity
|
|
166
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
167
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
168
|
+
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;
|
|
169
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
170
|
+
gl_FragColor=vec4(1.0);
|
|
171
|
+
#endif
|
|
172
|
+
}`,`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
|
|
173
|
+
#pragma mapbox: define lowp float opacity
|
|
174
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
175
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
176
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
177
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
178
|
+
void main() {
|
|
179
|
+
#pragma mapbox: initialize lowp float opacity
|
|
180
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
181
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
182
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
183
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
184
|
+
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillPattern:Lt(`#ifdef GL_ES
|
|
185
|
+
precision highp float;
|
|
186
|
+
#endif
|
|
187
|
+
uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;
|
|
188
|
+
#pragma mapbox: define lowp float opacity
|
|
189
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
190
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
191
|
+
void main() {
|
|
192
|
+
#pragma mapbox: initialize lowp float opacity
|
|
193
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
194
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
195
|
+
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;
|
|
196
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
197
|
+
gl_FragColor=vec4(1.0);
|
|
198
|
+
#endif
|
|
199
|
+
}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;
|
|
200
|
+
#pragma mapbox: define lowp float opacity
|
|
201
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
202
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
203
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
204
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
205
|
+
void main() {
|
|
206
|
+
#pragma mapbox: initialize lowp float opacity
|
|
207
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
208
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
209
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
210
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
211
|
+
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:Lt(`varying vec4 v_color;void main() {gl_FragColor=v_color;
|
|
212
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
213
|
+
gl_FragColor=vec4(1.0);
|
|
214
|
+
#endif
|
|
215
|
+
}`,`uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;
|
|
216
|
+
#ifdef TERRAIN3D
|
|
217
|
+
attribute vec2 a_centroid;
|
|
218
|
+
#endif
|
|
219
|
+
varying vec4 v_color;
|
|
220
|
+
#pragma mapbox: define highp float base
|
|
221
|
+
#pragma mapbox: define highp float height
|
|
222
|
+
#pragma mapbox: define highp vec4 color
|
|
223
|
+
void main() {
|
|
224
|
+
#pragma mapbox: initialize highp float base
|
|
225
|
+
#pragma mapbox: initialize highp float height
|
|
226
|
+
#pragma mapbox: initialize highp vec4 color
|
|
227
|
+
vec3 normal=a_normal_ed.xyz;
|
|
228
|
+
#ifdef TERRAIN3D
|
|
229
|
+
float baseDelta=10.0;float ele=get_elevation(a_centroid);
|
|
230
|
+
#else
|
|
231
|
+
float baseDelta=0.0;float ele=0.0;
|
|
232
|
+
#endif
|
|
233
|
+
base=max(0.0,ele+base-baseDelta);height=max(0.0,ele+height);float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:Lt(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
|
|
234
|
+
#pragma mapbox: define lowp float base
|
|
235
|
+
#pragma mapbox: define lowp float height
|
|
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
|
|
240
|
+
void main() {
|
|
241
|
+
#pragma mapbox: initialize lowp float base
|
|
242
|
+
#pragma mapbox: initialize lowp float height
|
|
243
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
244
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
245
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
246
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
247
|
+
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;
|
|
248
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
249
|
+
gl_FragColor=vec4(1.0);
|
|
250
|
+
#endif
|
|
251
|
+
}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;
|
|
252
|
+
#ifdef TERRAIN3D
|
|
253
|
+
attribute vec2 a_centroid;
|
|
254
|
+
#endif
|
|
255
|
+
varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
|
|
256
|
+
#pragma mapbox: define lowp float base
|
|
257
|
+
#pragma mapbox: define lowp float height
|
|
258
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
259
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
260
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
261
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
262
|
+
void main() {
|
|
263
|
+
#pragma mapbox: initialize lowp float base
|
|
264
|
+
#pragma mapbox: initialize lowp float height
|
|
265
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
266
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
267
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
268
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
269
|
+
vec2 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;
|
|
270
|
+
#ifdef TERRAIN3D
|
|
271
|
+
float baseDelta=10.0;float ele=get_elevation(a_centroid);
|
|
272
|
+
#else
|
|
273
|
+
float baseDelta=0.0;float ele=0.0;
|
|
274
|
+
#endif
|
|
275
|
+
base=max(0.0,ele+base-baseDelta);height=max(0.0,ele+height);float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
|
|
276
|
+
? a_pos
|
|
277
|
+
: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:Lt(`#ifdef GL_ES
|
|
278
|
+
precision highp float;
|
|
279
|
+
#endif
|
|
280
|
+
uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);
|
|
281
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
282
|
+
gl_FragColor=vec4(1.0);
|
|
283
|
+
#endif
|
|
284
|
+
}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:Lt(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;
|
|
285
|
+
#define PI 3.141592653589793
|
|
286
|
+
void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;
|
|
287
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
288
|
+
gl_FragColor=vec4(1.0);
|
|
289
|
+
#endif
|
|
290
|
+
}`,"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:Lt(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;
|
|
291
|
+
#pragma mapbox: define highp vec4 color
|
|
292
|
+
#pragma mapbox: define lowp float blur
|
|
293
|
+
#pragma mapbox: define lowp float opacity
|
|
294
|
+
void main() {
|
|
295
|
+
#pragma mapbox: initialize highp vec4 color
|
|
296
|
+
#pragma mapbox: initialize lowp float blur
|
|
297
|
+
#pragma mapbox: initialize lowp float opacity
|
|
298
|
+
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);gl_FragColor=color*(alpha*opacity);
|
|
299
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
300
|
+
gl_FragColor=vec4(1.0);
|
|
301
|
+
#endif
|
|
302
|
+
}`,`
|
|
303
|
+
#define scale 0.015873016
|
|
304
|
+
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;
|
|
305
|
+
#pragma mapbox: define highp vec4 color
|
|
306
|
+
#pragma mapbox: define lowp float blur
|
|
307
|
+
#pragma mapbox: define lowp float opacity
|
|
308
|
+
#pragma mapbox: define mediump float gapwidth
|
|
309
|
+
#pragma mapbox: define lowp float offset
|
|
310
|
+
#pragma mapbox: define mediump float width
|
|
311
|
+
void main() {
|
|
312
|
+
#pragma mapbox: initialize highp vec4 color
|
|
313
|
+
#pragma mapbox: initialize lowp float blur
|
|
314
|
+
#pragma mapbox: initialize lowp float opacity
|
|
315
|
+
#pragma mapbox: initialize mediump float gapwidth
|
|
316
|
+
#pragma mapbox: initialize lowp float offset
|
|
317
|
+
#pragma mapbox: initialize mediump float width
|
|
318
|
+
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
|
|
319
|
+
#ifdef TERRAIN3D
|
|
320
|
+
v_gamma_scale=1.0;
|
|
321
|
+
#else
|
|
322
|
+
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|
323
|
+
#endif
|
|
324
|
+
v_width2=vec2(outset,inset);}`),lineGradient:Lt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;
|
|
325
|
+
#pragma mapbox: define lowp float blur
|
|
326
|
+
#pragma mapbox: define lowp float opacity
|
|
327
|
+
void main() {
|
|
328
|
+
#pragma mapbox: initialize lowp float blur
|
|
329
|
+
#pragma mapbox: initialize lowp float opacity
|
|
330
|
+
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);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);
|
|
331
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
332
|
+
gl_FragColor=vec4(1.0);
|
|
333
|
+
#endif
|
|
334
|
+
}`,`
|
|
335
|
+
#define scale 0.015873016
|
|
336
|
+
attribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;
|
|
337
|
+
#pragma mapbox: define lowp float blur
|
|
338
|
+
#pragma mapbox: define lowp float opacity
|
|
339
|
+
#pragma mapbox: define mediump float gapwidth
|
|
340
|
+
#pragma mapbox: define lowp float offset
|
|
341
|
+
#pragma mapbox: define mediump float width
|
|
342
|
+
void main() {
|
|
343
|
+
#pragma mapbox: initialize lowp float blur
|
|
344
|
+
#pragma mapbox: initialize lowp float opacity
|
|
345
|
+
#pragma mapbox: initialize mediump float gapwidth
|
|
346
|
+
#pragma mapbox: initialize lowp float offset
|
|
347
|
+
#pragma mapbox: initialize mediump float width
|
|
348
|
+
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
|
|
349
|
+
#ifdef TERRAIN3D
|
|
350
|
+
v_gamma_scale=1.0;
|
|
351
|
+
#else
|
|
352
|
+
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|
353
|
+
#endif
|
|
354
|
+
v_width2=vec2(outset,inset);}`),linePattern:Lt(`#ifdef GL_ES
|
|
355
|
+
precision highp float;
|
|
356
|
+
#endif
|
|
357
|
+
uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
|
|
358
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
359
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
360
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
361
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
362
|
+
#pragma mapbox: define lowp float blur
|
|
363
|
+
#pragma mapbox: define lowp float opacity
|
|
364
|
+
void main() {
|
|
365
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
366
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
367
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
368
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
369
|
+
#pragma mapbox: initialize lowp float blur
|
|
370
|
+
#pragma mapbox: initialize lowp float opacity
|
|
371
|
+
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;
|
|
372
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
373
|
+
gl_FragColor=vec4(1.0);
|
|
374
|
+
#endif
|
|
375
|
+
}`,`
|
|
376
|
+
#define scale 0.015873016
|
|
377
|
+
#define LINE_DISTANCE_SCALE 2.0
|
|
378
|
+
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
|
|
379
|
+
#pragma mapbox: define lowp float blur
|
|
380
|
+
#pragma mapbox: define lowp float opacity
|
|
381
|
+
#pragma mapbox: define lowp float offset
|
|
382
|
+
#pragma mapbox: define mediump float gapwidth
|
|
383
|
+
#pragma mapbox: define mediump float width
|
|
384
|
+
#pragma mapbox: define lowp float floorwidth
|
|
385
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
386
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
387
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
388
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
389
|
+
void main() {
|
|
390
|
+
#pragma mapbox: initialize lowp float blur
|
|
391
|
+
#pragma mapbox: initialize lowp float opacity
|
|
392
|
+
#pragma mapbox: initialize lowp float offset
|
|
393
|
+
#pragma mapbox: initialize mediump float gapwidth
|
|
394
|
+
#pragma mapbox: initialize mediump float width
|
|
395
|
+
#pragma mapbox: initialize lowp float floorwidth
|
|
396
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
397
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
398
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
399
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
400
|
+
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
|
|
401
|
+
#ifdef TERRAIN3D
|
|
402
|
+
v_gamma_scale=1.0;
|
|
403
|
+
#else
|
|
404
|
+
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|
405
|
+
#endif
|
|
406
|
+
v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:Lt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
|
|
407
|
+
#pragma mapbox: define highp vec4 color
|
|
408
|
+
#pragma mapbox: define lowp float blur
|
|
409
|
+
#pragma mapbox: define lowp float opacity
|
|
410
|
+
#pragma mapbox: define mediump float width
|
|
411
|
+
#pragma mapbox: define lowp float floorwidth
|
|
412
|
+
void 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 width
|
|
417
|
+
#pragma mapbox: initialize lowp float floorwidth
|
|
418
|
+
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 sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);
|
|
419
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
420
|
+
gl_FragColor=vec4(1.0);
|
|
421
|
+
#endif
|
|
422
|
+
}`,`
|
|
423
|
+
#define scale 0.015873016
|
|
424
|
+
#define LINE_DISTANCE_SCALE 2.0
|
|
425
|
+
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
|
|
426
|
+
#pragma mapbox: define highp vec4 color
|
|
427
|
+
#pragma mapbox: define lowp float blur
|
|
428
|
+
#pragma mapbox: define lowp float opacity
|
|
429
|
+
#pragma mapbox: define mediump float gapwidth
|
|
430
|
+
#pragma mapbox: define lowp float offset
|
|
431
|
+
#pragma mapbox: define mediump float width
|
|
432
|
+
#pragma mapbox: define lowp float floorwidth
|
|
433
|
+
void main() {
|
|
434
|
+
#pragma mapbox: initialize highp vec4 color
|
|
435
|
+
#pragma mapbox: initialize lowp float blur
|
|
436
|
+
#pragma mapbox: initialize lowp float opacity
|
|
437
|
+
#pragma mapbox: initialize mediump float gapwidth
|
|
438
|
+
#pragma mapbox: initialize lowp float offset
|
|
439
|
+
#pragma mapbox: initialize mediump float width
|
|
440
|
+
#pragma mapbox: initialize lowp float floorwidth
|
|
441
|
+
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
|
|
442
|
+
#ifdef TERRAIN3D
|
|
443
|
+
v_gamma_scale=1.0;
|
|
444
|
+
#else
|
|
445
|
+
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|
446
|
+
#endif
|
|
447
|
+
v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:Lt(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
|
|
448
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
449
|
+
gl_FragColor=vec4(1.0);
|
|
450
|
+
#endif
|
|
451
|
+
}`,"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:Lt(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;
|
|
452
|
+
#pragma mapbox: define lowp float opacity
|
|
453
|
+
void main() {
|
|
454
|
+
#pragma mapbox: initialize lowp float opacity
|
|
455
|
+
lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;
|
|
456
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
457
|
+
gl_FragColor=vec4(1.0);
|
|
458
|
+
#endif
|
|
459
|
+
}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;
|
|
460
|
+
#pragma mapbox: define lowp float opacity
|
|
461
|
+
void main() {
|
|
462
|
+
#pragma mapbox: initialize lowp float opacity
|
|
463
|
+
vec2 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;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|
464
|
+
camera_to_anchor_distance/u_camera_to_center_distance :
|
|
465
|
+
u_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=u_matrix*vec4(a_pos+vec2(1,0),ele,1);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=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:Lt(`#define SDF_PX 8.0
|
|
466
|
+
uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;
|
|
467
|
+
#pragma mapbox: define highp vec4 fill_color
|
|
468
|
+
#pragma mapbox: define highp vec4 halo_color
|
|
469
|
+
#pragma mapbox: define lowp float opacity
|
|
470
|
+
#pragma mapbox: define lowp float halo_width
|
|
471
|
+
#pragma mapbox: define lowp float halo_blur
|
|
472
|
+
void main() {
|
|
473
|
+
#pragma mapbox: initialize highp vec4 fill_color
|
|
474
|
+
#pragma mapbox: initialize highp vec4 halo_color
|
|
475
|
+
#pragma mapbox: initialize lowp float opacity
|
|
476
|
+
#pragma mapbox: initialize lowp float halo_width
|
|
477
|
+
#pragma mapbox: initialize lowp float halo_blur
|
|
478
|
+
float 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 buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);
|
|
479
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
480
|
+
gl_FragColor=vec4(1.0);
|
|
481
|
+
#endif
|
|
482
|
+
}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform 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;varying vec2 v_data0;varying vec3 v_data1;
|
|
483
|
+
#pragma mapbox: define highp vec4 fill_color
|
|
484
|
+
#pragma mapbox: define highp vec4 halo_color
|
|
485
|
+
#pragma mapbox: define lowp float opacity
|
|
486
|
+
#pragma mapbox: define lowp float halo_width
|
|
487
|
+
#pragma mapbox: define lowp float halo_blur
|
|
488
|
+
void main() {
|
|
489
|
+
#pragma mapbox: initialize highp vec4 fill_color
|
|
490
|
+
#pragma mapbox: initialize highp vec4 halo_color
|
|
491
|
+
#pragma mapbox: initialize lowp float opacity
|
|
492
|
+
#pragma mapbox: initialize lowp float halo_width
|
|
493
|
+
#pragma mapbox: initialize lowp float halo_blur
|
|
494
|
+
vec2 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;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|
495
|
+
camera_to_anchor_distance/u_camera_to_center_distance :
|
|
496
|
+
u_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=u_matrix*vec4(a_pos+vec2(1,0),ele,1);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=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;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:Lt(`#define SDF_PX 8.0
|
|
497
|
+
#define SDF 1.0
|
|
498
|
+
#define ICON 0.0
|
|
499
|
+
uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;
|
|
500
|
+
#pragma mapbox: define highp vec4 fill_color
|
|
501
|
+
#pragma mapbox: define highp vec4 halo_color
|
|
502
|
+
#pragma mapbox: define lowp float opacity
|
|
503
|
+
#pragma mapbox: define lowp float halo_width
|
|
504
|
+
#pragma mapbox: define lowp float halo_blur
|
|
505
|
+
void main() {
|
|
506
|
+
#pragma mapbox: initialize highp vec4 fill_color
|
|
507
|
+
#pragma mapbox: initialize highp vec4 halo_color
|
|
508
|
+
#pragma mapbox: initialize lowp float opacity
|
|
509
|
+
#pragma mapbox: initialize lowp float halo_width
|
|
510
|
+
#pragma mapbox: initialize lowp float halo_blur
|
|
511
|
+
float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;
|
|
512
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
513
|
+
gl_FragColor=vec4(1.0);
|
|
514
|
+
#endif
|
|
515
|
+
return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);
|
|
516
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
517
|
+
gl_FragColor=vec4(1.0);
|
|
518
|
+
#endif
|
|
519
|
+
}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;
|
|
520
|
+
#pragma mapbox: define highp vec4 fill_color
|
|
521
|
+
#pragma mapbox: define highp vec4 halo_color
|
|
522
|
+
#pragma mapbox: define lowp float opacity
|
|
523
|
+
#pragma mapbox: define lowp float halo_width
|
|
524
|
+
#pragma mapbox: define lowp float halo_blur
|
|
525
|
+
void main() {
|
|
526
|
+
#pragma mapbox: initialize highp vec4 fill_color
|
|
527
|
+
#pragma mapbox: initialize highp vec4 halo_color
|
|
528
|
+
#pragma mapbox: initialize lowp float opacity
|
|
529
|
+
#pragma mapbox: initialize lowp float halo_width
|
|
530
|
+
#pragma mapbox: initialize lowp float halo_blur
|
|
531
|
+
vec2 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;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|
532
|
+
camera_to_anchor_distance/u_camera_to_center_distance :
|
|
533
|
+
u_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=u_matrix*vec4(a_pos+vec2(1,0),ele,1);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=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;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:Lt("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",Cn),terrainDepth:Lt("varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}",Cn),terrainCoords:Lt("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",Cn)};function Lt(l,t){const n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,s=t.match(/attribute ([\w]+) ([\w]+)/g),u=l.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),d=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),f=d?d.concat(u):u,_={};return{fragmentSource:l=l.replace(n,(y,w,I,P,D)=>(_[D]=!0,w==="define"?`
|
|
534
|
+
#ifndef HAS_UNIFORM_u_${D}
|
|
535
|
+
varying ${I} ${P} ${D};
|
|
536
|
+
#else
|
|
537
|
+
uniform ${I} ${P} u_${D};
|
|
538
|
+
#endif
|
|
539
|
+
`:`
|
|
540
|
+
#ifdef HAS_UNIFORM_u_${D}
|
|
541
|
+
${I} ${P} ${D} = u_${D};
|
|
542
|
+
#endif
|
|
543
|
+
`)),vertexSource:t=t.replace(n,(y,w,I,P,D)=>{const N=P==="float"?"vec2":"vec4",U=D.match(/color/)?"color":N;return _[D]?w==="define"?`
|
|
544
|
+
#ifndef HAS_UNIFORM_u_${D}
|
|
545
|
+
uniform lowp float u_${D}_t;
|
|
546
|
+
attribute ${I} ${N} a_${D};
|
|
547
|
+
varying ${I} ${P} ${D};
|
|
548
|
+
#else
|
|
549
|
+
uniform ${I} ${P} u_${D};
|
|
550
|
+
#endif
|
|
551
|
+
`:U==="vec4"?`
|
|
552
|
+
#ifndef HAS_UNIFORM_u_${D}
|
|
553
|
+
${D} = a_${D};
|
|
554
|
+
#else
|
|
555
|
+
${I} ${P} ${D} = u_${D};
|
|
556
|
+
#endif
|
|
557
|
+
`:`
|
|
558
|
+
#ifndef HAS_UNIFORM_u_${D}
|
|
559
|
+
${D} = unpack_mix_${U}(a_${D}, u_${D}_t);
|
|
560
|
+
#else
|
|
561
|
+
${I} ${P} ${D} = u_${D};
|
|
562
|
+
#endif
|
|
563
|
+
`:w==="define"?`
|
|
564
|
+
#ifndef HAS_UNIFORM_u_${D}
|
|
565
|
+
uniform lowp float u_${D}_t;
|
|
566
|
+
attribute ${I} ${N} a_${D};
|
|
567
|
+
#else
|
|
568
|
+
uniform ${I} ${P} u_${D};
|
|
569
|
+
#endif
|
|
570
|
+
`:U==="vec4"?`
|
|
571
|
+
#ifndef HAS_UNIFORM_u_${D}
|
|
572
|
+
${I} ${P} ${D} = a_${D};
|
|
573
|
+
#else
|
|
574
|
+
${I} ${P} ${D} = u_${D};
|
|
575
|
+
#endif
|
|
576
|
+
`:`
|
|
577
|
+
#ifndef HAS_UNIFORM_u_${D}
|
|
578
|
+
${I} ${P} ${D} = unpack_mix_${U}(a_${D}, u_${D}_t);
|
|
579
|
+
#else
|
|
580
|
+
${I} ${P} ${D} = u_${D};
|
|
581
|
+
#endif
|
|
582
|
+
`}),staticAttributes:s,staticUniforms:f}}class ls{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,n,s,u,d,f,_,y,w){this.context=t;let I=this.boundPaintVertexBuffers.length!==u.length;for(let P=0;!I&&P<u.length;P++)this.boundPaintVertexBuffers[P]!==u[P]&&(I=!0);t.extVertexArrayObject&&this.vao&&this.boundProgram===n&&this.boundLayoutVertexBuffer===s&&!I&&this.boundIndexBuffer===d&&this.boundVertexOffset===f&&this.boundDynamicVertexBuffer===_&&this.boundDynamicVertexBuffer2===y&&this.boundDynamicVertexBuffer3===w?(t.bindVertexArrayOES.set(this.vao),_&&_.bind(),d&&d.dynamicDraw&&d.bind(),y&&y.bind(),w&&w.bind()):this.freshBind(n,s,u,d,f,_,y,w)}freshBind(t,n,s,u,d,f,_,y){let w;const I=t.numAttributes,P=this.context,D=P.gl;if(P.extVertexArrayObject)this.vao&&this.destroy(),this.vao=P.extVertexArrayObject.createVertexArrayOES(),P.bindVertexArrayOES.set(this.vao),w=0,this.boundProgram=t,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=s,this.boundIndexBuffer=u,this.boundVertexOffset=d,this.boundDynamicVertexBuffer=f,this.boundDynamicVertexBuffer2=_,this.boundDynamicVertexBuffer3=y;else{w=P.currentNumAttributes||0;for(let N=I;N<w;N++)D.disableVertexAttribArray(N)}n.enableAttributes(D,t);for(const N of s)N.enableAttributes(D,t);f&&f.enableAttributes(D,t),_&&_.enableAttributes(D,t),y&&y.enableAttributes(D,t),n.bind(),n.setVertexAttribPointers(D,t,d);for(const N of s)N.bind(),N.setVertexAttribPointers(D,t,d);f&&(f.bind(),f.setVertexAttribPointers(D,t,d)),u&&u.bind(),_&&(_.bind(),_.setVertexAttribPointers(D,t,d)),y&&(y.bind(),y.setVertexAttribPointers(D,t,d)),P.currentNumAttributes=I}destroy(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)}}function cs(l){const t=[];for(let n=0;n<l.length;n++){if(l[n]===null)continue;const s=l[n].split(" ");t.push(s.pop())}return t}class ga{constructor(t,n,s,u,d,f,_){const y=t.gl;this.program=y.createProgram();const w=cs(s.staticAttributes),I=u?u.getBinderAttributes():[],P=w.concat(I),D=Kn.prelude.staticUniforms?cs(Kn.prelude.staticUniforms):[],N=s.staticUniforms?cs(s.staticUniforms):[],U=u?u.getBinderUniforms():[],V=D.concat(N).concat(U),Y=[];for(const _e of V)Y.indexOf(_e)<0&&Y.push(_e);const ie=u?u.defines():[];f&&ie.push("#define OVERDRAW_INSPECTOR;"),_&&ie.push("#define TERRAIN3D;");const se=ie.concat(Kn.prelude.fragmentSource,s.fragmentSource).join(`
|
|
583
|
+
`),G=ie.concat(Kn.prelude.vertexSource,s.vertexSource).join(`
|
|
584
|
+
`),ue=y.createShader(y.FRAGMENT_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);y.shaderSource(ue,se),y.compileShader(ue),y.attachShader(this.program,ue);const ae=y.createShader(y.VERTEX_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);y.shaderSource(ae,G),y.compileShader(ae),y.attachShader(this.program,ae),this.attributes={};const ge={};this.numAttributes=P.length;for(let _e=0;_e<this.numAttributes;_e++)P[_e]&&(y.bindAttribLocation(this.program,_e,P[_e]),this.attributes[P[_e]]=_e);y.linkProgram(this.program),y.deleteShader(ae),y.deleteShader(ue);for(let _e=0;_e<Y.length;_e++){const we=Y[_e];if(we&&!ge[we]){const me=y.getUniformLocation(this.program,we);me&&(ge[we]=me)}}this.fixedUniforms=d(t,ge),this.terrainUniforms=((_e,we)=>({u_depth:new a.Uniform1i(_e,we.u_depth),u_terrain:new a.Uniform1i(_e,we.u_terrain),u_terrain_dim:new a.Uniform1f(_e,we.u_terrain_dim),u_terrain_matrix:new a.UniformMatrix4f(_e,we.u_terrain_matrix),u_terrain_unpack:new a.Uniform4f(_e,we.u_terrain_unpack),u_terrain_offset:new a.Uniform1f(_e,we.u_terrain_offset),u_terrain_exaggeration:new a.Uniform1f(_e,we.u_terrain_exaggeration)}))(t,ge),this.binderUniforms=u?u.getUniforms(t,ge):[]}draw(t,n,s,u,d,f,_,y,w,I,P,D,N,U,V,Y,ie,se){const G=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(s),t.setStencilMode(u),t.setColorMode(d),t.setCullFace(f),y){t.activeTexture.set(G.TEXTURE2),G.bindTexture(G.TEXTURE_2D,y.depthTexture),t.activeTexture.set(G.TEXTURE3),G.bindTexture(G.TEXTURE_2D,y.texture);for(const ae in this.terrainUniforms)this.terrainUniforms[ae].set(y[ae])}for(const ae in this.fixedUniforms)this.fixedUniforms[ae].set(_[ae]);V&&V.setUniforms(t,this.binderUniforms,N,{zoom:U});let ue=0;switch(n){case G.LINES:ue=2;break;case G.TRIANGLES:ue=3;break;case G.LINE_STRIP:ue=1}for(const ae of D.get()){const ge=ae.vaos||(ae.vaos={});(ge[w]||(ge[w]=new ls)).bind(t,this,I,V?V.getPaintVertexBuffers():[],P,ae.vertexOffset,Y,ie,se),G.drawElements(n,ae.primitiveLength*ue,G.UNSIGNED_SHORT,ae.primitiveOffset*ue*2)}}}function _a(l,t,n){const s=1/Yt(n,1,t.transform.tileZoom),u=Math.pow(2,n.tileID.overscaledZ),d=n.tileSize*Math.pow(2,t.transform.tileZoom)/u,f=d*(n.tileID.canonical.x+n.tileID.wrap*u),_=d*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[s,l.fromScale,l.toScale],u_fade:l.t,u_pixel_coord_upper:[f>>16,_>>16],u_pixel_coord_lower:[65535&f,65535&_]}}const us=(l,t,n,s)=>{const u=t.style.light,d=u.properties.get("position"),f=[d.x,d.y,d.z],_=a.create$1();u.properties.get("anchor")==="viewport"&&a.fromRotation(_,-t.transform.angle),a.transformMat3(f,f,_);const y=u.properties.get("color");return{u_matrix:l,u_lightpos:f,u_lightintensity:u.properties.get("intensity"),u_lightcolor:[y.r,y.g,y.b],u_vertical_gradient:+n,u_opacity:s}},Fl=(l,t,n,s,u,d,f)=>a.extend(us(l,t,n,s),_a(d,t,f),{u_height_factor:-Math.pow(2,u.overscaledZ)/f.tileSize/8}),Mo=l=>({u_matrix:l}),hs=(l,t,n,s)=>a.extend(Mo(l),_a(n,t,s)),ya=(l,t)=>({u_matrix:l,u_world:t}),xa=(l,t,n,s,u)=>a.extend(hs(l,t,n,s),{u_world:u}),va=(l,t,n,s)=>{const u=l.transform;let d,f;if(s.paint.get("circle-pitch-alignment")==="map"){const _=Yt(n,1,u.zoom);d=!0,f=[_,_]}else d=!1,f=u.pixelsToGLUnits;return{u_camera_to_center_distance:u.cameraToCenterDistance,u_scale_with_map:+(s.paint.get("circle-pitch-scale")==="map"),u_matrix:l.translatePosMatrix(t.posMatrix,n,s.paint.get("circle-translate"),s.paint.get("circle-translate-anchor")),u_pitch_with_map:+d,u_device_pixel_ratio:l.pixelRatio,u_extrude_scale:f}},tn=(l,t,n)=>{const s=Yt(n,1,t.zoom),u=Math.pow(2,t.zoom-n.tileID.overscaledZ),d=n.tileID.overscaleFactor();return{u_matrix:l,u_camera_to_center_distance:t.cameraToCenterDistance,u_pixels_to_tile_units:s,u_extrude_scale:[t.pixelsToGLUnits[0]/(s*u),t.pixelsToGLUnits[1]/(s*u)],u_overscale_factor:d}},Jn=(l,t,n=1)=>({u_matrix:l,u_color:t,u_overlay:0,u_overlay_scale:n}),An=l=>({u_matrix:l}),Po=(l,t,n,s)=>({u_matrix:l,u_extrude_scale:Yt(t,1,n),u_intensity:s});function zo(l,t){const n=Math.pow(2,t.canonical.z),s=t.canonical.y;return[new a.MercatorCoordinate(0,s/n).toLngLat().lat,new a.MercatorCoordinate(0,(s+1)/n).toLngLat().lat]}const Mn=(l,t,n,s)=>{const u=l.transform;return{u_matrix:Qn(l,t,n,s),u_ratio:1/Yt(t,1,u.zoom),u_device_pixel_ratio:l.pixelRatio,u_units_to_pixels:[1/u.pixelsToGLUnits[0],1/u.pixelsToGLUnits[1]]}},ds=(l,t,n,s,u)=>a.extend(Mn(l,t,n,u),{u_image:0,u_image_height:s}),ko=(l,t,n,s,u)=>{const d=l.transform,f=Nt(t,d);return{u_matrix:Qn(l,t,n,u),u_texsize:t.imageAtlasTexture.size,u_ratio:1/Yt(t,1,d.zoom),u_device_pixel_ratio:l.pixelRatio,u_image:0,u_scale:[f,s.fromScale,s.toScale],u_fade:s.t,u_units_to_pixels:[1/d.pixelsToGLUnits[0],1/d.pixelsToGLUnits[1]]}},Yn=(l,t,n,s,u,d)=>{const f=l.lineAtlas,_=Nt(t,l.transform),y=n.layout.get("line-cap")==="round",w=f.getDash(s.from,y),I=f.getDash(s.to,y),P=w.width*u.fromScale,D=I.width*u.toScale;return a.extend(Mn(l,t,n,d),{u_patternscale_a:[_/P,-w.height/2],u_patternscale_b:[_/D,-I.height/2],u_sdfgamma:f.width/(256*Math.min(P,D)*l.pixelRatio)/2,u_image:0,u_tex_y_a:w.y,u_tex_y_b:I.y,u_mix:u.t})};function Nt(l,t){return 1/Yt(l,1,t.tileZoom)}function Qn(l,t,n,s){return l.translatePosMatrix(s?s.posMatrix:t.tileID.posMatrix,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const ba=(l,t,n,s,u)=>{return{u_matrix:l,u_tl_parent:t,u_scale_parent:n,u_buffer_scale:1,u_fade_t:s.mix,u_opacity:s.opacity*u.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:u.paint.get("raster-brightness-min"),u_brightness_high:u.paint.get("raster-brightness-max"),u_saturation_factor:(f=u.paint.get("raster-saturation"),f>0?1-1/(1.001-f):-f),u_contrast_factor:(d=u.paint.get("raster-contrast"),d>0?1/(1-d):1+d),u_spin_weights:wa(u.paint.get("raster-hue-rotate"))};var d,f};function wa(l){l*=Math.PI/180;const t=Math.sin(l),n=Math.cos(l);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const ps=(l,t,n,s,u,d,f,_,y,w)=>{const I=u.transform;return{u_is_size_zoom_constant:+(l==="constant"||l==="source"),u_is_size_feature_constant:+(l==="constant"||l==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:I.cameraToCenterDistance,u_pitch:I.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:I.width/I.height,u_fade_change:u.options.fadeDuration?u.symbolFadeChange:1,u_matrix:d,u_label_plane_matrix:f,u_coord_matrix:_,u_is_text:+y,u_pitch_with_map:+s,u_texsize:w,u_texture:0}},Do=(l,t,n,s,u,d,f,_,y,w,I)=>{const P=u.transform;return a.extend(ps(l,t,n,s,u,d,f,_,y,w),{u_gamma_scale:s?Math.cos(P._pitch)*P.cameraToCenterDistance:1,u_device_pixel_ratio:u.pixelRatio,u_is_halo:+I})},Ta=(l,t,n,s,u,d,f,_,y,w)=>a.extend(Do(l,t,n,s,u,d,f,_,!0,y,!0),{u_texsize_icon:w,u_texture_icon:1}),Ol=(l,t,n)=>({u_matrix:l,u_opacity:t,u_color:n}),$l=(l,t,n,s,u,d)=>a.extend(function(f,_,y,w){const I=y.imageManager.getPattern(f.from.toString()),P=y.imageManager.getPattern(f.to.toString()),{width:D,height:N}=y.imageManager.getPixelSize(),U=Math.pow(2,w.tileID.overscaledZ),V=w.tileSize*Math.pow(2,y.transform.tileZoom)/U,Y=V*(w.tileID.canonical.x+w.tileID.wrap*U),ie=V*w.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:I.tl,u_pattern_br_a:I.br,u_pattern_tl_b:P.tl,u_pattern_br_b:P.br,u_texsize:[D,N],u_mix:_.t,u_pattern_size_a:I.displaySize,u_pattern_size_b:P.displaySize,u_scale_a:_.fromScale,u_scale_b:_.toScale,u_tile_units_to_pixels:1/Yt(w,1,y.transform.tileZoom),u_pixel_coord_upper:[Y>>16,ie>>16],u_pixel_coord_lower:[65535&Y,65535&ie]}}(s,d,n,u),{u_matrix:l,u_opacity:t}),fs={fillExtrusion:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_lightpos:new a.Uniform3f(l,t.u_lightpos),u_lightintensity:new a.Uniform1f(l,t.u_lightintensity),u_lightcolor:new a.Uniform3f(l,t.u_lightcolor),u_vertical_gradient:new a.Uniform1f(l,t.u_vertical_gradient),u_opacity:new a.Uniform1f(l,t.u_opacity)}),fillExtrusionPattern:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_lightpos:new a.Uniform3f(l,t.u_lightpos),u_lightintensity:new a.Uniform1f(l,t.u_lightintensity),u_lightcolor:new a.Uniform3f(l,t.u_lightcolor),u_vertical_gradient:new a.Uniform1f(l,t.u_vertical_gradient),u_height_factor:new a.Uniform1f(l,t.u_height_factor),u_image:new a.Uniform1i(l,t.u_image),u_texsize:new a.Uniform2f(l,t.u_texsize),u_pixel_coord_upper:new a.Uniform2f(l,t.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(l,t.u_pixel_coord_lower),u_scale:new a.Uniform3f(l,t.u_scale),u_fade:new a.Uniform1f(l,t.u_fade),u_opacity:new a.Uniform1f(l,t.u_opacity)}),fill:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix)}),fillPattern:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_image:new a.Uniform1i(l,t.u_image),u_texsize:new a.Uniform2f(l,t.u_texsize),u_pixel_coord_upper:new a.Uniform2f(l,t.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(l,t.u_pixel_coord_lower),u_scale:new a.Uniform3f(l,t.u_scale),u_fade:new a.Uniform1f(l,t.u_fade)}),fillOutline:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_world:new a.Uniform2f(l,t.u_world)}),fillOutlinePattern:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_world:new a.Uniform2f(l,t.u_world),u_image:new a.Uniform1i(l,t.u_image),u_texsize:new a.Uniform2f(l,t.u_texsize),u_pixel_coord_upper:new a.Uniform2f(l,t.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(l,t.u_pixel_coord_lower),u_scale:new a.Uniform3f(l,t.u_scale),u_fade:new a.Uniform1f(l,t.u_fade)}),circle:(l,t)=>({u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_scale_with_map:new a.Uniform1i(l,t.u_scale_with_map),u_pitch_with_map:new a.Uniform1i(l,t.u_pitch_with_map),u_extrude_scale:new a.Uniform2f(l,t.u_extrude_scale),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_matrix:new a.UniformMatrix4f(l,t.u_matrix)}),collisionBox:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_pixels_to_tile_units:new a.Uniform1f(l,t.u_pixels_to_tile_units),u_extrude_scale:new a.Uniform2f(l,t.u_extrude_scale),u_overscale_factor:new a.Uniform1f(l,t.u_overscale_factor)}),collisionCircle:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_inv_matrix:new a.UniformMatrix4f(l,t.u_inv_matrix),u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_viewport_size:new a.Uniform2f(l,t.u_viewport_size)}),debug:(l,t)=>({u_color:new a.UniformColor(l,t.u_color),u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_overlay:new a.Uniform1i(l,t.u_overlay),u_overlay_scale:new a.Uniform1f(l,t.u_overlay_scale)}),clippingMask:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix)}),heatmap:(l,t)=>({u_extrude_scale:new a.Uniform1f(l,t.u_extrude_scale),u_intensity:new a.Uniform1f(l,t.u_intensity),u_matrix:new a.UniformMatrix4f(l,t.u_matrix)}),heatmapTexture:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_world:new a.Uniform2f(l,t.u_world),u_image:new a.Uniform1i(l,t.u_image),u_color_ramp:new a.Uniform1i(l,t.u_color_ramp),u_opacity:new a.Uniform1f(l,t.u_opacity)}),hillshade:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_image:new a.Uniform1i(l,t.u_image),u_latrange:new a.Uniform2f(l,t.u_latrange),u_light:new a.Uniform2f(l,t.u_light),u_shadow:new a.UniformColor(l,t.u_shadow),u_highlight:new a.UniformColor(l,t.u_highlight),u_accent:new a.UniformColor(l,t.u_accent)}),hillshadePrepare:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_image:new a.Uniform1i(l,t.u_image),u_dimension:new a.Uniform2f(l,t.u_dimension),u_zoom:new a.Uniform1f(l,t.u_zoom),u_unpack:new a.Uniform4f(l,t.u_unpack)}),line:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_ratio:new a.Uniform1f(l,t.u_ratio),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_units_to_pixels:new a.Uniform2f(l,t.u_units_to_pixels)}),lineGradient:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_ratio:new a.Uniform1f(l,t.u_ratio),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_units_to_pixels:new a.Uniform2f(l,t.u_units_to_pixels),u_image:new a.Uniform1i(l,t.u_image),u_image_height:new a.Uniform1f(l,t.u_image_height)}),linePattern:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_texsize:new a.Uniform2f(l,t.u_texsize),u_ratio:new a.Uniform1f(l,t.u_ratio),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_image:new a.Uniform1i(l,t.u_image),u_units_to_pixels:new a.Uniform2f(l,t.u_units_to_pixels),u_scale:new a.Uniform3f(l,t.u_scale),u_fade:new a.Uniform1f(l,t.u_fade)}),lineSDF:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_ratio:new a.Uniform1f(l,t.u_ratio),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_units_to_pixels:new a.Uniform2f(l,t.u_units_to_pixels),u_patternscale_a:new a.Uniform2f(l,t.u_patternscale_a),u_patternscale_b:new a.Uniform2f(l,t.u_patternscale_b),u_sdfgamma:new a.Uniform1f(l,t.u_sdfgamma),u_image:new a.Uniform1i(l,t.u_image),u_tex_y_a:new a.Uniform1f(l,t.u_tex_y_a),u_tex_y_b:new a.Uniform1f(l,t.u_tex_y_b),u_mix:new a.Uniform1f(l,t.u_mix)}),raster:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_tl_parent:new a.Uniform2f(l,t.u_tl_parent),u_scale_parent:new a.Uniform1f(l,t.u_scale_parent),u_buffer_scale:new a.Uniform1f(l,t.u_buffer_scale),u_fade_t:new a.Uniform1f(l,t.u_fade_t),u_opacity:new a.Uniform1f(l,t.u_opacity),u_image0:new a.Uniform1i(l,t.u_image0),u_image1:new a.Uniform1i(l,t.u_image1),u_brightness_low:new a.Uniform1f(l,t.u_brightness_low),u_brightness_high:new a.Uniform1f(l,t.u_brightness_high),u_saturation_factor:new a.Uniform1f(l,t.u_saturation_factor),u_contrast_factor:new a.Uniform1f(l,t.u_contrast_factor),u_spin_weights:new a.Uniform3f(l,t.u_spin_weights)}),symbolIcon:(l,t)=>({u_is_size_zoom_constant:new a.Uniform1i(l,t.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(l,t.u_is_size_feature_constant),u_size_t:new a.Uniform1f(l,t.u_size_t),u_size:new a.Uniform1f(l,t.u_size),u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_pitch:new a.Uniform1f(l,t.u_pitch),u_rotate_symbol:new a.Uniform1i(l,t.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(l,t.u_aspect_ratio),u_fade_change:new a.Uniform1f(l,t.u_fade_change),u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(l,t.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(l,t.u_coord_matrix),u_is_text:new a.Uniform1i(l,t.u_is_text),u_pitch_with_map:new a.Uniform1i(l,t.u_pitch_with_map),u_texsize:new a.Uniform2f(l,t.u_texsize),u_texture:new a.Uniform1i(l,t.u_texture)}),symbolSDF:(l,t)=>({u_is_size_zoom_constant:new a.Uniform1i(l,t.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(l,t.u_is_size_feature_constant),u_size_t:new a.Uniform1f(l,t.u_size_t),u_size:new a.Uniform1f(l,t.u_size),u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_pitch:new a.Uniform1f(l,t.u_pitch),u_rotate_symbol:new a.Uniform1i(l,t.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(l,t.u_aspect_ratio),u_fade_change:new a.Uniform1f(l,t.u_fade_change),u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(l,t.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(l,t.u_coord_matrix),u_is_text:new a.Uniform1i(l,t.u_is_text),u_pitch_with_map:new a.Uniform1i(l,t.u_pitch_with_map),u_texsize:new a.Uniform2f(l,t.u_texsize),u_texture:new a.Uniform1i(l,t.u_texture),u_gamma_scale:new a.Uniform1f(l,t.u_gamma_scale),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_is_halo:new a.Uniform1i(l,t.u_is_halo)}),symbolTextAndIcon:(l,t)=>({u_is_size_zoom_constant:new a.Uniform1i(l,t.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(l,t.u_is_size_feature_constant),u_size_t:new a.Uniform1f(l,t.u_size_t),u_size:new a.Uniform1f(l,t.u_size),u_camera_to_center_distance:new a.Uniform1f(l,t.u_camera_to_center_distance),u_pitch:new a.Uniform1f(l,t.u_pitch),u_rotate_symbol:new a.Uniform1i(l,t.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(l,t.u_aspect_ratio),u_fade_change:new a.Uniform1f(l,t.u_fade_change),u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(l,t.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(l,t.u_coord_matrix),u_is_text:new a.Uniform1i(l,t.u_is_text),u_pitch_with_map:new a.Uniform1i(l,t.u_pitch_with_map),u_texsize:new a.Uniform2f(l,t.u_texsize),u_texsize_icon:new a.Uniform2f(l,t.u_texsize_icon),u_texture:new a.Uniform1i(l,t.u_texture),u_texture_icon:new a.Uniform1i(l,t.u_texture_icon),u_gamma_scale:new a.Uniform1f(l,t.u_gamma_scale),u_device_pixel_ratio:new a.Uniform1f(l,t.u_device_pixel_ratio),u_is_halo:new a.Uniform1i(l,t.u_is_halo)}),background:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_opacity:new a.Uniform1f(l,t.u_opacity),u_color:new a.UniformColor(l,t.u_color)}),backgroundPattern:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_opacity:new a.Uniform1f(l,t.u_opacity),u_image:new a.Uniform1i(l,t.u_image),u_pattern_tl_a:new a.Uniform2f(l,t.u_pattern_tl_a),u_pattern_br_a:new a.Uniform2f(l,t.u_pattern_br_a),u_pattern_tl_b:new a.Uniform2f(l,t.u_pattern_tl_b),u_pattern_br_b:new a.Uniform2f(l,t.u_pattern_br_b),u_texsize:new a.Uniform2f(l,t.u_texsize),u_mix:new a.Uniform1f(l,t.u_mix),u_pattern_size_a:new a.Uniform2f(l,t.u_pattern_size_a),u_pattern_size_b:new a.Uniform2f(l,t.u_pattern_size_b),u_scale_a:new a.Uniform1f(l,t.u_scale_a),u_scale_b:new a.Uniform1f(l,t.u_scale_b),u_pixel_coord_upper:new a.Uniform2f(l,t.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(l,t.u_pixel_coord_lower),u_tile_units_to_pixels:new a.Uniform1f(l,t.u_tile_units_to_pixels)}),terrain:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_texture:new a.Uniform1i(l,t.u_texture)}),terrainDepth:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix)}),terrainCoords:(l,t)=>({u_matrix:new a.UniformMatrix4f(l,t.u_matrix),u_texture:new a.Uniform1i(l,t.u_texture),u_terrain_coords_id:new a.Uniform1f(l,t.u_terrain_coords_id)})};class ms{constructor(t,n,s){this.context=t;const u=t.gl;this.buffer=u.createBuffer(),this.dynamicDraw=Boolean(s),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),u.bufferData(u.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?u.DYNAMIC_DRAW:u.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const n=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),n.bufferSubData(n.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const gs={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class _s{constructor(t,n,s,u){this.length=n.length,this.attributes=s,this.itemSize=n.bytesPerElement,this.dynamicDraw=u,this.context=t;const d=t.gl;this.buffer=d.createBuffer(),t.bindVertexBuffer.set(this.buffer),d.bufferData(d.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?d.DYNAMIC_DRAW:d.STATIC_DRAW),this.dynamicDraw||delete n.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 n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,n){for(let s=0;s<this.attributes.length;s++){const u=n.attributes[this.attributes[s].name];u!==void 0&&t.enableVertexAttribArray(u)}}setVertexAttribPointers(t,n,s){for(let u=0;u<this.attributes.length;u++){const d=this.attributes[u],f=n.attributes[d.name];f!==void 0&&t.vertexAttribPointer(f,d.components,t[gs[d.type]],!1,this.itemSize,d.offset+this.itemSize*(s||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class St{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 Ea extends St{getDefault(){return a.Color.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Ul extends St{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class eo extends St{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class to extends St{getDefault(){return[!0,!0,!0,!0]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Sa extends St{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class Ui extends St{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class ys extends St{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const n=this.current;(t.func!==n.func||t.ref!==n.ref||t.mask!==n.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class Lo extends St{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class Ro extends St{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.STENCIL_TEST):n.disable(n.STENCIL_TEST),this.current=t,this.dirty=!1}}class xs extends St{getDefault(){return[0,1]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class vs extends St{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),this.current=t,this.dirty=!1}}class Bo extends St{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class bs extends St{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.BLEND):n.disable(n.BLEND),this.current=t,this.dirty=!1}}class ws extends St{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class Fo extends St{getDefault(){return a.Color.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Ia extends St{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class Ca extends St{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.CULL_FACE):n.disable(n.CULL_FACE),this.current=t,this.dirty=!1}}class Pn extends St{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class Vl extends St{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class Nl extends St{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class Gl extends St{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class Zl extends St{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class ql extends St{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindFramebuffer(n.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class jl extends St{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindRenderbuffer(n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Ts extends St{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindTexture(n.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class Oo extends St{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindBuffer(n.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Es extends St{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Ss extends St{constructor(t){super(t),this.vao=t.extVertexArrayObject}getDefault(){return null}set(t){this.vao&&(t!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(t),this.current=t,this.dirty=!1)}}class zn extends St{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class Aa extends St{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class Ma extends St{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class $o extends St{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class rn extends $o{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class Pa extends $o{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class kn{constructor(t,n,s,u){this.context=t,this.width=n,this.height=s;const d=t.gl,f=this.framebuffer=d.createFramebuffer();if(this.colorAttachment=new rn(t,f),u&&(this.depthAttachment=new Pa(t,f)),d.checkFramebufferStatus(d.FRAMEBUFFER)!==d.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const t=this.context.gl,n=this.colorAttachment.get();if(n&&t.deleteTexture(n),this.depthAttachment){const s=this.depthAttachment.get();s&&t.deleteRenderbuffer(s)}t.deleteFramebuffer(this.framebuffer)}}class Ot{constructor(t,n,s){this.blendFunction=t,this.blendColor=n,this.mask=s}}Ot.Replace=[1,0],Ot.disabled=new Ot(Ot.Replace,a.Color.transparent,[!1,!1,!1,!1]),Ot.unblended=new Ot(Ot.Replace,a.Color.transparent,[!0,!0,!0,!0]),Ot.alphaBlended=new Ot([1,771],a.Color.transparent,[!0,!0,!0,!0]);class za{constructor(t){this.gl=t,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new Ea(this),this.clearDepth=new Ul(this),this.clearStencil=new eo(this),this.colorMask=new to(this),this.depthMask=new Sa(this),this.stencilMask=new Ui(this),this.stencilFunc=new ys(this),this.stencilOp=new Lo(this),this.stencilTest=new Ro(this),this.depthRange=new xs(this),this.depthTest=new vs(this),this.depthFunc=new Bo(this),this.blend=new bs(this),this.blendFunc=new ws(this),this.blendColor=new Fo(this),this.blendEquation=new Ia(this),this.cullFace=new Ca(this),this.cullFaceSide=new Pn(this),this.frontFace=new Vl(this),this.program=new Nl(this),this.activeTexture=new Gl(this),this.viewport=new Zl(this),this.bindFramebuffer=new ql(this),this.bindRenderbuffer=new jl(this),this.bindTexture=new Ts(this),this.bindVertexBuffer=new Oo(this),this.bindElementBuffer=new Es(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new Ss(this),this.pixelStoreUnpack=new zn(this),this.pixelStoreUnpackPremultiplyAlpha=new Aa(this),this.pixelStoreUnpackFlipY=new Ma(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.extTextureHalfFloat=t.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&(t.getExtension("OES_texture_half_float_linear"),this.extRenderToTextureHalfFloat=t.getExtension("EXT_color_buffer_half_float")),this.extTimerQuery=t.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE)}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.extVertexArrayObject&&(this.bindVertexArrayOES.dirty=!0),this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,n){return new ms(this,t,n)}createVertexBuffer(t,n,s){return new _s(this,t,n,s)}createRenderbuffer(t,n,s){const u=this.gl,d=u.createRenderbuffer();return this.bindRenderbuffer.set(d),u.renderbufferStorage(u.RENDERBUFFER,t,n,s),this.bindRenderbuffer.set(null),d}createFramebuffer(t,n,s){return new kn(this,t,n,s)}clear({color:t,depth:n}){const s=this.gl;let u=0;t&&(u|=s.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),n!==void 0&&(u|=s.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),s.clear(u)}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){oe(t.blendFunction,Ot.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}unbindVAO(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)}}class yt{constructor(t,n,s){this.func=t,this.mask=n,this.range=s}}yt.ReadOnly=!1,yt.ReadWrite=!0,yt.disabled=new yt(519,yt.ReadOnly,[0,1]);const It=7680;class Bt{constructor(t,n,s,u,d,f){this.test=t,this.ref=n,this.mask=s,this.fail=u,this.depthFail=d,this.pass=f}}Bt.disabled=new Bt({func:519,mask:0},0,0,It,It,It);class Gt{constructor(t,n,s){this.enable=t,this.mode=n,this.frontFace=s}}let io;function Dn(l,t,n,s,u,d,f){const _=l.context,y=_.gl,w=l.useProgram("collisionBox"),I=[];let P=0,D=0;for(let G=0;G<s.length;G++){const ue=s[G],ae=t.getTile(ue),ge=ae.getBucket(n);if(!ge)continue;let _e=ue.posMatrix;u[0]===0&&u[1]===0||(_e=l.translatePosMatrix(ue.posMatrix,ae,u,d));const we=f?ge.textCollisionBox:ge.iconCollisionBox,me=ge.collisionCircleArray;if(me.length>0){const Oe=a.create(),Ce=_e;a.mul(Oe,ge.placementInvProjMatrix,l.transform.glCoordMatrix),a.mul(Oe,Oe,ge.placementViewportMatrix),I.push({circleArray:me,circleOffset:D,transform:Ce,invTransform:Oe,coord:ue}),P+=me.length/4,D=P}we&&w.draw(_,y.LINES,yt.disabled,Bt.disabled,l.colorModeForRenderPass(),Gt.disabled,tn(_e,l.transform,ae),l.style.terrain&&l.style.terrain.getTerrainData(ue),n.id,we.layoutVertexBuffer,we.indexBuffer,we.segments,null,l.transform.zoom,null,null,we.collisionVertexBuffer)}if(!f||!I.length)return;const N=l.useProgram("collisionCircle"),U=new a.CollisionCircleLayoutArray;U.resize(4*P),U._trim();let V=0;for(const G of I)for(let ue=0;ue<G.circleArray.length/4;ue++){const ae=4*ue,ge=G.circleArray[ae+0],_e=G.circleArray[ae+1],we=G.circleArray[ae+2],me=G.circleArray[ae+3];U.emplace(V++,ge,_e,we,me,0),U.emplace(V++,ge,_e,we,me,1),U.emplace(V++,ge,_e,we,me,2),U.emplace(V++,ge,_e,we,me,3)}(!io||io.length<2*P)&&(io=function(G){const ue=2*G,ae=new a.QuadTriangleArray;ae.resize(ue),ae._trim();for(let ge=0;ge<ue;ge++){const _e=6*ge;ae.uint16[_e+0]=4*ge+0,ae.uint16[_e+1]=4*ge+1,ae.uint16[_e+2]=4*ge+2,ae.uint16[_e+3]=4*ge+2,ae.uint16[_e+4]=4*ge+3,ae.uint16[_e+5]=4*ge+0}return ae}(P));const Y=_.createIndexBuffer(io,!0),ie=_.createVertexBuffer(U,a.collisionCircleLayout.members,!0);for(const G of I){const ue={u_matrix:G.transform,u_inv_matrix:G.invTransform,u_camera_to_center_distance:(se=l.transform).cameraToCenterDistance,u_viewport_size:[se.width,se.height]};N.draw(_,y.TRIANGLES,yt.disabled,Bt.disabled,l.colorModeForRenderPass(),Gt.disabled,ue,l.style.terrain&&l.style.terrain.getTerrainData(G.coord),n.id,ie,Y,a.SegmentVector.simpleSegment(0,2*G.circleOffset,G.circleArray.length,G.circleArray.length/2),null,l.transform.zoom,null,null,null)}var se;ie.destroy(),Y.destroy()}Gt.disabled=new Gt(!1,1029,2305),Gt.backCCW=new Gt(!0,1029,2305);const Xl=a.identity(new Float32Array(16));function Wl(l,t,n,s,u,d){const{horizontalAlign:f,verticalAlign:_}=a.getAnchorAlignment(l),y=-(f-.5)*t,w=-(_-.5)*n,I=a.evaluateVariableOffset(l,s);return new a.pointGeometry((y/u+I[0])*d,(w/u+I[1])*d)}function ka(l,t,n,s,u,d,f,_,y,w,I){const P=l.text.placedSymbolArray,D=l.text.dynamicLayoutVertexArray,N=l.icon.dynamicLayoutVertexArray,U={};D.clear();for(let V=0;V<P.length;V++){const Y=P.get(V),ie=l.allowVerticalPlacement&&!Y.placedOrientation,se=Y.hidden||!Y.crossTileID||ie?null:s[Y.crossTileID];if(se){const G=new a.pointGeometry(Y.anchorX,Y.anchorY),ue=bt(G,n?f:d,I),ae=Ki(u.cameraToCenterDistance,ue.signedDistanceFromCamera);let ge=a.evaluateSizeForFeature(l.textSizeData,y,Y)*ae/a.ONE_EM;n&&(ge*=l.tilePixelRatio/_);const{width:_e,height:we,anchor:me,textOffset:Oe,textBoxScale:Ce}=se,$e=Wl(me,_e,we,Oe,Ce,ge),lt=n?bt(G.add($e),d,I).point:ue.point.add(t?$e.rotate(-u.angle):$e),dt=l.allowVerticalPlacement&&Y.placedOrientation===a.WritingMode.vertical?Math.PI/2:0;for(let We=0;We<Y.numGlyphs;We++)a.addDynamicAttributes(D,lt,dt);w&&Y.associatedIconIndex>=0&&(U[Y.associatedIconIndex]={shiftedAnchor:lt,angle:dt})}else ot(Y.numGlyphs,D)}if(w){N.clear();const V=l.icon.placedSymbolArray;for(let Y=0;Y<V.length;Y++){const ie=V.get(Y);if(ie.hidden)ot(ie.numGlyphs,N);else{const se=U[Y];if(se)for(let G=0;G<ie.numGlyphs;G++)a.addDynamicAttributes(N,se.shiftedAnchor,se.angle);else ot(ie.numGlyphs,N)}}l.icon.dynamicLayoutVertexBuffer.updateData(N)}l.text.dynamicLayoutVertexBuffer.updateData(D)}function Hl(l,t,n){return n.iconsInText&&t?"symbolTextAndIcon":l?"symbolSDF":"symbolIcon"}function Uo(l,t,n,s,u,d,f,_,y,w,I,P){const D=l.context,N=D.gl,U=l.transform,V=_==="map",Y=y==="map",ie=_!=="viewport"&&n.layout.get("symbol-placement")!=="point",se=V&&!Y&&!ie,G=!n.layout.get("symbol-sort-key").isConstant();let ue=!1;const ae=l.depthModeForSublayer(0,yt.ReadOnly),ge=n.layout.get("text-variable-anchor"),_e=[];for(const we of s){const me=t.getTile(we),Oe=me.getBucket(n);if(!Oe)continue;const Ce=u?Oe.text:Oe.icon;if(!Ce||!Ce.segments.get().length)continue;const $e=Ce.programConfigurations.get(n.id),lt=u||Oe.sdfIcons,dt=u?Oe.textSizeData:Oe.iconSizeData,We=Y||U.pitch!==0,Mt=l.useProgram(Hl(lt,u,Oe),$e),Pt=a.evaluateSizeForZoom(dt,U.zoom),xt=l.style.terrain&&l.style.terrain.getTerrainData(we);let Et,kt,li,_r,or=[0,0],yr=null;if(u){if(kt=me.glyphAtlasTexture,li=N.LINEAR,Et=me.glyphAtlasTexture.size,Oe.iconsInText){or=me.imageAtlasTexture.size,yr=me.imageAtlasTexture;const Qi=dt.kind==="composite"||dt.kind==="camera";_r=We||l.options.rotating||l.options.zooming||Qi?N.LINEAR:N.NEAREST}}else{const Qi=n.layout.get("icon-size").constantOr(0)!==1||Oe.iconsNeedLinear;kt=me.imageAtlasTexture,li=lt||l.options.rotating||l.options.zooming||Qi||We?N.LINEAR:N.NEAREST,Et=me.imageAtlasTexture.size}const Xr=Yt(me,1,l.transform.zoom),Yi=Jr(we.posMatrix,Y,V,l.transform,Xr),zi=rr(we.posMatrix,Y,V,l.transform,Xr),Ar=ge&&Oe.hasTextData(),Wo=n.layout.get("icon-text-fit")!=="none"&&Ar&&Oe.hasIconData();if(ie){const Qi=l.style.terrain?(Us,$n)=>l.style.terrain.getElevation(we,Us,$n):null,an=n.layout.get("text-rotation-alignment")==="map";$i(Oe,we.posMatrix,l,u,Yi,zi,Y,w,an,Qi)}const ri=l.translatePosMatrix(we.posMatrix,me,d,f),ft=ie||u&&ge||Wo?Xl:Yi,Ct=l.translatePosMatrix(zi,me,d,f,!0),ci=lt&&n.paint.get(u?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let ui;ui=lt?Oe.iconsInText?Ta(dt.kind,Pt,se,Y,l,ri,ft,Ct,Et,or):Do(dt.kind,Pt,se,Y,l,ri,ft,Ct,u,Et,!0):ps(dt.kind,Pt,se,Y,l,ri,ft,Ct,u,Et);const qt={program:Mt,buffers:Ce,uniformValues:ui,atlasTexture:kt,atlasTextureIcon:yr,atlasInterpolation:li,atlasInterpolationIcon:_r,isSDF:lt,hasHalo:ci};if(G&&Oe.canOverlap){ue=!0;const Qi=Ce.segments.get();for(const an of Qi)_e.push({segments:new a.SegmentVector([an]),sortKey:an.sortKey,state:qt,terrainData:xt})}else _e.push({segments:Ce.segments,sortKey:0,state:qt,terrainData:xt})}ue&&_e.sort((we,me)=>we.sortKey-me.sortKey);for(const we of _e){const me=we.state;if(D.activeTexture.set(N.TEXTURE0),me.atlasTexture.bind(me.atlasInterpolation,N.CLAMP_TO_EDGE),me.atlasTextureIcon&&(D.activeTexture.set(N.TEXTURE1),me.atlasTextureIcon&&me.atlasTextureIcon.bind(me.atlasInterpolationIcon,N.CLAMP_TO_EDGE)),me.isSDF){const Oe=me.uniformValues;me.hasHalo&&(Oe.u_is_halo=1,ro(me.buffers,we.segments,n,l,me.program,ae,I,P,Oe,we.terrainData)),Oe.u_is_halo=0}ro(me.buffers,we.segments,n,l,me.program,ae,I,P,me.uniformValues,we.terrainData)}}function ro(l,t,n,s,u,d,f,_,y,w){const I=s.context;u.draw(I,I.gl.TRIANGLES,d,f,_,Gt.disabled,y,w,n.id,l.layoutVertexBuffer,l.indexBuffer,t,n.paint,s.transform.zoom,l.programConfigurations.get(n.id),l.dynamicLayoutVertexBuffer,l.opacityVertexBuffer)}function no(l,t,n,s,u,d,f){const _=l.context.gl,y=n.paint.get("fill-pattern"),w=y&&y.constantOr(1),I=n.getCrossfadeParameters();let P,D,N,U,V;f?(D=w&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",P=_.LINES):(D=w?"fillPattern":"fill",P=_.TRIANGLES);for(const Y of s){const ie=t.getTile(Y);if(w&&!ie.patternsLoaded())continue;const se=ie.getBucket(n);if(!se)continue;const G=se.programConfigurations.get(n.id),ue=l.useProgram(D,G),ae=l.style.terrain&&l.style.terrain.getTerrainData(Y);w&&(l.context.activeTexture.set(_.TEXTURE0),ie.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),G.updatePaintBuffers(I));const ge=y.constantOr(null);if(ge&&ie.imageAtlas){const me=ie.imageAtlas,Oe=me.patternPositions[ge.to.toString()],Ce=me.patternPositions[ge.from.toString()];Oe&&Ce&&G.setConstantPatternPositions(Oe,Ce)}const _e=ae?Y:null,we=l.translatePosMatrix(_e?_e.posMatrix:Y.posMatrix,ie,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(f){U=se.indexBuffer2,V=se.segments2;const me=[_.drawingBufferWidth,_.drawingBufferHeight];N=D==="fillOutlinePattern"&&w?xa(we,l,I,ie,me):ya(we,me)}else U=se.indexBuffer,V=se.segments,N=w?hs(we,l,I,ie):Mo(we);ue.draw(l.context,P,u,l.stencilModeForClipping(Y),d,Gt.disabled,N,ae,n.id,se.layoutVertexBuffer,U,V,n.paint,l.transform.zoom,G)}}function oo(l,t,n,s,u,d,f){const _=l.context,y=_.gl,w=n.paint.get("fill-extrusion-pattern"),I=w.constantOr(1),P=n.getCrossfadeParameters(),D=n.paint.get("fill-extrusion-opacity");for(const N of s){const U=t.getTile(N),V=U.getBucket(n);if(!V)continue;const Y=l.style.terrain&&l.style.terrain.getTerrainData(N),ie=V.programConfigurations.get(n.id),se=l.useProgram(I?"fillExtrusionPattern":"fillExtrusion",ie);I&&(l.context.activeTexture.set(y.TEXTURE0),U.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),ie.updatePaintBuffers(P));const G=w.constantOr(null);if(G&&U.imageAtlas){const _e=U.imageAtlas,we=_e.patternPositions[G.to.toString()],me=_e.patternPositions[G.from.toString()];we&&me&&ie.setConstantPatternPositions(we,me)}const ue=l.translatePosMatrix(N.posMatrix,U,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),ae=n.paint.get("fill-extrusion-vertical-gradient"),ge=I?Fl(ue,l,ae,D,N,P,U):us(ue,l,ae,D);se.draw(_,_.gl.TRIANGLES,u,d,f,Gt.backCCW,ge,Y,n.id,V.layoutVertexBuffer,V.indexBuffer,V.segments,n.paint,l.transform.zoom,ie,l.style.terrain&&V.centroidVertexBuffer)}}function Is(l,t,n,s,u,d,f){const _=l.context,y=_.gl,w=n.fbo;if(!w)return;const I=l.useProgram("hillshade"),P=l.style.terrain&&l.style.terrain.getTerrainData(t);_.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,w.colorAttachment.get()),I.draw(_,y.TRIANGLES,u,d,f,Gt.disabled,((D,N,U,V)=>{const Y=U.paint.get("hillshade-shadow-color"),ie=U.paint.get("hillshade-highlight-color"),se=U.paint.get("hillshade-accent-color");let G=U.paint.get("hillshade-illumination-direction")*(Math.PI/180);U.paint.get("hillshade-illumination-anchor")==="viewport"&&(G-=D.transform.angle);const ue=!D.options.moving;return{u_matrix:V?V.posMatrix:D.transform.calculatePosMatrix(N.tileID.toUnwrapped(),ue),u_image:0,u_latrange:zo(0,N.tileID),u_light:[U.paint.get("hillshade-exaggeration"),G],u_shadow:Y,u_highlight:ie,u_accent:se}})(l,n,s,P?t:null),P,s.id,l.rasterBoundsBuffer,l.quadTriangleIndexBuffer,l.rasterBoundsSegments)}function Da(l,t,n,s,u,d){const f=l.context,_=f.gl,y=t.dem;if(y&&y.data){const w=y.dim,I=y.stride,P=y.getPixels();if(f.activeTexture.set(_.TEXTURE1),f.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||l.getTileTexture(I),t.demTexture){const N=t.demTexture;N.update(P,{premultiply:!1}),N.bind(_.NEAREST,_.CLAMP_TO_EDGE)}else t.demTexture=new Me(f,P,_.RGBA,{premultiply:!1}),t.demTexture.bind(_.NEAREST,_.CLAMP_TO_EDGE);f.activeTexture.set(_.TEXTURE0);let D=t.fbo;if(!D){const N=new Me(f,{width:w,height:w,data:null},_.RGBA);N.bind(_.LINEAR,_.CLAMP_TO_EDGE),D=t.fbo=f.createFramebuffer(w,w,!0),D.colorAttachment.set(N.texture)}f.bindFramebuffer.set(D.framebuffer),f.viewport.set([0,0,w,w]),l.useProgram("hillshadePrepare").draw(f,_.TRIANGLES,s,u,d,Gt.disabled,((N,U)=>{const V=U.stride,Y=a.create();return a.ortho(Y,0,a.EXTENT,-a.EXTENT,0,0,1),a.translate(Y,Y,[0,-a.EXTENT,0]),{u_matrix:Y,u_image:1,u_dimension:[V,V],u_zoom:N.overscaledZ,u_unpack:U.getUnpackVector()}})(t.tileID,y),null,n.id,l.rasterBoundsBuffer,l.quadTriangleIndexBuffer,l.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function Vo(l,t,n,s,u,d){const f=s.paint.get("raster-fade-duration");if(!d&&f>0){const _=a.exported.now(),y=(_-l.timeAdded)/f,w=t?(_-t.timeAdded)/f:-1,I=n.getSource(),P=u.coveringZoomLevel({tileSize:I.tileSize,roundZoom:I.roundZoom}),D=!t||Math.abs(t.tileID.overscaledZ-P)>Math.abs(l.tileID.overscaledZ-P),N=D&&l.refreshedUponExpiration?1:a.clamp(D?y:1-w,0,1);return l.refreshedUponExpiration&&y>=1&&(l.refreshedUponExpiration=!1),t?{opacity:1,mix:1-N}:{opacity:N,mix:0}}return{opacity:1,mix:0}}const No=new a.Color(1,0,0,1),nr=new a.Color(0,1,0,1),La=new a.Color(0,0,1,1),Cs=new a.Color(1,0,1,1),Ra=new a.Color(0,1,1,1);function nn(l,t,n,s){Ln(l,0,t+n/2,l.transform.width,n,s)}function so(l,t,n,s){Ln(l,t-n/2,0,n,l.transform.height,s)}function Ln(l,t,n,s,u,d){const f=l.context,_=f.gl;_.enable(_.SCISSOR_TEST),_.scissor(t*l.pixelRatio,n*l.pixelRatio,s*l.pixelRatio,u*l.pixelRatio),f.clear({color:d}),_.disable(_.SCISSOR_TEST)}function Kl(l,t,n){const s=l.context,u=s.gl,d=n.posMatrix,f=l.useProgram("debug"),_=yt.disabled,y=Bt.disabled,w=l.colorModeForRenderPass(),I="$debug",P=l.style.terrain&&l.style.terrain.getTerrainData(n);s.activeTexture.set(u.TEXTURE0),l.emptyTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE);const D=t.getTileByID(n.key).latestRawTileData,N=Math.floor((D&&D.byteLength||0)/1024),U=t.getTile(n).tileSize,V=512/Math.min(U,512)*(n.overscaledZ/l.transform.zoom)*.5;let Y=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(Y+=` => ${n.overscaledZ}`),function(ie,se){ie.initDebugOverlayCanvas();const G=ie.debugOverlayCanvas,ue=ie.context.gl,ae=ie.debugOverlayCanvas.getContext("2d");ae.clearRect(0,0,G.width,G.height),ae.shadowColor="white",ae.shadowBlur=2,ae.lineWidth=1.5,ae.strokeStyle="white",ae.textBaseline="top",ae.font="bold 36px Open Sans, sans-serif",ae.fillText(se,5,5),ae.strokeText(se,5,5),ie.debugOverlayTexture.update(G),ie.debugOverlayTexture.bind(ue.LINEAR,ue.CLAMP_TO_EDGE)}(l,`${Y} ${N}kB`),f.draw(s,u.TRIANGLES,_,y,Ot.alphaBlended,Gt.disabled,Jn(d,a.Color.transparent,V),null,I,l.debugBuffer,l.quadTriangleIndexBuffer,l.debugSegments),f.draw(s,u.LINE_STRIP,_,y,w,Gt.disabled,Jn(d,a.Color.red),P,I,l.debugBuffer,l.tileBorderIndexBuffer,l.debugSegments)}function Go(l,t,n){const s=l.context,u=s.gl,d=l.colorModeForRenderPass(),f=new yt(u.LEQUAL,yt.ReadWrite,l.depthRangeFor3D),_=l.useProgram("terrain"),y=t.getTerrainMesh(),w=t.getTerrainData(n.tileID);s.bindFramebuffer.set(null),s.viewport.set([0,0,l.width,l.height]),s.activeTexture.set(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,t.getRTTFramebuffer().colorAttachment.get());const I=l.transform.calculatePosMatrix(n.tileID.toUnwrapped());_.draw(s,u.TRIANGLES,f,Bt.disabled,d,Gt.backCCW,{u_matrix:I,u_texture:0},w,"terrain",y.vertexBuffer,y.indexBuffer,y.segments)}function Ba(l,t,n,s){const u=l.context,d=n.tileSize*t.qualityFactor;n.textures[s]||(n.textures[s]=l.getTileTexture(d)||new Me(u,{width:d,height:d,data:null},u.gl.RGBA),n.textures[s].bind(u.gl.LINEAR,u.gl.CLAMP_TO_EDGE),s===0&&t.sourceCache.renderHistory.unshift(n.tileID.key));const f=t.getRTTFramebuffer();f.colorAttachment.set(n.textures[s].texture),u.bindFramebuffer.set(f.framebuffer),u.viewport.set([0,0,d,d])}class Fa{constructor(t){this._coordsDescendingInv={},this._coordsDescendingInvStr={},this.painter=t,this._renderToTexture={background:!0,fill:!0,line:!0,raster:!0},this._coordsDescendingInv={},this._coordsDescendingInvStr={},this._stacks=[],this._prevType=null,this._rerender={},this._renderableTiles=t.style.terrain.sourceCache.getRenderableTiles(),this._init()}_init(){const t=this.painter.style,n=t.terrain;for(const s in t.sourceCaches){this._coordsDescendingInv[s]={};const u=t.sourceCaches[s].getVisibleCoordinates();for(const d of u){const f=n.sourceCache.getTerrainCoords(d);for(const _ in f)this._coordsDescendingInv[s][_]||(this._coordsDescendingInv[s][_]=[]),this._coordsDescendingInv[s][_].push(f[_])}}for(const s of t._order){const u=t._layers[s],d=u.source;if(this._renderToTexture[u.type]&&!this._coordsDescendingInvStr[d]){this._coordsDescendingInvStr[d]={};for(const f in this._coordsDescendingInv[d])this._coordsDescendingInvStr[d][f]=this._coordsDescendingInv[d][f].map(_=>_.key).sort().join()}}return this._renderableTiles.forEach(s=>{for(const u in this._coordsDescendingInvStr){const d=this._coordsDescendingInvStr[u][s.tileID.key];d&&d!==s.textureCoords[u]&&s.clearTextures(this.painter),n.needsRerender(u,s.tileID)&&s.clearTextures(this.painter)}this._rerender[s.tileID.key]=!s.textures.length}),n.clearRerenderCache(),n.sourceCache.removeOutdated(this.painter),this}renderLayer(t){const n=t.type,s=this.painter,u=s.style._order,d=s.currentLayer,f=d+1===u.length;if(this._renderToTexture[n]&&(this._prevType&&this._renderToTexture[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(u[d]),!f))return!0;if(this._renderToTexture[this._prevType]||n==="hillshade"||this._renderToTexture[n]&&f){this._prevType=n;const _=this._stacks.length-1,y=this._stacks[_]||[];for(const w of this._renderableTiles){if(Ba(s,s.style.terrain,w,_),this._rerender[w.tileID.key]){s.context.clear({color:a.Color.transparent});for(let I=0;I<y.length;I++){const P=s.style._layers[y[I]],D=P.source?this._coordsDescendingInv[P.source][w.tileID.key]:[w.tileID];s._renderTileClippingMasks(P,D),s.renderLayer(s,s.style.sourceCaches[P.source],P,D),P.source&&(w.textureCoords[P.source]=this._coordsDescendingInvStr[P.source][w.tileID.key])}}Go(s,s.style.terrain,w)}if(n==="hillshade"){this._stacks.push([u[d]]);for(const w of this._renderableTiles){const I=this._coordsDescendingInv[t.source][w.tileID.key];Ba(s,s.style.terrain,w,this._stacks.length-1),s.context.clear({color:a.Color.transparent}),s._renderTileClippingMasks(t,I),s.renderLayer(s,s.style.sourceCaches[t.source],t,I),Go(s,s.style.terrain,w)}return!0}return this._renderToTexture[n]}return!1}}const ao={symbol:function(l,t,n,s,u){if(l.renderPass!=="translucent")return;const d=Bt.disabled,f=l.colorModeForRenderPass();n.layout.get("text-variable-anchor")&&function(_,y,w,I,P,D,N){const U=y.transform,V=P==="map",Y=D==="map";for(const ie of _){const se=I.getTile(ie),G=se.getBucket(w);if(!G||!G.text||!G.text.segments.get().length)continue;const ue=a.evaluateSizeForZoom(G.textSizeData,U.zoom),ae=Yt(se,1,y.transform.zoom),ge=Jr(ie.posMatrix,Y,V,y.transform,ae),_e=w.layout.get("icon-text-fit")!=="none"&&G.hasIconData();if(ue){const we=Math.pow(2,U.zoom-se.tileID.overscaledZ);ka(G,V,Y,N,U,ge,ie.posMatrix,we,ue,_e,y.style.terrain?(me,Oe)=>y.style.terrain.getElevation(ie,me,Oe):null)}}}(s,l,n,t,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),u),n.paint.get("icon-opacity").constantOr(1)!==0&&Uo(l,t,n,s,!1,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),n.layout.get("icon-rotation-alignment"),n.layout.get("icon-pitch-alignment"),n.layout.get("icon-keep-upright"),d,f),n.paint.get("text-opacity").constantOr(1)!==0&&Uo(l,t,n,s,!0,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),n.layout.get("text-keep-upright"),d,f),t.map.showCollisionBoxes&&(Dn(l,t,n,s,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),Dn(l,t,n,s,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))},circle:function(l,t,n,s){if(l.renderPass!=="translucent")return;const u=n.paint.get("circle-opacity"),d=n.paint.get("circle-stroke-width"),f=n.paint.get("circle-stroke-opacity"),_=!n.layout.get("circle-sort-key").isConstant();if(u.constantOr(1)===0&&(d.constantOr(1)===0||f.constantOr(1)===0))return;const y=l.context,w=y.gl,I=l.depthModeForSublayer(0,yt.ReadOnly),P=Bt.disabled,D=l.colorModeForRenderPass(),N=[];for(let U=0;U<s.length;U++){const V=s[U],Y=t.getTile(V),ie=Y.getBucket(n);if(!ie)continue;const se=ie.programConfigurations.get(n.id),G=l.useProgram("circle",se),ue=ie.layoutVertexBuffer,ae=ie.indexBuffer,ge=l.style.terrain&&l.style.terrain.getTerrainData(V),_e={programConfiguration:se,program:G,layoutVertexBuffer:ue,indexBuffer:ae,uniformValues:va(l,V,Y,n),terrainData:ge};if(_){const we=ie.segments.get();for(const me of we)N.push({segments:new a.SegmentVector([me]),sortKey:me.sortKey,state:_e})}else N.push({segments:ie.segments,sortKey:0,state:_e})}_&&N.sort((U,V)=>U.sortKey-V.sortKey);for(const U of N){const{programConfiguration:V,program:Y,layoutVertexBuffer:ie,indexBuffer:se,uniformValues:G,terrainData:ue}=U.state;Y.draw(y,w.TRIANGLES,I,P,D,Gt.disabled,G,ue,n.id,ie,se,U.segments,n.paint,l.transform.zoom,V)}},heatmap:function(l,t,n,s){if(n.paint.get("heatmap-opacity")!==0)if(l.renderPass==="offscreen"){const u=l.context,d=u.gl,f=Bt.disabled,_=new Ot([d.ONE,d.ONE],a.Color.transparent,[!0,!0,!0,!0]);(function(y,w,I){const P=y.gl;y.activeTexture.set(P.TEXTURE1),y.viewport.set([0,0,w.width/4,w.height/4]);let D=I.heatmapFbo;if(D)P.bindTexture(P.TEXTURE_2D,D.colorAttachment.get()),y.bindFramebuffer.set(D.framebuffer);else{const N=P.createTexture();P.bindTexture(P.TEXTURE_2D,N),P.texParameteri(P.TEXTURE_2D,P.TEXTURE_WRAP_S,P.CLAMP_TO_EDGE),P.texParameteri(P.TEXTURE_2D,P.TEXTURE_WRAP_T,P.CLAMP_TO_EDGE),P.texParameteri(P.TEXTURE_2D,P.TEXTURE_MIN_FILTER,P.LINEAR),P.texParameteri(P.TEXTURE_2D,P.TEXTURE_MAG_FILTER,P.LINEAR),D=I.heatmapFbo=y.createFramebuffer(w.width/4,w.height/4,!1),function(U,V,Y,ie){const se=U.gl;se.texImage2D(se.TEXTURE_2D,0,se.RGBA,V.width/4,V.height/4,0,se.RGBA,U.extRenderToTextureHalfFloat?U.extTextureHalfFloat.HALF_FLOAT_OES:se.UNSIGNED_BYTE,null),ie.colorAttachment.set(Y)}(y,w,N,D)}})(u,l,n),u.clear({color:a.Color.transparent});for(let y=0;y<s.length;y++){const w=s[y];if(t.hasRenderableParent(w))continue;const I=t.getTile(w),P=I.getBucket(n);if(!P)continue;const D=P.programConfigurations.get(n.id),N=l.useProgram("heatmap",D),{zoom:U}=l.transform;N.draw(u,d.TRIANGLES,yt.disabled,f,_,Gt.disabled,Po(w.posMatrix,I,U,n.paint.get("heatmap-intensity")),null,n.id,P.layoutVertexBuffer,P.indexBuffer,P.segments,n.paint,l.transform.zoom,D)}u.viewport.set([0,0,l.width,l.height])}else l.renderPass==="translucent"&&(l.context.setColorMode(l.colorModeForRenderPass()),function(u,d){const f=u.context,_=f.gl,y=d.heatmapFbo;if(!y)return;f.activeTexture.set(_.TEXTURE0),_.bindTexture(_.TEXTURE_2D,y.colorAttachment.get()),f.activeTexture.set(_.TEXTURE1);let w=d.colorRampTexture;w||(w=d.colorRampTexture=new Me(f,d.colorRamp,_.RGBA)),w.bind(_.LINEAR,_.CLAMP_TO_EDGE),u.useProgram("heatmapTexture").draw(f,_.TRIANGLES,yt.disabled,Bt.disabled,u.colorModeForRenderPass(),Gt.disabled,((I,P,D,N)=>{const U=a.create();a.ortho(U,0,I.width,I.height,0,0,1);const V=I.context.gl;return{u_matrix:U,u_world:[V.drawingBufferWidth,V.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:P.paint.get("heatmap-opacity")}})(u,d),null,d.id,u.viewportBuffer,u.quadTriangleIndexBuffer,u.viewportSegments,d.paint,u.transform.zoom)}(l,n))},line:function(l,t,n,s){if(l.renderPass!=="translucent")return;const u=n.paint.get("line-opacity"),d=n.paint.get("line-width");if(u.constantOr(1)===0||d.constantOr(1)===0)return;const f=l.depthModeForSublayer(0,yt.ReadOnly),_=l.colorModeForRenderPass(),y=n.paint.get("line-dasharray"),w=n.paint.get("line-pattern"),I=w.constantOr(1),P=n.paint.get("line-gradient"),D=n.getCrossfadeParameters(),N=I?"linePattern":y?"lineSDF":P?"lineGradient":"line",U=l.context,V=U.gl;let Y=!0;for(const ie of s){const se=t.getTile(ie);if(I&&!se.patternsLoaded())continue;const G=se.getBucket(n);if(!G)continue;const ue=G.programConfigurations.get(n.id),ae=l.context.program.get(),ge=l.useProgram(N,ue),_e=Y||ge.program!==ae,we=l.style.terrain&&l.style.terrain.getTerrainData(ie),me=w.constantOr(null);if(me&&se.imageAtlas){const $e=se.imageAtlas,lt=$e.patternPositions[me.to.toString()],dt=$e.patternPositions[me.from.toString()];lt&&dt&&ue.setConstantPatternPositions(lt,dt)}const Oe=we?ie:null,Ce=I?ko(l,se,n,D,Oe):y?Yn(l,se,n,y,D,Oe):P?ds(l,se,n,G.lineClipsArray.length,Oe):Mn(l,se,n,Oe);if(I)U.activeTexture.set(V.TEXTURE0),se.imageAtlasTexture.bind(V.LINEAR,V.CLAMP_TO_EDGE),ue.updatePaintBuffers(D);else if(y&&(_e||l.lineAtlas.dirty))U.activeTexture.set(V.TEXTURE0),l.lineAtlas.bind(U);else if(P){const $e=G.gradients[n.id];let lt=$e.texture;if(n.gradientVersion!==$e.version){let dt=256;if(n.stepInterpolant){const We=t.getSource().maxzoom,Mt=ie.canonical.z===We?Math.ceil(1<<l.transform.maxZoom-ie.canonical.z):1;dt=a.clamp(a.nextPowerOfTwo(G.maxLineLength/a.EXTENT*1024*Mt),256,U.maxTextureSize)}$e.gradient=a.renderColorRamp({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:dt,image:$e.gradient||void 0,clips:G.lineClipsArray}),$e.texture?$e.texture.update($e.gradient):$e.texture=new Me(U,$e.gradient,V.RGBA),$e.version=n.gradientVersion,lt=$e.texture}U.activeTexture.set(V.TEXTURE0),lt.bind(n.stepInterpolant?V.NEAREST:V.LINEAR,V.CLAMP_TO_EDGE)}ge.draw(U,V.TRIANGLES,f,l.stencilModeForClipping(ie),_,Gt.disabled,Ce,we,n.id,G.layoutVertexBuffer,G.indexBuffer,G.segments,n.paint,l.transform.zoom,ue,G.layoutVertexBuffer2),Y=!1}},fill:function(l,t,n,s){const u=n.paint.get("fill-color"),d=n.paint.get("fill-opacity");if(d.constantOr(1)===0)return;const f=l.colorModeForRenderPass(),_=n.paint.get("fill-pattern"),y=l.opaquePassEnabledForLayer()&&!_.constantOr(1)&&u.constantOr(a.Color.transparent).a===1&&d.constantOr(0)===1?"opaque":"translucent";if(l.renderPass===y){const w=l.depthModeForSublayer(1,l.renderPass==="opaque"?yt.ReadWrite:yt.ReadOnly);no(l,t,n,s,w,f,!1)}if(l.renderPass==="translucent"&&n.paint.get("fill-antialias")){const w=l.depthModeForSublayer(n.getPaintProperty("fill-outline-color")?2:0,yt.ReadOnly);no(l,t,n,s,w,f,!0)}},"fill-extrusion":function(l,t,n,s){const u=n.paint.get("fill-extrusion-opacity");if(u!==0&&l.renderPass==="translucent"){const d=new yt(l.context.gl.LEQUAL,yt.ReadWrite,l.depthRangeFor3D);if(u!==1||n.paint.get("fill-extrusion-pattern").constantOr(1))oo(l,t,n,s,d,Bt.disabled,Ot.disabled),oo(l,t,n,s,d,l.stencilModeFor3D(),l.colorModeForRenderPass());else{const f=l.colorModeForRenderPass();oo(l,t,n,s,d,Bt.disabled,f)}}},hillshade:function(l,t,n,s){if(l.renderPass!=="offscreen"&&l.renderPass!=="translucent")return;const u=l.context,d=l.depthModeForSublayer(0,yt.ReadOnly),f=l.colorModeForRenderPass(),[_,y]=l.renderPass==="translucent"?l.stencilConfigForOverlap(s):[{},s];for(const w of y){const I=t.getTile(w);I.needsHillshadePrepare!==void 0&&I.needsHillshadePrepare&&l.renderPass==="offscreen"?Da(l,I,n,d,Bt.disabled,f):l.renderPass==="translucent"&&Is(l,w,I,n,d,_[w.overscaledZ],f)}u.viewport.set([0,0,l.width,l.height])},raster:function(l,t,n,s){if(l.renderPass!=="translucent"||n.paint.get("raster-opacity")===0||!s.length)return;const u=l.context,d=u.gl,f=t.getSource(),_=l.useProgram("raster"),y=l.colorModeForRenderPass(),[w,I]=f instanceof Ai?[{},s]:l.stencilConfigForOverlap(s),P=I[I.length-1].overscaledZ,D=!l.options.moving;for(const N of I){const U=l.depthModeForSublayer(N.overscaledZ-P,n.paint.get("raster-opacity")===1?yt.ReadWrite:yt.ReadOnly,d.LESS),V=t.getTile(N);V.registerFadeDuration(n.paint.get("raster-fade-duration"));const Y=t.findLoadedParent(N,0),ie=Vo(V,Y,t,n,l.transform,l.style.terrain);let se,G;const ue=n.paint.get("raster-resampling")==="nearest"?d.NEAREST:d.LINEAR;u.activeTexture.set(d.TEXTURE0),V.texture.bind(ue,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST),u.activeTexture.set(d.TEXTURE1),Y?(Y.texture.bind(ue,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST),se=Math.pow(2,Y.tileID.overscaledZ-V.tileID.overscaledZ),G=[V.tileID.canonical.x*se%1,V.tileID.canonical.y*se%1]):V.texture.bind(ue,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST);const ae=l.style.terrain&&l.style.terrain.getTerrainData(N),ge=ae?N:null,_e=ge?ge.posMatrix:l.transform.calculatePosMatrix(N.toUnwrapped(),D),we=ba(_e,G||[0,0],se||1,ie,n);f instanceof Ai?_.draw(u,d.TRIANGLES,U,Bt.disabled,y,Gt.disabled,we,ae,n.id,f.boundsBuffer,l.quadTriangleIndexBuffer,f.boundsSegments):_.draw(u,d.TRIANGLES,U,w[N.overscaledZ],y,Gt.disabled,we,ae,n.id,l.rasterBoundsBuffer,l.quadTriangleIndexBuffer,l.rasterBoundsSegments)}},background:function(l,t,n,s){const u=n.paint.get("background-color"),d=n.paint.get("background-opacity");if(d===0)return;const f=l.context,_=f.gl,y=l.transform,w=y.tileSize,I=n.paint.get("background-pattern");if(l.isPatternMissing(I))return;const P=!I&&u.a===1&&d===1&&l.opaquePassEnabledForLayer()?"opaque":"translucent";if(l.renderPass!==P)return;const D=Bt.disabled,N=l.depthModeForSublayer(0,P==="opaque"?yt.ReadWrite:yt.ReadOnly),U=l.colorModeForRenderPass(),V=l.useProgram(I?"backgroundPattern":"background"),Y=s||y.coveringTiles({tileSize:w,terrain:l.style.terrain});I&&(f.activeTexture.set(_.TEXTURE0),l.imageManager.bind(l.context));const ie=n.getCrossfadeParameters();for(const se of Y){const G=s?se.posMatrix:l.transform.calculatePosMatrix(se.toUnwrapped()),ue=I?$l(G,d,l,I,{tileID:se,tileSize:w},ie):Ol(G,d,u),ae=l.style.terrain&&l.style.terrain.getTerrainData(se);V.draw(f,_.TRIANGLES,N,D,U,Gt.disabled,ue,ae,n.id,l.tileExtentBuffer,l.quadTriangleIndexBuffer,l.tileExtentSegments)}},debug:function(l,t,n){for(let s=0;s<n.length;s++)Kl(l,t,n[s])},custom:function(l,t,n){const s=l.context,u=n.implementation;if(l.renderPass==="offscreen"){const d=u.prerender;d&&(l.setCustomLayerDefaults(),s.setColorMode(l.colorModeForRenderPass()),d.call(u,s.gl,l.transform.customLayerMatrix()),s.setDirty(),l.setBaseState())}else if(l.renderPass==="translucent"){l.setCustomLayerDefaults(),s.setColorMode(l.colorModeForRenderPass()),s.setStencilMode(Bt.disabled);const d=u.renderingMode==="3d"?new yt(l.context.gl.LEQUAL,yt.ReadWrite,l.depthRangeFor3D):l.depthModeForSublayer(0,yt.ReadOnly);s.setDepthMode(d),u.render(s.gl,l.transform.customLayerMatrix()),s.setDirty(),l.setBaseState(),s.bindFramebuffer.set(null)}}};class As{constructor(t,n){this.context=new za(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:a.create(),renderTime:0},this.setup(),this.numSublayers=Mi.maxUnderzooming+Mi.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new it,this.gpuTimers={}}resize(t,n,s){if(this.width=t*s,this.height=n*s,this.pixelRatio=s,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const u of this.style._order)this.style._layers[u].resize()}setup(){const t=this.context,n=new a.PosArray;n.emplaceBack(0,0),n.emplaceBack(a.EXTENT,0),n.emplaceBack(0,a.EXTENT),n.emplaceBack(a.EXTENT,a.EXTENT),this.tileExtentBuffer=t.createVertexBuffer(n,wt.members),this.tileExtentSegments=a.SegmentVector.simpleSegment(0,0,4,2);const s=new a.PosArray;s.emplaceBack(0,0),s.emplaceBack(a.EXTENT,0),s.emplaceBack(0,a.EXTENT),s.emplaceBack(a.EXTENT,a.EXTENT),this.debugBuffer=t.createVertexBuffer(s,wt.members),this.debugSegments=a.SegmentVector.simpleSegment(0,0,4,5);const u=new a.RasterBoundsArray;u.emplaceBack(0,0,0,0),u.emplaceBack(a.EXTENT,0,a.EXTENT,0),u.emplaceBack(0,a.EXTENT,0,a.EXTENT),u.emplaceBack(a.EXTENT,a.EXTENT,a.EXTENT,a.EXTENT),this.rasterBoundsBuffer=t.createVertexBuffer(u,Hi.members),this.rasterBoundsSegments=a.SegmentVector.simpleSegment(0,0,4,2);const d=new a.PosArray;d.emplaceBack(0,0),d.emplaceBack(1,0),d.emplaceBack(0,1),d.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(d,wt.members),this.viewportSegments=a.SegmentVector.simpleSegment(0,0,4,2);const f=new a.LineStripIndexArray;f.emplaceBack(0),f.emplaceBack(1),f.emplaceBack(3),f.emplaceBack(2),f.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(f);const _=new a.TriangleIndexArray;_.emplaceBack(0,1,2),_.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(_),this.emptyTexture=new Me(t,{width:1,height:1,data:new Uint8Array([0,0,0,0])},t.gl.RGBA);const y=this.context.gl;this.stencilClearMode=new Bt({func:y.ALWAYS,mask:0},0,255,y.ZERO,y.ZERO,y.ZERO)}clearStencil(){const t=this.context,n=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const s=a.create();a.ortho(s,0,this.width,this.height,0,0,1),a.scale(s,s,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,n.TRIANGLES,yt.disabled,this.stencilClearMode,Ot.disabled,Gt.disabled,An(s),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,n){if(this.currentStencilSource===t.source||!t.isTileClipped()||!n||!n.length)return;this.currentStencilSource=t.source;const s=this.context,u=s.gl;this.nextStencilID+n.length>256&&this.clearStencil(),s.setColorMode(Ot.disabled),s.setDepthMode(yt.disabled);const d=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const f of n){const _=this._tileClippingMaskIDs[f.key]=this.nextStencilID++,y=this.style.terrain&&this.style.terrain.getTerrainData(f);d.draw(s,u.TRIANGLES,yt.disabled,new Bt({func:u.ALWAYS,mask:0},_,255,u.KEEP,u.KEEP,u.REPLACE),Ot.disabled,Gt.disabled,An(f.posMatrix),y,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new Bt({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new Bt({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(t){const n=this.context.gl,s=t.sort((f,_)=>_.overscaledZ-f.overscaledZ),u=s[s.length-1].overscaledZ,d=s[0].overscaledZ-u+1;if(d>1){this.currentStencilSource=void 0,this.nextStencilID+d>256&&this.clearStencil();const f={};for(let _=0;_<d;_++)f[_+u]=new Bt({func:n.GEQUAL,mask:255},_+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=d,[f,s]}return[{[u]:Bt.disabled},s]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new Ot([t.CONSTANT_COLOR,t.ONE],new a.Color(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Ot.unblended:Ot.alphaBlended}depthModeForSublayer(t,n,s){if(!this.opaquePassEnabledForLayer())return yt.disabled;const u=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new yt(s||this.context.gl.LEQUAL,n,[u,u])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,n){this.style=t,this.options=n,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(a.exported.now()),this.imageManager.beginFrame();const s=this.style._order,u=this.style.sourceCaches,d=this.style.terrain&&new Fa(this);for(const w in u){const I=u[w];I.used&&I.prepare(this.context)}const f={},_={},y={};for(const w in u){const I=u[w];f[w]=I.getVisibleCoordinates(),_[w]=f[w].slice().reverse(),y[w]=I.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let w=0;w<s.length;w++)if(this.style._layers[s[w]].is3D()){this.opaquePassCutoff=w;break}if(d){this.opaquePassCutoff=0;const w=this.style.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime);(this.terrainFacilitator.dirty||!a.equals(this.terrainFacilitator.matrix,this.transform.projMatrix)||w.length)&&(a.copy(this.terrainFacilitator.matrix,this.transform.projMatrix),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(I,P){const D=I.context,N=D.gl,U=Ot.unblended,V=new yt(N.LEQUAL,yt.ReadWrite,[0,1]),Y=P.getTerrainMesh(),ie=P.sourceCache.getRenderableTiles(),se=I.useProgram("terrainDepth");D.bindFramebuffer.set(P.getFramebuffer("depth").framebuffer),D.viewport.set([0,0,I.width/devicePixelRatio,I.height/devicePixelRatio]),D.clear({color:a.Color.transparent,depth:1});for(const G of ie){const ue=P.getTerrainData(G.tileID),ae=I.transform.calculatePosMatrix(G.tileID.toUnwrapped());se.draw(D,N.TRIANGLES,V,Bt.disabled,U,Gt.backCCW,{u_matrix:ae},ue,"terrain",Y.vertexBuffer,Y.indexBuffer,Y.segments)}D.bindFramebuffer.set(null),D.viewport.set([0,0,I.width,I.height])}(this,this.style.terrain),function(I,P){const D=I.context,N=D.gl,U=Ot.unblended,V=new yt(N.LEQUAL,yt.ReadWrite,[0,1]),Y=P.getTerrainMesh(),ie=P.getCoordsTexture(),se=P.sourceCache.getRenderableTiles(),G=I.useProgram("terrainCoords");D.bindFramebuffer.set(P.getFramebuffer("coords").framebuffer),D.viewport.set([0,0,I.width/devicePixelRatio,I.height/devicePixelRatio]),D.clear({color:a.Color.transparent,depth:1}),P.coordsIndex=[];for(const ue of se){const ae=P.getTerrainData(ue.tileID);D.activeTexture.set(N.TEXTURE0),N.bindTexture(N.TEXTURE_2D,ie.texture);const ge=I.transform.calculatePosMatrix(ue.tileID.toUnwrapped());G.draw(D,N.TRIANGLES,V,Bt.disabled,U,Gt.backCCW,{u_matrix:ge,u_terrain_coords_id:(255-P.coordsIndex.length)/255,u_texture:0},ae,"terrain",Y.vertexBuffer,Y.indexBuffer,Y.segments),P.coordsIndex.push(ue.tileID.key)}D.bindFramebuffer.set(null),D.viewport.set([0,0,I.width,I.height])}(this,this.style.terrain))}this.renderPass="offscreen";for(const w of s){const I=this.style._layers[w];if(!I.hasOffscreenPass()||I.isHidden(this.transform.zoom))continue;const P=_[I.source];(I.type==="custom"||P.length)&&this.renderLayer(this,u[I.source],I,P)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?a.Color.black:a.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!d)for(this.renderPass="opaque",this.currentLayer=s.length-1;this.currentLayer>=0;this.currentLayer--){const w=this.style._layers[s[this.currentLayer]],I=u[w.source],P=f[w.source];this._renderTileClippingMasks(w,P),this.renderLayer(this,I,w,P)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<s.length;this.currentLayer++){const w=this.style._layers[s[this.currentLayer]],I=u[w.source];if(d&&d.renderLayer(w))continue;const P=(w.type==="symbol"?y:_)[w.source];this._renderTileClippingMasks(w,f[w.source]),this.renderLayer(this,I,w,P)}if(this.options.showTileBoundaries){let w,I;Object.values(this.style._layers).forEach(P=>{P.source&&!P.isHidden(this.transform.zoom)&&(P.source!==(I&&I.id)&&(I=this.style.sourceCaches[P.source]),(!w||w.getSource().maxzoom<I.getSource().maxzoom)&&(w=I))}),w&&ao.debug(this,w,w.getVisibleCoordinates())}this.options.showPadding&&function(w){const I=w.transform.padding;nn(w,w.transform.height-(I.top||0),3,No),nn(w,I.bottom||0,3,nr),so(w,I.left||0,3,La),so(w,w.transform.width-(I.right||0),3,Cs);const P=w.transform.centerPoint;(function(D,N,U,V){Ln(D,N-1,U-10,2,20,V),Ln(D,N-10,U-1,20,2,V)})(w,P.x,w.transform.height-P.y,Ra)}(this),this.context.setDefault()}renderLayer(t,n,s,u){s.isHidden(this.transform.zoom)||(s.type==="background"||s.type==="custom"||(u||[]).length)&&(this.id=s.id,this.gpuTimingStart(s),ao[s.type](t,n,s,u,this.style.placement.variableOffsets),this.gpuTimingEnd())}gpuTimingStart(t){if(!this.options.gpuTiming)return;const n=this.context.extTimerQuery;let s=this.gpuTimers[t.id];s||(s=this.gpuTimers[t.id]={calls:0,cpuTime:0,query:n.createQueryEXT()}),s.calls++,n.beginQueryEXT(n.TIME_ELAPSED_EXT,s.query)}gpuTimingEnd(){if(!this.options.gpuTiming)return;const t=this.context.extTimerQuery;t.endQueryEXT(t.TIME_ELAPSED_EXT)}collectGpuTimers(){const t=this.gpuTimers;return this.gpuTimers={},t}queryGpuTimers(t){const n={};for(const s in t){const u=t[s],d=this.context.extTimerQuery,f=d.getQueryObjectEXT(u.query,d.QUERY_RESULT_EXT)/1e6;d.deleteQueryEXT(u.query),n[s]=f}return n}translatePosMatrix(t,n,s,u,d){if(!s[0]&&!s[1])return t;const f=d?u==="map"?this.transform.angle:0:u==="viewport"?-this.transform.angle:0;if(f){const w=Math.sin(f),I=Math.cos(f);s=[s[0]*I-s[1]*w,s[0]*w+s[1]*I]}const _=[d?s[0]:Yt(n,s[0],this.transform.zoom),d?s[1]:Yt(n,s[1],this.transform.zoom),0],y=new Float32Array(16);return a.translate(y,t,_),y}saveTileTexture(t){const n=this._tileTextures[t.size[0]];n?n.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const n=this._tileTextures[t];return n&&n.length>0?n.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const n=this.imageManager.getPattern(t.from.toString()),s=this.imageManager.getPattern(t.to.toString());return!n||!s}useProgram(t,n){this.cache=this.cache||{};const s=t+(n?n.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.terrain?"/terrain":"");return this.cache[s]||(this.cache[s]=new ga(this.context,t,Kn[t],n,fs[t],this._showOverdrawInspector,this.style.terrain)),this.cache[s]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const 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 Me(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}}class Zo{constructor(t,n){this.points=t,this.planes=n}static fromInvProjectionMatrix(t,n,s){const u=Math.pow(2,s),d=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(_=>{const y=1/(_=a.transformMat4([],_,t))[3]/n*u;return a.mul$1(_,_,[y,y,1/_[3],y])}),f=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(_=>{const y=a.sub([],d[_[0]],d[_[1]]),w=a.sub([],d[_[2]],d[_[1]]),I=a.normalize([],a.cross([],y,w)),P=-a.dot(I,d[_[1]]);return I.concat(P)});return new Zo(d,f)}}class lo{constructor(t,n){this.min=t,this.max=n,this.center=a.scale$1([],a.add([],this.min,this.max),.5)}quadrant(t){const n=[t%2==0,t<2],s=a.clone$2(this.min),u=a.clone$2(this.max);for(let d=0;d<n.length;d++)s[d]=n[d]?this.min[d]:this.center[d],u[d]=n[d]?this.center[d]:this.max[d];return u[2]=this.max[2],new lo(s,u)}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]}intersects(t){const n=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]];let s=!0;for(let u=0;u<t.planes.length;u++){const d=t.planes[u];let f=0;for(let _=0;_<n.length;_++)a.dot$1(d,n[_])>=0&&f++;if(f===0)return 0;f!==n.length&&(s=!1)}if(s)return 2;for(let u=0;u<3;u++){let d=Number.MAX_VALUE,f=-Number.MAX_VALUE;for(let _=0;_<t.points.length;_++){const y=t.points[_][u]-this.min[u];d=Math.min(d,y),f=Math.max(f,y)}if(f<0||d>this.max[u]-this.min[u])return 0}return 1}}class Rn{constructor(t=0,n=0,s=0,u=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(s)||s<0||isNaN(u)||u<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=n,this.left=s,this.right=u}interpolate(t,n,s){return n.top!=null&&t.top!=null&&(this.top=a.number(t.top,n.top,s)),n.bottom!=null&&t.bottom!=null&&(this.bottom=a.number(t.bottom,n.bottom,s)),n.left!=null&&t.left!=null&&(this.left=a.number(t.left,n.left,s)),n.right!=null&&t.right!=null&&(this.right=a.number(t.right,n.right,s)),this}getCenter(t,n){const s=a.clamp((this.left+t-this.right)/2,0,t),u=a.clamp((this.top+n-this.bottom)/2,0,n);return new a.pointGeometry(s,u)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Rn(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class co{constructor(t,n,s,u,d){this.tileSize=512,this.maxValidLatitude=85.051129,this.freezeElevation=!1,this._renderWorldCopies=d===void 0||!!d,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=s==null?0:s,this._maxPitch=u==null?60:u,this.setMaxBounds(),this.width=0,this.height=0,this._center=new a.LngLat(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Rn,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){const t=new co(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.tileSize=this.tileSize,t.latRange=this.latRange,t.width=this.width,t.height=this.height,t._center=this._center,t._elevation=this._elevation,t.zoom=this.zoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._calcMatrices(),t}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new a.pointGeometry(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const n=-a.wrap(t,-180,180)*Math.PI/180;var s;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=(s=new a.ARRAY_TYPE(4),a.ARRAY_TYPE!=Float32Array&&(s[1]=0,s[2]=0),s[0]=1,s[3]=1,s),function(u,d,f){var _=d[0],y=d[1],w=d[2],I=d[3],P=Math.sin(f),D=Math.cos(f);u[0]=_*D+w*P,u[1]=y*D+I*P,u[2]=_*-P+w*D,u[3]=y*-P+I*D}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=a.clamp(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const n=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==n&&(this._unmodified=!1,this._zoom=n,this.scale=this.zoomScale(n),this.tileZoom=Math.floor(n),this.zoomFraction=n-this.tileZoom,this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,n,s){this._unmodified=!1,this._edgeInsets.interpolate(t,n,s),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const n=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(t){const n=[new a.UnwrappedTileID(0,t)];if(this._renderWorldCopies){const s=this.pointCoordinate(new a.pointGeometry(0,0)),u=this.pointCoordinate(new a.pointGeometry(this.width,0)),d=this.pointCoordinate(new a.pointGeometry(this.width,this.height)),f=this.pointCoordinate(new a.pointGeometry(0,this.height)),_=Math.floor(Math.min(s.x,u.x,d.x,f.x)),y=Math.floor(Math.max(s.x,u.x,d.x,f.x)),w=1;for(let I=_-w;I<=y+w;I++)I!==0&&n.push(new a.UnwrappedTileID(I,t))}return n}coveringTiles(t){var n,s;let u=this.coveringZoomLevel(t);const d=u;if(t.minzoom!==void 0&&u<t.minzoom)return[];t.maxzoom!==void 0&&u>t.maxzoom&&(u=t.maxzoom);const f=this.pointCoordinate(this.getCameraPoint()),_=a.MercatorCoordinate.fromLngLat(this.center),y=Math.pow(2,u),w=[y*f.x,y*f.y,0],I=[y*_.x,y*_.y,0],P=Zo.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,u);let D=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(D=u);const N=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,U=G=>({aabb:new lo([G*y,0,0],[(G+1)*y,y,0]),zoom:0,x:0,y:0,wrap:G,fullyVisible:!1}),V=[],Y=[],ie=u,se=t.reparseOverscaled?d:u;if(this._renderWorldCopies)for(let G=1;G<=3;G++)V.push(U(-G)),V.push(U(G));for(V.push(U(0));V.length>0;){const G=V.pop(),ue=G.x,ae=G.y;let ge=G.fullyVisible;if(!ge){const $e=G.aabb.intersects(P);if($e===0)continue;ge=$e===2}const _e=t.terrain?w:I,we=G.aabb.distanceX(_e),me=G.aabb.distanceY(_e),Oe=Math.max(Math.abs(we),Math.abs(me)),Ce=N+(1<<ie-G.zoom)-2;if(G.zoom===ie||Oe>Ce&&G.zoom>=D){const $e=ie-G.zoom,lt=w[0]-.5-(ue<<$e),dt=w[1]-.5-(ae<<$e);Y.push({tileID:new a.OverscaledTileID(G.zoom===ie?se:G.zoom,G.wrap,G.zoom,ue,ae),distanceSq:a.sqrLen([I[0]-.5-ue,I[1]-.5-ae]),tileDistanceToCamera:Math.sqrt(lt*lt+dt*dt)})}else for(let $e=0;$e<4;$e++){const lt=(ue<<1)+$e%2,dt=(ae<<1)+($e>>1),We=G.zoom+1;let Mt=G.aabb.quadrant($e);if(t.terrain){const Pt=new a.OverscaledTileID(We,G.wrap,We,lt,dt),xt=t.terrain.getMinMaxElevation(Pt),Et=(n=xt.minElevation)!==null&&n!==void 0?n:this.elevation,kt=(s=xt.maxElevation)!==null&&s!==void 0?s:this.elevation;Mt=new lo([Mt.min[0],Mt.min[1],Et],[Mt.max[0],Mt.max[1],kt])}V.push({aabb:Mt,zoom:We,x:lt,y:dt,wrap:G.wrap,fullyVisible:ge})}}return Y.sort((G,ue)=>G.distanceSq-ue.distanceSq).map(G=>G.tileID)}resize(t,n){this.width=t,this.height=n,this.pixelsToGLUnits=[2/t,-2/n],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const n=a.clamp(t.lat,-this.maxValidLatitude,this.maxValidLatitude);return new a.pointGeometry(a.mercatorXfromLng(t.lng)*this.worldSize,a.mercatorYfromLat(n)*this.worldSize)}unproject(t){return new a.MercatorCoordinate(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}updateElevation(t){this.freezeElevation||(this.elevation=t?this.getElevation(this._center,t):0)}getElevation(t,n){const s=a.MercatorCoordinate.fromLngLat(t),u=(1<<this.tileZoom)*a.EXTENT,d=s.x*u,f=s.y*u,_=Math.floor(d/a.EXTENT),y=Math.floor(f/a.EXTENT),w=new a.OverscaledTileID(this.tileZoom,0,this.tileZoom,_,y);return n.getElevation(w,d%a.EXTENT,f%a.EXTENT,a.EXTENT)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(t){const n=this.pointLocation(this.centerPoint,t),s=this.getElevation(n,t);if(!(this.elevation-s))return;const u=this.getCameraPosition(),d=a.MercatorCoordinate.fromLngLat(u.lngLat,u.altitude),f=a.MercatorCoordinate.fromLngLat(n,s),_=d.x-f.x,y=d.y-f.y,w=d.z-f.z,I=Math.sqrt(_*_+y*y+w*w),P=this.scaleZoom(this.cameraToCenterDistance/I/this.tileSize);this._elevation=s,this._center=n,this.zoom=P}setLocationAtPoint(t,n){const s=this.pointCoordinate(n),u=this.pointCoordinate(this.centerPoint),d=this.locationCoordinate(t),f=new a.MercatorCoordinate(d.x-(s.x-u.x),d.y-(s.y-u.y));this.center=this.coordinateLocation(f),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,n){return n?this.coordinatePoint(this.locationCoordinate(t),this.getElevation(t,n),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,n){return this.coordinateLocation(this.pointCoordinate(t,n))}locationCoordinate(t){return a.MercatorCoordinate.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,n){if(n){const D=n.pointCoordinate(t);if(D!=null)return D}const s=[t.x,t.y,0,1],u=[t.x,t.y,1,1];a.transformMat4(s,s,this.pixelMatrixInverse),a.transformMat4(u,u,this.pixelMatrixInverse);const d=s[3],f=u[3],_=s[1]/d,y=u[1]/f,w=s[2]/d,I=u[2]/f,P=w===I?0:(0-w)/(I-w);return new a.MercatorCoordinate(a.number(s[0]/d,u[0]/f,P)/this.worldSize,a.number(_,y,P)/this.worldSize)}coordinatePoint(t,n=0,s=this.pixelMatrix){const u=[t.x*this.worldSize,t.y*this.worldSize,n,1];return a.transformMat4(u,u,s),new a.pointGeometry(u[0]/u[3],u[1]/u[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return new a.LngLatBounds().extend(this.pointLocation(new a.pointGeometry(0,t))).extend(this.pointLocation(new a.pointGeometry(this.width,t))).extend(this.pointLocation(new a.pointGeometry(this.width,this.height))).extend(this.pointLocation(new a.pointGeometry(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new a.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(t,n=!1){const s=t.key,u=n?this._alignedPosMatrixCache:this._posMatrixCache;if(u[s])return u[s];const d=t.canonical,f=this.worldSize/this.zoomScale(d.z),_=d.x+Math.pow(2,d.z)*t.wrap,y=a.identity(new Float64Array(16));return a.translate(y,y,[_*f,d.y*f,0]),a.scale(y,y,[f/a.EXTENT,f/a.EXTENT,1]),a.multiply(y,n?this.alignedProjMatrix:this.projMatrix,y),u[s]=new Float32Array(y),u[s]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let t,n,s,u,d=-90,f=90,_=-180,y=180;const w=this.size,I=this._unmodified;if(this.latRange){const N=this.latRange;d=a.mercatorYfromLat(N[1])*this.worldSize,f=a.mercatorYfromLat(N[0])*this.worldSize,t=f-d<w.y?w.y/(f-d):0}if(this.lngRange){const N=this.lngRange;_=a.wrap(a.mercatorXfromLng(N[0])*this.worldSize,0,this.worldSize),y=a.wrap(a.mercatorXfromLng(N[1])*this.worldSize,0,this.worldSize),y<_&&(y+=this.worldSize),n=y-_<w.x?w.x/(y-_):0}const P=this.point,D=Math.max(n||0,t||0);if(D)return this.center=this.unproject(new a.pointGeometry(n?(y+_)/2:P.x,t?(f+d)/2:P.y)),this.zoom+=this.scaleZoom(D),this._unmodified=I,void(this._constraining=!1);if(this.latRange){const N=P.y,U=w.y/2;N-U<d&&(u=d+U),N+U>f&&(u=f-U)}if(this.lngRange){const N=(_+y)/2,U=a.wrap(P.x,N-this.worldSize/2,N+this.worldSize/2),V=w.x/2;U-V<_&&(s=_+V),U+V>y&&(s=y-V)}s===void 0&&u===void 0||(this.center=this.unproject(new a.pointGeometry(s!==void 0?s:P.x,u!==void 0?u:P.y)).wrap()),this._unmodified=I,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,n=this.point.x,s=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=a.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let u=a.identity(new Float64Array(16));a.scale(u,u,[this.width/2,-this.height/2,1]),a.translate(u,u,[1,-1,0]),this.labelPlaneMatrix=u,u=a.identity(new Float64Array(16)),a.scale(u,u,[1,-1,1]),a.translate(u,u,[-1,-1,0]),a.scale(u,u,[2/this.width,2/this.height,1]),this.glCoordMatrix=u,this.cameraToSeaLevelDistance=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch);const d=Math.PI/2+this._pitch,f=this._fov*(.5+t.y/this.height),_=Math.sin(f)*this.cameraToSeaLevelDistance/Math.sin(a.clamp(Math.PI-d-f,.01,Math.PI-.01)),y=this.getHorizon(),w=2*Math.atan(y/this.cameraToCenterDistance)*(.5+t.y/(2*y)),I=Math.sin(w)*this.cameraToSeaLevelDistance/Math.sin(a.clamp(Math.PI-d-w,.01,Math.PI-.01)),P=Math.cos(Math.PI/2-this._pitch)*_+this.cameraToSeaLevelDistance,D=Math.cos(Math.PI/2-this._pitch)*I+this.cameraToSeaLevelDistance,N=1.01*Math.min(P,D),U=this.height/50;u=new Float64Array(16),a.perspective(u,this._fov,this.width/this.height,U,N),u[8]=2*-t.x/this.width,u[9]=2*t.y/this.height,a.scale(u,u,[1,-1,1]),a.translate(u,u,[0,0,-this.cameraToCenterDistance]),a.rotateX(u,u,this._pitch),a.rotateZ(u,u,this.angle),a.translate(u,u,[-n,-s,0]),this.mercatorMatrix=a.scale([],u,[this.worldSize,this.worldSize,this.worldSize]),a.scale(u,u,[1,1,this._pixelPerMeter]),this.pixelMatrix=a.multiply(new Float64Array(16),this.labelPlaneMatrix,u),a.translate(u,u,[0,0,-this.elevation]),this.projMatrix=u,this.invProjMatrix=a.invert([],u),this.pixelMatrix3D=a.multiply(new Float64Array(16),this.labelPlaneMatrix,u);const V=this.width%2/2,Y=this.height%2/2,ie=Math.cos(this.angle),se=Math.sin(this.angle),G=n-Math.round(n)+ie*V+se*Y,ue=s-Math.round(s)+ie*Y+se*V,ae=new Float64Array(u);if(a.translate(ae,ae,[G>.5?G-1:G,ue>.5?ue-1:ue,0]),this.alignedProjMatrix=ae,u=a.invert(new Float64Array(16),this.pixelMatrix),!u)throw new Error("failed to invert matrix");this.pixelMatrixInverse=u,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new a.pointGeometry(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return a.transformMat4(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new a.pointGeometry(0,t))}getCameraQueryGeometry(t){const n=this.getCameraPoint();if(t.length===1)return[t[0],n];{let s=n.x,u=n.y,d=n.x,f=n.y;for(const _ of t)s=Math.min(s,_.x),u=Math.min(u,_.y),d=Math.max(d,_.x),f=Math.max(f,_.y);return[new a.pointGeometry(s,u),new a.pointGeometry(d,u),new a.pointGeometry(d,f),new a.pointGeometry(s,f),new a.pointGeometry(s,u)]}}}class Oa{constructor(t){this._hashName=t&&encodeURIComponent(t),a.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(n,s){let u=!1,d=null;const f=()=>{d=null,u&&(n(),d=setTimeout(f,300),u=!1)};return()=>(u=!0,d||f(),d)}(this._updateHashUnthrottled.bind(this))}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()),delete this._map,this}getHashString(t){const n=this._map.getCenter(),s=Math.round(100*this._map.getZoom())/100,u=Math.ceil((s*Math.LN2+Math.log(512/360/.5))/Math.LN10),d=Math.pow(10,u),f=Math.round(n.lng*d)/d,_=Math.round(n.lat*d)/d,y=this._map.getBearing(),w=this._map.getPitch();let I="";if(I+=t?`/${f}/${_}/${s}`:`${s}/${_}/${f}`,(y||w)&&(I+="/"+Math.round(10*y)/10),w&&(I+=`/${Math.round(w)}`),this._hashName){const P=this._hashName;let D=!1;const N=window.location.hash.slice(1).split("&").map(U=>{const V=U.split("=")[0];return V===P?(D=!0,`${V}=${I}`):U}).filter(U=>U);return D||N.push(`${P}=${I}`),`#${N.join("&")}`}return`#${I}`}_getCurrentHash(){const t=window.location.hash.replace("#","");if(this._hashName){let n;return t.split("&").map(s=>s.split("=")).forEach(s=>{s[0]===this._hashName&&(n=s)}),(n&&n[1]||"").split("/")}return t.split("/")}_onHashChange(){const t=this._getCurrentHash();if(t.length>=3&&!t.some(n=>isNaN(n))){const n=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:n,pitch:+(t[4]||0)}),!0}return!1}_updateHashUnthrottled(){const t=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,t)}catch{}}}const uo={linearity:.3,easing:a.bezier(0,0,.3,1)},$a=a.extend({deceleration:2500,maxSpeed:1400},uo),Ua=a.extend({deceleration:20,maxSpeed:1400},uo),Va=a.extend({deceleration:1e3,maxSpeed:360},uo),Bn=a.extend({deceleration:1e3,maxSpeed:90},uo);class Na{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:a.exported.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=a.exported.now();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,pan:new a.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(const{settings:d}of this._inertiaBuffer)n.zoom+=d.zoomDelta||0,n.bearing+=d.bearingDelta||0,n.pitch+=d.pitchDelta||0,d.panDelta&&n.pan._add(d.panDelta),d.around&&(n.around=d.around),d.pinchAround&&(n.pinchAround=d.pinchAround);const s=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,u={};if(n.pan.mag()){const d=po(n.pan.mag(),s,a.extend({},$a,t||{}));u.offset=n.pan.mult(d.amount/n.pan.mag()),u.center=this._map.transform.center,ho(u,d)}if(n.zoom){const d=po(n.zoom,s,Ua);u.zoom=this._map.transform.zoom+d.amount,ho(u,d)}if(n.bearing){const d=po(n.bearing,s,Va);u.bearing=this._map.transform.bearing+a.clamp(d.amount,-179,179),ho(u,d)}if(n.pitch){const d=po(n.pitch,s,Bn);u.pitch=this._map.transform.pitch+d.amount,ho(u,d)}if(u.zoom||u.bearing){const d=n.pinchAround===void 0?n.around:n.pinchAround;u.around=d?this._map.unproject(d):this._map.getCenter()}return this.clear(),a.extend(u,{noMoveStart:!0})}}function ho(l,t){(!l.duration||l.duration<t.duration)&&(l.duration=t.duration,l.easing=t.easing)}function po(l,t,n){const{maxSpeed:s,linearity:u,deceleration:d}=n,f=a.clamp(l*u/(t/1e3),-s,s),_=Math.abs(f)/(d*u);return{easing:n.easing,duration:1e3*_,amount:f*(_/2)}}class Vi extends a.Event{constructor(t,n,s,u={}){const d=ee.mousePos(n.getCanvasContainer(),s),f=n.unproject(d);super(t,a.extend({point:d,lngLat:f,originalEvent:s},u)),this._defaultPrevented=!1,this.target=n}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class fo extends a.Event{constructor(t,n,s){const u=t==="touchend"?s.changedTouches:s.touches,d=ee.touchPos(n.getCanvasContainer(),u),f=d.map(y=>n.unproject(y)),_=d.reduce((y,w,I,P)=>y.add(w.div(P.length)),new a.pointGeometry(0,0));super(t,{points:d,point:_,lngLats:f,lngLat:n.unproject(_),originalEvent:s}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class Ni extends a.Event{constructor(t,n,s){super(t,{originalEvent:s}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class Jl{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new Ni(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new Vi(t.type,this._map,t))}mouseup(t){this._map.fire(new Vi(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new Vi(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Vi(t.type,this._map,t))}mouseover(t){this._map.fire(new Vi(t.type,this._map,t))}mouseout(t){this._map.fire(new Vi(t.type,this._map,t))}touchstart(t){return this._firePreventable(new fo(t.type,this._map,t))}touchmove(t){this._map.fire(new fo(t.type,this._map,t))}touchend(t){this._map.fire(new fo(t.type,this._map,t))}touchcancel(t){this._map.fire(new fo(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Vr{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Vi(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Vi("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Vi(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Ga{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=n.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,n){this.isEnabled()&&t.shiftKey&&t.button===0&&(ee.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const s=n;if(this._lastPos.equals(s)||!this._box&&s.dist(this._startPos)<this._clickTolerance)return;const u=this._startPos;this._lastPos=s,this._box||(this._box=ee.create("div","maplibregl-boxzoom mapboxgl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair","mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));const d=Math.min(u.x,s.x),f=Math.max(u.x,s.x),_=Math.min(u.y,s.y),y=Math.max(u.y,s.y);ee.setTransform(this._box,`translate(${d}px,${_}px)`),this._box.style.width=f-d+"px",this._box.style.height=y-_+"px"}mouseupWindow(t,n){if(!this._active||t.button!==0)return;const s=this._startPos,u=n;if(this.reset(),ee.suppressClick(),s.x!==u.x||s.y!==u.y)return this._map.fire(new a.Event("boxzoomend",{originalEvent:t})),{cameraAnimation:d=>d.fitScreenCoordinates(s,u,this._map.getBearing(),{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","mapboxgl-crosshair"),this._box&&(ee.remove(this._box),this._box=null),ee.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new a.Event(t,{originalEvent:n}))}}function Ir(l,t){if(l.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${l.length}, points ${t.length}`);const n={};for(let s=0;s<l.length;s++)n[l[s].identifier]=t[s];return n}class mo{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,n,s){(this.centroid||s.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),s.length===this.numTouches&&(this.centroid=function(u){const d=new a.pointGeometry(0,0);for(const f of u)d._add(f);return d.div(u.length)}(n),this.touches=Ir(s,n)))}touchmove(t,n,s){if(this.aborted||!this.centroid)return;const u=Ir(s,n);for(const d in this.touches){const f=this.touches[d],_=u[d];(!_||_.dist(f)>30)&&(this.aborted=!0)}}touchend(t,n,s){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),s.length===0){const u=!this.aborted&&this.centroid;if(this.reset(),u)return u}}}class Ms{constructor(t){this.singleTap=new mo(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,n,s){this.singleTap.touchstart(t,n,s)}touchmove(t,n,s){this.singleTap.touchmove(t,n,s)}touchend(t,n,s){const u=this.singleTap.touchend(t,n,s);if(u){const d=t.timeStamp-this.lastTime<500,f=!this.lastTap||this.lastTap.dist(u)<30;if(d&&f||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=u,this.count===this.numTaps)return this.reset(),u}}}class Yl{constructor(){this._zoomIn=new Ms({numTouches:1,numTaps:2}),this._zoomOut=new Ms({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,s){this._zoomIn.touchstart(t,n,s),this._zoomOut.touchstart(t,n,s)}touchmove(t,n,s){this._zoomIn.touchmove(t,n,s),this._zoomOut.touchmove(t,n,s)}touchend(t,n,s){const u=this._zoomIn.touchend(t,n,s),d=this._zoomOut.touchend(t,n,s);return u?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:f=>f.easeTo({duration:300,zoom:f.getZoom()+1,around:f.unproject(u)},{originalEvent:t})}):d?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:f=>f.easeTo({duration:300,zoom:f.getZoom()-1,around:f.unproject(d)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const Ql={0:1,2:2};class qo{constructor(t){this.reset(),this._clickTolerance=t.clickTolerance||1}reset(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton}_correctButton(t,n){return!1}_move(t,n){return{}}mousedown(t,n){if(this._lastPoint)return;const s=ee.mouseButton(t);this._correctButton(t,s)&&(this._lastPoint=n,this._eventButton=s)}mousemoveWindow(t,n){const s=this._lastPoint;if(s){if(t.preventDefault(),function(u,d){const f=Ql[d];return u.buttons===void 0||(u.buttons&f)!==f}(t,this._eventButton))this.reset();else if(this._moved||!(n.dist(s)<this._clickTolerance))return this._moved=!0,this._lastPoint=n,this._move(s,n)}}mouseupWindow(t){this._lastPoint&&ee.mouseButton(t)===this._eventButton&&(this._moved&&ee.suppressClick(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class go extends qo{mousedown(t,n){super.mousedown(t,n),this._lastPoint&&(this._active=!0)}_correctButton(t,n){return n===0&&!t.ctrlKey}_move(t,n){return{around:n,panDelta:n.sub(t)}}}class Cr extends qo{_correctButton(t,n){return n===0&&t.ctrlKey||n===2}_move(t,n){const s=.8*(n.x-t.x);if(s)return this._active=!0,{bearingDelta:s}}contextmenu(t){t.preventDefault()}}class Ve extends qo{_correctButton(t,n){return n===0&&t.ctrlKey||n===2}_move(t,n){const s=-.5*(n.y-t.y);if(s)return this._active=!0,{pitchDelta:s}}contextmenu(t){t.preventDefault()}}class Za{constructor(t,n){this._minTouches=t.cooperativeGestures?2:1,this._clickTolerance=t.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new a.pointGeometry(0,0),setTimeout(()=>{this._cancelCooperativeMessage=!1},200)}touchstart(t,n,s){return this._calculateTransform(t,n,s)}touchmove(t,n,s){if(this._map._cooperativeGestures&&(this._minTouches===2&&s.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(t,!1,s.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(s.length<this._minTouches))return t.preventDefault(),this._calculateTransform(t,n,s)}touchend(t,n,s){this._calculateTransform(t,n,s),this._active&&s.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,n,s){s.length>0&&(this._active=!0);const u=Ir(s,n),d=new a.pointGeometry(0,0),f=new a.pointGeometry(0,0);let _=0;for(const w in u){const I=u[w],P=this._touches[w];P&&(d._add(I),f._add(I.sub(P)),_++,u[w]=I)}if(this._touches=u,_<this._minTouches||!f.mag())return;const y=f.div(_);return this._sum._add(y),this._sum.mag()<this._clickTolerance?void 0:{around:d.div(_),panDelta:y}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class on{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}_start(t){}_move(t,n,s){return{}}touchstart(t,n,s){this._firstTwoTouches||s.length<2||(this._firstTwoTouches=[s[0].identifier,s[1].identifier],this._start([n[0],n[1]]))}touchmove(t,n,s){if(!this._firstTwoTouches)return;t.preventDefault();const[u,d]=this._firstTwoTouches,f=Nr(s,n,u),_=Nr(s,n,d);if(!f||!_)return;const y=this._aroundCenter?null:f.add(_).div(2);return this._move([f,_],y,t)}touchend(t,n,s){if(!this._firstTwoTouches)return;const[u,d]=this._firstTwoTouches,f=Nr(s,n,u),_=Nr(s,n,d);f&&_||(this._active&&ee.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 Nr(l,t,n){for(let s=0;s<l.length;s++)if(l[s].identifier===n)return t[s]}function Ps(l,t){return Math.log(l/t)/Math.LN2}class ke extends on{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,n){const s=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(Ps(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Ps(this._distance,s),pinchAround:n}}}function jo(l,t){return 180*l.angleWith(t)/Math.PI}class ec extends on{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,n){const s=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:jo(this._vector,s),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,s=jo(t,this._startVector);return Math.abs(s)<n}}function zs(l){return Math.abs(l.y)>Math.abs(l.x)}class ks extends on{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,n,s){super.touchstart(t,n,s),this._currentTouchCount=s.length}_start(t){this._lastPoints=t,zs(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,s){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const u=t[0].sub(this._lastPoints[0]),d=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(u,d,s.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(u.y+d.y)/2*-.5}):void 0}gestureBeginsVertically(t,n,s){if(this._valid!==void 0)return this._valid;const u=t.mag()>=2,d=n.mag()>=2;if(!u&&!d)return;if(!u||!d)return this._firstMove===void 0&&(this._firstMove=s),s-this._firstMove<100&&void 0;const f=t.y>0==n.y>0;return zs(t)&&zs(n)&&f}}const qa={panStep:100,bearingStep:15,pitchStep:10};class ja{constructor(){const t=qa;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let n=0,s=0,u=0,d=0,f=0;switch(t.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:t.shiftKey?s=-1:(t.preventDefault(),d=-1);break;case 39:t.shiftKey?s=1:(t.preventDefault(),d=1);break;case 38:t.shiftKey?u=1:(t.preventDefault(),f=-1);break;case 40:t.shiftKey?u=-1:(t.preventDefault(),f=1);break;default:return}return this._rotationDisabled&&(s=0,u=0),{cameraAnimation:_=>{const y=_.getZoom();_.easeTo({duration:300,easeId:"keyboardHandler",easing:tc,zoom:n?Math.round(y)+n*(t.shiftKey?2:1):y,bearing:_.getBearing()+s*this._bearingStep,pitch:_.getPitch()+u*this._pitchStep,offset:[-d*this._panStep,-f*this._panStep],center:_.getCenter()},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function tc(l){return l*(2-l)}const Xa=4.000244140625;class Ds{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._handler=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,a.bindAll(["_onTimeout"],this)}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!this._map._metaPress)return;t.preventDefault()}let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const s=a.exported.now(),u=s-(this._lastWheelEventTime||0);this._lastWheelEventTime=s,n!==0&&n%Xa==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":u>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(u*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),t.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=t,this._delta-=n,this._active||this._start(t)),t.preventDefault()}_onTimeout(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const n=ee.mousePos(this._el,t);this._around=a.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(n)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._map.transform;if(this._delta!==0){const _=this._type==="wheel"&&Math.abs(this._delta)>Xa?this._wheelZoomRate:this._defaultZoomRate;let y=2/(1+Math.exp(-Math.abs(this._delta*_)));this._delta<0&&y!==0&&(y=1/y);const w=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(w*y))),this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const n=typeof this._targetZoom=="number"?this._targetZoom:t.zoom,s=this._startZoom,u=this._easing;let d,f=!1;if(this._type==="wheel"&&s&&u){const _=Math.min((a.exported.now()-this._lastWheelEventTime)/200,1),y=u(_);d=a.number(s,n,y),_<1?this._frameId||(this._frameId=!0):f=!0}else d=n,f=!0;return this._active=!0,f&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!f,zoomDelta:d-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=a.ease;if(this._prevEase){const s=this._prevEase,u=(a.exported.now()-s.start)/s.duration,d=s.easing(u+.01)-s.easing(u),f=.27/Math.sqrt(d*d+1e-4)*.01,_=Math.sqrt(.0729-f*f);n=a.bezier(f,_,.25,1)}return this._prevEase={start:a.exported.now(),duration:t,easing:n},n}reset(){this._active=!1}}class Ls{constructor(t,n){this._clickZoom=t,this._tapZoom=n}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Rs{constructor(){this.reset()}reset(){this._active=!1}dblclick(t,n){return t.preventDefault(),{cameraAnimation:s=>{s.easeTo({duration:300,zoom:s.getZoom()+(t.shiftKey?-1:1),around:s.unproject(n)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Bs{constructor(){this._tap=new Ms({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(t,n,s){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?s.length>0&&(this._swipePoint=n[0],this._swipeTouch=s[0].identifier):this._tap.touchstart(t,n,s))}touchmove(t,n,s){if(this._tapTime){if(this._swipePoint){if(s[0].identifier!==this._swipeTouch)return;const u=n[0],d=u.y-this._swipePoint.y;return this._swipePoint=u,t.preventDefault(),this._active=!0,{zoomDelta:d/128}}}else this._tap.touchmove(t,n,s)}touchend(t,n,s){this._tapTime?this._swipePoint&&s.length===0&&this.reset():this._tap.touchend(t,n,s)&&(this._tapTime=t.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Pi{constructor(t,n,s){this._el=t,this._mousePan=n,this._touchPan=s}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Gr{constructor(t,n,s){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=n,this._mousePitch=s}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Wa{constructor(t,n,s,u){this._el=t,this._touchZoom=n,this._touchRotate=s,this._tapDragZoom=u,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","mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const Fn=l=>l.zoom||l.drag||l.pitch||l.rotate;class Fs extends a.Event{}function _o(l){return l.panDelta&&l.panDelta.mag()||l.zoomDelta||l.bearingDelta||l.pitchDelta}class Ha{constructor(t,n){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Na(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n),a.bindAll(["handleEvent","handleWindowEvent"],this);const s=this._el;this._listeners=[[s,"touchstart",{passive:!0}],[s,"touchmove",{passive:!1}],[s,"touchend",void 0],[s,"touchcancel",void 0],[s,"mousedown",void 0],[s,"mousemove",void 0],[s,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[s,"mouseover",void 0],[s,"mouseout",void 0],[s,"dblclick",void 0],[s,"click",void 0],[s,"keydown",{capture:!1}],[s,"keyup",void 0],[s,"wheel",{passive:!1}],[s,"contextmenu",void 0],[window,"blur",void 0]];for(const[u,d,f]of this._listeners)ee.addEventListener(u,d,u===document?this.handleWindowEvent:this.handleEvent,f)}destroy(){for(const[t,n,s]of this._listeners)ee.removeEventListener(t,n,t===document?this.handleWindowEvent:this.handleEvent,s)}_addDefaultHandlers(t){const n=this._map,s=n.getCanvasContainer();this._add("mapEvent",new Jl(n,t));const u=n.boxZoom=new Ga(n,t);this._add("boxZoom",u);const d=new Yl,f=new Rs;n.doubleClickZoom=new Ls(f,d),this._add("tapZoom",d),this._add("clickZoom",f);const _=new Bs;this._add("tapDragZoom",_);const y=n.touchPitch=new ks(n);this._add("touchPitch",y);const w=new Cr(t),I=new Ve(t);n.dragRotate=new Gr(t,w,I),this._add("mouseRotate",w,["mousePitch"]),this._add("mousePitch",I,["mouseRotate"]);const P=new go(t),D=new Za(t,n);n.dragPan=new Pi(s,P,D),this._add("mousePan",P),this._add("touchPan",D,["touchZoom","touchRotate"]);const N=new ec,U=new ke;n.touchZoomRotate=new Wa(s,U,N,_),this._add("touchRotate",N,["touchPan","touchZoom"]),this._add("touchZoom",U,["touchPan","touchRotate"]);const V=n.scrollZoom=new Ds(n,this);this._add("scrollZoom",V,["mousePan"]);const Y=n.keyboard=new ja;this._add("keyboard",Y),this._add("blockableMapEvent",new Vr(n));for(const ie of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[ie]&&n[ie].enable(t[ie])}_add(t,n,s){this._handlers.push({handlerName:t,handler:n,allowed:s}),this._handlersById[t]=n}stop(t){if(!this._updatingCamera){for(const{handler:n}of this._handlers)n.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 Boolean(Fn(this._eventsInProgress))||this.isZooming()}_blockedByActive(t,n,s){for(const u in t)if(u!==s&&(!n||n.indexOf(u)<0))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,`${t.type}Window`)}_getMapTouches(t){const n=[];for(const s of t)this._el.contains(s.target)&&n.push(s);return n}handleEvent(t,n){if(t.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const s=t.type==="renderFrame"?void 0:t,u={needsRenderFrame:!1},d={},f={},_=t.touches,y=_?this._getMapTouches(_):void 0,w=y?ee.touchPos(this._el,y):ee.mousePos(this._el,t);for(const{handlerName:D,handler:N,allowed:U}of this._handlers){if(!N.isEnabled())continue;let V;this._blockedByActive(f,U,D)?N.reset():N[n||t.type]&&(V=N[n||t.type](t,w,y),this.mergeHandlerResult(u,d,V,D,s),V&&V.needsRenderFrame&&this._triggerRenderFrame()),(V||N.isActive())&&(f[D]=N)}const I={};for(const D in this._previousActiveHandlers)f[D]||(I[D]=s);this._previousActiveHandlers=f,(Object.keys(I).length||_o(u))&&(this._changes.push([u,d,I]),this._triggerRenderFrame()),(Object.keys(f).length||_o(u))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:P}=u;P&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],P(this._map))}mergeHandlerResult(t,n,s,u,d){if(!s)return;a.extend(t,s);const f={handlerName:u,originalEvent:s.originalEvent||d};s.zoomDelta!==void 0&&(n.zoom=f),s.panDelta!==void 0&&(n.drag=f),s.pitchDelta!==void 0&&(n.pitch=f),s.bearingDelta!==void 0&&(n.rotate=f)}_applyChanges(){const t={},n={},s={};for(const[u,d,f]of this._changes)u.panDelta&&(t.panDelta=(t.panDelta||new a.pointGeometry(0,0))._add(u.panDelta)),u.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+u.zoomDelta),u.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+u.bearingDelta),u.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+u.pitchDelta),u.around!==void 0&&(t.around=u.around),u.pinchAround!==void 0&&(t.pinchAround=u.pinchAround),u.noInertia&&(t.noInertia=u.noInertia),a.extend(n,d),a.extend(s,f);this._updateMapTransform(t,n,s),this._changes=[]}_updateMapTransform(t,n,s){const u=this._map,d=u.transform,f=u.style&&u.style.terrain;if(!(_o(t)||f&&this._drag))return this._fireEvents(n,s,!0);let{panDelta:_,zoomDelta:y,bearingDelta:w,pitchDelta:I,around:P,pinchAround:D}=t;D!==void 0&&(P=D),u._stop(!0),P=P||u.transform.centerPoint;const N=d.pointLocation(_?P.sub(_):P);w&&(d.bearing+=w),I&&(d.pitch+=I),y&&(d.zoom+=y),f?n.drag&&!this._drag?(this._drag={center:d.centerPoint,lngLat:d.pointLocation(P),point:P,handlerName:n.drag.handlerName},u.fire(new a.Event("freezeElevation",{freeze:!0}))):this._drag&&s[this._drag.handlerName]?(u.fire(new a.Event("freezeElevation",{freeze:!1})),this._drag=null):n.drag&&this._drag&&(d.center=d.pointLocation(d.centerPoint.sub(_))):d.setLocationAtPoint(N,P),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,s,!0)}_fireEvents(t,n,s){const u=Fn(this._eventsInProgress),d=Fn(t),f={};for(const I in t){const{originalEvent:P}=t[I];this._eventsInProgress[I]||(f[`${I}start`]=P),this._eventsInProgress[I]=t[I]}!u&&d&&this._fireEvent("movestart",d.originalEvent);for(const I in f)this._fireEvent(I,f[I]);d&&this._fireEvent("move",d.originalEvent);for(const I in t){const{originalEvent:P}=t[I];this._fireEvent(I,P)}const _={};let y;for(const I in this._eventsInProgress){const{handlerName:P,originalEvent:D}=this._eventsInProgress[I];this._handlersById[P].isActive()||(delete this._eventsInProgress[I],y=n[P]||D,_[`${I}end`]=y)}for(const I in _)this._fireEvent(I,_[I]);const w=Fn(this._eventsInProgress);if(s&&(u||d)&&!w){this._updatingCamera=!0;const I=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),P=D=>D!==0&&-this._bearingSnap<D&&D<this._bearingSnap;I?(P(I.bearing||this._map.getBearing())&&(I.bearing=0),this._map.easeTo(I,{originalEvent:y})):(this._map.fire(new a.Event("moveend",{originalEvent:y})),P(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new a.Event(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new Fs("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const Ji={extend:(l,...t)=>a.extend(l,...t),run(l){l()},logToElement(l,t=!1,n="log"){const s=window.document.getElementById(n);s&&(t&&(s.innerHTML=""),s.innerHTML+=`<br>${l}`)}};class Zt extends a.Evented{constructor(t,n){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,a.bindAll(["_renderFrameCallback"],this)}getCenter(){return new a.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}panBy(t,n,s){return t=a.pointGeometry.convert(t).mult(-1),this.panTo(this.transform.center,a.extend({offset:t},n),s)}panTo(t,n,s){return this.easeTo(a.extend({center:t},n),s)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,s){return this.easeTo(a.extend({zoom:t},n),s)}zoomIn(t,n){return this.zoomTo(this.getZoom()+1,t,n),this}zoomOut(t,n){return this.zoomTo(this.getZoom()-1,t,n),this}getBearing(){return this.transform.bearing}setBearing(t,n){return this.jumpTo({bearing:t},n),this}getPadding(){return this.transform.padding}setPadding(t,n){return this.jumpTo({padding:t},n),this}rotateTo(t,n,s){return this.easeTo(a.extend({bearing:t},n),s)}resetNorth(t,n){return this.rotateTo(0,a.extend({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(a.extend({bearing:0,pitch:0,duration:1e3},t),n),this}snapToNorth(t,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,n):this}getPitch(){return this.transform.pitch}setPitch(t,n){return this.jumpTo({pitch:t},n),this}cameraForBounds(t,n){t=a.LngLatBounds.convert(t);const s=n&&n.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),s,n)}_cameraForBoxAndBearing(t,n,s,u){const d={top:0,bottom:0,right:0,left:0};if(typeof(u=a.extend({padding:d,offset:[0,0],maxZoom:this.transform.maxZoom},u)).padding=="number"){const ae=u.padding;u.padding={top:ae,bottom:ae,right:ae,left:ae}}u.padding=a.extend(d,u.padding);const f=this.transform,_=f.padding,y=f.project(a.LngLat.convert(t)),w=f.project(a.LngLat.convert(n)),I=y.rotate(-s*Math.PI/180),P=w.rotate(-s*Math.PI/180),D=new a.pointGeometry(Math.max(I.x,P.x),Math.max(I.y,P.y)),N=new a.pointGeometry(Math.min(I.x,P.x),Math.min(I.y,P.y)),U=D.sub(N),V=(f.width-(_.left+_.right+u.padding.left+u.padding.right))/U.x,Y=(f.height-(_.top+_.bottom+u.padding.top+u.padding.bottom))/U.y;if(Y<0||V<0)return void a.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const ie=Math.min(f.scaleZoom(f.scale*Math.min(V,Y)),u.maxZoom),se=a.pointGeometry.convert(u.offset),G=new a.pointGeometry((u.padding.left-u.padding.right)/2,(u.padding.top-u.padding.bottom)/2).rotate(s*Math.PI/180),ue=se.add(G).mult(f.scale/f.zoomScale(ie));return{center:f.unproject(y.add(w).div(2).sub(ue)),zoom:ie,bearing:s}}fitBounds(t,n,s){return this._fitInternal(this.cameraForBounds(t,n),n,s)}fitScreenCoordinates(t,n,s,u,d){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(a.pointGeometry.convert(t)),this.transform.pointLocation(a.pointGeometry.convert(n)),s,u),u,d)}_fitInternal(t,n,s){return t?(delete(n=a.extend(t,n)).padding,n.linear?this.easeTo(n,s):this.flyTo(n,s)):this}jumpTo(t,n){this.stop();const s=this.transform;let u=!1,d=!1,f=!1;return"zoom"in t&&s.zoom!==+t.zoom&&(u=!0,s.zoom=+t.zoom),t.center!==void 0&&(s.center=a.LngLat.convert(t.center)),"bearing"in t&&s.bearing!==+t.bearing&&(d=!0,s.bearing=+t.bearing),"pitch"in t&&s.pitch!==+t.pitch&&(f=!0,s.pitch=+t.pitch),t.padding==null||s.isPaddingEqual(t.padding)||(s.padding=t.padding),this.fire(new a.Event("movestart",n)).fire(new a.Event("move",n)),u&&this.fire(new a.Event("zoomstart",n)).fire(new a.Event("zoom",n)).fire(new a.Event("zoomend",n)),d&&this.fire(new a.Event("rotatestart",n)).fire(new a.Event("rotate",n)).fire(new a.Event("rotateend",n)),f&&this.fire(new a.Event("pitchstart",n)).fire(new a.Event("pitch",n)).fire(new a.Event("pitchend",n)),this.fire(new a.Event("moveend",n))}calculateCameraOptionsFromTo(t,n,s,u=0){const d=a.MercatorCoordinate.fromLngLat(t,n),f=a.MercatorCoordinate.fromLngLat(s,u),_=f.x-d.x,y=f.y-d.y,w=f.z-d.z,I=Math.hypot(_,y,w);if(I===0)throw new Error("Can't calculate camera options with same From and To");const P=Math.hypot(_,y),D=this.transform.scaleZoom(this.transform.cameraToCenterDistance/I/this.transform.tileSize),N=180*Math.atan2(_,-y)/Math.PI;let U=180*Math.acos(P/I)/Math.PI;return U=w<0?90-U:90+U,{center:f.toLngLat(),zoom:D,pitch:U,bearing:N}}easeTo(t,n){this._stop(!1,t.easeId),((t=a.extend({offset:[0,0],duration:500,easing:a.ease},t)).animate===!1||!t.essential&&a.exported.prefersReducedMotion)&&(t.duration=0);const s=this.transform,u=this.getZoom(),d=this.getBearing(),f=this.getPitch(),_=this.getPadding(),y="zoom"in t?+t.zoom:u,w="bearing"in t?this._normalizeBearing(t.bearing,d):d,I="pitch"in t?+t.pitch:f,P="padding"in t?t.padding:s.padding,D=a.pointGeometry.convert(t.offset);let N=s.centerPoint.add(D);const U=s.pointLocation(N),V=a.LngLat.convert(t.center||U);this._normalizeCenter(V);const Y=s.project(U),ie=s.project(V).sub(Y),se=s.zoomScale(y-u);let G,ue;t.around&&(G=a.LngLat.convert(t.around),ue=s.locationPoint(G));const ae={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||y!==u,this._rotating=this._rotating||d!==w,this._pitching=this._pitching||I!==f,this._padding=!s.isPaddingEqual(P),this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,ae),this._ease(ge=>{if(this._zooming&&(s.zoom=a.number(u,y,ge)),this._rotating&&(s.bearing=a.number(d,w,ge)),this._pitching&&(s.pitch=a.number(f,I,ge)),this._padding&&(s.interpolatePadding(_,P,ge),N=s.centerPoint.add(D)),G)s.setLocationAtPoint(G,ue);else{const _e=s.zoomScale(s.zoom-u),we=y>u?Math.min(2,se):Math.max(.5,se),me=Math.pow(we,1-ge),Oe=s.unproject(Y.add(ie.mult(ge*me)).mult(_e));s.setLocationAtPoint(s.renderWorldCopies?Oe.wrap():Oe,N)}this._fireMoveEvents(n)},ge=>{this._afterEase(n,ge)},t),this}_prepareEase(t,n,s={}){this._moving=!0,this.fire(new a.Event("freezeElevation",{freeze:!0})),n||s.moving||this.fire(new a.Event("movestart",t)),this._zooming&&!s.zooming&&this.fire(new a.Event("zoomstart",t)),this._rotating&&!s.rotating&&this.fire(new a.Event("rotatestart",t)),this._pitching&&!s.pitching&&this.fire(new a.Event("pitchstart",t))}_fireMoveEvents(t){this.fire(new a.Event("move",t)),this._zooming&&this.fire(new a.Event("zoom",t)),this._rotating&&this.fire(new a.Event("rotate",t)),this._pitching&&this.fire(new a.Event("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId,this.fire(new a.Event("freezeElevation",{freeze:!1}));const s=this._zooming,u=this._rotating,d=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,s&&this.fire(new a.Event("zoomend",t)),u&&this.fire(new a.Event("rotateend",t)),d&&this.fire(new a.Event("pitchend",t)),this.fire(new a.Event("moveend",t))}flyTo(t,n){if(!t.essential&&a.exported.prefersReducedMotion){const We=a.pick(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(We,n)}this.stop(),t=a.extend({offset:[0,0],speed:1.2,curve:1.42,easing:a.ease},t);const s=this.transform,u=this.getZoom(),d=this.getBearing(),f=this.getPitch(),_=this.getPadding(),y="zoom"in t?a.clamp(+t.zoom,s.minZoom,s.maxZoom):u,w="bearing"in t?this._normalizeBearing(t.bearing,d):d,I="pitch"in t?+t.pitch:f,P="padding"in t?t.padding:s.padding,D=s.zoomScale(y-u),N=a.pointGeometry.convert(t.offset);let U=s.centerPoint.add(N);const V=s.pointLocation(U),Y=a.LngLat.convert(t.center||V);this._normalizeCenter(Y);const ie=s.project(V),se=s.project(Y).sub(ie);let G=t.curve;const ue=Math.max(s.width,s.height),ae=ue/D,ge=se.mag();if("minZoom"in t){const We=a.clamp(Math.min(t.minZoom,u,y),s.minZoom,s.maxZoom),Mt=ue/s.zoomScale(We-u);G=Math.sqrt(Mt/ge*2)}const _e=G*G;function we(We){const Mt=(ae*ae-ue*ue+(We?-1:1)*_e*_e*ge*ge)/(2*(We?ae:ue)*_e*ge);return Math.log(Math.sqrt(Mt*Mt+1)-Mt)}function me(We){return(Math.exp(We)-Math.exp(-We))/2}function Oe(We){return(Math.exp(We)+Math.exp(-We))/2}const Ce=we(0);let $e=function(We){return Oe(Ce)/Oe(Ce+G*We)},lt=function(We){return ue*((Oe(Ce)*(me(Mt=Ce+G*We)/Oe(Mt))-me(Ce))/_e)/ge;var Mt},dt=(we(1)-Ce)/G;if(Math.abs(ge)<1e-6||!isFinite(dt)){if(Math.abs(ue-ae)<1e-6)return this.easeTo(t,n);const We=ae<ue?-1:1;dt=Math.abs(Math.log(ae/ue))/G,lt=function(){return 0},$e=function(Mt){return Math.exp(We*G*Mt)}}return t.duration="duration"in t?+t.duration:1e3*dt/("screenSpeed"in t?+t.screenSpeed/G:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=d!==w,this._pitching=I!==f,this._padding=!s.isPaddingEqual(P),this._prepareEase(n,!1),this._ease(We=>{const Mt=We*dt,Pt=1/$e(Mt);s.zoom=We===1?y:u+s.scaleZoom(Pt),this._rotating&&(s.bearing=a.number(d,w,We)),this._pitching&&(s.pitch=a.number(f,I,We)),this._padding&&(s.interpolatePadding(_,P,We),U=s.centerPoint.add(N));const xt=We===1?Y:s.unproject(ie.add(se.mult(lt(Mt))).mult(Pt));s.setLocationAtPoint(s.renderWorldCopies?xt.wrap():xt,U),this._fireMoveEvents(n)},()=>this._afterEase(n),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,n){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const s=this._onEaseEnd;delete this._onEaseEnd,s.call(this,n)}if(!t){const s=this.handlers;s&&s.stop(!1)}return this}_ease(t,n,s){s.animate===!1||s.duration===0?(t(1),n()):(this._easeStart=a.exported.now(),this._easeOptions=s,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((a.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,n){t=a.wrap(t,-180,180);const s=Math.abs(t-n);return Math.abs(t-360-n)<s&&(t-=360),Math.abs(t+360-n)<s&&(t+=360),t}_normalizeCenter(t){const n=this.transform;if(!n.renderWorldCopies||n.lngRange)return;const s=t.lng-n.center.lng;t.lng+=s>180?-360:s<-180?360:0}}class yo{constructor(t={}){this.options=t,a.bindAll(["_toggleAttribution","_updateData","_updateCompact","_updateCompactMinimize"],this)}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options&&this.options.compact,this._container=ee.create("details","maplibregl-ctrl maplibregl-ctrl-attrib mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=ee.create("summary","maplibregl-ctrl-attrib-button mapboxgl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=ee.create("div","maplibregl-ctrl-attrib-inner mapboxgl-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(){ee.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,n){const s=this._map._getUIString(`AttributionControl.${n}`);t.title=s,t.setAttribute("aria-label",s)}_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","mapboxgl-compact-show")):(this._container.classList.add("maplibregl-compact-show","mapboxgl-compact-show"),this._container.removeAttribute("open")))}_updateData(t){!t||t.sourceDataType!=="metadata"&&t.sourceDataType!=="visibility"&&t.dataType!=="style"&&t.type!=="terrain"||this._updateAttributions()}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(u=>typeof u!="string"?"":u)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const u=this._map.style.stylesheet;this.styleOwner=u.owner,this.styleId=u.id}const n=this._map.style.sourceCaches;for(const u in n){const d=n[u];if(d.used||d.usedForTerrain){const f=d.getSource();f.attribution&&t.indexOf(f.attribution)<0&&t.push(f.attribution)}}t=t.filter(u=>String(u).trim()),t.sort((u,d)=>u.length-d.length),t=t.filter((u,d)=>{for(let f=d+1;f<t.length;f++)if(t[f].indexOf(u)>=0)return!1;return!0});const s=t.join(" | ");s!==this._attribHTML&&(this._attribHTML=s,t.length?(this._innerContainer.innerHTML=s,this._container.classList.remove("maplibregl-attrib-empty","mapboxgl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty","mapboxgl-attrib-empty"),this._updateCompact(),this._editLink=null)}_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","mapboxgl-compact","maplibregl-compact-show","mapboxgl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show","mapboxgl-compact","mapboxgl-compact-show"))}_updateCompactMinimize(){this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show")}}class Xo{constructor(t={}){this.options=t,a.bindAll(["_updateCompact"],this)}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=ee.create("div","maplibregl-ctrl mapboxgl-ctrl");const n=ee.create("a","maplibregl-ctrl-logo mapboxgl-ctrl-logo");return n.target="_blank",n.rel="noopener nofollow",n.href="https://maplibre.org/",n.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),n.setAttribute("rel","noopener nofollow"),this._container.appendChild(n),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){ee.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}_updateCompact(){const t=this._container.children;if(t.length){const n=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&n.classList.add("maplibregl-compact","mapboxgl-compact"):n.classList.remove("maplibregl-compact","mapboxgl-compact")}}}class Ka{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const n=++this._id;return this._queue.push({callback:t,id:n,cancelled:!1}),n}remove(t){const n=this._currentlyRunning,s=n?this._queue.concat(n):this._queue;for(const u of s)if(u.id===t)return void(u.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const n=this._currentlyRunning=this._queue;this._queue=[];for(const s of n)if(!s.cancelled&&(s.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const Ja={"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":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"},Ya={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:void 0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",transformRequest:null,fadeDuration:300,crossSourceCollisions:!0},ic={showCompass:!0,showZoom:!0,visualizePitch:!1};class mr{constructor(t,n,s=!1){this._clickTolerance=10,this.element=n,this.mouseRotate=new Cr({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,s&&(this.mousePitch=new Ve({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),a.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),ee.addEventListener(n,"mousedown",this.mousedown),ee.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),ee.addEventListener(n,"touchmove",this.touchmove),ee.addEventListener(n,"touchend",this.touchend),ee.addEventListener(n,"touchcancel",this.reset)}down(t,n){this.mouseRotate.mousedown(t,n),this.mousePitch&&this.mousePitch.mousedown(t,n),ee.disableDrag()}move(t,n){const s=this.map,u=this.mouseRotate.mousemoveWindow(t,n);if(u&&u.bearingDelta&&s.setBearing(s.getBearing()+u.bearingDelta),this.mousePitch){const d=this.mousePitch.mousemoveWindow(t,n);d&&d.pitchDelta&&s.setPitch(s.getPitch()+d.pitchDelta)}}off(){const t=this.element;ee.removeEventListener(t,"mousedown",this.mousedown),ee.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),ee.removeEventListener(t,"touchmove",this.touchmove),ee.removeEventListener(t,"touchend",this.touchend),ee.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){ee.enableDrag(),ee.removeEventListener(window,"mousemove",this.mousemove),ee.removeEventListener(window,"mouseup",this.mouseup)}mousedown(t){this.down(a.extend({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),ee.mousePos(this.element,t)),ee.addEventListener(window,"mousemove",this.mousemove),ee.addEventListener(window,"mouseup",this.mouseup)}mousemove(t){this.move(t,ee.mousePos(this.element,t))}mouseup(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp()}touchstart(t){t.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=ee.touchPos(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>t.preventDefault()},this._startPos))}touchmove(t){t.targetTouches.length!==1?this.reset():(this._lastPos=ee.touchPos(this.element,t.targetTouches)[0],this.move({preventDefault:()=>t.preventDefault()},this._lastPos))}touchend(t){t.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}function xo(l,t,n){if(l=new a.LngLat(l.lng,l.lat),t){const s=new a.LngLat(l.lng-360,l.lat),u=new a.LngLat(l.lng+360,l.lat),d=n.locationPoint(l).distSqr(t);n.locationPoint(s).distSqr(t)<d?l=s:n.locationPoint(u).distSqr(t)<d&&(l=u)}for(;Math.abs(l.lng-n.center.lng)>180;){const s=n.locationPoint(l);if(s.x>=0&&s.y>=0&&s.x<=n.width&&s.y<=n.height)break;l.lng>n.center.lng?l.lng-=360:l.lng+=360}return l}const je={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 Qe(l,t,n){const s=l.classList;for(const u in je)s.remove(`maplibregl-${n}-anchor-${u}`,`mapboxgl-${n}-anchor-${u}`);s.add(`maplibregl-${n}-anchor-${t}`,`mapboxgl-${n}-anchor-${t}`)}class On extends a.Evented{constructor(t,n){if(super(),(t instanceof HTMLElement||n)&&(t=a.extend({element:t},n)),a.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),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._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,t&&t.element)this._element=t.element,this._offset=a.pointGeometry.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=ee.create("div"),this._element.setAttribute("aria-label","Map marker");const s=ee.createNS("http://www.w3.org/2000/svg","svg"),u=41,d=27;s.setAttributeNS(null,"display","block"),s.setAttributeNS(null,"height",`${u}px`),s.setAttributeNS(null,"width",`${d}px`),s.setAttributeNS(null,"viewBox",`0 0 ${d} ${u}`);const f=ee.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"stroke","none"),f.setAttributeNS(null,"stroke-width","1"),f.setAttributeNS(null,"fill","none"),f.setAttributeNS(null,"fill-rule","evenodd");const _=ee.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"fill-rule","nonzero");const y=ee.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"transform","translate(3.0, 29.0)"),y.setAttributeNS(null,"fill","#000000");const w=[{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 se of w){const G=ee.createNS("http://www.w3.org/2000/svg","ellipse");G.setAttributeNS(null,"opacity","0.04"),G.setAttributeNS(null,"cx","10.5"),G.setAttributeNS(null,"cy","5.80029008"),G.setAttributeNS(null,"rx",se.rx),G.setAttributeNS(null,"ry",se.ry),y.appendChild(G)}const I=ee.createNS("http://www.w3.org/2000/svg","g");I.setAttributeNS(null,"fill",this._color);const P=ee.createNS("http://www.w3.org/2000/svg","path");P.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"),I.appendChild(P);const D=ee.createNS("http://www.w3.org/2000/svg","g");D.setAttributeNS(null,"opacity","0.25"),D.setAttributeNS(null,"fill","#000000");const N=ee.createNS("http://www.w3.org/2000/svg","path");N.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"),D.appendChild(N);const U=ee.createNS("http://www.w3.org/2000/svg","g");U.setAttributeNS(null,"transform","translate(6.0, 7.0)"),U.setAttributeNS(null,"fill","#FFFFFF");const V=ee.createNS("http://www.w3.org/2000/svg","g");V.setAttributeNS(null,"transform","translate(8.0, 8.0)");const Y=ee.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 ie=ee.createNS("http://www.w3.org/2000/svg","circle");ie.setAttributeNS(null,"fill","#FFFFFF"),ie.setAttributeNS(null,"cx","5.5"),ie.setAttributeNS(null,"cy","5.5"),ie.setAttributeNS(null,"r","5.4999962"),V.appendChild(Y),V.appendChild(ie),_.appendChild(y),_.appendChild(I),_.appendChild(D),_.appendChild(U),_.appendChild(V),s.appendChild(_),s.setAttributeNS(null,"height",u*this._scale+"px"),s.setAttributeNS(null,"width",d*this._scale+"px"),this._element.appendChild(s),this._offset=a.pointGeometry.convert(t&&t.offset||[0,-14])}this._element.classList.add("maplibregl-marker","mapboxgl-marker"),this._element.addEventListener("dragstart",s=>{s.preventDefault()}),this._element.addEventListener("mousedown",s=>{s.preventDefault()}),Qe(this._element,this._anchor,"marker"),this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",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("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),ee.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=a.LngLat.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 u=Math.sqrt(Math.pow(13.5,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[u,-1*(38.1-13.5+u)],"bottom-right":[-u,-1*(38.1-13.5+u)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}_onKeyPress(t){const n=t.code,s=t.charCode||t.keyCode;n!=="Space"&&n!=="Enter"&&s!==32&&s!==13||this.togglePopup()}_onMapClick(t){const n=t.originalEvent.target,s=this._element;this._popup&&(n===s||s.contains(n))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}_update(t){if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=xo(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let n="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?n=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(n=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let s="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?s="rotateX(0deg)":this._pitchAlignment==="map"&&(s=`rotateX(${this._map.getPitch()}deg)`),t&&t.type!=="moveend"||(this._pos=this._pos.round()),ee.setTransform(this._element,`${je[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${s} ${n}`),this._map.style&&this._map.style.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{const u=this._map.unproject(this._pos),d=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=u.distanceTo(this._lngLat)>20*d?"0.2":"1.0",this._opacityTimeout=null},100))}getOffset(){return this._offset}setOffset(t){return this._offset=a.pointGeometry.convert(t),this._update(),this}_onMove(t){if(!this._isDragging){const n=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=n}this._isDragging&&(this._pos=t.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 a.Event("dragstart"))),this.fire(new a.Event("drag")))}_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 a.Event("dragend")),this._state="inactive"}_addDragHandler(t){this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.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))}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}}const Os={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Zr,mi=0,qr=!1;const gr={maxWidth:100,unit:"metric"};function Qa(l,t,n){const s=n&&n.maxWidth||100,u=l._container.clientHeight/2,d=l.unproject([0,u]),f=l.unproject([s,u]),_=d.distanceTo(f);if(n&&n.unit==="imperial"){const y=3.2808*_;y>5280?jr(t,s,y/5280,l._getUIString("ScaleControl.Miles")):jr(t,s,y,l._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?jr(t,s,_/1852,l._getUIString("ScaleControl.NauticalMiles")):_>=1e3?jr(t,s,_/1e3,l._getUIString("ScaleControl.Kilometers")):jr(t,s,_,l._getUIString("ScaleControl.Meters"))}function jr(l,t,n,s){const u=function(d){const f=Math.pow(10,`${Math.floor(d)}`.length-1);let _=d/f;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:function(y){const w=Math.pow(10,Math.ceil(-Math.log(y)/Math.LN10));return Math.round(y*w)/w}(_),f*_}(n);l.style.width=t*(u/n)+"px",l.innerHTML=`${u} ${s}`}const Ht={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Qt=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function $s(l){if(l){if(typeof l=="number"){const t=Math.round(Math.sqrt(.5*Math.pow(l,2)));return{center:new a.pointGeometry(0,0),top:new a.pointGeometry(0,l),"top-left":new a.pointGeometry(t,t),"top-right":new a.pointGeometry(-t,t),bottom:new a.pointGeometry(0,-l),"bottom-left":new a.pointGeometry(t,-t),"bottom-right":new a.pointGeometry(-t,-t),left:new a.pointGeometry(l,0),right:new a.pointGeometry(-l,0)}}if(l instanceof a.pointGeometry||Array.isArray(l)){const t=a.pointGeometry.convert(l);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:a.pointGeometry.convert(l.center||[0,0]),top:a.pointGeometry.convert(l.top||[0,0]),"top-left":a.pointGeometry.convert(l["top-left"]||[0,0]),"top-right":a.pointGeometry.convert(l["top-right"]||[0,0]),bottom:a.pointGeometry.convert(l.bottom||[0,0]),"bottom-left":a.pointGeometry.convert(l["bottom-left"]||[0,0]),"bottom-right":a.pointGeometry.convert(l["bottom-right"]||[0,0]),left:a.pointGeometry.convert(l.left||[0,0]),right:a.pointGeometry.convert(l.right||[0,0])}}return $s(new a.pointGeometry(0,0))}const sn={supported:W,setRTLTextPlugin:a.setRTLTextPlugin,getRTLTextPluginStatus:a.getRTLTextPluginStatus,Map:class extends Zt{constructor(l){var t;if(a.PerformanceUtils.mark(a.PerformanceMarkers.create),(l=a.extend({},Ya,l)).minZoom!=null&&l.maxZoom!=null&&l.minZoom>l.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(l.minPitch!=null&&l.maxPitch!=null&&l.minPitch>l.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(l.minPitch!=null&&l.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(l.maxPitch!=null&&l.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new co(l.minZoom,l.maxZoom,l.minPitch,l.maxPitch,l.renderWorldCopies),{bearingSnap:l.bearingSnap}),this._interactive=l.interactive,this._cooperativeGestures=l.cooperativeGestures,this._maxTileCacheSize=l.maxTileCacheSize,this._failIfMajorPerformanceCaveat=l.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=l.preserveDrawingBuffer,this._antialias=l.antialias,this._trackResize=l.trackResize,this._bearingSnap=l.bearingSnap,this._refreshExpiredTiles=l.refreshExpiredTiles,this._fadeDuration=l.fadeDuration,this._crossSourceCollisions=l.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=l.collectResourceTiming,this._renderTaskQueue=new Ka,this._controls=[],this._mapId=a.uniqueId(),this._locale=a.extend({},Ja,l.locale),this._clickTolerance=l.clickTolerance,this._pixelRatio=(t=l.pixelRatio)!==null&&t!==void 0?t:devicePixelRatio,this._requestManager=new Re(l.transformRequest),typeof l.container=="string"){if(this._container=document.getElementById(l.container),!this._container)throw new Error(`Container '${l.container}' not found.`)}else{if(!(l.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=l.container}if(l.maxBounds&&this.setMaxBounds(l.maxBounds),a.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");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)}),typeof window!="undefined"&&(addEventListener("online",this._onWindowOnline,!1),addEventListener("resize",this._onWindowResize,!1),addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new Ha(this,l),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=l.hash&&new Oa(typeof l.hash=="string"&&l.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:l.center,zoom:l.zoom,bearing:l.bearing,pitch:l.pitch}),l.bounds&&(this.resize(),this.fitBounds(l.bounds,a.extend({},l.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=l.localIdeographFontFamily,l.style&&this.setStyle(l.style,{localIdeographFontFamily:l.localIdeographFontFamily}),l.attributionControl&&this.addControl(new yo({customAttribution:l.customAttribution})),l.maplibreLogo&&this.addControl(new Xo,l.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",n=>{this._update(n.dataType==="style"),this.fire(new a.Event(`${n.dataType}data`,n))}),this.on("dataloading",n=>{this.fire(new a.Event(`${n.dataType}dataloading`,n))}),this.on("dataabort",n=>{this.fire(new a.Event("sourcedataabort",n))})}_getMapId(){return this._mapId}addControl(l,t){if(t===void 0&&(t=l.getDefaultPosition?l.getDefaultPosition():"top-right"),!l||!l.onAdd)return this.fire(new a.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=l.onAdd(this);this._controls.push(l);const s=this._controlPositions[t];return t.indexOf("bottom")!==-1?s.insertBefore(n,s.firstChild):s.appendChild(n),this}removeControl(l){if(!l||!l.onRemove)return this.fire(new a.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(l);return t>-1&&this._controls.splice(t,1),l.onRemove(this),this}hasControl(l){return this._controls.indexOf(l)>-1}calculateCameraOptionsFromTo(l,t,n,s){return s==null&&this.style.terrain&&(s=this.transform.getElevation(n,this.style.terrain)),super.calculateCameraOptionsFromTo(l,t,n,s)}resize(l){const t=this._containerDimensions(),n=t[0],s=t[1];this._resizeCanvas(n,s,this.getPixelRatio()),this.transform.resize(n,s),this.painter.resize(n,s,this.getPixelRatio());const u=!this._moving;return u&&(this.stop(),this.fire(new a.Event("movestart",l)).fire(new a.Event("move",l))),this.fire(new a.Event("resize",l)),u&&this.fire(new a.Event("moveend",l)),this}getPixelRatio(){return this._pixelRatio}setPixelRatio(l){const[t,n]=this._containerDimensions();this._pixelRatio=l,this._resizeCanvas(t,n,l),this.painter.resize(t,n,l)}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(l){return this.transform.setMaxBounds(a.LngLatBounds.convert(l)),this._update()}setMinZoom(l){if((l=l==null?-2:l)>=-2&&l<=this.transform.maxZoom)return this.transform.minZoom=l,this._update(),this.getZoom()<l&&this.setZoom(l),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(l){if((l=l==null?22:l)>=this.transform.minZoom)return this.transform.maxZoom=l,this._update(),this.getZoom()>l&&this.setZoom(l),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(l){if((l=l==null?0:l)<0)throw new Error("minPitch must be greater than or equal to 0");if(l>=0&&l<=this.transform.maxPitch)return this.transform.minPitch=l,this._update(),this.getPitch()<l&&this.setPitch(l),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(l){if((l=l==null?60:l)>85)throw new Error("maxPitch must be less than or equal to 85");if(l>=this.transform.minPitch)return this.transform.maxPitch=l,this._update(),this.getPitch()>l&&this.setPitch(l),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(l){return this.transform.renderWorldCopies=l,this._update()}project(l){return this.transform.locationPoint(a.LngLat.convert(l),this.style&&this.style.terrain)}unproject(l){return this.transform.pointLocation(a.pointGeometry.convert(l),this.style&&this.style.terrain)}isMoving(){return this._moving||this.handlers.isMoving()}isZooming(){return this._zooming||this.handlers.isZooming()}isRotating(){return this._rotating||this.handlers.isRotating()}_createDelegatedListener(l,t,n){if(l==="mouseenter"||l==="mouseover"){let s=!1;return{layer:t,listener:n,delegates:{mousemove:d=>{const f=this.getLayer(t)?this.queryRenderedFeatures(d.point,{layers:[t]}):[];f.length?s||(s=!0,n.call(this,new Vi(l,this,d.originalEvent,{features:f}))):s=!1},mouseout:()=>{s=!1}}}}if(l==="mouseleave"||l==="mouseout"){let s=!1;return{layer:t,listener:n,delegates:{mousemove:f=>{(this.getLayer(t)?this.queryRenderedFeatures(f.point,{layers:[t]}):[]).length?s=!0:s&&(s=!1,n.call(this,new Vi(l,this,f.originalEvent)))},mouseout:f=>{s&&(s=!1,n.call(this,new Vi(l,this,f.originalEvent)))}}}}{const s=u=>{const d=this.getLayer(t)?this.queryRenderedFeatures(u.point,{layers:[t]}):[];d.length&&(u.features=d,n.call(this,u),delete u.features)};return{layer:t,listener:n,delegates:{[l]:s}}}}on(l,t,n){if(n===void 0)return super.on(l,t);const s=this._createDelegatedListener(l,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[l]=this._delegatedListeners[l]||[],this._delegatedListeners[l].push(s);for(const u in s.delegates)this.on(u,s.delegates[u]);return this}once(l,t,n){if(n===void 0)return super.once(l,t);const s=this._createDelegatedListener(l,t,n);for(const u in s.delegates)this.once(u,s.delegates[u]);return this}off(l,t,n){return n===void 0?super.off(l,t):(this._delegatedListeners&&this._delegatedListeners[l]&&(s=>{const u=this._delegatedListeners[l];for(let d=0;d<u.length;d++){const f=u[d];if(f.layer===t&&f.listener===n){for(const _ in f.delegates)this.off(_,f.delegates[_]);return u.splice(d,1),this}}})(),this)}queryRenderedFeatures(l,t){if(!this.style)return[];let n;if(t!==void 0||l===void 0||l instanceof a.pointGeometry||Array.isArray(l)||(t=l,l=void 0),t=t||{},(l=l||[[0,0],[this.transform.width,this.transform.height]])instanceof a.pointGeometry||typeof l[0]=="number")n=[a.pointGeometry.convert(l)];else{const s=a.pointGeometry.convert(l[0]),u=a.pointGeometry.convert(l[1]);n=[s,new a.pointGeometry(u.x,s.y),u,new a.pointGeometry(s.x,u.y),s]}return this.style.queryRenderedFeatures(n,t,this.transform)}querySourceFeatures(l,t){return this.style.querySourceFeatures(l,t)}setStyle(l,t){return(t=a.extend({},{localIdeographFontFamily:this._localIdeographFontFamily},t)).diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&l?(this._diffStyle(l,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(l,t))}setTransformRequest(l){return this._requestManager.setTransformRequest(l),this}_getUIString(l){const t=this._locale[l];if(t==null)throw new Error(`Missing UI string '${l}'`);return t}_updateStyle(l,t){return this.style&&(this.style.setEventedParent(null),this.style._remove()),l?(this.style=new _i(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof l=="string"?this.style.loadURL(l):this.style.loadJSON(l),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new _i(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(l,t){if(typeof l=="string"){const n=this._requestManager.transformRequest(l,a.ResourceType.Style);a.getJSON(n,(s,u)=>{s?this.fire(new a.ErrorEvent(s)):u&&this._updateDiff(u,t)})}else typeof l=="object"&&this._updateDiff(l,t)}_updateDiff(l,t){try{this.style.setState(l)&&this._update(!0)}catch(n){a.warnOnce(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(l,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():a.warnOnce("There is no style added to the map.")}addSource(l,t){return this._lazyInitEmptyStyle(),this.style.addSource(l,t),this._update(!0)}isSourceLoaded(l){const t=this.style&&this.style.sourceCaches[l];if(t!==void 0)return t.loaded();this.fire(new a.ErrorEvent(new Error(`There is no source with ID '${l}'`)))}setTerrain(l){return this.style.setTerrain(l),this}getTerrain(){return this.style.terrain&&this.style.terrain.options}areTilesLoaded(){const l=this.style&&this.style.sourceCaches;for(const t in l){const n=l[t]._tiles;for(const s in n){const u=n[s];if(u.state!=="loaded"&&u.state!=="errored")return!1}}return!0}addSourceType(l,t,n){return this._lazyInitEmptyStyle(),this.style.addSourceType(l,t,n)}removeSource(l){return this.style.removeSource(l),this._update(!0)}getSource(l){return this.style.getSource(l)}addImage(l,t,{pixelRatio:n=1,sdf:s=!1,stretchX:u,stretchY:d,content:f}={}){if(this._lazyInitEmptyStyle(),t instanceof HTMLImageElement||a.isImageBitmap(t)){const{width:_,height:y,data:w}=a.exported.getImageData(t);this.style.addImage(l,{data:new a.RGBAImage({width:_,height:y},w),pixelRatio:n,stretchX:u,stretchY:d,content:f,sdf:s,version:0})}else{if(t.width===void 0||t.height===void 0)return this.fire(new a.ErrorEvent(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:_,height:y,data:w}=t,I=t;this.style.addImage(l,{data:new a.RGBAImage({width:_,height:y},new Uint8Array(w)),pixelRatio:n,stretchX:u,stretchY:d,content:f,sdf:s,version:0,userImage:I}),I.onAdd&&I.onAdd(this,l)}}}updateImage(l,t){const n=this.style.getImage(l);if(!n)return this.fire(new a.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const s=t instanceof HTMLImageElement||a.isImageBitmap(t)?a.exported.getImageData(t):t,{width:u,height:d,data:f}=s;if(u===void 0||d===void 0)return this.fire(new a.ErrorEvent(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(u!==n.data.width||d!==n.data.height)return this.fire(new a.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));const _=!(t instanceof HTMLImageElement||a.isImageBitmap(t));n.data.replace(f,_),this.style.updateImage(l,n)}hasImage(l){return l?!!this.style.getImage(l):(this.fire(new a.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(l){this.style.removeImage(l)}loadImage(l,t){a.getImage(this._requestManager.transformRequest(l,a.ResourceType.Image),t)}listImages(){return this.style.listImages()}addLayer(l,t){return this._lazyInitEmptyStyle(),this.style.addLayer(l,t),this._update(!0)}moveLayer(l,t){return this.style.moveLayer(l,t),this._update(!0)}removeLayer(l){return this.style.removeLayer(l),this._update(!0)}getLayer(l){return this.style.getLayer(l)}setLayerZoomRange(l,t,n){return this.style.setLayerZoomRange(l,t,n),this._update(!0)}setFilter(l,t,n={}){return this.style.setFilter(l,t,n),this._update(!0)}getFilter(l){return this.style.getFilter(l)}setPaintProperty(l,t,n,s={}){return this.style.setPaintProperty(l,t,n,s),this._update(!0)}getPaintProperty(l,t){return this.style.getPaintProperty(l,t)}setLayoutProperty(l,t,n,s={}){return this.style.setLayoutProperty(l,t,n,s),this._update(!0)}getLayoutProperty(l,t){return this.style.getLayoutProperty(l,t)}setLight(l,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(l,t),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(l,t){return this.style.setFeatureState(l,t),this._update()}removeFeatureState(l,t){return this.style.removeFeatureState(l,t),this._update()}getFeatureState(l){return this.style.getFeatureState(l)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let l=0,t=0;return this._container&&(l=this._container.clientWidth||400,t=this._container.clientHeight||300),[l,t]}_setupContainer(){const l=this._container;l.classList.add("maplibregl-map","mapboxgl-map");const t=this._canvasContainer=ee.create("div","maplibregl-canvas-container mapboxgl-canvas-container",l);this._interactive&&t.classList.add("maplibregl-interactive","mapboxgl-interactive"),this._canvas=ee.create("canvas","maplibregl-canvas mapboxgl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const n=this._containerDimensions();this._resizeCanvas(n[0],n[1],this.getPixelRatio());const s=this._controlContainer=ee.create("div","maplibregl-control-container mapboxgl-control-container",l),u=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(d=>{u[d]=ee.create("div",`maplibregl-ctrl-${d} mapboxgl-ctrl-${d}`,s)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){const l=this._container;this._metaPress=!1,this._cooperativeGesturesScreen=ee.create("div","maplibregl-cooperative-gesture-screen",l);let t="Control",n=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";navigator.platform.indexOf("Mac")===0&&(n=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use \u2318 + scroll to zoom the map",t="Meta"),this._cooperativeGesturesScreen.innerHTML=`
|
|
585
|
+
<div class="maplibregl-desktop-message">${n}</div>
|
|
586
|
+
<div class="maplibregl-mobile-message">${typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map"}</div>
|
|
587
|
+
`,document.addEventListener("keydown",s=>{s.key===t&&(this._metaPress=!0)}),document.addEventListener("keyup",s=>{s.key===t&&(this._metaPress=!1)}),this._canvasContainer.addEventListener("wheel",s=>{this._onCooperativeGesture(s,this._metaPress,1)},!1),this._canvasContainer.classList.remove("mapboxgl-touch-drag-pan","maplibregl-touch-drag-pan")}_resizeCanvas(l,t,n){this._canvas.width=n*l,this._canvas.height=n*t,this._canvas.style.width=`${l}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const l=a.extend({},W.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),t=this._canvas.getContext("webgl",l)||this._canvas.getContext("experimental-webgl",l);t?(this.painter=new As(t,this.transform),a.exported$1.testSupport(t)):this.fire(new a.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(l){l.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new a.Event("webglcontextlost",{originalEvent:l}))}_contextRestored(l){this._setupPainter(),this.resize(),this._update(),this.fire(new a.Event("webglcontextrestored",{originalEvent:l}))}_onMapScroll(l){if(l.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}_onCooperativeGesture(l,t,n){return!t&&n<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(l){return this.style?(this._styleDirty=this._styleDirty||l,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(l){return this._update(),this._renderTaskQueue.add(l)}_cancelRenderFrame(l){this._renderTaskQueue.remove(l)}_render(l){let t,n=0;const s=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(t=s.createQueryEXT(),s.beginQueryEXT(s.TIME_ELAPSED_EXT,t),n=a.exported.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(l),this._removed)return;let u=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const f=this.transform.zoom,_=a.exported.now();this.style.zoomHistory.update(f,_);const y=new a.EvaluationParameters(f,{now:_,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),w=y.crossFadingFactor();w===1&&w===this._crossFadingFactor||(u=!0,this._crossFadingFactor=w),this.style.update(y)}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.style.terrain&&this.style.terrain.sourceCache.update(this.transform,this.style.terrain),this.transform.updateElevation(this.style.terrain),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,this._fadeDuration,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:this._fadeDuration,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer")}),this.fire(new a.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,a.PerformanceUtils.mark(a.PerformanceMarkers.load),this.fire(new a.Event("load"))),this.style&&(this.style.hasTransitions()||u)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){const f=a.exported.now()-n;s.endQueryEXT(s.TIME_ELAPSED_EXT,t),setTimeout(()=>{const _=s.getQueryObjectEXT(t,s.QUERY_RESULT_EXT)/1e6;s.deleteQueryEXT(t),this.fire(new a.Event("gpu-timing-frame",{cpuTime:f,gpuTime:_}))},50)}if(this.listens("gpu-timing-layer")){const f=this.painter.collectGpuTimers();setTimeout(()=>{const _=this.painter.queryGpuTimers(f);this.fire(new a.Event("gpu-timing-layer",{layerTimes:_}))},50)}const d=this._sourcesDirty||this._styleDirty||this._placementDirty;return d||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new a.Event("idle")),!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,a.PerformanceUtils.mark(a.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window!="undefined"&&(removeEventListener("resize",this._onWindowResize,!1),removeEventListener("orientationchange",this._onWindowResize,!1),removeEventListener("online",this._onWindowOnline,!1));const l=this.painter.context.gl.getExtension("WEBGL_lose_context");l&&l.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),ee.remove(this._canvasContainer),ee.remove(this._controlContainer),this._cooperativeGestures&&ee.remove(this._cooperativeGesturesScreen),this._container.classList.remove("maplibregl-map","mapboxgl-map"),a.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new a.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=a.exported.frame(l=>{a.PerformanceUtils.frame(l),this._frame=null,this._render(l)}))}_onWindowOnline(){this._update()}_onWindowResize(l){this._trackResize&&this.resize({originalEvent:l})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(l){this._showTileBoundaries!==l&&(this._showTileBoundaries=l,this._update())}get showPadding(){return!!this._showPadding}set showPadding(l){this._showPadding!==l&&(this._showPadding=l,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(l){this._showCollisionBoxes!==l&&(this._showCollisionBoxes=l,l?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(l){this._showOverdrawInspector!==l&&(this._showOverdrawInspector=l,this._update())}get repaint(){return!!this._repaint}set repaint(l){this._repaint!==l&&(this._repaint=l,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(l){this._vertices=l,this._update()}_setCacheLimits(l,t){a.setCacheLimits(l,t)}get version(){return"2.4.0"}},NavigationControl:class{constructor(l){this.options=a.extend({},ic,l),this._container=ee.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(a.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in mapboxgl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),ee.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out mapboxgl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),ee.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(a.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass mapboxgl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=ee.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const l=this._map.getZoom(),t=l===this._map.getMaxZoom(),n=l===this._map.getMinZoom();this._zoomInButton.disabled=t,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",n.toString())}_rotateCompassArrow(){const l=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=l}onAdd(l){return this._map=l,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new mr(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){ee.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(l,t){const n=ee.create("button",l,this._container);return n.type="button",n.addEventListener("click",t),n}_setButtonTitle(l,t){const n=this._map._getUIString(`NavigationControl.${t}`);l.title=n,l.setAttribute("aria-label",n)}},GeolocateControl:class extends a.Evented{constructor(l){super(),this.options=a.extend({},Os,l),a.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(l){var t;return this._map=l,this._container=ee.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),t=this._setupUI,Zr!==void 0?t(Zr):window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(n=>{Zr=n.state!=="denied",t(Zr)}):(Zr=!!window.navigator.geolocation,t(Zr)),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(),ee.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,mi=0,qr=!1}_isOutOfMapMaxBounds(l){const t=this._map.getMaxBounds(),n=l.coords;return t&&(n.longitude<t.getWest()||n.longitude>t.getEast()||n.latitude<t.getSouth()||n.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_onSuccess(l){if(this._map){if(this._isOutOfMapMaxBounds(l))return this._setErrorState(),this.fire(new a.Event("outofmaxbounds",l)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=l,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(l),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(l),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new a.Event("geolocate",l)),this._finish()}}_updateCamera(l){const t=new a.LngLat(l.coords.longitude,l.coords.latitude),n=l.coords.accuracy,s=this._map.getBearing(),u=a.extend({bearing:s},this.options.fitBoundsOptions);this._map.fitBounds(t.toBounds(n),u,{geolocateSource:!0})}_updateMarker(l){if(l){const t=new a.LngLat(l.coords.longitude,l.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=l.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const l=this._map._container.clientHeight/2,t=this._map.unproject([0,l]),n=this._map.unproject([1,l]),s=t.distanceTo(n),u=Math.ceil(2*this._accuracy/s);this._circleElement.style.width=`${u}px`,this._circleElement.style.height=`${u}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(l){if(this._map){if(this.options.trackUserLocation)if(l.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(l.code===3&&qr)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new a.Event("error",l)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(l){if(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=ee.create("button","maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate",this._container),ee.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",l===!1){a.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=ee.create("div","maplibregl-user-location-dot mapboxgl-user-location-dot"),this._userLocationDotMarker=new On(this._dotElement),this._circleElement=ee.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new On({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",t=>{t.geolocateSource||this._watchState!=="ACTIVE_LOCK"||t.originalEvent&&t.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this.fire(new a.Event("trackuserlocationend")))})}trigger(){if(!this._setup)return a.warnOnce("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 a.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":mi--,qr=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this.fire(new a.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new a.Event("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-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 l;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),mi++,mi>1?(l={maximumAge:6e5,timeout:0},qr=!0):(l=this.options.positionOptions,qr=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,l)}}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","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:yo,LogoControl:Xo,ScaleControl:class{constructor(l){this.options=a.extend({},gr,l),a.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){Qa(this._map,this._container,this.options)}onAdd(l){return this._map=l,this._container=ee.create("div","maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-ctrl-scale",l.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){ee.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(l){this.options.unit=l,Qa(this._map,this._container,this.options)}},FullscreenControl:class{constructor(l){this._fullscreen=!1,l&&l.container&&(l.container instanceof HTMLElement?this._container=l.container:a.warnOnce("Full screen control 'container' must be a DOM element.")),a.bindAll(["_onClickFullscreen","_changeIcon"],this),"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(l){return this._map=l,this._container||(this._container=this._map.getContainer()),this._controlContainer=ee.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",a.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){ee.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!!(document.fullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled)}_setupUI(){const l=this._fullscreenButton=ee.create("button","maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen",this._controlContainer);ee.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",l).setAttribute("aria-hidden","true"),l.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const l=this._getTitle();this._fullscreenButton.setAttribute("aria-label",l),this._fullscreenButton.title=l}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?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._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},TerrainControl:class{constructor(l){this.options=l,a.bindAll(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(l){return this._map=l,this._container=ee.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._terrainButton=ee.create("button","maplibregl-ctrl-terrain mapboxgl-ctrl-terrain",this._container),ee.create("span","maplibregl-ctrl-icon mapboxgl-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(){ee.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._map.style.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}},Popup:class extends a.Evented{constructor(l){super(),this.options=a.extend(Object.create(Ht),l),a.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(l){return this._map&&this.remove(),this._map=l,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","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new a.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&ee.remove(this._content),this._container&&(ee.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),delete this._map),this.fire(new a.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(l){return this._lngLat=a.LngLat.convert(l),this._pos=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","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer","mapboxgl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=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","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")),this}getElement(){return this._container}setText(l){return this.setDOMContent(document.createTextNode(l))}setHTML(l){const t=document.createDocumentFragment(),n=document.createElement("body");let s;for(n.innerHTML=l;s=n.firstChild,s;)t.appendChild(s);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(l){return this.options.maxWidth=l,this._update(),this}setDOMContent(l){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=ee.create("div","maplibregl-popup-content mapboxgl-popup-content",this._container);return this._content.appendChild(l),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(l){this._container&&this._container.classList.add(l)}removeClassName(l){this._container&&this._container.classList.remove(l)}setOffset(l){return this.options.offset=l,this._update(),this}toggleClassName(l){if(this._container)return this._container.classList.toggle(l)}_createCloseButton(){this.options.closeButton&&(this._closeButton=ee.create("button","maplibregl-popup-close-button mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(l){this._update(l.point)}_onMouseMove(l){this._update(l.point)}_onDrag(l){this._update(l.point)}_update(l){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content||(this._container||(this._container=ee.create("div","maplibregl-popup mapboxgl-popup",this._map.getContainer()),this._tip=ee.create("div","maplibregl-popup-tip mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(d=>this._container.classList.add(d)),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=xo(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!l))return;const t=this._pos=this._trackPointer&&l?l:this._map.project(this._lngLat);let n=this.options.anchor;const s=$s(this.options.offset);if(!n){const d=this._container.offsetWidth,f=this._container.offsetHeight;let _;_=t.y+s.bottom.y<f?["top"]:t.y>this._map.transform.height-f?["bottom"]:[],t.x<d/2?_.push("left"):t.x>this._map.transform.width-d/2&&_.push("right"),n=_.length===0?"bottom":_.join("-")}const u=t.add(s[n]).round();ee.setTransform(this._container,`${je[n]} translate(${u.x}px,${u.y}px)`),Qe(this._container,n,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const l=this._container.querySelector(Qt);l&&l.focus()}_onClose(){this.remove()}},Marker:On,Style:_i,LngLat:a.LngLat,LngLatBounds:a.LngLatBounds,Point:a.pointGeometry,MercatorCoordinate:a.MercatorCoordinate,Evented:a.Evented,AJAXError:a.AJAXError,config:a.config,CanvasSource:Kr,GeoJSONSource:Ti,ImageSource:Ai,RasterDEMTileSource:et,RasterTileSource:pi,VectorTileSource:wi,VideoSource:ir,prewarm:function(){bn().acquire(br)},clearPrewarmedResources:function(){const l=Br;l&&(l.isPreloaded()&&l.numActive()===1?(l.release(br),Br=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()"))},get version(){return"2.4.0"},get workerCount(){return Fi.workerCount},set workerCount(l){Fi.workerCount=l},get maxParallelImageRequests(){return a.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(l){a.config.MAX_PARALLEL_IMAGE_REQUESTS=l},clearStorage(l){a.clearTileCache(l)},workerUrl:"",addProtocol(l,t){a.config.REGISTERED_PROTOCOLS[l]=t},removeProtocol(l){delete a.config.REGISTERED_PROTOCOLS[l]}};return Ji.extend(sn,{isSafari:a.isSafari,getPerformanceMetrics:a.PerformanceUtils.getPerformanceMetrics}),sn});var J=k;return J})})(yd);var jm=yd.exports;function vd(x,v,T){T===void 0&&(T={});var A={type:"Feature"};return(T.id===0||T.id)&&(A.id=T.id),T.bbox&&(A.bbox=T.bbox),A.properties=v||{},A.geometry=x,A}function Hh(x,v,T){if(T===void 0&&(T={}),!x)throw new Error("coordinates is required");if(!Array.isArray(x))throw new Error("coordinates must be an Array");if(x.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Kh(x[0])||!Kh(x[1]))throw new Error("coordinates must contain numbers");var A={type:"Point",coordinates:x};return vd(A,v,T)}function Xm(x,v,T){T===void 0&&(T={});var A={type:"MultiPoint",coordinates:x};return vd(A,v,T)}function Kh(x){return!isNaN(x)&&x!==null&&!Array.isArray(x)}function bd(x,v,T){if(x!==null)for(var A,k,B,J,a,W,K,ce=0,oe=0,ee,Re=x.type,Fe=Re==="FeatureCollection",Me=Re==="Feature",Ze=Fe?x.features.length:1,Ke=0;Ke<Ze;Ke++){K=Fe?x.features[Ke].geometry:Me?x.geometry:x,ee=K?K.type==="GeometryCollection":!1,a=ee?K.geometries.length:1;for(var Je=0;Je<a;Je++){var tt=0,gt=0;if(J=ee?K.geometries[Je]:K,J!==null){W=J.coordinates;var ct=J.type;switch(ce=T&&(ct==="Polygon"||ct==="MultiPolygon")?1:0,ct){case null:break;case"Point":if(v(W,oe,Ke,tt,gt)===!1)return!1;oe++,tt++;break;case"LineString":case"MultiPoint":for(A=0;A<W.length;A++){if(v(W[A],oe,Ke,tt,gt)===!1)return!1;oe++,ct==="MultiPoint"&&tt++}ct==="LineString"&&tt++;break;case"Polygon":case"MultiLineString":for(A=0;A<W.length;A++){for(k=0;k<W[A].length-ce;k++){if(v(W[A][k],oe,Ke,tt,gt)===!1)return!1;oe++}ct==="MultiLineString"&&tt++,ct==="Polygon"&>++}ct==="Polygon"&&tt++;break;case"MultiPolygon":for(A=0;A<W.length;A++){for(gt=0,k=0;k<W[A].length;k++){for(B=0;B<W[A][k].length-ce;B++){if(v(W[A][k][B],oe,Ke,tt,gt)===!1)return!1;oe++}gt++}tt++}break;case"GeometryCollection":for(A=0;A<J.geometries.length;A++)if(bd(J.geometries[A],v,T)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Hc(x){var v=[1/0,1/0,-1/0,-1/0];return bd(x,function(T){v[0]>T[0]&&(v[0]=T[0]),v[1]>T[1]&&(v[1]=T[1]),v[2]<T[0]&&(v[2]=T[0]),v[3]<T[1]&&(v[3]=T[1])}),v}Hc.default=Hc;const Wm={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0},Hm=()=>{const[x,v]=de.exports.useState(null),[T,A]=de.exports.useState(Wm),k=de.exports.useMemo(()=>new window.ResizeObserver(B=>{if(B[0]){const{x:J,y:a,width:W,height:K,top:ce,left:oe,bottom:ee,right:Re}=B[0].contentRect;A({x:J,y:a,width:W,height:K,top:ce,left:oe,bottom:ee,right:Re})}}),[]);return de.exports.useLayoutEffect(()=>{if(!!x)return k.observe(x),()=>{k.disconnect()}},[x]),[v,T,x]};var Km="Expected a function",Jh=0/0,Jm="[object Symbol]",Ym=/^\s+|\s+$/g,Qm=/^[-+]0x[0-9a-f]+$/i,eg=/^0b[01]+$/i,tg=/^0o[0-7]+$/i,ig=parseInt,rg=typeof la=="object"&&la&&la.Object===Object&&la,ng=typeof self=="object"&&self&&self.Object===Object&&self,og=rg||ng||Function("return this")(),sg=Object.prototype,ag=sg.toString,lg=Math.max,cg=Math.min,Zc=function(){return og.Date.now()};function ug(x,v,T){var A,k,B,J,a,W,K=0,ce=!1,oe=!1,ee=!0;if(typeof x!="function")throw new TypeError(Km);v=Yh(v)||0,Kc(T)&&(ce=!!T.leading,oe="maxWait"in T,B=oe?lg(Yh(T.maxWait)||0,v):B,ee="trailing"in T?!!T.trailing:ee);function Re(rt){var Ut=A,Wt=k;return A=k=void 0,K=rt,J=x.apply(Wt,Ut),J}function Fe(rt){return K=rt,a=setTimeout(Ke,v),ce?Re(rt):J}function Me(rt){var Ut=rt-W,Wt=rt-K,ur=v-Ut;return oe?cg(ur,B-Wt):ur}function Ze(rt){var Ut=rt-W,Wt=rt-K;return W===void 0||Ut>=v||Ut<0||oe&&Wt>=B}function Ke(){var rt=Zc();if(Ze(rt))return Je(rt);a=setTimeout(Ke,Me(rt))}function Je(rt){return a=void 0,ee&&A?Re(rt):(A=k=void 0,J)}function tt(){a!==void 0&&clearTimeout(a),K=0,A=W=k=a=void 0}function gt(){return a===void 0?J:Je(Zc())}function ct(){var rt=Zc(),Ut=Ze(rt);if(A=arguments,k=this,W=rt,Ut){if(a===void 0)return Fe(W);if(oe)return a=setTimeout(Ke,v),Re(W)}return a===void 0&&(a=setTimeout(Ke,v)),J}return ct.cancel=tt,ct.flush=gt,ct}function Kc(x){var v=typeof x;return!!x&&(v=="object"||v=="function")}function hg(x){return!!x&&typeof x=="object"}function dg(x){return typeof x=="symbol"||hg(x)&&ag.call(x)==Jm}function Yh(x){if(typeof x=="number")return x;if(dg(x))return Jh;if(Kc(x)){var v=typeof x.valueOf=="function"?x.valueOf():x;x=Kc(v)?v+"":v}if(typeof x!="string")return x===0?x:+x;x=x.replace(Ym,"");var T=eg.test(x);return T||tg.test(x)?ig(x.slice(2),T?2:8):Qm.test(x)?Jh:+x}var pg=ug;const fg=()=>{const[x,v]=de.exports.useState(!1);return de.exports.useLayoutEffect(()=>{const T=()=>{v(window.innerWidth<ld.screenSizes.mobileL)};return window.addEventListener("resize",pg(T,250)),T(),()=>window.removeEventListener("resize",T)},[]),x},mg=x=>de.exports.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...x},de.exports.createElement("g",{clipPath:"url(#clip0_6_16062)"},de.exports.createElement("path",{d:"M3 13H5V11H3V13ZM3 17H5V15H3V17ZM3 9H5V7H3V9ZM7 13H21V11H7V13ZM7 17H21V15H7V17ZM7 7V9H21V7H7ZM3 13H5V11H3V13ZM3 17H5V15H3V17ZM3 9H5V7H3V9ZM7 13H21V11H7V13ZM7 17H21V15H7V17ZM7 7V9H21V7H7Z"}))),wd={all:()=>["pois"],list:x=>[...wd.all(),x]},{scorePois:gg}=Co.Constants;function Td(){var a;const{client:x}=da(),{sdkState:v}=kl(),T=tu(v.options,250),{activeScore:A}=gn(),k=A?gg[A]:void 0,J={...de.exports.useMemo(()=>T!=null&&T.marker?T.marker:{lat:T==null?void 0:T.lat,lng:T==null?void 0:T.lng},[T]),limit:10,radius:2e3,include:k};return ru(wd.list(J),async()=>x.getPois(J),{enabled:!!J&&!!((a=J.include)!=null&&a.length)&&!!J.lat&&!!J.lng})}const Ed={all:()=>["schools"],list:x=>[...Ed.all(),x]};function Sd(){const{client:x}=da(),{sdkState:v}=kl(),T=tu(v.options,250),k={...de.exports.useMemo(()=>T!=null&&T.marker?T.marker:{lat:T==null?void 0:T.lat,lng:T==null?void 0:T.lng},[T]),limit:10,radius:2e3};return ru(Ed.list(k),async()=>x.getSchools(k),{enabled:!!k&&!!k.lat&&!!k.lng})}const Id=st.createContext({}),Cd=()=>de.exports.useContext(Id),_g=({children:x,mapRef:v,mapPadding:T})=>Ee(Id.Provider,{value:{mapRef:v,mapPadding:T},children:x}),Ad=st.memo(({marker:x})=>Ee(Wc,{latitude:x.lat,longitude:x.lng,style:{zIndex:1},children:Ee(Yf.Root,{options:{style:"pin"}})}));Ad.displayName="Pin";function Jc(x,v,T,A,k,B){if(k-A<=T)return;const J=A+k>>1;Md(x,v,J,A,k,B%2),Jc(x,v,T,A,J-1,B+1),Jc(x,v,T,J+1,k,B+1)}function Md(x,v,T,A,k,B){for(;k>A;){if(k-A>600){const K=k-A+1,ce=T-A+1,oe=Math.log(K),ee=.5*Math.exp(2*oe/3),Re=.5*Math.sqrt(oe*ee*(K-ee)/K)*(ce-K/2<0?-1:1),Fe=Math.max(A,Math.floor(T-ce*ee/K+Re)),Me=Math.min(k,Math.floor(T+(K-ce)*ee/K+Re));Md(x,v,T,Fe,Me,B)}const J=v[2*T+B];let a=A,W=k;for(oa(x,v,A,T),v[2*k+B]>J&&oa(x,v,A,k);a<W;){for(oa(x,v,a,W),a++,W--;v[2*a+B]<J;)a++;for(;v[2*W+B]>J;)W--}v[2*A+B]===J?oa(x,v,A,W):(W++,oa(x,v,W,k)),W<=T&&(A=W+1),T<=W&&(k=W-1)}}function oa(x,v,T,A){qc(x,T,A),qc(v,2*T,2*A),qc(v,2*T+1,2*A+1)}function qc(x,v,T){const A=x[v];x[v]=x[T],x[T]=A}function yg(x,v,T,A,k,B,J){const a=[0,x.length-1,0],W=[];let K,ce;for(;a.length;){const oe=a.pop(),ee=a.pop(),Re=a.pop();if(ee-Re<=J){for(let Ze=Re;Ze<=ee;Ze++)K=v[2*Ze],ce=v[2*Ze+1],K>=T&&K<=k&&ce>=A&&ce<=B&&W.push(x[Ze]);continue}const Fe=Math.floor((Re+ee)/2);K=v[2*Fe],ce=v[2*Fe+1],K>=T&&K<=k&&ce>=A&&ce<=B&&W.push(x[Fe]);const Me=(oe+1)%2;(oe===0?T<=K:A<=ce)&&(a.push(Re),a.push(Fe-1),a.push(Me)),(oe===0?k>=K:B>=ce)&&(a.push(Fe+1),a.push(ee),a.push(Me))}return W}function xg(x,v,T,A,k,B){const J=[0,x.length-1,0],a=[],W=k*k;for(;J.length;){const K=J.pop(),ce=J.pop(),oe=J.pop();if(ce-oe<=B){for(let Ze=oe;Ze<=ce;Ze++)Qh(v[2*Ze],v[2*Ze+1],T,A)<=W&&a.push(x[Ze]);continue}const ee=Math.floor((oe+ce)/2),Re=v[2*ee],Fe=v[2*ee+1];Qh(Re,Fe,T,A)<=W&&a.push(x[ee]);const Me=(K+1)%2;(K===0?T-k<=Re:A-k<=Fe)&&(J.push(oe),J.push(ee-1),J.push(Me)),(K===0?T+k>=Re:A+k>=Fe)&&(J.push(ee+1),J.push(ce),J.push(Me))}return a}function Qh(x,v,T,A){const k=x-T,B=v-A;return k*k+B*B}const vg=x=>x[0],bg=x=>x[1];class ed{constructor(v,T=vg,A=bg,k=64,B=Float64Array){this.nodeSize=k,this.points=v;const J=v.length<65536?Uint16Array:Uint32Array,a=this.ids=new J(v.length),W=this.coords=new B(v.length*2);for(let K=0;K<v.length;K++)a[K]=K,W[2*K]=T(v[K]),W[2*K+1]=A(v[K]);Jc(a,W,k,0,a.length-1,0)}range(v,T,A,k){return yg(this.ids,this.coords,v,T,A,k,this.nodeSize)}within(v,T,A){return xg(this.ids,this.coords,v,T,A,this.nodeSize)}}const wg={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:x=>x},Ml=Math.fround||(x=>v=>(x[0]=+v,x[0]))(new Float32Array(1));class Tg{constructor(v){this.options=ca(Object.create(wg),v),this.trees=new Array(this.options.maxZoom+1)}load(v){const{log:T,minZoom:A,maxZoom:k,nodeSize:B}=this.options;T&&console.time("total time");const J=`prepare ${v.length} points`;T&&console.time(J),this.points=v;let a=[];for(let W=0;W<v.length;W++)!v[W].geometry||a.push(Sg(v[W],W));this.trees[k+1]=new ed(a,id,rd,B,Float32Array),T&&console.timeEnd(J);for(let W=k;W>=A;W--){const K=+Date.now();a=this._cluster(a,W),this.trees[W]=new ed(a,id,rd,B,Float32Array),T&&console.log("z%d: %d clusters in %dms",W,a.length,+Date.now()-K)}return T&&console.timeEnd("total time"),this}getClusters(v,T){let A=((v[0]+180)%360+360)%360-180;const k=Math.max(-90,Math.min(90,v[1]));let B=v[2]===180?180:((v[2]+180)%360+360)%360-180;const J=Math.max(-90,Math.min(90,v[3]));if(v[2]-v[0]>=360)A=-180,B=180;else if(A>B){const ce=this.getClusters([A,k,180,J],T),oe=this.getClusters([-180,k,B,J],T);return ce.concat(oe)}const a=this.trees[this._limitZoom(T)],W=a.range(Cl(A),Al(J),Cl(B),Al(k)),K=[];for(const ce of W){const oe=a.points[ce];K.push(oe.numPoints?td(oe):this.points[oe.index])}return K}getChildren(v){const T=this._getOriginId(v),A=this._getOriginZoom(v),k="No cluster with the specified id.",B=this.trees[A];if(!B)throw new Error(k);const J=B.points[T];if(!J)throw new Error(k);const a=this.options.radius/(this.options.extent*Math.pow(2,A-1)),W=B.within(J.x,J.y,a),K=[];for(const ce of W){const oe=B.points[ce];oe.parentId===v&&K.push(oe.numPoints?td(oe):this.points[oe.index])}if(K.length===0)throw new Error(k);return K}getLeaves(v,T,A){T=T||10,A=A||0;const k=[];return this._appendLeaves(k,v,T,A,0),k}getTile(v,T,A){const k=this.trees[this._limitZoom(v)],B=Math.pow(2,v),{extent:J,radius:a}=this.options,W=a/J,K=(A-W)/B,ce=(A+1+W)/B,oe={features:[]};return this._addTileFeatures(k.range((T-W)/B,K,(T+1+W)/B,ce),k.points,T,A,B,oe),T===0&&this._addTileFeatures(k.range(1-W/B,K,1,ce),k.points,B,A,B,oe),T===B-1&&this._addTileFeatures(k.range(0,K,W/B,ce),k.points,-1,A,B,oe),oe.features.length?oe:null}getClusterExpansionZoom(v){let T=this._getOriginZoom(v)-1;for(;T<=this.options.maxZoom;){const A=this.getChildren(v);if(T++,A.length!==1)break;v=A[0].properties.cluster_id}return T}_appendLeaves(v,T,A,k,B){const J=this.getChildren(T);for(const a of J){const W=a.properties;if(W&&W.cluster?B+W.point_count<=k?B+=W.point_count:B=this._appendLeaves(v,W.cluster_id,A,k,B):B<k?B++:v.push(a),v.length===A)break}return B}_addTileFeatures(v,T,A,k,B,J){for(const a of v){const W=T[a],K=W.numPoints;let ce,oe,ee;if(K)ce=Pd(W),oe=W.x,ee=W.y;else{const Me=this.points[W.index];ce=Me.properties,oe=Cl(Me.geometry.coordinates[0]),ee=Al(Me.geometry.coordinates[1])}const Re={type:1,geometry:[[Math.round(this.options.extent*(oe*B-A)),Math.round(this.options.extent*(ee*B-k))]],tags:ce};let Fe;K?Fe=W.id:this.options.generateId?Fe=W.index:this.points[W.index].id&&(Fe=this.points[W.index].id),Fe!==void 0&&(Re.id=Fe),J.features.push(Re)}}_limitZoom(v){return Math.max(this.options.minZoom,Math.min(Math.floor(+v),this.options.maxZoom+1))}_cluster(v,T){const A=[],{radius:k,extent:B,reduce:J,minPoints:a}=this.options,W=k/(B*Math.pow(2,T));for(let K=0;K<v.length;K++){const ce=v[K];if(ce.zoom<=T)continue;ce.zoom=T;const oe=this.trees[T+1],ee=oe.within(ce.x,ce.y,W),Re=ce.numPoints||1;let Fe=Re;for(const Me of ee){const Ze=oe.points[Me];Ze.zoom>T&&(Fe+=Ze.numPoints||1)}if(Fe>Re&&Fe>=a){let Me=ce.x*Re,Ze=ce.y*Re,Ke=J&&Re>1?this._map(ce,!0):null;const Je=(K<<5)+(T+1)+this.points.length;for(const tt of ee){const gt=oe.points[tt];if(gt.zoom<=T)continue;gt.zoom=T;const ct=gt.numPoints||1;Me+=gt.x*ct,Ze+=gt.y*ct,gt.parentId=Je,J&&(Ke||(Ke=this._map(ce,!0)),J(Ke,this._map(gt)))}ce.parentId=Je,A.push(Eg(Me/Fe,Ze/Fe,Je,Fe,Ke))}else if(A.push(ce),Fe>1)for(const Me of ee){const Ze=oe.points[Me];Ze.zoom<=T||(Ze.zoom=T,A.push(Ze))}}return A}_getOriginId(v){return v-this.points.length>>5}_getOriginZoom(v){return(v-this.points.length)%32}_map(v,T){if(v.numPoints)return T?ca({},v.properties):v.properties;const A=this.points[v.index].properties,k=this.options.map(A);return T&&k===A?ca({},k):k}}function Eg(x,v,T,A,k){return{x:Ml(x),y:Ml(v),zoom:1/0,id:T,parentId:-1,numPoints:A,properties:k}}function Sg(x,v){const[T,A]=x.geometry.coordinates;return{x:Ml(Cl(T)),y:Ml(Al(A)),zoom:1/0,index:v,parentId:-1}}function td(x){return{type:"Feature",id:x.id,properties:Pd(x),geometry:{type:"Point",coordinates:[Ig(x.x),Cg(x.y)]}}}function Pd(x){const v=x.numPoints,T=v>=1e4?`${Math.round(v/1e3)}k`:v>=1e3?`${Math.round(v/100)/10}k`:v;return ca(ca({},x.properties),{cluster:!0,cluster_id:x.id,point_count:v,point_count_abbreviated:T})}function Cl(x){return x/360+.5}function Al(x){const v=Math.sin(x*Math.PI/180),T=.5-.25*Math.log((1+v)/(1-v))/Math.PI;return T<0?0:T>1?1:T}function Ig(x){return(x-.5)*360}function Cg(x){const v=(180-x*360)*Math.PI/180;return 360*Math.atan(Math.exp(v))/Math.PI-90}function ca(x,v){for(const T in v)x[T]=v[T];return x}function id(x){return x.x}function rd(x){return x.y}var nd=Object.prototype.hasOwnProperty;function od(x,v,T){for(T of x.keys())if(Io(T,v))return T}function Io(x,v){var T,A,k;if(x===v)return!0;if(x&&v&&(T=x.constructor)===v.constructor){if(T===Date)return x.getTime()===v.getTime();if(T===RegExp)return x.toString()===v.toString();if(T===Array){if((A=x.length)===v.length)for(;A--&&Io(x[A],v[A]););return A===-1}if(T===Set){if(x.size!==v.size)return!1;for(A of x)if(k=A,k&&typeof k=="object"&&(k=od(v,k),!k)||!v.has(k))return!1;return!0}if(T===Map){if(x.size!==v.size)return!1;for(A of x)if(k=A[0],k&&typeof k=="object"&&(k=od(v,k),!k)||!Io(A[1],v.get(k)))return!1;return!0}if(T===ArrayBuffer)x=new Uint8Array(x),v=new Uint8Array(v);else if(T===DataView){if((A=x.byteLength)===v.byteLength)for(;A--&&x.getInt8(A)===v.getInt8(A););return A===-1}if(ArrayBuffer.isView(x)){if((A=x.byteLength)===v.byteLength)for(;A--&&x[A]===v[A];);return A===-1}if(!T||typeof x=="object"){A=0;for(T in x)if(nd.call(x,T)&&++A&&!nd.call(v,T)||!(T in v)||!Io(x[T],v[T]))return!1;return Object.keys(v).length===A}}return x!==x&&v!==v}function Ag(x){var v=de.exports.useRef(x),T=de.exports.useRef(0);return Io(x,v.current)||(v.current=x,T.current+=1),de.exports.useMemo(function(){return v.current},[T.current])}function Mg(x,v){return de.exports.useEffect(x,Ag(v))}var Pg=function(v){var T=v.points,A=v.bounds,k=v.zoom,B=v.options,J=de.exports.useRef(),a=de.exports.useRef(),W=de.exports.useState([]),K=W[0],ce=W[1],oe=Math.round(k);return Mg(function(){(!J.current||!Io(a.current,T)||!Io(J.current.options,B))&&(J.current=new Tg(B),J.current.load(T)),A&&ce(J.current.getClusters(A,oe)),a.current=T},[T,A,oe,B]),{clusters:K,supercluster:J.current}};const zg=Ft.div`
|
|
588
|
+
border-radius: 50%;
|
|
589
|
+
background: linear-gradient(
|
|
590
|
+
to top,
|
|
591
|
+
${mt["--ll-color-primary-variant1"]},
|
|
592
|
+
${mt["--ll-color-primary"]}
|
|
593
|
+
);
|
|
594
|
+
color: ${mt["--ll-color-on-primary"]};
|
|
595
|
+
height: ${({diameter:x})=>x}px;
|
|
596
|
+
width: ${({diameter:x})=>x}px;
|
|
597
|
+
display: flex;
|
|
598
|
+
justify-content: center;
|
|
599
|
+
align-items: center;
|
|
600
|
+
line-height: 1;
|
|
601
|
+
font-family: ${mt["--ll-font-family"]};
|
|
602
|
+
font-size: ${({diameter:x})=>x/2.5}px;
|
|
603
|
+
border: 2px solid #fff;
|
|
604
|
+
box-shadow: ${mt["--ll-shadow-small"]};
|
|
605
|
+
cursor: default;
|
|
606
|
+
`,kg=({cluster:x,pointsCount:v,onClick:T})=>{const A=x.properties.point_count,k=20+A/v*25;return Ee(zg,{diameter:k,onClick:()=>T&&T(x),children:x.properties.point_count})};function Dg(x){return x.properties.cluster!==void 0}const zd=st.memo(({rect:x,zoom:v,mapRef:T,points:A,isMobile:k,activePOI:B,hoveredPOI:J,isMapMoving:a,setActivePOI:W})=>{var ee;const K=(ee=T==null?void 0:T.current)==null?void 0:ee.getMap().getBounds().toArray().flat(),{clusters:ce,supercluster:oe}=Pg({points:A,bounds:K,zoom:v,options:{radius:50,maxZoom:18}});return Ee(Dl,{children:ce.map((Re,Fe)=>{const[Me,Ze]=Re.geometry.coordinates;if(Dg(Re))return Ee(Wc,{latitude:Ze,longitude:Me,children:Ee(kg,{cluster:Re,pointsCount:A.length,onClick:()=>{var rt;const ct=Math.min(oe.getClusterExpansionZoom(Re.id),20);(rt=T.current)==null||rt.flyTo({zoom:ct,center:[Me,Ze],duration:1e3})}})},`cluster-${Re.id}`);const{poi:Ke,type:Je}=Re.properties,tt=B===Ke,gt=J===Ke;return Ee(Wc,{latitude:Ke.lat,longitude:Ke.lng,style:{zIndex:tt?1:0},children:Ri(Vc.Root,{options:{type:Je,poi:Ke,isOpen:a?!1:tt,isHovered:gt,side:"top",collisionPadding:k?{top:x.height+32,bottom:os*2,left:os*2,right:os*2}:{left:x.width+32,right:os*2,top:os*2,bottom:os*2}},onChange:ct=>{ct.type==="open-change"&&(ct.data?setTimeout(()=>{W(Ke)},0):tt&&W(void 0))},children:[Ee(Vc.Marker,{}),Ee(Vc.Content,{})]})},`${Ke.name}-${Ke.lat}-${Ke.lng}-${Fe}`)})})});zd.displayName="Markers";const kd={all:()=>["scores"],list:x=>[...kd.all(),x]};function ou(x){const{client:v}=da(),{sdkState:T}=kl(),A=tu(T.options,250),B={...de.exports.useMemo(()=>A!=null&&A.marker?A.marker:{lat:A==null?void 0:A.lat,lng:A==null?void 0:A.lng},[A]),geographyLevels:["10","30"],locationScoresRounding:!1,include:x};return ru(kd.list(B),async()=>v.getScores(B),{enabled:!!B})}const Lg=Ft.div`
|
|
607
|
+
padding: ${mt["--ll-spacing-small"]} ${mt["--ll-spacing-medium"]};
|
|
608
|
+
background-color: ${mt["--ll-color-surface"]};
|
|
609
|
+
display: flex;
|
|
610
|
+
flex-direction: column;
|
|
611
|
+
overflow: hidden;
|
|
612
|
+
flex: 1;
|
|
613
|
+
`,Rg=Ft.div`
|
|
614
|
+
display: grid;
|
|
615
|
+
grid-template-columns: min-content 1fr;
|
|
616
|
+
grid-gap: ${mt["--ll-spacing-medium"]};
|
|
617
|
+
margin-bottom: ${mt["--ll-spacing-medium"]};
|
|
618
|
+
`,Bg=Ft.div`
|
|
619
|
+
overflow: auto;
|
|
620
|
+
|
|
621
|
+
&:not(:empty) {
|
|
622
|
+
margin-top: ${mt["--ll-spacing-medium"]};
|
|
623
|
+
}
|
|
624
|
+
`;function su(x,v=[]){let T=[];function A(B,J){const a=de.exports.createContext(J),W=T.length;T=[...T,J];function K(oe){const{scope:ee,children:Re,...Fe}=oe,Me=(ee==null?void 0:ee[x][W])||a,Ze=de.exports.useMemo(()=>Fe,Object.values(Fe));return de.exports.createElement(Me.Provider,{value:Ze},Re)}function ce(oe,ee){const Re=(ee==null?void 0:ee[x][W])||a,Fe=de.exports.useContext(Re);if(Fe)return Fe;if(J!==void 0)return J;throw new Error(`\`${oe}\` must be used within \`${B}\``)}return K.displayName=B+"Provider",[K,ce]}const k=()=>{const B=T.map(J=>de.exports.createContext(J));return function(a){const W=(a==null?void 0:a[x])||B;return de.exports.useMemo(()=>({[`__scope${x}`]:{...a,[x]:W}}),[a,W])}};return k.scopeName=x,[A,Fg(k,...v)]}function Fg(...x){const v=x[0];if(x.length===1)return v;const T=()=>{const A=x.map(k=>({useScope:k(),scopeName:k.scopeName}));return function(B){const J=A.reduce((a,{useScope:W,scopeName:K})=>{const oe=W(B)[`__scope${K}`];return{...a,...oe}},{});return de.exports.useMemo(()=>({[`__scope${v.scopeName}`]:J}),[J])}};return T.scopeName=v.scopeName,T}function Og(x,v){typeof x=="function"?x(v):x!=null&&(x.current=v)}function Dd(...x){return v=>x.forEach(T=>Og(T,v))}function ha(...x){return de.exports.useCallback(Dd(...x),x)}const Pl=de.exports.forwardRef((x,v)=>{const{children:T,...A}=x,k=de.exports.Children.toArray(T),B=k.find(Ug);if(B){const J=B.props.children,a=k.map(W=>W===B?de.exports.Children.count(J)>1?de.exports.Children.only(null):de.exports.isValidElement(J)?J.props.children:null:W);return de.exports.createElement(Yc,Bi({},A,{ref:v}),de.exports.isValidElement(J)?de.exports.cloneElement(J,void 0,a):null)}return de.exports.createElement(Yc,Bi({},A,{ref:v}),T)});Pl.displayName="Slot";const Yc=de.exports.forwardRef((x,v)=>{const{children:T,...A}=x;return de.exports.isValidElement(T)?de.exports.cloneElement(T,{...Vg(A,T.props),ref:Dd(v,T.ref)}):de.exports.Children.count(T)>1?de.exports.Children.only(null):null});Yc.displayName="SlotClone";const $g=({children:x})=>de.exports.createElement(de.exports.Fragment,null,x);function Ug(x){return de.exports.isValidElement(x)&&x.type===$g}function Vg(x,v){const T={...v};for(const A in v){const k=x[A],B=v[A];/^on[A-Z]/.test(A)?T[A]=(...a)=>{B==null||B(...a),k==null||k(...a)}:A==="style"?T[A]={...k,...B}:A==="className"&&(T[A]=[k,B].filter(Boolean).join(" "))}return{...x,...T}}function Ng(x){const v=x+"CollectionProvider",[T,A]=su(v),[k,B]=T(v,{collectionRef:{current:null},itemMap:new Map}),J=Re=>{const{scope:Fe,children:Me}=Re,Ze=st.useRef(null),Ke=st.useRef(new Map).current;return st.createElement(k,{scope:Fe,itemMap:Ke,collectionRef:Ze},Me)},a=x+"CollectionSlot",W=st.forwardRef((Re,Fe)=>{const{scope:Me,children:Ze}=Re,Ke=B(a,Me),Je=ha(Fe,Ke.collectionRef);return st.createElement(Pl,{ref:Je},Ze)}),K=x+"CollectionItemSlot",ce="data-radix-collection-item",oe=st.forwardRef((Re,Fe)=>{const{scope:Me,children:Ze,...Ke}=Re,Je=st.useRef(null),tt=ha(Fe,Je),gt=B(K,Me);return st.useEffect(()=>(gt.itemMap.set(Je,{ref:Je,...Ke}),()=>void gt.itemMap.delete(Je))),st.createElement(Pl,{[ce]:"",ref:tt},Ze)});function ee(Re){const Fe=B(x+"CollectionConsumer",Re);return st.useCallback(()=>{const Ze=Fe.collectionRef.current;if(!Ze)return[];const Ke=Array.from(Ze.querySelectorAll(`[${ce}]`));return Array.from(Fe.itemMap.values()).sort((gt,ct)=>Ke.indexOf(gt.ref.current)-Ke.indexOf(ct.ref.current))},[Fe.collectionRef,Fe.itemMap])}return[{Provider:J,Slot:W,ItemSlot:oe},ee,A]}function Ld(x,v,{checkForDefaultPrevented:T=!0}={}){return function(k){if(x==null||x(k),T===!1||!k.defaultPrevented)return v==null?void 0:v(k)}}function Rd(x){const v=de.exports.useRef(x);return de.exports.useEffect(()=>{v.current=x}),de.exports.useMemo(()=>(...T)=>{var A;return(A=v.current)===null||A===void 0?void 0:A.call(v,...T)},[])}function au({prop:x,defaultProp:v,onChange:T=()=>{}}){const[A,k]=Gg({defaultProp:v,onChange:T}),B=x!==void 0,J=B?x:A,a=Rd(T),W=de.exports.useCallback(K=>{if(B){const oe=typeof K=="function"?K(x):K;oe!==x&&a(oe)}else k(K)},[B,x,k,a]);return[J,W]}function Gg({defaultProp:x,onChange:v}){const T=de.exports.useState(x),[A]=T,k=de.exports.useRef(A),B=Rd(v);return de.exports.useEffect(()=>{k.current!==A&&(B(A),k.current=A)},[A,k,B]),T}const Zg=["a","button","div","h2","h3","img","li","nav","ol","p","span","svg","ul"],fa=Zg.reduce((x,v)=>{const T=de.exports.forwardRef((A,k)=>{const{asChild:B,...J}=A,a=B?Pl:v;return de.exports.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),de.exports.createElement(a,Bi({},J,{ref:k}))});return T.displayName=`Primitive.${v}`,{...x,[v]:T}},{}),zl=Boolean(globalThis==null?void 0:globalThis.document)?de.exports.useLayoutEffect:()=>{};function qg(x,v){return de.exports.useReducer((T,A)=>{const k=v[T][A];return k!=null?k:T},x)}const Bd=x=>{const{present:v,children:T}=x,A=jg(v),k=typeof T=="function"?T({present:A.isPresent}):de.exports.Children.only(T),B=ha(A.ref,k.ref);return typeof T=="function"||A.isPresent?de.exports.cloneElement(k,{ref:B}):null};Bd.displayName="Presence";function jg(x){const[v,T]=de.exports.useState(),A=de.exports.useRef({}),k=de.exports.useRef(x),B=de.exports.useRef("none"),J=x?"mounted":"unmounted",[a,W]=qg(J,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return de.exports.useEffect(()=>{const K=Sl(A.current);B.current=a==="mounted"?K:"none"},[a]),zl(()=>{const K=A.current,ce=k.current;if(ce!==x){const ee=B.current,Re=Sl(K);x?W("MOUNT"):Re==="none"||(K==null?void 0:K.display)==="none"?W("UNMOUNT"):W(ce&&ee!==Re?"ANIMATION_OUT":"UNMOUNT"),k.current=x}},[x,W]),zl(()=>{if(v){const K=oe=>{const Re=Sl(A.current).includes(oe.animationName);oe.target===v&&Re&&eu.exports.flushSync(()=>W("ANIMATION_END"))},ce=oe=>{oe.target===v&&(B.current=Sl(A.current))};return v.addEventListener("animationstart",ce),v.addEventListener("animationcancel",K),v.addEventListener("animationend",K),()=>{v.removeEventListener("animationstart",ce),v.removeEventListener("animationcancel",K),v.removeEventListener("animationend",K)}}else W("ANIMATION_END")},[v,W]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:de.exports.useCallback(K=>{K&&(A.current=getComputedStyle(K)),T(K)},[])}}function Sl(x){return(x==null?void 0:x.animationName)||"none"}const Xg=Qf["useId".toString()]||(()=>{});let Wg=0;function Fd(x){const[v,T]=de.exports.useState(Xg());return zl(()=>{x||T(A=>A!=null?A:String(Wg++))},[x]),x||(v?`radix-${v}`:"")}const Od="Collapsible",[Hg,$d]=su(Od),[Kg,lu]=Hg(Od),Jg=de.exports.forwardRef((x,v)=>{const{__scopeCollapsible:T,open:A,defaultOpen:k,disabled:B,onOpenChange:J,...a}=x,[W=!1,K]=au({prop:A,defaultProp:k,onChange:J});return de.exports.createElement(Kg,{scope:T,disabled:B,contentId:Fd(),open:W,onOpenToggle:de.exports.useCallback(()=>K(ce=>!ce),[K])},de.exports.createElement(fa.div,Bi({"data-state":cu(W),"data-disabled":B?"":void 0},a,{ref:v})))}),Yg="CollapsibleTrigger",Qg=de.exports.forwardRef((x,v)=>{const{__scopeCollapsible:T,...A}=x,k=lu(Yg,T);return de.exports.createElement(fa.button,Bi({type:"button","aria-controls":k.contentId,"aria-expanded":k.open||!1,"data-state":cu(k.open),"data-disabled":k.disabled?"":void 0,disabled:k.disabled},A,{ref:v,onClick:Ld(x.onClick,k.onOpenToggle)}))}),Ud="CollapsibleContent",e_=de.exports.forwardRef((x,v)=>{const{forceMount:T,...A}=x,k=lu(Ud,x.__scopeCollapsible);return de.exports.createElement(Bd,{present:T||k.open},({present:B})=>de.exports.createElement(t_,Bi({},A,{ref:v,present:B})))}),t_=de.exports.forwardRef((x,v)=>{const{__scopeCollapsible:T,present:A,children:k,...B}=x,J=lu(Ud,T),[a,W]=de.exports.useState(A),K=de.exports.useRef(null),ce=ha(v,K),oe=de.exports.useRef(0),ee=oe.current,Re=de.exports.useRef(0),Fe=Re.current,Me=J.open||a,Ze=de.exports.useRef(Me),Ke=de.exports.useRef();return de.exports.useEffect(()=>{const Je=requestAnimationFrame(()=>Ze.current=!1);return()=>cancelAnimationFrame(Je)},[]),zl(()=>{const Je=K.current;if(Je){Ke.current=Ke.current||{transitionDuration:Je.style.transitionDuration,animationDuration:Je.style.animationDuration,animationFillMode:Je.style.animationFillMode},Je.style.transitionDuration="0s",Je.style.animationDuration="0s",Je.style.animationFillMode="none";const tt=Je.getBoundingClientRect();oe.current=tt.height,Re.current=tt.width,Ze.current||(Je.style.transitionDuration=Ke.current.transitionDuration,Je.style.animationDuration=Ke.current.animationDuration,Je.style.animationFillMode=Ke.current.animationFillMode),W(A)}},[J.open,A]),de.exports.createElement(fa.div,Bi({"data-state":cu(J.open),"data-disabled":J.disabled?"":void 0,id:J.contentId,hidden:!Me},B,{ref:ce,style:{["--radix-collapsible-content-height"]:ee?`${ee}px`:void 0,["--radix-collapsible-content-width"]:Fe?`${Fe}px`:void 0,...x.style}}),Me&&k)});function cu(x){return x?"open":"closed"}const i_=Jg,r_=Qg,n_=e_,ma="Accordion",o_=["Home","End","ArrowDown","ArrowUp"],[uu,s_,a_]=Ng(ma),[Bl,iy]=su(ma,[a_,$d]),hu=$d(),Vd=st.forwardRef((x,v)=>{const{type:T,...A}=x,k=A,B=A;return st.createElement(uu.Provider,{scope:x.__scopeAccordion},T==="multiple"?st.createElement(h_,Bi({},B,{ref:v})):st.createElement(u_,Bi({},k,{ref:v})))});Vd.propTypes={type(x){const v=x.value||x.defaultValue;return x.type&&!["single","multiple"].includes(x.type)?new Error("Invalid prop `type` supplied to `Accordion`. Expected one of `single | multiple`."):x.type==="multiple"&&typeof v=="string"?new Error("Invalid prop `type` supplied to `Accordion`. Expected `single` when `defaultValue` or `value` is type `string`."):x.type==="single"&&Array.isArray(v)?new Error("Invalid prop `type` supplied to `Accordion`. Expected `multiple` when `defaultValue` or `value` is type `string[]`."):null}};const[Nd,l_]=Bl(ma),[Gd,c_]=Bl(ma,{collapsible:!1}),u_=st.forwardRef((x,v)=>{const{value:T,defaultValue:A,onValueChange:k=()=>{},collapsible:B=!1,...J}=x,[a,W]=au({prop:T,defaultProp:A,onChange:k});return st.createElement(Nd,{scope:x.__scopeAccordion,value:a?[a]:[],onItemOpen:W,onItemClose:st.useCallback(()=>B&&W(""),[B,W])},st.createElement(Gd,{scope:x.__scopeAccordion,collapsible:B},st.createElement(Zd,Bi({},J,{ref:v}))))}),h_=st.forwardRef((x,v)=>{const{value:T,defaultValue:A,onValueChange:k=()=>{},...B}=x,[J=[],a]=au({prop:T,defaultProp:A,onChange:k}),W=st.useCallback(ce=>a((oe=[])=>[...oe,ce]),[a]),K=st.useCallback(ce=>a((oe=[])=>oe.filter(ee=>ee!==ce)),[a]);return st.createElement(Nd,{scope:x.__scopeAccordion,value:J,onItemOpen:W,onItemClose:K},st.createElement(Gd,{scope:x.__scopeAccordion,collapsible:!0},st.createElement(Zd,Bi({},B,{ref:v}))))}),[d_,p_]=Bl(ma),Zd=st.forwardRef((x,v)=>{const{__scopeAccordion:T,disabled:A,...k}=x,B=st.useRef(null),J=ha(B,v),a=s_(T),W=Ld(x.onKeyDown,K=>{var ce;if(!o_.includes(K.key))return;const oe=K.target,ee=a().filter(Ke=>{var Je;return!((Je=Ke.ref.current)!==null&&Je!==void 0&&Je.disabled)}),Re=ee.findIndex(Ke=>Ke.ref.current===oe),Fe=ee.length;if(Re===-1)return;K.preventDefault();let Me=Re;switch(K.key){case"Home":Me=0;break;case"End":Me=Fe-1;break;case"ArrowDown":Me=Re+1;break;case"ArrowUp":Me=Re-1,Me<0&&(Me=Fe-1);break}const Ze=Me%Fe;(ce=ee[Ze].ref.current)===null||ce===void 0||ce.focus()});return st.createElement(d_,{scope:T,disabled:A},st.createElement(uu.Slot,{scope:T},st.createElement(fa.div,Bi({},k,{ref:J,onKeyDown:A?void 0:W}))))}),Qc="AccordionItem",[f_,du]=Bl(Qc),m_=st.forwardRef((x,v)=>{const{__scopeAccordion:T,value:A,...k}=x,B=p_(Qc,T),J=l_(Qc,T),a=hu(T),W=Fd(),K=A&&J.value.includes(A)||!1,ce=B.disabled||x.disabled;return st.createElement(f_,{scope:T,open:K,disabled:ce,triggerId:W},st.createElement(i_,Bi({"data-state":K?"open":"closed"},a,k,{ref:v,disabled:ce,open:K,onOpenChange:oe=>{oe?J.onItemOpen(A):J.onItemClose(A)}})))}),g_="AccordionHeader",__=st.forwardRef((x,v)=>{const{__scopeAccordion:T,...A}=x,k=du(g_,T);return st.createElement(fa.h3,Bi({"data-state":b_(k.open),"data-disabled":k.disabled?"":void 0},A,{ref:v}))}),sd="AccordionTrigger",y_=st.forwardRef((x,v)=>{const{__scopeAccordion:T,...A}=x,k=du(sd,T),B=c_(sd,T),J=hu(T);return st.createElement(uu.ItemSlot,{scope:T},st.createElement(r_,Bi({"aria-disabled":k.open&&!B.collapsible||void 0,id:k.triggerId},J,A,{ref:v})))}),x_="AccordionContent",v_=st.forwardRef((x,v)=>{const{__scopeAccordion:T,...A}=x,k=du(x_,T),B=hu(T);return st.createElement(n_,Bi({role:"region","aria-labelledby":k.triggerId},B,A,{ref:v,style:{["--radix-accordion-content-height"]:"var(--radix-collapsible-content-height)",["--radix-accordion-content-width"]:"var(--radix-collapsible-content-width)",...x.style}}))});function b_(x){return x?"open":"closed"}const w_=Vd,T_=m_,E_=__,S_=y_,I_=v_,C_=cd({from:{height:0},to:{height:"var(--radix-accordion-content-height)"}}),A_=cd({from:{height:"var(--radix-accordion-content-height)"},to:{height:0}}),M_=Ft(E_)`
|
|
625
|
+
margin: 0;
|
|
626
|
+
`,qd=Ft(S_)`
|
|
627
|
+
background: none;
|
|
628
|
+
border: none;
|
|
629
|
+
display: flex;
|
|
630
|
+
align-items: center;
|
|
631
|
+
width: 100%;
|
|
632
|
+
padding: ${mt["--ll-spacing-x-small"]} 0;
|
|
633
|
+
`,P_=Ft(I_)`
|
|
634
|
+
background-color: ${mt["--ll-color-surface"]};
|
|
635
|
+
position: relative;
|
|
636
|
+
z-index: 1;
|
|
637
|
+
overflow: hidden;
|
|
638
|
+
margin-left: calc(-1 * ${mt["--ll-spacing-medium"]});
|
|
639
|
+
margin-right: calc(-1 * ${mt["--ll-spacing-medium"]});
|
|
640
|
+
|
|
641
|
+
[data-state="open"] & {
|
|
642
|
+
animation: ${C_} 300ms cubic-bezier(0.87, 0, 0.13, 1);
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
[data-state="closed"] & {
|
|
646
|
+
animation: ${A_} 300ms cubic-bezier(0.87, 0, 0.13, 1);
|
|
647
|
+
}
|
|
648
|
+
`,z_=Ft.div`
|
|
649
|
+
padding: ${mt["--ll-spacing-medium"]};
|
|
650
|
+
`,k_=Ft.span`
|
|
651
|
+
${qd}[data-state=open] & {
|
|
652
|
+
transform: rotate(90deg);
|
|
653
|
+
} ;
|
|
654
|
+
`;Ft.div`
|
|
655
|
+
display: flex;
|
|
656
|
+
align-items: flex-start;
|
|
657
|
+
justify-content: space-between;
|
|
658
|
+
`;const pu=Ft.div`
|
|
659
|
+
margin: ${mt["--ll-spacing-small"]} 0;
|
|
660
|
+
`,D_=Ft.div`
|
|
661
|
+
margin-top: ${mt["--ll-spacing-large"]};
|
|
662
|
+
|
|
663
|
+
&:empty {
|
|
664
|
+
margin: 0;
|
|
665
|
+
}
|
|
666
|
+
`,jd=st.memo(({result:x,poi:v})=>{const{activePOI:T,setActivePOI:A,hoveredPOI:k,setHoveredPOI:B}=gn(),{mapRef:J,mapPadding:a}=Cd();return!x.data||!x.data[v]?null:Ee(Co.Content,{options:{value:v},children:Ee(ud.Root,{options:{type:"poi",data:x.data[v],activePOI:T,hoveredPOI:k},onChange:W=>{var K;if(W.type==="poi-click"){const ce=W.data;A(ce);const oe=window.innerWidth-a.left,ee=window.innerWidth/2,Re=oe/2+a.left-ee;ce&&((K=J.current)==null||K.flyTo({zoom:18,center:[ce.lng,ce.lat],duration:1e3,offset:[Re,0]}))}W.type==="poi-hover"&&B(W.data)}})},v)});jd.displayName="POI";const fu=st.memo(({include:x})=>{const v=Td();return v.isLoading&&x.length?Ee(Dl,{children:[...Array(10)].map((T,A)=>Ee(pu,{children:Ee(Ll,{height:"34px",width:"100%"})},A))}):v.data?Ri(Co.Root,{options:{include:x},children:[Ee(Co.Tabs,{}),x.map(T=>Ee(jd,{poi:T,result:v},T))]}):null});fu.displayName="POIs";const Xd=({score:x})=>{const{data:v,isLoading:T}=Sd(),{activePOI:A,setActivePOI:k,hoveredPOI:B,setHoveredPOI:J}=gn(),{mapRef:a,mapPadding:W}=Cd();return T?Ee(Dl,{children:[...Array(10)].map(K=>Ee(pu,{children:Ee(Ll,{height:"34px",width:"100%"})},K))}):v?Ee(ud.Root,{options:{type:"school",data:v==null?void 0:v[x],activePOI:A,hoveredPOI:B},onChange:K=>{var ce;if(K.type==="poi-click"){const oe=K.data;k(oe);const ee=window.innerWidth-W.left,Re=window.innerWidth/2,Fe=ee/2+W.left-Re;oe&&((ce=a.current)==null||ce.easeTo({zoom:18,center:[oe.lng,oe.lat],duration:1e3,offset:[Fe,0]}))}K.type==="poi-hover"&&J(K.data)}}):null},{scorePois:ad}=Co.Constants,L_=()=>{const{activeCategory:x,activeScore:v,showMobileList:T}=gn(),A=ua.find(a=>a.value===x),{data:k,isLoading:B}=ou(A.scores),J=a=>!T||!ad[a].length?null:a==="high_schools"||a==="primary_schools"?Ee(Xd,{score:a}):Ee(fu,{include:ad[a]});return v&&(k==null?void 0:k.location[v])?B?Ee("div",{children:"Loading"}):Ee(tr.Root,{options:{score:v,data:k},children:Ri(Lg,{children:[Ri(Rg,{children:[Ee(tr.Badge,{}),Ee(tr.BarChart,{})]}),Ee(tr.Description,{}),Ee(Bg,{children:J(v)})]})}):null},R_=Ft.div`
|
|
667
|
+
display: flex;
|
|
668
|
+
overflow-x: scroll;
|
|
669
|
+
padding: ${mt["--ll-spacing-x-small"]} ${mt["--ll-spacing-medium"]};
|
|
670
|
+
flex-shrink: 0;
|
|
671
|
+
position: relative;
|
|
672
|
+
`,B_=Ft.button`
|
|
673
|
+
position: relative;
|
|
674
|
+
display: flex;
|
|
675
|
+
flex-direction: column;
|
|
676
|
+
align-items: center;
|
|
677
|
+
background: none;
|
|
678
|
+
border: none;
|
|
679
|
+
min-width: 60px;
|
|
680
|
+
padding: 0;
|
|
681
|
+
margin: 0 8px;
|
|
682
|
+
flex-shrink: 0;
|
|
683
|
+
|
|
684
|
+
&:first-child {
|
|
685
|
+
margin-left: 0;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
&:last-child {
|
|
689
|
+
margin-right: 0;
|
|
690
|
+
}
|
|
691
|
+
`,F_=Ft.div`
|
|
692
|
+
position: absolute;
|
|
693
|
+
top: -6px;
|
|
694
|
+
right: 4px;
|
|
695
|
+
border: 2px solid ${mt["--ll-color-background"]};
|
|
696
|
+
border-radius: 6px;
|
|
697
|
+
`,O_=Ft.div`
|
|
698
|
+
flex: 1;
|
|
699
|
+
display: flex;
|
|
700
|
+
align-items: center;
|
|
701
|
+
`,$_=Ft.div`
|
|
702
|
+
margin: 0 2px;
|
|
703
|
+
`,U_=({category:x})=>{const{data:v,isLoading:T,isFetching:A}=ou(x.scores),{activeScore:k,setActiveScore:B,setActiveCategory:J,setShowMobileList:a}=gn();return Ee(R_,{children:x.scores.map(W=>{const K=W===k,ce=K?"--ll-color-primary":"--ll-color-disabled";return T||A?Ee($_,{children:Ee(Ll,{height:"44px",width:"60px"})},W):Ee(tr.Root,{options:{score:W,data:v},children:Ri(B_,{onClick:()=>{a(!1),J(x.value),B(W)},children:[Ee(tr.Icon,{options:{color:ce}}),Ee(O_,{children:Ee(tr.Title,{options:{variant:"caption1",color:ce,noWrap:!0,noMargin:!0,weight:"--ll-font-weight-bold"}})}),Ee(F_,{children:Ee(tr.Badge,{options:{variant:"small",isPrimary:K}})})]})},W)})})},V_=Ft.div`
|
|
704
|
+
display: flex;
|
|
705
|
+
padding: ${mt["--ll-spacing-x-small"]} ${mt["--ll-spacing-medium"]} ${mt["--ll-spacing-xx-small"]} ${mt["--ll-spacing-medium"]};
|
|
706
|
+
`,N_=Ft.div`
|
|
707
|
+
position: absolute;
|
|
708
|
+
top: 0;
|
|
709
|
+
left: 0;
|
|
710
|
+
right: 0;
|
|
711
|
+
bottom: ${({showMobileList:x})=>x&&0};
|
|
712
|
+
z-index: 3;
|
|
713
|
+
box-shadow: rgba(0, 0, 0, 0.15) 0px 3px 8px;
|
|
714
|
+
background-color: #fff;
|
|
715
|
+
overflow: hidden;
|
|
716
|
+
display: flex;
|
|
717
|
+
flex-direction: column;
|
|
718
|
+
background-color: ${mt["--ll-color-background"]};
|
|
719
|
+
border: 1px solid ${mt["--ll-color-border"]};
|
|
720
|
+
`,Wd=st.forwardRef(({showMobileList:x},v)=>{const{activeCategory:T,setActiveCategory:A}=gn();return Ri(N_,{ref:v,showMobileList:x,children:[Ee(V_,{children:Ri(Tl.Root,{value:T,onValueChange:k=>A(k),children:[Ee(Tl.Trigger,{children:Ee(El.Root,{options:{scoreCategory:T},children:Ee(El.Title,{options:{color:"inherit",noMargin:!0}})},T)}),Ee(Tl.Content,{children:ua.map(k=>Ee(El.Root,{options:{scoreCategory:k.value},children:Ee(Tl.Item,{value:k.value,children:Ee(El.Title,{options:{color:"inherit",noMargin:!0}})})},k.value))})]})}),Ee(U_,{category:ua.find(k=>k.value===T)}),Ee(L_,{})]})});Wd.displayName="MobileScores";const G_=x=>de.exports.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...x},de.exports.createElement("path",{d:"M9.99984 6L8.58984 7.41L13.1698 12L8.58984 16.59L9.99984 18L15.9998 12L9.99984 6Z"})),{scorePois:Z_}=Co.Constants,Hd=st.memo(({score:x,isLoading:v,data:T})=>v?Ee(pu,{children:Ee(Ll,{height:"34px",width:"100%"},x)}):Ee(T_,{value:x,children:Ri(tr.Root,{options:{score:x,data:T},children:[Ee(M_,{children:Ri(qd,{children:[Ee(k_,{children:Ee(em,{SVGElement:G_,fill:mt["--ll-color-on-background-variant1"]})}),Ee(aa,{spacing:"--ll-spacing-small"}),Ee(tr.Icon,{}),Ee(aa,{spacing:"--ll-spacing-small"}),Ee(tr.Title,{}),Ee(aa,{}),Ee(tr.Badge,{})]})}),Ee(P_,{children:Ri(z_,{children:[Ee(tr.Description,{}),Ee(aa,{vertical:!0,spacing:"--ll-spacing-small"}),Ee(tr.BarChart,{}),Ee(D_,{children:x==="high_schools"||x==="primary_schools"?Ee(Xd,{score:x}):Ee(fu,{include:Z_[x]})})]})})]})},x));Hd.displayName="Score";const q_=Ft.div`
|
|
721
|
+
padding: ${mt["--ll-spacing-small"]} ${mt["--ll-spacing-medium"]};
|
|
722
|
+
`,j_=Ft.div`
|
|
723
|
+
display: flex;
|
|
724
|
+
justify-content: space-between;
|
|
725
|
+
align-items: center;
|
|
726
|
+
`,Kd=st.memo(({locale:x,data:v,isLoading:T,isFetching:A,tabContent:k})=>{const B=de.exports.useMemo(()=>x==="fr"?"Aucune donn\xE9e disponible pour cet emplacement.":"No data available for this location.",[x]);return Ri(q_,{children:[Ri(j_,{children:[Ee(Il.Title,{options:{variant:"h4",noMargin:!0,weight:"--ll-font-weight-medium"}}),A&&!T&&Ee(tm,{size:"small"})]}),Ee(aa,{spacing:"--ll-spacing-small",vertical:!0}),!A&&!Object.keys((v==null?void 0:v.location)||{}).length&&Ee(im,{color:"--ll-color-on-background-variant1",children:B}),k.scores.map(J=>Ee(Hd,{score:J,data:v,isLoading:T},J))]})});Kd.displayName="ScoreCategory";const Jd=st.memo(({tabContent:x})=>{const{client:v}=da(),{data:T,isLoading:A,isFetching:k}=ou(x.scores),{activeScore:B,setActiveScore:J}=gn();return Ee(w_,{value:B,onValueChange:a=>{J(a)},type:"single",collapsible:!0,children:Ee(Kd,{data:T,isLoading:A,isFetching:k,tabContent:x,locale:v.options.locale})})});Jd.displayName="ScoreCategoryAccordion";const X_=Ft.div`
|
|
727
|
+
overflow-y: auto;
|
|
728
|
+
`,W_=Ft.div`
|
|
729
|
+
position: absolute;
|
|
730
|
+
top: ${mt["--ll-spacing-medium"]};
|
|
731
|
+
left: ${mt["--ll-spacing-medium"]};
|
|
732
|
+
width: 360px;
|
|
733
|
+
max-height: calc(100% - 2 * ${mt["--ll-spacing-medium"]});
|
|
734
|
+
z-index: 1;
|
|
735
|
+
border-radius: ${mt["--ll-border-radius-medium"]};
|
|
736
|
+
box-shadow: rgba(0, 0, 0, 0.15) 0px 3px 8px;
|
|
737
|
+
background-color: #fff;
|
|
738
|
+
overflow: hidden;
|
|
739
|
+
display: flex;
|
|
740
|
+
flex-direction: column;
|
|
741
|
+
background-color: ${mt["--ll-color-background"]};
|
|
742
|
+
border: 1px solid ${mt["--ll-color-border"]};
|
|
743
|
+
`;Ft.div`
|
|
744
|
+
display: flex;
|
|
745
|
+
justify-content: center;
|
|
746
|
+
padding: ${mt["--ll-spacing-small"]};
|
|
747
|
+
`;const H_=Ft.div`
|
|
748
|
+
padding: ${mt["--ll-spacing-x-small"]};
|
|
749
|
+
border-bottom: 1px solid ${mt["--ll-color-border"]};
|
|
750
|
+
`,K_=Ft.div`
|
|
751
|
+
display: flex;
|
|
752
|
+
justify-content: center;
|
|
753
|
+
padding: ${mt["--ll-spacing-small"]};
|
|
754
|
+
background-color: ${mt["--ll-color-background"]};
|
|
755
|
+
`,Yd=()=>Ee(K_,{children:Ee(rm.Root,{})}),Qd=st.forwardRef((x,v)=>{const{activeCategory:T,setActiveCategory:A,setShowMobileList:k}=gn();return Ee(Il.Root,{options:{currentTab:T},onChange:B=>{A(B.data)},children:Ri(W_,{ref:v,children:[Ee(H_,{children:Ee(Il.Tabs,{})}),Ee(X_,{children:ua.map(B=>Ee(Il.Content,{options:{value:B.value},children:Ee(Jd,{tabContent:B},B.value)},B.value))}),Ee(Yd,{})]})})});Qd.displayName="DesktopScores";const J_=Ft.div`
|
|
756
|
+
position: relative;
|
|
757
|
+
display: flex;
|
|
758
|
+
flex-direction: column;
|
|
759
|
+
height: 100vh;
|
|
760
|
+
`,Y_=Ft.div`
|
|
761
|
+
position: absolute;
|
|
762
|
+
bottom: 86px;
|
|
763
|
+
right: 10px;
|
|
764
|
+
background-color: ${mt["--ll-color-background"]};
|
|
765
|
+
z-index: 3;
|
|
766
|
+
border-radius: 50%;
|
|
767
|
+
`,Q_=Ft(nm)`
|
|
768
|
+
box-shadow: ${mt["--ll-shadow-medium"]};
|
|
769
|
+
`,{scorePois:jc}=Co.Constants,ey=()=>{var ur,Wi,hr;const{client:x}=da(),{sdkState:v,setSdkState:T}=kl(),{activeScore:A,activePOI:k,setActivePOI:B,hoveredPOI:J,showMobileList:a,setShowMobileList:W}=gn(),K=fg(),ce=Td(),oe=Sd(),ee=((Wi=(ur=v==null?void 0:v.globalOptions)==null?void 0:ur.appearance)==null?void 0:Wi.theme)==="night"?"basic-v2-dark":"600d69cb-288d-445e-9839-3dfe4d76b31a",[Re,Fe]=de.exports.useState(!1),Me=de.exports.useMemo(()=>{var At;return(A==="high_schools"||A==="primary_schools")&&!oe.isFetching?{[A]:((At=oe==null?void 0:oe.data)==null?void 0:At[A])||[]}:!(A&&jc[A]&&jc[A].length)&&!ce.isFetching?{[A]:[]}:ce.data},[ce.data,oe.data,A]),Ze=de.exports.useMemo(()=>Me?Object.entries(Me).map(([wi,pi])=>pi.map(ii=>Hh([ii.lng,ii.lat],{poi:ii,type:wi}))).flat().filter((wi,pi,ii)=>ii.findIndex(et=>["lat","lng","name"].every(Ti=>et.properties.poi[Ti]===wi.properties.poi[Ti]))===pi):[],[Me]),Ke=de.exports.useMemo(()=>{var wi,pi,ii;const At=((wi=v==null?void 0:v.options)==null?void 0:wi.marker)&&Hh([(pi=v==null?void 0:v.options)==null?void 0:pi.marker.lng,(ii=v==null?void 0:v.options)==null?void 0:ii.marker.lat]);return[...Ze,...At?[At]:[]]},[Ze,(hr=v==null?void 0:v.options)==null?void 0:hr.marker]),Je=de.exports.useRef(),[tt,gt]=Hm(),ct=de.exports.useMemo(()=>({top:25+gt.height,bottom:25,left:25,right:25}),[gt.height]),rt=de.exports.useMemo(()=>({top:50,bottom:50,left:gt.width+32+50,right:50}),[gt.width]),Ut=K?ct:rt,Wt=At=>{T({...v,options:{...v.options,lat:At.viewState.latitude,lng:At.viewState.longitude,zoom:At.viewState.zoom,bearing:At.viewState.bearing,pitch:At.viewState.pitch}})};return de.exports.useEffect(()=>{var Ti,Hi;if(!Ke.length||!((Ti=v.options)!=null&&Ti.marker))return;const At=Xm(Ke.map(({geometry:Ai})=>[Ai.coordinates[1],Ai.coordinates[0]])),[wi,pi,ii,et]=Hc(At);(Hi=Je==null?void 0:Je.current)==null||Hi.fitBounds([[pi,wi],[et,ii]],{maxZoom:17,padding:Ut,duration:1e3})},[Ke,Ut]),de.exports.useMemo(()=>{const{locale:At}=x.options;return a?At==="en"?"Show Map":"Montrer la carte":At==="en"?"Show List":"Montrer la liste"},[x,a]),v.options?Ee(_g,{mapRef:Je,mapPadding:Ut,children:Ri(J_,{children:[Ri(nu,{ref:Je,mapLib:jm,latitude:v.options.lat,longitude:v.options.lng,zoom:v.options.zoom,pitch:v.options.pitch,bearing:v.options.bearing,style:{flex:1,width:"100vw"},mapStyle:`https://api.maptiler.com/maps/${ee}/style.json?key=9jNGatuzs05Q1oNlctEs`,onMove:Wt,cooperativeGestures:v.options.cooperativeGestures,onMoveStart:()=>Fe(!0),onMoveEnd:()=>Fe(!1),children:[Ee(Zm,{showCompass:!0,style:{marginTop:K?16+gt.height:16,marginRight:16}}),v.options.marker&&Ee(Ad,{marker:v.options.marker}),Ee(zd,{rect:gt,zoom:v.options.zoom,mapRef:Je,points:Ze,isMobile:K,activePOI:k,hoveredPOI:J,isMapMoving:Re,setActivePOI:B}),K?Ee(Wd,{ref:tt,showMobileList:a}):Ee(Qd,{ref:tt})]}),K&&Ri(Dl,{children:[Ee(Y_,{children:Ee(Q_,{SVGElement:mg,onClick:()=>W(At=>!At),disabled:!(A&&!!jc[A].length)})}),Ee(Yd,{})]})]})}):Ee("div",{children:"No options provided."})},ry=()=>Ee(Tm,{children:Ee(ey,{})});export{ry as default};
|