PageSourceSearch

https://elzewhere.com/assets/mapbox-DYU4mihP.js

js elzewhere.com collected 2026-10-09 05:14:53 UTC 1,704,143 bytes, 3,004 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mapbox-gl-ECfj-Tyj.js","assets/radix-BKGOUGPy.js"])))=>i.map(i=>d[i]);
2import{r as Bt,a as e1}from"./radix-BKGOUGPy.js";const i2="modulepreload",r2=function(me){return"/"+me},q0={},n2=function(_e,qe,$e){let Ve=Promise.resolve();if(qe&&qe.length>0){let zt=function(wt){return Promise.all(wt.map(Ui=>Promise.resolve(Ui).then(Ht=>({status:"fulfilled",value:Ht}),Ht=>({status:"rejected",reason:Ht}))))};document.getElementsByTagName("link");const at=document.querySelector("meta[property=csp-nonce]"),s=at?.nonce||at?.getAttribute("nonce");Ve=zt(qe.map(wt=>{if(wt=r2(wt),wt in q0)return;q0[wt]=!0;const Ui=wt.endsWith(".css"),Ht=Ui?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${wt}"]${Ht}`))return;const Yi=document.createElement("link");if(Yi.rel=Ui?"stylesheet":i2,Ui||(Yi.as="script"),Yi.crossOrigin="",Yi.href=wt,s&&Yi.setAttribute("nonce",s),document.head.appendChild(Yi),Ui)return new Promise((lr,Hn)=>{Yi.addEventListener("load",lr),Yi.addEventListener("error",()=>Hn(new Error(`Unable to preload CSS for ${wt}`)))})}))}function Ye(at){const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=at,window.dispatchEvent(s),!s.defaultPrevented)throw at}return Ve.then(at=>{for(const s of at||[])s.status==="rejected"&&Ye(s.reason);return _e().catch(Ye)})},o2=Bt.createContext(null);function s2(me){return{longitude:me.center.lng,latitude:me.center.lat,zoom:me._seaLevelZoom??me.zoom,pitch:me.pitch,bearing:me.bearing,padding:me.padding,elevation:me._centerAltitude}}function a2(me){return Number.isFinite(me.longitude)||Number.isFinite(me.latitude)||Number.isFinite(me.zoom)||Number.isFinite(me.pitch)||Number.isFinite(me.bearing)}function l2(me,_e){return!!(Number.isFinite(_e.longitude)&&me.center.lng!==_e.longitude||Number.isFinite(_e.latitude)&&me.center.lat!==_e.latitude||Number.isFinite(_e.bearing)&&me.bearing!==_e.bearing||Number.isFinite(_e.pitch)&&me.pitch!==_e.pitch||Number.isFinite(_e.zoom)&&(me._seaLevelZoom??me.zoom)!==_e.zoom||_e.padding&&!me.isPaddingEqual(_e.padding))}function H0(){}function c2(me,_e){const qe=me._constrain,$e=me._calcMatrices;if(me._constrain=H0,me._calcMatrices=H0,Number.isFinite(_e.bearing)&&(me.bearing=_e.bearing),Number.isFinite(_e.pitch)&&(me.pitch=_e.pitch),_e.padding&&!me.isPaddingEqual(_e.padding)&&(me.padding=_e.padding),Number.isFinite(_e.longitude)||Number.isFinite(_e.latitude)){const Ve=me.center;me._center=new Ve.constructor(_e.longitude??Ve.lng,_e.latitude??Ve.lat)}if(Number.isFinite(_e.zoom))if(me._centerAltitude=_e.elevation??0,me.elevation){me._seaLevelZoom=_e.zoom;const Ve=me.pixelsPerMeter/me.worldSize*me._centerAltitude,Ye=me._mercatorZfromZoom(_e.zoom),at=me._mercatorZfromZoom(me._maxZoom),s=Math.max(Ye-Ve,at);me._setZoom(me._zoomFromMercatorZ(s))}else me._seaLevelZoom=null,me.zoom=_e.zoom;me._constrain=qe,me._calcMatrices=$e,me._unmodified||(me._constrain(),me._calcMatrices())}const u2=new Set(["_calcMatrices","_calcFogMatrices","_updateCameraState","_updateSeaLevelZoom"]);function h2(me){let _e=!1,qe={};const $e=me;let Ve=null;const Ye={get(at,s){return s==="$reactViewState"?qe:s==="$proposedTransform"?Ve:s==="$internalUpdate"?_e:s==="_setZoom"?zt=>{_e&&Ve?.[s](zt),Number.isFinite(qe.zoom)||$e[s](zt)}:(_e&&s==="_translateCameraConstrained"&&a2(qe)&&(Ve=Ve||$e.clone()),u2.has(s)?function(...zt){Ve?.[s](...zt),$e[s](...zt)}
2:_e&&Ve?Ve[s]:$e[s])},set(at,s,zt){if(s==="$reactViewState")return qe=zt,c2($e,qe),!0;if(s==="$proposedTransform")return Ve=zt,!0;if(s==="$internalUpdate")return _e=zt,!0;let wt=zt;return s==="center"||s==="_center"?(Number.isFinite(qe.longitude)||Number.isFinite(qe.latitude))&&(wt=new zt.constructor(qe.longitude??zt.lng,qe.latitude??zt.lat)):s==="zoom"||s==="_zoom"||s==="_seaLevelZoom"?Number.isFinite(qe.zoom)&&(wt=$e[s]):s==="_centerAltitude"?Number.isFinite(qe.elevation)&&(wt=$e[s]):s==="pitch"||s==="_pitch"?Number.isFinite(qe.pitch)&&(wt=$e[s]):(s==="bearing"||s==="rotation"||s==="angle")&&Number.isFinite(qe.bearing)&&(wt=$e[s]),_e&&wt!==zt&&(Ve=Ve||$e.clone()),_e&&Ve&&(Ve[s]=zt),$e[s]=wt,!0}};return new Proxy(me,Ye)}const d2=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function $0(me){if(!me)return null;if(typeof me=="string"||("toJS"in me&&(me=me.toJS()),!me.layers))return me;const _e={};for(const $e of me.layers)_e[$e.id]=$e;const qe=me.layers.map($e=>{let Ve=null;"interactive"in $e&&(Ve=Object.assign({},$e),delete Ve.interactive);const Ye=_e[$e.ref];if(Ye){Ve=Ve||Object.assign({},$e),delete Ve.ref;for(const at of d2)at in Ye&&(Ve[at]=Ye[at])}return Ve||$e});return{...me,layers:qe}}function f2(me,_e){const qe=Array.isArray(me)?me[0]:me?me.x:0,$e=Array.isArray(me)?me[1]:me?me.y:0,Ve=Array.isArray(_e)?_e[0]:_e?_e.x:0,Ye=Array.isArray(_e)?_e[1]:_e?_e.y:0;return qe===Ve&&$e===Ye}function Co(me,_e){if(me===_e)return!0;if(!me||!_e)return!1;if(Array.isArray(me)){if(!Array.isArray(_e)||me.length!==_e.length)return!1;for(let qe=0;qe<me.length;qe++)if(!Co(me[qe],_e[qe]))return!1;return!0}else if(Array.isArray(_e))return!1;if(typeof me=="object"&&typeof _e=="object"){const qe=Object.keys(me),$e=Object.keys(_e);if(qe.length!==$e.length)return!1;for(const Ve of qe)if(!_e.hasOwnProperty(Ve)||!Co(me[Ve],_e[Ve]))return!1;return!0}return!1}var Z0={};const W0={version:8,sources:{},layers:[]},X0={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"},Y0={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"},K0={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"},p2=["minZoom","maxZoom","minPitch","maxPitch","maxBounds","projection","renderWorldCopies"],m2=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"];class Du{constructor(_e,qe,$e){this._map=null,this._internalUpdate=!1,this._inRender=!1,this._hoveredFeatures=null,this._deferredEvents={move:!1,zoom:!1,pitch:!1,rotate:!1},this._onEvent=Ve=>{const Ye=this.props[K0[Ve.type]];Ye?Ye(Ve):Ve.type==="error"&&console.error(Ve.error)},this._onPointerEvent=Ve=>{(Ve.type==="mousemove"||Ve.type==="mouseout")&&this._updateHover(Ve);const Ye=this.props[X0[Ve.type]];Ye&&(this.props.interactiveLayerIds&&Ve.type!=="mouseover"&&Ve.type!=="mouseout"&&(Ve.features=this._hoveredFeatures||this._queryRenderedFeatures(Ve.point)),Ye(Ve),delete Ve.features)},this._onCameraEvent=Ve=>{if(!this._internalUpdate){const Ye=this.props[Y0[Ve.type]],at=this._proxyTransform;Ye&&(Ve.viewState=s2(at.$proposedTransform??at),Ye(Ve)),Ve.type==="moveend"&&(at.$proposedTransform=null)}Ve.type in this._deferredEvents&&(this._deferredEvents[Ve.type]=!1)},this._MapClass=_e,this.props=qe,this._initialize($e)}get map(){return this._map}get transform(){return this._map.transform}setProps(_e){const qe=this.props;this.props=_e;const $e=this._updateSettings(_e,qe);$e&&this._createProxyTransform(this._map);const Ve=this._updateSize(_e),Ye=this._updateViewState(_e,!0);this._updateStyle(_e,qe),this._updateStyleComponents(_e,qe),this._updateHandlers(_e,qe),($e||Ve||Ye&&!this._map.isMoving())&&this.redraw()}static reuse(_e,qe){const $e=Du.savedMaps.pop();if(!$e)return null;const Ve=$e.map,Ye=Ve.getContainer();for(qe.className=Ye.className;Ye.childNodes.length>0;)qe.appendChild(Ye.childNodes[0]);Ve._container=qe,$e.setProps({..._e,styleDiffing:!1}),Ve.resize();const{initialViewState:at}=_e;
2return at&&(at.bounds?Ve.fitBounds(at.bounds,{...at.fitBoundsOptions,duration:0}):$e._updateViewState(at,!1)),Ve.isStyleLoaded()?Ve.fire("load"):Ve.once("styledata",()=>Ve.fire("load")),Ve._update(),$e}_initialize(_e){const{props:qe}=this,{mapStyle:$e=W0}=qe,Ve={...qe,...qe.initialViewState,accessToken:qe.mapboxAccessToken||_2()||null,container:_e,style:$0($e)},Ye=Ve.initialViewState||Ve.viewState||Ve;if(Object.assign(Ve,{center:[Ye.longitude||0,Ye.latitude||0],zoom:Ye.zoom||0,pitch:Ye.pitch||0,bearing:Ye.bearing||0}),qe.gl){const Ht=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=Ht,qe.gl)}const at=new this._MapClass(Ve);Ye.padding&&at.setPadding(Ye.padding),qe.cursor&&(at.getCanvas().style.cursor=qe.cursor),this._createProxyTransform(at);const s=at._render;at._render=Ht=>{this._inRender=!0,s.call(at,Ht),this._inRender=!1};const zt=at._renderTaskQueue.run;at._renderTaskQueue.run=Ht=>{this._proxyTransform.$internalUpdate=!0,zt.call(at._renderTaskQueue,Ht),this._proxyTransform.$internalUpdate=!1,this._fireDefferedEvents()};const wt=at.jumpTo;at.jumpTo=(...Ht)=>(this._proxyTransform.$internalUpdate=!0,wt.apply(at,Ht),this._proxyTransform.$internalUpdate=!1,at);const Ui=at.fire;at.fire=this._fireEvent.bind(this,Ui),at.on("styledata",()=>{this._updateStyleComponents(this.props,{})}),at.on("sourcedata",()=>{this._updateStyleComponents(this.props,{})});for(const Ht in X0)at.on(Ht,this._onPointerEvent);for(const Ht in Y0)at.on(Ht,this._onCameraEvent);for(const Ht in K0)at.on(Ht,this._onEvent);this._map=at}recycle(){this.map.getContainer().querySelector("[mapboxgl-children]")?.remove(),Du.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){const _e=this._map;!this._inRender&&_e.style&&(_e._frame&&(_e._frame.cancel(),_e._frame=null),_e._render())}_createProxyTransform(_e){const qe=h2(_e.transform);_e.transform=qe,_e.painter.transform=qe,this._proxyTransform=qe}_updateSize(_e){const{viewState:qe}=_e;if(qe){const $e=this._map;if(qe.width!==$e.transform.width||qe.height!==$e.transform.height)return $e.resize(),!0}return!1}_updateViewState(_e,qe){const $e=_e.viewState||_e,Ve=this._proxyTransform,{zoom:Ye,pitch:at,bearing:s}=Ve,zt=l2(this._proxyTransform,$e);if(Ve.$reactViewState=$e,zt&&qe){const wt=this._deferredEvents;wt.move=!0,wt.zoom||(wt.zoom=Ye!==Ve.zoom),wt.rotate||(wt.rotate=s!==Ve.bearing),wt.pitch||(wt.pitch=at!==Ve.pitch)}return zt}_updateSettings(_e,qe){const $e=this._map;let Ve=!1;for(const Ye of p2)Ye in _e&&!Co(_e[Ye],qe[Ye])&&(Ve=!0,$e[`set${Ye[0].toUpperCase()}${Ye.slice(1)}`]?.call($e,_e[Ye]));return Ve}_updateStyle(_e,qe){if(_e.cursor!==qe.cursor&&(this._map.getCanvas().style.cursor=_e.cursor||""),_e.mapStyle!==qe.mapStyle){const{mapStyle:$e=W0,styleDiffing:Ve=!0}=_e,Ye={diff:Ve};return"localIdeographFontFamily"in _e&&(Ye.localIdeographFontFamily=_e.localIdeographFontFamily),this._map.setStyle($0($e),Ye),!0}return!1}_updateStyleComponents(_e,qe){const $e=this._map;let Ve=!1;return $e.isStyleLoaded()&&("light"in _e&&$e.setLight&&!Co(_e.light,qe.light)&&(Ve=!0,$e.setLight(_e.light)),"fog"in _e&&$e.setFog&&!Co(_e.fog,qe.fog)&&(Ve=!0,$e.setFog(_e.fog)),"terrain"in _e&&$e.setTerrain&&!Co(_e.terrain,qe.terrain)&&(!_e.terrain||$e.getSource(_e.terrain.source))&&(Ve=!0,$e.setTerrain(_e.terrain))),Ve}_updateHandlers(_e,qe){const $e=this._map;let Ve=!1;for(const Ye of m2){const at=_e[Ye]??!0,s=qe[Ye]??!0;Co(at,s)||(Ve=!0,at?$e[Ye].enable(at):$e[Ye].disable())}return Ve}_queryRenderedFeatures(_e){const qe=this._map,{interactiveLayerIds:$e=[]}=this.props;try{return qe.queryRenderedFeatures(_e,{layers:$e.filter(qe.getLayer.bind(qe))})}catch{return[]}}_updateHover(_e){const{props:qe}=this;if(qe.interactiveLayerIds&&(qe.onMouseMove||qe.onMouseEnter||qe.onMouseLeave)){const Ve=_e.type,Ye=this._hoveredFeatures?.length>0,at=this._queryRenderedFeatures(_e.point),s=at.length>0;!s&&Ye&&(_e.type="mouseleave",this._onPointerEvent(_e)),this._hoveredFeatures=at,s&&!Ye&&(_e.type="mouseenter",this._onPointerEvent(_e)),_e.type=Ve}else this._hoveredFeatures=null}_fireEvent(_e,qe,$e){const Ve=this._map,Ye=this._proxyTransform,at=Ye.$internalUpdate;try{Ye.$internalUpdate=!1,_e.call(Ve,qe,$e)}finally{Ye.$internalUpdate=at}return Ve}_fireDefferedEvents(){const _e=this._map;this._internalUpdate=!0;for(const qe in this._deferredEvents)this._deferredEvents[qe]&&_e.fire(qe);this._internalUpdate=!1}}Du.savedMaps=[];function _2(){let me=null;if(typeof location<"u"){const _e=/access_token=([^&\/]*)/.exec(location.search);me=_e&&_e[1]}try{me=me||Z0.MapboxAccessToken}catch{}try{me=me||Z0.REACT_APP_MAPBOX_ACCESS_TOKEN}catch{}return me}
2const g2=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];function y2(me){if(!me)return null;const _e=me.map,qe={getMap:()=>_e,getCenter:()=>me.transform.center,getZoom:()=>me.transform.zoom,getBearing:()=>me.transform.bearing,getPitch:()=>me.transform.pitch,getPadding:()=>me.transform.padding,getBounds:()=>me.transform.getBounds(),project:$e=>{const Ve=_e.transform;_e.transform=me.transform;const Ye=_e.project($e);return _e.transform=Ve,Ye},unproject:$e=>{const Ve=_e.transform;_e.transform=me.transform;const Ye=_e.unproject($e);return _e.transform=Ve,Ye},queryTerrainElevation:($e,Ve)=>{const Ye=_e.transform;_e.transform=me.transform;const at=_e.queryTerrainElevation($e,Ve);return _e.transform=Ye,at},queryRenderedFeatures:($e,Ve)=>{const Ye=_e.transform;_e.transform=me.transform;const at=_e.queryRenderedFeatures($e,Ve);return _e.transform=Ye,at}};for(const $e of x2(_e))!($e in qe)&&!g2.includes($e)&&(qe[$e]=_e[$e].bind(_e));return qe}function x2(me){const _e=new Set;let qe=me;for(;qe;){for(const $e of Object.getOwnPropertyNames(qe))$e[0]!=="_"&&typeof me[$e]=="function"&&$e!=="fire"&&$e!=="setEventedParent"&&_e.add($e);qe=Object.getPrototypeOf(qe)}return Array.from(_e)}const v2=typeof document<"u"?Bt.useLayoutEffect:Bt.useEffect,b2=["baseApiUrl","maxParallelImageRequests","workerClass","workerCount","workerUrl"];function w2(me,_e){for(const $e of b2)$e in _e&&(me[$e]=_e[$e]);const{RTLTextPlugin:qe="https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js"}=_e;qe&&me.getRTLTextPluginStatus&&me.getRTLTextPluginStatus()==="unavailable"&&me.setRTLTextPlugin(qe,$e=>{$e&&console.error($e)},!0)}const Lu=Bt.createContext(null);
2function T2(me,_e){const qe=Bt.useContext(o2),[$e,Ve]=Bt.useState(null),Ye=Bt.useRef(),{current:at}=Bt.useRef({mapLib:null,map:null});Bt.useEffect(()=>{const wt=me.mapLib;let Ui=!0,Ht;return Promise.resolve(wt||n2(()=>import("./mapbox-gl-ECfj-Tyj.js").then(Yi=>Yi.m),__vite__mapDeps([0,1]))).then(Yi=>{if(!Ui)return;if(!Yi)throw new Error("Invalid mapLib");const lr="Map"in Yi?Yi:Yi.default;if(!lr.Map)throw new Error("Invalid mapLib");w2(lr,me),me.reuseMaps&&(Ht=Du.reuse(me,Ye.current)),Ht||(Ht=new Du(lr.Map,me,Ye.current)),at.map=y2(Ht),at.mapLib=lr,Ve(Ht),qe?.onMapMount(at.map,me.id)}).catch(Yi=>{const{onError:lr}=me;lr?lr({type:"error",target:null,error:Yi}):console.error(Yi)}),()=>{Ui=!1,Ht&&(qe?.onMapUnmount(me.id),me.reuseMaps?Ht.recycle():Ht.destroy())}},[]),v2(()=>{$e&&$e.setProps(me)}),Bt.useImperativeHandle(_e,()=>at.map,[$e]);const s=Bt.useMemo(()=>({position:"relative",width:"100%",height:"100%",...me.style}),[me.style]),zt={height:"100%"};return Bt.createElement("div",{id:me.id,ref:Ye,style:s},$e&&Bt.createElement(Lu.Provider,{value:at},Bt.createElement("div",{"mapboxgl-children":"",style:zt},me.children)))}const N2=Bt.forwardRef(T2),S2=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function ac(me,_e){if(!me||!_e)return;const qe=me.style;for(const $e in _e){const Ve=_e[$e];Number.isFinite(Ve)&&!S2.test($e)?qe[$e]=`${Ve}px`:qe[$e]=Ve}}function t1(me,_e){if(me===_e)return null;const qe=J0(me),$e=J0(_e),Ve=[];for(const Ye of $e)qe.has(Ye)||Ve.push(Ye);for(const Ye of qe)$e.has(Ye)||Ve.push(Ye);return Ve.length===0?null:Ve}function J0(me){return new Set(me?me.trim().split(/\s+/):[])}const V2=Bt.memo(Bt.forwardRef((me,_e)=>{const{map:qe,mapLib:$e}=Bt.useContext(Lu),Ve=Bt.useRef({props:me}),Ye=Bt.useMemo(()=>{let $r=!1;Bt.Children.forEach(me.children,Ji=>{Ji&&($r=!0)});const Ii={...me,element:$r?document.createElement("div"):null},_r=new $e.Marker(Ii);return _r.setLngLat([me.longitude,me.latitude]),_r.getElement().addEventListener("click",Ji=>{Ve.current.props.onClick?.({type:"click",target:_r,originalEvent:Ji})}),_r.on("dragstart",Ji=>{const Lr=Ji;Lr.lngLat=Ye.getLngLat(),Ve.current.props.onDragStart?.(Lr)}),_r.on("drag",Ji=>{const Lr=Ji;Lr.lngLat=Ye.getLngLat(),Ve.current.props.onDrag?.(Lr)}),_r.on("dragend",Ji=>{const Lr=Ji;Lr.lngLat=Ye.getLngLat(),Ve.current.props.onDragEnd?.(Lr)}),_r},[]);Bt.useEffect(()=>(Ye.addTo(qe.getMap()),()=>{Ye.remove()}),[]);const{longitude:at,latitude:s,offset:zt,style:wt,draggable:Ui=!1,popup:Ht=null,rotation:Yi=0,rotationAlignment:lr="auto",pitchAlignment:Hn="auto"}=me;Bt.useEffect(()=>{ac(Ye.getElement(),wt)},[wt]),Bt.useImperativeHandle(_e,()=>Ye,[]);const ni=Ve.current.props;(Ye.getLngLat().lng!==at||Ye.getLngLat().lat!==s)&&Ye.setLngLat([at,s]),zt&&!f2(Ye.getOffset(),zt)&&Ye.setOffset(zt),Ye.isDraggable()!==Ui&&Ye.setDraggable(Ui),Ye.getRotation()!==Yi&&Ye.setRotation(Yi),Ye.getRotationAlignment()!==lr&&Ye.setRotationAlignment(lr),Ye.getPitchAlignment()!==Hn&&Ye.setPitchAlignment(Hn),Ye.getPopup()!==Ht&&Ye.setPopup(Ht);const Ei=t1(ni.className,me.className);if(Ei)for(const $r of Ei)Ye.toggleClassName($r);return Ve.current.props=me,e1.createPortal(me.children,Ye.getElement())})),U2=Bt.memo(Bt.forwardRef((me,_e)=>{const{map:qe,mapLib:$e}=Bt.useContext(Lu),Ve=Bt.useMemo(()=>document.createElement("div"),[]),Ye=Bt.useRef({props:me}),at=Bt.useMemo(()=>{const s={...me},zt=new $e.Popup(s);return zt.setLngLat([me.longitude,me.latitude]),zt.once("open",wt=>{Ye.current.props.onOpen?.(wt)}),zt},[]);if(Bt.useEffect(()=>{const s=zt=>{Ye.current.props.onClose?.(zt)};return at.on("close",s),at.setDOMContent(Ve).addTo(qe.getMap()),()=>
2{at.off("close",s),at.isOpen()&&at.remove()}},[]),Bt.useEffect(()=>{ac(at.getElement(),me.style)},[me.style]),Bt.useImperativeHandle(_e,()=>at,[]),at.isOpen()){const s=Ye.current.props;(at.getLngLat().lng!==me.longitude||at.getLngLat().lat!==me.latitude)&&at.setLngLat([me.longitude,me.latitude]),me.offset&&!Co(s.offset,me.offset)&&(at.options.anchor=me.anchor,at.setOffset(me.offset)),(s.anchor!==me.anchor||s.maxWidth!==me.maxWidth)&&at.setMaxWidth(me.maxWidth);const zt=t1(s.className,me.className);if(zt)for(const wt of zt)at.toggleClassName(wt);Ye.current.props=me}return e1.createPortal(me.children,Ve)}));function Wd(me,_e,qe,$e){const Ve=Bt.useContext(Lu),Ye=Bt.useMemo(()=>me(Ve),[]);return Bt.useEffect(()=>{const at=_e,s=null,zt=typeof _e=="function"?_e:null,{map:wt}=Ve;return wt.hasControl(Ye)||(wt.addControl(Ye,at?.position),s&&s(Ve)),()=>{zt&&zt(Ve),wt.hasControl(Ye)&&wt.removeControl(Ye)}},[]),Ye}function E2(me){const _e=Wd(({mapLib:qe})=>new qe.AttributionControl(me),{position:me.position});return Bt.useEffect(()=>{ac(_e._container,me.style)},[me.style]),null}Bt.memo(E2);function I2(me){const _e=Wd(({mapLib:qe})=>new qe.FullscreenControl({container:me.containerId&&document.getElementById(me.containerId)}),{position:me.position});return Bt.useEffect(()=>{ac(_e._controlContainer,me.style)},[me.style]),null}Bt.memo(I2);
2function A2(me,_e){const qe=Bt.useRef({props:me}),$e=Wd(({mapLib:Ve})=>{const Ye=new Ve.GeolocateControl(me),at=Ye._setupUI.bind(Ye);return Ye._setupUI=s=>{Ye._container.hasChildNodes()||at(s)},Ye.on("geolocate",s=>{qe.current.props.onGeolocate?.(s)}),Ye.on("error",s=>{qe.current.props.onError?.(s)}),Ye.on("outofmaxbounds",s=>{qe.current.props.onOutOfMaxBounds?.(s)}),Ye.on("trackuserlocationstart",s=>{qe.current.props.onTrackUserLocationStart?.(s)}),Ye.on("trackuserlocationend",s=>{qe.current.props.onTrackUserLocationEnd?.(s)}),Ye},{position:me.position});return qe.current.props=me,Bt.useImperativeHandle(_e,()=>$e,[]),Bt.useEffect(()=>{ac($e._container,me.style)},[me.style]),null}Bt.memo(Bt.forwardRef(A2));function M2(me){const _e=Wd(({mapLib:qe})=>new qe.NavigationControl(me),{position:me.position});return Bt.useEffect(()=>{ac(_e._container,me.style)},[me.style]),null}const j2=Bt.memo(M2);function C2(me){const _e=Wd(({mapLib:Ye})=>new Ye.ScaleControl(me),{position:me.position}),qe=Bt.useRef(me),$e=qe.current;qe.current=me;const{style:Ve}=me;return me.maxWidth!==void 0&&me.maxWidth!==$e.maxWidth&&(_e.options.maxWidth=me.maxWidth),me.unit!==void 0&&me.unit!==$e.unit&&_e.setUnit(me.unit),Bt.useEffect(()=>{ac(_e._container,Ve)},[Ve]),null}Bt.memo(C2);function vm(me,_e){if(!me)throw new Error(_e)}let P2=0;function R2(me,_e,qe){if(me.style&&me.style._loaded){const $e={...qe};return delete $e.id,delete $e.children,me.addSource(_e,$e),me.getSource(_e)}return null}function z2(me,_e,qe){vm(_e.id===qe.id,"source id changed"),vm(_e.type===qe.type,"source type changed");let $e="",Ve=0;for(const at in _e)at!=="children"&&at!=="id"&&!Co(qe[at],_e[at])&&($e=at,Ve++);if(!Ve)return;const Ye=_e.type;Ye==="geojson"?me.setData(_e.data):Ye==="image"?me.updateImage({url:_e.url,coordinates:_e.coordinates}):"setCoordinates"in me&&Ve===1&&$e==="coordinates"?me.setCoordinates(_e.coordinates):"setUrl"in me&&$e==="url"?me.setUrl(_e.url):"setTiles"in me&&$e==="tiles"?me.setTiles(_e.tiles):console.warn(`Unable to update <Source> prop: ${$e}`)}function G2(me){const _e=Bt.useContext(Lu).map.getMap(),qe=Bt.useRef(me),[,$e]=Bt.useState(0),Ve=Bt.useMemo(()=>me.id||`jsx-source-${P2++}`,[]);Bt.useEffect(()=>{if(_e){const at=()=>setTimeout(()=>$e(s=>s+1),0);return _e.on("styledata",at),at(),()=>{if(_e.off("styledata",at),_e.style&&_e.style._loaded&&_e.getSource(Ve)){const s=_e.getStyle()?.layers;if(s)for(const zt of s)zt.source===Ve&&_e.removeLayer(zt.id);_e.removeSource(Ve)}}}},[_e]);let Ye=_e&&_e.style&&_e.getSource(Ve);return Ye?z2(Ye,me,qe.current):Ye=R2(_e,Ve,me),qe.current=me,Ye&&Bt.Children.map(me.children,at=>at&&Bt.cloneElement(at,{source:Ve}))||null}function D2(me,_e,qe,$e){if(vm(qe.id===$e.id,"layer id changed"),vm(qe.type===$e.type,"layer type changed"),qe.type==="custom"||$e.type==="custom")return;const{layout:Ve={},paint:Ye={},filter:at,minzoom:s,maxzoom:zt,beforeId:wt}=qe;if(wt!==$e.beforeId&&me.moveLayer(_e,wt),Ve!==$e.layout){const Ui=$e.layout||{};for(const Ht in Ve)Co(Ve[Ht],Ui[Ht])||me.setLayoutProperty(_e,Ht,Ve[Ht]);for(const Ht in Ui)Ve.hasOwnProperty(Ht)||me.setLayoutProperty(_e,Ht,void 0)}if(Ye!==$e.paint){const Ui=$e.paint||{};for(const Ht in Ye)Co(Ye[Ht],Ui[Ht])||me.setPaintProperty(_e,Ht,Ye[Ht]);for(const Ht in Ui)Ye.hasOwnProperty(Ht)||me.setPaintProperty(_e,Ht,void 0)}Co(at,$e.filter)||me.setFilter(_e,at),(s!==$e.minzoom||zt!==$e.maxzoom)&&me.setLayerZoomRange(_e,s,zt)}function L2(me,_e,qe){if(me.style&&me.style._loaded&&(!("source"in qe)||me.getSource(qe.source))){const $e={...qe,id:_e};delete $e.beforeId,me.addLayer($e,qe.beforeId)}}let F2=0;function q2(me){const _e=Bt.useContext(Lu).map.getMap(),qe=Bt.useRef(me),[,$e]=Bt.useState(0),Ve=Bt.useMemo(()=>me.id||`jsx-layer-${F2++}`,[]);if(Bt.useEffect(()=>{if(_e){const at=()=>$e(s=>s+1);return _e.on("styledata",at),at(),()=>{_e.off("styledata",at),_e.style&&_e.style._loaded&&_e.getLayer(Ve)&&_e.removeLayer(Ve)}}},[_e]),_e&&_e.style&&_e.getLayer(Ve))try{D2(_e,Ve,me,qe.current)}catch(at){console.warn(at)}else L2(_e,Ve,me);return qe.current=me,null}var xm={exports:{}},O2=xm.exports,Q0;function H2(){return Q0||(Q0=1,(function(me,_e){(function(qe,$e){me.exports=$e()})(O2,(function(){var qe,$e,Ve;function Ye(s,zt){if(!qe)qe=zt;else if(!$e)$e=zt;else{var wt="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+qe+")(sharedChunk); ("+$e+")(sharedChunk); self.onerror = null;",Ui={};qe(Ui),Ve=zt(Ui),typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(Ve.workerUrl=window.URL.createObjectURL(new Blob([wt],{type:"text/javascript"})))}}Ye(["exports"],function(s){var zt=1e-6,wt=typeof Float32Array<"u"?Float32Array:Array;function Ui(r,e){var i=e[0],n=e[1],a=e[2],u=e[3],h=i*u-a*n;return h?(r[0]=u*(h=1/h),r[1]=-n*h,r[2]=-a*h,r[3]=i*h,r):null}function Ht(){var r=new wt(9);
vendor: 1,616 bytes, line 2
2return wt!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function Yi(r,e){var i=e[0],n=e[1],a=e[2],u=e[3],h=e[4],f=e[5],_=e[6],g=e[7],v=e[8];return r[0]=h*v-f*g,r[1]=a*g-n*v,r[2]=n*f-a*h,r[3]=f*_-u*v,r[4]=i*v-a*_,r[5]=a*u-i*f,r[6]=u*g-h*_,r[7]=n*_-i*g,r[8]=i*h-n*u,r}function lr(r,e,i){var n=e[0],a=e[1],u=e[2],h=e[3],f=e[4],_=e[5],g=e[6],v=e[7],b=e[8],w=i[0],E=i[1],I=i[2],P=i[3],D=i[4],R=i[5],F=i[6],B=i[7],V=i[8];return r[0]=w*n+E*h+I*g,r[1]=w*a+E*f+I*v,r[2]=w*u+E*_+I*b,r[3]=P*n+D*h+R*g,r[4]=P*a+D*f+R*v,r[5]=P*u+D*_+R*b,r[6]=F*n+B*h+V*g,r[7]=F*a+B*f+V*v,r[8]=F*u+B*_+V*b,r}function Hn(){var r=new wt(16);return wt!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0),r[0]=1,r[5]=1,r[10]=1,r[15]=1,r}function ni(r){var e=new wt(16);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15],e}function Ei(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function $r(r,e){var i=e[0],n=e[1],a=e[2],u=e[3],h=e[4],f=e[5],_=e[6],g=e[7],v=e[8],b=e[9],w=e[10],E=e[11],I=e[12],P=e[13],D=e[14],R=e[15],F=i*f-n*h,B=i*_-a*h,V=i*g-u*h,$=n*_-a*f,H=n*g-u*f,J=a*g-u*_,ee=v*P-b*I,K=v*D-w*I,re=v*R-E*I,se=b*D-w*P,Ee=b*R-E*P,we=w*R-E*D,Se=F*we-B*Ee+V*se+$*re-H*K+J*ee;return Se?(r[0]=(f*we-_*Ee+g*se)*(Se=1/Se),r[1]=(a*Ee-n*we-u*se)*Se,r[2]=(P*J-D*H+R*$)*Se,r[3]=(w*H-b*J-E*$)*Se,r[4]=(_*re-h*we-g*K)*Se,r[5]=(i*we-a*re+u*K)*Se,r[6]=(D*V-I*J-
vendor: 5,745 bytes, line 2
2R*B)*Se,r[7]=(v*J-w*V+E*B)*Se,r[8]=(h*Ee-f*re+g*ee)*Se,r[9]=(n*re-i*Ee-u*ee)*Se,r[10]=(I*H-P*V+R*F)*Se,r[11]=(b*V-v*H-E*F)*Se,r[12]=(f*K-h*se-_*ee)*Se,r[13]=(i*se-n*K+a*ee)*Se,r[14]=(P*B-I*$-D*F)*Se,r[15]=(v*$-b*B+w*F)*Se,r):null}function Ii(r,e,i){var n=e[0],a=e[1],u=e[2],h=e[3],f=e[4],_=e[5],g=e[6],v=e[7],b=e[8],w=e[9],E=e[10],I=e[11],P=e[12],D=e[13],R=e[14],F=e[15],B=i[0],V=i[1],$=i[2],H=i[3];return r[0]=B*n+V*f+$*b+H*P,r[1]=B*a+V*_+$*w+H*D,r[2]=B*u+V*g+$*E+H*R,r[3]=B*h+V*v+$*I+H*F,r[4]=(B=i[4])*n+(V=i[5])*f+($=i[6])*b+(H=i[7])*P,r[5]=B*a+V*_+$*w+H*D,r[6]=B*u+V*g+$*E+H*R,r[7]=B*h+V*v+$*I+H*F,r[8]=(B=i[8])*n+(V=i[9])*f+($=i[10])*b+(H=i[11])*P,r[9]=B*a+V*_+$*w+H*D,r[10]=B*u+V*g+$*E+H*R,r[11]=B*h+V*v+$*I+H*F,r[12]=(B=i[12])*n+(V=i[13])*f+($=i[14])*b+(H=i[15])*P,r[13]=B*a+V*_+$*w+H*D,r[14]=B*u+V*g+$*E+H*R,r[15]=B*h+V*v+$*I+H*F,r}function _r(r,e,i){var n,a,u,h,f,_,g,v,b,w,E,I,P=i[0],D=i[1],R=i[2];return e===r?(r[12]=e[0]*P+e[4]*D+e[8]*R+e[12],r[13]=e[1]*P+e[5]*D+e[9]*R+e[13],r[14]=e[2]*P+e[6]*D+e[10]*R+e[14],r[15]=e[3]*P+e[7]*D+e[11]*R+e[15]):(a=e[1],u=e[2],h=e[3],f=e[4],_=e[5],g=e[6],v=e[7],b=e[8],w=e[9],E=e[10],I=e[11],r[0]=n=e[0],r[1]=a,r[2]=u,r[3]=h,r[4]=f,r[5]=_,r[6]=g,r[7]=v,r[8]=b,r[9]=w,r[10]=E,r[11]=I,r[12]=n*P+f*D+b*R+e[12],r[13]=a*P+_*D+w*R+e[13],r[14]=u*P+g*D+E*R+e[14],r[15]=h*P+v*D+I*R+e[15]),r}function Ji(r,e,i){var n=i[0],a=i[1],u=i[2];return r[0]=e[0]*n,r[1]=e[1]*n,r[2]=e[2]*n,r[3]=e[3]*n,r[4]=e[4]*a,r[5]=e[5]*a,r[6]=e[6]*a,r[7]=e[7]*a,r[8]=e[8]*u,r[9]=e[9]*u,r[10]=e[10]*u,r[11]=e[11]*u,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r}function Lr(r,e,i){var n=Math.sin(i),a=Math.cos(i),u=e[4],h=e[5],f=e[6],_=e[7],g=e[8],v=e[9],b=e[10],w=e[11];return e!==r&&(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[4]=u*a+g*n,r[5]=h*a+v*n,r[6]=f*a+b*n,r[7]=_*a+w*n,r[8]=g*a-u*n,r[9]=v*a-h*n,r[10]=b*a-f*n,r[11]=w*a-_*n,r}function Jn(r,e,i){var n=Math.sin(i),a=Math.cos(i),u=e[0],h=e[1],f=e[2],_=e[3],g=e[8],v=e[9],b=e[10],w=e[11];return e!==r&&(r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=u*a-g*n,r[1]=h*a-v*n,r[2]=f*a-b*n,r[3]=_*a-w*n,r[8]=u*n+g*a,r[9]=h*n+v*a,r[10]=f*n+b*a,r[11]=_*n+w*a,r}function Qn(r,e,i){var n=Math.sin(i),a=Math.cos(i),u=e[0],h=e[1],f=e[2],_=e[3],g=e[4],v=e[5],b=e[6],w=e[7];return e!==r&&(r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=u*a+g*n,r[1]=h*a+v*n,r[2]=f*a+b*n,r[3]=_*a+w*n,r[4]=g*a-u*n,r[5]=v*a-h*n,r[6]=b*a-f*n,r[7]=w*a-_*n,r}function uo(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=e[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=e[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function Ls(r,e,i){var n,a,u,h=i[0],f=i[1],_=i[2],g=Math.sqrt(h*h+f*f+_*_);return g<zt?null:(h*=g=1/g,f*=g,_*=g,n=Math.sin(e),a=Math.cos(e),r[0]=h*h*(u=1-a)+a,r[1]=f*h*u+_*n,r[2]=_*h*u-f*n,r[3]=0,r[4]=h*f*u-_*n,r[5]=f*f*u+a,r[6]=_*f*u+h*n,r[7]=0,r[8]=h*_*u+f*n,r[9]=f*_*u-h*n,r[10]=_*_*u+a,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r)}function tl(r,e){var i=e[0],n=e[1],a=e[2],u=e[4],h=e[5],f=e[6],_=e[8],g=e[9],v=e[10];return r[0]=Math.sqrt(i*i+n*n+a*a),r[1]=Math.sqrt(u*u+h*h+f*f),r[2]=Math.sqrt(_*_+g*g+v*v),r}function il(r,e){var i=e[0],n=e[1],a=e[2],u=e[3],h=i+i,f=n+n,_=a+a,g=i*h,v=n*h,b=n*f,w=a*h,E=a*f,I=a*_,P=u*h,D=u*f,R=u*_;return r[0]=1-b-I,r[1]=v+R,r[2]=w-D,r[3]=0,r[4]=v-R,r[5]=1-g-I,r[6]=E+P,r[7]=0,r[8]=w+D,r[9]=E-P,r[10]=1-g-b,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}var rl=Ii;function li(){var r=new wt(3);return wt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function lc(r){var e=new wt(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e}function gn(r){var e=r[0],i=r[1],n=r[2];return Math.sqrt(e*e+i*i+n*n)}function xi(r,e,i){var n=new wt(3);return n[0]=r,n[1]=e,n[2]=i,n}function wi(r,e,i,n){return r[0]=e,r[1]=i,r[2]=n,r}function nr(r,e,i){return r[0]=e[0]+i[0],r[1]=e[1]+i[1],r[2]=e[2]+i[2],r}function ho(r,e,i){return r[0]=e[0]-i[0],r[1]=e[1]-i[1],r[2]=e[2]-i[2],r}function eo(r,e,i){return r[0]=e[0]*i[0],r[1]=e[1]*i[1],r[2]=e[2]*i[2],r}function fo(r,e,i){return r[0]=Math.min(e[0],i[0]),r[1]=Math.min(e[1],i[1]),r[2]=Math.min(e[2],i[2]),r}function to(r,e,i){return r[0]=Math.max(e[0],i[0]),r[1]=Math.max(e[1],i[1]),r[2]=Math.max(e[2],i[2]),r}function ki(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r}function Mn(r,e,i,n){return r[0]=e[0]+i[0]*n,r[1]=e[1]+i[1]*n,r[2]=e[2]+i[2]*n,r}function cc(r,e){var i=e[0]-r[0],n=e[1]-r[1],a=e[2]-r[2];return Math.sqrt(i*i+n*n+a*a)}function nl(r,e){var i=e[0]-r[0],n=e[1]-r[1],a=e[2]-r[2];return i*i+n*n+a*a}function uc(r){var e=r[0],i=r[1],n=r[2];return e*e+i*i+n*n}function Qo(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r}function mi(r,e){var i=e[0],n=e[1],a=e[2],u=i*i+n*n+a*a;return u>0&&(u=1/Math.sqrt(u)),r[0]=e[0]*u,r[1]=e[1]*u,r[2]=e[2]*u,r}function Gi(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]}function Fr(r,e,i){var n=e[0],a=e[1],u=e[2],h=i[0],f=i[1],_=i[2];return r[0]=a*_-u*f,r[1]=u*h-n*_,r[2]=n*f-a*h,r}function Fs(r,e,i,n){var a=e[0],u=e[1],h=e[2];return r[0]=a+n*(i[0]-a),r[1]=u+n*(i[1]-u),r[2]=h+n*(i[2]-h),r}function Qi(r,e,i){var n=e[0],a=e[1],u=e[2],h=i[3]*n+i[7]*a+i[11]*u+i[15];return r[0]=(i[0]*n+i[4]*a+i[8]*u+i[12])/(h=h||1),r[1]=(i[1]*n+i[5]*a+i[9]*u+i[13])/h,r[2]=(i[2]*n+i[6]*a+i[10]*u+i[14])/h,r}function es(r,e,i){var n=e[0],a=e[1],u=e[2];return r[0]=n*i[0]+a*i[3]+u*i[6],r[1]=n*i[1]+a*i[4]+u*i[7],r[2]=n*i[2]+a*i[5]+u*i[8],r}function ts(r,e,i){var n=i[0],a=i[1],u=i[2],h=i[3],f=e[0],_=e[1],g=e[2],v=a*g-u*_,b=u*f-n*g,w=n*_-a*f;return r[0]=f+h*(v+=v)+a*(w+=w)-u*(b+=b),r[1]=_+h*b+u*v-n*w,r[2]=g+h*w+n*b-a*v,r}function Os(r){return r[0]=0,r[1]=0,r[2]=0,r}function io(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]}var tr=ho,la=eo,is=gn;function ca(){var r=new wt(4);
2return wt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0,r[3]=0),r}function ks(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r[3]=e[3]*i,r}function ol(r,e){var i=e[0],n=e[1],a=e[2],u=e[3],h=i*i+n*n+a*a+u*u;return h>0&&(h=1/Math.sqrt(h)),r[0]=i*h,r[1]=n*h,r[2]=a*h,r[3]=u*h,r}function yn(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]+r[3]*e[3]}function an(r,e,i){var n=e[0],a=e[1],u=e[2],h=e[3];return r[0]=i[0]*n+i[4]*a+i[8]*u+i[12]*h,r[1]=i[1]*n+i[5]*a+i[9]*u+i[13]*h,r[2]=i[2]*n+i[6]*a+i[10]*u+i[14]*h,r[3]=i[3]*n+i[7]*a+i[11]*u+i[15]*h,r}function Po(){var r=new wt(4);return wt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function Ro(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=1,r}function rs(r,e,i){i*=.5;var n=e[0],a=e[1],u=e[2],h=e[3],f=Math.sin(i),_=Math.cos(i);return r[0]=n*_+h*f,r[1]=a*_+u*f,r[2]=u*_-a*f,r[3]=h*_-n*f,r}function Bs(r,e,i){i*=.5;var n=e[0],a=e[1],u=e[2],h=e[3],f=Math.sin(i),_=Math.cos(i);return r[0]=n*_-u*f,r[1]=a*_+h*f,r[2]=u*_+n*f,r[3]=h*_-a*f,r}li(),ca();var Zr,ua,Cn,sl=ol,zo=(Zr=li(),ua=xi(1,0,0),Cn=xi(0,1,0),function(r,e,i){var n=Gi(e,i);return n<-.999999?(Fr(Zr,ua,e),is(Zr)<1e-6&&Fr(Zr,Cn,e),mi(Zr,Zr),(function(a,u,h){h*=.5;var f=Math.sin(h);a[0]=f*u[0],a[1]=f*u[1],a[2]=f*u[2],a[3]=Math.cos(h)})(r,Zr,Math.PI),r):n>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(Fr(Zr,e,i),r[0]=Zr[0],r[1]=Zr[1],r[2]=Zr[2],r[3]=1+n,sl(r,r))});function Or(){var r=new wt(2);return wt!=Float32Array&&(r[0]=0,r[1]=0),r}function Do(r,e){var i=new wt(2);return i[0]=r,i[1]=e,i}function Lo(r,e,i){return r[0]=e,r[1]=i,r}function ns(r,e,i){return r[0]=e[0]+i[0],r[1]=e[1]+i[1],r}function Fo(r,e,i){return r[0]=e[0]-i[0],r[1]=e[1]-i[1],r}function os(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r}function ss(r){var e=r[0],i=r[1];return Math.sqrt(e*e+i*i)}function ha(r,e){var i=e[0],n=e[1],a=i*i+n*n;return a>0&&(a=1/Math.sqrt(a)),r[0]=e[0]*a,r[1]=e[1]*a,r}function Ai(r,e){return r[0]*e[0]+r[1]*e[1]}Po(),Po(),Ht();var Rr,hc,da=Fo;function Pn(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}Or();var Fu=(function(){if(hc)return Rr;function r(e,i,n,a){this.cx=3*e,this.bx=3*(n-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(a-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=n,this.p2y=a}return hc=1,Rr=r,r.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,i){if(i===void 0&&(i=1e-6),e<0)return 0;if(e>1)return 1;for(var n=e,a=0;a<8;a++){var u=this.sampleCurveX(n)-e;if(Math.abs(u)<i)return n;var h=this.sampleCurveDerivativeX(n);if(Math.abs(h)<1e-6)break;n-=u/h}var f=0,_=1;for(n=e,a=0;a<20&&(u=this.sampleCurveX(n),!(Math.abs(u-e)<i));a++)e>u?f=n:_=n,n=.5*(_-f)+f;return n},solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},Rr})(),fa=Pn(Fu);function Be(r,e){this.x=r,this.y=e}function Oo(r,e){if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let i=0;i<r.length;i++)if(!Oo(r[i],e[i]))return!1;return!0}if(typeof r=="object"&&r!==null&&e!==null){if(typeof e!="object"||Object.keys(r).length!==Object.keys(e).length)return!1;for(const i in r)if(!Oo(r[i],e[i]))return!1;return!0}return r===e}Be.prototype={clone(){return new Be(this.x,this.y)},add(r){return this.clone()._add(r)},sub(r){return this.clone()._sub(r)},multByPoint(r){return this.clone()._multByPoint(r)},divByPoint(r){return this.clone()._divByPoint(r)},mult(r){return this.clone()._mult(r)},div(r){return this.clone()._div(r)},rotate(r){return this.clone()._rotate(r)},rotateAround(r,e){return this.clone()._rotateAround(r,e)},matMult(r){return this.clone()._matMult(r)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(r){return this.x===r.x&&this.y===r.y},dist(r){return Math.sqrt(this.distSqr(r))},distSqr(r){const e=r.x-this.x,i=r.y-this.y;return e*e+i*i},angle(){return Math.atan2(this.y,this.x)},angleTo(r){return Math.atan2(this.y-r.y,this.x-r.x)},angleWith(r){return this.angleWithSep(r.x,r.y)},angleWithSep(r,e){return Math.atan2(this.x*e-this.y*r,this.x*r+this.y*e)},_matMult(r){const e=r[2]*this.x+r[3]*this.y;return this.x=r[0]*this.x+r[1]*this.y,this.y=e,this},_add(r){return this.x+=r.x,this.y+=r.y,this},_sub(r){return this.x-=r.x,this.y-=r.y,this},_mult(r){return this.x*=r,this.y*=r,this},_div(r){return this.x/=r,this.y/=r,this},_multByPoint(r){return this.x*=r.x,this.y*=r.y,this},_divByPoint(r){return this.x/=r.x,this.y/=r.y,this},_unit(){return this._div(this.mag()),this},_perp(){const r=this.y;return this.y=this.x,this.x=-r,this},_rotate(r){const e=Math.cos(r),i=Math.sin(r),n=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=n,this}
2,_rotateAround(r,e){const i=Math.cos(r),n=Math.sin(r),a=e.y+n*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-n*(this.y-e.y),this.y=a,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:Be},Be.convert=function(r){if(r instanceof Be)return r;if(Array.isArray(r))return new Be(+r[0],+r[1]);if(r.x!==void 0&&r.y!==void 0)return new Be(+r.x,+r.y);throw new Error("Expected [x, y] or {x, y} point format")};const Ou=Math.PI/180,al=180/Math.PI;function $t(r){return r*Ou}function he(r){return r*al}const k=[[0,0],[1,0],[1,1],[0,1]];function U(r){if(r<=0)return 0;if(r>=1)return 1;const e=r*r,i=e*r;return 4*(r<.5?i:3*(r-e)+i-.75)}function W(r,e,i,n){const a=new fa(r,e,i,n);return function(u){return a.solve(u)}}const ae=W(.25,.1,.25,1);function Y(r,e,i){return Math.min(i,Math.max(e,r))}function le(r,e,i){return(i=Y((i-r)/(e-r),0,1))*i*(3-2*i)}function xe(r,e,i){const n=i-e,a=((r-e)%n+n)%n+e;return a===e?i:a}function ue(r,e,i){if(!r.length)return i(null,[]);let n=r.length;const a=new Array(r.length);let u=null;r.forEach((h,f)=>{e(h,(_,g)=>{_&&(u=_),a[f]=g,--n===0&&i(u,a)})})}let Te=1;function Ne(){return Te++}function Oe(r){return r<=1?1:Math.pow(2,Math.ceil(Math.log2(r)))}function rt(r,e){r.forEach(i=>{e[i]&&(e[i]=e[i].bind(e))})}function ft(r,e,i){const n={};for(const a in r)n[a]=e.call(this,r[a],a,r);return n}function mt(r,e,i){const n={};for(const a in r)e.call(this,r[a],a,r)&&(n[a]=r[a]);return n}function At(r){return Array.isArray(r)?r.map(At):typeof r=="object"&&r?ft(r,At):r}function Dt(r,e){for(let i=0;i<r.length;i++)if(e.indexOf(r[i])>=0)return!0;return!1}const Tt={};function xt(r){Tt[r]||(typeof console<"u"&&console.warn(r),Tt[r]=!0)}function _i(r,e,i){return(i.y-r.y)*(e.x-r.x)>(e.y-r.y)*(i.x-r.x)}function or(r){let e=0;for(let i,n,a=0,u=r.length,h=u-1;a<u;h=a++)i=r[a],n=r[h],e+=(n.x-i.x)*(i.y+n.y);return e}function qi([r,e,i]){const n=$t(e+90),a=$t(i);return{x:r*Math.cos(n)*Math.sin(a),y:r*Math.sin(n)*Math.sin(a),z:r*Math.cos(a),azimuthal:e,polar:i}}function Hi(r){return(typeof self<"u"||r!==void 0)&&typeof WorkerGlobalScope<"u"&&(r!==void 0?r:self)instanceof WorkerGlobalScope}function Mi(r){const e={};if(r.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(i,n,a,u)=>{const h=a||u;return e[n]=!h||h.toLowerCase(),""}),e["max-age"]){const i=parseInt(e["max-age"],10);isNaN(i)?delete e["max-age"]:e["max-age"]=i}return e}let Gt=null;function zi(r,e){return[r[4*e],r[4*e+1],r[4*e+2],r[4*e+3]]}function di(r,e,i,n){for(;e<i;){const a=e+i>>1;r[a]<n?e=a+1:i=a}return e}function fi(r,e,i,n){for(;e<i;){const a=e+i>>1;r[a]<=n?e=a+1:i=a}return e}function ji(r){return r>0?1/(1.001-r):1+r}function zr(r){return r>0?1-1/(1.001-r):-r}function Sr(r,e,i){return(r-e.min)*(i.max-i.min)/(e.max-e.min)+i.min}const cr={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i},get API_TILEJSON_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},get API_CDN_URL_REGEX(){return/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i},get EVENTS_URL(){if(!cr.API_URL)return null;try{const r=new URL(cr.API_URL);return r.hostname==="api.mapbox.cn"?"https://events.mapbox.cn/events/v2":r.hostname==="api.mapbox.com"?"https://events.mapbox.com/events/v2":null}catch{return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",RASTERARRAYS_URL_PREFIX:"rasterarrays/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,DEFAULT_STYLE:"mapbox://styles/mapbox/standard",MAX_PARALLEL_IMAGE_REQUESTS:16,DRACO_URL:"https://api.mapbox.com/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",MES
2HOPT_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_base_v0.20.wasm",MESHOPT_SIMD_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_simd_v0.20.wasm",BUILDING_GEN_URL:"https://api.mapbox.com/mapbox-gl-js/building-gen/building_gen_v1.2.4.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1"};function as(r){return cr.API_URL_REGEX.test(r)}function Vr(r){return cr.API_SPRITE_REGEX.test(r)}let xn,$n,ro,vn,Wr,ko;function Ns(){return xn==null&&(xn=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&typeof self.createImageBitmap=="function"),xn}const Rn={now:()=>vn!==void 0?vn:performance.now(),setNow(r){vn=r},restoreNow(){vn=void 0},frame(r){const e=requestAnimationFrame(r);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(r,e=0){const{width:i,height:n}=r;Wr||(Wr=document.createElement("canvas"));const a=Wr.getContext("2d",{willReadFrequently:!0});if(!a)throw new Error("failed to create canvas 2d context");return(i>Wr.width||n>Wr.height)&&(Wr.width=i,Wr.height=n),a.clearRect(-e,-e,i+2*e,n+2*e),a.drawImage(r,0,0,i,n),a.getImageData(-e,-e,i+2*e,n+2*e)},resolveURL:r=>($n||($n=document.createElement("a")),$n.href=r,$n.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(ro==null&&(ro=window.matchMedia("(prefers-reduced-motion: reduce)")),ro.matches)},hasCanvasFingerprintNoise(){if(ko!==void 0)return ko;if(!Ns())return ko=!1,!1;const r=new OffscreenCanvas(85,1),e=r.getContext("2d",{willReadFrequently:!0});let i=0;for(let a=0;a<r.width;++a)e.fillStyle=`rgba(${i++},${i++},${i++}, 255)`,e.fillRect(a,0,1,1);const n=e.getImageData(0,0,r.width,r.height);i=0;for(let a=0;a<n.data.length;++a)if(a%4!=3&&i++!==n.data[a])return ko=!0,!0;return ko=!1,!1}};function ll(r,e){const i=r.indexOf("?");if(i<0)return`${r}?${new URLSearchParams(e).toString()}`;
2const n=new URLSearchParams(r.slice(i));for(const a in e)n.set(a,e[a]);return`${r.slice(0,i)}?${n.toString()}`}function cl(r,e={persistentParams:[]}){const i=r.indexOf("?");if(i<0)return r;const n=new URLSearchParams,a=new URLSearchParams(r.slice(i));for(const h of e.persistentParams){const f=a.get(h);f&&n.set(h,f)}const u=n.toString();return`${r.slice(0,i)}${u.length>0?`?${u}`:""}`}const Xd="mapbox-tiles";let Yd=500,ku=50;const Bu=["language","worldview","jobid"];let Er,zn;function Bo(){try{return caches}catch{}}function Dn(){const r=Bo();r&&Er==null&&(Er=r.open(Xd))}let po=1/0;const pa={supported:!1,testSupport:function(r){!ls&&Vs&&(dc?Jd(r):ma=r)}};let ma,Vs,ls=!1,dc=!1;const Kd=typeof self<"u"?self:{};function Jd(r){const e=r.createTexture();r.bindTexture(r.TEXTURE_2D,e);try{if(r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,Vs),r.isContextLost())return;pa.supported=!0}catch{}r.deleteTexture(e),ls=!0}Kd.document&&(Vs=Kd.document.createElement("img"),Vs.onload=function(){ma&&Jd(ma),ma=null,dc=!0},Vs.onerror=function(){ls=!0,ma=null},Vs.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const ln={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Iconset:"Iconset",Image:"Image",Model:"Model"};typeof Object.freeze=="function"&&Object.freeze(ln);class ul extends Error{constructor(e,i,n){i===401&&as(n)&&(e+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(e),this.status=i,this.url=n}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const hl=Hi()?()=>self.worker.referrer:()=>(location.protocol==="blob:"?parent:self).location.href,No=function(r,e){if(!(/^file:/.test(i=r.url)||/^file:/.test(hl())&&!/^\w+:/.test(i))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return(function(n,a){const u=new AbortController,h=new Request(n.url,{method:n.method||"GET",body:n.body,credentials:n.credentials,headers:n.headers,referrer:hl(),referrerPolicy:n.referrerPolicy,signal:u.signal});let f=!1,_=!1;const g=(v=h.url).indexOf("sku=")>0&&as(v);var v;n.type==="json"&&h.headers.set("Accept","application/json");const b=(E,I,P)=>{if(_)return;if(E&&E.message!=="SecurityError"&&xt(E.toString()),I&&P)return w(I);const D=Date.now();fetch(h).then(R=>{if(R.ok){const F=g?R.clone():null;return w(R,F,D)}return a(new ul(R.statusText,R.status,n.url))}).catch(R=>{R.name!=="AbortError"&&a(new Error(`${R.message} ${n.url}`))})},w=(E,I,P)=>{(n.type==="arrayBuffer"?E.arrayBuffer():n.type==="json"?E.json():E.text()).then(D=>{_||(I&&P&&(function(R,F,B){if(Dn(),Er==null)return;const V=Mi(F.headers.get("Cache-Control")||"");if(V["no-store"])return;const $={status:F.status,statusText:F.statusText,headers:new Headers};F.headers.forEach((ee,K)=>$.headers.set(K,ee)),V["max-age"]&&$.headers.set("Expires",new Date(B+1e3*V["max-age"]).toUTCString());const H=$.headers.get("Expires");if(!H||new Date(H).getTime()-B<42e4)return;
2let J=cl(R.url,{persistentParams:Bu});if(F.status===206){const ee=R.headers.get("Range");if(!ee)return;$.status=200,J=ll(J,{range:ee})}(function(ee,K){if(zn===void 0)try{new Response(new ReadableStream),zn=!0}catch{zn=!1}zn?K(ee.body):ee.blob().then(K).catch(re=>xt(re.message))})(F,ee=>{const K=new Response((re=F.status)!==200&&re!==404&&[101,103,204,205,304].includes(re)?null:ee,$);var re;Dn(),Er?.then(se=>se.put(J,K)).catch(se=>xt(se.message))})})(h,I,P),f=!0,a(null,D,E.headers))}).catch(D=>{_||a(new Error(D.message))})};return g?(function(E,I){if(Dn(),Er==null)return I(null);Er.then(P=>{let D=cl(E.url,{persistentParams:Bu});const R=E.headers.get("Range");R&&(D=ll(D,{range:R})),P.match(D).then(F=>{const B=(function(V){if(!V)return!1;const $=new Date(V.headers.get("Expires")||0),H=Mi(V.headers.get("Cache-Control")||"");return Number($)>Date.now()&&!H["no-cache"]})(F);P.delete(D).catch(I),B&&P.put(D,F.clone()).catch(I),I(null,F,B)}).catch(I)}).catch(I)})(h,b):b(null,null),{cancel:()=>{_=!0,f||u.abort()}}})(r,e);if(Hi(self)&&self.worker.actor)return self.worker.actor.send("getResource",r,e,void 0,!0)}var i;return(function(n,a){const u=new XMLHttpRequest;u.open(n.method||"GET",n.url,!0),n.type==="arrayBuffer"&&(u.responseType="arraybuffer");for(const h in n.headers)u.setRequestHeader(h,n.headers[h]);return n.type==="json"&&(u.responseType="text",u.setRequestHeader("Accept","application/json")),u.withCredentials=n.credentials==="include",u.onerror=()=>{a(new Error(u.statusText))},u.onload=()=>{if((u.status>=200&&u.status<300||u.status===0)&&u.response!==null){let h=u.response;if(n.type==="json")try{h=JSON.parse(u.response)}catch(_){return a(_)}const f=new Headers;u.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(_=>{const g=_.split(": "),v=g.shift(),b=g.join(": ");f.append(v,b)}),a(null,h,f)}else a(new ul(u.statusText,u.status,n.url))},u.send(n.body),{cancel:()=>u.abort()}})(r,e)},dl=function(r,e){return No(Object.assign(r,{type:"arrayBuffer"}),e)};function bm(r){const e=document.createElement("a");return e.href=r,e.protocol===location.protocol&&e.host===location.host}const Nu="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let Xt,_a;Xt=[],_a=0;const fc=function(r,e){if(pa.supported&&(r.headers||(r.headers={}),r.headers.accept="image/webp,*/*"),_a>=cr.MAX_PARALLEL_IMAGE_REQUESTS){const u={requestParameters:r,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return Xt.push(u),u}_a++;let i=!1;const n=()=>
2{if(!i)for(i=!0,_a--;Xt.length&&_a<cr.MAX_PARALLEL_IMAGE_REQUESTS;){const u=Xt.shift(),{requestParameters:h,callback:f,cancelled:_}=u;_||(u.cancel=fc(h,f).cancel)}},a=dl(r,(u,h,f)=>{n(),u?e(u):h&&(self.createImageBitmap?(function(_,g){const v=new Blob([new Uint8Array(_)],{type:"image/png"});createImageBitmap(v).then(b=>{g(null,b)}).catch(b=>{g(new Error(`Could not load image because of ${b.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})})(h,(_,g)=>e(_,g,f)):(function(_,g){const v=new Image;v.onload=()=>{g(null,v),URL.revokeObjectURL(v.src),v.onload=null,requestAnimationFrame(()=>{v.src=Nu})},v.onerror=()=>g(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 b=new Blob([new Uint8Array(_)],{type:"image/png"});v.src=_.byteLength?URL.createObjectURL(b):Nu})(h,(_,g)=>e(_,g,f)))});return{cancel:()=>{a.cancel(),n()}}};var Qd,ef,fl,cs={exports:{}},pl={exports:{}},pc={exports:{}},wm=(function(){if(fl)return cs.exports;fl=1;var r=(Qd||(Qd=1,pl.exports=function(i,n){var a,u,h,f,_,g,v,b;for(u=i.length-(a=3&i.length),h=n,_=3432918353,g=461845907,b=0;b<u;)v=255&i.charCodeAt(b)|(255&i.charCodeAt(++b))<<8|(255&i.charCodeAt(++b))<<16|(255&i.charCodeAt(++b))<<24,++b,h=27492+(65535&(f=5*(65535&(h=(h^=v=(65535&(v=(v=(65535&v)*_+(((v>>>16)*_&65535)<<16)&4294967295)<<15|v>>>17))*g+(((v>>>16)*g&65535)<<16)&4294967295)<<13|h>>>19))+((5*(h>>>16)&65535)<<16)&4294967295))+(((f>>>16)+58964&65535)<<16);switch(v=0,a){case 3:v^=(255&i.charCodeAt(b+2))<<16;case 2:v^=(255&i.charCodeAt(b+1))<<8;case 1:h^=v=(65535&(v=(v=(65535&(v^=255&i.charCodeAt(b)))*_+(((v>>>16)*_&65535)<<16)&4294967295)<<15|v>>>17))*g+(((v>>>16)*g&65535)<<16)&4294967295}return h^=i.length,h=2246822507*(65535&(h^=h>>>16))+((2246822507*(h>>>16)&65535)<<16)&4294967295,h=3266489909*(65535&(h^=h>>>13))+((3266489909*(h>>>16)&65535)<<16)&4294967295,(h^=h>>>16)>>>0}),pl.exports),e=(ef||(ef=1,pc.exports=function(i,n){for(var a,u=i.length,h=n^u,f=0;u>=4;)a=1540483477*(65535&(a=255&i.charCodeAt(f)|(255&i.charCodeAt(++f))<<8|(255&i.charCodeAt(++f))<<16|(255&i.charCodeAt(++f))<<24))+((1540483477*(a>>>16)&65535)<<16),h=1540483477*(65535&h)+((1540483477*(h>>>16)&65535)<<16)^(a=1540483477*(65535&(a^=a>>>24))+((1540483477*(a>>>16)&65535)<<16)),u-=4,++f;switch(u){case 3:h^=(255&i.charCodeAt(f+2))<<16;case 2:h^=(255&i.charCodeAt(f+1))<<8;case 1:h=1540483477*(65535&(h^=255&i.charCodeAt(f)))+((1540483477*(h>>>16)&65535)<<16)}return h=1540483477*(65535&(h^=h>>>13))+((1540483477*(h>>>16)&65535)<<16),(h^=h>>>15)>>>0}
2),pc.exports);return cs.exports=r,cs.exports.murmur3=r,cs.exports.murmur2=e,cs.exports})(),ga=Pn(wm);class Vo{constructor(e,...i){Object.assign(this,i[0]||{}),this.type=e}}class ml extends Vo{constructor(e,i={}){super("error",Object.assign({error:e},i))}}function tf(r,e,i){i[r]&&i[r].indexOf(e)!==-1||(i[r]=i[r]||[],i[r].push(e))}function Us(r,e,i){if(i&&i[r]){const n=i[r].indexOf(e);n!==-1&&i[r].splice(n,1)}}class Uo{on(e,i){return this._listeners=this._listeners||{},tf(e,i,this._listeners),this}off(e,i){return Us(e,i,this._listeners),Us(e,i,this._oneTimeListeners),this}once(e,i){return i?(this._oneTimeListeners=this._oneTimeListeners||{},tf(e,i,this._oneTimeListeners),this):new Promise(n=>{this.once(e,n)})}fire(e,i){const n=typeof e=="string"?new Vo(e,i):e,a=n.type;if(this.listens(a)){n.target=this;const u=this._listeners&&this._listeners[a]?this._listeners[a].slice():[];for(const _ of u)_.call(this,n);const h=this._oneTimeListeners&&this._oneTimeListeners[a]?this._oneTimeListeners[a].slice():[];for(const _ of h)Us(a,_,this._oneTimeListeners),_.call(this,n);const f=this._eventedParent;if(f){const _=typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData;Object.assign(n,_),f.fire(n)}}else n instanceof ml&&console.error(n.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,i){return this._eventedParent=e,this._eventedParentData=i,this}}class cn{constructor(e){typeof e=="string"?this.name=e:(this.name=e.name,this.iconsetId=e.iconsetId)}static from(e){return new cn(e)}static toString(e){return e.iconsetId?`${e.name}�${e.iconsetId}`:e.name}static parse(e){const[i,n]=e.split("�");return new cn({name:i,iconsetId:n})}static isEqual(e,i){return e.name===i.name&&e.iconsetId===i.iconsetId}toString(){return cn.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var Zn,mc={},rf=(function(){if(Zn)return mc;Zn=1;var r={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 e(u){return(u=Math.round(u))<0?0:u>255?255:u}function i(u){return e(u[u.length-1]==="%"?parseFloat(u)/100*255:parseInt(u))}
vendor: 25,101 bytes, line 2
2function n(u){return(h=u[u.length-1]==="%"?parseFloat(u)/100:parseFloat(u))<0?0:h>1?1:h;var h}function a(u,h,f){return f<0?f+=1:f>1&&(f-=1),6*f<1?u+(h-u)*f*6:2*f<1?h:3*f<2?u+(h-u)*(2/3-f)*6:u}try{mc.parseCSSColor=function(u){var h,f=u.replace(/ /g,"").toLowerCase();if(f in r)return r[f].slice();if(f[0]==="#")return f.length===4?(h=parseInt(f.substr(1),16))>=0&&h<=4095?[(3840&h)>>4|(3840&h)>>8,240&h|(240&h)>>4,15&h|(15&h)<<4,1]:null:f.length===7&&(h=parseInt(f.substr(1),16))>=0&&h<=16777215?[(16711680&h)>>16,(65280&h)>>8,255&h,1]:null;var _=f.indexOf("("),g=f.indexOf(")");if(_!==-1&&g+1===f.length){var v=f.substr(0,_),b=f.substr(_+1,g-(_+1)).split(","),w=1;switch(v){case"rgba":if(b.length!==4)return null;w=n(b.pop());case"rgb":return b.length!==3?null:[i(b[0]),i(b[1]),i(b[2]),w];case"hsla":if(b.length!==4)return null;w=n(b.pop());case"hsl":if(b.length!==3)return null;var E=(parseFloat(b[0])%360+360)%360/360,I=n(b[1]),P=n(b[2]),D=P<=.5?P*(I+1):P+I-P*I,R=2*P-D;return[e(255*a(R,D,E+1/3)),e(255*a(R,D,E)),e(255*a(R,D,E-1/3)),w];default:return null}}return null}}catch{}return mc})();class ii{constructor(e,i,n,a=1){this.r=e,this.g=i,this.b=n,this.a=a}static parse(e){if(!e)return;if(e instanceof ii)return e;if(typeof e!="string")return;const i=rf.parseCSSColor(e);return i?new ii(i[0]/255,i[1]/255,i[2]/255,i[3]):void 0}toString(){const[e,i,n,a]=[this.r,this.g,this.b,this.a];return`rgba(${Math.round(255*e)},${Math.round(255*i)},${Math.round(255*n)},${a})`}toNonPremultipliedRenderColor(e){const{r:i,g:n,b:a,a:u}=this;return new nf(e,i,n,a,u)}toPremultipliedRenderColor(e){const{r:i,g:n,b:a,a:u}=this;return new of(e,i*u,n*u,a*u,u)}clone(){return new ii(this.r,this.g,this.b,this.a)}}class Vu{constructor(e,i,n,a,u,h=!1){if(this.premultiplied=!1,this.premultiplied=h,e){const f=e.image.height,_=f*f;this.premultiplied?(i=u===0?0:i/u*(f-1),n=u===0?0:n/u*(f-1),a=u===0?0:a/u*(f-1)):(i*=f-1,n*=f-1,a*=f-1),i=Math.max(0,Math.min(f-1,i)),n=Math.max(0,Math.min(f-1,n)),a=Math.max(0,Math.min(f-1,a));const g=Math.floor(i),v=Math.floor(n),b=Math.floor(a),w=Math.ceil(i),E=Math.ceil(n),I=Math.ceil(a),P=i-g,D=n-v,R=a-b,F=e.image.data,B=4*(g+v*_+b*f),V=4*(g+v*_+I*f),$=4*(g+E*_+b*f),H=4*(g+E*_+I*f),J=4*(w+v*_+b*f),ee=4*(w+v*_+I*f),K=4*(w+E*_+b*f),re=4*(w+E*_+I*f);this.r=_t(_t(_t(F[B],F[V],R),_t(F[$],F[H],R),D),_t(_t(F[J],F[ee],R),_t(F[K],F[re],R),D),P)/255*(this.premultiplied?u:1),this.g=_t(_t(_t(F[B+1],F[V+1],R),_t(F[$+1],F[H+1],R),D),_t(_t(F[J+1],F[ee+1],R),_t(F[K+1],F[re+1],R),D),P)/255*(this.premultiplied?u:1),this.b=_t(_t(_t(F[B+2],F[V+2],R),_t(F[$+2],F[H+2],R),D),_t(_t(F[J+2],F[ee+2],R),_t(F[K+2],F[re+2],R),D),P)/255*(this.premultiplied?u:1),this.a=u}else this.r=i,this.g=n,this.b=a,this.a=u}toArray(){const{r:e,g:i,b:n,a}=this;return[255*e,255*i,255*n,a]}toHslaArray(){let{r:e,g:i,b:n,a}=this;if(this.premultiplied){if(a===0)return[0,0,0,0];const I=1/a;e*=I,i*=I,n*=I}const u=Math.min(Math.max(e,0),1),h=Math.min(Math.max(i,0),1),f=Math.min(Math.max(n,0),1),_=Math.min(u,h,f),g=Math.max(u,h,f),v=g-_,b=.5*(_+g);if(v===0)return[0,0,100*b,a];const w=b>.5?v/(2-g-_):v/(g+_);let E;switch(g){case u:E=60*((h-f)/v+(h<f?6:0));break;case h:E=60*((f-u)/v+2);break;default:E=60*((u-h)/v+4)}return[E,100*w,100*b,a]}toArray01(){const{r:e,g:i,b:n,a}=this;return[e,i,n,a]}toArray01Scaled(e){const{r:i,g:n,b:a}=this;return[i*e,n*e,a*e]}toArray01Linear(){const{r:e,g:i,b:n,a}=this;return[Math.pow(e,2.2),Math.pow(i,2.2),Math.pow(n,2.2),a]}}class nf extends Vu{constructor(e,i,n,a,u){super(e,i,n,a,u,!1)}}class of extends Vu{constructor(e,i,n,a,u){super(e,i,n,a,u,!0)}}function _t(r,e,i){return r*(1-i)+e*i}function Uu(r,e,i){return r.map((n,a)=>_t(n,e[a],i))}ii.black=new ii(0,0,0,1),ii.white=new ii(1,1,1,1),ii.transparent=new ii(0,0,0,0),ii.red=new ii(1,0,0,1),ii.blue=new ii(0,0,1,1);var js=Object.freeze({__proto__:null,array:Uu,color:function(r,e,i){return new ii(_t(r.r,e.r,i),_t(r.g,e.g,i),_t(r.b,e.b,i),_t(r.a,e.a,i))},number:_t});class Xr extends Error{constructor(e,i){super(i),this.message=i,this.key=e}}class _c{constructor(e,i=[]){this.parent=e,this.bindings={};for(const[n,a]of i)this.bindings[n]=a}concat(e){return new _c(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 un={kind:"null"},ht={kind:"number"},ti={kind:"string"},Yt={kind:"boolean"},Yr={kind:"color"},ya={kind:"object"},oi={kind:"value"},gc={kind:"collator"},xa={kind:"formatted"},Gs={kind:"resolvedImage"};function Ur(r,e){return{kind:"array",itemType:r,N:e}}function er(r){if(r.kind==="array"){const e=er(r.itemType);return typeof r.N=="number"?`array<${e}, ${r.N}>`:r.itemType.kind==="value"?"array":`array<${e}>`}return r.kind}const Tm=[un,ht,ti,Yt,Yr,xa,ya,Ur(oi),Gs];function _l(r,e){if(e.kind==="error")return null;if(r.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!_l(r.itemType,e.itemType))&&(typeof r.N!="number"||r.N===e.N))return null}else{if(r.kind===e.kind)return null;if(r.kind==="value"){for(const i of Tm)if(!_l(i,e))return null}}return`Expected ${er(r)} but found ${er(e)} instead.`}function ju(r,e){return e.some(i=>i.kind===r.kind)}function gl(r,e){return e.some(i=>i==="null"?r===null:i==="array"?Array.isArray(r):i==="object"?r&&!Array.isArray(r)&&typeof r=="object":i===typeof r)}function yc(r,e){return r.kind==="array"&&e.kind==="array"?r.N===e.N&&yc(r.itemType,e.itemType):r.kind===e.kind}class Gu{constructor(e,i,n){this.sensitivity=e?i?"variant":"case":i?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,i){return this.collator.compare(e,i)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class xc{constructor(e,i,n,a,u){this.text=e.normalize?e.normalize():e,this.image=i,this.scale=n,this.fontStack=a,this.textColor=u}}class jr{constructor(e){this.sections=e}static fromString(e){return new jr([new xc(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||!!e.image&&e.image.hasPrimary())}static factory(e){return e instanceof jr?e:jr.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}serialize(){const e=["format"];for(const i of this.sections){if(i.image){const a=i.image.getPrimary().id.toString();e.push(["image",a]);continue}e.push(i.text);const n={};i.fontStack&&(n["text-font"]=["literal",i.fontStack.split(",")]),i.scale&&(n["font-scale"]=i.scale),i.textColor&&(n["text-color"]=["rgba"].concat(i.textColor.toNonPremultipliedRenderColor(null).toArray())),e.push(n)}return e}}class hn{constructor(e,i={}){this.id=cn.from(e),this.params=i.params,this.sx=i.sx||1,this.sy=i.sy||1}toString(){return JSON.stringify(this)}static parse(e){let i,n,a,u;try{({id:i,params:n,sx:a,sy:u}=JSON.parse(e)||{})}catch{return null}return i?new hn(i,{params:n,sx:a,sy:u}):null}scaleSelf(e,i=e){return this.sx*=e,this.sy*=i,this}}class dn{constructor(e,i,n,a,u=!1){this.primaryId=cn.from(e),this.primaryOptions=i,n&&(this.secondaryId=cn.from(n)),this.secondaryOptions=a,this.available=u}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new hn(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new hn(this.secondaryId,this.secondaryOptions):null}static from(e){return typeof e=="string"?dn.build({name:e}):e}static build(e,i,n,a){return!e||typeof e=="object"&&!("name"in e)?null:new dn(e,n,i,a)}}function qu(r,e,i,n){return typeof r=="number"&&r>=0&&r<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof i=="number"&&i>=0&&i<=255?n===void 0||typeof n=="number"&&n>=0&&n<=1?null:`Invalid rgba value [${[r,e,i,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof n=="number"?[r,e,i,n]:[r,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function us(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof ii||r instanceof Gu||r instanceof jr||r instanceof dn)return!0;if(Array.isArray(r)){for(const e of r)if(!us(e))return!1;return!0}if(typeof r=="object"){for(const e in r)if(!us(r[e]))return!1;return!0}return!1}function gr(r){if(r===null)return un;if(typeof r=="string")return ti;if(typeof r=="boolean")return Yt;if(typeof r=="number")return ht;if(r instanceof ii)return Yr;if(r instanceof Gu)return gc;if(r instanceof jr)return xa;if(r instanceof dn)return Gs;if(Array.isArray(r)){const e=r.length;let i;for(const n of r){const a=gr(n);if(i){if(i===a)continue;i=oi;break}i=a}return Ur(i||oi,e)}return ya}function mo(r){const e=typeof r;return r===null?"":e==="string"||e==="number"||e==="boolean"?String(r):r instanceof jr||r instanceof dn||r instanceof ii?r.toString():JSON.stringify(r)}class jo{constructor(e,i){this.type=e,this.value=i}static parse(e,i){if(e.length!==2)return i.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!us(e[1]))return i.error("invalid value");const n=e[1];let a=gr(n);const u=i.expectedType;return a.kind!=="array"||a.N!==0||!u||u.kind!=="array"||typeof u.N=="number"&&u.N!==0||(a=u),new jo(a,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof ii?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof jr?this.value.serialize():this.value}}class ur{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const hs={string:ti,number:ht,boolean:Yt,object:ya};class Et{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let n,a=1;const u=e[0];if(u==="array"){let f,_;if(e.length>2){const g=e[1];if(typeof g!="string"||!(g in hs)||g==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);f=hs[g],a++}else f=oi;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return i.error('The length argument to "array" must be a positive integer literal',2);_=e[2],a++}n=Ur(f,_)}else n=hs[u];const h=[];for(;a<e.length;a++){const f=i.parse(e[a],a,oi);if(!f)return null;h.push(f)}return new Et(n,h)}evaluate(e){for(let i=0;i<this.args.length;i++){const n=this.args[i].evaluate(e);if(!_l(this.type,gr(n)))return n;if(i===this.args.length-1)throw new ur(`The expression ${JSON.stringify(this.args[i].serialize())} evaluated to ${er(gr(n))} but was expected to be of type ${er(this.type)}.`)}return null}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=this.type,i=[e.kind];if(e.kind==="array"){const n=e.itemType;if(n.kind==="string"||n.kind==="number"||n.kind==="boolean"){i.push(n.kind);const a=e.N;(typeof a=="number"||this.args.length>1)&&i.push(a)}}return i.concat(this.args.map(n=>n.serialize()))}}class ut{constructor(e){this.type=xa,this.sections=e}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const n=e[1];if(!Array.isArray(n)&&typeof n=="object")return i.error("First argument must be an image or text section.");const a=[];let u=!1;for(let h=1;h<=e.length-1;++h){const f=e[h];if(u&&typeof f=="object"&&!Array.isArray(f)){u=!1;let _=null;if(f["font-scale"]&&(_=i.parseObjectValue(f["font-scale"],h,"font-scale",ht),!_))return null;let g=null;if(f["text-font"]&&(g=i.parseObjectValue(f["text-font"],h,"text-font",Ur(ti)),!g))return null;let v=null;if(f["text-color"]&&(v=i.parseObjectValue(f["text-color"],h,"text-color",Yr),!v))return null;const b=a[a.length-1];b.scale=_,b.font=g,b.textColor=v}else{const _=i.parse(e[h],h,oi);if(!_)return null;const g=_.type.kind;if(g!=="string"&&g!=="value"&&g!=="null"&&g!=="resolvedImage")return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");u=!0,a.push({content:_,scale:null,font:null,textColor:null})}}return new ut(a)}evaluate(e){return new jr(this.sections.map(i=>{const n=i.content.evaluate(e);return yc(gr(n),Gs)?new xc("",n,null,null,null):new xc(mo(n),null,i.scale?i.scale.evaluate(e):null,i.font?i.font.evaluate(e).join(","):null,i.textColor?i.textColor.evaluate(e):null)}))}eachChild(e){for(const i of this.sections)e(i.content),i.scale&&e(i.scale),i.font&&e(i.font),i.textColor&&e(i.textColor)}outputDefined(){return!1}serialize(){const e=["format"];for(const i of this.sections){e.push(i.content.serialize());const n={};i.scale&&(n["font-scale"]=i.scale.serialize()),i.font&&(n["text-font"]=i.font.serialize()),i.textColor&&(n["text-color"]=i.textColor.serialize()),e.push(n)}return e}}class va{constructor(e,i,n,a){this._imageWarnHistory={},this.type=Gs,this.namePrimary=e,this.nameSecondary=i,n&&(this.paramsPrimary=n.params,this.iconsetIdPrimary=n.iconset?n.iconset.id:void 0),a&&(this.paramsSecondary=a.params,this.iconsetIdSecondary=a.iconset?a.iconset.id:void 0)}static parse(e,i){if(e.length<2)return i.error("Expected two or more arguments.");let n=1;const a=[];function u(){if(n<e.length){const f=i.parse(e[n],n++,ti);return f?(a.push({image:f,options:{}}),!0):(i.error(a.length?"Secondary image variant is not a string.":"No image name provided."),!1)}return!0}function h(){if(n<e.length){const _=e[n];if((f=_)===null||typeof f!="object"||Array.isArray(f))return!0;const g=_.params,v=_.iconset,b=i.concat(n);if(!g&&!v)return n++,!0;if(g){if(typeof g!="object"||g.constructor!==Object)return b.error('Image options "params" should be an object'),!1;const w={},E=b.concat(void 0,"params");for(const I in g){if(!I)return E.error("Image parameter name should be non-empty"),!1;const P=E.concat(void 0,I).parse(g[I],void 0,Yr,void 0,{typeAnnotation:"coerce"});if(!P)return!1;w[I]=P}a[a.length-1].options.params=w}if(v){if(typeof v!="object"||v.constructor!==Object)return b.error('Image options "iconset" should be an object'),!1;if(!v.id)return b.error('Image options "iconset" should have an "id" property'),!1;a[a.length-1].options.iconset=v}return n++,!0}var f;return!0}for(let f=0;f<2;f++)if(!u()||!h())return;return new va(a[0].image,a[1]?a[1].image:void 0,a[0].options,a[1]?a[1].options:void 0)}evaluateParams(e,i){const n={};if(i){for(const a in i)if(i[a])try{n[a]=i[a].evaluate(e)}catch{continue}if(Object.keys(n).length!==0)return{params:n}}}evaluate(e){const i={name:this.namePrimary.evaluate(e),iconsetId:this.iconsetIdPrimary},n=this.nameSecondary?{name:this.nameSecondary.evaluate(e),iconsetId:this.iconsetIdSecondary}:void 0,a=dn.build(i,n,this.paramsPrimary?this.evaluateParams(e,this.paramsPrimary):void 0,this.paramsSecondary?this.evaluateParams(e,this.paramsSecondary):void 0);if(a&&e.availableImages){const u=a.getPrimary().id;if(a.available=e.availableImages.some(h=>cn.isEqual(h,u)),a.available){const h=a.getSecondary()?a.getSecondary().id:null;h&&(a.available=e.availableImages.some(f=>cn.isEqual(f,h)))}}return a}eachChild(e){if(e(this.namePrimary),this.paramsPrimary)for(const i in this.paramsPrimary)this.paramsPrimary[i]&&e(this.paramsPrimary[i]);if(this.nameSecondary&&(e(this.nameSecondary),this.paramsSecondary))for(const i in this.paramsSecondary)this.paramsSecondary[i]&&e(this.paramsSecondary[i])}outputDefined(){return!1}serializeOptions(e,i){const n={};if(i&&(n.iconset={id:i}),e){n.params={};for(const a in e)e[a]&&(n.params[a]=e[a].serialize())}return Object.keys(n).length>0?n:void 0}serialize(){const e=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){const i=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);i&&e.push(i)}if(this.nameSecondary&&(e.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){const i=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);i&&e.push(i)}return e}}function vt(r){return yl(r)?"string":gt(r)?"number":Hu(r)?"boolean":Array.isArray(r)?"array":r===null?"null":vc(r)?"object":typeof r}function vc(r){return r!=null&&!Array.isArray(r)&&typeof r!="function"&&!(r instanceof String||r instanceof Number||r instanceof Boolean)&&typeof r=="object"}function yl(r){return typeof r=="string"||r instanceof String}function gt(r){return typeof r=="number"||r instanceof Number}function Hu(r){return typeof r=="boolean"||r instanceof Boolean}const $u={"to-boolean":Yt,"to-color":Yr,"to-number":ht,"to-string":ti};class _o{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const n=e[0],a=[];let u=un;if(n==="to-array"){if(!Array.isArray(e[1]))return null;const h=e[1].length;if(i.expectedType){if(i.expectedType.kind!=="array")return i.error(`Expected ${i.expectedType.kind} but found array.`);u=Ur(i.expectedType.itemType,h)}else{if(!(h>0&&us(e[1][0])))return null;u=Ur(gr(e[1][0]),h)}for(let f=0;f<h;f++){const _=e[1][f];let g;if(Array.isArray(_))g=i.parse(_,void 0,u.itemType);else{const v=vt(_);if(v!==u.itemType.kind)return i.error(`Expected ${u.itemType.kind} but found ${v}.`);g=i.registry.literal.parse(["literal",_===void 0?null:_],i)}if(!g)return null;a.push(g)}}else{if((n==="to-boolean"||n==="to-string")&&e.length!==2)return i.error("Expected one argument.");u=$u[n];for(let h=1;h<e.length;h++){const f=i.parse(e[h],h,oi);if(!f)return null;a.push(f)}}return new _o(u,a)}evaluate(e){if(this.type.kind==="boolean")return!!this.args[0].evaluate(e);if(this.type.kind==="color"){let i,n;for(const a of this.args){if(i=a.evaluate(e),n=null,i instanceof ii)return i;if(typeof i=="string"){const u=e.parseColor(i);if(u)return u}else if(Array.isArray(i)&&(n=i.length<3||i.length>4?`Invalid rbga value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:qu(i[0],i[1],i[2],i[3]),!n))return new ii(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new ur(n||`Could not parse color from value '${typeof i=="string"?i:String(JSON.stringify(i))}'`)}if(this.type.kind==="number"){let i=null;for(const n of this.args){if(i=n.evaluate(e),i===null)return 0;const a=Number(i);if(!isNaN(a))return a}throw new ur(`Could not convert ${JSON.stringify(i)} to number.`)}return this.type.kind==="formatted"?jr.fromString(mo(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?dn.build(mo(this.args[0].evaluate(e))):this.type.kind==="array"?this.args.map(i=>i.evaluate(e)):mo(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){if(this.type.kind==="formatted")return new ut([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new va(this.args[0]).serialize();const e=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild(i=>{e.push(i.serialize())}),e}}const sf=["Unknown","Point","LineString","Polygon"];class ba{constructor(e,i,n){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=e,this.options=i,this.iconImageUseTheme=n}id(){return this.feature&&this.feature.id!==void 0?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?sf[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||{}}measureLight(e){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const e=this.featureDistanceData.center,i=this.featureDistanceData.scale,{x:n,y:a}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(n*i-e[0])+this.featureDistanceData.bearing[1]*(a*i-e[1])}return 0}parseColor(e){let i=this._parseColorCache[e];return i||(i=this._parseColorCache[e]=ii.parse(e)),i}getConfig(e){return this.options?this.options.get(e):null}}class fn{constructor(e,i,n,a,u){this.name=e,this.type=i,this._evaluate=n,this.args=a,this._overloadIndex=u}evaluate(e){if(!this._evaluate){const i=fn.definitions[this.name];this._evaluate=Array.isArray(i)?i[2]:i.overloads[this._overloadIndex][1]}return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(e=>e.serialize()))}static parse(e,i){const n=e[0],a=fn.definitions[n];if(!a)return i.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);const u=Array.isArray(a)?a[0]:a.type,h=Array.isArray(a)?[[a[1],a[2]]]:a.overloads,f=[];let _=null,g=-1;for(const[v,b]of h){if(Array.isArray(v)&&v.length!==e.length-1)continue;f.push(v),g++,_=new Pc(i.registry,i.path,null,i.scope,void 0,i._scope,i.options,i.iconImageUseTheme);const w=[];let E=!1;for(let I=1;I<e.length;I++){const P=e[I],D=Array.isArray(v)?v[I-1]:v.type,R=_.parse(P,1+w.length,D);if(!R){E=!0;break}w.push(R)}if(!E)if(Array.isArray(v)&&v.length!==w.length)_.error(`Expected ${v.length} arguments, but found ${w.length} instead.`);else{for(let I=0;I<w.length;I++){const P=Array.isArray(v)?v[I]:v.type,D=w[I];_.concat(I+1).checkSubtype(P,D.type)}if(_.errors.length===0)return new fn(n,u,b,w,g)}}if(f.length===1)i.errors.push(..._.errors);else{const v=(f.length?f:h.map(([w])=>w)).map(Zu).join(" | "),b=[];for(let w=1;w<e.length;w++){const E=i.parse(e[w],1+b.length);if(!E)return null;b.push(er(E.type))}i.error(`Expected arguments of type ${v}, but found (${b.join(", ")}) instead.`)}return null}static register(e,i){fn.definitions=i;for(const n in i)e[n]=fn}}function Zu(r){return Array.isArray(r)?`(${r.map(er).join(", ")})`:`(${er(r.type)}...)`}class go{constructor(e,i,n){this.type=gc,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=i}static parse(e,i){if(e.length!==2)return i.error("Expected one argument.");const n=e[1];if(typeof n!="object"||Array.isArray(n))return i.error("Collator options argument must be an object.");const a=n["case-sensitive"]===void 0?i.parse(!1,1,Yt):i.parseObjectValue(n["case-sensitive"],1,"case-sensitive",Yt);if(!a)return null;const u=n["diacritic-sensitive"]===void 0?i.parse(!1,1,Yt):i.parseObjectValue(n["diacritic-sensitive"],1,"diacritic-sensitive",Yt);if(!u)return null;let h=null;return n.locale&&(h=i.parseObjectValue(n.locale,1,"locale",ti),!h)?null:new go(a,u,h)}evaluate(e){return new Gu(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}serialize(){const e={};return e["case-sensitive"]=this.caseSensitive.serialize(),e["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(e.locale=this.locale.serialize()),["collator",e]}}function bc(r,e,i=0,n=r.length-1,a=ds){for(;n>i;){if(n-i>600){const _=n-i+1,g=e-i+1,v=Math.log(_),b=.5*Math.exp(2*v/3),w=.5*Math.sqrt(v*b*(_-b)/_)*(g-_/2<0?-1:1);bc(r,e,Math.max(i,Math.floor(e-g*b/_+w)),Math.min(n,Math.floor(e+(_-g)*b/_+w)),a)}const u=r[e];let h=i,f=n;for(Wn(r,i,e),a(r[n],u)>0&&Wn(r,i,n);h<f;){for(Wn(r,h,f),h++,f--;a(r[h],u)<0;)h++;for(;a(r[f],u)>0;)f--}a(r[i],u)===0?Wn(r,i,f):(f++,Wn(r,f,n)),f<=e&&(i=f+1),e<=f&&(n=f-1)}}function Wn(r,e,i){const n=r[e];r[e]=r[i],r[i]=n}function ds(r,e){return r<e?-1:r>e?1:0}function Sm(r){let e=0;for(let i,n,a=0,u=r.length,h=u-1;a<u;h=a++)i=r[a],n=r[h],e+=(n.x-i.x)*(i.y+n.y);return e}function xl(r,e){r[0]=Math.min(r[0],e[0]),r[1]=Math.min(r[1],e[1]),r[2]=Math.max(r[2],e[0]),r[3]=Math.max(r[3],e[1])}function vl(r,e){return!(r[0]<=e[0]||r[2]>=e[2]||r[1]<=e[1]||r[3]>=e[3])}function wc(r,e,i){const n=r[0]-e[0],a=r[1]-e[1],u=r[0]-i[0],h=r[1]-i[1];return n*h-u*a===0&&n*u<=0&&a*h<=0}function af(r,e,i){return e[1]>r[1]!=i[1]>r[1]&&r[0]<(i[0]-e[0])*(r[1]-e[1])/(i[1]-e[1])+e[0]}function Xn(r,e,i=!1){let n=!1;for(let a=0,u=e.length;a<u;a++){const h=e[a];for(let f=0,_=h.length,g=_-1;f<_;g=f++){const v=h[g],b=h[f];if(wc(r,v,b))return i;af(r,v,b)&&(n=!n)}}return n}function lf(r,e,i,n){const a=n[0]-i[0],u=n[1]-i[1],h=(r[0]-i[0])*u-a*(r[1]-i[1]),f=(e[0]-i[0])*u-a*(e[1]-i[1]);return h>0&&f<0||h<0&&f>0}function Tc(r,e,i,n){return(a=[n[0]-i[0],n[1]-i[1]])[0]*(u=[e[0]-r[0],e[1]-r[1]])[1]-a[1]*u[0]!==0&&!(!lf(r,e,i,n)||!lf(i,n,r,e));var a,u}function bl(r){const e=new Be(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),i=new Be(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const n of r[0])e.x>n.x&&(e.x=n.x),e.y>n.y&&(e.y=n.y),i.x<n.x&&(i.x=n.x),i.y<n.y&&(i.y=n.y);return{min:e,max:i}}const fs=8192;function Em(r,e){const i=(180+r[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r[1]*Math.PI/360)))/360,a=Math.pow(2,e.z);return[Math.round(i*a*fs),Math.round(n*a*fs)]}function cf(r,e){for(let i=0;i<e.length;i++)if(Xn(r,e[i]))return!0;return!1}
2function Im(r,e,i){for(const n of i)for(let a=0,u=n.length,h=u-1;a<u;h=a++)if(Tc(r,e,n[h],n[a]))return!0;return!1}function Wu(r,e){for(let i=0;i<r.length;++i)if(!Xn(r[i],e))return!1;for(let i=0;i<r.length-1;++i)if(Im(r[i],r[i+1],e))return!1;return!0}function Am(r,e){for(let i=0;i<e.length;i++)if(Wu(r,e[i]))return!0;return!1}function Go(r,e,i){const n=[];for(let a=0;a<r.length;a++){const u=[];for(let h=0;h<r[a].length;h++){const f=Em(r[a][h],i);xl(e,f),u.push(f)}n.push(u)}return n}function uf(r,e,i){const n=[];for(let a=0;a<r.length;a++){const u=Go(r[a],e,i);n.push(u)}return n}function hf(r,e,i,n){if(r[0]<i[0]||r[0]>i[2]){const a=.5*n;let u=r[0]-i[0]>a?-n:i[0]-r[0]>a?n:0;u===0&&(u=r[0]-i[2]>a?-n:i[2]-r[0]>a?n:0),r[0]+=u}xl(e,r)}function Sc(r,e,i,n){const a=Math.pow(2,n.z)*fs,u=[n.x*fs,n.y*fs],h=[];if(!r)return h;for(const f of r)for(const _ of f){const g=[_.x+u[0],_.y+u[1]];hf(g,e,i,a),h.push(g)}return h}function Xu(r,e,i,n){const a=Math.pow(2,n.z)*fs,u=[n.x*fs,n.y*fs],h=[];if(!r)return h;for(const _ of r){const g=[];for(const v of _){const b=[v.x+u[0],v.y+u[1]];xl(e,b),g.push(b)}h.push(g)}if(e[2]-e[0]<=a/2){(f=e)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(const _ of h)for(const g of _)hf(g,e,i,a)}var f;return h}class ps{constructor(e,i){this.type=Yt,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(us(e[1])){const n=e[1];if(n.type==="FeatureCollection")for(let a=0;a<n.features.length;++a){const u=n.features[a].geometry.type;if(u==="Polygon"||u==="MultiPolygon")return new ps(n,n.features[a].geometry)}else if(n.type==="Feature"){const a=n.geometry.type;if(a==="Polygon"||a==="MultiPolygon")return new ps(n,n.geometry)}else if(n.type==="Polygon"||n.type==="MultiPolygon")return new ps(n,n)}return i.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(i,n){const a=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],h=i.canonicalID();if(!h)return!1;if(n.type==="Polygon"){const f=Go(n.coordinates,u,h),_=Sc(i.geometry(),a,u,h);if(!vl(a,u))return!1;for(const g of _)if(!Xn(g,f))return!1}if(n.type==="MultiPolygon"){const f=uf(n.coordinates,u,h),_=Sc(i.geometry(),a,u,h);if(!vl(a,u))return!1;for(const g of _)if(!cf(g,f))return!1}return!0})(e,this.geometries);if(e.geometryType()==="LineString")return(function(i,n){const a=[1/0,1/0,-1/0,-1/0],u=[1/0,1/0,-1/0,-1/0],h=i.canonicalID();if(!h)return!1;if(n.type==="Polygon"){const f=Go(n.coordinates,u,h),_=Xu(i.geometry(),a,u,h);if(!vl(a,u))return!1;for(const g of _)if(!Wu(g,f))return!1}if(n.type==="MultiPolygon"){const f=uf(n.coordinates,u,h),_=Xu(i.geometry(),a,u,h);if(!vl(a,u))return!1;for(const g of _)if(!Am(g,f))return!1}return!0})(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}const bn={kilometers:1,miles:1e3/1609.344,nauticalmiles:1e3/1852,meters:1e3,metres:1e3,yards:1e3/.9144,feet:1e3/.3048,inches:1e3/.0254},Yu=1/298.257223563,Ku=Yu*(2-Yu),wa=Math.PI/180;class Ta{static fromTile(e,i,n){const a=Math.PI*(1-2*(e+.5)/Math.pow(2,i)),u=Math.atan(.5*(Math.exp(a)-Math.exp(-a)))/wa;return new Ta(u,n)}static get units(){return bn}constructor(e,i){if(e===void 0)throw new Error("No latitude given.");if(i&&!bn[i])throw new Error(`Unknown unit ${i}. Use one of: ${Object.keys(bn).join(", ")}`);const n=6378.137*wa*(i?bn[i]:1),a=Math.cos(e*wa),u=1/(1-Ku*(1-a*a)),h=Math.sqrt(u);this.kx=n*h*a,this.ky=n*h*u*(1-Ku)}distance(e,i){const n=Ln(e[0]-i[0])*this.kx,a=(e[1]-i[1])*this.ky;return Math.sqrt(n*n+a*a)}bearing(e,i){const n=Ln(i[0]-e[0])*this.kx;return Math.atan2(n,(i[1]-e[1])*this.ky)/wa}destination(e,i,n){const a=n*wa;return this.offset(e,Math.sin(a)*i,Math.cos(a)*i)}offset(e,i,n){return[e[0]+i/this.kx,e[1]+n/this.ky]}lineDistance(e){let i=0;for(let n=0;n<e.length-1;n++)i+=this.distance(e[n],e[n+1]);return i}area(e){let i=0;for(let n=0;n<e.length;n++){const a=e[n];for(let u=0,h=a.length,f=h-1;u<h;f=u++)i+=Ln(a[u][0]-a[f][0])*(a[u][1]+a[f][1])*(n?-1:1)}return Math.abs(i)/2*this.kx*this.ky}along(e,i){let n=0;if(i<=0)return e[0];for(let a=0;a<e.length-1;a++){const u=e[a],h=e[a+1],f=this.distance(u,h);if(n+=f,n>i)return Ec(u,h,(i-(n-f))/f)}return e[e.length-1]}pointToSegmentDistance(e,i,n){let[a,u]=i,h=Ln(n[0]-a)*this.kx,f=(n[1]-u)*this.ky;if(h!==0||f!==0){const _=(Ln(e[0]-a)*this.kx*h+(e[1]-u)*this.ky*f)/(h*h+f*f);_>1?(a=n[0],u=n[1]):_>0&&(a+=h/this.kx*_,u+=f/this.ky*_)}return h=Ln(e[0]-a)*this.kx,f=(e[1]-u)*this.ky,Math.sqrt(h*h+f*f)}pointOnLine(e,i){let n=1/0,a=e[0][0],u=e[0][1],h=0,f=0;for(let _=0;_<e.length-1;_++){let g=e[_][0],v=e[_][1],b=Ln(e[_+1][0]-g)*this.kx,w=(e[_+1][1]-v)*this.ky,E=0;b===0&&w===0||(E=(Ln(i[0]-g)*this.kx*b+(i[1]-v)*this.ky*w)/(b*b+w*w),E>
21?(g=e[_+1][0],v=e[_+1][1]):E>0&&(g+=b/this.kx*E,v+=w/this.ky*E)),b=Ln(i[0]-g)*this.kx,w=(i[1]-v)*this.ky;const I=b*b+w*w;I<n&&(n=I,a=g,u=v,h=_,f=E)}return{point:[a,u],index:h,t:Math.max(0,Math.min(1,f))}}lineSlice(e,i,n){let a=this.pointOnLine(n,e),u=this.pointOnLine(n,i);if(a.index>u.index||a.index===u.index&&a.t>u.t){const g=a;a=u,u=g}const h=[a.point],f=a.index+1,_=u.index;!Ju(n[f],h[0])&&f<=_&&h.push(n[f]);for(let g=f+1;g<=_;g++)h.push(n[g]);return Ju(n[_],u.point)||h.push(u.point),h}lineSliceAlong(e,i,n){let a=0;const u=[];for(let h=0;h<n.length-1;h++){const f=n[h],_=n[h+1],g=this.distance(f,_);if(a+=g,a>e&&u.length===0&&u.push(Ec(f,_,(e-(a-g))/g)),a>=i)return u.push(Ec(f,_,(i-(a-g))/g)),u;a>e&&u.push(_)}return u}bufferPoint(e,i){const n=i/this.ky,a=i/this.kx;return[e[0]-a,e[1]-n,e[0]+a,e[1]+n]}bufferBBox(e,i){const n=i/this.ky,a=i/this.kx;return[e[0]-a,e[1]-n,e[2]+a,e[3]+n]}insideBBox(e,i){return Ln(e[0]-i[0])>=0&&Ln(e[0]-i[2])<=0&&e[1]>=i[1]&&e[1]<=i[3]}}function Ju(r,e){return r[0]===e[0]&&r[1]===e[1]}function Ec(r,e,i){const n=Ln(e[0]-r[0]);return[r[0]+n*i,r[1]+(e[1]-r[1])*i]}function Ln(r){for(;r<-180;)r+=360;for(;r>180;)r-=360;return r}class wl{constructor(e=[],i=(n,a)=>n<a?-1:n>a?1:0){if(this.data=e,this.length=this.data.length,this.compare=i,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],i=this.data.pop();return--this.length>0&&(this.data[0]=i,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:i,compare:n}=this,a=i[e];for(;e>0;){const u=e-1>>1,h=i[u];if(n(a,h)>=0)break;i[e]=h,e=u}i[e]=a}_down(e){const{data:i,compare:n}=this,a=this.length>>1,u=i[e];for(;e<a;){let h=1+(e<<1);const f=h+1;if(f<this.length&&n(i[f],i[h])<0&&(h=f),n(i[h],u)>=0)break;i[e]=i[h],e=h}i[e]=u}}var We=8192;function Qu(r,e){return e.dist-r.dist}function eh(r){const e=[1/0,1/0,-1/0,-1/0];if(e.length!==r.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==r[i])return!1;return!0}function Tl(r){return r[1]-r[0]+1}function yo(r,e){const i=r[1]>=r[0]&&r[1]<e;return i||console.warn("Distance Expression: Index is out of range"),i}function th(r,e){if(r[0]>r[1])return[null,null];const i=Tl(r);if(e){if(i===2)return[r,null];const n=Math.floor(i/2);return[[r[0],r[0]+n],[r[0]+n,r[1]]]}{if(i===1)return[r,null];const n=Math.floor(i/2)-1;return[[r[0],r[0]+n],[r[0]+n+1,r[1]]]}}function qs(r,e){const i=[1/0,1/0,-1/0,-1/0];if(!yo(e,r.length))return i;for(let n=e[0];n<=e[1];++n)xl(i,r[n]);return i}function Hs(r){const e=[1/0,1/0,-1/0,-1/0];for(let i=0;i<r.length;++i)for(let n=0;n<r[i].length;++n)xl(e,r[i][n]);return e}function ms(r,e,i){if(eh(r)||eh(e))return NaN;let n=0,a=0;return r[2]<e[0]&&(n=e[0]-r[2]),r[0]>e[2]&&(n=r[0]-e[2]),r[1]>e[3]&&(a=r[1]-e[3]),r[3]<e[1]&&(a=e[1]-r[3]),i.distance([0,0],[n,a])}function Ic(r){return 360*r-180}function df(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function Ac(r,e){const i=Math.pow(2,e.z),n=(r.y/We+e.y)/i;return[Ic((r.x/We+e.x)/i),df(n)]}function Mm(r,e){const i=[];for(let n=0;n<r.length;++n)i.push(Ac(r[n],e));return i}function ff(r,e,i){const n=i.pointOnLine(e,r).point;return i.distance(r,n)}function ih(r,e,i,n,a){const u=i.slice(n[0],n[1]+1);let h=1/0;for(let f=e[0];f<=e[1];++f)if((h=Math.min(h,ff(r[f],u,a)))===0)return 0;return h}function _s(r,e,i,n,a){const u=Math.min(a.pointToSegmentDistance(r,i,n),a.pointToSegmentDistance(e,i,n)),h=Math.min(a.pointToSegmentDistance(i,r,e),a.pointToSegmentDistance(n,r,e));return Math.min(u,h)}function jt(r,e,i,n,a){if(!yo(e,r.length)||!yo(n,i.length))return NaN;let u=1/0;for(let h=e[0];h<e[1];++h)for(let f=n[0];f<n[1];++f){if(Tc(r[h],r[h+1],i[f],i[f+1]))return 0;u=Math.min(u,_s(r[h],r[h+1],i[f],i[f+1],a))}return u}function Cm(r,e,i,n,a){if(!yo(e,r.length)||!yo(n,i.length))return NaN;let u=1/0;for(let h=e[0];h<=e[1];++h)for(let f=n[0];f<=n[1];++f)if((u=Math.min(u,a.distance(r[h],i[f])))===0)return u;return u}function Pm(r,e,i){if(Xn(r,e,!0))return 0;let n=1/0;for(const a of e){const u=a.length;if(u<2)return console.warn("Distance Expression: Invalid polygon!"),NaN;if(a[0]!==a[u-1]&&(n=Math.min(n,i.pointToSegmentDistance(r,a[u-1],a[0])))===0||(n=Math.min(n,ff(r,a,i)))===0)return n}return n}
2function Rm(r,e,i,n){if(!yo(e,r.length))return NaN;for(let u=e[0];u<=e[1];++u)if(Xn(r[u],i,!0))return 0;let a=1/0;for(let u=e[0];u<e[1];++u)for(const h of i)for(let f=0,_=h.length,g=_-1;f<_;g=f++){if(Tc(r[u],r[u+1],h[g],h[f]))return 0;a=Math.min(a,_s(r[u],r[u+1],h[g],h[f],n))}return a}function rh(r,e){for(const i of r)for(let n=0;n<=i.length-1;++n)if(Xn(i[n],e,!0))return!0;return!1}function zm(r,e,i,n=1/0){const a=Hs(r),u=Hs(e);if(n!==1/0&&ms(a,u,i)>=n)return n;if(vl(a,u)){if(rh(r,e))return 0}else if(rh(e,r))return 0;let h=n;for(const f of r)for(let _=0,g=f.length,v=g-1;_<g;v=_++)for(const b of e)for(let w=0,E=b.length,I=E-1;w<E;I=w++){if(Tc(f[v],f[_],b[I],b[w]))return 0;h=Math.min(h,_s(f[v],f[_],b[I],b[w],i))}return h}function Ti(r,e,i,n,a,u,h){if(u===null||h===null)return;const f=ms(qs(n,u),qs(a,h),i);f<e&&r.push({dist:f,range1:u,range2:h})}function Dm(r,e,i,n,a=1/0){let u=Math.min(n.distance(r[0],i[0][0]),a);if(u===0)return u;const h=new wl([{dist:0,range1:[0,r.length-1],range2:[0,0]}],Qu),f=e?50:100,_=Hs(i);for(;h.length;){const g=h.pop();if(g.dist>=u)continue;const v=g.range1;if(Tl(v)<=f){if(!yo(v,r.length))return NaN;if(e){const b=Rm(r,v,i,n);if((u=Math.min(u,b))===0)return u}else for(let b=v[0];b<=v[1];++b){const w=Pm(r[b],i,n);if((u=Math.min(u,w))===0)return u}}else{const b=th(v,e);if(b[0]!==null){const w=ms(qs(r,b[0]),_,n);w<u&&h.push({dist:w,range1:b[0],range2:[0,0]})}if(b[1]!==null){const w=ms(qs(r,b[1]),_,n);w<u&&h.push({dist:w,range1:b[1],range2:[0,0]})}}}return u}function pf(r,e,i,n,a,u=1/0){let h=Math.min(u,a.distance(r[0],i[0]));if(h===0)return h;const f=new wl([{dist:0,range1:[0,r.length-1],range2:[0,i.length-1]}],Qu),_=e?50:100,g=n?50:100;for(;f.length;){const v=f.pop();if(v.dist>=h)continue;const b=v.range1,w=v.range2;if(Tl(b)<=_&&Tl(w)<=g){if(!yo(b,r.length)||!yo(w,i.length))return NaN;if(e&&n?h=Math.min(h,jt(r,b,i,w,a)):e||n?e&&!n?h=Math.min(h,ih(i,w,r,b,a)):!e&&n&&(h=Math.min(h,ih(r,b,i,w,a))):h=Math.min(h,Cm(r,b,i,w,a)),h===0)return h}else{const E=th(b,e),I=th(w,n);Ti(f,h,a,r,i,E[0],I[0]),Ti(f,h,a,r,i,E[0],I[1]),Ti(f,h,a,r,i,E[1],I[0]),Ti(f,h,a,r,i,E[1],I[1])}}return h}function nh(r,e,i,n,a=1/0){let u=a;const h=qs(r,[0,r.length-1]);for(const f of i)if(!(u!==1/0&&ms(h,qs(f,[0,f.length-1]),n)>=u)&&(u=Math.min(u,pf(r,e,f,!0,n,u)),u===0))return u;return u}function Mc(r,e,i,n,a=1/0){let u=a;const h=qs(r,[0,r.length-1]);for(const f of i){if(u!==1/0&&ms(h,Hs(f),n)>=u)continue;const _=Dm(r,e,f,n,u);if(isNaN(_))return _;if((u=Math.min(u,_))===0)return u}return u}function oh(r){return r==="Point"||r==="MultiPoint"||r==="LineString"||r==="MultiLineString"||r==="Polygon"||r==="MultiPolygon"}class $s{constructor(e,i){this.type=ht,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'distance' expression requires either one argument, but found ' ${e.length-1} instead.`);if(us(e[1])){const n=e[1];if(n.type==="FeatureCollection"){for(let a=0;a<n.features.length;++a)if(oh(n.features[a].geometry.type))return new $s(n,n.features[a].geometry)}else if(n.type==="Feature"){if(oh(n.geometry.type))return new $s(n,n.geometry)}else if(oh(n.type))return new $s(n,n)}return i.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].")}evaluate(e){const i=e.geometry(),n=e.canonicalID();if(i!=null&&n!=null){if(e.geometryType()==="Point")return(function(a,u,h){const f=[];for(const g of a)for(const v of g)f.push(Ac(v,u));const _=new Ta(f[0][1],"meters");return h.type==="Point"||h.type==="MultiPoint"||h.type==="LineString"?pf(f,!1,h.type==="Point"?[h.coordinates]:h.coordinates,h.type==="LineString",_):h.type==="MultiLineString"?nh(f,!1,h.coordinates,_):h.type==="Polygon"||h.type==="MultiPolygon"?Mc(f,!1,h.type==="Polygon"?[h.coordinates]:h.coordinates,_):null})(i,n,this.geometries);if(e.geometryType()==="LineString")return(function(a,u,h){const f=[];for(const g of a){const v=[];for(const b of g)v.push(Ac(b,u));f.push(v)}const _=new Ta(f[0][0][1],"meters");if(h.type==="Point"||h.type==="MultiPoint"||h.type==="LineString")return nh(h.type==="Point"?[h.coordinates]:h.coordinates,h.type==="LineString",f,_);if(h.type==="MultiLineString"){let g=1/0;for(let v=0;v<h.coordinates.length;v++){const b=nh(h.coordinates[v],!0,f,_,g);if(isNaN(b))return b;if((g=Math.min(g,b))===0)return g}return g}if(h.type==="Polygon"||h.type==="MultiPolygon"){let g=1/0;for(let v=0;v<f.length;v++){const b=Mc(f[v],!0,h.type==="Polygon"?[h.coordinates]:h.coordinates,_,g);if(isNaN(b))return b;if((g=Math.min(g,b))===0)return g}return g}return null})(i,n,this.geometries);if(e.geometryType()==="Polygon")return(function(a,u,h){const f=[];for(const g of(function(v){const b=v.length;if(b<=1)return[v];const w=[];let E,I;for(let P=0;P<b;P++){const D=Sm(v[P]);D!==0&&(v[P].area=Math.abs(D),I===void 0&&(I=D<0),I===D<0?(E&&w.push(E),E=[v[P]]):E.push(v[P]))}return E&&w.push(E),w})(a)){const v=[];for(let b=0;b<g.length;++b)v.push(Mm(g[b],u));f.push(v)}const _=new Ta(f[0][0][0][1],"meters");if(h.type==="Point"||h.type==="MultiPoint"||h.type==="LineString")return Mc(h.type==="Point"?[h.coordinates]:h.coordinates,h.type==="LineString",f,_);if(h.type==="MultiLineString"){let g=1/0;for(let v=0;v<h.coordinates.length;v++){const b=Mc(h.coordinates[v],!0,f,_,g);if(isNaN(b))return b;if((g=Math.min(g,b))===0)return g}return g}return h.type==="Polygon"||h.type==="MultiPolygon"?(function(g,v,b){let w=1/0;for(const E of g)for(const I of v){const P=zm(E,I,b,w);if(isNaN(P))return P;if((w=Math.min(w,P))===0)return w}return w})(h.type==="Polygon"?[h.coordinates]:h.coordinates,f,_):null})(i,n,this.geometries);console.warn("Distance Expression: currently only evaluates valid Point/LineString/Polygon geometries.")}else console.warn("Distance Expression: requirs valid feature and canonical information.");return null}eachChild(){}outputDefined(){return!0}serialize(){return["distance",this.geojson]}}function Sa(r){if(r instanceof fn&&(r.name==="get"&&r.args.length===1||r.name==="feature-state"||r.name==="has"&&r.args.length===1||r.name==="properties"||r.name==="geometry-type"||r.name==="id"||/^filter-/.test(r.name))||r instanceof ps||r instanceof $s)return!1;if(r instanceof Ia)return r.featureConstant;let e=!0;return r.eachChild(i=>{e&&!Sa(i)&&(e=!1)}),e}function Sl(r){if(r instanceof fn&&r.name==="feature-state")return!1;let e=!0;return r.eachChild(i=>{e&&!Sl(i)&&(e=!1)}),e}function Ea(r,e){if(r instanceof fn&&e.indexOf(r.name)>=0)return!1;let i=!0;return r.eachChild(n=>{i&&!Ea(n,e)&&(i=!1)}),i}
2function mf(r,e,i){return[r,e,i].filter(Boolean).join("�")}function sh(r,e){switch(r){case"string":return mo(e);case"number":return+e;case"boolean":return!!e;case"color":return ii.parse(e);case"formatted":return jr.fromString(mo(e));case"resolvedImage":return dn.build(mo(e))}return e}function _f(r,e,i,n){return n!==void 0&&(r=n*Math.round(r/n)),e!==void 0&&r<e&&(r=e),i!==void 0&&r>i&&(r=i),r}class Ia{constructor(e,i,n,a=!1){this.type=e,this.key=i,this.scope=n,this.featureConstant=a}static parse(e,i){let n=i.expectedType;if(n==null&&(n=oi),e.length<2||e.length>3)return i.error("Invalid number of arguments for 'config' expression.");const a=i.parse(e[1],1);if(!(a instanceof jo))return i.error("Key name of 'config' expression must be a string literal.");let u,h=!0;const f=mo(a.value);if(e.length>=3){const _=i.parse(e[2],2);if(!(_ instanceof jo))return i.error("Scope of 'config' expression must be a string literal.");u=mo(_.value)}if(i.options){const _=mf(f,u,i._scope),g=i.options.get(_);g&&(h=Sa(g.value||g.default))}return new Ia(n,f,u,h)}evaluate(e){const i=mf(this.key,this.scope,e.scope),n=e.getConfig(i);if(!n)return null;const{type:a,value:u,values:h,minValue:f,maxValue:_,stepValue:g}=n,v=n.default.evaluate(e);let b=v;if(u){const w=e.scope;e.scope=(w||"").split("�").slice(1).join("�"),b=u.evaluate(e),e.scope=w}return a&&(b=sh(a,b)),b===void 0||f===void 0&&_===void 0&&g===void 0||(typeof b=="number"?b=_f(b,f,_,g):Array.isArray(b)&&(b=b.map(w=>typeof w=="number"?_f(w,f,_,g):w))),u!==void 0&&b!==void 0&&h&&!h.includes(b)&&(b=v,a&&(b=sh(a,b))),(a&&a!==this.type||b!==void 0&&!yc(gr(b),this.type))&&(b=sh(this.type.kind,b)),b}eachChild(){}outputDefined(){return!1}serialize(){const e=["config",this.key];return this.scope&&e.concat(this.scope),e}}class Cc{constructor(e,i){this.type=i.type,this.name=e,this.boundExpression=i}static parse(e,i){if(e.length!==2||typeof e[1]!="string")return i.error("'var' expression requires exactly one string literal argument.");const n=e[1];return i.scope.has(n)?new Cc(n,i.scope.get(n)):i.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class Pc{constructor(e,i=[],n,a=new _c,u=[],h,f,_){this.registry=e,this.path=i,this.key=i.map(g=>typeof g=="string"?`['${g}']`:`[${g}]`).join(""),this.scope=a,this.errors=u,this.expectedType=n,this._scope=h,this.options=f,this.iconImageUseTheme=_}parse(e,i,n,a,u={}){return i||n?this.concat(i,null,n,a)._parse(e,u):this._parse(e,u)}parseObjectValue(e,i,n,a,u,h={}){return this.concat(i,n,a,u)._parse(e,h)}_parse(e,i){function n(a,u,h){return h==="assert"?new Et(u,[a]):h==="coerce"?new _o(u,[a]):a}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 a=typeof e[0]=="string"?this.registry[e[0]]:void 0;if(a){let u=a.parse(e,this);if(!u)return null;if(this.expectedType){const h=this.expectedType,f=u.type;if(h.kind!=="string"&&h.kind!=="number"&&h.kind!=="boolean"&&h.kind!=="object"&&h.kind!=="array"||f.kind!=="value")if(h.kind!=="color"&&h.kind!=="formatted"&&h.kind!=="resolvedImage"||f.kind!=="value"&&f.kind!=="string"){if(this.checkSubtype(h,f))return null}else u=n(u,h,i.typeAnnotation||"coerce");else u=n(u,h,i.typeAnnotation||"assert")}if(!(u instanceof jo)&&u.type.kind!=="resolvedImage"&&ah(u)){const h=new ba(this._scope,this.options,this.iconImageUseTheme);try{u=new jo(u.type,u.evaluate(h))}catch(f){return this.error(f.message),null}}return u}return _o.parse(["to-array",e],this)}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,i,n,a){let u=typeof e=="number"?this.path.concat(e):this.path;u=typeof i=="string"?u.concat(i):u;const h=a?this.scope.concat(a):this.scope;
vendor: 33,205 bytes, line 2
2return new Pc(this.registry,u,n||null,h,this.errors,this._scope,this.options,this.iconImageUseTheme)}error(e,...i){const n=`${this.key}${i.map(a=>`[${a}]`).join("")}`;this.errors.push(new Xr(n,e))}checkSubtype(e,i){const n=_l(e,i);return n&&this.error(n),n}}function ah(r){if(r instanceof Cc)return ah(r.boundExpression);if(r instanceof fn&&r.name==="error"||r instanceof go||r instanceof ps||r instanceof $s||r instanceof Ia)return!1;const e=r instanceof _o||r instanceof Et;let i=!0;return r.eachChild(n=>{i=e?i&&ah(n):i&&n instanceof jo}),!!i&&Sa(r)&&Ea(r,["zoom","heatmap-density","worldview","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])}function Rc(r,e){const i=r.length-1;let n,a,u=0,h=i,f=0;for(;u<=h;)if(f=Math.floor((u+h)/2),n=r[f],a=r[f+1],n<=e){if(f===i||e<a)return f;u=f+1}else{if(!(n>e))throw new ur("Input is not a number.");h=f-1}return 0}class El{constructor(e,i,n){this.type=e,this.input=i,this.labels=[],this.outputs=[];for(const[a,u]of n)this.labels.push(a),this.outputs.push(u)}static parse(e,i){if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");const n=i.parse(e[1],1,ht);if(!n)return null;const a=[];let u=null;i.expectedType&&i.expectedType.kind!=="value"&&(u=i.expectedType);for(let h=1;h<e.length;h+=2){const f=h===1?-1/0:e[h],_=e[h+1],g=h,v=h+1;if(typeof f!="number")return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',g);if(a.length&&a[a.length-1][0]>=f)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',g);const b=i.parse(_,v,u);if(!b)return null;u=u||b.type,a.push([f,b])}return new El(u,n,a)}evaluate(e){const i=this.labels,n=this.outputs;if(i.length===1)return n[0].evaluate(e);const a=this.input.evaluate(e);if(a<=i[0])return n[0].evaluate(e);const u=i.length;return a>=i[u-1]?n[u-1].evaluate(e):n[Rc(i,a)].evaluate(e)}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){const e=["step",this.input.serialize()];for(let i=0;i<this.labels.length;i++)i>0&&e.push(this.labels[i]),e.push(this.outputs[i].serialize());return e}}const gf=.95047,yf=1.08883,xf=4/29,Aa=6/29,vf=3*Aa*Aa,Lm=Aa*Aa*Aa,Fm=Math.PI/180,Om=180/Math.PI;function lh(r){return r>Lm?Math.pow(r,1/3):r/vf+xf}function ch(r){return r>Aa?r*r*r:vf*(r-xf)}function uh(r){return 255*(r<=.0031308?12.92*r:1.055*Math.pow(r,1/2.4)-.055)}function hh(r){return(r/=255)<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function bf(r){const e=hh(r.r),i=hh(r.g),n=hh(r.b),a=lh((.4124564*e+.3575761*i+.1804375*n)/gf),u=lh((.2126729*e+.7151522*i+.072175*n)/1);return{l:116*u-16,a:500*(a-u),b:200*(u-lh((.0193339*e+.119192*i+.9503041*n)/yf)),alpha:r.a}}function zc(r){let e=(r.l+16)/116,i=isNaN(r.a)?e:e+r.a/500,n=isNaN(r.b)?e:e-r.b/200;return e=1*ch(e),i=gf*ch(i),n=yf*ch(n),new ii(uh(3.2404542*i-1.5371385*e-.4985314*n),uh(-.969266*i+1.8760108*e+.041556*n),uh(.0556434*i-.2040259*e+1.0572252*n),r.alpha)}function Dc(r,e,i){const n=e-r;return r+i*(n>180||n<-180?n-360*Math.round(n/360):n)}const Ma={forward:bf,reverse:zc,interpolate:function(r,e,i){return{l:_t(r.l,e.l,i),a:_t(r.a,e.a,i),b:_t(r.b,e.b,i),alpha:_t(r.alpha,e.alpha,i)}}},Il={forward:function(r){const{l:e,a:i,b:n}=bf(r),a=Math.atan2(n,i)*Om;return{h:a<0?a+360:a,c:Math.sqrt(i*i+n*n),l:e,alpha:r.a}},reverse:function(r){const e=r.h*Fm,i=r.c;return zc({l:r.l,a:Math.cos(e)*i,b:Math.sin(e)*i,alpha:r.alpha})},interpolate:function(r,e,i){return{h:Dc(r.h,e.h,i),c:_t(r.c,e.c,i),l:_t(r.l,e.l,i),alpha:_t(r.alpha,e.alpha,i)}}};var wf=Object.freeze({__proto__:null,hcl:Il,lab:Ma});class Fn{constructor(e,i,n,a,u){this.type=e,this.operator=i,this.interpolation=n,this.input=a,this.labels=[],this.outputs=[];for(const[h,f]of u)this.labels.push(h),this.outputs.push(f)}static interpolationFactor(e,i,n,a){let u=0;if(e.name==="exponential")u=Lc(i,e.base,n,a);else if(e.name==="linear")u=Lc(i,1,n,a);else if(e.name==="cubic-bezier"){const h=e.controlPoints;u=new fa(h[0],h[1],h[2],h[3]).solve(Lc(i,1,n,a))}return u}static parse(e,i){let[n,a,u,...h]=e;if(!Array.isArray(a)||a.length===0)return i.error("Expected an interpolation type expression.",1);if(a[0]==="linear")a={name:"linear"};else if(a[0]==="exponential"){const g=a[1];if(typeof g!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);a={name:"exponential",base:g}}else{if(a[0]!=="cubic-bezier")return i.error(`Unknown interpolation type ${String(a[0])}`,1,0);{const g=a.slice(1);if(g.length!==4||g.some(v=>typeof v!="number"||v<0||v>1))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);a={name:"cubic-bezier",controlPoints:g}}}if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length-1>3&&(e.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(u=i.parse(u,2,ht),!u)return null;const f=[];let _=null;n==="interpolate-hcl"||n==="interpolate-lab"?_=Yr:i.expectedType&&i.expectedType.kind!=="value"&&(_=i.expectedType);for(let g=0;g<h.length;g+=2){const v=h[g],b=h[g+1],w=g+3,E=g+4;if(typeof v!="number")return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',w);if(f.length&&f[f.length-1][0]>=v)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',w);const I=i.parse(b,E,_);if(!I)return null;_=_||I.type,f.push([v,I])}return _.kind==="number"||_.kind==="color"||_.kind==="array"&&_.itemType.kind==="number"&&typeof _.N=="number"?new Fn(_,n,a,u,f):i.error(`Type ${er(_)} is not interpolatable.`)}evaluate(e){const i=this.labels,n=this.outputs;if(i.length===1)return n[0].evaluate(e);const a=this.input.evaluate(e);if(a<=i[0])return n[0].evaluate(e);const u=i.length;if(a>=i[u-1])return n[u-1].evaluate(e);const h=Rc(i,a),f=Fn.interpolationFactor(this.interpolation,a,i[h],i[h+1]),_=n[h].evaluate(e),g=n[h+1].evaluate(e);return this.operator==="interpolate"?js[this.type.kind.toLowerCase()](_,g,f):this.operator==="interpolate-hcl"?Il.reverse(Il.interpolate(Il.forward(_),Il.forward(g),f)):Ma.reverse(Ma.interpolate(Ma.forward(_),Ma.forward(g),f))}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){let e;e=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier",...this.interpolation.controlPoints];const i=[this.operator,e,this.input.serialize()];for(let n=0;n<this.labels.length;n++)i.push(this.labels[n],this.outputs[n].serialize());return i}}function Lc(r,e,i,n){const a=n-i,u=r-i;return a===0?0:e===1?u/a:(Math.pow(e,u)-1)/(Math.pow(e,a)-1)}class Al{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expectected at least one argument.");let n=null;const a=i.expectedType;a&&a.kind!=="value"&&(n=a);const u=[];for(const f of e.slice(1)){const _=i.parse(f,1+u.length,n,void 0,{typeAnnotation:"omit"});if(!_)return null;n=n||_.type,u.push(_)}const h=a&&u.some(f=>_l(a,f.type));return new Al(h?oi:n,u)}evaluate(e){let i,n=null,a=0;for(const u of this.args){if(a++,n=u.evaluate(e),n&&n instanceof dn&&!n.available&&(i||(i=n),n=null,a===this.args.length))return i;if(n!==null)break}return n}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=["coalesce"];return this.eachChild(i=>{e.push(i.serialize())}),e}}class qo{constructor(e,i){this.type=i.type,this.bindings=[].concat(e),this.result=i}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const i of this.bindings)e(i[1]);e(this.result)}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const n=[];for(let u=1;u<e.length-1;u+=2){const h=e[u];if(typeof h!="string")return i.error(`Expected string, but found ${typeof h} instead.`,u);if(/[^a-zA-Z0-9_]/.test(h))return i.error("Variable names must contain only alphanumeric characters or '_'.",u);const f=i.parse(e[u+1],u+1);if(!f)return null;n.push([h,f])}const a=i.parse(e[e.length-1],e.length-1,i.expectedType,n);return a?new qo(n,a):null}outputDefined(){return this.result.outputDefined()}serialize(){const e=["let"];for(const[i,n]of this.bindings)e.push(i,n.serialize());return e.push(this.result.serialize()),e}}class Fc{constructor(e,i,n){this.type=e,this.index=i,this.input=n}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=i.parse(e[1],1,ht),a=i.parse(e[2],2,Ur(i.expectedType||oi));return n&&a?new Fc(a.type.itemType,n,a):null}evaluate(e){const i=this.index.evaluate(e),n=this.input.evaluate(e);if(i<0)throw new ur("Array index out of bounds: negative index");if(i>=n.length)throw new ur("Array index out of bounds: index exceeds array size");if(i!==Math.floor(i))throw new ur("Array index must be an integer. Use at-interpolated for fractional indices");return n[i]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class Oc{constructor(e,i,n){this.type=e,this.index=i,this.input=n}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=i.parse(e[1],1,ht),a=i.parse(e[2],2,Ur(i.expectedType||oi));return n&&a?new Oc(a.type.itemType,n,a):null}evaluate(e){const i=this.index.evaluate(e),n=this.input.evaluate(e);if(i<0)throw new ur(`Array index out of bounds: ${i} < 0.`);if(i>n.length-1)throw new ur(`Array index out of bounds: ${i} > ${n.length-1}.`);if(i===Math.floor(i))return n[i];const a=Math.floor(i),u=Math.ceil(i),h=n[a],f=n[u];if(typeof h!="number"||typeof f!="number")throw new ur(`Cannot interpolate between non-number values at index ${i}.`);const _=i-a;return h*(1-_)+f*_}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class dh{constructor(e,i){this.type=Yt,this.needle=e,this.haystack=i}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=i.parse(e[1],1,oi),a=i.parse(e[2],2,oi);return n&&a?ju(n.type,[Yt,ti,ht,un,oi])?new dh(n,a):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${er(n.type)} instead`):null}evaluate(e){const i=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(n==null)return!1;if(!gl(i,["boolean","string","number","null"]))throw new ur(`Expected first argument to be of type boolean, string, number or null, but found ${er(gr(i))} instead.`);if(!gl(n,["string","array"]))throw new ur(`Expected second argument to be of type array or string, but found ${er(gr(n))} instead.`);return n.indexOf(i)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class Ca{constructor(e,i,n){this.type=ht,this.needle=e,this.haystack=i,this.fromIndex=n}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const n=i.parse(e[1],1,oi),a=i.parse(e[2],2,oi);if(!n||!a)return null;if(!ju(n.type,[Yt,ti,ht,un,oi]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${er(n.type)} instead`);if(e.length===4){const u=i.parse(e[3],3,ht);return u?new Ca(n,a,u):null}return new Ca(n,a)}evaluate(e){const i=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!gl(i,["boolean","string","number","null"]))throw new ur(`Expected first argument to be of type boolean, string, number or null, but found ${er(gr(i))} instead.`);if(!gl(n,["string","array"]))throw new ur(`Expected second argument to be of type array or string, but found ${er(gr(n))} instead.`);if(this.fromIndex){const a=this.fromIndex.evaluate(e);return n.indexOf(i,a)}return n.indexOf(i)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}serialize(){if(this.fromIndex!=null&&this.fromIndex!==void 0){const e=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),e]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class Ml{constructor(e,i,n,a,u,h){this.inputType=e,this.type=i,this.input=n,this.cases=a,this.outputs=u,this.otherwise=h}static parse(e,i){if(e.length<5)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return i.error("Expected an even number of arguments.");let n,a;i.expectedType&&i.expectedType.kind!=="value"&&(a=i.expectedType);const u={},h=[];for(let g=2;g<e.length-1;g+=2){let v=e[g];const b=e[g+1];Array.isArray(v)||(v=[v]);const w=i.concat(g);if(v.length===0)return w.error("Expected at least one branch label.");for(const I of v){if(typeof I!="number"&&typeof I!="string")return w.error("Branch labels must be numbers or strings.");if(typeof I=="number"&&Math.abs(I)>Number.MAX_SAFE_INTEGER)return w.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof I=="number"&&Math.floor(I)!==I)return w.error("Numeric branch labels must be integer values.");if(n){if(w.checkSubtype(n,gr(I)))return null}else n=gr(I);if(u[String(I)]!==void 0)return w.error("Branch labels must be unique.");u[String(I)]=h.length}const E=i.parse(b,g,a);if(!E)return null;a=a||E.type,h.push(E)}const f=i.parse(e[1],1,oi);if(!f)return null;const _=i.parse(e[e.length-1],e.length-1,a);return _?f.type.kind!=="value"&&i.concat(1).checkSubtype(n,f.type)?null:new Ml(n,a,f,u,h,_):null}evaluate(e){const i=this.input.evaluate(e);return(yc(gr(i),this.inputType)&&this.outputs[this.cases[i]]||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()}serialize(){const e=["match",this.input.serialize()],i=Object.keys(this.cases).sort(),n=[],a={};for(const h of i){const f=a[this.cases[h]];f===void 0?(a[this.cases[h]]=n.length,n.push([this.cases[h],[h]])):n[f][1].push(h)}const u=h=>this.inputType.kind==="number"?Number(h):h;for(const[h,f]of n)e.push(f.length===1?u(f[0]):f.map(u)),e.push(this.outputs[h].serialize());return e.push(this.otherwise.serialize()),e}}class Cl{constructor(e,i,n){this.type=e,this.branches=i,this.otherwise=n}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return i.error("Expected an odd number of arguments.");let n;i.expectedType&&i.expectedType.kind!=="value"&&(n=i.expectedType);const a=[];for(let h=1;h<e.length-1;h+=2){const f=i.parse(e[h],h,Yt);if(!f)return null;const _=i.parse(e[h+1],h+1,n);if(!_)return null;a.push([f,_]),n=n||_.type}const u=i.parse(e[e.length-1],e.length-1,n);return u?new Cl(n,a,u):null}evaluate(e){for(const[i,n]of this.branches)if(i.evaluate(e))return n.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[i,n]of this.branches)e(i),e(n);e(this.otherwise)}outputDefined(){return this.branches.every(([e,i])=>i.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["case"];return this.eachChild(i=>{e.push(i.serialize())}),e}}class kc{constructor(e,i,n,a){this.type=e,this.input=i,this.beginIndex=n,this.endIndex=a}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const n=i.parse(e[1],1,oi),a=i.parse(e[2],2,ht);if(!n||!a)return null;if(!ju(n.type,[Ur(oi),ti,oi]))return i.error(`Expected first argument to be of type array or string, but found ${er(n.type)} instead`);if(e.length===4){const u=i.parse(e[3],3,ht);return u?new kc(n.type,n,a,u):null}return new kc(n.type,n,a)}evaluate(e){const i=this.input.evaluate(e),n=this.beginIndex.evaluate(e);if(!gl(i,["string","array"]))throw new ur(`Expected first argument to be of type array or string, but found ${er(gr(i))} instead.`);if(this.endIndex){const a=this.endIndex.evaluate(e);return i.slice(n,a)}return i.slice(n)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&&this.endIndex!==void 0){const e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}class fh{constructor(e,i){this.type=Ur(ti),this.str=e,this.delimiter=i}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=i.parse(e[1],1,ti),a=i.parse(e[2],2,ti);return n&&a?new fh(n,a):void 0}evaluate(e){const i=this.str.evaluate(e),n=this.delimiter.evaluate(e);return i.split(n)}eachChild(e){e(this.str),e(this.delimiter)}outputDefined(){return!1}serialize(){return["split",this.str.serialize(),this.delimiter.serialize()]}}function ph(r,e){return r==="=="||r==="!="?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 mh(r,e,i,n){return n.compare(e,i)===0}function Pa(r,e,i){const n=r!=="=="&&r!=="!=";return class i1{constructor(u,h,f){this.type=Yt,this.lhs=u,this.rhs=h,this.collator=f,this.hasUntypedArgument=u.type.kind==="value"||h.type.kind==="value"}static parse(u,h){if(u.length!==3&&u.length!==4)return h.error("Expected two or three arguments.");const f=u[0];let _=h.parse(u[1],1,oi);if(!_)return null;if(!ph(f,_.type))return h.concat(1).error(`"${f}" comparisons are not supported for type '${er(_.type)}'.`);let g=h.parse(u[2],2,oi);if(!g)return null;if(!ph(f,g.type))return h.concat(2).error(`"${f}" comparisons are not supported for type '${er(g.type)}'.`);if(_.type.kind!==g.type.kind&&_.type.kind!=="value"&&g.type.kind!=="value")return h.error(`Cannot compare types '${er(_.type)}' and '${er(g.type)}'.`);n&&(_.type.kind==="value"&&g.type.kind!=="value"?_=new Et(g.type,[_]):_.type.kind!=="value"&&g.type.kind==="value"&&(g=new Et(_.type,[g])));let v=null;if(u.length===4){if(_.type.kind!=="string"&&g.type.kind!=="string"&&_.type.kind!=="value"&&g.type.kind!=="value")return h.error("Cannot use collator to compare non-string types.");if(v=h.parse(u[3],3,gc),!v)return null}return new i1(_,g,v)}evaluate(u){const h=this.lhs.evaluate(u),f=this.rhs.evaluate(u);if(n&&this.hasUntypedArgument){const _=gr(h),g=gr(f);if(_.kind!==g.kind||_.kind!=="string"&&_.kind!=="number")throw new ur(`Expected arguments for "${r}" to be (string, string) or (number, number), but found (${_.kind}, ${g.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const _=gr(h),g=gr(f);if(_.kind!=="string"||g.kind!=="string")return e(u,h,f)}return this.collator?i(u,h,f,this.collator.evaluate(u)):e(u,h,f)}eachChild(u){u(this.lhs),u(this.rhs),this.collator&&u(this.collator)}outputDefined(){return!0}serialize(){const u=[r];return this.eachChild(h=>{u.push(h.serialize())}),u}}}const km=Pa("==",function(r,e,i){return e===i},mh),Bm=Pa("!=",function(r,e,i){return e!==i},function(r,e,i,n){return!mh(0,e,i,n)}),Tf=Pa("<",function(r,e,i){return e<i},function(r,e,i,n){return n.compare(e,i)<0}),Sf=Pa(">",function(r,e,i){return e>i},function(r,e,i,n){return n.compare(e,i)>0}),Bc=Pa("<=",function(r,e,i){return e<=i},function(r,e,i,n){return n.compare(e,i)<=0}),Nm=Pa(">=",function(r,e,i){return e>=i},function(r,e,i,n){return n.compare(e,i)>=0});class Nc{constructor(e,i,n,a,u,h){this.type=ti,this.number=e,this.locale=i,this.currency=n,this.unit=a,this.minFractionDigits=u,this.maxFractionDigits=h}static parse(e,i){if(e.length!==3)return i.error("Expected two arguments.");const n=i.parse(e[1],1,ht);if(!n)return null;const a=e[2];if(typeof a!="object"||Array.isArray(a))return i.error("NumberFormat options argument must be an object.");let u=null;if(a.locale&&(u=i.parseObjectValue(a.locale,2,"locale",ti),!u))return null;let h=null;if(a.currency&&(h=i.parseObjectValue(a.currency,2,"currency",ti),!h))return null;let f=null;if(a.unit&&(f=i.parseObjectValue(a.unit,2,"unit",ti),!f))return null;let _=null;if(a["min-fraction-digits"]&&(_=i.parseObjectValue(a["min-fraction-digits"],2,"min-fraction-digits",ht),!_))return null;let g=null;return a["max-fraction-digits"]&&(g=i.parseObjectValue(a["max-fraction-digits"],2,"max-fraction-digits",ht),!g)?null:new Nc(n,u,h,f,_,g)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.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.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const e={};return this.locale&&(e.locale=this.locale.serialize()),this.currency&&(e.currency=this.currency.serialize()),this.unit&&(e.unit=this.unit.serialize()),this.minFractionDigits&&(e["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(e["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),e]}}class _h{constructor(e){this.type=ht,this.input=e}static parse(e,i){if(e.length!==2)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);const n=i.parse(e[1],1);return n?n.type.kind!=="array"&&n.type.kind!=="string"&&n.type.kind!=="value"?i.error(`Expected argument of type string or array, but found ${er(n.type)} instead.`):new _h(n):null}evaluate(e){const i=this.input.evaluate(e);if(typeof i=="string"||Array.isArray(i))return i.length;throw new ur(`Expected value to be of type string or array, but found ${er(gr(i))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){const e=["length"];return this.eachChild(i=>{e.push(i.serialize())}),e}}function Ef(r){return function(){r=1831565813+(r|=0)|0;let e=Math.imul(r^r>>>15,1|r);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}const Zs={"==":km,"!=":Bm,">":Sf,"<":Tf,">=":Nm,"<=":Bc,array:Et,at:Fc,"at-interpolated":Oc,boolean:Et,case:Cl,coalesce:Al,collator:go,format:ut,image:va,in:dh,"index-of":Ca,interpolate:Fn,"interpolate-hcl":Fn,"interpolate-lab":Fn,length:_h,let:qo,literal:jo,match:Ml,number:Et,"number-format":Nc,object:Et,slice:kc,step:El,string:Et,"to-boolean":_o,"to-color":_o,"to-number":_o,"to-string":_o,var:Cc,within:ps,distance:$s,config:Ia,split:fh};function gh(r,[e,i,n,a]){e=e.evaluate(r),i=i.evaluate(r),n=n.evaluate(r);const u=a?a.evaluate(r):1,h=qu(e,i,n,u);if(h)throw new ur(h);return new ii(e/255,i/255,n/255,u)}function If(r,[e,i,n,a]){e=e.evaluate(r),i=i.evaluate(r),n=n.evaluate(r);const u=a?a.evaluate(r):1,h=(function(g,v,b,w){return typeof g=="number"&&g>=0&&g<=360?typeof v=="number"&&v>=0&&v<=100&&typeof b=="number"&&b>=0&&b<=100?w===void 0||typeof w=="number"&&w>=0&&w<=1?null:`Invalid hsla value [${[g,v,b,w].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(typeof w=="number"?[g,v,b,w]:[g,v,b]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(typeof w=="number"?[g,v,b,w]:[g,v,b]).join(", ")}]: 'h' must be between 0 and 360.`})(e,i,n,u);if(h)throw new ur(h);const f=`hsla(${e}, ${i}%, ${n}%, ${u})`,_=ii.parse(f);if(!_)throw new ur(`Failed to parse HSLA color: ${f}`);return _}function Af(r,e){return r in e}function yh(r,e){const i=e[r];return i===void 0?null:i}function gs(r){return{type:r}}function Ws(r){if(r instanceof Ia)return new Set([r.key]);let e=new Set;return r.eachChild(i=>{e=new Set([...e,...Ws(i)])}),e}function Vc(r){if(r instanceof fn&&r.name==="is-active-floor")return!0;let e=!1;return r.eachChild(i=>{!e&&Vc(i)&&(e=!0)}),e}function Mf(r){return{result:"success",value:r}}function ys(r){return{result:"error",value:r}}function xh(r,e){return!!r&&!!r.parameters&&r.parameters.indexOf(e)>-1}function Uc(r){return r["property-type"]==="data-driven"}function vh(r){return xh(r.expression,"measure-light")}function Cf(r){return xh(r.expression,"zoom")}function bh(r){return!!r.expression&&r.expression.interpolated}function jc(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function Pf(r){return r}function wh(r,e){const i=e.type==="color",n=r.stops&&typeof r.stops[0][0]=="object",a=n||!(n||r.property!==void 0),u=r.type||(bh(e)?"exponential":"interval");if(i&&((r=Object.assign({},r)).stops&&(r.stops=r.stops.map(g=>[g[0],ii.parse(g[1])])),r.default=ii.parse(r.default?r.default:e.default)),r.colorSpace&&r.colorSpace!=="rgb"&&!wf[r.colorSpace])throw new Error(`Unknown color space: ${r.colorSpace}`);let h,f,_;if(u==="exponential")h=Rf;else if(u==="interval")h=Vm;else if(u==="categorical"){h=Ra,f=Object.create(null);for(const g of r.stops)f[g[0]]=g[1];_=typeof r.stops[0][0]}else{if(u!=="identity")throw new Error(`Unknown function type "${u}"`);h=Um}if(n){const g={},v=[];for(let E=0;E<r.stops.length;E++){const I=r.stops[E],P=I[0].zoom;g[P]===void 0&&(g[P]={zoom:P,type:r.type,property:r.property,default:r.default,stops:[]},v.push(P)),g[P].stops.push([I[0].value,I[1]])}const b=[];for(const E of v)b.push([g[E].zoom,wh(g[E],e)]);const w={name:"linear"};return{kind:"composite",interpolationType:w,interpolationFactor:Fn.interpolationFactor.bind(void 0,w),zoomStops:b.map(E=>E[0]),evaluate:({zoom:E},I)=>Rf({stops:b,base:r.base},e,E).evaluate(E,I)}}if(a){const g=u==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:g,interpolationFactor:Fn.interpolationFactor.bind(void 0,g),zoomStops:r.stops.map(v=>v[0]),evaluate:({zoom:v})=>h(r,e,v,f,_)}}return{kind:"source",evaluate(g,v){const b=v&&v.properties?v.properties[r.property]:void 0;return b===void 0?Pl(r.default,e.default):h(r,e,b,f,_)}}}function Pl(r,e,i){return r!==void 0?r:e!==void 0?e:i!==void 0?i:void 0}function Ra(r,e,i,n,a){return Pl(typeof i===a?n[i]:void 0,r.default,e.default)}function Vm(r,e,i){if(!gt(i))return Pl(r.default,e.default);const n=r.stops.length;if(n===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[n-1][0])return r.stops[n-1][1];const a=Rc(r.stops.map(u=>u[0]),i);return r.stops[a][1]}function Rf(r,e,i){const n=r.base!==void 0?r.base:1;if(!gt(i))return Pl(r.default,e.default);const a=r.stops.length;if(a===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[a-1][0])return r.stops[a-1][1];const u=Rc(r.stops.map(v=>v[0]),i),h=(function(v,b,w,E){const I=E-w,P=v-w;return I===0?0:b===1?P/I:(Math.pow(b,P)-1)/(Math.pow(b,I)-1)})(i,n,r.stops[u][0],r.stops[u+1][0]),f=r.stops[u][1],_=r.stops[u+1][1];let g=js[e.type]||Pf;if(r.colorSpace&&r.colorSpace!=="rgb"){const v=wf[r.colorSpace];g=(b,w)=>v.reverse(v.interpolate(v.forward(b),v.forward(w),h))}return typeof f.evaluate=="function"?{evaluate(...v){const b=f.evaluate.apply(void 0,v),w=_.evaluate.apply(void 0,v);if(b!==void 0&&w!==void 0)return g(b,w,h)}}:g(f,_,h)}function Um(r,e,i){return e.type==="color"?i=ii.parse(i):e.type==="formatted"?i=jr.fromString(i.toString()):e.type==="resolvedImage"?i=dn.build(i.toString()):vt(i)===e.type||e.type==="enum"&&e.values[i]||(i=void 0),Pl(i,r.default,e.default)}fn.register(Zs,{error:[{kind:"error"},[ti],(r,[e])=>{throw new ur(e.evaluate(r))}],typeof:[ti,[oi],(r,[e])=>er(gr(e.evaluate(r)))],"to-rgba":[Ur(ht,4),[Yr],(r,[e])=>e.evaluate(r).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[Ur(ht,4),[Yr],(r,[e])=>e.evaluate(r).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[Yr,[ht,ht,ht],gh],rgba:[Yr,[ht,ht,ht,ht],gh],hsl:[Yr,[ht,ht,ht],If],hsla:[Yr,[ht,ht,ht,ht],If],has:{type:Yt,overloads:[[[ti],(r,[e])=>Af(e.evaluate(r),r.properties())],[[ti,ya],(r,[e,i])=>Af(e.evaluate(r),i.evaluate(r))]]},get:{type:oi,overloads:[[[ti],(r,[e])=>yh(e.evaluate(r),r.properties())],[[ti,ya],(r,[e,i])=>yh(e.evaluate(r),i.evaluate(r))]]},"feature-state":[oi,[ti],(r,[e])=>yh(e.evaluate(r),r.featureState||{})],properties:[ya,[],r=>r.properties()],"geometry-type":[ti,[],r=>r.geometryType()],worldview:[ti,[],r=>r.globals.worldview||""],"is-active-floor":[Yt,gs(ti),(r,e)=>{if(!(r.globals.activeFloors&&r.globals.activeFloors.size>0))return!1;const i=r.globals.activeFloors;return e.some(n=>{const a=n.evaluate(r);return i.has(a)})}],id:[oi,[],r=>r.id()],zoom:[ht,[],r=>r.globals.zoom],pitch:[ht,[],r=>r.globals.pitch||0],"distance-from-center":[ht,[],r=>r.distanceFromCenter()],"measure-light":[ht,[ti],(r,[e])=>r.measureLight(e.evaluate(r))],"heatmap-density":[ht,[],r=>r.globals.heatmapDensity||0],"line-progress":[ht,[],r=>r.globals.lineProgress||0],"raster-value":[ht,[],r=>r.globals.rasterValue||0],"raster-particle-speed":[ht,[],r=>r.globals.rasterParticleSpeed||0],"sky-radial-progress":[ht,[],r=>r.globals.skyRadialProgress||0],accumulated:[oi,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[ht,gs(ht),(r,e)=>{let i=0;for(const n of e)i+=n.evaluate(r);return i}],"*":[ht,gs(ht),(r,e)=>{let i=1;for(const n of e)i*=n.evaluate(r);return i}],"-":{type:ht,overloads:[[[ht,ht],(r,[e,i])=>e.evaluate(r)-i.evaluate(r)],[[ht],(r,[e])=>-e.evaluate(r)]]},"/":[ht,[ht,ht],(r,[e,i])=>e.evaluate(r)/i.evaluate(r)],"%":[ht,[ht,ht],(r,[e,i])=>e.evaluate(r)%i.evaluate(r)],ln2:[ht,[],()=>Math.LN2],pi:[ht,[],()=>Math.PI],e:[ht,[],()=>Math.E],"^":[ht,[ht,ht],(r,[e,i])=>Math.pow(e.evaluate(r),i.evaluate(r))],sqrt:[ht,[ht],(r,[e])=>Math.sqrt(e.evaluate(r))],log10:[ht,[ht],(r,[e])=>Math.log(e.evaluate(r))/Math.LN10],ln:[ht,[ht],(r,[e])=>Math.log(e.evaluate(r))],log2:[ht,[ht],(r,[e])=>Math.log2(e.evaluate(r))],sin:[ht,[ht],(r,[e])=>Math.sin(e.evaluate(r))],cos:[ht,[ht],(r,[e])=>Math.cos(e.evaluate(r))],tan:[ht,[ht],(r,[e])=>Math.tan(e.evaluate(r))],asin:[ht,[ht],(r,[e])=>Math.asin(e.evaluate(r))],acos:[ht,[ht],(r,[e])=>Math.acos(e.evaluate(r))],atan:[ht,[ht],(r,[e])=>Math.atan(e.evaluate(r))],min:[ht,gs(ht),(r,e)=>Math.min(...e.map(i=>i.evaluate(r)))],max:[ht,gs(ht),(r,e)=>Math.max(...e.map(i=>i.evaluate(r)))],abs:[ht,[ht],(r,[e])=>Math.abs(e.evaluate(r))],round:[ht,[ht],(r,[e])=>{const i=e.evaluate(r);return i<0?-Math.round(-i):Math.round(i)}],floor:[ht,[ht],(r,[e])=>Math.floor(e.evaluate(r))],ceil:[ht,[ht],(r,[e])=>Math.ceil(e.evaluate(r))],"filter-==":[Yt,[ti,oi],(r,[e,i])=>r.properties()[e.value]===i.value],"filter-id-==":[Yt,[oi],(r,[e])=>r.id()===e.value],"filter-type-==":[Yt,[ti],(r,[e])=>r.geometryType()===e.value],"filter-<":[Yt,[ti,oi],(r,[e,i])=>{const n=r.properties()[e.value],a=i.value;return typeof n==typeof a&&n<a}],"filter-id-<":[Yt,[oi],(r,[e])=>{const i=r.id(),n=e.value;return typeof i==typeof n&&i<n}],"filter->":[Yt,[ti,oi],(r,[e,i])=>{const n=r.properties()[e.value],a=i.value;return typeof n==typeof a&&n>a}],"filter-id->":[Yt,[oi],(r,[e])=>{const i=r.id(),n=e.value;return typeof i==typeof n&&i>n}],"filter-<=":[Yt,[ti,oi],(r,[e,i])=>{const n=r.properties()[e.value],a=i.value;return typeof n==typeof a&&n<=a}],"filter-id-<=":[Yt,[oi],(r,[e])=>{const i=r.id(),n=e.value;return typeof i==typeof n&&i<=n}],"filter->=":[Yt,[ti,oi],(r,[e,i])=>{const n=r.properties()[e.value],a=i.value;return typeof n==typeof a&&n>=a}],"filter-id->=":[Yt,[oi],(r,[e])=>{const i=r.id(),n=e.value;return typeof i==typeof n&&i>=n}],"filter-has":[Yt,[oi],(r,[e])=>e.value in r.properties()],"filter-has-id":[Yt,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[Yt,[Ur(ti)],(r,[e])=>e.value.indexOf(r.geometryType())>=0],"filter-id-in":[Yt,[Ur(oi)],(r,[e])=>e.value.indexOf(r.id())>=0],"filter-in-small":[Yt,[ti,Ur(oi)],(r,[e,i])=>i.value.indexOf(r.properties()[e.value])>=0],"filter-in-large":[Yt,[ti,Ur(oi)],(r,[e,i])=>(function(n,a,u,h){for(;u<=h;){const f=u+h>>1;if(a[f]===n)return!0;a[f]>n?h=f-1:u=f+1}return!1})(r.properties()[e.value],i.value,0,i.value.length-1)],all:{type:Yt,overloads:[[[Yt,Yt],(r,[e,i])=>e.evaluate(r)&&i.evaluate(r)],[gs(Yt),(r,e)=>{for(const i of e)if(!i.evaluate(r))return!1;return!0}]]},any:{type:Yt,overloads:[[[Yt,Yt],(r,[e,i])=>e.evaluate(r)||i.evaluate(r)],[gs(Yt),(r,e)=>{for(const i of e)if(i.evaluate(r))return!0;return!1}]]},"!":[Yt,[Yt],(r,[e])=>!e.evaluate(r)],"is-supported-script":[Yt,[ti],(r,[e])=>{const i=r.globals&&r.globals.isSupportedScript;return!i||i(e.evaluate(r))}],upcase:[ti,[ti],(r,[e])=>e.evaluate(r).toUpperCase()],downcase:[ti,[ti],(r,[e])=>e.evaluate(r).toLowerCase()],concat:[ti,gs(oi),(r,e)=>e.map(i=>mo(i.evaluate(r))).join("")],"resolved-locale":[ti,[gc],(r,[e])=>e.evaluate(r).resolvedLocale()],random:[ht,[ht,ht,oi],(r,e)=>{const[i,n,a]=e.map(h=>h.evaluate(r));if(i>n||i===n)return i;let u;
2if(typeof a=="string")u=(function(h){let f=0;if(h.length===0)return f;for(let _=0;_<h.length;_++)f=(f<<5)-f+h.charCodeAt(_),f&=f;return f})(a);else{if(typeof a!="number")throw new ur(`Invalid seed input: ${a}`);u=a}return i+Ef(u)()*(n-i)}]});class Gc{constructor(e,i,n,a,u){this.expression=e,this._warningHistory={},this._scope=n,this._options=a,this._iconImageUseTheme=u,this._evaluator=new ba(n,a,u),this._defaultValue=i?(function(h){return h.type==="color"&&(jc(h.default)||Array.isArray(h.default))?new ii(0,0,0,0):h.type==="color"?ii.parse(h.default)||null:h.default===void 0?null:h.default})(i):null,this._enumValues=i&&i.type==="enum"?i.values:null,this.configDependencies=Ws(e),this.isIndoorDependent=Vc(e)}evaluateWithoutErrorHandling(e,i,n,a,u,h,f,_){return this._evaluator.globals=e,this._evaluator.feature=i,this._evaluator.featureState=n,this._evaluator.canonical=a||null,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=h,this._evaluator.featureTileCoord=f||null,this._evaluator.featureDistanceData=_||null,this.expression.evaluate(this._evaluator)}evaluate(e,i,n,a,u,h,f,_,g){this._evaluator||(this._evaluator=new ba(this._scope,this._options,this._iconImageUseTheme)),this._evaluator.globals=e,this._evaluator.feature=i||null,this._evaluator.featureState=n||null,this._evaluator.canonical=a||null,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=h||null,this._evaluator.featureTileCoord=f||null,this._evaluator.featureDistanceData=_||null,this._evaluator.iconImageUseTheme=g||null;try{const v=this.expression.evaluate(this._evaluator);if(v==null||typeof v=="number"&&v!=v)return this._defaultValue;if(this._enumValues&&!(v in this._enumValues))throw new ur(`Expected value to be one of ${Object.keys(this._enumValues).map(b=>JSON.stringify(b)).join(", ")}, but found ${JSON.stringify(v)} instead.`);return v}catch(v){const b=v;return this._warningHistory[b.message]||(this._warningHistory[b.message]=!0,typeof console<"u"&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${b.message}`)),this._defaultValue}}}function Rl(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in Zs}function xs(r,e,i,n,a){const u=new Pc(Zs,[],e?(function(f){const _={color:Yr,string:ti,number:ht,enum:ti,boolean:Yt,formatted:xa,resolvedImage:Gs};return f.type==="array"?Ur(_[f.value]||oi,f.length):_[f.type]})(e):void 0,void 0,void 0,i,n,a),h=u.parse(r,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return h?Mf(new Gc(h,e,i,n,a)):ys(u.errors)}class zl{constructor(e,i,n,a){this.kind=e,this._styleExpression=i,this.isLightConstant=n,this.isLineProgressConstant=a,this.isStateDependent=e!=="constant"&&!Sl(i.expression),this.configDependencies=Ws(i.expression),this.isIndoorDependent=Vc(i.expression)}evaluateWithoutErrorHandling(e,i,n,a,u,h){return this._styleExpression.evaluateWithoutErrorHandling(e,i,n,a,u,h)}evaluate(e,i,n,a,u,h,f){return this._styleExpression.evaluate(e,i,n,a,u,h,void 0,void 0,f)}}class Xs{constructor(e,i,n,a,u,h){this.kind=e,this.zoomStops=n,this._styleExpression=i,this.isStateDependent=e!=="camera"&&!Sl(i.expression),this.isIndoorDependent=Vc(i.expression),this.isLightConstant=u,this.isLineProgressConstant=h,this.configDependencies=Ws(i.expression),this.interpolationType=a}evaluateWithoutErrorHandling(e,i,n,a,u,h){return this._styleExpression.evaluateWithoutErrorHandling(e,i,n,a,u,h)}evaluate(e,i,n,a,u,h){return this._styleExpression.evaluate(e,i,n,a,u,h)}interpolationFactor(e,i,n){return this.interpolationType?Fn.interpolationFactor(this.interpolationType,e,i,n):0}}function qc(r,e,i,n,a){if((r=xs(r,e,i,n,a)).result==="error")return r;const u=r.value.expression,h=Sa(u);if(!h&&!Uc(e))return ys([new Xr("","data expressions not supported")]);const f=Ea(u,["zoom","pitch","distance-from-center"]);if(!f&&!Cf(e))return ys([new Xr("","zoom expressions not supported")]);const _=Ea(u,["measure-light"]);if(!_&&!vh(e))return ys([new Xr("","measure-light expression not supported")]);const g=Ea(u,["line-progress"]);if(!g&&!(function(w){return xh(w.expression,"line-progress")})(e))return ys([new Xr("","line-progress expression not supported")]);const v=e.expression&&e.expression.relaxZoomRestriction,b=Hc(u);return b||f||v?b instanceof Xr?ys([b]):b instanceof Fn&&!bh(e)?ys([new Xr("",'"interpolate" expressions cannot be used with this property')]):Mf(b?new Xs(h&&g?"camera":"composite",r.value,b.labels,b instanceof Fn?b.interpolation:void 0,_,g):new zl(h&&g?"constant":"source",r.value,_,g)):ys([new Xr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class Dl{constructor(e,i){this._parameters=e,this._specification=i,Object.assign(this,wh(this._parameters,this._specification))}static deserialize(e){return new Dl(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Hc(r){let e=null;if(r instanceof qo)e=Hc(r.result);else if(r instanceof Al){for(const i of r.args)if(e=Hc(i),e)break}else(r instanceof El||r instanceof Fn)&&r.input instanceof fn&&r.input.name==="zoom"&&(e=r);return e instanceof Xr||r.eachChild(i=>{const n=Hc(i);n instanceof Xr?e=n:e&&n&&e!==n&&(e=new Xr("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}var xo,zf,jm=(function(){if(zf)return xo;zf=1,xo=e;var r=3;function e(i,n,a){var u=this.cells=[];if(i instanceof ArrayBuffer){this.arrayBuffer=i;var h=new Int32Array(this.arrayBuffer);i=h[0],this.d=(n=h[1])+2*(a=h[2]);for(var f=0;f<this.d*this.d;f++){var _=h[r+f],g=h[r+f+1];u.push(_===g?null:h.subarray(_,g))}var v=h[r+u.length+1];this.keys=h.subarray(h[r+u.length],v),this.bboxes=h.subarray(v),this.insert=this._insertReadonly}else{this.d=n+2*a;for(var b=0;b<this.d*this.d;b++)u.push([]);this.keys=[],this.bboxes=[]}this.n=n,this.extent=i,this.padding=a,this.scale=n/i,this.uid=0;var w=a/n*i;this.min=-w,this.max=i+w}
2return e.prototype.insert=function(i,n,a,u,h){this._forEachCell(n,a,u,h,this._insertCell,this.uid++),this.keys.push(i),this.bboxes.push(n),this.bboxes.push(a),this.bboxes.push(u),this.bboxes.push(h)},e.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},e.prototype._insertCell=function(i,n,a,u,h,f){this.cells[h].push(f)},e.prototype.query=function(i,n,a,u,h){var f=this.min,_=this.max;if(i<=f&&n<=f&&_<=a&&_<=u&&!h)return Array.prototype.slice.call(this.keys);var g=[];return this._forEachCell(i,n,a,u,this._queryCell,g,{},h),g},e.prototype._queryCell=function(i,n,a,u,h,f,_,g){var v=this.cells[h];if(v!==null)for(var b=this.keys,w=this.bboxes,E=0;E<v.length;E++){var I=v[E];if(_[I]===void 0){var P=4*I;(g?g(w[P+0],w[P+1],w[P+2],w[P+3]):i<=w[P+2]&&n<=w[P+3]&&a>=w[P+0]&&u>=w[P+1])?(_[I]=!0,f.push(b[I])):_[I]=!1}}},e.prototype._forEachCell=function(i,n,a,u,h,f,_,g){for(var v=this._convertToCellCoord(i),b=this._convertToCellCoord(n),w=this._convertToCellCoord(a),E=this._convertToCellCoord(u),I=v;I<=w;I++)for(var P=b;P<=E;P++){var D=this.d*P+I;if((!g||g(this._convertFromCellCoord(I),this._convertFromCellCoord(P),this._convertFromCellCoord(I+1),this._convertFromCellCoord(P+1)))&&h.call(this,i,n,a,u,D,f,_,g))return}},e.prototype._convertFromCellCoord=function(i){return(i-this.padding)/this.scale},e.prototype._convertToCellCoord=function(i){return Math.max(0,Math.min(this.d-1,Math.floor(i*this.scale)+this.padding))},e.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var i=this.cells,n=r+this.cells.length+1+1,a=0,u=0;u<this.cells.length;u++)a+=this.cells[u].length;var h=new Int32Array(n+a+this.keys.length+this.bboxes.length);h[0]=this.extent,h[1]=this.n,h[2]=this.padding;for(var f=n,_=0;_<i.length;_++){var g=i[_];h[r+_]=f,h.set(g,f),f+=g.length}return h[r+i.length]=f,h.set(this.keys,f),h[r+i.length+1]=f+=this.keys.length,h.set(this.bboxes,f),f+=this.bboxes.length,h.buffer},xo})(),Ys=Pn(jm);const $c={};function nt(r,e,i={}){Object.defineProperty(r,"_classRegistryKey",{value:e,writable:!1}),$c[e]={klass:r,omit:i.omit||[]}}nt(Object,"Object"),Ys.serialize=function(r,e){const i=r.toArrayBuffer();return e&&e.add(i),{buffer:i}},Ys.deserialize=function(r){return new Ys(r.buffer)},Object.defineProperty(Ys,"name",{value:"Grid"}),nt(Ys,"Grid"),delete Be.prototype.constructor,nt(ii,"Color"),nt(Error,"Error"),nt(jr,"Formatted"),nt(xc,"FormattedSection"),nt(ul,"AJAXError"),nt(dn,"ResolvedImage"),nt(Dl,"StylePropertyFunction"),nt(Gc,"StyleExpression",{omit:["_evaluator"]}),nt(cn,"ImageId"),nt(hn,"ImageVariant"),nt(Xs,"ZoomDependentExpression"),nt(zl,"ZoomConstantExpression"),nt(fn,"CompoundExpression",{omit:["_evaluate"]});for(const r in Zs)$c[Zs[r]._classRegistryKey]||nt(Zs[r],`Expression${r}`);function Th(r){return r&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}function no(r,e){if(r==null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||r instanceof Boolean||r instanceof Number||r instanceof String||r instanceof Date||r instanceof RegExp)return r;if(Th(r)||r instanceof ImageBitmap)return e&&e.add(r),r;if(ArrayBuffer.isView(r))return e&&e.add(r.buffer),r;if(r instanceof ImageData)return e&&e.add(r.data.buffer),r;if(Array.isArray(r)){const i=[];for(const n of r)i.push(no(n,e));return i}if(r instanceof Map){const i={$name:"Map",entries:[]};for(const[n,a]of r.entries())i.entries.push(no(n),no(a,e));return i}if(r instanceof Set){const i={$name:"Set"};let n=0;for(const a of r.values())i[++n]=no(a);return i}if(typeof r=="bigint")return{$name:"BigInt",value:r.toString()};if(typeof r=="object"){const i=r.constructor,n=i._classRegistryKey;if(!n)throw new Error(`Can't serialize object of unregistered class "${i.name}".`);const a=i.serialize?i.serialize(r,e):{};if(!i.serialize){for(const u in r)r.hasOwnProperty(u)&&($c[n].omit.indexOf(u)>=0||(a[u]=no(r[u],e)));r instanceof Error&&(a.message=r.message)}if(a.$name)throw new Error("$name property is reserved for worker serialization logic.");return n!=="Object"&&(a.$name=n),a}throw new Error("can't serialize object of type "+typeof r)}function Ho(r){if(r==null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||r instanceof Boolean||r instanceof Number||r instanceof String||r instanceof Date||r instanceof RegExp||Th(r)||r instanceof ImageBitmap||ArrayBuffer.isView(r)||r instanceof ImageData)return r;if(Array.isArray(r))return r.map(Ho);if(typeof r=="object"){const e=r.$name||"Object";if(e==="Map"){const a=r.entries||[],u=new Map;for(let h=0;h<a.length;h+=2)u.set(Ho(a[h]),Ho(a[h+1]));return u}if(e==="Set"){const a=new Set;for(const u of Object.keys(r))u!=="$name"&&a.add(Ho(r[u]));return a}if(e==="BigInt")return BigInt(r.value);const{klass:i}=$c[e];if(!i)throw new Error(`Can't deserialize unregistered class "${e}".`);if(i.deserialize)return i.deserialize(r);const n=Object.create(i.prototype);for(const a of Object.keys(r))a!=="$name"&&(n[a]=Ho(r[a]));return n}throw new Error("can't deserialize object of type "+typeof r)}const Df=r=>r>=1536&&r<=1791,Lf=r=>r>=1872&&r<=1919,Zc=r=>r>=2208&&r<=2303,Wc=r=>r>=11904&&r<=12031,Sh=r=>r>=12032&&r<=12255,Eh=r=>r>=12272&&r<=12287,za=r=>r>=12288&&r<=12351,Da=r=>r>=12352&&r<=12447,Ll=r=>r>=12448&&r<=12543,vo=r=>r>=12544&&r<=12591,Ff=r=>r>=12704&&r<=12735,Of=r=>r>=12736&&r<=12783,kf=r=>r>=12784&&r<=12799,Bf=r=>r>=12800&&r<=13055,Ih=r=>r>=13056&&r<=13311,La=r=>r>=13312&&r<=19903,Xc=r=>r>=19968&&r<=40959,Ah=r=>r>=40960&&r<=42127,Yc=r=>r>=42128&&r<=42191,Nf=r=>r>=44032&&r<=55215,Vf=r=>r>=63744&&r<=64255,Mh=r=>r>=64336&&r<=65023,Uf=r=>r>=65040&&r<=65055,Ch=r=>r>=65072&&r<=65103,jf=r=>r>=65104&&r<=65135,Ph=r=>r>=65136&&r<=65279,Rh=r=>r>=65280&&r<=65519;function zh(r){for(const e of r)if(vs(e.charCodeAt(0)))return!0;return!1}function Gm(r){for(const e of r)if(!qm(e.charCodeAt(0)))return!1;return!0}function qm(r){return!(Df(r)||Lf(r)||Zc(r)||Mh(r)||Ph(r))}function Gf(r){return!(r<11904||!(Ff(r)||vo(r)||Ch(r)||Vf(r)||Ih(r)||Wc(r)||Of(r)||za(r)||La(r)||Xc(r)||Bf(r)||Rh(r)||Da(r)||Eh(r)||Sh(r)||kf(r)||Ll(r)||Uf(r)||Yc(r)||Ah(r)))}function vs(r){return!(r!==746&&r!==747&&(r<4352||!(Ff(r)||vo(r)||Ch(r)&&!(r>=65097&&r<=65103)||Vf(r)||Ih(r)||Wc(r)||Of(r)||!(!za(r)||r>=12296&&r<=12305||r>=12308&&r<=12319||r===12336)||La(r)||Xc(r)||Bf(r)||(e=>e>=12592&&e<=12687)(r)||(e=>e>=43360&&e<=43391)(r)||(e=>e>=55216&&e<=55295)(r)||(e=>e>
vendor: 11,813 bytes, line 2
2=4352&&e<=4607)(r)||Nf(r)||Da(r)||Eh(r)||(e=>e>=12688&&e<=12703)(r)||Sh(r)||kf(r)||Ll(r)&&r!==12540||!(!Rh(r)||r===65288||r===65289||r===65293||r>=65306&&r<=65310||r===65339||r===65341||r===65343||r>=65371&&r<=65503||r===65507||r>=65512&&r<=65519)||!(!jf(r)||r>=65112&&r<=65118||r>=65123&&r<=65126)||(e=>e>=5120&&e<=5759)(r)||(e=>e>=6320&&e<=6399)(r)||Uf(r)||(e=>e>=19904&&e<=19967)(r)||Ah(r)||Yc(r))))}function qf(r){return r===12312||r===12313||r===12316||r===12540||r===12448}function Dh(r){return!(vs(r)||(function(e){return!!((i=>i>=128&&i<=255)(e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||(i=>i>=8192&&i<=8303)(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)||(i=>i>=8448&&i<=8527)(e)||(i=>i>=8528&&i<=8591)(e)||(i=>i>=8960&&i<=9215)(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)||(i=>i>=9216&&i<=9279)(e)&&e!==9251||(i=>i>=9280&&i<=9311)(e)||(i=>i>=9312&&i<=9471)(e)||(i=>i>=9632&&i<=9727)(e)||(i=>i>=9728&&i<=9983)(e)&&!(e>=9754&&e<=9759)||(i=>i>=11008&&i<=11263)(e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||za(e)||Ll(e)||(i=>i>=57344&&i<=63743)(e)||Ch(e)||jf(e)||Rh(e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)})(r))}function Kc(r){return Df(r)||Lf(r)||Zc(r)||Mh(r)||Ph(r)}function Hf(r){return r>=1424&&r<=2303||Mh(r)||Ph(r)}function Hm(r,e){return!(!e&&Hf(r)||r>=2304&&r<=3583||r>=3840&&r<=4255||(i=>i>=6016&&i<=6143)(r))}function bs(r){for(const e of r)if(Hf(e.charCodeAt(0)))return!0;return!1}const pn={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"};let ws=null,Kr=pn.unavailable,Ts=null;const $f=function(r){r&&typeof r=="string"&&r.indexOf("NetworkError")>-1&&(Kr=pn.error),ws&&ws(r)};function Lh(){Fh.fire(new Vo("pluginStateChange",{pluginStatus:Kr,pluginURL:Ts}))}const Fh=new Uo,Oh=function(){return Kr},kh=function(){if(Kr!==pn.deferred||!Ts)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Kr=pn.loading,Lh(),Ts&&dl({url:Ts},r=>{r?$f(r):(Kr=pn.loaded,Lh())})},oo={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Kr===pn.loaded||oo.applyArabicShaping!=null,isLoading:()=>Kr===pn.loading,setState(r){Kr=r.pluginStatus,Ts=r.pluginURL},isParsing:()=>Kr===pn.parsing,isParsed:()=>Kr===pn.parsed,getPluginURL:()=>Ts};class ui{constructor(e,i){this.zoom=e,i?(this.now=i.now,this.fadeDuration=i.fadeDuration,this.transition=i.transition,this.pitch=i.pitch,this.brightness=i.brightness,this.worldview=i.worldview,this.activeFloors=i.activeFloors):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(e){return(function(i,n){for(const a of i)if(!Hm(a.charCodeAt(0),n))return!1;return!0})(e,oo.isLoaded())}}class Fl{constructor(e,i,n,a,u){this.property=e,this.value=i,this.expression=(function(h,f,_,g,v){if(jc(h))return new Dl(h,f);if(Rl(h)||Array.isArray(h)&&h.length>0){const b=qc(h,f,_,g,v);if(b.result==="error")throw new Error(b.value.map(w=>`${w.key}: ${w.message}`).join(", "));return b.value}{let b=h;return typeof h=="string"&&f.type==="color"&&(b=ii.parse(h)),{kind:"constant",configDependencies:new Set,isIndoorDependent:!1,evaluate:()=>b}}})(i===void 0?e.specification.default:i,e.specification,n,a,u)}isIndoorDependent(){return this.expression.isIndoorDependent}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,i,n,a){return this.property.possiblyEvaluate(this,e,i,n,a)}}class Ol{constructor(e,i,n,a){this.property=e,this.value=new Fl(e,void 0,i,n,a)}transitioned(e,i){return new Zf(this.property,this.value,i,Object.assign({},e.transition,this.transition),e.now)}untransitioned(){return new Zf(this.property,this.value,null,{},0)}}class Fa{constructor(e,i,n,a){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._scope=i,this._options=n,this._iconImageUseTheme=a,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(e){return At(this._values[e].value.value)}setValue(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new Ol(this._values[e].property,this._scope,this._options,this._iconImageUseTheme)),this._values[e].value=new Fl(this._values[e].property,i===null?void 0:At(i),this._scope,this._options,this._iconImageUseTheme),this._values[e].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].value.expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[e].value.isIndoorDependent())}setTransitionOrValue(e,i){i&&(this._options=i);const n=this._properties.properties;if(e)for(const a in e){const u=e[a];if(a.endsWith("-transition")){const h=a.slice(0,-11);n[h]&&this.setTransition(h,u)}else n.hasOwnProperty(a)&&this.setValue(a,u)}}getTransition(e){return At(this._values[e].transition)}setTransition(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new Ol(this._values[e].property)),this._values[e].transition=At(i)||void 0}serialize(){const e={};for(const i of Object.keys(this._values)){const n=this.getValue(i);n!==void 0&&(e[i]=n);const a=this.getTransition(i);a!==void 0&&(e[`${i}-transition`]=a)}return e}transitioned(e,i){const n=new Wf(this._properties);for(const a of Object.keys(this._values))n._values[a]=this._values[a].transitioned(e,i._values[a]);return n}untransitioned(){const e=new Wf(this._properties);for(const i of Object.keys(this._values))e._values[i]=this._values[i].untransitioned();return e}isIndoorDependent(){return this._isIndoorDependent}}class Zf{constructor(e,i,n,a,u){const h=a.delay||0,f=a.duration||0;u=u||0,this.property=e,this.value=i,this.begin=u+h,this.end=this.begin+f,e.specification.transition&&(a.delay||a.duration)&&(this.prior=n)}possiblyEvaluate(e,i,n){const a=e.now||0,u=this.value.possiblyEvaluate(e,i,n),h=this.prior;if(h){if(a>this.end)return this.prior=null,u;if(this.value.isDataDriven())return this.prior=null,u;if(a<this.begin)return h.possiblyEvaluate(e,i,n);{const f=(a-this.begin)/(this.end-this.begin);return this.property.interpolate(h.possiblyEvaluate(e,i,n),u,U(f))}}return u}}class Wf{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,i,n){const a=new Jr(this._properties);for(const u of Object.keys(this._values))a._values[u]=this._values[u].possiblyEvaluate(e,i,n);return a}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Bh{constructor(e,i,n,a){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._scope=i,this._options=n,this._iconImageUseTheme=a,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(e){return At(this._values[e].value)}setValue(e,i){this._values[e]=new Fl(this._values[e].property,i===null?void 0:At(i),this._scope,this._options,this._iconImageUseTheme),this._values[e].expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[e].isIndoorDependent())}serialize(){const e={};for(const i of Object.keys(this._values)){const n=this.getValue(i);n!==void 0&&(e[i]=n)}return e}possiblyEvaluate(e,i,n,a){const u=new Jr(this._properties);for(const h of Object.keys(this._values))u._values[h]=this._values[h].possiblyEvaluate(e,i,n,a);return u}isIndoorDependent(){return this._isIndoorDependent}}class Ks{constructor(e,i,n,a){this.property=e,this.value=i,this.parameters=n,this.iconImageUseTheme=a}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,i,n,a){return this.property.evaluate(this.value,this.parameters,e,i,n,a,this.iconImageUseTheme)}}class Jr{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Ge{constructor(e){this.specification=e}possiblyEvaluate(e,i){return e.expression.evaluate(i)}interpolate(e,i,n){const a=js[this.specification.type];return a?a(e,i,n):e}}class Je{constructor(e,i){this.specification=e,this.overrides=i}possiblyEvaluate(e,i,n,a,u){return e.expression.kind==="constant"||e.expression.kind==="camera"?new Ks(this,{kind:"constant",value:e.expression.evaluate(i,null,{},n,a,void 0,u)},i):new Ks(this,e.expression,i,u)}interpolate(e,i,n){if(e.value.kind!=="constant"||i.value.kind!=="constant")return e;if(e.value.value===void 0||i.value.value===void 0)return new Ks(this,{kind:"constant",value:void 0},e.parameters);const a=js[this.specification.type];return a?new Ks(this,{kind:"constant",value:a(e.value.value,i.value.value,n)},e.parameters):e}evaluate(e,i,n,a,u,h,f){return e.kind==="constant"?e.value:e.evaluate(i,n,a,u,h,void 0,f)}}class Oa{constructor(e){this.specification=e}possiblyEvaluate(e,i,n,a){return!!e.expression.evaluate(i,null,{},n,a)}interpolate(){return!1}}class Bi{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const i=new ui(0,{});for(const n in e){const a=e[n];a.specification.overridable&&this.overridableProperties.push(n);const u=this.defaultPropertyValues[n]=new Fl(a,void 0),h=this.defaultTransitionablePropertyValues[n]=new Ol(a);this.defaultTransitioningPropertyValues[n]=h.untransitioned(),this.defaultPossiblyEvaluatedValues[n]=u.possiblyEvaluate(i)}}}nt(Je,"DataDrivenProperty"),nt(Ge,"DataConstantProperty"),nt(Oa,"ColorRampProperty");var fe=JSON.parse('{"$version":8,"$root":{"version":{"type":"enum","values":[8]},"fragment":{"type":"boolean"},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360},"pitch":{"type":"number","default":0},"light":{"type":"light"},"lights":{"type":"array","value":"light-3d"},"terrain":{"type":"terrain","optional":true},"fog":{"type":"fog"},"snow":{"type":"snow"},"rain":{"type":"rain"},"camera":{"type":"camera"},"color-theme":{"type":"colorTheme"},"indoor":{"type":"indoor"},"imports":{"type":"array","value":"import"},"iconsets":{"type":"iconsets"},"schema":{"type":"schema"},"sources":{"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string","default":"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"type":"array","value":"layer"},"models":{"type":"models"},"featuresets":{"type":"featuresets"}},"featuresets":{"*":{"type":"featureset"}},"featureset":{"metadata":{"type":"*"},"selectors":{"type":"array","value":"selector"}},"selector":{"layer":{"type":"string"},"properties":{"type":"selectorProperty"},"featureNamespace":{"type":"string"},"_uniqueFeatureID":{"type":"boolean"}},"selectorProperty":{"*":{"type":"*"}},"model":{"type":"string"},"import":{"id":{"type":"string"},"url":{"type":"string"},"config":{"type":"config"},"data":{"type":"$root"},"color-theme":{"type":"colorTheme","optional":true}},"config":{"*":{"type":"*"}},"schema":{"*":{"type":"option"}},"option":{"default":{"type":"*","expression":{}},"type":{"type":"enum","values":{"string":1,"number":1,"boolean":1,"color":1}},"array":{"type":"boolean"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"stepValue":{"type":"number"},"values":{"type":"array","value":"*"},"metadata":{"type":"*"}},"models":{"*":{"type":"model"}}
2,"light-3d":{"id":{"type":"string"},"properties":{"type":"properties"},"type":{"type":"enum","values":{"ambient":{},"directional":{},"flat":{}}}},"properties":["properties_light_directional","properties_light_ambient","properties_light_flat"],"properties_light_directional":{"direction":{"type":"array","default":[210,30],"minimum":[0,0],"maximum":[360,90],"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"cast-shadows":{"type":"boolean","default":false},"shadow-quality":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"parameters":["zoom"]}},"shadow-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"shadow-draw-before-layer":{"type":"string"}},"properties_light_ambient":{"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_flat":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"iconsets":{"*":{"type":"iconset"}},"iconset":["iconset_sprite","iconset_source"],"iconset_sprite":{"type":{"type":"enum","values":{"sprite":1}},"url":{"type":"string"}},"iconset_source":{"type":{"type":"enum","values":{"source":1}},"source":{"type":"string"}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_raster_array","source_geojson","source_video","source_image","source_model"],"source_vector":{"type":{"type":"enum","values":{"vector":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"type":"enum","values":{"raster":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"type":"enum","values":{"raster-dem":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":1,"mapbox":1},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_array":{"type":{"type":"enum","values":{"raster-array":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"rasterLayers":{"type":"*"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"type":"enum","values":{"geojson":1}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0}
2,"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"},"dynamic":{"type":"boolean","default":false}},"source_video":{"type":{"type":"enum","values":{"video":1}},"urls":{"type":"array","value":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"type":"enum","values":{"image":1}},"url":{"type":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"modelNodeOverride":{"orientation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360}},"modelNodeOverrides":{"*":{"type":"modelNodeOverride"}},"modelMaterialOverride":{"model-color":{"type":"color"},"model-color-mix-intensity":{"type":"number"},"model-opacity":{"type":"number"},"model-emissive-strength":{"type":"number"}},"modelMaterialOverrides":{"*":{"type":"modelMaterialOverride"}},"modelSourceModel":{"uri":{"type":"string"},"position":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[-180,-90],"maximum":[180,90]},"orientation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360},"nodeOverrides":{"type":"modelNodeOverrides"},"materialOverrides":{"type":"modelMaterialOverrides"},"nodeOverrideNames":{"type":"array","value":"string"},"materialOverrideNames":{"type":"array","value":"string"},"featureProperties":{"type":"*"}},"modelSourceModels":{"*":{"type":"modelSourceModel"}},"source_model":{"type":{"type":"enum","values":{"model":1,"batched-model":1}},"url":{"type":"string"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"tiles":{"type":"array","value":"string"},"models":{"type":"modelSourceModels"}},"layer":{"id":{"type":"string"},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"building":{},"raster":{},"raster-particle":{},"hillshade":{},"model":{},"background":{},"sky":{},"slot":{},"clip":{}}},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"slot":{"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"},"appearances":{"type":"array","value":"appearance","supported-layer-types":["symbol"]}},"appearance":{"condition":{"type":"boolean","expression":{"interpolated":true,"parameters":["zoom","pitch","feature","feature-state","measure-light","distance-from-center"]},"property-type":"data-driven"},"name":{"type":"string"},"properties":{"type":"*"}},"layout":["layout_clip","layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_building","layout_symbol","layout_raster","layout_raster-particle","layout_hillshade","layout_background","layout_sky","layout_model"],"layout_background":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_model":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"model-id":{"type":"string","default":"","property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"model-allow-density-reduction":{"type":"boolean","default":true}},"layout_clip":{"clip-layer-types":{"type":"array","value":"enum","values":{"model":1,"symbol":1},"default":[],"expression":{}},"clip-layer-scope":{"type":"array","value":"string","default":[],"expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"fill-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-base":1,"hd-road-markup":1},"default":"none","expression":{}},"fill-construct-bridge-guard-rail":{"type":"boolean","default":"true","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"circle-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-markup":1},"default":"none","expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"fill-extrusion-edge-radius":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}}},"layout_building":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"building-facade":{"type":"boolean","default":false,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-floors":{"type":"number","minimum":1,"maximum":200,"default":3,"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-facade-unit-width":{"type":"number","minimum":1,"maximum":20,"default":3.1,"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-facade-window":{"type":"array","length":2,"value":"number","minimum":0.1,"maximum":1,"default":[0.9,0.9],"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-roof-shape":{"type":"enum","values":{"flat":1,"hipped":1,"gabled":1,"parapet":1,"mansard":1,"skillion":1,"pyramidal":1},"default":"flat","expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{},"property-type":"data-driven"},"building-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{},"property-type":"data-driven"},"building-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"building-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"building-flip-roof-orientation":{"property-type":"data-driven","type":"boolean","default":false,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":1,"round":1,"square":1},"default":"butt","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":1,"round":1,"miter":1,"none":1},"default":"miter","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-z-offset":{"type":"number","default":0,"expression":{"parameters":["zoom","feature","line-progress"]},"property-type":"data-driven"},"line-elevation-reference":{"type":"enum","values":{"none":1,"sea":1,"ground":1,"hd-road-markup":1},"default":"none","expression":{}},"line-cross-slope":{"type":"number","expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"line-width-unit":{"type":"enum","values":{"pixels":1,"meters":1},"default":"pixels","expression":{"parameters":["zoom"]}}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":1,"line":1,"line-center":1},"default":"point","expression":{"parameters":["zoom"]}},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":true,"parameters":["zoom"]}},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":1,"viewport-y":1,"source":1},"default":"auto","expression":{"parameters":["zoom"]}},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{"parameters":["zoom"]}},"icon-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"icon-size":{"type":"number","default":1,"minimum":0,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"expression":{}},"icon-text-fit":{"type":"enum","values":{"none":1,"width":1,"height":1,"both":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","tokens":true,"appearance":true,"use-theme":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}
2,"icon-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"expression":{}},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":1,"left":1,"center":1,"right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["zoom"]}},"text-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]}},"text-rotate":{"type":"number","default":0,"period":360,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"text-transform":{"type":"enum","values":{"none":1,"uppercase":1,"lowercase":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","length":2,"default":[0,0],"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_raster-particle":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_hillshade":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster-particle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_clip":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_model":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_building":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":1,"!=":1,">":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"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":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*"}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"high-color":{"type":"color","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"space-color":{"type":"color","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"horizon-blend":{"type":"number","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"snow":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.85],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.3],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.4,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,50],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"flake-size":{"type":"number","default":0.71,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"rain":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.5],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#03113d",0.3,"#a8adbc"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":["interpolate",["linear"],["measure-light","brightness"],0,0.88,1,0.7],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#001736",0.3,"#464646"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.57,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"droplet-size":{"type":"array","default":[2.6,18.2],"minimum":0,"maximum":50,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"distortion-strength":{"type":"number","default":0.7,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective"}},"colorTheme":{"data":{"type":"string","expression":{}}},"indoor_source":{"sourceId":{"type":"string"},"sourceLayers":{"type":"array","value":"string"}},"indoor":{"*":{"type":"indoor_source"}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator"},"center":{"type":"array","length":2,"value":"number","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string"},"exaggeration":{"type":"number","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_building","paint_symbol","paint_raster","paint_raster-particle","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-bridge-guard-rail-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"},"fill-tunnel-structure-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","meas
2ure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"flat"},"fill-extrusion-base-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"terrain"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true}},"paint_building":{"building-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"parameters":[]},"transition":true},"building-ambient-occlusion-ground-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-cast-shadows":{"type":"boolean","default":true},"building-color":{"type":"color","default":"rgba(193, 154, 127, 1)","use-theme":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-facade-emissive-chance":{"type":"number","default":0.35,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["measure-light","zoom"]}},"building-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"building-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light","line-progress"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"}
2,"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-gradient":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["line-progress"]}},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1]},"line-trim-fade-range":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-trim-color":{"type":"color","default":"transparent","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-driven"},"line-border-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"use-theme":true,"expression":{"interpolated":true,"parameters":["heatmap-density"]}},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-image-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{}},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-value"]}},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]}},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"raster-array-band":{"type":"string"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string"},"raster-particle-count":{"type":"number","default":512,"minimum":1},"raster-particle-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-particle-speed"]}},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-shadow-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-accent-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_background":{"background-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":[]}},"background-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]}},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]}},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]}},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"use-theme":true,"expression":{"interpolated":true,"parameters":["sky-radial-progress"]}},"sky-atmosphere-halo-color":{"type":"color","default":"white","use-theme":true},"sky-atmosphere-color":{"type":"color","default":"white","use-theme":true},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"property-type":"data-driven"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"use-theme":true,"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default
2":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d"},"model-cast-shadows":{"type":"boolean","default":true},"model-receive-shadows":{"type":"boolean","default":true},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"model-front-cutoff":{"type":"array","value":"number","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]},"model-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{}}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"promoteId":{"*":{"type":"*"}}}');function Xf(r){return r instanceof Number||r instanceof String||r instanceof Boolean?r.valueOf():r}function Jc(r){if(Array.isArray(r))return r.map(Jc);if(r instanceof Object&&!(r instanceof Number||r instanceof String||r instanceof Boolean)){const e={};for(const i in r)e[i]=Jc(r[i]);return e}return Xf(r)}function Nh(r){if(r===!0||r===!1)return!0;if(!Array.isArray(r)||r.length===0)return!1;switch(r[0]){case"has":return r.length>=2&&r[1]!=="$id"&&r[1]!=="$type";case"in":return r.length>=3&&(typeof r[1]!="string"||Array.isArray(r[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return r.length!==3||Array.isArray(r[1])||Array.isArray(r[2]);case"any":case"all":for(const e of r.slice(1))if(!Nh(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}function Vh(r,e="",i=null,n="fill"){if(r==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};Nh(r)||(r=kl(r));const a=r;let u=!0;try{u=(function(v){if(!ka(v))return v;let b=Jc(v);return Uh(b),b=Yf(b),b})(a)}catch{console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.
3This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md
4and paste the contents of this message in the report.
5Thank you!
6Filter Expression:
7${JSON.stringify(a,null,2)}
8        `)}let h=null,f=null;if(n!=="background"&&n!=="sky"&&n!=="slot"){f=fe[`filter_${n}`];const v=xs(u,f,e,i);if(v.result==="error")throw new Error(v.value.map(b=>`${b.key}: ${b.message}`).join(", "));h=(b,w,E)=>v.value.evaluate(b,w,{},E)}let _=null,g=null;if(u!==a){const v=xs(a,f,e,i);if(v.result==="error")throw new Error(v.value.map(b=>`${b.key}: ${b.message}`).join(", "));_=(b,w,E,I,P)=>v.value.evaluate(b,w,{},E,void 0,void 0,I,P),g=!Sa(v.value.expression)}return{filter:h,dynamicFilter:_||void 0,needGeometry:jh(u),needFeature:!!g}}function Yf(r){if(!Array.isArray(r))return r;const e=(function(i){if($m.has(i[0])){for(let n=1;n<i.length;n++)if(ka(i[n]))return!0}return i})(r);return e===!0?e:e.map(i=>Yf(i))}function Uh(r){let e=!1;const i=[];if(r[0]==="case"){for(let n=1;n<r.length-1;n+=2)e=e||ka(r[n]),i.push(r[n+1]);i.push(r[r.length-1])}else if(r[0]==="match"){e=e||ka(r[1]);for(let n=2;n<r.length-1;n+=2)i.push(r[n+1]);i.push(r[r.length-1])}else if(r[0]==="step"){e=e||ka(r[1]);for(let n=1;n<r.length-1;n+=2)i.push(r[n+1])}e&&(r.length=0,r.push("any",...i));for(let n=1;n<r.length;n++)Uh(r[n])}function ka(r){if(!Array.isArray(r))return!1;if((e=r[0])==="pitch"||e==="distance-from-center")return!0;var e;
8for(let i=1;i<r.length;i++)if(ka(r[i]))return!0;return!1}const $m=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function Zm(r,e){return r<e?-1:r>e?1:0}function jh(r){if(!Array.isArray(r))return!1;if(r[0]==="within"||r[0]==="distance")return!0;for(let e=1;e<r.length;e++)if(jh(r[e]))return!0;return!1}function kl(r){if(!r)return!0;const e=r[0];return r.length<=1?e!=="any":e==="=="?bo(r[1],r[2],"=="):e==="!="?Qc(bo(r[1],r[2],"==")):e==="<"||e===">"||e==="<="||e===">="?bo(r[1],r[2],e):e==="any"?(i=r.slice(1),["any"].concat(i.map(kl))):e==="all"?["all"].concat(r.slice(1).map(kl)):e==="none"?["all"].concat(r.slice(1).map(kl).map(Qc)):e==="in"?Gh(r[1],r.slice(2)):e==="!in"?Qc(Gh(r[1],r.slice(2))):e==="has"?Kf(r[1]):e!=="!has"||Qc(Kf(r[1]));var i}function bo(r,e,i){switch(r){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,r,e]}}function Gh(r,e){if(e.length===0)return!1;switch(r){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(i=>typeof i!=typeof e[0])?["filter-in-large",r,["literal",e.sort(Zm)]]:["filter-in-small",r,["literal",e]]}}function Kf(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function Qc(r){return["!",r]}const Bl="�";function Js(r,e){return e?`${r}${Bl}${e}`:r}let qh;const Hh=()=>qh||(qh=new Bi({"icon-size":new Je(fe.layout_symbol["icon-size"]),"icon-image":new Je(fe.layout_symbol["icon-image"]),"icon-rotate":new Je(fe.layout_symbol["icon-rotate"]),"icon-offset":new Je(fe.layout_symbol["icon-offset"]),"text-size":new Je(fe.layout_symbol["text-size"]),"text-rotate":new Je(fe.layout_symbol["text-rotate"]),"text-offset":new Je(fe.layout_symbol["text-offset"])}));class Jf{constructor(e,i,n,a,u,h){const f=xs(e,fe.appearance.condition);if(f.result==="success"&&(this.condition=f.value),this.name=i,n){this.properties=new Jr(Hh()),this.unevaluatedLayout=new Bh(Hh(),a,u,h);for(const _ in n)this.unevaluatedLayout.setValue(_,n[_])}}isActive(e){return!(this.condition||!e.isHidden||this.name!=="hidden")||this.condition.evaluate(e.globals,e.feature,e.featureState,e.canonical)}getCondition(){return this.condition}getName(){return this.name}getProperty(e){return this.properties.get(e)}getUnevaluatedProperties(){return this.unevaluatedLayout}getUnevaluatedProperty(e){return this.unevaluatedLayout._values[e]}recalculate(e,i,n){this.unevaluatedLayout&&(this.properties=this.unevaluatedLayout.possiblyEvaluate(e,void 0,i,n))}serialize(){const e={};return e.condition=this.condition.expression.serialize(),this.name&&(e.name=this.name),this.unevaluatedLayout&&(e.properties=this.unevaluatedLayout.serialize()),e}hasIconProperties(){const e=this.hasProperty("icon-image"),i=this.hasProperty("icon-size"),n=this.hasProperty("icon-offset"),a=this.hasProperty("icon-rotate");return e||i||n||a}hasTextProperties(){const e=this.hasProperty("text-size"),i=this.hasProperty("text-offset"),n=this.hasProperty("text-rotate");return e||i||n}hasProperty(e){return this.getUnevaluatedProperty(e).value!==void 0}}const Qf="-transition",ep=new Set(["fill","line","background","hillshade","raster"]);class Qr extends Uo{constructor(e,i,n,a,u,h){if(super(),this.id=e.id,this.fqid=Js(this.id,n),this.type=e.type,this.scope=n,this.lut=a,this.options=u,this.iconImageUseTheme=h,this.appearances=new Array,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.expressionDependencies={isIndoorDependent:!1,configDependencies:new Set},e.type!=="custom"){if(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type&&e.type!=="background"&&e.type!=="sky"&&e.type!=="slot"){this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter;const f=xs(this.filter,fe[`filter_${e.type}`]);f.result!=="error"&&(this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...f.value.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||f.value.isIndoorDependent)}if(e.slot&&(this.slot=e.slot),e.appearances&&this.setAppearances(e.appearances),i.layout&&(this._unevaluatedLayout=new Bh(i.layout,this.scope,u,this.iconImageUseTheme),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...this._unevaluatedLayout.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._unevaluatedLayout.isIndoorDependent()),i.paint){this._transitionablePaint=new Fa(i.paint,this.scope,u);for(const f in e.paint)this.setPaintProperty(f,e.paint[f]);for(const f in e.layout)this.setLayoutProperty(f,e.layout[f]);this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...this._transitionablePaint.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._transitionablePaint.isIndoorDependent(),this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Jr(i.paint)}}}onAdd(e){}onRemove(e){}isDraped(e){return!this.is3D(!0)&&ep.has(this.type)}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}
8setLayoutProperty(e,i){if(this.type==="custom"&&e==="visibility")return void(this.visibility=i);const n=this._unevaluatedLayout;n._properties.properties[e]&&(n.setValue(e,i),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...n.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||n.isIndoorDependent(),e==="visibility"&&this.possiblyEvaluateVisibility())}setAppearances(e){this.appearances=[],e.forEach(i=>{this.appearances.push(new Jf(i.condition,i.name,i.properties,this.scope,this.options,this.iconImageUseTheme))})}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(e){return e.endsWith(Qf)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}isPaintProperty(e){return!!this._transitionablePaint._properties.properties[e]}setPaintProperty(e,i){const n=this._transitionablePaint,a=n._properties.properties;if(e.endsWith(Qf)){const b=e.slice(0,-11);return a[b]&&n.setTransition(b,i||void 0),!1}if(!a[e])return!1;const u=n._values[e],h=u.value.isDataDriven(),f=u.value;n.setValue(e,i),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...n.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||n.isIndoorDependent(),this._handleSpecialPaintPropertyUpdate(e);const _=n._values[e].value,g=_.isDataDriven(),v=e.endsWith("pattern")||e==="line-dasharray";return g||h||v||this._handleOverridablePaintPropertyUpdate(e,f,_)}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getDefaultProgramParams(e,i,n){return null}_handleOverridablePaintPropertyUpdate(e,i,n){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,i){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,i,this.iconImageUseTheme)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,i)}
vendor: 5,078 bytes, line 8
8serialize(){const e={id:this.id,type:this.type,slot:this.slot,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.appearances.length!==0&&(e.appearances=this.appearances.map(i=>i.serialize())),mt(e,(i,n)=>!(i===void 0||n==="layout"&&!Object.keys(i).length||n==="paint"&&!Object.keys(i).length))}is3D(e){return!1}hasElevation(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}_clear(){}isStateDependent(){for(const e in this.paint._values){const i=this.paint.get(e);if(i instanceof Ks&&Uc(i.property.specification)&&(i.value.kind==="source"||i.value.kind==="composite")&&i.value.isStateDependent)return!0}for(const e of this.appearances)if(!Sl(e.condition.expression))return!0;return!1}compileFilter(e){this._filterCompiled||(this._featureFilter=Vh(this.filter,this.scope,e),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(e){this._stats&&(e.renderPass==="shadow"?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}getAppearances(){return this.appearances}queryRenderedFeatures(e,i,n){return{}}queryRadius(e){}queryIntersectsFeature(e,i,n,a,u,h,f,_,g,v){}}const tp={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Ss{constructor(e,i){this._structArray=e,this._pos1=i*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}const Wm=new ArrayBuffer(0);class vi{constructor(){this._reallocCount=0,this.capacity=0,this.length=0}static serialize(e,i){return e._trim(),i&&e.arrayBuffer&&i.add(e.arrayBuffer),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const i=Object.create(this.prototype);return i.arrayBuffer=e.arrayBuffer,i.length=e.length,e.arrayBuffer?i.capacity=e.arrayBuffer.byteLength/i.bytesPerElement:(i.capacity=0,i.arrayBuffer=Wm),i._refreshViews(),i}_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._reallocCount++,this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const i=this.uint8;this._refreshViews(),i&&this.uint8.set(i)}}reserveForAdditional(e){this.reserve(this.length+e)}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...e){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...e){throw new Error("StructArray#emplaceBack() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function Nt(r,e=1){let i=0,n=0;return{members:r.map(a=>{const u=tp[a.type].BYTES_PER_ELEMENT,h=i=ip(i,Math.max(e,u)),f=a.components||1;return n=Math.max(n,u),i+=u*f,{name:a.name,type:a.type,components:f,offset:h}}),size:ip(i,Math.max(n,e)),alignment:e}}function ip(r,e){return Math.ceil(r/e)*e}class Es extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,i)}emplace(e,i,n){const a=2*e;return this.int16[a+0]=i,this.int16[a+1]=n,e}}Es.prototype.bytesPerElement=4,nt(Es,"StructArrayLayout2i4");class $o extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,n)}emplace(e,i,n,a){const u=3*e;return this.int16[u+0]=i,this.int16[u+1]=n,this.int16[u+2]=a,e}}$o.prototype.bytesPerElement=6,nt($o,"StructArrayLayout3i6");class Zo extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,a){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,n,a)}emplace(e,i,n,a,u){const h=4*e;return this.int16[h+0]=i,this.int16[h+1]=n,this.int16[h+2]=a,this.int16[h+3]=u,e}}Zo.prototype.bytesPerElement=8,nt(Zo,"StructArrayLayout4i8");class Ir extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.float32[1*e+0]=i,e}}
vendor: 21,397 bytes, line 8
8Ir.prototype.bytesPerElement=4,nt(Ir,"StructArrayLayout1f4");class Ba extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,n)}emplace(e,i,n,a){const u=4*e,h=2*e;return this.int16[u+0]=i,this.int16[u+1]=n,this.float32[h+1]=a,e}}Ba.prototype.bytesPerElement=8,nt(Ba,"StructArrayLayout2i1f8");class $h extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,n)}emplace(e,i,n,a){const u=4*e;return this.int16[u+0]=i,this.int16[u+1]=n,this.int16[u+2]=a,e}}$h.prototype.bytesPerElement=8,nt($h,"StructArrayLayout3i8");class Zh extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,a,u){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,n,a,u)}emplace(e,i,n,a,u,h){const f=5*e;return this.int16[f+0]=i,this.int16[f+1]=n,this.int16[f+2]=a,this.int16[f+3]=u,this.int16[f+4]=h,e}}Zh.prototype.bytesPerElement=10,nt(Zh,"StructArrayLayout5i10");class Wh extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,a,u,h,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,n,a,u,h,f)}emplace(e,i,n,a,u,h,f,_){const g=6*e,v=12*e,b=3*e;return this.int16[g+0]=i,this.int16[g+1]=n,this.uint8[v+4]=a,this.uint8[v+5]=u,this.uint8[v+6]=h,this.uint8[v+7]=f,this.float32[b+2]=_,e}}Wh.prototype.bytesPerElement=12,nt(Wh,"StructArrayLayout2i4ub1f12");class Yn extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,n)}emplace(e,i,n,a){const u=3*e;return this.float32[u+0]=i,this.float32[u+1]=n,this.float32[u+2]=a,e}}Yn.prototype.bytesPerElement=12,nt(Yn,"StructArrayLayout3f12");class wo extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,a,u){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,n,a,u)}emplace(e,i,n,a,u,h){const f=6*e,_=3*e;return this.uint16[f+0]=i,this.uint16[f+1]=n,this.uint16[f+2]=a,this.uint16[f+3]=u,this.float32[_+2]=h,e}}wo.prototype.bytesPerElement=12,nt(wo,"StructArrayLayout4ui1f12");class Na extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,n,a){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,n,a)}emplace(e,i,n,a,u){const h=4*e;return this.uint16[h+0]=i,this.uint16[h+1]=n,this.uint16[h+2]=a,this.uint16[h+3]=u,e}}Na.prototype.bytesPerElement=8,nt(Na,"StructArrayLayout4ui8");class Va extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,a,u,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,n,a,u,h)}emplace(e,i,n,a,u,h,f){const _=6*e;return this.int16[_+0]=i,this.int16[_+1]=n,this.int16[_+2]=a,this.int16[_+3]=u,this.int16[_+4]=h,this.int16[_+5]=f,e}}Va.prototype.bytesPerElement=12,nt(Va,"StructArrayLayout6i12");class Xh extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,n,a,u,h,f,_,g,v,b,w){const E=this.length;return this.resize(E+1),this.emplace(E,e,i,n,a,u,h,f,_,g,v,b,w)}emplace(e,i,n,a,u,h,f,_,g,v,b,w,E){const I=12*e;return this.int16[I+0]=i,this.int16[I+1]=n,this.int16[I+2]=a,this.int16[I+3]=u,this.uint16[I+4]=h,this.uint16[I+5]=f,this.uint16[I+6]=_,this.uint16[I+7]=g,this.int16[I+8]=v,this.int16[I+9]=b,this.int16[I+10]=w,this.int16[I+11]=E,e}}Xh.prototype.bytesPerElement=24,nt(Xh,"StructArrayLayout4i4ui4i24");class Yh extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,a,u,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,n,a,u,h)}emplace(e,i,n,a,u,h,f){const _=10*e,g=5*e;return this.int16[_+0]=i,this.int16[_+1]=n,this.int16[_+2]=a,this.float32[g+2]=u,this.float32[g+3]=h,this.float32[g+4]=f,e}}Yh.prototype.bytesPerElement=20,nt(Yh,"StructArrayLayout3i3f20");class Is extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,a){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,n,a)}emplace(e,i,n,a,u){const h=4*e;return this.float32[h+0]=i,this.float32[h+1]=n,this.float32[h+2]=a,this.float32[h+3]=u,e}}Is.prototype.bytesPerElement=16,nt(Is,"StructArrayLayout4f16");class Kh extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint32[1*e+0]=i,e}}Kh.prototype.bytesPerElement=4,nt(Kh,"StructArrayLayout1ul4");class On extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,i)}emplace(e,i,n){const a=2*e;return this.uint16[a+0]=i,this.uint16[a+1]=n,e}}On.prototype.bytesPerElement=4,nt(On,"StructArrayLayout2ui4");class Nl extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,n,a,u,h,f,_,g,v,b,w,E){const I=this.length;return this.resize(I+1),this.emplace(I,e,i,n,a,u,h,f,_,g,v,b,w,E)}emplace(e,i,n,a,u,h,f,_,g,v,b,w,E,I){const P=20*e,D=10*e;return this.int16[P+0]=i,this.int16[P+1]=n,this.int16[P+2]=a,this.int16[P+3]=u,this.int16[P+4]=h,this.float32[D+3]=f,this.float32[D+4]=_,this.float32[D+5]=g,this.float32[D+6]=v,this.int16[P+14]=b,this.uint32[D+8]=w,this.uint16[P+18]=E,this.uint16[P+19]=I,e}}Nl.prototype.bytesPerElement=40,nt(Nl,"StructArrayLayout5i4f1i1ul2ui40");class eu extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,a,u,h,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,n,a,u,h,f)}emplace(e,i,n,a,u,h,f,_){const g=8*e;return this.int16[g+0]=i,this.int16[g+1]=n,this.int16[g+2]=a,this.int16[g+4]=u,this.int16[g+5]=h,this.int16[g+6]=f,this.int16[g+7]=_,e}}eu.prototype.bytesPerElement=16,nt(eu,"StructArrayLayout3i2i2i16");class tu extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,a,u){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,n,a,u)}emplace(e,i,n,a,u,h){const f=4*e,_=8*e;return this.float32[f+0]=i,this.float32[f+1]=n,this.float32[f+2]=a,this.int16[_+6]=u,this.int16[_+7]=h,e}}tu.prototype.bytesPerElement=16,nt(tu,"StructArrayLayout2f1f2i16");class iu extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,a,u,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,n,a,u,h)}emplace(e,i,n,a,u,h,f){const _=20*e,g=5*e;return this.uint8[_+0]=i,this.uint8[_+1]=n,this.float32[g+1]=a,this.float32[g+2]=u,this.float32[g+3]=h,this.float32[g+4]=f,e}}iu.prototype.bytesPerElement=20,nt(iu,"StructArrayLayout2ub4f20");class hr extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,n){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,n)}emplace(e,i,n,a){const u=3*e;return this.uint16[u+0]=i,this.uint16[u+1]=n,this.uint16[u+2]=a,e}}hr.prototype.bytesPerElement=6,nt(hr,"StructArrayLayout3ui6");class Vl extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,i,n,a,u,h,f,_,g,v,b,w,E,I,P,D,R,F,B,V,$){const H=this.length;return this.resize(H+1),this.emplace(H,e,i,n,a,u,h,f,_,g,v,b,w,E,I,P,D,R,F,B,V,$)}emplace(e,i,n,a,u,h,f,_,g,v,b,w,E,I,P,D,R,F,B,V,$,H){const J=30*e,ee=15*e,K=60*e;return this.int16[J+0]=i,this.int16[J+1]=n,this.int16[J+2]=a,this.float32[ee+2]=u,this.float32[ee+3]=h,this.uint16[J+8]=f,this.uint16[J+9]=_,this.uint32[ee+5]=g,this.uint32[ee+6]=v,this.uint32[ee+7]=b,this.uint16[J+16]=w,this.uint16[J+17]=E,this.uint16[J+18]=I,this.float32[ee+10]=P,this.float32[ee+11]=D,this.uint8[K+48]=R,this.uint8[K+49]=F,this.uint8[K+50]=B,this.uint32[ee+13]=V,this.int16[J+28]=$,this.uint8[K+58]=H,e}}Vl.prototype.bytesPerElement=60,nt(Vl,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class Ua extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,i,n,a,u,h,f,_,g,v,b,w,E,I,P,D,R,F,B,V,$,H,J,ee,K,re,se,Ee,we,Se,Re,Ce,Pe){const ye=this.length;return this.resize(ye+1),this.emplace(ye,e,i,n,a,u,h,f,_,g,v,b,w,E,I,P,D,R,F,B,V,$,H,J,ee,K,re,se,Ee,we,Se,Re,Ce,Pe)}emplace(e,i,n,a,u,h,f,_,g,v,b,w,E,I,P,D,R,F,B,V,$,H,J,ee,K,re,se,Ee,we,Se,Re,Ce,Pe,ye){const De=20*e,Ae=40*e,Le=80*e;return this.float32[De+0]=i,this.float32[De+1]=n,this.int16[Ae+4]=a,this.int16[Ae+5]=u,this.int16[Ae+6]=h,this.int16[Ae+7]=f,this.int16[Ae+8]=_,this.int16[Ae+9]=g,this.int16[Ae+10]=v,this.int16[Ae+11]=b,this.int16[Ae+12]=w,this.uint16[Ae+13]=E,this.uint16[Ae+14]=I,this.uint16[Ae+15]=P,this.uint16[Ae+16]=D,this.uint16[Ae+17]=R,this.uint16[Ae+18]=F,this.uint16[Ae+19]=B,this.uint16[Ae+20]=V,this.uint16[Ae+21]=$,this.uint16[Ae+22]=H,this.uint16[Ae+23]=J,this.uint16[Ae+24]=ee,this.uint16[Ae+25]=K,this.uint16[Ae+26]=re,this.uint16[Ae+27]=se,this.uint32[De+14]=Ee,this.float32[De+15]=we,this.float32[De+16]=Se,this.float32[De+17]=Re,this.float32[De+18]=Ce,this.uint8[Le+76]=Pe,this.uint16[Ae+39]=ye,e}}Ua.prototype.bytesPerElement=80,nt(Ua,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class ru extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,a,u,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,n,a,u,h)}emplace(e,i,n,a,u,h,f){const _=6*e;return this.float32[_+0]=i,this.float32[_+1]=n,this.float32[_+2]=a,this.float32[_+3]=u,this.float32[_+4]=h,this.float32[_+5]=f,e}}ru.prototype.bytesPerElement=24,nt(ru,"StructArrayLayout6f24");class Qs extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,a,u){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,n,a,u)}emplace(e,i,n,a,u,h){const f=5*e;return this.float32[f+0]=i,this.float32[f+1]=n,this.float32[f+2]=a,this.float32[f+3]=u,this.float32[f+4]=h,e}}Qs.prototype.bytesPerElement=20,nt(Qs,"StructArrayLayout5f20");class nu extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,a,u,h,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,n,a,u,h,f)}emplace(e,i,n,a,u,h,f,_){const g=7*e;return this.float32[g+0]=i,this.float32[g+1]=n,this.float32[g+2]=a,this.float32[g+3]=u,this.float32[g+4]=h,this.float32[g+5]=f,this.float32[g+6]=_,e}}nu.prototype.bytesPerElement=28,nt(nu,"StructArrayLayout7f28");class Jh extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,a,u,h,f,_,g,v,b){const w=this.length;return this.resize(w+1),this.emplace(w,e,i,n,a,u,h,f,_,g,v,b)}emplace(e,i,n,a,u,h,f,_,g,v,b,w){const E=11*e;return this.float32[E+0]=i,this.float32[E+1]=n,this.float32[E+2]=a,this.float32[E+3]=u,this.float32[E+4]=h,this.float32[E+5]=f,this.float32[E+6]=_,this.float32[E+7]=g,this.float32[E+8]=v,this.float32[E+9]=b,this.float32[E+10]=w,e}}Jh.prototype.bytesPerElement=44,nt(Jh,"StructArrayLayout11f44");class Ul extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,a,u,h,f,_,g){const v=this.length;return this.resize(v+1),this.emplace(v,e,i,n,a,u,h,f,_,g)}emplace(e,i,n,a,u,h,f,_,g,v){const b=9*e;return this.float32[b+0]=i,this.float32[b+1]=n,this.float32[b+2]=a,this.float32[b+3]=u,this.float32[b+4]=h,this.float32[b+5]=f,this.float32[b+6]=_,this.float32[b+7]=g,this.float32[b+8]=v,e}}Ul.prototype.bytesPerElement=36,nt(Ul,"StructArrayLayout9f36");class ea extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,i)}emplace(e,i,n){const a=2*e;return this.float32[a+0]=i,this.float32[a+1]=n,e}}ea.prototype.bytesPerElement=8,nt(ea,"StructArrayLayout2f8");class Qh extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,n,a){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,n,a)}emplace(e,i,n,a,u){const h=6*e;return this.uint32[3*e+0]=i,this.uint16[h+2]=n,this.uint16[h+3]=a,this.uint16[h+4]=u,e}}Qh.prototype.bytesPerElement=12,nt(Qh,"StructArrayLayout1ul3ui12");class jl extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint16[1*e+0]=i,e}}jl.prototype.bytesPerElement=2,nt(jl,"StructArrayLayout1ui2");class ed extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,a,u,h,f,_,g,v,b,w,E,I,P,D){const R=this.length;return this.resize(R+1),this.emplace(R,e,i,n,a,u,h,f,_,g,v,b,w,E,I,P,D)}emplace(e,i,n,a,u,h,f,_,g,v,b,w,E,I,P,D,R){const F=16*e;return this.float32[F+0]=i,this.float32[F+1]=n,this.float32[F+2]=a,this.float32[F+3]=u,this.float32[F+4]=h,this.float32[F+5]=f,this.float32[F+6]=_,this.float32[F+7]=g,this.float32[F+8]=v,this.float32[F+9]=b,this.float32[F+10]=w,this.float32[F+11]=E,this.float32[F+12]=I,this.float32[F+13]=P,this.float32[F+14]=D,this.float32[F+15]=R,e}}ed.prototype.bytesPerElement=64,nt(ed,"StructArrayLayout16f64");class Gl extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,a,u,h,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,n,a,u,h,f)}emplace(e,i,n,a,u,h,f,_){const g=10*e,v=5*e;return this.uint16[g+0]=i,this.uint16[g+1]=n,this.uint16[g+2]=a,this.uint16[g+3]=u,this.float32[v+2]=h,this.float32[v+3]=f,this.float32[v+4]=_,e}}Gl.prototype.bytesPerElement=20,nt(Gl,"StructArrayLayout4ui3f20");class td extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.int16[1*e+0]=i,e}}td.prototype.bytesPerElement=2,nt(td,"StructArrayLayout1i2");class ou extends vi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint8[1*e+0]=i,e}}ou.prototype.bytesPerElement=1,nt(ou,"StructArrayLayout1ub1");class rp extends Ss{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}rp.prototype.size=40;class np extends Nl{get(e){return new rp(this,e)}}nt(np,"CollisionBoxArray");class op extends Ss{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(e){this._structArray.uint8[this._pos1+49]=e}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(e){this._structArray.uint8[this._pos1+50]=e}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(e){this._structArray.uint32[this._pos4+13]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(e){this._structArray.uint8[this._pos1+58]=e}}op.prototype.size=60;class sp extends Vl{get(e){return new op(this,e)}}nt(sp,"PlacedSymbolArray");class ap extends Ss{get tileAnchorX(){return this._structArray.float32[this._pos4+0]}get tileAnchorY(){return this._structArray.float32[this._pos4+1]}get projectedAnchorX(){return this._structArray.int16[this._pos2+4]}get projectedAnchorY(){return this._structArray.int16[this._pos2+5]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+6]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+7]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+11]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get key(){return this._structArray.uint16[this._pos2+13]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+14]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+15]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+17]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+19]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+21]}get featureIndex(){return this._structArray.uint16[this._pos2+22]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+23]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numIconVertices(){return this._structArray.uint16[this._pos2+25]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+26]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+27]}get crossTileID(){return this._structArray.uint32[this._pos4+14]}set crossTileID(e){this._structArray.uint32[this._pos4+14]=e}get textOffset0(){return this._structArray.float32[this._pos4+15]}get textOffset1(){return this._structArray.float32[this._pos4+16]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+17]}get zOffset(){return this._structArray.float32[this._pos4+18]}set zOffset(e){this._structArray.float32[this._pos4+18]=e}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}get elevationFeatureIndex(){return this._structArray.uint16[this._pos2+39]}}ap.prototype.size=80;class lp extends Ua{get(e){return new ap(this,e)}}nt(lp,"SymbolInstanceArray");class ql extends Ir{getoffsetX(e){return this.float32[1*e+0]}}nt(ql,"GlyphOffsetArray");
vendor: 24,576 bytes, line 8
8class cp extends Es{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}nt(cp,"SymbolLineVertexArray");class up extends Ss{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}up.prototype.size=12;class Hl extends Qh{get(e){return new up(this,e)}}nt(Hl,"FeatureIndexArray");class hp extends On{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}nt(hp,"FillExtrusionCentroidArray");class id extends Ss{get a_join_normal_inside0(){return this._structArray.int16[this._pos2+0]}get a_join_normal_inside1(){return this._structArray.int16[this._pos2+1]}get a_join_normal_inside2(){return this._structArray.int16[this._pos2+2]}}id.prototype.size=6;class dp extends $o{get(e){return new id(this,e)}}nt(dp,"FillExtrusionWallArray");const fp=Nt([{name:"a_pos",components:2,type:"Int16"}],4),pp=Nt([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),mp=Nt([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class Ci{constructor(e=[]){this.segments=e}_prepareSegment(e,i,n,a){let u=this.segments[this.segments.length-1];return e>Ci.MAX_VERTEX_ARRAY_LENGTH&&xt(`Max vertices per segment is ${Ci.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!u||u.vertexLength+e>Ci.MAX_VERTEX_ARRAY_LENGTH||u.sortKey!==a)&&(u={vertexOffset:i,primitiveOffset:n,vertexLength:0,primitiveLength:0},a!==void 0&&(u.sortKey=a),this.segments.push(u)),u}prepareSegment(e,i,n,a){return this._prepareSegment(e,i.length,n.length,a)}get(){return this.segments}destroy(){for(const e of this.segments)for(const i in e.vaos)e.vaos[i].destroy()}static simpleSegment(e,i,n,a){return new Ci([{vertexOffset:e,primitiveOffset:i,vertexLength:n,primitiveLength:a,vaos:{},sortKey:0}])}}function _p(r,e){return 256*(r=Y(Math.floor(r),0,255))+Y(Math.floor(e),0,255)}Ci.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,nt(Ci,"SegmentVector");const gp=Nt([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),Xm=Nt([{name:"a_pattern_b",components:4,type:"Uint16"}]),Ym=Nt([{name:"a_dash",components:4,type:"Uint16"}]);class $l{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(e,i,n,a){this.ids.push(yp(e)),this.positions.push(i,n,a)}eachPosition(e,i){const n=yp(e);let a=0,u=this.ids.length-1;for(;a<u;){const h=a+u>>1;this.ids[h]>=n?u=h:a=h+1}for(;this.ids[a]===n;)i(this.positions[3*a],this.positions[3*a+1],this.positions[3*a+2]),a++}static serialize(e,i){const n=new Float64Array(e.ids),a=new Uint32Array(e.positions);return rd(n,a,0,n.length-1),i&&(i.add(n.buffer),i.add(a.buffer)),{ids:n,positions:a}}static deserialize(e){const i=new $l;let n;i.ids=e.ids,i.positions=e.positions;for(const a of i.ids)a!==n&&i.uniqueIds.push(a),n=a;return i.indexed=!0,i}}function yp(r){const e=+r;return Number.isSafeInteger(e)?e:ga(String(r))}function rd(r,e,i,n){for(;i<n;){const a=r[i+n>>1];let u=i-1,h=n+1;for(;;){do u++;while(r[u]<a);do h--;while(r[h]>a);if(u>=h)break;Zl(r,u,h),Zl(e,3*u,3*h),Zl(e,3*u+1,3*h+1),Zl(e,3*u+2,3*h+2)}h-i<n-h?(rd(r,e,i,h),i=h+1):(rd(r,e,h+1,n),n=h)}}function Zl(r,e,i){const n=r[e];r[e]=r[i],r[i]=n}nt($l,"FeaturePositionMap");class so{constructor(e){this.gl=e.gl,this.initialized=!1}fetchUniformLocation(e,i){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(e,i),this.initialized=!0),!!this.location}set(e,i,n){throw new Error("Uniform#set() must be implemented by each concrete Uniform")}}class kn extends so{constructor(e){super(e),this.current=0}set(e,i,n){this.fetchUniformLocation(e,i)&&this.current!==n&&(this.current=n,this.gl.uniform1i(this.location,n))}}class ir extends so{constructor(e){super(e),this.current=0}set(e,i,n){this.fetchUniformLocation(e,i)&&this.current!==n&&(this.current=n,this.gl.uniform1f(this.location,n))}}class Bn extends so{constructor(e){super(e),this.current=[0,0]}set(e,i,n){this.fetchUniformLocation(e,i)&&(n[0]===this.current[0]&&n[1]===this.current[1]||(this.current=n,this.gl.uniform2f(this.location,n[0],n[1])))}}class Wl extends so{constructor(e){super(e),this.current=[0,0,0]}set(e,i,n){this.fetchUniformLocation(e,i)&&(n[0]===this.current[0]&&n[1]===this.current[1]&&n[2]===this.current[2]||(this.current=n,this.gl.uniform3f(this.location,n[0],n[1],n[2])))}}class su extends so{constructor(e){super(e),this.current=[0,0,0,0]}set(e,i,n){this.fetchUniformLocation(e,i)&&(n[0]===this.current[0]&&n[1]===this.current[1]&&n[2]===this.current[2]&&n[3]===this.current[3]||(this.current=n,this.gl.uniform4f(this.location,n[0],n[1],n[2],n[3])))}}class xp extends so{constructor(e){super(e),this.current=ii.transparent.toPremultipliedRenderColor(null)}set(e,i,n){this.fetchUniformLocation(e,i)&&(n.r===this.current.r&&n.g===this.current.g&&n.b===this.current.b&&n.a===this.current.a||(this.current=n,this.gl.uniform4f(this.location,n.r,n.g,n.b,n.a)))}}const Km=new Float32Array(16);class ja extends so{constructor(e){super(e),this.current=Km}set(e,i,n){if(this.fetchUniformLocation(e,i)){if(n[12]!==this.current[12]||n[0]!==this.current[0])return this.current=n,void this.gl.uniformMatrix4fv(this.location,!1,n);for(let a=1;a<16;a++)if(n[a]!==this.current[a]){this.current=n,this.gl.uniformMatrix4fv(this.location,!1,n);break}}}}const Cg=new Float32Array(9),l=new Float32Array(4);class t extends so{constructor(e){super(e),this.current=l}set(e,i,n){if(this.fetchUniformLocation(e,i)){for(let a=0;a<4;a++)if(n[a]!==this.current[a]){this.current=n,this.gl.uniformMatrix2fv(this.location,!1,n);break}}}}function o(r){return[_p(255*r.r,255*r.g),_p(255*r.b,255*r.a)]}function c(r,e,i,n,a,u,h,f){return!!r&&(r.kind==="composite"||r.kind==="source"?r.evaluate(new ui(0,{brightness:u,worldview:f}),e,i,a,n,h)==="none":r.value==="none")}class d{constructor(e,i,n,a){this.value=e,this.uniformNames=i.map(u=>`u_${u}`),this.type=n,this.context=a}setUniform(e,i,n,a,u){const h=a.constantOr(this.value);i.set(e,u,h instanceof ii?h.toPremultipliedRenderColor(this.lutExpression&&this.lutExpression.kind==="constant"&&this.lutExpression.value==="none"?null:this.context.lut):h)}getBinding(e,i){return this.type==="color"?new xp(e):new ir(e)}}class p{constructor(e,i){this.uniformNames=i.map(n=>`u_${n}`),this.pattern=null,this.patternTransition=null,this.pixelRatio=1}setConstantPatternPositions(e,i){this.pixelRatio=e.pixelRatio||1,this.pattern=e.tl.concat(e.br),this.patternTransition=i?i.tl.concat(i.br):this.pattern}setUniform(e,i,n,a,u){let h=null;u!=="u_pattern"&&u!=="u_dash"||(h=this.pattern),u==="u_pattern_b"&&(h=this.patternTransition),u==="u_pixel_ratio"&&(h=this.pixelRatio),h&&i.set(e,u,h)}getBinding(e,i){return i==="u_pattern"||i==="u_pattern_b"||i==="u_dash"?new su(e):new ir(e)}}class m{constructor(e,i,n,a){this.expression=e,this.type=n,this.maxValue=0,this.paintVertexAttributes=i.map(u=>({name:`a_${u}`,type:"Float32",components:n==="color"?2:1,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,i,n,a,u,h,f,_){const g=this.paintVertexArray.length,v=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate(new ui(0,{brightness:h,worldview:_}),i,{},u,a,f):this.expression.kind==="constant"&&this.expression.value,b=c(this.lutExpression,i,{},a,u,h,f,_);this.paintVertexArray.resize(e),this._setPaintValue(g,e,v,b?null:this.context.lut)}updatePaintArray(e,i,n,a,u,h,f,_){const g=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate({zoom:0,brightness:f,worldview:_},n,a,void 0,u):this.expression.kind==="constant"&&this.expression.value,v=c(this.lutExpression,n,a,u,void 0,f,void 0,_);this._setPaintValue(e,i,g,v?null:this.context.lut)}_setPaintValue(e,i,n,a){if(this.type==="color"){const u=o(n.toPremultipliedRenderColor(a));for(let h=e;h<i;h++)this.paintVertexArray.emplace(h,u[0],u[1])}else{for(let u=e;u<i;u++)this.paintVertexArray.emplace(u,n);this.maxValue=Math.max(this.maxValue,Math.abs(n))}}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.lutExpression&&this.lutExpression.kind!=="constant"&&(this.lutExpression.isStateDependent||!this.lutExpression.isLightConstant)||this.expression.kind!=="constant"&&(this.expression.isStateDependent||!this.expression.isLightConstant)))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class y{constructor(e,i,n,a,u,h){this.expression=e,this.uniformNames=i.map(f=>`u_${f}_t`),this.type=n,this.useIntegerZoom=a,this.context=u,this.maxValue=0,this.paintVertexAttributes=i.map(f=>({name:`a_${f}`,type:"Float32",components:n==="color"?4:2,offset:0})),this.paintVertexArray=new h}populatePaintArray(e,i,n,a,u,h,f,_){const g=this.expression.evaluate(new ui(this.context.zoom,{brightness:h,worldview:_}),i,{},u,a,f),v=this.expression.evaluate(new ui(this.context.zoom+1,{brightness:h,worldview:_}),i,{},u,a,f),b=c(this.lutExpression,i,{},a,u,h,f,_),w=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(w,e,g,v,b?null:this.context.lut)}updatePaintArray(e,i,n,a,u,h,f,_){const g=this.expression.evaluate({zoom:this.context.zoom,brightness:f,worldview:_},n,a,void 0,u),v=this.expression.evaluate({zoom:this.context.zoom+1,brightness:f,worldview:_},n,a,void 0,u),b=c(this.lutExpression,n,a,u,void 0,f,void 0,_);this._setPaintValue(e,i,g,v,b?null:this.context.lut)}_setPaintValue(e,i,n,a,u){if(this.type==="color"){const h=o(n.toPremultipliedRenderColor(u)),f=o(a.toPremultipliedRenderColor(u));for(let _=e;_<i;_++)this.paintVertexArray.emplace(_,h[0],h[1],f[0],f[1])}else{for(let h=e;h<i;h++)this.paintVertexArray.emplace(h,n,a);this.maxValue=Math.max(this.maxValue,Math.abs(n),Math.abs(a))}}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||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,i,n,a,u){const h=this.useIntegerZoom?Math.floor(n.zoom):n.zoom,f=Y(this.expression.interpolationFactor(h,this.context.zoom,this.context.zoom+1),0,1);i.set(e,u,f)}getBinding(e,i){return new ir(e)}}class x{constructor(e,i,n,a,u){this.expression=e,this.layerId=u,this.paintVertexAttributes=(n==="array"?Ym:gp).members;for(let h=0;h<i.length;++h);this.paintVertexArray=new a,this.paintTransitionVertexArray=new Na}populatePaintArray(e,i,n,a){const u=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValues(u,e,i.patterns&&i.patterns[this.layerId],n)}updatePaintArray(e,i,n,a,u,h,f){this._setPaintValues(e,i,n.patterns&&n.patterns[this.layerId],h)}_setPaintValues(e,i,n,a){if(!a||!n)return;const u=a[n[0]],h=a[n[1]];if(u){if(u){const{tl:f,br:_,pixelRatio:g}=u;for(let v=e;v<i;v++)this.paintVertexArray.emplace(v,f[0],f[1],_[0],_[1],g)}if(h){this.paintTransitionVertexArray.resize(this.paintVertexArray.length);const{tl:f,br:_}=h;for(let g=e;g<i;g++)this.paintTransitionVertexArray.emplace(g,f[0],f[1],_[0],_[1])}}}upload(e){const i=this.expression.isStateDependent||!this.expression.isLightConstant;this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,i)),this.paintTransitionVertexArray&&this.paintTransitionVertexArray.length&&(this.paintTransitionVertexBuffer=e.createVertexBuffer(this.paintTransitionVertexArray,Xm.members,i))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy(),this.paintTransitionVertexBuffer&&this.paintTransitionVertexBuffer.destroy()}}class T{constructor(e,i,n=()=>!0){this.binders={},this._buffers=[],this.context=i;const a=[];for(const u in e.paint._values){const h=e.paint.get(u);if(u.endsWith("-use-theme")||!n(u)||!(h instanceof Ks&&Uc(h.property.specification)))continue;const f=A(u,e.type),_=h.value,g=h.property.specification.type,v=!!h.property.useIntegerZoom,b=u==="line-dasharray"||u.endsWith("pattern"),w=e.paint.get(`${u}-use-theme`),E=u==="line-dasharray"&&e.layout.get("line-cap").value.kind!=="constant"||w&&w.value.kind!=="constant";if(_.kind!=="constant"||E)if(_.kind==="source"||E||b){const I=z(u,g,"source");this.binders[u]=b?new x(_,f,g,I,e.id):new m(_,f,g,I),a.push(`/a_${u}`)}else{const I=z(u,g,"composite");this.binders[u]=new y(_,f,g,v,i,I),a.push(`/z_${u}`)}else this.binders[u]=b?new p(_.value,f):new d(_.value,f,g,i),a.push(`/u_${u}`);w&&(this.binders[u].lutExpression=w.value)}this.cacheKey=a.sort().join("")}getMaxValue(e){const i=this.binders[e];return i instanceof m||i instanceof y?i.maxValue:0}populatePaintArrays(e,i,n,a,u,h,f,_){for(const g in this.binders){const v=this.binders[g];v.context=this.context,(v instanceof m||v instanceof y||v instanceof x)&&v.populatePaintArray(e,i,n,a,u,h,f,_)}}setConstantPatternPositions(e,i){for(const n in this.binders){const a=this.binders[n];a instanceof p&&a.setConstantPatternPositions(e,i)}}getPatternTransitionVertexBuffer(e){const i=this.binders[e];return i instanceof x?i.paintTransitionVertexBuffer:null}updatePaintArrays(e,i,n,a,u,h,f,_,g,v){let b=!1;const w=Object.keys(e),E=w.length!==0&&!_,I=E?w:i.uniqueIds;this.context.lut=u.lut;for(const P in this.binders){const D=this.binders[P];if(D.context=this.context,(D instanceof m||D instanceof y||D instanceof x)&&D.expression&&D.expression.kind&&D.expression.kind!=="constant"&&(D.expression.isStateDependent===!0||D.expression.isLightConstant===!1)){const R=u.paint.get(P);D.expression=R.value;for(const F of I){const B=e[F.toString()];i.eachPosition(F,(V,$,H)=>{const J=a.feature(V);D.updatePaintArray($,H,J,B,h,f,g,v)})}if(!E)for(const F of n.uniqueIds){const B=e[F.toString()];n.eachPosition(F,(V,$,H)=>{const J=a.feature(V);D.updatePaintArray($,H,J,B,h,f,g,v)})}b=!0}}return b}defines(){const e=[];for(const i in this.binders){const n=this.binders[i];(n instanceof d||n instanceof p)&&e.push(...n.uniformNames.map(a=>`#define HAS_UNIFORM_${a}`))}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e){const i=[];for(const n in this.binders){const a=this.binders[n];if(a instanceof d||a instanceof p||a instanceof y)for(const u of a.uniformNames)i.push({name:u,property:n,binding:a.getBinding(e,u)})}return i}setUniforms(e,i,n,a,u){for(const{name:h,property:f,binding:_}of n)this.binders[f].setUniform(e,_,u,a.get(f),h)}updatePaintBuffers(){this._buffers=[];for(const e in this.binders){const i=this.binders[e];(i instanceof m||i instanceof y||i instanceof x)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer),i instanceof x&&i.paintTransitionVertexBuffer&&this._buffers.push(i.paintTransitionVertexBuffer)}}upload(e){for(const i in this.binders){const n=this.binders[i];(n instanceof m||n instanceof y||n instanceof x)&&n.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const i=this.binders[e];(i instanceof m||i instanceof y||i instanceof x)&&i.destroy()}}}class S{constructor(e,i,n=()=>!0){this.programConfigurations={};for(const a of e)this.programConfigurations[a.id]=new T(a,i,n);this.needsUpload=!1,this._featureMap=new $l,this._featureMapWithoutIds=new $l,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(e,i,n,a,u,h,f,_,g){for(const v in this.programConfigurations)this.programConfigurations[v].populatePaintArrays(e,i,a,u,h,f,_,g);i.id!==void 0?this._featureMap.add(i.id,n,this._bufferOffset,e):(this._featureMapWithoutIds.add(this._idlessCounter,n,this._bufferOffset,e),this._idlessCounter+=1),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,i,n,a,u,h,f,_){for(const g of n)this.needsUpload=this.programConfigurations[g.id].updatePaintArrays(e,this._featureMap,this._featureMapWithoutIds,i,g,a,u,h,f||0,_)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const i in this.programConfigurations)this.programConfigurations[i].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}const M={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-occlusion-opacity":["occlusion_opacity"],"icon-occlusion-opacity":["occlusion_opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-emissive-strength":["emissive_strength"],"icon-emissive-strength":["emissive_strength"],"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"],"symbol-z-offset":["z_offset"],"line-gap-width":["gapwidth"],"line-pattern":["pattern","pixel_ratio","pattern_b"],"fill-pattern":["pattern","pixel_ratio","pattern_b"],"fill-extrusion-pattern":["pattern","pixel_ratio","pattern_b"],"line-dasharray":["dash"],"fill-bridge-guard-rail-color":["structure_color"],"fill-tunnel-structure-color":["structure_color"]};function A(r,e){return M[r]||[r.replace(`${e}-`,"").replace(/-/g,"_")]}const C={"line-pattern":{source:wo,composite:wo},"fill-pattern":{source:wo,composite:wo},"fill-extrusion-pattern":{source:wo,composite:wo},"line-dasharray":{source:Na,composite:Na}},L={color:{source:ea,composite:Is},number:{source:Ir,composite:ea}};function z(r,e,i){const n=C[r];return n&&n[i]||L[e][i]}nt(d,"ConstantBinder"),nt(p,"PatternConstantBinder"),nt(m,"SourceExpressionBinder"),nt(x,"PatternCompositeBinder"),nt(y,"CompositeExpressionBinder"),nt(T,"ProgramConfiguration",{omit:["_buffers"]}),nt(S,"ProgramConfigurationSet");const O=We/Math.PI/2,N=64,q=[N,32,16],G=-O,j=O;function ie(r,e,i,n=O){return i=$t(i),[r*Math.sin(i)*n,-e*n,r*Math.cos(i)*n]}function Q(r,e,i){return ie(Math.cos($t(r)),Math.sin($t(r)),e,i)}const te=63710088e-1,X=2*Math.PI*te;class Z{constructor(e,i){if(isNaN(e)||isNaN(i))throw new Error(`Invalid LngLat object: (${e}, ${i})`);if(this.lng=+e,this.lat=+i,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Z(xe(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const i=Math.PI/180,n=this.lat*i,a=e.lat*i,u=Math.sin(n)*Math.sin(a)+Math.cos(n)*Math.cos(a)*Math.cos((e.lng-this.lng)*i);return te*Math.acos(Math.min(u,1))}toBounds(e=0){const i=360*e/40075017,n=i/Math.cos(Math.PI/180*this.lat);return new ne({lng:this.lng-n,lat:this.lat-i},{lng:this.lng+n,lat:this.lat+i})}toEcef(e){return Q(this.lat,this.lng,O+e*O/te)}static convert(e){if(e instanceof Z)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Z(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Z(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 ne{constructor(e,i){e&&(i?this.setSouthWest(e).setNorthEast(i):Array.isArray(e)&&e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1]))}setNorthEast(e){return this._ne=e instanceof Z?new Z(e.lng,e.lat):Z.convert(e),this}setSouthWest(e){return this._sw=e instanceof Z?new Z(e.lng,e.lat):Z.convert(e),this}extend(e){const i=this._sw,n=this._ne;let a,u;if(e instanceof Z)a=e,u=e;else{if(!(e instanceof ne))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(ne.convert(e)):this.extend(Z.convert(e)):typeof e=="object"&&e!==null&&e.hasOwnProperty("lat")&&(e.hasOwnProperty("lon")||e.hasOwnProperty("lng"))?this.extend(Z.convert(e)):this;if(a=e._sw,u=e._ne,!a||!u)return this}return i||n?(i.lng=Math.min(a.lng,i.lng),i.lat=Math.min(a.lat,i.lat),n.lng=Math.max(u.lng,n.lng),n.lat=Math.max(u.lat,n.lat)):(this._sw=new Z(a.lng,a.lat),this._ne=new Z(u.lng,u.lat)),this}getCenter(){return new Z((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 Z(this.getWest(),this.getNorth())}getSouthEast(){return new Z(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:i,lat:n}=Z.convert(e);let a=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(a=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&a}static convert(e){if(e)return e instanceof ne?e:new ne(e)}}function ce(r){return X*Math.cos(r*Math.PI/180)}function de(r){return(180+r)/360}function ve(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function ge(r,e){return r/ce(e)}function Me(r){return 360*r-180}function Fe(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function pe(r,e){return r*ce(Fe(e))}const oe=85.051129;function Ie(r){return Math.cos($t(Y(r,-85.051129,oe)))}function be(r,e){const i=Y(e,0,25.5),n=Math.pow(2,i);return Ie(r)*X/(512*n)}function ke(r){return 1/Math.cos(r*Math.PI/180)}function Ue(r,e=0){const i=Math.exp(Math.PI*(1-(r.y+e/We)/(1<<r.z)*2));return 80150034*i/(i*i+1)/We/(1<<r.z)}class Ke{constructor(e,i,n=0){this.x=+e,this.y=+i,this.z=+n}static fromLngLat(e,i=0){const n=Z.convert(e);return new Ke(de(n.lng),ve(n.lat),ge(i,n.lat))}toLngLat(){return new Z(Me(this.x),Fe(this.y))}toAltitude(){return pe(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/X*ke(Fe(this.y))}}function je(r,e,i,n,a,u,h,f,_){const g=(e+n)/2,v=(i+a)/2,b=new Be(g,v);f(b),(function(w,E,I,P,D,R){const F=I-D,B=P-R;return Math.abs((P-E)*F-(I-w)*B)/Math.hypot(F,B)})(b.x,b.y,u.x,u.y,h.x,h.y)>=_?(je(r,e,i,g,v,u,b,f,_),je(r,g,v,n,a,b,h,f,_)):r.push(h)}function He(r,e,i){let n=r[0],a=n.x,u=n.y;e(n);const h=[n];for(let f=1;f<r.length;f++){const _=r[f],{x:g,y:v}=_;e(_),je(h,a,u,g,v,n,_,e,i),a=g,u=v,n=_}return h}function lt(r,e,i,n){if(n(e,i)){const a=e.add(i)._mult(.5);lt(r,e,a,n),lt(r,a,i,n)}else r.push(i)}function st(r,e){let i=r[0];const n=[i];for(let a=1;a<r.length;a++){const u=r[a];lt(n,i,u,e),i=u}return n}const et=Math.pow(2,14)-1,ot=-et-1;function dt(r,e){const i=Math.round(r.x*e),n=Math.round(r.y*e);return r.x=Y(i,ot,et),r.y=Y(n,ot,et),(i<r.x||i>r.x+1||n<r.y||n>r.y+1)&&xt("Geometry exceeds allowed extent, reduce your vector tile buffer size"),r}function yt(r,e,i){const n=r.loadGeometry(),a=r.extent,u=We/a;if(e&&i&&i.projection.isReprojectedInTileSpace){const h=1<<e.z,{scale:f,x:_,y:g,projection:v}=i,b=w=>{const E=Me((e.x+w.x/a)/h),I=Fe((e.y+w.y/a)/h),P=v.project(E,I);w.x=(P.x*f-_)*a,w.y=(P.y*f-g)*a};for(let w=0;w<n.length;w++)if(r.type!==1)n[w]=He(n[w],b,1);else{const E=[];for(const I of n[w])I.x<0||I.x>=a||I.y<0||I.y>=a||(b(I),E.push(I));n[w]=E}}for(const h of n)for(const f of h)dt(f,u);return n}function Pt(r,e){return{type:r.type,id:r.id,properties:r.properties,geometry:e?yt(r):[]}}class Vt{constructor(e,i,n,a,u){this.properties={},this.extent=n,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=a,this._values=u,e.readFields(St,this,i)}loadGeometry(){const e=this._pbf;e.pos=this._geometry;const i=e.readVarint()+e.pos,n=[];let a,u=1,h=0,f=0,_=0;for(;e.pos<i;){if(h<=0){const g=e.readVarint();u=7&g,h=g>>3}if(h--,u===1||u===2)f+=e.readSVarint(),_+=e.readSVarint(),u===1&&(a&&n.push(a),a=[]),a&&a.push(new Be(f,_));else{if(u!==7)throw new Error(`unknown command ${u}`);a&&a.push(a[0].clone())}}return a&&n.push(a),n}bbox(){const e=this._pbf;e.pos=this._geometry;const i=e.readVarint()+e.pos;let n=1,a=0,u=0,h=0,f=1/0,_=-1/0,g=1/0,v=-1/0;for(;e.pos<i;){if(a<=0){const b=e.readVarint();n=7&b,a=b>>3}if(a--,n===1||n===2)u+=e.readSVarint(),h+=e.readSVarint(),u<f&&(f=u),u>_&&(_=u),h<g&&(g=h),h>v&&(v=h);else if(n!==7)throw new Error(`unknown command ${n}`)}return[f,g,_,v]}toGeoJSON(e,i,n){const a=this.extent*Math.pow(2,n),u=this.extent*e,h=this.extent*i,f=this.loadGeometry();function _(w){return[360*(w.x+u)/a-180,360/Math.PI*Math.atan(Math.exp((1-2*(w.y+h)/a)*Math.PI))-90]}function g(w){return w.map(_)}let v;
8if(this.type===1){const w=[];for(const I of f)w.push(I[0]);const E=g(w);v=w.length===1?{type:"Point",coordinates:E[0]}:{type:"MultiPoint",coordinates:E}}else if(this.type===2){const w=f.map(g);v=w.length===1?{type:"LineString",coordinates:w[0]}:{type:"MultiLineString",coordinates:w}}else{if(this.type!==3)throw new Error("unknown feature type");{const w=(function(I){const P=I.length;if(P<=1)return[I];const D=[];let R,F;for(let B=0;B<P;B++){const V=Zt(I[B]);V!==0&&(F===void 0&&(F=V<0),F===V<0?(R&&D.push(R),R=[I[B]]):R&&R.push(I[B]))}return R&&D.push(R),D})(f),E=[];for(const I of w)E.push(I.map(g));v=E.length===1?{type:"Polygon",coordinates:E[0]}:{type:"MultiPolygon",coordinates:E}}}const b={type:"Feature",geometry:v,properties:this.properties};return this.id!=null&&(b.id=this.id),b}}function St(r,e,i){r===1?e.id=i.readVarint():r===2?(function(n,a){const u=n.readVarint()+n.pos;for(;n.pos<u;){const h=a._keys[n.readVarint()],f=a._values[n.readVarint()];a.properties[h]=f}})(i,e):r===3?e.type=i.readVarint():r===4&&(e._geometry=i.pos)}function Zt(r){let e=0;for(let i,n,a=0,u=r.length,h=u-1;a<u;h=a++)i=r[a],n=r[h],e+=(n.x-i.x)*(i.y+n.y);return e}Vt.types=["Unknown","Point","LineString","Polygon"];class It{constructor(e,i){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(si,this,i),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];const i=this._pbf.readVarint()+this._pbf.pos;return new Vt(this._pbf,i,this.extent,this._keys,this._values)}}function si(r,e,i){r===15?e.version=i.readVarint():r===1?e.name=i.readString():r===5?e.extent=i.readVarint():r===2?e._features.push(i.pos):r===3?e._keys.push(i.readString()):r===4&&e._values.push((function(n){let a=null;const u=n.readVarint()+n.pos;for(;n.pos<u;){const h=n.readVarint()>>3;a=h===1?n.readString():h===2?n.readFloat():h===3?n.readDouble():h===4?n.readVarint64():h===5?n.readVarint():h===6?n.readSVarint():h===7?n.readBoolean():null}if(a==null)throw new Error("unknown feature value");return a})(i))}class ri{constructor(e,i){this.layers=e.readFields(ci,{},i)}}function ci(r,e,i){if(r===3){const n=new It(i,i.readVarint()+i.pos);n.length&&(e[n.name]=n)}}const Ut="3d_elevation_id",Mt="level";class Jt{constructor(){this._valid=!1}reset(e){return this.feature=e,this._valid=!0,this._geometry=e.loadGeometry(),this._geometry.length!==0&&this._geometry[0].length!==0||(this._valid=!1),this}geometry(e,i){return this._valid&&e(i(this._geometry)),this}require(e,i,n){return this.get(e,!0,i,n)}optional(e,i,n){return this.get(e,!1,i,n)}success(){return this._valid}get(e,i,n,a){const u=this.feature.properties.hasOwnProperty(e)?+this.feature.properties[e]:void 0;return this._valid&&u!==void 0&&!Number.isNaN(u)?n(a?a(u):u):i&&(this._valid=!1),this}}class Pi{constructor(e,i){this.featureFunc=e,this.vertexFunc=i}parseFeature(e,i,n){return this.featureFunc(e,i,n)}parseVertex(e,i,n){return this.vertexFunc(e,i,n)}}const Ri=new Pi((r,e,i)=>r.reset(e).require(Ut,n=>{i.id=n}).optional("fixed_height_relative",n=>{i.constantHeight=n},kt.decodeRelativeHeight).geometry(n=>{i.bounds=n},bl).success(),(r,e,i)=>r.reset(e).require(Ut,n=>{i.id=n}).require("elevation_idx",n=>{i.idx=n}).require("extent",n=>{i.extent=n}).require("height_relative",n=>{i.height=n},kt.decodeRelativeHeight).geometry(n=>{i.position=n},kt.getPoint).success()),Qt=new Pi((r,e,i)=>r.reset(e).require(Ut,n=>{i.id=n}).optional("fixed_height",n=>{i.constantHeight=n},kt.decodeMetricHeight).geometry(n=>{i.bounds=n},bl).success(),(r,e,i)=>r.reset(e).require(Ut,n=>{i.id=n}).require("elevation_idx",n=>{i.idx=n}).require("extent",n=>{i.extent=n}).require("height",n=>{i.height=n},kt.decodeMetricHeight).geometry(n=>{i.position=n},kt.getPoint).success());class kt{static getPoint(e){return Do(e[0][0].x,e[0][0].y)}static decodeRelativeHeight(e){return 1e-4*e*5}static decodeMetricHeight(e){return 1e-4*e}static getVersionSchema(e){return e?e==="1.0.1"?Qt:void 0:Ri}static parse(e){const i=[],n=[],a=e.length,u=new Jt;for(let h=0;h<a;h++){const f=e.feature(h),_=f.properties.version,g=kt.getVersionSchema(_);if(g===void 0){xt(`Unknown elevation feature version number ${_||"(unknown)"}`);continue}const v=f.properties.type;if(!v)continue;const b=Vt.types[f.type];if(b==="Point"&&v==="curve_point"){const w={};g.parseVertex(u,f,w)&&i.push(w)}else if(b==="Polygon"&&v==="curve_meta"){const w={};g.parseFeature(u,f,w)&&n.push(w)}}return{vertices:i,features:n}}}class Ct{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,n){const a=Ai(i,this.dir);if(Math.abs(a)<1e-6)return!1;const u=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1])/a;return n[0]=this.pos[0]+this.dir[0]*u,n[1]=this.pos[1]+this.dir[1]*u,!0}}class pi{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,n){const a=Gi(i,this.dir);if(Math.abs(a)<1e-6)return!1;const u=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1]+(e[2]-this.pos[2])*i[2])/a;return n[0]=this.pos[0]+this.dir[0]*u,n[1]=this.pos[1]+this.dir[1]*u,n[2]=this.pos[2]+this.dir[2]*u,!0}closestPointOnSphere(e,i,n){if((function(E,I){var P=E[0],D=E[1],R=E[2],F=I[0],B=I[1],V=I[2];return Math.abs(P-F)<=zt*Math.max(1,Math.abs(P),Math.abs(F))&&Math.abs(D-B)<=zt*Math.max(1,Math.abs(D),Math.abs(B))&&Math.abs(R-V)<=zt*Math.max(1,Math.abs(R),Math.abs(V))})(this.pos,e)||i===0)return n[0]=n[1]=n[2]=0,!1;const[a,u,h]=this.dir,f=this.pos[0]-e[0],_=this.pos[1]-e[1],g=this.pos[2]-e[2],v=a*
vendor: 31,510 bytes, line 8
8a+u*u+h*h,b=2*(f*a+_*u+g*h),w=b*b-4*v*(f*f+_*_+g*g-i*i);if(w<0){const E=Math.max(-b/2,0),I=f+a*E,P=_+u*E,D=g+h*E,R=Math.hypot(I,P,D);return n[0]=I*i/R,n[1]=P*i/R,n[2]=D*i/R,!1}{const E=(-b-Math.sqrt(w))/(2*v);if(E<0){const I=Math.hypot(f,_,g);return n[0]=f*i/I,n[1]=_*i/I,n[2]=g*i/I,!1}return n[0]=f+a*E,n[1]=_+u*E,n[2]=g+h*E,!0}}}class Ni{constructor(e,i,n,a,u){this.TL=e,this.TR=i,this.BR=n,this.BL=a,this.horizon=u}static fromInvProjectionMatrix(e,i,n){const a=[-1,1,1],u=[1,1,1],h=[1,-1,1],f=[-1,-1,1],_=Qi(a,a,e),g=Qi(u,u,e),v=Qi(h,h,e),b=Qi(f,f,e);return new Ni(_,g,v,b,i/n)}}function gi(r,e,i){let n=1/0,a=-1/0;const u=[];for(const h of r){tr(u,h,e);const f=Gi(u,i);n=Math.min(n,f),a=Math.max(a,f)}return[n,a]}function bi(r,e){let i=!0;for(let n=0;n<r.planes.length;n++){const a=r.planes[n];let u=0;for(let h=0;h<e.length;h++)u+=+(Gi(a,e[h])+a[3]>=0);if(u===0)return 0;u!==e.length&&(i=!1)}return i?2:1}function en(r,e){for(const i of r.projections){const n=gi(e,r.points[0],i.axis);if(i.projection[1]<n[0]||i.projection[0]>n[1])return 0}return 1}function mn(r,e){let i=0;const n=[0,0,0,0];for(let a=0;a<r.length;a++)n[0]=r[a][0],n[1]=r[a][1],n[2]=r[a][2],n[3]=1,yn(n,e)>=0&&i++;return i}class xr{constructor(e,i){this.points=e||new Array(8).fill([0,0,0]),this.planes=i||new Array(6).fill([0,0,0,0]),this.bounds=ei.fromPoints(this.points),this.projections=[],this.frustumEdges=[tr([],this.points[2],this.points[3]),tr([],this.points[0],this.points[3]),tr([],this.points[4],this.points[0]),tr([],this.points[5],this.points[1]),tr([],this.points[6],this.points[2]),tr([],this.points[7],this.points[3])];for(const n of this.frustumEdges){const a=[0,-n[2],n[1]],u=[n[2],0,-n[0]];this.projections.push({axis:a,projection:gi(this.points,this.points[0],a)}),this.projections.push({axis:u,projection:gi(this.points,this.points[0],u)})}}static fromInvProjectionMatrix(e,i,n,a){const u=Math.pow(2,n),h=[[-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(g=>{const v=an([],g,e),b=1/v[3]/i*u;return(w=v)[0]=(E=v)[0]*(I=[b,b,a?1/v[3]:b,b])[0],w[1]=E[1]*I[1],w[2]=E[2]*I[2],w[3]=E[3]*I[3],w;var w,E,I}),f=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(g=>{const v=mi([],Fr([],tr([],h[g[0]],h[g[1]]),tr([],h[g[2]],h[g[1]]))),b=-Gi(v,h[g[1]]);return v.concat(b)}),_=[];for(let g=0;g<h.length;g++)_.push([h[g][0],h[g][1],h[g][2]]);return new xr(_,f)}intersectsPrecise(e,i,n){for(let a=0;a<i.length;a++)if(!mn(e,i[a]))return 0;for(let a=0;a<this.planes.length;a++)if(!mn(e,this.planes[a]))return 0;for(const a of n)for(const u of this.frustumEdges){const h=Fr([],a,u),f=gn(h);if(f===0)continue;ki(h,h,1/f);const _=gi(this.points,this.points[0],h),g=gi(e,this.points[0],h);if(_[0]>g[1]||g[0]>_[1])return 0}return 1}containsPoint(e){for(const i of this.planes){const n=i[3];if(Gi([i[0],i[1],i[2]],e)+n<0)return!1}return!0}}class ei{static fromPoints(e){const i=[1/0,1/0,1/0],n=[-1/0,-1/0,-1/0];for(const a of e)fo(i,i,a),to(n,n,a);return new ei(i,n)}static fromTileIdAndHeight(e,i,n){const a=1<<e.canonical.z,u=e.canonical.x,h=e.canonical.y;return new ei([u/a,h/a,i],[(u+1)/a,(h+1)/a,n])}static applyTransform(e,i){const n=e.getCorners();for(let a=0;a<n.length;++a)Qi(n[a],n[a],i);return ei.fromPoints(n)}static applyTransformFast(e,i){const n=[i[12],i[13],i[14]],a=[...n];for(let u=0;u<3;u++)for(let h=0;h<3;h++){const f=i[4*h+u],_=f*e.min[h],g=f*e.max[h];n[u]+=Math.min(_,g),a[u]+=Math.max(_,g)}return new ei(n,a)}static projectAabbCorners(e,i){const n=e.getCorners();for(let a=0;a<n.length;++a)Qi(n[a],n[a],i);return n}constructor(e,i){this.min=e,this.max=i,this.center=ki([],nr([],this.min,this.max),.5)}quadrant(e){const i=[e%2==0,e<2],n=lc(this.min),a=lc(this.max);for(let u=0;u<i.length;u++)n[u]=i[u]?this.min[u]:this.center[u],a[u]=i[u]?this.center[u]:this.max[u];return a[2]=this.max[2],new ei(n,a)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}distanceZ(e){return Math.max(Math.min(this.max[2],e[2]),this.min[2])-e[2]}getCorners(){const e=this.min,i=this.max;return[[e[0],e[1],e[2]],[i[0],e[1],e[2]],[i[0],i[1],e[2]],[e[0],i[1],e[2]],[e[0],e[1],i[2]],[i[0],e[1],i[2]],[i[0],i[1],i[2]],[e[0],i[1],i[2]]]}intersects(e){return this.intersectsAabb(e.bounds)?bi(e,this.getCorners()):0}intersectsFlat(e){return this.intersectsAabb(e.bounds)?bi(e,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsPrecise(e,i){return i||this.intersects(e)?en(e,this.getCorners()):0}intersectsPreciseFlat(e,i){return i||this.intersectsFlat(e)?en(e,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsAabb(e){for(let i=0;i<3;++i)if(this.min[i]>e.max[i]||e.min[i]>this.max[i])return!1;return!0}intersectsAabbXY(e){return!(this.min[0]>e.max[0]||e.min[0]>this.max[0]||this.min[1]>e.max[1]||e.min[1]>this.max[1])}encapsulate(e){for(let i=0;i<3;i++)this.min[i]=Math.min(this.min[i],e.min[i]),this.max[i]=Math.max(this.max[i],e.max[i])}encapsulatePoint(e){for(let i=0;i<3;i++)this.min[i]=Math.min(this.min[i],e[i]),this.max[i]=Math.max(this.max[i],e[i])}closestPoint(e){return[Math.max(Math.min(this.max[0],e[0]),this.min[0]),Math.max(Math.min(this.max[1],e[1]),this.min[1]),Math.max(Math.min(this.max[2],e[2]),this.min[2])]}}nt(ei,"Aabb");class wn{constructor(e,i){this.feature=e,this.metersToTile=i,this.index=0}get(){const e=this.feature.vertices[this.index],i=this.feature.vertexProps[this.index].dir,n=i[1],a=-i[0],u=(e.extent+1)*this.metersToTile;return[new Be(Math.trunc(e.position[0]+n*u),Math.trunc(e.position[1]+a*u)),new Be(Math.trunc(e.position[0]-n*u),Math.trunc(e.position[1]-a*u))]}next(){this.index++}valid(){return this.index<this.feature.vertices.length}}class Dr{constructor(e,i,n,a,u,h){if(this.vertices=new Array,this.vertexProps=new Array,this.edges=new Array,this.edgeProps=new Array,this._tmpVec2=[Or(),Or(),Or(),Or(),Or(),Or(),Or()],this.id=e,this.heightRange={min:n,max:n},this.safeArea=i,this.constantHeight=n,this.constantHeight==null&&(this.constantHeight!=null||a.length!==0)){this.vertices=a,this.edges=u,this.edges=this.edges.filter(f=>{return f.a<this.vertices.length&&f.b<this.vertices.length&&!((_=this.vertices[f.a].position)[0]===(g=this.vertices[f.b].position)[0]&&_[1]===g[1]);var _,g}),this.heightRange={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};for(const f of this.vertices)this.vertexProps.push({dir:Do(0,0)}),this.heightRange.min=Math.min(this.heightRange.min,f.height),this.heightRange.max=Math.max(this.heightRange.max,f.height);for(const f of this.edges){const _=this.vertices[f.a].position,g=this.vertices[f.b].position,v=Fo(Or(),g,_),b=ss(v),w=os(Or(),v,1/b);this.edgeProps.push({vec:v,dir:w,len:b});const E=this.vertexProps[f.a].dir,I=this.vertexProps[f.b].dir;ns(E,E,w),ns(I,I,w)}for(const f of this.vertexProps)f.dir[0]===0&&f.dir[1]===0||ha(f.dir,f.dir);this.tessellate(h)}}pointElevation(e){if(this.constantHeight!=null)return this.constantHeight;const i=this.getClosestEdge(e);if(i==null)return 0;const[n,a]=i;return _t(this.vertices[this.edges[n].a].height,this.vertices[this.edges[n].b].height,a)}computeSlopeNormal(e,i){const n=this.getClosestEdge(e);if(!n)return xi(0,0,1);const a=n[0],u=this.edges[a],h=this.edgeProps[a].vec,f=xi(h[0],h[1],(this.vertices[u.b].height-this.vertices[u.a].height)*i),_=xi(f[1],-f[0],0);Fr(_,_,f);const g=gn(_);return g>0?ki(_,_,1/g):wi(_,0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(e){if(this.edges.length===0)return;let i=0,n=Number.POSITIVE_INFINITY,a=0;const[u,h,f,_,g,v,b]=this._tmpVec2;Lo(b,e.x,e.y);const w=new Ct(b,null);for(let E=0;E<this.edges.length;E++){const I=this.edges[E],P=this.edgeProps[E].dir;w.dir=P;const D=this.vertices[I.a].position,R=this.vertices[I.b].position,F=w.intersectsPlane(D,this.vertexProps[I.a].dir,u),B=w.intersectsPlane(R,this.vertexProps[I.b].dir,h);if(!F||!B)continue;Fo(f,h,u),Fo(_,b,u);const V=Ai(f,f),$=V>0?Ai(_,f)/V:0,H=Y($,0,1),J=Math.abs(($-H)*this.edgeProps[E].len);Fo(g,b,D),Lo(v,P[1],-P[0]);const ee=J+Math.abs(Ai(g,v));ee<n&&(i=E,n=ee,a=H)}return[i,a]}tessellate(e){const i=li(),n=li(),a=li(),u=li();for(let h=this.edges.length-1;h>=0;--h){const f=this.edges[h].a,_=this.edges[h].b,{position:g,height:v,extent:b}=this.vertices[f],{position:w,height:E,extent:I}=this.vertices[_],P=this.vertexProps[f].dir,D=this.vertexProps[_].dir;if(wi(i,g[0]/e,g[1]/e,v),wi(n,w[0]/e,w[1]/e,E),wi(a,P[1],-P[0],0),ki(a,a,b),wi(u,D[1],-D[0],0),ki(u,u,I),this.distSqLines(xi(i[0]+.5*a[0],i[1]+.5*a[1],i[2]+.5*a[2]),xi(n[0]-.5*u[0],n[1]-.5*u[1],n[2]-.5*u[2]),xi(i[0]-.5*a[0],i[1]-.5*a[1],i[2]-.5*a[2]),xi(n[0]+.5*u[0],n[1]+.5*u[1],n[2]+.5*u[2]))<=.0025000000000000005)continue;const R=this.vertices.length,F=ns(Or(),g,w);this.vertices.push({position:os(F,F,.5),height:.5*(v+E),extent:.5*(b+I)});const B=ns(Or(),P,D);this.vertexProps.push({dir:ha(B,B)}),this.edges.splice(h,1),this.edgeProps.splice(h,1),this.edges.push({a:f,b:R}),this.edges.push({a:R,b:_});const V=Fo(Or(),this.vertices[R].position,g),$=ss(V),H={vec:V,dir:os(Or(),V,1/$),len:$};this.edgeProps.push(H),this.edgeProps.push(H)}}distSqLines(e,i,n,a){const u=ho(li(),i,e),h=ho(li(),a,n),f=ho(li(),e,n),_=Gi(u,u),g=Gi(u,h),v=Gi(u,f),b=Gi(h,h),w=Gi(h,f),E=_*b-g*g;if(E===0)return nl(Fs(u,n,a,Gi(f,h)/Gi(h,h)),e);const I=(_*w-g*v)/E;return nl(Fs(u,e,i,(g*w-v*b)/E),Fs(h,n,a,I))}}class tn{static parseFrom(e,i){const n=kt.parse(e);if(!n)return[];let{vertices:a,features:u}=n;const h=1/Ue(i);u.sort((v,b)=>v.id-b.id),a.sort((v,b)=>v.id-b.id||v.idx-b.idx),a=a.filter((v,b,w)=>b===w.findIndex(E=>E.id===v.id&&E.idx===v.idx));const f=new Array;let _=0;const g=a.length;for(const v of u){if(v.constantHeight){f.push(new Dr(v.id,v.bounds,v.constantHeight));continue}for(;_!==g&&a[_].id<v.id;)_++;if(_===g||a[_].id!==v.id)continue;const b=new Array,w=new Array,E=_;for(;_!==g&&a[_].id===v.id;){const I=a[_];if(b.push({position:I.position,height:I.height,extent:I.extent}),_!==E&&a[_-1].idx===I.idx-1){const P=_-E;w.push({a:P-1,b:P})}_++}f.push(new Dr(v.id,v.bounds,void 0,b,w,h))}return f}static getElevationFeature(e,i){if(!i)return;const n=+e.properties[Ut];return Number.isNaN(n)?void 0:i.find(a=>a.id===n)}}class Kn{constructor(e,i){this.zScale=1,this.xOffset=0,this.yOffset=0,e.equals(i)||(this.zScale=Math.pow(2,i.z-e.z),this.xOffset=(e.x*this.zScale-i.x)*We,this.yOffset=(e.y*this.zScale-i.y)*We)}constantElevation(e,i){if(e.constantHeight!=null)return this.computeBiasedHeight(e.constantHeight,i)}pointElevation(e,i,n){const a=this.constantElevation(i,n);return a??(e.x=e.x*this.zScale+this.xOffset,e.y=e.y*this.zScale+this.yOffset,this.computeBiasedHeight(i.pointElevation(e),n))}computeBiasedHeight(e,i){return i<=0?e:e+i*le(0,i,e>=0?e:Math.abs(.5*e))}}nt(Dr,"ElevationFeature");class rn{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.projection=e.projection,this.layoutVertexArray=new Es,this.indexArray=new hr,this.segments=new Ci,this.programConfigurations=new S(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.elevationMode=this.layers[0].layout.get("circle-elevation-reference"),this.hasElevation=!1,this.elevationMode!=="none"&&(this.elevatedLayoutVertexArray=new Ir),this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,i){}updateAppearances(e,i,n,a){}populate(e,i,n,a){const u=this.layers[0],h=[];let f=null;u.type==="circle"&&(f=u.layout.get("circle-sort-key"));for(const{feature:g,id:v,index:b,sourceLayerIndex:w}of e){const E=this.layers[0]._featureFilter.needGeometry,I=Pt(g,E);if(!this.layers[0]._featureFilter.filter(new ui(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),I,n))continue;const P=f?f.evaluate(I,{},n):void 0,D={id:v,properties:g.properties,type:g.type,sourceLayerIndex:w,index:b,geometry:E?I.geometry:yt(g,n,a),patterns:{},sortKey:P};h.push(D)}f&&h.sort((g,v)=>g.sortKey-v.sortKey);let _=null;a.projection.name==="globe"&&(this.globeExtVertexArray=new Va,_=a.projection);for(const g of h){const{geometry:v,index:b,sourceLayerIndex:w}=g,E=e[b].feature;this.addFeature(g,v,b,i.availableImages,n,_,i.brightness,i.elevationFeatures),i.featureIndex.insert(E,v,b,w,this.index)}this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}update(e,i,n,a,u,h,f){this.programConfigurations.updatePaintArrays(e,i,u,n,a,h,f,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,fp.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,mp.members)),this.elevatedLayoutVertexArray&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,pp.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy())}addFeature(e,i,n,a,u,h,f,_){let g;this.elevationMode!=="none"&&(g=tn.getElevationFeature(e,_));for(const v of i)for(const b of v){const w=b.x,E=b.y;if(w<0||w>=We||E<0||E>=We)continue;if(h){const D=h.projectTilePoint(w,E,u),R=h.upVector(u,w,E);this.addGlobeExtVertex(D,R),this.addGlobeExtVertex(D,R),this.addGlobeExtVertex(D,R),this.addGlobeExtVertex(D,R)}const I=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),P=I.vertexLength;if(this.addCircleVertex(w,E,-1,-1),this.addCircleVertex(w,E,1,-1),this.addCircleVertex(w,E,1,1),this.addCircleVertex(w,E,-1,1),this.elevationMode!=="none"){const D=g?g.pointElevation(new Be(w,E)):0;this.hasElevation=this.hasElevation||D!==0;for(let R=0;R<4;R++)this.elevatedLayoutVertexArray.emplaceBack(D)}this.indexArray.emplaceBack(P,P+1,P+2),this.indexArray.emplaceBack(P,P+2,P+3),I.vertexLength+=4,I.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{},a,u,f,void 0,this.worldview)}addCircleVertex(e,i,n,a){this.layoutVertexArray.emplaceBack(2*e+(n+1)/2,2*i+(a+1)/2)}addGlobeExtVertex(e,i){this.globeExtVertexArray.emplaceBack(e.x,e.y,e.z,i[0]*16384,i[1]*16384,i[2]*16384)}}function Di(r,e){for(let i=0;i<r.length;i++)if(Sn(e,r[i]))return!0;for(let i=0;i<e.length;i++)if(Sn(r,e[i]))return!0;return!!kr(r,e)}function Ki(r,e,i){return!!Sn(r,e)||!!To(e,r,i)}function yi(r,e){if(r.length===1)return qa(e,r[0]);for(let i=0;i<e.length;i++){const n=e[i];for(let a=0;a<n.length;a++)if(Sn(r,n[a]))return!0}for(let i=0;i<r.length;i++)if(qa(e,r[i]))return!0;for(let i=0;i<e.length;i++)if(kr(r,e[i]))return!0;return!1}function rr(r,e,i){if(r.length>1){if(kr(r,e))return!0;for(let n=0;n<e.length;n++)if(To(e[n],r,i))return!0}for(let n=0;n<r.length;n++)if(To(r[n],e,i))return!0;return!1}function kr(r,e){if(r.length===0||e.length===0)return!1;for(let i=0;i<r.length-1;i++){const n=r[i],a=r[i+1];for(let u=0;u<e.length-1;u++)if($i(n,a,e[u],e[u+1]))return!0}return!1}function $i(r,e,i,n){return _i(r,i,n)!==_i(e,i,n)&&_i(r,e,i)!==_i(r,e,n)}function Tn(r,e,i){return(r.x-i.x)*(e.y-i.y)-(r.y-i.y)*(e.x-i.x)}function Xl(r,e,i,n){const a=Tn(r,e,n),u=Tn(r,e,i);if(Math.sign(a)===Math.sign(u))return;const h=Tn(i,n,r),f=h+u-a;return Math.sign(h)!==Math.sign(f)?[h/(h-f),u/(u-a)]:void 0}function To(r,e,i){const n=i*i;if(e.length===1)return r.distSqr(e[0])<n;for(let a=1;a<e.length;a++)if(Ga(r,e[a-1],e[a])<n)return!0;return!1}function Ga(r,e,i){const n=e.distSqr(i);if(n===0)return r.distSqr(e);const a=((r.x-e.x)*(i.x-e.x)+(r.y-e.y)*(i.y-e.y))/n;return r.distSqr(a<0?e:a>1?i:i.sub(e)._mult(a)._add(e))}function qa(r,e){let i,n,a,u=!1;for(let h=0;h<r.length;h++){i=r[h];for(let f=0,_=i.length-1;f<i.length;_=f++)n=i[f],a=i[_],n.y>e.y!=a.y>e.y&&e.x<(a.x-n.x)*(e.y-n.y)/(a.y-n.y)+n.x&&(u=!u)}return u}function Sn(r,e){let i=!1;for(let n=0,a=r.length-1;n<r.length;a=n++){const u=r[n],h=r[a];u.y>e.y!=h.y>e.y&&e.x<(h.x-u.x)*(e.y-u.y)/(h.y-u.y)+u.x&&(i=!i)}return i}function So(r,e,i,n,a){for(const h of r)if(e<=h.x&&i<=h.y&&n>=h.x&&a>=h.y)return!0;const u=[new Be(e,i),new Be(e,a),new Be(n,a),new Be(n,i)];if(r.length>2){for(const h of u)if(Sn(r,h))return!0}for(let h=0;h<r.length-1;h++)if(Eo(r[h],r[h+1],u))return!0;return!1}function Eo(r,e,i){const n=i[0],a=i[2];if(r.x<n.x&&e.x<n.x||r.x>a.x&&e.x>a.x||r.y<n.y&&e.y<n.y||r.y>a.y&&e.y>a.y)return!1;const u=_i(r,e,i[0]);return u!==_i(r,e,i[1])||u!==_i(r,e,i[2])||u!==_i(r,e,i[3])}function Nn(r,e,i,n,a,u){let h=e.y-r.y,f=r.x-e.x;if(u=u||0){const _=h*h+f*f;if(_===0)return!0;const g=Math.sqrt(_);h/=g,f/=g}return!((i.x-r.x)*h+(i.y-r.y)*f-u<0||(n.x-r.x)*h+(n.y-r.y)*f-u<0||(a.x-r.x)*h+(a.y-r.y)*f-u<0)}function Wo(r,e,i,n,a,u,h){return!(Nn(r,e,n,a,u,h)||Nn(e,i,n,a,u,h)||Nn(i,r,n,a,u,h)||Nn(n,a,r,e,i,h)||Nn(a,u,r,e,i,h)||Nn(u,n,r,e,i,h))}function ta(r,e,i){const n=e.paint.get(r).value;return n.kind==="constant"?n.value:i.programConfigurations.get(e.id).getMaxValue(r)}function au(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function Pg(r,e,i,n,a){if(!e[0]&&!e[1])return r;const u=Be.convert(e)._mult(a);i==="viewport"&&u._rotate(-n);const h=[];for(let f=0;f<r.length;f++)h.push(r[f].sub(u));return h}function Rg(r,e,i,n){const a=Be.convert(r)._mult(n);return e==="viewport"&&a._rotate(-i),a}let zg,Dg;function Lg(r,e,i){var n=2*Math.PI*6378137/256/Math.pow(2,i);return[r*n-2*Math.PI*6378137/2,e*n-2*Math.PI*6378137/2]}nt(rn,"CircleBucket",{omit:["layers"]});class Yl{constructor(e,i,n){this.z=e,this.x=i,this.y=n,this.key=lu(0,e,e,i,n)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}isChildOf(e){const i=this.z-e.z;return e.z===0||e.z<this.z&&e.x===this.x>>i&&e.y===this.y>>i}url(e,i){const n=(function(u,h,f){var _=Lg(256*u,256*(h=Math.pow(2,f)-h-1),f),g=Lg(256*(u+1),256*(h+1),f);return _[0]+","+_[1]+","+g[0]+","+g[1]})(this.x,this.y,this.z),a=(function(u,h,f){let _,g="";for(let v=u;v>0;v--)_=1<<v-1,g+=(h&_?1:0)+(f&_?2:0);return g})(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace("{prefix}",(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(i==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",a).replace("{bbox-epsg-3857}",n)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Fg{constructor(e,i){this.wrap=e,this.canonical=i,this.key=lu(e,i.z,i.z,i.x,i.y)}}class nn{constructor(e,i,n,a,u){this.overscaledZ=e,this.wrap=i,this.canonical=new Yl(n,+a,+u),this.key=i===0&&e===n?this.canonical.key:lu(i,e,n,a,u)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){const i=this.canonical.z-e;return e>this.canonical.z?new nn(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new nn(e,this.wrap,e,this.canonical.x>>i,this.canonical.y>>i)}calculateScaledKey(e,i=!0){if(this.overscaledZ===e&&i)return this.key;if(e>this.canonical.z)return lu(this.wrap*+i,e,this.canonical.z,this.canonical.x,this.canonical.y);{const n=this.canonical.z-e;return lu(this.wrap*+i,e,e,this.canonical.x>>n,this.canonical.y>>n)}}isChildOf(e){if(e.wrap!==this.wrap)return!1;const i=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.z<this.canonical.z&&e.canonical.x===this.canonical.x>>i&&e.canonical.y===this.canonical.y>>i}children(e){if(this.overscaledZ>=e)return[new nn(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const i=this.canonical.z+1,n=2*this.canonical.x,a=2*this.canonical.y;return[new nn(i,this.wrap,i,n,a),new nn(i,this.wrap,i,n+1,a),new nn(i,this.wrap,i,n,a+1),new nn(i,this.wrap,i,n+1,a+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 nn(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new nn(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 Fg(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function lu(r,e,i,n,a){const u=1<<Math.min(i,22);let h=u*(a%u)+n%u;return r&&i<22&&(h+=u*u*((r<0?-2*r-1:2*r)%(1<<2*(22-i)))),16*(32*h+i)+(e-i)}const r1=[r=>{let e=r.canonical.x-1,i=r.wrap;return e<0&&(e=(1<<r.canonical.z)-1,i--),new nn(r.overscaledZ,i,r.canonical.z,e,r.canonical.y)},r=>{let e=r.canonical.x+1,i=r.wrap;return e===1<<r.canonical.z&&(e=0,i++),new nn(r.overscaledZ,i,r.canonical.z,e,r.canonical.y)},r=>new nn(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,(r.canonical.y===0?1<<r.canonical.z:r.canonical.y)-1),r=>new nn(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,r.canonical.y===(1<<r.canonical.z)-1?0:r.canonical.y+1)];nt(Yl,"CanonicalTileID"),nt(nn,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});const n1=Nt([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:vp}=n1,o1=Nt([{name:"a_pos_3",components:3,type:"Int16"}]);var Og=Nt([{name:"a_pos",type:"Int16",components:2}]);function bp(r){return r*O/te}const s1=[new ei([G,G,G],[j,j,j]),new ei([G,G,G],[0,0,j]),new ei([0,G,G],[j,0,j]),new ei([G,0,G],[0,j,j]),new ei([0,0,G],[j,j,j])];function kg(r,e,i,n=!0){const a=ki([],r._camera.position,r.worldSize),u=[e,i,1,1];an(u,u,r.pixelMatrixInverse),ks(u,u,1/u[3]);const h=mi([],tr([],u,a)),f=r.globeMatrix,_=[f[12],f[13],f[14]],g=tr([],_,a),v=gn(g),b=mi([],g),w=r.worldSize/(2*Math.PI),E=Gi(b,h),I=Math.asin(w/v);if(I<Math.acos(E)){if(!n)return null;const re=[],se=[];ki(re,h,v/E),mi(se,tr(se,re,g)),mi(h,nr(h,g,ki(h,se,Math.tan(I)*v)))}const P=[];new pi(a,h).closestPointOnSphere(_,w,P);const D=mi([],zi(f,0)),R=mi([],zi(f,1)),F=mi([],zi(f,2)),B=Gi(D,P),V=Gi(R,P),$=Gi(F,P),H=he(Math.asin(-V/w));let J=he(Math.atan2(B,$));J=r.center.lng+(function(re,se){const Ee=(se-re+180)%360-180;return Ee<-180?Ee+360:Ee})(r.center.lng,J);const ee=de(J),K=Y(ve(H),0,1);return new Ke(ee,K)}class a1{constructor(e,i,n){this.a=tr([],e,n),this.b=tr([],i,n),this.center=n;const a=mi([],this.a),u=mi([],this.b);this.angle=Math.acos(Gi(a,u))}}function Jm(r,e){if(r.angle===0)return null;let i;return i=r.a[e]===0?1/r.angle*.5*Math.PI:1/r.angle*Math.atan(r.b[e]/r.a[e]/Math.sin(r.angle)-1/Math.tan(r.angle)),i<0||i>1?null:(function(n,a,u,h){const f=Math.sin(u);return n*(Math.sin((1-h)*u)/f)+a*(Math.sin(h*u)/f)})(r.a[e],r.b[e],r.angle,Y(i,0,1))+r.center[e]}function As(r){if(r.z<=1)return s1[r.z+2*r.y+r.x];const e=Qm(wp(r));return ei.fromPoints(e)}function ia(r,e,i){return ki(r,r,1-i),Mn(r,r,e,i)}function Bg(r,e,i){for(const n of r)Qi(n,n,e),ki(n,n,i)}function Ng(r,e,i,n){const a=e/r.worldSize,u=r.globeMatrix;if(i.z<=1){const K=As(i).getCorners();return Bg(K,u,a),ei.fromPoints(K)}const h=wp(i,n),f=Qm(h,O+bp(r._tileCoverLift));Bg(f,u,a);const _=Number.MAX_VALUE,g=[-_,-_,-_],v=[_,_,_];if(h.contains(r.center)){for(const se of f)fo(v,v,se),to(g,g,se);g[2]=0;const K=r.point,re=[K.x*a,K.y*a,0];return fo(v,v,re),to(g,g,re),new ei(v,g)}if(r._tileCoverLift>0){for(const K of f)fo(v,v,K),to(g,g,K);return new ei(v,g)}const b=[u[12]*a,u[13]*a,u[14]*a],w=h.getCenter(),E=Y(r.center.lat,-85.051129,oe),I=Y(w.lat,-85.051129,oe),P=de(r.center.lng),D=ve(E);let R=P-de(w.lng);const F=D-ve(I);R>.5?R-=1:R<-.5&&(R+=1);let B=0;Math.abs(R)>Math.abs(F)?B=R>=0?1:3:(B=F>=0?0:2,Mn(b,b,[u[4]*a,u[5]*a,u[6]*a],-Math.sin($t(F>=0?h.getSouth():h.getNorth()))*O));const V=f[B],$=f[(B+1)%4],H=new a1(V,$,b),J=[Jm(H,0)||V[0],Jm(H,1)||V[1],Jm(H,2)||V[2]],ee=Ha(r.zoom);if(ee>0){const K=(function({x:se,y:Ee,z:we},Se,Re,Ce,Pe){const ye=1/(1<<we);let De=se*ye,Ae=De+ye,Le=Ee*ye,ze=Le+ye,tt=0;const it=(De+Ae)/2-Ce;return it>.5?tt=-1:it<-.5&&(tt=1),De=((De+tt)*Se-(Ce*=Se))*Re+Ce,Ae=((Ae+tt)*Se-Ce)*Re+Ce,Le=(Le*Se-(Pe*=Se))*Re+Pe,ze=(ze*Se-Pe)*Re+Pe,[[De,ze,0],[Ae,ze,0],[Ae,Le,0],[De,Le,0]]})(i,e,r._pixelsPerMercatorPixel,P,D);for(let se=0;se<f.length;se++)ia(f[se],K[se],ee);const re=nr([],K[B],K[(B+1)%4]);ki(re,re,.5),ia(J,re,ee)}for(const K of f)fo(v,v,K),to(g,g,K);return v[2]=Math.min(V[2],$[2]),fo(v,v,J),to(g,g,J),new ei(v,g)}function wp({x:r,y:e,z:i},n=!1){const a=1/(1<<i),u=new Z(Me(r*a),e===(1<<i)-1&&n?-90:Fe((e+1)*a)),h=new Z(Me((r+1)*a),e===0&&n?90:Fe(e*a));return new ne(u,h)}function Qm(r,e=O){const i=$t(r.getNorth()),n=$t(r.getSouth()),a=Math.cos(i),u=Math.cos(n),h=Math.sin(i),f=Math.sin(n),_=r.getWest(),g=r.getEast();return[ie(u,f,_,e),ie(u,f,g,e),ie(a,h,g,e),ie(a,h,_,e)]}function nd(r,e,i,n){const a=1<<i.z,u=(r/We+i.x)/a;return Q(Fe((e/We+i.y)/a),Me(u),n)}function Tp({min:r,max:e}){return 16383/Math.max(e[0]-r[0],e[1]-r[1],e[2]-r[2])}const Vg=new Float64Array(16);function Sp(r){const e=Tp(r),i=uo(Vg,[e,e,e]);return _r(i,i,Qo([],r.min))}function e_(r){const e=(function(n,a){return n[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=a[0],n[13]=a[1],n[14]=a[2],n[15]=1,n})(Vg,r.min),i=1/Tp(r);return Ji(e,e,[i,i,i])}function t_(r){const e=We/(2*Math.PI);return r/(2*Math.PI)/e}function Ug(r,e){return We/(512*Math.pow(2,r))*Tp(As(e))}function jg(r,e,i,n,a){const u=t_(i),h=[r,e,-i/(2*Math.PI)],f=Ei(new Float64Array(16));return _r(f,f,h),Ji(f,f,[u,u,u]),Lr(f,f,$t(-a)),Jn(f,f,$t(-n)),f}function Ha(r){return le(5,6,r)}function Gg(r,e){const i=Q(e.lat,e.lng),n=(function(I){const P=Q(I._center.lat,I._center.lng);let D=Fr([],xi(0,1,0),P);const R=Ls([],-I.angle,P);D=Qi(D,D,R),Ls(R,-I._pitch,D);const F=mi([],P);return ki(F,F,bp(I.cameraToCenterDistance/I.pixelsPerMeter)),Qi(F,F,R),nr([],P,F)})(r);return h=(a=ho([],n,i))[0],f=a[1],_=a[2],g=(u=i)[0],v=u[1],b=u[2],E=(w=Math.sqrt((h*h+f*f+_*_)*(g*g+v*v+b*b)))&&Gi(a,u)/w,Math.acos(Math.min(Math.max(E,-1),1));var a,u,h,f,_,g,v,b,w,E}function i_(r,e){return Gg(r,e)>Math.PI/2*1.01}const qg=$t(85),l1=Math.cos(qg),c1=Math.sin(qg),u1=Hn(),Hg=r=>{const e=[];return r.paint.get("circle-pitch-alignment")==="map"&&e.push("PITCH_WITH_MAP"),r.paint.get("circle-pitch-scale")==="map"&&e.push("SCALE_WITH_MAP"),e};function $g(r,e,i,n,a,u,h,f,_){if(u&&r.queryGeometry.isAboveHorizon)return!1;u&&(_*=r.pixelToTileUnitsFactor);const g=r.tileID.canonical,v=i.projection.upVectorScale(g,i.center.lat,i.worldSize).metersToTile;for(const b of e)for(const w of b){const E=w.add(f),I=a&&i.elevation?i.elevation.exaggeration()*a.getElevationAt(E.x,E.y,!0):0,P=i.projection.projectTilePoint(E.x,E.y,g);if(I>0){const B=i.projection.upVector(g,E.x,E.y);P.x+=B[0]*v*I,P.y+=B[1]*v*I,P.z+=B[2]*v*I}const D=u?E:h1(P.x,P.y,P.z,n),R=u?r.tilespaceRays.map(B=>f1(B,I)):r.queryGeometry.screenGeometry,F=an([],[P.x,P.y,P.z,1],n);if(!h&&u?_*=F[3]/i.cameraToCenterDistance:h&&!u&&(_*=i.cameraToCenterDistance/F[3]),u){const B=Fe((w.y/We+g.y)/(1<<g.z));_/=i.projection.pixelsPerMeter(B,1)/ge(1,B)}if(Ki(R,D,_))return!0}return!1}function h1(r,e,i,n){const a=an([],[r,e,i,1],n);return new Be(a[0]/a[3],a[1]/a[3])}const Zg=xi(0,0,0),d1=xi(0,0,1);function f1(r,e){const i=li();return Zg[2]=e,r.intersectsPlane(Zg,d1,i),new Be(i[0],i[1])}class Wg extends rn{}let Xg,Yg,Kg,Jg;function Qg(r,{width:e,height:i},n,a){if(a){if(a instanceof Uint8ClampedArray)a=new Uint8Array(a.buffer);else if(a.length!==e*i*n)throw new RangeError("mismatched image size")}else a=new Uint8Array(e*i*n);return r.width=e,r.height=i,r.data=a,r}function ey(r,e,i){const{width:n,height:a}=e;n===r.width&&a===r.height||(r_(r,e,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,n),height:Math.min(r.height,a)},i,null),r.width=n,r.height=a,r.data=e.data)}function r_(r,e,i,n,a,u,h,f){if(a.width===0||a.height===0)return e;if(a.width>r.width||a.height>r.height||i.x>r.width-a.width||i.y>r.height-a.height)throw new RangeError("out of range source coordinates for image copy");if(a.width>e.width||a.height>e.height||n.x>e.width-a.width||n.y>e.height-a.height)throw new RangeError("out of range destination coordinates for image copy");const _=r.data,g=e.data,v=u===4&&f;for(let b=0;b<a.height;b++){const w=((i.y+b)*r.width+i.x)*u,E=((n.y+b)*e.width+n.x)*u;if(v)for(let I=0;I<a.width;I++){const P=w+I*u+3,D=E+I*u;g[D+0]=255,g[D+1]=255,g[D+2]=255,g[D+3]=_[P]}else if(h)for(let I=0;I<a.width;I++){const P=w+I*u,D=E+I*u,R=new ii(_[P+0]/255,_[P+1]/255,_[P+2]/255,_[P+3]).toNonPremultipliedRenderColor(h).toArray();g[D+0]=R[0],g[D+1]=R[1],g[D+2]=R[2],g[D+3]=R[3]}else for(let I=0;I<a.width*u;I++)g[E+I]=_[w+I]}return e}nt(Wg,"HeatmapBucket",{omit:["layers"]});class $a{constructor(e,i){Qg(this,e,1,i)}resize(e){ey(this,new $a(e),1)}clone(){return new $a({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,n,a,u){r_(e,i,n,a,u,1,null)}}class Br{constructor(e,i){Qg(this,e,4,i)}resize(e){ey(this,new Br(e),4)}replace(e,i){i?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new Br({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,n,a,u,h,f){r_(e,i,n,a,u,4,h,f)}}class ty{constructor(e,i){this.width=e.width,this.height=e.height,this.data=i instanceof Uint8Array?new Float32Array(i.buffer):i}}function od(r){const e={},i=r.resolution||256,n=r.clips?r.clips.length:1,a=r.image||new Br({width:i,height:n}),u=(h,f,_)=>{e[r.evaluationKey]=_;const g=r.expression.evaluate(e),v=g?g.toNonPremultipliedRenderColor(null):null;v&&(a.data[h+f+0]=Math.floor(255*v.r),a.data[h+f+1]=Math.floor(255*v.g),a.data[h+f+2]=Math.floor(255*v.b),a.data[h+f+3]=Math.floor(255*v.a))};if(r.clips)for(let h=0,f=0;h<n;++h,f+=4*i)for(let _=0,g=0;_<i;_++,g+=4){const v=_/(i-1),{start:b,end:w}=r.clips[h];u(f,g,b*(1-v)+w*v)}else for(let h=0,f=0;h<i;h++,f+=4)u(0,f,h/(i-1));return a}nt($a,"AlphaImage"),nt(Br,"RGBAImage");const p1=Nt([{name:"a_pos",components:2,type:"Int16"}],4),m1=Nt([{name:"a_road_z_offset",components:1,type:"Float32"}],4),_1=Nt([{name:"a_pos",components:2,type:"Int16"},{name:"a_height",components:1,type:"Float32"}],4),g1=Nt([{name:"a_pos_normal_3",components:3,type:"Int16"}],4);function cu(r,e,i=2){const n=e&&e.length,a=n?e[0]*i:r.length;let u=iy(r,0,a,i,!0);const h=[];if(!u||u.next===u.prev)return h;let f,_,g;if(n&&(u=(function(v,b,w,E){const I=[];for(let P=0,D=b.length;P<D;P++){const R=iy(v,b[P]*E,P<D-1?b[P+1]*E:v.length,E,!1);R===R.next&&(R.steiner=!0),I.push(E1(R))}I.sort(w1);for(let P=0;P<I.length;P++)w=T1(I[P],w);return w})(r,e,u,i)),r.length>80*i){f=r[0],_=r[1];let v=f,b=_;for(let w=i;w<a;w+=i){const E=r[w],I=r[w+1];E<f&&(f=E),I<_&&(_=I),E>v&&(v=E),I>b&&(b=I)}g=Math.max(v-f,b-_),g=g!==0?32767/g:0}return sd(u,h,i,f,_,g,0),h}function iy(r,e,i,n,a){let u;if(a===(function(h,f,_,g){let v=0;for(let b=f,w=_-g;b<_;b+=g)v+=(h[w]-h[b])*(h[b+1]+h[w+1]),w=b;return v})(r,e,i,n)>0)for(let h=e;h<i;h+=n)u=sy(h/n|0,r[h],r[h+1],u);else for(let h=i-n;h>=e;h-=n)u=sy(h/n|0,r[h],r[h+1],u);return u&&uu(u,u.next)&&(cd(u),u=u.next),u}function Kl(r,e){if(!r)return r;e||(e=r);let i,n=r;do if(i=!1,n.steiner||!uu(n,n.next)&&vr(n.prev,n,n.next)!==0)n=n.next;else{if(cd(n),n=e=n.prev,n===n.next)break;
vendor: 2,272 bytes, line 8
8i=!0}while(i||n!==e);return e}function sd(r,e,i,n,a,u,h){if(!r)return;!h&&u&&(function(_,g,v,b){let w=_;do w.z===0&&(w.z=n_(w.x,w.y,g,v,b)),w.prevZ=w.prev,w.nextZ=w.next,w=w.next;while(w!==_);w.prevZ.nextZ=null,w.prevZ=null,(function(E){let I,P=1;do{let D,R=E;E=null;let F=null;for(I=0;R;){I++;let B=R,V=0;for(let H=0;H<P&&(V++,B=B.nextZ,B);H++);let $=P;for(;V>0||$>0&&B;)V!==0&&($===0||!B||R.z<=B.z)?(D=R,R=R.nextZ,V--):(D=B,B=B.nextZ,$--),F?F.nextZ=D:E=D,D.prevZ=F,F=D;R=B}F.nextZ=null,P*=2}while(I>1)})(w)})(r,n,a,u);let f=r;for(;r.prev!==r.next;){const _=r.prev,g=r.next;if(u?x1(r,n,a,u):y1(r))e.push(_.i,r.i,g.i),cd(r),r=g.next,f=g.next;else if((r=g)===f){h?h===1?sd(r=v1(Kl(r),e),e,i,n,a,u,2):h===2&&b1(r,e,i,n,a,u):sd(Kl(r),e,i,n,a,u,1);break}}}function y1(r){const e=r.prev,i=r,n=r.next;if(vr(e,i,n)>=0)return!1;const a=e.x,u=i.x,h=n.x,f=e.y,_=i.y,g=n.y,v=Math.min(a,u,h),b=Math.min(f,_,g),w=Math.max(a,u,h),E=Math.max(f,_,g);let I=n.next;for(;I!==e;){if(I.x>=v&&I.x<=w&&I.y>=b&&I.y<=E&&ad(a,f,u,_,h,g,I.x,I.y)&&vr(I.prev,I,I.next)>=0)return!1;I=I.next}return!0}function x1(r,e,i,n){const a=r.prev,u=r,h=r.next;if(vr(a,u,h)>=0)return!1;const f=a.x,_=u.x,g=h.x,v=a.y,b=u.y,w=h.y,E=Math.min(f,_,g),I=Math.min(v,b,w),P=Math.max(f,_,g),D=Math.max(v,b,w),R=n_(E,I,e,i,n),F=n_(P,D,e,i,n);let B=r.prevZ,V=r.nextZ;for(;B&&B.z>=R&&V&&V.z<=F;){if(B.x>=E&&B.x<=P&&B.y>=I&&B.y<=D&&B!==a&&B!==h&&ad(f,v,_,b,g,w,B.x,B.y)&&vr(B.prev,B,B.next)>=0||(B=B.prevZ,V.x>=E&&V.x<=P&&V.y>=I&&V.y<=D&&V!==a&&V!==h&&ad(f,v,_,b,g,w,V.x,V.y)&&vr(V.prev,V,V.next)>=0))return!1;V=V.nextZ}for(;B&&B.z>=R;){if(B.x>=E&&B.x<=P&&B.y>=I&&B.y<=D&&B!==a&&B!==h&&ad(f,v,_,b,g,w,B.x,B.y)&&vr(B.prev,B,B.next)>=0)return!1;B=B.prevZ}for(;V&&V.z<=F;){if(V.x>=E&&V.x<=P&&V.y>=I&&V.y<=D&&V!==a&&V!==h&&ad(f,v,_,b,g,w,V.x,V.y)&&vr(V.prev,V,V.next)>=0)return!1;V=V.nextZ}return!0}function v1(r,e){let i=r;do{const n=i.prev,a=i.next.next;!uu(n,a)&&ny(n,i,i.next,a)&&ld(n,a)&&ld(a,n)&&(e.push(n.i,i.i,a.i),cd(i),cd(i.next),i=r=a),i=i.next}while(i!==r);return Kl(i)}function b1(r,e,i,n,a,u){let h=r;do{let f=h.next.next;for(;f!==h.prev;){if(h.i!==f.i&&I1(h,f)){let _=oy(h,f);return h=Kl(h,h.next),_=Kl(_,_.next),sd(h,e,i,n,a,u,0),void sd(_,e,i,n,a,u,0)}f=f.next}h=h.next}while(h!==r)}function w1(r,e){let i=r.x-e.x;
vendor: 26,760 bytes, line 8
8return i===0&&(i=r.y-e.y,i===0)&&(i=(r.next.y-r.y)/(r.next.x-r.x)-(e.next.y-e.y)/(e.next.x-e.x)),i}function T1(r,e){const i=(function(a,u){let h=u;const f=a.x,_=a.y;let g,v=-1/0;if(uu(a,h))return h;do{if(uu(a,h.next))return h.next;if(_<=h.y&&_>=h.next.y&&h.next.y!==h.y){const P=h.x+(_-h.y)*(h.next.x-h.x)/(h.next.y-h.y);if(P<=f&&P>v&&(v=P,g=h.x<h.next.x?h:h.next,P===f))return g}h=h.next}while(h!==u);if(!g)return null;const b=g,w=g.x,E=g.y;let I=1/0;h=g;do{if(f>=h.x&&h.x>=w&&f!==h.x&&ry(_<E?f:v,_,w,E,_<E?v:f,_,h.x,h.y)){const P=Math.abs(_-h.y)/(f-h.x);ld(h,a)&&(P<I||P===I&&(h.x>g.x||h.x===g.x&&S1(g,h)))&&(g=h,I=P)}h=h.next}while(h!==b);return g})(r,e);if(!i)return e;const n=oy(i,r);return Kl(n,n.next),Kl(i,i.next)}function S1(r,e){return vr(r.prev,r,e.prev)<0&&vr(e.next,r,r.next)<0}function n_(r,e,i,n,a){return(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-i)*a|0)|r<<8))|r<<4))|r<<2))|r<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*a|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function E1(r){let e=r,i=r;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==r);return i}function ry(r,e,i,n,a,u,h,f){return(a-h)*(e-f)>=(r-h)*(u-f)&&(r-h)*(n-f)>=(i-h)*(e-f)&&(i-h)*(u-f)>=(a-h)*(n-f)}function ad(r,e,i,n,a,u,h,f){return!(r===h&&e===f)&&ry(r,e,i,n,a,u,h,f)}function I1(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!(function(i,n){let a=i;do{if(a.i!==i.i&&a.next.i!==i.i&&a.i!==n.i&&a.next.i!==n.i&&ny(a,a.next,i,n))return!0;a=a.next}while(a!==i);return!1})(r,e)&&(ld(r,e)&&ld(e,r)&&(function(i,n){let a=i,u=!1;const h=(i.x+n.x)/2,f=(i.y+n.y)/2;do a.y>f!=a.next.y>f&&a.next.y!==a.y&&h<(a.next.x-a.x)*(f-a.y)/(a.next.y-a.y)+a.x&&(u=!u),a=a.next;while(a!==i);return u})(r,e)&&(vr(r.prev,r,e.prev)||vr(r,e.prev,e))||uu(r,e)&&vr(r.prev,r,r.next)>0&&vr(e.prev,e,e.next)>0)}function vr(r,e,i){return(e.y-r.y)*(i.x-e.x)-(e.x-r.x)*(i.y-e.y)}function uu(r,e){return r.x===e.x&&r.y===e.y}function ny(r,e,i,n){const a=Ip(vr(r,e,i)),u=Ip(vr(r,e,n)),h=Ip(vr(i,n,r)),f=Ip(vr(i,n,e));return a!==u&&h!==f||!(a!==0||!Ep(r,i,e))||!(u!==0||!Ep(r,n,e))||!(h!==0||!Ep(i,r,n))||!(f!==0||!Ep(i,e,n))}function Ep(r,e,i){return e.x<=Math.max(r.x,i.x)&&e.x>=Math.min(r.x,i.x)&&e.y<=Math.max(r.y,i.y)&&e.y>=Math.min(r.y,i.y)}function Ip(r){return r>0?1:r<0?-1:0}function ld(r,e){return vr(r.prev,r,r.next)<0?vr(r,e,r.next)>=0&&vr(r,r.prev,e)>=0:vr(r,e,r.prev)<0||vr(r,r.next,e)<0}function oy(r,e){const i=o_(r.i,r.x,r.y),n=o_(e.i,e.x,e.y),a=r.next,u=e.prev;return r.next=e,e.prev=r,i.next=a,a.prev=i,n.next=i,i.prev=n,u.next=n,n.prev=u,n}function sy(r,e,i,n){const a=o_(r,e,i);return n?(a.next=n.next,a.prev=n,n.next.prev=a,n.next=a):(a.prev=a,a.next=a),a}function cd(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function o_(r,e,i){return{i:r,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function ud(r,e){const i=r.length;if(i<=1)return[r];const n=[];let a,u;for(let h=0;h<i;h++){const f=or(r[h]);f!==0&&(r[h].area=Math.abs(f),u===void 0&&(u=f<0),u===f<0?(a&&n.push(a),a=[r[h]]):a.push(r[h]))}if(a&&n.push(a),e>1)for(let h=0;h<n.length;h++)n[h].length<=e||(bc(n[h],e,1,n[h].length-1,A1),n[h]=n[h].slice(0,e));return n}function A1(r,e){return e.area-r.area}function ay(r,e,i=1){if(!r)return null;const n=typeof r=="string"?dn.from(r).getPrimary():r.getPrimary(),a=typeof r=="string"?null:r.getSecondary();for(const u of[n,a]){if(!u)continue;const h=u.id.toString();e.has(h)||e.set(h,[]),u.scaleSelf(i),e.get(h).push(u)}return{primary:n.toString(),secondary:a?a.toString():null}}function s_(r,e,i,n){const a=n.patternDependencies;let u=!1;for(const h of e){const f=h.paint.get(`${r}-pattern`);f.isConstant()||(u=!0),ay(f.constantOr(null),a,i)&&(u=!0)}return u}function a_(r,e,i,n,a,u){const h=u.patternDependencies;for(const f of e){const _=f.paint.get(`${r}-pattern`).value;if(_.kind!=="constant"){let g=_.evaluate({zoom:n},i,{},u.availableImages);g=g&&g.name?g.name:g;const v=ay(g,h,a);if(!v)continue;const{primary:b,secondary:w}=v;b&&(i.patterns[f.id]=[b,w].filter(Boolean))}}return i}class ra{constructor(){this.portals=[]}static isOnBorder(e,i){return e<=0&&i<=0||e>=We&&i>=We}static evaluate(e){if(e.length===0)return new ra;let i=[];for(const _ of e)i.push(..._.portals);if(i.length===0)return new ra;for(const _ of i){const g=_.va,v=_.vb;(ra.isOnBorder(g.x,v.x)||ra.isOnBorder(g.y,v.y))&&(_.type="border")}const n=i.filter(_=>_.type!=="unevaluated"),a=i.filter(_=>_.type==="unevaluated");if(a.length===0)return new ra;a.sort((_,g)=>_.hash===g.hash?_.isTunnel===g.isTunnel?0:_.isTunnel?-1:1:_.hash<g.hash?1:-1),i=n.concat(a);let u=n.length,h=u,f=u;do if(h++,h===i.length||i[u].hash!==i[h].hash){if(h-u===2){f<u&&(i[f]=i[u],i[u]=null);const _=i[f],g=i[h-1];_.type=_.isTunnel!==g.isTunnel?"tunnel":"polygon",_.connection={a:_.connection.a,b:g.connection.a},f++}u=h}while(u!==i.length);return i.splice(f),i.sort((_,g)=>_.hash<g.hash?1:-1),{portals:i}}}nt(ra,"ElevationPortalGraph");class M1{constructor(e,i,n){this.outPositions=e,this.outNormals=i,this.outIndices=n,this.vertexLookup=new Map}addVertex(e,i,n){let a=e[2];n!=null&&(a*=n);const u=`${e[0]},${e[1]},${e[2]},${i[0]},${i[1]},${i[2]}`,h=this.vertexLookup.get(u);if(h!=null)return h;const f=this.outPositions.length;this.vertexLookup.set(u,f);const _=Math.trunc(16384*i[0]),g=Math.trunc(16384*i[1]),v=Math.trunc(16384*i[2]);return this.outPositions.emplaceBack(e[0],e[1],a),this.outNormals.emplaceBack(_,g,v),f}addTriangle(e,i,n){this.outIndices.emplaceBack(e,i,n)}addTriangles(e,i,n){if(e.length===0)return;const a=n.length===1,u=li(),h=li();for(let f=0;f<e.length;f+=3){const _=i[e[f+0]],g=i[e[f+1]],v=i[e[f+2]],b=a?n[0]:n[e[f+1]],w=a?n[0]:n[e[f+2]];wi(u,_.x,_.y,a?n[0]:n[e[f+0]]);const E=this.addVertex(u,h);wi(u,g.x,g.y,b);const I=this.addVertex(u,h);wi(u,v.x,v.y,w);const P=this.addVertex(u,h);this.outIndices.emplaceBack(E,I,P)}}addQuad(e,i,n,a,u,h){const f=this.addVertex(e,u,h),_=this.addVertex(i,u,h),g=this.addVertex(n,u,h),v=this.addVertex(a,u,h);this.addTriangle(f,_,g),this.addTriangle(g,v,f)}getVertexCount(){return this.outPositions.length}clearVertexLookup(){this.vertexLookup.clear()}}class Vn{constructor(e,i,n,a){this.unevaluatedPortals=new ra,this.bridgeFeatureSections=[],this.tunnelFeatureSections=[],this.vertexHashLookup=new Map,this.unevalVertices=[],this.unevalHeights=[],this.unevalTriangles=[],this.unevalTunnelTriangles=[],this.unevalEdges=[],this.vertexPositions=new Ba,this.vertexNormals=new $h,this.indexArray=new hr,this.tileToMeters=Ue(e),this.bridgeProgramConfigurations=new S(i,{zoom:n,lut:a},u=>u!=="fill-tunnel-structure-color"),this.tunnelProgramConfigurations=new S(i,{zoom:n,lut:a},u=>u!=="fill-bridge-guard-rail-color")}addVertices(e,i){const n=this.unevalVertices.length;for(let a=0;a<e.length;a++)this.unevalVertices.push(e[a]),this.unevalHeights.push(i[a]);return n}addTriangles(e,i,n){const a=n?this.unevalTunnelTriangles:this.unevalTriangles;for(const u of e)a.push(u+i)}addRenderableRing(e,i,n,a,u,h){const f=[new Be(u.min.x,u.min.y),new Be(u.max.x,u.min.y),new Be(u.max.x,u.max.y),new Be(u.min.x,u.max.y)];for(let _=0;_<n-1;_++){const g=i+_,v=g+1,b=this.unevalVertices[g],w=this.unevalVertices[v];if(!(b.x>=u.min.x&&b.x<=u.max.x&&b.y>=u.min.y&&b.y<=u.max.y||w.x>=u.min.x&&w.x<=u.max.x&&w.y>=u.min.y&&w.y<=u.max.y||Eo(b,w,f))||this.isOnBorder(b.x,w.x)||this.isOnBorder(b.y,w.y))continue;const E=Vn.computeEdgeHash(this.unevalVertices[g],this.unevalVertices[v]);let I,P=this.vertexHashLookup.get(Vn.computePosHash(b));P!=null?I=P.next:(P=this.vertexHashLookup.get(Vn.computePosHash(w)),I=P!=null?P.prev:E),this.unevalEdges.push({polygonIdx:e,a:g,b:v,hash:E,portalHash:I,isTunnel:a,type:"unevaluated",featureInfo:h})}}addPortalCandidates(e,i,n,a,u){if(i.length!==0){this.vertexHashLookup.clear();for(const h of i){if(h.length===0)continue;const f=h[0];let _=Vn.computeEdgeHash(f[f.length-2],f[f.length-1]);for(let g=0;g<f.length-1;g++){const v=f[g+0],b=f[g+1],w=Do(b.x-v.x,b.y-v.y),E=ss(w);if(E===0)continue;let I="unevaluated";const P=a.pointElevation(v),D=a.pointElevation(b);Math.abs(P)<.01&&Math.abs(D)<.01?I="entrance":(this.isOnBorder(v.x,b.x)||this.isOnBorder(v.y,b.y))&&(I="border");const R=Vn.computeEdgeHash(v,b);this.unevaluatedPortals.portals.push({connection:{a:e,b:void 0},va:v,vb:b,vab:w,length:E,hash:R,isTunnel:n,type:I});const F=Vn.computePosHash(v);this.vertexHashLookup.set(F,{prev:_,next:R}),_=R}}}}construct(e){if(this.unevalVertices.length===0)return;const i=()=>({vertexOffset:0,primitiveOffset:this.indexArray.length}),n=w=>{w.primitiveLength=this.indexArray.length-w.primitiveOffset},a=new M1(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(e.portals,this.unevalEdges);const u=i(),h=i(),f=i(),_=(w,E)=>{w.sort((P,D)=>P.type===E&&D.type!==E?-1:P.type!==E&&D.type===E?1:0);const I=w.findIndex(P=>P.type!==E);return I>=0?I:w.length};let g=0;this.unevalEdges.length>0&&(g=_(this.unevalEdges,"none"),this.constructBridgeStructures(a,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:g},this.tileToMeters)),n(f);const v=i(),b=i();if(this.unevalEdges.length>0){const w=this.unevalEdges.splice(g),E=_(w,"tunnel")+g;this.unevalEdges.push(...w),this.constructTunnelStructures(a,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:g},{min:g,max:E})}n(v),a.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),n(b),a.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),n(h),a.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),n(u),this.maskSegments=Ci.simpleSegment(0,b.primitiveOffset,0,b.primitiveLength),this.depthSegments=Ci.simpleSegment(0,h.primitiveOffset,0,h.primitiveLength),this.renderableBridgeSegments=Ci.simpleSegment(0,f.primitiveOffset,0,f.primitiveLength),this.renderableTunnelSegments=Ci.simpleSegment(0,v.primitiveOffset,0,v.primitiveLength),this.shadowCasterSegments=Ci.simpleSegment(0,u.primitiveOffset,0,u.primitiveLength)}update(e,i,n,a,u,h,f,_){this.bridgeProgramConfigurations.updatePaintArrays(e,i,u,n,a,h,f,_),this.tunnelProgramConfigurations.updatePaintArrays(e,i,u,n,a,h,f,_)}upload(e){this.vertexBuffer||this.vertexPositions.length===0||this.vertexNormals.length===0||this.indexArray.length===0||(this.vertexBuffer=e.createVertexBuffer(this.vertexPositions,_1.members),this.vertexBufferNormal=e.createVertexBuffer(this.vertexNormals,g1.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.bridgeProgramConfigurations.upload(e),this.tunnelProgramConfigurations.upload(e))}destroy(){this.vertexBuffer&&(this.vertexBuffer.destroy(),this.vertexBufferNormal.destroy(),this.indexBuffer.destroy()),this.maskSegments&&(this.maskSegments.destroy(),this.depthSegments.destroy(),this.renderableBridgeSegments.destroy(),this.renderableTunnelSegments.destroy(),this.shadowCasterSegments.destroy()),this.bridgeProgramConfigurations.destroy(),this.tunnelProgramConfigurations.destroy()}populatePaintArrays(e,i,n,a,u){const h=(f,_)=>{for(let g=0;g<_.length-1;g++){const v=_[g].featureIndex,b=_[g+1].vertexStart,w=e.feature(v);f.populatePaintArrays(b,w,v,{},n,i,a,void 0,u)}};h(this.bridgeProgramConfigurations,this.bridgeFeatureSections),h(this.tunnelProgramConfigurations,this.tunnelFeatureSections)}computeVertexConnections(e,i,n,a,u){const h=new Map;for(let f=a;f<u;f++){const _=n[f],g=_.a,v=_.b,b=Vn.computePosHash(e[g]),w=Vn.computePosHash(e[v]);let E=h.get(b);E||(E={},h.set(b,E));let I=h.get(w);I||(I={},h.set(w,I)),i[g]<=0&&i[v]<=0||(E.to=v,I.from=g)}return h}isTerminalVertex(e,i){const n=Vn.computePosHash(this.unevalVertices[e]),a=i.get(n);return!a||!a.from||!a.to}constructBridgeStructures(e,i,n,a,u,h){e.clearVertexLookup();const f=this.computeVertexConnections(i,n,a,u.min,u.max),_=1/h,g=.5*_,v=(Re,Ce)=>wi(Re,i[Ce].x,i[Ce].y,n[Ce]*_),b=li(),w=li(),E=li(),I=li(),P=li(),D=(Re,Ce)=>{const Pe=f.get(Vn.computePosHash(i[Ce])),ye=Pe.from,De=Pe.to;if(!ye||!De)return;v(b,ye),v(w,Ce),v(E,De),Os(I),io(b,w)||(tr(P,w,b),mi(I,P)),io(E,w)||(tr(P,E,w),nr(I,I,mi(P,P)));const Ae=is(I);return Ae>0?ki(Re,I,1/Ae):void 0};let R=Number.POSITIVE_INFINITY;this.sortSubarray(a,u.min,u.max,(Re,Ce)=>Re.featureInfo.featureIndex-Ce.featureInfo.featureIndex);const F=li(),B=li(),V=li(),$=li(),H=li(),J=li(),ee=li(),K=li(),re=li(),se=[li(),li(),li(),li()],Ee=[li(),li(),li(),li()],we=[{coord:new Be(0,0),height:0},{coord:new Be(0,0),height:0}],Se=(Re,Ce)=>Re>Ce;for(let Re=u.min;Re<u.max;Re++){const Ce=a[Re];if(!Ce.featureInfo.guardRailEnabled||!this.prepareEdgePoints(we,i,n,Ce,Se))continue;const[Pe,ye]=we;if(wi(F,Pe.coord.x,Pe.coord.y,_*Pe.height),wi(B,ye.coord.x,ye.coord.y,_*ye.height),io(F,B))continue;tr(V,B,F),mi(V,V);const De=D(K,Ce.a)||V,Ae=D(re,Ce.b)||V;wi($,De[1],-De[0],0),mi($,$),wi(H,Ae[1],-Ae[0],0),mi(H,H),Fr(K,$,De),mi(J,K),Fr(K,H,Ae),mi(ee,K),nr(se[0],F,ki(K,tr(K,$,J),g)),nr(se[1],F,ki(K,nr(K,$,J),g)),nr(se[2],F,ki(K,J,g)),se[3]=F,nr(Ee[0],B,ki(K,tr(K,H,ee),g)),nr(Ee[1],B,ki(K,nr(K,H,ee),g)),nr(Ee[2],B,ki(K,ee,g)),Ee[3]=B,R=this.addFeatureSection(Ce.featureInfo.featureIndex,R,this.bridgeFeatureSections,e);const Le=e.addVertex(se[0],$,h),ze=e.addVertex(se[1],$,h),tt=e.addVertex(Ee[0],H,h),it=e.addVertex(Ee[1],H,h);e.addTriangle(Le,ze,tt),e.addTriangle(ze,it,tt);const Ze=e.addVertex(se[1],J,h),Xe=e.addVertex(se[2],J,h),pt=e.addVertex(Ee[1],ee,h),ct=e.addVertex(Ee[2],ee,h);e.addTriangle(Ze,Xe,pt),e.addTriangle(Xe,ct,pt),Qo($,$),Qo(H,H);const Qe=e.addVertex(se[2],$,h),bt=e.addVertex(se[3],$,h),Ot=e.addVertex(Ee[2],H,h),Kt=e.addVertex(Ee[3],H,h);e.addTriangle(Qe,bt,Ot),e.addTriangle(bt,Kt,Ot);const Lt=this.isTerminalVertex(Ce.a,f),hi=this.isTerminalVertex(Ce.b,f);Pe.height<.01&&Lt&&e.addQuad(se[3],se[2],se[1],se[0],Qo(De,De),h),ye.height<.01&&hi&&e.addQuad(Ee[0],Ee[1],Ee[2],Ee[3],Ae,h)}this.bridgeFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:e.getVertexCount()})}constructTunnelStructures(e,i,n,a,u,h){e.clearVertexLookup();let f=Number.POSITIVE_INFINITY;const _=(R,F)=>R.featureInfo.featureIndex-F.featureInfo.featureIndex;this.sortSubarray(a,u.min,u.max,_),this.sortSubarray(a,h.min,h.max,_);const g=R=>mi(R,R),v=[{coord:new Be(0,0),height:0},{coord:new Be(0,0),height:0}],b=(R,F)=>R<F,w=li(),E=li(),I=li(),P=li(),D=li();for(let R=u.min;R<u.max;R++){if(!this.prepareEdgePoints(v,i,n,a[R],b))continue;const[F,B]=v,V=g(wi(D,-(B.coord.y-F.coord.y),B.coord.x-F.coord.x,0));f=this.addFeatureSection(a[R].featureInfo.featureIndex,f,this.tunnelFeatureSections,e),e.addQuad(wi(w,F.coord.x,F.coord.y,F.height),wi(E,B.coord.x,B.coord.y,B.height),wi(I,B.coord.x,B.coord.y,a[R].isTunnel?-.1:0),wi(P,F.coord.x,F.coord.y,a[R].isTunnel?-.1:0),V)}for(let R=h.min;R<h.max;R++){const F=a[R];F.isTunnel&&([F.a,F.b]=[F.b,F.a]);const B=i[F.a],V=i[F.b],$=g(wi(D,-(V.y-B.y),V.x-B.x,0));f=this.addFeatureSection(F.featureInfo.featureIndex,f,this.tunnelFeatureSections,e),e.addQuad(wi(w,V.x,V.y,0),wi(E,B.x,B.y,0),wi(I,B.x,B.y,n[F.a]+4),wi(P,V.x,V.y,n[F.b]+4),$),e.addQuad(wi(w,B.x,B.y,0),wi(E,V.x,V.y,0),wi(I,V.x,V.y,n[F.b]+4),wi(P,B.x,B.y,n[F.a]+4),$)}this.tunnelFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:e.getVertexCount()})}setElevatedPoint(e,i,n,a){e.coord.x=i,e.coord.y=n,e.height=a}prepareEdgePoints(e,i,n,a,u){let h=i[a.a].x,f=i[a.a].y,_=i[a.b].x,g=i[a.b].y,v=n[a.a],b=n[a.b];const w=u(v,0),E=u(b,0);if(w&&E)return this.setElevatedPoint(e[0],h,f,v),this.setElevatedPoint(e[1],_,g,b),!0;if(!w&&!E)return!1;if(w){if(!E){const I=b/(b-v);_=_t(_,h,I),g=_t(g,f,I),b=_t(b,v,I)}}else{const I=v/(v-b);h=_t(h,_,I),f=_t(f,g,I),v=_t(v,b,I)}return this.setElevatedPoint(e[0],h,f,v),this.setElevatedPoint(e[1],_,g,b),!0}prepareEdges(e,i){if(i.length===0)return;i.sort((f,_)=>f.hash===_.hash?_.polygonIdx-f.polygonIdx:_.hash>f.hash?1:-1);let n=0,a=0,u=0,h=i[n].polygonIdx;do a++,(a===i.length||i[n].hash!==i[a].hash)&&((a-n===1||i[a-1].polygonIdx!==h)&&(u<n&&(i[u]=i[n],i[n]=null),i[u].type="none",u++),n=a,n!==i.length&&(h=i[n].polygonIdx));while(n!==i.length);if(i.splice(u),i.length!==0&&e.length!==0){i.sort((g,v)=>g.portalHash<v.portalHash?1:-1);let f=0,_=0;for(;f!==i.length&&_!==e.length;){const g=i[f],v=e[_];g.portalHash>v.hash?f++:v.hash>g.portalHash?_++:(g.type=v.type,f++)}}}isOnBorder(e,i){return e<=0&&i<=0||e>=We&&i>=We}addFeatureSection(e,i,n,a){return e!==i&&(i=e,n.push({featureIndex:e,vertexStart:a.getVertexCount()}),a.clearVertexLookup()),i}sortSubarray(e,i,n,a){const u=e.slice(i,n);u.sort(a),e.splice(i,u.length,...u)}static computeEdgeHash(e,i){return(e.y===i.y&&e.x>i.x||e.y>i.y)&&([e,i]=[i,e]),BigInt(Vn.computePosHash(e))<<32n|BigInt(Vn.computePosHash(i))}static computePosHash(e){return((65535&e.x)<<16|65535&e.y)>>>0}}function C1(r,e){return r>e?1:r<e?-1:0}class l_{constructor(e=C1,i=!1){this._compare=e,this._root=null,this._size=0,this._noDuplicates=!!i}rotateLeft(e){var i=e.right;i&&(e.right=i.left,i.left&&(i.left.parent=e),i.parent=e.parent),e.parent?e===e.parent.left?e.parent.left=i:e.parent.right=i:this._root=i,i&&(i.left=e),e.parent=i}rotateRight(e){var i=e.left;i&&(e.left=i.right,i.right&&(i.right.parent=e),i.parent=e.parent),e.parent?e===e.parent.left?e.parent.left=i:e.parent.right=i:this._root=i,i&&(i.right=e),e.parent=i}_splay(e){for(;e.parent;){var i=e.parent;i.parent?i.left===e&&i.parent.left===i?(this.rotateRight(i.parent),this.rotateRight(i)):i.right===e&&i.parent.right===i?(this.rotateLeft(i.parent),this.rotateLeft(i)):i.left===e&&i.parent.right===i?(this.rotateRight(i),this.rotateLeft(i)):(this.rotateLeft(i),this.rotateRight(i)):i.left===e?this.rotateRight(i):this.rotateLeft(i)}}splay(e){for(var i,n,a,u,h;e.parent;)(n=(i=e.parent).parent)&&n.parent?((a=n.parent).left===n?a.left=e:a.right=e,e.parent=a):(e.parent=null,this._root=e),u=e.left,h=e.right,e===i.left?(n&&(n.left===i?(i.right?(n.left=i.right,n.left.parent=n):n.left=null,i.right=n,n.parent=i):(u?(n.right=u,u.parent=n):n.right=null,e.left=n,n.parent=e)),h?(i.left=h,h.parent=i):i.left=null,e.right=i,i.parent=e):(n&&(n.right===i?(i.left?(n.right=i.left,n.right.parent=n):n.right=null,i.left=n,n.parent=i):(h?(n.left=h,h.parent=n):n.left=null,e.right=n,n.parent=e)),u?(i.right=u,u.parent=i):i.right=null,e.left=i,i.parent=e)}replace(e,i){e.parent?e===e.parent.left?e.parent.left=i:e.parent.right=i:this._root=i,i&&(i.parent=e.parent)}minNode(e=this._root){if(e)for(;e.left;)e=e.left;return e}maxNode(e=this._root){if(e)for(;e.right;)e=e.right;return e}insert(e,i){var n=this._root,a=null,u=this._compare;if(this._noDuplicates)for(;n;){if(a=n,u(n.key,e)===0)return;n=u(n.key,e)<0?n.right:n.left}else for(;n;)a=n,n=u(n.key,e)<0?n.right:n.left;return n={key:e,data:i,left:null,right:null,parent:a},a?u(a.key,n.key)<0?a.right=n:a.left=n:this._root=n,this.splay(n),this._size++,n}find(e){for(var i=this._root,n=this._compare;i;){var a=n(i.key,e);if(a<0)i=i.right;else{if(!(a>0))return i;i=i.left}}return null}contains(e){for(var i=this._root,n=this._compare;i;){var a=n(e,i.key);if(a===0)return!0;i=a<0?i.left:i.right}return!1}remove(e){var i=this.find(e);if(!i)return!1;if(this.splay(i),i.left)if(i.right){var n=this.minNode(i.right);n.parent!==i&&(this.replace(n,n.right),n.right=i.right,n.right.parent=n),this.replace(i,n),n.left=i.left,n.left.parent=n}else this.replace(i,i.left);else this.replace(i,i.right);return this._size--,!0}removeNode(e){if(!e)return!1;if(this.splay(e),e.left)if(e.right){var i=this.minNode(e.right);i.parent!==e&&(this.replace(i,i.right),i.right=e.right,i.right.parent=i),this.replace(e,i),i.left=e.left,i.left.parent=i}else this.replace(e,e.left);else this.replace(e,e.right);return this._size--,!0}erase(e){var i=this.find(e);if(i){this.splay(i);var n=i.left,a=i.right,u=null;n&&(n.parent=null,u=this.maxNode(n),this.splay(u),this._root=u),a&&(n?u.right=a:this._root=a,a.parent=u),this._size--}}pop(){var e=this._root,i=null;if(e){for(;e.left;)e=e.left;i={key:e.key,data:e.data},this.remove(e.key)}return i}next(e){var i=e;if(i)if(i.right)for(i=i.right;i&&i.left;)i=i.left;else for(i=e.parent;i&&i.right===e;)e=i,i=i.parent;return i}prev(e){var i=e;if(i)if(i.left)for(i=i.left;i&&i.right;)i=i.right;else for(i=e.parent;i&&i.left===e;)e=i,i=i.parent;return i}forEach(e){for(var i=this._root,n=[],a=!1,u=0;!a;)i?(n.push(i),i=i.left):n.length>0?(e(i=n.pop(),u++),i=i.right):a=!0;return this}range(e,i,n,a){const u=[],h=this._compare;let f,_=this._root;for(;u.length!==0||_;)if(_)u.push(_),_=_.left;else{if(_=u.pop(),f=h(_.key,i),f>0)break;if(h(_.key,e)>=0&&n.call(a,_))return this;_=_.right}return this}keys(){for(var e=this._root,i=[],n=[],a=!1;!a;)e?(i.push(e),e=e.left):i.length>0?(e=i.pop(),n.push(e.key),e=e.right):a=!0;return n}values(){for(var e=this._root,i=[],n=[],a=!1;!a;)e?(i.push(e),e=e.left):i.length>0?(e=i.pop(),n.push(e.data),e=e.right):a=!0;return n}at(e){for(var i=this._root,n=[],a=!1,u=0;!a;)if(i)n.push(i),i=i.left;else if(n.length>0){if(i=n.pop(),u===e)return i;u++,i=i.right}else a=!0;return null}load(e=[],i=[],n=!1){if(this._size!==0)throw new Error("bulk-load: tree is not empty");const a=e.length;return n&&u_(e,i,0,a-1,this._compare),this._root=c_(null,e,i,0,a),this._size=a,this}min(){var e=this.minNode(this._root);return e?e.key:null}max(){var e=this.maxNode(this._root);return e?e.key:null}isEmpty(){return this._root===null}get size(){return this._size}static createTree(e,i,n,a,u){return new l_(n,u).load(e,i,a)}}function c_(r,e,i,n,a){const u=a-n;if(u>0){const h=n+Math.floor(u/2),f={key:e[h],data:i[h],parent:r};return f.left=c_(f,e,i,n,h),f.right=c_(f,e,i,h+1,a),f}return null}function u_(r,e,i,n,a){if(i>=n)return;const u=r[i+n>>1];let h=i-1,f=n+1;for(;;){do h++;while(a(r[h],u)<0);do f--;while(a(r[f],u)>0);if(h>=f)break;let _=r[h];r[h]=r[f],r[f]=_,_=e[h],e[h]=e[f],e[f]=_}u_(r,e,i,f,a),u_(r,e,f+1,n,a)}const ly=11102230246251565e-32,En=134217729,P1=(3+8*ly)*ly;function h_(r,e,i,n,a){let u,h,f,_,g=e[0],v=n[0],b=0,w=0;v>g==v>-g?(u=g,g=e[++b]):(u=v,v=n[++w]);let E=0;if(b<r&&w<i)for(v>g==v>-g?(h=g+u,f=u-(h-g),g=e[++b]):(h=v+u,f=u-(h-v),v=n[++w]),u=h,f!==0&&(a[E++]=f);b<r&&w<i;)v>g==v>-g?(h=u+g,_=h-u,f=u-(h-_)+(g-_),g=e[++b]):(h=u+v,_=h-u,f=u-(h-_)+(v-_),v=n[++w]),u=h,f!==0&&(a[E++]=f);for(;b<r;)h=u+g,_=h-u,f=u-(h-_)+(g-_),g=e[++b],u=h,f!==0&&(a[E++]=f);for(;w<i;)h=u+v,_=h-u,f=u-(h-_)+(v-_),v=n[++w],u=h,f!==0&&(a[E++]=f);return u===0&&E!==0||(a[E++]=u),E}function hd(r){return new Float64Array(r)}const hu=hd(4),cy=hd(8),uy=hd(12),hy=hd(16),Un=hd(4);function dd(r,e,i){e===null?(r.inOut=!1,r.otherInOut=!0):(r.isSubject===e.isSubject?(r.inOut=!e.inOut,r.otherInOut=e.otherInOut):(r.inOut=!e.otherInOut,r.otherInOut=e.isVertical()?!e.inOut:e.inOut),e&&(r.prevInResult=!dy(e,i)||e.isVertical()?e.prevInResult:e)),r.resultTransition=dy(r,i)?(function(n,a){let u,h=!n.inOut,f=!n.otherInOut;switch(a){case 0:u=h&&f;break;case 1:u=h||f;break;case 3:u=h!==f;break;case 2:u=n.isSubject?h&&!f:f&&!h}return u?1:-1})(r,i):0}function dy(r,e){switch(r.type){case 0:switch(e){case 0:return!r.otherInOut;case 1:return r.otherInOut;case 2:return r.isSubject&&r.otherInOut||!r.isSubject&&!r.otherInOut;case 3:return!0}break;case 2:return e===0||e===1;case 3:return e===2;case 1:return!1}return!1}class du{constructor(e,i,n,a,u){this.left=i,this.point=e,this.otherEvent=n,this.isSubject=a??!1,this.type=u||0,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.resultTransition=0,this.otherPos=-1,this.outputContourId=-1,this.isExteriorRing=!0}isBelow(e){const i=this.point,n=this.otherEvent.point;return this.left?(i[0]-e[0])*(n[1]-e[1])-(n[0]-e[0])*(i[1]-e[1])>0:(n[0]-e[0])*(i[1]-e[1])-(i[0]-e[0])*(n[1]-e[1])>0}isAbove(e){return!this.isBelow(e)}isVertical(){return this.point[0]===this.otherEvent.point[0]}get inResult(){return this.resultTransition!==0}clone(){const e=new du(this.point,this.left,this.otherEvent,this.isSubject,this.type);return e.contourId=this.contourId,e.resultTransition=this.resultTransition,e.prevInResult=this.prevInResult,e.isExteriorRing=this.isExteriorRing,e.inOut=this.inOut,e.otherInOut=this.otherInOut,e}}function Ms(r,e){return r[0]===e[0]&&r[1]===e[1]}function d_(r,e,i){const n=(function(a,u,h,f,_,g){const v=(u-g)*(h-_),b=(a-_)*(f-g),w=v-b;if(v===0||b===0||v>0!=b>0)return w;const E=Math.abs(v+b);return Math.abs(w)>=33306690738754716e-32*E?w:-(function(I,P,D,R,F,B,V){let $,H,J,ee,K,re,se,Ee,we,Se,Re,Ce,Pe,ye,De,Ae,Le,ze;const tt=I-F,it=D-F,Ze=P-B,Xe=R-B;ye=tt*Xe,re=En*tt,se=re-(re-tt),Ee=tt-se,re=En*Xe,we=re-(re-Xe),Se=Xe-we,De=Ee*Se-(ye-se*we-Ee*we-se*Se),Ae=Ze*it,re=En*Ze,se=re-(re-Ze),Ee=Ze-se,re=En*it,we=re-(re-it),Se=it-we,Le=Ee*Se-(Ae-se*we-Ee*we-se*Se),Re=De-Le,K=De-Re,hu[0]=De-(Re+K)+(K-Le),Ce=ye+Re,K=Ce-ye,Pe=ye-(Ce-K)+(Re-K),Re=Pe-Ae,K=Pe-Re,hu[1]=Pe-(Re+K)+(K-Ae),ze=Ce+Re,K=ze-Ce,hu[2]=Ce-(ze-K)+(Re-K),hu[3]=ze;let pt=(function(Kt,Lt){let hi=Lt[0];for(let qt=1;qt<4;qt++)hi+=Lt[qt];return hi})(0,hu),ct=22204460492503146e-32*V;if(pt>=ct||-pt>=ct||(K=I-tt,$=I-(tt+K)+(K-F),K=D-it,J=D-(it+K)+(K-F),K=P-Ze,H=P-(Ze+K)+(K-B),K=R-Xe,ee=R-(Xe+K)+(K-B),$===0&&H===0&&J===0&&ee===0)||(ct=11093356479670487e-47*V+P1*Math.abs(pt),pt+=tt*ee+Xe*$-(Ze*J+it*H),pt>=ct||-pt>=ct))return pt;ye=$*Xe,re=En*$,se=re-(re-$),Ee=$-se,re=En*Xe,we=re-(re-Xe),Se=Xe-we,De=Ee*Se-(ye-se*we-Ee*we-se*Se),Ae=H*it,re=En*H,se=re-(re-H),Ee=H-se,re=En*it,we=re-(re-it),Se=it-we,Le=Ee*Se-(Ae-se*we-Ee*we-se*Se),Re=De-Le,K=De-Re,Un[0]=De-(Re+K)+(K-Le),Ce=ye+Re,K=Ce-ye,Pe=ye-(Ce-K)+(Re-K),Re=Pe-Ae,K=Pe-Re,Un[1]=Pe-(Re+K)+(K-Ae),ze=Ce+Re,K=ze-Ce,Un[2]=Ce-(ze-K)+(Re-K),Un[3]=ze;const Qe=h_(4,hu,4,Un,cy);ye=tt*ee,re=En*tt,se=re-(re-tt),Ee=tt-se,re=En*ee,we=re-(re-ee),Se=ee-we,De=Ee*Se-(ye-se*we-Ee*we-se*Se),Ae=Ze*J,re=En*Ze,se=re-(re-Ze),Ee=Ze-se,re=En*J,we=re-(re-J),Se=J-we,Le=Ee*Se-(Ae-se*we-Ee*we-se*Se),Re=De-Le,K=De-Re,Un[0]=De-(Re+K)+(K-Le),Ce=ye+Re,K=Ce-ye,Pe=ye-(Ce-K)+(Re-K),Re=Pe-Ae,K=Pe-Re,Un[1]=Pe-(Re+K)+(K-Ae),ze=Ce+Re,K=ze-Ce,Un[2]=Ce-(ze-K)+(Re-K),Un[3]=ze;const bt=h_(Qe,cy,4,Un,uy);ye=$*ee,re=En*$,se=re-(re-$),Ee=$-se,re=En*ee,we=re-(re-ee),Se=ee-we,De=Ee*Se-(ye-se*we-Ee*we-se*Se),Ae=H*J,re=En*H,se=re-(re-H),Ee=H-se,re=En*J,we=re-(re-J),Se=J-we,Le=Ee*Se-(Ae-se*we-Ee*we-se*Se),Re=De-Le,K=De-Re,Un[0]=De-(Re+K)+(K-Le),Ce=ye+Re,K=Ce-ye,Pe=ye-(Ce-K)+(Re-K),Re=Pe-Ae,K=Pe-Re,Un[1]=Pe-(Re+K)+(K-Ae),ze=Ce+Re,K=ze-Ce,Un[2]=Ce-(ze-K)+(Re-K),Un[3]=ze;const Ot=h_(bt,uy,4,Un,hy);return hy[Ot-1]})(a,u,h,f,_,g,E)})(r[0],r[1],e[0],e[1],i[0],i[1]);return n>0?-1:n<0?1:0}function Za(r,e){const i=r.point,n=e.point;return i[0]>n[0]?1:i[0]<n[0]?-1:i[1]!==n[1]?i[1]>n[1]?1:-1:(function(a,u,h){return a.left!==u.left?a.left?1:-1:d_(h,a.otherEvent.point,u.otherEvent.point)!==0?a.isBelow(u.otherEvent.point)?-1:1:!a.isSubject&&u.isSubject?1:-1})(r,e,i)}function Wa(r,e,i){const n=new du(e,!1,r,r.isSubject),a=new du(e,!0,r.otherEvent,r.isSubject);return Ms(r.point,r.otherEvent.point)&&console.warn("what is that, a collapsed 
8segment?",r),n.contourId=a.contourId=r.contourId,Za(a,r.otherEvent)>0&&(r.otherEvent.left=!0,a.left=!1),r.otherEvent.otherEvent=a,r.otherEvent=n,i.push(a),i.push(n),i}function Ap(r,e){return r[0]*e[1]-r[1]*e[0]}function f_(r,e){return r[0]*e[0]+r[1]*e[1]}function p_(r,e,i){const n=(function(_,g,v,b){const w=[g[0]-_[0],g[1]-_[1]],E=[b[0]-v[0],b[1]-v[1]];function I(J,ee,K){return[J[0]+ee*K[0],J[1]+ee*K[1]]}const P=[v[0]-_[0],v[1]-_[1]];let D=Ap(w,E),R=D*D;const F=f_(w,w);if(R>0){const J=Ap(P,E)/D;if(J<0||J>1)return null;const ee=Ap(P,w)/D;return ee<0||ee>1?null:J===0||J===1?[I(_,J,w)]:ee===0||ee===1?[I(v,ee,E)]:[I(_,J,w)]}if(D=Ap(P,w),R=D*D,R>0)return null;const B=f_(w,P)/F,V=B+f_(w,E)/F,$=Math.min(B,V),H=Math.max(B,V);return $<=1&&H>=0?$===1?[I(_,$>0?$:0,w)]:H===0?[I(_,H<1?H:1,w)]:[I(_,$>0?$:0,w),I(_,H<1?H:1,w)]:null})(r.point,r.otherEvent.point,e.point,e.otherEvent.point),a=n?n.length:0;if(a===0||a===1&&(Ms(r.point,e.point)||Ms(r.otherEvent.point,e.otherEvent.point))||a===2&&r.isSubject===e.isSubject)return 0;if(a===1)return!Ms(r.point,n[0])&&!Ms(r.otherEvent.point,n[0])&&Wa(r,n[0],i),!Ms(e.point,n[0])&&!Ms(e.otherEvent.point,n[0])&&Wa(e,n[0],i),1;const u=[];let h=!1,f=!1;return Ms(r.point,e.point)?h=!0:Za(r,e)===1?u.push(e,r):u.push(r,e),Ms(r.otherEvent.point,e.otherEvent.point)?f=!0:Za(r.otherEvent,e.otherEvent)===1?u.push(e.otherEvent,r.otherEvent):u.push(r.otherEvent,e.otherEvent),h&&f||h?(e.type=1,r.type=e.inOut===r.inOut?2:3,h&&!f&&Wa(u[1].otherEvent,u[0].point,i),2):f?(Wa(u[0],u[1].point,i),3):u[0]!==u[3].otherEvent?(Wa(u[0],u[1].point,i),Wa(u[1],u[2].point,i),3):(Wa(u[0],u[1].point,i),Wa(u[3].otherEvent,u[2].point,i),3)}function R1(r,e){if(r===e)return 0;if(d_(r.point,r.otherEvent.point,e.point)!==0||d_(r.point,r.otherEvent.point,e.otherEvent.point)!==0)return Ms(r.point,e.point)?r.isBelow(e.otherEvent.point)?-1:1:r.point[0]===e.point[0]?r.point[1]<e.point[1]?-1:1:Za(r,e)===1?e.isAbove(r.point)?-1:1:r.isBelow(e.point)?-1:1;if(r.isSubject!==e.isSubject)return r.isSubject?-1:1;{let i=r.point,n=e.point;if(i[0]===n[0]&&i[1]===n[1])return i=r.otherEvent.point,n=e.otherEvent.point,i[0]===n[0]&&i[1]===n[1]?0:(r.contourId??0)>(e.contourId??0)?1:-1}return Za(r,e)===1?1:-1}class z1{constructor(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null}isExterior(){return this.holeOf==null}}function D1(r,e,i,n){let a,u=r+1,h=e[r].point;const f=e.length;for(u<f&&(a=e[u].point);u<f&&a[0]===h[0]&&a[1]===h[1];){if(!i[u])return u;u++,u<f&&(a=e[u].point)}for(u=r-1;i[u]&&u>n;)u--;return u}function L1(r,e,i){const n=new z1;if(r.prevInResult!=null){const a=r.prevInResult,u=a.outputContourId;if(a.resultTransition>0){const h=e[u];if(h.holeOf!=null){const f=h.holeOf;e[f].holeIds.push(i),n.holeOf=f,n.depth=e[u].depth}else e[u].holeIds.push(i),n.holeOf=u,n.depth=e[u].depth+1}else n.holeOf=null,n.depth=e[u].depth}else n.holeOf=null,n.depth=0;return n}const fy=Math.max,py=Math.min;let Mp=0;function my(r,e,i,n,a,u){let h,f,_,g,v,b;for(h=0,f=r.length-1;h<f;h++){if(_=r[h],g=r[h+1],v=new du(_,!1,void 0,e),b=new du(g,!1,v,e),v.otherEvent=b,_[0]===g[0]&&_[1]===g[1])continue;v.contourId=b.contourId=i,u||(v.isExteriorRing=!1,b.isExteriorRing=!1),Za(v,b)>0?b.left=!0:v.left=!0;const w=_[0],E=_[1];a[0]=py(a[0],w),a[1]=py(a[1],E),a[2]=fy(a[2],w),a[3]=fy(a[3],E),n.push(v),n.push(b)}}const Cp=[];function _y(r,e,i){let n=r,a=e;typeof r[0][0][0]=="number"&&(n=[r]),typeof e[0][0][0]=="number"&&(a=[e]);let u=(function(w,E,I){let P=null;return w.length*E.length===0&&(I===0?P=Cp:I===2?P=w:(I===1||I===3)&&(P=w.length===0?E:w)),P})(n,a,i);if(u)return u===Cp?null:u;const h=[1/0,1/0,-1/0,-1/0],f=[1/0,1/0,-1/0,-1/0],_=(function(w,E,I,P,D){const R=new wl(void 0,Za);let F,B,V,$,H,J;for(V=0,$=w.length;V<$;V++)for(F=w[V],H=0,J=F.length;H<J;H++)B=H===0,B&&Mp++,my(F[H],!0,Mp,R,I,B);for(V=0,$=E.length;V<$;V++)for(F=E[V],H=0,J=F.length;H<J;H++)B=H===0,D===2&&(B=!1),B&&Mp++,my(F[H],!1,Mp,R,P,B);return R})(n,a,h,f,i);if(u=(function(w,E,I,P,D){let R=null;return(I[0]>P[2]||P[0]>I[2]||I[1]>P[3]||P[1]>I[3])&&(D===0?R=Cp:D===2?R=w:(D===1||D===3)&&(R=w.concat(E))),R})(n,a,h,f,i),u)return u===Cp?null:u;const g=(function(w,E,I,P,D,R){const F=new l_(R1),B=[],V=Math.min(P[2],D[2]);let $,H,J;
8for(;w.length!==0;){let ee=w.pop();if(B.push(ee),R===0&&ee.point[0]>V||R===2&&ee.point[0]>P[2])break;if(ee.left){H=$=F.insert(ee),J=F.minNode(),$=$!==J?F.prev($):null,H=F.next(H);const K=$?$.key:null;let re;if(dd(ee,K,R),H&&p_(ee,H.key,w)===2&&(dd(ee,K,R),dd(H.key,ee,R)),$&&p_($.key,ee,w)===2){let se=$;se=se!==J?F.prev(se):null,re=se?se.key:null,dd(K,re,R),dd(ee,K,R)}}else ee=ee.otherEvent,H=$=F.find(ee),$&&H&&($=$!==J?F.prev($):null,H=F.next(H),F.remove(ee),H&&$&&p_($.key,H.key,w))}return B})(_,0,0,h,f,i),v=(function(w){let E,I;const P=(function(F){let B,V,$,H,J;const ee=[];for(V=0,$=F.length;V<$;V++)B=F[V],(B.left&&B.inResult||!B.left&&B.otherEvent.inResult)&&ee.push(B);let K=!1;for(;!K;)for(K=!0,V=0,$=ee.length;V<$;V++)V+1<$&&Za(ee[V],ee[V+1])===1&&(H=ee[V],ee[V]=ee[V+1],ee[V+1]=H,K=!1);for(V=0,$=ee.length;V<$;V++)B=ee[V],B.otherPos=V;for(V=0,$=ee.length;V<$;V++)B=ee[V],B.left||(J=B.otherPos,B.otherPos=B.otherEvent.otherPos,B.otherEvent.otherPos=J);return ee})(w),D={},R=[];for(E=0,I=P.length;E<I;E++){if(D[E])continue;const F=R.length,B=L1(P[E],R,F),V=J=>{D[J]=!0,J<P.length&&P[J]&&(P[J].outputContourId=F)};let $=E,H=E;for(B.points.push(P[E].point);V($),$=P[$].otherPos,V($),B.points.push(P[$].point),$=D1($,P,D,H),!($==H||$>=P.length)&&P[$];);R.push(B)}return R})(g),b=[];for(let w=0;w<v.length;w++){let E=v[w];if(E.isExterior()){let I=[E.points];for(let P=0;P<E.holeIds.length;P++)I.push(v[E.holeIds[P]].points);b.push(I)}}return b}function Pp(r,e,i,n){const a=[],u=n===0?(h,f,_,g,v,b)=>{h.push(new Be(b,_+(b-f)/(g-f)*(v-_)))}:(h,f,_,g,v,b)=>{h.push(new Be(f+(b-_)/(v-_)*(g-f),b))};for(const h of r){const f=[];for(const _ of h){if(_.length<=2)continue;const g=[];for(let w=0;w<_.length-1;w++){const E=_[w].x,I=_[w].y,P=_[w+1].x,D=_[w+1].y,R=n===0?E:I,F=n===0?P:D;R<e?F>e&&u(g,E,I,P,D,e):R>i?F<i&&u(g,E,I,P,D,i):g.push(_[w]),F<e&&R>=e&&u(g,E,I,P,D,e),F>i&&R<=i&&u(g,E,I,P,D,i)}let v=_[_.length-1];const b=n===0?v.x:v.y;b>=e&&b<=i&&g.push(v),g.length&&(v=g[g.length-1],g[0].x===v.x&&g[0].y===v.y||g.push(g[0]),f.push(g))}f.length&&a.push(f)}return a}function F1(r,e){const i=_y(m_(r),m_([e]),0);return i==null?[]:gy(i)}function O1(r,e){let n=m_(r,65536);const a=[];for(;e.valid();e.next()){const[u,h]=e.get(),f=u.x*65536,_=u.y*65536,g=h.x*65536,v=h.y*65536,b=g-f,w=v-_,E=Math.hypot(b,w);if(E===0)continue;const I=Math.trunc(w/E*3),P=-Math.trunc(b/E*3);a.push([[[f,_],[g,v],[g+I,v+P],[f+I,_+P],[f,_]]])}return a.length>0&&(n=_y(n,a,2)),gy(n,1/65536,128)}function m_(r,e=1){return[r.map(i=>i.map(n=>[n.x*e,n.y*e]))]}function gy(r,e=1,i){return r.map(n=>n.map((a,u)=>{const h=a.map(f=>{let _=f[0],g=f[1];return i&&(_=Math.round(_/i)*i,g=Math.round(g/i)*i),new Be(_*e,g*e)._round()});return u>0&&h.reverse(),h}))}class __{constructor(e,i){this.layoutVertexArray=new Es,this.indexArray=new hr,this.lineIndexArray=new On,this.triangleSegments=new Ci,this.lineSegments=new Ci,this.programConfigurations=new S(e.layers,{zoom:e.zoom,lut:e.lut}),this.uploaded=!1,i&&(this.elevatedLayoutVertexArray=new Ir)}update(e,i,n,a,u,h,f,_){this.programConfigurations.updatePaintArrays(e,i,u,n,a,h,f,_)}isEmpty(){return this.layoutVertexArray.length===0}needsUpload(){return this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,p1.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.lineIndexBuffer=e.createIndexBuffer(this.lineIndexArray),this.elevatedLayoutVertexArray&&this.elevatedLayoutVertexArray.length>0&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,m1.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.lineIndexBuffer.destroy(),this.programConfigurations.destroy(),this.triangleSegments.destroy(),this.lineSegments.destroy())}populatePaintArrays(e,i,n,a,u,h,f){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,n,a,u,h,void 0,f)}}class g_{constructor(e){this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lut=e.lut,this.bufferData=new __(e,!1),this.elevationBufferData=new __(e,!0),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.projection=e.projection,this.elevationMode=this.layers[0].layout.get("fill-elevation-reference"),this.sourceLayerIndex=e.s
8ourceLayerIndex,this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,i){}updateAppearances(e,i,n,a){}populate(e,i,n,a){this.hasPattern=s_("fill",this.layers,this.pixelRatio,i);const u=this.layers[0].layout.get("fill-sort-key"),h=[];for(const{feature:f,id:_,index:g,sourceLayerIndex:v}of e){const b=this.layers[0]._featureFilter.needGeometry,w=Pt(f,b);if(!this.layers[0]._featureFilter.filter(new ui(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),w,n))continue;const E=u?u.evaluate(w,{},n,i.availableImages):void 0,I={id:_,properties:f.properties,type:f.type,sourceLayerIndex:v,index:g,geometry:b?w.geometry:yt(f,n,a),patterns:{},sortKey:E};h.push(I)}u&&h.sort((f,_)=>f.sortKey-_.sortKey);for(const f of h){const{geometry:_,index:g,sourceLayerIndex:v}=f;if(this.hasPattern){const b=a_("fill",this.layers,f,this.zoom,this.pixelRatio,i);this.patternFeatures.push(b)}else this.addFeature(f,_,g,n,{},i.availableImages,i.brightness,i.elevationFeatures);i.featureIndex.insert(e[g].feature,_,g,v,this.index)}}update(e,i,n,a,u,h,f){this.bufferData.update(e,i,n,a,u,h,f,this.worldview),this.elevationBufferData.update(e,i,n,a,u,h,f,this.worldview),this.elevatedStructures&&this.elevatedStructures.update(e,i,n,a,u,h,f,this.worldview)}addFeatures(e,i,n,a,u,h){for(const f of this.patternFeatures)this.addFeature(f,f.geometry,f.index,i,n,a,h,e.elevationFeatures)}isEmpty(){return this.bufferData.isEmpty()&&this.elevationBufferData.isEmpty()}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||this.elevationBufferData.needsUpload()}upload(e){this.bufferData.upload(e),this.elevationBufferData.upload(e),this.elevatedStructures&&this.elevatedStructures.upload(e)}destroy(){this.bufferData.destroy(),this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}addFeature(e,i,n,a,u,h=[],f,_){const g=ud(i,500);this.elevationMode!=="none"?this.addElevatedRoadFeature(e,g,a,n,_):this.addGeometry(g,this.bufferData),this.bufferData.populatePaintArrays(e,n,u,h,a,f,this.worldview),this.elevationBufferData.populatePaintArrays(e,n,u,h,a,f,this.worldview)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}setEvaluatedPortalGraph(e,i,n,a,u){this.elevatedStructures&&(this.elevatedStructures.construct(e),this.elevatedStructures.populatePaintArrays(i,n,a,u,this.worldview))}addElevatedRoadFeature(e,i,n,a,u){const h=new Array,f=tn.getElevationFeature(e,u);if(!f)return void this.addGeometry(i,this.bufferData);{const g=this.clipPolygonsToTile(i,1);g.length>0&&h.push({polygons:g,elevationFeature:f,elevationTileID:n})}const _={guardRailEnabled:this.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(e,{},n),featureIndex:a};for(const g of h)if(g.elevationFeature){if(this.elevationMode==="hd-road-base"){this.elevatedStructures||(this.elevatedStructures=new Vn(g.elevationTileID,this.layers,this.zoom,this.lut));const b=g.elevationFeature.isTunnel();let w=0;e.properties.hasOwnProperty(Mt)&&(w=+e.properties[Mt]),this.elevatedStructures.addPortalCandidates(g.elevationFeature.id,g.polygons,b,g.elevationFeature,w)}g.elevationFeature.constantHeight==null&&(g.polygons=this.prepareElevatedPolygons(g.polygons,g.elevationFeature,g.elevationTileID));const v=new Kn(n,g.elevationTileID);this.addElevatedGeometry(g.polygons,v,g.elevationFeature,this.elevationMode==="hd-road-base"?0:.05,a,_)}}addElevatedGeometry(e,i,n,a,u,h){const f={elevation:n,elevationSampler:i,bias:a,index:u,featureInfo:h},[_,g]=this.addGeometry(e,this.elevationBufferData,f);this.elevationBufferData.heightRange==null?this.elevationBufferData.heightRange={min:_,max:g}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,_),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,g))}addGeometry(e,i,n){let a=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY,h=null;n&&(h=n.elevationSampler.constantElevation(n.elevation,n.bias),h!=null&&(a=h,u=h));const f=(_,g,v)=>{if(n!=null)if(g.push(_),h!=null)i.elevatedLayoutVertexArray.emplaceBack(h),v.push(h);else{const b=n.elevationSampler.pointElevation(_,n.elevation,n.bias);i.elevatedLayoutVertexArray.emplaceBack(b),v.push(b),a=Math.min(a,b),u=Math.max(u,b)}};for(const _ of e){let g=0;for(const B of _)g+=B.length;const v=i.triangleSegments.prepareSegment(g,i.layoutVertexArray,i.indexArray),b=v.vertexLength,w=[],E=[],I=[],P=[],D=[],R=i.layoutVertexArray.length;for(const B of _){if(B.length===0)continue;B!==_[0]&&E.push(w.length/2);const V=i.lineSegments.prepareSegment(B.length,i.layoutVertexArray,i.lineIndexArray),$=V.vertexLength;n&&D.push(i.layoutVertexArray.length-R),f(B[0],I,P),i.layoutVertexArray.emplaceBack(B[0].x,B[0].y),i.lineIndexArray.emplaceBack($+B.length-1,$),w.push(B[0].x),w.push(B[0].y);for(let H=1;H<B.length;H++)f(B[H],I,P),i.layoutVertexArray.emplaceBack(B[H].x,B[H].y),i.lineIndexArray.emplaceBack($+H-1,$+H),w.push(B[H].x),w.push(B[H].y);V.vertexLength+=B.length,V.primitiveLength+=B.length}const F=cu(w,E);for(let B=0;B<F.length;B+=3)i.indexArray.emplaceBack(b+F[B],b+F[B+1],b+F[B+2]);if(F.length>0&&n&&this.elevationMode==="hd-road-base"){const B=n.elevation.isTunnel(),V=n.elevation.safeArea,$=this.elevatedStructures.addVertices(I,P);this.elevatedStructures.addTriangles(F,$,B);const H=D.length;if(H>0){for(let J=0;J<H-1;J++)this.elevatedStructures.addRenderableRing(n.index,D[J]+$,D[J+1]-D[J],B,V,n.featureInfo);this.elevatedStructures.addRenderableRing(n.index,D[H-1]+$,I.length-D[H-1],B,V,n.featureInfo)}}v.vertexLength+=g,v.primitiveLength+=F.length/3}return[a,u]}prepareElevatedPolygons(e,i,n){const a=1/Ue(n),u=[];for(const h of e){const f=O1(h,new wn(i,a));u.push(...f)}return u}clipPolygonsToTile(e,i){const n=-i,a=-i,u=We+i,h=We+i;let f=0;const _=[],g=[];for(;f<e.length;f++){const w=e[f],E=bl(w);(E.min.x>=n&&E.max.x<=u&&E.min.y>=a&&E.max.y<=h?_:g).push(w)}if(_.length===e.length)return e;const v=[new Be(n,a),new Be(u,a),new Be(u,h),new Be(n,h),new Be(n,a)],b=_;for(const w of g)b.push(...F1(w,v));return b}}let yy,xy,vy,by;nt(g_,"FillBucket",{omit:["layers","patternFeatures"]}),nt(__,"FillBufferData"),nt(Vn,"ElevatedStructures");class Rp{constructor(e,i,n,a){if(this.triangleCount=i.length/3,this.min=new Be(0,0),this.max=new Be(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],this.triangleCount===0||e.length===0)return;const[u,h]=[e[0].clone(),e[0].clone()];for(let b=1;b<e.length;++b){const w=e[b];u.x=Math.min(u.x,w.x),u.y=Math.min(u.y,w.y),h.x=Math.max(h.x,w.x),h.y=Math.max(h.y,w.y)}
vendor: 38,999 bytes, line 8
8if(a){const b=Math.ceil(Math.max(h.x-u.x,h.y-u.y)/a);n=Math.max(n,b)}if(n===0)return;this.min=u,this.max=h;const f=this.max.sub(this.min);f.x=Math.max(f.x,1),f.y=Math.max(f.y,1);const _=Math.max(f.x,f.y)/n;this.cellsX=Math.max(1,Math.ceil(f.x/_)),this.cellsY=Math.max(1,Math.ceil(f.y/_)),this.xScale=1/_,this.yScale=1/_;const g=[];for(let b=0;b<this.triangleCount;b++){const w=e[i[3*b+0]].sub(this.min),E=e[i[3*b+1]].sub(this.min),I=e[i[3*b+2]].sub(this.min),P=Cs(Math.floor(Math.min(w.x,E.x,I.x)),this.xScale,this.cellsX),D=Cs(Math.floor(Math.max(w.x,E.x,I.x)),this.xScale,this.cellsX),R=Cs(Math.floor(Math.min(w.y,E.y,I.y)),this.yScale,this.cellsY),F=Cs(Math.floor(Math.max(w.y,E.y,I.y)),this.yScale,this.cellsY),B=new Be(0,0),V=new Be(0,0),$=new Be(0,0),H=new Be(0,0);for(let J=R;J<=F;++J){B.y=V.y=J*_,$.y=H.y=(J+1)*_;for(let ee=P;ee<=D;++ee)B.x=$.x=ee*_,V.x=H.x=(ee+1)*_,(Wo(w,E,I,B,V,H)||Wo(w,E,I,B,H,$))&&g.push({cellIdx:J*this.cellsX+ee,triIdx:b})}}if(g.length===0)return;g.sort((b,w)=>b.cellIdx-w.cellIdx||b.triIdx-w.triIdx);let v=0;for(;v<g.length;){const b=g[v].cellIdx,w={start:this.payload.length,len:0};for(;v<g.length&&g[v].cellIdx===b;)++w.len,this.payload.push(g[v++].triIdx);this.cells[b]=w}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(e,i){if(this.triangleCount===0||this.cells.length===0||e.x>this.max.x||this.min.x>e.x||e.y>this.max.y||this.min.y>e.y)return;const n=Cs(e.x-this.min.x,this.xScale,this.cellsX),a=Cs(e.y-this.min.y,this.yScale,this.cellsY),u=this.cells[a*this.cellsX+n];if(u){this._lazyInitLookup();for(let h=0;h<u.len;h++){const f=this.payload[u.start+h],_=Math.floor(f/8),g=1<<f%8;if(!(this.lookup[_]&g)&&(this.lookup[_]|=g,i.push(f),i.length===this.triangleCount))return}}}query(e,i,n){if(this.triangleCount===0||this.cells.length===0||e.x>this.max.x||this.min.x>i.x||e.y>this.max.y||this.min.y>i.y)return;this._lazyInitLookup();const a=Cs(e.x-this.min.x,this.xScale,this.cellsX),u=Cs(i.x-this.min.x,this.xScale,this.cellsX),h=Cs(e.y-this.min.y,this.yScale,this.cellsY),f=Cs(i.y-this.min.y,this.yScale,this.cellsY);for(let _=h;_<=f;_++)for(let g=a;g<=u;g++){const v=this.cells[_*this.cellsX+g];if(v)for(let b=0;b<v.len;b++){const w=this.payload[v.start+b],E=Math.floor(w/8),I=1<<w%8;if(!(this.lookup[E]&I)&&(this.lookup[E]|=I,n.push(w),n.length===this.triangleCount))return}}}}function Cs(r,e,i){return Math.max(0,Math.min(i-1,Math.floor(r*e)))}nt(Rp,"TriangleGridIndex");class wy{constructor(e){this.zoom=e.zoom,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.footprints=[],this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,i){for(const n of this.footprints)i.push({footprint:n,id:e})}updateAppearances(e,i,n,a){}populate(e,i,n,a){const u=[];for(const{feature:h,id:f,index:_,sourceLayerIndex:g}of e){const v=this.layers[0]._featureFilter.needGeometry,b=Pt(h,v);if(!this.layers[0]._featureFilter.filter(new ui(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),b,n))continue;const w={id:f,properties:h.properties,type:h.type,sourceLayerIndex:g,index:_,geometry:v?b.geometry:yt(h,n,a),patterns:{}};u.push(w)}for(const h of u){const{geometry:f,index:_,sourceLayerIndex:g}=h;this.addFeature(h,f,_,n,{},i.availableImages,i.brightness),i.featureIndex.insert(e[_].feature,f,_,g,this.index)}}isEmpty(){return this.footprints.length===0}uploadPending(){return!1}upload(e){}update(e,i,n,a,u,h,f){}destroy(){}addFeature(e,i,n,a,u,h=[],f){for(const _ of ud(i,2)){const g=[],v=[],b=[],w=new Be(1/0,1/0),E=new Be(-1/0,-1/0);for(const D of _)if(D.length!==0){D!==_[0]&&b.push(v.length/2);for(let R=0;R<D.length;R++)v.push(D[R].x),v.push(D[R].y),g.push(D[R]),w.x=Math.min(w.x,D[R].x),w.y=Math.min(w.y,D[R].y),E.x=Math.max(E.x,D[R].x),E.y=Math.max(E.y,D[R].y)}const I=cu(v,b),P=new Rp(g,I,8,256);this.footprints.push({vertices:g,indices:I,grid:P,min:w,max:E})}}}nt(wy,"ClipBucket",{omit:["layers"]});const k1=Nt([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),B1=Nt([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),N1=Nt([{name:"a_flood_light_ground_radius",components:1,type:"Float32"}]),V1=Nt([{name:"a_centroid_pos",components:2,type:"Uint16"}]),U1=Nt([{name:"a_join_normal_inside",components:3,type:"Int16"}]),j1=Nt([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),G1=Nt([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:q1}=k1,fd=Number.MAX_SAFE_INTEGER,H1=fd-1;function Ty(r,e,i,n){return r.order<e||r.order===fd||!(r.clipMask&i)||(function(a,u){return u.length!==0&&u.find(h=>h===a)===void 0})(n,r.clipScope)}function zp(r,e){return r.x-e.x||r.y-e.y}function Sy(r,e){return zp(r.min,e.min)===0&&zp(r.max,e.max)===0}function y_(r,e){return!(r.min.x>e.max.x||r.max.x<e.min.x||r.min.y>e.max.y||r.max.y<e.min.y)}function Dp(r,e){if(r.length!==e.length)return!1;for(let i=0;i<r.length;i++)if(r[i].sourceId!==e[i].sourceId||!Sy(r[i],e[i])||r[i].order!==e[i].order||r[i].clipMask!==e[i].clipMask||!Oo(r[i].clipScope,e[i].clipScope))return!1;return!0}function Ey(r,e,i){const n=1/We,a=1/(1<<i.canonical.z),u=(e.x*n+i.canonical.x)*a+i.wrap,h=(e.y*n+i.canonical.y)*a;return{min:new Be((r.x*n+i.canonical.x)*a+i.wrap,(r.y*n+i.canonical.y)*a),max:new Be(u,h)}}function $1(r,e,i){const n=1<<i.canonical.z,a=((e.x-i.wrap)*n-i.canonical.x)*We,u=(e.y*n-i.canonical.y)*We;return{min:new Be(((r.x-i.wrap)*n-i.canonical.x)*We,(r.y*n-i.canonical.y)*We),max:new Be(a,u)}}function x_(r,e,i,n,a,u,h){const f=r.indices,_=r.vertices,g=[];for(let v=n;v<n+a;v+=3){const b=e[i[v+0]+u],w=e[i[v+1]+u],E=e[i[v+2]+u],I=Math.min(b.x,w.x,E.x),P=Math.max(b.x,w.x,E.x),D=Math.min(b.y,w.y,E.y),R=Math.max(b.y,w.y,E.y);g.length=0,r.grid.query(new Be(I,D),new Be(P,R),g);for(let F=0;F<g.length;F++){const B=g[F];if(Wo(_[f[3*B+0]],_[f[3*B+1]],_[f[3*B+2]],b,w,E,h))return!0}}return!1}function Iy(r,e,i,n){if(!r||!i)return!1;let a=r.vertices;if(!e.canonical.equals(n.canonical)||e.wrap!==n.wrap){if(i.vertices.length<r.vertices.length)return Iy(i,n,r,e);const u=e.canonical,h=n.canonical,f=Math.pow(2,h.z-u.z);a=r.vertices.map(_=>new Be((_.x+u.x*We)*f-h.x*We,(_.y+u.y*We)*f-h.y*We))}return x_(i,a,r.indices,0,r.indices.length,0,0)}function Ay(r,e,i,n){const a=Math.pow(2,n.z-i.z);return new Be((r+i.x*We)*a-n.x*We,(e+i.y*We)*a-n.y*We)}function My(r,e){const i=[];e.grid.queryPoint(r,i);const n=e.indices,a=e.vertices;for(let u=0;u<i.length;u++){const h=i[u];if(Sn([a[n[3*h+0]],a[n[3*h+1]],a[n[3*h+2]]],r))return!0}return!1}const v_=[new Be(0,0),new Be(We,0),new Be(We,We),new Be(0,We)];function Cy(r,e){const i=[];let n=[];if(!e||r.length<2)return[r];if(r.length===2)return Eo(r[0],r[1],v_)?[r]:[];for(let a=0;a<r.length+2;a++){const u=r[a%r.length],h=r[(a+1)%r.length],f=Eo(a===0?r[r.length-1]:r[(a-1)%r.length],u,v_),_=Eo(u,h,v_),g=f||_;g&&n.push(u),g&&_||n.length>0&&(n.length>1&&i.push(n),n=[])}return n.length>1&&i.push(n),i}const b_=Vt.types,Z1=["fill-extrusion-base","fill-extrusion-height","fill-extrusion-color","fill-extrusion-pattern","fill-extrusion-flood-light-wall-radius","fill-extrusion-line-width","fill-extrusion-emissive-strength"],W1=["fill-extrusion-flood-light-ground-radius"],X1=Math.pow(2,13),Y1=Math.pow(2,15)-1,Py=new Be(0,1),na=2147483648;function pd(r,e,i,n,a,u,h,f){r.emplaceBack((e<<1)+h,(i<<1)+u,(Math.floor(n*X1)<<1)+a,Math.round(f))}function md(r,e,i){r.emplaceBack(e.x*We,e.y*We,i?1:0)}function Lp(r,e,i,n,a,u){r.emplaceBack(e.x,e.y,(i.x<<1)+n,(i.y<<1)+a,u)}function _d(r,e,i){r.emplaceBack(e.x,e.y,e.z,i[0]*16384,i[1]*16384,i[2]*16384)}class Ry{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class zy{constructor(){this.centroidXY=new Be(0,0),this.vertexArrayOffset=0,this.vertexCount=0,this.groundVertexArrayOffset=0,this.groundVertexCount=0,this.flags=0,this.footprintSegIdx=-1,this.footprintSegLen=0,this.polygonSegIdx=-1,this.polygonSegLen=0,this.min=new Be(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new Be(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0,this.buildingId=0}span(){return new Be(this.max.x-this.min.x,this.max.y-this.min.y)}}class Dy{constructor(){this.acc=new Be(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(e,i){e.min.x===Number.MAX_VALUE&&(e.min.x=e.max.x=i.x,e.min.y=e.max.y=i.y)}appendEdge(e,i,n){this.accCount++,this.acc._add(i);let a=!!this.borders;i.x<e.min.x?(e.min.x=i.x,a=!0):i.x>e.max.x&&(e.max.x=i.x,a=!0),i.y<e.min.y?(e.min.y=i.y,a=!0):i.y>e.max.y&&(e.max.y=i.y,a=!0),((i.x===0||i.x===We)&&i.x===n.x)!=((i.y===0||i.y===We)&&i.y===n.y)&&this.processBorderOverlap(i,n),a&&this.checkBorderIntersection(i,n)}checkBorderIntersection(e,i){i.x<0!=e.x<0&&this.addBorderIntersection(0,_t(i.y,e.y,(0-i.x)/(e.x-i.x))),i.x>We!=e.x>We&&this.addBorderIntersection(1,_t(i.y,e.y,(We-i.x)/(e.x-i.x))),i.y<0!=e.y<0&&this.addBorderIntersection(2,_t(i.x,e.x,(0-i.y)/(e.y-i.y))),i.y>We!=e.y>We&&this.addBorderIntersection(3,_t(i.x,e.x,(We-i.y)/(e.y-i.y)))}addBorderIntersection(e,i){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const n=this.borders[e];i<n[0]&&(n[0]=i),i>n[1]&&(n[1]=i)}processBorderOverlap(e,i){if(e.x===i.x){if(e.y===i.y)return;const n=e.x===0?0:1;this.addBorderIntersection(n,i.y),this.addBorderIntersection(n,e.y)}else{const n=e.y===0?2:3;this.addBorderIntersection(n,i.x),this.addBorderIntersection(n,e.x)}}centroid(){return this.accCount===0?new Be(0,0):new Be(Math.floor(Math.max(0,this.acc.x)/this.accCount),Math.floor(Math.max(0,this.acc.y)/this.accCount))}intersectsCount(){return this.borders?this.borders.reduce((e,i)=>e+ +(i[0]!==Number.MAX_VALUE),0):0}}function Ly(r,e){const i=r.add(e)._unit(),n=Y(r.x*i.x+r.y*i.y,-1,1);var a,u,h;return h=Math.acos(n),Math.min(4,Math.max(-4,Math.tan(h)))/4*Y1*((a=r).x*(u=e).y-a.y*u.x<0?-1:1)}const K1=[r=>r.x<0,r=>r.x>We,r=>r.y<0,r=>r.y>We];function J1(r,e,i,n){const a=[4];if(n===0)return a;i._mult(n);const u=r.sub(i),h=e.sub(i),f=[r,e,u,h];for(let _=0;_<4;_++)for(const g of f)if(K1[_](g)){a.push(_);break}return a}class w_{constructor(e){this.groundRadiusArray=null,this.groundRadiusBuffer=null,this.vertexArray=new Zh,this.indexArray=new hr,this.programConfigurations=new S(e.layers,{zoom:e.zoom,lut:e.lut},i=>W1.includes(i)),this._segments=new Ci,this.hiddenByLandmarkVertexArray=new ou,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new Ci}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}addData(e,i,n,a=!1){const u=e.length;if(u>2){let h=Math.max(0,this._segments.get().length-1);const f=this._segments._prepareSegment(4*u,this.vertexArray.length,2*this._segmentToGroundQuads[h].length);let _;h!==this._segments.get().length-1&&(h++,this._segmentToGroundQuads[h]=[],this._segmentToRegionTriCounts[h]=[0,0,0,0,0]);{const g=e[0],v=e[1];_=Ly(g.sub(e[u-1])._perp()._unit(),v.sub(g)._perp()._unit())}for(let g=0;g<u;g++){const v=g===u-1?0:g+1,b=e[g],w=e[v],E=e[v===u-1?0:v+1],I=w.sub(b)._perp()._unit(),P=Ly(I,E.sub(w)._perp()._unit()),D=_,R=P;if(T_(b,w,i)||a&&ky(b,i)&&ky(w,i)){_=P;continue}const F=f.vertexLength;Lp(this.vertexArray,b,w,1,1,D),Lp(this.vertexArray,b,w,1,0,D),Lp(this.vertexArray,b,w,0,1,R),Lp(this.vertexArray,b,w,0,0,R),f.vertexLength+=4;const B=J1(b,w,I,n);for(const V of B)this._segmentToGroundQuads[h].push({id:F,region:V}),this._segmentToRegionTriCounts[h][V]+=2,f.primitiveLength+=2;_=P}}}prepareBorderSegments(){if(!this.hasData())return;const e=this._segments.get(),i=e.length;for(let n=0;n<i;n++)this._segmentToGroundQuads[n].sort((a,u)=>a.region-u.region);for(let n=0;n<i;n++){const a=this._segmentToGroundQuads[n],u=e[n],h=this._segmentToRegionTriCounts[n];h.reduce((_,g)=>_+g,0);let f=0;for(let _=0;_<=4;_++){const g=h[_];if(g!==0){let v=this.regionSegments[_];v||(v=this.regionSegments[_]=new Ci);const b={vertexOffset:u.vertexOffset,primitiveOffset:u.primitiveOffset+f,vertexLength:u.vertexLength,primitiveLength:g};v.get().push(b)}f+=g}for(let _=0;_<a.length;_++){const g=a[_].id;this.indexArray.emplaceBack(g,g+1,g+3),this.indexArray.emplaceBack(g,g+3,g+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(e,i,n,a,u,h,f){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,e,i,n,a,u,h,void 0,f)}upload(e){this.hasData()&&(this.vertexBuffer=e.createVertexBuffer(this.vertexArray,B1.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.groundRadiusArray!=null&&(this.groundRadiusBuffer=e.createVertexBuffer(this.groundRadiusArray,N1.members)))}uploadPaintProperties(e){this.hasData()&&this.programConfigurations.upload(e)}update(e,i,n,a,u,h,f,_){this.hasData()&&this.programConfigurations.updatePaintArrays(e,i,n,a,u,h,f,_)}updateHiddenByLandmark(e){this.updateHiddenByLandmarkRange(e.groundVertexArrayOffset,e.groundVertexCount,!!(e.flags&na))}updateHiddenByLandmarkRange(e,i,n){if(!this.hasData())return;const a=i+e;if(i!==0){for(let u=e;u<a;++u)this.hiddenByLandmarkVertexArray.emplace(u,n?1:0);this._needsHiddenByLandmarkUpdate=!0}}uploadHiddenByLandmark(e){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=e.createVertexBuffer(this.hiddenByLandmarkVertexArray,j1.members,!0):this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray),this._needsHiddenByLandmarkUpdate=!1)}destroy(){if(this.vertexBuffer){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.destroy(),this.groundRadiusBuffer&&this.groundRadiusBuffer.destroy(),this._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let e=0;e<=4;e++){const i=this.regionSegments[e];i&&i.destroy()}}}}class Fp{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaling=e.overscaling,this.layers=e.layers,this.pixelRatio=e.pixelRatio,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=e.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new hr,this.footprintVertices=new Es,this.footprintSegments=[],this.layoutVertexArray=new Zo,this.centroidVertexArray=new hp,this.wallVertexArray=new dp,this.indexArray=new hr,this.programConfigurations=new S(e.layers,{zoom:e.zoom,lut:e.lut},i=>Z1.includes(i)),this.segments=new Ci,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.groundEffect=new w_(e),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,i){}updateAppearances(e,i,n,a){}populate(e,i,n,a){this.features=[],this.hasPattern=s_("fill-extrusion",this.layers,this.pixelRatio,i),this.featuresOnBorder=[],this.borderFeatureIndices=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.selfDEMTileTimestamp=Number.MAX_VALUE,this.borderDEMTileTimestamp=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE],this.tileToMeter=Ue(n),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,this.wallMode=this.layers[0].paint.get("fill-extrusion-line-width").constantOr(1)!==0;for(const{feature:u,id:h,index:f,sourceLayerIndex:_}of e){const g=this.layers[0]._featureFilter.needGeometry,v=Pt(u,g);if(!this.layers[0]._featureFilter.filter(new ui(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),v,n))continue;const b={id:h,sourceLayerIndex:_,index:f,geometry:g?v.geometry:yt(u,n,a),properties:u.properties,type:u.type,patterns:{}},w=this.layoutVertexArray.length,E=b_[b.type]==="Polygon";if(this.hasPattern)this.features.push({featureId:u.id,feature:a_("fill-extrusion",this.layers,b,this.zoom,this.pixelRatio,i)});else if(this.wallMode)for(const I of b.geometry)for(const P of Cy(I,E))this.addFeature(u.id,b,[P],f,n,{},i.availableImages,a,i.brightness);else this.addFeature(u.id,b,b.geometry,f,n,{},i.availableImages,a,i.brightness);i.featureIndex.insert(u,b.geometry,f,_,this.index,w)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(e,i,n,a,u,h){for(const{featureId:f,feature:_}of this.features){const g=b_[_.type]==="Polygon",{geometry:v}=_;if(this.wallMode)for(const b of v)for(const w of Cy(b,g))this.addFeature(f,_,[w],_.index,i,n,a,u,h);else this.addFeature(f,_,v,_.index,i,n,a,u,h)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles()}update(e,i,n,a,u,h,f){this.programConfigurations.updatePaintArrays(e,i,u,n,a,h,f,this.worldview),this.groundEffect.update(e,i,u,n,a,h,f,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,q1),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.wallVertexBuffer=e.createVertexBuffer(this.wallVertexArray,U1.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,G1.members,!0)),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}uploadCentroid(e){this.groundEffect.uploadHiddenByLandmark(e),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,V1.members,!0):this.centroidVertexBuffer&&this.centroidVertexBuffer.updateData(this.centroidVertexArray),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,i,n,a,u,h,f,_,g){const v=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(i,{})/this.tileToMeter,b=[new Be(0,0),new Be(We,We)],w=_.projection,E=w.name==="globe",I=this.wallMode||b_[i.type]==="Polygon",P=new Dy;P.centroidDataIndex=this.centroidData.length;const D=new zy;D.buildingId=e,i.properties&&i.properties.hasOwnProperty("building_id")&&(D.buildingId=Number(i.properties.building_id));const R=this.layers[0].paint.get("fill-extrusion-base").evaluate(i,{},u)<=0,F=this.layers[0].paint.get("fill-extrusion-height").evaluate(i,{},u);let B;if(D.height=F,D.vertexArrayOffset=this.layoutVertexArray.length,D.groundVertexArrayOffset=this.groundEffect.vertexArray.length,E&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new Va),this.wallMode){if(E)return void xt("Non zero fill-extrusion-line-width is not yet supported on globe.");if(n.length!==1)return;B=(function(re){const se=re[0].x===re[re.length-1].x&&re[0].y===re[re.length-1].y;(function(Ze){let Xe=0;const pt=Ze.length;for(let ct=0;ct<pt;ct++)Xe+=(Ze[(ct+1)%pt].x-Ze[ct].x)*(Ze[(ct+1)%pt].y+Ze[ct].y);return Xe>=0})(re)||(re=re.reverse());const we={geometry:[],joinNormals:[],indices:[]},Se=[],Re=[],Ce=[];let Pe=re.length;for(;Pe>=2&&re[Pe-1].equals(re[Pe-2]);)Pe--;if(Pe<(se?3:2))return we;let ye,De,Ae,Le,ze,tt=0;for(;tt<Pe-1&&re[tt].equals(re[tt+1]);)tt++;se&&(ye=re[Pe-2],ze=re[tt].sub(ye)._unit()._perp());for(let Ze=tt;Ze<Pe;Ze++){if(Ae=Ze===Pe-1?se?re[tt+1]:void 0:re[Ze+1],Ae&&re[Ze].equals(Ae))continue;ze&&(Le=ze),ye&&(De=ye),ye=re[Ze],ze=Ae?Ae.sub(ye)._unit()._perp():Le,Le=Le||ze;let Xe=Le.add(ze);Xe.x===0&&Xe.y===0||Xe._unit();const pt=Xe.x*ze.x+Xe.y*ze.y,ct=pt!==0?1/pt:1/0,Qe=Le.x*ze.y-Le.y*ze.x>0;let bt="miter";const Ot=2;bt==="miter"&&ct>Ot&&(bt="bevel"),bt==="bevel"&&(ct>100&&(bt="flipbevel"),ct<Ot&&(bt="miter"));const Kt=(Lt,hi,qt,Zi)=>{const Wt=new Be(Lt.x,Lt.y),ai=new Be(Lt.x,Lt.y);Wt.x+=hi.x*Zi,Wt.y+=hi.y*Zi,ai.x-=hi.x*Math.max(qt,1),ai.y-=hi.y*Math.max(qt,1),Ce.push(hi),Se.push(Wt),Re.push(ai)};if(bt==="miter")Xe._mult(ct),Kt(ye,Xe,0,0);else if(bt==="flipbevel")Xe=ze.mult(-1),Kt(ye,Xe,0,0),Kt(ye,Xe.mult(-1),0,0);else{const Lt=-Math.sqrt(ct*ct-1),hi=Qe?Lt:0,qt=Qe?0:Lt;De&&Kt(ye,Le,hi,qt),Ae&&Kt(ye,ze,hi,qt)}}we.geometry=[...Se,...Re.reverse(),Se[0]],we.joinNormals=[...Ce,...Ce.reverse(),Ce[Ce.length-1]];const it=we.geometry.length-1;for(let Ze=0;Ze<it/2;Ze++)if(Ze+1<it/2){let Xe=Ze,pt=Ze+1,ct=it-1-Ze,Qe=it-2-Ze;Xe=Xe===0?it-1:Xe-1,pt=pt===0?it-1:pt-1,ct=ct===0?it-1:ct-1,Qe=Qe===0?it-1:Qe-1,we.indices.push(ct),we.indices.push(pt),we.indices.push(Xe),we.indices.push(ct),we.indices.push(Qe),we.indices.push(pt)}return we})(n[0]),n=[B.geometry]}const V=(re,se)=>re<(se.length-1)/2||re===se.length-1,$=this.wallMode?[n]:ud(n,500);for(let re=$.length-1;re>=0;re--){const se=$[re];(se.length===0||eb(se[0]))&&$.splice(re,1)}let H;if(E)H=Uy($,b,u);else{H=[];for(const re of $)H.push({polygon:re,bounds:b})}const J=I?this.edgeRadius:0,ee=J>0&&this.zoom<17,K=(re,se)=>{if(re.length===0)return!1;const Ee=re[re.length-1];return se.x===Ee.x&&se.y===Ee.y};for(const{polygon:re,bounds:se}of H){let Ee=0,we=0;for(const Pe of re)I&&!Pe[0].equals(Pe[Pe.length-1])&&Pe.push(Pe[0]),we+=I?Pe.length-1:Pe.length;const Se=this.segments.prepareSegment((I?5:4)*we,this.layoutVertexArray,this.indexArray);D.footprintSegIdx<0&&(D.footprintSegIdx=this.footprintSegments.length),D.polygonSegIdx<0&&(D.polygonSegIdx=this.polygonSegments.length);const Re={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},Ce=new Ry;if(Ce.vertexOffset=this.footprintVertices.length,Ce.indexOffset=3*this.footprintIndices.length,Ce.ringIndices=[],I){const Pe=[],ye=[];Ee=Se.vertexLength;for(let Ae=0;Ae<re.length;Ae++){const Le=re[Ae];Le.length&&Ae!==0&&ye.push(Pe.length/2);const ze=[];let tt,it;tt=Le[1].sub(Le[0])._perp()._unit(),Ce.ringIndices.push(Le.length-1);for(let Ze=1;Ze<Le.length;Ze++){const Xe=Le[Ze],pt=Le[Ze===Le.length-1?1:Ze+1],ct=Xe.clone();if(J){it=pt.sub(Xe)._perp()._unit();const Qe=tt.add(it)._unit(),bt=J*Math.min(4,1/(tt.x*Qe.x+tt.y*Qe.y));ct.x+=bt*Qe.x,ct.y+=bt*Qe.y,ct.x=Math.round(ct.x),ct.y=Math.round(ct.y),tt=it}if(!R||J!==0&&!ee||K(ze,ct)||ze.push(ct),pd(this.layoutVertexArray,ct.x,ct.y,0,0,1,1,0),this.wallMode){const Qe=V(Ze,Le);md(this.wallVertexArray,B.joinNormals[Ze],!Qe)}Se.vertexLength++,this.footprintVertices.emplaceBack(Xe.x,Xe.y),Pe.push(Xe.x,Xe.y),E&&_d(this.layoutVertexExtArray,w.projectTilePoint(ct.x,ct.y,u),w.upVector(u,ct.x,ct.y))}R&&(J===0||ee)&&(ze.length!==0&&K(ze,ze[0])&&ze.pop(),this.groundEffect.addData(ze,se,v))}const De=this.wallMode?B.indices:cu(Pe,ye);for(let Ae=0;Ae<De.length;Ae+=3)this.footprintIndices.emplaceBack(Ce.vertexOffset+De[Ae+0],Ce.vertexOffset+De[Ae+1],Ce.vertexOffset+De[Ae+2]),this.indexArray.emplaceBack(Ee+De[Ae],Ee+De[Ae+2],Ee+De[Ae+1]),Se.primitiveLength++;Ce.indexCount+=De.length,Ce.vertexCount+=this.footprintVertices.length-Ce.vertexOffset}for(let Pe=0;Pe<re.length;Pe++){const ye=re[Pe];P.startRing(D,ye[0]);let De=ye.length>4&&By(ye[ye.length-2],ye[0],ye[1]),Ae=J?Q1(ye[ye.length-2],ye[0],ye[1],J):0;const Le=[];let ze,tt,it;tt=ye[1].sub(ye[0])._perp()._unit();let Ze=!0;for(let Xe=1,pt=0;Xe<ye.length;Xe++){let ct=ye[Xe-1],Qe=ye[Xe];const bt=ye[Xe===ye.length-1?1:Xe+1];if(P.appendEdge(D,Qe,ct),T_(Qe,ct,se)){J&&(tt=bt.sub(Qe)._perp()._unit(),Ze=!Ze);continue}const Ot=Qe.sub(ct)._perp(),Kt=Ot.x/(Math.abs(Ot.x)+Math.abs(Ot.y)),Lt=Ot.y>0?1:0,hi=ct.dist(Qe);if(pt+hi>32768&&(pt=0),J){it=bt.sub(Qe)._perp()._unit();let ai=Oy(ct,Qe,bt,Fy(tt,it),J);isNaN(ai)&&(ai=0);const Si=Qe.sub(ct)._unit();ct=ct.add(Si.mult(Ae))._round(),Qe=Qe.add(Si.mult(-ai))._round(),Ae=ai,tt=it,R&&this.zoom>=17&&(K(Le,ct)||Le.push(ct),K(Le,Qe)||Le.push(Qe))}const qt=Se.vertexLength,Zi=ye.length>4&&By(ct,Qe,bt);let Wt=Ny(pt,De,Ze);if(pd(this.layoutVertexArray,ct.x,ct.y,Kt,Lt,0,0,Wt),pd(this.layoutVertexArray,ct.x,ct.y,Kt,Lt,0,1,Wt),this.wallMode){const ai=V(Xe-1,ye),Si=B.joinNormals[Xe-1];md(this.wallVertexArray,Si,ai),md(this.wallVertexArray,Si,ai)}if(pt+=hi,Wt=Ny(pt,Zi,!Ze),De=Zi,pd(this.layoutVertexArray,Qe.x,Qe.y,Kt,Lt,0,0,Wt),pd(this.layoutVertexArray,Qe.x,Qe.y,Kt,Lt,0,1,Wt),this.wallMode){const ai=V(Xe,ye),Si=B.joinNormals[Xe];md(this.wallVertexArray,Si,ai),md(this.wallVertexArray,Si,ai)}if(Se.vertexLength+=4,this.indexArray.emplaceBack(qt+0,qt+1,qt+2),this.indexArray.emplaceBack(qt+1,qt+3,qt+2),Se.primitiveLength+=2,J){const ai=Ee+(Xe===1?ye.length-2:Xe-2),Si=Xe===1?Ee:ai+1;if(this.indexArray.emplaceBack(qt+1,ai,qt+3),this.indexArray.emplaceBack(ai,Si,qt+3),Se.primitiveLength+=2,ze===void 0&&(ze=qt),!T_(bt,ye[Xe],se)){const Li=Xe===ye.length-1?ze:Se.vertexLength;this.indexArray.emplaceBack(qt+2,qt+3,Li),this.indexArray.emplaceBack(qt+3,Li+1,Li),this.indexArray.emplaceBack(qt+3,Si,Li+1),Se.primitiveLength+=3}Ze=!Ze}if(E){const ai=this.layoutVertexExtArray,Si=w.projectTilePoint(ct.x,ct.y,u),Li=w.projectTilePoint(Qe.x,Qe.y,u),Fi=w.upVector(u,ct.x,ct.y),Wi=w.upVector(u,Qe.x,Qe.y);_d(ai,Si,Fi),_d(ai,Si,Fi),_d(ai,Li,Wi),_d(ai,Li,Wi)}}I&&(Ee+=ye.length-1),R&&J&&this.zoom>=17&&(Le.length!==0&&K(Le,Le[0])&&Le.pop(),this.groundEffect.addData(Le,se,v,J>0))}this.footprintSegments.push(Ce),Re.triangleCount=this.indexArray.length-Re.triangleArrayOffset,this.polygonSegments.push(Re),++D.footprintSegLen,++D.polygonSegLen}if(D.vertexCount=this.layoutVertexArray.length-D.vertexArrayOffset,D.groundVertexCount=this.groundEffect.vertexArray.length-D.groundVertexArrayOffset,D.vertexCount!==0){if(D.centroidXY=P.borders?Py:this.encodeCentroid(P,D),this.centroidData.push(D),P.borders){this.featuresOnBorder.push(P);const re=this.featuresOnBorder.length-1;for(let se=0;se<P.borders.length;se++)P.borders[se][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[se].push(re)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,a,h,f,u,g,void 0,this.worldview),this.groundEffect.addPaintPropertiesData(i,a,h,f,u,g,this.worldview),this.maxHeight=Math.max(this.maxHeight,F)}}sortBorders(){for(let e=0;e<this.borderFeatureIndices.length;e++)this.borderFeatureIndices[e].sort((i,n)=>this.featuresOnBorder[i].borders[e][0]-this.featuresOnBorder[n].borders[e][0])}splitToSubtiles(){const e=[];for(let f=0;f<this.centroidData.length;f++){const _=this.centroidData[f],g=+(_.min.y+_.max.y>We),v=2*g+(+(_.min.x+_.max.x>We)^g);for(let b=0;b<_.polygonSegLen;b++){const w=_.polygonSegIdx+b;e.push({centroidIdx:f,subtile:v,polygonSegmentIdx:w,triangleSegmentIdx:this.polygonSegments[w].triangleSegIdx})}}const i=new hr;e.sort((f,_)=>f.triangleSegmentIdx===_.triangleSegmentIdx?f.subtile-_.subtile:f.triangleSegmentIdx-_.triangleSegmentIdx);let n=0,a=0,u=0;for(const f of e){if(f.triangleSegmentIdx!==n)break;u++}const h=e.length;for(;a!==e.length;){n=e[a].triangleSegmentIdx;let f=0,_=a,g=a;for(let v=_;v<u&&e[v].subtile===f;v++)g++;for(;_!==u;){const v=e[_];f=v.subtile;const b=this.centroidData[v.centroidIdx].min.clone(),w=this.centroidData[v.centroidIdx].max.clone(),E={vertexOffset:this.segments.segments[n].vertexOffset,primitiveOffset:i.length,vertexLength:this.segments.segments[n].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let I=_;I<g;I++){const P=e[I],D=this.polygonSegments[P.polygonSegmentIdx],R=this.centroidData[P.centroidIdx].min,F=this.centroidData[P.centroidIdx].max,B=this.indexArray.uint16;for(let V=D.triangleArrayOffset;V<D.triangleArrayOffset+D.triangleCount;V++)i.emplaceBack(B[3*V],B[3*V+1],B[3*V+2]);E.primitiveLength+=D.triangleCount,b.x=Math.min(b.x,R.x),b.y=Math.min(b.y,R.y),w.x=Math.max(w.x,F.x),w.y=Math.max(w.y,F.y)}E.primitiveLength>0&&this.triangleSubSegments.push({segment:E,min:b,max:w}),_=g;for(let I=_;I<u&&e[I].subtile===e[_].subtile;I++)g++}a=u;for(let v=a;v<h&&e[v].triangleSegmentIdx===e[a].triangleSegmentIdx;v++)u++}i._trim(),this.indexArray=i}getVisibleSegments(e,i,n){const a=new Ci;if(this.wallMode){for(const P of this.triangleSubSegments)a.segments.push(P.segment);return a}let u=0,h=0;const f=1<<e.canonical.z;if(i){const P=i.getMinMaxForTile(e);P&&(u=P.min,h=P.max)}h+=this.maxHeight;const _=e.toUnwrapped();let g;const v=[_.canonical.x/f+_.wrap,_.canonical.y/f],b=[(_.canonical.x+1)/f+_.wrap,(_.canonical.y+1)/f],w=(P,D,R)=>[P[0]*(1-R[0])+D[0]*R[0],P[1]*(1-R[1])+D[1]*R[1]],E=[],I=[];for(const P of this.triangleSubSegments){E[0]=P.min.x/We,E[1]=P.min.y/We,I[0]=P.max.x/We,I[1]=P.max.y/We;const D=w(v,b,E),R=w(v,b,I);if(new ei([D[0],D[1],u],[R[0],R[1],h]).intersectsPrecise(n)===0){g&&(a.segments.push(g),g=void 0);continue}const F=P.segment;g&&g.vertexOffset!==F.vertexOffset&&(a.segments.push(g),g=void 0),g?(g.vertexLength+=F.vertexLength,g.primitiveLength+=F.primitiveLength):g={vertexOffset:F.vertexOffset,primitiveLength:F.primitiveLength,vertexLength:F.vertexLength,primitiveOffset:F.primitiveOffset,sortKey:void 0,vaos:{}}}return g&&a.segments.push(g),a}encodeCentroid(e,i){const n=e.centroid(),a=i.span(),u=Math.min(7,Math.round(a.x*this.tileToMeter/10)),h=Math.min(7,Math.round(a.y*this.tileToMeter/10));return new Be(Y(n.x,1,8191)<<3|u,Y(n.y,1,8191)<<3|h)}encodeBorderCentroid(e){if(!e.borders)return new Be(0,0);const i=e.borders,n=Number.MAX_VALUE;if(i[0][0]!==n||i[1][0]!==n){const a=i[0][0]!==n?0:1;return new Be(6|(i[0][0]!==n?0:65528),(i[a][0]+i[a][1])/2<<3|6)}{const a=i[2][0]!==n?2:3;return new Be((i[a][0]+i[a][1])/2<<3|6,6|(i[2][0]!==n?0:65528))}}showCentroid(e){const i=this.centroidData[e.centroidDataIndex];i.flags&=2147483647,i.centroidXY.x=0,i.centroidXY.y=0,this.writeCentroidToBuffer(i)}writeCentroidToBuffer(e){this.groundEffect.updateHiddenByLandmark(e);const i=e.vertexArrayOffset,n=e.vertexCount+e.vertexArrayOffset,a=e.flags&na?Py:e.centroidXY,u=this.centroidVertexArray.geta_centroid_pos0(i);if(this.centroidVertexArray.geta_centroid_pos1(i)!==a.y||u!==a.x){for(let h=i;h<n;++h)this.centroidVertexArray.emplace(h,a.x,a.y);this.needsCentroidUpdate=!0}}createCentroidsBuffer(){this.centroidVertexArray.resize(this.layoutVertexArray.length),this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const e of this.centroidData)this.writeCentroidToBuffer(e)}updateReplacement(e,i,n){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const a=i.getReplacementRegionsForTile(e.toUnwrapped());if(Dp(this.activeReplacements,a))return;if(this.activeReplacements=a,this.centroidVertexArray.length===0)this.createCentroidsBuffer();else for(const h of this.centroidData)h.flags&=2147483647;const u=[];for(const h of this.activeReplacements){if(h.order<n)continue;const f=Math.max(1,Math.pow(2,h.footprintTileId.canonical.z-e.canonical.z));if(h.footprint.buildingIds)for(const _ of this.centroidData)_.flags&na||h.min.x>_.max.x||_.min.x>h.max.x||h.min.y>_.max.y||_.min.y>h.max.y||h.footprint.buildingIds.has(_.buildingId)&&(_.flags|=na);else for(const _ of this.centroidData)if(!(_.flags&na||h.min.x>_.max.x||_.min.x>h.max.x||h.min.y>_.max.y||_.min.y>h.max.y))for(let g=0;g<_.footprintSegLen;g++){const v=this.footprintSegments[_.footprintSegIdx+g];if(u.length=0,tb(this.footprintVertices,v.vertexOffset,v.vertexCount,h.footprintTileId.canonical,e.canonical,u),x_(h.footprint,u,this.footprintIndices.uint16,v.indexOffset,v.indexCount,-v.vertexOffset,-f)){_.flags|=na;break}}}for(const h of this.centroidData)this.writeCentroidToBuffer(h);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(e,i,n){let a=!1;for(let u=0;u<n.footprintSegLen;u++){const h=this.footprintSegments[n.footprintSegIdx+u];let f=0;for(const _ of h.ringIndices){for(let g=f,v=_+f-1;g<_+f;v=g++){const b=this.footprintVertices.int16[2*(g+h.vertexOffset)+0],w=this.footprintVertices.int16[2*(g+h.vertexOffset)+1],E=this.footprintVertices.int16[2*(v+h.vertexOffset)+1];w>i!=E>i&&e<(this.footprintVertices.int16[2*(v+h.vertexOffset)+0]-b)*(i-w)/(E-w)+b&&(a=!a)}f=_}}return a}getHeightAtTileCoord(e,i){let n=Number.NEGATIVE_INFINITY,a=!0;const u=4*(e+We)*We+(i+We);if(this.partLookup.hasOwnProperty(u)){const h=this.partLookup[u];return h?{height:h.height,hidden:!!(h.flags&na)}:void 0}for(const h of this.centroidData)e>h.max.x||h.min.x>e||i>h.max.y||h.min.y>i||h.height<=n||this.footprintContainsPoint(e,i,h)&&(n=h.height,this.partLookup[u]=h,a=!!(h.flags&na));if(n!==Number.NEGATIVE_INFINITY)return{height:n,hidden:a};this.partLookup[u]=void 0}}function Fy(r,e){const i=r.add(e)._unit();return r.x*i.x+r.y*i.y}function Q1(r,e,i,n){const a=e.sub(r)._perp()._unit(),u=i.sub(e)._perp()._unit();return Oy(r,e,i,Fy(a,u),n)}function Oy(r,e,i,n,a){const u=Math.sqrt(1-n*n);return Math.min(r.dist(e)/3,e.dist(i)/3,a*u/n)}function T_(r,e,i){return r.x<i[0].x&&e.x<i[0].x||r.x>i[1].x&&e.x>i[1].x||r.y<i[0].y&&e.y<i[0].y||r.y>i[1].y&&e.y>i[1].y}function ky(r,e){return r.x<e[0].x||r.x>e[1].x||r.y<e[0].y||r.y>e[1].y}function eb(r){return r.every(e=>e.x<=0)||r.every(e=>e.x>=We)||r.every(e=>e.y<=0)||r.every(e=>e.y>=We)}function By(r,e,i){if(r.x<0||r.x>=We||e.x<0||e.x>=We||i.x<0||i.x>=We)return!1;const n=i.sub(e),a=n.perp(),u=r.sub(e);return(n.x*u.x+n.y*u.y)/Math.sqrt((n.x*n.x+n.y*n.y)*(u.x*u.x+u.y*u.y))>-.866&&a.x*u.x+a.y*u.y<0}function Ny(r,e,i){const n=e?2|r:-3&r;return i?1|n:-2&n}function Vy(){const r=Math.PI/32,e=Math.tan(r),i=te;return i*Math.sqrt(1+2*e*e)-i}function Uy(r,e,i){const n=1<<i.z,a=Me(i.x/n),u=Me((i.x+1)/n),h=Fe(i.y/n),f=Fe((i.y+1)/n);return(function(_,g,v,b,w=0,E){const I=[];if(!_.length||!v||!b)return I;const P=(H,J)=>{for(const ee of H)I.push({polygon:ee,bounds:J})},D=Math.ceil(Math.log2(v)),R=Math.ceil(Math.log2(b)),F=D-R,B=[];for(let H=0;H<Math.abs(F);H++)B.push(F>0?0:1);for(let H=0;H<Math.min(D,R);H++)B.push(0),B.push(1);let V=_;if(V=Pp(V,g[0].y-w,g[1].y+w,1),V=Pp(V,g[0].x-w,g[1].x+w,0),!V.length)return I;const $=[];for(B.length?$.push({polygons:V,bounds:g,depth:0}):P(V,g);$.length;){const H=$.pop(),J=H.depth,ee=B[J],K=H.bounds[0],re=H.bounds[1],se=ee===0?K.x:K.y,Ee=ee===0?re.x:re.y,we=E?E(ee,se,Ee):.5*(se+Ee),Se=Pp(H.polygons,se-w,we+w,ee),Re=Pp(H.polygons,we-w,Ee+w,ee);if(Se.length){const Ce=[K,new Be(ee===0?we:re.x,ee===1?we:re.y)];B.length>J+1?$.push({polygons:Se,bounds:Ce,depth:J+1}):P(Se,Ce)}if(Re.length){const Ce=[new Be(ee===0?we:K.x,ee===1?we:K.y),re];B.length>J+1?$.push({polygons:Re,bounds:Ce,depth:J+1}):P(Re,Ce)}}return I})(r,e,Math.ceil((u-a)/11.25),Math.ceil((h-f)/11.25),1,(_,g,v)=>{if(_===0)return .5*(g+v);{const b=Fe((i.y+g/We)/n);return(ve(.5*(Fe((i.y+v/We)/n)+b))*n-i.y)*We}})}function tb(r,e,i,n,a,u){const h=Math.pow(2,n.z-a.z);for(let f=0;f<i;f++){let _=r.int16[2*(f+e)+0],g=r.int16[2*(f+e)+1];_=(_+a.x*We)*h-n.x*We,g=(g+a.y*We)*h-n.y*We,u.push(new Be(_,g))}}let jy,Gy;nt(Fp,"FillExtrusionBucket",{omit:["layers","features"]}),nt(zy,"PartData"),nt(Ry,"FootprintSegment"),nt(Dy,"BorderCentroidData"),nt(w_,"GroundEffect");class Jl extends Be{constructor(e,i,n){super(e,i),this.z=n}}class qy extends Jl{constructor(e,i,n,a){super(e,i,n),this.w=a}}function Hy(r,e,i,n){const a=i==="x"?"y":"x",u=(n-r[i])/(e[i]-r[i]);r[a]=Math.round(r[a]+(e[a]-r[a])*u),r[i]=n,r.hasOwnProperty("z")&&(r.z=_t(r.z,e.z,u)),r.hasOwnProperty("w")&&(r.w=_t(r.w,e.w,u))}function $y(r,e,i,n){const a=i,u=n;for(const h of["x","y"]){let f=r,_=e;f[h]>=_[h]&&(f=e,_=r),f[h]<a&&_[h]>a&&Hy(f,_,h,a),f[h]<u&&_[h]>u&&Hy(_,f,h,u)}}function Op(r,e,i,n,a,u){const h=[];for(let f=0;f<r.length;f++){const _=r[f];let g;const v=h.length;let b=0;for(let w=0;w<_.length-1;w++){let E=_[w],I=_[w+1],P=0;const D=b;let R,F;u&&(P=Math.hypot(I.x-E.x,I.y-E.y),b+=P,R=E,F=I),E.x<e&&I.x<e||(E.x<e?E=new Be(e,E.y+(e-E.x)/(I.x-E.x)*(I.y-E.y))._round():I.x<e&&(I=new Be(e,E.y+(e-E.x)/(I.x-E.x)*(I.y-E.y))._round()),E.y<i&&I.y<i||(E.y<i?E=new Be(E.x+(i-E.y)/(I.y-E.y)*(I.x-E.x),i)._round():I.y<i&&(I=new Be(E.x+(i-E.y)/(I.y-E.y)*(I.x-E.x),i)._round()),E.x>=n&&I.x>=n||(E.x>=n?E=new Be(n,E.y+(n-E.x)/(I.x-E.x)*(I.y-E.y))._round():I.x>=n&&(I=new Be(n,E.y+(n-E.x)/(I.x-E.x)*(I.y-E.y))._round()),E.y>=a&&I.y>=a||(E.y>=a?E=new Be(E.x+(a-E.y)/(I.y-E.y)*(I.x-E.x),a)._round():I.y>=a&&(I=new Be(E.x+(a-E.y)/(I.y-E.y)*(I.x-E.x),a)._round()),g&&E.equals(g[g.length-1])||(g=[E],h.push(g),u&&u.push({progress:{min:D+Zy(R,F,E)*P,max:1},parentIndex:f,prevPoint:R,nextPoint:F})),g.push(I),u&&(u[u.length-1].progress.max=D+Zy(R,F,I)*P,u[u.length-1].nextPoint=F)))))}if(u&&b>0)for(let w=v;w<h.length;w++)u[w].progress.min/=b,u[w].progress.max/=b}return h}function ib(r,e,i,n,a){if(r.length<2)return void n.push(r);const u=[];for(;e.valid();){const[g,v]=e.get();for(let b=0;b<r.length-1;b++){const w=r[b],E=r[b+1],I=Xl(w,E,g,v);if(I){const[P]=I,D=new Be(_t(w.x,E.x,P),_t(w.y,E.y,P));u.push({t:b+P,distance:0,point:D})}}e.next()}if(u.length===0)return void n.push(r);u.sort((g,v)=>g.t-v.t);let h=0,f=0,_=[];for(n.push(_);h!==r.length;){if(f===u.length){for(;h!==r.length;)_.length!==0&&_[_.length-1].equals(r[h])||_.push(r[h]),h++;break}u[f].t<=h?(_.length!==0&&_[_.length-1].equals(u[f].point)||_.push(u[f].point),Math.trunc(u[f].t),f++):(_.length!==0&&_[_.length-1].equals(r[h])||_.push(r[h]),h++)}}function Zy(r,e,i){return r.x!==e.x?(i.x-r.x)/(e.x-r.x):r.y!==e.y?(i.y-r.y)/(e.y-r.y):0}function gd(r,e){return r.x*e.x+r.y*e.y}function Wy(r,e){if(r.length===1){let i=0;const n=e[i++];let a;for(;!a||n.equals(a);)if(a=e[i++],!a)return 1/0;for(;i<e.length;i++){const u=e[i],h=r[0],f=a.sub(n),_=u.sub(n),g=h.sub(n),v=gd(f,f),b=gd(f,_),w=gd(_,_),E=gd(g,f),I=gd(g,_),P=v*w-b*b,D=(w*E-b*I)/P,R=(v*I-b*E)/P,F=n.z*(1-D-R)+a.z*D+u.z*R;if(isFinite(F))return F}return 1/0}{let i=1/0;for(const n of e)i=Math.min(i,n.z);return i}}function Xy(r,e,i){let n=1/0;yi(i,e)&&(n=Wy(i,e[0]));for(let a=0;a<e.length;a++){const u=e[a],h=r[a];for(let f=0;f<u.length-1;f++){const _=u[f],g=[_,u[f+1],h[f+1],h[f],_];Di(i,g)&&(n=Math.min(n,Wy(i,g)))}}return n!==1/0&&n}function Yy(r,e,i,n,a,u,h,f,_,g,v){return r.projection.name==="globe"?(function(b,w,E,I,P,D,R,F,B,V,$){const H=[],J=[],ee=b.projection.upVectorScale($,b.center.lat,b.worldSize).metersToTile,K=[0,0,0,1],re=[0,0,0,1],se=(we,Se,Re,Ce)=>{we[0]=Se,we[1]=Re,we[2]=Ce,we[3]=1},Ee=Vy();E>0&&(E+=Ee),I+=Ee;for(const we of w){const Se=[],Re=[];for(const Ce of we){const Pe=Ce.x+P.x,ye=Ce.y+P.y,De=b.projection.projectTilePoint(Pe,ye,$),Ae=b.projection.upVector($,Ce.x,Ce.y);let Le=E,ze=I;if(R){const tt=Ky(Pe,ye,E,I,R,F,B,V);Le+=tt.base,ze+=tt.top}E!==0?se(K,De.x+Ae[0]*ee*Le,De.y+Ae[1]*ee*Le,De.z+Ae[2]*ee*Le):se(K,De.x,De.y,De.z),se(re,De.x+Ae[0]*ee*ze,De.y+Ae[1]*ee*ze,De.z+Ae[2]*ee*ze),Qi(K,K,D),Qi(re,re,D),Se.pu
8sh(new Jl(K[0],K[1],K[2])),Re.push(new Jl(re[0],re[1],re[2]))}H.push(Se),J.push(Re)}return[H,J]})(r,e,i,n,a,u,h,f,_,g,v):h?(function(b,w,E,I,P,D,R,F,B){const V=[],$=[],H=[0,0,0,1];for(const J of b){const ee=[],K=[];for(const re of J){const se=re.x+I.x,Ee=re.y+I.y,we=Ky(se,Ee,w,E,D,R,F,B);H[0]=se,H[1]=Ee,H[2]=we.base,H[3]=1,an(H,H,P),H[3]=Math.max(H[3],1e-5);const Se=new Jl(H[0]/H[3],H[1]/H[3],H[2]/H[3]);H[0]=se,H[1]=Ee,H[2]=we.top,H[3]=1,an(H,H,P),H[3]=Math.max(H[3],1e-5);const Re=new Jl(H[0]/H[3],H[1]/H[3],H[2]/H[3]);ee.push(Se),K.push(Re)}V.push(ee),$.push(K)}return[V,$]})(e,i,n,a,u,h,f,_,g):(function(b,w,E,I,P){const D=[],R=[],F=P[8]*w,B=P[9]*w,V=P[10]*w,$=P[11]*w,H=P[8]*E,J=P[9]*E,ee=P[10]*E,K=P[11]*E;for(const re of b){const se=[],Ee=[];for(const we of re){const Se=we.x+I.x,Re=we.y+I.y,Ce=P[0]*Se+P[4]*Re+P[12],Pe=P[1]*Se+P[5]*Re+P[13],ye=P[2]*Se+P[6]*Re+P[14],De=P[3]*Se+P[7]*Re+P[15],Ae=Ce+F,Le=Pe+B,ze=ye+V,tt=Math.max(De+$,1e-5),it=Ce+H,Ze=Pe+J,Xe=ye+ee,pt=Math.max(De+K,1e-5);se.push(new Jl(Ae/tt,Le/tt,ze/tt)),Ee.push(new Jl(it/pt,Ze/pt,Xe/pt))}D.push(se),R.push(Ee)}return[D,R]})(e,i,n,a,u)}function Ky(r,e,i,n,a,u,h,f){const _=h*a.getElevationAt(r,e,!0,!0),g=u[0]!==0,v=g?u[1]===0?h*(u[0]/7-450):h*(function(b,w,E){const I=Math.floor(w[0]/8),P=Math.floor(w[1]/8),D=10*(w[0]-8*I),R=10*(w[1]-8*P),F=b.getElevationAt(I,P,!0,!0),B=b.getMeterToDEM(E),V=Math.floor(.5*(D*B-1)),$=Math.floor(.5*(R*B-1)),H=b.tileCoordToPixel(I,P),J=2*V+1,ee=2*$+1,K=(function(Re,Ce,Pe,ye,De){return[Re.getElevationAtPixel(Ce,Pe,!0),Re.getElevationAtPixel(Ce+De,Pe,!0),Re.getElevationAtPixel(Ce,Pe+De,!0),Re.getElevationAtPixel(Ce+ye,Pe+De,!0)]})(b,H.x-V,H.y-$,J,ee),re=Math.abs(K[0]-K[1]),se=Math.abs(K[2]-K[3]),Ee=Math.abs(K[0]-K[2])+Math.abs(K[1]-K[3]),we=Math.min(.25,.5*B*(re+se)/J),Se=Math.min(.25,.5*B*Ee/ee);return F+Math.max(we*D,Se*R)})(a,u,f):_;return{base:_+(i===0?-1:i),top:g?Math.max(v+n,_+i+2):_+n}}class rb{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel<"u"&&(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(){this._channel=void 0,this._callback=()=>{}}}class nb{constructor(){this.tasks={},this.taskQueue=[],rt(["process"],this),this.invoker=new rb(this.process),this.nextId=0}add(e,i){const n=this.nextId++,a=(function({type:u,isSymbolTile:h,zoom:f}){return f=f||0,u==="message"?0:u!=="maybePrepare"||h?u!=="parseTile"||h?u==="parseTile"&&h?300-f:u==="maybePrepare"&&h?400-f:500:200-f:100-f})(i);return a===0?(e(),null):(this.tasks[n]={fn:e,metadata:i,priority:a,id:n},this.taskQueue.push(n),this.invoker.trigger(),{cancel:()=>{delete this.tasks[n]}})}process(){{if(this.taskQueue=this.taskQueue.filter(n=>!!this.tasks[n]),!this.taskQueue.length)return;const e=this.pick();if(e===null)return;const i=this.tasks[e];if(delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),!i)return;i.fn()}}pick(){let e=null,i=1/0;for(let a=0;a<this.taskQueue.length;a++){const u=this.tasks[this.taskQueue[a]];u.priority<i&&(i=u.priority,e=a)}if(e===null)return null;const n=this.taskQueue[e];return this.taskQueue.splice(e,1),n}remove(){this.invoker.remove()}}class Jy{constructor(e,i,n){this.target=e,this.parent=i,this.mapId=n,this.callbacks={},this.cancelCallbacks={},rt(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler=new nb}send(e,i,n,a,u=!1,h){const f=Math.round(1e18*Math.random()).toString(36).substring(0,10);n&&(n.metadata=h,this.callbacks[f]=n);const _=new Set;return this.target.postMessage({id:f,type:e,hasCallback:!!n,targetMapId:a,mustQueue:u,sourceMapId:this.mapId,data:no(i,_)},_),{cancel:()=>{n&&delete this.callbacks[f],this.target.postMessage({id:f,type:"<cancel>",targetMapId:a,sourceMapId:this.mapId})}}}receive(e){const i=e.data;if(!i)return;const n=i.id;if(n&&(!i.targetMapId||this.mapId===i.targetMapId))if(i.type==="<cancel>"){const a=this.cancelCallbacks[n];delete this.cancelCallbacks[n],a&&a.cancel()}else if(i.mustQueue||Hi(self)){const a=this.callbacks[n],u=this.scheduler.add(()=>this.processTask(n,i),a&&a.metadata||{type:"message"});u&&(this.cancelCallbacks[n]=u)}else this.processTask(n,i)}processTask(e,i){if(delete this.cancelCallbacks[e],i.type==="<response>"){const n=this.callbacks[e];delete this.callbacks[e],n&&(i.error?n(Ho(i.error)):n(null,Ho(i.data)))}else{const n=new Set,a=i.hasCallback?(h,f)=>{this.target.postMessage({id:e,type:"<response>",sourceMapId:this.mapId,error:h?no(h):null,data:no(f,n)},n)}:()=>{},u=Ho(i.data);if(this.parent[i.type])this.parent[i.type](i.sourceMapId,u,a);else if(this.parent.getWorkerSource){const h=i.type.split("."),{source:f,scope:_}=u;this.parent.getWorkerSource(i.sourceMapId,h[0],f,_)[h[1]](u,a)}else a(new Error(`Could not find function ${i.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}var yd={workerUrl:"",workerClass:null,workerParams:void 0};function ob(r){return yd.workerClass!=null?new yd.workerClass:new self.Worker(yd.workerUrl,Object.assign({name:r},yd.workerParams))}const S_="mapboxgl_preloaded_worker_pool";class Ql{constructor(e){this.active={},this.name=e}acquire(e,i=Ql.workerCount){if(!this.workers)for(this.workers=[];this.workers.length<i;){const n=ob(`${this.name||""}WorkerPool: ${e}-${this.workers.length}`);this.workers.push(n)}return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.workers&&this.numActive()===0&&(this.workers.forEac
8h(i=>{i.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[S_]}numActive(){return Object.keys(this.active).length}}Ql.workerCount=2;class fu{constructor(e,i,n="Worker",a=Ql.workerCount){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=Ne();const u=this.workerPool.acquire(this.id,a);for(let h=0;h<u.length;h++){const f=new fu.Actor(u[h],i,this.id);f.name=`${n} ${h}`,this.actors.push(f)}this.ready=!1,this.broadcast("checkIfReady",null,()=>{this.ready=!0})}broadcast(e,i,n){ue(this.actors,(a,u)=>{a.send(e,i,u)},n=n||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(e=>{e.remove()}),this.actors=[],this.workerPool.release(this.id)}}let xd,E_;function kp(){return xd||(xd=new Ql),xd}fu.Actor=Jy;const I_=4096;class sb{constructor(e){this.module=e,this.memoryStack=this.module.malloc(I_),this.memoryStackNextFree=this.memoryStack}createIntArray(e){const i=this.memoryStackNextFree;return this.memoryStackNextFree+=e.length*Int32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>I_?-1:(new Int32Array(this.module.heap32.buffer,i,e.length).set(e),i)}createFloatArray(e){const i=this.memoryStackNextFree;return this.memoryStackNextFree+=e.length*Float32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>I_?-1:(new Float32Array(this.module.heapF32.buffer,i,e.length).set(e),i)}readStringBuffer(e){let i="";for(;this.module.heapU8[e]!==0;)i+=String.fromCharCode(this.module.heapU8[e]),++e;return i}setStyle(e){const i=e.normalScale;this.module.setStyle(i[0],i[1],i[2],e.tileToMeters)}setAOOptions(e,i){this.module.setAOOptions(e?1:0,i)}setMetricOptions(e,i){this.module.setMetricOptions(e?1:0,i)}setStructuralOptions(e){this.module.setStructuralOptions(e?1:0)}setFacadeOptions(e,i){this.module.setFacadeOptions(e,i?1:0)}setFauxFacadeOptions(e,i,n){this.module.setFauxFacadeOptions(e?1:0,i?1:0,n)}setFacadeClassifierOptions(e){this.module.setFacadeClassifierOptions(e)}generateMesh(e,i){this.memoryStackNextFree=this.memoryStack;for(const f of e){const _=this.createIntArray(f.ringIndices),g=this.createFloatArray(f.coordinates);if(_===-1||g===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFeature(f.id,f.sourceId,f.minHeight,f.height,f.roofType,g,_,f.ringIndices.length-1)}for(const f of i){let _;_=f.entrances?JSON.parse(f.entrances):[];const g=this.createFloatArray(_),v=this.createFloatArray(f.coordinates);if(g===-1||v===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFacade(f.sourceId,f.crossPerc,f.distanceToRoad,g,_.length,v,f.coordinates.length)}if(!this.module.generateMesh()){const f=this.module.getLastError();return this.readStringBuffer(f)}const n=this.module.getMeshCount(),a=new Array(n);for(let f=0;f<n;f++){const _=this.module.getPositionsPtr(f),g=this.module.getPositionsLength(f),v=new Float32Array(this.module.heapF32.buffer,_,g),b=this.module.getNormalsPtr(f),w=this.module.getNormalsLength(f),E=new Float32Array(this.module.heapF32.buffer,b,w),I=this.module.getAOPtr(f),P=this.module.getAOLength(f),D=new Float32Array(this.module.heapF32.buffer,I,P),R=this.module.getUVPtr(f),F=this.module.getUVLength(f),B=new Float32Array(this.module.heapF32.buffer,R,F),V=this.module.getFauxFacadePtr(f),$=this.module.getFauxFacadeLength(f),H=new Uint8Array(this.module.heapU8.buffer,V,$),J=this.module.getIndicesPtr(f),ee=this.module.getIndicesLength(f),K=new Int16Array(this.module.heap16.buffer,J,ee),re=this.module.getBuildingPart(f);a[f]={positions:v,normals:E,ao:D,uv:B,isFauxFacade:H,indices:K,buildingPart:re}}const u=this.module.getRingCount(),h=[];for(let f=0;f<u;f++){const _=this.module.getRingPtr(f),g=this.module.getRingLength(f),v=new Float32Array(this.module.heapF32.buffer,_,g);h.push(v)}return{meshes:a,outerRingLength:this.module.getOuterRingLength(),modifiedPolygonRings:h}}}let vd,A_,Xo,pu,M_,mu=null,_u=null,Qy=null,Bp=null;function ex(){return Hi(self)&&self.worker.dracoUrl?self.worker.dracoUrl:A_||cr.DRACO_URL}function tx(){if(Hi(self)&&self.worker.meshoptUrl)return self.worker.meshoptUrl;if(pu)return pu;
8const r=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]);if(typeof WebAssembly!="object")throw new Error("WebAssembly not supported, cannot instantiate meshoptimizer");return pu=WebAssembly.validate(r)?cr.MESHOPT_SIMD_URL:cr.MESHOPT_URL,pu}function ab(){return Bp}const ix=5120,rx=5121,nx=5122,ox=5123,sx=5125,ax=5126,Np={[ix]:Int8Array,[rx]:Uint8Array,[nx]:Int16Array,[ox]:Uint16Array,[sx]:Uint32Array,[ax]:Float32Array},lb={[ix]:"DT_INT8",[rx]:"DT_UINT8",[nx]:"DT_INT16",[ox]:"DT_UINT16",[sx]:"DT_UINT32",[ax]:"DT_FLOAT32"},bd={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function lx(r,e,i){const n=i.json.bufferViews.length,a=i.buffers.length;e.bufferView=n,i.json.bufferViews[n]={buffer:a,byteLength:r.byteLength},i.buffers[a]=r}const C_="KHR_draco_mesh_compression";function cb(r,e){const i=r.extensions&&r.extensions[C_];if(!i)return;const n=new Xo.Decoder,a=dx(e,i.bufferView),u=new Xo.Mesh;if(!n.DecodeArrayToMesh(a,a.byteLength,u))throw new Error("Failed to decode Draco mesh");const h=e.json.accessors[r.indices],f=Np[h.componentType],_=h.count*f.BYTES_PER_ELEMENT,g=Xo._malloc(_);f===Uint16Array?n.GetTrianglesUInt16Array(u,_,g):n.GetTrianglesUInt32Array(u,_,g),lx(Xo.memory.buffer.slice(g,g+_),h,e),Xo._free(g);for(const v of Object.keys(i.attributes)){const b=n.GetAttributeByUniqueId(u,i.attributes[v]),w=e.json.accessors[r.attributes[v]],E=lb[w.componentType],I=w.count*bd[w.type]*Np[w.componentType].BYTES_PER_ELEMENT,P=Xo._malloc(I);n.GetAttributeDataArrayForAllPoints(u,b,Xo[E],I,P),lx(Xo.memory.buffer.slice(P,P+I),w,e),Xo._free(P)}n.destroy(),u.destroy(),delete r.extensions[C_]}const Vp="EXT_meshopt_compression";function ub(r,e){if(!r.extensions||!r.extensions[Vp])return;const i=r.extensions[Vp],n=new Uint8Array(e.buffers[i.buffer],i.byteOffset||0,i.byteLength||0),a=new Uint8Array(i.count*i.byteStride);M_.decodeGltfBuffer(a,i.count,i.byteStride,n,i.mode,i.filter),r.buffer=e.buffers.length,r.byteOffset=0,e.buffers[r.buffer]=a.buffer,delete r.extensions[Vp]}const cx=1179937895,ux=new TextDecoder("utf8");function hx(r,e){return new URL(r,e).href}function hb(r,e,i,n){return fetch(hx(r.uri,n)).then(a=>a.arrayBuffer()).then(a=>{e.buffers[i]=a})}function dx(r,e){const i=r.json.bufferViews[e];return new Uint8Array(r.buffers[i.buffer],i.byteOffset||0,i.byteLength)}function db(r,e,i,n){if(r.uri){const a=hx(r.uri,n);return fetch(a).then(u=>u.blob()).then(u=>createImageBitmap(u)).then(u=>{e.images[i]=u})}if(r.bufferView!==void 0){const a=dx(e,r.bufferView),u=new Blob([a],{type:r.mimeType});return createImageBitmap(u).then(h=>{e.images[i]=h})}}function fx(r,e=0,i){const n={json:null,images:[],buffers:[]};if(new Uint32Array(r,e,1)[0]===cx){const v=new Uint32Array(r,e);let b=2;const w=(v[b++]>>2)-3,E=v[b++]>>2;if(b++,n.json=JSON.parse(ux.decode(v.subarray(b,b+E))),b+=E,b<w){const I=v[b++];b++;const P=e+(b<<2);n.buffers[0]=r.slice(P,P+I)}}else n.json=JSON.parse(ux.decode(new Uint8Array(r,e)));const{buffers:a,images:u,meshes:h,extensionsUsed:f,bufferViews:_}=n.json;let g=Promise.resolve();if(a){const v=[];for(let b=0;b<a.length;b++){const w=a[b];w.uri?v.push(hb(w,n,b,i)):n.buffers[b]||(n.buffers[b]=null)}g=Promise.all(v)}return g.then(()=>{const v=[],b=f&&f.includes(C_),w=f&&f.includes(Vp);if(b&&v.push((function(){if(!Xo)return vd??(vd=(function(E){let I,P=null;function D(){I=new Uint8Array(P.buffer)}function R(){throw new Error("Unexpected Draco error.")}const F={a:{a:R,d:function(B,V,$){return I.copyWithin(B,V,V+$)},c:function(B){const V=I.length,$=Math.max(B>>>0,Math.ceil(1.2*V)),H=Math.ceil(($-V)/65536);try{return P.grow(H),D(),!0}catch{return!1}},b:R}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(E,F):E.then(B=>B.arrayBuffer()).then(B=>WebAssembly.instantiate(B,F))).then(B=>{const{Rb:V,Qb:$,P:H,T:J,X:ee,Ja:K,La:re,Qa:se,Va:Ee,Wa:we,eb:Se,jb:Re,f:Ce,e:Pe,yb:ye,zb:De,Ab:Ae,Bb:Le,Db:ze,Gb:tt}=B.instance.exports;P=Pe;const it=(()=>{let Ze=0,Xe=0,pt=0,ct=0;return Qe=>{pt&&(V(ct),V(Ze),Xe+=pt,pt=Ze=0),Ze||(Xe+=128,Ze=$(Xe));const bt=Qe.length+7&-8;let Ot=Ze;bt>=Xe&&(pt=bt,Ot=ct=$(bt));for(let Kt=0;Kt<Qe.length;Kt++)I[Ot+Kt]=Qe[Kt];return Ot}})();return D(),Ce(),{memory:Pe,_free:V,_malloc:$,Mesh:class{constructor(){this.ptr=H()}destroy(){J(this.ptr)}},Decoder:class{constructor(){this.ptr=K()}destroy(){Re(this.ptr)}DecodeArrayToMesh(Ze,Xe,pt){const ct=it(Ze),Qe=re(this.ptr,ct,Xe,pt.ptr);return!!ee(Qe)}GetAttributeByUniqueId(Ze,Xe){return{ptr:se(this.ptr,Ze.ptr,Xe)}}GetTrianglesUInt16Array(Ze,Xe,pt){Ee(this.ptr,Ze.ptr,Xe,pt)}GetTrianglesUInt32Array(Ze,Xe,pt){we(this.ptr,Ze.ptr,Xe,pt)}GetAttributeDataArrayForAllPoints(Ze,Xe,pt,ct,Qe){Se(this.ptr,Ze.ptr,Xe.ptr,pt,ct,Qe)}},DT_INT8:ye(),DT_UINT8:De(),DT_INT16:Ae(),DT_UINT16:Le(),DT_UINT32:ze(),DT_FLOAT32:tt()}})})(fetch(ex())),vd.then(E=>{Xo=E,vd=void 0}))})()),w&&v.push((function(){if(M_)return;const E=(function(I){let P;const D=WebAssembly.instantiateStreaming(I,{}).then(B=>{P=B.instance,P.exports.__wasm_call_ctors()}),R={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},F={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:D,supported:!0,decodeGltfBuffer(B,V,$,H,J,ee){(function(K,re,se,Ee,we,Se,Re){const Ce=K.exports.sbrk,Pe=Ee+3&-4,ye=Ce(Pe*we),De=Ce(Se.length),Ae=new Uint8Array(K.exports.memory.buffer);Ae.set(Se,De);const Le=re(ye,Ee,we,De,Se.length);if(Le===0&&Re&&Re(ye,Pe,we),se.set(Ae.subarray(ye,ye+Ee*we)),Ce(ye-Ce(0)),Le!==0)throw new Error(`Malformed buffer data: ${Le}`)})(P,P.exports[F[J]],B,V,$,H,P.exports[R[ee]])}}})(fetch(tx()));return E.ready.then(()=>{M_=E})})()),u)for(let E=0;E<u.length;
vendor: 12,374 bytes, line 8
8E++)v.push(db(u[E],n,E,i));return(v.length?Promise.all(v):Promise.resolve()).then(()=>{if(b&&h)for(const{primitives:E}of h)for(const I of E)cb(I,n);if(w&&h&&_)for(const E of _)ub(E,n);return n})})}function px(r){return fetch(r).then(e=>e.arrayBuffer()).then(e=>fx(e,0,r))}function P_(r){switch(r){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.RGBA;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.DEPTH_COMPONENT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.DEPTH_STENCIL;case WebGL2RenderingContext.R8:case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.RED}}function R_(r){switch(r){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.UNSIGNED_SHORT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.UNSIGNED_INT_24_8;case WebGL2RenderingContext.R8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.FLOAT}}class z_{constructor(e,i,n,a){this.context=e,this.format=n,this.useMipmap=a&&a.useMipmap,this.texture=e.gl.createTexture(),this.update(i,{premultiply:a&&a.premultiply})}update(e,i){const n=e&&e instanceof HTMLVideoElement&&e.width===0?e.videoWidth:e.width,a=e&&e instanceof HTMLVideoElement&&e.height===0?e.videoHeight:e.height,{context:u}=this,{gl:h}=u,{x:f,y:_}=i&&i.position?i.position:{x:0,y:0},g=f+n,v=_+a;!this.size||this.size[0]===g&&this.size[1]===v||(h.bindTexture(h.TEXTURE_2D,null),h.deleteTexture(this.texture),this.texture=h.createTexture(),this.size=null),h.bindTexture(h.TEXTURE_2D,this.texture),u.pixelStoreUnpackFlipY.set(!1),u.pixelStoreUnpack.set(1),u.pixelStoreUnpackPremultiplyAlpha.set(this.format===h.RGBA8&&(!i||i.premultiply!==!1));const b=e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap;if(!this.size&&g>0&&v>0){const w=this.useMipmap?Math.floor(Math.log2(Math.max(g,v)))+1:1;h.texStorage2D(h.TEXTURE_2D,w,this.format,g,v),this.size=[g,v]}this.size&&(b?h.texSubImage2D(h.TEXTURE_2D,0,f,_,P_(this.format),R_(this.format),e):"data"in e&&e.data&&h.texSubImage2D(h.TEXTURE_2D,0,f,_,n,a,P_(this.format),R_(this.format),e.data)),this.useMipmap&&h.generateMipmap(h.TEXTURE_2D)}bind(e,i,n=!1){const{context:a}=this,{gl:u}=a;u.bindTexture(u.TEXTURE_2D,this.texture),e!==this.minFilter&&(u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,e),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,this.useMipmap&&!n?e===u.NEAREST?u.NEAREST_MIPMAP_NEAREST:u.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),i!==this.wrapS&&(u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,i),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,i),this.wrapS=i)}bindExtraParam(e,i,n,a,u){const{context:h}=this,{gl:f}=h;f.bindTexture(f.TEXTURE_2D,this.texture),i!==this.magFilter&&(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,i),this.magFilter=i),e!==this.minFilter&&(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,this.useMipmap?e===f.NEAREST?f.NEAREST_MIPMAP_NEAREST:f.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),n!==this.wrapS&&(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,n),this.wrapS=n),a!==this.wrapT&&(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,a),this.wrapT=a),u!==this.compareMode&&(u?(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_COMPARE_MODE,f.COMPARE_REF_TO_TEXTURE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_COMPARE_FUNC,u)):f.texParameteri(f.TEXTURE_2D,f.TEXTURE_COMPARE_MODE,f.NONE),this.compareMode=u)}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class wd{constructor(e,i){this.context=e,this.texture=i}bind(e,i){const{context:n}=this,{gl:a}=n;a.bindTexture(a.TEXTURE_2D,this.texture),e!==this.minFilter&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,e),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,e),this.minFilter=e),i!==this.wrapS&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,i),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,i),this.wrapS=i)}}const fb=Nt([{name:"a_pos_3f",components:3,type:"Float32"}]),pb=Nt([{name:"a_color_3f",components:3,type:"Float32"}]),mb=Nt([{name:"a_color_4f",components:4,type:"Float32"}]),_b=Nt([{name:"a_uv_2f",components:2,type:"Float32"}]),gb=Nt([{name:"a_normal_3f",components:3,type:"Float32"}]),yb=Nt([{name:"a_normal_matrix0",components:4,type:"Float32"},{name:"a_normal_matrix1",components:4,type:"Float32"},{name:"a_normal_matrix2",components:4,type:"Float32"},{name:"a_normal_matrix3",components:4,type:"Float32"}]),xb=Nt([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function mx(r,e){const i=Up(r.projection,r.zoom,r.width,r.height),n=(function(u,h,f,_,g){const v=new Z(f.lng-180*Xa,f.lat),b=new Z(f.lng+180*Xa,f.lat),w=u.project(v.lng,v.lat),E=u.project(b.lng,b.lat),I=-Math.atan2(E.y-w.y,E.x-w.x),P=Ke.fromLngLat(f);P.y=Y(P.y,-1+Xa,1-Xa);const D=P.toLngLat(),R=u.project(D.lng,D.lat),F=Ke.fromLngLat(D);F.x+=Xa;const B=F.toLngLat(),V=u.project(B.lng,B.lat),$=gx(V.x-R.x,V.y-R.y,I),H=Ke.fromLngLat(D);H.y+=Xa;const J=H.toLngLat(),ee=u.project(J.lng,J.lat),K=gx(ee.x-R.x,ee.y-R.y,I),re=Math.abs($.x)/Math.abs(K.y),se=Ei([]);Qn(se,se,-I*(1-(g?0:_)));const Ee=Ei([]);return Ji(Ee,Ee,[1,1-(1-re)*_,1]),Ee[4]=-K.x/K.y*_,Qn(Ee,Ee,I),Ii(Ee,se,Ee),Ee})(r.projection,0,r.center,i,e),a=_x(r);return Ji(n,n,[a,a,1]),n}function _x(r){const e=r.projection,i=Up(r.projection,r.zoom,r.width,r.height),n=D_(e,r.center),a=D_(e,Z.convert(e.center));return Math.pow(2,n*i+(1-i)*a)}function Up(r,e,i,n,a=1/0){const u=r.range;if(!u)return 0;const h=Math.min(a,Math.max(i,n)),f=Math.log2(h/1024);return le(u[0]+f,u[1]+f,e)}const Xa=1/4e4;function D_(r,e){const i=Y(e.lat,-85.051129,oe),n=new Z(e.lng-180*Xa,i),a=new Z(e.lng+180*Xa,i),u=r.project(n.lng,i),h=r.project(a.lng,i),f=Ke.fromLngLat(n),_=Ke.fromLngLat(a),g=h.x-u.x,v=h.y-u.y,b=_.x-f.x,w=_.y-f.y,E=Math.sqrt((b*b+w*w)/(g*g+v*v));return Math.log2(E)}function gx(r,e,i){const n=Math.cos(i),a=Math.sin(i);return{x:r*n-e*a,y:r*a+e*n}}function yx(r,e,i){Ei(r),Qn(r,r,$t(e[2])),Lr(r,r,$t(e[0])),Jn(r,r,$t(e[1])),Ji(r,r,i),Ii(r,r,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function jp(r,e,i,n,a,u,h,f){const _=[i[0]-e[0],i[1]-e[1],0],g=[n[0]-e[0],n[1]-e[1],0];if(gn(_)<1e-12||gn(g)<1e-12)return Ro(r);const v=Fr([],_,g);mi(v,v),ho(g,n,e),_[2]=(u-a)*f,g[2]=(h-a)*f;const b=_;return Fr(b,_,g),mi(b,b),zo(r,v,b)}function Gp(r,e,i=!1){const n=Ha(e.zoom),a=(function(u,h,f){const _=h.worldSize,g=[u[12],u[13],u[14]],v=Fe(g[1]/_),b=Me(g[0]/_),w=Ei([]),E=ge(1,v)*_,I=ge(1,0)*_*be(v,h.zoom),P=1/t_(_);let D=I*P;if(f){const V=Up(h.projection,h.zoom,h.width,h.height,1024);D=P*h.projection.pixelSpaceConversion(h.center.lat,_,V)}const R=Q(v,b);nr(R,R,ki([],mi([],R),E*D*g[2]));const F=(function(V){const $=[V[0],V[1],V[2]];let H=[0,1,0];const J=Fr([],H,$);return Fr(H,$,J),uc(H)===0&&(H=[0,1,0],Fr(J,$,H)),mi(J,J),mi(H,H),mi($,$),[J[0],J[1],J[2],0,H[0],H[1],H[2],0,$[0],$[1],$[2],0,V[0],V[1],V[2],1]})(R);Ji(w,w,[D,D,D*E]),_r(w,w,[-g[0],-g[1],-g[2]]);const B=Ii([],h.globeMatrix,F);return Ii(B,B,w),Ii(B,B,u),B})(r,e,i);if(n>0){const u=(function(h,f){const _=f.worldSize,g=ge(1,0)*_*be(f.center.lat,f.zoom)/t_(_),v=ge(1,f.center.lat)*_,b=Ei([]);Jn(b,b,$t(f.center.lng)),Lr(b,b,$t(f.center.lat)),_r(b,b,[0,0,O]),Ji(b,b,[g,g,g*v]);const w=f.point;return _r(b,b,[-w.x,-w.y,0]),Ii(b,b,h),Ii(b,f.globeMatrix,b)})(r,e);return(function(h,f,_){const g=(I,P,D)=>{const R=gn(I),F=gn(P),B=ia(I,P,D);return ki(B,B,1/gn(B)*_t(R,F,D))},v=g([h[0],h[1],h[2]],[f[0],f[1],f[2]],_),b=g([h[4],h[5],h[6]],[f[4],f[5],f[6]],_),w=g([h[8],h[9],h[10]],[f[8],f[9],f[10]],_),E=ia([h[12],h[13],h[14]],[f[12],f[13],f[14]],_);return[v[0],v[1],v[2],0,b[0],b[1],b[2],0,w[0],w[1],w[2],0,E[0],E[1],E[2],1]})(a,u,n)}return a}function L_(r,e,i,n){const a=ei.projectAabbCorners(n,i);let u=Number.MAX_VALUE;for(let f=0;f<a.length;++f){const _=a[f];_[0]=(.5*_[0]+.5)*e.width,_[1]=(.5-.5*_[1])*e.height,_[2]<u&&(u=_[2])}const h=(function(f){const _=[];let g=0;for(let E=1;E<f.length;E++)(f[E][0]<f[g][0]||f[E][0]===f[g][0]&&f[E][1]<f[g][1])&&(g=E);let v,b=g;const w=new Uint8Array(f.length);do{if(w[b])break;_.push(new Be(f[b][0],f[b][1])),w[b]=1,v=(b+1)%f.length;for(let E=0;E<f.length;E++){if(f[E][0]===f[v][0]&&f[E][1]===f[v][1]||f[E][0]===f[b][0]&&f[E][1]===f[b][1])continue;const I=[f[E][0]-f[b][0],f[E][1]-f[b][1]],P=[f[v][0]-f[b][0],f[v][1]-f[b][1]],D=I[0]*P[1]-I[1]*P[0];(D>0||D===0&&I[0]*P[0]+I[1]*P[1]>=0&&I[0]*I[0]+I[1]*I[1]>P[0]*P[0]+P[1]*P[1])&&(v=E)}b=v}while(b!==g);return _.length>0&&_.push(_[0]),_})(a);if(Di(r,h))return u}const ec=64,gu={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function qp(r,e,i,n,a,u,h,f,_,g=!1){const v=i.zoom,b=i.project(n),w=be(n.lat,v),E=1/w;Ei(r),_r(r,r,[b.x+h[0]*E,b.y+h[1]*E,h[2]]);let I=1,P=1;const D=i.worldSize;if(g){if(i.projection.name==="mercator"){let V=0;i.elevation&&(V=i.elevation.getAtPointOrZero(new Ke(b.x/D,b.y/D),0));const $=an([],[b.x,b.y,V,1],i.projMatrix)[3]/i.cameraToCenterDistance;I=$,P=$*be(i.center.lat,v)}else if(i.projection.name==="globe"){const V=Gp(r,i),$=[0,0,0,1];an($,$,Ii([],i.projMatrix,V));const H=$[3]/i.cameraToCenterDistance,J=Ha(v),ee=i.projection.pixelsPerMeter(n.lat,D)*be(n.lat,v),K=i.projection.pixelsPerMeter(i.center.lat,D)*be(i.center.lat,v);I=H/_t(ee,Ie(i.center.lat),J),P=H*w/ee,I*=K,P*=K}}else I=E;Ji(r,r,[I,I,P]);const R=[...r],F=e.orientation,B=[];if(yx(B,[F[0]+(a?a[0]:0),F[1]+(a?a[1]:0),F[2]+(a?a[2]:0)],u),Ii(r,R,B),f&&i.elevation){let V=0;const $=[];if(_&&i.elevation){V=(function(J,ee,K,re,se){const Ee=ee.elevation;if(!Ee)return 0;const we=ei.projectAabbCorners(K,re),Se=ge(1,se.lat)*ee.worldSize,Re=(function(Xe,pt){const ct=[0,0,1],Qe=[{corners:[0,1,3,2],dotProductWithUp:0},{corners:[1,5,2,6],dotProductWithUp:0},{corners:[0,4,1,5],dotProductWithUp:0},{corners:[2,6,3,7],dotProductWithUp:0},{corners:[4,7,5,6],dotProductWithUp:0},{corners:[0,3,4,7],dotProductWithUp:0}];for(const bt of Qe){const Ot=Xe[bt.corners[0]],Kt=Xe[bt.corners[1]],Lt=Xe[bt.corners[2]],hi=[Kt[0]-Ot[0],Kt[1]-Ot[1],pt*(Kt[2]-Ot[2])],qt=Fr(hi,hi,[Lt[0]-Ot[0],Lt[1]-Ot[1],pt*(Lt[2]-Ot[2])]);mi(qt,qt),bt.dotProductWithUp=Gi(qt,ct)}return Qe.sort((bt,Ot)=>bt.dotProductWithUp-Ot.dotProductWithUp),Qe[0].corners})(we,Se),Ce=we[Re[0]],Pe=we[Re[1]],ye=we[Re[2]],De=we[Re[3]],Ae=Ee.getAtPointOrZero(new Ke(Ce[0]/ee.worldSize,Ce[1]/ee.worldSize),0),Le=Ee.getAtPointOrZero(new Ke(Pe[0]/ee.worldSize,Pe[1]/ee.worldSize),0),ze=Ee.getAtPointOrZero(new Ke(ye[0]/ee.worldSize,ye[1]/ee.worldSize),0),tt=Ee.getAtPointOrZero(new Ke(De[0]/ee.worldSize,De[1]/ee.worldSize),0),it=(Ae+tt)/2,Ze=(Le+ze)/2;return it>Ze?Le<ze?jp(J,Pe,De,Ce,Le,tt,Ae,Se):jp(J,ye,Ce,De,ze,Ae,tt,Se):Ae<tt?jp(J,Ce,Pe,ye,Ae,Le,ze,Se):jp(J,De,ye,Pe,tt,ze,Le,Se),Math.max(it,Ze)})($,i,e.aabb,r,n);const H=Ii([],il([],$),B);Ii(r,R,H)}else V=i.elevation.getAtPointOrZero(new Ke(b.x/D,b.y/D),0);V!==0&&(r[14]+=V)}}class xx{constructor(e,i,n,a,u){this.materialOverrides=new Map,this.nodeOverrides=new Map,this.materialOverrideNames=[],this.nodeOverrideNames=[],this.featureProperties={},this.id=e,this.uri=i,this.position=n!=null?new Z(n[0],n[1]):new Z(0,0),this.orientation=a??[0,0,0],this.nodes=u,this.uploaded=!1,this.aabb=new ei([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(e,i){Ii(e.globalMatrix,i,e.localMatrix);const n=this.nodeOverrides.get(e.name);if(n!==void 0){const h=[];u=n.orientation,Ei(a=h),Jn(a,a,$t(u[1])),Qn(a,a,$t(u[2])),Lr(a,a,$t(u[0])),Ii(e.globalMatrix,e.globalMatrix,h)}var a,u;if(e.meshes)for(const h of e.meshes){const f=ei.applyTransformFast(h.aabb,e.globalMatrix);this.aabb.encapsulate(f)}if(e.children)for(const h of e.children)this._applyTransformations(h,e.globalMatrix)}computeBoundsAndApplyParent(){const e=Ei([]);this.aabb=new ei([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const i of this.nodes)this._applyTransformations(i,e)}computeModelMatrix(e,i,n,a,u,h,f=!1){qp(this.matrix,this,e.transform,this.position,i,n,a,u,h,f)}upload(e){if(!this.uploaded){for(const i of this.nodes)F_(i,e);for(const i of this.nodes)Hp(i);this.uploaded=!0}}destroy(){for(const e of this.nodes)O_(e)}}function Td(r,e,i=!1){r.uploaded||(r.gfxTexture=new z_(e,r.image,i?e.gl.R8:e.gl.RGBA8,{useMipmap:r.sampler.minFilter>=e.gl.NEAREST_MIPMAP_NEAREST}),r.uploaded=!0,r.image=null)}
8function vb(r,e,i){r.indexBuffer=e.createIndexBuffer(r.indexArray,!1,!0),r.vertexBuffer=e.createVertexBuffer(r.vertexArray,fb.members,!1,!0),r.normalArray&&(r.normalBuffer=e.createVertexBuffer(r.normalArray,gb.members,!1,!0)),r.texcoordArray&&(r.texcoordBuffer=e.createVertexBuffer(r.texcoordArray,_b.members,!1,!0)),r.colorArray&&(r.colorBuffer=e.createVertexBuffer(r.colorArray,(r.colorArray.bytesPerElement===12?pb:mb).members,!1,!0)),r.featureArray&&(r.pbrBuffer=e.createVertexBuffer(r.featureArray,xb.members,!0)),r.segments=Ci.simpleSegment(0,0,r.vertexArray.length,r.indexArray.length);const n=r.material;n.pbrMetallicRoughness.baseColorTexture&&Td(n.pbrMetallicRoughness.baseColorTexture,e),n.pbrMetallicRoughness.metallicRoughnessTexture&&Td(n.pbrMetallicRoughness.metallicRoughnessTexture,e),n.normalTexture&&Td(n.normalTexture,e),n.occlusionTexture&&Td(n.occlusionTexture,e,i),n.emissionTexture&&Td(n.emissionTexture,e)}function F_(r,e,i){if(r.meshes)for(const n of r.meshes)vb(n,e,i);if(r.children)for(const n of r.children)F_(n,e,i)}function Hp(r){if(r.meshes)for(const e of r.meshes)e.indexArray.destroy(),e.vertexArray.destroy(),e.colorArray&&e.colorArray.destroy(),e.normalArray&&e.normalArray.destroy(),e.texcoordArray&&e.texcoordArray.destroy(),e.featureArray&&e.featureArray.destroy();if(r.children)for(const e of r.children)Hp(e)}function bb(r){r.pbrMetallicRoughness.baseColorTexture&&r.pbrMetallicRoughness.baseColorTexture.gfxTexture&&r.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),r.pbrMetallicRoughness.metallicRoughnessTexture&&r.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&r.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),r.normalTexture&&r.normalTexture.gfxTexture&&r.normalTexture.gfxTexture.destroy(),r.emissionTexture&&r.emissionTexture.gfxTexture&&r.emissionTexture.gfxTexture.destroy(),r.occlusionTexture&&r.occlusionTexture.gfxTexture&&r.occlusionTexture.gfxTexture.destroy()}function O_(r){if(r.meshes)for(const e of r.meshes)e.vertexBuffer&&(e.vertexBuffer.destroy(),e.indexBuffer.destroy(),e.normalBuffer&&e.normalBuffer.destroy(),e.texcoordBuffer&&e.texcoordBuffer.destroy(),e.colorBuffer&&e.colorBuffer.destroy(),e.pbrBuffer&&e.pbrBuffer.destroy(),e.segments.destroy(),e.material&&bb(e.material));if(r.children)for(const e of r.children)O_(e)}function tc(r,e){const i=r.json.bufferViews[e.bufferView],n=Np[e.componentType];return new n(r.buffers[i.buffer],(e.byteOffset||0)+(i.byteOffset||0),e.count*(i.byteStride&&i.byteStride!==bd[e.type]*n.BYTES_PER_ELEMENT?i.byteStride/n.BYTES_PER_ELEMENT:bd[e.type]))}function k_(r,e,i,n){const a=Np[e.componentType],u=(function(v){switch(v){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}})(a),h=r.json.bufferViews[e.bufferView],f=h.byteStride?h.byteStride/a.BYTES_PER_ELEMENT:bd[e.type],_=i.float32,g=_.length/i.capacity;for(let v=0,b=0;v<e.count*f;v+=f,b+=g)for(let w=0;w<g;w++)_[b+w]=n[v+w]*u;i._trim()}function wb(r,e,i){const n=r.indices,a=r.attributes,u={};u.indexArray=new hr;const h=e.json.accessors[n],f=h.count/3;u.indexArray.reserve(f);const _=tc(e,h);for(let w=0;w<f;w++)u.indexArray.emplaceBack(_[3*w],_[3*w+1],_[3*w+2]);u.indexArray._trim(),u.vertexArray=new Yn;const g=e.json.accessors[a.POSITION];u.vertexArray.reserve(g.count);const v=tc(e,g);for(let w=0;w<g.count;w++)u.vertexArray.emplaceBack(v[3*w],v[3*w+1],v[3*w+2]);if(u.vertexArray._trim(),u.aabb=new ei(g.min,g.max),u.centroid=(function(w,E){const I=[0,0,0],P=w.length;if(P>0){for(let D=0;D<P;D++){const R=3*w[D];I[0]+=E[R],I[1]+=E[R+1],I[2]+=E[R+2]}I[0]/=P,I[1]/=P,I[2]/=P}return I})(_,v),a.COLOR_0!==void 0){const w=e.json.accessors[a.COLOR_0],E=bd[w.type],I=tc(e,w);u.colorArray=E===3?new Yn:new Is,u.colorArray.resize(w.count),k_(e,w,u.colorArray,I)}if(a.NORMAL!==void 0){u.normalArray=new Yn;const w=e.json.accessors[a.NORMAL];u.normalArray.resize(w.count);const E=tc(e,w);k_(e,w,u.normalArray,E)}if(a.TEXCOORD_0!==void 0&&i.length>0){u.texcoordArray=new ea;const w=e.json.accessors[a.TEXCOORD_0];u.texcoordArray.resize(w.count);const E=tc(e,w);k_(e,w,u.texcoordArray,E)}if(a._FEATURE_ID_RGBA4444!==void 0){const w=e.json.accessors[a._FEATURE_ID_RGBA4444];e.json.extensionsUsed&&e.json.extensionsUsed.includes("EXT_meshopt_compression")&&(u.featureData=tc(e,w))}a._FEATURE_RGBA4444!==void 0&&(u.featureData=new Uint32Array(tc(e,e.json.accessors[a._FEATURE_RGBA4444]).buffer));const b=r.material;return u.material=(function(w,E){const{emissiveFactor:I=[0,0,0],alphaMode:P="OPAQUE",alphaCutoff:D=.5,normalTexture:R,occlusionTexture:F,emissiveTexture:B,doubleSided:V,name:$}=w,{baseColorFactor:H=[1,1,1,1],metallicFactor:J=1,roughnessFactor:ee=1,baseColorTexture:K,metallicRoughnessTexture:re}=w.pbrMetallicRoughness||{},se=F?E[F.index]:void 0;if(F&&F.extensions&&F.extensions.KHR_texture_transform&&se){const Ee=F.extensions.KHR_texture_transform;se.offsetScale=[Ee.offset[0],Ee.offset[1],Ee.scale[0],Ee.scale[1]]}return{name:$,pbrMetallicRoughness:{baseColorFactor:new ii(...H),metallicFactor:J,roughnessFactor:ee,baseColorTexture:K?E[K.index]:void 0,metallicRoughnessTexture:re?E[re.index]:void 0}
vendor: 5,934 bytes, line 8
8,doubleSided:V,emissiveFactor:new ii(...I),alphaMode:P,alphaCutoff:D,normalTexture:R?E[R.index]:void 0,occlusionTexture:se,emissionTexture:B?E[B.index]:void 0,defined:w.defined===void 0}})(b!==void 0?e.json.materials[b]:{defined:!1},i),u}function vx(r,e,i){const{matrix:n,rotation:a,translation:u,scale:h,mesh:f,extras:_,children:g,name:v}=r,b={};if(b.name=v,b.localMatrix=n||(function(w,E,I,P){var D=E[0],R=E[1],F=E[2],B=E[3],V=D+D,$=R+R,H=F+F,J=D*V,ee=D*$,K=D*H,re=R*$,se=R*H,Ee=F*H,we=B*V,Se=B*$,Re=B*H,Ce=P[0],Pe=P[1],ye=P[2];return w[0]=(1-(re+Ee))*Ce,w[1]=(ee+Re)*Ce,w[2]=(K-Se)*Ce,w[3]=0,w[4]=(ee-Re)*Pe,w[5]=(1-(J+Ee))*Pe,w[6]=(se+we)*Pe,w[7]=0,w[8]=(K+Se)*ye,w[9]=(se-we)*ye,w[10]=(1-(J+re))*ye,w[11]=0,w[12]=I[0],w[13]=I[1],w[14]=I[2],w[15]=1,w})([],a||[0,0,0,1],u||[0,0,0],h||[1,1,1]),b.globalMatrix=ni(b.localMatrix),f!==void 0){b.meshes=i[f];const w=b.anchor=[0,0];for(const E of b.meshes){const{min:I,max:P}=E.aabb;w[0]+=I[0]+P[0],w[1]+=I[1]+P[1]}w[0]=Math.floor(w[0]/b.meshes.length/2),w[1]=Math.floor(w[1]/b.meshes.length/2)}if(_&&(_.id&&(b.id=_.id),_.lights&&(b.lights=(function(w){if(!w.length)return[];const E=(function(F){const B=atob(F),V=new Uint8Array(B.length);for(let $=0;$<B.length;$++)V[$]=B.codePointAt($);return V})(w),I=[],P=E.length/24,D=new Uint16Array(E.buffer),R=new Float32Array(E.buffer);for(let F=0;F<P;F++){const B=D[2*F*6]/30,V=D[2*F*6+1]/30,$=D[2*F*6+10]/100,H=R[6*F+1],J=R[6*F+2],ee=R[6*F+3],K=R[6*F+4],re=ee-H,se=K-J,Ee=Math.hypot(re,se);I.push({pos:[H+.5*re,J+.5*se,V],normal:[se/Ee,-re/Ee,0],width:Ee,height:B,depth:$,points:[H,J,ee,K]})}return I})(_.lights)),_.MAPBOX_geometry_bloom&&(b.isGeometryBloom=_.MAPBOX_geometry_bloom)),g){const w=[];for(const E of g)w.push(vx(e.json.nodes[E],e,i));b.children=w}return b}function Tb(r){if(r.vertices.length===0||r.indices.length===0)return null;const e=new Rp(r.vertices,r.indices,8,256),[i,n]=[e.min.clone(),e.max.clone()];return{vertices:r.vertices,indices:r.indices,grid:e,min:i,max:n}}function Sb(r){if(!r.extras||!r.extras.ground)return null;const e=r.extras.ground;if(!e||!Array.isArray(e)||e.length===0)return null;const i=e[0];if(!i||!Array.isArray(i)||i.length===0)return null;const n=[];for(const h of i){if(!Array.isArray(h)||h.length!==2)continue;const f=h[0],_=h[1];typeof f=="number"&&typeof _=="number"&&n.push(new Be(f,_))}if(n.length<3)return null;n.length>1&&n[n.length-1].equals(n[0])&&n.pop();let a=0;for(let h=0;h<n.length;h++){const f=n[h],_=n[(h+1)%n.length],g=n[(h+2)%n.length];a+=(f.x-_.x)*(g.y-_.y)-(g.x-_.x)*(f.y-_.y)}a>0&&n.reverse();const u=cu(n.flatMap(h=>[h.x,h.y]),[]);return u.length===0?null:{vertices:n,indices:u}}function Eb(r,e){const i=[],n=[];let a=0;const u=[];for(const h of r){a=i.length;const f=h.vertexArray.float32,_=h.indexArray.uint16;for(let g=0;g<h.vertexArray.length;g++)u[0]=f[3*g+0],u[1]=f[3*g+1],u[2]=f[3*g+2],Qi(u,u,e),i.push(new Be(u[0],u[1]));for(let g=0;g<3*h.indexArray.length;g++)n.push(_[g]+a)}if(n.length%3!=0)return null;for(let h=0;h<n.length;h+=3){const f=i[n[h+0]],_=i[n[h+1]],g=i[n[h+2]];(f.x-_.x)*(g.y-_.y)-(g.x-_.x)*(f.y-_.y)>0&&([n[h+1],n[h+2]]=[n[h+2],n[h+1]])}return{vertices:i,indices:n}}function B_(r){const e=(function(_,g){const v=[],b=WebGL2RenderingContext;if(_.json.textures)for(const w of _.json.textures){const E={magFilter:b.LINEAR,minFilter:b.NEAREST,wrapS:b.REPEAT,wrapT:b.REPEAT};w.sampler!==void 0&&Object.assign(E,_.json.samplers[w.sampler]),v.push({image:g[w.source],sampler:E,uploaded:!1})}return v})(r,r.images),i=(function(_,g){const v=[];for(const b of _.json.meshes){const w=[];for(const E of b.primitives)w.push(wb(E,_,g));v.push(w)}return v})(r,e),{scenes:n,scene:a,nodes:u}=r.json,h=n?n[a||0].nodes:[...u.keys()],f=[];for(const _ of h)f.push(vx(u[_],r,i));return(function(_,g,v){const b={},w=new Set;for(let E=0;E<_.length;E++){const I=v[g[E]];if(!I.extras)continue;const P=I.extras["mapbox:footprint:version"],D=I.extras["mapbox:footprint:id"];(P||D)&&w.add(E),P==="1.0.0"&&D&&(b[D]=E)}for(let E=0;E<_.length;E++){if(w.has(E))continue;const I=_[E],P=v[g[E]];if(!P.extras)continue;let D=null;I.id in b&&(D=Eb(_[b[I.id]].meshes,I.localMatrix)),D||(D=Sb(P)),D&&(I.footprint=Tb(D))}if(w.size>0){const E=Array.from(w.values()).sort((I,P)=>I-P);for(let I=E.length-1;I>=0;I--)_.splice(E[I],1)}})(f,h,r.json.nodes),f}function Ib(r){r.heightmap=new Float32Array(4096),r.heightmap.fill(-1);const e=r.vertexArray.float32,i=r.aabb.min[0]-1,n=r.aabb.min[1]-1,a=ec/(r.aabb.max[0]-i+2),u=ec/(r.aabb.max[1]-n+2);for(let h=0;h<e.length;h+=3){const f=e[h+2],_=(e[h+0]-i)*a|0,g=(e[h+1]-n)*u|0;f>r.heightmap[g*ec+_]&&(r.heightmap[g*ec+_]=f)}}function bx(r,e,i,n,a){i.reserve(i.length+4*r.length),n.reserve(n.length+10*r.length),a.reserve(a.length+10*r.length);let u=n.length;for(const h of r){const f=Math.min(10,Math.max(4,1.3*h.height))*e,_=[-h.normal[1],h.normal[0],0],g=Math.min(.29,.1*h.width/h.depth),v=h.width-2*h.depth*e*(g+.01),b=Mn([],h.pos,_,v/2),w=Mn([],h.pos,_,-v/2),E=[b[0],b[1],b[2]+h.height],I=[w[0],w[1],w[2]+h.height],P=Mn([],h.normal,_,g);ki(P,P,f);const D=Mn([],h.normal,_,-g);ki(D,D,f),nr(P,b,P),nr(D,w,D),b[2]+=.1,w[2]+=.1,n.emplaceBack(P[0],P[1],P[2]),n.emplaceBack(D[0],D[1],D[2]),n.emplaceBack(b[0],b[1],b[2]),n.emplaceBack(w[0],w[1],w[2]),n.emplaceBack(E[0],E[1],E[2]),n.emplaceBack(I[0],I[1],I[2]),n.emplaceBack(b[0],b[1],b[2]),n.emplaceBack(w[0],w[1],w[2]),n.emplaceBack(P[0],P[1],P[2]),n.emplaceBack(D[0],D[1],D[2]);const R=v/f/2;a.emplaceBack(-R-g,-1,R,.8),a.emplaceBack(R+g,-1,R,.8),a.emplaceBack(-R,0,R,1.3),a.emplaceBack(R,0,R,1.3),a.emplaceBack(R+g,-.8,R,.7),a.emplaceBack(R+g,-.8,R,.7),a.emplaceBack(0,0,R,1.3),a.emplaceBack(0,0,R,1.3),a.emplaceBack(R+g,-1.2,R,.8),a.emplaceBack(R+g,-1.2,R,.8),i.emplaceBack(6+u,4+u,8+u),i.emplaceBack(7+u,9+u,5+u),i.emplaceBack(0+u,1+u,2+u),i.emplaceBack(1+u,3+u,2+u),u+=10}}function Ab(r,e){const i={};i.indexArray=new hr,i.vertexArray=new Yn,i.colorArray=new Is,bx(r,e,i.indexArray,i.vertexArray,i.c
vendor: 1,155 bytes, line 8
8olorArray);const n={defined:!0};n.emissiveFactor=ii.black;const a={};return a.baseColorFactor=ii.white,n.pbrMetallicRoughness=a,i.material=n,i.aabb=new ei([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),i}const wx=Nt([{name:"a_pos_3f",components:3,type:"Float32"}]),Mb=Nt([{name:"a_normal_3",components:3,type:"Int16"}]),Cb=Nt([{name:"a_centroid_3",components:3,type:"Int16"}]),Tx=Nt([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),Pb=Nt([{name:"a_faux_facade_color_emissive",components:2,type:"Uint16"}]),Rb=Nt([{name:"a_faux_facade_data",components:4,type:"Uint16"}]),zb=Nt([{name:"a_faux_facade_vertical_range",components:2,type:"Uint16"}]),Db=Nt([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),Lb=Nt([{name:"a_flood_light_wall_radius_1i16",components:1,type:"Uint16"}]),Sx=Vt.types,$p=32767;function Fb(r,e){const i=We+e;for(const n of r)for(const a of n)if(a.x<-e||a.x>i||a.y<-e||a.y>i)return!1;return!0}function Ob(r){switch(r){case"flat":return 3;case"hipped":return 1;case"gabled":return 2;case"parapet":return 0;case"mansard":return 4;case"skillion":return 5;case"pyramidal":return 6;default:throw new Error(`Unknown roof shape: ${r}`)}}
vendor: 30,381 bytes, line 8
8class N_{constructor(){this.layoutVertexArray=new Yn,this.layoutAttenuationArray=new Is,this.layoutColorArray=new On,this.indexArray=new hr,this.indexArrayForConflation=new hr,this.segmentsBucket=new Ci}}class V_{constructor(e){this.layoutFacadePaintArray=null,this.layoutFacadeDataArray=null,this.layoutFacadeVerticalRangeArray=null,this.segmentsBucket=new Ci,this.entranceBloom=new N_;const i=66560;this.layoutVertexArray=new Yn,this.layoutVertexArray.reserve(i),this.layoutNormalArray=new $o,this.layoutNormalArray.reserve(i),this.layoutCentroidArray=new $o,this.layoutCentroidArray.reserve(i),this.layoutColorArray=new On,this.layoutColorArray.reserve(i),this.layoutFloodLightDataArray=new jl,this.layoutFloodLightDataArray.reserve(i),this.layoutAOArray=new ou,this.layoutAOArray.reserve(i),this.indexArray=new hr,this.indexArray.reserve(66560),this.indexArrayForConflation=new hr,this.segmentsBucket=new Ci,this.entranceBloom=new N_,e&&(this.layoutFacadePaintArray=new On,this.layoutFacadeDataArray=new Na,this.layoutFacadeVerticalRangeArray=new On)}reserve(e,i,n){this.layoutVertexArray.reserveForAdditional(e),this.layoutCentroidArray.reserveForAdditional(e),this.layoutFloodLightDataArray.reserveForAdditional(e),this.layoutNormalArray.reserveForAdditional(e),this.layoutAOArray.reserveForAdditional(e),this.layoutColorArray.reserveForAdditional(e),this.indexArray.reserveForAdditional(i),n&&(this.layoutFacadePaintArray.reserveForAdditional(e),this.layoutFacadeDataArray.reserveForAdditional(e),this.layoutFacadeVerticalRangeArray.reserveForAdditional(e))}}class Ex{constructor(e){this.colorBufferUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.footprintsVertices=new ea,this.footprintsIndices=new jl,this.footprintsMin=new Be(1/0,1/0),this.footprintsMax=new Be(-1/0,-1/0),this.featuresOnBorder=[],this.buildingWithoutFacade=new V_(!1),this.buildingWithFacade=new V_(!0),this.indexArrayForConflationUploaded=!1,this.featureFootprintLookup=new Map,this.buildingIds=new Set,this.footprintLookup={},this.zoom=e.zoom,this.canonical=e.canonical,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.worldview=e.worldview,this.lut=e.lut,this.programConfigurations=new S(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.projection=e.projection,this.groundEffect=new w_(e),this.groundEffect.groundRadiusArray=new Ir,this.hasAppearances=null}updateFootprints(e,i){const n=new Rp([],[],1),a={vertices:[],indices:new Uint32Array(0),grid:n,min:this.footprintsMin,max:this.footprintsMax,buildingIds:this.buildingIds};i.push({footprint:a,id:e})}updateAppearances(e,i,n,a){}prepare(){return(function(){if(Bp!=null||Qy!=null)return null;if(_u!=null)return _u;const e=fetch(cr.BUILDING_GEN_URL);return _u=(function(i){let n,a,u,h,f;function _(){n=new Uint8Array(f.buffer),a=new Int16Array(f.buffer),u=new Int32Array(f.buffer),h=new Float32Array(f.buffer)}function g(){throw new Error("Unexpected BuildingGen error.")}const v=()=>{},b={a:{a:g,f:function(w){const E=n.length,I=Math.max(w>>>0,Math.ceil(1.2*E)),P=Math.ceil((I-E)/65536);try{return f.grow(P),_(),!0}catch{return!1}},g,b:v,c:v,d:v,e:v}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(i,b):i.then(w=>w.arrayBuffer()).then(w=>WebAssembly.instantiate(w,b))).then(w=>{const E=w.instance.exports;return(0,E.g)(),f=E.f,_(),new sb({setStyle:E.h,setAOOptions:E.i,setMetricOptions:E.j,setStructuralOptions:E.k,setFacadeOptions:E.l,setFauxFacadeOptions:E.m,setFacadeClassifierOptions:E.n,addFeature:E.o,addFacade:E.p,generateMesh:E.q,getLastError:E.r,getOuterRingLength:E.s,getMeshCount:E.t,getPositionsPtr:E.u,getPositionsLength:E.v,getNormalsPtr:E.w,getNormalsLength:E.x,getAOPtr:E.y,getAOLength:E.z,getUVPtr:E.A,getUVLength:E.B,getFauxFacadePtr:E.C,getFauxFacadeLength:E.D,getIndicesPtr:E.E,getIndicesLength:E.F,getBuildingPart:E.G,getRingCount:E.H,getRingPtr:E.I,getRingLength:E.J,malloc:E.K,free:E.L,heapU8:n,heap16:a,heap32:u,heapF32:h})})})(e).then(i=>(_u=null,Bp=i,Bp)).catch(i=>{xt("Could not load building-gen"),_u=null,Qy=i}),_u})()}populate(e,i,n,a){const u=ab();if(!u)return;const h=Ue(n);this.tileToMeter=h,this.brightness=i.brightness,u.setStyle({normalScale:[1,-1,h],tileToMeters:h}),u.setAOOptions(!1,.3),u.setMetricOptions(!1,16),u.setStructuralOptions(!0),u.setFacadeClassifierOptions(3);const f=new Map,_=new Map;let g=0;for(const{feature:R}of e){if(Sx[R.type]!=="LineString"){f.set(R.id,R.properties.source_id);continue}const F=this.layers[0]._featureFilter.needGeometry;if(F&&!this.layers[0]._featureFilter.filter(new ui(this.zoom),R,n))continue;const B=Pt(R,F);if(!F&&!this.layers[0]._featureFilter.filter(new ui(this.zoom),B,n))continue;const V=F?B.geometry:yt(R,n,a),$=[];for(const K of V)for(const re of K)$.push(re.x),$.push(re.y);const H={coordinates:$,crossPerc:R.properties.cross_perc,distanceToRoad:R.properties.distance_to_road,entrances:R.properties.entrances,sourceId:0},J=R.properties.source_id;let ee=_.get(J);ee||(ee=[],_.set(J,ee)),ee.push(H),++g}this.maxHeight=0;const v=new Array,b=new Set,w=R=>{R!=null&&b.add(R)},E=(R,F)=>{R!=null&&v.push({buildingId:R,footprintIndex:F})},I=64*(e.length-g),P=I/2;this.buildingWithFacade.reserve(I,P,!0),this.buildingWithoutFacade.reserve(2*I,2*P,!1),this.footprintsIndices.reserve(16*(e.length-g)),this.footprintsVertices.reserve(8*(e.length-g));for(const{feature:R,id:F,index:B,sourceLayerIndex:V}of e){if(Sx[R.type]==="LineString")continue;const $=this.layers[0]._featureFilter.needGeometry;if($&&!this.layers[0]._featureFilter.filter(new ui(this.zoom),R,n))continue;let H=null;if(R.properties&&R.properties.hasOwnProperty("building_id")&&(H=Number(R.properties.building_id),b.has(H)))continue;const J=Pt(R,$);if(!$&&!this.layers[0]._featureFilter.filter(new ui(this.zoom),J,n))continue;const ee=$?J.geometry:yt(R,n,a),K=ud(ee,500);let re=!1;for(const Ft of K)if(Ft.length!==1){re=!0;break}if(re){w(H);continue}if(!Fb(ee,163)){w(H);continue}const se=this.layers[0],Ee=Ob(se.layout.get("building-roof-shape").evaluate(R,{},n)),we=se.layout.get("building-base").evaluate(R,{},n),Se=se.layout.get("building-height").evaluate(R,{},n),Re=se.layout.get("building-flood-light-ground-radius").evaluate(R,{},n),Ce=se.paint.get("building-ambient-occlusion-intensity"),Pe=Re/this.tileToMeter;R.properties["building-part"]="roof";const ye=se.paint.get("building-color").evaluate(R,{},this.canonical).toPremultipliedRenderColor(this.lut),De=se.paint.get("building-emissive-strength").evaluate(R,{},this.canonical);R.properties["building-part"]="wall";const Ae=se.paint.get("building-color").evaluate(R,{},this.canonical).toPremultipliedRenderColor(this.lut),Le=se.paint.get("building-emissive-strength").evaluate(R,{},this.canonical);R.properties["building-part"]="window";const ze=se.paint.get("building-color").evaluate(R,{},this.canonical).toPremultipliedRenderColor(this.lut),tt=se.paint.get("building-emissive-strength").evaluate(R,{},this.canonical);R.properties["building-part"]="door";const it=se.paint.get("building-color").evaluate(R,{},this.canonical).toPremultipliedRenderColor(this.lut),Ze=se.paint.get("building-emissive-strength").evaluate(R,{},this.canonical);let Xe=se.layout.get("building-flood-light-wall-radius").evaluate(R,{},n);Xe=Y(Xe,0,2048);const pt=Xe/2048*$p,ct=f.get(F),Qe=_.get(ct)||[],bt=Qe.length!==0&&se.layout.get("building-facade").evaluate(R,{},n);u.setFacadeOptions(4,!0),u.setFauxFacadeOptions(bt,!1,1);let Ot=0,Kt=0,Lt=0,hi=0,qt=0,Zi=0,Wt=0,ai=0,Si=0,Li=0,Fi=0;if(bt){let Ft=Math.round(se.layout.get("building-facade-floors").evaluate(R,{},n));if(we===0){Ft=Math.max(1,Ft-(Qe.length>0?1:0));let Xi=4;if(Se>100){const pr=[10,13,15];Xi=pr[R.id?R.id%pr.length:0]}else Se<=10&&(Xi=3);u.setFacadeOptions(Xi,!0),qt=(Se<15?1.3:1.61803)*Xi/h}else qt=we/h;Zi=Se/h,qt=Math.min(qt,Zi),Lt=se.layout.get("building-facade-unit-width").evaluate(R,{},n)/h,hi=(Zi-qt)/Ft,u.setFauxFacadeOptions(!0,!0,Lt);const wr=se.layout.get("building-facade-window").evaluate(R,{},n);Ot=wr[0],Kt=wr[1],Wt=Math.floor(65535*Math.min(1,qt/We)),ai=Math.floor(65535*Math.min(1,Zi/We)),Si=Math.floor(255*Ot)<<8|Math.floor(255*Kt),Li=Math.floor(65535*Math.min(1,Lt/We)),Fi=Math.floor(65535*Math.min(1,hi/We))}const Wi=Array(K.length),Ar={x:1/0,y:1/0},Nr={x:-1/0,y:-1/0},sr={x:0,y:0};let fr=0;for(let Ft=0;Ft<K.length;Ft++){const wr=K[Ft];if(wr.length>0){const Xi=[],pr=Array(wr.length+1);pr[0]=0;for(let co=0;co<wr.length;co++){const In=wr[co];for(let qn=0;qn<In.length;qn++){const Tr=In[In.length-qn-1];Ar.x=Math.min(Ar.x,Tr.x),Ar.y=Math.min(Ar.y,Tr.y),Nr.x=Math.max(Nr.x,Tr.x),Nr.y=Math.max(Nr.y,Tr.y),sr.x+=Tr.x,sr.y+=Tr.y,fr++,Xi.push(Tr.x),Xi.push(Tr.y)}pr[co+1]=Xi.length}Wi[Ft]={id:R.id?R.id:0,height:Se,minHeight:we,sourceId:0,roofType:Ee,coordinates:Xi,ringIndices:pr}}}sr.x/=fr||1,sr.y/=fr||1;const yr=u.generateMesh(Wi,Qe);if(typeof yr=="string"){xt(`Unable to generate building ${R.id}: ${yr}`),w(H);continue}if(yr.meshes.length===0||yr.modifiedPolygonRings.length===0){w(H);continue}const Rt=bt?this.buildingWithFacade:this.buildingWithoutFacade;let Oi=0;for(const Ft of yr.meshes)Oi+=Ft.positions.length/3;const Vi=Rt.segmentsBucket.prepareSegment(Oi,Rt.layoutVertexArray,Rt.indexArray),Gn=[];let on=null,Mr=0,sn=-1;const Ps=Rt.layoutVertexArray.length,Gr=Ps+Oi;Rt.layoutVertexArray.resize(Gr),Rt.layoutCentroidArray.resize(Gr),Rt.layoutNormalArray.resize(Gr),Rt.layoutAOArray.resize(Gr),Rt.layoutColorArray.resize(Gr),Rt.layoutFloodLightDataArray.resize(Gr),bt&&(Rt.layoutFacadePaintArray.resize(Gr),Rt.layoutFacadeDataArray.resize(Gr),Rt.layoutFacadeVerticalRangeArray.resize(Gr));const gm=Rt.indexArray.length;let Cu=0,_n=Ps;for(const Ft of yr.meshes){let wr,Xi;if(Ft.buildingPart===1)wr=ye,Xi=De;else if(Ft.buildingPart===0)wr=Ae,Xi=Le;else if(Ft.buildingPart===2)wr=ze,Xi=tt;else{if(Ft.buildingPart!==3)continue;wr=it,Xi=Ze}if(Xi=Y(Xi,0,1),Ft.buildingPart===3){const ar=new Array;for(let Hr=0;Hr<Ft.positions.length;Hr+=12){const el=Ft.positions[Hr+0],Pr=Ft.positions[Hr+1],An=Ft.positions[Hr+3],Mo=Ft.positions[Hr+4],Ds=Ft.positions[Hr+2],Eg=Ft.positions[Hr+8]-Ds,Ig=1,Zd=An-el,Ru=Mo-Pr,Jo=Math.hypot(Zd,Ru);ar.push({pos:[el+.5*Zd,Pr+.5*Ru,Ds],normal:[Ru/Jo,-Zd/Jo,0],width:Jo,height:Eg,depth:Ig,points:[el,Pr,An,Mo]})}const Cr=Rt.entranceBloom.segmentsBucket.prepareSegment(10*ar.length,Rt.entranceBloom.layoutVertexArray,Rt.entranceBloom.indexArray),mr=Rt.entranceBloom.layoutVertexArray.length;Mr=Rt.entranceBloom.indexArray.length,bx(ar,.5/this.tileToMeter,Rt.entranceBloom.indexArray,Rt.entranceBloom.layoutVertexArray,Rt.entranceBloom.layoutAttenuationArray);const qr=Rt.entranceBloom.layoutVertexArray.length-mr;sn=Rt.entranceBloom.indexArray.length-Mr;for(let Hr=0;Hr<qr;Hr++)Rt.entranceBloom.layoutColorArray.emplaceBack(255*it.r<<8|255*it.g,255*it.b<<8|51*Ze);Cr.vertexLength+=qr,Cr.primitiveLength+=sn,on={part:Ft.buildingPart,vertexOffset:mr,vertexLength:qr}}Rt.layoutVertexArray.float32.set(Ft.positions,3*_n);const pr=Ft.positions.length/3;for(let ar=0;ar<pr;++ar){const Cr=3*ar;Cu=Math.max(Cu,Ft.positions[Cr+2]);const mr=Ft.normals[Cr+1]*$p,qr=Ft.normals[Cr+2]*$p,Hr=3*(_n+ar);Rt.layoutNormalArray.int16[Hr]=Ft.normals[Cr]*$p,Rt.layoutNormalArray.int16[Hr+1]=mr,Rt.layoutNormalArray.int16[Hr+2]=qr;const el=Ft.ao[ar];Rt.layoutAOArray.uint8[_n+ar]=255*el;const Pr=1+(el-1)*Ce,An=255*wr.b*Pr<<8|255*Xi;Rt.layoutColorArray.uint16[2*(_n+ar)]=255*wr.r*Pr<<8|255*wr.g*Pr,Rt.layoutColorArray.uint16[2*(_n+ar)+1]=An}const co=Math.floor(sr.x),In=Math.floor(sr.y),qn=Math.floor(Se);for(let ar=0;ar<pr;++ar){const Cr=3*(_n+ar);Rt.layoutCentroidArray.int16[Cr]=co,Rt.layoutCentroidArray.int16[Cr+1]=In,Rt.layoutCentroidArray.int16[Cr+2]=qn}if(Rt.layoutFloodLightDataArray.uint16.fill(Ft.buildingPart===0?pt:0,_n,_n+pr),bt){const ar=255*ze.r<<8|255*ze.g,Cr=255*ze.b<<8|255*tt;for(let mr=0;mr<pr;++mr){const qr=2*(_n+mr);Rt.layoutFacadePaintArray.uint16[qr]=ar,Rt.layoutFacadePaintArray.uint16[qr+1]=Cr}for(let mr=0;mr<pr;++mr)if(Ft.isFauxFacade[mr]){const qr=Math.min(65535,Math.floor(Ft.uv[2*mr]*yr.outerRingLength));Rt.layoutFacadeDataArray.emplace(_n+mr,1|qr,Si,Li,Fi),Rt.layoutFacadeVerticalRangeArray.emplace(_n+mr,Wt,ai)}else Rt.layoutFacadeDataArray.emplace(_n+mr,0,0,0,0),Rt.layoutFacadeVerticalRangeArray.emplace(_n+mr,0,0)}const Tr=Vi.vertexLength,$d=Ft.indices.length/3,zs=Rt.indexArray.length;Rt.indexArray.resize(zs+$d);for(let ar=0;ar<$d;++ar){const Cr=3*ar,mr=3*zs+Cr;Rt.indexArray.uint16[mr]=Tr+Ft.indices[Cr],Rt.indexArray.uint16[mr+1]=Tr+Ft.indices[Cr+1],Rt.indexArray.uint16[mr+2]=Tr+Ft.indices[Cr+2]}Ft.buildingPart!==1&&Ft.buildingPart!==0&&Ft.buildingPart!==2&&Ft.buildingPart!==3||Gn.push({part:Ft.buildingPart,vertexOffset:_n,vertexLength:Ft.positions.length/3}),_n+=pr,Vi.vertexLength+=pr,Vi.primitiveLength+=Ft.indices.length/3}this.maxHeight=Math.max(this.maxHeight,Cu);const ym=Rt.indexArray.length-gm,Rs=this.footprintsIndices.length,aa=this.footprintsVertices.length,Qa=[],lo=new Be(1/0,1/0),Ao=new Be(-1/0,-1/0),Hd=this.groundEffect.vertexArray.length;for(const Ft of yr.modifiedPolygonRings){const wr=[],Xi=new Be(1/0,1/0),pr=new Be(-1/0,-1/0);for(let co=0;co<Ft.length;co+=2){const In=Ft.length-co-2;Xi.x=Math.min(Xi.x,Ft[In]),Xi.y=Math.min(Xi.y,Ft[In+1]),pr.x=Math.max(pr.x,Ft[In]),pr.y=Math.max(pr.y,Ft[In+1]);const qn=new Be(Ft[In],Ft[In+1]);wr.push(qn),Qa.push(qn.x,qn.y),this.footprintsVertices.emplaceBack(qn.x,qn.y)}lo.x=Math.min(lo.x,Xi.x),lo.y=Math.min(lo.y,Xi.y),Ao.x=Math.max(Ao.x,pr.x),Ao.y=Math.max(Ao.y,pr.y),this.groundEffect.addData(wr,[Xi,pr],Pe)}const Pu=this.groundEffect.vertexArray.length-Hd;this.groundEffect.groundRadiusArray.reserveForAdditional(Pu);for(let Ft=0;Ft<Pu;Ft++)this.groundEffect.groundRadiusArray.emplaceBack(Re);(Ar.x<0||Nr.x>We||Ar.y<0||Nr.y>We)&&this.featuresOnBorder.push({featureId:R.id,footprintIndex:this.footprints.length});{const Ft=cu(Qa,null,2);this.footprintsIndices.resize(this.footprintsIndices.length+Ft.length),this.footprintsIndices.uint16.set(Ft,Rs),this.buildingIds.add(H??R.id),this.footprintsMin.x=Math.min(this.footprintsMin.x,lo.x),this.footprintsMin.y=Math.min(this.footprintsMin.y,lo.y),this.footprintsMax.x=Math.max(this.footprintsMax.x,Ao.x),this.footprintsMax.y=Math.max(this.footprintsMax.y,Ao.y);const wr={footprintVertexOffset:aa,footprintVertexLength:this.footprintsVertices.length-aa,footprintIndexOffset:Rs,footprintIndexLength:this.footprintsIndices.length-Rs,min:lo,max:Ao,hiddenFlags:0,indicesOffset:gm,indicesLength:ym,bloomIndicesOffset:Mr,bloomIndicesLength:sn,groundEffectVertexOffset:Hd,groundEffectVertexLength:Pu,hasFauxFacade:bt,height:Cu,promoteId:F,feature:J,parts:Gn,buildingBloom:on},Xi=this.footprints.length;R.id!==void 0&&this.featureFootprintLookup.set(R.id,Xi),E(H,Xi),this.footprints.push(wr)}this.programConfigurations.populatePaintArrays(Rt.layoutVertexArray.length,R,B,{},i.availableImages,n,i.brightness),this.groundEffect.addPaintPropertiesData(R,B,{},i.availableImages,n,i.brightness),i.featureIndex.insert(R,ee,B,V,this.index,Ps)}v.forEach(({buildingId:R,footprintIndex:F})=>{b.has(R)&&(this.footprints[F].hiddenFlags|=4)});const D=new Set;this.buildingIds.forEach((R,F,B)=>{b.has(R)||D.add(R)}),this.buildingIds=D,this.groundEffect.prepareBorderSegments()}update(e,i,n,a,u,h,f){this.programConfigurations.updatePaintArrays(e,i,u,n,a,h,f),this.groundEffect.update(e,i,u,n,a,h,f),this.evaluate(this.layers[0],e),this.colorBufferUploaded=!1}isEmpty(){return this.buildingWithoutFacade.layoutVertexArray.length===0&&this.buildingWithFacade.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){const i=n=>{n.layoutVertexBuffer=e.createVertexBuffer(n.layoutVertexArray,wx.members),n.layoutNormalBuffer=e.createVertexBuffer(n.layoutNormalArray,Mb.members),n.layoutCentroidBuffer=e.createVertexBuffer(n.layoutCentroidArray,Cb.members),n.layoutFloodLightDataBuffer=e.createVertexBuffer(n.layoutFloodLightDataArray,Lb.members),n.layoutFacadeDataArray&&n.layoutFacadeDataArray.length&&(n.layoutFacadeDataBuffer=e.createVertexBuffer(n.layoutFacadeDataArray,Rb.members)),n.layoutFacadeVerticalRangeArray&&n.layoutFacadeVerticalRangeArray.length&&(n.layoutFacadeVerticalRangeBuffer=e.createVertexBuffer(n.layoutFacadeVerticalRangeArray,zb.members)),n.entranceBloom.layoutVertexArray.length&&(n.entranceBloom.layoutVertexBuffer=e.createVertexBuffer(n.entranceBloom.layoutVertexArray,wx.members),n.entranceBloom.layoutAttenuationBuffer=e.createVertexBuffer(n.entranceBloom.layoutAttenuationArray,Db.members)),this.uploadUpdatedColorBuffer(e),this.uploadUpdatedIndexBuffer(e)};this.uploaded||(i(this.buildingWithoutFacade),i(this.buildingWithFacade),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){const e=i=>{i.layoutVertexBuffer&&(i.layoutVertexBuffer.destroy(),i.layoutNormalBuffer.destroy(),i.layoutColorBuffer.destroy(),i.segmentsBucket.destroy(),i.indexBuffer&&i.indexBuffer.destroy(),i.entranceBloom.layoutVertexBuffer&&(i.entranceBloom.layoutVertexBuffer.destroy(),i.entranceBloom.layoutColorBuffer.destroy(),i.entranceBloom.layoutAttenuationBuffer.destroy(),i.entranceBloom.indexBuffer.destroy(),i.entranceBloom.segmentsBucket.destroy()))};e(this.buildingWithoutFacade),e(this.buildingWithFacade),this.groundEffect.destroy(),this.programConfigurations.destroy()}updateFootprintHiddenFlags(e,i,n=!0){let a=!1;const u=n?i:0,h=0|(n?-1:~i);this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const f of e){const _=this.footprints[f],g=_.hiddenFlags&h|u;_.hiddenFlags!==g&&(_.hiddenFlags=g,a=!0,this.groundEffect.updateHiddenByLandmarkRange(_.groundEffectVertexOffset,_.groundEffectVertexLength,_.hiddenFlags!==0))}return a&&(this.indexArrayForConflationUploaded=!1),a}uploadUpdatedIndexBuffer(e){if(this.groundEffect.uploadHiddenByLandmark(e),this.indexArrayForConflationUploaded)return;const i=a=>{a.indexArray.length!==0&&(a.indexArrayForConflation.resize(a.indexArray.length),a.indexArrayForConflation.uint16.set(a.indexArray.uint16),a.entranceBloom.indexArrayForConflation.resize(a.entranceBloom.indexArray.length),a.entranceBloom.indexArrayForConflation.uint16.set(a.entranceBloom.indexArray.uint16))};i(this.buildingWithoutFacade),i(this.buildingWithFacade);for(const a of this.footprints){const u=a.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade,h=a.indicesOffset+a.indicesLength;if(a.hiddenFlags!==0){for(let _=a.indicesOffset;_<h;_++)u.indexArrayForConflation.uint16[3*_+0]=0,u.indexArrayForConflation.uint16[3*_+1]=0,u.indexArrayForConflation.uint16[3*_+2]=0;const f=a.bloomIndicesOffset+a.bloomIndicesLength;for(let _=a.bloomIndicesOffset;_<f;_++)u.entranceBloom.indexArrayForConflation.uint16[3*_+0]=0,u.entranceBloom.indexArrayForConflation.uint16[3*_+1]=0,u.entranceBloom.indexArrayForConflation.uint16[3*_+2]=0}}const n=a=>{a.indexArray.length!==0&&(a.indexBuffer?a.indexBuffer.updateData(a.indexArrayForConflation):a.indexBuffer=e.createIndexBuffer(a.indexArrayForConflation,!0),a.entranceBloom.indexBuffer?a.entranceBloom.indexBuffer.updateData(a.entranceBloom.indexArrayForConflation):a.entranceBloom.indexBuffer=e.createIndexBuffer(a.entranceBloom.indexArrayForConflation,!0))};n(this.buildingWithoutFacade),n(this.buildingWithFacade),this.indexArrayForConflationUploaded=!0}uploadUpdatedColorBuffer(e){const i=n=>{n.layoutColorBuffer?n.layoutColorBuffer.updateData(n.layoutColorArray):n.layoutColorBuffer=e.createVertexBuffer(n.layoutColorArray,Tx.members,!0),n.layoutFacadePaintArray&&(n.layoutFacadePaintBuffer?n.layoutFacadePaintBuffer.updateData(n.layoutFacadePaintArray):n.layoutFacadePaintBuffer=e.createVertexBuffer(n.layoutFacadePaintArray,Pb.members,!0)),n.entranceBloom.layoutColorBuffer?n.entranceBloom.layoutColorBuffer.updateData(n.entranceBloom.layoutColorArray):n.entranceBloom.layoutColorBuffer=e.createVertexBuffer(n.entranceBloom.layoutColorArray,Tx.members,!0)};i(this.buildingWithoutFacade),i(this.buildingWithFacade),this.colorBufferUploaded=!0}evaluate(e,i){const n=e.paint.get("building-ambient-occlusion-intensity");for(const a of this.footprints){if(4&a.hiddenFlags)continue;const u=i[a.promoteId],h=a.feature;h.properties["building-part"]="roof";const f=e.paint.get("building-color").evaluate(h,u,this.canonical).toPremultipliedRenderColor(this.lut),_=e.paint.get("building-emissive-strength").evaluate(h,u,this.canonical);h.properties["building-part"]="wall";const g=e.paint.get("building-color").evaluate(h,u,this.canonical).toPremultipliedRenderColor(this.lut),v=e.paint.get("building-emissive-strength").evaluate(h,u,this.canonical);h.properties["building-part"]="window";const b=e.paint.get("building-color").evaluate(h,u,this.canonical).toPremultipliedRenderColor(this.lut),w=e.paint.get("building-emissive-strength").evaluate(h,u,this.canonical);h.properties["building-part"]="door";const E=e.paint.get("building-color").evaluate(h,u,this.canonical).toPremultipliedRenderColor(this.lut),I=e.paint.get("building-emissive-strength").evaluate(h,u,this.canonical),P=a.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade;for(const R of a.parts){let F,B=f;R.part===1?(B=f,F=_):R.part===0?(B=g,F=v):R.part===2?(B=b,F=w):R.part===3&&(B=E,F=I),F=Y(F,0,1);for(let V=0;V<R.vertexLength;V++){const $=R.vertexOffset+V,H=1+(P.layoutAOArray.uint8[$]/255-1)*n;P.layoutColorArray.emplace($,B.r*H*255<<8|B.g*H*255,B.b*H*255<<8|255*F),a.hasFauxFacade&&P.layoutFacadePaintArray.emplace($,255*b.r<<8|255*b.g,255*b.b<<8|255*w)}}const D=a.buildingBloom;if(D)for(let R=0;R<D.vertexLength;R++)P.entranceBloom.layoutColorArray.emplace(D.vertexOffset+R,255*E.r<<8|255*E.g,255*E.b<<8|51*I)}}needsEvaluation(){return!this.colorBufferUploaded}updateReplacement(e,i,n){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const a=i.getReplacementRegionsForTile(e.toUnwrapped());if(Dp(this.activeReplacements,a))return;this.activeReplacements=a;for(const h of this.footprints)h.hiddenFlags&=-2;const u=[];for(const h of this.activeReplacements){if(h.order<n)continue;const f=Math.max(1,Math.pow(2,h.footprintTileId.canonical.z-e.canonical.z));for(const _ of this.footprints)_.min.x>h.max.x||_.max.x<h.min.x||_.min.y>h.max.y||_.max.y<h.min.y||(u.length=0,Bb(this.footprintsVertices,_.footprintVertexOffset,_.footprintVertexLength,h.footprintTileId.canonical,e.canonical,u),x_(h.footprint,u,this.footprintsIndices.uint16,_.footprintIndexOffset,_.footprintIndexLength,0,-f)&&(_.hiddenFlags|=1))}this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const h of this.footprints)this.groundEffect.updateHiddenByLandmarkRange(h.groundEffectVertexOffset,h.groundEffectVertexLength,h.hiddenFlags!==0);this.indexArrayForConflationUploaded=!1}getFootprint(e){if(e.id!==void 0){const i=this.featureFootprintLookup.get(e.id);return this.footprints[i]}return null}getHeightAtTileCoord(e,i){let n=Number.NEGATIVE_INFINITY,a=!0;const u=4*(e+We)*We+(i+We);if(this.footprintLookup.hasOwnProperty(u)){const f=this.footprintLookup[u];return f?{height:f.height,hidden:f.hiddenFlags!==0}:void 0}const h=new Be(e,i);for(const f of this.footprints)e>f.max.x||f.min.x>e||i>f.max.y||f.min.y>i||f.height<=n||kb(h,this.footprintsVertices.float32.subarray(2*f.footprintVertexOffset,2*(f.footprintVertexOffset+f.footprintVertexLength)),this.footprintsIndices.uint16.subarray(f.footprintIndexOffset,f.footprintIndexOffset+f.footprintIndexLength))&&(n=f.height,this.footprintLookup[u]=f,a=f.hiddenFlags!==0);if(n!==Number.NEGATIVE_INFINITY)return{height:n,hidden:a};this.footprintLookup[u]=void 0}}function kb(r,e,i){for(let n=0;n<i.length;n+=3){const a=i[n],u=i[n+1],h=i[n+2],f=e[2*a+0],_=e[2*a+1],g=e[2*u+0],v=e[2*u+1],b=e[2*h+0],w=e[2*h+1],E=(f-b)*(r.y-w)-(_-w)*(r.x-b),I=(g-f)*(r.y-_)-(v-_)*(r.x-f);if(E<0!=I<0&&E!==0&&I!==0)continue;const P=(b-g)*(r.y-v)-(w-v)*(r.x-g);if(P===0||P<0==E+I<=0)return!0}return!1}function Bb(r,e,i,n,a,u){const h=Math.pow(2,n.z-a.z);for(let f=0;f<i;f++){let _=r.float32[2*(f+e)+0],g=r.float32[2*(f+e)+1];_=(_+a.x*We)*h-n.x*We,g=(g+a.y*We)*h-n.y*We,u.push(new Be(_,g))}}let Ix,Ax;nt(Ex,"BuildingBucket",{omit:["layers"]}),nt(V_,"BuildingGeometry"),nt(N_,"BuildingBloomGeometry");const Nb=Nt([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),Vb=Nt([{name:"a_z_offset_width",components:3,type:"Float32"}],4),{members:Ub}=Nb,jb=Nt([{name:"a_packed",components:3,type:"Float32"}]),{members:Gb}=jb,qb=Nt([{name:"a_pattern_data",components:3,type:"Float32"}]),{members:Hb}=qb;class Mx{constructor(e,i){this.width=e,this.height=i,this.nextRow=0,this.image=new $a({width:e,height:i}),this.positions={},this.uploaded=!1}getDash(e,i){const n=this.getKey(e,i);return this.positions[n]}trim(){const e=this.width,i=this.height=Oe(this.nextRow);this.image.resize({width:e,height:i})}getKey(e,i){return e.join(",")+i}getDashRanges(e,i,n){const a=[];let u=e.length%2==1?-e[e.length-1]*n:0,h=e[0]*n,f=!0;a.push({left:u,right:h,isDash:f,zeroLength:e[0]===0});let _=e[0];for(let g=1;g<e.length;g++){f=!f;const v=e[g];u=_*n,_+=v,h=_*n,a.push({left:u,right:h,isDash:f,zeroLength:v===0})}return a}addRoundDash(e,i,n){const a=i/2;for(let u=-n;u<=n;u++){const h=this.width*(this.nextRow+n+u);let f=0,_=e[f];for(let g=0;g<this.width;g++){g/_.right>1&&(_=e[++f]);const v=Math.abs(g-_.left),b=Math.abs(g-_.right),w=Math.min(v,b);let E;const I=u/n*(a+1);if(_.isDash){const P=a-Math.abs(I);E=Math.sqrt(w*w+P*P)}else E=a-Math.sqrt(w*w+I*I);this.image.data[h+g]=Math.max(0,Math.min(255,E+128))}}}addRegularDash(e,i){for(let _=e.length-1;_>=0;--_){const g=e[_],v=e[_+1];g.zeroLength?e.splice(_,1):v&&v.isDash===g.isDash&&(v.left=g.left,e.splice(_,1))}const n=e[0],a=e[e.length-1];n.isDash===a.isDash&&(n.left=a.left-this.width,a.right=n.right+this.width);const u=this.width*this.nextRow;let h=0,f=e[h];for(let _=0;_<this.width;_++){_/f.right>1&&(f=e[++h]);const g=Math.abs(_-f.left),v=Math.abs(_-f.right),b=Math.min(g,v);this.image.data[u+_]=Math.max(0,Math.min(255,(f.isDash?b:-b)+i+128))}}addDash(e,i){const n=this.getKey(e,i);if(this.positions[n])return this.positions[n];const a=i==="round",u=a?7:0,h=2*u+1;if(this.nextRow+h>this.height)return xt("LineAtlas out of space"),null;e.length===0&&e.push(1);let f=0;for(let v=0;v<e.length;v++)e[v]<0&&(xt("Negative value is found in line dasharray, replacing values with 0"),e[v]=0),f+=e[v];if(f!==0){const v=this.width/f,b=this.getDashRanges(e,this.width,v);a?this.addRoundDash(b,v,u):this.addRegularDash(b,i==="square"?.5*v:0)}const _=this.nextRow+u;this.nextRow+=h;const g={tl:[_,u],br:[f,0]};return this.positions[n]=g,g}}nt(Mx,"LineAtlas");const $b=Vt.types,Zb=Math.cos(Math.PI/180*37.5),Wb=Math.cos(Math.PI/180*5);class U_{constructor(e){this.evaluationGlobals={zoom:0,lineProgress:void 0},this.elevationType="none",this.zoom=e.zoom,this.evaluationGlobals.zoom=this.zoom,this.overscaling=e.overscaling,this.pixelRatio=e.pixelRatio,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.projection=e.projection,this.hasPattern=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(i=>{this.gradients[i.id]={}}),this.layoutVertexArray=new Wh,this.layoutVertexArray2=new Yn,this.patternVertexArray=new Yn,this.indexArray=new hr,this.programConfigurations=new S(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new Ci,this.maxLineLength=0,this.zOffsetVertexArray=new Yn,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.tessellationStep=e.tessellationStep?e.tessellationStep:128,this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,i){}updateAppearances(e,i,n,a){}populate(e,i,n,a){this.hasPattern=s_("line",this.layers,this.pixelRatio,i);const u=this.layers[0].layout.get("line-sort-key");this.tileToMeter=Ue(n);const h=this.layers[0].layout.get("line-elevation-reference");if(h==="hd-road-markup")this.elevationType="road";else{const w=this.layers[0].layout.get("line-z-offset"),E=w.isConstant()&&!w.constantOr(0);this.elevationType=h!=="sea"&&h!=="ground"&&E?"none":"offset",this.elevationType==="offset"&&h==="none"&&xt(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`)}const f=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope=this.elevationType==="offset"&&f!==void 0;const _=[];for(const{feature:w,id:E,index:I,sourceLayerIndex:P}of e){const D=this.layers[0]._featureFilter.needGeometry,R=Pt(w,D);if(!this.layers[0]._featureFilter.filter(new ui(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),R,n))continue;const F=u?u.evaluate(R,{},n):void 0,B={id:E,properties:w.properties,type:w.type,sourceLayerIndex:P,index:I,geometry:D?R.geometry:yt(w,n,a),patterns:{},sortKey:F};_.push(B)}u&&_.sort((w,E)=>w.sortKey-E.sortKey);const{lineAtlas:g,featureIndex:v}=i,b=this.addConstantDashes(g);for(const w of _){const{geometry:E,index:I,sourceLayerIndex:P}=w;if(b&&this.addFeatureDashes(w,g),this.hasPattern){const D=a_("line",this.layers,w,this.zoom,this.pixelRatio,i);this.patternFeatures.push(D)}else this.addFeature(w,E,I,n,g.positions,i.availableImages,i.brightness,i.elevationFeatures);v.insert(e[I].feature,E,I,P,this.index)}}addConstantDashes(e){let i=!1;for(const n of this.layers){const a=n.paint.get("line-dasharray").value,u=n.layout.get("line-cap").value;if(a.kind!=="constant"||u.kind!=="constant")i=!0;else{const h=u.value,f=a.value;if(!f)continue;e.addDash(f,h)}}return i}addFeatureDashes(e,i){const n=this.zoom;for(const a of this.layers){const u=a.paint.get("line-dasharray").value,h=a.layout.get("line-cap").value;if(u.kind==="constant"&&h.kind==="constant")continue;let f,_;if(u.kind==="constant"){if(f=u.value,!f)continue}else f=u.evaluate({zoom:n},e);_=h.kind==="constant"?h.value:h.evaluate({zoom:n},e),i.addDash(f,_),e.patterns[a.id]=[i.getKey(f,_)]}}update(e,i,n,a,u,h,f,_){this.programConfigurations.updatePaintArrays(e,i,u,n,a,h,f,_)}
8addFeatures(e,i,n,a,u,h){for(const f of this.patternFeatures)this.addFeature(f,f.geometry,f.index,i,n,a,h,e.elevationFeatures)}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,Gb)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=e.createVertexBuffer(this.patternVertexArray,Hb)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,Vb.members,!0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ub),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e,i){let n,a;if(i&&i>0?(n=`mapbox_clip_start_${i}`,a=`mapbox_clip_end_${i}`):(n="mapbox_clip_start",a="mapbox_clip_end"),e.properties&&e.properties.hasOwnProperty(n)&&e.properties.hasOwnProperty(a))return{start:+e.properties[n],end:+e.properties[a]}}addFeature(e,i,n,a,u,h,f,_){const g=this.layers[0].layout,v=g.get("line-join").evaluate(e,{}),b=g.get("line-cap").evaluate(e,{}),w=g.get("line-miter-limit"),E=g.get("line-round-limit");this.lineClips=this.lineFeatureClips(e),this.lineFeature=e;const I=!(!e.properties||!e.properties.hasOwnProperty("mapbox_line_metrics"))&&e.properties.mapbox_line_metrics;this.zOffsetValue=g.get("line-z-offset").value;const P=this.layers[0].paint.get("line-width").value;if(P.kind!=="constant"&&P.isLineProgressConstant===!1&&(this.variableWidthValue=P),this.elevationType==="road"){const D=this.layoutVertexArray.length;if(!this.addElevatedRoadFeature(e,i,a,_,v,b,w,E)){const[R,F]=this.clipRuntimeLinesToTile(i,1);for(let B=0;B<R.length;B++){const V=R[B],$=F[B],H={progress:{min:$.progress.min,max:$.progress.max},nextDir:this.computeSegNextDir($,V),prevDir:this.computeSegPrevDir($,V)};this.addLine(V,e,a,v,b,w,E,H,I&&$.parentIndex>0?$.parentIndex:null)}this.fillNonElevatedRoadSegment(D)}}else for(let D=0;D<i.length;D++)this.addLine(i[D],e,a,v,b,w,E,void 0,I&&D>0?D:null);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,u,h,a,f,void 0,this.worldview)}computeSegNextDir(e,i){return e.nextPoint.sub(i.at(-2)).unit()}computeSegPrevDir(e,i){return i[1].sub(e.prevPoint).unit()}clipLinesToTile(e,i){return Op(e,-i,-i,We+i,We+i)}clipRuntimeLinesToTile(e,i){const n=[];return[Op(e,-i,-i,We+i,We+i,n),n]}addElevatedRoadFeature(e,i,n,a,u,h,f,_){const g=[],v=tn.getElevationFeature(e,a);if(v){const b=this.clipLinesToTile(i,1),w=this.prepareElevatedLines(b,v,n);for(const E of w)g.push({geometry:E,elevation:v,elevationTileID:n,segment:{progress:{min:0,max:1},nextDir:void 0,prevDir:void 0}})}if(g.length===0)return!1;for(const b of g){const w=this.layoutVertexArray.length;this.addLine(b.geometry,e,n,u,h,f,_);const E=new Kn(n,b.elevationTileID);if(b.elevation)for(let I=w;I<this.layoutVertexArray.length;I++){const P=new Be(this.layoutVertexArray.int16[6*I]>>1,this.layoutVertexArray.int16[6*I+1]>>1),D=E.pointElevation(P,b.elevation,.05);this.updateHeightRange(D),this.zOffsetVertexArray.emplaceBack(D,0,0)}else this.fillNonElevatedRoadSegment(w)}return!0}prepareElevatedLines(e,i,n){if(i.constantHeight!=null)return e;const a=[],u=1/Ue(n);for(const h of e)ib(h,new wn(i,u),0,a);return a}fillNonElevatedRoadSegment(e){for(let i=e;i<this.layoutVertexArray.length;i++)this.zOffsetVertexArray.emplaceBack(0,0,0)}updateHeightRange(e){this.heightRange?(this.heightRange.min=Math.min(this.heightRange.min,e),this.heightRange.max=Math.max(this.heightRange.max,e)):this.heightRange={min:e,max:e}}addLine(e,i,n,a,u,h,f,_,g){this.distance=0,this.prevDistance=0,this.scaledDistance=0,this.totalDistance=0,this.totalFeatureLength=0,this.lineSoFar=0,this.currentVertex=void 0,this.lineClips=g?this.lineFeatureClips(i,g):this.lineClips;const v=a==="none";this.patternJoinNone=this.hasPattern&&v,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[];const b=_&&_.progress.min>0,w=_&&_.progress.max<1;if(this.lineClips){let K={min:this.lineClips.start,max:this.lineClips.end},re=1;
vendor: 6,303 bytes, line 8
8if(_){const we=this.lineClips.end-this.lineClips.start;K=(function(Se,Re,Ce){return{min:Sr(Se.min,Re,Ce),max:Sr(Se.max,Re,Ce)}})(_.progress,{min:0,max:1},K),we>0&&(re=(K.max-K.min)/we)}const se=+i.properties.mapbox_clip_feature_len,Ee=+i.properties.mapbox_clip_seg_len;if(Number.isNaN(se)||Number.isNaN(Ee)){for(let Se=0;Se<e.length-1;Se++)this.totalDistance+=e[Se].dist(e[Se+1]);const we=this.totalDistance/(K.max-K.min);this.totalFeatureLength=Number.isFinite(we)?we:0,this.lineClips.start=K.min,this.lineClips.end=K.max,this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}else this.totalFeatureLength=se,this.distance=Ee*re,this.lineClips.start=K.min,this.lineClips.end=K.max,this.maxLineLength=Math.max(this.maxLineLength,this.distance);this.lineClipsArray.push(this.lineClips),this.updateScaledDistance()}const E=$b[i.type]==="Polygon";let I=e.length;for(;I>=2&&e[I-1].equals(e[I-2]);)I--;let P=0;for(;P<I-1&&e[P].equals(e[P+1]);)P++;if(I<(E?3:2))return;a==="bevel"&&(h=1.05);const D=this.segments.prepareSegment(10*I,this.layoutVertexArray,this.indexArray);let R,F,B,V,$,H,J,ee;_&&_.prevDir&&(H=_.prevDir.perp()),_&&_.nextDir&&(J=_.nextDir.perp()),this.e1=this.e2=-1,E&&(R=e[I-2],$=e[P].sub(R)._unit()._perp());for(let K=P;K<I;K++){if(B=K===I-1?E?e[P+1]:void 0:e[K+1],B&&e[K].equals(B))continue;$&&(V=$),R&&(F=R),R=e[K],ee=this.evaluateLineProgressFeatures(F?F.dist(R):0),$=B?B.sub(R)._unit()._perp():V,V=V||$;const re=F&&B;let se=re?a:E||v?"butt":u;const Ee=V.x*$.x+V.y*$.y;if(v){const Ae=function(Le){if(Le.patternJoinNone){const ze=Le.segmentPoints.length/2,tt=Le.lineSoFar-Le.segmentStart;for(let it=0;it<ze;++it){const Ze=Le.segmentPoints[2*it+1],Xe=Math.round(Le.segmentPoints[2*it])+.5+.25*Ze;Le.patternVertexArray.emplaceBack(Xe,tt,Le.segmentStart),Le.patternVertexArray.emplaceBack(Xe,tt,Le.segmentStart)}Le.segmentPoints.length=0}Le.e1=Le.e2=-1};if(re&&Ee<Wb){this.updateDistance(F,R),this.addCurrentVertex(R,V,1,1,D,ee),Ae(this),this.addCurrentVertex(R,$,-1,-1,D,ee);continue}if(F){if(!B){this.updateDistance(F,R),this.addCurrentVertex(R,V,1,1,D,ee),Ae(this);continue}se="miter"}}let we=V.add($);we.x===0&&we.y===0||we._unit();const Se=we.x*$.x+we.y*$.y,Re=Se!==0?1/Se:1/0,Ce=2*Math.sqrt(2-2*Se),Pe=Se<Zb&&F&&B,ye=V.x*$.y-V.y*$.x>0,De=this.overscaling<=16?122880/(512*this.overscaling):0;if(re&&se==="round"){if(Re<f)se="miter";else if(Re<=2){const Ae=j_(R,-10,8202);se=this.elevationType==="offset"&&(Ae||this.hasCrossSlope)?"miter":"fakeround"}}if(se==="miter"&&Re>h&&(se="bevel"),se==="bevel"&&(Re>2&&(se="flipbevel"),Re<h&&(se="miter")),F&&!(se==="miter"&&Pe)&&this.updateDistance(F,R),se==="miter")if(Pe){const Ae=R.dist(F);if(Ae>2*De){const ze=R.sub(R.sub(F)._mult(De/Ae)._round());this.updateDistance(F,ze),this.addCurrentVertex(ze,V,0,0,D,ee),F=ze}this.updateDistance(F,R),we._mult(Re),this.addCurrentVertex(R,we,0,0,D,ee);const Le=R.dist(B);if(Le>2*De){const ze=R.add(B.sub(R)._mult(De/Le)._round());this.updateDistance(R,ze),this.addCurrentVertex(ze,$,0,0,D,ee),R=ze}}else we._mult(Re),this.addCurrentVertex(R,we,0,0,D,ee);else if(se==="flipbevel"){if(Re>100)we=$.mult(-1);else{const Ae=Re*V.add($).mag()/V.sub($).mag();we._perp()._mult(Ae*(ye?-1:1))}this.addCurrentVertex(R,we,0,0,D,ee),this.addCurrentVertex(R,we.mult(-1),0,0,D,ee)}else if(se==="bevel"||se==="fakeround"){ee!=null&&F&&this.addCurrentVertex(R,J||V,-1,-1,D,ee);const Ae=R.dist(F)<=2*De&&se!=="bevel",Le=we.mult(ye?1:-1);Le._mult(Re);const ze=$.mult(ye?-1:1),tt=V.mult(ye?-1:1),it=this.evaluateLineProgressFeatures(this.distance);if(ee==null&&(this.addHalfVertex(R,Le.x,Le.y,!1,!ye,0,D,it),Ae||this.addHalfVertex(R,Le.x+2*tt.x,Le.y+2*tt.y,!1,ye,0,D,it)),se==="fakeround"){const Ze=Math.round(180*Ce/Math.PI/20);this.addHalfVertex(R,tt.x,tt.y,!1,ye,0,D,it);for(let Xe=0;Xe<Ze;Xe++){let pt=Xe/Ze;if(pt!==.5){const Qe=pt-.5;pt+=pt*Qe*(pt-1)*((1.0904+Ee*(Ee*(3.55645-1.43519*Ee)-3.2452))*Qe*Qe+(.848013+Ee*(.215638*Ee-1.06021)))}const ct=ze.sub(tt)._mult(pt)._add(tt)._unit();this.addHalfVertex(R,ct.x,ct.y,!1,ye,0,D,it)}this.addHalfVertex(R,ze.x,ze.y,!1,ye,0,D,it)}Ae||ee!=null||this.addHalfVertex(R,Le.x+2*ze.x,Le.y+2*ze.y,!1,ye,0,D,it),ee!=null&&B&&this.addCurrentVertex(R,H||$,1,1,D,ee)}else if(se==="butt")this.addCurrentVertex(R,we,0,0,D,ee);else if(se==="square"){if(!F){const Ae=b?0:-1;this.addCurrentVertex(R,we,Ae,Ae,D,ee)}if(this.addCurrentVertex(R,we,0,0,D,ee),F){const Ae=w?0:1;this.addCurrentVertex(R,we,Ae,Ae,D,ee)}}else if(se==="round"){if(F){const Ae=!re&&J?J:V;this.addCurrentVertex(R,Ae,0,0,D,ee),!re&&w||this.addCurrentVertex(R,Ae,1,1,D,ee,!0)}if(B){const Ae=!re&&H?H:$;!re&&b||this.addCurrentVertex(R,Ae,-1,-1,D,ee,!0),this.addCurrentVertex(R,Ae,0,0,D,ee)}}}}addVerticesTo(e,i,n,a,u,h,f,_,g,v){const b=(i.w-e.w)/this.tessellationStep|0;let w=0;const E=this.scaledDistance;if(b>1){this.lineSoFar=e.w;const P=(i.x-e.x)/b,D=(i.y-e.y)/b,R=(i.z-e.z)/b,F=(i.w-e.w)/b;for(let B=1;B<b;++B){e.x+=P,e.y+=D,e.z+=R,this.lineSoFar+=F,w+=F;const V=this.evaluateLineProgressFeatures(this.prevDistance+w);this.scaledDistance=(this.prevDistance+w)/this.totalDistance,this.addHalfVertex(e,n,a,v,!1,f,g,V),this.addHalfVertex(e,u,h,v,!0,-_,g,V)}}this.lineSoFar=i.w,this.scaledDistance=E;const I=this.evaluateLineProgressFeatures(this.distance);this.addHalfVertex(i,n,a,v,!1,f,g,I),this.addHalfVertex(i,u,h,v,!0,-_,g,I)}evaluateLineProgressFeatures(e){if(!this.variableWidthValue&&this.elevationType!=="offset")return null;this.evaluationGlobals.lineProgress=0,this.lineClips?this.evaluationGlobals.lineProgress=Math.min(1,(this.totalFeatureLength*this.lineClips.start+e)/this.totalFeatureLength):xt(`line-progress evaluation for ${this.layerIds[0]} requires enabling 'lineMetrics' for the source.`);let i=0;return this.variableWidthValue&&this.variableWidthValue.kind!=="constant"&&(i=this.variableWidthValue.evaluate(this.evaluationGlobals,this.lineFeature)||0),this.elevationType!=="offset"?{zOffset:0,variableWidth:i}:this.zOffsetValue.kind==="constant"?{zOffset:this.zOffsetValue.value,variableWidth:i}:{zOffset:this.zOffsetValue.evaluate(this.evaluationGlobals,this.lineFeature)||0,variableWidth:i}}addCurrentVertex(e,i,n,a,u,h,f=!1){const _=i.x+i.y*n,g=i.y-i.x*n,v=i.y*a-i.x,b=-i.y-i.x*a;if(h!=null){const w=this.elevationType==="offset",E=-10,I=8202,P=h.zOffset,D=new qy(e.x,e.y,P,this.lineS
8oFar),R=!!w&&j_(e,E,I),F=this.lineSoFar,B=this.distance;if(this.currentVertex)if(R){const V=this.currentVertexIsOutside,$=this.currentVertex,H=new qy(e.x,e.y,P,this.lineSoFar);if($y($,H,E,I),!j_(H,E,I)){if(V){this.e1=this.e2=-1,this.distance-=$.dist(D),this.lineSoFar=$.w;const J=this.evaluateLineProgressFeatures($.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex($,_,g,f,!1,n,u,J),this.addHalfVertex($,v,b,f,!0,-a,u,J),this.prevDistance=this.distance}this.distance=this.prevDistance+$.dist(H),this.scaledDistance=this.distance/this.totalDistance,this.addVerticesTo($,H,_,g,v,b,n,a,u,f),this.distance=B,this.scaledDistance=this.distance/this.totalDistance}}else{const V=this.currentVertex;if(this.currentVertexIsOutside){$y(V,D,E,I),this.e1=this.e2=-1,this.distance-=V.dist(D),this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=V.w;const $=this.evaluateLineProgressFeatures(V.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(V,_,g,f,!1,n,u,$),this.addHalfVertex(V,v,b,f,!0,-a,u,$),this.prevDistance=this.distance,this.distance=B,this.scaledDistance=this.distance/this.totalDistance}this.addVerticesTo(V,D,_,g,v,b,n,a,u,f)}else R||(this.addHalfVertex(e,_,g,f,!1,n,u,h),this.addHalfVertex(e,v,b,f,!0,-a,u,h));this.currentVertex=D,this.currentVertexIsOutside=R,this.lineSoFar=F}else this.addHalfVertex(e,_,g,f,!1,n,u,h),this.addHalfVertex(e,v,b,f,!0,-a,u,h)}addHalfVertex({x:e,y:i},n,a,u,h,f,_,g){if(this.patternJoinNone&&(this.segmentPoints.length===0&&(this.segmentStart=this.lineSoFar,this.segmentStartf32=Math.fround(this.lineSoFar)),h||this.segmentPoints.push(this.lineSoFar-this.segmentStart,f)),this.layoutVertexArray.emplaceBack((e<<1)+(u?1:0),(i<<1)+(h?1:0),Math.round(63*n)+128,Math.round(63*a)+128,1+(f===0?0:f<0?-1:1),0,this.lineSoFar-this.segmentStartf32),this.lineClips){const b=_t(this.lineClips.start,this.lineClips.end,this.scaledDistance);this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,b)}const v=_.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,v),_.primitiveLength++),h?this.e2=v:this.e1=v,g!=null&&this.zOffsetVertexArray.emplaceBack(g.zOffset,g.variableWidth,g.variableWidth)}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(e,i){this.prevDistance=this.distance,this.distance+=e.dist(i),this.updateScaledDistance()}}function j_(r,e,i){return r.x<e||r.x>i||r.y<e||r.y>i}let Cx,Px;function Rx(r,e,i){return e*(We/(r.tileSize*Math.pow(2,i-r.tileID.overscaledZ)))}nt(U_,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const zx=(r,e,i)=>(1-i)*r+i*e;function Dx(r,e){return 1/Rx(r,1,e.tileZoom)}function Lx(r,e,i,n){return r.translatePosMatrix(n||e.tileID.projMatrix,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const Fx=r=>{const e=[];Ox(r)&&e.push("RENDER_LINE_DASH"),r.paint.get("line-gradient")&&e.push("RENDER_LINE_GRADIENT");const i=r.paint.get("line-trim-offset");i[0]===0&&i[1]===0||e.push("RENDER_LINE_TRIM_OFFSET"),r.paint.get("line-border-width").constantOr(1)!==0&&e.push("RENDER_LINE_BORDER");const n=r.layout.get("line-join").constantOr("miter")==="none",a=!!r.paint.get("line-pattern").constantOr(1);return n&&a&&e.push("LINE_JOIN_NONE"),e};function Ox(r){const e=r.paint.get("line-dasharray").value;return e.kind!=="constant"||e.value}let G_;
vendor: 6,389 bytes, line 8
8const kx=()=>G_||(G_={layout:Cx||(Cx=new Bi({"line-cap":new Je(fe.layout_line["line-cap"]),"line-join":new Je(fe.layout_line["line-join"]),"line-miter-limit":new Ge(fe.layout_line["line-miter-limit"]),"line-round-limit":new Ge(fe.layout_line["line-round-limit"]),"line-sort-key":new Je(fe.layout_line["line-sort-key"]),"line-z-offset":new Je(fe.layout_line["line-z-offset"]),"line-elevation-reference":new Ge(fe.layout_line["line-elevation-reference"]),"line-cross-slope":new Ge(fe.layout_line["line-cross-slope"]),visibility:new Ge(fe.layout_line.visibility),"line-width-unit":new Ge(fe.layout_line["line-width-unit"])})),paint:Px||(Px=new Bi({"line-opacity":new Je(fe.paint_line["line-opacity"]),"line-color":new Je(fe.paint_line["line-color"]),"line-translate":new Ge(fe.paint_line["line-translate"]),"line-translate-anchor":new Ge(fe.paint_line["line-translate-anchor"]),"line-width":new Je(fe.paint_line["line-width"]),"line-gap-width":new Je(fe.paint_line["line-gap-width"]),"line-offset":new Je(fe.paint_line["line-offset"]),"line-blur":new Je(fe.paint_line["line-blur"]),"line-dasharray":new Je(fe.paint_line["line-dasharray"]),"line-pattern":new Je(fe.paint_line["line-pattern"]),"line-pattern-cross-fade":new Ge(fe.paint_line["line-pattern-cross-fade"]),"line-gradient":new Oa(fe.paint_line["line-gradient"]),"line-trim-offset":new Ge(fe.paint_line["line-trim-offset"]),"line-trim-fade-range":new Ge(fe.paint_line["line-trim-fade-range"]),"line-trim-color":new Ge(fe.paint_line["line-trim-color"]),"line-emissive-strength":new Je(fe.paint_line["line-emissive-strength"]),"line-border-width":new Je(fe.paint_line["line-border-width"]),"line-border-color":new Je(fe.paint_line["line-border-color"]),"line-occlusion-opacity":new Ge(fe.paint_line["line-occlusion-opacity"]),"line-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},G_);class Xb extends Je{possiblyEvaluate(e,i){return i=new ui(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,transition:i.transition,worldview:i.worldview}),super.possiblyEvaluate(e,i)}evaluate(e,i,n,a){return i=Object.assign({},i,{zoom:Math.floor(i.zoom)}),super.evaluate(e,i,n,a)}}let Sd;function Bx(r,e){return e>0?e+2*r:r}const Yb=Nt([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Kb=Nt([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),Jb=Nt([{name:"a_projected_pos",components:4,type:"Float32"}],4);Nt([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Qb=Nt([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),ew=Nt([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),tw=Nt([{name:"a_texb",components:2,type:"Uint16"}]),iw=Nt([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),rw=Nt([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);Nt([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Nx=Nt([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),nw=Nt([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);Nt([{name:"triangle",components:3,type:"Uint16"}]),Nt([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{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"},{type:"Uint8",name:"flipState"}]),Nt([{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{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",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Float32",name:"zOffset"},{type:"Uint8",name:"hasIconTextFit"},{type:"Uint16",name:"elevationFeatureIndex"}
vendor: 10,465 bytes, line 8
8]),Nt([{type:"Float32",name:"offsetX"}]),Nt([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var br=24;function ow(r,e,i){return r.sections.forEach(n=>{n.text=(function(a,u,h){const f=u.layout.get("text-transform").evaluate(h,{});return f==="uppercase"?a=a.toLocaleUpperCase():f==="lowercase"&&(a=a.toLocaleLowerCase()),oo.applyArabicShaping&&(a=oo.applyArabicShaping(a)),a})(n.text,e,i)}),r}const Ed={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function sw(r){return r==="︶"||r==="﹈"||r==="︸"||r==="﹄"||r==="﹂"||r==="︾"||r==="︼"||r==="︺"||r==="︘"||r==="﹀"||r==="︐"||r==="︓"||r==="︔"||r==="`"||r===" ̄"||r==="︑"||r==="︒"}function aw(r){return r==="︵"||r==="﹇"||r==="︷"||r==="﹃"||r==="﹁"||r==="︽"||r==="︻"||r==="︹"||r==="︗"||r==="︿"}const q_=4294967296,Vx=1/q_,Ux=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");let Zp=class{constructor(r=new Uint8Array(16)){this.buf=ArrayBuffer.isView(r)?r:new Uint8Array(r),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(r,e,i=this.length){for(;this.pos<i;){const n=this.readVarint(),a=n>>3,u=this.pos;this.type=7&n,r(a,e,this),this.pos===u&&this.skip(n)}return e}readMessage(r,e){return this.readFields(r,e,this.readVarint()+this.pos)}readFixed32(){const r=this.dataView.getUint32(this.pos,!0);return this.pos+=4,r}readSFixed32(){const r=this.dataView.getInt32(this.pos,!0);return this.pos+=4,r}readFixed64(){const r=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*q_;return this.pos+=8,r}readSFixed64(){const r=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*q_;return this.pos+=8,r}readFloat(){const r=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,r}readDouble(){const r=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,r}readVarint(r){const e=this.buf;let i,n;return n=e[this.pos++],i=127&n,n<128?i:(n=e[this.pos++],i|=(127&n)<<7,n<128?i:(n=e[this.pos++],i|=(127&n)<<14,n<128?i:(n=e[this.pos++],i|=(127&n)<<21,n<128?i:(n=e[this.pos],i|=(15&n)<<28,(function(a,u,h){const f=h.buf;let _,g;if(g=f[h.pos++],_=(112&g)>>4,g<128||(g=f[h.pos++],_|=(127&g)<<3,g<128)||(g=f[h.pos++],_|=(127&g)<<10,g<128)||(g=f[h.pos++],_|=(127&g)<<17,g<128)||(g=f[h.pos++],_|=(127&g)<<24,g<128)||(g=f[h.pos++],_|=(1&g)<<31,g<128))return yu(a,_,u);throw new Error("Expected varint not more than 10 bytes")})(i,r,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const r=this.readVarint();return r%2==1?(r+1)/-2:r/2}readBoolean(){return!!this.readVarint()}readString(){const r=this.readVarint()+this.pos,e=this.pos;return this.pos=r,r-e>=12&&Ux?Ux.decode(this.buf.subarray(e,r)):(function(i,n,a){let u="",h=n;for(;h<a;){const f=i[h];let _,g,v,b=null,w=f>239?4:f>223?3:f>191?2:1;if(h+w>a)break;w===1?f<128&&(b=f):w===2?(_=i[h+1],(192&_)==128&&(b=(31&f)<<6|63&_,b<=127&&(b=null))):w===3?(_=i[h+1],g=i[h+2],(192&_)==128&&(192&g)==128&&(b=(15&f)<<12|(63&_)<<6|63&g,(b<=2047||b>=55296&&b<=57343)&&(b=null))):w===4&&(_=i[h+1],g=i[h+2],v=i[h+3],(192&_)==128&&(192&g)==128&&(192&v)==128&&(b=(15&f)<<18|(63&_)<<12|(63&g)<<6|63&v,(b<=65535||b>=1114112)&&(b=null))),b===null?(b=65533,w=1):b>65535&&(b-=65536,u+=String.fromCharCode(b>>>10&1023|55296),b=56320|1023&b),u+=String.fromCharCode(b),h+=w}return u})(this.buf,e,r)}readBytes(){const r=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,r);return this.pos=r,e}readPackedVarint(r=[],e){const i=this.readPackedEnd();for(;this.pos<i;)r.push(this.readVarint(e));return r}readPackedSVarint(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readSVarint());return r}readPackedBoolean(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readBoolean());return r}readPackedFloat(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readFloat());return r}readPackedDouble(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readDouble());return r}readPackedFixed32(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readFixed32());return r}readPackedSFixed32(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readSFixed32());return r}readPackedFixed64(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readFixed64());return r}readPackedSFixed64(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readSFixed64());return r}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}skip(r){const e=7&r;if(e===0)for(;this.buf[this.pos++]>127;);else if(e===2)this.pos=this.readVarint()+this.pos;else if(e===5)this.pos+=4;else{if(e!==1)throw new Error(`Unimplemented type: ${e}`);this.pos+=8}}writeTag(r,e){this.writeVarint(r<<3|e)}realloc(r){let e=this.length||16;for(;e<this.pos+r;)e*=2;if(e!==this.length){const i=new Uint8Array(e);i.set(this.buf),this.buf=i,this.dataView=new DataView(i.buffer),this.length=e}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(r){this.realloc(4),this.dataView.setInt32(this.pos,r,!0),this.pos+=4}writeSFixed32(r){this.realloc(4),this.dataView.setInt32(this.pos,r,!0),this.pos+=4}writeFixed64(r){this.realloc(8),this.dataView.setInt32(this.pos,-1&r,!0),this.dataView.setInt32(this.pos+4,Math.floor(r*Vx),!0),this.pos+=8}writeSFixed64(r){this.realloc(8),this.dataView.setInt32(this.pos,-1&r,!0),this.dataView.setInt32(this.pos+4,Math.floor(r*Vx),!0),this.pos+=8}writeVarint(r){(r=+r||0)>268435455||r<0?(function(e,i){let n,a;if(e>=0?(n=e%4294967296|0,a=e/4294967296|0):(n=~(-e%4294967296),a=~(-e/4294967296),4294967295^n?n=n+1|0:(n=0,a=a+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");i.realloc(10),(function(u,h,f){f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,f.buf[f.pos]=127&(u>>>=7)})(n,0,i),(function(u,h){const f=(7&u)<<4;h.buf[h.pos++]|=f|((u>>>=3)?128:0),u&&(h.buf[h.pos++]=127&u|((u>>>=7)?128:0),u&&(h.buf[h.pos++]=127&u|((u>>>=7)?128:0),u&&(h.buf[h.pos++]=127&u|((u>>>=7)?128:0),u&&(h.buf[h.pos++]=127&u|((u>>>=7)?128:0),u&&(h.buf[h.pos++]=127&u)))))})(a,i)})(r,this):(this.realloc(4),this.buf[this.pos++]=127&r|(r>127?128:0),r<=127||(this.buf[this.pos++]=127&(r>>>=7)|(r>127?128:0),r<=127||(this.buf[this.pos++]=127&(r>>>=7)|(r>127?128:0),r<=127||(this.buf[this.pos++]=r>>>7&127))))}writeSVarint(r){this.writeVarint(r<0?2*-r-1:2*r)}writeBoolean(r){this.writeVarint(+r)}writeString(r){r=String(r),this.realloc(4*r.length),this.pos++;const e=this.pos;this.pos=(function(n,a,u){for(let h,f,_=0;_<a.length;_++){if(h=a.charCodeAt(_),h>55295&&h<57344){if(!f){h>56319||_+1===a.length?(n[u++]=239,n[u++]=191,n[u++]=189):f=h;continue}if(h<56320){n[u++]=239,n[u++]=191,n[u++]=189,f=h;continue}h=f-55296<<10|h-56320|65536,f=null}else f&&(n[u++]=239,n[u++]=191,n[u++]=189,f=null);h<128?n[u++]=h:(h<2048?n[u++]=h>>6|192:(h<65536?n[u++]=h>>12|224:(n[u++]=h>>18|240,n[u++]=h>>12&63|128),n[u++]=h>>6&63|128),n[u++]=63&h|128)}return u})(this.buf,r,this.pos);const i=this.pos-e;i>=128&&jx(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i}writeFloat(r){this.realloc(4),this.dataView.setFloat32(this.pos,r,!0),this.pos+=4}writeDouble(r){this.realloc(8),this.dataView.setFloat64(this.pos,r,!0),this.pos+=8}writeBytes(r){const e=r.length;this.writeVarint(e),this.realloc(e);for(let i=0;i<e;i++)this.buf[this.pos++]=r[i]}writeRawMessage(r,e){this.pos++;const i=this.pos;r(e,this);const n=this.pos-i;n>=128&&jx(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n}writeMessage(r,e,i){this.writeTag(r,2),this.writeRawMessage(e,i)}writePackedVarint(r,e){e.length&&this.writeMessage(r,lw,e)}writePackedSVarint(r,e){e.length&&this.writeMessage(r,cw,e)}writePackedBoolean(r,e){e.length&&this.writeMessage(r,dw,e)}writePackedFloat(r,e){e.length&&this.writeMessage(r,uw,e)}writePackedDouble(r,e){e.length&&this.writeMessage(r,hw,e)}writePackedFixed32(r,e){e.length&&this.writeMessage(r,fw,e)}writePackedSFixed32(r,e){e.length&&this.writeMessage(r,pw,e)}writePackedFixed64(r,e){e.length&&this.writeMessage(r,mw,e)}writePackedSFixed64(r,e){e.length&&this.writeMessage(r,_w,e)}writeBytesField(r,e){this.writeTag(r,2),this.writeBytes(e)}writeFixed32Field(r,e){this.writeTag(r,5),this.writeFixed32(e)}writeSFixed32Field(r,e){this.writeTag(r,5),this.writeSFixed32(e)}writeFixed64Field(r,e){this.writeTag(r,1),this.writeFixed64(e)}writeSFixed64Field(r,e){this.writeTag(r,1),this.writeSFixed64(e)}writeVarintField(r,e){this.writeTag(r,0),this.writeVarint(e)}writeSVarintField(r,e){this.writeTag(r,0),this.writeSVarint(e)}writeStringField(r,e){this.writeTag(r,2),this.writeString(e)}writeFloatField(r,e){this.writeTag(r,5),this.writeFloat(e)}writeDoubleField(r,e){this.writeTag(r,1),this.writeDouble(e)}writeBooleanField(r,e){this.writeVarintField(r,+e)}};function yu(r,e,i){return i?4294967296*e+(r>>>0):4294967296*(e>>>0)+(r>>>0)}function jx(r,e,i){const n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(n);for(let a=i.pos-1;a>=r;a--)i.buf[a+n]=i.buf[a]}function lw(r,e){for(let i=0;i<r.length;i++)e.writeVarint(r[i])}function cw(r,e){for(let i=0;i<r.length;i++)e.writeSVarint(r[i])}function uw(r,e){for(let i=0;i<r.length;i++)e.writeFloat(r[i])}function hw(r,e){for(let i=0;i<r.length;i++)e.writeDouble(r[i])}function dw(r,e){for(let i=0;i<r.length;i++)e.writeBoolean(r[i])}function fw(r,e){for(let i=0;i<r.length;i++)e.writeFixed32(r[i])}function pw(r,e){for(let i=0;i<r.length;i++)e.writeSFixed32(r[i])}function mw(r,e){for(let i=0;i<r.length;
8i++)e.writeFixed64(r[i])}function _w(r,e){for(let i=0;i<r.length;i++)e.writeSFixed64(r[i])}function gw(r,e,i){e.glyphs=[],r===1&&i.readMessage(yw,e)}function yw(r,e,i){if(r===3){const{id:n,bitmap:a,width:u,height:h,left:f,top:_,advance:g}=i.readMessage(xw,{});e.glyphs.push({id:n,bitmap:new $a({width:u+6,height:h+6},a),metrics:{width:u,height:h,left:f,top:_,advance:g}})}else r===4?e.ascender=i.readSVarint():r===5&&(e.descender=i.readSVarint())}function xw(r,e,i){r===1?e.id=i.readVarint():r===2?e.bitmap=i.readBytes():r===3?e.width=i.readVarint():r===4?e.height=i.readVarint():r===5?e.left=i.readSVarint():r===6?e.top=i.readSVarint():r===7&&(e.advance=i.readVarint())}const jn={horizontal:1,vertical:2,horizontalOnly:3};class Id{constructor(){this.scale=1,this.fontStack="",this.image=null}static forText(e,i){const n=new Id;return n.scale=e||1,n.fontStack=i,n}static forImage(e){const i=new Id;return i.image=e,i}}class xu{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,i,n){const a=new xu;for(let u=0;u<e.sections.length;u++){const h=e.sections[u];h.image?a.addImageSection(h,n):a.addTextSection(h,i)}return a}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSections(){return this.sections}getSectionIndex(e){return this.sectionIndex[e]}getCodePoint(e){return this.text.codePointAt(e)}verticalizePunctuation(e){this.text=(function(i,n){let a="";for(let u=0;u<i.length;u++){const h=i.charCodeAt(u+1)||null,f=i.charCodeAt(u-1)||null;a+=!n&&(h&&Dh(h)&&!Ed[i[u+1]]||f&&Dh(f)&&!Ed[i[u-1]])||!Ed[i[u]]?i[u]:Ed[i[u]]}return a})(this.text,e)}trim(){let e=0;for(let n=0;n<this.text.length&&Wp[this.text.charCodeAt(n)];n++)e++;let i=this.text.length;for(let n=this.text.length-1;n>=0&&n>=e&&Wp[this.text.charCodeAt(n)];n--)i--;this.text=this.text.substring(e,i),this.sectionIndex=this.sectionIndex.slice(e,i)}substring(e,i){const n=new xu;return n.text=this.text.substring(e,i),n.sectionIndex=this.sectionIndex.slice(e,i),n.sections=this.sections,n}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,i)=>Math.max(e,this.sections[i].scale),0)}addTextSection(e,i){this.text+=e.text,this.sections.push(Id.forText(e.scale,e.fontStack||i));const n=this.sections.length-1;for(let a=0;a<e.text.length;++a)this.sectionIndex.push(n)}addImageSection(e,i){const n=e.image?e.image.getPrimary():null;if(!n)return void xt("Can't add FormattedSection with an empty image.");n.scaleSelf(i);const a=this.getNextImageSectionCharCode();a?(this.text+=String.fromCodePoint(a),this.sections.push(Id.forImage(n)),this.sectionIndex.push(this.sections.length-1)):xt("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function H_(r,e,i,n,a,u,h,f,_,g,v,b,w,E,I,P=1){const D=xu.fromFeature(r,a,P);
8b===jn.vertical&&D.verticalizePunctuation(w);let R=[];const F=(function(J,ee,K,re,se,Ee){if(!J)return[];const we=[],Se=(function(Pe,ye,De,Ae,Le,ze){let tt=0;for(let it=0;it<Pe.length();it++){const Ze=Pe.getSection(it);tt+=Gx(Pe.getCodePoint(it),Ze,Ae,Le,ye,ze)}return tt/Math.max(1,Math.ceil(tt/De))})(J,ee,K,re,se,Ee),Re=J.text.indexOf("​")>=0;let Ce=0;for(let Pe=0;Pe<J.length();Pe++){const ye=J.getSection(Pe),De=J.getCodePoint(Pe);if(Wp[De]||(Ce+=Gx(De,ye,re,se,ee,Ee)),Pe<J.length()-1){const Ae=Gf(De);(vw[De]||Ae||ye.image)&&we.push(Hx(Pe+1,Ce,Se,we,bw(De,J.getCodePoint(Pe+1),Ae&&Re),!1))}}return $x(Hx(J.length(),Ce,Se,we,0,!0))})(D,g,u,e,n,E),{processBidirectionalText:B,processStyledBidirectionalText:V}=oo;if(B&&D.sections.length===1){const J=B(D.toString(),F);for(const ee of J){const K=new xu;K.text=ee,K.sections=D.sections;for(let re=0;re<ee.length;re++)K.sectionIndex.push(0);R.push(K)}}else if(V){const J=V(D.text,D.sectionIndex,F);for(const ee of J){const K=new xu;K.text=ee[0],K.sectionIndex=ee[1],K.sections=D.sections,R.push(K)}}else R=(function(J,ee){const K=[],re=J.text;let se=0;for(const Ee of ee)K.push(J.substring(se,Ee)),se=Ee;return se<re.length&&K.push(J.substring(se,re.length)),K})(D,F);const $=[],H={positionedLines:$,text:D.toString(),top:v[1],bottom:v[1],left:v[0],right:v[0],writingMode:b,iconsInText:!1,verticalizable:!1,hasBaseline:!1};if((function(J,ee,K,re,se,Ee,we,Se,Re,Ce,Pe,ye){let De=0,Ae=0,Le=0;const ze=Se==="right"?1:Se==="left"?0:.5;let tt=!1;for(const ct of se){const Qe=ct.getSections();for(const bt of Qe){if(bt.image)continue;const Ot=ee[bt.fontStack];if(Ot&&(tt=Ot.ascender!==void 0&&Ot.descender!==void 0,!tt))break}if(!tt)break}let it=0;for(const ct of se){ct.trim();const Qe=ct.getMaxScale(),bt=(Qe-1)*br,Ot={positionedGlyphs:[],lineOffset:0};J.positionedLines[it]=Ot;const Kt=Ot.positionedGlyphs;let Lt=0;if(!ct.length()){Ae+=Ee,++it;continue}let hi=0,qt=0;for(let Wt=0;Wt<ct.length();Wt++){const ai=ct.getSection(Wt),Si=ct.getSectionIndex(Wt),Li=ct.getCodePoint(Wt);let Fi=ai.scale,Wi=null,Ar=null,Nr=null,sr=br,fr=0,yr=Re;yr===jn.vertical&&qf(Li)&&(yr=jn.horizontal);const Rt=!(yr===jn.horizontal||!Pe&&!vs(Li)||Pe&&(Wp[Li]||Kc(Li)));if(ai.image){const Oi=re.get(ai.image.toString());if(!Oi)continue;Nr=ai.image,J.iconsInText=J.iconsInText||!0,Ar=Oi.paddedRect;const Vi=Oi.displaySize;Fi=Fi*br/ye,Wi={width:Vi[0],height:Vi[1],left:0,top:-3,advance:Rt?Vi[1]:Vi[0],localGlyph:!1},fr=tt?-Wi.height*Fi:Qe*br-17-Vi[1]*Fi,sr=Wi.advance;const Gn=(Rt?Vi[0]:Vi[1])*Fi-br*Qe;Gn>0&&Gn>Lt&&(Lt=Gn)}else{const Oi=K[ai.fontStack];if(!Oi)continue;Oi[Li]&&(Ar=Oi[Li]);const Vi=ee[ai.fontStack];if(!Vi)continue;const Gn=Vi.glyphs[Li];if(!Gn)continue;if(Wi=Gn.metrics,sr=Li!==8203?br:0,tt){const on=Vi.ascender!==void 0?Math.abs(Vi.ascender):0,Mr=Vi.descender!==void 0?Math.abs(Vi.descender):0,sn=(on+Mr)*Fi;hi<sn&&(hi=sn,qt=(on-Mr)/2*Fi),fr=-on*Fi}else fr=(Qe-Fi)*br-17}Rt?(J.verticalizable=!0,Kt.push({glyph:Li,image:Nr,x:De,y:Ae+fr,vertical:Rt,scale:Fi,localGlyph:Wi.localGlyph,fontStack:ai.fontStack,sectionIndex:Si,metrics:Wi,rect:Ar}),De+=sr*Fi+Ce):(Kt.push({glyph:Li,image:Nr,x:De,y:Ae+fr,vertical:Rt,scale:Fi,localGlyph:Wi.localGlyph,fontStack:ai.fontStack,sectionIndex:Si,metrics:Wi,rect:Ar}),De+=Wi.advance*Fi+Ce)}Kt.length!==0&&(Le=Math.max(De-Ce,Le),tt?Zx(Kt,ze,Lt,qt,Ee*Qe/2):Zx(Kt,ze,Lt,0,Ee/2)),De=0;const Zi=Ee*Qe+Lt;Ot.lineOffset=Math.max(Lt,bt),Ae+=Zi,++it}const Ze=Ae,{horizontalAlign:Xe,verticalAlign:pt}=$_(we);(function(ct,Qe,bt,Ot,Kt,Lt){const hi=(Qe-bt)*Kt,qt=-Lt*Ot;for(const Zi of ct)for(const Wt of Zi.positionedGlyphs)Wt.x+=hi,Wt.y+=qt})(J.positionedLines,ze,Xe,pt,Le,Ze),J.top+=-pt*Ze,J.bottom=J.top+Ze,J.left+=-Xe*Le,J.right=J.left+Le,J.hasBaseline=tt})(H,e,i,n,R,h,f,_,b,g,w,I),!(function(J){for(const ee of J)if(ee.positionedGlyphs.length!==0)return!1;return!0})($))return H}const Wp={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},vw={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 Gx(r,e,i,n,a,u){if(e.image){const h=n.get(e.image.toString());return h?h.displaySize[0]*e.scale*br/u+a:0}{const h=i[e.fontStack],f=h&&h.glyphs[r];return f?f.metrics.advance*e.scale+a:0}}function qx(r,e,i,n){const a=Math.pow(r-e,2);return n?r<e?a/2:2*a:a+Math.abs(i)*i}function bw(r,e,i){let n=0;return r===10&&(n-=1e4),i&&(n+=150),r!==40&&r!==65288||(n+=50),e!==41&&e!==65289||(n+=50),n}function Hx(r,e,i,n,a,u){let h=null,f=qx(e,i,a,u);for(const _ of n){const g=qx(e-_.x,i,a,u)+_.badness;g<=f&&(h=_,f=g)}return{index:r,x:e,priorBreak:h,badness:f}}function $x(r){return r?$x(r.priorBreak).concat(r.index):[]}function $_(r){let e=.5,i=.5;
vendor: 13,669 bytes, line 8
8switch(r){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(r){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:e,verticalAlign:i}}function Zx(r,e,i,n,a){if(!(e||i||n||a))return;const u=r.length-1,h=r[u],f=(h.x+h.metrics.advance*h.scale)*e;for(let _=0;_<=u;_++)r[_].x-=f,r[_].y+=i+n+a}function Z_(r){return r.imagePrimary!==void 0&&r.top!==void 0&&r.bottom!==void 0&&r.left!==void 0&&r.right!==void 0}function Xp(r,e,i,n){const{horizontalAlign:a,verticalAlign:u}=$_(n),h=i[0]-r.displaySize[0]*a,f=i[1]-r.displaySize[1]*u;return{imagePrimary:r,imageSecondary:e,top:f,bottom:f+r.displaySize[1],left:h,right:h+r.displaySize[0]}}function W_(r,e,i,n,a,u){const h=r.imagePrimary;let f;if(h.content){const D=h.content,R=h.pixelRatio||1;f=[D[0]/R,D[1]/R,h.displaySize[0]-D[2]/R,h.displaySize[1]-D[3]/R]}const _=e.left*u,g=e.right*u;let v,b,w,E;i==="width"||i==="both"?(E=a[0]+_-n[3],b=a[0]+g+n[1]):(E=a[0]+(_+g-h.displaySize[0])/2,b=E+h.displaySize[0]);const I=e.top*u,P=e.bottom*u;return i==="height"||i==="both"?(v=a[1]+I-n[0],w=a[1]+P+n[2]):(v=a[1]+(I+P-h.displaySize[1])/2,w=v+h.displaySize[1]),{imagePrimary:h,imageSecondary:void 0,top:v,right:b,bottom:w,left:E,collisionPadding:f}}function Wx(r){return!r.imagePrimary.stretchX}function Xx(r){return!r.imagePrimary.stretchY}function Yx(r){return{width:r.right-r.left,height:r.bottom-r.top}}const oa=128;function ic(r,e,i,n){const{expression:a}=e;if(a.kind==="constant")return{kind:"constant",layoutSize:a.evaluate(new ui(r+1,{worldview:i}),void 0,void 0,void 0,n)};if(a.kind==="source")return{kind:"source"};{const{zoomStops:u,interpolationType:h}=a;let f=0;for(;f<u.length&&u[f]<=r;)f++;f=Math.max(0,f-1);let _=f;for(;_<u.length&&u[_]<r+1;)_++;_=Math.min(u.length-1,_);const g=u[f],v=u[_];return a.kind==="composite"?{kind:"composite",minZoom:g,maxZoom:v,interpolationType:h}:{kind:"camera",minZoom:g,maxZoom:v,minSize:a.evaluate(new ui(g,{worldview:i}),void 0,void 0,void 0,n),maxSize:a.evaluate(new ui(v,{worldview:i}),void 0,void 0,void 0,n),interpolationType:h}}}function X_(r,{uSize:e,uSizeT:i},{lowerSize:n,upperSize:a}){return r.kind==="source"?n/oa:r.kind==="composite"?_t(n/oa,a/oa,i):e}function vu(r,e,i=1){let n=0,a=0;if(r.kind==="constant")a=r.layoutSize*i;else if(r.kind!=="source"){const{interpolationType:u,minZoom:h,maxZoom:f}=r,_=u?Y(Fn.interpolationFactor(u,e,h,f),0,1):0;r.kind==="camera"?a=_t(r.minSize,r.maxSize,_)*i:n=_*i}return{uSizeT:n,uSize:a}}class sa extends Be{constructor(e,i,n,a,u){super(e,i),this.angle=a,this.z=n,u!==void 0&&(this.segment=u)}clone(){return new sa(this.x,this.y,this.z,this.angle,this.segment)}}function Kx(r,e,i,n,a){if(e.segment===void 0)return!0;let u=e,h=e.segment+1,f=0;for(;f>-i/2;){if(h--,h<0)return!1;f-=r[h].dist(u),u=r[h]}f+=r[h].dist(r[h+1]),h++;const _=[];let g=0;for(;f<i/2;){const v=r[h],b=r[h+1];if(!b)return!1;let w=r[h-1].angleTo(v)-v.angleTo(b);for(w=Math.abs((w+3*Math.PI)%(2*Math.PI)-Math.PI),_.push({distance:f,angleDelta:w}),g+=w;f-_[0].distance>n;)g-=_.shift().angleDelta;if(g>a)return!1;h++,f+=v.dist(b)}return!0}function Jx(r){let e=0;for(let i=0;i<r.length-1;i++)e+=r[i].dist(r[i+1]);return e}function Qx(r,e,i){return r?.6*e*i:0}function ev(r,e){return Math.max(r?r.right-r.left:0,e?e.right-e.left:0)}function ww(r,e,i,n,a,u){const h=Qx(i,a,u),f=ev(i,n)*u;let _=0;const g=Jx(r)/2;for(let v=0;v<r.length-1;v++){const b=r[v],w=r[v+1],E=b.dist(w);if(_+E>g){const I=(g-_)/E,P=_t(b.x,w.x,I),D=_t(b.y,w.y,I),R=new sa(P,D,0,w.angleTo(b),v);return!h||Kx(r,R,f,h,e)?R:void 0}_+=E}}function Tw(r,e,i,n,a,u,h,f,_){const g=Qx(n,u,h),v=ev(n,a),b=v*h,w=r[0].x===0||r[0].x===_||r[0].y===0||r[0].y===_;return e-b<e/4&&(e=b+e/4),tv(r,w?e/2*f%e:(v/2+2*u)*h*f%e,e,g,i,b,w,!1,_)}function tv(r,e,i,n,a,u,h,f,_){const g=u/2,v=Jx(r);let b=0,w=e-i,E=[];for(let I=0;I<r.length-1;I++){const P=r[I],D=r[I+1],R=P.dist(D),F=D.angleTo(P);for(;w+i<b+R;){w+=i;const B=(w-b)/R,V=_t(P.x,D.x,B),$=_t(P.y,D.y,B);if(V>=0&&V<_&&$>=0&&$<_&&w-g>=0&&w+g<=v){const H=new sa(V,$,0,F,I);n&&!Kx(r,H,u,n,a)||E.push(H)}}b+=R}return f||E.length||h||(E=tv(r,b/2,i,n,a,u,h,!0,_)),E}function iv(r){let e=0,i=0;for(const h of r)e+=h.w*h.h,i=Math.max(i,h.w);r.sort((h,f)=>f.h-h.h);const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let a=0,u=0;for(const h of r)for(let f=n.length-1;f>=0;f--){const _=n[f];if(!(h.w>_.w||h.h>_.h)){if(h.x=_.x,h.y=_.y,u=Math.max(u,h.y+h.h),a=Math.max(a,h.x+h.w),h.w===_.w&&h.h===_.h){const g=n.pop();g&&f<n.length&&(n[f]=g)}else h.h===_.h?(_.x+=h.w,_.w-=h.w):h.w===_.w?(_.y+=h.h,_.h-=h.h):(n.push({x:_.x+h.w,y:_.y,w:_.w-h.w,h:h.h}),_.y+=h.h,_.h-=h.h);break}}return{w:a,h:u,fill:e/(a*u)||0}}nt(sa,"Anchor");class Ad{static getImagePositionScale(e,i,n){if(i&&e){const{sx:a,sy:u}=e;return{x:a,y:u}}return{x:n,y:n}}constructor(e,i,n,a){this.paddedRect=e;const{pixelRatio:u,version:h,stretchX:f,stretchY:_,content:g,sdf:v,usvg:b}=i;this.pixelRatio=u,this.stretchX=f,this.stretchY=_,this.content=g,this.version=h,this.padding=n,this.sdf=v,this.usvg=b,this.scale=Ad.getImagePositionScale(a,b,u)}get tl(){return[this.paddedRect.x+this.padding,this.paddedRect.y+this.padding]}get br(){return[this.paddedRect.x+this.paddedRect.w-this.padding,this.paddedRect.y+this.paddedRect.h-this.padding]}get displaySize(){return[(this.paddedRect.w-2*this.padding)/this.scale.x,(this.paddedRect.h-2*this.padding)/this.scale.y]}}function Y_(r,e,i){const n=hn.parse(r),a=(function(u,h,f=[1,1]){return{x:0,y:0,w:(u.data?u.data.width:u.width*f[0])+2*h,h:(u.data?u.data.height:u.height*f[1])+2*h}})(e,i,[n.sx,n.sy]);return{bin:a,imagePosition:new Ad(a,e,i,n),imageVariant:n}}class rv{constructor(e,i,n){const a=new Map,u=new Map;this.haveRenderCallbacks=[];const h=[];this.addImages(e,a,1,h),this.addImages(i,u,2,h);const{w:f,h:_}=iv(h),g=new Br({width:f||1,height:_||1});for(const[v,b]of e.entries()){const w=a.get(v).paddedRect;Br.copy(b.data,g,{x:0,y:0},{x:w.x+1,y:w.y+1},b.data,null,b.sdf)}for(const[v,b]of i.entries()){const w=u.get(v),E=w.paddedRect;let I=w.padding;const P=E.x+I,D=E.y+I,R=b.data.width,F=b.data.height;I=I>1?I-1:I,Br.copy(b.data,g,{x:0,y:0},{x:P,y:D},b.data,n),Br.copy(b.data,g,{x:0,y:F-I},{x:P,y:D-I},{width:R,height:I},n),Br.copy(b.data,g,{x:0,y:0},{x:P,y:D+F},{width:R,height:I},n),Br.copy(b.data,g,{x:R-I,y:0},{x:P-I,y:D},{width:I,height:F},n),Br.copy(b.data,g,{x:0,y:0},{x:P+R,y:D},{width:I,height:F},n),Br.copy(b.data,g,{x:R-I,y:F-I},{x:P-I,y:D-I},{width:I,height:I},n),Br.copy(b.data,g,{x:0,y:F-I},{x:P+R,y:D-I},{width:I,height:I},n),Br.copy(b.data,g,{x:0,y:0},{x:P+R,y:D+F},{width:I,height:I},n),Br.copy(b.data,g,{x:R-I,y:0},{x:P-I,y:D+F},{width:I,height:I},n)}this.lut=n,this.image=g,this.iconPositions=a,this.patternPositions=u}addImages(e,i,n,a){for(const[u,h]of e.entries()){const{bin:f,imagePosition:_,imageVariant:g}=Y_(u,h,n);i.set(u,_),a.push(f),h.hasRenderCallback&&this.haveRenderCallbacks.push(g.id)}}patchUpdatedImages(e,i,n,a){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(u=>e.hasImage(u,n)),e.dispatchRenderCallbacks(this.haveRenderCallbacks,n);for(const u of e.getUpdatedImages(n)){for(const h of this.iconPositions.keys()){const f=hn.parse(h);if(cn.isEqual(f.id,u)){const _=e.getImage(u,n);this.patchUpdatedImage(this.iconPositions.get(h),_,i,null)}}for(const h of this.patternPositions.keys()){const f=hn.parse(h);if(cn.isEqual(f.id,u)){const _=e.getImage(u,n);this.patchUpdatedImage(this.patternPositions.get(h),_,i,a||this.lut)}}}}patchUpdatedImage(e,i,n,a=null){if(!e||!i||e.version===i.version)return;e.version=i.version;const[u,h]=e.tl,f=e.sdf;if(this.lut||f){const _={width:i.data.width,height:i.data.height},g=new Br(_);Br.copy(i.data,g,{x:0,y:0},{x:0,y:0},_,a,f),n.update(g,{position:{x:u,y:h}})}else n.update(i.data,{position:{x:u,y:h}})}}nt(Ad,"ImagePosition"),nt(rv,"ImageAtlas",{omit:["lut"]});const Md=1e20;function nv(r,e,i,n,a,u,h,f,_){for(let g=e;g<e+n;g++)ov(r,i*u+g,u,a,h,f,_);for(let g=i;g<i+a;g++)ov(r,g*u+e,1,n,h,f,_)}function ov(r,e,i,n,a,u,h){u[0]=0,h[0]=-Md,h[1]=Md,a[0]=r[e];for(let f=1,_=0,g=0;f<n;f++){a[f]=r[e+f*i];const v=f*f;do{const b=u[_];g=(a[f]-a[b]+v-b*b)/(f-b)/2}while(g<=h[_]&&--_>-1);_++,u[_]=f,h[_]=g,h[_+1]=Md}for(let f=0,_=0;f<n;f++){for(;h[_+1]<f;)_++;const g=u[_],v=f-g;r[e+f*i]=a[g]+v*v}}const K_={none:0,ideographs:1,all:2};class bu{constructor(e,i,n){this.requestManager=e,this.localGlyphMode=i,this.localFontFamily=n,this.url="",this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}setURL(e){this.url=e}getGlyphs(e,i){const n=[],a=this.url||cr.GLYPHS_URL;for(const u in e)for(const h of e[u])n.push({stack:u,id:h});ue(n,({stack:u,id:h},f)=>{let _=this.entries[u];_||(_=this.entries[u]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let g=_.glyphs[h];if(g!==void 0)return void f(null,{stack:u,id:h,glyph:g});if(g=this._tinySDF(_,u,h),g)return _.glyphs[h]=g,void f(null,{stack:u,id:h,glyph:g});const v=Math.floor(h/256);if(256*v>65535)return xt("glyphs > 65535 not supported"),void f(null,{stack:u,id:h,glyph:g});if(_.ranges[v])return void f(null,{stack:u,id:h,glyph:g});let b=_.requests[v];b||(b=_.requests[v]=[],bu.loadGlyphRange(u,v,a,this.requestManager,(w,E)=>{if(E){_.ascender=E.ascender,_.descender=E.descender;for(const I in E.glyphs)this._doesCharSupportLocalGlyph(+I)||(_.glyphs[+I]=E.glyphs[+I]);_.ranges[v]=!0}for(const I of b)I(w,E);delete _.requests[v]})),b.push((w,E)=>{w?f(w):E&&f(null,{stack:u,id:h,glyph:E.glyphs[h]||null})})},(u,h)=>{if(u)i(u);else if(h){const f={};for(const{stack:_,id:g,glyph:v}of h)f[_]===void 0&&(f[_]={}),f[_].glyphs===void 0&&(f[_].glyphs={}),f[_].glyphs[g]=v&&{id:v.id,bitmap:v.bitmap.clone(),metrics:v.metrics},f[_].ascender=this.entries[_].ascender,f[_].descender=this.entries[_].descender;i(null,f)}})}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==K_.none&&(this.localGlyphMode===K_.all?!!this.localFontFamily:!!this.localFontFamily&&(Xc(e)||Nf(e)||Da(e)||Ll(e)||za(e)||La(e)||(i=e)>=131072&&i<=173791||(n=>n>=66736&&n<=66815)(e)));var i}_tinySDF(e,i,n){const a=this.localFontFamily;if(!a||!this._doesCharSupportLocalGlyph(n))return;let u=e.tinySDF;if(!u){let P="400";/bold/i.test(i)?P="900":/medium/i.test(i)?P="500":/light/i.test(i)&&(P="200"),u=e.tinySDF=new bu.TinySDF({fontFamily:a,fontWeight:P,fontSize:48,buffer:6,radius:16}),u.fontWeight=P}if(this.localGlyphs[u.fontWeight][n])return this.localGlyphs[u.fontWeight][n];const h=String.fromCodePoint(n),{data:f,width:_,height:g,glyphWidth:v,glyphHeight:b,glyphLeft:w,glyphTop:E,glyphAdvance:I}=u.draw(h);return this.localGlyphs[u.fontWeight][n]={id:n,bitmap:new $a({width:_,height:g},f),metrics:{width:v/2,height:b/2,left:w/2,top:E/2-27,advance:I/2,localGlyph:!0}}}}function sv(r,e){return r+e[1]-e[0]}function J_(r,e,i,n,a=1){const u=[],h=r.imagePrimary,f=h.pixelRatio,_=h.paddedRect.w-2,g=h.paddedRect.h-2,v=(r.right-r.left)*a,b=(r.bottom-r.top)*a,w=h.stretchX||[[0,_]],E=h.stretchY||[[0,g]],I=w.reduce(sv,0),P=E.reduce(sv,0),D=_-I,R=g-P;let F=0,B=I,V=0,$=P,H=0,J=D,ee=0,K=R;if(h.content&&n){const se=h.content;F=Yp(w,0,se[0]),V=Yp(E,0,se[1]),B=Yp(w,se[0],se[2]),$=Yp(E,se[1],se[3]),H=se[0]-F,ee=se[1]-V,J=se[2]-se[0]-B,K=se[3]-se[1]-$}const re=(se,Ee,we,Se)=>{const Re=Kp(se.stretch-F,B,v,r.left*a),Ce=Jp(se.fixed-H,J,se.stretch,I),Pe=Kp(Ee.stretch-V,$,b,r.top*a),ye=Jp(Ee.fixed-ee,K,Ee.stretch,P),De=Kp(we.stretch-F,B,v,r.left*a),Ae=Jp(we.fixed-H,J,we.stretch,I),Le=Kp(Se.stretch-V,$,b,r.top*a),ze=Jp(Se.fixed-ee,K,Se.stretch,P),tt=new Be(Re,Pe),it=new Be(De,Pe),Ze=new Be(De,Le),Xe=new Be(Re,Le),pt=new Be(Ce/f,ye/f),ct=new Be(Ae/f,ze/f),Qe=e*Math.PI/180;if(Qe){const qt=Math.sin(Qe),Zi=Math.cos(Qe),Wt=[Zi,-qt,qt,Zi];tt._matMult(Wt),it._matMult(Wt),Xe._matMult(Wt),Ze._matMult(Wt)}const bt=se.stretch+se.fixed,Ot=we.stretch+we.fixed,Kt=Ee.stretch+Ee.fixed,Lt=Se.stretch+Se.fixed,hi=r.imageSecondary;return{tl:tt,tr:it,bl:Xe,br:Ze,texPrimary:{x:h.paddedRect.x+1+bt,y:h.paddedRect.y+1+Kt,w:Ot-bt,h:Lt-Kt},texSecondary:hi?{x:hi.paddedRect.x+1+bt,y:hi.paddedRect.y+1+Kt,w:Ot-bt,h:Lt-Kt}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:pt,pixelOffsetBR:ct,minFontScaleX:J/f/v,minFontScaleY:K/f/b,isSDF:i}};if(h.stretchX||h.stretchY){const se=av(w,D,I),Ee=av(E,R,P);for(let we=0;we<se.length-1;we++){const Se=se[we],Re=se[we+1];for(let Ce=0;Ce<Ee.length-1;Ce++)u.push(re(Se,Ee[Ce],Re,Ee[Ce+1]))}}else u.push(re({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:_+1},{fixed:0,stretch:g+1}));return u}function Sw(r,e){const i=r.stretchY||[[0,r.paddedRect.h-2]];return r.stretchX||r.stretchY?lv(r.stretchX||[[0,r.paddedRect.w-2]])*lv(i):1}function Yp(r,e,i){let n=0;for(const a of r)n+=Math.max(e,Math.min(i,a[1]))-Math.max(e,Math.min(i,a[0]));return n}function av(r,e,i){const n=[{fixed:-1,stretch:0}];for(const[a,u]of r){const h=n[n.length-1];n.push({fixed:a-h.stretch,stretch:h.stretch}),n.push({fixed:a-h.stretch,stretch:h.stretch+(u-a)})}return n.push({fixed:e+1,stretch:i}),n}function lv(r){return 2*r.length+1}function Kp(r,e,i,n){return r/e*i+n}function Jp(r,e,i,n){return r-e*i/n}function Ew(r,e,i,n){const a=e+r.positionedLines[n].lineOffset;return n===0?i+a/2:i+(a+(e+r.positionedLines[n-1].lineOffset))/2}function cv(r,e,i,n,a,u,h,f,_){const g=[];if(e.positionedLines.length===0)return g;const v=(_!==void 0?_:n.layout.get("text-rotate").evaluate(u,{}))*Math.PI/180,b=(function(D){const R=D[0],F=D[1],B=R*F;return B>0?[R,-F]:B<0?[-R,F]:R===0?[F,R]:[F,-R]})(i);let w=Math.abs(e.top-e.bottom);for(const D of e.positionedLines)w-=D.lineOffset;const E=e.positionedLines.length,I=w/E;let P=e.top-i[1];for(let D=0;D<E;++D){const R=e.positionedLines[D];
8P=Ew(e,I,P,D);for(const F of R.positionedGlyphs){if(!F.rect)continue;const B=F.rect||{};let V=4,$=!0,H=1,J=0;if(F.image){const it=h.get(F.image.toString());if(!it)continue;if(it.sdf){xt("SDF images are not supported in formatted text and will be ignored.");continue}$=!1,H=it.pixelRatio,V=1/H}const ee=(a||f)&&F.vertical,K=F.metrics.advance*F.scale/2,re=F.metrics,se=F.rect;if(se===null)continue;f&&e.verticalizable&&(J=F.image?K-F.metrics.width*F.scale/2:0);const Ee=a?[F.x+K,F.y]:[0,0];let we=[0,0],Se=[0,0],Re=!1;a||(ee?(Se=[F.x+K+b[0],F.y+b[1]-J],Re=!0):we=[F.x+K+i[0],F.y+i[1]-J]);const Ce=se.w*F.scale/(H*(F.localGlyph?2:1)),Pe=se.h*F.scale/(H*(F.localGlyph?2:1));let ye,De,Ae,Le;if(ee){const it=F.y-P,Ze=new Be(-K,K-it),Xe=-Math.PI/2,pt=new Be(...Se);ye=new Be(-K+we[0],we[1]),ye._rotateAround(Xe,Ze)._add(pt),ye.x+=-it+K,ye.y-=(re.left-V)*F.scale;const ct=F.image?re.advance*F.scale:br*F.scale,Qe=String.fromCodePoint(F.glyph);sw(Qe)?ye.x+=(1-V)*F.scale:aw(Qe)?ye.x+=ct-re.height*F.scale+(-V-1)*F.scale:ye.x+=F.image||re.width+2*V===se.w&&re.height+2*V===se.h?(ct-Pe)/2:(ct-(re.height+2*V)*F.scale)/2,De=new Be(ye.x,ye.y-Ce),Ae=new Be(ye.x+Pe,ye.y),Le=new Be(ye.x+Pe,ye.y-Ce)}else{const it=(re.left-V)*F.scale-K+we[0],Ze=(-re.top-V)*F.scale+we[1],Xe=it+Ce,pt=Ze+Pe;ye=new Be(it,Ze),De=new Be(Xe,Ze),Ae=new Be(it,pt),Le=new Be(Xe,pt)}if(v){let it;it=a?new Be(0,0):Re?new Be(b[0],b[1]):new Be(i[0],i[1]),ye._rotateAround(v,it),De._rotateAround(v,it),Ae._rotateAround(v,it),Le._rotateAround(v,it)}const ze=new Be(0,0),tt=new Be(0,0);g.push({tl:ye,tr:De,bl:Ae,br:Le,texPrimary:B,texSecondary:void 0,writingMode:e.writingMode,glyphOffset:Ee,sectionIndex:F.sectionIndex,isSDF:$,pixelOffsetTL:ze,pixelOffsetBR:tt,minFontScaleX:0,minFontScaleY:0})}}return g}function Iw(r,e=1,i=!1){let n=1/0,a=1/0,u=-1/0,h=-1/0;const f=r[0];for(let E=0;E<f.length;E++){const I=f[E];(!E||I.x<n)&&(n=I.x),(!E||I.y<a)&&(a=I.y),(!E||I.x>u)&&(u=I.x),(!E||I.y>h)&&(h=I.y)}const _=Math.min(u-n,h-a);let g=_/2;const v=new wl([],Aw);if(_===0)return new Be(n,a);for(let E=n;E<u;E+=_)for(let I=a;I<h;I+=_)v.push(new wu(E+g,I+g,g,r));let b=(function(E){let I=0,P=0,D=0;const R=E[0];for(let F=0,B=R.length,V=B-1;F<B;V=F++){const $=R[F],H=R[V],J=$.x*H.y-H.x*$.y;P+=($.x+H.x)*J,D+=($.y+H.y)*J,I+=3*J}return new wu(P/I,D/I,0,E)})(r),w=v.length;for(;v.length;){const E=v.pop();(E.d>b.d||!b.d)&&(b=E,i&&console.log("found best %d after %d probes",Math.round(1e4*E.d)/1e4,w)),E.max-b.d<=e||(g=E.h/2,v.push(new wu(E.p.x-g,E.p.y-g,g,r)),v.push(new wu(E.p.x+g,E.p.y-g,g,r)),v.push(new wu(E.p.x-g,E.p.y+g,g,r)),v.push(new wu(E.p.x+g,E.p.y+g,g,r)),w+=4)}return i&&(console.log(`num probes: ${w}`),console.log(`best distance: ${b.d}`)),b.p}function Aw(r,e){return e.max-r.max}bu.loadGlyphRange=function(r,e,i,n,a){const u=256*e,h=u+255,f=n.transformRequest(n.normalizeGlyphsURL(i).replace("{fontstack}",r).replace("{range}",`${u}-${h}`),ln.Glyphs);dl(f,(_,g)=>{if(_)a(_);else if(g){const v={},b=(function(w){return new Zp(w).readFields(gw,{})})(g);for(const w of b.glyphs)v[w.id]=w;a(null,{glyphs:v,ascender:b.ascender,descender:b.descender})}})},bu.TinySDF=class{constructor({fontSize:r=24,buffer:e=3,radius:i=8,cutoff:n=.25,fontFamily:a="sans-serif",fontWeight:u="normal",fontStyle:h="normal",lang:f=null}={}){this.buffer=e,this.cutoff=n,this.radius=i,this.lang=f;const _=this.size=r+4*e,g=this._createCanvas(_),v=this.ctx=g.getContext("2d",{willReadFrequently:!0});v.font=`${h} ${u} ${r}px ${a}`,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(r){const e=document.createElement("canvas");return e.width=e.height=r,e}draw(r){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:n,actualBoundingBoxLeft:a,actualBoundingBoxRight:u}=this.ctx.measureText(r),h=Math.ceil(i),f=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(u-a))),_=Math.min(this.size-this.buffer,h+Math.ceil(n)),g=f+2*this.buffer,v=_+2*this.buffer,b=Math.max(g*v,0),w=new Uint8ClampedArray(b),E={data:w,width:g,height:v,glyphWidth:f,glyphHeight:_,glyphTop:h,glyphLeft:0,glyphAdvance:e};if(f===0||_===0)return E;const{ctx:I,buffer:P,gridInner:D,gridOuter:R}=this;this.lang&&(I.lang=this.lang),I.clearRect(P,P,f,_),I.fillText(r,P,P+h);const F=I.getImageData(P,P,f,_);R.fill(Md,0,b),D.fill(0,0,b);for(let B=0;B<_;B++)for(let V=0;V<f;V++){const $=F.data[4*(B*f+V)+3]/255;if($===0)continue;const H=(B+P)*g+V+P;if($===1)R[H]=0,D[H]=Md;else{const J=.5-$;R[H]=J>0?J*J:0,D[H]=J<0?J*J:0}}nv(R,0,0,g,v,g,this.f,this.v,this.z),nv(D,P,P,f,_,g,this.f,this.v,this.z);for(let B=0;B<b;B++){const V=Math.sqrt(R[B])-Math.sqrt(D[B]);w[B]=Math.round(255-255*(V/this.radius+this.cutoff))}return E}};class wu{constructor(e,i,n,a){this.p=new Be(e,i),this.h=n,this.d=(function(u,h){let f=!1,_=1/0;for(let g=0;g<h.length;g++){const v=h[g];for(let b=0,w=v.length,E=w-1;b<w;E=b++){const I=v[b],P=v[E];I.y>u.y!=P.y>u.y&&u.x<(P.x-I.x)*(u.y-I.y)/(P.y-I.y)+I.x&&(f=!f),_=Math.min(_,Ga(u,I,P))}}return(f?1:-1)*Math.sqrt(_)})(this.p,a),this.max=this.d+this.h*Math.SQRT2}}const Mw=Object.keys,Q_=Number.POSITIVE_INFINITY,Cw=Math.sqrt(2);function Ya(r,e,i,n,a){const u=Z_(r)&&r.collisionPadding?r.collisionPadding:[0,0,0,0],h={top:r.top-u[1],bottom:r.bottom+u[3],left:r.left-u[0],right:r.right+u[2],scaled:!1};return n!==void 0&&(function(f,_){f.top*=_,f.bottom*=_,f.left*=_,f.right*=_,f.scaled=!0}
8)(h,n),i&&(function(f,_){if(!_)return;const g=$t(_),v=new Be(f.left,f.top),b=new Be(f.right,f.top),w=new Be(f.left,f.bottom),E=new Be(f.right,f.bottom),I=new Be(0,0);v._rotateAround(g,I),b._rotateAround(g,I),w._rotateAround(g,I),E._rotateAround(g,I),f.left=Math.min(v.x,b.x,w.x,E.x),f.right=Math.max(v.x,b.x,w.x,E.x),f.top=Math.min(v.y,b.y,w.y,E.y),f.bottom=Math.max(v.y,b.y,w.y,E.y)})(h,i),a&&(h.left+=a[0],h.right+=a[0],h.top+=a[1],h.bottom+=a[1]),e?{top:Math.min(e.top,h.top),bottom:Math.max(e.bottom,h.bottom),left:Math.min(e.left,h.left),right:Math.max(e.right,h.right),scaled:e.scaled||h.scaled}:h}function uv(r,[e,i]){let n=0,a=0;if(i===Q_){e<0&&(e=0);const u=e/Cw;switch(r){case"top-right":case"top-left":a=u-7;break;case"bottom-right":case"bottom-left":a=7-u;break;case"bottom":a=7-e;break;case"top":a=e-7}switch(r){case"top-right":case"bottom-right":n=-u;break;case"top-left":case"bottom-left":n=u;break;case"left":n=e;break;case"right":n=-e}}else{switch(e=Math.abs(e),i=Math.abs(i),r){case"top-right":case"top-left":case"top":a=i-7;break;case"bottom-right":case"bottom-left":case"bottom":a=7-i}switch(r){case"top-right":case"bottom-right":case"right":n=-e;break;case"top-left":case"bottom-left":case"left":n=e}}return[n,a]}function Pw(r,e,i,n,a,u,h,f,_,g,v,b,w,E,I){const P=r.layers[0],D=P.appearances;if(D.length===0)return{iconBBox:null,iconVerticalBBox:null,textBBox:null,textVerticalBBox:null};const R={iconBBox:null,iconVerticalBBox:null},F={textBBox:null,textVerticalBBox:null},{baseIconRotate:B,baseTextRotate:V,iconScaleFactor:$}=(function(J,ee,K){const re=J.get("icon-rotate").evaluate(ee,{},K),se=J.get("text-rotate").evaluate(ee,{},K),[Ee,we]=J.get("icon-size-scale-range");return{baseIconRotate:re,baseTextRotate:se,iconScaleFactor:Y(1,Ee,we)}})(n,a,u);e&&(R.iconBBox=Ya(e,R.iconBBox,B,h),i)&&(R.iconVerticalBBox=Ya(i,R.iconVerticalBBox,B+90,h));const H=em(b.horizontal);H&&(F.textBBox=Ya(H,F.textBBox,V,1,E)),b.vertical&&(F.textVerticalBBox=Ya(b.vertical,F.textVerticalBBox,V+90,1,E));for(const J of D)J.hasIconProperties()&&Rw(R,r,P,J,a,u,f,B,h,_,e,g,$,v,I),J.hasTextProperties()&&zw(F,P,J,a,u,E,V,w,H,b.vertical);return{iconBBox:R.iconBBox,iconVerticalBBox:R.iconVerticalBBox,textBBox:F.textBBox,textVerticalBBox:F.textVerticalBBox}}function Rw(r,e,i,n,a,u,h,f,_,g,v,b,w,E,I){const{appearanceIconOffset:P,appearanceIconRotate:D,appearanceIconSize:R}=hv(n,i,a,u,h,f,_,g.iconScaleFactor);let F=null,B=null,V=null;n.hasProperty("icon-image")?V=(function($,H,J,ee,K,re,se,Ee){let we=null;const Se=H.getAppearanceValueAndResolveTokens(J,"icon-image",ee,K,Ee);if(Se){const Re=$.getResolvedImageFromTokens(Se),Ce=J.getUnevaluatedProperty("icon-size"),Pe=Cd(Re,ic($.zoom,Ce,$.worldview,Ee),Ce,K,$.zoom,ee,$.pixelRatio,se,$.worldview,Ee);we=re.get(Pe.iconPrimary.toString())}return we})(e,i,n,a,u,b,w,I):v&&(V=v.imagePrimary),V&&(F=Xp(V,null,P,E),e.allowVerticalPlacement&&(B=Xp(V,null,P,E))),F&&(r.iconBBox=Ya(F,r.iconBBox,D,R)),B&&(r.iconVerticalBBox=Ya(B,r.iconVerticalBBox,D+90,R))}function hv(r,e,i,n,a,u,h,f){const _=r.hasProperty("icon-offset")?e.getAppearanceValueAndResolveTokens(r,"icon-offset",i,n,[]):null,g=_&&Array.isArray(_)?_:a,v=r.hasProperty("icon-rotate")?e.getAppearanceValueAndResolveTokens(r,"icon-rotate",i,n,[]):null,b=typeof v=="number"?v:u,w=r.hasProperty("icon-size")?e.getAppearanceValueAndResolveTokens(r,"icon-size",i,n,[]):null;return{appearanceIconOffset:g,appearanceIconRotate:b,appearanceIconSize:typeof w=="number"?w*f:h}}function zw(r,e,i,n,a,u,h,f,_,g){const{appearanceTextOffset:v,appearanceTextRotate:b,appearanceTextSize:w}=dv(i,e,n,a,u,h,f),E=w/f;_&&(r.textBBox=Ya(_,r.textBBox,b,E,v)),g&&(r.textVerticalBBox=Ya(g,r.textVerticalBBox,b+90,E,v))}function dv(r,e,i,n,a,u,h){const f=r.hasProperty("text-offset")?e.getAppearanceValueAndResolveTokens(r,"text-offset",i,n,[]):null,_=f&&Array.isArray(f)?[f[0]*br,f[1]*br]:a,g=r.hasProperty("text-rotate")?e.getAppearanceValueAndResolveTokens(r,"text-rotate",i,n,[]):null,v=typeof g=="number"?g:u,b=r.hasProperty("text-size")?e.getAppearanceValueAndResolveTokens(r,"text-size",i,n,[]):null;return{appearanceTextOffset:_,appearanceTextRotate:v,appearanceTextSize:typeof b=="number"?b:h}}function Qp(r,e,i,n,a,u,h,f,_){if(!e||!e.usvg)return;const g=Yx(n),v=Yx(a),b=u!=="both"&&u!=="width"||!Wx(n)?1:v.width/g.width,w=u!=="both"&&u!=="height"||!Xx(n)?1:v.height/g.height;i.scaleSelf(b,w);const E=i.toString();h.set(E,i),f.set(E,e);const{imagePosition:I}=Y_(E,e,1);_.set(E,I)}function fv(r,e,i,n,a,u,h,f,_,g){if(!r)return;const v=(function(b,w,E,I,P,D,R){if(b.kind==="camera")return b.maxSize;if(b.kind==="composite"){const F=w.possiblyEvaluate(new ui(b.maxZoom,{worldview:D}),E,R).evaluate(P,{},E,R),B=w.possiblyEvaluate(new ui(b.minZoom,{worldview:D}),E,R).evaluate(P,{},E,R);return Math.max(F,B)}return w.possiblyEvaluate(new ui(I,{worldview:D}),E,R).evaluate(P,{},E,R)})(e,i,n,a,u,_,g);return r.scaleSelf(v*f*h)}function Cd(r,e,i,n,a,u,h,f,_,g){return{iconPrimary:fv(r.getPrimary(),e,i,n,a,u,h,f,_,g),iconSecondary:fv(r.getSecondary(),e,i,n,a,u,h,f,_,g)}}function Dw(r,e,i){if(!e)return;const n=i.get(r.toString()),a=i.get(e.toString());n&&a&&(n.paddedRect.w===a.paddedRect.w&&n.paddedRect.h===a.paddedRect.h||xt(`Mismatch in icon variant sizes: ${r.toString()} and ${e.toString()}`),n.usvg!==a.usvg&&xt(`Mismatch in icon variant image types: ${r.id} and ${e.id}`))}
8function pv(r,e,i,n){if(!r)return;const a=e.get(i.toString());if(r.imagePrimary=a,n){const u=e.get(n.toString());r.imageSecondary=u}}function Lw(r,e){for(const i in r.horizontal)mv(r.horizontal[i],e);mv(r.vertical,e)}function mv(r,e){if(r){for(const i of r.positionedLines)for(const n of i.positionedGlyphs)if(n.image!==null){const a=n.image.toString();n.rect=e.get(a).paddedRect}}}function eg(r){switch(r){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Fw(r,e,i,n,a,u,h,f,_){const g=em(u.horizontal)||u.vertical,v=i.get("icon-text-fit-padding").evaluate(n,{},a);let b,w=e;return e&&_!=="none"&&(r.allowVerticalPlacement&&u.vertical&&(b=W_(e,u.vertical,_,v,f,h)),g&&(w=W_(e,g,_,v,f,h))),{defaultShapedIcon:w,verticallyShapedIcon:b}}function _v(r,e){return r*e/24}function Ow(r,e,i,n,a,u,h,f,_,g,v,b,w,E,I,P,D,R,F,B,V,$,H,J){let ee=h.textMaxSize.evaluate(e,{},w);ee===void 0?ee=f*h.textScaleFactor:ee*=h.textScaleFactor;const K=r.layers[0].layout,re=_v(f,h.textScaleFactor),se=em(i.horizontal)||i.vertical,Ee=r.hasAnyAppearanceProperty(["text-size","text-offset","text-rotate"]);if((D!=="none"||Ee)&&r.appearanceFeatureData&&r.featureToAppearanceIndex[e.index]<r.appearanceFeatureData.length){const Ze=r.appearanceFeatureData[r.featureToAppearanceIndex[e.index]];Ze&&(Ze.textShaping=se,Ze.iconTextFitPadding=K.get("icon-text-fit-padding").evaluate(e,{},w),Ze.fontScale=re,Ze.textScaleFactor=h.textScaleFactor)}const we=E.name==="globe",Se=r.tilePixelRatio*ee/24,Re=(Le=r.overscaling,r.zoom>18&&Le>2&&(Le>>=1),Math.max(We/(512*Le),1)*K.get("symbol-spacing")),Ce=K.get("text-padding")*r.tilePixelRatio,Pe=K.get("icon-padding")*r.tilePixelRatio,ye=$t(K.get("text-max-angle")),De=K.get("icon-rotation-alignment")==="map"&&B!=="point",Ae=Re/2;var Le;r.hasAnyIconTextFit===!1&&D!=="none"&&(r.hasAnyIconTextFit=!0);const ze=e.properties?+e.properties[Ut]:null,tt=ze&&r.elevationFeatureIdToIndex?r.elevationFeatureIdToIndex.get(ze):65535,it=(Ze,Xe,pt)=>{if(Xe.x<0||Xe.x>=We||Xe.y<0||Xe.y>=We)return;let ct=null;if(we){const{x:Qe,y:bt,z:Ot}=E.projectTilePoint(Xe.x,Xe.y,pt);ct={anchor:new sa(Qe,bt,Ot,0,void 0),up:E.upVector(pt,Xe.x,Xe.y)}}(function(Qe,bt,Ot,Kt,Lt,hi,qt,Zi,Wt,ai,Si,Li,Fi,Wi,Ar,Nr,sr,fr,yr,Rt,Oi,Vi,Gn,on,Mr,sn,Ps,Gr,gm,Cu,_n,ym){const Rs=Qe.addToLineVertexArray(bt,Kt);let aa,Qa,lo,Ao,Hd,Pu,Ft,wr=0,Xi=0,pr=0,co=0,In=-1,qn=-1;const Tr={};let $d=ga("");const zs=Ot?Ot.anchor:bt,ar=Gr!=="none";let Cr=0,mr=0;if(Wt._unevaluatedLayout.getValue("text-radial-offset")===void 0){const Pr=Wt.layout.get("text-offset").evaluate(Oi,{},Mr);Cr=Pr[0]*br,mr=Pr[1]*br}else Cr=Wt.layout.get("text-radial-offset").evaluate(Oi,{},Mr)*br,mr=Q_;if(Qe.allowVerticalPlacement&&Lt.vertical){const Pr=Lt.vertical;if(Ar)Pu=rg(Pr),Zi&&(Ft=rg(Zi));else{const An=Wt.layout.get("text-rotate").evaluate(Oi,{},Mr)+90;lo=tm(ai,zs,bt,Si,Li,Fi,Pr,Wi,An,Nr,ym),Zi&&(Ao=tm(ai,zs,bt,Si,Li,Fi,Zi,fr,An,null,_n))}}if(hi){const Pr=Wt.layout.get("icon-rotate").evaluate(Oi,{},Mr),An=J_(hi,Pr,Gn,ar,Vi.iconScaleFactor),Mo=Zi?J_(Zi,Pr,Gn,ar,Vi.iconScaleFactor):void 0;Qa=tm(ai,zs,bt,Si,Li,Fi,hi,fr,Pr,null,Cu);const Ds=(function(Jo,WT,L0,XT,YT,F0,O0,KT,k2,Ag){const k0=Jo.layers[0],B0=k0.appearances;let zu=WT.length;if(L0&&(zu=Math.max(zu,L0.length)),B0.length===0)return zu;const[JT,QT]=XT.get("icon-size-scale-range"),e2=Y(1,JT,QT);for(const Mg of B0){const N0=Mg.getUnevaluatedProperties();if(N0._values["icon-image"].value!==void 0){const V0=k0.getAppearanceValueAndResolveTokens(Mg,"icon-image",F0,O0,Ag);if(V0){const U0=Jo.getResolvedImageFromTokens(V0);if(U0){const j0=Mg.hasProperty("icon-size")?N0._values["icon-size"]:YT._values["icon-size"],t2=Cd(U0,ic(Jo.zoom,j0,Jo.worldview,Ag),j0,O0,Jo.zoom,F0,Jo.pixelRatio,e2,Jo.worldview,Ag),G0=KT.get(t2.iconPrimary.toString());G0&&(zu=Math.max(zu,Sw(G0)))}}}}return zu})(Qe,An,Mo,Wt.layout,Wt._unevaluatedLayout,Oi,Mr,Qe.iconAtlasPositions,0,on);wr=4*Ds;const Eg=Wt.layout.get("icon-size").evaluate(Oi,{},Mr,on),Ig=Vi.compositeIconSizes?Vi.compositeIconSizes[0].evaluate(Oi,{},Mr,on):0,Zd=Vi.compositeIconSizes?Vi.compositeIconSizes[1].evaluate(Oi,{},Mr,on):0,Ru=ig(Qe.layerIds[0],Qe.iconSizeData,Eg,Vi.iconScaleFactor,Ig,Zd);Qe.addSymbols(Qe.icon,An,Ru,Rt,yr,Oi,void 0,Ot,bt,Rs.lineStartIndex,Rs.lineLength,-1,on,Mr,sn,Ps,Qe.symbolInstances.length,Ds),In=Qe.icon.placedSymbolArray.length-1,Mo&&(Xi=4*Ds,Qe.addSymbols(Qe.icon,Mo,Ru,Rt,yr,Oi,jn.vertical,Ot,bt,Rs.lineStartIndex,Rs.lineLength,-1,on,Mr,sn,Ps,Qe.symbolInstances.length,Ds),qn=Qe.icon.placedSymbolArray.length-1)}for(const Pr in Lt.horizontal){const An=Pr,Mo=Lt.horizontal[An];aa||($d=ga(Mo.text),Ar?Hd=rg(Mo):aa=tm(ai,zs,bt,Si,Li,Fi,Mo,Wi,Wt.layout.get("text-rotate").evaluate(Oi,{},Mr),Nr,ym));const Ds=Mo.positionedLines.length===1;if(pr+=gv(Qe,Ot,bt,Mo,qt,Wt,Ar,Oi,Nr,Rs,Lt.vertical?jn.horizontal:jn.horizontalOnly,Ds?Mw(Lt.horizontal):[An],Tr,In,Vi,on,Mr,Qe.symbolInstances.length,sn),Ds)break}Lt.vertical&&(co+=gv(Qe,Ot,bt,Lt.vertical,qt,Wt,Ar,Oi,Nr,Rs,jn.vertical,["vertical"],Tr,qn,Vi,on,Mr,Qe.symbolInstances.length,sn));let qr=-1;const Hr=(Pr,An)=>Pr?Math.max(Pr,An):An;qr=Hr(Hd,qr),qr=Hr(Pu,qr),qr=Hr(Ft,qr);const el=qr>-1?1:0;Qe.glyphOffsetArray.length>=65535&&xt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),O
vendor: 6,095 bytes, line 8
8i.sortKey!==void 0&&Qe.addToSortKeyRanges(Qe.symbolInstances.length,Oi.sortKey),Qe.symbolInstances.emplaceBack(bt.x,bt.y,zs.x,zs.y,zs.z,Tr.right>=0?Tr.right:-1,Tr.center>=0?Tr.center:-1,Tr.left>=0?Tr.left:-1,Tr.vertical>=0?Tr.vertical:-1,In,qn,$d,aa!==void 0?aa:Qe.collisionBoxArray.length,aa!==void 0?aa+1:Qe.collisionBoxArray.length,lo!==void 0?lo:Qe.collisionBoxArray.length,lo!==void 0?lo+1:Qe.collisionBoxArray.length,Qa!==void 0?Qa:Qe.collisionBoxArray.length,Qa!==void 0?Qa+1:Qe.collisionBoxArray.length,Ao||Qe.collisionBoxArray.length,Ao?Ao+1:Qe.collisionBoxArray.length,Si,pr,co,wr,Xi,el,0,Cr,mr,qr,0,ar?1:0,gm)})(r,Xe,ct,Ze,i,n,u,a,r.layers[0],r.collisionBoxArray,e.index,e.sourceLayerIndex,r.index,Ce,F,g,0,Pe,De,R,e,h,v,b,w,I,P,D,tt,V,$,H)};if(B==="line")for(const Ze of Op(e.geometry,0,0,We,We)){const Xe=Tw(Ze,Re,ye,i.vertical||se,n,24,Se,r.overscaling,We);for(const pt of Xe)se&&kw(r,se.text,Ae,pt)||it(Ze,pt,w)}else if(B==="line-center"){for(const Ze of e.geometry)if(Ze.length>1){const Xe=ww(Ze,ye,i.vertical||se,n,24,Se);Xe&&it(Ze,Xe,w)}}else if(e.type==="Polygon")for(const Ze of ud(e.geometry,0)){const Xe=Iw(Ze,16);it(Ze[0],new sa(Xe.x,Xe.y,0,0,void 0),w)}else if(e.type==="LineString")for(const Ze of e.geometry)it(Ze,new sa(Ze[0].x,Ze[0].y,0,0,void 0),w);else if(e.type==="Point")for(const Ze of e.geometry)for(const Xe of Ze)it([Xe],new sa(Xe.x,Xe.y,0,0,void 0),w)}const tg=255,rc=tg*oa;function gv(r,e,i,n,a,u,h,f,_,g,v,b,w,E,I,P,D,R,F){const B=cv(0,n,_,u,h,f,a,r.allowVerticalPlacement,void 0),V=u.layout.get("text-size").evaluate(f,{},D),$=I.compositeTextSizes?I.compositeTextSizes[0].evaluate(f,{},D):0,H=I.compositeTextSizes?I.compositeTextSizes[1].evaluate(f,{},D):0,J=ig(r.layerIds[0],r.textSizeData,V,I.textScaleFactor,$,H);r.addSymbols(r.text,B,J,_,h,f,v,e,i,g.lineStartIndex,g.lineLength,E,P,D,F,!1,R,B.length);for(const ee of b)w[ee]=r.text.placedSymbolArray.length-1;return 4*B.length}function ig(r,e,i,n,a,u){const h=e;let f=null;return h.kind==="source"?(f=[oa*i*n],f[0]>rc&&xt(`${r}: Value for "text-size" is >= ${tg}. Reduce your "text-size".`)):h.kind==="composite"&&(f=[oa*a*n,oa*u*n],(f[0]>rc||f[1]>rc)&&xt(`${r}: Value for "text-size" is >= ${tg}. Reduce your "text-size".`)),f}function em(r){for(const e in r)return r[e];return null}function tm(r,e,i,n,a,u,h,f,_,g,v){let b,w,E,I;if(b=v?v.top:h.top,w=v?v.bottom:h.bottom,E=v?v.left:h.left,I=v?v.right:h.right,Z_(h)&&h.collisionPadding){const P=h.collisionPadding;E-=P[0],b-=P[1],I+=P[2],w+=P[3]}if(_){const P=new Be(E,b),D=new Be(I,b),R=new Be(E,w),F=new Be(I,w),B=$t(_);let V=new Be(0,0);g&&(V=new Be(g[0],g[1])),P._rotateAround(B,V),D._rotateAround(B,V),R._rotateAround(B,V),F._rotateAround(B,V),E=Math.min(P.x,D.x,R.x,F.x),I=Math.max(P.x,D.x,R.x,F.x),b=Math.min(P.y,D.y,R.y,F.y),w=Math.max(P.y,D.y,R.y,F.y)}return r.emplaceBack(e.x,e.y,e.z,i.x,i.y,E,b,I,w,f,n,a,u),r.length-1}function rg(r){Z_(r)&&r.collisionPadding&&(r.top-=r.collisionPadding[1],r.bottom+=r.collisionPadding[3]);const e=r.bottom-r.top;return e>0?Math.max(10,e):null}function kw(r,e,i,n){const a=r.compareText;if(e in a){const u=a[e];for(let h=u.length-1;h>=0;h--)if(n.dist(u[h])<i)return!0}else a[e]=[];return a[e].push(n),!1}function yv(r,e){const i=r.fovAboveCenter,n=r.elevation?r.elevation.getMinElevationBelowMSL()*e:0,a=(r._camera.position[2]*r.worldSize-n)/Math.cos(r._pitch),u=Math.sin(i)*a/Math.sin(Math.max(Math.PI/2-r._pitch-i,.01));let h=Math.sin(r._pitch)*u+a;const f=a*(1/r._horizonShift);if(!r.elevation||r.elevation.exaggeration()===0){let _=Math.max(r.zoom-17,0);r.isOrthographic&&(_/=10),h*=1+_}return Math.min(1.01*h,f)}function Pd(r,e){if(!e.isReprojectedInTileSpace)return{scale:1<<r.z,x:r.x,y:r.y,x2:r.x+1,y2:r.y+1,projection:e};const i=Math.pow(2,-r.z),n=r.x*i,a=(r.x+1)*i,u=r.y*i,h=(r.y+1)*i,f=Me(n),_=Me(a),g=Fe(u),v=Fe(h),b=e.project(f,g),w=e.project(_,g),E=e.project(_,v),I=e.project(f,v);let P=Math.min(b.x,w.x,E.x,I.x),D=Math.min(b.y,w.y,E.y,I.y),R=Math.max(b.x,w.x,E.x,I.x),F=Math.max(b.y,w.y,E.y,I.y);const B=i/16;function V(H,J,ee,K,re,se){const Ee=(ee+re)/2,we=(K+se)/2,Se=e.project(Me(Ee),Fe(we)),Re=Math.max(0,P-Se.x,D-Se.y,Se.x-R,Se.y-F);P=Math.min(P,Se.x),R=Math.max(R,Se.x),D=Math.min(D,Se.y),F=Math.max(F,Se.y),Re>B&&(V(H,Se,ee,K,Ee,we),V(Se,J,Ee,we,re,se))}V(b,w,n,u,a,u),V(w,E,a,u,a,h),V(E,I,a,h,n,h),V(I,b,n,h,n,u),P-=B,D-=B,R+=B,F+=B;const $=1/Math.max(R-P,F-D);return{scale:$,x:P*$,y:D*$,x2:R*$,y2:F*$,projection:e}}function xv(r,{x:e,y:i},n=0){return new Be(((e-n)*r.scale-r.x)*We,(i*r.scale-r.y)*We)}const Bw=Ei(new Float32Array(16));class Ka{constructor(e){this.spec=e,this.name=e.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(e,i){return{x:0,y:0,z:0}}unproject(e,i){return new Z(0,0)}projectTilePoint(e,i,n){return{x:e,y:i,z:0}}locationPoint(e,i,n,a=!0){return e._coordinatePoint(e.locationCoordinate(i,n),a)}pixelsPerMeter(e,i){return ge(1,e)*i}pixelSpaceConversion(e,i,n){return 1}farthestPixelDistance(e){return yv(e,e.pixelsPerMeter)}pointCoordinate(e,i,n,a){const u=e.horizonLineFromTop(!1),h=new Be(i,Math.max(u,n));return e.rayIntersectionCoordinate(e.pointRayIntersection(h,a))}pointCoordinate3D(e,i,n){const a=new Be(i,n);if(e.elevation)return e.elevation.pointCoordinate(a);{const u=this.pointCoordinate(e,a.x,a.y,0);return[u.x,u.y,u.z]}}isPointAboveHorizon(e,i){if(e.elevation&&e.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(e,i.x,i.y);const n=e.horizonLineFromTop();return i.y<n}createInversionMatrix(e,i){return Bw}createTileMatrix(e,i,n){let a,u,h;const f=n.canonical,_=Ei(new Float64Array(16));if(this.isReprojectedInTileSpace){const g=Pd(f,this);a=1,u=g.x+n.wrap*g.scale,h=g.y,Ji(_,_,[a/g.scale,a/g.scale,e.pixelsPerMeter/i])}else a=i/e.zoomScale(f.z),u=(f.x+Math.pow(2,f.z)*n.wrap)*a,h=f.y*a;return _r(_,_,[u,h,0]),Ji(_,_,[a/We,a/We,1]),_}upVector(e,i,n){return[0,0,1]}upVectorScale(e,i,n){return{metersToTile:1}}}
vendor: 4,457 bytes, line 8
8class Nw extends Ka{constructor(e){super(e),this.range=[4,7],this.center=e.center||[-96,37.5];const[i,n]=this.parallels=e.parallels||[29.5,45.5],a=Math.sin($t(i));this.n=(a+Math.sin($t(n)))/2,this.c=1+a*(2*this.n-a),this.r0=Math.sqrt(this.c)/this.n}project(e,i){const{n,c:a,r0:u}=this,h=$t(e-this.center[0]),f=$t(i),_=Math.sqrt(a-2*n*Math.sin(f))/n;return{x:_*Math.sin(h*n),y:_*Math.cos(h*n)-u,z:0}}unproject(e,i){const{n,c:a,r0:u}=this,h=u+i;let f=Math.atan2(e,Math.abs(h))*Math.sign(h);h*n<0&&(f-=Math.PI*Math.sign(e)*Math.sign(h));const _=$t(this.center[0])*n;f=xe(f,-Math.PI-_,Math.PI-_);const g=Y(he(f/n)+this.center[0],-180,180),v=Math.asin(Y((a-(e*e+h*h)*n*n)/(2*n),-1,1)),b=Y(he(v),-85.051129,oe);return new Z(g,b)}}const Rd=1.340264,zd=-.081106,Dd=893e-6,Ld=.003796,im=Math.sqrt(3)/2;class Vw extends Ka{project(e,i){i=i/180*Math.PI,e=e/180*Math.PI;const n=Math.asin(im*Math.sin(i)),a=n*n,u=a*a*a;return{x:.5*(e*Math.cos(n)/(im*(Rd+3*zd*a+u*(7*Dd+9*Ld*a)))/Math.PI+.5),y:1-.5*(n*(Rd+zd*a+u*(Dd+Ld*a))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let n=i=(2*(1-i)-1)*Math.PI,a=n*n,u=a*a*a;for(let v,b,w,E=0;E<12&&(b=n*(Rd+zd*a+u*(Dd+Ld*a))-i,w=Rd+3*zd*a+u*(7*Dd+9*Ld*a),v=b/w,n=Y(n-v,-Math.PI/3,Math.PI/3),a=n*n,u=a*a*a,!(Math.abs(v)<1e-12));++E);const h=im*e*(Rd+3*zd*a+u*(7*Dd+9*Ld*a))/Math.cos(n),f=Math.asin(Math.sin(n)/im),_=Y(180*h/Math.PI,-180,180),g=Y(180*f/Math.PI,-85.051129,oe);return new Z(_,g)}}class Uw extends Ka{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0}project(e,i){return{x:.5+e/360,y:.5-i/360,z:0}}unproject(e,i){const n=360*(e-.5),a=Y(360*(.5-i),-85.051129,oe);return new Z(n,a)}}const Tu=Math.PI/2;function rm(r){return Math.tan((Tu+r)/2)}class jw extends Ka{constructor(e){super(e),this.center=e.center||[0,30];const[i,n]=this.parallels=e.parallels||[30,30];let a=$t(i),u=$t(n);this.southernCenter=a+u<0,this.southernCenter&&(a=-a,u=-u);const h=Math.cos(a),f=rm(a);this.n=a===u?Math.sin(a):Math.log(h/Math.cos(u))/Math.log(rm(u)/f),this.f=h*Math.pow(rm(a),this.n)/this.n}project(e,i){i=$t(i),this.southernCenter&&(i=-i),e=$t(e-this.center[0]);const n=1e-6,{n:a,f:u}=this;u>0?i<-Tu+n&&(i=-Tu+n):i>Tu-n&&(i=Tu-n);const h=u/Math.pow(rm(i),a);let f=h*Math.sin(a*e),_=u-h*Math.cos(a*e);return f=.5*(f/Math.PI+.5),_=.5*(_/Math.PI+.5),{x:f,y:this.southernCenter?_:1-_,z:0}}unproject(e,i){e=(2*e-.5)*Math.PI,this.southernCenter&&(i=1-i),i=(2*(1-i)-.5)*Math.PI;const{n,f:a}=this,u=a-i,h=Math.sign(u),f=Math.sign(n)*Math.sqrt(e*e+u*u);let _=Math.atan2(e,Math.abs(u))*h;u*n<0&&(_-=Math.PI*Math.sign(e)*h);const g=Y(he(_/n)+this.center[0],-180,180),v=Y(he(2*Math.atan(Math.pow(a/f,1/n))-Tu),-85.051129,oe);return new Z(g,this.southernCenter?-v:v)}}class vv extends Ka{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(e,i){return{x:de(e),y:ve(i),z:0}}unproject(e,i){const n=Me(e),a=Fe(i);return new Z(n,a)}}const bv=$t(oe);class Gw extends Ka{project(e,i){const n=(i=$t(i))*i,a=n*n;return{x:.5*((e=$t(e))*(.8707-.131979*n+a*(a*(.003971*n-.001529*a)-.013791))/Math.PI+.5),y:1-.5*(i*(1.007226+n*(.015085+a*(.028874*n-.044475-.005916*a)))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let n=i=(2*(1-i)-1)*Math.PI,a=25,u=0,h=n*n;do{h=n*n;const g=h*h;u=(n*(1.007226+h*(.015085+g*(.028874*h-.044475-.005916*g)))-i)/(1.007226+h*(.045255+g*(.259866*h-.311325-.005916*11*g))),n=Y(n-u,-bv,bv)}while(Math.abs(u)>1e-6&&--a>0);h=n*n;const f=Y(he(e/(.8707+h*(h*(h*h*h*(.003971-.001529*h)-.013791)-.131979))),-180,180),_=he(n);return new Z(f,_)}}const wv=$t(oe);class qw extends Ka{project(e,i){i=$t(i),e=$t(e);const n=Math.cos(i),a=2/Math.PI,u=Math.acos(n*Math.cos(e/2)),h=Math.sin(u)/u,f=.5*(e*a+2*n*Math.sin(e/2)/h)||0,_=.5*(i+Math.sin(i)/h)||0;return{x:.5*(f/Math.PI+.5),y:1-.5*(_/Math.PI+1),z:0}}unproject(e,i){let n=e=(2*e-.5)*Math.PI,a=i=(2*(1-i)-1)*Math.PI,u=25;const h=1e-6;let f=0,_=0;do{const g=Math.cos(a),v=Math.sin(a),b=2*v*g,w=v*v,E=g*g,I=Math.cos(n/2),P=Math.sin(n/2),D=2*I*P,R=P*P,F=1-E*I*I,B=F?1/F:0,V=F?Math.acos(g*I)*Math.sqrt(1/F):0,$=.5*(2*V*g*P+2*n/Math.PI)-e,H=.5*(V*v+a)-i,J=.5*B*(E*R+V*g*I*w)+1/Math.PI,ee=B*(D*b/4-V*v*P),K=.125*B*(b*P-V*v*E*D),re=.5*B*(w*I+V*R*g)+.5,se=ee*K-re*J;f=(H*ee-$*re)/se,_=($*K-H*J)/se,n=Y(n-f,-Math.PI,Math.PI),a=Y(a-_,-wv,wv)}while((Math.abs(f)>h||Math.abs(_)>h)&&--u>0);return new Z(he(n),he(a))}}
vendor: 11,274 bytes, line 8
8class Tv extends Ka{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos($t(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(e,i){const{scale:n,cosPhi:a}=this;return{x:$t(e)*a*n+.5,y:-Math.sin($t(i))/a*n+.5,z:0}}unproject(e,i){const{scale:n,cosPhi:a}=this,u=-(i-.5)/n,h=Y(he((e-.5)/n)/a,-180,180),f=Math.asin(Y(u*a,-1,1)),_=Y(he(f),-85.051129,oe);return new Z(h,_)}}class Hw extends vv{constructor(e){super(e),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(e,i,n){const a=nd(e,i,n);return Qi(a,a,Sp(As(n))),{x:a[0],y:a[1],z:a[2]}}locationPoint(e,i,n){const a=Q(i.lat,i.lng),u=mi([],a),h=n?e._centerAltitude+n:e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(i),e._centerAltitude):e._centerAltitude;Mn(a,a,u,ge(1,0)*We*h);const f=Ei(new Float64Array(16));return Ii(f,e.pixelMatrix,e.globeMatrix),Qi(a,a,f),new Be(a[0],a[1])}pixelsPerMeter(e,i){return ge(1,0)*i}pixelSpaceConversion(e,i,n){const a=ge(1,e)*i,u=_t(ge(1,45)*i,a,n);return this.pixelsPerMeter(e,i)/u}createTileMatrix(e,i,n){const a=e_(As(n.canonical));return Ii(new Float64Array(16),e.globeMatrix,a)}createInversionMatrix(e,i){const{center:n}=e,a=Sp(As(i));return Jn(a,a,$t(n.lng)),Lr(a,a,$t(n.lat)),Ji(a,a,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(a)}pointCoordinate(e,i,n,a){return kg(e,i,n,!0)||new Ke(0,0)}pointCoordinate3D(e,i,n){const a=this.pointCoordinate(e,i,n,0);return[a.x,a.y,a.z]}isPointAboveHorizon(e,i){return!kg(e,i.x,i.y,!1)}farthestPixelDistance(e){const i=(function(a,u){const h=a.cameraToCenterDistance,f=a._centerAltitude*u,_=a._camera,g=a._camera.forward(),v=nr([],ki([],g,-h),[0,0,f]),b=a.worldSize/(2*Math.PI),w=[0,0,-b],E=a.width/a.height,I=Math.tan(a.fovAboveCenter),P=ki([],_.up(),I),D=ki([],_.right(),I*E),R=mi([],nr([],nr([],g,P),D)),F=[];let B;if(new pi(v,R).closestPointOnSphere(w,b,F)){const V=nr([],F,w),$=tr([],V,v);B=Math.cos(a.fovAboveCenter)*gn($)}else{const V=tr([],v,w),$=tr([],w,v);mi($,$);const H=gn(V)-b;B=Math.sqrt(H*(H+2*b));const J=Math.acos(B/(b+H))-Math.acos(Gi(g,$));B*=Math.cos(J)}return 1.01*B})(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),n=Ha(e.zoom);if(n>0){const a=yv(e,ge(1,e.center.lat)*e.worldSize),u=e.worldSize/(2*Math.PI),h=Math.max(e.width,e.height)/e.worldSize*Math.PI;return _t(i,a+u*(1-Math.cos(h)),Math.pow(n,10))}return i}upVector(e,i,n){return nd(i,n,e,1)}upVectorScale(e){return{metersToTile:bp(Tp(As(e)))}}}function Sv(r){const e=r.parallels,i=!!e&&Math.abs(e[0]+e[1])<.01;switch(r.name){case"mercator":return new vv(r);case"equirectangular":return new Uw(r);case"naturalEarth":return new Gw(r);case"equalEarth":return new Vw(r);case"winkelTripel":return new qw(r);case"albers":return i?new Tv(r):new Nw(r);case"lambertConformalConic":return i?new Tv(r):new jw(r);case"globe":return new Hw(r)}throw new Error(`Invalid projection name: ${r.name}`)}const $w=Vt.types,Zw=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Fd(r,e,i,n,a,u,h,f,_,g,v,b,w){const E=f?Math.min(rc,Math.round(f[0])):0,I=f?Math.min(rc,Math.round(f[1])):0;r.emplaceBack(e,i,Math.round(32*n),Math.round(32*a),u,h,(E<<1)+(_?1:0),0+(I<<1),16*g,16*v,256*b,256*w)}function Od(r,e,i){r.emplaceBack(e,i)}function kd(r,e,i,n,a,u,h){r.emplaceBack(e,i,n,a,u,h)}const nm=(r,e,i,n)=>{for(let a=0;a<e;a++)r.emplaceBack(i[0],i[1],i[2],n[0],n[1],n[2])};function Su(r,e,i,n,a){r.emplaceBack(e,i,n,a),r.emplaceBack(e,i,n,a),r.emplaceBack(e,i,n,a),r.emplaceBack(e,i,n,a)}function Ww(r){for(const e of r.sections)if(bs(e.text))return!0;return!1}class ng{constructor(e){this.layoutVertexArray=new Xh,this.indexArray=new hr,this.programConfigurations=e,this.segments=new Ci,this.dynamicLayoutVertexArray=new Is,this.opacityVertexArray=new Kh,this.placedSymbolArray=new sp,this.iconTransitioningVertexArray=new On,this.globeExtVertexArray=new Yh,this.zOffsetVertexArray=new Ir,this.orientationVertexArray=new ru,this.symbolInstanceIndices=[]}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0&&this.iconTransitioningVertexArray.length===0}getSymbolVertexData(e,i){const n=[],a=this.layoutVertexArray.uint16;for(let u=0;u<i;++u){const h=12*(e+u);n.push(...a.slice(h,h+12))}return n}updateSymbolVertexData(e,i,n,a,u,h,f,_,g,v,b,w,E){const I=this.layoutVertexArray.uint16,P=12*e;I[P]=i,I[P+1]=n,I[P+2]=a,I[P+3]=u,I[P+4]=h,I[P+5]=f,I[P+6]=_,I[P+7]=g,I[P+8]=v,I[P+9]=b,I[P+10]=w,I[P+11]=E}upload(e,i,n,a,u,h){this.isEmpty()||(n&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Yb.members,!!h),this.indexBuffer=e.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Jb.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,Zw,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=e.createVertexBuffer(this.iconTransitioningVertexArray,tw.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,Kb.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||u)&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,Qb.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=e.createVertexBuffer(this.orientationVertexArray,ew.members,!0)),this.opacityVertexBuffer.itemSize=1),(n||a)&&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(),this.iconTransitioningVertexBuffer&&this.iconTransitioningVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.orientationVertexBuffer&&this.orientationVertexBuffer.destroy())}}nt(ng,"SymbolBuffers");class og{constructor(e,i,n){this.layoutVertexArray=new e,this.layoutAttributes=i,this.indexArray=new n,this.segments=new Ci,this.collisionVertexArray=new iu,this.collisionVertexArrayExt=new Is}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,iw.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,rw.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}nt(og,"CollisionBuffers");class om{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(h=>h.fqid),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Ei([]),this.placementViewportMatrix=Ei([]);const i=this.layers[0]._unevaluatedLayout._values;this.worldview=e.worldview,this.localizable=e.localizable,this.textSizeData=ic(this.zoom,i["text-size"],this.worldview,e.availableImages),this.iconSizeData=ic(this.zoom,i["icon-size"],this.worldview,e.availableImages);const n=this.layers[0].layout,a=n.get("symbol-sort-key"),u=n.get("symbol-z-order");this.lut=e.lut,this.canOverlap=n.get("text-allow-overlap")||n.get("icon-allow-overlap")||n.get("text-ignore-placement")||n.get("icon-ignore-placement"),this.sortFeaturesByKey=u!=="viewport-y"&&a.constantOr(1)!==void 0,this.sortFeaturesByY=(u==="viewport-y"||u==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=n.get("text-writing-mode").map(h=>jn[h]),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id),this.sourceID=e.sourceID,this.projection=e.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=!1,this.elevationType="none",this.elevationStateComplete=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.hasAnySecondaryIcon=!1,this.hasAppearances=null,this.lastActiveApperance=null,this.featureToAppearanceIndex={}}hasAnyAppearanceProperty(e){const i=this.layers[0].getAppearances();if(!i||i.length===0)return!1;const n=Array.isArray(e)?e:[e];return i.some(a=>n.some(u=>a.getProperty(u)!=null))}createArrays(){this.text=new ng(new S(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("text")||e.startsWith("symbol"))),this.icon=new ng(new S(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("icon")||e.startsWith("symbol"))),this.glyphOffsetArray=new ql,this.lineVertexArray=new cp,this.symbolInstances=new lp}calculateGlyphDependencies(e,i,n,a,u){for(const h of e){const f=h.codePointAt(0);if(f===void 0)break;if(i[f]=!0,a&&u&&f<=65535){const _=Ed[h];_&&(i[_.charCodeAt(0)]=!0)}}}calculateEffectiveAppearanceIconSize(e,i,n,a,u,h,f){if(!e.hasProperty("icon-size"))return f*h;let _=1;const g=e.getUnevaluatedProperties()._values["icon-size"],v=ic(this.zoom,g,this.worldview,u),b=vu(v,i);if(v.kind!=="constant"&&v.kind!=="camera"||(_=b.uSize),v.kind==="composite"){const{minZoom:w,maxZoom:E}=v,I=g.possiblyEvaluate(new ui(w,{worldview:this.worldview}),a),P=g.possiblyEvaluate(new ui(E,{worldview:this.worldview}),a),D=I.evaluate(n,{},a,u);_=D+(P.evaluate(n,{},a,u)-D)*b.uSizeT}return v.kind==="source"&&(_=g.possiblyEvaluate(new ui(this.zoom,{worldview:this.worldview}),a).evaluate(n,{},a,u)),_*h}updateFootprints(e,i){}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;const n=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);return!Dp(this.activeReplacements,n)&&(this.activeReplacements=n,!0)}getResolvedImageFromTokens(e){return typeof e=="string"?dn.build(e):e}populate(e,i,n,a){const u=this.layers[0],h=u.layout,f=this.projection.name==="globe",_=h.get("text-font"),g=h.get("text-field"),v=h.get("icon-image"),[b,w]=h.get("icon-size-scale-range"),E=Y(i.scaleFactor||1,b,w),I=(g.value.kind!=="constant"||g.value.value instanceof jr&&!g.value.value.isEmpty()||g.value.value.toString().length>0)&&(_.value.kind!=="constant"||_.value.value.length>0),P=v.value.kind!=="constant"||!!v.value.value||Object.keys(v.parameters).length>0,D=this.hasAnyAppearanceProperty("icon-image"),R=h.get("symbol-sort-key");if(this.features=[],this.appearanceFeatureData=[],!I&&!P&&!D)return;const F=i.iconDependencies,B=i.glyphDependencies,V=i.availableImages,$=new ui(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),H=J=>{const ee=J.id.toString();F.has(ee)?F.get(ee).push(J):F.set(ee,[J])};for(const J of e){const{feature:ee,id:K,index:re,sourceLayerIndex:se}=J,Ee=u._featureFilter.needGeometry,we=Pt(ee,Ee);
8if(!u._featureFilter.filter($,we,n))continue;if(Ee||(we.geometry=yt(ee,n,a)),f&&ee.type!==1&&n.z<=5){const Le=we.geometry,ze=.98078528056,tt=(it,Ze)=>Gi(nd(it.x,it.y,n,1),nd(Ze.x,Ze.y,n,1))<ze;for(let it=0;it<Le.length;it++)Le[it]=st(Le[it],tt)}let Se,Re;if(I){const Le=u.getValueAndResolveTokens("text-field",we,n,V),ze=jr.factory(Le);Ww(ze)&&(this.hasRTLText=!0),(!this.hasRTLText||Oh()==="unavailable"||this.hasRTLText&&oo.isParsed())&&(Se=ow(ze,u,we))}if(P){const Le=u.getValueAndResolveTokens("icon-image",we,n,V);Re=this.getResolvedImageFromTokens(Le)}const Ce=this.layers[0];let Pe=!1;if(!Re&&D){const Le=Ce.getAppearances();for(const ze of Le)if(ze.getProperty("icon-image")){const tt=Ce.getAppearanceValueAndResolveTokens(ze,"icon-image",we,n,V);if(tt){Re=this.getResolvedImageFromTokens(tt),Pe=!0;break}}}if(!Se&&!Re)continue;const ye=this.sortFeaturesByKey?R.evaluate(we,{},n):void 0,De={id:K,text:Se,icon:Re,index:re,sourceLayerIndex:se,geometry:we.geometry,properties:ee.properties,type:$w[ee.type],sortKey:ye};if(this.features.push(De),this.featureToAppearanceIndex[re]=this.appearanceFeatureData.length,this.appearanceFeatureData.push({id:K,properties:ee.properties,usesAppearanceIconAsPlaceholder:Pe,isUsingAppearanceIconVertexData:!1,isUsingAppearanceTextVertexData:!1,layoutBasedIconVertexData:[],layoutBasedTextVertexData:[],activeAppearance:null}),Re){const Le=Ce._unevaluatedLayout._values,{iconPrimary:ze,iconSecondary:tt}=Cd(Re,this.iconSizeData,Le["icon-size"],n,this.zoom,De,this.pixelRatio,E,this.worldview,V);H(ze),tt&&(this.hasAnySecondaryIcon=!0,H(tt))}const Ae=Ce.getAppearances();if(Ae.length!==0&&Ae.forEach(Le=>{if(!Le.getProperty("icon-image"))return;const ze=this.getCombinedIconPrimary(Le,Ce,we,n,V,De,E);ze&&H(ze)}),Se){const Le=_.evaluate(we,{},n).join(","),ze=h.get("text-rotation-alignment")==="map"&&h.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(jn.vertical)>=0;for(const tt of Se.sections)if(tt.image){const it=tt.image.getPrimary().scaleSelf(this.pixelRatio),Ze=it.id.toString(),Xe=F.get(Ze)||[];Xe.push(it),F.set(Ze,Xe)}else{const it=zh(Se.toString()),Ze=tt.fontStack||Le,Xe=B[Ze]=B[Ze]||{};this.calculateGlyphDependencies(tt.text,Xe,ze,this.allowVerticalPlacement,it)}}}if(h.get("symbol-placement")==="line"&&(this.features=(function(J){const ee={},K={},re=[];let se=0;function Ee(Ce){re.push(J[Ce]),se++}function we(Ce,Pe,ye){const De=K[Ce];return delete K[Ce],K[Pe]=De,re[De].geometry[0].pop(),re[De].geometry[0]=re[De].geometry[0].concat(ye[0]),De}function Se(Ce,Pe,ye){const De=ee[Pe];return delete ee[Pe],ee[Ce]=De,re[De].geometry[0].shift(),re[De].geometry[0]=ye[0].concat(re[De].geometry[0]),De}function Re(Ce,Pe,ye){const De=ye?Pe[0][Pe[0].length-1]:Pe[0][0];return`${Ce}:${De.x}:${De.y}`}for(let Ce=0;Ce<J.length;Ce++){const Pe=J[Ce],ye=Pe.geometry,De=Pe.text?Pe.text.toString():null;if(!De){Ee(Ce);continue}const Ae=Re(De,ye),Le=Re(De,ye,!0);if(Ae in K&&Le in ee&&K[Ae]!==ee[Le]){const ze=Se(Ae,Le,ye),tt=we(Ae,Le,re[ze].geometry);delete ee[Ae],delete K[Le],K[Re(De,re[tt].geometry,!0)]=tt,re[ze].geometry=null}else Ae in K?we(Ae,Le,ye):Le in ee?Se(Ae,Le,ye):(Ee(Ce),ee[Ae]=se-1,K[Le]=se-1)}return re.filter(Ce=>Ce.geometry)})(this.features)),h.get("symbol-elevation-reference")==="hd-road-markup"){if(this.elevationType="road",i.elevationFeatures){!this.elevationFeatures&&i.elevationFeatures.length>0&&(this.elevationFeatures=[],this.elevationFeatureIdToIndex=new Map);for(const J of i.elevationFeatures)this.elevationFeatureIdToIndex.set(J.id,this.elevationFeatures.length),this.elevationFeatures.push(J)}}else h.get("symbol-z-elevate")&&(this.elevationType="offset");this.elevationType!=="none"&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((J,ee)=>J.sortKey-ee.sortKey)}getCombinedIconPrimary(e,i,n,a,u,h,f){let _,g;const v=e.getUnevaluatedProperties();if(v._values["icon-image"].value!==void 0){const b=i.getAppearanceValueAndResolveTokens(e,"icon-image",n,a,u);_=this.getResolvedImageFromTokens(b)}else{const b=i.getValueAndResolveTokens("icon-image",n,a,u);_=this.getResolvedImageFromTokens(b)}if(_){const b=e.hasProperty("icon-size")?v._values["icon-size"]:i._unevaluatedLayout._values["icon-size"];g=Cd(_,ic(this.zoom,b,this.worldview,u),b,a,this.zoom,h,this.pixelRatio,f,this.worldview,u).iconPrimary}return g}updateSymbolInstanceIconVertices(e,i,n,a,u,h,f,_,g,v,b,w,E,I){if(e.placedIconSymbolIndex<0)return{vertexOffsetDelta:0,hasChanges:!1};if(i.activeAppearance===n)return{vertexOffsetDelta:e.numIconVertices,hasChanges:!1};if(n){const P=this.getCombinedIconPrimary(n,g,a,h,f,{sortKey:void 0,text:void 0,icon:null,index:e.featureIndex,sourceLayerIndex:e.featureIndex,geometry:[],properties:i.properties,type:"Point",id:i.id},v);if(!P)return{vertexOffsetDelta:0,hasChanges:!1};const D=P.toString(),R=this.iconAtlasPositions&&this.iconAtlasPositions.get(D);if(R){const{appearanceIconOffset:F,appearanceIconRotate:B}=hv(n,g,a,h,w,I,E,v);let V=Xp(R,void 0,F,g.layout.get("icon-anchor").evaluate(a,b,h));const $=R.sdf,H=g.layout.get("icon-text-fit").constantOr("none");H!=="none"&&i.textShaping&&i.iconTextFitPadding&&i.fontScale&&(V=W_(V,i.textShaping,H,i.iconTextFitPadding,F,i.fontScale));
8const J=this.calculateEffectiveAppearanceIconSize(n,_.zoom,a,h,f,v,E),ee=0,K=1+(Math.min(rc,Math.round(J*oa))<<1),re=J_(V,B,$,H!=="none",v);i.isUsingAppearanceIconVertexData||(i.isUsingAppearanceIconVertexData=!0,i.layoutBasedIconVertexData=this.icon.getSymbolVertexData(u,e.numIconVertices));let se=u;for(let we=0;we<re.length;++we){const Se=re[we],Re=i.layoutBasedIconVertexData[0]||e.tileAnchorX,Ce=i.layoutBasedIconVertexData[1]||e.tileAnchorY,Pe=16*Se.pixelOffsetTL.x,ye=16*Se.pixelOffsetTL.y,De=16*Se.pixelOffsetBR.x,Ae=16*Se.pixelOffsetBR.y,Le=16*Se.minFontScaleX,ze=16*Se.minFontScaleY;this.icon.updateSymbolVertexData(se,Re,Ce,Math.round(32*Se.tl.x),Math.round(32*Se.tl.y),Se.texPrimary.x,Se.texPrimary.y,ee,K,Pe,ye,Le,ze),this.icon.updateSymbolVertexData(se+1,Re,Ce,Math.round(32*Se.tr.x),Math.round(32*Se.tr.y),Se.texPrimary.x+Se.texPrimary.w,Se.texPrimary.y,ee,K,De,ye,Le,ze),this.icon.updateSymbolVertexData(se+2,Re,Ce,Math.round(32*Se.bl.x),Math.round(32*Se.bl.y),Se.texPrimary.x,Se.texPrimary.y+Se.texPrimary.h,ee,K,Pe,Ae,Le,ze),this.icon.updateSymbolVertexData(se+3,Re,Ce,Math.round(32*Se.br.x),Math.round(32*Se.br.y),Se.texPrimary.x+Se.texPrimary.w,Se.texPrimary.y+Se.texPrimary.h,ee,K,De,Ae,Le,ze),se+=4}const Ee=e.numIconVertices-4*re.length;for(let we=0;we<Ee;++we)this.icon.updateSymbolVertexData(se+we,0,0,0,0,0,0,0,0,0,0,0,0);return{vertexOffsetDelta:e.numIconVertices,hasChanges:!0}}}else if(i.usesAppearanceIconAsPlaceholder){if(this.layers[0].appearances&&this.layers[0].appearances.length>0)return this.icon.updateSymbolVertexData(u,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(u+1,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(u+2,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(u+3,0,0,0,0,0,0,0,0,0,0,0,0),{vertexOffsetDelta:e.numIconVertices,hasChanges:!0}}else if(i.isUsingAppearanceIconVertexData){const D=i.layoutBasedIconVertexData.length/12;for(let R=0;R<D;++R){const F=R*12;this.icon.updateSymbolVertexData(u+R,i.layoutBasedIconVertexData[F+0],i.layoutBasedIconVertexData[F+1],i.layoutBasedIconVertexData[F+2],i.layoutBasedIconVertexData[F+3],i.layoutBasedIconVertexData[F+4],i.layoutBasedIconVertexData[F+5],i.layoutBasedIconVertexData[F+6],i.layoutBasedIconVertexData[F+7],i.layoutBasedIconVertexData[F+8],i.layoutBasedIconVertexData[F+9],i.layoutBasedIconVertexData[F+10],i.layoutBasedIconVertexData[F+11])}return i.isUsingAppearanceIconVertexData=!1,{vertexOffsetDelta:D,hasChanges:!0}}return{vertexOffsetDelta:e.numIconVertices,hasChanges:!1}}updateSymbolInstanceTextVertices(e,i,n,a,u,h,f,_,g,v,b,w,E,I,P,D,R,F){const B=e.numHorizontalGlyphVertices>0||e.numVerticalGlyphVertices>0;if(!B)return{vertexOffsetDelta:B?e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices:0,hasChanges:!1};if(i.activeAppearance===n)return{vertexOffsetDelta:e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices,hasChanges:!1};if(n&&i.textShaping){const{appearanceTextOffset:V,appearanceTextRotate:$,appearanceTextSize:H}=dv(n,f,a,h,b,E,w);i.fontScale=_v(H,i.textScaleFactor);const J=n.getUnevaluatedProperty("text-size");let ee=this.textSizeData,K=D,re=R;n.hasProperty("text-size")&&(ee=ic(this.zoom,J,this.worldview,F),K=this.textSizeData.kind==="composite"?this.textSizeData.minZoom:0,re=this.textSizeData.kind==="composite"?this.textSizeData.maxZoom:0);const se=i.textShaping.bottom-b[1],Ee=i.textShaping.left-b[0],we=i.textShaping.right-b[0];i.textShaping.top=V[1]+(i.textShaping.top-b[1]),i.textShaping.bottom=V[1]+se,i.textShaping.left=V[0]+Ee,i.textShaping.right=V[0]+we;const Se=cv(0,i.textShaping,V,f,!1,a,g,this.allowVerticalPlacement,$),Re=H&&ee.kind==="composite"?J.possiblyEvaluate(new ui(K,{}),h).evaluate(a,v,h):I,Ce=H&&ee.kind==="composite"?J.possiblyEvaluate(new ui(re,{}),h).evaluate(a,v,h):P,Pe=ig(n.name,ee,H,_,Re,Ce),ye=Array.isArray(Pe)?Pe[1]:H,De=0,Ae=1+(Math.min(rc,Math.round(ye*oa))<<1);i.isUsingAppearanceTextVertexData||(i.isUsingAppearanceTextVertexData=!0,i.layoutBasedTextVertexData=this.text.getSymbolVertexData(u,e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices));for(let Le=0;Le<Se.length&&Le<(e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices)/4;++Le){const ze=Se[Le],tt=ze.glyphOffset[1],it=e.tileAnchorX,Ze=e.tileAnchorY,Xe=u+4*Le;this.text.updateSymbolVertexData(Xe,it,Ze,Math.round(32*ze.tl.x),Math.round(32*(tt+ze.tl.y)),ze.texPrimary.x,ze.texPrimary.y,De,Ae,ze.pixelOffsetTL.x,ze.pixelOffsetTL.y,ze.minFontScaleX,ze.minFontScaleY),this.text.updateSymbolVertexData(Xe+1,it,Ze,Math.round(32*ze.tr.x),Math.round(32*(tt+ze.tr.y)),ze.texPrimary.x+ze.texPrimary.w,ze.texPrimary.y,De,Ae,ze.pixelOffsetBR.x,ze.pixelOffsetTL.y,ze.minFontScaleX,ze.minFontScaleY),this.text.updateSymbolVertexData(Xe+2,it,Ze,Math.round(32*ze.bl.x),Math.round(32*(tt+ze.bl.y)),ze.texPrimary.x,ze.texPrimary.y+ze.texPrimary.h,De,Ae,ze.pixelOffsetTL.x,ze.pixelOffsetBR.y,ze.minFontScaleX,ze.minFontScaleY),this.text.updateSymbolVertexData(Xe+3,it,Ze,Math.round(32*ze.br.x),Math.round(32*(tt+ze.br.y)),ze.texPrimary.x+ze.texPrimary.w,ze.texPrimary.y+ze.texPrimary.h,De,Ae,ze.pixelOffsetBR.x,ze.pixelOffsetBR.y,ze.minFontScaleX,ze.minFontScaleY)}return{vertexOffsetDelta:e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices,hasChanges:!0}}if(i.isUsingAppearanceTextVertexData){const $=i.layoutBasedTextVertexData.length/12;for(let H=0;H<$;++H){const J=H*12;this.text.updateSymbolVertexData(u+H,i.layoutBasedTextVertexData[J+0],i.layoutBasedTextVertexData[J+1],i.layoutBasedTextVertexData[J+2],i.layoutBasedTextVertexData[J+3],i.layoutBasedTextVertexData[J+4],i.layoutBasedTextVertexData[J+5],i.layoutBasedTextVertexData[J+6],i.layoutBasedTextVertexData[J+7],i.layoutBasedTextVertexData[J+8],i.layoutBasedTextVertexData[J+9],i.layoutBasedTextVertexData[J+10],i.layoutBasedTextVertexData[J+11])}return i.isUsingAppearanceTextVertexData=!1,{vertexOffsetDelta:$,hasChanges:!0}}return{vertexOffsetDelta:e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices,hasChanges:!1}}update(e,i,n,a,u,h,f){this.text.programConfigurations.updatePaintArrays(e,i,u,n,a,h,f,this.worldview),this.icon.programConfigurations.updatePaintArrays(e,i,u,n,a,h,f,this.worldview)}updateRoadElevation(e){if(this.elevationType!=="road"||!this.elevationFeatures||this.elevationStateComplete)return;this.elevationStateComplete=!0,this.hasAnyZOffset=!1;let i=!1;const n=Ue(e),a=1/n;let u=!1,h=!1;for(let f=0;f<this.symbolInstances.length;f++){const _=this.symbolInstances.get(f),g=xi(1,0,0),v=xi(0,1,0),{numHorizontalGlyphVertices:b,numVerticalGlyphVertices:w,numIconVertices:E,numVerticalIconVertices:I}=_,P=b>0||w>0,D=E>0,R=this.elevationFeatures[_.elevationFeatureIndex];if(R){const F=new Be(_.tileAnchorX,_.tileAnchorY),B=.075+R.pointElevation(F);_.zOffset!==B&&(i=!0,_.zOffset=B),B!==0&&(this.hasAnyZOffset=!0);const V=R.computeSlopeNormal(F,a),$=zo(Po(),xi(0,0,1),V);ts(g,g,$),ts(v,v,$),g[2]*=n,v[2]*=n,g[0]===1&&g[1]===0&&g[2]===0&&v[0]===0&&v[1]===1&&v[2]===0||(u=u||P,h=h||D)}if(P&&(nm(this.text.orientationVertexArray,b,g,v),nm(this.text.orientationVertexArray,w,g,v)),D){const{placedIconSymbolIndex:F,verticalPlacedIconSymbolIndex:B}=_;F>=0&&nm(this.icon.orientationVertexArray,E,g,v),B>=0&&nm(this.icon.orientationVertexArray,I,g,v)}}u||(this.text.orientationVertexArray=void 0),h||(this.icon.orientationVertexArray=void 0),i&&(this.zOffsetBuffersNeedUpload=!0,this.zOffsetSortDirty=!0)}updateZOffset(){const e=(u,h,f)=>{n+=h,n>u.length&&u.resize(n);for(let _=-h;_<0;_++)u.emplace(_+n,f)},i=(u,h,f)=>{a+=h,a>u.length&&u.resize(a);for(let _=-h;_<0;_++)u.emplace(_+a,f)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let n=0,a=0;for(let u=0;u<this.symbolInstances.length;u++){const h=this.symbolInstances.get(u),{numHorizontalGlyphVertices:f,numVerticalGlyphVertices:_,numIconVertices:g}=h,v=h.zOffset,b=g>0;if((f>0||_>0)&&(e(this.text.zOffsetVertexArray,f,v),e(this.text.zOffsetVertexArray,_,v)),b){const{placedIconSymbolIndex:w,verticalPlacedIconSymbolIndex:E}=h;w>=0&&i(this.icon.zOffsetVertexArray,g,v),E>=0&&i(this.icon.zOffsetVertexArray,h.numVerticalIconVertices,v)}}this.text.zOffsetVertexBuffer&&this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&&this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray)}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e,i,n,a,u){!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.zOffsetBuffersNeedUpload,this.hasAppearances),this.hasAppearances===null&&(this.hasAppearances=this.layers.some(h=>h.appearances&&h.appearances.length>0)),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,this.hasAppearances),this.uploaded=!0}updateAppearances(e,i,n,a,u){if(!(e&&i&&n&&this.appearanceFeatureData))return!1;const h=this.icon.layoutVertexArray&&this.icon.layoutVertexArray.length>0&&this.icon.layoutVertexArray.arrayBuffer,f=this.text.layoutVertexArray&&this.text.layoutVertexArray.length>0&&this.text.layoutVertexArray.arrayBuffer;if(!h&&!f)return!1;const _=this.layers[0],g=_.layout;let v=1,b=0,w=!1;if(h){const[R,F]=g.get("icon-size-scale-range");v=Y(1,R,F)}let E=1,I=0,P=!1;if(f){const[R,F]=g.get("text-size-scale-range");E=Y(1,R,F)}const D=new Map;if(u&&n)for(const R of n){const F=u.getImage(R,_.scope);if(F){const B=new hn(R.toString());D.set(B.toString(),F)}}for(let R=0;R<this.symbolInstances.length;R++){const F=this.symbolInstances.get(R),B=this.featureToAppearanceIndex[F.featureIndex],V=B!==void 0?this.appearanceFeatureData[B]:void 0;if(!V)continue;const $=V.id,H=i&&$!==void 0?i[String($)]:void 0,J={type:"Point",id:V.id,properties:V.properties,geometry:[]},ee=_.appearances&&_.appearances.find(K=>K.isActive({globals:a,feature:J,canonical:e,featureState:H}));if(f){const K=g.get("text-size"),re=g.get("text-offset").evaluate(J,H,e),se=K.evaluate(J,H,e),Ee=g.get("text-rotate").evaluate(J,H,e),we=this.textSizeData.kind==="composite"?this.textSizeData.minZoom:0,Se=this.textSizeData.kind==="composite"?this.textSizeData.maxZoom:0,Re=K.evaluate(J,{zoom:we},e),Ce=K.evaluate(J,{zoom:Se},e),Pe=this.updateSymbolInstanceTextVertices(F,V,ee,J,I,e,_,E,D,H,re,se,Ee,Re,Ce,we,Se,n);I+=Pe.vertexOffsetDelta,P=P||Pe.hasChanges}if(h){const K=g.get("icon-offset").evaluate(J,H,e),re=g.get("icon-size").evaluate(J,H,e,n),se=g.get("icon-rotate").evaluate(J,H,e),Ee=this.updateSymbolInstanceIconVertices(F,V,ee,J,b,e,n,a,_,v,H,K,re,se);b+=Ee.vertexOffsetDelta,w=w||Ee.hasChanges}V.activeAppearance=ee}return w&&this.icon.layoutVertexBuffer&&this.icon.layoutVertexArray.arrayBuffer!==null&&this.icon.layoutVertexArray.length===this.icon.layoutVertexBuffer.length&&this.icon.layoutVertexBuffer.updateData(this.icon.layoutVertexArray),P&&this.text.layoutVertexBuffer&&this.text.layoutVertexArray.arrayBuffer!==null&&this.text.layoutVertexArray.length===this.text.layoutVertexBuffer.length&&this.text.layoutVertexBuffer.updateData(this.text.layoutVertexArray),w||P}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=Sv(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,i){const n=this.lineVertexArray.length;if(e.segment!==void 0)for(const{x:a,y:u}of i)this.lineVertexArray.emplaceBack(a,u);return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(e,i,n,a,u,h,f,_,g,v,b,w,E,I,P,D,R,F){const B=e.indexArray,V=e.layoutVertexArray,$=e.globeExtVertexArray,H=e.segments.prepareSegment(4*F,V,B,this.canOverlap?h.sortKey:void 0),J=this.glyphOffsetArray.length,ee=H.vertexLength,K=this.allowVerticalPlacement&&f===jn.vertical?Math.PI/2:0,re=h.text&&h.text.sections;for(let we=0;we<i.length;we++){const{tl:Se,tr:Re,bl:Ce,br:Pe,texPrimary:ye,texSecondary:De,pixelOffsetTL:Ae,pixelOffsetBR:Le,minFontScaleX:ze,minFontScaleY:tt,glyphOffset:it,isSDF:Ze,sectionIndex:Xe}=i[we],pt=H.vertexLength,ct=it[1];if(Fd(V,g.x,g.y,Se.x,ct+Se.y,ye.x,ye.y,n,Ze,Ae.x,Ae.y,ze,tt),Fd(V,g.x,g.y,Re.x,ct+Re.y,ye.x+ye.w,ye.y,n,Ze,Le.x,Ae.y,ze,tt),Fd(V,g.x,g.y,Ce.x,ct+Ce.y,ye.x,ye.y+ye.h,n,Ze,Ae.x,Le.y,ze,tt),Fd(V,g.x,g.y,Pe.x,ct+Pe.y,ye.x+ye.w,ye.y+ye.h,n,Ze,Le.x,Le.y,ze,tt),_){const{x:Qe,y:bt,z:Ot}=_.anchor,[Kt,Lt,hi]=_.up;kd($,Qe,bt,Ot,Kt,Lt,hi),kd($,Qe,bt,Ot,Kt,Lt,hi),kd($,Qe,bt,Ot,Kt,Lt,hi),kd($,Qe,bt,Ot,Kt,Lt,hi),Su(e.dynamicLayoutVertexArray,Qe,bt,Ot,K)}else Su(e.dynamicLayoutVertexArray,g.x,g.y,g.z,K);if(D){const Qe=De||ye;Od(e.iconTransitioningVertexArray,Qe.x,Qe.y),Od(e.iconTransitioningVertexArray,Qe.x+Qe.w,Qe.
vendor: 16,429 bytes, line 8
8y),Od(e.iconTransitioningVertexArray,Qe.x,Qe.y+Qe.h),Od(e.iconTransitioningVertexArray,Qe.x+Qe.w,Qe.y+Qe.h)}B.emplaceBack(pt,pt+1,pt+2),B.emplaceBack(pt+1,pt+2,pt+3),H.vertexLength+=4,H.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(it[0]),we!==i.length-1&&Xe===i[we+1].sectionIndex||e.programConfigurations.populatePaintArrays(V.length,h,h.index,{},E,I,P,re&&re[Xe],this.worldview)}const se=F-i.length;se!==0&&this._addNullVertices(se,V,n,_,$,e,D,H,B);const Ee=_?_.anchor:g;e.placedSymbolArray.emplaceBack(Ee.x,Ee.y,Ee.z,g.x,g.y,J,this.glyphOffsetArray.length-J,ee,v,b,g.segment,n?n[0]:0,n?n[1]:0,a[0],a[1],f,0,0,0,w,0),e.symbolInstanceIndices.push(R)}_addNullVertices(e,i,n,a,u,h,f,_,g){for(let v=0;v<e;v++){for(let w=0;w<4;w++)Fd(i,0,0,0,0,0,0,n,!1,0,0,0,0),a&&kd(u,0,0,0,0,0,0),Su(h.dynamicLayoutVertexArray,0,0,0,0),f&&Od(h.iconTransitioningVertexArray,0,0);const b=_.vertexLength;g.emplaceBack(b,b+1,b+2),g.emplaceBack(b+1,b+2,b+3),_.vertexLength+=4,_.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(0)}}_commitLayoutVertex(e,i,n,a,u,h,f){e.emplaceBack(i,n,a,u,h,Math.round(f.x),Math.round(f.y))}_addCollisionDebugVertices(e,i,n,a,u,h,f){const _=n.segments.prepareSegment(4,n.layoutVertexArray,n.indexArray),g=_.vertexLength,v=f.tileAnchorX,b=f.tileAnchorY;for(let E=0;E<4;E++)n.collisionVertexArray.emplaceBack(0,0,0,0,0,0);this._commitDebugCollisionVertexUpdate(n.collisionVertexArrayExt,i,e.padding,f.zOffset),this._commitLayoutVertex(n.layoutVertexArray,a,u,h,v,b,new Be(e.x1,e.y1)),this._commitLayoutVertex(n.layoutVertexArray,a,u,h,v,b,new Be(e.x2,e.y1)),this._commitLayoutVertex(n.layoutVertexArray,a,u,h,v,b,new Be(e.x2,e.y2)),this._commitLayoutVertex(n.layoutVertexArray,a,u,h,v,b,new Be(e.x1,e.y2)),_.vertexLength+=4;const w=n.indexArray;w.emplaceBack(g,g+1),w.emplaceBack(g+1,g+2),w.emplaceBack(g+2,g+3),w.emplaceBack(g+3,g),_.primitiveLength+=4}_addTextDebugCollisionBoxes(e,i,n,a,u,h){for(let f=a;f<u;f++){const _=n.get(f),g=this.getSymbolInstanceTextSize(e,h,i,f);this._addCollisionDebugVertices(_,g,this.textCollisionBox,_.projectedAnchorX,_.projectedAnchorY,_.projectedAnchorZ,h)}}_addIconDebugCollisionBoxes(e,i,n,a,u,h){for(let f=a;f<u;f++){const _=n.get(f),g=this.getSymbolInstanceIconSize(e,i,h.placedIconSymbolIndex);this._addCollisionDebugVertices(_,g,this.iconCollisionBox,_.projectedAnchorX,_.projectedAnchorY,_.projectedAnchorZ,h)}}generateCollisionDebugBuffers(e,i,n){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new og(eu,Nx.members,On),this.iconCollisionBox=new og(eu,Nx.members,On);const a=vu(this.iconSizeData,e),u=vu(this.textSizeData,e,n);for(let h=0;h<this.symbolInstances.length;h++){const f=this.symbolInstances.get(h);this._addTextDebugCollisionBoxes(u,e,i,f.textBoxStartIndex,f.textBoxEndIndex,f),this._addTextDebugCollisionBoxes(u,e,i,f.verticalTextBoxStartIndex,f.verticalTextBoxEndIndex,f),this._addIconDebugCollisionBoxes(a,e,i,f.iconBoxStartIndex,f.iconBoxEndIndex,f),this._addIconDebugCollisionBoxes(a,e,i,f.verticalIconBoxStartIndex,f.verticalIconBoxEndIndex,f)}}getSymbolInstanceTextSize(e,i,n,a){const u=this.text.placedSymbolArray.get(i.rightJustifiedTextSymbolIndex>=0?i.rightJustifiedTextSymbolIndex:i.centerJustifiedTextSymbolIndex>=0?i.centerJustifiedTextSymbolIndex:i.leftJustifiedTextSymbolIndex>=0?i.leftJustifiedTextSymbolIndex:i.verticalPlacedTextSymbolIndex>=0?i.verticalPlacedTextSymbolIndex:a),h=X_(this.textSizeData,e,u)/br;return this.tilePixelRatio*h}getSymbolInstanceIconSize(e,i,n){const a=this.icon.placedSymbolArray.get(n),u=X_(this.iconSizeData,e,a);return this.tilePixelRatio*u}_commitDebugCollisionVertexUpdate(e,i,n,a){e.emplaceBack(i,-n,-n,a),e.emplaceBack(i,n,-n,a),e.emplaceBack(i,n,n,a),e.emplaceBack(i,-n,n,a)}_updateTextDebugCollisionBoxes(e,i,n,a,u,h,f){for(let _=a;_<u;_++){const g=n.get(_),v=this.getSymbolInstanceTextSize(e,h,i,_);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,v,g.padding,h.zOffset)}}_updateIconDebugCollisionBoxes(e,i,n,a,u,h,f){for(let _=a;_<u;_++){const g=n.get(_),v=this.getSymbolInstanceIconSize(e,i,h.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,v,g.padding,h.zOffset)}}updateCollisionDebugBuffers(e,i,n,a){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const u=vu(this.iconSizeData,e,a),h=vu(this.textSizeData,e,n);for(let f=0;f<this.symbolInstances.length;f++){const _=this.symbolInstances.get(f);this._updateTextDebugCollisionBoxes(h,e,i,_.textBoxStartIndex,_.textBoxEndIndex,_,n),this._updateTextDebugCollisionBoxes(h,e,i,_.verticalTextBoxStartIndex,_.verticalTextBoxEndIndex,_,n),this._updateIconDebugCollisionBoxes(u,e,i,_.iconBoxStartIndex,_.iconBoxEndIndex,_,a),this._updateIconDebugCollisionBoxes(u,e,i,_.verticalIconBoxStartIndex,_.verticalIconBoxEndIndex,_,a)}this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexBufferExt&&this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexBufferExt&&this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt)}_deserializeCollisionBoxesForSymbol(e,i,n,a,u,h,f,_,g){const v={};if(i<n){const{x1:b,y1:w,x2:E,y2:I,padding:P,projectedAnchorX:D,projectedAnchorY:R,projectedAnchorZ:F,tileAnchorX:B,tileAnchorY:V,featureIndex:$}=e.get(i);v.textBox={x1:b,y1:w,x2:E,y2:I,padding:P,projectedAnchorX:D,projectedAnchorY:R,projectedAnchorZ:F,tileAnchorX:B,tileAnchorY:V},v.textFeatureIndex=$}if(a<u){const{x1:b,y1:w,x2:E,y2:I,padding:P,projectedAnchorX:D,projectedAnchorY:R,projectedAnchorZ:F,tileAnchorX:B,tileAnchorY:V,featureIndex:$}=e.get(a);v.verticalTextBox={x1:b,y1:w,x2:E,y2:I,padding:P,projectedAnchorX:D,projectedAnchorY:R,projectedAnchorZ:F,tileAnchorX:B,tileAnchorY:V},v.verticalTextFeatureIndex=$}if(h<f){const{x1:b,y1:w,x2:E,y2:I,padding:P,projectedAnchorX:D,projectedAnchorY:R,projectedAnchorZ:F,tileAnchorX:B,tileAnchorY:V,featureIndex:$}=e.get(h);v.iconBox={x1:b,y1:w,x2:E,y2:I,padding:P,projectedAnchorX:D,projectedAnchorY:R,projectedAnchorZ:F,tileAnchorX:B,tileAnchorY:V},v.iconFeatureIndex=$}if(_<g){const{x1:b,y1:w,x2:E,y2:I,padding:P,projectedAnchorX:D,projectedAnchorY:R,projectedAnchorZ:F,tileAnchorX:B,tileAnchorY:V,featureIndex:$}=e.get(_);v.verticalIconBox={x1:b,y1:w,x2:E,y2:I,padding:P,projectedAnchorX:D,projectedAnchorY:R,projectedAnchorZ:F,tileAnchorX:B,tileAnchorY:V},v.verticalIconFeatureIndex=$}return v}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let i=0;i<this.symbolInstances.length;i++){const n=this.symbolInstances.get(i);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,n.textBoxStartIndex,n.textBoxEndIndex,n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n.iconBoxStartIndex,n.iconBoxEndIndex,n.verticalIconBoxStartIndex,n.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}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(e,i){const n=e.placedSymbolArray.get(i),a=n.vertexStartIndex+4*n.numGlyphs;for(let u=n.vertexStartIndex;u<a;u+=4)e.indexArray.emplaceBack(u,u+1,u+2),e.indexArray.emplaceBack(u+1,u+2,u+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const i=Math.sin(e),n=Math.cos(e),a=[],u=[],h=[];for(let f=0;f<this.symbolInstances.length;++f){h.push(f);const _=this.symbolInstances.get(f);a.push(0|Math.round(i*_.tileAnchorX+n*_.tileAnchorY)),u.push(_.featureIndex)}return h.sort((f,_)=>a[f]-a[_]||u[_]-u[f]),h}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let e=0;e<this.symbolInstances.length;++e)this.symbolInstanceIndexesSortedZOffset.push(e)}return this.zOffsetSortDirty=!1,this.symbolInstanceIndexesSortedZOffset.sort((e,i)=>this.symbolInstances.get(i).zOffset-this.symbolInstances.get(e).zOffset)}addToSortKeyRanges(e,i){const n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===i?n.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:i,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 i of this.symbolInstanceIndexes){const n=this.symbolInstances.get(i);this.featureSortOrder.push(n.featureIndex);const{rightJustifiedTextSymbolIndex:a,centerJustifiedTextSymbolIndex:u,leftJustifiedTextSymbolIndex:h,verticalPlacedTextSymbolIndex:f,placedIconSymbolIndex:_,verticalPlacedIconSymbolIndex:g}=n;a>=0&&this.addIndicesForPlacedSymbol(this.text,a),u>=0&&u!==a&&this.addIndicesForPlacedSymbol(this.text,u),h>=0&&h!==u&&h!==a&&this.addIndicesForPlacedSymbol(this.text,h),f>=0&&this.addIndicesForPlacedSymbol(this.text,f),_>=0&&this.addIndicesForPlacedSymbol(this.icon,_),g>=0&&this.addIndicesForPlacedSymbol(this.icon,g)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}getElevationFeatureForText(e){const i=this.symbolInstances.get(this.text.symbolInstanceIndices[e]).elevationFeatureIndex;let n;return this.elevationFeatures&&i<this.elevationFeatures.length&&(n=this.elevationFeatures[i]),n}}function Ev(r,e){return e.replace(/{([^{}]+)}/g,(i,n)=>n in r?String(r[n]):"")}let Iv,Av,sg;nt(om,"SymbolBucket",{omit:["layers","collisionBoxArray","compareText","features"]}),om.addDynamicAttributes=Su;class Mv{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:un,this.defaultValue=e}evaluate(e){if(e.formattedSection){const i=this.defaultValue.property.overrides;if(i&&i.hasOverride(e.formattedSection))return i.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}}nt(Mv,"FormatSectionOverride",{omit:["defaultValue"]});const ag=()=>sg||(sg={layout:Iv||(Iv=new Bi({"symbol-placement":new Ge(fe.layout_symbol["symbol-placement"]),"symbol-spacing":new Ge(fe.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ge(fe.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Je(fe.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ge(fe.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new Ge(fe.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new Ge(fe.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new Ge(fe.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Ge(fe.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ge(fe.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ge(fe.layout_symbol["icon-rotation-alignment"]),"icon-size":new Je(fe.layout_symbol["icon-size"]),"icon-size-scale-range":new Ge(fe.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new Je(fe.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Je(fe.layout_symbol["icon-text-fit-padding"]),"icon-image":new Je(fe.layout_symbol["icon-image"]),"icon-image-use-theme":new Ge({type:"string",default:"default","property-type":"data-constant"}),"icon-rotate":new Je(fe.layout_symbol["icon-rotate"]),"icon-padding":new Ge(fe.layout_symbol["icon-padding"]),"icon-keep-upright":new Ge(fe.layout_symbol["icon-keep-upright"]),"icon-offset":new Je(fe.layout_symbol["icon-offset"]),"icon-anchor":new Je(fe.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ge(fe.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ge(fe.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ge(fe.layout_symbol["text-rotation-alignment"]),"text-field":new Je(fe.layout_symbol["text-field"]),"text-font":new Je(fe.layout_symbol["text-font"]),"text-size":new Je(fe.layout_symbol["text-size"]),"text-size-scale-range":new Ge(fe.layout_symbol["text-size-scale-range"]),"text-max-width":new Je(fe.layout_symbol["text-max-width"]),"text-line-height":new Je(fe.layout_symbol["text-line-height"]),"text-letter-spacing":new Je(fe.layout_symbol["text-letter-spacing"]),"text-justify":new Je(fe.layout_symbol["text-justify"]),"text-radial-offset":new Je(fe.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ge(fe.layout_symbol["text-variable-anchor"]),"text-anchor":new Je(fe.layout_symbol["text-anchor"]),"text-max-angle":new Ge(fe.layout_symbol["text-max-angle"]),"text-writing-mode":new Ge(fe.layout_symbol["text-writing-mode"]),"text-rotate":new Je(fe.layout_symbol["text-rotate"]),"text-padding":new Ge(fe.layout_symbol["text-padding"]),"text-keep-upright":new Ge(fe.layout_symbol["text-keep-upright"]),"text-transform":new Je(fe.layout_symbol["text-transform"]),"text-offset":new Je(fe.layout_symbol["text-offset"]),"text-allow-overlap":new Ge(fe.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Ge(fe.layout_symbol["text-ignore-placement"]),"text-optional":new Ge(fe.layout_symbol["text-optional"]),visibility:new Ge(fe.layout_symbol.visibility)})),paint:Av||(Av=new Bi({"icon-opacity":new Je(fe.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new Je(fe.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new Je(fe.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new Je(fe.paint_symbol["text-emissive-strength"]),"icon-color":new Je(fe.paint_symbol["icon-color"]),"icon-halo-color":new Je(fe.paint_symbol["icon-halo-color"]),"icon-halo-width":new Je(fe.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Je(fe.paint_symbol["icon-halo-blur"]),"icon-translate":new Ge(fe.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ge(fe.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new Ge(fe.paint_symbol["icon-image-cross-fade"]),"text-opacity":new Je(fe.paint_symbol["text-opacity"]),"text-occlusion-opacity":new Je(fe.paint_symbol["text-occlusion-opacity"]),"text-color":new Je(fe.paint_symbol["text-color"],{runtimeType:Yr,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new Je(fe.paint_symbol["text-halo-color"]),"text-halo-width":new Je(fe.paint_symbol["text-halo-width"]),"text-halo-blur":new Je(fe.paint_symbol["text-halo-blur"]),"text-translate":new Ge(fe.paint_symbol["text-translate"]),"text-translate-anchor":new Ge(fe.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new Ge(fe.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new Ge(fe.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new Ge(fe.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new Ge(fe.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new Je(fe.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},sg);class sm extends Qr{constructor(e,i,n,a){super(e,ag(),i,n,a,e.layout?e.layout["icon-image-use-theme"]:null),this._colorAdjustmentMatrix=Ei([]),this.hasOcclusionOpacityProperties=e.paint!==void 0&&("icon-occlusion-opacity"in e.paint||"text-occlusion-opacity"in e.paint)}_handleSpecialPaintPropertyUpdate(e){e!=="icon-occlusion-opacity"&&e!=="text-occlusion-opacity"||(this.hasOcclusionOpacityProperties=!0)}recalculate(e,i){super.recalculate(e,i),this.appearances&&this.appearances.forEac
vendor: 12,152 bytes, line 8
8h(a=>{a.recalculate(e,i,this.iconImageUseTheme)}),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")),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const n=this.layout.get("text-writing-mode");if(n){const a=[];for(const u of n)a.indexOf(u)<0&&a.push(u);this.layout._values["text-writing-mode"]=a}else this.layout._values["text-writing-mode"]=this.layout.get("symbol-placement")==="point"?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(e,i,n,a){return this._saturation===e&&this._contrast===i&&this._brightnessMin===n&&this._brightnessMax===a||(this._colorAdjustmentMatrix=(function(u,h,f,_){u=zr(u),h=ji(h);const g=Hn(),v=u/3,b=1-2*v,w=[b,v,v,0,v,b,v,0,v,v,b,0,0,0,0,1],E=.5-.5*h,I=_-f;return Ii(g,[I,0,0,0,0,I,0,0,0,0,I,0,f,f,f,1],[h,0,0,0,0,h,0,0,0,0,h,0,E,E,E,1]),Ii(g,g,w),g})(e,i,n,a),this._saturation=e,this._contrast=i,this._brightnessMin=n,this._brightnessMax=a),this._colorAdjustmentMatrix}getValueAndResolveTokens(e,i,n,a){const u=this.layout.get(e).evaluate(i,{},n,a),h=this._unevaluatedLayout._values[e];return h.isDataDriven()||Rl(h.value)||!u?u:Ev(i.properties,u)}getAppearanceValueAndResolveTokens(e,i,n,a,u){const h=e.getProperty(i);if(!h)return;const f=h.evaluate(n,{},a,u),_=e.getUnevaluatedProperties()._values[i];return _.isDataDriven()||Rl(_.value)||!f||typeof f!="string"?f:Ev(n.properties,f)}createBucket(e){return new om(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of ag().paint.overridableProperties){if(!sm.hasPaintOverride(this.layout,e))continue;const i=this.paint.get(e),n=new Mv(i),a=new Gc(n,i.property.specification,this.scope,this.options,this.layout.get("icon-image-use-theme"));let u=null;u=i.value.kind==="constant"||i.value.kind==="source"?new zl("source",a):new Xs("composite",a,i.value.zoomStops,i.value.interpolationType),this.paint._values[e]=new Ks(i.property,u,i.parameters)}}_handleOverridablePaintPropertyUpdate(e,i,n){return!(!this.layout||i.isDataDriven()||n.isDataDriven())&&sm.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,i){const n=e.get("text-field"),a=ag().paint.properties[i];let u=!1;const h=f=>{for(const _ of f)if(a.overrides&&a.overrides.hasOverride(_))return void(u=!0)};if(n.value.kind==="constant"&&n.value.value instanceof jr)h(n.value.value.sections);else if(n.value.kind==="source"){const f=g=>{u||(g instanceof jo&&gr(g.value)===xa?h(g.value.sections):g instanceof ut?h(g.sections):g.eachChild(f))},_=n.value;_._styleExpression&&f(_._styleExpression.expression)}return u}getProgramIds(){return["symbol"]}getDefaultProgramParams(e,i,n){return{config:new T(this,{zoom:i,lut:n}),overrideFog:!1}}hasElevation(){return this.layout&&this.layout.get("symbol-elevation-reference")==="hd-road-markup"}}let Cv,Pv,Rv,zv;var lg=Nt([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function am(r,e,i,n,a,u,h,f){const _=[r,e,1,i,n,1,a,u,1],g=[h,f,1],v=Yi([],_),[b,w,E]=es(g,g,v);return lr(_,_,[b,0,0,0,w,0,0,0,E])}function Dv(r,e,i,n,a,u,h,f){const _=(function(g,v,b,w,E,I,P,D){const R=am(0,0,1,0,1,1,0,1),F=am(g,v,b,w,E,I,P,D);return lr(F,F,Yi([],R))})(r,e,i,n,a,u,h,f);return[_[2]/_[8]/We,_[5]/_[8]/We]}function lm(r){return[r[0],Math.min(Math.max(r[1],-85.051129),oe)]}class Lv extends Uo{constructor(e,i,n,a){super(),this.id=e,this.dispatcher=n,this.coordinates=i.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.onNorthPole=!1,this.onSouthPole=!1,this.setEventedParent(a),this.options=i,this._dirty=!1}load(e,i){if(this._loaded=i||!1,this.fire(new Vo("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return e&&(this.coordinates=e),this._loaded=!0,void this._finishLoading();this._imageRequest=fc(this.map._requestManager.transformRequest(this.url,ln.Image),(n,a)=>{this._imageRequest=null,this._loaded=!0,n?this.fire(new ml(n)):a&&(this.image=a instanceof HTMLImageElement?Rn.getImageData(a):a,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,e&&(this.coordinates=e),this._finishLoading())})}loaded(){return this._loaded}updateImage(e){return e.url?(this._imageRequest&&e.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=e.url,this.load(e.coordinates,this._loaded),this):this}setTexture(e){if(!(e.handle instanceof WebGLTexture))throw new Error("The provided handle is not a WebGLTexture instance");return this.texture=new wd(this.map.painter.context,e.handle),this.width=e.dimensions[0],this.height=e.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new Vo("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(e){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof wd||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(e){if(this.coordinates=e,this._boundsArray=void 0,this._unsupportedCoords=!1,!e.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let i=e[0][1],n=e[0][1];for(const u of e)u[1]>n&&(n=u[1]),u[1]<i&&(i=u[1]);const a=(n+i)/2;if(a>oe?this.onNorthPole=!0:a<-85.051129&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const u=e.map(Ke.fromLngLat);this.tileID=(function(h){let f=1/0,_=1/0,g=-1/0,v=-1/0;for(const P of h)f=Math.min(f,P.x),_=Math.min(_,P.y),g=Math.max(g,P.x),v=Math.max(v,P.y);const b=Math.max(g-f,v-_),w=Math.max(0,Math.floor(-Math.log2(b))),E=Math.pow(2,w);let I=Math.floor((f+g)/2*E);return I>1&&(I-=1),new Yl(w,I,Math.floor((_+v)/2*E))})(u),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new Vo("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof wd||(this.texture.destroy(),this._dirty=!0),this.texture=null,this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(e){for(const R in this.tiles){const F=this.tiles[R];F.state!=="loaded"&&(F.state="loaded",F.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const i=Pd(new Yl(0,0,0),this.map.transform.projection),n=[i.projection.project(this.coordinates[0][0],this.coordinates[0][1]),i.projection.project(this.coordinates[1][0],this.coordinates[1][1]),i.projection.project(this.coordinates[2][0],this.coordinates[2][1]),i.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!(function(R){const F=R[1].x-R[0].x,B=R[1].y-R[0].y,V=R[2].x-R[1].x,$=R[2].y-R[1].y,H=R[3].x-R[2].x,J=R[3].y-R[2].y,ee=R[0].x-R[3].x,K=R[0].y-R[3].y,re=F*$-V*B,se=V*J-H*$,Ee=H*K-ee*J,we=ee*B-F*K;return re>0&&se>0&&Ee>0&&we>0||re<0&&se<0&&Ee<0&&we<0})(n))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const a=Pd(this.tileID,this.map.transform.projection),[u,h,f,_]=this.coordinates.map(R=>{const F=a.projection.project(R[0],R[1]);return xv(a,F)._round()});this.perspectiveTransform=Dv(u.x,u.y,h.x,h.y,f.x,f.y,_.x,_.y);const g=this._boundsArray=new Zo;g.emplaceBack(u.x,u.y,0,0),g.emplaceBack(h.x,h.y,We,0),g.emplaceBack(_.x,_.y,0,We),g.emplaceBack(f.x,f.y,We,We),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=e.createVertexBuffer(g,lg.members),this.boundsSegments=Ci.simpleSegment(0,0,4,2);const v=[],b=[lm((w=this.coordinates)[0]),lm(w[1]),lm(w[2]),lm(w[3])];var w;const[E,I,P,D]=(function(R){let F=R[0][0],B=F,V=R[0][1],$=V;for(let H=1;H<R.length;H++)R[H][0]<F?F=R[H][0]:R[H][0]>B&&(B=R[H][0]),R[H][1]<V?V=R[H][1]:R[H][1]>$&&($=R[H][1]);return[F,V,B-F,$-V]})(b);{const R=new Zo,[F,B,V,$]=(function(Pe){let ye=Pe[0].x,De=ye,Ae=Pe[0].y,Le=Ae;for(let ze=1;ze<Pe.length;ze++)Pe[ze].x<ye?ye=Pe[ze].x:Pe[ze].x>De&&(De=Pe[ze].x),Pe[ze].y<Ae?Ae=Pe[ze].y:Pe[ze].y>Le&&(Le=Pe[ze].y);return[ye,Ae,De-ye,Le-Ae]})(n),H=Pe=>[(Pe.x-F)/V,(Pe.y-B)/$],[J,ee,K,re]=n.map(H),se=(function(Pe,ye,De,Ae,Le,ze,tt,it){const Ze=am(0,0,1,0,1,1,0,1);return lr(Ze,Ze,Yi([],am(Pe,ye,De,Ae,Le,ze,tt,it)))})(J[0],J[1],ee[0],ee[1],K[0],K[1],re[0],re[1]);this.elevatedGlobePerspectiveTransform=Dv(J[0],J[1],ee[0],ee[1],K[0],K[1],re[0],re[1]);const Ee=(Pe,ye)=>{v.push(Pe.lng);const De=Math.round((Pe.lng-E)/P*We),Ae=Math.round((Pe.lat-I)/D*We),Le=H(ye),ze=es([],[Le[0],Le[1],1],se),tt=Math.round(ze[0]/ze[2]*We),it=Math.round(ze[1]/ze[2]*We);R.emplaceBack(De,Ae,tt,it)},we=n[3].x-n[0].x,Se=n[3].y-n[0].y,Re=n[2].x-n[1].x,Ce=n[2].y-n[1].y;for(let Pe=0;Pe<65;Pe++){const ye=Pe/64,De=[n[0].x+ye*we,n[0].y+ye*Se],Ae=[n[1].x+ye*Re,n[1].y+ye*Ce],Le=Ae[0]-De[0],ze=Ae[1]-De[1];for(let tt=0;tt<65;tt++){const it=tt/64,Ze={x:De[0]+Le*it,y:De[1]+ze*it};Ee(i.projection.unproject(Ze.x,Ze.y),Ze)}}this.elevatedGlobeVertexBuffer=e.createVertexBuffer(R,lg.members)}{this.maxLongitudeTriangleSize=0;let R=[],F=new hr;const B=(V,$,H)=>{F.emplaceBack(V,$,H);const J=v[V],ee=v[$],K=v[H],re=Math.min(Math.min(J,ee),K),se=Math.max(Math.max(J,ee),K)-re;se>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=se),R.push(re+se/2)};for(let V=0;V<64;V++)for(let $=0;$<64;$++){const H=65*V+$,J=H+1,ee=H+65,K=ee+1;B(H,ee,J),B(J,ee,K)}[R,F]=(function(V,$){const H=Array.from({length:V.length},(K,re)=>re);H.sort((K,re)=>V[K]-V[re]);const J=[],ee=new hr;for(let K=0;K<H.length;K++){const re=H[K];J.push(V[re]);const se=3*re,Ee=se+1;ee.emplaceBack($.uint16[se],$.uint16[Ee],$.uint16[Ee+1])}return[J,ee]})(R,F),this.elevatedGlobeTrianglesCenterLongitudes=R,this.elevatedGlobeIndexBuffer=e.createIndexBuffer(F)}this.elevatedGlobeSegments=Ci.simpleSegment(0,0,4225,8192),this.elevatedGlobeGridMatrix=new Float32Array([0,P/We,0,D/We,0,0,I,E,0])}prepare(){const e=Object.keys(this.tiles).length!==0;if(this.tileID&&!e)return;const i=this.map.painter.context,n=i.gl;!this._dirty||this.texture instanceof wd||(this.texture?this.texture.update(this.image):(this.texture=new z_(i,this.image,n.RGBA8),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE)),this._dirty=!1),e&&this._prepareData(i)}loadTile(e,i){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={},i(null)):(e.state="errored",i(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}getSegmentsForLongitude(e){const i=this.elevatedGlobeSegments;if(!this.elevatedGlobeTrianglesCenterLongitudes||!i)return null;const n=this.elevatedGlobeTrianglesCenterLongitudes;let a=(u=e+180)+360*Math.round((n[0]-u)/360);var u;const h=new Ci,f=(b,w)=>{h.segments.push({vertexOffset:0,primitiveOffset:b,vertexLength:i.segments[0].vertexLength,primitiveLength:w,sortKey:void 0,vaos:{}})},_=.51*this.maxLongitudeTriangleSize;if(Math.abs(n[0]-a)<=_){const b=fi(n,0,n.length,a+_);return b===n.length||f(b,di(n,b+1,n.length,a+360-_)-b),h}a<n[0]&&(a+=360);const g=di(n,0,n.length,a-_);if(g===n.length)return f(0,n.length),h;f(0,g-0);const v=fi(n,g+1,n.length,a+_);return v!==n.length&&f(v,n.length-v),h}}const cg=1024,Xw=(Math.pow(cg,2)-1)/268170240;class Fv extends Qr{constructor(e,i,n,a){super(e,{layout:Rv||(Rv=new Bi({visibility:new Ge(fe.layout_raster.visibility)})),paint:zv||(zv=new Bi({"raster-opacity":new Ge(fe.paint_raster["raster-opacity"]),"raster-color":new Oa(fe.paint_raster["raster-color"]),"raster-color-mix":ne
8w Ge(fe.paint_raster["raster-color-mix"]),"raster-color-range":new Ge(fe.paint_raster["raster-color-range"]),"raster-hue-rotate":new Ge(fe.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ge(fe.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ge(fe.paint_raster["raster-brightness-max"]),"raster-saturation":new Ge(fe.paint_raster["raster-saturation"]),"raster-contrast":new Ge(fe.paint_raster["raster-contrast"]),"raster-resampling":new Ge(fe.paint_raster["raster-resampling"]),"raster-fade-duration":new Ge(fe.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new Ge(fe.paint_raster["raster-emissive-strength"]),"raster-array-band":new Ge(fe.paint_raster["raster-array-band"]),"raster-elevation":new Ge(fe.paint_raster["raster-elevation"]),"raster-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},i,n,a),this.updateColorRamp(),this._curRampRange=[NaN,NaN]}getProgramIds(){return["raster"]}hasColorMap(){return!!this._transitionablePaint._values["raster-color"].value.value}tileCoverLift(){return this.paint.get("raster-elevation")}isDraped(e){return!(e&&e._source instanceof Lv&&(e._source.onNorthPole||e._source.onSouthPole))&&this.paint.get("raster-elevation")===0}_handleSpecialPaintPropertyUpdate(e){e!=="raster-color"&&e!=="raster-color-range"||(this._curRampRange=[NaN,NaN],this.updateColorRamp())}_clear(){this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}updateColorRamp(e){if(!this.hasColorMap()||!this._curRampRange)return;const i=this._transitionablePaint._values["raster-color"].value.expression,[n,a]=e||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];isNaN(n)&&isNaN(a)||n===this._curRampRange[0]&&a===this._curRampRange[1]||(this.colorRamp=od({expression:i,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:n,end:a}],resolution:cg}),this.colorRampTexture=null,this._curRampRange=[n,a])}is3D(e){return this.paint.get("raster-elevation")>0}}let Ov,kv,Bv,Nv,Vv;class Uv extends Qr{constructor(e,i,n,a){super(e,{layout:Ov||(Ov=new Bi({visibility:new Ge(fe["layout_raster-particle"].visibility)})),paint:kv||(kv=new Bi({"raster-particle-array-band":new Ge(fe["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new Ge(fe["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new Oa(fe["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new Ge(fe["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new Ge(fe["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new Ge(fe["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new Ge(fe["paint_raster-particle"]["raster-particle-reset-rate-factor"]),"raster-particle-elevation":new Ge(fe["paint_raster-particle"]["raster-particle-elevation"]),"raster-particle-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},i,n,a),this._updateColorRamp(),this.lastInvalidatedAt=Rn.now()}_clear(){this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null),this.tileFramebuffer&&(this.tileFramebuffer.destroy(),this.tileFramebuffer=null),this.particleFramebuffer&&(this.particleFramebuffer.destroy(),this.particleFramebuffer=null)}onRemove(e){this.colorRampTexture&&this.colorRampTexture.destroy(),this.tileFramebuffer&&this.tileFramebuffer.destroy(),this.particleFramebuffer&&this.particleFramebuffer.destroy()}hasColorMap(){return!!this._transitionablePaint._values["raster-particle-color"].value.value}getProgramIds(){return["rasterParticle"]}hasOffscreenPass(){return this.visibility!=="none"}isDraped(e){return!1}_handleSpecialPaintPropertyUpdate(e){e!=="raster-particle-color"&&e!=="raster-particle-max-speed"||(this._updateColorRamp(),this._invalidateAnimationState()),e==="raster-particle-count"&&this._invalidateAnimationState()}_updateColorRamp(){if(!this.hasColorMap())return;const e=this._transitionablePaint._values["raster-particle-color"].value.expression,i=this._transitionablePaint._values["raster-particle-max-speed"].value.expression.evaluate({zoom:0});this.colorRamp=od({expression:e,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:i}],resolution:256}),this.colorRampTexture=null}
vendor: 11,943 bytes, line 8
8_invalidateAnimationState(){this.lastInvalidatedAt=Rn.now()}tileCoverLift(){return this.paint.get("raster-particle-elevation")}}class Yw extends Qr{constructor(e,i){super(e,{},i,null),this.implementation=e,e.slot&&(this.slot=e.slot)}is3D(e){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}isDraped(e){return this.implementation.renderToTile!==void 0}shouldRedrape(){return!!this.implementation.shouldRerenderTiles&&this.implementation.shouldRerenderTiles()}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(e){this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)}onRemove(e){this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)}}function ug(r,e,i){const n=[0,0,1],a=Ro([]);return Bs(a,a,i?-$t(r)+Math.PI:$t(r)),rs(a,a,-$t(e)),ts(n,n,a),mi(n,n)}const jv={None:0,Model:1,Symbol:2,FillExtrusion:4};class cm{constructor(e,i,n,a){this.message=(e?`${e}: `:"")+n,a&&(this.identifier=a),i!=null&&i.__line__&&(this.line=i.__line__)}}function hg(r,e){const i=r.indexOf("://")===-1;try{return new URL(r,i&&e?"http://example.com":void 0),!0}catch{return!1}}class Gv{constructor(e,i){this.feature=e,this.instancedDataOffset=i,this.instancedDataCount=0,this.rotation=[0,0,0],this.scale=[1,1,1],this.translation=[0,0,0]}}class qv{constructor(){this.maxScale=1,this.maxXYTranslationDistance=0,this.instancedDataArray=new ed,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}colorForInstance(e){const i=16*e,n=this.instancedDataArray.float32;let a=Math.floor(n[i+2]);const u=1.05*(n[i+2]-a);return a/=100,[n[i]%1*1.05,n[i+1]%1*1.05,u,a]}tileCoordinatesForInstance(e){const i=16*e,n=this.instancedDataArray.float32;let a=n[i+0];return a=a>We?a-We:a,new Be(Math.trunc(a),Math.trunc(n[i+1]))}translationForInstance(e){const i=16*e,n=this.instancedDataArray.float32;return[n[i+4],n[i+5],n[i+6]]}rotationScaleForInstance(e){const i=16*e,n=this.instancedDataArray.float32;return[n[i+7],n[i+8],n[i+9],n[i+10],n[i+11],n[i+12],n[i+13],n[i+14],n[i+15]]}transformForInstance(e){const i=16*e,n=this.instancedDataArray.float32;return[n[i+7],n[i+8],n[i+9],n[i+4],n[i+10],n[i+11],n[i+12],n[i+5],n[i+13],n[i+14],n[i+15],n[i+6],0,0,0,1]}}class dg{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaledZ=this.canonical.z+Math.log2(e.overscaling),this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.projection=e.projection,this.index=e.index,this.worldview=e.worldview,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom>this.canonical.z+1?0:this.zoom>this.canonical.z?256:this.zoom>15?75:100,this.instanceCount=0,this.terrainElevationMin=0,this.terrainElevationMax=0,this.validForDEMTile={id:null,timestamp:0},this.modelUris=[],this.modelsRequested=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.styleDefinedModelURLs=e.styleDefinedModelURLs,this.hasAppearances=null}updateFootprints(e,i){}updateAppearances(e,i,n,a){}populate(e,i,n,a){this.tileToMeter=Ue(n);const u=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);const h=this.layers[0].paint.get("model-elevation-reference")==="hd-road-markup"?i.elevationFeatures:void 0;for(const{feature:f,id:_,index:g,sourceLayerIndex:v}of e){const b=_??(f.properties&&f.properties.hasOwnProperty("id")?f.properties.id:void 0),w=Pt(f,u);if(!this.layers[0]._featureFilter.filter(new ui(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),w,n))continue;const E={id:b,sourceLayerIndex:v,index:g,geometry:u?w.geometry:yt(f,n,a),properties:f.properties,type:f.type,patterns:{}},I=this.addFeature(E,E.geometry,w,h,n);I&&i.featureIndex.insert(f,E.geometry,g,v,this.index,this.instancesPerModel[I].instancedDataArray.length,256)}this.lookup=null}evaluateQueryRenderedFeaturePadding(){const e=this.layers[0].modelManager,i=this.layers[0].scope;let n=0;for(const a of this.modelUris){const u=e.getModel(a,i);if(!u)continue;const h=this.instancesPerModel[a];if(h){const f=.5*cc(u.aabb.max,u.aabb.min)*h.maxScale+h.maxXYTranslationDistance,_=Math.min(We,Math.max(f/this.tileToMeter,256));n=Math.max(_,n)}}return n}update(e,i,n,a){for(const u in this.instancesPerModel){const h=this.instancesPerModel[u];for(const f in e)h.idToFeaturesIndex.hasOwnProperty(f)&&(this.evaluate(h.features[h.idToFeaturesIndex[f]],e[f],h,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let e=!1;for(const i in this.instancesPerModel){const n=this.instancesPerModel[i];for(const a of n.features){const u=this.layers[0],h=a.feature,f=this.canonical,_=u.paint.get("model-rotation").evaluate(h,{},f),g=u.paint.get("model-scale").evaluate(h,{},f),v=u.paint.get("model-translation").evaluate(h,{},f);io(a.rotation,_)&&io(a.scale,g)&&io(a.translation,v)||(this.evaluate(a,a.featureStates,n,!0),e=!0)}}return e}updateReplacement(e,i,n,a){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;const u=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);if(Dp(this.activeReplacements,u))return!1;this.activeReplacements=u;let h=!1;for(const f in this.instancesPerModel){const _=this.instancesPerModel[f],g=_.instancedDataArray;for(const v of _.features){const b=v.instancedDataOffset,w=v.instancedDataCount;for(let E=0;E<w;E++){const I=16*(E+b);let P=g.float32[I+0];const D=P>We;P=D?P-We:P;const R=Math.floor(P),F=Math.floor(g.float32[I+1]);let B=!1;for(const V of this.activeReplacements)if(!Ty(V,n,jv.Model,a)&&!(V.min.x>R||R>V.max.x||V.min.y>F||F>V.max.y)&&(B=My(Ay(R,F,e.canonical,V.footprintTileId.canonical),V.footprint),B))break;g.float32[I]=B?P+We:P,h=h||B!==D}}}return h}isEmpty(){for(const e in this.instancesPerModel)if(this.instancesPerModel[e].instancedDataArray.length!==0)return!1;return!0}uploadPending(){return!this.uploaded}upload(e){if(!this.uploaded)for(const i in this.instancesPerModel){const n=this.instancesPerModel[i];n.instancedDataArray.length<0||n.instancedDataArray.length===0||(n.instancedDataBuffer?n.instancedDataBuffer.updateData(n.instancedDataArray):n.instancedDataBuffer=e.createVertexBuffer(n.instancedDataArray,yb.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(e){for(const n in this.instancesPerModel){const a=this.instancesPerModel[n];a.instancedDataArray.length!==0&&a.instancedDataBuffer&&a.instancedDataBuffer.destroy()}const i=this.layers[0].modelManager;if(e&&i&&this.modelUris&&this.modelsRequested)for(const n of this.modelUris)i.removeModel(n,"",!0)}addFeature(e,i,n,a,u){const h=this.layers[0],f=h.layout.get("model-id"),_=h.layout.get("model-allow-density-reduction"),g=f.evaluate(n,{},this.canonical);if(!g)return xt(`modelId is not evaluated for layer ${h.id} and it is not going to get rendered.`),g;(hg(g,!1)||this.styleDefinedModelURLs[g]!==void 0)&&(this.modelUris.includes(g)||this.modelUris.push(g)),this.instancesPerModel[g]||(this.instancesPerModel[g]=new qv);const v=this.instancesPerModel[g],b=v.instancedDataArray,w=new Gv(n,b.length);let E;a&&(E=tn.getElevationFeature(e,a));for(const I of i)for(const P of I){if(P.x<0||P.x>=We||P.y<0||P.y>=We)continue;if(this.lookupDim!==0&&_){const R=(this.lookupDim-1)/We,F=this.lookupDim*(P.y*R|0)+P.x*R|0;if(this.lookup){if(this.lookup[F]!==0)continue;this.lookup[F]=1}}this.instanceCount++;const D=b.length;if(b.resize(D+1),a){v.instancesRoadElevation||(v.instancesRoadElevation=[]);const R=E?E.pointElevation(new Be(P.x,P.y)):0;v.instancesRoadElevation.push(R)}v.instancesEvaluatedElevation.push(0),b.float32[16*D]=P.x,b.float32[16*D+1]=P.y}return w.instancedDataCount=v.instancedDataArray.length-w.instancedDataOffset,w.instancedDataCount>0&&(e.id&&(v.idToFeaturesIndex[e.id]=v.features.length),v.features.push(w),this.evaluate(w,{},v,!1)),g}getModelUris(){return this.modelUris}evaluate(e,i,n,a){const u=this.layers[0],h=e.feature,f=this.canonical,_=e.rotation=u.paint.get("model-rotation").evaluate(h,i,f),g=e.scale=u.paint.get("model-scale").evaluate(h,i,f),v=e.translation=u.paint.get("model-translation").evaluate(h,i,f),b=Object.assign({},u.paint.get("model-color").evaluate(h,i,f));b.a=u.paint.get("model-color-mix-intensity").evaluate(h,i,f);const w=[];this.maxVerticalOffset<v[2]&&(this.maxVerticalOffset=v[2]);const E=v[0]*v[0]+v[1]*v[1],I=E>0?Math.sqrt(E):0;n.maxScale=Math.max(Math.max(n.maxScale,g[0]),Math.max(g[1],g[2])),n.maxXYTranslationDistance=Math.max(n.maxXYTranslationDistance,I),this.maxScale=Math.max(Math.max(this.maxScale,g[0]),Math.max(g[1],g[2])),yx(w,_,g);const P=Math.round(100*b.a)+b.b/1.05;for(let D=0;D<e.instancedDataCount;++D){const R=e.instancedDataOffset+D,F=16*R,B=n.instancedDataArray.float32;let V=0;a&&(V=B[F+6]-n.instancesEvaluatedElevation[R]);const $=0|B[F+1];B[F]=(0|B[F])+b.r/1.05,B[F+1]=$+b.g/1.05,B[F+2]=P,B[F+3]=1/(f.z>10?this.tileToMeter:Ue(f,$)),B[F+4]=v[0],B[F+5]=v[1],B[F+6]=v[2]+(n.instancesRoadElevation?n.instancesRoadElevation[R]:0)+V,B[F+7]=w[0],B[F+8]=w[1],B[F+9]=w[2],B[F+10]=w[4],B[F+11]=w[5],B[F+12]=w[6],B[F+13]=w[8],B[F+14]=w[9],B[F+15]=w[10],n.instancesEvaluatedElevation[R]=v[2]}}}let Hv,$v;nt(dg,"ModelBucket",{omit:["layers"]}),nt(qv,"PerModelAttributes"),nt(Gv,"ModelFeature");class Eu{constructor(e,i,n){this._demTile=e,this._dem=this._demTile.dem,this._scale=i,this._offset=n}static create(e,i,n){const a=n||e.findDEMTileFor(i);if(!a||!a.dem)return;const u=a.dem,h=a.tileID,f=1<<i.canonical.z-h.canonical.z;return new Eu(a,u.dim/We/f,[(i.canonical.x/f-h.canonical.x)*u.dim,(i.canonical.y/f-h.canonical.y)*u.dim])}tileCoordToPixel(e,i){const n=i*this._scale+this._offset[1];return new Be(Math.floor(e*this._scale+this._offset[0]),Math.floor(n))}getElevationAt(e,i,n,a){const u=e*this._scale+this._offset[0],h=i*this._scale+this._offset[1],f=Math.floor(u),_=Math.floor(h),g=this._dem;return a=!!a,n?_t(_t(g.get(f,_,a),g.get(f,_+1,a),h-_),_t(g.get(f+1,_,a),g.get(f+1,_+1,a),h-_),u-f):g.get(f,_,a)}getElevationAtPixel(e,i,n){return this._dem.get(e,i,!!n)}getMeterToDEM(e){return(1<<this._demTile.tileID.canonical.z)*ge(1,e)*this._dem.stride}}const fg=new Float32Array(262144),nc=new Uint8Array(262144);function Zv(r){let e=0;if(r.meshes)for(const i of r.meshes)e=Math.max(e,i.aabb.max[2]);if(r.children)for(const i of r.children)e=Math.max(e,Zv(i));return e}function Wv(r,e,i){if(r.meshes)for(const n of r.meshes){if(n.aabb.min[0]===1/0)continue;const a=ei.applyTransform(n.aabb,r.globalMatrix);i.insert(e,a.min[0],a.min[1],a.max[0],a.max[1])}if(r.children)for(const n of r.children)Wv(n,e,i)}const Xv=["","wall","door","roof","window","lamp","logo"];class Yv{constructor(e){this.node=e,this.evaluatedRMEA=[[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[.4,1,0,1],[1,0,0,1],[1,0,0,1]],this.hiddenByReplacement=!1,this.evaluatedTranslation=[0,0,0],this.evaluatedScale=[1,1,1],this.evaluatedColor=[],this.emissionHeightBasedParams=[],this.cameraCollisionOpacity=1,this.feature={type:"Point",id:e.id,geometry:[],properties:{height:Zv(e)}},this.aabb=this._getLocalBounds(),this.state=null}_getLocalBounds(){if(!this.node.meshes)return new ei([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let e=0;const i=new ei([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const n of this.node.meshes)this.node.lightMeshIndex!==e&&(n.transformedAabb=ei.applyTransformFast(n.aabb,this.node.globalMatrix),i.encapsulate(n.transformedAabb)),e++;this.aabb=i}return this.aabb}}class um{constructor(e,i,n,a,u,h,f,_){this.id=n,this.layers=e,this.layerIds=this.layers.map(g=>g.fqid),this.stateDependentLayerIds=this.layers.filter(g=>g.isStateDependent()).map(g=>g.id),this.modelTraits|=gu.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,a&&(this.modelTraits|=gu.HasMapbox
8MeshFeatures),u&&(this.modelTraits|=gu.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=h,this.worldview=_,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[];for(const g of i)this.nodesInfo.push(new Yv(g)),Wv(g,f.featureIndexArray.length,f.grid),f.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,f.bucketLayerIDs.length-1,0);this.states={},this.hasAppearances=null}updateFootprints(e,i){for(const n of this.getNodesInfo()){const a=n.node;a.footprint&&i.push({footprint:a.footprint,id:e})}}updateAppearances(e,i,n,a){}update(e){const i=Object.keys(e).length!==0;if(i&&!this.stateDependentLayers.length)return;const n=i?this.stateDependentLayers:this.layers;if(!Oo(e,this.states))for(const a of n)this.evaluate(a,e);this.states=structuredClone(e)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(e){if(!this.needsUpload)return;const i=this.getNodesInfo();for(const n of i){const a=n.node;this.uploaded?this.updatePbrBuffer(a):F_(a,e,!0)}for(const n of i)Hp(n.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(e){let i=!1;if(!e.meshes)return i;for(const n of e.meshes)n.pbrBuffer&&(n.pbrBuffer.updateData(n.featureArray),i=!0);return i}needsReEvaluation(e,i,n){const a=e.transform.projectionOptions,u=e.style.getBrightness(),h=this.brightness!==u;if(!this.uploaded||this.dirty||a.name!==this.projection.name||Bd(n.paint.get("model-color").value,h)||Bd(n.paint.get("model-color-mix-intensity").value,h)||Bd(n.paint.get("model-roughness").value,h)||Bd(n.paint.get("model-emissive-strength").value,h)||Bd(n.paint.get("model-height-based-emissive-strength-multiplier").value,h)){this.projection=a,this.brightness=u;const f=this.getNodesInfo();for(const _ of f)_.state=null;return!0}return!1}evaluateTransform(e,i){if(e.transform.zoom===this.zoom)return;this.zoom=e.transform.zoom;const n=this.getNodesInfo(),a=this.id.canonical;for(const u of n){const h=u.feature;u.evaluatedTranslation=i.paint.get("model-translation").evaluate(h,{},a),u.evaluatedScale=i.paint.get("model-scale").evaluate(h,{},a)}}evaluate(e,i){const n=this.getNodesInfo();for(const a of n){if(!a.node.meshes)continue;const u=a.feature,h=i&&i[u.id];if(Oo(h,a.state))continue;a.state=structuredClone(h);const f=a.node.meshes&&a.node.meshes[0].featureData,_=a.evaluatedColor[2],g=a.evaluatedRMEA[2],v=this.id.canonical;if(a.hasTranslucentParts=!1,f){for(let b=0;b<Xv.length;b++){const w=Xv[b];w.length&&(u.properties.part=w);const E=e.paint.get("model-color").evaluate(u,h,v).toPremultipliedRenderColor(null),I=e.paint.get("model-color-mix-intensity").evaluate(u,h,v);a.evaluatedColor[b]=[E.r,E.g,E.b,I],a.evaluatedRMEA[b][0]=e.paint.get("model-roughness").evaluate(u,h,v),a.evaluatedRMEA[b][2]=e.paint.get("model-emissive-strength").evaluate(u,h,v),a.evaluatedRMEA[b][3]=E.a,a.emissionHeightBasedParams[b]=e.paint.get("model-height-based-emissive-strength-multiplier").evaluate(u,h,v),!a.hasTranslucentParts&&E.a<1&&(a.hasTranslucentParts=!0)}delete u.properties.part,Jw(a,_!==a.evaluatedColor[2]||g!==a.evaluatedRMEA[2],this.modelTraits)}else a.evaluatedRMEA[0][2]=e.paint.get("model-emissive-strength").evaluate(u,h,v);a.evaluatedTranslation=e.paint.get("model-translation").evaluate(u,h,v),a.evaluatedScale=e.paint.get("model-scale").evaluate(u,h,v),this.updatePbrBuffer(a.node)||(this.needsUpload=!0)}this.dirty=!1}elevationUpdate(e,i,n,a){const u=e.findDEMTileFor(n);if(u&&(u.tileID.canonical!==this.terrainTile||i!==this.terrainExaggeration)){if(u.dem&&u.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=u.tileID.overscaledZ;const h=Eu.create(e,n,u);if(!h)return;
8this.modelTraits&gu.HasMapboxMeshFeatures&&this.updateDEM(e,h,n,a);for(const f of this.getNodesInfo()){const _=f.node;if(!_.footprint||!_.footprint.vertices||!_.footprint.vertices.length)continue;const g=_.footprint.vertices;let v=h.getElevationAt(g[0].x,g[0].y,!0,!0);for(let b=1;b<g.length;b++)v=Math.min(v,h.getElevationAt(g[b].x,g[b].y,!0,!0));_.elevation=v}}this.terrainTile=u.tileID.canonical,this.terrainExaggeration=i}}updateDEM(e,i,n,a){let u=i._dem._modifiedForSources[a];if(u===void 0&&(i._dem._modifiedForSources[a]=[],u=i._dem._modifiedForSources[a]),u.includes(n.canonical))return;const h=i._dem.dim;u.push(n.canonical);let f=!1;for(const _ of this.getNodesInfo()){const g=_.node;if(!g.footprint||!g.footprint.grid)continue;const v=g.footprint.grid,b=i.tileCoordToPixel(v.min.x,v.min.y),w=i.tileCoordToPixel(v.max.x,v.max.y),E=Math.min(Math.min(h-w.y,b.x),Math.min(b.y,h-w.x));if(E<0)continue;const I=Y(E,2,5);let P=Math.max(0,b.x-I),D=Math.max(0,b.y-I),R=Math.min(w.x+I,h-1),F=Math.min(w.y+I,h-1);for(let H=D;H<=F;++H)for(let J=P;J<=R;++J)nc[H*h+J]=255;let B=0,V=0;for(let H=0;H<v.cellsY;++H)for(let J=0;J<v.cellsX;++J){if(!v.cells[H*v.cellsX+J])continue;const ee=i.tileCoordToPixel(v.min.x+J/v.xScale,v.min.y+H/v.yScale),K=i.tileCoordToPixel(v.min.x+(J+1)/v.xScale,v.min.y+(H+1)/v.yScale);for(let re=ee.y;re<=Math.min(K.y+1,h-1);++re)for(let se=ee.x;se<=Math.min(K.x+1,h-1);++se)nc[re*h+se]===255&&(nc[re*h+se]=0,B+=i.getElevationAtPixel(se,re),V++)}const $=B/V;P=Math.max(1,b.x-I),D=Math.max(1,b.y-I),R=Math.min(w.x+I,h-2),F=Math.min(w.y+I,h-2),f=!0;for(let H=D;H<=F;++H)for(let J=P;J<=R;++J)nc[H*h+J]===0&&(fg[H*h+J]=i._dem.set(J,H,$));for(let H=1;H<I;++H){P=Math.max(1,b.x-H),D=Math.max(1,b.y-H),R=Math.min(w.x+H,h-2),F=Math.min(w.y+H,h-2);for(let J=D;J<=F;++J)for(let ee=P;ee<=R;++ee){const K=J*h+ee;if(nc[K]===255){let re=0,se=0,Ee=-1,we=-1;for(let Se=-1;Se<=1;++Se)for(let Re=-1;Re<=1;++Re){const Ce=(J+Se)*h+ee+Re;if(nc[Ce]>=H)continue;const Pe=fg[Ce],ye=Math.abs(Pe);ye>se&&(re=Pe,se=ye,Ee=Re,we=Se)}if(se>.1){const Se=1-(H+.5*Math.abs(Ee*we))/I;let Re=i._dem.get(ee,J)+re*Se;const Ce=i._dem.get(ee+Ee,J+we),Pe=i._dem.get(ee-Ee,J-we,!0);(Re-Ce)*(Re-Pe)>0&&(Re=(Ce+Pe)/2),fg[K]=i._dem.set(ee,J,Re),nc[K]=H}}}}}f&&(i._demTile.needsDEMTextureUpload=!0,i._dem._timestamp=Rn.now())}setFilter(e){this.filter=e?Vh(e):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(e=>this.filter.filter(new ui(this.id.overscaledZ,{worldview:this.worldview}),e.feature,this.id.canonical)):this.nodesInfo}destroy(){const e=this.getNodesInfo();for(const i of e)Hp(i.node),O_(i.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const n=i.getReplacementRegionsForTile(e.toUnwrapped());for(const a of this.getNodesInfo()){const u=a.node.footprint;a.hiddenByReplacement=!!u&&!n.find(h=>h.footprint===u)}}getHeightAtTileCoord(e,i){const n=[],a=[0,0,0],u=Ei([]);for(const h of this.getNodesInfo()){const f=h.node.meshes[0],_=f.transformedAabb;if(e<_.min[0]||i<_.min[1]||e>_.max[0]||i>_.max[1])continue;if(h.node.hidden===!0)return{height:1/0,maxHeight:h.feature.properties.height,hidden:!1,verticalScale:h.evaluatedScale[2]};$r(u,h.node.globalMatrix),a[0]=e,a[1]=i,Qi(a,a,u);const g=(a[0]-f.aabb.min[0])/(f.aabb.max[0]-f.aabb.min[0])*ec|0,v=Math.min(63,(a[1]-f.aabb.min[1])/(f.aabb.max[1]-f.aabb.min[1])*ec|0)*ec+Math.min(63,g),b=f.heightmap[v];if(!(b<0&&h.node.footprint))return h.hiddenByReplacement?void 0:{height:b,maxHeight:h.feature.properties.height,hidden:!1,verticalScale:h.evaluatedScale[2]};if(h.node.footprint.grid.query(new Be(e,i),new Be(e,i),n),n.length>0)return{height:void 0,maxHeight:h.feature.properties.height,hidden:h.hiddenByReplacement,verticalScale:h.evaluatedScale[2]}}}}function Bd(r,e){return r instanceof zl&&!r.isLightConstant&&e}function Kw(r,e,i,n,a,u,h,f){let _=(61440&e|(61440&e)>>4)>>8,g=(3840&e|(3840&e)>>4)>>4,v=240&e|(240&e)>>4;i[3]>0&&(_=_t(_,255*i[0],i[3]),g=_t(g,255*i[1],i[3]),v=_t(v,255*i[2],i[3]));const b=_<<8|g,w=v<<8|Math.floor(255*n[3]),E=(function(H){const J=Y(H,0,2);return Math.min(Math.round(.5*J*255),255)})(n[2])<<8|15*n[0]<<4|15*n[1],I=Y(a[0],0,1),P=Y(a[1],0,1),D=Y(a[2],0,1),R=Y(a[3],0,1);let F,B,V,$;if(I!==P&&h!==u&&P!==I){const H=h-u;
8B=1/(H*(P-I)),V=-(u+H*I)/(H*(P-I));const J=Y(a[4],-1,1);$=Math.pow(10,J),F=255*D<<8|255*R}else F=65535,B=0,V=1,$=1;if(r.emplaceBack(b,w,E,F,B,V,$),f){const H=f.length;f.clear();for(let J=0;J<H;J++)f.emplaceBack(b,w,E,F,B,V,$)}}function Jw(r,e,i){const n=r.node;let a=0;const u=i&gu.HasMeshoptCompression;for(const h of n.meshes){if(n.lights&&n.lightMeshIndex===a||!h.featureData)continue;h.featureArray=new Gl,h.featureArray.reserve(h.featureData.length);let f=e;for(const _ of h.featureData){const g=u?65535&_:_>>16&65535,v=u?_>>16&65535:65535&_,b=(15&v)<8?15&v:0,w=r.evaluatedRMEA[b],E=r.evaluatedColor[b],I=r.emissionHeightBasedParams[b];let P;if(f&&b===2&&n.lights&&(P=new Gl,P.resize(10*n.lights.length)),Kw(h.featureArray,g,E,w,I,h.aabb.min[2],h.aabb.max[2],P),P&&f){f=!1;const D=n.meshes[n.lightMeshIndex];D.featureArray=P,D.featureArray._trim()}}h.featureArray._trim(),a++}}nt(um,"Tiled3dModelBucket",{omit:["layers"]}),nt(Yv,"Tiled3dModelFeature");const Qw=["id","tile","layer","source","sourceLayer","state"];class oc{constructor(e,i,n,a,u){this.type="Feature",this._vectorTileFeature=e,this._z=i,this._x=n,this._y=a,this.properties=e?e.properties:{},this.id=u}clone(){const e=new oc(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(e.state=Object.assign({},this.state)),this.layer&&(e.layer=Object.assign({},this.layer)),this.source&&(e.source=this.source),this.sourceLayer&&(e.sourceLayer=this.sourceLayer),e}get geometry(){return this._geometry===void 0&&this._vectorTileFeature&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(const i of Qw)this[i]!==void 0&&(e[i]=this[i]);return e}}class sc extends Uo{constructor(e,i,n,a){super(),this.id=e,this.type="model",this.models=[],this._options=i,this._modelsInfo=new Map}loadGLTFFromURI(e){return px(this.map._requestManager.transformRequest(e,ln.Model).url)}load(){for(const e in this._options.models){const i=this._options.models[e],n=this._modelsInfo.get(e);if(n){n.modelSpec=i;const a=n.model;a&&(a.position=i.position!=null?new Z(i.position[0],i.position[1]):new Z(0,0),a.orientation=i.orientation!=null?i.orientation:[0,0,0],sc.applyModelSpecification(a,i),a.computeBoundsAndApplyParent(),this.models.push(a))}else this._modelsInfo.set(e,{modelSpec:i,model:null}),this.loadGLTFFromURI(i.uri).then(a=>{if(!a)return;const u=this._modelsInfo.get(e);if(!u)return;const h=B_(a),f=u.modelSpec,_=new xx(e,f.uri,f.position,f.orientation,h);sc.applyModelSpecification(_,f),_.computeBoundsAndApplyParent(),this.models.push(_),u.model=_,this.loaded()&&this.fire(new Vo("data",{dataType:"source",sourceDataType:"metadata"}))}).catch(a=>{this.fire(new ml(new Error(`Could not load model ${e} from ${i.uri}: ${a.message}`)))})}this.loaded()&&this.fire(new Vo("data",{dataType:"source",sourceDataType:"metadata"}))}static applyModelSpecification(e,i){i.nodeOverrides&&sc.convertNodeOverrides(e,i.nodeOverrides),i.materialOverrides&&sc.convertMaterialOverrides(e,i.materialOverrides),i.nodeOverrideNames&&(e.nodeOverrideNames=[...i.nodeOverrideNames]),i.materialOverrideNames&&(e.materialOverrideNames=[...i.materialOverrideNames]),i.featureProperties&&(e.featureProperties=i.featureProperties)}static convertNodeOverrides(e,i){if(Array.isArray(i)&&i.every(n=>typeof n=="string")){e.nodeOverrideNames=[];for(const n of i)e.nodeOverrideNames.push(n)}else Object.entries(i).forEach(([n,a])=>{const u={orientation:[0,0,0]};if(a.hasOwnProperty("orientation")){const h=a.orientation;h&&(u.orientation=h)}e.nodeOverrides.set(n,u)})}static convertMaterialOverrides(e,i){if(Array.isArray(i)&&i.every(n=>typeof n=="string")){e.materialOverrideNames=[];for(const n of i)e.materialOverrideNames.push(n)}else Object.entries(i).forEach(([n,a])=>{const u={color:new ii(1,1,1),colorMix:0,emissionStrength:0,opacity:1},h=a["model-color"];h!==void 0&&(u.color.r=h[0],u.color.g=h[1],u.color.b=h[2]);const f=a["model-color-mix-intensity"];f!==void 0&&(u.colorMix=f);const _=a["model-emissive-strength"];_!==void 0&&(u.emissionStrength=_);const g=a["model-opacity"];g!==void 0&&(u.opacity=g),e.materialOverrides.set(n,u)})}onAdd(e){this.map=e,this.load()}hasTransition(){return!1}loaded(){if(this._modelsInfo.size===0)return!0;for(const e of this._modelsInfo.values())if(e.model==null)return!1;return!0}getModels(){return this.models}loadTile(e,i){}serialize(){return this._options}setProperty(e,i){return!1}reload(){const e=Js(this.id,this.scope);this.map.style.clearSource(e),this.models=[],this._modelsInfo.clear(),this.load()}setModels(e){this.models=[];const i=new Map;for(const n in e){const a=e[n];if(this._modelsInfo.has(n)){const u=this._modelsInfo.get(n);u&&u.modelSpec.uri===a.uri&&i.set(n,u)}}this._modelsInfo=i,this._options.models=e,this.load()}}function pg(r,e,i,n){const a=1<<r.z;e.lat=Fe((n/We+r.y)/a),e.lng=Me((i/We+r.x)/a)}function eT(r,e,i,n){const a=r.getNodesInfo()[e];
vendor: 21,784 bytes, line 8
8if(!a||a.hiddenByReplacement||!a.node.meshes)return;let u=Number.MAX_VALUE;const h=a.node,f=i.tile,_=n.calculatePosMatrix(f.tileID.toUnwrapped(),n.worldSize),g=a.evaluatedScale;let v=0;n.elevation&&h.elevation&&(v=h.elevation*n.elevation.exaggeration()),_r(_,_,[(h.anchor?h.anchor[0]:0)*(g[0]-1),(h.anchor?h.anchor[1]:0)*(g[1]-1),v]),Ji(_,_,g);const b=i.queryGeometry,w=b.isPointQuery()?b.screenBounds:b.screenGeometry,E=function(P){const D=Ii([],_,P.globalMatrix);Ii(D,n.expandedFarZProjMatrix,D);for(let R=0;R<P.meshes.length;++R){const F=P.meshes[R];if(R===P.lightMeshIndex)continue;const B=L_(w,n,D,F.aabb);B!=null&&(u=Math.min(B,u))}if(P.children)for(const R of P.children)E(R)};if(E(h),u===Number.MAX_VALUE)return;const I=new Z(0,0);return pg(f.tileID.canonical,I,a.node.anchor[0],a.node.anchor[1]),{intersectionZ:u,position:I,feature:a.feature}}const tT={circle:class extends Qr{constructor(r,e,i,n){super(r,{layout:zg||(zg=new Bi({"circle-sort-key":new Je(fe.layout_circle["circle-sort-key"]),"circle-elevation-reference":new Ge(fe.layout_circle["circle-elevation-reference"]),visibility:new Ge(fe.layout_circle.visibility)})),paint:Dg||(Dg=new Bi({"circle-radius":new Je(fe.paint_circle["circle-radius"]),"circle-color":new Je(fe.paint_circle["circle-color"]),"circle-blur":new Je(fe.paint_circle["circle-blur"]),"circle-opacity":new Je(fe.paint_circle["circle-opacity"]),"circle-translate":new Ge(fe.paint_circle["circle-translate"]),"circle-translate-anchor":new Ge(fe.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ge(fe.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ge(fe.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Je(fe.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Je(fe.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Je(fe.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new Ge(fe.paint_circle["circle-emissive-strength"]),"circle-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"circle-stroke-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},e,i,n)}createBucket(r){return new rn(r)}queryRadius(r){const e=r;return ta("circle-radius",this,e)+ta("circle-stroke-width",this,e)+au(this.paint.get("circle-translate"))}queryIntersectsFeature(r,e,i,n,a,u,h,f){const _=Rg(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),u.angle,r.pixelToTileUnitsFactor),g=this.paint.get("circle-radius").evaluate(e,i)+this.paint.get("circle-stroke-width").evaluate(e,i);return $g(r,n,u,h,f,this.paint.get("circle-pitch-alignment")==="map",this.paint.get("circle-pitch-scale")==="map",_,g)}getProgramIds(){return["circle"]}getDefaultProgramParams(r,e,i){const n=Hg(this);return{config:new T(this,{zoom:e,lut:i}),defines:n,overrideFog:!1}}is3D(r){return!r&&!!this.layout&&this.layout.get("circle-elevation-reference")!=="none"}hasElevation(){return this.layout&&this.layout.get("circle-elevation-reference")!=="none"}},heatmap:class extends Qr{createBucket(r){return new Wg(r)}constructor(r,e,i,n){super(r,{layout:Xg||(Xg=new Bi({visibility:new Ge(fe.layout_heatmap.visibility)})),paint:Yg||(Yg=new Bi({"heatmap-radius":new Je(fe.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Je(fe.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ge(fe.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Oa(fe.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ge(fe.paint_heatmap["heatmap-opacity"]),"heatmap-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},e,i,n),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(r){r==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=od({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)}_clear(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}queryRadius(r){return ta("heatmap-radius",this,r)}queryIntersectsFeature(r,e,i,n,a,u,h,f){const _=this.paint.get("heatmap-radius").evaluate(e,i);return $g(r,n,u,h,f,!0,!0,new Be(0,0),_)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}getProgramIds(){return["heatmap","heatmapTexture"]}getDefaultProgramParams(r,e,i){return r==="heatmap"?{config:new T(this,{zoom:e,lut:i}),overrideFog:!1}:{}}},hillshade:class extends Qr{constructor(r,e,i,n){super(r,{layout:Kg||(Kg=new Bi({visibility:new Ge(fe.layout_hillshade.visibility)})),paint:Jg||(Jg=new Bi({"hillshade-illumination-direction":new Ge(fe.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Ge(fe.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ge(fe.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ge(fe.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ge(fe.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ge(fe.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new Ge(fe.paint_hillshade["hillshade-emissive-strength"]),"hillshade-shadow-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"hillshade-highlight-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"hillshade-accent-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},e,i,n)}shouldRedrape(){return this.hasOffscreenPass()&&this.paint.get("hillshade-illumination-anchor")==="viewport"}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}getProgramIds(){return["hillshade","hillshadePrepare"]}getDefaultProgramParams(r,e,i){return{overrideFog:!1}}},fill:class extends Qr{constructor(r,e,i,n){super(r,{layout:yy||(yy=new Bi({"fill-sort-key":new Je(fe.layout_fill["fill-sort-key"]),visibility:new Ge(fe.layout_fill.visibility),"fill-elevation-reference":new Ge(fe.layout_fill["fill-elevation-reference"]),"fill-construct-bridge-guard-rail":new Je(fe.layout_fill["fill-construct-bridge-guard-rail"])})),paint:xy||(xy=new Bi({"fill-antialias":new Ge(fe.paint_fill["fill-antialias"]),"fill-opacity":new Je(fe.paint_fill["fill-opacity"]),"fill-color":new Je(fe.paint_fill["fill-color"]),"fill-outline-color":new Je(fe.paint_fill["fill-outline-color"]),"fill-translate":new Ge(fe.paint_fill["fill-translate"]),"fill-translate-anchor":new Ge(fe.paint_fill["fill-translate-anchor"]),"fill-pattern":new Je(fe.paint_fill["fill-pattern"]),"fill-pattern-cross-fade":new Ge(fe.paint_fill["fill-pattern-cross-fade"]),"fill-emissive-strength":new Ge(fe.paint_fill["fill-emissive-strength"]),"fill-z-offset":new Je(fe.paint_fill["fill-z-offset"]),"fill-bridge-guard-rail-color":new Je(fe.paint_fill["fill-bridge-guard-rail-color"]),"fill-tunnel-structure-color":new Je(fe.paint_fill["fill-tunnel-structure-color"]),"fill-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"fill-outline-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"fill-bridge-guard-rail-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"fill-tunnel-structure-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},e,i,n)}getProgramIds(){const r=this.paint.get("fill-pattern"),e=r&&r.constantOr(1),i=[e?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&i.push(e&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),i}getDefaultProgramParams(r,e,i){return{config:new T(this,{zoom:e,lut:i}),overrideFog:!1}}recalculate(r,e){super.recalculate(r,e);const i=this.paint._values["fill-outline-color"];i.value.kind==="constant"&&i.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(r){return new g_(r)}queryRadius(){return au(this.paint.get("fill-translate"))}queryIntersectsFeature(r,e,i,n,a,u){return!r.queryGeometry.isAboveHorizon&&yi(Pg(r.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),u.angle,r.pixelToTileUnitsFactor),n)}isTileClipped(){return this.paint.get("fill-z-offset").constantOr(1)===0}is3D(r){if(this.paint.get("fill-z-offset").constantOr(1)!==0)return!0;const e=this.layout&&this.layout.get("fill-elevation-reference")!=="none";return r!=null?e&&!r:e}hasElevation(){return this.layout&&this.layout.get("fill-elevation-reference")!=="none"}hasShadowPass(){return this.layout&&this.layout.get("fill-elevation-reference")!=="none"}},"fill-extrusion":class extends Qr{constructor(r,e,i,n){super(r,{layout:jy||(jy=new Bi({visibility:new Ge(fe["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new Ge(fe["layout_fill-extrusion"]["fill-extrusion-edge-radius"])})),paint:Gy||(Gy=new Bi({"fill-extrusion-opacity":new Ge(fe["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Je(fe["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ge(fe["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ge(fe["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Je(fe["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-pattern-cross-fade":new Ge(fe["paint_fill-extrusion"]["fill-extrusion-pattern-cross-fade"]),"fill-extrusion-height":new Je(fe["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Je(fe["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-height-alignment":new Ge(fe["paint_fill-extrusion"]["fill-extrusion-height-alignment"]),"fill-extrusion-base-alignment":new Ge(fe["paint_fill-extrusion"]["fill-extrusion-base-alignment"]),"fill-extrusion-vertical-gradient":new Ge(fe["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new Ge(fe["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new Ge(fe["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new Ge(fe["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new Ge(fe["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new Ge(fe["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new Ge(fe["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new Ge(fe["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new Je(fe["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new Je(fe["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new Ge(fe["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new Ge(fe["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new Ge(fe["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new Ge(fe["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-emissive-strength":new Je(fe["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]),"fill-extrusion-line-width":new Je(fe["paint_fill-extrusion"]["fill-extrusion-line-width"]),"fill-extrusion-cast-shadows":new Ge(fe["paint_fill-extrusion"]["fill-extrusion-cast-shadows"]),"fill-extrusion-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"fill-extrusion-flood-light-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},e,i,n),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(r){return new Fp(r)}queryRadius(){return au(this.paint.get("fill-extrusion-translate"))}is3D(r){return!0}hasShadowPass(){return this.paint.get("fill-extrusion-cast-shadows")}cutoffRange(){return this.paint.get("fill-extrusion-cutoff-fade-range")}canCastShadows(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}queryIntersectsFeature(r,e,i,n,a,u,h,f,_){const g=Rg(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),u.angle,r.pixelToTileUnitsFactor),v=this.paint.get("fill-extrusion-height").evaluate(e,i),b=this.paint.get("fill-extrusion-base").evaluate(e,i),w=[0,0],E=f&&u.elevation,I=u.elevation?u.elevation.exaggeration():1,P=r.tile.getBucket(this);if(E&&P instanceof Fp){const V=P.centroidVertexArray,$=_+1;$<V.length&&(w[0]=V.geta_centroid_pos0($),w[1]=V.geta_centroid_pos1($))}if(w[0]===0&&w[1]===1)return!1;u.projection.name==="globe"&&(n=Uy([n],[new Be(0,0),new Be(We,We)],r.tileID.canonical).map(V=>V.polygon).flat());const D=E?f:null,[R,F]=Yy(u,n,b,v,g,h,D,w,I,u.center.lat,r.tileID.canonical),B=r.queryGeometry;return Xy(R,F,B.isPointQuery()?B.screenBounds:B.screenGeometry)}},building:class extends Qr{constructor(r,e,i,n){super(r,{layout:Ix||(Ix=new Bi({visibility:new Ge(fe.layout_building.visibility),"building-facade":new Je(fe.layout_building["building-facade"]),"building-facade-floors":new Je(fe.layout_building["building-facade-floors"]),"building-facade-unit-width":new Je(fe.layout_building["building-facade-unit-width"]),"building-facade-window":new Je(fe.layout_building["building-facade-window"]),"building-roof-shape":new Je(fe.layout_building["building-roof-shape"]),"building-height":new Je(fe.layout_building["building-height"]),"building-base":new Je(fe.layout_building["building-base"]),"building-flood-light-wall-radius":new Je(fe.layout_building["building-flood-light-wall-radius"]),"building-flood-light-ground-radius":new Je(fe.layout_building["building-flood-light-ground-radius"]),"building-flip-roof-orientation":new Je(fe.layout_building["building-flip-roof-orientation"])})),paint:Ax||(Ax=new Bi({"building-opacity":new Ge(fe.paint_building["building-opacity"]),"building-ambient-occlusion-intensity":new Ge(fe.paint_building["building-ambient-occlusion-intensity"]),"building-ambient-occlusion-ground-intensity":new Ge(fe.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new Ge(fe.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new Ge(fe.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new Ge(fe.paint_building["building-vertical-scale"]),"building-cast-shadows":new Ge(fe.paint_building["building-cast-shadows"]),"building-color":new Je(fe.paint_building["building-color"]),"building-emissive-strength":new Je(fe.paint_building["building-emissive-strength"]),"building-facade-emissive-chance":new Ge(fe.paint_building["building-facade-emissive-chance"]),"building-cutoff-fade-range":new Ge(fe.paint_building["building-cutoff-fade-range"]),"building-flood-light-color":new Ge(fe.paint_building["building-flood-light-color"]),"building-flood-light-intensity":new Ge(fe.paint_building["building-flood-light-intensity"]),"building-flood-light-ground-attenuation":new Ge(fe.paint_building["building-flood-light-ground-attenuation"]),"building-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"building-flood-light-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},e,i,n),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(r){return new Ex(r)}cutoffRange(){return this.paint.get("building-cutoff-fade-range")}hasShadowPass(){return this.paint.get("building-cast-shadows")}hasLightBeamPass(){return!0}canCastShadows(){return!0}is3D(r){return!0}queryRadius(r){return 0}queryIntersectsFeature(r,e,i,n,a,u,h,f,_,g){let v=this.layout.get("building-height").evaluate(e,i);const b=this.layout.get("building-base").evaluate(e,i),w=r.tile.getBucket(this).getFootprint(e);if(w){if(w.hiddenFlags!==0)return!1;v=w.height}const[E,I]=Yy(u,n,b,v,new Be(0,0),h,null,[0,0],1,u.center.lat,r.tileID.canonical),P=r.queryGeometry;return Xy(E,I,P.isPointQuery()?P.screenBounds:P.screenGeometry)}},line:class extends Qr{constructor(r,e,i,n){const a=kx();super(r,a,e,i,n),a.layout&&(this.layout=new Jr(a.layout)),this.gradientVersion=0,this.hasElevatedBuckets=!1,this.hasNonElevatedBuckets=!1}_handleSpecialPaintPropertyUpdate(r){if(r==="line-gradient"){const e=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=e._styleExpression&&e._styleExpression.expression instanceof El,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}widthExpression(){return this._transitionablePaint._values["line-width"].value.expression}emissiveStrengthExpression(){return this._transitionablePaint._values["line-emissive-strength"].value.expression}recalculate(r,e){super.recalculate(r,e),this.paint._values["line-floorwidth"]=(()=>{if(Sd)return Sd;const i=kx();return Sd=new Xb(i.paint.properties["line-width"].specification),Sd.useIntegerZoom=!0,Sd})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,r)}createBucket(r){return new U_(r)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(r,e,i){const n=Fx(this);return{config:new T(this,{zoom:e,lut:i}),defines:n,overrideFog:!1}}queryRadius(r){const e=r,i=Bx(ta("line-width",this,e),ta("line-gap-width",this,e)),n=ta("line-offset",this,e);return i/2+Math.abs(n)+au(this.paint.get("line-translate"))}queryIntersectsFeature(r,e,i,n,a,u){if(r.queryGeometry.isAboveHorizon)return!1;const h=Pg(r.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),u.angle,r.pixelToTileUnitsFactor),f=r.pixelToTileUnitsFactor/2*Bx(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),_=this.paint.get("line-offset").evaluate(e,i);return _&&(n=(function(g,v){const b=[],w=new Be(0,0);for(let E=0;E<g.length;E++){const I=g[E],P=[];for(let D=0;D<I.length;D++){const R=I[D],F=I[D+1],B=D===0?w:R.sub(I[D-1])._unit()._perp(),V=D===I.length-1?w:F.sub(R)._unit()._perp(),$=B._add(V)._unit();$._mult(1/($.x*V.x+$.y*V.y)),P.push($._mult(v)._add(R))}b.push(P)}return b})(n,_*r.pixelToTileUnitsFactor)),(function(g,v,b){for(let w=0;w<v.length;w++){const E=v[w];if(g.length>=3){for(let I=0;I<E.length;I++)if(Sn(g,E[I]))return!0}if(rr(g,E,b))return!0}return!1})(h,n,f)}isTileClipped(){return this.hasNonElevatedBuckets}isDraped(r){return!this.hasElevatedBuckets||this.layout&&this.layout.get("line-elevation-reference")==="hd-road-markup"}hasElevation(){return this.layout&&this.layout.get("line-elevation-reference")!=="none"}},symbol:sm,background:class extends Qr{constructor(r,e,i,n){super(r,{layout:Cv||(Cv=new Bi({visibility:new Ge(fe.layout_background.visibility)})),paint:Pv||(Pv=new Bi({"background-pitch-alignment":new Ge(fe.paint_background["background-pitch-alignment"]),"background-color":new Ge(fe.paint_background["background-color"]),"background-pattern":new Ge(fe.paint_background["background-pattern"]),"background-opacity":new Ge(fe.paint_background["background-opacity"]),"background-emissive-strength":new Ge(fe.paint_background["background-emissive-strength"]),"background-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},e,i,n)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(r,e,i){return{overrideFog:!1}}is3D(r){return this.paint.get("background-pitch-alignment")==="viewport"}},raster:Fv,"raster-particle":Uv,sky:class extends Qr{constructor(r,e,i,n){super(r,{layout:Bv||(Bv=new Bi({visibility:new Ge(fe.layout_sky.visibility)})),paint:Nv||(Nv=new Bi({"sky-type":new Ge(fe.paint_sky["sky-type"]),"sky-atmosphere-sun":new Ge(fe.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new Ge(fe.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new Ge(fe.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new Ge(fe.paint_sky["sky-gradient-radius"]),"sky-gradient":new Oa(fe.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new Ge(fe.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new Ge(fe.paint_sky["sky-atmosphere-color"]),"sky-opacity":new Ge(fe.paint_sky["sky-opacity"]),"sky-gradient-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-halo-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},e,i,n),this._updateColorRamp()}_clear(){this.skyboxFbo&&(this.skyboxFbo.destroy(),this.skyboxFbo=null),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null),this._skyboxInvalidated=!0}_handleSpecialPaintPropertyUpdate(r){r==="sky-gradient"?this._updateColorRamp():r!=="sky-atmosphere-sun"&&r!=="sky-atmosphere-halo-color"&&r!=="sky-atmosphere-color"&&r!=="sky-atmosphere-sun-intensity"||(this._skyboxInvali
8dated=!0)}_updateColorRamp(){this.colorRamp=od({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(r){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){const e=r.style.light.properties.get("position");return this._lightPosition.azimuthal!==e.azimuthal||this._lightPosition.polar!==e.polar}return!1}getCenter(r,e){if(this.paint.get("sky-type")==="atmosphere"){const n=this.paint.get("sky-atmosphere-sun"),a=!n,u=r.style.light,h=u.properties.get("position");return a&&u.properties.get("anchor")==="viewport"&&xt("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),a?ug(h.azimuthal,90-h.polar,e):ug(n[0],90-n[1],e)}const i=this.paint.get("sky-gradient-center");return ug(i[0],90-i[1],e)}isSky(){return!0}markSkyboxValid(r){this._skyboxInvalidated=!1,this._lightPosition=r.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){const r=this.paint.get("sky-type");return r==="atmosphere"?["skyboxCapture","skybox"]:r==="gradient"?["skyboxGradient"]:null}},slot:class extends Qr{constructor(r,e,i,n){super(r,{paint:Vv||(Vv=new Bi({}))},e,null)}},model:class extends Qr{constructor(r,e,i,n){super(r,{layout:Hv||(Hv=new Bi({visibility:new Ge(fe.layout_model.visibility),"model-id":new Je(fe.layout_model["model-id"]),"model-allow-density-reduction":new Ge(fe.layout_model["model-allow-density-reduction"])})),paint:$v||($v=new Bi({"model-opacity":new Je(fe.paint_model["model-opacity"]),"model-rotation":new Je(fe.paint_model["model-rotation"]),"model-scale":new Je(fe.paint_model["model-scale"]),"model-translation":new Je(fe.paint_model["model-translation"]),"model-color":new Je(fe.paint_model["model-color"]),"model-color-mix-intensity":new Je(fe.paint_model["model-color-mix-intensity"]),"model-type":new Ge(fe.paint_model["model-type"]),"model-cast-shadows":new Ge(fe.paint_model["model-cast-shadows"]),"model-receive-shadows":new Ge(fe.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new Ge(fe.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new Je(fe.paint_model["model-emissive-strength"]),"model-roughness":new Je(fe.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new Je(fe.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new Ge(fe.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new Ge(fe.paint_model["model-front-cutoff"]),"model-elevation-reference":new Ge(fe.paint_model["model-elevation-reference"]),"model-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},e,i,n),this.layer=r,this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(r){return new dg(r)}getProgramIds(){return["model"]}is3D(r){return!0}hasShadowPass(){return!0}canCastShadows(){return!0}hasLightBeamPass(){return!0}cutoffRange(){return this.paint.get("model-cutoff-fade-range")}queryRadius(r){return r instanceof um?8191:0}queryRenderedFeatures(r,e,i){const n=e.getSource();if(!(n&&n instanceof sc))return{};const a=n,u={};u[this.id]=[];const h=u[this.id];let f=0;for(const _ of a.models){const g=e.getFeatureState(this.sourceLayer,_.id),v={type:"Unknown",id:_.id,properties:_.featureProperties},b=this.paint.get("model-rotation").evaluate(v,g),w=this.paint.get("model-scale").evaluate(v,g),E=this.paint.get("model-translation").evaluate(v,g),I=this.paint.get("model-elevation-reference");let P=[];qp(P,_,i,_.position,b,w,E,I==="ground",I==="ground",!1),i.projection.name==="globe"&&(P=Gp(P,i));const D=Ii([],i.projMatrix,P),R=L_(r.isPointQuery()?r.screenBounds:r.screenGeometry,i,D,_.aabb);if(R!=null){const F=new oc(void 0,0,0,0,_.id);F.layer=this.layer,F.properties=structuredClone(_.featureProperties),F.properties.layer=this.id,F.properties.uri=_.uri,F.properties.orientation=_.orientation,F.sourceLayer=this.sourceLayer,F.geometry={type:"Point",coordinates:[_.position.lng,_.position.lat]},F.state=g,F.source=this.source,h.push({featureIndex:f,feature:F,intersectionZ:R})}++f}return u}queryIntersectsFeature(r,e,i,n,a,u,h,f,_,g){if(!this.modelManager)return!1;const v=this.modelManager,b=r.tile.getBucket(this);if(!(b&&b instanceof dg))return!1;for(const w in b.instancesPerModel){const E=b.instancesPerModel[w],I=e.id!==void 0?e.id:e.properties&&e.properties.hasOwnProperty("id")?e.properties.id:void 0;if(E.idToFeaturesIndex.hasOwnProperty(I)){const P=E.features[E.idToFeaturesIndex[I]],D=v.getModel(w,g||this.scope);if(!D)return!1;let R=[];const F=new Z(0,0),B=b.canonical;let V=Number.MAX_VALUE;for(let $=0;$<P.instancedDataCount;++$){const H=16*(P.instancedDataOffset+$),J=E.instancedDataArray.float32,ee=[J[H+4],J[H+5],J[H+6]];pg(B,F,Math.floor(J[H]),Math.floor(J[H+1])),qp(R,D,u,F,P.rotation,P.scale,ee,!1,!1,!1),u.projection.name==="globe"&&(R=Gp(R,u));const K=Ii([],u.projMatrix,R),re=r.queryGeometry,se=L_(re.isPointQuery()?re.screenBounds:re.screenGeometry,u,K,D.aabb);se!=null&&(V=Math.min(se,V))}return V!==Number.MAX_VALUE&&V}}return!1}_handleOverridablePaintPropertyUpdate(r,e,i){return!(!this.layout||e.isDataDriven()||i.isDataDriven()||r!=="model-color"&&r!=="model-color-mix-intensity"&&r!=="model-rotation"&&r!=="model-scale"&&r!=="model-translation"&&r!=="model-emissive-strength")}_isPropertyZoomDependent(r){const e=this._transitionablePaint._values[r];return e!=null&&e.value!=null&&e.value.expression!=null&&e.value.expression instanceof Xs}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}},clip:class extends Qr{constructor(r,e,i,n){super(r,{layout:vy||(vy=new Bi({"clip-layer-types":ne
8w Ge(fe.layout_clip["clip-layer-types"]),"clip-layer-scope":new Ge(fe.layout_clip["clip-layer-scope"]),visibility:new Ge(fe.layout_clip.visibility)})),paint:by||(by=new Bi({}))},e,i,n)}recalculate(r,e){super.recalculate(r,e)}createBucket(r){return new wy(r)}is3D(r){return!0}}},mg=new ii(0,0,0);function iT(r,e,i){r===1&&e.icons.push((function(n,a){return(function(u){if(u.usvg_tree.height||(u.usvg_tree.height=u.usvg_tree.width),!u.metadata)return u;const{metadata:h}=u;if(h.content_area){const{content_area:f}=h;f.left==null&&(f.left=0),f.top==null&&(f.top=f.left),f.width==null&&(f.width=u.usvg_tree.width),f.height==null&&(f.height=f.width)}if(h.text_placeholder){const{text_placeholder:f}=h;f.top==null&&(f.top=f.left),f.height==null&&(f.height=f.width)}return h.stretch_x&&h.stretch_x.length&&Kv(h,"x"),h.stretch_y&&h.stretch_y.length&&Kv(h,"y"),u})(n.readFields(rT,{name:void 0},a))})(i,i.readVarint()+i.pos))}function Kv(r,e){const i=[],n=r[`stretch_${e}`];let a=null;for(let u=0;u<n.length;u++)a===null?a=i.length===0?n[0]:i[i.length-1][1]+n[u]:(i.push([a,a+n[u]]),a=null);r[`stretch_${e}_areas`]=i}function rT(r,e,i){r===1?e.name=i.readString():r===2?e.metadata=(function(n,a){return n.readFields(nT,{stretch_x:null,stretch_y:null,stretch_x_areas:null,stretch_y_areas:null,variables:[]},a)})(i,i.readVarint()+i.pos):r===3&&(e.usvg_tree=(function(n,a){return n.readFields(aT,{width:20,children:[],linear_gradients:[],radial_gradients:[],clip_paths:[],masks:[]},a)})(i,i.readVarint()+i.pos),e.data="usvg_tree")}function nT(r,e,i){r===1?e.stretch_x=i.readPackedVarint():r===2?e.stretch_y=i.readPackedVarint():r===3?e.content_area=Jv(i,i.readVarint()+i.pos):r===4?e.variables.push((function(n,a){return n.readFields(sT,{name:void 0},a)})(i,i.readVarint()+i.pos)):r===5&&(e.text_placeholder=Jv(i,i.readVarint()+i.pos))}function Jv(r,e){return r.readFields(oT,{},e)}function oT(r,e,i){r===1?e.left=i.readVarint():r===2?e.width=i.readVarint():r===3?e.top=i.readVarint():r===4&&(e.height=i.readVarint())}function sT(r,e,i){r===1?e.name=i.readString():r===2&&(e.rgb_color=fm(i.readVarint()),e.value="rgb_color")}function aT(r,e,i){r===1?e.width=e.height=i.readVarint():r===2?e.height=i.readVarint():r===3?e.children.push(hm(i,i.readVarint()+i.pos)):r===4?e.linear_gradients.push((function(n,a){return n.readFields(pT,{spread_method:1,stops:[],x1:0,y1:0,x2:1,y2:0},a)})(i,i.readVarint()+i.pos)):r===5?e.radial_gradients.push((function(n,a){return n.readFields(_T,{spread_method:1,stops:[],cx:.5,cy:.5,r:.5,fx:.5,fy:.5,fr:0},a)})(i,i.readVarint()+i.pos)):r===7?e.clip_paths.push((function(n,a){return n.readFields(gT,{children:[]},a)})(i,i.readVarint()+i.pos)):r===8&&e.masks.push((function(n,a){const u=n.readFields(yT,{left:0,width:20,mask_type:1,children:[]},a);return u.height==null&&(u.height=u.width),u.top==null&&(u.top=u.left),u})(i,i.readVarint()+i.pos))}function hm(r,e){return r.readFields(lT,{},e)}function lT(r,e,i){r===1?(e.group=(function(n,a){return n.readFields(cT,{opacity:255,children:[]},a)})(i,i.readVarint()+i.pos),e.node="group"):r===2&&(e.path=(function(n,a){return n.readFields(hT,{paint_order:1,commands:[],step:1,diffs:[],rule:1},a)})(i,i.readVarint()+i.pos),e.node="path")}function cT(r,e,i){r===1?e.transform=dm(i,i.readVarint()+i.pos):r===2?e.opacity=i.readVarint():r===5?e.clip_path_idx=i.readVarint():r===6?e.mask_idx=i.readVarint():r===7&&e.children.push(hm(i,i.readVarint()+i.pos))}function dm(r,e){return r.readFields(uT,{sx:1,ky:0,kx:0,sy:1,tx:0,ty:0},e)}function uT(r,e,i){r===1?e.sx=i.readFloat():r===2?e.ky=i.readFloat():r===3?e.kx=i.readFloat():r===4?e.sy=i.readFloat():r===5?e.tx=i.readFloat():r===6&&(e.ty=i.readFloat())}function hT(r,e,i){r===1?e.fill=(function(n,a){return n.readFields(dT,{rgb_color:mg,paint:"rgb_color",opacity:255},a)})(i,i.readVarint()+i.pos):r===2?e.stroke=(function(n,a){return n.readFields(fT,{rgb_color:mg,paint:"rgb_color",dasharray:[],dashoffset:0,miterlimit:4,opacity:255,width:1,linecap:1,linejoin:1},a)})(i,i.readVarint()+i.pos):r===3?e.paint_order=i.readVarint():r===5?i.readPackedVarint(e.commands):r===6?e.step=i.readFloat():r===7?i.readPackedSVarint(e.diffs):r===8&&(e.rule=i.readVarint())}
8function dT(r,e,i){r===1?(e.rgb_color=fm(i.readVarint()),e.paint="rgb_color"):r===2?(e.linear_gradient_idx=i.readVarint(),e.paint="linear_gradient_idx"):r===3?(e.radial_gradient_idx=i.readVarint(),e.paint="radial_gradient_idx"):r===5&&(e.opacity=i.readVarint())}function fm(r){return new ii((r>>16&255)/255,(r>>8&255)/255,(255&r)/255,1)}function fT(r,e,i){r===1?(e.rgb_color=fm(i.readVarint()),e.paint="rgb_color"):r===2?(e.linear_gradient_idx=i.readVarint(),e.paint="linear_gradient_idx"):r===3?(e.radial_gradient_idx=i.readVarint(),e.paint="radial_gradient_idx"):r===5?i.readPackedFloat(e.dasharray):r===6?e.dashoffset=i.readFloat():r===7?e.miterlimit=i.readFloat():r===8?e.opacity=i.readVarint():r===9?e.width=i.readFloat():r===10?e.linecap=i.readVarint():r===11&&(e.linejoin=i.readVarint())}function pT(r,e,i){r===1?e.transform=dm(i,i.readVarint()+i.pos):r===2?e.spread_method=i.readVarint():r===3?e.stops.push(Qv(i,i.readVarint()+i.pos)):r===4?e.x1=i.readFloat():r===5?e.y1=i.readFloat():r===6?e.x2=i.readFloat():r===7&&(e.y2=i.readFloat())}function Qv(r,e){return r.readFields(mT,{offset:0,opacity:255,rgb_color:mg},e)}function mT(r,e,i){r===1?e.offset=i.readFloat():r===2?e.opacity=i.readVarint():r===3&&(e.rgb_color=fm(i.readVarint()))}function _T(r,e,i){r===1?e.transform=dm(i,i.readVarint()+i.pos):r===2?e.spread_method=i.readVarint():r===3?e.stops.push(Qv(i,i.readVarint()+i.pos)):r===4?e.cx=i.readFloat():r===5?e.cy=i.readFloat():r===6?e.r=i.readFloat():r===7?e.fx=i.readFloat():r===8?e.fy=i.readFloat():r===9&&(e.fr=i.readFloat())}function gT(r,e,i){r===1?e.transform=dm(i,i.readVarint()+i.pos):r===2?e.clip_path_idx=i.readVarint():r===3&&e.children.push(hm(i,i.readVarint()+i.pos))}function yT(r,e,i){r===1?e.left=e.top=i.readFloat():r===2?e.width=e.height=i.readFloat():r===3?e.top=i.readFloat():r===4?e.height=i.readFloat():r===5?e.mask_type=i.readVarint():r===6?e.mask_idx=i.readVarint():r===7&&e.children.push(hm(i,i.readVarint()+i.pos))}class xT{static calculate(e={},i=[]){const n=new Map,a=new Map;if(Object.keys(e).length===0)return n;i.forEach(u=>{a.set(u.name,u.rgb_color||new ii(0,0,0))});for(const[u,h]of Object.entries(e))a.has(u)?n.set(a.get(u).toString(),h):console.warn(`Ignoring unknown image variable "${u}"`);return n}}function Iu(r,e=255,i){const n=e/255,a=r.toString(),u=i.has(a)?i.get(a).clone():r.clone();return u.a*=n,u.toString()}function Nd(r,e){if(!Ns()){const i=document.createElement("canvas");return i.width=r,i.height=e,i}return new OffscreenCanvas(r,e)}let _g,Vd=null;function gg(r,e,i,n,a){for(const u of n.children)e0(r,e,i,u,a)}function e0(r,e,i,n,a){n.group?(r.save(),(function(u,h,f,_,g){const v=_.mask_idx!=null?f.masks[_.mask_idx]:null,b=_.clip_path_idx!=null?f.clip_paths[_.clip_path_idx]:null;if(_.transform&&(h=Au(_.transform).preMultiplySelf(h)),!(function(I,P,D){return I.opacity!==255||P||D})(_,b!=null,v!=null))return void gg(u,h,f,_,g);const w=Nd(u.canvas.width,u.canvas.height),E=w.getContext("2d");gg(E,h,f,_,g),b&&a0(E,h,f,b),v&&l0(E,h,f,v,g),u.globalAlpha=_.opacity/255,u.drawImage(w,0,0)})(r,e,i,n.group,a),r.restore()):n.path&&(r.save(),(function(u,h,f,_,g){u.setTransform(h),_.paint_order===1?(t0(u,f,_,g),r0(u,f,_,g)):(r0(u,f,_,g),t0(u,f,_,g))})(r,e,i,n.path,a),r.restore())}function t0(r,e,i,n){const a=i.fill;if(!a)return;const u=a.opacity/255;switch(r.save(),r.beginPath(),c0(i,r),a.paint){case"rgb_color":r.fillStyle=Iu(a.rgb_color,a.opacity,n);break;case"linear_gradient_idx":{const h=e.linear_gradients[a.linear_gradient_idx];h.transform&&r.setTransform(Au(h.transform).preMultiplySelf(r.getTransform())),r.fillStyle=n0(r,h,u,n);break}case"radial_gradient_idx":{const h=e.radial_gradients[a.radial_gradient_idx];h.transform&&r.setTransform(Au(h.transform).preMultiplySelf(r.getTransform())),r.fillStyle=o0(r,h,u,n)}}r.fill(i0(i)),r.restore()}function i0(r){return r.rule===1?"nonzero":r.rule===2?"evenodd":void 0}function r0(r,e,i,n){const a=i.stroke;if(!a)return;const u=u0(i);r.lineWidth=a.width,r.miterLimit=a.miterlimit,r.setLineDash(a.dasharray),r.lineDashOffset=a.dashoffset;const h=a.opacity/255;switch(a.paint){case"rgb_color":r.strokeStyle=Iu(a.rgb_color,a.opacity,n);break;case"linear_gradient_idx":r.strokeStyle=n0(r,e.linear_gradients[a.linear_gradient_idx],h,n,!0);break;case"radial_gradient_idx":r.strokeStyle=o0(r,e.radial_gradients[a.radial_gradient_idx],h,n,!0)}switch(a.linejoin){case 2:case 1:r.lineJoin="miter";break;case 3:r.lineJoin="round";break;case 4:r.lineJoin="bevel"}switch(a.linecap){case 1:r.lineCap="butt";break;case 2:r.lineCap="round";break;case 3:r.lineCap="square"}r.stroke(u)}function n0(r,e,i,n,a=!1){if(e.stops.length===1){const w=e.stops[0];return Iu(w.rgb_color,w.opacity*i,n)}const{x1:u,y1:h,x2:f,y2:_}=e;let g=new DOMPoint(u,h),v=new DOMPoint(f,_);if(a){const w=Au(e.transform);g=w.transformPoint(g),v=w.transformPoint(v)}const b=r.createLinearGradient(g.x,g.y,v.x,v.y);for(const w of e.stops)b.addColorStop(w.offset,Iu(w.rgb_color,w.opacity*i,n));return b}function o0(r,e,i,n,a=!1){if(e.stops.length===1){const R=e.stops[0];return Iu(R.rgb_color,R.opacity*i,n)}const u=Au(e.transform),{fx:h,fy:f,fr:_,cx:g,cy:v,r:b}=e;let w=new DOMPoint(h,f),E=new DOMPoint(g,v),I=_,P=b;if(a){w=u.transformPoint(w),E=u.transformPoint(E);const R=(u.a+u.d)/2;I=_*R,P=e.r*R}const D=r.createRadialGradient(w.x,w.y,I,E.x,E.y,P);for(const R of e.stops)D.addColorStop(R.offset,Iu(R.rgb_color,R.opacity*i,n));return D}function s0(r,e,i,n){const a=n.transform?Au(n.transform).preMultiplySelf(e):e,u=Nd(r.canvas.width,r.canvas.height),h=u.getContext("2d");for(const _ of n.children)if(_.group)s0(h,a,i,_.group);else if(_.path){const g=_.path,v=new Path2D;v.addPath(u0(g),a),h.fill(v,i0(g))}const f=n.clip_path_idx!=null?i.clip_paths[n.clip_path_idx]:null;f&&a0(h,a,i,f),r.globalCompositeOperation="source-over",r.drawImage(u,0,0)}function a0(r,e,i,n){const a=Nd(r.canvas.width,r.canvas.height);s0(a.getContext("2d"),e,i,n),r.globalCompositeOperation="destination-in",r.drawImage(a,0,0)}function l0(r,e,i,n,a){if(n.children.length===0)return;const u=n.mask_idx!=null?i.masks[n.mask_idx]:null;u&&l0(r,e,i,u,a);const h=r.canvas.width,f=r.canvas.height,_=Nd(h,f),g=_.getContext("2d"),v=n.width,b=n.height,w=n.left,E=n.top,I=new Path2D,P=new Path2D;P.rect(w,E,v,b),I.addPath(P,e),g.clip(I);
vendor: 5,023 bytes, line 8
8for(const F of n.children)e0(g,e,i,F,a);const D=g.getImageData(0,0,h,f),R=D.data;if(n.mask_type===1)for(let F=0;F<R.length;F+=4)R[F+3]=R[F+3]/255*(.2126*R[F]+.7152*R[F+1]+.0722*R[F+2]);g.putImageData(D,0,0),r.globalCompositeOperation="destination-in",r.drawImage(_,0,0)}function Au(r){return r?new DOMMatrix([r.sx,r.ky,r.kx,r.sy,r.tx,r.ty]):new DOMMatrix}function c0(r,e){const i=r.step;let n=r.diffs[0]*i,a=r.diffs[1]*i;e.moveTo(n,a);for(let u=0,h=2;u<r.commands.length;u++)switch(r.commands[u]){case 1:n+=r.diffs[h++]*i,a+=r.diffs[h++]*i,e.moveTo(n,a);break;case 2:n+=r.diffs[h++]*i,a+=r.diffs[h++]*i,e.lineTo(n,a);break;case 3:{const f=n+r.diffs[h++]*i,_=a+r.diffs[h++]*i;n=f+r.diffs[h++]*i,a=_+r.diffs[h++]*i,e.quadraticCurveTo(f,_,n,a);break}case 4:{const f=n+r.diffs[h++]*i,_=a+r.diffs[h++]*i,g=f+r.diffs[h++]*i,v=_+r.diffs[h++]*i;n=g+r.diffs[h++]*i,a=v+r.diffs[h++]*i,e.bezierCurveTo(f,_,g,v,n,a);break}case 5:e.closePath();break}return e}function u0(r){return c0(r,new Path2D)}class pm{constructor(e){this.capacity=e,this.cache=new Map}get(e){if(!this.cache.has(e))return;const i=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,i),i}put(e,i){this.cache.has(e)?this.cache.delete(e):this.cache.size===this.capacity&&this.cache.delete(this.cache.keys().next().value),this.cache.set(e,i)}delete(e){this.cache.delete(e)}}nt(pm,"LRUCache");class yg{constructor(){this.cacheMap=new Map,this.cacheDependenciesMap=new Map}static _getImage(e){return new Br(e,e.data)}getFromCache(e,i,n){return this.cacheMap.has(n)||this.cacheMap.set(n,new pm(150)),this.cacheMap.get(n).get(Js(e.toString(),i))}setInCache(e,i,n,a){this.cacheDependenciesMap.has(a)||this.cacheDependenciesMap.set(a,new Map),this.cacheMap.has(a)||this.cacheMap.set(a,new pm(150));const u=this.cacheDependenciesMap.get(a),h=Js(e.id.toString(),n);u.get(h)||u.set(h,new Set);const f=this.cacheMap.get(a),_=e.toString();u.get(h).add(_),f.put(Js(e.toString(),n),i)}removeImagesFromCacheByIds(e,i,n=0){if(!this.cacheMap.has(n)||!this.cacheDependenciesMap.has(n))return;const a=this.cacheMap.get(n),u=this.cacheDependenciesMap.get(n);for(const h of e){const f=Js(h.toString(),i);if(u.has(f)){for(const _ of u.get(f))a.delete(_);u.delete(f)}}}rasterize(e,i,n,a){const u=this.getFromCache(e,n,a);if(u)return u.clone();const h=(function(_,g){const v=xT.calculate(g.params,_.metadata?_.metadata.variables:[]),b=_.usvg_tree,w=b.width,E=b.height,I=Math.max(1,Math.round(w*g.sx)),P=Math.max(1,Math.round(E*g.sy)),D=new DOMMatrix([I/w,0,0,P/E,0,0]);return Vd===null&&(Vd=Nd(10,10),_g=Vd.getContext("2d",{willReadFrequently:!0})),Vd.width=I,Vd.height=P,gg(_g,D,b,b,v),_g.getImageData(0,0,I,P)})(i.icon,e),f=yg._getImage(h);return this.setInCache(e,f,n,a),f.clone()}}class h0{constructor(e){this.size=e,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(e,i){const n=this.toIdx(e,i);return{min:this.minimums[n],max:this.maximums[n]}}isLeaf(e,i){return this.leaves[this.toIdx(e,i)]}toIdx(e,i){return i*this.size+e}}function d0(r,e,i,n){let a=0,u=Number.MAX_VALUE;for(let h=0;h<3;h++)if(Math.abs(n[h])<1e-15){if(i[h]<r[h]||i[h]>e[h])return null}else{const f=1/n[h];let _=(r[h]-i[h])*f,g=(e[h]-i[h])*f;if(_>g){const v=_;_=g,g=v}if(_>a&&(a=_),g<u&&(u=g),a>u)return null}return a}function f0(r,e,i,n,a,u,h,f,_,g,v){const b=n-r,w=a-e,E=u-i,I=h-r,P=f-e,D=_-i,R=v[1]*D-v[2]*P,F=v[2]*I-v[0]*D,B=v[0]*P-v[1]*I,V=b*R+w*F+E*B;if(Math.abs(V)<1e-15)return null;const $=1/V,H=g[0]-r,J=g[1]-e,ee=g[2]-i,K=(H*R+J*F+ee*B)*$;if(K<0||K>1)return null;const re=J*E-ee*w,se=ee*b-H*E,Ee=H*w-J*b,we=(v[0]*re+v[1]*se+v[2]*Ee)*$;return we<0||K+we>1?null:(I*re+P*se+D*Ee)*$}function p0(r,e,i){return(r-e)/(i-e)}function m0(r,e,i,n,a,u,h,f,_){const g=1<<i,v=u-n,b=h-a,w=(r+1)/g*v+n,E=(e+0)/g*b+a,I=(e+1)/g*b+a;f[0]=(r+0)/g*v+n,f[1]=E,_[0]=w,_[1]=I}class _0{constructor(e){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=e,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;const i=(function(u){const h=Math.ceil(Math.log2(u.dim/8)),f=[];let _=Math.ceil(Math.pow(2,h));const g=1/_,v=(E,I,P,D,R)=>{const F=D?1:0,B=(E+1)*P-F,V=I*P,$=(I+1)*P-F;R[0]=E*P,R[1]=V,R[2]=B,R[3]=$};let b=new h0(_);const w=[];for(let E=0;E<_*_;E++){v(E%_,Math.floor(E/_),g,!1,w);const I=Ja(w[0],w[1],u),P=Ja(w[2],w[1],u),D=Ja(w[2],w[3],u),R=Ja(w[0],w[3],u);b.minimums.push(Math.min(I,P,D,R)),b.maximums.push(Math.max(I,P,D,R)),b.leaves.push(1)}for(f.push(b),_/=2;_>=1;_/=2){const E=f[f.length-1];b=new h0(_);for(let I=0;I<_*_;I++){v(I%_,Math.floor(I/_),2,!0,w);const P=E.getElevation(w[0],w[1]),D=E.getElevation(w[2],w[1]),R=E.getElevation(w[2],w[3]),F=E.getElevation(w[0],w[3]),B=E.isLeaf(w[0],w[1]),V=E.isLeaf(w[2],w[1]),$=E.isLeaf(w[2],w[3]),H=E.isLeaf(w[0],w[3]),J=Math.min(P.min,D.min,R.min,F.min),ee=Math.max(P.max,D.max,R.max,F.max),K=B&&V&&$&&H;b.maximums.push(ee),b.minimums.push(J),b.leaves.push(ee-J<=5&&K?1:0)}f.push(b)}return f})(this.dem),n=i.length-1,a=i[n];this._addNode(a.minimums[0],a.maximums[0],a.leaves[0]),this._construct(i,
80,0,n,0)}raycastRoot(e,i,n,a,u,h,f=1){return d0([e,i,-100],[n,a,this.maximums[0]*f],u,h)}raycast(e,i,n,a,u,h,f=1){if(!this.nodeCount)return null;const _=this.raycastRoot(e,i,n,a,u,h,f);if(_==null)return null;const g=[],v=[],b=[],w=[],E=[{idx:0,t:_,nodex:0,nodey:0,depth:0}];for(;E.length>0;){const{idx:I,t:P,nodex:D,nodey:R,depth:F}=E.pop();if(this.leaves[I]){m0(D,R,F,e,i,n,a,b,w);const V=1<<F,$=(D+0)/V,H=(D+1)/V,J=(R+0)/V,ee=(R+1)/V,K=Ja($,J,this.dem)*f,re=Ja(H,J,this.dem)*f,se=Ja(H,ee,this.dem)*f,Ee=Ja($,ee,this.dem)*f,we=f0(b[0],b[1],K,w[0],b[1],re,w[0],w[1],se,u,h),Se=f0(w[0],w[1],se,b[0],w[1],Ee,b[0],b[1],K,u,h),Re=Math.min(we!==null?we:Number.MAX_VALUE,Se!==null?Se:Number.MAX_VALUE);if(Re!==Number.MAX_VALUE)return Re;{const Ce=Mn([],u,h,P);if(g0(K,re,Ee,se,p0(Ce[0],b[0],w[0]),p0(Ce[1],b[1],w[1]))>=Ce[2])return P}continue}let B=0;for(let V=0;V<this._siblingOffset.length;V++){m0((D<<1)+this._siblingOffset[V][0],(R<<1)+this._siblingOffset[V][1],F+1,e,i,n,a,b,w),b[2]=-100,w[2]=this.maximums[this.childOffsets[I]+V]*f;const $=d0(b,w,u,h);if($!=null){const H=$;g[V]=H;let J=!1;for(let ee=0;ee<B&&!J;ee++)H>=g[v[ee]]&&(v.splice(ee,0,V),J=!0);J||(v[B]=V),B++}}for(let V=0;V<B;V++){const $=v[V];E.push({idx:this.childOffsets[I]+$,t:g[$],nodex:(D<<1)+this._siblingOffset[$][0],nodey:(R<<1)+this._siblingOffset[$][1],depth:F+1})}}return null}_addNode(e,i,n){return this.minimums.push(e),this.maximums.push(i),this.leaves.push(n),this.childOffsets.push(0),this.nodeCount++}_construct(e,i,n,a,u){if(e[a].isLeaf(i,n)===1)return;this.childOffsets[u]||(this.childOffsets[u]=this.nodeCount);const h=a-1,f=e[h];let _=0,g=0;for(let v=0;v<this._siblingOffset.length;v++){const b=2*i+this._siblingOffset[v][0],w=2*n+this._siblingOffset[v][1],E=f.getElevation(b,w),I=f.isLeaf(b,w),P=this._addNode(E.min,E.max,I);I&&(_|=1<<v),g||(g=P)}for(let v=0;v<this._siblingOffset.length;v++)_&1<<v||this._construct(e,2*i+this._siblingOffset[v][0],2*n+this._siblingOffset[v][1],h,g+v)}}function g0(r,e,i,n,a,u){return _t(_t(r,i,u),_t(e,n,u),a)}function Ja(r,e,i){const n=i.dim,a=Y(r*n-.5,0,n-1),u=Y(e*n-.5,0,n-1),h=Math.floor(a),f=Math.floor(u),_=Math.min(h+1,n-1),g=Math.min(f+1,n-1);return g0(i.get(h,f),i.get(_,f),i.get(h,g),i.get(_,g),a-h,u-f)}const vT={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function bT(r,e,i){return(256*r*256+256*e+i)/10-1e4}function wT(r,e,i){return 256*r+e+i/256-32768}class mm{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(e,i,n,a=!1){if(this.uid=e,i.height!==i.width)throw new RangeError("DEM tiles must be square");if(n&&n!=="mapbox"&&n!=="terrarium")return void xt(`"${n}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=i.height;const u=this.dim=i.height-2,h=new Uint32Array(i.data.buffer);if(this.pixels=new Uint8Array(i.data.buffer),this.floatView=new Float32Array(i.data.buffer),this.borderReady=a,this._modifiedForSources={},!a){for(let _=0;_<u;_++)h[this._idx(-1,_)]=h[this._idx(0,_)],h[this._idx(u,_)]=h[this._idx(u-1,_)],h[this._idx(_,-1)]=h[this._idx(_,0)],h[this._idx(_,u)]=h[this._idx(_,u-1)];h[this._idx(-1,-1)]=h[this._idx(0,0)],h[this._idx(u,-1)]=h[this._idx(u-1,0)],h[this._idx(-1,u)]=h[this._idx(0,u-1)],h[this._idx(u,u)]=h[this._idx(u-1,u-1)]}const f=n==="terrarium"?wT:bT;
vendor: 20,555 bytes, line 8
8for(let _=0;_<h.length;++_){const g=4*_;this.floatView[_]=f(this.pixels[g],this.pixels[g+1],this.pixels[g+2])}this._timestamp=Rn.now()}_buildQuadTree(){this._tree=new _0(this)}get(e,i,n=!1){n&&(e=Y(e,-1,this.dim),i=Y(i,-1,this.dim));const a=this._idx(e,i);return this.floatView[a]}set(e,i,n){const a=this._idx(e,i),u=this.floatView[a];return this.floatView[a]=n,n-u}static getUnpackVector(e){return vT[e]}_idx(e,i){if(e<-1||e>=this.dim+1||i<-1||i>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(i+1)*this.stride+(e+1)}static pack(e,i){const n=[0,0,0,0],a=mm.getUnpackVector(i);let u=Math.floor((e+a[3])/a[2]);return n[2]=u%256,u=Math.floor(u/256),n[1]=u%256,u=Math.floor(u/256),n[0]=u,n}getPixels(){return new ty({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,i,n){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let a=i*this.dim,u=i*this.dim+this.dim,h=n*this.dim,f=n*this.dim+this.dim;switch(i){case-1:a=u-1;break;case 1:u=a+1}switch(n){case-1:h=f-1;break;case 1:f=h+1}const _=-i*this.dim,g=-n*this.dim;for(let v=h;v<f;v++)for(let b=a;b<u;b++){const w=4*this._idx(b,v),E=4*this._idx(b+_,v+g);this.pixels[w+0]=e.pixels[E+0],this.pixels[w+1]=e.pixels[E+1],this.pixels[w+2]=e.pixels[E+2],this.pixels[w+3]=e.pixels[E+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}function TT(r,e,i){r===1?e.headerLength=i.readFixed32():r===2?e.x=i.readVarint():r===3?e.y=i.readVarint():r===4?e.z=i.readVarint():r===5&&e.layers.push((function(n,a){return n.readFields(MT,{version:0,name:"",units:"",tileSize:0,buffer:0,pixelFormat:0,dataIndex:[]},a)})(i,i.readVarint()+i.pos))}function ST(r,e,i){r===1?(e.delta_filter=(function(n,a){return n.readFields(ET,{blockSize:0},a)})(i,i.readVarint()+i.pos),e.filter="delta_filter"):r===2?(i.readVarint(),e.filter="zigzag_filter"):r===3?(i.readVarint(),e.filter="bitshuffle_filter"):r===4&&(i.readVarint(),e.filter="byteshuffle_filter")}function ET(r,e,i){r===1&&(e.blockSize=i.readVarint())}function IT(r,e,i){r===1?(i.readVarint(),e.codec="gzip_data"):r===2?(i.readVarint(),e.codec="jpeg_image"):r===3?(i.readVarint(),e.codec="webp_image"):r===4&&(i.readVarint(),e.codec="png_image")}function AT(r,e,i){let n=0,a=0;r===1?e.firstByte=i.readFixed64():r===2?e.lastByte=i.readFixed64():r===3?e.filters.push((function(u,h){return u.readFields(ST,{},h)})(i,i.readVarint()+i.pos)):r===4?e.codec=(function(u,h){return u.readFields(IT,{},h)})(i,i.readVarint()+i.pos):r===5?a=i.readFloat():r===6?n=i.readFloat():r===7?e.bands.push(i.readString()):r===8?e.offset=i.readDouble():r===9&&(e.scale=i.readDouble()),e.offset===0&&(e.offset=a),e.scale===0&&(e.scale=n)}function MT(r,e,i){r===1?e.version=i.readVarint():r===2?e.name=i.readString():r===3?e.units=i.readString():r===4?e.tileSize=i.readVarint():r===5?e.buffer=i.readVarint():r===6?e.pixelFormat=i.readVarint():r===7&&e.dataIndex.push((function(n,a){return n.readFields(AT,{firstByte:0,lastByte:0,filters:[],codec:null,offset:0,scale:0,bands:[]},a)})(i,i.readVarint()+i.pos))}function CT(r,e,i){if(r===2)(function(n,a,u){n.readFields(PT,u,a)})(i,i.readVarint()+i.pos,e);else if(r===3)throw new Error("Not implemented")}function PT(r,e,i){if(r===1){let n=0;const a=i.readVarint()+i.pos;for(;i.pos<a;)e[n++]=i.readVarint()}}function RT(r,e){if(e.length!==4)throw new Error(`Expected data of dimension 4 but got ${e.length}.`);let i=e[3];for(let n=2;n>=1;n--){const a=n===1?1:0,u=n===2?1:0;for(let h=0;h<e[0];h++){const f=e[1]*h;for(let _=a;_<e[1];_++){const g=e[2]*(_+f);for(let v=u;v<e[2];v++){const b=e[3]*(v+g);for(let w=0;w<e[3];w++){const E=b+w;r[E]+=r[E-i]}}}}i*=e[n]}return r}function zT(r){for(let e=0,i=r.length;e<i;e++)r[e]=r[e]>>>1^-(1&r[e]);return r}function DT(r,e){switch(e){case"uint32":return r;case"uint16":for(let i=0;i<r.length;i+=2){const n=r[i],a=r[i+1];r[i]=(240&n)>>4|(61440&n)>>8|(240&a)<<4|61440&a,r[i+1]=15&n|(3840&n)>>4|(15&a)<<8|(3840&a)<<4}return r;case"uint8":for(let i=0;i<r.length;i+=4){const n=r[i],a=r[i+1],u=r[i+2],h=r[i+3];r[i+0]=(192&n)>>6|(192&a)>>4|(192&u)>>2|192&h,r[i+1]=(48&n)>>4|(48&a)>>2|48&u|(48&h)<<2,r[i+2]=(12&n)>>2|12&a|(12&u)<<2|(12&h)<<4,r[i+3]=3&n|(3&a)<<2|(3&u)<<4|(3&h)<<6}return r;default:throw new Error(`Invalid pixel format, "${e}"`)}}nt(mm,"DEMData"),nt(_0,"DemMinMaxQuadTree",{omit:["dem"]});var ao=Uint8Array,Ud=Uint16Array,LT=Int32Array,y0=new ao([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),x0=new ao([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),FT=new ao([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),v0=function(r,e){for(var i=new Ud(31),n=0;n<31;++n)i[n]=e+=1<<r[n-1];var a=new LT(i[30]);for(n=1;n<30;++n)for(var u=i[n];u<i[n+1];++u)a[u]=u-i[n]<<5|n;return{b:i,r:a}},b0=v0(y0,2),w0=b0.b,OT=b0.r;w0[28]=258,OT[258]=28;for(var kT=v0(x0,0).b,T0=new Ud(32768),dr=0;dr<32768;++dr){var Mu=(43690&dr)>>1|(21845&dr)<<1;T0[dr]=((65280&(Mu=(61680&(Mu=(52428&Mu)>>2|(13107&Mu)<<2))>>4|(3855&Mu)<<4))>>8|(255&Mu)<<8)>>1}var jd=function(r,e,i){for(var n=r.length,a=0,u=new Ud(e);a<n;++a)r[a]&&++u[r[a]-1];var h,f=new Ud(e);for(a=1;a<e;++a)f[a]=f[a-1]+u[a-1]<<1;h=new Ud(1<<e);var _=15-e;for(a=0;a<n;++a)if(r[a])for(var g=a<<4|r[a],v=e-r[a],b=f[r[a]-1]++<<v,w=b|(1<<v)-1;b<=w;++b)h[T0[b]>>_]=g;return h},Gd=new ao(288);for(dr=0;dr<144;++dr)Gd[dr]=8;for(dr=144;dr<256;++dr)Gd[dr]=9;for(dr=256;dr<280;++dr)Gd[dr]=7;for(dr=280;dr<288;++dr)Gd[dr]=8;var S0=new ao(32);for(dr=0;dr<32;++dr)S0[dr]=5;var BT=jd(Gd,9),NT=jd(S0,5),xg=function(r){for(var e=r[0],i=1;i<r.length;++i)r[i]>e&&(e=r[i]);return e},Yo=function(r,e,i){var n=e/8|0;return(r[n]|r[n+1]<<8)>>(7&e)&i},vg=function(r,e){var i=e/8|0;return(r[i]|r[i+1]<<8|r[i+2]<<16)>>(7&e)},VT=function(r){return(r+7)/8|0},UT=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Ko=function(r,e,i){var n=new Error(e||UT[r]);if(n.code=r,Error.captureStackTrace&&Error.captureStackTrace(n,Ko),!i)throw n;return n},jT=new ao(0),GT=typeof TextDecoder<"u"&&new TextDecoder;try{GT.decode(jT,{stream:!0})}catch{}const qT={gzip_data:"gzip"};class Io extends Error{constructor(e){super(e),this.name="MRTError"}}const HT={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},E0={uint32:1,uint16:2,uint8:4},$T={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let bg;class _m{constructor(e=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=e}getLayer(e){const i=this.layers[e];if(!i)throw new Io(`Layer '${e}' not found`);return i}getHeaderLength(e){const i=new Uint8Array(e),n=new DataView(e);if(i[0]!==13)throw new Io("File is not a valid MRT.");return n.getUint32(1,!0)}parseHeader(e){const i=new Uint8Array(e),n=this.getHeaderLength(e);if(i.length<n)throw new Io(`Expected header with length >= ${n} but got buffer of length ${i.length}`);const a=new bg(i.subarray(0,n)).readFields(TT,{headerLength:0,x:0,y:0,z:0,layers:[]},void 0);if(!isNaN(this.x)&&(this.x!==a.x||this.y!==a.y||this.z!==a.z))throw new Io(`Invalid attempt to parse header ${a.z}/${a.x}/${a.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=a.x,this.y=a.y,this.z=a.z;for(const u of a.layers)this.layers[u.name]=new I0(u,{cacheSize:this._cacheSize});return this}createDecodingTask(e){const i=[],n=this.getLayer(e.layerName);for(let a of e.blockIndices){const u=n.dataIndex[a],h=u.firstByte-e.firstByte,f=u.lastByte-e.firstByte;if(n._blocksInProgress.has(a))continue;const _={layerName:n.name,firstByte:h,lastByte:f,pixelFormat:n.pixelFormat,blockIndex:a,blockShape:[u.bands.length].concat(n.bandShape),buffer:n.buffer,codec:u.codec.codec,filters:u.filters.map(g=>g.filter)};n._blocksInProgress.add(a),i.push(_)}return new A0(i,()=>{i.forEach(a=>n._blocksInProgress.delete(a.blockIndex))},(a,u)=>{if(i.forEach(h=>n._blocksInProgress.delete(h.blockIndex)),a)throw a;u.forEach(h=>{this.getLayer(h.layerName).processDecodedData(h)})})}}class I0{constructor({version:e,name:i,units:n,tileSize:a,pixelFormat:u,buffer:h,dataIndex:f},_){if(this.version=e,this.version!==1)throw new Io(`Cannot parse raster layer encoded with MRT version ${e}`);this.name=i,this.units=n,this.tileSize=a,this.buffer=h,this.pixelFormat=HT[u],this.dataIndex=f,this.bandShape=[a+2*h,a+2*h,E0[this.pixelFormat]],this._decodedBlocks=new pm(_?_.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return E0[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:e})=>e).flat()}processDecodedData(e){const i=e.blockIndex.toString();this._decodedBlocks.get(i)||this._decodedBlocks.put(i,e.data)}getBlockForBand(e){let i=0;switch(typeof e){case"string":for(const[n,a]of this.dataIndex.entries()){for(const[u,h]of a.bands.entries())if(h===e)return{bandIndex:i+u,blockIndex:n,blockBandIndex:u};i+=a.bands.length}break;case"number":for(const[n,a]of this.dataIndex.entries()){if(e>=i&&e<i+a.bands.length)return{bandIndex:e,blockIndex:n,blockBandIndex:e-i};i+=a.bands.length}break;default:throw new Io(`Invalid band \`${JSON.stringify(e)}\`. Expected string or integer.`)}return{blockIndex:-1,blockBandIndex:-1}}getDataRange(e){let i=1/0,n=-1/0;const a=[],u=new Set;for(const h of e){const{blockIndex:f}=this.getBlockForBand(h);if(f<0)throw new Io(`Invalid band: ${JSON.stringify(h)}`);const _=this.dataIndex[f];a.includes(f)||a.push(f),u.add(f),i=Math.min(i,_.firstByte),n=Math.max(n,_.lastByte)}if(u.size>this.cacheSize)throw new Io(`Number of blocks to decode (${u.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:i,lastByte:n,blockIndices:a}}hasBand(e){const{blockIndex:i}=this.getBlockForBand(e);return i>=0}hasDataForBand(e){const{blockIndex:i}=this.getBlockForBand(e);return i>=0&&!!this._decodedBlocks.get(i.toString())}getBandView(e){const{blockIndex:i,blockBandIndex:n}=this.getBlockForBand(e);if(i<0)throw new Io(`Band not found: ${JSON.stringify(e)}`);const a=this._decodedBlocks.get(i.toString());if(!a)throw new Io(`Data for band ${JSON.stringify(e)} of layer "${this.name}" not decoded.`);const u=this.dataIndex[i],h=this.bandShape.reduce((g,v)=>g*v,1),f=n*h,_=a.subarray(f,f+h);return{data:_,bytes:new Uint8Array(_.buffer).subarray(_.byteOffset,_.byteOffset+_.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:u.offset,scale:u.scale}}}_m.setPbf=function(r){bg=r};class A0{constructor(e,i,n){this.tasks=e,this._onCancel=i,this._onComplete=n,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(e,i){this._finalized||(this._onComplete(e,i),this._finalized=!0)}}_m.performDecoding=function(r,e){const i=new Uint8Array(r);return Promise.all(e.tasks.map(n=>{const{layerName:a,firstByte:u,lastByte:h,pixelFormat:f,blockShape:_,blockIndex:g,filters:v,codec:b}=n,w=i.subarray(u,h+1),E=new Uint32Array(_[0]*_[1]*_[2]);let I;if(b!=="gzip_data")throw new Io(`Unhandled codec: ${b}`);return I=(function(P,D){if(!globalThis.DecompressionStream&&D==="gzip_data")return Promise.resolve(($=(function(ee){ee[0]==31&&ee[1]==139&&ee[2]==8||Ko(6,"invalid gzip data");var K=ee[3],re=10;4&K&&(re+=2+(ee[10]|ee[11]<<8));for(var se=(K>>3&1)+(K>>4&1);se>0;se-=!ee[re++]);return re+(2&K)})(R=P),$+8>R.length&&Ko(6,"invalid gzip data"),(function(ee,K,re,se){var Ee=ee.length;if(!Ee||K.f&&!K.l)return re||new ao(0);var we=!re,Se=we||K.i!=2,Re=K.i;we&&(re=new ao(3*Ee));var Ce=function(sn){var Ps=re.length;if(sn>Ps){var Gr=new ao(Math.max(2*Ps,sn));Gr.set(re),re=Gr}},Pe=K.f||0,ye=K.p||0,De=K.b||0,Ae=K.l,Le=K.d,ze=K.m,tt=K.n,it=8*Ee;do{if(!Ae){Pe=Yo(ee,ye,1);var Ze=Yo(ee,ye+1,3);if(ye+=3,!Ze){var Xe=ee[(Wt=VT(ye)+4)-4]|ee[Wt-3]<<8,pt=Wt+Xe;if(pt>Ee){Re&&Ko(0);break}Se&&Ce(De+Xe),re.set(ee.subarray(Wt,pt),De),K.b=De+=Xe,K.p=ye=8*pt,K.f=Pe;continue}if(Ze==1)Ae=BT,Le=NT,ze=9,tt=5;else if(Ze==2){var ct=Yo(ee,ye,31)+257,Qe=Yo(ee,ye+10,15)+4,bt=ct+Yo(ee,ye+5,31)+1;ye+=14;for(var Ot=new ao(bt),Kt=new ao(19),Lt=0;Lt<Qe;++Lt)Kt[FT[Lt]]=Yo(ee,ye+3*Lt,7);ye+=3*Qe;var hi=xg(Kt),qt=(1<<hi)-1,Zi=jd(Kt,hi);for(Lt=0;Lt<bt;){var Wt,ai=Zi[Yo(ee,ye,qt)];if(ye+=15&ai,(Wt=ai>>4)<16)Ot[Lt++]=Wt;else{var Si=0,Li=0;for(Wt==16?(Li=3+Yo(ee,ye,3),ye+=2,Si=Ot[Lt-1]):Wt==17?(Li=3+Yo(ee,ye,7),ye+=3):Wt==18&&(Li=11+Yo(ee,ye,127),ye+=7);Li--;)Ot[Lt++]=Si}}var Fi=Ot.subarray(0,ct),Wi=Ot.subarray(ct);ze=xg(Fi),tt=xg(Wi),Ae=jd(Fi,ze),Le=jd(Wi,tt)}else Ko(1);if(ye>it){Re&&Ko(0);break}}Se&&Ce(De+131072);for(var Ar=(1<<ze)-1,Nr=(1<<tt)-1,sr=ye;;sr=ye){var fr=(Si=Ae[vg(ee,ye)&Ar])>>4;if((ye+=15&Si)>it){Re&&Ko(0);break}if(Si||Ko(2),fr<256)re[De++]=fr;else{if(fr==256){sr=ye,Ae=null;break}var yr=fr-254;fr>264&&(yr=Yo(ee,ye,(1<<(Vi=y0[Lt=fr-257]))-1)+w0[Lt],ye+=Vi);var Rt=Le[vg(ee,ye)&Nr],Oi=Rt>>4;if(Rt||Ko(3),ye+=15&Rt,Wi=kT[Oi],Oi>3){var Vi=x0[Oi];Wi+=vg(ee,ye)&(1<<Vi)-1,ye+=Vi}if(ye>it){Re&&Ko(0);break}Se&&Ce(De+131072);var Gn=De+yr;if(De<Wi){var on=0-Wi,Mr=Math.min(Wi,Gn);for(on+De<0&&Ko(3);De<Mr;++De)re[De]=se[on+De]}for(;De<Gn;++De)re[De]=re[De-Wi]}}K.l=Ae,K.p=sr,K.b=De,K.f=Pe,Ae&&(Pe=1,K.m=ze,K.d=Le,K.n=tt)}while(!Pe);return De!=re.length&&we?(function(sn,Ps,Gr){return(Gr==null||Gr>sn.length)&&(Gr=sn.length),new ao(sn.subarray(0,Gr))})(re,0,De):re.subarray(0,De)})(R.subarray($,-8),{i:2},new ao(((B=R)[(V=B.length)-4]|B[V-3]<<8|B[V-2]<<16|B[V-1]<<24)>>>0),F)));var R,F,B,V,$;const H=qT[D];if(!H)throw new Error(`Unhandled codec: ${D}`);const J=new globalThis.DecompressionStream(H);return new Response(new Blob([P]).stream().pipeThrough(J)).arrayBuffer().then(ee=>new Uint8Array(ee))})(w,b).then(P=>((function(D,R){D.readFields(CT,R)})(new bg(P),E),new $T[f](E.buffer))),I.then(P=>{for(let D=v.length-1;D>=0;D--)switch(v[D]){case"delta_filter":RT(P,_);break;case"zigzag_filter":zT(P);break;case"bitshuffle_filter":DT(P,f);break;default:throw new Io(`Unhandled filter "${v[D]}"`)}return{layerName:a,blockIndex:g,data:P}}).catch(P=>{throw P})}))},nt(A0,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),nt(_m,"MapboxRasterTile"),nt(I0,"MapboxRasterLayer",{omit:["_blocksInProgress"]});class M0{constructor(e){this._stringToNumber={},this._numberToString=[];for(let i=0;i<e.length;i++){const n=e[i];this._stringToNumber[n]=i,this._numberToString[i]=n}}encode(e){return this._stringToNumber[e]}decode(e){return this._numberToString[e]}}class C0{constructor(e,i){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Ys(We,16,0),this.featureIndexArray=new Hl,this.promoteId=i,this.is3DTile=!1,this.serializedLayersCache=new Map}insert(e,i,n,a,u,h=0,f=0){const _=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,a,u,h);const g=this.grid;for(let v=0;v<i.length;v++){const b=i[v],w=[1/0,1/0,-1/0,-1/0];for(let E=0;E<b.length;E++){const I=b[E];w[0]=Math.min(w[0],I.x),w[1]=Math.min(w[1],I.y),w[2]=Math.max(w[2],I.x),w[3]=Math.max(w[3],I.y)}f!==0&&(w[0]-=f,w[1]-=f,w[2]+=f,w[3]+=f),w[0]<We&&w[1]<We&&w[2]>=0&&w[3]>=0&&g.insert(_,w[0],w[1],w[2],w[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new ri(new Zp(this.rawTileData)).layers,this.sourceLayerCoder=new M0(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const e in this.vtLayers)this.vtFeatures[e]=[]}return this.vtLayers}query(e,i){const{tilespaceGeometry:n,transform:a,tileTransform:u,pixelPosMatrix:h,availableImages:f,worldview:_}=i;this.loadVTLayers(),this.serializedLayersCache.clear();const g=i.queryRadius?i.queryRadius:0,v=n.bufferedTilespaceBounds,b=this.grid.query(v.min.x,v.min.y,v.max.x,v.max.y,(P,D,R,F)=>So(n.bufferedTilespaceGeometry,P-g,D-g,R+g,F+g));b.sort(ZT);let w=null;a.elevation&&b.length>0&&(w=Eu.create(a.elevation,this.tileID));const E={};let I;for(let P=0;P<b.length;P++){const D=b[P];if(D===I)continue;I=D;const R=this.featureIndexArray.get(D);let F=null;this.is3DTile?this.loadMatchingModelFeature(E,R,e,n,a,_):this.loadMatchingFeature(E,R,e,f,_,(B,V,$,H=0)=>(F||(F=yt(B,this.tileID.canonical,u)),V.queryIntersectsFeature(n,B,$,F,this.z,a,h,w,H,i.scope)))}return E}loadMatchingFeature(e,i,n,a,u,h){const{featureIndex:f,bucketIndex:_,sourceLayerIndex:g,layoutVertexArrayOffset:v}=i,b=this.bucketLayerIDs[_],w=n.layers,E=Object.keys(w);if(E.length&&!Dt(E,b))return;const I=n.sourceCache,P=this.sourceLayerCoder.decode(g),D=this.vtLayers[P].feature(f),R=this.getId(D,P);for(let F=0;F<b.length;F++){const B=b[F];if(!w[B])continue;const{styleLayer:V,targets:$}=w[B];let H={};R!==void 0&&(H=I.getFeatureState(V.sourceLayer,R));const J=!h||h(D,V,H,v);if(!J)continue;const ee=new oc(D,this.z,this.x,this.y,R);ee.tile=this.tileID.canonical,ee.state=H;let K=this.serializedLayersCache.get(B);K||(K=V.serialize(),K.id=B,this.serializedLayersCache.set(B,K)),ee.source=K.source,ee.sourceLayer=K["source-layer"],ee.layer=Object.assign({},K),ee.layer.paint=P0(K.paint,V.paint,D,H,a),ee.layer.layout=P0(K.layout,V.layout,D,H,a);let re=!1;for(const se of $){this.updateFeatureProperties(ee,se);const{filter:Ee}=se;if(Ee){if(D.properties=ee.properties,Ee.needGeometry){const we=Pt(D,!0);if(!Ee.filter(new ui(this.tileID.overscaledZ,{worldview:u}),we,this.tileID.canonical))continue}else if(!Ee.filter(new ui(this.tileID.overscaledZ,{worldview:u}),D))continue}re=!0,se.targetId&&this.addFeatureVariant(ee,se)}re&&this.appendToResult(e,B,f,ee,J)}}loadMatchingModelFeature(e,i,n,a,u,h){const{featureIndex:f,bucketIndex:_}=i,g=this.bucketLayerIDs[_],v=n.layers,b=Object.keys(v);if(!b.length||Dt(b,g))for(let w=0;w<g.length;w++){const E=g[w],{styleLayer:I,targets:P}=v[E];if(I.type!=="model")continue;const D=a.tile,R=D.getBucket(I);if(!(R&&R instanceof um))continue;const F=eT(R,f,a,u);if(!F)continue;const{z:B,x:V,y:$}=D.tileID.canonical,{feature:H,intersectionZ:J,position:ee}=F;let K={};H.id!==void 0&&(K=n.sourceCache.getFeatureState(I.sourceLayer,H.id));const re=new oc({},B,V,$,H.id);re.tile=this.tileID.canonical,re.state=K,re.properties=H.properties,re.geometry={type:"Point",coordinates:[ee.lng,ee.lat]};let se=this.serializedLayersCache.get(E);se||(se=I.serialize(),se.id=E,this.serializedLayersCache.set(E,se)),re.source=se.source,re.sourceLayer=se["source-layer"],re.layer=Object.assign({},se);let Ee=!1;for(const we of P){this.updateFeatureProperties(re,we);const{filter:Se}=we;if(Se){if(H.properties=re.properties,Se.needGeometry){if(!Se.filter(new ui(this.tileID.overscaledZ,{worldview:h}),H,this.tileID.canonical))continue}else if(!Se.filter(new ui(this.tileID.overscaledZ,{worldview:h}),H))continue}Ee=!0,we.targetId&&this.addFeatureVariant(re,we)}Ee&&this.appendToResult(e,E,f,re,J)}}updateFeatureProperties(e,i,n){if(i.properties){const a={};for(const u in i.properties){const h=i.properties[u].evaluate({zoom:this.z},e._vectorTileFeature,e.state,e.tile,n);h!=null&&(a[u]=h)}e.properties=a}}addFeatureVariant(e,i,n){const a={target:i.target,namespace:i.namespace,uniqueFeatureID:i.uniqueFeatureID};i.properties&&(a.properties=e.properties),e.variants=e.variants||{},e.variants[i.targetId]=e.variants[i.targetId]||[],e.variants[i.targetId].push(a)}appendToResult(e,i,n,a,u){let h=e[i];h===void 0&&(h=e[i]=[]),h.push({featureIndex:n,feature:a,intersectionZ:u})}lookupSymbolFeatures(e,i,n,a,u,h){const f={};this.loadVTLayers();for(const _ of e)this.loadMatchingFeature(f,{bucketIndex:i,sourceLayerIndex:n,featureIndex:_,layoutVertexArrayOffset:0},a,u,h);return f}loadFeature(e){const{featureIndex:i,sourceLayerIndex:n}=e;this.loadVTLayers();const a=this.sourceLayerCoder.decode(n),u=this.vtFeatures[a];if(u[i])return u[i];const h=this.vtLayers[a].feature(i);return u[i]=h,h}hasLayer(e){for(const i of this.bucketLayerIDs)for(const n of i)if(e===n)return!0;return!1}getId(e,i){let n=e.id;if(this.promoteId){const a=Array.isArray(this.promoteId)||typeof this.promoteId!="object"?this.promoteId:this.promoteId[i];if(a!=null)if(Array.isArray(a)){if(!this.promoteIdExpression){const u=xs(a);if(u.result!=="success"){const h=u.value.map(f=>`${f.key}: ${f.message}`).join(", ");return void xt(`Failed to create expression for promoteId: ${h}`)}this.promoteIdExpression=u.value}n=this.promoteIdExpression.evaluate({zoom:0},e)}else n=e.properties[a];typeof n=="boolean"&&(n=Number(n))}return n}}function P0(r,e,i,n,a){return ft(r,(u,h)=>{const f=e instanceof Jr?e.get(h):null;return f&&f.evaluate?f.evaluate(i,n,void 0,a):f})}function ZT(r,e){return e-r}nt(C0,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const R0=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array
vendor: 4,099 bytes, line 8
8];class wg{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[i,n]=new Uint8Array(e,0,2);if(i!==219)throw new Error("Data does not appear to be in a KDBush format.");const a=n>>4;if(a!==1)throw new Error(`Got v${a} data when expected v1.`);const u=R0[15&n];if(!u)throw new Error("Unrecognized array type.");const[h]=new Uint16Array(e,2,1),[f]=new Uint32Array(e,4,1);return new wg(f,h,u,e)}constructor(e,i=64,n=Float64Array,a){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const u=R0.indexOf(this.ArrayType),h=2*e*this.ArrayType.BYTES_PER_ELEMENT,f=e*this.IndexArrayType.BYTES_PER_ELEMENT,_=(8-f%8)%8;if(u<0)throw new Error(`Unexpected typed array class: ${n}.`);a&&a instanceof ArrayBuffer?(this.data=a,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+_,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+h+f+_),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+_,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+u]),new Uint16Array(this.data,2,1)[0]=i,new Uint32Array(this.data,4,1)[0]=e)}add(e,i){const n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=i,n}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return Tg(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,i,n,a){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:u,coords:h,nodeSize:f}=this,_=[0,u.length-1,0],g=[];for(;_.length;){const v=_.pop()||0,b=_.pop()||0,w=_.pop()||0;if(b-w<=f){for(let D=w;D<=b;D++){const R=h[2*D],F=h[2*D+1];R>=e&&R<=n&&F>=i&&F<=a&&g.push(u[D])}continue}const E=w+b>>1,I=h[2*E],P=h[2*E+1];I>=e&&I<=n&&P>=i&&P<=a&&g.push(u[E]),(v===0?e<=I:i<=P)&&(_.push(w),_.push(E-1),_.push(1-v)),(v===0?n>=I:a>=P)&&(_.push(E+1),_.push(b),_.push(1-v))}return g}within(e,i,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:a,coords:u,nodeSize:h}=this,f=[0,a.length-1,0],_=[],g=n*n;for(;f.length;){const v=f.pop()||0,b=f.pop()||0,w=f.pop()||0;if(b-w<=h){for(let D=w;D<=b;D++)D0(u[2*D],u[2*D+1],e,i)<=g&&_.push(a[D]);continue}const E=w+b>>1,I=u[2*E],P=u[2*E+1];D0(I,P,e,i)<=g&&_.push(a[E]),(v===0?e-n<=I:i-n<=P)&&(f.push(w),f.push(E-1),f.push(1-v)),(v===0?e+n>=I:i+n>=P)&&(f.push(E+1),f.push(b),f.push(1-v))}return _}}function Tg(r,e,i,n,a,u){if(a-n<=i)return;const h=n+a>>1;z0(r,e,h,n,a,u),Tg(r,e,i,n,h-1,1-u),Tg(r,e,i,h+1,a,1-u)}function z0(r,e,i,n,a,u){for(;a>n;){if(a-n>600){const g=a-n+1,v=i-n+1,b=Math.log(g),w=.5*Math.exp(2*b/3),E=.5*Math.sqrt(b*w*(g-w)/g)*(v-g/2<0?-1:1);z0(r,e,i,Math.max(n,Math.floor(i-v*w/g+E)),Math.min(a,Math.floor(i+(g-v)*w/g+E)),u)}const h=e[2*i+u];let f=n,_=a;for(qd(r,e,n,i),e[2*a+u]>h&&qd(r,e,n,a);f<_;){for(qd(r,e,f,_),f++,_--;e[2*f+u]<h;)f++;for(;e[2*_+u]>h;)_--}e[2*n+u]===h?qd(r,e,n,_):(_++,qd(r,e,_,a)),_<=i&&(n=_+1),i<=_&&(a=_-1)}}function qd(r,e,i,n){Sg(r,i,n),Sg(e,2*i,2*n),Sg(e,2*i+1,2*n+1)}function Sg(r,e,i){const n=r[e];r[e]=r[i],r[i]=n}function D0(r,e,i,n){const a=r-i,u=e-n;return a*a+u*u}s.$=Hu,s.A=hn,s.B=Js,s.C=2,s.D=fu,s.E=Uo,s.F=Ad,s.G=iv,s.H=vc,s.I=cn,s.J=Xf,s.K=vt,s.L=gt,s.M=bh,s.N=Uc,s.O=Cf,s.P=Be,s.Q=Rl,s.R=ln,s.S=Jc,s.T=z_,s.U=xs,s.V=cm,s.W=qc,s.X=Ea,s.Y=Sa,s.Z=Sl,s._=fn,s.a=function(r){return cr.API_CDN_URL_REGEX.test(r)},s.a$=Fe,s.a0=yl,s.a1=rf,s.a2=Nh,s.a3=class extends cm{},s.a4=jc,s.a5=vh,s.a6=fe,s.a7=function(r){const e=r.value;return e?yl(e)?hg(e,!0)?[]:[new cm(r.key,e,`invalid url "${e}"`)]:[new cm(r.key,e,`string expected, "${vt(e)}" found`)]:[]},s.a8=Fa,s.a9=Bi,s.aA=Y,s.aB=Ii,s.aC=an,s.aD=O,s.aE=Sn,s.aF=de,s.aG=He,s.aH=function(r,e){const i={};for(let n=0;n<e.length;n++){const a=e[n];a in r&&(i[a]=r[a])}return i},s.aI=ne,s.aJ=ve,s.aK=class{constructor(r){this.entries={}
8,this.scheduler=r}request(r,e,i,n){const a=this.entries[r]=this.entries[r]||{callbacks:[]};if(a.result){const[u,h]=a.result;return this.scheduler?this.scheduler.add(()=>{n(u,h)},e):n(u,h),()=>{}}return a.callbacks.push(n),a.cancel||(a.cancel=i((u,h)=>{a.result=[u,h];for(const f of a.callbacks)this.scheduler?this.scheduler.add(()=>{f(u,h)},e):f(u,h);setTimeout(()=>delete this.entries[r],3e3)})),()=>{a.result||(a.callbacks=a.callbacks.filter(u=>u!==n),a.callbacks.length||(a.cancel(),delete this.entries[r]))}}},s.aL=function(r,e,i){const n=JSON.stringify(r.request);return r.data&&(this.deduped.entries[n]={result:[null,r.data]}),this.deduped.request(n,{type:"parseTile",isSymbolTile:r.isSymbolTile,zoom:r.tileZoom},a=>{const u=dl(r.request,(h,f,_)=>{h?a(h):f&&a(null,{rawData:f,vectorTile:i?void 0:new ri(new Zp(f)),responseHeaders:new Map(_.entries())})});return()=>{u.cancel(),a()}},e)},s.aM=function(r){return r?{cacheControl:r.get("Cache-Control"),expires:r.get("Expires")}:{cacheControl:void 0,expires:void 0}},s.aN=ul,s.aO=function(r){po++,po>ku&&(r.getActor().send("enforceCacheSizeLimit",Yd),po=0)},s.aP=function(r){return r<=1?1:Math.pow(2,Math.floor(Math.log2(r)))},s.aQ=nn,s.aR=Fv,s.aS=Uv,s.aT=Z,s.aU=Lv,s.aV=function(r,e){const i=document.createElement("video");i.muted=!0,i.onloadstart=function(){e(null,i)};for(let n=0;n<r.length;n++){const a=document.createElement("source");bm(r[n])||(i.crossOrigin="Anonymous"),a.src=r[n],i.appendChild(a)}return{cancel:()=>{}}},s.aW=wd,s.aX=sc,s.aY=rt,s.aZ=Pd,s.a_=Me,s.aa=Ge,s.ab=class{constructor(r){this.specification=r}possiblyEvaluate(r,e){return qi(r.expression.evaluate(e))}interpolate(r,e,i){return{x:_t(r.x,e.x,i),y:_t(r.y,e.y,i),z:_t(r.z,e.z,i),azimuthal:_t(r.azimuthal,e.azimuthal,i),polar:_t(r.polar,e.polar,i)}}},s.ac=ui,s.ad=Xs,s.ae=Ke,s.af=Qi,s.ag=gn,s.ah=le,s.ai=Jr,s.aj=Ha,s.ak=_t,s.al=We,s.am=Uu,s.an=$t,s.ao=ii,s.ap=class{constructor(r){this.specification=r}possiblyEvaluate(r,e){return(function([i,n]){const a=qi([1,i,n]);return{x:a.x,y:a.y,z:a.z}})(r.expression.evaluate(e))}interpolate(r,e,i){return{x:_t(r.x,e.x,i),y:_t(r.y,e.y,i),z:_t(r.z,e.z,i)}}},s.aq=function(r,e,i=0,n=!0){const a=new Be(i,i),u=r.sub(a),h=e.add(a),f=[u,new Be(h.x,u.y),h,new Be(u.x,h.y)];return n&&f.push(u.clone()),f},s.ar=function(r,e){const i=[];for(let n=0;n<r.length;n++){const a=xe(n-1,-1,r.length-1),u=xe(n+1,-1,r.length-1),h=r[n],f=r[u],_=r[a].sub(h).unit(),g=f.sub(h).unit(),v=g.angleWithSep(_.x,_.y),b=_.add(g).unit().mult(-1*e/Math.sin(v/2));i.push(h.add(b))}return i},s.as=xv,s.at=So,s.au=function(r,e,i=0){return xi(((e.x-i)*r.scale-r.x)*We,(e.y*r.scale-r.y)*We,pe(e.z,e.y))},s.av=tr,s.aw=mi,s.ax=pi,s.ay=Rx,s.az=function(r){let e=1/0,i=1/0,n=-1/0,a=-1/0;for(const u of r)e=Math.min(e,u.x),i=Math.min(i,u.y),n=Math.max(n,u.x),a=Math.max(a,u.y);return{min:new Be(e,i),max:new Be(n,a)}},s.b=function(r){return cr.API_FONTS_REGEX.test(r)},s.b$=Ay,s.b0=hr,s.b1=Zo,s.b2=Ne,s.b3=np,s.b4=om,s.b5=function(){oo.isLoading()||oo.isLoaded()||Oh()!=="deferred"||kh()},s.b6=Vh,s.b7=Pt,s.b8=oc,s.b9=Mi,s.bA=Ei,s.bB=Qn,s.bC=Hn,s.bD=function(r,e){const{x:i,y:n}=r.point,a=jg(i,n,r.worldSize/r._pixelsPerMercatorPixel,0,0);return Ii(a,a,e_(As(e)))},s.bE=Ui,s.bF=Os,s.bG=cc,s.bH=Mn,s.bI=Fr,s.bJ=Gi,s.bK=vu,s.bL=jn,s.bM=X_,s.bN=function(r,e,i,n,a){const u=5*e+2;r.float32[u+0]=i,r.float32[u+1]=n,r.float32[u+2]=a},s.bO=Su,s.bP=Do,s.bQ=os,s.bR=ns,s.bS=da,s.bT=xe,s.bU=function(r,e,i,n){var a=new wt(4);return a[0]=r,a[1]=e,a[2]=i,a[3]=n,a},s.bV=class{isDataAvailableAtPoint(r){const e=this._source();if(this.isUsingMockSource()||!e||r.y<0||r.y>1)return!1;const i=e.getSource().maxzoom,n=1<<i,a=Math.floor(r.x),u=Math.floor((r.x-a)*n),h=Math.floor(r.y*n),f=this.findDEMTileFor(new nn(i,a,i,u,h));return!(!f||!f.dem)}getAtPointOrZero(r,e=0){return this.getAtPoint(r,e)||0}getAtPoint(r,e,i=!0){if(this.isUsingMockSource())return null;e==null&&(e=null);const n=this._source();if(!n||r.y<0||r.y>1)return e;const a=n.getSource().maxzoom,u=1<<a,h=Math.floor(r.x),f=r.x-h,_=new nn(a,h,a,Math.floor(f*u),Math.floor(r.y*u)),g=this.findDEMTileFor(_);if(!g||!g.dem)return e;const v=g.dem,b=1<<g.tileID.canonical.z,w=(f*b-g.tileID.canonical.x)*v.dim,E=(r.y*b-g.tileID.canonical.y)*v.dim,I=Math.floor(w),P=Math.floor(E);return(i?this.exaggeration():1)*_t(_t(v.get(I,P),v.get(I,P+1),E-P),_t(v.get(I+1,P),v.get(I+1,P+1),E-P),w-I)}static getAtTileOffset(r,e,i,n){const a=1<<r.canonical.z;
vendor: 5,062 bytes, line 8
8return n?n.pointElevation(e):i?i.getAtPointOrZero(new Ke(r.wrap+(r.canonical.x+e.x/We)/a,(r.canonical.y+e.y/We)/a)):0}static getAtTileOffsetFunc(r,e,i,n){return(a,u,h)=>{const f=this.getAtTileOffset(r,a,u,h),_=n.upVector(r.canonical,a.x,a.y);return ki(_,_,f*n.upVectorScale(r.canonical,e,i).metersToTile),_}}getForTilePoints(r,e,i,n){if(this.isUsingMockSource())return!1;const a=Eu.create(this,r,n);return!!a&&(e.forEach(u=>{u[2]=this.exaggeration()*a.getElevationAt(u[0],u[1],i)}),!0)}getMinMaxForTile(r){if(this.isUsingMockSource())return null;const e=this.findDEMTileFor(r);if(!e||!e.dem)return null;const i=e.dem.tree,n=e.tileID,a=1<<r.canonical.z-n.canonical.z;let u=r.canonical.x/a-n.canonical.x,h=r.canonical.y/a-n.canonical.y,f=0;for(let _=0;_<r.canonical.z-n.canonical.z&&!i.leaves[f];_++){u*=2,h*=2;const g=2*Math.floor(h)+Math.floor(u);f=i.childOffsets[f]+g,u%=1,h%=1}return{min:this.exaggeration()*i.minimums[f],max:this.exaggeration()*i.maximums[f]}}getMinElevationBelowMSL(){throw new Error("Pure virtual method called.")}raycast(r,e,i){throw new Error("Pure virtual method called.")}pointCoordinate(r){throw new Error("Pure virtual method called.")}_source(){throw new Error("Pure virtual method called.")}isUsingMockSource(){throw new Error("Pure virtual method called.")}exaggeration(){throw new Error("Pure virtual method called.")}findDEMTileFor(r){throw new Error("Pure virtual method called.")}get visibleDemTiles(){throw new Error("Getter must be implemented in subclass.")}getMinMaxForVisibleTiles(){const r=this.visibleDemTiles;if(r.length===0)return null;let e=!1,i=Number.MAX_VALUE,n=Number.MIN_VALUE;for(const a of r){const u=this.getMinMaxForTile(a.tileID);u&&(i=Math.min(i,u.min),n=Math.max(n,u.max),e=!0)}return e?{min:i,max:n}:null}},s.bW=Op,s.bX=Di,s.bY=br,s.bZ=Ty,s.b_=jv,s.ba=U_,s.bb=g_,s.bc=yt,s.bd=Es,s.be=jl,s.bf=Og,s.bg=Ci,s.bh=cu,s.bi=lg,s.bj=function(r,e){const i=Ha(e.zoom);if(i===0)return As(r);const n=wp(r),a=Qm(n),u=de(n.getWest())*e.worldSize,h=de(n.getEast())*e.worldSize,f=ve(n.getNorth())*e.worldSize,_=ve(n.getSouth())*e.worldSize,g=[u,f,0],v=[h,f,0],b=[u,_,0],w=[h,_,0],E=$r([],e.globeMatrix);return Qi(g,g,E),Qi(v,v,E),Qi(b,b,E),Qi(w,w,E),a[0]=ia(a[0],b,i),a[1]=ia(a[1],w,i),a[2]=ia(a[2],v,i),a[3]=ia(a[3],g,i),ei.fromPoints(a)},s.bk=Sp,s.bl=$r,s.bm=nd,s.bn=ia,s.bo=$o,s.bp=o1,s.bq=uo,s.br=_r,s.bs=_m,s.bt=Zp,s.bu=dl,s.bv=function(r,e){const i=[];for(const n in r)n in e||i.push(n);return i},s.bw=ue,s.bx=["type","source","source-layer","minzoom","maxzoom","filter","layout"],s.by=Oo,s.bz=ni,s.c=Vr,s.c$=function(r,e,i){let n=0;for(let a=0;a<2;++a)r[a]>0&&(n+=(r[a]-0)*(r[a]-0)),e[a]<0&&(n+=(0-e[a])*(0-e[a]));return n},s.c0=My,s.c1=$_,s.c2=uv,s.c3=eg,s.c4=wg,s.c5=ki,s.c6=is,s.c7=Ro,s.c8=function(r,e,i){i*=.5;var n=e[0],a=e[1],u=e[2],h=e[3],f=Math.sin(i),_=Math.cos(i);return r[0]=n*_+a*f,r[1]=a*_-n*f,r[2]=u*_+h*f,r[3]=h*_-u*f,r},s.c9=rs,s.cA=li,s.cB=xr,s.cC=_x,s.cD=Yl,s.cE=Ng,s.cF=function(r,e,i,n,a,u,h,f,_){if(_.name==="globe")return Ng(r,e,new Yl(i,n,a),!1);const g=Pd({z:i,x:n,y:a},_);return new ei([(u+g.x/g.scale)*e,e*(g.y/g.scale),h],[(u+g.x2/g.scale)*e,e*(g.y2/g.scale),f])},s.cG=function(r,e,i){return r[0]=Math.min(e[0],i[0]),r[1]=Math.min(e[1],i[1]),r[2]=Math.min(e[2],i[2]),r[3]=Math.min(e[3],i[3]),r},s.cH=function(r,e,i){return r[0]=Math.max(e[0],i[0]),r[1]=Math.max(e[1],i[1]),r[2]=Math.max(e[2],i[2]),r[3]=Math.max(e[3],i[3]),r},s.cI=function(r){const e=Math.round((r+45+360)%360/90)%4;return k[e]},s.cJ=oe,s.cK=ks,s.cL=6,s.cM=function(r){const e=Ei(new Float64Array(16));Ii(e,r.pixelMatrix,r.globeMatrix);const i=[0,G,0],n=[0,j,0];return Qi(i,i,e),Qi(n,n,e),[i[0]>0&&i[0]<=r.width&&i[1]>0&&i[1]<=r.height&&!i_(r,new Z(r.center.lat,90)),n[0]>0&&n[0]<=r.width&&n[1]>0&&n[1]<=r.height&&!i_(r,new Z(r.center.lat,-90))]},s.cN=function(r,e){const{scale:i}=r.tileTransform,n=i*We/(r.tileSize*Math.pow(2,e.zoom-r.tileID.overscaledZ+r.tileID.canonical.z));return(function(a,u,h){var f=u[1],_=u[2],g=u[3],v=h[0],b=h[1];return a[0]=u[0]*v,a[1]=f*v,a[2]=_*b,a[3]=g*b,a})(new Float32Array(4),e.inverseAdjustmentMatrix,[n,n])},s.cO=Up,s.cP=rl,s.cQ=mx,s.cR=function(r){const e=mx(r,!0);return Ui([],[e[0],e[1],e[4],e[5]])},s.cS=Ji,s.cT=Ni,s.cU=Lr,s.cV=function(r){const{x:e,y:i}=r.point,{lng:n,lat:a}=r._center;return jg(e,i,r.worldSize,n,a)},s.cW=eo,s.cX=he,s.cY=lu,s.cZ=Eo,s.c_=5,s.ca=zi,s.cb=function(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=e[3],r},s.cc=il,s.cd=function(r,e,i,n,a){var u=1/Math.tan(e/2);if(r[0]=u/i,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=u,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,a!=null&&a!==1/0){var h=1/(n-a);r[10]=(a+n)*h,r[14]=2*a*n*h}else r[10]=-1,r[14]=-2*n;return r},s.ce=function(r,e,i,n,a,u,h){var f=1/(e-i),_=1/(n-a),g=1/(u-h);return r[0]=-2*f,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*_,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*g,r[11]=0,r[12]=(e+i)*f,r[13]=(a+n)*_,r[14]=(h+u)*g,r[15]=1,r},s.cf=ge,s.cg=function(r,e,i){r[4*e+0]=i[0],r[4*e+1]=i[1],r[4*e+2]=i[2],r[4*e+3]=i[3]},s.ch=kn,s.ci=Wl,s.cj=ir,s.ck=Bn,s.cl=ja,s.cm=Sv,s.cn=function(){var r=new wt(4);
8return wt!=Float32Array&&(r[1]=0,r[2]=0),r[0]=1,r[3]=1,r},s.co=function(r,e,i){var n=e[0],a=e[1],u=e[2],h=e[3],f=Math.sin(i),_=Math.cos(i);return r[0]=n*_+u*f,r[1]=a*_+h*f,r[2]=n*-f+u*_,r[3]=a*-f+h*_,r},s.cp=function(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]},s.cq=io,s.cr=function(r){var e=r[0],i=r[1],n=r[2],a=r[3];return Math.sqrt(e*e+i*i+n*n+a*a)},s.cs=sl,s.ct=ts,s.cu=Fg,s.cv=3,s.cw=2,s.cx=7,s.cy=6,s.cz=Fs,s.d=function(r){return cr.API_TILEJSON_REGEX.test(r)},s.d$=class{constructor(r,e,i,n){this.context=r,this.format=n,this.size=i,this.texture=r.gl.createTexture();const[a,u,h]=this.size,{gl:f}=r;f.bindTexture(f.TEXTURE_3D,this.texture),r.pixelStoreUnpackFlipY.set(!1),r.pixelStoreUnpack.set(1),r.pixelStoreUnpackPremultiplyAlpha.set(!1),"data"in e&&e.data&&f.texImage3D(f.TEXTURE_3D,0,this.format,a,u,h,0,P_(this.format),R_(this.format),e.data)}bind(r,e){const{context:i}=this,{gl:n}=i;n.bindTexture(n.TEXTURE_3D,this.texture),r!==this.minFilter&&(n.texParameteri(n.TEXTURE_3D,n.TEXTURE_MAG_FILTER,r),n.texParameteri(n.TEXTURE_3D,n.TEXTURE_MIN_FILTER,r),this.minFilter=r),e!==this.wrapS&&(n.texParameteri(n.TEXTURE_3D,n.TEXTURE_WRAP_S,e),n.texParameteri(n.TEXTURE_3D,n.TEXTURE_WRAP_T,e),this.wrapS=e)}destroy(){const{gl:r}=this.context;r.deleteTexture(this.texture),this.texture=null}},s.d0=function(r){return r*r*r*r*r},s.d1=ce,s.d2=45,s.d3=su,s.d4=function(r,e,i){const n=Math.sqrt(r*r+e*e+i*i),a=n>0?Math.acos(i/n)*al:0;let u=r!==0||e!==0?Math.atan2(-e,-r)*al+90:0;return u<0&&(u+=360),[n,u,a]},s.d5=xi,s.d6=qi,s.d7=Ue,s.d8=nr,s.d9=ei,s.dA=function(r){return r({pluginStatus:Kr,pluginURL:Ts}),Fh.on("pluginStateChange",r),r},s.dB=xp,s.dC=class extends so{constructor(r){super(r),this.current=Cg}set(r,e,i){if(this.fetchUniformLocation(r,e)){for(let n=0;n<9;n++)if(i[n]!==this.current[n]){this.current=i,this.gl.uniformMatrix3fv(this.location,!1,i);break}}}},s.dD=U,s.dE=function(r,e,i){const n=Ha(i.zoom),a=r.style.map._antialias,u=r.terrain&&r.terrain.exaggeration()>0;return n===0&&!a&&!u},s.dF=function(r){const e=r.pixelsPerMeter,i=e/ge(1,r.center.lat),n=Ei(new Float64Array(16));return _r(n,n,[r.point.x,r.point.y,0]),Ji(n,n,[i,i,e]),Float32Array.from(n)},s.dG=wp,s.dH=function(r){const e=80.051129;r=Y(r,-80.051129,e)/e*90;const i=Math.pow(Math.abs(Math.sin($t(r))),3);return Math.round(i*(q.length-1))},s.dI=function(r,e,i,n){const a=e.getNorth(),u=e.getSouth(),h=e.getWest(),f=e.getEast(),_=1<<r.z,g=f-h,v=a-u,b=g/N,w=-v/q[i],E=[0,b,0,w,0,0,a,h,0];if(r.z>0){const I=180/n;lr(E,E,[I/g+1,0,0,0,I/v+1,0,-.5*I/b,.5*I/w,1])}return E[2]=_,E[5]=r.x,E[8]=r.y,E},s.dJ=As,s.dK=function(r,e,i){const n=Ei(new Float64Array(16)),a=(e/(1<<r)-.5)*Math.PI*2;return Jn(n,i.globeMatrix,a),Float32Array.from(n)},s.dL=ty,s.dM=bp,s.dN=function(r,e){return[Math.pow(r[0],2.2)*e,Math.pow(r[1],2.2)*e,Math.pow(r[2],2.2)*e]},s.dO=Ht,s.dP=function(r,e){var i=Math.sin(e),n=Math.cos(e);return r[0]=n,r[1]=i,r[2]=0,r[3]=-i,r[4]=n,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r},s.dQ=es,s.dR=Ug,s.dS=ji,s.dT=zr,s.dU=cg,s.dV=function(r,e){const i=[0,0,0];return Qi(i,i,Sp(As(e.canonical))),Qi(i,i,r),i},s.dW=r=>({u_matrix:new ja(r),u_texsize:new Bn(r),u_pixels_to_tile_units:new t(r),u_device_pixel_ratio:new ir(r),u_width_scale:new ir(r),u_floor_width_scale:new ir(r),u_image:new kn(r),u_units_to_pixels:new Bn(r),u_tile_units_to_pixels:new ir(r),u_alpha_discard_threshold:new ir(r),u_trim_offset:new Bn(r),u_trim_fade_range:new Bn(r),u_trim_gradient_mix_range:new Bn(r),u_trim_color:new su(r),u_zbias_factor:new ir(r),u_tile_to_meter:new ir(r),u_ground_shadow_factor:new Wl(r),u_pattern_transition:new ir(r)}),s.dX=r=>({u_matrix:new ja(r),u_pixels_to_tile_units:new t(r),u_device_pixel_ratio:new ir(r),u_width_scale:new ir(r),u_floor_width_scale:new ir(r),u_units_to_pixels:new Bn(r),u_dash_image:new kn(r),u_gradient_image:new kn(r),u_image_height:new ir(r),u_texsize:new Bn(r),u_tile_units_to_pixels:new ir(r),u_alpha_discard_threshold:new ir(r),u_trim_offset:new Bn(r),u_trim_fade_range:new Bn(r),u_trim_gradient_mix_range:new Bn(r),u_trim_color:new su(r),u_zbias_factor:new ir(r),u_tile_to_meter:new ir(r),u_ground_shadow_factor:new Wl(r)}),s.dY=r=>({u_camera_to_center_distance:new ir(r),u_extrude_scale:new t(r),u_device_pixel_ratio:new ir(r),u_matrix:new ja(r),u_inv_rot_matrix:new ja(r),u_merc_center:new Bn(r),u_tile_id:new Wl(r),u_zoom_transition:new ir(r),u_up_dir:new Wl(r),u_emissive_strength:new ir(r)}),s.dZ=tu,s.d_=nw,s.da=ho,s.db=function(r){return[Math.pow(r[0],1/2.2),Math.pow(r[1],1/2.2),Math.pow(r[2],1/2.2)]},s.dc=px,s.dd=B_,s.de=xx,s.df=hg,s.dg=function(r,e){return r.readFields(iT,{icons:[]},e)},s.dh=kp,s.di=bu,s.dj=K_,s.dk=hl,s.dl=$f,s.dm=cl,s.dn=ga,s.dp=At,s.dq=function(r){const e=r.indexOf(Bl);return e>=0?r.slice(0,e):r},s.dr=function(r){return r.indexOf(Bl)>=0},s.ds=function(r){const e=r.lastIndexOf(Bl);return e>=0?r.slice(e+1):""},s.dt=function(r){const e=[],i=r.id;return i===void 0&&e.push({message:`layers.${i}: missing required property "id"`}),r.render===void 0&&e.push({message:`layers.${i}: missing required method "render"`}),r.renderingMode&&r.renderingMode!=="2d"&&r.renderingMode!=="3d"&&e.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),e},s.du=function(r,e,i,n){return r.type==="custom"?new Yw(r,e):new tT[r.type](r,e,i,n)},s.dv=mt,s.dw=function(r){const e=r.indexOf(Bl);return e>=0?r.slice(e+1):""},s.dx=class extends oc{constructor(r,e){super(r._vectorTileFeature,r._z,r._x,r._y,r.id),r.state&&(this.state=Object.assign({},r.state)),this.target=e.target,this.namespace=e.namespace,e.properties&&(this.properties=e.properties),this.target&&("featuresetId"in this.target&&!this.target.importId||"layerId"in this.target)&&(this.source=r.source,this.sourceLayer=r.sourceLayer,this.layer=r.layer)}toJSON(){const r=super.toJSON();return r.target=this.target,r.namespace=this.namespace,r}},s.dy=Fh,s.dz=No,s.e=cr,s.e$=wi,s.e0=Hg,s.e1=(r,e,i,n,a,u)=>{const h=r.transform,f=h.projection.name==="globe";let _;if(u.paint.get("circle-pitch-alignment")==="map")if(f){const v=Ug(h.zoom,e.canonical)*h._pixelsPerMercatorPixel;_=Float32Array.from([v,0,0,v])}else _=h.calculatePixelsToTileUnitsMatrix(i);else _=new Float32Array([h.pixelsToGLUnits[0],0,0,h.pixelsToGLUnits[1]]);const g={u_camera_to_center_distance:r.transform.getCameraToCenterDistance(h.projection),u_matrix:r.translatePosMatrix(e.projMatrix,i,u.paint.get("circle-translate"),u.paint.get("circle-translate-anchor")),u_device_pixel_ratio:Rn.devicePixelRatio,u_extrude_scale:_,u_inv_rot_matrix:u1,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:u.paint.get("circle-emissive-strength")};if(f){g.u_inv_rot_matrix=n,g.u_merc_center=a,g.u_tile_id=[e.canonical.x,e.canonical.y,1<<e.canonical.z],g.u_zoom_transition=Ha(h.zoom);const v=a[0]*We,b=a[1]*We;g.u_up_dir=h.projection.upVector(new Yl(0,0,0),v,b)}return g},s.e2=Fx,s.e3=dn,s.e4=(r,e,i,n,a,u,h,f,_,g)=>{const v=r.transform,b=v.pitch<15?zx(.07,.7,Y((14-v.zoom)/5,0,1)):.07,w=i.paint.get("line-trim-color-use-theme").
vendor: 9,083 bytes, line 8
8constantOr("default")==="none";return{u_matrix:Lx(r,e,i,n),u_texsize:e.imageAtlasTexture?e.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:v.calculatePixelsToTileUnitsMatrix(e),u_device_pixel_ratio:a,u_width_scale:u,u_floor_width_scale:h,u_image:0,u_tile_units_to_pixels:Dx(e,v),u_units_to_pixels:[1/v.pixelsToGLUnits[0],1/v.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:f,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_gradient_mix_range:[1,1],u_trim_color:i.paint.get("line-trim-color").toPremultipliedRenderColor(w?null:i.lut).toArray01(),u_zbias_factor:b,u_tile_to_meter:Ue(e.tileID.canonical,0),u_ground_shadow_factor:_,u_pattern_transition:g}},s.e5=(r,e,i,n,a,u,h,f,_,g)=>{const v=r.transform,b=v.calculatePixelsToTileUnitsMatrix(e),w=i.paint.get("line-trim-color-use-theme").constantOr("default")==="none",E=v.pitch<15?zx(.07,.7,Y((14-v.zoom)/5,0,1)):.07;return{u_matrix:Lx(r,e,i,n),u_pixels_to_tile_units:b,u_device_pixel_ratio:u,u_width_scale:h,u_floor_width_scale:f,u_units_to_pixels:[1/v.pixelsToGLUnits[0],1/v.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:a,u_texsize:Ox(i)&&e.lineAtlasTexture?e.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:Dx(e,r.transform),u_alpha_discard_threshold:0,u_trim_offset:_,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_gradient_mix_range:[1,1],u_trim_color:i.paint.get("line-trim-color").toPremultipliedRenderColor(w?null:i.lut).toArray01(),u_zbias_factor:E,u_tile_to_meter:Ue(e.tileID.canonical,0),u_ground_shadow_factor:g}},s.e6=Oe,s.e7=od,s.e8=pe,s.e9=r1,s.eA=function(r,e){var i=2*Math.acos(e[3]),n=Math.sin(i/2);return n>zt?(r[0]=e[0]/n,r[1]=e[1]/n,r[2]=e[2]/n):(r[0]=1,r[1]=0,r[2]=0),i},s.eB=pg,s.eC=qp,s.eD=Gp,s.eE=[1,1,1],s.eF=Eu,s.eG=ca,s.eH=function(r,e,i,n){var a=e[0],u=e[1],h=e[2],f=e[3];return r[0]=a+n*(i[0]-a),r[1]=u+n*(i[1]-u),r[2]=h+n*(i[2]-h),r[3]=f+n*(i[3]-f),r},s.eI=gu,s.eJ=On,s.eK=ea,s.eL=function(r,e,i,n,a,u,h,f,_,g,v,b,w,E,I,P){var D=new wt(16);return D[0]=r,D[1]=e,D[2]=i,D[3]=n,D[4]=a,D[5]=u,D[6]=h,D[7]=f,D[8]=_,D[9]=g,D[10]=v,D[11]=b,D[12]=w,D[13]=E,D[14]=I,D[15]=P,D},s.eM=te,s.eN=Ul,s.eO=Jh,s.eP=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new Be(1/0,1/0),max:new Be(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(r,e=!1){const i=Ey(new Be(0,0),new Be(We,We),r),n=[];if(e&&!y_(i,this._globalClipBounds))return n;for(const a of this._activeRegions){if(a.hiddenByOverlap||!y_(i,a))continue;const u=$1(a.min,a.max,r);n.push({min:u.min,max:u.max,sourceId:this._sourceIds[a.priority],footprint:a.footprint,footprintTileId:a.tileId,order:a.order,clipMask:a.clipMask,clipScope:a.clipScope})}return n}setSources(r){this._setSources(r.map(e=>({getSourceId:()=>e.cache.id,getFootprints:()=>{const i=[];for(const n of e.cache.getVisibleCoordinates()){const a=e.cache.getTile(n).buckets[e.layer];a&&a.updateFootprints(n.toUnwrapped(),i)}return i},getOrder:()=>e.order,getClipMask:()=>e.clipMask,getClipScope:()=>e.clipScope})))}_addSource(r){const e=r.getFootprints();if(e.length===0)return;const i=r.getOrder(),n=r.getClipMask(),a=r.getClipScope();for(const u of e){if(!u.footprint)continue;const h=Ey(u.footprint.min,u.footprint.max,u.id);this._activeRegions.push({min:h.min,max:h.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:u.id,footprint:u.footprint,order:i,clipMask:n,clipScope:a})}this._sourceIds.push(r.getSourceId())}_computeReplacement(){this._activeRegions.sort((e,i)=>e.priority-i.priority||zp(e.min,i.min)||zp(e.max,i.max)||e.order-i.order||e.clipMask-i.clipMask||(function(n,a){const u=(h,f)=>h+f;return n.length-a.length||n.reduce(u,"").localeCompare(a.reduce(u,""))})(e.clipScope,i.clipScope));let r=this._activeRegions.length!==this._prevRegions.length;if(!r){let e=0;for(;!r&&e!==this._activeRegions.length;){const i=this._activeRegions[e],n=this._prevRegions[e];r=i.priority!==n.priority||!Sy(i,n)||i.order!==n.order||i.clipMask!==n.clipMask||!Oo(i.clipScope,n.clipScope),this._activeRegions[e].hiddenByOverlap=n.hiddenByOverlap,++e}}if(r){++this._updateTime;for(const i of this._activeRegions)i.order!==fd&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,i.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,i.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,i.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,i.max.y));const e=i=>{const n=this._activeRegions;if(i>=n.length)return i;const a=n[i].priority;for(;i<n.length&&n[i].priority===a;)++i;return i};if(this._sourceIds.length>1){let i=0,n=e(i);for(;i!==n;){let a=i;const u=i;for(;a!==n;){const h=this._activeRegions[a];h.hiddenByOverlap=!1;for(let f=0;f<u;f++){const _=this._activeRegions[f];if(!_.hiddenByOverlap&&h.order===fd&&y_(h,_)&&(h.hiddenByOverlap=Iy(h.footprint,h.tileId,_.footprint,_.tileId),h.hiddenByOverlap))break}++a}i=n,n=e(i)}}}}_setSources(r){[this._prevRegions,this._activeRegions]=[this._activeRegions,[]],this._sourceIds=[];for(let e=r.length-1;e>=0;e--)this._addSource(r[e]);this._computeReplacement()}},s.eQ=fd,s.eR=class{constructor(r){this._createGrid(r),this._createPoles(r)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const r of this._poleSegments)r.destroy();for(const r of this._gridSegments)r.withSkirts.destroy(),r.withoutSkirts.destroy()}_fillGridMeshWithLods(r,e){const i=new Es,n=new hr,a=[],u=r+1+2,h=e[0]+1,f=e[0]+1+(1+e.length),_=(g,v,b)=>{let w=g===u-1?g-2:g===0?g:g-1;return w+=b?24575:0,[w,v]};for(let g=0;g<u;++g)i.emplaceBack(..._(g,0,!0));for(let g=0;g<h;++g)for(let v=0;v<u;++v)i.emplaceBack(..._(v,g,(v===0||v===u-1)&&!0));for(let g=0;g<e.length;++g){const v=e[g];for(let b=0;b<u;++b)i.emplaceBack(..._(b,v,!0))}for(let g=0;g<e.length;++g){const v=n.length,b=e[g]+1+2,w=new hr;for(let P=0;P<b-1;P++){const D=P===b-2,R=D?u*(f-e.length+g-P):u;for(let F=0;F<u-1;F++){const B=P*u+F;P===0||D||F===0||F===u-2?(w.emplaceBack(B+1,B,B+R),w.emplaceBack(B+R,B+R+1,B+1)):(n.emplaceBack(B+1,B,B+R),n.emplaceBack(B+R,B+R+1,B+1))}}const E=Ci.simpleSegment(0,v,i.length,n.length-v);for(let P=0;P<w.uint16.length;P+=3)n.emplaceBack(w.uint16[P],w.uint16[P+1],w.uint16[P+2]);const I=Ci.simpleSegment(0,v,i.length,n.length-v);a.push({withoutSkirts:E,withSkirts:I})}return{vertices:i,indices:n,segments:a}}_createGrid(r){const e=this._fillGridMeshWithLods(N,q);this._gridSegments=e.segments,this._gridBuffer=r.createVertexBuffer(e.vertices,Og.members),this._gridIndexBuffer=r.createIndexBuffer(e.indices,!0)}_createPoles(r){const e=new hr;for(let h=0;h<=N;h++)e.emplaceBack(0,h+1,h+2);this._poleIndexBuffer=r.createIndexBuffer(e,!0);const i=new Qs,n=new Qs,a=new Qs,u=new Qs;this._poleSegments=[];for(let h=0,f=0;h<5;h++){const _=360/(1<<h);i.emplaceBack(0,-O,0,.5,0),n.emplaceBack(0,-O,0,.5,1),a.emplaceBack(0,-O,0,.5,.5),u.emplaceBack(0,-O,0,.5,.5);for(let g=0;g<=N;g++){let v=g/N,b=0;const w=_t(0,_,v),[E,I,P]=ie(l1,c1,w,O);i.emplaceBack(E,I,P,v,b),n.emplaceBack(E,I,P,v,1-b);const D=$t(w);v=.5+.5*Math.sin(D),b=.5+.5*Math.cos(D),a.emplaceBack(E,I,P,v,b),u.emplaceBack(E,I,P,v,1-b)}this._poleSegments.push(Ci.simpleSegment(f,0,66,64)),f+=66}this._poleNorthVertexBuffer=r.createVertexBuffer(i,vp,!1),this._poleSouthVertexBuffer=r.createVertexBuffer(n,vp,!1),this._texturedPoleNorthVertexBuffer=r.createVertexBuffer(a,vp,!1),this._texturedPoleSouthVertexBuffer=r.createVertexBuffer(u,vp,!1)}getGridBuffers(r,e){return[this._gridBuffer,this._gridIndexBuffer,e?this._gridSegments[r].withSkirts:this._gridSegments[r].withoutSkirts]}getPoleBuffers(r,e){return[e?this._texturedPoleNorthVertexBuffer:this._poleNorthVertexBuffer,e?this._texturedPoleSouthVertexBuffer:this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[r]]}},s.eS=H1,s.eT=W,s.eU=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},s.eV=ae,s.eW=ke,s.eX=function(r,e,i){return r[0]=e[0]/i[0],r[1]=e[1]/i[1],r[2]=e[2]/i[2],r},s.eY=la,s.eZ=Q,s.e_=uc,s.ea=Fp,s.eb=Vy,s.ec=na,s.ed=450,s.ee=7,s.ef=be,s.eg=function(r,e){if(r===e){var i=e[1],n=e[2],a=e[3],u=e[6],h=e[7],f=e[11];r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=i,r[6]=e[9],r[7]=e[13],r[8]=n,r[9]=u,r[11]=e[14],r[12]=a,r[13]=h,r[14]=f}else r[0]=e[0],r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=e[1],r[5]=e[5],r[6]=e[9],r[7]=e[13],r[8]=e[2],r[9]=e[6],r[10]=e[10],r[11]=e[14],r[12]=e[3],r[13]=e[7],r[14]=e[11],r[15]=e[15];return r},s.eh=Xw,s.ei=Nt,s.ej=td,s.ek=256,s.el=e_,s.em=Yn,s.en=Jn,s.eo=function(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[4],r[4]=e[5],r[5]=e[6],r[6]=e[8],r[7]=e[9],r[8]=e[10],r},s.ep=Qs,s.eq=Ef,s.er=nu,s.es=function(r,e,i,n,a){return Y((r-e)/(i-e)*(a-n)+n,n,a)},s.et=Bs,s.eu=function(r,e){var i=e[0],n=e[1],a=e[2],u=e[3],h=e[4],f=e[5],_=e[6],g=e[7],v=e[8],b=v*h-f*g,w=-v*u+f*_,E=g*u-h*_,I=i*b+n*w+a*E;
8return I?(r[0]=b*(I=1/I),r[1]=(-v*n+a*g)*I,r[2]=(f*n-a*h)*I,r[3]=w*I,r[4]=(v*i-a*_)*I,r[5]=(-f*i+a*u)*I,r[6]=E*I,r[7]=(-g*i+n*_)*I,r[8]=(h*i-n*u)*I,r):null},s.ev=2,s.ew=Qo,s.ex=Po,s.ey=tl,s.ez=function(r,e){var i=new wt(3);tl(i,e);var n=1/i[0],a=1/i[1],u=1/i[2],h=e[0]*n,f=e[1]*a,_=e[2]*u,g=e[4]*n,v=e[5]*a,b=e[6]*u,w=e[8]*n,E=e[9]*a,I=e[10]*u,P=h+v+I,D=0;return P>0?(D=2*Math.sqrt(P+1),r[3]=.25*D,r[0]=(b-E)/D,r[1]=(w-_)/D,r[2]=(f-g)/D):h>v&&h>I?(D=2*Math.sqrt(1+h-v-I),r[3]=(b-E)/D,r[0]=.25*D,r[1]=(f+g)/D,r[2]=(w+_)/D):v>I?(D=2*Math.sqrt(1+v-h-I),r[3]=(w-_)/D,r[0]=(f+g)/D,r[1]=.25*D,r[2]=(b+E)/D):(D=2*Math.sqrt(1+I-h-v),r[3]=(f-g)/D,r[0]=(w+_)/D,r[1]=(b+E)/D,r[2]=.25*D),r},s.f=function(r){return btoa(encodeURIComponent(r).replace(/%([0-9A-F]{2})/g,(e,i)=>String.fromCharCode(+("0x"+i))))},s.f0=function([r,e,i]){const n=Math.hypot(r,e,i),a=Math.atan2(r,i),u=.5*Math.PI-Math.acos(-e/n);return new Z(he(a),he(u))},s.f1=ol,s.f2=D_,s.f3=function(r){const e=r.navigator?r.navigator.userAgent:null;return!!(function(i){if(Gt==null){const n=i.navigator?i.navigator.userAgent:null;Gt=!!i.safari||!(!n||!(/\b(iPad|iPhone|iPod)\b/.test(n)||n.match("Safari")&&!n.match("Chrome")))}return Gt})(r)&&!(!e||!(e.match("Version/15.4")||e.match("Version/15.5")||e.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/)))},s.f4=function(r,e){Yd=r,ku=e},s.f5=i_,s.f6=Gg,s.f7=function(r){const e=[0,0,0],i=Ei(new Float64Array(16));return Ii(i,r.pixelMatrix,r.globeMatrix),Qi(e,e,i),new Be(e[0],e[1])},s.f8=function(){const r=xd;r&&(r.isPreloaded()&&r.numActive()===1?(r.release(S_),xd=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()"))},s.f9=function(){kp().acquire(S_)},s.fA=mm,s.fB=Vt,s.fC=function(r){let e=0;if(new Uint32Array(r,0,1)[0]!==cx){const i=new Uint32Array(r,0,7),[,,n,a,u,h]=i;e=i.byteLength+a+u+h+u,(n!==r.byteLength||e>=r.byteLength)&&xt("Invalid b3dm header information.")}return fx(r,e)},s.fD=function(r,e){const i=B_(r);for(const n of i){for(const a of n.meshes)Ib(a);n.lights&&(n.lightMeshIndex=n.meshes.length,n.meshes.push(Ab(n.lights,e)))}return i},s.fE=um,s.fF=Hi,s.fG=Jy,s.fH=oo,s.fI=pn,s.fJ=function(r){Dn(),Er?.then(e=>{e.keys().then(i=>{for(let n=0;n<i.length-r;n++)e.delete(i[n]).catch(a=>xt(a.message))}).catch(i=>xt(i.message))}).catch(e=>xt(e.message))},s.fa=Oh,s.fb=function(r,e,i=!1){if(Kr===pn.deferred||Kr===pn.loading||Kr===pn.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");Ts=Rn.resolveURL(r),Kr=pn.deferred,ws=e,Lh(),i||kh()},s.fc=function(r){pu=Rn.resolveURL(r),mu||(mu=new fu(kp(),new Uo)),mu.broadcast("setMeshoptUrl",pu)},s.fd=tx,s.fe=function(r){A_=Rn.resolveURL(r),mu||(mu=new fu(kp(),new Uo)),mu.broadcast("setDracoUrl",A_)},s.ff=ex,s.fg=yd,s.fh=function(r){const e=Bo();if(!e)return;const i=e.delete(Xd);r&&i.then(()=>r()).catch(r)},s.fi=Ql,s.fj=nt,s.fk=$a,s.fl=2,s.fm=M0,s.fn=C0,s.fo=Mx,s.fp=Ut,s.fq="hd_road_elevation",s.fr=tn,s.fs=ft,s.ft=ra,s.fu=Y_,s.fv=1,s.fw=function(r,e,i,n,a,u,h,f=1,_,g,v,b){r.createArrays(),r.tilePixelRatio=We/(512*r.overscaling),r.compareText={},r.iconsNeedLinear=!1;const w=r.layers[0].layout,E=r.layers[0]._unevaluatedLayout._values,I={};I.scaleFactor=f,I.textSizeScaleRange=w.get("text-size-scale-range"),I.iconSizeScaleRange=w.get("icon-size-scale-range");const[P,D]=I.textSizeScaleRange,[R,F]=I.iconSizeScaleRange;I.textScaleFactor=Y(I.scaleFactor,P,D),I.iconScaleFactor=Y(I.scaleFactor,R,F);const B=E["text-size"],V=E["icon-size"];if(r.textSizeData.kind==="composite"){const{minZoom:re,maxZoom:se}=r.textSizeData;I.compositeTextSizes=[B.possiblyEvaluate(new ui(re,{worldview:v}),u),B.possiblyEvaluate(new ui(se,{worldview:v}),u)]}if(r.iconSizeData.kind==="composite"){const{minZoom:re,maxZoom:se}=r.iconSizeData;I.compositeIconSizes=[V.possiblyEvaluate(new ui(re,{worldview:v}),u,b),V.possiblyEvaluate(new ui(se,{worldview:v}),u,b)]}I.layoutTextSize=B.possiblyEvaluate(new ui(h+1,{worldview:v}),u),I.layoutIconSize=V.possiblyEvaluate(new ui(h+1,{worldview:v}),u,b),I.textMaxSize=B.possiblyEvaluate(new ui(18,{worldview:v}),u);const $=w.get("symbol-placement"),H=w.get("text-rotation-alignment")==="map"&&$!=="point",J=w.get("text-size");let ee=!1;const K=[];for(const re of r.features){const se=w.get("text-font").evaluate(re,{},u).join(","),Ee=J.evaluate(re,{},u)*I.textScaleFactor,we=I.layoutTextSize.evaluate(re,{},u)*I.textScaleFactor,Se=I.layoutIconSize.evaluate(re,{},u,b)*I.iconScaleFactor,Re={horizontal:{},vertical:void 0},Ce=re.text;let Pe,ye=[0,0];if(Ce){const qt=Ce.toString(),Zi=w.get("text-letter-spacing").evaluate(re,{},u)*br,Wt=w.get("text-line-height").evaluate(re,{},u)*br,ai=Gm(qt)?Zi:0,Si=w.get("text-anchor").evaluate(re,{},u),Li=w.get("text-variable-anchor");if(!Li){const sr=w.get("text-radial-offset").evaluate(re,{},u);if(sr)ye=uv(Si,[sr*br,Q_]);else{const fr=w.get("text-offset").evaluate(re,{},u);ye=[fr[0]*br,fr[1]*br]}}
8let Fi=H?"center":w.get("text-justify").evaluate(re,{},u);const Wi=$==="point",Ar=Wi?w.get("text-max-width").evaluate(re,{},u)*br:1/0,Nr=sr=>{r.allowVerticalPlacement&&zh(qt)&&(Re.vertical=H_(Ce,e,i,a,se,Ar,Wt,Si,sr,ai,ye,jn.vertical,!0,we,Ee,_))};if(!H&&Li){const sr=Fi==="auto"?Li.map(yr=>eg(yr)):[Fi];let fr=!1;for(let yr=0;yr<sr.length;yr++){const Rt=sr[yr];if(!Re.horizontal[Rt])if(fr)Re.horizontal[Rt]=Re.horizontal[0];else{const Oi=H_(Ce,e,i,a,se,Ar,Wt,"center",Rt,ai,ye,jn.horizontal,!1,we,Ee,_);Oi&&(Re.horizontal[Rt]=Oi,fr=Oi.positionedLines.length===1)}}Nr("left")}else{if(Fi==="auto"&&(Fi=eg(Si)),Wi||w.get("text-writing-mode").indexOf("horizontal")>=0||!zh(qt)){const sr=H_(Ce,e,i,a,se,Ar,Wt,Si,Fi,ai,ye,jn.horizontal,!1,we,Ee,_);sr&&(Re.horizontal[Fi]=sr)}Nr(Wi?"left":Fi)}}let De,Ae,Le,ze,tt,it,Ze=!1;const Xe=w.get("icon-text-fit").evaluate(re,{},u);if(re.icon&&re.icon.hasPrimary()){const qt=Cd(re.icon,r.iconSizeData,E["icon-size"],u,r.zoom,re,_,I.iconScaleFactor,v,b);De=qt.iconPrimary,Le=qt.iconSecondary;const Zi=De.toString();if(Ae=n.get(Zi),Ae&&(tt=w.get("icon-offset").evaluate(re,{},u),it=w.get("icon-anchor").evaluate(re,{},u),Pe=Xp(a.get(Zi),Le?a.get(Le.toString()):void 0,tt,it),Ze=Ae.sdf,r.sdfIcons===void 0?r.sdfIcons=Ae.sdf:r.sdfIcons!==Ae.sdf&&xt("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(Ae.pixelRatio!==r.pixelRatio||w.get("icon-rotate").constantOr(1)!==0)&&(r.iconsNeedLinear=!0)),Le){const Wt=Le.toString();ze=n.get(Wt)}}ee=ee||!(!re.icon||!re.icon.hasSecondary());const pt=em(Re.horizontal)||Re.vertical;r.iconsInText||(r.iconsInText=!!pt&&pt.iconsInText);const ct=we*I.textScaleFactor/br,{defaultShapedIcon:Qe,verticallyShapedIcon:bt}=Fw(r,Pe,w,re,u,Re,ct,tt,Xe);Xe!=="none"&&Pe&&(Wx(Pe)||Xx(Pe))&&(Qp(0,Ae,De,Pe,Qe,Xe,g,n,a),Qp(0,ze,Le,Pe,Qe,Xe,g,n,a),bt&&(Qp(0,Ae,De,Pe,bt,Xe,g,n,a),Qp(0,ze,Le,Pe,bt,Xe,g,n,a))),Pe=Qe;const{iconBBox:Ot,iconVerticalBBox:Kt,textBBox:Lt,textVerticalBBox:hi}=Pw(r,Pe,bt,w,re,u,Se,tt,I,a,it,Re,we,ye,b);K.push({feature:re,shapedTextOrientations:Re,shapedText:pt,shapedIcon:Pe,iconPrimary:De,iconSecondary:Le,iconOffset:tt,iconAnchor:it,verticallyShapedIcon:bt,layoutTextSize:we,layoutIconSize:Se,textOffset:ye,isSDFIcon:Ze,iconTextFit:Xe,iconCollisionBounds:Ot,iconVerticalCollisionBounds:Kt,textCollisionBounds:Lt,textVerticalCollisionBounds:hi})}return{featureData:K,sizes:I,hasAnySecondaryIcon:ee,textAlongLine:H,symbolPlacement:$}},s.fx=rv,s.fy=function(r,e,i,n,a,u,h,f,_,g){r.iconAtlasPositions=g.iconPositions;const{featureData:v,hasAnySecondaryIcon:b,sizes:w,textAlongLine:E,symbolPlacement:I}=e;for(const P of v){const{shapedIcon:D,verticallyShapedIcon:R,feature:F,shapedTextOrientations:B,shapedText:V,layoutTextSize:$,textOffset:H,isSDFIcon:J,iconPrimary:ee,iconSecondary:K,iconTextFit:re,iconOffset:se,iconCollisionBounds:Ee,iconVerticalCollisionBounds:we,textCollisionBounds:Se}=P;pv(D,g.iconPositions,ee,K),pv(R,g.iconPositions,ee,K),Lw(B,g.iconPositions),Dw(ee,K,g.iconPositions),(V||D)&&Ow(r,F,B,D,R,_,w,$,0,H,J,n,a,h,f,b,re,se,E,I,Ee,we,Se)}i&&r.generateCollisionDebugBuffers(u,r.collisionBoxArray,w.textScaleFactor)},s.fz=ri,s.g=function(r,e){return No(Object.assign(r,{method:"GET"}),e)},s.h=function(r){return r.indexOf("mapbox:")===0},s.i=function(r){return cr.API_STYLE_REGEX.test(r)&&!Vr(r)},s.j=as,s.k=pa,s.l=function(r){return decodeURIComponent(atob(r).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""))},s.m=function(r,e){return No(Object.assign(r,{type:"json"}),e)},s.n=fc,s.o=Rn,s.p=function(r,e){return No(Object.assign(r,{method:"POST"}),e)},s.q=Br,s.r=Ns,s.s=function(r){try{const e=self[r];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch{return!1}},s.t=function(){return E_||(E_=new Ql("ImageRasterizer")),E_},s.u=function(){return(function r(e){return e?(e^Math.random()*(16>>e/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,r)})()},s.v=function(r){return!!r&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(r)},s.w=xt,s.x=yg,s.y=ml,s.z=Vo}),Ye(["./shared"],function(s){function zt(he){const k=he?he.url.toString():void 0;return k?performance.getEntriesByName(k):[]}function wt(he){if(typeof he=="number"||typeof he=="boolean"||typeof he=="string"||he==null)return JSON.stringify(he);
vendor: 5,125 bytes, line 8
8if(Array.isArray(he)){let U="[";for(const W of he)U+=`${wt(W)},`;return`${U}]`}let k="{";for(const U of Object.keys(he).sort())k+=`${U}:${wt(he[U])},`;return`${k}}`}function Ui(he){let k="";for(const U of s.bx)k+=`/${wt(he[U])}`;return k}function Ht(he,k){return(function U(W){return typeof W=="string"&&W===k||(Array.isArray(W)?W.some(U):!(!W||typeof W!="object")&&Object.values(W).some(U))})(he)}class Yi{constructor(k){this.keyCache={},this._layers={},this._layerConfigs={},k&&this.replace(k)}replace(k,U){this._layerConfigs={},this._layers={},this.update(k,[],U)}update(k,U,W){this._options=W;for(const Y of k)this._layerConfigs[Y.id]=Y,(this._layers[Y.id]=s.du(Y,this.scope,null,this._options)).compileFilter(W),this.keyCache[Y.id]&&delete this.keyCache[Y.id];for(const Y of U)delete this.keyCache[Y],delete this._layerConfigs[Y],delete this._layers[Y];this.familiesBySource={};const ae=(function(Y,le){const xe={};for(let Te=0;Te<Y.length;Te++){const Ne=Y[Te];let Oe=le&&le[Ne.id];Oe||(Ne.type==="symbol"?Oe=Ne.id:(Oe=Ui(Ne),Ne.type==="line"&&Ne.paint&&Ht(Ne.paint["line-width"],"line-progress")&&(Oe+=`/${wt(Ne.paint["line-width"])}`))),le&&(le[Ne.id]=Oe);let rt=xe[Oe];rt||(rt=xe[Oe]=[]),rt.push(Ne)}const ue=[];for(const Te in xe)ue.push(xe[Te]);return ue})(Object.values(this._layerConfigs),this.keyCache);for(const Y of ae){const le=Y.map(rt=>this._layers[rt.id]),xe=le[0];if(xe.visibility==="none")continue;const ue=xe.source||"";let Te=this.familiesBySource[ue];Te||(Te=this.familiesBySource[ue]={});const Ne=xe.sourceLayer||"_geojsonTileLayer";let Oe=Te[Ne];Oe||(Oe=Te[Ne]=[]),Oe.push(le)}}}const lr=1*s.fl;class Hn{constructor(k){const U={},W=[];for(const xe in k){const ue=k[xe],Te=U[xe]={};for(const Ne in ue.glyphs){const Oe=ue.glyphs[+Ne];if(!Oe||Oe.bitmap.width===0||Oe.bitmap.height===0)continue;const rt=Oe.metrics.localGlyph?lr:1,ft={x:0,y:0,w:Oe.bitmap.width+2*rt,h:Oe.bitmap.height+2*rt};W.push(ft),Te[Ne]=ft}}const{w:ae,h:Y}=s.G(W),le=new s.fk({width:ae||1,height:Y||1});for(const xe in k){const ue=k[xe];for(const Te in ue.glyphs){const Ne=ue.glyphs[+Te];if(!Ne||Ne.bitmap.width===0||Ne.bitmap.height===0)continue;const Oe=U[xe][Te],rt=Ne.metrics.localGlyph?lr:1;s.fk.copy(Ne.bitmap,le,{x:0,y:0},{x:Oe.x+rt,y:Oe.y+rt},Ne.bitmap)}}this.image=le,this.positions=U}}function ni(he,k,U){he[k]?U&&(he[k].center=U):he[k]={floorIds:new Set,center:U||[0,0],floors:{}}}function Ei(he,k,U,W){for(const ae of k)ni(he,ae),he[ae].floors[U]=W,he[ae].floorIds.add(U)}function $r(he){return{id:he.properties.id.toString(),center:he.properties.center.toString().split(";").map(Number)}}function Ii(he){return{id:he.properties.id.toString(),isDefault:!!he.properties.is_default&&he.properties.is_default,connections:he.properties.connected_floor_ids?new Set(he.properties.connected_floor_ids.toString().split(";")):new Set,conflicts:he.properties.conflicted_floor_ids?new Set(he.properties.conflicted_floor_ids.toString().split(";")):new Set,buildings:he.properties.building_ids?new Set(he.properties.building_ids.toString().split(";")):new Set,name:he.properties.name.toString(),zIndex:he.properties.z_index}}function _r(he,k){return k.every(U=>he.properties&&he.properties[U]!=null)}function Ji(he){return _r(he,["type","id","name"])&&he.properties.type==="building"}function Lr(he){return _r(he,["type","id","name","z_index"])&&he.properties.type==="floor"}s.fj(Hn,"GlyphAtlas");class Jn{constructor(k){this.tileID=new s.aQ(k.tileID.overscaledZ,k.tileID.wrap,k.tileID.canonical.z,k.tileID.canonical.x,k.tileID.canonical.y),this.tileZoom=k.tileZoom,this.uid=k.uid,this.zoom=k.zoom,this.lut=k.lut,this.canonical=k.tileID.canonical,this.pixelRatio=k.pixelRatio,this.tileSize=k.tileSize,this.source=k.source,this.scope=k.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=k.showCollisionBoxes,this.collectResourceTiming=!!k.request&&k.request.collectResourceTiming,this.promoteId=k.promoteId,this.isSymbolTile=k.isSymbolTile,this.tileTransform=s.aZ(k.tileID.canonical,k.projection),this.projection=k.projection,this.worldview=k.worldview,this.localizableLayerIds=k.localizableLayerIds,this.brightness=k.brightness,this.extraShadowCaster=!!k.extraShadowCaster,this.tessellationStep=k.tessellationStep,this.scaleFactor=k.scaleFactor,this.worldview=k.worldview,this.indoor=k.indoor}parse(k,U,W,ae,Y,le){this.status="parsing",this.data=k,this.collisionBoxArray=new s.b3;const xe=new s.fm(Object.keys(k.layers).sort()),ue=new s.fn(this.tileID,this.promoteId);ue.bucketLayerIDs=[];const Te={},Ne=new s.fo(256,256),Oe={featureIndex:ue,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:Ne,availableImages:W,brightness:this.brightness,scaleFactor:this.scaleFactor,elevationFeatures:void 0,activeFloors:void 0};if(this.indoor){const At=this.indoor.indoorState.activeFloorsVisible,Dt=(function(Tt,xt,_i){const or=(function(Mi,Gt){if(!Mi)return s.w("No source layers defined in indoor specification"),Gt;if(Mi.size===0)return Gt;const zi=Mi.difference(Gt);for(const di of zi)s.w(`Missing source layer required in indoor specification: ${di}`);return Gt.intersection(Gt)}
8)(xt.sourceLayers,new Set(Object.keys(Tt.layers))),qi=xt.indoorState,Hi=(function(Mi,Gt,zi,di){const fi=new Set,ji=new Set,zr=new Set,Sr=new Map,cr={},as=Vr=>{const xn=Sr.get(Vr)||new Set;for(const $n of fi)if((Sr.get($n)||new Set).has(Vr)||xn.has($n))return!0;return!1};for(const Vr of Gt){const xn=Mi.layers[Vr];if(xn)for(let $n=0;$n<xn.length;$n++){const ro=xn.feature($n);if(Ji(ro)){const{id:vn,center:Wr}=$r(ro);ni(cr,vn,Wr),fi.add(vn);continue}if(Lr(ro)){const{id:vn,isDefault:Wr,connections:ko,conflicts:Ns,buildings:Rn,name:ll,zIndex:cl}=Ii(ro);Ei(cr,Rn,vn,{name:ll,zIndex:cl}),Sr.set(vn,Ns),(vn===di||ko.has(di))&&fi.add(vn),ji.add(vn),Wr&&zr.add(vn)}}else s.w(`indoor source layer not found: ${Vr}`)}if(zi)for(const Vr of zi)ji.has(Vr)&&(as(Vr)||fi.add(Vr));for(const Vr of zr)fi.has(Vr)||as(Vr)||fi.add(Vr);return{buildings:cr,activeFloors:fi}})(Tt,or,qi.lastActiveFloors,qi.selectedFloorId);return _i.send("setIndoorData",Hi),Hi})(k,this.indoor,Y);Oe.activeFloors=At?Dt.activeFloors:void 0}const rt=[],ft=U.familiesBySource[this.source];for(const At in ft){const Dt=k.layers[At];if(!Dt)continue;let Tt=!1,xt=!1,_i=!1;for(const Gt of ft[At])Gt[0].type==="symbol"?Tt=!0:xt=!0,Gt[0].is3D()&&Gt[0].type!=="model"&&(_i=!0);if(this.extraShadowCaster&&!_i||this.isSymbolTile===!0&&!Tt||this.isSymbolTile===!1&&!xt)continue;Dt.version===1&&s.w(`Vector tile source "${this.source}" layer "${At}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const or=xe.encode(At),qi=[],Hi=this.localizableLayerIds&&this.localizableLayerIds.has(At);let Mi=!1;for(let Gt=0,zi=0;Gt<Dt.length;Gt++){const di=Dt.feature(Gt),fi=ue.getId(di,At),ji=di.properties?di.properties.worldview:null;if(Hi&&this.worldview&&typeof ji=="string")if(ji==="all")di.properties.$localized=!0;else{if(!ji.split(",").includes(this.worldview))continue;di.properties.$localized=!0,di.properties.worldview=this.worldview}!Mi&&di.properties&&di.properties.hasOwnProperty(s.fp)&&(Mi=!0),qi.push({feature:di,id:fi,index:zi,sourceLayerIndex:or}),zi++}Mi&&!Oe.elevationFeatures&&k.layers.hasOwnProperty(s.fq)&&(Oe.elevationFeatures=s.fr.parseFrom(k.layers[s.fq],this.canonical));for(const Gt of ft[At]){const zi=Gt[0];if(this.extraShadowCaster&&(!zi.is3D()||zi.type==="model")||this.isSymbolTile!==void 0&&zi.type==="symbol"!==this.isSymbolTile||zi.minzoom&&this.zoom<Math.floor(zi.minzoom)||zi.maxzoom&&this.zoom>=zi.maxzoom||zi.visibility==="none")continue;Qn(Gt,this.zoom,Oe.brightness,W,this.worldview);const di=Te[zi.id]=zi.createBucket({index:ue.bucketLayerIDs.length,layers:Gt,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:or,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:ae,worldview:this.worldview,localizable:Hi,availableImages:W});ue.bucketLayerIDs.push(Gt.map(ji=>s.B(ji.id,ji.scope)));let fi=di.prepare?di.prepare():null;fi!=null?(fi=fi.then(()=>di.populate(qi,Oe,this.tileID.canonical,this.tileTransform)),rt.push(fi)):di.populate(qi,Oe,this.tileID.canonical,this.tileTransform)}}const mt=()=>{let At,Dt,Tt,xt,_i,or;Ne.trim();const qi={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},Hi=()=>{if(At)return this.status="done",le(At);if(this.extraShadowCaster)this.status="done",le(null,{buckets:Object.values(Te).filter(Gt=>!Gt.isEmpty()),featureIndex:ue,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:Oe.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(Dt&&Tt&&xt){const Gt=new Hn(Dt),zi=new Map;for(const[ji,zr]of Tt.entries()){const{imagePosition:Sr}=s.fu(ji,zr,s.fv);zi.set(ji,Sr)}const di={};for(const ji in Te){const zr=Te[ji];zr instanceof s.b4&&(Qn(zr.layers,this.zoom,Oe.brightness,W,this.worldview),di[ji]=s.fw(zr,Dt,Gt.positions,Tt,zi,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,_i,this.worldview,W))}const fi={iconsPending:!0,patternsPending:!0};this.rasterizeIfNeeded(Y,Tt,_i,()=>{fi.iconsPending=!1,Mi(di,Gt,fi)}),this.rasterizeIfNeeded(Y,xt,or,()=>{fi.patternsPending=!1,Mi(di,Gt,fi)})}},Mi=(Gt,zi,di,fi)=>{if(di.iconsPending||di.patternsPending)return;const ji=new s.fx(Tt,xt,this.lut);for(const zr in Te){const Sr=Te[zr];if(zr in Gt)s.fy(Sr,Gt[zr],this.showCollisionBoxes,W,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,Tt,ji);else if(Sr.hasPattern&&(Sr instanceof s.ba||Sr instanceof s.bb||Sr instanceof s.ea)){Qn(Sr.layers,this.zoom,Oe.brightness,W,this.worldview);const cr=Object.fromEntries(ji.patternPositions);Sr.addFeatures(Oe,this.tileID.canonical,cr,W,this.tileTransform,this.brightness)}}this.status="done",le(null,{buckets:Object.values(Te).filter(zr=>!zr.isEmpty()),featureIndex:ue,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:zi.image,lineAtlas:Ne,imageAtlas:ji,brightness:Oe.brightness})};if(!this.extraShadowCaster){const Gt=s.fs(Oe.glyphDependencies,fi=>Object.keys(fi).map(Number));Object.keys(Gt).length?Y.send("getGlyphs",{uid:this.uid,stacks:Gt},(fi,ji)=>{At||(At=fi,Dt=ji,Hi())},void 0,!1,qi):Dt={};const zi=Array.from(Oe.iconDependencies.keys()).map(fi=>s.I.parse(fi));zi.length?Y.send("getImages",{images:zi,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(fi,ji)=>{At||(At=fi,Tt=new Map,_i=this.updateImageMapAndGetImageTaskQueue(Tt,ji,Oe.iconDependencies),Hi())},void 0,!1,qi):(Tt=new Map,_i=new Map);const di=Array.from(Oe.patternDependencies.keys()).map(fi=>s.I.parse(fi));di.length?Y.send("getImages",{images:di,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(fi,ji)=>{At||(At=fi,xt=new Map,or=this.updateImageMapAndGetImageTaskQueue(xt,ji,Oe.patternDependencies),Hi())},void 0,!1,qi):(xt=new Map,or=new Map)}if(Oe.elevationFeatures&&Oe.elevationFeatures.length>0){const Gt=[];for(const di of Object.values(Te))if(di instanceof s.bb){const fi=di.getUnevaluatedPortalGraph();fi&&Gt.push(fi)}const zi=s.ft.evaluate(Gt);for(const di of Object.values(Te))if(di instanceof s.bb){const fi=k.layers[xe.decode(di.sourceLayerIndex)];di.setEvaluatedPortalGraph(zi,fi,this.tileID.canonical,Oe.availableImages,Oe.brightness)}}Hi()};rt.length>0?Promise.allSettled(rt).then(mt).catch(le):mt()}updateParameters(k){this.scaleFactor=k.scaleFactor,this.showCollisionBoxes=k.showCollisionBoxes,this.projection=k.projection,this.brightness=k.brightness,this.tileTransform=s.aZ(k.tileID.canonical,k.projection),this.extraShadowCaster=k.extraShadowCaster,this.lut=k.lut,this.worldview=k.worldview,this.indoor=k.indoor}rasterizeIfNeeded(k,U,W,ae){Array.from(U.values()).some(Y=>Y.usvg)?this.rasterize(k,U,W,ae):ae()}updateImageMapAndGetImageTaskQueue(k,U,W){const ae=new Map;for(const Y of U.keys()){const le=W.get(Y)||[];for(const xe of le){const ue=xe.toString(),Te=U.get(xe.id.toString());Te.usvg?ae.has(ue)||(ae.set(ue,xe),k.set(ue,Object.assign({},Te))):k.set(ue,Te)}}return ae}rasterize(k,U,W,ae){this.rasterizeTask=k.send("rasterizeImages",{scope:this.scope,tasks:W},(Y,le)=>{if(!Y)for(const[xe,ue]of le.entries()){const Te=Object.assign(U.get(xe),{data:ue});U.set(xe,Te)}ae()})}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function Qn(he,k,U,W,ae){const Y=new s.ac(k,{brightness:U,worldview:ae});for(const le of he)le.recalculate(Y,W)}class uo extends s.E{constructor(k,U,W,ae,Y,le,xe){super(),this.actor=k,this.layerIndex=U,this.availableImages=W,this.availableModels=ae,this.loadVectorData=le||s.aL,this.loading={},this.loaded={},this.deduped=new s.aK(k.scheduler),this.isSpriteLoaded=Y,this.scheduler
8=k.scheduler,this.brightness=xe}loadTile(k,U){const W=k.uid,ae=k&&k.request,Y=ae&&ae.collectResourceTiming,le=this.loading[W]=new Jn(k);le.abort=this.loadVectorData(k,(xe,ue)=>{const Te=!this.loading[W];if(delete this.loading[W],le.cancelRasterize(),Te||xe||!ue)return le.status="done",Te||(this.loaded[W]=le),U(xe);const Ne=ue.rawData,Oe={},rt=s.aM(ue.responseHeaders);rt&&rt.expires&&(Oe.expires=rt.expires),rt&&rt.cacheControl&&(Oe.cacheControl=rt.cacheControl),le.vectorTile=ue.vectorTile||new s.fz(new s.bt(Ne));const ft=()=>{le.parse(le.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,(mt,At)=>{if(mt||!At)return U(mt);const Dt={};if(Y){const Tt=zt(ae);Tt.length>0&&(Dt.resourceTiming=JSON.parse(JSON.stringify(Tt)))}U(null,Object.assign({rawTileData:Ne.slice(0),responseHeaders:ue.responseHeaders},At,Oe,Dt))})};this.isSpriteLoaded?ft():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(ft,{type:"parseTile",isSymbolTile:k.isSymbolTile,zoom:k.tileZoom}):ft()}),this.loaded=this.loaded||{},this.loaded[W]=le})}reloadTile(k,U){const W=this.loaded,ae=k.uid;if(W&&W[ae]){const Y=W[ae];Y.updateParameters(k);const le=(xe,ue)=>{const Te=Y.reloadCallback;Te&&(delete Y.reloadCallback,Y.parse(Y.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,Te)),U(xe,ue)};Y.status==="parsing"?Y.reloadCallback=le:Y.status==="done"&&(Y.vectorTile?Y.parse(Y.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,le):le())}else U(null,void 0)}abortTile(k,U){const W=k.uid,ae=this.loading[W];ae&&(ae.abort&&ae.abort(),delete this.loading[W]),U()}removeTile(k,U){const W=this.loaded,ae=k.uid;W&&W[ae]&&delete W[ae],U()}}class Ls{loadTile(k,U){const{uid:W,encoding:ae,rawImageData:Y,padding:le}=k,xe=ImageBitmap&&Y instanceof ImageBitmap?this.getImageData(Y,le):Y;U(null,new s.fA(W,xe,ae,le<1))}reloadTile(k,U){U(null,null)}abortTile(k,U){U()}removeTile(k,U){U()}getImageData(k,U){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(k.width,k.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=k.width,this.offscreenCanvas.height=k.height,this.offscreenCanvasContext.drawImage(k,0,0,k.width,k.height);const W=this.offscreenCanvasContext.getImageData(-U,-U,k.width+2*U,k.height+2*U);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),W}}s.bs.setPbf(s.bt);class tl{constructor(k){this._mrt=new s.bs(k.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=k.uid,this.tileID=k.tileID,this.source=k.source}parse(k,U){const W=this._mrt;this.status="parsing",this._entireBuffer=k;try{W.parseHeader(k),this._isHeaderLoaded=!0;const ae=[];for(const Y in W.layers){const le=W.getLayer(Y),xe=le.getDataRange(le.getBandList()),ue=W.createDecodingTask(xe),Te=k.slice(xe.firstByte,xe.lastByte+1),Ne=s.bs.performDecoding(Te,ue).then(Oe=>ue.complete(null,Oe)).catch(Oe=>ue.complete(Oe,null));ae.push(Ne)}Promise.allSettled(ae).then(()=>U(null,W)).catch(Y=>U(Y))}catch(ae){U(ae)}}}class il{constructor(k){this.actor=k,this.loading={},this.loaded={}}loadTile(k,U){const W=k.uid,ae=k.request,Y=this.loading[W]=new tl(k),{cancel:le}=s.bu(ae,(xe,ue,Te)=>{const Ne=!this.loading[W];if(delete this.loading[W],Ne||xe||!ue)return Y.status="done",Ne||(this.loaded[W]=Y),U(xe);Y.parse(ue,(Oe,rt)=>{if(Oe||!rt)return U(Oe);U(null,rt,Te)}),this.loaded[W]=Y});Y.abort=le}reloadTile(k,U){U(null,void 0)}abortTile(k,U){const W=k.uid,ae=this.loading[W];ae&&(ae.abort&&ae.abort(),delete this.loading[W]),U()}removeTile(k,U){const W=k.uid;this.loaded[W]&&delete this.loaded[W],U()}decodeRasterArray(k,U){s.bs.performDecoding(k.buffer,k.task).then(W=>U(null,W)).catch(W=>U(W))}}const rl=s.fB.prototype.toGeoJSON;class li{constructor(k){this._feature=k,this.extent=s.al,this.type=k.type,this.properties=k.tags,"id"in k&&!isNaN(k.id)&&(this.id=parseInt(k.id,10))}loadGeometry(){if(this._feature.type===1){const k=[];for(const U of this._feature.geometry)k.push([new s.P(U[0],U[1])]);return k}{const k=[];for(const U of this._feature.geometry){const W=[];for(const ae of U)W.push(new s.P(ae[0],ae[1]));k.push(W)}return k}}toGeoJSON(k,U,W){return rl.call(this,k,U,W)}}class lc{constructor(k,U){this.name=k,this.extent=s.al,this.length=U.length,this._jsonFeatures=U}feature(k){return new li(this._jsonFeatures[k])}}class gn{constructor(k){this.layers={},this.extent=s.al;for(const U of Object.keys(k))this.layers[U]=new lc(U,k[U])}}const xi=64/4096;class wi{constructor(){this.features=new Map}clear(){this.features.clear()}load(k=[],U){for(const W of k){const ae=W.id;if(ae==null)continue;let Y=this.features.get(ae);Y&&this.updateCache(Y,U),W.geometry?(Y=ho(W),this.updateCache(Y,U),this.features.set(ae,Y)):this.features.delete(ae),this.updateCache(Y,U)}}updateCache(k,U){for(const{canonical:W,uid:ae}of Object.values(U)){const{z:Y,x:le,y:xe}=W;nr(k,Math.pow(2,Y),le,xe)&&delete U[ae]}}getTile(k,U,W){const ae=Math.pow(2,k),Y=[];for(const le of this.features.values())nr(le,ae,U,W)&&Y.push(ki(le,ae,U,W));return{features:Y}}getFeatures(){return[...this.features.values()]}}function nr({minX:he,minY:k,maxX:U,maxY:W},ae,Y,le){return he<(Y+1+xi)/ae&&k<(le+1+xi)/ae&&U>(Y-xi)/ae&&W>(le-xi)/ae}function ho(he){const{id:k,geometry:U,properties:W}=he;if(!U)return;if(U.type==="GeometryCollection")throw new Error("GeometryCollection not supported in dynamic mode.");const{type:ae,coordinates:Y}=U,le={id:k,type:1,geometry:[],tags:W,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},xe=le.geometry;if(ae==="Point")eo(Y,xe,le);else if(ae==="MultiPoint")for(const ue of Y)eo(ue,xe,le);else if(ae==="LineString")le.type=2,fo(Y,xe,le);else if(ae==="MultiLineString")le.type=2,to(Y,xe,le);else if(ae==="Polygon")le.type=3,to(Y,xe,le,!0);else{if(ae!=="MultiPolygon")throw new Error("Input data is not a valid GeoJSON object.");le.type=3;for(const ue of Y)to(ue,xe,le,!0)}return le}function eo([he,k],U,W){const ae=s.aF(he);let Y=s.aJ(k);Y=Y<0?0:Y>1?1:Y,U.push(ae,Y),W.minX=Math.min(W.minX,ae),W.minY=Math.min(W.minY,Y),W.maxX=Math.max(W.maxX,ae),W.maxY=Math.max(W.maxY,Y)}function fo(he,k,U,W=!1,ae=!1){const Y=[];for(const le of he)eo(le,Y,U);k.push(Y),W&&(function(le,xe){let ue=0;for(let Te=0,Ne=le.length,Oe=Ne-2;Te<Ne;Oe=Te,Te+=2)ue+=(le[Te]-le[Oe])*(le[Te+1]+le[Oe+1]);if(ue>0===xe)for(let Te=0,Ne=le.length;Te<Ne/2;Te+=2){const Oe=le[Te],rt=le[Te+1];le[Te]=le[Ne-2-Te],le[Te+1]=le[Ne-1-Te],le[Ne-2-Te]=Oe,le[Ne-1-Te]=rt}})(Y,ae)}function to(he,k,U,W=!1){for(let ae=0;ae<he.length;ae++)fo(he[ae],k,U,W,ae===0)}function ki(he,k,U,W){const{id:ae,type:Y,geometry:le,tags:xe}=he,ue=[];
8if(Y===1)(function(Te,Ne,Oe,rt,ft){for(let mt=0;mt<Te.length;mt+=2){const At=Math.round(s.al*(Te[mt+0]*Ne-Oe)),Dt=Math.round(s.al*(Te[mt+1]*Ne-rt));ft.push([At,Dt])}})(le,k,U,W,ue);else if(Y===2)for(const Te of le)Mn(Te,k,U,W,ue);else if(Y===3)for(const Te of le)cc(Te,k,U,W,ue);return{id:ae,type:Y,geometry:ue,tags:xe}}function Mn(he,k,U,W,ae){const le=s.al+128;let xe;for(let ue=0;ue<he.length-2;ue+=2){let Te=Math.round(s.al*(he[ue+0]*k-U)),Ne=Math.round(s.al*(he[ue+1]*k-W)),Oe=Math.round(s.al*(he[ue+2]*k-U)),rt=Math.round(s.al*(he[ue+3]*k-W));const ft=Oe-Te,mt=rt-Ne;Te<-128&&Oe<-128||(Te<-128?(Ne+=Math.round(mt*((-128-Te)/ft)),Te=-128):Oe<-128&&(rt=Ne+Math.round(mt*((-128-Te)/ft)),Oe=-128),Ne<-128&&rt<-128||(Ne<-128?(Te+=Math.round(ft*((-128-Ne)/mt)),Ne=-128):rt<-128&&(Oe=Te+Math.round(ft*((-128-Ne)/mt)),rt=-128),Te>=le&&Oe>=le||(Te>=le?(Ne+=Math.round(mt*((le-Te)/ft)),Te=le):Oe>=le&&(rt=Ne+Math.round(mt*((le-Te)/ft)),Oe=le),Ne>=le&&rt>=le||(Ne>=le?(Te+=Math.round(ft*((le-Ne)/mt)),Ne=le):rt>=le&&(Oe=Te+Math.round(ft*((le-Ne)/mt)),rt=le),xe&&Te===xe[xe.length-1][0]&&Ne===xe[xe.length-1][1]||(xe=[[Te,Ne]],ae.push(xe)),xe.push([Oe,rt])))))}}function cc(he,k,U,W,ae){const Y=(U-xi)/k,le=(W-xi)/k,xe=(U+1+xi)/k,ue=(W+1+xi)/k;function Te(rt,ft){let mt=0;return rt<Y?mt|=1:rt>xe&&(mt|=2),ft<le?mt|=4:ft>ue&&(mt|=8),mt}let Ne=[];for(let rt=1;rt<=8;rt*=2){let ft=he[he.length-2],mt=he[he.length-1],At=!(Te(ft,mt)&rt);for(let Dt=0;Dt<he.length;Dt+=2){const Tt=he[Dt],xt=he[Dt+1],_i=!(Te(Tt,xt)&rt);_i!==At&&(8&rt?Ne.push(ft+(Tt-ft)*(ue-mt)/(xt-mt),ue):4&rt?Ne.push(ft+(Tt-ft)*(le-mt)/(xt-mt),le):2&rt?Ne.push(xe,mt+(xt-mt)*(xe-ft)/(Tt-ft)):1&rt&&Ne.push(Y,mt+(xt-mt)*(Y-ft)/(Tt-ft))),_i&&Ne.push(Tt,xt),ft=Tt,mt=xt,At=_i}if(!(he=Ne).length||rt===8)break;Ne=[]}const Oe=[];for(let rt=0;rt<Ne.length;rt+=2)Oe.push([Math.round(s.al*(Ne[rt]*k-U)),Math.round(s.al*(Ne[rt+1]*k-W))]);Oe.length&&ae.push(Oe)}function nl({name:he,features:k},U){U.writeStringField(1,he),U.writeVarintField(5,s.al);const W=new Map,ae=new Map,Y={keys:W,values:ae,feature:null};for(const le of k)Y.feature=le,U.writeMessage(2,uc,Y);for(const le of W.keys())U.writeStringField(3,le);for(const le of ae.keys())U.writeMessage(4,Fs,le)}function uc(he,k){const U=he.feature;U.id!==void 0&&Number.isSafeInteger(+U.id)&&k.writeVarintField(1,+U.id),U.tags&&k.writeMessage(2,Qo,he),k.writeVarintField(3,U.type),k.writeMessage(4,Fr,U)}function Qo({keys:he,values:k,feature:U},W){for(const ae of Object.keys(U.tags)){let Y=U.tags[ae];if(Y===null)continue;let le=he.get(ae);le===void 0&&(le=he.size,he.set(ae,le)),W.writeVarint(le);const xe=typeof Y;xe!=="string"&&xe!=="boolean"&&xe!=="number"&&(Y=JSON.stringify(Y));let ue=k.get(Y);ue===void 0&&(ue=k.size,k.set(Y,ue)),W.writeVarint(ue)}}function mi(he,k){return(k<<3)+(7&he)}function Gi(he){return he<<1^he>>31}function Fr(he,k){const{geometry:U,type:W}=he;let ae=0,Y=0;if(W===1){k.writeVarint(mi(1,U.length));for(const le of U){const xe=le[0]-ae,ue=le[1]-Y;k.writeVarint(Gi(xe)),k.writeVarint(Gi(ue)),ae+=xe,Y+=ue}}else for(const le of U){if(le.length===0)continue;k.writeVarint(mi(1,1));const xe=le.length-(W===3?1:0);for(let ue=0;ue<xe;ue++){ue===1&&k.writeVarint(mi(2,xe-1));const Te=le[ue][0]-ae,Ne=le[ue][1]-Y;k.writeVarint(Gi(Te)),k.writeVarint(Gi(Ne)),ae+=Te,Y+=Ne}W===3&&k.writeVarint(mi(7,1))}}function Fs(he,k){const U=typeof he;U==="string"?k.writeStringField(1,he):U==="boolean"?k.writeBooleanField(7,he):U==="number"&&(he%1!=0?k.writeDoubleField(3,he):he<0?k.writeSVarintField(6,he):k.writeVarintField(5,he))}const Qi={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:he=>he},es=Math.fround||(ts=new Float32Array(1),he=>(ts[0]=+he,ts[0]));var ts;class Os{constructor(k){this.options=Object.assign(Object.create(Qi),k),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(k){const{log:U,minZoom:W,maxZoom:ae}=this.options;U&&console.time("total time");const Y=`prepare ${k.length} points`;U&&console.time(Y),this.points=k;const le=[];for(let ue=0;ue<k.length;ue++){const Te=k[ue];if(!Te.geometry)continue;const[Ne,Oe]=Te.geometry.coordinates,rt=es(la(Ne)),ft=es(is(Oe));le.push(rt,ft,1/0,ue,-1,1),this.options.reduce&&le.push(0)}let xe=this.trees[ae+1]=this._createTree(le);U&&console.timeEnd(Y);for(let ue=ae;ue>=W;ue--){const Te=+Date.now();xe=this.trees[ue]=this._createTree(this._cluster(xe,ue)),U&&console.log("z%d: %d clusters in %dms",ue,xe.numItems,+Date.now()-Te)}return U&&console.timeEnd("total time"),this}getClusters(k,U){let W=((k[0]+180)%360+360)%360-180;const ae=Math.max(-90,Math.min(90,k[1]));let Y=k[2]===180?180:((k[2]+180)%360+360)%360-180;const le=Math.max(-90,Math.min(90,k[3]));if(k[2]-k[0]>=360)W=-180,Y=180;else if(W>Y){const Oe=this.getClusters([W,ae,180,le],U),rt=this.getClusters([-180,ae,Y,le],U);return Oe.concat(rt)}const xe=this.trees[this._limitZoom(U)],ue=xe.range(la(W),is(le),la(Y),is(ae)),Te=xe.data,Ne=[];for(const Oe of ue){const rt=this.stride*Oe;Ne.push(Te[rt+5]>
vendor: 13,734 bytes, line 8
81?io(Te,rt,this.clusterProps):this.points[Te[rt+3]])}return Ne}getChildren(k){const U=this._getOriginId(k),W=this._getOriginZoom(k),ae="No cluster with the specified id.",Y=this.trees[W];if(!Y)throw new Error(ae);const le=Y.data;if(U*this.stride>=le.length)throw new Error(ae);const xe=this.options.radius/(this.options.extent*Math.pow(2,W-1)),ue=Y.within(le[U*this.stride],le[U*this.stride+1],xe),Te=[];for(const Ne of ue){const Oe=Ne*this.stride;le[Oe+4]===k&&Te.push(le[Oe+5]>1?io(le,Oe,this.clusterProps):this.points[le[Oe+3]])}if(Te.length===0)throw new Error(ae);return Te}getLeaves(k,U,W){const ae=[];return this._appendLeaves(ae,k,U=U||10,W=W||0,0),ae}getTile(k,U,W){const ae=this.trees[this._limitZoom(k)],Y=Math.pow(2,k),{extent:le,radius:xe}=this.options,ue=xe/le,Te=(W-ue)/Y,Ne=(W+1+ue)/Y,Oe={features:[]};return this._addTileFeatures(ae.range((U-ue)/Y,Te,(U+1+ue)/Y,Ne),ae.data,U,W,Y,Oe),U===0&&this._addTileFeatures(ae.range(1-ue/Y,Te,1,Ne),ae.data,Y,W,Y,Oe),U===Y-1&&this._addTileFeatures(ae.range(0,Te,ue/Y,Ne),ae.data,-1,W,Y,Oe),Oe.features.length?Oe:null}getClusterExpansionZoom(k){let U=this._getOriginZoom(k)-1;for(;U<=this.options.maxZoom;){const W=this.getChildren(k);if(U++,W.length!==1)break;k=W[0].properties.cluster_id}return U}_appendLeaves(k,U,W,ae,Y){const le=this.getChildren(U);for(const xe of le){const ue=xe.properties;if(ue&&ue.cluster?Y+ue.point_count<=ae?Y+=ue.point_count:Y=this._appendLeaves(k,ue.cluster_id,W,ae,Y):Y<ae?Y++:k.push(xe),k.length===W)break}return Y}_createTree(k){const U=new s.c4(k.length/this.stride|0,this.options.nodeSize,Float32Array);for(let W=0;W<k.length;W+=this.stride)U.add(k[W],k[W+1]);return U.finish(),U.data=k,U}_addTileFeatures(k,U,W,ae,Y,le){for(const xe of k){const ue=xe*this.stride,Te=U[ue+5]>1;let Ne,Oe,rt;if(Te)Ne=tr(U,ue,this.clusterProps),Oe=U[ue],rt=U[ue+1];else{const At=this.points[U[ue+3]];Ne=At.properties;const[Dt,Tt]=At.geometry.coordinates;Oe=la(Dt),rt=is(Tt)}const ft={type:1,geometry:[[Math.round(this.options.extent*(Oe*Y-W)),Math.round(this.options.extent*(rt*Y-ae))]],tags:Ne};let mt;mt=Te||this.options.generateId?U[ue+3]:this.points[U[ue+3]].id,mt!==void 0&&(ft.id=mt),le.features.push(ft)}}_limitZoom(k){return Math.max(this.options.minZoom,Math.min(Math.floor(+k),this.options.maxZoom+1))}_cluster(k,U){const{radius:W,extent:ae,reduce:Y,minPoints:le}=this.options,xe=W/(ae*Math.pow(2,U)),ue=k.data,Te=[],Ne=this.stride;for(let Oe=0;Oe<ue.length;Oe+=Ne){if(ue[Oe+2]<=U)continue;ue[Oe+2]=U;const rt=ue[Oe],ft=ue[Oe+1],mt=k.within(ue[Oe],ue[Oe+1],xe),At=ue[Oe+5];let Dt=At;for(const Tt of mt){const xt=Tt*Ne;ue[xt+2]>U&&(Dt+=ue[xt+5])}if(Dt>At&&Dt>=le){let Tt,xt=rt*At,_i=ft*At,or=-1;const qi=(Oe/Ne<<5)+(U+1)+this.points.length;for(const Hi of mt){const Mi=Hi*Ne;if(ue[Mi+2]<=U)continue;ue[Mi+2]=U;const Gt=ue[Mi+5];xt+=ue[Mi]*Gt,_i+=ue[Mi+1]*Gt,ue[Mi+4]=qi,Y&&(Tt||(Tt=this._map(ue,Oe,!0),or=this.clusterProps.length,this.clusterProps.push(Tt)),Y(Tt,this._map(ue,Mi)))}ue[Oe+4]=qi,Te.push(xt/Dt,_i/Dt,1/0,qi,-1,Dt),Y&&Te.push(or)}else{for(let Tt=0;Tt<Ne;Tt++)Te.push(ue[Oe+Tt]);if(Dt>1)for(const Tt of mt){const xt=Tt*Ne;if(!(ue[xt+2]<=U)){ue[xt+2]=U;for(let _i=0;_i<Ne;_i++)Te.push(ue[xt+_i])}}}}return Te}_getOriginId(k){return k-this.points.length>>5}_getOriginZoom(k){return(k-this.points.length)%32}_map(k,U,W){if(k[U+5]>1){const le=this.clusterProps[k[U+6]];return W?Object.assign({},le):le}const ae=this.points[k[U+3]].properties,Y=this.options.map(ae);return W&&Y===ae?Object.assign({},Y):Y}}function io(he,k,U){return{type:"Feature",id:he[k+3],properties:tr(he,k,U),geometry:{type:"Point",coordinates:[(W=he[k],360*(W-.5)),ca(he[k+1])]}};var W}function tr(he,k,U){const W=he[k+5],ae=W>=1e4?`${Math.round(W/1e3)}k`:W>=1e3?Math.round(W/100)/10+"k":W,Y=he[k+6],le=Y===-1?{}:Object.assign({},U[Y]);return Object.assign(le,{cluster:!0,cluster_id:he[k+3],point_count:W,point_count_abbreviated:ae})}function la(he){return he/360+.5}function is(he){const k=Math.sin(he*Math.PI/180),U=.5-.25*Math.log((1+k)/(1-k))/Math.PI;return U<0?0:U>1?1:U}function ca(he){const k=(180-360*he)*Math.PI/180;return 360*Math.atan(Math.exp(k))/Math.PI-90}function ks(he,k,U,W){let ae=W;const Y=k+(U-k>>1);let le,xe=U-k;const ue=he[k],Te=he[k+1],Ne=he[U],Oe=he[U+1];for(let rt=k+3;rt<U;rt+=3){const ft=ol(he[rt],he[rt+1],ue,Te,Ne,Oe);if(ft>ae)le=rt,ae=ft;else if(ft===ae){const mt=Math.abs(rt-Y);mt<xe&&(le=rt,xe=mt)}}ae>W&&(le-k>3&&ks(he,k,le,W),he[le+2]=ae,U-le>3&&ks(he,le,U,W))}function ol(he,k,U,W,ae,Y){let le=ae-U,xe=Y-W;if(le!==0||xe!==0){const ue=((he-U)*le+(k-W)*xe)/(le*le+xe*xe);ue>1?(U=ae,W=Y):ue>0&&(U+=le*ue,W+=xe*ue)}return le=he-U,xe=k-W,le*le+xe*xe}function yn(he,k,U,W){const ae={id:he??null,type:k,geometry:U,tags:W,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(k==="Point"||k==="MultiPoint"||k==="LineString")an(ae,U);else if(k==="Polygon")an(ae,U[0]);else if(k==="MultiLineString")for(const Y of U)an(ae,Y);else if(k==="MultiPolygon")for(const Y of U)an(ae,Y[0]);return ae}function an(he,k){for(let U=0;U<k.length;U+=3)he.minX=Math.min(he.minX,k[U]),he.minY=Math.min(he.minY,k[U+1]),he.maxX=Math.max(he.maxX,k[U]),he.maxY=Math.max(he.maxY,k[U+1])}function Po(he,k,U,W){if(!k.geometry)return;const ae=k.geometry.coordinates;if(ae&&ae.length===0)return;const Y=k.geometry.type,le=Math.pow(U.tolerance/((1<<U.maxZoom)*U.extent),2);let xe=[],ue=k.id;if(U.promoteId?ue=k.properties[U.promoteId]:U.generateId&&(ue=W||0),Y==="Point")Ro(ae,xe);else if(Y==="MultiPoint")for(const Te of ae)Ro(Te,xe);else if(Y==="LineString")rs(ae,xe,le,!1);else if(Y==="MultiLineString"){if(U.lineMetrics){for(const Te of ae)xe=[],rs(Te,xe,le,!1),he.push(yn(ue,"LineString",xe,k.properties));return}Bs(ae,xe,le,!1)}else if(Y==="Polygon")Bs(ae,xe,le,!0);else{if(Y!=="MultiPolygon"){if(Y==="GeometryCollection"){for(const Te of k.geometry.geometries)Po(he,{id:ue,geometry:Te,properties:k.properties},U,W);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const Te of ae){const Ne=[];Bs(Te,Ne,le,!0),xe.push(Ne)}}he.push(yn(ue,Y,xe,k.properties))}function Ro(he,k){k.push(Zr(he[0]),ua(he[1]),0)}function rs(he,k,U,W){let ae,Y,le=0;for(let ue=0;ue<he.length;ue++){const Te=Zr(he[ue][0]),Ne=ua(he[ue][1]);k.push(Te,Ne,0),ue>0&&(le+=W?(ae*Ne-Te*Y)/2:Math.sqrt(Math.pow(Te-ae,2)+Math.pow(Ne-Y,2))),ae=Te,Y=Ne}const xe=k.length-3;k[2]=1,ks(k,0,xe,U),k[xe+2]=1,k.size=Math.abs(le),k.start=0,k.end=k.size}function Bs(he,k,U,W){for(let ae=0;ae<he.length;ae++){const Y=[];rs(he[ae],Y,U,W),k.push(Y)}}function Zr(he){return he/360+.5}function ua(he){const k=Math.sin(he*Math.PI/180),U=.5-.25*Math.log((1+k)/(1-k))/Math.PI;return U<0?0:U>1?1:U}function Cn(he,k,U,W,ae,Y,le,xe){if(W/=k,Y>=(U/=k)&&le<W)return he;if(le<U||Y>=W)return null;const ue=[];for(const Te of he){const Ne=Te.geometry;let Oe=Te.type;const rt=ae===0?Te.minX:Te.minY,ft=ae===0?Te.maxX:Te.maxY;if(rt>=U&&ft<W){ue.push(Te);continue}if(ft<U||rt>=W)continue;let mt=[];if(Oe==="Point"||Oe==="MultiPoint")sl(Ne,mt,U,W,ae);else if(Oe==="LineString")zo(Ne,mt,U,W,ae,!1,xe.lineMetrics);else if(Oe==="MultiLineString")Do(Ne,mt,U,W,ae,!1);else if(Oe==="Polygon")Do(Ne,mt,U,W,ae,!0);else if(Oe==="MultiPolygon")for(const At of Ne){const Dt=[];Do(At,Dt,U,W,ae,!0),Dt.length&&mt.push(Dt)}if(mt.length){if(xe.lineMetrics&&Oe==="LineString"){for(const At of mt)ue.push(yn(Te.id,Oe,At,Te.tags));continue}Oe!=="LineString"&&Oe!=="MultiLineString"||(mt.length===1?(Oe="LineString",mt=mt[0]):Oe="MultiLineString"),Oe!=="Point"&&Oe!=="MultiPoint"||(Oe=mt.length===3?"Point":"MultiPoint"),ue.push(yn(Te.id,Oe,mt,Te.tags))}}return ue.length?ue:null}function sl(he,k,U,W,ae){for(let Y=0;Y<he.length;Y+=3){const le=he[Y+ae];le>=U&&le<=W&&Lo(k,he[Y],he[Y+1],he[Y+2])}}function zo(he,k,U,W,ae,Y,le){let xe=Or(he);const ue=ae===0?ns:Fo;let Te,Ne,Oe=he.start;for(let Dt=0;Dt<he.length-3;Dt+=3){const Tt=he[Dt],xt=he[Dt+1],_i=he[Dt+2],or=he[Dt+3],qi=he[Dt+4],Hi=ae===0?Tt:xt,Mi=ae===0?or:qi;let Gt=!1;le&&(Te=Math.sqrt(Math.pow(Tt-or,2)+Math.pow(xt-qi,2))),Hi<U?Mi>U&&(Ne=ue(xe,Tt,xt,or,qi,U),le&&(xe.start=Oe+Te*Ne)):Hi>W?Mi<W&&(Ne=ue(xe,Tt,xt,or,qi,W),le&&(xe.start=Oe+Te*Ne)):Lo(xe,Tt,xt,_i),Mi<U&&Hi>=U&&(Ne=ue(xe,Tt,xt,or,qi,U),Gt=!0),Mi>W&&Hi<=W&&(Ne=ue(xe,Tt,xt,or,qi,W),Gt=!0),!Y&&Gt&&(le&&(xe.end=Oe+Te*Ne),k.push(xe),xe=Or(he)),le&&(Oe+=Te)}let rt=he.length-3;const ft=he[rt],mt=he[rt+1],At=ae===0?ft:mt;At>=U&&At<=W&&Lo(xe,ft,mt,he[rt+2]),rt=xe.length-3,Y&&rt>=3&&(xe[rt]!==xe[0]||xe[rt+1]!==xe[1])&&Lo(xe,xe[0],xe[1],xe[2]),xe.length&&k.push(xe)}function Or(he){const k=[];return k.size=he.size,k.start=he.start,k.end=he.end,k}function Do(he,k,U,W,ae,Y){for(const le of he)zo(le,k,U,W,ae,Y,!1)}function Lo(he,k,U,W){he.push(k,U,W)}function ns(he,k,U,W,ae,Y){const le=(Y-k)/(W-k);return Lo(he,Y,U+(ae-U)*le,1),le}function Fo(he,k,U,W,ae,Y){const le=(Y-U)/(ae-U);return Lo(he,k+(W-k)*le,Y,1),le}function os(he,k){const U=[];for(let W=0;W<he.length;W++){const ae=he[W],Y=ae.type;let le;if(Y==="Point"||Y==="MultiPoint"||Y==="LineString")le=ss(ae.geometry,k);else if(Y==="MultiLineString"||Y==="Polygon"){le=[];for(const xe of ae.geometry)le.push(ss(xe,k))}else if(Y==="MultiPolygon"){le=[];for(const xe of ae.geometry){const ue=[];for(const Te of xe)ue.push(ss(Te,k));le.push(ue)}}U.push(yn(ae.id,Y,le,ae.tags))}return U}function ss(he,k){const U=[];U.size=he.size,he.start!==void 0&&(U.start=he.start,U.end=he.end);for(let W=0;W<he.length;W+=3)U.push(he[W]+k,he[W+1],he[W+2]);return U}function ha(he,k){if(he.transformed)return he;const U=1<<he.z,W=he.x,ae=he.y;for(const Y of he.features){const le=Y.geometry,xe=Y.type;if(Y.geometry=[],xe===1)for(let ue=0;ue<le.length;ue+=2)Y.geometry.push(Ai(le[ue],le[ue+1],k,U,W,ae));else for(let ue=0;ue<le.length;ue++){const Te=[];for(let Ne=0;Ne<le[ue].length;Ne+=2)Te.push(Ai(le[ue][Ne],le[ue][Ne+1],k,U,W,ae));Y.geometry.push(Te)}}return he.transformed=!0,he}function Ai(he,k,U,W,ae,Y){return[Math.round(U*(he*W-ae)),Math.round(U*(k*W-Y))]}function Rr(he,k,U,W,ae){const Y=k===ae.maxZoom?0:ae.tolerance/((1<<k)*ae.extent),le={features:[],numPoints:0,numSimplified:0,numFeatures:he.length,source:null,x:U,y:W,z:k,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const xe of he)hc(le,xe,Y,ae);return le}function hc(he,k,U,W){const ae=k.geometry,Y=k.type,le=[];if(he.minX=Math.min(he.minX,k.minX),he.minY=Math.min(he.minY,k.minY),he.maxX=Math.max(he.maxX,k.maxX),he.maxY=Math.max(he.maxY,k.maxY),Y==="Point"||Y==="MultiPoint")for(let xe=0;xe<ae.length;xe+=3)le.push(ae[xe],ae[xe+1]),he.numPoints++,he.numSimplified++;else if(Y==="LineString")da(le,ae,he,U,!1,!1);else if(Y==="MultiLineString"||Y==="Polygon")for(let xe=0;xe<ae.length;xe++)da(le,ae[xe],he,U,Y==="Polygon",xe===0);else if(Y==="MultiPolygon")for(let xe=0;xe<ae.length;xe++){const ue=ae[xe];for(let Te=0;Te<ue.length;Te++)da(le,ue[Te],he,U,!0,Te===0)}if(le.length){let xe=k.tags||null;if(Y==="LineString"&&W.lineMetrics){xe={};for(const Te in k.tags)xe[Te]=k.tags[Te];xe.mapbox_clip_start=ae.start/ae.size,xe.mapbox_clip_end=ae.end/ae.size}const ue={geometry:le,type:Y==="Polygon"||Y==="MultiPolygon"?3:Y==="LineString"||Y==="MultiLineString"?2:1,tags:xe};k.id!==null&&(ue.id=k.id),he.features.push(ue)}}function da(he,k,U,W,ae,Y){const le=W*W;if(W>0&&k.size<(ae?le:W))return void(U.numPoints+=k.length/3);const xe=[];for(let ue=0;ue<k.length;ue+=3)(W===0||k[ue+2]>le)&&(U.numSimplified++,xe.push(k[ue],k[ue+1])),U.numPoints++;ae&&(function(ue,Te){let Ne=0;for(let Oe=0,rt=ue.length,ft=rt-2;Oe<rt;ft=Oe,Oe+=2)Ne+=(ue[Oe]-ue[ft])*(ue[Oe+1]+ue[ft+1]);if(Ne>0===Te)for(let Oe=0,rt=ue.length;Oe<rt/2;Oe+=2){const ft=ue[Oe],mt=ue[Oe+1];ue[Oe]=ue[rt-2-Oe],ue[Oe+1]=ue[rt-1-Oe],ue[rt-2-Oe]=ft,ue[rt-1-Oe]=mt}})(xe,Y),he.push(xe)}const Pn={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class Fu{constructor(k,U){const W=(U=this.options=(function(Y,le){for(const xe in le)Y[xe]=le[xe];return Y})(Object.create(Pn),U)).debug;if(W&&console.time("preprocess data"),U.maxZoom<0||U.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(U.promoteId&&U.generateId)throw new Error("promoteId and generateId cannot be used together.");let ae=(function(Y,le){const xe=[];if(Y.type==="FeatureCollection")for(let ue=0;ue<Y.features.length;ue++)Po(xe,Y.features[ue],le,ue);else Po(xe,Y.type==="Feature"?Y:{geometry:Y},le);return xe})(k,U);this.tiles={},this.tileCoords=[],W&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",U.indexMaxZoom,U.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),ae=(function(Y,le){const xe=le.buffer/le.extent;let ue=Y;const Te=Cn(Y,1,-1-xe,xe,0,-1,2,le),Ne=Cn(Y,1,1-xe,2+xe,0,-1,2,le);return(Te||Ne)&&(ue=Cn(Y,1,-xe,1+xe,0,-1,2,le)||[],Te&&(ue=os(Te,1).concat(ue)),Ne&&(ue=ue.concat(os(Ne,-1)))),ue})(ae,U),ae.length&&this.splitTile(ae,0,0,0),W&&(ae.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(k,U,W,ae,Y,le,xe){const ue=[k,U,W,ae],Te=this.options,Ne=Te.debug;for(;ue.length;){ae=ue.pop(),W=ue.pop(),U=ue.pop(),k=ue.pop();const Oe=1<<U,rt=fa(U,W,ae);let ft=this.tiles[rt];if(!ft&&(Ne>1&&console.time("creation"),ft=this.tiles[rt]=Rr(k,U,W,ae,Te),this.tileCoords.push({z:U,x:W,y:ae}),Ne)){Ne>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",U,W,ae,ft.numFeatures,ft.numPoints,ft.numSimplified),console.timeEnd("creation"));const Gt=`z${U}`;this.stats[Gt]=(this.stats[Gt]||0)+1,this.total++}if(ft.source=k,Y==null){if(U===Te.indexMaxZoom||ft.numPoints<=Te.indexMaxPoints)continue}else{if(U===Te.maxZoom||U===Y)continue;if(Y!=null){const Gt=Y-U;
8if(W!==le>>Gt||ae!==xe>>Gt)continue}}if(ft.source=null,k.length===0)continue;Ne>1&&console.time("clipping");const mt=.5*Te.buffer/Te.extent,At=.5-mt,Dt=.5+mt,Tt=1+mt;let xt=null,_i=null,or=null,qi=null,Hi=Cn(k,Oe,W-mt,W+Dt,0,ft.minX,ft.maxX,Te),Mi=Cn(k,Oe,W+At,W+Tt,0,ft.minX,ft.maxX,Te);k=null,Hi&&(xt=Cn(Hi,Oe,ae-mt,ae+Dt,1,ft.minY,ft.maxY,Te),_i=Cn(Hi,Oe,ae+At,ae+Tt,1,ft.minY,ft.maxY,Te),Hi=null),Mi&&(or=Cn(Mi,Oe,ae-mt,ae+Dt,1,ft.minY,ft.maxY,Te),qi=Cn(Mi,Oe,ae+At,ae+Tt,1,ft.minY,ft.maxY,Te),Mi=null),Ne>1&&console.timeEnd("clipping"),ue.push(xt||[],U+1,2*W,2*ae),ue.push(_i||[],U+1,2*W,2*ae+1),ue.push(or||[],U+1,2*W+1,2*ae),ue.push(qi||[],U+1,2*W+1,2*ae+1)}}getTile(k,U,W){k=+k,U=+U,W=+W;const ae=this.options,{extent:Y,debug:le}=ae;if(k<0||k>24)return null;const xe=1<<k,ue=fa(k,U=U+xe&xe-1,W);if(this.tiles[ue])return ha(this.tiles[ue],Y);le>1&&console.log("drilling down to z%d-%d-%d",k,U,W);let Te,Ne=k,Oe=U,rt=W;for(;!Te&&Ne>0;)Ne--,Oe>>=1,rt>>=1,Te=this.tiles[fa(Ne,Oe,rt)];return Te&&Te.source?(le>1&&(console.log("found parent tile z%d-%d-%d",Ne,Oe,rt),console.time("drilling down")),this.splitTile(Te.source,Ne,Oe,rt,k,U,W),le>1&&console.timeEnd("drilling down"),this.tiles[ue]?ha(this.tiles[ue],Y):null):null}}function fa(he,k,U){return 32*((1<<he)*U+k)+he}function Be(he,k){const U=he.tileID.canonical;if(!this._geoJSONIndex)return void k(null,null);const W=this._geoJSONIndex.getTile(U.z,U.x,U.y);if(!W)return void k(null,null);const ae=Te=>Te.tags&&"3d_elevation_id"in Te.tags&&"source"in Te.tags&&Te.tags.source==="elevation",Y=W.features.filter(Te=>ae(Te));let le={_geojsonTileLayer:W.features};Y.length>0&&(le={_geojsonTileLayer:W.features.filter(Te=>!ae(Te)),hd_road_elevation:Y});const xe=new gn(le),ue=(function(Te){const Ne=new s.bt;for(const Oe of Object.keys(Te))Ne.writeMessage(3,nl,{name:Oe,features:Te[Oe]});return Ne.finish()})(le).buffer;k(null,{vectorTile:xe,rawData:ue})}class Oo extends uo{constructor(k,U,W,ae,Y,le,xe){super(k,U,W,ae,Y,Be,xe),le&&(this.loadGeoJSON=le),this._dynamicIndex=new wi}loadData(k,U){const W=k&&k.request,ae=W&&W.collectResourceTiming;this._geoJSONIndex=null,this.loadGeoJSON(k,(Y,le)=>{if(Y||!le)return U(Y);if(typeof le!="object")return U(new Error(`Input data given to '${k.source}' is not a valid GeoJSON object.`));{try{if(k.filter){const ue=s.U(k.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(ue.result==="error")throw new Error(ue.value.map(Te=>`${Te.key}: ${Te.message}`).join(", "));le.features=le.features.filter(Te=>ue.value.evaluate({zoom:0},Te))}k.dynamic?(le.type==="Feature"&&(le={type:"FeatureCollection",features:[le]}),k.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(le.features,this.loaded),k.cluster&&(le.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=k.cluster?new Os((function({superclusterOptions:ue,clusterProperties:Te}){if(!Te||!ue)return ue;const Ne={},Oe={},rt={accumulated:null,zoom:0},ft={properties:null},mt=Object.keys(Te);for(const At of mt){const[Dt,Tt]=Te[At],xt=s.U(Tt),_i=s.U(typeof Dt=="string"?[Dt,["accumulated"],["get",At]]:Dt);Ne[At]=xt.value,Oe[At]=_i.value}return ue.map=At=>{ft.properties=At;const Dt={};for(const Tt of mt)Dt[Tt]=Ne[Tt].evaluate(rt,ft);return Dt},ue.reduce=(At,Dt)=>{ft.properties=Dt;for(const Tt of mt)rt.accumulated=At[Tt],At[Tt]=Oe[Tt].evaluate(rt,ft)},ue})(k)).load(le.features):k.dynamic?this._dynamicIndex:(function(ue,Te){return new Fu(ue,Te)})(le,k.geojsonVtOptions)}catch(ue){return U(ue)}const xe={};if(ae){const ue=zt(W);ue&&(xe.resourceTiming={},xe.resourceTiming[k.source]=JSON.parse(JSON.stringify(ue)))}U(null,xe)}})}reloadTile(k,U){const W=this.loaded;return W&&W[k.uid]?k.partial?U(null,void 0):super.reloadTile(k,U):this.loadTile(k,U)}loadGeoJSON(k,U){if(k.request)s.m(k.request,U);else{if(typeof k.data!="string")return U(new Error(`Input data given to '${k.source}' is not a valid GeoJSON object.`));setTimeout(()=>{try{return U(null,JSON.parse(k.data))}catch{return U(new Error(`Input data given to '${k.source}' is not a valid GeoJSON object.`))}},0)}}getClusterExpansionZoom(k,U){try{U(null,this._geoJSONIndex.getClusterExpansionZoom(k.clusterId))}catch(W){U(W)}}getClusterChildren(k,U){try{U(null,this._geoJSONIndex.getChildren(k.clusterId))}catch(W){U(W)}}getClusterLeaves(k,U){try{U(null,this._geoJSONIndex.getLeaves(k.clusterId,
8k.limit,k.offset))}catch(W){U(W)}}}class Ou{constructor(k,U,W){this.tileID=new s.aQ(k.tileID.overscaledZ,k.tileID.wrap,k.tileID.canonical.z,k.tileID.canonical.x,k.tileID.canonical.y),this.tileZoom=k.tileZoom,this.uid=k.uid,this.zoom=k.zoom,this.canonical=k.tileID.canonical,this.pixelRatio=k.pixelRatio,this.tileSize=k.tileSize,this.source=k.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=k.projection,this.brightness=U,this.worldview=W}parse(k,U,W,ae){this.status="parsing";const Y=new s.aQ(W.tileID.overscaledZ,W.tileID.wrap,W.tileID.canonical.z,W.tileID.canonical.x,W.tileID.canonical.y),le=[],xe=U.familiesBySource[W.source],ue=new s.fn(Y,W.promoteId);ue.bucketLayerIDs=[],ue.is3DTile=!0,s.fC(k).then(Te=>{if(!Te)return ae(new Error("Could not parse tile"));const Ne=Te.json.extensionsUsed&&Te.json.extensionsUsed.includes("MAPBOX_mesh_features")||Te.json.asset.extras&&Te.json.asset.extras.MAPBOX_mesh_features,Oe=Te.json.extensionsUsed&&Te.json.extensionsUsed.includes("EXT_meshopt_compression"),rt=new s.ac(this.zoom,{brightness:this.brightness,worldview:this.worldview});for(const ft in xe)for(const mt of xe[ft]){const At=mt[0];ue.bucketLayerIDs.push(mt.map(xt=>s.B(xt.id,xt.scope))),At.recalculate(rt,[]);const Dt=s.fD(Te,1/s.d7(W.tileID.canonical)),Tt=new s.fE(mt,Dt,Y,Ne,Oe,this.brightness,ue,this.worldview);Ne||(Tt.needsUpload=!0),le.push(Tt),Tt.evaluate(At)}this.status="done",ae(null,{buckets:le,featureIndex:ue,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})}).catch(Te=>ae(new Error(Te.message)))}}class al{constructor(k,U,W,ae,Y,le,xe,ue){this.actor=k,this.layerIndex=U,this.availableImages=W,this.availableModels=ae,this.brightness=xe,this.loading={},this.loaded={},this.worldview=ue}loadTile(k,U){const W=k.uid,ae=this.loading[W]=new Ou(k,this.brightness,this.worldview);s.bu(k.request,(Y,le)=>{const xe=!this.loading[W];return delete this.loading[W],xe||Y?(ae.status="done",xe||(this.loaded[W]=ae),U(Y)):le&&le.byteLength!==0?void ae.parse(le,this.layerIndex,k,(ue,Te)=>{ae.status="done",this.loaded=this.loaded||{},this.loaded[W]=ae,ue||!Te?U(ue):U(null,Te)}):(ae.status="done",this.loaded[W]=ae,U())})}reloadTile(k,U){const W=this.loaded,ae=k.uid;if(W&&W[ae]){const Y=W[ae];Y.projection=k.projection,Y.brightness=k.brightness;const le=(xe,ue)=>{Y.reloadCallback&&(delete Y.reloadCallback,this.loadTile(k,U)),U(xe,ue)};Y.status==="parsing"?Y.reloadCallback=le:Y.status==="done"&&this.loadTile(k,U)}}abortTile(k,U){const W=k.uid;this.loading[W]&&delete this.loading[W],U()}removeTile(k,U){const W=this.loaded,ae=k.uid;W&&W[ae]&&delete W[ae],U()}}class $t{constructor(k){this.self=k,this.actor=new s.fG(k,this),this.layerIndexes={},this.availableImages={},this.availableModels={},this.isSpriteLoaded={},this.imageRasterizer=new s.x,this.rtlPluginParsingListeners=[],this.projections={},this.defaultProjection=s.cm({name:"mercator"}),this.workerSourceTypes={vector:uo,geojson:Oo,"raster-dem":Ls,"raster-array":il,"batched-model":al},this.workerSources={},this.self.registerWorkerSource=(U,W)=>{if(this.workerSourceTypes[U])throw new Error(`Worker source with name "${U}" already registered.`);this.workerSourceTypes[U]=W},this.self.registerRTLTextPlugin=U=>{if(s.fH.isParsed())throw new Error("RTL text plugin already registered.");s.fH.setState({pluginStatus:s.fI.parsed,pluginURL:s.fH.getPluginURL()}),s.fH.applyArabicShaping=U.applyArabicShaping,s.fH.processBidirectionalText=U.processBidirectionalText,s.fH.processStyledBidirectionalText=U.processStyledBidirectionalText;for(const W of this.rtlPluginParsingListeners)W(null,!0);this.rtlPluginParsingListeners=[]}}clearCaches(k,U,W){delete this.layerIndexes[k],delete this.availableImages[k],delete this.availableModels[k],delete this.workerSources[k],W()}checkIfReady(k,U,W){W()}setReferrer(k,U){this.referrer=U}spriteLoaded(k,U){this.isSpriteLoaded[k]||(this.isSpriteLoaded[k]={});const{scope:W,isLoaded:ae}=U;if(this.isSpriteLoaded[k][W]=ae,this.workerSources[k]&&this.workerSources[k][W])for(const Y in this.workerSources[k][W]){const le=this.workerSources[k][W][Y];for(const xe in le){const ue=le[xe];ue instanceof uo&&(ue.isSpriteLoaded=ae,ue.fire(new s.z("isSpriteLoaded")))}}}setImages(k,U,W){this.availableImages[k]||(this.availableImages[k]={});const{scope:ae,images:Y}=U;if(this.availableImages[k][ae]=Y,this.workerSources[k]&&this.workerSources[k][ae]){for(const le in this.workerSources[k][ae]){const xe=this.workerSources[k][ae][le];for(const ue in xe)xe[ue].availableImages=Y}W()}else W()}setModels(k,{scope:U,models:W},ae){if(this.availableModels[k]||(this.availableModels[k]={}),this.availableModels[k][U]=W,this.workerSources[k]&&this.workerSources[k][U]){for(const Y in this.workerSources[k][U]){const le=this.workerSources[k][U][Y];for(const xe in le)le[xe].availableModels=W}ae()}else ae()}setProjection(k,U){this.projections[k]=s.cm(U)}setBrightness(k,U,W){this.brightness=U,W()}setWorldview(k,U,W){this.worldview=U,W()}setLayers(k,U,W){this.getLayerIndex(k,U.scope).replace(U.layers,U.options),W()}updateLayers(k,U,W){this.getLayerIndex(k,U.scope).update(U.layers,U.removedIds,U.options),W()}loadTile(k,U,W){U.projection=this.projections[k]||this.defaultProjection,this.getWorkerSource(k,U.type,U.source,U.scope).loadTile(U,W)}decodeRasterArray(k,U,W){this.getWorkerSource(k,U.type,U.source,U.scope).decodeRasterArray(U,W)}reloadTile(k,U,W){U.projection=this.projections[k]||this.defaultProjection,this.getWorkerSource(k,U.type,U.source,U.scope).reloadTile(U,W)}abortTile(k,U,W){this.getWorkerSource(k,U.type,U.source,U.scope).abortTile(U,W)}removeTile(k,U,W){this.getWorkerSource(k,U.type,U.source,U.scope).removeTile(U,W)}removeSource(k,U,W){if(!(this.workerSources[k]&&this.workerSources[k][U.scope]&&this.workerSources[k][U.scope][U.type]&&this.workerSources[k][U.scope][U.type][U.source]))return;const ae=this.workerSources[k][U.scope][U.type][U.source];delete this.workerSources[k][U.scope][U.type][U.source],ae.removeSource!==void 0?ae.removeSource(U,W):W()}loadWorkerSource(k,U,W){try{this.self.importScripts(U.url),W()}catch(ae){W(ae)}}syncRTLPluginState(k,U,W){if(s.fH.isParsed())W(null,!0);else if(s.fH.isParsing())this.rtlPluginParsingListeners.push(W);else try{s.fH.setState(U);const ae=s.fH.getPluginURL();!s.fH.isLoaded()||s.fH.isParsed()||s.fH.isParsing()||ae==null||(s.fH.setState({pluginStatus:s.fI.parsing,pluginURL:s.fH.getPluginURL()}),this.self.importScripts(ae),s.fH.isParsed()?W(null,!0):this.rtlPluginParsingListeners.push(W))}catch(ae){W(ae)}}setDracoUrl(k,U){this.dracoUrl=U}getAvailableImages(k,U){this.availableImages[k]||(this.availableImages[k]={});let W=this.availableImages[k][U];return W||(W=[]),W}getAvailableModels(k,U){this.availableModels[k]||(this.availableModels[k]={});let W=this.availableModels[k][U];return W||(W={}),W}getLayerIndex(k,U){this.layerIndexes[k]||(this.layerIndexes[k]={});let W=this.layerIndexes[k][U];return W||(W=this.layerIndexes[k][U]=new Yi,W.scope=U),W}getWorkerSource(k,U,W,ae){const Y=this.workerSources;return Y[k]||(Y[k]={}),Y[k][ae]||(Y[k][ae]={}),Y[k][ae][U]||(Y[k][ae][U]={}),this.isSpriteLoaded[k]||(this.isSpriteLoaded[k]={}),Y[k][ae][U][W]||(Y[k][ae][U][W]=new this.workerSourceTypes[U]({send:(le,xe,ue,Te,Ne,Oe)=>this.actor.send(le,xe,ue,k,Ne,Oe),scheduler:this.actor.scheduler},this.getLayerIndex(k,ae),this.getAvailableImages(k,ae),this.getAvailableModels(k,ae),this.isSpriteLoaded[k][ae],void 0,this.brightness,this.worldview)),Y[k][ae][U][W]}rasterizeImagesWorker(k,U,W){const ae=new Map;for(const[Y,{image:le,imageVariant:xe}]of U.tasks.entries()){const ue=this.imageRasterizer.rasterize(xe,le,U.scope,k);ae.set(Y,ue)}W(void 0,ae)}removeRasterizedImages(k,U,W){this.imageRasterizer.removeImagesFromCacheByIds(U.imageIds,U.scope,k),W()}enforceCacheSizeLimit(k,U){s.fJ(U)}getWorkerPerformanceMetrics(k,U,W){W(void 0,void 0)}}return s.fF(self)&&(self.worker=new $t(self)),$t}),Ye(["./shared"],function(s){var zt="3.18.1";const wt={create:"create",load:"load",fullLoad:"fullLoad"},Ui={mark(l){performance.mark(l)},measure(l,t,o){performance.measure(l,t,o)}};function Ht(l){const t=l.name.split("?")[0];return s.a(t)&&t.includes("mapbox-gl.js")?"javascript":s.a(t)&&t.includes("mapbox-gl.css")?"css":s.b(t)?"fontRange":s.c(t)?"sprite":s.i(t)?"style":s.d(t)?"tilejson":"other"}var Yi,lr={},Hn=(function(){if(Yi)return lr;function l(c){return!t(c)}function t(c){return typeof window>"u"||typeof document>"u"?"not a browser":(function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var p,m,y=new Blob([""],{type:"text/javascript"}),x=URL.createObjectURL(y);try{m=new Worker(x),p=!0}catch{p=!1}return m&&m.terminate(),URL.revokeObjectURL(x),p})()?(function(){var p=document.createElement("canvas");p.width=p.height=1;var m=p.getContext("2d");if(!m)return!1;var y=m.getImageData(0,0,1,1);return y&&y.width===p.width})()?(o[d=c&&c.failIfMajorPerformanceCaveat]===void 0&&(o[d]=(function(p){var m,y=(function(x){var T=document.createElement("canvas"),S=Object.create(l.webGLContextAttributes);return S.failIfMajorPerformanceCaveat=x,T.getContext("webgl2",S)})(p);if(!y)return!1;try{m=y.createShader(y.VERTEX_SHADER)}catch{return!1}return!(!m||y.isContextLost())&&(y.shaderSource(m,"void main() {}"),y.compileShader(m),y.getShaderParameter(m,y.COMPILE_STATUS)===!0)})(d)),o[d]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var d}Yi=1,lr.supported=l,lr.notSupportedReason=t;var o={};return l.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},lr})();function ni(l,t,o){const c=document.createElement(l);return t!=null&&(c.className=t),o&&o.appendChild(c),c}function Ei(l,t,o){const c=document.createElementNS("http://www.w3.org/2000/svg",l);for(const d of Object.keys(t))c.setAttributeNS(null,d,String(t[d]));return o&&o.appendChild(c),c}const $r=typeof document<"u"?document.documentElement&&document.documentElement.style:null,Ii=$r&&$r.userSelect!==void 0?"userSelect":"WebkitUserSelect";let _r;function Ji(){$r&&Ii&&(_r=$r[Ii],$r[Ii]="none")}function Lr(){$r&&Ii&&($r[Ii]=_r)}function Jn(l){l.preventDefault(),l.stopPropagation(),window.removeEventListener("click",Jn,!0)}function Qn(){window.addEventListener("click",Jn,!0),window.setTimeout(()=>{window.removeEventListener("click",Jn,!0)},0)}function uo(l,t){const o=l.getBoundingClientRect();return il(l,o,t)}function Ls(l,t){const o=l.getBoundingClientRect(),c=[];for(let d=0;d<t.length;d++)c.push(il(l,o,t[d]));return c}function tl(l){return/firefox/i.test(navigator.userAgent)&&/macintosh/i.test(navigator.userAgent)&&l.button===2&&l.ctrlKey?0:l.button}function il(l,t,o){const c=l.offsetWidth===t.width?1:l.offsetWidth/t.width;return new s.P((o.clientX-t.left)*c,(o.clientY-t.top)*c)}const rl="01",li="NO_ACCESS_TOKEN";class lc{constructor(t,o,c){this._transformRequestFn=t,this._customAccessToken=o,this._silenceAuthErrors=!!c,this._createSkuToken()}_createSkuToken(){const t=(function(){let o="";for(let c=0;c<10;c++)o+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",rl,o].join(""),tokenExpiresAt:Date.now()+432e5}})();this._skuToken=t.token,this._skuTokenExpiresAt=t.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(t,o){return this._transformRequestFn&&this._transformRequestFn(t,o)||{url:t}}normalizeStyleURL(t,o){if(!s.h(t))return t;const c=xi(t);return c.params.push(`sdk=js-${zt}`),c.path=`/styles/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||o)}normalizeGlyphsURL(t,o){if(!s.h(t))return t;const c=xi(t);return c.path=`/fonts/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||o)}normalizeModelURL(t,o){if(!s.h(t))return t;const c=xi(t);return c.path=`/models/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||o)}normalizeSourceURL(t,o,c,d){if(!s.h(t))return t;const p=xi(t);return p.path=`/v4/${p.authority}.json`,p.params.push("secure"),c&&p.params.push(`language=${c}`),d&&p.params.push(`worldview=${d}`),this._makeAPIURL(p,this._customAccessToken||o)}normalizeIconsetURL(t,o){const c=xi(t);return s.h(t)?(c.path=`/styles/v1${c.path}/iconset.pbf`,this._makeAPIURL(c,this._customAccessToken||o)):wi(c)}normalizeSpriteURL(t,o,c,d){const p=xi(t);return s.h(t)?(p.path=`/styles/v1${p.path}/sprite${o}${c}`,this._makeAPIURL(p,this._customAccessToken||d)):(p.path+=`${o}${c}`,wi(p))}normalizeTileURL(t,o,c){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!s.h(t))return t;const d=xi(t);d.path=d.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${o||c&&d.authority!=="raster"&&c===512?"@2x":""}${s.k.supported?".webp":"$1"}`),d.authority==="raster"?d.path=`/${s.e.RASTER_URL_PREFIX}${d.path}`:d.authority==="rasterarrays"?d.path=`/${s.e.RASTERARRAYS_URL_PREFIX}${d.path}`:d.authority==="3dtiles"?d.path=`/${s.e.TILES3D_URL_PREFIX}${d.path}`:(d.path=d.path.replace(/^.+\/v4\//,"/"),d.path=`/${s.e.TILE_URL_VERSION}${d.path}`);const p=this._customAccessToken||(function(m){for(const y of m){const x=y.match(/^access_token=(.*)$/);if(x)return x[1]}return null})(d.params)||s.e.ACCESS_TOKEN;return s.e.REQUIRE_ACCESS_TOKEN&&p&&this._skuToken&&d.params.push(`sku=${this._skuToken}`),this._makeAPIURL(d,p)}canonicalizeTileURL(t,o){const c=xi(t);if(!c.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!c.path.match(/\.[\w]+$/))return t;let d="mapbox://";c.path.match(/^\/raster\/v1\//)?d+=`raster/${c.path.replace(`/${s.e.RASTER_URL_PREFIX}/`,"")}`:c.path.match(/^\/rasterarrays\/v1\//)?d+=`rasterarrays/${c.path.replace(`/${s.e.RASTERARRAYS_URL_PREFIX}/`,"")}`:d+=`tiles/${c.path.replace(`/${s.e.TILE_URL_VERSION}/`,"")}`;let p=c.params;return o&&(p=p.filter(m=>!m.match(/^access_token=/))),p.length&&(d+=`?${p.join("&")}`),d}canonicalizeTileset(t,o){const c=!!o&&s.h(o),d=[];for(const p of t.tiles||[])s.j(p)?d.push(this.canonicalizeTileURL(p,c)):d.push(p);return d}_makeAPIURL(t,o){const c="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",d=xi(s.e.API_URL);if(t.protocol=d.protocol,t.authority=d.authority,t.protocol==="http"){const p=t.params.indexOf("secure");p>=0&&t.params.splice(p,1)}if(d.path!=="/"&&(t.path=`${d.path}${t.path}`),!s.e.REQUIRE_ACCESS_TOKEN)return wi(t);if(o=o||s.e.ACCESS_TOKEN,!this._silenceAuthErrors){if(!o)throw new Error(`An API access token is required to use Mapbox GL. ${c}`);
8if(o[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${c}`)}return t.params=t.params.filter(p=>p.indexOf("access_token")===-1),t.params.push(`access_token=${o||""}`),wi(t)}}const gn=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function xi(l){const t=l.match(gn);if(!t)throw new Error("Unable to parse URL object");return{protocol:t[1],authority:t[2],path:t[3]||"/",params:t[4]?t[4].split("&"):[]}}function wi(l){const t=l.params.length?`?${l.params.join("&")}`:"";return`${l.protocol}://${l.authority}${l.path}${t}`}const nr="mapbox.eventData";function ho(l){if(!l)return null;const t=l.split(".");if(!t||t.length!==3)return null;try{return JSON.parse(s.l(t[1]))}catch{return null}}class eo{constructor(t){this.type=t,this.anonId=null,this.anonIdTimestamp=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(t){const o=ho(s.e.ACCESS_TOKEN);let c="";return c=o&&o.u?s.f(o.u):s.e.ACCESS_TOKEN||"",t?`${nr}.${t}:${c}`:`${nr}:${c}`}fetchEventData(){const t=s.s("localStorage"),o=this.getStorageKey(),c=this.getStorageKey("uuid"),d=this.getStorageKey("uuidTimestamp");if(t)try{const p=localStorage.getItem(o);p&&(this.eventData=JSON.parse(p));const m=localStorage.getItem(c);m&&(this.anonId=m);const y=localStorage.getItem(d);y&&(this.anonIdTimestamp=Number(y));const x=Date.now()-864e5;(!this.anonIdTimestamp||this.anonIdTimestamp<x)&&this.refreshUUID()}catch{s.w("Unable to read from LocalStorage")}}refreshUUID(){this.anonId=s.u(),this.anonIdTimestamp=Date.now()}saveEventData(){const t=s.s("localStorage"),o=this.getStorageKey(),c=this.getStorageKey("uuid"),d=this.getStorageKey("uuidTimestamp"),p=this.anonId,m=this.anonIdTimestamp;if(t&&p)try{localStorage.setItem(c,p),Object.keys(this.eventData).length>=1&&localStorage.setItem(o,JSON.stringify(this.eventData)),m&&localStorage.setItem(d,m.toString())}catch{s.w("Unable to write to LocalStorage")}}processRequests(t){}postEvent(t,o,c,d){if(!s.e.EVENTS_URL)return;const p=xi(s.e.EVENTS_URL);p.params.push(`access_token=${d||s.e.ACCESS_TOKEN||""}`);const m={event:this.type,created:new Date(t).toISOString()},y=o?Object.assign(m,o):m,x={url:wi(p),headers:{"Content-Type":"text/plain"},body:JSON.stringify([y])};this.pendingRequest=s.p(x,T=>{this.pendingRequest=null,c(T),this.saveEventData(),this.processRequests(d)})}queueRequest(t,o){this.queue.push(t),this.processRequests(o)}}class fo extends eo{constructor(t){super("metrics"),t&&(this.data=t)}postMetricsEvent(t){if(!s.e.EVENTS_URL||!t&&!s.e.ACCESS_TOKEN)return;this.anonId||this.fetchEventData(),s.v(this.anonId)||this.refreshUUID();const o=Object.assign({},this.data,{sessionId:this.anonId});this.queueRequest({timestamp:Date.now(),payload:o},t)}processRequests(t){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:o,payload:c}=this.queue.shift();this.postEvent(o,c,()=>{},t)}}const to=new class extends eo{constructor(l){super("appUserTurnstile"),this._customAccessToken=l}postTurnstileEvent(l,t){s.e.EVENTS_URL&&s.e.ACCESS_TOKEN&&Array.isArray(l)&&l.some(o=>s.h(o)||s.j(o))&&this.queueRequest(Date.now(),t)}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.anonIdTimestamp&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const t=ho(s.e.ACCESS_TOKEN),o=t?t.u:s.e.ACCESS_TOKEN;let c=o!==this.eventData.tokenU;s.v(this.anonId)||(this.refreshUUID(),c=!0);const d=this.queue.shift();if(this.eventData.lastSuccess){const p=new Date(this.eventData.lastSuccess),m=new Date(d),y=(d-this.eventData.lastSuccess)/864e5;c=c||y>=1||y<-1||p.getDate()!==m.getDate()}else c=!0;c?this.postEvent(d,{sdkIdentifier:"mapbox-gl-js",sdkVersion:zt,skuId:rl,"enabled.telemetry":!1,userId:this.anonId},p=>{p||(this.eventData.lastSuccess=d,this.eventData.tokenU=o)},l):this.processRequests()}},ki=to.postTurnstileEvent.bind(to),Mn=new class extends eo{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(l,t,o,c){this.skuToken=t,this.errorCb=c,s.e.EVENTS_URL&&(o||s.e.ACCESS_TOKEN?this.queueRequest({id:l,timestamp:Date.now()},o):this.errorCb(new Error(li)))}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{id:t,timestamp:o}=this.queue.shift();t&&this.success[t]||(this.anonId&&this.anonIdTimestamp||this.fetchEventData(),s.v(this.anonId)||this.refreshUUID(),this.postEvent(o,{sdkIdentifier:"mapbox-gl-js",sdkVersion:zt,skuId:rl,skuToken:this.skuToken,userId:this.anonId},c=>{c?this.errorCb(c):t&&(this.success[t]=!0)},l))}remove(){this.errorCb=null}},cc=Mn.postMapLoadEvent.bind(Mn),nl=new class extends eo{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(l){let t=this.mapInstanceIdMap.get(l);return t||(t=s.u(),this.mapInstanceIdMap.set(l,t)),t}getEventId(l){const t=this.eventIdPerMapInstanceMap.get(l)||0;return this.eventIdPerMapInstanceMap.set(l,t+1),t}postStyleLoadEvent(l,t){const{map:o,style:c,importedStyles:d}=t;if(!s.e.EVENTS_URL||!l&&!s.e.ACCESS_TOKEN)return;const p=this.getMapInstanceId(o),m={mapInstanceId:p,eventId:this.getEventId(p),style:c};d.length&&(m.importedStyles=d),this.queueRequest({timestamp:Date.now(),payload:m},l)}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:t,payload:o}=this.queue.shift();this.postEvent(t,o,()=>{},l)}},uc=nl.postStyleLoadEvent.bind(nl),Qo=new fo({attributes:[{name:"maps/js/layer
8-animations/style-with-appearances"}]}),mi=Qo.postMetricsEvent.bind(Qo),Gi=new fo({attributes:[{name:"maps/js/layer-animations/runtime-appearances"}]}),Fr=Gi.postMetricsEvent.bind(Gi),Fs=new class extends eo{constructor(){super("gljs.performance")}postPerformanceEvent(l,t){s.e.EVENTS_URL&&(l||s.e.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:t},l)}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:t,performanceData:o}=this.queue.shift(),c=(function(d){const p=performance.getEntriesByType("resource"),m=performance.getEntriesByType("mark"),y=(function(C){const L={};if(C){for(const z in C)if(z!=="other")for(const O of C[z]){const N=`${z}ResolveRangeMin`,q=`${z}ResolveRangeMax`,G=`${z}RequestCount`,j=`${z}RequestCachedCount`;L[N]=Math.min(L[N]||1/0,O.startTime),L[q]=Math.max(L[q]||-1/0,O.responseEnd);const ie=Q=>{L[Q]===void 0&&(L[Q]=0),++L[Q]};O.transferSize!==void 0&&O.transferSize===0&&ie(j),ie(G)}}return L})((function(C,L){const z={};if(C)for(const O of C){const N=L(O);z[N]===void 0&&(z[N]=[]),z[N].push(O)}return z})(p,Ht)),x=window.devicePixelRatio,T=navigator.connection||navigator.mozConnection||navigator.webkitConnection,S=T?T.effectiveType:void 0,M={counters:[],metadata:[],attributes:[]},A=(C,L,z)=>{z!=null&&C.push({name:L,value:z.toString()})};for(const C in y)A(M.counters,C,y[C]);if(d.interactionRange[0]!==1/0&&d.interactionRange[1]!==-1/0&&(A(M.counters,"interactionRangeMin",d.interactionRange[0]),A(M.counters,"interactionRangeMax",d.interactionRange[1])),m)for(const C of Object.values(wt)){const L=m.find(z=>z.name===C);L&&A(M.counters,C,L.startTime)}return A(M.counters,"visibilityHidden",d.visibilityHidden),A(M.attributes,"style",(function(C){if(C)for(const L of C){const z=L.name.split("?")[0];if(s.i(z)){const O=z.split("/").slice(-2);if(O.length===2)return`mapbox://styles/${O[0]}/${O[1]}`}}})(p)),A(M.attributes,"terrainEnabled",d.terrainEnabled?"true":"false"),A(M.attributes,"fogEnabled",d.fogEnabled?"true":"false"),A(M.attributes,"projection",d.projection),A(M.attributes,"zoom",d.zoom),A(M.metadata,"devicePixelRatio",x),A(M.metadata,"connectionEffectiveType",S),A(M.metadata,"navigatorUserAgent",navigator.userAgent),A(M.metadata,"screenWidth",window.screen.width),A(M.metadata,"screenHeight",window.screen.height),A(M.metadata,"windowWidth",window.innerWidth),A(M.metadata,"windowHeight",window.innerHeight),A(M.metadata,"mapWidth",d.width/x),A(M.metadata,"mapHeight",d.height/x),A(M.metadata,"webglRenderer",d.renderer),A(M.metadata,"webglVendor",d.vendor),A(M.metadata,"sdkVersion",zt),A(M.metadata,"sdkIdentifier","mapbox-gl-js"),M})(o);for(const d of c.metadata);for(const d of c.counters);for(const d of c.attributes);this.postEvent(t,c,()=>{},l)}},Qi=Fs.postPerformanceEvent.bind(Fs),es=new class extends eo{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(l,t,o,c){if(!s.e.API_URL||!s.e.SESSION_PATH)return;const d=xi(s.e.API_URL+s.e.SESSION_PATH);d.params.push(`sku=${t||""}`),d.params.push(`access_token=${c||s.e.ACCESS_TOKEN||""}`);const p={url:wi(d),headers:{"Content-Type":"text/plain"}};this.pendingRequest=s.g(p,m=>{this.pendingRequest=null,o(m),this.saveEventData(),this.processRequests(c)})}getSessionAPI(l,t,o,c){this.skuToken=t,this.errorCb=c,s.e.SESSION_PATH&&s.e.API_URL&&(o||s.e.ACCESS_TOKEN?this.queueRequest({id:l,timestamp:Date.now()},o):this.errorCb(new Error(li)))}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{id:t,timestamp:o}=this.queue.shift();t&&this.success[t]||this.getSession(o,this.skuToken,c=>{c?this.errorCb(c):t&&(this.success[t]=!0)},l)}remove(){this.errorCb=null}},ts=es.getSessionAPI.bind(es),Os=new Set;function io(l,t){t?Os.add(l):Os.delete(l)}class tr{constructor(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps=new Set,this._updatedImages={}}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(t,o){this._updatedSourceCaches[t]=o,this.setDirty()}discardSourceCacheUpdate(t){delete this._updatedSourceCaches[t]}updateLayer(t){const o=t.scope;this._updatedLayers[o]=this._updatedLayers[o]||new Set,this._updatedLayers[o].add(t.id),this.setDirty()}removeLayer(t){const o=t.scope;this._removedLayers[o]=this._removedLayers[o]||{},this._updatedLayers[o]=this._updatedLayers[o]||new Set,this._removedLayers[o][t.id]=t,this._updatedLayers[o].delete(t.id),this._updatedPaintProps.delete(t.fqid),this.setDirty()}getRemovedLayer(t){return this._removedLayers[t.scope]?this._removedLayers[t.scope][t.id]:null}discardLayerRemoval(t){this._removedLayers[t.scope]&&delete this._removedLayers[t.scope][t.id]}getLayerUpdatesByScope(){const t={};for(const o in this._updatedLayers)t[o]=t[o]||{},t[o].updatedIds=Array.from(this._updatedLayers[o].values());for(const o in this._removedLayers)t[o]=t[o]||{},t[o].removedIds=Object.keys(this._removedLayers[o]);return t}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(t){this._updatedPaintProps.add(t.fqid),this.setDirty()}getUpdatedImages(t){return this._updatedImages[t]?Array.from(this._updatedImages[t].values()):[]}updateImage(t,o){this._updatedImages[o]=this._updatedImages[o]||new Set,this._updatedImages[o].add(s.I.toString(t)),this.setDirty()}resetUpdatedImages(t){this._updatedImages[t]&&this._updatedImages[t].clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages={}}}function la(l){const{userImage:t}=l;return!!(t&&t.render&&t.render())&&(l.data.replace(new Uint8Array(t.data.buffer)),!0)}class is extends s.E{constructor(t){super(),this.imageProviders=new Map,this.images=new Map,this.updatedImages=new Map,this.callbackDispatchedThisFrame=new Map,this.loaded=new Map,this.requestors=[],this.patterns=new Map,this.patternsInFlight=new Set,this.atlasImage=new Map,this.atlasTexture=new Map,this.dirty=!0,this.spriteFormat=t,t!=="raster"&&s.r()&&(this.imageRasterizerDispatcher=new s.D(s.t(),this,"Image Rasterizer Worker",1))}addScope(t){this.loaded.set(t,!1),this.imageProviders.set(t,new Map),this.images.set(t,new Map),this.updatedImages.set(t,new Set),this.callbackDispatchedThisFrame.set(t,new Set),this.patterns.set(t,new Map),this.atlasImage.set(t,new s.q({width:1,height:1}))}removeScope(t){this.loaded.delete(t),this.imageProviders.delete(t),this.images.delete(t),this.updatedImages.delete(t),this.callbackDispatchedThisFrame.delete(t),this.patterns.delete(t),this.atlasImage.delete(t);const o=this.atlasTexture.get(t);o&&(o.destroy(),this.atlasTexture.delete(t))}addImageProvider(t,o){this.imageProviders.has(o)||this.imageProviders.set(o,new Map),this.imageProviders.get(o).set(t.id,t)}removeImageProvider(t,o){this.imageProviders.has(o)&&this.imageProviders.get(o).delete(t)}getPendingImageProviders(){const t=[];for(const o of this.imageProviders.values())for(const c of o.values())c.hasPendingRequests()&&t.push(c);return t}get imageRasterizer(){return this._imageRasterizer||(this._imageRasterizer=new s.x),this._imageRasterizer}isLoaded(){for(const t of this.loaded.keys())if(!this.loaded.get(t))return!1;return!0}setLoaded(t,o){if(this.loaded.get(o)!==t&&(this.loaded.set(o,t),t)){for(const{ids:c,callback:d}of this.requestors)this._notify(c,o,d);this.requestors=[]}}hasImage(t,o){return!!this.getImage(t,o)}getImage(t,o){return this.images.get(o).get(t.toString())}
8addImage(t,o,c){this._validate(t,c)&&this.images.get(o).set(t.toString(),c)}_validate(t,o){let c=!0;return this._validateStretch(o.stretchX,o.data&&o.data.width)||(this.fire(new s.y(new Error(`Image "${t.name}" has invalid "stretchX" value`))),c=!1),this._validateStretch(o.stretchY,o.data&&o.data.height)||(this.fire(new s.y(new Error(`Image "${t.name}" has invalid "stretchY" value`))),c=!1),this._validateContent(o.content,o)||(this.fire(new s.y(new Error(`Image "${t.name}" has invalid "content" value`))),c=!1),c}_validateStretch(t,o){if(!t)return!0;let c=0;for(const d of t){if(d[0]<c||d[1]<d[0]||o<d[1])return!1;c=d[1]}return!0}_validateContent(t,o){return t?t.length!==4||!o.usvg&&(t[0]<0||o.data.width<t[0]||t[1]<0||o.data.height<t[1]||t[2]<0||o.data.width<t[2]||t[3]<0||o.data.height<t[3])?!1:!(t[2]<t[0]||t[3]<t[1]):!0}updateImage(t,o,c){const d=this.images.get(o).get(t.toString());c.version=d.version+1,this.images.get(o).set(t.toString(),c),this.updatedImages.get(o).add(t),this.removeFromImageRasterizerCache(t,o)}clearUpdatedImages(t){this.updatedImages.get(t).clear()}removeFromImageRasterizerCache(t,o){this.spriteFormat!=="raster"&&(s.r()?this.imageRasterizerDispatcher.getActor().send("removeRasterizedImages",{imageIds:[t],scope:o}):this.imageRasterizer.removeImagesFromCacheByIds([t],o))}removeImage(t,o){const c=this.images.get(o),d=c.get(t.toString());c.delete(t.toString()),this.patterns.get(o).delete(t.toString()),this.removeFromImageRasterizerCache(t,o),d.userImage&&d.userImage.onRemove&&d.userImage.onRemove()}listImages(t){return Array.from(this.images.get(t).keys()).map(o=>s.I.from(o))}getImages(t,o,c){const d=[],p=[],m=this.imageProviders.get(o);for(const S of t){if(!S.iconsetId){d.push(S);continue}const M=m.get(S.iconsetId);M&&(this.getImage(S,o)?p.push(S):M.addPendingRequest(S))}if(d.length===0)return void this._notify(p,o,c);let y=!0;const x=!!this.loaded.get(o),T=this.images.get(o);if(!x)for(const S of d)T.has(S.toString())||(y=!1);x||y?this._notify(d,o,c):this.requestors.push({ids:d,scope:o,callback:c})}rasterizeImages(t,o){const c=new Map,{tasks:d,scope:p}=t;for(const[m,y]of d.entries()){const x=this.getImage(y.id,p);x&&c.set(m,{image:x,imageVariant:y})}this._rasterizeImages(p,c,o)}_rasterizeImages(t,o,c){if(s.r())this.imageRasterizerDispatcher.getActor().send("rasterizeImagesWorker",{tasks:o,scope:t},c);else{const d=new Map;for(const[p,{image:m,imageVariant:y}]of o.entries())d.set(p,this.imageRasterizer.rasterize(y,m,t,0));c(void 0,d)}}getUpdatedImages(t){return this.updatedImages.get(t)||new Set}_notify(t,o,c){const d=this.images.get(o),p=new Map;for(const m of t){if(!d.get(m.toString())){if(m.iconsetId)continue;this.fire(new s.z("styleimagemissing",{id:m.name}))}const y=d.get(m.toString());if(!y){s.w(`Image "${m.name}" 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.`);continue}const x={data:y.usvg?null:y.data.clone(),pixelRatio:y.pixelRatio,sdf:y.sdf,usvg:y.usvg,version:y.version,stretchX:y.stretchX,stretchY:y.stretchY,content:y.content,hasRenderCallback:!!(y.userImage&&y.userImage.render)};y.usvg&&Object.assign(x,{width:y.icon.usvg_tree.width,height:y.icon.usvg_tree.height}),p.set(s.I.toString(m),x)}c(null,p)}getPixelSize(t){const{width:o,height:c}=this.atlasImage.get(t);return{width:o,height:c}}getPattern(t,o,c){const d=t.toString(),p=this.patterns.get(o),m=p.get(d),y=this.getImage(t,o);if(!y)return null;if(m){if(m.position.version===y.version)return m.position;m.position.version=y.version}else{if(y.usvg&&!y.data){const x=this.getPatternInFlightId(d,o);if(this.patternsInFlight.has(x))return null;this.patternsInFlight.add(x);const T=new s.A(t).scaleSelf(s.o.devicePixelRatio),S=new Map([[T.toString(),{image:y,imageVariant:T}]]);return this._rasterizeImages(o,S,(M,A)=>this.storePatternImage(T,o,y,c,A)),null}this.storePattern(t,o,y)}return this._updatePatternAtlas(o,c),p.get(d).position}getPatternInFlightId(t,o){return s.B(t,o)}hasPatternsInFlight(){return this.patternsInFlight.size!==0}storePatternImage(t,o,c,d,p){const m=t.toString(),y=p?p.get(m):void 0;y&&(c.data=y,this.storePattern(t.id,o,c),this._updatePatternAtlas(o,d),this.patternsInFlight.delete(this.getPatternInFlightId(t.id.toString(),o)))}storePattern(t,o,c){const d={w:c.data.width+2*s.C,h:c.data.height+2*s.C,x:0,y:0},p=new s.F(d,c,s.C);this.patterns.get(o).set(t.toString(),{bin:d,position:p})}destroyAtlasTextures(){for(const t of this.atlasTexture.values())t&&t.destroy();this.atlasTexture.clear()}bind(t,o){const c=t.gl;let d=this.atlasTexture.get(o);d?this.dirty&&(d.update(this.atlasImage.get(o)),this.dirty=!1):(d=new s.T(t,this.atlasImage.get(o),c.RGBA8),this.atlasTexture.set(o,d)),d.bind(c.LINEAR,c.CLAMP_TO_EDGE)}_updatePatternAtlas(t,o){const c=this.patterns.get(t),d=Array.from(c.values()).map(({bin:T})=>T),{w:p,h:m}=s.G(d),y=this.atlasImage.get(t);y.resize({width:p||1,height:m||1});const x=this.images.get(t);for(const[T,{bin:S,position:M}]of c.entries()){let A=M.padding;const C=S.x+A,L=S.y+A,z=x.get(T).data,O=z.width,N=z.height;A=A>1?A-1:A,s.q.copy(z,y,{x:0,y:0},{x:C,y:L},{width:O,height:N},o),s.q.copy(z,y,{x:0,y:N-A},{x:C,y:L-A},{width:O,height:A},o),s.q.copy(z,y,{x:0,y:0},{x:C,y:L+N},{width:O,height:A},o),s.q.copy(z,y,{x:O-A,y:0},{x:C-A,y:L},{width:A,height:N},o),s.q.copy(z,y,{x:0,y:0},{x:C+O,y:L},{width:A,height:N},o),s.q.copy(z,y,{x:O-A,y:N-A},{x:C-A,y:L-A},{width:A,height:A},o),s.q.copy(z,y,{x:0,y:N-A},{x:C+O,y:L-A},{width:A,height:A},o),s.q.copy(z,y,{x:0,y:0},{x:C+O,y:L+N},{width:A,height:A},o),s.q.copy(z,y,{x:O-A,y:0},{x:C-A,y:L+N},{width:A,height:A},o)}this.dirty=!0}beginFrame(){for(const t of this.images.keys())this.callbackDispatchedThisFrame.set(t,new Set)}
8dispatchRenderCallbacks(t,o){const c=this.images.get(o);for(const d of t){if(this.callbackDispatchedThisFrame.get(o).has(d.toString()))continue;this.callbackDispatchedThisFrame.get(o).add(d.toString());const p=c.get(d.toString());la(p)&&this.updateImage(d,o,p)}}destroy(){this.imageRasterizerDispatcher&&this.imageRasterizerDispatcher.remove()}}function ca(l){const t=l.value,o=l.valueSpec,c=l.style,d=l.styleSpec,p=l.key,m=l.arrayElementValidator||Ai;if(!Array.isArray(t))return[new s.V(p,t,`array expected, ${s.K(t)} found`)];if(o.length&&t.length!==o.length)return[new s.V(p,t,`array length ${o.length} expected, length ${t.length} found`)];if(o["min-length"]&&t.length<o["min-length"])return[new s.V(p,t,`array length at least ${o["min-length"]} expected, length ${t.length} found`)];let y={type:o.value,values:o.values,minimum:o.minimum,maximum:o.maximum,function:void 0};d.$version<7&&(y.function=o.function),s.H(o.value)&&(y=o.value);let x=[];for(let T=0;T<t.length;T++)x=x.concat(m({array:t,arrayIndex:T,value:t[T],valueSpec:y,style:c,styleSpec:d,key:`${p}[${T}]`},!0));return x}function ks(l){const t=l.key,o=l.value,c=l.valueSpec;if(!s.L(o))return[new s.V(t,o,`number expected, ${s.K(o)} found`)];if(o!=o)return[new s.V(t,o,"number expected, NaN found")];if("minimum"in c){let d=c.minimum;if(Array.isArray(c.minimum)&&(d=c.minimum[l.arrayIndex]),o<d)return[new s.V(t,o,`${o} is less than the minimum value ${d}`)]}if("maximum"in c){let d=c.maximum;if(Array.isArray(c.maximum)&&(d=c.maximum[l.arrayIndex]),o>d)return[new s.V(t,o,`${o} is greater than the maximum value ${d}`)]}return[]}function ol(l){const t=l.key,o=l.value;if(!s.H(o))return[new s.V(t,o,`object expected, ${s.K(o)} found`)];const c=l.valueSpec,d=s.J(o.type);let p,m,y,x={};const T=d!=="categorical"&&o.property===void 0,S=!T,M=(function(z){const O=z.stops;return Array.isArray(O)&&Array.isArray(O[0])&&s.H(O[0][0])})(o),A=Rr({key:l.key,value:l.value,valueSpec:l.styleSpec.function,style:l.style,styleSpec:l.styleSpec,objectElementValidators:{stops:function(z){if(d==="identity")return[new s.V(z.key,z.value,'identity function may not have a "stops" property')];let O=[];const N=z.value;return O=O.concat(ca({key:z.key,value:N,valueSpec:z.valueSpec,style:z.style,styleSpec:z.styleSpec,arrayElementValidator:C})),Array.isArray(N)&&N.length===0&&O.push(new s.V(z.key,N,"array must have at least one stop")),O},default:function(z){return Ai({key:z.key,value:z.value,valueSpec:c,style:z.style,styleSpec:z.styleSpec})}}});return d==="identity"&&T&&A.push(new s.V(l.key,l.value,'missing required property "property"')),d==="identity"||o.stops||A.push(new s.V(l.key,l.value,'missing required property "stops"')),d==="exponential"&&c.expression&&!s.M(c)&&A.push(new s.V(l.key,l.value,"exponential functions not supported")),l.styleSpec.$version>=8&&(S&&!s.N(c)?A.push(new s.V(l.key,l.value,"property functions not supported")):T&&!s.O(c)&&A.push(new s.V(l.key,l.value,"zoom functions not supported"))),d!=="categorical"&&!M||o.property!==void 0||A.push(new s.V(l.key,l.value,'"property" property is required')),A;function C(z){let O=[];const N=z.value,q=z.key;if(!Array.isArray(N))return[new s.V(q,N,`array expected, ${s.K(N)} found`)];if(N.length!==2)return[new s.V(q,N,`array length 2 expected, length ${N.length} found`)];if(M){if(!s.H(N[0]))return[new s.V(q,N,`object expected, ${s.K(N[0])} found`)];const G=N[0];if(G.zoom===void 0)return[new s.V(q,N,"object stop key must have zoom")];if(G.value===void 0)return[new s.V(q,N,"object stop key must have value")];const j=s.J(G.zoom);if(typeof j!="number")return[new s.V(q,G.zoom,"stop zoom values must be numbers")];if(y&&y>j)return[new s.V(q,G.zoom,"stop zoom values must appear in ascending order")];j!==y&&(y=j,m=void 0,x={}),O=O.concat(Rr({key:`${q}[0]`,value:N[0],valueSpec:{zoom:{}},style:z.style,styleSpec:z.styleSpec,objectElementValidators:{zoom:ks,value:L}}))}else O=O.concat(L({key:`${q}[0]`,value:N[0],style:z.style,styleSpec:z.styleSpec},N));return s.Q(s.S(N[1]))?O.concat([new s.V(`${q}[1]`,N[1],"expressions are not allowed in function stops.")]):O.concat(Ai({key:`${q}[1]`,value:N[1],valueSpec:c,style:z.style,styleSpec:z.styleSpec}))}function L(z,O){const N=s.K(z.value),q=s.J(z.value),G=z.value!==null?z.value:O;if(p){if(N!==p)return[new s.V(z.key,G,`${N} stop domain type must match previous stop domain type ${p}`)]}else p=N;
8if(N!=="number"&&N!=="string"&&N!=="boolean"&&typeof q!="number"&&typeof q!="string"&&typeof q!="boolean")return[new s.V(z.key,G,"stop domain value must be a number, string, or boolean")];if(N!=="number"&&d!=="categorical"){let j=`number expected, ${N} found`;return s.N(c)&&d===void 0&&(j+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new s.V(z.key,G,j)]}return d!=="categorical"||N!=="number"||typeof q=="number"&&isFinite(q)&&Math.floor(q)===q?d!=="categorical"&&N==="number"&&typeof q=="number"&&typeof m=="number"&&m!==void 0&&q<m?[new s.V(z.key,G,"stop domain values must appear in ascending order")]:(m=q,d==="categorical"&&q in x?[new s.V(z.key,G,"stop domain values must be unique")]:(x[q]=!0,[])):[new s.V(z.key,G,`integer expected, found ${String(q)}`)]}}function yn(l){const t=(l.expressionContext==="property"?s.W:s.U)(s.S(l.value),l.valueSpec);if(t.result==="error")return t.value.map(c=>new s.V(`${l.key}${c.key}`,l.value,c.message));const o=t.value.expression||t.value._styleExpression.expression;if(l.expressionContext==="property"&&l.propertyKey==="text-font"&&!o.outputDefined())return[new s.V(l.key,l.value,`Invalid data expression for "${l.propertyKey}". Output values must be contained as literals within the expression.`)];if(l.expressionContext==="property"&&l.propertyType==="layout"&&!s.Z(o))return[new s.V(l.key,l.value,'"feature-state" data expressions are not supported with layout properties.')];if(l.expressionContext==="filter")return an(o,l);if(l.expressionContext==="appearance")return Po(o,l);if(l.expressionContext&&l.expressionContext.indexOf("cluster")===0){if(!s.X(o,["zoom","feature-state"]))return[new s.V(l.key,l.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(l.expressionContext==="cluster-initial"&&!s.Y(o))return[new s.V(l.key,l.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function an(l,t){const o=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(t.valueSpec&&t.valueSpec.expression)for(const d of t.valueSpec.expression.parameters)o.delete(d);if(o.size===0)return[];const c=[];return l instanceof s._&&o.has(l.name)?[new s.V(t.key,t.value,`["${l.name}"] expression is not supported in a filter for a ${t.object.type} layer with id: ${t.object.id}`)]:(l.eachChild(d=>{c.push(...an(d,t))}),c)}function Po(l,t){const o=new Set;if(t.valueSpec&&t.valueSpec.expression)for(const d of t.valueSpec.expression.parameters)o.add(d);if(o.size===0)return[];const c=[];return l instanceof s._&&!o.has(l.name)?[new s.V(t.key,t.value,`["${l.name}"] is not an allowed parameter`)]:(l.eachChild(d=>{c.push(...Po(d,t))}),c)}function Ro(l){const t=l.key,o=l.value,c=l.valueSpec,d=[];return Array.isArray(c.values)?c.values.indexOf(s.J(o))===-1&&d.push(new s.V(t,o,`expected one of [${c.values.join(", ")}], ${JSON.stringify(o)} found`)):Object.keys(c.values).indexOf(s.J(o))===-1&&d.push(new s.V(t,o,`expected one of [${Object.keys(c.values).join(", ")}], ${JSON.stringify(o)} found`)),d}function rs(l){return s.a2(s.S(l.value))?yn(Object.assign({},l,{expressionContext:"filter",valueSpec:l.styleSpec[`filter_${l.layerType||"fill"}`]})):Bs(l)}function Bs(l){const t=l.value,o=l.key;if(!Array.isArray(t))return[new s.V(o,t,`array expected, ${s.K(t)} found`)];if(t.length<1)return[new s.V(o,t,"filter array must have at least 1 element")];const c=l.styleSpec;let d=Ro({key:`${o}[0]`,value:t[0],valueSpec:c.filter_operator});const p=()=>{t.length>=2&&(s.a0(t[1])||d.push(new s.V(`${o}[1]`,t[1],`string expected, ${s.K(t[1])} found`)));for(let m=2;m<t.length;m++)s.J(t[1])==="$type"?d=d.concat(Ro({key:`${o}[${m}]`,value:t[m],valueSpec:c.geometry_type})):s.a0(t[m])||s.L(t[m])||s.$(t[m])||d.push(new s.V(`${o}[${m}]`,t[m],`string, number, or boolean expected, ${s.K(t[m])} found.`))};switch(s.J(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&s.J(t[1])==="$type"&&d.push(new s.V(o,t,`"$type" cannot be use with operator "${t[0]}"`)),t.length!==3&&d.push(new s.V(o,t,`filter array for operator "${t[0]}" must have 3 elements`)),p();break;case"==":case"!=":t.length!==3&&d.push(new s.V(o,t,`filter array for operator "${t[0]}" must have 3 elements`)),p();break;case"in":case"!in":p();break;case"any":case"all":case"none":for(let m=1;m<t.length;m++)d=d.concat(Bs({key:`${o}[${m}]`,value:t[m],style:l.style,styleSpec:l.styleSpec}));break;case"has":case"!has":t.length!==2?d.push(new s.V(o,t,`filter array for "${t[0]}" operator must have 2 elements`)):s.a0(t[1])||d.push(new s.V(`${o}[1]`,t[1],`string expected, ${s.K(t[1])} found`))}return d}function Zr(l,t){const o=l.key,c=l.style,d=l.layer,p=l.styleSpec,m=l.value,y=l.objectKey,x=p[`${t}_${l.layerType}`];if(!x)return[];const T=y.match(/^(.*)-use-theme$/);if(T&&x[T[1]])return s.Q(s.S(m))?[].concat(Ai({key:o,value:m,valueSpec:{type:"string",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},style:c,styleSpec:p,expressionContext:"property",propertyType:t,propertyKey:y}
8)):Ai({key:o,value:m,valueSpec:{type:"string"},style:c,styleSpec:p});const S=y.match(/^(.*)-transition$/);if(t==="paint"&&S&&x[S[1]]&&x[S[1]].transition)return Ai({key:o,value:m,valueSpec:p.transition,style:c,styleSpec:p});const M=l.valueSpec||x[y];if(!M)return[new s.a3(o,m,`unknown property "${y}"`)];let A;if(s.a0(m)&&s.N(M)&&!M.tokens&&(A=/^{([^}]+)}$/.exec(m))){const L=`\`{ "type": "identity", "property": ${A?JSON.stringify(A[1]):'"_"'} }\``;return[new s.V(o,m,`"${y}" does not support interpolation syntax
9Use an identity property function instead: ${L}.`)]}const C=[];if(l.layerType==="symbol")y!=="text-field"||!c||c.glyphs||c.imports||C.push(new s.V(o,m,'use of "text-field" requires a style "glyphs" property')),y==="text-font"&&s.a4(s.S(m))&&s.J(m.type)==="identity"&&C.push(new s.V(o,m,'"text-font" does not support identity functions'));else if(l.layerType==="model"&&t==="paint"&&d&&d.layout&&d.layout.hasOwnProperty("model-id")&&s.N(M)&&(s.a5(M)||s.O(M))){const L=s.W(s.S(m),M).value,z="expression"in L&&L.expression||"_styleExpression"in L&&L._styleExpression&&L._styleExpression.expression;z&&!s.X(z,["measure-light"])&&(y==="model-emissive-strength"&&s.Y(z)&&s.Z(z)||C.push(new s.V(o,m,`${y} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return C.concat(Ai({key:l.key,value:m,valueSpec:M,style:c,styleSpec:p,expressionContext:"property",propertyType:t,propertyKey:y}))}function ua(l){return Zr(l,"paint")}function Cn(l){return Zr(l,"layout")}function sl(l){let t=[];const o=l.value,c=l.key,d=l.style,p=l.styleSpec;if(!s.H(o))return[new s.V(c,o,"object expected")];o.type||o.ref||t.push(new s.V(c,o,'either "type" or "ref" is required'));let m=s.J(o.type);const y=s.J(o.ref);if(o.id){const x=s.J(o.id);for(let T=0;T<l.arrayIndex;T++){const S=d.layers[T];s.J(S.id)===x&&t.push(new s.V(c,o.id,`duplicate layer id "${x}", previously used at line ${S.id.__line__}`))}}if("ref"in o){let x;["type","source","source-layer","filter","layout"].forEach(T=>{T in o&&t.push(new s.V(c,o[T],`"${T}" is prohibited for ref layers`))}),d.layers.forEach(T=>{s.J(T.id)===y&&(x=T)}),x?x.ref?t.push(new s.V(c,o.ref,"ref cannot reference another ref layer")):m=s.J(x.type):typeof y=="string"&&t.push(new s.V(c,o.ref,`ref layer "${y}" not found`))}else if(m!=="background"&&m!=="sky"&&m!=="slot")if(o.source)if(s.a0(o.source)){const x=d.sources&&d.sources[o.source],T=x&&s.J(x.type);x?T==="vector"&&m==="raster"?t.push(new s.V(c,o.source,`layer "${o.id}" requires a raster source`)):T==="raster"&&m!=="raster"?t.push(new s.V(c,o.source,`layer "${o.id}" requires a vector source`)):T!=="vector"||o["source-layer"]?T==="raster-dem"&&m!=="hillshade"?t.push(new s.V(c,o.source,"raster-dem source can only be used with layer type 'hillshade'.")):T!=="raster-array"||["raster","raster-particle"].includes(m)?m==="line"&&o.paint&&(o.paint["line-gradient"]||o.paint["line-trim-offset"])&&T==="geojson"&&!x.lineMetrics?t.push(new s.V(c,o,`layer "${o.id}" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):m==="raster-particle"&&T!=="raster-array"&&t.push(new s.V(c,o.source,`layer "${o.id}" requires a 'raster-array' source.`)):t.push(new s.V(c,o.source,"raster-array source can only be used with layer type 'raster'.")):t.push(new s.V(c,o,`layer "${o.id}" must specify a "source-layer"`)):t.push(new s.V(c,o.source,`source "${o.source}" not found`))}else t.push(new s.V(`${c}.source`,o.source,'"source" must be a string'));else t.push(new s.V(c,o,'missing required property "source"'));return t=t.concat(Rr({key:c,value:o,valueSpec:p.layer,style:l.style,styleSpec:l.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Ai({key:`${c}.type`,value:o.type,valueSpec:p.layer.type,style:l.style,styleSpec:l.styleSpec,object:o,objectKey:"type"}),filter:x=>rs(Object.assign({layerType:m},x)),layout:x=>Rr({layer:o,key:x.key,value:x.value,valueSpec:{},style:x.style,styleSpec:x.styleSpec,objectElementValidators:{"*":T=>Cn(Object.assign({layerType:m},T))}}),paint:x=>Rr({layer:o,key:x.key,value:x.value,valueSpec:{},style:x.style,styleSpec:x.styleSpec,objectElementValidators:{"*":T=>ua(Object.assign({layerType:m,layer:o},T))}}),appearances(x){const T=ca({key:x.key,value:x.value,valueSpec:x.valueSpec,style:x.style,styleSpec:x.styleSpec,arrayElementValidator:A=>(function(C){const{key:L,layer:z,layerType:O}=C,N=s.J(C.value),q=s.J(N.name),G=s.J(N.condition),j=Rr({key:L,value:N,valueSpec:C.styleSpec.appearance,style:C.style,styleSpec:C.styleSpec,objectElementValidators:{condition:ie=>(function(Q){const te=[];return te.push(...yn({key:Q.key,value:Q.object.condition,valueSpec:s.a6.appearance.condition,expressionContext:"appearance"})),te})(Object.assign({layer:z,layerType:O},ie)),properties:ie=>(function(Q){const te=[],{styleSpec:X,layer:Z,layerType:ne}=Q,ce=X[`paint_${ne}`],de=X[`layout_${ne}`],ve=Q.object[Q.objectKey];for(const ge in ve){const Me=ge in ce?"paint":ge in de?"layout":void 0;if(!Me){te.push(new s.V(Q.key,ge,`unknown property "${ge}" for layer type "${ne}"`));continue}const Fe=Object.assign({},Q,{key:`${Q.key}.${ge}`,object:ve,objectKey:ge,layer:Z,layerType:ne,value:ve[ge],valueSpec:Me==="paint"?ce[ge]:de[ge]});te.push(...Zr(Fe,Me))}return te})(Object.assign({layer:z,layerType:O},ie))}});return q!=="hidden"&&G===void 0&&j.push(new s.V(C.key,"name",'Appearance with name different than "hidden" must have a condition')),j})(Object.assign({layerType:m,layer:o},A))}),S=Array.isArray(x.value)?x.value:[],M=new Set;
9return S.forEach((A,C)=>{const L=s.J(A.name);if(L)if(M.has(L)){const z=s.J(o.id);T.push(new s.V(x.key,L,`Duplicated appearance name "${L}" for layer "${z}"`))}else M.add(L)}),T}}})),t}function zo({key:l,value:t}){return s.a0(t)?[]:[new s.V(l,t,`string expected, ${s.K(t)} found`)]}const Or={promoteId:function l({key:t,value:o}){if(s.a0(o))return zo({key:t,value:o});if(Array.isArray(o)){const d=[],p=s.S(o),m=s.U(p);return m.result==="error"&&m.value.forEach(y=>{d.push(new s.V(`${t}${y.key}`,null,`${y.message}`))}),s.X(m.value.expression,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])||d.push(new s.V(`${t}`,null,"promoteId expression should be only feature dependent")),d}if(!s.H(o))return[new s.V(t,o,`string, expression or object expected, "${s.K(o)}" found`)];const c=[];for(const d in o)c.push(...l({key:`${t}.${d}`,value:o[d]}));return c}};function Do(l){const t=l.value,o=l.key,c=l.styleSpec,d=l.style;if(!s.H(t))return[new s.V(o,t,`object expected, ${s.K(t)} found`)];if(!("type"in t))return[new s.V(o,t,'"type" is required')];const p=s.J(t.type);let m=[];switch(["vector","raster","raster-dem","raster-array"].includes(p)&&("url"in t||"tiles"in t||m.push(new s.a3(o,t,'Either "url" or "tiles" is required.'))),p){case"vector":case"raster":case"raster-dem":case"raster-array":return m=m.concat(Rr({key:o,value:t,valueSpec:c[`source_${p.replace("-","_")}`],style:l.style,styleSpec:c,objectElementValidators:Or})),m;case"geojson":if(m=Rr({key:o,value:t,valueSpec:c.source_geojson,style:d,styleSpec:c,objectElementValidators:Or}),"cluster"in t&&"clusterProperties"in t){if(!s.H(t.clusterProperties))return[new s.V(`${o}.clusterProperties`,t,`object expected, ${s.K(t)} found`)];for(const y in t.clusterProperties){const x=t.clusterProperties[y];if(!Array.isArray(x))return[new s.V(`${o}.clusterProperties.${y}`,x,"array expected")];const[T,S]=x,M=typeof T=="string"?[T,["accumulated"],["get",y]]:T;m.push(...yn({key:`${o}.${y}.map`,value:S,expressionContext:"cluster-map"})),m.push(...yn({key:`${o}.${y}.reduce`,value:M,expressionContext:"cluster-reduce"}))}}return m;case"video":return Rr({key:o,value:t,valueSpec:c.source_video,style:d,styleSpec:c});case"image":return Rr({key:o,value:t,valueSpec:c.source_image,style:d,styleSpec:c});case"canvas":return[new s.V(o,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Ro({key:`${o}.type`,value:t.type,valueSpec:{values:Lo(c)}})}}function Lo(l){return l.source.reduce((t,o)=>{const c=l[o];return c.type.type==="enum"&&(t=t.concat(Object.keys(c.type.values||{}))),t},[])}function ns(l){const t=l.value,o=l.styleSpec,c=o.light,d=l.style;if(t===void 0)return[];if(!s.H(t))return[new s.V("light",t,`object expected, ${s.K(t)} found`)];let p=[];for(const m in t){const y=m.match(/^(.*)-transition$/),x=m.match(/^(.*)-use-theme$/);p=p.concat(x&&c[x[1]]?Ai({key:m,value:t[m],valueSpec:{type:"string"},style:d,styleSpec:o}):y&&c[y[1]]&&c[y[1]].transition?Ai({key:m,value:t[m],valueSpec:o.transition,style:d,styleSpec:o}):c[m]?Ai({key:m,value:t[m],valueSpec:c[m],style:d,styleSpec:o}):[new s.V(m,t[m],`unknown property "${m}"`)])}return p}function Fo(l){const t=l.value;if(!t)return[];const o=l.key;if(!s.H(t))return[new s.V(o,t,`object expected, ${s.K(t)} found`)];let c=[];const d=l.styleSpec,p=d["light-3d"],m=l.style,y=l.style.lights;for(const S of["type","id"])if(!(S in t))return c=c.concat([new s.V(o,t,`missing property "${S}"`)]),c;if(!s.a0(t.type))return c=c.concat([new s.V(`${o}.type`,t.type,"string expected")]),c;if(y)for(let S=0;S<l.arrayIndex;S++){const M=s.J(t.type),A=y[S];s.J(A.type)===M&&c.push(new s.V(o,t.id,`duplicate light type "${t.type}", previously defined at line ${A.id.__line__}`))}const x=`properties_light_${t.type}`;if(!(x in d))return c=c.concat([new s.V(`${o}.type`,t,`Invalid light type ${t.type}`)]),c;const T=d[x];for(const S in t)if(S==="properties"){const M=t[S];if(!s.H(M))return c=c.concat([new s.V("properties",M,`object expected, ${s.K(M)} found`)]),c;for(const A in M){const C=A.match(/^(.*)-transition$/),L=A.match(/^(.*)-use-theme$/);c=c.concat(L&&T[L[1]]?Ai({key:S,value:M[A],valueSpec:{type:"string"},style:m,styleSpec:d}):C&&T[C[1]]&&T[C[1]].transition?Ai({key:S,value:t[S],valueSpec:d.transition,style:m,styleSpec:d}):T[A]?Ai({key:A,value:M[A],valueSpec:T[A],style:m,styleSpec:d}):[new s.a3(l.key,M[A],`unknown property "${A}"`)])}}else c=c.concat(p[S]?Ai({key:S,value:t[S],valueSpec:p[S],style:m,styleSpec:d}):[new s.a3(S,t[S],`unknown property "${S}"`)]);return c}function os(l){const t=l.value,o=l.key,c=l.style,d=l.styleSpec,p=d.terrain;if(t==null)return[];if(!s.H(t))return[new s.V("terrain",t,`object expected, ${s.K(t)} found`)];let m=[];for(const y in t){const x=y.match(/^(.*)-transition$/),T=y.match(/^(.*)-use-theme$/);m=m.concat(T&&p[T[1]]?Ai({key:y,value:t[y],valueSpec:{type:"string"},style:c,styleSpec:d}):x&&p[x[1]]&&p[x[1]].transition?Ai({key:y,value:t[y],valueSpec:d.transition,style:c,styleSpec:d}):p[y]?Ai({key:y,value:t[y],valueSpec:p[y],style:c,styleSpec:d}):[new s.a3(y,t[y],`unknown property "${y}"`)])}if(t.source)if(s.a0(t.source)){const y=c.sources&&c.sources[t.source],x=y&&s.J(y.type);y?x!=="raster-dem"&&m.push(new s.V(`${o}.source`,t.source,`terrain cannot be used with a source of type ${x}, it only be used with a "raster-dem" source type`)):m.push(new s.V(`${o}.source`,t.source,`source "${t.source}" not found`))}else m.push(new s.V(`${o}.source`,t.source,"source must be a string"));else m.push(new s.V(o,t,'terrain is missing required property "source"'));return m}function ss(l){const t=l.value,o=l.style,c=l.styleSpec,d=c.fog;if(t===void 0)return[];if(!s.H(t))return[new s.V("fog",t,`object expected, ${s.K(t)} found`)];let p=[];for(const m in t){const y=m.match(/^(.*)-transition$/),x=m.match(/^(.*)-use-theme$/);p=p.concat(x&&d[x[1]]?Ai({key:m,value:t[m],valueSpec:{type:"string"},style:o,styleSpec:c}):y&&d[y[1]]&&d[y[1]].transition?Ai({key:m,value:t[m],valueSpec:c.transition,style:o,styleSpec:c}):d[m]?Ai({key:m,value:t[m],valueSpec:d[m],style:o,styleSpec:c}):[new s.a3(m,t[m],`unknown property "${m}"`)])}return p}const ha={"*":()=>[],array:ca,boolean:function(l){const t=l.value,o=l.key;return s.$(t)?[]:[new s.V(o,t,`boolean expected, ${s.K(t)} found`)]},number:ks,color:function({key:l,value:t}){return s.a0(t)?s.a1.parseCSSColor(t)===null?[new s.V(l,t,`color expected, "${t}" found`)]:[]:[new s.V(l,t,`color expected, ${s.K(t)} found`)]},enum:Ro,filter:rs,function:ol,layer:sl,object:Rr,source:Do,model:s.a7,light:ns,"light-3d":Fo,terrain:os,fog:ss,string:zo,formatted:function(l){return zo(l).length===0?[]:yn(l)},resolvedImage:function(l){return zo(l).length===0?[]:yn(l)},projection:function(l){const t=l.value,o=l.styleSpec,c=o.projection,d=l.style;if(s.H(t)){let p=[];for(const m in t)p=p.concat(Ai({key:m,value:t[m],valueSpec:c[m],style:d,styleSpec:o}));return p}return s.a0(t)?[]:[new s.V("projection",t,`object or string expected, ${s.K(t)} found`)]},import:function(l){const t=l.key,{value:o,styleSpec:c}=l;if(!s.H(o))return[new s.V(t,o,"import must be an object")];const{data:d,...p}=o;Object.defineProperty(p,"__line__",{value:o.__line__,enumerable:!1});let m=Rr(Object.assign({},l,{value:p,valueSpec:c.import}));return s.J(p.id)===""&&m.push(new s.V(`${l.key}.id`,p,"import id can't be an empty string")),d&&(m=m.concat(da(d,c,{key:`${l.key}.data`}))),m},iconset:function(l){const t=l.value,o=l.key,c=l.styleSpec,d=l.style;if(!s.H(t))return[new s.V(o,t,"object expected")];if(!t.type)return[new s.V(o,t,'"type" is required')];const p=s.J(t.type);let m=[];
9if(m=m.concat(Rr({key:o,value:t,valueSpec:c[`iconset_${p}`],style:d,styleSpec:c})),(function(y,x){return!(y!=="source"||!x.source)})(p,t)){const y=d.sources&&d.sources[t.source],x=y&&s.J(y.type);y?x!=="raster-array"&&m.push(new s.V(o,t.source,`iconset cannot be used with a source of type ${String(x)}, it only be used with a "raster-array" source type`)):m.push(new s.V(o,t.source,`source "${t.source}" not found`))}return m}};function Ai(l,t=!1){const o=l.value,c=l.valueSpec,d=l.styleSpec;if(c.expression){if(s.a4(s.J(o)))return ol(l);if(s.Q(s.S(o)))return yn(l)}if(c.type&&ha[c.type]){const p=ha[c.type](l);return t===!0&&p.length>0&&Array.isArray(l.value)?yn(l):p}return Rr(Object.assign({},l,{valueSpec:c.type?d[c.type]:c}))}function Rr(l){const t=l.key,o=l.value,c=l.valueSpec||{},d=l.objectElementValidators||{},p=l.style,m=l.styleSpec;if(!s.H(o))return[new s.V(t,o,`object expected, ${s.K(o)} found`)];let y=[];for(const x in o){const T=x.split(".")[0];let S;d[T]?S=d[T]:c[T]?S=Ai:d["*"]?S=d["*"]:c["*"]&&(S=Ai),S?y=y.concat(S({key:(t&&`${t}.`)+x,value:o[x],valueSpec:c[T]||c["*"],style:p,styleSpec:m,object:o,objectKey:x},o)):y.push(new s.a3(t,o[x],`unknown property "${x}"`))}for(const x in c){if(d[x])continue;const T=c[x];T.required&&T.default===void 0&&o[x]===void 0&&y.push(new s.V(t,o,`missing required property "${x}"`))}return y}function hc({key:l,value:t}){const o=zo({key:l,value:t});if(o.length)return o;const c=t;return c.indexOf("{fontstack}")===-1&&o.push(new s.V(l,t,'"glyphs" url must include a "{fontstack}" token')),c.indexOf("{range}")===-1&&o.push(new s.V(l,t,'"glyphs" url must include a "{range}" token')),o}function da(l,t=s.a6,o={}){return Rr({key:o.key||"",value:l,valueSpec:Object.assign(t.$root,{"*":{type:"*"}}),styleSpec:t,style:l,objectElementValidators:{glyphs:hc}})}function Pn(l,t=s.a6){return Y(da(l,t))}const Fu=l=>Y(Do(l)),fa=l=>Y(ns(l)),Be=l=>Y(Fo(l)),Oo=l=>Y(os(l)),Ou=l=>Y(ss(l)),al=l=>Y((function(t){const o=t.value,c=t.style,d=t.styleSpec,p=d.snow;if(o===void 0)return[];if(!s.H(o))return[new s.V("snow",o,`object expected, ${s.K(o)} found`)];let m=[];for(const y in o){const x=y.match(/^(.*)-transition$/);m=m.concat(x&&p[x[1]]&&p[x[1]].transition?Ai({key:y,value:o[y],valueSpec:d.transition,style:c,styleSpec:d}):p[y]?Ai({key:y,value:o[y],valueSpec:p[y],style:c,styleSpec:d}):[new s.a3(y,o[y],`unknown property "${y}"`)])}return m})(l)),$t=l=>Y((function(t){const o=t.value,c=t.style,d=t.styleSpec,p=d.rain;if(o===void 0)return[];if(!s.H(o))return[new s.V("rain",o,`object expected, ${s.K(o)} found`)];let m=[];for(const y in o){const x=y.match(/^(.*)-transition$/);m=m.concat(x&&p[x[1]]&&p[x[1]].transition?Ai({key:y,value:o[y],valueSpec:d.transition,style:c,styleSpec:d}):p[y]?Ai({key:y,value:o[y],valueSpec:p[y],style:c,styleSpec:d}):[new s.a3(y,o[y],`unknown property "${y}"`)])}return m})(l)),he=l=>Y(sl(l)),k=l=>Y(rs(l)),U=l=>Y(ua(l)),W=l=>Y(Cn(l)),ae=l=>Y(s.a7(l));function Y(l){return l.slice().sort((t,o)=>t.line&&o.line?t.line-o.line:0)}function le(l,t){let o=!1;if(t&&t.length)for(const c of t)c instanceof s.a3?s.w(c.message):(l.fire(new s.y(new Error(c.message))),o=!0);return o}const xe=s.a6.light;let ue;class Te extends s.E{constructor(t,o="flat"){super(),this._transitionable=new s.a8(ue||(ue=new s.a9({anchor:new s.aa(xe.anchor),position:new s.ab(xe.position),color:new s.aa(xe.color),intensity:new s.aa(xe.intensity)}))),this.setLight(t,o),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,o,c={}){this._validate(fa,t,c)||(this._transitionable.setTransitionOrValue(t),this.id=o)}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,o,c){return(!c||c.validate!==!1)&&le(this,t.call(Pn,Object.assign({value:o,style:{glyphs:!0,sprite:!0},styleSpec:s.a6})))}}const Ne=s.a6.terrain;let Oe=class extends s.E{constructor(l,t,o,c,d){super(),this.scope=o,this._transitionable=new s.a8(new s.a9({source:new s.aa(Ne.source),exaggeration:new s.aa(Ne.exaggeration)}),o,c),this._transitionable.setTransitionOrValue(l,c),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=t,this.worldview=d}get(){return this._transitionable.serialize()}set(l,t){this._transitionable.setTransitionOrValue(l,t)}updateTransitions(l){this._transitioning=this._transitionable.transitioned(l,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(l){this.properties=this._transitioning.possiblyEvaluate(l)}getExaggeration(l){return this._transitioning.possiblyEvaluate(new s.ac(l,{worldview:this.worldview})).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;const l=this._transitionable._values.exaggeration;if(!l)return null;const t=l.value.expression;if(!t)return null;let o=-1,c=-1,d=1;for(const p of t.zoomStops)d=t.evaluate(new s.ac(p,{worldview:this.worldview})),d>.01?(o=p,c=-1):c=p;return d<.01&&o>0&&c>o?[o,c]:null}isZoomDependent(){const l=this._transitionable._values.exaggeration;return l!=null&&l.value!=null&&l.value.expression!=null&&l.value.expression instanceof s.ad}};const rt=.05;function ft(l,t,o,c){const d=s.ah(45,65,o),[p,m]=mt(l,c);let y=1-Math.min(1,Math.exp((t-p)/(m-p)*-6));return y*=y*y,y=Math.min(1,1.00747*y),y*d*l.alpha}function mt(l,t){const o=.5/Math.tan(.5*t);return[l.range[0]+o,l.range[1]+o]}function At(l,t,o,c,d){const p=s.af([],[t,o,c],d.mercatorFogMatrix);return ft(l,s.ag(p),d.pitch,d._fov)}function Dt(l,t,o,c,d,p,m){const y=[[o,c,0],[d,c,0],[d,p,0],[o,p,0]];let x=Number.MAX_VALUE,T=-Number.MAX_VALUE;for(const S of y){const M=s.af([],S,t),A=s.ag(M);x=Math.min(x,A),T=Math.max(T,A)}return[ft(l,x,m.pitch,m._fov),ft(l,T,m.pitch,m._fov)]}const Tt=s.a6.fog;class xt extends s.E{constructor(t,o,c,d){super();const p=new s.a9({range:new s.aa(Tt.range),color:new s.aa(Tt.color),"color-use-theme":new s.aa({type:"string","property-type":"data-constant",default:"default"}),"high-color":new s.aa(Tt["high-color"]),"high-color-use-theme":new s.aa({type:"string","property-type":"data-constant",default:"default"}),"space-color":new s.aa(Tt["space-color"]),"space-color-use-theme":new s.aa({type:"string","property-type":"data-constant",default:"default"}
9),"horizon-blend":new s.aa(Tt["horizon-blend"]),"star-intensity":new s.aa(Tt["star-intensity"]),"vertical-range":new s.aa(Tt["vertical-range"])});this._transitionable=new s.a8(p,c,new Map(d)),this.set(t,d),this._transitioning=this._transitionable.untransitioned(),this._transform=o,this.properties=new s.ai(p),this.scope=c}get state(){const t=this._transform,o=t.projection.name==="globe",c=s.aj(t.zoom),d=this.properties.get("range"),p=[.5,3];return{range:o?[s.ak(p[0],d[0],c),s.ak(p[1],d[1],c)]:d,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(t,o,c={}){if(this._validate(Ou,t,c))return;const d=Object.assign({},t);for(const p of Object.keys(Tt))d[p]===void 0&&(d[p]=Tt[p].default);this._options=d,this._transitionable.setTransitionOrValue(this._options,o)}getOpacity(t){if(!this._transform.projection.supportsFog)return 0;const o=this.properties&&this.properties.get("color")||1;return(this._transform.projection.name==="globe"?1:s.ah(45,65,t))*o.a}getOpacityAtLatLng(t,o){return this._transform.projection.supportsFog?(function(c,d,p){const m=s.ae.fromLngLat(d),y=p.elevation?p.elevation.getAtPointOrZero(m):0;return At(c,m.x,m.y,y,p)})(this.state,t,o):0}getOpacityForTile(t){if(!this._transform.projection.supportsFog)return[1,1];const o=this._transform.calculateFogTileMatrix(t.toUnwrapped());return Dt(this.state,o,0,0,s.al,s.al,this._transform)}getOpacityForBounds(t,o,c,d,p){return this._transform.projection.supportsFog?Dt(this.state,t,o,c,d,p,this._transform):[1,1]}getFovAdjustedRange(t){return this._transform.projection.supportsFog?mt(this.state,t):[0,1]}isVisibleOnFrustum(t){if(!this._transform.projection.supportsFog)return!1;const o=[4,5,6,7];for(const c of o){const d=t.points[c];let p;if(d[2]>=0)p=d;else{const m=t.points[c-4];p=s.am(m,d,m[2]/(m[2]-d[2]))}if(At(this.state,p[0],p[1],0,this._transform)>=rt)return!0}return!1}updateConfig(t){this._transitionable.setTransitionOrValue(this._options,new Map(t))}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,o,c){return(!c||c.validate!==!1)&&le(this,t.call(Pn,Object.assign({value:o,style:{glyphs:!0,sprite:!0},styleSpec:s.a6})))}}let _i,or,qi,Hi=class extends s.E{constructor(l,t,o,c){super();const d=_i||(_i=new s.a9({density:new s.aa(s.a6.snow.density),intensity:new s.aa(s.a6.snow.intensity),color:new s.aa(s.a6.snow.color),opacity:new s.aa(s.a6.snow.opacity),vignette:new s.aa(s.a6.snow.vignette),"vignette-color":new s.aa(s.a6.snow["vignette-color"]),"center-thinning":new s.aa(s.a6.snow["center-thinning"]),direction:new s.aa(s.a6.snow.direction),"flake-size":new s.aa(s.a6.snow["flake-size"])}));this._transitionable=new s.a8(d,o,new Map(c)),this.set(l,c),this._transitioning=this._transitionable.untransitioned(),this.properties=new s.ai(d),this.scope=o}get state(){const l=this.properties.get("opacity"),t=this.properties.get("color"),o=this.properties.get("direction"),c=s.an(o[0]),d=-Math.max(s.an(o[1]),.01),p=[Math.cos(c)*Math.cos(d),Math.sin(c)*Math.cos(d),Math.sin(d)],m=this.properties.get("vignette"),y=this.properties.get("vignette-color");return y.a=m,{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new s.ao(t.r,t.g,t.b,t.a*l),direction:p,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:y}}get(){return this._transitionable.serialize()}set(l,t,o={}){if(this._validate(al,l,o))return;const c=Object.assign({},l),d=s.a6.snow;for(const p of Object.keys(d))c[p]===void 0&&(c[p]=d[p].default);this._options=c,this._transitionable.setTransitionOrValue(this._options,t)}updateConfig(l){this._transitionable.setTransitionOrValue(this._options,new Map(l))}updateTransitions(l){this._transitioning=this._transitionable.transitioned(l,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(l){this.properties=this._transitioning.possiblyEvaluate(l)}_validate(l,t,o){return(!o||o.validate!==!1)&&le(this,l.call(Pn,Object.assign({value:t,style:{glyphs:!0,sprite:!0},styleSpec:s.a6})))}},Mi=class extends s.E{constructor(l,t,o,c){super();const d=or||(or=new s.a9({density:new s.aa(s.a6.rain.density),intensity:new s.aa(s.a6.rain.intensity),color:new s.aa(s.a6.rain.color),opacity:new s.aa(s.a6.rain.opacity),vignette:new s.aa(s.a6.rain.vignette),"vignette-color":new s.aa(s.a6.rain["vignette-color"]),"center-thinning":new s.aa(s.a6.rain["center-thinning"]),direction:new s.aa(s.a6.rain.direction),"droplet-size":new s.aa(s.a6.rain["droplet-size"]),"distortion-strength":new s.aa(s.a6.rain["distortion-strength"])}));this._transitionable=new s.a8(d,o,new Map(c)),this.set(l,c),this._transitioning=this._transitionable.untransitioned(),this.properties=new s.ai(d),this.scope=o}get state(){const l=this.properties.get("opacity"),t=this.properties.get("color"),o=this.properties.get("direction"),c=s.an(o[0]),d=-Math.max(s.an(o[1]),.01),p=[Math.cos(c)*Math.cos(d),Math.sin(c)*Math.cos(d),Math.sin(d)],m=this.properties.get("vignette-color");return m.a=this.properties.get("vignette"),{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new s.ao(t.r,t.g,t.b,t.a*l),direction:p,centerThinning:this.properties.get("center-thinning"),droplet
9Size:this.properties.get("droplet-size"),distortionStrength:this.properties.get("distortion-strength"),vignetteColor:m}}get(){return this._transitionable.serialize()}set(l,t,o={}){if(this._validate($t,l,o))return;const c=Object.assign({},l),d=s.a6.rain;for(const p of Object.keys(d))c[p]===void 0&&(c[p]=d[p].default);this._options=c,this._transitionable.setTransitionOrValue(this._options,t)}updateConfig(l){this._transitionable.setTransitionOrValue(this._options,new Map(l))}updateTransitions(l){this._transitioning=this._transitionable.transitioned(l,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(l){this.properties=this._transitioning.possiblyEvaluate(l)}_validate(l,t,o){return(!o||o.validate!==!1)&&le(this,l.call(Pn,Object.assign({value:t,style:{glyphs:!0,sprite:!0},styleSpec:s.a6})))}};class Gt extends s.E{constructor(t,o,c,d){super(),this.scope=c,this._options=t,this.properties=new s.ai(o),this._transitionable=new s.a8(o,c,new Map(d)),this._transitionable.setTransitionOrValue(t.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(t){this._transitionable.setTransitionOrValue(this._options.properties,new Map(t))}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(t,o){this._options=t,this._transitionable.setTransitionOrValue(t.properties,o)}shadowsEnabled(){return!!this.properties&&this.properties.get("cast-shadows")===!0}}const zi=()=>qi||(qi=new s.a9({color:new s.aa(s.a6.properties_light_ambient.color),"color-use-theme":new s.aa({type:"string",default:"default","property-type":"data-constant"}),intensity:new s.aa(s.a6.properties_light_ambient.intensity)}));let di;const fi=()=>di||(di=new s.a9({direction:new s.ap(s.a6.properties_light_directional.direction),color:new s.aa(s.a6.properties_light_directional.color),"color-use-theme":new s.aa({type:"string",default:"default","property-type":"data-constant"}),intensity:new s.aa(s.a6.properties_light_directional.intensity),"cast-shadows":new s.aa(s.a6.properties_light_directional["cast-shadows"]),"shadow-quality":new s.aa(s.a6.properties_light_directional["shadow-quality"]),"shadow-intensity":new s.aa(s.a6.properties_light_directional["shadow-intensity"]),"shadow-draw-before-layer":new s.aa(s.a6.properties_light_directional["shadow-draw-before-layer"])}));
vendor: 5,177 bytes, line 9
9class ji{constructor(t,o,c){this.screenBounds=t,this.cameraPoint=c.getCameraPoint(),this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=o,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,c)}static createFromScreenPoints(t,o){let c,d;if(t instanceof s.P||typeof t[0]=="number"){const p=s.P.convert(t);c=[p],d=o.isPointAboveHorizon(p)}else{const p=s.P.convert(t[0]),m=s.P.convert(t[1]),y=p.add(m)._div(2);c=[p,m],d=s.aq(p,m).every(x=>o.isPointAboveHorizon(x))&&o.isPointAboveHorizon(y)}return new ji(c,d,o)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(t){return s.aq(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],t)}bufferedCameraGeometry(t){const o=this.screenBounds[0],c=this.screenBounds.length===1?this.screenBounds[0].add(new s.P(1,1)):this.screenBounds[1],d=s.aq(o,c,0,!1);return this.cameraPoint.y>c.y&&(this.cameraPoint.x>o.x&&this.cameraPoint.x<c.x?d.splice(3,0,this.cameraPoint):this.cameraPoint.x>=c.x?d[2]=this.cameraPoint:this.cameraPoint.x<=o.x&&(d[3]=this.cameraPoint)),s.ar(d,t)}bufferedCameraGeometryGlobe(t){const o=this.screenBounds[0],c=this.screenBounds.length===1?this.screenBounds[0].add(new s.P(1,1)):this.screenBounds[1],d=s.aq(o,c,t),p=this.cameraPoint.clone();switch(3*((p.y>o.y)+(p.y>c.y))+((p.x>o.x)+(p.x>c.x))){case 0:d[0]=p,d[4]=p.clone();break;case 1:d.splice(1,0,p);break;case 2:d[1]=p;break;case 3:d.splice(4,0,p);break;case 5:d.splice(2,0,p);break;case 6:d[3]=p;break;case 7:d.splice(3,0,p);break;case 8:d[2]=p}return d}containsTile(t,o,c,d=0){const p=Math.max(t.queryPadding,t.evaluateQueryRenderedFeaturePadding())/o._pixelsPerMercatorPixel+1,m=c?this._bufferedCameraMercator(p,o):this._bufferedScreenMercator(p,o);let y=t.tileID.wrap+(m.unwrapped?d:0);const x=m.polygon.map(O=>s.as(t.tileTransform,O,y));if(!s.at(x,0,0,s.al,s.al))return;y=t.tileID.wrap+(this.screenGeometryMercator.unwrapped?d:0);const T=this.screenGeometryMercator.polygon.map(O=>s.au(t.tileTransform,O,y)),S=T.map(O=>new s.P(O[0],O[1])),M=o.getFreeCameraOptions().position||new s.ae(0,0,0),A=s.au(t.tileTransform,M,y),C=T.map(O=>{const N=s.av(O,O,A);return s.aw(N,N),new s.ax(A,N)}),L=s.ay(t,1,o.zoom)*o._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:S,tilespaceRays:C,bufferedTilespaceGeometry:x,bufferedTilespaceBounds:(z=s.az(x),z.min.x=s.aA(z.min.x,0,s.al),z.min.y=s.aA(z.min.y,0,s.al),z.max.x=s.aA(z.max.x,0,s.al),z.max.y=s.aA(z.max.y,0,s.al),z),tile:t,tileID:t.tileID,pixelToTileUnitsFactor:L};var z}_bufferedScreenMercator(t,o){const c=cr(t);if(this._screenRaycastCache[c])return this._screenRaycastCache[c];{let d;return d=o.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(t),o):{polygon:this.bufferedScreenGeometry(t).map(p=>o.pointCoordinate3D(p)),unwrapped:!0},this._screenRaycastCache[c]=d,d}}_bufferedCameraMercator(t,o){const c=cr(t);if(this._cameraRaycastCache[c])return this._cameraRaycastCache[c];{let d;return d=o.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(t),o):{polygon:this.bufferedCameraGeometry(t).map(p=>o.pointCoordinate3D(p)),unwrapped:!0},this._cameraRaycastCache[c]=d,d}}_projectAndResample(t,o){const c=(function(p,m){const y=s.aB([],m.pixelMatrix,m.globeMatrix),x=[0,-s.aD,0,1],T=[0,s.aD,0,1],S=[0,0,0,1];s.aC(x,x,y),s.aC(T,T,y),s.aC(S,S,y);const M=new s.P(x[0]/x[3],x[1]/x[3]),A=new s.P(T[0]/T[3],T[1]/T[3]),C=s.aE(p,M)&&x[3]<S[3],L=s.aE(p,A)&&T[3]<S[3];if(!C&&!L)return null;const z=(function(te,X,Z){for(let ne=1;ne<te.length;ne++){const ce=Sr(X.pointCoordinate3D(te[ne-1]).x),de=Sr(X.pointCoordinate3D(te[ne]).x);if(Z<0){if(ce<de)return{idx:ne,t:-ce/(de-1-ce)}}else if(de<ce)return{idx:ne,t:(1-ce)/(de+1-ce)}}return null})(p,m,C?-1:1);if(!z)return null;const{idx:O,t:N}=z;let q=O>1?zr(p.slice(0,O),m):[],G=O<p.length?zr(p.slice(O),m):[];q=q.map(te=>new s.P(Sr(te.x),te.y)),G=G.map(te=>new s.P(Sr(te.x),te.y));const j=[...q];j.length===0&&j.push(G[G.length-1]);const ie=s.ak(j[j.length-1].y,(G.length===0?q[0]:G[0]).y,N);let Q;return Q=C?[new s.P(0,ie),new s.P(0,0),new s.P(1,0),new s.P(1,ie)]:[new s.P(1,ie),new s.P(1,1),new s.P(0,1),new s.P(0,ie)],j.push(...Q),G.length===0?j.push(q[0]):j.push(...G),{polygon:j.map(te=>new s.ae(te.x,te.y)),unwrapped:!1}})(t,o);if(c)return c;const d=(function(p,m){let y=!1,x=-1/0,T=0;for(let M=0;M<p.length-1;M++)p[M].x>x&&(x=p[M].x,T=M);for(let M=0;M<p.length-1;M++){const A=(T+M)%(p.length-1),C=p[A],L=p[A+1];Math.abs(C.x-L.x)>.5&&(C.x<L.x?(C.x+=1,A===0&&(p[p.length-1].x+=1)):(L.x+=1,A+1===p.length-1&&(p[0].x+=1)),y=!0)}const S=s.aF(m.center.lng);return y&&S<Math.abs(S-1)&&p.forEach(M=>{M.x-=1}),{polygon:p,unwrapped:y}})(zr(t,o).map(p=>new s.P(Sr(p.x),p.y)),o);return{polygon:d.polygon.map(p=>new s.ae(p.x,p.y)),unwrapped:d.unwrapped}}}function zr(l,t){return s.aG(l,o=>{const c=t.pointCoordinate3D(o);o.x=c.x,o.y=c.y},1/256)}function Sr(l){return l<0?1+l%1:l%1}function cr(l){return 100*l|0}function as(l,t,o,c,d){const p=function(y,x){if(y)return d(y);if(x){if(l.url&&x.tiles&&l.tiles&&delete l.tiles,x.variants){if(!Array.isArray(x.variants)
9)return d(new Error("variants must be an array"));for(const S of x.variants){if(S==null||typeof S!="object"||S.constructor!==Object)return d(new Error("variant must be an object"));if(!Array.isArray(S.capabilities))return d(new Error("capabilities must be an array"));if(S.capabilities.length===1&&S.capabilities[0]==="meshopt"){x=Object.assign(x,S);break}}}const T=s.aH(Object.assign({},x,l),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","extra_bounds","scheme","tileSize","encoding","vector_layers","raster_layers","worldview_options","worldview_default","worldview"]);T.tiles=t.canonicalizeTileset(T,l.url),d(null,T)}},m=(function(y,x,T){if(!y)return null;if(!x&&!T)return y;T=T||y.worldview_default;const S=Object.values(y.language||{});if(S.length===0)return null;const M=Object.values(y.worldview||{});if(M.length===0)return null;const A=S.every(L=>L===x),C=M.every(L=>L===T);return A&&C?y:x in(y.language_options||{})||T in(y.worldview_options||{})?null:y.language_options&&y.worldview_options?y:null})(l.data,o,c);return m?s.o.frame(()=>p(null,m)):l.url?s.m(t.transformRequest(t.normalizeSourceURL(l.url,null,o,c),s.R.Source),p):s.o.frame(()=>{const{data:y,...x}=l;p(null,x)})}function Vr(l,t){const o=Math.pow(2,t.z),c=Math.floor(s.aF(l.getWest())*o),d=Math.floor(s.aJ(l.getNorth())*o),p=Math.ceil(s.aF(l.getEast())*o),m=Math.ceil(s.aJ(l.getSouth())*o);return t.x>=c&&t.x<p&&t.y>=d&&t.y<m}class xn{constructor(t,o,c){this.bounds=t?s.aI.convert(this.validateBounds(t)):null,this.minzoom=o||0,this.maxzoom=c||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}addExtraBounds(t){if(t){this.extraBounds||(this.extraBounds=[]);for(const o of t)this.extraBounds.push(s.aI.convert(this.validateBounds(o)))}}contains(t){if(t.z>this.maxzoom||t.z<this.minzoom||this.bounds&&!Vr(this.bounds,t))return!1;if(!this.extraBounds)return!0;for(const o of this.extraBounds)if(Vr(o,t))return!0;return!1}static fromTileJSON(t){if(!t.bounds&&!t.extra_bounds)return null;const o=new xn(t.bounds,t.minzoom,t.maxzoom);return o.addExtraBounds(t.extra_bounds),o}}class $n extends s.E{constructor(t,o,c,d){if(super(),this.id=t,this.dispatcher=c,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,Object.assign(this,s.aH(o,["url","scheme","tileSize","promoteId"])),this._options=Object.assign({type:"vector"},o),this._collectResourceTiming=!!o.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(d),this._tileWorkers={},this._deduped=new s.aK}load(t){this._loaded=!1,this.fire(new s.z("dataloading",{dataType:"source"}));const o=Array.isArray(this.map._language)?this.map._language.join():this.map._language,c=this.map.getWorldview();this._tileJSONRequest=as(this._options,this.map._requestManager,o,c,(d,p)=>{if(this._tileJSONRequest=null,this._loaded=!0,d)o&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${o}`),c&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${c}`),this.fire(new s.y(d));else if(p){if(Object.assign(this,p),this.hasWorldviews=!!p.worldview_options,p.worldview_default&&(this.worldviewDefault=p.worldview_default),p.vector_layers){this.vectorLayers=p.vector_layers,this.vectorLayerIds=[],this.localizableLayerIds=new Set;for(const m of p.vector_layers)this.vectorLayerIds.push(m.id),p.worldview&&p.worldview[m.source]&&this.localizableLayerIds.add(m.id)}this.tileBounds=xn.fromTileJSON(p),ki(p.tiles,this.map._requestManager._customAccessToken),this.fire(new s.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.z("data",{dataType:"source",sourceDataType:"content"}))}t&&t(d)})}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}reload(){this.cancelTileJSONRequest();const t=s.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(t))}setTiles(t){return this._options.tiles=t,this.reload(),this}setUrl(t){return this.url=t,this._options.url=t,this.reload(),this}onRemove(t){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}loadTile(t,o){const c=t.tileID.canonical.url(this.tiles,this.scheme),d=this.map._requestManager.normalizeTileURL(c),p=this.map._requestManager.transformRequest(d,s.R.Tile),m=this.map.style?this.map.style.getLut(this.scope):null,y=m?{image:m.image.clone()}:null,x={request:p,data:void 0,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,lut:y,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.t
9ype,source:this.id,scope:this.scope,pixelRatio:s.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:t.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:t.isExtraShadowCaster,tessellationStep:this.map._tessellationStep,scaleFactor:this.map.getScaleFactor(),worldview:this.map.getWorldview()||this.worldviewDefault,indoor:this.map.getIndoorTileOptions(this.id,this.scope)};if(this.hasWorldviews&&s.h(c)&&(x.localizableLayerIds=this.localizableLayerIds),x.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired")t.state==="loading"?t.reloadCallback=o:t.request=t.actor.send("reloadTile",x,T.bind(this));else if(t.actor=this._tileWorkers[d]=this._tileWorkers[d]||this.dispatcher.getActor(),this.dispatcher.ready)t.request=t.actor.send("loadTile",x,T.bind(this),void 0,!0);else{const S=s.aL.call({deduped:this._deduped},x,(M,A)=>{if(M||!A)T.call(this,M);else{const C=s.aM(A.responseHeaders);x.data={rawData:A.rawData.slice(0),expires:C.expires,cacheControl:C.cacheControl},t.actor&&t.actor.send("loadTile",x,T.bind(this),void 0,!0)}},!0);t.request={cancel:S}}function T(S,M){return delete t.request,t.aborted?o(null):S&&S instanceof s.aN&&S.status!==404?o(S):(M&&M.resourceTiming&&(t.resourceTiming=M.resourceTiming),this.map._refreshExpiredTiles&&M&&t.setExpiryData(M),t.loadVectorData(M,this.map.painter),s.aO(this.dispatcher),o(null,M),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.t
9ype,source:this.id,scope:this.scope})}unloadTile(t,o){t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id,scope:this.scope}),t.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class ro extends s.E{constructor(t,o,c,d){super(),this.id=t,this.dispatcher=c,this.setEventedParent(d),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=Object.assign({type:"raster"},o),Object.assign(this,s.aH(o,["url","scheme","tileSize"]))}load(t){this._loaded=!1,this.fire(new s.z("dataloading",{dataType:"source"}));const o=this.map.getWorldview();this._tileJSONRequest=as(this._options,this.map._requestManager,null,o,(c,d)=>{this._tileJSONRequest=null,this._loaded=!0,c?this.fire(new s.y(c)):d&&(Object.assign(this,d),d.raster_layers&&(this.rasterLayers=d.raster_layers,this.rasterLayerIds=this.rasterLayers.map(p=>p.id)),this.tileBounds=xn.fromTileJSON(d),ki(d.tiles),this.fire(new s.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.z("data",{dataType:"source",sourceDataType:"content"}))),t&&t(c)})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}reload(){this.cancelTileJSONRequest();const t=s.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(t))}setTiles(t){return this._options.tiles=t,this.reload(),this}setUrl(t){return this.url=t,this._options.url=t,this.reload(),this}onRemove(t){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,o){const c=s.o.devicePixelRatio>=2,d=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),c,this.tileSize);t.request=s.n(this.map._requestManager.transformRequest(d,s.R.Tile),(p,m,y)=>{if(delete t.request,t.aborted)return t.state="unloaded",o(null);if(p)return t.state="errored",o(p);if(!m)return o(null);const x=s.aM(y);this.map._refreshExpiredTiles&&t.setExpiryData(x),t.setTexture(m,this.map.painter),t.state="loaded",s.aO(this.dispatcher),o(null)})}abortTile(t,o){t.request&&(t.request.cancel(),delete t.request),o&&o()}unloadTile(t,o){t.texture&&t.texture instanceof s.T?(t.destroy(!1),t.texture&&t.texture instanceof s.T&&this.map.painter.saveTileTexture(t.texture)):t.destroy(),o&&o()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}function vn([l,t],o,c,{scaled:d=!0}={}){const{tileSize:p,buffer:m}=c,{x:y,y:x,z:T}=o;if(!isFinite(y)||!isFinite(x)||!isFinite(T))throw new Error("Invalid MRT header");const S=2**T,M=S*s.aF(l),A=S*s.aJ(t);return(function([C,L],z,{scaled:O=!0}={}){if(!z)throw new Error("bandView is undefined");const{data:N,tileSize:q,buffer:G,offset:j,scale:ie,dimension:Q}=z;if(C<-G||C>q+G||L<-G||L>q+G)throw new Error(`Point (${C}, ${L}) out of bounds for tileSize=${q}, buffer=${G}`);const te=(L+G)*(q+2*G)+(C+G);if(new Uint32Array(N.buffer)[te]===4294967295)return null;let X=[];X=O?[]:new z.data.constructor(Q);for(let Z=0;Z<Q;Z++)X[Z]=Math.round(1e12*(N[Q*te+Z]*ie+j))/1e12;return X})([Math.min(Math.max(-m,Math.floor((M-y)*p)),p-1+m),Math.min(Math.max(-m,Math.floor((A-x)*p)),p-1+m)],c,{scaled:d})}class Wr extends ro{constructor(t,o,c,d){super(t,o,c,d),this.type="raster-array",this.maxzoom=22,this.partial=!0,this._loadTilePending={},this._loadTileLoaded={},this._options=Object.assign({type:"raster-array"},o)}triggerRepaint(t){const o=this.map.painter._terrain,c=this.map.style.getSourceCache(this.id);o&&o.enabled&&c&&o._clearRenderCacheForTile(c.id,t.tileID),this.map.triggerRepaint()}loadTile(t,o){const c=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),d=this.map._requestManager.transformRequest(c,s.R.Tile),p={request:d,uid:t.uid,tileID:t.tileID,type:this.t
9ype,source:this.id,scope:this.scope,partial:this.partial};t.source=this.id,t.scope=this.scope,t.requestParams=d,t.actor||(t.actor=this.dispatcher.getActor());const m=(y,x,T)=>{if(delete t.request,t.aborted)return t.state="unloaded",o(null);if(y)return y.name==="AbortError"?void 0:(t.state="errored",o(y));if(this.map._refreshExpiredTiles&&x){const S=s.aM(T);t.setExpiryData(S)}if(this.partial&&t.state!=="expired")t.state="empty";else if(!this.partial){if(!x)return o(null);t.state="loaded",t._isHeaderLoaded=!0,t._mrt=x}o(null)};t.request=this.partial?t.fetchHeader(void 0,m.bind(this)):t.actor.send("loadTile",p,m.bind(this),void 0,!0)}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,scope:this.scope})}unloadTile(t,o){const c=t.texturePerLayer;if(t.flushAllQueues(),c.size){t.destroy(!1);for(const d of c.values())this.map.painter.saveTileTexture(d)}else t.destroy()}prepareTile(t,o,c,d){t._isHeaderLoaded&&(t.state!=="empty"&&(t.state="reloading"),t.fetchBandForRender(o,c,d,(p,m)=>{if(p)return t.state="errored",this.fire(new s.y(p)),void this.triggerRepaint(t);m&&(t._isHeaderLoaded=!0,t.setTexturePerLayer(c,m,this.map.painter),t.state="loaded",this.triggerRepaint(t))}))}getInitialBand(t){if(!this.rasterLayers)return 0;const o=this.rasterLayers.find(({id:p})=>p===t),c=o&&o.fields,d=c&&c.bands&&c.bands;return d?d[0]:0}getTextureDescriptor(t,o,c){if(!t)return;const d=o.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!d)return;let p=null;o instanceof s.aR?p=o.paint.get("raster-array-band"):o instanceof s.aS&&(p=o.paint.get("raster-particle-array-band"));const m=p||this.getInitialBand(d);if(m==null)return;if(!t.textureDescriptorPerLayer.get(o.id))return void this.prepareTile(t,d,o.id,m);if(t.updateNeeded(o.id,m)&&!c)return;const y=t.textureDescriptorPerLayer.get(o.id);return Object.assign({},y,{texture:t.texturePerLayer.get(o.id)})}getImages(t,o){const c=new Map;for(const d of t)for(const p of o){const[m,y]=p.split("/"),x=d.getLayer(m);if(!x||!x.hasBand(y)||!x.hasDataForBand(y))continue;const{bytes:T,tileSize:S,buffer:M}=x.getBandView(y),A=S+2*M,C={data:new s.q({width:A,height:A},T),pixelRatio:2,sdf:!1,usvg:!1,version:0};c.set(p,C)}return c}queryRasterArrayValueByBandId(t,o,c){const d=o._mrt;return new Promise(p=>{const m={},y=new Set;for(const[x,T]of Object.entries(d.layers)){if(c.layerName&&x!==c.layerName)continue;const S={};m[x]=S;for(const{bands:M}of T.dataIndex)for(const A of M)c.bands&&!c.bands.includes(A)||(y.add(s.B(x,A)),o.fetchBand(x,null,A,C=>{s.o.frame(()=>{S[A]=C?null:vn([t.lng,t.lat],d,T.getBandView(A)),y.delete(s.B(x,A)),y.size===0&&p(m)})},!1))}y.size===0&&p(m)})}_loadTileForQuery(t,o){if(this._loadTileLoaded[t.uid])return void o(null,t._mrt);if(this._loadTilePending[t.uid])return void this._loadTilePending[t.uid].push(o);this._loadTilePending[t.uid]=[o];const c=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),d=this.map._requestManager.transformRequest(c,s.R.Tile);t.actor.send("loadTile",{request:d,uid:t.uid,tileID:t.tileID,type:this.t
9ype,source:this.id,scope:this.scope,partial:!1},(p,m,y)=>{if(p)return this._loadTilePending[t.uid].forEach(x=>x(p,null)),void delete this._loadTilePending[t.uid];if(!m)return this._loadTilePending[t.uid].forEach(x=>x(null,null)),void delete this._loadTilePending[t.uid];if(this.map._refreshExpiredTiles&&m){const x=s.aM(y);t.setExpiryData(x)}t._mrt=m,t._isHeaderLoaded=!0,t.state="loaded",this._loadTilePending[t.uid].forEach(x=>x(null,m)),this._loadTileLoaded[t.uid]=!0,delete this._loadTilePending[t.uid]},void 0,!0)}queryRasterArrayValueByAllBands(t,o,c){return new Promise((d,p)=>{this._loadTileForQuery(o,(m,y)=>{m?p(m):d(y?this.queryRasterArrayValueByBandId(t,o,c):null)})})}queryRasterArrayValue(t,o){const c=s.aT.convert(t),d=this.findLoadedParent(c);return d&&d._mrt?o.bands||!this.partial?this.queryRasterArrayValueByBandId(c,d,o):this.queryRasterArrayValueByAllBands(c,d,o):Promise.resolve(null)}findLoadedParent(t){const o=s.ae.fromLngLat(t,this.map.transform.tileSize),c=this.maxzoom+1,d=1<<c,p=Math.floor(o.x),m=Math.floor((o.x-p)*d),y=Math.floor(o.y*d),x=this.map.style.getSourceCache(this.id),T=new s.aQ(c,p,c,m,y);return x.findLoadedParent(T,this.minzoom)}}const ko={vector:$n,raster:ro,"raster-dem":class extends ro{constructor(l,t,o,c){super(l,t,o,c),this.type="raster-dem",this.maxzoom=22,this._options=Object.assign({type:"raster-dem"},t),this.encoding=t.encoding||"mapbox"}loadTile(l,t){const o=this.map._requestManager.normalizeTileURL(l.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function c(d,p){d&&(l.state="errored",t(d)),p&&(l.dem=p,l.dem.onDeserialize(),l.needsHillshadePrepare=!0,l.needsDEMTextureUpload=!0,l.state="loaded",t(null))}l.request=s.n(this.map._requestManager.transformRequest(o,s.R.Tile),(function(d,p,m){if(delete l.request,l.aborted)l.state="unloaded",t(null);else if(d)l.state="errored",t(d);else if(p){const y=s.aM(m);this.map._refreshExpiredTiles&&l.setExpiryData(y);const x=ImageBitmap&&p instanceof ImageBitmap&&s.r(),T=1-(p.width-s.aP(p.width))/2;T<1||l.neighboringTiles||(l.neighboringTiles=this._getNeighboringTiles(l.tileID));const S=x?p:s.o.getImageData(p,T),M={uid:l.uid,tileID:l.tileID,source:this.id,type:this.t
9ype,scope:this.scope,rawImageData:S,encoding:this.encoding,padding:T};l.actor&&l.state!=="expired"||(l.actor=this.dispatcher.getActor(),l.actor.send("loadTile",M,c.bind(this),void 0,!0))}}).bind(this))}_getNeighboringTiles(l){const t=l.canonical,o=Math.pow(2,t.z),c=(t.x-1+o)%o,d=t.x===0?l.wrap-1:l.wrap,p=(t.x+1+o)%o,m=t.x+1===o?l.wrap+1:l.wrap,y={};return y[new s.aQ(l.overscaledZ,d,t.z,c,t.y).key]={backfilled:!1},y[new s.aQ(l.overscaledZ,m,t.z,p,t.y).key]={backfilled:!1},t.y>0&&(y[new s.aQ(l.overscaledZ,d,t.z,c,t.y-1).key]={backfilled:!1},y[new s.aQ(l.overscaledZ,l.wrap,t.z,t.x,t.y-1).key]={backfilled:!1},y[new s.aQ(l.overscaledZ,m,t.z,p,t.y-1).key]={backfilled:!1}),t.y+1<o&&(y[new s.aQ(l.overscaledZ,d,t.z,c,t.y+1).key]={backfilled:!1},y[new s.aQ(l.overscaledZ,l.wrap,t.z,t.x,t.y+1).key]={backfilled:!1},y[new s.aQ(l.overscaledZ,m,t.z,p,t.y+1).key]={backfilled:!1}),y}},"raster-array":Wr,geojson:class extends s.E{constructor(l,t,o,c){super(),this.id=l,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=o.getActor(),this.setEventedParent(c),this._data=t.data,this._options=Object.assign({},t),this._collectResourceTiming=t.collectResourceTiming,t.maxzoom!==void 0&&(this.maxzoom=t.maxzoom),t.minzoom!==void 0&&(this.minzoom=t.minzoom),t.type&&(this.type=t.type),t.attribution&&(this.attribution=t.attribution),this.promoteId=t.promoteId;const d=s.al/this.tileSize;this.workerOptions=Object.assign({source:this.id,scope:this.scope,cluster:t.cluster||!1,geojsonVtOptions:{buffer:(t.buffer!==void 0?t.buffer:128)*d,tolerance:(t.tolerance!==void 0?t.tolerance:.375)*d,extent:s.al,maxZoom:this.maxzoom,lineMetrics:t.lineMetrics||!1,generateId:t.generateId||!1},superclusterOptions:{maxZoom:t.clusterMaxZoom!==void 0?t.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,t.clusterMinPoints||2),extent:s.al,radius:(t.clusterRadius!==void 0?t.clusterRadius:50)*d,log:!1,generateId:t.generateId||!1},clusterProperties:t.clusterProperties,filter:t.filter,dynamic:t.dynamic},t.workerOptions)}onAdd(l){this.map=l,this.setData(this._data)}setData(l){return this._data=l,this._updateWorkerData(),this}updateData(l){if(!this._options.dynamic)return this.fire(new s.y(new Error("Can't call updateData on a GeoJSON source with dynamic set to false.")));if(typeof l!="string"&&(l.type==="Feature"&&(l={type:"FeatureCollection",features:[l]}),l.type!=="FeatureCollection"))return this.fire(new s.y(new Error("Data to update should be a feature or a feature collection.")));if(this._coalesce&&typeof l!="string"&&typeof this._data!="string"&&this._data.type==="FeatureCollection"){const t=new Map;for(const o of this._data.features)t.set(o.id,o);for(const o of l.features)t.set(o.id,o);this._data.features=[...t.values()]}else this._data=l;return this._updateWorkerData(!0),this}getClusterExpansionZoom(l,t){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:l,source:this.id,scope:this.scope},t),this}getClusterChildren(l,t){return this.actor.send("geojson.getClusterChildren",{clusterId:l,source:this.id,scope:this.scope},t),this}getClusterLeaves(l,t,o,c){return this.actor.send("geojson.getClusterLeaves",{source:this.id,scope:this.scope,clusterId:l,limit:t,offset:o},c),this}_updateWorkerData(l=!1){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new s.z("dataloading",{dataType:"source"})),this._loaded=!1;const t=Object.assign({append:l},this.workerOptions);t.scope=this.scope;const o=this._data;typeof o=="string"?(t.request=this.map._requestManager.transformRequest(s.o.resolveURL(o),s.R.Source),t.request.collectResourceTiming=this._collectResourceTiming):t.data=JSON.stringify(o),this._pendingLoad=this.actor.send(`${this.type}.loadData`,t,(c,d)=>{if(this._loaded=!0,this._pendingLoad=null,c)this.fire(new s.y(c));else{const p={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&d&&d.resourceTiming&&d.resourceTiming[this.id]&&(p.resourceTiming=d.resourceTiming[this.id]),l&&(this._partialReload=!0),this.fire(new s.z("data",p)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(l),this._coalesce=!1)})}loaded(){return this._loaded}reload(){const l=s.B(this.id,this.scope);this.map.style.clearSource(l),this._updateWorkerData()}loadTile(l,t){const o=l.actor?"reloadTile":"loadTile";l.actor=this.actor;const c=this.map.style?this.map.style.getLut(this.scope):null,d=c?{image:c.image.clone()}
9:null,p=this._partialReload,m={type:this.type,uid:l.uid,tileID:l.tileID,tileZoom:l.tileZoom,zoom:l.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:d,scope:this.scope,pixelRatio:s.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:l.isExtraShadowCaster,scaleFactor:this.map.getScaleFactor(),partial:p,worldview:this.map.getWorldview(),indoor:this.map.getIndoorTileOptions(this.id,this.scope)};l.request=this.actor.send(o,m,(y,x)=>p&&!x?(l.state="loaded",t(null)):(delete l.request,l.destroy(!1),l.aborted?t(null):y?t(y):(l.loadVectorData(x,this.map.painter,o==="reloadTile"),t(null))),void 0,o==="loadTile")}abortTile(l){l.request&&(l.request.cancel(),delete l.request),l.aborted=!0}unloadTile(l,t){this.actor.send("removeTile",{uid:l.uid,type:this.type,source:this.id,scope:this.scope}),l.destroy()}onRemove(l){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return Object.assign({}
9,this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends s.aU{constructor(l,t,o,c){super(l,t,o,c),this.roundZoom=!0,this.type="video",this.options=t}load(){this._loaded=!1;const l=this.options;this.urls=[];for(const t of l.urls)this.urls.push(this.map._requestManager.transformRequest(t,s.R.Source).url);s.aV(this.urls,(t,o)=>{this._loaded=!0,t?this.fire(new s.y(t)):o&&(this.video=o,this.video.loop=!0,this.video.setAttribute("playsinline",""),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(l){if(this.video){const t=this.video.seekable;l<t.start(0)||l>t.end(0)?this.fire(new s.y(new s.V(`sources.${this.id}`,null,`Playback for this video can be set only between the ${t.start(0)} and ${t.end(0)}-second mark.`))):this.video.currentTime=l}}getVideo(){return this.video}onAdd(l){this.map||(this.map=l,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 l=this.map.painter.context,t=l.gl;this.texture?this.video.paused||(this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this.texture=new s.T(l,this.video,t.RGBA8),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(l)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:s.aU,model:s.aX,"batched-model":class extends s.E{constructor(l,t,o,c){super(),this.type="batched-model",this.id=l,this.tileSize=512,this._options=t,this.tiles=this._options.tiles,this.maxzoom=t.maxzoom||19,this.minzoom=t.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=o,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(c)}onAdd(l){this.map=l,this.load()}reload(){this.cancelTileJSONRequest();const l=s.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(l))}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}load(l){this._loaded=!1,this.fire(new s.z("dataloading",{dataType:"source"}));const t=Array.isArray(this.map._language)?this.map._language.join():this.map._language,o=this.map.getWorldview();this._tileJSONRequest=as(this._options,this.map._requestManager,t,o,(c,d)=>{this._tileJSONRequest=null,this._loaded=!0,c?(t&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${t}`),o&&o.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${o}`),this.fire(new s.y(c))):d&&(Object.assign(this,d),d.bounds&&(this.tileBounds=new xn(d.bounds,this.minzoom,this.maxzoom)),ki(d.tiles,this.map._requestManager._customAccessToken),this.fire(new s.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.z("data",{dataType:"source",sourceDataType:"content"}))),l&&l(c)})}hasTransition(){return!1}hasTile(l){return!this.tileBounds||this.tileBounds.contains(l.canonical)}loaded(){return this._loaded}loadTile(l,t){const o=this.map._requestManager.normalizeTileURL(l.tileID.canonical.url(this.tiles,this.scheme)),c={request:this.map._requestManager.transformRequest(o,s.R.Tile),data:void 0,uid:l.uid,tileID:l.tileID,tileZoom:l.tileZoom,zoom:l.tileID.overscaledZ,tileSize:this.tileSize*l.tileID.overscaleFactor(),type:this.t
9ype,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:l.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,pixelRatio:s.o.devicePixelRatio,promoteId:this.promoteId};if(l.actor&&l.state!=="expired")if(l.state==="loading")l.reloadCallback=t;else{if(l.buckets){const p=Object.values(l.buckets);for(const m of p)m.dirty=!0;return void(l.state="loaded")}l.request=l.actor.send("reloadTile",c,d.bind(this))}else l.actor=this.dispatcher.getActor(),l.request=l.actor.send("loadTile",c,d.bind(this),void 0,!0);function d(p,m){return l.aborted?t(null):p&&p.status!==404?t(p):(this.map._refreshExpiredTiles&&m&&l.setExpiryData(m),l.loadModelData(m,this.map.painter),l.state="loaded",void t(null))}}serialize(){return Object.assign({},this._options)}},canvas:class extends s.aU{constructor(l,t,o,c){super(l,t,o,c),t.coordinates?Array.isArray(t.coordinates)&&t.coordinates.length===4&&!t.coordinates.some(d=>!Array.isArray(d)||d.length!==2||d.some(p=>typeof p!="number"))||this.fire(new s.y(new s.V(`sources.${l}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new s.y(new s.V(`sources.${l}`,null,'missing required property "coordinates"'))),t.animate&&typeof t.animate!="boolean"&&this.fire(new s.y(new s.V(`sources.${l}`,null,'optional "animate" property must be a boolean value'))),t.canvas?typeof t.canvas=="string"||t.canvas instanceof HTMLCanvasElement||this.fire(new s.y(new s.V(`sources.${l}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new s.y(new s.V(`sources.${l}`,null,'missing required property "canvas"'))),this.options=t,this.animate=t.animate===void 0||t.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 s.y(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(l){this.map=l,this.load(),this.canvas&&this.animate&&this.play()}onRemove(l){this.pause()}prepare(){let l=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,l=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,l=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const t=this.map.painter.context;this.texture?!l&&!this._playing||this.texture instanceof s.aW||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new s.T(t,this.canvas,t.gl.RGBA8,{premultiply:!0}),this._prepareData(t)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const l of[this.canvas.width,this.canvas.height])if(isNaN(l)||l<=0)return!0;return!1}},custom:class extends s.E{constructor(l,t,o,c){super(),this.id=l,this.type="custom",this._dataType="raster",this._dispatcher=o,this._implementation=t,this.setEventedParent(c),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new s.y(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new s.y(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new xn(this._implementation.bounds,this.minzoom,this.maxzoom)),t.update=this._update.bind(this),t.clearTiles=this._clearTiles.bind(this),t.coveringTiles=this._coveringTiles.bind(this),Object.assign(this,s.aH(t,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return s.aH(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new s.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.z("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(l){this.map=l,this._loaded=!1,this.fire(new s.z("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(l),this.load()}onRemove(l){this._implementation.onRemove&&this._implementation.onRemove(l)}hasTile(l){if(this._implementation.hasTile){const{x:t,y:o,z:c}=l.canonical;return this._implementation.hasTile({x:t,y:o,z:c})}return!this.tileBounds||this.tileBounds.contains(l.canonical)}loadTile(l,t){const{x:o,y:c,z:d}=l.tileID.canonical,p=new AbortController;l.request=Promise.resolve(this._implementation.loadTile({x:o,y:c,z:d},{signal:p.signal})).then((function(m){return delete l.request,l.aborted?(l.state="unloaded",t(null)):m===void 0?(l.state="errored",t(null)):m===null?(this.loadTileData(l,{width:this.tileSize,height:this.tileSize,data:null}),l.state="loaded",t(null)):(function(y){return y instanceof ImageData||y instanceof HTMLCanvasElement||y instanceof ImageBitmap||y instanceof HTMLImageElement})(m)?(this.loadTileData(l,m),l.state="loaded",void t(null)):(l.state="errored",t(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}).bind(this)).catch(m=>{m.name!=="AbortError"&&(l.state="errored",t(m))}),l.request.cancel=()=>p.abort()}loadTileData(l,t){l.setTexture(t,this.map.painter)}unloadTile(l,t){if(l.texture&&l.texture instanceof s.T?(l.destroy(!1),l.texture&&l.texture instanceof s.T&&this.map.painter.saveTileTexture(l.texture)):l.destroy(),this._implementation.unloadTile){const{x:o,y:c,z:d}=l.tileID.canonical;this._implementation.unloadTile({x:o,y:c,z:d})}t&&t()}abortTile(l,t){l.request&&l.request.cancel&&(l.request.cancel(),delete l.request),t&&t()}hasTransition(){return!1}_coveringTiles(){return this.map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}
vendor: 18,651 bytes, line 9
9).map(l=>({x:l.canonical.x,y:l.canonical.y,z:l.canonical.z}))}_clearTiles(){const l=s.B(this.id,this.scope);this.map.style.clearSource(l)}_update(){this.fire(new s.z("data",{dataType:"source",sourceDataType:"content"}))}}},Ns=function(l,t,o,c){const d=new ko[t.type](l,t,o,c);if(d.id!==l)throw new Error(`Expected Source id to be ${l} instead of ${d.id}`);return s.aY(["load","abort","unload","serialize","prepare"],d),d};function Rn(l,t,o=""){return`${o}:${t.id||""}:${t.layer.id}:${(function(c){if("layerId"in c)return`layer:${c.layerId}`;{const{featuresetId:d,importId:p}=c;return`featureset:${d}${p?`:import:${p}`:""}`}})(l.target)}`}function ll(l,t,o,c=""){if(l.uniqueFeatureID){const d=Rn(l,t,c);if(o.has(d))return!0;o.add(d)}return!1}function cl(l,t,o,c,d=!1,p=void 0){const m=t.sourceCache.transform,y=t.sourceCache.tilesIn(l,t.has3DLayers,d);y.sort(ku);const x=[];for(const T of y){const S=T.tile.queryRenderedFeatures(t,T,o,c,m,d,p);Object.keys(S).length&&x.push({wrappedTileID:T.tile.tileID.wrapped().key,queryResults:S})}for(const T in t.layers){const S=t.layers[T];if(S.styleLayer){const M=S.styleLayer.queryRenderedFeatures(l,t.sourceCache,c);Object.keys(M).length&&x.push({wrappedTileID:0,queryResults:M})}}return x.length===0?{}:(function(T){const S={},M={};for(const A of T){const C=A.queryResults,L=A.wrappedTileID,z=M[L]=M[L]||{};for(const O in C){const N=C[O],q=z[O]=z[O]||{},G=S[O]=S[O]||[];for(const j of N)q[j.featureIndex]||(q[j.featureIndex]=!0,G.push(j))}}return S})(x)}function Xd(l,t,o,c,d,p){const m={},y=c.queryRenderedSymbols(l),x=[];for(const T of Object.keys(y).map(Number))x.push(d[T]);x.sort(ku);for(const T of x){const S=T.featureIndex.lookupSymbolFeatures(y[T.bucketInstanceId],T.bucketIndex,T.sourceLayerIndex,t,o,p);for(const M in S){const A=m[M]=m[M]||[],C=S[M];C.sort((L,z)=>{const O=T.featureSortOrder;if(O){const N=O.indexOf(L.featureIndex);return O.indexOf(z.featureIndex)-N}return z.featureIndex-L.featureIndex});for(const L of C)A.push(L)}}return m}function Yd(l,t){const o=l.getRenderableIds().map(p=>l.getTileByID(p)),c=[],d={};for(let p=0;p<o.length;p++){const m=o[p],y=m.tileID.canonical.key;d[y]||(d[y]=!0,m.querySourceFeatures(c,t))}return c}function ku(l,t){const o=l.tileID,c=t.tileID;return o.overscaledZ-c.overscaledZ||o.canonical.y-c.canonical.y||o.wrap-c.wrap||o.canonical.x-c.canonical.x}function Bu(l,t){const o={};if(!t)return o;for(const c of l){const d=c.layerIds.map(p=>t.getLayer(p)).filter(Boolean);if(d.length!==0){c.layers=d,c.stateDependentLayerIds&&(c.stateDependentLayers=c.stateDependentLayerIds.map(p=>d.filter(m=>m.id===p)[0]));for(const p of d)o[p.fqid]=c}}return o}const Er=32,zn=33,Bo=new Uint16Array(8184);for(let l=0;l<2046;l++){let t=l+2,o=0,c=0,d=0,p=0,m=0,y=0;for(1&t?d=p=m=Er:o=c=y=Er;(t>>=1)>1;){const T=o+d>>1,S=c+p>>1;1&t?(d=o,p=c,o=m,c=y):(o=d,c=p,d=m,p=y),m=T,y=S}const x=4*l;Bo[x+0]=o,Bo[x+1]=c,Bo[x+2]=d,Bo[x+3]=p}const Dn=new Uint16Array(2178),po=new Uint8Array(1089),pa=new Uint16Array(1089);function ma(l){return l===0?-.03125:l===32?.03125:0}const Vs={type:2,extent:s.al,loadGeometry:()=>[[new s.P(0,0),new s.P(s.al+1,0),new s.P(s.al+1,s.al+1),new s.P(0,s.al+1),new s.P(0,0)]]};class ls{constructor(t,o,c,d,p,m){this.tileID=t,this.uid=s.b2(),this.uses=0,this.tileSize=o,this.tileZoom=c,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=p,d&&d.style&&(this._lastUpdatedBrightness=d.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",d&&d.transform&&(this.projection=d.transform.projection),this.worldview=m,this._hasAppearances=null}registerFadeDuration(t){const o=t+this.timeAdded;o<s.o.now()||this.fadeEndTime&&o<this.fadeEndTime||(this.fadeEndTime=o)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}get tileTransform(){return this._tileTransform||(this._tileTransform=s.aZ(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(t,o,c){if(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=Bu(t.buckets,o.style),this.hasSymbolBuckets=!1;for(const d in this.buckets){const p=this.buckets[d];if(p instanceof s.b4){if(this.hasSymbolBuckets=!0,!c)break;p.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const d in this.buckets){const p=this.buckets[d];if(p instanceof s.b4&&p.hasRTLText){this.hasRTLText=!0,s.b5();break}}this.queryPadding=0;for(const d in this.buckets){const p=this.buckets[d],m=o.style.getOwnLayer(d);if(!m)continue;const y=m.queryRadius(p);this.queryPadding=Math.max(this.queryPadding,y)}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),t.lineAtlas&&(this.lineAtlas=t.lineAtlas),this._lastUpdatedBrightness=t.brightness}else this.collisionBoxArray=new s.b3}unloadVectorData(){if(this.hasData()){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}loadModelData(t,o,c){t&&(t.resourceTiming&&(this.resourceTiming=t.resourceTiming),this.buckets=Object.assign({},this.buckets,Bu(t.buckets,o.style)),t.featureIndex&&(this.latestFeatureIndex=t.featureIndex))}getBucket(t){return this.buckets[t.fqid]}upload(t,o){for(const p in this.buckets){const m=this.buckets[p];if(m.uploadPending()){let y={},x=[],T={zoom:0,pitch:0,brightness:0,worldview:""};if(o){if(o.style){x=o.style.listImages();const S=m.layers[0],M=S.sourceLayer||"_geojsonTileLayer",A=o.style.getLayerSourceCache(S);A&&(y=A._state.getState(M,void 0))}T={zoom:o.transform.zoom||0,pitch:o.transform.pitch||0,brightness:o.style.getBrightness()||0,worldview:o.worldview||""}}m.upload(t,this.tileID.canonical,y,x,T)}}const c=t.gl,d=this.imageAtlas;d&&!d.uploaded&&(this.imageAtlasTexture=new s.T(t,d.image,c.RGBA8,{useMipmap:!!d.patternPositions.size}),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new s.T(t,this.glyphAtlasImage,c.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new s.T(t,this.lineAtlas.image,c.R8),this.lineAtlas.uploaded=!0)}prepare(t,o,c){if(this.imageAtlas&&this.imageAtlasTexture&&o){const p=o.style.getLut(c);this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture,c,p)}if(!o||!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData)return;const d=o.style.getBrightness();this._hasAppearances===null&&(this._hasAppearances=this.hasAppearances(o)),(this._lastUpdatedBrightness||d||this._hasAppearances)&&(!this._hasAppearances&&this._lastUpdatedBrightness&&d&&Math.abs(this._lastUpdatedBrightness-d)<.001||(this.updateBuckets(o,this._lastUpdatedBrightness!==d),this._lastUpdatedBrightness=d))}evaluateQueryRenderedFeaturePadding(){let t=0;for(const o in this.buckets){const c=this.buckets[o];c.evaluateQueryRenderedFeaturePadding&&(t=Math.max(t,c.evaluateQueryRenderedFeaturePadding()))}return t}queryRenderedFeatures(t,o,c,d,p,m,y){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData&&!this.latestFeatureIndex.is3DTile)return{};const x=this.evaluateQueryRenderedFeaturePadding(),T=(function(S,M){const A=s.bq([],[.5*S.width,.5*-S.height,1]);return s.br(A,A,[1,-1,0]),s.aB(A,A,S.calculateProjMatrix(M.toUnwrapped())),Float32Array.from(A)})(p,this.tileID);return this.latestFeatureIndex.query(t,{tilespaceGeometry:o,pixelPosMatrix:T,transform:d,availableImages:c,tileTransform:this.tileTransform,worldview:this.worldview,queryRadius:x,scope:y})}querySourceFeatures(t,o){const c=this.latestFeatureIndex;if(!c||!c.rawTileData)return;const d=c.loadVTLayers(),p=o?o.sourceLayer:"",m=d._geojsonTileLayer||d[p];if(!m)return;const y=s.b6(o&&o.filter),{z:x,x:T,y:S}=this.tileID.canonical,M={z:x,x:T,y:S};for(let A=0;A<m.length;A++){const C=m.feature(A);if(y.needGeometry){const O=s.b7(C,!0);if(!y.filter(new s.ac(this.tileID.overscaledZ,{worldview:this.worldview}),O,this.tileID.canonical))continue}else if(!y.filter(new s.ac(this.tileID.overscaledZ,{worldview:this.worldview}),C))continue;const L=c.getId(C,p),z=new s.b8(C,x,T,S,L);z.tile=M,t.push(z)}}loaded(){return this.state==="loaded"||this.state==="errored"}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return!!this.imageAtlas&&!!this.imageAtlas.patternPositions.size}setExpiryData(t){const o=this.expirationTime;if(t.cacheControl){const c=s.b9(t.cacheControl);c["max-age"]&&(this.expirationTime=Date.now()+1e3*c["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const c=Date.now();let d=!1;if(this.expirationTime>c)d=!1;else if(o)if(this.expirationTime<o)d=!0;else{const p=this.expirationTime-o;p?this.expirationTime=c+Math.max(p,3e4):d=!0}else d=!0;d?(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)}refreshFeatureState(t){this.latestFeatureIndex&&(this.latestFeatureIndex.rawTileData||this.latestFeatureIndex.is3DTile)&&t&&this.updateBuckets(t)}hasAppearances(t){for(const o in this.buckets)if(t.style.hasLayer(o)&&this.buckets[o].layers.some(c=>c.appearances&&c.appearances.length>0))return!0;return!1}updateBuckets(t,o){if(!this.latestFeatureIndex||!t.style)return;const c=t.style.listImages(),d=t.style.getBrightness();for(const p in this.buckets){if(!t.style.hasLayer(p))continue;const m=this.buckets[p],y=m.layers[0],x=y.sourceLayer||"_geojsonTileLayer",T=t.style.getLayerSourceCache(y);let S={};T&&(S=T._state.getState(x,void 0));const M=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},A=Object.keys(S).length>0&&!o;m.hasAppearances=m.layers.some(z=>z.appearances&&z.appearances.length>0);const C=A?m.stateDependentLayers:m.layers;if(A&&m.stateDependentLayers.length!==0||o){const z=this.latestFeatureIndex.loadVTLayers();m.update(S,z[x],c,M,C,o,d)}if(A&&m.stateDependentLayers.length!==0||o||m.hasAppearances){const z={zoom:t.transform.zoom,pitch:t.transform.pitch,brightness:t.style.getBrightness()||0,worldview:t.worldview};m.updateAppearances(this.tileID.canonical,S,c,z,t.imageManager)}(m instanceof s.ba||m instanceof s.bb)&&t._terrain&&t._terrain.enabled&&T&&m.uploadPending()&&t._terrain._clearRenderCacheForTile(T.id,this.tileID);const L=t&&t.style&&t.style.getOwnLayer(p);L&&(this.queryPadding=Math.max(this.queryPadding,L.queryRadius(m)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<s.o.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=s.o.now()+t}setTexture(t,o){const c=o.context,d=c.gl;this.texture=this.texture||o.getTileTexture(t.width),this.texture&&this.texture instanceof s.T?this.texture.update(t):(this.texture=new s.T(c,t,d.RGBA8,{useMipmap:!0}),this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE))}setDependencies(t,o){const c={};for(const d of o)c[d]=!0;this.dependencies[t]=c}hasDependency(t,o){for(const c of t){const d=this.dependencies[c];if(d){for(const p of o)if(d[p])return!0}}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(t,o){if(!o||o.name==="mercator"||this._tileDebugBuffer)return;const c=s.bc(Vs,this.tileID.canonical,this.tileTransform)[0],d=new s.bd,p=new s.be;for(let m=0;m<c.length;m++){const{x:y,y:x}=c[m];d.emplaceBack(y,x),p.emplaceBack(m)}p.emplaceBack(0),this._tileDebugIndexBuffer=t.createIndexBuffer(p),this._tileDebugBuffer=t.createVertexBuffer(d,s.bf.members),this._tileDebugSegments=s.bg.simpleSegment(0,0,d.length,p.length)}_makeTileBoundsBuffers(t,o){if(this._tileBoundsBuffer||!o||o.name==="mercator")return;const c=s.bc(Vs,this.tileID.canonical,this.tileTransform)[0];let d,p;if(this.isRaster){const m=(function(y,x){const T=s.aZ(y,x),S=Math.pow(2,y.z);for(let O=0;O<zn;O++)for(let N=0;N<zn;N++){const q=s.a_((y.x+(N+ma(N))/Er)/S),G=s.a$((y.y+(O+ma(O))/Er)/S),j=x.project(q,G),ie=O*zn+N;Dn[2*ie+0]=Math.round((j.x*T.scale-T.x)*s.al),Dn[2*ie+1]=Math.round((j.y*T.scale-T.y)*s.al)}po.fill(0),pa.fill(0);for(let O=2045;O>=0;O--){const N=4*O,q=Bo[N+0],G=Bo[N+1],j=Bo[N+2],ie=Bo[N+3],Q=q+j>>1,te=G+ie>>1,X=Q+te-G,Z=te+q-Q,ne=G*zn+q,ce=ie*zn+j,de=te*zn+Q,ve=Math.hypot((Dn[2*ne+0]+Dn[2*ce+0])/2-Dn[2*de+0],(Dn[2*ne+1]+Dn[2*ce+1])/2-Dn[2*de+1])>=16;po[de]=po[de]||(ve?1:0),O<1022&&(po[de]=po[de]||po[(G+Z>>1)*zn+(q+X>>1)]||po[(ie+Z>>1)*zn+(j+X>>1)])}const M=new s.b1,A=new s.b0;let C=0;function L(O,N){const q=N*zn+O;return pa[q]===0&&(M.emplaceBack(Dn[2*q+0],Dn[2*q+1],O*s.al/Er,N*s.al/Er),pa[q]=++C),pa[q]-1}function z(O,N,q,G,j,ie){const Q=O+q>>1,te=N+G>>1;if(Math.abs(O-j)+Math.abs(N-ie)>1&&po[te*zn+Q])z(j,ie,O,N,Q,te),z(q,G,j,ie,Q,te);else{const X=L(O,N),Z=L(q,G),ne=L(j,ie);A.emplaceBack(X,Z,ne)}}return z(0,0,Er,Er,Er,0),z(Er,Er,0,0,0,Er),{vertices:M,indices:A}})(this.tileID.canonical,o);d=m.vertices,p=m.indices}else{d=new s.b1,p=new s.b0;for(const{x:y,y:x}of c)d.emplaceBack(y,x,0,0);const m=s.bh(d.int16.subarray(0,4*d.length),void 0,4);for(let y=0;y<m.length;y+=3)p.emplaceBack(m[y],m[y+1],m[y+2])}this._tileBoundsBuffer=t.createVertexBuffer(d,s.bi.members),this._tileBoundsIndexBuffer=t.createIndexBuffer(p),this._tileBoundsSegments=s.bg.simpleSegment(0,0,d.length,p.length)}_makeGlobeTileDebugBuffers(t,o){const c=o.projection;if(!c||c.name!=="globe"||o.freezeTileCoverage)return;const d=this.tileID.canonical,p=s.bj(d,o),m=s.bk(p),y=s.aj(o.zoom);let x;y>0&&(x=s.bl(new Float64Array(16),o.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(t,d,o,m,x,y),this._makeGlobeTileDebugTextBuffer(t,d,o,m,x,y)}_globePoint(t,o,c,d,p,m,y){let x=s.bm(t,o,c);if(m){const T=1<<c.z,S=s.aF(d.center.lng),M=s.aJ(d.center.lat),A=(c.x+.5)/T-S;let C=0;A>.5?C=-1:A<-.5&&(C=1);let L=(t/s.al+c.x)/T+C,z=(o/s.al+c.y)/T;L=(L-S)*d._pixelsPerMercatorPixel+S,z=(z-M)*d._pixelsPerMercatorPixel+M;const O=[L*d.worldSize,z*d.worldSize,0];s.af(O,O,m),x=s.bn(x,O,y)}return s.af(x,x,p)}_makeGlobeTileDebugBorderBuffer(t,o,c,d,p,m){const y=new s.bd,x=new s.be,T=new s.bo,S=(A,C,L,z,O)=>{const N=(L-A)/(O-1),q=(z-C)/(O-1),G=y.length;for(let j=0;j<O;j++){const ie=A+j*N,Q=C+j*q;y.emplaceBack(ie,Q);const te=this._globePoint(ie,Q,o,c,d,p,m);T.emplaceBack(te[0],te[1],te[2]),x.emplaceBack(G+j)}},M=s.al;S(0,0,M,0,16),S(M,0,M,M,16),S(M,M,0,M,16),S(0,M,0,0,16),this._tileDebugIndexBuffer=t.createIndexBuffer(x),this._tileDebugBuffer=t.createVertexBuffer(y,s.bf.members),this._globeTileDebugBorderBuffer=t.createVertexBuffer(T,s.bp.members),this._tileDebugSegments=s.bg.simpleSegment(0,0,y.length,x.length)}_makeGlobeTileDebugTextBuffer(t,o,c,d,p,m){const y=s.al/4,x=new s.bd,T=new s.b0,S=new s.bo,M=25;T.reserve(32),x.reserve(M),S.reserve(M);const A=(C,L)=>M*C+L;for(let C=0;C<M;C++){const L=C*y;for(let z=0;z<M;z++){const O=z*y;x.emplaceBack(O,L);const N=this._globePoint(O,L,o,c,d,p,m);S.emplaceBack(N[0],N[1],N[2])}}for(let C=0;C<4;C++)for(let L=0;L<4;L++){const z=A(C,L),O=A(C,L+1),N=A(C+1,L),q=A(C+1,L+1);T.emplaceBack(z,O,N),T.emplaceBack(N,O,q)}this._tileDebugTextIndexBuffer=t.createIndexBuffer(T),this._tileDebugTextBuffer=t.createVertexBuffer(x,s.bf.members),this._globeTileDebugTextBuffer=t.createVertexBuffer(S,s.bp.members),this._tileDebugTextSegments=s.bg.simpleSegment(0,0,M,32)}destroy(t=!0){for(const o in this.buckets)this.buckets[o].destroy(t);this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&(this.imageAtlasTexture.destroy(),delete this.imageAtlasTexture),this.glyphAtlasTexture&&(this.glyphAtlasTexture.destroy(),delete this.glyphAtlasTexture),this.lineAtlasTexture&&(this.lineAtlasTexture.destroy(),delete this.lineAtlasTexture),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),t&&this.texture&&this.texture instanceof s.T&&(this.texture.destroy(),delete this.texture),this.emissiveTexture&&this.emissiveTexture instanceof s.T&&(this.emissiveTexture.destroy(),delete this.emissiveTexture),this.hillshadeFBO&&(this.hillshadeFBO.destroy(),delete this.hillshadeFBO),this.dem&&delete this.dem,this.neighboringTiles&&delete this.neighboringTiles,this.demTexture&&(this.demTexture.destroy(),delete this.demTexture),this.rasterParticleState&&(this.rasterParticleState.destroy(),delete this.rasterParticleState),this.latestFeatureIndex=null,this.state="unloaded"}}s.bs.setPbf(s.bt);class dc extends ls{constructor(t,o,c,d,p){super(t,o,c,d,p),this._workQueuePerLayer=new Map,this._fetchQueuePerLayer=new Map,this._taskQueue=new Map,this._isHeaderLoaded=!1,this.textureDescriptorPerLayer=new Map,this.texturePerLayer=new Map}
9getLayers(){return this._mrt?Object.values(this._mrt.layers):[]}getLayer(t){return this._mrt&&this._mrt.getLayer(t)}setTexturePerLayer(t,o,c){const d=c.context,p=d.gl;let m=this.texturePerLayer.get(t)||c.getTileTexture(o.width);m&&m instanceof s.T?m.update(o,{premultiply:!1}):m=new s.T(d,o,p.RGBA8,{premultiply:!1}),this.texturePerLayer.has(t)||this.texturePerLayer.set(t,m)}flushQueues(t){const o=this._workQueuePerLayer.get(t)||[],c=this._fetchQueuePerLayer.get(t)||[];for(;o.length;)o.pop()();for(;c.length;)c.pop()()}flushAllQueues(){for(const t of this._workQueuePerLayer.keys()){const o=this._workQueuePerLayer.get(t)||[];for(;o.length;)o.pop()()}for(const t of this._fetchQueuePerLayer.keys()){const o=this._fetchQueuePerLayer.get(t)||[];for(;o.length;)o.pop()()}}fetchHeader(t=16384,o){const c=this._mrt=new s.bs(30),d=Object.assign({},this.requestParams,{headers:{Range:"bytes=0-"+(t-1)}});return this.entireBuffer=null,this.request=s.bu(d,(p,m,y)=>{if(p)o(p);else try{const x=c.getHeaderLength(m);if(x>t)return void(this.request=this.fetchHeader(x,o));c.parseHeader(m),this._isHeaderLoaded=!0;let T=0;for(const S of Object.values(c.layers))T=Math.max(T,S.dataIndex[S.dataIndex.length-1].lastByte);m.byteLength>=T&&(this.entireBuffer=m),o(null,this.entireBuffer||m,y)}catch(x){o(x)}}),this.request}fetchBandForRender(t,o,c,d){this.fetchBand(t,o,c,p=>{if(p)return void d(p);this.updateTextureDescriptor(t,o,c);const m=this.textureDescriptorPerLayer.get(o);d(null,m?m.img:null)})}fetchBand(t,o,c,d,p=!0){const m=this._mrt;if(!this._isHeaderLoaded||!m)return void d(new Error("Tile header is not ready"));const y=this.actor;if(!y)return void d(new Error("Can't fetch tile band without an actor"));let x;const T=s.B(String(c),s.B(this.tileID.key,t));let S=this._taskQueue.get(T);S?S.add(d):(S=new Set,S.add(d),this._taskQueue.set(T,S));const M=(z,O)=>{x.complete(z,O),z?d(z):(S.forEach(N=>N(null,O)),this._taskQueue.delete(T))},A=(z,O)=>{if(z)return d(z);const N=y.send("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:O,task:x},M,void 0,!0);if(o!==null){const q=this._workQueuePerLayer.get(o)||[];q.push(()=>{N&&N.cancel(),x.cancel()}),this._workQueuePerLayer.has(o)||this._workQueuePerLayer.set(o,q)}};let C;try{C=m.getLayer(t)}catch(z){if(this.state==="reloading")return;throw z}if(!C)return void d(new Error(`Unknown sourceLayer "${t}"`));if(C.hasDataForBand(c))return S.forEach(z=>z(null,null)),void this._taskQueue.delete(T);const L=C.getDataRange([c]);if(x=m.createDecodingTask(L),!x||x.tasks.length)if(o!==null&&this.flushQueues(o),this.entireBuffer)A(null,this.entireBuffer.slice(L.firstByte,L.lastByte+1));else{const z=Object.assign({},this.requestParams,{headers:{Range:`bytes=${L.firstByte}-${L.lastByte}`}}),O=s.bu(z,A);if(o!==null){const N=this._fetchQueuePerLayer.get(o)||[];N.push(()=>{O.cancel(),x.cancel()}),this._fetchQueuePerLayer.has(o)||this._fetchQueuePerLayer.set(o,N)}}}updateNeeded(t,o){return(!this.textureDescriptorPerLayer.get(t)||this.textureDescriptorPerLayer.get(t).band!==o||this.refreshedUponExpiration)&&this.state!=="errored"}updateTextureDescriptor(t,o,c){if(!this._mrt)return;const d=this._mrt.getLayer(t);if(!d||!d.hasBand(c)||!d.hasDataForBand(c))return;const{bytes:p,tileSize:m,buffer:y,offset:x,scale:T}=d.getBandView(c),S=m+2*y,M=new s.q({width:S,height:S},p),A=this.texturePerLayer.get(o);A&&A instanceof s.T&&A.update(M,{premultiply:!1}),this.textureDescriptorPerLayer.set(o,{layer:t,band:c,img:M,buffer:y,offset:x,tileSize:m,format:d.pixelFormat,mix:[T,256*T,65536*T,16777216*T]})}destroy(t=!1){if(super.destroy(t),delete this._mrt,!t)for(const o of this.texturePerLayer.values())o&&o instanceof s.T&&o.destroy();this.texturePerLayer.clear(),this.textureDescriptorPerLayer.clear(),this.fbo&&(this.fbo.destroy(),delete this.fbo),delete this.request,delete this.requestParams,this._isHeaderLoaded=!1}}class Kd{constructor(t,o){this.max=t,this.onRemove=o,this.reset()}reset(){for(const t in this.data)for(const o of this.data[t])o.timeout&&clearTimeout(o.timeout),this.onRemove(o.value);return this.data={},this.order=[],this}add(t,o,c){const d=t.wrapped().key;this.data[d]===void 0&&(this.data[d]=[]);const p={value:o,timeout:void 0};if(c!==void 0&&(p.timeout=setTimeout(()=>{this.remove(t,p)},c)),this.data[d].push(p),this.order.push(d),this.order.length>this.max){const m=this._getAndRemoveByKey(this.order[0]);m&&this.onRemove(m)}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 o=this.data[t].shift();return o.timeout&&clearTimeout(o.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),o.value}getByKey(t){const o=this.data[t];return o?o[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,o){if(!this.has(t))return this;const c=t.wrapped().key,d=o===void 0?0:this.data[c].indexOf(o),p=this.data[c][d];return this.data[c].splice(d,1),p.timeout&&clearTimeout(p.timeout),this.data[c].length===0&&delete this.data[c],this.onRemove(p.value),this.order.splice(this.order.indexOf(c),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const o=this._getAndRemoveByKey(this.order[0]);o&&this.onRemove(o)}return this}filter(t){const o=[];for(const c in this.data)for(const d of this.data[c])t(d.value)||o.push(d);for(const c of o)this.remove(c.value.tileID,c)}}class Jd{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,o,c){const d=String(o);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][d]=this.stateChanges[t][d]||{},Object.assign(this.stateChanges[t][d],c),this.deletedStates[t]===null){this.deletedStates[t]={};for(const p in this.state[t])p!==d&&(this.deletedStates[t][p]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][d]===null){this.deletedStates[t][d]={};for(const p in this.state[t][d])c[p]||(this.deletedStates[t][d][p]=null)}else for(const p in c)this.deletedStates[t]&&this.deletedStates[t][d]&&this.deletedStates[t][d][p]===null&&delete this.deletedStates[t][d][p]}removeFeatureState(t,o,c){if(this.deletedStates[t]===null)return;const d=String(o);if(this.deletedStates[t]=this.deletedStates[t]||{},c&&o!==void 0)this.deletedStates[t][d]!==null&&(this.deletedStates[t][d]=this.deletedStates[t][d]||{},this.deletedStates[t][d][c]=null);else if(o!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][d])for(c in this.deletedStates[t][d]={},this.stateChanges[t][d])this.deletedStates[t][d][c]=null;else this.deletedStates[t][d]=null;else this.deletedStates[t]=null}getState(t,o){const c=this.state[t]||{},d=this.stateChanges[t]||{},p=this.deletedStates[t];if(p===null)return{};if(o!==void 0){const y=String(o),x=Object.assign({},c[y],d[y]);if(p){const T=p[o];if(T===null)return{};for(const S in T)delete x[S]}return x}const m=Object.assign({},c,d);if(p)for(const y in p)delete m[y];return m}
9initializeTileState(t,o){t.refreshFeatureState(o)}coalesceChanges(t,o){const c={};for(const d in this.stateChanges){this.state[d]=this.state[d]||{};const p={};for(const m in this.stateChanges[d])this.state[d][m]||(this.state[d][m]={}),Object.assign(this.state[d][m],this.stateChanges[d][m]),p[m]=this.state[d][m];c[d]=p}for(const d in this.deletedStates){this.state[d]=this.state[d]||{};const p={};if(this.deletedStates[d]===null)for(const m in this.state[d])p[m]={},this.state[d][m]={};else for(const m in this.deletedStates[d]){if(this.deletedStates[d][m]===null)this.state[d][m]={};else if(this.state[d][m])for(const y of Object.keys(this.deletedStates[d][m]))delete this.state[d][m][y];p[m]=this.state[d][m]}c[d]=c[d]||{},Object.assign(c[d],p)}if(this.stateChanges={},this.deletedStates={},Object.keys(c).length!==0)for(const d in t)t[d].refreshFeatureState(o)}}class ln extends s.E{constructor(t,o,c){super(),this.id=t,this._onlySymbols=c,o.on("data",d=>{d.dataType==="source"&&d.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&d.dataType==="source"&&d.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),o.on("error",()=>{this._sourceErrored=!0}),this._source=o,this._tiles={},this._cache=new Kd(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=o.minTileCacheSize,this._maxTileCacheSize=o.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new Jd,this._isRaster=this._source.type==="raster"||this._source.type==="raster-dem"||this._source.type==="raster-array"||this._source.type==="custom"&&this._source._dataType==="raster"}onAdd(t){this.map=t,this._minTileCacheSize=this._minTileCacheSize===void 0&&t?t._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=this._maxTileCacheSize===void 0&&t?t._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const t in this._tiles)if(!this._tiles[t].loaded())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)}_loadTile(t,o){return t.isSymbolTile=this._onlySymbols,t.isExtraShadowCaster=this._shadowCasterTiles[t.tileID.key],this._source.loadTile(t,o)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t)}_abortTile(t){if(this._source.abortTile)return this._source.abortTile(t)}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 o in this._tiles){const c=this._tiles[o];c.upload(t,this.map?this.map.painter:void 0),c.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(ul).map(t=>t.key)}getRenderableIds(t,o){const c=[];for(const d in this._tiles)this._isIdRenderable(+d,t,o)&&c.push(this._tiles[d]);return t?c.sort((d,p)=>{const m=d.tileID,y=p.tileID,x=new s.P(m.canonical.x,m.canonical.y)._rotate(this.transform.angle),T=new s.P(y.canonical.x,y.canonical.y)._rotate(this.transform.angle);return m.overscaledZ-y.overscaledZ||T.y-x.y||T.x-x.x}).map(d=>d.tileID.key):c.map(d=>d.tileID).sort(ul).map(d=>d.key)}hasRenderableParent(t){const o=this.findLoadedParent(t,0);return!!o&&this._isIdRenderable(o.tileID.key)}_isIdRenderable(t,o,c){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(o||!this._tiles[t].holdingForFade())&&(c||!this._shadowCasterTiles[t])}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,o){const c=this._tiles[t];c&&(c.state!=="loading"&&(c.state=o),this._loadTile(c,this._tileLoaded.bind(this,c,t,o)))}_tileLoaded(t,o,c,d,p){if(d){if(t.state="errored",d.status!==404)this._source.fire(new s.y(d,{tile:t}));else{if(this._source.fire(new s.z("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:t})),!(t.tileID.key in this._loadedParentTiles))return;if(this._source.type==="raster-dem"&&this.usedForTerrain&&this.map.painter.terrain){const y=this.map.painter.terrain;this.update(this.transform,y.getScaledDemTileSize(),!0),y.resetTileLookupCache(this.id
vendor: 13,591 bytes, line 9
9)}else this.update(this.transform)}return}t.timeAdded=s.o.now(),c==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(o,t),this._source.type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null);let m=new Map;p&&p.responseHeaders&&(m=p.responseHeaders),this._source.fire(new s.z("data",{dataType:"source",tile:t,coord:t.tileID,sourceCacheId:this.id,responseHeaders:m}))}_backfillDEM(t){const o=this.getRenderableIds();for(let d=0;d<o.length;d++){const p=o[d];if(t.neighboringTiles&&t.neighboringTiles[p]){const m=this.getTileByID(p);c(t,m),c(m,t)}}function c(d,p){if(!d.dem||d.dem.borderReady)return;d.needsHillshadePrepare=!0,d.needsDEMTextureUpload=!0;let m=p.tileID.canonical.x-d.tileID.canonical.x;const y=p.tileID.canonical.y-d.tileID.canonical.y,x=Math.pow(2,d.tileID.canonical.z),T=p.tileID.key;m===0&&y===0||Math.abs(y)>1||(Math.abs(m)>1&&(Math.abs(m+x)===1?m+=x:Math.abs(m-x)===1&&(m-=x)),p.dem&&d.dem&&(d.dem.backfillBorder(p.dem,m,y),d.neighboringTiles&&d.neighboringTiles[T]&&(d.neighboringTiles[T].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,o,c,d){for(const p in this._tiles){let m=this._tiles[p];if(d[p]||!m.hasData()||m.tileID.overscaledZ<=o||m.tileID.overscaledZ>c)continue;let y=m.tileID;for(;m&&m.tileID.overscaledZ>o+1;){const T=m.tileID.scaledTo(m.tileID.overscaledZ-1);m=this._tiles[T.key],m&&m.hasData()&&(y=T)}let x=y;for(;x.overscaledZ>o;)if(x=x.scaledTo(x.overscaledZ-1),t[x.key]){d[y.key]=y;break}}}findLoadedParent(t,o){if(t.key in this._loadedParentTiles){const c=this._loadedParentTiles[t.key];return c&&c.tileID.overscaledZ>=o?c:null}for(let c=t.overscaledZ-1;c>=o;c--){const d=t.scaledTo(c),p=this._getLoadedTile(d);if(p)return p}}_getLoadedTile(t){const o=this._tiles[t.key];return o&&o.hasData()?o:this._cache.getByKey(this._source.reparseOverscaled?t.wrapped().key:t.canonical.key)}updateCacheSize(t,o){o=o||this._source.tileSize;const c=Math.ceil(t.width/o)+1,d=Math.ceil(t.height/o)+1,p=Math.floor(c*d*5),m=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,p):p,y=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,m):m;this._cache.setMaxSize(y)}handleWrapJump(t){const o=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,o){const c={};for(const d in this._tiles){const p=this._tiles[d];p.tileID=p.tileID.unwrapTo(p.tileID.wrap+o),c[p.tileID.key]=p}this._tiles=c;for(const d in this._timers)clearTimeout(this._timers[d]),delete this._timers[d];for(const d in this._tiles)this._setTileReloadTimer(+d,this._tiles[d])}}update(t,o,c,d,p){if(this.transform=t,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!c)return;this.updateCacheSize(t,o),this.transform.projection.name!=="globe"&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};const m=this._source.type==="batched-model";let y,x=this._source.maxzoom;const T=this.map&&this.map.painter?this.map.painter._terrain:null;if(T&&T.sourceCache===this&&T.attenuationRange()){const A=T.attenuationRange()[0],C=Math.floor(A)-Math.log2(T.getDemUpscale());x>C&&(x=C)}if(this.used||this.usedForTerrain){if(this._source.tileID)y=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(A=>new s.aQ(A.canonical.z,A.wrap,A.canonical.z,A.canonical.x,A.canonical.y));else if(this.tileCoverLift!==0){const A=t.clone();A.tileCoverLift=this.tileCoverLift,y=A.coveringTiles({tileSize:o||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:x,roundZoom:this._source.roundZoom&&!c,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:m}),this._source.minzoom<=1&&t.projection.name==="globe"&&(y.push(new s.aQ(1,0,1,0,0)),y.push(new s.aQ(1,0,1,1,0)),y.push(new s.aQ(1,0,1,0,1)),y.push(new s.aQ(1,0,1,1,1)))}else if(y=t.coveringTiles({tileSize:o||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:x,roundZoom:this._source.roundZoom&&!c,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:m}),this._source.hasTile){const A=this._source.hasTile.bind(this._source);y=y.filter(C=>A(C))}}else y=[];if(y.length>0&&this.transform.projection.name!=="globe"&&!this.usedForTerrain&&!hl(this._source.type)){const A=t.coveringZoomLevel({tileSize:o||this._source.tileSize,roundZoom:this._source.roundZoom&&!c}),C=Math.min(A,this._source.maxzoom);if(m){const L=t.extendTileCover(y,C);for(const z of L)y.push(z)}else if(p){const L=t.extendTileCoverToNearPlane(y,this.transform.getFrustum(C),C);for(const z of L)y.push(z)}else if(this.castsShadows&&d){const L=t.extendTileCover(y,C,d,16);for(const z of L)this._shadowCasterTiles[z.key]=!0,y.push(z)}}const S=this._updateRetainedTiles(y);if(hl(this._source.type)&&y.length!==0){const A={},C={},L=Object.keys(S);for(const O of L){const N=S[O],q=this._tiles[O];if(!q||q.fadeEndTime&&q.fadeEndTime<=s.o.now())continue;const G=this.findLoadedParent(N,Math.max(N.overscaledZ-ln.maxOverzooming,this._source.minzoom));G&&(this._addTile(G.tileID),A[G.tileID.key]=G.tileID),C[O]=N}const z=y[y.length-1].overscaledZ;for(const O in this._tiles){const N=this._tiles[O];if(S[O]||!N.hasData())continue;let q=N.tileID;for(;q.overscaledZ>z;){q=q.scaledTo(q.overscaledZ-1);const G=this._tiles[q.key];if(G&&G.hasData()&&C[q.key]){S[O]=N.tileID;break}}}for(const O in A)S[O]||(this._coveredTiles[O]=!0,S[O]=A[O])}for(const A in S)this._tiles[A].clearFadeHold();const M=s.bv(this._tiles,S);for(const A of M){const C=this._tiles[A];C.hasSymbolBuckets&&!C.holdingForFade()?C.setHoldDuration(this.map._fadeDuration):C.hasSymbolBuckets&&!C.symbolFadeFinished()||this._removeTile(+A)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(+t)}_updateRetainedTiles(t){const o={};if(t.length===0)return o;const c={},d=t.reduce((T,S)=>Math.min(T,S.overscaledZ),1/0),p=t[0].overscaledZ,m=Math.max(p-ln.maxOverzooming,this._source.minzoom),y=Math.max(p+ln.maxUnderzooming,this._source.minzoom),x={};for(const T of t){const S=this._addTile(T);o[T.key]=T,S.hasData()||d<this._source.maxzoom&&(x[T.key]=T)}this._retainLoadedChildren(x,d,y,o);for(const T of t){let S=this._tiles[T.key];if(S.hasData())continue;if(T.canonical.z>=this._source.maxzoom){const A=T.children(this._source.maxzoom)[0],C=this.getTile(A);if(C&&C.hasData()){o[A.key]=A;continue}}else{const A=T.children(this._source.maxzoom);if(o[A[0].key]&&o[A[1].key]&&o[A[2].key]&&o[A[3].key])continue}let M=S.wasRequested();for(let A=T.overscaledZ-1;A>=m;--A){const C=T.scaledTo(A);if(c[C.key]||(c[C.key]=!0,S=this.getTile(C),!S&&M&&(S=this._addTile(C)),S&&(o[C.key]=C,M=S.wasRequested(),S.hasData())))break}}return o}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const o=[];let c,d=this._tiles[t].tileID;for(;d.overscaledZ>0;){if(d.key in this._loadedParentTiles){c=this._loadedParentTiles[d.key];break}o.push(d.key);const p=d.scaledTo(d.overscaledZ-1);if(c=this._getLoadedTile(p),c)break;d=p}for(const p of o)this._loadedParentTiles[p]=c}}_addTile(t){let o=this._tiles[t.key];if(o)return o.isExtraShadowCaster!==!0||this._shadowCasterTiles[t.key]||this._reloadTile(t.key,"reloading"),o;o=this._cache.getAndRemove(t),o&&(this._setTileReloadTimer(t.key,o),o.tileID=t,this._state.initializeTileState(o,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,o)));const c=!!o;if(!c){const d=this.map?this.map.painter:null,p=this._source.tileSize*t.overscaleFactor();o=this._source.type==="raster-array"?new dc(t,p,this.transform.tileZoom,d,this._isRaster):new ls(t,p,this.transform.tileZoom,d,this._isRaster,this._source.worldview),this._loadTile(o,this._tileLoaded.bind(this,o,t.key,o.state))}return o.uses++,this._tiles[t.key]=o,c||this._source.fire(new s.z("dataloading",{tile:o,coord:o.tileID,dataType:"source"})),o}_setTileReloadTimer(t,o){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const c=o.getExpiryTimeout();c&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},c))}_removeTile(t){const o=this._tiles[t];o&&(o.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),o.uses>0||(o.hasData()&&o.state!=="reloading"||o.state==="empty"?this._cache.add(o.tileID,o,o.getExpiryTimeout()):(o.aborted=!0,this._abortTile(o),this._unloadTile(o))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(+t);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(t,o,c){const d=[],p=this.transform;if(!p)return d;const m=p.projection.name==="globe",y=s.aF(p.center.lng);for(const x in this._tiles){const T=this._tiles[x];if(c&&T.clearQueryDebugViz(),T.holdingForFade())continue;let S;if(m){const M=T.tileID.canonical;if(M.z===0){const A=[Math.abs(s.aA(y,...No(M,-1))-y),Math.abs(s.aA(y,...No(M,1))-y)];S=[0,2*A.indexOf(Math.min(...A))-1]}else{const A=[Math.abs(s.aA(y,...No(M,-1))-y),Math.abs(s.aA(y,...No(M,0))-y),Math.abs(s.aA(y,...No(M,1))-y)];S=[A.indexOf(Math.min(...A))-1]}}else S=[0];for(const M of S){const A=t.containsTile(T,p,o,M);A&&d.push(A)}}return d}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(t){return this._getRenderableCoordinates(t)}_getRenderableCoordinates(t,o){const c=this.getRenderableIds(t,o).map(p=>this._tiles[p].tileID),d=this.transform.projection.name==="globe";for(const p of c)p.projMatrix=this.transform.calculateProjMatrix(p.toUnwrapped()),p.expandedProjMatrix=d?this.transform.calculateProjMatrix(p.toUnwrapped(),!1,!0):p.projMatrix;return c}sortCoordinatesByDistance(t){const o=t.slice(),c=this.transform._camera.position,d=this.transform._camera.forward(),p={};for(const m of o){const y=1/(1<<m.canonical.z);p[m.key]=((m.canonical.x+.5)*y+m.wrap-c[0])*d[0]+((m.canonical.y+.5)*y-c[1])*d[1]-c[2]*d[2]}return o.sort((m,y)=>p[m.key]-p[y.key]),o}hasTransition(){if(this._source.hasTransition())return!0;if(hl(this._source.type))for(const t in this._tiles){const o=this._tiles[t];if(o.fadeEndTime!==void 0&&o.fadeEndTime>=s.o.now())return!0}return!1}setFeatureState(t,o,c){this._state.updateState(t=t||"_geojsonTileLayer",o,c)}removeFeatureState(t,o,c){this._state.removeFeatureState(t=t||"_geojsonTileLayer",o,c)}getFeatureState(t,o){return this._state.getState(t=t||"_geojsonTileLayer",o)}setDependencies(t,o,c){const d=this._tiles[t];d&&d.setDependencies(o,c)}reloadTilesForDependencies(t,o){for(const c in this._tiles)this._tiles[c].hasDependency(t,o)&&this._reloadTile(+c,"reloading");this._cache.filter(c=>!c.hasDependency(t,o))}_preloadTiles(t,o){if(!this._sourceLoaded){const x=()=>{this._sourceLoaded&&(this._source.off("data",x),this._preloadTiles(t,o))};return void this._source.on("data",x)}const c=new Map,d=Array.isArray(t)?t:[t],p=this.map.painter.terrain,m=this.usedForTerrain&&p?p.getScaledDemTileSize():this._source.tileSize;for(const x of d){const T=x.coveringTiles({tileSize:m,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const S of T)c.set(S.key,S);this.usedForTerrain&&x.updateElevation(!1)}const y=Array.from(c.values());s.bw(y,(x,T)=>{const S=new ls(x,this._source.tileSize*x.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster,this._source.worldview);this._loadTile(S,M=>{this._source.type==="raster-dem"&&S.dem&&this._backfillDEM(S),T(M,S)})},o)}}function ul(l,t){const o=Math.abs(2*l.wrap)-+(l.wrap<0),c=Math.abs(2*t.wrap)-+(t.wrap<0);return l.overscaledZ-t.overscaledZ||c-o||t.canonical.y-l.canonical.y||t.canonical.x-l.canonical.x}function hl(l){return l==="raster"||l==="image"||l==="video"||l==="custom"}function No(l,t){const o=1<<l.z;return[l.x/o+t,(l.x+1)/o+t]}ln.maxOverzooming=10,ln.maxUnderzooming=3;class dl{constructor(t){this.style=t,this.layersGotHidden=!1,this.layers=[]}processLayersChanged(){this.layers=[];const t=!1,o=!1;for(const c in this.style._mergedLayers){const d=this.style._mergedLayers[c];if(d.type==="fill-extrusion"||d.type==="building")this.layers.push({layer:d,visible:t,visibilityChanged:o});else if(d.type==="model"){const p=this.style.getLayerSource(d);p&&p.type==="batched-model"&&this.layers.push({layer:d,visible:t,visibilityChanged:o})}}}onNewFrame(t){this.layersGotHidden=!1;for(const o of this.layers){const c=o.layer;let d=!1;c.type==="fill-extrusion"?d=!c.isHidden(t)&&c.paint.get("fill-extrusion-opacity")>0:c.type==="building"?d=!c.isHidden(t)&&c.paint.get("building-opacity")>0:c.type==="model"&&(d=!c.isHidden(t)&&c.paint.get("model-opacity").constantOr(1)>0),this.layersGotHidden=this.layersGotHidden||!d&&o.visible,o.visible=d}}updateZOffset(t,o){this.currentBuildingBuckets=[];for(const d of this.layers){const p=d.layer,m=this.style.getLayerSourceCache(p);let y=1;p.type==="fill-extrusion"?y=d.visible?p.paint.get("fill-extrusion-vertical-scale"):0:p.type==="building"&&(y=d.visible?p.paint.get("building-vertical-scale"):0);let x=m?m.getTile(o):null;if(!x&&m)for(const T in m._tiles){const S=m._tiles[T];
9if(o.canonical.isChildOf(S.tileID.canonical)){x=S;break}}this.currentBuildingBuckets.push({bucket:x?x.getBucket(p):null,tileID:x?x.tileID:o,verticalScale:y})}t.hasAnyZOffset=!1;let c=!1;for(let d=0;d<t.symbolInstances.length;d++){const p=t.symbolInstances.get(d),m=p.zOffset,y=this._getHeightAtTileOffset(o,p.tileAnchorX,p.tileAnchorY);p.zOffset=y!==Number.NEGATIVE_INFINITY?y:m,c||m===p.zOffset||(c=!0),t.hasAnyZOffset||p.zOffset===0||(t.hasAnyZOffset=!0)}c&&(t.zOffsetBuffersNeedUpload=!0,t.zOffsetSortDirty=!0)}_mapCoordToOverlappingTile(t,o,c,d){let p=o,m=c;if(t.canonical.z!==d.canonical.z){const y=d.canonical,x=1/(1<<t.canonical.z-y.z);p=(o+t.canonical.x*s.al)*x-y.x*s.al|0,m=(c+t.canonical.y*s.al)*x-y.y*s.al|0}return{tileX:p,tileY:m}}_getHeightAtTileOffset(t,o,c){let d,p;for(let m=0;m<this.layers.length;++m){const y=this.layers[m].layer;if(y.type!=="fill-extrusion"&&y.type!=="building")continue;const{bucket:x,tileID:T,verticalScale:S}=this.currentBuildingBuckets[m];if(!x)continue;const{tileX:M,tileY:A}=this._mapCoordToOverlappingTile(t,o,c,T),C=x.getHeightAtTileCoord(M,A);C&&C.height!==void 0&&(C.hidden?d=C.height:p=Math.max(C.height*S,p||0))}if(p!==void 0)return p;for(let m=0;m<this.layers.length;++m){const y=this.layers[m];if(y.layer.type!=="model"||!y.visible)continue;const{bucket:x,tileID:T}=this.currentBuildingBuckets[m];if(!x)continue;const{tileX:S,tileY:M}=this._mapCoordToOverlappingTile(t,o,c,T),A=x.getHeightAtTileCoord(S,M);if(A&&!A.hidden)return A.height===void 0&&d!==void 0?Math.min(A.maxHeight,d)*A.verticalScale:A.height?A.height*A.verticalScale:Number.NEGATIVE_INFINITY}return this.layersGotHidden?0:Number.NEGATIVE_INFINITY}}function bm(l,t){const o={};for(const c in l)c!=="ref"&&(o[c]=l[c]);return s.bx.forEach(c=>{c in t&&(o[c]=t[c])}),o}function Nu(l){l=l.slice();const t=Object.create(null);for(let o=0;o<l.length;o++)t[l[o].id]=l[o];for(let o=0;o<l.length;o++)"ref"in l[o]&&(l[o]=bm(l[o],t[l[o].ref]));return l}const Xt={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setSlot:"setSlot",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",setTerrain:"setTerrain",setFog:"setFog",setSnow:"setSnow",setRain:"setRain",setCamera:"setCamera",setLights:"setLights",setProjection:"setProjection",addImport:"addImport",removeImport:"removeImport",updateImport:"updateImport",addIconset:"addIconset",removeIconset:"removeIconset"};function _a(l,t,o){o.push({command:Xt.addSource,args:[l,t[l]]})}function fc(l,t,o){t.push({command:Xt.removeSource,args:[l]}),o[l]=!0}function Qd(l,t,o,c){fc(l,o,c),_a(l,t,o)}function ef(l,t,o){let c;for(c in l[o])if(l[o].hasOwnProperty(c)&&c!=="data"&&!s.by(l[o][c],t[o][c]))return!1;for(c in t[o])if(t[o].hasOwnProperty(c)&&c!=="data"&&!s.by(l[o][c],t[o][c]))return!1;return!0}function fl(l,t,o,c,d,p){let m;for(m in t=t||{},l=l||{})l.hasOwnProperty(m)&&(s.by(l[m],t[m])||o.push({command:p,args:[c,m,t[m],d]}));for(m in t)t.hasOwnProperty(m)&&!l.hasOwnProperty(m)&&(s.by(l[m],t[m])||o.push({command:p,args:[c,m,t[m],d]}))}function cs(l){return l.id}function pl(l,t){return l[t.id]=t,l}function pc(l,t,o){const c=t.createTileMatrix(l,l.worldSize,o.toUnwrapped());return s.aB(new Float32Array(16),l.projMatrix,c)}function wm(l,t,o){if(t.projection.name===o.projection.name)return l.projMatrix;const c=o.clone();return c.setProjection(t.projection),pc(c,t.getProjection(),l)}function ga(l,t,o){return t.name===o.projection.name?l.projMatrix:pc(o,t,l)}class Vo{constructor(t,o){this.reset(t,o)}reset(t,o){this.points=t||[],this._distances=[0];for(let c=1;c<this.points.length;c++)this._distances[c]=this._distances[c-1]+this.points[c].dist(this.points[c-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(o||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=s.aA(t,0,1);let o=1,c=this._distances[o];const d=t*this.paddedLength+this.padding;
vendor: 4,286 bytes, line 9
9for(;c<d&&o<this._distances.length;)c=this._distances[++o];const p=o-1,m=this._distances[p],y=c-m,x=y>0?(d-m)/y:0;return this.points[p].mult(1-x).add(this.points[o].mult(x))}}class ml{constructor(t,o,c){const d=this.boxCells=[],p=this.circleCells=[];this.xCellCount=Math.ceil(t/c),this.yCellCount=Math.ceil(o/c);for(let m=0;m<this.xCellCount*this.yCellCount;m++)d.push([]),p.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=o,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/o,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,o,c,d,p){this._forEachCell(o,c,d,p,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(o),this.bboxes.push(c),this.bboxes.push(d),this.bboxes.push(p)}insertCircle(t,o,c,d){this._forEachCell(o-d,c-d,o+d,c+d,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(o),this.circles.push(c),this.circles.push(d)}_insertBoxCell(t,o,c,d,p,m){this.boxCells[p].push(m)}_insertCircleCell(t,o,c,d,p,m){this.circleCells[p].push(m)}_query(t,o,c,d,p,m){if(c<0||t>this.width||d<0||o>this.height)return!p&&[];const y=[];if(t<=0&&o<=0&&this.width<=c&&this.height<=d){if(p)return!0;for(let x=0;x<this.boxKeys.length;x++)y.push({key:this.boxKeys[x],x1:this.bboxes[4*x],y1:this.bboxes[4*x+1],x2:this.bboxes[4*x+2],y2:this.bboxes[4*x+3]});for(let x=0;x<this.circleKeys.length;x++){const T=this.circles[3*x],S=this.circles[3*x+1],M=this.circles[3*x+2];y.push({key:this.circleKeys[x],x1:T-M,y1:S-M,x2:T+M,y2:S+M})}return m?y.filter(m):y}return this._forEachCell(t,o,c,d,this._queryCell,y,{hitTest:p,seenUids:{box:{},circle:{}}},m),p?y.length>0:y}_queryCircle(t,o,c,d,p){const m=t-c,y=t+c,x=o-c,T=o+c;if(y<0||m>this.width||T<0||x>this.height)return!d&&[];const S=[];return this._forEachCell(m,x,y,T,this._queryCellCircle,S,{hitTest:d,circle:{x:t,y:o,radius:c},seenUids:{box:{},circle:{}}},p),d?S.length>0:S}query(t,o,c,d,p){return this._query(t,o,c,d,!1,p)}hitTest(t,o,c,d,p){return this._query(t,o,c,d,!0,p)}hitTestCircle(t,o,c,d){return this._queryCircle(t,o,c,!0,d)}_queryCell(t,o,c,d,p,m,y,x){const T=y.seenUids,S=this.boxCells[p];if(S!==null){const A=this.bboxes;for(const C of S)if(!T.box[C]){T.box[C]=!0;const L=4*C;if(t<=A[L+2]&&o<=A[L+3]&&c>=A[L+0]&&d>=A[L+1]&&(!x||x(this.boxKeys[C]))){if(y.hitTest)return m.push(!0),!0;m.push({key:this.boxKeys[C],x1:A[L],y1:A[L+1],x2:A[L+2],y2:A[L+3]})}}}const M=this.circleCells[p];if(M!==null){const A=this.circles;for(const C of M)if(!T.circle[C]){T.circle[C]=!0;const L=3*C;if(this._circleAndRectCollide(A[L],A[L+1],A[L+2],t,o,c,d)&&(!x||x(this.circleKeys[C]))){if(y.hitTest)return m.push(!0),!0;{const z=A[L],O=A[L+1],N=A[L+2];m.push({key:this.circleKeys[C],x1:z-N,y1:O-N,x2:z+N,y2:O+N})}}}}}_queryCellCircle(t,o,c,d,p,m,y,x){const T=y.circle,S=y.seenUids,M=this.boxCells[p];if(M!==null){const C=this.bboxes;for(const L of M)if(!S.box[L]){S.box[L]=!0;const z=4*L;if(this._circleAndRectCollide(T.x,T.y,T.radius,C[z+0],C[z+1],C[z+2],C[z+3])&&(!x||x(this.boxKeys[L])))return m.push(!0),!0}}const A=this.circleCells[p];if(A!==null){const C=this.circles;for(const L of A)if(!S.circle[L]){S.circle[L]=!0;const z=3*L;if(this._circlesCollide(C[z],C[z+1],C[z+2],T.x,T.y,T.radius)&&(!x||x(this.circleKeys[L])))return m.push(!0),!0}}}_forEachCell(t,o,c,d,p,m,y,x){const T=this._convertToXCellCoord(t),S=this._convertToYCellCoord(o),M=this._convertToXCellCoord(c),A=this._convertToYCellCoord(d);for(let C=T;C<=M;C++)for(let L=S;L<=A;L++)if(p.call(this,t,o,c,d,this.xCellCount*L+C,m,y,x))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,o,c,d,p,m){const y=d-t,x=p-o,T=c+m;return T*T>y*y+x*x}_circleAndRectCollide(t,o,c,d,p,m,y){const x=(m-d)/2,T=Math.abs(t-(d+x));if(T>x+c)return!1;const S=(y-p)/2,M=Math.abs(o-(p+S));if(M>S+c)return!1;if(T<=x||M<=S)return!0;const A=T-x,C=M-S;return A*A+C*C<=c*c}}const tf=Math.tan(85*Math.PI/180);function Us(l,t,o,c,d,p,m){const y=s.bC();if(o)if(p.name==="globe"){const x=s.bD(d,t);s.aB(y,y,x)}else{const x=s.bE([],m);y[0]=x[0],y[1]=x[1],y[4]=x[2],y[5]=x[3],c||s.bB(y,y,d.angle)}
9else s.aB(y,d.labelPlaneMatrix,l);return y}function Uo(l,t,o,c,d,p,m){const y=Us(l,t,o,c,d,p,m);return p.name==="globe"&&o||(y[2]=y[6]=y[10]=y[14]=0),y}function cn(l,t,o,c,d,p,m){if(o){if(p.name==="globe"){const y=Us(l,t,o,c,d,p,m);return s.bl(y,y),s.aB(y,l,y),y}{const y=s.bz(l),x=s.bA([]);return x[0]=m[0],x[1]=m[1],x[4]=m[2],x[5]=m[3],s.aB(y,y,x),c||s.bB(y,y,-d.angle),y}}return d.glCoordMatrix}function Zn(l,t,o,c){const d=[l,t,o,1];o?s.aC(d,d,c):_c(d,d,c);const p=d[3];return d[0]/=p,d[1]/=p,d[2]/=p,d}function mc(l,t){return Math.min(.5+l/t*.5,1.5)}function rf(l,t){const o=l[0]/l[3],c=l[1]/l[3];return o>=-t[0]&&o<=t[0]&&c>=-t[1]&&c<=t[1]}function ii(l,t,o,c,d,p,m,y,x,T,S=1){const M=o.transform,A=c?l.textSizeData:l.iconSizeData,C=s.bK(A,o.transform.zoom,S),L=M.projection.name==="globe",z=[256/o.width*2+1,256/o.height*2+1],O=c?l.text.dynamicLayoutVertexArray:l.icon.dynamicLayoutVertexArray;O.clear();let N=null;L&&(N=c?l.text.globeExtVertexArray:l.icon.globeExtVertexArray);const q=l.lineVertexArray,G=c?l.text.placedSymbolArray:l.icon.placedSymbolArray,j=o.transform.width/o.transform.height;let ie,Q=!1;for(let te=0;te<G.length;te++){const X=G.get(te),{numGlyphs:Z,writingMode:ne}=X;if(ne!==s.bL.vertical||Q||ie===s.bL.horizontal||(Q=!0),ie=ne,(X.hidden||ne===s.bL.vertical)&&!Q){Xr(Z,O);continue}Q=!1;const ce=new s.P(X.tileAnchorX,X.tileAnchorY),de=l.elevationType==="road",ve=!!M.elevation||de;let{x:ge,y:Me,z:Fe}=M.projection.projectTilePoint(ce.x,ce.y,T.canonical),pe=null;if(ve){const ot=de?l.getElevationFeatureForText(te):null;pe={getElevation:x,elevation:M.elevation,elevationFeature:ot};const[dt,yt,Pt]=x(ce,M.elevation,ot);ge+=dt,Me+=yt,Fe+=Pt}const oe=[ge,Me,Fe,1];if(s.aC(oe,oe,t),!rf(oe,z)){Xr(Z,O);continue}const Ie=oe[3],be=mc(o.transform.getCameraToCenterDistance(M.projection),Ie),ke=s.bM(A,C,X),Ue=m?ke/be:ke*be,Ke=Zn(ge,Me,Fe,d);if(Ke[3]<=0){Xr(Z,O);continue}let je={};const He=s.an(l.layers[0].layout.get("text-max-angle")),lt=Math.cos(He),st=m?null:pe,et=of(X,Ue,!1,y,t,d,p,l.glyphOffsetArray,q,O,N,Ke,ce,je,j,st,M.projection,T,m,lt);Q=et.useVertical,st&&et.needsFlipping&&(je={}),(et.notEnoughRoom||Q||et.needsFlipping&&of(X,Ue,!0,y,t,d,p,l.glyphOffsetArray,q,O,N,Ke,ce,je,j,st,M.projection,T,m,lt).notEnoughRoom)&&Xr(Z,O)}c?(l.text.dynamicLayoutVertexBuffer.updateData(O),N&&l.text.globeExtVertexBuffer&&l.text.globeExtVertexBuffer.updateData(N)):(l.icon.dynamicLayoutVertexBuffer.updateData(O),N&&l.icon.globeExtVertexBuffer&&l.icon.globeExtVertexBuffer.updateData(N))}function Vu(l,t,o,c,d,p,m,y,x,T,S,M,A,C,L,z,O){const{lineStartIndex:N,glyphStartIndex:q,segment:G}=y,j=q+y.numGlyphs,ie=N+y.lineLength,Q=t.getoffsetX(q),te=t.getoffsetX(j-1),X=js(l*Q,o,c,d,p,m,G,N,ie,x,T,S,M,A,!0,C,L,z,O);if(!X)return null;const Z=js(l*te,o,c,d,p,m,G,N,ie,x,T,S,M,A,!0,C,L,z,O);return Z?{first:X,last:Z}:null}function nf(l,t,o,c){return l===s.bL.horizontal&&Math.abs(c)>Math.abs(o)?{useVertical:!0}:l===s.bL.vertical?c>0?{needsFlipping:!0}:null:t!==0&&(function(d,p){return d===0||Math.abs(p/d)>tf})(o,c)?t===1?{needsFlipping:!0}:null:o<0?{needsFlipping:!0}:null}function of(l,t,o,c,d,p,m,y,x,T,S,M,A,C,L,z,O,N,q,G){const j=t/24,ie=l.lineOffsetX*j,Q=l.lineOffsetY*j,{lineStartIndex:te,glyphStartIndex:X,numGlyphs:Z,segment:ne,writingMode:ce,flipState:de}=l,ve=te+l.lineLength,ge=Me=>{if(S){const[Ie,be,ke]=Me.up,Ue=T.length;s.bN(S,Ue+0,Ie,be,ke),s.bN(S,Ue+1,Ie,be,ke),s.bN(S,Ue+2,Ie,be,ke),s.bN(S,Ue+3,Ie,be,ke)}const[Fe,pe,oe]=Me.point;s.bO(T,Fe,pe,oe,Me.angle)};if(Z>1){const Me=Vu(j,y,ie,Q,o,M,A,l,x,p,C,z,!1,O,N,q,G);if(!Me)return{notEnoughRoom:!0};if(c&&!o){let[Fe,pe,oe]=Me.first.point,[Ie,be,ke]=Me.last.point;[Fe,pe]=Zn(Fe,pe,oe,m),[Ie,be]=Zn(Ie,be,ke,m);const Ue=nf(ce,de,(Ie-Fe)*L,be-pe);if(l.flipState=Ue&&Ue.needsFlipping?1:2,Ue)return Ue}ge(Me.first);for(let Fe=X+1;Fe<X+Z-1;Fe++){const pe=js(j*y.getoffsetX(Fe),ie,Q,o,M,A,ne,te,ve,x,p,C,z,!1,!1,O,N,q,G);if(!pe)return T.length-=4*(Fe-X),{notEnoughRoom:!0};ge(pe)}ge(Me.last)}else{if(c&&!o){const Fe=Zn(A.x,A.y,0,d),pe=te+ne+1,oe=new s.P(x.getx(pe),x.gety(pe)),Ie=Zn(oe.x,oe.y,0,d),be=Ie[3]>0?Ie:Uu(A,oe,Fe,1,d,void 0,O,N.canonical),ke=nf(ce,de,(be[0]-Fe[0])*L,be[1]-Fe[1]);if(l.flipState=ke&&ke.needsFlipping?1:2,ke)return ke}const Me=js(j*y.getoffsetX(X),ie,Q,o,M,A,ne,te,ve,x,p,C,z,!1,!1,O,N,q,G);if(!Me)return{notEnoughRoom:!0};ge(Me)}return{}}function _t(l,t,o,c,d){const{x:p,y:m,z:y}=c.projectTilePoint(l.x,l.y,t);if(!d)return Zn(p,m,y,o);const[x,T,S]=d.getElevation(l,d.elevation,d.elevationFeature);return Zn(p+x,m+T,y+S,o)}
9function Uu(l,t,o,c,d,p,m,y){const x=_t(l.sub(t)._unit()._add(l),y,d,m,p);return s.av(x,o,x),s.aw(x,x),s.bH(x,o,x,c)}function js(l,t,o,c,d,p,m,y,x,T,S,M,A,C,L,z,O,N,q){const G=c?l-t:l+t;let j=G>0?1:-1,ie=0;c&&(j*=-1,ie=Math.PI),j<0&&(ie+=Math.PI);let Q=y+m+(j>0?0:1)|0,te=d,X=d,Z=0,ne=0;const ce=Math.abs(G),de=[],ve=[];let ge=p,Me=ge,Fe=s.bF([]);const pe=()=>Uu(Me,ge,X,ce-Z+1,S,A,z,O.canonical);for(;Z+ne<=ce;){if(Q+=j,Q<y||Q>=x)return null;if(X=te,Me=ge,de.push(X),C&&ve.push(Me),ge=new s.P(T.getx(Q),T.gety(Q)),te=M[Q],!te){const st=_t(ge,O.canonical,S,z,A);te=st[3]>0?M[Q]=st:pe()}Z+=ne;const He=s.av([],te,X),lt=s.bG(X,te);if(o&&lt>0&&ne>0&&s.bJ(Fe,He)/(ne*lt)<q)return null;ne=lt,Fe=He}L&&A&&(M[Q]&&(te=pe(),ne=s.bG(X,te),Fe=s.av([],te,X)),M[Q]=te);const oe=(ce-Z)/ne,Ie=ge.sub(Me)._mult(oe)._add(Me),be=s.bH([],X,Fe,oe);let ke=[0,0,1],Ue=Fe[0],Ke=Fe[1];if(N&&(ke=z.upVector(O.canonical,Ie.x,Ie.y),ke[0]!==0||ke[1]!==0||ke[2]!==1)){const He=[ke[2],0,-ke[0]],lt=s.bI([],ke,He);s.aw(He,He),s.aw(lt,lt),Ue=s.bJ(Fe,He),Ke=s.bJ(Fe,lt)}if(o){const He=s.bI([],ke,Fe);s.aw(He,He),s.bH(be,be,He,o*j)}const je=ie+Math.atan2(Ke,Ue);return de.push(be),C&&ve.push(Ie),{point:be,angle:je,path:de,tilePath:ve,up:ke}}function Xr(l,t){const o=t.length,c=o+4*l;t.resize(c),t.float32.fill(-1/0,4*o,4*c)}function _c(l,t,o){const c=t[0],d=t[1];return l[0]=o[0]*c+o[4]*d+o[12],l[1]=o[1]*c+o[5]*d+o[13],l[3]=o[3]*c+o[7]*d+o[15],l}const un=100;class ht{constructor(t,o,c=new ml(t.width+200,t.height+200,25),d=new ml(t.width+200,t.height+200,25)){this.transform=t,this.grid=c,this.ignoredGrid=d,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+un,this.screenBottomBoundary=t.height+un,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.fogState=o}placeCollisionBox(t,o,c,d,p,m,y,x,T,S,M){let A=c.projectedAnchorX,C=c.projectedAnchorY,L=c.projectedAnchorZ;const z=c.tileAnchorX,O=c.tileAnchorY,N=c.elevation,q=c.tileID,G=t.getProjection();if(N&&q){const[ve,ge,Me]=G.upVector(q.canonical,c.tileAnchorX,c.tileAnchorY),Fe=G.upVectorScale(q.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;A+=ve*N*Fe,C+=ge*N*Fe,L+=Me*N*Fe}const j=t.projection.name==="globe",ie=t.projection.name==="globe"?s.aj(this.transform.zoom):0;if(q&&j&&ie<1&&!m){const ve=1<<q.canonical.z,ge=s.bP(z,O);s.bQ(ge,ge,1/s.al),s.bR(ge,ge,s.bP(q.canonical.x,q.canonical.y)),s.bQ(ge,ge,1/ve),s.bS(ge,ge,s.bP(d[0],d[1])),ge[0]=s.bT(ge[0],-.5,.5),s.bQ(ge,ge,s.al);const Me=s.bU(ge[0],ge[1],s.al/(2*Math.PI),1);s.aC(Me,Me,p),A=s.ak(A,Me[0],ie),C=s.ak(C,Me[1],ie),L=s.ak(L,Me[2],ie)}const Q=this.projectAndGetPerspectiveRatio(S,A,C,L,c.tileID,G.name==="globe"||!!N||this.transform.pitch>0,G),te=T*Q.perspectiveRatio,X=(c.x1*o+y.x-c.padding)*te+Q.point.x,Z=(c.y1*o+y.y-c.padding)*te+Q.point.y,ne=(c.x2*o+y.x+c.padding)*te+Q.point.x,ce=(c.y2*o+y.y+c.padding)*te+Q.point.y,de=Q.perspectiveRatio<=.55||Q.occluded;return!this.isInsideGrid(X,Z,ne,ce)||!x&&this.grid.hitTest(X,Z,ne,ce,M)||de?{box:[],offscreen:!1,occluded:Q.occluded}:{box:[X,Z,ne,ce],offscreen:this.isOffscreen(X,Z,ne,ce),occluded:!1}}placeCollisionCircles(t,o,c,d,p,m,y,x,T,S,M,A,C,L,z,O){const N=[],q=this.transform.elevation,G=t.getProjection(),j=t.elevationType==="road",ie=!!q||j,Q=s.bV.getAtTileOffsetFunc(O,this.transform.center.lat,this.transform.worldSize,G),te=new s.P(c.tileAnchorX,c.tileAnchorY),X=new s.P(c.tileAnchorX,c.tileAnchorY);let{x:Z,y:ne,z:ce}=G.projectTilePoint(X.x,X.y,O.canonical),de=null;if(ie){const lt=j?t.getElevationFeatureForText(d):null;de={getElevation:Q,elevation:q,elevationFeature:lt};const[st,et,ot]=Q(te,q,lt);Z+=st,ne+=et,ce+=ot}const ve=G.name==="globe",ge=this.projectAndGetPerspectiveRatio(x,Z,ne,ce,O,ve||!!q||this.transform.pitch>0,G),{perspectiveRatio:Me}=ge,Fe=(A?y/Me:y*Me)/s.bY,pe=Zn(Z,ne,ce,T),oe=c.lineOffsetX*Fe,Ie=c.lineOffsetY*Fe,be=s.an(t.layers[0].layout.get("text-max-angle")),ke=Math.cos(be),Ue=ge.signedDistanceFromCamera>0?Vu(Fe,m,oe,Ie,j&&c.flipState===1,pe,X,c,p,T,{},ie&&!A?de:null,A&&ie,G,O,A,ke):null;let Ke=!1,je=!1,He=!0;if(Ue&&!ge.occluded){const lt=.5*L*Me+z,st=new s.P(-100,-100),et=new s.P(this.screenRightBoundary,this.screenBottomBoundary),ot=new Vo,{first:dt,last:yt}=Ue,Pt=dt.path.length;let Vt=[];for(let It=Pt-1;It>=1;It--)Vt.push(dt.path[It]);for(let It=1;It<yt.path.length;It++)Vt.push(yt.path[It]);const St=2.5*lt;S&&(Vt=Vt.map(([It,si,ri],ci)=>(ie&&!ve&&(ri=Q(ci<Pt-1?dt.tilePath[Pt-1-ci]:yt.tilePath[ci-Pt+2],q,de.elevationFeature)[2]),Zn(It,si,ri,S))),Vt.some(It=>It[3]<=0)&&(Vt=[]));let Zt=[];
vendor: 4,701 bytes, line 9
9if(Vt.length>0){let It=1/0,si=-1/0,ri=1/0,ci=-1/0;for(const Ut of Vt)It=Math.min(It,Ut[0]),ri=Math.min(ri,Ut[1]),si=Math.max(si,Ut[0]),ci=Math.max(ci,Ut[1]);si>=st.x&&It<=et.x&&ci>=st.y&&ri<=et.y&&(Zt=[Vt.map(Ut=>new s.P(Ut[0],Ut[1]))],(It<st.x||si>et.x||ri<st.y||ci>et.y)&&(Zt=s.bW(Zt,st.x,st.y,et.x,et.y)))}for(const It of Zt){ot.reset(It,.25*lt);let si=0;si=ot.length<=.5*lt?1:Math.ceil(ot.paddedLength/St)+1;for(let ri=0;ri<si;ri++){const ci=ri/Math.max(si-1,1),Ut=ot.lerp(ci),Mt=Ut.x+un,Jt=Ut.y+un;N.push(Mt,Jt,lt,0);const Pi=Mt-lt,Ri=Jt-lt,Qt=Mt+lt,kt=Jt+lt;if(He=He&&this.isOffscreen(Pi,Ri,Qt,kt),je=je||this.isInsideGrid(Pi,Ri,Qt,kt),!o&&this.grid.hitTestCircle(Mt,Jt,lt,C)&&(Ke=!0,!M))return{circles:[],offscreen:!1,collisionDetected:Ke,occluded:!1}}}}return{circles:!M&&Ke||!je?[]:N,offscreen:He,collisionDetected:Ke,occluded:ge.occluded}}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const o=[];let c=1/0,d=1/0,p=-1/0,m=-1/0;for(const S of t){const M=new s.P(S.x+un,S.y+un);c=Math.min(c,M.x),d=Math.min(d,M.y),p=Math.max(p,M.x),m=Math.max(m,M.y),o.push(M)}const y=this.grid.query(c,d,p,m).concat(this.ignoredGrid.query(c,d,p,m)),x={},T={};for(const S of y){const M=S.key;if(x[M.bucketInstanceId]===void 0&&(x[M.bucketInstanceId]={}),x[M.bucketInstanceId][M.featureIndex])continue;const A=[new s.P(S.x1,S.y1),new s.P(S.x2,S.y1),new s.P(S.x2,S.y2),new s.P(S.x1,S.y2)];s.bX(o,A)&&(x[M.bucketInstanceId][M.featureIndex]=!0,T[M.bucketInstanceId]===void 0&&(T[M.bucketInstanceId]=[]),T[M.bucketInstanceId].push(M.featureIndex))}return T}insertCollisionBox(t,o,c,d,p){(o?this.ignoredGrid:this.grid).insert({bucketInstanceId:c,featureIndex:d,collisionGroupID:p},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,o,c,d,p){const m=o?this.ignoredGrid:this.grid,y={bucketInstanceId:c,featureIndex:d,collisionGroupID:p};for(let x=0;x<t.length;x+=4)m.insertCircle(y,t[x],t[x+1],t[x+2])}projectAndGetPerspectiveRatio(t,o,c,d,p,m,y){const x=[o,c,d,1];let T=!1;d||this.transform.pitch>0?(s.aC(x,x,t),this.fogState&&p&&y.name!=="globe"&&(T=(function(A,C,L,z,O,N){const q=N.calculateFogTileMatrix(O),G=[C,L,z];return s.af(G,G,q),ft(A,s.ag(G),N.pitch,N._fov)})(this.fogState,o,c,d,p.toUnwrapped(),this.transform)>.9)):_c(x,x,t);const S=x[3];return{point:new s.P((x[0]/S+1)/2*this.transform.width+un,(-x[1]/S+1)/2*this.transform.height+un),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(y)/S*.5,1.5),signedDistanceFromCamera:S,occluded:m&&x[2]>S||T}}isOffscreen(t,o,c,d){return c<un||t>=this.screenRightBoundary||d<un||o>this.screenBottomBoundary}isInsideGrid(t,o,c,d){return c>=0&&t<this.gridRightBoundary&&d>=0&&o<this.gridBottomBoundary}getViewportMatrix(){const t=s.bA([]);return s.br(t,t,[-100,-100,0]),t}}class ti{constructor(t,o,c,d){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?o:-o))):d&&c?1:0,this.placed=c}isHidden(){return this.opacity===0&&!this.placed}}class Yt{constructor(t,o,c,d,p,m=!1){this.text=new ti(t?t.text:null,o,c,p),this.icon=new ti(t?t.icon:null,o,d,p),this.clipped=m}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Yr{constructor(t,o,c,d=!1){this.text=t,this.icon=o,this.skipFade=c,this.clipped=d}}class ya{constructor(){this.invProjMatrix=s.bC(),this.viewportMatrix=s.bC(),this.circles=[]}}class oi{constructor(t,o,c,d,p){this.bucketInstanceId=t,this.featureIndex=o,this.sourceLayerIndex=c,this.bucketIndex=d,this.tileID=p}}class gc{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 o=++this.maxGroupID;this.collisionGroups[t]={ID:o,predicate:c=>c.collisionGroupID===o}}return this.collisionGroups[t]}}function xa(l,t,o,c,d){const{horizontalAlign:p,verticalAlign:m}=s.c1(l),y=-(p-.5)*t,x=-(m-.5)*o,T=s.c2(l,c);return new s.P(y+T[0]*d,x+T[1]*d)}function Gs(l,t,o,c,d){const p=new s.P(l,t);return o&&p._rotate(c?d:-d),p}class Ur{constructor(t,o,c,d,p,m){this.transform=t.clone(),this.projection=t.projection.name,this.collisionIndex=new ht(this.transform,p),this.buildingIndex=m,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=o,this.retainedQueryData={},this.collisionGroups=new gc(c),this.collisionCircleArrays={},this.prevPlacement=d,d&&(d.prevPlacement=void 0),this.placedOrientations={},this.lastReplacementSourceUpdateTime=0}getBucketParts(t,o,c,d,p=1){const m=c.getBucket(o),y=c.latestFeatureIndex;if(!m||!y||o.fqid!==m.layerIds[0])return;const x=m.layers[0].layout,T=m.layers[0].paint,S=c.collisionBoxArray,M=Math.pow(2,this.transform.zoom-c.tileID.overscaledZ
9),A=c.tileSize/s.al,C=c.tileID.toUnwrapped();this.transform.setProjection(m.projection);const L=(z=c.tileID,O=m.getProjection(),N=this.transform,O.name===this.projection?N.calculateProjMatrix(z.toUnwrapped()):pc(N,O,z));var z,O,N;const q=x.get("text-pitch-alignment")==="map",G=x.get("text-rotation-alignment")==="map";o.compileFilter(o.options);const j=o.dynamicFilter(),ie=o.dynamicFilterNeedsFeature(),Q=this.transform.calculatePixelsToTileUnitsMatrix(c),te=Uo(L,c.tileID.canonical,q,G,this.transform,m.getProjection(),Q);let X=null;const Z=m.getProjection().createInversionMatrix(this.transform,c.tileID.canonical);if(q){const oe=cn(L,c.tileID.canonical,q,G,this.transform,m.getProjection(),Q);X=s.aB([],this.transform.labelPlaneMatrix,oe)}let ne=null;j&&c.latestFeatureIndex&&(ne={unwrappedTileID:C,dynamicFilter:j,dynamicFilterNeedsFeature:ie}),this.retainedQueryData[m.bucketInstanceId]=new oi(m.bucketInstanceId,y,m.sourceLayerIndex,m.index,c.tileID);const[ce,de]=m.layers[0].layout.get("text-size-scale-range"),ve=s.aA(p,ce,de),[ge,Me]=x.get("icon-size-scale-range"),Fe=s.aA(p,ge,Me),pe={bucket:m,layout:x,paint:T,posMatrix:L,invMatrix:Z,mercatorCenter:[s.aF(this.transform.center.lng),s.aJ(this.transform.center.lat)],textLabelPlaneMatrix:te,labelToScreenMatrix:X,clippingData:ne,scale:M,textPixelRatio:A,holdingForFade:c.holdingForFade(),collisionBoxArray:S,partiallyEvaluatedTextSize:s.bK(m.textSizeData,this.transform.zoom,ve),partiallyEvaluatedIconSize:s.bK(m.iconSizeData,this.transform.zoom,Fe),collisionGroup:this.collisionGroups.get(m.sourceID),latestFeatureIndex:c.latestFeatureIndex};if(d)for(const oe of m.sortKeyRanges){const{sortKey:Ie,symbolInstanceStart:be,symbolInstanceEnd:ke}=oe;t.push({sortKey:Ie,symbolInstanceStart:be,symbolInstanceEnd:ke,parameters:pe})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:m.symbolInstances.length,parameters:pe})}attemptAnchorPlacement(t,o,c,d,p,m,y,x,T,S,M,A,C,L,z,O,N,q,G,j,ie){const{textOffset0:Q,textOffset1:te,crossTileID:X}=z,Z=[Q,te],ne=xa(t,m,y,Z,x),ce=this.collisionIndex.placeCollisionBox(N,x,o,c,d,p,Gs(ne.x,ne.y,T,S,this.transform.angle),L,M,A,C.predicate);if(G){const de=N.getSymbolInstanceIconSize(ie,this.transform.zoom,z.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(N,de,G,c,d,p,Gs(ne.x,ne.y,T,S,this.transform.angle),L,M,A,C.predicate).box.length===0)return}if(ce.box.length>0){let de;return this.prevPlacement&&this.prevPlacement.variableOffsets[X]&&this.prevPlacement.placements[X]&&this.prevPlacement.placements[X].text&&(de=this.prevPlacement.variableOffsets[X].anchor),this.variableOffsets[X]={textOffset:Z,width:m,height:y,anchor:t,textScale:x,prevAnchor:de},this.markUsedJustification(N,t,z,q),N.allowVerticalPlacement&&(this.markUsedOrientation(N,q,z),this.placedOrientations[X]=q),{shift:ne,placedGlyphBoxes:ce}}}placeLayerBucketPart(t,o,c,d,p=1){const{bucket:m,layout:y,paint:x,posMatrix:T,textLabelPlaneMatrix:S,labelToScreenMatrix:M,clippingData:A,textPixelRatio:C,mercatorCenter:L,invMatrix:z,holdingForFade:O,collisionBoxArray:N,partiallyEvaluatedTextSize:q,partiallyEvaluatedIconSize:G,collisionGroup:j,latestFeatureIndex:ie}=t.parameters,Q=y.get("text-optional"),te=y.get("icon-optional"),X=y.get("text-allow-overlap"),Z=y.get("icon-allow-overlap"),ne=y.get("text-rotation-alignment")==="map",ce=y.get("icon-rotation-alignment")==="map",de=y.get("text-pitch-alignment")==="map",ve=x.get("symbol-z-offset"),ge=y.get("symbol-elevation-reference")==="sea",Me=y.get("symbol-placement"),[Fe,pe]=y.get("text-size-scale-range"),[oe,Ie]=y.get("icon-size-scale-range"),be=s.aA(p,Fe,pe),ke=s.aA(p,oe,Ie),Ue=y.get("text-variable-anchor"),Ke=ne&&Me!=="point",je=ce&&Me!=="point",He=Ue&&m.hasTextData(),lt=m.hasIconTextFit()&&He&&m.hasIconData();this.transform.setProjection(m.projection);const st=He||Ke,et=je||lt;let ot=X&&(Z||!m.hasIconData()||te),dt=Z&&(X||!m.hasTextData()||Q);const yt=!ve.isConstant();!m.collisionArrays&&N&&m.deserializeCollisionBoxes(N),c&&d&&m.updateCollisionDebugBuffers(this.transform.zoom,N,be,ke);const Pt=(St,Zt,It)=>{const{crossTileID:si,numVerticalGlyphVertices:ri}=St;
vendor: 22,377 bytes, line 9
9let ci=null;if(A&&A.dynamicFilterNeedsFeature||yt){const Di=this.retainedQueryData[m.bucketInstanceId];ci=ie.loadFeature({featureIndex:St.featureIndex,bucketIndex:Di.bucketIndex,sourceLayerIndex:Di.sourceLayerIndex,layoutVertexArrayOffset:0});const Ki=ci.properties?ci.properties.worldview:null;if(m.localizable&&m.worldview&&typeof Ki=="string")if(Ki==="all")ci.properties.$localized=!0;else{if(!Ki.split(",").includes(m.worldview))return;ci.properties.$localized=!0,ci.properties.worldview=m.worldview}}if(A&&!(0,A.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch,worldview:m.worldview},ci,this.retainedQueryData[m.bucketInstanceId].tileID.canonical,new s.P(St.tileAnchorX,St.tileAnchorY),this.transform.calculateDistanceTileData(A.unwrappedTileID)))return this.placements[si]=new Yr(!1,!1,!1,!0),void o.add(si);const Ut=ve.evaluate(ci,{});if(o.has(si))return;if(O)return void(this.placements[si]=new Yr(!1,!1,!1));let Mt=!1,Jt=!1,Pi=!0,Ri=!1,Qt=!1,kt=null,Ct={box:null,offscreen:null,occluded:null},pi={box:null},Ni=null,gi=null,bi=null,en=0,mn=0,xr=0;It.textFeatureIndex?en=It.textFeatureIndex:St.useRuntimeCollisionCircles&&(en=St.featureIndex),It.verticalTextFeatureIndex&&(mn=It.verticalTextFeatureIndex);const ei=m.elevationFeatures?m.elevationFeatures[St.elevationFeatureIndex]:void 0,wn=Di=>{Di.tileID=this.retainedQueryData[m.bucketInstanceId].tileID;const Ki=this.transform.elevation;Di.elevation=ge?Ut:Ut+s.bV.getAtTileOffset(Di.tileID,new s.P(Di.tileAnchorX,Di.tileAnchorY),Ki,ei),Di.elevation+=St.zOffset},Dr=It.textBox;if(Dr){wn(Dr);const Di=yi=>{let rr=s.bL.horizontal;if(m.allowVerticalPlacement&&!yi&&this.prevPlacement){const kr=this.prevPlacement.placedOrientations[si];kr&&(this.placedOrientations[si]=kr,rr=kr,this.markUsedOrientation(m,rr,St))}return rr},Ki=(yi,rr)=>{if(m.allowVerticalPlacement&&ri>0&&It.verticalTextBox){for(const kr of m.writingModes)if(kr===s.bL.vertical?(Ct=rr(),pi=Ct):Ct=yi(),Ct&&Ct.box&&Ct.box.length)break}else Ct=yi()};if(Ue){let yi=Ue;if(this.prevPlacement&&this.prevPlacement.variableOffsets[si]){const $i=this.prevPlacement.variableOffsets[si];yi.indexOf($i.anchor)>0&&(yi=yi.filter(Tn=>Tn!==$i.anchor),yi.unshift($i.anchor))}const rr=($i,Tn,Xl)=>{const To=m.getSymbolInstanceTextSize(q,St,this.transform.zoom,Zt),Ga=($i.x2-$i.x1)*To+2*$i.padding,qa=($i.y2-$i.y1)*To+2*$i.padding,Sn=St.hasIconTextFit&&!Z?Tn:null;Sn&&wn(Sn);let So={box:[],offscreen:!1,occluded:!1};const Eo=X?2*yi.length:yi.length;for(let Nn=0;Nn<Eo;++Nn){const Wo=this.attemptAnchorPlacement(yi[Nn%yi.length],$i,L,z,st,Ga,qa,To,ne,de,C,T,j,Nn>=yi.length,St,Zt,m,Xl,Sn,q,G);if(Wo&&(So=Wo.placedGlyphBoxes,So&&So.box&&So.box.length)){Mt=!0,kt=Wo.shift;break}}return So};Ki(()=>rr(Dr,It.iconBox,s.bL.horizontal),()=>{const $i=It.verticalTextBox;return $i&&wn($i),m.allowVerticalPlacement&&!(Ct&&Ct.box&&Ct.box.length)&&ri>0&&$i?rr($i,It.verticalIconBox,s.bL.vertical):{box:null,offscreen:null,occluded:null}}),Ct&&(Mt=Ct.box,Pi=Ct.offscreen,Ri=Ct.occluded);const kr=Di(!(!Ct||!Ct.box));if(!Mt&&this.prevPlacement){const $i=this.prevPlacement.variableOffsets[si];$i&&(this.variableOffsets[si]=$i,this.markUsedJustification(m,$i.anchor,St,kr))}}else{const yi=(rr,kr)=>{const $i=m.getSymbolInstanceTextSize(q,St,this.transform.zoom,Zt),Tn=this.collisionIndex.placeCollisionBox(m,$i,rr,L,z,st,new s.P(0,0),X,C,T,j.predicate);return Tn&&Tn.box&&Tn.box.length&&(this.markUsedOrientation(m,kr,St),this.placedOrientations[si]=kr),Tn};Ki(()=>yi(Dr,s.bL.horizontal),()=>{const rr=It.verticalTextBox;return m.allowVerticalPlacement&&ri>0&&rr?(wn(rr),yi(rr,s.bL.vertical)):{box:null,offscreen:null,occluded:null}}),Di(!!(Ct&&Ct.box&&Ct.box.length))}}if(Ni=Ct,Mt=Ni&&Ni.box&&Ni.box.length>0,Pi=Ni&&Ni.offscreen,Ri=Ni&&Ni.occluded,St.useRuntimeCollisionCircles){const Di=St.centerJustifiedTextSymbolIndex>=0?St.centerJustifiedTextSymbolIndex:St.verticalPlacedTextSymbolIndex,Ki=m.text.placedSymbolArray.get(Di),yi=s.bM(m.textSizeData,q,Ki),rr=y.get("text-padding");gi=this.collisionIndex.placeCollisionCircles(m,X,Ki,Di,m.lineVertexArray,m.glyphOffsetArray,yi,T,S,M,c,de,j.predicate,St.collisionCircleDiameter*yi/s.bY,rr,this.retainedQueryData[m.bucketInstanceId].tileID),Mt=X||gi.circles.length>0&&!gi.collisionDetected,Pi=Pi&&gi.offscreen,Ri=gi.occluded}if(It.iconFeatureIndex&&(xr=It.iconFeatureIndex),It.iconBox){const Di=Ki=>{wn(Ki);const yi=St.hasIconTextFit&&kt?Gs(kt.x,kt.y,ne,de,this.transform.angle):new s.P(0,0),rr=m.getSymbolInstanceIconSize(G,this.transform.zoom,St.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(m,rr,Ki,L,z,et,yi,Z,C,T,j.predicate)};pi&&pi.box&&pi.box.length&&It.verticalIconBox?(bi=Di(It.verticalIconBox),Jt=bi.box.length>0):(bi=Di(It.iconBox),Jt=bi.box.length>0),Pi=Pi&&bi.offscreen,Qt=bi.occluded}const tn=Q||St.numHorizontalGlyphVertices===0&&ri===0,Kn=te||St.numIconVertices===0;if(tn||Kn?Kn?tn||(Jt=Jt&&Mt):Mt=Jt&&Mt:Jt=Mt=Jt&&Mt,Mt&&Ni&&Ni.box&&this.collisionIndex.insertCollisionBox(Ni.box,y.get("text-ignore-placement"),m.bucketInstanceId,pi&&pi.box&&mn?mn:en,j.ID),Jt&&bi&&this.collisionIndex.insertCollisionBox(bi.box,y.get("icon-ignore-placement"),m.bucketInstanceId,xr,j.ID),gi&&(Mt&&this.collisionIndex.insertCollisionCircles(gi.circles,y.get("text-ignore-placement"),m.bucketInstanceId,en,j.ID),c)){const Di=m.bucketInstanceId;let Ki=this.collisionCircleArrays[Di];Ki===void 0&&(Ki=this.collisionCircleArrays[Di]=new ya);for(let yi=0;yi<gi.circles.length;yi+=4)Ki.circles.push(gi.circles[yi+0]),Ki.circles.push(gi.circles[yi+1]),Ki.circles.push(gi.circles[yi+2]),Ki.circles.push(gi.collisionDetected?1:0)}const rn=m.projection.name!=="globe";ot=ot&&(rn||!Ri),dt=dt&&(rn||!Qt),this.placements[si]=new Yr(Mt||ot,Jt||dt,Pi||m.justReloaded),o.add(si)},Vt=this.retainedQueryData[m.bucketInstanceId].tileID;if(m.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(m,Vt),m.elevationType==="road"&&m.updateRoadElevation(Vt.canonical),m.updateZOffset(),m.sortFeaturesByY){const St=m.getSortedSymbolIndexes(this.transform.angle);for(let Zt=St.length-1;Zt>=0;--Zt){const It=St[Zt];Pt(m.symbolInstances.get(It),It,m.collisionArrays[It])}m.hasAnyZOffset&&s.w(`${m.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(m.hasAnyZOffset){const St=m.getSortedIndexesByZOffset();for(let Zt=0;Zt<St.length;++Zt){const It=St[Zt];Pt(m.symbolInstances.get(It),It,m.collisionArrays[It])}}else for(let St=t.symbolInstanceStart;St<t.symbolInstanceEnd;St++)Pt(m.symbolInstances.get(St),St,m.collisionArrays[St]);if(c&&m.bucketInstanceId in this.collisionCircleArrays){const St=this.collisionCircleArrays[m.bucketInstanceId];s.bl(St.invProjMatrix,T),St.viewportMatrix=this.collisionIndex.getViewportMatrix()}m.justReloaded=!1}markUsedJustification(t,o,c,d){const{leftJustifiedTextSymbolIndex:p,centerJustifiedTextSymbolIndex:m,rightJustifiedTextSymbolIndex:y,verticalPlacedTextSymbolIndex:x,crossTileID:T}=c,S=s.c3(o),M=d===s.bL.vertical?x:S==="left"?p:S==="center"?m:S==="right"?y:-1;p>=0&&(t.text.placedSymbolArray.get(p).crossTileID=M>=0&&p!==M?0:T),m>=0&&(t.text.placedSymbolArray.get(m).crossTileID=M>=0&&m!==M?0:T),y>=0&&(t.text.placedSymbolArray.get(y).crossTileID=M>=0&&y!==M?0:T),x>=0&&(t.text.placedSymbolArray.get(x).crossTileID=M>=0&&x!==M?0:T)}markUsedOrientation(t,o,c){const d=o===s.bL.horizontal||o===s.bL.horizontalOnly?o:0,p=o===s.bL.vertical?o:0,{leftJustifiedTextSymbolIndex:m,centerJustifiedTextSymbolIndex:y,rightJustifiedTextSymbolIndex:x,verticalPlacedTextSymbolIndex:T}=c,S=t.text.placedSymbolArray;m>=0&&(S.get(m).placedOrientation=d),y>=0&&(S.get(y).placedOrientation=d),x>=0&&(S.get(x).placedOrientation=d),T>=0&&(S.get(T).placedOrientation=p)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const o=this.prevPlacement;let c=!1;this.prevZoomAdjustment=o?o.zoomAdjustment(this.transform.zoom):0;const d=o?o.symbolFadeChange(t):1,p=o?o.opacities:{},m=o?o.variableOffsets:{},y=o?o.placedOrientations:{};for(const x in this.placements){const T=this.placements[x],S=p[x];S?(this.opacities[x]=new Yt(S,d,T.text,T.icon,null,T.clipped),c=c||T.text!==S.text.placed||T.icon!==S.icon.placed):(this.opacities[x]=new Yt(null,d,T.text,T.icon,T.skipFade,T.clipped),c=c||T.text||T.icon)}for(const x in p){const T=p[x];if(!this.opacities[x]){const S=new Yt(T,d,!1,!1);S.isHidden()||(this.opacities[x]=S,c=c||T.text.placed||T.icon.placed)}}for(const x in m)this.variableOffsets[x]||!this.opacities[x]||this.opacities[x].isHidden()||(this.variableOffsets[x]=m[x]);for(const x in y)this.placedOrientations[x]||!this.opacities[x]||this.opacities[x].isHidden()||(this.placedOrientations[x]=y[x]);c?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=o?o.lastPlacementChangeTime:t)}updateLayerOpacities(t,o,c,d){d&&(this.lastReplacementSourceUpdateTime=d.updateTime);const p=new Set;for(const m of o){const y=m.getBucket(t);y&&m.latestFeatureIndex&&t.fqid===y.layerIds[0]&&(this.updateBucketOpacities(y,p,m,m.collisionBoxArray,c,d,m.tileID,t.scope),y.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(y,m.tileID),y.elevationType==="road"&&y.updateRoadElevation(m.tileID.canonical),y.updateZOffset())}}updateBucketOpacities(t,o,c,d,p,m,y,x){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 T=t.layers[0].layout,S=t.layers[0].paint,M=!!t.layers[0].dynamicFilter(),A=new Yt(null,0,!1,!1,!0),C=T.get("text-allow-overlap"),L=T.get("icon-allow-overlap"),z=T.get("text-variable-anchor"),O=T.get("text-rotation-alignment")==="map",N=T.get("text-pitch-alignment")==="map",q=S.get("symbol-z-offset"),G=T.get("symbol-elevation-reference")==="sea",j=!q.isConstant(),ie=new Yt(null,0,C&&(L||!t.hasIconData()||T.get("icon-optional")),L&&(C||!t.hasTextData()||T.get("text-optional")),!0);!t.collisionArrays&&d&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(d);const Q=(X,Z,ne)=>{for(let ce=0;ce<Z/4;ce++)X.opacityVertexArray.emplaceBack(ne)};let te=0;m&&t.updateReplacement(y,m);for(let X=0;X<t.symbolInstances.length;X++){const Z=t.symbolInstances.get(X),{numHorizontalGlyphVertices:ne,numVerticalGlyphVertices:ce,crossTileID:de,numIconVertices:ve,tileAnchorX:ge,tileAnchorY:Me}=Z;let Fe=null;const pe=this.retainedQueryData[t.bucketInstanceId];j&&Z&&pe&&(Fe=c.latestFeatureIndex.loadFeature({featureIndex:Z.featureIndex,bucketIndex:pe.bucketIndex,sourceLayerIndex:pe.sourceLayerIndex,layoutVertexArrayOffset:0}));const oe=q.evaluate(Fe,{}),Ie=o.has(de);let be=this.opacities[de];Ie?be=A:be||(be=ie,this.opacities[de]=be),o.add(de);const ke=ne>0||ce>0,Ue=ve>0,Ke=this.placedOrientations[de],je=Ke===s.bL.vertical,He=Ke===s.bL.horizontal||Ke===s.bL.horizontalOnly;!ke&&!Ue||be.isHidden()||te++;let lt=!1;if((ke||Ue)&&m)for(const st of t.activeReplacements){if(s.bZ(st,p,s.b_.Symbol,x)||st.min.x>ge||ge>st.max.x||st.min.y>Me||Me>st.max.y)continue;const et=s.b$(ge,Me,y.canonical,st.footprintTileId.canonical);if(lt=s.c0(et,st.footprint),lt)break}if(ke){const st=lt?hn:jr(be.text);Q(t.text,ne,je?hn:st),Q(t.text,ce,He?hn:st);const et=be.text.isHidden(),{leftJustifiedTextSymbolIndex:ot,centerJustifiedTextSymbolIndex:dt,rightJustifiedTextSymbolIndex:yt,verticalPlacedTextSymbolIndex:Pt}=Z,Vt=t.text.placedSymbolArray,St=et||je?1:0;ot>=0&&(Vt.get(ot).hidden=St),dt>=0&&(Vt.get(dt).hidden=St),yt>=0&&(Vt.get(yt).hidden=St),Pt>=0&&(Vt.get(Pt).hidden=et||He?1:0);const Zt=this.variableOffsets[de];Zt&&this.markUsedJustification(t,Zt.anchor,Z,Ke);const It=this.placedOrientations[de];It&&(this.markUsedJustification(t,"left",Z,It),this.markUsedOrientation(t,It,Z))}if(Ue){const st=lt?hn:jr(be.icon),{placedIconSymbolIndex:et,verticalPlacedIconSymbolIndex:ot}=Z,dt=t.icon.placedSymbolArray,yt=be.icon.isHidden()?1:0;et>=0&&(Q(t.icon,ve,je?hn:st),dt.get(et).hidden=yt),ot>=0&&(Q(t.icon,Z.numVerticalIconVertices,He?hn:st),dt.get(ot).hidden=yt)}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const st=t.collisionArrays[X];if(st){let et=new s.P(0,0),ot=!0;if(st.textBox||st.verticalTextBox){if(z){const yt=this.variableOffsets[de];yt?(et=xa(yt.anchor,yt.width,yt.height,yt.textOffset,yt.textScale),O&&et._rotate(N?this.transform.angle:-this.transform.angle)):ot=!1}M&&(ot=!be.clipped),st.textBox&&er(t.textCollisionBox.collisionVertexArray,be.text.placed,!ot||je,oe,G,et.x,et.y),st.verticalTextBox&&er(t.textCollisionBox.collisionVertexArray,be.text.placed,!ot||He,oe,G,et.x,et.y)}const dt=ot&&!!(!He&&st.verticalIconBox);st.iconBox&&er(t.iconCollisionBox.collisionVertexArray,be.icon.placed,dt,oe,G,Z.hasIconTextFit?et.x:0,Z.hasIconTextFit?et.y:0),st.verticalIconBox&&er(t.iconCollisionBox.collisionVertexArray,be.icon.placed,!dt,oe,G,Z.hasIconTextFit?et.x:0,Z.hasIconTextFit?et.y:0)}}}if(t.fullyClipped=te===0,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.bucketInstanceId in this.collisionCircleArrays){const X=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=X.invProjMatrix,t.placementViewportMatrix=X.viewportMatrix,t.collisionCircleArray=X.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 t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,o){const c=this.zoomAtLastRecencyCheck===o?1-this.zoomAdjustment(o):1;return this.zoomAtLastRecencyCheck=o,this.commitTime+this.fadeDuration*c>t}isStale(){return this.stale}setStale(){this.stale=!0}}function er(l,t,o,c,d,p,m){l.emplaceBack(t?1:0,o?1:0,p||0,m||0,c,d?1:0),l.emplaceBack(t?1:0,o?1:0,p||0,m||0,c,d?1:0),l.emplaceBack(t?1:0,o?1:0,p||0,m||0,c,d?1:0),l.emplaceBack(t?1:0,o?1:0,p||0,m||0,c,d?1:0)}const Tm=Math.pow(2,25),_l=Math.pow(2,24),ju=Math.pow(2,17),gl=Math.pow(2,16),yc=Math.pow(2,9),Gu=Math.pow(2,8),xc=Math.pow(2,1);function jr(l){if(l.opacity===0&&!l.placed)return 0;if(l.opacity===1&&l.placed)return 4294967295;const t=l.placed?1:0,o=Math.floor(127*l.opacity);return o*Tm+t*_l+o*ju+t*gl+o*yc+t*Gu+o*xc+t}const hn=0;class dn{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&t.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(t,o,c,d,p,m){const y=this._bucketParts;for(;this._currentTileIndex<t.length;)if(o.getBucketParts(y,d,t[this._currentTileIndex],this._sortAcrossTiles,m),this._currentTileIndex++,p())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,y.sort((x,T)=>x.sortKey-T.sortKey));this._currentPartIndex<y.length;){const x=y[this._currentPartIndex];if(o.placeLayerBucketPart(x,this._seenCrossTileIDs,c,x.symbolInstanceStart===0,m),this._currentPartIndex++,p())return!0}return!1}}class qu{startNewPlacement(t,o,c,d,p,m,y,x){return this.placement=new Ur(t,d,p,m,y,x),this._currentPlacementIndex=o.length-1,this._forceFullPlacement=!1,this._showCollisionBoxes=c,this._fadeDuration=d,this._done=!1,this._inProgressLayer=null,this}requestFullPlacement(){this._forceFullPlacement=!0}isFullPlacementRequested(){return this._forceFullPlacement}setStale(){this.placement&&(this.placement.stale=!0)}isStale(){return!!this.placement&&this.placement.stale}isDone(){return this._done}continuePlacement(t,o,c,d,p){const m=s.o.now(),y=()=>{const x=s.o.now()-m;return!this.isFullPlacementRequested()&&this._fadeDuration!==0&&x>2};for(;this._currentPlacementIndex>=0;){const x=o[t[this._currentPlacementIndex]],T=this.placement.collisionIndex.transform.zoom;if(x.type==="symbol"&&x.visibility!=="none"&&(!x.minzoom||x.minzoom<=T)&&(!x.maxzoom||x.maxzoom>T)){const S=x,M=S.layout.get("symbol-z-elevate"),A=S.layout.get("symbol-sort-key").constantOr(1)!==void 0,C=S.layout.get("symbol-z-order"),L=C==="viewport-y"||C==="auto"&&!(C!=="viewport-y"&&A),z=S.layout.get("text-allow-overlap")||S.layout.get("icon-allow-overlap")||S.layout.get("text-ignore-placement")||S.layout.get("icon-ignore-placement"),O=L&&z,N=this._inProgressLayer=this._inProgressLayer||new dn(S),q=s.B(x.source,x.scope);if(N.continuePlacement(M||O?d[q]:c[q],this.placement,this._showCollisionBoxes,x,y,p))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._forceFullPlacement=!1,this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const us=512/s.al/2;class gr{constructor(t,o,c){this.tileID=t,this.bucketInstanceId=c,this.index=new s.c4(o.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const d=t.canonical.x*s.al,p=t.canonical.y*s.al;for(let m=0;m<o.length;m++){const{key:y,crossTileID:x,tileAnchorX:T,tileAnchorY:S}=o.get(m),M=Math.floor((d+T)*us),A=Math.floor((p+S)*us);this.index.add(M,A),this.keys.push(y),this.crossTileIDs.push(x)}this.index.finish()}findMatches(t,o,c){const d=this.tileID.canonical.z<o.canonical.z?1:Math.pow(2,this.tileID.canonical.z-o.canonical.z),p=us/Math.pow(2,o.canonical.z-this.tileID.canonical.z),m=o.canonical.x*s.al,y=o.canonical.y*s.al;for(let x=0;x<t.length;x++){const T=t.get(x);if(T.crossTileID)continue;const{key:S,tileAnchorX:M,tileAnchorY:A}=T,C=Math.floor((m+M)*p),L=Math.floor((y+A)*p),z=this.index.range(C-d,L-d,C+d,L+d).sort((O,N)=>O-N);for(const O of z){const N=this.crossTileIDs[O];if(this.keys[O]===S&&!c.has(N)){c.add(N),T.crossTileID=N;break}}}}}class mo{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class jo{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const o=Math.round((t-this.lng)/360);if(o!==0)for(const c in this.indexes){const d=this.indexes[c],p={};for(const m in d){const y=d[m];y.tileID=y.tileID.unwrapTo(y.tileID.wrap+o),p[y.tileID.key]=y}this.indexes[c]=p}this.lng=t}addBucket(t,o,c){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===o.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let p=0;p<o.symbolInstances.length;p++)o.symbolInstances.get(p).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]=new Set);const d=this.usedCrossTileIDs[t.overscaledZ];for(const p in this.indexes){const m=this.indexes[p];if(Number(p)>t.overscaledZ)for(const y in m){const x=m[y];x.tileID.isChildOf(t)&&x.findMatches(o.symbolInstances,t,d)}else{const y=m[t.scaledTo(Number(p)).key];y&&y.findMatches(o.symbolInstances,t,d)}}for(let p=0;p<o.symbolInstances.length;p++){const m=o.symbolInstances.get(p);m.crossTileID||(m.crossTileID=c.generate(),d.add(m.crossTileID))}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new gr(t,o.symbolInstances,o.bucketInstanceId),!0}removeBucketCrossTileIDs(t,o){for(const c of o.crossTileIDs)this.usedCrossTileIDs[t].delete(c)}removeStaleBuckets(t){let o=!1;for(const c in this.indexes){const d=this.indexes[c];for(const p in d)t[d[p].bucketInstanceId]||(this.removeBucketCrossTileIDs(c,d[p]),delete d[p],o=!0)}return o}}class ur{constructor(){this.layerIndexes={},this.crossTileIDs=new mo,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,o,c,d){let p=this.layerIndexes[t.fqid];p===void 0&&(p=this.layerIndexes[t.fqid]=new jo);let m=!1;const y={};d.name!=="globe"&&p.handleWrapJump(c);for(const x of o){const T=x.getBucket(t);T&&t.fqid===T.layerIds[0]&&(T.bucketInstanceId||(T.bucketInstanceId=++this.maxBucketInstanceId),p.addBucket(x.tileID,T,this.crossTileIDs)&&(m=!0),y[T.bucketInstanceId]=!0)}return p.removeStaleBuckets(y)&&(m=!0),m}pruneUnusedLayers(t){const o={};t.forEach(c=>{o[c]=!0});for(const c in this.layerIndexes)o[c]||delete this.layerIndexes[c]}}const hs=771;class Et{constructor(t,o,c,d){this.blendFunction=t,this.blendColor=o.toNonPremultipliedRenderColor(null),this.mask=c,this.blendEquation=d}}Et.Replace=[1,0,1,0],Et.disabled=new Et(Et.Replace,s.ao.transparent,[!1,!1,!1,!1]),Et.unblended=new Et(Et.Replace,s.ao.transparent,[!0,!0,!0,!0]),Et.alphaBlended=new Et([1,hs,1,hs],s.ao.transparent,[!0,!0,!0,!0]),Et.alphaBlendedNonPremultiplied=new Et([770,hs,770,hs],s.ao.transparent,[!0,!0,!0,!0]),Et.multiply=new Et([774,0,774,0],s.ao.transparent,[!0,!0,!0,!0]),Et.additive=new Et([1,1,1,1],s.ao.transparent,[!0,!0,!0,!0]);class ut{constructor(t,o,c){this.func=t,this.mask=o,this.range=c}}ut.ReadOnly=!1,ut.ReadWrite=!0,ut.disabled=new ut(519,ut.ReadOnly,[0,1]);const va=7680;class vt{constructor(t,o,c,d,p,m){this.test=t,this.ref=o,this.mask=c,this.fail=d,this.depthFail=p,this.pass=m}}vt.disabled=new vt({func:519,mask:0},0,0,va,va,va);const vc=1029,yl=2305;class gt{constructor(t,o,c){this.enable=t,this.mode=o,this.frontFace=c}}function Hu(l,t){const o=s.ca(l,3);s.cc(l,t),s.cg(l,3,o)}function $u(l,t){const o=s.c7([]);return s.c8(o,o,-t),s.c9(o,o,-l),o}function _o(l,t){const o=[l[0],l[1],0],c=[t[0],t[1],0];if(s.ag(o)>=1e-15){const m=s.aw([],o);s.c5(c,m,s.bJ(c,m)),t[0]=c[0],t[1]=c[1]}const d=s.bI([],t,l);if(s.c6(d)<1e-15)return null;const p=Math.atan2(-d[1],d[0]);return $u(Math.atan2(Math.sqrt(l[0]*l[0]+l[1]*l[1]),-l[2]),p)}gt.disabled=new gt(!1,vc,yl),gt.backCCW=new gt(!0,vc,yl),gt.backCW=new gt(!0,vc,2304),gt.frontCW=new gt(!0,1028,2304),gt.frontCCW=new gt(!0,1028,yl);class sf{constructor(t,o){this.position=t,this.orientation=o}get position(){return this._position}set position(t){if(t){const o=t instanceof s.ae?t:new s.ae(t[0],t[1],t[2]);
9this._renderWorldCopies&&(o.x=s.bT(o.x,0,1)),this._position=o}else this._position=null}lookAtPoint(t,o,c){if(this.orientation=null,!this.position)return;const d=this.position,p=c||(this._elevation?this._elevation.getAtPointOrZero(s.ae.fromLngLat(t)):0),m=s.ae.fromLngLat(t,p),y=[m.x-d.x,m.y-d.y,m.z-d.z];o||(o=[0,0,1]),o[2]=Math.abs(o[2]),this.orientation=_o(y,o)}setPitchBearing(t,o){this.orientation=$u(s.an(t),s.an(-o))}}class ba{constructor(t,o){this._transform=s.bA([]),this.orientation=o,this.position=t}get mercatorPosition(){const t=this.position;return new s.ae(t[0],t[1],t[2])}get position(){const t=s.ca(this._transform,3);return[t[0],t[1],t[2]]}set position(t){var o;t&&s.cg(this._transform,3,[(o=t)[0],o[1],o[2],1])}get orientation(){return this._orientation}set orientation(t){this._orientation=t||s.c7([]),t&&Hu(this._transform,this._orientation)}getPitchBearing(){const t=this.forward(),o=this.right();return{bearing:Math.atan2(-o[1],o[0]),pitch:Math.atan2(Math.sqrt(t[0]*t[0]+t[1]*t[1]),-t[2])}}setPitchBearing(t,o){this._orientation=$u(t,o),Hu(this._transform,this._orientation)}forward(){const t=s.ca(this._transform,2);return[-t[0],-t[1],-t[2]]}up(){const t=s.ca(this._transform,1);return[-t[0],-t[1],-t[2]]}right(){const t=s.ca(this._transform,0);return[t[0],t[1],t[2]]}getCameraToWorld(t,o){const c=new Float64Array(16);return s.bl(c,this.getWorldToCamera(t,o)),c}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(t,o,c){const d=this.position;s.c5(d,d,-t);const p=new Float64Array(16);return s.bq(p,[c,c,c]),s.br(p,p,d),p[10]*=o,p}getWorldToCamera(t,o){const c=new Float64Array(16),d=new Float64Array(4),p=this.position;return s.cb(d,this._orientation),s.c5(p,p,-t),s.cc(c,d),s.br(c,c,p),c[1]*=-1,c[5]*=-1,c[9]*=-1,c[13]*=-1,c[8]*=o,c[9]*=o,c[10]*=o,c[11]*=o,c}getCameraToClipPerspective(t,o,c,d){const p=new Float64Array(16);return s.cd(p,t,o,c,d),p}getCameraToClipOrthographic(t,o,c,d,p,m){const y=new Float64Array(16);return s.ce(y,t,o,c,d,p,m),y}getDistanceToElevation(t,o=!1){const c=t===0?0:s.cf(t,o?s.a$(this.position[1]):this.position[1]),d=this.forward();return(c-this.position[2])/d[2]}clone(){return new ba([...this.position],[...this.orientation])}}const fn=(l,t)=>({u_matrix:l,u_ground_shadow_factor:t});class Zu{constructor(t=0,o=0,c=0,d=0){if(isNaN(t)||t<0||isNaN(o)||o<0||isNaN(c)||c<0||isNaN(d)||d<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=o,this.left=c,this.right=d}interpolate(t,o,c){return o.top!=null&&t.top!=null&&(this.top=s.ak(t.top,o.top,c)),o.bottom!=null&&t.bottom!=null&&(this.bottom=s.ak(t.bottom,o.bottom,c)),o.left!=null&&t.left!=null&&(this.left=s.ak(t.left,o.left,c)),o.right!=null&&t.right!=null&&(this.right=s.ak(t.right,o.right,c)),this}getCenter(t,o){const c=s.aA((this.left+t-this.right)/2,0,t),d=s.aA((this.top+o-this.bottom)/2,0,o);return new s.P(c,d)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Zu(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const go=15;class bc{constructor(t,o,c,d,p,m,y){this.tileSize=512,this._renderWorldCopies=p===void 0||p,this._minZoom=t||0,this._maxZoom=o||22,this._minPitch=c??0,this._maxPitch=d??60,this.setProjection(m),this.setMaxBounds(y),this.width=0,this.height=0,this._center=new s.aT(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new Zu,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new ba,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._tileCoverLift=0,this.freezeTileCoverage=!1,this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1,this._allowWorldUnderZoom=!1}clone(){const t=new bc(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection(),this.maxBounds);return t._elevation=this._elevation,t._centerAltitude=this._centerAltitude,t._centerAltitudeValidForE
vendor: 1,249 bytes, line 9
9xaggeration=this._centerAltitudeValidForExaggeration,t.tileSize=this.tileSize,t.mercatorFromTransition=this.mercatorFromTransition,t.width=this.width,t.height=this.height,t.cameraElevationReference=this.cameraElevationReference,t._center=this._center,t._setZoom(this.zoom),t._seaLevelZoom=this._seaLevelZoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._nearZ=this._nearZ,t._farZ=this._farZ,t._averageElevation=this._averageElevation,t._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._camera=this._camera.clone(),t._calcMatrices(),t.freezeTileCoverage=this.freezeTileCoverage,t.frustumCorners=this.frustumCorners,t._allowWorldUnderZoom=this._allowWorldUnderZoom,t}get isOrthographic(){return this.projection.name!=="globe"&&this._orthographicProjectionAtLowPitch&&this.pitch<go}get elevation(){return this._elevation}set elevation(t){this._elevation!==t&&(this._elevation=t,this._updateCameraOnTerrain(),this._calcMatrices())}get depthOcclusionForSymbolsAndCircles(){return this.projection.name!=="globe"&&!this.isOrthographic}updateElevation(t,o=!1){const c=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForE
9xaggeration;(this._seaLevelZoom==null||c)&&this._updateCameraOnTerrain(),(t||c)&&this._constrainCamera(o),this._calcMatrices()}getProjection(){return s.aH(this.projection,["name","center","parallels"])}setProjection(t){this.projectionOptions=t||{name:"mercator"};const o=this.projection?this.getProjection():void 0;this.projection=s.cm(this.projectionOptions);const c=this.getProjection(),d=!s.by(o,c);return d&&this._calcMatrices(),this.mercatorFromTransition=!1,d}setOrthographicProjectionAtLowPitch(t){return this._orthographicProjectionAtLowPitch!==t&&(this._orthographicProjectionAtLowPitch=t,this._calcMatrices(),!0)}setMercatorFromTransition(){const t=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=s.cm({name:"mercator"});const o=t!==this.projection.name;return o&&this._calcMatrices(),o}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&&this.projection.supportsWorldCopies===!0}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){const t=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(t))}get cameraWorldSize(){const t=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(t))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return s.cf(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new s.P(this.width,this.height)}get bearing(){return s.bT(this.rotation,-180,180)}set bearing(t){this.rotation=t}get rotation(){return-this.angle/Math.PI*180}set rotation(t){const o=-t*Math.PI/180;this.angle!==o&&(this._unmodified=!1,this.angle=o,this._calcMatrices(),this.rotationMatrix=s.cn(),s.co(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const o=s.aA(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==o&&(this._unmodified=!1,this._pitch=o,this._calcMatrices())}get aspect(){return this.width/this.height}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=s.an(t),this._calcMatrices())}get fovX(){return this._fov}get fovY(){const t=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/t)}get averageElevation(){return this._averageElevation}set averageElevation(t){this._averageElevation=t,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(t){const o=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==o&&(this._unmodified=!1,this._setZoom(o),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(t){this._zoom=t,this.scale=this.zoomScale(t),this.tileZoom=Math.floor(t),this.zoomFraction=t-this.tileZoom}get tileCoverLift(){return this._tileCoverLift}set tileCoverLift(t){this._tileCoverLift!==t&&(this._tileCoverLift=t)}_updateCameraOnTerrain(){const t=this.elevation?this.elevation.getAtPoint(this.locationCoordinate(this.center),Number.NEGATIVE_INFINITY):Number.NEGATIVE_INFINITY,o=this.elevation&&t===Number.NEGATIVE_INFINITY&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>
vendor: 6,648 bytes, line 9
90&&this._centerAltitudeValidForExaggeration;if(!this._elevation||t===Number.NEGATIVE_INFINITY&&(!o||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const c=this._elevation;o||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&c.exaggeration()&&this._centerAltitudeValidForExaggeration!==c.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*c.exaggeration(),this._centerAltitudeValidForExaggeration=c.exaggeration()):(this._centerAltitude=t||0,this._centerAltitudeValidForExaggeration=c.exaggeration()),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){if(this._centerAltitudeValidForExaggeration===void 0)return;const t=Math.max(0,(this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize);this._seaLevelZoom=this._zoomFromMercatorZ(t)}sampleAverageElevation(){if(!this._elevation)return 0;const t=this._elevation,o=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],c=this.horizonLineFromTop();let d=0,p=0;for(let m=0;m<o.length;m++){const y=new s.P(o[m][0]*this.width,c+o[m][1]*(this.height-c)),x=t.pointCoordinate(y);if(!x)continue;const T=1/Math.hypot(x[0]-this._camera.position[0],x[1]-this._camera.position[1]);d+=x[3]*T,p+=T}return p===0?NaN:d/p}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._terrainEnabled()&&(this.cameraElevationReference==="ground"?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(this._seaLevelZoom==null||!this._elevation)return;const t=this._seaLevelZoom,o=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),c=this.pixelsPerMeter/this.worldSize*o,d=this._mercatorZfromZoom(t),p=this._mercatorZfromZoom(this._maxZoom),m=Math.max(d-c,p);this._setZoom(this._zoomFromMercatorZ(m))}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())}equals(t){const o=this.elevation,c=t.elevation,d=o!=null!=(c!=null)||o&&c&&o.exaggeration()!==c.exaggeration();return this.width===t.width&&this.height===t.height&&this.center.lng===t.center.lng&&this.center.lat===t.center.lat&&this.zoom===t.zoom&&this.bearing===t.bearing&&this.pitch===t.pitch&&this.fov===t.fov&&this.projection.name===t.projection.name&&this._edgeInsets.equals(t.padding)&&!d}computeZoomRelativeTo(t){const o=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,t.toAltitude()));let c;c=t.z<this._camera.position[2]?[o.x,o.y,o.z]:[t.x,t.y,t.z];const d=s.ag(s.av([],this._camera.position,c));return s.aA(this._zoomFromMercatorZ(d),this._minZoom,this._maxZoom)}setFreeCameraOptions(t){if(!this.height||!t.position&&!t.orientation)return;this._updateCameraState();let o=!1;if(t.orientation&&!s.cp(t.orientation,this._camera.orientation)&&(o=this._setCameraOrientation(t.orientation)),t.position){const c=[t.position.x,t.position.y,t.position.z];s.cq(c,this._camera.position)||(this._setCameraPosition(c),o=!0)}o&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();const t=this._camera.position,o=new sf;return o.position=new s.ae(t[0],t[1],t[2]),o.orientation=this._camera.orientation,o._elevation=this.elevation,o._renderWorldCopies=this.renderWorldCopies,o}_setCameraOrientation(t){if(!s.cr(t))return!1;s.cs(t,t);const o=s.ct([],[0,0,-1],t),c=s.ct([],[0,-1,0],t);if(c[2]<0)return!1;const d=_o(o,c);return!!d&&(this._camera.orientation=d,!0)}_setCameraPosition(t){const o=this.zoomScale(this.minZoom)*this.tileSize,c=this.zoomScale(this.maxZoom)*this.tileSize,d=this.cameraToCenterDistance;t[2]=s.aA(t[2],d/c,d/o),this._camera.position=t}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,o,c){this._unmodified=!1,this._edgeInsets.interpolate(t,o,c),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const o=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,o)}getVisibleUnwrappedCoordinates(t){const o=[new s.cu(0,t)];if(this.renderWorldCopies){const c=this.pointCoordinate(new s.P(0,0)),d=this.pointCoordinate(new s.P(this.width,0)),p=this.pointCoordinate(new s.P(this.width,this.height)),m=this.pointCoordinate(new s.P(0,this.height)),y=Math.floor(Math.min(c.x,d.x,p.x,m.x)),x=Math.floor(Math.max(c.x,d.x,p.x,m.x)),T=1;for(let S=y-T;S<=x+T;S++)S!==0&&o.push(new s.cu(S,t))}return o}isLODDisabled(t){return(!t||this.pitch<=60)&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace}extendTileCover(t,o,c,d){let p=[];const m=c!=null,y=!m;if(y&&this.zoom<o||m&&c[0]===0&&c[1]===0)return p;const x=new Set,T=(M,A,C,L,z)=>{const O=s.cY(A,M,C,L,z);x.has(O)||(p.push(new s.aQ(M,A,C,L,z)),x.add(O))};for(let M=0;M<t.length;M++){const A=t[M];if(y&&A.canonical.z!==o||m&&d!==void 0&&d>A.canonical.z)continue;const C=A.canonical,L=A.overscaledZ,z=A.wrap,O=1<<C.z,N=C.x+1<O,q=C.x>0,G=C.y+1<O,j=C.y>0,ie=A.wrap-(q?0:1),Q=A.wrap+(N?0:1),te=q?C.x-1:O-1,X=N?C.x+1:0;if(m)c[0]<0?(T(L,Q,C.z,X,C.y),c[1]<0&&G&&(T(L,z,C.z,C.x,C.y+1),T(L,Q,C.z,X,C.y+1)),c[1]>0&&j&&(T(L,z,C.z,C.x,C.y-1),T(L,Q,C.z,X,C.y-1))):c[0]>0?(T(L,ie,C.z,te,C.y),c[1]<0&&G&&(T(L,z,C.z,C.x,C.y+1),T(L,ie,C.z,te,C.y+1)),c[1]>0&&j&&(T(L,z,C.z,C.x,C.y-1),T(L,ie,C.z,te,C.y-1))):c[1]<0&&G?T(L,z,C.z,C.x,C.y+1):j&&T(L,z,C.z,C.x,C.y-1);else{const Z=A.visibleQuadrants;1&Z&&(T(L,ie,C.z,te,C.y),j&&(T(L,z,C.z,C.x,C.y-1),T(L,ie,C.z,te,C.y-1))),2&Z&&(T(L,Q,C.z,X,C.y),j&&(T(L,z,C.z,C.x,C.y-1),T(L,Q,C.z,X,C.y-1))),4&Z&&(T(L,ie,C.z,te,C.y),G&&(T(L,z,C.z,C.x,C.y+1),T(L,ie,C.z,te,C.y+1))),8&Z&&(T(L,Q,C.z,X,C.y),G&&(T(L,z,C.z,C.x,C.y+1),T(L,Q,C.z,X,C.y+1)))}}const S=[];for(const M of p)p.some(A=>M.isChildOf(A))||S.push(M);if(p=S.filter(M=>!t.some(A=>!!(M.overscaledZ<o&&A.isChildOf(M))||M.equals(A)||M.isChildOf(A))),y){const M=1<<o,A=this.projection.name==="globe"?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),C=[M*A.x,M*A.y],L=4,z=L*L;p=p.filter(O=>{const N=O.canonical.x+.5-C[0],q=O.canonical.y+.5-C[1];return N*N+q*q<z})}return p}extendTileCoverToNearPlane(t,o,c){const d=[],p=new Set;for(const q of t)p.add(q.key);const m=(q,G,j,ie,Q)=>{const te=s.cY(G,q,j,ie,Q);p.has(te)||(d.push(new s.aQ(q,G,j,ie,Q)),p.add(te))},y=t.reduce((q,G)=>
9Math.max(q,G.overscaledZ),c),x=1<<c,T=[new s.P(0,0),new s.P(s.al,0),new s.P(s.al,s.al),new s.P(0,s.al)],S=new s.P(0,0),M=new s.P(0,0),A=(q,G)=>{const j=Math.floor(q[0]),ie=Math.floor(q[1]),Q=(q[0]-j)*s.al,te=(q[1]-ie)*s.al,X=Math.floor(G[0]),Z=Math.floor(G[1]),ne=(G[0]-X)*s.al,ce=(G[1]-Z)*s.al;for(let de=-1;de<=1;de++){const ve=j+de;if(!(ve<0||ve>=x)){S.x=Q-de*s.al,M.x=ne-(ve-X)*s.al;for(let ge=-1;ge<=1;ge++){const Me=ie+ge;S.y=te-ge*s.al,M.y=ce-(Me-Z)*s.al,s.cZ(S,M,T)&&m(y,0,c,ve,Me)}}}},C=o.points,L=C[s.cv],z=C[s.cw],O=this._projectToGround(L,C[s.cx]),N=this._projectToGround(z,C[s.cy]);return A(L,O),A(z,N),d}_projectToGround(t,o){return s.cz(s.cA(),t,o,t[2]/(t[2]-o[2]))}coveringTiles(t){let o=this.coveringZoomLevel(t);const c=o,d=this.elevation&&this.elevation.exaggeration(),p=d&&!t.isTerrainDEM,m=this.projection.name==="mercator";if(t.minzoom!==void 0&&o<t.minzoom)return[];t.maxzoom!==void 0&&o>t.maxzoom&&(o=t.maxzoom);const y=this.locationCoordinate(this.center),x=this.center.lat,T=1<<o,S=[T*y.x,T*y.y,0],M=this.projection.name==="globe",A=!M,C=s.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,o,A),L=M?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),z=T*s.cf(1,this.center.lat),O=this._camera.position[2]/s.cf(1,this.center.lat),N=[T*L.x,T*L.y,O*(A?1:z)],q=M||d,G=this.cameraToCenterDistance/t.tileSize*(t.roundZoom?1:.502),j=this.isLODDisabled(!0)?o:0;let ie;if(this._elevation&&t.isTerrainDEM)ie=1e4*this._elevation.exaggeration();else if(this._elevation){const oe=this._elevation.getMinMaxForVisibleTiles();ie=oe?oe.max:this._centerAltitude}else ie=this._centerAltitude;const Q=t.isTerrainDEM?-ie:this._elevation?this._elevation.getMinElevationBelowMSL():0,te=this.projection.isReprojectedInTileSpace?s.cC(this):1,X=oe=>{const be=new s.ae(oe.x+25e-6,oe.y,oe.z),ke=new s.ae(oe.x,oe.y+25e-6,oe.z),Ue=oe.toLngLat(),Ke=be.toLngLat(),je=ke.toLngLat(),He=this.locationCoordinate(Ue),lt=this.locationCoordinate(Ke),st=this.locationCoordinate(je),et=Math.hypot(lt.x-He.x,lt.y-He.y),ot=Math.hypot(st.x-He.x,st.y-He.y);return Math.sqrt(et*ot)*te/25e-6},Z=oe=>{const Ie=ie,be=Q;return{aabb:s.cF(this,T,0,0,0,oe,be,Ie,this.projection),zoom:0,x:0,y:0,minZ:be,maxZ:Ie,wrap:oe,fullyVisible:!1}},ne=[];let ce=[];const de=o,ve=t.reparseOverscaled?c:o,ge=(O-this._centerAltitude)*z,Me=oe=>{if(!this._elevation||!oe.tileID||!m)return;const Ie=this._elevation.getMinMaxForTile(oe.tileID),be=oe.aabb;Ie?(be.min[2]=Ie.min,be.max[2]=Ie.max,be.center[2]=(be.min[2]+be.max[2])/2):(oe.shouldSplit=pe(oe),oe.shouldSplit||(be.min[2]=be.max[2]=be.center[2]=this._centerAltitude))},Fe=(oe,Ie)=>{if(.707*Ie<oe)return 1;const be=Ie/oe;return be/(1.4144271570014144+(Math.pow(1.1,be-1.4144271570014144+1)-1)/(1.1-1)-1)},pe=oe=>{if(oe.zoom<j)return!0;if(oe.zoom===de)return!1;if(oe.shouldSplit!=null)return oe.shouldSplit;const Ie=oe.aabb.distanceX(N),be=oe.aabb.distanceY(N);let ke=ge,Ue=1;if(M){ke=oe.aabb.distanceZ(N);const ot=Math.pow(2,oe.zoom),dt=s.a$((oe.y+1)/ot),yt=s.a$(oe.y/ot),Pt=Math.min(Math.max(x,dt),yt),Vt=s.d1(Pt)/s.d1(x);if(Ue=Pt===x?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,Vt/this._mercatorScaleRatio),this.zoom<=s.c_&&oe.zoom===de-1&&Vt>=.9)return!0}else if(p&&(ke=oe.aabb.distanceZ(N)*z),this.projection.isReprojectedInTileSpace&&c<=5){const ot=Math.pow(2,oe.zoom),dt=X(new s.ae((oe.x+.5)/ot,(oe.y+.5)/ot));Ue=dt>.85?1:dt}if(!m&&!M){const ot=Math.sqrt(Ie*Ie+be*be+ke*ke);let dt=(1<<de-oe.zoom)*G*Ue;return dt*=Fe(Math.max(ke,ge),ot),ot<dt}let Ke=Number.MAX_VALUE,je=0;const He=oe.aabb.getCorners(),lt=[];for(const ot of He){s.av(lt,ot,N),M||(p?lt[2]*=z:lt[2]=ge);const dt=s.bJ(lt,this._camera.forward());dt<Ke&&(Ke=dt,je=Math.abs(lt[2]))}let st=(1<<de-oe.zoom)*G*Ue;if(st*=Fe(Math.max(je,ge),Ke),Ke<st)return!0;const et=oe.aabb.closestPoint(S);return et[0]===S[0]&&et[1]===S[1]};if(this.renderWorldCopies)for(let oe=1;oe<=3;oe++)ne.push(Z(-oe)),ne.push(Z(oe));for(ne.push(Z(0));ne.length>0;){const oe=ne.pop(),Ie=oe.x,be=oe.y;let ke=oe.fullyVisible;const Ue=()=>this.projection.name==="globe"&&(oe.y===0||oe.y===(1<<oe.zoom)-1);if(!ke){let Ke=q?oe.aabb.intersects(C):oe.aabb.intersectsFlat(C);if(Ke===0&&Ue()){const je=new s.cD(oe.zoom,Ie,be);Ke=s.cE(this,T,je,!0).intersects(C)}if(Ke===0)continue;ke=Ke===2}if(oe.zoom===de||!pe(oe)){const Ke=oe.zoom===de?ve:oe.zoom;if(t.minzoom&&t.minzoom>Ke)continue;let je=0;if(!ke){let et=q?oe.aabb.intersectsPrecise(C):oe.aabb.intersectsPreciseFlat(C);if(et===0&&Ue()){const ot=new s.cD(oe.zoom,Ie,be);et=s.cE(this,T,ot,!0).intersectsPrecise(C)}if(et===0)continue;if(t.calculateQuadrantVisibility)if(C.containsPoint(oe.aabb.center))je=15;else for(let ot=0;ot<4;ot++)oe.aabb.quadrant(ot).intersects(C)!==0&&(je|=1<<ot)}const He=S[0]-(.5+Ie+(oe.wrap<<oe.zoom))*(1<<o-oe.zoom),lt=S[1]-.5-be,st=oe.tileID?oe.tileID:new s.aQ(Ke,oe.wrap,oe.zoom,Ie,be);t.calculateQuadrantVisibility&&(st.visibleQuadrants=je),ce.push({tileID:st,distanceSq:He*He+lt*lt});continue}for(let Ke=0;Ke<4;Ke++){const je=(Ie<<1)+Ke%2,He=(be<<1)+(Ke>>1),lt={aabb:m?oe.aabb.quadrant(Ke):s.cF(this,T,oe.zoom+1,je,He,oe.wrap,oe.minZ,oe.maxZ,this.projection),zoom:oe.zoom+1,x:je,y:He,wrap:oe.wrap,fullyVisible:ke,tileID:void 0,shouldSplit:void 0,minZ:oe.minZ,maxZ:oe.maxZ};p&&!M&&(lt.tileID=new s.aQ(oe.zoom+1===de?ve:oe.zoom+1,oe.wrap,oe.zoom+1,je,He),Me(lt)),ne.push(lt)}}if(this.fogCullDistSq){const oe=this.fogCullDistSq,Ie=this.horizonLineFromTop();ce=ce.filter(be=>{const ke=[0,0,0,1],Ue=[s.al,s.al,0,1],Ke=this.calculateFogTileMatrix(be.tileID.toUnwrapped());s.aC(ke,ke,Ke),s.aC(Ue,Ue,Ke);const je=s.cG([],ke,Ue),He=s.cH([],ke,Ue),lt=s.c$(je,He);if(lt===0)return!0;let st=!1;const et=this._elevation;if(et&&lt>oe&&Ie!==0){const ot=this.calculateProjMatrix(be.tileID.toUnwrapped());let dt;t.isTerrainDEM||(dt=et.getMinMaxForTile(be.tileID)),dt||(dt={min:Q,max:ie});const yt=s.cI(this.rotation),Pt=[yt[0]*s.al,yt[1]*s.al,dt.max];s.af(Pt,Pt,ot),st=(1-Pt[1])*this.height*.5<Ie}return lt<oe||st})}return ce.sort((oe,Ie)=>oe.distanceSq-Ie.distanceSq).map(oe=>oe.tileID)}resize(t,o){this.width=t,this.height=o,this.pixelsToGLUnits=[2/t,-2/o],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log2(t)}project(t){const o=s.aA(t.lat,-s.cJ,s.cJ),c=this.projection.project(t.lng,o);return new s.P(c.x*this.worldSize,c.y*this.worldSize)}unproject(t){return this.projection.unproject(t.x/this.worldSize,t.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/s.cf(1,this.center.lat)/this.worldSize}setLocationAtPoint(t,o){let c,d;const p=this.centerPoint;if(this.projection.name==="globe"){const y=this.worldSize;c=(o.x-p.x)/y,d=(o.y-p.y)/y}else{const y=this.pointCoordinate(o),x=this.pointCoordinate(p);c=y.x-x.x,d=y.y-x.y}const m=this.locationCoordinate(t);this.setLocation(new s.ae(m.x-c,m.y-d))}setLocation(t){this.center=this.coordinateLocation(t),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(t,o){return this.projection.locationPoint(this,t,o)}locationPoint3D(t,o){return this.projection.locationPoint(this,t,o,!0)}pointLocation(t){return this.coordinateLocation(this.pointCoordinate(t))}pointLocation3D(t,o){return this.coordinateLocation(this.pointCoordinate3D(t,o))}locationCoordinate(t,o){const c=o?s.cf(o,t.lat):void 0,d=this.projection.project(t.lng,t.lat);return new s.ae(d.x,d.y,c)}coordinateLocation(t){return this.projection.unproject(t.x,t.y)}pointRayIntersection(t,o){const c=o??this._centerAltitude,d=[t.x,t.y,0,1],p=[t.x,t.y,1,1];s.aC(d,d,this.pixelMatrixInverse),s.aC(p,p,this.pixelMatrixInverse);const m=p[3];s.cK(d,d,1/d[3]),s.cK(p,p,1/m);const y=d[2],x=p[2];return{p0:d,p1:p,t:y===x?0:(c-y)/(x-y)}}screenPointToMercatorRay(t){const o=[t.x,t.y,0,1],c=[t.x,t.y,1,1];return s.aC(o,o,this.pixelMatrixInverse),s.aC(c,c,this.pixelMatrixInverse),s.cK(o,o,1/o[3]),s.cK(c,c,1/c[3]),o[2]=s.cf(o[2],this._center.lat)*this.worldSize,c[2]=s.cf(c[2],this._center.lat)*this.worldSize,s.cK(o,o,1/this.worldSize),s.cK(c,c,1/this.worldSize),new s.ax([o[0],o[1],o[2]],s.aw([],s.av([],c,o)))}rayIntersectionCoordinate(t){const{p0:o,p1:c,t:d}=t,p=s.cf(o[2],this._center.lat),m=s.cf(c[2],this._center.lat);return new s.ae(s.ak(o[0],c[0],d)/this.worldSize,s.ak(o[1],c[1],d)/this.worldSize,s.ak(p,m,d))}pointCoordinate(t,o=this._centerAltitude){return this.projection.pointCoordinate(this,t.x,t.y,o)}pointCoordinate3D(t,o){if(!this.elevation)return this.pointCoordinate(t,o);let c=this.projection.pointCoordinate3D(this,t.x,t.y);if(c)return new s.ae(c[0],c[1],c[2]);let d=0,p=this.horizonLineFromTop();if(t.y>p)return this.pointCoordinate(t,o);const m=.02*p,y=t.clone();for(let x=0;x<10&&p-d>m;x++){y.y=s.ak(d,p,.66);const T=this.projection.pointCoordinate3D(this,y.x,y.y);T?(p=y.y,c=T):d=y.y}return c?new s.ae(c[0],c[1],c[2]):this.pointCoordinate(t)}isPointAboveHorizon(t){return this.projection.isPointAboveHorizon(this,t)}isPointOnSurface(t){if(t.y<0||t.y>this.height||t.x<0||t.x>this.width)return!1;if(this.elevation||this.zoom>=s.cL)return!this.isPointAboveHorizon(t);const o=this.pointCoordinate(t);return o.y>=0&&o.y<=1}_coordinatePoint(t,o){const c=o&&this.elevation?this.elevation.getAtPointOrZero(t,this._centerAltitude):this._centerAltitude,d=[t.x*this.worldSize,t.y*this.worldSize,c+t.toAltitude(),1];return s.aC(d,d,this.pixelMatrix),d[3]>0?new s.P(d[0]/d[3],d[1]/d[3]):new s.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:t,left:o}=this._edgeInsets,c=this.height-this._edgeInsets.bottom,d=this.width-this._edgeInsets.right,p=this.pointLocation3D(new s.P(o,t)),m=this.pointLocation3D(new s.P(d,t)),y=this.pointLocation3D(new s.P(d,c)),x=this.pointLocation3D(new s.P(o,c));let T=Math.min(p.lng,m.lng,y.lng,x.lng),S=Math.max(p.lng,m.lng,y.lng,x.lng),M=Math.min(p.lat,m.lat,y.lat,x.lat),A=Math.max(p.lat,m.lat,y.lat,x.lat);const C=Math.pow(2,-this.zoom)/16*270,L=this.projection.name==="globe"?1:4,z=(O,N,q,G,j)=>
9{const ie=(O+q)/2,Q=(N+G)/2,te=new s.P(ie,Q),{lng:X,lat:Z}=this.pointLocation3D(te),ne=Math.max(0,T-X,M-Z,X-S,Z-A);T=Math.min(T,X),S=Math.max(S,X),M=Math.min(M,Z),A=Math.max(A,Z),(j<L||ne>C)&&(z(O,N,ie,Q,j+1),z(ie,Q,q,G,j+1))};if(z(o,t,d,t,1),z(d,t,d,c,1),z(d,c,o,c,1),z(o,c,o,t,1),this.projection.name==="globe"){const[O,N]=s.cM(this);O?(A=90,S=180,T=-180):N&&(M=-90,S=180,T=-180)}return new s.aI(new s.aT(T,M),new s.aT(S,A))}_getBoundsRectangular(t,o){const{top:c,left:d}=this._edgeInsets,p=this.height-this._edgeInsets.bottom,m=this.width-this._edgeInsets.right,y=new s.P(d,c),x=new s.P(m,c),T=new s.P(m,p),S=new s.P(d,p);let M=this.pointCoordinate(y,t),A=this.pointCoordinate(x,t);const C=this.pointCoordinate(T,o),L=this.pointCoordinate(S,o),z=(O,N)=>(N.y-O.y)/(N.x-O.x);return M.y>1&&A.y>=0?M=new s.ae((1-L.y)/z(L,M)+L.x,1):M.y<0&&A.y<=1&&(M=new s.ae(-L.y/z(L,M)+L.x,0)),A.y>1&&M.y>=0?A=new s.ae((1-C.y)/z(C,A)+C.x,1):A.y<0&&M.y<=1&&(A=new s.ae(-C.y/z(C,A)+C.x,0)),new s.aI().extend(this.coordinateLocation(M)).extend(this.coordinateLocation(A)).extend(this.coordinateLocation(L)).extend(this.coordinateLocation(C))}_getBoundsRectangularTerrain(){const t=this.elevation;if(!t.visibleDemTiles.length||t.isUsingMockSource())return this._getBoundsRectangular(0,0);const o=t.visibleDemTiles.reduce((c,d)=>{if(d.dem){const p=d.dem.tree;c.min=Math.min(c.min,p.minimums[0]),c.max=Math.max(c.max,p.maximums[0])}return c},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(o.min*t.exaggeration(),o.max*t.exaggeration())}getBounds(){return this.projection.name==="mercator"||this.projection.name==="equirectangular"?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(t=!0){const o=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,c=this.height/2-o*(1-this._horizonShift);return t?Math.max(0,c):c}getMaxBounds(){return this.maxBounds}setMaxBounds(t){this.maxBounds=t,this.minLat=-s.cJ,this.maxLat=s.cJ,this.minLng=-180,this.maxLng=180,t&&(this.minLat=t.getSouth(),this.maxLat=t.getNorth(),this.minLng=t.getWest(),this.maxLng=t.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=s.aF(this.minLng)*this.tileSize,this.worldMaxX=s.aF(this.maxLng)*this.tileSize,this.worldMinY=s.aJ(this.maxLat)*this.tileSize,this.worldMaxY=s.aJ(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(t,o){return this.projection.createTileMatrix(this,o,t)}calculateDistanceTileData(t){const o=t.key,c=this._distanceTileDataCache;if(c[o])return c[o];const d=t.canonical,p=1/this.height,m=this.cameraWorldSize,y=m/this.zoomScale(d.z),x=(d.x+Math.pow(2,d.z)*t.wrap)*y,T=d.y*y,S=this.point;S.x*=m/this.worldSize,S.y*=m/this.worldSize;const M=this.angle,A=Math.sin(-M),C=-Math.cos(-M);return c[o]={bearing:[A,C],center:[(S.x-x)*p,(S.y-T)*p],scale:y/s.al*p},c[o]}calculateFogTileMatrix(t){const o=t.key,c=this._fogTileMatrixCache;if(c[o])return c[o];const d=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,t);return s.aB(d,this.worldToFogMatrix,d),c[o]=new Float32Array(d),c[o]}calculateProjMatrix(t,o=!1,c=!1){const d=t.key;let p;if(p=c?this._expandedProjMatrixCache:o?this._alignedProjMatrixCache:this._projMatrixCache,p[d])return p[d];const m=this.calculatePosMatrix(t,this.worldSize);let y;return y=this.projection.isReprojectedInTileSpace?this.mercatorMatrix:c?this.expandedFarZProjMatrix:o?this.alignedProjMatrix:this.projMatrix,s.aB(m,y,m),p[d]=new Float32Array(m),p[d]}calculatePixelsToTileUnitsMatrix(t){const o=t.tileID.key,c=this._pixelsToTileUnitsCache;if(c[o])return c[o];const d=s.cN(t,this);return c[o]=d,c[o]}customLayerMatrix(){return this.mercatorMatrix.slice()}globeToMercatorMatrix(){if(this.projection.name==="globe"){const t=1/this.worldSize,o=s.bq([],[t,t,t]);return s.aB(o,o,this.globeMatrix),o}}recenterOnTerrain(){if(!this._elevation||this.projection.name==="globe")return;const t=this._elevation;this._updateCameraState();const o=s.cf(1,this._center.lat)*this.worldSize,c=this._computeCameraPosition(o),d=this._camera.forward(),p=s.cf(1,this._center.lat);c[2]/=p,d[2]/=p,s.aw(d,d);const m=t.raycast(c,d,t.exaggeration());if(m){const y=s.bH([],c,d,m),x=new s.ae(y[0],y[1],s.cf(y[2],s.a$(y[1]))),T=(x.z+s.ag([x.x-c[0],x.y-c[1],x.z-c[2]*p]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(T),this._centerAltitude=x.toAltitude(),this._center=this.coordinateLocation(x),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCamera(t=!1){if(!this._elevation)return;const o=this._elevation,c=s.cf(1,this._center.lat)*this.worldSize,d=this._computeCameraPosition(c),p=o.getAtPointOrZero(new s.ae(...d)),m=this.pixelsPerMeter/this.worldSize*p,y=this._minimumHeightOverTerrain(),x=d[2]-m;if(x<=y)if(x<0||t){const T=this.locationCoordinate(this._center,this._centerAltitude),S=[d[0],d[1],T.z-d[2]],M=s.ag(S);S[2]-=(y-x)/this._pixelsPerMercatorPixel;const A=s.ag(S);if(A===0)return;s.c5(S,S,M/A*this._pixelsPerMercatorPixel),this._camera.position=[d[0],d[1],T.z*this._pixelsPerMercatorPixel-S[2]],this._updateStateFromCamera()}else this._isCameraConstrained=!0}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const t=this.projection.name==="globe"||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||t){const A=this.center;return A.lat=s.aA(A.lat,this.minLat,this.maxLat),(this.maxBounds||!this.renderWorldCopies&&!t)&&(A.lng=s.aA(A.lng,this.minLng,this.maxLng)),this.center=A,void(this._constraining=!1)}const o=this._unmodified,{x:c,y:d}=this.point;let p=0,m=c,y=d;const x=this.width/2,T=this.height/2,S=this.worldMinY*this.scale,M=this.worldMaxY*this.scale;if(d-T<S&&(y=S+T),d+T>M&&(y=M-T),M-S<this.height&&(p=Math.max(p,this.height/(M-S)),y=(M+S)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){const A=this.worldMinX*this.scale,C=this.worldMaxX*this.scale,L=this.worldSize/2-(A+C)/2;m=(c+L+this.worldSize)%this.worldSize-L,m-x<A&&(m=A+x),m+x>C&&(m=C-x),C-A<this.width&&(p=Math.max(p,this.width/(C-A)),m=(C+A)/2)}m===c&&y===d||this._allowWorldUnderZoom||(this.center=this.unproject(new s.P(m,y))),p&&!this._allowWorldUnderZoom&&(this.zoom+=this.scaleZoom(p)),this._constrainCamera(),this._unmodified=o,this._constraining=!1}_minZoomForBounds(){let t=Math.max(0,this.scaleZoom(Math.max(0,this.height)/(this.worldMaxY-this.worldMinY)));return this.maxBounds&&(t=Math.max(t,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),t}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}
9_calcMatrices(){if(!this.height)return;const t=this.centerOffset,o=this.projection.name==="globe",c=this.pixelsPerMeter;this.projection.name==="globe"&&(this._mercatorScaleRatio=s.cf(1,this.center.lat)/s.cf(1,s.d2));const d=s.cO(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,d),this.cameraToCenterDistance=.5/Math.tan(.5*this._fov)*this.height*this._pixelsPerMercatorPixel,this._updateCameraState(),this._farZ=this.projection.farthestPixelDistance(this),this._nearZ=this.height/50;const p=this.projection.zAxisUnit==="meters"?c:1,m=this._camera.getWorldToCamera(this.worldSize,p);let y;const x=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);if(x[8]=2*-t.x/this.width,x[9]=2*t.y/this.height,this.isOrthographic){let Z=.5*this.height/Math.tan(this._fov/2)*1*Math.tan(.5*this._fov),ne=Z*this.aspect,ce=-ne,de=-Z;ne-=t.x,ce-=t.x,Z+=t.y,de+=t.y,y=this._camera.getCameraToClipOrthographic(ce,ne,de,Z,this._nearZ,this._farZ),((ve,ge,Me,Fe)=>{for(let pe=0;pe<16;pe++)ve[pe]=s.ak(ge[pe],Me[pe],Fe)})(y,y,x,s.d0(this.pitch>=go?1:this.pitch/go))}else y=x;const T=s.cP([],x,m);let S=s.cP([],y,m);if(this.projection.isReprojectedInTileSpace){const Z=this.locationCoordinate(this.center),ne=s.bA([]);s.br(ne,ne,[Z.x*this.worldSize,Z.y*this.worldSize,0]),s.aB(ne,ne,s.cQ(this)),s.br(ne,ne,[-Z.x*this.worldSize,-Z.y*this.worldSize,0]),s.aB(S,S,ne),s.aB(T,T,ne),this.inverseAdjustmentMatrix=s.cR(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=s.cS([],S,[this.worldSize,this.worldSize,this.worldSize/p,1]),this.projMatrix=S,this.invProjMatrix=s.bl(new Float64Array(16),this.projMatrix),o){const Z=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);Z[8]=2*-t.x/this.width,Z[9]=2*t.y/this.height,this.expandedFarZProjMatrix=s.cP([],Z,m)}else this.expandedFarZProjMatrix=this.projMatrix;const M=s.bl([],y);this.frustumCorners=s.cT.fromInvProjectionMatrix(M,this.horizonLineFromTop(),this.height),this.cameraFrustum=s.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!o);const A=new Float32Array(16);s.bA(A),s.cS(A,A,[1,-1,1]),s.cU(A,A,this._pitch),s.bB(A,A,this.angle);const C=s.cd(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=s.bz(C);const L=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;C[8]=2*-t.x/this.width,C[9]=2*(t.y+L)/this.height,this.skyboxMatrix=s.aB(A,C,A);const z=this.point,O=z.x,N=z.y,q=this.width%2/2,G=this.height%2/2,j=Math.cos(this.angle),ie=Math.sin(this.angle),Q=O-Math.round(O)+j*q+ie*G,te=N-Math.round(N)+j*G+ie*q,X=new Float64Array(S);if(s.br(X,X,[Q>.5?Q-1:Q,te>.5?te-1:te,0]),this.alignedProjMatrix=X,S=s.bC(),s.cS(S,S,[this.width/2,-this.height/2,1]),s.br(S,S,[1,-1,0]),this.labelPlaneMatrix=S,S=s.bC(),s.cS(S,S,[1,-1,1]),s.br(S,S,[-1,-1,0]),s.cS(S,S,[2/this.width,2/this.height,1]),this.glCoordMatrix=S,this.pixelMatrix=s.aB(new Float64Array(16),this.labelPlaneMatrix,T),this._calcFogMatrices(),this._distanceTileDataCache={},S=s.bl(new Float64Array(16),this.pixelMatrix),!S)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=S,this.projection.name==="globe"||this.mercatorFromTransition){this.globeMatrix=s.cV(this);const Z=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=s.af(Z,Z,m),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=S;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const t=this.cameraWorldSizeForFog,o=this.cameraPixelsPerMeter,c=this._camera.position,d=1/this.height/this._pixelsPerMercatorPixel,p=[t,t,o];s.c5(p,p,d),s.c5(c,c,-1),s.cW(c,c,p);const m=s.bC();s.br(m,m,c),s.cS(m,m,p),this.mercatorFogMatrix=m,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(t,o,d)}_computeCameraPosition(t){const o=(t=t||this.pixelsPerMeter)/this.pixelsPerMeter,c=this._camera.forward(),d=this.point,p=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*o-t/this.worldSize*this._centerAltitude;return[d.x/this.worldSize-c[0]*p,d.y/this.worldSize-c[1]*p,t/this.worldSize*this._centerAltitude-c[2]*p]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(t){const o=this._maxCameraBoundsDistance()*Math.cos(this._pitch),c=this._camera.position[2],d=t[2];let p=1;this.projection.wrap&&(this.center=this.center.wrap()),d>0&&(p=Math.min((o-c)/d,1)),this._camera.position=s.bH([],this._camera.position,t,p),this._updateStateFromCamera()}_updateStateFromCamera(){const t=this._camera.position,o=this._camera.forward(),{pitch:c,bearing:d}=this._camera.getPitchBearing(),p=s.cf(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,m=this._mercatorZfromZoom(this._maxZoom)*Math.cos(s.an(this._maxPitch)),y=Math.max((t[2]-p)/Math.cos(c),m),x=this._zoomFromMercatorZ(y);s.bH(t,t,o,y),this._pitch=s.aA(c,s.an(this.minPitch),s.an(this.maxPitch)),this.angle=s.bT(d,-Math.PI,Math.PI),this._setZoom(s.aA(x,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new s.ae(t[0],t[1],t[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(t){return Math.pow(2,t)*this.tileSize}_mercatorZfromZoom(t){return this.cameraToCenterDistance/this._worldSizeFromZoom(t)}_minimumHeightOverTerrain(){const t=Math.min(this._seaLevelZoom!=null?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(t)}_zoomFromMercatorZ(t){return this.scaleZoom(this.cameraToCenterDistance/(Math.max(0,t)*this.tileSize))}
9zoomFromMercatorZAdjusted(t){let o=0,c=s.cL,d=0,p=1/0;for(;c-o>1e-6&&c>o;){const m=o+.5*(c-o),y=this.tileSize*Math.pow(2,m),x=this.getCameraToCenterDistance(this.projection,m,y),T=this.scaleZoom(x/(Math.max(0,t)*this.tileSize)),S=Math.abs(m-T);S<p&&(p=S,d=m),m<T?o=m:c=m}return d}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(s.w("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(t,o){const c=Math.min(t.x,o.x),d=Math.max(t.x,o.x),p=Math.min(t.y,o.y),m=Math.max(t.y,o.y);if(p<this.horizonLineFromTop(!1))return!0;if(this.projection.name!=="mercator")return!1;const y=[new s.P(c,p),new s.P(d,m),new s.P(c,m),new s.P(d,p)],x=this.renderWorldCopies?-3:0,T=this.renderWorldCopies?4:1;for(const S of y){const M=this.pointRayIntersection(S);if(M.t<0)return!0;const A=this.rayIntersectionCoordinate(M);if(A.x<x||A.y<0||A.x>T||A.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+s.cX(this.fovAboveCenter)>88||this.anyCornerOffEdge(new s.P(0,0),new s.P(this.width,this.height))}zoomDeltaToMovement(t,o){const c=s.ag(s.av([],this._camera.position,t)),d=this._zoomFromMercatorZ(c)+o;return c-this._mercatorZfromZoom(d)}getCameraPoint(){if(this.projection.name==="globe"){const t=(function([o,c,d],p){const m=[o,c,d,1];s.aC(m,m,p);const y=m[3]=Math.max(m[3],1e-6);return m[0]/=y,m[1]/=y,m[2]/=y,m})([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new s.P(t[0],t[1])}{const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new s.P(0,t))}}getCameraToCenterDistance(t,o=this.zoom,c=this.worldSize){const d=s.cO(t,o,this.width,this.height,1024),p=t.pixelSpaceConversion(this.center.lat,c,d);let m=.5/Math.tan(.5*this._fov)*this.height*p;return this.isOrthographic&&(m=s.ak(1,m,s.d0(this.pitch>=go?1:this.pitch/go))),m}getWorldToCameraMatrix(){const t=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?this.pixelsPerMeter:1);return this.projection.name==="globe"&&s.aB(t,t,this.globeMatrix),t}getFrustum(t){return s.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,t,this.projection.zAxisUnit==="meters")}}const Wn=(l,t)=>{if(t>0&&l.terrain&&s.w("Cutoff is currently disabled on terrain"),t<=0||l.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const o=l.transform,c=Math.max(Math.abs(o._zoom-(l.minCutoffZoom-1)),1),d=o.isLODDisabled(!1)?s.ah(60,45,o.pitch):s.ah(30,15,o.pitch),p=o._farZ-o._nearZ,m=t*o.height,y=((1-(x=d))*o.cameraToCenterDistance+x*(o._farZ+m))*c;var x;return{shouldRenderCutoff:d<1,uniformValues:{u_cutoff_params:[o._nearZ,o._farZ,(y-o._nearZ)/p,(y-m-o._nearZ)/p]}}},ds=2048;class Sm{constructor(t,o){this.aabb=t,this.lastCascade=o}}class xl{add(t,o){const c=this.receivers[t.key];c!==void 0?(c.aabb.min[0]=Math.min(c.aabb.min[0],o.min[0]),c.aabb.min[1]=Math.min(c.aabb.min[1],o.min[1]),c.aabb.min[2]=Math.min(c.aabb.min[2],o.min[2]),c.aabb.max[0]=Math.max(c.aabb.max[0],o.max[0]),c.aabb.max[1]=Math.max(c.aabb.max[1],o.max[1]),c.aabb.max[2]=Math.max(c.aabb.max[2],o.max[2])):this.receivers[t.key]=new Sm(o,null)}clear(){this.receivers={}}get(t){return this.receivers[t.key]}computeRequiredCascades(t,o,c){const d=s.d9.fromPoints(t.points);let p=0;for(const m in this.receivers){const y=this.receivers[m];if(!y||!d.intersectsAabb(y.aabb))continue;y.aabb.min=d.closestPoint(y.aabb.min),y.aabb.max=d.closestPoint(y.aabb.max);const x=y.aabb.getCorners();for(let T=0;T<c.length;T++){let S=!0;for(const M of x){const A=[M[0]*o,M[1]*o,M[2]];if(s.af(A,A,c[T].matrix),A[0]<-1||A[0]>1||A[1]<-1||A[1]>1){S=!1;break}}if(y.lastCascade=T,p=Math.max(p,T),S)break}}return p+1}}class vl{constructor(t){this.painter=t,this._enabled=!1,this._drawShadowAfterLayer=-1,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new xl,this._depthMode=new ut(t.context.gl.LEQUAL,ut.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this.useNormalOffset=!1}destroy(){for(const t of this._cascades)t.texture.destroy(),t.framebuffer.destroy();this._cascades=[]}updateShadowParameters(t,o){const c=this.painter;if(this._enabled=!1,this._drawShadowAfterLayer=-1,this._receivers.clear(),!o||!o.properties)return;const d=o.properties.get("shadow-intensity"),p=o.properties.get("shadow-draw-before-layer");if(!o.shadowsEnabled()||d<=0)return;let m=-1,y=0;for(const N of c.style.order){const q=c.style._mergedLayers[N];q.hasShadowPass()&&!q.isHidden(t.zoom)&&(m=y),p&&p===N&&(this._drawShadowAfterLayer=y>0?y-1:0),y+=1}if(this._enabled=m>=0,!this.enabled)return;this._drawShadowAfterLayer<0&&(this._drawShadowAfterLayer=m);const x=c.context,T=ds,S=ds;if(this._cascades.length===0||ds!==this._cascades[0].texture.size[0]){this._cascades=[];for(let N=0;N<2;++N){const q=c._shadowMapDebug,G=x.gl,j=x.createFramebuffer(T,S,q?1:0,"texture"),ie=new s.T(x,{width:T,height:S,data:null},G.DEPTH_COMPONENT16);if(j.depthAttachment.set(ie.texture),q){const Q=new s.T(x,{width:T,height:S,data:null},G.RGBA8);j.colorAttachment0.set(Q.texture)}this._cascades.push({framebuffer:j,texture:ie,matrix:[],far:0,boundingSphereRadius:0,frustum:new s.cB,scale:0})}}this.shadowDirection=af(o);let M=0;if(t.elevation){const N=t.elevation,q=[1e4,-1e4];N.visibleDemTiles.filter(G=>G.dem).forEach(G=>{const j=G.dem.tree;q[0]=Math.min(q[0],j.minimums[0]),q[1]=Math.max(q[1],j.maximums[0])}),q[0]!==1e4&&(M=(q[1]-q[0])*N.exaggeration())}const A=1.5*t.cameraToCenterDistance,C=3*A,L=new Float64Array(16);for(let N=0;N<this._cascades.length;++N){const q=this._cascades[N];let G=t.height/50,j=1;N===0?j=A:(G=A,j=C);const[ie,Q]=lf(t,this.shadowDirection,G,j,ds,M);q.scale=t.scale,q.matrix=ie,q.boundingSphereRadius=Q,s.bl(L,q.matrix),q.frustum=s.cB.fromInvProjectionMatrix(L,1,0,!0),q.far=j}const z=this._cascades.length-1;this._uniformValues.u_fade_range=[.75*this._cascades[z].far,this._cascades[z].far],this._uniformValues.u_shadow_intensity=d,this._uniformValues.u_shadow_direction=[this.shadowDirection[0],this.shadowDirection[1],this.shadowDirection[2]],this._uniformValues.u_shadow_texel_size=.00048828125,this._uniformValues.u_shadow_map_resolution=ds,this._uniformValues.u_shadowmap_0=11,this._uniformValues.u_shadowmap_1=12,this._groundShadowTiles=c.transform.coveringTiles({tileSize:512,renderWorldCopies:!0});const O=c.transform.elevation;for(const N of this._groundShadowTiles){let q={min:0,max:0};if(O){const G=O.getMinMaxForTile(N);G&&(q=G)}this.addShadowReceiver(N.toUnwrapped(),q.min,q.max)}}get enabled(){return this._enabled&&!this._forceDisable}set enabled(t){this._enabled=t}drawShadowPass(t,o){if(!this.enabled)return;const c=this.painter,d=c.context;this._numCascadesToRender=this._receivers.computeRequiredCascades(c.transform.getFrustum(0),c.transform.worldSize,this._cascades),d.viewport.set([0,0,ds,ds]);for(let p=0;p<this._numCascadesToRender;++p){c.currentShadowCascade=p,d.bindFramebuffer.set(this._cascades[p].framebuffer.framebuffer),d.clear({color:s.ao.white,depth:1});for(const m of t.order){const y=t._mergedLayers[m];if(!y.hasShadowPass()||y.isHidden(c.transform.zoom))continue;const x=t.getLayerSourceCache(y),T=x?o[x.id]:void 0;(y.type==="model"||T&&T.length)&&c.renderLayer(c,x,y,T)}}c.currentShadowCascade=0}drawGroundShadows(){if(!this.enabled)return;const t=this.painter,o=t.style,c=t.context,d=c.gl,p=o.directionalLight,m=o.ambientLight;if(!p||!m)return;const y=[],x=Wn(t,t.longestCutoffRange);x.shouldRenderCutoff&&y.push("RENDER_CUTOFF"),y.push("RENDER_SHADOWS","DEPTH_TEXTURE"),this.useNormalOffset&&y.push("NORMAL_OFFSET");const T=Xn(o,p,m),S=new ut(d.LEQUAL,ut.ReadOnly,t.depthRangeFor3D),M=new vt({func:d.EQUAL,mask:255},0,255,d.KEEP,d.KEEP,d.KEEP);for(const A of this._groundShadowTiles){const C=A.toUnwrapped(),L=t.isTileAffectedByFog(A),z=t.getOrCreateProgram("groundShadow",{defines:y,overrideFog:L});this.setupShadows(C,z),t.uploadCommonUniforms(c,z,C,null,x);const O=fn(t.transform.calculateProjMatrix(C),T);z.draw(t,d.TRIANGLES,S,M,Et.multiply,gt.disabled,O,"ground_shadow",t.tileExtentBuffer,t.quadTriangleIndexBuffer,t.tileExtentSegments,null,t.transform.zoom,null,null)}}getShadowPassColorMode(){return this.painter._shadowMapDebug?Et.unblended:Et.disabled}getShadowPassDepthMode(){return this._depthMode}getGroundShadowLayerIndex(){return this._drawShadowAfterLayer}calculateShadowPassMatrixFromTile(t){const o=this.painter.transform,c=o.calculatePosMatrix(t,o.worldSize);return s.aB(c,this._cascades[this.painter.currentShadowCascade].matrix,c),Float32Array.from(c)}
9calculateShadowPassMatrixFromMatrix(t){const o=s.bz(t);return s.aB(o,this._cascades[this.painter.currentShadowCascade].matrix,t),o}setupShadows(t,o,c){if(!this.enabled)return;const d=this.painter.transform,p=this.painter.context,m=p.gl,y=this._uniformValues,x=new Float64Array(16),T=d.calculatePosMatrix(t,d.worldSize);for(let S=0;S<this._cascades.length;S++)s.aB(x,this._cascades[S].matrix,T),y[S===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(x),p.activeTexture.set(m.TEXTURE0+11+S),this._cascades[S].texture.bindExtraParam(m.LINEAR,m.LINEAR,m.CLAMP_TO_EDGE,m.CLAMP_TO_EDGE,m.GREATER);if(this.useNormalOffset=!!c,this.useNormalOffset){const S=s.d7(t.canonical),M=2/d.tileSize*s.al/ds,A=M*this._cascades[0].boundingSphereRadius,C=M*this._cascades[this._cascades.length-1].boundingSphereRadius,L=(c==="vector-tile"?1:3)*(function(z){const O=s.aA((z-22)/-22,0,1);return .125*(1-O)+4*O})(d.zoom);y.u_shadow_normal_offset=[S,A*L,C*L],y.u_shadow_bias=[1e-4,.0012,.012]}else y.u_shadow_bias=[36e-5,.0012,.012];o.setShadowUniformValues(p,y)}setupShadowsFromMatrix(t,o,c=!1){if(!this.enabled)return;const d=this.painter.context,p=d.gl,m=this._uniformValues,y=new Float64Array(16);for(let x=0;x<2;x++)s.aB(y,this._cascades[x].matrix,t),m[x===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(y),d.activeTexture.set(p.TEXTURE0+11+x),this._cascades[x].texture.bindExtraParam(p.LINEAR,p.LINEAR,p.CLAMP_TO_EDGE,p.CLAMP_TO_EDGE,p.GREATER);this.useNormalOffset=c,c?(m.u_shadow_normal_offset=[1,3,3],m.u_shadow_bias=[6e-5,.0012,.012]):m.u_shadow_bias=[36e-5,.0012,.012],o.setShadowUniformValues(d,m)}getShadowUniformValues(){return this._uniformValues}getCurrentCascadeFrustum(){return this._cascades[this.painter.currentShadowCascade].frustum}computeSimplifiedTileShadowVolume(t,o,c,d){if(d[2]>=0)return{};const p=(function(x,T,S){const M=S/(1<<x.canonical.z);return new s.d9([x.canonical.x*M+x.wrap*S,x.canonical.y*M+x.wrap*S,0],[(x.canonical.x+1)*M+x.wrap*S,(x.canonical.y+1)*M+x.wrap*S,T])})(t,o,c).getCorners(),m=o/-d[2];d[0]<0?(s.d8(p[0],p[0],[d[0]*m,0,0]),s.d8(p[3],p[3],[d[0]*m,0,0])):d[0]>0&&(s.d8(p[1],p[1],[d[0]*m,0,0]),s.d8(p[2],p[2],[d[0]*m,0,0])),d[1]<0?(s.d8(p[0],p[0],[0,d[1]*m,0]),s.d8(p[1],p[1],[0,d[1]*m,0])):d[1]>0&&(s.d8(p[2],p[2],[0,d[1]*m,0]),s.d8(p[3],p[3],[0,d[1]*m,0]));const y={};return y.vertices=p,y.planes=[wc(p[1],p[0],p[4]),wc(p[2],p[1],p[5]),wc(p[3],p[2],p[6]),wc(p[0],p[3],p[7])],y}addShadowReceiver(t,o,c){this._receivers.add(t,s.d9.fromTileIdAndHeight(t,o,c))}getMaxCascadeForTile(t){const o=this._receivers.get(t);return o&&o.lastCascade?o.lastCascade:0}}function wc(l,t,o){const c=s.av([],o,t),d=s.av([],l,t),p=s.bI([],c,d),m=s.ag(p);return m===0?[0,0,1,0]:(s.c5(p,p,1/m),[p[0],p[1],p[2],-s.bJ(p,t)])}function af(l){const t=l.properties.get("direction"),o=s.d4(t.x,t.y,t.z);o[2]=s.aA(o[2],0,75);const c=s.d6([o[0],o[1],o[2]]);return s.d5(c.x,c.y,c.z)}function Xn(l,t,o){const c=t.properties.get("color-use-theme")==="none",d=t.properties.get("color"),p=t.properties.get("intensity"),m=t.properties.get("direction"),y=[m.x,m.y,m.z],x=o.properties.get("color-use-theme")==="none",T=o.properties.get("color"),S=o.properties.get("intensity"),M=Math.max(s.bJ([0,0,1],y),0),A=[0,0,0];s.c5(A,T.toPremultipliedRenderColor(x?null:l.getLut(t.scope)).toArray01Linear().slice(0,3),S);const C=[0,0,0];return s.c5(C,d.toPremultipliedRenderColor(c?null:l.getLut(o.scope)).toArray01Linear().slice(0,3),M*p),s.db([A[0]>0?A[0]/(A[0]+C[0]):0,A[1]>0?A[1]/(A[1]+C[1]):0,A[2]>0?A[2]/(A[2]+C[2]):0])}function lf(l,t,o,c,d,p){const m=l.zoom,y=l.scale,x=l.worldSize,T=1/x,S=l.aspect,M=Math.sqrt(1+S*S)*Math.tan(.5*l.fovX),A=M*M,C=c-o,L=c+o;let z,O;A>C/L?(z=c,O=c*M):(z=.5*L*(1+A),O=.5*Math.sqrt(C*C+2*(c*c+o*o)*A+L*L*A*A));const N=l.projection.pixelsPerMeter(l.center.lat,x),q=l._camera.getCameraToWorldMercator(),G=[0,0,-z*T];s.af(G,G,q);let j=O*T;const ie=function(ke){return ke[0]/=y,ke[1]/=y,ke[2]=s.cf(ke[2],l._center.lat),ke},Q=l._edgeInsets;if(!(Q.left===0&&Q.top===0&&Q.right===0&&Q.bottom===0||Q.left===Q.right&&Q.top===Q.bottom)){const ke=l._camera.getWorldToCamera(l.worldSize,l.projection.zAxisUnit==="meters"?N:1),Ue=l._camera.getCameraToClipPerspective(l._fov,l.width/l.height,o,c);Ue[8]=2*-l.centerOffset.x/l.width,Ue[9]=2*l.centerOffset.y/l.height;const Ke=new Float64Array(16);
9s.cP(Ke,Ue,ke);const je=new Float64Array(16);s.bl(je,Ke);const He=s.cB.fromInvProjectionMatrix(je,x,m,!0);for(const lt of He.points){const st=ie(lt);j=Math.max(j,s.c6(s.da([],G,st)))}}j*=d/(d-1);const te=Math.acos(t[2]),X=Math.atan2(-t[0],-t[1]),Z=new ba;Z.position=G,Z.setPitchBearing(te,X);const ne=Z.getWorldToCamera(x,N),ce=j*x,de=Math.min(l._mercatorZfromZoom(17)*x*-2,-2*ce),ve=Z.getCameraToClipOrthographic(-ce,ce,-ce,ce,de,(ce+p*N)/t[2]),ge=new Float64Array(16);s.aB(ge,ve,ne);const Me=s.d5(Math.floor(1e6*G[0])/1e6*x,Math.floor(1e6*G[1])/1e6*x,0),Fe=.5*d,pe=[0,0,0];s.af(pe,Me,ge),s.c5(pe,pe,Fe);const oe=[Math.floor(pe[0]),Math.floor(pe[1]),Math.floor(pe[2])],Ie=[0,0,0];s.av(Ie,pe,oe),s.c5(Ie,Ie,-1/Fe);const be=new Float64Array(16);return s.bA(be),s.br(be,be,Ie),s.aB(ge,be,ge),[ge,ce]}class Tc extends s.E{constructor(t){super(),this.requestManager=t,this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}loadModel(t,o){return s.dc(this.requestManager.transformRequest(o,s.R.Model).url).then(c=>{if(!c)return;const d=s.dd(c),p=new s.de(t,o,void 0,void 0,d);return p.computeBoundsAndApplyParent(),p}).catch(c=>{if(c&&c.status===404)return null;this.fire(new s.y(new Error(`Could not load model ${t} from ${o}: ${c.message}`)))})}load(t,o,c={forceReload:!1}){this.models[o]||(this.models[o]={});const d=Object.keys(t),p=[],m=[];for(const y of d){const x=t[y];this.hasURLBeenRequested(x)&&!c.forceReload||(this.modelByURL[x]={modelId:y,scope:o},p.push(this.loadModel(y,x)),m.push(y)),this.models[o][y]||(this.models[o][y]={model:null,numReferences:1})}this.numModelsLoading[o]=(this.numModelsLoading[o]||0)+m.length,Promise.allSettled(p).then(y=>{for(let x=0;x<y.length;x++){const{status:T}=y[x];if(T==="rejected")continue;const{value:S}=y[x];this.models[o][m[x]]||(this.models[o][m[x]]={model:null,numReferences:1}),this.models[o][m[x]].model=S}this.numModelsLoading[o]-=m.length,this.fire(new s.z("data",{dataType:"style"}))}).catch(y=>{this.fire(new s.y(new Error(`Could not load models: ${y.message}`)))})}isLoaded(){for(const t in this.numModelsLoading)if(this.numModelsLoading[t]>0)return!1;return!0}hasModel(t,o,c={exactIdMatch:!1}){return!!(c.exactIdMatch?this.getModel(t,o):this.getModelByURL(this.modelUris[o][t]))}getModel(t,o){return this.models[o]||(this.models[o]={}),this.models[o][t]?this.models[o][t].model:void 0}getModelByURL(t){if(!t)return null;const o=this.modelByURL[t];return o?this.models[o.scope][o.modelId].model:null}hasModelBeenAdded(t,o){return this.models[o]&&this.models[o][t]!==void 0}getModelURIs(t){return this.modelUris[t]||{}}addModel(t,o,c){this.models[c]||(this.models[c]={}),this.modelUris[c]||(this.modelUris[c]={});const d=this.requestManager.normalizeModelURL(o);if((this.hasModel(t,c,{exactIdMatch:!0})||this.hasModelBeenAdded(t,c))&&this.modelUris[c][t]===d)this.models[c][t].numReferences++;else if(this.hasURLBeenRequested(d)){const{scope:p,modelId:m}=this.modelByURL[d];this.models[p][m].numReferences++}else this.modelUris[c][t]=d,this.load({[t]:this.modelUris[c][t]},c)}addModelURLs(t,o){this.models[o]||(this.models[o]={}),this.modelUris[o]||(this.modelUris[o]={});const c=this.modelUris[o];for(const d in t)c[d]=this.requestManager.normalizeModelURL(t[d])}reloadModels(t){this.load(this.modelUris[t],t,{forceReload:!0})}addModelsFromBucket(t,o){this.models[o]||(this.models[o]={}),this.modelUris[o]||(this.modelUris[o]={});const c={};for(const d of t)this.hasModel(d,o,{exactIdMatch:!0})||this.hasURLBeenRequested(d)?this.models[o][d].numReferences++:this.modelUris[o][d]&&!this.hasURLBeenRequested(d)?c[d]=this.modelUris[o][d]:!this.hasURLBeenRequested(d)&&s.df(d,!1)&&(this.modelUris[o][d]=this.requestManager.normalizeModelURL(d),c[d]=this.modelUris[o][d]);this.load(c,o)}hasURLBeenRequested(t){return this.modelByURL[t]!==void 0}removeModel(t,o,c=!1,d=!1){if(this.models[o]&&this.models[o][t]&&(this.models[o][t].numReferences--,this.models[o][t].numReferences===0||d)){const p=this.modelUris[o][t];c||delete this.modelUris[o][t],delete this.modelByURL[p];const m=this.models[o][t].model;if(!m)return;delete this.models[o][t],m.destroy()}}destroy(){for(const t of Object.keys(this.models))for(const o of Object.keys(this.models[t])){const c=this.models[t][o].model;delete this.models[t][o],c&&c.destroy()}this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}listModels(t){return this.models[t]||(this.models[t]={}),Object.keys(this.models[t])}upload(t,o){this.models[o]||(this.models[o]={});for(const c in this.models[o])this.models[o][c].model&&this.models[o][c].model.upload(t.context)}}const bl=s.a6.colorTheme,fs=new s.a9({data:new s.aa(bl.data)});function Em(l){if(!l.metadata||!l.metadata.content_area)return;const t=s.o.devicePixelRatio,{left:o,top:c,width:d,height:p}=l.metadata.content_area,m=o*t,y=c*t;return[m,y,m+d*t,y+p*t]}function cf(l){if(l)return l.map(([t,o])=>[t*s.o.devicePixelRatio,o*s.o.devicePixelRatio])}class Im{constructor(t,o,c){this.id=t,this.scope=o,this.sourceCache=c,this.pendingRequests=new Set,this.missingRequests=new Set}addPendingRequest(t){this.missingRequests.has(t.name)||this.pendingRequests.has(t.name)||this.pendingRequests.add(t.name)}hasPendingRequests(){return this.pendingRequests.size>0}resolvePendingRequests(){const t=new Map;if(!this.sourceCache.loaded())return t;const o=this.sourceCache.getVisibleCoordinates();if(o.length===0)return t;const c=this.sourceCache.getSource();if(!(c instanceof Wr))return t;const d=o.map(m=>this.sourceCache.getTile(m)),p=c.getImages(d,Array.from(this.pendingRequests));for(const[m,y]of p)t.set(s.I.from({name:m,iconsetId:this.id}),y),this.pendingRequests.delete(m);for(const m of this.pendingRequests)this.missingRequests.add(m);return this.pendingRequests.clear(),t}}class Wu{constructor(){s.aY(["_onIndoorUpdate"],this)}onAdd(t){return this._map=t,this._container=ni("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._map.style&&this._map.style.indoorManager.on("selector-update",o=>this._onIndoorUpdate(o)),this._container}_createButton(t,o){const c=ni("button",t,this._container);return c.type="button",c.addEventListener("click",o),c}_createSeparator(){return ni("div","mapboxgl-ctrl-separator",this._container)}_setButtonTitle(t,o){this._map&&(t.setAttribute("aria-label",o),t.textContent=o)}onRemove(){this._container&&this._container.remove(),this._map&&this._map.style&&(this._map.style.indoorManager.off("selector-update",this._onIndoorUpdate),this._map=null)}getDefaultPosition(){return"right"}_onIndoorUpdate(t){if(!t||!t.floors)return this._model=t,void(this._container.style.display="none");const o=this._model;this._model=t,this._container.style.display="inline-block",this._container.style.borderRadius="8px",o&&Array.from(this._container.children).forEac
9h(c=>c.remove()),t.floors.length>0&&(this.addBuildingsToggleButton(),this.addCurrentFloors(t.floors,t.activeFloorsVisible),this._updateBuildingsButtonState())}addBuildingsToggleButton(){const t=this._createButton("mapboxgl-ctrl-buildings-toggle",()=>{const o=this._map;this._model&&o&&o._setIndoorActiveFloorsVisibility(!this._model.activeFloorsVisible)});ni("span","mapboxgl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.classList.add("mapboxgl-ctrl-level-button","mapboxgl-ctrl-buildings-toggle"),this._model&&!this._model.activeFloorsVisible&&t.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.append(t),this._createSeparator()}_updateBuildingsButtonState(){const t=this._container.querySelector(".mapboxgl-ctrl-buildings-toggle");t&&this._model&&(this._model.activeFloorsVisible?t.classList.remove("mapboxgl-ctrl-level-button-selected"):t.classList.add("mapboxgl-ctrl-level-button-selected"))}addCurrentFloors(t,o){for(let c=0;c<t.length;c++){const d=t[c],p=this._createButton("mapboxgl-ctrl-level-button",()=>{this._map._selectIndoorFloor(d.id)}),m=(d.name||"").trim(),y=d.zIndex.toString(),x=m?Array.from(m).slice(0,3).join(""):y;this._setButtonTitle(p,x),this._model&&d.id===this._model.selectedFloorId&&o&&p.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.append(p),c<t.length-1&&this._createSeparator()}}}class Am extends s.E{constructor(t){super(),this._style=t,this._buildings={},this._indoorControl=null,this._activeFloors=new Set,this._activeFloorsVisible=!0,this._indoorState={selectedFloorId:null,lastActiveFloors:null,activeFloorsVisible:!0},s.aY(["_updateUI"],this),this._style.on("style.load",()=>{this._style.isIndoorEnabled()&&(this._style.map.on("load",this._updateUI),this._style.map.on("move",this._updateUI),this._style.map.on("idle",this._updateUI),this._updateUI())})}destroy(){this._buildings={},this._activeFloors=new Set,this._indoorState=null,this._removeIndoorControl()}selectFloor(t){t===this._selectedFloorId&&this._activeFloorsVisible||(this._selectedFloorId=t,this._activeFloorsVisible=!0,this._updateActiveFloors())}setActiveFloorsVisibility(t){this._activeFloorsVisible=t,this._updateActiveFloors(),this._updateIndoorSelector()}setIndoorData(t){for(const[o,c]of Object.entries(t.buildings))if(this._buildings[o])for(const d of c.floorIds)this._buildings[o].floors[d]||(this._buildings[o].floors[d]=c.floors[d]);else this._buildings[o]=c;for(const o of t.activeFloors)this._activeFloors.add(o);this._updateIndoorSelector()}getIndoorTileOptions(t,o){const c=this._style.getIndoorSourceLayers(t,o);return c&&this._indoorState?{sourceLayers:c,indoorState:this._indoorState}:null}_addIndoorControl(){this._indoorControl||(this._indoorControl=new Wu,this._style.map.addControl(this._indoorControl,"right"))}_removeIndoorControl(){this._indoorControl&&(this._indoorControl.onRemove(),this._indoorControl=null)}_updateUI(){const t=this._style.map.transform,o=(function(c,d,p,m){let y=null,x=Number.MAX_SAFE_INTEGER;if(m<16)return null;for(const[T,S]of Object.entries(c)){const M=S.center;if(M){const A=d.distanceTo(s.aT.convert(M));A<x&&p.contains(M)&&(x=A,y=T)}}return y})(this._buildings,t.center,t.getBounds(),t.zoom);o!==this._closestBuildingId&&(this._closestBuildingId=o,this._updateIndoorSelector())}_updateIndoorSelector(){const t=this._buildings,o=this._closestBuildingId,c=o&&t?t[o]:void 0;if(!c)return this._removeIndoorControl(),void this.fire(new s.z("selector-update",{selectedFloorId:null,activeFloorsVisible:this._activeFloorsVisible,floors:[]}));this._addIndoorControl();let d=null;for(const m of c.floorIds)if(this._activeFloors&&this._activeFloors.has(m)){d=m;break}const p=Array.from(c.floorIds).map(m=>({id:m,name:c.floors[m].name,zIndex:c.floors[m].zIndex})).sort((m,y)=>y.zIndex-m.zIndex).filter((m,y,x)=>y===0||m.zIndex!==x[y-1].zIndex);this.fire(new s.z("selector-update",{selectedFloorId:d,activeFloorsVisible:this._activeFloorsVisible,floors:p}))}_updateActiveFloors(){const t=this._activeFloors;this._activeFloors=new Set,this._indoorState={selectedFloorId:this._selectedFloorId,lastActiveFloors:t,activeFloorsVisible:this._activeFloorsVisible},this._style.updateIndoorDependentLayers()}}const Go=(l,t)=>le(l,t&&t.filter(o=>o.identifier!=="source.canvas")),uf=s.aH(Xt,["addLayer","removeLayer","setLights","setPaintProperty","setLayoutProperty","setLayerProperty","setSlot","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setSnow","setRain","setProjection","setCamera","addImport","removeImport","updateImport","addIconset","removeIconset"]),hf=s.aH(Xt,["setCenter","setZoom","setBearing","setP
9itch"]),Sc=new Set(["background","sky","slot","custom"]),Xu={version:8,layers:[],sources:{}},ps={duration:300,delay:0};class bn extends s.E{constructor(t,o={}){super(),this.map=t,this.scope=o.scope||"",this.globalId=null,this.fragments=[],this.importDepth=o.importDepth||0,this.importsCache=o.importsCache||new Map,this.resolvedImports=o.resolvedImports||new Set,this.transition=Object.assign({},ps),this._buildingIndex=new dl(this),this.crossTileSymbolIndex=new ur,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers={},this._mergedIndoor={},this._mergedSourceCaches={},this._mergedOtherSourceCaches={},this._mergedSymbolSourceCaches={},this._clipLayerPresent=!1,this._hasAppearances=!1,this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._importedAsBasemap=!1,this._changes=o.styleChanges||new tr,this._hasDataDrivenEmissive=!1,this.indoorManager=new Am(this),this.dispatcher=o.dispatcher?o.dispatcher:new s.D(s.dh(),this),o.imageManager?this.imageManager=o.imageManager:(this.imageManager=new is(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.addScope(this.scope),this.glyphManager=o.glyphManager?o.glyphManager:new s.di(t._requestManager,o.localFontFamily?s.dj.all:o.localIdeographFontFamily?s.dj.ideographs:s.dj.none,o.localFontFamily||o.localIdeographFontFamily),o.modelManager?this.modelManager=o.modelManager:(this.modelManager=new Tc(t._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._precompileDone=!1,this._shouldPrecompile=!1,this._availableImages=[],this._availableModels={},this._order=[],this._markersNeedUpdate=!1,this.options=o.configOptions?o.configOptions:new Map,this._configDependentLayers=o.configDependentLayers?o.configDependentLayers:new Set,this._indoorDependentLayers=o.indoorDependentLayers?o.indoorDependentLayers:new Set,this._config=o.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:o.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=o.initialConfig,this.dispatcher.broadcast("setReferrer",s.dk());const c=this;this._rtlTextPluginCallback=bn.registerForPluginStateChange(d=>{c.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:d.pluginStatus,pluginURL:d.pluginURL},(p,m)=>{if(s.dl(p),m&&m.every(y=>y))for(const y in c._sourceCaches){const x=c._sourceCaches[y],T=x.getSource().type;T!=="vector"&&T!=="geojson"||x.reload()}})}),this.on("data",d=>{if(d.dataType!=="source"||d.sourceDataType!=="metadata")return;const p=this.getOwnSource(d.sourceId);if(p&&p.vectorLayerIds)for(const m in this._layers){const y=this._layers[m];y.source===p.id&&this._validateLayer(y)}})}load(t){return t?(typeof t=="string"?this.loadURL(t):this.loadJSON(t),this):this}_getGlobalId(t){if(!t)return null;if(typeof t=="string"){if(s.h(t))return t;const o=s.dm(t);if(!o.startsWith("http"))try{return new URL(o,location.href).toString()}catch{return o}return o}return`json://${s.dn(JSON.stringify(t))}`}_diffStyle(t,o,c){this.globalId=this._getGlobalId(t);const d=(p,m)=>{try{m(null,this.setState(p,c))}catch(y){m(y,!1)}};if(typeof t=="string"){const p=this.map._requestManager.normalizeStyleURL(t),m=this.map._requestManager.transformRequest(p,s.R.Style);s.m(m,(y,x)=>{y?this.fire(new s.y(y)):x&&d(x,o)})}else typeof t=="object"&&d(t,o)}loadURL(t,o={}){this.fire(new s.z("dataloading",{dataType:"style"}));const c=typeof o.validate=="boolean"?o.validate:!s.h(t);this.globalId=this._getGlobalId(t),t=this.map._requestManager.normalizeStyleURL(t,o.accessToken),this.resolvedImports.add(t);const d=this.importsCache.get(t);if(d)return this._load(d,c);const p=this.map._requestManager.transformRequest(t,s.R.Style);this._request=s.m(p,(m,y)=>{if(this._request=null,m)this.fire(new s.y(m));else if(y)return this.importsCache.set(t,y),this._load(y,c)})}loadJSON(t,o={}){this.fire(new s.z("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(t),this._request=s.o.frame(()=>{this._request=null,this._load(t,o.validate!==!1)})}loadEmpty(){this.fire(new s.z("dataloading",{dataType:"style"})),this._load(Xu,!1)}_loadImports(t,o,c){if(this.importDepth>=4)return s.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const d=[];for(const p of t){const m=this._createFragmentStyle(p),y=new Promise(S=>{m.once("style.import.load",S),m.once("error",S)}).then(()=>this.mergeAll());if(d.push(y),this.resolvedImports.has(p.url)){m.loadEmpty();continue}const x=p.data||this.importsCache.get(p.url);x?(m.loadJSON(x,{validate:o}),this._isInternalStyle(x)&&(m.globalId=null)):p.url?m.loadURL(p.url,{validate:o}):m.loadEmpty();const T={style:m,id:p.id,config:p.config};if(c){const S=this.fragments.findIndex(({id:M})=>M===c);
9this.fragments=this.fragments.slice(0,S).concat(T).concat(this.fragments.slice(S))}else this.fragments.push(T)}return Promise.allSettled(d)}getImportGlobalIds(t=this,o=new Set){for(const c of t.fragments)c.style.globalId&&o.add(c.style.globalId),this.getImportGlobalIds(c.style,o);return[...o.values()]}_createFragmentStyle(t){const o=this.scope?s.B(t.id,this.scope):t.id;let c;const d=this._initialConfig&&this._initialConfig[o];(t.config||d)&&(c=Object.assign({},t.config,d));const p=new bn(this.map,{scope:o,styleChanges:this._changes,importDepth:this.importDepth+1,importsCache:this.importsCache,resolvedImports:new Set(this.resolvedImports),dispatcher:this.dispatcher,imageManager:this.imageManager,glyphManager:this.glyphManager,modelManager:this.modelManager,config:c,configOptions:this.options,colorThemeOverride:t["color-theme"],configDependentLayers:this._configDependentLayers,indoorDependentLayers:this._indoorDependentLayers});return p.setEventedParent(this.map,{style:p}),p}_reloadImports(){this.mergeAll(),this._updateMapProjection(),this.updateConfigDependencies(),this._updateLayers(this._indoorDependentLayers),this.map._triggerCameraUpdate(this.camera),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),this._shouldPrecompile=this.map._precompilePrograms&&this.isRootStyle()}_isInternalStyle(t){return this.isRootStyle()&&(t.fragment||!!t.schema&&t.fragment!==!1)}_load(t,o){if(this._isInternalStyle(t)){const p=Object.assign({},Xu,{imports:[{id:"basemap",data:t,url:""}]},t.center?{center:t.center}:{},t.bearing?{bearing:t.bearing}:{},t.pitch?{pitch:t.pitch}:{},t.zoom?{zoom:t.zoom}:{},t.light?{light:t.light}:{});return this._importedAsBasemap=!0,void this._load(p,o)}if(this.updateConfig(this._config,t.schema),o&&Go(this,Pn(t)))return;this._loaded=!0,this.stylesheet=s.dp(t);const c=()=>{for(const x in t.sources)this.addSource(x,t.sources[x],{validate:!1,isInitialLoad:!0});if(t.iconsets)for(const x in t.iconsets)this.addIconset(x,t.iconsets[x]);t.sprite?this._loadIconset(t.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),!this.glyphManager.url&&t.glyphs&&this.glyphManager.setURL(t.glyphs);const p=Nu(this.stylesheet.layers);if(this._order=p.map(x=>x.id),this.stylesheet.light&&s.w("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights)if(this.stylesheet.lights.length===1&&this.stylesheet.lights[0].type==="flat"){const x=this.stylesheet.lights[0];this.light=new Te(x.properties,x.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new Te(this.stylesheet.light)),this._layers={};for(const x of p){const T=s.du(x,this.scope,this._styleColorTheme.lut,this.options);T.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(T.fqid),T.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(T.fqid),this._hasAppearances=this._hasAppearances||T.getAppearances().length!==0,T.setEventedParent(this,{layer:{id:T.id}}),this._layers[T.id]=T;const S=this.getOwnLayerSourceCache(T),M=!!this.directionalLight&&this.directionalLight.shadowsEnabled();S&&T.canCastShadows()&&M&&(S.castsShadows=!0)}this.stylesheet.featuresets&&this.setFeaturesetSelectors(this.stylesheet.featuresets),this.stylesheet.models&&this.addModelURLs(this.stylesheet.models);const m=this.stylesheet.terrain;m&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(m,1)),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this.stylesheet.snow&&this._createSnow(this.stylesheet.snow),this.stylesheet.rain&&this._createRain(this.stylesheet.rain),this.stylesheet.transition&&this.setTransition(this.stylesheet.transition),this.fire(new s.z("data",{dataType:"style"}));const y=this.isRootStyle();t.imports?this._loadImports(t.imports,o).then(()=>{this._reloadImports(),this.fire(new s.z(y?"style.load":"style.import.load"))}).catch(x=>{this.fire(new s.y(new Error("Failed to load imports",x))),this.fire(new s.z(y?"style.load":"style.import.load"))}):(this._reloadImports(),this.fire(new s.z(y?"style.load":"style.import.load")))};this._styleColorTheme.colorTheme=this.stylesheet["color-theme"];const d=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(d){const p=this._evaluateColorThemeData(d);this._loadColorTheme(p).then(()=>{c()}).catch(m=>{s.w(`Couldn't load color theme from the stylesheet: ${m}`),c()})}else this._styleColorTheme.lut=null,c()}isRootStyle(){return this.importDepth===0}hasAppearances(){return this._hasAppearances||this.fragments.some(t=>t.style.hasAppearances())}mergeAll(){let t,o,c,d,p,m,y,x,T,S;const M={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(A=>{if(A.stylesheet){if(A.light!=null&&(t=A.light),A.stylesheet.lights)for(const C of A.stylesheet.lights)C.type==="ambient"&&A.ambientLight!=null&&(o=A.ambientLight),C.type==="directional"&&A.directionalLight!=null&&(c=A.directionalLight);d=this._prioritizeTerrain(d,A.terrain,A.stylesheet.terrain),A.stylesheet.fog&&A.fog!=null&&(p=A.fog),A.stylesheet.snow&&A.snow!=null&&(m=A.snow),A.stylesheet.rain&&A.rain!=null&&(y=A.rain),A.stylesheet.camera!=null&&(S=A.stylesheet.camera),A.stylesheet.projection!=null&&(x=A.stylesheet.projection),A.stylesheet.transition!=null&&(T=A.stylesheet.transition),M[A.scope]=A._styleColorTheme}}),this.light=t,this.ambientLight=o,this.directionalLight=c,this.fog=p,this.snow=m,this.rain=y,this._styleColorThemeForScope=M,d===null?delete this.terrain:this.terrain=d,this.camera=S||{"camera-projection":"perspective"},this.projection=x||{name:"mercator"},this.transition=Object.assign({},ps,T),this.mergeSources(),this.mergeLayers(),this.mergeIndoor()}forEachFragmentStyle(t){const o=c=>
9{for(const d of c.fragments)o(d.style);t(c)};o(this)}_prioritizeTerrain(t,o,c){const d=t&&t.drapeRenderMode===0;return c===null?o&&o.drapeRenderMode===0?o:d?t:null:o!=null&&(!t||d||o&&o.drapeRenderMode===1)?o:t}mergeTerrain(){let t;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(o=>{t=this._prioritizeTerrain(t,o.terrain,o.stylesheet.terrain)}),t===null?delete this.terrain:this.terrain=t}mergeProjection(){let t;this.forEachFragmentStyle(o=>{o.stylesheet.projection!=null&&(t=o.stylesheet.projection)}),this.projection=t||{name:"mercator"}}mergeSources(){const t={},o={},c={};this.forEachFragmentStyle(d=>{for(const p in d._sourceCaches){const m=s.B(p,d.scope);t[m]=d._sourceCaches[p]}for(const p in d._otherSourceCaches){const m=s.B(p,d.scope);o[m]=d._otherSourceCaches[p]}for(const p in d._symbolSourceCaches){const m=s.B(p,d.scope);c[m]=d._symbolSourceCaches[p]}}),this._mergedSourceCaches=t,this._mergedOtherSourceCaches=o,this._mergedSymbolSourceCaches=c}mergeIndoor(){this.forEachFragmentStyle(t=>{if(t.stylesheet&&t.stylesheet.indoor)for(const o of Object.values(t.stylesheet.indoor)){const c=o,d=s.B(c.sourceId,t.scope);this._mergedIndoor[d]=new Set(c.sourceLayers||[])}})}mergeLayers(){const t={},o=[],c={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(m=>{for(const y of m._order){const x=m._layers[y];if(x.type==="slot"){const T=s.dq(y);if(t[T])continue;t[T]=[]}x.slot&&t[x.slot]?t[x.slot].push(x):o.push(x)}}),this._mergedOrder=[];let d=-1;const p=(m=[])=>{for(const y of m)if(y.type==="slot"){const x=s.dq(y.id);t[x]&&p(t[x]),this._mergedSlots.push(x)}else{const x=s.B(y.id,y.scope);this._mergedOrder.push(x),c[x]=y,y.is3D(!!this.terrain)&&(this._has3DLayers=!0,d=this._mergedOrder.length-1),y.type==="circle"&&(this._hasCircleLayers=!0),y.type==="symbol"&&(this._hasSymbolLayers=!0),y.type==="clip"&&(this._clipLayerPresent=!0)}};if(p(o),this._has3DLayers){const m={};for(let y=0;y<this._mergedOrder.length;++y){const x=this._mergedOrder[y];m[x]=y===d?1:y<d?c[x].hasOcclusionOpacityProperties?2:0:4}this._mergedOrder.sort((y,x)=>m[y]-m[x])}this._mergedLayers=c,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged(),this._updateDataDrivenEmissiveStrength()}terrainSetForDrapingOnly(){return!!this.terrain&&this.terrain.drapeRenderMode===0}getCamera(){return this.stylesheet.camera}setCamera(t){return this.stylesheet.camera=Object.assign({},this.stylesheet.camera,t),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(t){return t.data?(function(o,c,d){const p=Object.assign({},c);for(const y of Object.keys(bl))p[y]===void 0&&(p[y]=bl[y].default);const m=new s.a8(fs,o,new Map(d));return m.setTransitionOrValue(p,d),m.untransitioned().possiblyEvaluate(new s.ac(0,{worldview:void 0}))})(this.scope,t,this.options).get("data"):null}_loadColorTheme(t){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const o=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((c,d)=>{const p="data:image/png;base64,";if(!t||t.length===0)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void c();let m=t;m.startsWith(p)||(m=p+m);const y=s.I.from("mapbox-reserved-lut"),x=new Image;x.src=m,x.onerror=()=>{this._styleColorTheme.lutLoading=!1,d(new Error("Failed to load image data"))},x.onload=()=>{if(this._styleColorTheme.lutLoadingCorrelationID!==o)return void c();this._styleColorTheme.lutLoading=!1;const{width:T,height:S,data:M}=s.o.getImageData(x);if(S>32)return void d(new Error("The height of the image must be less than or equal to 32 pixels."));if(T!==S*S)return void d(new Error("The width of the image must be equal to the height squared."));this.getImage(y)&&this.removeImage(y),this.addImage(y,{data:new s.q({width:T,height:S},M),pixelRatio:1,sdf:!1,usvg:!1,version:0});const A=this.imageManager.getImage(y,this.scope);A?(this._styleColorTheme.lut={image:A.data,data:t},c()):d(new Error("Missing LUT image."))}})}getLut(t){const o=this._styleColorThemeForScope[t];return o?o.lut:null}setProjection(t){t?this.stylesheet.projection=t:delete this.stylesheet.projection,this.mergeProjection(),this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?(this.getTerrain()||this.stylesheet.terrain)&&!this.disableElevatedTerrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null,0))}_updateMapProjection(){this.isRootStyle()&&(this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.projection))}_loadSprite(t){this._spriteRequest=(function(o,c,d){let p,m,y;const x=s.o.devicePixelRatio>1?"@2x":"";let T=s.m(c.transformRequest(c.normalizeSpriteURL(o,x,".json"),s.R.SpriteJSON),(A,C)=>{T=null,y||(y=A,p=C,M())}),S=s.n(c.transformRequest(c.normalizeSpriteURL(o,x,".png"),s.R.SpriteImage),(A,C)=>{S=null,y||(y=A,m=C,M())});function M(){if(y)d(y);else if(p&&m){const A=s.o.getImageData(m),C={};for(const L in p){const{width:z,height:O,x:N,y:q,sdf:G,pixelRatio:j,stretchX:ie,stretchY:Q,content:te}=p[L],X=new s.q({width:z,height:O});s.q.copy(A,X,{x:N,y:q},{x:0,y:0},{width:z,height:O},null),C[L]={data:X,pixelRatio:j!==void 0?j:1,sdf:G!==void 0&&G,stretchX:ie,stretchY:Q,content:te,usvg:!1,version:0}}d(null,C)}}return{cancel(){T&&(T.cancel(),T=null),S&&(S.cancel(),S=null)}}})(t,this.map._requestManager,(o,c)=>{if(this._spriteRequest=null,o)this.fire(new s.y(o));else if(c){const d=new Map;for(const p in c)d.set(s.I.from(p),c[p]);this.addImages(d)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new s.z("data",{dataType:"style"}))})}
9addIconset(t,o){if(o.type==="sprite")return void this._loadSprite(o.url);const c=this.getOwnSourceCache(o.source);if(!c)return void this.fire(new s.y(new Error(`Source "${o.source}" as specified by iconset "${t}" does not exist and cannot be used as an iconset source`)));const d=c.getSource();if(d.type!=="raster-array")return void this.fire(new s.y(new Error(`Source "${o.source}" as specified by iconset "${t}" is not a "raster-array" source and cannot be used as an iconset source`)));d.partial=!1;const p=new Im(t,this.scope,c);this.imageManager.addImageProvider(p,this.scope)}removeIconset(t){this.imageManager.removeImageProvider(t,this.scope)}_loadIconset(t){if(!s.h(t)&&this.map._spriteFormat!=="icon_set"||this.map._spriteFormat==="raster")return void this._loadSprite(t);const o=this.map._spriteFormat==="auto";var c,d;this._spriteRequest=(d=(p,m)=>{if(this._spriteRequest=null,p)o?this._loadSprite(t):this.fire(new s.y(p));else if(m){const y=new Map;for(const x in m)y.set(s.I.from(x),m[x]);this.addImages(y)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new s.z("data",{dataType:"style"}))},s.bu((c=this.map._requestManager).transformRequest(c.normalizeIconsetURL(t),s.R.Iconset),(p,m)=>{if(p)return void d(p);const y={},x=s.dg(new s.bt(m));for(const T of x.icons){const S={version:1,pixelRatio:s.o.devicePixelRatio,content:Em(T),stretchX:T.metadata?cf(T.metadata.stretch_x_areas):void 0,stretchY:T.metadata?cf(T.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:T};y[T.name]=S}d(null,y)}))}_validateLayer(t){const o=this.getOwnSource(t.source);if(!o)return;const c=t.sourceLayer;c&&(o.type==="geojson"||o.vectorLayerIds&&o.vectorLayerIds.indexOf(c)===-1)&&this.fire(new s.y(new Error(`Source layer "${c}" does not exist on source "${o.id}" as specified by style layer "${t.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(const t in this._sourceCaches)if(!this._sourceCaches[t].loaded())return!1;if(!this.imageManager.isLoaded()||this.imageManager.hasPatternsInFlight()||!this.modelManager.isLoaded()||this._styleColorTheme.lutLoading)return!1;for(const{style:t}of this.fragments)if(!t.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((t,o)=>{const c=this.fragments[o];return c&&c.style&&(t.data=c.style.serialize()),t})}_serializeSources(){const t={};for(const o in this._sourceCaches){const c=this._sourceCaches[o].getSource();t[c.id]||(t[c.id]=c.serialize())}return t}_serializeLayers(t){const o=[];for(const c of t){const d=this._layers[c];d&&d.type!=="custom"&&o.push(d.serialize())}return o}hasLightTransitions(){return!(!this.light||!this.light.hasTransition())||!(!this.ambientLight||!this.ambientLight.hasTransition())||!(!this.directionalLight||!this.directionalLight.hasTransition())}hasFogTransition(){return!!this.fog&&this.fog.hasTransition()}hasSnowTransition(){return!!this.snow&&this.snow.hasTransition()}hasRainTransition(){return!!this.rain&&this.rain.hasTransition()}hasTransitions(){if(this.hasLightTransitions()||this.hasFogTransition()||this.hasSnowTransition()||this.hasRainTransition())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}_updateDataDrivenEmissiveStrength(){for(const t in this._mergedLayers){const o=this._mergedLayers[t];if(o._transitionablePaint&&o._transitionablePaint._values){const c=o._transitionablePaint._values["line-emissive-strength"];if(c&&c.value&&c.value.isDataDriven())return void(this._hasDataDrivenEmissive=!0)}}this._hasDataDrivenEmissive=!1}hasDataDrivenEmissiveStrength(){return this._hasDataDrivenEmissive}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}_getOrder(t){return t?this.order:this._mergedOrder}isLayerDraped(t){return!!this.terrain&&t.isDraped(this.getLayerSourceCache(t))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(t){const o=this.getOwnLayer(t);if(o)return o;this.fire(new s.y(new Error(`The layer '${t}' does not exist in the map's style.`)))}_checkSource(t){const o=this.getOwnSource(t);if(o)return o;this.fire(new s.y(new Error(`The source '${t}' does not exist in the map's style.`)))}precompilePrograms(t,o){const c=this.map.painter;if(c)for(let d=t.minzoom||0;d<(t.maxzoom||25.5);d++){const p=t.getProgramIds();if(p)for(const m of p){const y=t.getDefaultProgramParams(m,o.zoom,this._styleColorTheme.lut);y&&(c.style=this,this.fog&&(c._fogVisible=!0,y.overrideFog=!0,c.getOrCreateProgram(m,y)),c._fogVisible=!1,y.overrideFog=!1,c.getOrCreateProgram(m,y),(this.stylesheet.terrain||this.stylesheet.projection&&this.stylesheet.projection.name==="globe")&&(y.overrideRtt=!0,c.getOrCreateProgram(m,y)))}}}update(t){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(t),this.directionalLight&&this.directionalLight.recalculate(t);const o=this.calculateLightsBrightness();t.brightness=o||0,o!==this._brightness&&(this._brightness=o,this.dispatcher.broadcast("setBrightness",o)),t.worldview!==this._worldview&&(this._worldview=t.worldview,this.dispatcher.broadcast("setWorldview",this._worldview));const c=this._changes.isDirty();let d=!1;if(this._changes.isDirty()){const y=this._changes.getLayerUpdatesByScope();for(const x in y){const{updatedIds:T,removedIds:S}=y[x];(T||S)&&(this._updateWorkerLayers(x,T,S),d=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(t),this.light&&this.light.updateTransitions(t),this.ambientLight&&this.ambientLight.updateTransitions(t),this.directionalLight&&this.directionalLight.updateTransitions(t),this.fog&&this.fog.updateTransitions(t),this.snow&&this.snow.updateTransitions(t),this.rain&&this.rain.updateTransitions(t),this._changes.reset()}const p={};for(const y in this._mergedSourceCaches){const x=this._mergedSourceCaches[y];p[y]=x.used,x.used=!1,x.tileCoverLift=0}for(const y of this._mergedOrder){const x=this._mergedLayers[y];if(x.visibility!=="none"&&x.recalculate(t,this._availableImages),!x.isHidden(t.zoom)){const T=this.getLayerSourceCache(x);
9T&&(T.used=!0,T.tileCoverLift=Math.max(T.tileCoverLift,x.tileCoverLift()))}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback(()=>{this.precompilePrograms(x,t)}):this.precompilePrograms(x,t))}this._shouldPrecompile&&(this._precompileDone=!0),this.terrain&&d&&this.mergeLayers();const m=this.imageManager.getPendingImageProviders();for(const y of m)y.sourceCache.used=!0;for(const y in p){const x=this._mergedSourceCaches[y];p[y]!==x.used&&x.getSource().fire(new s.z("data",{sourceDataType:"visibility",dataType:"source",sourceId:x.getSource().id}))}this.light&&this.light.recalculate(t),this.terrain&&this.terrain.recalculate(t),this.fog&&this.fog.recalculate(t),this.snow&&this.snow.recalculate(t),this.rain&&this.rain.recalculate(t),this.z=t.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),this.imageManager.clearUpdatedImages(this.scope),c&&this.fire(new s.z("data",{dataType:"style"}))}updateImageProviders(){const t=this.imageManager.getPendingImageProviders();for(const o of t){const c=o.resolvePendingRequests(),d=this.getFragmentStyle(o.scope);d&&d.addImages(c)}}_updateTilesForChangedImages(){const t={};for(const o in this._mergedSourceCaches){const c=this._mergedSourceCaches[o].getSource().scope;t[c]=t[c]||this._changes.getUpdatedImages(c),t[c].length!==0&&this._mergedSourceCaches[o].reloadTilesForDependencies(["icons","patterns"],t[c])}for(const o in t)this._changes.resetUpdatedImages(o)}_updateWorkerLayers(t,o,c){const d=this.getFragmentStyle(t);d&&this.dispatcher.broadcast("updateLayers",{layers:o?d._serializeLayers(o):[],scope:t,removedIds:c||[],options:d.options})}setState(t,o){if(this._checkLoaded(),Go(this,Pn(t)))return!1;(t=s.dp(t)).layers=Nu(t.layers);const c=(function(m,y){if(!m)return[{command:Xt.setStyle,args:[y]}];let x=[];try{if(!s.by(m.version,y.version))return[{command:Xt.setStyle,args:[y]}];if(s.by(m.center,y.center)||x.push({command:Xt.setCenter,args:[y.center]}),s.by(m.zoom,y.zoom)||x.push({command:Xt.setZoom,args:[y.zoom]}),s.by(m.bearing,y.bearing)||x.push({command:Xt.setBearing,args:[y.bearing]}),s.by(m.pitch,y.pitch)||x.push({command:Xt.setPitch,args:[y.pitch]}),s.by(m.sprite,y.sprite)||x.push({command:Xt.setSprite,args:[y.sprite]}),s.by(m.glyphs,y.glyphs)||x.push({command:Xt.setGlyphs,args:[y.glyphs]}),s.by(m.imports,y.imports)||(function(C=[],L=[],z){L=L||[];const O=(C=C||[]).map(cs),N=L.map(cs),q=C.reduce(pl,{}),G=L.reduce(pl,{}),j=O.slice();let ie,Q,te,X;for(ie=0,Q=0;ie<O.length;ie++)te=O[ie],G.hasOwnProperty(te)?Q++:(z.push({command:Xt.removeImport,args:[te]}),j.splice(j.indexOf(te,Q),1));for(ie=0,Q=0;ie<N.length;ie++)te=N[N.length-1-ie],j[j.length-1-ie]!==te&&(q.hasOwnProperty(te)?(z.push({command:Xt.removeImport,args:[te]}),j.splice(j.lastIndexOf(te,j.length-Q),1)):Q++,X=j[j.length-ie],z.push({command:Xt.addImport,args:[G[te],X]}),j.splice(j.length-ie,0,te));for(const Z of L){const ne=q[Z.id];ne&&(delete ne.data,s.by(ne,Z)||z.push({command:Xt.updateImport,args:[Z.id,Z]}))}})(m.imports,y.imports,x),s.by(m.transition,y.transition)||x.push({command:Xt.setTransition,args:[y.transition]}),s.by(m.light,y.light)||x.push({command:Xt.setLight,args:[y.light]}),s.by(m.fog,y.fog)||x.push({command:Xt.setFog,args:[y.fog]}),s.by(m.snow,y.snow)||x.push({command:Xt.setSnow,args:[y.snow]}),s.by(m.rain,y.rain)||x.push({command:Xt.setRain,args:[y.rain]}),s.by(m.projection,y.projection)||x.push({command:Xt.setProjection,args:[y.projection]}),s.by(m.lights,y.lights)||x.push({command:Xt.setLights,args:[y.lights]}),s.by(m.camera,y.camera)||x.push({command:Xt.setCamera,args:[y.camera]}),s.by(m.iconsets,y.iconsets)||(function(C,L,z){let O;for(O in L=L||{},C=C||{})C.hasOwnProperty(O)&&(L.hasOwnProperty(O)||z.push({command:Xt.removeIconset,args:[O]}));for(O in L){if(!L.hasOwnProperty(O))continue;const N=L[O];C.hasOwnProperty(O)?s.by(C[O],N)||(z.push({command:Xt.removeIconset,args:[O]}),z.push({command:Xt.addIconset,args:[O,N]})):z.push({command:Xt.addIconset,args:[O,N]})}})(m.iconsets,y.iconsets,x),!s.by(m["color-theme"],y["color-theme"]))return[{command:Xt.setStyle,args:[y]}];const T={},S=[];(function(C,L,z,O){let N;for(N in L=L||{},C=C||{})C.hasOwnProperty(N)&&(L.hasOwnProperty(N)||fc(N,z,O));for(N in L){if(!L.hasOwnProperty(N))continue;const q=L[N];
9C.hasOwnProperty(N)?s.by(C[N],q)||(C[N].type==="geojson"&&q.type==="geojson"&&ef(C,L,N)?z.push({command:Xt.setGeoJSONSourceData,args:[N,q.data]}):Qd(N,L,z,O)):_a(N,L,z)}})(m.sources,y.sources,S,T);const M=[];m.layers&&m.layers.forEach(C=>{C.source&&T[C.source]?x.push({command:Xt.removeLayer,args:[C.id]}):M.push(C)});let A=m.terrain;A&&T[A.source]&&(x.push({command:Xt.setTerrain,args:[void 0]}),A=void 0),x=x.concat(S),s.by(A,y.terrain)||x.push({command:Xt.setTerrain,args:[y.terrain]}),(function(C,L,z){L=L||[];const O=(C=C||[]).map(cs),N=L.map(cs),q=C.reduce(pl,{}),G=L.reduce(pl,{}),j=O.slice(),ie=Object.create(null);let Q,te,X,Z,ne,ce,de;for(Q=0,te=0;Q<O.length;Q++)X=O[Q],G.hasOwnProperty(X)?te++:(z.push({command:Xt.removeLayer,args:[X]}),j.splice(j.indexOf(X,te),1));for(Q=0,te=0;Q<N.length;Q++)X=N[N.length-1-Q],j[j.length-1-Q]!==X&&(q.hasOwnProperty(X)?(z.push({command:Xt.removeLayer,args:[X]}),j.splice(j.lastIndexOf(X,j.length-te),1)):te++,ce=j[j.length-Q],z.push({command:Xt.addLayer,args:[G[X],ce]}),j.splice(j.length-Q,0,X),ie[X]=!0);for(Q=0;Q<N.length;Q++)if(X=N[Q],Z=q[X],ne=G[X],!ie[X]&&!s.by(Z,ne))if(s.by(Z.source,ne.source)&&s.by(Z["source-layer"],ne["source-layer"])&&s.by(Z.type,ne.type)){for(de in fl(Z.layout,ne.layout,z,X,null,Xt.setLayoutProperty),fl(Z.paint,ne.paint,z,X,null,Xt.setPaintProperty),s.by(Z.slot,ne.slot)||z.push({command:Xt.setSlot,args:[X,ne.slot]}),s.by(Z.filter,ne.filter)||z.push({command:Xt.setFilter,args:[X,ne.filter]}),s.by(Z.minzoom,ne.minzoom)&&s.by(Z.maxzoom,ne.maxzoom)||z.push({command:Xt.setLayerZoomRange,args:[X,ne.minzoom,ne.maxzoom]}),Z)Z.hasOwnProperty(de)&&de!=="layout"&&de!=="paint"&&de!=="filter"&&de!=="metadata"&&de!=="minzoom"&&de!=="maxzoom"&&de!=="slot"&&(de.indexOf("paint.")===0?fl(Z[de],ne[de],z,X,de.slice(6),Xt.setPaintProperty):s.by(Z[de],ne[de])||z.push({command:Xt.setLayerProperty,args:[X,de,ne[de]]}));for(de in ne)ne.hasOwnProperty(de)&&!Z.hasOwnProperty(de)&&de!=="layout"&&de!=="paint"&&de!=="filter"&&de!=="metadata"&&de!=="minzoom"&&de!=="maxzoom"&&de!=="slot"&&(de.indexOf("paint.")===0?fl(Z[de],ne[de],z,X,de.slice(6),Xt.setPaintProperty):s.by(Z[de],ne[de])||z.push({command:Xt.setLayerProperty,args:[X,de,ne[de]]}))}else z.push({command:Xt.removeLayer,args:[X]}),ce=j[j.lastIndexOf(X)+1],z.push({command:Xt.addLayer,args:[ne,ce]})})(M,y.layers,x)}catch(T){console.warn("Unable to compute style diff:",T),x=[{command:Xt.setStyle,args:[y]}]}return x})(this.serialize(),t).filter(m=>!(m.command in hf));if(c.length===0)return!1;const d=c.filter(m=>!(m.command in uf));if(d.length>0)throw new Error(`Unimplemented: ${d.map(m=>m.command).join(", ")}.`);const p=[];return c.forEach(m=>{p.push(this[m.command](...m.args))}),o&&Promise.all(p).then(o).catch(o),this.stylesheet=t,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}_updateWorkerImages(){this._availableImages=this.imageManager.listImages(this.scope),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages})}_updateWorkerModels(){this._availableModels=this.modelManager.getModelURIs(this.scope),this.dispatcher.broadcast("setModels",{scope:this.scope,models:this._availableModels})}addImages(t){if(t.size===0)return this;for(const[o,c]of t.entries()){if(this.getImage(o))return this.fire(new s.y(new Error(`An image with the name "${o.name}" already exists.`)));this.imageManager.addImage(o,this.scope,c),this._changes.updateImage(o,this.scope)}return this._updateWorkerImages(),this.fire(new s.z("data",{dataType:"style"})),this}addImage(t,o){return this.getImage(t)?this.fire(new s.y(new Error(`An image with the name "${t.name}" already exists.`))):(this.imageManager.addImage(t,this.scope,o),this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new s.z("data",{dataType:"style"})),this)}updateImage(t,o,c=!1){this.imageManager.updateImage(t,this.scope,o),c&&(this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new s.z("data",{dataType:"style"})))}getImage(t){return this.imageManager.getImage(t,this.scope)}removeImage(t){return this.getImage(t)?(this.imageManager.removeImage(t,this.scope),this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new s.z("data",{dataType:"style"})),this):this.fire(new s.y(new Error("No image with this name exists.")))}listImages(){return this._checkLoaded(),this._availableImages.slice()}getActualScope(){return this._importedAsBasemap?"basemap":this.scope}addModelURLs(t){return this.modelManager.addModelURLs(t,this.getActualScope()),this._updateWorkerModels(),this.fire(new s.z("data",{dataType:"style"})),this}addModel(t,o,c={}
vendor: 5,397 bytes, line 9
9){return this._checkLoaded(),this._validate(ae,`models.${t}`,o,null,c)||(this.modelManager.addModel(t,o,this.getActualScope()),this.fire(new s.z("data",{dataType:"style"}))),this}hasModel(t){return this.modelManager.hasModel(t,this.getActualScope())}removeModel(t){return this.hasModel(t)?(this.modelManager.removeModel(t,this.getActualScope(),!1,!0),this.fire(new s.z("data",{dataType:"style"})),this):this.fire(new s.y(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.getActualScope())}addSource(t,o,c={}){if(this._checkLoaded(),this.getOwnSource(t)!==void 0)throw new Error(`There is already a source with ID "${t}".`);if(!o.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(o).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(o.type)>=0&&this._validate(Fu,`sources.${t}`,o,null,c))return;this.map&&this.map._collectResourceTiming&&(o.collectResourceTiming=!0);const d=Ns(t,o,this.dispatcher,this);d.scope=this.scope,d.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(d.id),source:d.serialize(),sourceId:d.id}));const p=m=>{const y=(m?"symbol:":"other:")+d.id,x=s.B(y,this.scope),T=this._sourceCaches[y]=new ln(x,d,m);(m?this._symbolSourceCaches:this._otherSourceCaches)[d.id]=T,T.onAdd(this.map)};p(!1),o.type!=="vector"&&o.type!=="geojson"||p(!0),d.onAdd&&d.onAdd(this.map),c.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(t){this._checkLoaded();const o=this.getOwnSource(t);if(!o)throw new Error("There is no source with this ID");for(const d in this._layers)if(this._layers[d].source===t)return this.fire(new s.y(new Error(`Source "${t}" cannot be removed while layer "${d}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===t)return this.fire(new s.y(new Error(`Source "${t}" cannot be removed while terrain is using it.`)));if(this.stylesheet.iconsets){const d=Object.entries(this.stylesheet.iconsets).find(([p,m])=>m.type==="source"&&m.source===t);if(d)return this.fire(new s.y(new Error(`Source "${t}" cannot be removed while iconset "${d[0]}" is using it.`)))}const c=this.getOwnSourceCaches(t);for(const d of c){const p=s.dq(d.id);delete this._sourceCaches[p],this._changes.discardSourceCacheUpdate(d.id),d.fire(new s.z("data",{sourceDataType:"metadata",dataType:"source",sourceId:d.getSource().id})),d.setEventedParent(null),d.clearTiles()}return delete this._otherSourceCaches[t],delete this._symbolSourceCaches[t],this.mergeSources(),o.setEventedParent(null),o.onRemove&&o.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(t,o){this._checkLoaded(),this.getOwnSource(t).setData(o),this._changes.setDirty()}getOwnSource(t){const o=this.getOwnSourceCache(t);return o&&o.getSource()}getOwnSources(){const t=[];for(const o in this._otherSourceCaches){const c=this.getOwnSourceCache(o);c&&t.push(c.getSource())}return t}areTilesLoaded(){const t=this._mergedSourceCaches;for(const o in t){const c=t[o]._tiles;for(const d in c){const p=c[d];if(p.state!=="loaded"&&p.state!=="errored")return!1}}return!0}setLights(t){if(this._checkLoaded(),!t)return delete this.ambientLight,void delete this.directionalLight;const o=this._getTransitionParameters();for(const p of t){if(this._validate(Be,"lights",p))return;switch(p.type){case"ambient":if(this.ambientLight){const m=this.ambientLight;m.set(p),m.updateTransitions(o)}else this.ambientLight=new Gt(p,zi(),this.scope,this.options);break;case"directional":if(this.directionalLight){const m=this.directionalLight;m.set(p),m.updateTransitions(o)}else this.directionalLight=new Gt(p,fi(),this.scope,this.options)}}const c=Object.assign(o,{worldview:this.map.getWorldview()}),d=new s.ac(this.z||0,c);this.ambientLight&&this.ambientLight.recalculate(d),this.directionalLight&&this.directionalLight.recalculate(d),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const t=this.directionalLight,o=this.ambientLight;if(!t||!o)return;const c=A=>.2126*(A[0]<=.03928?A[0]/12.92:Math.pow((A[0]+.055)/1.055,2.4))+.7152*(A[1]<=.03928?A[1]/12.92:Math.pow((A[1]+.055)/1.055,2.4))+.0722*(A[2]<=.03928?A[2]/12.92:Math.pow((A[2]+.055)/1.055,2.4)),d=t.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),p=t.properties.get("intensity"),m=t.properties.get("direction"),y=1-s.d4(m.x,m.y,m.z)[2]/90,x=c(d)*p*y,T=o.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),S=o.properties.get("intensity"),M=c(T)*S;return Number(((x+M)/2).toFixed(6))}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const t=[];return this.directionalLight&&t.push(this.directionalLight.get()),this.ambientLight&&t.push(this.ambientLight.get()),t}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(t){if(t==null||t===""&&this.isRootStyle())return this;if(s.dr(t)){const o=s.ds(t),c=this.fragments.find(({id:p})=>p===o);if(!c)return;const d=s.dq(t);return c.style.getFragmentStyle(d)}{const o=this.fragments.find(({id:c})=>c===t);return o?o.style:void 0}}setFeaturesetSelectors(t){if(!t)return;const o={},c=(d,p="")=>`${d}::${p}`;this._featuresetSelectors={};for(const d in t){const p=this._featuresetSelectors[d]=[];
9for(const m of t[d].selectors){if(m.featureNamespace){const x=this.getOwnLayer(m.layer);if(!x){s.w(`Layer is undefined for selector: ${m.layer}`);continue}const T=c(x.source,x.sourceLayer);if(T in o&&o[T]!==m.featureNamespace){s.w(`"featureNamespace ${m.featureNamespace} of featureset ${d}'s selector is not associated to the same source, skip this selector`);continue}o[T]=m.featureNamespace}let y;if(m.properties)for(const x in m.properties){const T=s.U(m.properties[x]);T.result==="success"&&(y=y||{},y[x]=T.value)}p.push({layerId:m.layer,namespace:m.featureNamespace,properties:y,uniqueFeatureID:m._uniqueFeatureID})}}}getFeaturesetDescriptors(t){const o=this.getFragmentStyle(t);if(!o||!o.stylesheet.featuresets)return[];const c=[];for(const d in o.stylesheet.featuresets)c.push({featuresetId:d,importId:o.scope?o.scope:void 0});return c}getFeaturesetLayers(t,o){const c=this.getFragmentStyle(o),d=c.stylesheet.featuresets;if(!d||!d[t])return this.fire(new s.y(new Error(`The featureset '${t}' does not exist in the map's style and cannot be queried.`))),[];const p=[];for(const m of d[t].selectors){const y=c.getOwnLayer(m.layer);y&&p.push(y)}return p}getConfigProperty(t,o){const c=this.getFragmentStyle(t);if(!c)return null;const d=s.B(o,c.scope),p=c.options.get(d),m=p?p.value||p.default:null;return m?m.serialize():null}isIndoorEnabled(){return Object.keys(this._mergedIndoor).length>0}getIndoorSourceLayers(t,o){const c=s.B(t,o);return this._mergedIndoor[c]}setIndoorData(t,o){this.indoorManager.setIndoorData(o)}updateIndoorDependentLayers(){this._updateLayers(this._indoorDependentLayers),this.map._styleDirty=!0,this.map.triggerRepaint()}setConfigProperty(t,o,c){const d=this.getFragmentStyle(t);if(!d)return;const p=d.stylesheet.schema;if(!p||!p[o])return;const m=s.U(c);if(m.result!=="success")return void Go(this,m.value);const y=m.value.expression,x=s.B(o,d.scope),T=d.options.get(x);if(!T)return;let S;const{minValue:M,maxValue:A,stepValue:C,type:L,values:z}=p[o],O=s.U(p[o].default);O.result==="success"&&(S=O.value.expression),S?(this.options.set(x,Object.assign({},T,{value:y,default:S,minValue:M,maxValue:A,stepValue:C,type:L,values:z})),this.updateConfigDependencies(o)):this.fire(new s.y(new Error(`No schema defined for the config option "${o}" in the "${t}" fragment.`)))}getConfig(t){const o=this.getFragmentStyle(t);if(!o)return null;const c=o.stylesheet.schema;if(!c)return null;const d={};for(const p in c){const m=s.B(p,o.scope),y=o.options.get(m),x=y?y.value||y.default:null;d[p]=x?x.serialize():null}return d}setConfig(t,o){const c=this.getFragmentStyle(t);c&&(c.updateConfig(o,c.stylesheet.schema),this.updateConfigDependencies())}getSchema(t){const o=this.getFragmentStyle(t);return o?o.stylesheet.schema:null}setSchema(t,o){const c=this.getFragmentStyle(t);c&&(c.stylesheet.schema=o,c.updateConfig(c._config,o),this.updateConfigDependencies())}updateConfig(t,o){if(this._config=t,t||o)if(o)for(const c in o){let d,p;const m=s.U(o[c].default);if(m.result==="success"&&(d=m.value.expression),t&&t[c]!==void 0){const A=s.U(t[c]);A.result==="success"&&(p=A.value.expression)}const{minValue:y,maxValue:x,stepValue:T,type:S,values:M}=o[c];if(d){const A=s.B(c,this.scope);this.options.set(A,{default:d,value:p,minValue:y,maxValue:x,stepValue:T,type:S,values:M})}else this.fire(new s.y(new Error(`No schema defined for config option "${c}".`)))}else this.fire(new s.y(new Error("Attempting to set config for a style without schema.")))}_updateLayers(t,o=()=>!0){for(const c of t){const d=this.getLayer(c);d&&o(d)&&(d.possiblyEvaluateVisibility(),this._updateLayer(d),this._changes.setDirty())}}updateConfigDependencies(t){this._updateLayers(this._configDependentLayers,o=>!t||o.expressionDependencies.configDependencies.has(t)),this.ambientLight&&this.ambientLight.updateConfig(this.options),this.directionalLight&&this.directionalLight.updateConfig(this.options),this.fog&&this.fog.updateConfig(this.options),this.snow&&this.snow.updateConfig(this.options),this.rain&&this.rain.updateConfig(this.options),this.forEachFragmentStyle(o=>{const c=o._styleColorTheme.colorThemeOverride?o._styleColorTheme.colorThemeOverride:o._styleColorTheme.colorTheme;if(c){const d=o._evaluateColorThemeData(c);(!o._styleColorTheme.lut&&d!==""||o._styleColorTheme.lut&&d!==o._styleColorTheme.lut.data)&&o.setColorTheme(c)}}),this._changes.setDirty()}addLayer(t,o,c={}){this._checkLoaded();const d=t.id;if(this._layers[d])return void this.fire(new s.y(new Error(`Layer with i
9d "${d}" already exists on this map`)));let p;if(t.type==="custom"){if(Go(this,s.dt(t)))return;p=s.du(t,this.scope,this._styleColorTheme.lut,this.options)}else{if(typeof t.source=="object"&&(this.addSource(d,t.source),t=s.dp(t),t=Object.assign(t,{source:d})),this._validate(he,`layers.${d}`,t,{arrayIndex:-1},c))return;p=s.du(t,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(p),p.setEventedParent(this,{layer:{id:d}})}const m=s.B(p.source,p.scope);p.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(m),p.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(m);let y=this._order.length;if(o){const M=this._order.indexOf(o);if(M===-1)return void this.fire(new s.y(new Error(`Layer with id "${o}" does not exist on this map.`)));p.slot&&p.slot!==this._layers[o].slot?s.w(`Layer with id "${o}" has a different slot. Layers can only be rearranged within the same slot.`):y=M}this._order.splice(y,0,d),this._handleLayerOrderChange(),this._layers[d]=p;const x=this.getOwnLayerSourceCache(p),T=!!this.directionalLight&&this.directionalLight.shadowsEnabled();x&&p.canCastShadows()&&T&&(x.castsShadows=!0);const S=this._changes.getRemovedLayer(p);if(S&&p.source&&x&&p.type!=="custom"){this._changes.discardLayerRemoval(p);const M=s.B(p.source,p.scope);S.type!==p.type?this._changes.updateSourceCache(M,"clear"):(this._changes.updateSourceCache(M,"reload"),x.pause())}this._updateLayer(p),p.onAdd&&p.onAdd(this.map),p.scope=this.scope,this.mergeLayers()}moveLayer(t,o){this._checkLoaded();const c=this._checkLayer(t);if(!c||t===o)return;const d=this._order.indexOf(t);this._order.splice(d,1);let p=this._order.length;if(o){const m=this._order.indexOf(o);
9if(m===-1)return void this.fire(new s.y(new Error(`Layer with id "${o}" does not exist on this map.`)));c.slot&&c.slot!==this._layers[o].slot?s.w(`Layer with id "${o}" has a different slot. Layers can only be rearranged within the same slot.`):p=m}this._order.splice(p,0,t),this._changes.setDirty(),this._handleLayerOrderChange(),this.mergeLayers()}removeLayer(t){this._checkLoaded();const o=this._checkLayer(t);if(!o)return;o.setEventedParent(null);const c=this._order.indexOf(t);this._order.splice(c,1),delete this._layers[t],this._changes.setDirty(),this._handleLayerOrderChange(),this._configDependentLayers.delete(o.fqid),this._indoorDependentLayers.delete(o.fqid),this._changes.removeLayer(o);const d=this.getOwnLayerSourceCache(o);if(d&&d.castsShadows){let p=!1;for(const m in this._layers)if(this._layers[m].source===o.source&&this._layers[m].canCastShadows()){p=!0;break}d.castsShadows=p}o.onRemove&&o.onRemove(this.map),this.mergeLayers()}getOwnLayer(t){return this._layers[t]}hasLayer(t){return t in this._mergedLayers}hasLayerType(t){for(const o in this._layers)if(this._layers[o].type===t)return!0;return!1}setLayerZoomRange(t,o,c){this._checkLoaded();const d=this._checkLayer(t);d&&(d.minzoom===o&&d.maxzoom===c||(o!=null&&(d.minzoom=o),c!=null&&(d.maxzoom=c),this._updateLayer(d)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(t,o){this._checkLoaded();const c=this._checkLayer(t);c&&c.slot!==o&&(c.slot=o,this._updateLayer(c))}setFilter(t,o,c={}){this._checkLoaded();const d=this._checkLayer(t);if(d&&!s.by(d.filter,o))return o==null?(d.filter=void 0,void this._updateLayer(d)):void(this._validate(k,`layers.${d.id}.filter`,o,{layerType:d.type},c)||(d.filter=s.dp(o),this._updateLayer(d)))}getFilter(t){const o=this._checkLayer(t);if(o)return s.dp(o.filter)}setLayoutProperty(t,o,c,d={}){this._checkLoaded();const p=this._checkLayer(t);if(p&&!s.by(p.getLayoutProperty(o),c)){if(c!=null&&(!d||d.validate!==!1)&&Go(p,W.call(Pn,{key:`layers.${t}.layout.${o}`,layerType:p.type,objectKey:o,value:c,styleSpec:s.a6,style:{glyphs:!0,sprite:!0}})))return;p.setLayoutProperty(o,c),p.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(p.fqid),p.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(p.fqid),this._updateLayer(p)}}setLayerProperty(t,o,c,d={}){this._checkLoaded();const p=this._checkLayer(t);p&&(o==="appearances"?(p.setAppearances(c),this._changes.setDirty()):p.isPaintProperty(o)?this.setPaintProperty(t,o,c,d):this.setLayoutProperty(t,o,c,d))}getLayoutProperty(t,o){const c=this._checkLayer(t);if(c)return c.getLayoutProperty(o)}setPaintProperty(t,o,c,d={}){this._checkLoaded();const p=this._checkLayer(t);if(!p||s.by(p.getPaintProperty(o),c)||c!=null&&(!d||d.validate!==!1)&&Go(p,U.call(Pn,{key:`layers.${t}.paint.${o}`,layerType:p.type,objectKey:o,value:c,styleSpec:s.a6})))return;const m=p.setPaintProperty(o,c);p.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(p.fqid),p.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(p.fqid),m&&this._updateLayer(p),this._changes.updatePaintProperties(p)}getPaintProperty(t,o){const c=this._checkLayer(t);if(c)return c.getPaintProperty(o)}setFeatureState(t,o){if(this._checkLoaded(),"target"in t){if("featuresetId"in t.target){const{featuresetId:x,importId:T}=t.target,S=this.getFragmentStyle(T),M=S.getFeaturesetLayers(x);for(const{source:A,sourceLayer:C}of M)S.setFeatureState({id:t.id,source:A,sourceLayer:C},o)}else if("layerId"in t.target){const{layerId:x}=t.target,T=this.getLayer(x);this.setFeatureState({id:t.id,source:T.source,sourceLayer:T.sourceLayer},o)}return}const c=t.source,d=t.sourceLayer,p=this._checkSource(c);if(!p)return;const m=p.type;if(m==="geojson"&&d)return void this.fire(new s.y(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(m==="vector"&&!d)return void this.fire(new s.y(new Error("The sourceLayer parameter must be provided for vector source types.")));t.id===void 0&&this.fire(new s.y(new Error("The feature id parameter must be provided.")));const y=this.getOwnSourceCaches(c);for(const x of y)x.setFeatureState(d,t.id,o)}removeFeatureState(t,o){if(this._checkLoaded(),"target"in t){if("featuresetId"in t.target){const{featuresetId:x,importId:T}=t.target,S=this.getFragmentStyle(T),M=S.getFeaturesetLayers(x);for(const{source:A,sourceLayer:C}of M)S.removeFeatureState({id:t.id,source:A,sourceLayer:C},o)}else if("layerId"in t.target){const{layerId:x}=t.target,T=this.getLayer(x);this.removeFeatureState({id:t.id,source:T.source,sourceLayer:T.sourceLayer},o)}return}const c=t.source,d=this._checkSource(c);if(!d)return;const p=d.type,m=p==="vector"?t.sourceLayer:void 0;if(p==="vector"&&!m)return void this.fire(new s.y(new Error("The sourceLayer parameter must be provided for vector source types.")));if(o&&typeof t.id!="string"&&typeof t.id!="number")return void this.fire(new s.y(new Error("A feature id is required to remove its specific state property.")));const y=this.getOwnSourceCaches(c);for(const x of y)x.removeFeatureState(m,t.id,o)}getFeatureState(t){if(this._checkLoaded(),"target"in t){let p;if("featuresetId"in t.target){const{featuresetId:m,importId:y}=t.target,x=this.getFragmentStyle(y),T=x.getFeaturesetLayers(m);for(const{source:S,sourceLayer:M}of T){const A=x.getFeatureState({id:t.id,source:S,sourceLayer:M});if(A&&!p)p=A;else if(!s.by(p,A))return void this.fire(new s.y(new Error("The same feature id exists in multiple sources in the featureset, but their feature states are not consistent through the sources.")))}}else if("layerId"in t.target){const{layerId:m}=t.target,y=this.getLayer(m);p=this.getFeatureState({id:t.id,source:y.source,sourceLayer:y.sourceLayer})}return p}const o=t.source,c=t.sourceLayer,d=this._checkSource(o);if(d){if(d.type!=="vector"||c)return t.id===void 0&&this.fire(new s.y(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(o)[0].getFeatureState(c,t.id);this.fire(new s.y(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(t){return this.stylesheet.transition=Object.assign({},this.stylesheet.transition,t),this.transition=this.stylesheet.transition,this}getTransition(){return Object.assign({},this.stylesheet.transition)}serialize(){this._checkLoaded();const t=this.getTerrain(),o=t&&this.terrain&&this.terrain.scope===this.scope?t:this.stylesheet.terrain;return s.dv({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,iconsets:this.stylesheet.iconsets,featuresets:this.stylesheet.featuresets,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:o,fog:this.stylesheet.fog,snow:this.stylesheet.snow,rain:this.stylesheet.rain,indoor:this.stylesheet.indoor,center:this.stylesheet.center,"color-theme":this.stylesheet["color-theme"],zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:this._serializeSources(),layers:this._serializeLayers(this._order)},c=>c!==void 0)}_updateFilteredLayers(t){for(const o of Object.values(this._mergedLayers))t(o)&&this._updateLayer(o)}_updateLayer(t){this._changes.updateLayer(t);const o=this.getLayerSourceCache(t),c=s.B(t.source,t.scope),d=this._changes.getUpd
vendor: 4,235 bytes, line 9
9atedSourceCaches();t.source&&!d[c]&&o&&o.getSource().type!=="raster"&&(this._changes.updateSourceCache(c,"reload"),o.pause()),t.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(t){const o=y=>this._mergedLayers[y].is3D(!!this.terrain),c=this.order,d={},p=[];for(let y=c.length-1;y>=0;y--){const x=c[y];if(o(x)){d[x]=y;for(const T of t){const S=T[x];if(S)for(const M of S)p.push(M)}}}p.sort((y,x)=>x.intersectionZ-y.intersectionZ);const m=[];for(let y=c.length-1;y>=0;y--){const x=c[y];if(o(x))for(let T=p.length-1;T>=0;T--){const S=p[T].feature;if(S.layer&&d[S.layer.id]<y)break;m.push(S),p.pop()}else for(const T of t){const S=T[x];if(S)for(const M of S)m.push(M.feature)}}return m}queryRasterValue(t,o,c){const d=this.getOwnSource(t);return d?d.type!=="raster-array"?(this.fire(new s.y(new Error('queryRasterValue support only "raster-array" sources.'))),Promise.resolve(null)):d.queryRasterArrayValue(o,c):(this.fire(new s.y(new Error(`Source with id "${t}" does not exist in the style.`))),Promise.resolve(null))}queryRenderedFeatures(t,o,c){let d;o&&!Array.isArray(o)&&o.filter&&(this._validate(k,"queryRenderedFeatures.filter",o.filter,null,o),d=s.b6(o.filter));const p={},m=S=>{if(Sc.has(S.type))return;const M=this.getOwnLayerSourceCache(S),A=p[M.id]=p[M.id]||{sourceCache:M,layers:{},has3DLayers:!1};S.is3D(!!this.terrain)&&(A.has3DLayers=!0),A.layers[S.fqid]=A.layers[S.fqid]||{styleLayer:S,targets:[]},A.layers[S.fqid].targets.push({filter:d})};if(o&&o.layers){if(!Array.isArray(o.layers))return this.fire(new s.y(new Error("parameters.layers must be an Array."))),[];for(const S of o.layers){const M=this._layers[S];if(!M)return this.fire(new s.y(new Error(`The layer '${S}' does not exist in the map's style and cannot be queried for features.`))),[];m(M)}}else for(const S in this._layers)m(this._layers[S]);const y=this._queryRenderedFeatures(t,p,c),x=this._flattenAndSortRenderedFeatures(y),T=[];for(const S of x)s.dw(S.layer.id)===this.scope&&T.push(S);return T}queryRenderedFeatureset(t,o,c){let d;o&&!Array.isArray(o)&&o.filter&&(this._validate(k,"queryRenderedFeatures.filter",o.filter,null,o),d=s.b6(o.filter));const p="mock",m=[];if(o&&o.target)m.push(Object.assign({},o,{targetId:p,filter:d}));else{const S=this.getFeaturesetDescriptors();for(const M of S)m.push({targetId:p,filter:d,target:M});for(const{style:M}of this.fragments){const A=M.getFeaturesetDescriptors();for(const C of A)m.push({targetId:p,filter:d,target:C})}}const y=this.queryRenderedTargets(t,m,c),x=[],T=new Set;for(const S of y)for(const M of S.variants[p])ll(M,S,T)||x.push(new s.dx(S,M));return x}queryRenderedTargets(t,o,c){const d={},p=(y,x,T,S)=>{const M=d[x.id]=d[x.id]||{sourceCache:x,layers:{},has3DLayers:!1};if(M.layers[y.fqid]=M.layers[y.fqid]||{styleLayer:y,targets:[]},y.is3D(!!this.terrain)&&(M.has3DLayers=!0),!S)return T.uniqueFeatureID=!1,void M.layers[y.fqid].targets.push(T);M.layers[y.fqid].targets.push(Object.assign({},T,{namespace:S.namespace,properties:S.properties,uniqueFeatureID:S.uniqueFeatureID}))};for(const y of o)if("featuresetId"in y.target){const{featuresetId:x,importId:T}=y.target,S=this.getFragmentStyle(T);if(!S||!S._featuresetSelectors)continue;const M=S._featuresetSelectors[x];if(!M){this.fire(new s.y(new Error(`The featureset '${x}' does not exist in the map's style and cannot be queried for features.`)));continue}for(const A of M){const C=S.getOwnLayer(A.layerId);C&&!Sc.has(C.type)&&p(C,S.getOwnLayerSourceCache(C),y,A)}}else if("layerId"in y.target){const{layerId:x}=y.target,T=this.getLayer(x);if(!T||Sc.has(T.type))continue;p(T,this.getLayerSourceCache(T),y)}const m=this._queryRenderedFeatures(t,d,c);return this._flattenAndSortRenderedFeatures(m)}_queryRenderedFeatures(t,o,c){const d=[],p=!!this.map._showQueryGeometry,m=ji.createFromScreenPoints(t,c);for(const y in o){const x=cl(m,o[y],this._availableImages,c,p,this.getActualScope());Object.keys(x).length&&d.push(x)}if(this.placement)for(const y in o){if(!o[y].sourceCache._onlySymbols)continue;const x=Xd(m.screenGeometry,o[y],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData,this.map.getWorldview());Object.keys(x).length&&d.push(x)}return d}querySourceFeatures(t,o){const c=o&&o.filter;
9c&&this._validate(k,"querySourceFeatures.filter",c,null,o);let d=[];const p=this.getOwnSourceCaches(t);for(const m of p)d=d.concat(Yd(m,o));return d}addSourceType(t,o,c){return bn.getSourceType(t)?c(new Error(`A source type called "${t}" already exists.`)):(bn.setSourceType(t,o),o.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:o.workerSourceURL},c):c(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(t,o,c={}){this._checkLoaded();const d=this.light.getLight();let p=!1;for(const y in t)if(!s.by(t[y],d[y])){p=!0;break}if(!p)return;const m=this._getTransitionParameters();this.light.setLight(t,o,c),this.light.updateTransitions(m)}getTerrain(){return this.terrain&&this.terrain.drapeRenderMode===1?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}checkCanvasFingerprintNoise(){this.disableElevatedTerrain===void 0&&(this.disableElevatedTerrain=s.o.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&s.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(t,o=1){if(this._checkLoaded(),!t)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),o===0&&delete this.terrain,t===null?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let c=t;const d=!("source"in t)||t.source==null;if(o===1){if(this.disableElevatedTerrain)return;if("source"in c&&typeof c.source=="object"){const y="terrain-dem-src";this.addSource(y,c.source),c=s.dp(c),c=Object.assign(c,{source:y})}const p=Object.assign({},c),m={};if(this.terrain&&d){p.source=this.terrain.get().source;const y=this.terrain?this.getFragmentStyle(this.terrain.scope):null;y&&(m.style=y.serialize())}if(this._validate(Oo,"terrain",p,m))return}if(!this.terrain||this.terrain.scope!==this.scope&&!d||this.terrain&&o!==this.terrain.drapeRenderMode){if(!c)return;this._createTerrain(c,o),this.fire(new s.z("data",{dataType:"style"}))}else{const p=this.terrain,m=p.get();for(const y of Object.keys(s.a6.terrain))!c.hasOwnProperty(y)&&s.a6.terrain[y].default&&(c[y]=s.a6.terrain[y].default);for(const y in t)if(!s.by(t[y],m[y])){p.set(t,this.options),this.stylesheet.terrain=t;const x=this._getTransitionParameters({duration:0});p.updateTransitions(x),this.fire(new s.z("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(t){const o=this.fog=new xt(t,this.map.transform,this.scope,this.options);this.stylesheet.fog=o.get();const c=this._getTransitionParameters({duration:0});o.updateTransitions(c)}_createSnow(t){const o=this.snow=new Hi(t,this.map.transform,this.scope,this.options);this.stylesheet.snow=o.get();const c=this._getTransitionParameters({duration:0});o.updateTransitions(c)}_createRain(t){const o=this.rain=new Mi(t,this.map.transform,this.scope,this.options);this.stylesheet.rain=o.get();const c=this._getTransitionParameters({duration:0});o.updateTransitions(c)}_updateMarkersOpacity(){this.map._markers.length!==0&&this.map._requestDomTask(()=>{for(const t of this.map._markers)t._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(t){if(this._checkLoaded(),!t)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const o=this.fog;if(!s.by(o.get(),t)){o.set(t,this.options),this.stylesheet.fog=o.get();const c=this._getTransitionParameters({duration:0});o.updateTransitions(c)}}else this._createFog(t);this._markersNeedUpdate=!0}getSnow(){return this.snow?this.snow.get():null}setSnow(t){if(this._checkLoaded(),!t)return delete this.snow,void delete this.stylesheet.snow;if(this.snow){const o=this.snow;if(!s.by(o.get(),t)){o.set(t,this.options),this.stylesheet.snow=o.get();const c=this._getTransitionParameters({duration:0});o.updateTransitions(c)}}else this._createSnow(t);this._markersNeedUpdate=!0}getRain(){return this.rain?this.rain.get():null}setRain(t){if(this._checkLoaded(),!t)return delete this.rain,void delete this.stylesheet.rain;if(this.rain){const o=this.rain;if(!s.by(o.get(),t)){o.set(t,this.options),this.stylesheet.rain=o.get();const c=this._getTransitionParameters({duration:0});o.updateTransitions(c)}}else this._createRain(t);
9this._markersNeedUpdate=!0}_reloadColorTheme(){const t=()=>{for(const d in this._layers)this._layers[d].lut=this._styleColorTheme.lut;for(const d in this._sourceCaches)this._sourceCaches[d].clearTiles()},o=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!o)return this._styleColorTheme.lut=null,void t();const c=this._evaluateColorThemeData(o);this._loadColorTheme(c).then(()=>{this.fire(new s.z("colorthemeset")),t()}).catch(d=>{s.w(`Couldn't set color theme: ${d}`)})}setColorTheme(t){this._checkLoaded(),this._styleColorTheme.colorThemeOverride&&s.w("Note: setColorTheme is called on a style with a color-theme override, the passed color-theme won't be visible."),this._styleColorTheme.colorTheme=t,this._reloadColorTheme()}setImportColorTheme(t,o){const c=this.getFragmentStyle(t);c&&(c._styleColorTheme.colorThemeOverride=o,c._reloadColorTheme())}_getTransitionParameters(t){return{now:s.o.now(),transition:Object.assign(this.transition,t)}}updateDrapeFirstLayers(){if(!this.terrain)return;const t=[],o=[];for(const c of this._mergedOrder)this.isLayerDraped(this._mergedLayers[c])?t.push(c):o.push(c);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...t),this._drapedFirstOrder.push(...o)}_createTerrain(t,o){const c=this.terrain=new Oe(t,o,this.scope,this.options,this.map.getWorldview());o===1&&(this.stylesheet.terrain=t),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const d=this._getTransitionParameters({duration:0});c.updateTransitions(d)}_force3DLayerUpdate(){for(const t in this._layers){const o=this._layers[t];o.type==="fill-extrusion"&&this._updateLayer(o)}}_forceSymbolLayerUpdate(){for(const t in this._layers){const o=this._layers[t];o.type==="symbol"&&this._updateLayer(o)}}_validate(t,o,c,d,p={}){if(p&&p.validate===!1)return!1;const m=Object.assign({},this.serialize());return Go(this,t.call(Pn,Object.assign({key:o,style:m,value:c,styleSpec:s.a6},d)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),s.dy.off("pluginStateChange",this._rtlTextPluginCallback);for(const t in this._mergedLayers)this._mergedLayers[t].setEventedParent(null);for(const t in this._mergedSourceCaches)this._mergedSourceCaches[t].clearTiles(),this._mergedSourceCaches[t].setEventedParent(null);this.imageManager.removeScope(this.scope),this.setEventedParent(null),delete this.fog,delete this.snow,delete this.rain,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.indoorManager.destroy(),this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this.modelManager.setEventedParent(null),this.modelManager.destroy(),this.dispatcher.remove())}clearSource(t){const o=this.getSourceCaches(t);for(const c of o)c.clearTiles()}clearSources(){for(const t in this._mergedSourceCaches)this._mergedSourceCaches[t].clearTiles()}clearLayers(){for(const t in this._mergedLayers){const o=this._mergedLayers[t];o._clear&&o._clear()}}reloadSource(t){const o=this.getSourceCaches(t);for(const c of o)c.resume(),c.reload()}reloadSources(){for(const t of this.getSources())t.reload&&t.reload()}reloadModels(){this.modelManager.reloadModels(""),this.forEachFragmentStyle(t=>{t.modelManager.reloadModels(t.scope)})}updateSources(t){let o;this.directionalLight&&(o=af(this.directionalLight));const c=new Set,d=new Set;for(const p in this._mergedLayers){const m=this._mergedLayers[p];
vendor: 5,429 bytes, line 9
9m.type==="building"&&c.add(m.source),m.hasElevation()&&!d.has(m.source)&&d.add(m.source)}for(const p in this._mergedSourceCaches){const m=this._mergedSourceCaches[p],y=d.has(m._source.id);c.has(m._source.id)&&(m._source.reparseOverscaled=!1),m.update(t,void 0,void 0,o,y)}}_generateCollisionBoxes(){for(const t in this._sourceCaches){const o=this._sourceCaches[t];o.resume(),o.reload()}}_handleLayerOrderChange(){this._requestFullLabelPlacement(),this.fire(new s.z("neworder"))}_requestFullLabelPlacement(){this.pauseablePlacement||(this.pauseablePlacement=new qu),this.pauseablePlacement.requestFullPlacement()}_setLabelPlacementStale(){this.placement&&this.placement.setStale()}_updatePlacement(t,o,c,d,p){this.pauseablePlacement||(this.pauseablePlacement=new qu);let m=!1,y=!1;const x={},T={};for(const z of this._mergedOrder){const O=this._mergedLayers[z];if(O.type!=="symbol")continue;const N=s.B(O.source,O.scope);let q=x[N];if(!q){const j=this.getLayerSourceCache(O);if(!j)continue;const ie=j.getRenderableIds(!0).map(Q=>j.getTileByID(Q));T[N]=ie.slice(),q=x[N]=ie.sort((Q,te)=>te.tileID.overscaledZ-Q.tileID.overscaledZ||(Q.tileID.isLessThan(te.tileID)?-1:1))}const G=this.crossTileSymbolIndex.addLayer(O,q,t.center.lng,t.projection);m=m||G}this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder);const S=!!(this.placement&&!t.equals(this.placement.transform)),M=!!(this.placement&&(this.placement.lastReplacementSourceUpdateTime!==0&&!p||this.placement.lastReplacementSourceUpdateTime!==p.updateTime)),A=S||M||m,C=(A||this.pauseablePlacement.isStale())&&c===0,L=this.pauseablePlacement.isDone()&&!this.placement.stillRecent(s.o.now(),t.zoom)&&c!==0;if((this.pauseablePlacement.isFullPlacementRequested()||!this.pauseablePlacement.placement||C||L)&&(this.pauseablePlacement=this.pauseablePlacement.startNewPlacement(t,this._mergedOrder,o,c,d,this.placement,this.fog&&t.projection.supportsFog?this.fog.state:null,this._buildingIndex)),this.pauseablePlacement.isDone()?A&&c!==0&&this.pauseablePlacement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,x,T,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(s.o.now()),y=!0),m&&this.pauseablePlacement.setStale()),y||m){this._buildingIndex.onNewFrame(t.zoom);for(let z=0;z<this._mergedOrder.length;z++){const O=this._mergedLayers[this._mergedOrder[z]];if(O.type!=="symbol"||O.visibility==="none")continue;const N=this.isLayerClipped(O);this.placement.updateLayerOpacities(O,x[s.B(O.source,O.scope)],z,N?p:null)}}return!this.pauseablePlacement.isDone()||this.placement.isStale()||this.placement.hasTransitions(s.o.now())}_releaseSymbolFadeTiles(){for(const t in this._sourceCaches)this._sourceCaches[t].releaseSymbolFadeTiles()}addImport(t,o){this._checkLoaded();const c=this.stylesheet.imports=this.stylesheet.imports||[];if(c.findIndex(({id:p})=>p===t.id)!==-1)return void this.fire(new s.y(new Error(`Import with id '${t.id}' already exists in the map's style.`)));if(!o)return c.push(t),this._loadImports([t],!0);const d=c.findIndex(({id:p})=>p===o);return d===-1&&this.fire(new s.y(new Error(`Import with id "${o}" does not exist on this map.`))),this.stylesheet.imports=c.slice(0,d).concat(t).concat(c.slice(d)),this._loadImports([t],!0,o)}updateImport(t,o){this._checkLoaded();const c=this.stylesheet.imports||[],d=this.getImportIndex(t);return d===-1?this:typeof o=="string"?(this.setImportUrl(t,o),this):(o.url&&o.url!==c[d].url&&this.setImportUrl(t,o.url),s.by(o.config,c[d].config)||this.setImportConfig(t,o.config,o.data.schema),s.by(o.data,c[d].data)||this.setImportData(t,o.data),this)}moveImport(t,o){this._checkLoaded();let c=this.stylesheet.imports||[];const d=this.getImportIndex(t);if(d===-1)return this;const p=this.getImportIndex(o);if(p===-1)return this;const m=c[d],y=this.fragments[d];return c=c.filter(({id:x})=>x!==t),this.fragments=this.fragments.filter(({id:x})=>x!==t),this.stylesheet.imports=c.slice(0,p).concat(m).concat(c.slice(p)),this.fragments=this.fragments.slice(0,p).concat(y).concat(this.fragments.slice(p)),this.mergeLayers(),this}setImportUrl(t,o){this._checkLoaded();const c=this.stylesheet.imports||[],d=this.getImportIndex(t);if(d===-1)return this;c[d].url=o;const p=this.fragments[d];return p.style=this._createFragmentStyle(c[d]),p.style.on("style.import.load",()=>this.mergeAll()),p.style.loadURL(o),this}setImportData(t,o){this._checkLoaded();const c=this.getImportIndex(t),d=this.stylesheet.imports||[];return c===-1?this:o?(this.fragments[c].style.setState(o),this._reloadImports(),this):(delete d[c].data,this.setImportUrl(t,d[c].url))}setImportConfig(t,o,c){this._checkLoaded();const d=this.getImportIndex(t),p=this.stylesheet.imports||[];if(d===-1)return this;o?p[d].config=o:delete p[d].config;const m=this.fragments[d];c&&m.style.stylesheet&&(m.style.stylesheet.schema=c);const y=m.style.stylesheet&&m.style.stylesheet.schema;return m.config=o,m.style.updateConfig(o,y),this.updateConfigDependencies(),this}removeImport(t){this._checkLoaded();const o=this.stylesheet.imports||[],c=this.getImportIndex(t);c!==-1&&(o.splice(c,1),this.fragments[c].style._remove(),this.fragments.splice(c,1),this._reloadImports())}getImportIndex(t){const o=(this.stylesheet.imports||[]).findIndex(c=>c.id===t);return o===-1&&this.fire(new s.y(new Error(`Import '${t}' does not exist in the map's style and cannot be updated.`))),o}
9getLayer(t){return this._mergedLayers[t]}getSources(){const t=[];for(const o in this._mergedOtherSourceCaches){const c=this._mergedOtherSourceCaches[o];c&&t.push(c.getSource())}return t}getSource(t,o){const c=this.getSourceCache(t,o);return c&&c.getSource()}getLayerSource(t){const o=this.getLayerSourceCache(t);return o&&o.getSource()}getSourceCache(t,o){const c=s.B(t,o);return this._mergedOtherSourceCaches[c]}getLayerSourceCache(t){const o=s.B(t.source,t.scope);return t.type==="symbol"?this._mergedSymbolSourceCaches[o]:this._mergedOtherSourceCaches[o]}getSourceCaches(t){if(t==null)return Object.values(this._mergedSourceCaches);const o=[];return this._mergedOtherSourceCaches[t]&&o.push(this._mergedOtherSourceCaches[t]),this._mergedSymbolSourceCaches[t]&&o.push(this._mergedSymbolSourceCaches[t]),o}updateSourceCaches(){const t=this._changes.getUpdatedSourceCaches();for(const o in t){const c=t[o];c==="reload"?this.reloadSource(o):c==="clear"&&this.clearSource(o)}}updateLayers(t){const o=this._changes.getUpdatedPaintProperties();for(const c of o){const d=this.getLayer(c);d&&d.updateTransitions(t)}}getGlyphsUrl(){return this.stylesheet.glyphs}setGlyphsUrl(t){this.stylesheet.glyphs=t,this.glyphManager.setURL(t)}getImages(t,o,c){this.imageManager.getImages(o.images,o.scope,c),this._updateTilesForChangedImages();const d=m=>{if(m){const y=o.images.map(x=>s.I.toString(x));m.setDependencies(o.tileID.key,o.type,y)}},p=s.B(o.source,o.scope);d(this._mergedOtherSourceCaches[p]),d(this._mergedSymbolSourceCaches[p]),o.images.some(m=>m.iconsetId)&&this.fire(new s.z("data",{dataType:"style"}))}rasterizeImages(t,o,c){this.imageManager.rasterizeImages(o,c)}getGlyphs(t,o,c){this.glyphManager.getGlyphs(o.stacks,c)}getResource(t,o,c){return s.dz(o,c)}getOwnSourceCache(t){return this._otherSourceCaches[t]}getOwnLayerSourceCache(t){return t.type==="symbol"?this._symbolSourceCaches[t.source]:this._otherSourceCaches[t.source]}getOwnSourceCaches(t){const o=[];return this._otherSourceCaches[t]&&o.push(this._otherSourceCaches[t]),this._symbolSourceCaches[t]&&o.push(this._symbolSourceCaches[t]),o}_isSourceCacheLoaded(t){const o=this.getOwnSourceCaches(t);return o.length===0?(this.fire(new s.y(new Error(`There is no source with ID '${t}'`))),!1):o.every(c=>c.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(t,o){if(!this._clipLayerPresent&&t.type!=="fill-extrusion"&&t.type!=="building")return!1;const c=t.type==="fill-extrusion"&&(t.sourceLayer==="building"||t.sourceLayer==="procedural_buildings"),d=t.type==="building";if(t.is3D(!!this.terrain)){if(c||d||o&&o.type==="batched-model"||t.type==="model")return!0}else if(t.type==="symbol")return!0;return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.fragments.forEach(t=>{t.style._remove()}),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}bn.getSourceType=function(l){return ko[l]},bn.setSourceType=function(l,t){ko[l]=t},bn.registerForPluginStateChange=s.dA;var Yu=`
10#define EPSILON 0.0000001
11#define PI 3.141592653589793
12#ifdef RENDER_CUTOFF
13float cutoff_opacity(vec4 cutoff_params,float depth) {float near=cutoff_params.x;float far=cutoff_params.y;float cutoffStart=cutoff_params.z;float cutoffEnd=cutoff_params.w;float linearDepth=(depth-near)/(far-near);return clamp((linearDepth-cutoffStart)/(cutoffEnd-cutoffStart),0.0,1.0);}
14#endif`,Ku=`
15#ifdef DUAL_SOURCE_BLENDING
16layout(location=0,index=0) out vec4 glFragColor;layout(location=0,index=1) out vec4 glFragColorSrc1;
17#else
18layout(location=0) out vec4 glFragColor;
19#endif
20#ifdef USE_MRT1
21layout(location=1) out vec4 out_Target1;
22#endif
23highp float unpack_depth(highp vec4 rgba_depth)
24{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}
25#ifdef INDICATOR_CUTOUT
26uniform vec3 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params;
27#endif
28vec4 applyCutout(vec4 color,float height) {
29#ifdef INDICATOR_CUTOUT
30float verticalFadeRange=u_indicator_cutout_centers.z*0.25;float holeMinOpacity=mix(1.0,u_indicator_cutout_params.x,smoothstep(u_indicator_cutout_centers.z,u_indicator_cutout_centers.z+verticalFadeRange,height));float holeRadius=max(u_indicator_cutout_params.y,0.0);float holeAspectRatio=u_indicator_cutout_params.z;
30float fadeStart=u_indicator_cutout_params.w;float distA=distance(vec2(gl_FragCoord.x,gl_FragCoord.y*holeAspectRatio),vec2(u_indicator_cutout_centers[0],u_indicator_cutout_centers[1]*holeAspectRatio));return color*min(smoothstep(fadeStart,holeRadius,distA)+holeMinOpacity,1.0);
31#else
32return color;
33#endif
34}
35#ifdef DEBUG_WIREFRAME
36#define HANDLE_WIREFRAME_DEBUG \\
37glFragColor=vec4(0.7,0.0,0.0,0.7); \\
38gl_FragDepth=gl_FragCoord.z-0.0001;
39#else
40#define HANDLE_WIREFRAME_DEBUG
41#endif
42#ifdef RENDER_CUTOFF
43uniform highp vec4 u_cutoff_params;in float v_cutoff_opacity;
44#endif
45vec4 textureLodCustom(sampler2D image,highp vec2 pos,highp vec2 lod_coord) {highp vec2 size=vec2(textureSize(image,0));highp vec2 dx=dFdx(lod_coord.xy*size);highp vec2 dy=dFdy(lod_coord.xy*size);highp float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));highp float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}vec4 applyLUT(highp sampler3D lut,vec4 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return vec4(texture(lut,uvw).rgb*col.a,col.a);}vec3 applyLUT(highp sampler3D lut,vec3 col) {return applyLUT(lut,vec4(col,1.0)).rgb;}`,wa=`
46#define EXTENT 8192.0
47#define RAD_TO_DEG 180.0/PI
48#define DEG_TO_RAD PI/180.0
49#define GLOBE_RADIUS EXTENT/PI/2.0
50float wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}
51#ifdef PROJECTION_GLOBE_VIEW
52vec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {
53#ifndef PROJECTED_POS_ON_VIEWPORT
54float tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;
55#else
56return vec3(0.0);
57#endif
58}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}
59#endif
60vec2 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(
61unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
62);}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 vec2 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 (units_to_pixels*pos+offset)/pattern_size;}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) {return get_pattern_pos(pixel_coord_upper,pixel_coord_lower,pattern_size,vec2(tile_units_to_pixels),pos);}float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(PI/4.0+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);}
63#ifdef RENDER_CUTOFF
64uniform vec4 u_cutoff_params;out float v_cutoff_opacity;
65#endif
66const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt)
67{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}
68#ifndef HAS_SHADER_STORAGE_BLOCK_material_buffer
69#define GET_ATTRIBUTE_float(attrib,matInfo,attrib_id) attrib
70#define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_id) attrib
71#define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_id) attrib
72#define DECLARE_MATERIAL_TABLE_INFO
73#endif`,Ta="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;
73void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",Ju=`
74#define ELEVATION_SCALE 7.0
75#define ELEVATION_OFFSET 450.0
76#ifdef PROJECTION_GLOBE_VIEW
77uniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix(
78mix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;}
79#else
80vec3 elevationVector(vec2 pos) { return vec3(0,0,1); }
81#endif
82#ifdef TERRAIN
83uniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float currentElevation(vec2 apos) {
84#ifdef TERRAIN_DEM_FLOAT_FORMAT
85vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem,pos).r;
86#else
87float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(dd,0)).r;float bl=texture(u_dem,pos+vec2(0,dd)).r;float br=texture(u_dem,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);
88#endif
89}float prevElevation(vec2 apos) {
90#ifdef TERRAIN_DEM_FLOAT_FORMAT
91vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem_prev,pos).r;
92#else
93float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem_prev,pos).r;float tr=texture(u_dem_prev,pos+vec2(dd,0)).r;float bl=texture(u_dem_prev,pos+vec2(0,dd)).r;float br=texture(u_dem_prev,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);
94#endif
95}
96#ifdef TERRAIN_VERTEX_MORPHING
97float elevation(vec2 apos) {
98#ifdef ZERO_EXAGGERATION
99return 0.0;
100#endif
101float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}
102#else
103float elevation(vec2 apos) {
104#ifdef ZERO_EXAGGERATION
105return 0.0;
106#endif
107return currentElevation(apos);}
108#endif
109vec4 fourSample(vec2 pos,vec2 off) {float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(off.x,0.0)).r;float bl=texture(u_dem,pos+vec2(0.0,off.y)).r;float br=texture(u_dem,pos+off).r;return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);}
110#else
111float elevation(vec2 pos) { return 0.0; }
112#endif
113#ifdef DEPTH_OCCLUSION
114uniform highp sampler2D u_depth;uniform highp vec2 u_depth_size_inv;uniform highp vec2 u_depth_range_unpack;uniform highp float u_occluder_half_size;uniform highp float u_occlusion_depth_offset;
115#ifdef DEPTH_D24
116float unpack_depth(float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}vec4 unpack_depth4(vec4 depth) {return depth*u_depth_range_unpack.x+vec4(u_depth_range_unpack.y);}
117#else
118highp float unpack_depth_rgba(vec4 rgba_depth)
119{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}
120#endif
121bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;
122#ifdef CLIP_ZERO_TO_ONE
123coord.z=-1.0+2.0*coord.z; 
124#endif
125#ifdef DEPTH_D24
126float depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r);
127#else
128float depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5));
129#endif
130return coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_
130size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5;
131#ifdef DEPTH_D24
132highp vec4 depth=vec4(
133texture(u_depth,uv-df.xz).r,texture(u_depth,uv+df.xz).r,texture(u_depth,uv-df.zy).r,texture(u_depth,uv+df.zy).r
134);depth=unpack_depth4(depth);
135#else
136highp vec4 depth=vec4(
137unpack_depth_rgba(texture(u_depth,uv-df.xz)),unpack_depth_rgba(texture(u_depth,uv+df.xz)),unpack_depth_rgba(texture(u_depth,uv-df.zy)),unpack_depth_rgba(texture(u_depth,uv+df.zy))
138);
139#endif
140return depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5;
141#ifdef CLIP_ZERO_TO_ONE
142coord.z=-1.0+2.0*coord.z; 
143#endif
144int NX=3;int NY=4;highp vec2 df=u_occluder_half_size*u_depth_size_inv;highp vec2 oneStep=2.0*u_occluder_half_size*u_depth_size_inv/vec2(NX-1,NY-1);highp float res=0.0;for (int y=0; y < NY;++y) {for (int x=0; x < NX;++x) {
145#ifdef DEPTH_D24
146highp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r);
147#else
148highp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)));
149#endif
150res+=1.0-clamp(300.0*(coord.z+u_occlusion_depth_offset-depth),0.0,1.0);}}res=clamp(2.0*res/float(NX*NY)-0.5,0.0,1.0);return res;}highp float occlusionFade(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;
151#ifdef CLIP_ZERO_TO_ONE
152coord.z=-1.0+2.0*coord.z; 
153#endif
154highp vec4 depth=getCornerDepths(coord.xy);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z+u_occlusion_depth_offset)-depth),0.0,1.0));}
155#else
156bool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; }
157#endif`,Ec=`#ifdef FOG
158uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;out vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);}
159#endif`,Ln=`#ifdef FOG
160uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;
161#ifdef FLIP_Y
162uv.y=1.0-uv.y;
163#endif
164highp vec3 ray_dir=mix(
165mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos,float opacity_limit) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,min(opacity,opacity_limit));}vec3 fog_apply(vec3 color,vec3 pos) {return fog_apply(color,pos,1.0);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}
165vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x > 0.0 || u_fog_vertical_limit.y > 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) {return color;}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}
166#endif`,wl=`#ifdef RASTER_ARRAY
167uniform highp sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);ivec4 _raTexLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}vec2 _raTexLinearMix(highp vec2 fxy,highp vec4 colorMix,highp float colorOffset,highp vec4 t00,highp vec4 t10,highp vec4 t01,highp vec4 t11) {vec2 c00=t00==NODATA ? vec2(0) : vec2(colorOffset+dot(t00,colorMix),1);vec2 c10=t10==NODATA ? vec2(0) : vec2(colorOffset+dot(t10,colorMix),1);vec2 c01=t01==NODATA ? vec2(0) : vec2(colorOffset+dot(t01,colorMix),1);vec2 c11=t11==NODATA ? vec2(0) : vec2(colorOffset+dot(t11,colorMix),1);return mix(mix(c01,c11,fxy.x),mix(c00,c10,fxy.x),fxy.y);}vec2 raTexture2D_image0_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image0,c.yz,0),texelFetch(u_image0,c.xz,0),texelFetch(u_image0,c.yw,0),texelFetch(u_image0,c.xw,0)
168);}vec2 raTexture2D_image1_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image1,c.yz,0),texelFetch(u_image1,c.xz,0),texelFetch(u_image1,c.yw,0),texelFetch(u_image1,c.xw,0)
169);}vec2 raTexture2D_image0_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image0,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}vec2 raTexture2D_image1_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image1,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}
170#endif`,We=`#ifdef RASTER_ARRAY
171uniform sampler2D u_velocity;uniform mediump vec2 u_velocity_res;uniform mediump float u_max_speed;const vec4 NO_DATA=vec4(1);const vec2 INVALID_VELOCITY=vec2(-1);uniform highp vec2 u_uv_offset;uniform highp float u_data_offset;uniform highp vec2 u_data_scale;ivec4 rasterArrayLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}highp vec2 lookup_velocity(highp vec2 uv) {uv=u_uv_offset.x+u_uv_offset.y*uv;highp vec2 fxy;ivec4 c=rasterArrayLinearCoord(uv,u_velocity_res,fxy);highp vec4 tl=texelFetch(u_velocity,c.yz,0);highp vec4 tr=texelFetch(u_velocity,c.xz,0);highp vec4 bl=texelFetch(u_velocity,c.yw,0);highp vec4 br=texelFetch(u_velocity,c.xw,0);if (tl==NO_DATA) {return INVALID_VELOCITY;}if (tr==NO_DATA) {return INVALID_VELOCITY;}if (bl==NO_DATA) {return INVALID_VELOCITY;}if (br==NO_DATA) {return INVALID_VELOCITY;}highp vec4 t=mix(mix(bl,br,fxy.x),mix(tl,tr,fxy.x),fxy.y);highp vec2 velocity=u_data_offset+vec2(dot(t.rg,u_data_scale),dot(t.ba,u_data_scale));velocity.y=-velocity.y;velocity/=max(u_max_speed,length(velocity));return velocity;}
172#endif
173uniform highp float u_particle_pos_scale;uniform highp vec2 u_particle_pos_offset;highp vec4 pack_pos_to_rgba(highp vec2 p) {highp vec2 v=(p+u_particle_pos_offset)/u_particle_pos_scale;highp vec4 r=vec4(v.x,fract(v.x*255.0),v.y,fract(v.y*255.0));return vec4(r.x-r.y/255.0,r.y,r.z-r.w/255.0,r.w);}highp vec2 unpack_pos_from_rgba(highp vec4 v) {v=floor(v*255.0+0.5)/255.0;highp vec2 p=vec2(v.x+(v.y/255.0),v.z+(v.w/255.0));return u_particle_pos_scale*p-u_particle_pos_offset;}`,Qu=`#ifdef RENDER_SHADOWS
174uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_normal_offset;vec3 shadow_normal_offset(vec3 normal) {float tileInMeters=u_shadow_normal_offset[0];vec3 n=vec3(-normal.xy,tileInMeters*normal.z);float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return n*dotScale;}vec3 shadow_normal_offset_model(vec3 normal) {vec3 transformed_normal=vec3(-normal.xy,normal.z);float NDotL=dot(normalize(transformed_normal),u_shadow_direction);float dotScale=min(1.0-NDotL,1.0)*0.5+0.5;return normal*dotScale;}float shadow_normal_offset_multiplier0() {return u_shadow_normal_offset[1];}float shadow_normal_offset_multiplier1() {return u_shadow_normal_offset[2];}
175#endif`,eh=`#ifdef RENDER_SHADOWS
176precision highp sampler2DShadow;uniform sampler2DShadow u_shadowmap_0;uniform sampler2DShadow u_shadowmap_1;uniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;float shadow_sample(sampler2DShadow shadowmap,highp vec3 pos,high
176p float bias) {
177#ifdef CLIP_ZERO_TO_ONE
178highp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z-bias);
179#else
180highp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z*0.5+0.5-bias);
181#endif
182return texture(shadowmap,coord);}float shadow_occlusion(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,highp float bias) {light_view_pos0.xyz/=light_view_pos0.w;
183#ifdef SHADOWS_SINGLE_CASCADE
184vec2 abs_bounds=abs(light_view_pos0.xy);if (abs_bounds.x >=1.0 || abs_bounds.y >=1.0) {return 0.0;}return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias);
185#else
186light_view_pos1.xyz/=light_view_pos1.w;vec4 abs_bounds=abs(vec4(light_view_pos0.xy,light_view_pos1.xy));if (abs_bounds.x < 1.0 && abs_bounds.y < 1.0) {return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias);}if (abs_bounds.z >=1.0 || abs_bounds.w >=1.0) {return 0.0;}float occlusion1=shadow_sample(u_shadowmap_1,light_view_pos1.xyz,bias);return clamp(mix(occlusion1,0.0,smoothstep(u_fade_range.x,u_fade_range.y,view_depth)),0.0,1.0);
187#endif
188}highp float calculate_shadow_bias(float NDotL) {
189#ifdef NORMAL_OFFSET
190return 0.5*u_shadow_bias.x;
191#else
192return 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z));
193#endif
194}float shadowed_light_factor_normal(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_opacity(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,float shadow_opacity) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias)*shadow_opacity;return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_unbiased(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}highp vec2 compute_receiver_plane_depth_bias(highp vec3 pos_dx,highp vec3 pos_dy)
195{highp vec2 biasUV=vec2(
196pos_dy.y*pos_dx.z-pos_dx.y*pos_dy.z,pos_dx.x*pos_dy.z-pos_dy.x*pos_dx.z);biasUV*=1.0/((pos_dx.x*pos_dy.y)-(pos_dx.y*pos_dy.x));return biasUV;}float shadowed_light_factor_plane_bias(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {highp vec3 light_view_pos0_xyz=light_view_pos0.xyz/light_view_pos0.w*0.5+0.5;highp vec3 light_view_pos0_ddx=dFdx(light_view_pos0_xyz);highp vec3 light_view_pos0_ddy=dFdy(light_view_pos0_xyz);highp vec2 plane_depth_bias=compute_receiver_plane_depth_bias(light_view_pos0_ddx,light_view_pos0_ddy);highp float bias=dot(vec2(u_shadow_texel_size,u_shadow_texel_size),plane_depth_bias)+0.0001;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadowed_light_factor(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadow_occlusion(float ndotl,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=calculate_shadow_bias(ndotl);return shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);}
197#endif`;const Tl=/#include\s+"([^"]+)"/g,yo=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g,th=/\b[A-Za-z_][A-Za-z0-9_]*\b/g,qs=new Set(["ifdef","ifndef","elif","if","defined"]),Hs=new Set;_s(Yu,Hs),_s(wa,Hs),_s(Ku,Hs);const ms={"_prelude_fog.vertex.glsl":Ec,"_prelude_terrain.vertex.glsl":Ju,"_prelude_shadow.vertex.glsl":Qu,"_prelude_material_table.vertex.glsl":`#ifdef HAS_SHADER_STORAGE_BLOCK_material_buffer
198#define MATERIAL_TABLE_DEBUG 0
199uniform int u_material_offset;uniform int u_vertex_offset;layout(std140,binding=0)readonly buffer material_buffer{uvec4 material_data[];};struct MaterialInfo{uint dataOffset;
200#if MATERIAL_TABLE_DEBUG
201vec4 colorDebug;
202#endif
203};uint read_buf_no_offset(uint iDword) {return material_data[iDword/4u][iDword % 4u];}uint read_buf(uint iDword) {iDword+=uint(u_material_offset/4);return read_buf_no_offset(iDword);}
203float read_buf_float(uint iDword){return uintBitsToFloat(read_buf(iDword));}uint read_buf_uint8(uint iDword,uint iUint8){uint dwordOffset=iDword+(iUint8/4u);uint byteOffset=iUint8 & 3u;uint bitOffset=8u*byteOffset;uint mask=0xffu << bitOffset;uint dwordVal=read_buf(dwordOffset);return (dwordVal & mask) >> bitOffset;}uint read_buf_uint16(uint iDword,uint iUint16){uint dwordOffset=iDword+(iUint16 >> 1u);uint bitOffset=(iUint16 & 1u)*16u;uint mask=0xffffu << bitOffset;uint dwordVal=read_buf(dwordOffset);return (dwordVal & mask) >> bitOffset;}uint nrDwordsForVertexIdEntries(uint nrMaterialLookupEntries) {return nrMaterialLookupEntries;}uint nrDwordsForMaterialIdEntries(uint nrMaterialLookupEntries) {return (nrMaterialLookupEntries*2u+3u)/4u;}uint findRangeBinarySearch(uint vertexId,uint numRanges,uint dwordOffset) {uint left=0u;uint right=numRanges-1u;for (uint i=0u; i < 16u; i++) { 
204if (left > right) {break;}uint mid=(left+right)/2u;uint start=read_buf(dwordOffset+mid);uint nextStart=(mid+1u < numRanges) ? read_buf(dwordOffset+mid+1u) : 0xffffffffu;if (vertexId >=start && vertexId < nextStart) {return mid;} else if (vertexId < start) {if (mid==0u) {break;}right=mid-1u;} else {left=mid+1u;}}return 0u; 
205}uint readVertexId(uint dwordOffset,uint iMaterialLookupEntry) {return read_buf(dwordOffset+iMaterialLookupEntry);}uint findRange(uint vertexId,uint numRanges,uint dwordOffset) {uint iRange;if(numRanges <=64u){uint vertexBegin;for(iRange=0u; iRange < numRanges;++iRange) {vertexBegin=readVertexId(dwordOffset,iRange);if(vertexBegin > vertexId) {break;}}iRange=iRange==0u? 0u : iRange-1u;} else { 
206iRange=findRangeBinarySearch(vertexId,numRanges,dwordOffset);}return iRange;}MaterialInfo read_material_info(uint vertex_id) {MaterialInfo info;
207#if MATERIAL_TABLE_DEBUG
208const vec4 red=vec4(1.0,0.0,0.0,1.0);const vec4 orange=vec4(1.0,0.5,0.0,1.0);const vec4 yellow=vec4(1.0,1.0,0.0,1.0);const vec4 green=vec4(0.0,1.0,0.0,1.0);const vec4 indigo=vec4(0.294,0.0,0.510,1.0);const vec4 blue=vec4(0.0,0.0,1.0,1.0);const vec4 purple=vec4(0.5,0.0,0.5,1.0);const vec4 pink=vec4(1.0,0.0,1.0,1.0);info.colorDebug=green;
209#endif
210uint offset=0u;
211#if MATERIAL_TABLE_DEBUG
212bool keepFinding=true;uint magic=read_buf(offset);if(magic !=0xCAFEBABEu) {info.colorDebug=red;keepFinding=false;return info;}
213#endif
214offset++;
215#if MATERIAL_TABLE_DEBUG
216uint nrMaterials=read_buf(offset);uint nrVertices=read_buf(offset+1u);if(keepFinding && vertex_id >=nrVertices) {info.colorDebug=red;keepFinding=false;}
217#endif
218offset+=2u;uint nrMaterialLookupEntries=read_buf(offset++);uint perMaterialEntrySizeDwords=read_buf(offset++);
219#if MATERIAL_TABLE_DEBUG
220if(keepFinding && perMaterialEntrySizeDwords !=1u) {info.colorDebug=red;keepFinding=false;}
221#endif
222uint iMaterialLookup=findRange(vertex_id,nrMaterialLookupEntries,offset);
223#if MATERIAL_TABLE_DEBUG
224if(keepFinding)
225{uint vertexBeginCheck=readVertexId(offset,iMaterialLookup);if(vertexBeginCheck > vertex_id) {info.colorDebug=red;keepFinding=false;}if(iMaterialLookup < nrMaterialLookupEntries-1u) {uint vertexEndCheck=readVertexId(offset,iMaterialLookup+1u);if(vertexEndCheck <=vertex_id) {info.colorDebug=red;keepFinding=false;}}}
226#endif
227offset+=nrDwordsForVertexIdEntries(nrMaterialLookupEntries);uint materialId=iMaterialLookup;
228#if MATERIAL_TABLE_DEBUG
229if(keepFinding) {if(materialId >=nrMaterialLookupEntries) {info.colorDebug=red;}}
230#endif
231info.dataOffset=offset+materialId*perMaterialEntrySizeDwords;return info;}uint get_data_location(const MaterialInfo matInfo,uint attribOffsetBytes)
232{uint attribFieldOffsetDwords=attribOffsetBytes/4u;return matInfo.dataOffset+attribFieldOffsetDwords;}vec4 read_material_vec4(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return vec4(read_buf_float(loc),read_buf_float(loc+1u),read_buf_float(loc+2u),read_buf_float(loc+3u));}vec2 read_material_vec2(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return vec2(read_buf_float(loc),read_buf_float(loc+1u));}float read_material_float(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return read_buf_float(loc);}
233#define GET_ATTRIBUTE_float(attrib,matInfo,attrib_offset) read_material_float(matInfo,attrib_offset)
234#define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_offset) read_material_vec4(matInfo,attrib_offset)
235#define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_offset) read_material_vec2(matInfo,attrib_offset)
236#define DECLARE_MATERIAL_TABLE_INFO MaterialInfo materialInfo=read_material_info(uint(gl_VertexID));
237#define DECLARE_MATERIAL_TABLE_INFO_DEBUG(dbgColor) MaterialInfo materialInfo=read_material_info(uint(gl_VertexID)); dbgColor=materialInfo.colorDebug;
238#endif`,"_prelude_fog.fragment.glsl":Ln,"_prelude_shadow.fragment.glsl":eh,"_prelude_lighting.glsl":`
239#ifdef LIGHTING_3D_MODE
240uniform mediump vec3 u_lighting_ambient_color;uniform mediump vec3 u_lighting_directional_dir;uniform mediump vec3 u_lighting_directional_color;uniform mediump vec3 u_ground_radiance;float calculate_ambient_directional_factor(vec3 normal) {float NdotL=dot(normal,u_lighting_directional_dir);const float factor_reduction_max=0.3;float dir_luminance=dot(u_lighting_directional_color,vec3(0.2126,0.7152,0.0722));float directional_factor_min=1.0-factor_reduction_max*min(dir_luminance,1.0);float ambient_directional_factor=mix(directional_factor_min,1.0,min((NdotL+1.0),1.0
240));const float vertical_factor_min=0.92;float vertical_factor=mix(vertical_factor_min,1.0,normal.z*0.5+0.5);return vertical_factor*ambient_directional_factor;}vec3 linearProduct(vec3 srgbIn,vec3 k) {return srgbIn*pow(k,vec3(1./2.2));}vec3 apply_lighting(vec3 color,vec3 normal,float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return linearProduct(color,ambient_contrib+directional_contrib);}vec4 apply_lighting(vec4 color,vec3 normal,float dir_factor) {return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting(vec3 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return apply_lighting(color.rgb,normal,dir_factor);}vec4 apply_lighting(vec4 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting_ground(vec3 color) {return color*u_ground_radiance;}vec4 apply_lighting_ground(vec4 color) {return vec4(apply_lighting_ground(color.rgb),color.a);}float calculate_NdotL(vec3 normal) {const float ext=0.70710678118;return (clamp(dot(normal,u_lighting_directional_dir),-ext,1.0)+ext)/(1.0+ext);}vec4 apply_lighting_with_emission_ground(vec4 color,float emissive_strength) {return mix(apply_lighting_ground(color),color,emissive_strength);}vec3 compute_flood_lighting(vec3 flood_light_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=flood_light_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);float occlusion_ramp=smoothstep(0.0,0.2,1.0-occlusion);return mix(fully_occluded_color,flood_light_color,occlusion_ramp);}vec3 compute_emissive_draped(vec3 unlit_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=unlit_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);return mix(fully_occluded_color,unlit_color,1.0-occlusion);}
241#endif`,"_prelude_raster_array.glsl":wl,"_prelude_raster_particle.glsl":We},Ic={};jt("",Ju),jt(Ln,Ec),jt(eh,Qu),jt(wl,""),jt(We,"");const df=jt(Ku,wa),Ac=Yu,Mm=[`
242#if defined(GL_EXT_blend_func_extended) && defined(DUAL_SOURCE_BLENDING)
243#extension GL_EXT_blend_func_extended : require
244#endif`,"precision mediump float;",Ac,df.fragmentSource].join(`
245`),ff=["precision highp float;",Ac,df.vertexSource].join(`
246`);var ih={background:jt(`#include "_prelude_fog.fragment.glsl"
247#include "_prelude_lighting.glsl"
248uniform vec4 u_color;uniform float u_opacity;uniform mediump float u_emissive_strength;
249#ifdef LIGHTING_3D_MODE
250in vec4 v_color;
251#endif
252void main() {vec4 out_color;
253#ifdef LIGHTING_3D_MODE
254out_color=v_color;
255#else
256out_color=u_color;
257#endif
258#ifdef FOG
259out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
260#endif
261glFragColor=out_color*u_opacity;
262#ifdef USE_MRT1
263out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
264#endif
265#ifdef OVERDRAW_INSPECTOR
266glFragColor=vec4(1.0);
267#endif
268HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
269#include "_prelude_lighting.glsl"
270in vec2 a_pos;uniform mat4 u_matrix;uniform mediump float u_emissive_strength;
271#ifdef LIGHTING_3D_MODE
272uniform mediump vec4 u_color;out vec4 v_color;
273#endif
274void main() {gl_Position=u_matrix*vec4(a_pos,0,1);
275#ifdef LIGHTING_3D_MODE
276v_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength);
277#endif
278#ifdef FOG
279v_fog_pos=fog_position(a_pos);
280#endif
281}`),backgroundPattern:jt(`#include "_prelude_fog.fragment.glsl"
282#include "_prelude_lighting.glsl"
283uniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform float u_emissive_strength;uniform sampler2D u_image;in highp vec2 v_pos;void main() {highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=textureLodCustom(u_image,pos,v_pos);
284#ifdef LIGHTING_3D_MODE
285out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
286#endif
287#ifdef FOG
288out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
289#endif
290glFragColor=out_color*u_opacity;
291#ifdef USE_MRT1
292out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
293#endif
294#ifdef OVERDRAW_INSPECTOR
295glFragColor=vec4(1.0);
296#endif
297HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
298uniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec2 u_pattern_units_to_pixels;in vec2 a_pos;out highp vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_pattern_units_to_pixels,a_pos);
299#ifdef FOG
300v_fog_pos=fog_position(a_pos);
301#endif
302}`),building:jt(`#include "_prelude_fog.fragment.glsl"
303#include "_prelude_shadow.fragment.glsl"
304#include "_prelude_lighting.glsl"
305const float window_depth=0.5;const float ao_radius=0.2;in vec4 v_color;in highp vec3 v_normal;in highp vec3 v_pos;
306#ifdef BUILDING_FAUX_FACADE
307in lowp float v_faux_facade;in highp float v_faux_facade_ed;in highp vec2 v_faux_facade_window;in highp vec2 v_faux_facade_floor;in highp vec2 v_faux_facade_range;in highp float v_aspect;in highp vec3 v_tbn_0;in highp vec3 v_tbn_1;in highp vec3 v_tbn_2;in highp vec4 v_faux_color_emissive;uniform float u_faux_facade_ao_intensity;
308#endif
309#ifdef RENDER_SHADOWS
310in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;
311#endif
312#ifdef FLOOD_LIGHT
313in highp float v_flood_radius;in float v_has_flood_light;
314#endif
315uniform lowp float u_opacity;uniform vec3 u_camera_pos;uniform highp float u_tile_to_meter;uniform float u_facade_emissive_chance;uniform vec3 u_flood_light_color;uniform float u_flood_light_intensity;vec3 linearTosRGB(in vec3 color) {return pow(color,vec3(1./2.2));}
316#ifdef BUILDING_FAUX_FACADE
317float hash12(in vec2 p) {vec3 p3 =fract(vec3(p.xyx)*0.1031);p3+=dot(p3,p3.yzx+33.33);return fract((p3.x+p3.y)*p3.z);}float min3(in vec3 v) {return min(min(v.x,v.y),v.z);}vec2 get_uv_mask_id(in vec2 q,out float mask,out vec2 id) {vec2 p=q;mask=step(v_faux_facade_range.x,p.y)*step(p.y,v_faux_facade_range.y);p.y=p.y-v_faux_facade_range.x;vec2 uv=modf(p/v_faux_facade_floor,id);vec4 d=(v_faux_facade_floor.xyxy+vec4(-v_faux_facade_window,v_faux_facade_window))*0.5;vec4 edge=d/v_faux_facade_floor.xyxy;vec2 m=step(edge.xy,uv)*step(uv,edge.zw);mask*=m.x*m.y;uv-=vec2(0.5);uv*=vec2(0.5)/(vec2(0.5)-edge.xy);uv+=vec2(0.5);return uv;}float ray_unit_box(in vec3 ray_o,in vec3 ray_d,in vec3 bmin,in vec3 bmax) {vec3 planes=mix(bmin,bmax,step(0.0,ray_d));vec3 t=(planes-ray_o)/ray_d;return min3(t);}float get_emissive(in vec2 id) {if (u_facade_emissive_chance > 0.0) {return (step(hash12(id),u_facade_emissive_chance)+0.05)*v_faux_color_emissive.a;}return 0.0;}vec3 get_shade_info(in vec3 v,in vec3 v_normalized,in vec3 color,in vec2 id,in mat3 tbn,inout vec3 out_normal,inout float out_emissive) {vec3 out_color=color;vec3 abs_v=abs(v_normalized);bool x_major=abs_v.x >=abs_v.y && abs_v.x >=abs_v.z;bool y_major=abs_v.y >=abs_v.x && abs_v.y >=abs_v.z;bool z_major=abs_v.z >=abs_v.x && abs_v.z >=abs_v.y;
318#if 0
319if (x_major) {out_color=v.x > 0.0 ? vec3(1.0,0.0,0.0) : vec3(0.0,1.0,1.0);} else if (y_major) {out_color=v.y > 0.0 ? vec3(0.0,1.0,0.0) : vec3(1.0,0.0,1.0);} else if (z_major) {out_color=v.z > 0.0 ? vec3(0.0,0.0,1.0) : vec3(1.0,1.0,0.0);}out_emissive=1.0;
320#else
321if (x_major) {out_normal=sign(v.x)*tbn[0];} else if (y_major) {out_normal=vec3(0.0,0.0,-sign(v.y));} else if (z_major) {out_color=v_faux_color_emissive.rgb;out_emissive=v.z <=0.0 ? get_emissive(id) : out_emissive;}float ao=1.0;if (u_faux_facade_ao_intensity > 0.0) {vec4 ao_range=v_faux_facade_window.xxyy*0.5-vec4(0,ao_radius,0,ao_radius);vec2 ao_range_z=vec2(window_depth*0.5)-vec2(0.0,ao_radius);if (x_major || y_major) {ao*=smoothstep(-ao_range_z.x,-ao_range_z.y,v.z);} else if (z_major) {ao*=smoothstep(-ao_range.x,-ao_range.y,v.x)*(1.0-smoothstep(ao_range.y,ao_range.x,v.x));ao*=smoothstep(-ao_range.z,-ao_range.w,v.y)*(1.0-smoothstep(ao_range.w,ao_range.z,v.y));}ao=mix(1.0,min(1.0,ao+0.25),u_faux_facade_ao_intensity);}out_color*=ao;
322#endif
323return out_color;}
324#endif
325vec3 apply_lighting_linear(in vec3 color,in vec3 normal,in float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return color*(ambient_contrib+directional_contrib);}void main() {vec3 normal=normalize(v_normal);vec3 base_color=v_color.rgb;float emissive=v_color.a;
326#ifdef BUILDING_FAUX_FACADE
327if (v_faux_facade > 0.0) {mat3 tbn=mat3(v_tbn_0,v_tbn_1,v_tbn_2);vec3 v=vec3(v_pos.xy,v_pos.z/u_tile_to_meter)-u_camera_pos;vec3 view_tangent=transpose(tbn)*v;vec2 q=vec2(v_faux_facade_ed,v_pos.z);float mask=0.0;vec2 id=vec2(0.0);vec2 uv=get_uv_mask_id(q,mask,id);uv*=v_faux_facade_window;vec3 bmin=vec3(0.0,0.0,-window_depth);vec3 bmax=bmin+vec3(v_faux_facade_window,window_depth);vec3 ray_o=vec3(uv,0.0);vec3 ray_d=normalize(view_tangent);float t_min=ray_unit_box(ray_o,ray_d,bmin,bmax);vec3 hit=ray_o+t_min*ray_d;vec3 r=vec3(v_faux_facade_window,-window_depth);hit-=r*0.5;vec3 normalized=hit/r;vec3 out_normal=normal;float out_emissive=emissive;vec3 room_color=get_shade_info(hit,normalized,base_color,id,tbn,out_normal,out_emissive);base_color=mix(base_color,room_color,mask);normal=mix(normal,out_normal,mask);emissive=mix(emissive,out_emissive,mask);}
328#endif
329vec4 color=vec4(base_color,1.0);vec3 xy_flipped_normal=vec3(-normal.xy,normal.z);float shadowed_lighting_factor=0.0;
330#ifdef RENDER_SHADOWS
331#ifdef RENDER_CUTOFF
332shadowed_lighting_factor=shadowed_light_factor_normal_opacity(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;}
333#else
334shadowed_lighting_factor=shadowed_light_factor_normal(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);
335#endif
336#else
337shadowed_lighting_factor=dot(xy_flipped_normal,u_lighting_directional_dir);
338#endif
339color.rgb=apply_lighting_linear(color.rgb,xy_flipped_normal,shadowed_lighting_factor);color.rgb=linearTosRGB(color.rgb);
340#ifdef FLOOD_LIGHT
341float flood_radiance=(1.0-min(v_pos.z/v_flood_radius,1.0))*u_flood_light_intensity*v_has_flood_light;color.rgb=mix(color.rgb,u_flood_light_color,flood_radiance);
342#endif
343color.rgb=mix(color.rgb,linearTosRGB(base_color.rgb),emissive);
344#ifdef FOG
345color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,v_pos.z));
346#endif
347color*=u_opacity;
348#ifdef INDICATOR_CUTOUT
349color=applyCutout(color,v_pos.z);
350#endif
351#ifdef FEATURE_CUTOUT
352color=apply_feature_cutout(color,gl_FragCoord);
353#endif
354glFragColor=color; 
355#ifdef DEBUG_SHOW_NORMALS
356color.rgb=xy_flipped_normal*0.5+vec3(0.5,0.5,0.5);color.a=1.0;glFragColor=color;
357#endif
358#ifdef OVERDRAW_INSPECTOR
359glFragColor=vec4(1.0);
360#endif
361HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
362#include "_prelude_shadow.vertex.glsl"
363in vec3 a_pos_3f;in vec3 a_normal_3;in vec3 a_centroid_3;in float a_flood_light_wall_radius_1i16;in vec4 a_faux_facade_data;in vec2 a_faux_facade_vertical_range;uniform mat4 u_matrix;uniform mat4 u_normal_matrix;uniform highp float u_tile_to_meter;out vec4 v_color;out vec3 v_normal;out highp vec3 v_pos;
364#ifdef BUILDING_FAUX_FACADE
365out lowp float v_faux_facade;out highp float v_faux_facade_ed;out highp vec2 v_faux_facade_window;out highp vec2 v_faux_facade_floor;out highp vec2 v_faux_facade_range;out highp float v_aspect;out highp vec3 v_tbn_0;out highp vec3 v_tbn_1;out highp vec3 v_tbn_2;out highp vec4 v_faux_color_emissive;
366#endif
367#ifdef RENDER_SHADOWS
368uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;
369#endif
370#ifdef FLOOD_LIGHT
371out highp float v_flood_radius;out float v_has_flood_light;
372#endif
373const float MAX_UINT_16=65535.0;const float MAX_INT_16=32767.0;const float MAX_UINT_8=255.0;const float TWO_POW_8=256.0;const float FLOOD_LIGHT_MAX_RADIUS_METER=2048.0;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}
374#ifdef BUILDING_FAUX_FACADE
375mat3 get_tbn(in vec3 normal) {const vec3 bitangent=vec3(0.0,0.0,1.0);vec3 tangent=normalize(vec3(normal.y,-normal.x,0.0));return mat3(tangent,bitangent,normal);}
376#endif
377#pragma mapbox: define-attribute-vertex-shader-only highp vec2 part_color_emissive
378#pragma mapbox: define-attribute-vertex-shader-only highp vec2 faux_facade_color_emissive
379void main() {
380#pragma mapbox: initialize-attribute-custom highp vec2 part_color_emissive
381#pragma mapbox: initialize-attribute-custom highp vec2 faux_facade_color_emissive
382#ifdef FLOOD_LIGHT
383v_flood_radius=(a_flood_light_wall_radius_1i16/MAX_INT_16*FLOOD_LIGHT_MAX_RADIUS_METER);v_has_flood_light=step(0.0,v_flood_radius);
384#endif
385vec4 color_emissive=decode_color(part_color_emissive);v_color=vec4(sRGBToLinear(color_emissive.rgb),color_emissive.a);vec3 a_normal_3f=a_normal_3/MAX_INT_16;v_normal=vec3(u_normal_matrix*vec4(a_normal_3f,0.0));float hidden=0.0;float depth_offset=0.0;
386#ifdef BUILDING_FAUX_FACADE
387v_faux_facade=a_faux_facade_data.x;if (v_faux_facade > 0.0) {v_faux_facade_ed=a_faux_facade_data.x *u_tile_to_meter;float window_x_perc=floor(a_faux_facade_data.y/TWO_POW_8);float window_y_perc=a_faux_facade_data.y-TWO_POW_8*window_x_perc;vec2 window_perc=vec2(window_x_perc,window_y_perc)/MAX_UINT_8;v_faux_facade_floor=(a_faux_facade_data.zw/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_faux_facade_window=window_perc*v_faux_facade_floor;v_faux_facade_range=(a_faux_facade_vertical_range/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_aspect=v_faux_facade_window.x/v_faux_facade_window.y;mat3 tbn=get_tbn(normalize(v_normal));v_tbn_0=tbn[0];v_tbn_1=tbn[1];v_tbn_2=tbn[2];v_faux_color_emissive=decode_color(faux_facade_color_emissive);v_faux_color_emissive.rgb=sRGBToLinear(v_faux_color_emissive.rgb);float height=a_centroid_3.z;depth_offset=min(1000.0,height)*0.0000002;}
388#endif
389v_pos=a_pos_3f;
390#ifdef RENDER_CUTOFF
391vec4 ground=u_matrix*vec4(a_centroid_3,1.0);v_cutoff_opacity=cutoff_opacity(u_cutoff_params,ground.z);hidden=float(v_cutoff_opacity==0.0);v_pos.z*=v_cutoff_opacity;
392#endif
393#ifdef RENDER_SHADOWS
394vec3 shadow_pos=v_pos;
395#ifdef NORMAL_OFFSET
396vec3 offset=shadow_normal_offset_model(v_normal);shadow_pos+=offset*shadow_normal_offset_multiplier0();
397#endif
398v_pos_light_view_0=u_light_matrix_0*vec4(shadow_pos,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(shadow_pos,1.0);
399#endif
400#ifdef FOG
401v_fog_pos=fog_position(v_pos);
402#endif
403gl_Position=mix(u_matrix*vec4(v_pos,1),AWAY,hidden);gl_Position.z-=depth_offset*gl_Position.w;}`),buildingBloom:jt(`in vec4 v_color_emissive;
404#pragma mapbox: define-attribute highp vec4 bloom_attenuation
405#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation
406float saturate(float val) {return clamp(val,0.0,1.0);}void main() {float emission=v_color_emissive.a;float opacity=1.0;
407#ifdef HAS_ATTRIBUTE_a_bloom_attenuation
408float distance=length(vec2(1.3*max(0.0,abs(bloom_attenuation.x)-bloom_attenuation.z),bloom_attenuation.y));distance+= mix(0.5,0.0,clamp(emission-1.0,0.0,1.0));
408opacity*=saturate(1.0-distance*distance);
409#endif
410#ifdef RENDER_CUTOFF
411opacity*=v_cutoff_opacity;
412#endif
413glFragColor=vec4(v_color_emissive.rgb,1.0)*opacity;}`,`in vec3 a_pos_3f;
414#pragma mapbox: define-attribute-vertex-shader-only highp vec2 part_color_emissive
415#pragma mapbox: define-attribute highp vec4 bloom_attenuation
416out vec4 v_color_emissive;uniform mat4 u_matrix;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {
417#pragma mapbox: initialize-attribute-custom highp vec2 part_color_emissive
418#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation
419#ifdef HAS_ATTRIBUTE_a_part_color_emissive
420vec4 color_emissive=decode_color(part_color_emissive);float part_emissive=color_emissive.a*5.0;v_color_emissive=vec4(sRGBToLinear(color_emissive.rgb),part_emissive);
421#else
422v_color_emissive=vec4(1.0);
423#endif
424gl_Position=u_matrix*vec4(a_pos_3f,1.0);
425#ifdef RENDER_CUTOFF
426v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);
427#endif
428}`),buildingDepth:jt(`in highp float v_depth;void main() {
429#ifndef DEPTH_TEXTURE
430glFragColor=pack_depth(v_depth);
431#endif
432}`,"in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;void main() {gl_Position=u_matrix*vec4(a_pos_3f,1.0);v_depth=gl_Position.z/gl_Position.w;}"),circle:jt(`#include "_prelude_fog.fragment.glsl"
433#include "_prelude_lighting.glsl"
434in vec3 v_data;in float v_visibility;
435#pragma mapbox: define highp vec4 color
436#pragma mapbox: define mediump float radius
437#pragma mapbox: define lowp float blur
438#pragma mapbox: define lowp float opacity
439#pragma mapbox: define highp vec4 stroke_color
440#pragma mapbox: define mediump float stroke_width
441#pragma mapbox: define lowp float stroke_opacity
442uniform float u_emissive_strength;void main() {
443#pragma mapbox: initialize highp vec4 color
444#pragma mapbox: initialize mediump float radius
445#pragma mapbox: initialize lowp float blur
446#pragma mapbox: initialize lowp float opacity
447#pragma mapbox: initialize highp vec4 stroke_color
448#pragma mapbox: initialize mediump float stroke_width
449#pragma mapbox: initialize lowp float stroke_opacity
450vec2 extrude=v_data.xy;float blur_positive=blur < 0.0 ? 0.0 : 1.0;lowp float antialiasblur=v_data.z;float extrude_length=length(extrude)+antialiasblur*(1.0-blur_positive);float antialiased_blur=-max(abs(blur),antialiasblur);float antialiase_blur_opacity=smoothstep(0.0,antialiasblur,extrude_length-1.0);float opacity_t=blur_positive==1.0 ? 
451smoothstep(0.0,-antialiased_blur,1.0-extrude_length) : 
452smoothstep(antialiased_blur,0.0,extrude_length-1.0)-antialiase_blur_opacity;float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(
453antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)
454);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);
455#ifdef LIGHTING_3D_MODE
456out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
457#endif
458#ifdef FOG
459out_color=fog_apply_premultiplied(out_color,v_fog_pos);
460#endif
461glFragColor=out_color*(v_visibility*opacity_t);
462#ifdef OVERDRAW_INSPECTOR
463glFragColor=vec4(1.0);
464#endif
465}`,`#include "_prelude_fog.vertex.glsl"
466#include "_prelude_terrain.vertex.glsl"
467#define NUM_VISIBILITY_RINGS 2
468#define INV_SQRT2 0.70710678
469#define ELEVATION_BIAS 0.0001
470#define NUM_SAMPLES_PER_RING 16
471uniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in vec2 a_pos;
472#ifdef PROJECTION_GLOBE_VIEW
473in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;
474#endif
475#ifdef ELEVATED_ROADS
476in float a_circle_z_offset;
477#endif
478out vec3 v_data;out float v_visibility;
479#pragma mapbox: define highp vec4 color
480#pragma mapbox: define mediump float radius
481#pragma mapbox: define lowp float blur
482#pragma mapbox: define lowp float opacity
483#pragma mapbox: define highp vec4 stroke_color
484#pragma mapbox: define mediump float stroke_width
485#pragma mapbox: define lowp float stroke_opacity
486vec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*v
486iew_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {
487#if defined(TERRAIN)
488return elevation(pos)+ELEVATION_BIAS;
489#else
490return 0.0;
491#endif
492}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);
493#ifdef PITCH_WITH_MAP
494#ifdef PROJECTION_GLOBE_VIEW
495return u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );
496#else
497return u_matrix*( world_center+vec4(sample_offset,0,0) );
498#endif
499#else
500return projected_center+vec4(sample_offset,0,0);
501#endif
502}float get_sample_step() {
503#ifdef PITCH_WITH_MAP
504return 2.0*PI/float(NUM_SAMPLES_PER_RING);
505#else
506return PI/float(NUM_SAMPLES_PER_RING);
507#endif
508}void main() {
509#pragma mapbox: initialize highp vec4 color
510#pragma mapbox: initialize mediump float radius
511#pragma mapbox: initialize lowp float blur
512#pragma mapbox: initialize lowp float opacity
513#pragma mapbox: initialize highp vec4 stroke_color
514#pragma mapbox: initialize mediump float stroke_width
515#pragma mapbox: initialize lowp float stroke_opacity
516vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);vec4 world_center;mat3 surface_vectors;
517#ifdef PROJECTION_GLOBE_VIEW
518vec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1);
519#else 
520surface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1);
521#endif
522#ifdef ELEVATED_ROADS
523world_center.z+=a_circle_z_offset+ELEVATION_BIAS;
524#endif
525vec4 projected_center=u_matrix*world_center;float view_scale=0.0;
526#ifdef PITCH_WITH_MAP
527#ifdef SCALE_WITH_MAP
528view_scale=1.0;
529#else
530view_scale=projected_center.w/u_camera_to_center_distance;
531#endif
532#else
533#ifdef SCALE_WITH_MAP
534view_scale=u_camera_to_center_distance;
535#else
536view_scale=projected_center.w;
537#endif
538#endif
539gl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0;
540#ifdef TERRAIN
541float step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;
542#ifdef PITCH_WITH_MAP
543float cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center;
544#else
545occlusion_world_center=world_center;occlusion_projected_center=projected_center;
546#endif
547for(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);
548#else
549visibility=1.0;
550#endif
551#ifdef PROJECTION_GLOBE_VIEW
552visibility=1.0;
553#endif
554v_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);
555#ifdef FOG
556v_fog_pos=fog_position(world_center.xyz);
557#endif
558}`),clippingMask:jt("void main() {glFragColor=vec4(1.0);}","in vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:jt(`#include "_prelude_fog.fragment.glsl"
559uniform highp float u_intensity;in vec2 v_extrude;
560#pragma mapbox: define highp float weight
561#define GAUSS_COEF 0.3989422804014327
562void main() {
563#pragma mapbox: initialize highp float weight
564float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);glFragColor=vec4(val,1.0,1.0,1.0);
565#ifdef FOG
566if (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}
567#endif
568#ifdef OVERDRAW_INSPECTOR
569glFragColor=vec4(1.0);
570#endif
571HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl"
572#include "_prelude_fog.vertex.glsl"
573uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos;
574#ifdef PROJECTION_GLOBE_VIEW
575in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;
576#endif
577out vec2 v_extrude;
578#pragma mapbox: define highp float weight
579#pragma mapbox: define mediump float radius
580const highp float ZERO=1.0/255.0/16.0;
581#define GAUSS_COEF 0.3989422804014327
582void main() {
583#pragma mapbox: initialize highp float weight
584#pragma mapbox: initialize mediump float radius
585vec2 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;vec2 tilePos=floor(a_pos*0.5);vec3 pos;
586#ifdef PROJECTION_GLOBE_VIEW
587vec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);
588#else
589pos=vec3(tilePos+extrude,elevation(tilePos));
590#endif
591gl_Position=u_matrix*vec4(pos,1);
592#ifdef FOG
593v_fog_pos=fog_position(pos);
594#endif
595}`),heatmapTexture:jt(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));glFragColor=color*u_opacity;
596#ifdef OVERDRAW_INSPECTOR
597glFragColor=vec4(0.0);
598#endif
599HANDLE_WIREFRAME_DEBUG;}`,"in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:jt("in float v_placed;in float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);glFragColor =mix(red,blue,step(0.5,v_placed))*0.5;glFragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}",`#include "_prelude_terrain.vertex.glsl"
600in vec3 a_pos;in vec2 a_anchor_pos;in vec2 a_extrude;in vec2 a_placed;in vec2 a_shift;in vec2 a_elevation_from_sea;in float a_size_scale;in vec2 a_padding;in float a_auto_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;
601#ifdef PROJECTION_GLOBE_VIEW
602uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform float u_zoom_transition;
603#endif
604out float v_placed;out float v_notUsed;void main() {float feature_elevation=a_elevation_from_sea.x+a_auto_z_offset;float terrain_elevation=(a_elevation_from_sea.y==1.0 ? 0.0 : elevation(a_anchor_pos));vec3 proj_pos=a_pos+elevationVector(a_anchor_pos)*(feature_elevation+terrain_elevation);
605#ifdef PROJECTION_GLOBE_VIEW
606#ifndef PROJECTED_POS_ON_VIEWPORT
607vec3 globe_pos=proj_pos;vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,a_anchor_pos,u_tile_id,u_merc_center);proj_pos=mix_globe_mercator(globe_pos,mercator_pos,u_zoom_transition);
608#endif
609#endif
610vec4 projectedPoint=u_matrix*vec4(proj_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(
6110.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}`),collisionCircle:jt("in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in 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);glFragColor=color*alpha*opacity_t;}",`in vec2 a_pos_2f;in float a_radius;in vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out 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_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(
612mix(-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(
6130.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:jt("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);glFragColor=mix(u_color,overlay_color,overlay_color.a);}",`#include "_prelude_terrain.vertex.glsl"
614in vec2 a_pos;
615#ifdef PROJECTION_GLOBE_VIEW
616in vec3 a_pos_3;
617#endif
618out vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0;
619#ifdef PROJECTION_GLOBE_VIEW
620gl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1);
621#else
622gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);
623#endif
624}`),elevatedStructuresDepth:jt(`void main() {
625#ifndef DEPTH_TEXTURE
626glFragColor=vec4(0.);
627#endif
628}`,"in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform float u_depth_bias;void main() {gl_Position=u_matrix*vec4(a_pos,a_height,1);gl_Position.z=gl_Position.z+u_depth_bias;}"),elevatedStructuresDepthReconstruct:jt(`#ifdef DEPTH_RECONSTRUCTION
629in float v_height;
630#endif
631void main() {
632#ifdef DEPTH_RECONSTRUCTION
633if (v_height >=0.0)
634discard;
635#else
636#ifdef FEATURE_CUTOUT
637apply_feature_cutout(vec4(0.0,0.0,0.0,1.0),gl_FragCoord);
638#endif
639#endif
640glFragColor=vec4(1.0,0.0,0.0,1.0);}`,`in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform vec3 u_camera_pos;uniform highp float u_depth_bias;uniform lowp float u_height_scale;uniform lowp float u_reset_depth;
641#ifdef DEPTH_RECONSTRUCTION
642out float v_height;
643#endif
644void main() {vec3 vpos=vec3(a_pos,a_height*u_height_scale);
645#ifdef DEPTH_RECONSTRUCTION
646if (u_camera_pos.z > vpos.z) {vpos-=(u_camera_pos-vpos)*(vpos.z/(u_camera_pos.z-vpos.z));}v_height=a_height;
647#endif
648gl_Position=u_matrix*vec4(vpos,1);gl_Position.z=u_reset_depth==1.0 ? gl_Position.w : gl_Position.z+u_depth_bias;}`),elevatedStructures:jt(`#include "_prelude_fog.fragment.glsl"
649#include "_prelude_lighting.glsl"
650#include "_prelude_shadow.fragment.glsl"
651in vec3 v_normal;in float v_height;
652#ifdef RENDER_SHADOWS
653in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth;
654#endif
655vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}
655vec3 compute_view_dependent_emissive_color(float ndotl,float emissive_strength,vec3 color)
656{color=sRGBToLinear(color);color=color*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);color=linearTosRGB(color.rgb);return color;}uniform float u_emissive_strength;
657#pragma mapbox: define highp vec4 structure_color
658void main() {
659#pragma mapbox: initialize highp vec4 structure_color
660vec3 color=structure_color.xyz;
661#ifdef LIGHTING_3D_MODE
662vec3 normal=normalize(v_normal);vec3 transformed_normal=vec3(-normal.xy,normal.z);float ndotl=calculate_NdotL(transformed_normal);float emissive_strength=u_emissive_strength;emissive_strength=0.0;vec3 emissive_color=compute_view_dependent_emissive_color(ndotl,emissive_strength,color.xyz);
663#ifdef RENDER_SHADOWS
664float shadowed_lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth);color.rgb=apply_lighting(color.rgb,transformed_normal,shadowed_lighting_factor);
665#else
666color=apply_lighting(color,transformed_normal);
667#endif
668color=mix(color,emissive_color,emissive_strength);if (v_height < 0.0) {float penetration=max(v_height+7.5,0.0);float occlusion=1.0-1.0/PI*acos(1.0-penetration/4.0);color=color*(1.0-pow(occlusion,2.0)*0.3);}
669#endif
670#ifdef FOG
671color=fog_apply(color,v_fog_pos);
672#endif
673vec4 out_color=vec4(color,1.0);
674#ifdef INDICATOR_CUTOUT
675out_color=applyCutout(out_color,v_height);
676#endif
677#ifdef FEATURE_CUTOUT
678out_color=apply_feature_cutout(out_color,gl_FragCoord);
679#endif
680glFragColor=out_color;HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
681#include "_prelude_shadow.vertex.glsl"
682in vec2 a_pos;in float a_height;in vec3 a_pos_normal_3;uniform mat4 u_matrix;out vec3 v_normal;out float v_height;
683#ifdef RENDER_SHADOWS
684uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth;
685#endif
686#pragma mapbox: define highp vec4 structure_color
687void main() {
688#pragma mapbox: initialize highp vec4 structure_color
689v_normal=a_pos_normal_3/16384.0;v_height=a_height;vec3 pos=vec3(a_pos,a_height);gl_Position=u_matrix*vec4(pos,1);
690#ifdef RENDER_SHADOWS
691vec3 shd_pos0=pos;vec3 shd_pos1=pos;
692#ifdef NORMAL_OFFSET
693vec3 offset=shadow_normal_offset(vec3(-v_normal.xy,v_normal.z));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();
694#endif
695v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
696#endif
697#ifdef FOG
698v_fog_pos=fog_position(a_pos);
699#endif
700}`),fill:jt(`#include "_prelude_fog.fragment.glsl"
701#include "_prelude_lighting.glsl"
702#include "_prelude_shadow.fragment.glsl"
703#pragma mapbox: define highp vec4 color
704#pragma mapbox: define lowp float opacity
705uniform float u_emissive_strength;
706#ifdef RENDER_SHADOWS
707uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;
708#endif
709#ifdef ELEVATED_ROADS
710in highp float v_road_z_offset;
711#endif
712#ifdef INDICATOR_CUTOUT
713in highp float v_z_offset;
714#endif
715void main() {
716#pragma mapbox: initialize highp vec4 color
717#pragma mapbox: initialize lowp float opacity
718vec4 out_color=color;
719#ifdef LIGHTING_3D_MODE
720out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
721#ifdef RENDER_SHADOWS
722float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
723#endif
724#endif
725#ifdef FOG
726out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
727#endif
728out_color*=opacity;
729#ifdef INDICATOR_CUTOUT
730if (v_z_offset >=0.0) {out_color=applyCutout(out_color,v_z_offset);}
731#endif
732#ifdef FEATURE_CUTOUT
733out_color=apply_feature_cutout(out_color,gl_FragCoord);
734#endif
735glFragColor=out_color;
736#ifdef USE_MRT1
737out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
738#endif
739#ifdef OVERDRAW_INSPECTOR
740glFragColor=vec4(1.0);
741#endif
742HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
743#include "_prelude_shadow.vertex.glsl"
744in vec2 a_pos;
745#ifdef ELEVATED_ROADS
746in float a_road_z_offset;out highp float v_road_z_offset;
747#endif
748#ifdef RENDER_SHADOWS
749uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;
750#endif
751#ifdef INDICATOR_CUTOUT
752out highp float v_z_offset;
753#endif
754uniform mat4 u_matrix;
755#pragma mapbox: define highp vec4 color
756#pragma mapbox: define lowp float opacity
757#pragma mapbox: define highp float z_offset
758void main() {
759#pragma mapbox: initialize highp vec4 color
760#pragma mapbox: initialize lowp float opacity
761#pragma mapbox: initialize highp float z_offset
762#ifdef ELEVATED_ROADS
763z_offset+=a_road_z_offset;v_road_z_offset=z_offset;
764#endif
765float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);
766#ifdef RENDER_SHADOWS
767vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);
768#ifdef NORMAL_OFFSET
769vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();
770#endif
771v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
772#endif
773#ifdef FOG
774v_fog_pos=fog_position(a_pos);
775#endif
776#ifdef INDICATOR_CUTOUT
777v_z_offset=z_offset;
778#endif
779}`),fillOutline:jt(`#include "_prelude_fog.fragment.glsl"
780#include "_prelude_lighting.glsl"
781#include "_prelude_shadow.fragment.glsl"
782in highp vec2 v_pos;uniform float u_emissive_strength;
783#ifdef RENDER_SHADOWS
784uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;
785#endif
786#pragma mapbox: define highp vec4 outline_color
787#pragma mapbox: define lowp float opacity
788void main() {
789#pragma mapbox: initialize highp vec4 outline_color
790#pragma mapbox: initialize lowp float opacity
791float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color;
792#ifdef LIGHTING_3D_MODE
793out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
794#ifdef RENDER_SHADOWS
795float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
796#endif
797#endif
798#ifdef FOG
799out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
800#endif
801#ifdef FEATURE_CUTOUT
802out_color=apply_feature_cutout(out_color,gl_FragCoord);
803#endif
804glFragColor=out_color*(alpha*opacity);
805#ifdef USE_MRT1
806out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
807#endif
808#ifdef OVERDRAW_INSPECTOR
809glFragColor=vec4(1.0);
810#endif
811HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
812#include "_prelude_shadow.vertex.glsl"
813in vec2 a_pos;
814#ifdef ELEVATED_ROADS
815in float a_road_z_offset;
816#endif
817#ifdef RENDER_SHADOWS
818uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;
819#endif
820uniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos;
821#pragma mapbox: define highp vec4 outline_color
822#pragma mapbox: define lowp float opacity
823#pragma mapbox: define highp float z_offset
824void main() {
825#pragma mapbox: initialize highp vec4 outline_color
826#pragma mapbox: initialize lowp float opacity
827#pragma mapbox: initialize highp float z_offset
828#ifdef ELEVATED_ROADS
829z_offset+=a_road_z_offset;
830#endif
831float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);
832#ifdef FLIP_Y
833v_pos=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world;
834#else
835v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
836#endif
837#ifdef RENDER_SHADOWS
838vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);
839#ifdef NORMAL_OFFSET
840vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();
841#endif
842v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
843#endif
844#ifdef FOG
845v_fog_pos=fog_position(a_pos);
846#endif
847}`),fillOutlinePattern:jt(`#include "_prelude_fog.fragment.glsl"
848#include "_prelude_lighting.glsl"
849#include "_prelude_shadow.fragment.glsl"
850uniform vec2 u_texsize;uniform sampler2D u_image;
851#ifdef FILL_PATTERN_TRANSITION
852uniform float u_pattern_transition;
853#endif
854uniform float u_emissive_strength;
855#ifdef APPLY_LUT_ON_GPU
856uniform highp sampler3D u_lutTexture;
857#endif
858#ifdef RENDER_SHADOWS
859uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;
860#endif
861in highp vec2 v_pos;in highp vec2 v_pos_world;
862#pragma mapbox: define lowp float opacity
863#pragma mapbox: define lowp vec4 pattern
864#ifdef FILL_PATTERN_TRANSITION
865#pragma mapbox: define mediump vec4 pattern_b
866#endif
867void main() {
868#pragma mapbox: initialize lowp float opacity
869#pragma mapbox: initialize mediump vec4 pattern
870#ifdef FILL_PATTERN_TRANSITION
871#pragma mapbox: initialize mediump vec4 pattern_b
872#endif
873vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);
874#ifdef APPLY_LUT_ON_GPU
875out_color=applyLUT(u_lutTexture,out_color);
876#endif
877#ifdef FILL_PATTERN_TRANSITION
878vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;
879#endif
880#ifdef LIGHTING_3D_MODE
881out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
882#ifdef RENDER_SHADOWS
883float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
884#endif
885#endif
886#ifdef FEATURE_CUTOUT
887out_color=apply_feature_cutout(out_color,gl_FragCoord);
888#endif
889#ifdef FOG
890out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
891#endif
892glFragColor=out_color*(alpha*opacity);
893#ifdef USE_MRT1
894out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
895#endif
896#ifdef OVERDRAW_INSPECTOR
897glFragColor=vec4(1.0);
898#endif
899HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
900#include "_prelude_shadow.vertex.glsl"
901uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;
902#ifdef ELEVATED_ROADS
903in float a_road_z_offset;
904#endif
905#ifdef RENDER_SHADOWS
906uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;
907#endif
908out highp vec2 v_pos;out highp vec2 v_pos_world;
909#pragma mapbox: define lowp float opacity
910#pragma mapbox: define lowp vec4 pattern
911#ifdef FILL_PATTERN_TRANSITION
912#pragma mapbox: define mediump vec4 pattern_b
913#endif
914#pragma mapbox: define lowp float pixel_ratio
915#pragma mapbox: define highp float z_offset
916void main() {
917#pragma mapbox: initialize lowp float opacity
918#pragma mapbox: initialize mediump vec4 pattern
919#ifdef FILL_PATTERN_TRANSITION
920#pragma mapbox: initialize mediump vec4 pattern_b
921#endif
922#pragma mapbox: initialize lowp float pixel_ratio
923#pragma mapbox: initialize highp float z_offset
924vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;
925#ifdef ELEVATED_ROADS
926z_offset+=a_road_z_offset;
927#endif
928float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);
929#ifdef FLIP_Y
930v_pos_world=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world;
931#else
932v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
933#endif
934#ifdef RENDER_SHADOWS
935vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);
936#ifdef NORMAL_OFFSET
937vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();
938#endif
939v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
940#endif
941#ifdef FOG
942v_fog_pos=fog_position(a_pos);
943#endif
944}`),fillPattern:jt(`#include "_prelude_fog.fragment.glsl"
945#include "_prelude_lighting.glsl"
946#include "_prelude_shadow.fragment.glsl"
947uniform vec2 u_texsize;uniform sampler2D u_image;
948#ifdef FILL_PATTERN_TRANSITION
949uniform float u_pattern_transition;
950#endif
951in highp vec2 v_pos;uniform float u_emissive_strength;
952#ifdef RENDER_SHADOWS
953uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;
954#endif
955#ifdef ELEVATED_ROADS
956in highp float v_road_z_offset;
957#endif
958#ifdef APPLY_LUT_ON_GPU
959uniform highp sampler3D u_lutTexture;
960#endif
961#pragma mapbox: define lowp float opacity
962#pragma mapbox: define lowp vec4 pattern
963#ifdef FILL_PATTERN_TRANSITION
964#pragma mapbox: define mediump vec4 pattern_b
965#endif
966void main() {
967#pragma mapbox: initialize lowp float opacity
968#pragma mapbox: initialize mediump vec4 pattern
969#ifdef FILL_PATTERN_TRANSITION
970#pragma mapbox: initialize mediump vec4 pattern_b
971#endif
972vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);
973#ifdef APPLY_LUT_ON_GPU
974out_color=applyLUT(u_lutTexture,out_color);
975#endif
976#ifdef FILL_PATTERN_TRANSITION
977vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;
978#endif
979#ifdef LIGHTING_3D_MODE
980out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
981#ifdef RENDER_SHADOWS
982float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);
983#ifdef ELEVATED_ROADS
984out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
985#else
986out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
987#endif
988#endif
989#endif
990#ifdef FEATURE_CUTOUT
991out_color=apply_feature_cutout(out_color,gl_FragCoord);
992#endif
993#ifdef FOG
994out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
995#endif
996glFragColor=out_color*opacity;
997#ifdef USE_MRT1
998out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
999#endif
1000#ifdef OVERDRAW_INSPECTOR
1001glFragColor=vec4(1.0);
1002#endif
1003HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1004#include "_prelude_shadow.vertex.glsl"
1005uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;
1006#ifdef ELEVATED_ROADS
1007in float a_road_z_offset;out highp float v_road_z_offset;
1008#endif
1009#ifdef RENDER_SHADOWS
1010uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;
1011#endif
1012out highp vec2 v_pos;
1013#pragma mapbox: define lowp float opacity
1014#pragma mapbox: define lowp vec4 pattern
1015#ifdef FILL_PATTERN_TRANSITION
1016#pragma mapbox: define mediump vec4 pattern_b
1017#endif
1018#pragma mapbox: define lowp float pixel_ratio
1019#pragma mapbox: define highp float z_offset
1020void main() {
1021#pragma mapbox: initialize lowp float opacity
1022#pragma mapbox: initialize mediump vec4 pattern
1023#pragma mapbox: initialize lowp float pixel_ratio
1024#pragma mapbox: initialize highp float z_offset
1025#ifdef FILL_PATTERN_TRANSITION
1026#pragma mapbox: initialize mediump vec4 pattern_b
1027#endif
1028vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;
1029#ifdef ELEVATED_ROADS
1030z_offset+=a_road_z_offset;v_road_z_offset=z_offset;
1031#endif
1032float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);v_pos=get_pa
1032ttern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);
1033#ifdef RENDER_SHADOWS
1034vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);
1035#ifdef NORMAL_OFFSET
1036vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();
1037#endif
1038v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
1039#endif
1040#ifdef FOG
1041v_fog_pos=fog_position(a_pos);
1042#endif
1043}`),fillExtrusion:jt(`#include "_prelude_fog.fragment.glsl"
1044#include "_prelude_shadow.fragment.glsl"
1045#include "_prelude_lighting.glsl"
1046in vec4 v_color;in vec4 v_flat;
1047#ifdef RENDER_SHADOWS
1048in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;
1049#endif
1050uniform lowp float u_opacity;
1051#ifdef FAUX_AO
1052uniform lowp vec2 u_ao;in vec2 v_ao;
1053#endif
1054#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)
1055in vec4 v_roof_color;
1056#endif
1057#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
1058in highp vec3 v_normal;
1059#endif
1060uniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor;
1061#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)
1062in float v_flood_radius;in float v_has_floodlight;
1063#endif
1064in float v_height;
1065#pragma mapbox: define highp float emissive_strength
1066void main() {
1067#pragma mapbox: initialize highp float emissive_strength
1068#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
1069vec3 normal=normalize(v_normal);
1070#endif
1071float z;vec4 color=v_color;
1072#ifdef ZERO_ROOF_RADIUS
1073z=float(normal.z > 0.00001);
1074#ifdef LIGHTING_3D_MODE
1075normal=mix(normal,vec3(0.0,0.0,1.0),z);
1076#else
1077color=mix(v_color,v_roof_color,z);
1078#endif
1079#endif
1080float h=max(0.0,v_height);float ao_shade=1.0;
1081#ifdef FAUX_AO
1082float intensity=u_ao[0];float h_floors=h/(u_ao[1]*u_vertical_scale);float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);ao_shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;
1083#ifdef ZERO_ROOF_RADIUS
1084concave*=(1.0-z);
1085#endif
1086float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);ao_shade*=mix(1.0,x_shade*x_shade*x_shade,concave);
1087#ifdef LIGHTING_3D_MODE
1088#ifdef FLOOD_LIGHT
1089color.rgb*=mix(ao_shade,1.0,v_has_floodlight);
1090#else
1091color.rgb*=ao_shade;
1092#endif
1093#else
1094color.rgb*=ao_shade;
1095#endif
1096#endif
1097#ifdef LIGHTING_3D_MODE
1098float flood_radiance=0.0;
1099#ifdef FLOOD_LIGHT
1100flood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight;
1101#endif
1102#ifdef RENDER_SHADOWS
1103#ifdef FLOOD_LIGHT
1104float ndotl_unclamped=dot(normal,u_shadow_direction);float ndotl=max(0.0,ndotl_unclamped);float occlusion=ndotl_unclamped < 0.0 ? 1.0 : shadow_occlusion(ndotl,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 litColor=apply_lighting(color.rgb,normal,(1.0-u_shadow_intensity*occlusion)*ndotl);vec3 floodLitColor=compute_flood_lighting(u_flood_light_color*u_opacity,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=mix(litColor,floodLitColor,flood_radiance);
1105#else
1106float shadowed_lighting_factor;
1107#ifdef RENDER_CUTOFF
1108shadowed_lighting_factor=shadowed_light_factor_normal_opacity(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;}
1109#else
1110shadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);
1111#endif
1112color.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor);
1113#endif
1114#else
1115color.rgb=apply_lighting(color.rgb,normal);
1116#ifdef FLOOD_LIGHT
1117color.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance);
1118#endif
1119#endif
1120color.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity;
1121#endif
1122#ifdef FOG
1123color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h));
1124#endif
1125#ifdef INDICATOR_CUTOUT
1126color=applyCutout(color,h);
1127#endif
1128#ifdef FEATURE_CUTOUT
1129color=apply_feature_cutout(color,gl_FragCoord);
1130#endif
1131glFragColor=color;
1132#ifdef OVERDRAW_INSPECTOR
1133glFragColor=vec4(1.0);
1134#endif
1135HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1136#include "_prelude_terrain.vertex.glsl"
1137#include "_prelude_shadow.vertex.glsl"
1138#include "_prelude_lighting.glsl"
1139#include "_prelude_material_table.vertex.glsl"
1140uniform 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;uniform float u_edge_radius;uniform float u_width_scale;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;
1141#ifdef RENDER_WALL_MODE
1142in vec3 a_join_normal_inside;
1143#endif
1144#ifdef PROJECTION_GLOBE_VIEW
1145in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;
1146#endif
1147#ifdef TERRAIN
1148uniform int u_height_type;uniform int u_base_type;
1149#endif
1150uniform highp float u_vertical_scale;out vec4 v_color;out vec4 v_flat;
1151#ifdef RENDER_SHADOWS
1152uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;
1153#endif
1154#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)
1155out vec4 v_roof_color;
1156#endif
1157#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
1158out highp vec3 v_normal;
1159#endif
1160#ifdef FAUX_AO
1161uniform lowp vec2 u_ao;out vec2 v_ao;
1162#endif
1163#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)
1164out float v_flood_radius;out float v_has_floodlight;
1165#endif
1166out float v_height;vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}
1167#pragma mapbox: define highp float base
1168#pragma mapbox: define highp float height
1169#pragma mapbox: define highp vec4 color
1170#pragma mapbox: define highp float flood_light_wall_radius
1171#pragma mapbox: define highp float line_width
1172#pragma mapbox: define highp float emissive_strength
1173void main() {DECLARE_MATERIAL_TABLE_INFO
1174#pragma mapbox: initialize highp float base
1175#pragma mapbox: initialize highp float height
1176#pragma mapbox: initialize highp vec4 color
1177#pragma mapbox: initialize highp float flood_light_wall_radius
1178#pragma mapbox: initialize highp float line_width
1179#pragma mapbox: initialize highp float emissive_strength
1180base*=u_vertical_scale;height*=u_vertical_scale;vec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));
1181#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
1182v_normal=normal;
1183#endif
1184base=max(0.0,base);float attr_height=height;height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);
1185#if defined(HAS_CENTROID) || defined(TERRAIN)
1186centroid_pos=a_centroid_pos;
1187#endif
1188float ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos;
1189#ifdef TERRAIN
1190bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h);
1191#else
1192h=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h);
1193#endif
1194#ifdef PROJECTION_GLOBE_VIEW
1195float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);
1196#endif
1197float cutoff=1.0;vec3 scaled_pos=pos;
1198#ifdef RENDER_CUTOFF
1199vec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_pos.x==0.0 ? pos.xyz : (centroid_random/8.0);vec4 ground=u_matrix*vec4(ground_pos.xy,ele,1.0);
1200#ifdef CLIP_ZERO_TO_ONE
1201cutoff=cutoff_opacity(u_cutoff_params,ground.z*2.0-ground.w);
1202#else
1203cutoff=cutoff_opacity(u_cutoff_params,ground.z);
1204#endif
1205if (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 g=floor(ground_pos);vec3 mod_=centroid_random-g*8.0;float seed=min(1.0,0.1*(min(3.5,max(mod_.x+mod_.y,0.2*attr_height))*0.35+mod_.z));if (cutoff < 0.8-seed) {cutoff=0.0;}}float cutoff_scale=cutoff;v_cutoff_opacity=cutoff;scaled_pos.z=mix(c_ele,h,cutoff_scale);
1206#endif
1207float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0) || (color.a==0.0));
1208#ifdef RENDER_WALL_MODE
1209vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);scaled_pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;scaled_pos.xy-=a_join_normal_inside.z*wall_offset*0.5;
1210#endif
1211gl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h;
1212#ifdef RENDER_SHADOWS
1213vec3 shd_pos0=pos;vec3 shd_pos1=pos;
1214#ifdef NORMAL_OFFSET
1215vec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();
1216#endif
1217v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);
1218#endif
1219float NdotL=0.0;float colorvalue=0.0;
1220#ifndef LIGHTING_3D_MODE
1221colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);if (normal.y !=0.0) {float r=0.84;r=mix(0.7,0.98,1.0-u_lightintensity);NdotL*=(
1222(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}
1223#endif
1224#ifdef FAUX_AO
1225float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;
1226#ifdef TERRAIN
1227top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);
1228#endif
1229v_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);
1230#ifdef PROJECTION_GLOBE_VIEW
1231top_height+=u_height_lift;
1232#endif
1233gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;
1234#endif
1235#ifdef LIGHTING_3D_MODE
1236#ifdef FLOOD_LIGHT
1237float is_wall=1.0-float(t > 0.0 && top_up_ny.y > 0.0);v_has_floodlight=float(flood_light_wall_radius > 0.0 && is_wall > 0.0);v_flood_radius=flood_light_wall_radius*u_vertical_scale;
1238#endif
1239v_color=vec4(color.rgb,1.0);float ndotl=calculate_NdotL(normal);v_flat.rgb=sRGBToLinear(color.rgb);v_flat.rgb=v_flat.rgb*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);v_flat=vec4(linearTosRGB(v_flat.rgb),1.0);
1240#else
1241v_color=vec4(0.0,0.0,0.0,1.0);v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity;
1242#endif
1243#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)
1244float roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color=vec4(0.0,0.0,0.0,1.0);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_roof_color*=u_opacity;
1245#endif
1246#ifdef FOG
1247v_fog_pos=fog_position(pos);
1248#endif
1249}`),fillExtrusionDepth:jt(`in highp float v_depth;void main() {
1250#ifndef DEPTH_TEXTURE
1251glFragColor=pack_depth(v_depth);
1252#endif
1253}`,`#include "_prelude_terrain.vertex.glsl"
1254#include "_prelude_material_table.vertex.glsl"
1255uniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_width_scale;uniform float u_vertical_scale;
1256#ifdef TERRAIN
1257uniform int u_height_type;uniform int u_base_type;
1258#endif
1259in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;
1260#ifdef RENDER_WALL_MODE
1261in vec3 a_join_normal_inside;
1262#endif
1263#pragma mapbox: define highp float base
1264#pragma mapbox: define highp float height
1265#pragma mapbox: define highp float line_width
1266#pragma mapbox: define highp vec4 color
1267out highp float v_depth;void main() {DECLARE_MATERIAL_TABLE_INFO
1268#pragma mapbox: initialize highp float base
1269#pragma mapbox: initialize highp float height
1270#pragma mapbox: initialize highp float line_width
1271#pragma mapbox: initialize highp vec4 color
1272base*=u_vertical_scale;height*=u_vertical_scale;vec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);
1273#if defined(HAS_CENTROID) || defined(TERRAIN)
1274centroid_pos=a_centroid_pos;
1275#endif
1276vec3 pos;
1277#ifdef TERRAIN
1278bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;float ele=elevation(pos_nx.xy);float c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);float h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h);
1279#else
1280pos=vec3(pos_nx.xy,t > 0.0 ? height : base);
1281#endif
1282#ifdef RENDER_WALL_MODE
1283vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;pos.xy-=a_join_normal_inside.z*wall_offset*0.5;
1284#endif
1285float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);v_depth=gl_Position.z/gl_Position.w;}`),fillExtrusionPattern:jt(`#include "_prelude_fog.fragment.glsl"
1286#include "_prelude_lighting.glsl"
1287uniform vec2 u_texsize;uniform sampler2D u_image;
1288#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1289uniform float u_pattern_transition;
1290#endif
1291#ifdef FAUX_AO
1292uniform lowp vec2 u_ao;in vec3 v_ao;
1293#endif
1294#ifdef LIGHTING_3D_MODE
1295in vec3 v_normal;
1296#endif
1297#ifdef APPLY_LUT_ON_GPU
1298uniform highp sampler3D u_lutTexture;
1299#endif
1300in highp vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity;
1301#pragma mapbox: define highp float base
1302#pragma mapbox: define highp float height
1303#pragma mapbox: define mediump vec4 pattern
1304#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1305#pragma mapbox: define mediump vec4 pattern_b
1306#endif
1307#pragma mapbox: define highp float pixel_ratio
1308void main() {
1309#pragma mapbox: initialize highp float base
1310#pragma mapbox: initialize highp float height
1311#pragma mapbox: initialize mediump vec4 pattern
1312#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1313#pragma mapbox: initialize mediump vec4 pattern_b
1314#endif
1315#pragma mapbox: initialize highp float pixel_ratio
1316vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);
1317#ifdef APPLY_LUT_ON_GPU
1318out_color=applyLUT(u_lutTexture,out_color);
1319#endif
1320#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1321vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;
1322#endif
1323#ifdef LIGHTING_3D_MODE
1324out_color=apply_lighting(out_color,normalize(v_normal))*u_opacity;
1325#else
1326out_color=out_color*v_lighting;
1327#endif
1328#ifdef FAUX_AO
1329float intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0
1329),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade;
1330#endif
1331#ifdef FOG
1332out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
1333#endif
1334#ifdef INDICATOR_CUTOUT
1335out_color=applyCutout(out_color,height);
1336#endif
1337glFragColor=out_color;
1338#ifdef OVERDRAW_INSPECTOR
1339glFragColor=vec4(1.0);
1340#endif
1341HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1342#include "_prelude_terrain.vertex.glsl"
1343#include "_prelude_lighting.glsl"
1344#include "_prelude_material_table.vertex.glsl"
1345uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_width_scale;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;
1346#ifdef RENDER_WALL_MODE
1347in vec3 a_join_normal_inside;
1348#endif
1349#ifdef PROJECTION_GLOBE_VIEW
1350in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;
1351#endif
1352#ifdef TERRAIN
1353uniform int u_height_type;uniform int u_base_type;
1354#endif
1355out highp vec2 v_pos;out vec4 v_lighting;
1356#ifdef FAUX_AO
1357uniform lowp vec2 u_ao;out vec3 v_ao;
1358#endif
1359#ifdef LIGHTING_3D_MODE
1360out vec3 v_normal;
1361#endif
1362#pragma mapbox: define highp float base
1363#pragma mapbox: define highp float height
1364#pragma mapbox: define highp vec4 color
1365#pragma mapbox: define mediump vec4 pattern
1366#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1367#pragma mapbox: define mediump vec4 pattern_b
1368#endif
1369#pragma mapbox: define highp float pixel_ratio
1370#pragma mapbox: define highp float line_width
1371void main() {DECLARE_MATERIAL_TABLE_INFO
1372#pragma mapbox: initialize highp float base
1373#pragma mapbox: initialize highp float height
1374#pragma mapbox: initialize highp vec4 color
1375#pragma mapbox: initialize mediump vec4 pattern
1376#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1377#pragma mapbox: initialize mediump vec4 pattern_b
1378#endif
1379#pragma mapbox: initialize highp float pixel_ratio
1380#pragma mapbox: initialize highp float line_width
1381vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);
1382#if defined(HAS_CENTROID) || defined(TERRAIN)
1383centroid_pos=a_centroid_pos;
1384#endif
1385float ele=0.0;float h=z;vec3 p;float c_ele;
1386#ifdef TERRAIN
1387bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;p=vec3(pos_nx.xy,h);
1388#else
1389p=vec3(pos_nx.xy,z);
1390#endif
1391#ifdef PROJECTION_GLOBE_VIEW
1392float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);
1393#endif
1394#ifdef RENDER_WALL_MODE
1395vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);p.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;p.xy-=a_join_normal_inside.z*wall_offset*0.5;
1396#endif
1397float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0
1398? pos_nx.xy
1399: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0;
1400#ifdef LIGHTING_3D_MODE
1401NdotL=calculate_NdotL(normal);
1402#else
1403NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);
1404#endif
1405if (normal.y !=0.0) {float r=0.84;
1406#ifndef LIGHTING_3D_MODE
1407r=mix(0.7,0.98,1.0-u_lightintensity);
1408#endif
1409NdotL*=(
1410(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}
1411#ifdef FAUX_AO
1412float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;
1413#ifdef TERRAIN
1414top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);
1415#endif
1416v_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);
1417#ifdef PROJECTION_GLOBE_VIEW
1418top_height+=u_height_lift;
1419#endif
1420gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;
1421#endif
1422#ifdef LIGHTING_3D_MODE
1423v_normal=normal;
1424#else
1425v_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;
1426#endif
1427#ifdef FOG
1428v_fog_pos=fog_position(p);
1429#endif
1430}`),groundShadow:jt(`#include "_prelude_shadow.fragment.glsl"
1431precision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;
1432#ifdef FOG
1433in float v_fog_opacity;
1434#endif
1435void main() {float light=shadowed_light_factor_plane_bias(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 shadow=mix(u_ground_shadow_factor,vec3(1.0),light);
1436#ifdef RENDER_CUTOFF
1437shadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w));
1438#endif
1439#ifdef FOG
1440shadow=mix(shadow,vec3(1.0),v_fog_opacity);
1441#endif
1442#ifdef INDICATOR_CUTOUT
1443shadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0),0.0).r);
1444#endif
1445glFragColor=vec4(shadow,1.0);}`,`#include "_prelude_fog.vertex.glsl"
1446uniform mat4 u_matrix;uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;in vec2 a_pos;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;
1447#ifdef FOG
1448out float v_fog_opacity;
1449#endif
1450void main() {gl_Position=u_matrix*vec4(a_pos,0.0,1.0);v_pos_light_view_0=u_light_matrix_0*vec4(a_pos,0.0,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(a_pos,0.0,1.0);
1451#ifdef FOG
1452v_fog_pos=fog_position(a_pos);v_fog_opacity=fog(v_fog_pos);
1453#endif
1454}`),fillExtrusionGroundEffect:jt(`uniform highp float u_ao_pass;uniform highp float u_opacity;uniform highp float u_flood_light_intensity;uniform highp vec3 u_flood_light_color;uniform highp float u_attenuation;uniform sampler2D u_fb;uniform float u_fb_size;
1455#ifdef SDF_SUBPASS
1456in highp vec2 v_pos;in highp vec4 v_line_segment;in highp float v_flood_light_radius_tile;in highp vec2 v_ao;float line_df(highp vec2 a,highp vec2 b,highp vec2 p) {highp vec2 ba=b-a;highp vec2 pa=p-a;highp float r=clamp(dot(pa,ba)/dot(ba,ba),0.0,1.0);return length(pa-r*ba);}
1457#ifdef FOG
1458in highp float v_fog;
1459#endif
1460#endif
1461void main() {
1462#ifdef CLEAR_SUBPASS
1463vec4 color=vec4(1.0);
1464#ifdef CLEAR_FROM_TEXTURE
1465color=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size));
1466#endif
1467glFragColor=color;
1468#else
1469#ifdef SDF_SUBPASS
1470highp float d=line_df(v_line_segment.xy,v_line_segment.zw,v_pos);highp float effect_radius=mix(v_flood_light_radius_tile,v_ao.y,u_ao_pass);d/=effect_radius;d=min(d,1.0);d=1.0-pow(1.0-d,u_attenuation);highp float effect_intensity=mix(u_flood_light_intensity,v_ao.x,u_ao_pass);highp float fog=1.0;
1471#ifdef FOG
1472fog=v_fog;
1473#endif
1474#ifdef RENDER_CUTOFF
1475fog*=v_cutoff_opacity;
1476#endif
1477glFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog));
1478#else
1479#ifdef USE_MRT1
1480out_Target1=vec4(1.0-texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size)).a,0.0,0.0,0.0);
1481#else
1482vec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass);
1483#ifdef OVERDRAW_INSPECTOR
1484color=vec4(1.0);
1485#endif
1486glFragColor=color;
1487#endif
1488#endif
1489HANDLE_WIREFRAME_DEBUG;
1490#endif
1491}`,`#include "_prelude_fog.vertex.glsl"
1492in highp vec4 a_pos_end;in highp float a_angular_offset_factor;in highp float a_hidden_by_landmark;
1493#ifdef SDF_SUBPASS
1494out highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao;
1495#ifdef FOG
1496out highp float v_fog;
1497#endif
1498#endif
1499uniform highp float u_flood_light_intensity;uniform highp mat4 u_matrix;uniform highp float u_ao_pass;uniform highp float u_meter_to_tile;uniform highp float u_edge_radius;uniform highp float u_dynamic_offset;uniform highp vec2 u_ao;
1500#pragma mapbox: define highp float flood_light_ground_radius
1501const float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() {
1502#pragma mapbox: initialize highp float flood_light_ground_radius
1503vec2 p=a_pos_end.xy;vec2 q=floor(a_pos_end.zw*0.5);vec2 start_bottom=a_pos_end.zw-q*2.0;float fl_ground_radius=flood_light_ground_radius;fl_ground_radius=abs(flood_light_ground_radius);float direction=flood_light_ground_radius < 0.0 ?-1.0 : 1.0;float flood_radius_tile=fl_ground_radius*u_meter_to_tile;vec2 v=normalize(q-p);float ao_radius=u_ao.y/3.5;float effect_radius=mix(flood_radius_tile,ao_radius,u_ao_pass)+u_edge_radius;float angular_offset_factor=a_angular_offset_factor/NORM*TANGENT_CUTOFF;float angular_offset=direction*angular_offset_factor*effect_radius;float top=1.0-start_bottom.y;float side=(0.5-start_bottom.x)*2.0;vec2 extrusion_parallel=v*side*mix(u_dynamic_offset,angular_offset,top);vec2 perp=vec2(v.y,-v.x);vec2 extrusion_perp=direction*perp*effect_radius*top;vec3 pos=vec3(mix(q,p,start_bottom.x),0.0);pos.xy+=extrusion_parallel+extrusion_perp;
1504#ifdef SDF_SUBPASS
1505v_pos=pos.xy;v_line_segment=vec4(p,q)+perp.xyxy*u_edge_radius;v_flood_light_radius_tile=flood_radius_tile;v_ao=vec2(u_ao.x,ao_radius);
1506#ifdef FOG
1507v_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos);
1508#endif
1509#endif
1510float hidden_by_landmark=0.0;
1511#ifdef HAS_CENTROID
1512hidden_by_landmark=a_hidden_by_landmark;
1513#endif
1514float isFloodlit=float(fl_ground_radius > 0.0 && u_flood_light_intensity > 0.0);float hidden=mix(1.0-isFloodlit,isFloodlit,u_ao_pass);hidden+=hidden_by_landmark;gl_Position=mix(u_matrix*vec4(pos,1.0),AWAY,float(hidden > 0.0));
1515#ifdef RENDER_CUTOFF
1516v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);
1517#endif
1518}`),hillshadePrepare:jt(`precision highp float;uniform highp sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;float getElevation(vec2 coord) {return texture(u_image,coord).r/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));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(
1519(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)
1520)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4(
1521deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:jt(`#include "_prelude_fog.fragment.glsl"
1522#include "_prelude_lighting.glsl"
1523uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;uniform float u_emissive_strength;void main() {vec4 pixel=texture(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);glFragColor=accent_color*(1.0-shade_color.a)+shade_color;
1524#ifdef LIGHTING_3D_MODE
1525glFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength);
1526#endif
1527#ifdef FOG
1528glFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos));
1529#endif
1530#ifdef USE_MRT1
1531out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
1532#endif
1533#ifdef OVERDRAW_INSPECTOR
1534glFragColor=vec4(1.0);
1535#endif
1536HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1537uniform mat4 u_matrix;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;
1538#ifdef FOG
1539v_fog_pos=fog_position(a_pos);
1540#endif
1541}`),line:jt(`#include "_prelude_fog.fragment.glsl"
1542#include "_prelude_lighting.glsl"
1543#include "_prelude_shadow.fragment.glsl"
1544uniform lowp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_floor_width_scale;
1544uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform highp vec2 u_trim_gradient_mix_range;uniform lowp vec4 u_trim_color;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec3 v_uv;
1545#ifdef ELEVATED_ROADS
1546in highp float v_road_z_offset;
1547#endif
1548#ifdef VARIABLE_LINE_WIDTH
1549in float stub_side;
1550#endif
1551#ifdef RENDER_LINE_DASH
1552uniform sampler2D u_dash_image;in vec2 v_tex;
1553#endif
1554#ifdef RENDER_LINE_GRADIENT
1555uniform sampler2D u_gradient_image;
1556#endif
1557#ifdef INDICATOR_CUTOUT
1558in highp float v_z_offset;
1559#endif
1560#ifdef RENDER_SHADOWS
1561uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;
1562#endif
1563float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}
1564#pragma mapbox: define highp vec4 color
1565#pragma mapbox: define lowp float floorwidth
1566#pragma mapbox: define lowp vec4 dash
1567#pragma mapbox: define lowp float blur
1568#pragma mapbox: define lowp float opacity
1569#pragma mapbox: define mediump float side_z_offset
1570#pragma mapbox: define lowp float border_width
1571#pragma mapbox: define lowp vec4 border_color
1572#pragma mapbox: define lowp float emissive_strength
1573float linearstep(float edge0,float edge1,float x) {return  clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {
1574#pragma mapbox: initialize highp vec4 color
1575#pragma mapbox: initialize lowp float floorwidth
1576#pragma mapbox: initialize lowp vec4 dash
1577#pragma mapbox: initialize lowp float blur
1578#pragma mapbox: initialize lowp float opacity
1579#pragma mapbox: initialize mediump float side_z_offset
1580#pragma mapbox: initialize lowp float border_width
1581#pragma mapbox: initialize lowp vec4 border_color
1582#pragma mapbox: initialize lowp float emissive_strength
1583float dist=length(v_normal)*v_width2.s;
1584#ifdef VARIABLE_LINE_WIDTH
1585blur=mix(blur,0.0,stub_side);
1586#endif
1587float blur2=(u_width_scale*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);
1588#ifdef VARIABLE_LINE_WIDTH
1589alpha=mix(alpha,1.0,stub_side);
1590#endif
1591alpha=side_z_offset > 0.0 ? 1.0-alpha : alpha;
1592#ifdef RENDER_LINE_DASH
1593float sdfdist=texture(u_dash_image,v_tex).r;
1593float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;float scaled_floorwidth=(floorwidth*u_floor_width_scale);alpha*=linearstep(0.5-sdfgamma/scaled_floorwidth,0.5+sdfgamma/scaled_floorwidth,sdfdist);
1594#endif
1595highp vec4 out_color;
1596#ifdef RENDER_LINE_GRADIENT
1597out_color=texture(u_gradient_image,v_uv.xy);
1598#else
1599out_color=color;
1600#endif
1601float trim_alpha=1.0;
1602#ifdef RENDER_LINE_TRIM_OFFSET
1603highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);highp float gradient_trim_color_mix_factor=0.0;
1604#ifdef RENDER_LINE_GRADIENT
1605gradient_trim_color_mix_factor=smoothstep(u_trim_gradient_mix_range.x,u_trim_gradient_mix_range.y,line_progress);
1606#endif
1607highp vec4 trim_color=mix(u_trim_color,out_color,gradient_trim_color_mix_factor);out_color=mix(u_trim_gradient_mix_range.x < 1.0 ? color : out_color,trim_color,transition_factor);trim_alpha=1.0-transition_factor;}
1608#endif
1609if (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}}
1610#ifdef RENDER_LINE_BORDER
1611#ifndef VARIABLE_LINE_WIDTH
1612float edgeBlur=((border_width*u_width_scale)+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);if (border_color.a==0.0) {float Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}} else {out_color=mix(border_color*trim_alpha,out_color,smoothAlpha);}}
1613#endif
1614#endif
1615#ifdef LIGHTING_3D_MODE
1616out_color=apply_lighting_with_emission_ground(out_color,emissive_strength);
1617#ifdef RENDER_SHADOWS
1618float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);
1619#ifdef ELEVATED_ROADS
1620out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
1621#else
1622out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
1623#endif
1624#endif
1625#endif
1626#ifdef FOG
1627out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
1628#endif
1629out_color*=(alpha*opacity);
1630#ifdef INDICATOR_CUTOUT
1631out_color=applyCutout(out_color,v_z_offset);
1632#endif
1633#ifdef FEATURE_CUTOUT
1634out_color=apply_feature_cutout(out_color,gl_FragCoord);
1635#endif
1636glFragColor=out_color;
1637#ifdef DUAL_SOURCE_BLENDING
1638glFragColorSrc1=vec4(vec3(0.0),emissive_strength);
1639#else
1640#ifdef USE_MRT1
1641out_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
1642#endif
1643#endif
1644#ifdef OVERDRAW_INSPECTOR
1645glFragColor=vec4(1.0);
1646#endif
1647HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1648#include "_prelude_shadow.vertex.glsl"
1649#include "_prelude_terrain.vertex.glsl"
1650#define EXTRUDE_SCALE 0.015873016
1651in vec2 a_pos_normal;in vec4 a_data;
1652#if defined(ELEVATED) || defined(ELEVATED_ROADS) || defined(VARIABLE_LINE_WIDTH)
1653in vec3 a_z_offset_width;
1654#endif
1655#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)
1656in highp vec3 a_packed;
1657#endif
1658#ifdef RENDER_LINE_DASH
1659in float a_linesofar;
1660#endif
1661uniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;uniform float u_width_scale;uniform highp float u_floor_width_scale;
1662#ifdef ELEVATED
1663uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {
1664#ifdef ELEVATION_REFERENCE_SEA
1665return 0.0;
1666#else
1667return elevation(apos);
1668#endif
1669}
1670#endif
1671out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec3 v_uv;
1672#ifdef ELEVATED_ROADS
1673out highp float v_road_z_offset;
1674#endif
1675#ifdef VARIABLE_LINE_WIDTH
1676out float stub_side;
1677#endif
1678#ifdef RENDER_LINE_DASH
1679uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex;
1680#endif
1681#ifdef RENDER_LINE_GRADIENT
1682uniform float u_image_height;
1683#endif
1684#ifdef INDICATOR_CUTOUT
1685out highp float v_z_offset;
1686#endif
1687#ifdef RENDER_SHADOWS
1688uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;
1689#endif
1690#pragma mapbox: define highp vec4 color
1691#pragma mapbox: define lowp float floorwidth
1692#pragma mapbox: define lowp vec4 dash
1693#pragma mapbox: define lowp float blur
1694#pragma mapbox: define lowp float opacity
1695#pragma mapbox: define mediump float gapwidth
1696#pragma mapbox: define lowp float offset
1697#pragma mapbox: define mediump float width
1698#pragma mapbox: define mediump float side_z_offset
1699#pragma mapbox: define lowp float border_width
1700#pragma mapbox: define lowp vec4 border_color
1701#pragma mapbox: define lowp float emissive_strength
1702void main() {
1703#pragma mapbox: initialize highp vec4 color
1704#pragma mapbox: initialize lowp float floorwidth
1705#pragma mapbox: initialize lowp vec4 dash
1706#pragma mapbox: initialize lowp float blur
1707#pragma mapbox: initialize lowp float opacity
1708#pragma mapbox: initialize mediump float gapwidth
1709#pragma mapbox: initialize lowp float offset
1710#pragma mapbox: initialize mediump float width
1711#pragma mapbox: initialize mediump float side_z_offset
1712#pragma mapbox: initialize lowp float border_width
1713#pragma mapbox: initialize lowp vec4 border_color
1714#pragma mapbox: initialize lowp float emissive_strength
1715float a_z_offset;
1716#if defined(ELEVATED) || defined(ELEVATED_ROADS)
1717a_z_offset=a_z_offset_width.x;
1718#endif
1719float 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;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;offset=-1.0*offset*u_width_scale;gapwidth=gapwidth/2.0;float halfwidth;
1720#ifdef VARIABLE_LINE_WIDTH
1721bool left=normal.y==1.0;float left_width=a_z_offset_width.y;float right_width=a_z_offset_width.z;halfwidth=(u_width_scale*(left ? left_width : right_width))/2.0;a_z_offset+=left ? side_z_offset : 0.0;v_normal=side_z_offset > 0.0 && left ? vec2(0.0) : v_normal;offset=border_width >
1721 0.0 ? (left_width+right_width)*u_width_scale*0.5 : offset;halfwidth=border_width > 0.0 ? border_width*u_width_scale*0.5 : halfwidth;bool zero_right_width=border_width==0.0 && right_width==0.0;stub_side=zero_right_width ?-normal.y : 0.0;v_normal=!left && zero_right_width ? vec2(0.0) : v_normal;ANTIALIASING=!left && zero_right_width ? 0.0 : ANTIALIASING;
1722#else
1723halfwidth=(u_width_scale*width)/2.0;
1724#endif
1725float 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*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;
1726#ifdef ELEVATED_ROADS
1727v_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude;
1728#else
1729#ifdef ELEVATED
1730vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;
1731#ifdef CROSS_SLOPE_VERTICAL
1732float top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);
1733#else
1734#ifdef CROSS_SLOPE_HORIZONTAL
1735float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset;
1736#else
1737float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset;
1738#endif
1739#endif
1740gl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);
1741#else
1742gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);
1743#endif
1744#endif
1745#ifdef ELEVATED_ROADS
1746#ifdef RENDER_SHADOWS
1747vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;
1748#ifdef NORMAL_OFFSET
1749vec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();
1750#endif
1751v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
1752#endif
1753#endif
1754#ifndef RENDER_TO_TEXTURE
1755float epsilon=0.0001;float extrude_length_without_perspective=max(length(dist),epsilon);float extrude_length_with_perspective=max(length(projected_extrude_xy/gl_Position.w*u_units_to_pixels),epsilon);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur));
1756#else
1757v_gamma_scale=1.0;
1758#endif
1759#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)
1760highp float a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float line_progress=a_packed[2];
1761#ifdef RENDER_LINE_GRADIENT
1762highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec3(a_uv_x,a_split_index*texel_height-half_texel_height,line_progress);
1763#else
1764v_uv=vec3(a_uv_x,0.0,line_progress);
1765#endif
1766#endif
1767#ifdef RENDER_LINE_DASH
1768float scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/(floorwidth*u_floor_width_scale),(-normal.y*height+dash.x+0.5)/u_texsize.y);
1769#endif
1770v_width2=vec2(outset,inset);
1771#ifdef FOG
1772v_fog_pos=fog_position(pos);
1773#endif
1774#ifdef INDICATOR_CUTOUT
1775v_z_offset=a_z_offset;
1776#endif
1777}`),linePattern:jt(`#include "_prelude_fog.fragment.glsl"
1778#include "_prelude_lighting.glsl"
1779#include "_prelude_shadow.fragment.glsl"
1780uniform highp float u_device_pixel_ratio;uniform highp float u_width_scale;
1780uniform highp float u_alpha_discard_threshold;uniform highp vec2 u_texsize;uniform highp float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;uniform sampler2D u_image;
1781#ifdef APPLY_LUT_ON_GPU
1782uniform highp sampler3D u_lutTexture;
1783#endif
1784#ifdef LINE_PATTERN_TRANSITION
1785uniform float u_pattern_transition;
1786#endif
1787in vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width;
1788#ifdef RENDER_LINE_TRIM_OFFSET
1789in highp vec3 v_uv;
1790#endif
1791#ifdef ELEVATED_ROADS
1792in highp float v_road_z_offset;
1793#endif
1794#ifdef LINE_JOIN_NONE
1795in vec2 v_pattern_data;
1796#endif
1797#ifdef INDICATOR_CUTOUT
1798in highp float v_z_offset;
1799#endif
1800#ifdef RENDER_SHADOWS
1801uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;
1802#endif
1803#pragma mapbox: define mediump vec4 pattern
1804#ifdef LINE_PATTERN_TRANSITION
1805#pragma mapbox: define mediump vec4 pattern_b
1806#endif
1807#pragma mapbox: define mediump float pixel_ratio
1808#pragma mapbox: define mediump float blur
1809#pragma mapbox: define mediump float opacity
1810#pragma mapbox: define lowp float emissive_strength
1811void main() {
1812#pragma mapbox: initialize mediump vec4 pattern
1813#ifdef LINE_PATTERN_TRANSITION
1814#pragma mapbox: initialize mediump vec4 pattern_b
1815#endif
1816#pragma mapbox: initialize mediump float pixel_ratio
1817#pragma mapbox: initialize mediump float blur
1818#pragma mapbox: initialize mediump float opacity
1819#pragma mapbox: initialize lowp float emissive_strength
1820vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;highp float pattern_size=display_size.x/u_tile_units_to_pixels;float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*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);highp float pattern_x=v_linesofar/pattern_size*aspect;highp float x=mod(pattern_x,1.0);highp float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;highp vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));highp vec2 lod_pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(pattern_x,y));vec4 color=textureLodCustom(u_image,pos,lod_pos);
1821#ifdef APPLY_LUT_ON_GPU
1822color=applyLUT(u_lutTexture,color);
1823#endif
1824#ifdef LINE_PATTERN_TRANSITION
1825vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl*texel_size-texel_size,pattern_b_br*texel_size+texel_size,vec2(x,y));vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);color=color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;
1826#endif
1827#ifdef RENDER_LINE_TRIM_OFFSET
1828highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);color=mix(color,color.a*u_trim_color,transition_factor);}
1829#endif
1830#ifdef LINE_JOIN_NONE
1831highp float pattern_len=pattern_size/aspect;highp float segment_phase=pattern_len-mod(v_linesofar-v_pattern_data.x+pattern_len,pattern_len);highp float visible_start=segment_phase-step(pattern_len*0.5,segment_phase)*pattern_len;highp float visible_end=floor((v_pattern_data.y-segment_phase)/pattern_len)*pattern_len+segment_phase;visible_end+=step(pattern_len*0.5,v_pattern_data.y-visible_end)*pattern_len;if (v_pattern_data.x < visible_start || v_pattern_data.x >=visible_end) {color=vec4(0.0);}
1832#endif
1833#ifdef LIGHTING_3D_MODE
1834color=apply_lighting_with_emission_ground(color,emissive_strength);
1835#ifdef RENDER_SHADOWS
1836float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);
1837#ifdef ELEVATED_ROADS
1838color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
1839#else
1840color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
1841#endif
1842#endif
1843#endif
1844#ifdef FOG
1845color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
1846#endif
1847color*=(alpha*opacity);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}}
1848#ifdef INDICATOR_CUTOUT
1849color=applyCutout(color,v_z_offset);
1850#endif
1851glFragColor=color;
1852#ifdef DUAL_SOURCE_BLENDING
1853glFragColorSrc1=vec4(vec3(0.0),emissive_strength);
1854#else
1855#ifdef USE_MRT1
1856out_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
1857#endif
1858#endif
1859#ifdef OVERDRAW_INSPECTOR
1860glFragColor=vec4(1.0);
1861#endif
1862HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1863#include "_prelude_shadow.vertex.glsl"
1864#include "_prelude_terrain.vertex.glsl"
1865#define scale 0.015873016
1866in vec2 a_pos_normal;in vec4 a_data;
1867#if defined(ELEVATED) || defined(ELEVATED_ROADS)
1868in vec3 a_z_offset_width;
1869#endif
1870#ifdef RENDER_LINE_TRIM_OFFSET
1871in highp vec3 a_packed;
1872#endif
1873in highp float a_linesofar;
1874#ifdef LINE_JOIN_NONE
1875in highp vec3 a_pattern_data;out vec2 v_pattern_data;
1876#endif
1877#ifdef INDICATOR_CUTOUT
1878out highp float v_z_offset;
1879#endif
1880uniform mat4 u_matrix;uniform float u_tile_units_to_pixels;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform float u_device_pixel_ratio;uniform float u_width_scale;uniform float u_floor_width_scale;
1881#ifdef ELEVATED
1882uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {
1883#ifdef ELEVATION_REFERENCE_SEA
1884return 0.0;
1885#else
1886return elevation(apos);
1887#endif
1888}
1889#endif
1890out vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width;
1891#ifdef RENDER_LINE_TRIM_OFFSET
1892out highp vec3 v_uv;
1893#endif
1894#ifdef ELEVATED_ROADS
1895out highp float v_road_z_offset;
1896#endif
1897#ifdef RENDER_SHADOWS
1898uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;
1899#endif
1900#pragma mapbox: define mediump float blur
1901#pragma mapbox: define mediump float opacity
1902#pragma mapbox: define mediump float offset
1903#pragma mapbox: define mediump float gapwidth
1904#pragma mapbox: define mediump float width
1905#pragma mapbox: define mediump float floorwidth
1906#pragma mapbox: define mediump vec4 pattern
1907#ifdef LINE_PATTERN_TRANSITION
1908#pragma mapbox: define mediump vec4 pattern_b
1909#endif
1910#pragma mapbox: define mediump float pixel_ratio
1911#pragma mapbox: define lowp float emissive_strength
1912void main() {
1913#pragma mapbox: initialize mediump float blur
1914#pragma mapbox: initialize mediump float opacity
1915#pragma mapbox: initialize mediump float offset
1916#pragma mapbox: initialize mediump float gapwidth
1917#pragma mapbox: initialize mediump float width
1918#pragma mapbox: initialize mediump float floorwidth
1919#pragma mapbox: initialize mediump vec4 pattern
1920#ifdef LINE_PATTERN_TRANSITION
1921#pragma mapbox: initialize mediump vec4 pattern_b
1922#endif
1923#pragma mapbox: initialize mediump float pixel_ratio
1924#pragma mapbox: initialize lowp float emissive_strength
1925float a_z_offset;
1926#if defined(ELEVATED) || defined(ELEVATED_ROADS)
1927a_z_offset=a_z_offset_width.x;
1928#endif
1929float 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;vec2 pos=floor(a_pos_normal*0.5);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=(u_width_scale*width)/2.0;offset=-1.0*offset*u_width_scale;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);vec2 dist=outset*a_extrude*scale;float u=0.5*a_direction;float t=1.0-abs(u);vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;
1929vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;
1930#ifdef ELEVATED_ROADS
1931v_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude;
1932#else
1933#ifdef ELEVATED
1934vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;
1935#ifdef CROSS_SLOPE_VERTICAL
1936float top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);
1937#else
1938#ifdef CROSS_SLOPE_HORIZONTAL
1939float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset;
1940#else
1941float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset;
1942#endif
1943#endif
1944gl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);
1945#else
1946gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);
1947#endif
1948#endif
1949#ifdef ELEVATED_ROADS
1950#ifdef RENDER_SHADOWS
1951vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;
1952#ifdef NORMAL_OFFSET
1953vec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();
1954#endif
1955v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
1956#endif
1957#endif
1958#ifndef RENDER_TO_TEXTURE
1959float 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=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur));
1960#else
1961v_gamma_scale=1.0;
1962#endif
1963#ifdef RENDER_LINE_TRIM_OFFSET
1964highp float a_uv_x=a_packed[0];highp float line_progress=a_packed[2];v_uv=vec3(a_uv_x,0.0,line_progress);
1965#endif
1966v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=(floorwidth*u_floor_width_scale);
1967#ifdef LINE_JOIN_NONE
1968v_width=(floorwidth*u_floor_width_scale)+ANTIALIASING;mediump float pixels_to_tile_units=1.0/u_tile_units_to_pixels;mediump float pixel_ratio_inverse=1.0/pixel_ratio;mediump float aspect=v_width/((pattern.w-pattern.y)*pixel_ratio_inverse);highp float subt_multiple=(pattern.z-pattern.x)*pixel_ratio_inverse*pixels_to_tile_units*aspect*32.0;highp float subt=floor(a_pattern_data.z/subt_multiple)*subt_multiple;float offset_sign=(fract(a_pattern_data.x)-0.5)*4.0;float line_progress_offset=offset_sign*v_width*0.5*pixels_to_tile_units;v_linesofar=(a_pattern_data.z-subt)+a_linesofar+line_progress_offset;v_pattern_data=vec2(a_pattern_data.x+line_progress_offset,a_pattern_data.y);
1969#endif
1970#ifdef FOG
1971v_fog_pos=fog_position(pos);
1972#endif
1973#ifdef INDICATOR_CUTOUT
1974v_z_offset=a_z_offset;
1975#endif
1976}`),raster:jt(`#include "_prelude_fog.fragment.glsl"
1977#include "_prelude_lighting.glsl"
1978#include "_prelude_raster_array.glsl"
1979uniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;uniform highp float u_zoom_transition;in vec2 v_pos0;in vec2 v_pos1;in float v_depth;
1980#ifdef PROJECTION_GLOBE_VIEW
1981in float v_split_fade;
1982#endif
1983uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;uniform float u_emissive_strength;
1984#ifndef RASTER_ARRAY
1985uniform highp sampler2D u_image0;uniform sampler2D u_image1;
1986#endif
1987#ifdef RASTER_COLOR
1988uniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res;
1989#endif
1990void main() {vec4 color0,color1,color;vec2 value;
1991#ifdef RASTER_COLOR
1992#ifdef RASTER_ARRAY
1993#ifdef RASTER_ARRAY_LINEAR
1994value=mix(
1995raTexture2D_image0_linear(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_linear(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t
1996);
1997#else
1998value=mix(
1999raTexture2D_image0_nearest(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_nearest(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t
2000);
2001#endif
2002if (value.y > 0.0) value.x/=value.y;
2003#else
2004color=mix(texture(u_image0,v_pos0),texture(u_image1,v_pos1),u_fade_t);value=vec2(u_colorization_offset+dot(color.rgb,u_colorization_mix.rgb),color.a);
2005#endif
2006color=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y;
2007#else
2008color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);
2009#endif
2010color.a*=u_opacity;
2011#ifdef GLOBE_POLES
2012color.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition);
2013#endif
2014vec3 rgb=color.rgb;rgb=vec3(
2015dot(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);vec3 out_color=mix(u_high_vec,u_low_vec,rgb);
2016#ifdef LIGHTING_3D_MODE
2017out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb;
2018#endif
2019#ifdef FOG
2020highp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));
2021#endif
2022glFragColor=vec4(out_color*color.a,color.a);
2023#ifdef PROJECTION_GLOBE_VIEW
2024glFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade));
2025#endif
2026#ifdef RENDER_CUTOFF
2027glFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth);
2028#endif
2029#ifdef OVERDRAW_INSPECTOR
2030glFragColor=vec4(1.0);
2031#endif
2032#ifdef USE_MRT1
2033out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
2034#endif
2035HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
2036uniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;uniform vec2 u_texture_offset;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;
2037#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8
2038#ifdef GLOBE_POLES
2039in vec3 a_globe_pos;in vec2 a_uv;
2040#else
2041in vec2 a_pos;in vec2 a_texture_pos;
2042#endif
2043out vec2 v_pos0;out vec2 v_pos1;out float v_depth;
2044#ifdef PROJECTION_GLOBE_VIEW
2045out float v_split_fade;
2046#endif
2047void main() {vec2 uv;
2048#ifdef GLOBE_POLES
2049vec3 globe_pos=a_globe_pos;globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos   ,1.0);uv=a_uv;
2050#ifdef FOG
2051v_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz);
2052#endif
2053#else
2054float w=1.0+dot(a_texture_pos,u_perspective_transform);uv=a_texture_pos/8192.0;
2055#ifdef PROJECTION_GLOBE_VIEW
2056vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);    
2057v_split_fade=0.0;if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;float opposite_merc_center=mod(u_merc_center.x+0.5,1.0);float dist_from_poles=(abs(mercatorY-0.5)*2.0);float range=0.1;v_split_fade=abs(opposite_merc_center-mercatorX);v_split_fade=clamp(1.0-v_split_fade,0.0,1.0);v_split_fade=max(smoothstep(1.0-range,1.0,dist_from_poles),max(smoothstep(1.0-range,1.0,v_split_fade),smoothstep(1.0-range,1.0,1.0-v_split_fade)));}float tiles=u_grid_matrix[0][2];
2057if (tiles > 0.0) {float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvY=mercatorY*tiles-idy;float uvX=mercatorX*tiles-idx;uv=vec2(uvX,uvY);}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;
2058#ifdef FOG
2059v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
2060#endif
2061#else
2062gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);
2063#ifdef FOG
2064v_fog_pos=fog_position(a_pos);
2065#endif
2066#endif
2067#endif
2068v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;v_pos0=u_texture_offset.x+u_texture_offset.y*v_pos0;v_pos1=u_texture_offset.x+u_texture_offset.y*v_pos1;
2069#ifdef RENDER_CUTOFF
2070v_depth=gl_Position.z;
2071#endif
2072}`),rasterParticle:jt(`#include "_prelude_fog.fragment.glsl"
2073#include "_prelude_lighting.glsl"
2074uniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;in vec2 v_pos0;in vec2 v_pos1;uniform sampler2D u_image0;uniform sampler2D u_image1;void main() {vec4 color0,color1,color;color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 out_color=color.rgb;
2075#ifdef LIGHTING_3D_MODE
2076out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),1.0).rgb;
2077#endif
2078#ifdef FOG
2079highp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));
2080#endif
2081glFragColor=vec4(out_color*color.a,color.a);
2082#ifdef OVERDRAW_INSPECTOR
2083glFragColor=vec4(1.0);
2084#endif
2085HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
2086uniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;
2087#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8
2088in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv;
2089#ifdef PROJECTION_GLOBE_VIEW
2090vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvX=mercatorX*tiles-idx;float uvY=mercatorY*tiles-idy;uv=vec2(uvX,uvY);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;
2091#ifdef FOG
2092v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
2093#endif
2094#else
2095uv=a_texture_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);
2096#ifdef FOG
2097v_fog_pos=fog_position(a_pos);
2098#endif
2099#endif
2100v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),rasterParticleDraw:jt("uniform sampler2D u_color_ramp;in float v_particle_speed;void main() {glFragColor=texture(u_color_ramp,vec2(v_particle_speed,0.5));}",`#include "_prelude_raster_particle.glsl"
2101in float a_index;uniform sampler2D u_particle_texture;uniform float u_particle_texture_side_len;uniform vec2 u_tile_offset;out float v_particle_speed;void main() {ivec2 pixel_coord=ivec2(
2102mod(a_index,u_particle_texture_side_len),a_index/u_particle_texture_side_len);vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);vec2 pos=unpack_pos_from_rgba(pixel)+u_tile_offset;vec2 tex_coord=fract(pos);vec2 velocity=lookup_velocity(tex_coord);if (velocity==INVALID_VELOCITY) {gl_Position=AWAY;v_particle_speed=0.0;} else {gl_Position=vec4(2.0*pos-1.0,0,1);v_particle_speed=length(velocity);}gl_PointSize=1.0;}`),rasterParticleTexture:jt("uniform sampler2D u_texture;uniform float u_opacity;in vec2 v_tex_pos;void main() {vec4 color=texture(u_texture,v_tex_pos);glFragColor=vec4(floor(255.0*color*u_opacity)/255.0);}","in vec2 a_pos;out vec2 v_tex_pos;void main() {vec2 uv=0.5*a_pos+vec2(0.5);v_tex_pos=uv;gl_Position=vec4(a_pos,0.0,1.0);}"),rasterParticleUpdate:jt(`#include "_prelude_raster_particle.glsl"
2103uniform sampler2D u_particle_texture;uniform mediump float u_particle_texture_side_len;uniform mediump float u_speed_factor;uniform highp float u_reset_rate;uniform highp float u_rand_seed;in highp vec2 v_tex_coord;
2103vec2 linearstep(vec2 edge0,vec2 edge1,vec2 x) {return  clamp((x-edge0)/(edge1-edge0),vec2(0),vec2(1));}const highp vec3 rand_constants=vec3(12.9898,78.233,4375.85453);highp float rand(const highp vec2 co) {highp float t=dot(rand_constants.xy,co);return fract(sin(t)*(rand_constants.z+t));}void main() {ivec2 pixel_coord=ivec2(v_tex_coord*u_particle_texture_side_len);highp vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);highp vec2 pos=unpack_pos_from_rgba(pixel);highp vec2 velocity=lookup_velocity(clamp(pos,0.0,1.0));highp vec2 dp=velocity==INVALID_VELOCITY ? vec2(0) : velocity*u_speed_factor;pos=pos+dp;highp vec2 seed=(pos+v_tex_coord)*u_rand_seed;highp vec2 random_pos=vec2(rand(seed+1.3),rand(seed+2.1));highp vec2 persist_rate=pow(
2104linearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4)
2105);highp vec2 per_frame_persist=pow(persist_rate,abs(dp)/u_particle_pos_offset);highp float drop_rate=1.0-per_frame_persist.x*per_frame_persist.y;drop_rate=any(greaterThanEqual(abs(pos-0.5),vec2(0.5+u_particle_pos_offset))) ? 1.0 : drop_rate;highp float drop=step(1.0-drop_rate-u_reset_rate,rand(seed));highp vec2 next_pos=mix(pos,random_pos,drop);glFragColor=pack_pos_to_rgba(next_pos);}`,"in vec2 a_pos;out vec2 v_tex_coord;void main() {v_tex_coord=0.5*(a_pos+vec2(1.0));gl_Position=vec4(a_pos,0.0,1.0);}"),symbol:jt(`#include "_prelude_lighting.glsl"
2106#include "_prelude_shadow.fragment.glsl"
2107#define SDF_PX 8.0
2108#define SDF 1.0
2109#define ICON 0.0
2110uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_halo;uniform lowp float u_scale_factor;
2111#ifdef ICON_TRANSITION
2112uniform float u_icon_transition;
2113#endif
2114#ifdef COLOR_ADJUSTMENT
2115uniform mat4 u_color_adj_mat;
2116#endif
2117#ifdef INDICATOR_CUTOUT
2118in highp float v_z_offset;
2119#else
2120#ifdef RENDER_SHADOWS
2121in highp float v_z_offset;
2122#endif
2123#endif
2124in vec2 v_tex_a;
2125#ifdef ICON_TRANSITION
2126in vec2 v_tex_b;
2127#endif
2128in float v_draw_halo;in vec3 v_gamma_scale_size_fade_opacity;
2129#ifdef RENDER_TEXT_AND_SYMBOL
2130in float is_sdf;in vec2 v_tex_a_icon;
2131#endif
2132#ifdef RENDER_SHADOWS
2133uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;
2134#endif
2135#ifdef APPLY_LUT_ON_GPU
2136uniform highp sampler3D u_lutTexture;
2137#endif
2138#pragma mapbox: define highp vec4 fill_color
2139#pragma mapbox: define highp vec4 halo_color
2140#pragma mapbox: define lowp float opacity
2141#pragma mapbox: define lowp float halo_width
2142#pragma mapbox: define lowp float halo_blur
2143#pragma mapbox: define lowp float emissive_strength
2144void main() {
2145#pragma mapbox: initialize highp vec4 fill_color
2146#pragma mapbox: initialize highp vec4 halo_color
2147#pragma mapbox: initialize lowp float opacity
2148#pragma mapbox: initialize lowp float halo_width
2149#pragma mapbox: initialize lowp float halo_blur
2150#pragma mapbox: initialize lowp float emissive_strength
2151vec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2];
2152#ifdef RENDER_TEXT_AND_SYMBOL
2153if (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity;glFragColor=texture(u_texture_icon,tex_icon)*alpha;
2154#ifdef OVERDRAW_INSPECTOR
2155glFragColor=vec4(1.0);
2156#endif
2157return;}
2158#endif
2159#ifdef RENDER_SDF
2160float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_gamma_scale_size_fade_opacity.x;float size=v_gamma_scale_size_fade_opacity.y;float fontScale=u_is_text ? size/24.0 : size;out_color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {out_color=halo_color;gamma=(halo_blur*u_scale_factor*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width*u_scale_factor/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,v_tex_a).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);out_color*=alpha;
2161#else
2162#ifdef ICON_TRANSITION
2163vec4 a=texture(u_texture,v_tex_a)*(1.0-u_icon_transition);vec4 b=texture(u_texture,v_tex_b)*u_icon_transition;out_color=(a+b);
2164#else
2165out_color=texture(u_texture,v_tex_a);
2166#endif
2167#ifdef APPLY_LUT_ON_GPU
2168out_color=applyLUT(u_lutTexture,out_color);
2169#endif
2170#ifdef COLOR_ADJUSTMENT
2171out_color=u_color_adj_mat*out_color;
2172#endif
2173#endif
2174out_color*=opacity*fade_opacity;
2175#ifdef LIGHTING_3D_MODE
2176out_color=apply_lighting_with_emission_ground(out_color,emissive_strength);
2177#ifdef RENDER_SHADOWS
2178float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);
2179#ifdef TERRAIN
2180out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
2181#else
2182out_color.rgb*=mix(v_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
2183#endif
2184#endif
2185#endif
2186#ifdef INDICATOR_CUTOUT
2187out_color=applyCutout(out_color,v_z_offset);
2188#endif
2189#ifdef FEATURE_CUTOUT
2190out_color=apply_feature_cutout(out_color,gl_FragCoord);
2191#endif
2192glFragColor=out_color;
2193#ifdef OVERDRAW_INSPECTOR
2194glFragColor=vec4(1.0);
2195#endif
2196HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl"
2197#include "_prelude_shadow.vertex.glsl"
2198#define USING_APPEARANCE 1.0
2199in vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity;
2200#ifdef Z_OFFSET
2201in float a_auto_z_offset;
2202#endif
2203#ifdef PROJECTION_GLOBE_VIEW
2204in vec3 a_globe_anchor;in vec3 a_globe_normal;
2205#endif
2206#ifdef ICON_TRANSITION
2207in vec2 a_texb;
2208#endif
2209#ifdef OCCLUSION_QUERIES
2210in float a_occlusion_query_opacity;
2211#endif
2212#ifdef ELEVATED_ROADS
2213in vec3 a_x_axis;in vec3 a_y_axis;uniform float u_normal_scale;
2214#endif
2215#ifdef INDICATOR_CUTOUT
2216out highp float v_z_offset;
2217#else
2218#ifdef RENDER_SHADOWS
2219out highp float v_z_offset;
2220#endif
2221#endif
2222uniform 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_inv_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_elevation_from_sea;uniform bool u_pitch_with_map;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 vec3 u_up_vector;uniform vec2 u_texsize_icon;uniform bool u_is_halo;
2223#ifdef PROJECTION_GLOBE_VIEW
2224uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;
2225#endif
2226out vec2 v_tex_a;
2227#ifdef ICON_TRANSITION
2228out vec2 v_tex_b;
2229#endif
2230out float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity;
2231#ifdef RENDER_TEXT_AND_SYMBOL
2232out float is_sdf;out vec2 v_tex_a_icon;
2233#endif
2234#ifdef RENDER_SHADOWS
2235uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;
2236#endif
2237#pragma mapbox: define highp vec4 fill_color
2238#pragma mapbox: define highp vec4 halo_color
2239#pragma mapbox: define lowp float opacity
2240#pragma mapbox: define lowp float halo_width
2241#pragma mapbox: define lowp float halo_blur
2242#pragma mapbox: define lowp float emissive_strength
2243#pragma mapbox: define lowp float occlusion_opacity
2244#pragma mapbox: define lowp float z_offset
2245void main() {
2246#pragma mapbox: initialize highp vec4 fill_color
2247#pragma mapbox: initialize highp vec4 halo_color
2248#pragma mapbox: initialize lowp float opacity
2249#pragma mapbox: initialize lowp float halo_width
2250#pragma mapbox: initialize lowp float halo_blur
2251#pragma mapbox: initialize lowp float emissive_strength
2252#pragma mapbox: initialize lowp float occlusion_opacity
2253#pragma mapbox: initialize lowp float z_offset
2254vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);float a_size_max= floor(a_size[1]*0.5);float a_apperance=a_size[1]-2.0*a_size_max;vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (a_apperance==USING_APPEARANCE) {size=a_size_max/128.0;} else if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size_max,u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=u_elevation_from_sea ? z_offset : z_offset+elevation(tile_anchor);
2255#ifdef Z_OFFSET
2256e+=a_auto_z_offset;
2257#endif
2258vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe;
2259#ifdef PROJECTION_GLOBE_VIEW
2260mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos_globe=a_globe_anchor+h;world_pos=mix_globe_mercator(world_pos_globe,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;
2261#else
2262world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;
2263#endif
2264vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?
2265camera_to_anchor_distance/u_camera_to_center_distance :
2266u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(
22670.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;vec2 a;
2268#ifdef PROJECTION_GLOBE_VIEW
2269vec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);vec4 projected_point_globe=u_matrix*vec4(world_pos_globe,1);a=projected_point_globe.xy/projected_point_globe.w;
2270#else
2271offsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w;
2272#endif
2273vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;
2274#ifdef PROJECTION_GLOBE_VIEW
2275#ifdef PROJECTED_POS_ON_VIEWPORT
2276projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xyz+h,1.0);
2277#else
2278vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz,mercator_pos,u_zoom_transition)+h;projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);    
2279#endif
2280#else
2281projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);
2282#endif
2283highp 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);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0);
2284#ifdef TERRAIN
2285#ifdef PITCH_WITH_MAP_TERRAIN
2286vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);
2287#endif
2288#endif
2289#ifdef Z_OFFSET
2290z+=u_pitch_with_map ? a_auto_z_offset+z_offset : 0.0;
2291#else
2292z+=u_pitch_with_map ? z_offset : 0.0;
2293#endif
2294float occlusion_fade=globe_occlusion_fade;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float out_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));
2295#ifdef DEPTH_OCCLUSION
2296float depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier;
2297#endif
2298#ifdef OCCLUSION_QUERIES
2299float occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier;
2300#endif
2301#ifdef Z_TEST_OCCLUSION
2302out_fade_opacity*=occlusion_opacity;
2303#endif
2304float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);vec3 pos;
2305#ifdef PROJECTION_GLOBE_VIEW
2306vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y;
2307#else
2308#ifdef ELEVATED_ROADS
2309vec3 xAxis=vec3(a_x_axis.xy,a_x_axis.z*u_normal_scale);vec3 yAxis=vec3(a_y_axis.xy,a_y_axis.z*u_normal_scale);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y;
2310#else
2311pos=vec3(projected_pos.xy/projected_pos.w+offset,z);
2312#endif
2313#endif
2314gl_Position=mix(u_coord_matrix*vec4(pos,1.0),AWAY,hidden);float gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_gamma_scale_size_fade_opacity=vec3(gamma_scale,size,out_fade_opacity);v_tex_a=a_tex/u_texsize;
2315#ifdef RENDER_TEXT_AND_SYMBOL
2316is_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon;
2317#endif
2318#ifdef ICON_TRANSITION
2319v_tex_b=a_texb/u_texsize;
2320#endif
2321#ifdef RENDER_SHADOWS
2322vec4 shd_pos=u_inv_matrix*vec4(pos,1.0);vec3 shd_pos0=shd_pos.xyz;vec3 shd_pos1=shd_pos.xyz;
2323#ifdef NORMAL_OFFSET
2324vec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();
2325#endif
2326v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
2327#endif
2328#ifdef INDICATOR_CUTOUT
2329v_z_offset=e;
2330#else
2331#ifdef RENDER_SHADOWS
2332v_z_offset=e;
2333#endif
2334#endif
2335}`),terrainRaster:jt(`#include "_prelude_fog.fragment.glsl"
2336#include "_prelude_shadow.fragment.glsl"
2337#include "_prelude_lighting.glsl"
2338uniform sampler2D u_image0;
2339#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2340uniform sampler2D u_image1;uniform float u_emissive_texture_available;
2341#endif
2342in vec2 v_pos0;
2343#ifdef FOG
2344in float v_fog_opacity;
2345#endif
2346#ifdef RENDER_SHADOWS
2347in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;
2348#endif
2349uniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color;
2350#ifdef LIGHTING_3D_MODE
2351const vec3 normal=vec3(0.0,0.0,1.0);
2352#ifdef RENDER_SHADOWS
2353float cutoffOpacity=1.0;
2354#ifdef RENDER_CUTOFF
2355cutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w);
2356#endif
2357#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2358float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : image_color.a;vec3 unlit_base=image_color.rgb*(1.0-emissive_strength);vec3 emissive_base=image_color.rgb*emissive_strength;float ndotl=u_shadow_direction.z;float occlusion=ndotl < 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,0.0);ndotl=max(0.0,ndotl);vec3 lit=apply_lighting(unlit_base,normal,mix(1.0,(1.0-(u_shadow_intensity*occlusion))*ndotl,cutoffOpacity));vec3 emissive=compute_emissive_draped(emissive_base,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=lit+emissive;color.a=1.0;
2359#else
2360float lighting_factor=shadowed_light_factor_normal_unbiased(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);color=apply_lighting(image_color,normal,mix(1.0,lighting_factor,cutoffOpacity));
2361#endif
2362#else
2363float lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor);
2364#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2365float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : image_color.a;color.rgb=mix(color.rgb,image_color.rgb,emissive_strength);color.a=1.0;
2366#endif
2367#endif
2368#else
2369color=image_color;
2370#endif
2371#ifdef FOG
2372#ifdef ZERO_EXAGGERATION
2373color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
2374#else
2375color=fog_dither(fog_apply_from_vert(color,v_fog_opacity));
2376#endif
2377#endif
2378glFragColor=color;
2379#ifdef OVERDRAW_INSPECTOR
2380glFragColor=vec4(1.0);
2381#endif
2382HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
2383#include "_prelude_terrain.vertex.glsl"
2384uniform mat4 u_matrix;uniform float u_skirt_height;in vec2 a_pos;out vec2 v_pos0;
2385#ifdef FOG
2386out float v_fog_opacity;
2387#endif
2388#ifdef RENDER_SHADOWS
2389uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;
2390#endif
2391void main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;v_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);
2392#ifdef FOG
2393#ifdef ZERO_EXAGGERATION
2394v_fog_pos=fog_position(decodedPos);
2395#else
2396v_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));
2397#endif
2398#endif
2399#ifdef RENDER_SHADOWS
2400vec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.);
2401#endif
2402}`),terrainDepth:jt("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",`#include "_prelude_terrain.vertex.glsl"
2403uniform mat4 u_matrix;in vec2 a_pos;out float v_depth;void main() {float elevation=elevation(a_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}`),skybox:jt(`#include "_prelude_fog.fragment.glsl"
2404in lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(
2405cos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(e
2405nd-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=texture(u_cubemap,uv).rgb;
2406#ifdef FOG
2407sky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);
2408#endif
2409sky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity);
2410#ifdef OVERDRAW_INSPECTOR
2411glFragColor=vec4(1.0);
2412#endif
2413}`,Ta),skyboxGradient:jt(`#include "_prelude_fog.fragment.glsl"
2414in highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture(u_color_ramp,vec2(progress,0.5));
2415#ifdef FOG
2416color.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;
2417#endif
2418color*=u_opacity;glFragColor=color;
2419#ifdef OVERDRAW_INSPECTOR
2420glFragColor=vec4(1.0);
2421#endif
2422}`,Ta),skyboxCapture:jt
vendor: 3,792 bytes, lines 2422-2433
2422(`
2423in highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;precision highp float;
2424#define BETA_R                  vec3(5.5e-6,13.0e-6,22.4e-6)
2425#define BETA_M                  vec3(21e-6,21e-6,21e-6)
2426#define MIE_G                   0.76
2427#define DENSITY_HEIGHT_SCALE_R  8000.0
2428#define DENSITY_HEIGHT_SCALE_M  1200.0
2429#define PLANET_RADIUS           6360e3
2430#define ATMOSPHERE_RADIUS       6420e3
2431#define SAMPLE_STEPS            10
2432#define DENSITY_STEPS           4
2433float ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;glFragColor=vec4(color,1.0);}`,"in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globe
2433Raster:jt(`#include "_prelude_fog.fragment.glsl"
2434#include "_prelude_lighting.glsl"
2435uniform sampler2D u_image0;
2436#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2437uniform sampler2D u_image1;uniform float u_emissive_texture_available;
2438#endif
2439uniform float u_far_z_cutoff;in vec2 v_pos0;
2440#ifndef FOG
2441uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport;
2442#endif
2443void main() {vec4 color;
2444#ifdef CUSTOM_ANTIALIASING
2445highp vec2 uv=gl_FragCoord.xy/u_viewport;
2446#ifdef FLIP_Y
2447uv.y=1.0-uv.y;
2448#endif
2449highp vec3 ray_dir=mix(
2450mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;highp float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);highp float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture(u_image0,v_pos0);
2451#ifdef LIGHTING_3D_MODE
2452#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2453float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : raster.a;raster=apply_lighting_with_emission_ground(raster,emissive_strength);color=vec4(clamp(raster.rgb,vec3(0),vec3(1))*antialias,antialias);
2454#else
2455raster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias);
2456#endif
2457#else
2458color=vec4(raster.rgb*antialias,raster.a*antialias);
2459#endif
2460#else
2461color=texture(u_image0,v_pos0);
2462#ifdef LIGHTING_3D_MODE
2463#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2464float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : color.a;color=apply_lighting_with_emission_ground(color,emissive_strength);color.a=1.0;
2465#else
2466color=apply_lighting_ground(color);
2467#endif
2468#endif
2469#endif
2470#ifdef FOG
2471color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
2472#endif
2473color*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color;
2474#ifdef OVERDRAW_INSPECTOR
2475glFragColor=vec4(1.0);
2476#endif
2477HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
2478#include "_prelude_terrain.vertex.glsl"
2479uniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height;
2480#ifdef GLOBE_POLES
2481in vec3 a_globe_pos;in vec2 a_uv;
2482#else
2483in vec2 a_pos;
2484#endif
2485out vec2 v_pos0;void main() {
2486#ifdef GLOBE_POLES
2487vec3 globe_pos=a_globe_pos;vec2 uv=a_uv;
2488#else
2489float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY);
2490#endif
2491v_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale;
2492#ifdef GLOBE_POLES
2493vec3 up_vector=globe_derived_up_vector;
2494#else
2495vec3 up_vector=elevationVector(tile_pos);
2496#endif
2497float height=elevation(tile_pos);globe_pos+=up_vector*height;
2498#ifndef GLOBE_POLES
2499globe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z;
2500#endif
2501#ifdef GLOBE_POLES
2502vec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);
2503#else
2504vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);
2505#endif
2506gl_Position=u_proj_matrix*interpolated_pos;
2507#ifdef FOG
2508v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
2509#endif
2510}`),globeAtmosphere:jt(`#include "_prelude_fog.fragment.glsl"
2511uniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_atmosphere_fog_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir;
2512#ifdef PROJECTION_GLOBE_VIEW
2513globe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {
2514#ifdef ALPHA_PASS
2515glFragColor=vec4(0,0,0,0);return;
2516#else
2517#ifdef NATIVE
2518glFragColor=vec4(1,1,1,1);
2519#else
2520glFragColor=vec4(0,0,0,1);
2521#endif
2522return;
2523#endif
2524}
2525#endif
2526highp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?
25270.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle;
2528#ifdef PROJECTION_GLOBE_VIEW
2529highp vec3 closest_point=globe_pos_dot_dir*dir;highp float closest_point_to_center=length(closest_point-u_globe_pos);highp float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ?
2530PI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t);
2531#else
2532horizon_angle=horizon_angle_mercator;
2533#endif
2534horizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_atmosphere_fog_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_atmosphere_fog_color.rgb;vec3 color_stop_1=u_high_color.rgb;
2534vec3 color_stop_2=u_space_color.rgb;
2535#ifdef ALPHA_PASS
2536float a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);glFragColor=vec4(1.0,1.0,1.0,a);
2537#else
2538vec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c=c2;glFragColor=vec4(c*t,t);
2539#endif
2540}`,`in vec3 a_pos;in vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;out highp vec3 v_ray_dir;out highp vec3 v_horizon_dir;void main() {v_ray_dir=mix(
2541mix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix(
2542mix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}`),model:jt(`#include "_prelude_fog.fragment.glsl"
2543#include "_prelude_shadow.fragment.glsl"
2544#include "_prelude_lighting.glsl"
2545uniform float u_opacity;
2546#ifdef DITHERED_DISCARD
2547uniform float u_dithered_discard_threshold;
2548#endif
2549uniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;uniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix;
2550#ifdef RENDER_SHADOWS
2551in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows;
2552#endif
2553#ifdef OCCLUSION_TEXTURE_TRANSFORM
2554uniform vec4 u_occlusionTextureTransform;
2555#endif
2556#pragma mapbox: define-attribute highp vec3 normal_3f
2557#pragma mapbox: define-attribute highp vec3 color_3f
2558#pragma mapbox: define-attribute highp vec4 color_4f
2559#pragma mapbox: define-attribute highp vec2 uv_2f
2560#pragma mapbox: initialize-attribute highp vec3 normal_3f
2561#pragma mapbox: initialize-attribute highp vec3 color_3f
2562#pragma mapbox: initialize-attribute highp vec4 color_4f
2563#pragma mapbox: initialize-attribute highp vec2 uv_2f
2564#ifdef HAS_ATTRIBUTE_a_pbr
2565in lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params;
2566#endif
2567#ifdef HAS_TEXTURE_u_baseColorTexture
2568uniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff;
2569#endif
2570#ifdef HAS_TEXTURE_u_metallicRoughnessTexture
2571uniform sampler2D u_metallicRoughnessTexture;
2572#endif
2573#ifdef HAS_TEXTURE_u_occlusionTexture
2574uniform sampler2D u_occlusionTexture;uniform float u_aoIntensity;
2575#endif
2576#ifdef HAS_TEXTURE_u_normalTexture
2577uniform sampler2D u_normalTexture;
2578#endif
2579#ifdef HAS_TEXTURE_u_emissionTexture
2580uniform sampler2D u_emissionTexture;
2581#endif
2582#ifdef APPLY_LUT_ON_GPU
2583uniform highp sampler3D u_lutTexture;
2584#endif
2585#ifdef TERRAIN_FRAGMENT_OCCLUSION
2586in highp float v_depth;uniform highp sampler2D u_depthTexture;uniform highp vec2 u_inv_depth_size;uniform highp vec2 u_depth_range_unpack;
2587#ifdef DEPTH_D24
2588highp float unpack_depth(highp float depth) {return  depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}
2589#else
2590highp float unpack_depth_rgba(highp vec4 rgba_depth)
2591{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}
2592#endif
2593bool isOccluded() {highp vec2 coord=gl_FragCoord.xy*u_inv_depth_size;
2594#ifdef FLIP_Y
2595coord.y=1.0-coord.y;
2596#endif
2597#ifdef DEPTH_D24
2598highp float depth=unpack_depth(texture(u_depthTexture,coord).r);
2599#else
2600highp float depth=unpack_depth_rgba(texture(u_depthTexture,coord));
2601#endif
2602return v_depth > depth+0.0005;}
2603#endif
2604#define saturate(_x) clamp(_x,0.,1.)
2605vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}float calculate_NdotL(vec3 normal,vec3 lightDir) {const float ext=0.70710678118;return (clamp(dot(normal,lightDir),-ext,1.0)+ext)/(1.0+ext);}vec3 getDiffuseShadedColor(vec3 albedo,vec3 normal,vec3 lightDir,vec3 lightColor)
2606{
2607#ifdef LIGHTING_3D_MODE
2608vec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor;
2609#ifdef RENDER_SHADOWS
2610lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);
2611#else
2612lighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir));
2613#endif
2614return apply_lighting(albedo,transformed_normal,lighting_factor);
2615#else
2616vec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-light
2616Color),vec3(1.0));return c3;
2617#endif
2618}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor;
2619#ifdef HAS_ATTRIBUTE_a_color_3f
2620albedo*=vec4(color_3f,1.0);
2621#endif
2622#ifdef HAS_ATTRIBUTE_a_pbr
2623#else
2624#ifdef HAS_ATTRIBUTE_a_color_4f
2625albedo*=color_4f;
2626#endif
2627#endif
2628#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f)
2629vec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}}
2630#ifdef UNPREMULT_TEXTURE_IN_SHADER
2631if(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=1.0;
2632#endif
2633if(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;}
2634#endif
2635vec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a);
2636#ifdef APPLY_LUT_ON_GPU
2637color=applyLUT(u_lutTexture,color);
2638#endif
2639return color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) {
2640#ifdef HAS_TEXTURE_u_normalTexture
2641highp vec3 dp1=vec3(dFdx(p.x),dFdx(p.y),dFdx(p.z));highp vec3 dp2=vec3(dFdy(p.x),dFdy(p.y),dFdy(p.z));highp vec2 duv1=vec2(dFdx(uv.x),dFdx(uv.y));highp vec2 duv2=vec2(dFdy(uv.x),dFdy(uv.y));highp vec3 dp2perp=cross( dp2,N );highp vec3 dp1perp=cross( N,dp1 );highp vec3 T=dp2perp*duv1.x+dp1perp*duv2.x;highp vec3 B=dp2perp*duv1.y+dp1perp*duv2.y;
2642#ifdef FLIP_Y
2643T=-T;B=-B;
2644#endif
2645highp float lengthT=dot(T,T);highp float lengthB=dot(B,B);highp float maxLength=max(lengthT,lengthB);highp float invmax=inversesqrt( maxLength );highp mat3 res=mat3( T*invmax,B*invmax,N );return res;
2646#else
2647return mat3(1.0);
2648#endif
2649}highp vec3 getNormal(){highp vec3 n;
2650#ifdef HAS_ATTRIBUTE_a_normal_3f
2651n=normalize(normal_3f);
2652#else
2653highp vec3 fdx=vec3(dFdx(v_position_height.x),dFdx(v_position_height.y),dFdx(v_position_height.z));highp vec3 fdy=vec3(dFdy(v_position_height.x),dFdy(v_position_height.y),dFdy(v_position_height.z));
2654#ifdef FLIP_Y
2655n=normalize(cross(fdx,fdy));
2656#else
2657n=normalize(cross(fdx,fdy))*-1.0;
2658#endif
2659#endif
2660#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
2661vec3 nMap=texture( u_normalTexture,uv_2f).xyz;nMap=normalize(2.0*nMap-vec3(1.0));highp vec3 v=normalize(-v_position_height.xyz);highp mat3 TBN=cotangentFrame(n,v,uv_2f);n=normalize(TBN*nMap);
2662#endif
2663return n;}struct Material {float perceptualRoughness;float alphaRoughness;float metallic;vec3 f90;vec4 baseColor;vec3 diffuseColor;vec3 specularColor;highp vec3 normal;};Material getPBRMaterial() {Material mat;mat.baseColor=getBaseColor();mat.perceptualRoughness=u_roughnessFactor;mat.metallic=u_metallicFactor;
2664#ifdef HAS_ATTRIBUTE_a_pbr
2665mat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w;
2666#endif
2667#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 
2668vec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b;
2669#endif
2670const float c_minRoughness=0.04;mat.perceptualRoughness=clamp(mat.perceptualRoughness,c_minRoughness,1.0);mat.metallic=saturate(mat.metallic);mat.alphaRoughness=mat.perceptualRoughness*mat.perceptualRoughness;const vec3 f0=vec3(0.04);mat.diffuseColor=mat.baseColor.rgb*(vec3(1.0)-f0);mat.diffuseColor*=1.0-mat.metallic;mat.specularColor=mix(f0,mat.baseColor.rgb,mat.metallic);highp float reflectance=max(max(mat.specularColor.r,mat.specularColor.g),mat.specularColor.b);highp float reflectance90=saturate(reflectance*25.0);mat.f90=vec3(reflectance90);mat.normal=getNormal();return mat;}float V_GGX(float NdotL,float NdotV,float roughness)
2671{float a2=roughness*roughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-a2)+a2);float GGXL=NdotV*sqrt(NdotL*NdotL*(1.0-a2)+a2);return 0.5/(GGXV+GGXL);}float V_GGXFast(float NdotL,float NdotV,float roughness) {float a=roughness;float GGXV=NdotL*(NdotV*(1.0-a)+a);float GGXL=NdotV*(NdotL*(1.0-a)+a);return 0.5/(GGXV+GGXL);}vec3 F_Schlick(vec3 specularColor,vec3 f90,float VdotH)
2672{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH)
2673{float x=1.0-VdotH;float x4=x*x*x*x;return specularColor+(1.0-specularColor)*x4*x;}float D_GGX(highp float NdotH,float alphaRoughness)
2674{highp float a4=alphaRoughness*alphaRoughness;highp float f=(NdotH*a4-NdotH)*NdotH+1.0;return a4/(PI*f*f);}vec3 diffuseBurley(Material mat,float LdotH,float NdotL,float NdotV)
2675{float f90=2.0*LdotH*LdotH*mat.alphaRoughness-0.5;return (mat.diffuseColor/PI)*(1.0+f90*pow((1.0-NdotL),5.0))*(1.0+f90*pow((1.0-NdotV),5.0));}vec3 diffuseLambertian(Material mat)
2676{
2677#ifdef LIGHTING_3D_MODE
2678return mat.diffuseColor;
2679#else
2680return mat.diffuseColor/PI;
2681#endif
2682}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV)
2683{vec4 c0=vec4(-1,-0.0275,-0.572,0.022);vec4 c1=vec4(1,0.0425,1.04,-0.04);highp vec4 r=roughness*c0+c1;highp float a004=min(r.x*r.x,exp2(-9.28*NdotV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}vec3 computeIndirectLightContribution(Material mat,float NdotV,vec3 normal)
2684{vec3 env_light=vec3(0.65,0.65,0.65);
2685#ifdef LIGHTING_3D_MODE
2686float ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor;
2687#endif
2688vec3 envBRDF=EnvBRDFApprox(mat.specularColor,mat.perceptualRoughness,NdotV);vec3 indirectSpecular= envBRDF*env_light;vec3 indirectDiffuse=mat.diffuseColor*env_light;return indirectSpecular+indirectDiffuse;}vec3 computeLightContribution(Material mat,vec3 lightPosition,vec3 lightColor)
2689{highp vec3 n=mat.normal;highp vec3 v=normalize(-v_position_height.xyz);highp vec3 l=normalize(lightPosition);highp vec3 h=normalize(v+l);float NdotV=clamp(abs(dot(n,v)),0.001,1.0);float NdotL=saturate(dot(n,l));highp float NdotH=saturate(dot(n,h));float VdotH=saturate(dot(v,h));vec3 f=F_SchlickFast(mat.specularColor,VdotH);float g=V_GGXFast(NdotL,NdotV,mat.alphaRoughness);float d=D_GGX(NdotH,mat.alphaRoughness);vec3 diffuseTerm=(1.0-f)*diffuseLambertian(mat);vec3 specularTerm=f*g*d;vec3 transformed_normal=vec3(-n.xy,n.z);float lighting_factor;
2690#ifdef RENDER_SHADOWS
2691lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);
2692#else
2693lighting_factor=NdotL;
2694#endif
2695vec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*light
2695Color;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0;
2696#if !defined(LIGHTING_3D_MODE)
2697const vec3 luminosityFactor=vec3(0.2126,0.7152,0.0722);float luminance=dot(diffuseTerm,luminosityFactor);intensityFactor=mix((1.0-u_lightintensity),max((1.0-luminance+u_lightintensity),1.0),NdotL);
2698#endif
2699color*=intensityFactor;return color;}void main() {
2700#ifdef TERRAIN_FRAGMENT_OCCLUSION
2701if (isOccluded()) {discard;}
2702#endif
2703vec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor;
2704#ifdef LIGHTING_3D_MODE
2705lightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color;
2706#endif
2707vec4 finalColor;
2708#ifdef DIFFUSE_SHADED
2709vec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor);
2710#ifdef HAS_TEXTURE_u_occlusionTexture
2711float ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao;
2712#endif
2713finalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity;
2714#else
2715Material mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0;
2716#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
2717#ifdef OCCLUSION_TEXTURE_TRANSFORM
2718vec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy;
2719#else
2720vec2 uv=uv_2f;
2721#endif
2722ao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao;
2723#endif
2724vec4 emissive=u_emissiveFactor;
2725#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
2726emissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb);
2727#endif
2728#ifdef APPLY_LUT_ON_GPU
2729float emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength;
2730#endif
2731color+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity;
2732#ifdef HAS_ATTRIBUTE_a_pbr
2733float resEmission=v_roughness_metallic_emissive_alpha.z;resEmission*=v_height_based_emission_params.z+v_height_based_emission_params.w*pow(clamp(v_height_based_emission_params.x,0.0,1.0),v_height_based_emission_params.y);vec3 color_mix=v_color_mix.rgb;
2734#ifdef APPLY_LUT_ON_GPU
2735color_mix=applyLUT(u_lutTexture,color_mix);
2736#endif
2737color=mix(color,color_mix,min(1.0,resEmission));
2738#ifdef HAS_ATTRIBUTE_a_color_4f
2739float distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.
2739y));distance+= mix(0.5,0.0,clamp(resEmission-1.0,0.0,1.0));opacity*=v_roughness_metallic_emissive_alpha.w*saturate(1.0-distance*distance);
2740#endif
2741#endif
2742vec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity);
2743#endif
2744#ifdef DITHERED_DISCARD
2745if (abs(u_dithered_discard_threshold) < 1.0) {float ditherValue=fract(52.9829189*fract(0.06711056*gl_FragCoord.x+0.00583715*gl_FragCoord.y));float compareValue=mix(1.0-ditherValue,ditherValue,step(0.0,u_dithered_discard_threshold));if (abs(u_dithered_discard_threshold) < compareValue) {discard;}}
2746#endif
2747#ifdef FOG
2748finalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w));
2749#endif
2750#ifdef RENDER_CUTOFF
2751finalColor*=v_cutoff_opacity;
2752#endif
2753#ifdef INDICATOR_CUTOUT
2754finalColor=applyCutout(finalColor,v_position_height.w);
2755#endif
2756#ifdef FEATURE_CUTOUT
2757finalColor=apply_feature_cutout(finalColor,gl_FragCoord);
2758#endif
2759glFragColor=finalColor;
2760#ifdef OVERDRAW_INSPECTOR
2761glFragColor=vec4(1.0);
2762#endif
2763HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
2764#include "_prelude_shadow.vertex.glsl"
2765in vec3 a_pos_3f;
2766#pragma mapbox: define-attribute highp vec3 normal_3f
2767#pragma mapbox: define-attribute highp vec2 uv_2f
2768#pragma mapbox: define-attribute highp vec3 color_3f
2769#pragma mapbox: define-attribute highp vec4 color_4f
2770#pragma mapbox: define-attribute-vertex-shader-only highp vec4 pbr
2771#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength
2772uniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix;
2773#ifdef INSTANCED_ARRAYS
2774in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;
2775#else
2776uniform highp mat4 u_normal_matrix;
2777#endif
2778#ifdef RENDER_SHADOWS
2779uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth_shadows;
2780#endif
2781out vec4 v_position_height;out lowp vec4 v_color_mix;
2782#ifdef TERRAIN_FRAGMENT_OCCLUSION
2783out highp float v_depth;
2784#endif
2785#ifdef HAS_ATTRIBUTE_a_pbr
2786out lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params;
2787#endif
2788vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {
2789#pragma mapbox: initialize-attribute highp vec3 normal_3f
2790#pragma mapbox: initialize-attribute highp vec2 uv_2f
2791#pragma mapbox: initialize-attribute highp vec3 color_3f
2792#pragma mapbox: initialize-attribute highp vec4 color_4f
2793#pragma mapbox: initialize-attribute-custom highp vec4 pbr
2794#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength
2795highp mat4 normal_matrix;
2796#ifdef INSTANCED_ARRAYS
2797normal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);
2798#else
2799normal_matrix=u_normal_matrix;
2800#endif
2801vec3 local_pos;mat3 rs;
2802#ifdef MODEL_POSITION_ON_GPU
2803vec3 pos_color=normal_matrix[0].xyz;vec4 translate=normal_matrix[1];vec3 pos_a=floor(pos_color);vec3 rgb=1.05*(pos_color-pos_a);float hidden=float(pos_a.x > EXTENT);float color_mix=pos_a.z/100.0;v_color_mix=vec4(sRGBToLinear(rgb),color_mix);float meter_to_tile=normal_matrix[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);rs[0].x=normal_matrix[1].w;rs[0].yz=normal_matrix[2].xy;rs[1].xy=normal_matrix[2].zw;rs[1].z=normal_matrix[3].x;rs[2].xyz=normal_matrix[3].yzw;vec4 pos_node=u_lighting_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;local_pos=pos.xyz;gl_Position=mix(u_matrix*pos,AWAY,hidden);pos.z*=meter_to_tile;v_position_height.xyz=pos.xyz-u_camera_pos;
2804#else
2805local_pos=a_pos_3f;gl_Position=u_matrix*vec4(a_pos_3f,1);v_position_height.xyz=vec3(u_lighting_matrix*vec4(a_pos_3f,1));v_color_mix=vec4(sRGBToLinear(u_color_mix.rgb),u_color_mix.a);
2806#endif
2807v_position_height.w=a_pos_3f.z;
2808#ifdef HAS_ATTRIBUTE_a_pbr
2809vec4 albedo_c=decode_color(pbr.xy);vec2 e_r_m=unpack_float(pbr.z);vec2 r_m= unpack_float(e_r_m.y*16.0);r_m.r=r_m.r*16.0;v_color_mix=vec4(albedo_c.rgb,1.0);v_roughness_metallic_emissive_alpha=vec4(vec3(r_m,e_r_m.x)/255.0,albedo_c.a);v_roughness_metallic_emissive_alpha.z*=2.0;float heightBasedRelativeIntepolation=a_pos_3f.z*heightBasedEmissiveStrength.x+heightBasedEmissiveStrength.y;v_height_based_emission_params.x=heightBasedRelativeIntepolation;v_height_based_emission_params.y=heightBasedEmissiveStrength.z;vec2 emissionMultiplierValues=unpack_float(pbr.w)/256.0;v_height_based_emission_params.z=emissionMultiplierValues.x;v_height_based_emission_params.w=emissionMultiplierValues.y-emissionMultiplierValues.x;
2810#endif
2811#ifdef FOG
2812v_fog_pos=fog_position(local_pos);
2813#endif
2814#ifdef RENDER_CUTOFF
2815v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);
2816#endif
2817#ifdef TERRAIN_FRAGMENT_OCCLUSION
2818v_depth=gl_Position.z/gl_Position.w;
2819#ifdef CLIP_ZERO_TO_ONE
2820v_depth=-1.0+2.0*v_depth; 
2821#endif
2822#endif
2823#ifdef HAS_ATTRIBUTE_a_normal_3f
2824#ifdef MODEL_POSITION_ON_GPU
2825float x_squared_scale=dot(rs[0],rs[0]);float y_squared_scale=dot(rs[1],rs[1]);float z_squared_scale=dot(rs[2],rs[2]);vec3 squared_scale=vec3(x_squared_scale,y_squared_scale,z_squared_scale);normal_3f=rs*((u_lighting_matrix*vec4(normal_3f,0.0)).xyz/squared_scale);normal_3f=normalize(normal_3f);
2826#else
2827normal_3f=vec3(normal_matrix*vec4(normal_3f,0));
2828#endif
2829#endif
2830#ifdef HAS_ATTRIBUTE_a_pbr
2831#ifdef HAS_ATTRIBUTE_a_color_4f
2832v_roughness_metallic_emissive_alpha.w=clamp(color_4f.a*v_roughness_metallic_emissive_alpha.w*(v_roughness_metallic_emissive_alpha.z-1.0),0.0,1.0);
2833#endif
2834#endif
2835#ifdef RENDER_SHADOWS
2836vec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0);
2837#ifdef NORMAL_OFFSET
2838#ifdef HAS_ATTRIBUTE_a_normal_3f
2839#ifdef MODEL_POSITION_ON_GPU
2840vec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();
2841#else
2842vec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();
2843#endif
2844#endif
2845#endif
2846v_pos_light_view_0=u_light_matrix_0*shadow_pos;v_pos_light_view_1=u_light_matrix_1*shadow_pos;v_depth_shadows=gl_Position.w;
2847#endif
2848}`),modelDepth:jt(`in highp float v_depth;void main() {
2849#ifndef DEPTH_TEXTURE
2850glFragColor=pack_depth(v_depth);
2851#endif
2852}`,`in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;
2853#ifdef MODEL_POSITION_ON_GPU
2854#ifdef INSTANCED_ARRAYS
2855in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;
2856#else
2857uniform highp mat4 u_instance;
2858#endif
2859uniform highp mat4 u_node_matrix;
2860#endif
2861void main() {
2862#ifdef MODEL_POSITION_ON_GPU
2863highp mat4 instance;
2864#ifdef INSTANCED_ARRAYS
2865instance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);
2866#else
2867instance=u_instance;
2868#endif
2869vec3 pos_color=instance[0].xyz;vec4 translate=instance[1];vec3 pos_a=floor(pos_color);float hidden=float(pos_a.x > EXTENT);float meter_to_tile=instance[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);mat3 rs;rs[0].x=instance[1].w;rs[0].yz=instance[2].xy;
2869rs[1].xy=instance[2].zw;rs[1].z=instance[3].x;rs[2].xyz=instance[3].yzw;vec4 pos_node=u_node_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;gl_Position=mix(u_matrix*pos,AWAY,hidden);
2870#else
2871gl_Position=u_matrix*vec4(a_pos_3f,1);
2872#endif
2873v_depth=gl_Position.z/gl_Position.w;}`),stars:jt(`in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv)
2874{float beginFade=0.6;float lengthFromCenter=length(v_uv);return 1.0-clamp((lengthFromCenter-beginFade)/(1.0-beginFade),0.0,1.0);}void main() {float alpha=shapeCircle(v_uv);vec3 color=vec3(1.0,1.0,1.0);alpha*=v_intensity;glFragColor=vec4(color*alpha,alpha);HANDLE_WIREFRAME_DEBUG;}`,`
2875in vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_fade_opacity;uniform mat4 u_matrix;uniform vec3 u_up;uniform vec3 u_right;uniform float u_intensity_multiplier;out highp vec2 v_uv;out mediump float v_intensity;void main() {v_uv=a_uv;v_intensity=a_fade_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}`),snowParticle:jt("in highp vec2 uv;in highp float alphaMultiplier;uniform vec4 u_particleColor;uniform vec2 u_simpleShapeParameters;void main() {float t=clamp((length(uv)-u_simpleShapeParameters.x)/(1.0-u_simpleShapeParameters.x),0.0,1.0);float alpha=1.0-pow(t,pow(10.0,u_simpleShapeParameters.y));alpha*=alphaMultiplier;alpha*=u_particleColor.a;vec3 color=u_particleColor.rgb*alpha;glFragColor=vec4(color,alpha) ;HANDLE_WIREFRAME_DEBUG;}",`
2876in highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_snowParticleData;in highp vec4 a_snowParticleDataHorizontalOscillation;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform vec2 u_screenSize;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; 
2877uniform float u_velocity;uniform vec3 u_direction;uniform float u_horizontalOscillationRadius; 
2878uniform float u_horizontalOscillationRate; 
2879uniform float u_billboardSize;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;out highp vec2 uv;out highp float alphaMultiplier;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos.xyz*=halfBoxSize;pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_snowParticleData.z;float coneAngleHeadingRad=a_snowParticleData.w*radians(360.0);vec3 localZ=normalize(u_direction);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 direction;direction.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.z=cos(coneAnglePichRad);direction=normalize(direction);vec3 simPosLocal=vec3(0,0,0);float velocityScale=(1.0+3.0*a_snowParticleData.y)*u_velocity;simPosLocal+=direction*velocityScale*u_time;float horizontalOscillationRadius=u_horizontalOscillationRadius*a_snowParticleDataHorizontalOscillation.x;float horizontalOscillationAngle=u_horizontalOscillationRate*u_time*(-1.0+2.0*a_snowParticleDataHorizontalOscillation.y);simPosLocal.xy+=horizontalOscillationRadius*vec2(cos(horizontalOscillationAngle),sin(horizontalOscillationAngle));vec3 simPos=localX*simPosLocal.x+
2880localY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);float clipZ=-u_cam_pos.z+pos.z;vec4 posView=u_modelview*vec4(pos,1.0);float size=u_billboardSize;alphaMultiplier=1.0;vec4 posScreen=u_projection*posView;posScreen/=posScreen.w;posScreen.xy=vec2(0.5)+posScreen.xy*0.5;posScreen.xy*=u_screenSize;vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=u_screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-posScreen.xy)/(0.5*u_screenSize));screenDist+=a_snowParticleData.x*u_thinningParticleOffset;float scaleFactorMode=0.0;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);if (a_snowParticleData.x < u_thinningAffectedRatio) {scaleFactorMode=1.0-thinningFadeRatio;alphaMultiplier=thinningFadeRatio;}}vec4 posScreen1=u_projection*vec4(posView.x-size,posView.yzw);posScreen1/=posScreen1.w;vec4 posScreen2=u_projection*vec4(posView.x+size,posView.yzw);posScreen2/=posScreen2.w;posScreen1.xy=vec2(0.5)+posScreen1.xy*0.5;posScreen1.xy*=u_screenSize;posScreen2.xy=vec2(0.5)+posScreen2.xy*0.5;posScreen2.xy*=u_screenSize;float screenLength=length(posScreen1.xy-posScreen2.xy);float screenEpsilon=3.0;float scaleFactor=1.0;if (screenLength < screenEpsilon) {scaleFactor=screenEpsilon/max(screenLength,0.01);scaleFactor=mix(scaleFactor,1.0,scaleFactorMode);}float screenEpsilon2=15.0;if (screenLength > screenEpsilon2) {scaleFactor=screenEpsilon2/max(screenLength,0.01);}size*=scaleFactor;vec2 right=size*vec2(1,0);vec2 up=size*vec2(0,1);posView.xy+=right*a_uv.x;posView.xy+=up*a_uv.y;uv=a_uv;gl_Position=u_projection*posView;}`),rainParticle:jt("in highp vec2 uv;in highp float particleRandomValue;uniform sampler2D u_texScreen;uniform float u_distortionStrength;uniform vec4 u_color;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;uniform float u_shapeDirectionalPower;uniform float u_mode;void main() {vec2 st=uv*0.5+vec2(0.5);vec2 uvm=uv;uvm.y=-1.0+2.0*pow(st.y,u_shapeDirectionalPower);float shape=clamp(1.0-length(uvm),0.0,1.0);float alpha=abs(shape)*u_color.a;vec2 screenSize=vec2(textureSize(u_texScreen,0));vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-gl_FragCoord.xy)/(0.5*screenSize));screenDist+=(0.5+0.5*particleRandomValue)*u_thinningParticleOffset;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;float thinningAlpha=1.0;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);thinningAlpha*=thinningFadeRatio;}vec2 offsetXY=normalize(uvm)*abs(shape);vec2 stScreen=(gl_FragCoord.xy+offsetXY*u_distortionStrength*thinningAlpha)/screenSize;vec3 colorScreen=texture(u_texScreen,stScreen).rgb;alpha*=thinningAlpha;glFragColor=mix(vec4(colorScreen,1.0),vec4(u_color.rgb*alpha,alpha),u_mode);HANDLE_WIREFRAME_DEBUG;}",`
2881in highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_rainParticleData;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; 
2882uniform float u_velocity; 
2883uniform vec2 u_rainDropletSize;uniform vec3 u_rainDirection;out highp vec2 uv;out highp float particleRandomValue;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;
2883pos*=halfBoxSize; 
2884pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_rainParticleData.z;float coneAngleHeadingRad=a_rainParticleData.w*radians(360.0);vec3 localZ=normalize(u_rainDirection);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 directionLocal;directionLocal.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.z=cos(coneAnglePichRad);directionLocal=normalize(directionLocal);vec3 directionWorld=localX*directionLocal.x+localY*directionLocal.y+localZ*directionLocal.z;float velocityScale=(1.0+3.0*a_rainParticleData.y)*u_velocity;vec3 simPosLocal=vec3(0,0,0);simPosLocal+=directionLocal*velocityScale*u_time;vec3 simPos=localX*simPosLocal.x+
2885localY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);vec4 posView=u_modelview*vec4(pos,1.0);vec3 directionView=normalize((u_modelview*vec4(directionWorld,0.0)).xyz);vec3 side=cross(directionView,normalize(posView.xyz));posView.xyz+=side*a_uv.x*u_rainDropletSize.x;posView.xyz+=directionView*a_uv.y*u_rainDropletSize.y;uv=a_uv;particleRandomValue=a_rainParticleData.x;gl_Position=u_projection*posView;}`),vignette:jt("uniform vec3 u_vignetteShape;uniform vec4 u_vignetteColor;in vec2 st;void main() {float screenDist=length(st);float alpha=clamp((screenDist-u_vignetteShape.x)/u_vignetteShape.y,0.0,1.0);alpha=pow(alpha,u_vignetteShape.z)*u_vignetteColor.a;vec3 color=u_vignetteColor.rgb;glFragColor=vec4(color*alpha,alpha) ;}","in vec2 a_pos_2f;out vec2 st;void main() {st=a_pos_2f;gl_Position=vec4(a_pos_2f,0,1);}"),occlusion:jt("uniform vec4 u_color;void main() {glFragColor=u_color;}",`#include "_prelude_terrain.vertex.glsl"
2886in highp vec2 a_offset_xy;uniform highp vec3 u_anchorPos;uniform mat4 u_matrix;uniform vec2 u_screenSizePx;uniform vec2 u_occluderSizePx;void main() {vec3 world_pos=u_anchorPos;
2887#ifdef TERRAIN
2888float e=elevation(world_pos.xy);world_pos.z+=e;
2889#endif
2890vec4 projected_point=u_matrix*vec4(world_pos,1.0);projected_point.xy+=projected_point.w*a_offset_xy*0.5*u_occluderSizePx/u_screenSizePx;gl_Position=projected_point;}`)};function _s(l,t){const o=l.split(`
2891`);for(let c of o){if(c=c.trimStart(),c[0]!=="#"||!c.includes("if")||c.startsWith("#endif"))continue;const d=c.match(th);if(d)for(const p of d)qs.has(p)||t.add(p)}}function jt(l,t){const o=new Set,c=[],d=[];l=l.replace(Tl,(m,y)=>(d.push(y),"")),t=t.replace(Tl,(m,y)=>(c.push(y),""));let p=new Set(Hs);_s(l,p),_s(t,p);for(const m of[...c,...d])Ic[m]||(Ic[m]=new Set,_s(ms[m],Ic[m])),p=new Set([...p,...Ic[m]]);return{fragmentSource:l=l.replace(yo,(m,y,x,T,S)=>(o.add(S),y==="define"?`
2892#ifndef HAS_UNIFORM_u_${S}
2893in ${x} ${T} ${S};
2894#else
2895uniform ${x} ${T} u_${S};
2896#endif
2897`:y==="initialize"?`
2898#ifdef HAS_UNIFORM_u_${S}
2899    ${x} ${T} ${S} = u_${S};
2900#endif
2901`:y==="define-attribute"?`
2902#ifdef HAS_ATTRIBUTE_a_${S}
2903    in ${x}
2903 ${T} ${S};
2904#endif
2905`:y==="initialize-attribute"?"":void 0)),vertexSource:t=t.replace(yo,(m,y,x,T,S)=>{const M=`MATERIAL_ATTRIBUTE_OFFSET_${S}`,A=T==="float"?"vec2":T,C=`GET_ATTRIBUTE_${A}(a_${S}, materialInfo, ${M})`,L=S.match(/color/)?"color":A;return y==="define-attribute-vertex-shader-only"?`
2906#ifdef HAS_ATTRIBUTE_a_${S}
2907in ${x} ${T} a_${S};
2908#endif
2909`:o.has(S)?y==="define"?`
2910#ifndef HAS_UNIFORM_u_${S}
2911uniform lowp float u_${S}_t;
2912    #if !defined(${M})
2913        in ${x} ${A} a_${S};
2914    #endif
2915out ${x} ${T} ${S};
2916#else
2917uniform ${x} ${T} u_${S};
2918#endif
2919`:y==="initialize"?L==="vec4"?`
2920#ifndef HAS_UNIFORM_u_${S}
2921    ${S} = a_${S};
2922#else
2923    ${x} ${T} ${S} = u_${S};
2924#endif
2925`:`
2926#if !defined(HAS_UNIFORM_u_${S})
2927    #ifdef ${M}
2928        ${S} = unpack_mix_${L}(${C}, u_${S}_t);
2929    #else
2930        ${S} = unpack_mix_${L}(a_${S}, u_${S}_t);
2931    #endif
2932#else
2933    ${x} ${T} ${S} = u_${S};
2934#endif
2935`:y==="define-attribute"?`
2936#ifdef HAS_ATTRIBUTE_a_${S}
2937    in ${x} ${T} a_${S};
2938    out ${x} ${T} ${S};
2939#endif
2940`:y==="initialize-attribute"?`
2941#ifdef HAS_ATTRIBUTE_a_${S}
2942    ${S} = a_${S};
2943#endif
2944`:void 0:y==="define"?`
2945#ifndef HAS_UNIFORM_u_${S}
2946uniform lowp float u_${S}_t;
2947    #if !defined(${M})
2948        in ${x} ${A} a_${S};
2949    #endif
2950#else
2951uniform ${x} ${T} u_${S};
2952#endif
2953`:y==="define-instanced"?L==="mat4"?`
2954#ifdef INSTANCED_ARRAYS
2955in vec4 a_${S}0;
2956in vec4 a_${S}1;
2957in vec4 a_${S}2;
2958in vec4 a_${S}3;
2959#else
2960uniform ${x} ${T} u_${S};
2961#endif
2962`:`
2963#ifdef INSTANCED_ARRAYS
2964in ${x} ${A} a_${S};
2965#else
2966uniform ${x} ${T} u_${S};
2967#endif
2968`:y==="initialize-attribute-custom"?`
2969#ifdef HAS_ATTRIBUTE_a_${S}
2970    ${x} ${T} ${S} = a_${S};
2971#endif
2972`:L==="vec4"?`
2973#ifndef HAS_UNIFORM_u_${S}
2974    #ifdef ${M}
2975        ${x} ${T} ${S} = ${C};
2976    #else
2977        ${x} ${T} ${S} = a_${S};
2978    #endif
2979#else
2980    ${x} ${T} ${S} = u_${S};
2981#endif
2982`:`
2983#ifndef HAS_UNIFORM_u_${S}
2984    #ifdef ${M}
2985        ${x} ${T} ${S} = unpack_mix_${L}(${C}, u_${S}_t);
2986    #else
2987        ${x} ${T} ${S} = unpack_mix_${L}(a_${S}, u_${S}_t);
2988    #endif
2989#else
2990    ${x} ${T} ${S} = u_${S};
2991#endif
2992`}),usedDefines:p,vertexIncludes:c,fragmentIncludes:d}}class Cm{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(t,o,c,d,p,m,y,x){this.context=t;let T=this.boundPaintVertexBuffers.length!==d.length;for(let M=0;!T&&M<d.length;M++)this.boundPaintVertexBuffers[M]!==d[M]&&(T=!0);let S=this.boundDynamicVertexBuffers.length!==y.length;for(let M=0;!S&&M<y.length;M++)this.boundDynamicVertexBuffers[M]!==y[M]&&(S=!0);if(!this.vao||this.boundProgram!==o||this.boundLayoutVertexBuffer!==c||T||S||this.boundIndexBuffer!==p||this.boundVertexOffset!==m)this.freshBind(o,c,d,p,m,y,x);else{t.bindVertexArrayOES.set(this.vao);for(const M of y)M&&(M.bind(),x&&M.instanceCount&&M.setVertexAttribDivisor(t.gl,o,x));p&&p.dynamicDraw&&p.bind()}}freshBind(t,o,c,d,p,m,y){const x=this.context,T=x.gl;this.vao&&this.destroy(),this.vao=x.gl.createVertexArray(),x.bindVertexArrayOES.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=o,this.boundPaintVertexBuffers=c,this.boundIndexBuffer=d,this.boundVertexOffset=p,this.boundDynamicVertexBuffers=m,o.enableAttributes(T,t),o.bind(),o.setVertexAttribPointers(T,t,p);for(const S of c)S.enableAttributes(T,t),S.bind(),S.setVertexAttribPointers(T,t,p);for(const S of m)S&&(S.enableAttributes(T,t),S.bind(),S.setVertexAttribPointers(T,t,p),y&&S.instanceCount&&S.setVertexAttribDivisor(T,t,y));d&&d.bind()}destroy(){this.vao&&(this.context.gl.deleteVertexArray(this.vao),this.vao=null)}}function Pm(l,t){const o=Math.pow(2,t.canonical.z),c=t.canonical.y;return[new s.ae(0,c/o).toLngLat().lat,new s.ae(0,(c+1)/o).toLngLat().lat]}function Rm(l,t,o,c,d,p,m){const y=l.context,x=y.gl,T=o.hillshadeFBO;if(!T)return;l.prepareDrawTile();const S=l.isTileAffectedByFog(t),M=[];l.terrain&&l.terrain.renderingToTexture&&l.emissiveMode==="mrt-fallback"&&M.push("USE_MRT1");const A=l.getOrCreateProgram("hillshade",{overrideFog:S,defines:M});y.activeTexture.set(x.TEXTURE0),x.bindTexture(x.TEXTURE_2D,T.colorAttachment0.get());const C=((N,q,G,j)=>{const ie=G.paint.get("hillshade-shadow-color"),Q=G.paint.get("hillshade-shadow-color-use-theme").
vendor: 47,930 bytes, lines 2992-2997
2992constantOr("default")==="none",te=G.paint.get("hillshade-highlight-color"),X=G.paint.get("hillshade-highlight-color-use-theme").constantOr("default")==="none",Z=G.paint.get("hillshade-accent-color"),ne=G.paint.get("hillshade-accent-color-use-theme").constantOr("default")==="none",ce=G.paint.get("hillshade-emissive-strength");let de=s.an(G.paint.get("hillshade-illumination-direction"));if(G.paint.get("hillshade-illumination-anchor")==="viewport")de-=N.transform.angle;else if(N.style&&N.style.enable3dLights()&&N.style.directionalLight){const ge=N.style.directionalLight.properties.get("direction"),Me=s.d4(ge.x,ge.y,ge.z);de=s.an(Me[1])}const ve=!N.options.moving;return{u_matrix:j||N.transform.calculateProjMatrix(q.tileID.toUnwrapped(),ve),u_image:0,u_latrange:Pm(0,q.tileID),u_light:[G.paint.get("hillshade-exaggeration"),de],u_shadow:ie.toPremultipliedRenderColor(Q?null:G.lut),u_highlight:te.toPremultipliedRenderColor(X?null:G.lut),u_emissive_strength:ce,u_accent:Z.toPremultipliedRenderColor(ne?null:G.lut)}})(l,o,c,l.terrain?t.projMatrix:null);l.uploadCommonUniforms(y,A,t.toUnwrapped());const{tileBoundsBuffer:L,tileBoundsIndexBuffer:z,tileBoundsSegments:O}=l.getTileBoundsBuffers(o);A.draw(l,x.TRIANGLES,d,p,m,gt.disabled,C,c.id,L,z,O)}function rh(l,t,o){if(!t.needsDEMTextureUpload)return;const c=l.context,d=c.gl;c.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||l.getTileTexture(o.stride);const p=o.getPixels();t.demTexture?t.demTexture.update(p,{premultiply:!1}):t.demTexture=new s.T(c,p,d.R32F,{premultiply:!1}),t.needsDEMTextureUpload=!1}function zm(l,t,o){const c=l.context,d=c.gl;if(!t.dem)return;const p=t.dem;if(c.activeTexture.set(d.TEXTURE1),rh(l,t,p),!t.demTexture)return;t.demTexture.bind(d.NEAREST,d.CLAMP_TO_EDGE);const m=p.dim;c.activeTexture.set(d.TEXTURE0);let y=t.hillshadeFBO;if(!y){const A=new s.T(c,{width:m,height:m,data:null},d.RGBA8);A.bind(d.LINEAR,d.CLAMP_TO_EDGE),y=t.hillshadeFBO=c.createFramebuffer(m,m,1,"renderbuffer"),y.colorAttachment0.set(A.texture)}c.bindFramebuffer.set(y.framebuffer),c.viewport.set([0,0,m,m]);const{tileBoundsBuffer:x,tileBoundsIndexBuffer:T,tileBoundsSegments:S}=l.getMercatorTileBoundsBuffers(),M=[];l.linearFloatFilteringSupported()&&M.push("TERRAIN_DEM_FLOAT_FORMAT"),l.terrain&&l.terrain.renderingToTexture&&l.emissiveMode==="mrt-fallback"&&M.push("USE_MRT1"),l.getOrCreateProgram("hillshadePrepare",{defines:M}).draw(l,d.TRIANGLES,ut.disabled,vt.disabled,Et.unblended,gt.disabled,((A,C)=>{const L=C.stride,z=s.bC();return s.ce(z,0,s.al,-s.al,0,0,1),s.br(z,z,[0,-s.al,0]),{u_matrix:z,u_image:1,u_dimension:[L,L],u_zoom:A.overscaledZ}})(t.tileID,p),o.id,x,T,S),t.needsHillshadePrepare=!1}class Ti{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 Dm extends Ti{getDefault(){return s.ao.transparent.toNonPremultipliedRenderColor(null)}set(t){const o=this.current;(t.r!==o.r||t.g!==o.g||t.b!==o.b||t.a!==o.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class pf extends Ti{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class nh extends Ti{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class Mc extends Ti{getDefault(){return[!0,!0,!0,!0]}set(t){const o=this.current;(t[0]!==o[0]||t[1]!==o[1]||t[2]!==o[2]||t[3]!==o[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class oh extends Ti{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class $s extends Ti{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class Sa extends Ti{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const o=this.current;(t.func!==o.func||t.ref!==o.ref||t.mask!==o.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class Sl extends Ti{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const o=this.current;(t[0]!==o[0]||t[1]!==o[1]||t[2]!==o[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class Ea extends Ti{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;t?o.enable(o.STENCIL_TEST):o.disable(o.STENCIL_TEST),this.current=t,this.dirty=!1}}class mf extends Ti{getDefault(){return[0,1]}set(t){const o=this.current;(t[0]!==o[0]||t[1]!==o[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class sh extends Ti{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;t?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),this.current=t,this.dirty=!1}}class _f extends Ti{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class Ia extends Ti{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;t?o.enable(o.BLEND):o.disable(o.BLEND),this.current=t,this.dirty=!1}}class Cc extends Ti{getDefault(){const t=this.gl;return[t.ONE,t.ZERO,t.ONE,t.ZERO]}set(t){const o=this.current;(t[0]!==o[0]||t[1]!==o[1]||t[2]!==o[2]||t[3]!==o[3]||this.dirty)&&(this.gl.blendFuncSeparate(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Pc extends Ti{getDefault(){return s.ao.transparent.toNonPremultipliedRenderColor(null)}set(t){const o=this.current;(t.r!==o.r||t.g!==o.g||t.b!==o.b||t.a!==o.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class ah extends Ti{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(t,t),this.current=t,this.dirty=!1)}}class Rc extends Ti{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;t?o.enable(o.CULL_FACE):o.disable(o.CULL_FACE),this.current=t,this.dirty=!1}}class El extends Ti{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class gf extends Ti{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}let yf=class extends Ti{getDefault(){return null}set(l){(l!==this.current||this.dirty)&&(this.gl.useProgram(l),this.current=l,this.dirty=!1)}};class xf extends Ti{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class Aa extends Ti{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const o=this.current;(t[0]!==o[0]||t[1]!==o[1]||t[2]!==o[2]||t[3]!==o[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class vf extends Ti{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.bindFramebuffer(o.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class Lm extends Ti{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.bindRenderbuffer(o.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Fm extends Ti{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.bindTexture(o.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class Om extends Ti{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.bindBuffer(o.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class lh extends Ti{getDefault(){return null}set(t){const o=this.gl;o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class ch extends Ti{getDefault(){return null}set(t){this.gl&&(t!==this.current||this.dirty)&&(this.gl.bindVertexArray(t),this.current=t,this.dirty=!1)}}class uh extends Ti{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.pixelStorei(o.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class hh extends Ti{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class bf extends Ti{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class zc extends Ti{constructor(t,o){super(t),this.context=t,this.parent=o}getDefault(){return null}}class Dc extends zc{constructor(t,o,c=0){super(t,o),this.attachmentPoint=t.gl.COLOR_ATTACHMENT0+c}setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const o=this.gl;o.framebufferTexture2D(o.FRAMEBUFFER,this.attachmentPoint,o.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class Ma extends zc{attachment(){return this.gl.DEPTH_ATTACHMENT}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const o=this.gl;o.framebufferRenderbuffer(o.FRAMEBUFFER,this.attachment(),o.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Il extends zc{attachment(){return this.gl.DEPTH_ATTACHMENT}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const o=this.gl;o.framebufferTexture2D(o.FRAMEBUFFER,this.attachment(),o.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class wf extends Ma{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}const Fn=(l,t,o,c)=>({u_matrix:l,u_image0:0,u_image1:1,u_skirt_height:t,u_ground_shadow_factor:o,u_emissive_texture_available:c}),Lc=(l,t,o,c,d,p,m,y,x,T,S,M,A,C,L,z,O)=>({u_proj_matrix:Float32Array.from(l),u_globe_matrix:t,u_normalize_matrix:Float32Array.from(c),u_merc_matrix:o,u_zoom_transition:d,u_merc_center:p,u_image0:0,u_image1:1,u_frustum_tl:m,u_frustum_tr:y,u_frustum_br:x,u_frustum_bl:T,u_globe_pos:S,u_globe_radius:M,u_viewport:A,u_grid_matrix:O?Float32Array.from(O):new Float32Array(9),u_skirt_height:C,u_far_z_cutoff:L,u_emissive_texture_available:z});function Al(l,t){return l!=null&&t!=null&&!(!l.hasData()||!t.hasData())&&l.demTexture!=null&&t.demTexture!=null&&l.tileID.key!==t.tileID.key}const qo=new class{constructor(){this.operations={}}newMorphing(l,t,o,c,d){if(l in this.operations){const p=this.operations[l];p.to.tileID.key!==o.tileID.key&&(p.queued=o)}else this.operations[l]={startTime:c,phase:0,duration:d,from:t,to:o,queued:null}}getMorphValuesForProxy(l){if(!(l in this.operations))return null;const t=this.operations[l];return{from:t.from,to:t.to,phase:t.phase}}update(l){for(const t in this.operations){const o=this.operations[t];for(o.phase=(l-o.startTime)/o.duration;o.phase>=1||!this._validOp(o);)if(!this._nextOp(o,l)){delete this.operations[t];break}}}_nextOp(l,t){return!!l.queued&&(l.from=l.to,l.to=l.queued,l.queued=null,l.phase=0,l.startTime=t,!0)}_validOp(l){return l.from.hasData()&&l.to.hasData()}},Fc={0:null,1:"TERRAIN_VERTEX_MORPHING"};function Oc(l,t,o){if(t===0)return 0;const c=t<1&&o===514?.25/t:1;return 6*Math.pow(1.5,22-l)*Math.max(t,1)*c}function dh(l,t){const o=1<<l.z;return!t&&(l.x===0||l.x===o-1)||l.y===0||l.y===o-1}function Ca(l,t){if(!l.style||!l.style.enable3dLights())return;const o=l.context,c=o.gl;o.activeTexture.set(c.TEXTURE1),t?t.bind(c.LINEAR,c.CLAMP_TO_EDGE):l.emptyTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE)}const Ml=l=>({u_matrix:l});function Cl(l,t,o,c,d){if(d>0){const p=s.o.now(),m=(p-l.timeAdded)/d,y=t?(p-t.timeAdded)/d:-1,x=o.getSource(),T=c.coveringZoomLevel({tileSize:x.tileSize,roundZoom:x.roundZoom}),S=!t||Math.abs(t.tileID.overscaledZ-T)>Math.abs(l.tileID.overscaledZ-T),M=S&&l.refreshedUponExpiration?1:s.aA(S?m:1-y,0,1);return t?{opacity:1,mix:1-M,isFading:m<1}:{opacity:M,mix:0,isFading:m<1}}return{opacity:1,mix:0,isFading:!1}}class kc extends ln{constructor(t){const o=Ns("mock-dem",{type:"raster-dem",maxzoom:t.transform.maxZoom},t.style.dispatcher,t.style);super("mock-dem",o,!1),o.setEventedParent(this),this._sourceLoaded=!0}_loadTile(t,o){t.state="loaded",o(null)}}class fh extends ln{constructor(t){const o=Ns("proxy",{type:"geojson",maxzoom:t.transform.maxZoom},t.style.dispatcher,t.style);super("proxy",o,!1),o.setEventedParent(this),this.map=this.getSource().map=t,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(t,o,c){if(t.freezeTileCoverage)return;this.transform=t;const d=t.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((p,m)=>{if(p[m.key]="",!this._tiles[m.key]){const y=new ls(m,this._source.tileSize*m.overscaleFactor(),t.tileZoom,void 0,void 0,this._source.worldview);y.state="loaded",this._tiles[m.key]=y}return p},{});for(const p in this._tiles)p in d||(this.freeFBO(p),this._tiles[p].unloadVectorData(),delete this._tiles[p])}freeFBO(t){const o=this.proxyCachedFBO[t];if(o!==void 0){const c=Object.values(o);this.renderCachePool.push(...c),delete this.proxyCachedFBO[t]}}deallocRenderCache(){this.renderCache.forEach(t=>t.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class ph extends s.aQ{constructor(t,o,c){super(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y),this.proxyTileKey=o,this.projMatrix=c}}class mh extends s.bV{constructor(t,o){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},this.painter=t,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[c,d,p]=(function(){const x=new s.bd,T=new s.b0,S=131;x.reserve(17161),T.reserve(33800);const M=s.al/128,A=s.al+M/2,C=A+M;for(let z=-M;z<C;z+=M)for(let O=-M;O<C;O+=M){const N=O<0||O>A||z<0||z>A?24575:0,q=s.aA(Math.round(O),0,s.al),G=s.aA(Math.round(z),0,s.al);x.emplaceBack(q+N,G)}const L=(z,O)=>{const N=O*S+z;T.emplaceBack(N+1,N,N+S),T.emplaceBack(N+S,N+S+1,N+1)};for(let z=1;z<129;z++)for(let O=1;O<129;O++)L(O,z);return[0,129].forEach(z=>{for(let O=0;O<130;O++)L(O,z),L(z,O)}),[x,T,32768]})(),m=t.context;this.gridBuffer=m.createVertexBuffer(c,s.bf.members),this.gridIndexBuffer=m.createIndexBuffer(d),this.gridSegments=s.bg.simpleSegment(0,0,c.length,d.length),this.gridNoSkirtSegments=s.bg.simpleSegment(0,0,c.length,p),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new fh(o.map),this.orthoMatrix=s.bC(),s.ce(this.orthoMatrix,this.painter.transform.projection.name==="globe"?.015:0,s.al,0,s.al,0,1);const y=m.gl;this._overlapStencilMode=new vt({func:y.GEQUAL,mask:255},0,255,y.KEEP,y.KEEP,y.REPLACE),this._previousZoom=t.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=o,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new kc(o.map),this._pendingGroundEffectLayers=[],this._emissiveTexture=!1}set style(t){t.on("data",this._onStyleDataEvent.bind(this)),this._style=t,this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(t,o,c){if(t&&t.terrain){this._style!==t&&(this.style=t,this._evaluationZoom=void 0);const d=t.terrain.properties,p=t.terrain.drapeRenderMode===0,m=t.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=s.o.now();const y=t.terrain&&t.terrain.scope,x=d.get("source"),T=p?this._mockSourceCache:t.getSourceCache(x,y);if(!T)return void s.w(`Couldn't find terrain source "${x}".`);if(this.sourceCache=T,this._attenuationRange=t.terrain.getAttenuationRange(),this._exaggeration=m?this.calculateExaggeration(o):d.get("exaggeration"),!o.projection.requiresDraping&&m&&this._exaggeration===0)return void this._disable();this.enabled=!0;const S=()=>{this.sourceCache.used&&s.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source.
2993This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const M=this.getScaledDemTileSize();this.sourceCache.update(o,M,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,S(),this._initializing=!0),S(),o.updateElevation(!0,c),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(o),this._emptyDEMTextureDirty=!0,this._previousZoom=o.zoom}else this._disable()}calculateExaggeration(t){if(this._attenuationRange&&t.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(t.zoom);const o=this._previousCameraAltitude,c=t.getFreeCameraOptions().position.z/t.pixelsPerMeter*t.worldSize;this._previousCameraAltitude=c;const d=o!=null?c-o:Number.MAX_VALUE;if(Math.abs(d)<2)return this._exaggeration;const p=t.zoom,m=this._style.terrain;if(!this._previousUpdateTimestamp)return m.getExaggeration(p);let y=p-this._previousZoom;const x=this._previousUpdateTimestamp;let T=p;this._evaluationZoom!=null&&(T=this._evaluationZoom,Math.abs(p-T)>.5&&(y=.5*(p-T+y)),y*d<0&&(T+=y)),this._evaluationZoom=T;const S=m.getExaggeration(T),M=S===m.getExaggeration(Math.max(0,T-.1));if(M&&Math.abs(S-this._exaggeration)<.01)return S;let A=Math.min(.1,.00375*(this._updateTimestamp-x));return(M||S<.1||Math.abs(y)<1e-4)&&(A=Math.min(.2,4*A)),s.ak(this._exaggeration,S,A)}resetTileLookupCache(t){this._findCoveringTileCache[t]={}}attenuationRange(){return this._attenuationRange}getDemUpscale(){return this.proxySourceCache.getSource().tileSize/128}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(t){t.dataType==="source"&&t.coord?this._clearRenderCacheForTile(t.sourceCacheId,t.coord):t.dataType==="style"&&(this.invalidateRenderCache=!0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this._previousCameraAltitude=void 0)}_disable(){if(this.enabled&&(this.enabled=!1,this._emptyDEMTextureDirty=!0,this._sharedDepthStencil=void 0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const t in this._style._mergedSourceCaches)this._style._mergedSourceCaches[t].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach(t=>t.fb.destroy()),this.pool=[],this.framebufferCopyTexture&&this.framebufferCopyTexture.destroy()}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this.enabled?this._exaggeration:0}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const t=2*this.proxySourceCache.getSource().tileSize;return[t,t]}set useVertexMorphing(t){this._useVertexMorphing=t}updateTileBinding(t){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const o=this.proxySourceCache,c=this.painter.transform;this._initializing&&(this._initializing=c._centerAltitude===0&&this.getAtPointOrZero(s.ae.fromLngLat(c.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const d=this.proxyCoords=o.getIds().map(x=>{const T=o.getTileByID(x).tileID;return T.projMatrix=c.calculateProjMatrix(T.toUnwrapped()),T});(function(x,T){const S=T.transform.pointCoordinate(T.transform.getCameraPoint()),M=new s.P(S.x,S.y);x.sort((A,C)=>{if(C.overscaledZ-A.overscaledZ)return C.overscaledZ-A.overscaledZ;const L=new s.P(A.canonical.x+(1<<A.canonical.z)*A.wrap,A.canonical.y),z=new s.P(C.canonical.x+(1<<C.canonical.z)*C.wrap,C.canonical.y),O=M.mult(1<<A.canonical.z);return O.x-=.5,O.y-=.5,O.distSqr(L)-O.distSqr(z)})})(d,this.painter);const p=this.proxyToSource||{};this.proxyToSource={},d.forEach(x=>{this.proxyToSource[x.key]={}}),this.terrainTileForTile={};const m=this._style._mergedSourceCaches;for(const x in m){const T=m[x];if(!T.used||(T!==this.sourceCache&&this.resetTileLookupCache(T.id),this._setupProxiedCoordsForOrtho(T,t[x],p),T.usedForTerrain))continue;const S=t[x];T.getSource().reparseOverscaled&&this._assignTerrainTiles(S)}this.proxiedCoords[o.id]=d.map(x=>new ph(x,x.key,this.orthoMatrix)),this._assignTerrainTiles(d),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(p),this.renderingToTexture=!1;const y={};this._visibleDemTiles=[];for(const x of this.proxyCoords){const T=this.terrainTileForTile[x.key];if(!T)continue;const S=T.tileID.key;S in y||(this._visibleDemTiles.push(T),y[S]=S)}}_assignTerrainTiles(t){this._initializing||t.forEach(o=>{if(this.terrainTileForTile[o.key])return;const c=this._findTileCoveringTileID(o,this.sourceCache);c&&(this.terrainTileForTile[o.key]=c)})}_prepareDEMTextures(){const t=this.painter.context,o=t.gl;for(const c in this.terrainTileForTile){const d=this.terrainTileForTile[c],p=d.dem;!p||d.demTexture&&!d.needsDEMTextureUpload||(t.activeTexture.set(o.TEXTURE1),rh(this.painter,d,p))}}_prepareDemTileUniforms(t,o,c,d){if(!o||o.demTexture==null)return!1;const p=t.tileID.canonical,m=Math.pow(2,o.tileID.canonical.z-p.z),y=d||"";return c[`u_dem_tl${y}`]=[p.x*m%1,p.y*m%1],c[`u_dem_scale${y}`]=m,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let t=0;const o=this._visibleDemTiles.reduce((c,d)=>{if(!d.dem)return c;const p=d.dem.tree.minimums[0];return p>0&&t++,c+p},0);return t?o/t:0}_updateEmptyDEMTexture(){const t=this.painter.context,o=t.gl;t.activeTexture.set(o.TEXTURE2);const c=this._getLoadedAreaMinimum(),d=new s.dL({width:1,height:1},new Float32Array([c]));this._emptyDEMTextureDirty=!1;let p=this._emptyDEMTexture;return p?p.update(d,{premultiply:!1}):p=this._emptyDEMTexture=new s.T(t,d,o.R32F,{premultiply:!1}),p}setupElevationDraw(t,o,c){const d=this.painter.context,p=d.gl,m={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0};m.u_exaggeration=this.exaggeration();let y=null,x=null,T=1;if(c&&c.morphing&&this._useVertexMorphing){const C=c.morphing.srcDemTile,L=c.morphing.dstDemTile;T=c.morphing.phase,C&&L&&(this._prepareDemTileUniforms(t,C,m,"_prev")&&(x=C),this._prepareDemTileUniforms(t,L,m)&&(y=L))}const S=C=>C&&C.demTexture&&this.painter.linearFloatFilteringSupported()?p.LINEAR:p.NEAREST;let M=null;var A;if(this.enabled?x&&y?(M=y.demTexture,d.activeTexture.set(p.TEXTURE4),x.demTexture.bind(S(x),p.CLAMP_TO_EDGE),m.u_dem_lerp=T):(y=this.terrainTileForTile[t.tileID.key],M=this._prepareDemTileUniforms(t,y,m)?y.demTexture:this.emptyDEMTexture):M=this.emptyDEMTexture,d.activeTexture.set(p.TEXTURE2),M&&(m.u_dem_size=(A=M).size[0]===1?1:A.size[0]-2,M.bind(S(y),p.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(c&&c.useDepthForOcclusion,o,m),c&&c.useMeterToDem&&y){const C=(1<<y.tileID.canonical.z)*s.cf(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;m.u_meter_to_dem=C}if(c&&c.labelPlaneMatrixInv&&(m.u_label_plane_matrix_inv=c.labelPlaneMatrixInv),o.setTerrainUniformValues(d,m),this.painter.transform.projection.name==="globe"){const C=this.globeUniformValues(this.painter.transform,t.tileID.canonical,c&&c.useDenormalizedUpVectorScale);o.setGlobeUniformValues(d,C)}}globeUniformValues(t,o,c){const d=t.projection;return{u_tile_tl_up:d.upVector(o,0,0),u_tile_tr_up:d.upVector(o,s.al,0),u_tile_br_up:d.upVector(o,s.al,s.al),u_tile_bl_up:d.upVector(o,0,s.al),u_tile_up_scale:c?s.dM(1):d.upVectorScale(o,t.center.lat,t.worldSize).metersToTile}}renderToBackBuffer(t){const o=this.painter,c=this.painter.context;t.length!==0&&(c.bindFramebuffer.set(null),c.viewport.set([0,0,o.width,o.height]),o.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,(function(d,p,m,y,x){if(d.transform.projection.name==="globe")(function(T,S,M,A,C){const L=T.context,z=L.gl;let O,N;const q=T.transform,G=s.dE(T,L,q),j=(ve,ge)=>{if(N===ge)return;const Me=[Fc[ge],"PROJECTION_GLOBE_VIEW"];G&&Me.push("CUSTOM_ANTIALIASING");const Fe=T.isTileAffectedByFog(ve);O=T.getOrCreateProgram("globeRaster",{defines:Me,overrideFog:Fe}),N=ge},ie=T.colorModeForRenderPass(),Q=new ut(z.LEQUAL,ut.ReadWrite,T.depthRangeFor3D);qo.update(C);const te=s.dF(q),X=[s.aF(q.center.lng),s.aJ(q.center.lat)],Z=T.globeSharedBuffers,ne=[q.width*s.o.devicePixelRatio,q.height*s.o.devicePixelRatio],ce=Float32Array.from(q.globeMatrix),de={useDenormalizedUpVectorScale:!0};{const ve=T.transform,ge=Oc(ve.zoom,S.exaggeration(),S.sourceCache._source.tileSize);N=-1;const Me=z.TRIANGLES;for(const Fe of A){const pe=M.getTile(Fe),oe=vt.disabled,Ie=S.prevTerrainTileForTile[Fe.key],be=S.terrainTileForTile[Fe.key];Al(Ie,be)&&qo.newMorphing(Fe.key,Ie,be,C,250),Ca(T,pe.emissiveTexture),L.activeTexture.set(z.TEXTURE0),pe.texture&&pe.texture.bind(z.LINEAR,z.CLAMP_TO_EDGE);const ke=qo.getMorphValuesForProxy(Fe.key),Ue=ke?1:0;ke&&Object.assign(de,{morphing:{srcDemTile:ke.from,dstDemTile:ke.to,phase:s.dD(ke.phase)}});const Ke=s.dG(Fe.canonical),je=s.dH(Ke.getCenter().lat),He=s.dI(Fe.canonical,Ke,je,ve.worldSize/ve._pixelsPerMercatorPixel),lt=s.bk(s.dJ(Fe.canonical)),st=T.emissiveMode==="mrt-fallback"?1:0,et=Lc(ve.expandedFarZProjMatrix,ce,te,lt,s.aj(ve.zoom),X,ve.frustumCorners.TL,ve.frustumCorners.TR,ve.frustumCorners.BR,ve.frustumCorners.BL,ve.globeCenterInViewSpace,ve.globeRadius,ne,ge,ve._farZ,st,He);if(j(Fe,Ue),O&&(S.setupElevationDraw(pe,O,de),T.uploadCommonUniforms(L,O,Fe.toUnwrapped()),Z)){const[ot,dt,yt]=Z.getGridBuffers(je,ge!==0);O.draw(T,Me,Q,oe,ie,gt.backCCW,et,"globe_raster",ot,dt,yt)}}}if(Z&&(T.renderDefaultNorthPole||T.renderDefaultSouthPole)){const ve=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];G&&ve.push("CUSTOM_ANTIALIASING"),O=T.getOrCreateProgram("globeRaster",{defines:ve});for(const ge of A){const{x:Me,y:Fe,z:pe}=ge.canonical,oe=Fe===0,Ie=Fe===(1<<pe)-1,[be,ke,Ue,Ke]=Z.getPoleBuffers(pe,!1);if(Ke&&(oe||Ie)){const je=M.getTile(ge);Ca(T,je.emissiveTexture),L.activeTexture.set(z.TEXTURE0),je.texture&&je.texture.bind(z.LINEAR,z.CLAMP_TO_EDGE);let He=s.dK(pe,Me,q);const lt=s.bk(s.dJ(ge.canonical)),st=T.emissiveMode==="mrt-fallback"?1:0,et=(ot,dt)=>ot.draw(T,z.TRIANGLES,Q,vt.disabled,ie,gt.disabled,Lc(q.expandedFarZProjMatrix,He,He,lt,0,X,q.frustumCorners.TL,q.frustumCorners.TR,q.frustumCorners.BR,q.frustumCorners.BL,q.globeCenterInViewSpace,q.globeRadius,ne,0,q._farZ,st),"globe_pole_raster",dt,Ue,Ke);S.setupElevationDraw(je,O,de),T.uploadCommonUniforms(L,O,ge.toUnwrapped()),oe&&T.renderDefaultNorthPole&&et(O,be),Ie&&T.renderDefaultSouthPole&&(He=s.cS(s.bC(),He,[1,-1,1]),et(O,ke))}}}})(d,p,m,y,x);else{const T=d.context,S=T.gl;let M,A;const C=d.shadowRenderer,L=Wn(d,d.longestCutoffRange),z=ie=>{if(A===ie)return;const Q=[];Q.push(Fc[ie]),L.shouldRenderCutoff&&Q.push("RENDER_CUTOFF"),C&&(Q.push("RENDER_SHADOWS","DEPTH_TEXTURE"),C.useNormalOffset&&Q.push("NORMAL_OFFSET")),M=d.getOrCreateProgram("terrainRaster",{defines:Q}),A=ie},O=d.colorModeForRenderPass(),N=new ut(S.LEQUAL,ut.ReadWrite,d.depthRangeFor3D);qo.update(x);const q=d.transform,G=Oc(q.zoom,p.exaggeration(),p.sourceCache._source.tileSize);let j=[0,0,0];if(C){const ie=d.style.directionalLight,Q=d.style.ambientLight;ie&&Q&&(j=Xn(d.style,ie,Q))}{A=-1;const ie=S.TRIANGLES,[Q,te]=[p.gridIndexBuffer,p.gridSegments];for(const X of y){const Z=m.getTile(X),ne=vt.disabled,ce=p.prevTerrainTileForTile[X.key],de=p.terrainTileForTile[X.key];Al(ce,de)&&qo.newMorphing(X.key,ce,de,x,250),Ca(d,Z.emissiveTexture),T.activeTexture.set(S.TEXTURE0),Z.texture&&Z.texture.bind(S.LINEAR,S.CLAMP_TO_EDGE);const ve=qo.getMorphValuesForProxy(X.key),ge=ve?1:0;let Me;ve&&(Me={morphing:{srcDemTile:ve.from,dstDemTile:ve.to,phase:s.dD(ve.phase)}});const Fe=d.emissiveMode==="mrt-fallback"?1:0,pe=Fn(X.projMatrix,dh(X.canonical,q.renderWorldCopies)?G/10:G,j,Fe);if(z(ge),!M)continue;p.setupElevationDraw(Z,M,Me);const oe=X.toUnwrapped();C&&C.setupShadows(oe,M),d.uploadCommonUniforms(T,M,oe,null,L),M.draw(d,ie,N,ne,O,gt.backCCW,pe,"terrain_raster",p.gridBuffer,Q,te)}}}})(o,this,this.proxySourceCache,t,this._updateTimestamp),this.renderingToTexture=!0,o.gpuTimingDeferredRenderEnd(),t.splice(0,t.length))}renderBatch(t){if(this._drapedRenderBatches.length===0)return t+1;this.renderingToTexture=!0;const o=this.painter,c=this.painter.context,d=this.proxySourceCache,p=this.proxiedCoords[d.id],m=this._drapedRenderBatches.shift(),y=o.style.order,x=[];this._updateFBOs(o.emissiveMode==="mrt-fallback");let T=0;for(const S of p){const M=d.getTileByID(S.proxyTileKey),A=d.proxyCachedFBO[S.key]?d.proxyCachedFBO[S.key][t]:void 0,C=A!==void 0?d.renderCache[A]:this.pool[T++],L=A!==void 0;if(M.texture=C.tex,M.emissiveTexture=C.emissiveTex,L&&!C.dirty){x.push(M.tileID);continue}c.bindFramebuffer.set(C.fb.framebuffer);const z=c.gl;let O;z.drawBuffers(o.emissiveMode==="mrt-fallback"?[z.COLOR_ATTACHMENT0,z.COLOR_ATTACHMENT1]:[z.COLOR_ATTACHMENT0]),this.renderedToTile=!1,C.dirty&&(c.clear({color:s.ao.transparent,stencil:0}),C.dirty=!1);for(let N=m.start;N<=m.end;++N){const q=o.style._mergedLayers[y[N]];if(q.isHidden(o.transform.zoom))continue;const G=o.style.getLayerSourceCache(q),j=G?this.proxyToSource[S.key][G.id]:[S];if(!j)continue;const ie=j;c.viewport.set([0,0,C.fb.width,C.fb.height]),O!==(G?G.id:null)&&(this._setupStencil(C,j,q,G),O=G?G.id:null),o.renderLayer(o,G,q,ie)}if(z.drawBuffers([z.COLOR_ATTACHMENT0]),this._drapedRenderBatches.length===0)for(const N of this._pendingGroundEffectLayers){const q=o.style._mergedLayers[y[N]];if(q.isHidden(o.transform.zoom))continue;const G=o.style.getLayerSourceCache(q),j=G?this.proxyToSource[S.key][G.id]:[S];if(!j)continue;const ie=j;c.viewport.set([0,0,C.fb.width,C.fb.height]),O!==(G?G.id:null)&&(this._setupStencil(C,j,q,G),O=G?G.id:null),o.renderLayer(o,G,q,ie)}this.renderedToTile?(C.dirty=!0,x.push(M.tileID)):L||--T,T===5&&(T=0,this.renderToBackBuffer(x))}return this.renderToBackBuffer(x),this.renderingToTexture=!1,c.bindFramebuffer.set(null),c.viewport.set([0,0,o.width,o.height]),m.end+1}postRender(){}isLayerOrderingCorrect(t){const o=t.order.length;let c=-1,d=o;for(let p=0;p<o;++p)this._style.isLayerDraped(t._mergedLayers[t.order[p]])?c=Math.max(c,p):d=Math.min(d,p);return d>c}getMinElevationBelowMSL(){let t=0;return this._visibleDemTiles.filter(o=>o.dem).forEach(o=>{t=Math.min(t,o.dem.tree.minimums[0])}),t===0?t:(t-30)*this._exaggeration}raycast(t,o,c){if(!this._visibleDemTiles)return null;const d=this._visibleDemTiles.filter(p=>p.dem).map(p=>{const m=p.tileID,y=1<<m.overscaledZ,{x,y:T}=m.canonical,S=x/y,M=(x+1)/y,A=T/y,C=(T+1)/y;return{minx:S,miny:A,maxx:M,maxy:C,t:p.dem.tree.raycastRoot(S,A,M,C,t,o,c),tile:p}});d.sort((p,m)=>(p.t!==null?p.t:Number.MAX_VALUE)-(m.t!==null?m.t:Number.MAX_VALUE));for(const p of d){if(p.t==null)return null;const m=p.tile.dem.tree.raycast(p.minx,p.miny,p.maxx,p.maxy,t,o,c);if(m!=null)return m}return null}_createFBO(){const t=this.painter.context,o=t.gl,c=this.drapeBufferSize;t.activeTexture.set(o.TEXTURE0);const d=new s.T(t,{width:c[0],height:c[1],data:null},o.RGBA8);d.bind(o.LINEAR,o.CLAMP_TO_EDGE);const p=t.createFramebuffer(c[0],c[1],1,null);let m;return p.colorAttachment0.set(d.texture),this._emissiveTexture&&(m=new s.T(t,{width:c[0],height:c[1],data:null},o.R8),m.bind(o.LINEAR,o.CLAMP_TO_EDGE),p.createColorAttachment(t,1),p.colorAttachment1.set(m.texture)),p.depthAttachment=new wf(t,p.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=t.createRenderbuffer(t.gl.DEPTH_STENCIL,c[0],c[1]),this._stencilRef=0,p.depthAttachment.set(this._sharedDepthStencil),t.clear({stencil:0})):p.depthAttachment.set(this._sharedDepthStencil),t.extTextureFilterAnisotropic&&o.texParameterf(o.TEXTURE_2D,t.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,t.extTextureFilterAnisotropicMax),{fb:p,tex:d,emissiveTex:m,dirty:!1}}_updateFBOs(t){if(this._emissiveTexture!==t){for(const o of this.pool)this._updateFBO(o,t);for(const o of this.proxySourceCache.renderCache)this._updateFBO(o,t);this._emissiveTexture=t}}_updateFBO(t,o){const c=t.fb,d=this.painter.context,p=d.gl,m=this.drapeBufferSize;if(o){const y=new s.T(d,{width:m[0],height:m[1],data:null},p.R8);y.bind(p.LINEAR,p.CLAMP_TO_EDGE),t.emissiveTex=y,c.createColorAttachment(d,1),c.colorAttachment1.set(y.texture)}else t.emissiveTex=void 0,c.removeColorAttachment(d,1);t.dirty=!0}_initFBOPool(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())}_shouldDisableRenderCache(){if(this._debugParams.disableRenderCache||this._style.hasLightTransitions())return!0;for(const t in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[t].hasTransition())return!0;return this._style.order.some(t=>{const o=this._style._mergedLayers[t],c=o.isHidden(this.painter.transform.zoom);return o.type==="hillshade"||o.type==="custom"?!c&&o.shouldRedrape():!c&&o.hasTransition()})}_clearLineLayersFromRenderCache(){let t=!1;for(const c of this._style.getSources())if(c instanceof $n){t=!0;break}if(!t)return;const o={};for(let c=0;c<this._style.order.length;++c){const d=this._style._mergedLayers[this._style.order[c]],p=this._style.getLayerSourceCache(d);if(!p||o[p.id]||d.isHidden(this.painter.transform.zoom)||d.type!=="line")continue;const m=d.widthExpression(),y=d.emissiveStrengthExpression();if(m instanceof s.ad||y instanceof s.ad){o[p.id]=!0;for(const x of this.proxyCoords){const T=this.proxyToSource[x.key][p.id];if(T)for(const S of T)this._clearRenderCacheForTile(p.id,S)}}}}_clearRasterLayersFromRenderCache(){let t=!1;for(const c in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[c]._source instanceof ro){t=!0;break}if(!t)return;const o={};for(let c=0;c<this._style.order.length;++c){const d=this._style._mergedLayers[this._style.order[c]],p=this._style.getLayerSourceCache(d);if(!p||o[p.id]||d.isHidden(this.painter.transform.zoom)||d.type!=="raster")continue;const m=d.paint.get("raster-fade-duration");for(const y of this.proxyCoords){const x=this.proxyToSource[y.key][p.id];if(x)for(const T of x){const S=Cl(p.getTile(T),p.findLoadedParent(T,0),p,this.painter.transform,m);(S.opacity!==1||S.mix!==0)&&this._clearRenderCacheForTile(p.id,T)}}}}_setupDrapedRenderBatches(){this._style.updateDrapeFirstLayers();const t=this._style.order,o=t.length;if(o===0)return;const c=[];this._pendingGroundEffectLayers=[];let d,p=0,m=this._style._mergedLayers[t[p]];for(;!this._style.isLayerDraped(m)&&m.isHidden(this.painter.transform.zoom)&&++p<o;)m=this._style._mergedLayers[t[p]];for(;p<o;++p){const y=this._style._mergedLayers[t[p]];y.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(y)?d===void 0&&(d=p):(y.type==="fill-extrusion"&&this._pendingGroundEffectLayers.push(p),d!==void 0&&(c.push({start:d,end:p-1}),d=void 0)))}if(d!==void 0&&c.push({start:d,end:p-1}),c.length!==0){const y=c[c.length-1];this._pendingGroundEffectLayers.every(x=>x>y.end)||s.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=c}_setupRenderCache(t){const o=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,o.renderCache.length>o.renderCachePool.length){const m=Object.values(o.proxyCachedFBO);o.proxyCachedFBO={};for(let y=0;y<m.length;++y){const x=Object.values(m[y]);o.renderCachePool.push(...x)}}return}this._clearRasterLayersFromRenderCache();const c=this.proxyCoords,d=this._tilesDirty;for(let m=c.length-1;m>=0;m--){const y=c[m];if(o.getTileByID(y.key),o.proxyCachedFBO[y.key]!==void 0){const x=t[y.key],T=this.proxyToSource[y.key];let S=0;for(const M in T){const A=T[M],C=x[M];if(!C||C.length!==A.length||A.some((L,z)=>L!==C[z]||d[M]&&d[M].hasOwnProperty(L.key))){S=-1;break}++S}for(const M in o.proxyCachedFBO[y.key])o.renderCache[o.proxyCachedFBO[y.key][M]].dirty=S<0||S!==Object.values(x).length}}const p=[...this._drapedRenderBatches];p.sort((m,y)=>y.end-y.start-(m.end-m.start));for(const m of p)for(const y of c){if(o.proxyCachedFBO[y.key])continue;let x=o.renderCachePool.pop();x===void 0&&o.renderCache.length<50&&(x=o.renderCache.length,o.renderCache.push(this._createFBO())),x!==void 0&&(o.proxyCachedFBO[y.key]={},o.proxyCachedFBO[y.key][m.start]=x,o.renderCache[x].dirty=!0)}this._tilesDirty={}}_setupStencil(t,o,c,d){if(!d||!this._sourceTilesOverlap[d.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const p=this.painter.context,m=p.gl;if(o.length<=1)return void(this._overlapStencilType=!1);let y;if(c.isTileClipped())y=o.length,this._overlapStencilMode.test={func:m.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(o[0].overscaledZ>o[o.length-1].overscaledZ))return void(this._overlapStencilType=!1);y=1,this._overlapStencilMode.test={func:m.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+y>255&&(p.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=y,this._overlapStencilMode.ref=this._stencilRef,c.isTileClipped()&&this._renderTileClippingMasks(o,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return this._overlapStencilType==="Clip"||this._overlapStencilType==="Mask"}stencilModeForRTTOverlap(t){return this.renderingToTexture&&this._overlapStencilType?(this._overlapStencilType==="Clip"&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[t.key]),this._overlapStencilMode):vt.disabled}_renderTileClippingMasks(t,o){const c=this.painter,d=this.painter.context,p=d.gl;c._tileClippingMaskIDs={},d.setColorMode(Et.disabled),d.setDepthMode(ut.disabled);const m=c.getOrCreateProgram("clippingMask");for(const y of t){const x=c._tileClippingMaskIDs[y.key]=--o;m.draw(c,p.TRIANGLES,ut.disabled,new vt({func:p.ALWAYS,mask:0},x,255,p.KEEP,p.KEEP,p.REPLACE),Et.disabled,gt.disabled,Ml(y.projMatrix),"$clipping",c.tileExtentBuffer,c.quadTriangleIndexBuffer,c.tileExtentSegments)}}pointCoordinate(t){const o=this.painter.transform;if(t.x<0||t.x>o.width||t.y<0||t.y>o.height)return null;const c=[t.x,t.y,1,1];s.aC(c,c,o.pixelMatrixInverse),s.cK(c,c,1/c[3]),c[0]/=o.worldSize,c[1]/=o.worldSize;const d=o._camera.position,p=s.cf(1,o.center.lat),m=[d[0],d[1],d[2]/p,0],y=s.da([],c.slice(0,3),m);s.aw(y,y);const x=this.raycast(m,y,this._exaggeration);return x!==null&&x?(s.bH(m,m,y,x),m[3]=m[2],m[2]*=p,m):null}_setupProxiedCoordsForOrtho(t,o,c){if(t.getSource()instanceof s.aU)return this._setupProxiedCoordsForImageSource(t,o,c);this._findCoveringTileCache[t.id]=this._findCoveringTileCache[t.id]||{};const d=this.proxiedCoords[t.id]=[],p=this.proxyCoords;for(let x=0;x<p.length;x++){const T=p[x],S=this._findTileCoveringTileID(T,t);if(S){const M=this._createProxiedId(T,S,c[T.key]&&c[T.key][t.id]);d.push(M),this.proxyToSource[T.key][t.id]=[M]}}let m=!1;const y=new Set;for(let x=0;x<o.length;x++){const T=t.getTile(o[x]);if(!T||!T.hasData())continue;const S=this._findTileCoveringTileID(T.tileID,this.proxySourceCache);if(S&&S.tileID.canonical.z!==T.tileID.canonical.z){const M=this.proxyToSource[S.tileID.key][t.id],A=this._createProxiedId(S.tileID,T,c[S.tileID.key]&&c[S.tileID.key][t.id]);M?M.splice(M.length-1,0,A):this.proxyToSource[S.tileID.key][t.id]=[A];const C=this.proxyToSource[S.tileID.key][t.id];y.has(C)||y.add(C),d.push(A),m=!0}}if(this._sourceTilesOverlap[t.id]=m,m&&this._debugParams.sortTilesHiZFirst)for(const x of y)x.sort((T,S)=>S.overscaledZ-T.overscaledZ)}_setupProxiedCoordsForImageSource(t,o,c){if(!t.getSource().loaded())return;const d=this.proxiedCoords[t.id]=[],p=this.proxyCoords,m=t.getSource(),y=m.tileID;if(!y)return;const x=new s.P(y.x,y.y)._div(1<<y.z),T=m.coordinates.map(s.ae.fromLngLat).reduce((M,A)=>(M.min.x=Math.min(M.min.x,A.x-x.x),M.min.y=Math.min(M.min.y,A.y-x.y),M.max.x=Math.max(M.max.x,A.x-x.x),M.max.y=Math.max(M.max.y,A.y-x.y),M),{min:new s.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new s.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),S=(M,A)=>{const C=M.wrap+M.canonical.x/(1<<M.canonical.z),L=M.canonical.y/(1<<M.canonical.z),z=s.al/(1<<M.canonical.z),O=A.wrap+A.canonical.x/(1<<A.canonical.z),N=A.canonical.y/(1<<A.canonical.z);return C+z<O+T.min.x||C>O+T.max.x||L+z<N+T.min.y||L>N+T.max.y};for(let M=0;M<p.length;M++){const A=p[M];for(let C=0;C<o.length;C++){const L=t.getTile(o[C]);if(!L||!L.hasData()||S(A,L.tileID))continue;const z=this._createProxiedId(A,L,c[A.key]&&c[A.key][t.id]),O=this.proxyToSource[A.key][t.id];O?O.push(z):this.proxyToSource[A.key][t.id]=[z],d.push(z)}}}_createProxiedId(t,o,c){let d=this.orthoMatrix;if(c){const p=c.find(m=>m.key===o.tileID.key);if(p)return p}if(o.tileID.key!==t.key){const p=t.canonical.z-o.tileID.canonical.z;let m,y,x;d=s.bC();const T=o.tileID.wrap-t.wrap<<t.overscaledZ;p>0?(m=s.al>>p,y=m*((o.tileID.canonical.x<<p)-t.canonical.x+T),x=m*((o.tileID.canonical.y<<p)-t.canonical.y)):(m=s.al<<-p,y=s.al*(o.tileID.canonical.x-(t.canonical.x+T<<-p)),x=s.al*(o.tileID.canonical.y-(t.canonical.y<<-p))),s.ce(d,0,m,0,m,0,1),s.br(d,d,[y,x,0])}return new ph(o.tileID,t.key,d)}_findTileCoveringTileID(t,o){let c=o.getTile(t);if(c&&c.hasData())return c;const d=this._findCoveringTileCache[o.id],p=d[t.key];if(c=p?o.getTileByID(p):null,c&&c.hasData()||p===null)return c;let m=c?c.tileID:t,y=m.overscaledZ;const x=o.getSource().minzoom,T=[];if(!p){const M=o.getSource().maxzoom;if(t.canonical.z>=M){const A=t.canonical.z-M;o.getSource().reparseOverscaled?(y=Math.max(t.canonical.z+2,o.transform.tileZoom),m=new s.aQ(y,t.wrap,M,t.canonical.x>>A,t.canonical.y>>A)):A!==0&&(y=M,m=new s.aQ(y,t.wrap,M,t.canonical.x>>A,t.canonical.y>>A))}m.key!==t.key&&(T.push(m.key),c=o.getTile(m))}const S=M=>{T.forEach(A=>{d[A]=M}),T.length=0};for(y-=1;y>=x&&(!c||!c.hasData());y--){c&&S(c.tileID.key);const M=m.calculateScaledKey(y);if(c=o.getTileByID(M),c&&c.hasData())break;const A=d[M];if(A===null)break;A===void 0?T.push(M):c=o.getTileByID(A)}return S(c?c.tileID.key:null),c&&c.hasData()?c:null}findDEMTileFor(t){return this.enabled?this._findTileCoveringTileID(t,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(t,o){let c=this._tilesDirty[t];c||(c=this._tilesDirty[t]={}),c[o.key]=!0}}function Pa(l,t,o){const c=(function(y,x,T){const S=s.bJ(x,y),M=s.bJ(T,[.2126,.7152,.0722]),A=(L,z,O)=>(1-O)*L+O*z,C=A(1-.3*Math.min(M,1),1,Math.min(S+1,1));return A(.92,1,Math.asin(s.aA(x[2],-1,1))/Math.PI+.5)*C})(l,[0,0,1],t),d=[0,0,0];s.c5(d,o.slice(0,3),c);const p=[0,0,0];s.c5(p,t.slice(0,3),l[2]);const m=[0,0,0];return s.d8(m,d,p),s.db(m)}const km=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],Bm=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","building","buildingBloom","elevatedStructures","model","symbol"];class Tf{static cacheKey(t,o,c,d){const p=[o];d&&p.push(d.cacheKey);for(const m of c)t.usedDefines.has(m)&&p.push(m);return p.join("/")}constructor(t,o,c,d,p,m){const y=t.gl;this.program=y.createProgram(),this.configuration=d,this.name=o,this.fixedDefines=[...m];const x=`#version 300 es
2994${(d?d.defines():[]).concat(m.map(z=>`#define ${z}`)).join(`
2995`)}`,T=[x,Mm];for(const z of c.fragmentIncludes)T.push(ms[z]);T.push(c.fragmentSource);const S=T.join(`
2996`),M=[x,ff];for(const z of c.vertexIncludes)M.push(ms[z]);this.forceManualRenderingForInstanceIDShaders=t.forceManualRenderingForInstanceIDShaders&&c.vertexSource.includes("gl_InstanceID"),this.forceManualRenderingForInstanceIDShaders&&M.push("uniform int u_instanceID;"),M.push(c.vertexSource);let A=M.join(`
2997`);this.forceManualRenderingForInstanceIDShaders&&(A=A.replaceAll("gl_InstanceID","u_instanceID"));const C=y.createShader(y.FRAGMENT_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);y.shaderSource(C,S),y.compileShader(C),y.attachShader(this.program,C);const L=y.createShader(y.VERTEX_SHADER);y.isContextLost()?this.failedToCreate=!0:(y.shaderSource(L,A),y.compileShader(L),y.attachShader(this.program,L),this.attributes={},y.linkProgram(this.program),y.deleteShader(L),y.deleteShader(C),this.fixedUniforms=p(t),this.fixedUniformsEntries=Object.entries(this.fixedUniforms),this.binderUniforms=d?d.getUniforms(t):[],this.forceManualRenderingForInstanceIDShaders&&(this.instancingUniforms=(z=>({u_instanceID:new s.ch(z)}))(t)),(m.includes("TERRAIN")||o.includes("symbol")||o.includes("circle"))&&(this.terrainUniforms=(z=>({u_dem:new s.ch(z),u_dem_prev:new s.ch(z),u_dem_tl:new s.ck(z),u_dem_scale:new s.cj(z),u_dem_tl_prev:new s.ck(z),u_dem_scale_prev:new s.cj(z),u_dem_size:new s.cj(z),u_dem_lerp:new s.cj(z),u_exaggeration:new s.cj(z),u_depth:new s.ch(z),u_depth_size_inv:new s.ck(z),u_depth_range_unpack:new s.ck(z),u_occluder_half_size:new s.cj(z),u_occlusion_depth_offset:new s.cj(z),u_meter_to_dem:new s.cj(z),u_label_plane_matrix_inv:new s.cl(z)}))(t)),m.includes("GLOBE")&&(this.globeUniforms=(z=>({u_tile_tl_up:new s.ci(z),u_tile_tr_up:new s.ci(z),u_tile_br_up:new s.ci(z),u_tile_bl_up:new s.ci(z),u_tile_up_scale:new s.cj(z)}))(t)),m.includes("FOG")&&(this.fogUniforms=(z=>({u_fog_matrix:new s.cl(z),u_fog_range:new s.ck(z),u_fog_color:new s.d3(z),u_fog_horizon_blend:new s.cj(z),u_fog_vertical_limit:new s.ck(z),u_fog_temporal_offset:new s.cj(z),u_frustum_tl:new s.ci(z),u_frustum_tr:new s.ci(z),u_frustum_br:new s.ci(z),u_frustum_bl:new s.ci(z),u_globe_pos:new s.ci(z),u_globe_radius:new s.cj(z),u_globe_transition:new s.cj(z),u_is_globe:new s.ch(z),u_viewport:new s.ck(z)}))(t)),m.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(z=>({u_cutoff_params:new s.d3(z)}))(t)),m.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(z=>({u_lighting_ambient_color:new s.ci(z),u_lighting_directional_dir:new s.ci(z),u_lighting_directional_color:new s.ci(z),u_ground_radiance:new s.ci(z)}))(t)),m.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(z=>({u_light_matrix_0:new s.cl(z),u_light_matrix_1:new s.cl(z),u_fade_range:new s.ck(z),u_shadow_normal_offset:new s.ci(z),u_shadow_intensity:new s.cj(z),u_shadow_texel_size:new s.cj(z),u_shadow_map_resolution:new s.cj(z),u_shadow_direction:new s.ci(z),u_shadow_bias:new s.ci(z),u_shadowmap_0:new s.ch(z),u_shadowmap_1:new s.ch(z)}))(t)))}getAttributeLocation(t,o){let c=this.attributes[o];return c===void 0&&(c=this.attributes[o]=t.getAttribLocation(this.program,o)),c}setTerrainUniformValues(t,o){if(!this.terrainUniforms)return;const c=this.terrainUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in o)c[d]&&c[d].set(this.program,d,o[d])}}setGlobeUniformValues(t,o){if(!this.globeUniforms)return;const c=this.globeUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in o)c[d]&&c[d].set(this.program,d,o[d])}}setFogUniformValues(t,o){if(!this.fogUniforms)return;const c=this.fogUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in o)c[d].set(this.program,d,o[d])}}setCutoffUniformValues(t,o){if(!this.cutoffUniforms)return;const c=this.cutoffUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in o)c[d].set(this.program,d,o[d])}}setLightsUniformValues(t,o){if(!this.lightsUniforms)return;const c=this.lightsUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in o)c[d].set(this.program,d,o[d])}}setShadowUniformValues(t,o){if(this.failedToCreate||!this.shadowUniforms)return;const c=this.shadowUniforms;t.program.set(this.program);for(const d in o)c[d].set(this.program,d,o[d])}_drawDebugWireframe(t,o,c,d,p,m,y,x,T,S){const M=t.options.wireframe;if(M.terrain===!1&&M.layers2D===!1&&M.layers3D===!1)return;const A=t.context;if(!(!(!M.terrain||this.name!=="terrainRaster"&&this.name!=="globeRaster")||!(!M.layers2D||t._terrain&&t._terrain.renderingToTexture||!km.includes(this.name))||!(!M.layers3D||!Bm.includes(this.name))))return;const C=A.gl,L=t.wireframeDebugCache.getLinesFromTrianglesBuffer(t.frameCounter,p,A);if(!L)return;
2997const z=[...this.fixedDefines,"DEBUG_WIREFRAME"],O=t.getOrCreateProgram(this.name,{config:this.configuration,defines:z});A.program.set(O.program);const N=(j,ie,Q)=>{if(ie[j]&&Q[j])for(const te in ie[j])Q[j][te]&&Q[j][te].set(Q.program,te,ie[j][te].current)};T&&T.setUniforms(O.program,A,O.binderUniforms,y,{zoom:x}),N("fixedUniforms",this,O),N("terrainUniforms",this,O),N("globeUniforms",this,O),N("fogUniforms",this,O),N("lightsUniforms",this,O),N("shadowUniforms",this,O),L.bind(),A.setColorMode(new Et([C.ONE,C.ONE_MINUS_SRC_ALPHA,C.ZERO,C.ONE],s.ao.transparent,[!0,!0,!0,!1])),A.setDepthMode(new ut(o.func===C.LESS?C.LEQUAL:o.func,ut.ReadOnly,o.range)),A.setStencilMode(vt.disabled);const q=3*m.primitiveLength*2,G=3*m.primitiveOffset*2*2;if(this.forceManualRenderingForInstanceIDShaders){const j=S||1;for(let ie=0;ie<j;++ie)O.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",ie),C.drawElements(C.LINES,q,C.UNSIGNED_SHORT,G)}else S&&S>1?C.drawElementsInstanced(C.LINES,q,C.UNSIGNED_SHORT,G,S):C.drawElements(C.LINES,q,C.UNSIGNED_SHORT,G);p.bind(),A.program.set(this.program),A.setDepthMode(o),A.setStencilMode(c),A.setColorMode(d)}checkUniforms(t,o,c){if(this.fixedDefines.includes(o)){for(const d of Object.keys(c))if(!c[d].initialized)throw new Error(`Program '${this.name}', from draw '${t}': uniform ${d} not set but required by ${o} being defined`)}}draw(t,o,c,d,p,m,y,x,T,S,M,A,C,L,z,O){const N=t.context,q=N.gl;if(this.failedToCreate)return;N.program.set(this.program),N.setDepthMode(c),N.setStencilMode(d),N.setColorMode(p),N.setCullFace(m);for(const[X,Z]of this.fixedUniformsEntries)Z.set(this.program,X,y[X]);L&&L.setUniforms(this.program,N,this.binderUniforms,A,{zoom:C});const G={[q.POINTS]:1,[q.LINES]:2,[q.TRIANGLES]:3,[q.LINE_STRIP]:1}[o];this.checkUniforms(x,"RENDER_SHADOWS",this.shadowUniforms);const j=z||[],ie=L?L.getPaintVertexBuffers():[],Q=o===q.TRIANGLES&&S,te=O&&O>0?1:void 0;for(const X of M.get()){const Z=X.vaos||(X.vaos={});if((Z[x]||(Z[x]=new Cm)).bind(N,this,T,ie,S,X.vertexOffset,j,te),this.forceManualRenderingForInstanceIDShaders){const ne=O||1;for(let ce=0;ce<ne;++ce)this.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",ce),S?q.drawElements(o,X.primitiveLength*G,q.UNSIGNED_SHORT,X.primitiveOffset*G*2):q.drawArrays(o,X.vertexOffset,X.vertexLength)}else O&&O>1?q.drawElementsInstanced(o,X.primitiveLength*G,q.UNSIGNED_SHORT,X.primitiveOffset*G*2,O):S?q.drawElements(o,X.primitiveLength*G,q.UNSIGNED_SHORT,X.primitiveOffset*G*2):q.drawArrays(o,X.vertexOffset,X.vertexLength);Q&&this._drawDebugWireframe(t,c,d,p,S,X,A,C,L,O)}}}function Sf(l,t,o=0){const c=Math.pow(2,t.tileID.overscaledZ),d=t.tileSize*Math.pow(2,l.transform.tileZoom)/c,p=d*(t.tileID.canonical.x+t.tileID.wrap*c),m=d*t.tileID.canonical.y;return{u_image:0,u_texsize:t.imageAtlasTexture?t.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/s.ay(t,1,l.transform.tileZoom),u_pixel_coord_upper:[p>>16,m>>16],u_pixel_coord_lower:[65535&p,65535&m],u_pattern_transition:o}}const Bc={terrain:0,flat:1},Nm=s.bC(),Nc=(l,t,o,c,d,p,m,y,x,T,S,M,A,C,L,z,O,N)=>{const q=t.style.light,G=q.properties.get("position"),j=[G.x,G.y,G.z],ie=s.dO();q.properties.get("anchor")==="viewport"&&(s.dP(ie,-t.transform.angle),s.dQ(j,j,ie));const Q=q.properties.get("color").toPremultipliedRenderColor(null),te=t.transform,X={u_matrix:l,u_lightpos:j,u_lightintensity:q.properties.get("intensity"),u_lightcolor:[Q.r,Q.g,Q.b],u_vertical_gradient:+o,u_opacity:c,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Nm,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:Bc[T],u_base_type:Bc[S],u_ao:d,u_edge_radius:p,u_width_scale:m,u_flood_light_color:L,u_vertical_scale:z,u_flood_light_intensity:O,u_ground_shadow_factor:N};return te.projection.name==="globe"&&(X.u_tile_id=[y.canonical.x,y.canonical.y,1<<y.canonical.z],X.u_zoom_transition=M,X.u_inv_rot_matrix=C,X.u_merc_center=A,X.u_up_dir=te.projection.upVector(new s.cD(0,0,0),A[0]*s.al,A[1]*s.al),X.u_height_lift=x),X},_h=(l,t,o,c,d,p)=>({u_matrix:l,u_edge_radius:t,u_width_scale:o,u_vertical_scale:c,u_height_type:Bc[d],u_base_type:Bc[p]}),Ef=(l,t,o,c,d,p,m,y,x,T,S,M,A,C,L,z,O,N)=>{const q=Nc(l,t,o,c,d,p,m,y,T,S,M,A,C,L,z,O,1,[0,0,0]),G={u_height_factor:-Math.pow(2,y.overscaledZ
vendor: 4,798 bytes, line 2997
2997)/x.tileSize/8};return Object.assign(q,Sf(t,x,N),G)},Zs=(l,t,o)=>({u_matrix:l,u_emissive_strength:t,u_ground_shadow_factor:o}),gh=(l,t,o,c,d,p=0)=>Object.assign(Zs(l,t,d),Sf(o,c,p)),If=(l,t,o,c)=>({u_matrix:l,u_world:o,u_emissive_strength:t,u_ground_shadow_factor:c}),Af=(l,t,o,c,d,p,m=0)=>Object.assign(gh(l,t,o,c,p,m),{u_world:d}),yh=(l,t)=>({u_matrix:l,u_depth_bias:t}),gs=(l,t)=>({u_matrix:l,u_ground_shadow_factor:t}),Ws=(l,t,o,c,d)=>({u_matrix:l,u_camera_pos:[t[0],t[1],t[2]],u_depth_bias:o,u_height_scale:c,u_reset_depth:d}),Vc=(l,t,o,c,d,p,m,y,x)=>({u_matrix:l,u_normal_matrix:t,u_opacity:o,u_faux_facade_ao_intensity:c,u_camera_pos:d,u_tile_to_meter:p,u_facade_emissive_chance:m,u_flood_light_color:y,u_flood_light_intensity:x}),Mf=l=>({u_matrix:l}),ys=l=>({u_matrix:l}),xh=(l,t,o,c,d,p,m,y)=>{const x=s.al/p.tileSize;return{u_matrix:l,u_inv_rot_matrix:t,u_camera_to_center_distance:o.getCameraToCenterDistance(y),u_extrude_scale:[o.pixelsToGLUnits[0]/x,o.pixelsToGLUnits[1]/x],u_zoom_transition:c,u_tile_id:m,u_merc_center:d}},Uc=(l,t,o,c)=>({u_matrix:l,u_inv_matrix:t,u_camera_to_center_distance:o.getCameraToCenterDistance(c),u_viewport_size:[o.width,o.height]}),vh=(l,t,o=1)=>({u_matrix:l,u_color:t,u_overlay:0,u_overlay_scale:o}),Cf=s.bC(),bh=(l,t,o,c,d,p,m)=>{const y=l.transform,x=y.projection.name==="globe",T=x?s.dR(y.zoom,t.canonical)*y._pixelsPerMercatorPixel:s.ay(o,1,p),S={u_matrix:t.projMatrix,u_extrude_scale:T,u_intensity:m,u_inv_rot_matrix:Cf,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(x){S.u_inv_rot_matrix=c,S.u_merc_center=d,S.u_tile_id=[t.canonical.x,t.canonical.y,1<<t.canonical.z],S.u_zoom_transition=s.aj(y.zoom);const M=d[0]*s.al,A=d[1]*s.al;S.u_up_dir=y.projection.upVector(new s.cD(0,0,0),M,A)}return S};function jc(l,[t,o,c,d],[p,m]){if(p===m)return[0,0,0,0];const y=255*(l-1)/(l*(m-p));return[t*y,o*y,c*y,d*y]}function Pf(l,t,[o,c]){return o===c?0:.5/l+(t-o)*(l-1)/(l*(c-o))}const wh=(l,t,o,c,d,p,m,y,x,T,S,M,A,C,L,z,O,N,q,G,j)=>({u_matrix:l,u_normalize_matrix:t,u_globe_matrix:o,u_merc_matrix:c,u_grid_matrix:d,u_tl_parent:p,u_scale_parent:T,u_fade_t:S.mix,u_opacity:S.opacity*M.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:M.paint.get("raster-brightness-min"),u_brightness_high:M.paint.get("raster-brightness-max"),u_saturation_factor:s.dT(M.paint.get("raster-saturation")),u_contrast_factor:s.dS(M.paint.get("raster-contrast")),u_spin_weights:Pl(M.paint.get("raster-hue-rotate")),u_perspective_transform:A,u_raster_elevation:C,u_zoom_transition:m,u_merc_center:y,u_cutoff_params:x,u_colorization_mix:jc(s.dU,z,N),u_colorization_offset:Pf(s.dU,O,N),u_color_ramp:L,u_texture_offset:[G/(q+2*G),q/(q+2*G)],u_texture_res:[q+2*G,q+2*G],u_emissive_strength:j});function Pl(l){l*=Math.PI/180;const t=Math.sin(l),o=Math.cos(l);return[(2*o+1)/3,(-Math.sqrt(3)*t-o+1)/3,(Math.sqrt(3)*t-o+1)/3]}const Ra=.05,Vm=(l,t,o,c,d,p,m,y,x,T,S,M)=>({u_matrix:l,u_normalize_matrix:t,u_globe_matrix:o,u_merc_matrix:c,u_grid_matrix:d,u_tl_parent:p,u_scale_parent:T,u_fade_t:S.mix,u_opacity:S.opacity,u_image0:0,u_image1:1,u_raster_elevation:M,u_zoom_transition:m,u_merc_center:y,u_cutoff_params:x}),Rf=(l,t,o,c,d,p,m,y,x,T)=>({u_particle_texture:l,u_particle_texture_side_len:t,u_tile_offset:o,u_velocity:c,u_color_ramp:p,u_velocity_res:d,u_max_speed:m,u_uv_offset:y,u_data_scale:[255*x[0],255*x[1]],u_data_offset:T,u_particle_pos_scale:1.1,u_particle_pos_offset:[Ra,Ra]}),Um=(l,t,o,c,d,p,m,y,x,T)=>({u_particle_texture:l,u_particle_texture_side_len:t,u_velocity:o,u_velocity_res:c,u_max_speed:d,u_speed_factor:p,u_reset_rate:m,u_rand_seed:Math.random(),u_uv_offset:y,u_data_scale:[255*x[0],255*x[1]],u_data_offset:T,u_particle_pos_scale:1.1,u_particle_pos_offset:[Ra,Ra]}),Gc=s.bC(),Rl=(l,t,o,c,d,p,m,y,x,T,S,M,A,C,L,z,O,N,q,G,j,ie,Q,te)=>{const X=d.transform,Z={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:X.getCameraToCenterDistance(q),u_rotate_symbol:+o,u_aspect_ratio:X.width/X.height,u_fade_change:d.options.fadeDuration?d.symbolFadeChange:1,u_matrix:p,u_label_plane_matrix:m,u_coord_matrix:y,u_is_text:+T,u_elevation_from_sea:x?1:0,u_pitch_with_map:+c,u_texsize:S,u_texsize_icon:M,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Gc,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:Gc,u_up_vector:[0,-1,0],u_color_adj_mat:ie,u_icon_transition:Q||0,u_gamma_scale:c?d.transform.getCameraToCenterDistance(q)*Math.cos(d.terrain?0:d.transform._pitch):1,u_device_pixel_ratio:s.o.devicePixelRatio,u_is_halo:1,u_scale_factor:te||1,u_ground_shadow_factor:G,u_inv_matrix:s.bl(s.bC(),m),u_normal_scale:j,u_lutTexture:10};
2997return q.name==="globe"&&(Z.u_tile_id=[C.canonical.x,C.canonical.y,1<<C.canonical.z],Z.u_zoom_transition=L,Z.u_inv_rot_matrix=O,Z.u_merc_center=z,Z.u_camera_forward=X._camera.forward(),Z.u_ecef_origin=s.dV(X.globeMatrix,C.toUnwrapped()),Z.u_tile_matrix=Float32Array.from(X.globeMatrix),Z.u_up_vector=N),Z},xs=(l,t,o,c)=>({u_matrix:l,u_emissive_strength:t,u_opacity:o,u_color:c}),zl=(l,t,o,c,d,p,m,y,x)=>Object.assign((function(T,S,M,A,C,L){const{width:z,height:O}=A.imageManager.getPixelSize(S),N=Math.pow(2,L.tileID.overscaledZ),q=L.tileSize*Math.pow(2,A.transform.tileZoom)/N,G=q*(L.tileID.canonical.x+L.tileID.wrap*N),j=q*L.tileID.canonical.y;return{u_image:0,u_pattern_tl:M.tl,u_pattern_br:M.br,u_texsize:[z,O],u_pattern_size:M.displaySize,u_pattern_units_to_pixels:C?[A.transform.width,-1*A.transform.height]:[1/s.ay(L,1,A.transform.tileZoom),1/s.ay(L,1,A.transform.tileZoom)],u_pixel_coord_upper:[G>>16,j>>16],u_pixel_coord_lower:[65535&G,65535&j]}})(0,p,m,c,y,x),{u_matrix:l,u_emissive_strength:t,u_opacity:o}),Xs=new Float32Array(s.bA([])),qc=(l,t,o,c,d,p,m,y,x,T,S,M,A,C=[0,0,0],L,z,O)=>{const N=d.style.light,q=N.properties.get("position"),G=[-q.x,-q.y,q.z],j=s.dO();N.properties.get("anchor")==="viewport"&&(s.dP(j,-d.transform.angle),s.dQ(G,G,j));const ie=S.alphaMode==="MASK",Q=N.properties.get("color").toNonPremultipliedRenderColor(null),te=A.paint.get("model-ambient-occlusion-intensity"),X=A.paint.get("model-color").constantOr(s.ao.white).toNonPremultipliedRenderColor(null);return X.a=A.paint.get("model-color-mix-intensity").constantOr(0),O&&(X.r=O[0],X.g=O[1],X.b=O[2],X.a=O[3]),z&&(X.r=z.color.r,X.g=z.color.g,X.b=z.color.b,X.a=z.colorMix,M=z.emissionStrength,p*=z.opacity),{u_matrix:l,u_lighting_matrix:t,u_normal_matrix:o,u_node_matrix:c||Xs,u_lightpos:G,u_lightintensity:N.properties.get("intensity"),u_lightcolor:[Q.r,Q.g,Q.b],u_camera_pos:C,u_opacity:p,u_baseTextureIsAlpha:0,u_alphaMask:+ie,u_alphaCutoff:S.alphaCutoff,u_baseColorFactor:m.toNonPremultipliedRenderColor(null).toArray01(),u_emissiveFactor:y.toNonPremultipliedRenderColor(null).toArray01(),u_metallicFactor:x,u_roughnessFactor:T,u_baseColorTexture:5,u_metallicRoughnessTexture:6,u_normalTexture:7,u_occlusionTexture:8,u_emissionTexture:9,u_lutTexture:10,u_color_mix:X.toArray01(),u_aoIntensity:te,u_emissive_strength:M,u_occlusionTextureTransform:L||[0,0,0,0]}},Dl=(l,t=Xs,o=Xs)=>({u_matrix:l,u_instance:t,u_node_matrix:o}),Hc={fillExtrusion:l=>({u_matrix:new s.cl(l),u_lightpos:new s.ci(l),u_lightintensity:new s.cj(l),u_lightcolor:new s.ci(l),u_vertical_gradient:new s.cj(l),u_opacity:new s.cj(l),u_edge_radius:new s.cj(l),u_width_scale:new s.cj(l),u_ao:new s.ck(l),u_height_type:new s.ch(l),u_base_type:new s.ch(l),u_tile_id:new s.ci(l),u_zoom_transition:new s.cj(l),u_inv_rot_matrix:new s.cl(l),u_merc_center:new s.ck(l),u_up_dir:new s.ci(l),u_height_lift:new s.cj(l),u_flood_light_color:new s.ci(l),u_vertical_scale:new s.cj(l),u_flood_light_intensity:new s.cj(l),u_ground_shadow_factor:new s.ci(l)}),fillExtrusionDepth:l=>({u_matrix:new s.cl(l),u_edge_radius:new s.cj(l),u_width_scale:new s.cj(l),u_vertical_scale:new s.cj(l),u_height_type:new s.ch(l),u_base_type:new s.ch(l)}),fillExtrusionPattern:l=>({u_matrix:new s.cl(l),u_lightpos:new s.ci(l),u_lightintensity:new s.cj(l),u_lightcolor:new s.ci(l),u_vertical_gradient:new s.cj(l),u_height_factor:new s.cj(l),u_edge_radius:new s.cj(l),u_width_scale:new s.cj(l),u_ao:new s.ck(l),u_height_type:new s.ch(l),u_base_type:new s.ch(l),u_tile_id:new s.ci(l),u_zoom_transition:new s.cj(l),u_inv_rot_matrix:new s.cl(l),u_merc_center:new s.ck(l),u_up_dir:new s.ci(l),u_height_lift:new s.cj(l),u_image:new s.ch(l),u_texsize:new s.ck(l),u_pixel_coord_upper:new s.ck(l),u_pixel_coord_lower:new s.ck(l),u_tile_units_to_pixels:new s.cj(l),u_opacity:new s.cj(l),u_pattern_transition:new s.cj(l)}),fillExtrusionGroundEffect:l=>({u_matrix:new s.cl(l),u_opacity:new s.cj(l),u_ao_pass:new s.cj(l),u_meter_to_tile:new s.cj(l),u_ao:new s.ck(l),u_flood_light_intensity:new s.cj(l),u_flood_light_color:new s.ci(l),u_attenuation:new s.cj(l),u_edge_radius:new s.cj(l),u_fb:new s.ch(l),u_fb_size:new s.cj(l),u_dynamic_offset:new s.cj(l)}),fill:l=>({u_matrix:new s.cl(l),u_emissive_strength:new s.cj(l),u_ground_shadow_factor:new s.ci(l)}),fillPattern:l=>({u_matrix:new s.cl(l),u_emissive_strength:new s.cj(l),u_image:new s.ch(l),u_texsize:new s.ck(l),u_pixel_coord_upper:new s.ck(l),u_pixel_coord_lower:new s.ck(l),u_tile_units_to_pixels:new s.cj(l),u_ground_shadow_factor:new s.ci(l),u_pattern_transition:new s.cj(l)}),fillOutline:l=>({u_matrix:new s.cl(l),u_emissive_strength:new s.cj(l),u_world:new s.ck(l),u_ground_shadow_factor:new s.ci(l)}),fillOutlinePattern:l=>({u_matrix:new s.cl(l),u_emissive_strength:new s.cj(l),u_world:new s.ck(l),u_image:new s.ch(l),u_texsize:new s.ck(l),u_pixel_coord_upper:new s.ck(l),u_pixel_coord_lower:new s.ck(l),u_tile_units_to_pixels:new s.cj(l),u_ground_shadow_factor:new s.ci(l),u_pattern_transition:new s.cj(l)}),building:l=>({u_matrix:new s.cl(l),u_normal_matrix:new s.cl(l),u_opacity:new s.cj(l),u_faux_facade_ao_intensity:new s.cj(l),u_camera_pos:new s.ci(l),u_tile_to_meter:new s.cj(l),u_facade_emissive_chance:new s.cj(l),u_flood_light_color:new s.ci(l),u_flood_light_intensity:new s.cj(l)}),buildingBloom:l=>({u_matrix:new s.cl(l)}),buildingDepth:l=>({u_matrix:new s.cl(l)}),elevatedStructuresDepth:l=>({u_matrix:new s.cl(l),u_depth_bias:new s.cj(l)}),elevatedStructures:l=>({u_matrix:new s.cl(l),u_ground_shadow_factor:new s.ci(l)}),elevatedStructuresDepthReconstruct:l=>({u_matrix:new s.cl(l),u_camera_pos:new s.ci(l),u_depth_bias:new s.cj(l),u_height_scale:new s.cj(l),u_reset_depth:new s.cj(l)}),circle:s.dY,collisionBox:l=>({u_matrix:new s.cl(l),u_inv_rot_matrix:new s.cl(l),u_camera_to_center_distance:new s.cj(l),u_extrude_scale:new s.ck(l),u_zoom_transition:new s.cj(l),u_merc_center:new s.ck(l),u_tile_id:new s.ci(l)}),collisionCircle:l=>({u_matrix:new s.cl(l),u_inv_matrix:new s.cl(l),u_camera_to_center_distance:new s.cj(l),u_viewport_size:new s.ck(l)}),debug:l=>({u_color:new s.dB(l),u_matrix:new s.cl(l),u_overlay:new s.ch(l),u_overlay_scale:new s.cj(l)}),clippingMask:l=>({u_matrix:new s.cl(l)}),heatmap:l=>({u_extrude_scale:new s.cj(l),u_intensity:new s.cj(l),u_matrix:new s.cl(l),u_inv_rot_matrix:new s.cl(l),u_merc_center:new s.ck(l),u_tile_id:new s.ci(l),u_zoom_transition:new s.cj(l),u_up_dir:new s.ci(l)}),heatmapTexture:l=>({u_image:new s.ch(l),u_color_ramp:new s.ch(l),u_opacity:new s.cj(l)}),hillshade:l=>({u_matrix:new s.cl(l),u_image:new s.ch(l),u_latrange:new s.ck(l),u_light:new s.ck(l),u_shadow:new s.dB(l),u_highlight:new s.dB(l),u_emissive_strength:new s.cj(l),u_accent:new s.dB(l)}),hillshadePrepare:l=>({u_matrix:new s.cl(l),u_image:new s.ch(l),u_dimension:new s.ck(l),u_zoom:new s.cj(l)}),line:s.dX,linePattern:s.dW,raster:l=>({u_matrix:new s.cl(l),u_normalize_matrix:new s.cl(l),u_globe_matrix:new s.cl(l),u_merc_matrix:new s.cl(l),u_grid_matrix:new s.dC(l),u_tl_parent:new s.ck(l),u_scale_parent:new s.cj(l),u_fade_t:new s.cj(l),u_opacity:new s.cj(l),u_image0:new s.ch(l),u_image1:new s.ch(l),u_brightness_low:new s.cj(l),u_brightness_high:new s.cj(l),u_saturation_factor:new s.cj(l),u_contrast_factor:new s.cj(l),u_spin_weights:new s.ci(l),u_perspective_transform:new s.ck(l),u_raster_elevation:new s.cj(l),u_zoom_transition:new s.cj(l),u_merc_center:new s.ck(l),u_cutoff_params:new s.d3(l),u_colorization_mix:new s.d3(l),u_colorization_offset:new s.cj(l),u_color_ramp:new s.ch(l),u_texture_offset:new s.ck(l),u_texture_res:new s.ck(l),u_emissive_strength:new s.cj(l)}),rasterParticle:l=>({u_matrix:new s.cl(l),u_normalize_matrix:new s.cl(l),u_globe_matrix:new s.cl(l),u_merc_matrix:new s.cl(l),u_grid_matrix:new s.dC(l),u_tl_parent:new s.ck(l),u_scale_parent:new s.cj(l),u_fade_t:new s.cj(l),u_opacity:new s.cj(l),u_image0:new s.ch(l),u_image1:new s.ch(l),u_raster_elevation:new s.cj(l),u_zoom_transition:new s.cj(l),u_merc_center:new s.ck(l),u_cutoff_params:new s.d3(l)}),rasterParticleTexture:l=>({u_texture:new s.ch(l),u_opacity:new s.cj(l)}),rasterParticleDraw:l=>({u_particle_texture:new s.ch(l),u_particle_texture_side_len:new s.cj(l),u_tile_offset:new s.ck(l),u_velocity:new s.ch(l),u_color_ramp:new s.ch(l),u_velocity_res:new s.ck(l),u_max_speed:new s.cj(l),u_uv_offset:new s.ck(l),u_data_scale:new s.ck(l),u_data_offset:new s.cj(l),u_particle_pos_scale:new s.cj(l),u_particle_pos_offset:new s.ck(l)}),rasterParticleUpdate:l=>({u_particle_texture:new s.ch(l),u_particle_texture_side_len:new s.cj(l),u_velocity:new s.ch(l),u_velocity_res:new s.ck(l),u_max_speed:new s.cj(l),u_speed_factor:new s.cj(l),u_reset_rate:new s.cj(l),u_rand_seed:new s.cj(l),u_uv_offset:new s.ck(l),u_data_scale:new s.ck(l),u_data_offset:new s.cj(l),u_particle_pos_scale:new s.cj(l),u_particle_pos_offset:new s.ck(l)}),symbol:l=>({u_is_size_zoom_constant:new s.ch(l),u_is_size_feature_constant:new s.ch(l),u_size_t:new s.cj(l),u_size:new s.cj(l),u_camera_to_center_distance:new s.cj(l),u_rotate_symbol:new s.ch(l),u_aspect_ratio:new s.cj(l),u_fade_change:new s.cj(l),u_matrix:new s.cl(l),u_label_plane_matrix:new s.cl(l),u_coord_matrix:new s.cl(l),u_is_text:new s.ch(l),u_elevation_from_sea:new s.ch(l),u_pitch_with_map:new s.ch(l),u_texsize:new s.ck(l),u_texsize_icon:new s.ck(l),u_texture:new s.ch(l),u_texture_icon:new s.ch(l),u_gamma_scale:new s.cj(l),u_device_pixel_ratio:new s.cj(l),u_tile_id:new s.ci(l),u_zoom_transition:new s.cj(l),u_inv_rot_matrix:new s.cl(l),u_merc_center:new s.ck(l),u_camera_forward:new s.ci(l),u_tile_matrix:new s.cl(l),u_up_vector:new s.ci(l),u_ecef_origin:new s.ci(l),u_is_halo:new s.ch(l),u_icon_transition:new s.cj(l),u_color_adj_mat:new s.cl(l),u_scale_factor:new s.cj(l),u_ground_shadow_factor:new s.ci(l),u_inv_matrix:new s.cl(l),u_normal_scale:new s.cj(l),u_lutTexture:new s.ch(l)}),background:l=>({u_matrix:new s.cl(l),u_emissive_strength:new s.cj(l),u_opacity:new s.cj(l),u_color:new s.dB(l)}),backgroundPattern:l=>({u_matrix:new s.cl(l),u_emissive_strength:new s.cj(l),u_opacity:new s.cj(l),u_image:new s.ch(l),u_pattern_tl:new s.ck(l),u_pattern_br:new s.ck(l),u_texsize:new s.ck(l),u_pattern_size:new s.ck(l),u_pixel_coord_upper:new s.ck(l),u_pixel_coord_lower:new s.ck(l),u_pattern_units_to_pixels:new s.ck(l)}),terrainRaster:l=>({u_matrix:new s.cl(l),u_image0:new s.ch(l),u_image1:new s.ch(l),u_skirt_height:new s.cj(l),u_ground_shadow_factor:new s.ci(l),u_emissive_texture_available:new s.cj(l)}),skybox:l=>({u_matrix:new s.cl(l),u_sun_direction:new s.ci(l),u_cubemap:new s.ch(l),u_opacity:new s.cj(l),u_temporal_offset:new s.cj(l)}),skyboxGradient:l=>({u_matrix:new s.cl(l),u_color_ramp:new s.ch(l),u_center_direction:new s.ci(l),u_radius:new s.cj(l),u_opacity:new s.cj(l),u_temporal_offset:new s.cj(l)}),skyboxCapture:l=>({u_matrix_3f:new s.dC(l),u_sun_direction:new s.ci(l),u_sun_intensity:new s.cj(l),u_color_tint_r:new s.d3(l),u_color_tint_m:new s.d3(l),u_luminance:new s.cj(l)}),globeRaster:l=>({u_proj_matrix:new s.cl(l),u_globe_matrix:new s.cl(l),u_normalize_matrix:new s.cl(l),u_merc_matrix:new s.cl(l),u_zoom_transition:new s.cj(l),u_merc_center:new s.ck(l),u_image0:new s.ch(l),u_image1:new s.ch(l),u_grid_matrix:new s.dC(l),u_skirt_height:new s.cj(l),u_far_z_cutoff:new s.cj(l),u_frustum_tl:new s.ci(l),u_frustum_tr:new s.ci(l),u_frustum_br:new s.ci(l),u_frustum_bl:new s.ci(l),u_globe_pos:new s.ci(l),u_globe_radius:new s.cj(l),u_viewport:new s.ck(l),u_emissive_texture_available:new s.cj(l)}),globeAtmosphere:l=>({u_frustum_tl:new s.ci(l),u_frustum_tr:new s.ci(l),u_frustum_br:new s.ci(l),u_frustum_bl:new s.ci(l),u_horizon:new s.cj(l),u_transition:new s.cj(l),u_fadeout_range:new s.cj(l),u_atmosphere_fog_color:new s.d3(l),u_high_color:new s.d3(l),u_space_color:new s.d3(l),u_temporal_offset:new s.cj(l),u_horizon_angle:new s.cj(l)}),model:l=>({u_matrix:new s.cl(l),u_lighting_matrix:new s.cl(l),u_normal_matrix:new s.cl(l),u_node_matrix:new s.cl(l),u_lightpos:new s.ci(l),u_lightintensity:new s.cj(l),u_lightcolor:new s.ci(l),u_camera_pos:new s.ci(l),u_opacity:new s.cj(l),u_baseColorFactor:new s.d3(l),u_emissiveFactor:new s.d3(l),u_metallicFactor:new s.cj(l),u_roughnessFactor:new s.cj(l),u_baseTextureIsAlpha:new s.ch(l),u_alphaMask:new s.ch(l),u_alphaCutoff:new s.cj(l),u_baseColorTexture:new s.ch(l),u_metallicRoughnessTexture:new s.ch(l),u_normalTexture:new s.ch(l),u_occlusionTexture:new s.ch(l),u_emissionTexture:new s.ch(l),u_lutTexture:new s.ch(l),u_color_mix:new s.d3(l),u_aoIntensity:new s.cj(l),u_emissive_strength:new s.cj(l),u_occlusionTextureTransform:new s.d3(l)}),modelDepth:l=>({u_matrix:new s.cl(l),u_instance:new s.cl(l),u_node_matrix:new s.cl(l)}),groundShadow:l=>({u_matrix:new s.cl(l),u_ground_shadow_factor:new s.ci(l)}),stars:l=>({u_matrix:new s.cl(l),u_up:new s.ci(l),u_right:new s.ci(l),u_intensity_multiplier:new s.cj(l)}),snowParticle:l=>({u_modelview:new s.cl(l),u_projection:new s.cl(l),u_time:new s.cj(l),u_cam_pos:new s.ci(l),u_velocityConeAperture:new s.cj(l),u_velocity:new s.cj(l),u_horizontalOscillationRadius:new s.cj(l),u_horizontalOscillationRate:new s.cj(l),u_boxSize:new s.cj(l),u_billboardSize:new s.cj(l),u_simpleShapeParameters:new s.ck(l),u_screenSize:new s.ck(l),u_thinningCenterPos:new s.ck(l),u_thinningShape:new s.ci(l),u_thinningAffectedRatio:new s.cj(l),u_thinningParticleOffset:new s.cj(l),u_particleColor:new s.d3(l),u_direction:new s.ci(l)}),rainParticle:l=>({u_modelview:new s.cl(l),u_projection:new s.cl(l),u_time:new s.cj(l),u_cam_pos:new s.ci(l),u_texScreen:new s.ch(l),u_velocityConeAperture:new s.cj(l),u_velocity:new s.cj(l),u_boxSize:new s.cj(l),u_rainDropletSize:new s.ck(l),u_distortionStrength:new s.cj(l),u_rainDirection:new s.ci(l),u_color:new s.d3(l),u_screenSize:new s.ck(l),u_thinningCenterPos:new s.ck(l),u_thinningShape:new s.ci(l),u_thinningAffectedRatio:new s.cj(l),u_thinningParticleOffset:new s.cj(l),u_shapeDirectionalPower:new s.cj(l),u_shapeNormalPower:new s.cj(l),u_mode:new s.cj(l)}),vignette:l=>({u_vignetteShape:new s.ci(l),u_vignetteColor:new s.d3(l)}),occlusion:l=>({u_matrix:new s.cl(l),u_anchorPos:new s.ci(l),u_screenSizePx:new s.ck(l),u_occluderSizePx:new s.ck(l),u_color:new s.d3(l)})};class xo{constructor(t,o,c,d){this.id=xo.uniqueIdxCounter,xo.uniqueIdxCounter++,this.context=t;const p=t.gl;this.buffer=p.createBuffer(),this.dynamicDraw=!!c,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),p.bufferData(p.ELEMENT_ARRAY_BUFFER,o.arrayBuffer,this.dynamicDraw?p.DYNAMIC_DRAW:p.STATIC_DRAW),this.dynamicDraw||d||o.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){this.id=xo.uniqueIdxCounter,xo.uniqueIdxCounter++;const o=this.context.gl;this.context.unbindVAO(),this.bind(),o.bufferSubData(o.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}xo.uniqueIdxCounter=0;const zf={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class jm{constructor(t,o,c,d,p,m){this.length=o.length,this.attributes=c,this.itemSize=o.bytesPerElement,this.dynamicDraw=d,this.instanceCount=m,this.context=t;const y=t.gl;this.buffer=y.createBuffer(),t.bindVertexBuffer.set(this.buffer),y.bufferData(y.ARRAY_BUFFER,o.arrayBuffer,this.dynamicDraw?y.DYNAMIC_DRAW:y.STATIC_DRAW),this.dynamicDraw||p||o.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){const o=this.context.gl;this.bind(),o.bufferSubData(o.ARRAY_BUFFER,0,t.arrayBuffer)}
vendor: 19,327 bytes, line 2997
2997enableAttributes(t,o){for(let c=0;c<this.attributes.length;c++){const d=o.getAttributeLocation(t,this.attributes[c].name);d!==-1&&t.enableVertexAttribArray(d)}}setVertexAttribPointers(t,o,c){for(let d=0;d<this.attributes.length;d++){const p=this.attributes[d],m=o.getAttributeLocation(t,p.name);m!==-1&&t.vertexAttribPointer(m,p.components,t[zf[p.type]],!1,this.itemSize,p.offset+this.itemSize*(c||0))}}setVertexAttribDivisor(t,o,c){for(let d=0;d<this.attributes.length;d++){const p=o.getAttributeLocation(t,this.attributes[d].name);p!==-1&&this.instanceCount&&this.instanceCount>0&&t.vertexAttribDivisor(p,c)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Ys{constructor(t,o,c,d,p){this.context=t,this.width=o,this.height=c;const m=this.framebuffer=t.gl.createFramebuffer();d>0&&(this.colorAttachment0=new Dc(t,m,0)),d>1&&(this.colorAttachment1=new Dc(t,m,1)),p&&(this.depthAttachmentType=p,this.depthAttachment=p==="renderbuffer"?new Ma(t,m):new Il(t,m))}createColorAttachment(t,o){o===0?this.colorAttachment0=new Dc(t,this.framebuffer,0):o===1&&(this.colorAttachment1=new Dc(t,this.framebuffer,1))}removeColorAttachment(t,o){const c=this.context.gl;let d;o===0?(d=this.colorAttachment0.get(),this.colorAttachment0=void 0):o===1&&(d=this.colorAttachment1.get(),this.colorAttachment1=void 0),d&&c.deleteTexture(d)}destroy(){const t=this.context.gl;if(this.colorAttachment0){const o=this.colorAttachment0.get();o&&t.deleteTexture(o)}if(this.colorAttachment1){const o=this.colorAttachment1.get();o&&t.deleteTexture(o)}if(this.depthAttachment&&this.depthAttachmentType)if(this.depthAttachmentType==="renderbuffer"){const o=this.depthAttachment.get();o&&t.deleteRenderbuffer(o)}else{const o=this.depthAttachment.get();o&&t.deleteTexture(o)}t.deleteFramebuffer(this.framebuffer)}}class $c{constructor(t,o){this.gl=t,this.clearColor=new Dm(this),this.clearDepth=new pf(this),this.clearStencil=new nh(this),this.colorMask=new Mc(this),this.depthMask=new oh(this),this.stencilMask=new $s(this),this.stencilFunc=new Sa(this),this.stencilOp=new Sl(this),this.stencilTest=new Ea(this),this.depthRange=new mf(this),this.depthTest=new sh(this),this.depthFunc=new _f(this),this.blend=new Ia(this),this.blendFunc=new Cc(this),this.blendColor=new Pc(this),this.blendEquation=new ah(this),this.cullFace=new Rc(this),this.cullFaceSide=new El(this),this.frontFace=new gf(this),this.program=new yf(this),this.activeTexture=new xf(this),this.viewport=new Aa(this),this.bindFramebuffer=new vf(this),this.bindRenderbuffer=new Lm(this),this.bindTexture=new Fm(this),this.bindVertexBuffer=new Om(this),this.bindElementBuffer=new lh(this),this.bindVertexArrayOES=new ch(this),this.pixelStoreUnpack=new uh(this),this.pixelStoreUnpackPremultiplyAlpha=new hh(this),this.pixelStoreUnpackFlipY=new bf(this),this.options=o?Object.assign({},o):{},this.options.extTextureFilterAnisotropicForceOff||(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.extDebugRendererInfo=t.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=t.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=t.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.forceManualRenderingForInstanceIDShaders=o&&!!o.forceManualRenderingForInstanceIDShaders||this.renderer&&this.renderer.indexOf("PowerVR")!==-1,this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=t.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=t.getExtension("EXT_color_buffer_half_float"),this.extTimerQuery=t.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),this.extBlendFuncExtended=t.getExtension("WEBGL_blend_func_extended")}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.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,o,c){return new xo(this,t,o,c)}createVertexBuffer(t,o,c,d,p){return new jm(this,t,o,c,d,p)}createRenderbuffer(t,o,c){const d=this.gl,p=d.createRenderbuffer();return this.bindRenderbuffer.set(p),d.renderbufferStorage(d.RENDERBUFFER,t,o,c),this.bindRenderbuffer.set(null),p}createFramebuffer(t,o,c,d){return new Ys(this,t,o,c,d)}clear({color:t,depth:o,stencil:c,colorMask:d}){const p=this.gl;let m=0;t&&(m|=p.COLOR_BUFFER_BIT,this.clearColor.set(t.toNonPremultipliedRenderColor(null)),this.colorMask.set(d||[!0,!0,!0,!0])),o!==void 0&&(m|=p.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(o),this.depthMask.set(!0)),c!==void 0&&(m|=p.STENCIL_BUFFER_BIT,this.clearStencil.set(c),this.stencilMask.set(255)),p.clear(m)}setCullFace(t){t.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){s.by(t.blendFunction,Et.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor),t.blendEquation?this.blendEquation.set(t.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(t.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}let nt;function Th(l,t,o,c,d,p,m){const y=l.context,x=y.gl,T=l.transform,S=[s.aF(T.center.lng),s.aJ(T.center.lat)],M=o.layout.get("symbol-placement"),A=o.layout.get("text-variable-anchor"),C=o.layout.get("icon-rotation-alignment")==="map",L=o.layout.get("text-rotation-alignment")==="map",z=M!=="point",O=[];let N=0,q=0;for(let X=0;X<c.length;X++){const Z=c[X],ne=t.getTile(Z),ce=ne.getBucket(o);if(!ce)continue;const de=ce.getProjection().createInversionMatrix(T,Z.canonical),ve=[],ge=wm(Z,ce,T),Me=!m&&C&&z,Fe=m&&L&&z,pe=A&&ce.hasTextData(),oe=ce.hasIconTextFit()&&pe&&ce.hasIconData(),Ie=Me||Fe||m&&pe||oe,be=ce.projection.name==="globe",ke=be?s.aj(T.zoom):0;be&&(ve.push("PROJECTION_GLOBE_VIEW"),Ie&&ve.push("PROJECTED_POS_ON_VIEWPORT"));const Ue=l.getOrCreateProgram("collisionBox",{defines:ve});let Ke=ge;d[0]===0&&d[1]===0||(Ke=l.translatePosMatrix(ge,ne,d,p));const je=m?ce.textCollisionBox:ce.iconCollisionBox,He=ce.collisionCircleArray;if(He.length>0){const st=s.bC(),et=Ke;s.cP(st,ce.placementInvProjMatrix,T.glCoordMatrix),s.cP(st,st,ce.placementViewportMatrix),O.push({circleArray:He,circleOffset:q,transform:et,invTransform:st,projection:ce.getProjection()}),N+=He.length/4,q=N}if(!je)continue;l.terrain&&l.terrain.setupElevationDraw(ne,Ue);const lt=be?[Z.canonical.x,Z.canonical.y,1<<Z.canonical.z]:[0,0,0];Ue.draw(l,x.LINES,ut.disabled,vt.disabled,l.colorModeForRenderPass(),gt.disabled,xh(Ke,de,T,ke,S,ne,lt,ce.getProjection()),o.id,je.layoutVertexBuffer,je.indexBuffer,je.segments,null,T.zoom,null,[je.collisionVertexBuffer,je.collisionVertexBufferExt])}if(!m||!O.length)return;const G=l.getOrCreateProgram("collisionCircle"),j=new s.dZ;j.resize(4*N),j._trim();let ie=0;for(const X of O)for(let Z=0;Z<X.circleArray.length/4;Z++){const ne=4*Z,ce=X.circleArray[ne+0],de=X.circleArray[ne+1],ve=X.circleArray[ne+2],ge=X.circleArray[ne+3];j.emplace(ie++,ce,de,ve,ge,0),j.emplace(ie++,ce,de,ve,ge,1),j.emplace(ie++,ce,de,ve,ge,2),j.emplace(ie++,ce,de,ve,ge,3)}(!nt||nt.length<2*N)&&(nt=(function(X){const Z=2*X,ne=new s.b0;ne.resize(Z),ne._trim();for(let ce=0;ce<Z;ce++){const de=6*ce;ne.uint16[de+0]=4*ce+0,ne.uint16[de+1]=4*ce+1,ne.uint16[de+2]=4*ce+2,ne.uint16[de+3]=4*ce+2,ne.uint16[de+4]=4*ce+3,ne.uint16[de+5]=4*ce+0}return ne})(N));const Q=y.createIndexBuffer(nt,!0),te=y.createVertexBuffer(j,s.d_.members,!0);for(const X of O){const Z=Uc(X.transform,X.invTransform,T,X.projection);G.draw(l,x.TRIANGLES,ut.disabled,vt.disabled,l.colorModeForRenderPass(),gt.disabled,Z,o.id,te,Q,s.bg.simpleSegment(0,2*X.circleOffset,X.circleArray.length,X.circleArray.length/2),null,T.zoom)}te.destroy(),Q.destroy()}const no=s.bC();function Ho(l){const t=l._camera.getWorldToCamera(l.worldSize,1),o=s.aB([],t,l.globeMatrix);s.bl(o,o);const c=[0,0,0],d=[0,1,0,0];return s.aC(d,d,o),c[0]=d[0],c[1]=d[1],c[2]=d[2],s.aw(c,c),c}function Df({width:l,height:t,anchor:o,textOffset:c,textScale:d},p){const{horizontalAlign:m,verticalAlign:y}=s.c1(o),x=-(m-.5)*l,T=-(y-.5)*t,S=s.c2(o,c);return new s.P((x/d+S[0])*p,(T/d+S[1])*p)}function Lf(l,t,o,c,d,p,m,y,x,T){const S=l.text.placedSymbolArray,M=l.text.dynamicLayoutVertexArray,A=l.icon.dynamicLayoutVertexArray,C={},L=l.getProjection(),z=ga(m,L,d),O=d.elevation,N=L.upVectorScale(m.canonical,d.center.lat,d.worldSize).metersToTile;M.clear();for(let q=0;q<S.length;q++){const G=S.get(q),{tileAnchorX:j,tileAnchorY:ie,numGlyphs:Q}=G,te=G.hidden||!G.crossTileID||l.allowVerticalPlacement&&!G.placedOrientation?null:c[G.crossTileID];if(te){let X=0,Z=0,ne=0;const ce=l.elevationType==="road";if(O||ce){const be=ce?l.getElevationFeatureForText(q):null,ke=s.bV.getAtTileOffset(m,new s.P(j,ie),O,be),[Ue,Ke,je]=L.upVector(m.canonical,j,ie);X=ke*Ue*N,Z=ke*Ke*N,ne=ke*je*N}let[de,ve,ge,Me]=Zn(G.projectedAnchorX+X,G.projectedAnchorY+Z,G.projectedAnchorZ+ne,o?z:p);const Fe=mc(d.getCameraToCenterDistance(L),Me);let pe=s.bM(l.textSizeData,x,G)*Fe/s.bY;o&&(pe*=l.tilePixelRatio/y);const oe=Df(te,pe);o?({x:de,y:ve,z:ge}=L.projectTilePoint(j+oe.x,ie+oe.y,m.canonical),[de,ve,ge]=Zn(de+X,ve+Z,ge+ne,p)):(t&&oe._rotate(-d.angle),de+=oe.x,ve+=oe.y,ge=0);const Ie=l.allowVerticalPlacement&&G.placedOrientation===s.bL.vertical?Math.PI/2:0;for(let be=0;be<Q;be++)s.bO(M,de,ve,ge,Ie);T&&G.associatedIconIndex>=0&&(C[G.associatedIconIndex]={x:de,y:ve,z:ge,angle:Ie})}else Xr(Q,M)}if(T){A.clear();const q=l.icon.placedSymbolArray;for(let G=0;G<q.length;G++){const j=q.get(G),{numGlyphs:ie}=j,Q=C[G];if(j.hidden||!Q)Xr(ie,A);else{const{x:te,y:X,z:Z,angle:ne}=Q;for(let ce=0;ce<ie;ce++)s.bO(A,te,X,Z,ne)}}l.icon.dynamicLayoutVertexBuffer.updateData(A)}l.text.dynamicLayoutVertexBuffer.updateData(M)}function Zc(l,t,o,c,d,p,m={}){const y=o.paint.get("icon-translate"),x=o.paint.get("text-translate"),T=o.paint.get("icon-translate-anchor"),S=o.paint.get("text-translate-anchor"),M=o.layout.get("icon-rotation-alignment"),A=o.layout.get("text-rotation-alignment"),C=o.layout.get("icon-pitch-alignment"),L=o.layout.get("text-pitch-alignment"),z=o.layout.get("icon-keep-upright"),O=o.layout.get("text-keep-upright"),N=o.paint.get("icon-color-saturation"),q=o.paint.get("icon-color-contrast"),G=o.paint.get("icon-color-brightness-min"),j=o.paint.get("icon-color-brightness-max"),ie=o.layout.get("symbol-elevation-reference")==="sea",Q=o.layout.get("icon-image-use-theme")==="none",te=l.context,X=te.gl,Z=l.transform,ne=M==="map",ce=A==="map",de=C==="map",ve=L==="map",ge=o.layout.get("symbol-sort-key").constantOr(1)!==void 0;let Me=!1;const Fe=l.depthModeForSublayer(0,ut.ReadOnly),pe=new ut(l.context.gl.LEQUAL,ut.ReadOnly,l.depthRangeFor3D),oe=[s.aF(Z.center.lng),s.aJ(Z.center.lat)],Ie=o.layout.get("text-variable-anchor"),be=Z.projection.name==="globe",ke=[],Ue=[0,-1,0];for(const Ke of c){const je=t.getTile(Ke),He=je.getBucket(o);if(!He||He.projection.name==="mercator"&&be||He.fullyClipped)continue;const lt=He.projection.name==="globe",st=lt?s.aj(Z.zoom):0,et=ga(Ke,He.getProjection(),Z),ot=Z.calculatePixelsToTileUnitsMatrix(je),dt=Ie&&He.hasTextData(),yt=He.hasIconTextFit()&&dt&&He.hasIconData(),Pt=He.getProjection().createInversionMatrix(Z,Ke.canonical),Vt=(1<<je.tileID.canonical.z)*s.al/l.transform.worldSize,St=Qt=>{let kt=[0,0,0];if(Qt){const Ct=l.style.directionalLight,pi=l.style.ambientLight;Ct&&pi&&(kt=Xn(l.style,Ct,pi))}return kt},Zt=Qt=>{Z.depthOcclusionForSymbolsAndCircles&&(o.hasOcclusionOpacityProperties||l.terrain)&&(Qt.push("DEPTH_D24"),Qt.push("DEPTH_OCCLUSION"))},It=Qt=>{o.lut&&!Q&&(o.lut.texture||(o.lut.texture=new s.d$(l.context,o.lut.image,[o.lut.image.height,o.lut.image.height,o.lut.image.height],te.gl.RGBA8)),te.activeTexture.set(te.gl.TEXTURE0+10),o.lut.texture&&o.lut.texture.bind(te.gl.LINEAR,te.gl.CLAMP_TO_EDGE),Qt.push("APPLY_LUT_ON_GPU"))},si=()=>{const Qt=ne&&o.layout.get("symbol-placement")!=="point",kt=[];Zt(kt),It(kt);const Ct=Qt||yt,pi=He.elevationType==="road",Ni=l.shadowRenderer,gi=pi&&de&&!!Ni&&Ni.enabled,bi=St(gi),en=pi&&de&&!l.terrain?pe:Fe,mn=o.paint.get("icon-image-cross-fade");l.terrainRenderModeElevated()&&de&&kt.push("PITCH_WITH_MAP_TERRAIN"),lt&&(kt.push("PROJECTION_GLOBE_VIEW"),Ct&&kt.push("PROJECTED_POS_ON_VIEWPORT")),mn>0&&He.hasAnySecondaryIcon&&kt.push("ICON_TRANSITION"),!He.icon.zOffsetVertexBuffer||pi&&l.terrain||kt.push("Z_OFFSET"),N===0&&q===0&&G===0&&j===1||kt.push("COLOR_ADJUSTMENT"),He.sdfIcons&&kt.push("RENDER_SDF"),gi&&kt.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),pi&&de&&!l.terrain&&He.icon.orientationVertexBuffer&&kt.push("ELEVATED_ROADS");const xr=He.icon.programConfigurations.get(o.id),ei=l.getOrCreateProgram("symbol",{config:xr,defines:kt}),wn=je.imageAtlasTexture?je.imageAtlasTexture.size:[0,0],Dr=He.iconSizeData,tn=s.bK(Dr,Z.zoom),Kn=de||!Z.isOrthographic,rn=Us(et,je.tileID.canonical,de,ne,Z,He.getProjection(),ot),Di=cn(et,je.tileID.canonical,de,ne,Z,He.getProjection(),ot),Ki=l.translatePosMatrix(Di,je,y,T,!0),yi=l.translatePosMatrix(et,je,y,T),rr=Ct?no:rn,kr=ne&&!de&&!Qt;let $i=Ue;!be&&!Z.mercatorFromTransition||ne||($i=Ho(Z));const Tn=lt?$i:Ue,Xl=o.getColorAdjustmentMatrix(N,q,G,j),To=Rl(Dr.kind,tn,kr,de,l,yi,rr,Ki,ie,!1,wn,[0,0],0,Ke,st,oe,Pt,Tn,He.getProjection(),bi,Vt,Xl,mn,null),Ga=je.imageAtlasTexture?je.imageAtlasTexture:null,qa=o.layout.get("icon-size").constantOr(0)!==1||He.iconsNeedLinear,Sn=He.sdfIcons||l.options.rotating||l.options.zooming||qa||Kn?X.LINEAR:X.NEAREST,So=He.sdfIcons&&o.paint.get("icon-halo-width").constantOr(1)!==0,Eo=l.terrain&&de&&Qt?s.bl(s.bC(),rn):no;if(Qt&&He.icon){const Nn=s.bV.getAtTileOffsetFunc(Ke,Z.center.lat,Z.worldSize,He.getProjection()),Wo=Uo(et,je.tileID.canonical,de,ne,Z,He.getProjection(),ot),ta=o.layout.get("icon-size-scale-range"),au=s.aA(l.scaleFactor,ta[0],ta[1]);ii(He,et,l,!1,Wo,Di,de,z,Nn,Ke,au)}return{program:ei,buffers:He.icon,uniformValues:To,atlasTexture:Ga,atlasTextureIcon:null,atlasInterpolation:Sn,atlasInterpolationIcon:null,isSDF:He.sdfIcons,hasHalo:So,depthMode:en,tile:je,renderWithShadows:gi,labelPlaneMatrixInv:Eo}},ri=()=>{const Qt=ce&&o.layout.get("symbol-placement")!=="point",kt=[],Ct=Qt||Ie||yt,pi=He.elevationType==="road",Ni=l.shadowRenderer,gi=pi&&ve&&!!Ni&&Ni.enabled,bi=St(gi),en=pi&&ve&&!l.terrain?pe:Fe;l.terrainRenderModeElevated()&&ve&&kt.push("PITCH_WITH_MAP_TERRAIN"),lt&&(kt.push("PROJECTION_GLOBE_VIEW"),Ct&&kt.push("PROJECTED_POS_ON_VIEWPORT")),!He.text.zOffsetVertexBuffer||pi&&l.terrain||kt.push("Z_OFFSET"),He.iconsInText&&kt.push("RENDER_TEXT_AND_SYMBOL"),kt.push("RENDER_SDF"),gi&&kt.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),pi&&ve&&!l.terrain&&He.text.orientationVertexBuffer&&kt.push("ELEVATED_ROADS"),Zt(kt);const mn=He.text.programConfigurations.get(o.id),xr=l.getOrCreateProgram("symbol",{config:mn,defines:kt});let ei,wn=[0,0],Dr=null;const tn=He.textSizeData;He.iconsInText&&(wn=je.imageAtlasTexture?je.imageAtlasTexture.size:[0,0],Dr=je.imageAtlasTexture?je.imageAtlasTexture:null,ei=ve||!Z.isOrthographic||l.options.rotating||l.options.zooming||tn.kind==="composite"||tn.kind==="camera"?X.LINEAR:X.NEAREST);const Kn=je.glyphAtlasTexture?je.glyphAtlasTexture.size:[0,0],rn=o.layout.get("text-size-scale-range"),Di=s.aA(l.scaleFactor,rn[0],rn[1]),Ki=s.bK(tn,Z.zoom,Di),yi=Us(et,je.tileID.canonical,ve,ce,Z,He.getProjection(),ot),rr=cn(et,je.tileID.canonical,ve,ce,Z,He.getProjection(),ot),kr=l.translatePosMatrix(rr,je,x,S,!0),$i=l.translatePosMatrix(et,je,x,S),Tn=Ct?no:yi,Xl=ce&&!ve&&!Qt;let To=Ue;!be&&!Z.mercatorFromTransition||ce||(To=Ho(Z));const Ga=Rl(tn.kind,Ki,Xl,ve,l,$i,Tn,kr,ie,!0,Kn,wn,0,Ke,st,oe,Pt,lt?To:Ue,He.getProjection(),bi,Vt,null,null,Di),qa=je.glyphAtlasTexture?je.glyphAtlasTexture:null,Sn=X.LINEAR,So=o.paint.get("text-halo-width").constantOr(1)!==0,Eo=l.terrain&&ve&&Qt?s.bl(s.bC(),yi):no;if(Qt&&He.text){const Nn=s.bV.getAtTileOffsetFunc(Ke,Z.center.lat,Z.worldSize,He.getProjection()),Wo=Uo(et,je.tileID.canonical,ve,ce,Z,He.getProjection(),ot);ii(He,et,l,!0,Wo,rr,ve,O,Nn,Ke,Di)}return{program:xr,buffers:He.text,uniformValues:Ga,atlasTexture:qa,atlasTextureIcon:Dr,atlasInterpolation:Sn,atlasInterpolationIcon:ei,isSDF:!0,hasHalo:So,depthMode:en,tile:je,renderWithShadows:gi,labelPlaneMatrixInv:Eo}},ci=He.icon.segments.get().length,Ut=He.text.segments.get().length,Mt=ci&&!m.onlyText?si():null,Jt=Ut&&!m.onlyIcons?ri():null,Pi=o.paint.get("icon-opacity").constantOr(1),Ri=o.paint.get("text-opacity").constantOr(1);if(ge&&He.canOverlap){Me=!0;const Qt=Pi&&!m.onlyText?He.icon.segments.get():[],kt=Ri&&!m.onlyIcons?He.text.segments.get():[];for(const Ct of Qt)ke.push({segments:new s.bg([Ct]),sortKey:Ct.sortKey,state:Mt});for(const Ct of kt)ke.push({segments:new s.bg([Ct]),sortKey:Ct.sortKey,state:Jt})}else m.onlyText||ke.push({segments:Pi?He.icon.segments:new s.bg([]),sortKey:0,state:Mt}),m.onlyIcons||ke.push({segments:Ri?He.text.segments:new s.bg([]),sortKey:0,state:Jt})}Me&&ke.sort((Ke,je)=>Ke.sortKey-je.sortKey);for(const Ke of ke){const je=Ke.state;if(je)if(l.terrain?l.terrain.setupElevationDraw(je.tile,je.program,{useDepthForOcclusion:Z.depthOcclusionForSymbolsAndCircles,labelPlaneMatr
2997ixInv:je.labelPlaneMatrixInv}):l.setupDepthForOcclusion(Z.depthOcclusionForSymbolsAndCircles,je.program),te.activeTexture.set(X.TEXTURE0),je.atlasTexture&&je.atlasTexture.bind(je.atlasInterpolation,X.CLAMP_TO_EDGE,!0),je.atlasTextureIcon&&(te.activeTexture.set(X.TEXTURE1),je.atlasTextureIcon&&je.atlasTextureIcon.bind(je.atlasInterpolationIcon,X.CLAMP_TO_EDGE,!0)),je.renderWithShadows&&l.shadowRenderer.setupShadows(je.tile.tileID.toUnwrapped(),je.program,"vector-tile"),l.uploadCommonLightUniforms(l.context,je.program),je.hasHalo){const He=je.uniformValues;He.u_is_halo=1,Wc(je.buffers,Ke.segments,o,l,je.program,je.depthMode,d,p,He,2),He.u_is_halo=0}else{if(je.isSDF){const He=je.uniformValues;je.hasHalo&&(He.u_is_halo=1,Wc(je.buffers,Ke.segments,o,l,je.program,je.depthMode,d,p,He,1)),He.u_is_halo=0}Wc(je.buffers,Ke.segments,o,l,je.program,je.depthMode,d,p,je.uniformValues,1)}}}function Wc(l,t,o,c,d,p,m,y,x,T){const S=[l.dynamicLayoutVertexBuffer,l.opacityVertexBuffer,l.iconTransitioningVertexBuffer,l.globeExtVertexBuffer,l.zOffsetVertexBuffer,l.orientationVertexBuffer];d.draw(c,c.context.gl.TRIANGLES,p,m,y,gt.disabled,x,o.id,l.layoutVertexBuffer,l.indexBuffer,t,o.paint,c.transform.zoom,l.programConfigurations.get(o.id),S,T)}function Sh(l,t){const o=1<<l.canonical.z,c=(t.x*o-l.canonical.x-l.wrap*o)*s.al,d=(t.y*o-l.canonical.y)*s.al,p=s.e8(t.z,t.y);return s.d5(c,d,p)}function Eh(l,t,o,c,d){if(!o.layout||o.layout.get("fill-elevation-reference")==="none"||o.paint.get("fill-opacity").constantOr(1)===0)return;const p=l.context.gl,m=new ut(l.context.gl.LEQUAL,ut.ReadWrite,l.depthRangeFor3D),y=new ut(l.context.gl.GREATER,ut.ReadWrite,l.depthRangeFor3D),x=(function(C){let L=.01;return C.isOrthographic&&(L=s.ak(1e-4,L,s.d0(C.pitch>=go?1:C.pitch/go))),2*L})(l.transform),T=l.transform.getFreeCameraOptions().position,S="elevatedStructuresDepthReconstruct",M=l.getOrCreateProgram(S,{defines:["DEPTH_RECONSTRUCTION"]}),A=l.getOrCreateProgram(S);for(const C of c){const L=t.getTile(C),z=L.getBucket(o);if(!z)continue;const O=z.elevatedStructures;if(!O)continue;const N=z.elevationBufferData.heightRange,q=Sh(C.toUnwrapped(),T),G=l.translatePosMatrix(C.projMatrix,L,o.paint.get("fill-translate"),o.paint.get("fill-translate-anchor"));let j,ie,Q,te;if(d==="initialize"){if(!N||N.min>=1||O.depthSegments.segments[0].primitiveLength===0)continue;j=Ws(G,q,x,1,0),ie=m,Q=O.depthSegments,te=M}else if(d==="reset"){if(!N||N.min>=0||O.maskSegments.segments[0].primitiveLength===0)continue;j=Ws(G,q,0,0,1),ie=y,Q=O.maskSegments,te=M}else if(d==="geometry"){if(O.depthSegments.segments[0].primitiveLength===0)continue;j=Ws(G,q,x,1,0),ie=m,Q=O.depthSegments,te=A}te.draw(l,p.TRIANGLES,ie,vt.disabled,Et.disabled,gt.disabled,j,o.id,O.vertexBuffer,O.indexBuffer,Q,o.paint,l.transform.zoom)}}function za(l,t,o,c){const{painter:d,sourceCache:p,layer:m,coords:y,colorMode:x,elevationType:T,terrainEnabled:S,pass:M}=l,A=d.context.gl,C=m.paint.get("fill-pattern"),L=m.paint.get("fill-pattern-cross-fade"),z=C.constantOr(null);let O=T;T!=="road"||t&&!S||(O="none");const N=O==="road",q=l.painter.shadowRenderer,G=N&&!!q&&q.enabled,j=new ut(d.context.gl.LEQUAL,ut.ReadOnly,d.depthRangeFor3D);let ie=[0,0,0];if(G){const Z=d.style.directionalLight,ne=d.style.ambientLight;Z&&ne&&(ie=Xn(d.style,Z,ne))}const Q=C&&C.constantOr(1),te=d.terrain&&d.terrain.renderingToTexture,X=(Z,ne)=>{let ce,de,ve,ge,Me;ne?(ce=Q&&!m.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",ve=A.LINES):(ce=Q?"fillPattern":"fill",ve=A.TRIANGLES);for(const Fe of y){const pe=p.getTile(Fe);if(Q&&!pe.patternsLoaded())continue;const oe=pe.getBucket(m);if(!oe)continue;const Ie=t?oe.elevationBufferData:oe.bufferData;if(Ie.isEmpty())continue;d.prepareDrawTile();const be=Ie.programConfigurations.get(m.id),ke=d.isTileAffectedByFog(Fe),Ue=[],Ke=[];N&&(Ue.push("ELEVATED_ROADS"),Ke.push(Ie.elevatedLayoutVertexBuffer)),G&&Ue.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),te&&o&&Ue.push("USE_MRT1"),Q&&(d.context.activeTexture.set(A.TEXTURE0),pe.imageAtlasTexture&&pe.imageAtlasTexture.bind(A.LINEAR,A.CLAMP_TO_EDGE),be.updatePaintBuffers());let je=!1;if(z&&pe.imageAtlas){const ot=pe.imageAtlas,dt=s.e3.from(z),yt=dt.getPrimary().scaleSelf(s.o.devicePixelRatio).toString(),Pt=dt.getSecondary(),Vt=ot.patternPositions.get(yt),St=Pt?ot.patternPositions.get(Pt.scaleSelf(s.o.devicePixelRatio).toString()):null;je=!!Vt&&!!St,Vt&&be.setConstantPatternPositions(Vt,St)}L>0&&(je||be.getPatternTransitionVertexBuffer("fill-pattern"))&&Ue.push("FILL_PATTERN_TRANSITION");const He=d.getOrCreateProgram(ce,{config:be,overrideFog:ke,defines:Ue}),lt=d.translatePosMatrix(Fe.projMatrix,pe,m.paint.get("fill-translate"),m.paint.get("fill-translate-anchor"));G&&q.setupShadows(pe.tileID.toUnwrapped(),He,"vector-tile");const st=m.paint.get("fill-emissive-strength");if(ne){ge=Ie.lineIndexBuffer,Me=Ie.lineSegments;const ot=d.terrain&&d.terrain.renderingToTexture?d.terrain.drapeBufferSize:[A.drawingBufferWidth,A.drawingBufferHeight];de=ce==="fillOutlinePattern"&&Q?Af(lt,st,d,pe,ot,ie,L):If(lt,st,ot,ie)}else ge=Ie.indexBuffer,Me=Ie.triangleSegments,de=Q?gh(lt,st,d,pe,ie,L):Zs(lt,st,ie);d.uploadCommonUniforms(d.context,He,Fe.toUnwrapped());let et=Z;(T==="road"&&!S||T==="offset")&&(et=j),He.draw(d,ve,et,c||d.stencilModeForClipping(Fe),x,gt.disabled,de,m.id,Ie.layoutVertexBuffer,ge,Me,m.paint,d.transform.zoom,be,Ke)}};d.renderPass===M&&X(d.depthModeForSublayer(1,d.renderPass==="opaque"?ut.ReadWrite:ut.ReadOnly),!1),O==="none"&&d.renderPass==="translucent"&&m.paint.get("fill-antialias")&&X(d.depthModeForSublayer(m.getPaintProperty("fill-outline-color")?2:0,ut.ReadOnly),!0)}
vendor: 5,071 bytes, line 2997
2997function Da(l,t,o,c,d,p,m,y){o.resetLayerRenderingStats(l);const x=l.context,T=x.gl,S=l.transform,M=o.paint.get("fill-extrusion-pattern"),A=o.paint.get("fill-extrusion-pattern-cross-fade"),C=M.constantOr(null),L=M.constantOr(1),z=o.paint.get("fill-extrusion-opacity"),O=l.style.enable3dLights(),N=o.paint.get(O&&!L?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),q=[o.paint.get("fill-extrusion-ambient-occlusion-intensity"),N],G=o.layout.get("fill-extrusion-edge-radius"),j=G>0&&!o.paint.get("fill-extrusion-rounded-roof"),ie=j?0:G,Q=S.projection.name==="globe"?s.eb():0,te=S.projection.name==="globe",X=te?s.aj(S.zoom):0,Z=[s.aF(S.center.lng),s.aJ(S.center.lat)],ne=o.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",ce=o.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(ne?null:o.lut).toArray01().slice(0,3),de=o.paint.get("fill-extrusion-flood-light-intensity"),ve=o.paint.get("fill-extrusion-vertical-scale"),ge=o.paint.get("fill-extrusion-line-width").constantOr(1)!==0,Me=o.paint.get("fill-extrusion-height-alignment"),Fe=o.paint.get("fill-extrusion-base-alignment"),pe=Wn(l,o.paint.get("fill-extrusion-cutoff-fade-range")),oe=[];let Ie;te&&oe.push("PROJECTION_GLOBE_VIEW"),q[0]>0&&oe.push("FAUX_AO"),j&&oe.push("ZERO_ROOF_RADIUS"),y&&oe.push("HAS_CENTROID"),de>0&&oe.push("FLOOD_LIGHT"),pe.shouldRenderCutoff&&oe.push("RENDER_CUTOFF"),ge&&oe.push("RENDER_WALL_MODE");const be=l.renderPass==="shadow",ke=l.shadowRenderer,Ue=be&&!!ke,Ke=be?gt.disabled:gt.backCCW;l.shadowRenderer&&(l.shadowRenderer.useNormalOffset=!0);let je=[0,0,0];if(ke){const st=l.style.directionalLight,et=l.style.ambientLight;st&&et&&(je=Xn(l.style,st,et)),be||(oe.push("RENDER_SHADOWS","DEPTH_TEXTURE"),ke.useNormalOffset&&oe.push("NORMAL_OFFSET")),Ie=oe.concat(["SHADOWS_SINGLE_CASCADE"])}const He=Ue?"fillExtrusionDepth":L?"fillExtrusionPattern":"fillExtrusion",lt=o.getLayerRenderingStats();for(const st of c){const et=t.getTile(st),ot=et.getBucket(o);if(!ot||ot.projection.name!==S.projection.name)continue;let dt=!1;ke&&(dt=ke.getMaxCascadeForTile(st.toUnwrapped())===0);const yt=l.isTileAffectedByFog(st),Pt=ot.programConfigurations.get(o.id);let Vt=!1;if(C&&et.imageAtlas){const Ut=et.imageAtlas,Mt=s.e3.from(C),Jt=Mt.getPrimary().scaleSelf(s.o.devicePixelRatio).toString(),Pi=Mt.getSecondary(),Ri=Ut.patternPositions.get(Jt),Qt=Pi?Ut.patternPositions.get(Pi.scaleSelf(s.o.devicePixelRatio).toString()):null;Vt=!!Ri&&!!Qt,Ri&&Pt.setConstantPatternPositions(Ri,Qt)}A>0&&(Vt||Pt.getPatternTransitionVertexBuffer("fill-extrusion-pattern"))&&oe.push("FILL_EXTRUSION_PATTERN_TRANSITION");const St=l.getOrCreateProgram(He,{config:Pt,defines:dt?Ie:oe,overrideFog:yt});if(l.terrain&&l.terrain.setupElevationDraw(et,St,{useMeterToDem:!0}),!ot.centroidVertexBuffer){const Ut=St.getAttributeLocation(T,"a_centroid_pos");Ut!==-1&&T.vertexAttrib2f(Ut,0,0)}!be&&ke&&ke.setupShadows(et.tileID.toUnwrapped(),St,"vector-tile"),L&&(l.context.activeTexture.set(T.TEXTURE0),et.imageAtlasTexture&&et.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),Pt.updatePaintBuffers());const Zt=o.paint.get("fill-extrusion-vertical-gradient"),It=1/ot.tileToMeter;let si;if(be&&ke){if(Ih(et.tileID,ot.maxHeight,l))continue;const Ut=ke.calculateShadowPassMatrixFromTile(et.tileID.toUnwrapped());si=_h(Ut,ie,It,ve,Me,Fe)}else{const Ut=l.translatePosMatrix(st.expandedProjMatrix,et,o.paint.get("fill-extrusion-translate"),o.paint.get("fill-extrusion-translate-anchor")),Mt=S.projection.createInversionMatrix(S,st.canonical);si=L?Ef(Ut,l,Zt,z,q,ie,It,st,et,Q,Me,Fe,X,Z,Mt,ce,ve,A):Nc(Ut,l,Zt,z,q,ie,It,st,Q,Me,Fe,X,Z,Mt,ce,ve,de,je)}l.uploadCommonUniforms(x,St,st.toUnwrapped(),null,pe);let ri=ot.segments;if(S.projection.name==="mercator"&&!be&&(ri=ot.getVisibleSegments(et.tileID,l.terrain,l.transform.getFrustum(0)),!ri.get().length))continue;if(lt)if(be)for(const Ut of ri.get())lt.numRenderedVerticesInShadowPass+=Ut.primitiveLength;else for(const Ut of ri.get())lt.numRenderedVerticesInTransparentPass+=Ut.primitiveLength;const ci=[];(l.terrain||y)&&ci.push(ot.centroidVertexBuffer),te&&ci.push(ot.layoutVertexExtBuffer),ge&&ci.push(ot.wallVertexBuffer),St.draw(l,x.gl.TRIANGLES,d,p,m,Ke,si,o.id,ot.layoutVertexBuffer,ot.indexBuffer,ri,o.paint,l.transform.zoom,Pt,ci)}l.shadowRenderer&&(l.shadowRenderer.useNormalOffset=!1)}class Ll{constructor(){this.translate=[0,0],this.translateAnchor="map",this.edgeRadius=0,this.cutoffFadeRange=0}}function vo(l,t,o,c,d,p,m,y,x,T,S,M,A,C,L,z,O,N,q,G){const j=t.context,ie=j.gl,Q=t.transform,te=t.transform.zoom,X=[],Z=l.translate,ne=l.translateAnchor,ce=l.edgeRadius,de=Wn(t,l.cutoffFadeRange);S==="clear"?(X.push("CLEAR_SUBPASS"),G&&(X.push("CLEAR_FROM_TEXTURE"),j.activeTexture.set(ie.TEXTURE0),G.bind(ie.LINEAR,ie.CLAMP_TO_EDGE))):S==="sdf"?X.push("SDF_SUBPASS"):S==="emissive"&&(X.push("USE_MRT1"),j.activeTexture.set(ie.TEXTURE0),G.bind(ie.LINEAR,ie.CLAMP_TO_EDGE)),N&&X.push("HAS_CENTROID"),de.shouldRenderCutoff&&X.push("RENDER_CUTOFF");const ve=(ge,Me,Fe,pe,oe)=>
2997{let Ie=X;Me.groundRadiusBuffer!=null&&(Ie=X.concat("HAS_ATTRIBUTE_a_flood_light_ground_radius"));const be=Me.programConfigurations.get(c.id),ke=t.isTileAffectedByFog(ge),Ue=t.getOrCreateProgram("fillExtrusionGroundEffect",{config:be,defines:Ie,overrideFog:ke}),Ke=((He,lt,st,et,ot,dt,yt,Pt,Vt,St,Zt)=>({u_matrix:lt,u_opacity:st,u_ao_pass:et?1:0,u_meter_to_tile:ot,u_ao:dt,u_flood_light_intensity:yt,u_flood_light_color:Pt,u_attenuation:Vt,u_edge_radius:St,u_fb:0,u_fb_size:Zt,u_dynamic_offset:1}))(0,pe,M,T,oe,[A,C*oe],L,z,O,te>=17?0:ce*oe,G?G.size[0]:0),je=[];N&&je.push(Me.hiddenByLandmarkVertexBuffer),Me.groundRadiusBuffer!=null&&je.push(Me.groundRadiusBuffer),t.uploadCommonUniforms(j,Ue,ge.toUnwrapped(),null,de),Ue.draw(t,j.gl.TRIANGLES,p,m,y,x,Ke,c.id,Me.vertexBuffer,Me.indexBuffer,Fe,c.paint,te,be,je)};for(const ge of d){const Me=o.getTile(ge),Fe=Me.getBucket(c);if(!Fe||Fe.projection.name!==Q.projection.name||!Fe.groundEffect||Fe.groundEffect&&!Fe.groundEffect.hasData())continue;const pe=Fe.groundEffect,oe=1/Fe.tileToMeter;{const Ie=t.translatePosMatrix(ge.projMatrix,Me,Z,ne),be=pe.getDefaultSegment();ve(ge,pe,be,Ie,oe)}if(q)for(let Ie=0;Ie<4;Ie++){const be=s.e9[Ie](ge),ke=o.getTile(be);if(!ke)continue;const Ue=ke.getBucket(c);if(!Ue||Ue.projection.name!==Q.projection.name||!Ue.groundEffect||Ue.groundEffect&&!Ue.groundEffect.hasData())continue;const Ke=Ue.groundEffect;let je,He;Ie===0?(je=[-s.al,0,0],He=1):Ie===1?(je=[s.al,0,0],He=0):Ie===2?(je=[0,-s.al,0],He=3):(je=[0,s.al,0],He=2);const lt=Ke.regionSegments[He];if(!lt)continue;const st=new Float32Array(16);s.br(st,ge.projMatrix,je),ve(ge,Ke,lt,t.translatePosMatrix(st,Me,Z,ne),oe)}}}function Ff(l,t,o,c,d,p,m){c.centroidVertexArray.length===0&&c.createCentroidsBuffer();const y=p?p.findDEMTileFor(o):null;if(!(y&&y.dem||m))return;p&&y&&y.dem&&c.selfDEMTileTimestamp!==y.dem._timestamp&&(c.borderDoneWithNeighborZ=[-1,-1,-1,-1],c.selfDEMTileTimestamp=y.dem._timestamp);const x=(O,N)=>{(O.flags|N.flags)&s.ec?(O.flags|=s.ec,N.flags|=s.ec):(O.flags&=~s.ec,N.flags&=~s.ec)},T=O=>new s.P(Math.ceil((O+s.ed)*s.ee),0),S=O=>{const N=t.getSource().minzoom,q=j=>{const ie=t.getTileByID(j);if(ie&&ie.hasData())return ie.getBucket(d)},G=[0,-1,1];for(const j of G){if(O.overscaledZ+j<N)continue;const ie=q(O.calculateScaledKey(O.overscaledZ+j));if(ie)return ie}},M=[0,0,0],A=(O,N)=>(M[0]=Math.min(O.min.y,N.min.y),M[1]=Math.max(O.max.y,N.max.y),M[2]=s.al-N.min.x>O.max.x?N.min.x-s.al:O.max.x,M),C=(O,N)=>(M[0]=Math.min(O.min.x,N.min.x),M[1]=Math.max(O.max.x,N.max.x),M[2]=s.al-N.min.y>O.max.y?N.min.y-s.al:O.max.y,M),L=[(O,N)=>A(O,N),(O,N)=>A(N,O),(O,N)=>C(O,N),(O,N)=>C(N,O)],z=(O,N,q,G,j,ie,Q)=>{if(!p)return 0;const te=[[ie?q:O,ie?O:q,0],[ie?q:N,ie?N:q,0]],X=Q<0?s.al+Q:Q,Z=[ie?X:(O+N)/2,ie?(O+N)/2:X,0];return q===0&&Q<0||q!==0&&Q>0?p.getForTilePoints(j,[Z],!0,G):te.push(Z),p.getForTilePoints(o,te,!0,y),Math.max(te[0][2],te[1][2],Z[2])/p.exaggeration()};for(let O=0;O<4;O++){const N=c.borderFeatureIndices[O];if(N.length===0)continue;const q=s.e9[O](o),G=S(q);if(!(G&&G instanceof s.ea))continue;const j=p?p.findDEMTileFor(q):null;if(!(j&&j.dem||m)||(p&&j&&j.dem&&c.borderDEMTileTimestamp[O]!==j.dem._timestamp&&(c.borderDoneWithNeighborZ[O]=-1,c.borderDEMTileTimestamp[O]=j.dem._timestamp),c.borderDoneWithNeighborZ[O]===G.canonical.z))continue;G.centroidVertexArray.length===0&&G.createCentroidsBuffer();const ie=(O<2?1:5)-O,Q=G.borderDoneWithNeighborZ[ie]!==c.canonical.z,te=G.borderFeatureIndices[ie];let X=0;if(c.canonical.z!==G.canonical.z){for(const Z of N)c.showCentroid(c.featuresOnBorder[Z]);if(Q)for(const Z of te)G.showCentroid(G.featuresOnBorder[Z]);c.borderDoneWithNeighborZ[O]=G.canonical.z,G.borderDoneWithNeighborZ[ie]=c.canonical.z}for(const Z of N){const ne=c.featuresOnBorder[Z],ce=c.centroidData[ne.centroidDataIndex],de=ne.borders[O];let ve;for(;X<te.length;){ve=G.featuresOnBorder[te[X]];const ge=ve.borders[ie];if(ge[1]>de[0]+3||ge[0]>de[0]-3)break;G.showCentroid(ve),X++}if(ve&&X<te.length){const ge=X;let Me=0;for(;!(ve.borders[ie][0]>de[1]-3)&&(Me++,++X!==te.length);)ve=G.featuresOnBorder[te[X]];ve=G.featuresOnBorder[te[ge]];let Fe=!1;if(Me>=1){const Ie=ve.borders[ie];Math.abs(de[0]-Ie[0])<3&&Math.abs(de[1]-Ie[1])<3&&(Me=1,Fe=!0,X=ge+1)}else if(Me===0){c.showCentroid(ne);continue}const pe=G.centroidData[ve.centroidDataIndex];m&&Fe&&x(ce,pe);const oe=ne.intersectsCount()>1||ve.intersectsCount()>1;
2997if(Me>1)X=ge,ce.centroidXY=pe.centroidXY=new s.P(0,0);else if(j&&j.dem&&!oe){const Ie=L[O](ce,pe),be=O%2?s.al-1:0,ke=z(Ie[0],Math.min(s.al-1,Ie[1]),be,j,q,O<2,Ie[2]);ce.centroidXY=pe.centroidXY=T(ke)}else oe?ce.centroidXY=pe.centroidXY=new s.P(0,0):(ce.centroidXY=c.encodeBorderCentroid(ne),pe.centroidXY=G.encodeBorderCentroid(ve));c.writeCentroidToBuffer(ce),G.writeCentroidToBuffer(pe)}else c.showCentroid(ne)}c.borderDoneWithNeighborZ[O]=G.canonical.z,G.borderDoneWithNeighborZ[ie]=c.canonical.z}(c.needsCentroidUpdate||!c.centroidVertexBuffer&&c.centroidVertexArray.length!==0)&&c.uploadCentroid(l)}const Of=[1,0,0],kf=[0,1,0],Bf=[0,0,1];function Ih(l,t,o){const c=o.transform,d=o.shadowRenderer;if(!d)return!0;const p=l.toUnwrapped(),m=c.tileSize*d._cascades[o.currentShadowCascade].scale;let y=t;if(c.elevation){const z=c.elevation.getMinMaxForTile(l);z&&(y+=z.max)}const x=[...d.shadowDirection];x[2]=-x[2];const T=d.computeSimplifiedTileShadowVolume(p,y,m,x);if(!T)return!1;const S=[Of,kf,Bf,x,[x[0],0,x[2]],[0,x[1],x[2]]],M=c.projection.name==="globe",A=c.scaleZoom(m),C=s.cB.fromInvProjectionMatrix(c.invProjMatrix,c.worldSize,A,!M),L=d.getCurrentCascadeFrustum();return C.intersectsPrecise(T.vertices,T.planes,S)===0||L.intersectsPrecise(T.vertices,T.planes,S)===0}function La(l){const{painter:t,source:o,layer:c,coords:d}=l;let p=l.defines;const m=t.context,y=t.renderPass==="shadow",x=t.renderPass==="light-beam",T=t.shadowRenderer,S=s.ef(t.transform.center.lat,t.transform.zoom),M=Wn(t,c.paint.get("building-cutoff-fade-range"));M.shouldRenderCutoff&&(p=p.concat("RENDER_CUTOFF")),l.floodLightIntensity>0&&(p=p.concat("FLOOD_LIGHT"));for(const A of d){const C=o.getTile(A),L=C.getBucket(c);if(!L)continue;T&&T.getMaxCascadeForTile(A.toUnwrapped())===0&&(p=p.concat("SHADOWS_SINGLE_CASCADE"));const z=L.programConfigurations.get(c.id);let O,N,q,G=t.translatePosMatrix(A.expandedProjMatrix,C,[0,0],"map");if(G=s.cS(s.bC(),G,[1,1,l.verticalScale]),y&&T){if(Ih(C.tileID,L.maxHeight*S,t))continue;let ie=T.calculateShadowPassMatrixFromTile(C.tileID.toUnwrapped());ie=s.cS(s.bC(),ie,[1,1,l.verticalScale]),q=ys(ie),O=N=t.getOrCreateProgram("buildingDepth",{config:z,defines:p,overrideFog:!1})}else if(x)O=N=t.getOrCreateProgram("buildingBloom",{config:z,defines:p,overrideFog:!1}),q=Mf(G);else{const ie=t.transform.calculatePosMatrix(A.toUnwrapped(),t.transform.worldSize);s.cS(ie,ie,[1,1,l.verticalScale]);const Q=s.bC();s.cS(Q,ie,[1,-1,1/S]),s.bl(Q,Q),s.eg(Q,Q);const te=t.transform.getFreeCameraOptions().position,X=1<<A.canonical.z;if(q=Vc(G,Q,l.opacity,l.facadeAOIntensity,[((te.x-A.wrap)*X-A.canonical.x)*s.al,(te.y*X-A.canonical.y)*s.al,te.z*X*s.al],L.tileToMeter,l.facadeEmissiveChance,l.floodLightColor,l.floodLightIntensity),N=t.getOrCreateProgram("building",{config:z,defines:p,overrideFog:!1}),l.depthOnly===!0)O=N;else{const Z=p.concat(["BUILDING_FAUX_FACADE","HAS_ATTRIBUTE_a_faux_facade_color_emissive"]);O=t.getOrCreateProgram("building",{config:z,defines:Z,overrideFog:!1})}T&&(T.setupShadowsFromMatrix(ie,N,!0),O!==N&&T.setupShadowsFromMatrix(ie,O,!0))}const j=(ie,Q)=>{if(x){const te=ie.entranceBloom;Q.draw(t,m.gl.TRIANGLES,l.depthMode,vt.disabled,l.blendMode,gt.disabled,q,c.id,te.layoutVertexBuffer,te.indexBuffer,te.segmentsBucket,c.paint,t.transform.zoom,z,[te.layoutAttenuationBuffer,te.layoutColorBuffer])}else{const te=ie.segmentsBucket;let X=[ie.layoutNormalBuffer,ie.layoutCentroidBuffer,ie.layoutColorBuffer,ie.layoutFloodLightDataBuffer];ie.layoutFacadePaintBuffer&&(X=X.concat([ie.layoutFacadeDataBuffer,ie.layoutFacadeVerticalRangeBuffer,ie.layoutFacadePaintBuffer])),Q.draw(t,m.gl.TRIANGLES,l.depthMode,vt.disabled,l.blendMode,y?gt.disabled:gt.backCW,q,c.id,ie.layoutVertexBuffer,ie.indexBuffer,te,c.paint,t.transform.zoom,z,X)}};t.uploadCommonUniforms(m,N,A.toUnwrapped(),null,M),L.buildingWithoutFacade&&j(L.buildingWithoutFacade,N),L.buildingWithFacade&&(O!==N&&t.uploadCommonUniforms(m,O,A.toUnwrapped(),null,M),j(L.buildingWithFacade,O))}}function Xc(l,t,o,c,d,p,m,y,x,T,S,M,A){const C=l.context.gl,L=l.depthModeForSublayer(1,ut.ReadOnly,C.LEQUAL,!0),z=.1*(1-(O=S))+3*O;var O;const N=l._showOverdrawInspector,q=M,G=new Ll;N||vo(G,l,t,o,c,L,new vt({func:C.ALWAYS,mask:255},255,255,C.KEEP,C.KEEP,C.REPLACE),new Et([C.ONE,C.ONE,C.ONE,C.ONE],s.ao.transparent,[!1,!1,!1,!0],C.MIN),gt.disabled,d,"sdf",p,m,y,x,T,z,q,!1);{const j=N?vt.disabled:new vt({func:C.EQUAL,mask:255},255,255,C.KEEP,C.DECR,C.DECR),ie=N?l.colorModeForRenderPass():new Et([C.ONE_MINUS_DST_ALPHA,C.DST_ALPHA,C.ONE,C.ONE],s.ao.transparent,[!0,!0,!0,!0]);vo(G,l,t,o,c,L,j,ie,gt.disabled,d,"color",p,m,y,x,T,z,q,!1)}}function Ah(l){return[l[0]*s.eh,l[1]*s.eh,l[2]*s.eh,0]}function Yc(l,t,o,c,d,p,m,y,x){const T=c.getSource(),S=o.globeSharedBuffers;if(!S)return;let M,A,C;if(t&&(M=c.getTile(t)),T instanceof s.aU?(A=T.texture,C=s.dK(0,0,o.transform)):M&&t&&(A=M.texture,C=s.dK(t.canonical.z,t.canonical.x,o.transform)),!A||!C)return;l||(C=s.cS(s.bC(),C,[1,-1,1]));
vendor: 15,431 bytes, line 2997
2997const L=o.context,z=L.gl,O=d.paint.get("raster-resampling")==="nearest"?z.NEAREST:z.LINEAR,N=o.colorModeForDrapableLayerRenderPass(p),q=m.defines;q.push("GLOBE_POLES");const G=new ut(z.LEQUAL,ut.ReadWrite,o.depthRangeFor3D),j=Float32Array.from(o.transform.expandedFarZProjMatrix),ie=Float32Array.from(s.bk(s.dJ(new s.cD(0,0,0))));o.terrain&&o.terrain.prepareDrawTile(),L.activeTexture.set(z.TEXTURE0),A.bind(O,z.CLAMP_TO_EDGE),L.activeTexture.set(z.TEXTURE1),A.bind(O,z.CLAMP_TO_EDGE),"useMipmap"in A&&L.extTextureFilterAnisotropic&&o.transform.pitch>20&&z.texParameterf(z.TEXTURE_2D,L.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,L.extTextureFilterAnisotropicMax);const[Q,te,X,Z]=t?S.getPoleBuffers(t.canonical.z,!1):S.getPoleBuffers(0,!0),ne=d.paint.get("raster-elevation");let ce;l?(ce=Q,o.renderDefaultNorthPole=ne!==0):(ce=te,o.renderDefaultSouthPole=ne!==0);const de=Ah(m.mix),ve=((Me,Fe,pe,oe,Ie,be,ke,Ue,Ke,je,He,lt,st)=>wh(Me,Fe,pe,new Float32Array(16),new Float32Array(9),[0,0],oe,[0,0],[0,0,0,0],1,{opacity:1,mix:0},be,[0,0],Ue,2,je,He,lt,1,0,st))(j,ie,C,s.aj(o.transform.zoom),0,d,0,ne,0,de,m.offset,m.range,p),ge=o.getOrCreateProgram("raster",{defines:q});o.uploadCommonUniforms(L,ge,null),ge.draw(o,z.TRIANGLES,G,x,N,y,ve,d.id,ce,X,Z)}function Nf(l){if(l.isOrthographic)return[0,0,0,0];const t=l._nearZ,o=l.projection.farthestPixelDistance(l),c=o-t,d=.2*l.height,p=t+d;return[t,o,(p-d-t)/c,(p-t)/c]}function Vf(l,t,o,c){if(l)return t instanceof Wr&&l instanceof dc?t.getTextureDescriptor(l,o,!0):{texture:l.texture,mix:Ah(c.mix),offset:c.offset,buffer:0,tileSize:1}}var Mh=s.ei([{name:"a_index",type:"Int16",components:1}]);class Uf{constructor(t,o,c,d){const p={width:c[0],height:c[1],data:null},m=t.gl;this.targetColorTexture=new s.T(t,p,m.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new s.T(t,p,m.RGBA8,{useMipmap:!1}),this.context=t,this.updateParticleTexture(o,d),this.lastInvalidatedAt=0}updateParticleTexture(t,o){if(this.particleTextureDimension===o.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());const c=this.context.gl,d=o.width*o.height;this.particleTexture0=new s.T(this.context,o,c.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new s.T(this.context,o,c.RGBA8,{premultiply:!1,useMipmap:!1});const p=new s.ej;p.reserve(d);for(let m=0;m<d;m++)p.emplaceBack(m);this.particleIndexBuffer=this.context.createVertexBuffer(p,Mh.members,!0),this.particleSegment=s.bg.simpleSegment(0,0,this.particleIndexBuffer.length,0),this.particleTextureDimension=o.width}update(t){return!(this.lastInvalidatedAt<t&&(this.lastInvalidatedAt=s.o.now(),1))}destroy(){this.targetColorTexture.destroy(),this.backgroundColorTexture.destroy(),this.particleIndexBuffer.destroy(),this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleSegment.destroy()}}function Ch(l,t,o){if(!l)return null;const c=t.getTextureDescriptor(l,o,!0);if(!c)return null;let{texture:d,mix:p,offset:m,tileSize:y,buffer:x,format:T}=c;if(!d||!T)return null;let S=!1;return T==="uint32"&&(S=!0,p[3]=0,p=jc(s.ek,p,[0,o.paint.get("raster-particle-max-speed")]),m=Pf(s.ek,m,[0,o.paint.get("raster-particle-max-speed")])),{texture:d,textureOffset:[x/(y+2*x),y/(y+2*x)],tileSize:y,scalarData:S,scale:p,offset:m,defines:["RASTER_ARRAY",{uint8:"DATA_FORMAT_UINT8",uint16:"DATA_FORMAT_UINT16",uint32:"DATA_FORMAT_UINT32"}[T]]}}function jf(l){const t=l._nearZ,o=l.projection.farthestPixelDistance(l),c=o-t,d=.2*l.height,p=t+d;return[t,o,(p-d-t)/c,(p-t)/c]}const Ph=new s.ao(1,0,0,1),Rh=new s.ao(0,1,0,1),zh=new s.ao(0,0,1,1),Gm=new s.ao(1,0,1,1),qm=new s.ao(0,1,1,1);function Gf(l,t,o,c,d,p){for(let m=0;m<o.length;m++)if(d){const T=new s.ao(c.r*.8,c.g*.8,c.b*.8,1);vs(l,t,o[m],c,-1,-1,p),vs(l,t,o[m],c,-1,1,p),vs(l,t,o[m],c,1,1,p),vs(l,t,o[m],c,1,-1,p),vs(l,t,o[m],T,0,0,p)}else vs(l,t,o[m],c,0,0,p)}function vs(l,t,o,c,d,p,m){const y=l.context,x=l.transform,T=y.gl,S=x.projection.name==="globe",M=S?["PROJECTION_GLOBE_VIEW"]:[];let A=s.bz(o.projMatrix);if(S&&s.aj(x.zoom)>0){const de=s.bj(o.canonical,x),ve=s.el(de);A=s.aB(new Float32Array(16),x.globeMatrix,ve),s.aB(A,x.projMatrix,A)}const C=s.bC();C[12]+=2*d/(s.o.devicePixelRatio*x.width),C[13]+=2*p/(s.o.devicePixelRatio*x.height),s.aB(A,C,A);const L=l.getOrCreateProgram("debug",{defines:M}),z=t.getTileByID(o.key);l.terrain&&l.terrain.setupElevationDraw(z,L);const O=ut.disabled,N=vt.disabled,q=l.colorModeForRenderPass(),G="$debug";y.activeTexture.set(T.TEXTURE0),l.emptyTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),S?z._makeGlobeTileDebugBuffers(l.context,x):z._makeDebugTileBoundsBuffers(l.context,x.projection);const j=z._tileDebugBuffer||l.debugBuffer,ie=z._tileDebugIndexBuffer||l.debugIndexBuffer,Q=z._tileDebugSegments||l.debugSegments;if(L.draw(l,T.LINE_STRIP,O,N,q,gt.disabled,vh(A,c.toPremultipliedRenderColor(null)),G,j,ie,Q,null,null,null,[z._globeTileDebugBorderBuffer]),m){const de=z.latestRawTileData,ve=Math.floor((de&&de.byteLength||0)/1024);let ge=o.canonical.toString();o.overscaledZ!==o.canonical.z&&(ge+=` => ${o.overscaledZ}`),ge+=` ${z.state}`,ge+=` ${ve}kb`,(function(Me,Fe){Me.initDebugOverlayCanvas();const pe=Me.debugOverlayCanvas,oe=Me.context.gl,Ie=Me.debugOverlayCanvas.getContext("2d");Ie.clearRect(0,0,pe.width,pe.height),Ie.shadowColor="white",Ie.shadowBlur=2,Ie.lineWidth=1.5,Ie.strokeStyle="white",Ie.textBaseline="top",Ie.font="bold 36px Open Sans, sans-serif",Ie.fillText(Fe,5,5),Ie.strokeText(Fe,5,5),Me.debugOverlayTexture.update(pe),Me.debugOverlayTexture.bind(oe.LINEAR,oe.CLAMP_TO_EDGE)})(l,ge)}const te=t.getTile(o).tileSize,X=512/Math.min(te,512)*(o.overscaledZ/x.zoom)*.5,Z=z._tileDebugTextBuffer||l.debugBuffer,ne=z._tileDebugTextIndexBuffer||l.quadTriangleIndexBuffer,ce=z._tileDebugTextSegments||l.debugSegments;L.draw(l,T.TRIANGLES,O,N,Et.alphaBlended,gt.disabled,vh(A,s.ao.transparent.toPremultipliedRenderColor(null),X),G,Z,ne,ce,null,null,null,[z._globeTileDebugTextBuffer])}function qf(l,t,o,c){Kc(l,0,t+o/2,l.transform.width,o,c)}function Dh(l,t,o,c){Kc(l,t-o/2,0,o,l.transform.height,c)}function Kc(l,t,o,c,d,p){const m=l.context,y=m.gl;y.enable(y.SCISSOR_TEST),y.scissor(t*s.o.devicePixelRatio,o*s.o.devicePixelRatio,c*s.o.devicePixelRatio,d*s.o.devicePixelRatio),m.clear({color:p}),y.disable(y.SCISSOR_TEST)}const Hf=s.ei([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:Hm}=Hf;function bs(l,t,o,c){l.emplaceBack(t,o,c)}class pn{constructor(t){this.vertexArray=new s.em,this.indices=new s.b0,bs(this.vertexArray,-1,-1,1),bs(this.vertexArray,1,-1,1),bs(this.vertexArray,-1,1,1),bs(this.vertexArray,1,1,1),bs(this.vertexArray,-1,-1,-1),bs(this.vertexArray,1,-1,-1),bs(this.vertexArray,-1,1,-1),bs(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=t.createVertexBuffer(this.vertexArray,Hm),this.indexBuffer=t.createIndexBuffer(this.indices),this.segment=s.bg.simpleSegment(0,0,36,12)}}function ws(l,t,o,c,d,p){const m=l.context.gl,y=t.paint.get("sky-atmosphere-color"),x=t.paint.get("sky-atmosphere-halo-color"),T=t.paint.get("sky-atmosphere-sun-intensity"),S=((M,A,C,L,z)=>({u_matrix_3f:M,u_sun_direction:A,u_sun_intensity:C,u_color_tint_r:[L.r,L.g,L.b,L.a],u_color_tint_m:[z.r,z.g,z.b,z.a],u_luminance:5e-5}))(s.eo(s.dO(),c),d,T,y.toPremultipliedRenderColor(null),x.toPremultipliedRenderColor(null));m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,m.TEXTURE_CUBE_MAP_POSITIVE_X+p,t.skyboxTexture,0),o.draw(l,m.TRIANGLES,ut.disabled,vt.disabled,Et.unblended,gt.frontCW,S,"skyboxCapture",t.skyboxGeometry.vertexBuffer,t.skyboxGeometry.indexBuffer,t.skyboxGeometry.segment)}const Kr=s.ei([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class Ts{constructor(t){const o=new s.ep;o.emplaceBack(-1,1,1,0,0),o.emplaceBack(1,1,1,1,0),o.emplaceBack(1,-1,1,1,1),o.emplaceBack(-1,-1,1,0,1);const c=new s.b0;c.emplaceBack(0,1,2),c.emplaceBack(2,3,0),this.vertexBuffer=t.createVertexBuffer(o,Kr.members),this.indexBuffer=t.createIndexBuffer(c),this.segments=s.bg.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const $f=s.ei([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_size_scale",components:1},{type:"Float32",name:"a_fade_opacity",components:1}]);class Lh{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class Fh{constructor(t){this.colorModeAlphaBlendedWriteRGB=new Et([1,hs,1,hs],s.ao.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new Et([1,0,1,0],s.ao.transparent,[!1,!1,!1,!0]),this.params=new Lh,this.updateNeeded=!0}update(t){const o=t.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new Ts(o);const c=this.params.sizeRange,d=this.params.intensityRange,p=(function(S){const M=s.eq(30),A=[];for(let C=0;C<S;++C){const L=2*Math.PI*M(),z=Math.acos(1-2*M())-.5*Math.PI;A.push(s.d5(Math.cos(z)*Math.cos(L),Math.cos(z)*Math.sin(L),Math.sin(z)))}return A})(this.params.starsCount),m=s.eq(300),y=new s.er,x=new s.b0;let T=0;for(let S=0;S<p.length;++S){const M=s.c5([],p[S],200),A=Math.max(0,1+.01*c*(1*m()-.5)),C=Math.max(0,1+.01*d*(1*m()-.5));y.emplaceBack(M[0],M[1],M[2],-1,-1,A,C),y.emplaceBack(M[0],M[1],M[2],1,-1,A,C),y.emplaceBack(M[0],M[1],M[2],1,1,A,C),y.emplaceBack(M[0],M[1],M[2],-1,1,A,C),x.emplaceBack(T+0,T+1,T+2),x.emplaceBack(T+0,T+2,T+3),T+=4}this.starsVx=o.createVertexBuffer(y,$f.members),this.starsIdx=o.createIndexBuffer(x),this.starsSegments=s.bg.simpleSegment(0,0,y.length,x.length)}}destroy(){this.atmosphereBuffer&&this.atmosphereBuffer.destroy(),this.starsVx&&this.starsVx.destroy(),this.starsIdx&&this.starsIdx.destroy()}drawAtmosphereGlow(t,o){const c=t.context,d=c.gl,p=t.transform,m=new ut(d.LEQUAL,ut.ReadOnly,[0,1]),y=s.aj(p.zoom),x=t.style.getLut(o.scope),T=o.properties.get("color-use-theme")==="none",S=o.properties.get("color").toNonPremultipliedRenderColor(T?null:x),M=o.properties.get("high-color-use-theme")==="none",A=o.properties.get("high-color").toNonPremultipliedRenderColor(M?null:x),C=o.properties.get("space-color-use-theme")==="none",L=o.properties.get("space-color").toNonPremultipliedRenderColor(C?null:x),z=5e-4,O=s.es(o.properties.get("horizon-blend"),0,1,z,.25),N=s.dE(t,c,p)&&O===z?p.worldSize/(2*Math.PI*1.025)-1:p.globeRadius,q=t.frameCounter/1e3%1,G=s.ag(p.globeCenterInViewSpace),j=Math.sqrt(Math.pow(G,2)-Math.pow(N,2)),ie=Math.acos(j/G),Q=te=>{const X=p.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];te&&X.push("ALPHA_PASS");const Z=t.getOrCreateProgram("globeAtmosphere",{defines:X}),ne=((de,ve,ge,Me,Fe,pe,oe,Ie,be,ke,Ue,Ke)=>({u_frustum_tl:de,u_frustum_tr:ve,u_frustum_br:ge,u_frustum_bl:Me,u_horizon:Fe,u_transition:pe,u_fadeout_range:oe,u_atmosphere_fog_color:Ie.toArray01(),u_high_color:be.toArray01(),u_space_color:ke.toArray01(),u_temporal_offset:Ue,u_horizon_angle:Ke}))(p.frustumCorners.TL,p.frustumCorners.TR,p.frustumCorners.BR,p.frustumCorners.BL,p.frustumCorners.horizon,y,O,S,A,L,q,ie);t.uploadCommonUniforms(c,Z);const ce=this.atmosphereBuffer;ce&&Z.draw(t,d.TRIANGLES,m,vt.disabled,te?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,gt.backCW,ne,te?"atmosphere_glow_alpha":"atmosphere_glow",ce.vertexBuffer,ce.indexBuffer,ce.segments)};Q(!1),Q(!0)}drawStars(t,o){const c=s.aA(o.properties.get("star-intensity"),0,1);if(c===0)return;const d=t.context,p=d.gl,m=t.transform,y=t.getOrCreateProgram("stars"),x=s.c7([]);s.c9(x,x,-m._pitch),s.c8(x,x,-m.angle),s.c9(x,x,s.an(m._center.lat)),s.et(x,x,-s.an(m._center.lng));const T=s.cc(new Float32Array(16),x),S=s.aB([],m.starsProjMatrix,T),M=s.eo([],T),A=s.eu([],M),C=[0,1,0];s.dQ(C,C,A),s.c5(C,C,this.params.sizeMultiplier);const L=[1,0,0];s.dQ(L,L,A),s.c5(L,L,this.params.sizeMultiplier);const z=(O=C,N=L,q=c,{u_matrix:Float32Array.from(S),u_up:O,u_right:N,u_intensity_multiplier:q});var O,N,q;t.uploadCommonUniforms(d,y),this.starsVx&&this.starsIdx&&y.draw(t,p.TRIANGLES,ut.disabled,vt.disabled,this.colorModeAlphaBlendedWriteRGB,gt.disabled,z,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}class Oh{constructor(){this.visibleTiles=[]}updateBorders(t,o){const c=[],d=[],p=t._getRenderableCoordinates(!1,!0);for(const x of p){const T=t.getTile(x);if(!T.hasData())continue;const S=T.getBucket(o);S&&(S.isEmpty()||(c.push(x.key),d.push({bucket:S,tileID:x.canonical})))}let m=c.length!==this.visibleTiles.length;if(!m){c.sort();for(let x=0;x<c.length;x++)if(c[x]!==this.visibleTiles[x]){m=!0;break}}if(!m)return;const y=new Set;this.visibleTiles=c,d.sort((x,T)=>x.tileID.z-T.tileID.z||x.tileID.x-T.tileID.x||x.tileID.y-T.tileID.y);for(const x of d){const T=new Array,S=new Array,M=x.bucket;for(const A of M.featuresOnBorder)y.has(A.featureId)?S.push(A.footprintIndex):(y.add(A.featureId),T.push(A.footprintIndex));M.updateFootprintHiddenFlags(T,s.ev,!1),M.updateFootprintHiddenFlags(S,s.ev,!0)}}}function kh(l,t){const o=[...l],c=t.cameraWorldSizeForFog/t.worldSize,d=s.bA([]);return s.cS(d,d,[c,c,1]),s.aB(o,d,o),s.aB(o,t.worldToFogMatrix,o),o}function oo(l,t,o,c,d){const p=o.material,m=c.context,{baseColorTexture:y,metallicRoughnessTexture:x}=p.pbrMetallicRoughness,{normalTexture:T,occlusionTexture:S,emissionTexture:M}=p;function A(L,z,O){if(L&&(l.push(z),m.activeTexture.set(m.gl.TEXTURE0+O),L.gfxTexture)){const{minFilter:N,magFilter:q,wrapS:G,wrapT:j}=L.sampler;L.gfxTexture.bindExtraParam(N,q,G,j)}}A(y,"HAS_TEXTURE_u_baseColorTexture",5),A(x,"HAS_TEXTURE_u_metallicRoughnessTexture",6),A(T,"HAS_TEXTURE_u_normalTexture",7),A(S,"HAS_TEXTURE_u_occlusionTexture",8),A(M,"HAS_TEXTURE_u_emissionTexture",9),d&&(d.texture||(d.texture=new s.d$(c.context,d.image,[d.image.height,d.image.height,d.image.height],m.gl.RGBA8)),m.activeTexture.set(m.gl.TEXTURE0+10),d.texture&&d.texture.bind(m.gl.LINEAR,m.gl.CLAMP_TO_EDGE),l.push("APPLY_LUT_ON_GPU")),o.texcoordBuffer&&(l.push("HAS_ATTRIBUTE_a_uv_2f"),t.push(o.texcoordBuffer)),o.colorBuffer&&(l.push(o.colorBuffer.itemSize===12?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),t.push(o.colorBuffer)),o.normalBuffer&&(l.push("HAS_ATTRIBUTE_a_normal_3f"),t.push(o.normalBuffer)),o.pbrBuffer&&(l.push("HAS_ATTRIBUTE_a_pbr"),l.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),t.push(o.pbrBuffer)),p.alphaMode!=="OPAQUE"&&p.alphaMode!=="MASK"||l.push("UNPREMULT_TEXTURE_IN_SHADER"),p.defined||l.push("DIFFUSE_SHADED");const C=c.shadowRenderer;C&&(l.push("RENDER_SHADOWS","DEPTH_TEXTURE"),C.useNormalOffset&&l.push("NORMAL_OFFSET"))}function ui(l,t,o,c,d,p){const m=l.modelOpacity,y=t.context,x=new ut(t.context.gl.LEQUAL,l.isLightMesh?ut.ReadOnly:ut.ReadWrite,t.depthRangeFor3D),T=t.transform,S=l.mesh,M=S.material,A=M.pbrMetallicRoughness,C=t.style.fog;let L;L=t.transform.projection.zAxisUnit==="pixels"?[...l.nodeModelMatrix]:s.aB([],c.zScaleMatrix,l.nodeModelMatrix),s.aB(L,c.negCameraPosMatrix,L);const z=s.bl([],L);s.eg(z,z);
2997const O=o.paint.get("model-color-use-theme").constantOr("default")==="none",N=o.paint.get("model-emissive-strength").constantOr(0),q=qc(new Float32Array(l.worldViewProjection),new Float32Array(L),new Float32Array(z),null,t,m,A.baseColorFactor,M.emissiveFactor,A.metallicFactor,A.roughnessFactor,M,N,o,void 0,void 0,l.materialOverride,l.modelColor),G={defines:[]},j=[],ie=t.shadowRenderer;ie&&(ie.useNormalOffset=!1),oo(G.defines,j,S,t,O?null:o.lut);let Q=null;if(C){const Z=kh(l.nodeModelMatrix,t.transform);if(Q=new Float32Array(Z),T.projection.name!=="globe"){const ne=S.aabb.min,ce=S.aabb.max,[de,ve]=C.getOpacityForBounds(Z,ne[0],ne[1],ce[0],ce[1]);G.overrideFog=de>=rt||ve>=rt}}const te=Wn(t,o.paint.get("model-cutoff-fade-range"));te.shouldRenderCutoff&&G.defines.push("RENDER_CUTOFF");const X=t.getOrCreateProgram("model",G);t.uploadCommonUniforms(y,X,null,Q,te),t.renderPass!=="shadow"&&ie&&ie.setupShadowsFromMatrix(l.nodeModelMatrix,X),X.draw(t,y.gl.TRIANGLES,x,d,p,S.material.doubleSided?gt.disabled:gt.backCCW,q,o.id,S.vertexBuffer,S.indexBuffer,S.segments,o.paint,t.transform.zoom,void 0,j)}function Fl(l,t){return l.style._importedAsBasemap?"basemap":t.scope}function Ol(l,t,o,c,d,p,m,y,x,T){const S=l.transform,M=!!t.isGeometryBloom&&t.isGeometryBloom;if(M&&l.renderPass==="shadow")return;const A=S.projection.name==="globe"?s.eD(o,S):[...o];s.aB(A,A,t.globalMatrix);const C=s.aB([],c,A);if(t.meshes)for(const L of t.meshes){const z=y.get(L.material.name);if(z&&z.opacity<=0)continue;if(L.material.alphaMode!=="BLEND"){m.push({mesh:L,depth:0,modelIndex:d,worldViewProjection:C,nodeModelMatrix:A,isLightMesh:M,materialOverride:z,modelOpacity:x,modelColor:T});continue}const O=s.af([],L.centroid,C);!S.isOrthographic&&O[2]<=0||p.push({mesh:L,depth:O[2],modelIndex:d,worldViewProjection:C,nodeModelMatrix:A,isLightMesh:M,materialOverride:z,modelOpacity:x,modelColor:T})}if(t.children)for(const L of t.children)Ol(l,L,o,c,d,p,m,y,x,T)}function Fa(l,t,o,c){const d=o.shadowRenderer;if(!d)return;const p=d.getShadowPassDepthMode(),m=d.getShadowPassColorMode(),y=d.calculateShadowPassMatrixFromMatrix(t),x=Dl(y);o.getOrCreateProgram("modelDepth",{defines:o._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(o,o.context.gl.TRIANGLES,p,vt.disabled,m,gt.disabled,x,c.id,l.vertexBuffer,l.indexBuffer,l.segments,c.paint,o.transform.zoom,void 0,void 0)}function Zf(l,t,o,c,d,p){for(const m of d){const y=Object.assign({},c);y.part=m;const x={type:"Unknown",id:t,properties:y},T={orientation:l.paint.get("model-rotation").evaluate(x,o)};p.set(m,T)}}function Wf(l,t,o,c,d,p){for(const m of d){const y=Object.assign({},c);y.part=m;const x={type:"Unknown",id:t,properties:y},T={color:l.paint.get("model-color").evaluate(x,o),colorMix:l.paint.get("model-color-mix-intensity").evaluate(x,o),opacity:l.paint.get("model-opacity").evaluate(x,o),emissionStrength:l.paint.get("model-emissive-strength").evaluate(x,o)};p.set(m,T)}}function Bh(l,t,o,c,d){let p=!1;for(const y of c)y.modelOpacity!==1&&(ui(y,l,t,d[y.modelIndex],vt.disabled,Et.disabled),p=!0);for(const y of c)ui(y,l,t,d[y.modelIndex],y.modelOpacity!==1?l.stencilModeFor3D():vt.disabled,l.colorModeForRenderPass());p&&l.resetStencilClippingMasks();const m=Et.additive;for(const y of o)ui(y,l,t,d[y.modelIndex],vt.disabled,y.isLightMesh?m:l.colorModeForRenderPass())}function Ks(l,t,o){const c=t.updateZoomBasedPaintProperties(),d=(function(p,m,y){let x,T,S,M=p.terrain?p.terrain.exaggeration():0;if(p.terrain&&M>0){const A=p.terrain,C=A.findDEMTileFor(y);C&&C.dem?x=s.eF.create(A,y,C):M=0}if(M===0&&(m.terrainElevationMin=0,m.terrainElevationMax=0),M===m.validForExaggeration&&(M===0||x&&x._demTile&&x._demTile.tileID===m.validForDEMTile.id&&x._dem._timestamp===m.validForDEMTile.timestamp))return!1;for(const A in m.instancesPerModel){const C=m.instancesPerModel[A];for(let L=0;L<C.instancedDataArray.length;++L){const z=(x?M*x.getElevationAt(0|C.instancedDataArray.float32[16*L],0|C.instancedDataArray.float32[16*L+1],!0,!0):0)+C.instancesEvaluatedElevation[L];C.instancedDataArray.float32[16*L+6]=z,T=T?Math.min(m.terrainElevationMin,z):z,S=S?Math.max(m.terrainElevationMax,z):z}}return m.terrainElevationMin=T||0,m.terrainElevationMax=S||0,m.validForExaggeration=M,m.validForDEMTile=x&&x._demTile?{id:x._demTile.tileID,timestamp:x._dem._timestamp}:{id:void 0,timestamp:0},!0})(l,t,o);(c||d)&&(t.uploaded=!1,t.upload(l.context))}const Jr={shadowUniformsInitialized:!1,useSingleShadowCascade:!1,tileMatrix:new Float64Array(16),shadowTileMatrix:new Float32Array(16),aabb:new s.d9([0,0,0],[s.al,s.al,0])};function Ge(l,t){const o=1<<l.canonical.z,c=t.getFreeCameraOptions().position,d=t.elevation,p=l.canonical.x/o,m=(l.canonical.x+1)/o,y=l.canonical.y/o,x=(l.canonical.y+1)/o;let T=t._centerAltitude;if(d){const C=d.getMinMaxForTile(l);C&&C.max>T&&(T=C.max)}const S=s.aA(c.x,p,m)-c.x,M=s.aA(c.y,y,x)-c.y,A=s.cf(T,t.center.lat)-c.z;return t._zoomFromMercatorZ(Math.sqrt(S*S+M*M+A*A))}function Je(l,t,o,c,d,p,m){const y=l.context,x=l.renderPass==="shadow",T=l.shadowRenderer,S=x&&T?T.getShadowPassDepthMode():new ut(y.gl.LEQUAL,ut.ReadWrite,l.depthRangeFor3D),M=l.isTileAffectedByFog(p),A=l.transform.projection.name==="globe";if(o.meshes)for(const C of o.meshes){const L=A?[]:["MODEL_POSITION_ON_GPU"],z=[];let O,N,q;const G=!A&&c.instancedDataArray.length>20;G&&L.push("INSTANCED_ARRAYS");const j=Wn(l,t.paint.get("model-cutoff-fade-range"));if(j.shouldRenderCutoff&&L.push("RENDER_CUTOFF"),x&&T)O=l.getOrCreateProgram("modelDepth",{defines:L}),N=Dl(m.shadowTileMatrix,m.shadowTileMatrix,Float32Array.from(o.globalMatrix)),q=T.getShadowPassColorMode();
2997else{oo(L,z,C,l,t.paint.get("model-color-use-theme").constantOr("default")==="none"?null:t.lut),O=l.getOrCreateProgram("model",{defines:L,overrideFog:M});const Q=C.material,te=Q.pbrMetallicRoughness,X=t.paint.get("model-opacity").constantOr(1),Z=t.paint.get("model-emissive-strength").constantOr(0);N=qc(p.expandedProjMatrix,Float32Array.from(o.globalMatrix),new Float32Array(16),null,l,X,te.baseColorFactor,Q.emissiveFactor,te.metallicFactor,te.roughnessFactor,Q,Z,t,d),T&&(m.shadowUniformsInitialized?O.setShadowUniformValues(y,T.getShadowUniformValues()):(T.setupShadows(p.toUnwrapped(),O,"model-tile"),m.shadowUniformsInitialized=!0)),q=j.shouldRenderCutoff||X<1||Q.alphaMode!=="OPAQUE"?Et.alphaBlended:Et.unblended}l.uploadCommonUniforms(y,O,p.toUnwrapped(),null,j);const ie=C.material.doubleSided?gt.disabled:gt.backCCW;if(G)z.push(c.instancedDataBuffer),O.draw(l,y.gl.TRIANGLES,S,vt.disabled,q,ie,N,t.id,C.vertexBuffer,C.indexBuffer,C.segments,t.paint,l.transform.zoom,void 0,z,c.instancedDataArray.length);else{const Q=x?"u_instance":"u_normal_matrix";for(let te=0;te<c.instancedDataArray.length;++te)N[Q]=new Float32Array(c.instancedDataArray.arrayBuffer,64*te,16),O.draw(l,y.gl.TRIANGLES,S,vt.disabled,q,ie,N,t.id,C.vertexBuffer,C.indexBuffer,C.segments,t.paint,l.transform.zoom,void 0,z)}}if(o.children)for(const C of o.children)Je(l,t,C,c,d,p,m)}const Oa=[1,-1,1];function Bi(l,t,o,c){if(!o.modelManager)return!0;const d=o.modelManager;if(!o.shadowRenderer)return!0;const p=o.shadowRenderer,m=t.aabb;let y=!0,x=l.maxHeight;if(x===0){let S=0;for(const M in l.instancesPerModel){const A=d.getModel(M,c);A?S=Math.max(S,Math.max(Math.max(A.aabb.max[0],A.aabb.max[1]),A.aabb.max[2])):y=!1}x=l.maxScale*S*1.41+l.maxVerticalOffset,y&&(l.maxHeight=x)}m.max[2]=x,m.min[2]+=l.terrainElevationMin,m.max[2]+=l.terrainElevationMax,s.af(m.min,m.min,t.tileMatrix),s.af(m.max,m.max,t.tileMatrix);const T=m.intersects(p.getCurrentCascadeFrustum());return o.currentShadowCascade===0&&(l.isInsideFirstShadowMapFrustum=T===2),T===0}function fe(l,t){const o=l.uniformValues.u_cutoff_params[0],c=l.uniformValues.u_cutoff_params[1],d=l.uniformValues.u_cutoff_params[2],p=l.uniformValues.u_cutoff_params[3];return c===o||p===d?1:s.aA(((t-o)/(c-o)-d)/(p-d),0,1)}function Xf(l,t,o,c){if(t.pitch<20)return 1;const d=t.getWorldToCameraMatrix();s.aB(d,d,l);const p=s.bU(o.min[0],o.min[1],o.min[2],1);let m=s.aC(s.eG(),p,d),y=m,x=m;p[1]=o.max[1],m=s.aC(s.eG(),p,d),y=m[1]<y[1]?m:y,x=m[1]>x[1]?m:x,p[0]=o.max[0],m=s.aC(s.eG(),p,d),y=m[1]<y[1]?m:y,x=m[1]>x[1]?m:x,p[1]=o.min[1],m=s.aC(s.eG(),p,d),y=m[1]<y[1]?m:y,x=m[1]>x[1]?m:x;const T=s.aA(c[0],0,1),S=100*t.pixelsPerMeter*s.aA(c[1],0,1),M=s.aA(c[2],0,1),A=s.eH(s.eG(),y,x,T),C=Math.tan(.5*t.fovX),L=-A[2]*C;if(S===0)return A[1]<-Math.abs(L)?M:1;const z=(-Math.abs(L)-A[1])/S,O=(q,G,j)=>(1-j)*q+j*G,N=s.aA(O(1,M,z),M,1);return O(1,N,s.aA((t.pitch-20)/20,0,1))}class Jc{}class Nh{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(t,o,c){{const M=this._storage.get(o.id);if(M)return M.lastUsedFrameIdx=t,M.buf}const d=c.gl,p=d.getBufferParameter(d.ELEMENT_ARRAY_BUFFER,d.BUFFER_SIZE),m=new ArrayBuffer(p),y=new Int16Array(m);d.getBufferSubData(d.ELEMENT_ARRAY_BUFFER,0,new Int16Array(m));const x=new s.eJ;for(let M=0;M<p/2;M+=3){const A=y[M],C=y[M+1],L=y[M+2];x.emplaceBack(A,C),x.emplaceBack(C,L),x.emplaceBack(L,A)}const T=c.bindVertexArrayOES.current,S=new Jc;return S.buf=new xo(c,x),S.lastUsedFrameIdx=t,this._storage.set(o.id,S),c.bindVertexArrayOES.set(T),S.buf}update(t){for(const[o,c]of this._storage)t-c.lastUsedFrameIdx>30&&(c.buf.destroy(),this._storage.delete(o))}destroy(){for(const[t,o]of this._storage)o.buf.destroy(),this._storage.delete(t)}}class Vh{constructor(){this.occluderSize=30,this.depthOffset=-1e-4}}const Yf=s.ei([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_rainParticleData",components:4}]);class Uh{constructor(t){this.revealStart=11,this.revealRange=2}}const ka=s.ei([{type:"Float32",name:"a_pos_2f",components:2}]);class $m{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(t,o){const c=t.getOrCreateProgram("vignette");
2997if(!this.vignetteVx||!this.vignetteIdx){const m=new s.eK,y=new s.b0;m.emplaceBack(-1,-1),m.emplaceBack(1,-1),m.emplaceBack(1,1),m.emplaceBack(-1,1),y.emplaceBack(0,1,2),y.emplaceBack(0,2,3),this.vignetteVx=t.context.createVertexBuffer(m,ka.members),this.vignetteIdx=t.context.createIndexBuffer(y)}const d=s.bg.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){t.uploadCommonUniforms(t.context,c);const m={u_vignetteShape:(p={vignetteShape:[o.start,o.range,Math.pow(10,o.fadePower)],vignetteColor:[o.color.r,o.color.g,o.color.b,o.color.a*o.strength]}).vignetteShape,u_vignetteColor:p.vignetteColor};c.draw(t,t.context.gl.TRIANGLES,ut.disabled,vt.disabled,Et.alphaBlended,gt.disabled,m,"vignette",this.vignetteVx,this.vignetteIdx,d)}var p}}class Zm{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(t,o){const c=t.getFreeCameraOptions().position,d=c.toAltitude(),p=c.toLngLat(),m=s.an(p.lng),y=s.an(p.lat),x=t.pixelsPerMeter/o,T=m*s.eM,S=s.eM*Math.log(Math.tan(Math.PI/4+y/2));if(this._offsetXPrev===void 0)this._offsetXPrev=0,this._offsetYPrev=0,this._elevationPrev=0,this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0;else{const M=-this._offsetYPrev+S,A=-this._elevationPrev+d;this._accumulatedOffsetX+=(-this._offsetXPrev+T)*x,this._accumulatedOffsetY+=M*x,this._accumulatedElevation+=A*x,this._offsetXPrev=T,this._offsetYPrev=S,this._elevationPrev=d}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function jh(l,t){return[-(l[0]-Math.floor(l[0]/t)*t),-(l[1]-Math.floor(l[1]/t)*t),-(l[2]-Math.floor(l[2]/t)*t)]}function kl(l){const t=s.eq(1323123451230),o=[];for(let c=0;c<l;++c){const d=2*t()-1,p=2*t()-1,m=2*t()-1;o.push(s.d5(d,p,m))}return o}function bo(l,t,o,c,d){const p=s.aA((d-o)/(c-o),0,1);return(1-p)*l+p*t}class Gh{constructor(t){this._movement=new Zm,this._accumulatedTimeFromStart=0,this._prevTime=Date.now()/1e3,this._vignette=new $m,this._ppmScaleFactor=t}destroy(){this.particlesVx&&this.particlesVx.destroy(),this.particlesIdx&&this.particlesIdx.destroy(),this._vignette&&this._vignette.destroy()}updateOnRender(t,o){const c=t.transform;this._movement.update(c,this._ppmScaleFactor);const d=c.starsProjMatrix,p=s.c7([]);s.c9(p,p,s.an(90)-c._pitch),s.c8(p,p,-c.angle);const m=s.cc(new Float32Array(16),p),y=s.eL(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1),x=s.eg([],y),T=s.aB([],x,m),S=Date.now()/1e3;return this._accumulatedTimeFromStart+=(S-this._prevTime)*o,this._prevTime=S,{projectionMatrix:d,modelviewMatrix:T}}}class Kf extends Gh{constructor(t){super(4.25),this._params={overrideStyleParameters:!1,intensity:.5,timeFactor:1,velocityConeAperture:0,velocity:300,boxSize:2500,dropletSizeX:1,dropletSizeYScale:10,distortionStrength:70,screenThinning:{intensity:.57,start:.46,range:1.17,fadePower:.17,affectedRatio:1,particleOffset:-.2},color:{r:.66,g:.68,b:.74,a:.7},direction:{x:-50,y:-35},shapeDirPower:2,shapeNormalPower:1},this._revealParams=new Uh("Precipitation > Rain"),this._vignetteParams={strength:1,start:.7,range:1,fadePower:.4,color:{r:.27,g:.27,b:.27,a:1}},this.particlesCount=16e3}update(t){const o=t.context;if(!this.particlesVx){const c=kl(this.particlesCount),d=new s.eN,p=new s.b0;let m=0;const y=s.eq(1323123451230);for(let x=0;x<c.length;++x){const T=c[x],S=[2*y()-1,y(),y(),y()];d.emplaceBack(T[0],T[1],T[2],-1,-1,...S),d.emplaceBack(T[0],T[1],T[2],1,-1,...S),d.emplaceBack(T[0],T[1],T[2],1,1,...S),d.emplaceBack(T[0],T[1],T[2],-1,1,...S),p.emplaceBack(m+0,m+1,m+2),p.emplaceBack(m+0,m+2,m+3),m+=4}this.particlesVx=o.createVertexBuffer(d,Yf.members),this.particlesIdx=o.createIndexBuffer(p)}}draw(t){if(!this._params.overrideStyleParameters&&!t.style.rain)return;const o=this._params.overrideStyleParameters?this._revealParams:{revealStart:0,revealRange:.01},c=t.transform.zoom;if(o.revealStart>c)return;const d=bo(0,1,o.revealStart,o.revealStart+o.revealRange,c);if(!this.particlesVx||!this.particlesIdx)return;const p=structuredClone(this._params);let m=[-p.direction.x,p.direction.y,-100];s.aw(m,m);
2997const y=structuredClone(this._vignetteParams);y.strength*=d,p.overrideStyleParameters||(p.intensity=t.style.rain.state.density,p.timeFactor=t.style.rain.state.intensity,p.color=structuredClone(t.style.rain.state.color),m=structuredClone(t.style.rain.state.direction),p.screenThinning.intensity=t.style.rain.state.centerThinning,p.dropletSizeX=t.style.rain.state.dropletSize[0],p.dropletSizeYScale=t.style.rain.state.dropletSize[1]/t.style.rain.state.dropletSize[0],p.distortionStrength=100*t.style.rain.state.distortionStrength,y.strength=1,y.color=structuredClone(t.style.rain.state.vignetteColor));const x=this.updateOnRender(t,p.timeFactor),T=t.context,S=T.gl,M=t.transform;this.screenTexture&&this.screenTexture.size[0]===t.width&&this.screenTexture.size[1]===t.height||(this.screenTexture=new s.T(T,{width:t.width,height:t.height,data:null},S.RGBA8)),p.distortionStrength>0&&(T.activeTexture.set(S.TEXTURE0),this.screenTexture.bind(S.LINEAR,S.CLAMP_TO_EDGE),S.copyTexSubImage2D(S.TEXTURE_2D,0,0,0,0,0,t.width,t.height));const A=t.getOrCreateProgram("rainParticle");t.uploadCommonUniforms(T,A),T.activeTexture.set(S.TEXTURE0),this.screenTexture.bind(S.LINEAR,S.CLAMP_TO_EDGE);const C=[p.color.r,p.color.g,p.color.b,p.color.a],L=(z,O)=>{const N=jh(this._movement.getPosition(),z),q=p.dropletSizeX,G=p.dropletSizeX*p.dropletSizeYScale,j=t.width/2,ie=t.height/2,Q=bo(0,p.screenThinning.start,0,1,p.screenThinning.intensity),te=bo(.001,p.screenThinning.range,0,1,p.screenThinning.intensity),X=bo(0,p.screenThinning.particleOffset,0,1,p.screenThinning.intensity),Z=(ne={modelview:x.modelviewMatrix,projection:x.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:N,velocityConeAperture:p.velocityConeAperture,velocity:p.velocity,boxSize:z,rainDropletSize:[q,G],distortionStrength:p.distortionStrength,rainDirection:m,color:C,screenSize:[M.width,M.height],thinningCenterPos:[j,ie],thinningShape:[Q,te,Math.pow(10,p.screenThinning.fadePower)],thinningAffectedRatio:p.screenThinning.affectedRatio,thinningParticleOffset:X,shapeDirectionalPower:p.shapeDirPower,shapeNormalPower:p.shapeNormalPower,mode:O?0:1},{u_modelview:Float32Array.from(ne.modelview),u_projection:Float32Array.from(ne.projection),u_time:ne.time,u_cam_pos:ne.camPos,u_texScreen:0,u_velocityConeAperture:ne.velocityConeAperture,u_velocity:ne.velocity,u_boxSize:ne.boxSize,u_rainDropletSize:ne.rainDropletSize,u_distortionStrength:ne.distortionStrength,u_rainDirection:ne.rainDirection,u_color:ne.color,u_screenSize:ne.screenSize,u_thinningCenterPos:ne.thinningCenterPos,u_thinningShape:ne.thinningShape,u_thinningAffectedRatio:ne.thinningAffectedRatio,u_thinningParticleOffset:ne.thinningParticleOffset,u_shapeDirectionalPower:ne.shapeDirectionalPower,u_shapeNormalPower:ne.shapeNormalPower,u_mode:ne.mode});var ne;const ce=Math.round(p.intensity*this.particlesCount),de=s.bg.simpleSegment(0,0,4*ce,2*ce);A.draw(t,S.TRIANGLES,ut.disabled,vt.disabled,Et.alphaBlended,gt.disabled,Z,"rain_particles",this.particlesVx,this.particlesIdx,de)};p.distortionStrength>0&&L(p.boxSize,!0),L(p.boxSize,!1),this._vignette.draw(t,y)}}const Qc=s.ei([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_snowParticleData",components:4},{type:"Float32",name:"a_snowParticleDataHorizontalOscillation",components:2}]);class Bl extends Gh{constructor(t){super(2.25),this._params={overrideStyleParameters:!1,intensity:.85,timeFactor:.75,velocityConeAperture:70,velocity:40,horizontalOscillationRadius:4,horizontalOscillationRate:1.5,boxSize:2e3,billboardSize:2,shapeFadeStart:.27,shapeFadePower:.21,screenThinning:{intensity:.4,start:.15,range:1.4,fadePower:.24,affectedRatio:1,particleOffset:-.2},color:{r:1,g:1,b:1,a:1},direction:{x:-50,y:-35}},this._revealParams=new Uh("Precipitation > Snow"),this._vignetteParams={strength:.3,start:.78,range:.46,fadePower:.2,color:{r:1,g:1,b:1,a:1}},this.particlesCount=16e3}update(t){const o=t.context;if(!this.particlesVx){const c=kl(this.particlesCount),d=new s.eO,p=new s.b0;let m=0;const y=s.eq(1323123451230);for(let x=0;x<c.length;++x){const T=c[x],S=y(),M=y(),A=y(),C=[x/c.length,S,M,A],L=[y(),y()];d.emplaceBack(T[0],T[1],T[2],-1,-1,...C,...L),d.emplaceBack(T[0],T[1],T[2],1,-1,...C,...L),d.emplaceBack(T[0],T[1],T[2],1,1,...C,...L),d.emplaceBack(T[0],T[1],T[2],-1,1,...C,...L),p.emplaceBack(m+0,m+1,m+2),p.emplaceBack(m+0,m+2,m+3),m
2997+=4}this.particlesVx=o.createVertexBuffer(d,Qc.members),this.particlesIdx=o.createIndexBuffer(p)}}draw(t){if(!this._params.overrideStyleParameters&&!t.style.snow)return;const o=structuredClone(this._params);let c=[-o.direction.x,o.direction.y,-100];s.aw(c,c);const d=structuredClone(this._vignetteParams),p=o.overrideStyleParameters?this._revealParams:{revealStart:0,revealRange:.01},m=t.transform.zoom;if(p.revealStart>m)return;const y=bo(0,1,p.revealStart,p.revealStart+p.revealRange,m);d.strength*=y,o.overrideStyleParameters||(o.intensity=t.style.snow.state.density,o.timeFactor=t.style.snow.state.intensity,o.color=structuredClone(t.style.snow.state.color),c=structuredClone(t.style.snow.state.direction),o.screenThinning.intensity=t.style.snow.state.centerThinning,o.billboardSize=2.79*t.style.snow.state.flakeSize,d.strength=1,d.color=structuredClone(t.style.snow.state.vignetteColor));const x=this.updateOnRender(t,o.timeFactor);if(!this.particlesVx||!this.particlesIdx)return;const T=t.context,S=T.gl,M=t.transform,A=t.getOrCreateProgram("snowParticle");t.uploadCommonUniforms(T,A),((C,L,z)=>{const O=jh(this._movement.getPosition(),C),N=M.width/2,q=M.height/2,G=bo(0,z.screenThinning.start,0,1,z.screenThinning.intensity),j=bo(.001,z.screenThinning.range,0,1,z.screenThinning.intensity),ie=bo(0,z.screenThinning.particleOffset,0,1,z.screenThinning.intensity),Q=(te={modelview:x.modelviewMatrix,projection:x.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:O,velocityConeAperture:z.velocityConeAperture,velocity:z.velocity,horizontalOscillationRadius:z.horizontalOscillationRadius,horizontalOscillationRate:z.horizontalOscillationRate,boxSize:C,billboardSize:1*z.billboardSize,simpleShapeParameters:[z.shapeFadeStart,z.shapeFadePower],screenSize:[M.width,M.height],thinningCenterPos:[N,q],thinningShape:[G,j,Math.pow(10,z.screenThinning.fadePower)],thinningAffectedRatio:z.screenThinning.affectedRatio,thinningParticleOffset:ie,color:[z.color.r,z.color.g,z.color.b,z.color.a],direction:c},{u_modelview:Float32Array.from(te.modelview),u_projection:Float32Array.from(te.projection),u_time:te.time,u_cam_pos:te.camPos,u_velocityConeAperture:te.velocityConeAperture,u_velocity:te.velocity,u_horizontalOscillationRadius:te.horizontalOscillationRadius,u_horizontalOscillationRate:te.horizontalOscillationRate,u_boxSize:te.boxSize,u_billboardSize:te.billboardSize,u_simpleShapeParameters:te.simpleShapeParameters,u_screenSize:te.screenSize,u_thinningCenterPos:te.thinningCenterPos,u_thinningShape:te.thinningShape,u_thinningAffectedRatio:te.thinningAffectedRatio,u_thinningParticleOffset:te.thinningParticleOffset,u_particleColor:te.color,u_direction:te.direction});var te;const X=Math.round(z.intensity*this.particlesCount),Z=s.bg.simpleSegment(0,0,4*X,2*X);this.particlesVx&&this.particlesIdx&&A.draw(t,S.TRIANGLES,ut.disabled,vt.disabled,Et.alphaBlended,gt.disabled,Q,"snow_particles",this.particlesVx,this.particlesIdx,Z)})(o.boxSize,0,o),this._vignette.draw(t,d)}}const Js={symbol:function(l,t,o,c,d){if(l.renderPass!=="translucent")return;const p=vt.disabled,m=l.colorModeForRenderPass(),y=o.layout.get("text-variable-anchor"),x=o.layout.get("text-size-scale-range"),T=s.aA(l.scaleFactor,x[0],x[1]);y&&(function(A,C,L,z,O,N,q,G){const j=C.transform,ie=O==="map",Q=N==="map";for(const te of A){const X=z.getTile(te),Z=X.getBucket(L);if(!Z||!Z.text||!Z.text.segments.get().length)continue;const ne=s.bK(Z.textSizeData,j.zoom,G),ce=ga(te,Z.getProjection(),j),de=j.calculatePixelsToTileUnitsMatrix(X),ve=Us(ce,X.tileID.canonical,Q,ie,j,Z.getProjection(),de),ge=Z.hasIconTextFit()&&Z.hasIconData();ne&&Lf(Z,ie,Q,q,j,ve,te,Math.pow(2,j.zoom-X.tileID.overscaledZ),ne,ge)}})(c,l,o,t,o.layout.get("text-rotation-alignment"),o.layout.get("text-pitch-alignment"),d,T);const S=o.paint.get("icon-opacity").constantOr(1)!==0,M=o.paint.get("text-opacity").constantOr(1)!==0;o.layout.get("symbol-sort-key").constantOr(1)!==void 0&&(S||M)?Zc(l,t,o,c,p,m):(S&&Zc(l,t,o,c,p,m,{onlyIcons:!0}),M&&Zc(l,t,o,c,p,m,{onlyText:!0})),t.map.showCollisionBoxes&&(Th(l,t,o,c,o.paint.get("text-translate"),o.paint.get("text-translate-anchor"),!0),Th(l,t,o,c,o.paint.get("icon-translate"),o.paint.get("icon-translate-anchor"),!1))},circle:function(l,t,o,c){if(l.renderPass!=="translucent")return;const d=o.paint.get("circle-opacity"),p=o.paint.get("circle-stroke-width"),m=o.paint.get("circle-stroke-opacity"),y=o.layout.get("
vendor: 8,069 bytes, line 2997
2997circle-sort-key").constantOr(1)!==void 0,x=o.paint.get("circle-emissive-strength");if(d.constantOr(1)===0&&(p.constantOr(1)===0||m.constantOr(1)===0))return;const T=l.context,S=T.gl,M=l.transform,A=!(!l.terrain||!l.terrain.enabled),C=o.layout.get("circle-elevation-reference"),L=l.depthModeForSublayer(0,ut.ReadOnly),z=new ut(l.context.gl.LEQUAL,ut.ReadOnly,l.depthRangeFor3D),O=C==="none"||A?L:z,N=vt.disabled,q=l.colorModeForDrapableLayerRenderPass(x),G=M.projection.name==="globe",j=[s.aF(M.center.lng),s.aJ(M.center.lat)],ie=[];for(let te=0;te<c.length;te++){const X=c[te],Z=t.getTile(X),ne=Z.getBucket(o);if(!ne||ne.projection.name!==M.projection.name)continue;const ce=ne.programConfigurations.get(o.id),de=ne.layoutVertexBuffer,ve=ne.globeExtVertexBuffer,ge=ne.indexBuffer,Me=s.e0(o),Fe=[ve],pe=l.isTileAffectedByFog(X);G&&Me.push("PROJECTION_GLOBE_VIEW"),Me.push("DEPTH_D24"),l.terrain&&M.depthOcclusionForSymbolsAndCircles&&Me.push("DEPTH_OCCLUSION"),ne.hasElevation&&!l.terrain&&(Me.push("ELEVATED_ROADS"),Fe.push(ne.elevatedLayoutVertexBuffer));const oe=l.getOrCreateProgram("circle",{config:ce,defines:Me,overrideFog:pe}),Ie=M.projection.createInversionMatrix(M,X.canonical),be={programConfiguration:ce,program:oe,layoutVertexBuffer:de,dynamicBuffers:Fe,indexBuffer:ge,uniformValues:s.e1(l,X,Z,Ie,j,o),tile:Z};if(y){const ke=ne.segments.get();for(const Ue of ke)ie.push({segments:new s.bg([Ue]),sortKey:Ue.sortKey,state:be})}else ie.push({segments:ne.segments,sortKey:0,state:be})}y&&ie.sort((te,X)=>te.sortKey-X.sortKey);const Q={useDepthForOcclusion:M.depthOcclusionForSymbolsAndCircles};for(const te of ie){const{programConfiguration:X,program:Z,layoutVertexBuffer:ne,dynamicBuffers:ce,indexBuffer:de,uniformValues:ve,tile:ge}=te.state,Me=te.segments;l.terrain&&l.terrain.setupElevationDraw(ge,Z,Q),l.uploadCommonUniforms(T,Z,ge.tileID.toUnwrapped()),Z.draw(l,S.TRIANGLES,O,N,q,gt.disabled,ve,o.id,ne,de,Me,o.paint,M.zoom,X,ce)}},heatmap:function(l,t,o,c){if(o.paint.get("heatmap-opacity")!==0)if(l.renderPass==="offscreen"){const d=l.context,p=d.gl,m=vt.disabled,y=new Et([p.ONE,p.ONE,p.ONE,p.ONE],s.ao.transparent,[!0,!0,!0,!0]);(function(C,L,z,O){const N=C.gl,q=L.width*O,G=L.height*O;C.activeTexture.set(N.TEXTURE1),C.viewport.set([0,0,q,G]);let j=z.heatmapFbo;if(!j||j&&(j.width!==q||j.height!==G)){j&&j.destroy();const ie=N.createTexture();N.bindTexture(N.TEXTURE_2D,ie),N.texParameteri(N.TEXTURE_2D,N.TEXTURE_WRAP_S,N.CLAMP_TO_EDGE),N.texParameteri(N.TEXTURE_2D,N.TEXTURE_WRAP_T,N.CLAMP_TO_EDGE),N.texParameteri(N.TEXTURE_2D,N.TEXTURE_MIN_FILTER,N.LINEAR),N.texParameteri(N.TEXTURE_2D,N.TEXTURE_MAG_FILTER,N.LINEAR),j=z.heatmapFbo=C.createFramebuffer(q,G,1,null),(function(Q,te,X,Z,ne,ce){const de=Q.gl;de.texImage2D(de.TEXTURE_2D,0,Q.extRenderToTextureHalfFloat?de.RGBA16F:de.RGBA,ne,ce,0,de.RGBA,Q.extRenderToTextureHalfFloat?de.HALF_FLOAT:de.UNSIGNED_BYTE,null),Z.colorAttachment0.set(X)})(C,0,ie,j,q,G)}else N.bindTexture(N.TEXTURE_2D,j.colorAttachment0.get()),C.bindFramebuffer.set(j.framebuffer)})(d,l,o,l.transform.projection.name==="globe"?.5:.25),d.clear({color:s.ao.transparent});const x=l.transform,T=x.projection.name==="globe",S=T?["PROJECTION_GLOBE_VIEW"]:[],M=T?gt.frontCCW:gt.disabled,A=[s.aF(x.center.lng),s.aJ(x.center.lat)];for(let C=0;C<c.length;C++){const L=c[C];if(t.hasRenderableParent(L))continue;const z=t.getTile(L),O=z.getBucket(o);if(!O||O.projection.name!==x.projection.name)continue;const N=l.isTileAffectedByFog(L),q=O.programConfigurations.get(o.id),G=l.getOrCreateProgram("heatmap",{config:q,defines:S,overrideFog:N}),{zoom:j}=l.transform;l.terrain&&l.terrain.setupElevationDraw(z,G),l.uploadCommonUniforms(d,G,L.toUnwrapped());const ie=x.projection.createInversionMatrix(x,L.canonical);G.draw(l,p.TRIANGLES,ut.disabled,m,y,M,bh(l,L,z,ie,A,j,o.paint.get("heatmap-intensity")),o.id,O.layoutVertexBuffer,O.indexBuffer,O.segments,o.paint,l.transform.zoom,q,T?[O.globeExtVertexBuffer]:null)}d.viewport.set([0,0,l.width,l.height])}else l.renderPass==="translucent"&&(l.context.setColorMode(l.colorModeForRenderPass()),(function(d,p){const m=d.context,y=m.gl,x=p.heatmapFbo;if(!x)return;m.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,x.colorAttachment0.get()),m.activeTexture.set(y.TEXTURE1);let T=p.colorRampTexture;T||(T=p.colorRampTexture=new s.T(m,p.colorRamp,y.RGBA8)),T.bind(y.LINEAR,y.CLAMP_TO_EDGE),d.getOrCreateProgram("heatmapTexture").draw(d,y.TRIANGLES,ut.disabled,vt.disabled,d.colorModeForRenderPass(),gt.disabled,((S,M)=>({u_image:0,u_color_ramp:1,u_opacity:M.paint.get("heatmap-opacity")}))(0,p),p.id,d.viewportBuffer,d.quadTriangleIndexBuffer,d.viewportSegments,p.paint,d.transform.zoom)})(l,o))},line:function(l,t,o,c){if(l.renderPass!=="translucent")return;const d=o.paint.get("line-opacity"),p=o.paint.get("line-width");if(d.constantOr(1)===0||p.constantOr(1)===0)return;const m=o.paint.get("line-emissive-strength").isConstant(),y=o.paint.get("line-emissive-strength").constantOr(0),x=o.paint.get("line-occlusion-opacity"),T=o.layout.get("line-elevation-reference"),S=o.layout.get("line-width-unit")==="meters",M=T==="sea",A=!(!l.terrain||!l.terrain.enabled),C=l.context,L=C.gl;if(o.hasElevatedBuckets&&l.transform.projection.name==="globe")return;const z=o.layout.get("line-cross-slope"),O=z!==void 0,N=z<1,q=l.colorModeForDrapableLayerRenderPass(m?y:null),G=l.terrain&&l.terrain.renderingToTexture,j=G?1:s.o.devicePixelRatio,ie=o.paint.get("line-dasharray"),Q=ie.constantOr(1),te=o.layout.get("line-cap"),X=ie.constantOr(null),Z=te.constantOr(null),ne=o.paint.get("line-pattern"),ce=ne.constantOr(1),de=o.paint.get("line-pattern-cross-fade"),ve=ne.constantOr(null),ge=o.paint.get("line-opacity").constantOr(1);let Me=!ce&&ge!==1||l.depthOcclusion&&x>0&&x<1;const Fe=o.paint.get("line-gradient"),pe=ce?"linePattern":"line",oe=s.e2(o);let Ie;if(G&&l.terrain&&l.terrain.clipOrMaskOverlapStencilType()&&(Me=!1),x!==0&&l.depthOcclusion){const Ke=o.paint._values["line-opacity"];Ke&&Ke.value&&Ke.value.kind==="constant"?Ie=Ke.value:s.w(`Occlusion opacity for layer ${o.id} is supported only when line-opacity isn't data-driven.`)}p.value.kind!=="constant"&&p.value.isLineProgressConstant===!1&&oe.push("VARIABLE_LINE_WIDTH"),G&&(l.emissiveMode!=="dual-source-blending"||m?l.emissiveMode==="mrt-fallback"&&oe.push("USE_MRT1"):oe.push("DUAL_SOURCE_BLENDING"));const be=(Ke,je,He,lt,st,et)=>{for(const ot of Ke){const dt=t.getTile(ot);if(ce&&!dt.patternsLoaded())continue;const yt=dt.getBucket(o);if(!yt||yt.elevationType!=="none"&&!st||yt.elevationType==="none"&&st)continue;l.prepareDrawTile();const Pt=[...je],Vt=l.shadowRenderer,St=yt.elevationType==="road"&&!!Vt&&Vt.enabled;let Zt=[0,0,0];if(St){const Ct=l.style.directionalLight,pi=l.style.ambientLight;Ct&&pi&&(Zt=Xn(l.style,Ct,pi)),Pt.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET")}const It=yt.programConfigurations.get(o.id);let si=!1;if(ve&&dt.imageAtlas){const Ct=s.e3.from(ve),pi=Ct.getPrimary().scaleSelf(j).toString(),Ni=dt.imageAtlas.patternPositions.get(pi),gi=Ct.getSecondary(),bi=gi?dt.imageAtlas.patternPositions.get(gi.scaleSelf(j).toString()):null;si=!!Ni&&!!bi,Ni&&It.setConstantPatternPositions(Ni,bi)}de>0&&(si||It.getPatternTransitionVertexBuffer("line-pattern"))&&Pt.push("LINE_PATTERN_TRANSITION");const ri=l.isTileAffectedByFog(ot),ci=l.getOrCreateProgram(pe,{config:It,defines:Pt,overrideFog:ri});if(!ce&&X&&Z&&dt.lineAtlas){const Ct=dt.lineAtlas.getDash(X,Z);Ct&&It.setConstantPatternPositions(Ct)}St&&Vt.setupShadows(dt.tileID.toUnwrapped(),ci,"vector-tile");let[Ut,Mt]=o.paint.get("line-trim-offset");(Z==="round"||Z==="square")&&Ut!==Mt&&(Ut===0&&(Ut-=1),Mt===1&&(Mt+=1));const Jt=G?ot.projMatrix:null,Pi=S?1/yt.tileToMeter/s.ay(dt,1,l.transform.zoom):1,Ri=S?1/yt.tileToMeter/s.ay(dt,1,Math.floor(l.transform.zoom)):1,Qt=ce?s.e4(l,dt,o,Jt,j,Pi,Ri,[Ut,Mt],Zt,de):s.e5(l,dt,o,Jt,yt.lineClipsArray.length,j,Pi,Ri,[Ut,Mt],Zt);if(Fe){const Ct=yt.gradients[o.id];let pi=Ct.texture;if(o.gradientVersion!==Ct.version){let Ni=256;if(o.stepInterpolant){const gi=t.getSource().maxzoom,bi=ot.canonical.z===gi?Math.
2997ceil(1<<l.transform.maxZoom-ot.canonical.z):1;Ni=s.aA(s.e6(yt.maxLineLength/s.al*1024*bi),256,C.maxTextureSize)}Ct.gradient=s.e7({expression:o.gradientExpression(),evaluationKey:"lineProgress",resolution:Ni,image:Ct.gradient||void 0,clips:yt.lineClipsArray}),Ct.texture?Ct.texture.update(Ct.gradient):Ct.texture=new s.T(C,Ct.gradient,L.RGBA8),Ct.version=o.gradientVersion,pi=Ct.texture}C.activeTexture.set(L.TEXTURE1),pi.bind(o.stepInterpolant?L.NEAREST:L.LINEAR,L.CLAMP_TO_EDGE)}Q&&(C.activeTexture.set(L.TEXTURE0),dt.lineAtlasTexture&&dt.lineAtlasTexture.bind(L.LINEAR,L.REPEAT),It.updatePaintBuffers()),ce&&(C.activeTexture.set(L.TEXTURE0),dt.imageAtlasTexture&&dt.imageAtlasTexture.bind(L.LINEAR,L.CLAMP_TO_EDGE),It.updatePaintBuffers()),st&&!M&&l.terrain.setupElevationDraw(dt,ci),l.uploadCommonUniforms(C,ci,ot.toUnwrapped());const kt=Ct=>{Ie!=null&&(Ie.value=ge*x),ci.draw(l,L.TRIANGLES,He,Ct,q,gt.disabled,Qt,o.id,yt.layoutVertexBuffer,yt.indexBuffer,yt.segments,o.paint,l.transform.zoom,It,[yt.layoutVertexBuffer2,yt.patternVertexBuffer,yt.zOffsetVertexBuffer]),Ie!=null&&(Ie.value=ge)};if(Me&&!st){const Ct=l.stencilModeForClipping(ot).ref;Ct===0&&G&&C.clear({stencil:0});const pi={func:L.EQUAL,mask:255};Qt.u_alpha_discard_threshold=.8,kt(new vt(pi,Ct,255,L.KEEP,L.KEEP,L.INVERT)),Qt.u_alpha_discard_threshold=0,kt(new vt(pi,Ct,255,L.KEEP,L.KEEP,L.KEEP))}else Qt.u_alpha_discard_threshold=Me&&st&&et?.8:0,kt(st?lt:l.stencilModeForClipping(ot))}};let ke=l.depthModeForSublayer(0,ut.ReadOnly);const Ue=new ut(l.depthOcclusion?L.GREATER:L.LEQUAL,ut.ReadOnly,l.depthRangeFor3D);if(o.hasNonElevatedBuckets){const Ke=!G&&l.terrain;x!==0&&Ke?s.w(`Occlusion opacity for layer ${o.id} is supported on terrain only if the layer has line-z-offset enabled.`):Ke?s.w(`Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ${o.id}.`):be(c,oe,ke,vt.disabled,!1,!0)}if(o.hasElevatedBuckets){T==="hd-road-markup"?A||(ke=Ue,oe.push("ELEVATED_ROADS")):(oe.push("ELEVATED"),ke=Ue,O&&oe.push(N?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),M&&oe.push("ELEVATION_REFERENCE_SEA"));const Ke=Me?l.stencilModeFor3D():vt.disabled;l.forceTerrainMode=!0,be(c,oe,ke,Ke,!0,!0),Me&&be(c,oe,ke,Ke,!0,!1),l.forceTerrainMode=!1}Me&&(l.resetStencilClippingMasks(),G&&C.clear({stencil:0})),x===0||l.depthOcclusion||G||l.layersWithOcclusionOpacity.push(l.currentLayer)},fill:function(l,t,o,c){const d=o.paint.get("fill-color"),p=o.paint.get("fill-opacity");if(p.constantOr(1)===0)return;const m=o.paint.get("fill-emissive-strength"),y=l.colorModeForDrapableLayerRenderPass(m),x=o.paint.get("fill-pattern"),T=l.opaquePassEnabledForLayer()&&!x.constantOr(1)&&d.constantOr(s.ao.transparent).a===1&&p.constantOr(0)===1?"opaque":"translucent";let S="none";o.layout.get("fill-elevation-reference")!=="none"?S="road":o.paint.get("fill-z-offset").constantOr(1)!==0&&(S="offset");const M=!(!l.terrain||!l.terrain.enabled),A={painter:l,sourceCache:t,layer:o,coords:c,colorMode:y,elevationType:S,terrainEnabled:M,pass:T};if(l.renderPass==="shadow")return void(l.shadowRenderer&&S==="road"&&!M&&(function(L){const{painter:z,sourceCache:O,layer:N,coords:q}=L,G=z.context.gl,j=L.painter.shadowRenderer;for(const ie of q){const Q=O.getTile(ie),te=Q.getBucket(N);if(!te)continue;const X=te.elevatedStructures;if(!X||!X.shadowCasterSegments||X.shadowCasterSegments.segments[0].primitiveLength===0)continue;z.prepareDrawTile();const Z=te.bufferData.programConfigurations.get(N.id),ne=z.isTileAffectedByFog(ie),ce=z.getOrCreateProgram("elevatedStructuresDepth",{config:Z,overrideFog:ne}),de=j.calculateShadowPassMatrixFromTile(Q.tileID.toUnwrapped());z.uploadCommonUniforms(z.context,ce,ie.toUnwrapped());const ve=yh(de,0);ce.draw(z,G.TRIANGLES,j.getShadowPassDepthMode(),vt.disabled,j.getShadowPassColorMode(),gt.disabled,ve,N.id,X.vertexBuffer,X.indexBuffer,X.shadowCasterSegments,N.paint,z.transform.zoom,Z)}})(A));const C=l.emissiveMode==="mrt-fallback";if(S!=="offset"){if(za(A,!1,C),S==="road"){const L=!M&&l.renderPass==="translucent";L&&Eh(l,t,o,c,"geometry"),za(A,!0,C,vt.disabled),L&&(function(z){const{painter:O,sourceCache:N,layer:q,co
2997ords:G,colorMode:j}=z,ie=O.context.gl,Q=z.painter.shadowRenderer,te=!!Q&&Q.enabled,X=new ut(O.context.gl.LEQUAL,ut.ReadOnly,O.depthRangeFor3D);let Z=[0,0,0];if(te){const ce=O.style.directionalLight,de=O.style.ambientLight;ce&&de&&(Z=Xn(O.style,ce,de))}const ne=ce=>{for(const de of G){const ve=N.getTile(de),ge=ve.getBucket(q);if(!ge)continue;const Me=ge.elevatedStructures;if(!Me)continue;let Fe,pe;if(ce?(Fe=Me.renderableBridgeSegments,pe=Me.bridgeProgramConfigurations.get(q.id)):(Fe=Me.renderableTunnelSegments,pe=Me.tunnelProgramConfigurations.get(q.id)),!Fe||Fe.segments[0].primitiveLength===0)continue;pe.updatePaintBuffers(),O.prepareDrawTile();const oe=O.isTileAffectedByFog(de),Ie=[];te&&Ie.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET");const be=O.getOrCreateProgram("elevatedStructures",{config:pe,overrideFog:oe,defines:Ie}),ke=O.translatePosMatrix(de.projMatrix,ve,q.paint.get("fill-translate"),q.paint.get("fill-translate-anchor"));te&&Q.setupShadows(ve.tileID.toUnwrapped(),be,"vector-tile");const Ue=gs(ke,Z);O.uploadCommonUniforms(O.context,be,de.toUnwrapped()),be.draw(O,ie.TRIANGLES,X,vt.disabled,j,gt.backCCW,Ue,q.id,Me.vertexBuffer,Me.indexBuffer,Fe,q.paint,O.transform.zoom,pe,[Me.vertexBufferNormal])}};ne(!0),ne(!1)})(A)}}else za(A,!1,C,l.stencilModeFor3D())},"fill-extrusion":function(l,t,o,c){const d=o.paint.get("fill-extrusion-opacity"),p=l.context,m=p.gl,y=l.terrain,x=y&&y.renderingToTexture;if(d===0)return;const T=l.emissiveMode==="mrt-fallback",S=l.conflationActive&&l.style.isLayerClipped(o,t.getSource()),M=l.style.order.indexOf(o.fqid);if(S&&(function(A,C,L,z,O){for(const N of z){const q=C.getTile(N).getBucket(L);q&&(q.updateReplacement(N,A.replacementSource,O),q.uploadCentroid(A.context))}})(l,t,o,c,M),y||S)for(const A of c){const C=t.getTile(A).getBucket(o);C&&Ff(l.context,t,A,C,o,y,S)}if(l.renderPass==="shadow"&&l.shadowRenderer){const A=l.shadowRenderer;if(y&&d<.65&&o._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof s.ad)return;const C=A.getShadowPassDepthMode(),L=A.getShadowPassColorMode();Da(l,t,o,c,C,vt.disabled,L,S)}else if(l.renderPass==="translucent"){const A=!o.paint.get("fill-extrusion-pattern").constantOr(1),C=o.paint.get("fill-extrusion-color").constantOr(s.ao.white);if(!x&&C.a!==0){const L=new ut(l.context.gl.LEQUAL,ut.ReadWrite,l.depthRangeFor3D);d===1&&A?Da(l,t,o,c,L,vt.disabled,Et.unblended,S):(Da(l,t,o,c,L,vt.disabled,Et.disabled,S),Da(l,t,o,c,L,l.stencilModeFor3D(),l.colorModeForRenderPass(),S),l.resetStencilClippingMasks())}if(l.style.enable3dLights()&&A&&(!y&&l.transform.projection.name!=="globe"||x)){const L=o.paint.get("fill-extrusion-opacity"),z=o.paint.get("fill-extrusion-ambient-occlusion-intensity"),O=o.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),N=o.paint.get("fill-extrusion-flood-light-intensity"),q=o.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",G=o.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(q?null:o.lut).toArray01().slice(0,3),j=z>0&&O>0,ie=N>0,Q=(Z,ne,ce)=>(1-ce)*Z+ce*ne,te=new Ll;te.translate=o.paint.get("fill-extrusion-translate"),te.translateAnchor=o.paint.get("fill-extrusion-translate-anchor"),te.edgeRadius=o.layout.get("fill-extrusion-edge-radius"),te.cutoffFadeRange=o.paint.get("fill-extrusion-cutoff-fade-range");const X=Z=>{const ne=l.depthModeForSublayer(1,ut.ReadOnly,m.LEQUAL,!0),ce=o.paint.get(Z?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),de=Q(.1,3,ce),ve=l._showOverdrawInspector;if(!ve){const ge=new vt({func:m.ALWAYS,mask:255},255,255,m.KEEP,m.KEEP,m.REPLACE),Me=new Et([m.ONE,m.ONE,m.ONE,m.ONE],s.ao.transparent,[!1,!1,!1,!0],m.MIN);vo(te,l,t,o,c,ne,ge,Me,gt.disabled,Z,"sdf",L,z,O,N,G,de,S,!1)}{const ge=ve?vt.disabled:new vt({func:m.EQUAL,mask:255},255,255,m.KEEP,m.DECR,m.DECR),Me=ve?l.colorModeForRenderPass():new Et([m.ONE_MINUS_DST_ALPHA,m.DST_ALPHA,m.ONE,m.ONE],s.ao.transparent,[!0,!0,!0,!0]);vo(te,l,t,o,c,ne,ge,Me,gt.disabled,Z,"color",L,z,O,N,G,de,S,!1)}};if(x){const Z=()=>{const ce=y.drapeBufferSize[0],de=y.drapeBufferSize[1];let ve=y.framebufferCopyTexture;return ve&&(!ve||ve.size[0]===ce&&ve.size[1]===de)||(ve&&ve.destroy(),ve=y.framebufferCopyTexture=new s.T(p,new s.q({width:ce,height:de}),m.RGBA8)),ve.bind(m.LINEAR,m.CLAMP_TO_EDGE),m.copyTexSubImage2D(m.TEXTURE_2D,0,0,0,0,0,ce,de),ve},ne=(ce,de,ve)=>{const ge=l.depthModeForSublayer(1,ut.ReadOnly,m.LEQUAL,!1),Me=o.paint.get(ce?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),Fe=Q(.1,3,Me);{const pe=new Et([m.ONE,m.ONE,m.ONE,m.ONE],s.ao.transparent,[!1,!1,!1,!0]);vo(te,l,t,o,c,ge,vt.disabled,pe,gt.disabled,ce,"clear",L,z,O,N,G,Fe,S,de)}{const pe=new vt({func:m.ALWAYS,mask:255},255,255,m.KEEP,m.KEEP,m.REPLACE),oe=new Et([m.ONE,m.ONE,m.ONE,m.ONE],s.ao.transparent,[!1,!1,!1,!0],m.MIN);vo(te,l,t,o,c,ge,pe,oe,gt.disabled,ce,"sdf",L,z,O,N,G,Fe,S,de)}T&&!ce&&(ve=Z());
2997{const pe=ce?m.ZERO:m.ONE_MINUS_DST_ALPHA,oe=new vt({func:m.EQUAL,mask:255},255,255,m.KEEP,m.DECR,m.DECR),Ie=new Et([pe,m.DST_ALPHA,m.ONE_MINUS_DST_ALPHA,m.ZERO],s.ao.transparent,[!0,!0,!0,!0]);vo(te,l,t,o,c,ge,oe,Ie,gt.disabled,ce,"color",L,z,O,N,G,Fe,S,de)}if(!T||ce){const pe=new Et([m.ONE,m.ONE,m.ONE,ce?m.ZERO:m.ONE],s.ao.transparent,[!1,!1,!1,!0],ce?m.FUNC_ADD:m.MAX);vo(te,l,t,o,c,ge,vt.disabled,pe,gt.disabled,ce,"clear",L,z,O,N,G,Fe,S,de,ve)}else{m.drawBuffers([m.NONE,m.COLOR_ATTACHMENT1]);const pe=new vt({func:m.EQUAL,mask:255},254,255,m.KEEP,m.DECR,m.DECR),oe=new Et([m.ONE,m.ONE,m.ONE,m.ONE],s.ao.transparent,[!0,!1,!1,!1],m.MAX);vo(te,l,t,o,c,ge,pe,oe,gt.disabled,ce,"emissive",L,z,O,N,G,Fe,S,de,ve),m.drawBuffers([m.COLOR_ATTACHMENT0])}};if(j||ie){let ce;l.prepareDrawTile(),T&&!j||(ce=Z()),j&&ne(!0,!1,ce),ie&&ne(!1,!0,ce)}}else j&&X(!0),ie&&X(!1),(j||ie)&&l.resetStencilClippingMasks()}}},building:function(l,t,o,c){l.currentLayer<l.firstLightBeamLayer&&(l.firstLightBeamLayer=l.currentLayer);const d=o.paint.get("building-ambient-occlusion-ground-intensity"),p=o.paint.get("building-ambient-occlusion-ground-radius"),m=o.paint.get("building-ambient-occlusion-ground-attenuation"),y=o.paint.get("building-opacity");if(y<=0)return;let x=d>0&&p>0,T=!0;const S=o.paint.get("building-vertical-scale");if(S<=0)return;l.shadowRenderer||(T=!1);const M=l.conflationActive&&l.style.isLayerClipped(o,t.getSource()),A=l.style.order.indexOf(o.fqid);if((function(C,L,z,O,N,q){for(const G of q){const j=L.getTile(G).getBucket(z);j&&(N&&j.updateReplacement(G,C.replacementSource,O),j.uploadUpdatedIndexBuffer(C.context))}})(l,t,o,A,M,c),(function(C,L,z,O){for(const N of O){const q=L.getTile(N).getBucket(z);q&&q.needsEvaluation()&&q.uploadUpdatedColorBuffer(C.context)}})(l,t,o,c),o.resetLayerRenderingStats(l),l.shadowRenderer&&(l.shadowRenderer.useNormalOffset=!0),l.renderPass==="shadow"&&l.shadowRenderer){const C=l.shadowRenderer,L=[],z=C.getShadowPassDepthMode();La({painter:l,source:t,layer:o,coords:c,defines:L,blendMode:C.getShadowPassColorMode(),depthMode:z,opacity:y,verticalScale:S,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}else if(l.renderPass==="translucent"){let C=["HAS_ATTRIBUTE_a_part_color_emissive","LIGHTING_3D_MODE"];T&&(C=C.concat("RENDER_SHADOWS","DEPTH_TEXTURE")),l.shadowRenderer&&l.shadowRenderer.useNormalOffset&&(C=C.concat("NORMAL_OFFSET"));const L=o.paint.get("building-facade-emissive-chance"),z=o.paint.get("building-ambient-occlusion-intensity"),O=o.paint.get("building-flood-light-intensity"),N=o.paint.get("building-flood-light-color-use-theme").constantOr("default")==="none",q=o.paint.get("building-flood-light-color").toNonPremultipliedRenderColor(N?null:o.lut).toArray01().slice(0,3),G=o.paint.get("building-flood-light-ground-attenuation"),j=O>0,ie=new ut(l.context.gl.LEQUAL,ut.ReadWrite,l.depthRangeFor3D);y<1&&La({painter:l,source:t,layer:o,coords:c,defines:C,blendMode:Et.disabled,depthMode:ie,opacity:y,verticalScale:S,facadeEmissiveChance:L,facadeAOIntensity:z,floodLightIntensity:O,floodLightColor:q,depthOnly:!0});const Q=l.colorModeForRenderPass();La({painter:l,source:t,layer:o,coords:c,defines:C,blendMode:Q,depthMode:ie,opacity:y,verticalScale:S,facadeEmissiveChance:L,facadeAOIntensity:z,floodLightIntensity:O,floodLightColor:q}),x&&Xc(l,t,o,c,!0,y,d,p,O,q,m,M),j&&Xc(l,t,o,c,!1,y,d,p,O,q,G,M)}else if(l.renderPass==="light-beam"){const C=["HAS_ATTRIBUTE_a_part_color_emissive","HAS_ATTRIBUTE_a_bloom_attenuation"],L=new ut(l.context.gl.LEQUAL,ut.ReadOnly,l.depthRangeFor3D);La({painter:l,source:t,layer:o,coords:c,defines:C,blendMode:Et.alphaBlended,depthMode:L,opacity:y,verticalScale:S,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}l.shadowRenderer&&(l.shadowRenderer.useNormalOffset=!1),l.resetStencilClippingMasks()},hillshade:function(l,t,o,c){if(l.renderPass!=="offscreen"&&l.renderPass!=="translucent"||l.style.disableElevatedTerrain)return;const d=l.context,p=l.terrain&&l.terrain.renderingToTexture,[m,y]=l.renderPass!=="translucent"||p?[{},c]:l.stencilConfigForOverlap(c);for(const x of y){const T=t.getTile(x);
2997if(T.needsHillshadePrepare&&l.renderPass==="offscreen")zm(l,T,o);else if(l.renderPass==="translucent"){const S=l.depthModeForSublayer(0,ut.ReadOnly),M=o.paint.get("hillshade-emissive-strength"),A=l.colorModeForDrapableLayerRenderPass(M),C=p&&l.terrain?l.terrain.stencilModeForRTTOverlap(x):m[x.overscaledZ];Rm(l,x,T,o,S,C,A)}}d.viewport.set([0,0,l.width,l.height]),l.resetStencilClippingMasks()},raster:function(l,t,o,c,d,p){if(l.renderPass!=="translucent"||o.paint.get("raster-opacity")===0)return;const m=l.transform.projection.name==="globe",y=o.paint.get("raster-elevation")!==0,x=y&&m;if(l.renderElevatedRasterBackface&&!x)return;const T=l.context,S=T.gl,M=t.getSource(),A=(function(Q,te,X,Z,ne){const ce=te.paint.get("raster-color"),de=Q.type==="raster-array",ve=[],ge=te.paint.get("raster-resampling"),Me=te.paint.get("raster-color-mix");let Fe=te.paint.get("raster-color-range");const pe=[Me[0],Me[1],Me[2],0],oe=Me[3];let Ie=ge==="nearest"?Z.NEAREST:Z.LINEAR;if(de&&(ve.push("RASTER_ARRAY"),ce||ve.push("RASTER_COLOR"),ge==="linear"&&ve.push("RASTER_ARRAY_LINEAR"),Ie=Z.NEAREST,!Fe&&Q.rasterLayers)){const be=Q.rasterLayers.find(({id:ke})=>ke===te.sourceLayer);be&&be.fields&&be.fields.range&&(Fe=be.fields.range)}if(Fe=Fe||[0,1],ce){ve.push("RASTER_COLOR"),X.activeTexture.set(Z.TEXTURE2),te.updateColorRamp(Fe);let be=te.colorRampTexture;be||(be=te.colorRampTexture=new s.T(X,te.colorRamp,Z.RGBA8)),be.bind(Ie,Z.CLAMP_TO_EDGE)}return ne&&ve.push("USE_MRT1"),{mix:pe,range:Fe,offset:oe,defines:ve,resampling:Ie}})(M,o,T,S,l.terrain&&l.terrain.renderingToTexture&&l.emissiveMode==="mrt-fallback");if(M instanceof s.aU&&!c.length&&!m)return;const C=o.paint.get("raster-emissive-strength"),L=l.colorModeForDrapableLayerRenderPass(C),z=l.terrain&&l.terrain.renderingToTexture,O=!l.options.moving,N=o.paint.get("raster-resampling")==="nearest"?S.NEAREST:S.LINEAR;if(M instanceof s.aU&&!c.length&&(M.onNorthPole||M.onSouthPole)){const Q=y?l.stencilModeFor3D():vt.disabled;return void Yc(!!M.onNorthPole,null,l,t,o,C,A,gt.disabled,Q)}if(!c.length)return;const[q,G]=M instanceof s.aU||z?[{},c]:l.stencilConfigForOverlap(c),j=G[G.length-1].overscaledZ;x&&A.defines.push("PROJECTION_GLOBE_VIEW"),y&&A.defines.push("RENDER_CUTOFF");const ie=(Q,te,X)=>{for(const Z of Q){const ne=Z.toUnwrapped(),ce=t.getTile(Z);if(z&&(!ce||!ce.hasData()))continue;T.activeTexture.set(S.TEXTURE0);const de=Vf(ce,M,o,A);if(!de||!de.texture)continue;const{texture:ve,mix:ge,offset:Me,tileSize:Fe,buffer:pe}=de;let oe,Ie;z?(oe=ut.disabled,Ie=Z.projMatrix):y?(oe=new ut(S.LEQUAL,ut.ReadWrite,l.depthRangeFor3D),Ie=m?Float32Array.from(l.transform.expandedFarZProjMatrix):l.transform.calculateProjMatrix(ne,O)):(oe=l.depthModeForSublayer(Z.overscaledZ-j,o.paint.get("raster-opacity")===1?ut.ReadWrite:ut.ReadOnly,S.LESS),Ie=l.transform.calculateProjMatrix(ne,O));const be=l.terrain&&z?l.terrain.stencilModeForRTTOverlap(Z):q[Z.overscaledZ],ke=p?0:o.paint.get("raster-fade-duration");ce.registerFadeDuration(ke);const Ue=t.findLoadedParent(Z,0),Ke=Cl(ce,Ue,t,l.transform,ke);let je,He;!Ke.isFading&&ce.refreshedUponExpiration&&(ce.refreshedUponExpiration=!1),l.terrain&&l.terrain.prepareDrawTile(),T.activeTexture.set(S.TEXTURE0),ve.bind(N,S.CLAMP_TO_EDGE),T.activeTexture.set(S.TEXTURE1),Ue?(Ue.texture&&Ue.texture.bind(N,S.CLAMP_TO_EDGE),je=Math.pow(2,Ue.tileID.overscaledZ-ce.tileID.overscaledZ),He=[ce.tileID.canonical.x*je%1,ce.tileID.canonical.y*je%1]):ve.bind(N,S.CLAMP_TO_EDGE),"useMipmap"in ve&&T.extTextureFilterAnisotropic&&l.transform.pitch>20&&S.texParameterf(S.TEXTURE_2D,T.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,T.extTextureFilterAnisotropicMax);const lt=l.transform;let st;const et=y?Nf(lt):[0,0,0,0];let ot,dt,yt,Pt,Vt,St=0;if(x&&M instanceof s.aU&&M.coordinates.length>3)ot=Float32Array.from(s.bk(s.dJ(new s.cD(0,0,0)))),dt=Float32Array.from(lt.globeMatrix),yt=Float32Array.from(s.dF(lt)),Pt=[s.aF(lt.center.lng),s.aJ(lt.center.lat)],st=M.elevatedGlobePerspectiveTransform,Vt=M.elevatedGlobeGridMatrix||new Float32Array(9);else if(x){const ri=s.dG(Z.canonical);St=s.dH(ri.getCenter().lat),ot=Float32Array.from(s.bk(s.dJ(Z.canonical))),dt=Float32Array.from(lt.globeMatrix),yt=Float32Array.from(s.dF(lt)),Pt=[s.aF(lt.center.lng),s.aJ(lt.center.lat)],st=[0,0],Vt=Float32Array.from(s.dI(Z.canonical,ri,St,lt.worldSize/lt._pixelsPerMercatorPixel))}else st=M instanceof s.aU?M.perspectiveTransform:[0,0],ot=new Float32Array(16),dt=new Float32Array(9),yt=new Float32Array(16),Pt=[0,0],Vt=new Float32Array(9);const Zt=wh(Ie,ot,dt,yt,Vt,He||[0,0],s.aj(l.transform.zoom),Pt,et,je||1,Ke,o,st,y?o.paint.get("raster-elevation"):0,2,ge,Me,A.range,Fe,pe,C),It=l.isTileAffectedByFog(Z),si=l.getOrCreateProgram("raster",{defines:A.defines,overrideFog:It});if(l.uploadCommonUniforms(T,si,ne),M instanceof s.aU){const ri=M.elevatedGlobeVertexBuffer,ci=M.elevatedGlobeIndexBuffer;if(z||!m)M.boundsBuffer&&M.boundsSegments&&si.draw(l,S.TRIANGLES,oe,vt.disabled,L,gt.disabled,Zt,o.id,M.boundsBuffer,l.quadTriangleIndexBuffer,M.boundsSegments);else if(ri&&ci){const Ut=lt.zoom<=s.c_?M.elevatedGlobeSegments:M.getSegmentsForLongitude(lt.center.lng);Ut&&si.draw(l,S.TRIANGLES,oe,vt.disabled,L,te,Zt,o.id,ri,ci,Ut)}}else if(x){oe=new ut(S.LEQUAL,ut.ReadOnly,l.depthRangeFor3D);const ri=l.globeSharedBuffers;if(ri){const[ci,Ut,Mt]=ri.getGridBuffers(St,!1);si.draw(l,S.TRIANGLES,oe,X||be,l.colorModeForRenderPass(),te,Zt,o.id,ci,Ut,Mt)}}else{const{tileBoundsBuffer:ri,tileBoundsIndexBuffer:ci,tileBoundsSegments:Ut}=l.getTileBoundsBuffers(ce);si.draw(l,S.TRIANGLES,oe,be,L,gt.disabled,Zt,o.id,ri,ci,Ut)}}if(!(M instanceof s.aU)&&x)for(const Z of Q){const ne=Z.canonical.y===(1<<Z.canonical.z)-1;Z.canonical.y===0&&Yc(!0,Z,l,t,o,C,A,te,X||vt.disabled),ne&&Yc(!1,Z,l,t,o,C,A,te===gt.frontCW?gt.backCW:gt.frontCW,X||vt.disabled)}};x?ie(G,l.renderElevatedRasterBackface?gt.backCW:gt.frontCW,l.stencilModeFor3D()):ie(G,gt.disabled,void 0),l.resetStencilClippingMasks()},"raster-particle":function(l,t,o,c,d,p){l.renderPass==="offscreen"&&(function(m,y,x,T){if(!T.length)return;const S=m.context,M=S.gl,A=y.getSource();if(!(A instanceof Wr))return;const C=Math.ceil(Math.sqrt(x.paint.get("raster-particle-count")));let L=x.particlePositionRGBAImage;if(!L||L.width!==C){const G=(function(j){const ie=j*j,Q=new Uint8Array(4*ie),te=function(Z){return Z|=0,Z=Math.imul(2747636419^Z,2654435769),Z=Math.imul(Z^Z>>>16,2654435769),((Z=Math.imul(Z^Z>>>16,2654435769))>>>0)/4294967296},X=.9090909090909091;for(let Z=0;Z<ie;Z++){const ne=X*(te(2*Z+0)+Ra),ce=X*(te(2*Z+1)+Ra),de=255*ne%1,ve=255*ce%1,ge=de,Me=ce-ve/255,Fe=ve;Q[4*Z+0]=255*(ne-de/255),Q[4*Z+1]=255*ge,Q[4*Z+2]=255*Me,Q[4*Z+3]=255*Fe}return Q})(C);L=x.particlePositionRGBAImage=new s.q({width:C,height:C},G)}let z=x.particleFramebuffer;z?z.width!==C&&(z.destroy(),z=x.particleFramebuffer=S.createFramebuffer(C,C,1,null)):z=x.particleFramebuffer=S.createFramebuffer(C,C,1,null);const O=[];for(const G of T){const j=y.getTile(G);if(!(j instanceof dc))continue;const ie=Ch(j,A,x);if(!ie)continue;const Q=[j.tileSize,j.tileSize];let te=x.tileFramebuffer;te||(te=x.tileFramebuffer=S.createFramebuffer(Q[0],Q[1],1,null));let X=j.rasterParticleState;X||(X=j.rasterParticleState=new Uf(S,G,Q,L));const Z=X.update(x.lastInvalidatedAt);X.particleTextureDimension!==C&&X.updateParticleTexture(G,L);const ne=X.targetColorTexture;X.targetColorTexture=X.backgroundColorTexture,X.backgroundColorTexture=ne;const ce=X.particleTexture0;X.particleTexture0=X.particleTexture1,X.particleTexture1=ce,O.pu
vendor: 5,556 bytes, line 2997
2997sh([G,ie,X,Z])}if(O.length===0)return;const N=s.o.now(),q=x.previousDrawTimestamp?.001*(N-x.previousDrawTimestamp):.0167;if(x.previousDrawTimestamp=N,x.hasColorMap()){S.activeTexture.set(M.TEXTURE0+2);let G=x.colorRampTexture;G||(G=x.colorRampTexture=new s.T(S,x.colorRamp,M.RGBA8)),G.bind(M.LINEAR,M.CLAMP_TO_EDGE)}S.bindFramebuffer.set(x.tileFramebuffer.framebuffer),(function(G,j,ie){const Q=G.context,te=Q.gl,X=j.tileFramebuffer;Q.activeTexture.set(te.TEXTURE0);const Z={u_texture:0,u_opacity:1.05*(ce=j.paint.get("raster-particle-fade-opacity-factor"))/(ce+.05)},ne=G.getOrCreateProgram("rasterParticleTexture",{defines:[],overrideFog:!1});var ce;for(const de of ie){const[,,ve,ge]=de;X.colorAttachment0.set(ve.targetColorTexture.texture),Q.viewport.set([0,0,X.width,X.height]),Q.clear({color:s.ao.transparent}),ge&&(ve.backgroundColorTexture.bind(te.NEAREST,te.CLAMP_TO_EDGE),ne.draw(G,te.TRIANGLES,ut.disabled,vt.disabled,Et.alphaBlended,gt.disabled,Z,j.id,G.viewportBuffer,G.quadTriangleIndexBuffer,G.viewportSegments))}})(m,x,O),(function(G,j,ie,Q){const te=G.context,X=te.gl,Z=ie.tileFramebuffer,ne=G.transform.projection.name==="globe",ce=ie.paint.get("raster-particle-max-speed");for(const de of Q){const[ve,ge,Me]=de;te.activeTexture.set(X.TEXTURE0+0),ge.texture.bind(X.LINEAR,X.CLAMP_TO_EDGE),Z.colorAttachment0.set(Me.targetColorTexture.texture);const Fe=G.getOrCreateProgram("rasterParticleDraw",{defines:ge.defines,overrideFog:!1});te.activeTexture.set(X.TEXTURE0+1);const pe=ge.scalarData?[]:[0,1,2,3].map(be=>s.e9[be](ve));pe.push(ve);const oe=ve.canonical.x,Ie=ve.canonical.y;for(const be of pe){const ke=j.getTile(ne?be.wrapped():be);if(!ke)continue;const Ue=ke.rasterParticleState;if(!Ue)continue;const Ke=be.canonical.x+(1<<be.canonical.z)*(be.wrap-ve.wrap),je=be.canonical.y;Ue.particleTexture0.bind(X.NEAREST,X.CLAMP_TO_EDGE);const He=Rf(1,Ue.particleTexture0.size[0],[Ke-oe,je-Ie],0,ge.texture.size,2,ce,ge.textureOffset,ge.scale,ge.offset);Fe.draw(G,X.POINTS,ut.disabled,vt.disabled,Et.alphaBlended,gt.disabled,He,ie.id,Ue.particleIndexBuffer,void 0,Ue.particleSegment)}}})(m,y,x,O),S.bindFramebuffer.set(x.particleFramebuffer.framebuffer),(function(G,j,ie,Q){const te=G.context,X=te.gl,Z=j.paint.get("raster-particle-max-speed"),ne=Q*j.paint.get("raster-particle-speed-factor")*.15,ce=(function(ve){return Math.pow(ve,6)})(.01+1*j.paint.get("raster-particle-reset-rate-factor")),de=j.particleFramebuffer;te.viewport.set([0,0,de.width,de.height]);for(const ve of ie){const[,ge,Me]=ve;te.activeTexture.set(X.TEXTURE0+0),ge.texture.bind(X.LINEAR,X.CLAMP_TO_EDGE),te.activeTexture.set(X.TEXTURE0+1);const Fe=Me.particleTexture0;Fe.bind(X.NEAREST,X.CLAMP_TO_EDGE);const pe=Um(1,Fe.size[0],0,ge.texture.size,Z,ne,ce,ge.textureOffset,ge.scale,ge.offset);de.colorAttachment0.set(Me.particleTexture1.texture),te.clear({color:s.ao.transparent}),G.getOrCreateProgram("rasterParticleUpdate",{defines:ge.defines}).draw(G,X.TRIANGLES,ut.disabled,vt.disabled,Et.unblended,gt.disabled,pe,j.id,G.viewportBuffer,G.quadTriangleIndexBuffer,G.viewportSegments)}})(m,x,O,q)})(l,t,o,c),l.renderPass==="translucent"&&((function(m,y,x,T){const S=m.context,M=S.gl,A=y.getSource().tileSize,C=5*(1-s.ah(s.cL,s.cL+1,m.transform.zoom))*A+x.paint.get("raster-particle-elevation"),L=!m.options.moving,z=m.transform.projection.name==="globe";if(!T.length)return;const[O,N]=m.stencilConfigForOverlap(T),q=[];z&&q.push("PROJECTION_GLOBE_VIEW");const G=m.stencilModeFor3D();for(const j of N){const ie=j.toUnwrapped(),Q=y.getTile(j);if(!Q.rasterParticleState)continue;const te=Q.rasterParticleState,X=100;Q.registerFadeDuration(X);const Z=y.findLoadedParent(j,0),ne=Cl(Q,Z,y,m.transform,X);let ce,de;m.terrain&&m.terrain.prepareDrawTile(),S.activeTexture.set(M.TEXTURE0),te.targetColorTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE),S.activeTexture.set(M.TEXTURE1),Z&&Z.rasterParticleState?(Z.rasterParticleState.targetColorTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE),ce=Math.pow(2,Z.tileID.overscaledZ-Q.tileID.overscaledZ),de=[Q.tileID.canonical.x*ce%1,Q.tileID.canonical.y*ce%1]):te.targetColorTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE);const ve=z?Float32Array.from(m.transform.expandedFarZProjMatrix):m.transform.calculateProjMatrix(ie,L),ge=m.transform,Me=jf(ge),Fe=s.dG(j.canonical),pe=s.dH(Fe.getCenter().lat);let oe,Ie,be,ke,Ue;z?(oe=Float32Array.from(s.bk(s.dJ(j.canonical))),Ie=Float32Array.from(ge.globeMatrix),be=Float32Array.from(s.dF(ge)),ke=[s.aF(ge.center.lng),s.aJ(ge.center.lat)],Ue=Float32Array.from(s.dI(j.canonical,Fe,pe,ge.worldSize/ge._pixelsPerMercatorPixel))):(oe=new Float32Array(16),Ie=new Float32Array(9),be=new Float32Array(16),ke=[0,0],Ue=new Float32Array(9));const Ke=Vm(ve,oe,Ie,be,Ue,de||[0,0],s.aj(m.transform.zoom),ke,Me,ce||1,ne,C),je=m.isTileAffectedByFog(j),He=m.getOrCreateProgram("rasterParticle",{defines:q,overrideFog:je});if(m.uploadCommonUniforms(S,He,ie),z){const lt=new ut(M.LEQUAL,ut.ReadOnly,m.depthRangeFor3D),st=0,et=m.globeSharedBuffers;if(et){const[ot,dt,yt]=et.getGridBuffers(pe,st!==0);He.draw(m,M.TRIANGLES,lt,G,Et.alphaBlended,m.renderElevatedRasterBackface?gt.frontCCW:gt.backCCW,Ke,x.id,ot,dt,yt)}}else{const lt=m.depthModeForSublayer(0,ut.ReadOnly),st=O[j.overscaledZ],{tileBoundsBuffer:et,tileBoundsIndexBuffer:ot,tileBoundsSegments:dt}=m.getTileBoundsBuffers(Q);He.draw(m,M.TRIANGLES,lt,st,Et.alphaBlended,gt.disabled,Ke,x.id,et,ot,dt)}}m.resetStencilClippingMasks()})(l,t,o,c),l.style.map.triggerRepaint())},background:function(l,t,o,c){const d=o.paint.get("background-color"),p=o.paint.get("background-color-use-theme").
2997constantOr("default")==="none",m=o.paint.get("background-opacity"),y=o.paint.get("background-emissive-strength"),x=o.paint.get("background-pitch-alignment")==="viewport";if(m===0)return;const T=l.context,S=T.gl,M=l.transform,A=M.tileSize,C=o.paint.get("background-pattern");let L;if(C!==void 0&&(C===null||(L=l.imageManager.getPattern(s.I.from(C.toString()),o.scope,l.style.getLut(o.scope)),!L)))return;const z=!C&&d.a===1&&m===1&&l.opaquePassEnabledForLayer()?"opaque":"translucent";if(l.renderPass!==z)return;const O=vt.disabled,N=l.depthModeForSublayer(0,z==="opaque"?ut.ReadWrite:ut.ReadOnly),q=l.colorModeForDrapableLayerRenderPass(y),G=C?"backgroundPattern":"background";let j,ie=c;ie||(j=l.getBackgroundTiles(),ie=Object.values(j).map(te=>te.tileID)),C&&(T.activeTexture.set(S.TEXTURE0),l.imageManager.bind(l.context,o.scope));const Q=[];if(l.terrain&&l.terrain.renderingToTexture&&l.emissiveMode==="mrt-fallback"&&Q.push("USE_MRT1"),x){const te=l.getOrCreateProgram(G,{overrideFog:!1,overrideRtt:!0,defines:Q}),X=new Float32Array(s.bA([])),Z=new s.aQ(0,0,0,0,0),ne=C?zl(X,y,m,l,0,o.scope,L,x,{tileID:Z,tileSize:A}):xs(X,y,m,d.toPremultipliedRenderColor(p?null:o.lut));return void te.draw(l,S.TRIANGLES,N,O,q,gt.disabled,ne,o.id,l.viewportBuffer,l.quadTriangleIndexBuffer,l.viewportSegments)}for(const te of ie){const X=l.isTileAffectedByFog(te),Z=l.getOrCreateProgram(G,{overrideFog:X,defines:Q}),ne=te.toUnwrapped(),ce=c?te.projMatrix:l.transform.calculateProjMatrix(ne);l.prepareDrawTile();const de=t?t.getTile(te):j?j[te.key]:new ls(te,A,M.zoom,l),ve=C?zl(ce,y,m,l,0,o.scope,L,x,{tileID:te,tileSize:A}):xs(ce,y,m,d.toPremultipliedRenderColor(p?null:o.lut));l.uploadCommonUniforms(T,Z,ne);const{tileBoundsBuffer:ge,tileBoundsIndexBuffer:Me,tileBoundsSegments:Fe}=l.getTileBoundsBuffers(de);Z.draw(l,S.TRIANGLES,N,O,q,gt.disabled,ve,o.id,ge,Me,Fe)}},sky:function(l,t,o){const c=l._atmosphere?s.aj(l.transform.zoom):1,d=o.paint.get("sky-opacity")*c;if(d===0)return;const p=l.context,m=o.paint.get("sky-type"),y=new ut(p.gl.LEQUAL,ut.ReadOnly,[0,1]),x=l.frameCounter/1e3%1;m==="atmosphere"?l.renderPass==="offscreen"?o.needsSkyboxCapture(l)&&((function(T,S){const M=T.context,A=M.gl;let C=S.skyboxFbo;if(!C){C=S.skyboxFbo=M.createFramebuffer(32,32,1,null),S.skyboxGeometry=new pn(M),S.skyboxTexture=M.gl.createTexture(),A.bindTexture(A.TEXTURE_CUBE_MAP,S.skyboxTexture),A.texParameteri(A.TEXTURE_CUBE_MAP,A.TEXTURE_WRAP_S,A.CLAMP_TO_EDGE),A.texParameteri(A.TEXTURE_CUBE_MAP,A.TEXTURE_WRAP_T,A.CLAMP_TO_EDGE),A.texParameteri(A.TEXTURE_CUBE_MAP,A.TEXTURE_MIN_FILTER,A.LINEAR),A.texParameteri(A.TEXTURE_CUBE_MAP,A.TEXTURE_MAG_FILTER,A.LINEAR);for(let N=0;N<6;++N)A.texImage2D(A.TEXTURE_CUBE_MAP_POSITIVE_X+N,0,A.RGBA,32,32,0,A.RGBA,A.UNSIGNED_BYTE,null)}M.bindFramebuffer.set(C.framebuffer),M.viewport.set([0,0,32,32]);const L=S.getCenter(T,!0),z=T.getOrCreateProgram("skyboxCapture"),O=new Float64Array(16);s.bA(O),s.en(O,O,.5*-Math.PI),ws(T,S,z,O,L,0),s.bA(O),s.en(O,O,.5*Math.PI),ws(T,S,z,O,L,1),s.bA(O),s.cU(O,O,.5*-Math.PI),ws(T,S,z,O,L,2),s.bA(O),s.cU(O,O,.5*Math.PI),ws(T,S,z,O,L,3),s.bA(O),ws(T,S,z,O,L,4),s.bA(O),s.en(O,O,Math.PI),ws(T,S,z,O,L,5),M.viewport.set([0,0,T.width,T.height])})(l,o),o.markSkyboxValid(l)):l.renderPass==="sky"&&(function(T,S,M,A,C){const L=T.context,z
vendor: 4,887 bytes, line 2997
2997=L.gl,O=T.transform,N=T.getOrCreateProgram("skybox");L.activeTexture.set(z.TEXTURE0),z.bindTexture(z.TEXTURE_CUBE_MAP,S.skyboxTexture);const q=((G,j,ie,Q,te)=>({u_matrix:G,u_sun_direction:j,u_cubemap:0,u_opacity:Q,u_temporal_offset:te}))(O.skyboxMatrix,S.getCenter(T,!1),0,A,C);T.uploadCommonUniforms(L,N),N.draw(T,z.TRIANGLES,M,vt.disabled,T.colorModeForRenderPass(),gt.backCW,q,"skybox",S.skyboxGeometry.vertexBuffer,S.skyboxGeometry.indexBuffer,S.skyboxGeometry.segment)})(l,o,y,d,x):m==="gradient"&&l.renderPass==="sky"&&(function(T,S,M,A,C){const L=T.context,z=L.gl,O=T.transform,N=T.getOrCreateProgram("skyboxGradient");S.skyboxGeometry||(S.skyboxGeometry=new pn(L)),L.activeTexture.set(z.TEXTURE0);let q=S.colorRampTexture;q||(q=S.colorRampTexture=new s.T(L,S.colorRamp,z.RGBA8)),q.bind(z.LINEAR,z.CLAMP_TO_EDGE);const G=((j,ie,Q,te,X)=>({u_matrix:j,u_color_ramp:0,u_center_direction:ie,u_radius:s.an(Q),u_opacity:te,u_temporal_offset:X}))(O.skyboxMatrix,S.getCenter(T,!1),S.paint.get("sky-gradient-radius"),A,C);T.uploadCommonUniforms(L,N),N.draw(T,z.TRIANGLES,M,vt.disabled,T.colorModeForRenderPass(),gt.backCW,G,"skyboxGradient",S.skyboxGeometry.vertexBuffer,S.skyboxGeometry.indexBuffer,S.skyboxGeometry.segment)})(l,o,y,d,x)},custom:function(l,t,o,c){const d=l.context,p=o.implementation;if(!l.transform.projection.unsupportedLayers||!l.transform.projection.unsupportedLayers.includes("custom")||l.terrain&&(l.terrain.renderingToTexture||l.renderPass==="offscreen")&&o.isDraped(t)){if(l.renderPass==="offscreen"){const m=p.prerender;if(m){if(l.setCustomLayerDefaults(),d.setColorMode(l.colorModeForRenderPass()),l.transform.projection.name==="globe"){const y=l.transform.pointMerc;m.call(p,d.gl,l.transform.customLayerMatrix(),l.transform.getProjection(),l.transform.globeToMercatorMatrix(),s.aj(l.transform.zoom),[y.x,y.y],l.transform.pixelsPerMeterRatio)}else m.call(p,d.gl,l.transform.customLayerMatrix());d.setDirty(),l.setBaseState()}}else if(l.renderPass==="translucent"){if(l.terrain&&l.terrain.renderingToTexture){const y=p.renderToTile;if(y){const x=c[0].canonical,T={x:x.x+c[0].wrap*(p.wrapTileId?0:1<<x.z),y:x.y,z:x.z};d.setDepthMode(ut.disabled),d.setStencilMode(vt.disabled),d.setColorMode(l.colorModeForRenderPass()),l.setCustomLayerDefaults(),y.call(p,d.gl,T),d.setDirty(),l.setBaseState()}return}l.setCustomLayerDefaults(),d.setColorMode(l.colorModeForRenderPass()),d.setStencilMode(vt.disabled);const m=p.renderingMode==="3d"?new ut(l.context.gl.LEQUAL,ut.ReadWrite,l.depthRangeFor3D):l.depthModeForSublayer(0,ut.ReadOnly);if(d.setDepthMode(m),l.transform.projection.name==="globe"){const y=l.transform.pointMerc;p.render(d.gl,l.transform.customLayerMatrix(),l.transform.getProjection(),l.transform.globeToMercatorMatrix(),s.aj(l.transform.zoom),[y.x,y.y],l.transform.pixelsPerMeterRatio)}else p.render(d.gl,l.transform.customLayerMatrix());d.setDirty(),l.setBaseState(),d.bindFramebuffer.set(null)}}else s.w("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers.")},model:function(l,t,o,c){if(l.renderPass==="opaque")return;const d=o.paint.get("model-opacity").constantOr(1),p=o.paint.get("model-elevation-reference"),m=p==="ground",y=p==="ground";if(d===0)return;const x=o.paint.get("model-cast-shadows");if(l.renderPass==="shadow"&&(!x||l.terrain&&d<.65&&o._transitionablePaint._values["model-opacity"].value.expression instanceof s.ad))return;const T=l.shadowRenderer,S=o.paint.get("model-receive-shadows");T&&(T.useNormalOffset=!0,S||(T.enabled=!1));const M=()=>{T&&(T.useNormalOffset=!0,S||(T.enabled=!0))},A=t.getSource();if(l.renderPass==="light-beam"&&A.type!=="batched-model")return;if(A.type==="vector"||A.type==="geojson")return(function(j,ie,Q,te,X){const Z=j.transform,ne=Z.projection.name==="globe",ce=Z.getFreeCameraOptions().position;if(!j.modelManager)return;const de=j.modelManager;Q.modelManager=de;const ve=j.shadowRenderer;if(!Q._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const ge=Q._unevaluatedLayout._values["model-id"],Me=Object.assign({},Q.layout.get("model-id").parameters),Fe=j.style.order.indexOf(Q.fqid),pe=Q.paint.get("model-opacity").constantOr(1);for(const oe of te){const Ie=ie.getTile(oe).getBucket(Q);if(!Ie||Ie.projection.name!==Z.projection.name)continue;const be=Ie.getModelUris();if(be&&!Ie.modelsRequested&&(de.addModelsFromBucket(be,X),Ie.modelsRequested=!0),ne)Me.zoom=oe.overscaledZ;else{const et=Ge(oe,Z);Me.zoom=et}const ke=ge.possiblyEvaluate(Me);if(Ks(j,Ie,oe),Jr.shadowUniformsInitialized=!1,Jr.useSingleShadowCascade=!!ve&&ve.getMaxCascadeForTile(oe.toUnwrapped())===0,j.renderPass==="shadow"&&ve){if(j.currentShadowCascade===1&&Ie.isInsideFirstShadowMapFrustum)continue;const et=Z.calculatePosMatrix(oe.toUnwrapped(),Z.worldSize);if(Jr.tileMatrix.set(et),Jr.shadowTileMatrix=Float32Array.from(ve.calculateShadowPassMatrixFromMatr
2997ix(et)),Jr.aabb.min=[0,0,0],Jr.aabb.max[0]=Jr.aabb.max[1]=s.al,Jr.aabb.max[2]=0,Bi(Ie,Jr,j,Q.scope))continue}const Ue=1<<oe.canonical.z,Ke=[((ce.x-oe.wrap)*Ue-oe.canonical.x)*s.al,(ce.y*Ue-oe.canonical.y)*s.al,ce.z*Ue*s.al];j.conflationActive&&Object.keys(Ie.instancesPerModel).length>0&&j.style.isLayerClipped(Q,ie.getSource())&&Ie.updateReplacement(oe,j.replacementSource,Fe,Q.scope)&&(Ie.uploaded=!1,Ie.upload(j.context));let je=0;const He=new Array,lt=new Array,st=new Array;for(let et in Ie.instancesPerModel){const ot=Ie.instancesPerModel[et];ot.features.length>0&&!ne&&(et=ke.evaluate(ot.features[0].feature,{}));const dt=de.getModel(et,X);if(dt||de.hasURLBeenRequested(et)||Ie.modelUris.includes(et)||(Ie.modelUris.push(et),Ie.modelsRequested=!1),dt&&dt.uploaded)if(ne){const yt=s.c5([],[ce.x,ce.y,ce.z],j.transform.worldSize);s.ew(yt,yt);for(let Pt=0;Pt<ot.instancedDataArray.length;++Pt){const Vt=[0,0,0],St=[1,1,1],Zt=s.ex(),It=ot.tileCoordinatesForInstance(Pt),si=ot.transformForInstance(Pt);s.ey(St,si),s.ez(Zt,si),s.eA(Vt,Zt);const ri=ot.translationForInstance(Pt),ci=new s.aT(0,0);s.eB(Ie.canonical,ci,It.x,It.y);const Ut=s.bC();s.eC(Ut,dt,j.transform,ci,Vt,St,ri,!0,!1,!1);const Mt=ot.colorForInstance(Pt),Jt=s.bA([]),Pi=s.ef(ci.lat,j.transform.zoom),Ri=s.bq([],[1,1,1/Pi]);s.br(Jt,Jt,yt),st.push({zScaleMatrix:Ri,negCameraPosMatrix:Jt});for(const Qt of dt.nodes)Ol(j,Qt,Ut,j.transform.expandedFarZProjMatrix,je,He,lt,dt.materialOverrides,pe,Mt);++je}}else for(const yt of dt.nodes)Je(j,Q,yt,ot,Ke,oe,Jr)}if(ne)if(j.renderPass==="shadow"){for(const et of lt)Fa(et.mesh,et.nodeModelMatrix,j,Q);for(const et of He)Fa(et.mesh,et.nodeModelMatrix,j,Q)}else Bh(j,Q,He,lt,st)}})(l,t,o,c,Fl(l,o)),void M();if(!A.loaded())return;if(A.type==="batched-model")return(function(j,ie,Q,te){Q.resetLayerRenderingStats(j);const X=j.context,Z=j.transform,ne=j.style.fog,ce=j.shadowRenderer;if(Z.projection.name!=="mercator")return void s.w(`Drawing 3D landmark models for ${Z.projection.name} projection is not yet implemented`);const de=j.transform.getFreeCameraOptions().position,ve=s.c5([],[de.x,de.y,de.z],j.transform.worldSize),ge=s.ew([],ve),Me=s.bA([]),Fe=s.ef(Z.center.lat,Z.zoom),pe=s.bq([],[1,1,1/Fe]);s.br(Me,Me,ge);const oe=Q.paint.get("model-opacity").constantOr(1),Ie=new ut(X.gl.LEQUAL,ut.ReadWrite,j.depthRangeFor3D),be=new ut(X.gl.LEQUAL,ut.ReadOnly,j.depthRangeFor3D),ke=new s.d9([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),Ue=j.renderPass==="shadow",Ke=Ue&&ce?ce.getCurrentCascadeFrustum():Z.getFrustum(Z.scaleZoom(Z.worldSize)),je=Q.paint.get("model-front-cutoff"),He=je[2]<1,lt=Wn(j,Q.paint.get("model-cutoff-fade-range")),st=Q.getLayerRenderingStats();(function(et,ot,dt,yt){const Pt=et.terrain?et.terrain.exaggeration():0,Vt=et.transform.zoom;for(const St of yt){const Zt=ot.getTile(St).getBucket(dt);Zt&&(Zt.setFilter(dt.filter),et.conflationActive&&Zt.updateReplacement(St,et.replacementSource),Zt.evaluateTransform(et,dt),et.terrain&&Pt>0&&Zt.elevationUpdate(et.terrain,Pt,St,dt.source),Zt.needsReEvaluation(et,Vt,dt)&&Zt.evaluate(dt))}})(j,ie,Q,te),(function(){let et,ot,dt;He?(et=te.length-1,ot=-1,dt=-1):(et=0,ot=te.length,dt=1);const yt=new Float64Array(16),Pt=s.cA(),Vt=new s.P(0,0);for(let St=et;St!==ot;St+=dt){const Zt=te[St],It=ie.getTile(Zt).getBucket(Q);if(!It||!It.uploaded)continue;let si=!1;ce&&(si=ce.getMaxCascadeForTile(Zt.toUnwrapped())===0);const ri=Z.calculatePosMatrix(Zt.toUnwrapped(),Z.worldSize),ci=It.modelTraits;!Ue&&He&&(s.bl(yt,ri),s.af(Pt,ve,yt),Vt.x=Pt[0],Vt.y=Pt[1]);const Ut=[];It.setFilter(Q.filter);for(const Mt of It.getNodesInfo()){if(Mt.hiddenByReplacement||!Mt.node.meshes)continue;const Jt=Mt.node;let Pi=0;j.terrain&&Jt.elevation&&(Pi=Jt.elevation*j.terrain.exaggeration());const Ri=(()=>{const ei=Mt.aabb;return ke.min=[...ei.min],ke.max=[...ei.max],ke.min[2]+=Pi,ke.max[2]+=Pi,s.af(ke.min,ke.min,ri),s.af(ke.max,ke.max,ri),ke})(),Qt=Mt.evaluatedScale;if(Qt[0]<=1&&Qt[1]<=1&&Qt[2]<=1&&Ri.intersects(Ke)===0)continue;if(!Ue&&He){const ei=.16666666666666666;Mt.cameraCollisionOpacity=ve[0]>Ri.min[0]&&ve[0]<Ri.max[0]&&ve[1]>Ri.min[1]&&ve[1]<Ri.max[1]&&ve[2]*Fe<Ri.max[2]&&Jt.footprint&&s.c0(Vt,Jt.footprint)?Math.max(Mt.cameraCollisionOpacity-ei,0):Math.min(1,Mt.cameraCollisionOpacity+ei)}const kt=[...ri],Ct=1/s.d7(Zt.canonical),pi=Jt.anchor?Jt.anchor[0]:0,Ni=Jt.anchor?Jt.anchor[1]:0;s.br(kt,kt,[pi*(Qt[0]-1)+Mt.evaluatedTranslation[0]*Ct,Ni*(Qt[1]-1)+Mt.evaluatedTranslation[1]*Ct,Pi+Mt.evaluatedTranslation[2]]),s.cq(Qt,s.eE)||s.cS(kt,kt,Qt);const gi=s.aB([],kt,Jt.globalMatrix),bi=s.aB([],Z.expandedFarZProjMatrix,gi),en=s.aB([],Z.expandedFarZProjMatrix,kt),mn=s.aC([],[pi,Ni,Pi,1],bi)[2];Jt.hidden=!1;let xr=oe;Ue||(He&&(xr*=Mt.cameraCollisionOpacity,xr*=Xf(kt,Z,Mt.aabb,je)),xr*=fe(lt,mn)),xr!==0?Ut.push({nodeInfo:Mt,depth:mn,opacity:xr,wvpForNode:bi,wvpForTile:en,nodeModelMatrix:gi,tileModelMatrix:kt}):Jt.hidden=!0}Ue||Ut.sort((Mt,Jt)=>!He||Mt.opacity===1&&Jt.opacity===1?Mt.depth<Jt.depth?-1:1:Mt.opacity===1?-1:Jt.opacity===1?1:Mt.depth>Jt.depth?-1:1);for(const Mt of Ut){const Jt=Mt.nodeInfo,Pi=Jt.node;let Ri=s.aB([],pe,Mt.tileModelMatrix);s.aB(Ri,Me,Ri);const Qt=s.bl([],Ri);s.eg(Qt,Qt),s.cS(Qt,Qt,Oa),Ri=s.aB(Ri,Ri,Pi.globalMatrix);const kt=j.renderPass==="light-beam",Ct=Q.paint.get("model-color-use-theme").
2997constantOr("default")==="none",pi=ci&s.eI.HasMapboxMeshFeatures,Ni=pi?0:Jt.evaluatedRMEA[0][2];for(let gi=0;gi<Pi.meshes.length;++gi){const bi=Pi.meshes[gi],en=gi===Pi.lightMeshIndex;let mn=Mt.wvpForNode;if(en){if(!kt&&!j.terrain&&j.shadowRenderer){j.currentLayer<j.firstLightBeamLayer&&(j.firstLightBeamLayer=j.currentLayer);continue}mn=Mt.wvpForTile}else if(kt)continue;const xr={defines:[]},ei=[];if(!Ue&&ce&&(ce.useNormalOffset=!!bi.normalBuffer),oo(xr.defines,ei,bi,j,Ct?null:Q.lut),pi||xr.defines.push("DIFFUSE_SHADED"),si&&xr.defines.push("SHADOWS_SINGLE_CASCADE"),st&&(Ue?st.numRenderedVerticesInShadowPass+=bi.vertexArray.length:st.numRenderedVerticesInTransparentPass+=bi.vertexArray.length),Ue){Fa(bi,Mt.nodeModelMatrix,j,Q);continue}let wn=null;if(ne){const Ki=kh(Mt.nodeModelMatrix,j.transform);if(wn=new Float32Array(Ki),Z.projection.name!=="globe"){const yi=bi.aabb.min,rr=bi.aabb.max,[kr,$i]=ne.getOpacityForBounds(Ki,yi[0],yi[1],rr[0],rr[1]);xr.overrideFog=kr>=rt||$i>=rt}}const Dr=bi.material;let tn;Dr.occlusionTexture&&Dr.occlusionTexture.offsetScale&&(tn=Dr.occlusionTexture.offsetScale,xr.defines.push("OCCLUSION_TEXTURE_TRANSFORM"));const Kn=j.getOrCreateProgram("model",xr);!Ue&&ce&&ce.setupShadowsFromMatrix(Mt.tileModelMatrix,Kn,ce.useNormalOffset),j.uploadCommonUniforms(X,Kn,null,wn);const rn=Dr.pbrMetallicRoughness;rn.metallicFactor=.9,rn.roughnessFactor=.5;const Di=qc(new Float32Array(mn),new Float32Array(Ri),new Float32Array(Qt),new Float32Array(Pi.globalMatrix),j,Mt.opacity,rn.baseColorFactor,Dr.emissiveFactor,rn.metallicFactor,rn.roughnessFactor,Dr,Ni,Q,[0,0,0],tn);!en&&(Jt.hasTranslucentParts||Mt.opacity<1)&&Kn.draw(j,X.gl.TRIANGLES,Ie,vt.disabled,Et.disabled,gt.backCCW,Di,Q.id,bi.vertexBuffer,bi.indexBuffer,bi.segments,Q.paint,j.transform.zoom,void 0,ei),Kn.draw(j,X.gl.TRIANGLES,en?be:Ie,vt.disabled,en||Mt.opacity<1||Jt.hasTranslucentParts?Et.alphaBlended:Et.unblended,gt.backCCW,Di,Q.id,bi.vertexBuffer,bi.indexBuffer,bi.segments,Q.paint,j.transform.zoom,void 0,ei)}}}})()})(l,t,o,c),void M();if(A.type!=="model")return;const C=A.getModels(),L=[],z=l.transform.getFreeCameraOptions().position,O=s.c5([],[z.x,z.y,z.z],l.transform.worldSize);s.ew(O,O);const N=[],q=[];let G=0;for(const j of C){const ie=t.getFeatureState("",j.id),Q={type:"Unknown",id:j.id,properties:j.featureProperties},te=o.paint.get("model-rotation").evaluate(Q,ie),X=o.paint.get("model-scale").evaluate(Q,ie),Z=o.paint.get("model-translation").evaluate(Q,ie),ne=o.paint.get("model-opacity").evaluate(Q,ie);Zf(o,j.id,ie,j.featureProperties,j.nodeOverrideNames,j.nodeOverrides),Wf(o,j.id,ie,j.featureProperties,j.materialOverrideNames,j.materialOverrides),j.nodeOverrides.size>0&&j.computeBoundsAndApplyParent(),j.computeModelMatrix(l,te,X,Z,y,m,!1);const ce=s.bA([]),de=s.ef(j.position.lat,l.transform.zoom),ve=s.bq([],[1,1,1/de]);s.br(ce,ce,O),L.push({zScaleMatrix:ve,negCameraPosMatrix:ce});for(const ge of j.nodes)Ol(l,ge,j.matrix,l.transform.expandedFarZProjMatrix,G,N,q,j.materialOverrides,ne);G++}if(N.sort((j,ie)=>ie.depth-j.depth),l.renderPass!=="shadow")Bh(l,o,N,q,L),M();else{for(const j of q)Fa(j.mesh,j.nodeModelMatrix,l,o);for(const j of N)Fa(j.mesh,j.nodeModelMatrix,l,o);M()}}},qh={line:function(l,t,o){if(l.hasElevatedBuckets=!1,l.hasNonElevatedBuckets=!1,l._unevaluatedLayout.getValue("line-elevation-reference")!==void 0||l._unevaluatedLayout.getValue("line-z-offset")!==void 0){if(t){const c=t.getVisibleCoordinates();for(const d of c){const p=t.getTile(d).getBucket(l);if(p&&(p.elevationType!=="none"?l.hasElevatedBuckets=!0:l.hasNonElevatedBuckets=!0,l.hasElevatedBuckets&&l.hasNonElevatedBuckets))break}}}else l.hasNonElevatedBuckets=!0},model:function(l,t,o){const c=t.getSource();if(!c.loaded())return;if(c.type==="vector"||c.type==="geojson")return void(o.modelManager&&o.modelManager.upload(o,Fl(o,l)));if(c.type==="batched-model"||c.type!=="model")return;const d=c.getModels();for(const p of d)p.upload(o.context)},raster:function(l,t,o){const c=t.getSource();if(!(c instanceof Wr&&c.loaded()))return;const d=l.sourceLayer||c.rasterLayerIds&&c.rasterLayerIds[0];if(!d)return;const p=l.paint.get("raster-array-band")||c.getInitialBand(d);if(p==null)return;const m=t.getIds().map(y=>t.getTileByID(y));for(const y of m)y.updateNeeded(l.id,p)&&c.prepareTile(y,d,l.id,p)},"raster-particle":function(l,t,o){const c=t.getSource();if(!(c instanceof Wr&&c.loaded()))return;const d=l.sourceLayer||c.rasterLayerIds&&c.rasterLayerIds[0];if(!d)return;const p=l.paint.get("raster-particle-array-band")||c.getInitialBand(d);if(p==null)return;const m=t.getIds().map(y=>t.getTileByID(y));for(const y of m)y.updateNeeded(l.id,p)&&c.prepareTile(y,d,l.id,p)}},Hh={fill:Eh},Jf={fill:function(l,t,o,c){if(!o.layout||o.layout.get("fill-elevation-reference")==="none"||o.paint.get("fill-opacity").constantOr(1)===0)return;const d=l.context.gl,p=new ut(d.LEQUAL,ut.ReadOnly,l.depthRangeFor3D),m=new vt({func:d.ALWAYS,mask:255},255,255,d.KEEP,d.KEEP,d.REPLACE),y=l.transform.getFreeCameraOptions().position,x=l.getOrCreateProgram("elevatedStructuresDepthReconstruct");for(const T of c){const S=t.getTile(T),M=S.getBucket(o);if(!M)continue;const A=M.elevatedStructures;if(!A||A.depthSegments.segments[0].primitiveLength===0)continue;const C=Sh(T.toUnwrapped(),y),L=l.translatePosMatrix(T.projMatrix,S,o.paint.get("fill-translate"),o.paint.get("fill-translate-anchor")),z=Ws(L,C,0,1,0);x.draw(l,d.TRIANGLES,p,m,Et.disabled,gt.disabled,z,o.id,A.vertexBuffer,A.indexBuffer,A.depthSegments,o.paint,l.transform.zoom)}}};class Qf{constructor(t,o,c,d,p){this.context=new $c(t,o),this.transform=c,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this._timeStamp=s.o.now(),this._averageFPS=0,this._fpsHistory=[],this._dt=0,this._debugParams={forceEnablePrecipitation:!1,showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,enabledLayers:{}};const m=["fill","line","symbol","circle","heatmap","fill-extrusion","building","raster","raster-particle","hillshade","model","background","sky"];for(const x of m)this._debugParams.enabledLayers[x]=!0;for(const x of m);this.occlusionParams=new Vh,this.setup(),this.numSublayers=ln.maxUnderzooming+ln.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new s.eP,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new vl(this),this._wireframeDebugCache=new Nh,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const y=new s.q({width:1,height:1},Uint8Array.of(0,0,0,0));
2997this.emptyDepthTexture=new s.T(this.context,y,t.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=d,this.worldview=p,this._forceEmissiveMode=!1,this.emissiveMode="constant"}updateTerrain(t,o){const c=!!t&&!!t.terrain&&this.transform.projection.supportsTerrain;if(!(c||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new mh(this,t));const d=this._terrain;this.transform.elevation=c?d:null,d.update(t,this.transform,o),this.transform.elevation&&!d.enabled&&(this.transform.elevation=null)}_updateFog(t){const o=t.fog;if(!o||this.transform.projection.name==="globe"||o.getOpacity(this.transform.pitch)<1||o.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[c,d]=o.getFovAdjustedRange(this.transform._fov);if(c>d)return void(this.transform.fogCullDistSq=null);const p=c+.78*(d-c);this.transform.fogCullDistSq=p*p}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled||this._forceTerrainMode?this._terrain:null}get forceTerrainMode(){return this._forceTerrainMode}set forceTerrainMode(t){t&&!this._terrain&&(this._terrain=new mh(this,this.style)),this._forceTerrainMode=t}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(t,o){if(this.width=t*s.o.devicePixelRatio,this.height=o*s.o.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const c of this.style.order)this.style._mergedLayers[c].resize()}setup(){const t=this.context,o=new s.bd;o.emplaceBack(0,0),o.emplaceBack(s.al,0),o.emplaceBack(0,s.al),o.emplaceBack(s.al,s.al),this.tileExtentBuffer=t.createVertexBuffer(o,s.bf.members),this.tileExtentSegments=s.bg.simpleSegment(0,0,4,2);const c=new s.bd;c.emplaceBack(0,0),c.emplaceBack(s.al,0),c.emplaceBack(0,s.al),c.emplaceBack(s.al,s.al),this.debugBuffer=t.createVertexBuffer(c,s.bf.members),this.debugSegments=s.bg.simpleSegment(0,0,4,5);const d=new s.bd;d.emplaceBack(-1,-1),d.emplaceBack(1,-1),d.emplaceBack(-1,1),d.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(d,s.bf.members),this.viewportSegments=s.bg.simpleSegment(0,0,4,2);const p=new s.b1;p.emplaceBack(0,0,0,0),p.emplaceBack(s.al,0,s.al,0),p.emplaceBack(0,s.al,0,s.al),p.emplaceBack(s.al,s.al,s.al,s.al),this.mercatorBoundsBuffer=t.createVertexBuffer(p,s.bi.members),this.mercatorBoundsSegments=s.bg.simpleSegment(0,0,4,2);const m=new s.b0;m.emplaceBack(0,1,2),m.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(m);const y=new s.be;for(const T of[0,1,3,2,0])y.emplaceBack(T);this.debugIndexBuffer=t.createIndexBuffer(y),this.emptyTexture=new s.T(t,new s.q({width:1,height:1},Uint8Array.of(0,0,0,0)),t.gl.RGBA8),this.identityMat=s.bC();const x=this.context.gl;this.stencilClearMode=new vt({func:x.ALWAYS,mask:0},0,255,x.ZERO,x.ZERO,x.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(t){return t._makeTileBoundsBuffers(this.context,this.transform.projection),t._tileBoundsBuffer?{tileBoundsBuffer:t._tileBoundsBuffer,tileBoundsIndexBuffer:t._tileBoundsIndexBuffer,tileBoundsSegments:t._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const t=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,t.TRIANGLES,ut.disabled,this.stencilClearMode,Et.disabled,gt.disabled,Ml(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(t,o,c){if(!o||this.currentStencilSource===o.id||!t.isTileClipped()||!c||c.length===0)return;if(this._tileClippingMaskIDs&&!this.terrain){let y=!1;for(const x of c)if(this._tileClippingMaskIDs[x.key]===void 0){y=!0;break}if(!y)return}this.currentStencilSource=o.id;const d=this.context,p=d.gl;this.nextStencilID+c.length>256&&this.clearStencil(),d.setColorMode(Et.disabled),d.setDepthMode(ut.disabled);const m=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const y of c){const x=o.getTile(y),T=this._tileClippingMaskIDs[y.key]=this.nextStencilID++,{tileBoundsBuffer:S,tileBoundsIndexBuffer:M,tileBoundsSegments:A}=this.getTileBoundsBuffers(x);m.draw(this,p.TRIANGLES,ut.disabled,new vt({func:p.ALWAYS,mask:0},T,255,p.KEEP,p.KEEP,p.REPLACE),Et.disabled,gt.disabled,Ml(y.projMatrix),"$clipping",S,M,A)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,o=this.context.gl;return new vt({func:o.NOTEQUAL,mask:255},t,255,o.KEEP,o.KEEP,o.REPLACE)}stencilModeForClipping(t){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(t);const o=this.context.gl;return new vt({func:o.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,o.KEEP,o.KEEP,o.REPLACE)}stencilConfigForOverlap(t){const o=this.context.gl,c=t.sort((m,y)=>
2997y.overscaledZ-m.overscaledZ),d=c[c.length-1].overscaledZ,p=c[0].overscaledZ-d+1;if(p>1){this.currentStencilSource=void 0,this.nextStencilID+p>256&&this.clearStencil();const m={};for(let y=0;y<p;y++)m[y+d]=new vt({func:o.GEQUAL,mask:255},y+this.nextStencilID,255,o.KEEP,o.KEEP,o.REPLACE);return this.nextStencilID+=p,[m,c]}return[{[d]:vt.disabled},c]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new Et([t.CONSTANT_COLOR,t.ONE,t.CONSTANT_COLOR,t.ONE],new s.ao(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Et.unblended:Et.alphaBlended}colorModeForDrapableLayerRenderPass(t){const o=this.context.gl;return this.style&&this.style.enable3dLights()&&this.terrain&&this.terrain.renderingToTexture&&this.renderPass==="translucent"?t!=null&&this.emissiveMode!=="mrt-fallback"||this.emissiveMode==="constant"?new Et([o.ONE,o.ONE_MINUS_SRC_ALPHA,o.CONSTANT_ALPHA,o.ONE_MINUS_SRC_ALPHA],new s.ao(0,0,0,t??0),[!0,!0,!0,!0]):this.emissiveMode==="dual-source-blending"?new Et([o.ONE,o.ONE_MINUS_SRC_ALPHA,this.context.extBlendFuncExtended.SRC1_ALPHA_WEBGL,o.ONE_MINUS_SRC_ALPHA],s.ao.transparent,[!0,!0,!0,!0]):this.colorModeForRenderPass():this.colorModeForRenderPass()}depthModeForSublayer(t,o,c,d=!1){if(this.depthOcclusion)return new ut(this.context.gl.GREATER,ut.ReadOnly,this.depthRangeFor3D);if(!this.opaquePassEnabledForLayer()&&!d)return ut.disabled;const p=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new ut(c||this.context.gl.LEQUAL,o,[p,p])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}blitDepth(){const t=this.context.gl,o=Math.ceil(this.width),c=Math.ceil(this.height),d=this.context.bindFramebuffer.get(),p=t.getParameter(t.TEXTURE_BINDING_2D);this.depthFBO&&this.depthFBO.width===o&&this.depthFBO.height===c||(this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),o!==0&&c!==0&&(this.depthFBO=new Ys(this.context,o,c,0,"texture"),this.depthTexture=new s.T(this.context,{width:o,height:c,data:null},t.DEPTH24_STENCIL8),this.depthFBO.depthAttachment.set(this.depthTexture.texture))),this.context.bindFramebuffer.set(d),t.bindTexture(t.TEXTURE_2D,p),this.depthFBO&&(t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,this.depthFBO.framebuffer),t.blitFramebuffer(0,0,o,c,0,0,o,c,t.DEPTH_BUFFER_BIT,t.NEAREST),t.bindFramebuffer(t.FRAMEBUFFER,this.context.bindFramebuffer.current))}updateAverageFPS(){this._fpsHistory.push(this._dt===0?0:1e3/this._dt),this._fpsHistory.length>this._debugParams.fpsWindow&&this._fpsHistory.splice(0,this._fpsHistory.length-this._debugParams.fpsWindow),this._averageFPS=Math.round(this._fpsHistory.reduce((t,o)=>t+o/this._fpsHistory.length,0))}render(t,o){const c=s.o.now();this._dt=c-this._timeStamp,this._timeStamp=c,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=t.map.repaint,this.style=t,this.options=o;const d=this.style._mergedLayers,p=!(!this.terrain||!this.terrain.enabled),m=()=>this.style._getOrder(p).filter(pe=>{const oe=d[pe];return!(oe.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[oe.type]});let y=m(),x=!1,T=!1,S=null,M=0,A=!1;for(const pe of y){const oe=d[pe];oe.visibility!=="none"&&(oe.type==="circle"?x=!0:oe.type==="building"?(S=oe,++M):oe.type==="symbol"&&(oe.hasOcclusionOpacityProperties?T=!0:x=!0))}this.updateEmissiveMode();let C=y.map(pe=>d[pe]);const L=this.style._mergedSourceCaches;this.imageManager=t.imageManager,this.modelManager=t.modelManager,this.symbolFadeChange=t.placement.symbolFadeChange(s.o.now()),this.imageManager.beginFrame();for(const pe in L){const oe=L[pe];oe.used&&(oe.prepare(this.context),oe.getSource().usedInConflation&&++M)}let z=!1;for(const pe of C)pe.isHidden(this.transform.zoom)||(pe.type==="clip"&&(z=!0),this.prepareLayer(pe));const O={},N={},q={},G={},j={};for(const pe in L){const oe=L[pe];O[pe]=oe.getVisibleCoordinates(),N[pe]=O[pe].slice().reverse(),q[pe]=oe.getVisibleCoordinates(!0).reverse(),G[pe]=oe.getShadowCasterCoordinates(),j[pe]=oe.sortCoordinatesByDistance(O[pe])}const ie=pe=>{const oe=this.style.getLayerSourceCache(pe);return oe&&oe.used?oe.getSource():null};if(M||z||this._clippingActiveLastFrame){const pe=[],oe=[];let Ie=0;for(const be of C)this.isSourceForClippingOrConflation(be,ie(be))&&(pe.pu
vendor: 9,598 bytes, line 2997
2997sh(be),oe.push(Ie)),Ie++;if(pe&&(z||pe.length>1)||this._clippingActiveLastFrame){z=!1;const be=[];for(let ke=0;ke<pe.length;ke++){const Ue=pe[ke],Ke=oe[ke],je=this.style.getLayerSourceCache(Ue);if(!je||!je.used||!je.getSource().usedInConflation&&Ue.type!=="clip"&&Ue.type!=="building")continue;let He=s.eQ,lt=s.b_.None;const st=[];let et=!0;if(Ue.type==="building")He=s.eS;else if(Ue.type==="clip")if(He=Ke,Ue.isHidden(this.transform.zoom))et=!1;else{if(!Ue.layout){et=!1;continue}for(const ot of Ue.layout.get("clip-layer-types"))lt|=ot==="model"?s.b_.Model:ot==="symbol"?s.b_.Symbol:s.b_.FillExtrusion;for(const ot of Ue.layout.get("clip-layer-scope"))st.push(ot);z=!0}et&&be.push({layer:Ue.fqid,cache:je,order:He,clipMask:lt,clipScope:st})}this.replacementSource.setSources(be),A=!0}}this._clippingActiveLastFrame=z,A||this.replacementSource.clear(),this.conflationActive=A,this.minCutoffZoom=0,this.longestCutoffRange=0,this.opaquePassCutoff=1/0,this._lastOcclusionLayer=-1,this.layersWithOcclusionOpacity=[];for(let pe=0;pe<C.length;pe++){const oe=C[pe];if(oe.visibility==="none")continue;const Ie=oe.cutoffRange();if(this.longestCutoffRange=Math.max(Ie,this.longestCutoffRange),Ie>0){const be=ie(oe);be&&(this.minCutoffZoom=Math.max(be.minzoom,this.minCutoffZoom)),oe.minzoom&&(this.minCutoffZoom=Math.max(oe.minzoom,this.minCutoffZoom))}oe.is3D(p)&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=pe),this._lastOcclusionLayer=pe)}const Q=this.style&&this.style.fog;Q?(this._fogVisible=Q.getOpacity(this.transform.pitch)!==0,this._fogVisible&&this.transform.projection.name!=="globe"&&(this._fogVisible=Q.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(q),this.opaquePassCutoff=0,y=m(),C=y.map(pe=>d[pe]));const te=this._shadowRenderer;if(te){te.updateShadowParameters(this.transform,this.style.directionalLight);for(const pe in L)for(const oe of O[pe]){let Ie={min:0,max:0};this.terrain&&(Ie=this.terrain.getMinMaxForTile(oe)||Ie),te.addShadowReceiver(oe.toUnwrapped(),Ie.min,Ie.max)}}this.transform.projection.name!=="globe"||this.globeSharedBuffers||(this.globeSharedBuffers=new s.eR(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new Fh(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);const X=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.snow),Z=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.rain);if(X&&!this._snow&&(this._snow=new Bl(this)),!X&&this._snow&&(this._snow.destroy(),delete this._snow),Z&&!this._rain&&(this._rain=new Kf(this)),!Z&&this._rain&&(this._rain.destroy(),delete this._rain),this._snow&&this._snow.update(this),this._rain&&this._rain.update(this),S){this.buildingTileBorderManager||(this.buildingTileBorderManager=new Oh);const pe=this.style.getLayerSourceCache(S);this.buildingTileBorderManager.updateBorders(pe,S)}if(!Os.has(this.context.gl))return;this.renderPass="offscreen";for(const pe of C){const oe=t.getLayerSourceCache(pe);if(!pe.hasOffscreenPass()||pe.isHidden(this.transform.zoom))continue;const Ie=oe?N[oe.id]:void 0;(pe.type==="custom"||pe.type==="raster"||pe.type==="raster-particle"||pe.isSky()||Ie&&Ie.length)&&this.renderLayer(this,oe,pe,Ie)}this.depthRangeFor3D=[0,1-(C.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,G)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const ne=this.transform.projection.name==="globe"||this.transform.isHorizonVisible(),ce=(()=>{if(o.showOverdrawInspector)return s.ao.black;const pe=this.style.fog;if(pe&&this.transform.projection.supportsFog){const oe=this.style.getLut(pe.scope);if(!ne){const Ie=pe.properties.get("color-use-theme")==="none",be=pe.properties.get("color").toNonPremultipliedRenderColor(Ie?null:oe).toArray01();return new s.ao(...be)}if(ne){const Ie=pe.properties.get("space-color-use-theme")==="none",be=pe.properties.get("space-color").toNonPremultipliedRenderColor(Ie?null:oe).toArray01();return new s.ao(...be)}}return s.ao.transparent})();if(this.context.clear({color:ce,depth:1}),this.clearStencil(),this._showOverdrawInspector=o.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&ne&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=y.length-1;this.currentLayer>=0;this.currentLayer--){const pe=C[this.currentLayer],oe=t.getLayerSourceCache(pe);if(pe.isSky())continue;const Ie=oe?(pe.is3D(p)?j:N)[oe.id]:void 0;this._renderTileClippingMasks(pe,oe,Ie),this.renderLayer(this,oe,pe,Ie)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&ne&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||s.aj(this.transform.zoom)>0)&&(this.transform.projection.name==="globe"||this.transform.isHorizonVisible()))for(this.currentLayer=0;this.currentLayer<y.length;this.currentLayer++){const pe=C[this.currentLayer],oe=t.getLayerSourceCache(pe);pe.isSky()&&this.renderLayer(this,oe,pe,oe?N[oe.id]:void 0)}function de(pe,oe){let Ie;return oe&&(Ie=(pe.type==="symbol"?q:pe.is3D(p)?j:N)[oe.id]),Ie}if(this.renderPass="translucent",this.transform.projection.name==="globe"){for(this.renderElevatedRasterBackface=!0,this.currentLayer=0;this.currentLayer<y.length;){const pe=C[this.currentLayer];if(pe.type==="raster"||pe.type==="raster-particle"){const oe=t.getLayerSourceCache(pe);this.renderLayer(this,oe,pe,de(pe,oe))}++this.currentLayer}this.renderElevatedRasterBackface=!1}this.currentLayer=0,this.firstLightBeamLayer=Number.MAX_SAFE_INTEGER;const ve=te?te.getGroundShadowLayerIndex():-1;let ge=!1,Me=-1;for(let pe=0;pe<y.length;++pe){const oe=C[pe];oe.isHidden(this.transform.zoom)||oe.is3D(p)&&(Me=pe)}T&&Me===-1&&(x=!0);let Fe=!1;for(;this.currentLayer<y.length;){const pe=C[this.currentLayer],oe=t.getLayerSourceCache(pe);if(pe.isSky())++this.currentLayer;else if(this.terrain&&this.style.isLayerDraped(pe)){if(pe.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer),this._lastOcclusionLayer=Math.max(this.currentLayer,this._lastOcclusionLayer)}else{if(!Fe&&pe.is3D(p)&&!p){const Ie=this.currentLayer,be=ke=>{for(this.currentLayer=0;this.currentLayer<C.length;this.currentLayer++){const Ue=C[this.currentLayer];if(Hh[Ue.type]){const Ke=this.style.getLayerSourceCache(Ue);Hh[Ue.type](this,Ke,Ue,de(Ue,Ke),ke)}}};be("initialize"),be("reset"),this.currentLayer=Ie,Fe=!0}if(x&&!ge&&this.terrain&&!this.transform.isOrthographic&&(ge=!0,this.blitDepth()),T&&Me!==-1&&this.currentLayer===Me+1&&!this.transform.isOrthographic&&this.blitDepth(),this.terrain||this._renderTileClippingMasks(pe,oe,oe?O[oe.id]:void 0),this.renderLayer(this,oe,pe,de(pe,oe)),!this.terrain&&te&&this.currentLayer===ve){{this.clearStencil(),this.resetStencilClippingMasks();const Ie=this.currentLayer;for(this.currentLayer=0;this.currentLayer<C.length;this.currentLayer++){const be=C[this.currentLayer];if(Jf[be.type]){const ke=this.style.getLayerSourceCache(be);Jf[be.type](this,ke,be,de(be,ke))}}this.currentLayer=Ie}if(te.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer){const Ie=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=Ie;this.currentLayer++){const be=C[this.currentLayer];if(!be.hasLightBeamPass())continue;const ke=t.getLayerSourceCache(be);this.renderLayer(this,ke,be,ke?N[ke.id]:void 0)}this.currentLayer=Ie,this.renderPass="translucent"}}if(this.currentLayer>=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){const Ie=this.currentLayer;this.depthOcclusion=!0;for(const be of this.layersWithOcclusionOpacity){this.currentLayer=be;const ke=C[this.currentLayer],Ue=t.getLayerSourceCache(ke),Ke=Ue?N[Ue.id]:void 0;this.terrain||this._renderTileClippingMasks(ke,Ue,Ue?O[Ue.id]:void 0),this.renderLayer(this,Ue,ke,Ke)}this.depthOcclusion=!1,this.currentLayer=Ie,this.renderPass="translucent",this.layersWithOcclusionOpacity=[]}++this.currentLayer}}if(this.terrain&&this.terrain.postRender(),this._snow&&this._snow.draw(this),this._rain&&this._rain.draw(this),this.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){let pe=null;C.forEach(oe=>{const Ie=t.getLayerSourceCache(oe);Ie&&!oe.isHidden(this.transform.zoom)&&Ie.getVisibleCoordinates().length&&(!pe||pe.getSource().maxzoom<Ie.getSource().maxzoom)&&(pe=Ie)}),pe&&this.options.showTileBoundaries&&Gf(this,pe,pe.getVisibleCoordinates(),s.ao.red,!1,this.options.showParseStatus)}this.terrain&&this._debugParams.showTerrainProxyTiles&&Gf(this,this.terrain.proxySourceCache,this.terrain.proxyCoords,new s.ao(1,.8,.1,1),!0,this.options.showParseStatus),this.options.showPadding&&(function(pe){const oe=pe.transform.padding;qf(pe,pe.transform.height-(oe.top||0),3,Ph),qf(pe,oe.bottom||0,3,Rh),Dh(pe,oe.left||0,3,zh),Dh(pe,pe.transform.width-(oe.right||0),3,Gm);const Ie=pe.transform.centerPoint;(function(be,ke,Ue,Ke){Kc(be,ke-1,Ue-10,2,20,Ke),Kc(be,ke-10,Ue-1,20,2,Ke)})(pe,Ie.x,pe.transform.height-Ie.y,qm)})(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(performance.now()),this.saveC
2997anvasCopy()),A||(this.conflationActive=!1)}prepareLayer(t){this.gpuTimingStart(t);const{unsupportedLayers:o}=this.transform.projection,c=!o||!o.includes(t.type);if(qh[t.type]&&(c||this.terrain&&t.type==="custom")){const d=this.style.getLayerSourceCache(t);qh[t.type](t,d,this)}this.gpuTimingEnd()}renderLayer(t,o,c,d){c.isHidden(this.transform.zoom)||(c.type==="background"||c.type==="sky"||c.type==="custom"||c.type==="model"||c.type==="raster"||c.type==="raster-particle"||d&&d.length)&&(this.id=c.id,this.gpuTimingStart(c),t.transform.projection.unsupportedLayers&&t.transform.projection.unsupportedLayers.includes(c.type)&&(!t.terrain||c.type!=="custom")||c.type==="clip"||Js[c.type](t,o,c,d,this.style.placement.variableOffsets,this.options.isInitialLoad),this.gpuTimingEnd())}gpuTimingStart(t){if(!this.options.gpuTiming)return;const o=this.context.extTimerQuery,c=this.context.gl;let d=this.gpuTimers[t.id];d||(d=this.gpuTimers[t.id]={calls:0,cpuTime:0,query:c.createQuery()}),d.calls++,c.beginQuery(o.TIME_ELAPSED_EXT,d.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){const t=this.context.extTimerQuery,o=this.context.gl,c=o.createQuery();this.deferredRenderGpuTimeQueries.push(c),o.beginQuery(t.TIME_ELAPSED_EXT,c)}}gpuTimingDeferredRenderEnd(){this.options.gpuTimingDeferredRender&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}gpuTimingEnd(){this.options.gpuTiming&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}collectGpuTimers(){const t=this.gpuTimers;return this.gpuTimers={},t}collectDeferredRenderGpuQueries(){const t=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],t}queryGpuTimers(t){const o={};for(const c in t){const d=t[c],p=this.context.extTimerQuery,m=p.getQueryParameter(d.query,this.context.gl.QUERY_RESULT)/1e6;
2997p.deleteQueryEXT(d.query),o[c]=m}return o}queryGpuTimeDeferredRender(t){if(!this.options.gpuTimingDeferredRender)return 0;const o=this.context.gl;let c=0;for(const d of t)c+=o.getQueryParameter(d,o.QUERY_RESULT)/1e6,o.deleteQuery(d);return c}translatePosMatrix(t,o,c,d,p){if(!c[0]&&!c[1])return t;const m=p?d==="map"?this.transform.angle:0:d==="viewport"?-this.transform.angle:0;if(m){const T=Math.sin(m),S=Math.cos(m);c=[c[0]*S-c[1]*T,c[0]*T+c[1]*S]}const y=[p?c[0]:s.ay(o,c[0],this.transform.zoom),p?c[1]:s.ay(o,c[1],this.transform.zoom),0],x=new Float32Array(16);return s.br(x,t,y),x}saveTileTexture(t){if(t.context!==this.context)return;const o=t.size[0],c=this._tileTextures[o];c?c.push(t):this._tileTextures[o]=[t]}getTileTexture(t){const o=this._tileTextures[t];return o&&o.length>0?o.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return this.context.extTextureFloatLinear!=null}currentGlobalDefines(t,o,c){const d=c===void 0?this.terrain&&this.terrain.renderingToTexture:c,p=[];return this.style&&this.style.enable3dLights()&&(t==="globeRaster"||t==="terrainRaster"?(p.push("LIGHTING_3D_MODE"),p.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):d||p.push("LIGHTING_3D_MODE")),this.renderPass==="shadow"&&(this._shadowMapDebug||p.push("DEPTH_TEXTURE")),this.terrainRenderModeElevated()&&(p.push("TERRAIN"),this.linearFloatFilteringSupported()&&p.push("TERRAIN_DEM_FLOAT_FORMAT")),this.transform.projection.name==="globe"&&p.push("GLOBE"),!this._fogVisible||d||o!==void 0&&!o||p.push("FOG"),d&&p.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&p.push("OVERDRAW_INSPECTOR"),p}getOrCreateProgram(t,o){this.cache=this.cache||{};const c=o&&o.defines||[],d=o&&o.config,p=this.currentGlobalDefines(t,o&&o.overrideFog,o&&o.overrideRtt).concat(c),m=Tf.cacheKey(ih[t],t,p,d);return this.cache[m]||(this.cache[m]=new Tf(this.context,t,ih[t],d,Hc[t],p)),this.cache[m]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new s.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA8))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy(),this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),this.emptyDepthTexture&&this.emptyDepthTexture.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(t,o){if(this.style.enable3dLights()){const c=this.style.directionalLight,d=this.style.ambientLight;if(c&&d){const p=((m,y,x)=>{const T=m.properties.get("direction"),S=m.properties.get("color-use-theme")==="none",M=m.properties.get("color").toNonPremultipliedRenderColor(S?null:x.getLut(m.scope)).toArray01(),A=m.properties.get("intensity"),C=y.properties.get("color-use-theme")==="none",L=y.properties.get("color").toNonPremultipliedRenderColor(C?null:x.getLut(y.scope)).toArray01(),z=y.properties.get("intensity"),O=[T.x,T.y,T.z],N=s.dN(L,z),q=s.dN(M,A);return{u_lighting_ambient_color:N,u_lighting_directional_dir:O,u_lighting_directional_color:q,u_ground_radiance:Pa(O,q,N)}})(c,d,this.style);o.setLightsUniformValues(t,p)}}}uploadCommonUniforms(t,o,c,d,p){if(this.uploadCommonLightUniforms(t,o),this.terrain&&this.terrain.renderingToTexture)return;const m=this.style.fog;if(m){const y=m.getOpacity(this.transform.pitch),x=((T,S,M,A,C,L,z,O,N,q,G,j)=>{const ie=T.transform,Q=S.properties.get("color-use-theme")==="none",te=S.properties.get("color").toNonPremultipliedRenderColor(Q?null:T.style.getLut(S.scope)).toArray01();te[3]=A;const X=T.frameCounter/1e3%1,[Z,ne]=S.properties.get("vertical-range");return{u_fog_matrix:M?ie.calculateFogTileMatrix(M):j||T.identityMat,u_fog_range:S.getFovAdjustedRange(ie._fov),u_fog_color:te,u_fog_horizon_blend:S.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(Z,ne),ne],u_fog_temporal_offset:X,u_frustum_tl:C,u_frustum_tr:L,u_frustum_br:z,u_frustum_bl:O,u_globe_pos:N,u_globe_radius:q,u_viewport:G,u_globe_transition:s.aj(ie.zoom),u_is_globe:+(ie.projection.name==="globe")}})(this,m,c,y,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*s.o.devicePixelRatio,this.transform.height*s.o.devicePixelRatio],d);o.setFogUniformValues(t,x)}p&&o.setCutoffUniformValues(t,p.uniformValues)}setTileLoadedFlag(t){this.tileLoaded=t}saveCanvasCopy(){const t=this.canvasCopy();t&&(this.frameCopies.push(t),this.tileLoaded=!1)}canvasCopy(){const t=this.context.gl,o=t.createTexture();return t.bindTexture(t.TEXTURE_2D,o),t.copyTexImage2D(t.TEXTURE_2D,0,t.RGBA,0,0,t.drawingBufferWidth,t.drawingBufferHeight,0),o}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const t=this.style&&this.style.fog;return!!t&&t.getOpacity(this.transform.pitch)!==0}
vendor: 66,920 bytes, line 2997
2997getBackgroundTiles(){const t=this._backgroundTiles,o=this._backgroundTiles={},c=this.transform.coveringTiles({tileSize:512});for(const d of c)o[d.key]=t[d.key]||new ls(d,512,this.transform.tileZoom,this,void 0,this.worldview);return o}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(t,o){return!(!t.is3D(!(!this.terrain||!this.terrain.enabled))||t.type!=="clip"&&t.type!=="building"&&(t.minzoom&&t.minzoom>this.transform.zoom||(this.style._clipLayerPresent||t.sourceLayer!=="building"&&t.sourceLayer!=="procedural_buildings")&&(!o||o.type!=="batched-model")))}isTileAffectedByFog(t){if(!this.style||!this.style.fog)return!1;if(this.transform.projection.name==="globe")return!0;let o=this._cachedTileFogOpacities[t.key];return o||(this._cachedTileFogOpacities[t.key]=o=this.style.fog.getOpacityForTile(t)),o[0]>=rt||o[1]>=rt}setupDepthForOcclusion(t,o,c){const d=this.context,p=d.gl,m=!!c;var y;c||(c={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0}),d.activeTexture.set(p.TEXTURE3),t&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(p.NEAREST,p.CLAMP_TO_EDGE),c.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],c.u_depth_range_unpack=[2/((y=this.depthRangeFor3D)[1]-y[0]),-1-2*y[0]/(y[1]-y[0])],c.u_occluder_half_size=.5*this.occlusionParams.occluderSize,c.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.emptyDepthTexture.bind(p.NEAREST,p.CLAMP_TO_EDGE),d.activeTexture.set(p.TEXTURE0),m||o.setTerrainUniformValues(d,c)}updateEmissiveMode(){if(this._forceEmissiveMode)return;const t=this.style.hasDataDrivenEmissiveStrength();this.emissiveMode=t?this.context.extBlendFuncExtended?"dual-source-blending":"mrt-fallback":"constant"}}function ep(l,t){let o=!1,c=null;const d=()=>{c=null,o&&(l(),c=setTimeout(d,t),o=!1)};return()=>(o=!0,c||d(),c)}class Qr{constructor(t){this._hashName=t&&encodeURIComponent(t),s.aY(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=ep(this._updateHashUnthrottled.bind(this),300)}addTo(t){return this._map=t,window.addEventListener("hashchange",this._onHashChange,!1),t.on("moveend",this._updateHash),this}remove(){return this._map?(this._map.off("moveend",this._updateHash),window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}getHashString(){const t=this._map;if(!t)return"";const o=tp(t);if(this._hashName){const c=this._hashName;let d=!1;const p=location.hash.slice(1).split("&").map(m=>{const y=m.split("=")[0];return y===c?(d=!0,`${y}=${o}`):m}).filter(m=>m);return d||p.push(`${c}=${o}`),`#${p.join("&")}`}return`#${o}`}_getCurrentHash(){const t=location.hash.replace("#","");if(this._hashName){let o;return t.split("&").map(c=>c.split("=")).forEach(c=>{c[0]===this._hashName&&(o=c)}),(o&&o[1]||"").split("/")}return t.split("/")}_onHashChange(){const t=this._map;if(!t)return!1;const o=this._getCurrentHash();if(o.length>=3&&!o.some(c=>isNaN(Number(c)))){const c=t.dragRotate.isEnabled()&&t.touchZoomRotate.isEnabled()?+(o[3]||0):t.getBearing();return t.jumpTo({center:[+o[2],+o[1]],zoom:+o[0],bearing:c,pitch:+(o[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function tp(l,t){const o=l.getCenter(),c=Math.round(100*l.getZoom())/100,d=Math.ceil((c*Math.LN2+Math.log(512/360/.5))/Math.LN10),p=Math.pow(10,d),m=Math.round(o.lng*p)/p,y=Math.round(o.lat*p)/p,x=l.getBearing(),T=l.getPitch();let S=t?`/${m}/${y}/${c}`:`${c}/${y}/${m}`;return(x||T)&&(S+="/"+Math.round(10*x)/10),T&&(S+=`/${Math.round(T)}`),S}const Ss={linearity:.3,easing:s.eT(0,0,.3,1)},Wm=Object.assign({deceleration:2500,maxSpeed:1400},Ss),vi=Object.assign({deceleration:20,maxSpeed:1400},Ss),Nt=Object.assign({deceleration:1e3,maxSpeed:360},Ss),ip=Object.assign({deceleration:1e3,maxSpeed:90},Ss);class Es{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:s.o.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,o=s.o.now();for(;t.length>0&&o-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;const o={zoom:0,bearing:0,pitch:0,pan:new s.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:p}of this._inertiaBuffer)o.zoom+=p.zoomDelta||0,o.bearing+=p.bearingDelta||0,o.pitch+=p.pitchDelta||0,p.panDelta&&o.pan._add(p.panDelta),p.around&&(o.around=p.around),p.pinchAround&&(o.pinchAround=p.pinchAround);const c=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,d={};if(o.pan.mag()){const p=Zo(o.pan.mag(),c,Object.assign({},Wm,t||{}));d.offset=o.pan.mult(p.amount/o.pan.mag()),d.center=this._map.transform.center,$o(d,p)}if(o.zoom){const p=Zo(o.zoom,c,vi);d.zoom=this._map.transform.zoom+p.amount,$o(d,p)}if(o.bearing){const p=Zo(o.bearing,c,Nt);d.bearing=this._map.transform.bearing+s.aA(p.amount,-179,179),$o(d,p)}if(o.pitch){const p=Zo(o.pitch,c,ip);d.pitch=this._map.transform.pitch+p.amount,$o(d,p)}if(d.zoom||d.bearing){const p=o.pinchAround===void 0?o.around:o.pinchAround;d.around=p?this._map.unproject(p):this._map.getCenter()}return this.clear(),d.noMoveStart=!0,d}}function $o(l,t){(!l.duration||l.duration<t.duration)&&(l.duration=t.duration,l.easing=t.easing)}function Zo(l,t,o){const{maxSpeed:c,linearity:d,deceleration:p}=o,m=s.aA(l*d/(t/1e3),-c,c),y=Math.abs(m)/(p*d);return{easing:o.easing,duration:1e3*y,amount:m*(y/2)}}class Ir extends s.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,o,c,d={}){const p=uo(o.getCanvasContainer(),c),m=o.unproject(p);super(t,Object.assign({point:p,lngLat:m,originalEvent:c},d)),this._defaultPrevented=!1,this.target=o}}class Ba extends s.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,o,c){const d=t==="touchend"?c.changedTouches:c.touches,p=Ls(o.getCanvasContainer(),d),m=p.map(x=>o.unproject(x)),y=p.reduce((x,T,S,M)=>x.add(T.div(M.length)),new s.P(0,0));super(t,{points:p,point:y,lngLats:m,lngLat:o.unproject(y),originalEvent:c}),this._defaultPrevented=!1}}class $h extends s.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,o){super("wheel",{originalEvent:o}),this._defaultPrevented=!1}}class Zh{constructor(t,o){this._map=t,this._clickTolerance=o.clickTolerance}reset(){this._mousedownPos=void 0}wheel(t){return this._firePreventable(new $h(this._map,t))}mousedown(t,o){return this._mousedownPos=o,this._firePreventable(new Ir(t.type,this._map,t))}mouseup(t){this._map.fire(new Ir(t.type,this._map,t))}preclick(t){const o=new MouseEvent("preclick",t);this._map.fire(new Ir(o.type,this._map,o))}click(t,o){this._mousedownPos&&this._mousedownPos.dist(o)>=this._clickTolerance||(this.preclick(t),this._map.fire(new Ir(t.type,this._map,t)))}dblclick(t){return this._firePreventable(new Ir(t.type,this._map,t))}mouseover(t){this._map.fire(new Ir(t.type,this._map,t))}mouseout(t){this._map.fire(new Ir(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Ba(t.type,this._map,t))}touchmove(t){this._map.fire(new Ba(t.type,this._map,t))}touchend(t){this._map.fire(new Ba(t.type,this._map,t))}touchcancel(t){this._map.fire(new Ba(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Wh{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(t){this._map.fire(new Ir(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ir("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._map.fire(new Ir(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Yn{constructor(t,o){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=o.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,o){this.isEnabled()&&t.shiftKey&&t.button===0&&(Ji(),this._startPos=this._lastPos=o,this._active=!0)}mousemoveWindow(t,o){if(!this._active)return;const c=o,d=this._startPos,p=this._lastPos;if(!d||!p||p.equals(c)||!this._box&&c.dist(d)<this._clickTolerance)return;this._lastPos=c,this._box||(this._box=ni("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));const m=Math.min(d.x,c.x),y=Math.max(d.x,c.x),x=Math.min(d.y,c.y),T=Math.max(d.y,c.y);this._map._requestDomTask(()=>{this._box&&(this._box.style.transform=`translate(${m}px,${x}px)`,this._box.style.width=y-m+"px",this._box.style.height=T-x+"px")})}mouseupWindow(t,o){if(!this._active)return;const c=this._startPos,d=o;if(c&&t.button===0){if(this.reset(),Qn(),c.x!==d.x||c.y!==d.y)return this._map.fire(new s.z("boxzoomend",{originalEvent:t})),{cameraAnimation:p=>p.fitScreenCoordinates(c,d,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",t)}}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),Lr(),delete this._startPos,delete this._lastPos}_fireEvent(t,o){return this._map.fire(new s.z(t,{originalEvent:o}))}}function wo(l,t){const o={};for(let c=0;c<l.length;c++)o[l[c].identifier]=t[c];return o}class Na{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(t,o,c){(this.centroid||c.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===0&&(this.startTime=t.timeStamp),c.length===this.numTouches&&(this.centroid=(function(d){const p=new s.P(0,0);for(const m of d)p._add(m);return p.div(d.length)})(o),this.touches=wo(c,o)))}touchmove(t,o,c){if(this.aborted||!this.centroid)return;const d=wo(c,o);for(const p in this.touches){const m=d[p];(!m||m.dist(this.touches[p])>30)&&(this.aborted=!0)}}touchend(t,o,c){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),c.length===0){const d=!this.aborted&&this.centroid;if(this.reset(),d)return d}}}class Va{constructor(t){this.singleTap=new Na(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(t,o,c){this.singleTap.touchstart(t,o,c)}touchmove(t,o,c){this.singleTap.touchmove(t,o,c)}touchend(t,o,c){const d=this.singleTap.touchend(t,o,c);if(d){const p=t.timeStamp-this.lastTime<500,m=!this.lastTap||this.lastTap.dist(d)<30;if(p&&m||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=d,this.count===this.numTaps)return this.reset(),d}}}class Xh{constructor(){this._zoomIn=new Va({numTouches:1,numTaps:2}),this._zoomOut=new Va({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,o,c){this._zoomIn.touchstart(t,o,c),this._zoomOut.touchstart(t,o,c)}touchmove(t,o,c){this._zoomIn.touchmove(t,o,c),this._zoomOut.touchmove(t,o,c)}touchend(t,o,c){const d=this._zoomIn.touchend(t,o,c),p=this._zoomOut.touchend(t,o,c);return d?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:m=>m.easeTo({duration:300,zoom:m.getZoom()+1,around:m.unproject(d)},{originalEvent:t})}):p?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:m=>m.easeTo({duration:300,zoom:m.getZoom()-1,around:m.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 Yh=0,Is=2,Kh={[Yh]:1,[Is]:2},On={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class Nl{constructor(t){this.reset(),this._clickTolerance=t.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(t,o){return!1}_move(t,o){return{}}mousedown(t,o){if(this._lastPoint)return;const c=tl(t);this._correctButton(t,c)&&(this._lastPoint=o,this._eventButton=c)}mousemoveWindow(t,o){const c=this._lastPoint;if(c){if(t.preventDefault(),this._eventButton!=null&&(function(d,p){const m=Kh[p];return d.buttons===void 0||(d.buttons&m)!==m})(t,this._eventButton))this.reset();else if(this._moved||!(o.dist(c)<this._clickTolerance))return this._moved=!0,this._lastPoint=o,this._move(c,o)}}mouseupWindow(t){this._lastPoint&&tl(t)===this._eventButton&&(this._moved&&Qn(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class eu extends Nl{mousedown(t,o){super.mousedown(t,o),this._lastPoint&&(this._active=!0)}_correctButton(t,o){return o===0&&!t.ctrlKey}_move(t,o){return{around:o,panDelta:o.sub(t)}}}class tu extends Nl{constructor(t){super(t),this._pitchRotateKey=t.pitchRotateKey?On[t.pitchRotateKey]:void 0}_correctButton(t,o){return this._pitchRotateKey?o===0&&t[this._pitchRotateKey]:o===0&&t.ctrlKey||o===2}_move(t,o){const c=.8*(o.x-t.x);if(c)return this._active=!0,{bearingDelta:c}}contextmenu(t){this._pitchRotateKey||t.preventDefault()}}class iu extends Nl{constructor(t){super(t),this._pitchRotateKey=t.pitchRotateKey?On[t.pitchRotateKey]:void 0}_correctButton(t,o){return this._pitchRotateKey?o===0&&t[this._pitchRotateKey]:o===0&&t.ctrlKey||o===2}_move(t,o){const c=-.5*(o.y-t.y);if(c)return this._active=!0,{pitchDelta:c}}contextmenu(t){this._pitchRotateKey||t.preventDefault()}}class hr{constructor(t,o){this._map=t,this._el=t.getCanvasContainer(),this._minTouches=1,this._clickTolerance=o.clickTolerance||1,this.reset(),s.aY(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new s.P(0,0)}touchstart(t,o,c){return this._calculateTransform(t,o,c)}touchmove(t,o,c){if(this._active&&!(c.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(c.length===1&&!s.eU())return void this._showTouchPanBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return t.cancelable&&t.preventDefault(),this._calculateTransform(t,o,c)}}touchend(t,o,c){this._calculateTransform(t,o,c),this._active&&c.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,o,c){c.length>0&&(this._active=!0);const d=wo(c,o),p=new s.P(0,0),m=new s.P(0,0);let y=0;for(const T in d){const S=d[T],M=this._touches[T];M&&(p._add(S),m._add(S.sub(M)),y++,d[T]=S)}if(this._touches=d,y<this._minTouches||!m.mag())return;const x=m.div(y);return this._sum._add(x),this._sum.mag()<this._clickTolerance?void 0:{around:p.div(y),panDelta:x}}enable(){this._enabled=!0,this._map._cooperativeGestures&&(this._addTouchPanBlocker(),this._el.classList.add("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page"))}disable(){this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove(),this._el.classList.remove("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page")),this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}_addTouchPanBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=ni("div","mapboxgl-touch-pan-blocker",this._map._container),this._alertContainer.textContent=this._map._getUIString("TouchPanBlocker.Message"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showTouchPanBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-touch-pan-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.removeAttribute("role")},500)}}class Vl{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(t){}_move(t,o,c){return{}}touchstart(t,o,c){this._firstTwoTouches||c.length<2||(this._firstTwoTouches=[c[0].identifier,c[1].identifier],this._start([o[0],o[1]]))}touchmove(t,o,c){const d=this._firstTwoTouches;if(!d)return;t.preventDefault();const[p,m]=d,y=Ua(c,o,p),x=Ua(c,o,m);if(!y||!x)return;const T=this._aroundCenter?null:y.add(x).div(2);return this._move([y,x],T,t)}touchend(t,o,c){if(!this._firstTwoTouches)return;const[d,p]=this._firstTwoTouches,m=Ua(c,o,d),y=Ua(c,o,p);m&&y||(this._active&&Qn(),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 Ua(l,t,o){for(let c=0;c<l.length;c++)if(l[c].identifier===o)return t[c]}function ru(l,t){return Math.log2(l/t)}class Qs extends Vl{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,o){const c=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(ru(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:ru(this._distance,c),pinchAround:o}}}function nu(l,t){return 180*l.angleWith(t)/Math.PI}class Jh extends Vl{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,o){const c=this._vector;if(this._vector=t[0].sub(t[1]),c&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:nu(this._vector,c),pinchAround:o}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const o=25/(Math.PI*this._minDiameter)*360,c=this._startVector;if(!c)return!1;const d=nu(t,c);return Math.abs(d)<o}}function Ul(l){return Math.abs(l.y)>Math.abs(l.x)}class ea extends Vl{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(t){this._lastPoints=t,Ul(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,o,c){const d=this._lastPoints;if(!d)return;const p=t[0].sub(d[0]),m=t[1].sub(d[1]);return this._map._cooperativeGestures&&!s.eU()&&c.touches.length<3||(this._valid=this.gestureBeginsVertically(p,m,c.timeStamp),!this._valid)?void 0:(this._lastPoints=t,this._active=!0,{pitchDelta:(p.y+m.y)/2*-.5})}gestureBeginsVertically(t,o,c){if(this._valid!==void 0)return this._valid;const d=t.mag()>=2,p=o.mag()>=2;if(!d&&!p)return;if(!d||!p)return this._firstMove==null&&(this._firstMove=c),c-this._firstMove<100&&void 0;const m=t.y>0==o.y>0;return Ul(t)&&Ul(o)&&m}}const Qh={panStep:100,bearingStep:15,pitchStep:10};class jl{constructor(){const t=Qh;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let o=0,c=0,d=0,p=0,m=0;switch(t.keyCode){case 61:case 107:case 171:case 187:o=1;break;case 189:case 109:case 173:o=-1;break;case 37:t.shiftKey?c=-1:(t.preventDefault(),p=-1);break;case 39:t.shiftKey?c=1:(t.preventDefault(),p=1);break;case 38:t.shiftKey?d=1:(t.preventDefault(),m=-1);break;case 40:t.shiftKey?d=-1:(t.preventDefault(),m=1);break;default:return}return this._rotationDisabled&&(c=0,d=0),{cameraAnimation:y=>{const x=y.getZoom();y.easeTo({duration:300,easeId:"keyboardHandler",easing:ed,zoom:o?Math.round(x)+o*(t.shiftKey?2:1):x,bearing:y.getBearing()+c*this._bearingStep,pitch:y.getPitch()+d*this._pitchStep,offset:[-p*this._panStep,-m*this._panStep],center:y.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 ed(l){return l*(2-l)}const Gl=4.000244140625,td=1/450;class ou{constructor(t,o){this._map=t,this._el=t.getCanvasContainer(),this._handler=o,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=td,s.aY(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],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",this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(t.ctrlKey||t.metaKey||this.isZooming()||s.eU()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let o=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const c=s.o.now(),d=c-(this._lastWheelEventTime||0);this._lastWheelEventTime=c,o!==0&&o%Gl===0?this._type="wheel":o!==0&&Math.abs(o)<4?this._type="trackpad":d>400?(this._type=null,this._lastValue=o,this._timeout=window.setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(d*o)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,o+=this._lastValue)),t.shiftKey&&o&&(o/=4),this._type&&(this._lastWheelEvent=t,this._delta-=o,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 o=uo(this._el,t);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:o,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._map.transform;this._type==="wheel"&&t.projection.wrap&&(t._center.lng>=180||t._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const o=()=>t._terrainEnabled()&&this._aroundCoord?t.computeZoomRelativeTo(this._aroundCoord):t.zoom;if(this._delta!==0){const T=this._type==="wheel"&&Math.abs(this._delta)>Gl?this._wheelZoomRate:this._defaultZoomRate;let S=2/(1+Math.exp(-Math.abs(this._delta*T)));this._delta<0&&S!==0&&(S=1/S);const M=o(),A=Math.pow(2,M),C=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):A;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(C*S))),this._type==="wheel"&&(this._startZoom=M,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const c=typeof this._targetZoom=="number"?this._targetZoom:o(),d=this._startZoom,p=this._easing;let m,y=!1;if(this._type==="wheel"&&d&&p){const T=Math.min((s.o.now()-this._lastWheelEventTime)/200,1),S=p(T);m=s.ak(d,c,S),T<1?this._frameId||(this._frameId=!0):y=!0}else m=c,y=!0;this._active=!0,y&&(this._active=!1,this._finishTimeout=window.setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let x=m-o();return x*this._lastDelta<0&&(x=0),{noInertia:!0,needsRenderFrame:!y,zoomDelta:x,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let o=s.eV;if(this._prevEase){const c=this._prevEase,d=(s.o.now()-c.start)/c.duration,p=c.easing(d+.01)-c.easing(d),m=.27/Math.sqrt(p*p+1e-4)*.01,y=Math.sqrt(.0729-m*m);o=s.eT(m,y,.25,1)}return this._prevEase={start:s.o.now(),duration:t,easing:o},o}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=ni("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.removeAttribute("role")},200)}}class rp{constructor(t,o){this._clickZoom=t,this._tapZoom=o}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 np{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(t,o){return t.preventDefault(),{cameraAnimation:c=>{c.easeTo({duration:300,zoom:c.getZoom()+(t.shiftKey?-1:1),around:c.unproject(o)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class op{constructor(){this._tap=new Va({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(t,o,c){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?c.length>0&&(this._swipePoint=o[0],this._swipeTouch=c[0].identifier):this._tap.touchstart(t,o,c))}touchmove(t,o,c){if(this._tapTime){if(this._swipePoint){if(c[0].identifier!==this._swipeTouch)return;const d=o[0],p=d.y-this._swipePoint.y;return this._swipePoint=d,t.preventDefault(),this._active=!0,{zoomDelta:p/128}}}else this._tap.touchmove(t,o,c)}touchend(t,o,c){this._tapTime?this._swipePoint&&c.length===0&&this.reset():this._tap.touchend(t,o,c)&&(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 sp{constructor(t,o,c){this._el=t,this._mousePan=o,this._touchPan=c}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class ap{constructor(t,o,c){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=o,this._mousePitch=c}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 lp{constructor(t,o,c,d){this._el=t,this._touchZoom=o,this._touchRotate=c,this._tapDragZoom=d,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("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("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 ql=l=>l.zoom||l.drag||l.pitch||l.rotate;class cp extends s.z{}class up{constructor(){this.constants=[1,1,.01],this.radius=0}setup(t,o){const c=s.av([],o,t);this.radius=s.ag(c[2]<0?s.eX([],c,this.constants):[c[0],c[1],0])}projectRay(t){s.eX(t,t,this.constants),s.aw(t,t),s.eY(t,t,this.constants);const o=s.c5([],t,this.radius);if(o[2]>0){const c=s.c5([],[0,0,1],s.bJ(o,[0,0,1])),d=s.c5([],s.aw([],[o[0],o[1],0]),this.radius),p=s.d8([],o,s.c5([],s.av([],s.d8([],d,c),o),2));o[0]=p[0],o[1]=p[1]}return o}}function Hl(l){return l.panDelta&&l.panDelta.mag()||l.zoomDelta||l.bearingDelta||l.pitchDelta}class hp{constructor(t,o){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Es(t),this._bearingSnap=o.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new up,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(o),s.aY(["handleEvent","handleWindowEvent"],this);const c=this._el;this._listeners=[[c,"touchstart",{passive:!0}],[c,"touchmove",{passive:!1}],[c,"touchend",void 0],[c,"touchcancel",void 0],[c,"mousedown",void 0],[c,"mousemove",void 0],[c,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[c,"mouseover",void 0],[c,"mouseout",void 0],[c,"dblclick",void 0],[c,"click",void 0],[c,"keydown",{capture:!1}],[c,"keyup",void 0],[c,"wheel",{passive:!1}],[c,"contextmenu",void 0],[window,"blur",void 0]];for(const[d,p,m]of this._listeners){const y=d===document?this.handleWindowEvent:this.handleEvent;d.addEventListener(p,y,m)}}destroy(){for(const[t,o,c]of this._listeners){const d=t===document?this.handleWindowEvent:this.handleEvent;t.removeEventListener(o,d,c)}}_addDefaultHandlers(t){const o=this._map,c=o.getCanvasContainer();this._add("mapEvent",new Zh(o,t));const d=o.boxZoom=new Yn(o,t);this._add("boxZoom",d);const p=new Xh,m=new np;o.doubleClickZoom=new rp(m,p),this._add("tapZoom",p),this._add("clickZoom",m);const y=new op;this._add("tapDragZoom",y);const x=o.touchPitch=new ea(o);this._add("touchPitch",x);const T=new tu(t),S=new iu(t);o.dragRotate=new ap(t,T,S),this._add("mouseRotate",T,["mousePitch"]),this._add("mousePitch",S,["mouseRotate"]);const M=new eu(t),A=new hr(o,t);o.dragPan=new sp(c,M,A),this._add("mousePan",M),this._add("touchPan",A,["touchZoom","touchRotate"]);const C=new Jh,L=new Qs;o.touchZoomRotate=new lp(c,L,C,y),this._add("touchRotate",C,["touchPan","touchZoom"]),this._add("touchZoom",L,["touchPan","touchRotate"]),this._add("blockableMapEvent",new Wh(o));const z=o.scrollZoom=new ou(o,this);this._add("scrollZoom",z,["mousePan"]);const O=o.keyboard=new jl;this._add("keyboard",O);for(const N of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[N]&&o[N].enable(t[N])}_add(t,o,c){this._handlers.push({handlerName:t,handler:o,allowed:c}),this._handlersById[t]=o}stop(t){if(!this._updatingCamera){for(const{handler:o}of this._handlers)o.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[],this._originalZoom=void 0}}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!!ql(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(t,o,c){for(const d in t)if(d!==c&&(!o||o.indexOf(d)<0))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,`${t.type}Window`)}_getMapTouches(t){const o=[];for(const c of t)this._el.contains(c.target)&&o.push(c);return o}handleEvent(t,o){this._updatingCamera=!0;const c=t.type==="renderFrame",d=c?void 0:t,p={needsRenderFrame:!1},m={},y={},x=t.touches?this._getMapTouches(t.touches):void 0,T=x?Ls(this._el,x):c?void 0:uo(this._el,t);for(const{handlerName:A,handler:C,allowed:L}of this._handlers){if(!C.isEnabled())continue;let z;this._blockedByActive(y,L,A)?C.reset():C[o||t.type]&&(z=C[o||t.type](t,T,x),this.mergeHandlerResult(p,m,z,A,d),z&&z.needsRenderFrame&&this._triggerRenderFrame()),(z||C.isActive())&&(y[A]=C)}const S={};for(const A in this._previousActiveHandlers)y[A]||(S[A]=d);this._previousActiveHandlers=y,(Object.keys(S).length||Hl(p))&&(this._changes.push([p,m,S]),this._triggerRenderFrame()),(Object.keys(y).length||Hl(p))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:M}=p;M&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],M(this._map))}mergeHandlerResult(t,o,c,d,p){if(!c)return;Object.assign(t,c);const m={handlerName:d,originalEvent:c.originalEvent||p};c.zoomDelta!==void 0&&(o.zoom=m),c.panDelta!==void 0&&(o.drag=m),c.pitchDelta!==void 0&&(o.pitch=m),c.bearingDelta!==void 0&&(o.rotate=m)}_applyChanges(){const t={},o={},c={};for(const[d,p,m]of this._changes)d.panDelta&&(t.panDelta=(t.panDelta||new s.P(0,0))._add(d.panDelta)),d.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+d.zoomDelta),d.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+d.bearingDelta),d.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+d.pitchDelta),d.around!==void 0&&(t.around=d.around),d.aroundCoord!==void 0&&(t.aroundCoord=d.aroundCoord),d.pinchAround!==void 0&&(t.pinchAround=d.pinchAround),d.noInertia&&(t.noInertia=d.noInertia),Object.assign(o,p),Object.assign(c,m);this._updateMapTransform(t,o,c),this._changes=[]}_updateMapTransform(t,o,c){const d=this._map,p=d.transform,m=q=>[q.x,q.y,q.z];if((()=>{const q=this._eventsInProgress.drag;return q&&!this._handlersById[q.handlerName].isActive()})()&&!Hl(t)){const q=p.zoom;p.cameraElevationReference="sea",this._originalZoom!=null&&p._orthographicProjectionAtLowPitch&&p.projection.name!=="globe"&&p.pitch===0?(p.cameraElevationReference="ground",p.zoom=this._originalZoom):(p.recenterOnTerrain(),p.cameraElevationReference="ground"),q!==p.zoom&&this._map._update(!0)}if(p._isCameraConstrained&&d._stop(!0),!Hl(t))return void this._fireEvents(o,c,!0);let{panDelta:y,zoomDelta:x,bearingDelta:T,pitchDelta:S,around:M,aroundCoord:A,pinchAround:C}=t;p._isCameraConstrained&&(x>0&&(x=0),p._isCameraConstrained=!1),C!==void 0&&(M=C),(x||(q=>o[q]&&!this._eventsInProgress[q])("drag"))&&M&&(this._dragOrigin=m(p.pointCoordinate3D(M)),this._originalZoom=p.zoom,this._trackingEllipsoid.setup(p._camera.position,this._dragOrigin)),p.cameraElevationReference="sea",d._stop(!0),M=M||d.transform.centerPoint,T&&(p.bearing+=T),S&&(p.pitch+=S),p._updateCameraState();const L=[0,0,0];if(y)if(p.projection.name==="mercator"){const q=this._trackingEllipsoid.projectRay(p.screenPointToMercatorRay(M).dir),G=this._trackingEllipsoid.projectRay(p.screenPointToMercatorRay(M.sub(y)).dir);L[0]=G[0]-q[0],L[1]=G[1]-q[1]}else{const q=p.pointCoordinate(M);if(p.projection.name==="globe"){y=y.rotate(-p.angle);const G=p._pixelsPerMercatorPixel/p.worldSize;L[0]=-y.x*s.eW(s.a$(q.y))*G,L[1]=-y.y*s.eW(p.center.lat)*G}else{const G=p.pointCoordinate(M.sub(y));q&&G&&(L[0]=G.x-q.x,L[1]=G.y-q.y)}}const z=p.zoom,O=[0,0,0];if(x){const q=m(A||p.pointCoordinate3D(M)),G={dir:s.aw([],s.av([],q,p._camera.position))};if(G.dir[2]<0){const j=p.zoomDeltaToMovement(q,x);s.c5(O,G.dir,j)}}const N=s.d8(L,L,O);p._translateCameraConstrained(N),x&&Math.abs(p.zoom-z)>1e-4&&p.recenterOnTerrain(),p.cameraElevationReference="ground",this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(o,c,!0)}_fireEvents(t,o,c){const d=ql(this._eventsInProgress),p=ql(t),m={};for(const S in t){const{originalEvent:M}=t[S];this._eventsInProgress[S]||(m[`${S}start`]=M),this._eventsInProgress[S]=t[S]}!d&&p&&this._fireEvent("movestart",p.originalEvent);for(const S in m)this._fireEvent(S,m[S]);p&&this._fireEvent("move",p.originalEvent);for(const S in t){const{originalEvent:M}=t[S];this._fireEvent(S,M)}const y={};let x;for(const S in this._eventsInProgress){const{handlerName:M,originalEvent:A}=this._eventsInProgress[S];this._handlersById[M].isActive()||(delete this._eventsInProgress[S],x=o[M]||A,y[`${S}end`]=x)}for(const S in y)this._fireEvent(S,y[S]);const T=ql(this._eventsInProgress);if(c&&(d||p)&&!T){this._updatingCamera=!0;const S=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),M=A=>A!==0&&-this._bearingSnap<A&&A<this._bearingSnap;S?(M(S.bearing||this._map.getBearing())&&(S.bearing=0),this._map.easeTo(S,{originalEvent:x})):(this._map.fire(new s.z("moveend",{originalEvent:x})),M(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,o){this._map.fire(new s.z(t,o?{originalEvent:o}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{this._frameId=void 0,this.handleEvent(new cp("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const id="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class dp extends s.E{constructor(t,o){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=o.bearingSnap,this._respectPrefersReducedMotion=o.respectPrefersReducedMotion!==!1,s.aY(["_renderFrameCallback"],this)}getCenter(){return new s.aT(this.transform.center.lng,this.transform.center.lat)}setCenter(t,o){return this.jumpTo({center:t},o)}panBy(t,o,c){return t=s.P.convert(t).mult(-1),this.panTo(this.transform.center,Object.assign({offset:t},o),c)}panTo(t,o,c){return this.easeTo(Object.assign({center:t},o),c)}getZoom(){return this.transform.zoom}setZoom(t,o){return this.jumpTo({zoom:t},o),this}zoomTo(t,o,c){return this.easeTo(Object.assign({zoom:t},o),c)}zoomIn(t,o){return this.zoomTo(this.getZoom()+1,t,o),this}zoomOut(t,o){return this.zoomTo(this.getZoom()-1,t,o),this}getBearing(){return this.transform.bearing}setBearing(t,o){return this.jumpTo({bearing:t},o),this}getPadding(){return this.transform.padding}setPadding(t,o){return this.jumpTo({padding:t},o),this}rotateTo(t,o,c){return this.easeTo(Object.assign({bearing:t},o),c)}resetNorth(t,o){return this.rotateTo(0,Object.assign({duration:1e3},t),o),this}resetNorthPitch(t,o){return this.easeTo(Object.assign({bearing:0,pitch:0,duration:1e3},t),o),this}snapToNorth(t,o){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,o):this}getPitch(){return this.transform.pitch}setPitch(t,o){return this.jumpTo({pitch:t},o),this}cameraForBounds(t,o){t=s.aI.convert(t);const c=o&&o.bearing||0,d=o&&o.pitch||0,p=t.getNorthWest(),m=t.getSouthEast();return this._cameraForBounds(this.transform,p,m,c,d,o)}_extendPadding(t){const o={top:0,right:0,bottom:0,left:0};return t==null?Object.assign({},o,this.transform.padding):typeof t=="number"?{top:t,bottom:t,right:t,left:t}:Object.assign({},o,t)}_extendCameraOptions(t){return(t=Object.assign({offset:[0,0],maxZoom:this.transform.maxZoom},t)).padding=this._extendPadding(t.padding),t}_minimumAABBFrustumDistance(t,o){const c=o.max[0]-o.min[0],d=o.max[1]-o.min[1];return c/d>t.aspect?c/(2*Math.tan(.5*t.fovX)*t.aspect):d/(2*Math.tan(.5*t.fovY)*t.aspect)}_cameraForBoundsOnGlobe(t,o,c,d,p,m){const y=t.clone(),x=this._extendCameraOptions(m);y.bearing=d,y.pitch=p;const T=s.aT.convert(o),S=s.aT.convert(c),M=.5*(T.lat+S.lat),A=.5*(T.lng+S.lng),C=s.eZ(M,A),L=s.aw([],C),z=s.aw([],s.bI([],L,[0,1,0])),O=s.bI([],z,L),N=[z[0],z[1],z[2],0,O[0],O[1],O[2],0,L[0],L[1],L[2],0,0,0,0,1],q=[C,s.eZ(T.lat,T.lng),s.eZ(S.lat,T.lng),s.eZ(S.lat,S.lng),s.eZ(T.lat,S.lng),s.eZ(M,T.lng),s.eZ(M,S.lng),s.eZ(T.lat,A),s.eZ(S.lat,A)];let G=s.d9.fromPoints(q.map(be=>[s.bJ(z,be),s.bJ(O,be),s.bJ(L,be)]));const j=s.af([],G.center,N);s.e_(j)===0&&s.e$(j,0,0,1),s.aw(j,j),s.c5(j,j,s.aD),y.center=s.f0(j);const ie=y.getWorldToCameraMatrix(),Q=s.bl(new Float64Array(16),ie);G=s.d9.applyTransform(G,s.aB([],ie,N));const te=this._extendAABB(G,y,x,d);if(!te)return void s.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");G=te,s.af(j,j,ie);const X=.5*(G.max[2]-G.min[2]),Z=this._minimumAABBFrustumDistance(y,G),ne=s.c5([],[0,0,1],X),ce=s.d8(ne,j,ne),de=Z+(y.pitch===0?0:s.bG(j,ce)),ve=y.globeCenterInViewSpace,ge=s.av([],j,[ve[0],ve[1],ve[2]]);s.aw(ge,ge),s.c5(ge,ge,de);const Me=s.d8([],j,ge);s.af(Me,Me,Q);const Fe=s.eM/s.aD,pe=s.ag(Me),oe=s.cf(Math.max(pe*Fe-s.eM,Number.EPSILON),0),Ie=Math.min(y.zoomFromMercatorZAdjusted(oe),x.maxZoom);return Ie>.5*(s.c_+s.cL)?(y.setProjection({name:"mercator"}),y.zoom=Ie,this._cameraForBounds(y,o,c,d,p,m)):{center:y.center,zoom:Ie,bearing:d,pitch:p}}_extendAABB(t,o,c,d){const p=.5*((c.padding.left||0)+(c.padding.right||0)),m=.5*((c.padding.top||0)+(c.padding.bottom||0)),y=m,x=p,T=p,S=m,M=o.width-(x+T),A=o.height-(y+S),C=s.av([],t.max,t.min),L=Math.min(M/C[0],A/C[1]),z=Math.min(o.scaleZoom(o.scale*L),c.maxZoom);if(isNaN(z))return null;const O=o.scale/o.zoomScale(z),N=new s.d9([t.min[0]-x*O,t.min[1]-S*O,t.min[2]],[t.max[0]+T*O,t.max[1]+y*O,t.max[2]]),q=(typeof c.offset.x=="number"&&typeof c.offset.y=="number"?new s.P(c.offset.x,c.offset.y):s.P.convert(c.offset)).rotate(-s.an(d));return N.center[0]-=q.x*O,N.center[1]+=q.y*O,N}queryTerrainElevation(t,o){const c=this.transform.elevation;return c?(o=Object.assign({},{exaggerated:!0},o),c.getAtPoint(s.ae.fromLngLat(t),null,o.exaggerated)):null}_cameraForBounds(t,o,c,d,p,m){if(t.projection.name==="globe")return this._cameraForBoundsOnGlobe(t,o,c,d,p,m);const y=t.clone(),x=this._extendCameraOptions(m);y.bearing=d,y.pitch=p;const T=s.aT.convert(o),S=s.aT.convert(c),M=new s.aT(T.lng,S.lat),A=new s.aT(S.lng,T.lat),C=y.project(T),L=y.project(S),z=this.queryTerrainElevation(T),O=this.queryTerrainElevation(S),N=this.queryTerrainElevation(M),q=this.queryTerrainElevation(A),G=[[C.x,C.y,Math.min(z||0,O||0,N||0,q||0)],[L.x,L.y,Math.max(z||0,O||0,N||0,q||0)]];let j=s.d9.fromPoints(G);const ie=y.getWorldToCameraMatrix(),Q=s.bl(new Float64Array(16),ie);j=s.d9.applyTransform(j,ie);const te=this._extendAABB(j,y,x,d);if(!te)return void s.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");j=te;const X=.5*s.av([],j.max,j.min)[2],Z=this._minimumAABBFrustumDistance(y,j),ne=[0,0,1,0];s.aC(ne,ne,ie),s.f1(ne,ne);const ce=s.c5([],ne,Z+X),de=s.d8([],j.center,ce);s.af(j.center,j.center,Q),s.af(de,de,Q);const ve=y.unproject(new s.P(j.center[0],j.center[1])),ge=s.f2(y.projection,ve),Me=Math.pow(2,ge),Fe=Math.min(y._zoomFromMercatorZ(de[2]*y.pixelsPerMeter*Me/y.worldSize),x.maxZoom);return y.mercatorFromTransition&&Fe<.5*(s.c_+s.cL)?(y.setProjection({name:"globe"}),y.zoom=Fe,this._cameraForBounds(y,o,c,d,p,m)):{center:ve,zoom:Fe,bearing:d,pitch:p}}fitBounds(t,o,c){const d=this.cameraForBounds(t,o);return this._fitInternal(d,o,c)}fitScreenCoordinates(t,o,c,d,p){const m=s.P.convert(t),y=s.P.convert(o),x=new s.P(Math.min(m.x,y.x),Math.min(m.y,y.y)),T=new s.P(Math.max(m.x,y.x),Math.max(m.y,y.y));if(this.transform.projection.name==="mercator"&&this.transform.anyCornerOffEdge(m,y))return this;const S=this.transform.pointLocation3D(x),M=this.transform.pointLocation3D(T),A=this.transform.pointLocation3D(new s.P(x.x,T.y)),C=this.transform.pointLocation3D(new s.P(T.x,x.y)),L=[Math.min(S.lng,M.lng,A.lng,C.lng),Math.min(S.lat,M.lat,A.lat,C.lat)],z=[Math.max(S.lng,M.lng,A.lng,C.lng),Math.max(S.lat,M.lat,A.lat,C.lat)],O=d&&d.pitch?d.pitch:this.getPitch(),N=this._cameraForBounds(this.transform,L,z,c,O,d);return this._fitInternal(N,d,p)}_fitInternal(t,o,c){return t?(o=Object.assign(t,o)).linear?this.easeTo(o,c):this.flyTo(o,c):this}jumpTo(t,o){this.stop();const c=t.preloadOnly?this.transform.clone():this.transform;let d=!1,p=!1,m=!1;"zoom"in t&&c.zoom!==+t.zoom&&(d=!0,c.zoom=+t.zoom),t.center!==void 0&&(c.center=s.aT.convert(t.center)),"bearing"in t&&c.bearing!==+t.bearing&&(p=!0,c.bearing=+t.bearing),"pitch"in t&&c.pitch!==+t.pitch&&(m=!0,c.pitch=+t.pitch);const y=typeof t.padding=="number"?this._extendPadding(t.padding):t.padding;if(t.padding!=null&&!c.isPaddingEqual(y))if(t.retainPadding===!1){const x=c.clone();x.padding=y,c.setLocationAtPoint(c.center,x.centerPoint)}else c.padding=y;return t.preloadOnly?(this._preloadTiles(c),this):(this.fire(new s.z("movestart",o)).fire(new s.z("move",o)),d&&this.fire(new s.z("zoomstart",o)).fire(new s.z("zoom",o)).fire(new s.z("zoomend",o)),p&&this.fire(new s.z("rotatestart",o)).fire(new s.z("rotate",o)).fire(new s.z("rotateend",o)),m&&this.fire(new s.z("pitchstart",o)).fire(new s.z("pitch",o)).fire(new s.z("pitchend",o)),this.fire(new s.z("moveend",o)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||s.w(id),this.transform.getFreeCameraOptions()}setFreeCameraOptions(t,o){const c=this.transform;if(!c.projection.supportsFreeCamera)return s.w(id),this;this.stop();const d=c.zoom,p=c.pitch,m=c.bearing;c.setFreeCameraOptions(t);const y=d!==c.zoom,x=p!==c.pitch,T=m!==c.bearing;return this.fire(new s.z("movestart",o)).fire(new s.z("move",o)),y&&this.fire(new s.z("zoomstart",o)).fire(new s.z("zoom",o)).fire(new s.z("zoomend",o)),T&&this.fire(new s.z("rotatestart",o)).fire(new s.z("rotate",o)).fire(new s.z("rotateend",o)),x&&this.fire(new s.z("pitchstart",o)).fire(new s.z("pitch",o)).fire(new s.z("pitchend",o)),this.fire(new s.z("moveend",o)),this}easeTo(t,o){this._stop(!1,t.easeId),((t=Object.assign({offset:[0,0],duration:500,easing:s.eV},t)).animate===!1||this._prefersReducedMotion(t))&&(t.duration=0);const c=this.transform,d=this.getZoom(),p=this.getBearing(),m=this.getPitch(),y=this.getPadding(),x="zoom"in t?+t.zoom:d,T="bearing"in t?this._normalizeBearing(t.bearing,p):p,S="pitch"in t?+t.pitch:m,M=this._extendPadding(t.padding),A=s.P.convert(t.offset);let C,L,z;if(c.projection.name==="globe"){const ne=s.ae.fromLngLat(c.center),ce=A.rotate(-c.angle);ne.x+=ce.x/c.worldSize,ne.y+=ce.y/c.worldSize;const de=ne.toLngLat(),ve=s.aT.convert(t.center||de);this._normalizeCenter(ve),C=c.centerPoint.add(ce),L=new s.P(ne.x,ne.y).mult(c.worldSize),z=new s.P(s.aF(ve.lng),s.aJ(ve.lat)).mult(c.worldSize).sub(L)}else{C=c.centerPoint.add(A);const ne=c.pointLocation(C),ce=s.aT.convert(t.center||ne);this._normalizeCenter(ce),L=c.project(ne),z=c.project(ce).sub(L)}const O=c.zoomScale(x-d);let N,q;t.around&&(N=s.aT.convert(t.around),q=c.locationPoint(N));const G=this._zooming||x!==d,j=this._rotating||p!==T,ie=this._pitching||S!==m,Q=!c.isPaddingEqual(M),te=t.retainPadding===!1?c.clone():c,X=ne=>ce=>{if(G&&(ne.zoom=s.ak(d,x,ce)),j&&(ne.bearing=s.ak(p,T,ce)),ie&&(ne.pitch=s.ak(m,S,ce)),Q&&(te.interpolatePadding(y,M,ce),C=te.centerPoint.add(A)),N)ne.setLocationAtPoint(N,q);else{const de=ne.zoomScale(ne.zoom-d),ve=x>d?Math.min(2,O):Math.max(.5,O),ge=Math.pow(ve,1-ce),Me=ne.unproject(L.add(z.mult(ce*ge)).mult(de));ne.setLocationAtPoint(ne.renderWorldCopies?Me.wrap():Me,C)}return t.preloadOnly||this._fireMoveEvents(o),ne};if(t.preloadOnly){const ne=this._emulate(X,t.duration,c);return this._preloadTiles(ne),this}const Z={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=G,this._rotating=j,this._pitching=ie,this._padding=Q,this._easeId=t.easeId,this._prepareEase(o,t.noMoveStart,Z),this._ease(X(c),ne=>{c.cameraElevationReference==="sea"&&c.recenterOnTerrain(),this._afterEase(o,ne)},t),this}_prepareEase(t,o,c={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&this.transform.pitch===0&&this.transform.projection.name!=="globe"&&(this.transform.cameraElevationReference="ground"),o||c.moving||this.fire(new s.z("movestart",t)),this._zooming&&!c.zooming&&this.fire(new s.z("zoomstart",t)),this._rotating&&!c.rotating&&this.fire(new s.z("rotatestart",t)),this._pitching&&!c.pitching&&this.fire(new s.z("pitchstart",t))}_fireMoveEvents(t){this.fire(new s.z("move",t)),this._zooming&&this.fire(new s.z("zoom",t)),this._rotating&&this.fire(new s.z("rotate",t)),this._pitching&&this.fire(new s.z("pitch",t))}_afterEase(t,o){if(this._easeId&&o&&this._easeId===o)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const c=this._zooming,d=this._rotating,p=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,c&&this.fire(new s.z("zoomend",t)),d&&this.fire(new s.z("rotateend",t)),p&&this.fire(new s.z("pitchend",t)),this.fire(new s.z("moveend",t))}flyTo(t,o){if(this._prefersReducedMotion(t)){const be=s.aH(t,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(be,o)}this.stop(),t=Object.assign({offset:[0,0],speed:1.2,curve:1.42,easing:s.eV},t);const c=this.transform,d=this.getZoom(),p=this.getBearing(),m=this.getPitch(),y=this.getPadding(),x="zoom"in t?s.aA(+t.zoom,c.minZoom,c.maxZoom):d,T="bearing"in t?this._normalizeBearing(t.bearing,p):p,S="pitch"in t?+t.pitch:m,M=this._extendPadding(t.padding),A=c.zoomScale(x-d),C=s.P.convert(t.offset);let L=c.centerPoint.add(C);const z=c.pointLocation(L),O=s.aT.convert(t.center||z);this._normalizeCenter(O);const N=c.project(z),q=c.project(O).sub(N);let G=t.curve;const j=Math.max(c.width,c.height),ie=j/A,Q=q.mag();if("minZoom"in t){const be=s.aA(Math.min(t.minZoom,d,x),c.minZoom,c.maxZoom),ke=j/c.zoomScale(be-d);G=Math.sqrt(ke/Q*2)}const te=G*G;function X(be){const ke=(ie*ie-j*j+(be?-1:1)*te*te*Q*Q)/(2*(be?ie:j)*te*Q);return Math.log(Math.sqrt(ke*ke+1)-ke)}function Z(be){return(Math.exp(be)-Math.exp(-be))/2}function ne(be){return(Math.exp(be)+Math.exp(-be))/2}const ce=X(0);let de=function(be){return ne(ce)/ne(ce+G*be)},ve=function(be){return j*((ne(ce)*(Z(ke=ce+G*be)/ne(ke))-Z(ce))/te)/Q;var ke},ge=(X(1)-ce)/G;if(Math.abs(Q)<1e-6||!isFinite(ge)){if(Math.abs(j-ie)<1e-6)return this.easeTo(t,o);const be=ie<j?-1:1;ge=Math.abs(Math.log(ie/j))/G,ve=function(){return 0},de=function(ke){return Math.exp(be*G*ke)}}t.duration="duration"in t?+t.duration:1e3*ge/("screenSpeed"in t?+t.screenSpeed/G:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0);const Me=p!==T,Fe=S!==m,pe=!c.isPaddingEqual(M),oe=t.retainPadding===!1?c.clone():c,Ie=be=>ke=>{const Ue=ke*ge,Ke=1/de(Ue);be.zoom=ke===1?x:d+be.scaleZoom(Ke),Me&&(be.bearing=s.ak(p,T,ke)),Fe&&(be.pitch=s.ak(m,S,ke)),pe&&(oe.interpolatePadding(y,M,ke),L=oe.centerPoint.add(C));const je=ke===1?O:be.unproject(N.add(q.mult(ve(Ue))).mult(Ke));return be.setLocationAtPoint(be.renderWorldCopies?je.wrap():je,L),be._updateCameraOnTerrain(),t.preloadOnly||this._fireMoveEvents(o),be};if(t.preloadOnly){const be=this._emulate(Ie,t.duration,c);return this._preloadTiles(be),this}return this._zooming=!0,this._rotating=Me,this._pitching=Fe,this._padding=pe,this._prepareEase(o,!1),this._ease(Ie(c),()=>this._afterEase(o),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(t){}_cancelRenderFrame(t){}_stop(t,o){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const c=this._onEaseEnd;this._onEaseEnd=void 0,c.call(this,o)}if(!t){const c=this.handlers;c&&c.stop(!1)}return this}_ease(t,o,c){c.animate===!1||c.duration===0?(t(1),o()):(this._easeStart=s.o.now(),this._easeOptions=c,this._onEaseFrame=t,this._onEaseEnd=o,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((s.o.now()-this._easeStart)/this._easeOptions.duration,1),o=this._onEaseFrame;o&&o(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,o){t=s.bT(t,-180,180);const c=Math.abs(t-o);return Math.abs(t-360-o)<c&&(t-=360),Math.abs(t+360-o)<c&&(t+=360),t}_normalizeCenter(t){const o=this.transform;if(o.maxBounds||o.projection.name!=="globe"&&!o.renderWorldCopies)return;const c=t.lng-o.center.lng;t.lng+=c>180?-360:c<-180?360:0}_prefersReducedMotion(t){return this._respectPrefersReducedMotion&&s.o.prefersReducedMotion&&!(t&&t.essential)}_emulate(t,o,c){const d=Math.ceil(15*o/1e3),p=[],m=t(c.clone());for(let y=0;y<=d;y++){const x=m(y/d);p.push(x.clone())}return p}_preloadTiles(t,o){}}class fp{constructor(t={}){this.options=t,s.aY(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(t){const o=this.options&&this.options.compact,c=t._getUIString("AttributionControl.ToggleAttribution");this._map=t,this._container=ni("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=ni("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",c);const d=ni("span","mapboxgl-ctrl-icon",this._compactButton);return d.setAttribute("aria-hidden","true"),d.setAttribute("title",c),this._innerContainer=ni("div","mapboxgl-ctrl-attrib-inner",this._container),o&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),o===void 0&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let t=this._editLink;t||(t=this._editLink=this._container.querySelector(".mapbox-improve-map"));const o=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||s.e.ACCESS_TOKEN}];if(t){const c=o.reduce((d,p,m)=>(p.value&&(d+=`${p.key}=${p.value}${m<o.length-1?"&":""}`),d),"?");t.href=`${s.e.FEEDBACK_URL}/${c}#${tp(this._map,!0)}`,t.rel="noopener nofollow"}}_updateData(t){!t||(t.dataType!=="source"||t.sourceDataType!=="metadata"&&t.sourceDataType!=="visibility")&&t.dataType!=="style"||(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let t=[];if(this._map.style.stylesheet){const d=this._map.style.stylesheet;this.styleOwner=d.owner,this.styleId=d.id}const o=this._map.style._mergedSourceCaches;for(const d in o){const p=o[d];if(p.used){const m=p.getSource();m.attribution&&t.indexOf(m.attribution)<0&&t.push(m.attribution)}}t.sort((d,p)=>d.length-p.length),t=t.filter((d,p)=>{for(let m=p+1;m<t.length;m++)if(t[m].indexOf(d)>=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=[...this.options.customAttribution,...t]:t.unshift(this.options.customAttribution));const c=t.map(d=>(function(p){const m=new DOMParser().parseFromString(p,"text/html");return Array.from(m.body.querySelectorAll("*")).reverse().forEach(y=>{const x=y.textContent||"";if(y.tagName!=="A")return void y.replaceWith(...y.childNodes);const T=y.getAttribute("href");if(!T||!/^(https?:|mailto:)/i.test(T))return void y.replaceWith(m.createTextNode(x));const S=m.createElement("a");S.href=T,S.textContent=x,S.rel="noopener nofollow";const M=y.getAttribute("class");M&&(S.className=M),y.replaceWith(S)}),m.body.innerHTML})(d)).join(" | ");c!==this._attribHTML&&(this._attribHTML=c,t.length?(this._innerContainer.innerHTML=c,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class pp{constructor(){s.aY(["_updateLogo","_updateCompact"],this)}onAdd(t){this._map=t,this._container=ni("div","mapboxgl-ctrl");const o=ni("a","mapboxgl-ctrl-logo");return o.target="_blank",o.rel="noopener nofollow",o.href="https://www.mapbox.com/",o.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),o.setAttribute("rel","noopener nofollow"),this._container.appendChild(o),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(t){t&&t.sourceDataType!=="metadata"||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const t=this._map.style._sourceCaches;if(Object.entries(t).length===0)return!0;for(const o in t){const c=t[o].getSource();if(c.hasOwnProperty("mapbox_logo")&&!c.mapbox_logo)return!1}return!0}_updateCompact(){const t=this._container.children;if(t.length){const o=t[0];this._map.getCanvasContainer().offsetWidth<250?o.classList.add("mapboxgl-compact"):o.classList.remove("mapboxgl-compact")}}}class mp{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const o=++this._id;return this._queue.push({callback:t,id:o,cancelled:!1}),o}remove(t){const o=this._currentlyRunning,c=o?this._queue.concat(o):this._queue;for(const d of c)if(d.id===t)return void(d.cancelled=!0)}run(t=0){const o=this._currentlyRunning=this._queue;this._queue=[];for(const c of o)if(!c.cancelled&&(c.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}class Ci{constructor(t){this.jumpTo(t)}getValue(t){if(t<=this._startTime)return this._start;if(t>=this._endTime)return this._end;const o=s.dD((t-this._startTime)/(this._endTime-this._startTime));return this._start*(1-o)+this._end*o}isEasing(t){return t>=this._startTime&&t<=this._endTime}jumpTo(t){this._startTime=-1/0,this._endTime=-1/0,this._start=t,this._end=t}easeTo(t,o,c){this._start=this.getValue(o),this._end=t,this._startTime=o,this._endTime=o+c}}const _p={"AttributionControl.ToggleAttribution":"Toggle attribution","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox homepage","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use ⌘ + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"};class gp extends s.z{constructor(t,o,c,d){const{point:p,lngLat:m,originalEvent:y,target:x}=t;super(t.type,{point:p,lngLat:m,originalEvent:y,target:x}),this.preventDefault=()=>{t.preventDefault()},this.id=o,this.interaction=c,this.feature=d}}class Xm{constructor(t){this.map=t,this.interactionsByType=new Map,this.delegatedInteractions=new Map,this.typeById=new Map,this.filters=new Map,this.handleType=this.handleType.bind(this),this.handleMove=this.handleMove.bind(this),this.handleOut=this.handleOut.bind(this),this.hoveredFeatures=new Map,this.prevHoveredFeatures=new Map}add(t,o){if(this.typeById.has(t))throw new Error(`Interaction id "${t}" already exists.`);const c=o.filter;let d=o.type;c&&this.filters.set(t,s.b6(c)),d==="mouseover"&&(d="mouseenter"),d==="mouseout"&&(d="mouseleave");const p=this.interactionsByType.get(d)||new Map;d==="mouseenter"||d==="mouseleave"?(this.delegatedInteractions.size===0&&(this.map.on("mousemove",this.handleMove),this.map.on("mouseout",this.handleOut)),this.delegatedInteractions.set(t,o)):p.size===0&&this.map.on(d,this.handleType),p.size===0&&this.interactionsByType.set(d,p),p.set(t,o),this.typeById.set(t,d)}get(t){const o=this.typeById.get(t);if(!o)return;const c=this.interactionsByType.get(o);return c?c.get(t):void 0}remove(t){const o=this.typeById.get(t);if(!o)return;this.typeById.delete(t),this.filters.delete(t);const c=this.interactionsByType.get(o);c&&(c.delete(t),o==="mouseenter"||o==="mouseleave"?(this.delegatedInteractions.delete(t),this.delegatedInteractions.size===0&&(this.map.off("mousemove",this.handleMove),this.map.off("mouseout",this.handleOut))):c.size===0&&this.map.off(o,this.handleType))}queryTargets(t,o){const c=[];for(const[d,p]of o)p.target&&c.push({targetId:d,target:p.target,filter:this.filters.get(d)});return this.map.style.queryRenderedTargets(t,c,this.map.transform)}handleMove(t){this.prevHoveredFeatures=this.hoveredFeatures,this.hoveredFeatures=new Map;const o=this.queryTargets(t.point,Array.from(this.delegatedInteractions).reverse());o.length&&(t.type="mouseenter",this.handleType(t,o));const c=new Map;for(const[d,{feature:p}]of this.prevHoveredFeatures)this.hoveredFeatures.has(d)||c.set(p.id,p);c.size&&(t.type="mouseleave",this.handleType(t,Array.from(c.values())))}handleOut(t){const o=Array.from(this.hoveredFeatures.values()).map(({feature:c})=>c);o.length&&(t.type="mouseleave",this.handleType(t,o)),this.hoveredFeatures.clear()}handleType(t,o){const c=t.type==="mouseenter";if(c&&!this.interactionsByType.has(t.type))return void s.w("mouseenter interaction required for mouseleave to work.");const d=Array.from(this.interactionsByType.get(t.type)).reverse(),p=!!o;o=o||this.queryTargets(t.point,d);let m=!1;const y=new Set;for(const x of o){for(const[T,S]of d){if(!S.target)continue;const M=x.variants?x.variants[T]:null;if(M){for(const A of M){if(ll(A,x,y,T))continue;const C=new s.dx(x,A),L=Rn(A,x,T);p&&C.id!==void 0&&(C.state=this.map.getFeatureState(C));const z=c?this.prevHoveredFeatures.get(L):null,O=new gp(t,T,S,C),N=z?z.stop:S.handler(O);if(c&&this.hoveredFeatures.set(L,{feature:x,stop:N}),N!==!1){m=!0;break}}if(m)break}}if(m)break}if(!m)for(const[x,T]of d){const{handler:S,target:M}=T;if(!M&&S(new gp(t,x,T,null))!==!1)break}}}function Ym(l,t){if(Array.isArray(l)&&Array.isArray(t)){const o=new Set(l),c=new Set(t);return o.size===c.size&&l.every(d=>c.has(d))}return s.by(l,t)}const $l={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,antialias:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1,precompilePrograms:!0,scaleFactor:1,spriteFormat:"auto"},yp={showCompass:!0,showZoom:!0,visualizePitch:!1};class rd{constructor(t,o,c=!1){this._clickTolerance=10,this.element=o,this.mouseRotate=new tu({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,c&&(this.mousePitch=new iu({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),s.aY(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),o.addEventListener("mousedown",this.mousedown),o.addEventListener("touchstart",this.touchstart,{passive:!1}),o.addEventListener("touchmove",this.touchmove),o.addEventListener("touchend",this.touchend),o.addEventListener("touchcancel",this.reset)}down(t,o){this.mouseRotate.mousedown(t,o),this.mousePitch&&this.mousePitch.mousedown(t,o),Ji()}move(t,o){const c=this.map,d=this.mouseRotate.mousemoveWindow(t,o),p=d&&d.bearingDelta;if(p&&c.setBearing(c.getBearing()+p),this.mousePitch){const m=this.mousePitch.mousemoveWindow(t,o),y=m&&m.pitchDelta;y&&c.setPitch(c.getPitch()+y)}}off(){const t=this.element;t.removeEventListener("mousedown",this.mousedown),t.removeEventListener("touchstart",this.touchstart),t.removeEventListener("touchmove",this.touchmove),t.removeEventListener("touchend",this.touchend),t.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){Lr(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(t){this.down(Object.assign({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),uo(this.element,t)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(t){this.move(t,uo(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=Ls(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=Ls(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 Zl(l,t,o){if(l=new s.aT(l.lng,l.lat),t){const c=new s.aT(l.lng-360,l.lat),d=new s.aT(l.lng+360,l.lat),p=360*Math.ceil(Math.abs(l.lng-o.center.lng)/360),m=o.locationPoint3D(l).distSqr(t),y=t.x<0||t.y<0||t.x>o.width||t.y>o.height;o.locationPoint3D(c).distSqr(t)<m&&(y||Math.abs(c.lng-o.center.lng)<p)?l=c:o.locationPoint3D(d).distSqr(t)<m&&(y||Math.abs(d.lng-o.center.lng)<p)&&(l=d)}for(;Math.abs(l.lng-o.center.lng)>180;){const c=o.locationPoint3D(l);if(c.x>=0&&c.y>=0&&c.x<=o.width&&c.y<=o.height)break;l.lng>o.center.lng?l.lng-=360:l.lng+=360}return l}
2997const so={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%)"},kn={rotation:0,rotationAlignment:"auto",pitchAlignment:"auto",occludedOpacity:.2,altitude:0};class ir extends s.E{constructor(t,o){super(),(t instanceof HTMLElement||o)&&(t=Object.assign({element:t},o)),s.aY(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this);const{anchor:c="center",color:d="#3FB1CE",scale:p=1,draggable:m=!1,clickTolerance:y=0,rotation:x=kn.rotation,rotationAlignment:T=kn.rotationAlignment,pitchAlignment:S=kn.pitchAlignment,occludedOpacity:M=kn.occludedOpacity,altitude:A=kn.altitude}=t||{};this._anchor=c,this._color=d,this._scale=p,this._draggable=m,this._clickTolerance=y,this._rotation=x,this._rotationAlignment=T,this._pitchAlignment=S,this._occludedOpacity=M,this._altitude=A,this._state="inactive",this._isDragging=!1,this._updateMoving=()=>this._update(!0),t&&t.element?(this._element=t.element,this._offset=s.P.convert(t&&t.offset||[0,0])):(this._defaultMarker=!0,this._element=this._createDefaultMarker(),this._offset=s.P.convert(t&&t.offset||[0,-14])),this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.hasAttribute("role")||this._element.setAttribute("role","img"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",z=>{z.preventDefault()}),this._element.addEventListener("mousedown",z=>{z.preventDefault()});const C=this._element.classList;for(const z in so)C.remove(`mapboxgl-marker-anchor-${z}`);C.add(`mapboxgl-marker-anchor-${this._anchor}`);const L=t&&t.className?t.className.trim().split(/\s+/):[];C.add(...L),this._popup=null}_createDefaultMarker(){const t=ni("div"),o=Ei("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},t);if(this._altitude===0){const c=Ei("radialGradient",{id:"shadowGradient"},Ei("defs",{},o));Ei("stop",{offset:"10%","stop-opacity":.4},c),Ei("stop",{offset:"100%","stop-opacity":.05},c),Ei("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},o)}return Ei("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},o),Ei("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},o),Ei("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},o),t}addTo(t){return t===this._map||(this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._updateMoving),t.on("moveend",this._update),t.on("remove",this._clearFadeTimer),t._addMarker(this),this.setDraggable(this._draggable),this._update(),t.on("click",this._onMapClick)),this}remove(){const t=this._map;return t&&(t.off("click",this._onMapClick),t.off("move",this._updateMoving),t.off("moveend",this._update),t.off("mousedown",this._addDragHandler),t.off("touchstart",this._addDragHandler),t.off("mouseup",this._onUp),t.off("touchend",this._onUp),t.off("mousemove",this._onMove),t.off("touchmove",this._onMove),t.off("remove",this._clearFadeTimer),t._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=s.aT.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}setAltitude(t){return t===this._altitude||(this._defaultMarker&&(this._altitude===0&&t!==0||this._altitude!==0&&t===0)&&(this._element=this._createDefaultMarker()),this._altitude=t||kn.altitude,this._update()),this}getAltitude(){return this._altitude}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const d=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:[
vendor: 7,484 bytes, lines 2997-3002
29970,-38.1],"bottom-left":[d,-1*(38.1-13.5+d)],"bottom-right":[-d,-1*(38.1-13.5+d)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,t._marker=this,t._altitude=this._altitude,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(t){const o=t.code,c=t.charCode||t.keyCode;o!=="Space"&&o!=="Enter"&&c!==32&&c!==13||this.togglePopup()}_onMapClick(t){const o=t.originalEvent.target,c=this._element;this._popup&&(o===c||c.contains(o))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?(t.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(t.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const t=this._map,o=this._pos;if(!t||!o)return!1;const c=t.unproject(o,this._altitude),d=t.getFreeCameraOptions();if(!d.position)return!1;const p=d.position.toLngLat();return p.distanceTo(c)<.9*p.distanceTo(this._lngLat)}_evaluateOpacity(){const t=this._map;if(!t)return;const o=this._pos;if(!o||o.x<0||o.x>t.transform.width||o.y<0||o.y>t.transform.height)return void this._clearFadeTimer();const c=t.unproject(o,this._altitude);let d;t._showingGlobe()&&s.f5(t.transform,this._lngLat)?d=0:(d=1-t._queryFogOpacity(c),t.transform._terrainEnabled()&&t.getTerrain()&&this._behindTerrain()&&(d*=this._occludedOpacity)),this._element.style.opacity=`${d}`,this._element.style.pointerEvents=d>0?"auto":"none",this._popup&&this._popup._setOpacity(d),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const t=this._pos;if(!t||!this._map)return;const o=this._offset.mult(this._scale);this._element.style.transform=`
2998            translate(${t.x}px,${t.y}px)
2999            ${so[this._anchor]}
3000            ${this._calculateXYTransform()} ${this._calculateZTransform()}
3001            translate(${o.x}px,${o.y}px)
3002        `}_calculateXYTransform(){const t=this._pos,o=this._map,c=this.getPitchAlignment();if(!o||!t||c!=="map")return"";if(!o._showingGlobe()){const x=o.getPitch();return x?`rotateX(${x}deg)`:""}const d=s.cX(s.f6(o.transform,this._lngLat)),p=t.sub(s.f7(o.transform)),m=Math.abs(p.x)+Math.abs(p.y);if(m===0)return"";const y=d/m;return`rotateX(${-p.y*y}deg) rotateY(${p.x*y}deg)`}_calculateZTransform(){const t=this._pos,o=this._map;if(!o||!t)return"";let c=0;const d=this.getRotationAlignment();if(d==="map")if(o._showingGlobe()){const p=o.project(new s.aT(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),m=o.project(new s.aT(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(p);c=s.cX(Math.atan2(m.y,m.x))-90}else c=-o.getBearing();else if(d==="horizon"){const p=s.ah(4,6,o.getZoom()),m=s.f7(o.transform);m.y+=p*o.transform.height;const y=t.sub(m),x=s.cX(Math.atan2(y.y,y.x));c=(x>90?x-270:x+90)*(1-p)}return c+=this._rotation,c?`rotateZ(${c}deg)`:""}_update(t){cancelAnimationFrame(this._updateFrameId);const o=this._map;o&&(o.transform.renderWorldCopies&&(this._lngLat=Zl(this._lngLat,this._pos,o.transform)),this._pos=o.project(this._lngLat,this._altitude),t===!0?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),o._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(o._showingGlobe()||o.getTerrain()||o.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(t){return this._offset=s.P.convert(t),this._update(),this}addClassName(t){return this._element.classList.add(t),this}removeClassName(t){return this._element.classList.remove(t),this}toggleClassName(t){return this._element.classList.toggle(t)}_onMove(t){const o=this._map;if(!o)return;const c=this._pointerdownPos,d=this._positionDelta;if(c&&d){if(!this._isDragging){const p=this._clickTolerance||o._clickTolerance;if(t.point.dist(c)<p)return;this._isDragging=!0}this._pos=t.point.sub(d),this._lngLat=o.unproject(this._pos,this._altitude),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new s.z("dragstart"))),this.fire(new s.z("drag"))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;const t=this._map;t&&(t.off("mousemove",this._onMove),t.off("touchmove",this._onMove)),this._state==="active"&&this.fire(new s.z("dragend")),this._state="inactive"}_addDragHandler(t){const o=this._map,c=this._pos;o&&c&&this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(c),this._pointerdownPos=t.point,this._state="pending",o.on("mousemove",this._onMove),o.on("touchmove",this._onMove),o.once("mouseup",this._onUp),o.once("touchend",this._onUp))}setDraggable(t){this._draggable=!!t;const o=this._map;return o&&(t?(o.on("mousedown",this._addDragHandler),o.on("touchstart",this._addDragHandler)):(o.off("mousedown",this._addDragHandler),o.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||kn.rotation,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||kn.rotationAlignment,this._update(),this}getRotationAlignment(){return this._rotationAlignment==="auto"||this._rotationAlignment==="horizon"&&this._map&&!this._map._showingGlobe()?"viewport":this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t||kn.pitchAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment==="auto"?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(t){return this._occludedOpacity=t||kn.occludedOpacity,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}const Bn={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1,showButton:!0,followUserLocation:!0},Wl={maxWidth:100,unit:"metric"},su={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"},xp={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",altitude:0},Km=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function ja(l=new s.P(0,0),t="bottom"){if(typeof l=="number"){const o=Math.round(Math.sqrt(.5*Math.pow(l,2)));switch(t){case"top":return new s.P(0,l);case"top-left":return new s.P(o,o);case"top-right":return new s.P(-o,o);case"bottom":return new s.P(0,-l);case"bottom-left":return new s.P(o,-o);case"bottom-right":return new s.P(-o,-o);case"left":return new s.P(l,0);case"right":return new s.P(-l,0)}return new s.P(0,0)}return l instanceof s.P||Array.isArray(l)?s.P.convert(l):s.P.convert(l[t]||[0,0])}return{version:zt,supported:Hn.supported,setRTLTextPlugin:s.fb,getRTLTextPluginStatus:s.fa,Map:class extends dp{constructor(l){Ui.mark(wt.create);const t=l;if((l=Object.assign({}
3002,$l,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(l.antialias&&s.f3(window)&&(l.antialias=!1,s.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new bc(l.minZoom,l.maxZoom,l.minPitch,l.maxPitch,l.renderWorldCopies,null,null),l),this._repaint=!!l.repaint,this._interactive=l.interactive,this._minTileCacheSize=l.minTileCacheSize,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._isInitialLoad=!0,this._crossSourceCollisions=l.crossSourceCollisions,this._collectResourceTiming=l.collectResourceTiming,this._language=this._parseLanguage(l.language),this._worldview=l.worldview,this._renderTaskQueue=new mp,this._domRenderTaskQueue=new mp,this._controls=[],this._markers=[],this._popups=[],this._mapId=s.b2(),this._locale=Object.assign({},_p,l.locale),this._clickTolerance=l.clickTolerance,this._cooperativeGestures=l.cooperativeGestures,this._performanceMetricsCollection=l.performanceMetricsCollection,this._tessellationStep=l.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=l.precompilePrograms,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new Ci(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=l.scaleFactor,this._requestManager=new lc(l.transformRequest,l.accessToken,l.testMode),this._silenceAuthErrors=!!l.testMode,this._contextCreateOptions=l.contextCreateOptions?Object.assign({},l.contextCreateOptions):{},typeof l.container=="string"){const o=document.getElementById(l.container);if(!o)throw new Error(`Container '${l.container.toString()}' not found.`);this._container=o}else{if(!(l.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=l.container}if(this._container.childNodes.length>0&&s.w("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),l.maxBounds&&this.setMaxBounds(l.maxBounds),this._spriteFormat=l.spriteFormat,s.aY(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");if(this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this._fullscreenchangeEvent="onfullscreenchange"in document?"fullscreenchange":"webkitfullscreenchange",window.addEventListener("online",this._onWindowOnline,!1),window.addEventListener("resize",this._onWindowResize,!1),window.addEventListener("orientationchange",this._onWindowResize,!1),window.addEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.addEventListener("visibilitychange",this._onVisibilityChange,!1),this.handlers=new hp(this,l),this._localFontFamily=l.localFontFamily,this._localIdeographFontFamily=l.localIdeographFontFamily,(l.style||!l.testMode)&&this.setStyle(l.style||s.e.DEFAULT_STYLE,{config:l.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),l.projection&&this.setProjection(l.projection),l.hash&&(this._hash=new Qr(typeof l.hash=="string"&&l.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){t.center==null&&t.zoom==null||(this.transform._unmodified=!1),this.jumpTo({center:l.center,zoom:l.zoom,bearing:l.bearing,pitch:l.pitch});const o=l.bounds;o&&(this.resize(),this.fitBounds(o,Object.assign({},l.fitBoundsOptions,{duration:0})))}this.resize(),l.attributionControl&&this.addControl(new fp({customAttribution:l.customAttribution}
vendor: 9,360 bytes, line 3002
3002)),this._logoControl=new pp,this.addControl(this._logoControl,l.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent(),this._postStyleWithAppearanceEvent()}),this.on("data",o=>{this._update(o.dataType==="style"),this.fire(new s.z(`${o.dataType}data`,o))}),this.on("dataloading",o=>{this.fire(new s.z(`${o.dataType}dataloading`,o))}),this._interactions=new Xm(this)}_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 s.y(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const o=l.onAdd(this);this._controls.push(l);const c=this._controlPositions[t];return t.indexOf("bottom")!==-1?c.insertBefore(o,c.firstChild):c.appendChild(o),this}removeControl(l){if(!l||!l.onRemove)return this.fire(new s.y(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}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(l){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const t=!this._moving;return t&&this.fire(new s.z("movestart",l)).fire(new s.z("move",l)),this.fire(new s.z("resize",l)),t&&this.fire(new s.z("moveend",l)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(l){return this.transform.setMaxBounds(s.aI.convert(l)),this._update()}setMinZoom(l){if((l=l??-2)>=-2&&l<=this.transform.maxZoom)return this.transform.minZoom=l,this._update(),this.getZoom()<l?this.setZoom(l):this.fire(new s.z("zoomstart")).fire(new s.z("zoom")).fire(new s.z("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(l){if((l=l??22)>=this.transform.minZoom)return this.transform.maxZoom=l,this._update(),this.getZoom()>l?this.setZoom(l):this.fire(new s.z("zoomstart")).fire(new s.z("zoom")).fire(new s.z("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(l){if((l=l??0)<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.fire(new s.z("pitchstart")).fire(new s.z("pitch")).fire(new s.z("pitchend")),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(l){if((l=l??85)>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.fire(new s.z("pitchstart")).fire(new s.z("pitch")).fire(new s.z("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getScaleFactor(){return this._scaleFactor}setScaleFactor(l){return this._scaleFactor=l,this.painter.scaleFactor=l,this.style&&this.style._setLabelPlacementStale(),this.style._updateFilteredLayers(t=>t.type==="symbol"),this._update(!0),this}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(l){return this.transform.renderWorldCopies=l,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(l){return l==="auto"?navigator.language:Array.isArray(l)?l.length===0?void 0:l.map(t=>t==="auto"?navigator.language:t):l}setLanguage(l){const t=this._parseLanguage(l);if(!this.style||t===this._language)return this;this._language=t,this.style.reloadSources();for(const o of this._controls)o._setLanguage&&o._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(l){return this.style&&l!==this._worldview?(this._worldview=l,this._styleDirty=!0,this.style.reloadSources(),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return this.transform.projection.name==="globe"}setProjection(l){return this._lazyInitEmptyStyle(),l?typeof l=="string"&&(l={name:l}):l=null,this._useExplicitProjection=!!l,this._prioritizeAndUpdateProjection(l,this.style.projection)}_updateProjectionTransition(){if(this.getProjection().name!=="globe")return;const l=this.transform,t=l.projection.name;let o;t==="globe"&&l.zoom>=s.cL?(l.setMercatorFromTransition(),o=!0):t==="mercator"&&l.zoom<s.cL&&(l.setProjection({name:"globe"}),o=!0),o&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayerUpdate(),this._update(!0))}_prioritizeAndUpdateProjection(l,t){return this._updateProjection(l||t||{name:"mercator"})}_updateProjection(l){let t;const o=this.transform.mercatorFromTransition;t=l.name==="globe"&&this.transform.zoom>=s.cL?this.transform.setMercatorFromTransition():this.transform.setProjection(l),this.style.applyProjectionUpdate();const c=this.transform.getProjection().name==="mercator"&&o!==this.transform.mercatorFromTransition;return(t||c)&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(l,t){return this.transform.locationPoint3D(s.aT.convert(l),t)}unproject(l,t){return this.transform.pointLocation3D(s.P.convert(l),t)}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(l,t,o){const c=d=>{let p=[];if(Array.isArray(t)){const m=t.filter(y=>this.getLayer(y));p=m.length?this.queryRenderedFeatures(d,{layers:m}):[]}else p=this.queryRenderedFeatures(d,{target:t});return p};if(l==="mouseenter"||l==="mouseover"){let d=!1;return{listener:o,targets:t,delegates:{mousemove:m=>{const y=c(m.point);y.length?d||(d=!0,o.call(this,new Ir(l,this,m.originalEvent,{features:y}))):d=!1},mouseout:()=>{d=!1}}}}if(l==="mouseleave"||l==="mouseout"){let d=!1;return{listener:o,targets:t,delegates:{mousemove:y=>{c(y.point).length?d=!0:d&&(d=!1,o.call(this,new Ir(l,this,y.originalEvent)))},mouseout:y=>{d&&(d=!1,o.call(this,new Ir(l,this,y.originalEvent)))}}}}{const d=p=>{const m=c(p.point);m.length&&(p.features=m,o.call(this,p),delete p.features)};return{listener:o,targets:t,delegates:{[l]:d}}}}on(l,t,o){if(typeof t=="function"||o===void 0)return super.on(l,t);if(typeof t=="string"&&(t=[t]),!this._areTargetsValid(t))return this;const c=this._createDelegatedListener(l,t,o);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[l]=this._delegatedListeners[l]||[],this._delegatedListeners[l].push(c);for(const d in c.delegates)this.on(d,c.delegates[d]);return this}once(l,t,o){if(typeof t=="function"||o===void 0)return super.once(l,t);if(typeof t=="string"&&(t=[t]),!this._areTargetsValid(t))return this;const c=this._createDelegatedListener(l,t,o);for(const d in c.delegates)this.once(d,c.delegates[d]);return this}off(l,t,o){if(typeof t=="function"||o===void 0)return super.off(l,t);if(typeof t=="string"&&(t=[t]),!this._areTargetsValid(t))return this;const c=this._delegatedListeners?this._delegatedListeners[l]:void 0;return c&&(d=>{for(let p=0;p<d.length;p++){const m=d[p];if(m.listener===o&&Ym(m.targets,t)){for(const y in m.delegates)this.off(y,m.delegates[y]);return d.splice(p,1),this}}})(c),this}queryRenderedFeatures(l,t){if(!this.style)return[];if(l===void 0||l instanceof s.P||Array.isArray(l)||t!==void 0||(t=l,l=void 0),l=l||[[0,0],[this.transform.width,this.transform.height]],!t){const p=this.style.queryRenderedFeatures(l,void 0,this.transform),m=this.style.queryRenderedFeatureset(l,void 0,this.transform);return p.concat(m)}let o=!0;if(t.target&&(o=this._isTargetValid(t.target),o&&!t.layers))return this.style.queryRenderedFeatureset(l,t,this.transform);let c=!0;if(t.layers&&Array.isArray(t.layers)){for(const p of t.layers)if(!this._isValidId(p)){c=!1;break}if(c&&!t.target)return this.style.queryRenderedFeatures(l,t,this.transform)}let d=[];return c&&(d=d.concat(this.style.queryRenderedFeatures(l,t,this.transform))),o&&(d=d.concat(this.style.queryRenderedFeatureset(l,t,this.transform))),d}querySourceFeatures(l,t){return!l||typeof l=="string"&&!this._isValidId(l)?[]:this.style.querySourceFeatures(l,t)}queryRasterValue(l,t,o){return this._isValidId(l)?this.style.queryRasterValue(l,t,o):Promise.resolve(null)}isPointOnSurface(l){const{name:t}=this.transform.projection;return t!=="globe"&&t!=="mercator"&&s.w(`${t} projection does not support isPointOnSurface, this API may behave unex
3002pectedly.`),this.transform.isPointOnSurface(s.P.convert(l))}addInteraction(l,t){return this._interactions.add(l,t),this}removeInteraction(l){return this._interactions.remove(l),this}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(l){return this._cooperativeGestures=l,this}setStyle(l,t){return t=Object.assign({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily},t),this.style&&l&&t.diff!==!1&&t.localFontFamily===this._localFontFamily&&t.localIdeographFontFamily===this._localIdeographFontFamily&&!t.config?(this.style._diffStyle(l,(o,c)=>{if(o){const d=typeof o=="string"?o:o instanceof Error?o.message:o.error;s.w(`Unable to perform style diff: ${d}. Rebuilding the style from scratch.`),this._updateStyle(l,t)}else c&&this._update(!0)},()=>this._postStyleLoadEvent()),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._localFontFamily=t.localFontFamily,this._updateStyle(l,t))}_getUIString(l){const t=this._locale[l];if(t==null)throw new Error(`Missing UI string '${l}'`);return t}_updateStyle(l,t){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),l){const o=Object.assign({},t);t&&t.config&&(o.initialConfig=t.config,delete o.config),this.style=new bn(this,o).load(l),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new bn(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(s.w("There is no style added to the map."),!1)}_isValidId(l){return l==null?(this.fire(new s.y(new Error("IDs can't be empty."))),!1):!s.dr(l)||(this.fire(new s.y(new Error(`IDs can't contain special symbols: "${l}".`))),!1)}_isTargetValid(l){return"featuresetId"in l?this._isValidId("importId"in l?l.importId:l.featuresetId):"layerId"in l&&this._isValidId(l.layerId)}_areTargetsValid(l){if(Array.isArray(l)){for(const t of l)if(!this._isValidId(t))return!1;return!0}return this._isTargetValid(l)}addSource(l,t){return this._isValidId(l)?(this._lazyInitEmptyStyle(),this.style.addSource(l,t),this._update(!0)):this}isSourceLoaded(l){return!!this._isValidId(l)&&!!this.style&&this.style._isSourceCacheLoaded(l)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(l,t,o){this._lazyInitEmptyStyle(),this.style.addSourceType(l,t,o)}removeSource(l){return this._isValidId(l)?(this.style.removeSource(l),this._updateTerrain(),this._update(!0)):this}getSource(l){return this._isValidId(l)?this.style.getOwnSource(l):null}addImage(l,t,{pixelRatio:o=1,sdf:c=!1,stretchX:d,stretchY:p,content:m}={}){this._lazyInitEmptyStyle();const y=s.I.from(l);if(t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap){const{width:x,height:T,data:S}=s.o.getImageData(t);this.style.addImage(y,{data:new s.q({width:x,height:T},S),pixelRatio:o,stretchX:d,stretchY:p,content:m,sdf:c,version:0,usvg:!1})}else if(t.width===void 0||t.height===void 0)this.fire(new s.y(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`")));else{const{width:x,height:T}=t,S=t;this.style.addImage(y,{data:new s.q({width:x,height:T},new Uint8Array(S.data)),pixelRatio:o,stretchX:d,stretchY:p,content:m,sdf:c,usvg:!1,version:0,userImage:S}),S.onAdd&&S.onAdd(this,l)}}updateImage(l,t){this._lazyInitEmptyStyle();const o=s.I.from(l),c=this.style.getImage(o);if(!c)return void this.fire(new s.y(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const d=t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap?s.o.getImageData(t):t,{width:p,height:m,data:y}=d;if(p===void 0||m===void 0)return void this.fire(new s.y(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(p!==(c.usvg?c.icon.usvg_tree.width:c.data.width)||m!==(c.usvg?c.icon.usvg_tree.height:c.data.height))return void this.fire(new s.y(new Error(`The width and height of the updated image (${p}, ${m})
3003                must be that same as the previous version of the image
3004                (${c.data.width}, ${c.data.height})`)));const x=!(t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap);let T=!1;c.usvg?(c.data=new s.q({width:p,height:m},new Uint8Array(y)),c.usvg=!1,c.icon=void 0,T=!0):c.data.replace(y,x),this.style.updateImage(o,c,T)}hasImage(l){return l?!!this.style&&!!this.style.getImage(s.I.from(l)):(this.fire(new s.y(new Error("Missing required image id"))),!1)}removeImage(l){this.style.removeImage(s.I.from(l))}loadImage(l,t){s.n(this._requestManager.transformRequest(l,s.R.Image),(o,c)=>{t(o,c instanceof HTMLImageElement?s.o.getImageData(c):c)})}
vendor: 26,316 bytes, line 3004
3004listImages(){return this.style.listImages().map(l=>l.name)}addModel(l,t){this._lazyInitEmptyStyle(),this.style.addModel(l,t)}hasModel(l){return l?this.style.hasModel(l):(this.fire(new s.y(new Error("Missing required model id"))),!1)}removeModel(l){this.style.removeModel(l)}listModels(){return this.style.listModels()}addLayer(l,t){return this._isValidId(l.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(l,t),this._update(!0)):this}getSlot(l){const t=this.getLayer(l);return t&&t.slot||null}setSlot(l,t){return this.style.setSlot(l,t),this.style.mergeLayers(),this._update(!0)}addImport(l,t){return this.style.addImport(l,t).catch(o=>this.fire(new s.y(new Error("Failed to add import",o)))),this}updateImport(l,t){return typeof t!="string"&&t.id!==l?(this.removeImport(l),this.addImport(t)):(this.style.updateImport(l,t),this._update(!0))}removeImport(l){return this.style.removeImport(l),this}moveImport(l,t){return this.style.moveImport(l,t),this._update(!0)}moveLayer(l,t){return this._isValidId(l)?(this.style.moveLayer(l,t),this._update(!0)):this}removeLayer(l){return this._isValidId(l)?(this.style.removeLayer(l),this._update(!0)):this}getLayer(l){if(!this._isValidId(l))return null;const t=this.style.getOwnLayer(l);return t?t.type==="custom"?t.implementation:t.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(l,t,o){return this._isValidId(l)?(this.style.setLayerZoomRange(l,t,o),this._update(!0)):this}setFilter(l,t,o={}){return this._isValidId(l)?(this.style.setFilter(l,t,o),this._update(!0)):this}getFilter(l){return this._isValidId(l)?this.style.getFilter(l):null}setPaintProperty(l,t,o,c={}){return this._isValidId(l)?(this.style.setPaintProperty(l,t,o,c),this._update(!0)):this}getPaintProperty(l,t){return this._isValidId(l)?this.style.getPaintProperty(l,t):null}setLayoutProperty(l,t,o,c={}){return this._isValidId(l)?(this.style.setLayoutProperty(l,t,o,c),this._update(!0)):this}getLayoutProperty(l,t){return this._isValidId(l)?this.style.getLayoutProperty(l,t):null}setLayerProperty(l,t,o,c={}){return this._isValidId(l)?(t==="appearances"&&this._postAddingAppearancesToStyleEvent(),this.style.setLayerProperty(l,t,o,c),this._update(!0)):this}getGlyphsUrl(){return this.style.getGlyphsUrl()}setGlyphsUrl(l){return this.style.setGlyphsUrl(l),this._update(!0)}getSchema(l){return this.style.getSchema(l)}setSchema(l,t){return this.style.setSchema(l,t),this._update(!0)}getConfig(l){return this.style.getConfig(l)}setConfig(l,t){return this.style.setConfig(l,t),this._update(!0)}getConfigProperty(l,t){return this.style.getConfigProperty(l,t)}setConfigProperty(l,t,o){return this.style.setConfigProperty(l,t,o),this._update(!0)}getFeaturesetDescriptors(l){return this.style.getFeaturesetDescriptors(l)}setLights(l){if(this._lazyInitEmptyStyle(),l&&l.length===1&&l[0].type==="flat"){const t=l[0];t.properties?this.style.setFlatLight(t.properties,t.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(l),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const l=this.style.getLights()||[];return l.length===0&&l.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),l}setLight(l,t={}){return console.log("The `map.setLight` function is deprecated, prefer using `map.setLights` with `flat` light type instead."),this.setLights([{id:"flat",type:"flat",properties:l}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(l){return this._lazyInitEmptyStyle(),!l&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(l),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(l){return this._lazyInitEmptyStyle(),this.style.setFog(l),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setSnow(l){return this._lazyInitEmptyStyle(),this.style.setSnow(l),this._update(!0)}getSnow(){return this.style?this.style.getSnow():null}setRain(l){return this._lazyInitEmptyStyle(),this.style.setRain(l),this._update(!0)}getRain(){return this.style?this.style.getRain():null}setColorTheme(l){return this._lazyInitEmptyStyle(),this.style.setColorTheme(l),this._update(!0)}setImportColorTheme(l,t){return this._lazyInitEmptyStyle(),this.style.setImportColorTheme(l,t),this._update(!0)}setCamera(l){return this.style.setCamera(l),this._triggerCameraUpdate(l)}_triggerCameraUpdate(l){return this._update(this.transform.setOrthographicProjectionAtLowPitch(l["camera-projection"]==="orthographic"))}getCamera(){return this.style.camera}_queryFogOpacity(l){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(s.aT.convert(l),this.transform):0}setFeatureState(l,t){return l.source&&!this._isValidId(l.source)?this:(this.style.setFeatureState(l,t),this._update())}removeFeatureState(l,t){return l.source&&!this._isValidId(l.source)?this:(this.style.removeFeatureState(l,t),this._update())}getFeatureState(l){return l.source&&!this._isValidId(l.source)?null:this.style.getFeatureState(l)}_selectIndoorFloor(l){this.style.indoorManager.selectFloor(l)}_setIndoorActiveFloorsVisibility(l){this.style.indoorManager.setActiveFloorsVisibility(l)}getIndoorTileOptions(l,t){return this.style.isIndoorEnabled()?this.style.indoorManager.getIndoorTileOptions(l,t):null}_updateContainerDimensions(){if(!this._container)return;const l=this._container.getBoundingClientRect().width||400,t=this._container.getBoundingClientRect().height||300;let o,c,d,p=this._container;for(;p&&(!c||!d);){const m=window.getComputedStyle(p).transform;m&&m!=="none"&&(o=m.match(/matrix.*\((.+)\)/)[1].split(", "),o[0]&&o[0]!=="0"&&o[0]!=="1"&&(c=o[0]),o[3]&&o[3]!=="0"&&o[3]!=="1"&&(d=o[3])),p=p.parentElement}this._containerWidth=c?Math.abs(l/c):l,this._containerHeight=d?Math.abs(t/d):t}_detectMissingCSS(){window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")!=="rgb(250, 128, 114)"&&s.w("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){const l=this._container;l.classList.add("mapboxgl-map"),(this._missingCSSCanary=ni("div","mapboxgl-canary",l)).style.visibility="hidden",this._detectMissingCSS();const t=this._canvasContainer=ni("div","mapboxgl-canvas-container",l);this._canvas=ni("canvas","mapboxgl-canvas",t),this._interactive&&(t.classList.add("mapboxgl-interactive"),this._canvas.setAttribute("tabindex","0")),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const o=this._controlContainer=ni("div","mapboxgl-control-container",l),c=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(d=>{c[d]=ni("div",`mapboxgl-ctrl-${d}`,o)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(l,t){const o=s.o.devicePixelRatio||1;this._canvas.width=o*Math.ceil(l),this._canvas.height=o*Math.ceil(t),this._canvas.style.width=`${l}px`,this._canvas.style.height=`${t}px`}_addMarker(l){this._markers.push(l)}_removeMarker(l){const t=this._markers.indexOf(l);t!==-1&&this._markers.splice(t,1)}_addPopup(l){this._popups.push(l)}_removePopup(l){const t=this._popups.indexOf(l);t!==-1&&this._popups.splice(t,1)}_setupPainter(){const l=Object.assign({},Hn.supported.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),t=this._canvas.getContext("webgl2",l);t?(io(t,!0),this.painter=new Qf(t,this._contextCreateOptions,this.transform,this._scaleFactor,this._worldview),this.on("data",o=>{if(o.dataType==="source"){const c=this.transform.elevation?this.transform.elevation._source():null;c&&o.sourceCacheId===c.id&&this.style&&this.style._setLabelPlacementStale(),this.painter.setTileLoadedFlag(!0)}}),s.k.testSupport(t)):this.fire(new s.y(new Error("Failed to initialize WebGL")))}_contextLost(l){l.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new s.z("webglcontextlost",{originalEvent:l}))}_contextRestored(l){this._setupPainter(),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight)),this._updateTerrain(),this.style&&(this.style.clearLayers(),this.style.imageManager.destroyAtlasTextures(),this.style.reloadModels(),this.style.clearSources()),this._update(),this.fire(new s.z("webglcontextrestored",{originalEvent:l}))}_onMapScroll(l){if(l.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}idle(){return!this.isMoving()&&this.loaded()}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}frameReady(){return this.loaded()&&!this._placementDirty}_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)}_requestDomTask(l){!this.loaded()||this.loaded()&&!this.isMoving()?l():this._domRenderTaskQueue.add(l)}_render(l){let t;this.fire(new s.z("renderstart")),++this._frameId;const o=this.painter.context.extTimerQuery,c=s.o.now(),d=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(t=d.createQuery(),d.beginQuery(o.TIME_ELAPSED_EXT,t)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&(this._interactionRange[0]=Math.min(this._interactionRange[0],performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],performance.now())),this._renderTaskQueue.run(l),this._domRenderTaskQueue.run(l),this._removed)return;this._updateProjectionTransition();const p=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const x=this.transform.zoom,T=this.transform.pitch,S=s.o.now(),M=new s.ac(x,{now:S,fadeDuration:p,pitch:T,transition:this.style.transition,worldview:this._worldview});this.style.update(M)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let m=!1;if(this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),m=this._updateAverageElevation(c),this.style.updateSources(this.transform),this.style.updateImageProviders(),this.isMoving()||this._forceMarkerAndPopupUpdate()):m=this._updateAverageElevation(c),this.style&&(this._placementDirty=this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,p,this._crossSourceCollisions,this.painter.replacementSource)),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showParseStatus:this.showParseStatus,wireframe:{terrain:this.showTerrainWireframe,layers2D:this.showLayers2DWireframe,layers3D:this.showLayers3DWireframe},showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:p,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new s.z("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,Ui.mark(wt.load),this.fire(new s.z("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&(this.style.snow||this.style.rain)&&(this._styleDirty=!0),this.style&&this.style.imageManager.hasPatternsInFlight()&&(this._styleDirty=!0),this.style&&!this.style.modelManager.isLoaded()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),t){const x=s.o.now()-c;d.endQuery(o.TIME_ELAPSED_EXT),setTimeout(()=>{const T=d.getQueryParameter(t,d.QUERY_RESULT)/1e6;d.deleteQuery(t),this.fire(new s.z("gpu-timing-frame",{cpuTime:x,gpuTime:T}))},50)}if(this.listens("gpu-timing-layer")){const x=this.painter.collectGpuTimers();setTimeout(()=>{const T=this.painter.queryGpuTimers(x);this.fire(new s.z("gpu-timing-layer",{layerTimes:T}))},50)}if(this.listens("gpu-timing-deferred-render")){const x=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const T=this.painter.queryGpuTimeDeferredRender(x);this.fire(new s.z("gpu-timing-deferred-render",{gpuTime:T}))},50)}const y=this._sourcesDirty||this._styleDirty||this._placementDirty||m;if(y||this._repaint)this.triggerRepaint();else{const x=this.idle();if(x&&(m=this._updateAverageElevation(c,!0)),m)this.triggerRepaint();else if(this._triggerFrame(!1),x&&(this.fire(new s.z("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const T=this._calculateSpeedIndex();this.fire(new s.z("speedindexcompleted",{speedIndex:T})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||y||(this._fullyLoaded=!0,Ui.mark(wt.fullLoad),this._performanceMetricsCollection&&Qi(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(l){for(const t of this._markers)l&&!this.getRenderWorldCopies()&&(t._lngLat=t._lngLat.wrap()),t._update();for(const t of this._popups)!l||this.getRenderWorldCopies()||t._trackPointer||(t._lngLat=t._lngLat.wrap()),t._update()}_updateAverageElevation(l,t=!1){const o=d=>(this.transform.averageElevation=d,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&&o(0);const c=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(c||(t||l-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(l)){const d=this.transform.averageElevation;let p=this.transform.sampleAverageElevation();this.transform.elevation!=null&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(p)?p=0:this._averageElevationLastSampledAt=l;const m=Math.abs(d-p);if(m>1){if(this._isInitialLoad||c)return this._averageElevation.jumpTo(p),o(p);this._averageElevation.easeTo(p,l,300)}else if(m>1e-4)return this._averageElevation.jumpTo(p),o(p)}return!!this._averageElevation.isEasing(l)&&o(this._averageElevation.getValue(l))}_authenticate(){ts(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,l=>{if(l&&(l.message===li||l.status===401)){const t=this.painter.context.gl;io(t,!1),this._logoControl instanceof pp&&this._logoControl._updateLogo(),t&&t.clear(t.DEPTH_BUFFER_BIT|t.COLOR_BUFFER_BIT|t.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new s.y(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}}),cc(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&uc(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_postStyleWithAppearanceEvent(){this.style.globalId&&this.style.hasAppearances()&&mi(this._requestManager._customAccessToken)}_postAddingAppearancesToStyleEvent(){Fr(this._requestManager._customAccessToken)}_updateTerrain(){const l=this._isDragging();this.painter.updateTerrain(this.style,l)}_calculateSpeedIndex(){const l=this.painter.canvasCopy(),t=this.painter.getCanvasCopiesAndTimestamps();t.timeStamps.push(performance.now());const o=this.painter.context.gl,c=o.createFramebuffer();function d(p){o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,p,0);const m=new Uint8Array(o.drawingBufferWidth*o.drawingBufferHeight*4);return o.readPixels(0,0,o.drawingBufferWidth,o.drawingBufferHeight,o.RGBA,o.UNSIGNED_BYTE,m),m}return o.bindFramebuffer(o.FRAMEBUFFER,c),this._canvasPixelComparison(d(l),t.canvasCopies.map(d),t.timeStamps)}_canvasPixelComparison(l,t,o){let c=o[1]-o[0];const d=l.length/4;for(let p=0;p<t.length;p++){const m=t[p];let y=0;for(let x=0;x<m.length;x+=4)m[x]===l[x]&&m[x+1]===l[x+1]&&m[x+2]===l[x+2]&&m[x+3]===l[x+3]&&(y+=1);c+=(o[p+2]-o[p+1])*(1-y/d)}return c}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._domRenderTaskQueue.clear(),this.style&&this.style.destroy(),this.painter.destroy(),this.handlers&&this.handlers.destroy(),this.handlers=void 0,this.setStyle(null),window.removeEventListener("resize",this._onWindowResize,!1),window.removeEventListener("orientationchange",this._onWindowResize,!1),window.removeEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.removeEventListener("online",this._onWindowOnline,!1),window.removeEventListener("visibilitychange",this._onVisibilityChange,!1);const l=this.painter.context.gl.getExtension("WEBGL_lose_context");l&&l.loseContext(),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._missingCSSCanary.remove(),this._canvas=void 0,this._canvasContainer=void 0,this._controlContainer=void 0,this._missingCSSCanary=void 0,this._container.classList.remove("mapboxgl-map"),this._container.removeEventListener("scroll",this._onMapScroll,!1),Os.delete(this.painter.context.gl),es.remove(),Mn.remove(),this._removed=!0,this.fire(new s.z("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(l){this._renderNextFrame=this._renderNextFrame||l,this.style&&!this._frame&&(this._frame=s.o.frame(t=>{const o=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,o&&this._render(t)}))}_preloadTiles(l){const t=this.style?this.style.getSourceCaches():[];return s.bw(t,(o,c)=>o._preloadTiles(l,c),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(l){this._trackResize&&this.resize({originalEvent:l})._update()}_onVisibilityChange(){document.visibilityState==="hidden"&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(l){this._showTileBoundaries!==l&&(this._showTileBoundaries=l,this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(l){this._showParseStatus!==l&&(this._showParseStatus=l,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(l){this._showTerrainWireframe!==l&&(this._showTerrainWireframe=l,this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(l){this._showLayers2DWireframe!==l&&(this._showLayers2DWireframe=l,this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(l){this._showLayers3DWireframe!==l&&(this._showLayers3DWireframe=l,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(l){this._speedIndexTiming!==l&&(this._speedIndexTiming=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,this.style&&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()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(l){this._showTileAABBs!==l&&(this._showTileAABBs=l,l&&this._update())}_setCacheLimits(l,t){s.f4(l,t)}get version(){return zt}},NavigationControl:class{constructor(l={}){this.options=Object.assign({},yp,l),this._container=ni("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(s.aY(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",t=>{this._map&&this._map.zoomIn({},{originalEvent:t})}),ni("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",t=>{this._map&&this._map.zoomOut({},{originalEvent:t})}),ni("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(s.aY(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",t=>{const o=this._map;o&&(this.options.visualizePitch?o.resetNorthPitch({},{originalEvent:t}):o.resetNorth({},{originalEvent:t}))}),this._compassIcon=ni("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const l=this._map;if(!l)return;const t=l.getZoom(),o=t===l.getMaxZoom(),c=t===l.getMinZoom();this._zoomInButton.disabled=o,this._zoomOutButton.disabled=c,this._zoomInButton.setAttribute("aria-disabled",o.toString()),this._zoomOutButton.setAttribute("aria-disabled",c.toString())}_rotateCompassArrow(){const l=this._map;if(!l)return;const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(l.transform.pitch*(Math.PI/180)),.5)}) rotateX(${l.transform.pitch}deg) rotateZ(${l.transform.angle*(180/Math.PI)}deg)`:`rotate(${l.transform.angle*(180/Math.PI)}deg)`;l._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=t)})}onAdd(l){return this._map=l,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),l.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&l.on("pitch",this._rotateCompassArrow),l.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new rd(l,this._compass,this.options.visualizePitch)),this._container}onRemove(){const l=this._map;l&&(this._container.remove(),this.options.showZoom&&l.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&l.off("pitch",this._rotateCompassArrow),l.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(l,t){const o=ni("button",l,this._container);return o.type="button",o.addEventListener("click",t),o}_setButtonTitle(l,t){if(!this._map)return;const o=this._map._getUIString(`NavigationControl.${t}`);l.setAttribute("aria-label",o),l.firstElementChild&&l.firstElementChild.setAttribute("title",o)}},GeolocateControl:class extends s.E{constructor(l={}){super();const t=navigator.geolocation;this.options=Object.assign({geolocation:t},Bn,l),s.aY(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=ep(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(l){return this._map=l,this._container=ni("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){this._clearRequestTimeout(),this._geolocationWatchID!==void 0&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(l){const t=(o=!!this.options.geolocation)=>{this._supportsGeolocation=o,l(o)};this._supportsGeolocation!==void 0?l(this._supportsGeolocation):navigator.permissions!==void 0?navigator.permissions.query({name:"geolocation"}).then(o=>t(o.state!=="denied")).catch(()=>t()):t()}_isOutOfMapMaxBounds(l){const t=this._map.getMaxBounds(),o=l.coords;return!!t&&(o.longitude<t.getWest()||o.longitude>t.getEast()||o.latitude<t.getSouth()||o.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(l){if(this._map){if(this._clearRequestTimeout(),this._isOutOfMapMaxBounds(l))return this._setErrorState(),this.fire(new s.z("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_E
3004RROR":this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this.options.followUserLocation?(this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active")):(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"));break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(l),this.options.followUserLocation&&(!this.options.trackUserLocation||this._watchState==="ACTIVE_LOCK")&&this._updateCamera(l),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new s.z("geolocate",Object.assign({coords:l.coords,timestamp:l.timestamp},l.toJSON?{toJSON:l.toJSON.bind(l)}:{}))),this._finish()}}_updateCamera(l){const t=new s.aT(l.coords.longitude,l.coords.latitude),o=l.coords.accuracy,c=this._map.getBearing(),d=Object.assign({bearing:c},this.options.fitBoundsOptions);this._map.fitBounds(t.toBounds(o),d,{geolocateSource:!0})}_updateMarker(l){if(l){const t=new s.aT(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.transform,t=s.cf(1,l._center.lat)*l.worldSize,o=Math.ceil(2*this._accuracy*t);this._circleElement.style.width=`${o}px`,this._circleElement.style.height=`${o}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&typeof this._heading=="number"?(this._userLocationDotMarker.setRotation(this._heading),this._userLocationDotMarker.addClassName("mapboxgl-user-location-show-heading")):(this._userLocationDotMarker.removeClassName("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(l){if(this._map){if(this._clearRequestTimeout(),this.options.trackUserLocation)if(l.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(l.code===3&&this._noTimeout)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new s.z("error",{code:l.code,message:l.message,PERMISSION_DENIED:l.PERMISSION_DENIED,POSITION_UNAVAILABLE:l.POSITION_UNAVAILABLE,TIMEOUT:l.TIMEOUT})),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_startRequestTimeout(){this._clearRequestTimeout();const l=this.options.positionOptions.timeout;l&&(this._requestTimeoutId=window.setTimeout(()=>{this._onError({code:3,message:"Geolocation request timed out"})},l))}_clearRequestTimeout(){this._requestTimeoutId!==void 0&&(clearTimeout(this._requestTimeoutId),this._requestTimeoutId=void 0)}_setupUI(l){if(this._map!==void 0){if(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=ni("button","mapboxgl-ctrl-geolocate",this._container),ni("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",l===!1){s.w("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","fal
3004se"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=ni("div","mapboxgl-user-location"),this._dotElement.appendChild(ni("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(ni("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new ir({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=ni("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ir({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.showButton||(this._container.style.display="none"),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("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new s.z("trackuserlocationend")))})}}_onDeviceOrientation(l){this._userLocationDotMarker&&(l.webkitCompassHeading?this._heading=l.webkitCompassHeading:l.absolute===!0&&(this._heading=-1*l.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return s.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new s.z("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new s.z("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new s.z("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let l;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(l={maximumAge:6e5,timeout:0},this._noTimeout=!0):(l=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,l),this._startRequestTimeout(),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._startRequestTimeout(),this._timeoutId=window.setTimeout(this._finish,1e4);return!0}setFollowUserLocation(l){return this.options.followUserLocation=l??Bn.followUserLocation,this.options.trackUserLocation&&this._watchState!=="OFF"&&(this.options.followUserLocation?this._watchState!=="BACKGROUND"&&this._watchState!=="BACKGROUND_ERROR"||(this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new s.z("trackuserlocationstart"))):this._watchState!=="ACTIVE_LOCK"&&this._watchState!=="ACTIVE_E
3004RROR"||(this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this.fire(new s.z("trackuserlocationend")))),this}_addDeviceOrientationListener(){const l=()=>{const t="ondeviceorientationabsolute"in window?"deviceorientationabsolute":"deviceorientation";window.addEventListener(t,this._onDeviceOrientation)};typeof DeviceOrientationEvent.requestPermission=="function"?DeviceOrientationEvent.requestPermission().then(t=>{t==="granted"&&l()}).catch(console.error):l()}_clearWatch(){this._clearRequestTimeout(),this.options.geolocation.clearWatch(this._geolocationWatchID),window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:fp,ScaleControl:class{constructor(l={}){this.options=Object.assign({},Wl,l),s.aY(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const l=this.options.maxWidth||100,t=this._map,o=t._containerHeight/2,c=t._containerWidth/2-l/2,d=t.unproject([c,o]),p=t.unproject([c+l,o]),m=d.distanceTo(p);if(this.options.unit==="imperial"){const y=3.2808*m;y>5280?this._setScale(l,y/5280,"mile"):this._setScale(l,y,"foot")}else this.options.unit==="nautical"?this._setScale(l,m/1852,"nautical-mile"):m>=1e3?this._setScale(l,m/1e3,"kilometer"):this._setScale(l,m,"meter")}_setScale(l,t,o){this._map._requestDomTask(()=>{const c=(function(p){const m=Math.pow(10,`${Math.floor(p)}`.length-1);let y=p/m;return y=y>=10?10:y>=5?5:y>=3?3:y>=2?2:y>=1?1:(function(x){const T=Math.pow(10,Math.ceil(-Math.log(x)/Math.LN10));return Math.round(x*T)/T})(y),m*y})(t),d=c/t;this._container.innerHTML=o!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:o}).format(c):`${c}&nbsp;${su[o]}`,this._container.style.width=l*d+"px"})}onAdd(l){return this._map=l,this._language=l.getLanguage(),this._container=ni("div","mapboxgl-ctrl mapboxgl-ctrl-scale",l.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(l){this._language=l,this._update()}setUnit(l){this.options.unit=l,this._update()}},FullscreenControl:class{constructor(l={}){this._fullscreen=!1,l&&l.container&&(l.container instanceof HTMLElement?this._container=l.container:s.w("Full screen control 'container' must be a DOM element.")),s.aY(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(l){return this._map=l,this._container||(this._container=this._map.getContainer()),this._controlContainer=ni("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",s.w("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!document.fullscreenEnabled&&!document.webkitFullscreenEnabled)}_setupUI(){const l=this._fullscreenButton=ni("button","mapboxgl-ctrl-fullscreen",this._controlContainer);ni("span","mapboxgl-ctrl-icon",l).setAttribute("aria-hidden","true"),l.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const l=this._getTitle();this._fullscreenButton.setAttribute("aria-label",l),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",l)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(document.fullscreenElement||document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},IndoorControl:Wu,Popup:class extends s.E{constructor(l){super(),this.options=Object.assign(Object.create(xp),l),this._altitude=this.options.altitude,s.aY(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(l&&l.className?l.className.trim().split(/\s+/):[])}addTo(l){return this._map&&this.remove(),this._map=l,this.options.closeOnClick&&l.on("preclick",this._onClose),this.options.closeOnMove&&l.on("move",this._onClose),l.on("remove",this.remove),this._update(),l._addPopup(this),this._focusFirstElement(),this._trackPointer?(l.on("mousemove",this._onMouseEvent),l.on("mouseup",this._onMouseEvent),l._canvasContainer.classList.add("mapboxgl-track-pointer")):l.on("move",this._update),this.fire(new s.z("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const l=this._map;return l&&(l.off("move",this._update),l.off("move",this._onClose),l.off("preclick",this._onClose),l.off("click",this._onClose),l.off("remove",this.remove),l.off("mousemove",this._onMouseEvent),l.off("mouseup",this._onMouseEvent),l.off("drag",this._onMouseEvent),l._canvasContainer&&l._canvasContainer.classList.remove("mapboxgl-track-pointer"),l._removePopup(this),this._map=void 0),this.fire(new s.z("close")),this}getLngLat(){return this._lngLat}setLngLat(l){this._lngLat=s.aT.convert(l),this._pos=null,this._trackPointer=!1,this._update();const t=this._map;return t&&(t.on("move",this._update),t.off("mousemove",this._onMouseEvent),t._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}getAltitude(){return this._altitude}setAltitude(l){return this._altitude=l,this._update(),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const l=this._map;return l&&(l.off("move",this._update),l.on("mousemove",this._onMouseEvent),l.on("drag",this._onMouseEvent),l._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(l){return this.setDOMContent(document.createTextNode(l))}setHTML(l){const t=document.createDocumentFragment(),o=document.createElement("body");let c;for(o.innerHTML=l;c=o.firstChild,c;
vendor: 4,024 bytes, line 3004
3004)t.appendChild(c);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(l){return this.options.maxWidth=l,this._update(),this}setDOMContent(l){let t=this._content;if(t)for(;t.hasChildNodes();)t.firstChild&&t.removeChild(t.firstChild);else t=this._content=ni("div","mapboxgl-popup-content",this._container||void 0);if(t.appendChild(l),this.options.closeButton){const o=this._closeButton=ni("button","mapboxgl-popup-close-button",t);o.type="button",o.setAttribute("aria-label","Close popup"),o.innerHTML='<span aria-hidden="true">&#215;</span>',o.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(l){return this._classList.add(l),this._updateClassList(),this}removeClassName(l){return this._classList.delete(l),this._updateClassList(),this}setOffset(l){return this.options.offset=l,this._update(),this}toggleClassName(l){let t;return this._classList.delete(l)?t=!1:(this._classList.add(l),t=!0),this._updateClassList(),t}_onMouseEvent(l){this._update(l.point)}_getAnchor(l){if(this.options.anchor)return this.options.anchor;const t=this._map,o=this._container,c=this._pos;if(!t||!o||!c)return"bottom";const d=o.offsetWidth,p=o.offsetHeight,m=c.x<d/2,y=c.x>t.transform.width-d/2;if(c.y+l<p)return m?"top-left":y?"top-right":"top";if(c.y>t.transform.height-p){if(m)return"bottom-left";if(y)return"bottom-right"}return m?"left":y?"right":"bottom"}_updateClassList(){const l=this._container;if(!l)return;const t=[...this._classList];t.push("mapboxgl-popup"),this._anchor&&t.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&t.push("mapboxgl-popup-track-pointer"),l.className=t.join(" ")}_update(l){const t=this._map,o=this._content;if(!t||!this._lngLat&&!this._trackPointer||!o)return;let c=this._container;if(c||(c=this._container=ni("div","mapboxgl-popup",t.getContainer()),this._tip=ni("div","mapboxgl-popup-tip",c),c.appendChild(o)),this.options.maxWidth&&c.style.maxWidth!==this.options.maxWidth&&(c.style.maxWidth=this.options.maxWidth),t.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Zl(this._lngLat,this._pos,t.transform)),!this._trackPointer||l){const d=this._pos=this._trackPointer&&l instanceof s.P?l:t.project(this._lngLat,this._altitude),p=ja(this.options.offset),m=this._anchor=this._getAnchor(p.y),y=ja(this.options.offset,m),x=d.add(y).round();t._requestDomTask(()=>{this._container&&m&&(this._container.style.transform=`${so[m]} translate(${x.x}px,${x.y}px)`)})}if(!this._marker&&t._showingGlobe()){const d=s.f5(t.transform,this._lngLat)?0:1;this._setOpacity(d)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const l=this._container.querySelector(Km);l&&l.focus()}_onClose(){this.remove()}_setOpacity(l){this._container&&(this._container.style.opacity=`${l}`),this._content&&(this._content.style.pointerEvents=l?"auto":"none")}},Marker:ir,Style:bn,LngLat:s.aT,LngLatBounds:s.aI,Point:s.P,MercatorCoordinate:s.ae,FreeCameraOptions:sf,Evented:s.E,config:s.e,prewarm:s.f9,clearPrewarmedResources:s.f8,get accessToken(){return s.e.ACCESS_TOKEN},set accessToken(l){s.e.ACCESS_TOKEN=l},get baseApiUrl(){return s.e.API_URL},set baseApiUrl(l){s.e.API_URL=l},get workerCount(){return s.fi.workerCount},set workerCount(l){s.fi.workerCount=l},get maxParallelImageRequests(){return s.e.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(l){s.e.MAX_PARALLEL_IMAGE_REQUESTS=l},clearStorage(l){s.fh(l)},get workerUrl(){return s.fg.workerUrl},set workerUrl(l){s.fg.workerUrl=l},get workerClass(){return s.fg.workerClass},set workerClass(l){s.fg.workerClass=l},get workerParams(){return s.fg.workerParams},set workerParams(l){s.fg.workerParams=l},get dracoUrl(){return s.ff()},set dracoUrl(l){s.fe(l)},get meshoptUrl(){return s.fd()},set meshoptUrl(l){s.fc(l)},setNow:s.o.setNow,restoreNow:s.o.restoreNow}});var at=Ve;return at}))})(xm)),xm.exports}export{q2 as L,N2 as M,j2 as N,U2 as P,G2 as S,n2 as _,V2 as a,H2 as r};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.