@local-logic/sdks-app 1.0.0-beta.42 → 1.0.0-beta.45
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.1679f9d5.js → index.58d7e039.js} +186 -185
- package/dist/assets/index.fde633ba.js +743 -0
- package/dist/index.html +1 -1
- package/dist/types/features/scores/keyFactory.d.ts +1 -1
- package/dist/types/sdks/LocalContent/Map/Attribution/index.d.ts +4 -0
- package/dist/types/sdks/LocalContent/Map/Attribution/index.d.ts.map +1 -0
- package/dist/types/sdks/LocalContent/Map/Attribution/index.js +7 -0
- package/dist/types/sdks/LocalContent/Map/Attribution/index.js.map +1 -0
- package/dist/types/sdks/LocalContent/Map/Attribution/styles.d.ts +2 -0
- package/dist/types/sdks/LocalContent/Map/Attribution/styles.d.ts.map +1 -0
- package/dist/types/sdks/LocalContent/Map/Attribution/styles.js +9 -0
- package/dist/types/sdks/LocalContent/Map/Attribution/styles.js.map +1 -0
- package/dist/types/sdks/LocalContent/Map/{Scores → DesktopScores}/ScoreCategoryAccordion/ScoreCategory/Score/index.d.ts +0 -0
- package/dist/types/sdks/LocalContent/Map/DesktopScores/ScoreCategoryAccordion/ScoreCategory/Score/index.d.ts.map +1 -0
- package/dist/types/sdks/LocalContent/Map/{Scores → DesktopScores}/ScoreCategoryAccordion/ScoreCategory/Score/index.js +3 -2
- package/dist/types/sdks/LocalContent/Map/DesktopScores/ScoreCategoryAccordion/ScoreCategory/Score/index.js.map +1 -0
- package/dist/types/sdks/LocalContent/Map/{Scores → DesktopScores}/ScoreCategoryAccordion/ScoreCategory/Score/styles.d.ts +0 -0
- package/dist/types/sdks/LocalContent/Map/DesktopScores/ScoreCategoryAccordion/ScoreCategory/Score/styles.d.ts.map +1 -0
- package/dist/types/sdks/LocalContent/Map/{Scores → DesktopScores}/ScoreCategoryAccordion/ScoreCategory/Score/styles.js +0 -0
- package/dist/types/sdks/LocalContent/Map/DesktopScores/ScoreCategoryAccordion/ScoreCategory/Score/styles.js.map +1 -0
- package/dist/types/sdks/LocalContent/Map/{Scores → DesktopScores}/ScoreCategoryAccordion/ScoreCategory/index.d.ts +2 -2
- package/dist/types/sdks/LocalContent/Map/DesktopScores/ScoreCategoryAccordion/ScoreCategory/index.d.ts.map +1 -0
- package/dist/types/sdks/LocalContent/Map/{Scores → DesktopScores}/ScoreCategoryAccordion/ScoreCategory/index.js +6 -2
- package/dist/types/sdks/LocalContent/Map/DesktopScores/ScoreCategoryAccordion/ScoreCategory/index.js.map +1 -0
- package/dist/types/sdks/LocalContent/Map/{Scores → DesktopScores}/ScoreCategoryAccordion/ScoreCategory/styles.d.ts +0 -0
- package/dist/types/sdks/LocalContent/Map/DesktopScores/ScoreCategoryAccordion/ScoreCategory/styles.d.ts.map +1 -0
- package/dist/types/sdks/LocalContent/Map/{Scores → DesktopScores}/ScoreCategoryAccordion/ScoreCategory/styles.js +0 -0
- package/dist/types/sdks/LocalContent/Map/DesktopScores/ScoreCategoryAccordion/ScoreCategory/styles.js.map +1 -0
- package/dist/types/sdks/LocalContent/Map/DesktopScores/ScoreCategoryAccordion/index.d.ts +7 -0
- package/dist/types/sdks/LocalContent/Map/DesktopScores/ScoreCategoryAccordion/index.d.ts.map +1 -0
- package/dist/types/sdks/LocalContent/Map/{Scores → DesktopScores}/ScoreCategoryAccordion/index.js +4 -2
- package/dist/types/sdks/LocalContent/Map/DesktopScores/ScoreCategoryAccordion/index.js.map +1 -0
- package/dist/types/sdks/LocalContent/Map/DesktopScores/index.d.ts +4 -0
- package/dist/types/sdks/LocalContent/Map/DesktopScores/index.d.ts.map +1 -0
- package/dist/types/sdks/LocalContent/Map/DesktopScores/index.js +21 -0
- package/dist/types/sdks/LocalContent/Map/DesktopScores/index.js.map +1 -0
- package/dist/types/sdks/LocalContent/Map/DesktopScores/styles.d.ts +5 -0
- package/dist/types/sdks/LocalContent/Map/DesktopScores/styles.d.ts.map +1 -0
- package/dist/types/sdks/LocalContent/Map/DesktopScores/styles.js +31 -0
- package/dist/types/sdks/LocalContent/Map/DesktopScores/styles.js.map +1 -0
- package/dist/types/sdks/LocalContent/Map/Markers/index.d.ts.map +1 -1
- package/dist/types/sdks/LocalContent/Map/Markers/index.js +5 -3
- package/dist/types/sdks/LocalContent/Map/Markers/index.js.map +1 -1
- package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreCategory/index.d.ts +8 -0
- package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreCategory/index.d.ts.map +1 -0
- package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreCategory/index.js +46 -0
- package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreCategory/index.js.map +1 -0
- package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreCategory/styles.d.ts +5 -0
- package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreCategory/styles.d.ts.map +1 -0
- package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreCategory/styles.js +30 -0
- package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreCategory/styles.js.map +1 -0
- package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreInfo/index.d.ts +4 -0
- package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreInfo/index.d.ts.map +1 -0
- package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreInfo/index.js +37 -0
- package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreInfo/index.js.map +1 -0
- package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreInfo/styles.d.ts +4 -0
- package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreInfo/styles.d.ts.map +1 -0
- package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreInfo/styles.js +20 -0
- package/dist/types/sdks/LocalContent/Map/MobileScores/ScoreInfo/styles.js.map +1 -0
- package/dist/types/sdks/LocalContent/Map/MobileScores/index.d.ts +7 -0
- package/dist/types/sdks/LocalContent/Map/MobileScores/index.d.ts.map +1 -0
- package/dist/types/sdks/LocalContent/Map/MobileScores/index.js +11 -0
- package/dist/types/sdks/LocalContent/Map/MobileScores/index.js.map +1 -0
- package/dist/types/sdks/LocalContent/Map/MobileScores/styles.d.ts +5 -0
- package/dist/types/sdks/LocalContent/Map/MobileScores/styles.d.ts.map +1 -0
- package/dist/types/sdks/LocalContent/Map/MobileScores/styles.js +24 -0
- package/dist/types/sdks/LocalContent/Map/MobileScores/styles.js.map +1 -0
- package/dist/types/sdks/LocalContent/Map/{Scores/ScoreCategoryAccordion/ScoreCategory/Score/POIs → POIs}/index.d.ts +0 -0
- package/dist/types/sdks/LocalContent/Map/POIs/index.d.ts.map +1 -0
- package/dist/types/sdks/LocalContent/Map/{Scores/ScoreCategoryAccordion/ScoreCategory/Score/POIs → POIs}/index.js +8 -5
- package/dist/types/sdks/LocalContent/Map/POIs/index.js.map +1 -0
- package/dist/types/sdks/LocalContent/Map/{Scores/ScoreCategoryAccordion/ScoreCategory/Score/Schools → Schools}/index.d.ts +0 -0
- package/dist/types/sdks/LocalContent/Map/Schools/index.d.ts.map +1 -0
- package/dist/types/sdks/LocalContent/Map/{Scores/ScoreCategoryAccordion/ScoreCategory/Score/Schools → Schools}/index.js +9 -6
- package/dist/types/sdks/LocalContent/Map/Schools/index.js.map +1 -0
- package/dist/types/sdks/LocalContent/Map/index.d.ts.map +1 -1
- package/dist/types/sdks/LocalContent/Map/index.js +51 -22
- package/dist/types/sdks/LocalContent/Map/index.js.map +1 -1
- package/dist/types/sdks/LocalContent/Map/styles.d.ts +3 -0
- package/dist/types/sdks/LocalContent/Map/styles.d.ts.map +1 -0
- package/dist/types/sdks/LocalContent/Map/styles.js +17 -0
- package/dist/types/sdks/LocalContent/Map/styles.js.map +1 -0
- package/dist/types/sdks/LocalContent/context.d.ts +6 -4
- package/dist/types/sdks/LocalContent/context.d.ts.map +1 -1
- package/dist/types/sdks/LocalContent/context.js +45 -11
- package/dist/types/sdks/LocalContent/context.js.map +1 -1
- package/dist/types/sdks/LocalContent/features/usePois.js +1 -1
- package/dist/types/sdks/LocalContent/features/usePois.js.map +1 -1
- package/package.json +5 -4
- package/dist/assets/index.f5e9a24b.js +0 -719
- package/dist/types/sdks/LocalContent/Map/Scores/ScoreCategoryAccordion/ScoreCategory/Score/POIs/index.d.ts.map +0 -1
- package/dist/types/sdks/LocalContent/Map/Scores/ScoreCategoryAccordion/ScoreCategory/Score/POIs/index.js.map +0 -1
- package/dist/types/sdks/LocalContent/Map/Scores/ScoreCategoryAccordion/ScoreCategory/Score/Schools/index.d.ts.map +0 -1
- package/dist/types/sdks/LocalContent/Map/Scores/ScoreCategoryAccordion/ScoreCategory/Score/Schools/index.js.map +0 -1
- package/dist/types/sdks/LocalContent/Map/Scores/ScoreCategoryAccordion/ScoreCategory/Score/index.d.ts.map +0 -1
- package/dist/types/sdks/LocalContent/Map/Scores/ScoreCategoryAccordion/ScoreCategory/Score/index.js.map +0 -1
- package/dist/types/sdks/LocalContent/Map/Scores/ScoreCategoryAccordion/ScoreCategory/Score/styles.d.ts.map +0 -1
- package/dist/types/sdks/LocalContent/Map/Scores/ScoreCategoryAccordion/ScoreCategory/Score/styles.js.map +0 -1
- package/dist/types/sdks/LocalContent/Map/Scores/ScoreCategoryAccordion/ScoreCategory/index.d.ts.map +0 -1
- package/dist/types/sdks/LocalContent/Map/Scores/ScoreCategoryAccordion/ScoreCategory/index.js.map +0 -1
- package/dist/types/sdks/LocalContent/Map/Scores/ScoreCategoryAccordion/ScoreCategory/styles.d.ts.map +0 -1
- package/dist/types/sdks/LocalContent/Map/Scores/ScoreCategoryAccordion/ScoreCategory/styles.js.map +0 -1
- package/dist/types/sdks/LocalContent/Map/Scores/ScoreCategoryAccordion/index.d.ts +0 -7
- package/dist/types/sdks/LocalContent/Map/Scores/ScoreCategoryAccordion/index.d.ts.map +0 -1
- package/dist/types/sdks/LocalContent/Map/Scores/ScoreCategoryAccordion/index.js.map +0 -1
- package/dist/types/sdks/LocalContent/Map/Scores/index.d.ts +0 -8
- package/dist/types/sdks/LocalContent/Map/Scores/index.d.ts.map +0 -1
- package/dist/types/sdks/LocalContent/Map/Scores/index.js +0 -69
- package/dist/types/sdks/LocalContent/Map/Scores/index.js.map +0 -1
- package/dist/types/sdks/LocalContent/Map/Scores/styles.d.ts +0 -18
- package/dist/types/sdks/LocalContent/Map/Scores/styles.d.ts.map +0 -1
- package/dist/types/sdks/LocalContent/Map/Scores/styles.js +0 -92
- package/dist/types/sdks/LocalContent/Map/Scores/styles.js.map +0 -1
|
@@ -1,719 +0,0 @@
|
|
|
1
|
-
import{R as If,r as ve,$ as Xh,a as Wh,u as Hh,_ as Oc,s as Cf,b as Af,c as Mf,d as Pf,P as zf,L as kf,e as Df,f as Lf,g as Rf,h as nt,j as Ve,i as Bf,k as Kh,l as Ff,m as pi,t as It,n as Jh,o as Zc,p as Tl,q as Sh,v as ca,w as sr,x as Yh,y as Of,z as ua,A as Sl,B as jc,C as Xc,U as Qh,F as Il,D as Wc,E as ep,G as os,H as gr,I as rs,S as Uf,J as vl,K as Gn,M as $f,T as tp,N as Ih,O as Vf,Q as Dc,V as oa}from"./index.1679f9d5.js";var aa=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};const Nf=If["useId".toString()]||(()=>{});let Gf=0;function ip(b){const[I,C]=ve.exports.useState(Nf());return Xh(()=>{b||C(k=>k!=null?k:String(Gf++))},[b]),b||(I?`radix-${I}`:"")}function Hc({prop:b,defaultProp:I,onChange:C=()=>{}}){const[k,B]=qf({defaultProp:I,onChange:C}),N=b!==void 0,ne=N?b:k,a=Wh(C),Y=ve.exports.useCallback(ie=>{if(N){const ue=typeof ie=="function"?ie(b):ie;ue!==b&&a(ue)}else B(ie)},[N,b,B,a]);return[ne,Y]}function qf({defaultProp:b,onChange:I}){const C=ve.exports.useState(b),[k]=C,B=ve.exports.useRef(k),N=Wh(I);return ve.exports.useEffect(()=>{B.current!==k&&(N(k),B.current=k)},[k,B,N]),C}function rp(){var b=ve.exports.useRef(!1);return Hh(function(){return b.current=!0,function(){b.current=!1}},[]),b}function Zf(){var b=rp(),I=Oc(ve.exports.useState(0),2),C=I[0],k=I[1],B=ve.exports.useCallback(function(){b.current&&k(C+1)},[C]),N=ve.exports.useCallback(function(){return Cf.postRender(B)},[B]);return[N,C]}var Lc=function(b){var I=b.children,C=b.initial,k=b.isPresent,B=b.onExitComplete,N=b.custom,ne=b.presenceAffectsLayout,a=Af(jf),Y=Mf(),ie=ve.exports.useMemo(function(){return{id:Y,initial:C,isPresent:k,custom:N,onExitComplete:function(he){var ue,ee;a.set(he,!0);try{for(var Se=Pf(a.values()),Ie=Se.next();!Ie.done;Ie=Se.next()){var Ce=Ie.value;if(!Ce)return}}catch(Ke){ue={error:Ke}}finally{try{Ie&&!Ie.done&&(ee=Se.return)&&ee.call(Se)}finally{if(ue)throw ue.error}}B==null||B()},register:function(he){return a.set(he,!1),function(){return a.delete(he)}}}},ne?void 0:[k]);return ve.exports.useMemo(function(){a.forEach(function(he,ue){return a.set(ue,!1)})},[k]),ve.exports.useEffect(function(){!k&&!a.size&&(B==null||B())},[k]),ve.exports.createElement(zf.Provider,{value:ie},I)};function jf(){return new Map}var ns=function(b){return b.key||""};function Xf(b,I){b.forEach(function(C){var k=ns(C);I.set(k,C)})}function Wf(b){var I=[];return ve.exports.Children.forEach(b,function(C){ve.exports.isValidElement(C)&&I.push(C)}),I}var Hf=function(b){var I=b.children,C=b.custom,k=b.initial,B=k===void 0?!0:k,N=b.onExitComplete,ne=b.exitBeforeEnter,a=b.presenceAffectsLayout,Y=a===void 0?!0:a,ie=Oc(Zf(),1),he=ie[0],ue=ve.exports.useContext(kf).forceRender;ue&&(he=ue);var ee=rp(),Se=Wf(I),Ie=Se,Ce=new Set,Ke=ve.exports.useRef(Ie),Xe=ve.exports.useRef(new Map).current,Qe=ve.exports.useRef(!0);if(Hh(function(){Qe.current=!1,Xf(Se,Xe),Ke.current=Ie}),Df(function(){Qe.current=!0,Xe.clear(),Ce.clear()}),Qe.current)return ve.exports.createElement(ve.exports.Fragment,null,Ie.map(function(ct){return ve.exports.createElement(Lc,{key:ns(ct),isPresent:!0,initial:B?void 0:!1,presenceAffectsLayout:Y},ct)}));Ie=Lf([],Oc(Ie),!1);for(var lt=Ke.current.map(ns),vt=Se.map(ns),ot=lt.length,gt=0;gt<ot;gt++){var ft=lt[gt];vt.indexOf(ft)===-1&&Ce.add(ft)}return ne&&Ce.size&&(Ie=[]),Ce.forEach(function(ct){if(vt.indexOf(ct)===-1){var Xt=Xe.get(ct);if(!!Xt){var Wt=lt.indexOf(ct),ki=function(){Xe.delete(ct),Ce.delete(ct);var di=Ke.current.findIndex(function(Hi){return Hi.key===ct});if(Ke.current.splice(di,1),!Ce.size){if(Ke.current=Se,ee.current===!1)return;he(),N&&N()}};Ie.splice(Wt,0,ve.exports.createElement(Lc,{key:ns(Xt),isPresent:!1,onExitComplete:ki,custom:C,presenceAffectsLayout:Y},Xt))}}}),Ie=Ie.map(function(ct){var Xt=ct.key;return Ce.has(Xt)?ct:ve.exports.createElement(Lc,{key:ns(ct),isPresent:!0,presenceAffectsLayout:Y},ct)}),Rf!=="production"&&ne&&Ie.length>1&&console.warn("You're attempting to animate multiple children within AnimatePresence, but its exitBeforeEnter prop is set to true. This will lead to odd visual behaviour."),ve.exports.createElement(ve.exports.Fragment,null,Ce.size?Ie:Ie.map(function(ct){return ve.exports.cloneElement(ct)}))};const np=nt.createContext({}),as=()=>ve.exports.useContext(np),Kf=({children:b})=>{const[I,C]=ve.exports.useState({commute:"pedestrian_friendly",amenities:"groceries",character:"vibrant",nature:"parks",education:"high_schools"}),[k,B]=ve.exports.useState(),[N,ne]=ve.exports.useState(),[a,Y]=ve.exports.useState("commute"),ie=I[a],he=ee=>{C(Se=>({...Se,[a]:ee}))},ue=ve.exports.useMemo(()=>({activeScore:ie,setActiveScore:he,activeCategory:a,setActiveCategory:Y,activePOI:k,setActivePOI:B,hoveredPOI:N,setHoveredPOI:ne}),[ie,he,a,Y,k,B,N,ne]);return Ve(np.Provider,{value:ue,children:b})},Jf=ve.exports.createContext(null);function Yf(b){const I=b.clone();return I.pixelsToGLUnits=b.pixelsToGLUnits,I}function Ch(b){return{longitude:b.center.lng,latitude:b.center.lat,zoom:b.zoom,pitch:b.pitch,bearing:b.bearing,padding:b.padding}}function Ah(b,I){const C=I.viewState||I;let k=!1;if("longitude"in C&&"latitude"in C){const B=b.center;b.center=new B.constructor(C.longitude,C.latitude),k=k||B!==b.center}if("zoom"in C){const B=b.zoom;b.zoom=C.zoom,k=k||B!==b.zoom}if("bearing"in C){const B=b.bearing;b.bearing=C.bearing,k=k||B!==b.bearing}if("pitch"in C){const B=b.pitch;b.pitch=C.pitch,k=k||B!==b.pitch}return C.padding&&!b.isPaddingEqual(C.padding)&&(k=!0,b.padding=C.padding),k}const Qf=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Mh(b){if(!b)return null;if(typeof b=="string"||("toJS"in b&&(b=b.toJS()),!b.layers))return b;const I={};for(const k of b.layers)I[k.id]=k;const C=b.layers.map(k=>{const B=I[k.ref];let N=null;if("interactive"in k&&(N={...k},delete N.interactive),B){N=N||{...k},delete N.ref;for(const ne of Qf)ne in B&&(N[ne]=B[ne])}return N||k});return{...b,layers:C}}function em(b,I){const C=Array.isArray(b)?b[0]:b?b.x:0,k=Array.isArray(b)?b[1]:b?b.y:0,B=Array.isArray(I)?I[0]:I?I.x:0,N=Array.isArray(I)?I[1]:I?I.y:0;return C===B&&k===N}function qn(b,I){if(b===I)return!0;if(!b||!I)return!1;if(Array.isArray(b)){if(!Array.isArray(I)||b.length!==I.length)return!1;for(let C=0;C<b.length;C++)if(!qn(b[C],I[C]))return!1;return!0}else if(Array.isArray(I))return!1;if(typeof b=="object"&&typeof I=="object"){const C=Object.keys(b),k=Object.keys(I);if(C.length!==k.length)return!1;for(const B of C)if(!I.hasOwnProperty(B)||!qn(b[B],I[B]))return!1;return!0}return!1}const Ph={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"},Rc={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"},zh={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"},tm=["minZoom","maxZoom","minPitch","maxPitch","maxBounds","projection","renderWorldCopies"],im=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"];class ss{constructor(I,C,k){this._map=null,this._internalUpdate=!1,this._inRender=!1,this._hoveredFeatures=null,this._deferredEvents={move:!1,zoom:!1,pitch:!1,rotate:!1},this._onEvent=B=>{const N=this.props[zh[B.type]];N&&N(B)},this._onPointerEvent=B=>{(B.type==="mousemove"||B.type==="mouseout")&&this._updateHover(B);const N=this.props[Ph[B.type]];if(N){if(this.props.interactiveLayerIds&&B.type!=="mouseover"&&B.type!=="mouseout"){const ne=this._hoveredFeatures||this._map.queryRenderedFeatures(B.point,{layers:this.props.interactiveLayerIds});B.features=ne}N(B),delete B.features}},this._onCameraEvent=B=>{if(!this._internalUpdate){const N=this.props[Rc[B.type]];N&&N(B)}B.type in this._deferredEvents&&(this._deferredEvents[B.type]=!1)},this._MapClass=I,this.props=C,this._initialize(k)}get map(){return this._map}get transform(){return this._renderTransform}setProps(I){const C=this.props;this.props=I;const k=this._updateSettings(I,C);k&&this._createShadowTransform(this._map);const B=this._updateSize(I),N=this._updateViewState(I,!0);this._updateStyle(I,C),this._updateStyleComponents(I,C),this._updateHandlers(I,C),(k||B||N&&!this._map.isMoving())&&this.redraw()}static reuse(I,C){const k=ss.savedMaps.pop();if(!k)return null;const B=k.map,N=B.getContainer();for(C.className=N.className;N.childNodes.length>0;)C.appendChild(N.childNodes[0]);B._container=C,k.setProps({...I,styleDiffing:!1}),B.resize();const{initialViewState:ne}=I;return ne&&(ne.bounds?B.fitBounds(ne.bounds,{...ne.fitBoundsOptions,duration:0}):k._updateViewState(ne,!1)),B.isStyleLoaded()?B.fire("load"):B.once("styledata",()=>B.fire("load")),k}_initialize(I){const{props:C}=this,k={...C,...C.initialViewState,accessToken:C.mapboxAccessToken||rm()||null,container:I,style:Mh(C.mapStyle)},B=k.initialViewState||k.viewState||k;if(Object.assign(k,{center:[B.longitude||0,B.latitude||0],zoom:B.zoom||0,pitch:B.pitch||0,bearing:B.bearing||0}),C.gl){const ie=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=ie,C.gl)}const N=new this._MapClass(k);B.padding&&N.setPadding(B.padding),C.cursor&&(N.getCanvas().style.cursor=C.cursor),this._createShadowTransform(N);const ne=N._render;N._render=ie=>{this._inRender=!0,ne.call(N,ie),this._inRender=!1};const a=N._renderTaskQueue.run;N._renderTaskQueue.run=ie=>{a.call(N._renderTaskQueue,ie),this._onBeforeRepaint()},N.on("render",()=>this._onAfterRepaint());const Y=N.fire;N.fire=this._fireEvent.bind(this,Y),N.on("resize",()=>{this._renderTransform.resize(N.transform.width,N.transform.height)}),N.on("styledata",()=>this._updateStyleComponents(this.props,{})),N.on("sourcedata",()=>this._updateStyleComponents(this.props,{}));for(const ie in Ph)N.on(ie,this._onPointerEvent);for(const ie in Rc)N.on(ie,this._onCameraEvent);for(const ie in zh)N.on(ie,this._onEvent);this._map=N}recycle(){ss.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){const I=this._map;!this._inRender&&I.style&&(I._frame&&(I._frame.cancel(),I._frame=null),I._render())}_createShadowTransform(I){const C=Yf(I.transform);I.painter.transform=C,this._renderTransform=C}_updateSize(I){const{viewState:C}=I;if(C){const k=this._map;if(C.width!==k.transform.width||C.height!==k.transform.height)return k.resize(),!0}return!1}_updateViewState(I,C){if(this._internalUpdate)return!1;const k=this._map,B=this._renderTransform,{zoom:N,pitch:ne,bearing:a}=B,Y=k.isMoving();Y&&(B.cameraElevationReference="sea");const ie=Ah(B,{...Ch(k.transform),...I});if(Y&&(B.cameraElevationReference="ground"),ie&&C){const he=this._deferredEvents;he.move=!0,he.zoom||(he.zoom=N!==B.zoom),he.rotate||(he.rotate=a!==B.bearing),he.pitch||(he.pitch=ne!==B.pitch)}return Y||Ah(k.transform,I),ie}_updateSettings(I,C){const k=this._map;let B=!1;for(const N of tm)N in I&&!qn(I[N],C[N])&&(B=!0,k[`set${N[0].toUpperCase()}${N.slice(1)}`](I[N]));return B}_updateStyle(I,C){if(I.cursor!==C.cursor&&(this._map.getCanvas().style.cursor=I.cursor),I.mapStyle!==C.mapStyle){const k={diff:I.styleDiffing};return"localIdeographFontFamily"in I&&(k.localIdeographFontFamily=I.localIdeographFontFamily),this._map.setStyle(Mh(I.mapStyle),k),!0}return!1}_updateStyleComponents(I,C){const k=this._map;let B=!1;return k.style.loaded()&&("light"in I&&!qn(I.light,C.light)&&(B=!0,k.setLight(I.light)),"fog"in I&&!qn(I.fog,C.fog)&&(B=!0,k.setFog(I.fog)),"terrain"in I&&!qn(I.terrain,C.terrain)&&(!I.terrain||k.getSource(I.terrain.source))&&(B=!0,k.setTerrain(I.terrain))),B}_updateHandlers(I,C){const k=this._map;let B=!1;for(const N of im){const ne=I[N];qn(ne,C[N])||(B=!0,ne?k[N].enable(ne):k[N].disable())}return B}_updateHover(I){var C;const{props:k}=this;if(k.interactiveLayerIds&&(k.onMouseMove||k.onMouseEnter||k.onMouseLeave)){const N=I.type,ne=((C=this._hoveredFeatures)===null||C===void 0?void 0:C.length)>0;let a;if(N==="mousemove")try{a=this._map.queryRenderedFeatures(I.point,{layers:k.interactiveLayerIds})}catch{a=[]}else a=[];const Y=a.length>0;!Y&&ne&&(I.type="mouseleave",this._onPointerEvent(I)),this._hoveredFeatures=a,Y&&!ne&&(I.type="mouseenter",this._onPointerEvent(I)),I.type=N}else this._hoveredFeatures=null}_fireEvent(I,C,k){const B=this._map,N=B.transform,ne=typeof C=="string"?C:C.type;return ne==="move"&&this._updateViewState(this.props,!1),ne in Rc&&(typeof C=="object"&&(C.viewState=Ch(N)),this._map.isMoving())?(B.transform=this._renderTransform,I.call(B,C,k),B.transform=N,B):(I.call(B,C,k),B)}_onBeforeRepaint(){const I=this._map;this._internalUpdate=!0;for(const k in this._deferredEvents)this._deferredEvents[k]&&I.fire(k);this._internalUpdate=!1;const C=this._map.transform;this._map.transform=this._renderTransform,this._onAfterRepaint=()=>{this._map.transform=C}}}ss.savedMaps=[];function rm(){let b=null;if(typeof location!="undefined"){const I=/access_token=([^&\/]*)/.exec(location.search);b=I&&I[1]}try{b=b||{}.MapboxAccessToken}catch{}try{b=b||{}.REACT_APP_MAPBOX_ACCESS_TOKEN}catch{}return b}const nm=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];function om(b,I){if(!b)return null;const C=b.map,k={getMap:()=>C,getCenter:()=>b.transform.center,getZoom:()=>b.transform.zoom,getBearing:()=>b.transform.bearing,getPitch:()=>b.transform.pitch,getPadding:()=>b.transform.padding,getBounds:()=>b.transform.getBounds(),project:B=>b.transform.locationPoint(I.LngLat.convert(B)),unproject:B=>b.transform.pointLocation(I.Point.convert(B)),queryTerrainElevation:(B,N)=>{const ne=C.transform;C.transform=b.transform;const a=C.queryTerrainElevation(B,N);return C.transform=ne,a}};for(const B of sm(C))!(B in k)&&!nm.includes(B)&&(k[B]=C[B].bind(C));return k}function sm(b){const I=new Set;let C=b;for(;C;){for(const k of Object.getOwnPropertyNames(C))k[0]!=="_"&&typeof b[k]=="function"&&k!=="fire"&&k!=="setEventedParent"&&I.add(k);C=Object.getPrototypeOf(C)}return Array.from(I)}const am=typeof document!="undefined"?ve.exports.useLayoutEffect:ve.exports.useEffect,lm=["baseApiUrl","maxParallelImageRequests","workerClass","workerCount","workerUrl"];function cm(b,I){for(const C of lm)C in I&&(b[C]=I[C]);I.RTLTextPlugin&&b.getRTLTextPluginStatus&&b.getRTLTextPluginStatus()==="unavailable"&&b.setRTLTextPlugin(I.RTLTextPlugin,C=>{C&&console.error(C)},!1)}const Cl=ve.exports.createContext(null),um={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:b=>console.error(b.error),RTLTextPlugin:"https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js"},Kc=ve.exports.forwardRef((b,I)=>{const C=ve.exports.useContext(Jf),[k,B]=ve.exports.useState(null),N=ve.exports.useRef(),{current:ne}=ve.exports.useRef({mapLib:null,map:null});ve.exports.useEffect(()=>{const Y=b.mapLib;let ie=!0,he;return Promise.resolve(Y||Bf(()=>import("./index.c629d6a1.js").then(function(ue){return ue.i}),[])).then(ue=>{if(!!ie){if(ue.Map||(ue=ue.default),!ue||!ue.Map)throw new Error("Invalid mapLib");if(ue.supported(b))cm(ue,b),b.reuseMaps&&(he=ss.reuse(b,N.current)),he||(he=new ss(ue.Map,b,N.current)),ne.map=om(he,ue),ne.mapLib=ue,B(he),C==null||C.onMapMount(ne.map,b.id);else throw new Error("Map is not supported by this browser")}}).catch(ue=>{b.onError({type:"error",target:null,originalEvent:null,error:ue})}),()=>{ie=!1,he&&(C==null||C.onMapUnmount(b.id),b.reuseMaps?he.recycle():he.destroy())}},[]),am(()=>{k&&k.setProps(b)}),ve.exports.useImperativeHandle(I,()=>ne.map,[k]);const a=ve.exports.useMemo(()=>({position:"relative",width:"100%",height:"100%",...b.style}),[b.style]);return ve.exports.createElement("div",{id:b.id,ref:N,style:a},k&&ve.exports.createElement(Cl.Provider,{value:ne},b.children))});Kc.displayName="Map";Kc.defaultProps=um;const hm=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function Io(b,I){if(!b||!I)return;const C=b.style;for(const k in I){const B=I[k];Number.isFinite(B)&&!hm.test(k)?C[k]=`${B}px`:C[k]=B}}const pm={draggable:!1,popup:null,rotation:0,rotationAlignment:"auto",pitchAlignment:"auto"};function op(b){const{map:I,mapLib:C}=ve.exports.useContext(Cl),k=ve.exports.useRef({props:b});k.current.props=b;const B=ve.exports.useMemo(()=>{let N=!1;ve.exports.Children.forEach(b.children,Y=>{Y&&(N=!0)});const ne={...b,element:N?document.createElement("div"):null},a=new C.Marker(ne).setLngLat([b.longitude,b.latitude]);return a.getElement().addEventListener("click",Y=>{var ie,he;(he=(ie=k.current.props).onClick)===null||he===void 0||he.call(ie,{type:"click",target:a,originalEvent:Y})}),a.on("dragstart",Y=>{var ie,he;const ue=Y;ue.lngLat=B.getLngLat(),(he=(ie=k.current.props).onDragStart)===null||he===void 0||he.call(ie,ue)}),a.on("drag",Y=>{var ie,he;const ue=Y;ue.lngLat=B.getLngLat(),(he=(ie=k.current.props).onDrag)===null||he===void 0||he.call(ie,ue)}),a.on("dragend",Y=>{var ie,he;const ue=Y;ue.lngLat=B.getLngLat(),(he=(ie=k.current.props).onDragEnd)===null||he===void 0||he.call(ie,ue)}),a},[]);return ve.exports.useEffect(()=>(B.addTo(I.getMap()),()=>{B.remove()}),[]),ve.exports.useEffect(()=>{Io(B.getElement(),b.style)},[b.style]),(B.getLngLat().lng!==b.longitude||B.getLngLat().lat!==b.latitude)&&B.setLngLat([b.longitude,b.latitude]),b.offset&&!em(B.getOffset(),b.offset)&&B.setOffset(b.offset),B.isDraggable()!==b.draggable&&B.setDraggable(b.draggable),B.getRotation()!==b.rotation&&B.setRotation(b.rotation),B.getRotationAlignment()!==b.rotationAlignment&&B.setRotationAlignment(b.rotationAlignment),B.getPitchAlignment()!==b.pitchAlignment&&B.setPitchAlignment(b.pitchAlignment),B.getPopup()!==b.popup&&B.setPopup(b.popup),Kh.exports.createPortal(b.children,B.getElement())}op.defaultProps=pm;var Uc=ve.exports.memo(op);function kh(b){return new Set(b?b.trim().split(/\s+/):[])}function dm(b){const{map:I,mapLib:C}=ve.exports.useContext(Cl),k=ve.exports.useMemo(()=>document.createElement("div"),[]),B=ve.exports.useRef({props:b});B.current.props=b;const N=ve.exports.useMemo(()=>{const ne={...b},a=new C.Popup(ne).setLngLat([b.longitude,b.latitude]);return a.once("open",Y=>{var ie,he;(he=(ie=B.current.props).onOpen)===null||he===void 0||he.call(ie,Y)}),a},[]);if(ve.exports.useEffect(()=>{const ne=a=>{var Y,ie;(ie=(Y=B.current.props).onClose)===null||ie===void 0||ie.call(Y,a)};return N.on("close",ne),N.setDOMContent(k).addTo(I.getMap()),()=>{N.off("close",ne),N.isOpen()&&N.remove()}},[]),ve.exports.useEffect(()=>{Io(N.getElement(),b.style)},[b.style]),N.isOpen()&&((N.getLngLat().lng!==b.longitude||N.getLngLat().lat!==b.latitude)&&N.setLngLat([b.longitude,b.latitude]),b.offset&&!qn(N.options.offset,b.offset)&&N.setOffset(b.offset),(N.options.anchor!==b.anchor||N.options.maxWidth!==b.maxWidth)&&(N.options.anchor=b.anchor,N.setMaxWidth(b.maxWidth)),N.options.className!==b.className)){const ne=kh(N.options.className),a=kh(b.className);for(const Y of ne)a.has(Y)||N.removeClassName(Y);for(const Y of a)ne.has(Y)||N.addClassName(Y);N.options.className=b.className}return Kh.exports.createPortal(b.children,k)}ve.exports.memo(dm);function ha(b,I,C,k){const B=ve.exports.useContext(Cl),N=ve.exports.useMemo(()=>b(B),[]);return ve.exports.useEffect(()=>{const ne=k||C||I,a=typeof I=="function"&&typeof C=="function"?I:null,Y=typeof C=="function"?C:typeof I=="function"?I:null,{map:ie}=B;return ie.hasControl(N)||(ie.addControl(N,ne==null?void 0:ne.position),a&&a(B)),()=>{Y&&Y(B),ie.hasControl(N)&&ie.removeControl(N)}},[]),N}function fm(b){const I=ha(({mapLib:C})=>new C.AttributionControl(b),{position:b.position});return ve.exports.useEffect(()=>{Io(I._container,b.style)},[b.style]),null}ve.exports.memo(fm);function mm(b){const I=ha(({mapLib:C})=>new C.FullscreenControl({container:b.containerId&&document.getElementById(b.containerId)}),{position:b.position});return ve.exports.useEffect(()=>{Io(I._controlContainer,b.style)},[b.style]),null}ve.exports.memo(mm);const sp=ve.exports.forwardRef((b,I)=>{const C=ve.exports.useRef({props:b}),k=ha(({mapLib:B})=>{const N=new B.GeolocateControl(b),ne=N._setupUI;return N._setupUI=a=>{N._container.hasChildNodes()||ne(a)},N.on("geolocate",a=>{var Y,ie;(ie=(Y=C.current.props).onGeolocate)===null||ie===void 0||ie.call(Y,a)}),N.on("error",a=>{var Y,ie;(ie=(Y=C.current.props).onError)===null||ie===void 0||ie.call(Y,a)}),N.on("outofmaxbounds",a=>{var Y,ie;(ie=(Y=C.current.props).onOutOfMaxBounds)===null||ie===void 0||ie.call(Y,a)}),N.on("trackuserlocationstart",a=>{var Y,ie;(ie=(Y=C.current.props).onTrackUserLocationStart)===null||ie===void 0||ie.call(Y,a)}),N.on("trackuserlocationend",a=>{var Y,ie;(ie=(Y=C.current.props).onTrackUserLocationEnd)===null||ie===void 0||ie.call(Y,a)}),N},{position:b.position});return C.current.props=b,ve.exports.useImperativeHandle(I,()=>({trigger:()=>k.trigger()}),[]),ve.exports.useEffect(()=>{Io(k._container,b.style)},[b.style]),null});sp.displayName="GeolocateControl";ve.exports.memo(sp);function gm(b){const I=ha(({mapLib:C})=>new C.NavigationControl(b),{position:b.position});return ve.exports.useEffect(()=>{Io(I._container,b.style)},[b.style]),null}var _m=ve.exports.memo(gm);const ym={unit:"metric",maxWidth:100};function ap(b){const I=ha(({mapLib:C})=>new C.ScaleControl(b),{position:b.position});return(I.options.unit!==b.unit||I.options.maxWidth!==b.maxWidth)&&(I.options.maxWidth=b.maxWidth,I.setUnit(b.unit)),ve.exports.useEffect(()=>{Io(I._container,b.style)},[b.style]),null}ap.defaultProps=ym;ve.exports.memo(ap);var lp={exports:{}};(function(b,I){(function(C,k){b.exports=k()})(aa,function(){var C,k,B;function N(a,Y){if(!C)C=Y;else if(!k)k=Y;else{var ie="var sharedChunk = {}; ("+C+")(sharedChunk); ("+k+")(sharedChunk);",he={};C(he),B=Y(he),typeof window!="undefined"&&(B.workerUrl=window.URL.createObjectURL(new Blob([ie],{type:"text/javascript"})))}}N(["exports"],function(a){var Y=ie;function ie(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 he(i,e,r,o){const c=new Y(i,e,r,o);return function(h){return c.solve(h)}}ie.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 d=0,m=1;for(r=i,o=0;o<20&&(c=this.sampleCurveX(r),!(Math.abs(c-i)<e));o++)i>c?d=r:m=r,r=.5*(m-d)+d;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};const ue=he(.25,.1,.25,1);function ee(i,e,r){return Math.min(r,Math.max(e,i))}function Se(i,e,r){const o=r-e,c=((i-e)%o+o)%o+e;return c===e?r:c}function Ie(i,...e){for(const r of e)for(const o in r)i[o]=r[o];return i}let Ce=1;function Ke(i,e){i.forEach(r=>{e[r]&&(e[r]=e[r].bind(e))})}function Xe(i,e,r){const o={};for(const c in i)o[c]=e.call(r||this,i[c],c,i);return o}function Qe(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 lt(i){return Array.isArray(i)?i.map(lt):typeof i=="object"&&i?Xe(i,lt):i}const vt={};function ot(i){vt[i]||(typeof console!="undefined"&&console.warn(i),vt[i]=!0)}function gt(i,e,r){return(r.y-i.y)*(e.x-i.x)>(e.y-i.y)*(r.x-i.x)}function ft(i){let e=0;for(let r,o,c=0,h=i.length,d=h-1;c<h;d=c++)r=i[c],o=i[d],e+=(o.x-r.x)*(r.y+o.y);return e}function ct(){return typeof WorkerGlobalScope!="undefined"&&typeof self!="undefined"&&self instanceof WorkerGlobalScope}function Xt(i){const e={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,o,c,h)=>{const d=c||h;return e[o]=!d||d.toLowerCase(),""}),e["max-age"]){const r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e}let Wt,ki,di=null;function Hi(i){if(di==null){const e=i.navigator?i.navigator.userAgent:null;di=!!i.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return di}function Ki(i){return typeof ImageBitmap!="undefined"&&i instanceof ImageBitmap}const zr={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=>(Wt||(Wt=document.createElement("a")),Wt.href=i,Wt.href),hardwareConcurrency:typeof navigator!="undefined"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(ki==null&&(ki=matchMedia("(prefers-reduced-motion: reduce)")),ki.matches)}};var tt=_r;function _r(i,e){this.x=i,this.y=e}_r.prototype={clone:function(){return new _r(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}},_r.convert=function(i){return i instanceof _r?i:Array.isArray(i)?new _r(i[0],i[1]):i};const yr={MAX_PARALLEL_IMAGE_REQUESTS:16,REGISTERED_PROTOCOLS:{}},Ji="mapbox-tiles";let Yi,Hr,mn=500,gn=50;function _n(){typeof caches=="undefined"||Yi||(Yi=caches.open(Ji))}let ar=1/0;const kr={supported:!1,testSupport:function(i){!Ii&&Lr&&(yn?Zn(i):Dr=i)}};let Dr,Lr,Ii=!1,yn=!1;function Zn(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,Lr),i.isContextLost())return;kr.supported=!0}catch{}i.deleteTexture(e),Ii=!0}typeof document!="undefined"&&(Lr=document.createElement("img"),Lr.onload=function(){Dr&&Zn(Dr),Dr=null,yn=!0},Lr.onerror=function(){Ii=!0,Dr=null},Lr.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const xr={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};typeof Object.freeze=="function"&&Object.freeze(xr);class Di 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 jn=ct()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href;function Rr(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:jn(),signal:r.signal});let c=!1,h=!1;return i.type==="json"&&o.headers.set("Accept","application/json"),((d,m,g)=>{if(h)return;const x=Date.now();fetch(o).then(T=>T.ok?((S,P,D)=>{(i.type==="arrayBuffer"?S.arrayBuffer():i.type==="json"?S.json():S.text()).then(L=>{h||(P&&D&&function(Z,q,re){if(_n(),!Yi)return;const ce={status:q.status,statusText:q.statusText,headers:new Headers};q.headers.forEach((ae,xe)=>ce.headers.set(xe,ae));const te=Xt(q.headers.get("Cache-Control")||"");te["no-store"]||(te["max-age"]&&ce.headers.set("Expires",new Date(re+1e3*te["max-age"]).toUTCString()),new Date(ce.headers.get("Expires")).getTime()-re<42e4||function(ae,xe){if(Hr===void 0)try{new Response(new ReadableStream),Hr=!0}catch{Hr=!1}Hr?xe(ae.body):ae.blob().then(xe)}(q,ae=>{const xe=new Response(ae,ce);_n(),Yi&&Yi.then(ye=>ye.put(function(Ue){const Ge=Ue.indexOf("?");return Ge<0?Ue:Ue.slice(0,Ge)}(Z.url),xe)).catch(ye=>ot(ye.message))}))}(o,P,D),c=!0,e(null,L,S.headers.get("Cache-Control"),S.headers.get("Expires")))}).catch(L=>{h||e(new Error(L.message))})})(T,null,x):T.blob().then(S=>e(new Di(T.status,T.statusText,i.url,S)))).catch(T=>{T.code!==20&&e(new Error(T.message))})})(),{cancel:()=>{h=!0,c||r.abort()}}}const xn=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){if(ct()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e);if(!ct()){const o=i.url.substring(0,i.url.indexOf("://"));return(yr.REGISTERED_PROTOCOLS[o]||Rr)(i,e)}}if(!(/^file:/.test(r=i.url)||/^file:/.test(jn())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return Rr(i,e);if(ct()&&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 d in o.headers)h.setRequestHeader(d,o.headers[d]);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 d=h.response;if(o.type==="json")try{d=JSON.parse(h.response)}catch(m){return c(m)}c(null,d,h.getResponseHeader("Cache-Control"),h.getResponseHeader("Expires"))}else{const d=new Blob([h.response],{type:h.getResponseHeader("Content-Type")});c(new Di(h.status,h.statusText,o.url,d))}},h.send(o.body),{cancel:()=>h.abort()}}(i,e)},vn=function(i,e){return xn(Ie(i,{type:"arrayBuffer"}),e)};function Xn(i){const e=window.document.createElement("a");return e.href=i,e.protocol===window.document.location.protocol&&e.host===window.document.location.host}const bt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let lr,Br;lr=[],Br=0;const Fr=function(i,e){if(kr.supported&&(i.headers||(i.headers={}),i.headers.accept="image/webp,*/*"),Br>=yr.MAX_PARALLEL_IMAGE_REQUESTS){const h={requestParameters:i,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return lr.push(h),h}Br++;let r=!1;const o=()=>{if(!r)for(r=!0,Br--;lr.length&&Br<yr.MAX_PARALLEL_IMAGE_REQUESTS;){const h=lr.shift(),{requestParameters:d,callback:m,cancelled:g}=h;g||(h.cancel=Fr(d,m).cancel)}},c=vn(i,(h,d,m,g)=>{o(),h?e(h):d&&function(x,T){typeof createImageBitmap=="function"?function(S,P){const D=new Blob([new Uint8Array(S)],{type:"image/png"});createImageBitmap(D).then(L=>{P(null,L)}).catch(L=>{P(new Error(`Could not load image because of ${L.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(x,T):function(S,P){const D=new Image;D.onload=()=>{P(null,D),URL.revokeObjectURL(D.src),D.onload=null,window.requestAnimationFrame(()=>{D.src=bt})},D.onerror=()=>P(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const L=new Blob([new Uint8Array(S)],{type:"image/png"});D.src=S.byteLength?URL.createObjectURL(L):bt}(x,T)}(d,(x,T)=>{x!=null?e(x):T!=null&&e(null,T,{cacheControl:m,expires:g})})});return{cancel:()=>{c.cancel(),o()}}};function Wn(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function vr(i,e,r){if(r&&r[i]){const o=r[i].indexOf(e);o!==-1&&r[i].splice(o,1)}}class br{constructor(e,r={}){Ie(this,r),this.type=e}}class bn extends br{constructor(e,r={}){super("error",Ie({error:e},r))}}class wr{on(e,r){return this._listeners=this._listeners||{},Wn(e,r,this._listeners),this}off(e,r){return vr(e,r,this._listeners),vr(e,r,this._oneTimeListeners),this}once(e,r){return this._oneTimeListeners=this._oneTimeListeners||{},Wn(e,r,this._oneTimeListeners),this}fire(e,r){typeof e=="string"&&(e=new br(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)vr(o,m,this._oneTimeListeners),m.call(this,e);const d=this._eventedParent;d&&(Ie(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),d.fire(e))}else e instanceof bn&&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 _e={$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 ze{constructor(e,r,o,c){this.message=(e?`${e}: `:"")+o,c&&(this.identifier=c),r!=null&&r.__line__&&(this.line=r.__line__)}}function Kr(i){const e=i.value;return e?[new ze(i.key,e,"constants have been deprecated as of v8")]:[]}function Qi(i,...e){for(const r of e)for(const o in r)i[o]=r[o];return i}function wt(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function qi(i){if(Array.isArray(i))return i.map(qi);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){const e={};for(const r in i)e[r]=qi(i[r]);return e}return wt(i)}class Li extends Error{constructor(e,r){super(r),this.message=r,this.key=e}}class Ri{constructor(e,r=[]){this.parent=e,this.bindings={};for(const[o,c]of r)this.bindings[o]=c}concat(e){return new Ri(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 Or={kind:"null"},Ae={kind:"number"},ut={kind:"string"},st={kind:"boolean"},fi={kind:"color"},Ur={kind:"object"},rt={kind:"value"},Tr={kind:"collator"},oi={kind:"formatted"},wn={kind:"padding"},Yt={kind:"resolvedImage"};function wi(i,e){return{kind:"array",itemType:i,N:e}}function kt(i){if(i.kind==="array"){const e=kt(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const Tn=[Or,Ae,ut,st,fi,oi,Ur,wi(rt),wn,Yt];function cr(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!cr(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 Tn)if(!cr(r,e))return null}}return`Expected ${kt(i)} but found ${kt(e)} instead.`}function Jr(i,e){return e.some(r=>r.kind===i.kind)}function Yr(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 En,Qr={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 O(i){return(i=Math.round(i))<0?0:i>255?255:i}function w(i){return O(i[i.length-1]==="%"?parseFloat(i)/100*255:parseInt(i))}function A(i){return(e=i[i.length-1]==="%"?parseFloat(i)/100:parseFloat(i))<0?0:e>1?1:e;var e}function R(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{En={}.parseCSSColor=function(i){var e,r=i.replace(/ /g,"").toLowerCase();if(r in Qr)return Qr[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),d=r.substr(o+1,c-(o+1)).split(","),m=1;switch(h){case"rgba":if(d.length!==4)return null;m=A(d.pop());case"rgb":return d.length!==3?null:[w(d[0]),w(d[1]),w(d[2]),m];case"hsla":if(d.length!==4)return null;m=A(d.pop());case"hsl":if(d.length!==3)return null;var g=(parseFloat(d[0])%360+360)%360/360,x=A(d[1]),T=A(d[2]),S=T<=.5?T*(x+1):T+x-T*x,P=2*T-S;return[O(255*R(P,S,g+1/3)),O(255*R(P,S,g)),O(255*R(P,S,g-1/3)),m];default:return null}}return null}}catch{}class F{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 F)return e;if(typeof e!="string")return;const r=En(e);return r?new F(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]}}F.black=new F(0,0,0,1),F.white=new F(1,1,1,1),F.transparent=new F(0,0,0,0),F.red=new F(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 K{constructor(e,r,o,c,h){this.text=e,this.image=r,this.scale=o,this.fontStack=c,this.textColor=h}}class W{constructor(e){this.sections=e}static fromString(e){return new W([new K(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 W?e:W.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 J{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new J({name:e,available:!1}):null}}function de(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 F||i instanceof j||i instanceof W||i instanceof X||i instanceof J)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 Or;if(typeof i=="string")return ut;if(typeof i=="boolean")return st;if(typeof i=="number")return Ae;if(i instanceof F)return fi;if(i instanceof j)return Tr;if(i instanceof W)return oi;if(i instanceof X)return wn;if(i instanceof J)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=rt;break}r=c}return wi(r||rt,e)}return Ur}function Ne(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof F||i instanceof W||i instanceof X||i instanceof J?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 Je={string:ut,number:Ae,boolean:st,object:Ur};class et{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 x=e[1];if(typeof x!="string"||!(x in Je)||x==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);m=Je[x],c++}else m=rt;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=wi(m,g)}else{if(!Je[h])throw new Error(`Types doesn't contain name = ${h}`);o=Je[h]}const d=[];for(;c<e.length;c++){const m=r.parse(e[c],c,rt);if(!m)return null;d.push(m)}return new et(o,d)}evaluate(e){for(let r=0;r<this.args.length;r++){const o=this.args[r].evaluate(e);if(!cr(this.type,pe(o)))return o;if(r===this.args.length-1)throw new Be(`Expected value to be of type ${kt(this.type)}, but found ${kt(pe(o))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const Tt={"to-boolean":st,"to-color":fi,"to-number":Ae,"to-string":ut};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.");const o=e[0];if(!Tt[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=Tt[o],h=[];for(let d=1;d<e.length;d++){const m=r.parse(e[d],d,rt);if(!m)return null;h.push(m)}return new it(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 F)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.`:de(r[0],r[1],r[2],r[3]),!o))return new F(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"?W.fromString(Ne(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?J.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 Et{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]=F.parse(e)),r}}class Lt{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=Lt.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,d=Array.isArray(c)?[[c[1],c[2]]]:c.overloads,m=d.filter(([x])=>!Array.isArray(x)||x.length===e.length-1);let g=null;for(const[x,T]of m){g=new Cn(r.registry,r.path,null,r.scope);const S=[];let P=!1;for(let D=1;D<e.length;D++){const L=e[D],Z=Array.isArray(x)?x[D-1]:x.type,q=g.parse(L,1+S.length,Z);if(!q){P=!0;break}S.push(q)}if(!P)if(Array.isArray(x)&&x.length!==S.length)g.error(`Expected ${x.length} arguments, but found ${S.length} instead.`);else{for(let D=0;D<S.length;D++){const L=Array.isArray(x)?x[D]:x.type,Z=S[D];g.concat(D+1).checkSubtype(L,Z.type)}if(g.errors.length===0)return new Lt(o,h,T,S)}}if(m.length===1)r.errors.push(...g.errors);else{const x=(m.length?m:d).map(([S])=>{return P=S,Array.isArray(P)?`(${P.map(kt).join(", ")})`:`(${kt(P.type)}...)`;var P}).join(" | "),T=[];for(let S=1;S<e.length;S++){const P=r.parse(e[S],1+T.length);if(!P)return null;T.push(kt(P.type))}r.error(`Expected arguments of type ${x}, but found (${T.join(", ")}) instead.`)}return null}static register(e,r){Lt.definitions=r;for(const o in r)e[o]=Lt}}class si{constructor(e,r,o){this.type=Tr,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,st);if(!c)return null;const h=r.parse(o["diacritic-sensitive"]!==void 0&&o["diacritic-sensitive"],1,st);if(!h)return null;let d=null;return o.locale&&(d=r.parse(o.locale,1,ut),!d)?null:new si(c,h,d)}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 $t=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 Sn(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function Hn(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*$t),Math.round(o*c*$t)]}function Rt(i,e,r){const o=i[0]-e[0],c=i[1]-e[1],h=i[0]-r[0],d=i[1]-r[1];return o*d-h*c==0&&o*h<=0&&c*d<=0}function ls(i,e){let r=!1;for(let d=0,m=e.length;d<m;d++){const g=e[d];for(let x=0,T=g.length;x<T-1;x++){if(Rt(i,g[x],g[x+1]))return!1;(c=g[x])[1]>(o=i)[1]!=(h=g[x+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 da(i,e,r,o){const c=o[0]-r[0],h=o[1]-r[1],d=(i[0]-r[0])*h-c*(i[1]-r[1]),m=(e[0]-r[0])*h-c*(e[1]-r[1]);return d>0&&m<0||d<0&&m>0}function fa(i,e,r){for(const x of r)for(let T=0;T<x.length-1;++T)if((m=[(d=x[T+1])[0]-(h=x[T])[0],d[1]-h[1]])[0]*(g=[(c=e)[0]-(o=i)[0],c[1]-o[1]])[1]-m[1]*g[0]!=0&&da(o,c,h,d)&&da(h,d,o,c))return!0;var o,c,h,d,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(fa(i[r],i[r+1],e))return!1;return!0}function Ml(i,e){for(let r=0;r<e.length;r++)if(us(i,e[r]))return!0;return!1}function Co(i,e,r){const o=[];for(let c=0;c<i.length;c++){const h=[];for(let d=0;d<i[c].length;d++){const m=Hn(i[c][d],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=Co(i[c],e,r);o.push(h)}return o}function ma(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 ga(i,e,r,o){const c=Math.pow(2,o.z)*$t,h=[o.x*$t,o.y*$t],d=[];for(const m of i)for(const g of m){const x=[g.x+h[0],g.y+h[1]];ma(x,e,r,c),d.push(x)}return d}function _a(i,e,r,o){const c=Math.pow(2,o.z)*$t,h=[o.x*$t,o.y*$t],d=[];for(const g of i){const x=[];for(const T of g){const S=[T.x+h[0],T.y+h[1]];_i(e,S),x.push(S)}d.push(x)}if(e[2]-e[0]<=c/2){(m=e)[0]=m[1]=1/0,m[2]=m[3]=-1/0;for(const g of d)for(const x of g)ma(x,e,r,c)}var m;return d}class en{constructor(e,r){this.type=st,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 en(o,o.features[c].geometry)}else if(o.type==="Feature"){const c=o.geometry.type;if(c==="Polygon"||c==="MultiPolygon")return new en(o,o.geometry)}else if(o.type==="Polygon"||o.type==="MultiPolygon")return new en(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],d=r.canonicalID();if(o.type==="Polygon"){const m=Co(o.coordinates,h,d),g=ga(r.geometry(),c,h,d);if(!Sn(c,h))return!1;for(const x of g)if(!ls(x,m))return!1}if(o.type==="MultiPolygon"){const m=hs(o.coordinates,h,d),g=ga(r.geometry(),c,h,d);if(!Sn(c,h))return!1;for(const x of g)if(!cs(x,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],d=r.canonicalID();if(o.type==="Polygon"){const m=Co(o.coordinates,h,d),g=_a(r.geometry(),c,h,d);if(!Sn(c,h))return!1;for(const x of g)if(!us(x,m))return!1}if(o.type==="MultiPolygon"){const m=hs(o.coordinates,h,d),g=_a(r.geometry(),c,h,d);if(!Sn(c,h))return!1;for(const x of g)if(!Ml(x,m))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}function Kn(i){if(i instanceof Lt&&(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 en)return!1;let e=!0;return i.eachChild(r=>{e&&!Kn(r)&&(e=!1)}),e}function In(i){if(i instanceof Lt&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!In(r)&&(e=!1)}),e}function Ao(i,e){if(i instanceof Lt&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(o=>{r&&!Ao(o,e)&&(r=!1)}),r}class Mo{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 Mo(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 Cn{constructor(e,r=[],o,c=new Ri,h=[]){this.registry=e,this.path=r,this.key=r.map(d=>`[${d}]`).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,d){return d==="assert"?new et(h,[c]):d==="coerce"?new it(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 d=h.parse(e,this);if(!d)return null;if(this.expectedType){const m=this.expectedType,g=d.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 d=o(d,m,r.typeAnnotation||"coerce");else d=o(d,m,r.typeAnnotation||"coerce");else d=o(d,m,r.typeAnnotation||"assert")}if(!(d instanceof qe)&&d.type.kind!=="resolvedImage"&&ps(d)){const m=new Et;try{d=new qe(d.type,d.evaluate(m))}catch(g){return this.error(g.message),null}}return d}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 Cn(this.registry,c,r||null,h,this.errors)}error(e,...r){const o=`${this.key}${r.map(c=>`[${c}]`).join("")}`;this.errors.push(new Li(o,e))}checkSubtype(e,r){const o=cr(e,r);return o&&this.error(o),o}}function ps(i){if(i instanceof Mo)return ps(i.boundExpression);if(i instanceof Lt&&i.name==="error"||i instanceof si||i instanceof en)return!1;const e=i instanceof it||i instanceof et;let r=!0;return i.eachChild(o=>{r=e?r&&ps(o):r&&o instanceof qe}),!!r&&Kn(i)&&Ao(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Po(i,e){const r=i.length-1;let o,c,h=0,d=r,m=0;for(;h<=d;)if(m=Math.floor((h+d)/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.");d=m-1}return 0}class Jn{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,Ae);if(!o)return null;const c=[];let h=null;r.expectedType&&r.expectedType.kind!=="value"&&(h=r.expectedType);for(let d=1;d<e.length;d+=2){const m=d===1?-1/0:e[d],g=e[d+1],x=d,T=d+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.',x);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.',x);const S=r.parse(g,T,h);if(!S)return null;h=h||S.type,c.push([m,S])}return new Jn(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[Po(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 Vt(i,e,r){return i*(1-r)+e*r}var Yn=Object.freeze({__proto__:null,number:Vt,color:function(i,e,r){return new F(Vt(i.r,e.r,r),Vt(i.g,e.g,r),Vt(i.b,e.b,r),Vt(i.a,e.a,r))},array:function(i,e,r){return i.map((o,c)=>Vt(o,e[c],r))},padding:function(i,e,r){const o=i.values,c=e.values;return new X([Vt(o[0],c[0],r),Vt(o[1],c[1],r),Vt(o[2],c[2],r),Vt(o[3],c[3],r)])}});const ya=.95047,xa=1.08883,ds=4/29,zo=6/29,va=3*zo*zo,Pl=Math.PI/180,zl=180/Math.PI;function fs(i){return i>.008856451679035631?Math.pow(i,1/3):i/va+ds}function ms(i){return i>zo?i*i*i:va*(i-ds)}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 Ct(i){const e=_s(i.r),r=_s(i.g),o=_s(i.b),c=fs((.4124564*e+.3575761*r+.1804375*o)/ya),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)/xa)),alpha:i.a}}function ba(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=ya*ms(r),o=xa*ms(o),new F(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 kl(i,e,r){const o=e-i;return i+r*(o>180||o<-180?o-360*Math.round(o/360):o)}const Qn={forward:Ct,reverse:ba,interpolate:function(i,e,r){return{l:Vt(i.l,e.l,r),a:Vt(i.a,e.a,r),b:Vt(i.b,e.b,r),alpha:Vt(i.alpha,e.alpha,r)}}},eo={forward:function(i){const{l:e,a:r,b:o}=Ct(i),c=Math.atan2(o,r)*zl;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*Pl,r=i.c;return ba({l:i.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:i.alpha})},interpolate:function(i,e,r){return{h:kl(i.h,e.h,r),c:Vt(i.c,e.c,r),l:Vt(i.l,e.l,r),alpha:Vt(i.alpha,e.alpha,r)}}};var wa=Object.freeze({__proto__:null,lab:Qn,hcl:eo});class Bi{constructor(e,r,o,c,h){this.type=e,this.operator=r,this.interpolation=o,this.input=c,this.labels=[],this.outputs=[];for(const[d,m]of h)this.labels.push(d),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 d=e.controlPoints;h=new Y(d[0],d[1],d[2],d[3]).solve(ys(r,1,o,c))}return h}static parse(e,r){let[o,c,h,...d]=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 x=c[1];if(typeof x!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);c={name:"exponential",base:x}}else{if(c[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(c[0])}`,1,0);{const x=c.slice(1);if(x.length!==4||x.some(T=>typeof T!="number"||T<0||T>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);c={name:"cubic-bezier",controlPoints:x}}}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,Ae),!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 x=0;x<d.length;x+=2){const T=d[x],S=d[x+1],P=x+3,D=x+4;if(typeof T!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',P);if(m.length&&m[m.length-1][0]>=T)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',P);const L=r.parse(S,D,g);if(!L)return null;g=g||L.type,m.push([T,L])}return g.kind==="number"||g.kind==="color"||g.kind==="padding"||g.kind==="array"&&g.itemType.kind==="number"&&typeof g.N=="number"?new Bi(g,o,c,h,m):r.error(`Type ${kt(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 d=Po(r,c),m=Bi.interpolationFactor(this.interpolation,c,r[d],r[d+1]),g=o[d].evaluate(e),x=o[d+1].evaluate(e);return this.operator==="interpolate"?Yn[this.type.kind.toLowerCase()](g,x,m):this.operator==="interpolate-hcl"?eo.reverse(eo.interpolate(eo.forward(g),eo.forward(x),m)):Qn.reverse(Qn.interpolate(Qn.forward(g),Qn.forward(x),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 ko{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 d=c&&h.some(m=>cr(c,m.type));return new ko(d?rt: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 J&&!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 Do{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 d=e[h];if(typeof d!="string")return r.error(`Expected string, but found ${typeof d} instead.`,h);if(/[^a-zA-Z0-9_]/.test(d))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([d,m])}const c=r.parse(e[e.length-1],e.length-1,r.expectedType,o);return c?new Do(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,Ae),c=r.parse(e[2],2,wi(r.expectedType||rt));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=st,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,rt),c=r.parse(e[2],2,rt);return o&&c?Jr(o.type,[st,ut,Ae,Or,rt])?new vs(o,c):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${kt(o.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),o=this.haystack.evaluate(e);if(!o)return!1;if(!Yr(r,["boolean","string","number","null"]))throw new Be(`Expected first argument to be of type boolean, string, number or null, but found ${kt(pe(r))} instead.`);if(!Yr(o,["string","array"]))throw new Be(`Expected second argument to be of type array or string, but found ${kt(pe(o))} instead.`);return o.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Lo{constructor(e,r,o){this.type=Ae,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,rt),c=r.parse(e[2],2,rt);if(!o||!c)return null;if(!Jr(o.type,[st,ut,Ae,Or,rt]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${kt(o.type)} instead`);if(e.length===4){const h=r.parse(e[3],3,Ae);return h?new Lo(o,c,h):null}return new Lo(o,c)}evaluate(e){const r=this.needle.evaluate(e),o=this.haystack.evaluate(e);if(!Yr(r,["boolean","string","number","null"]))throw new Be(`Expected first argument to be of type boolean, string, number or null, but found ${kt(pe(r))} instead.`);if(!Yr(o,["string","array"]))throw new Be(`Expected second argument to be of type array or string, but found ${kt(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,d){this.inputType=e,this.type=r,this.input=o,this.cases=c,this.outputs=h,this.otherwise=d}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={},d=[];for(let x=2;x<e.length-1;x+=2){let T=e[x];const S=e[x+1];Array.isArray(T)||(T=[T]);const P=r.concat(x);if(T.length===0)return P.error("Expected at least one branch label.");for(const L of T){if(typeof L!="number"&&typeof L!="string")return P.error("Branch labels must be numbers or strings.");if(typeof L=="number"&&Math.abs(L)>Number.MAX_SAFE_INTEGER)return P.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof L=="number"&&Math.floor(L)!==L)return P.error("Numeric branch labels must be integer values.");if(o){if(P.checkSubtype(o,pe(L)))return null}else o=pe(L);if(h[String(L)]!==void 0)return P.error("Branch labels must be unique.");h[String(L)]=d.length}const D=r.parse(S,x,c);if(!D)return null;c=c||D.type,d.push(D)}const m=r.parse(e[1],1,rt);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,d,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 d=1;d<e.length-1;d+=2){const m=r.parse(e[d],d,st);if(!m)return null;const g=r.parse(e[d+1],d+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 Ro{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,rt),c=r.parse(e[2],2,Ae);if(!o||!c)return null;if(!Jr(o.type,[wi(rt),ut,rt]))return r.error(`Expected first argument to be of type array or string, but found ${kt(o.type)} instead`);if(e.length===4){const h=r.parse(e[3],3,Ae);return h?new Ro(o.type,o,c,h):null}return new Ro(o.type,o,c)}evaluate(e){const r=this.input.evaluate(e),o=this.beginIndex.evaluate(e);if(!Yr(r,["string","array"]))throw new Be(`Expected first argument to be of type array or string, but found ${kt(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 Ta(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 Ea(i,e,r,o){return o.compare(e,r)===0}function An(i,e,r){const o=i!=="=="&&i!=="!=";return class cp{constructor(h,d,m){this.type=st,this.lhs=h,this.rhs=d,this.collator=m,this.hasUntypedArgument=h.type.kind==="value"||d.type.kind==="value"}static parse(h,d){if(h.length!==3&&h.length!==4)return d.error("Expected two or three arguments.");const m=h[0];let g=d.parse(h[1],1,rt);if(!g)return null;if(!Ta(m,g.type))return d.concat(1).error(`"${m}" comparisons are not supported for type '${kt(g.type)}'.`);let x=d.parse(h[2],2,rt);if(!x)return null;if(!Ta(m,x.type))return d.concat(2).error(`"${m}" comparisons are not supported for type '${kt(x.type)}'.`);if(g.type.kind!==x.type.kind&&g.type.kind!=="value"&&x.type.kind!=="value")return d.error(`Cannot compare types '${kt(g.type)}' and '${kt(x.type)}'.`);o&&(g.type.kind==="value"&&x.type.kind!=="value"?g=new et(x.type,[g]):g.type.kind!=="value"&&x.type.kind==="value"&&(x=new et(g.type,[x])));let T=null;if(h.length===4){if(g.type.kind!=="string"&&x.type.kind!=="string"&&g.type.kind!=="value"&&x.type.kind!=="value")return d.error("Cannot use collator to compare non-string types.");if(T=d.parse(h[3],3,Tr),!T)return null}return new cp(g,x,T)}evaluate(h){const d=this.lhs.evaluate(h),m=this.rhs.evaluate(h);if(o&&this.hasUntypedArgument){const g=pe(d),x=pe(m);if(g.kind!==x.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}, ${x.kind}) instead.`)}if(this.collator&&!o&&this.hasUntypedArgument){const g=pe(d),x=pe(m);if(g.kind!=="string"||x.kind!=="string")return e(h,d,m)}return this.collator?r(h,d,m,this.collator.evaluate(h)):e(h,d,m)}eachChild(h){h(this.lhs),h(this.rhs),this.collator&&h(this.collator)}outputDefined(){return!0}}}const Dl=An("==",function(i,e,r){return e===r},Ea),Ll=An("!=",function(i,e,r){return e!==r},function(i,e,r,o){return!Ea(0,e,r,o)}),Rl=An("<",function(i,e,r){return e<r},function(i,e,r,o){return o.compare(e,r)<0}),Bl=An(">",function(i,e,r){return e>r},function(i,e,r,o){return o.compare(e,r)>0}),Fl=An("<=",function(i,e,r){return e<=r},function(i,e,r,o){return o.compare(e,r)<=0}),Ol=An(">=",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,Ae);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 d=null;if(c.currency&&(d=r.parse(c.currency,1,ut),!d))return null;let m=null;if(c["min-fraction-digits"]&&(m=r.parse(c["min-fraction-digits"],1,Ae),!m))return null;let g=null;return c["max-fraction-digits"]&&(g=r.parse(c["max-fraction-digits"],1,Ae),!g)?null:new Ts(o,h,d,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 Bo{constructor(e){this.type=oi,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 d=1;d<=e.length-1;++d){const m=e[d];if(h&&typeof m=="object"&&!Array.isArray(m)){h=!1;let g=null;if(m["font-scale"]&&(g=r.parse(m["font-scale"],1,Ae),!g))return null;let x=null;if(m["text-font"]&&(x=r.parse(m["text-font"],1,wi(ut)),!x))return null;let T=null;if(m["text-color"]&&(T=r.parse(m["text-color"],1,fi),!T))return null;const S=c[c.length-1];S.scale=g,S.font=x,S.textColor=T}else{const g=r.parse(e[d],1,rt);if(!g)return null;const x=g.type.kind;if(x!=="string"&&x!=="value"&&x!=="null"&&x!=="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 Bo(c)}evaluate(e){return new W(this.sections.map(r=>{const o=r.content.evaluate(e);return pe(o)===Yt?new K("",o,null,null,null):new K(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=J.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=Ae,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 ${kt(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 ${kt(pe(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const Mn={"==":Dl,"!=":Ll,">":Bl,"<":Rl,">=":Ol,"<=":Fl,array:et,at:xs,boolean:et,case:ws,coalesce:ko,collator:si,format:Bo,image:Es,in:vs,"index-of":Lo,interpolate:Bi,"interpolate-hcl":Bi,"interpolate-lab":Bi,length:Ss,let:Do,literal:qe,match:bs,number:et,"number-format":Ts,object:et,slice:Ro,step:Jn,string:et,"to-boolean":it,"to-color":it,"to-number":it,"to-string":it,var:Mo,within:en};function Sa(i,[e,r,o,c]){e=e.evaluate(i),r=r.evaluate(i),o=o.evaluate(i);const h=c?c.evaluate(i):1,d=de(e,r,o,h);if(d)throw new Be(d);return new F(e/255*h,r/255*h,o/255*h,h)}function Ia(i,e){return i in e}function Fo(i,e){const r=e[i];return r===void 0?null:r}function tn(i){return{type:i}}function Ca(i){return{result:"success",value:i}}function Pn(i){return{result:"error",value:i}}function Ot(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function Aa(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function yt(i){return!!i.expression&&i.expression.interpolated}function At(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function Ft(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Nt(i){return i}function to(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 x=r?F.parse:X.parse;(i=Qi({},i)).stops&&(i.stops=i.stops.map(T=>[T[0],x(T[1])])),i.default=x(i.default?i.default:e.default)}if(i.colorSpace&&i.colorSpace!=="rgb"&&!wa[i.colorSpace])throw new Error(`Unknown color space: ${i.colorSpace}`);let d,m,g;if(h==="exponential")d=Ma;else if(h==="interval")d=$l;else if(h==="categorical"){d=Ul,m=Object.create(null);for(const x of i.stops)m[x[0]]=x[1];g=typeof i.stops[0][0]}else{if(h!=="identity")throw new Error(`Unknown function type "${h}"`);d=Vl}if(o){const x={},T=[];for(let D=0;D<i.stops.length;D++){const L=i.stops[D],Z=L[0].zoom;x[Z]===void 0&&(x[Z]={zoom:Z,type:i.type,property:i.property,default:i.default,stops:[]},T.push(Z)),x[Z].stops.push([L[0].value,L[1]])}const S=[];for(const D of T)S.push([x[D].zoom,to(x[D],e)]);const P={name:"linear"};return{kind:"composite",interpolationType:P,interpolationFactor:Bi.interpolationFactor.bind(void 0,P),zoomStops:S.map(D=>D[0]),evaluate:({zoom:D},L)=>Ma({stops:S,base:i.base},e,D).evaluate(D,L)}}if(c){const x=h==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:x,interpolationFactor:Bi.interpolationFactor.bind(void 0,x),zoomStops:i.stops.map(T=>T[0]),evaluate:({zoom:T})=>d(i,e,T,m,g)}}return{kind:"source",evaluate(x,T){const S=T&&T.properties?T.properties[i.property]:void 0;return S===void 0?zn(i.default,e.default):d(i,e,S,m,g)}}}function zn(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function Ul(i,e,r,o,c){return zn(typeof r===c?o[r]:void 0,i.default,e.default)}function $l(i,e,r){if(At(r)!=="number")return zn(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=Po(i.stops.map(h=>h[0]),r);return i.stops[c][1]}function Ma(i,e,r){const o=i.base!==void 0?i.base:1;if(At(r)!=="number")return zn(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=Po(i.stops.map(T=>T[0]),r),d=function(T,S,P,D){const L=D-P,Z=T-P;return L===0?0:S===1?Z/L:(Math.pow(S,Z)-1)/(Math.pow(S,L)-1)}(r,o,i.stops[h][0],i.stops[h+1][0]),m=i.stops[h][1],g=i.stops[h+1][1];let x=Yn[e.type]||Nt;if(i.colorSpace&&i.colorSpace!=="rgb"){const T=wa[i.colorSpace];x=(S,P)=>T.reverse(T.interpolate(T.forward(S),T.forward(P),d))}return typeof m.evaluate=="function"?{evaluate(...T){const S=m.evaluate.apply(void 0,T),P=g.evaluate.apply(void 0,T);if(S!==void 0&&P!==void 0)return x(S,P,d)}}:x(m,g,d)}function Vl(i,e,r){switch(e.type){case"color":r=F.parse(r);break;case"formatted":r=W.fromString(r.toString());break;case"resolvedImage":r=J.fromString(r.toString());break;case"padding":r=X.parse(r);break;default:At(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0)}return zn(r,i.default,e.default)}Lt.register(Mn,{error:[{kind:"error"},[ut],(i,[e])=>{throw new Be(e.evaluate(i))}],typeof:[ut,[rt],(i,[e])=>kt(pe(e.evaluate(i)))],"to-rgba":[wi(Ae,4),[fi],(i,[e])=>e.evaluate(i).toArray()],rgb:[fi,[Ae,Ae,Ae],Sa],rgba:[fi,[Ae,Ae,Ae,Ae],Sa],has:{type:st,overloads:[[[ut],(i,[e])=>Ia(e.evaluate(i),i.properties())],[[ut,Ur],(i,[e,r])=>Ia(e.evaluate(i),r.evaluate(i))]]},get:{type:rt,overloads:[[[ut],(i,[e])=>Fo(e.evaluate(i),i.properties())],[[ut,Ur],(i,[e,r])=>Fo(e.evaluate(i),r.evaluate(i))]]},"feature-state":[rt,[ut],(i,[e])=>Fo(e.evaluate(i),i.featureState||{})],properties:[Ur,[],i=>i.properties()],"geometry-type":[ut,[],i=>i.geometryType()],id:[rt,[],i=>i.id()],zoom:[Ae,[],i=>i.globals.zoom],"heatmap-density":[Ae,[],i=>i.globals.heatmapDensity||0],"line-progress":[Ae,[],i=>i.globals.lineProgress||0],accumulated:[rt,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[Ae,tn(Ae),(i,e)=>{let r=0;for(const o of e)r+=o.evaluate(i);return r}],"*":[Ae,tn(Ae),(i,e)=>{let r=1;for(const o of e)r*=o.evaluate(i);return r}],"-":{type:Ae,overloads:[[[Ae,Ae],(i,[e,r])=>e.evaluate(i)-r.evaluate(i)],[[Ae],(i,[e])=>-e.evaluate(i)]]},"/":[Ae,[Ae,Ae],(i,[e,r])=>e.evaluate(i)/r.evaluate(i)],"%":[Ae,[Ae,Ae],(i,[e,r])=>e.evaluate(i)%r.evaluate(i)],ln2:[Ae,[],()=>Math.LN2],pi:[Ae,[],()=>Math.PI],e:[Ae,[],()=>Math.E],"^":[Ae,[Ae,Ae],(i,[e,r])=>Math.pow(e.evaluate(i),r.evaluate(i))],sqrt:[Ae,[Ae],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[Ae,[Ae],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[Ae,[Ae],(i,[e])=>Math.log(e.evaluate(i))],log2:[Ae,[Ae],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[Ae,[Ae],(i,[e])=>Math.sin(e.evaluate(i))],cos:[Ae,[Ae],(i,[e])=>Math.cos(e.evaluate(i))],tan:[Ae,[Ae],(i,[e])=>Math.tan(e.evaluate(i))],asin:[Ae,[Ae],(i,[e])=>Math.asin(e.evaluate(i))],acos:[Ae,[Ae],(i,[e])=>Math.acos(e.evaluate(i))],atan:[Ae,[Ae],(i,[e])=>Math.atan(e.evaluate(i))],min:[Ae,tn(Ae),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[Ae,tn(Ae),(i,e)=>Math.max(...e.map(r=>r.evaluate(i)))],abs:[Ae,[Ae],(i,[e])=>Math.abs(e.evaluate(i))],round:[Ae,[Ae],(i,[e])=>{const r=e.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[Ae,[Ae],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[Ae,[Ae],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[st,[ut,rt],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[st,[rt],(i,[e])=>i.id()===e.value],"filter-type-==":[st,[ut],(i,[e])=>i.geometryType()===e.value],"filter-<":[st,[ut,rt],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o<c}],"filter-id-<":[st,[rt],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r<o}],"filter->":[st,[ut,rt],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o>c}],"filter-id->":[st,[rt],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r>o}],"filter-<=":[st,[ut,rt],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o<=c}],"filter-id-<=":[st,[rt],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r<=o}],"filter->=":[st,[ut,rt],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o>=c}],"filter-id->=":[st,[rt],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r>=o}],"filter-has":[st,[rt],(i,[e])=>e.value in i.properties()],"filter-has-id":[st,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[st,[wi(ut)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[st,[wi(rt)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[st,[ut,wi(rt)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[st,[ut,wi(rt)],(i,[e,r])=>function(o,c,h,d){for(;h<=d;){const m=h+d>>1;if(c[m]===o)return!0;c[m]>o?d=m-1:h=m+1}return!1}(i.properties()[e.value],r.value,0,r.value.length-1)],all:{type:st,overloads:[[[st,st],(i,[e,r])=>e.evaluate(i)&&r.evaluate(i)],[tn(st),(i,e)=>{for(const r of e)if(!r.evaluate(i))return!1;return!0}]]},any:{type:st,overloads:[[[st,st],(i,[e,r])=>e.evaluate(i)||r.evaluate(i)],[tn(st),(i,e)=>{for(const r of e)if(r.evaluate(i))return!0;return!1}]]},"!":[st,[st],(i,[e])=>!e.evaluate(i)],"is-supported-script":[st,[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,tn(rt),(i,e)=>e.map(r=>Ne(r.evaluate(i))).join("")],"resolved-locale":[ut,[Tr],(i,[e])=>e.evaluate(i).resolvedLocale()]});class Oo{constructor(e,r){this.expression=e,this._warningHistory={},this._evaluator=new Et,this._defaultValue=r?function(o){return o.type==="color"&&Ft(o.default)?new F(0,0,0,0):o.type==="color"?F.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,d){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=d,this.expression.evaluate(this._evaluator)}evaluate(e,r,o,c,h,d){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=d||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 io(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in Mn}function ro(i,e){const r=new Cn(Mn,[],e?function(c){const h={color:fi,string:ut,number:Ae,enum:ut,boolean:st,formatted:oi,padding:wn,resolvedImage:Yt};return c.type==="array"?wi(h[c.value]||rt,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?Ca(new Oo(o,e)):Pn(r.errors)}class no{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!In(r.expression)}evaluateWithoutErrorHandling(e,r,o,c,h,d){return this._styleExpression.evaluateWithoutErrorHandling(e,r,o,c,h,d)}evaluate(e,r,o,c,h,d){return this._styleExpression.evaluate(e,r,o,c,h,d)}}class Is{constructor(e,r,o,c){this.kind=e,this.zoomStops=o,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!In(r.expression),this.interpolationType=c}evaluateWithoutErrorHandling(e,r,o,c,h,d){return this._styleExpression.evaluateWithoutErrorHandling(e,r,o,c,h,d)}evaluate(e,r,o,c,h,d){return this._styleExpression.evaluate(e,r,o,c,h,d)}interpolationFactor(e,r,o){return this.interpolationType?Bi.interpolationFactor(this.interpolationType,e,r,o):0}}function Pa(i,e){const r=ro(i,e);if(r.result==="error")return r;const o=r.value.expression,c=Kn(o);if(!c&&!Ot(e))return Pn([new Li("","data expressions not supported")]);const h=Ao(o,["zoom"]);if(!h&&!Aa(e))return Pn([new Li("","zoom expressions not supported")]);const d=$o(o);return d||h?d instanceof Li?Pn([d]):d instanceof Bi&&!yt(e)?Pn([new Li("",'"interpolate" expressions cannot be used with this property')]):Ca(d?new Is(c?"camera":"composite",r.value,d.labels,d instanceof Bi?d.interpolation:void 0):new no(c?"constant":"source",r.value)):Pn([new Li("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Uo{constructor(e,r){this._parameters=e,this._specification=r,Qi(this,to(this._parameters,this._specification))}static deserialize(e){return new Uo(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function $o(i){let e=null;if(i instanceof Do)e=$o(i.result);else if(i instanceof ko){for(const r of i.args)if(e=$o(r),e)break}else(i instanceof Jn||i instanceof Bi)&&i.input instanceof Lt&&i.input.name==="zoom"&&(e=i);return e instanceof Li||i.eachChild(r=>{const o=$o(r);o instanceof Li?e=o:!e&&o?e=new Li("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&o&&e!==o&&(e=new Li("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function er(i){const e=i.key,r=i.value,o=i.valueSpec||{},c=i.objectElementValidators||{},h=i.style,d=i.styleSpec;let m=[];const g=At(r);if(g!=="object")return[new ze(e,r,`object expected, ${g} found`)];for(const x in r){const T=x.split(".")[0],S=o[T]||o["*"];let P;if(c[T])P=c[T];else if(o[T])P=Oi;else if(c["*"])P=c["*"];else{if(!o["*"]){m.push(new ze(e,r[x],`unknown property "${x}"`));continue}P=Oi}m=m.concat(P({key:(e&&`${e}.`)+x,value:r[x],valueSpec:S,style:h,styleSpec:d,object:r,objectKey:x},r))}for(const x in o)c[x]||o[x].required&&o[x].default===void 0&&r[x]===void 0&&m.push(new ze(e,r,`missing required property "${x}"`));return m}function za(i){const e=i.value,r=i.valueSpec,o=i.style,c=i.styleSpec,h=i.key,d=i.arrayElementValidator||Oi;if(At(e)!=="array")return[new ze(h,e,`array expected, ${At(e)} found`)];if(r.length&&e.length!==r.length)return[new ze(h,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new ze(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),At(r.value)==="object"&&(m=r.value);let g=[];for(let x=0;x<e.length;x++)g=g.concat(d({array:e,arrayIndex:x,value:e[x],valueSpec:m,style:o,styleSpec:c,key:`${h}[${x}]`}));return g}function Cs(i){const e=i.key,r=i.value,o=i.valueSpec;let c=At(r);return c==="number"&&r!=r&&(c="NaN"),c!=="number"?[new ze(e,r,`number expected, ${c} found`)]:"minimum"in o&&r<o.minimum?[new ze(e,r,`${r} is less than the minimum value ${o.minimum}`)]:"maximum"in o&&r>o.maximum?[new ze(e,r,`${r} is greater than the maximum value ${o.maximum}`)]:[]}function ka(i){const e=i.valueSpec,r=wt(i.value.type);let o,c,h,d={};const m=r!=="categorical"&&i.value.property===void 0,g=!m,x=At(i.value.stops)==="array"&&At(i.value.stops[0])==="array"&&At(i.value.stops[0][0])==="object",T=er({key:i.key,value:i.value,valueSpec:i.styleSpec.function,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(D){if(r==="identity")return[new ze(D.key,D.value,'identity function may not have a "stops" property')];let L=[];const Z=D.value;return L=L.concat(za({key:D.key,value:Z,valueSpec:D.valueSpec,style:D.style,styleSpec:D.styleSpec,arrayElementValidator:S})),At(Z)==="array"&&Z.length===0&&L.push(new ze(D.key,Z,"array must have at least one stop")),L},default:function(D){return Oi({key:D.key,value:D.value,valueSpec:e,style:D.style,styleSpec:D.styleSpec})}}});return r==="identity"&&m&&T.push(new ze(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||T.push(new ze(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!yt(i.valueSpec)&&T.push(new ze(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(g&&!Ot(i.valueSpec)?T.push(new ze(i.key,i.value,"property functions not supported")):m&&!Aa(i.valueSpec)&&T.push(new ze(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!x||i.value.property!==void 0||T.push(new ze(i.key,i.value,'"property" property is required')),T;function S(D){let L=[];const Z=D.value,q=D.key;if(At(Z)!=="array")return[new ze(q,Z,`array expected, ${At(Z)} found`)];if(Z.length!==2)return[new ze(q,Z,`array length 2 expected, length ${Z.length} found`)];if(x){if(At(Z[0])!=="object")return[new ze(q,Z,`object expected, ${At(Z[0])} found`)];if(Z[0].zoom===void 0)return[new ze(q,Z,"object stop key must have zoom")];if(Z[0].value===void 0)return[new ze(q,Z,"object stop key must have value")];if(h&&h>wt(Z[0].zoom))return[new ze(q,Z[0].zoom,"stop zoom values must appear in ascending order")];wt(Z[0].zoom)!==h&&(h=wt(Z[0].zoom),c=void 0,d={}),L=L.concat(er({key:`${q}[0]`,value:Z[0],valueSpec:{zoom:{}},style:D.style,styleSpec:D.styleSpec,objectElementValidators:{zoom:Cs,value:P}}))}else L=L.concat(P({key:`${q}[0]`,value:Z[0],valueSpec:{},style:D.style,styleSpec:D.styleSpec},Z));return io(qi(Z[1]))?L.concat([new ze(`${q}[1]`,Z[1],"expressions are not allowed in function stops.")]):L.concat(Oi({key:`${q}[1]`,value:Z[1],valueSpec:e,style:D.style,styleSpec:D.styleSpec}))}function P(D,L){const Z=At(D.value),q=wt(D.value),re=D.value!==null?D.value:L;if(o){if(Z!==o)return[new ze(D.key,re,`${Z} stop domain type must match previous stop domain type ${o}`)]}else o=Z;if(Z!=="number"&&Z!=="string"&&Z!=="boolean")return[new ze(D.key,re,"stop domain value must be a number, string, or boolean")];if(Z!=="number"&&r!=="categorical"){let ce=`number expected, ${Z} found`;return Ot(e)&&r===void 0&&(ce+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new ze(D.key,re,ce)]}return r!=="categorical"||Z!=="number"||isFinite(q)&&Math.floor(q)===q?r!=="categorical"&&Z==="number"&&c!==void 0&&q<c?[new ze(D.key,re,"stop domain values must appear in ascending order")]:(c=q,r==="categorical"&&q in d?[new ze(D.key,re,"stop domain values must be unique")]:(d[q]=!0,[])):[new ze(D.key,re,`integer expected, found ${q}`)]}}function rn(i){const e=(i.expressionContext==="property"?Pa:ro)(qi(i.value),i.valueSpec);if(e.result==="error")return e.value.map(o=>new ze(`${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 ze(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"&&!In(r))return[new ze(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!In(r))return[new ze(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!Ao(r,["zoom","feature-state"]))return[new ze(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!Kn(r))return[new ze(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function oo(i){const e=i.key,r=i.value,o=i.valueSpec,c=[];return Array.isArray(o.values)?o.values.indexOf(wt(r))===-1&&c.push(new ze(e,r,`expected one of [${o.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(o.values).indexOf(wt(r))===-1&&c.push(new ze(e,r,`expected one of [${Object.keys(o.values).join(", ")}], ${JSON.stringify(r)} found`)),c}function kn(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(!kn(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const Nl={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Vo(i){if(i==null)return{filter:()=>!0,needGeometry:!1};kn(i)||(i=so(i));const e=ro(i,Nl);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:La(i)}}function Da(i,e){return i<e?-1:i>e?1:0}function La(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let e=1;e<i.length;e++)if(La(i[e]))return!0;return!1}function so(i){if(!i)return!0;const e=i[0];return i.length<=1?e!=="any":e==="=="?As(i[1],i[2],"=="):e==="!="?Dn(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(so))):e==="all"?["all"].concat(i.slice(1).map(so)):e==="none"?["all"].concat(i.slice(1).map(so).map(Dn)):e==="in"?No(i[1],i.slice(2)):e==="!in"?Dn(No(i[1],i.slice(2))):e==="has"?ao(i[1]):e==="!has"?Dn(ao(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 No(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(Da)]]:["filter-in-small",i,["literal",e]]}}function ao(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function Dn(i){return["!",i]}function lo(i){return kn(qi(i.value))?rn(Qi({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Ra(i)}function Ra(i){const e=i.value,r=i.key;if(At(e)!=="array")return[new ze(r,e,`array expected, ${At(e)} found`)];const o=i.styleSpec;let c,h=[];if(e.length<1)return[new ze(r,e,"filter array must have at least 1 element")];switch(h=h.concat(oo({key:`${r}[0]`,value:e[0],valueSpec:o.filter_operator,style:i.style,styleSpec:i.styleSpec})),wt(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&wt(e[1])==="$type"&&h.push(new ze(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&h.push(new ze(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(c=At(e[1]),c!=="string"&&h.push(new ze(`${r}[1]`,e[1],`string expected, ${c} found`)));for(let d=2;d<e.length;d++)c=At(e[d]),wt(e[1])==="$type"?h=h.concat(oo({key:`${r}[${d}]`,value:e[d],valueSpec:o.geometry_type,style:i.style,styleSpec:i.styleSpec})):c!=="string"&&c!=="number"&&c!=="boolean"&&h.push(new ze(`${r}[${d}]`,e[d],`string, number, or boolean expected, ${c} found`));break;case"any":case"all":case"none":for(let d=1;d<e.length;d++)h=h.concat(Ra({key:`${r}[${d}]`,value:e[d],style:i.style,styleSpec:i.styleSpec}));break;case"has":case"!has":c=At(e[1]),e.length!==2?h.push(new ze(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):c!=="string"&&h.push(new ze(`${r}[1]`,e[1],`string expected, ${c} found`));break;case"within":c=At(e[1]),e.length!==2?h.push(new ze(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):c!=="object"&&h.push(new ze(`${r}[1]`,e[1],`object expected, ${c} found`))}return h}function co(i,e){const r=i.key,o=i.style,c=i.styleSpec,h=i.value,d=i.objectKey,m=c[`${e}_${i.layerType}`];if(!m)return[];const g=d.match(/^(.*)-transition$/);if(e==="paint"&&g&&m[g[1]]&&m[g[1]].transition)return Oi({key:r,value:h,valueSpec:c.transition,style:o,styleSpec:c});const x=i.valueSpec||m[d];if(!x)return[new ze(r,h,`unknown property "${d}"`)];let T;if(At(h)==="string"&&Ot(x)&&!x.tokens&&(T=/^{([^}]+)}$/.exec(h)))return[new ze(r,h,`"${d}" does not support interpolation syntax
|
|
2
|
-
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(T[1])} }\`.`)];const S=[];return i.layerType==="symbol"&&(d==="text-field"&&o&&!o.glyphs&&S.push(new ze(r,h,'use of "text-field" requires a style "glyphs" property')),d==="text-font"&&Ft(qi(h))&&wt(h.type)==="identity"&&S.push(new ze(r,h,'"text-font" does not support identity functions'))),S.concat(Oi({key:i.key,value:h,valueSpec:x,style:o,styleSpec:c,expressionContext:"property",propertyType:e,propertyKey:d}))}function Ba(i){return co(i,"paint")}function Fa(i){return co(i,"layout")}function Oa(i){let e=[];const r=i.value,o=i.key,c=i.style,h=i.styleSpec;r.type||r.ref||e.push(new ze(o,r,'either "type" or "ref" is required'));let d=wt(r.type);const m=wt(r.ref);if(r.id){const g=wt(r.id);for(let x=0;x<i.arrayIndex;x++){const T=c.layers[x];wt(T.id)===g&&e.push(new ze(o,r.id,`duplicate layer id "${r.id}", previously used at line ${T.id.__line__}`))}}if("ref"in r){let g;["type","source","source-layer","filter","layout"].forEach(x=>{x in r&&e.push(new ze(o,r[x],`"${x}" is prohibited for ref layers`))}),c.layers.forEach(x=>{wt(x.id)===m&&(g=x)}),g?g.ref?e.push(new ze(o,r.ref,"ref cannot reference another ref layer")):d=wt(g.type):e.push(new ze(o,r.ref,`ref layer "${m}" not found`))}else if(d!=="background")if(r.source){const g=c.sources&&c.sources[r.source],x=g&&wt(g.type);g?x==="vector"&&d==="raster"?e.push(new ze(o,r.source,`layer "${r.id}" requires a raster source`)):x==="raster"&&d!=="raster"?e.push(new ze(o,r.source,`layer "${r.id}" requires a vector source`)):x!=="vector"||r["source-layer"]?x==="raster-dem"&&d!=="hillshade"?e.push(new ze(o,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):d!=="line"||!r.paint||!r.paint["line-gradient"]||x==="geojson"&&g.lineMetrics||e.push(new ze(o,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new ze(o,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new ze(o,r.source,`source "${r.source}" not found`))}else e.push(new ze(o,r,'missing required property "source"'));return e=e.concat(er({key:o,value:r,valueSpec:h.layer,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Oi({key:`${o}.type`,value:r.type,valueSpec:h.layer.type,style:i.style,styleSpec:i.styleSpec,object:r,objectKey:"type"}),filter:lo,layout:g=>er({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,objectElementValidators:{"*":x=>Fa(Qi({layerType:d},x))}}),paint:g=>er({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,objectElementValidators:{"*":x=>Ba(Qi({layerType:d},x))}})}})),e}function Ln(i){const e=i.value,r=i.key,o=At(e);return o!=="string"?[new ze(r,e,`string expected, ${o} found`)]:[]}const Ua={promoteId:function({key:i,value:e}){if(At(e)==="string")return Ln({key:i,value:e});{const r=[];for(const o in e)r.push(...Ln({key:`${i}.${o}`,value:e[o]}));return r}}};function uo(i){const e=i.value,r=i.key,o=i.styleSpec,c=i.style;if(!e.type)return[new ze(r,e,'"type" is required')];const h=wt(e.type);let d;switch(h){case"vector":case"raster":case"raster-dem":return d=er({key:r,value:e,valueSpec:o[`source_${h.replace("-","_")}`],style:i.style,styleSpec:o,objectElementValidators:Ua}),d;case"geojson":if(d=er({key:r,value:e,valueSpec:o.source_geojson,style:c,styleSpec:o,objectElementValidators:Ua}),e.cluster)for(const m in e.clusterProperties){const[g,x]=e.clusterProperties[m],T=typeof g=="string"?[g,["accumulated"],["get",m]]:g;d.push(...rn({key:`${r}.${m}.map`,value:x,expressionContext:"cluster-map"})),d.push(...rn({key:`${r}.${m}.reduce`,value:T,expressionContext:"cluster-reduce"}))}return d;case"video":return er({key:r,value:e,valueSpec:o.source_video,style:c,styleSpec:o});case"image":return er({key:r,value:e,valueSpec:o.source_image,style:c,styleSpec:o});case"canvas":return[new ze(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return oo({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:c,styleSpec:o})}}function ho(i){const e=i.value,r=i.styleSpec,o=r.light,c=i.style;let h=[];const d=At(e);if(e===void 0)return h;if(d!=="object")return h=h.concat([new ze("light",e,`object expected, ${d} found`)]),h;for(const m in e){const g=m.match(/^(.*)-transition$/);h=h.concat(g&&o[g[1]]&&o[g[1]].transition?Oi({key:m,value:e[m],valueSpec:r.transition,style:c,styleSpec:r}):o[m]?Oi({key:m,value:e[m],valueSpec:o[m],style:c,styleSpec:r}):[new ze(m,e[m],`unknown property "${m}"`)])}return h}function Fi(i){const e=i.value,r=i.styleSpec,o=r.terrain,c=i.style;let h=[];const d=At(e);if(e===void 0)return h;if(d!=="object")return h=h.concat([new ze("terrain",e,`object expected, ${d} found`)]),h;for(const m in e)h=h.concat(o[m]?Oi({key:m,value:e[m],valueSpec:o[m],style:c,styleSpec:r}):[new ze(m,e[m],`unknown property "${m}"`)]);return h}const po={"*":()=>[],array:za,boolean:function(i){const e=i.value,r=i.key,o=At(e);return o!=="boolean"?[new ze(r,e,`boolean expected, ${o} found`)]:[]},number:Cs,color:function(i){const e=i.key,r=i.value,o=At(r);return o!=="string"?[new ze(e,r,`color expected, ${o} found`)]:En(r)===null?[new ze(e,r,`color expected, "${r}" found`)]:[]},constants:Kr,enum:oo,filter:lo,function:ka,layer:Oa,object:er,source:uo,light:ho,terrain:Fi,string:Ln,formatted:function(i){return Ln(i).length===0?[]:rn(i)},resolvedImage:function(i){return Ln(i).length===0?[]:rn(i)},padding:function(i){const e=i.key,r=i.value;if(At(r)==="array"){if(r.length<1||r.length>4)return[new ze(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(Oi({key:`${e}[${h}]`,value:r[h],valueSpec:o}));return c}return Cs({key:e,value:r,valueSpec:{}})}};function Oi(i){const e=i.value,r=i.valueSpec,o=i.styleSpec;return r.expression&&Ft(wt(e))?ka(i):r.expression&&io(qi(e))?rn(i):r.type&&po[r.type]?po[r.type](i):er(Qi({},i,{valueSpec:r.type?o[r.type]:r}))}function Gl(i){const e=i.value,r=i.key,o=Ln(i);return o.length||(e.indexOf("{fontstack}")===-1&&o.push(new ze(r,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&o.push(new ze(r,e,'"glyphs" url must include a "{range}" token'))),o}function $r(i,e=_e){let r=[];return r=r.concat(Oi({key:"",value:i,valueSpec:e.$root,styleSpec:e,style:i,objectElementValidators:{glyphs:Gl,"*":()=>[]}})),i.constants&&(r=r.concat(Kr({key:"constants",value:i.constants,style:i,styleSpec:e}))),$a(r)}function $a(i){return[].concat(i).sort((e,r)=>e.line-r.line)}function Er(i){return function(...e){return $a(i.apply(this,e))}}$r.source=Er(uo),$r.light=Er(ho),$r.terrain=Er(Fi),$r.layer=Er(Oa),$r.filter=Er(lo),$r.paintProperty=Er(Ba),$r.layoutProperty=Er(Fa);const fo=$r,Ms=fo.light,ql=fo.paintProperty,Zl=fo.layoutProperty;function Go(i,e){let r=!1;if(e&&e.length)for(const o of e)i.fire(new bn(new Error(o.message))),r=!0;return r}class mo{constructor(e,r,o){const c=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const d=new Int32Array(this.arrayBuffer);e=d[0],this.d=(r=d[1])+2*(o=d[2]);for(let g=0;g<this.d*this.d;g++){const x=d[3+g],T=d[3+g+1];c.push(x===T?null:d.subarray(x,T))}const m=d[3+c.length+1];this.keys=d.subarray(d[3+c.length],m),this.bboxes=d.subarray(m),this.insert=this._insertReadonly}else{this.d=r+2*o;for(let d=0;d<this.d*this.d;d++)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,d){this.cells[h].push(d)}query(e,r,o,c,h){const d=this.min,m=this.max;if(e<=d&&r<=d&&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,d,m,g){const x=this.cells[h];if(x!==null){const T=this.keys,S=this.bboxes;for(let P=0;P<x.length;P++){const D=x[P];if(m[D]===void 0){const L=4*D;(g?g(S[L+0],S[L+1],S[L+2],S[L+3]):e<=S[L+2]&&r<=S[L+3]&&o>=S[L+0]&&c>=S[L+1])?(m[D]=!0,d.push(T[D])):m[D]=!1}}}}_forEachCell(e,r,o,c,h,d,m,g){const x=this._convertToCellCoord(e),T=this._convertToCellCoord(r),S=this._convertToCellCoord(o),P=this._convertToCellCoord(c);for(let D=x;D<=S;D++)for(let L=T;L<=P;L++){const Z=this.d*L+D;if((!g||g(this._convertFromCellCoord(D),this._convertFromCellCoord(L),this._convertFromCellCoord(D+1),this._convertFromCellCoord(L+1)))&&h.call(this,e,r,o,c,Z,d,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 d=0;d<this.cells.length;d++)o+=this.cells[d].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 d=0;d<e.length;d++){const m=e[d];c[3+d]=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 mo(e.buffer)}}const Sr={};function $e(i,e,r={}){if(Sr[i])throw new Error(`${i} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:i,writeable:!1}),Sr[i]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}$e("Object",Object),$e("TransferableGridIndex",mo),$e("Color",F),$e("Error",Error),$e("AJAXError",Di),$e("ResolvedImage",J),$e("StylePropertyFunction",Uo),$e("StyleExpression",Oo,{omit:["_evaluator"]}),$e("ZoomDependentExpression",Is),$e("ZoomConstantExpression",no),$e("CompoundExpression",Lt,{omit:["_evaluate"]});for(const i in Mn)Mn[i]._classRegistryKey||$e(`Expression_${i}`,Mn[i]);function Va(i){return i&&typeof ArrayBuffer!="undefined"&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}function nn(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(Va(i)||Ki(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(nn(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(!Sr[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)||Sr[o].omit.indexOf(h)>=0)continue;const d=i[h];c[h]=Sr[o].shallow.indexOf(h)>=0?d:nn(d,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 Vr(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||Va(i)||Ki(i)||ArrayBuffer.isView(i)||i instanceof ImageData)return i;if(Array.isArray(i))return i.map(Vr);if(typeof i=="object"){const e=i.$name||"Object";if(!Sr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=Sr[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]=Sr[e].shallow.indexOf(c)>=0?h:Vr(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 De={"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 qo(i){for(const e of i)if(ks(e.charCodeAt(0)))return!0;return!1}function jl(i){for(const e of i)if(!zs(e.charCodeAt(0)))return!1;return!0}function zs(i){return!(De.Arabic(i)||De["Arabic Supplement"](i)||De["Arabic Extended-A"](i)||De["Arabic Presentation Forms-A"](i)||De["Arabic Presentation Forms-B"](i))}function ks(i){return!(i!==746&&i!==747&&(i<4352||!(De["Bopomofo Extended"](i)||De.Bopomofo(i)||De["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||De["CJK Compatibility Ideographs"](i)||De["CJK Compatibility"](i)||De["CJK Radicals Supplement"](i)||De["CJK Strokes"](i)||!(!De["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||De["CJK Unified Ideographs Extension A"](i)||De["CJK Unified Ideographs"](i)||De["Enclosed CJK Letters and Months"](i)||De["Hangul Compatibility Jamo"](i)||De["Hangul Jamo Extended-A"](i)||De["Hangul Jamo Extended-B"](i)||De["Hangul Jamo"](i)||De["Hangul Syllables"](i)||De.Hiragana(i)||De["Ideographic Description Characters"](i)||De.Kanbun(i)||De["Kangxi Radicals"](i)||De["Katakana Phonetic Extensions"](i)||De.Katakana(i)&&i!==12540||!(!De["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)||!(!De["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||De["Unified Canadian Aboriginal Syllabics"](i)||De["Unified Canadian Aboriginal Syllabics Extended"](i)||De["Vertical Forms"](i)||De["Yijing Hexagram Symbols"](i)||De["Yi Syllables"](i)||De["Yi Radicals"](i))))}function Na(i){return!(ks(i)||function(e){return!!(De["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||De["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)||De["Letterlike Symbols"](e)||De["Number Forms"](e)||De["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)||De["Control Pictures"](e)&&e!==9251||De["Optical Character Recognition"](e)||De["Enclosed Alphanumerics"](e)||De["Geometric Shapes"](e)||De["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||De["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||De["CJK Symbols and Punctuation"](e)||De.Katakana(e)||De["Private Use Area"](e)||De["CJK Compatibility Forms"](e)||De["Small Form Variants"](e)||De["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 Ga(i){return i>=1424&&i<=2303||De["Arabic Presentation Forms-A"](i)||De["Arabic Presentation Forms-B"](i)}function Xl(i,e){return!(!e&&Ga(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||De.Khmer(i))}function qa(i){for(const e of i)if(Ga(e.charCodeAt(0)))return!0;return!1}const Ds="deferred",Ls="loading",Rs="loaded";let Bs=null,Ci="unavailable",Nr=null;const Za=function(i){i&&typeof i=="string"&&i.indexOf("NetworkError")>-1&&(Ci="error"),Bs&&Bs(i)};function Rn(){Fs.fire(new br("pluginStateChange",{pluginStatus:Ci,pluginURL:Nr}))}const Fs=new wr,go=function(){return Ci},ja=function(){if(Ci!==Ds||!Nr)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Ci=Ls,Rn(),Nr&&vn({url:Nr},i=>{i?Za(i):(Ci=Rs,Rn())})},Zi={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Ci===Rs||Zi.applyArabicShaping!=null,isLoading:()=>Ci===Ls,setState(i){if(!ct())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");Ci=i.pluginStatus,Nr=i.pluginURL},isParsed(){if(!ct())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return Zi.applyArabicShaping!=null&&Zi.processBidirectionalText!=null&&Zi.processStyledBidirectionalText!=null},getPluginURL(){if(!ct())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return Nr}};class Gt{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(!Xl(c.charCodeAt(0),o))return!1;return!0}(e,Zi.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 _o{constructor(e,r){this.property=e,this.value=r,this.expression=function(o,c){if(Ft(o))return new Uo(o,c);if(io(o)){const h=Pa(o,c);if(h.result==="error")throw new Error(h.value.map(d=>`${d.key}: ${d.message}`).join(", "));return h.value}{let h=o;return c.type==="color"&&typeof o=="string"?h=F.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 Zo{constructor(e){this.property=e,this.value=new _o(e,void 0)}transitioned(e,r){return new Wa(this.property,this.value,r,Ie({},e.transition,this.transition),e.now)}untransitioned(){return new Wa(this.property,this.value,null,{},0)}}class Xa{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return lt(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Zo(this._values[e].property)),this._values[e].value=new _o(this._values[e].property,r===null?void 0:lt(r))}getTransition(e){return lt(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Zo(this._values[e].property)),this._values[e].transition=lt(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 Ha(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 Ha(this._properties);for(const r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}}class Wa{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),d=this.prior;if(d){if(c>this.end)return this.prior=null,h;if(this.value.isDataDriven())return this.prior=null,h;if(c<this.begin)return d.possiblyEvaluate(e,r,o);{const m=(c-this.begin)/(this.end-this.begin);return this.property.interpolate(d.possiblyEvaluate(e,r,o),h,function(g){if(g<=0)return 0;if(g>=1)return 1;const x=g*g,T=x*g;return 4*(g<.5?T:3*(g-x)+T-.75)}(m))}}return h}}class Ha{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,o){const c=new yo(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 Wl{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}getValue(e){return lt(this._values[e].value)}setValue(e,r){this._values[e]=new _o(this._values[e].property,r===null?void 0:lt(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 yo(this._properties);for(const h of Object.keys(this._values))c._values[h]=this._values[h].possiblyEvaluate(e,r,o);return c}}class ur{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 yo{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Ze{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=Yn[this.specification.type];return c?c(e,r,o):e}}class Ye{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,o,c){return new ur(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 ur(this,{kind:"constant",value:void 0},e.parameters);const c=Yn[this.specification.type];return c?new ur(this,{kind:"constant",value:c(e.value.value,r.value.value,o)},e.parameters):e}evaluate(e,r,o,c,h,d){return e.kind==="constant"?e.value:e.evaluate(r,o,c,h,d)}}class Bn extends Ye{possiblyEvaluate(e,r,o,c){if(e.value===void 0)return new ur(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){const h=e.expression.evaluate(r,null,{},o,c),d=e.property.specification.type==="resolvedImage"&&typeof h!="string"?h.name:h,m=this._calculate(d,d,d,r);return new ur(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 ur(this,{kind:"constant",value:h},r)}return new ur(this,e.expression,r)}evaluate(e,r,o,c,h,d){if(e.kind==="source"){const m=e.evaluate(r,o,c,h,d);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 Gt(Math.floor(r.zoom-1),r)),e.expression.evaluate(new Gt(Math.floor(r.zoom),r)),e.expression.evaluate(new Gt(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 Gr{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 _o(o,void 0),h=this.defaultTransitionablePropertyValues[r]=new Zo(o);this.defaultTransitioningPropertyValues[r]=h.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=c.possiblyEvaluate({})}}}$e("DataDrivenProperty",Ye),$e("DataConstantProperty",Ze),$e("CrossFadedDataDrivenProperty",Bn),$e("CrossFadedProperty",Os),$e("ColorRampProperty",Gr);const qr="-transition";class hr extends wr{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 Wl(r.layout)),r.paint)){this._transitionablePaint=new Xa(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 yo(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(Zl,`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(ql,`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",d=c.value.isDataDriven(),m=c.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);const g=this._transitionablePaint._values[e].value;return g.isDataDriven()||d||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),Qe(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)&&Go(this,e.call(fo,{key:r,layerType:this.type,objectKey:o,value:c,styleSpec:_e,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 ur&&Ot(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const Ka={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Zr{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=Ka[c.type].BYTES_PER_ELEMENT,d=r=Us(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:d}}),size:Us(r,Math.max(o,e)),alignment:e}}function Us(i,e){return Math.ceil(i/e)*e}class on 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}}on.prototype.bytesPerElement=4,$e("StructArrayLayout2i4",on);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 d=4*e;return this.int16[d+0]=r,this.int16[d+1]=o,this.int16[d+2]=c,this.int16[d+3]=h,e}}l.prototype.bytesPerElement=8,$e("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,d){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,o,c,h,d)}emplace(e,r,o,c,h,d,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]=d,this.int16[g+5]=m,e}}t.prototype.bytesPerElement=12,$e("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,d){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,o,c,h,d)}emplace(e,r,o,c,h,d,m){const g=4*e,x=8*e;return this.int16[g+0]=r,this.int16[g+1]=o,this.uint8[x+4]=c,this.uint8[x+5]=h,this.uint8[x+6]=d,this.uint8[x+7]=m,e}}n.prototype.bytesPerElement=8,$e("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,$e("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,d,m,g,x,T){const S=this.length;return this.resize(S+1),this.emplace(S,e,r,o,c,h,d,m,g,x,T)}emplace(e,r,o,c,h,d,m,g,x,T,S){const P=10*e;return this.uint16[P+0]=r,this.uint16[P+1]=o,this.uint16[P+2]=c,this.uint16[P+3]=h,this.uint16[P+4]=d,this.uint16[P+5]=m,this.uint16[P+6]=g,this.uint16[P+7]=x,this.uint16[P+8]=T,this.uint16[P+9]=S,e}}u.prototype.bytesPerElement=20,$e("StructArrayLayout10ui20",u);class p 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,d,m,g,x,T,S,P){const D=this.length;return this.resize(D+1),this.emplace(D,e,r,o,c,h,d,m,g,x,T,S,P)}emplace(e,r,o,c,h,d,m,g,x,T,S,P,D){const L=12*e;return this.int16[L+0]=r,this.int16[L+1]=o,this.int16[L+2]=c,this.int16[L+3]=h,this.uint16[L+4]=d,this.uint16[L+5]=m,this.uint16[L+6]=g,this.uint16[L+7]=x,this.int16[L+8]=T,this.int16[L+9]=S,this.int16[L+10]=P,this.int16[L+11]=D,e}}p.prototype.bytesPerElement=24,$e("StructArrayLayout4i4ui4i24",p);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,$e("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,$e("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,d,m,g,x){const T=this.length;return this.resize(T+1),this.emplace(T,e,r,o,c,h,d,m,g,x)}emplace(e,r,o,c,h,d,m,g,x,T){const S=10*e,P=5*e;return this.int16[S+0]=r,this.int16[S+1]=o,this.int16[S+2]=c,this.int16[S+3]=h,this.int16[S+4]=d,this.int16[S+5]=m,this.uint32[P+3]=g,this.uint16[S+8]=x,this.uint16[S+9]=T,e}}y.prototype.bytesPerElement=20,$e("StructArrayLayout6i1ul2ui20",y);class v extends Ht{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,d){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,o,c,h,d)}emplace(e,r,o,c,h,d,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]=d,this.int16[g+5]=m,e}}v.prototype.bytesPerElement=12,$e("StructArrayLayout2i2i2i12",v);class E 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 d=this.length;return this.resize(d+1),this.emplace(d,e,r,o,c,h)}emplace(e,r,o,c,h,d){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]=d,e}}E.prototype.bytesPerElement=16,$e("StructArrayLayout2f1f2i16",E);class M 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 d=12*e,m=3*e;return this.uint8[d+0]=r,this.uint8[d+1]=o,this.float32[m+1]=c,this.float32[m+2]=h,e}}M.prototype.bytesPerElement=12,$e("StructArrayLayout2ub2f12",M);class z 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}}z.prototype.bytesPerElement=6,$e("StructArrayLayout3ui6",z);class V 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,d,m,g,x,T,S,P,D,L,Z,q,re){const ce=this.length;return this.resize(ce+1),this.emplace(ce,e,r,o,c,h,d,m,g,x,T,S,P,D,L,Z,q,re)}emplace(e,r,o,c,h,d,m,g,x,T,S,P,D,L,Z,q,re,ce){const te=24*e,ae=12*e,xe=48*e;return this.int16[te+0]=r,this.int16[te+1]=o,this.uint16[te+2]=c,this.uint16[te+3]=h,this.uint32[ae+2]=d,this.uint32[ae+3]=m,this.uint32[ae+4]=g,this.uint16[te+10]=x,this.uint16[te+11]=T,this.uint16[te+12]=S,this.float32[ae+7]=P,this.float32[ae+8]=D,this.uint8[xe+36]=L,this.uint8[xe+37]=Z,this.uint8[xe+38]=q,this.uint32[ae+10]=re,this.int16[te+22]=ce,e}}V.prototype.bytesPerElement=48,$e("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",V);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,d,m,g,x,T,S,P,D,L,Z,q,re,ce,te,ae,xe,ye,Ue,Ge,Le,Pe,Ee,Re){const ke=this.length;return this.resize(ke+1),this.emplace(ke,e,r,o,c,h,d,m,g,x,T,S,P,D,L,Z,q,re,ce,te,ae,xe,ye,Ue,Ge,Le,Pe,Ee,Re)}emplace(e,r,o,c,h,d,m,g,x,T,S,P,D,L,Z,q,re,ce,te,ae,xe,ye,Ue,Ge,Le,Pe,Ee,Re,ke){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]=d,this.int16[Te+5]=m,this.int16[Te+6]=g,this.int16[Te+7]=x,this.uint16[Te+8]=T,this.uint16[Te+9]=S,this.uint16[Te+10]=P,this.uint16[Te+11]=D,this.uint16[Te+12]=L,this.uint16[Te+13]=Z,this.uint16[Te+14]=q,this.uint16[Te+15]=re,this.uint16[Te+16]=ce,this.uint16[Te+17]=te,this.uint16[Te+18]=ae,this.uint16[Te+19]=xe,this.uint16[Te+20]=ye,this.uint16[Te+21]=Ue,this.uint16[Te+22]=Ge,this.uint32[He+12]=Le,this.float32[He+13]=Pe,this.float32[He+14]=Ee,this.float32[He+15]=Re,this.float32[He+16]=ke,e}}U.prototype.bytesPerElement=68,$e("StructArrayLayout8i15ui1ul4f68",U);class $ 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}}$.prototype.bytesPerElement=4,$e("StructArrayLayout1f4",$);class H 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}}H.prototype.bytesPerElement=6,$e("StructArrayLayout3i6",H);class Q 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}}Q.prototype.bytesPerElement=8,$e("StructArrayLayout1ul2ui8",Q);class oe 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}}oe.prototype.bytesPerElement=4,$e("StructArrayLayout2ui4",oe);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,$e("StructArrayLayout1ui2",G);class le 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 d=4*e;return this.float32[d+0]=r,this.float32[d+1]=o,this.float32[d+2]=c,this.float32[d+3]=h,e}}le.prototype.bytesPerElement=16,$e("StructArrayLayout4f16",le);class se extends Zr{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 tt(this.anchorPointX,this.anchorPointY)}}se.prototype.size=20;class me extends y{get(e){return new se(this,e)}}$e("CollisionBoxArray",me);class ge extends Zr{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]}}ge.prototype.size=48;class we extends V{get(e){return new ge(this,e)}}$e("PlacedSymbolArray",we);class fe extends Zr{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]}}fe.prototype.size=68;class Fe extends U{get(e){return new fe(this,e)}}$e("SymbolInstanceArray",Fe);class Me extends ${getoffsetX(e){return this.float32[1*e+0]}}$e("GlyphOffsetArray",Me);class Oe extends H{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}$e("SymbolLineVertexArray",Oe);class at extends Zr{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]}}at.prototype.size=8;class pt extends Q{get(e){return new at(this,e)}}$e("FeatureIndexArray",pt);class We extends on{}class Pt extends on{}class zt extends on{}class xt extends t{}class St extends n{}class Dt extends s{}class ai extends u{}class pr extends p{}class tr extends f{}class dr extends _{}class jr extends v{}class ji extends M{}class Ai extends z{}class Ir extends oe{}const jo=Qt([{name:"a_pos",components:2,type:"Int16"}],4),{members:ii}=jo;class mt{constructor(e=[]){this.segments=e}prepareSegment(e,r,o,c){let h=this.segments[this.segments.length-1];return e>mt.MAX_VERTEX_ARRAY_LENGTH&&ot(`Max vertices per segment is ${mt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!h||h.vertexLength+e>mt.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 mt([{vertexOffset:e,primitiveOffset:r,vertexLength:o,primitiveLength:c,vaos:{},sortKey:0}])}}function Mt(i,e){return 256*(i=ee(Math.floor(i),0,255))+ee(Math.floor(e),0,255)}mt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,$e("SegmentVector",mt);const li=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 ci={exports:{}},qt={exports:{}};qt.exports=function(i,e){var r,o,c,h,d,m,g,x;for(o=i.length-(r=3&i.length),c=e,d=3432918353,m=461845907,x=0;x<o;)g=255&i.charCodeAt(x)|(255&i.charCodeAt(++x))<<8|(255&i.charCodeAt(++x))<<16|(255&i.charCodeAt(++x))<<24,++x,c=27492+(65535&(h=5*(65535&(c=(c^=g=(65535&(g=(g=(65535&g)*d+(((g>>>16)*d&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(x+2))<<16;case 2:g^=(255&i.charCodeAt(x+1))<<8;case 1:c^=g=(65535&(g=(g=(65535&(g^=255&i.charCodeAt(x)))*d+(((g>>>16)*d&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 Xi={exports:{}};Xi.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 sn=qt.exports,$s=Xi.exports;ci.exports=sn,ci.exports.murmur3=sn,ci.exports.murmur2=$s;class Fn{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,o,c){this.ids.push(Ja(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=Ja(e);let o=0,c=this.ids.length-1;for(;o<c;){const d=o+c>>1;this.ids[d]>=r?c=d:o=d+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 Fn;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function Ja(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:ci.exports(String(i))}function Vs(i,e,r,o){for(;r<o;){const c=i[r+o>>1];let h=r-1,d=o+1;for(;;){do h++;while(i[h]<c);do d--;while(i[d]>c);if(h>=d)break;Xr(i,h,d),Xr(e,3*h,3*d),Xr(e,3*h+1,3*d+1),Xr(e,3*h+2,3*d+2)}d-r<o-d?(Vs(i,e,r,d),r=d+1):(Vs(i,e,d+1,o),o=d)}}function Xr(i,e,r){const o=i[e];i[e]=i[r],i[r]=o}$e("FeaturePositionMap",Fn);class an{constructor(e,r){this.gl=e.gl,this.location=r}}class ln extends an{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class Xo extends an{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 ru extends an{constructor(e,r){super(e,r),this.current=F.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 Fp=new Float32Array(16);function Hl(i){return[Mt(255*i.r,255*i.g),Mt(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 ru(e,r):new ln(e,r)}}class Wo{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 Xo(e,r):new ln(e,r)}}class cn{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 d=this.paintVertexArray.length,m=this.expression.evaluate(new Gt(0),r,{},c,[],h);this.paintVertexArray.resize(e),this._setPaintValue(d,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=Hl(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 Cr{constructor(e,r,o,c,h,d){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 d}populatePaintArray(e,r,o,c,h){const d=this.expression.evaluate(new Gt(this.zoom),r,{},c,[],h),m=this.expression.evaluate(new Gt(this.zoom+1),r,{},c,[],h),g=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(g,e,d,m)}updatePaintArray(e,r,o,c){const h=this.expression.evaluate({zoom:this.zoom},o,c),d=this.expression.evaluate({zoom:this.zoom+1},o,c);this._setPaintValue(e,r,h,d)}_setPaintValue(e,r,o,c){if(this.type==="color"){const h=Hl(o),d=Hl(c);for(let m=e;m<r;m++)this.paintVertexArray.emplace(m,h[0],h[1],d[0],d[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 ln(e,r)}}class On{constructor(e,r,o,c,h,d){this.expression=e,this.type=r,this.useIntegerZoom=o,this.zoom=c,this.layerId=d,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:d,max:m}=o,g=c[h],x=c[d],T=c[m];if(g&&x&&T)for(let S=e;S<r;S++)this.zoomInPaintVertexArray.emplace(S,x.tl[0],x.tl[1],x.br[0],x.br[1],g.tl[0],g.tl[1],g.br[0],g.br[1],x.pixelRatio,g.pixelRatio),this.zoomOutPaintVertexArray.emplace(S,x.tl[0],x.tl[1],x.br[0],x.br[1],T.tl[0],T.tl[1],T.br[0],T.br[1],x.pixelRatio,T.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,li.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,li.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class nu{constructor(e,r,o){this.binders={},this._buffers=[];const c=[];for(const h in e.paint._values){if(!o(h))continue;const d=e.paint.get(h);if(!(d instanceof ur&&Ot(d.property.specification)))continue;const m=Op(h,e.type),g=d.value,x=d.property.specification.type,T=d.property.useIntegerZoom,S=d.property.specification["property-type"],P=S==="cross-faded"||S==="cross-faded-data-driven";if(g.kind==="constant")this.binders[h]=P?new Wo(g.value,m):new Ns(g.value,m,x),c.push(`/u_${h}`);else if(g.kind==="source"||P){const D=ou(h,x,"source");this.binders[h]=P?new On(g,x,T,r,D,e.id):new cn(g,m,x,D),c.push(`/a_${h}`)}else{const D=ou(h,x,"composite");this.binders[h]=new Cr(g,m,x,T,r,D),c.push(`/z_${h}`)}}this.cacheKey=c.sort().join("")}getMaxValue(e){const r=this.binders[e];return r instanceof cn||r instanceof Cr?r.maxValue:0}populatePaintArrays(e,r,o,c,h){for(const d in this.binders){const m=this.binders[d];(m instanceof cn||m instanceof Cr||m instanceof On)&&m.populatePaintArray(e,r,o,c,h)}}setConstantPatternPositions(e,r){for(const o in this.binders){const c=this.binders[o];c instanceof Wo&&c.setConstantPatternPositions(e,r)}}updatePaintArrays(e,r,o,c,h){let d=!1;for(const m in e){const g=r.getPositions(m);for(const x of g){const T=o.feature(x.index);for(const S in this.binders){const P=this.binders[S];if((P instanceof cn||P instanceof Cr||P instanceof On)&&P.expression.isStateDependent===!0){const D=c.paint.get(S);P.expression=D.value,P.updatePaintArray(x.start,x.end,T,e[m],h),d=!0}}}}return d}defines(){const e=[];for(const r in this.binders){const o=this.binders[r];(o instanceof Ns||o instanceof Wo)&&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 cn||o instanceof Cr)for(let c=0;c<o.paintVertexAttributes.length;c++)e.push(o.paintVertexAttributes[c].name);else if(o instanceof On)for(let c=0;c<li.members.length;c++)e.push(li.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 Wo||o instanceof Cr)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 Wo||h instanceof Cr){for(const d of h.uniformNames)if(r[d]){const m=h.getBinding(e,r[d],d);o.push({name:d,property:c,binding:m})}}}return o}setUniforms(e,r,o,c){for(const{name:h,property:d,binding:m}of r)this.binders[d].setUniform(m,c,o.get(d),h)}updatePaintBuffers(e){this._buffers=[];for(const r in this.binders){const o=this.binders[r];if(e&&o instanceof On){const c=e.fromScale===2?o.zoomInPaintVertexBuffer:o.zoomOutPaintVertexBuffer;c&&this._buffers.push(c)}else(o instanceof cn||o instanceof Cr)&&o.paintVertexBuffer&&this._buffers.push(o.paintVertexBuffer)}}upload(e){for(const r in this.binders){const o=this.binders[r];(o instanceof cn||o instanceof Cr||o instanceof On)&&o.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const r=this.binders[e];(r instanceof cn||r instanceof Cr||r instanceof On)&&r.destroy()}}}class xo{constructor(e,r,o=()=>!0){this.programConfigurations={};for(const c of e)this.programConfigurations[c.id]=new nu(c,r,o);this.needsUpload=!1,this._featureMap=new Fn,this._bufferOffset=0}populatePaintArrays(e,r,o,c,h,d){for(const m in this.programConfigurations)this.programConfigurations[m].populatePaintArrays(e,r,c,h,d);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 Op(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 ou(i,e,r){const o={color:{source:s,composite:le},number:{source:$,composite:s}},c=function(h){return{"line-pattern":{source:ai,composite:ai},"fill-pattern":{source:ai,composite:ai},"fill-extrusion-pattern":{source:ai,composite:ai}}[h]}(i);return c&&c[r]||o[e][r]}$e("ConstantBinder",Ns),$e("CrossFadedConstantBinder",Wo),$e("SourceExpressionBinder",cn),$e("CrossFadedCompositeBinder",On),$e("CompositeExpressionBinder",Cr),$e("ProgramConfiguration",nu,{omit:["_buffers"]}),$e("ProgramConfigurationSet",xo);var ri=8192;const Kl=Math.pow(2,14)-1,su=-Kl-1;function vo(i){const e=ri/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 d=c[h],m=Math.round(d.x*e),g=Math.round(d.y*e);d.x=ee(m,su,Kl),d.y=ee(g,su,Kl),(m<d.x||m>d.x+1||g<d.y||g>d.y+1)&&ot("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function bo(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?vo(i):[]}}function Ya(i,e,r,o,c){i.emplaceBack(2*e+(o+1)/2,2*r+(c+1)/2)}class Jl{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 Pt,this.indexArray=new Ai,this.segments=new mt,this.programConfigurations=new xo(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 d=null,m=!1;c.type==="circle"&&(d=c.layout.get("circle-sort-key"),m=!d.isConstant());for(const{feature:g,id:x,index:T,sourceLayerIndex:S}of e){const P=this.layers[0]._featureFilter.needGeometry,D=bo(g,P);if(!this.layers[0]._featureFilter.filter(new Gt(this.zoom),D,o))continue;const L=m?d.evaluate(D,{},o):void 0,Z={id:x,properties:g.properties,type:g.type,sourceLayerIndex:S,index:T,geometry:P?D.geometry:vo(g),patterns:{},sortKey:L};h.push(Z)}m&&h.sort((g,x)=>g.sortKey-x.sortKey);for(const g of h){const{geometry:x,index:T,sourceLayerIndex:S}=g,P=e[T].feature;this.addFeature(g,x,T,o),r.featureIndex.insert(P,x,T,S,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,ii),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 d of h){const m=d.x,g=d.y;if(m<0||m>=ri||g<0||g>=ri)continue;const x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),T=x.vertexLength;Ya(this.layoutVertexArray,m,g,-1,-1),Ya(this.layoutVertexArray,m,g,1,-1),Ya(this.layoutVertexArray,m,g,1,1),Ya(this.layoutVertexArray,m,g,-1,1),this.indexArray.emplaceBack(T,T+1,T+2),this.indexArray.emplaceBack(T,T+3,T+2),x.vertexLength+=4,x.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,{},c)}}function au(i,e){for(let r=0;r<i.length;r++)if(Ho(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(Ho(i,e[r]))return!0;return!!Yl(i,e)}function Up(i,e,r){return!!Ho(i,e)||!!Ql(e,i,r)}function lu(i,e){if(i.length===1)return uu(e,i[0]);for(let r=0;r<e.length;r++){const o=e[r];for(let c=0;c<o.length;c++)if(Ho(i,o[c]))return!0}for(let r=0;r<i.length;r++)if(uu(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(Yl(i,e[r]))return!0;return!1}function $p(i,e,r){if(i.length>1){if(Yl(i,e))return!0;for(let o=0;o<e.length;o++)if(Ql(e[o],i,r))return!0}for(let o=0;o<i.length;o++)if(Ql(i[o],e,r))return!0;return!1}function Yl(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(Vp(o,c,e[h],e[h+1]))return!0}return!1}function Vp(i,e,r,o){return gt(i,r,o)!==gt(e,r,o)&>(i,e,r)!==gt(i,e,o)}function Ql(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(cu(i,e[c-1],e[c])<o)return!0;return!1}function cu(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 uu(i,e){let r,o,c,h=!1;for(let d=0;d<i.length;d++){r=i[d];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 Ho(i,e){let r=!1;for(let o=0,c=i.length-1;o<i.length;c=o++){const h=i[o],d=i[c];h.y>e.y!=d.y>e.y&&e.x<(d.x-h.x)*(e.y-h.y)/(d.y-h.y)+h.x&&(r=!r)}return r}function Np(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=gt(i,e,r[0]);return h!==gt(i,e,r[1])||h!==gt(i,e,r[2])||h!==gt(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 Qa(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function el(i,e,r,o,c){if(!e[0]&&!e[1])return i;const h=tt.convert(e)._mult(c);r==="viewport"&&h._rotate(-o);const d=[];for(let m=0;m<i.length;m++)d.push(i[m].sub(h));return d}$e("CircleBucket",Jl,{omit:["layers"]});const Gp=new mi({"circle-sort-key":new Ye(_e.layout_circle["circle-sort-key"])});var qp={paint:new mi({"circle-radius":new Ye(_e.paint_circle["circle-radius"]),"circle-color":new Ye(_e.paint_circle["circle-color"]),"circle-blur":new Ye(_e.paint_circle["circle-blur"]),"circle-opacity":new Ye(_e.paint_circle["circle-opacity"]),"circle-translate":new Ze(_e.paint_circle["circle-translate"]),"circle-translate-anchor":new Ze(_e.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ze(_e.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ze(_e.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Ye(_e.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Ye(_e.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Ye(_e.paint_circle["circle-stroke-opacity"])}),layout:Gp},Mi=1e-6,Pi=typeof Float32Array!="undefined"?Float32Array:Array;function hu(){var i=new Pi(9);return Pi!=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 ec(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 pu(i,e,r){var o=e[0],c=e[1],h=e[2],d=e[3],m=e[4],g=e[5],x=e[6],T=e[7],S=e[8],P=e[9],D=e[10],L=e[11],Z=e[12],q=e[13],re=e[14],ce=e[15],te=r[0],ae=r[1],xe=r[2],ye=r[3];return i[0]=te*o+ae*m+xe*S+ye*Z,i[1]=te*c+ae*g+xe*P+ye*q,i[2]=te*h+ae*x+xe*D+ye*re,i[3]=te*d+ae*T+xe*L+ye*ce,i[4]=(te=r[4])*o+(ae=r[5])*m+(xe=r[6])*S+(ye=r[7])*Z,i[5]=te*c+ae*g+xe*P+ye*q,i[6]=te*h+ae*x+xe*D+ye*re,i[7]=te*d+ae*T+xe*L+ye*ce,i[8]=(te=r[8])*o+(ae=r[9])*m+(xe=r[10])*S+(ye=r[11])*Z,i[9]=te*c+ae*g+xe*P+ye*q,i[10]=te*h+ae*x+xe*D+ye*re,i[11]=te*d+ae*T+xe*L+ye*ce,i[12]=(te=r[12])*o+(ae=r[13])*m+(xe=r[14])*S+(ye=r[15])*Z,i[13]=te*c+ae*g+xe*P+ye*q,i[14]=te*h+ae*x+xe*D+ye*re,i[15]=te*d+ae*T+xe*L+ye*ce,i}Math.hypot||(Math.hypot=function(){for(var i=0,e=arguments.length;e--;)i+=arguments[e]*arguments[e];return Math.sqrt(i)});var qs,Zp=pu;function du(){var i=new Pi(3);return Pi!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i}function fu(i,e,r){var o=new Pi(3);return o[0]=i,o[1]=e,o[2]=r,o}function tl(i,e,r){var o=e[0],c=e[1],h=e[2],d=e[3];return i[0]=r[0]*o+r[4]*c+r[8]*h+r[12]*d,i[1]=r[1]*o+r[5]*c+r[9]*h+r[13]*d,i[2]=r[2]*o+r[6]*c+r[10]*h+r[14]*d,i[3]=r[3]*o+r[7]*c+r[11]*h+r[15]*d,i}function mu(){var i=new Pi(4);return Pi!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i[3]=1,i}function gu(i,e){const r=tl([],[i.x,i.y,0,1],e);return new tt(r[0]/r[3],r[1]/r[3])}du(),qs=new Pi(4),Pi!=Float32Array&&(qs[0]=0,qs[1]=0,qs[2]=0,qs[3]=0),du(),fu(1,0,0),fu(0,1,0),mu(),mu(),hu(),function(){var i;i=new Pi(2),Pi!=Float32Array&&(i[0]=0,i[1]=0)}();class _u extends Jl{}$e("HeatmapBucket",_u,{omit:["layers"]});var jp={paint:new mi({"heatmap-radius":new Ye(_e.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Ye(_e.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ze(_e.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Gr(_e.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ze(_e.paint_heatmap["heatmap-opacity"])})};function tc(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 yu(i,{width:e,height:r},o){if(e===i.width&&r===i.height)return;const c=tc({},{width:e,height:r},o);ic(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 ic(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 d=i.data,m=e.data;if(d===m)throw new Error("srcData equals dstData, so image is already copied");for(let g=0;g<c.height;g++){const x=((r.y+g)*i.width+r.x)*h,T=((o.y+g)*e.width+o.x)*h;for(let S=0;S<c.width*h;S++)m[T+S]=d[x+S]}return e}class Zs{constructor(e,r){tc(this,e,1,r)}resize(e){yu(this,e,1)}clone(){return new Zs({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,o,c,h){ic(e,r,o,c,h,1)}}class ir{constructor(e,r){tc(this,e,4,r)}resize(e){yu(this,e,4)}replace(e,r){r?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new ir({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,o,c,h){ic(e,r,o,c,h,4)}}function xu(i){const e={},r=i.resolution||256,o=i.clips?i.clips.length:1,c=i.image||new ir({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=(d,m,g)=>{e[i.evaluationKey]=g;const x=i.expression.evaluate(e);c.data[d+m+0]=Math.floor(255*x.r/x.a),c.data[d+m+1]=Math.floor(255*x.g/x.a),c.data[d+m+2]=Math.floor(255*x.b/x.a),c.data[d+m+3]=Math.floor(255*x.a)};if(i.clips)for(let d=0,m=0;d<o;++d,m+=4*r)for(let g=0,x=0;g<r;g++,x+=4){const T=g/(r-1),{start:S,end:P}=i.clips[d];h(m,x,S*(1-T)+P*T)}else for(let d=0,m=0;d<r;d++,m+=4)h(0,m,d/(r-1));return c}$e("AlphaImage",Zs),$e("RGBAImage",ir);var Xp={paint:new mi({"hillshade-illumination-direction":new Ze(_e.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Ze(_e.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ze(_e.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ze(_e.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ze(_e.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ze(_e.paint_hillshade["hillshade-accent-color"])})};const Wp=Qt([{name:"a_pos",components:2,type:"Int16"}],4),{members:Hp}=Wp;var il={exports:{}};function rl(i,e,r){r=r||2;var o,c,h,d,m,g,x,T=e&&e.length,S=T?e[0]*r:i.length,P=vu(i,0,S,r,!0),D=[];if(!P||P.next===P.prev)return D;if(T&&(P=function(Z,q,re,ce){var te,ae,xe,ye=[];for(te=0,ae=q.length;te<ae;te++)(xe=vu(Z,q[te]*ce,te<ae-1?q[te+1]*ce:Z.length,ce,!1))===xe.next&&(xe.steiner=!0),ye.push(rd(xe));for(ye.sort(ed),te=0;te<ye.length;te++)re=td(ye[te],re);return re}(i,e,P,r)),i.length>80*r){o=h=i[0],c=d=i[1];for(var L=r;L<S;L+=r)(m=i[L])<o&&(o=m),(g=i[L+1])<c&&(c=g),m>h&&(h=m),g>d&&(d=g);x=(x=Math.max(h-o,d-c))!==0?32767/x:0}return js(P,D,r,o,c,x,0),D}function vu(i,e,r,o,c){var h,d;if(c===oc(i,e,r,o)>0)for(h=e;h<r;h+=o)d=Tu(h,i[h],i[h+1],d);else for(h=r-o;h>=e;h-=o)d=Tu(h,i[h],i[h+1],d);return d&&nl(d,d.next)&&(Ws(d),d=d.next),d}function wo(i,e){if(!i)return i;e||(e=i);var r,o=i;do if(r=!1,o.steiner||!nl(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,d){if(i){!d&&h&&function(T,S,P,D){var L=T;do L.z===0&&(L.z=rc(L.x,L.y,S,P,D)),L.prevZ=L.prev,L.nextZ=L.next,L=L.next;while(L!==T);L.prevZ.nextZ=null,L.prevZ=null,function(Z){var q,re,ce,te,ae,xe,ye,Ue,Ge=1;do{for(re=Z,Z=null,ae=null,xe=0;re;){for(xe++,ce=re,ye=0,q=0;q<Ge&&(ye++,ce=ce.nextZ);q++);for(Ue=Ge;ye>0||Ue>0&&ce;)ye!==0&&(Ue===0||!ce||re.z<=ce.z)?(te=re,re=re.nextZ,ye--):(te=ce,ce=ce.nextZ,Ue--),ae?ae.nextZ=te:Z=te,te.prevZ=ae,ae=te;re=ce}ae.nextZ=null,Ge*=2}while(xe>1)}(L)}(i,o,c,h);for(var m,g,x=i;i.prev!==i.next;)if(m=i.prev,g=i.next,h?Jp(i,o,c,h):Kp(i))e.push(m.i/r|0),e.push(i.i/r|0),e.push(g.i/r|0),Ws(i),i=g.next,x=g.next;else if((i=g)===x){d?d===1?js(i=Yp(wo(i),e,r),e,r,o,c,h,2):d===2&&Qp(i,e,r,o,c,h):js(wo(i),e,r,o,c,h,1);break}}}function Kp(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,d=o.x,m=e.y,g=r.y,x=o.y,T=c<h?c<d?c:d:h<d?h:d,S=m<g?m<x?m:x:g<x?g:x,P=c>h?c>d?c:d:h>d?h:d,D=m>g?m>x?m:x:g>x?g:x,L=o.next;L!==e;){if(L.x>=T&&L.x<=P&&L.y>=S&&L.y<=D&&Ko(c,m,h,g,d,x,L.x,L.y)&&Jt(L.prev,L,L.next)>=0)return!1;L=L.next}return!0}function Jp(i,e,r,o){var c=i.prev,h=i,d=i.next;if(Jt(c,h,d)>=0)return!1;for(var m=c.x,g=h.x,x=d.x,T=c.y,S=h.y,P=d.y,D=m<g?m<x?m:x:g<x?g:x,L=T<S?T<P?T:P:S<P?S:P,Z=m>g?m>x?m:x:g>x?g:x,q=T>S?T>P?T:P:S>P?S:P,re=rc(D,L,e,r,o),ce=rc(Z,q,e,r,o),te=i.prevZ,ae=i.nextZ;te&&te.z>=re&&ae&&ae.z<=ce;){if(te.x>=D&&te.x<=Z&&te.y>=L&&te.y<=q&&te!==c&&te!==d&&Ko(m,T,g,S,x,P,te.x,te.y)&&Jt(te.prev,te,te.next)>=0||(te=te.prevZ,ae.x>=D&&ae.x<=Z&&ae.y>=L&&ae.y<=q&&ae!==c&&ae!==d&&Ko(m,T,g,S,x,P,ae.x,ae.y)&&Jt(ae.prev,ae,ae.next)>=0))return!1;ae=ae.nextZ}for(;te&&te.z>=re;){if(te.x>=D&&te.x<=Z&&te.y>=L&&te.y<=q&&te!==c&&te!==d&&Ko(m,T,g,S,x,P,te.x,te.y)&&Jt(te.prev,te,te.next)>=0)return!1;te=te.prevZ}for(;ae&&ae.z<=ce;){if(ae.x>=D&&ae.x<=Z&&ae.y>=L&&ae.y<=q&&ae!==c&&ae!==d&&Ko(m,T,g,S,x,P,ae.x,ae.y)&&Jt(ae.prev,ae,ae.next)>=0)return!1;ae=ae.nextZ}return!0}function Yp(i,e,r){var o=i;do{var c=o.prev,h=o.next.next;!nl(c,h)&&bu(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 wo(o)}function Qp(i,e,r,o,c,h){var d=i;do{for(var m=d.next.next;m!==d.prev;){if(d.i!==m.i&&nd(d,m)){var g=wu(d,m);return d=wo(d,d.next),g=wo(g,g.next),js(d,e,r,o,c,h,0),void js(g,e,r,o,c,h,0)}m=m.next}d=d.next}while(d!==i)}function ed(i,e){return i.x-e.x}function td(i,e){var r=function(c,h){var d,m=h,g=c.x,x=c.y,T=-1/0;do{if(x<=m.y&&x>=m.next.y&&m.next.y!==m.y){var S=m.x+(x-m.y)*(m.next.x-m.x)/(m.next.y-m.y);if(S<=g&&S>T&&(T=S,d=m.x<m.next.x?m:m.next,S===g))return d}m=m.next}while(m!==h);if(!d)return null;var P,D=d,L=d.x,Z=d.y,q=1/0;m=d;do g>=m.x&&m.x>=L&&g!==m.x&&Ko(x<Z?g:T,x,L,Z,x<Z?T:g,x,m.x,m.y)&&(P=Math.abs(x-m.y)/(g-m.x),Xs(m,c)&&(P<q||P===q&&(m.x>d.x||m.x===d.x&&id(d,m)))&&(d=m,q=P)),m=m.next;while(m!==D);return d}(i,e);if(!r)return e;var o=wu(r,i);return wo(o,o.next),wo(r,r.next)}function id(i,e){return Jt(i.prev,i,e.prev)<0&&Jt(e.next,i,i.next)<0}function rc(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 rd(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 Ko(i,e,r,o,c,h,d,m){return(c-d)*(e-m)>=(i-d)*(h-m)&&(i-d)*(o-m)>=(r-d)*(e-m)&&(r-d)*(h-m)>=(c-d)*(o-m)}function nd(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&&bu(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,d=(r.x+o.x)/2,m=(r.y+o.y)/2;do c.y>m!=c.next.y>m&&c.next.y!==c.y&&d<(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))||nl(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 nl(i,e){return i.x===e.x&&i.y===e.y}function bu(i,e,r,o){var c=sl(Jt(i,e,r)),h=sl(Jt(i,e,o)),d=sl(Jt(r,o,i)),m=sl(Jt(r,o,e));return c!==h&&d!==m||!(c!==0||!ol(i,r,e))||!(h!==0||!ol(i,o,e))||!(d!==0||!ol(r,i,o))||!(m!==0||!ol(r,e,o))}function ol(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 sl(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 wu(i,e){var r=new nc(i.i,i.x,i.y),o=new nc(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 Tu(i,e,r,o){var c=new nc(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 nc(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 oc(i,e,r,o){for(var c=0,h=e,d=r-o;h<r;h+=o)c+=(i[d]-i[h])*(i[h+1]+i[d+1]),d=h;return c}function od(i,e,r,o,c){Eu(i,e,r||0,o||i.length-1,c||sd)}function Eu(i,e,r,o,c){for(;o>r;){if(o-r>600){var h=o-r+1,d=e-r+1,m=Math.log(h),g=.5*Math.exp(2*m/3),x=.5*Math.sqrt(m*g*(h-g)/h)*(d-h/2<0?-1:1);Eu(i,e,Math.max(r,Math.floor(e-d*g/h+x)),Math.min(o,Math.floor(e+(h-d)*g/h+x)),c)}var T=i[e],S=r,P=o;for(Hs(i,r,e),c(i[o],T)>0&&Hs(i,r,o);S<P;){for(Hs(i,S,P),S++,P--;c(i[S],T)<0;)S++;for(;c(i[P],T)>0;)P--}c(i[r],T)===0?Hs(i,r,P):Hs(i,++P,o),P<=e&&(r=P+1),e<=P&&(o=P-1)}}function Hs(i,e,r){var o=i[e];i[e]=i[r],i[r]=o}function sd(i,e){return i<e?-1:i>e?1:0}function sc(i,e){const r=i.length;if(r<=1)return[i];const o=[];let c,h;for(let d=0;d<r;d++){const m=ft(i[d]);m!==0&&(i[d].area=Math.abs(m),h===void 0&&(h=m<0),h===m<0?(c&&o.push(c),c=[i[d]]):c.push(i[d]))}if(c&&o.push(c),e>1)for(let d=0;d<o.length;d++)o[d].length<=e||(od(o[d],e,1,o[d].length-1,ad),o[d]=o[d].slice(0,e));return o}function ad(i,e){return e.area-i.area}function ac(i,e,r){const o=r.patternDependencies;let c=!1;for(const h of e){const d=h.paint.get(`${i}-pattern`);d.isConstant()||(c=!0);const m=d.constantOr(null);m&&(c=!0,o[m.to]=!0,o[m.from]=!0)}return c}function lc(i,e,r,o,c){const h=c.patternDependencies;for(const d of e){const m=d.paint.get(`${i}-pattern`).value;if(m.kind!=="constant"){let g=m.evaluate({zoom:o-1},r,{},c.availableImages),x=m.evaluate({zoom:o},r,{},c.availableImages),T=m.evaluate({zoom:o+1},r,{},c.availableImages);g=g&&g.name?g.name:g,x=x&&x.name?x.name:x,T=T&&T.name?T.name:T,h[g]=!0,h[x]=!0,h[T]=!0,r.patterns[d.id]={min:g,mid:x,max:T}}}return r}il.exports=rl,il.exports.default=rl,rl.deviation=function(i,e,r,o){var c=e&&e.length,h=Math.abs(oc(i,0,c?e[0]*r:i.length,r));if(c)for(var d=0,m=e.length;d<m;d++)h-=Math.abs(oc(i,e[d]*r,d<m-1?e[d+1]*r:i.length,r));var g=0;for(d=0;d<o.length;d+=3){var x=o[d]*r,T=o[d+1]*r,S=o[d+2]*r;g+=Math.abs((i[x]-i[S])*(i[T+1]-i[x+1])-(i[x]-i[T])*(i[S+1]-i[x+1]))}return h===0&&g===0?0:Math.abs((g-h)/h)},rl.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 d=0;d<e;d++)r.vertices.push(i[c][h][d]);c>0&&r.holes.push(o+=i[c-1].length)}return r};class cc{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 zt,this.indexArray=new Ai,this.indexArray2=new Ir,this.programConfigurations=new xo(e.layers,e.zoom),this.segments=new mt,this.segments2=new mt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){this.hasPattern=ac("fill",this.layers,r);const c=this.layers[0].layout.get("fill-sort-key"),h=!c.isConstant(),d=[];for(const{feature:m,id:g,index:x,sourceLayerIndex:T}of e){const S=this.layers[0]._featureFilter.needGeometry,P=bo(m,S);if(!this.layers[0]._featureFilter.filter(new Gt(this.zoom),P,o))continue;const D=h?c.evaluate(P,{},o,r.availableImages):void 0,L={id:g,properties:m.properties,type:m.type,sourceLayerIndex:T,index:x,geometry:S?P.geometry:vo(m),patterns:{},sortKey:D};d.push(L)}h&&d.sort((m,g)=>m.sortKey-g.sortKey);for(const m of d){const{geometry:g,index:x,sourceLayerIndex:T}=m;if(this.hasPattern){const S=lc("fill",this.layers,m,this.zoom,r);this.patternFeatures.push(S)}else this.addFeature(m,g,x,o,{});r.featureIndex.insert(e[x].feature,g,x,T,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,Hp),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 d of sc(r,500)){let m=0;for(const D of d)m+=D.length;const g=this.segments.prepareSegment(m,this.layoutVertexArray,this.indexArray),x=g.vertexLength,T=[],S=[];for(const D of d){if(D.length===0)continue;D!==d[0]&&S.push(T.length/2);const L=this.segments2.prepareSegment(D.length,this.layoutVertexArray,this.indexArray2),Z=L.vertexLength;this.layoutVertexArray.emplaceBack(D[0].x,D[0].y),this.indexArray2.emplaceBack(Z+D.length-1,Z),T.push(D[0].x),T.push(D[0].y);for(let q=1;q<D.length;q++)this.layoutVertexArray.emplaceBack(D[q].x,D[q].y),this.indexArray2.emplaceBack(Z+q-1,Z+q),T.push(D[q].x),T.push(D[q].y);L.vertexLength+=D.length,L.primitiveLength+=D.length}const P=il.exports(T,S);for(let D=0;D<P.length;D+=3)this.indexArray.emplaceBack(x+P[D],x+P[D+1],x+P[D+2]);g.vertexLength+=m,g.primitiveLength+=P.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,h,c)}}$e("FillBucket",cc,{omit:["layers","patternFeatures"]});const ld=new mi({"fill-sort-key":new Ye(_e.layout_fill["fill-sort-key"])});var cd={paint:new mi({"fill-antialias":new Ze(_e.paint_fill["fill-antialias"]),"fill-opacity":new Ye(_e.paint_fill["fill-opacity"]),"fill-color":new Ye(_e.paint_fill["fill-color"]),"fill-outline-color":new Ye(_e.paint_fill["fill-outline-color"]),"fill-translate":new Ze(_e.paint_fill["fill-translate"]),"fill-translate-anchor":new Ze(_e.paint_fill["fill-translate-anchor"]),"fill-pattern":new Bn(_e.paint_fill["fill-pattern"])}),layout:ld};const ud=Qt([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),hd=Qt([{name:"a_centroid",components:2,type:"Int16"}],4),{members:pd}=ud;var Un={},dd=tt,Su=Jo;function Jo(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(fd,this,e)}function fd(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 d=c._keys[o.readVarint()],m=c._values[o.readVarint()];c.properties[d]=m}}(r,e):i==3?e.type=r.readVarint():i==4&&(e._geometry=r.pos)}function md(i){for(var e,r,o=0,c=0,h=i.length,d=h-1;c<h;d=c++)o+=((r=i[d]).x-(e=i[c]).x)*(e.y+r.y);return o}Jo.types=["Unknown","Point","LineString","Polygon"],Jo.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,d=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(),d+=i.readSVarint(),o===1&&(e&&m.push(e),e=[]),e.push(new dd(h,d));else{if(o!==7)throw new Error("unknown command "+o);e&&e.push(e[0].clone())}}return e&&m.push(e),m},Jo.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,d=1/0,m=-1/0,g=1/0,x=-1/0;i.pos<e;){if(o<=0){var T=i.readVarint();r=7&T,o=T>>3}if(o--,r===1||r===2)(c+=i.readSVarint())<d&&(d=c),c>m&&(m=c),(h+=i.readSVarint())<g&&(g=h),h>x&&(x=h);else if(r!==7)throw new Error("unknown command "+r)}return[d,g,m,x]},Jo.prototype.toGeoJSON=function(i,e,r){var o,c,h=this.extent*Math.pow(2,r),d=this.extent*i,m=this.extent*e,g=this.loadGeometry(),x=Jo.types[this.type];function T(D){for(var L=0;L<D.length;L++){var Z=D[L];D[L]=[360*(Z.x+d)/h-180,360/Math.PI*Math.atan(Math.exp((180-360*(Z.y+m)/h)*Math.PI/180))-90]}}switch(this.type){case 1:var S=[];for(o=0;o<g.length;o++)S[o]=g[o][0];T(g=S);break;case 2:for(o=0;o<g.length;o++)T(g[o]);break;case 3:for(g=function(D){var L=D.length;if(L<=1)return[D];for(var Z,q,re=[],ce=0;ce<L;ce++){var te=md(D[ce]);te!==0&&(q===void 0&&(q=te<0),q===te<0?(Z&&re.push(Z),Z=[D[ce]]):Z.push(D[ce]))}return Z&&re.push(Z),re}(g),o=0;o<g.length;o++)for(c=0;c<g[o].length;c++)T(g[o][c])}g.length===1?g=g[0]:x="Multi"+x;var P={type:"Feature",geometry:{type:x,coordinates:g},properties:this.properties};return"id"in this&&(P.id=this.id),P};var gd=Su,Iu=Cu;function Cu(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(_d,this,e),this.length=this._features.length}function _d(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 d=o.readVarint()>>3;c=d===1?o.readString():d===2?o.readFloat():d===3?o.readDouble():d===4?o.readVarint64():d===5?o.readVarint():d===6?o.readSVarint():d===7?o.readBoolean():null}return c}(r))}Cu.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 gd(this._pbf,e,this.extent,this._keys,this._values)};var yd=Iu;function xd(i,e,r){if(i===3){var o=new yd(r,r.readVarint()+r.pos);o.length&&(e[o.name]=o)}}Un.VectorTile=function(i,e){this.layers=i.readFields(xd,{},e)},Un.VectorTileFeature=Su,Un.VectorTileLayer=Iu;const vd=Un.VectorTileFeature.types,uc=Math.pow(2,13);function Ks(i,e,r,o,c,h,d,m){i.emplaceBack(e,r,2*Math.floor(o*uc)+d,c*uc*2,h*uc*2,Math.round(m))}class hc{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 Ai,this.programConfigurations=new xo(e.layers,e.zoom),this.segments=new mt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){this.features=[],this.hasPattern=ac("fill-extrusion",this.layers,r);for(const{feature:c,id:h,index:d,sourceLayerIndex:m}of e){const g=this.layers[0]._featureFilter.needGeometry,x=bo(c,g);if(!this.layers[0]._featureFilter.filter(new Gt(this.zoom),x,o))continue;const T={id:h,sourceLayerIndex:m,index:d,geometry:g?x.geometry:vo(c),properties:c.properties,type:c.type,patterns:{}};this.hasPattern?this.features.push(lc("fill-extrusion",this.layers,T,this.zoom,r)):this.addFeature(T,T.geometry,d,o,{}),r.featureIndex.insert(c,T.geometry,d,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,pd),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,hd.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 d={x:0,y:0,vertexCount:0};for(const m of sc(r,500)){let g=0;for(const L of m)g+=L.length;let x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const L of m){if(L.length===0||wd(L))continue;let Z=0;for(let q=0;q<L.length;q++){const re=L[q];if(q>=1){const ce=L[q-1];if(!bd(re,ce)){x.vertexLength+4>mt.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const te=re.sub(ce)._perp()._unit(),ae=ce.dist(re);Z+ae>32768&&(Z=0),Ks(this.layoutVertexArray,re.x,re.y,te.x,te.y,0,0,Z),Ks(this.layoutVertexArray,re.x,re.y,te.x,te.y,0,1,Z),d.x+=2*re.x,d.y+=2*re.y,d.vertexCount+=2,Z+=ae,Ks(this.layoutVertexArray,ce.x,ce.y,te.x,te.y,0,0,Z),Ks(this.layoutVertexArray,ce.x,ce.y,te.x,te.y,0,1,Z),d.x+=2*ce.x,d.y+=2*ce.y,d.vertexCount+=2;const xe=x.vertexLength;this.indexArray.emplaceBack(xe,xe+2,xe+1),this.indexArray.emplaceBack(xe+1,xe+2,xe+3),x.vertexLength+=4,x.primitiveLength+=2}}}}if(x.vertexLength+g>mt.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(g,this.layoutVertexArray,this.indexArray)),vd[e.type]!=="Polygon")continue;const T=[],S=[],P=x.vertexLength;for(const L of m)if(L.length!==0){L!==m[0]&&S.push(T.length/2);for(let Z=0;Z<L.length;Z++){const q=L[Z];Ks(this.layoutVertexArray,q.x,q.y,0,0,1,1,0),d.x+=q.x,d.y+=q.y,d.vertexCount+=1,T.push(q.x),T.push(q.y)}}const D=il.exports(T,S);for(let L=0;L<D.length;L+=3)this.indexArray.emplaceBack(P+D[L],P+D[L+2],P+D[L+1]);x.primitiveLength+=D.length/3,x.vertexLength+=g}for(let m=0;m<d.vertexCount;m++)this.centroidVertexArray.emplaceBack(Math.floor(d.x/d.vertexCount),Math.floor(d.y/d.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,h,c)}}function bd(i,e){return i.x===e.x&&(i.x<0||i.x>ri)||i.y===e.y&&(i.y<0||i.y>ri)}function wd(i){return i.every(e=>e.x<0)||i.every(e=>e.x>ri)||i.every(e=>e.y<0)||i.every(e=>e.y>ri)}$e("FillExtrusionBucket",hc,{omit:["layers","features"]});var Td={paint:new mi({"fill-extrusion-opacity":new Ze(_e["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Ye(_e["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ze(_e["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ze(_e["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Bn(_e["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Ye(_e["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Ye(_e["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ze(_e["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function Js(i,e){return i.x*e.x+i.y*e.y}function Au(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],d=i[0],m=c.sub(o),g=h.sub(o),x=d.sub(o),T=Js(m,m),S=Js(m,g),P=Js(g,g),D=Js(x,m),L=Js(x,g),Z=T*P-S*S,q=(P*D-S*L)/Z,re=(T*L-S*D)/Z,ce=o.z*(1-q-re)+c.z*q+h.z*re;if(isFinite(ce))return ce}return 1/0}{let r=1/0;for(const o of e)r=Math.min(r,o.z);return r}}const Ed=Qt([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Sd}=Ed,Id=Qt([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Cd}=Id,Ad=Un.VectorTileFeature.types,Md=Math.cos(Math.PI/180*37.5),Mu=Math.pow(2,14)/.5;class pc{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 St,this.layoutVertexArray2=new Dt,this.indexArray=new Ai,this.programConfigurations=new xo(e.layers,e.zoom),this.segments=new mt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){this.hasPattern=ac("line",this.layers,r);const c=this.layers[0].layout.get("line-sort-key"),h=!c.isConstant(),d=[];for(const{feature:m,id:g,index:x,sourceLayerIndex:T}of e){const S=this.layers[0]._featureFilter.needGeometry,P=bo(m,S);if(!this.layers[0]._featureFilter.filter(new Gt(this.zoom),P,o))continue;const D=h?c.evaluate(P,{},o):void 0,L={id:g,properties:m.properties,type:m.type,sourceLayerIndex:T,index:x,geometry:S?P.geometry:vo(m),patterns:{},sortKey:D};d.push(L)}h&&d.sort((m,g)=>m.sortKey-g.sortKey);for(const m of d){const{geometry:g,index:x,sourceLayerIndex:T}=m;if(this.hasPattern){const S=lc("line",this.layers,m,this.zoom,r);this.patternFeatures.push(S)}else this.addFeature(m,g,x,o,{});r.featureIndex.insert(e[x].feature,g,x,T,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,Cd)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Sd),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 d=this.layers[0].layout,m=d.get("line-join").evaluate(e,{}),g=d.get("line-cap"),x=d.get("line-miter-limit"),T=d.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const S of r)this.addLine(S,e,m,g,x,T);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,h,c)}addLine(e,r,o,c,h,d){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let re=0;re<e.length-1;re++)this.totalDistance+=e[re].dist(e[re+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const m=Ad[r.type]==="Polygon";let g=e.length;for(;g>=2&&e[g-1].equals(e[g-2]);)g--;let x=0;for(;x<g-1&&e[x].equals(e[x+1]);)x++;if(g<(m?3:2))return;o==="bevel"&&(h=1.05);const T=this.overscaling<=16?122880/(512*this.overscaling):0,S=this.segments.prepareSegment(10*g,this.layoutVertexArray,this.indexArray);let P,D,L,Z,q;this.e1=this.e2=-1,m&&(P=e[g-2],q=e[x].sub(P)._unit()._perp());for(let re=x;re<g;re++){if(L=re===g-1?m?e[x+1]:void 0:e[re+1],L&&e[re].equals(L))continue;q&&(Z=q),P&&(D=P),P=e[re],q=L?L.sub(P)._unit()._perp():Z,Z=Z||q;let ce=Z.add(q);ce.x===0&&ce.y===0||ce._unit();const te=Z.x*q.x+Z.y*q.y,ae=ce.x*q.x+ce.y*q.y,xe=ae!==0?1/ae:1/0,ye=2*Math.sqrt(2-2*ae),Ue=ae<Md&&D&&L,Ge=Z.x*q.y-Z.y*q.x>0;if(Ue&&re>x){const Ee=P.dist(D);if(Ee>2*T){const Re=P.sub(P.sub(D)._mult(T/Ee)._round());this.updateDistance(D,Re),this.addCurrentVertex(Re,Z,0,0,S),D=Re}}const Le=D&&L;let Pe=Le?o:m?"butt":c;if(Le&&Pe==="round"&&(xe<d?Pe="miter":xe<=2&&(Pe="fakeround")),Pe==="miter"&&xe>h&&(Pe="bevel"),Pe==="bevel"&&(xe>2&&(Pe="flipbevel"),xe<h&&(Pe="miter")),D&&this.updateDistance(D,P),Pe==="miter")ce._mult(xe),this.addCurrentVertex(P,ce,0,0,S);else if(Pe==="flipbevel"){if(xe>100)ce=q.mult(-1);else{const Ee=xe*Z.add(q).mag()/Z.sub(q).mag();ce._perp()._mult(Ee*(Ge?-1:1))}this.addCurrentVertex(P,ce,0,0,S),this.addCurrentVertex(P,ce.mult(-1),0,0,S)}else if(Pe==="bevel"||Pe==="fakeround"){const Ee=-Math.sqrt(xe*xe-1),Re=Ge?Ee:0,ke=Ge?0:Ee;if(D&&this.addCurrentVertex(P,Z,Re,ke,S),Pe==="fakeround"){const Te=Math.round(180*ye/Math.PI/20);for(let He=1;He<Te;He++){let je=He/Te;if(je!==.5){const Ut=je-.5;je+=je*Ut*(je-1)*((1.0904+te*(te*(3.55645-1.43519*te)-3.2452))*Ut*Ut+(.848013+te*(.215638*te-1.06021)))}const dt=q.sub(Z)._mult(je)._add(Z)._unit()._mult(Ge?-1:1);this.addHalfVertex(P,dt.x,dt.y,!1,Ge,0,S)}}L&&this.addCurrentVertex(P,q,-Re,-ke,S)}else if(Pe==="butt")this.addCurrentVertex(P,ce,0,0,S);else if(Pe==="square"){const Ee=D?1:-1;this.addCurrentVertex(P,ce,Ee,Ee,S)}else Pe==="round"&&(D&&(this.addCurrentVertex(P,Z,0,0,S),this.addCurrentVertex(P,Z,1,1,S,!0)),L&&(this.addCurrentVertex(P,q,-1,-1,S,!0),this.addCurrentVertex(P,q,0,0,S)));if(Ue&&re<g-1){const Ee=P.dist(L);if(Ee>2*T){const Re=P.add(L.sub(P)._mult(T/Ee)._round());this.updateDistance(P,Re),this.addCurrentVertex(Re,q,0,0,S),P=Re}}}}addCurrentVertex(e,r,o,c,h,d=!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,d,!1,o,h),this.addHalfVertex(e,m,g,d,!0,-c,h),this.distance>Mu/2&&this.totalDistance===0&&(this.distance=0,this.addCurrentVertex(e,r,o,c,h,d))}addHalfVertex({x:e,y:r},o,c,h,d,m,g){const x=.5*(this.lineClips?this.scaledDistance*(Mu-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(h?1:0),(r<<1)+(d?1:0),Math.round(63*o)+128,Math.round(63*c)+128,1+(m===0?0:m<0?-1:1)|(63&x)<<2,x>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const T=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,T),g.primitiveLength++),d?this.e2=T:this.e1=T}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()}}$e("LineBucket",pc,{omit:["layers","patternFeatures"]});const Pd=new mi({"line-cap":new Ze(_e.layout_line["line-cap"]),"line-join":new Ye(_e.layout_line["line-join"]),"line-miter-limit":new Ze(_e.layout_line["line-miter-limit"]),"line-round-limit":new Ze(_e.layout_line["line-round-limit"]),"line-sort-key":new Ye(_e.layout_line["line-sort-key"])});var Pu={paint:new mi({"line-opacity":new Ye(_e.paint_line["line-opacity"]),"line-color":new Ye(_e.paint_line["line-color"]),"line-translate":new Ze(_e.paint_line["line-translate"]),"line-translate-anchor":new Ze(_e.paint_line["line-translate-anchor"]),"line-width":new Ye(_e.paint_line["line-width"]),"line-gap-width":new Ye(_e.paint_line["line-gap-width"]),"line-offset":new Ye(_e.paint_line["line-offset"]),"line-blur":new Ye(_e.paint_line["line-blur"]),"line-dasharray":new Os(_e.paint_line["line-dasharray"]),"line-pattern":new Bn(_e.paint_line["line-pattern"]),"line-gradient":new Gr(_e.paint_line["line-gradient"])}),layout:Pd};const zu=new class extends Ye{possiblyEvaluate(i,e){return e=new Gt(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=Ie({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(i,e,r,o)}}(Pu.paint.properties["line-width"].specification);function ku(i,e){return e>0?e+2*i:i}zu.useIntegerZoom=!0;const zd=Qt([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),kd=Qt([{name:"a_projected_pos",components:3,type:"Float32"}],4);Qt([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Dd=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 Du=Qt([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Ld=Qt([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Rd(i,e,r){return i.sections.forEach(o=>{o.text=function(c,h,d){const m=h.layout.get("text-transform").evaluate(d,{});return m==="uppercase"?c=c.toLocaleUpperCase():m==="lowercase"&&(c=c.toLocaleLowerCase()),Zi.applyArabicShaping&&(c=Zi.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,dc=Bt,Lu=function(i,e,r,o,c){var h,d,m=8*c-o-1,g=(1<<m)-1,x=g>>1,T=-7,S=r?c-1:0,P=r?-1:1,D=i[e+S];for(S+=P,h=D&(1<<-T)-1,D>>=-T,T+=m;T>0;h=256*h+i[e+S],S+=P,T-=8);for(d=h&(1<<-T)-1,h>>=-T,T+=o;T>0;d=256*d+i[e+S],S+=P,T-=8);if(h===0)h=1-x;else{if(h===g)return d?NaN:1/0*(D?-1:1);d+=Math.pow(2,o),h-=x}return(D?-1:1)*d*Math.pow(2,h-o)},Ru=function(i,e,r,o,c,h){var d,m,g,x=8*h-c-1,T=(1<<x)-1,S=T>>1,P=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,D=o?0:h-1,L=o?1:-1,Z=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(m=isNaN(e)?1:0,d=T):(d=Math.floor(Math.log(e)/Math.LN2),e*(g=Math.pow(2,-d))<1&&(d--,g*=2),(e+=d+S>=1?P/g:P*Math.pow(2,1-S))*g>=2&&(d++,g/=2),d+S>=T?(m=0,d=T):d+S>=1?(m=(e*g-1)*Math.pow(2,c),d+=S):(m=e*Math.pow(2,S-1)*Math.pow(2,c),d=0));c>=8;i[r+D]=255&m,D+=L,m/=256,c-=8);for(d=d<<c|m,x+=c;x>0;i[r+D]=255&d,D+=L,d/=256,x-=8);i[r+D-L]|=128*Z};function Bt(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}Bt.Varint=0,Bt.Fixed64=1,Bt.Bytes=2,Bt.Fixed32=5;var $n,fc=4294967296,Bu=1/fc,Fu=typeof TextDecoder=="undefined"?null:new TextDecoder("utf8");function un(i){return i.type===Bt.Bytes?i.readVarint()+i.pos:i.pos+1}function Yo(i,e,r){return r?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function Ou(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 Bd(i,e){for(var r=0;r<i.length;r++)e.writeVarint(i[r])}function Fd(i,e){for(var r=0;r<i.length;r++)e.writeSVarint(i[r])}function Od(i,e){for(var r=0;r<i.length;r++)e.writeFloat(i[r])}function Ud(i,e){for(var r=0;r<i.length;r++)e.writeDouble(i[r])}function $d(i,e){for(var r=0;r<i.length;r++)e.writeBoolean(i[r])}function Vd(i,e){for(var r=0;r<i.length;r++)e.writeFixed32(i[r])}function Nd(i,e){for(var r=0;r<i.length;r++)e.writeSFixed32(i[r])}function Gd(i,e){for(var r=0;r<i.length;r++)e.writeFixed64(i[r])}function qd(i,e){for(var r=0;r<i.length;r++)e.writeSFixed64(i[r])}function al(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+16777216*i[e+3]}function Qo(i,e,r){i[r]=e,i[r+1]=e>>>8,i[r+2]=e>>>16,i[r+3]=e>>>24}function Uu(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}function Zd(i,e,r){i===1&&r.readMessage(jd,e)}function jd(i,e,r){if(i===3){const{id:o,bitmap:c,width:h,height:d,left:m,top:g,advance:x}=r.readMessage(Xd,{});e.push({id:o,bitmap:new Zs({width:h+6,height:d+6},c),metrics:{width:h,height:d,left:m,top:g,advance:x}})}}function Xd(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 $u(i){let e=0,r=0;for(const d of i)e+=d.w*d.h,r=Math.max(r,d.w);i.sort((d,m)=>m.h-d.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 d of i)for(let m=o.length-1;m>=0;m--){const g=o[m];if(!(d.w>g.w||d.h>g.h)){if(d.x=g.x,d.y=g.y,h=Math.max(h,d.y+d.h),c=Math.max(c,d.x+d.w),d.w===g.w&&d.h===g.h){const x=o.pop();m<o.length&&(o[m]=x)}else d.h===g.h?(g.x+=d.w,g.w-=d.w):d.w===g.w?(g.y+=d.h,g.h-=d.h):(o.push({x:g.x+d.w,y:g.y,w:g.w-d.w,h:d.h}),g.y+=d.h,g.h-=d.h);break}}return{w:c,h,fill:e/(c*h)||0}}Bt.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=al(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=Uu(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=al(this.buf,this.pos)+al(this.buf,this.pos+4)*fc;return this.pos+=8,i},readSFixed64:function(){var i=al(this.buf,this.pos)+Uu(this.buf,this.pos+4)*fc;return this.pos+=8,i},readFloat:function(){var i=Lu(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=Lu(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,d){var m,g,x=d.buf;if(m=(112&(g=x[d.pos++]))>>4,g<128||(m|=(127&(g=x[d.pos++]))<<3,g<128)||(m|=(127&(g=x[d.pos++]))<<10,g<128)||(m|=(127&(g=x[d.pos++]))<<17,g<128)||(m|=(127&(g=x[d.pos++]))<<24,g<128)||(m|=(1&(g=x[d.pos++]))<<31,g<128))return Yo(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&&Fu?function(r,o,c){return Fu.decode(r.subarray(o,c))}(this.buf,e,i):function(r,o,c){for(var h="",d=o;d<c;){var m,g,x,T=r[d],S=null,P=T>239?4:T>223?3:T>191?2:1;if(d+P>c)break;P===1?T<128&&(S=T):P===2?(192&(m=r[d+1]))==128&&(S=(31&T)<<6|63&m)<=127&&(S=null):P===3?(g=r[d+2],(192&(m=r[d+1]))==128&&(192&g)==128&&((S=(15&T)<<12|(63&m)<<6|63&g)<=2047||S>=55296&&S<=57343)&&(S=null)):P===4&&(g=r[d+2],x=r[d+3],(192&(m=r[d+1]))==128&&(192&g)==128&&(192&x)==128&&((S=(15&T)<<18|(63&m)<<12|(63&g)<<6|63&x)<=65535||S>=1114112)&&(S=null)),S===null?(S=65533,P=1):S>65535&&(S-=65536,h+=String.fromCharCode(S>>>10&1023|55296),S=56320|1023&S),h+=String.fromCharCode(S),d+=P}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!==Bt.Bytes)return i.push(this.readVarint(e));var r=un(this);for(i=i||[];this.pos<r;)i.push(this.readVarint(e));return i},readPackedSVarint:function(i){if(this.type!==Bt.Bytes)return i.push(this.readSVarint());var e=un(this);for(i=i||[];this.pos<e;)i.push(this.readSVarint());return i},readPackedBoolean:function(i){if(this.type!==Bt.Bytes)return i.push(this.readBoolean());var e=un(this);for(i=i||[];this.pos<e;)i.push(this.readBoolean());return i},readPackedFloat:function(i){if(this.type!==Bt.Bytes)return i.push(this.readFloat());var e=un(this);for(i=i||[];this.pos<e;)i.push(this.readFloat());return i},readPackedDouble:function(i){if(this.type!==Bt.Bytes)return i.push(this.readDouble());var e=un(this);for(i=i||[];this.pos<e;)i.push(this.readDouble());return i},readPackedFixed32:function(i){if(this.type!==Bt.Bytes)return i.push(this.readFixed32());var e=un(this);for(i=i||[];this.pos<e;)i.push(this.readFixed32());return i},readPackedSFixed32:function(i){if(this.type!==Bt.Bytes)return i.push(this.readSFixed32());var e=un(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed32());return i},readPackedFixed64:function(i){if(this.type!==Bt.Bytes)return i.push(this.readFixed64());var e=un(this);for(i=i||[];this.pos<e;)i.push(this.readFixed64());return i},readPackedSFixed64:function(i){if(this.type!==Bt.Bytes)return i.push(this.readSFixed64());var e=un(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed64());return i},skip:function(i){var e=7&i;if(e===Bt.Varint)for(;this.buf[this.pos++]>127;);else if(e===Bt.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Bt.Fixed32)this.pos+=4;else{if(e!==Bt.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),Qo(this.buf,i,this.pos),this.pos+=4},writeSFixed32:function(i){this.realloc(4),Qo(this.buf,i,this.pos),this.pos+=4},writeFixed64:function(i){this.realloc(8),Qo(this.buf,-1&i,this.pos),Qo(this.buf,Math.floor(i*Bu),this.pos+4),this.pos+=8},writeSFixed64:function(i){this.realloc(8),Qo(this.buf,-1&i,this.pos),Qo(this.buf,Math.floor(i*Bu),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,d,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,d){var m=(7&h)<<4;d.buf[d.pos++]|=m|((h>>>=3)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.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 d,m,g=0;g<c.length;g++){if((d=c.charCodeAt(g))>55295&&d<57344){if(!m){d>56319||g+1===c.length?(o[h++]=239,o[h++]=191,o[h++]=189):m=d;continue}if(d<56320){o[h++]=239,o[h++]=191,o[h++]=189,m=d;continue}d=m-55296<<10|d-56320|65536,m=null}else m&&(o[h++]=239,o[h++]=191,o[h++]=189,m=null);d<128?o[h++]=d:(d<2048?o[h++]=d>>6|192:(d<65536?o[h++]=d>>12|224:(o[h++]=d>>18|240,o[h++]=d>>12&63|128),o[h++]=d>>6&63|128),o[h++]=63&d|128)}return h}(this.buf,i,this.pos);var r=this.pos-e;r>=128&&Ou(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),Ru(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Ru(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&&Ou(r,o,this),this.pos=r-1,this.writeVarint(o),this.pos+=o},writeMessage:function(i,e,r){this.writeTag(i,Bt.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,Bd,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,Fd,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,$d,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,Od,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,Ud,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,Vd,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,Nd,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,Gd,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,qd,e)},writeBytesField:function(i,e){this.writeTag(i,Bt.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,Bt.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,Bt.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,Bt.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,Bt.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,Bt.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,Bt.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,Bt.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,Bt.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,Bt.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,Boolean(e))}};class mc{constructor(e,{pixelRatio:r,version:o,stretchX:c,stretchY:h,content:d}){this.paddedRect=e,this.pixelRatio=r,this.stretchX=c,this.stretchY=h,this.content=d,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 Vu{constructor(e,r){const o={},c={};this.haveRenderCallbacks=[];const h=[];this.addImages(e,o,h),this.addImages(r,c,h);const{w:d,h:m}=$u(h),g=new ir({width:d||1,height:m||1});for(const x in e){const T=e[x],S=o[x].paddedRect;ir.copy(T.data,g,{x:0,y:0},{x:S.x+1,y:S.y+1},T.data)}for(const x in r){const T=r[x],S=c[x].paddedRect,P=S.x+1,D=S.y+1,L=T.data.width,Z=T.data.height;ir.copy(T.data,g,{x:0,y:0},{x:P,y:D},T.data),ir.copy(T.data,g,{x:0,y:Z-1},{x:P,y:D-1},{width:L,height:1}),ir.copy(T.data,g,{x:0,y:0},{x:P,y:D+Z},{width:L,height:1}),ir.copy(T.data,g,{x:L-1,y:0},{x:P-1,y:D},{width:1,height:Z}),ir.copy(T.data,g,{x:0,y:0},{x:P+L,y:D},{width:1,height:Z})}this.image=g,this.iconPositions=o,this.patternPositions=c}addImages(e,r,o){for(const c in e){const h=e[c],d={x:0,y:0,w:h.data.width+2,h:h.data.height+2};o.push(d),r[c]=new mc(d,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})}}$e("ImagePosition",mc),$e("ImageAtlas",Vu),a.WritingMode=void 0,($n=a.WritingMode||(a.WritingMode={}))[$n.none=0]="none",$n[$n.horizontal=1]="horizontal",$n[$n.vertical=2]="vertical",$n[$n.horizontalOnly=3]="horizontalOnly";const ll=-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 es{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,r){const o=new es;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&&Na(c)&&!Ys[e[o+1]]||h&&Na(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&&ul[this.text.charCodeAt(o)];o++)e++;let r=this.text.length;for(let o=this.text.length-1;o>=0&&o>=e&&ul[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 es;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 ot("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)):ot("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function cl(i,e,r,o,c,h,d,m,g,x,T,S,P,D,L,Z){const q=es.fromFeature(i,c);let re;S===a.WritingMode.vertical&&q.verticalizePunctuation();const{processBidirectionalText:ce,processStyledBidirectionalText:te}=Zi;if(ce&&q.sections.length===1){re=[];const ye=ce(q.toString(),gc(q,x,h,e,o,D,L));for(const Ue of ye){const Ge=new es;Ge.text=Ue,Ge.sections=q.sections;for(let Le=0;Le<Ue.length;Le++)Ge.sectionIndex.push(0);re.push(Ge)}}else if(te){re=[];const ye=te(q.text,q.sectionIndex,gc(q,x,h,e,o,D,L));for(const Ue of ye){const Ge=new es;Ge.text=Ue[0],Ge.sectionIndex=Ue[1],Ge.sections=q.sections,re.push(Ge)}}else re=function(ye,Ue){const Ge=[],Le=ye.text;let Pe=0;for(const Ee of Ue)Ge.push(ye.substring(Pe,Ee)),Pe=Ee;return Pe<Le.length&&Ge.push(ye.substring(Pe,Le.length)),Ge}(q,gc(q,x,h,e,o,D,L));const ae=[],xe={positionedLines:ae,text:q.toString(),top:T[1],bottom:T[1],left:T[0],right:T[0],writingMode:S,iconsInText:!1,verticalizable:!1};return function(ye,Ue,Ge,Le,Pe,Ee,Re,ke,Te,He,je,dt){let Ut=0,Zt=ll,ni=0,nr=0;const yi=ke==="right"?1:ke==="left"?0:.5;let ei=0;for(const ti of Pe){ti.trim();const vi=ti.getMaxScale(),Ei=(vi-1)*gi,zi={positionedGlyphs:[],lineOffset:0};ye.positionedLines[ei]=zi;const $i=zi.positionedGlyphs;let Vi=0;if(!ti.length()){Zt+=Ee,++ei;continue}for(let hi=0;hi<ti.length();hi++){const _t=ti.getSection(hi),Wi=ti.getSectionIndex(hi),bi=ti.getCharCode(hi);let Si=0,fr=null,Ar=null,Mr=null,pn=gi;const mr=!(Te===a.WritingMode.horizontal||!je&&!ks(bi)||je&&(ul[bi]||(ui=bi,De.Arabic(ui)||De["Arabic Supplement"](ui)||De["Arabic Extended-A"](ui)||De["Arabic Presentation Forms-A"](ui)||De["Arabic Presentation Forms-B"](ui))));if(_t.imageName){const or=Le[_t.imageName];if(!or)continue;Mr=_t.imageName,ye.iconsInText=ye.iconsInText||!0,Ar=or.paddedRect;const Ni=or.displaySize;_t.scale=_t.scale*gi/dt,fr={width:Ni[0],height:Ni[1],left:1,top:-3,advance:mr?Ni[1]:Ni[0]},Si=Ei+(gi-Ni[1]*_t.scale),pn=fr.advance;const dn=mr?Ni[0]*_t.scale-gi*vi:Ni[1]*_t.scale-gi*vi;dn>0&&dn>Vi&&(Vi=dn)}else{const or=Ge[_t.fontStack],Ni=or&&or[bi];if(Ni&&Ni.rect)Ar=Ni.rect,fr=Ni.metrics;else{const dn=Ue[_t.fontStack],ia=dn&&dn[bi];if(!ia)continue;fr=ia.metrics}Si=(vi-_t.scale)*gi}mr?(ye.verticalizable=!0,$i.push({glyph:bi,imageName:Mr,x:Ut,y:Zt+Si,vertical:mr,scale:_t.scale,fontStack:_t.fontStack,sectionIndex:Wi,metrics:fr,rect:Ar}),Ut+=pn*_t.scale+He):($i.push({glyph:bi,imageName:Mr,x:Ut,y:Zt+Si,vertical:mr,scale:_t.scale,fontStack:_t.fontStack,sectionIndex:Wi,metrics:fr,rect:Ar}),Ut+=fr.advance*_t.scale+He)}$i.length!==0&&(ni=Math.max(Ut-He,ni),Kd($i,0,$i.length-1,yi,Vi)),Ut=0;const jt=Ee*vi+Vi;zi.lineOffset=Math.max(Vi,Ei),Zt+=jt,nr=Math.max(jt,nr),++ei}var ui;const xi=Zt-ll,{horizontalAlign:Ti,verticalAlign:Ui}=_c(Re);(function(ti,vi,Ei,zi,$i,Vi,jt,hi,_t){const Wi=(vi-Ei)*$i;let bi=0;bi=Vi!==jt?-hi*zi-ll:(-zi*_t+.5)*jt;for(const Si of ti)for(const fr of Si.positionedGlyphs)fr.x+=Wi,fr.y+=bi})(ye.positionedLines,yi,Ti,Ui,ni,nr,Ee,xi,Pe.length),ye.top+=-Ui*xi,ye.bottom=ye.top+xi,ye.left+=-Ti*ni,ye.right=ye.left+ni}(xe,e,r,o,re,d,m,g,S,x,P,Z),!function(ye){for(const Ue of ye)if(Ue.positionedGlyphs.length!==0)return!1;return!0}(ae)&&xe}const ul={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Wd={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 Nu(i,e,r,o,c,h){if(e.imageName){const d=o[e.imageName];return d?d.displaySize[0]*e.scale*gi/h+c:0}{const d=r[e.fontStack],m=d&&d[i];return m?m.metrics.advance*e.scale+c:0}}function Gu(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 Hd(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 qu(i,e,r,o,c,h){let d=null,m=Gu(e,r,c,h);for(const g of o){const x=Gu(e-g.x,r,c,h)+g.badness;x<=m&&(d=g,m=x)}return{index:i,x:e,priorBreak:d,badness:m}}function Zu(i){return i?Zu(i.priorBreak).concat(i.index):[]}function gc(i,e,r,o,c,h,d){if(h!=="point")return[];if(!i)return[];const m=[],g=function(P,D,L,Z,q,re){let ce=0;for(let te=0;te<P.length();te++){const ae=P.getSection(te);ce+=Nu(P.getCharCode(te),ae,Z,q,D,re)}return ce/Math.max(1,Math.ceil(ce/L))}(i,e,r,o,c,d),x=i.text.indexOf("\u200B")>=0;let T=0;for(let P=0;P<i.length();P++){const D=i.getSection(P),L=i.getCharCode(P);if(ul[L]||(T+=Nu(L,D,o,c,e,d)),P<i.length()-1){const Z=!((S=L)<11904||!(De["Bopomofo Extended"](S)||De.Bopomofo(S)||De["CJK Compatibility Forms"](S)||De["CJK Compatibility Ideographs"](S)||De["CJK Compatibility"](S)||De["CJK Radicals Supplement"](S)||De["CJK Strokes"](S)||De["CJK Symbols and Punctuation"](S)||De["CJK Unified Ideographs Extension A"](S)||De["CJK Unified Ideographs"](S)||De["Enclosed CJK Letters and Months"](S)||De["Halfwidth and Fullwidth Forms"](S)||De.Hiragana(S)||De["Ideographic Description Characters"](S)||De["Kangxi Radicals"](S)||De["Katakana Phonetic Extensions"](S)||De.Katakana(S)||De["Vertical Forms"](S)||De["Yi Radicals"](S)||De["Yi Syllables"](S)));(Wd[L]||Z||D.imageName)&&m.push(qu(P+1,T,g,m,Hd(L,i.getCharCode(P+1),Z&&x),!1))}}var S;return Zu(qu(i.length(),T,g,m,0,!0))}function _c(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 Kd(i,e,r,o,c){if(!o&&!c)return;const h=i[r],d=(i[r].x+h.metrics.advance*h.scale)*o;for(let m=e;m<=r;m++)i[m].x-=d,i[m].y+=c}function Jd(i,e,r){const{horizontalAlign:o,verticalAlign:c}=_c(r),h=e[0]-i.displaySize[0]*o,d=e[1]-i.displaySize[1]*c;return{image:i,top:d,bottom:d+i.displaySize[1],left:h,right:h+i.displaySize[0]}}function ju(i,e,r,o,c,h){const d=i.image;let m;if(d.content){const q=d.content,re=d.pixelRatio||1;m=[q[0]/re,q[1]/re,d.displaySize[0]-q[2]/re,d.displaySize[1]-q[3]/re]}const g=e.left*h,x=e.right*h;let T,S,P,D;r==="width"||r==="both"?(D=c[0]+g-o[3],S=c[0]+x+o[1]):(D=c[0]+(g+x-d.displaySize[0])/2,S=D+d.displaySize[0]);const L=e.top*h,Z=e.bottom*h;return r==="height"||r==="both"?(T=c[1]+L-o[0],P=c[1]+Z+o[2]):(T=c[1]+(L+Z-d.displaySize[1])/2,P=T+d.displaySize[1]),{image:d,top:T,right:S,bottom:P,left:D,collisionPadding:m}}const hn=128;function Xu(i,e){const{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new Gt(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 d=h;for(;d<o.length&&o[d]<i+1;)d++;d=Math.min(o.length-1,d);const m=o[h],g=o[d];return r.kind==="composite"?{kind:"composite",minZoom:m,maxZoom:g,interpolationType:c}:{kind:"camera",minZoom:m,maxZoom:g,minSize:r.evaluate(new Gt(m)),maxSize:r.evaluate(new Gt(g)),interpolationType:c}}}class Vn extends tt{constructor(e,r,o,c){super(e,r),this.angle=o,c!==void 0&&(this.segment=c)}clone(){return new Vn(this.x,this.y,this.angle,this.segment)}}function Wu(i,e,r,o,c){if(e.segment===void 0)return!0;let h=e,d=e.segment+1,m=0;for(;m>-r/2;){if(d--,d<0)return!1;m-=i[d].dist(h),h=i[d]}m+=i[d].dist(i[d+1]),d++;const g=[];let x=0;for(;m<r/2;){const T=i[d],S=i[d+1];if(!S)return!1;let P=i[d-1].angleTo(T)-T.angleTo(S);for(P=Math.abs((P+3*Math.PI)%(2*Math.PI)-Math.PI),g.push({distance:m,angleDelta:P}),x+=P;m-g[0].distance>o;)x-=g.shift().angleDelta;if(x>c)return!1;d++,m+=T.dist(S)}return!0}function Hu(i){let e=0;for(let r=0;r<i.length-1;r++)e+=i[r].dist(i[r+1]);return e}function Ku(i,e,r){return i?.6*e*r:0}function Ju(i,e){return Math.max(i?i.right-i.left:0,e?e.right-e.left:0)}function Yd(i,e,r,o,c,h){const d=Ku(r,c,h),m=Ju(r,o)*h;let g=0;const x=Hu(i)/2;for(let T=0;T<i.length-1;T++){const S=i[T],P=i[T+1],D=S.dist(P);if(g+D>x){const L=(x-g)/D,Z=Vt(S.x,P.x,L),q=Vt(S.y,P.y,L),re=new Vn(Z,q,P.angleTo(S),T);return re._round(),!d||Wu(i,re,m,d,e)?re:void 0}g+=D}}function Qd(i,e,r,o,c,h,d,m,g){const x=Ku(o,h,d),T=Ju(o,c),S=T*d,P=i[0].x===0||i[0].x===g||i[0].y===0||i[0].y===g;return e-S<e/4&&(e=S+e/4),Yu(i,P?e/2*m%e:(T/2+2*h)*d*m%e,e,x,r,S,P,!1,g)}function Yu(i,e,r,o,c,h,d,m,g){const x=h/2,T=Hu(i);let S=0,P=e-r,D=[];for(let L=0;L<i.length-1;L++){const Z=i[L],q=i[L+1],re=Z.dist(q),ce=q.angleTo(Z);for(;P+r<S+re;){P+=r;const te=(P-S)/re,ae=Vt(Z.x,q.x,te),xe=Vt(Z.y,q.y,te);if(ae>=0&&ae<g&&xe>=0&&xe<g&&P-x>=0&&P+x<=T){const ye=new Vn(ae,xe,ce,L);ye._round(),o&&!Wu(i,ye,h,o,c)||D.push(ye)}}S+=re}return m||D.length||d||(D=Yu(i,S/2,r,o,c,h,d,!0,g)),D}function Qu(i,e,r,o,c){const h=[];for(let d=0;d<i.length;d++){const m=i[d];let g;for(let x=0;x<m.length-1;x++){let T=m[x],S=m[x+1];T.x<e&&S.x<e||(T.x<e?T=new tt(e,T.y+(e-T.x)/(S.x-T.x)*(S.y-T.y))._round():S.x<e&&(S=new tt(e,T.y+(e-T.x)/(S.x-T.x)*(S.y-T.y))._round()),T.y<r&&S.y<r||(T.y<r?T=new tt(T.x+(r-T.y)/(S.y-T.y)*(S.x-T.x),r)._round():S.y<r&&(S=new tt(T.x+(r-T.y)/(S.y-T.y)*(S.x-T.x),r)._round()),T.x>=o&&S.x>=o||(T.x>=o?T=new tt(o,T.y+(o-T.x)/(S.x-T.x)*(S.y-T.y))._round():S.x>=o&&(S=new tt(o,T.y+(o-T.x)/(S.x-T.x)*(S.y-T.y))._round()),T.y>=c&&S.y>=c||(T.y>=c?T=new tt(T.x+(c-T.y)/(S.y-T.y)*(S.x-T.x),c)._round():S.y>=c&&(S=new tt(T.x+(c-T.y)/(S.y-T.y)*(S.x-T.x),c)._round()),g&&T.equals(g[g.length-1])||(g=[T],h.push(g)),g.push(S)))))}}return h}function eh(i,e,r,o){const c=[],h=i.image,d=h.pixelRatio,m=h.paddedRect.w-2,g=h.paddedRect.h-2,x=i.right-i.left,T=i.bottom-i.top,S=h.stretchX||[[0,m]],P=h.stretchY||[[0,g]],D=(Ee,Re)=>Ee+Re[1]-Re[0],L=S.reduce(D,0),Z=P.reduce(D,0),q=m-L,re=g-Z;let ce=0,te=L,ae=0,xe=Z,ye=0,Ue=q,Ge=0,Le=re;if(h.content&&o){const Ee=h.content;ce=hl(S,0,Ee[0]),ae=hl(P,0,Ee[1]),te=hl(S,Ee[0],Ee[2]),xe=hl(P,Ee[1],Ee[3]),ye=Ee[0]-ce,Ge=Ee[1]-ae,Ue=Ee[2]-Ee[0]-te,Le=Ee[3]-Ee[1]-xe}const Pe=(Ee,Re,ke,Te)=>{const He=pl(Ee.stretch-ce,te,x,i.left),je=dl(Ee.fixed-ye,Ue,Ee.stretch,L),dt=pl(Re.stretch-ae,xe,T,i.top),Ut=dl(Re.fixed-Ge,Le,Re.stretch,Z),Zt=pl(ke.stretch-ce,te,x,i.left),ni=dl(ke.fixed-ye,Ue,ke.stretch,L),nr=pl(Te.stretch-ae,xe,T,i.top),yi=dl(Te.fixed-Ge,Le,Te.stretch,Z),ei=new tt(He,dt),ui=new tt(Zt,dt),xi=new tt(Zt,nr),Ti=new tt(He,nr),Ui=new tt(je/d,Ut/d),ti=new tt(ni/d,yi/d),vi=e*Math.PI/180;if(vi){const $i=Math.sin(vi),Vi=Math.cos(vi),jt=[Vi,-$i,$i,Vi];ei._matMult(jt),ui._matMult(jt),Ti._matMult(jt),xi._matMult(jt)}const Ei=Ee.stretch+Ee.fixed,zi=Re.stretch+Re.fixed;return{tl:ei,tr:ui,bl:Ti,br:xi,tex:{x:h.paddedRect.x+1+Ei,y:h.paddedRect.y+1+zi,w:ke.stretch+ke.fixed-Ei,h:Te.stretch+Te.fixed-zi},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Ui,pixelOffsetBR:ti,minFontScaleX:Ue/d/x,minFontScaleY:Le/d/T,isSDF:r}};if(o&&(h.stretchX||h.stretchY)){const Ee=th(S,q,L),Re=th(P,re,Z);for(let ke=0;ke<Ee.length-1;ke++){const Te=Ee[ke],He=Ee[ke+1];for(let je=0;je<Re.length-1;je++)c.push(Pe(Te,Re[je],He,Re[je+1]))}}else c.push(Pe({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:m+1},{fixed:0,stretch:g+1}));return c}function hl(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 th(i,e,r){const o=[{fixed:-1,stretch:0}];for(const[c,h]of i){const d=o[o.length-1];o.push({fixed:c-d.stretch,stretch:d.stretch}),o.push({fixed:c-d.stretch,stretch:d.stretch+(h-c)})}return o.push({fixed:e+1,stretch:r}),o}function pl(i,e,r,o){return i/e*r+o}function dl(i,e,r,o){return i-e*r/o}$e("Anchor",Vn);class fl{constructor(e,r,o,c,h,d,m,g,x,T){if(this.boxStartIndex=e.length,x){let S=d.top,P=d.bottom;const D=d.collisionPadding;D&&(S-=D[1],P+=D[3]);let L=P-S;L>0&&(L=Math.max(10,L),this.circleDiameter=L)}else{let S=d.top*m-g[0],P=d.bottom*m+g[2],D=d.left*m-g[3],L=d.right*m+g[1];const Z=d.collisionPadding;if(Z&&(D-=Z[0]*m,S-=Z[1]*m,L+=Z[2]*m,P+=Z[3]*m),T){const q=new tt(D,S),re=new tt(L,S),ce=new tt(D,P),te=new tt(L,P),ae=T*Math.PI/180;q._rotate(ae),re._rotate(ae),ce._rotate(ae),te._rotate(ae),D=Math.min(q.x,re.x,ce.x,te.x),L=Math.max(q.x,re.x,ce.x,te.x),S=Math.min(q.y,re.y,ce.y,te.y),P=Math.max(q.y,re.y,ce.y,te.y)}e.emplaceBack(r.x,r.y,D,S,L,P,o,c,h)}this.boxEndIndex=e.length}}class ef{constructor(e=[],r=tf){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,d=r[h];if(o(c,d)>=0)break;r[e]=d,e=h}r[e]=c}_down(e){const{data:r,compare:o}=this,c=this.length>>1,h=r[e];for(;e<c;){let d=1+(e<<1),m=r[d];const g=d+1;if(g<this.length&&o(r[g],m)<0&&(d=g,m=r[g]),o(m,h)>=0)break;r[e]=m,e=d}r[e]=h}}function tf(i,e){return i<e?-1:i>e?1:0}function rf(i,e=1,r=!1){let o=1/0,c=1/0,h=-1/0,d=-1/0;const m=i[0];for(let D=0;D<m.length;D++){const L=m[D];(!D||L.x<o)&&(o=L.x),(!D||L.y<c)&&(c=L.y),(!D||L.x>h)&&(h=L.x),(!D||L.y>d)&&(d=L.y)}const g=Math.min(h-o,d-c);let x=g/2;const T=new ef([],nf);if(g===0)return new tt(o,c);for(let D=o;D<h;D+=g)for(let L=c;L<d;L+=g)T.push(new ts(D+x,L+x,x,i));let S=function(D){let L=0,Z=0,q=0;const re=D[0];for(let ce=0,te=re.length,ae=te-1;ce<te;ae=ce++){const xe=re[ce],ye=re[ae],Ue=xe.x*ye.y-ye.x*xe.y;Z+=(xe.x+ye.x)*Ue,q+=(xe.y+ye.y)*Ue,L+=3*Ue}return new ts(Z/L,q/L,0,D)}(i),P=T.length;for(;T.length;){const D=T.pop();(D.d>S.d||!S.d)&&(S=D,r&&console.log("found best %d after %d probes",Math.round(1e4*D.d)/1e4,P)),D.max-S.d<=e||(x=D.h/2,T.push(new ts(D.p.x-x,D.p.y-x,x,i)),T.push(new ts(D.p.x+x,D.p.y-x,x,i)),T.push(new ts(D.p.x-x,D.p.y+x,x,i)),T.push(new ts(D.p.x+x,D.p.y+x,x,i)),P+=4)}return r&&(console.log(`num probes: ${P}`),console.log(`best distance: ${S.d}`)),S.p}function nf(i,e){return e.max-i.max}function ts(i,e,r,o){this.p=new tt(i,e),this.h=r,this.d=function(c,h){let d=!1,m=1/0;for(let g=0;g<h.length;g++){const x=h[g];for(let T=0,S=x.length,P=S-1;T<S;P=T++){const D=x[T],L=x[P];D.y>c.y!=L.y>c.y&&c.x<(L.x-D.x)*(c.y-D.y)/(L.y-D.y)+D.x&&(d=!d),m=Math.min(m,cu(c,D,L))}}return(d?1:-1)*Math.sqrt(m)}(this.p,o),this.max=this.d+this.h*Math.SQRT2}const yc=Number.POSITIVE_INFINITY;function ih(i,e){return e[1]!==yc?function(r,o,c){let h=0,d=0;switch(o=Math.abs(o),c=Math.abs(c),r){case"top-right":case"top-left":case"top":d=c-7;break;case"bottom-right":case"bottom-left":case"bottom":d=7-c}switch(r){case"top-right":case"bottom-right":case"right":h=-o;break;case"top-left":case"bottom-left":case"left":h=o}return[h,d]}(i,e[0],e[1]):function(r,o){let c=0,h=0;o<0&&(o=0);const d=o/Math.sqrt(2);switch(r){case"top-right":case"top-left":h=d-7;break;case"bottom-right":case"bottom-left":h=7-d;break;case"bottom":h=7-o;break;case"top":h=o-7}switch(r){case"top-right":case"bottom-right":c=-d;break;case"top-left":case"bottom-left":c=d;break;case"left":c=o;break;case"right":c=-o}return[c,h]}(i,e[0])}function xc(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 of(i,e,r,o,c,h,d,m,g,x,T){let S=h.textMaxSize.evaluate(e,{});S===void 0&&(S=d);const P=i.layers[0].layout,D=P.get("icon-offset").evaluate(e,{},T),L=nh(r.horizontal),Z=d/24,q=i.tilePixelRatio*Z,re=i.tilePixelRatio*S/24,ce=i.tilePixelRatio*m,te=i.tilePixelRatio*P.get("symbol-spacing"),ae=P.get("text-padding")*i.tilePixelRatio,xe=function(Te,He,je,dt=1){const Ut=Te.get("icon-padding").evaluate(He,{},je),Zt=Ut&&Ut.values;return[Zt[0]*dt,Zt[1]*dt,Zt[2]*dt,Zt[3]*dt]}(P,e,T,i.tilePixelRatio),ye=P.get("text-max-angle")/180*Math.PI,Ue=P.get("text-rotation-alignment")!=="viewport"&&P.get("symbol-placement")!=="point",Ge=P.get("icon-rotation-alignment")==="map"&&P.get("symbol-placement")!=="point",Le=P.get("symbol-placement"),Pe=te/2,Ee=P.get("icon-text-fit");let Re;o&&Ee!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(Re=ju(o,r.vertical,Ee,P.get("icon-text-fit-padding"),D,Z)),L&&(o=ju(o,L,Ee,P.get("icon-text-fit-padding"),D,Z)));const ke=(Te,He)=>{He.x<0||He.x>=ri||He.y<0||He.y>=ri||function(je,dt,Ut,Zt,ni,nr,yi,ei,ui,xi,Ti,Ui,ti,vi,Ei,zi,$i,Vi,jt,hi,_t,Wi,bi,Si,fr){const Ar=je.addToLineVertexArray(dt,Ut);let Mr,pn,mr,or,Ni=0,dn=0,ia=0,vh=0,Mc=-1,Pc=-1;const fn={};let bh=ci.exports(""),zc=0,kc=0;if(ei._unevaluatedLayout.getValue("text-radial-offset")===void 0?[zc,kc]=ei.layout.get("text-offset").evaluate(_t,{},Si).map(Gi=>Gi*gi):(zc=ei.layout.get("text-radial-offset").evaluate(_t,{},Si)*gi,kc=yc),je.allowVerticalPlacement&&Zt.vertical){const Gi=ei.layout.get("text-rotate").evaluate(_t,{},Si)+90;mr=new fl(ui,dt,xi,Ti,Ui,Zt.vertical,ti,vi,Ei,Gi),yi&&(or=new fl(ui,dt,xi,Ti,Ui,yi,$i,Vi,Ei,Gi))}if(ni){const Gi=ei.layout.get("icon-rotate").evaluate(_t,{}),Wr=ei.layout.get("icon-text-fit")!=="none",ra=eh(ni,Gi,bi,Wr),na=yi?eh(yi,Gi,bi,Wr):void 0;pn=new fl(ui,dt,xi,Ti,Ui,ni,$i,Vi,!1,Gi),Ni=4*ra.length;const Eh=je.iconSizeData;let Eo=null;Eh.kind==="source"?(Eo=[hn*ei.layout.get("icon-size").evaluate(_t,{})],Eo[0]>Nn&&ot(`${je.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):Eh.kind==="composite"&&(Eo=[hn*Wi.compositeIconSizes[0].evaluate(_t,{},Si),hn*Wi.compositeIconSizes[1].evaluate(_t,{},Si)],(Eo[0]>Nn||Eo[1]>Nn)&&ot(`${je.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),je.addSymbols(je.icon,ra,Eo,hi,jt,_t,a.WritingMode.none,dt,Ar.lineStartIndex,Ar.lineLength,-1,Si),Mc=je.icon.placedSymbolArray.length-1,na&&(dn=4*na.length,je.addSymbols(je.icon,na,Eo,hi,jt,_t,a.WritingMode.vertical,dt,Ar.lineStartIndex,Ar.lineLength,-1,Si),Pc=je.icon.placedSymbolArray.length-1)}const wh=Object.keys(Zt.horizontal);for(const Gi of wh){const Wr=Zt.horizontal[Gi];if(!Mr){bh=ci.exports(Wr.text);const na=ei.layout.get("text-rotate").evaluate(_t,{},Si);Mr=new fl(ui,dt,xi,Ti,Ui,Wr,ti,vi,Ei,na)}const ra=Wr.positionedLines.length===1;if(ia+=rh(je,dt,Wr,nr,ei,Ei,_t,zi,Ar,Zt.vertical?a.WritingMode.horizontal:a.WritingMode.horizontalOnly,ra?wh:[Gi],fn,Mc,Wi,Si),ra)break}Zt.vertical&&(vh+=rh(je,dt,Zt.vertical,nr,ei,Ei,_t,zi,Ar,a.WritingMode.vertical,["vertical"],fn,Pc,Wi,Si));const yf=Mr?Mr.boxStartIndex:je.collisionBoxArray.length,xf=Mr?Mr.boxEndIndex:je.collisionBoxArray.length,vf=mr?mr.boxStartIndex:je.collisionBoxArray.length,bf=mr?mr.boxEndIndex:je.collisionBoxArray.length,wf=pn?pn.boxStartIndex:je.collisionBoxArray.length,Tf=pn?pn.boxEndIndex:je.collisionBoxArray.length,Ef=or?or.boxStartIndex:je.collisionBoxArray.length,Sf=or?or.boxEndIndex:je.collisionBoxArray.length;let Pr=-1;const xl=(Gi,Wr)=>Gi&&Gi.circleDiameter?Math.max(Gi.circleDiameter,Wr):Wr;Pr=xl(Mr,Pr),Pr=xl(mr,Pr),Pr=xl(pn,Pr),Pr=xl(or,Pr);const Th=Pr>-1?1:0;Th&&(Pr*=fr/gi),je.glyphOffsetArray.length>=is.MAX_GLYPHS&&ot("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),_t.sortKey!==void 0&&je.addToSortKeyRanges(je.symbolInstances.length,_t.sortKey),je.symbolInstances.emplaceBack(dt.x,dt.y,fn.right>=0?fn.right:-1,fn.center>=0?fn.center:-1,fn.left>=0?fn.left:-1,fn.vertical||-1,Mc,Pc,bh,yf,xf,vf,bf,wf,Tf,Ef,Sf,xi,ia,vh,Ni,dn,Th,0,ti,zc,kc,Pr)}(i,He,Te,r,o,c,Re,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,q,[ae,ae,ae,ae],Ue,g,ce,xe,Ge,D,e,h,x,T,d)};if(Le==="line")for(const Te of Qu(e.geometry,0,0,ri,ri)){const He=Qd(Te,te,ye,r.vertical||L,o,24,re,i.overscaling,ri);for(const je of He){const dt=L;dt&&sf(i,dt.text,Pe,je)||ke(Te,je)}}else if(Le==="line-center"){for(const Te of e.geometry)if(Te.length>1){const He=Yd(Te,ye,r.vertical||L,o,24,re);He&&ke(Te,He)}}else if(e.type==="Polygon")for(const Te of sc(e.geometry,0)){const He=rf(Te,16);ke(Te[0],new Vn(He.x,He.y,0))}else if(e.type==="LineString")for(const Te of e.geometry)ke(Te,new Vn(Te[0].x,Te[0].y,0));else if(e.type==="Point")for(const Te of e.geometry)for(const He of Te)ke([He],new Vn(He.x,He.y,0))}const Nn=32640;function rh(i,e,r,o,c,h,d,m,g,x,T,S,P,D,L){const Z=function(ce,te,ae,xe,ye,Ue,Ge,Le){const Pe=xe.layout.get("text-rotate").evaluate(Ue,{})*Math.PI/180,Ee=[];for(const Re of te.positionedLines)for(const ke of Re.positionedGlyphs){if(!ke.rect)continue;const Te=ke.rect||{};let He=4,je=!0,dt=1,Ut=0;const Zt=(ye||Le)&&ke.vertical,ni=ke.metrics.advance*ke.scale/2;if(Le&&te.verticalizable){const jt=(ke.scale-1)*gi,hi=(gi-ke.metrics.width*ke.scale)/2;Ut=Re.lineOffset/2-(ke.imageName?-hi:jt)}if(ke.imageName){const jt=Ge[ke.imageName];je=jt.sdf,dt=jt.pixelRatio,He=1/dt}const nr=ye?[ke.x+ni,ke.y]:[0,0];let yi=ye?[0,0]:[ke.x+ni+ae[0],ke.y+ae[1]-Ut],ei=[0,0];Zt&&(ei=yi,yi=[0,0]);const ui=(ke.metrics.left-He)*ke.scale-ni+yi[0],xi=(-ke.metrics.top-He)*ke.scale+yi[1],Ti=ui+Te.w*ke.scale/dt,Ui=xi+Te.h*ke.scale/dt,ti=new tt(ui,xi),vi=new tt(Ti,xi),Ei=new tt(ui,Ui),zi=new tt(Ti,Ui);if(Zt){const jt=new tt(-ni,ni-ll),hi=-Math.PI/2,_t=12-ni,Wi=new tt(22-_t,-(ke.imageName?_t:0)),bi=new tt(...ei);ti._rotateAround(hi,jt)._add(Wi)._add(bi),vi._rotateAround(hi,jt)._add(Wi)._add(bi),Ei._rotateAround(hi,jt)._add(Wi)._add(bi),zi._rotateAround(hi,jt)._add(Wi)._add(bi)}if(Pe){const jt=Math.sin(Pe),hi=Math.cos(Pe),_t=[hi,-jt,jt,hi];ti._matMult(_t),vi._matMult(_t),Ei._matMult(_t),zi._matMult(_t)}const $i=new tt(0,0),Vi=new tt(0,0);Ee.push({tl:ti,tr:vi,bl:Ei,br:zi,tex:Te,writingMode:te.writingMode,glyphOffset:nr,sectionIndex:ke.sectionIndex,isSDF:je,pixelOffsetTL:$i,pixelOffsetBR:Vi,minFontScaleX:0,minFontScaleY:0})}return Ee}(0,r,m,c,h,d,o,i.allowVerticalPlacement),q=i.textSizeData;let re=null;q.kind==="source"?(re=[hn*c.layout.get("text-size").evaluate(d,{})],re[0]>Nn&&ot(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):q.kind==="composite"&&(re=[hn*D.compositeTextSizes[0].evaluate(d,{},L),hn*D.compositeTextSizes[1].evaluate(d,{},L)],(re[0]>Nn||re[1]>Nn)&&ot(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),i.addSymbols(i.text,Z,re,m,h,d,x,e,g.lineStartIndex,g.lineLength,P,L);for(const ce of T)S[ce]=i.text.placedSymbolArray.length-1;return 4*Z.length}function nh(i){for(const e in i)return i[e];return null}function sf(i,e,r,o){const c=i.compareText;if(e in c){const h=c[e];for(let d=h.length-1;d>=0;d--)if(o.dist(h[d])<r)return!0}else c[e]=[];return c[e].push(o),!1}const af=Un.VectorTileFeature.types,lf=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function ml(i,e,r,o,c,h,d,m,g,x,T,S,P){const D=m?Math.min(Nn,Math.round(m[0])):0,L=m?Math.min(Nn,Math.round(m[1])):0;i.emplaceBack(e,r,Math.round(32*o),Math.round(32*c),h,d,(D<<1)+(g?1:0),L,16*x,16*T,256*S,256*P)}function vc(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 cf(i){for(const e of i.sections)if(qa(e.text))return!0;return!1}class bc{constructor(e){this.layoutVertexArray=new pr,this.indexArray=new Ai,this.programConfigurations=e,this.segments=new mt,this.dynamicLayoutVertexArray=new tr,this.opacityVertexArray=new dr,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,zd.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,kd.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,lf,!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())}}$e("SymbolBuffers",bc);class wc{constructor(e,r,o){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new o,this.segments=new mt,this.collisionVertexArray=new ji}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Dd.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}$e("CollisionBuffers",wc);class is{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(d=>d.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=ec([]),this.placementViewportMatrix=ec([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Xu(this.zoom,r["text-size"]),this.iconSizeData=Xu(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=Ec(o,"text-overlap","text-allow-overlap")!=="never"||Ec(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(d=>a.WritingMode[d])),this.stateDependentLayerIds=this.layers.filter(d=>d.isStateDependent()).map(d=>d.id),this.sourceID=e.sourceID}createArrays(){this.text=new bc(new xo(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new bc(new xo(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Me,this.lineVertexArray=new Oe,this.symbolInstances=new Fe}calculateGlyphDependencies(e,r,o,c,h){for(let d=0;d<e.length;d++)if(r[e.charCodeAt(d)]=!0,(o||c)&&h){const m=Ys[e.charAt(d)];m&&(r[m.charCodeAt(0)]=!0)}}populate(e,r,o){const c=this.layers[0],h=c.layout,d=h.get("text-font"),m=h.get("text-field"),g=h.get("icon-image"),x=(m.value.kind!=="constant"||m.value.value instanceof W&&!m.value.value.isEmpty()||m.value.value.toString().length>0)&&(d.value.kind!=="constant"||d.value.value.length>0),T=g.value.kind!=="constant"||!!g.value.value||Object.keys(g.parameters).length>0,S=h.get("symbol-sort-key");if(this.features=[],!x&&!T)return;const P=r.iconDependencies,D=r.glyphDependencies,L=r.availableImages,Z=new Gt(this.zoom);for(const{feature:q,id:re,index:ce,sourceLayerIndex:te}of e){const ae=c._featureFilter.needGeometry,xe=bo(q,ae);if(!c._featureFilter.filter(Z,xe,o))continue;let ye,Ue;if(ae||(xe.geometry=vo(q)),x){const Le=c.getValueAndResolveTokens("text-field",xe,o,L),Pe=W.factory(Le);cf(Pe)&&(this.hasRTLText=!0),(!this.hasRTLText||go()==="unavailable"||this.hasRTLText&&Zi.isParsed())&&(ye=Rd(Pe,c,xe))}if(T){const Le=c.getValueAndResolveTokens("icon-image",xe,o,L);Ue=Le instanceof J?Le:J.fromString(Le)}if(!ye&&!Ue)continue;const Ge=this.sortFeaturesByKey?S.evaluate(xe,{},o):void 0;if(this.features.push({id:re,text:ye,icon:Ue,index:ce,sourceLayerIndex:te,geometry:xe.geometry,properties:q.properties,type:af[q.type],sortKey:Ge}),Ue&&(P[Ue.name]=!0),ye){const Le=d.evaluate(xe,{},o).join(","),Pe=h.get("text-rotation-alignment")!=="viewport"&&h.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(a.WritingMode.vertical)>=0;for(const Ee of ye.sections)if(Ee.image)P[Ee.image.name]=!0;else{const Re=qo(ye.toString()),ke=Ee.fontStack||Le,Te=D[ke]=D[ke]||{};this.calculateGlyphDependencies(Ee.text,Te,Pe,this.allowVerticalPlacement,Re)}}}h.get("symbol-placement")==="line"&&(this.features=function(q){const re={},ce={},te=[];let ae=0;function xe(Le){te.push(q[Le]),ae++}function ye(Le,Pe,Ee){const Re=ce[Le];return delete ce[Le],ce[Pe]=Re,te[Re].geometry[0].pop(),te[Re].geometry[0]=te[Re].geometry[0].concat(Ee[0]),Re}function Ue(Le,Pe,Ee){const Re=re[Pe];return delete re[Pe],re[Le]=Re,te[Re].geometry[0].shift(),te[Re].geometry[0]=Ee[0].concat(te[Re].geometry[0]),Re}function Ge(Le,Pe,Ee){const Re=Ee?Pe[0][Pe[0].length-1]:Pe[0][0];return`${Le}:${Re.x}:${Re.y}`}for(let Le=0;Le<q.length;Le++){const Pe=q[Le],Ee=Pe.geometry,Re=Pe.text?Pe.text.toString():null;if(!Re){xe(Le);continue}const ke=Ge(Re,Ee),Te=Ge(Re,Ee,!0);if(ke in ce&&Te in re&&ce[ke]!==re[Te]){const He=Ue(ke,Te,Ee),je=ye(ke,Te,te[He].geometry);delete re[ke],delete ce[Te],ce[Ge(Re,te[je].geometry,!0)]=je,te[He].geometry=null}else ke in ce?ye(ke,Te,Ee):Te in re?Ue(ke,Te,Ee):(xe(Le),re[ke]=ae-1,ce[Te]=ae-1)}return te.filter(Le=>Le.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((q,re)=>q.sortKey-re.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 d={};for(let m=e.segment+1;m<r.length;m++)d[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--)d[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=d[m];this.lineVertexArray.emplaceBack(g.x,g.y,g.tileUnitDistanceFromAnchor)}}return{lineStartIndex:o,lineLength:this.lineVertexArray.length-o}}addSymbols(e,r,o,c,h,d,m,g,x,T,S,P){const D=e.indexArray,L=e.layoutVertexArray,Z=e.segments.prepareSegment(4*r.length,L,D,this.canOverlap?d.sortKey:void 0),q=this.glyphOffsetArray.length,re=Z.vertexLength,ce=this.allowVerticalPlacement&&m===a.WritingMode.vertical?Math.PI/2:0,te=d.text&&d.text.sections;for(let ae=0;ae<r.length;ae++){const{tl:xe,tr:ye,bl:Ue,br:Ge,tex:Le,pixelOffsetTL:Pe,pixelOffsetBR:Ee,minFontScaleX:Re,minFontScaleY:ke,glyphOffset:Te,isSDF:He,sectionIndex:je}=r[ae],dt=Z.vertexLength,Ut=Te[1];ml(L,g.x,g.y,xe.x,Ut+xe.y,Le.x,Le.y,o,He,Pe.x,Pe.y,Re,ke),ml(L,g.x,g.y,ye.x,Ut+ye.y,Le.x+Le.w,Le.y,o,He,Ee.x,Pe.y,Re,ke),ml(L,g.x,g.y,Ue.x,Ut+Ue.y,Le.x,Le.y+Le.h,o,He,Pe.x,Ee.y,Re,ke),ml(L,g.x,g.y,Ge.x,Ut+Ge.y,Le.x+Le.w,Le.y+Le.h,o,He,Ee.x,Ee.y,Re,ke),vc(e.dynamicLayoutVertexArray,g,ce),D.emplaceBack(dt,dt+1,dt+2),D.emplaceBack(dt+1,dt+2,dt+3),Z.vertexLength+=4,Z.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Te[0]),ae!==r.length-1&&je===r[ae+1].sectionIndex||e.programConfigurations.populatePaintArrays(L.length,d,d.index,{},P,te&&te[je])}e.placedSymbolArray.emplaceBack(g.x,g.y,q,this.glyphOffsetArray.length-q,re,x,T,g.segment,o?o[0]:0,o?o[1]:0,c[0],c[1],m,0,!1,0,S)}_addCollisionDebugVertex(e,r,o,c,h,d){return r.emplaceBack(0,0),e.emplaceBack(o.x,o.y,c,h,Math.round(d.x),Math.round(d.y))}addCollisionDebugVertices(e,r,o,c,h,d,m){const g=h.segments.prepareSegment(4,h.layoutVertexArray,h.indexArray),x=g.vertexLength,T=h.layoutVertexArray,S=h.collisionVertexArray,P=m.anchorX,D=m.anchorY;this._addCollisionDebugVertex(T,S,d,P,D,new tt(e,r)),this._addCollisionDebugVertex(T,S,d,P,D,new tt(o,r)),this._addCollisionDebugVertex(T,S,d,P,D,new tt(o,c)),this._addCollisionDebugVertex(T,S,d,P,D,new tt(e,c)),g.vertexLength+=4;const L=h.indexArray;L.emplaceBack(x,x+1),L.emplaceBack(x+1,x+2),L.emplaceBack(x+2,x+3),L.emplaceBack(x+3,x),g.primitiveLength+=4}addDebugCollisionBoxes(e,r,o,c){for(let h=e;h<r;h++){const d=this.collisionBoxArray.get(h);this.addCollisionDebugVertices(d.x1,d.y1,d.x2,d.y2,c?this.textCollisionBox:this.iconCollisionBox,d.anchorPoint,o)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new wc(jr,Du.members,Ir),this.iconCollisionBox=new wc(jr,Du.members,Ir);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,d,m,g,x){const T={};for(let S=r;S<o;S++){const P=e.get(S);T.textBox={x1:P.x1,y1:P.y1,x2:P.x2,y2:P.y2,anchorPointX:P.anchorPointX,anchorPointY:P.anchorPointY},T.textFeatureIndex=P.featureIndex;break}for(let S=c;S<h;S++){const P=e.get(S);T.verticalTextBox={x1:P.x1,y1:P.y1,x2:P.x2,y2:P.y2,anchorPointX:P.anchorPointX,anchorPointY:P.anchorPointY},T.verticalTextFeatureIndex=P.featureIndex;break}for(let S=d;S<m;S++){const P=e.get(S);T.iconBox={x1:P.x1,y1:P.y1,x2:P.x2,y2:P.y2,anchorPointX:P.anchorPointX,anchorPointY:P.anchorPointY},T.iconFeatureIndex=P.featureIndex;break}for(let S=g;S<x;S++){const P=e.get(S);T.verticalIconBox={x1:P.x1,y1:P.y1,x2:P.x2,y2:P.y2,anchorPointX:P.anchorPointX,anchorPointY:P.anchorPointY},T.verticalIconFeatureIndex=P.featureIndex;break}return T}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=[],d=[];for(let m=0;m<this.symbolInstances.length;++m){d.push(m);const g=this.symbolInstances.get(m);c.push(0|Math.round(r*g.anchorX+o*g.anchorY)),h.push(g.featureIndex)}return d.sort((m,g)=>c[m]-c[g]||h[g]-h[m]),d}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,d)=>{c>=0&&d.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)}}}$e("SymbolBucket",is,{omit:["layers","collisionBoxArray","features","compareText"]}),is.MAX_GLYPHS=65535,is.addDynamicAttributes=vc;const uf=new mi({"symbol-placement":new Ze(_e.layout_symbol["symbol-placement"]),"symbol-spacing":new Ze(_e.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ze(_e.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Ye(_e.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ze(_e.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ze(_e.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ze(_e.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ze(_e.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ze(_e.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ze(_e.layout_symbol["icon-rotation-alignment"]),"icon-size":new Ye(_e.layout_symbol["icon-size"]),"icon-text-fit":new Ze(_e.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ze(_e.layout_symbol["icon-text-fit-padding"]),"icon-image":new Ye(_e.layout_symbol["icon-image"]),"icon-rotate":new Ye(_e.layout_symbol["icon-rotate"]),"icon-padding":new Ye(_e.layout_symbol["icon-padding"]),"icon-keep-upright":new Ze(_e.layout_symbol["icon-keep-upright"]),"icon-offset":new Ye(_e.layout_symbol["icon-offset"]),"icon-anchor":new Ye(_e.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ze(_e.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ze(_e.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ze(_e.layout_symbol["text-rotation-alignment"]),"text-field":new Ye(_e.layout_symbol["text-field"]),"text-font":new Ye(_e.layout_symbol["text-font"]),"text-size":new Ye(_e.layout_symbol["text-size"]),"text-max-width":new Ye(_e.layout_symbol["text-max-width"]),"text-line-height":new Ze(_e.layout_symbol["text-line-height"]),"text-letter-spacing":new Ye(_e.layout_symbol["text-letter-spacing"]),"text-justify":new Ye(_e.layout_symbol["text-justify"]),"text-radial-offset":new Ye(_e.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ze(_e.layout_symbol["text-variable-anchor"]),"text-anchor":new Ye(_e.layout_symbol["text-anchor"]),"text-max-angle":new Ze(_e.layout_symbol["text-max-angle"]),"text-writing-mode":new Ze(_e.layout_symbol["text-writing-mode"]),"text-rotate":new Ye(_e.layout_symbol["text-rotate"]),"text-padding":new Ze(_e.layout_symbol["text-padding"]),"text-keep-upright":new Ze(_e.layout_symbol["text-keep-upright"]),"text-transform":new Ye(_e.layout_symbol["text-transform"]),"text-offset":new Ye(_e.layout_symbol["text-offset"]),"text-allow-overlap":new Ze(_e.layout_symbol["text-allow-overlap"]),"text-overlap":new Ze(_e.layout_symbol["text-overlap"]),"text-ignore-placement":new Ze(_e.layout_symbol["text-ignore-placement"]),"text-optional":new Ze(_e.layout_symbol["text-optional"])});var Tc={paint:new mi({"icon-opacity":new Ye(_e.paint_symbol["icon-opacity"]),"icon-color":new Ye(_e.paint_symbol["icon-color"]),"icon-halo-color":new Ye(_e.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ye(_e.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ye(_e.paint_symbol["icon-halo-blur"]),"icon-translate":new Ze(_e.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ze(_e.paint_symbol["icon-translate-anchor"]),"text-opacity":new Ye(_e.paint_symbol["text-opacity"]),"text-color":new Ye(_e.paint_symbol["text-color"],{runtimeType:fi,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new Ye(_e.paint_symbol["text-halo-color"]),"text-halo-width":new Ye(_e.paint_symbol["text-halo-width"]),"text-halo-blur":new Ye(_e.paint_symbol["text-halo-blur"]),"text-translate":new Ze(_e.paint_symbol["text-translate"]),"text-translate-anchor":new Ze(_e.paint_symbol["text-translate-anchor"])}),layout:uf};class oh{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:Or,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}}$e("FormatSectionOverride",oh,{omit:["defaultValue"]});class gl extends hr{constructor(e){super(e,Tc)}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),d=this._unevaluatedLayout._values[e];return d.isDataDriven()||io(d.value)||!h?h:function(m,g){return g.replace(/{([^{}]+)}/g,(x,T)=>T in m?String(m[T]):"")}(r.properties,h)}createBucket(e){return new is(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of Tc.paint.overridableProperties){if(!gl.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),o=new oh(r),c=new Oo(o,r.property.specification);let h=null;h=r.value.kind==="constant"||r.value.kind==="source"?new no("source",c):new Is("composite",c,r.value.zoomStops),this.paint._values[e]=new ur(r.property,h,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,o){return!(!this.layout||r.isDataDriven()||o.isDataDriven())&&gl.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const o=e.get("text-field"),c=Tc.paint.properties[r];let h=!1;const d=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 W)d(o.value.value.sections);else if(o.value.kind==="source"){const m=x=>{h||(x instanceof qe&&pe(x.value)===oi?d(x.value.sections):x instanceof Bo?d(x.sections):x.eachChild(m))},g=o.value;g._styleExpression&&m(g._styleExpression.expression)}return h}}function Ec(i,e,r){let o="never";const c=i.get(e);return c?o=c:i.get(r)&&(o="always"),o}var hf={paint:new mi({"background-color":new Ze(_e.paint_background["background-color"]),"background-pattern":new Os(_e.paint_background["background-pattern"]),"background-opacity":new Ze(_e.paint_background["background-opacity"])})},pf={paint:new mi({"raster-opacity":new Ze(_e.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ze(_e.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ze(_e.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ze(_e.paint_raster["raster-brightness-max"]),"raster-saturation":new Ze(_e.paint_raster["raster-saturation"]),"raster-contrast":new Ze(_e.paint_raster["raster-contrast"]),"raster-resampling":new Ze(_e.paint_raster["raster-resampling"]),"raster-fade-duration":new Ze(_e.paint_raster["raster-fade-duration"])})};class df extends hr{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 ff={circle:class extends hr{constructor(i){super(i,qp)}createBucket(i){return new Jl(i)}queryRadius(i){const e=i;return Gs("circle-radius",this,e)+Gs("circle-stroke-width",this,e)+Qa(this.paint.get("circle-translate"))}queryIntersectsFeature(i,e,r,o,c,h,d,m){const g=el(i,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),h.angle,d),x=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),T=this.paint.get("circle-pitch-alignment")==="map",S=T?g:function(D,L){return D.map(Z=>gu(Z,L))}(g,m),P=T?x*d:x;for(const D of o)for(const L of D){const Z=T?L:gu(L,m);let q=P;const re=tl([],[L.x,L.y,0,1],m);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?q*=re[3]/h.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(q*=h.cameraToCenterDistance/re[3]),Up(S,Z,q))return!0}return!1}},heatmap:class extends hr{constructor(i){super(i,jp),this._updateColorRamp()}createBucket(i){return new _u(i)}_handleSpecialPaintPropertyUpdate(i){i==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=xu({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 hr{constructor(i){super(i,Xp)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}},fill:class extends hr{constructor(i){super(i,cd)}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 cc(i)}queryRadius(){return Qa(this.paint.get("fill-translate"))}queryIntersectsFeature(i,e,r,o,c,h,d){return lu(el(i,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),h.angle,d),o)}isTileClipped(){return!0}},"fill-extrusion":class extends hr{constructor(i){super(i,Td)}createBucket(i){return new hc(i)}queryRadius(){return Qa(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(i,e,r,o,c,h,d,m){const g=el(i,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),h.angle,d),x=this.paint.get("fill-extrusion-height").evaluate(e,r),T=this.paint.get("fill-extrusion-base").evaluate(e,r),S=function(D,L,Z,q){const re=[];for(const ce of D){const te=[ce.x,ce.y,0,1];tl(te,te,L),re.push(new tt(te[0]/te[3],te[1]/te[3]))}return re}(g,m),P=function(D,L,Z,q){const re=[],ce=[],te=q[8]*L,ae=q[9]*L,xe=q[10]*L,ye=q[11]*L,Ue=q[8]*Z,Ge=q[9]*Z,Le=q[10]*Z,Pe=q[11]*Z;for(const Ee of D){const Re=[],ke=[];for(const Te of Ee){const He=Te.x,je=Te.y,dt=q[0]*He+q[4]*je+q[12],Ut=q[1]*He+q[5]*je+q[13],Zt=q[2]*He+q[6]*je+q[14],ni=q[3]*He+q[7]*je+q[15],nr=Zt+xe,yi=ni+ye,ei=dt+Ue,ui=Ut+Ge,xi=Zt+Le,Ti=ni+Pe,Ui=new tt((dt+te)/yi,(Ut+ae)/yi);Ui.z=nr/yi,Re.push(Ui);const ti=new tt(ei/Ti,ui/Ti);ti.z=xi/Ti,ke.push(ti)}re.push(Re),ce.push(ke)}return[re,ce]}(o,T,x,m);return function(D,L,Z){let q=1/0;lu(Z,L)&&(q=Au(Z,L[0]));for(let re=0;re<L.length;re++){const ce=L[re],te=D[re];for(let ae=0;ae<ce.length-1;ae++){const xe=ce[ae],ye=[xe,ce[ae+1],te[ae+1],te[ae],xe];au(Z,ye)&&(q=Math.min(q,Au(Z,ye)))}}return q!==1/0&&q}(P[0],P[1],S)}},line:class extends hr{constructor(i){super(i,Pu),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(i){i==="line-gradient"&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof Jn,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"]=zu.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,i)}createBucket(i){return new pc(i)}queryRadius(i){const e=i,r=ku(Gs("line-width",this,e),Gs("line-gap-width",this,e)),o=Gs("line-offset",this,e);return r/2+Math.abs(o)+Qa(this.paint.get("line-translate"))}queryIntersectsFeature(i,e,r,o,c,h,d){const m=el(i,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),h.angle,d),g=d/2*ku(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),x=this.paint.get("line-offset").evaluate(e,r);return x&&(o=function(T,S){const P=[];for(let D=0;D<T.length;D++){const L=T[D],Z=[];for(let q=0;q<L.length;q++){const re=L[q-1],ce=L[q],te=L[q+1],ae=q===0?new tt(0,0):ce.sub(re)._unit()._perp(),xe=q===L.length-1?new tt(0,0):te.sub(ce)._unit()._perp(),ye=ae._add(xe)._unit(),Ue=ye.x*xe.x+ye.y*xe.y;Ue!==0&&ye._mult(1/Ue),Z.push(ye._mult(S)._add(ce))}P.push(Z)}return P}(o,x*d)),function(T,S,P){for(let D=0;D<S.length;D++){const L=S[D];if(T.length>=3){for(let Z=0;Z<L.length;Z++)if(Ho(T,L[Z]))return!0}if($p(T,L,P))return!0}return!1}(m,o,g)}isTileClipped(){return!0}},symbol:gl,background:class extends hr{constructor(i){super(i,hf)}},raster:class extends hr{constructor(i){super(i,pf)}}};class mf{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 sh=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(Se(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 sh*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 To(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 To{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 To))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(To.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 To?e:e&&new To(e)}}const ah=2*Math.PI*sh;function lh(i){return ah*Math.cos(i*Math.PI/180)}function ch(i){return(180+i)/360}function uh(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function hh(i,e){return i/lh(e)}function Sc(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class _l{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 _l(ch(o.lng),uh(o.lat),hh(r,o.lat))}toLngLat(){return new Kt(360*this.x-180,Sc(this.y))}toAltitude(){return this.z*lh(Sc(this.y))}meterInMercatorCoordinateUnits(){return 1/ah*(e=Sc(this.y),1/Math.cos(e*Math.PI/180));var e}}function ph(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 Ic{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=(d=this.y,m=this.z,g=ph(256*(h=this.x),256*(d=Math.pow(2,m)-d-1),m),x=ph(256*(h+1),256*(d+1),m),g[0]+","+g[1]+","+x[0]+","+x[1]);var h,d,m,g,x;const T=function(S,P,D){let L,Z="";for(let q=S;q>0;q--)L=1<<q-1,Z+=(P&L?1:0)+(D&L?2:0);return Z}(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,T).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 tt((e.x*r-this.x)*ri,(e.y*r-this.y)*ri)}toString(){return`${this.z}/${this.x}/${this.y}`}}class dh{constructor(e,r){this.wrap=e,this.canonical=r,this.key=ea(e,r.z,r.z,r.x,r.y)}}class rr{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 Ic(o,+c,+h),this.key=ea(r,e,o,c,h)}clone(){return new rr(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 rr(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new rr(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 rr(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 rr(r,this.wrap,r,o,c),new rr(r,this.wrap,r,o+1,c),new rr(r,this.wrap,r,o,c+1),new rr(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 rr(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new rr(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 dh(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new _l(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)}$e("CanonicalTileID",Ic),$e("OverscaledTileID",rr,{omit:["posMatrix"]});class fh{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 ot(`"${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 d=0;d<c;d++){const m=this.get(h,d);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 ir({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,d=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:d=m-1;break;case 1:m=d+1}const g=-r*this.dim,x=-o*this.dim;for(let T=d;T<m;T++)for(let S=c;S<h;S++)this.data[this._idx(S,T)]=e.data[this._idx(S+g,T+x)]}}$e("DEMData",fh);class mh{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 gh{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 _h{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new mo(ri,16,0),this.grid3D=new mo(ri,16,0),this.featureIndexArray=new pt,this.promoteId=r}insert(e,r,o,c,h,d){const m=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(o,c,h);const g=d?this.grid3D:this.grid;for(let x=0;x<r.length;x++){const T=r[x],S=[1/0,1/0,-1/0,-1/0];for(let P=0;P<T.length;P++){const D=T[P];S[0]=Math.min(S[0],D.x),S[1]=Math.min(S[1],D.y),S[2]=Math.max(S[2],D.x),S[3]=Math.max(S[3],D.y)}S[0]<ri&&S[1]<ri&&S[2]>=0&&S[3]>=0&&g.insert(m,S[0],S[1],S[2],S[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Un.VectorTile(new dc(this.rawTileData)).layers,this.sourceLayerCoder=new mh(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,o,c){this.loadVTLayers();const h=e.params||{},d=ri/e.tileSize/e.scale,m=Vo(h.filter),g=e.queryGeometry,x=e.queryPadding*d,T=xh(g),S=this.grid.query(T.minX-x,T.minY-x,T.maxX+x,T.maxY+x),P=xh(e.cameraQueryGeometry),D=this.grid3D.query(P.minX-x,P.minY-x,P.maxX+x,P.maxY+x,(q,re,ce,te)=>function(ae,xe,ye,Ue,Ge){for(const Pe of ae)if(xe<=Pe.x&&ye<=Pe.y&&Ue>=Pe.x&&Ge>=Pe.y)return!0;const Le=[new tt(xe,ye),new tt(xe,Ge),new tt(Ue,Ge),new tt(Ue,ye)];if(ae.length>2){for(const Pe of Le)if(Ho(ae,Pe))return!0}for(let Pe=0;Pe<ae.length-1;Pe++)if(Np(ae[Pe],ae[Pe+1],Le))return!0;return!1}(e.cameraQueryGeometry,q-x,re-x,ce+x,te+x));for(const q of D)S.push(q);S.sort(gf);const L={};let Z;for(let q=0;q<S.length;q++){const re=S[q];if(re===Z)continue;Z=re;const ce=this.featureIndexArray.get(re);let te=null;this.loadMatchingFeature(L,ce.bucketIndex,ce.sourceLayerIndex,ce.featureIndex,m,h.layers,h.availableImages,r,o,c,(ae,xe,ye)=>(te||(te=vo(ae)),xe.queryIntersectsFeature(g,ae,ye,te,this.z,e.transform,d,e.pixelPosMatrix)))}return L}loadMatchingFeature(e,r,o,c,h,d,m,g,x,T,S){const P=this.bucketLayerIDs[r];if(d&&!function(q,re){for(let ce=0;ce<q.length;ce++)if(re.indexOf(q[ce])>=0)return!0;return!1}(d,P))return;const D=this.sourceLayerCoder.decode(o),L=this.vtLayers[D].feature(c);if(h.needGeometry){const q=bo(L,!0);if(!h.filter(new Gt(this.tileID.overscaledZ),q,this.tileID.canonical))return}else if(!h.filter(new Gt(this.tileID.overscaledZ),L))return;const Z=this.getId(L,D);for(let q=0;q<P.length;q++){const re=P[q];if(d&&d.indexOf(re)<0)continue;const ce=g[re];if(!ce)continue;let te={};Z&&T&&(te=T.getState(ce.sourceLayer||"_geojsonTileLayer",Z));const ae=Ie({},x[re]);ae.paint=yh(ae.paint,ce.paint,L,te,m),ae.layout=yh(ae.layout,ce.layout,L,te,m);const xe=!S||S(L,ce,te);if(!xe)continue;const ye=new gh(L,this.z,this.x,this.y,Z);ye.layer=ae;let Ue=e[re];Ue===void 0&&(Ue=e[re]=[]),Ue.push({featureIndex:c,feature:ye,intersectionZ:xe})}}lookupSymbolFeatures(e,r,o,c,h,d,m,g){const x={};this.loadVTLayers();const T=Vo(h);for(const S of e)this.loadMatchingFeature(x,o,c,S,T,d,m,g,r);return x}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 yh(i,e,r,o,c){return Xe(i,(h,d)=>{const m=e instanceof yo?e.get(d):null;return m&&m.evaluate?m.evaluate(r,o,c):m})}function xh(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 gf(i,e){return e-i}var Cc;$e("FeatureIndex",_h,{omit:["rawTileData","sourceLayerCoder"]}),a.PerformanceMarkers=void 0,(Cc=a.PerformanceMarkers||(a.PerformanceMarkers={})).create="create",Cc.load="load",Cc.fullLoad="fullLoad";let yl=null,ta=[];const Ac=1e3/30,_f={mark(i){performance.mark(i)},frame(i){const e=i;yl!=null&&ta.push(e-yl),yl=e},clearMetrics(){yl=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,d)=>h+d,0)/r/1e3),c=ta.filter(h=>h>Ac).reduce((h,d)=>h+(d-Ac)/Ac,0);return{loadTime:i,fullLoadTime:e,fps:o,percentDroppedFrames:c/(r+c)*100}}};a.AJAXError=Di,a.ARRAY_TYPE=Pi,a.Actor=class{constructor(i,e,r){this.target=i,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},Ke(["receive","process"],this),this.invoker=new mf(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=ct()?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 d=Hi(this.globalScope)?void 0:[];return this.target.postMessage({id:h,type:i,hasCallback:!!r,targetMapId:o,mustQueue:c,sourceMapId:this.mapId,data:nn(e,d)},d),{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 ct()||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(Vr(e.error)):r(null,Vr(e.data)))}else{let r=!1;const o=Hi(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?nn(m):null,data:nn(g,o)},o)}:m=>{r=!0};let h=null;const d=Vr(e.data);if(this.parent[e.type])h=this.parent[e.type](e.sourceMapId,d,c);else if(this.parent.getWorkerSource){const m=e.type.split(".");h=this.parent.getWorkerSource(e.sourceMapId,m[0],d.source)[m[1]](d,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=Zs,a.CanonicalTileID=Ic,a.CollisionBoxArray=me,a.CollisionCircleLayoutArray=class extends E{},a.Color=F,a.DEMData=fh,a.DataConstantProperty=Ze,a.DictionaryCoder=mh,a.EXTENT=ri,a.ErrorEvent=bn,a.EvaluationParameters=Gt,a.Event=br,a.Evented=wr,a.FeatureIndex=_h,a.FillBucket=cc,a.FillExtrusionBucket=hc,a.GeoJSONFeature=gh,a.ImageAtlas=Vu,a.ImagePosition=mc,a.LineBucket=pc,a.LineStripIndexArray=class extends G{},a.LngLat=Kt,a.LngLatBounds=To,a.MercatorCoordinate=_l,a.ONE_EM=gi,a.OverscaledTileID=rr,a.PerformanceUtils=_f,a.PosArray=We,a.Properties=mi,a.QuadTriangleArray=class extends z{},a.RGBAImage=ir,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=xr,a.SegmentVector=mt,a.SymbolBucket=is,a.Transitionable=Xa,a.TriangleIndexArray=Ai,a.Uniform1f=ln,a.Uniform1i=class extends an{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 an{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 an{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=Xo,a.UniformColor=ru,a.UniformMatrix4f=class extends an{constructor(i,e){super(i,e),this.current=Fp}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=dh,a.ValidationError=ze,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=vc,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((d,m)=>{e(d,(g,x)=>{g&&(h=g),c[m]=x,--o==0&&r(h,c)})})},a.bezier=he,a.bindAll=Ke,a.cacheEntryPossiblyAdded=function(i){ar++,ar>gn&&(i.getActor().send("enforceCacheSizeLimit",mn),ar=0)},a.clamp=ee,a.clearTileCache=function(i){const e=caches.delete(Ji);i&&e.catch(i).then(()=>i())},a.clipLine=Qu,a.clone=function(i){var e=new Pi(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=lt,a.clone$2=function(i){var e=new Pi(3);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e},a.collisionCircleLayout=Ld,a.config=yr,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 Pi(16);return Pi!=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=hu,a.createExpression=ro,a.createFilter=Vo,a.createLayout=Qt,a.createStyleLayer=function(i){return i.type==="custom"?new df(i):new ff[i.type](i)},a.cross=function(i,e,r){var o=e[0],c=e[1],h=e[2],d=r[0],m=r[1],g=r[2];return i[0]=c*g-h*m,i[1]=h*d-o*g,i[2]=o*m-c*d,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=ue,a.emitValidationErrors=Go,a.enforceCacheSizeLimit=function(i){_n(),Yi&&Yi.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],d=i[4],m=i[5],g=i[6],x=i[7],T=i[8],S=i[9],P=i[10],D=i[11],L=i[12],Z=i[13],q=i[14],re=i[15],ce=e[0],te=e[1],ae=e[2],xe=e[3],ye=e[4],Ue=e[5],Ge=e[6],Le=e[7],Pe=e[8],Ee=e[9],Re=e[10],ke=e[11],Te=e[12],He=e[13],je=e[14],dt=e[15];return Math.abs(r-ce)<=Mi*Math.max(1,Math.abs(r),Math.abs(ce))&&Math.abs(o-te)<=Mi*Math.max(1,Math.abs(o),Math.abs(te))&&Math.abs(c-ae)<=Mi*Math.max(1,Math.abs(c),Math.abs(ae))&&Math.abs(h-xe)<=Mi*Math.max(1,Math.abs(h),Math.abs(xe))&&Math.abs(d-ye)<=Mi*Math.max(1,Math.abs(d),Math.abs(ye))&&Math.abs(m-Ue)<=Mi*Math.max(1,Math.abs(m),Math.abs(Ue))&&Math.abs(g-Ge)<=Mi*Math.max(1,Math.abs(g),Math.abs(Ge))&&Math.abs(x-Le)<=Mi*Math.max(1,Math.abs(x),Math.abs(Le))&&Math.abs(T-Pe)<=Mi*Math.max(1,Math.abs(T),Math.abs(Pe))&&Math.abs(S-Ee)<=Mi*Math.max(1,Math.abs(S),Math.abs(Ee))&&Math.abs(P-Re)<=Mi*Math.max(1,Math.abs(P),Math.abs(Re))&&Math.abs(D-ke)<=Mi*Math.max(1,Math.abs(D),Math.abs(ke))&&Math.abs(L-Te)<=Mi*Math.max(1,Math.abs(L),Math.abs(Te))&&Math.abs(Z-He)<=Mi*Math.max(1,Math.abs(Z),Math.abs(He))&&Math.abs(q-je)<=Mi*Math.max(1,Math.abs(q),Math.abs(je))&&Math.abs(re-dt)<=Mi*Math.max(1,Math.abs(re),Math.abs(dt))},a.evaluateSizeForFeature=function(i,{uSize:e,uSizeT:r},{lowerSize:o,upperSize:c}){return i.kind==="source"?o/hn:i.kind==="composite"?Vt(o/hn,c/hn,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:d}=i,m=c?ee(Bi.interpolationFactor(c,e,h,d),0,1):0;i.kind==="camera"?o=Vt(i.minSize,i.maxSize,m):r=m}return{uSizeT:r,uSize:o}},a.evaluateVariableOffset=ih,a.evented=Fs,a.exported=zr,a.exported$1=kr,a.extend=Ie,a.filterObject=Qe,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=_c,a.getAnchorJustification=xc,a.getArrayBuffer=vn,a.getImage=Fr,a.getJSON=function(i,e){return xn(Ie(i,{type:"json"}),e)},a.getOverlapMode=Ec,a.getRTLTextPluginStatus=go,a.getReferrer=jn,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");Xn(i[o])||(r.crossOrigin="Anonymous"),c.src=i[o],r.appendChild(c)}return{cancel:()=>{}}},a.identity=ec,a.invert=function(i,e){var r=e[0],o=e[1],c=e[2],h=e[3],d=e[4],m=e[5],g=e[6],x=e[7],T=e[8],S=e[9],P=e[10],D=e[11],L=e[12],Z=e[13],q=e[14],re=e[15],ce=r*m-o*d,te=r*g-c*d,ae=r*x-h*d,xe=o*g-c*m,ye=o*x-h*m,Ue=c*x-h*g,Ge=T*Z-S*L,Le=T*q-P*L,Pe=T*re-D*L,Ee=S*q-P*Z,Re=S*re-D*Z,ke=P*re-D*q,Te=ce*ke-te*Re+ae*Ee+xe*Pe-ye*Le+Ue*Ge;return Te?(i[0]=(m*ke-g*Re+x*Ee)*(Te=1/Te),i[1]=(c*Re-o*ke-h*Ee)*Te,i[2]=(Z*Ue-q*ye+re*xe)*Te,i[3]=(P*ye-S*Ue-D*xe)*Te,i[4]=(g*Pe-d*ke-x*Le)*Te,i[5]=(r*ke-c*Pe+h*Le)*Te,i[6]=(q*ae-L*Ue-re*te)*Te,i[7]=(T*Ue-P*ae+D*te)*Te,i[8]=(d*Re-m*Pe+x*Ge)*Te,i[9]=(o*Pe-r*Re-h*Ge)*Te,i[10]=(L*ye-Z*ae+re*ce)*Te,i[11]=(S*ae-T*ye-D*ce)*Te,i[12]=(m*Le-d*Ee-g*Ge)*Te,i[13]=(r*Ee-o*Le+c*Ge)*Te,i[14]=(Z*te-L*xe-q*ce)*Te,i[15]=(T*xe-S*te+P*ce)*Te,i):null},a.isImageBitmap=Ki,a.isSafari=Hi,a.isWorker=ct,a.keysDifference=function(i,e){const r=[];for(const o in i)o in e||r.push(o);return r},a.lazyLoadRTLTextPlugin=function(){Zi.isLoading()||Zi.isLoaded()||go()!=="deferred"||ja()},a.makeRequest=xn,a.mapObject=Xe,a.mercatorXfromLng=ch,a.mercatorYfromLat=uh,a.mercatorZfromAltitude=hh,a.mul=Zp,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=pu,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=Vt,a.ortho=function(i,e,r,o,c,h,d){var m=1/(e-r),g=1/(o-c),x=1/(h-d);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*x,i[11]=0,i[12]=(e+r)*m,i[13]=(c+o)*g,i[14]=(d+h)*x,i[15]=1,i},a.parseCacheControl=Xt,a.parseGlyphPbf=function(i){return new dc(i).readFields(Zd,[])},a.pbf=dc,a.performSymbolLayout=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=ri/(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 Gt(i.bucket.zoom+1),i.canonical),layoutTextSize:r["text-size"].possiblyEvaluate(new Gt(i.bucket.zoom+1),i.canonical),textMaxSize:r["text-size"].possiblyEvaluate(new Gt(18))};if(i.bucket.textSizeData.kind==="composite"){const{minZoom:g,maxZoom:x}=i.bucket.textSizeData;o.compositeTextSizes=[r["text-size"].possiblyEvaluate(new Gt(g),i.canonical),r["text-size"].possiblyEvaluate(new Gt(x),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){const{minZoom:g,maxZoom:x}=i.bucket.iconSizeData;o.compositeIconSizes=[r["icon-size"].possiblyEvaluate(new Gt(g),i.canonical),r["icon-size"].possiblyEvaluate(new Gt(x),i.canonical)]}const c=e.get("text-line-height")*gi,h=e.get("text-rotation-alignment")!=="viewport"&&e.get("symbol-placement")!=="point",d=e.get("text-keep-upright"),m=e.get("text-size");for(const g of i.bucket.features){const x=e.get("text-font").evaluate(g,{},i.canonical).join(","),T=m.evaluate(g,{},i.canonical),S=o.layoutTextSize.evaluate(g,{},i.canonical),P=o.layoutIconSize.evaluate(g,{},i.canonical),D={horizontal:{},vertical:void 0},L=g.text;let Z,q=[0,0];if(L){const te=L.toString(),ae=e.get("text-letter-spacing").evaluate(g,{},i.canonical)*gi,xe=jl(te)?ae:0,ye=e.get("text-anchor").evaluate(g,{},i.canonical),Ue=e.get("text-variable-anchor");if(!Ue){const Re=e.get("text-radial-offset").evaluate(g,{},i.canonical);q=Re?ih(ye,[Re*gi,yc]):e.get("text-offset").evaluate(g,{},i.canonical).map(ke=>ke*gi)}let Ge=h?"center":e.get("text-justify").evaluate(g,{},i.canonical);const Le=e.get("symbol-placement"),Pe=Le==="point"?e.get("text-max-width").evaluate(g,{},i.canonical)*gi:0,Ee=()=>{i.bucket.allowVerticalPlacement&&qo(te)&&(D.vertical=cl(L,i.glyphMap,i.glyphPositions,i.imagePositions,x,Pe,c,ye,"left",xe,q,a.WritingMode.vertical,!0,Le,S,T))};if(!h&&Ue){const Re=Ge==="auto"?Ue.map(Te=>xc(Te)):[Ge];let ke=!1;for(let Te=0;Te<Re.length;Te++){const He=Re[Te];if(!D.horizontal[He])if(ke)D.horizontal[He]=D.horizontal[0];else{const je=cl(L,i.glyphMap,i.glyphPositions,i.imagePositions,x,Pe,c,"center",He,xe,q,a.WritingMode.horizontal,!1,Le,S,T);je&&(D.horizontal[He]=je,ke=je.positionedLines.length===1)}}Ee()}else{Ge==="auto"&&(Ge=xc(ye));const Re=cl(L,i.glyphMap,i.glyphPositions,i.imagePositions,x,Pe,c,ye,Ge,xe,q,a.WritingMode.horizontal,!1,Le,S,T);Re&&(D.horizontal[Ge]=Re),Ee(),qo(te)&&h&&d&&(D.vertical=cl(L,i.glyphMap,i.glyphPositions,i.imagePositions,x,Pe,c,ye,Ge,xe,q,a.WritingMode.vertical,!1,Le,S,T))}}let re=!1;if(g.icon&&g.icon.name){const te=i.imageMap[g.icon.name];te&&(Z=Jd(i.imagePositions[g.icon.name],e.get("icon-offset").evaluate(g,{},i.canonical),e.get("icon-anchor").evaluate(g,{},i.canonical)),re=!!te.sdf,i.bucket.sdfIcons===void 0?i.bucket.sdfIcons=re:i.bucket.sdfIcons!==re&&ot("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(te.pixelRatio!==i.bucket.pixelRatio||e.get("icon-rotate").constantOr(1)!==0)&&(i.bucket.iconsNeedLinear=!0))}const ce=nh(D.horizontal)||D.vertical;i.bucket.iconsInText=!!ce&&ce.iconsInText,(ce||Z)&&of(i.bucket,g,D,Z,i.imageMap,o,S,P,q,re,i.canonical)}i.showCollisionBoxes&&i.bucket.generateCollisionDebugBuffers()},a.perspective=function(i,e,r,o,c){var h,d=1/Math.tan(e/2);return i[0]=d/r,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=d,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=Zi,a.pointGeometry=tt,a.polygonIntersectsPolygon=au,a.potpack=$u,a.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],a.register=$e,a.registerForPluginStateChange=function(i){return i({pluginStatus:Ci,pluginURL:Nr}),Fs.on("pluginStateChange",i),i},a.renderColorRamp=xu,a.rotateX=function(i,e,r){var o=Math.sin(r),c=Math.cos(r),h=e[4],d=e[5],m=e[6],g=e[7],x=e[8],T=e[9],S=e[10],P=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+x*o,i[5]=d*c+T*o,i[6]=m*c+S*o,i[7]=g*c+P*o,i[8]=x*c-h*o,i[9]=T*c-d*o,i[10]=S*c-m*o,i[11]=P*c-g*o,i},a.rotateZ=function(i,e,r){var o=Math.sin(r),c=Math.cos(r),h=e[0],d=e[1],m=e[2],g=e[3],x=e[4],T=e[5],S=e[6],P=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+x*o,i[1]=d*c+T*o,i[2]=m*c+S*o,i[3]=g*c+P*o,i[4]=x*c-h*o,i[5]=T*c-d*o,i[6]=S*c-m*o,i[7]=P*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){mn=i,gn=e},a.setRTLTextPlugin=function(i,e,r=!1){if(Ci===Ds||Ci===Ls||Ci===Rs)throw new Error("setRTLTextPlugin cannot be called multiple times.");Nr=zr.resolveURL(i),Ci=Ds,Bs=e,Rn(),r||ja()},a.spec=_e,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=bo,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=tl,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,d,m,g,x,T,S,P,D,L,Z=r[0],q=r[1],re=r[2];return e===i?(i[12]=e[0]*Z+e[4]*q+e[8]*re+e[12],i[13]=e[1]*Z+e[5]*q+e[9]*re+e[13],i[14]=e[2]*Z+e[6]*q+e[10]*re+e[14],i[15]=e[3]*Z+e[7]*q+e[11]*re+e[15]):(c=e[1],h=e[2],d=e[3],m=e[4],g=e[5],x=e[6],T=e[7],S=e[8],P=e[9],D=e[10],L=e[11],i[0]=o=e[0],i[1]=c,i[2]=h,i[3]=d,i[4]=m,i[5]=g,i[6]=x,i[7]=T,i[8]=S,i[9]=P,i[10]=D,i[11]=L,i[12]=o*Z+m*q+S*re+e[12],i[13]=c*Z+g*q+P*re+e[13],i[14]=h*Z+x*q+D*re+e[14],i[15]=d*Z+T*q+L*re+e[15]),i},a.triggerPluginCompletionEvent=Za,a.unicodeBlockLookup=De,a.uniqueId=function(){return Ce++},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=fo,a.vectorTile=Un,a.warnOnce=ot,a.wrap=Se}),N(["./shared"],function(a){function Y(O){const w=typeof O;if(w==="number"||w==="boolean"||w==="string"||O==null)return JSON.stringify(O);if(Array.isArray(O)){let F="[";for(const j of O)F+=`${Y(j)},`;return`${F}]`}const A=Object.keys(O).sort();let R="{";for(let F=0;F<A.length;F++)R+=`${JSON.stringify(A[F])}:${Y(O[A[F]])},`;return`${R}}`}function ie(O){let w="";for(const A of a.refProperties)w+=`/${Y(O[A])}`;return w}class he{constructor(w){this.keyCache={},w&&this.replace(w)}replace(w){this._layerConfigs={},this._layers={},this.update(w,[])}update(w,A){for(const F of w){this._layerConfigs[F.id]=F;const j=this._layers[F.id]=a.createStyleLayer(F);j._featureFilter=a.createFilter(j.filter),this.keyCache[F.id]&&delete this.keyCache[F.id]}for(const F of A)delete this.keyCache[F],delete this._layerConfigs[F],delete this._layers[F];this.familiesBySource={};const R=function(F,j){const K={};for(let X=0;X<F.length;X++){const J=j&&j[F[X].id]||ie(F[X]);j&&(j[F[X].id]=J);let de=K[J];de||(de=K[J]=[]),de.push(F[X])}const W=[];for(const X in K)W.push(K[X]);return W}(Object.values(this._layerConfigs),this.keyCache);for(const F of R){const j=F.map(be=>this._layers[be.id]),K=j[0];if(K.visibility==="none")continue;const W=K.source||"";let X=this.familiesBySource[W];X||(X=this.familiesBySource[W]={});const J=K.sourceLayer||"_geojsonTileLayer";let de=X[J];de||(de=X[J]=[]),de.push(j)}}}class ue{constructor(w){const A={},R=[];for(const W in w){const X=w[W],J=A[W]={};for(const de in X){const be=X[+de];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};R.push(pe),J[de]={rect:pe,metrics:be.metrics}}}const{w:F,h:j}=a.potpack(R),K=new a.AlphaImage({width:F||1,height:j||1});for(const W in w){const X=w[W];for(const J in X){const de=X[+J];if(!de||de.bitmap.width===0||de.bitmap.height===0)continue;const be=A[W][J].rect;a.AlphaImage.copy(de.bitmap,K,{x:0,y:0},{x:be.x+1,y:be.y+1},de.bitmap)}}this.image=K,this.positions=A}}a.register("GlyphAtlas",ue);class ee{constructor(w){this.tileID=new a.OverscaledTileID(w.tileID.overscaledZ,w.tileID.wrap,w.tileID.canonical.z,w.tileID.canonical.x,w.tileID.canonical.y),this.uid=w.uid,this.zoom=w.zoom,this.pixelRatio=w.pixelRatio,this.tileSize=w.tileSize,this.source=w.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=w.showCollisionBoxes,this.collectResourceTiming=!!w.collectResourceTiming,this.returnDependencies=!!w.returnDependencies,this.promoteId=w.promoteId}parse(w,A,R,F,j){this.status="parsing",this.data=w,this.collisionBoxArray=new a.CollisionBoxArray;const K=new a.DictionaryCoder(Object.keys(w.layers).sort()),W=new a.FeatureIndex(this.tileID,this.promoteId);W.bucketLayerIDs=[];const X={},J={featureIndex:W,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:R},de=A.familiesBySource[this.source];for(const it in de){const ht=w.layers[it];if(!ht)continue;ht.version===1&&a.warnOnce(`Vector tile source "${this.source}" layer "${it}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Et=K.encode(it),Lt=[];for(let si=0;si<ht.length;si++){const $t=ht.feature(si),_i=W.getId($t,it);Lt.push({feature:$t,id:_i,index:si,sourceLayerIndex:Et})}for(const si of de[it]){const $t=si[0];$t.source!==this.source&&a.warnOnce(`layer.source = ${$t.source} does not equal this.source = ${this.source}`),$t.minzoom&&this.zoom<Math.floor($t.minzoom)||$t.maxzoom&&this.zoom>=$t.maxzoom||$t.visibility!=="none"&&(Se(si,this.zoom,R),(X[$t.id]=$t.createBucket({index:W.bucketLayerIDs.length,layers:si,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Et,sourceID:this.source})).populate(Lt,J,this.tileID.canonical),W.bucketLayerIDs.push(si.map(_i=>_i.id)))}}let be,pe,Ne,qe;const Be=a.mapObject(J.glyphDependencies,it=>Object.keys(it).map(Number));Object.keys(Be).length?F.send("getGlyphs",{uid:this.uid,stacks:Be},(it,ht)=>{be||(be=it,pe=ht,Tt.call(this))}):pe={};const Je=Object.keys(J.iconDependencies);Je.length?F.send("getImages",{icons:Je,source:this.source,tileID:this.tileID,type:"icons"},(it,ht)=>{be||(be=it,Ne=ht,Tt.call(this))}):Ne={};const et=Object.keys(J.patternDependencies);function Tt(){if(be)return j(be);if(pe&&Ne&&qe){const it=new ue(pe),ht=new a.ImageAtlas(Ne,qe);for(const Et in X){const Lt=X[Et];Lt instanceof a.SymbolBucket?(Se(Lt.layers,this.zoom,R),a.performSymbolLayout({bucket:Lt,glyphMap:pe,glyphPositions:it.positions,imageMap:Ne,imagePositions:ht.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Lt.hasPattern&&(Lt instanceof a.LineBucket||Lt instanceof a.FillBucket||Lt instanceof a.FillExtrusionBucket)&&(Se(Lt.layers,this.zoom,R),Lt.addFeatures(J,this.tileID.canonical,ht.patternPositions))}this.status="done",j(null,{buckets:Object.values(X).filter(Et=>!Et.isEmpty()),featureIndex:W,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:it.image,imageAtlas:ht,glyphMap:this.returnDependencies?pe:null,iconMap:this.returnDependencies?Ne:null,glyphPositions:this.returnDependencies?it.positions:null})}}et.length?F.send("getImages",{icons:et,source:this.source,tileID:this.tileID,type:"patterns"},(it,ht)=>{be||(be=it,qe=ht,Tt.call(this))}):qe={},Tt.call(this)}}function Se(O,w,A){const R=new a.EvaluationParameters(w);for(const F of O)F.recalculate(R,A)}function Ie(O,w){const A=a.getArrayBuffer(O.request,(R,F,j,K)=>{R?w(R):F&&w(null,{vectorTile:new a.vectorTile.VectorTile(new a.pbf(F)),rawData:F,cacheControl:j,expires:K})});return()=>{A.cancel(),w()}}class Ce{constructor(w,A,R,F){this.actor=w,this.layerIndex=A,this.availableImages=R,this.loadVectorData=F||Ie,this.loading={},this.loaded={}}loadTile(w,A){const R=w.uid;this.loading||(this.loading={});const F=!!(w&&w.request&&w.request.collectResourceTiming)&&new a.RequestPerformance(w.request),j=this.loading[R]=new ee(w);j.abort=this.loadVectorData(w,(K,W)=>{if(delete this.loading[R],K||!W)return j.status="done",this.loaded[R]=j,A(K);const X=W.rawData,J={};W.expires&&(J.expires=W.expires),W.cacheControl&&(J.cacheControl=W.cacheControl);const de={};if(F){const be=F.finish();be&&(de.resourceTiming=JSON.parse(JSON.stringify(be)))}j.vectorTile=W.vectorTile,j.parse(W.vectorTile,this.layerIndex,this.availableImages,this.actor,(be,pe)=>{if(be||!pe)return A(be);A(null,a.extend({rawTileData:X.slice(0)},pe,J,de))}),this.loaded=this.loaded||{},this.loaded[R]=j})}reloadTile(w,A){const R=this.loaded,F=w.uid,j=this;if(R&&R[F]){const K=R[F];K.showCollisionBoxes=w.showCollisionBoxes;const W=(X,J)=>{const de=K.reloadCallback;de&&(delete K.reloadCallback,K.parse(K.vectorTile,j.layerIndex,this.availableImages,j.actor,de)),A(X,J)};K.status==="parsing"?K.reloadCallback=W:K.status==="done"&&(K.vectorTile?K.parse(K.vectorTile,this.layerIndex,this.availableImages,this.actor,W):W())}}abortTile(w,A){const R=this.loading,F=w.uid;R&&R[F]&&R[F].abort&&(R[F].abort(),delete R[F]),A()}removeTile(w,A){const R=this.loaded,F=w.uid;R&&R[F]&&delete R[F],A()}}class Ke{constructor(){this.loaded={}}loadTile(w,A){const{uid:R,encoding:F,rawImageData:j}=w,K=a.isImageBitmap(j)?this.getImageData(j):j,W=new a.DEMData(R,K,F);this.loaded=this.loaded||{},this.loaded[R]=W,A(null,W)}getImageData(w){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(w.width,w.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=w.width,this.offscreenCanvas.height=w.height,this.offscreenCanvasContext.drawImage(w,0,0,w.width,w.height);const A=this.offscreenCanvasContext.getImageData(-1,-1,w.width+2,w.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new a.RGBAImage({width:A.width,height:A.height},A.data)}removeTile(w){const A=this.loaded,R=w.uid;A&&A[R]&&delete A[R]}}var Xe=function O(w,A){var R,F=w&&w.type;if(F==="FeatureCollection")for(R=0;R<w.features.length;R++)O(w.features[R],A);else if(F==="GeometryCollection")for(R=0;R<w.geometries.length;R++)O(w.geometries[R],A);else if(F==="Feature")O(w.geometry,A);else if(F==="Polygon")Qe(w.coordinates,A);else if(F==="MultiPolygon")for(R=0;R<w.coordinates.length;R++)Qe(w.coordinates[R],A);return w};function Qe(O,w){if(O.length!==0){lt(O[0],w);for(var A=1;A<O.length;A++)lt(O[A],!w)}}function lt(O,w){for(var A=0,R=0,F=0,j=O.length,K=j-1;F<j;K=F++){var W=(O[F][0]-O[K][0])*(O[K][1]+O[F][1]),X=A+W;R+=Math.abs(A)>=Math.abs(W)?A-X+W:W-X+A,A=X}A+R>=0!=!!w&&O.reverse()}const vt=a.vectorTile.VectorTileFeature.prototype.toGeoJSON;class ot{constructor(w){this._feature=w,this.extent=a.EXTENT,this.type=w.type,this.properties=w.tags,"id"in w&&!isNaN(w.id)&&(this.id=parseInt(w.id,10))}loadGeometry(){if(this._feature.type===1){const w=[];for(const A of this._feature.geometry)w.push([new a.pointGeometry(A[0],A[1])]);return w}{const w=[];for(const A of this._feature.geometry){const R=[];for(const F of A)R.push(new a.pointGeometry(F[0],F[1]));w.push(R)}return w}}toGeoJSON(w,A,R){return vt.call(this,w,A,R)}}class gt{constructor(w){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=a.EXTENT,this.length=w.length,this._features=w}feature(w){return new ot(this._features[w])}}var ft={exports:{}},ct=a.pointGeometry,Xt=a.vectorTile.VectorTileFeature,Wt=ki;function ki(O,w){this.options=w||{},this.features=O,this.length=O.length}function di(O,w){this.id=typeof O.id=="number"?O.id:void 0,this.type=O.type,this.rawGeometry=O.type===1?[O.geometry]:O.geometry,this.properties=O.tags,this.extent=w||4096}ki.prototype.feature=function(O){return new di(this.features[O],this.options.extent)},di.prototype.loadGeometry=function(){var O=this.rawGeometry;this.geometry=[];for(var w=0;w<O.length;w++){for(var A=O[w],R=[],F=0;F<A.length;F++)R.push(new ct(A[F][0],A[F][1]));this.geometry.push(R)}return this.geometry},di.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var O=this.geometry,w=1/0,A=-1/0,R=1/0,F=-1/0,j=0;j<O.length;j++)for(var K=O[j],W=0;W<K.length;W++){var X=K[W];w=Math.min(w,X.x),A=Math.max(A,X.x),R=Math.min(R,X.y),F=Math.max(F,X.y)}return[w,R,A,F]},di.prototype.toGeoJSON=Xt.prototype.toGeoJSON;var Hi=a.pbf,Ki=Wt;function zr(O){var w=new Hi;return function(A,R){for(var F in A.layers)R.writeMessage(3,tt,A.layers[F])}(O,w),w.finish()}function tt(O,w){var A;w.writeVarintField(15,O.version||1),w.writeStringField(1,O.name||""),w.writeVarintField(5,O.extent||4096);var R={keys:[],values:[],keycache:{},valuecache:{}};for(A=0;A<O.length;A++)R.feature=O.feature(A),w.writeMessage(2,_r,R);var F=R.keys;for(A=0;A<F.length;A++)w.writeStringField(3,F[A]);var j=R.values;for(A=0;A<j.length;A++)w.writeMessage(4,mn,j[A])}function _r(O,w){var A=O.feature;A.id!==void 0&&w.writeVarintField(1,A.id),w.writeMessage(2,yr,O),w.writeVarintField(3,A.type),w.writeMessage(4,Hr,A)}function yr(O,w){var A=O.feature,R=O.keys,F=O.values,j=O.keycache,K=O.valuecache;for(var W in A.properties){var X=A.properties[W],J=j[W];if(X!==null){J===void 0&&(R.push(W),j[W]=J=R.length-1),w.writeVarint(J);var de=typeof X;de!=="string"&&de!=="boolean"&&de!=="number"&&(X=JSON.stringify(X));var be=de+":"+X,pe=K[be];pe===void 0&&(F.push(X),K[be]=pe=F.length-1),w.writeVarint(pe)}}}function Ji(O,w){return(w<<3)+(7&O)}function Yi(O){return O<<1^O>>31}function Hr(O,w){for(var A=O.loadGeometry(),R=O.type,F=0,j=0,K=A.length,W=0;W<K;W++){var X=A[W],J=1;R===1&&(J=X.length),w.writeVarint(Ji(1,J));for(var de=R===3?X.length-1:X.length,be=0;be<de;be++){be===1&&R!==1&&w.writeVarint(Ji(2,de-1));var pe=X[be].x-F,Ne=X[be].y-j;w.writeVarint(Yi(pe)),w.writeVarint(Yi(Ne)),F+=pe,j+=Ne}R===3&&w.writeVarint(Ji(7,1))}}function mn(O,w){var A=typeof O;A==="string"?w.writeStringField(1,O):A==="boolean"?w.writeBooleanField(7,O):A==="number"&&(O%1!=0?w.writeDoubleField(3,O):O<0?w.writeSVarintField(6,O):w.writeVarintField(5,O))}function gn(O,w,A,R,F,j){if(F-R<=A)return;const K=R+F>>1;_n(O,w,K,R,F,j%2),gn(O,w,A,R,K-1,j+1),gn(O,w,A,K+1,F,j+1)}function _n(O,w,A,R,F,j){for(;F>R;){if(F-R>600){const J=F-R+1,de=A-R+1,be=Math.log(J),pe=.5*Math.exp(2*be/3),Ne=.5*Math.sqrt(be*pe*(J-pe)/J)*(de-J/2<0?-1:1);_n(O,w,A,Math.max(R,Math.floor(A-de*pe/J+Ne)),Math.min(F,Math.floor(A+(J-de)*pe/J+Ne)),j)}const K=w[2*A+j];let W=R,X=F;for(ar(O,w,R,A),w[2*F+j]>K&&ar(O,w,R,F);W<X;){for(ar(O,w,W,X),W++,X--;w[2*W+j]<K;)W++;for(;w[2*X+j]>K;)X--}w[2*R+j]===K?ar(O,w,R,X):(X++,ar(O,w,X,F)),X<=A&&(R=X+1),A<=X&&(F=X-1)}}function ar(O,w,A,R){kr(O,A,R),kr(w,2*A,2*R),kr(w,2*A+1,2*R+1)}function kr(O,w,A){const R=O[w];O[w]=O[A],O[A]=R}function Dr(O,w,A,R){const F=O-A,j=w-R;return F*F+j*j}ft.exports=zr,ft.exports.fromVectorTileJs=zr,ft.exports.fromGeojsonVt=function(O,w){w=w||{};var A={};for(var R in O)A[R]=new Ki(O[R].features,w),A[R].name=R,A[R].version=w.version,A[R].extent=w.extent;return zr({layers:A})},ft.exports.GeoJSONWrapper=Ki;const Lr=O=>O[0],Ii=O=>O[1];class yn{constructor(w,A=Lr,R=Ii,F=64,j=Float64Array){this.nodeSize=F,this.points=w;const K=w.length<65536?Uint16Array:Uint32Array,W=this.ids=new K(w.length),X=this.coords=new j(2*w.length);for(let J=0;J<w.length;J++)W[J]=J,X[2*J]=A(w[J]),X[2*J+1]=R(w[J]);gn(W,X,F,0,W.length-1,0)}range(w,A,R,F){return function(j,K,W,X,J,de,be){const pe=[0,j.length-1,0],Ne=[];let qe,Be;for(;pe.length;){const Je=pe.pop(),et=pe.pop(),Tt=pe.pop();if(et-Tt<=be){for(let Et=Tt;Et<=et;Et++)qe=K[2*Et],Be=K[2*Et+1],qe>=W&&qe<=J&&Be>=X&&Be<=de&&Ne.push(j[Et]);continue}const it=Math.floor((Tt+et)/2);qe=K[2*it],Be=K[2*it+1],qe>=W&&qe<=J&&Be>=X&&Be<=de&&Ne.push(j[it]);const ht=(Je+1)%2;(Je===0?W<=qe:X<=Be)&&(pe.push(Tt),pe.push(it-1),pe.push(ht)),(Je===0?J>=qe:de>=Be)&&(pe.push(it+1),pe.push(et),pe.push(ht))}return Ne}(this.ids,this.coords,w,A,R,F,this.nodeSize)}within(w,A,R){return function(F,j,K,W,X,J){const de=[0,F.length-1,0],be=[],pe=X*X;for(;de.length;){const Ne=de.pop(),qe=de.pop(),Be=de.pop();if(qe-Be<=J){for(let ht=Be;ht<=qe;ht++)Dr(j[2*ht],j[2*ht+1],K,W)<=pe&&be.push(F[ht]);continue}const Je=Math.floor((Be+qe)/2),et=j[2*Je],Tt=j[2*Je+1];Dr(et,Tt,K,W)<=pe&&be.push(F[Je]);const it=(Ne+1)%2;(Ne===0?K-X<=et:W-X<=Tt)&&(de.push(Be),de.push(Je-1),de.push(it)),(Ne===0?K+X>=et:W+X>=Tt)&&(de.push(Je+1),de.push(qe),de.push(it))}return be}(this.ids,this.coords,w,A,R,this.nodeSize)}}const Zn={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:O=>O},xr=Math.fround||(Di=new Float32Array(1),O=>(Di[0]=+O,Di[0]));var Di;class jn{constructor(w){this.options=Fr(Object.create(Zn),w),this.trees=new Array(this.options.maxZoom+1)}load(w){const{log:A,minZoom:R,maxZoom:F,nodeSize:j}=this.options;A&&console.time("total time");const K=`prepare ${w.length} points`;A&&console.time(K),this.points=w;let W=[];for(let X=0;X<w.length;X++)w[X].geometry&&W.push(xn(w[X],X));this.trees[F+1]=new yn(W,Wn,vr,j,Float32Array),A&&console.timeEnd(K);for(let X=F;X>=R;X--){const J=+Date.now();W=this._cluster(W,X),this.trees[X]=new yn(W,Wn,vr,j,Float32Array),A&&console.log("z%d: %d clusters in %dms",X,W.length,+Date.now()-J)}return A&&console.timeEnd("total time"),this}getClusters(w,A){let R=((w[0]+180)%360+360)%360-180;const F=Math.max(-90,Math.min(90,w[1]));let j=w[2]===180?180:((w[2]+180)%360+360)%360-180;const K=Math.max(-90,Math.min(90,w[3]));if(w[2]-w[0]>=360)R=-180,j=180;else if(R>j){const de=this.getClusters([R,F,180,K],A),be=this.getClusters([-180,F,j,K],A);return de.concat(be)}const W=this.trees[this._limitZoom(A)],X=W.range(bt(R),lr(K),bt(j),lr(F)),J=[];for(const de of X){const be=W.points[de];J.push(be.numPoints?vn(be):this.points[be.index])}return J}getChildren(w){const A=this._getOriginId(w),R=this._getOriginZoom(w),F="No cluster with the specified id.",j=this.trees[R];if(!j)throw new Error(F);const K=j.points[A];if(!K)throw new Error(F);const W=this.options.radius/(this.options.extent*Math.pow(2,R-1)),X=j.within(K.x,K.y,W),J=[];for(const de of X){const be=j.points[de];be.parentId===w&&J.push(be.numPoints?vn(be):this.points[be.index])}if(J.length===0)throw new Error(F);return J}getLeaves(w,A,R){const F=[];return this._appendLeaves(F,w,A=A||10,R=R||0,0),F}getTile(w,A,R){const F=this.trees[this._limitZoom(w)],j=Math.pow(2,w),{extent:K,radius:W}=this.options,X=W/K,J=(R-X)/j,de=(R+1+X)/j,be={features:[]};return this._addTileFeatures(F.range((A-X)/j,J,(A+1+X)/j,de),F.points,A,R,j,be),A===0&&this._addTileFeatures(F.range(1-X/j,J,1,de),F.points,j,R,j,be),A===j-1&&this._addTileFeatures(F.range(0,J,X/j,de),F.points,-1,R,j,be),be.features.length?be:null}getClusterExpansionZoom(w){let A=this._getOriginZoom(w)-1;for(;A<=this.options.maxZoom;){const R=this.getChildren(w);if(A++,R.length!==1)break;w=R[0].properties.cluster_id}return A}_appendLeaves(w,A,R,F,j){const K=this.getChildren(A);for(const W of K){const X=W.properties;if(X&&X.cluster?j+X.point_count<=F?j+=X.point_count:j=this._appendLeaves(w,X.cluster_id,R,F,j):j<F?j++:w.push(W),w.length===R)break}return j}_addTileFeatures(w,A,R,F,j,K){for(const W of w){const X=A[W],J=X.numPoints;let de,be,pe;if(J)de=Xn(X),be=X.x,pe=X.y;else{const Be=this.points[X.index];de=Be.properties,be=bt(Be.geometry.coordinates[0]),pe=lr(Be.geometry.coordinates[1])}const Ne={type:1,geometry:[[Math.round(this.options.extent*(be*j-R)),Math.round(this.options.extent*(pe*j-F))]],tags:de};let qe;J?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),K.features.push(Ne)}}_limitZoom(w){return Math.max(this.options.minZoom,Math.min(Math.floor(+w),this.options.maxZoom+1))}_cluster(w,A){const R=[],{radius:F,extent:j,reduce:K,minPoints:W}=this.options,X=F/(j*Math.pow(2,A));for(let J=0;J<w.length;J++){const de=w[J];if(de.zoom<=A)continue;de.zoom=A;const be=this.trees[A+1],pe=be.within(de.x,de.y,X),Ne=de.numPoints||1;let qe=Ne;for(const Be of pe){const Je=be.points[Be];Je.zoom>A&&(qe+=Je.numPoints||1)}if(qe>Ne&&qe>=W){let Be=de.x*Ne,Je=de.y*Ne,et=K&&Ne>1?this._map(de,!0):null;const Tt=(J<<5)+(A+1)+this.points.length;for(const it of pe){const ht=be.points[it];if(ht.zoom<=A)continue;ht.zoom=A;const Et=ht.numPoints||1;Be+=ht.x*Et,Je+=ht.y*Et,ht.parentId=Tt,K&&(et||(et=this._map(de,!0)),K(et,this._map(ht)))}de.parentId=Tt,R.push(Rr(Be/qe,Je/qe,Tt,qe,et))}else if(R.push(de),qe>1)for(const Be of pe){const Je=be.points[Be];Je.zoom<=A||(Je.zoom=A,R.push(Je))}}return R}_getOriginId(w){return w-this.points.length>>5}_getOriginZoom(w){return(w-this.points.length)%32}_map(w,A){if(w.numPoints)return A?Fr({},w.properties):w.properties;const R=this.points[w.index].properties,F=this.options.map(R);return A&&F===R?Fr({},F):F}}function Rr(O,w,A,R,F){return{x:xr(O),y:xr(w),zoom:1/0,id:A,parentId:-1,numPoints:R,properties:F}}function xn(O,w){const[A,R]=O.geometry.coordinates;return{x:xr(bt(A)),y:xr(lr(R)),zoom:1/0,index:w,parentId:-1}}function vn(O){return{type:"Feature",id:O.id,properties:Xn(O),geometry:{type:"Point",coordinates:[(w=O.x,360*(w-.5)),Br(O.y)]}};var w}function Xn(O){const w=O.numPoints,A=w>=1e4?`${Math.round(w/1e3)}k`:w>=1e3?Math.round(w/100)/10+"k":w;return Fr(Fr({},O.properties),{cluster:!0,cluster_id:O.id,point_count:w,point_count_abbreviated:A})}function bt(O){return O/360+.5}function lr(O){const w=Math.sin(O*Math.PI/180),A=.5-.25*Math.log((1+w)/(1-w))/Math.PI;return A<0?0:A>1?1:A}function Br(O){const w=(180-360*O)*Math.PI/180;return 360*Math.atan(Math.exp(w))/Math.PI-90}function Fr(O,w){for(const A in w)O[A]=w[A];return O}function Wn(O){return O.x}function vr(O){return O.y}function br(O,w,A,R){for(var F,j=R,K=A-w>>1,W=A-w,X=O[w],J=O[w+1],de=O[A],be=O[A+1],pe=w+3;pe<A;pe+=3){var Ne=bn(O[pe],O[pe+1],X,J,de,be);if(Ne>j)F=pe,j=Ne;else if(Ne===j){var qe=Math.abs(pe-K);qe<W&&(F=pe,W=qe)}}j>R&&(F-w>3&&br(O,w,F,R),O[F+2]=j,A-F>3&&br(O,F,A,R))}function bn(O,w,A,R,F,j){var K=F-A,W=j-R;if(K!==0||W!==0){var X=((O-A)*K+(w-R)*W)/(K*K+W*W);X>1?(A=F,R=j):X>0&&(A+=K*X,R+=W*X)}return(K=O-A)*K+(W=w-R)*W}function wr(O,w,A,R){var F={id:O===void 0?null:O,type:w,geometry:A,tags:R,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(j){var K=j.geometry,W=j.type;if(W==="Point"||W==="MultiPoint"||W==="LineString")_e(j,K);else if(W==="Polygon"||W==="MultiLineString")for(var X=0;X<K.length;X++)_e(j,K[X]);else if(W==="MultiPolygon")for(X=0;X<K.length;X++)for(var J=0;J<K[X].length;J++)_e(j,K[X][J])}(F),F}function _e(O,w){for(var A=0;A<w.length;A+=3)O.minX=Math.min(O.minX,w[A]),O.minY=Math.min(O.minY,w[A+1]),O.maxX=Math.max(O.maxX,w[A]),O.maxY=Math.max(O.maxY,w[A+1])}function ze(O,w,A,R){if(w.geometry){var F=w.geometry.coordinates,j=w.geometry.type,K=Math.pow(A.tolerance/((1<<A.maxZoom)*A.extent),2),W=[],X=w.id;if(A.promoteId?X=w.properties[A.promoteId]:A.generateId&&(X=R||0),j==="Point")Kr(F,W);else if(j==="MultiPoint")for(var J=0;J<F.length;J++)Kr(F[J],W);else if(j==="LineString")Qi(F,W,K,!1);else if(j==="MultiLineString"){if(A.lineMetrics){for(J=0;J<F.length;J++)Qi(F[J],W=[],K,!1),O.push(wr(X,"LineString",W,w.properties));return}wt(F,W,K,!1)}else if(j==="Polygon")wt(F,W,K,!0);else{if(j!=="MultiPolygon"){if(j==="GeometryCollection"){for(J=0;J<w.geometry.geometries.length;J++)ze(O,{id:X,geometry:w.geometry.geometries[J],properties:w.properties},A,R);return}throw new Error("Input data is not a valid GeoJSON object.")}for(J=0;J<F.length;J++){var de=[];wt(F[J],de,K,!0),W.push(de)}}O.push(wr(X,j,W,w.properties))}}function Kr(O,w){w.push(qi(O[0])),w.push(Li(O[1])),w.push(0)}function Qi(O,w,A,R){for(var F,j,K=0,W=0;W<O.length;W++){var X=qi(O[W][0]),J=Li(O[W][1]);w.push(X),w.push(J),w.push(0),W>0&&(K+=R?(F*J-X*j)/2:Math.sqrt(Math.pow(X-F,2)+Math.pow(J-j,2))),F=X,j=J}var de=w.length-3;w[2]=1,br(w,0,de,A),w[de+2]=1,w.size=Math.abs(K),w.start=0,w.end=w.size}function wt(O,w,A,R){for(var F=0;F<O.length;F++){var j=[];Qi(O[F],j,A,R),w.push(j)}}function qi(O){return O/360+.5}function Li(O){var w=Math.sin(O*Math.PI/180),A=.5-.25*Math.log((1+w)/(1-w))/Math.PI;return A<0?0:A>1?1:A}function Ri(O,w,A,R,F,j,K,W){if(R/=w,j>=(A/=w)&&K<R)return O;if(K<A||j>=R)return null;for(var X=[],J=0;J<O.length;J++){var de=O[J],be=de.geometry,pe=de.type,Ne=F===0?de.minX:de.minY,qe=F===0?de.maxX:de.maxY;if(Ne>=A&&qe<R)X.push(de);else if(!(qe<A||Ne>=R)){var Be=[];if(pe==="Point"||pe==="MultiPoint")Or(be,Be,A,R,F);else if(pe==="LineString")Ae(be,Be,A,R,F,!1,W.lineMetrics);else if(pe==="MultiLineString")st(be,Be,A,R,F,!1);else if(pe==="Polygon")st(be,Be,A,R,F,!0);else if(pe==="MultiPolygon")for(var Je=0;Je<be.length;Je++){var et=[];st(be[Je],et,A,R,F,!0),et.length&&Be.push(et)}if(Be.length){if(W.lineMetrics&&pe==="LineString"){for(Je=0;Je<Be.length;Je++)X.push(wr(de.id,pe,Be[Je],de.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(wr(de.id,pe,Be,de.tags))}}}return X.length?X:null}function Or(O,w,A,R,F){for(var j=0;j<O.length;j+=3){var K=O[j+F];K>=A&&K<=R&&(w.push(O[j]),w.push(O[j+1]),w.push(O[j+2]))}}function Ae(O,w,A,R,F,j,K){for(var W,X,J=ut(O),de=F===0?Ur:rt,be=O.start,pe=0;pe<O.length-3;pe+=3){var Ne=O[pe],qe=O[pe+1],Be=O[pe+2],Je=O[pe+3],et=O[pe+4],Tt=F===0?Ne:qe,it=F===0?Je:et,ht=!1;K&&(W=Math.sqrt(Math.pow(Ne-Je,2)+Math.pow(qe-et,2))),Tt<A?it>A&&(X=de(J,Ne,qe,Je,et,A),K&&(J.start=be+W*X)):Tt>R?it<R&&(X=de(J,Ne,qe,Je,et,R),K&&(J.start=be+W*X)):fi(J,Ne,qe,Be),it<A&&Tt>=A&&(X=de(J,Ne,qe,Je,et,A),ht=!0),it>R&&Tt<=R&&(X=de(J,Ne,qe,Je,et,R),ht=!0),!j&&ht&&(K&&(J.end=be+W*X),w.push(J),J=ut(O)),K&&(be+=W)}var Et=O.length-3;Ne=O[Et],qe=O[Et+1],Be=O[Et+2],(Tt=F===0?Ne:qe)>=A&&Tt<=R&&fi(J,Ne,qe,Be),Et=J.length-3,j&&Et>=3&&(J[Et]!==J[0]||J[Et+1]!==J[1])&&fi(J,J[0],J[1],J[2]),J.length&&w.push(J)}function ut(O){var w=[];return w.size=O.size,w.start=O.start,w.end=O.end,w}function st(O,w,A,R,F,j){for(var K=0;K<O.length;K++)Ae(O[K],w,A,R,F,j,!1)}function fi(O,w,A,R){O.push(w),O.push(A),O.push(R)}function Ur(O,w,A,R,F,j){var K=(j-w)/(R-w);return O.push(j),O.push(A+(F-A)*K),O.push(1),K}function rt(O,w,A,R,F,j){var K=(j-A)/(F-A);return O.push(w+(R-w)*K),O.push(j),O.push(1),K}function Tr(O,w){for(var A=[],R=0;R<O.length;R++){var F,j=O[R],K=j.type;if(K==="Point"||K==="MultiPoint"||K==="LineString")F=oi(j.geometry,w);else if(K==="MultiLineString"||K==="Polygon"){F=[];for(var W=0;W<j.geometry.length;W++)F.push(oi(j.geometry[W],w))}else if(K==="MultiPolygon")for(F=[],W=0;W<j.geometry.length;W++){for(var X=[],J=0;J<j.geometry[W].length;J++)X.push(oi(j.geometry[W][J],w));F.push(X)}A.push(wr(j.id,K,F,j.tags))}return A}function oi(O,w){var A=[];A.size=O.size,O.start!==void 0&&(A.start=O.start,A.end=O.end);for(var R=0;R<O.length;R+=3)A.push(O[R]+w,O[R+1],O[R+2]);return A}function wn(O,w){if(O.transformed)return O;var A,R,F,j=1<<O.z,K=O.x,W=O.y;for(A=0;A<O.features.length;A++){var X=O.features[A],J=X.geometry,de=X.type;if(X.geometry=[],de===1)for(R=0;R<J.length;R+=2)X.geometry.push(Yt(J[R],J[R+1],w,j,K,W));else for(R=0;R<J.length;R++){var be=[];for(F=0;F<J[R].length;F+=2)be.push(Yt(J[R][F],J[R][F+1],w,j,K,W));X.geometry.push(be)}}return O.transformed=!0,O}function Yt(O,w,A,R,F,j){return[Math.round(A*(O*R-F)),Math.round(A*(w*R-j))]}function wi(O,w,A,R,F){for(var j=w===F.maxZoom?0:F.tolerance/((1<<w)*F.extent),K={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:A,y:R,z:w,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},W=0;W<O.length;W++){K.numFeatures++,kt(K,O[W],j,F);var X=O[W].minX,J=O[W].minY,de=O[W].maxX,be=O[W].maxY;X<K.minX&&(K.minX=X),J<K.minY&&(K.minY=J),de>K.maxX&&(K.maxX=de),be>K.maxY&&(K.maxY=be)}return K}function kt(O,w,A,R){var F=w.geometry,j=w.type,K=[];if(j==="Point"||j==="MultiPoint")for(var W=0;W<F.length;W+=3)K.push(F[W]),K.push(F[W+1]),O.numPoints++,O.numSimplified++;else if(j==="LineString")Tn(K,F,O,A,!1,!1);else if(j==="MultiLineString"||j==="Polygon")for(W=0;W<F.length;W++)Tn(K,F[W],O,A,j==="Polygon",W===0);else if(j==="MultiPolygon")for(var X=0;X<F.length;X++){var J=F[X];for(W=0;W<J.length;W++)Tn(K,J[W],O,A,!0,W===0)}if(K.length){var de=w.tags||null;if(j==="LineString"&&R.lineMetrics){for(var be in de={},w.tags)de[be]=w.tags[be];de.mapbox_clip_start=F.start/F.size,de.mapbox_clip_end=F.end/F.size}var pe={geometry:K,type:j==="Polygon"||j==="MultiPolygon"?3:j==="LineString"||j==="MultiLineString"?2:1,tags:de};w.id!==null&&(pe.id=w.id),O.features.push(pe)}}function Tn(O,w,A,R,F,j){var K=R*R;if(R>0&&w.size<(F?K:R))A.numPoints+=w.length/3;else{for(var W=[],X=0;X<w.length;X+=3)(R===0||w[X+2]>K)&&(A.numSimplified++,W.push(w[X]),W.push(w[X+1])),A.numPoints++;F&&function(J,de){for(var be=0,pe=0,Ne=J.length,qe=Ne-2;pe<Ne;qe=pe,pe+=2)be+=(J[pe]-J[qe])*(J[pe+1]+J[qe+1]);if(be>0===de)for(pe=0,Ne=J.length;pe<Ne/2;pe+=2){var Be=J[pe],Je=J[pe+1];J[pe]=J[Ne-2-pe],J[pe+1]=J[Ne-1-pe],J[Ne-2-pe]=Be,J[Ne-1-pe]=Je}}(W,j),O.push(W)}}function cr(O,w){var A=(w=this.options=function(F,j){for(var K in j)F[K]=j[K];return F}(Object.create(this.options),w)).debug;if(A&&console.time("preprocess data"),w.maxZoom<0||w.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(w.promoteId&&w.generateId)throw new Error("promoteId and generateId cannot be used together.");var R=function(F,j){var K=[];if(F.type==="FeatureCollection")for(var W=0;W<F.features.length;W++)ze(K,F.features[W],j,W);else ze(K,F.type==="Feature"?F:{geometry:F},j);return K}(O,w);this.tiles={},this.tileCoords=[],A&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",w.indexMaxZoom,w.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),R=function(F,j){var K=j.buffer/j.extent,W=F,X=Ri(F,1,-1-K,K,0,-1,2,j),J=Ri(F,1,1-K,2+K,0,-1,2,j);return(X||J)&&(W=Ri(F,1,-K,1+K,0,-1,2,j)||[],X&&(W=Tr(X,1).concat(W)),J&&(W=W.concat(Tr(J,-1)))),W}(R,w),R.length&&this.splitTile(R,0,0,0),A&&(R.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 Jr(O,w,A){return 32*((1<<O)*A+w)+O}function Yr(O,w){const A=O.tileID.canonical;if(!this._geoJSONIndex)return w(null,null);const R=this._geoJSONIndex.getTile(A.z,A.x,A.y);if(!R)return w(null,null);const F=new gt(R.features);let j=ft.exports(F);j.byteOffset===0&&j.byteLength===j.buffer.byteLength||(j=new Uint8Array(j)),w(null,{vectorTile:F,rawData:j.buffer})}cr.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},cr.prototype.splitTile=function(O,w,A,R,F,j,K){for(var W=[O,w,A,R],X=this.options,J=X.debug;W.length;){R=W.pop(),A=W.pop(),w=W.pop(),O=W.pop();var de=1<<w,be=Jr(w,A,R),pe=this.tiles[be];if(!pe&&(J>1&&console.time("creation"),pe=this.tiles[be]=wi(O,w,A,R,X),this.tileCoords.push({z:w,x:A,y:R}),J)){J>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",w,A,R,pe.numFeatures,pe.numPoints,pe.numSimplified),console.timeEnd("creation"));var Ne="z"+w;this.stats[Ne]=(this.stats[Ne]||0)+1,this.total++}if(pe.source=O,F){if(w===X.maxZoom||w===F)continue;var qe=1<<F-w;if(A!==Math.floor(j/qe)||R!==Math.floor(K/qe))continue}else if(w===X.indexMaxZoom||pe.numPoints<=X.indexMaxPoints)continue;if(pe.source=null,O.length!==0){J>1&&console.time("clipping");var Be,Je,et,Tt,it,ht,Et=.5*X.buffer/X.extent,Lt=.5-Et,si=.5+Et,$t=1+Et;Be=Je=et=Tt=null,it=Ri(O,de,A-Et,A+si,0,pe.minX,pe.maxX,X),ht=Ri(O,de,A+Lt,A+$t,0,pe.minX,pe.maxX,X),O=null,it&&(Be=Ri(it,de,R-Et,R+si,1,pe.minY,pe.maxY,X),Je=Ri(it,de,R+Lt,R+$t,1,pe.minY,pe.maxY,X),it=null),ht&&(et=Ri(ht,de,R-Et,R+si,1,pe.minY,pe.maxY,X),Tt=Ri(ht,de,R+Lt,R+$t,1,pe.minY,pe.maxY,X),ht=null),J>1&&console.timeEnd("clipping"),W.push(Be||[],w+1,2*A,2*R),W.push(Je||[],w+1,2*A,2*R+1),W.push(et||[],w+1,2*A+1,2*R),W.push(Tt||[],w+1,2*A+1,2*R+1)}}},cr.prototype.getTile=function(O,w,A){var R=this.options,F=R.extent,j=R.debug;if(O<0||O>24)return null;var K=1<<O,W=Jr(O,w=(w%K+K)%K,A);if(this.tiles[W])return wn(this.tiles[W],F);j>1&&console.log("drilling down to z%d-%d-%d",O,w,A);for(var X,J=O,de=w,be=A;!X&&J>0;)J--,de=Math.floor(de/2),be=Math.floor(be/2),X=this.tiles[Jr(J,de,be)];return X&&X.source?(j>1&&console.log("found parent tile z%d-%d-%d",J,de,be),j>1&&console.time("drilling down"),this.splitTile(X.source,J,de,be,O,w,A),j>1&&console.timeEnd("drilling down"),this.tiles[W]?wn(this.tiles[W],F):null):null};class En extends Ce{constructor(w,A,R,F){super(w,A,R,Yr),F&&(this.loadGeoJSON=F)}loadData(w,A){var R;(R=this._pendingRequest)===null||R===void 0||R.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const F=!!(w&&w.request&&w.request.collectResourceTiming)&&new a.RequestPerformance(w.request);this._pendingCallback=A,this._pendingRequest=this.loadGeoJSON(w,(j,K)=>{if(delete this._pendingCallback,delete this._pendingRequest,j||!K)return A(j);if(typeof K!="object")return A(new Error(`Input data given to '${w.source}' is not a valid GeoJSON object.`));{Xe(K,!0);try{if(w.filter){const X=a.createExpression(w.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(X.result==="error")throw new Error(X.value.map(de=>`${de.key}: ${de.message}`).join(", "));const J=K.features.filter(de=>X.value.evaluate({zoom:0},de));K={type:"FeatureCollection",features:J}}this._geoJSONIndex=w.cluster?new jn(function({superclusterOptions:X,clusterProperties:J}){if(!J||!X)return X;const de={},be={},pe={accumulated:null,zoom:0},Ne={properties:null},qe=Object.keys(J);for(const Be of qe){const[Je,et]=J[Be],Tt=a.createExpression(et),it=a.createExpression(typeof Je=="string"?[Je,["accumulated"],["get",Be]]:Je);de[Be]=Tt.value,be[Be]=it.value}return X.map=Be=>{Ne.properties=Be;const Je={};for(const et of qe)Je[et]=de[et].evaluate(pe,Ne);return Je},X.reduce=(Be,Je)=>{Ne.properties=Je;for(const et of qe)pe.accumulated=Be[et],Be[et]=be[et].evaluate(pe,Ne)},X}(w)).load(K.features):function(X,J){return new cr(X,J)}(K,w.geojsonVtOptions)}catch(X){return A(X)}this.loaded={};const W={};if(F){const X=F.finish();X&&(W.resourceTiming={},W.resourceTiming[w.source]=JSON.parse(JSON.stringify(X)))}A(null,W)}})}reloadTile(w,A){const R=this.loaded;return R&&R[w.uid]?super.reloadTile(w,A):this.loadTile(w,A)}loadGeoJSON(w,A){if(w.request)return a.getJSON(w.request,A);if(typeof w.data=="string")try{A(null,JSON.parse(w.data))}catch{A(new Error(`Input data given to '${w.source}' is not a valid GeoJSON object.`))}else A(new Error(`Input data given to '${w.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}}removeSource(w,A){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),A()}getClusterExpansionZoom(w,A){try{A(null,this._geoJSONIndex.getClusterExpansionZoom(w.clusterId))}catch(R){A(R)}}getClusterChildren(w,A){try{A(null,this._geoJSONIndex.getChildren(w.clusterId))}catch(R){A(R)}}getClusterLeaves(w,A){try{A(null,this._geoJSONIndex.getLeaves(w.clusterId,w.limit,w.offset))}catch(R){A(R)}}}class Qr{constructor(w){this.self=w,this.actor=new a.Actor(w,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:Ce,geojson:En},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(A,R)=>{if(this.workerSourceTypes[A])throw new Error(`Worker source with name "${A}" already registered.`);this.workerSourceTypes[A]=R},this.self.registerRTLTextPlugin=A=>{if(a.plugin.isParsed())throw new Error("RTL text plugin already registered.");a.plugin.applyArabicShaping=A.applyArabicShaping,a.plugin.processBidirectionalText=A.processBidirectionalText,a.plugin.processStyledBidirectionalText=A.processStyledBidirectionalText}}setReferrer(w,A){this.referrer=A}setImages(w,A,R){this.availableImages[w]=A;for(const F in this.workerSources[w]){const j=this.workerSources[w][F];for(const K in j)j[K].availableImages=A}R()}setLayers(w,A,R){this.getLayerIndex(w).replace(A),R()}updateLayers(w,A,R){this.getLayerIndex(w).update(A.layers,A.removedIds),R()}loadTile(w,A,R){this.getWorkerSource(w,A.type,A.source).loadTile(A,R)}loadDEMTile(w,A,R){this.getDEMWorkerSource(w,A.source).loadTile(A,R)}reloadTile(w,A,R){this.getWorkerSource(w,A.type,A.source).reloadTile(A,R)}abortTile(w,A,R){this.getWorkerSource(w,A.type,A.source).abortTile(A,R)}removeTile(w,A,R){this.getWorkerSource(w,A.type,A.source).removeTile(A,R)}removeDEMTile(w,A){this.getDEMWorkerSource(w,A.source).removeTile(A)}removeSource(w,A,R){if(!this.workerSources[w]||!this.workerSources[w][A.type]||!this.workerSources[w][A.type][A.source])return;const F=this.workerSources[w][A.type][A.source];delete this.workerSources[w][A.type][A.source],F.removeSource!==void 0?F.removeSource(A,R):R()}loadWorkerSource(w,A,R){try{this.self.importScripts(A.url),R()}catch(F){R(F.toString())}}syncRTLPluginState(w,A,R){try{a.plugin.setState(A);const F=a.plugin.getPluginURL();if(a.plugin.isLoaded()&&!a.plugin.isParsed()&&F!=null){this.self.importScripts(F);const j=a.plugin.isParsed();R(j?void 0:new Error(`RTL Text Plugin failed to import scripts from ${F}`),j)}}catch(F){R(F.toString())}}getAvailableImages(w){let A=this.availableImages[w];return A||(A=[]),A}getLayerIndex(w){let A=this.layerIndexes[w];return A||(A=this.layerIndexes[w]=new he),A}getWorkerSource(w,A,R){if(this.workerSources[w]||(this.workerSources[w]={}),this.workerSources[w][A]||(this.workerSources[w][A]={}),!this.workerSources[w][A][R]){const F={send:(j,K,W)=>{this.actor.send(j,K,W,w)}};this.workerSources[w][A][R]=new this.workerSourceTypes[A](F,this.getLayerIndex(w),this.getAvailableImages(w))}return this.workerSources[w][A][R]}getDEMWorkerSource(w,A){return this.demWorkerSources[w]||(this.demWorkerSources[w]={}),this.demWorkerSources[w][A]||(this.demWorkerSources[w][A]=new Ke),this.demWorkerSources[w][A]}enforceCacheSizeLimit(w,A){a.enforceCacheSizeLimit(A)}}return a.isWorker()&&(self.worker=new Qr(self)),Qr}),N(["./shared"],function(a){var Y=ie;function ie(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,p=new Blob([""],{type:"text/javascript"}),f=URL.createObjectURL(p);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 p=u.getImageData(0,0,1,1);return p&&p.width===s.width}()?(he[n=t&&t.failIfMajorPerformanceCaveat]===void 0&&(he[n]=function(s){var u,p=function(f){var _=document.createElement("canvas"),y=Object.create(ie.webGLContextAttributes);return y.failIfMajorPerformanceCaveat=f,_.getContext("webgl",y)||_.getContext("experimental-webgl",y)}(s);if(!p)return!1;try{u=p.createShader(p.VERTEX_SHADER)}catch{return!1}return!(!u||p.isContextLost())&&(p.shaderSource(u,"void main() {}"),p.compileShader(u),p.getShaderParameter(u,p.COMPILE_STATUS)===!0)}(n)),he[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 he={};function ue(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(!ue(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(!ue(l[n],t[n]))return!1;return!0}return l===t}ie.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 p=0;p<n.length;p++)u.push(new a.pointGeometry(n[p].clientX-s.left-t.clientLeft,n[p].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 Se{constructor(t){this._transformRequestFn=t}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}normalizeSpriteURL(t,n,s){const u=function(p){const f=p.match(Ie);if(!f)throw new Error(`Unable to parse URL "${p}"`);return{protocol:f[1],authority:f[2],path:f[3]||"/",params:f[4]?f[4].split("&"):[]}}(t);return u.path+=`${n}${s}`,function(p){const f=p.params.length?`?${p.params.join("&")}`:"";return`${p.protocol}://${p.authority}${p.path}${f}`}(u)}setTransformRequest(t){this._transformRequestFn=t}}const Ie=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;class Ce{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:p}=t,f=!(this.size&&this.size[0]===u&&this.size[1]===p||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,p],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,p,0,this.format,y.UNSIGNED_BYTE,t.data);else{const{x:v,y:E}=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,v,E,y.RGBA,y.UNSIGNED_BYTE,t):y.texSubImage2D(y.TEXTURE_2D,0,v,E,u,p,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:p}=u;p.bindTexture(p.TEXTURE_2D,this.texture),s!==p.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(s=p.LINEAR),t!==this.filter&&(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,t),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,s||t),this.filter=t),n!==this.wrap&&(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,n),p.texParameteri(p.TEXTURE_2D,p.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 Ke(l){const{userImage:t}=l;return!!(t&&t.render&&t.render())&&(l.data.replace(new Uint8Array(t.data.buffer)),!0)}class Xe 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 p=this.images[u];p?s[u]={data:p.data.clone(),pixelRatio:p.pixelRatio,sdf:p.sdf,version:p.version,stretchX:p.stretchX,stretchY:p.stretchY,content:p.content,hasRenderCallback:Boolean(p.userImage&&p.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},p=new a.ImagePosition(u,s);this.patterns[t]={bin:u,position:p}}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 Ce(t,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const p in this.patterns)t.push(this.patterns[p].bin);const{w:n,h:s}=a.potpack(t),u=this.atlasImage;u.resize({width:n||1,height:s||1});for(const p in this.patterns){const{bin:f}=this.patterns[p],_=f.x+1,y=f.y+1,v=this.images[p].data,E=v.width,M=v.height;a.RGBAImage.copy(v,u,{x:0,y:0},{x:_,y},{width:E,height:M}),a.RGBAImage.copy(v,u,{x:0,y:M-1},{x:_,y:y-1},{width:E,height:1}),a.RGBAImage.copy(v,u,{x:0,y:0},{x:_,y:y+M},{width:E,height:1}),a.RGBAImage.copy(v,u,{x:E-1,y:0},{x:_-1,y},{width:1,height:M}),a.RGBAImage.copy(v,u,{x:0,y:0},{x:_+E,y},{width:1,height:M})}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`),Ke(s)&&this.updateImage(n,s)}}}const Qe=1e20;function lt(l,t,n,s,u,p,f,_,y){for(let v=t;v<t+s;v++)vt(l,n*p+v,p,u,f,_,y);for(let v=n;v<n+u;v++)vt(l,v*p+t,1,s,f,_,y)}function vt(l,t,n,s,u,p,f){p[0]=0,f[0]=-Qe,f[1]=Qe,u[0]=l[t];for(let _=1,y=0,v=0;_<s;_++){u[_]=l[t+_*n];const E=_*_;do{const M=p[y];v=(u[_]-u[M]+E-M*M)/(_-M)/2}while(v<=f[y]&&--y>-1);y++,p[y]=_,f[y]=v,f[y+1]=Qe}for(let _=0,y=0;_<s;_++){for(;f[y+1]<_;)y++;const v=p[y],E=_-v;l[t+_*n]=u[v]+E*E}}class ot{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 p of t[u])s.push({stack:u,id:p});a.asyncAll(s,({stack:u,id:p},f)=>{let _=this.entries[u];_||(_=this.entries[u]={glyphs:{},requests:{},ranges:{}});let y=_.glyphs[p];if(y!==void 0)return void f(null,{stack:u,id:p,glyph:y});if(y=this._tinySDF(_,u,p),y)return _.glyphs[p]=y,void f(null,{stack:u,id:p,glyph:y});const v=Math.floor(p/256);if(256*v>65535)return void f(new Error("glyphs > 65535 not supported"));if(_.ranges[v])return void f(null,{stack:u,id:p,glyph:y});let E=_.requests[v];E||(E=_.requests[v]=[],ot.loadGlyphRange(u,v,this.url,this.requestManager,(M,z)=>{if(z){for(const V in z)this._doesCharSupportLocalGlyph(+V)||(_.glyphs[+V]=z[+V]);_.ranges[v]=!0}for(const V of E)V(M,z);delete _.requests[v]})),E.push((M,z)=>{M?f(M):z&&f(null,{stack:u,id:p,glyph:z[p]||null})})},(u,p)=>{if(u)n(u);else if(p){const f={};for(const{stack:_,id:y,glyph:v}of p)(f[_]||(f[_]={}))[y]=v&&{id:v.id,bitmap:v.bitmap.clone(),metrics:v.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 p=t.tinySDF;if(!p){let _="400";/bold/i.test(n)?_="900":/medium/i.test(n)?_="500":/light/i.test(n)&&(_="200"),p=t.tinySDF=new ot.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:u,fontWeight:_})}const f=p.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}}}}ot.loadGlyphRange=function(l,t,n,s,u){const p=256*t,f=p+255,_=s.transformRequest(n.replace("{fontstack}",l).replace("{range}",`${p}-${f}`),a.ResourceType.Glyphs);a.getArrayBuffer(_,(y,v)=>{if(y)u(y);else if(v){const E={};for(const M of a.parseGlyphPbf(v))E[M.id]=M;u(null,E)}})},ot.TinySDF=class{constructor({fontSize:l=24,buffer:t=3,radius:n=8,cutoff:s=.25,fontFamily:u="sans-serif",fontWeight:p="normal",fontStyle:f="normal"}={}){this.buffer=t,this.cutoff=s,this.radius=n;const _=this.size=l+4*t,y=this._createCanvas(_),v=this.ctx=y.getContext("2d",{willReadFrequently:!0});v.font=`${f} ${p} ${l}px ${u}`,v.textBaseline="alphabetic",v.textAlign="left",v.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:p}=this.ctx.measureText(l),f=Math.ceil(n),_=Math.min(this.size-this.buffer,Math.ceil(p-u)),y=Math.min(this.size-this.buffer,f+Math.ceil(s)),v=_+2*this.buffer,E=y+2*this.buffer,M=Math.max(v*E,0),z=new Uint8ClampedArray(M),V={data:z,width:v,height:E,glyphWidth:_,glyphHeight:y,glyphTop:f,glyphLeft:0,glyphAdvance:t};if(_===0||y===0)return V;const{ctx:U,buffer:$,gridInner:H,gridOuter:Q}=this;U.clearRect($,$,_,y),U.fillText(l,$,$+f);const oe=U.getImageData($,$,_,y);Q.fill(Qe,0,M),H.fill(0,0,M);for(let G=0;G<y;G++)for(let le=0;le<_;le++){const se=oe.data[4*(G*_+le)+3]/255;if(se===0)continue;const me=(G+$)*v+le+$;if(se===1)Q[me]=0,H[me]=Qe;else{const ge=.5-se;Q[me]=ge>0?ge*ge:0,H[me]=ge<0?ge*ge:0}}lt(Q,0,0,v,E,v,this.f,this.v,this.z),lt(H,$,$,_,y,v,this.f,this.v,this.z);for(let G=0;G<M;G++){const le=Math.sqrt(Q[G])-Math.sqrt(H[G]);z[G]=Math.round(255-255*(le/this.radius+this.cutoff))}return V}};const gt=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)}),ft="-transition";class ct extends a.Evented{constructor(t){super(),this._transitionable=new a.Transitionable(gt),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(ft)?this._transitionable.setTransition(s.slice(0,-ft.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 Xt{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 p=t.length%2==1?-t[t.length-1]*s:0,f=t[0]*s,_=!0;u.push({left:p,right:f,isDash:_,zeroLength:t[0]===0});let y=t[0];for(let v=1;v<t.length;v++){_=!_;const E=t[v];p=y*s,y+=E,f=y*s,u.push({left:p,right:f,isDash:_,zeroLength:E===0})}return u}addRoundDash(t,n,s){const u=n/2;for(let p=-s;p<=s;p++){const f=this.width*(this.nextRow+s+p);let _=0,y=t[_];for(let v=0;v<this.width;v++){v/y.right>1&&(y=t[++_]);const E=Math.abs(v-y.left),M=Math.abs(v-y.right),z=Math.min(E,M);let V;const U=p/s*(u+1);if(y.isDash){const $=u-Math.abs(U);V=Math.sqrt(z*z+$*$)}else V=u-Math.sqrt(z*z+U*U);this.data[f+v]=Math.max(0,Math.min(255,V+128))}}}addRegularDash(t){for(let _=t.length-1;_>=0;--_){const y=t[_],v=t[_+1];y.zeroLength?t.splice(_,1):v&&v.isDash===y.isDash&&(v.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 p=0,f=t[p];for(let _=0;_<this.width;_++){_/f.right>1&&(f=t[++p]);const y=Math.abs(_-f.left),v=Math.abs(_-f.right),E=Math.min(y,v);this.data[u+_]=Math.max(0,Math.min(255,(f.isDash?E:-E)+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 p=0;for(let _=0;_<t.length;_++)p+=t[_];if(p!==0){const _=this.width/p,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:p};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 Wt{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 p=new Wt.Actor(s[u],n,this.id);p.name=`Worker ${u}`,this.actors.push(p)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,n,s){a.asyncAll(this.actors,(u,p)=>{u.send(t,n,p)},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 ki(l,t,n){const s=function(u,p){if(u)return n(u);if(p){const f=a.pick(a.extend(p,l),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);p.vector_layers&&(f.vectorLayers=p.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))}Wt.Actor=a.Actor;class di{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),p=Math.ceil(a.mercatorXfromLng(this.bounds.getEast())*n),f=Math.ceil(a.mercatorYfromLat(this.bounds.getSouth())*n);return t.x>=s&&t.x<p&&t.y>=u&&t.y<f}}class Hi 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=ki(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 di(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 p(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,p.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",u,p.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 Ki 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=ki(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 di(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,p,f)=>{if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(u)t.state="errored",n(u);else if(p){this.map._refreshExpiredTiles&&t.setExpiryData(f);const _=this.map.painter.context,y=_.gl;t.texture=this.map.painter.getTileTexture(p.width),t.texture?t.texture.update(p,{useMipmap:!0}):(t.texture=new Ce(_,p,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 zr;class tt extends Ki{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(p,f){p&&(t.state="errored",n(p)),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(p,f){if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(p)t.state="errored",n(p);else if(f){this.map._refreshExpiredTiles&&t.setExpiryData(f),delete f.cacheControl,delete f.expires;const _=a.isImageBitmap(f)&&(zr==null&&(zr=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),zr)?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,p=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,p,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,p,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,p,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 _r 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 p=a.EXTENT/this.tileSize;this.workerOptions=a.extend({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(n.buffer!==void 0?n.buffer:128)*p,tolerance:(n.tolerance!==void 0?n.tolerance:.375)*p,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)*p,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,p)=>{if(this._pendingLoads--,this._removed||p&&p.abandoned)return void this.fire(new a.Event("dataabort",{dataType:"source",sourceDataType:t}));let f=null;if(p&&p.resourceTiming&&p.resourceTiming[this.id]&&(f=p.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,(p,f)=>(delete t.request,t.unloadVectorData(),t.aborted?n(null):p?n(p):(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 yr=a.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Ji 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 p=1/0,f=1/0,_=-1/0,y=-1/0;for(const z of u)p=Math.min(p,z.x),f=Math.min(f,z.y),_=Math.max(_,z.x),y=Math.max(y,z.y);const v=Math.max(_-p,y-f),E=Math.max(0,Math.floor(-Math.log(v)/Math.LN2)),M=Math.pow(2,E);return new a.CanonicalTileID(E,Math.floor((p+_)/2*M),Math.floor((f+y)/2*M))}(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,yr.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Ce(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 Yi extends Ji{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,yr.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 Ce(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 Hr extends Ji{constructor(t,n,s,u){super(t,n,s,u),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some(p=>!Array.isArray(p)||p.length!==2||p.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,yr.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 Ce(n,this.canvas,s.RGBA,{premultiply:!0});for(const u in this.tiles){const p=this.tiles[u];p.state!=="loaded"&&(p.state="loaded",p.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 mn={vector:Hi,raster:Ki,"raster-dem":tt,geojson:_r,video:Yi,image:Ji,canvas:Hr};function gn(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 _n(l,t,n,s,u,p){const f=function(M,z,V){if(M)for(const U of M){const $=z[U];if($&&$.source===V&&$.type==="fill-extrusion")return!0}else for(const U in z){const $=z[U];if($.source===V&&$.type==="fill-extrusion")return!0}return!1}(u&&u.layers,t,l.id),_=p.maxPitchScaleFactor(),y=l.tilesIn(s,_,f);y.sort(ar);const v=[];for(const M of y)v.push({wrappedTileID:M.tileID.wrapped().key,queryResults:M.tile.queryRenderedFeatures(t,n,l._state,M.queryGeometry,M.cameraQueryGeometry,M.scale,u,p,_,gn(l.transform,M.tileID))});const E=function(M){const z={},V={};for(const U of M){const $=U.queryResults,H=U.wrappedTileID,Q=V[H]=V[H]||{};for(const oe in $){const G=$[oe],le=Q[oe]=Q[oe]||{},se=z[oe]=z[oe]||[];for(const me of G)le[me.featureIndex]||(le[me.featureIndex]=!0,se.push(me))}}return z}(v);for(const M in E)E[M].forEach(z=>{const V=z.feature,U=l.getFeatureState(V.layer["source-layer"],V.id);V.source=V.layer.source,V.layer["source-layer"]&&(V.sourceLayer=V.layer["source-layer"]),V.state=U});return E}function ar(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 kr{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,p){const f={};if(!p)return f;for(const _ of u){const y=_.layerIds.map(v=>p.getLayer(v)).filter(Boolean);if(y.length!==0){_.layers=y,_.stateDependentLayerIds&&(_.stateDependentLayers=_.stateDependentLayerIds.map(v=>y.filter(E=>E.id===v)[0]));for(const v of y)f[v.id]=_}}return f}(t.buckets,n.style),this.hasSymbolBuckets=!1;for(const u in this.buckets){const p=this.buckets[u];if(p instanceof a.SymbolBucket){if(this.hasSymbolBuckets=!0,!s)break;p.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const u in this.buckets){const p=this.buckets[u];if(p instanceof a.SymbolBucket&&p.hasRTLText){this.hasRTLText=!0,a.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const u in this.buckets){const p=this.buckets[u];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(u).queryRadius(p))}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 Ce(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Ce(t,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,n,s,u,p,f,_,y,v,E){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:u,cameraQueryGeometry:p,scale:f,tileSize:this.tileSize,pixelPosMatrix:E,transform:y,params:_,queryPadding:this.queryPadding*v},t,n,s):{}}querySourceFeatures(t,n){const s=this.latestFeatureIndex;if(!s||!s.rawTileData)return;const u=s.loadVTLayers(),p=n?n.sourceLayer:"",f=u._geojsonTileLayer||u[p];if(!f)return;const _=a.createFilter(n&&n.filter),{z:y,x:v,y:E}=this.tileID.canonical,M={z:y,x:v,y:E};for(let z=0;z<f.length;z++){const V=f.feature(z);if(_.needGeometry){const H=a.toEvaluationFeature(V,!0);if(!_.filter(new a.EvaluationParameters(this.tileID.overscaledZ),H,this.tileID.canonical))continue}else if(!_.filter(new a.EvaluationParameters(this.tileID.overscaledZ),V))continue;const U=s.getId(V,p),$=new a.GeoJSONFeature(V,y,v,E,U);$.tile=M,t.push($)}}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 p=this.expirationTime-n;p?this.expirationTime=s+Math.max(p,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 p=this.buckets[u],f=p.layers[0].sourceLayer||"_geojsonTileLayer",_=s[f],y=t[f];if(!_||!y||Object.keys(y).length===0)continue;p.update(y,_,this.imageAtlas&&this.imageAtlas.patternPositions||{});const v=n&&n.style&&n.style.getLayer(u);v&&(this.queryPadding=Math.max(this.queryPadding,v.queryRadius(p)))}}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 p of n)if(u[p])return!0}}return!1}}class Dr{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 p={value:n,timeout:void 0};if(s!==void 0&&(p.timeout=setTimeout(()=>{this.remove(t,p)},s)),this.data[u].push(p),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),p=this.data[s][u];return this.data[s].splice(u,1),p.timeout&&clearTimeout(p.timeout),this.data[s].length===0&&delete this.data[s],this.onRemove(p.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 Lr{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 p in this.state[t])p!==u&&(this.deletedStates[t][p]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][u]===null){this.deletedStates[t][u]={};for(const p in this.state[t][u])s[p]||(this.deletedStates[t][u][p]=null)}else for(const p in s)this.deletedStates[t]&&this.deletedStates[t][u]&&this.deletedStates[t][u][p]===null&&delete this.deletedStates[t][u][p]}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 p=this.deletedStates[t][n];if(p===null)return{};for(const f in p)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 p={};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]),p[f]=this.state[u][f];s[u]=p}for(const u in this.deletedStates){this.state[u]=this.state[u]||{};const p={};if(this.deletedStates[u]===null)for(const f in this.state[u])p[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][_];p[f]=this.state[u][f]}s[u]=s[u]||{},a.extend(s[u],p)}if(this.stateChanges={},this.deletedStates={},Object.keys(s).length!==0)for(const u in t)t[u].setFeatureState(s,n)}}class Ii 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,p,f,_){const y=new mn[p.type](u,p,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 Dr(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Lr}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(yn).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 p=s.tileID,f=u.tileID,_=new a.pointGeometry(p.canonical.x,p.canonical.y)._rotate(this.transform.angle),y=new a.pointGeometry(f.canonical.x,f.canonical.y)._rotate(this.transform.angle);return p.overscaledZ-f.overscaledZ||y.y-_.y||y.x-_.x}).map(s=>s.tileID.key):n.map(s=>s.tileID).sort(yn).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 p=n[u];if(t.neighboringTiles&&t.neighboringTiles[p]){const f=this.getTileByID(p);s(t,f),s(f,t)}}function s(u,p){u.needsHillshadePrepare=!0,u.needsTerrainPrepare=!0;let f=p.tileID.canonical.x-u.tileID.canonical.x;const _=p.tileID.canonical.y-u.tileID.canonical.y,y=Math.pow(2,u.tileID.canonical.z),v=p.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)),p.dem&&u.dem&&(u.dem.backfillBorder(p.dem,f,_),u.neighboringTiles&&u.neighboringTiles[v]&&(u.neighboringTiles[v].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,n,s,u){for(const p in this._tiles){let f=this._tiles[p];if(u[p]||!f.hasData()||f.tileID.overscaledZ<=n||f.tileID.overscaledZ>s)continue;let _=f.tileID;for(;f&&f.tileID.overscaledZ>n+1;){const v=f.tileID.scaledTo(f.tileID.overscaledZ-1);f=this._tiles[v.key],f&&f.hasData()&&(_=v)}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),p=this._getLoadedTile(u);if(p)return p}}_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),p=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,u):u;this._cache.setMaxSize(p)}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 p=this._tiles[u];p.tileID=p.tileID.unwrapTo(p.tileID.wrap+n),s[p.tileID.key]=p}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(v=>new a.OverscaledTileID(v.canonical.z,v.wrap,v.canonical.z,v.canonical.x,v.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(v=>this._source.hasTile(v)))):s=[];const u=t.coveringZoomLevel(this._source),p=Math.max(u-Ii.maxOverzooming,this._source.minzoom),f=Math.max(u+Ii.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const v={};for(const E of s)if(E.canonical.z>this._source.minzoom){const M=E.scaledTo(E.canonical.z-1);v[M.key]=M;const z=E.scaledTo(Math.max(this._source.minzoom,Math.min(E.canonical.z,5)));v[z.key]=z}s=s.concat(Object.values(v))}const _=this._updateRetainedTiles(s,u);if(Zn(this._source.type)){const v={},E={},M=Object.keys(_);for(const z of M){const V=_[z],U=this._tiles[z];if(!U||U.fadeEndTime&&U.fadeEndTime<=a.exported.now())continue;const $=this.findLoadedParent(V,p);$&&(this._addTile($.tileID),v[$.tileID.key]=$.tileID),E[z]=V}this._retainLoadedChildren(E,u,f,_);for(const z in v)_[z]||(this._coveredTiles[z]=!0,_[z]=v[z]);if(n){const z={},V={};for(const U of s)this._tiles[U.key].hasData()?z[U.key]=U:V[U.key]=U;for(const U in V){const $=V[U].children(this._source.maxzoom);this._tiles[$[0].key]&&this._tiles[$[1].key]&&this._tiles[$[2].key]&&this._tiles[$[3].key]&&(z[$[0].key]=_[$[0].key]=$[0],z[$[1].key]=_[$[1].key]=$[1],z[$[2].key]=_[$[2].key]=$[2],z[$[3].key]=_[$[3].key]=$[3],delete V[U])}for(const U in V){const $=this.findLoadedParent(V[U],this._source.minzoom);if($){z[$.tileID.key]=_[$.tileID.key]=$.tileID;for(const H in z)z[H].isChildOf($.tileID)&&delete z[H]}}for(const U in this._tiles)z[U]||(this._coveredTiles[U]=!0)}}for(const v in _)this._tiles[v].clearFadeHold();const y=a.keysDifference(this._tiles,_);for(const v of y){const E=this._tiles[v];E.hasSymbolBuckets&&!E.holdingForFade()?E.setHoldDuration(this.map._fadeDuration):E.hasSymbolBuckets&&!E.symbolFadeFinished()||this._removeTile(v)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,n){const s={},u={},p=Math.max(n-Ii.maxOverzooming,this._source.minzoom),f=Math.max(n+Ii.maxUnderzooming,this._source.minzoom),_={};for(const y of t){const v=this._addTile(y);s[y.key]=y,v.hasData()||n<this._source.maxzoom&&(_[y.key]=y)}this._retainLoadedChildren(_,n,f,s);for(const y of t){let v=this._tiles[y.key];if(v.hasData())continue;if(n+1>this._source.maxzoom){const M=y.children(this._source.maxzoom)[0],z=this.getTile(M);if(z&&z.hasData()){s[M.key]=M;continue}}else{const M=y.children(this._source.maxzoom);if(s[M[0].key]&&s[M[1].key]&&s[M[2].key]&&s[M[3].key])continue}let E=v.wasRequested();for(let M=y.overscaledZ-1;M>=p;--M){const z=y.scaledTo(M);if(u[z.key]||(u[z.key]=!0,v=this.getTile(z),!v&&E&&(v=this._addTile(z)),v&&(s[z.key]=z,E=v.wasRequested(),v.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 p=u.scaledTo(u.overscaledZ-1);if(s=this._getLoadedTile(p),s)break;u=p}for(const p of n)this._loadedParentTiles[p]=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 kr(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=[],p=this.transform;if(!p)return u;const f=s?p.getCameraQueryGeometry(t):t,_=t.map(U=>p.pointCoordinate(U,this.terrain)),y=f.map(U=>p.pointCoordinate(U,this.terrain)),v=this.getIds();let E=1/0,M=1/0,z=-1/0,V=-1/0;for(const U of y)E=Math.min(E,U.x),M=Math.min(M,U.y),z=Math.max(z,U.x),V=Math.max(V,U.y);for(let U=0;U<v.length;U++){const $=this._tiles[v[U]];if($.holdingForFade())continue;const H=$.tileID,Q=Math.pow(2,p.zoom-$.tileID.overscaledZ),oe=n*$.queryPadding*a.EXTENT/$.tileSize/Q,G=[H.getTilePoint(new a.MercatorCoordinate(E,M)),H.getTilePoint(new a.MercatorCoordinate(z,V))];if(G[0].x-oe<a.EXTENT&&G[0].y-oe<a.EXTENT&&G[1].x+oe>=0&&G[1].y+oe>=0){const le=_.map(me=>H.getTilePoint(me)),se=y.map(me=>H.getTilePoint(me));u.push({tile:$,tileID:H,queryGeometry:le,cameraQueryGeometry:se,scale:Q})}}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(Zn(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 yn(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 Zn(l){return l==="raster"||l==="image"||l==="video"}Ii.maxOverzooming=10,Ii.maxUnderzooming=3;const xr="mapboxgl_preloaded_worker_pool";class Di{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<Di.workerCount;)this.workers.push(new Worker(on.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[xr]}numActive(){return Object.keys(this.active).length}}const jn=Math.floor(a.exported.hardwareConcurrency/2);let Rr;function xn(){return Rr||(Rr=new Di),Rr}function vn(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 Xn(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]=vn(l[n],t[l[n].ref]));return l}Di.workerCount=Math.max(Math.min(jn,6),1);const bt={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 lr(l,t,n){n.push({command:bt.addSource,args:[l,t[l]]})}function Br(l,t,n){t.push({command:bt.removeSource,args:[l]}),n[l]=!0}function Fr(l,t,n,s){Br(l,n,s),lr(l,t,n)}function Wn(l,t,n){let s;for(s in l[n])if(Object.prototype.hasOwnProperty.call(l[n],s)&&s!=="data"&&!ue(l[n][s],t[n][s]))return!1;for(s in t[n])if(Object.prototype.hasOwnProperty.call(t[n],s)&&s!=="data"&&!ue(l[n][s],t[n][s]))return!1;return!0}function vr(l,t,n,s,u,p){let f;for(f in t=t||{},l=l||{})Object.prototype.hasOwnProperty.call(l,f)&&(ue(l[f],t[f])||n.push({command:p,args:[s,f,t[f],u]}));for(f in t)Object.prototype.hasOwnProperty.call(t,f)&&!Object.prototype.hasOwnProperty.call(l,f)&&(ue(l[f],t[f])||n.push({command:p,args:[s,f,t[f],u]}))}function br(l){return l.id}function bn(l,t){return l[t.id]=t,l}class wr{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 p=n-1,f=this._distances[p],_=s-f,y=_>0?(u-f)/_:0;return this.points[p].mult(1-y).add(this.points[n].mult(y))}}function _e(l,t){let n=!0;return l==="always"||l!=="never"&&t!=="never"||(n=!1),n}class ze{constructor(t,n,s){const u=this.boxCells=[],p=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([]),p.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,p){this._forEachCell(n,s,u,p,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(n),this.bboxes.push(s),this.bboxes.push(u),this.bboxes.push(p)}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,p,f){this.boxCells[p].push(f)}_insertCircleCell(t,n,s,u,p,f){this.circleCells[p].push(f)}_query(t,n,s,u,p,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(p)return[{key:null,x1:t,y1:n,x2:s,y2:u}];for(let v=0;v<this.boxKeys.length;v++)y.push({key:this.boxKeys[v],x1:this.bboxes[4*v],y1:this.bboxes[4*v+1],x2:this.bboxes[4*v+2],y2:this.bboxes[4*v+3]});for(let v=0;v<this.circleKeys.length;v++){const E=this.circles[3*v],M=this.circles[3*v+1],z=this.circles[3*v+2];y.push({key:this.circleKeys[v],x1:E-z,y1:M-z,x2:E+z,y2:M+z})}}else this._forEachCell(t,n,s,u,this._queryCell,y,{hitTest:p,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,p,f){return this._query(t,n,s,u,!0,p,f).length>0}hitTestCircle(t,n,s,u,p){const f=t-s,_=t+s,y=n-s,v=n+s;if(_<0||f>this.width||v<0||y>this.height)return!1;const E=[];return this._forEachCell(f,y,_,v,this._queryCellCircle,E,{hitTest:!0,overlapMode:u,circle:{x:t,y:n,radius:s},seenUids:{box:{},circle:{}}},p),E.length>0}_queryCell(t,n,s,u,p,f,_,y){const{seenUids:v,hitTest:E,overlapMode:M}=_,z=this.boxCells[p];if(z!==null){const U=this.bboxes;for(const $ of z)if(!v.box[$]){v.box[$]=!0;const H=4*$,Q=this.boxKeys[$];if(t<=U[H+2]&&n<=U[H+3]&&s>=U[H+0]&&u>=U[H+1]&&(!y||y(Q))&&(!E||!_e(M,Q.overlapMode))&&(f.push({key:Q,x1:U[H],y1:U[H+1],x2:U[H+2],y2:U[H+3]}),E))return!0}}const V=this.circleCells[p];if(V!==null){const U=this.circles;for(const $ of V)if(!v.circle[$]){v.circle[$]=!0;const H=3*$,Q=this.circleKeys[$];if(this._circleAndRectCollide(U[H],U[H+1],U[H+2],t,n,s,u)&&(!y||y(Q))&&(!E||!_e(M,Q.overlapMode))){const oe=U[H],G=U[H+1],le=U[H+2];if(f.push({key:Q,x1:oe-le,y1:G-le,x2:oe+le,y2:G+le}),E)return!0}}}return!1}_queryCellCircle(t,n,s,u,p,f,_,y){const{circle:v,seenUids:E,overlapMode:M}=_,z=this.boxCells[p];if(z!==null){const U=this.bboxes;for(const $ of z)if(!E.box[$]){E.box[$]=!0;const H=4*$,Q=this.boxKeys[$];if(this._circleAndRectCollide(v.x,v.y,v.radius,U[H+0],U[H+1],U[H+2],U[H+3])&&(!y||y(Q))&&!_e(M,Q.overlapMode))return f.push(!0),!0}}const V=this.circleCells[p];if(V!==null){const U=this.circles;for(const $ of V)if(!E.circle[$]){E.circle[$]=!0;const H=3*$,Q=this.circleKeys[$];if(this._circlesCollide(U[H],U[H+1],U[H+2],v.x,v.y,v.radius)&&(!y||y(Q))&&!_e(M,Q.overlapMode))return f.push(!0),!0}}}_forEachCell(t,n,s,u,p,f,_,y){const v=this._convertToXCellCoord(t),E=this._convertToYCellCoord(n),M=this._convertToXCellCoord(s),z=this._convertToYCellCoord(u);for(let V=v;V<=M;V++)for(let U=E;U<=z;U++)if(p.call(this,t,n,s,u,this.xCellCount*U+V,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,p,f){const _=u-t,y=p-n,v=s+f;return v*v>_*_+y*y}_circleAndRectCollide(t,n,s,u,p,f,_){const y=(f-u)/2,v=Math.abs(t-(u+y));if(v>y+s)return!1;const E=(_-p)/2,M=Math.abs(n-(p+E));if(M>E+s)return!1;if(v<=y||M<=E)return!0;const z=v-y,V=M-E;return z*z+V*V<=s*s}}function Kr(l,t,n,s,u){const p=a.create();return t?(a.scale(p,p,[1/u,1/u,1]),n||a.rotateZ(p,p,s.angle)):a.multiply(p,s.labelPlaneMatrix,l),p}function Qi(l,t,n,s,u){if(t){const p=a.clone(l);return a.scale(p,p,[u,u,1]),n||a.rotateZ(p,p,-s.angle),p}return s.glCoordMatrix}function wt(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],Tr(s,s,t));const u=s[3];return{point:new a.pointGeometry(s[0]/u,s[1]/u),signedDistanceFromCamera:u}}function qi(l,t){return .5+l/t*.5}function Li(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 Ri(l,t,n,s,u,p,f,_,y,v){const E=s?l.textSizeData:l.iconSizeData,M=a.evaluateSizeForZoom(E,n.transform.zoom),z=[256/n.width*2+1,256/n.height*2+1],V=s?l.text.dynamicLayoutVertexArray:l.icon.dynamicLayoutVertexArray;V.clear();const U=l.lineVertexArray,$=s?l.text.placedSymbolArray:l.icon.placedSymbolArray,H=n.transform.width/n.transform.height;let Q=!1;for(let oe=0;oe<$.length;oe++){const G=$.get(oe);if(G.hidden||G.writingMode===a.WritingMode.vertical&&!Q){rt(G.numGlyphs,V);continue}let le;if(Q=!1,v?(le=[G.anchorX,G.anchorY,v(G.anchorX,G.anchorY),1],a.transformMat4(le,le,t)):(le=[G.anchorX,G.anchorY,0,1],Tr(le,le,t)),!Li(le,z)){rt(G.numGlyphs,V);continue}const se=qi(n.transform.cameraToCenterDistance,le[3]),me=a.evaluateSizeForFeature(E,M,G),ge=f?me/se:me*se,we=new a.pointGeometry(G.anchorX,G.anchorY),fe=wt(we,u,v).point,Fe={},Me=ut(G,ge,!1,_,t,u,p,l.glyphOffsetArray,U,V,fe,we,Fe,H,y,v);Q=Me.useVertical,(Me.notEnoughRoom||Q||Me.needsFlipping&&ut(G,ge,!0,_,t,u,p,l.glyphOffsetArray,U,V,fe,we,Fe,H,y,v).notEnoughRoom)&&rt(G.numGlyphs,V)}s?l.text.dynamicLayoutVertexBuffer.updateData(V):l.icon.dynamicLayoutVertexBuffer.updateData(V)}function Or(l,t,n,s,u,p,f,_,y,v,E,M,z){const V=_.glyphStartIndex+_.numGlyphs,U=_.lineStartIndex,$=_.lineStartIndex+_.lineLength,H=t.getoffsetX(_.glyphStartIndex),Q=t.getoffsetX(V-1),oe=fi(l*H,n,s,u,p,f,_.segment,U,$,y,v,E,M,z);if(!oe)return null;const G=fi(l*Q,n,s,u,p,f,_.segment,U,$,y,v,E,M,z);return G?{first:oe,last:G}:null}function Ae(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,p,f,_,y,v,E,M,z,V,U,$){const H=t/24,Q=l.lineOffsetX*H,oe=l.lineOffsetY*H;let G;if(l.numGlyphs>1){const le=l.glyphStartIndex+l.numGlyphs,se=l.lineStartIndex,me=l.lineStartIndex+l.lineLength,ge=Or(H,_,Q,oe,n,E,M,l,y,p,z,U,$);if(!ge)return{notEnoughRoom:!0};const we=wt(ge.first.point,f,$).point,fe=wt(ge.last.point,f,$).point;if(s&&!n){const Fe=Ae(l.writingMode,we,fe,V);if(Fe)return Fe}G=[ge.first];for(let Fe=l.glyphStartIndex+1;Fe<le-1;Fe++)G.push(fi(H*_.getoffsetX(Fe),Q,oe,n,E,M,l.segment,se,me,y,p,z,U,$));G.push(ge.last)}else{if(s&&!n){const se=wt(M,u,$).point,me=l.lineStartIndex+l.segment+1,ge=new a.pointGeometry(y.getx(me),y.gety(me)),we=wt(ge,u,$),fe=we.signedDistanceFromCamera>0?we.point:st(M,ge,se,1,u,$),Fe=Ae(l.writingMode,se,fe,V);if(Fe)return Fe}const le=fi(H*_.getoffsetX(l.glyphStartIndex),Q,oe,n,E,M,l.segment,l.lineStartIndex,l.lineStartIndex+l.lineLength,y,p,z,U,$);if(!le)return{notEnoughRoom:!0};G=[le]}for(const le of G)a.addDynamicAttributes(v,le.point,le.angle);return{}}function st(l,t,n,s,u,p){const f=wt(l.add(l.sub(t)._unit()),u,p).point,_=n.sub(f);return n.add(_._mult(s/_.mag()))}function fi(l,t,n,s,u,p,f,_,y,v,E,M,z,V){const U=s?l-t:l+t;let $=U>0?1:-1,H=0;s&&($*=-1,H=Math.PI),$<0&&(H+=Math.PI);let Q=$>0?_+f:_+f+1,oe=u,G=u,le=0,se=0;const me=Math.abs(U),ge=[];for(;le+se<=me;){if(Q+=$,Q<_||Q>=y)return null;if(G=oe,ge.push(oe),oe=M[Q],oe===void 0){const Oe=new a.pointGeometry(v.getx(Q),v.gety(Q)),at=wt(Oe,E,V);if(at.signedDistanceFromCamera>0)oe=M[Q]=at.point;else{const pt=Q-$;oe=st(le===0?p:new a.pointGeometry(v.getx(pt),v.gety(pt)),Oe,G,me-le+1,E,V)}}le+=se,se=G.dist(oe)}const we=(me-le)/se,fe=oe.sub(G),Fe=fe.mult(we)._add(G);Fe._add(fe._unit()._perp()._mult(n*$));const Me=H+Math.atan2(oe.y-G.y,oe.x-G.x);return ge.push(Fe),{point:Fe,angle:z?Me:0,path:ge}}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 rt(l,t){for(let n=0;n<l;n++){const s=t.length;t.resize(s+4),t.float32.set(Ur,3*s)}}function Tr(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 oi=100;class wn{constructor(t,n=new ze(t.width+200,t.height+200,25),s=new ze(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+oi,this.screenBottomBoundary=t.height+oi,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,n,s,u,p,f){const _=this.projectAndGetPerspectiveRatio(u,t.anchorPointX,t.anchorPointY,f),y=s*_.perspectiveRatio,v=t.x1*y+_.point.x,E=t.y1*y+_.point.y,M=t.x2*y+_.point.x,z=t.y2*y+_.point.y;return!this.isInsideGrid(v,E,M,z)||n!=="always"&&this.grid.hitTest(v,E,M,z,n,p)||_.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[v,E,M,z],offscreen:this.isOffscreen(v,E,M,z)}}placeCollisionCircles(t,n,s,u,p,f,_,y,v,E,M,z,V,U){const $=[],H=new a.pointGeometry(n.anchorX,n.anchorY),Q=wt(H,f,U),oe=qi(this.transform.cameraToCenterDistance,Q.signedDistanceFromCamera),G=(E?p/oe:p*oe)/a.ONE_EM,le=wt(H,_,U).point,se=Or(G,u,n.lineOffsetX*G,n.lineOffsetY*G,!1,le,H,n,s,_,{},!1,U);let me=!1,ge=!1,we=!0;if(se){const fe=.5*z*oe+V,Fe=new a.pointGeometry(-100,-100),Me=new a.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),Oe=new wr,at=se.first,pt=se.last;let We=[];for(let xt=at.path.length-1;xt>=1;xt--)We.push(at.path[xt]);for(let xt=1;xt<pt.path.length;xt++)We.push(pt.path[xt]);const Pt=2.5*fe;if(y){const xt=We.map(St=>wt(St,y,U));We=xt.some(St=>St.signedDistanceFromCamera<=0)?[]:xt.map(St=>St.point)}let zt=[];if(We.length>0){const xt=We[0].clone(),St=We[0].clone();for(let Dt=1;Dt<We.length;Dt++)xt.x=Math.min(xt.x,We[Dt].x),xt.y=Math.min(xt.y,We[Dt].y),St.x=Math.max(St.x,We[Dt].x),St.y=Math.max(St.y,We[Dt].y);zt=xt.x>=Fe.x&&St.x<=Me.x&&xt.y>=Fe.y&&St.y<=Me.y?[We]:St.x<Fe.x||xt.x>Me.x||St.y<Fe.y||xt.y>Me.y?[]:a.clipLine([We],Fe.x,Fe.y,Me.x,Me.y)}for(const xt of zt){Oe.reset(xt,.25*fe);let St=0;St=Oe.length<=.5*fe?1:Math.ceil(Oe.paddedLength/Pt)+1;for(let Dt=0;Dt<St;Dt++){const ai=Dt/Math.max(St-1,1),pr=Oe.lerp(ai),tr=pr.x+oi,dr=pr.y+oi;$.push(tr,dr,fe,0);const jr=tr-fe,ji=dr-fe,Ai=tr+fe,Ir=dr+fe;if(we=we&&this.isOffscreen(jr,ji,Ai,Ir),ge=ge||this.isInsideGrid(jr,ji,Ai,Ir),t!=="always"&&this.grid.hitTestCircle(tr,dr,fe,t,M)&&(me=!0,!v))return{circles:[],offscreen:!1,collisionDetected:me}}}}return{circles:!v&&me||!ge||oe<this.perspectiveRatioCutoff?[]:$,offscreen:we,collisionDetected:me}}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const n=[];let s=1/0,u=1/0,p=-1/0,f=-1/0;for(const E of t){const M=new a.pointGeometry(E.x+oi,E.y+oi);s=Math.min(s,M.x),u=Math.min(u,M.y),p=Math.max(p,M.x),f=Math.max(f,M.y),n.push(M)}const _=this.grid.query(s,u,p,f).concat(this.ignoredGrid.query(s,u,p,f)),y={},v={};for(const E of _){const M=E.key;if(y[M.bucketInstanceId]===void 0&&(y[M.bucketInstanceId]={}),y[M.bucketInstanceId][M.featureIndex])continue;const z=[new a.pointGeometry(E.x1,E.y1),new a.pointGeometry(E.x2,E.y1),new a.pointGeometry(E.x2,E.y2),new a.pointGeometry(E.x1,E.y2)];a.polygonIntersectsPolygon(n,z)&&(y[M.bucketInstanceId][M.featureIndex]=!0,v[M.bucketInstanceId]===void 0&&(v[M.bucketInstanceId]=[]),v[M.bucketInstanceId].push(M.featureIndex))}return v}insertCollisionBox(t,n,s,u,p,f){(s?this.ignoredGrid:this.grid).insert({bucketInstanceId:u,featureIndex:p,collisionGroupID:f,overlapMode:n},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,n,s,u,p,f){const _=s?this.ignoredGrid:this.grid,y={bucketInstanceId:u,featureIndex:p,collisionGroupID:f,overlapMode:n};for(let v=0;v<t.length;v+=4)_.insertCircle(y,t[v],t[v+1],t[v+2])}projectAndGetPerspectiveRatio(t,n,s,u){let p;return u?(p=[n,s,u(n,s),1],a.transformMat4(p,p,t)):(p=[n,s,0,1],Tr(p,p,t)),{point:new a.pointGeometry((p[0]/p[3]+1)/2*this.transform.width+oi,(-p[1]/p[3]+1)/2*this.transform.height+oi),perspectiveRatio:.5+this.transform.cameraToCenterDistance/p[3]*.5}}isOffscreen(t,n,s,u){return s<oi||t>=this.screenRightBoundary||u<oi||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 wi{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 kt{constructor(t,n,s,u,p){this.text=new wi(t?t.text:null,n,s,p),this.icon=new wi(t?t.icon:null,n,u,p)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Tn{constructor(t,n,s){this.text=t,this.icon=n,this.skipFade=s}}class cr{constructor(){this.invProjMatrix=a.create(),this.viewportMatrix=a.create(),this.circles=[]}}class Jr{constructor(t,n,s,u,p){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=s,this.bucketIndex=u,this.tileID=p}}class Yr{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 En(l,t,n,s,u){const{horizontalAlign:p,verticalAlign:f}=a.getAnchorAlignment(l),_=-(p-.5)*t,y=-(f-.5)*n,v=a.evaluateVariableOffset(l,s);return new a.pointGeometry(_+v[0]*u,y+v[1]*u)}function Qr(l,t,n,s,u,p){const{x1:f,x2:_,y1:y,y2:v,anchorPointX:E,anchorPointY:M}=l,z=new a.pointGeometry(t,n);return s&&z._rotate(u?p:-p),{x1:f+z.x,y1:y+z.y,x2:_+z.x,y2:v+z.y,anchorPointX:E,anchorPointY:M}}class O{constructor(t,n,s,u,p){this.transform=t.clone(),this.terrain=n,this.collisionIndex=new wn(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=s,this.retainedQueryData={},this.collisionGroups=new Yr(u),this.collisionCircleArrays={},this.prevPlacement=p,p&&(p.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,n,s,u){const p=s.getBucket(n),f=s.latestFeatureIndex;if(!p||!f||n.id!==p.layerIds[0])return;const _=s.collisionBoxArray,y=p.layers[0].layout,v=Math.pow(2,this.transform.zoom-s.tileID.overscaledZ),E=s.tileSize/a.EXTENT,M=this.transform.calculatePosMatrix(s.tileID.toUnwrapped()),z=y.get("text-pitch-alignment")==="map",V=y.get("text-rotation-alignment")==="map",U=Yt(s,1,this.transform.zoom),$=Kr(M,z,V,this.transform,U);let H=null;if(z){const oe=Qi(M,z,V,this.transform,U);H=a.multiply([],this.transform.labelPlaneMatrix,oe)}this.retainedQueryData[p.bucketInstanceId]=new Jr(p.bucketInstanceId,f,p.sourceLayerIndex,p.index,s.tileID);const Q={bucket:p,layout:y,posMatrix:M,textLabelPlaneMatrix:$,labelToScreenMatrix:H,scale:v,textPixelRatio:E,holdingForFade:s.holdingForFade(),collisionBoxArray:_,partiallyEvaluatedTextSize:a.evaluateSizeForZoom(p.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(p.sourceID)};if(u)for(const oe of p.sortKeyRanges){const{sortKey:G,symbolInstanceStart:le,symbolInstanceEnd:se}=oe;t.push({sortKey:G,symbolInstanceStart:le,symbolInstanceEnd:se,parameters:Q})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:p.symbolInstances.length,parameters:Q})}attemptAnchorPlacement(t,n,s,u,p,f,_,y,v,E,M,z,V,U,$,H){const Q=[z.textOffset0,z.textOffset1],oe=En(t,s,u,Q,p),G=this.collisionIndex.placeCollisionBox(Qr(n,oe.x,oe.y,f,_,this.transform.angle),M,y,v,E.predicate,H);if((!$||this.collisionIndex.placeCollisionBox(Qr($,oe.x,oe.y,f,_,this.transform.angle),M,y,v,E.predicate,H).box.length!==0)&&G.box.length>0){let le;if(this.prevPlacement&&this.prevPlacement.variableOffsets[z.crossTileID]&&this.prevPlacement.placements[z.crossTileID]&&this.prevPlacement.placements[z.crossTileID].text&&(le=this.prevPlacement.variableOffsets[z.crossTileID].anchor),z.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[z.crossTileID]={textOffset:Q,width:s,height:u,anchor:t,textBoxScale:p,prevAnchor:le},this.markUsedJustification(V,t,z,U),V.allowVerticalPlacement&&(this.markUsedOrientation(V,U,z),this.placedOrientations[z.crossTileID]=U),{shift:oe,placedGlyphBoxes:G}}}placeLayerBucketPart(t,n,s){const{bucket:u,layout:p,posMatrix:f,textLabelPlaneMatrix:_,labelToScreenMatrix:y,textPixelRatio:v,holdingForFade:E,collisionBoxArray:M,partiallyEvaluatedTextSize:z,collisionGroup:V}=t.parameters,U=p.get("text-optional"),$=p.get("icon-optional"),H=a.getOverlapMode(p,"text-overlap","text-allow-overlap"),Q=H==="always",oe=a.getOverlapMode(p,"icon-overlap","icon-allow-overlap"),G=oe==="always",le=p.get("text-rotation-alignment")==="map",se=p.get("text-pitch-alignment")==="map",me=p.get("icon-text-fit")!=="none",ge=p.get("symbol-z-order")==="viewport-y",we=Q&&(G||!u.hasIconData()||$),fe=G&&(Q||!u.hasTextData()||U);!u.collisionArrays&&M&&u.deserializeCollisionBoxes(M);const Fe=(Me,Oe)=>{if(n[Me.crossTileID])return;if(E)return void(this.placements[Me.crossTileID]=new Tn(!1,!1,!1));let at=!1,pt=!1,We=!0,Pt=null,zt={box:null,offscreen:null},xt={box:null,offscreen:null},St=null,Dt=null,ai=null,pr=0,tr=0,dr=0;Oe.textFeatureIndex?pr=Oe.textFeatureIndex:Me.useRuntimeCollisionCircles&&(pr=Me.featureIndex),Oe.verticalTextFeatureIndex&&(tr=Oe.verticalTextFeatureIndex);const jr=this.retainedQueryData[u.bucketInstanceId].tileID,ji=this.terrain?(ii,mt)=>this.terrain.getElevation(jr,ii,mt):null;for(const ii of["textBox","verticalTextBox","iconBox","verticalIconBox"]){const mt=Oe[ii];mt&&(mt.elevation=ji?ji(mt.anchorPointX,mt.anchorPointY):0)}const Ai=Oe.textBox;if(Ai){const ii=Mt=>{let li=a.WritingMode.horizontal;if(u.allowVerticalPlacement&&!Mt&&this.prevPlacement){const ci=this.prevPlacement.placedOrientations[Me.crossTileID];ci&&(this.placedOrientations[Me.crossTileID]=ci,li=ci,this.markUsedOrientation(u,li,Me))}return li},mt=(Mt,li)=>{if(u.allowVerticalPlacement&&Me.numVerticalGlyphVertices>0&&Oe.verticalTextBox){for(const ci of u.writingModes)if(ci===a.WritingMode.vertical?(zt=li(),xt=zt):zt=Mt(),zt&&zt.box&&zt.box.length)break}else zt=Mt()};if(p.get("text-variable-anchor")){let Mt=p.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[Me.crossTileID]){const qt=this.prevPlacement.variableOffsets[Me.crossTileID];Mt.indexOf(qt.anchor)>0&&(Mt=Mt.filter(Xi=>Xi!==qt.anchor),Mt.unshift(qt.anchor))}const li=(qt,Xi,sn)=>{const $s=qt.x2-qt.x1,Fn=qt.y2-qt.y1,Ja=Me.textBoxScale,Vs=me&&oe==="never"?Xi:null;let Xr={box:[],offscreen:!1};const an=H!=="never"?2*Mt.length:Mt.length;for(let ln=0;ln<an;++ln){const Xo=this.attemptAnchorPlacement(Mt[ln%Mt.length],qt,$s,Fn,Ja,le,se,v,f,V,ln>=Mt.length?H:"never",Me,u,sn,Vs,ji);if(Xo&&(Xr=Xo.placedGlyphBoxes,Xr&&Xr.box&&Xr.box.length)){at=!0,Pt=Xo.shift;break}}return Xr};mt(()=>li(Ai,Oe.iconBox,a.WritingMode.horizontal),()=>{const qt=Oe.verticalTextBox;return u.allowVerticalPlacement&&!(zt&&zt.box&&zt.box.length)&&Me.numVerticalGlyphVertices>0&&qt?li(qt,Oe.verticalIconBox,a.WritingMode.vertical):{box:null,offscreen:null}}),zt&&(at=zt.box,We=zt.offscreen);const ci=ii(zt&&zt.box);if(!at&&this.prevPlacement){const qt=this.prevPlacement.variableOffsets[Me.crossTileID];qt&&(this.variableOffsets[Me.crossTileID]=qt,this.markUsedJustification(u,qt.anchor,Me,ci))}}else{const Mt=(li,ci)=>{const qt=this.collisionIndex.placeCollisionBox(li,H,v,f,V.predicate,ji);return qt&&qt.box&&qt.box.length&&(this.markUsedOrientation(u,ci,Me),this.placedOrientations[Me.crossTileID]=ci),qt};mt(()=>Mt(Ai,a.WritingMode.horizontal),()=>{const li=Oe.verticalTextBox;return u.allowVerticalPlacement&&Me.numVerticalGlyphVertices>0&&li?Mt(li,a.WritingMode.vertical):{box:null,offscreen:null}}),ii(zt&&zt.box&&zt.box.length)}}if(St=zt,at=St&&St.box&&St.box.length>0,We=St&&St.offscreen,Me.useRuntimeCollisionCircles){const ii=u.text.placedSymbolArray.get(Me.centerJustifiedTextSymbolIndex),mt=a.evaluateSizeForFeature(u.textSizeData,z,ii),Mt=p.get("text-padding");Dt=this.collisionIndex.placeCollisionCircles(H,ii,u.lineVertexArray,u.glyphOffsetArray,mt,f,_,y,s,se,V.predicate,Me.collisionCircleDiameter,Mt,ji),Dt.circles.length&&Dt.collisionDetected&&!s&&a.warnOnce("Collisions detected, but collision boxes are not shown"),at=Q||Dt.circles.length>0&&!Dt.collisionDetected,We=We&&Dt.offscreen}if(Oe.iconFeatureIndex&&(dr=Oe.iconFeatureIndex),Oe.iconBox){const ii=mt=>{const Mt=me&&Pt?Qr(mt,Pt.x,Pt.y,le,se,this.transform.angle):mt;return this.collisionIndex.placeCollisionBox(Mt,oe,v,f,V.predicate,ji)};xt&&xt.box&&xt.box.length&&Oe.verticalIconBox?(ai=ii(Oe.verticalIconBox),pt=ai.box.length>0):(ai=ii(Oe.iconBox),pt=ai.box.length>0),We=We&&ai.offscreen}const Ir=U||Me.numHorizontalGlyphVertices===0&&Me.numVerticalGlyphVertices===0,jo=$||Me.numIconVertices===0;if(Ir||jo?jo?Ir||(pt=pt&&at):at=pt&&at:pt=at=pt&&at,at&&St&&St.box&&this.collisionIndex.insertCollisionBox(St.box,H,p.get("text-ignore-placement"),u.bucketInstanceId,xt&&xt.box&&tr?tr:pr,V.ID),pt&&ai&&this.collisionIndex.insertCollisionBox(ai.box,oe,p.get("icon-ignore-placement"),u.bucketInstanceId,dr,V.ID),Dt&&(at&&this.collisionIndex.insertCollisionCircles(Dt.circles,H,p.get("text-ignore-placement"),u.bucketInstanceId,pr,V.ID),s)){const ii=u.bucketInstanceId;let mt=this.collisionCircleArrays[ii];mt===void 0&&(mt=this.collisionCircleArrays[ii]=new cr);for(let Mt=0;Mt<Dt.circles.length;Mt+=4)mt.circles.push(Dt.circles[Mt+0]),mt.circles.push(Dt.circles[Mt+1]),mt.circles.push(Dt.circles[Mt+2]),mt.circles.push(Dt.collisionDetected?1:0)}if(Me.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[Me.crossTileID]=new Tn(at||we,pt||fe,We||u.justReloaded),n[Me.crossTileID]=!0};if(ge){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Me=u.getSortedSymbolIndexes(this.transform.angle);for(let Oe=Me.length-1;Oe>=0;--Oe){const at=Me[Oe];Fe(u.symbolInstances.get(at),u.collisionArrays[at])}}else for(let Me=t.symbolInstanceStart;Me<t.symbolInstanceEnd;Me++)Fe(u.symbolInstances.get(Me),u.collisionArrays[Me]);if(s&&u.bucketInstanceId in this.collisionCircleArrays){const Me=this.collisionCircleArrays[u.bucketInstanceId];a.invert(Me.invProjMatrix,f),Me.viewportMatrix=this.collisionIndex.getViewportMatrix()}u.justReloaded=!1}markUsedJustification(t,n,s,u){let p;p=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=p>=0&&_!==p?0:s.crossTileID)}markUsedOrientation(t,n,s){const u=n===a.WritingMode.horizontal||n===a.WritingMode.horizontalOnly?n:0,p=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=p)}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,p=n?n.opacities:{},f=n?n.variableOffsets:{},_=n?n.placedOrientations:{};for(const y in this.placements){const v=this.placements[y],E=p[y];E?(this.opacities[y]=new kt(E,u,v.text,v.icon),s=s||v.text!==E.text.placed||v.icon!==E.icon.placed):(this.opacities[y]=new kt(null,u,v.text,v.icon,v.skipFade),s=s||v.text||v.icon)}for(const y in p){const v=p[y];if(!this.opacities[y]){const E=new kt(v,u,!1,!1);E.isHidden()||(this.opacities[y]=E,s=s||v.text.placed||v.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 p=u.getBucket(t);p&&u.latestFeatureIndex&&t.id===p.layerIds[0]&&this.updateBucketOpacities(p,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,p=new kt(null,0,!1,!1,!0),f=u.get("text-allow-overlap"),_=u.get("icon-allow-overlap"),y=u.get("text-variable-anchor"),v=u.get("text-rotation-alignment")==="map",E=u.get("text-pitch-alignment")==="map",M=u.get("icon-text-fit")!=="none",z=new kt(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 V=(U,$,H)=>{for(let Q=0;Q<$/4;Q++)U.opacityVertexArray.emplaceBack(H)};for(let U=0;U<t.symbolInstances.length;U++){const $=t.symbolInstances.get(U),{numHorizontalGlyphVertices:H,numVerticalGlyphVertices:Q,crossTileID:oe}=$;let G=this.opacities[oe];n[oe]?G=p:G||(G=z,this.opacities[oe]=G),n[oe]=!0;const le=$.numIconVertices>0,se=this.placedOrientations[$.crossTileID],me=se===a.WritingMode.vertical,ge=se===a.WritingMode.horizontal||se===a.WritingMode.horizontalOnly;if(H>0||Q>0){const we=J(G.text);V(t.text,H,me?de:we),V(t.text,Q,ge?de:we);const fe=G.text.isHidden();[$.rightJustifiedTextSymbolIndex,$.centerJustifiedTextSymbolIndex,$.leftJustifiedTextSymbolIndex].forEach(Oe=>{Oe>=0&&(t.text.placedSymbolArray.get(Oe).hidden=fe||me?1:0)}),$.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get($.verticalPlacedTextSymbolIndex).hidden=fe||ge?1:0);const Fe=this.variableOffsets[$.crossTileID];Fe&&this.markUsedJustification(t,Fe.anchor,$,se);const Me=this.placedOrientations[$.crossTileID];Me&&(this.markUsedJustification(t,"left",$,Me),this.markUsedOrientation(t,Me,$))}if(le){const we=J(G.icon),fe=!(M&&$.verticalPlacedIconSymbolIndex&&me);$.placedIconSymbolIndex>=0&&(V(t.icon,$.numIconVertices,fe?we:de),t.icon.placedSymbolArray.get($.placedIconSymbolIndex).hidden=G.icon.isHidden()),$.verticalPlacedIconSymbolIndex>=0&&(V(t.icon,$.numVerticalIconVertices,fe?de:we),t.icon.placedSymbolArray.get($.verticalPlacedIconSymbolIndex).hidden=G.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const we=t.collisionArrays[U];if(we){let fe=new a.pointGeometry(0,0);if(we.textBox||we.verticalTextBox){let Me=!0;if(y){const Oe=this.variableOffsets[oe];Oe?(fe=En(Oe.anchor,Oe.width,Oe.height,Oe.textOffset,Oe.textBoxScale),v&&fe._rotate(E?this.transform.angle:-this.transform.angle)):Me=!1}we.textBox&&w(t.textCollisionBox.collisionVertexArray,G.text.placed,!Me||me,fe.x,fe.y),we.verticalTextBox&&w(t.textCollisionBox.collisionVertexArray,G.text.placed,!Me||ge,fe.x,fe.y)}const Fe=Boolean(!ge&&we.verticalIconBox);we.iconBox&&w(t.iconCollisionBox.collisionVertexArray,G.icon.placed,Fe,M?fe.x:0,M?fe.y:0),we.verticalIconBox&&w(t.iconCollisionBox.collisionVertexArray,G.icon.placed,!Fe,M?fe.x:0,M?fe.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 w(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 A=Math.pow(2,25),R=Math.pow(2,24),F=Math.pow(2,17),j=Math.pow(2,16),K=Math.pow(2,9),W=Math.pow(2,8),X=Math.pow(2,1);function J(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*A+t*R+n*F+t*j+n*K+t*W+n*X+t}const de=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,p){const f=this._bucketParts;for(;this._currentTileIndex<t.length;)if(n.getBucketParts(f,u,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,p())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++,p())return!0;return!1}}class pe{constructor(t,n,s,u,p,f,_,y){this.placement=new O(t,n,f,_,y),this._currentPlacementIndex=s.length-1,this._forceFullPlacement=u,this._showCollisionBoxes=p,this._done=!1}isDone(){return this._done}continuePlacement(t,n,s){const u=a.exported.now(),p=()=>{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,p))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 p=n.get(u),f=p.key;this.indexedSymbolInstances[f]||(this.indexedSymbolInstances[f]=[]),this.indexedSymbolInstances[f].push({crossTileID:p.crossTileID,coord:this.getScaledCoordinates(p,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 p=0;p<t.length;p++){const f=t.get(p);if(f.crossTileID)continue;const _=this.indexedSymbolInstances[f.key];if(!_)continue;const y=this.getScaledCoordinates(f,n);for(const v of _)if(Math.abs(v.coord.x-y.x)<=u&&Math.abs(v.coord.y-y.y)<=u&&!s[v.crossTileID]){s[v.crossTileID]=!0,f.crossTileID=v.crossTileID;break}}}}class Be{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Je{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],p={};for(const f in u){const _=u[f];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+n),p[_.tileID.key]=_}this.indexes[s]=p}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 p=0;p<n.symbolInstances.length;p++)n.symbolInstances.get(p).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const u=this.usedCrossTileIDs[t.overscaledZ];for(const p in this.indexes){const f=this.indexes[p];if(Number(p)>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(p)).key];_&&_.findMatches(n.symbolInstances,t,u)}}for(let p=0;p<n.symbolInstances.length;p++){const f=n.symbolInstances.get(p);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 p in u)t[u[p].bucketInstanceId]||(this.removeBucketCrossTileIDs(s,u[p]),delete u[p],n=!0)}return n}}class et{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 Je);let p=!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)&&(p=!0),f[y.bucketInstanceId]=!0)}return u.removeStaleBuckets(f)&&(p=!0),p}pruneUnusedLayers(t){const n={};t.forEach(s=>{n[s]=!0});for(const s in this.layerIndexes)n[s]||delete this.layerIndexes[s]}}var Tt=a.createLayout([{name:"a_pos",type:"Int16",components:2}]);class it 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 kr(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 p=t.clone();p.posMatrix=new Float64Array(16),a.ortho(p.posMatrix,0,a.EXTENT,0,a.EXTENT,0,1),n[s]=p}else if(u.canonical.isChildOf(t.canonical)){const p=t.clone();p.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),v=a.EXTENT>>f;a.ortho(p.posMatrix,0,v,0,v,0,1),a.translate(p.posMatrix,p.posMatrix,[-_*v,-y*v,0]),n[s]=p}else if(t.canonical.isChildOf(u.canonical)){const p=t.clone();p.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),v=a.EXTENT>>f;a.ortho(p.posMatrix,0,a.EXTENT,0,a.EXTENT,0,1),a.translate(p.posMatrix,p.posMatrix,[_*v,y*v,0]),a.scale(p.posMatrix,p.posMatrix,[1/2**f,1/2**f,0]),n[s]=p}}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 p=this.sourceCache.getTileByID(this._sourceTileCache[t.key]);if((!p||!p.dem)&&n)for(;u>=s.minzoom&&(!p||!p.dem);)p=this.sourceCache.getTileByID(t.scaledTo(u--).key);return p}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 it(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 p=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],v=[Math.floor(y[0]),Math.floor(y[1])],E=f.tile.dem.get(v[0],v[1]),M=f.tile.dem.get(v[0],v[1]+1),z=f.tile.dem.get(v[0]+1,v[1]),V=f.tile.dem.get(v[0]+1,v[1]+1);p=a.number(a.number(E,M,y[0]-v[0]),a.number(z,V,y[0]-v[0]),y[1]-v[1])}return p}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,p=new a.RGBAImage({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new Ce(u,p,u.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new Ce(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 Ce(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 p=t.canonical.z-n.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=u?p=t.canonical.z-u:a.warnOnce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const f=t.canonical.x-(t.canonical.x>>p<<p),_=t.canonical.y-(t.canonical.y>>p<<p),y=a.fromScaling(new Float64Array(16),[1/(a.EXTENT<<p),1/(a.EXTENT<<p),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 Ce(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 Ce(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 p=0,f=0;p<this._coordsTextureSize;p++)for(let _=0;_<this._coordsTextureSize;_++,f+=4)n[f+0]=255&_,n[f+1]=255&p,n[f+2]=_>>8<<4|p>>8,n[f+3]=0;const s=new a.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),u=new Ce(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,p=u.gl;u.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),p.readPixels(t.x,s.height/devicePixelRatio-t.y-1,1,1,p.RGBA,p.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]],v=y&&this.sourceCache.getTileByID(y);if(!v)return null;const E=this._coordsTextureSize,M=(1<<v.tileID.canonical.z)*E;return new a.MercatorCoordinate((v.tileID.canonical.x*E+f)/M,(v.tileID.canonical.y*E+_)/M,this.getElevation(v.tileID,f,_,E))}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,p=a.EXTENT/u,f=u*u;for(let _=0;_<=u;_++)for(let y=0;y<=u;y++)n.emplaceBack(y*p,_*p);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,Tt.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 Et=(l,t)=>a.emitValidationErrors(l,t&&t.filter(n=>n.identifier!=="source.canvas")),Lt=a.pick(bt,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),si=a.pick(bt,["setCenter","setZoom","setBearing","setPitch"]),$t=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 Wt(xn(),this),this.imageManager=new Xe,this.imageManager.setEventedParent(this),this.glyphManager=new ot(t._requestManager,n.localIdeographFontFamily),this.lineAtlas=new Xt(256,512),this.crossTileSymbolIndex=new et,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},(p,f)=>{if(a.triggerPluginCompletionEvent(p),f&&f.every(_=>_))for(const _ in s.sourceCaches)s.sourceCaches[_].reload()})}),this.on("data",u=>{if(u.dataType!=="source"||u.sourceDataType!=="metadata")return;const p=this.sourceCaches[u.sourceId];if(!p)return;const f=p.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,(p,f)=>{this._request=null,p?this.fire(new a.ErrorEvent(p)):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($t,!1)}_load(t,n){if(n&&Et(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=Xn(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 ct(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,p){let f,_,y;const v=u>1?"@2x":"";let E=a.getJSON(s.transformRequest(s.normalizeSpriteURL(n,v,".json"),a.ResourceType.SpriteJSON),(V,U)=>{E=null,y||(y=V,f=U,z())}),M=a.getImage(s.transformRequest(s.normalizeSpriteURL(n,v,".png"),a.ResourceType.SpriteImage),(V,U)=>{M=null,y||(y=V,_=U,z())});function z(){if(y)p(y);else if(f&&_){const V=a.exported.getImageData(_),U={};for(const $ in f){const{width:H,height:Q,x:oe,y:G,sdf:le,pixelRatio:se,stretchX:me,stretchY:ge,content:we}=f[$],fe=new a.RGBAImage({width:H,height:Q});a.RGBAImage.copy(V,fe,{x:oe,y:G},{x:0,y:0},{width:H,height:Q}),U[$]={data:fe,pixelRatio:se,sdf:le,stretchX:me,stretchY:ge,content:we}}p(null,U)}}return{cancel(){E&&(E.cancel(),E=null),M&&(M.cancel(),M=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),p=Object.keys(this._removedLayers);(u.length||p.length)&&this._updateWorkerLayers(u,p);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 p=this.sourceCaches[u];s[u]=p.used,p.used=!1}for(const u of this._order){const p=this._layers[u];p.recalculate(t,this._availableImages),!p.isHidden(t.zoom)&&p.source&&(this.sourceCaches[p.source].used=!0)}for(const u in s){const p=this.sourceCaches[u];s[u]!==p.used&&p.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(),Et(this,a.validateStyle(t)))return!1;(t=a.clone$1(t)).layers=Xn(t.layers);const n=function(u,p){if(!u)return[{command:bt.setStyle,args:[p]}];let f=[];try{if(!ue(u.version,p.version))return[{command:bt.setStyle,args:[p]}];ue(u.center,p.center)||f.push({command:bt.setCenter,args:[p.center]}),ue(u.zoom,p.zoom)||f.push({command:bt.setZoom,args:[p.zoom]}),ue(u.bearing,p.bearing)||f.push({command:bt.setBearing,args:[p.bearing]}),ue(u.pitch,p.pitch)||f.push({command:bt.setPitch,args:[p.pitch]}),ue(u.sprite,p.sprite)||f.push({command:bt.setSprite,args:[p.sprite]}),ue(u.glyphs,p.glyphs)||f.push({command:bt.setGlyphs,args:[p.glyphs]}),ue(u.transition,p.transition)||f.push({command:bt.setTransition,args:[p.transition]}),ue(u.light,p.light)||f.push({command:bt.setLight,args:[p.light]});const _={},y=[];(function(E,M,z,V){let U;for(U in M=M||{},E=E||{})Object.prototype.hasOwnProperty.call(E,U)&&(Object.prototype.hasOwnProperty.call(M,U)||Br(U,z,V));for(U in M)Object.prototype.hasOwnProperty.call(M,U)&&(Object.prototype.hasOwnProperty.call(E,U)?ue(E[U],M[U])||(E[U].type==="geojson"&&M[U].type==="geojson"&&Wn(E,M,U)?z.push({command:bt.setGeoJSONSourceData,args:[U,M[U].data]}):Fr(U,M,z,V)):lr(U,M,z))})(u.sources,p.sources,y,_);const v=[];u.layers&&u.layers.forEach(E=>{_[E.source]?f.push({command:bt.removeLayer,args:[E.id]}):v.push(E)}),f=f.concat(y),function(E,M,z){M=M||[];const V=(E=E||[]).map(br),U=M.map(br),$=E.reduce(bn,{}),H=M.reduce(bn,{}),Q=V.slice(),oe=Object.create(null);let G,le,se,me,ge,we,fe;for(G=0,le=0;G<V.length;G++)se=V[G],Object.prototype.hasOwnProperty.call(H,se)?le++:(z.push({command:bt.removeLayer,args:[se]}),Q.splice(Q.indexOf(se,le),1));for(G=0,le=0;G<U.length;G++)se=U[U.length-1-G],Q[Q.length-1-G]!==se&&(Object.prototype.hasOwnProperty.call($,se)?(z.push({command:bt.removeLayer,args:[se]}),Q.splice(Q.lastIndexOf(se,Q.length-le),1)):le++,we=Q[Q.length-G],z.push({command:bt.addLayer,args:[H[se],we]}),Q.splice(Q.length-G,0,se),oe[se]=!0);for(G=0;G<U.length;G++)if(se=U[G],me=$[se],ge=H[se],!oe[se]&&!ue(me,ge))if(ue(me.source,ge.source)&&ue(me["source-layer"],ge["source-layer"])&&ue(me.type,ge.type)){for(fe in vr(me.layout,ge.layout,z,se,null,bt.setLayoutProperty),vr(me.paint,ge.paint,z,se,null,bt.setPaintProperty),ue(me.filter,ge.filter)||z.push({command:bt.setFilter,args:[se,ge.filter]}),ue(me.minzoom,ge.minzoom)&&ue(me.maxzoom,ge.maxzoom)||z.push({command:bt.setLayerZoomRange,args:[se,ge.minzoom,ge.maxzoom]}),me)Object.prototype.hasOwnProperty.call(me,fe)&&fe!=="layout"&&fe!=="paint"&&fe!=="filter"&&fe!=="metadata"&&fe!=="minzoom"&&fe!=="maxzoom"&&(fe.indexOf("paint.")===0?vr(me[fe],ge[fe],z,se,fe.slice(6),bt.setPaintProperty):ue(me[fe],ge[fe])||z.push({command:bt.setLayerProperty,args:[se,fe,ge[fe]]}));for(fe in ge)Object.prototype.hasOwnProperty.call(ge,fe)&&!Object.prototype.hasOwnProperty.call(me,fe)&&fe!=="layout"&&fe!=="paint"&&fe!=="filter"&&fe!=="metadata"&&fe!=="minzoom"&&fe!=="maxzoom"&&(fe.indexOf("paint.")===0?vr(me[fe],ge[fe],z,se,fe.slice(6),bt.setPaintProperty):ue(me[fe],ge[fe])||z.push({command:bt.setLayerProperty,args:[se,fe,ge[fe]]}))}else z.push({command:bt.removeLayer,args:[se]}),we=Q[Q.lastIndexOf(se)+1],z.push({command:bt.addLayer,args:[ge,we]})}(v,p.layers,f)}catch(_){console.warn("Unable to compute style diff:",_),f=[{command:bt.setStyle,args:[p]}]}return f}(this.serialize(),t).filter(u=>!(u.command in si));if(n.length===0)return!1;const s=n.filter(u=>!(u.command in Lt));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 Ii(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 p;if(t.type==="custom"){if(Et(this,a.validateCustomStyleLayer(t)))return;p=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;p=a.createStyleLayer(t),this._validateLayer(p),p.setEventedParent(this,{layer:{id:u}}),this._serializedLayers[p.id]=p.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]=p,this._removedLayers[u]&&p.source&&p.type!=="custom"){const _=this._removedLayers[u];delete this._removedLayers[u],_.type!==p.type?this._updatedSources[p.source]="clear":(this._updatedSources[p.source]="reload",this.sourceCaches[p.source].pause())}this._updateLayer(p),p.onAdd&&p.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(!ue(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 p=this.getLayer(t);p?ue(p.getLayoutProperty(n),s)||(p.setLayoutProperty(n,s,u),this._updateLayer(p)):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 p=this.getLayer(t);p?ue(p.getPaintProperty(n),s)||(p.setPaintProperty(n,s,u)&&this._updateLayer(p),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,p=this.sourceCaches[s];if(p===void 0)return void this.fire(new a.ErrorEvent(new Error(`The source '${s}' does not exist in the map's style.`)));const f=p.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."))),p.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 p=u.getSource().type,f=p==="vector"?t.sourceLayer:void 0;p!=="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 v=y[_];if(v)for(const E of v)u.push(E)}}}u.sort((f,_)=>_.intersectionZ-f.intersectionZ);const p=[];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 v=u[y].feature;if(s[v.layer.id]<f)break;p.push(v),u.pop()}else for(const y of t){const v=y[_];if(v)for(const E of v)p.push(E.feature)}}return p}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 p=[];n.availableImages=this._availableImages;for(const f in this.sourceCaches)n.layers&&!u[f]||p.push(_n(this.sourceCaches[f],this._layers,this._serializedLayers,t,n,s));return this.placement&&p.push(function(f,_,y,v,E,M,z){const V={},U=M.queryRenderedSymbols(v),$=[];for(const H of Object.keys(U).map(Number))$.push(z[H]);$.sort(ar);for(const H of $){const Q=H.featureIndex.lookupSymbolFeatures(U[H.bucketInstanceId],_,H.bucketIndex,H.sourceLayerIndex,E.filter,E.layers,E.availableImages,f);for(const oe in Q){const G=V[oe]=V[oe]||[],le=Q[oe];le.sort((se,me)=>{const ge=H.featureSortOrder;if(ge){const we=ge.indexOf(se.featureIndex);return ge.indexOf(me.featureIndex)-we}return me.featureIndex-se.featureIndex});for(const se of le)G.push(se)}}for(const H in V)V[H].forEach(Q=>{const oe=Q.feature,G=y[f[H].source].getFeatureState(oe.layer["source-layer"],oe.id);oe.source=oe.layer.source,oe.layer["source-layer"]&&(oe.sourceLayer=oe.layer["source-layer"]),oe.state=G});return V}(this._layers,this._serializedLayers,this.sourceCaches,t,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(p)}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,p){const f=u.getRenderableIds().map(v=>u.getTileByID(v)),_=[],y={};for(let v=0;v<f.length;v++){const E=f[v],M=E.tileID.canonical.key;y[M]||(y[M]=!0,E.querySourceFeatures(_,p))}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(!ue(t[f],s[f])){u=!0;break}if(!u)return;const p={now:a.exported.now(),transition:a.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,n),this.light.updateTransitions(p)}_validate(t,n,s,u,p={}){return(!p||p.validate!==!1)&&Et(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,p=!1){let f=!1,_=!1;const y={};for(const v of this._order){const E=this._layers[v];if(E.type!=="symbol")continue;if(!y[E.source]){const z=this.sourceCaches[E.source];y[E.source]=z.getRenderableIds(!0).map(V=>z.getTileByID(V)).sort((V,U)=>U.tileID.overscaledZ-V.tileID.overscaledZ||(V.tileID.isLessThan(U.tileID)?-1:1))}const M=this.crossTileSymbolIndex.addLayer(E,y[E.source],t.center.lng);f=f||M}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((p=p||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,p,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 v of this._order){const E=this._layers[v];E.type==="symbol"&&this.placement.updateLayerOpacities(E,y[E.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 mn[l]},_i.setSourceType=function(l,t){mn[l]=t},_i.registerForPluginStateChange=a.registerForPluginStateChange;var Sn="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 Hn={prelude:Rt(`#ifdef GL_ES
|
|
3
|
-
precision mediump float;
|
|
4
|
-
#else
|
|
5
|
-
#if !defined(lowp)
|
|
6
|
-
#define lowp
|
|
7
|
-
#endif
|
|
8
|
-
#if !defined(mediump)
|
|
9
|
-
#define mediump
|
|
10
|
-
#endif
|
|
11
|
-
#if !defined(highp)
|
|
12
|
-
#define highp
|
|
13
|
-
#endif
|
|
14
|
-
#endif`,`#ifdef GL_ES
|
|
15
|
-
precision highp float;
|
|
16
|
-
#else
|
|
17
|
-
#if !defined(lowp)
|
|
18
|
-
#define lowp
|
|
19
|
-
#endif
|
|
20
|
-
#if !defined(mediump)
|
|
21
|
-
#define mediump
|
|
22
|
-
#endif
|
|
23
|
-
#if !defined(highp)
|
|
24
|
-
#define highp
|
|
25
|
-
#endif
|
|
26
|
-
#endif
|
|
27
|
-
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
|
|
28
|
-
);}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;}
|
|
29
|
-
#ifdef TERRAIN3D
|
|
30
|
-
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;
|
|
31
|
-
#endif
|
|
32
|
-
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) {
|
|
33
|
-
#ifdef TERRAIN3D
|
|
34
|
-
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));
|
|
35
|
-
#else
|
|
36
|
-
return 1.0;
|
|
37
|
-
#endif
|
|
38
|
-
}float calculate_visibility(vec4 pos) {
|
|
39
|
-
#ifdef TERRAIN3D
|
|
40
|
-
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;
|
|
41
|
-
#else
|
|
42
|
-
return 1.0;
|
|
43
|
-
#endif
|
|
44
|
-
}float ele(vec2 pos) {
|
|
45
|
-
#ifdef TERRAIN3D
|
|
46
|
-
vec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
|
|
47
|
-
#else
|
|
48
|
-
return 0.0;
|
|
49
|
-
#endif
|
|
50
|
-
}float get_elevation(vec2 pos) {
|
|
51
|
-
#ifdef TERRAIN3D
|
|
52
|
-
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;
|
|
53
|
-
#else
|
|
54
|
-
return 0.0;
|
|
55
|
-
#endif
|
|
56
|
-
}`),background:Rt(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;
|
|
57
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
58
|
-
gl_FragColor=vec4(1.0);
|
|
59
|
-
#endif
|
|
60
|
-
}`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:Rt(`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;
|
|
61
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
62
|
-
gl_FragColor=vec4(1.0);
|
|
63
|
-
#endif
|
|
64
|
-
}`,"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:Rt(`varying vec3 v_data;varying float v_visibility;
|
|
65
|
-
#pragma mapbox: define highp vec4 color
|
|
66
|
-
#pragma mapbox: define mediump float radius
|
|
67
|
-
#pragma mapbox: define lowp float blur
|
|
68
|
-
#pragma mapbox: define lowp float opacity
|
|
69
|
-
#pragma mapbox: define highp vec4 stroke_color
|
|
70
|
-
#pragma mapbox: define mediump float stroke_width
|
|
71
|
-
#pragma mapbox: define lowp float stroke_opacity
|
|
72
|
-
void main() {
|
|
73
|
-
#pragma mapbox: initialize highp vec4 color
|
|
74
|
-
#pragma mapbox: initialize mediump float radius
|
|
75
|
-
#pragma mapbox: initialize lowp float blur
|
|
76
|
-
#pragma mapbox: initialize lowp float opacity
|
|
77
|
-
#pragma mapbox: initialize highp vec4 stroke_color
|
|
78
|
-
#pragma mapbox: initialize mediump float stroke_width
|
|
79
|
-
#pragma mapbox: initialize lowp float stroke_opacity
|
|
80
|
-
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);
|
|
81
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
82
|
-
gl_FragColor=vec4(1.0);
|
|
83
|
-
#endif
|
|
84
|
-
}`,`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;
|
|
85
|
-
#pragma mapbox: define highp vec4 color
|
|
86
|
-
#pragma mapbox: define mediump float radius
|
|
87
|
-
#pragma mapbox: define lowp float blur
|
|
88
|
-
#pragma mapbox: define lowp float opacity
|
|
89
|
-
#pragma mapbox: define highp vec4 stroke_color
|
|
90
|
-
#pragma mapbox: define mediump float stroke_width
|
|
91
|
-
#pragma mapbox: define lowp float stroke_opacity
|
|
92
|
-
void main(void) {
|
|
93
|
-
#pragma mapbox: initialize highp vec4 color
|
|
94
|
-
#pragma mapbox: initialize mediump float radius
|
|
95
|
-
#pragma mapbox: initialize lowp float blur
|
|
96
|
-
#pragma mapbox: initialize lowp float opacity
|
|
97
|
-
#pragma mapbox: initialize highp vec4 stroke_color
|
|
98
|
-
#pragma mapbox: initialize mediump float stroke_width
|
|
99
|
-
#pragma mapbox: initialize lowp float stroke_opacity
|
|
100
|
-
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:Rt("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:Rt(`uniform highp float u_intensity;varying vec2 v_extrude;
|
|
101
|
-
#pragma mapbox: define highp float weight
|
|
102
|
-
#define GAUSS_COEF 0.3989422804014327
|
|
103
|
-
void main() {
|
|
104
|
-
#pragma mapbox: initialize highp float weight
|
|
105
|
-
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);
|
|
106
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
107
|
-
gl_FragColor=vec4(1.0);
|
|
108
|
-
#endif
|
|
109
|
-
}`,`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;
|
|
110
|
-
#pragma mapbox: define highp float weight
|
|
111
|
-
#pragma mapbox: define mediump float radius
|
|
112
|
-
const highp float ZERO=1.0/255.0/16.0;
|
|
113
|
-
#define GAUSS_COEF 0.3989422804014327
|
|
114
|
-
void main(void) {
|
|
115
|
-
#pragma mapbox: initialize highp float weight
|
|
116
|
-
#pragma mapbox: initialize mediump float radius
|
|
117
|
-
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:Rt(`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;
|
|
118
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
119
|
-
gl_FragColor=vec4(0.0);
|
|
120
|
-
#endif
|
|
121
|
-
}`,"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:Rt("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:Rt("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:Rt("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:Rt(`#pragma mapbox: define highp vec4 color
|
|
122
|
-
#pragma mapbox: define lowp float opacity
|
|
123
|
-
void main() {
|
|
124
|
-
#pragma mapbox: initialize highp vec4 color
|
|
125
|
-
#pragma mapbox: initialize lowp float opacity
|
|
126
|
-
gl_FragColor=color*opacity;
|
|
127
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
128
|
-
gl_FragColor=vec4(1.0);
|
|
129
|
-
#endif
|
|
130
|
-
}`,`attribute vec2 a_pos;uniform mat4 u_matrix;
|
|
131
|
-
#pragma mapbox: define highp vec4 color
|
|
132
|
-
#pragma mapbox: define lowp float opacity
|
|
133
|
-
void main() {
|
|
134
|
-
#pragma mapbox: initialize highp vec4 color
|
|
135
|
-
#pragma mapbox: initialize lowp float opacity
|
|
136
|
-
gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:Rt(`varying vec2 v_pos;
|
|
137
|
-
#pragma mapbox: define highp vec4 outline_color
|
|
138
|
-
#pragma mapbox: define lowp float opacity
|
|
139
|
-
void main() {
|
|
140
|
-
#pragma mapbox: initialize highp vec4 outline_color
|
|
141
|
-
#pragma mapbox: initialize lowp float opacity
|
|
142
|
-
float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);
|
|
143
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
144
|
-
gl_FragColor=vec4(1.0);
|
|
145
|
-
#endif
|
|
146
|
-
}`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;
|
|
147
|
-
#pragma mapbox: define highp vec4 outline_color
|
|
148
|
-
#pragma mapbox: define lowp float opacity
|
|
149
|
-
void main() {
|
|
150
|
-
#pragma mapbox: initialize highp vec4 outline_color
|
|
151
|
-
#pragma mapbox: initialize lowp float opacity
|
|
152
|
-
gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:Rt(`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;
|
|
153
|
-
#pragma mapbox: define lowp float opacity
|
|
154
|
-
#pragma mapbox: define lowp vec4 pattern_from
|
|
155
|
-
#pragma mapbox: define lowp vec4 pattern_to
|
|
156
|
-
void main() {
|
|
157
|
-
#pragma mapbox: initialize lowp float opacity
|
|
158
|
-
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
159
|
-
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
160
|
-
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;
|
|
161
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
162
|
-
gl_FragColor=vec4(1.0);
|
|
163
|
-
#endif
|
|
164
|
-
}`,`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;
|
|
165
|
-
#pragma mapbox: define lowp float opacity
|
|
166
|
-
#pragma mapbox: define lowp vec4 pattern_from
|
|
167
|
-
#pragma mapbox: define lowp vec4 pattern_to
|
|
168
|
-
#pragma mapbox: define lowp float pixel_ratio_from
|
|
169
|
-
#pragma mapbox: define lowp float pixel_ratio_to
|
|
170
|
-
void main() {
|
|
171
|
-
#pragma mapbox: initialize lowp float opacity
|
|
172
|
-
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
173
|
-
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
174
|
-
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
175
|
-
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
176
|
-
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:Rt(`#ifdef GL_ES
|
|
177
|
-
precision highp float;
|
|
178
|
-
#endif
|
|
179
|
-
uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;
|
|
180
|
-
#pragma mapbox: define lowp float opacity
|
|
181
|
-
#pragma mapbox: define lowp vec4 pattern_from
|
|
182
|
-
#pragma mapbox: define lowp vec4 pattern_to
|
|
183
|
-
void main() {
|
|
184
|
-
#pragma mapbox: initialize lowp float opacity
|
|
185
|
-
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
186
|
-
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
187
|
-
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;
|
|
188
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
189
|
-
gl_FragColor=vec4(1.0);
|
|
190
|
-
#endif
|
|
191
|
-
}`,`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;
|
|
192
|
-
#pragma mapbox: define lowp float opacity
|
|
193
|
-
#pragma mapbox: define lowp vec4 pattern_from
|
|
194
|
-
#pragma mapbox: define lowp vec4 pattern_to
|
|
195
|
-
#pragma mapbox: define lowp float pixel_ratio_from
|
|
196
|
-
#pragma mapbox: define lowp float pixel_ratio_to
|
|
197
|
-
void main() {
|
|
198
|
-
#pragma mapbox: initialize lowp float opacity
|
|
199
|
-
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
200
|
-
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
201
|
-
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
202
|
-
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
203
|
-
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:Rt(`varying vec4 v_color;void main() {gl_FragColor=v_color;
|
|
204
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
205
|
-
gl_FragColor=vec4(1.0);
|
|
206
|
-
#endif
|
|
207
|
-
}`,`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;
|
|
208
|
-
#ifdef TERRAIN3D
|
|
209
|
-
attribute vec2 a_centroid;
|
|
210
|
-
#endif
|
|
211
|
-
varying vec4 v_color;
|
|
212
|
-
#pragma mapbox: define highp float base
|
|
213
|
-
#pragma mapbox: define highp float height
|
|
214
|
-
#pragma mapbox: define highp vec4 color
|
|
215
|
-
void main() {
|
|
216
|
-
#pragma mapbox: initialize highp float base
|
|
217
|
-
#pragma mapbox: initialize highp float height
|
|
218
|
-
#pragma mapbox: initialize highp vec4 color
|
|
219
|
-
vec3 normal=a_normal_ed.xyz;
|
|
220
|
-
#ifdef TERRAIN3D
|
|
221
|
-
float baseDelta=10.0;float ele=get_elevation(a_centroid);
|
|
222
|
-
#else
|
|
223
|
-
float baseDelta=0.0;float ele=0.0;
|
|
224
|
-
#endif
|
|
225
|
-
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:Rt(`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;
|
|
226
|
-
#pragma mapbox: define lowp float base
|
|
227
|
-
#pragma mapbox: define lowp float height
|
|
228
|
-
#pragma mapbox: define lowp vec4 pattern_from
|
|
229
|
-
#pragma mapbox: define lowp vec4 pattern_to
|
|
230
|
-
#pragma mapbox: define lowp float pixel_ratio_from
|
|
231
|
-
#pragma mapbox: define lowp float pixel_ratio_to
|
|
232
|
-
void main() {
|
|
233
|
-
#pragma mapbox: initialize lowp float base
|
|
234
|
-
#pragma mapbox: initialize lowp float height
|
|
235
|
-
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
236
|
-
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
237
|
-
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
238
|
-
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
239
|
-
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;
|
|
240
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
241
|
-
gl_FragColor=vec4(1.0);
|
|
242
|
-
#endif
|
|
243
|
-
}`,`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;
|
|
244
|
-
#ifdef TERRAIN3D
|
|
245
|
-
attribute vec2 a_centroid;
|
|
246
|
-
#endif
|
|
247
|
-
varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
|
|
248
|
-
#pragma mapbox: define lowp float base
|
|
249
|
-
#pragma mapbox: define lowp float height
|
|
250
|
-
#pragma mapbox: define lowp vec4 pattern_from
|
|
251
|
-
#pragma mapbox: define lowp vec4 pattern_to
|
|
252
|
-
#pragma mapbox: define lowp float pixel_ratio_from
|
|
253
|
-
#pragma mapbox: define lowp float pixel_ratio_to
|
|
254
|
-
void main() {
|
|
255
|
-
#pragma mapbox: initialize lowp float base
|
|
256
|
-
#pragma mapbox: initialize lowp float height
|
|
257
|
-
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
258
|
-
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
259
|
-
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
260
|
-
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
261
|
-
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;
|
|
262
|
-
#ifdef TERRAIN3D
|
|
263
|
-
float baseDelta=10.0;float ele=get_elevation(a_centroid);
|
|
264
|
-
#else
|
|
265
|
-
float baseDelta=0.0;float ele=0.0;
|
|
266
|
-
#endif
|
|
267
|
-
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
|
|
268
|
-
? a_pos
|
|
269
|
-
: 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:Rt(`#ifdef GL_ES
|
|
270
|
-
precision highp float;
|
|
271
|
-
#endif
|
|
272
|
-
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);
|
|
273
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
274
|
-
gl_FragColor=vec4(1.0);
|
|
275
|
-
#endif
|
|
276
|
-
}`,"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:Rt(`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;
|
|
277
|
-
#define PI 3.141592653589793
|
|
278
|
-
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;
|
|
279
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
280
|
-
gl_FragColor=vec4(1.0);
|
|
281
|
-
#endif
|
|
282
|
-
}`,"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:Rt(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;
|
|
283
|
-
#pragma mapbox: define highp vec4 color
|
|
284
|
-
#pragma mapbox: define lowp float blur
|
|
285
|
-
#pragma mapbox: define lowp float opacity
|
|
286
|
-
void main() {
|
|
287
|
-
#pragma mapbox: initialize highp vec4 color
|
|
288
|
-
#pragma mapbox: initialize lowp float blur
|
|
289
|
-
#pragma mapbox: initialize lowp float opacity
|
|
290
|
-
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);
|
|
291
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
292
|
-
gl_FragColor=vec4(1.0);
|
|
293
|
-
#endif
|
|
294
|
-
}`,`
|
|
295
|
-
#define scale 0.015873016
|
|
296
|
-
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;
|
|
297
|
-
#pragma mapbox: define highp vec4 color
|
|
298
|
-
#pragma mapbox: define lowp float blur
|
|
299
|
-
#pragma mapbox: define lowp float opacity
|
|
300
|
-
#pragma mapbox: define mediump float gapwidth
|
|
301
|
-
#pragma mapbox: define lowp float offset
|
|
302
|
-
#pragma mapbox: define mediump float width
|
|
303
|
-
void main() {
|
|
304
|
-
#pragma mapbox: initialize highp vec4 color
|
|
305
|
-
#pragma mapbox: initialize lowp float blur
|
|
306
|
-
#pragma mapbox: initialize lowp float opacity
|
|
307
|
-
#pragma mapbox: initialize mediump float gapwidth
|
|
308
|
-
#pragma mapbox: initialize lowp float offset
|
|
309
|
-
#pragma mapbox: initialize mediump float width
|
|
310
|
-
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;
|
|
311
|
-
#ifdef TERRAIN3D
|
|
312
|
-
v_gamma_scale=1.0;
|
|
313
|
-
#else
|
|
314
|
-
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;
|
|
315
|
-
#endif
|
|
316
|
-
v_width2=vec2(outset,inset);}`),lineGradient:Rt(`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;
|
|
317
|
-
#pragma mapbox: define lowp float blur
|
|
318
|
-
#pragma mapbox: define lowp float opacity
|
|
319
|
-
void main() {
|
|
320
|
-
#pragma mapbox: initialize lowp float blur
|
|
321
|
-
#pragma mapbox: initialize lowp float opacity
|
|
322
|
-
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);
|
|
323
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
324
|
-
gl_FragColor=vec4(1.0);
|
|
325
|
-
#endif
|
|
326
|
-
}`,`
|
|
327
|
-
#define scale 0.015873016
|
|
328
|
-
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;
|
|
329
|
-
#pragma mapbox: define lowp float blur
|
|
330
|
-
#pragma mapbox: define lowp float opacity
|
|
331
|
-
#pragma mapbox: define mediump float gapwidth
|
|
332
|
-
#pragma mapbox: define lowp float offset
|
|
333
|
-
#pragma mapbox: define mediump float width
|
|
334
|
-
void main() {
|
|
335
|
-
#pragma mapbox: initialize lowp float blur
|
|
336
|
-
#pragma mapbox: initialize lowp float opacity
|
|
337
|
-
#pragma mapbox: initialize mediump float gapwidth
|
|
338
|
-
#pragma mapbox: initialize lowp float offset
|
|
339
|
-
#pragma mapbox: initialize mediump float width
|
|
340
|
-
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;
|
|
341
|
-
#ifdef TERRAIN3D
|
|
342
|
-
v_gamma_scale=1.0;
|
|
343
|
-
#else
|
|
344
|
-
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;
|
|
345
|
-
#endif
|
|
346
|
-
v_width2=vec2(outset,inset);}`),linePattern:Rt(`#ifdef GL_ES
|
|
347
|
-
precision highp float;
|
|
348
|
-
#endif
|
|
349
|
-
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;
|
|
350
|
-
#pragma mapbox: define lowp vec4 pattern_from
|
|
351
|
-
#pragma mapbox: define lowp vec4 pattern_to
|
|
352
|
-
#pragma mapbox: define lowp float pixel_ratio_from
|
|
353
|
-
#pragma mapbox: define lowp float pixel_ratio_to
|
|
354
|
-
#pragma mapbox: define lowp float blur
|
|
355
|
-
#pragma mapbox: define lowp float opacity
|
|
356
|
-
void main() {
|
|
357
|
-
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
358
|
-
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
359
|
-
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
360
|
-
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
361
|
-
#pragma mapbox: initialize lowp float blur
|
|
362
|
-
#pragma mapbox: initialize lowp float opacity
|
|
363
|
-
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;
|
|
364
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
365
|
-
gl_FragColor=vec4(1.0);
|
|
366
|
-
#endif
|
|
367
|
-
}`,`
|
|
368
|
-
#define scale 0.015873016
|
|
369
|
-
#define LINE_DISTANCE_SCALE 2.0
|
|
370
|
-
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;
|
|
371
|
-
#pragma mapbox: define lowp float blur
|
|
372
|
-
#pragma mapbox: define lowp float opacity
|
|
373
|
-
#pragma mapbox: define lowp float offset
|
|
374
|
-
#pragma mapbox: define mediump float gapwidth
|
|
375
|
-
#pragma mapbox: define mediump float width
|
|
376
|
-
#pragma mapbox: define lowp float floorwidth
|
|
377
|
-
#pragma mapbox: define lowp vec4 pattern_from
|
|
378
|
-
#pragma mapbox: define lowp vec4 pattern_to
|
|
379
|
-
#pragma mapbox: define lowp float pixel_ratio_from
|
|
380
|
-
#pragma mapbox: define lowp float pixel_ratio_to
|
|
381
|
-
void main() {
|
|
382
|
-
#pragma mapbox: initialize lowp float blur
|
|
383
|
-
#pragma mapbox: initialize lowp float opacity
|
|
384
|
-
#pragma mapbox: initialize lowp float offset
|
|
385
|
-
#pragma mapbox: initialize mediump float gapwidth
|
|
386
|
-
#pragma mapbox: initialize mediump float width
|
|
387
|
-
#pragma mapbox: initialize lowp float floorwidth
|
|
388
|
-
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
389
|
-
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
390
|
-
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
391
|
-
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
392
|
-
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;
|
|
393
|
-
#ifdef TERRAIN3D
|
|
394
|
-
v_gamma_scale=1.0;
|
|
395
|
-
#else
|
|
396
|
-
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;
|
|
397
|
-
#endif
|
|
398
|
-
v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:Rt(`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;
|
|
399
|
-
#pragma mapbox: define highp vec4 color
|
|
400
|
-
#pragma mapbox: define lowp float blur
|
|
401
|
-
#pragma mapbox: define lowp float opacity
|
|
402
|
-
#pragma mapbox: define mediump float width
|
|
403
|
-
#pragma mapbox: define lowp float floorwidth
|
|
404
|
-
void main() {
|
|
405
|
-
#pragma mapbox: initialize highp vec4 color
|
|
406
|
-
#pragma mapbox: initialize lowp float blur
|
|
407
|
-
#pragma mapbox: initialize lowp float opacity
|
|
408
|
-
#pragma mapbox: initialize mediump float width
|
|
409
|
-
#pragma mapbox: initialize lowp float floorwidth
|
|
410
|
-
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);
|
|
411
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
412
|
-
gl_FragColor=vec4(1.0);
|
|
413
|
-
#endif
|
|
414
|
-
}`,`
|
|
415
|
-
#define scale 0.015873016
|
|
416
|
-
#define LINE_DISTANCE_SCALE 2.0
|
|
417
|
-
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;
|
|
418
|
-
#pragma mapbox: define highp vec4 color
|
|
419
|
-
#pragma mapbox: define lowp float blur
|
|
420
|
-
#pragma mapbox: define lowp float opacity
|
|
421
|
-
#pragma mapbox: define mediump float gapwidth
|
|
422
|
-
#pragma mapbox: define lowp float offset
|
|
423
|
-
#pragma mapbox: define mediump float width
|
|
424
|
-
#pragma mapbox: define lowp float floorwidth
|
|
425
|
-
void main() {
|
|
426
|
-
#pragma mapbox: initialize highp vec4 color
|
|
427
|
-
#pragma mapbox: initialize lowp float blur
|
|
428
|
-
#pragma mapbox: initialize lowp float opacity
|
|
429
|
-
#pragma mapbox: initialize mediump float gapwidth
|
|
430
|
-
#pragma mapbox: initialize lowp float offset
|
|
431
|
-
#pragma mapbox: initialize mediump float width
|
|
432
|
-
#pragma mapbox: initialize lowp float floorwidth
|
|
433
|
-
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;
|
|
434
|
-
#ifdef TERRAIN3D
|
|
435
|
-
v_gamma_scale=1.0;
|
|
436
|
-
#else
|
|
437
|
-
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;
|
|
438
|
-
#endif
|
|
439
|
-
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:Rt(`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);
|
|
440
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
441
|
-
gl_FragColor=vec4(1.0);
|
|
442
|
-
#endif
|
|
443
|
-
}`,"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:Rt(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;
|
|
444
|
-
#pragma mapbox: define lowp float opacity
|
|
445
|
-
void main() {
|
|
446
|
-
#pragma mapbox: initialize lowp float opacity
|
|
447
|
-
lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;
|
|
448
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
449
|
-
gl_FragColor=vec4(1.0);
|
|
450
|
-
#endif
|
|
451
|
-
}`,`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;
|
|
452
|
-
#pragma mapbox: define lowp float opacity
|
|
453
|
-
void main() {
|
|
454
|
-
#pragma mapbox: initialize lowp float opacity
|
|
455
|
-
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 ?
|
|
456
|
-
camera_to_anchor_distance/u_camera_to_center_distance :
|
|
457
|
-
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:Rt(`#define SDF_PX 8.0
|
|
458
|
-
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;
|
|
459
|
-
#pragma mapbox: define highp vec4 fill_color
|
|
460
|
-
#pragma mapbox: define highp vec4 halo_color
|
|
461
|
-
#pragma mapbox: define lowp float opacity
|
|
462
|
-
#pragma mapbox: define lowp float halo_width
|
|
463
|
-
#pragma mapbox: define lowp float halo_blur
|
|
464
|
-
void main() {
|
|
465
|
-
#pragma mapbox: initialize highp vec4 fill_color
|
|
466
|
-
#pragma mapbox: initialize highp vec4 halo_color
|
|
467
|
-
#pragma mapbox: initialize lowp float opacity
|
|
468
|
-
#pragma mapbox: initialize lowp float halo_width
|
|
469
|
-
#pragma mapbox: initialize lowp float halo_blur
|
|
470
|
-
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);
|
|
471
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
472
|
-
gl_FragColor=vec4(1.0);
|
|
473
|
-
#endif
|
|
474
|
-
}`,`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;
|
|
475
|
-
#pragma mapbox: define highp vec4 fill_color
|
|
476
|
-
#pragma mapbox: define highp vec4 halo_color
|
|
477
|
-
#pragma mapbox: define lowp float opacity
|
|
478
|
-
#pragma mapbox: define lowp float halo_width
|
|
479
|
-
#pragma mapbox: define lowp float halo_blur
|
|
480
|
-
void main() {
|
|
481
|
-
#pragma mapbox: initialize highp vec4 fill_color
|
|
482
|
-
#pragma mapbox: initialize highp vec4 halo_color
|
|
483
|
-
#pragma mapbox: initialize lowp float opacity
|
|
484
|
-
#pragma mapbox: initialize lowp float halo_width
|
|
485
|
-
#pragma mapbox: initialize lowp float halo_blur
|
|
486
|
-
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 ?
|
|
487
|
-
camera_to_anchor_distance/u_camera_to_center_distance :
|
|
488
|
-
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:Rt(`#define SDF_PX 8.0
|
|
489
|
-
#define SDF 1.0
|
|
490
|
-
#define ICON 0.0
|
|
491
|
-
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;
|
|
492
|
-
#pragma mapbox: define highp vec4 fill_color
|
|
493
|
-
#pragma mapbox: define highp vec4 halo_color
|
|
494
|
-
#pragma mapbox: define lowp float opacity
|
|
495
|
-
#pragma mapbox: define lowp float halo_width
|
|
496
|
-
#pragma mapbox: define lowp float halo_blur
|
|
497
|
-
void main() {
|
|
498
|
-
#pragma mapbox: initialize highp vec4 fill_color
|
|
499
|
-
#pragma mapbox: initialize highp vec4 halo_color
|
|
500
|
-
#pragma mapbox: initialize lowp float opacity
|
|
501
|
-
#pragma mapbox: initialize lowp float halo_width
|
|
502
|
-
#pragma mapbox: initialize lowp float halo_blur
|
|
503
|
-
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;
|
|
504
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
505
|
-
gl_FragColor=vec4(1.0);
|
|
506
|
-
#endif
|
|
507
|
-
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);
|
|
508
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
509
|
-
gl_FragColor=vec4(1.0);
|
|
510
|
-
#endif
|
|
511
|
-
}`,`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;
|
|
512
|
-
#pragma mapbox: define highp vec4 fill_color
|
|
513
|
-
#pragma mapbox: define highp vec4 halo_color
|
|
514
|
-
#pragma mapbox: define lowp float opacity
|
|
515
|
-
#pragma mapbox: define lowp float halo_width
|
|
516
|
-
#pragma mapbox: define lowp float halo_blur
|
|
517
|
-
void main() {
|
|
518
|
-
#pragma mapbox: initialize highp vec4 fill_color
|
|
519
|
-
#pragma mapbox: initialize highp vec4 halo_color
|
|
520
|
-
#pragma mapbox: initialize lowp float opacity
|
|
521
|
-
#pragma mapbox: initialize lowp float halo_width
|
|
522
|
-
#pragma mapbox: initialize lowp float halo_blur
|
|
523
|
-
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 ?
|
|
524
|
-
camera_to_anchor_distance/u_camera_to_center_distance :
|
|
525
|
-
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:Rt("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",Sn),terrainDepth:Rt("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);}",Sn),terrainCoords:Rt("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);}",Sn)};function Rt(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),p=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),f=p?p.concat(u):u,_={};return{fragmentSource:l=l.replace(n,(y,v,E,M,z)=>(_[z]=!0,v==="define"?`
|
|
526
|
-
#ifndef HAS_UNIFORM_u_${z}
|
|
527
|
-
varying ${E} ${M} ${z};
|
|
528
|
-
#else
|
|
529
|
-
uniform ${E} ${M} u_${z};
|
|
530
|
-
#endif
|
|
531
|
-
`:`
|
|
532
|
-
#ifdef HAS_UNIFORM_u_${z}
|
|
533
|
-
${E} ${M} ${z} = u_${z};
|
|
534
|
-
#endif
|
|
535
|
-
`)),vertexSource:t=t.replace(n,(y,v,E,M,z)=>{const V=M==="float"?"vec2":"vec4",U=z.match(/color/)?"color":V;return _[z]?v==="define"?`
|
|
536
|
-
#ifndef HAS_UNIFORM_u_${z}
|
|
537
|
-
uniform lowp float u_${z}_t;
|
|
538
|
-
attribute ${E} ${V} a_${z};
|
|
539
|
-
varying ${E} ${M} ${z};
|
|
540
|
-
#else
|
|
541
|
-
uniform ${E} ${M} u_${z};
|
|
542
|
-
#endif
|
|
543
|
-
`:U==="vec4"?`
|
|
544
|
-
#ifndef HAS_UNIFORM_u_${z}
|
|
545
|
-
${z} = a_${z};
|
|
546
|
-
#else
|
|
547
|
-
${E} ${M} ${z} = u_${z};
|
|
548
|
-
#endif
|
|
549
|
-
`:`
|
|
550
|
-
#ifndef HAS_UNIFORM_u_${z}
|
|
551
|
-
${z} = unpack_mix_${U}(a_${z}, u_${z}_t);
|
|
552
|
-
#else
|
|
553
|
-
${E} ${M} ${z} = u_${z};
|
|
554
|
-
#endif
|
|
555
|
-
`:v==="define"?`
|
|
556
|
-
#ifndef HAS_UNIFORM_u_${z}
|
|
557
|
-
uniform lowp float u_${z}_t;
|
|
558
|
-
attribute ${E} ${V} a_${z};
|
|
559
|
-
#else
|
|
560
|
-
uniform ${E} ${M} u_${z};
|
|
561
|
-
#endif
|
|
562
|
-
`:U==="vec4"?`
|
|
563
|
-
#ifndef HAS_UNIFORM_u_${z}
|
|
564
|
-
${E} ${M} ${z} = a_${z};
|
|
565
|
-
#else
|
|
566
|
-
${E} ${M} ${z} = u_${z};
|
|
567
|
-
#endif
|
|
568
|
-
`:`
|
|
569
|
-
#ifndef HAS_UNIFORM_u_${z}
|
|
570
|
-
${E} ${M} ${z} = unpack_mix_${U}(a_${z}, u_${z}_t);
|
|
571
|
-
#else
|
|
572
|
-
${E} ${M} ${z} = u_${z};
|
|
573
|
-
#endif
|
|
574
|
-
`}),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,p,f,_,y,v){this.context=t;let E=this.boundPaintVertexBuffers.length!==u.length;for(let M=0;!E&&M<u.length;M++)this.boundPaintVertexBuffers[M]!==u[M]&&(E=!0);t.extVertexArrayObject&&this.vao&&this.boundProgram===n&&this.boundLayoutVertexBuffer===s&&!E&&this.boundIndexBuffer===p&&this.boundVertexOffset===f&&this.boundDynamicVertexBuffer===_&&this.boundDynamicVertexBuffer2===y&&this.boundDynamicVertexBuffer3===v?(t.bindVertexArrayOES.set(this.vao),_&&_.bind(),p&&p.dynamicDraw&&p.bind(),y&&y.bind(),v&&v.bind()):this.freshBind(n,s,u,p,f,_,y,v)}freshBind(t,n,s,u,p,f,_,y){let v;const E=t.numAttributes,M=this.context,z=M.gl;if(M.extVertexArrayObject)this.vao&&this.destroy(),this.vao=M.extVertexArrayObject.createVertexArrayOES(),M.bindVertexArrayOES.set(this.vao),v=0,this.boundProgram=t,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=s,this.boundIndexBuffer=u,this.boundVertexOffset=p,this.boundDynamicVertexBuffer=f,this.boundDynamicVertexBuffer2=_,this.boundDynamicVertexBuffer3=y;else{v=M.currentNumAttributes||0;for(let V=E;V<v;V++)z.disableVertexAttribArray(V)}n.enableAttributes(z,t);for(const V of s)V.enableAttributes(z,t);f&&f.enableAttributes(z,t),_&&_.enableAttributes(z,t),y&&y.enableAttributes(z,t),n.bind(),n.setVertexAttribPointers(z,t,p);for(const V of s)V.bind(),V.setVertexAttribPointers(z,t,p);f&&(f.bind(),f.setVertexAttribPointers(z,t,p)),u&&u.bind(),_&&(_.bind(),_.setVertexAttribPointers(z,t,p)),y&&(y.bind(),y.setVertexAttribPointers(z,t,p)),M.currentNumAttributes=E}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 da{constructor(t,n,s,u,p,f,_){const y=t.gl;this.program=y.createProgram();const v=cs(s.staticAttributes),E=u?u.getBinderAttributes():[],M=v.concat(E),z=Hn.prelude.staticUniforms?cs(Hn.prelude.staticUniforms):[],V=s.staticUniforms?cs(s.staticUniforms):[],U=u?u.getBinderUniforms():[],$=z.concat(V).concat(U),H=[];for(const ge of $)H.indexOf(ge)<0&&H.push(ge);const Q=u?u.defines():[];f&&Q.push("#define OVERDRAW_INSPECTOR;"),_&&Q.push("#define TERRAIN3D;");const oe=Q.concat(Hn.prelude.fragmentSource,s.fragmentSource).join(`
|
|
575
|
-
`),G=Q.concat(Hn.prelude.vertexSource,s.vertexSource).join(`
|
|
576
|
-
`),le=y.createShader(y.FRAGMENT_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);y.shaderSource(le,oe),y.compileShader(le),y.attachShader(this.program,le);const se=y.createShader(y.VERTEX_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);y.shaderSource(se,G),y.compileShader(se),y.attachShader(this.program,se),this.attributes={};const me={};this.numAttributes=M.length;for(let ge=0;ge<this.numAttributes;ge++)M[ge]&&(y.bindAttribLocation(this.program,ge,M[ge]),this.attributes[M[ge]]=ge);y.linkProgram(this.program),y.deleteShader(se),y.deleteShader(le);for(let ge=0;ge<H.length;ge++){const we=H[ge];if(we&&!me[we]){const fe=y.getUniformLocation(this.program,we);fe&&(me[we]=fe)}}this.fixedUniforms=p(t,me),this.terrainUniforms=((ge,we)=>({u_depth:new a.Uniform1i(ge,we.u_depth),u_terrain:new a.Uniform1i(ge,we.u_terrain),u_terrain_dim:new a.Uniform1f(ge,we.u_terrain_dim),u_terrain_matrix:new a.UniformMatrix4f(ge,we.u_terrain_matrix),u_terrain_unpack:new a.Uniform4f(ge,we.u_terrain_unpack),u_terrain_offset:new a.Uniform1f(ge,we.u_terrain_offset),u_terrain_exaggeration:new a.Uniform1f(ge,we.u_terrain_exaggeration)}))(t,me),this.binderUniforms=u?u.getUniforms(t,me):[]}draw(t,n,s,u,p,f,_,y,v,E,M,z,V,U,$,H,Q,oe){const G=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(s),t.setStencilMode(u),t.setColorMode(p),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 se in this.terrainUniforms)this.terrainUniforms[se].set(y[se])}for(const se in this.fixedUniforms)this.fixedUniforms[se].set(_[se]);$&&$.setUniforms(t,this.binderUniforms,V,{zoom:U});let le=0;switch(n){case G.LINES:le=2;break;case G.TRIANGLES:le=3;break;case G.LINE_STRIP:le=1}for(const se of z.get()){const me=se.vaos||(se.vaos={});(me[v]||(me[v]=new ls)).bind(t,this,E,$?$.getPaintVertexBuffers():[],M,se.vertexOffset,H,Q,oe),G.drawElements(n,se.primitiveLength*le,G.UNSIGNED_SHORT,se.primitiveOffset*le*2)}}}function fa(l,t,n){const s=1/Yt(n,1,t.transform.tileZoom),u=Math.pow(2,n.tileID.overscaledZ),p=n.tileSize*Math.pow(2,t.transform.tileZoom)/u,f=p*(n.tileID.canonical.x+n.tileID.wrap*u),_=p*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,p=u.properties.get("position"),f=[p.x,p.y,p.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}},Ml=(l,t,n,s,u,p,f)=>a.extend(us(l,t,n,s),fa(p,t,f),{u_height_factor:-Math.pow(2,u.overscaledZ)/f.tileSize/8}),Co=l=>({u_matrix:l}),hs=(l,t,n,s)=>a.extend(Co(l),fa(n,t,s)),ma=(l,t)=>({u_matrix:l,u_world:t}),ga=(l,t,n,s,u)=>a.extend(hs(l,t,n,s),{u_world:u}),_a=(l,t,n,s)=>{const u=l.transform;let p,f;if(s.paint.get("circle-pitch-alignment")==="map"){const _=Yt(n,1,u.zoom);p=!0,f=[_,_]}else p=!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:+p,u_device_pixel_ratio:l.pixelRatio,u_extrude_scale:f}},en=(l,t,n)=>{const s=Yt(n,1,t.zoom),u=Math.pow(2,t.zoom-n.tileID.overscaledZ),p=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:p}},Kn=(l,t,n=1)=>({u_matrix:l,u_color:t,u_overlay:0,u_overlay_scale:n}),In=l=>({u_matrix:l}),Ao=(l,t,n,s)=>({u_matrix:l,u_extrude_scale:Yt(t,1,n),u_intensity:s});function Mo(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 Cn=(l,t,n,s)=>{const u=l.transform;return{u_matrix:Yn(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]]}},ps=(l,t,n,s,u)=>a.extend(Cn(l,t,n,u),{u_image:0,u_image_height:s}),Po=(l,t,n,s,u)=>{const p=l.transform,f=Vt(t,p);return{u_matrix:Yn(l,t,n,u),u_texsize:t.imageAtlasTexture.size,u_ratio:1/Yt(t,1,p.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/p.pixelsToGLUnits[0],1/p.pixelsToGLUnits[1]]}},Jn=(l,t,n,s,u,p)=>{const f=l.lineAtlas,_=Vt(t,l.transform),y=n.layout.get("line-cap")==="round",v=f.getDash(s.from,y),E=f.getDash(s.to,y),M=v.width*u.fromScale,z=E.width*u.toScale;return a.extend(Cn(l,t,n,p),{u_patternscale_a:[_/M,-v.height/2],u_patternscale_b:[_/z,-E.height/2],u_sdfgamma:f.width/(256*Math.min(M,z)*l.pixelRatio)/2,u_image:0,u_tex_y_a:v.y,u_tex_y_b:E.y,u_mix:u.t})};function Vt(l,t){return 1/Yt(l,1,t.tileZoom)}function Yn(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 ya=(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:(p=u.paint.get("raster-contrast"),p>0?1/(1-p):1+p),u_spin_weights:xa(u.paint.get("raster-hue-rotate"))};var p,f};function xa(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 ds=(l,t,n,s,u,p,f,_,y,v)=>{const E=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:E.cameraToCenterDistance,u_pitch:E.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:E.width/E.height,u_fade_change:u.options.fadeDuration?u.symbolFadeChange:1,u_matrix:p,u_label_plane_matrix:f,u_coord_matrix:_,u_is_text:+y,u_pitch_with_map:+s,u_texsize:v,u_texture:0}},zo=(l,t,n,s,u,p,f,_,y,v,E)=>{const M=u.transform;return a.extend(ds(l,t,n,s,u,p,f,_,y,v),{u_gamma_scale:s?Math.cos(M._pitch)*M.cameraToCenterDistance:1,u_device_pixel_ratio:u.pixelRatio,u_is_halo:+E})},va=(l,t,n,s,u,p,f,_,y,v)=>a.extend(zo(l,t,n,s,u,p,f,_,!0,y,!0),{u_texsize_icon:v,u_texture_icon:1}),Pl=(l,t,n)=>({u_matrix:l,u_opacity:t,u_color:n}),zl=(l,t,n,s,u,p)=>a.extend(function(f,_,y,v){const E=y.imageManager.getPattern(f.from.toString()),M=y.imageManager.getPattern(f.to.toString()),{width:z,height:V}=y.imageManager.getPixelSize(),U=Math.pow(2,v.tileID.overscaledZ),$=v.tileSize*Math.pow(2,y.transform.tileZoom)/U,H=$*(v.tileID.canonical.x+v.tileID.wrap*U),Q=$*v.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:E.tl,u_pattern_br_a:E.br,u_pattern_tl_b:M.tl,u_pattern_br_b:M.br,u_texsize:[z,V],u_mix:_.t,u_pattern_size_a:E.displaySize,u_pattern_size_b:M.displaySize,u_scale_a:_.fromScale,u_scale_b:_.toScale,u_tile_units_to_pixels:1/Yt(v,1,y.transform.tileZoom),u_pixel_coord_upper:[H>>16,Q>>16],u_pixel_coord_lower:[65535&H,65535&Q]}}(s,p,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 p=t.gl;this.buffer=p.createBuffer(),t.bindVertexBuffer.set(this.buffer),p.bufferData(p.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?p.DYNAMIC_DRAW:p.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 p=this.attributes[u],f=n.attributes[p.name];f!==void 0&&t.vertexAttribPointer(f,p.components,t[gs[p.type]],!1,this.itemSize,p.offset+this.itemSize*(s||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Ct{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 ba extends Ct{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 kl extends Ct{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Qn extends Ct{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class eo extends Ct{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 wa extends Ct{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class Bi extends Ct{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class ys extends Ct{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 ko extends Ct{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 Do extends Ct{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 Ct{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 Ct{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 Lo extends Ct{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 Ct{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 Ct{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 Ro extends Ct{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 Ta extends Ct{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class Ea extends Ct{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 An extends Ct{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class Dl extends Ct{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class Ll extends Ct{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class Rl extends Ct{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class Bl extends Ct{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 Fl extends Ct{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 Ol extends Ct{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 Ct{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 Bo extends Ct{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 Ct{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 Ct{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 Mn extends Ct{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 Sa extends Ct{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 Ia extends Ct{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 Fo extends Ct{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class tn extends Fo{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 Ca extends Fo{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 Pn{constructor(t,n,s,u){this.context=t,this.width=n,this.height=s;const p=t.gl,f=this.framebuffer=p.createFramebuffer();if(this.colorAttachment=new tn(t,f),u&&(this.depthAttachment=new Ca(t,f)),p.checkFramebufferStatus(p.FRAMEBUFFER)!==p.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 Aa{constructor(t){this.gl=t,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new ba(this),this.clearDepth=new kl(this),this.clearStencil=new Qn(this),this.colorMask=new eo(this),this.depthMask=new wa(this),this.stencilMask=new Bi(this),this.stencilFunc=new ys(this),this.stencilOp=new ko(this),this.stencilTest=new Do(this),this.depthRange=new xs(this),this.depthTest=new vs(this),this.depthFunc=new Lo(this),this.blend=new bs(this),this.blendFunc=new ws(this),this.blendColor=new Ro(this),this.blendEquation=new Ta(this),this.cullFace=new Ea(this),this.cullFaceSide=new An(this),this.frontFace=new Dl(this),this.program=new Ll(this),this.activeTexture=new Rl(this),this.viewport=new Bl(this),this.bindFramebuffer=new Fl(this),this.bindRenderbuffer=new Ol(this),this.bindTexture=new Ts(this),this.bindVertexBuffer=new Bo(this),this.bindElementBuffer=new Es(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new Ss(this),this.pixelStoreUnpack=new Mn(this),this.pixelStoreUnpackPremultiplyAlpha=new Sa(this),this.pixelStoreUnpackFlipY=new Ia(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,p=u.createRenderbuffer();return this.bindRenderbuffer.set(p),u.renderbufferStorage(u.RENDERBUFFER,t,n,s),this.bindRenderbuffer.set(null),p}createFramebuffer(t,n,s){return new Pn(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){ue(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 At=7680;class Ft{constructor(t,n,s,u,p,f){this.test=t,this.ref=n,this.mask=s,this.fail=u,this.depthFail=p,this.pass=f}}Ft.disabled=new Ft({func:519,mask:0},0,0,At,At,At);class Nt{constructor(t,n,s){this.enable=t,this.mode=n,this.frontFace=s}}let to;function zn(l,t,n,s,u,p,f){const _=l.context,y=_.gl,v=l.useProgram("collisionBox"),E=[];let M=0,z=0;for(let G=0;G<s.length;G++){const le=s[G],se=t.getTile(le),me=se.getBucket(n);if(!me)continue;let ge=le.posMatrix;u[0]===0&&u[1]===0||(ge=l.translatePosMatrix(le.posMatrix,se,u,p));const we=f?me.textCollisionBox:me.iconCollisionBox,fe=me.collisionCircleArray;if(fe.length>0){const Fe=a.create(),Me=ge;a.mul(Fe,me.placementInvProjMatrix,l.transform.glCoordMatrix),a.mul(Fe,Fe,me.placementViewportMatrix),E.push({circleArray:fe,circleOffset:z,transform:Me,invTransform:Fe,coord:le}),M+=fe.length/4,z=M}we&&v.draw(_,y.LINES,yt.disabled,Ft.disabled,l.colorModeForRenderPass(),Nt.disabled,en(ge,l.transform,se),l.style.terrain&&l.style.terrain.getTerrainData(le),n.id,we.layoutVertexBuffer,we.indexBuffer,we.segments,null,l.transform.zoom,null,null,we.collisionVertexBuffer)}if(!f||!E.length)return;const V=l.useProgram("collisionCircle"),U=new a.CollisionCircleLayoutArray;U.resize(4*M),U._trim();let $=0;for(const G of E)for(let le=0;le<G.circleArray.length/4;le++){const se=4*le,me=G.circleArray[se+0],ge=G.circleArray[se+1],we=G.circleArray[se+2],fe=G.circleArray[se+3];U.emplace($++,me,ge,we,fe,0),U.emplace($++,me,ge,we,fe,1),U.emplace($++,me,ge,we,fe,2),U.emplace($++,me,ge,we,fe,3)}(!to||to.length<2*M)&&(to=function(G){const le=2*G,se=new a.QuadTriangleArray;se.resize(le),se._trim();for(let me=0;me<le;me++){const ge=6*me;se.uint16[ge+0]=4*me+0,se.uint16[ge+1]=4*me+1,se.uint16[ge+2]=4*me+2,se.uint16[ge+3]=4*me+2,se.uint16[ge+4]=4*me+3,se.uint16[ge+5]=4*me+0}return se}(M));const H=_.createIndexBuffer(to,!0),Q=_.createVertexBuffer(U,a.collisionCircleLayout.members,!0);for(const G of E){const le={u_matrix:G.transform,u_inv_matrix:G.invTransform,u_camera_to_center_distance:(oe=l.transform).cameraToCenterDistance,u_viewport_size:[oe.width,oe.height]};V.draw(_,y.TRIANGLES,yt.disabled,Ft.disabled,l.colorModeForRenderPass(),Nt.disabled,le,l.style.terrain&&l.style.terrain.getTerrainData(G.coord),n.id,Q,H,a.SegmentVector.simpleSegment(0,2*G.circleOffset,G.circleArray.length,G.circleArray.length/2),null,l.transform.zoom,null,null,null)}var oe;Q.destroy(),H.destroy()}Nt.disabled=new Nt(!1,1029,2305),Nt.backCCW=new Nt(!0,1029,2305);const Ul=a.identity(new Float32Array(16));function $l(l,t,n,s,u,p){const{horizontalAlign:f,verticalAlign:_}=a.getAnchorAlignment(l),y=-(f-.5)*t,v=-(_-.5)*n,E=a.evaluateVariableOffset(l,s);return new a.pointGeometry((y/u+E[0])*p,(v/u+E[1])*p)}function Ma(l,t,n,s,u,p,f,_,y,v,E){const M=l.text.placedSymbolArray,z=l.text.dynamicLayoutVertexArray,V=l.icon.dynamicLayoutVertexArray,U={};z.clear();for(let $=0;$<M.length;$++){const H=M.get($),Q=l.allowVerticalPlacement&&!H.placedOrientation,oe=H.hidden||!H.crossTileID||Q?null:s[H.crossTileID];if(oe){const G=new a.pointGeometry(H.anchorX,H.anchorY),le=wt(G,n?f:p,E),se=qi(u.cameraToCenterDistance,le.signedDistanceFromCamera);let me=a.evaluateSizeForFeature(l.textSizeData,y,H)*se/a.ONE_EM;n&&(me*=l.tilePixelRatio/_);const{width:ge,height:we,anchor:fe,textOffset:Fe,textBoxScale:Me}=oe,Oe=$l(fe,ge,we,Fe,Me,me),at=n?wt(G.add(Oe),p,E).point:le.point.add(t?Oe.rotate(-u.angle):Oe),pt=l.allowVerticalPlacement&&H.placedOrientation===a.WritingMode.vertical?Math.PI/2:0;for(let We=0;We<H.numGlyphs;We++)a.addDynamicAttributes(z,at,pt);v&&H.associatedIconIndex>=0&&(U[H.associatedIconIndex]={shiftedAnchor:at,angle:pt})}else rt(H.numGlyphs,z)}if(v){V.clear();const $=l.icon.placedSymbolArray;for(let H=0;H<$.length;H++){const Q=$.get(H);if(Q.hidden)rt(Q.numGlyphs,V);else{const oe=U[H];if(oe)for(let G=0;G<Q.numGlyphs;G++)a.addDynamicAttributes(V,oe.shiftedAnchor,oe.angle);else rt(Q.numGlyphs,V)}}l.icon.dynamicLayoutVertexBuffer.updateData(V)}l.text.dynamicLayoutVertexBuffer.updateData(z)}function Vl(l,t,n){return n.iconsInText&&t?"symbolTextAndIcon":l?"symbolSDF":"symbolIcon"}function Oo(l,t,n,s,u,p,f,_,y,v,E,M){const z=l.context,V=z.gl,U=l.transform,$=_==="map",H=y==="map",Q=_!=="viewport"&&n.layout.get("symbol-placement")!=="point",oe=$&&!H&&!Q,G=!n.layout.get("symbol-sort-key").isConstant();let le=!1;const se=l.depthModeForSublayer(0,yt.ReadOnly),me=n.layout.get("text-variable-anchor"),ge=[];for(const we of s){const fe=t.getTile(we),Fe=fe.getBucket(n);if(!Fe)continue;const Me=u?Fe.text:Fe.icon;if(!Me||!Me.segments.get().length)continue;const Oe=Me.programConfigurations.get(n.id),at=u||Fe.sdfIcons,pt=u?Fe.textSizeData:Fe.iconSizeData,We=H||U.pitch!==0,Pt=l.useProgram(Vl(at,u,Fe),Oe),zt=a.evaluateSizeForZoom(pt,U.zoom),xt=l.style.terrain&&l.style.terrain.getTerrainData(we);let St,Dt,ai,pr,tr=[0,0],dr=null;if(u){if(Dt=fe.glyphAtlasTexture,ai=V.LINEAR,St=fe.glyphAtlasTexture.size,Fe.iconsInText){tr=fe.imageAtlasTexture.size,dr=fe.imageAtlasTexture;const Xi=pt.kind==="composite"||pt.kind==="camera";pr=We||l.options.rotating||l.options.zooming||Xi?V.LINEAR:V.NEAREST}}else{const Xi=n.layout.get("icon-size").constantOr(0)!==1||Fe.iconsNeedLinear;Dt=fe.imageAtlasTexture,ai=at||l.options.rotating||l.options.zooming||Xi||We?V.LINEAR:V.NEAREST,St=fe.imageAtlasTexture.size}const jr=Yt(fe,1,l.transform.zoom),ji=Kr(we.posMatrix,H,$,l.transform,jr),Ai=Qi(we.posMatrix,H,$,l.transform,jr),Ir=me&&Fe.hasTextData(),jo=n.layout.get("icon-text-fit")!=="none"&&Ir&&Fe.hasIconData();if(Q){const Xi=l.style.terrain?($s,Fn)=>l.style.terrain.getElevation(we,$s,Fn):null,sn=n.layout.get("text-rotation-alignment")==="map";Ri(Fe,we.posMatrix,l,u,ji,Ai,H,v,sn,Xi)}const ii=l.translatePosMatrix(we.posMatrix,fe,p,f),mt=Q||u&&me||jo?Ul:ji,Mt=l.translatePosMatrix(Ai,fe,p,f,!0),li=at&&n.paint.get(u?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let ci;ci=at?Fe.iconsInText?va(pt.kind,zt,oe,H,l,ii,mt,Mt,St,tr):zo(pt.kind,zt,oe,H,l,ii,mt,Mt,u,St,!0):ds(pt.kind,zt,oe,H,l,ii,mt,Mt,u,St);const qt={program:Pt,buffers:Me,uniformValues:ci,atlasTexture:Dt,atlasTextureIcon:dr,atlasInterpolation:ai,atlasInterpolationIcon:pr,isSDF:at,hasHalo:li};if(G&&Fe.canOverlap){le=!0;const Xi=Me.segments.get();for(const sn of Xi)ge.push({segments:new a.SegmentVector([sn]),sortKey:sn.sortKey,state:qt,terrainData:xt})}else ge.push({segments:Me.segments,sortKey:0,state:qt,terrainData:xt})}le&&ge.sort((we,fe)=>we.sortKey-fe.sortKey);for(const we of ge){const fe=we.state;if(z.activeTexture.set(V.TEXTURE0),fe.atlasTexture.bind(fe.atlasInterpolation,V.CLAMP_TO_EDGE),fe.atlasTextureIcon&&(z.activeTexture.set(V.TEXTURE1),fe.atlasTextureIcon&&fe.atlasTextureIcon.bind(fe.atlasInterpolationIcon,V.CLAMP_TO_EDGE)),fe.isSDF){const Fe=fe.uniformValues;fe.hasHalo&&(Fe.u_is_halo=1,io(fe.buffers,we.segments,n,l,fe.program,se,E,M,Fe,we.terrainData)),Fe.u_is_halo=0}io(fe.buffers,we.segments,n,l,fe.program,se,E,M,fe.uniformValues,we.terrainData)}}function io(l,t,n,s,u,p,f,_,y,v){const E=s.context;u.draw(E,E.gl.TRIANGLES,p,f,_,Nt.disabled,y,v,n.id,l.layoutVertexBuffer,l.indexBuffer,t,n.paint,s.transform.zoom,l.programConfigurations.get(n.id),l.dynamicLayoutVertexBuffer,l.opacityVertexBuffer)}function ro(l,t,n,s,u,p,f){const _=l.context.gl,y=n.paint.get("fill-pattern"),v=y&&y.constantOr(1),E=n.getCrossfadeParameters();let M,z,V,U,$;f?(z=v&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",M=_.LINES):(z=v?"fillPattern":"fill",M=_.TRIANGLES);for(const H of s){const Q=t.getTile(H);if(v&&!Q.patternsLoaded())continue;const oe=Q.getBucket(n);if(!oe)continue;const G=oe.programConfigurations.get(n.id),le=l.useProgram(z,G),se=l.style.terrain&&l.style.terrain.getTerrainData(H);v&&(l.context.activeTexture.set(_.TEXTURE0),Q.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),G.updatePaintBuffers(E));const me=y.constantOr(null);if(me&&Q.imageAtlas){const fe=Q.imageAtlas,Fe=fe.patternPositions[me.to.toString()],Me=fe.patternPositions[me.from.toString()];Fe&&Me&&G.setConstantPatternPositions(Fe,Me)}const ge=se?H:null,we=l.translatePosMatrix(ge?ge.posMatrix:H.posMatrix,Q,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(f){U=oe.indexBuffer2,$=oe.segments2;const fe=[_.drawingBufferWidth,_.drawingBufferHeight];V=z==="fillOutlinePattern"&&v?ga(we,l,E,Q,fe):ma(we,fe)}else U=oe.indexBuffer,$=oe.segments,V=v?hs(we,l,E,Q):Co(we);le.draw(l.context,M,u,l.stencilModeForClipping(H),p,Nt.disabled,V,se,n.id,oe.layoutVertexBuffer,U,$,n.paint,l.transform.zoom,G)}}function no(l,t,n,s,u,p,f){const _=l.context,y=_.gl,v=n.paint.get("fill-extrusion-pattern"),E=v.constantOr(1),M=n.getCrossfadeParameters(),z=n.paint.get("fill-extrusion-opacity");for(const V of s){const U=t.getTile(V),$=U.getBucket(n);if(!$)continue;const H=l.style.terrain&&l.style.terrain.getTerrainData(V),Q=$.programConfigurations.get(n.id),oe=l.useProgram(E?"fillExtrusionPattern":"fillExtrusion",Q);E&&(l.context.activeTexture.set(y.TEXTURE0),U.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),Q.updatePaintBuffers(M));const G=v.constantOr(null);if(G&&U.imageAtlas){const ge=U.imageAtlas,we=ge.patternPositions[G.to.toString()],fe=ge.patternPositions[G.from.toString()];we&&fe&&Q.setConstantPatternPositions(we,fe)}const le=l.translatePosMatrix(V.posMatrix,U,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),se=n.paint.get("fill-extrusion-vertical-gradient"),me=E?Ml(le,l,se,z,V,M,U):us(le,l,se,z);oe.draw(_,_.gl.TRIANGLES,u,p,f,Nt.backCCW,me,H,n.id,$.layoutVertexBuffer,$.indexBuffer,$.segments,n.paint,l.transform.zoom,Q,l.style.terrain&&$.centroidVertexBuffer)}}function Is(l,t,n,s,u,p,f){const _=l.context,y=_.gl,v=n.fbo;if(!v)return;const E=l.useProgram("hillshade"),M=l.style.terrain&&l.style.terrain.getTerrainData(t);_.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,v.colorAttachment.get()),E.draw(_,y.TRIANGLES,u,p,f,Nt.disabled,((z,V,U,$)=>{const H=U.paint.get("hillshade-shadow-color"),Q=U.paint.get("hillshade-highlight-color"),oe=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-=z.transform.angle);const le=!z.options.moving;return{u_matrix:$?$.posMatrix:z.transform.calculatePosMatrix(V.tileID.toUnwrapped(),le),u_image:0,u_latrange:Mo(0,V.tileID),u_light:[U.paint.get("hillshade-exaggeration"),G],u_shadow:H,u_highlight:Q,u_accent:oe}})(l,n,s,M?t:null),M,s.id,l.rasterBoundsBuffer,l.quadTriangleIndexBuffer,l.rasterBoundsSegments)}function Pa(l,t,n,s,u,p){const f=l.context,_=f.gl,y=t.dem;if(y&&y.data){const v=y.dim,E=y.stride,M=y.getPixels();if(f.activeTexture.set(_.TEXTURE1),f.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||l.getTileTexture(E),t.demTexture){const V=t.demTexture;V.update(M,{premultiply:!1}),V.bind(_.NEAREST,_.CLAMP_TO_EDGE)}else t.demTexture=new Ce(f,M,_.RGBA,{premultiply:!1}),t.demTexture.bind(_.NEAREST,_.CLAMP_TO_EDGE);f.activeTexture.set(_.TEXTURE0);let z=t.fbo;if(!z){const V=new Ce(f,{width:v,height:v,data:null},_.RGBA);V.bind(_.LINEAR,_.CLAMP_TO_EDGE),z=t.fbo=f.createFramebuffer(v,v,!0),z.colorAttachment.set(V.texture)}f.bindFramebuffer.set(z.framebuffer),f.viewport.set([0,0,v,v]),l.useProgram("hillshadePrepare").draw(f,_.TRIANGLES,s,u,p,Nt.disabled,((V,U)=>{const $=U.stride,H=a.create();return a.ortho(H,0,a.EXTENT,-a.EXTENT,0,0,1),a.translate(H,H,[0,-a.EXTENT,0]),{u_matrix:H,u_image:1,u_dimension:[$,$],u_zoom:V.overscaledZ,u_unpack:U.getUnpackVector()}})(t.tileID,y),null,n.id,l.rasterBoundsBuffer,l.quadTriangleIndexBuffer,l.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function Uo(l,t,n,s,u,p){const f=s.paint.get("raster-fade-duration");if(!p&&f>0){const _=a.exported.now(),y=(_-l.timeAdded)/f,v=t?(_-t.timeAdded)/f:-1,E=n.getSource(),M=u.coveringZoomLevel({tileSize:E.tileSize,roundZoom:E.roundZoom}),z=!t||Math.abs(t.tileID.overscaledZ-M)>Math.abs(l.tileID.overscaledZ-M),V=z&&l.refreshedUponExpiration?1:a.clamp(z?y:1-v,0,1);return l.refreshedUponExpiration&&y>=1&&(l.refreshedUponExpiration=!1),t?{opacity:1,mix:1-V}:{opacity:V,mix:0}}return{opacity:1,mix:0}}const $o=new a.Color(1,0,0,1),er=new a.Color(0,1,0,1),za=new a.Color(0,0,1,1),Cs=new a.Color(1,0,1,1),ka=new a.Color(0,1,1,1);function rn(l,t,n,s){kn(l,0,t+n/2,l.transform.width,n,s)}function oo(l,t,n,s){kn(l,t-n/2,0,n,l.transform.height,s)}function kn(l,t,n,s,u,p){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:p}),_.disable(_.SCISSOR_TEST)}function Nl(l,t,n){const s=l.context,u=s.gl,p=n.posMatrix,f=l.useProgram("debug"),_=yt.disabled,y=Ft.disabled,v=l.colorModeForRenderPass(),E="$debug",M=l.style.terrain&&l.style.terrain.getTerrainData(n);s.activeTexture.set(u.TEXTURE0),l.emptyTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE);const z=t.getTileByID(n.key).latestRawTileData,V=Math.floor((z&&z.byteLength||0)/1024),U=t.getTile(n).tileSize,$=512/Math.min(U,512)*(n.overscaledZ/l.transform.zoom)*.5;let H=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(H+=` => ${n.overscaledZ}`),function(Q,oe){Q.initDebugOverlayCanvas();const G=Q.debugOverlayCanvas,le=Q.context.gl,se=Q.debugOverlayCanvas.getContext("2d");se.clearRect(0,0,G.width,G.height),se.shadowColor="white",se.shadowBlur=2,se.lineWidth=1.5,se.strokeStyle="white",se.textBaseline="top",se.font="bold 36px Open Sans, sans-serif",se.fillText(oe,5,5),se.strokeText(oe,5,5),Q.debugOverlayTexture.update(G),Q.debugOverlayTexture.bind(le.LINEAR,le.CLAMP_TO_EDGE)}(l,`${H} ${V}kB`),f.draw(s,u.TRIANGLES,_,y,Ot.alphaBlended,Nt.disabled,Kn(p,a.Color.transparent,$),null,E,l.debugBuffer,l.quadTriangleIndexBuffer,l.debugSegments),f.draw(s,u.LINE_STRIP,_,y,v,Nt.disabled,Kn(p,a.Color.red),M,E,l.debugBuffer,l.tileBorderIndexBuffer,l.debugSegments)}function Vo(l,t,n){const s=l.context,u=s.gl,p=l.colorModeForRenderPass(),f=new yt(u.LEQUAL,yt.ReadWrite,l.depthRangeFor3D),_=l.useProgram("terrain"),y=t.getTerrainMesh(),v=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 E=l.transform.calculatePosMatrix(n.tileID.toUnwrapped());_.draw(s,u.TRIANGLES,f,Ft.disabled,p,Nt.backCCW,{u_matrix:E,u_texture:0},v,"terrain",y.vertexBuffer,y.indexBuffer,y.segments)}function Da(l,t,n,s){const u=l.context,p=n.tileSize*t.qualityFactor;n.textures[s]||(n.textures[s]=l.getTileTexture(p)||new Ce(u,{width:p,height:p,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,p,p])}class La{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 p of u){const f=n.sourceCache.getTerrainCoords(p);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],p=u.source;if(this._renderToTexture[u.type]&&!this._coordsDescendingInvStr[p]){this._coordsDescendingInvStr[p]={};for(const f in this._coordsDescendingInv[p])this._coordsDescendingInvStr[p][f]=this._coordsDescendingInv[p][f].map(_=>_.key).sort().join()}}return this._renderableTiles.forEach(s=>{for(const u in this._coordsDescendingInvStr){const p=this._coordsDescendingInvStr[u][s.tileID.key];p&&p!==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,p=s.currentLayer,f=p+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[p]),!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 v of this._renderableTiles){if(Da(s,s.style.terrain,v,_),this._rerender[v.tileID.key]){s.context.clear({color:a.Color.transparent});for(let E=0;E<y.length;E++){const M=s.style._layers[y[E]],z=M.source?this._coordsDescendingInv[M.source][v.tileID.key]:[v.tileID];s._renderTileClippingMasks(M,z),s.renderLayer(s,s.style.sourceCaches[M.source],M,z),M.source&&(v.textureCoords[M.source]=this._coordsDescendingInvStr[M.source][v.tileID.key])}}Vo(s,s.style.terrain,v)}if(n==="hillshade"){this._stacks.push([u[p]]);for(const v of this._renderableTiles){const E=this._coordsDescendingInv[t.source][v.tileID.key];Da(s,s.style.terrain,v,this._stacks.length-1),s.context.clear({color:a.Color.transparent}),s._renderTileClippingMasks(t,E),s.renderLayer(s,s.style.sourceCaches[t.source],t,E),Vo(s,s.style.terrain,v)}return!0}return this._renderToTexture[n]}return!1}}const so={symbol:function(l,t,n,s,u){if(l.renderPass!=="translucent")return;const p=Ft.disabled,f=l.colorModeForRenderPass();n.layout.get("text-variable-anchor")&&function(_,y,v,E,M,z,V){const U=y.transform,$=M==="map",H=z==="map";for(const Q of _){const oe=E.getTile(Q),G=oe.getBucket(v);if(!G||!G.text||!G.text.segments.get().length)continue;const le=a.evaluateSizeForZoom(G.textSizeData,U.zoom),se=Yt(oe,1,y.transform.zoom),me=Kr(Q.posMatrix,H,$,y.transform,se),ge=v.layout.get("icon-text-fit")!=="none"&&G.hasIconData();if(le){const we=Math.pow(2,U.zoom-oe.tileID.overscaledZ);Ma(G,$,H,V,U,me,Q.posMatrix,we,le,ge,y.style.terrain?(fe,Fe)=>y.style.terrain.getElevation(Q,fe,Fe):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&&Oo(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"),p,f),n.paint.get("text-opacity").constantOr(1)!==0&&Oo(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"),p,f),t.map.showCollisionBoxes&&(zn(l,t,n,s,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),zn(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"),p=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&&(p.constantOr(1)===0||f.constantOr(1)===0))return;const y=l.context,v=y.gl,E=l.depthModeForSublayer(0,yt.ReadOnly),M=Ft.disabled,z=l.colorModeForRenderPass(),V=[];for(let U=0;U<s.length;U++){const $=s[U],H=t.getTile($),Q=H.getBucket(n);if(!Q)continue;const oe=Q.programConfigurations.get(n.id),G=l.useProgram("circle",oe),le=Q.layoutVertexBuffer,se=Q.indexBuffer,me=l.style.terrain&&l.style.terrain.getTerrainData($),ge={programConfiguration:oe,program:G,layoutVertexBuffer:le,indexBuffer:se,uniformValues:_a(l,$,H,n),terrainData:me};if(_){const we=Q.segments.get();for(const fe of we)V.push({segments:new a.SegmentVector([fe]),sortKey:fe.sortKey,state:ge})}else V.push({segments:Q.segments,sortKey:0,state:ge})}_&&V.sort((U,$)=>U.sortKey-$.sortKey);for(const U of V){const{programConfiguration:$,program:H,layoutVertexBuffer:Q,indexBuffer:oe,uniformValues:G,terrainData:le}=U.state;H.draw(y,v.TRIANGLES,E,M,z,Nt.disabled,G,le,n.id,Q,oe,U.segments,n.paint,l.transform.zoom,$)}},heatmap:function(l,t,n,s){if(n.paint.get("heatmap-opacity")!==0)if(l.renderPass==="offscreen"){const u=l.context,p=u.gl,f=Ft.disabled,_=new Ot([p.ONE,p.ONE],a.Color.transparent,[!0,!0,!0,!0]);(function(y,v,E){const M=y.gl;y.activeTexture.set(M.TEXTURE1),y.viewport.set([0,0,v.width/4,v.height/4]);let z=E.heatmapFbo;if(z)M.bindTexture(M.TEXTURE_2D,z.colorAttachment.get()),y.bindFramebuffer.set(z.framebuffer);else{const V=M.createTexture();M.bindTexture(M.TEXTURE_2D,V),M.texParameteri(M.TEXTURE_2D,M.TEXTURE_WRAP_S,M.CLAMP_TO_EDGE),M.texParameteri(M.TEXTURE_2D,M.TEXTURE_WRAP_T,M.CLAMP_TO_EDGE),M.texParameteri(M.TEXTURE_2D,M.TEXTURE_MIN_FILTER,M.LINEAR),M.texParameteri(M.TEXTURE_2D,M.TEXTURE_MAG_FILTER,M.LINEAR),z=E.heatmapFbo=y.createFramebuffer(v.width/4,v.height/4,!1),function(U,$,H,Q){const oe=U.gl;oe.texImage2D(oe.TEXTURE_2D,0,oe.RGBA,$.width/4,$.height/4,0,oe.RGBA,U.extRenderToTextureHalfFloat?U.extTextureHalfFloat.HALF_FLOAT_OES:oe.UNSIGNED_BYTE,null),Q.colorAttachment.set(H)}(y,v,V,z)}})(u,l,n),u.clear({color:a.Color.transparent});for(let y=0;y<s.length;y++){const v=s[y];if(t.hasRenderableParent(v))continue;const E=t.getTile(v),M=E.getBucket(n);if(!M)continue;const z=M.programConfigurations.get(n.id),V=l.useProgram("heatmap",z),{zoom:U}=l.transform;V.draw(u,p.TRIANGLES,yt.disabled,f,_,Nt.disabled,Ao(v.posMatrix,E,U,n.paint.get("heatmap-intensity")),null,n.id,M.layoutVertexBuffer,M.indexBuffer,M.segments,n.paint,l.transform.zoom,z)}u.viewport.set([0,0,l.width,l.height])}else l.renderPass==="translucent"&&(l.context.setColorMode(l.colorModeForRenderPass()),function(u,p){const f=u.context,_=f.gl,y=p.heatmapFbo;if(!y)return;f.activeTexture.set(_.TEXTURE0),_.bindTexture(_.TEXTURE_2D,y.colorAttachment.get()),f.activeTexture.set(_.TEXTURE1);let v=p.colorRampTexture;v||(v=p.colorRampTexture=new Ce(f,p.colorRamp,_.RGBA)),v.bind(_.LINEAR,_.CLAMP_TO_EDGE),u.useProgram("heatmapTexture").draw(f,_.TRIANGLES,yt.disabled,Ft.disabled,u.colorModeForRenderPass(),Nt.disabled,((E,M,z,V)=>{const U=a.create();a.ortho(U,0,E.width,E.height,0,0,1);const $=E.context.gl;return{u_matrix:U,u_world:[$.drawingBufferWidth,$.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:M.paint.get("heatmap-opacity")}})(u,p),null,p.id,u.viewportBuffer,u.quadTriangleIndexBuffer,u.viewportSegments,p.paint,u.transform.zoom)}(l,n))},line:function(l,t,n,s){if(l.renderPass!=="translucent")return;const u=n.paint.get("line-opacity"),p=n.paint.get("line-width");if(u.constantOr(1)===0||p.constantOr(1)===0)return;const f=l.depthModeForSublayer(0,yt.ReadOnly),_=l.colorModeForRenderPass(),y=n.paint.get("line-dasharray"),v=n.paint.get("line-pattern"),E=v.constantOr(1),M=n.paint.get("line-gradient"),z=n.getCrossfadeParameters(),V=E?"linePattern":y?"lineSDF":M?"lineGradient":"line",U=l.context,$=U.gl;let H=!0;for(const Q of s){const oe=t.getTile(Q);if(E&&!oe.patternsLoaded())continue;const G=oe.getBucket(n);if(!G)continue;const le=G.programConfigurations.get(n.id),se=l.context.program.get(),me=l.useProgram(V,le),ge=H||me.program!==se,we=l.style.terrain&&l.style.terrain.getTerrainData(Q),fe=v.constantOr(null);if(fe&&oe.imageAtlas){const Oe=oe.imageAtlas,at=Oe.patternPositions[fe.to.toString()],pt=Oe.patternPositions[fe.from.toString()];at&&pt&&le.setConstantPatternPositions(at,pt)}const Fe=we?Q:null,Me=E?Po(l,oe,n,z,Fe):y?Jn(l,oe,n,y,z,Fe):M?ps(l,oe,n,G.lineClipsArray.length,Fe):Cn(l,oe,n,Fe);if(E)U.activeTexture.set($.TEXTURE0),oe.imageAtlasTexture.bind($.LINEAR,$.CLAMP_TO_EDGE),le.updatePaintBuffers(z);else if(y&&(ge||l.lineAtlas.dirty))U.activeTexture.set($.TEXTURE0),l.lineAtlas.bind(U);else if(M){const Oe=G.gradients[n.id];let at=Oe.texture;if(n.gradientVersion!==Oe.version){let pt=256;if(n.stepInterpolant){const We=t.getSource().maxzoom,Pt=Q.canonical.z===We?Math.ceil(1<<l.transform.maxZoom-Q.canonical.z):1;pt=a.clamp(a.nextPowerOfTwo(G.maxLineLength/a.EXTENT*1024*Pt),256,U.maxTextureSize)}Oe.gradient=a.renderColorRamp({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:pt,image:Oe.gradient||void 0,clips:G.lineClipsArray}),Oe.texture?Oe.texture.update(Oe.gradient):Oe.texture=new Ce(U,Oe.gradient,$.RGBA),Oe.version=n.gradientVersion,at=Oe.texture}U.activeTexture.set($.TEXTURE0),at.bind(n.stepInterpolant?$.NEAREST:$.LINEAR,$.CLAMP_TO_EDGE)}me.draw(U,$.TRIANGLES,f,l.stencilModeForClipping(Q),_,Nt.disabled,Me,we,n.id,G.layoutVertexBuffer,G.indexBuffer,G.segments,n.paint,l.transform.zoom,le,G.layoutVertexBuffer2),H=!1}},fill:function(l,t,n,s){const u=n.paint.get("fill-color"),p=n.paint.get("fill-opacity");if(p.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&&p.constantOr(0)===1?"opaque":"translucent";if(l.renderPass===y){const v=l.depthModeForSublayer(1,l.renderPass==="opaque"?yt.ReadWrite:yt.ReadOnly);ro(l,t,n,s,v,f,!1)}if(l.renderPass==="translucent"&&n.paint.get("fill-antialias")){const v=l.depthModeForSublayer(n.getPaintProperty("fill-outline-color")?2:0,yt.ReadOnly);ro(l,t,n,s,v,f,!0)}},"fill-extrusion":function(l,t,n,s){const u=n.paint.get("fill-extrusion-opacity");if(u!==0&&l.renderPass==="translucent"){const p=new yt(l.context.gl.LEQUAL,yt.ReadWrite,l.depthRangeFor3D);if(u!==1||n.paint.get("fill-extrusion-pattern").constantOr(1))no(l,t,n,s,p,Ft.disabled,Ot.disabled),no(l,t,n,s,p,l.stencilModeFor3D(),l.colorModeForRenderPass());else{const f=l.colorModeForRenderPass();no(l,t,n,s,p,Ft.disabled,f)}}},hillshade:function(l,t,n,s){if(l.renderPass!=="offscreen"&&l.renderPass!=="translucent")return;const u=l.context,p=l.depthModeForSublayer(0,yt.ReadOnly),f=l.colorModeForRenderPass(),[_,y]=l.renderPass==="translucent"?l.stencilConfigForOverlap(s):[{},s];for(const v of y){const E=t.getTile(v);E.needsHillshadePrepare!==void 0&&E.needsHillshadePrepare&&l.renderPass==="offscreen"?Pa(l,E,n,p,Ft.disabled,f):l.renderPass==="translucent"&&Is(l,v,E,n,p,_[v.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,p=u.gl,f=t.getSource(),_=l.useProgram("raster"),y=l.colorModeForRenderPass(),[v,E]=f instanceof Ji?[{},s]:l.stencilConfigForOverlap(s),M=E[E.length-1].overscaledZ,z=!l.options.moving;for(const V of E){const U=l.depthModeForSublayer(V.overscaledZ-M,n.paint.get("raster-opacity")===1?yt.ReadWrite:yt.ReadOnly,p.LESS),$=t.getTile(V);$.registerFadeDuration(n.paint.get("raster-fade-duration"));const H=t.findLoadedParent(V,0),Q=Uo($,H,t,n,l.transform,l.style.terrain);let oe,G;const le=n.paint.get("raster-resampling")==="nearest"?p.NEAREST:p.LINEAR;u.activeTexture.set(p.TEXTURE0),$.texture.bind(le,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),u.activeTexture.set(p.TEXTURE1),H?(H.texture.bind(le,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),oe=Math.pow(2,H.tileID.overscaledZ-$.tileID.overscaledZ),G=[$.tileID.canonical.x*oe%1,$.tileID.canonical.y*oe%1]):$.texture.bind(le,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST);const se=l.style.terrain&&l.style.terrain.getTerrainData(V),me=se?V:null,ge=me?me.posMatrix:l.transform.calculatePosMatrix(V.toUnwrapped(),z),we=ya(ge,G||[0,0],oe||1,Q,n);f instanceof Ji?_.draw(u,p.TRIANGLES,U,Ft.disabled,y,Nt.disabled,we,se,n.id,f.boundsBuffer,l.quadTriangleIndexBuffer,f.boundsSegments):_.draw(u,p.TRIANGLES,U,v[V.overscaledZ],y,Nt.disabled,we,se,n.id,l.rasterBoundsBuffer,l.quadTriangleIndexBuffer,l.rasterBoundsSegments)}},background:function(l,t,n,s){const u=n.paint.get("background-color"),p=n.paint.get("background-opacity");if(p===0)return;const f=l.context,_=f.gl,y=l.transform,v=y.tileSize,E=n.paint.get("background-pattern");if(l.isPatternMissing(E))return;const M=!E&&u.a===1&&p===1&&l.opaquePassEnabledForLayer()?"opaque":"translucent";if(l.renderPass!==M)return;const z=Ft.disabled,V=l.depthModeForSublayer(0,M==="opaque"?yt.ReadWrite:yt.ReadOnly),U=l.colorModeForRenderPass(),$=l.useProgram(E?"backgroundPattern":"background"),H=s||y.coveringTiles({tileSize:v,terrain:l.style.terrain});E&&(f.activeTexture.set(_.TEXTURE0),l.imageManager.bind(l.context));const Q=n.getCrossfadeParameters();for(const oe of H){const G=s?oe.posMatrix:l.transform.calculatePosMatrix(oe.toUnwrapped()),le=E?zl(G,p,l,E,{tileID:oe,tileSize:v},Q):Pl(G,p,u),se=l.style.terrain&&l.style.terrain.getTerrainData(oe);$.draw(f,_.TRIANGLES,V,z,U,Nt.disabled,le,se,n.id,l.tileExtentBuffer,l.quadTriangleIndexBuffer,l.tileExtentSegments)}},debug:function(l,t,n){for(let s=0;s<n.length;s++)Nl(l,t,n[s])},custom:function(l,t,n){const s=l.context,u=n.implementation;if(l.renderPass==="offscreen"){const p=u.prerender;p&&(l.setCustomLayerDefaults(),s.setColorMode(l.colorModeForRenderPass()),p.call(u,s.gl,l.transform.customLayerMatrix()),s.setDirty(),l.setBaseState())}else if(l.renderPass==="translucent"){l.setCustomLayerDefaults(),s.setColorMode(l.colorModeForRenderPass()),s.setStencilMode(Ft.disabled);const p=u.renderingMode==="3d"?new yt(l.context.gl.LEQUAL,yt.ReadWrite,l.depthRangeFor3D):l.depthModeForSublayer(0,yt.ReadOnly);s.setDepthMode(p),u.render(s.gl,l.transform.customLayerMatrix()),s.setDirty(),l.setBaseState(),s.bindFramebuffer.set(null)}}};class As{constructor(t,n){this.context=new Aa(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:a.create(),renderTime:0},this.setup(),this.numSublayers=Ii.maxUnderzooming+Ii.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new et,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,Tt.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,Tt.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,yr.members),this.rasterBoundsSegments=a.SegmentVector.simpleSegment(0,0,4,2);const p=new a.PosArray;p.emplaceBack(0,0),p.emplaceBack(1,0),p.emplaceBack(0,1),p.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(p,Tt.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 Ce(t,{width:1,height:1,data:new Uint8Array([0,0,0,0])},t.gl.RGBA);const y=this.context.gl;this.stencilClearMode=new Ft({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,Nt.disabled,In(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 p=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);p.draw(s,u.TRIANGLES,yt.disabled,new Ft({func:u.ALWAYS,mask:0},_,255,u.KEEP,u.KEEP,u.REPLACE),Ot.disabled,Nt.disabled,In(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 Ft({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new Ft({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,p=s[0].overscaledZ-u+1;if(p>1){this.currentStencilSource=void 0,this.nextStencilID+p>256&&this.clearStencil();const f={};for(let _=0;_<p;_++)f[_+u]=new Ft({func:n.GEQUAL,mask:255},_+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=p,[f,s]}return[{[u]:Ft.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,p=this.style.terrain&&new La(this);for(const v in u){const E=u[v];E.used&&E.prepare(this.context)}const f={},_={},y={};for(const v in u){const E=u[v];f[v]=E.getVisibleCoordinates(),_[v]=f[v].slice().reverse(),y[v]=E.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let v=0;v<s.length;v++)if(this.style._layers[s[v]].is3D()){this.opaquePassCutoff=v;break}if(p){this.opaquePassCutoff=0;const v=this.style.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime);(this.terrainFacilitator.dirty||!a.equals(this.terrainFacilitator.matrix,this.transform.projMatrix)||v.length)&&(a.copy(this.terrainFacilitator.matrix,this.transform.projMatrix),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(E,M){const z=E.context,V=z.gl,U=Ot.unblended,$=new yt(V.LEQUAL,yt.ReadWrite,[0,1]),H=M.getTerrainMesh(),Q=M.sourceCache.getRenderableTiles(),oe=E.useProgram("terrainDepth");z.bindFramebuffer.set(M.getFramebuffer("depth").framebuffer),z.viewport.set([0,0,E.width/devicePixelRatio,E.height/devicePixelRatio]),z.clear({color:a.Color.transparent,depth:1});for(const G of Q){const le=M.getTerrainData(G.tileID),se=E.transform.calculatePosMatrix(G.tileID.toUnwrapped());oe.draw(z,V.TRIANGLES,$,Ft.disabled,U,Nt.backCCW,{u_matrix:se},le,"terrain",H.vertexBuffer,H.indexBuffer,H.segments)}z.bindFramebuffer.set(null),z.viewport.set([0,0,E.width,E.height])}(this,this.style.terrain),function(E,M){const z=E.context,V=z.gl,U=Ot.unblended,$=new yt(V.LEQUAL,yt.ReadWrite,[0,1]),H=M.getTerrainMesh(),Q=M.getCoordsTexture(),oe=M.sourceCache.getRenderableTiles(),G=E.useProgram("terrainCoords");z.bindFramebuffer.set(M.getFramebuffer("coords").framebuffer),z.viewport.set([0,0,E.width/devicePixelRatio,E.height/devicePixelRatio]),z.clear({color:a.Color.transparent,depth:1}),M.coordsIndex=[];for(const le of oe){const se=M.getTerrainData(le.tileID);z.activeTexture.set(V.TEXTURE0),V.bindTexture(V.TEXTURE_2D,Q.texture);const me=E.transform.calculatePosMatrix(le.tileID.toUnwrapped());G.draw(z,V.TRIANGLES,$,Ft.disabled,U,Nt.backCCW,{u_matrix:me,u_terrain_coords_id:(255-M.coordsIndex.length)/255,u_texture:0},se,"terrain",H.vertexBuffer,H.indexBuffer,H.segments),M.coordsIndex.push(le.tileID.key)}z.bindFramebuffer.set(null),z.viewport.set([0,0,E.width,E.height])}(this,this.style.terrain))}this.renderPass="offscreen";for(const v of s){const E=this.style._layers[v];if(!E.hasOffscreenPass()||E.isHidden(this.transform.zoom))continue;const M=_[E.source];(E.type==="custom"||M.length)&&this.renderLayer(this,u[E.source],E,M)}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],!p)for(this.renderPass="opaque",this.currentLayer=s.length-1;this.currentLayer>=0;this.currentLayer--){const v=this.style._layers[s[this.currentLayer]],E=u[v.source],M=f[v.source];this._renderTileClippingMasks(v,M),this.renderLayer(this,E,v,M)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<s.length;this.currentLayer++){const v=this.style._layers[s[this.currentLayer]],E=u[v.source];if(p&&p.renderLayer(v))continue;const M=(v.type==="symbol"?y:_)[v.source];this._renderTileClippingMasks(v,f[v.source]),this.renderLayer(this,E,v,M)}if(this.options.showTileBoundaries){let v,E;Object.values(this.style._layers).forEach(M=>{M.source&&!M.isHidden(this.transform.zoom)&&(M.source!==(E&&E.id)&&(E=this.style.sourceCaches[M.source]),(!v||v.getSource().maxzoom<E.getSource().maxzoom)&&(v=E))}),v&&so.debug(this,v,v.getVisibleCoordinates())}this.options.showPadding&&function(v){const E=v.transform.padding;rn(v,v.transform.height-(E.top||0),3,$o),rn(v,E.bottom||0,3,er),oo(v,E.left||0,3,za),oo(v,v.transform.width-(E.right||0),3,Cs);const M=v.transform.centerPoint;(function(z,V,U,$){kn(z,V-1,U-10,2,20,$),kn(z,V-10,U-1,20,2,$)})(v,M.x,v.transform.height-M.y,ka)}(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),so[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],p=this.context.extTimerQuery,f=p.getQueryObjectEXT(u.query,p.QUERY_RESULT_EXT)/1e6;p.deleteQueryEXT(u.query),n[s]=f}return n}translatePosMatrix(t,n,s,u,p){if(!s[0]&&!s[1])return t;const f=p?u==="map"?this.transform.angle:0:u==="viewport"?-this.transform.angle:0;if(f){const v=Math.sin(f),E=Math.cos(f);s=[s[0]*E-s[1]*v,s[0]*v+s[1]*E]}const _=[p?s[0]:Yt(n,s[0],this.transform.zoom),p?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 da(this.context,t,Hn[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 Ce(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}}class No{constructor(t,n){this.points=t,this.planes=n}static fromInvProjectionMatrix(t,n,s){const u=Math.pow(2,s),p=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(_=>{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([],p[_[0]],p[_[1]]),v=a.sub([],p[_[2]],p[_[1]]),E=a.normalize([],a.cross([],y,v)),M=-a.dot(E,p[_[1]]);return E.concat(M)});return new No(p,f)}}class ao{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 p=0;p<n.length;p++)s[p]=n[p]?this.min[p]:this.center[p],u[p]=n[p]?this.center[p]:this.max[p];return u[2]=this.max[2],new ao(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 p=t.planes[u];let f=0;for(let _=0;_<n.length;_++)a.dot$1(p,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 p=Number.MAX_VALUE,f=-Number.MAX_VALUE;for(let _=0;_<t.points.length;_++){const y=t.points[_][u]-this.min[u];p=Math.min(p,y),f=Math.max(f,y)}if(f<0||p>this.max[u]-this.min[u])return 0}return 1}}class Dn{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 Dn(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class lo{constructor(t,n,s,u,p){this.tileSize=512,this.maxValidLatitude=85.051129,this.freezeElevation=!1,this._renderWorldCopies=p===void 0||!!p,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 Dn,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){const t=new lo(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,p,f){var _=p[0],y=p[1],v=p[2],E=p[3],M=Math.sin(f),z=Math.cos(f);u[0]=_*z+v*M,u[1]=y*z+E*M,u[2]=_*-M+v*z,u[3]=y*-M+E*z}(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)),p=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,p.x,f.x)),y=Math.floor(Math.max(s.x,u.x,p.x,f.x)),v=1;for(let E=_-v;E<=y+v;E++)E!==0&&n.push(new a.UnwrappedTileID(E,t))}return n}coveringTiles(t){var n,s;let u=this.coveringZoomLevel(t);const p=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),v=[y*f.x,y*f.y,0],E=[y*_.x,y*_.y,0],M=No.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,u);let z=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(z=u);const V=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,U=G=>({aabb:new ao([G*y,0,0],[(G+1)*y,y,0]),zoom:0,x:0,y:0,wrap:G,fullyVisible:!1}),$=[],H=[],Q=u,oe=t.reparseOverscaled?p:u;if(this._renderWorldCopies)for(let G=1;G<=3;G++)$.push(U(-G)),$.push(U(G));for($.push(U(0));$.length>0;){const G=$.pop(),le=G.x,se=G.y;let me=G.fullyVisible;if(!me){const Oe=G.aabb.intersects(M);if(Oe===0)continue;me=Oe===2}const ge=t.terrain?v:E,we=G.aabb.distanceX(ge),fe=G.aabb.distanceY(ge),Fe=Math.max(Math.abs(we),Math.abs(fe)),Me=V+(1<<Q-G.zoom)-2;if(G.zoom===Q||Fe>Me&&G.zoom>=z){const Oe=Q-G.zoom,at=v[0]-.5-(le<<Oe),pt=v[1]-.5-(se<<Oe);H.push({tileID:new a.OverscaledTileID(G.zoom===Q?oe:G.zoom,G.wrap,G.zoom,le,se),distanceSq:a.sqrLen([E[0]-.5-le,E[1]-.5-se]),tileDistanceToCamera:Math.sqrt(at*at+pt*pt)})}else for(let Oe=0;Oe<4;Oe++){const at=(le<<1)+Oe%2,pt=(se<<1)+(Oe>>1),We=G.zoom+1;let Pt=G.aabb.quadrant(Oe);if(t.terrain){const zt=new a.OverscaledTileID(We,G.wrap,We,at,pt),xt=t.terrain.getMinMaxElevation(zt),St=(n=xt.minElevation)!==null&&n!==void 0?n:this.elevation,Dt=(s=xt.maxElevation)!==null&&s!==void 0?s:this.elevation;Pt=new ao([Pt.min[0],Pt.min[1],St],[Pt.max[0],Pt.max[1],Dt])}$.push({aabb:Pt,zoom:We,x:at,y:pt,wrap:G.wrap,fullyVisible:me})}}return H.sort((G,le)=>G.distanceSq-le.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,p=s.x*u,f=s.y*u,_=Math.floor(p/a.EXTENT),y=Math.floor(f/a.EXTENT),v=new a.OverscaledTileID(this.tileZoom,0,this.tileZoom,_,y);return n.getElevation(v,p%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(),p=a.MercatorCoordinate.fromLngLat(u.lngLat,u.altitude),f=a.MercatorCoordinate.fromLngLat(n,s),_=p.x-f.x,y=p.y-f.y,v=p.z-f.z,E=Math.sqrt(_*_+y*y+v*v),M=this.scaleZoom(this.cameraToCenterDistance/E/this.tileSize);this._elevation=s,this._center=n,this.zoom=M}setLocationAtPoint(t,n){const s=this.pointCoordinate(n),u=this.pointCoordinate(this.centerPoint),p=this.locationCoordinate(t),f=new a.MercatorCoordinate(p.x-(s.x-u.x),p.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 z=n.pointCoordinate(t);if(z!=null)return z}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 p=s[3],f=u[3],_=s[1]/p,y=u[1]/f,v=s[2]/p,E=u[2]/f,M=v===E?0:(0-v)/(E-v);return new a.MercatorCoordinate(a.number(s[0]/p,u[0]/f,M)/this.worldSize,a.number(_,y,M)/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 p=t.canonical,f=this.worldSize/this.zoomScale(p.z),_=p.x+Math.pow(2,p.z)*t.wrap,y=a.identity(new Float64Array(16));return a.translate(y,y,[_*f,p.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,p=-90,f=90,_=-180,y=180;const v=this.size,E=this._unmodified;if(this.latRange){const V=this.latRange;p=a.mercatorYfromLat(V[1])*this.worldSize,f=a.mercatorYfromLat(V[0])*this.worldSize,t=f-p<v.y?v.y/(f-p):0}if(this.lngRange){const V=this.lngRange;_=a.wrap(a.mercatorXfromLng(V[0])*this.worldSize,0,this.worldSize),y=a.wrap(a.mercatorXfromLng(V[1])*this.worldSize,0,this.worldSize),y<_&&(y+=this.worldSize),n=y-_<v.x?v.x/(y-_):0}const M=this.point,z=Math.max(n||0,t||0);if(z)return this.center=this.unproject(new a.pointGeometry(n?(y+_)/2:M.x,t?(f+p)/2:M.y)),this.zoom+=this.scaleZoom(z),this._unmodified=E,void(this._constraining=!1);if(this.latRange){const V=M.y,U=v.y/2;V-U<p&&(u=p+U),V+U>f&&(u=f-U)}if(this.lngRange){const V=(_+y)/2,U=a.wrap(M.x,V-this.worldSize/2,V+this.worldSize/2),$=v.x/2;U-$<_&&(s=_+$),U+$>y&&(s=y-$)}s===void 0&&u===void 0||(this.center=this.unproject(new a.pointGeometry(s!==void 0?s:M.x,u!==void 0?u:M.y)).wrap()),this._unmodified=E,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 p=Math.PI/2+this._pitch,f=this._fov*(.5+t.y/this.height),_=Math.sin(f)*this.cameraToSeaLevelDistance/Math.sin(a.clamp(Math.PI-p-f,.01,Math.PI-.01)),y=this.getHorizon(),v=2*Math.atan(y/this.cameraToCenterDistance)*(.5+t.y/(2*y)),E=Math.sin(v)*this.cameraToSeaLevelDistance/Math.sin(a.clamp(Math.PI-p-v,.01,Math.PI-.01)),M=Math.cos(Math.PI/2-this._pitch)*_+this.cameraToSeaLevelDistance,z=Math.cos(Math.PI/2-this._pitch)*E+this.cameraToSeaLevelDistance,V=1.01*Math.min(M,z),U=this.height/50;u=new Float64Array(16),a.perspective(u,this._fov,this.width/this.height,U,V),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 $=this.width%2/2,H=this.height%2/2,Q=Math.cos(this.angle),oe=Math.sin(this.angle),G=n-Math.round(n)+Q*$+oe*H,le=s-Math.round(s)+Q*H+oe*$,se=new Float64Array(u);if(a.translate(se,se,[G>.5?G-1:G,le>.5?le-1:le,0]),this.alignedProjMatrix=se,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,p=n.x,f=n.y;for(const _ of t)s=Math.min(s,_.x),u=Math.min(u,_.y),p=Math.max(p,_.x),f=Math.max(f,_.y);return[new a.pointGeometry(s,u),new a.pointGeometry(p,u),new a.pointGeometry(p,f),new a.pointGeometry(s,f),new a.pointGeometry(s,u)]}}}class Ra{constructor(t){this._hashName=t&&encodeURIComponent(t),a.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(n,s){let u=!1,p=null;const f=()=>{p=null,u&&(n(),p=setTimeout(f,300),u=!1)};return()=>(u=!0,p||f(),p)}(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),p=Math.pow(10,u),f=Math.round(n.lng*p)/p,_=Math.round(n.lat*p)/p,y=this._map.getBearing(),v=this._map.getPitch();let E="";if(E+=t?`/${f}/${_}/${s}`:`${s}/${_}/${f}`,(y||v)&&(E+="/"+Math.round(10*y)/10),v&&(E+=`/${Math.round(v)}`),this._hashName){const M=this._hashName;let z=!1;const V=window.location.hash.slice(1).split("&").map(U=>{const $=U.split("=")[0];return $===M?(z=!0,`${$}=${E}`):U}).filter(U=>U);return z||V.push(`${M}=${E}`),`#${V.join("&")}`}return`#${E}`}_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 co={linearity:.3,easing:a.bezier(0,0,.3,1)},Ba=a.extend({deceleration:2500,maxSpeed:1400},co),Fa=a.extend({deceleration:20,maxSpeed:1400},co),Oa=a.extend({deceleration:1e3,maxSpeed:360},co),Ln=a.extend({deceleration:1e3,maxSpeed:90},co);class Ua{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:p}of this._inertiaBuffer)n.zoom+=p.zoomDelta||0,n.bearing+=p.bearingDelta||0,n.pitch+=p.pitchDelta||0,p.panDelta&&n.pan._add(p.panDelta),p.around&&(n.around=p.around),p.pinchAround&&(n.pinchAround=p.pinchAround);const s=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,u={};if(n.pan.mag()){const p=ho(n.pan.mag(),s,a.extend({},Ba,t||{}));u.offset=n.pan.mult(p.amount/n.pan.mag()),u.center=this._map.transform.center,uo(u,p)}if(n.zoom){const p=ho(n.zoom,s,Fa);u.zoom=this._map.transform.zoom+p.amount,uo(u,p)}if(n.bearing){const p=ho(n.bearing,s,Oa);u.bearing=this._map.transform.bearing+a.clamp(p.amount,-179,179),uo(u,p)}if(n.pitch){const p=ho(n.pitch,s,Ln);u.pitch=this._map.transform.pitch+p.amount,uo(u,p)}if(u.zoom||u.bearing){const p=n.pinchAround===void 0?n.around:n.pinchAround;u.around=p?this._map.unproject(p):this._map.getCenter()}return this.clear(),a.extend(u,{noMoveStart:!0})}}function uo(l,t){(!l.duration||l.duration<t.duration)&&(l.duration=t.duration,l.easing=t.easing)}function ho(l,t,n){const{maxSpeed:s,linearity:u,deceleration:p}=n,f=a.clamp(l*u/(t/1e3),-s,s),_=Math.abs(f)/(p*u);return{easing:n.easing,duration:1e3*_,amount:f*(_/2)}}class Fi extends a.Event{constructor(t,n,s,u={}){const p=ee.mousePos(n.getCanvasContainer(),s),f=n.unproject(p);super(t,a.extend({point:p,lngLat:f,originalEvent:s},u)),this._defaultPrevented=!1,this.target=n}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class po extends a.Event{constructor(t,n,s){const u=t==="touchend"?s.changedTouches:s.touches,p=ee.touchPos(n.getCanvasContainer(),u),f=p.map(y=>n.unproject(y)),_=p.reduce((y,v,E,M)=>y.add(v.div(M.length)),new a.pointGeometry(0,0));super(t,{points:p,point:_,lngLats:f,lngLat:n.unproject(_),originalEvent:s}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class Oi extends a.Event{constructor(t,n,s){super(t,{originalEvent:s}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class Gl{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new Oi(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new Fi(t.type,this._map,t))}mouseup(t){this._map.fire(new Fi(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new Fi(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Fi(t.type,this._map,t))}mouseover(t){this._map.fire(new Fi(t.type,this._map,t))}mouseout(t){this._map.fire(new Fi(t.type,this._map,t))}touchstart(t){return this._firePreventable(new po(t.type,this._map,t))}touchmove(t){this._map.fire(new po(t.type,this._map,t))}touchend(t){this._map.fire(new po(t.type,this._map,t))}touchcancel(t){this._map.fire(new po(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class $r{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Fi(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Fi("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Fi(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class $a{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 p=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(${p}px,${_}px)`),this._box.style.width=f-p+"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:p=>p.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 Er(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 fo{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 p=new a.pointGeometry(0,0);for(const f of u)p._add(f);return p.div(u.length)}(n),this.touches=Er(s,n)))}touchmove(t,n,s){if(this.aborted||!this.centroid)return;const u=Er(s,n);for(const p in this.touches){const f=this.touches[p],_=u[p];(!_||_.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 fo(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 p=t.timeStamp-this.lastTime<500,f=!this.lastTap||this.lastTap.dist(u)<30;if(p&&f||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=u,this.count===this.numTaps)return this.reset(),u}}}class ql{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),p=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})}):p?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:f=>f.easeTo({duration:300,zoom:f.getZoom()-1,around:f.unproject(p)},{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 Zl={0:1,2:2};class Go{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,p){const f=Zl[p];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 mo extends Go{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 Sr extends Go{_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 $e extends Go{_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 Va{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=Er(s,n),p=new a.pointGeometry(0,0),f=new a.pointGeometry(0,0);let _=0;for(const v in u){const E=u[v],M=this._touches[v];M&&(p._add(E),f._add(E.sub(M)),_++,u[v]=E)}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:p.div(_),panDelta:y}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class nn{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,p]=this._firstTwoTouches,f=Vr(s,n,u),_=Vr(s,n,p);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,p]=this._firstTwoTouches,f=Vr(s,n,u),_=Vr(s,n,p);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 Vr(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 De extends nn{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 qo(l,t){return 180*l.angleWith(t)/Math.PI}class jl extends nn{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:qo(this._vector,s),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,s=qo(t,this._startVector);return Math.abs(s)<n}}function zs(l){return Math.abs(l.y)>Math.abs(l.x)}class ks extends nn{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]),p=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(u,p,s.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(u.y+p.y)/2*-.5}):void 0}gestureBeginsVertically(t,n,s){if(this._valid!==void 0)return this._valid;const u=t.mag()>=2,p=n.mag()>=2;if(!u&&!p)return;if(!u||!p)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 Na={panStep:100,bearingStep:15,pitchStep:10};class Ga{constructor(){const t=Na;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,p=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(),p=-1);break;case 39:t.shiftKey?s=1:(t.preventDefault(),p=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:Xl,zoom:n?Math.round(y)+n*(t.shiftKey?2:1):y,bearing:_.getBearing()+s*this._bearingStep,pitch:_.getPitch()+u*this._pitchStep,offset:[-p*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 Xl(l){return l*(2-l)}const qa=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%qa==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)>qa?this._wheelZoomRate:this._defaultZoomRate;let y=2/(1+Math.exp(-Math.abs(this._delta*_)));this._delta<0&&y!==0&&(y=1/y);const v=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(v*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 p,f=!1;if(this._type==="wheel"&&s&&u){const _=Math.min((a.exported.now()-this._lastWheelEventTime)/200,1),y=u(_);p=a.number(s,n,y),_<1?this._frameId||(this._frameId=!0):f=!0}else p=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:p-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,p=s.easing(u+.01)-s.easing(u),f=.27/Math.sqrt(p*p+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],p=u.y-this._swipePoint.y;return this._swipePoint=u,t.preventDefault(),this._active=!0,{zoomDelta:p/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 Ci{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 Nr{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 Za{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 Rn=l=>l.zoom||l.drag||l.pitch||l.rotate;class Fs extends a.Event{}function go(l){return l.panDelta&&l.panDelta.mag()||l.zoomDelta||l.bearingDelta||l.pitchDelta}class ja{constructor(t,n){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Ua(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,p,f]of this._listeners)ee.addEventListener(u,p,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 Gl(n,t));const u=n.boxZoom=new $a(n,t);this._add("boxZoom",u);const p=new ql,f=new Rs;n.doubleClickZoom=new Ls(f,p),this._add("tapZoom",p),this._add("clickZoom",f);const _=new Bs;this._add("tapDragZoom",_);const y=n.touchPitch=new ks(n);this._add("touchPitch",y);const v=new Sr(t),E=new $e(t);n.dragRotate=new Nr(t,v,E),this._add("mouseRotate",v,["mousePitch"]),this._add("mousePitch",E,["mouseRotate"]);const M=new mo(t),z=new Va(t,n);n.dragPan=new Ci(s,M,z),this._add("mousePan",M),this._add("touchPan",z,["touchZoom","touchRotate"]);const V=new jl,U=new De;n.touchZoomRotate=new Za(s,U,V,_),this._add("touchRotate",V,["touchPan","touchZoom"]),this._add("touchZoom",U,["touchPan","touchRotate"]);const $=n.scrollZoom=new Ds(n,this);this._add("scrollZoom",$,["mousePan"]);const H=n.keyboard=new Ga;this._add("keyboard",H),this._add("blockableMapEvent",new $r(n));for(const Q of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[Q]&&n[Q].enable(t[Q])}_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(Rn(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},p={},f={},_=t.touches,y=_?this._getMapTouches(_):void 0,v=y?ee.touchPos(this._el,y):ee.mousePos(this._el,t);for(const{handlerName:z,handler:V,allowed:U}of this._handlers){if(!V.isEnabled())continue;let $;this._blockedByActive(f,U,z)?V.reset():V[n||t.type]&&($=V[n||t.type](t,v,y),this.mergeHandlerResult(u,p,$,z,s),$&&$.needsRenderFrame&&this._triggerRenderFrame()),($||V.isActive())&&(f[z]=V)}const E={};for(const z in this._previousActiveHandlers)f[z]||(E[z]=s);this._previousActiveHandlers=f,(Object.keys(E).length||go(u))&&(this._changes.push([u,p,E]),this._triggerRenderFrame()),(Object.keys(f).length||go(u))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:M}=u;M&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],M(this._map))}mergeHandlerResult(t,n,s,u,p){if(!s)return;a.extend(t,s);const f={handlerName:u,originalEvent:s.originalEvent||p};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,p,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,p),a.extend(s,f);this._updateMapTransform(t,n,s),this._changes=[]}_updateMapTransform(t,n,s){const u=this._map,p=u.transform,f=u.style&&u.style.terrain;if(!(go(t)||f&&this._drag))return this._fireEvents(n,s,!0);let{panDelta:_,zoomDelta:y,bearingDelta:v,pitchDelta:E,around:M,pinchAround:z}=t;z!==void 0&&(M=z),u._stop(!0),M=M||u.transform.centerPoint;const V=p.pointLocation(_?M.sub(_):M);v&&(p.bearing+=v),E&&(p.pitch+=E),y&&(p.zoom+=y),f?n.drag&&!this._drag?(this._drag={center:p.centerPoint,lngLat:p.pointLocation(M),point:M,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&&(p.center=p.pointLocation(p.centerPoint.sub(_))):p.setLocationAtPoint(V,M),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,s,!0)}_fireEvents(t,n,s){const u=Rn(this._eventsInProgress),p=Rn(t),f={};for(const E in t){const{originalEvent:M}=t[E];this._eventsInProgress[E]||(f[`${E}start`]=M),this._eventsInProgress[E]=t[E]}!u&&p&&this._fireEvent("movestart",p.originalEvent);for(const E in f)this._fireEvent(E,f[E]);p&&this._fireEvent("move",p.originalEvent);for(const E in t){const{originalEvent:M}=t[E];this._fireEvent(E,M)}const _={};let y;for(const E in this._eventsInProgress){const{handlerName:M,originalEvent:z}=this._eventsInProgress[E];this._handlersById[M].isActive()||(delete this._eventsInProgress[E],y=n[M]||z,_[`${E}end`]=y)}for(const E in _)this._fireEvent(E,_[E]);const v=Rn(this._eventsInProgress);if(s&&(u||p)&&!v){this._updatingCamera=!0;const E=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),M=z=>z!==0&&-this._bearingSnap<z&&z<this._bearingSnap;E?(M(E.bearing||this._map.getBearing())&&(E.bearing=0),this._map.easeTo(E,{originalEvent:y})):(this._map.fire(new a.Event("moveend",{originalEvent:y})),M(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 Zi={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 Gt 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 p={top:0,bottom:0,right:0,left:0};if(typeof(u=a.extend({padding:p,offset:[0,0],maxZoom:this.transform.maxZoom},u)).padding=="number"){const se=u.padding;u.padding={top:se,bottom:se,right:se,left:se}}u.padding=a.extend(p,u.padding);const f=this.transform,_=f.padding,y=f.project(a.LngLat.convert(t)),v=f.project(a.LngLat.convert(n)),E=y.rotate(-s*Math.PI/180),M=v.rotate(-s*Math.PI/180),z=new a.pointGeometry(Math.max(E.x,M.x),Math.max(E.y,M.y)),V=new a.pointGeometry(Math.min(E.x,M.x),Math.min(E.y,M.y)),U=z.sub(V),$=(f.width-(_.left+_.right+u.padding.left+u.padding.right))/U.x,H=(f.height-(_.top+_.bottom+u.padding.top+u.padding.bottom))/U.y;if(H<0||$<0)return void a.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const Q=Math.min(f.scaleZoom(f.scale*Math.min($,H)),u.maxZoom),oe=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),le=oe.add(G).mult(f.scale/f.zoomScale(Q));return{center:f.unproject(y.add(v).div(2).sub(le)),zoom:Q,bearing:s}}fitBounds(t,n,s){return this._fitInternal(this.cameraForBounds(t,n),n,s)}fitScreenCoordinates(t,n,s,u,p){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(a.pointGeometry.convert(t)),this.transform.pointLocation(a.pointGeometry.convert(n)),s,u),u,p)}_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,p=!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&&(p=!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)),p&&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 p=a.MercatorCoordinate.fromLngLat(t,n),f=a.MercatorCoordinate.fromLngLat(s,u),_=f.x-p.x,y=f.y-p.y,v=f.z-p.z,E=Math.hypot(_,y,v);if(E===0)throw new Error("Can't calculate camera options with same From and To");const M=Math.hypot(_,y),z=this.transform.scaleZoom(this.transform.cameraToCenterDistance/E/this.transform.tileSize),V=180*Math.atan2(_,-y)/Math.PI;let U=180*Math.acos(M/E)/Math.PI;return U=v<0?90-U:90+U,{center:f.toLngLat(),zoom:z,pitch:U,bearing:V}}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(),p=this.getBearing(),f=this.getPitch(),_=this.getPadding(),y="zoom"in t?+t.zoom:u,v="bearing"in t?this._normalizeBearing(t.bearing,p):p,E="pitch"in t?+t.pitch:f,M="padding"in t?t.padding:s.padding,z=a.pointGeometry.convert(t.offset);let V=s.centerPoint.add(z);const U=s.pointLocation(V),$=a.LngLat.convert(t.center||U);this._normalizeCenter($);const H=s.project(U),Q=s.project($).sub(H),oe=s.zoomScale(y-u);let G,le;t.around&&(G=a.LngLat.convert(t.around),le=s.locationPoint(G));const se={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||y!==u,this._rotating=this._rotating||p!==v,this._pitching=this._pitching||E!==f,this._padding=!s.isPaddingEqual(M),this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,se),this._ease(me=>{if(this._zooming&&(s.zoom=a.number(u,y,me)),this._rotating&&(s.bearing=a.number(p,v,me)),this._pitching&&(s.pitch=a.number(f,E,me)),this._padding&&(s.interpolatePadding(_,M,me),V=s.centerPoint.add(z)),G)s.setLocationAtPoint(G,le);else{const ge=s.zoomScale(s.zoom-u),we=y>u?Math.min(2,oe):Math.max(.5,oe),fe=Math.pow(we,1-me),Fe=s.unproject(H.add(Q.mult(me*fe)).mult(ge));s.setLocationAtPoint(s.renderWorldCopies?Fe.wrap():Fe,V)}this._fireMoveEvents(n)},me=>{this._afterEase(n,me)},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,p=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)),p&&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(),p=this.getBearing(),f=this.getPitch(),_=this.getPadding(),y="zoom"in t?a.clamp(+t.zoom,s.minZoom,s.maxZoom):u,v="bearing"in t?this._normalizeBearing(t.bearing,p):p,E="pitch"in t?+t.pitch:f,M="padding"in t?t.padding:s.padding,z=s.zoomScale(y-u),V=a.pointGeometry.convert(t.offset);let U=s.centerPoint.add(V);const $=s.pointLocation(U),H=a.LngLat.convert(t.center||$);this._normalizeCenter(H);const Q=s.project($),oe=s.project(H).sub(Q);let G=t.curve;const le=Math.max(s.width,s.height),se=le/z,me=oe.mag();if("minZoom"in t){const We=a.clamp(Math.min(t.minZoom,u,y),s.minZoom,s.maxZoom),Pt=le/s.zoomScale(We-u);G=Math.sqrt(Pt/me*2)}const ge=G*G;function we(We){const Pt=(se*se-le*le+(We?-1:1)*ge*ge*me*me)/(2*(We?se:le)*ge*me);return Math.log(Math.sqrt(Pt*Pt+1)-Pt)}function fe(We){return(Math.exp(We)-Math.exp(-We))/2}function Fe(We){return(Math.exp(We)+Math.exp(-We))/2}const Me=we(0);let Oe=function(We){return Fe(Me)/Fe(Me+G*We)},at=function(We){return le*((Fe(Me)*(fe(Pt=Me+G*We)/Fe(Pt))-fe(Me))/ge)/me;var Pt},pt=(we(1)-Me)/G;if(Math.abs(me)<1e-6||!isFinite(pt)){if(Math.abs(le-se)<1e-6)return this.easeTo(t,n);const We=se<le?-1:1;pt=Math.abs(Math.log(se/le))/G,at=function(){return 0},Oe=function(Pt){return Math.exp(We*G*Pt)}}return t.duration="duration"in t?+t.duration:1e3*pt/("screenSpeed"in t?+t.screenSpeed/G:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=p!==v,this._pitching=E!==f,this._padding=!s.isPaddingEqual(M),this._prepareEase(n,!1),this._ease(We=>{const Pt=We*pt,zt=1/Oe(Pt);s.zoom=We===1?y:u+s.scaleZoom(zt),this._rotating&&(s.bearing=a.number(p,v,We)),this._pitching&&(s.pitch=a.number(f,E,We)),this._padding&&(s.interpolatePadding(_,M,We),U=s.centerPoint.add(V));const xt=We===1?H:s.unproject(Q.add(oe.mult(at(Pt))).mult(zt));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 _o{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 p=n[u];if(p.used||p.usedForTerrain){const f=p.getSource();f.attribution&&t.indexOf(f.attribution)<0&&t.push(f.attribution)}}t=t.filter(u=>String(u).trim()),t.sort((u,p)=>u.length-p.length),t=t.filter((u,p)=>{for(let f=p+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 Zo{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 Xa{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 Wa={"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"},Ha={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},Wl={showCompass:!0,showZoom:!0,visualizePitch:!1};class ur{constructor(t,n,s=!1){this._clickTolerance=10,this.element=n,this.mouseRotate=new Sr({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,s&&(this.mousePitch=new $e({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 p=this.mousePitch.mousemoveWindow(t,n);p&&p.pitchDelta&&s.setPitch(s.getPitch()+p.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 yo(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),p=n.locationPoint(l).distSqr(t);n.locationPoint(s).distSqr(t)<p?l=s:n.locationPoint(u).distSqr(t)<p&&(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 Ze={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 Ye(l,t,n){const s=l.classList;for(const u in Ze)s.remove(`maplibregl-${n}-anchor-${u}`,`mapboxgl-${n}-anchor-${u}`);s.add(`maplibregl-${n}-anchor-${t}`,`mapboxgl-${n}-anchor-${t}`)}class Bn 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,p=27;s.setAttributeNS(null,"display","block"),s.setAttributeNS(null,"height",`${u}px`),s.setAttributeNS(null,"width",`${p}px`),s.setAttributeNS(null,"viewBox",`0 0 ${p} ${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 v=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const oe of v){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",oe.rx),G.setAttributeNS(null,"ry",oe.ry),y.appendChild(G)}const E=ee.createNS("http://www.w3.org/2000/svg","g");E.setAttributeNS(null,"fill",this._color);const M=ee.createNS("http://www.w3.org/2000/svg","path");M.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"),E.appendChild(M);const z=ee.createNS("http://www.w3.org/2000/svg","g");z.setAttributeNS(null,"opacity","0.25"),z.setAttributeNS(null,"fill","#000000");const V=ee.createNS("http://www.w3.org/2000/svg","path");V.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"),z.appendChild(V);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 $=ee.createNS("http://www.w3.org/2000/svg","g");$.setAttributeNS(null,"transform","translate(8.0, 8.0)");const H=ee.createNS("http://www.w3.org/2000/svg","circle");H.setAttributeNS(null,"fill","#000000"),H.setAttributeNS(null,"opacity","0.25"),H.setAttributeNS(null,"cx","5.5"),H.setAttributeNS(null,"cy","5.5"),H.setAttributeNS(null,"r","5.4999962");const Q=ee.createNS("http://www.w3.org/2000/svg","circle");Q.setAttributeNS(null,"fill","#FFFFFF"),Q.setAttributeNS(null,"cx","5.5"),Q.setAttributeNS(null,"cy","5.5"),Q.setAttributeNS(null,"r","5.4999962"),$.appendChild(H),$.appendChild(Q),_.appendChild(y),_.appendChild(E),_.appendChild(z),_.appendChild(U),_.appendChild($),s.appendChild(_),s.setAttributeNS(null,"height",u*this._scale+"px"),s.setAttributeNS(null,"width",p*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()}),Ye(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=yo(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,`${Ze[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),p=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*p?"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 Gr,mi=0,qr=!1;const hr={maxWidth:100,unit:"metric"};function Ka(l,t,n){const s=n&&n.maxWidth||100,u=l._container.clientHeight/2,p=l.unproject([0,u]),f=l.unproject([s,u]),_=p.distanceTo(f);if(n&&n.unit==="imperial"){const y=3.2808*_;y>5280?Zr(t,s,y/5280,l._getUIString("ScaleControl.Miles")):Zr(t,s,y,l._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?Zr(t,s,_/1852,l._getUIString("ScaleControl.NauticalMiles")):_>=1e3?Zr(t,s,_/1e3,l._getUIString("ScaleControl.Kilometers")):Zr(t,s,_,l._getUIString("ScaleControl.Meters"))}function Zr(l,t,n,s){const u=function(p){const f=Math.pow(10,`${Math.floor(p)}`.length-1);let _=p/f;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:function(y){const v=Math.pow(10,Math.ceil(-Math.log(y)/Math.LN10));return Math.round(y*v)/v}(_),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 Us(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 Us(new a.pointGeometry(0,0))}const on={supported:Y,setRTLTextPlugin:a.setRTLTextPlugin,getRTLTextPluginStatus:a.getRTLTextPluginStatus,Map:class extends Gt{constructor(l){var t;if(a.PerformanceUtils.mark(a.PerformanceMarkers.create),(l=a.extend({},Ha,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 lo(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 Xa,this._controls=[],this._mapId=a.uniqueId(),this._locale=a.extend({},Wa,l.locale),this._clickTolerance=l.clickTolerance,this._pixelRatio=(t=l.pixelRatio)!==null&&t!==void 0?t:devicePixelRatio,this._requestManager=new Se(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 ja(this,l),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=l.hash&&new Ra(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 _o({customAttribution:l.customAttribution})),l.maplibreLogo&&this.addControl(new Zo,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:p=>{const f=this.getLayer(t)?this.queryRenderedFeatures(p.point,{layers:[t]}):[];f.length?s||(s=!0,n.call(this,new Fi(l,this,p.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 Fi(l,this,f.originalEvent)))},mouseout:f=>{s&&(s=!1,n.call(this,new Fi(l,this,f.originalEvent)))}}}}{const s=u=>{const p=this.getLayer(t)?this.queryRenderedFeatures(u.point,{layers:[t]}):[];p.length&&(u.features=p,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 p=0;p<u.length;p++){const f=u[p];if(f.layer===t&&f.listener===n){for(const _ in f.delegates)this.off(_,f.delegates[_]);return u.splice(p,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:p,content:f}={}){if(this._lazyInitEmptyStyle(),t instanceof HTMLImageElement||a.isImageBitmap(t)){const{width:_,height:y,data:v}=a.exported.getImageData(t);this.style.addImage(l,{data:new a.RGBAImage({width:_,height:y},v),pixelRatio:n,stretchX:u,stretchY:p,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:v}=t,E=t;this.style.addImage(l,{data:new a.RGBAImage({width:_,height:y},new Uint8Array(v)),pixelRatio:n,stretchX:u,stretchY:p,content:f,sdf:s,version:0,userImage:E}),E.onAdd&&E.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:p,data:f}=s;if(u===void 0||p===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||p!==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(p=>{u[p]=ee.create("div",`maplibregl-ctrl-${p} mapboxgl-ctrl-${p}`,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=`
|
|
577
|
-
<div class="maplibregl-desktop-message">${n}</div>
|
|
578
|
-
<div class="maplibregl-mobile-message">${typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map"}</div>
|
|
579
|
-
`,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({},Y.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()}),v=y.crossFadingFactor();v===1&&v===this._crossFadingFactor||(u=!0,this._crossFadingFactor=v),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 p=this._sourcesDirty||this._styleDirty||this._placementDirty;return p||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new a.Event("idle")),!this._loaded||this._fullyLoaded||p||(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({},Wl,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 ur(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,Gr!==void 0?t(Gr):window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(n=>{Gr=n.state!=="denied",t(Gr)}):(Gr=!!window.navigator.geolocation,t(Gr)),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 Bn(this._dotElement),this._circleElement=ee.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Bn({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:_o,LogoControl:Zo,ScaleControl:class{constructor(l){this.options=a.extend({},hr,l),a.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){Ka(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,Ka(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(p=>this._container.classList.add(p)),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=yo(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=Us(this.options.offset);if(!n){const p=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<p/2?_.push("left"):t.x>this._map.transform.width-p/2&&_.push("right"),n=_.length===0?"bottom":_.join("-")}const u=t.add(s[n]).round();ee.setTransform(this._container,`${Ze[n]} translate(${u.x}px,${u.y}px)`),Ye(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:Bn,Style:_i,LngLat:a.LngLat,LngLatBounds:a.LngLatBounds,Point:a.pointGeometry,MercatorCoordinate:a.MercatorCoordinate,Evented:a.Evented,AJAXError:a.AJAXError,config:a.config,CanvasSource:Hr,GeoJSONSource:_r,ImageSource:Ji,RasterDEMTileSource:tt,RasterTileSource:Ki,VectorTileSource:Hi,VideoSource:Yi,prewarm:function(){xn().acquire(xr)},clearPrewarmedResources:function(){const l=Rr;l&&(l.isPreloaded()&&l.numActive()===1?(l.release(xr),Rr=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 Di.workerCount},set workerCount(l){Di.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 Zi.extend(on,{isSafari:a.isSafari,getPerformanceMetrics:a.PerformanceUtils.getPerformanceMetrics}),on});var ne=B;return ne})})(lp);var xm=lp.exports;function up(b,I,C){C===void 0&&(C={});var k={type:"Feature"};return(C.id===0||C.id)&&(k.id=C.id),C.bbox&&(k.bbox=C.bbox),k.properties=I||{},k.geometry=b,k}function Dh(b,I,C){if(C===void 0&&(C={}),!b)throw new Error("coordinates is required");if(!Array.isArray(b))throw new Error("coordinates must be an Array");if(b.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Lh(b[0])||!Lh(b[1]))throw new Error("coordinates must contain numbers");var k={type:"Point",coordinates:b};return up(k,I,C)}function vm(b,I,C){C===void 0&&(C={});var k={type:"MultiPoint",coordinates:b};return up(k,I,C)}function Lh(b){return!isNaN(b)&&b!==null&&!Array.isArray(b)}function hp(b,I,C){if(b!==null)for(var k,B,N,ne,a,Y,ie,he=0,ue=0,ee,Se=b.type,Ie=Se==="FeatureCollection",Ce=Se==="Feature",Ke=Ie?b.features.length:1,Xe=0;Xe<Ke;Xe++){ie=Ie?b.features[Xe].geometry:Ce?b.geometry:b,ee=ie?ie.type==="GeometryCollection":!1,a=ee?ie.geometries.length:1;for(var Qe=0;Qe<a;Qe++){var lt=0,vt=0;if(ne=ee?ie.geometries[Qe]:ie,ne!==null){Y=ne.coordinates;var ot=ne.type;switch(he=C&&(ot==="Polygon"||ot==="MultiPolygon")?1:0,ot){case null:break;case"Point":if(I(Y,ue,Xe,lt,vt)===!1)return!1;ue++,lt++;break;case"LineString":case"MultiPoint":for(k=0;k<Y.length;k++){if(I(Y[k],ue,Xe,lt,vt)===!1)return!1;ue++,ot==="MultiPoint"&<++}ot==="LineString"&<++;break;case"Polygon":case"MultiLineString":for(k=0;k<Y.length;k++){for(B=0;B<Y[k].length-he;B++){if(I(Y[k][B],ue,Xe,lt,vt)===!1)return!1;ue++}ot==="MultiLineString"&<++,ot==="Polygon"&&vt++}ot==="Polygon"&<++;break;case"MultiPolygon":for(k=0;k<Y.length;k++){for(vt=0,B=0;B<Y[k].length;B++){for(N=0;N<Y[k][B].length-he;N++){if(I(Y[k][B][N],ue,Xe,lt,vt)===!1)return!1;ue++}vt++}lt++}break;case"GeometryCollection":for(k=0;k<ne.geometries.length;k++)if(hp(ne.geometries[k],I,C)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function $c(b){var I=[1/0,1/0,-1/0,-1/0];return hp(b,function(C){I[0]>C[0]&&(I[0]=C[0]),I[1]>C[1]&&(I[1]=C[1]),I[2]<C[0]&&(I[2]=C[0]),I[3]<C[1]&&(I[3]=C[1])}),I}$c.default=$c;const bm={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0},wm=()=>{const[b,I]=ve.exports.useState(null),[C,k]=ve.exports.useState(bm),B=ve.exports.useMemo(()=>new window.ResizeObserver(N=>{if(N[0]){const{x:ne,y:a,width:Y,height:ie,top:he,left:ue,bottom:ee,right:Se}=N[0].contentRect;k({x:ne,y:a,width:Y,height:ie,top:he,left:ue,bottom:ee,right:Se})}}),[]);return ve.exports.useLayoutEffect(()=>{if(!!b)return B.observe(b),()=>{B.disconnect()}},[b]),[I,C,b]};var Tm="Expected a function",Rh=0/0,Em="[object Symbol]",Sm=/^\s+|\s+$/g,Im=/^[-+]0x[0-9a-f]+$/i,Cm=/^0b[01]+$/i,Am=/^0o[0-7]+$/i,Mm=parseInt,Pm=typeof aa=="object"&&aa&&aa.Object===Object&&aa,zm=typeof self=="object"&&self&&self.Object===Object&&self,km=Pm||zm||Function("return this")(),Dm=Object.prototype,Lm=Dm.toString,Rm=Math.max,Bm=Math.min,Bc=function(){return km.Date.now()};function Fm(b,I,C){var k,B,N,ne,a,Y,ie=0,he=!1,ue=!1,ee=!0;if(typeof b!="function")throw new TypeError(Tm);I=Bh(I)||0,Vc(C)&&(he=!!C.leading,ue="maxWait"in C,N=ue?Rm(Bh(C.maxWait)||0,I):N,ee="trailing"in C?!!C.trailing:ee);function Se(gt){var ft=k,ct=B;return k=B=void 0,ie=gt,ne=b.apply(ct,ft),ne}function Ie(gt){return ie=gt,a=setTimeout(Xe,I),he?Se(gt):ne}function Ce(gt){var ft=gt-Y,ct=gt-ie,Xt=I-ft;return ue?Bm(Xt,N-ct):Xt}function Ke(gt){var ft=gt-Y,ct=gt-ie;return Y===void 0||ft>=I||ft<0||ue&&ct>=N}function Xe(){var gt=Bc();if(Ke(gt))return Qe(gt);a=setTimeout(Xe,Ce(gt))}function Qe(gt){return a=void 0,ee&&k?Se(gt):(k=B=void 0,ne)}function lt(){a!==void 0&&clearTimeout(a),ie=0,k=Y=B=a=void 0}function vt(){return a===void 0?ne:Qe(Bc())}function ot(){var gt=Bc(),ft=Ke(gt);if(k=arguments,B=this,Y=gt,ft){if(a===void 0)return Ie(Y);if(ue)return a=setTimeout(Xe,I),Se(Y)}return a===void 0&&(a=setTimeout(Xe,I)),ne}return ot.cancel=lt,ot.flush=vt,ot}function Vc(b){var I=typeof b;return!!b&&(I=="object"||I=="function")}function Om(b){return!!b&&typeof b=="object"}function Um(b){return typeof b=="symbol"||Om(b)&&Lm.call(b)==Em}function Bh(b){if(typeof b=="number")return b;if(Um(b))return Rh;if(Vc(b)){var I=typeof b.valueOf=="function"?b.valueOf():b;b=Vc(I)?I+"":I}if(typeof b!="string")return b===0?b:+b;b=b.replace(Sm,"");var C=Cm.test(b);return C||Am.test(b)?Mm(b.slice(2),C?2:8):Im.test(b)?Rh:+b}var $m=Fm;const pp=()=>{const[b,I]=ve.exports.useState(!1);return ve.exports.useLayoutEffect(()=>{const C=()=>{I(window.innerWidth<Ff.screenSizes.mobileL)};return window.addEventListener("resize",$m(C,250)),C(),()=>window.removeEventListener("resize",C)},[]),b},Fh=pi.div`
|
|
580
|
-
overflow-y: auto;
|
|
581
|
-
`,Vm=pi.div`
|
|
582
|
-
position: absolute;
|
|
583
|
-
top: ${It["--ll-spacing-medium"]};
|
|
584
|
-
left: ${It["--ll-spacing-medium"]};
|
|
585
|
-
width: 360px;
|
|
586
|
-
max-height: calc(100% - 2 * ${It["--ll-spacing-medium"]});
|
|
587
|
-
z-index: 1;
|
|
588
|
-
border-radius: ${It["--ll-border-radius-medium"]};
|
|
589
|
-
box-shadow: rgba(0, 0, 0, 0.15) 0px 3px 8px;
|
|
590
|
-
background-color: #fff;
|
|
591
|
-
overflow: hidden;
|
|
592
|
-
display: flex;
|
|
593
|
-
flex-direction: column;
|
|
594
|
-
background-color: ${It["--ll-color-background"]};
|
|
595
|
-
border: 1px solid ${It["--ll-color-border"]};
|
|
596
|
-
`,Nm=pi.div`
|
|
597
|
-
display: flex;
|
|
598
|
-
justify-content: center;
|
|
599
|
-
padding: ${It["--ll-spacing-small"]};
|
|
600
|
-
`,Gm=pi.div`
|
|
601
|
-
padding: ${It["--ll-spacing-x-small"]};
|
|
602
|
-
border-bottom: 1px solid ${It["--ll-color-border"]};
|
|
603
|
-
`,qm=pi(Jh.div)`
|
|
604
|
-
position: absolute;
|
|
605
|
-
bottom: 0;
|
|
606
|
-
left: 0;
|
|
607
|
-
right: 0;
|
|
608
|
-
max-height: calc(100% - 100px);
|
|
609
|
-
overflow: ${({isOpen:b})=>b?"auto":"hidden"};
|
|
610
|
-
border-radius: ${It["--ll-border-radius-medium"]}
|
|
611
|
-
${It["--ll-border-radius-medium"]} 0 0;
|
|
612
|
-
box-shadow: rgb(0 0 0 / 15%) 0px -3px 8px;
|
|
613
|
-
background-color: #fff;
|
|
614
|
-
z-index: 2;
|
|
615
|
-
overflow: hidden;
|
|
616
|
-
display: flex;
|
|
617
|
-
flex-direction: column;
|
|
618
|
-
background-color: ${It["--ll-color-background"]};
|
|
619
|
-
border: 1px solid ${It["--ll-color-border"]};
|
|
620
|
-
`,Zm=pi.div`
|
|
621
|
-
display: flex;
|
|
622
|
-
justify-content: center;
|
|
623
|
-
padding: ${It["--ll-spacing-small"]};
|
|
624
|
-
`,jm=pi.div`
|
|
625
|
-
position: absolute;
|
|
626
|
-
top: ${It["--ll-spacing-x-small"]};
|
|
627
|
-
left: ${It["--ll-spacing-x-small"]};
|
|
628
|
-
right: ${It["--ll-spacing-x-small"]};
|
|
629
|
-
padding: ${It["--ll-spacing-x-small"]};
|
|
630
|
-
background-color: ${It["--ll-color-background"]};
|
|
631
|
-
border-radius: ${It["--ll-border-radius-medium"]};
|
|
632
|
-
box-shadow: rgba(0, 0, 0, 0.15) 0px 3px 8px;
|
|
633
|
-
z-index: 1;
|
|
634
|
-
`,Xm=pi.div`
|
|
635
|
-
height: 30px;
|
|
636
|
-
width: 100%;
|
|
637
|
-
position: relative;
|
|
638
|
-
|
|
639
|
-
&:after {
|
|
640
|
-
content: "";
|
|
641
|
-
position: absolute;
|
|
642
|
-
left: 50%;
|
|
643
|
-
top: 50%;
|
|
644
|
-
transform: translate(-50%, -50%);
|
|
645
|
-
height: 4px;
|
|
646
|
-
width: 40px;
|
|
647
|
-
background-color: ${It["--ll-color-surface"]};
|
|
648
|
-
}
|
|
649
|
-
`,Wm=pi(Jh.div)`
|
|
650
|
-
display: flex;
|
|
651
|
-
justify-content: center;
|
|
652
|
-
`;function Hm(b){const I=b+"CollectionProvider",[C,k]=Zc(I),[B,N]=C(I,{collectionRef:{current:null},itemMap:new Map}),ne=Se=>{const{scope:Ie,children:Ce}=Se,Ke=nt.useRef(null),Xe=nt.useRef(new Map).current;return nt.createElement(B,{scope:Ie,itemMap:Xe,collectionRef:Ke},Ce)},a=b+"CollectionSlot",Y=nt.forwardRef((Se,Ie)=>{const{scope:Ce,children:Ke}=Se,Xe=N(a,Ce),Qe=Tl(Ie,Xe.collectionRef);return nt.createElement(Sh,{ref:Qe},Ke)}),ie=b+"CollectionItemSlot",he="data-radix-collection-item",ue=nt.forwardRef((Se,Ie)=>{const{scope:Ce,children:Ke,...Xe}=Se,Qe=nt.useRef(null),lt=Tl(Ie,Qe),vt=N(ie,Ce);return nt.useEffect(()=>(vt.itemMap.set(Qe,{ref:Qe,...Xe}),()=>void vt.itemMap.delete(Qe))),nt.createElement(Sh,{[he]:"",ref:lt},Ke)});function ee(Se){const Ie=N(b+"CollectionConsumer",Se);return nt.useCallback(()=>{const Ke=Ie.collectionRef.current;if(!Ke)return[];const Xe=Array.from(Ke.querySelectorAll(`[${he}]`));return Array.from(Ie.itemMap.values()).sort((vt,ot)=>Xe.indexOf(vt.ref.current)-Xe.indexOf(ot.ref.current))},[Ie.collectionRef,Ie.itemMap])}return[{Provider:ne,Slot:Y,ItemSlot:ue},ee,k]}const dp="Collapsible",[Km,fp]=Zc(dp),[Jm,Jc]=Km(dp),Ym=ve.exports.forwardRef((b,I)=>{const{__scopeCollapsible:C,open:k,defaultOpen:B,disabled:N,onOpenChange:ne,...a}=b,[Y=!1,ie]=Hc({prop:k,defaultProp:B,onChange:ne});return ve.exports.createElement(Jm,{scope:C,disabled:N,contentId:ip(),open:Y,onOpenToggle:ve.exports.useCallback(()=>ie(he=>!he),[ie])},ve.exports.createElement(ca.div,sr({"data-state":Yc(Y),"data-disabled":N?"":void 0},a,{ref:I})))}),Qm="CollapsibleTrigger",eg=ve.exports.forwardRef((b,I)=>{const{__scopeCollapsible:C,...k}=b,B=Jc(Qm,C);return ve.exports.createElement(ca.button,sr({type:"button","aria-controls":B.contentId,"aria-expanded":B.open||!1,"data-state":Yc(B.open),"data-disabled":B.disabled?"":void 0,disabled:B.disabled},k,{ref:I,onClick:Yh(b.onClick,B.onOpenToggle)}))}),mp="CollapsibleContent",tg=ve.exports.forwardRef((b,I)=>{const{forceMount:C,...k}=b,B=Jc(mp,b.__scopeCollapsible);return ve.exports.createElement(Of,{present:C||B.open},({present:N})=>ve.exports.createElement(ig,sr({},k,{ref:I,present:N})))}),ig=ve.exports.forwardRef((b,I)=>{const{__scopeCollapsible:C,present:k,children:B,...N}=b,ne=Jc(mp,C),[a,Y]=ve.exports.useState(k),ie=ve.exports.useRef(null),he=Tl(I,ie),ue=ve.exports.useRef(0),ee=ue.current,Se=ve.exports.useRef(0),Ie=Se.current,Ce=ne.open||a,Ke=ve.exports.useRef(Ce),Xe=ve.exports.useRef();return ve.exports.useEffect(()=>{const Qe=requestAnimationFrame(()=>Ke.current=!1);return()=>cancelAnimationFrame(Qe)},[]),Xh(()=>{const Qe=ie.current;if(Qe){Xe.current=Xe.current||{transitionDuration:Qe.style.transitionDuration,animationDuration:Qe.style.animationDuration,animationFillMode:Qe.style.animationFillMode},Qe.style.transitionDuration="0s",Qe.style.animationDuration="0s",Qe.style.animationFillMode="none";const lt=Qe.getBoundingClientRect();ue.current=lt.height,Se.current=lt.width,Ke.current||(Qe.style.transitionDuration=Xe.current.transitionDuration,Qe.style.animationDuration=Xe.current.animationDuration,Qe.style.animationFillMode=Xe.current.animationFillMode),Y(k)}},[ne.open,k]),ve.exports.createElement(ca.div,sr({"data-state":Yc(ne.open),"data-disabled":ne.disabled?"":void 0,id:ne.contentId,hidden:!Ce},N,{ref:he,style:{["--radix-collapsible-content-height"]:ee?`${ee}px`:void 0,["--radix-collapsible-content-width"]:Ie?`${Ie}px`:void 0,...b.style}}),Ce&&B)});function Yc(b){return b?"open":"closed"}const rg=Ym,ng=eg,og=tg,pa="Accordion",sg=["Home","End","ArrowDown","ArrowUp"],[Qc,ag,lg]=Hm(pa),[Al,a_]=Zc(pa,[lg,fp]),eu=fp(),gp=nt.forwardRef((b,I)=>{const{type:C,...k}=b,B=k,N=k;return nt.createElement(Qc.Provider,{scope:b.__scopeAccordion},C==="multiple"?nt.createElement(pg,sr({},N,{ref:I})):nt.createElement(hg,sr({},B,{ref:I})))});gp.propTypes={type(b){const I=b.value||b.defaultValue;return b.type&&!["single","multiple"].includes(b.type)?new Error("Invalid prop `type` supplied to `Accordion`. Expected one of `single | multiple`."):b.type==="multiple"&&typeof I=="string"?new Error("Invalid prop `type` supplied to `Accordion`. Expected `single` when `defaultValue` or `value` is type `string`."):b.type==="single"&&Array.isArray(I)?new Error("Invalid prop `type` supplied to `Accordion`. Expected `multiple` when `defaultValue` or `value` is type `string[]`."):null}};const[_p,cg]=Al(pa),[yp,ug]=Al(pa,{collapsible:!1}),hg=nt.forwardRef((b,I)=>{const{value:C,defaultValue:k,onValueChange:B=()=>{},collapsible:N=!1,...ne}=b,[a,Y]=Hc({prop:C,defaultProp:k,onChange:B});return nt.createElement(_p,{scope:b.__scopeAccordion,value:a?[a]:[],onItemOpen:Y,onItemClose:nt.useCallback(()=>N&&Y(""),[N,Y])},nt.createElement(yp,{scope:b.__scopeAccordion,collapsible:N},nt.createElement(xp,sr({},ne,{ref:I}))))}),pg=nt.forwardRef((b,I)=>{const{value:C,defaultValue:k,onValueChange:B=()=>{},...N}=b,[ne=[],a]=Hc({prop:C,defaultProp:k,onChange:B}),Y=nt.useCallback(he=>a((ue=[])=>[...ue,he]),[a]),ie=nt.useCallback(he=>a((ue=[])=>ue.filter(ee=>ee!==he)),[a]);return nt.createElement(_p,{scope:b.__scopeAccordion,value:ne,onItemOpen:Y,onItemClose:ie},nt.createElement(yp,{scope:b.__scopeAccordion,collapsible:!0},nt.createElement(xp,sr({},N,{ref:I}))))}),[dg,fg]=Al(pa),xp=nt.forwardRef((b,I)=>{const{__scopeAccordion:C,disabled:k,...B}=b,N=nt.useRef(null),ne=Tl(N,I),a=ag(C),Y=Yh(b.onKeyDown,ie=>{var he;if(!sg.includes(ie.key))return;const ue=ie.target,ee=a().filter(Xe=>{var Qe;return!((Qe=Xe.ref.current)!==null&&Qe!==void 0&&Qe.disabled)}),Se=ee.findIndex(Xe=>Xe.ref.current===ue),Ie=ee.length;if(Se===-1)return;ie.preventDefault();let Ce=Se;switch(ie.key){case"Home":Ce=0;break;case"End":Ce=Ie-1;break;case"ArrowDown":Ce=Se+1;break;case"ArrowUp":Ce=Se-1,Ce<0&&(Ce=Ie-1);break}const Ke=Ce%Ie;(he=ee[Ke].ref.current)===null||he===void 0||he.focus()});return nt.createElement(dg,{scope:C,disabled:k},nt.createElement(Qc.Slot,{scope:C},nt.createElement(ca.div,sr({},B,{ref:ne,onKeyDown:k?void 0:Y}))))}),Nc="AccordionItem",[mg,tu]=Al(Nc),gg=nt.forwardRef((b,I)=>{const{__scopeAccordion:C,value:k,...B}=b,N=fg(Nc,C),ne=cg(Nc,C),a=eu(C),Y=ip(),ie=k&&ne.value.includes(k)||!1,he=N.disabled||b.disabled;return nt.createElement(mg,{scope:C,open:ie,disabled:he,triggerId:Y},nt.createElement(rg,sr({"data-state":ie?"open":"closed"},a,B,{ref:I,disabled:he,open:ie,onOpenChange:ue=>{ue?ne.onItemOpen(k):ne.onItemClose(k)}})))}),_g="AccordionHeader",yg=nt.forwardRef((b,I)=>{const{__scopeAccordion:C,...k}=b,B=tu(_g,C);return nt.createElement(ca.h3,sr({"data-state":wg(B.open),"data-disabled":B.disabled?"":void 0},k,{ref:I}))}),Oh="AccordionTrigger",xg=nt.forwardRef((b,I)=>{const{__scopeAccordion:C,...k}=b,B=tu(Oh,C),N=ug(Oh,C),ne=eu(C);return nt.createElement(Qc.ItemSlot,{scope:C},nt.createElement(ng,sr({"aria-disabled":B.open&&!N.collapsible||void 0,id:B.triggerId},ne,k,{ref:I})))}),vg="AccordionContent",bg=nt.forwardRef((b,I)=>{const{__scopeAccordion:C,...k}=b,B=tu(vg,C),N=eu(C);return nt.createElement(og,sr({role:"region","aria-labelledby":B.triggerId},N,k,{ref:I,style:{["--radix-accordion-content-height"]:"var(--radix-collapsible-content-height)",["--radix-accordion-content-width"]:"var(--radix-collapsible-content-width)",...b.style}}))});function wg(b){return b?"open":"closed"}const Tg=gp,Eg=gg,Sg=yg,Ig=xg,Cg=bg,vp={all:()=>["scores"],list:b=>[...vp.all(),b]};function Ag(b){const{client:I}=ua(),{sdkState:C}=Sl(),k=jc(C.options,250),N={...ve.exports.useMemo(()=>k!=null&&k.marker?k.marker:{lat:k==null?void 0:k.lat,lng:k==null?void 0:k.lng},[k]),geographyLevels:["10","30"],locationScoresRounding:!1,include:b};return Xc(vp.list(N),async()=>I.getScores(N),{enabled:!!N})}const Mg=b=>ve.exports.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...b},ve.exports.createElement("path",{d:"M9.99984 6L8.58984 7.41L13.1698 12L8.58984 16.59L9.99984 18L15.9998 12L9.99984 6Z"})),bp={all:()=>["schools"],list:b=>[...bp.all(),b]};function wp(){const{client:b}=ua(),{sdkState:I}=Sl(),C=jc(I.options,250),B={...ve.exports.useMemo(()=>C!=null&&C.marker?C.marker:{lat:C==null?void 0:C.lat,lng:C==null?void 0:C.lng},[C]),limit:10,radius:2e3};return Xc(bp.list(B),async()=>b.getSchools(B),{enabled:!!B&&!!B.lat&&!!B.lng})}const Pg=Qh({from:{height:0},to:{height:"var(--radix-accordion-content-height)"}}),zg=Qh({from:{height:"var(--radix-accordion-content-height)"},to:{height:0}}),kg=pi(Sg)`
|
|
653
|
-
margin: 0;
|
|
654
|
-
`,Tp=pi(Ig)`
|
|
655
|
-
background: none;
|
|
656
|
-
border: none;
|
|
657
|
-
display: flex;
|
|
658
|
-
align-items: center;
|
|
659
|
-
width: 100%;
|
|
660
|
-
padding: ${It["--ll-spacing-x-small"]} 0;
|
|
661
|
-
`,Dg=pi(Cg)`
|
|
662
|
-
background-color: ${It["--ll-color-surface"]};
|
|
663
|
-
position: relative;
|
|
664
|
-
z-index: 1;
|
|
665
|
-
overflow: hidden;
|
|
666
|
-
margin-left: calc(-1 * ${It["--ll-spacing-medium"]});
|
|
667
|
-
margin-right: calc(-1 * ${It["--ll-spacing-medium"]});
|
|
668
|
-
|
|
669
|
-
[data-state="open"] & {
|
|
670
|
-
animation: ${Pg} 300ms cubic-bezier(0.87, 0, 0.13, 1);
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
[data-state="closed"] & {
|
|
674
|
-
animation: ${zg} 300ms cubic-bezier(0.87, 0, 0.13, 1);
|
|
675
|
-
}
|
|
676
|
-
`,Lg=pi.div`
|
|
677
|
-
padding: ${It["--ll-spacing-medium"]};
|
|
678
|
-
`,Rg=pi.span`
|
|
679
|
-
${Tp}[data-state=open] & {
|
|
680
|
-
transform: rotate(90deg);
|
|
681
|
-
} ;
|
|
682
|
-
`;pi.div`
|
|
683
|
-
display: flex;
|
|
684
|
-
align-items: flex-start;
|
|
685
|
-
justify-content: space-between;
|
|
686
|
-
`;const iu=pi.div`
|
|
687
|
-
margin: ${It["--ll-spacing-small"]} 0;
|
|
688
|
-
`,Bg=pi.div`
|
|
689
|
-
margin-top: ${It["--ll-spacing-large"]};
|
|
690
|
-
|
|
691
|
-
&:empty {
|
|
692
|
-
margin: 0;
|
|
693
|
-
}
|
|
694
|
-
`,Ep=nt.createContext({}),Sp=()=>ve.exports.useContext(Ep),Fg=({children:b,mapRef:I,mapPadding:C})=>Ve(Ep.Provider,{value:{mapRef:I,mapPadding:C},children:b}),Og=({score:b})=>{const{data:I,isLoading:C}=wp(),{activePOI:k,setActivePOI:B,hoveredPOI:N,setHoveredPOI:ne}=as(),{mapRef:a,mapPadding:Y}=Sp();return C?Ve(Il,{children:[...Array(10)].map(ie=>Ve(iu,{children:Ve(Wc,{height:"34px",width:"100%"})},ie))}):I?Ve(ep.Root,{options:{type:"school",data:I==null?void 0:I[b],activePOI:k,hoveredPOI:N},onChange:ie=>{var he;if(ie.type==="poi-click"){const ue=ie.data;B(ue),ue&&((he=a.current)==null||he.flyTo({zoom:18,center:[ue.lng,ue.lat],duration:1e3,padding:Y}))}ie.type==="poi-hover"&&ne(ie.data)}}):null},Ip={all:()=>["pois"],list:b=>[...Ip.all(),b]},{scorePois:Ug}=os.Constants;function Cp(){var a;const{client:b}=ua(),{sdkState:I}=Sl(),C=jc(I.options,250),{activeScore:k}=as(),B=Ug[k],ne={...ve.exports.useMemo(()=>C!=null&&C.marker?C.marker:{lat:C==null?void 0:C.lat,lng:C==null?void 0:C.lng},[C]),limit:10,radius:2e3,include:B};return Xc(Ip.list(ne),async()=>b.getPois(ne),{enabled:!!ne&&!!((a=ne.include)!=null&&a.length)&&!!ne.lat&&!!ne.lng})}const Ap=nt.memo(({result:b,poi:I})=>{const{activePOI:C,setActivePOI:k,hoveredPOI:B,setHoveredPOI:N}=as(),{mapRef:ne,mapPadding:a}=Sp();return!b.data||!b.data[I]?null:Ve(os.Content,{options:{value:I},children:Ve(ep.Root,{options:{type:"poi",data:b.data[I],activePOI:C,hoveredPOI:B},onChange:Y=>{var ie;if(Y.type==="poi-click"){const he=Y.data;k(he),he&&((ie=ne.current)==null||ie.flyTo({zoom:18,center:[he.lng,he.lat],duration:1e3,padding:a}))}Y.type==="poi-hover"&&N(Y.data)}})},I)});Ap.displayName="POI";const Mp=nt.memo(({include:b})=>{const I=Cp();return I.isLoading&&b.length?Ve(Il,{children:[...Array(10)].map((C,k)=>Ve(iu,{children:Ve(Wc,{height:"34px",width:"100%"})},k))}):I.data?gr(os.Root,{options:{include:b},children:[Ve(os.Tabs,{}),b.map(C=>Ve(Ap,{poi:C,result:I},C))]}):null});Mp.displayName="POIs";const{scorePois:$g}=os.Constants,Pp=nt.memo(({score:b,isLoading:I,data:C})=>I?Ve(iu,{children:Ve(Wc,{height:"34px",width:"100%"},b)}):Ve(Eg,{value:b,children:gr(rs.Root,{options:{score:b,data:C},children:[Ve(kg,{children:gr(Tp,{children:[Ve(Rg,{children:Ve(Uf,{SVGElement:Mg,fill:It["--ll-color-on-background-variant1"]})}),Ve(vl,{spacing:"--ll-spacing-small"}),Ve(rs.Icon,{}),Ve(vl,{spacing:"--ll-spacing-small"}),Ve(rs.Title,{}),Ve(vl,{}),Ve(rs.Badge,{})]})}),Ve(Dg,{children:gr(Lg,{children:[Ve(rs.Description,{}),Ve(rs.BarChart,{}),Ve(Bg,{children:b==="high_schools"||b==="primary_schools"?Ve(Og,{score:b}):Ve(Mp,{include:$g[b]})})]})})]})},b));Pp.displayName="Score";const Vg=pi.div`
|
|
695
|
-
padding: ${It["--ll-spacing-small"]} ${It["--ll-spacing-medium"]};
|
|
696
|
-
`,Ng=pi.div`
|
|
697
|
-
display: flex;
|
|
698
|
-
justify-content: space-between;
|
|
699
|
-
align-items: center;
|
|
700
|
-
`,zp=nt.memo(({locale:b,data:I,isLoading:C,isFetching:k,tabContent:B})=>{const N=ve.exports.useMemo(()=>b==="fr"?"Aucune donn\xE9e disponible pour cet emplacement.":"No data available for this location.",[b]);return gr(Vg,{children:[gr(Ng,{children:[Ve(Gn.Title,{variant:"h4",noMargin:!0,weight:"--ll-font-weight-medium"}),k&&!C&&Ve($f,{size:"small"})]}),Ve(vl,{spacing:"--ll-spacing-small",vertical:!0}),!k&&!Object.keys((I==null?void 0:I.location)||{}).length&&Ve(tp,{color:"--ll-color-on-background-variant1",children:N}),B.scores.map(ne=>Ve(Pp,{score:ne,data:I,isLoading:C},ne))]})});zp.displayName="ScoreCategory";const Gc=nt.memo(({tabContent:b})=>{const{client:I}=ua(),{data:C,isLoading:k,isFetching:B}=Ag(b.scores),{activeScore:N,setActiveScore:ne}=as();return Ve(Tg,{value:N,onValueChange:a=>ne(a),type:"single",collapsible:!0,children:Ve(zp,{data:C,isLoading:k,isFetching:B,tabContent:b,locale:I.options.locale})})});Gc.displayName="ScoreCategoryAccordion";const kp=nt.forwardRef(({rect:b},I)=>{const[C,k]=ve.exports.useState(!0),B=pp(),{client:N}=ua(),{activeCategory:ne,setActiveCategory:a}=as(),Y={open:{y:0},closed:{y:b.height-60}},ie={closed:{opacity:1},open:{opacity:0}},he=ve.exports.useMemo(()=>N.options.locale==="fr"?"Explorez le quartier":"Explore neighbourhood insights",[N.options.locale]),ue=()=>gr(Il,{children:[Ve(jm,{children:Ve(Gn.Tabs,{})}),gr(qm,{ref:I,isOpen:C,animate:C?"open":"closed",variants:Y,drag:"y",dragMomentum:!1,dragConstraints:{top:0,bottom:200},dragElastic:{top:.1,bottom:.8},dragSnapToOrigin:!0,onDragEnd:(Se,Ie)=>{if(Ie.offset.y>50){k(!1);return}Ie.offset.y<-50&&k(!0)},children:[Ve(Xm,{}),gr(Fh,{children:[!C&&Ve(Hf,{children:Ve(Wm,{variants:ie,animate:C?"open":"closed",children:Ve(tp,{children:he})})}),Gn.Constants.tabsContent.map(Se=>Ve(Gn.Content,{options:{value:Se.value},children:Ve(Gc,{tabContent:Se},Se.value)},Se.value))]}),Ve(Zm,{children:Ve(Ih.Root,{})})]})]}),ee=()=>gr(Vm,{ref:I,children:[Ve(Gm,{children:Ve(Gn.Tabs,{})}),Ve(Fh,{children:Gn.Constants.tabsContent.map(Se=>Ve(Gn.Content,{options:{value:Se.value},children:Ve(Gc,{tabContent:Se},Se.value)},Se.value))}),Ve(Nm,{children:Ve(Ih.Root,{})})]});return Ve(Gn.Root,{options:{currentTab:ne},onChange:Se=>{a(Se.data),k(!0)},children:B?ue():ee()})});kp.displayName="Scores";const Dp=nt.memo(({marker:b})=>Ve(Uc,{latitude:b.lat,longitude:b.lng,style:{zIndex:1},children:Ve(Vf.Root,{options:{style:"pin"}})}));Dp.displayName="Pin";function qc(b,I,C,k,B,N){if(B-k<=C)return;const ne=k+B>>1;Lp(b,I,ne,k,B,N%2),qc(b,I,C,k,ne-1,N+1),qc(b,I,C,ne+1,B,N+1)}function Lp(b,I,C,k,B,N){for(;B>k;){if(B-k>600){const ie=B-k+1,he=C-k+1,ue=Math.log(ie),ee=.5*Math.exp(2*ue/3),Se=.5*Math.sqrt(ue*ee*(ie-ee)/ie)*(he-ie/2<0?-1:1),Ie=Math.max(k,Math.floor(C-he*ee/ie+Se)),Ce=Math.min(B,Math.floor(C+(ie-he)*ee/ie+Se));Lp(b,I,C,Ie,Ce,N)}const ne=I[2*C+N];let a=k,Y=B;for(sa(b,I,k,C),I[2*B+N]>ne&&sa(b,I,k,B);a<Y;){for(sa(b,I,a,Y),a++,Y--;I[2*a+N]<ne;)a++;for(;I[2*Y+N]>ne;)Y--}I[2*k+N]===ne?sa(b,I,k,Y):(Y++,sa(b,I,Y,B)),Y<=C&&(k=Y+1),C<=Y&&(B=Y-1)}}function sa(b,I,C,k){Fc(b,C,k),Fc(I,2*C,2*k),Fc(I,2*C+1,2*k+1)}function Fc(b,I,C){const k=b[I];b[I]=b[C],b[C]=k}function Gg(b,I,C,k,B,N,ne){const a=[0,b.length-1,0],Y=[];let ie,he;for(;a.length;){const ue=a.pop(),ee=a.pop(),Se=a.pop();if(ee-Se<=ne){for(let Ke=Se;Ke<=ee;Ke++)ie=I[2*Ke],he=I[2*Ke+1],ie>=C&&ie<=B&&he>=k&&he<=N&&Y.push(b[Ke]);continue}const Ie=Math.floor((Se+ee)/2);ie=I[2*Ie],he=I[2*Ie+1],ie>=C&&ie<=B&&he>=k&&he<=N&&Y.push(b[Ie]);const Ce=(ue+1)%2;(ue===0?C<=ie:k<=he)&&(a.push(Se),a.push(Ie-1),a.push(Ce)),(ue===0?B>=ie:N>=he)&&(a.push(Ie+1),a.push(ee),a.push(Ce))}return Y}function qg(b,I,C,k,B,N){const ne=[0,b.length-1,0],a=[],Y=B*B;for(;ne.length;){const ie=ne.pop(),he=ne.pop(),ue=ne.pop();if(he-ue<=N){for(let Ke=ue;Ke<=he;Ke++)Uh(I[2*Ke],I[2*Ke+1],C,k)<=Y&&a.push(b[Ke]);continue}const ee=Math.floor((ue+he)/2),Se=I[2*ee],Ie=I[2*ee+1];Uh(Se,Ie,C,k)<=Y&&a.push(b[ee]);const Ce=(ie+1)%2;(ie===0?C-B<=Se:k-B<=Ie)&&(ne.push(ue),ne.push(ee-1),ne.push(Ce)),(ie===0?C+B>=Se:k+B>=Ie)&&(ne.push(ee+1),ne.push(he),ne.push(Ce))}return a}function Uh(b,I,C,k){const B=b-C,N=I-k;return B*B+N*N}const Zg=b=>b[0],jg=b=>b[1];class $h{constructor(I,C=Zg,k=jg,B=64,N=Float64Array){this.nodeSize=B,this.points=I;const ne=I.length<65536?Uint16Array:Uint32Array,a=this.ids=new ne(I.length),Y=this.coords=new N(I.length*2);for(let ie=0;ie<I.length;ie++)a[ie]=ie,Y[2*ie]=C(I[ie]),Y[2*ie+1]=k(I[ie]);qc(a,Y,B,0,a.length-1,0)}range(I,C,k,B){return Gg(this.ids,this.coords,I,C,k,B,this.nodeSize)}within(I,C,k){return qg(this.ids,this.coords,I,C,k,this.nodeSize)}}const Xg={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:b=>b},El=Math.fround||(b=>I=>(b[0]=+I,b[0]))(new Float32Array(1));class Wg{constructor(I){this.options=la(Object.create(Xg),I),this.trees=new Array(this.options.maxZoom+1)}load(I){const{log:C,minZoom:k,maxZoom:B,nodeSize:N}=this.options;C&&console.time("total time");const ne=`prepare ${I.length} points`;C&&console.time(ne),this.points=I;let a=[];for(let Y=0;Y<I.length;Y++)!I[Y].geometry||a.push(Kg(I[Y],Y));this.trees[B+1]=new $h(a,Nh,Gh,N,Float32Array),C&&console.timeEnd(ne);for(let Y=B;Y>=k;Y--){const ie=+Date.now();a=this._cluster(a,Y),this.trees[Y]=new $h(a,Nh,Gh,N,Float32Array),C&&console.log("z%d: %d clusters in %dms",Y,a.length,+Date.now()-ie)}return C&&console.timeEnd("total time"),this}getClusters(I,C){let k=((I[0]+180)%360+360)%360-180;const B=Math.max(-90,Math.min(90,I[1]));let N=I[2]===180?180:((I[2]+180)%360+360)%360-180;const ne=Math.max(-90,Math.min(90,I[3]));if(I[2]-I[0]>=360)k=-180,N=180;else if(k>N){const he=this.getClusters([k,B,180,ne],C),ue=this.getClusters([-180,B,N,ne],C);return he.concat(ue)}const a=this.trees[this._limitZoom(C)],Y=a.range(bl(k),wl(ne),bl(N),wl(B)),ie=[];for(const he of Y){const ue=a.points[he];ie.push(ue.numPoints?Vh(ue):this.points[ue.index])}return ie}getChildren(I){const C=this._getOriginId(I),k=this._getOriginZoom(I),B="No cluster with the specified id.",N=this.trees[k];if(!N)throw new Error(B);const ne=N.points[C];if(!ne)throw new Error(B);const a=this.options.radius/(this.options.extent*Math.pow(2,k-1)),Y=N.within(ne.x,ne.y,a),ie=[];for(const he of Y){const ue=N.points[he];ue.parentId===I&&ie.push(ue.numPoints?Vh(ue):this.points[ue.index])}if(ie.length===0)throw new Error(B);return ie}getLeaves(I,C,k){C=C||10,k=k||0;const B=[];return this._appendLeaves(B,I,C,k,0),B}getTile(I,C,k){const B=this.trees[this._limitZoom(I)],N=Math.pow(2,I),{extent:ne,radius:a}=this.options,Y=a/ne,ie=(k-Y)/N,he=(k+1+Y)/N,ue={features:[]};return this._addTileFeatures(B.range((C-Y)/N,ie,(C+1+Y)/N,he),B.points,C,k,N,ue),C===0&&this._addTileFeatures(B.range(1-Y/N,ie,1,he),B.points,N,k,N,ue),C===N-1&&this._addTileFeatures(B.range(0,ie,Y/N,he),B.points,-1,k,N,ue),ue.features.length?ue:null}getClusterExpansionZoom(I){let C=this._getOriginZoom(I)-1;for(;C<=this.options.maxZoom;){const k=this.getChildren(I);if(C++,k.length!==1)break;I=k[0].properties.cluster_id}return C}_appendLeaves(I,C,k,B,N){const ne=this.getChildren(C);for(const a of ne){const Y=a.properties;if(Y&&Y.cluster?N+Y.point_count<=B?N+=Y.point_count:N=this._appendLeaves(I,Y.cluster_id,k,B,N):N<B?N++:I.push(a),I.length===k)break}return N}_addTileFeatures(I,C,k,B,N,ne){for(const a of I){const Y=C[a],ie=Y.numPoints;let he,ue,ee;if(ie)he=Rp(Y),ue=Y.x,ee=Y.y;else{const Ce=this.points[Y.index];he=Ce.properties,ue=bl(Ce.geometry.coordinates[0]),ee=wl(Ce.geometry.coordinates[1])}const Se={type:1,geometry:[[Math.round(this.options.extent*(ue*N-k)),Math.round(this.options.extent*(ee*N-B))]],tags:he};let Ie;ie?Ie=Y.id:this.options.generateId?Ie=Y.index:this.points[Y.index].id&&(Ie=this.points[Y.index].id),Ie!==void 0&&(Se.id=Ie),ne.features.push(Se)}}_limitZoom(I){return Math.max(this.options.minZoom,Math.min(Math.floor(+I),this.options.maxZoom+1))}_cluster(I,C){const k=[],{radius:B,extent:N,reduce:ne,minPoints:a}=this.options,Y=B/(N*Math.pow(2,C));for(let ie=0;ie<I.length;ie++){const he=I[ie];if(he.zoom<=C)continue;he.zoom=C;const ue=this.trees[C+1],ee=ue.within(he.x,he.y,Y),Se=he.numPoints||1;let Ie=Se;for(const Ce of ee){const Ke=ue.points[Ce];Ke.zoom>C&&(Ie+=Ke.numPoints||1)}if(Ie>Se&&Ie>=a){let Ce=he.x*Se,Ke=he.y*Se,Xe=ne&&Se>1?this._map(he,!0):null;const Qe=(ie<<5)+(C+1)+this.points.length;for(const lt of ee){const vt=ue.points[lt];if(vt.zoom<=C)continue;vt.zoom=C;const ot=vt.numPoints||1;Ce+=vt.x*ot,Ke+=vt.y*ot,vt.parentId=Qe,ne&&(Xe||(Xe=this._map(he,!0)),ne(Xe,this._map(vt)))}he.parentId=Qe,k.push(Hg(Ce/Ie,Ke/Ie,Qe,Ie,Xe))}else if(k.push(he),Ie>1)for(const Ce of ee){const Ke=ue.points[Ce];Ke.zoom<=C||(Ke.zoom=C,k.push(Ke))}}return k}_getOriginId(I){return I-this.points.length>>5}_getOriginZoom(I){return(I-this.points.length)%32}_map(I,C){if(I.numPoints)return C?la({},I.properties):I.properties;const k=this.points[I.index].properties,B=this.options.map(k);return C&&B===k?la({},B):B}}function Hg(b,I,C,k,B){return{x:El(b),y:El(I),zoom:1/0,id:C,parentId:-1,numPoints:k,properties:B}}function Kg(b,I){const[C,k]=b.geometry.coordinates;return{x:El(bl(C)),y:El(wl(k)),zoom:1/0,index:I,parentId:-1}}function Vh(b){return{type:"Feature",id:b.id,properties:Rp(b),geometry:{type:"Point",coordinates:[Jg(b.x),Yg(b.y)]}}}function Rp(b){const I=b.numPoints,C=I>=1e4?`${Math.round(I/1e3)}k`:I>=1e3?`${Math.round(I/100)/10}k`:I;return la(la({},b.properties),{cluster:!0,cluster_id:b.id,point_count:I,point_count_abbreviated:C})}function bl(b){return b/360+.5}function wl(b){const I=Math.sin(b*Math.PI/180),C=.5-.25*Math.log((1+I)/(1-I))/Math.PI;return C<0?0:C>1?1:C}function Jg(b){return(b-.5)*360}function Yg(b){const I=(180-b*360)*Math.PI/180;return 360*Math.atan(Math.exp(I))/Math.PI-90}function la(b,I){for(const C in I)b[C]=I[C];return b}function Nh(b){return b.x}function Gh(b){return b.y}var qh=Object.prototype.hasOwnProperty;function Zh(b,I,C){for(C of b.keys())if(So(C,I))return C}function So(b,I){var C,k,B;if(b===I)return!0;if(b&&I&&(C=b.constructor)===I.constructor){if(C===Date)return b.getTime()===I.getTime();if(C===RegExp)return b.toString()===I.toString();if(C===Array){if((k=b.length)===I.length)for(;k--&&So(b[k],I[k]););return k===-1}if(C===Set){if(b.size!==I.size)return!1;for(k of b)if(B=k,B&&typeof B=="object"&&(B=Zh(I,B),!B)||!I.has(B))return!1;return!0}if(C===Map){if(b.size!==I.size)return!1;for(k of b)if(B=k[0],B&&typeof B=="object"&&(B=Zh(I,B),!B)||!So(k[1],I.get(B)))return!1;return!0}if(C===ArrayBuffer)b=new Uint8Array(b),I=new Uint8Array(I);else if(C===DataView){if((k=b.byteLength)===I.byteLength)for(;k--&&b.getInt8(k)===I.getInt8(k););return k===-1}if(ArrayBuffer.isView(b)){if((k=b.byteLength)===I.byteLength)for(;k--&&b[k]===I[k];);return k===-1}if(!C||typeof b=="object"){k=0;for(C in b)if(qh.call(b,C)&&++k&&!qh.call(I,C)||!(C in I)||!So(b[C],I[C]))return!1;return Object.keys(I).length===k}}return b!==b&&I!==I}function Qg(b){var I=ve.exports.useRef(b),C=ve.exports.useRef(0);return So(b,I.current)||(I.current=b,C.current+=1),ve.exports.useMemo(function(){return I.current},[C.current])}function e_(b,I){return ve.exports.useEffect(b,Qg(I))}var t_=function(I){var C=I.points,k=I.bounds,B=I.zoom,N=I.options,ne=ve.exports.useRef(),a=ve.exports.useRef(),Y=ve.exports.useState([]),ie=Y[0],he=Y[1],ue=Math.round(B);return e_(function(){(!ne.current||!So(a.current,C)||!So(ne.current.options,N))&&(ne.current=new Wg(N),ne.current.load(C)),k&&he(ne.current.getClusters(k,ue)),a.current=C},[C,k,ue,N]),{clusters:ie,supercluster:ne.current}};const i_=pi.div`
|
|
701
|
-
border-radius: 50%;
|
|
702
|
-
background: linear-gradient(
|
|
703
|
-
to top,
|
|
704
|
-
${It["--ll-color-primary-variant1"]},
|
|
705
|
-
${It["--ll-color-primary"]}
|
|
706
|
-
);
|
|
707
|
-
color: ${It["--ll-color-on-primary"]};
|
|
708
|
-
height: ${({diameter:b})=>b}px;
|
|
709
|
-
width: ${({diameter:b})=>b}px;
|
|
710
|
-
display: flex;
|
|
711
|
-
justify-content: center;
|
|
712
|
-
align-items: center;
|
|
713
|
-
line-height: 1;
|
|
714
|
-
font-family: ${It["--ll-font-family"]};
|
|
715
|
-
font-size: ${({diameter:b})=>b/2.5}px;
|
|
716
|
-
border: 2px solid #fff;
|
|
717
|
-
box-shadow: ${It["--ll-shadow-small"]};
|
|
718
|
-
cursor: default;
|
|
719
|
-
`,r_=({cluster:b,pointsCount:I,onClick:C})=>{const k=b.properties.point_count,B=20+k/I*25;return Ve(i_,{diameter:B,onClick:()=>C&&C(b),children:b.properties.point_count})};function n_(b){return b.properties.cluster!==void 0}const Bp=nt.memo(({rect:b,zoom:I,mapRef:C,points:k,isMobile:B,activePOI:N,hoveredPOI:ne,isMapMoving:a,setActivePOI:Y})=>{var ee;const ie=(ee=C==null?void 0:C.current)==null?void 0:ee.getMap().getBounds().toArray().flat(),{clusters:he,supercluster:ue}=t_({points:k,bounds:ie,zoom:I,options:{radius:50,maxZoom:18}});return Ve(Il,{children:he.map((Se,Ie)=>{const[Ce,Ke]=Se.geometry.coordinates;if(n_(Se))return Ve(Uc,{latitude:Ke,longitude:Ce,children:Ve(r_,{cluster:Se,pointsCount:k.length,onClick:()=>{var gt;const ot=Math.min(ue.getClusterExpansionZoom(Se.id),20);(gt=C.current)==null||gt.flyTo({zoom:ot,center:[Ce,Ke],duration:1e3})}})},`cluster-${Se.id}`);const{poi:Xe,type:Qe}=Se.properties,lt=N===Xe,vt=ne===Xe;return Ve(Uc,{latitude:Xe.lat,longitude:Xe.lng,style:{zIndex:lt?1:0},children:gr(Dc.Root,{options:{type:Qe,poi:Xe,isOpen:a?!1:lt,isHovered:vt,side:"top",collisionPadding:B?{top:65,bottom:65,left:oa*2,right:oa*2}:{left:b.width+32,right:oa*2,top:oa*2,bottom:oa*2}},onChange:ot=>{ot.type==="open-change"&&Y(lt?void 0:Xe)},children:[Ve(Dc.Marker,{}),Ve(Dc.Content,{})]})},`${Xe.name}-${Xe.lat}-${Xe.lng}-${Ie}`)})})});Bp.displayName="Markers";const{scorePois:jh}=os.Constants,o_=()=>{var vt,ot,gt;const{sdkState:b,setSdkState:I}=Sl(),{activeScore:C,activePOI:k,setActivePOI:B,hoveredPOI:N}=as(),ne=pp(),a=Cp(),Y=wp(),ie=((ot=(vt=b==null?void 0:b.globalOptions)==null?void 0:vt.appearance)==null?void 0:ot.theme)==="night"?"streets-dark":"streets",[he,ue]=ve.exports.useState(!1),ee=ve.exports.useMemo(()=>{var ft;return(C==="high_schools"||C==="primary_schools")&&!Y.isFetching?{[C]:((ft=Y==null?void 0:Y.data)==null?void 0:ft[C])||[]}:!(jh[C]&&jh[C].length)&&!a.isFetching?{[C]:[]}:a.data},[a.data,Y.data,C]),Se=ve.exports.useMemo(()=>ee?Object.entries(ee).map(([ct,Xt])=>Xt.map(Wt=>Dh([Wt.lng,Wt.lat],{poi:Wt,type:ct}))).flat().filter((ct,Xt,Wt)=>Wt.findIndex(ki=>["lat","lng","name"].every(di=>ki.properties.poi[di]===ct.properties.poi[di]))===Xt):[],[ee]),Ie=ve.exports.useMemo(()=>{var ct,Xt,Wt;const ft=((ct=b==null?void 0:b.options)==null?void 0:ct.marker)&&Dh([(Xt=b==null?void 0:b.options)==null?void 0:Xt.marker.lng,(Wt=b==null?void 0:b.options)==null?void 0:Wt.marker.lat]);return[...Se,...ft?[ft]:[]]},[Se,(gt=b==null?void 0:b.options)==null?void 0:gt.marker]),Ce=ve.exports.useRef(),[Ke,Xe]=wm(),Qe=ve.exports.useMemo(()=>{const ft=ne?25:50;return{top:ft,bottom:ft,left:ne?ft:Xe.width+32+ft,right:ft}},[ne,Xe.width]),lt=ft=>{I({...b,options:{...b.options,lat:ft.viewState.latitude,lng:ft.viewState.longitude,zoom:ft.viewState.zoom,bearing:ft.viewState.bearing,pitch:ft.viewState.pitch}})};return ve.exports.useEffect(()=>{var di,Hi;if(!Ie.length||!((di=b.options)!=null&&di.marker))return;const ft=vm(Ie.map(({geometry:Ki})=>[Ki.coordinates[1],Ki.coordinates[0]])),[ct,Xt,Wt,ki]=$c(ft);(Hi=Ce==null?void 0:Ce.current)==null||Hi.fitBounds([[Xt,ct],[ki,Wt]],{maxZoom:17,padding:Qe,duration:1e3})},[Ie,Qe]),b.options?Ve(Fg,{mapRef:Ce,mapPadding:Qe,children:gr(Kc,{ref:Ce,mapLib:xm,latitude:b.options.lat,longitude:b.options.lng,zoom:b.options.zoom,pitch:b.options.pitch,bearing:b.options.bearing,style:{height:"100vh",width:"100vw"},mapStyle:`https://api.maptiler.com/maps/${ie}/style.json?key=KJ8IWUkGS9G824exx27J`,onMove:lt,cooperativeGestures:b.options.cooperativeGestures,onMoveStart:()=>ue(!0),onMoveEnd:()=>ue(!1),children:[Ve(_m,{showCompass:!0,style:ne?{marginTop:"85px",marginRight:"8px"}:{marginTop:"16px",marginRight:"16px"}}),Ve(kp,{ref:Ke,rect:Xe}),b.options.marker&&Ve(Dp,{marker:b.options.marker}),Ve(Bp,{rect:Xe,zoom:b.options.zoom,mapRef:Ce,points:Se,isMobile:ne,activePOI:k,hoveredPOI:N,isMapMoving:he,setActivePOI:B})]})}):Ve("div",{children:"No options provided."})},l_=()=>Ve(Kf,{children:Ve(o_,{})});export{l_ as default};
|