/*! For license information please see embed-93f992ed.js.LICENSE.txt */ (()=>{var e={4532:(e,t,i)=>{"use strict";var n=i(3310),r=i(7529),o="value",s="\n ",a={};function l(e){var t=Array.isArray(e);return function(i){var n=c(a.plainArray,i);if(n)return n;if(t&&i.length!==e.length)return"an array with "+e.length+" items";for(var r=0;re.length?t:e}))}},a.equal=function(e){return function(t){if(t!==e)return JSON.stringify(e)}},a.oneOf=function(){var e=(Array.isArray(arguments[0])?arguments[0]:Array.prototype.slice.call(arguments)).map((function(e){return a.equal(e)}));return a.oneOfType.apply(this,e)},a.range=function(e){var t=e[0],i=e[1];return function(e){if(c(a.number,e)||ei)return"number between "+t+" & "+i+" (inclusive)"}},a.any=function(){},a.boolean=function(e){if("boolean"!=typeof e)return"boolean"},a.number=function(e){if("number"!=typeof e)return"number"},a.plainArray=function(e){if(!Array.isArray(e))return"array"},a.plainObject=function(e){if(!n(e))return"object"},a.string=function(e){if("string"!=typeof e)return"string"},a.func=function(e){if("function"!=typeof e)return"function"},a.validate=c,a.processMessage=u,e.exports=a},8236:(e,t,i)=>{"use strict";var n=i(3416).x0;function r(e){this.origin=e.origin||"https://api.mapbox.com",this.endpoint="events/v2",this.access_token=e.accessToken,this.version="0.2.0",this.sessionID=this.generateSessionID(),this.userAgent=this.getUserAgent(),this.options=e,this.send=this.send.bind(this),this.countries=e.countries?e.countries.split(","):null,this.types=e.types?e.types.split(","):null,this.bbox=e.bbox?e.bbox:null,this.language=e.language?e.language.split(","):null,this.limit=e.limit?+e.limit:null,this.locale=navigator.language||null,this.enableEventLogging=this.shouldEnableLogging(e),this.eventQueue=new Array,this.flushInterval=e.flushInterval||1e3,this.maxQueueSize=e.maxQueueSize||100,this.timer=this.flushInterval?setTimeout(this.flush.bind(this),this.flushInterval):null,this.lastSentInput="",this.lastSentIndex=0}r.prototype={select:function(e,t){var i=this.getSelectedIndex(e,t),n=this.getEventPayload("search.select",t);if(n.resultIndex=i,n.resultPlaceName=e.place_name,n.resultId=e.id,(i!==this.lastSentIndex||n.queryString!==this.lastSentInput)&&-1!=i&&(this.lastSentIndex=i,this.lastSentInput=n.queryString,n.queryString))return this.push(n)},start:function(e){var t=this.getEventPayload("search.start",e);if(t.queryString)return this.push(t)},keyevent:function(e,t){if(e.key&&!e.metaKey&&-1===[9,27,37,39,13,38,40].indexOf(e.keyCode)){var i=this.getEventPayload("search.keystroke",t);if(i.lastAction=e.key,i.queryString)return this.push(i)}},send:function(e,t){if(!this.enableEventLogging)return t?t():void 0;var i=this.getRequestOptions(e);this.request(i,function(e){return e?this.handleError(e,t):t?t():void 0}.bind(this))},getRequestOptions:function(e){return Array.isArray(e)||(e=[e]),{method:"POST",host:this.origin,path:this.endpoint+"?access_token="+this.access_token,headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}},getEventPayload:function(e,t){var i;i=t.options.proximity?"object"==typeof t.options.proximity?[t.options.proximity.longitude,t.options.proximity.latitude]:"ip"===t.options.proximity?[999,999]:t.options.proximity:null;var n=t._map?t._map.getZoom():void 0,r={event:e,created:+new Date,sessionIdentifier:this.sessionID,country:this.countries,userAgent:this.userAgent,language:this.language,bbox:this.bbox,types:this.types,endpoint:"mapbox.places",autocomplete:t.options.autocomplete,fuzzyMatch:t.options.fuzzyMatch,proximity:i,limit:t.options.limit,routing:t.options.routing,worldview:t.options.worldview,mapZoom:n,keyboardLocale:this.locale};return"search.select"===e?r.queryString=t.inputString:"search.select"!=e&&t._inputEl?r.queryString=t._inputEl.value:r.queryString=t.inputString,r},request:function(e,t){var i=new XMLHttpRequest;for(var n in i.onreadystatechange=function(){if(4==this.readyState)return 204==this.status?t(null):t(this.statusText)},i.open(e.method,e.host+"/"+e.path,!0),e.headers){var r=e.headers[n];i.setRequestHeader(n,r)}i.send(e.body)},handleError:function(e,t){if(t)return t(e)},generateSessionID:function(){return n()},getUserAgent:function(){return"mapbox-gl-geocoder."+this.version+"."+navigator.userAgent},getSelectedIndex:function(e,t){if(t._typeahead){var i=t._typeahead.data,n=e.id;return i.map((function(e){return e.id})).indexOf(n)}},shouldEnableLogging:function(e){return!(!1===e.enableEventLogging||e.origin&&"https://api.mapbox.com"!==e.origin||e.localGeocoder||e.filter)},flush:function(){this.eventQueue.length>0&&(this.send(this.eventQueue),this.eventQueue=new Array),this.timer&&clearTimeout(this.timer),this.flushInterval&&(this.timer=setTimeout(this.flush.bind(this),this.flushInterval))},push:function(e,t){this.eventQueue.push(e),(this.eventQueue.length>=this.maxQueueSize||t)&&this.flush()},remove:function(){this.flush()}},e.exports=r},6630:e=>{e.exports={fr:{name:"France",bbox:[[-4.59235,41.380007],[9.560016,51.148506]]},us:{name:"United States",bbox:[[-171.791111,18.91619],[-66.96466,71.357764]]},ru:{name:"Russia",bbox:[[19.66064,41.151416],[190.10042,81.2504]]},ca:{name:"Canada",bbox:[[-140.99778,41.675105],[-52.648099,83.23324]]}}},2645:e=>{function t(){}t.prototype={isSupport:function(){return Boolean(window.navigator.geolocation)},getCurrentPosition:function(){const e={enableHighAccuracy:!0};return new Promise((function(t,i){window.navigator.geolocation.getCurrentPosition(t,i,e)}))}},e.exports=t},9651:(e,t,i)=>{"use strict";var n=i(504),r=i(1296),o=i(7529),s=i(7187).EventEmitter,a=i(6630),l=i(4010),c=i(2081),u=i(8236),h=i(2227),d=i(4395),p=i(2645),f=i(4537);function m(e){this._eventEmitter=new s,this.options=o({},this.options,e),this.inputString="",this.fresh=!0,this.lastSelected=null,this.geolocation=new p}m.prototype={options:{zoom:16,flyTo:!0,trackProximity:!0,minLength:2,reverseGeocode:!1,flipCoordinates:!1,limit:5,origin:"https://api.mapbox.com",enableEventLogging:!0,marker:!0,mapboxgl:null,collapsed:!1,clearAndBlurOnEsc:!1,clearOnBlur:!1,enableGeolocation:!1,addressAccuracy:"street",getItemValue:function(e){return e.place_name},render:function(e){var t=e.place_name.split(",");return'
'+t[0]+'
'+t.splice(1,t.length).join(",")+"
"}},addTo:function(e){function t(e,t){if(!document.body.contains(t))throw new Error("Element provided to #addTo() exists, but is not in the DOM");const i=e.onAdd();t.appendChild(i)}if(e._controlContainer)e.addControl(this);else if(e instanceof HTMLElement)t(this,e);else{if("string"!=typeof e)throw new Error("Error: addTo must be a mapbox-gl-js map, an html element, or a CSS selector query for a single html element");{const i=document.querySelectorAll(e);if(0===i.length)throw new Error("Element ",e,"not found.");if(i.length>1)throw new Error("Geocoder can only be added to a single html element");t(this,i[0])}}},onAdd:function(e){if(e&&"string"!=typeof e&&(this._map=e),this.setLanguage(),this.options.localGeocoderOnly||(this.geocoderService=c(l({accessToken:this.options.accessToken,origin:this.options.origin}))),this.options.localGeocoderOnly&&!this.options.localGeocoder)throw new Error("A localGeocoder function must be specified to use localGeocoderOnly mode");this.eventManager=new u(this.options),this._onChange=this._onChange.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onPaste=this._onPaste.bind(this),this._onBlur=this._onBlur.bind(this),this._showButton=this._showButton.bind(this),this._hideButton=this._hideButton.bind(this),this._onQueryResult=this._onQueryResult.bind(this),this.clear=this.clear.bind(this),this._updateProximity=this._updateProximity.bind(this),this._collapse=this._collapse.bind(this),this._unCollapse=this._unCollapse.bind(this),this._clear=this._clear.bind(this),this._clearOnBlur=this._clearOnBlur.bind(this),this._geolocateUser=this._geolocateUser.bind(this);var t=this.container=document.createElement("div");t.className="mapboxgl-ctrl-geocoder mapboxgl-ctrl";var i=this.createIcon("search",'');this._inputEl=document.createElement("input"),this._inputEl.type="text",this._inputEl.className="mapboxgl-ctrl-geocoder--input",this.setPlaceholder(),this.options.collapsed&&(this._collapse(),this.container.addEventListener("mouseenter",this._unCollapse),this.container.addEventListener("mouseleave",this._collapse),this._inputEl.addEventListener("focus",this._unCollapse)),(this.options.collapsed||this.options.clearOnBlur)&&this._inputEl.addEventListener("blur",this._onBlur),this._inputEl.addEventListener("keydown",r(this._onKeyDown,200)),this._inputEl.addEventListener("paste",this._onPaste),this._inputEl.addEventListener("change",this._onChange),this.container.addEventListener("mouseenter",this._showButton),this.container.addEventListener("mouseleave",this._hideButton),this._inputEl.addEventListener("keyup",function(e){this.eventManager.keyevent(e,this)}.bind(this));var o=document.createElement("div");o.classList.add("mapboxgl-ctrl-geocoder--pin-right"),this._clearEl=document.createElement("button"),this._clearEl.setAttribute("aria-label","Clear"),this._clearEl.addEventListener("click",this.clear),this._clearEl.className="mapboxgl-ctrl-geocoder--button";var s=this.createIcon("close",'');if(this._clearEl.appendChild(s),this._loadingEl=this.createIcon("loading",''),o.appendChild(this._clearEl),o.appendChild(this._loadingEl),t.appendChild(i),t.appendChild(this._inputEl),t.appendChild(o),this.options.enableGeolocation&&this.geolocation.isSupport()){this._geolocateEl=document.createElement("button"),this._geolocateEl.setAttribute("aria-label","Geolocate"),this._geolocateEl.addEventListener("click",this._geolocateUser),this._geolocateEl.className="mapboxgl-ctrl-geocoder--button";var a=this.createIcon("geolocate",'');this._geolocateEl.appendChild(a),o.appendChild(this._geolocateEl),this._showGeolocateButton()}var h=this._typeahead=new n(this._inputEl,[],{filter:!1,minLength:this.options.minLength,limit:this.options.limit});this.setRenderFunction(this.options.render),h.getItemValue=this.options.getItemValue;var d,p=h.list.draw,f=this._footerNode=((d=document.createElement("div")).className="mapboxgl-ctrl-geocoder--powered-by",d.innerHTML='Powered by Mapbox',d);return h.list.draw=function(){p.call(this),f.addEventListener("mousedown",function(){this.selectingListItem=!0}.bind(this)),f.addEventListener("mouseup",function(){this.selectingListItem=!1}.bind(this)),this.element.appendChild(f)},this.mapMarker=null,this._handleMarker=this._handleMarker.bind(this),this._map&&(this.options.trackProximity&&(this._updateProximity(),this._map.on("moveend",this._updateProximity)),this._mapboxgl=this.options.mapboxgl,!this._mapboxgl&&this.options.marker&&(console.error("No mapboxgl detected in options. Map markers are disabled. Please set options.mapboxgl."),this.options.marker=!1)),t},_geolocateUser:function(){this._hideGeolocateButton(),this._showLoadingIcon(),this.geolocation.getCurrentPosition().then(function(e){this._hideLoadingIcon();const t={geometry:{type:"Point",coordinates:[e.coords.longitude,e.coords.latitude]}};this._handleMarker(t),this._fly(t),this._typeahead.clear(),this._typeahead.selected=!0,this.lastSelected=JSON.stringify(t),this._showClearButton(),this.fresh=!1;const i={limit:1,language:[this.options.language],query:t.geometry.coordinates,types:["address"]};if(this.options.localGeocoderOnly){const e=t.geometry.coordinates[0]+","+t.geometry.coordinates[1];this._setInputValue(e),this._eventEmitter.emit("result",{result:t})}else this.geocoderService.reverseGeocode(i).send().then(function(e){const i=e.body.features[0];if(i){const e=f.transformFeatureToGeolocationText(i,this.options.addressAccuracy);this._setInputValue(e),i.user_coordinates=t.geometry.coordinates,this._eventEmitter.emit("result",{result:i})}else this._eventEmitter.emit("result",{result:{user_coordinates:t.geometry.coordinates}})}.bind(this))}.bind(this)).catch(function(e){1===e.code?this._renderUserDeniedGeolocationError():this._renderLocationError(),this._hideLoadingIcon(),this._showGeolocateButton(),this._hideAttribution()}.bind(this))},createIcon:function(e,t){var i=document.createElementNS("http://www.w3.org/2000/svg","svg");return i.setAttribute("class","mapboxgl-ctrl-geocoder--icon mapboxgl-ctrl-geocoder--icon-"+e),i.setAttribute("viewBox","0 0 18 18"),i.setAttribute("xml:space","preserve"),i.setAttribute("width",18),i.setAttribute("height",18),i.innerHTML=t,i},onRemove:function(){return this.container.parentNode.removeChild(this.container),this.options.trackProximity&&this._map&&this._map.off("moveend",this._updateProximity),this._removeMarker(),this._map=null,this},_setInputValue:function(e){this._inputEl.value=e,setTimeout(function(){this._inputEl.focus(),this._inputEl.scrollLeft=0,this._inputEl.setSelectionRange(0,0)}.bind(this),1)},_onPaste:function(e){var t=(e.clipboardData||window.clipboardData).getData("text");t.length>=this.options.minLength&&this._geocode(t)},_onKeyDown:function(e){var t=27,i=9;if(e.keyCode===t&&this.options.clearAndBlurOnEsc)return this._clear(e),this._inputEl.blur();var n=e.target&&e.target.shadowRoot?e.target.shadowRoot.activeElement:e.target;if(!n||!n.value)return this.fresh=!0,e.keyCode!==i&&this.clear(e),this._showGeolocateButton(),this._hideClearButton();this._hideGeolocateButton(),e.metaKey||-1!==[i,t,37,39,13,38,40].indexOf(e.keyCode)||n.value.length>=this.options.minLength&&this._geocode(n.value)},_showButton:function(){this._typeahead.selected&&this._showClearButton()},_hideButton:function(){this._typeahead.selected&&this._hideClearButton()},_showClearButton:function(){this._clearEl.style.display="block"},_hideClearButton:function(){this._clearEl.style.display="none"},_showGeolocateButton:function(){this._geolocateEl&&this.geolocation.isSupport()&&(this._geolocateEl.style.display="block")},_hideGeolocateButton:function(){this._geolocateEl&&(this._geolocateEl.style.display="none")},_showLoadingIcon:function(){this._loadingEl.style.display="block"},_hideLoadingIcon:function(){this._loadingEl.style.display="none"},_showAttribution:function(){this._footerNode.style.display="block"},_hideAttribution:function(){this._footerNode.style.display="none"},_onBlur:function(e){this.options.clearOnBlur&&this._clearOnBlur(e),this.options.collapsed&&this._collapse()},_onChange:function(){var e=this._typeahead.selected;e&&JSON.stringify(e)!==this.lastSelected&&(this._hideClearButton(),this.options.flyTo&&this._fly(e),this.options.marker&&this._mapboxgl&&this._handleMarker(e),this._inputEl.focus(),this._inputEl.scrollLeft=0,this._inputEl.setSelectionRange(0,0),this.lastSelected=JSON.stringify(e),this._eventEmitter.emit("result",{result:e}),this.eventManager.select(e,this))},_fly:function(e){var t;if(e.properties&&a[e.properties.short_code])t=o({},this.options.flyTo),this._map&&this._map.fitBounds(a[e.properties.short_code].bbox,t);else if(e.bbox){var i=e.bbox;t=o({},this.options.flyTo),this._map&&this._map.fitBounds([[i[0],i[1]],[i[2],i[3]]],t)}else{var n={zoom:this.options.zoom};t=o({},n,this.options.flyTo),e.center?t.center=e.center:e.geometry&&e.geometry.type&&"Point"===e.geometry.type&&e.geometry.coordinates&&(t.center=e.geometry.coordinates),this._map&&this._map.flyTo(t)}},_requestType:function(e,t){return e.localGeocoderOnly?1:e.reverseGeocode&&f.REVERSE_GEOCODE_COORD_RGX.test(t)?2:0},_setupConfig:function(e,t){const i=/[\s,]+/;var n=this,r=["bbox","limit","proximity","countries","types","language","reverseMode","mode","autocomplete","fuzzyMatch","routing","worldview"].reduce((function(e,t){if(void 0===n.options[t]||null===n.options[t])return e;["countries","types","language"].indexOf(t)>-1?e[t]=n.options[t].split(i):e[t]=n.options[t];const r="number"==typeof n.options[t].longitude&&"number"==typeof n.options[t].latitude;if("proximity"===t&&r){const i=n.options[t].longitude,r=n.options[t].latitude;e[t]=[i,r]}return e}),{});switch(e){case 2:var s=t.split(i).map((function(e){return parseFloat(e,10)}));n.options.flipCoordinates||s.reverse(),!r.types||r.types[0],r=o(r,{query:s,limit:1}),["proximity","autocomplete","fuzzyMatch","bbox"].forEach((function(e){e in r&&delete r[e]}));break;case 0:{const e=t.trim();/^(-?\d{1,3}(\.\d{0,256})?)[, ]+(-?\d{1,3}(\.\d{0,256})?)?$/.test(e)&&(t=t.replace(/,/g," ")),r=o(r,{query:t})}}return r},_geocode:function(e){this.inputString=e,this._showLoadingIcon(),this._eventEmitter.emit("loading",{query:e});const t=this._requestType(this.options,e),i=this._setupConfig(t,e);var n;switch(t){case 1:n=Promise.resolve();break;case 0:n=this.geocoderService.forwardGeocode(i).send();break;case 2:n=this.geocoderService.reverseGeocode(i).send()}var r=this.options.localGeocoder&&this.options.localGeocoder(e)||[],o=[],s=null;return n.catch(function(e){s=e}.bind(this)).then(function(t){this._hideLoadingIcon();var n={};return t?"200"==t.statusCode&&((n=t.body).request=t.request,n.headers=t.headers):n={type:"FeatureCollection",features:[]},n.config=i,this.fresh&&(this.eventManager.start(this),this.fresh=!1),n.features=n.features?r.concat(n.features):r,this.options.externalGeocoder?(o=this.options.externalGeocoder(e,n.features)||Promise.resolve([])).then((function(e){return n.features=n.features?e.concat(n.features):e,n}),(function(){return n})):n}.bind(this)).then(function(e){if(s)throw s;this.options.filter&&e.features.length&&(e.features=e.features.filter(this.options.filter)),e.features.length?(this._showClearButton(),this._hideGeolocateButton(),this._showAttribution(),this._eventEmitter.emit("results",e),this._typeahead.update(e.features)):(this._hideClearButton(),this._hideAttribution(),this._typeahead.selected=null,this._renderNoResults(),this._eventEmitter.emit("results",e))}.bind(this)).catch(function(e){this._hideLoadingIcon(),this._hideAttribution(),r.length&&this.options.localGeocoder||o.length&&this.options.externalGeocoder?(this._showClearButton(),this._hideGeolocateButton(),this._typeahead.update(r)):(this._hideClearButton(),this._typeahead.selected=null,this._renderError()),this._eventEmitter.emit("results",{features:r}),this._eventEmitter.emit("error",{error:e})}.bind(this)),n},_clear:function(e){e&&e.preventDefault(),this._inputEl.value="",this._typeahead.selected=null,this._typeahead.clear(),this._onChange(),this._hideClearButton(),this._showGeolocateButton(),this._removeMarker(),this.lastSelected=null,this._eventEmitter.emit("clear"),this.fresh=!0},clear:function(e){this._clear(e),this._inputEl.focus()},_clearOnBlur:function(e){e.relatedTarget&&this._clear(e)},_onQueryResult:function(e){var t=e.body;if(t.features.length){var i=t.features[0];this._typeahead.selected=i,this._inputEl.value=i.place_name,this._onChange()}},_updateProximity:function(){if(this._map&&this.options.trackProximity)if(this._map.getZoom()>9){var e=this._map.getCenter().wrap();this.setProximity({longitude:e.lng,latitude:e.lat},!1)}else this.setProximity(null,!1)},_collapse:function(){this._inputEl.value||this._inputEl===document.activeElement||this.container.classList.add("mapboxgl-ctrl-geocoder--collapsed")},_unCollapse:function(){this.container.classList.remove("mapboxgl-ctrl-geocoder--collapsed")},query:function(e){return this._geocode(e).then(this._onQueryResult),this},_renderError:function(){this._renderMessage("
There was an error reaching the server
")},_renderLocationError:function(){this._renderMessage("
A location error has occurred
")},_renderNoResults:function(){this._renderMessage("
No results found
")},_renderUserDeniedGeolocationError:function(){this._renderMessage("
Geolocation permission denied
")},_renderMessage:function(e){this._typeahead.update([]),this._typeahead.selected=null,this._typeahead.clear(),this._typeahead.renderError(e)},_getPlaceholderText:function(){if(this.options.placeholder)return this.options.placeholder;if(this.options.language){var e=this.options.language.split(",")[0],t=d.language(e),i=h.placeholder[t];if(i)return i}return"Search"},setInput:function(e){return this._inputEl.value=e,this._typeahead.selected=null,this._typeahead.clear(),e.length>=this.options.minLength&&this._geocode(e),this},setProximity:function(e,t=!0){return this.options.proximity=e,t&&(this.options.trackProximity=!1),this},getProximity:function(){return this.options.proximity},setRenderFunction:function(e){return e&&"function"==typeof e&&(this._typeahead.render=e),this},getRenderFunction:function(){return this._typeahead.render},setLanguage:function(e){var t=navigator.language||navigator.userLanguage||navigator.browserLanguage;return this.options.language=e||this.options.language||t,this},getLanguage:function(){return this.options.language},getZoom:function(){return this.options.zoom},setZoom:function(e){return this.options.zoom=e,this},getFlyTo:function(){return this.options.flyTo},setFlyTo:function(e){return this.options.flyTo=e,this},getPlaceholder:function(){return this.options.placeholder},setPlaceholder:function(e){return this.placeholder=e||this._getPlaceholderText(),this._inputEl.placeholder=this.placeholder,this._inputEl.setAttribute("aria-label",this.placeholder),this},getBbox:function(){return this.options.bbox},setBbox:function(e){return this.options.bbox=e,this},getCountries:function(){return this.options.countries},setCountries:function(e){return this.options.countries=e,this},getTypes:function(){return this.options.types},setTypes:function(e){return this.options.types=e,this},getMinLength:function(){return this.options.minLength},setMinLength:function(e){return this.options.minLength=e,this._typeahead&&(this._typeahead.options.minLength=e),this},getLimit:function(){return this.options.limit},setLimit:function(e){return this.options.limit=e,this._typeahead&&(this._typeahead.options.limit=e),this},getFilter:function(){return this.options.filter},setFilter:function(e){return this.options.filter=e,this},setOrigin:function(e){return this.options.origin=e,this.geocoderService=c(l({accessToken:this.options.accessToken,origin:this.options.origin})),this},getOrigin:function(){return this.options.origin},setAccessToken:function(e){return this.options.accessToken=e,this.geocoderService=c(l({accessToken:this.options.accessToken,origin:this.options.origin})),this},setAutocomplete:function(e){return this.options.autocomplete=e,this},getAutocomplete:function(){return this.options.autocomplete},setFuzzyMatch:function(e){return this.options.fuzzyMatch=e,this},getFuzzyMatch:function(){return this.options.fuzzyMatch},setRouting:function(e){return this.options.routing=e,this},getRouting:function(){return this.options.routing},setWorldview:function(e){return this.options.worldview=e,this},getWorldview:function(){return this.options.worldview},_handleMarker:function(e){if(this._map){this._removeMarker();var t=o({},{color:"#4668F2"},this.options.marker);return this.mapMarker=new this._mapboxgl.Marker(t),e.center?this.mapMarker.setLngLat(e.center).addTo(this._map):e.geometry&&e.geometry.type&&"Point"===e.geometry.type&&e.geometry.coordinates&&this.mapMarker.setLngLat(e.geometry.coordinates).addTo(this._map),this}},_removeMarker:function(){this.mapMarker&&(this.mapMarker.remove(),this.mapMarker=null)},on:function(e,t){return this._eventEmitter.on(e,t),this},off:function(e,t){return this._eventEmitter.removeListener(e,t),this.eventManager.remove(),this}},e.exports=m},2227:e=>{"use strict";e.exports={placeholder:{de:"Suche",it:"Ricerca",en:"Search",nl:"Zoeken",fr:"Chercher",ca:"Cerca",he:"לחפש",ja:"サーチ",lv:"Meklēt",pt:"Procurar",sr:"Претрага",zh:"搜索",cs:"Vyhledávání",hu:"Keresés",ka:"ძიება",nb:"Søke",sk:"Vyhľadávanie",th:"ค้นหา",fi:"Hae",is:"Leita",ko:"수색",pl:"Szukaj",sl:"Iskanje",fa:"جستجو",ru:"Поиск"}}},4537:e=>{function t(e){const t=e.address||"",i=e.text||"",n=e.place_name||"",r={address:n.split(",")[0],houseNumber:t,street:i,placeName:n};return e.context.forEach((function(e){const t=e.id.split(".")[0];r[t]=e.text})),r}e.exports={transformFeatureToGeolocationText:function(e,i){const n=t(e),r=["address","street","place","country"];if("function"==typeof i)return i(n);const o=r.indexOf(i);return(-1===o?r:r.slice(o)).reduce((function(e,t){return n[t]?(""!==e&&(e+=", "),e+n[t]):e}),"")},getAddressInfo:t,REVERSE_GEOCODE_COORD_RGX:/^[ ]*(-?\d{1,3}(\.\d{0,256})?)[, ]+(-?\d{1,3}(\.\d{0,256})?)[ ]*$/}},4010:(e,t,i)=>{"use strict";var n=i(2543);e.exports=n},2543:(e,t,i)=>{"use strict";var n=i(9366),r=i(8503);function o(e){r.call(this,e)}o.prototype=Object.create(r.prototype),o.prototype.constructor=o,o.prototype.sendRequest=n.browserSend,o.prototype.abortRequest=n.browserAbort,e.exports=function(e){return new o(e)}},9366:(e,t,i)=>{"use strict";var n=i(6293),r=i(4404),o=i(1835),s=i(9614),a={};function l(e){var t=e.total,i=e.loaded;return{total:t,transferred:i,percent:100*i/t}}function c(e,t){return new Promise((function(i,n){t.onprogress=function(t){e.emitter.emit(o.EVENT_PROGRESS_DOWNLOAD,l(t))};var s=e.file;s&&(t.upload.onprogress=function(t){e.emitter.emit(o.EVENT_PROGRESS_UPLOAD,l(t))}),t.onerror=function(e){n(e)},t.onabort=function(){var t=new r({request:e,type:o.ERROR_REQUEST_ABORTED});n(t)},t.onload=function(){if(delete a[e.id],t.status<200||t.status>=400){var o=new r({request:e,body:t.response,statusCode:t.status});n(o)}else i(t)};var c=e.body;"string"==typeof c?t.send(c):c?t.send(JSON.stringify(c)):s?t.send(s):t.send(),a[e.id]=t})).then((function(t){return function(e,t){return new n(e,{body:t.response,headers:s(t.getAllResponseHeaders()),statusCode:t.status})}(e,t)}))}function u(e,t){var i=e.url(t),n=new window.XMLHttpRequest;return n.open(e.method,i),Object.keys(e.headers).forEach((function(t){n.setRequestHeader(t,e.headers[t])})),n}e.exports={browserAbort:function(e){var t=a[e.id];t&&(t.abort(),delete a[e.id])},sendRequestXhr:c,browserSend:function(e){return Promise.resolve().then((function(){var t=u(e,e.client.accessToken);return c(e,t)}))},createRequestXhr:u}},8503:(e,t,i)=>{"use strict";var n=i(4713),r=i(5225),o=i(1835);function s(e){if(!e||!e.accessToken)throw new Error("Cannot create a client without an access token");n(e.accessToken),this.accessToken=e.accessToken,this.origin=e.origin||o.API_ORIGIN}s.prototype.createRequest=function(e){return new r(this,e)},e.exports=s},4404:(e,t,i)=>{"use strict";var n=i(1835);e.exports=function(e){var t,i=e.type||n.ERROR_HTTP;if(e.body)try{t=JSON.parse(e.body)}catch(i){t=e.body}else t=null;var r=e.message||null;r||("string"==typeof t?r=t:t&&"string"==typeof t.message?r=t.message:i===n.ERROR_REQUEST_ABORTED&&(r="Request aborted")),this.message=r,this.type=i,this.statusCode=e.statusCode||null,this.request=e.request,this.body=t}},5225:(e,t,i)=>{"use strict";var n=i(4713),r=i(7529),o=i(6729),s=i(5959),a=i(1835),l=1;function c(e,t){if(!e)throw new Error("MapiRequest requires a client");if(!t||!t.path||!t.method)throw new Error("MapiRequest requires an options object with path and method properties");var i={};t.body&&(i["content-type"]="application/json");var n=r(i,t.headers),s=Object.keys(n).reduce((function(e,t){return e[t.toLowerCase()]=n[t],e}),{});this.id=l++,this._options=t,this.emitter=new o,this.client=e,this.response=null,this.error=null,this.sent=!1,this.aborted=!1,this.path=t.path,this.method=t.method,this.origin=t.origin||e.origin,this.query=t.query||{},this.params=t.params||{},this.body=t.body||null,this.file=t.file||null,this.encoding=t.encoding||"utf8",this.sendFileAs=t.sendFileAs||null,this.headers=s}c.prototype.url=function(e){var t=s.prependOrigin(this.path,this.origin);t=s.appendQueryObject(t,this.query);var i=this.params,o=null==e?this.client.accessToken:e;if(o){t=s.appendQueryParam(t,"access_token",o);var a=n(o).user;i=r({ownerId:a},i)}return t=s.interpolateRouteParams(t,i)},c.prototype.send=function(){var e=this;if(e.sent)throw new Error("This request has already been sent. Check the response and error properties. Create a new request with clone().");return e.sent=!0,e.client.sendRequest(e).then((function(t){return e.response=t,e.emitter.emit(a.EVENT_RESPONSE,t),t}),(function(t){throw e.error=t,e.emitter.emit(a.EVENT_ERROR,t),t}))},c.prototype.abort=function(){this._nextPageRequest&&(this._nextPageRequest.abort(),delete this._nextPageRequest),this.response||this.error||this.aborted||(this.aborted=!0,this.client.abortRequest(this))},c.prototype.eachPage=function(e){var t=this;function i(i){e(null,i,(function(){delete t._nextPageRequest;var e=i.nextPage();e&&(t._nextPageRequest=e,r(e))}))}function n(t){e(t,null,(function(){}))}function r(e){e.send().then(i,n)}r(this)},c.prototype.clone=function(){return this._extend()},c.prototype._extend=function(e){var t=r(this._options,e);return new c(this.client,t)},e.exports=c},6293:(e,t,i)=>{"use strict";var n=i(4626);function r(e,t){this.request=e,this.headers=t.headers,this.rawBody=t.body,this.statusCode=t.statusCode;try{this.body=JSON.parse(t.body||"{}")}catch(e){this.body=t.body}this.links=n(this.headers.link)}r.prototype.hasNextPage=function(){return!!this.links.next},r.prototype.nextPage=function(){return this.hasNextPage()?this.request._extend({path:this.links.next.url}):null},e.exports=r},1835:e=>{"use strict";e.exports={API_ORIGIN:"https://api.mapbox.com",EVENT_PROGRESS_DOWNLOAD:"downloadProgress",EVENT_PROGRESS_UPLOAD:"uploadProgress",EVENT_ERROR:"error",EVENT_RESPONSE:"response",ERROR_HTTP:"HttpError",ERROR_REQUEST_ABORTED:"RequestAbortedError"}},9614:e=>{"use strict";e.exports=function(e){var t={};return e?(e.trim().split(/[\r|\n]+/).forEach((function(e){var i=function(e){var t=e.indexOf(":");return{name:e.substring(0,t).trim().toLowerCase(),value:e.substring(t+1).trim()}}(e);t[i.name]=i.value})),t):t}},4626:e=>{"use strict";e.exports=function(e){return e?e.split(/,\s*]*)>(.*)/);if(!t)return null;var i=t[1],n=t[2].split(";"),r=null,o=n.reduce((function(e,t){var i=function(e){var t=e.match(/\s*(.+)\s*=\s*"?([^"]+)"?/);return t?{key:t[1],value:t[2]}:null}(t);return i?"rel"===i.key?(r||(r=i.value),e):(e[i.key]=i.value,e):e}),{});return r?{url:i,rel:r,params:o}:null}(t);return i?(i.rel.split(/\s+/).forEach((function(t){e[t]||(e[t]={url:i.url,params:i.params})})),e):e}),{}):{}}},5959:e=>{"use strict";function t(e){return Array.isArray(e)?e.map(encodeURIComponent).join(","):encodeURIComponent(String(e))}function i(e,i,n){if(!1===n||null===n)return e;var r=/\?/.test(e)?"&":"?",o=encodeURIComponent(i);return void 0!==n&&""!==n&&!0!==n&&(o+="="+t(n)),""+e+r+o}e.exports={appendQueryObject:function(e,t){if(!t)return e;var n=e;return Object.keys(t).forEach((function(e){var r=t[e];void 0!==r&&(Array.isArray(r)&&(r=r.filter((function(e){return null!=e})).join(",")),n=i(n,e,r))})),n},appendQueryParam:i,prependOrigin:function(e,t){if(!t)return e;if("http"===e.slice(0,4))return e;var i="/"===e[0]?"":"/";return""+t.replace(/\/$/,"")+i+e},interpolateRouteParams:function(e,i){return i?e.replace(/\/:([a-zA-Z0-9]+)/g,(function(e,n){var r=i[n];if(void 0===r)throw new Error("Unspecified route parameter "+n);return"/"+t(r)})):e}}},2081:(e,t,i)=>{"use strict";var n=i(7529),r=i(1222),o=i(2497),s=i(3886),a=i(3222),l={},c=["country","region","postcode","district","place","locality","neighborhood","address","poi","poi.landmark"];l.forwardGeocode=function(e){r.assertShape({query:r.required(r.string),mode:r.oneOf("mapbox.places","mapbox.places-permanent"),countries:r.arrayOf(r.string),proximity:r.oneOf(r.coordinates,"ip"),types:r.arrayOf(r.oneOf(c)),autocomplete:r.boolean,bbox:r.arrayOf(r.number),limit:r.number,language:r.arrayOf(r.string),routing:r.boolean,fuzzyMatch:r.boolean,worldview:r.string})(e),e.mode=e.mode||"mapbox.places";var t=s(n({country:e.countries},o(e,["proximity","types","autocomplete","bbox","limit","language","routing","fuzzyMatch","worldview"])));return this.client.createRequest({method:"GET",path:"/geocoding/v5/:mode/:query.json",params:o(e,["mode","query"]),query:t})},l.reverseGeocode=function(e){r.assertShape({query:r.required(r.coordinates),mode:r.oneOf("mapbox.places","mapbox.places-permanent"),countries:r.arrayOf(r.string),types:r.arrayOf(r.oneOf(c)),bbox:r.arrayOf(r.number),limit:r.number,language:r.arrayOf(r.string),reverseMode:r.oneOf("distance","score"),routing:r.boolean,worldview:r.string})(e),e.mode=e.mode||"mapbox.places";var t=s(n({country:e.countries},o(e,["country","types","bbox","limit","language","reverseMode","routing","worldview"])));return this.client.createRequest({method:"GET",path:"/geocoding/v5/:mode/:query.json",params:o(e,["mode","query"]),query:t})},e.exports=a(l)},3222:(e,t,i)=>{"use strict";var n=i(8503),r=i(2543);e.exports=function(e){return function(t){var i;i=n.prototype.isPrototypeOf(t)?t:r(t);var o=Object.create(e);return o.client=i,o}}},4436:e=>{"use strict";e.exports=function(e,t){return Object.keys(e).reduce((function(i,n){return i[n]=t(n,e[n]),i}),{})}},2497:e=>{"use strict";e.exports=function(e,t){var i=function(e,i){return-1!==t.indexOf(e)&&void 0!==i};return"function"==typeof t&&(i=t),Object.keys(e).filter((function(t){return i(t,e[t])})).reduce((function(t,i){return t[i]=e[i],t}),{})}},3886:(e,t,i)=>{"use strict";var n=i(4436);e.exports=function(e){return n(e,(function(e,t){return"boolean"==typeof t?JSON.stringify(t):t}))}},1222:(e,t,i)=>{"use strict";var n=i(7529),r=i(4532);e.exports=n(r,{file:function(e){if("undefined"!=typeof window){if(e instanceof i.g.Blob||e instanceof i.g.ArrayBuffer)return;return"Blob or ArrayBuffer"}if("string"!=typeof e&&void 0===e.pipe)return"Filename or Readable stream"},date:function(e){var t="date";if("boolean"==typeof e)return t;try{var i=new Date(e);if(i.getTime&&isNaN(i.getTime()))return t}catch(e){return t}},coordinates:function(e){return r.tuple(r.number,r.number)(e)},assertShape:function(e,t){return r.assert(r.strictShape(e),t)}})},4713:(e,t,i)=>{"use strict";var n=i(7501),r={};function o(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e){if(r[e])return r[e];var t=e.split("."),i=t[0],s=t[1];if(!s)throw new Error("Invalid token");var a=function(e){try{return JSON.parse(n.decode(e))}catch(e){throw new Error("Invalid token")}}(s),l={usage:i,user:a.u};return o(a,"a")&&(l.authorization=a.a),o(a,"exp")&&(l.expires=1e3*a.exp),o(a,"iat")&&(l.created=1e3*a.iat),o(a,"scopes")&&(l.scopes=a.scopes),o(a,"client")&&(l.client=a.client),o(a,"ll")&&(l.lastLogin=a.ll),o(a,"iu")&&(l.impersonator=a.iu),r[e]=l,l}},7501:function(e,t,i){var n;e=i.nmd(e),function(r){var o=(e&&e.exports,"object"==typeof i.g&&i.g);o.global!==o&&o.window;var s=function(e){this.message=e};(s.prototype=new Error).name="InvalidCharacterError";var a=function(e){throw new s(e)},l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c=/[\t\n\f\r ]/g,u={encode:function(e){e=String(e),/[^\0-\xFF]/.test(e)&&a("The string to be encoded contains characters outside of the Latin1 range.");for(var t,i,n,r,o=e.length%3,s="",c=-1,u=e.length-o;++c>18&63)+l.charAt(r>>12&63)+l.charAt(r>>6&63)+l.charAt(63&r);return 2==o?(t=e.charCodeAt(c)<<8,i=e.charCodeAt(++c),s+=l.charAt((r=t+i)>>10)+l.charAt(r>>4&63)+l.charAt(r<<2&63)+"="):1==o&&(r=e.charCodeAt(c),s+=l.charAt(r>>2)+l.charAt(r<<4&63)+"=="),s},decode:function(e){var t=(e=String(e).replace(c,"")).length;t%4==0&&(t=(e=e.replace(/==?$/,"")).length),(t%4==1||/[^+a-zA-Z0-9/]/.test(e))&&a("Invalid character: the string to be decoded is not correctly encoded.");for(var i,n,r=0,o="",s=-1;++s>(-2*r&6)));return o},version:"0.1.0"};void 0===(n=function(){return u}.call(t,i,t,e))||(e.exports=n)}()},7802:(e,t,i)=>{"use strict";i.d(t,{Z:()=>a});var n=i(8081),r=i.n(n),o=i(3645),s=i.n(o)()(r());s.push([e.id,".cbeb-noscroll {\n overflow: hidden;\n}\n.lds-ripple {\n justify-content: center;\n align-items: center;\n margin: auto;\n position: relative;\n width: 64px;\n height: 64px;\n}\n.lds-ripple div {\n position: absolute;\n border: 4px solid grey;\n opacity: 1;\n border-radius: 50%;\n animation: lds-ripple 1s cubic-bezier(0, 0.2, 0.8, 1) infinite;\n}\n.lds-ripple div:nth-child(2) {\n animation-delay: -0.5s;\n}\n@keyframes lds-ripple {\n 0% {\n top: 28px;\n left: 28px;\n width: 0;\n height: 0;\n opacity: 1;\n }\n 100% {\n top: -1px;\n left: -1px;\n width: 58px;\n height: 58px;\n opacity: 0;\n }\n}\n/* Hack for Google's autocomplete widget */\n/* https://github.com/twbs/bootstrap/issues/4160 */\n.pac-container {\n z-index: 8101 !important;\n}\n/* Hack for Maptiler's autocomplete widget */\n.maptiler-geocoder-results {\n z-index: 8101 !important;\n}\n/* Mobile */\n@media screen and (max-width: 510px) {\n .cbeb-toolbar-searchgroup {\n justify-content: center;\n }\n .cbeb-category-summary-container {\n font-size: 14px;\n }\n .cbeb-category-summary {\n padding-left: 10px;\n padding-right: 10px;\n }\n .cbeb-bio-snippet {\n font-size: 17px;\n }\n .cbeb-entry-view {\n display: flex;\n flex-direction: column;\n font-size: 17px;\n text-align: center;\n }\n .cbeb-modal-title-text {\n font-size: 25px;\n }\n .cbeb-socmed-summary {\n font-size: 21px;\n }\n .cbeb-growdiv {\n flex-grow: 0;\n }\n .cbeb-search-inputfield {\n width: 80%;\n }\n .cbeb-toolbar-btn-group {\n margin-top: 17px;\n }\n .cb-photo-uploaded {\n width: 250px;\n height: 250px;\n }\n .cb-beo-overview-title {\n font-size: 22px;\n }\n .cb-beo-overview-businessname {\n font-size: 20px;\n font-weight: bold;\n line-height: 0.9em;\n }\n .cbeb-toolbar-btnlabel {\n font-size: 23px;\n }\n .cbeb-toolbar-btnlabel-plus {\n font-size: 25px;\n font-weight: bold;\n }\n .cbeb-toolbar-button {\n width: 44px;\n height: 44px;\n }\n .cb-image-upload-readonly {\n width: 250px;\n height: 250px;\n margin-bottom: 20px !important;\n }\n .cbeb-toolbar-btntxt {\n display: none;\n }\n}\n/* Desktop */\n@media screen and (min-width: 511px) {\n .cbeb-growdiv {\n flex-grow: 1;\n }\n .cbeb-search-container {\n width: 300px;\n }\n .cbeb-category-summary {\n padding-left: 5px;\n padding-right: 5px;\n }\n .cbeb-category-summary-container {\n font-size: 12px;\n }\n .cbeb-bio-snippet {\n font-size: 14px;\n }\n .cbeb-socmed-summary {\n font-size: 17px;\n }\n .cbeb-entry-view {\n display: flex;\n flex-direction: column;\n font-size: 15px;\n text-align: center;\n line-height: 1.2 !important;\n }\n .cbeb-entry-view p {\n margin-top: 3px;\n margin-bottom: 2px;\n }\n .cbeb-toolbar-button {\n padding-left: 10px;\n padding-right: 10px;\n padding-top: 5px;\n padding-bottom: 5px;\n }\n .cbeb-toolbar-btntxt {\n margin-left: 5px;\n }\n .cbeb-toolbar-btnlabel {\n font-size: 13px;\n }\n .cbeb-toolbar-btnlabel-plus {\n font-size: 15px;\n font-weight: bold;\n }\n .cb-photo-uploaded {\n width: 150px;\n height: 150px;\n }\n .cb-image-upload-readonly {\n width: 150px;\n height: 150px;\n margin-bottom: 20px !important;\n }\n .cb-beo-overview-title {\n font-size: 18px !important;\n }\n}\n.cb-beo-overview-businessname {\n margin-top: 4px;\n margin-bottom: 4px;\n font-weight: bold;\n font-size: 15px;\n}\n#communitybox-target {\n background-color: transparent;\n color: #55606b;\n display: flex;\n flex-direction: column;\n}\n#cbeb-main-div {\n display: flex;\n flex-direction: column;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n line-height: 1em;\n}\n.cb-photo-uploaded {\n margin-top: 10px;\n margin-left: auto;\n margin-right: auto;\n margin-bottom: 20px;\n background-size: cover;\n background-repeat: no-repeat;\n background-position: center;\n cursor: pointer;\n}\n.cbeb-fake-link {\n font-weight: bold;\n text-decoration: underline;\n cursor: pointer;\n}\n.cb-beo-text {\n display: flex;\n justify-content: center;\n text-align: center;\n line-height: 1em;\n}\n.cb-beo-readmore {\n display: flex;\n justify-content: center;\n text-decoration: underline;\n cursor: pointer;\n margin-bottom: 7px;\n}\n@media screen and (min-width: 511px) {\n .cb-beo-readmore {\n font-size: 12px;\n }\n}\n@media screen and (max-width: 510px) {\n .cb-beo-readmore {\n font-size: 16px;\n font-weight: 700;\n }\n}\n.box-entry-overview-container {\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n padding-left: 10px;\n padding-right: 10px;\n}\n@media screen and (min-width: 511px) {\n .box-entry-overview-container {\n margin-bottom: 21px;\n }\n}\n@media screen and (max-width: 510px) {\n .box-entry-overview-container:first-child {\n margin-top: 0px;\n }\n}\n@media screen and (max-width: 510px) {\n .box-entry-overview-container:nth-child(n + 2) {\n margin-top: 40px;\n }\n}\n.cbeb-vert-spacer {\n display: flex;\n flex-grow: 1;\n}\n.cbeb-search-container {\n display: flex;\n flex-direction: row;\n align-items: center;\n border: 1px solid lightgrey;\n}\n@media screen and (min-width: 511px) {\n .cbeb-search-container {\n padding-bottom: 3px;\n margin-left: 7px;\n }\n}\n@media screen and (max-width: 510px) {\n .cbeb-search-container {\n flex-basis: 100%;\n padding-top: 9px;\n padding-bottom: 10px;\n margin-bottom: 7px;\n border-radius: 7px;\n box-shadow: 0 4px 7px rgba(0, 0, 0, 0.1);\n }\n}\n.cbeb-search-inputfield {\n background-color: transparent;\n width: 300px;\n font-size: 14px;\n padding-top: 5px;\n border: none;\n outline: 0;\n padding-left: 10px;\n width: 280px;\n}\n.cbeb-content-container {\n display: flex;\n margin-top: 20px;\n user-select: text;\n -moz-user-select: text;\n -webkit-user-select: text;\n}\n@media screen and (min-width: 511px) {\n .cbeb-content-container {\n flex-flow: row wrap;\n position: relative;\n justify-content: center;\n }\n}\n@media screen and (max-width: 510px) {\n .cbeb-content-container {\n flex-direction: column;\n }\n}\n[cbeb-button] {\n font-size: 16px;\n border: none;\n display: flex;\n align-items: center;\n outline: 0;\n justify-content: center;\n color: #fcfcfc;\n cursor: pointer;\n font-family: inherit;\n padding: 7px 12px 7px 12px;\n}\n.cbeb-toolbar-button {\n font-size: 16px;\n border: none;\n display: flex;\n /* align-items: baseline; */\n outline: 0;\n justify-content: center;\n color: #fcfcfc;\n cursor: pointer;\n}\n@media screen and (max-width: 510px) {\n .cbeb-toolbar-button {\n align-items: center;\n margin-left: 7px;\n margin-top: 7px;\n margin-bottom: 21px;\n }\n}\n@media screen and (min-width: 511px) {\n .cbeb-toolbar-button {\n align-items: baseline;\n }\n}\n.cbeb-modal,\n[dialogbox] {\n display: none;\n position: fixed;\n z-index: 1100;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n overflow: auto;\n background-color: rgba(0, 0, 0, 0.4);\n}\n@media screen and (min-width: 511px) {\n .cbeb-modal,\n [dialogbox] {\n padding-top: 50px;\n backdrop-filter: blur(7px);\n -webkit-backdrop-filter: blur(7px);\n }\n}\n.cbeb-modal-content > * {\n flex-shrink: 0;\n}\n[close-dialog-btn] {\n outline: none;\n border: none;\n background-color: transparent;\n font-size: 25px;\n color: white;\n cursor: pointer;\n}\n[flexible-dialogbox-content] {\n display: flex;\n flex-direction: column;\n border: none;\n margin: auto;\n background-color: #fcfcfc;\n color: #55606b;\n}\n@media screen and (min-width: 511px) {\n [flexible-dialogbox-content] {\n width: 90%;\n overflow-y: auto;\n max-height: 80%;\n }\n}\n@media screen and (max-width: 510px) {\n [flexible-dialogbox-content] {\n width: 100%;\n height: auto;\n min-height: 400px;\n }\n}\n.cbeb-modal-content {\n line-height: normal;\n display: flex;\n flex-direction: column;\n margin: auto;\n border: none;\n background-color: #fcfcfc;\n color: #55606b;\n}\n@media screen and (min-width: 511px) {\n .cbeb-modal-content {\n width: 500px;\n overflow-y: auto;\n overflow-x: hidden;\n max-height: 80%;\n }\n}\n@media screen and (max-width: 510px) {\n .cbeb-modal-content {\n width: 100%;\n height: 100%;\n overflow-y: scroll;\n min-height: 400px;\n }\n}\n.cbeb-modal-title {\n display: flex;\n font-weight: bold;\n align-items: center;\n padding-top: 25px;\n padding-bottom: 25px;\n padding-left: 20px;\n padding-right: 20px;\n border: none;\n}\n.cbeb-modal-title-text {\n flex-grow: 1;\n color: white;\n text-align: left;\n}\nbutton[svg] {\n outline: none;\n border: none;\n cursor: pointer;\n background-color: transparent;\n}\nbutton[basic] {\n font-size: 13px;\n font-weight: bold;\n /* text-transform: uppercase; */\n padding: 10px 19px 10px 19px;\n border: 1px solid white;\n cursor: pointer;\n}\n.cbeb-dialog-title-button {\n color: #fcfcfc;\n font-size: 13px;\n font-weight: bold;\n /* text-transform: uppercase; */\n padding: 7px;\n margin-top: 5px !important;\n margin-bottom: 5px !important;\n margin-left: 5px;\n margin-right: 5px;\n border: 1px solid white;\n cursor: pointer;\n}\n.cbeb-dialog-close-button {\n font-size: 13px;\n font-weight: bold;\n margin: 5px;\n cursor: pointer;\n width: 27px;\n height: 27px;\n stroke-width: 2px;\n stroke: white;\n}\n.cbeb-dialog-msg {\n padding-left: 20px;\n padding-right: 20px;\n padding-top: 15px;\n margin-top: 10px;\n text-align: center;\n}\n.cbeb-dialog-msg > h1 {\n display: flex;\n justify-content: center;\n}\n.cbeb-dlg-input-row {\n display: flex;\n margin-top: 10px;\n justify-content: center;\n}\n.cbeb-dlg-input-row-input {\n flex-direction: column;\n flex-grow: 0;\n width: 350px;\n}\n.cbeb-dlg-input-label {\n padding-top: 17px;\n font-size: 11px;\n}\n.cbeb-dlg-inputfield-container {\n display: flex;\n}\n[cbeb-password-input-container] {\n display: flex;\n flex-direction: row;\n border-bottom: 1px solid grey;\n}\n.cbeb-dlg-input,\ninput[basic] {\n display: flex;\n flex-grow: 1;\n padding-top: 5px;\n border-top: none;\n border-left: none;\n border-right: none;\n border-bottom: 1px solid grey;\n outline: 0;\n font-weight: 400;\n font-style: normal;\n font-size: 17px;\n}\n[cbeb-password-input] {\n display: flex;\n flex-grow: 1;\n padding-top: 5px;\n border: none;\n outline: 0;\n font-weight: 400;\n font-style: normal;\n font-size: 17px;\n}\n.cbeb-checkbox-container {\n display: flex;\n flex-direction: column;\n}\n.cbeb-modal-field-container {\n padding-left: 40px;\n padding-right: 40px;\n padding-bottom: 20px;\n display: flex;\n flex-direction: column;\n height: auto;\n}\n/* ---------------------------------- spinner */\n.loader {\n display: none;\n justify-content: center;\n align-items: center;\n margin: auto;\n}\n.spinner {\n justify-content: center;\n align-items: center;\n margin: auto;\n}\n/* ---------------------------------- entry fields */\n.cbeb-locked-preamble-row {\n display: flex;\n}\n.cbeb-entry-preamble-text {\n border-bottom: 1px solid grey;\n display: flex;\n align-items: flex-end;\n padding-bottom: 1px;\n}\n.cbeb-entry-input {\n display: flex;\n flex-grow: 1;\n padding-top: 5px;\n border-top: none;\n border-left: none;\n border-right: none;\n border-bottom: 1px solid grey;\n font-weight: 400;\n font-style: normal;\n font-size: 17px;\n outline: none;\n}\n.cbeb-entry-view > a {\n color: #55606b;\n}\n.cbeb-center {\n justify-content: center;\n}\n.cbeb-entry-input-label,\n[cbeb-entry-input-label] {\n padding-top: 17px;\n font-size: 11px;\n}\n.cbeb-entry-input-row {\n display: flex;\n margin-top: 10px;\n flex-direction: column;\n}\n.cbeb-entry-view-row {\n display: flex;\n flex-direction: column;\n margin-top: 25px;\n}\n.cbeb-entry-tag-container {\n display: flex;\n flex-grow: 1;\n flex-wrap: wrap;\n padding-top: 7px;\n border-bottom: 1px solid grey;\n}\n.cbeb-entry-tag-details-container {\n display: flex;\n justify-content: center;\n flex-direction: row;\n flex-wrap: wrap;\n flex-grow: 1;\n padding-top: 7px;\n padding-bottom: 7px;\n}\n.cbeb-entry-input-row-left {\n display: flex;\n flex-basis: 5%;\n align-items: flex-end;\n justify-content: flex-end;\n font-size: 18px;\n padding-bottom: 2px;\n color: #777777;\n}\n.cbeb-entry-input-row-right {\n padding-top: 11px;\n flex-basis: 5%;\n font-size: 20px;\n font-weight: bold;\n}\n.cbeb-entry-image-input-container {\n display: flex;\n justify-content: center;\n}\n.cbeb-entry-inputfield-container {\n display: flex;\n}\n.cbeb-entry-viewfield-container {\n display: flex;\n justify-content: center;\n flex-direction: column;\n align-items: center;\n margin-top: 4px;\n}\n.cbeb-entry-viewfield-container [detail-label] {\n font-size: 13px;\n font-weight: 900;\n letter-spacing: -1px;\n}\n.cbeb-entry-multiline {\n font-size: 13px !important;\n border-left: 1px solid lightgrey !important;\n border-right: 1px solid lightgrey !important;\n border-top: 1px solid lightgrey !important;\n}\n.cb-image-upload > input {\n display: none;\n}\n.cb-image-upload img {\n width: 150px;\n height: 150px;\n cursor: pointer;\n}\n.cb-image-upload div {\n width: 150px;\n height: 150px;\n cursor: pointer;\n}\n.cb-image-upload {\n display: flex;\n justify-content: center;\n align-items: center;\n background-size: cover;\n background-repeat: no-repeat;\n background-position: center;\n width: 150px;\n height: 150px;\n border-radius: 50%;\n background-color: #eee;\n border: dashed 2px #ddd;\n margin-top: 30px;\n cursor: pointer;\n}\n.cb-image-upload-readonly {\n background-size: cover;\n background-repeat: no-repeat;\n background-position: center;\n border-radius: 50%;\n background-color: #eee;\n margin-top: 30px !important;\n}\n#cbeb-add-entry-modal-field-container {\n /* overflow-y: scroll; */\n /* height: 800px; */\n padding-left: 30px;\n padding-right: 30px;\n padding-bottom: 20px;\n}\n#cbeb-edit-entry-modal-field-container {\n padding-left: 30px;\n padding-right: 30px;\n padding-bottom: 20px;\n}\n@media screen and (min-width: 511px) {\n #cbeb-edit-entry-modal-field-container {\n height: 80vh;\n }\n}\n#cbeb-view-entry-modal-field-container {\n overflow-y: visible;\n padding-left: 30px;\n padding-right: 30px;\n padding-bottom: 20px;\n}\n#cbeb-view-entry-modal-field-container a {\n text-decoration: none;\n}\n.cbeb-extra-button-row {\n display: flex;\n padding-top: 20px;\n padding-bottom: 20px;\n justify-content: center;\n align-items: center;\n}\n.cbeb-socmed-details {\n display: flex;\n font-size: 19px;\n justify-content: center;\n padding-top: 5px;\n margin-bottom: 15px;\n color: #64b5f6;\n}\n.cbeb-socmed-summary {\n display: flex;\n justify-content: center;\n color: #64b5f6;\n margin-bottom: 5px;\n margin-top: 4px;\n}\n.cbeb-socmed-indiv {\n cursor: pointer;\n margin-left: 5px;\n margin-right: 5px;\n}\n.cbeb-add-entry-error-msg {\n display: flex;\n color: red;\n font-size: 12px;\n justify-content: center;\n margin-top: 20px;\n}\n.cbeb-entry-tag-input {\n display: flex;\n flex-grow: 1;\n padding-top: 5px;\n padding-left: 7px;\n border: none;\n font-weight: 400;\n font-style: normal;\n font-size: 17px;\n outline: none;\n box-sizing: content-box;\n}\n.cbeb-entry-tag {\n display: flex;\n align-items: center;\n padding-top: 2px;\n padding-bottom: 2px;\n color: white;\n font-size: 14px;\n margin-left: 2px;\n margin-right: 2px;\n padding-left: 7px;\n padding-right: 7px;\n padding-bottom: 4px;\n margin-top: 5px;\n}\n.cbeb-detail-tag {\n cursor: pointer;\n}\n.cbeb-category-summary-container {\n display: flex;\n justify-content: center;\n flex-grow: 0;\n flex-direction: row;\n flex-wrap: wrap;\n font-weight: bold;\n margin-top: 4px;\n}\n.cbeb-category-summary {\n display: flex;\n color: white;\n padding-top: 3px;\n padding-bottom: 4px;\n margin: 2px;\n cursor: pointer;\n line-height: 1em;\n text-align: center;\n}\n.cbeb-bio-snippet {\n display: flex;\n justify-content: center;\n align-items: center;\n text-align: center;\n line-height: 1.1;\n margin-top: 4px;\n margin-bottom: 4px;\n}\n.cbeb-vert-flex {\n display: flex;\n flex-direction: column;\n align-items: center;\n}\n/* Account ----------------------------- */\n.cbeb-act-container {\n display: flex;\n flex-direction: column;\n margin-top: 20px;\n flex-grow: 1;\n}\n@media screen and (min-width: 511px) {\n .cbeb-act-container {\n margin-left: 7px;\n margin-right: 7px;\n }\n}\n.cbeb-act-row {\n display: flex;\n flex-direction: row;\n border: 1px solid lightgrey;\n margin-top: 5px;\n margin-bottom: 5px;\n padding-left: 10px;\n padding-top: 5px;\n padding-bottom: 5px;\n padding-right: 10px;\n align-items: center;\n}\n.cbeb-act-button-group {\n display: flex;\n flex-direction: row;\n flex-grow: 0;\n column-gap: 14px;\n}\n.cbeb-act-name {\n flex-grow: 1;\n}\n.cbeb-act-button {\n margin-left: 4px;\n margin-right: 3px;\n padding: 5px;\n color: white;\n font-size: 15px;\n cursor: pointer;\n}\n@media screen and (max-width: 510px) {\n .cbeb-act-msg {\n display: flex;\n flex-direction: column;\n justify-content: center;\n text-align: center;\n }\n}\n.cbeb-close-tag {\n font-weight: bold;\n cursor: pointer;\n}\n.cbeb-detailleft {\n padding-top: 2px;\n min-width: 30px;\n font-size: 13px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.cbeb-search-clear-btn {\n margin-right: 7px;\n}\n#cbeb-imgupload-progress-msg {\n display: none;\n width: auto;\n height: auto;\n}\n.cbeb-toolbar-btn-group {\n display: flex;\n flex-direction: row;\n justify-content: center;\n}\n.cbeb-toolbar-searchgroup {\n display: flex;\n flex-direction: row;\n}\n.cbeb-fpw-row {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.cbeb-banner {\n display: block;\n margin: auto;\n margin-top: 20px;\n margin-bottom: 20px;\n}\n@media screen and (max-width: 510px) {\n .cbeb-banner {\n max-width: 80vw;\n }\n}\n@media screen and (min-width: 511px) {\n .cbeb-banner {\n height: 100px;\n }\n}\n@keyframes buttonPulse {\n 50% {\n opacity: 0.4;\n }\n}\n.cbeb-pulse-colour {\n animation: buttonPulse 3s infinite;\n}\n.cbeb-normal-btn-row {\n display: flex;\n}\n@media screen and (min-width: 511px) {\n .cbeb-normal-btn-row {\n flex-direction: row;\n flex-wrap: wrap;\n }\n}\n@media screen and (max-width: 510px) {\n .cbeb-normal-btn-row {\n flex-direction: column;\n justify-content: center;\n }\n}\n.cbeb-normal-btn {\n display: flex;\n cursor: pointer;\n margin-top: 7px;\n margin-bottom: 7px;\n margin-left: 7px;\n margin-right: 7px;\n color: #fcfcfc;\n padding-top: 5px;\n padding-bottom: 5px;\n padding-left: 7px;\n padding-right: 7px;\n}\n@media screen and (max-width: 510px) {\n .cbeb-normal-btn {\n justify-content: center;\n }\n}\n[server-error-msg] {\n text-align: center;\n border: 1px solid #77b3f4;\n padding: 20px;\n}\n#cbeb-tc-text {\n margin-left: 30px;\n margin-top: 20px;\n margin-right: 30px;\n font-size: 14px;\n}\n#cbeb-poweredby {\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: baseline;\n}\n[showmore-row] {\n display: flex;\n flex-direction: row;\n justify-content: center;\n margin-top: 10px;\n margin-bottom: 10px;\n}\n[showmore-row] button {\n background-color: transparent;\n outline: 0;\n border: 0;\n text-decoration: underline;\n cursor: pointer;\n font-size: 16px;\n color: #1abc9c;\n}\n[footer] {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n}\n[footer] #privacy-policy {\n text-decoration: underline;\n cursor: pointer;\n}\n@media screen and (min-width: 511px) {\n [footer] {\n font-size: 15px;\n margin-top: 20px;\n }\n}\n@media screen and (max-width: 510px) {\n [footer] {\n margin-top: 31px;\n }\n}\n.cbeb-banner-text {\n display: flex;\n justify-content: center;\n margin-bottom: 20px;\n margin-top: 10px;\n padding-left: 20%;\n padding-right: 20%;\n text-align: center;\n}\n.cb-beo-overview-location {\n cursor: pointer;\n}\n.cb-beo-overview-location a {\n text-decoration: none;\n}\n@media screen and (min-width: 511px) {\n .cb-beo-overview-location {\n margin-top: 4px;\n margin-bottom: 7px;\n font-size: 14px;\n }\n}\n@media screen and (max-width: 510px) {\n .cb-beo-overview-location {\n margin-top: 7px;\n margin-bottom: 3px;\n font-size: 18px;\n }\n}\n.cbeb-error-label {\n color: red;\n display: inline-block;\n}\n[cbeb-map] {\n height: 400px;\n}\n@media screen and (max-width: 510px) {\n [cbeb-map] {\n width: 100%;\n margin-left: auto;\n margin-right: auto;\n }\n}\n@media screen and (min-width: 511px) {\n [cbeb-map] {\n width: 100%;\n margin-left: 7px;\n margin-right: 7px;\n margin-bottom: 37px;\n margin-top: 21px;\n }\n}\n.cb-beo-connect {\n display: flex;\n justify-content: center;\n}\n.cb-beo-connect button {\n background-color: #55606b;\n color: white;\n outline: 0;\n border: none;\n padding-top: 2px;\n padding-bottom: 2px;\n padding-left: 8px;\n padding-right: 8px;\n border-radius: 8px;\n font-size: 14px;\n cursor: pointer;\n}\n[cbeb-invitation-lookup-modal] [cbeb-modal-field-container] {\n padding-left: 30px;\n padding-right: 30px;\n padding-bottom: 10px;\n}\n[cbeb-invitation-lookup-modal] [cbeb-modal-field-container] [cbeb-lookup-msg],\n[cbeb-invitation-lookup-modal] [cbeb-modal-field-container] [cbeb-signing-up] {\n display: flex;\n flex-direction: column;\n align-items: center;\n}\n[cbeb-invitation-lookup-modal] [cbeb-modal-field-container] [invite-email] {\n font-weight: bold;\n}\n[cbeb-connection-modal] [requesting-connection] {\n display: flex;\n flex-direction: column;\n align-items: center;\n padding-left: 30px;\n padding-right: 30px;\n}\n[cbeb-connection-modal] [connection-made] {\n display: flex;\n flex-direction: row;\n justify-content: center;\n padding-left: 30px;\n padding-right: 30px;\n padding-top: 30px;\n padding-bottom: 30px;\n}\n[cbeb-connection-modal] [spinner] {\n min-height: 200px;\n}\n[cbeb-connection-lookup-dlg] [looking-up-data] {\n display: flex;\n flex-direction: column;\n justify-content: center;\n text-align: center;\n padding-left: 30px;\n padding-right: 30px;\n}\n[cbeb-connection-lookup-dlg] [found-connection] {\n display: flex;\n flex-direction: column;\n justify-content: center;\n text-align: center;\n padding-left: 30px;\n padding-right: 30px;\n padding-top: 30px;\n padding-bottom: 30px;\n}\n[cbeb-connection-lookup-dlg] [spinner] {\n min-height: 100px;\n}\n[cbeb-share-entry-dlg] [contents] {\n display: flex;\n flex-direction: row;\n justify-content: space-evenly;\n align-items: center;\n}\n[cbeb-share-entry-dlg] [share-row] {\n margin-top: 10px;\n margin-bottom: 10px;\n}\n[cbeb-input-group] {\n display: flex;\n flex-direction: column;\n}\n[cbeb-product-picture-edit-row] {\n display: flex;\n flex-direction: row;\n flex-grow: 1;\n justify-content: space-between;\n}\n[cbeb-product-picture-edit-row] [inputfields] {\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n flex-grow: 1;\n}\n[cbeb-product-picture-edit-row] [inputfields] input {\n display: flex;\n flex-grow: 0;\n}\n[cbeb-product-picture-edit-row] [cbeb-pp-upload-thumbnail] {\n width: 120px;\n height: 120px;\n background-size: cover;\n background-repeat: no-repeat;\n background-position: center;\n background-color: #eee;\n background-image: url('https://dashboard.communitybox.co/img/upload-image.png');\n border: 2px dashed #ddd;\n}\n[cbeb-product-picture-edit-row] [cbeb-pp-upload-thumbnail] input {\n display: none;\n}\n[cbeb-product-picture-edit-row] [cbeb-pp-upload-thumbnail] img {\n width: 120px;\n height: 120px;\n cursor: pointer;\n}\n[cbeb-product-picture-edit-row] [cbeb-pp-upload-thumbnail] div {\n width: 120px;\n height: 120px;\n cursor: pointer;\n}\n[cbeb-ev-gallery] {\n display: flex;\n flex-direction: row;\n justify-content: space-evenly;\n}\n[cbeb-ev-gallery] [cbeb-ev-gallery-pic] {\n width: 130px;\n height: 130px;\n background-size: cover;\n background-repeat: no-repeat;\n background-position: center;\n background-color: #eee;\n cursor: pointer;\n}\n[feature-listing][container] {\n height: 20px;\n color: white;\n text-align: center;\n font-size: 14px;\n font-weight: bold;\n display: flex;\n flex-direction: row;\n justify-content: center;\n}\n[feature-listing][container] [banner] {\n padding-left: 20px;\n padding-right: 20px;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n[filter-and-search] [chapters] {\n display: flex;\n flex-direction: column;\n margin-top: 5px;\n margin-bottom: 20px;\n}\n[filter-and-search] [chapters] [fields] {\n display: flex;\n flex-direction: row;\n margin-top: 20px;\n}\n[filter-and-search] [chapters] [fields] [left] {\n display: flex;\n flex-direction: row;\n width: 131px;\n justify-content: flex-end;\n}\n[filter-and-search] [chapters] [fields] [right] {\n display: flex;\n flex-direction: column;\n flex-grow: 1;\n padding-left: 5%;\n}\n[filter-and-search] [chapters] [fields] [right] [inputrow] {\n display: flex;\n flex-direction: column;\n margin-bottom: 10px;\n}\n[filter-and-search] [chapters] [fields] [right] [inputrow] [label] {\n font-size: 13px;\n text-align: left;\n}\n[filter-and-search] [chapters] [fields] [right] [inputrow] select {\n width: 75%;\n}\n[filter-and-search] [chapters] [fields] [right] [inputrow] [tag-list] {\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n margin-top: 10px;\n}\n[filter-and-search] [chapters] [fields] [right] [inputrow] [tag-list] [tag] {\n display: flex;\n background-color: #777777;\n color: white;\n padding-left: 10px;\n padding-top: 4px;\n padding-right: 10px;\n padding-bottom: 3px;\n font-size: 14px;\n font-weight: 600;\n margin-right: 10px;\n margin-top: 7px;\n}\n[filter-and-search] [chapters] [fields] [right] [inputrow] [tag-list] [tag] button {\n background: transparent;\n border: none;\n outline: none;\n color: inherit;\n cursor: pointer;\n}\n@media screen and (max-width: 510px) {\n [toolbar][desktop] {\n display: none;\n }\n}\n@media screen and (min-width: 511px) {\n [toolbar][desktop] {\n display: flex;\n margin-left: 7px;\n margin-right: 7px;\n }\n}\n@media screen and (min-width: 511px) {\n [toolbar][mobile] {\n display: none;\n }\n}\n@media screen and (max-width: 510px) {\n [toolbar][mobile] {\n display: flex;\n margin-top: 10px;\n margin-left: 10px;\n margin-right: 10px;\n }\n}\n[toolbar] {\n flex-wrap: wrap;\n justify-content: space-between;\n flex-direction: row;\n}\n[toolbar] [select-container] {\n padding: 0;\n width: 190px;\n overflow: hidden;\n background: #fff url(\"https://dashboard.communitybox.co/img/dropdown_3.png\") no-repeat 95% 50%;\n display: flex;\n}\n@media screen and (min-width: 511px) {\n [toolbar] [select-container] {\n margin: 0;\n }\n}\n@media screen and (max-width: 510px) {\n [toolbar] [select-container] {\n margin-top: 7px;\n margin-left: 7px;\n }\n}\n[toolbar] [select-container] select {\n color: white;\n padding: 5px 8px;\n width: 130%;\n border: none;\n box-shadow: none;\n background-color: transparent;\n background-image: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n}\n[toolbar] [select-container] select:focus {\n outline: none;\n}\n.choices {\n flex-grow: 1;\n}\n.choices__list--dropdown {\n z-index: 2 !important;\n}\n.choices__inner {\n padding-right: 0px !important;\n padding-left: 0px !important;\n}\n.choices__item {\n border-radius: 0px !important;\n margin-right: 2px !important;\n margin-left: 2px;\n border: none !important;\n}\n#cbeb-login-modal p {\n text-align: center;\n font-size: 15px;\n}\nbutton[fake-link] {\n outline: none;\n border: none;\n background-color: transparent;\n text-decoration: underline;\n cursor: pointer;\n padding-left: 0px;\n padding-right: 0px;\n font-size: inherit;\n}\n[entry-ordering] {\n font-size: 16px;\n}\n[entry-ordering] > option {\n color: grey;\n}\n[tag-filter][dialogbox] [search-row-container] {\n display: flex;\n flex-direction: row;\n justify-content: flex-start;\n padding-left: 21%;\n align-items: center;\n margin-top: 40px;\n}\n[tag-filter][dialogbox] [search-row-container] input {\n border-top: none;\n border-left: none;\n border-right: none;\n border-bottom: 1px solid black;\n}\n[tag-filter][dialogbox] [tag-listing-container] {\n margin-top: 40px;\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n padding-left: 21%;\n padding-right: 7%;\n padding-bottom: 50px;\n}\n[tag-filter][dialogbox] [tag-listing-container] button[entry] {\n outline: none;\n border: none;\n background-color: transparent;\n text-align: left;\n padding-left: 0px;\n font-size: 16px;\n color: #515151;\n cursor: pointer;\n}\n[tag-filter][dialogbox] [tag-listing-container] button[entry]:hover {\n color: grey;\n}\n@media screen and (min-width: 511px) {\n [tag-filter][dialogbox] [tag-listing-container] button[entry] {\n flex-basis: 50%;\n margin-top: 10px;\n }\n}\n@media screen and (max-width: 510px) {\n [tag-filter][dialogbox] [tag-listing-container] button[entry] {\n flex-basis: 100%;\n }\n}\n[h17] {\n height: 17px;\n}\n[h37] {\n height: 37px;\n}\n[flexrow] {\n display: flex;\n flex-direction: row;\n}\n[flex] {\n display: flex;\n}\n[col] {\n flex-direction: column;\n}\n[row] {\n flex-direction: row;\n}\n[grow] {\n flex-grow: 1;\n}\n[mt0] {\n margin-top: 0px;\n}\n[mb0] {\n margin-bottom: 0px;\n}\n[mt10] {\n margin-top: 10px;\n}\n[mt17] {\n margin-top: 17px;\n}\n[mt31] {\n margin-top: 31px;\n}\n[mt37] {\n margin-top: 37px;\n}\n[mt53] {\n margin-top: 53px;\n}\n[mb10] {\n margin-bottom: 10px;\n}\n[mb17] {\n margin-bottom: 17px;\n}\n[mb53] {\n margin-bottom: 53px;\n}\n[ml17] {\n margin-left: 17px;\n}\n[mr17] {\n margin-right: 17px;\n}\n[w80] {\n width: 80%;\n}\n[w100] {\n width: 100%;\n}\n[pl71] {\n padding-left: 71px;\n}\n[pr71] {\n padding-right: 71px;\n}\n[pb43] {\n padding-bottom: 43px;\n}\n[cntr] {\n justify-content: center;\n}\n[vcntr] {\n align-items: center;\n}\n[left-text] {\n text-align: left;\n}\n[cntr-text] {\n text-align: center;\n}\n[space-evenly] {\n justify-content: space-evenly;\n}\n[space-between] {\n justify-content: space-between;\n}\n[justify-end] {\n justify-content: flex-end;\n}\n[justify-center] {\n justify-content: center;\n}\n[wrap] {\n flex-wrap: wrap;\n}\n[block] {\n display: block;\n}\n[no-shrink] {\n flex-shrink: 0;\n}\n[d-none] {\n display: none;\n}\nh4[fileedit] {\n margin-top: 0;\n margin-bottom: 0;\n}\nh5[fileedit] {\n margin-top: 0px;\n margin-bottom: 0px;\n}\nh4[dlg] {\n font-size: 14px;\n font-weight: 400;\n margin-bottom: 3px;\n}\ninput[dlg] {\n border-top: none;\n border-left: none;\n border-right: none;\n}\nbutton[new] {\n outline: 0;\n border: none;\n border-radius: 5px;\n padding-top: 8px;\n padding-bottom: 7px;\n padding-left: 31px;\n padding-right: 31px;\n font-size: 14px;\n font-weight: 600;\n font-family: inherit;\n letter-spacing: -1px;\n cursor: pointer;\n}\na[fake] {\n outline: none;\n border: none;\n background-color: transparent;\n}\n[cbeb-fake-button] {\n color: grey;\n outline: none;\n border: none;\n background: transparent;\n cursor: pointer;\n}\n.mapboxgl-ctrl-geocoder {\n font-size: inherit !important;\n min-width: initial !important;\n box-shadow: none !important;\n}\n@media screen and (max-width: 510px) {\n .mapboxgl-ctrl-geocoder {\n width: 100% !important;\n line-height: inherit !important;\n height: inherit;\n }\n}\n@media screen and (min-width: 511px) {\n .mapboxgl-ctrl-geocoder {\n width: 95% !important;\n }\n}\n.mapboxgl-ctrl-geocoder--icon-search {\n display: none !important;\n}\n@media screen and (max-width: 510px) {\n .mapboxgl-ctrl-geocoder--input {\n height: inherit !important;\n padding-left: 17px !important;\n padding-top: unset !important;\n padding-right: unset !important;\n padding-bottom: unset !important;\n }\n}\n@media screen and (min-width: 511px) {\n .mapboxgl-ctrl-geocoder--input {\n padding-left: 17px !important;\n padding-top: unset !important;\n padding-right: unset !important;\n padding-bottom: unset !important;\n }\n}\n[missing_required_field] {\n background-color: #ffaaaa;\n}\n[missing_required_field] input {\n background-color: #ffaaaa;\n}\n[missing_required_field] textarea {\n background-color: #ffaaaa;\n}\n[missing_required_field] .choices__inner {\n background-color: #ffaaaa;\n}\n[nobreak] {\n white-space: nowrap;\n}\n[funky-hover] {\n transition: transform 0.2s;\n}\n[funky-hover]:hover {\n transform: scale(1.2) rotate(2deg);\n}\n[red] {\n color: #d40f0f;\n}\n[inline] {\n display: inline;\n}\n[maperrorcontainer] {\n display: flex;\n flex-direction: column;\n row-gap: 17px;\n width: 100%;\n align-items: center;\n}\n[category-workbench-container] {\n display: flex;\n flex-direction: column;\n row-gap: 5px;\n}\n[tag-workbench] {\n display: flex;\n flex-direction: row;\n align-items: center;\n column-gap: 17px;\n box-sizing: border-box;\n padding: 7px 15px 7px 15px;\n background-color: lightblue;\n}\n[tag-workbench-select-ctrl] {\n flex-grow: 1;\n}\n[tag-workbench-frame] {\n display: flex;\n flex-direction: row;\n column-gap: 17px;\n row-gap: 7px;\n box-shadow: inset 2px 2px 2px 0px rgba(0, 0, 0, 0.07);\n box-sizing: border-box;\n padding: 7px;\n border: 1px solid lightgrey;\n flex-wrap: wrap;\n max-height: 90px;\n overflow-y: scroll;\n}\n[tag-workbench-label] {\n margin-top: 0px;\n margin-bottom: 0px;\n font-size: 15px;\n}\n[tag-workbench-error-msg] {\n color: red;\n font-size: 14px;\n}\n",""]);const a=s},3645:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var i="",n=void 0!==t[5];return t[4]&&(i+="@supports (".concat(t[4],") {")),t[2]&&(i+="@media ".concat(t[2]," {")),n&&(i+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),i+=e(t),n&&(i+="}"),t[2]&&(i+="}"),t[4]&&(i+="}"),i})).join("")},t.i=function(e,i,n,r,o){"string"==typeof e&&(e=[[null,e,void 0]]);var s={};if(n)for(var a=0;a0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=o),i&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=i):u[2]=i),r&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=r):u[4]="".concat(r)),t.push(u))}},t}},8081:e=>{"use strict";e.exports=function(e){return e[1]}},2702:function(e,t,i){e.exports=function(){"use strict";function e(e){return"function"==typeof e}var t=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},n=0,r=void 0,o=void 0,s=function(e,t){p[n]=e,p[n+1]=t,2===(n+=2)&&(o?o(f):b())};var a="undefined"!=typeof window?window:void 0,l=a||{},c=l.MutationObserver||l.WebKitMutationObserver,u="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),h="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function d(){var e=setTimeout;return function(){return e(f,1)}}var p=new Array(1e3);function f(){for(var e=0;e{"use strict";var t=Object.prototype.hasOwnProperty,i="~";function n(){}function r(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function o(e,t,n,o,s){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new r(n,o||e,s),l=i?i+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],a]:e._events[l].push(a):(e._events[l]=a,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),a.prototype.eventNames=function(){var e,n,r=[];if(0===this._eventsCount)return r;for(n in e=this._events)t.call(e,n)&&r.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},a.prototype.listeners=function(e){var t=i?i+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,o=n.length,s=new Array(o);r{"use strict";var t,i="object"==typeof Reflect?Reflect:null,n=i&&"function"==typeof i.apply?i.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)};t=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var r=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise((function(i,n){function r(i){e.removeListener(t,o),n(i)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",r),i([].slice.call(arguments))}m(e,t,o,{once:!0}),"error"!==t&&function(e,t,i){"function"==typeof e.on&&m(e,"error",t,{once:!0})}(e,r)}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function c(e,t,i,n){var r,o,s,c;if(a(i),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,i.listener?i.listener:i),o=e._events),s=o[t]),void 0===s)s=o[t]=i,++e._eventsCount;else if("function"==typeof s?s=o[t]=n?[i,s]:[s,i]:n?s.unshift(i):s.push(i),(r=l(e))>0&&s.length>r&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=s.length,c=u,console&&console.warn&&console.warn(c)}return e}function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(e,t,i){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:i},r=u.bind(n);return r.listener=i,n.wrapFn=r,r}function d(e,t,i){var n=e._events;if(void 0===n)return[];var r=n[t];return void 0===r?[]:"function"==typeof r?i?[r.listener||r]:[r]:i?function(e){for(var t=new Array(e.length),i=0;i0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var l=o[e];if(void 0===l)return!1;if("function"==typeof l)n(l,this,t);else{var c=l.length,u=f(l,c);for(i=0;i=0;o--)if(i[o]===t||i[o].listener===t){s=i[o].listener,r=o;break}if(r<0)return this;0===r?i.shift():function(e,t){for(;t+1=0;n--)this.removeListener(e,t[n]);return this},o.prototype.listeners=function(e){return d(this,e,!0)},o.prototype.rawListeners=function(e){return d(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},o.prototype.listenerCount=p,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},3261:e=>{var t;t={},e.exports=t,t.simpleFilter=function(e,i){return i.filter((function(i){return t.test(e,i)}))},t.test=function(e,i){return null!==t.match(e,i)},t.match=function(e,t,i){i=i||{};var n,r=0,o=[],s=t.length,a=0,l=0,c=i.pre||"",u=i.post||"",h=i.caseSensitive&&t||t.toLowerCase();e=i.caseSensitive&&e||e.toLowerCase();for(var d=0;d{"use strict";var t=Object.prototype.toString;e.exports=function(e){var i;return"[object Object]"===t.call(e)&&(null===(i=Object.getPrototypeOf(e))||i===Object.getPrototypeOf({}))}},1296:(e,t,i)=>{var n=/^\s+|\s+$/g,r=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,s=/^0o[0-7]+$/i,a=parseInt,l="object"==typeof i.g&&i.g&&i.g.Object===Object&&i.g,c="object"==typeof self&&self&&self.Object===Object&&self,u=l||c||Function("return this")(),h=Object.prototype.toString,d=Math.max,p=Math.min,f=function(){return u.Date.now()};function m(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function _(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==h.call(e)}(e))return NaN;if(m(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=m(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(n,"");var i=o.test(e);return i||s.test(e)?a(e.slice(2),i?2:8):r.test(e)?NaN:+e}e.exports=function(e,t,i){var n,r,o,s,a,l,c=0,u=!1,h=!1,g=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function y(t){var i=n,o=r;return n=r=void 0,c=t,s=e.apply(o,i)}function b(e){var i=e-l;return void 0===l||i>=t||i<0||h&&e-c>=o}function v(){var e=f();if(b(e))return x(e);a=setTimeout(v,function(e){var i=t-(e-l);return h?p(i,o-(e-c)):i}(e))}function x(e){return a=void 0,g&&n?y(e):(n=r=void 0,s)}function w(){var e=f(),i=b(e);if(n=arguments,r=this,l=e,i){if(void 0===a)return function(e){return c=e,a=setTimeout(v,t),u?y(e):s}(l);if(h)return a=setTimeout(v,t),y(l)}return void 0===a&&(a=setTimeout(v,t)),s}return t=_(t)||0,m(i)&&(u=!!i.leading,o=(h="maxWait"in i)?d(_(i.maxWait)||0,t):o,g="trailing"in i?!!i.trailing:g),w.cancel=function(){void 0!==a&&clearTimeout(a),c=0,n=l=r=a=void 0},w.flush=function(){return void 0===a?s:x(f())},w}},6158:function(e){e.exports=function(){"use strict";var e,t,i;function n(n,r){if(e)if(t){var o="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 = {}; ("+e+")(sharedChunk); ("+t+")(sharedChunk); self.onerror = null;",s={};e(s),i=r(s),"undefined"!=typeof window&&window&&window.URL&&window.URL.createObjectURL&&(i.workerUrl=window.URL.createObjectURL(new Blob([o],{type:"text/javascript"})))}else t=r;else e=r}return n(0,(function(e){var t="undefined"!=typeof self?self:{},i="2.15.0";let n;const r={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){if(null==n){const e=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;try{n=null!=process.env.API_URL_REGEX?new RegExp(process.env.API_URL_REGEX):e}catch(t){n=e}}return n},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(!r.API_URL)return null;try{const e=new URL(r.API_URL);return"api.mapbox.cn"===e.hostname?"https://events.mapbox.cn/events/v2":"api.mapbox.com"===e.hostname?"https://events.mapbox.com/events/v2":null}catch(e){return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,MAX_PARALLEL_IMAGE_REQUESTS:16},o={supported:!1,testSupport:function(e){!l&&a&&(c?u(e):s=e)}};let s,a,l=!1,c=!1;function u(e){const t=e.createTexture();e.bindTexture(e.TEXTURE_2D,t);try{if(e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,a),e.isContextLost())return;o.supported=!0}catch(e){}e.deleteTexture(t),l=!0}t.document&&(a=t.document.createElement("img"),a.onload=function(){s&&u(s),s=null,c=!0},a.onerror=function(){l=!0,s=null},a.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const h="01";function d(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var p=f;function f(e,t,i,n){this.cx=3*e,this.bx=3*(i-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(n-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=i,this.p2y=n}f.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,t){if(void 0===t&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var i=e,n=0;n<8;n++){var r=this.sampleCurveX(i)-e;if(Math.abs(r)r?s=i:a=i,i=.5*(a-s)+s;return i},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}};var m=d(p),_=g;function g(e,t){this.x=e,this.y=t}g.prototype={clone:function(){return new g(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,i=e.y-this.y;return t*t+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=t,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),i=Math.sin(e),n=i*this.x+t*this.y;return this.x=t*this.x-i*this.y,this.y=n,this},_rotateAround:function(e,t){var i=Math.cos(e),n=Math.sin(e),r=t.y+n*(this.x-t.x)+i*(this.y-t.y);return this.x=t.x+i*(this.x-t.x)-n*(this.y-t.y),this.y=r,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},g.convert=function(e){return e instanceof g?e:Array.isArray(e)?new g(e[0],e[1]):e};var y=d(_);const b=Math.PI/180,v=180/Math.PI;function x(e){return e*b}function w(e){return e*v}const E=[[0,0],[1,0],[1,1],[0,1]];function T(e){if(e<=0)return 0;if(e>=1)return 1;const t=e*e,i=t*e;return 4*(e<.5?i:3*(e-t)+i-.75)}function k(e,t,i,n){const r=new m(e,t,i,n);return function(e){return r.solve(e)}}const C=k(.25,.1,.25,1);function S(e,t,i){return Math.min(i,Math.max(t,e))}function M(e,t,i){return(i=S((i-e)/(t-e),0,1))*i*(3-2*i)}function A(e,t,i){const n=i-t,r=((e-t)%n+n)%n+t;return r===t?i:r}function I(e,t,i){if(!e.length)return i(null,[]);let n=e.length;const r=new Array(e.length);let o=null;e.forEach(((e,s)=>{t(e,((e,t)=>{e&&(o=e),r[s]=t,0==--n&&i(o,r)}))}))}function P(e){const t=[];for(const i in e)t.push(e[i]);return t}function L(e,...t){for(const i of t)for(const t in i)e[t]=i[t];return e}let D=1;function z(){return D++}function O(){return function e(t){return t?(t^Math.random()*(16>>t/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,e)}()}function B(e){return e<=1?1:Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function R(e){return!!e&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)}function F(e,t){e.forEach((e=>{t[e]&&(t[e]=t[e].bind(t))}))}function U(e,t){return-1!==e.indexOf(t,e.length-t.length)}function j(e,t,i){const n={};for(const r in e)n[r]=t.call(i||this,e[r],r,e);return n}function V(e,t,i){const n={};for(const r in e)t.call(i||this,e[r],r,e)&&(n[r]=e[r]);return n}function N(e){return Array.isArray(e)?e.map(N):"object"==typeof e&&e?j(e,N):e}const $={};function q(e){$[e]||("undefined"!=typeof console&&console.warn(e),$[e]=!0)}function G(e,t,i){return(i.y-e.y)*(t.x-e.x)>(t.y-e.y)*(i.x-e.x)}function Z(e){let t=0;for(let i,n,r=0,o=e.length,s=o-1;r@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((e,i,n,r)=>{const o=n||r;return t[i]=!o||o.toLowerCase(),""})),t["max-age"]){const e=parseInt(t["max-age"],10);isNaN(e)?delete t["max-age"]:t["max-age"]=e}return t}let X=null;function K(e){if(null==X){const t=e.navigator?e.navigator.userAgent:null;X=!!e.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return X}function J(e){try{const i=t[e];return i.setItem("_mapbox_test_",1),i.removeItem("_mapbox_test_"),!0}catch(e){return!1}}function Y(e,t){return[e[4*t],e[4*t+1],e[4*t+2],e[4*t+3]]}const Q="mapbox-tiles";let ee,te,ie=500,ne=50;function re(){try{return t.caches}catch(e){}}function oe(){re()&&!ee&&(ee=t.caches.open(Q))}function se(e){const t=e.indexOf("?");if(t<0)return e;const i=function(e){const t=e.indexOf("?");return t>0?e.slice(t+1).split("&"):[]}(e),n=i.filter((e=>{const t=e.split("=");return"language"===t[0]||"worldview"===t[0]}));return n.length?`${e.slice(0,t)}?${n.join("&")}`:e.slice(0,t)}let ae=1/0;const le={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(le);class ce extends Error{constructor(e,t,i){401===t&&ve(i)&&(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=t,this.url=i}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const ue=W()?()=>self.worker&&self.worker.referrer:()=>("blob:"===t.location.protocol?t.parent:t).location.href,he=function(e,i){if(!(/^file:/.test(n=e.url)||/^file:/.test(ue())&&!/^\w+:/.test(n))){if(t.fetch&&t.Request&&t.AbortController&&t.Request.prototype.hasOwnProperty("signal"))return function(e,i){const n=new t.AbortController,r=new t.Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,referrer:ue(),referrerPolicy:e.referrerPolicy,signal:n.signal});let o=!1,s=!1;const a=(l=r.url).indexOf("sku=")>0&&ve(l);var l;"json"===e.type&&r.headers.set("Accept","application/json");const c=(n,o,l)=>{if(s)return;if(n&&"SecurityError"!==n.message&&q(n.toString()),o&&l)return u(o);const c=Date.now();t.fetch(r).then((t=>{if(t.ok){const e=a?t.clone():null;return u(t,e,c)}return i(new ce(t.statusText,t.status,e.url))})).catch((t=>{"AbortError"!==t.name&&i(new Error(`${t.message} ${e.url}`))}))},u=(n,a,l)=>{("arrayBuffer"===e.type?n.arrayBuffer():"json"===e.type?n.json():n.text()).then((e=>{s||(a&&l&&function(e,i,n){if(oe(),!ee)return;const r={status:i.status,statusText:i.statusText,headers:new t.Headers};i.headers.forEach(((e,t)=>r.headers.set(t,e)));const o=H(i.headers.get("Cache-Control")||"");if(o["no-store"])return;o["max-age"]&&r.headers.set("Expires",new Date(n+1e3*o["max-age"]).toUTCString());const s=r.headers.get("Expires");s&&(new Date(s).getTime()-n<42e4||function(e,t){if(void 0===te)try{new Response(new ReadableStream),te=!0}catch(e){te=!1}te?t(e.body):e.blob().then(t)}(i,(i=>{const n=new t.Response(i,r);oe(),ee&&ee.then((t=>t.put(se(e.url),n))).catch((e=>q(e.message)))})))}(r,a,l),o=!0,i(null,e,n.headers.get("Cache-Control"),n.headers.get("Expires")))})).catch((e=>{s||i(new Error(e.message))}))};return a?function(e,t){if(oe(),!ee)return t(null);const i=se(e.url);ee.then((e=>{e.match(i).then((n=>{const r=function(e){if(!e)return!1;const t=new Date(e.headers.get("Expires")||0),i=H(e.headers.get("Cache-Control")||"");return t>Date.now()&&!i["no-cache"]}(n);e.delete(i),r&&e.put(i,n.clone()),t(null,n,r)})).catch(t)})).catch(t)}(r,c):c(null,null),{cancel:()=>{s=!0,o||n.abort()}}}(e,i);if(W()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",e,i,void 0,!0)}var n;return function(e,i){const n=new t.XMLHttpRequest;n.open(e.method||"GET",e.url,!0),"arrayBuffer"===e.type&&(n.responseType="arraybuffer");for(const t in e.headers)n.setRequestHeader(t,e.headers[t]);return"json"===e.type&&(n.responseType="text",n.setRequestHeader("Accept","application/json")),n.withCredentials="include"===e.credentials,n.onerror=()=>{i(new Error(n.statusText))},n.onload=()=>{if((n.status>=200&&n.status<300||0===n.status)&&null!==n.response){let t=n.response;if("json"===e.type)try{t=JSON.parse(n.response)}catch(e){return i(e)}i(null,t,n.getResponseHeader("Cache-Control"),n.getResponseHeader("Expires"))}else i(new ce(n.statusText,n.status,e.url))},n.send(e.body),{cancel:()=>n.abort()}}(e,i)},de=function(e,t){return he(L(e,{type:"arrayBuffer"}),t)};function pe(e){const i=t.document.createElement("a");return i.href=e,i.protocol===t.document.location.protocol&&i.host===t.document.location.host}const fe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let me,_e;me=[],_e=0;const ge=function(e,i){if(o.supported&&(e.headers||(e.headers={}),e.headers.accept="image/webp,*/*"),_e>=r.MAX_PARALLEL_IMAGE_REQUESTS){const t={requestParameters:e,callback:i,cancelled:!1,cancel(){this.cancelled=!0}};return me.push(t),t}_e++;let n=!1;const s=()=>{if(!n)for(n=!0,_e--;me.length&&_e{s(),e?i(e):n&&(t.createImageBitmap?function(e,i){const n=new t.Blob([new Uint8Array(e)],{type:"image/png"});t.createImageBitmap(n).then((e=>{i(null,e)})).catch((e=>{i(new Error(`Could not load image because of ${e.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))}))}(n,((e,t)=>i(e,t,r,o))):function(e,i){const n=new t.Image,r=t.URL;n.onload=()=>{i(null,n),r.revokeObjectURL(n.src),n.onload=null,t.requestAnimationFrame((()=>{n.src=fe}))},n.onerror=()=>i(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 o=new t.Blob([new Uint8Array(e)],{type:"image/png"});n.src=e.byteLength?r.createObjectURL(o):fe}(n,((e,t)=>i(e,t,r,o))))}));return{cancel:()=>{a.cancel(),s()}}},ye="NO_ACCESS_TOKEN";function be(e){return 0===e.indexOf("mapbox:")}function ve(e){return r.API_URL_REGEX.test(e)}function xe(e){return r.API_CDN_URL_REGEX.test(e)}function we(e){return r.API_STYLE_REGEX.test(e)&&!Ee(e)}function Ee(e){return r.API_SPRITE_REGEX.test(e)}const Te=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function ke(e){const t=e.match(Te);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 Ce(e){const t=e.params.length?`?${e.params.join("&")}`:"";return`${e.protocol}://${e.authority}${e.path}${t}`}const Se="mapbox.eventData";function Me(e){if(!e)return null;const i=e.split(".");if(!i||3!==i.length)return null;try{return JSON.parse(decodeURIComponent(t.atob(i[1]).split("").map((e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2))).join("")))}catch(e){return null}}class Ae{constructor(e){this.type=e,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(e){const i=Me(r.ACCESS_TOKEN);let n="";return n=i&&i.u?t.btoa(encodeURIComponent(i.u).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(Number("0x"+t))))):r.ACCESS_TOKEN||"",e?`${Se}.${e}:${n}`:`${Se}:${n}`}fetchEventData(){const e=J("localStorage"),i=this.getStorageKey(),n=this.getStorageKey("uuid");if(e)try{const e=t.localStorage.getItem(i);e&&(this.eventData=JSON.parse(e));const r=t.localStorage.getItem(n);r&&(this.anonId=r)}catch(e){q("Unable to read from LocalStorage")}}saveEventData(){const e=J("localStorage"),i=this.getStorageKey(),n=this.getStorageKey("uuid");if(e)try{t.localStorage.setItem(n,this.anonId),Object.keys(this.eventData).length>=1&&t.localStorage.setItem(i,JSON.stringify(this.eventData))}catch(e){q("Unable to write to LocalStorage")}}processRequests(e){}postEvent(e,t,i,n){if(!r.EVENTS_URL)return;const o=ke(r.EVENTS_URL);o.params.push(`access_token=${n||r.ACCESS_TOKEN||""}`);const s={event:this.type,created:new Date(e).toISOString()},a=t?L(s,t):s,l={url:Ce(o),headers:{"Content-Type":"text/plain"},body:JSON.stringify([a])};this.pendingRequest=function(e,t){return he(L(e,{method:"POST"}),t)}(l,(e=>{this.pendingRequest=null,i(e),this.saveEventData(),this.processRequests(n)}))}queueRequest(e,t){this.queue.push(e),this.processRequests(t)}}const Ie=new class extends Ae{constructor(e){super("appUserTurnstile"),this._customAccessToken=e}postTurnstileEvent(e,t){r.EVENTS_URL&&r.ACCESS_TOKEN&&Array.isArray(e)&&e.some((e=>be(e)||ve(e)))&&this.queueRequest(Date.now(),t)}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const t=Me(r.ACCESS_TOKEN),n=t?t.u:r.ACCESS_TOKEN;let o=n!==this.eventData.tokenU;R(this.anonId)||(this.anonId=O(),o=!0);const s=this.queue.shift();if(this.eventData.lastSuccess){const e=new Date(this.eventData.lastSuccess),t=new Date(s),i=(s-this.eventData.lastSuccess)/864e5;o=o||i>=1||i<-1||e.getDate()!==t.getDate()}else o=!0;o?this.postEvent(s,{sdkIdentifier:"mapbox-gl-js",sdkVersion:i,skuId:h,"enabled.telemetry":!1,userId:this.anonId},(e=>{e||(this.eventData.lastSuccess=s,this.eventData.tokenU=n)}),e):this.processRequests()}},Pe=Ie.postTurnstileEvent.bind(Ie),Le=new class extends Ae{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(e,t,i,n){this.skuToken=t,this.errorCb=n,r.EVENTS_URL&&(i||r.ACCESS_TOKEN?this.queueRequest({id:e,timestamp:Date.now()},i):this.errorCb(new Error(ye)))}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;const{id:t,timestamp:n}=this.queue.shift();t&&this.success[t]||(this.anonId||this.fetchEventData(),R(this.anonId)||(this.anonId=O()),this.postEvent(n,{sdkIdentifier:"mapbox-gl-js",sdkVersion:i,skuId:h,skuToken:this.skuToken,userId:this.anonId},(e=>{e?this.errorCb(e):t&&(this.success[t]=!0)}),e))}},De=Le.postMapLoadEvent.bind(Le),ze=new class extends Ae{constructor(){super("gljs.performance")}postPerformanceEvent(e,t){r.EVENTS_URL&&(e||r.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:t},e)}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;const{timestamp:n,performanceData:r}=this.queue.shift(),o=function(e){const n=t.performance.getEntriesByType("resource"),r=t.performance.getEntriesByType("mark"),o=function(e){const t={};if(e)for(const i in e)if("other"!==i)for(const n of e[i]){const e=`${i}ResolveRangeMin`,r=`${i}ResolveRangeMax`,o=`${i}RequestCount`,s=`${i}RequestCachedCount`;t[e]=Math.min(t[e]||1/0,n.startTime),t[r]=Math.max(t[r]||-1/0,n.responseEnd);const a=e=>{void 0===t[e]&&(t[e]=0),++t[e]};void 0!==n.transferSize&&0===n.transferSize&&a(s),a(o)}return t}(function(e,t){const i={};if(e)for(const n of e){const e=t(n);void 0===i[e]&&(i[e]=[]),i[e].push(n)}return i}(n,Ve)),s=t.devicePixelRatio,a=t.navigator.connection||t.navigator.mozConnection||t.navigator.webkitConnection,l={counters:[],metadata:[],attributes:[]},c=(e,t,i)=>{null!=i&&e.push({name:t,value:i.toString()})};for(const e in o)c(l.counters,e,o[e]);if(e.interactionRange[0]!==1/0&&e.interactionRange[1]!==-1/0&&(c(l.counters,"interactionRangeMin",e.interactionRange[0]),c(l.counters,"interactionRangeMax",e.interactionRange[1])),r)for(const e of Object.keys(Ue)){const t=Ue[e],i=r.find((e=>e.name===t));i&&c(l.counters,t,i.startTime)}return c(l.counters,"visibilityHidden",e.visibilityHidden),c(l.attributes,"style",function(e){if(e)for(const t of e){const e=t.name.split("?")[0];if(we(e)){const t=e.split("/").slice(-2);if(2===t.length)return`mapbox://styles/${t[0]}/${t[1]}`}}}(n)),c(l.attributes,"terrainEnabled",e.terrainEnabled?"true":"false"),c(l.attributes,"fogEnabled",e.fogEnabled?"true":"false"),c(l.attributes,"projection",e.projection),c(l.attributes,"zoom",e.zoom),c(l.metadata,"devicePixelRatio",s),c(l.metadata,"connectionEffectiveType",a?a.effectiveType:void 0),c(l.metadata,"navigatorUserAgent",t.navigator.userAgent),c(l.metadata,"screenWidth",t.screen.width),c(l.metadata,"screenHeight",t.screen.height),c(l.metadata,"windowWidth",t.innerWidth),c(l.metadata,"windowHeight",t.innerHeight),c(l.metadata,"mapWidth",e.width/s),c(l.metadata,"mapHeight",e.height/s),c(l.metadata,"webglRenderer",e.renderer),c(l.metadata,"webglVendor",e.vendor),c(l.metadata,"sdkVersion",i),c(l.metadata,"sdkIdentifier","mapbox-gl-js"),l}(r);for(const e of o.metadata);for(const e of o.counters);for(const e of o.attributes);this.postEvent(n,o,(()=>{}),e)}},Oe=ze.postPerformanceEvent.bind(ze),Be=new class extends Ae{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(e,t,i,n){if(!r.API_URL||!r.SESSION_PATH)return;const o=ke(r.API_URL+r.SESSION_PATH);o.params.push(`sku=${t||""}`),o.params.push(`access_token=${n||r.ACCESS_TOKEN||""}`);const s={url:Ce(o),headers:{"Content-Type":"text/plain"}};this.pendingRequest=function(e,t){return he(L(e,{method:"GET"}),t)}(s,(e=>{this.pendingRequest=null,i(e),this.saveEventData(),this.processRequests(n)}))}getSessionAPI(e,t,i,n){this.skuToken=t,this.errorCb=n,r.SESSION_PATH&&r.API_URL&&(i||r.ACCESS_TOKEN?this.queueRequest({id:e,timestamp:Date.now()},i):this.errorCb(new Error(ye)))}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;const{id:t,timestamp:i}=this.queue.shift();t&&this.success[t]||this.getSession(i,this.skuToken,(e=>{e?this.errorCb(e):t&&(this.success[t]=!0)}),e)}},Re=Be.getSessionAPI.bind(Be),Fe=new Set,Ue={create:"create",load:"load",fullLoad:"fullLoad"},je={mark(e){t.performance.mark(e)},measure(e,i,n){t.performance.measure(e,i,n)}};function Ve(e){const t=e.name.split("?")[0];return xe(t)&&t.includes("mapbox-gl.js")?"javascript":xe(t)&&t.includes("mapbox-gl.css")?"css":function(e){return r.API_FONTS_REGEX.test(e)}(t)?"fontRange":Ee(t)?"sprite":we(t)?"style":function(e){return r.API_TILEJSON_REGEX.test(e)}(t)?"tilejson":"other"}const Ne=t.performance;function $e(e){const t=e?e.url.toString():void 0;return Ne.getEntriesByName(t)}let qe,Ge,Ze,We;const He={now:()=>void 0!==Ze?Ze:t.performance.now(),setNow(e){Ze=e},restoreNow(){Ze=void 0},frame(e){const i=t.requestAnimationFrame(e);return{cancel:()=>t.cancelAnimationFrame(i)}},getImageData(e,i=0){const{width:n,height:r}=e;We||(We=t.document.createElement("canvas"));const o=We.getContext("2d",{willReadFrequently:!0});if(!o)throw new Error("failed to create canvas 2d context");return(n>We.width||r>We.height)&&(We.width=n,We.height=r),o.clearRect(-i,-i,n+2*i,r+2*i),o.drawImage(e,0,0,n,r),o.getImageData(-i,-i,n+2*i,r+2*i)},resolveURL:e=>(qe||(qe=t.document.createElement("a")),qe.href=e,qe.href),get devicePixelRatio(){return t.devicePixelRatio},get prefersReducedMotion(){return!!t.matchMedia&&(null==Ge&&(Ge=t.matchMedia("(prefers-reduced-motion: reduce)")),Ge.matches)}};function Xe(e,t,i){i[e]&&-1!==i[e].indexOf(t)||(i[e]=i[e]||[],i[e].push(t))}function Ke(e,t,i){if(i&&i[e]){const n=i[e].indexOf(t);-1!==n&&i[e].splice(n,1)}}class Je{constructor(e,t={}){L(this,t),this.type=e}}class Ye extends Je{constructor(e,t={}){super("error",L({error:e},t))}}class Qe{on(e,t){return this._listeners=this._listeners||{},Xe(e,t,this._listeners),this}off(e,t){return Ke(e,t,this._listeners),Ke(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners=this._oneTimeListeners||{},Xe(e,t,this._oneTimeListeners),this):new Promise((t=>this.once(e,t)))}fire(e,t){"string"==typeof e&&(e=new Je(e,t||{}));const i=e.type;if(this.listens(i)){e.target=this;const t=this._listeners&&this._listeners[i]?this._listeners[i].slice():[];for(const i of t)i.call(this,e);const n=this._oneTimeListeners&&this._oneTimeListeners[i]?this._oneTimeListeners[i].slice():[];for(const t of n)Ke(i,t,this._oneTimeListeners),t.call(this,e);const r=this._eventedParent;r&&(L(e,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),r.fire(e))}else e instanceof Ye&&console.error(e.error);return this}listens(e){return!!(this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e))}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}}var et=JSON.parse('{"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360,"units":"degrees"},"pitch":{"type":"number","default":0,"units":"degrees"},"light":{"type":"light"},"terrain":{"type":"terrain"},"fog":{"type":"fog"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"required":true,"type":"array","value":"layer"}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],"source_vector":{"type":{"required":true,"type":"enum","values":{"vector":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"scheme":{"type":"enum","values":{"xyz":{},"tms":{}},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"required":true,"type":"enum","values":{"raster":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"scheme":{"type":"enum","values":{"xyz":{},"tms":{}},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"required":true,"type":"enum","values":{"raster-dem":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":{},"mapbox":{}},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":{"geojson":{}}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"}},"source_video":{"type":{"required":true,"type":"enum","values":{"video":{}}},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":{"image":{}}},"url":{"required":true,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"raster":{},"hillshade":{},"background":{},"sky":{}},"required":true},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"}},"layout":["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background","layout_sky"],"layout_background":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"},"fill-extrusion-edge-radius":{"type":"number","private":true,"default":0,"minimum":0,"maximum":1,"property-type":"constant"}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":{},"round":{},"square":{}},"default":"butt","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":{},"round":{},"miter":{}},"default":"miter","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"requires":[{"line-join":"miter"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-round-limit":{"type":"number","default":1.05,"requires":[{"line-join":"round"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":{},"line":{},"line-center":{}},"default":"point","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"units":"pixels","requires":[{"symbol-placement":"line"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":{},"viewport-y":{},"source":{}},"default":"auto","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-optional":{"type":"boolean","default":false,"requires":["icon-image","text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-size":{"type":"number","default":1,"minimum":0,"units":"factor of the original icon size","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{"type":"enum","values":{"none":{},"width":{},"height":{},"both":{}},"default":"none","requires":["icon-image","text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"units":"pixels","requires":["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-image":{"type":"resolvedImage","tokens":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{"type":"boolean","default":false,"requires":["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{"type":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"default":"center","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{"type":"number","default":10,"minimum":0,"units":"ems","requires":["text-field",{"symbol-placement":["point"]}],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":{},"left":{},"center":{},"right":{}},"default":"center","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","units":"ems","default":0,"requires":["text-field"],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"requires":["text-field",{"symbol-placement":["point"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-anchor":{"type":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"default":"center","requires":["text-field",{"!":"text-variable-anchor"}],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"units":"degrees","requires":["text-field",{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":{},"vertical":{}},"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-keep-upright":{"type":"boolean","default":true,"requires":["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-transform":{"type":"enum","values":{"none":{},"uppercase":{},"lowercase":{}},"default":"none","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","units":"ems","length":2,"default":[0,0],"requires":["text-field",{"!":"text-radial-offset"}],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-optional":{"type":"boolean","default":false,"requires":["text-field","icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},"in":{},"!in":{},"all":{},"any":{},"none":{},"has":{},"!has":{},"within":{}}},"geometry_type":{"type":"enum","values":{"Point":{},"LineString":{},"Polygon":{}}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":{},"exponential":{},"interval":{},"categorical":{}},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":{},"lab":{},"hcl":{}},"default":"rgb"},"default":{"type":"*","required":false}},"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","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"high-color":{"type":"color","property-type":"data-constant","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"space-color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"horizon-blend":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"star-intensity":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":{},"viewport":{}},"property-type":"data-constant","transition":false,"expression":{"interpolated":false,"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":{},"equalEarth":{},"equirectangular":{},"lambertConformalConic":{},"mercator":{},"naturalEarth":{},"winkelTripel":{},"globe":{}},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-180,-90],"maximum":[180,90],"transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-90,-90],"maximum":[90,90],"transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]}},"terrain":{"source":{"type":"string","required":true},"exaggeration":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true,"requires":["source"]}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background","paint_sky"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","transition":true,"requires":[{"!":"fill-pattern"},{"fill-antialias":true}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom","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"]},"property-type":"data-constant"},"fill-extrusion-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-extrusion-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-extrusion-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"requires":["fill-extrusion-height"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-ambient-occlusion-intensity":{"property-type":"data-constant","type":"number","private":true,"default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"property-type":"data-constant","type":"number","private":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true,"requires":["fill-extrusion-edge-radius"]},"fill-extrusion-rounded-roof":{"type":"boolean","default":true,"requires":["fill-extrusion-edge-radius"],"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"line-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["line-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"transition":false,"units":"line widths","requires":[{"!":"line-pattern"}],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-gradient":{"type":"color","transition":false,"requires":[{"!":"line-pattern"},{"source":"geojson","has":{"lineMetrics":true}}],"expression":{"interpolated":true,"parameters":["line-progress"]},"property-type":"color-ramp"},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"transition":false,"requires":[{"source":"geojson","has":{"lineMetrics":true}}],"property-type":"constant"}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["circle-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"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"]},"property-type":"data-driven"}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"transition":false,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"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"],"transition":false,"expression":{"interpolated":true,"parameters":["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["icon-image","icon-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","transition":true,"overridable":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["text-field","text-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"units":"degrees","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-resampling":{"type":"enum","values":{"linear":{},"nearest":{}},"default":"linear","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"transition":false,"units":"milliseconds","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"transition":false,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_background":{"background-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"background-pattern"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":{},"atmosphere":{}},"default":"atmosphere","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"requires":[{"sky-type":"atmosphere"}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{"type":"number","requires":[{"sky-type":"atmosphere"}],"default":10,"minimum":0,"maximum":100,"transition":false,"property-type":"data-constant"},"sky-gradient-center":{"type":"array","requires":[{"sky-type":"gradient"}],"value":"number","default":[0,0],"length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{"type":"number","requires":[{"sky-type":"gradient"}],"default":90,"minimum":0,"maximum":180,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"transition":false,"requires":[{"sky-type":"gradient"}],"expression":{"interpolated":true,"parameters":["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-atmosphere-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"transition":{"duration":{"type":"number","default":300,"minimum":0,"units":"milliseconds"},"delay":{"type":"number","default":0,"minimum":0,"units":"milliseconds"}},"property-type":{"data-driven":{"type":"property-type"},"color-ramp":{"type":"property-type"},"data-constant":{"type":"property-type"},"constant":{"type":"property-type"}},"promoteId":{"*":{"type":"string"}}}');function tt(e,...t){for(const i of t)for(const t in i)e[t]=i[t];return e}function it(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function nt(e){if(Array.isArray(e))return e.map(nt);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){const t={};for(const i in e)t[i]=nt(e[i]);return t}return it(e)}class rt extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}var ot=rt;class st{constructor(e,t=[]){this.parent=e,this.bindings={};for(const[e,i]of t)this.bindings[e]=i}concat(e){return new st(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)}}var at=st;const lt={kind:"null"},ct={kind:"number"},ut={kind:"string"},ht={kind:"boolean"},dt={kind:"color"},pt={kind:"object"},ft={kind:"value"},mt={kind:"collator"},_t={kind:"formatted"},gt={kind:"resolvedImage"};function yt(e,t){return{kind:"array",itemType:e,N:t}}function bt(e){if("array"===e.kind){const t=bt(e.itemType);return"number"==typeof e.N?`array<${t}, ${e.N}>`:"value"===e.itemType.kind?"array":`array<${t}>`}return e.kind}const vt=[lt,ct,ut,ht,dt,_t,pt,yt(ft),gt];function xt(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!xt(e.itemType,t.itemType))&&("number"!=typeof e.N||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if("value"===e.kind)for(const e of vt)if(!xt(e,t))return null}return`Expected ${bt(e)} but found ${bt(t)} instead.`}function wt(e,t){return t.some((t=>t.kind===e.kind))}function Et(e,t){return t.some((t=>"null"===t?null===e:"array"===t?Array.isArray(e):"object"===t?e&&!Array.isArray(e)&&"object"==typeof e:t===typeof e))}var Tt,kt={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 Ct(e){return(e=Math.round(e))<0?0:e>255?255:e}function St(e){return Ct("%"===e[e.length-1]?parseFloat(e)/100*255:parseInt(e))}function Mt(e){return(t="%"===e[e.length-1]?parseFloat(e)/100:parseFloat(e))<0?0:t>1?1:t;var t}function At(e,t,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?e+(t-e)*i*6:2*i<1?t:3*i<2?e+(t-e)*(2/3-i)*6:e}try{Tt={}.parseCSSColor=function(e){var t,i=e.replace(/ /g,"").toLowerCase();if(i in kt)return kt[i].slice();if("#"===i[0])return 4===i.length?(t=parseInt(i.substr(1),16))>=0&&t<=4095?[(3840&t)>>4|(3840&t)>>8,240&t|(240&t)>>4,15&t|(15&t)<<4,1]:null:7===i.length&&(t=parseInt(i.substr(1),16))>=0&&t<=16777215?[(16711680&t)>>16,(65280&t)>>8,255&t,1]:null;var n=i.indexOf("("),r=i.indexOf(")");if(-1!==n&&r+1===i.length){var o=i.substr(0,n),s=i.substr(n+1,r-(n+1)).split(","),a=1;switch(o){case"rgba":if(4!==s.length)return null;a=Mt(s.pop());case"rgb":return 3!==s.length?null:[St(s[0]),St(s[1]),St(s[2]),a];case"hsla":if(4!==s.length)return null;a=Mt(s.pop());case"hsl":if(3!==s.length)return null;var l=(parseFloat(s[0])%360+360)%360/360,c=Mt(s[1]),u=Mt(s[2]),h=u<=.5?u*(c+1):u+c-u*c,d=2*u-h;return[Ct(255*At(d,h,l+1/3)),Ct(255*At(d,h,l)),Ct(255*At(d,h,l-1/3)),a];default:return null}}return null}}catch(e){}class It{constructor(e,t,i,n=1){this.r=e,this.g=t,this.b=i,this.a=n}static parse(e){if(!e)return;if(e instanceof It)return e;if("string"!=typeof e)return;const t=Tt(e);return t?new It(t[0]/255*t[3],t[1]/255*t[3],t[2]/255*t[3],t[3]):void 0}toString(){const[e,t,i,n]=this.toArray();return`rgba(${Math.round(e)},${Math.round(t)},${Math.round(i)},${n})`}toArray(){const{r:e,g:t,b:i,a:n}=this;return 0===n?[0,0,0,0]:[255*e/n,255*t/n,255*i/n,n]}toArray01(){const{r:e,g:t,b:i,a:n}=this;return 0===n?[0,0,0,0]:[e/n,t/n,i/n,n]}toArray01PremultipliedAlpha(){const{r:e,g:t,b:i,a:n}=this;return[e,t,i,n]}}It.black=new It(0,0,0,1),It.white=new It(1,1,1,1),It.transparent=new It(0,0,0,0),It.red=new It(1,0,0,1),It.blue=new It(0,0,1,1);var Pt=It;class Lt{constructor(e,t,i){this.sensitivity=e?t?"variant":"case":t?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Dt{constructor(e,t,i,n,r){this.text=e.normalize?e.normalize():e,this.image=t,this.scale=i,this.fontStack=n,this.textColor=r}}class zt{constructor(e){this.sections=e}static fromString(e){return new zt([new Dt(e,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((e=>0!==e.text.length||e.image&&0!==e.image.name.length))}static factory(e){return e instanceof zt?e:zt.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map((e=>e.text)).join("")}serialize(){const e=["format"];for(const t of this.sections){if(t.image){e.push(["image",t.image.name]);continue}e.push(t.text);const i={};t.fontStack&&(i["text-font"]=["literal",t.fontStack.split(",")]),t.scale&&(i["font-scale"]=t.scale),t.textColor&&(i["text-color"]=["rgba"].concat(t.textColor.toArray())),e.push(i)}return e}}class Ot{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new Ot({name:e,available:!1}):null}serialize(){return["image",this.name]}}function Bt(e,t,i,n){return"number"==typeof e&&e>=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[e,t,i,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof n?[e,t,i,n]:[e,t,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Rt(e){if(null===e)return!0;if("string"==typeof e)return!0;if("boolean"==typeof e)return!0;if("number"==typeof e)return!0;if(e instanceof Pt)return!0;if(e instanceof Lt)return!0;if(e instanceof zt)return!0;if(e instanceof Ot)return!0;if(Array.isArray(e)){for(const t of e)if(!Rt(t))return!1;return!0}if("object"==typeof e){for(const t in e)if(!Rt(e[t]))return!1;return!0}return!1}function Ft(e){if(null===e)return lt;if("string"==typeof e)return ut;if("boolean"==typeof e)return ht;if("number"==typeof e)return ct;if(e instanceof Pt)return dt;if(e instanceof Lt)return mt;if(e instanceof zt)return _t;if(e instanceof Ot)return gt;if(Array.isArray(e)){const t=e.length;let i;for(const t of e){const e=Ft(t);if(i){if(i===e)continue;i=ft;break}i=e}return yt(i||ft,t)}return pt}function Ut(e){const t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof Pt||e instanceof zt||e instanceof Ot?e.toString():JSON.stringify(e)}class jt{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(2!==e.length)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Rt(e[1]))return t.error("invalid value");const i=e[1];let n=Ft(i);const r=t.expectedType;return"array"!==n.kind||0!==n.N||!r||"array"!==r.kind||"number"==typeof r.N&&0!==r.N||(n=r),new jt(n,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof Pt?["rgba"].concat(this.value.toArray()):this.value instanceof zt?this.value.serialize():this.value}}var Vt=jt,Nt=class{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}};const $t={string:ut,number:ct,boolean:ht,object:pt};class qt{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i,n=1;const r=e[0];if("array"===r){let r,o;if(e.length>2){const i=e[1];if("string"!=typeof i||!(i in $t)||"object"===i)return t.error('The item type argument of "array" must be one of string, number, boolean',1);r=$t[i],n++}else r=ft;if(e.length>3){if(null!==e[2]&&("number"!=typeof e[2]||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);o=e[2],n++}i=yt(r,o)}else i=$t[r];const o=[];for(;ne.outputDefined()))}serialize(){const e=this.type,t=[e.kind];if("array"===e.kind){const i=e.itemType;if("string"===i.kind||"number"===i.kind||"boolean"===i.kind){t.push(i.kind);const n=e.N;("number"==typeof n||this.args.length>1)&&t.push(n)}}return t.concat(this.args.map((e=>e.serialize())))}}var Gt=qt;class Zt{constructor(e){this.type=_t,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const i=e[1];if(!Array.isArray(i)&&"object"==typeof i)return t.error("First argument must be an image or text section.");const n=[];let r=!1;for(let i=1;i<=e.length-1;++i){const o=e[i];if(r&&"object"==typeof o&&!Array.isArray(o)){r=!1;let e=null;if(o["font-scale"]&&(e=t.parse(o["font-scale"],1,ct),!e))return null;let i=null;if(o["text-font"]&&(i=t.parse(o["text-font"],1,yt(ut)),!i))return null;let s=null;if(o["text-color"]&&(s=t.parse(o["text-color"],1,dt),!s))return null;const a=n[n.length-1];a.scale=e,a.font=i,a.textColor=s}else{const o=t.parse(e[i],1,ft);if(!o)return null;const s=o.type.kind;if("string"!==s&&"value"!==s&&"null"!==s&&"resolvedImage"!==s)return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");r=!0,n.push({content:o,scale:null,font:null,textColor:null})}}return new Zt(n)}evaluate(e){return new zt(this.sections.map((t=>{const i=t.content.evaluate(e);return Ft(i)===gt?new Dt("",i,null,null,null):new Dt(Ut(i),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(","):null,t.textColor?t.textColor.evaluate(e):null)})))}eachChild(e){for(const t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor)}outputDefined(){return!1}serialize(){const e=["format"];for(const t of this.sections){e.push(t.content.serialize());const i={};t.scale&&(i["font-scale"]=t.scale.serialize()),t.font&&(i["text-font"]=t.font.serialize()),t.textColor&&(i["text-color"]=t.textColor.serialize()),e.push(i)}return e}}class Wt{constructor(e){this.type=gt,this.input=e}static parse(e,t){if(2!==e.length)return t.error("Expected two arguments.");const i=t.parse(e[1],1,ut);return i?new Wt(i):t.error("No image name provided.")}evaluate(e){const t=this.input.evaluate(e),i=Ot.fromString(t);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(t)>-1),i}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}const Ht={"to-boolean":ht,"to-color":dt,"to-number":ct,"to-string":ut};class Xt{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const i=e[0];if(("to-boolean"===i||"to-string"===i)&&2!==e.length)return t.error("Expected one argument.");const n=Ht[i],r=[];for(let i=1;i4?`Invalid rbga value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:Bt(t[0],t[1],t[2],t[3]),!i))return new Pt(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new Nt(i||`Could not parse color from value '${"string"==typeof t?t:String(JSON.stringify(t))}'`)}if("number"===this.type.kind){let t=null;for(const i of this.args){if(t=i.evaluate(e),null===t)return 0;const n=Number(t);if(!isNaN(n))return n}throw new Nt(`Could not convert ${JSON.stringify(t)} to number.`)}return"formatted"===this.type.kind?zt.fromString(Ut(this.args[0].evaluate(e))):"resolvedImage"===this.type.kind?Ot.fromString(Ut(this.args[0].evaluate(e))):Ut(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}serialize(){if("formatted"===this.type.kind)return new Zt([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new Wt(this.args[0]).serialize();const e=[`to-${this.type.kind}`];return this.eachChild((t=>{e.push(t.serialize())})),e}}var Kt=Xt;const Jt=["Unknown","Point","LineString","Polygon"];var Yt=class{constructor(){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}id(){return this.feature&&void 0!==this.feature.id?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?Jt[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||{}}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const e=this.featureDistanceData.center,t=this.featureDistanceData.scale,{x:i,y:n}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(i*t-e[0])+this.featureDistanceData.bearing[1]*(n*t-e[1])}return 0}parseColor(e){let t=this._parseColorCache[e];return t||(t=this._parseColorCache[e]=Pt.parse(e)),t}};class Qt{constructor(e,t,i,n){this.name=e,this.type=t,this._evaluate=i,this.args=n}evaluate(e){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,t){const i=e[0],n=Qt.definitions[i];if(!n)return t.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const r=Array.isArray(n)?n[0]:n.type,o=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,s=o.filter((([t])=>!Array.isArray(t)||t.length===e.length-1));let a=null;for(const[n,o]of s){a=new Ci(t.registry,t.path,null,t.scope);const s=[];let l=!1;for(let t=1;t{return t=e,Array.isArray(t)?`(${t.map(bt).join(", ")})`:`(${bt(t.type)}...)`;var t})).join(" | "),n=[];for(let i=1;i=t[2]||e[1]<=t[1]||e[3]>=t[3])}function oi(e,t){const i=(180+e[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e[1]*Math.PI/360)))/360,r=Math.pow(2,t.z);return[Math.round(i*r*ii),Math.round(n*r*ii)]}function si(e,t,i){const n=e[0]-t[0],r=e[1]-t[1],o=e[0]-i[0],s=e[1]-i[1];return n*s-o*r==0&&n*o<=0&&r*s<=0}function ai(e,t){let i=!1;for(let s=0,a=t.length;s(n=e)[1]!=(o=a[t+1])[1]>n[1]&&n[0]<(o[0]-r[0])*(n[1]-r[1])/(o[1]-r[1])+r[0]&&(i=!i)}}var n,r,o;return i}function li(e,t){for(let i=0;i0&&a<0||s<0&&a>0}function ui(e,t,i){for(const c of i)for(let i=0;ii[2]){const t=.5*n;let r=e[0]-i[0]>t?-n:i[0]-e[0]>t?n:0;0===r&&(r=e[0]-i[2]>t?-n:i[2]-e[0]>t?n:0),e[0]+=r}ni(t,e)}function _i(e,t,i,n){const r=Math.pow(2,n.z)*ii,o=[n.x*ii,n.y*ii],s=[];if(!e)return s;for(const n of e)for(const e of n){const n=[e.x+o[0],e.y+o[1]];mi(n,t,i,r),s.push(n)}return s}function gi(e,t,i,n){const r=Math.pow(2,n.z)*ii,o=[n.x*ii,n.y*ii],s=[];if(!e)return s;for(const i of e){const e=[];for(const n of i){const i=[n.x+o[0],n.y+o[1]];ni(t,i),e.push(i)}s.push(e)}if(t[2]-t[0]<=r/2){(a=t)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(const e of s)for(const n of e)mi(n,t,i,r)}var a;return s}class yi{constructor(e,t){this.type=ht,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Rt(e[1])){const t=e[1];if("FeatureCollection"===t.type)for(let e=0;e{t&&!vi(e)&&(t=!1)})),t}function xi(e){if(e instanceof ei&&"feature-state"===e.name)return!1;let t=!0;return e.eachChild((e=>{t&&!xi(e)&&(t=!1)})),t}function wi(e,t){if(e instanceof ei&&t.indexOf(e.name)>=0)return!1;let i=!0;return e.eachChild((e=>{i&&!wi(e,t)&&(i=!1)})),i}class Ei{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(2!==e.length||"string"!=typeof e[1])return t.error("'var' expression requires exactly one string literal argument.");const i=e[1];return t.scope.has(i)?new Ei(i,t.scope.get(i)):t.error(`Unknown variable "${i}". Make sure "${i}" 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]}}var Ti=Ei;class ki{constructor(e,t=[],i,n=new at,r=[]){this.registry=e,this.path=t,this.key=t.map((e=>`[${e}]`)).join(""),this.scope=n,this.errors=r,this.expectedType=i}parse(e,t,i,n,r={}){return t?this.concat(t,i,n)._parse(e,r):this._parse(e,r)}_parse(e,t){function i(e,t,i){return"assert"===i?new Gt(t,[e]):"coerce"===i?new Kt(t,[e]):e}if(null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e||(e=["literal",e]),Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const n=e[0];if("string"!=typeof n)return this.error(`Expression name must be a string, but found ${typeof n} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const r=this.registry[n];if(r){let n=r.parse(e,this);if(!n)return null;if(this.expectedType){const e=this.expectedType,r=n.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==r.kind)if("color"!==e.kind&&"formatted"!==e.kind&&"resolvedImage"!==e.kind||"value"!==r.kind&&"string"!==r.kind){if(this.checkSubtype(e,r))return null}else n=i(n,e,t.typeAnnotation||"coerce");else n=i(n,e,t.typeAnnotation||"assert")}if(!(n instanceof Vt)&&"resolvedImage"!==n.type.kind&&Si(n)){const t=new Yt;try{n=new Vt(n.type,n.evaluate(t))}catch(e){return this.error(e.message),null}}return n}return this.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(void 0===e?"'undefined' value invalid. Use null instead.":"object"==typeof e?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,t,i){const n="number"==typeof e?this.path.concat(e):this.path,r=i?this.scope.concat(i):this.scope;return new ki(this.registry,n,t||null,r,this.errors)}error(e,...t){const i=`${this.key}${t.map((e=>`[${e}]`)).join("")}`;this.errors.push(new ot(i,e))}checkSubtype(e,t){const i=xt(e,t);return i&&this.error(i),i}}var Ci=ki;function Si(e){if(e instanceof Ti)return Si(e.boundExpression);if(e instanceof ei&&"error"===e.name)return!1;if(e instanceof ti)return!1;if(e instanceof bi)return!1;const t=e instanceof Kt||e instanceof Gt;let i=!0;return e.eachChild((e=>{i=t?i&&Si(e):i&&e instanceof Vt})),!!i&&vi(e)&&wi(e,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center"])}function Mi(e,t){const i=e.length-1;let n,r,o=0,s=i,a=0;for(;o<=s;)if(a=Math.floor((o+s)/2),n=e[a],r=e[a+1],n<=t){if(a===i||tt))throw new Nt("Input is not a number.");s=a-1}return 0}class Ai{constructor(e,t,i){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[e,t]of i)this.labels.push(e),this.outputs.push(t)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");const i=t.parse(e[1],1,ct);if(!i)return null;const n=[];let r=null;t.expectedType&&"value"!==t.expectedType.kind&&(r=t.expectedType);for(let i=1;i=o)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const c=t.parse(s,l,r);if(!c)return null;r=r||c.type,n.push([o,c])}return new Ai(r,i,n)}evaluate(e){const t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);const n=this.input.evaluate(e);if(n<=t[0])return i[0].evaluate(e);const r=t.length;return n>=t[r-1]?i[r-1].evaluate(e):i[Mi(t,n)].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}serialize(){const e=["step",this.input.serialize()];for(let t=0;t0&&e.push(this.labels[t]),e.push(this.outputs[t].serialize());return e}}var Ii=Ai;function Pi(e,t,i){return e*(1-i)+t*i}var Li=Object.freeze({__proto__:null,array:function(e,t,i){return e.map(((e,n)=>Pi(e,t[n],i)))},color:function(e,t,i){return new Pt(Pi(e.r,t.r,i),Pi(e.g,t.g,i),Pi(e.b,t.b,i),Pi(e.a,t.a,i))},number:Pi});const Di=.95047,zi=1.08883,Oi=4/29,Bi=6/29,Ri=3*Bi*Bi,Fi=Bi*Bi*Bi,Ui=Math.PI/180,ji=180/Math.PI;function Vi(e){return e>Fi?Math.pow(e,1/3):e/Ri+Oi}function Ni(e){return e>Bi?e*e*e:Ri*(e-Oi)}function $i(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function qi(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Gi(e){const t=qi(e.r),i=qi(e.g),n=qi(e.b),r=Vi((.4124564*t+.3575761*i+.1804375*n)/Di),o=Vi((.2126729*t+.7151522*i+.072175*n)/1);return{l:116*o-16,a:500*(r-o),b:200*(o-Vi((.0193339*t+.119192*i+.9503041*n)/zi)),alpha:e.a}}function Zi(e){let t=(e.l+16)/116,i=isNaN(e.a)?t:t+e.a/500,n=isNaN(e.b)?t:t-e.b/200;return t=1*Ni(t),i=Di*Ni(i),n=zi*Ni(n),new Pt($i(3.2404542*i-1.5371385*t-.4985314*n),$i(-.969266*i+1.8760108*t+.041556*n),$i(.0556434*i-.2040259*t+1.0572252*n),e.alpha)}function Wi(e,t,i){const n=t-e;return e+i*(n>180||n<-180?n-360*Math.round(n/360):n)}const Hi={forward:Gi,reverse:Zi,interpolate:function(e,t,i){return{l:Pi(e.l,t.l,i),a:Pi(e.a,t.a,i),b:Pi(e.b,t.b,i),alpha:Pi(e.alpha,t.alpha,i)}}},Xi={forward:function(e){const{l:t,a:i,b:n}=Gi(e),r=Math.atan2(n,i)*ji;return{h:r<0?r+360:r,c:Math.sqrt(i*i+n*n),l:t,alpha:e.a}},reverse:function(e){const t=e.h*Ui,i=e.c;return Zi({l:e.l,a:Math.cos(t)*i,b:Math.sin(t)*i,alpha:e.alpha})},interpolate:function(e,t,i){return{h:Wi(e.h,t.h,i),c:Pi(e.c,t.c,i),l:Pi(e.l,t.l,i),alpha:Pi(e.alpha,t.alpha,i)}}};var Ki=Object.freeze({__proto__:null,hcl:Xi,lab:Hi});class Ji{constructor(e,t,i,n,r){this.type=e,this.operator=t,this.interpolation=i,this.input=n,this.labels=[],this.outputs=[];for(const[e,t]of r)this.labels.push(e),this.outputs.push(t)}static interpolationFactor(e,t,i,n){let r=0;if("exponential"===e.name)r=Yi(t,e.base,i,n);else if("linear"===e.name)r=Yi(t,1,i,n);else if("cubic-bezier"===e.name){const o=e.controlPoints;r=new m(o[0],o[1],o[2],o[3]).solve(Yi(t,1,i,n))}return r}static parse(e,t){let[i,n,r,...o]=e;if(!Array.isArray(n)||0===n.length)return t.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){const e=n[1];if("number"!=typeof e)return t.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:e}}else{if("cubic-bezier"!==n[0])return t.error(`Unknown interpolation type ${String(n[0])}`,1,0);{const e=n.slice(1);if(4!==e.length||e.some((e=>"number"!=typeof e||e<0||e>1)))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:e}}}if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");if(r=t.parse(r,2,ct),!r)return null;const s=[];let a=null;"interpolate-hcl"===i||"interpolate-lab"===i?a=dt:t.expectedType&&"value"!==t.expectedType.kind&&(a=t.expectedType);for(let e=0;e=i)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',r);const c=t.parse(n,l,a);if(!c)return null;a=a||c.type,s.push([i,c])}return"number"===a.kind||"color"===a.kind||"array"===a.kind&&"number"===a.itemType.kind&&"number"==typeof a.N?new Ji(a,i,n,r,s):t.error(`Type ${bt(a)} is not interpolatable.`)}evaluate(e){const t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);const n=this.input.evaluate(e);if(n<=t[0])return i[0].evaluate(e);const r=t.length;if(n>=t[r-1])return i[r-1].evaluate(e);const o=Mi(t,n),s=Ji.interpolationFactor(this.interpolation,n,t[o],t[o+1]),a=i[o].evaluate(e),l=i[o+1].evaluate(e);return"interpolate"===this.operator?Li[this.type.kind.toLowerCase()](a,l,s):"interpolate-hcl"===this.operator?Xi.reverse(Xi.interpolate(Xi.forward(a),Xi.forward(l),s)):Hi.reverse(Hi.interpolate(Hi.forward(a),Hi.forward(l),s))}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}serialize(){let e;e="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const t=[this.operator,e,this.input.serialize()];for(let e=0;ext(n,e.type)));return new en(o?ft:i,r)}evaluate(e){let t,i=null,n=0;for(const r of this.args){if(n++,i=r.evaluate(e),i&&i instanceof Ot&&!i.available&&(t||(t=i),i=null,n===this.args.length))return t;if(null!==i)break}return i}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}serialize(){const e=["coalesce"];return this.eachChild((t=>{e.push(t.serialize())})),e}}var tn=en;class nn{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const i=[];for(let n=1;n=i.length)throw new Nt(`Array index out of bounds: ${t} > ${i.length-1}.`);if(t!==Math.floor(t))throw new Nt(`Array index must be an integer, but found ${t} instead.`);return i[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}var sn=on;class an{constructor(e,t){this.type=ht,this.needle=e,this.haystack=t}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,ft),n=t.parse(e[2],2,ft);return i&&n?wt(i.type,[ht,ut,ct,lt,ft])?new an(i,n):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${bt(i.type)} instead`):null}evaluate(e){const t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(null==i)return!1;if(!Et(t,["boolean","string","number","null"]))throw new Nt(`Expected first argument to be of type boolean, string, number or null, but found ${bt(Ft(t))} instead.`);if(!Et(i,["string","array"]))throw new Nt(`Expected second argument to be of type array or string, but found ${bt(Ft(i))} instead.`);return i.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}var ln=an;class cn{constructor(e,t,i){this.type=ct,this.needle=e,this.haystack=t,this.fromIndex=i}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,ft),n=t.parse(e[2],2,ft);if(!i||!n)return null;if(!wt(i.type,[ht,ut,ct,lt,ft]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${bt(i.type)} instead`);if(4===e.length){const r=t.parse(e[3],3,ct);return r?new cn(i,n,r):null}return new cn(i,n)}evaluate(e){const t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!Et(t,["boolean","string","number","null"]))throw new Nt(`Expected first argument to be of type boolean, string, number or null, but found ${bt(Ft(t))} instead.`);if(!Et(i,["string","array"]))throw new Nt(`Expected second argument to be of type array or string, but found ${bt(Ft(i))} instead.`);if(this.fromIndex){const n=this.fromIndex.evaluate(e);return i.indexOf(t,n)}return i.indexOf(t)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){const e=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),e]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}var un=cn;class hn{constructor(e,t,i,n,r,o){this.inputType=e,this.type=t,this.input=i,this.cases=n,this.outputs=r,this.otherwise=o}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return t.error("Expected an even number of arguments.");let i,n;t.expectedType&&"value"!==t.expectedType.kind&&(n=t.expectedType);const r={},o=[];for(let s=2;sNumber.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof e&&Math.floor(e)!==e)return c.error("Numeric branch labels must be integer values.");if(i){if(c.checkSubtype(i,Ft(e)))return null}else i=Ft(e);if(void 0!==r[String(e)])return c.error("Branch labels must be unique.");r[String(e)]=o.length}const u=t.parse(l,s,n);if(!u)return null;n=n||u.type,o.push(u)}const s=t.parse(e[1],1,ft);if(!s)return null;const a=t.parse(e[e.length-1],e.length-1,n);return a?"value"!==s.type.kind&&t.concat(1).checkSubtype(i,s.type)?null:new hn(i,n,s,r,o,a):null}evaluate(e){const t=this.input.evaluate(e);return(Ft(t)===this.inputType&&this.outputs[this.cases[t]]||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()],t=Object.keys(this.cases).sort(),i=[],n={};for(const e of t){const t=n[this.cases[e]];void 0===t?(n[this.cases[e]]=i.length,i.push([this.cases[e],[e]])):i[t][1].push(e)}const r=e=>"number"===this.inputType.kind?Number(e):e;for(const[t,n]of i)e.push(1===n.length?r(n[0]):n.map(r)),e.push(this.outputs[t].serialize());return e.push(this.otherwise.serialize()),e}}var dn=hn;class pn{constructor(e,t,i){this.type=e,this.branches=t,this.otherwise=i}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return t.error("Expected an odd number of arguments.");let i;t.expectedType&&"value"!==t.expectedType.kind&&(i=t.expectedType);const n=[];for(let r=1;rt.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const e=["case"];return this.eachChild((t=>{e.push(t.serialize())})),e}}var fn=pn;class mn{constructor(e,t,i,n){this.type=e,this.input=t,this.beginIndex=i,this.endIndex=n}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,ft),n=t.parse(e[2],2,ct);if(!i||!n)return null;if(!wt(i.type,[yt(ft),ut,ft]))return t.error(`Expected first argument to be of type array or string, but found ${bt(i.type)} instead`);if(4===e.length){const r=t.parse(e[3],3,ct);return r?new mn(i.type,i,n,r):null}return new mn(i.type,i,n)}evaluate(e){const t=this.input.evaluate(e),i=this.beginIndex.evaluate(e);if(!Et(t,["string","array"]))throw new Nt(`Expected first argument to be of type array or string, but found ${bt(Ft(t))} instead.`);if(this.endIndex){const n=this.endIndex.evaluate(e);return t.slice(i,n)}return t.slice(i)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){const e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}var _n=mn;function gn(e,t){return"=="===e||"!="===e?"boolean"===t.kind||"string"===t.kind||"number"===t.kind||"null"===t.kind||"value"===t.kind:"string"===t.kind||"number"===t.kind||"value"===t.kind}function yn(e,t,i,n){return 0===n.compare(t,i)}function bn(e,t,i){const n="=="!==e&&"!="!==e;return class r{constructor(e,t,i){this.type=ht,this.lhs=e,this.rhs=t,this.collator=i,this.hasUntypedArgument="value"===e.type.kind||"value"===t.type.kind}static parse(e,t){if(3!==e.length&&4!==e.length)return t.error("Expected two or three arguments.");const i=e[0];let o=t.parse(e[1],1,ft);if(!o)return null;if(!gn(i,o.type))return t.concat(1).error(`"${i}" comparisons are not supported for type '${bt(o.type)}'.`);let s=t.parse(e[2],2,ft);if(!s)return null;if(!gn(i,s.type))return t.concat(2).error(`"${i}" comparisons are not supported for type '${bt(s.type)}'.`);if(o.type.kind!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return t.error(`Cannot compare types '${bt(o.type)}' and '${bt(s.type)}'.`);n&&("value"===o.type.kind&&"value"!==s.type.kind?o=new Gt(s.type,[o]):"value"!==o.type.kind&&"value"===s.type.kind&&(s=new Gt(o.type,[s])));let a=null;if(4===e.length){if("string"!==o.type.kind&&"string"!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return t.error("Cannot use collator to compare non-string types.");if(a=t.parse(e[3],3,mt),!a)return null}return new r(o,s,a)}evaluate(r){const o=this.lhs.evaluate(r),s=this.rhs.evaluate(r);if(n&&this.hasUntypedArgument){const t=Ft(o),i=Ft(s);if(t.kind!==i.kind||"string"!==t.kind&&"number"!==t.kind)throw new Nt(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${i.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const e=Ft(o),i=Ft(s);if("string"!==e.kind||"string"!==i.kind)return t(r,o,s)}return this.collator?i(r,o,s,this.collator.evaluate(r)):t(r,o,s)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}serialize(){const t=[e];return this.eachChild((e=>{t.push(e.serialize())})),t}}}const vn=bn("==",(function(e,t,i){return t===i}),yn),xn=bn("!=",(function(e,t,i){return t!==i}),(function(e,t,i,n){return!yn(0,t,i,n)})),wn=bn("<",(function(e,t,i){return t",(function(e,t,i){return t>i}),(function(e,t,i,n){return n.compare(t,i)>0})),Tn=bn("<=",(function(e,t,i){return t<=i}),(function(e,t,i,n){return n.compare(t,i)<=0})),kn=bn(">=",(function(e,t,i){return t>=i}),(function(e,t,i,n){return n.compare(t,i)>=0}));class Cn{constructor(e,t,i,n,r,o){this.type=ut,this.number=e,this.locale=t,this.currency=i,this.unit=n,this.minFractionDigits=r,this.maxFractionDigits=o}static parse(e,t){if(3!==e.length)return t.error("Expected two arguments.");const i=t.parse(e[1],1,ct);if(!i)return null;const n=e[2];if("object"!=typeof n||Array.isArray(n))return t.error("NumberFormat options argument must be an object.");let r=null;if(n.locale&&(r=t.parse(n.locale,1,ut),!r))return null;let o=null;if(n.currency&&(o=t.parse(n.currency,1,ut),!o))return null;let s=null;if(n.unit&&(s=t.parse(n.unit,1,ut),!s))return null;let a=null;if(n["min-fraction-digits"]&&(a=t.parse(n["min-fraction-digits"],1,ct),!a))return null;let l=null;return n["max-fraction-digits"]&&(l=t.parse(n["max-fraction-digits"],1,ct),!l)?null:new Cn(i,r,o,s,a,l)}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 Sn{constructor(e){this.type=ct,this.input=e}static parse(e,t){if(2!==e.length)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const i=t.parse(e[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?t.error(`Expected argument of type string or array, but found ${bt(i.type)} instead.`):new Sn(i):null}evaluate(e){const t=this.input.evaluate(e);if("string"==typeof t)return t.length;if(Array.isArray(t))return t.length;throw new Nt(`Expected value to be of type string or array, but found ${bt(Ft(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){const e=["length"];return this.eachChild((t=>{e.push(t.serialize())})),e}}const Mn={"==":vn,"!=":xn,">":En,"<":wn,">=":kn,"<=":Tn,array:Gt,at:sn,boolean:Gt,case:fn,coalesce:tn,collator:ti,format:Zt,image:Wt,in:ln,"index-of":un,interpolate:Qi,"interpolate-hcl":Qi,"interpolate-lab":Qi,length:Sn,let:rn,literal:Vt,match:dn,number:Gt,"number-format":Cn,object:Gt,slice:_n,step:Ii,string:Gt,"to-boolean":Kt,"to-color":Kt,"to-number":Kt,"to-string":Kt,var:Ti,within:bi};function An(e,[t,i,n,r]){t=t.evaluate(e),i=i.evaluate(e),n=n.evaluate(e);const o=r?r.evaluate(e):1,s=Bt(t,i,n,o);if(s)throw new Nt(s);return new Pt(t/255*o,i/255*o,n/255*o,o)}function In(e,t){return e in t}function Pn(e,t){const i=t[e];return void 0===i?null:i}function Ln(e){return{type:e}}ei.register(Mn,{error:[{kind:"error"},[ut],(e,[t])=>{throw new Nt(t.evaluate(e))}],typeof:[ut,[ft],(e,[t])=>bt(Ft(t.evaluate(e)))],"to-rgba":[yt(ct,4),[dt],(e,[t])=>t.evaluate(e).toArray()],rgb:[dt,[ct,ct,ct],An],rgba:[dt,[ct,ct,ct,ct],An],has:{type:ht,overloads:[[[ut],(e,[t])=>In(t.evaluate(e),e.properties())],[[ut,pt],(e,[t,i])=>In(t.evaluate(e),i.evaluate(e))]]},get:{type:ft,overloads:[[[ut],(e,[t])=>Pn(t.evaluate(e),e.properties())],[[ut,pt],(e,[t,i])=>Pn(t.evaluate(e),i.evaluate(e))]]},"feature-state":[ft,[ut],(e,[t])=>Pn(t.evaluate(e),e.featureState||{})],properties:[pt,[],e=>e.properties()],"geometry-type":[ut,[],e=>e.geometryType()],id:[ft,[],e=>e.id()],zoom:[ct,[],e=>e.globals.zoom],pitch:[ct,[],e=>e.globals.pitch||0],"distance-from-center":[ct,[],e=>e.distanceFromCenter()],"heatmap-density":[ct,[],e=>e.globals.heatmapDensity||0],"line-progress":[ct,[],e=>e.globals.lineProgress||0],"sky-radial-progress":[ct,[],e=>e.globals.skyRadialProgress||0],accumulated:[ft,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[ct,Ln(ct),(e,t)=>{let i=0;for(const n of t)i+=n.evaluate(e);return i}],"*":[ct,Ln(ct),(e,t)=>{let i=1;for(const n of t)i*=n.evaluate(e);return i}],"-":{type:ct,overloads:[[[ct,ct],(e,[t,i])=>t.evaluate(e)-i.evaluate(e)],[[ct],(e,[t])=>-t.evaluate(e)]]},"/":[ct,[ct,ct],(e,[t,i])=>t.evaluate(e)/i.evaluate(e)],"%":[ct,[ct,ct],(e,[t,i])=>t.evaluate(e)%i.evaluate(e)],ln2:[ct,[],()=>Math.LN2],pi:[ct,[],()=>Math.PI],e:[ct,[],()=>Math.E],"^":[ct,[ct,ct],(e,[t,i])=>Math.pow(t.evaluate(e),i.evaluate(e))],sqrt:[ct,[ct],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[ct,[ct],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[ct,[ct],(e,[t])=>Math.log(t.evaluate(e))],log2:[ct,[ct],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[ct,[ct],(e,[t])=>Math.sin(t.evaluate(e))],cos:[ct,[ct],(e,[t])=>Math.cos(t.evaluate(e))],tan:[ct,[ct],(e,[t])=>Math.tan(t.evaluate(e))],asin:[ct,[ct],(e,[t])=>Math.asin(t.evaluate(e))],acos:[ct,[ct],(e,[t])=>Math.acos(t.evaluate(e))],atan:[ct,[ct],(e,[t])=>Math.atan(t.evaluate(e))],min:[ct,Ln(ct),(e,t)=>Math.min(...t.map((t=>t.evaluate(e))))],max:[ct,Ln(ct),(e,t)=>Math.max(...t.map((t=>t.evaluate(e))))],abs:[ct,[ct],(e,[t])=>Math.abs(t.evaluate(e))],round:[ct,[ct],(e,[t])=>{const i=t.evaluate(e);return i<0?-Math.round(-i):Math.round(i)}],floor:[ct,[ct],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[ct,[ct],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[ht,[ut,ft],(e,[t,i])=>e.properties()[t.value]===i.value],"filter-id-==":[ht,[ft],(e,[t])=>e.id()===t.value],"filter-type-==":[ht,[ut],(e,[t])=>e.geometryType()===t.value],"filter-<":[ht,[ut,ft],(e,[t,i])=>{const n=e.properties()[t.value],r=i.value;return typeof n==typeof r&&n{const i=e.id(),n=t.value;return typeof i==typeof n&&i":[ht,[ut,ft],(e,[t,i])=>{const n=e.properties()[t.value],r=i.value;return typeof n==typeof r&&n>r}],"filter-id->":[ht,[ft],(e,[t])=>{const i=e.id(),n=t.value;return typeof i==typeof n&&i>n}],"filter-<=":[ht,[ut,ft],(e,[t,i])=>{const n=e.properties()[t.value],r=i.value;return typeof n==typeof r&&n<=r}],"filter-id-<=":[ht,[ft],(e,[t])=>{const i=e.id(),n=t.value;return typeof i==typeof n&&i<=n}],"filter->=":[ht,[ut,ft],(e,[t,i])=>{const n=e.properties()[t.value],r=i.value;return typeof n==typeof r&&n>=r}],"filter-id->=":[ht,[ft],(e,[t])=>{const i=e.id(),n=t.value;return typeof i==typeof n&&i>=n}],"filter-has":[ht,[ft],(e,[t])=>t.value in e.properties()],"filter-has-id":[ht,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[ht,[yt(ut)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[ht,[yt(ft)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[ht,[ut,yt(ft)],(e,[t,i])=>i.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[ht,[ut,yt(ft)],(e,[t,i])=>function(e,t,i,n){for(;i<=n;){const r=i+n>>1;if(t[r]===e)return!0;t[r]>e?n=r-1:i=r+1}return!1}(e.properties()[t.value],i.value,0,i.value.length-1)],all:{type:ht,overloads:[[[ht,ht],(e,[t,i])=>t.evaluate(e)&&i.evaluate(e)],[Ln(ht),(e,t)=>{for(const i of t)if(!i.evaluate(e))return!1;return!0}]]},any:{type:ht,overloads:[[[ht,ht],(e,[t,i])=>t.evaluate(e)||i.evaluate(e)],[Ln(ht),(e,t)=>{for(const i of t)if(i.evaluate(e))return!0;return!1}]]},"!":[ht,[ht],(e,[t])=>!t.evaluate(e)],"is-supported-script":[ht,[ut],(e,[t])=>{const i=e.globals&&e.globals.isSupportedScript;return!i||i(t.evaluate(e))}],upcase:[ut,[ut],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[ut,[ut],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[ut,Ln(ft),(e,t)=>t.map((t=>Ut(t.evaluate(e)))).join("")],"resolved-locale":[ut,[mt],(e,[t])=>t.evaluate(e).resolvedLocale()]});var Dn=Mn;function zn(e){return{result:"success",value:e}}function On(e){return{result:"error",value:e}}function Bn(e){return"data-driven"===e["property-type"]}function Rn(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function Fn(e){return!!e.expression&&e.expression.interpolated}function Un(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}function jn(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function Vn(e){return e}function Nn(e,t){const i="color"===t.type,n=e.stops&&"object"==typeof e.stops[0][0],r=n||!(n||void 0!==e.property),o=e.type||(Fn(t)?"exponential":"interval");if(i&&((e=tt({},e)).stops&&(e.stops=e.stops.map((e=>[e[0],Pt.parse(e[1])]))),e.default=Pt.parse(e.default?e.default:t.default)),e.colorSpace&&"rgb"!==e.colorSpace&&!Ki[e.colorSpace])throw new Error(`Unknown color space: ${e.colorSpace}`);let s,a,l;if("exponential"===o)s=Zn;else if("interval"===o)s=Gn;else if("categorical"===o){s=qn,a=Object.create(null);for(const t of e.stops)a[t[0]]=t[1];l=typeof e.stops[0][0]}else{if("identity"!==o)throw new Error(`Unknown function type "${o}"`);s=Wn}if(n){const i={},n=[];for(let t=0;te[0])),evaluate:({zoom:i},n)=>Zn({stops:r,base:e.base},t,i).evaluate(i,n)}}if(r){const i="exponential"===o?{name:"exponential",base:void 0!==e.base?e.base:1}:null;return{kind:"camera",interpolationType:i,interpolationFactor:Qi.interpolationFactor.bind(void 0,i),zoomStops:e.stops.map((e=>e[0])),evaluate:({zoom:i})=>s(e,t,i,a,l)}}return{kind:"source",evaluate(i,n){const r=n&&n.properties?n.properties[e.property]:void 0;return void 0===r?$n(e.default,t.default):s(e,t,r,a,l)}}}function $n(e,t,i){return void 0!==e?e:void 0!==t?t:void 0!==i?i:void 0}function qn(e,t,i,n,r){return $n(typeof i===r?n[i]:void 0,e.default,t.default)}function Gn(e,t,i){if("number"!==Un(i))return $n(e.default,t.default);const n=e.stops.length;if(1===n)return e.stops[0][1];if(i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[n-1][0])return e.stops[n-1][1];const r=Mi(e.stops.map((e=>e[0])),i);return e.stops[r][1]}function Zn(e,t,i){const n=void 0!==e.base?e.base:1;if("number"!==Un(i))return $n(e.default,t.default);const r=e.stops.length;if(1===r)return e.stops[0][1];if(i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[r-1][0])return e.stops[r-1][1];const o=Mi(e.stops.map((e=>e[0])),i),s=function(e,t,i,n){const r=n-i,o=e-i;return 0===r?0:1===t?o/r:(Math.pow(t,o)-1)/(Math.pow(t,r)-1)}(i,n,e.stops[o][0],e.stops[o+1][0]),a=e.stops[o][1],l=e.stops[o+1][1];let c=Li[t.type]||Vn;if(e.colorSpace&&"rgb"!==e.colorSpace){const t=Ki[e.colorSpace];c=(e,i)=>t.reverse(t.interpolate(t.forward(e),t.forward(i),s))}return"function"==typeof a.evaluate?{evaluate(...e){const t=a.evaluate.apply(void 0,e),i=l.evaluate.apply(void 0,e);if(void 0!==t&&void 0!==i)return c(t,i,s)}}:c(a,l,s)}function Wn(e,t,i){return"color"===t.type?i=Pt.parse(i):"formatted"===t.type?i=zt.fromString(i.toString()):"resolvedImage"===t.type?i=Ot.fromString(i.toString()):Un(i)===t.type||"enum"===t.type&&t.values[i]||(i=void 0),$n(i,e.default,t.default)}class Hn{constructor(e,t){this.expression=e,this._warningHistory={},this._evaluator=new Yt,this._defaultValue=t?function(e){return"color"===e.type&&(jn(e.default)||Array.isArray(e.default))?new Pt(0,0,0,0):"color"===e.type?Pt.parse(e.default)||null:void 0===e.default?null:e.default}(t):null,this._enumValues=t&&"enum"===t.type?t.values:null}evaluateWithoutErrorHandling(e,t,i,n,r,o,s,a){return this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=i,this._evaluator.canonical=n||null,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=o,this._evaluator.featureTileCoord=s||null,this._evaluator.featureDistanceData=a||null,this.expression.evaluate(this._evaluator)}evaluate(e,t,i,n,r,o,s,a){this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=i||null,this._evaluator.canonical=n||null,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=o||null,this._evaluator.featureTileCoord=s||null,this._evaluator.featureDistanceData=a||null;try{const e=this.expression.evaluate(this._evaluator);if(null==e||"number"==typeof e&&e!=e)return this._defaultValue;if(this._enumValues&&!(e in this._enumValues))throw new Nt(`Expected value to be one of ${Object.keys(this._enumValues).map((e=>JSON.stringify(e))).join(", ")}, but found ${JSON.stringify(e)} instead.`);return e}catch(e){return this._warningHistory[e.message]||(this._warningHistory[e.message]=!0,"undefined"!=typeof console&&console.warn(e.message)),this._defaultValue}}}function Xn(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in Dn}function Kn(e,t){const i=new Ci(Dn,[],t?function(e){const t={color:dt,string:ut,number:ct,enum:ut,boolean:ht,formatted:_t,resolvedImage:gt};return"array"===e.type?yt(t[e.value]||ft,e.length):t[e.type]}(t):void 0),n=i.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return n?zn(new Hn(n,t)):On(i.errors)}class Jn{constructor(e,t){this.kind=e,this._styleExpression=t,this.isStateDependent="constant"!==e&&!xi(t.expression)}evaluateWithoutErrorHandling(e,t,i,n,r,o){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,n,r,o)}evaluate(e,t,i,n,r,o){return this._styleExpression.evaluate(e,t,i,n,r,o)}}class Yn{constructor(e,t,i,n){this.kind=e,this.zoomStops=i,this._styleExpression=t,this.isStateDependent="camera"!==e&&!xi(t.expression),this.interpolationType=n}evaluateWithoutErrorHandling(e,t,i,n,r,o){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,n,r,o)}evaluate(e,t,i,n,r,o){return this._styleExpression.evaluate(e,t,i,n,r,o)}interpolationFactor(e,t,i){return this.interpolationType?Qi.interpolationFactor(this.interpolationType,e,t,i):0}}function Qn(e,t){if("error"===(e=Kn(e,t)).result)return e;const i=e.value.expression,n=vi(i);if(!n&&!Bn(t))return On([new ot("","data expressions not supported")]);const r=wi(i,["zoom","pitch","distance-from-center"]);if(!r&&!Rn(t))return On([new ot("","zoom expressions not supported")]);const o=tr(i);return o||r?o instanceof ot?On([o]):o instanceof Qi&&!Fn(t)?On([new ot("",'"interpolate" expressions cannot be used with this property')]):zn(o?new Yn(n?"camera":"composite",e.value,o.labels,o instanceof Qi?o.interpolation:void 0):new Jn(n?"constant":"source",e.value)):On([new ot("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class er{constructor(e,t){this._parameters=e,this._specification=t,tt(this,Nn(this._parameters,this._specification))}static deserialize(e){return new er(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function tr(e){let t=null;if(e instanceof rn)t=tr(e.result);else if(e instanceof tn){for(const i of e.args)if(t=tr(i),t)break}else(e instanceof Ii||e instanceof Qi)&&e.input instanceof ei&&"zoom"===e.input.name&&(t=e);return t instanceof ot||e.eachChild((e=>{const i=tr(e);i instanceof ot?t=i:!t&&i?t=new ot("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&i&&t!==i&&(t=new ot("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),t}class ir{constructor(e,t,i,n){this.message=(e?`${e}: `:"")+i,n&&(this.identifier=n),null!=t&&t.__line__&&(this.line=t.__line__)}}function nr(e){const t=e.key,i=e.value,n=e.valueSpec||{},r=e.objectElementValidators||{},o=e.style,s=e.styleSpec;let a=[];const l=Un(i);if("object"!==l)return[new ir(t,i,`object expected, ${l} found`)];for(const e in i){const l=e.split(".")[0];let c;r[l]?c=r[l]:n[l]?c=Rr:r["*"]?c=r["*"]:n["*"]&&(c=Rr),c?a=a.concat(c({key:(t?`${t}.`:t)+e,value:i[e],valueSpec:n[l]||n["*"],style:o,styleSpec:s,object:i,objectKey:e},i)):a.push(new ir(t,i[e],`unknown property "${e}"`))}for(const e in n)r[e]||n[e].required&&void 0===n[e].default&&void 0===i[e]&&a.push(new ir(t,i,`missing required property "${e}"`));return a}function rr(e){const t=e.value,i=e.valueSpec,n=e.style,r=e.styleSpec,o=e.key,s=e.arrayElementValidator||Rr;if("array"!==Un(t))return[new ir(o,t,`array expected, ${Un(t)} found`)];if(i.length&&t.length!==i.length)return[new ir(o,t,`array length ${i.length} expected, length ${t.length} found`)];if(i["min-length"]&&t.lengthr)return[new ir(t,i,`${i} is greater than the maximum value ${r}`)]}return[]}function sr(e){const t=e.valueSpec,i=it(e.value.type);let n,r,o,s={};const a="categorical"!==i&&void 0===e.value.property,l=!a,c="array"===Un(e.value.stops)&&"array"===Un(e.value.stops[0])&&"object"===Un(e.value.stops[0][0]),u=nr({key:e.key,value:e.value,valueSpec:e.styleSpec.function,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:function(e){if("identity"===i)return[new ir(e.key,e.value,'identity function may not have a "stops" property')];let t=[];const n=e.value;return t=t.concat(rr({key:e.key,value:n,valueSpec:e.valueSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:h})),"array"===Un(n)&&0===n.length&&t.push(new ir(e.key,n,"array must have at least one stop")),t},default:function(e){return Rr({key:e.key,value:e.value,valueSpec:t,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===i&&a&&u.push(new ir(e.key,e.value,'missing required property "property"')),"identity"===i||e.value.stops||u.push(new ir(e.key,e.value,'missing required property "stops"')),"exponential"===i&&e.valueSpec.expression&&!Fn(e.valueSpec)&&u.push(new ir(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!Bn(e.valueSpec)?u.push(new ir(e.key,e.value,"property functions not supported")):a&&!Rn(e.valueSpec)&&u.push(new ir(e.key,e.value,"zoom functions not supported"))),"categorical"!==i&&!c||void 0!==e.value.property||u.push(new ir(e.key,e.value,'"property" property is required')),u;function h(e){let i=[];const n=e.value,a=e.key;if("array"!==Un(n))return[new ir(a,n,`array expected, ${Un(n)} found`)];if(2!==n.length)return[new ir(a,n,`array length 2 expected, length ${n.length} found`)];if(c){if("object"!==Un(n[0]))return[new ir(a,n,`object expected, ${Un(n[0])} found`)];if(void 0===n[0].zoom)return[new ir(a,n,"object stop key must have zoom")];if(void 0===n[0].value)return[new ir(a,n,"object stop key must have value")];const t=it(n[0].zoom);if("number"!=typeof t)return[new ir(a,n[0].zoom,"stop zoom values must be numbers")];if(o&&o>t)return[new ir(a,n[0].zoom,"stop zoom values must appear in ascending order")];t!==o&&(o=t,r=void 0,s={}),i=i.concat(nr({key:`${a}[0]`,value:n[0],valueSpec:{zoom:{}},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:or,value:d}}))}else i=i.concat(d({key:`${a}[0]`,value:n[0],valueSpec:{},style:e.style,styleSpec:e.styleSpec},n));return Xn(nt(n[1]))?i.concat([new ir(`${a}[1]`,n[1],"expressions are not allowed in function stops.")]):i.concat(Rr({key:`${a}[1]`,value:n[1],valueSpec:t,style:e.style,styleSpec:e.styleSpec}))}function d(e,o){const a=Un(e.value),l=it(e.value),c=null!==e.value?e.value:o;if(n){if(a!==n)return[new ir(e.key,c,`${a} stop domain type must match previous stop domain type ${n}`)]}else n=a;if("number"!==a&&"string"!==a&&"boolean"!==a&&"number"!=typeof l&&"string"!=typeof l&&"boolean"!=typeof l)return[new ir(e.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==a&&"categorical"!==i){let n=`number expected, ${a} found`;return Bn(t)&&void 0===i&&(n+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new ir(e.key,c,n)]}return"categorical"!==i||"number"!==a||"number"==typeof l&&isFinite(l)&&Math.floor(l)===l?"categorical"!==i&&"number"===a&&"number"==typeof l&&"number"==typeof r&&void 0!==r&&lnew ir(`${e.key}${t.key}`,e.value,t.message)));const i=t.value.expression||t.value._styleExpression.expression;if("property"===e.expressionContext&&"text-font"===e.propertyKey&&!i.outputDefined())return[new ir(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===e.expressionContext&&"layout"===e.propertyType&&!xi(i))return[new ir(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===e.expressionContext)return lr(i,e);if(e.expressionContext&&0===e.expressionContext.indexOf("cluster")){if(!wi(i,["zoom","feature-state"]))return[new ir(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===e.expressionContext&&!vi(i))return[new ir(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function lr(e,t){const i=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(t.valueSpec&&t.valueSpec.expression)for(const e of t.valueSpec.expression.parameters)i.delete(e);if(0===i.size)return[];const n=[];return e instanceof ei&&i.has(e.name)?[new ir(t.key,t.value,`["${e.name}"] expression is not supported in a filter for a ${t.object.type} layer with id: ${t.object.id}`)]:(e.eachChild((e=>{n.push(...lr(e,t))})),n)}function cr(e){const t=e.key,i=e.value,n=e.valueSpec,r=[];return Array.isArray(n.values)?-1===n.values.indexOf(it(i))&&r.push(new ir(t,i,`expected one of [${n.values.join(", ")}], ${JSON.stringify(i)} found`)):-1===Object.keys(n.values).indexOf(it(i))&&r.push(new ir(t,i,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(i)} found`)),r}function ur(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||0===e.length)return!1;switch(e[0]){case"has":return e.length>=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(const t of e.slice(1))if(!ur(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}}function hr(e,t="fill"){if(null==e)return{filter:()=>!0,needGeometry:!1,needFeature:!1};ur(e)||(e=yr(e));const i=e;let n=!0;try{n=function(e){if(!fr(e))return e;let t=nt(e);return pr(t),t=dr(t),t}(i)}catch(e){console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.\nThis is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md\nand paste the contents of this message in the report.\nThank you!\nFilter Expression:\n${JSON.stringify(i,null,2)}\n `)}const r=et[`filter_${t}`],o=Kn(n,r);let s=null;if("error"===o.result)throw new Error(o.value.map((e=>`${e.key}: ${e.message}`)).join(", "));s=(e,t,i)=>o.value.evaluate(e,t,{},i);let a=null,l=null;if(n!==i){const e=Kn(i,r);if("error"===e.result)throw new Error(e.value.map((e=>`${e.key}: ${e.message}`)).join(", "));a=(t,i,n,r,o)=>e.value.evaluate(t,i,{},n,void 0,void 0,r,o),l=!vi(e.value.expression)}return{filter:s,dynamicFilter:a||void 0,needGeometry:gr(n),needFeature:!!l}}function dr(e){if(!Array.isArray(e))return e;const t=function(e){if(mr.has(e[0]))for(let t=1;tdr(e)))}function pr(e){let t=!1;const i=[];if("case"===e[0]){for(let n=1;n",">=","<","<=","to-boolean"]);function _r(e,t){return et?1:0}function gr(e){if(!Array.isArray(e))return!1;if("within"===e[0])return!0;for(let t=1;t"===t||"<="===t||">="===t?br(e[1],e[2],t):"any"===t?(i=e.slice(1),["any"].concat(i.map(yr))):"all"===t?["all"].concat(e.slice(1).map(yr)):"none"===t?["all"].concat(e.slice(1).map(yr).map(wr)):"in"===t?vr(e[1],e.slice(2)):"!in"===t?wr(vr(e[1],e.slice(2))):"has"===t?xr(e[1]):"!has"===t?wr(xr(e[1])):"within"!==t||e;var i}function br(e,t,i){switch(e){case"$type":return[`filter-type-${i}`,t];case"$id":return[`filter-id-${i}`,t];default:return[`filter-${i}`,e,t]}}function vr(e,t){if(0===t.length)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some((e=>typeof e!=typeof t[0]))?["filter-in-large",e,["literal",t.sort(_r)]]:["filter-in-small",e,["literal",t]]}}function xr(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function wr(e){return["!",e]}function Er(e){return ur(nt(e.value))?ar(tt({},e,{expressionContext:"filter",valueSpec:e.styleSpec[`filter_${e.layerType||"fill"}`]})):Tr(e)}function Tr(e){const t=e.value,i=e.key;if("array"!==Un(t))return[new ir(i,t,`array expected, ${Un(t)} found`)];const n=e.styleSpec;let r,o=[];if(t.length<1)return[new ir(i,t,"filter array must have at least 1 element")];switch(o=o.concat(cr({key:`${i}[0]`,value:t[0],valueSpec:n.filter_operator,style:e.style,styleSpec:e.styleSpec})),it(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&"$type"===it(t[1])&&o.push(new ir(i,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":3!==t.length&&o.push(new ir(i,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(r=Un(t[1]),"string"!==r&&o.push(new ir(`${i}[1]`,t[1],`string expected, ${r} found`)));for(let s=2;s{e in i&&t.push(new ir(n,i[e],`"${e}" is prohibited for ref layers`))})),r.layers.forEach((t=>{it(t.id)===a&&(e=t)})),e?e.ref?t.push(new ir(n,i.ref,"ref cannot reference another ref layer")):s=it(e.type):"string"==typeof a&&t.push(new ir(n,i.ref,`ref layer "${a}" not found`))}else if("background"!==s&&"sky"!==s)if(i.source){const e=r.sources&&r.sources[i.source],o=e&&it(e.type);e?"vector"===o&&"raster"===s?t.push(new ir(n,i.source,`layer "${i.id}" requires a raster source`)):"raster"===o&&"raster"!==s?t.push(new ir(n,i.source,`layer "${i.id}" requires a vector source`)):"vector"!==o||i["source-layer"]?"raster-dem"===o&&"hillshade"!==s?t.push(new ir(n,i.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==s||!i.paint||!i.paint["line-gradient"]&&!i.paint["line-trim-offset"]||"geojson"===o&&e.lineMetrics||t.push(new ir(n,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new ir(n,i,`layer "${i.id}" must specify a "source-layer"`)):t.push(new ir(n,i.source,`source "${i.source}" not found`))}else t.push(new ir(n,i,'missing required property "source"'));return t=t.concat(nr({key:n,value:i,valueSpec:o.layer,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Rr({key:`${n}.type`,value:i.type,valueSpec:o.layer.type,style:e.style,styleSpec:e.styleSpec,object:i,objectKey:"type"}),filter:e=>Er(tt({layerType:s},e)),layout:e=>nr({layer:i,key:e.key,value:e.value,valueSpec:{},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":e=>Sr(tt({layerType:s},e))}}),paint:e=>nr({layer:i,key:e.key,value:e.value,valueSpec:{},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":e=>Cr(tt({layerType:s},e))}})}})),t}function Ar(e){const t=e.value,i=e.key,n=Un(t);return"string"!==n?[new ir(i,t,`string expected, ${n} found`)]:[]}const Ir={promoteId:function({key:e,value:t}){if("string"===Un(t))return Ar({key:e,value:t});{const i=[];for(const n in t)i.push(...Ar({key:`${e}.${n}`,value:t[n]}));return i}}};function Pr(e){const t=e.value,i=e.key,n=e.styleSpec,r=e.style;if(!t.type)return[new ir(i,t,'"type" is required')];const o=it(t.type);let s;switch(o){case"vector":case"raster":case"raster-dem":return s=nr({key:i,value:t,valueSpec:n[`source_${o.replace("-","_")}`],style:e.style,styleSpec:n,objectElementValidators:Ir}),s;case"geojson":if(s=nr({key:i,value:t,valueSpec:n.source_geojson,style:r,styleSpec:n,objectElementValidators:Ir}),t.cluster)for(const e in t.clusterProperties){const[n,r]=t.clusterProperties[e],o="string"==typeof n?[n,["accumulated"],["get",e]]:n;s.push(...ar({key:`${i}.${e}.map`,value:r,expressionContext:"cluster-map"})),s.push(...ar({key:`${i}.${e}.reduce`,value:o,expressionContext:"cluster-reduce"}))}return s;case"video":return nr({key:i,value:t,valueSpec:n.source_video,style:r,styleSpec:n});case"image":return nr({key:i,value:t,valueSpec:n.source_image,style:r,styleSpec:n});case"canvas":return[new ir(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return cr({key:`${i}.type`,value:t.type,valueSpec:{values:Lr(n)},style:r,styleSpec:n})}}function Lr(e){return e.source.reduce(((t,i)=>{const n=e[i];return"enum"===n.type.type&&(t=t.concat(Object.keys(n.type.values))),t}),[])}function Dr(e){const t=e.value,i=e.styleSpec,n=i.light,r=e.style;let o=[];const s=Un(t);if(void 0===t)return o;if("object"!==s)return o=o.concat([new ir("light",t,`object expected, ${s} found`)]),o;for(const e in t){const s=e.match(/^(.*)-transition$/);o=o.concat(s&&n[s[1]]&&n[s[1]].transition?Rr({key:e,value:t[e],valueSpec:i.transition,style:r,styleSpec:i}):n[e]?Rr({key:e,value:t[e],valueSpec:n[e],style:r,styleSpec:i}):[new ir(e,t[e],`unknown property "${e}"`)])}return o}function zr(e){const t=e.value,i=e.key,n=e.style,r=e.styleSpec,o=r.terrain;let s=[];const a=Un(t);if(void 0===t)return s;if("object"!==a)return s=s.concat([new ir("terrain",t,`object expected, ${a} found`)]),s;for(const e in t){const i=e.match(/^(.*)-transition$/);s=s.concat(i&&o[i[1]]&&o[i[1]].transition?Rr({key:e,value:t[e],valueSpec:r.transition,style:n,styleSpec:r}):o[e]?Rr({key:e,value:t[e],valueSpec:o[e],style:n,styleSpec:r}):[new ir(e,t[e],`unknown property "${e}"`)])}if(t.source){const e=n.sources&&n.sources[t.source],r=e&&it(e.type);e?"raster-dem"!==r&&s.push(new ir(i,t.source,`terrain cannot be used with a source of type ${String(r)}, it only be used with a "raster-dem" source type`)):s.push(new ir(i,t.source,`source "${t.source}" not found`))}else s.push(new ir(i,t,'terrain is missing required property "source"'));return s}function Or(e){const t=e.value,i=e.style,n=e.styleSpec,r=n.fog;let o=[];const s=Un(t);if(void 0===t)return o;if("object"!==s)return o=o.concat([new ir("fog",t,`object expected, ${s} found`)]),o;for(const e in t){const s=e.match(/^(.*)-transition$/);o=o.concat(s&&r[s[1]]&&r[s[1]].transition?Rr({key:e,value:t[e],valueSpec:n.transition,style:i,styleSpec:n}):r[e]?Rr({key:e,value:t[e],valueSpec:r[e],style:i,styleSpec:n}):[new ir(e,t[e],`unknown property "${e}"`)])}return o}const Br={"*":()=>[],array:rr,boolean:function(e){const t=e.value,i=e.key,n=Un(t);return"boolean"!==n?[new ir(i,t,`boolean expected, ${n} found`)]:[]},number:or,color:function(e){const t=e.key,i=e.value,n=Un(i);return"string"!==n?[new ir(t,i,`color expected, ${n} found`)]:null===Tt(i)?[new ir(t,i,`color expected, "${i}" found`)]:[]},enum:cr,filter:Er,function:sr,layer:Mr,object:nr,source:Pr,light:Dr,terrain:zr,fog:Or,string:Ar,formatted:function(e){return 0===Ar(e).length?[]:ar(e)},resolvedImage:function(e){return 0===Ar(e).length?[]:ar(e)},projection:function(e){const t=e.value,i=e.styleSpec,n=i.projection,r=e.style;let o=[];const s=Un(t);if("object"===s)for(const e in t)o=o.concat(Rr({key:e,value:t[e],valueSpec:n[e],style:r,styleSpec:i}));else"string"!==s&&(o=o.concat([new ir("projection",t,`object or string expected, ${s} found`)]));return o}};function Rr(e){const t=e.value,i=e.valueSpec,n=e.styleSpec;return i.expression&&jn(it(t))?sr(e):i.expression&&Xn(nt(t))?ar(e):i.type&&Br[i.type]?Br[i.type](e):nr(tt({},e,{valueSpec:i.type?n[i.type]:i}))}function Fr(e){const t=e.value,i=e.key,n=Ar(e);return n.length||(-1===t.indexOf("{fontstack}")&&n.push(new ir(i,t,'"glyphs" url must include a "{fontstack}" token')),-1===t.indexOf("{range}")&&n.push(new ir(i,t,'"glyphs" url must include a "{range}" token'))),n}function Ur(e,t=et){return Nr(Rr({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,objectElementValidators:{glyphs:Fr,"*":()=>[]}}))}const jr=e=>Nr(Cr(e)),Vr=e=>Nr(Sr(e));function Nr(e){return e.slice().sort(((e,t)=>e.line&&t.line?e.line-t.line:0))}function $r(e,t){let i=!1;if(t&&t.length)for(const n of t)e.fire(new Ye(new Error(n.message))),i=!0;return i}var qr=Zr,Gr=3;function Zr(e,t,i){var n=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;var r=new Int32Array(this.arrayBuffer);e=r[0],this.d=(t=r[1])+2*(i=r[2]);for(var o=0;o=u[p+0]&&n>=u[p+1])?(s[d]=!0,o.push(c[d])):s[d]=!1}}},Zr.prototype._forEachCell=function(e,t,i,n,r,o,s,a){for(var l=this._convertToCellCoord(e),c=this._convertToCellCoord(t),u=this._convertToCellCoord(i),h=this._convertToCellCoord(n),d=l;d<=u;d++)for(var p=c;p<=h;p++){var f=this.d*p+d;if((!a||a(this._convertFromCellCoord(d),this._convertFromCellCoord(p),this._convertFromCellCoord(d+1),this._convertFromCellCoord(p+1)))&&r.call(this,e,t,i,n,f,o,s,a))return}},Zr.prototype._convertFromCellCoord=function(e){return(e-this.padding)/this.scale},Zr.prototype._convertToCellCoord=function(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))},Zr.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var e=this.cells,t=Gr+this.cells.length+1+1,i=0,n=0;n=0||(r[t]=Yr(e[t],i)));e instanceof Error&&(r.message=e.message)}if(r.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==n&&(r.$name=n),r}throw new Error("can't serialize object of type "+typeof e)}function Qr(e){if(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||Kr(e)||Jr(e)||ArrayBuffer.isView(e)||e instanceof t.ImageData)return e;if(Array.isArray(e))return e.map(Qr);if("object"==typeof e){const t=e.$name||"Object",{klass:i}=Hr[t];if(!i)throw new Error(`can't deserialize unregistered class ${t}`);if(i.deserialize)return i.deserialize(e);const n=Object.create(i.prototype);for(const t of Object.keys(e))"$name"!==t&&(n[t]=Qr(e[t]));return n}throw new Error("can't deserialize object of type "+typeof e)}const eo={"Latin-1 Supplement":e=>e>=128&&e<=255,Arabic:e=>e>=1536&&e<=1791,"Arabic Supplement":e=>e>=1872&&e<=1919,"Arabic Extended-A":e=>e>=2208&&e<=2303,"Hangul Jamo":e=>e>=4352&&e<=4607,"Unified Canadian Aboriginal Syllabics":e=>e>=5120&&e<=5759,Khmer:e=>e>=6016&&e<=6143,"Unified Canadian Aboriginal Syllabics Extended":e=>e>=6320&&e<=6399,"General Punctuation":e=>e>=8192&&e<=8303,"Letterlike Symbols":e=>e>=8448&&e<=8527,"Number Forms":e=>e>=8528&&e<=8591,"Miscellaneous Technical":e=>e>=8960&&e<=9215,"Control Pictures":e=>e>=9216&&e<=9279,"Optical Character Recognition":e=>e>=9280&&e<=9311,"Enclosed Alphanumerics":e=>e>=9312&&e<=9471,"Geometric Shapes":e=>e>=9632&&e<=9727,"Miscellaneous Symbols":e=>e>=9728&&e<=9983,"Miscellaneous Symbols and Arrows":e=>e>=11008&&e<=11263,"CJK Radicals Supplement":e=>e>=11904&&e<=12031,"Kangxi Radicals":e=>e>=12032&&e<=12255,"Ideographic Description Characters":e=>e>=12272&&e<=12287,"CJK Symbols and Punctuation":e=>e>=12288&&e<=12351,Hiragana:e=>e>=12352&&e<=12447,Katakana:e=>e>=12448&&e<=12543,Bopomofo:e=>e>=12544&&e<=12591,"Hangul Compatibility Jamo":e=>e>=12592&&e<=12687,Kanbun:e=>e>=12688&&e<=12703,"Bopomofo Extended":e=>e>=12704&&e<=12735,"CJK Strokes":e=>e>=12736&&e<=12783,"Katakana Phonetic Extensions":e=>e>=12784&&e<=12799,"Enclosed CJK Letters and Months":e=>e>=12800&&e<=13055,"CJK Compatibility":e=>e>=13056&&e<=13311,"CJK Unified Ideographs Extension A":e=>e>=13312&&e<=19903,"Yijing Hexagram Symbols":e=>e>=19904&&e<=19967,"CJK Unified Ideographs":e=>e>=19968&&e<=40959,"Yi Syllables":e=>e>=40960&&e<=42127,"Yi Radicals":e=>e>=42128&&e<=42191,"Hangul Jamo Extended-A":e=>e>=43360&&e<=43391,"Hangul Syllables":e=>e>=44032&&e<=55215,"Hangul Jamo Extended-B":e=>e>=55216&&e<=55295,"Private Use Area":e=>e>=57344&&e<=63743,"CJK Compatibility Ideographs":e=>e>=63744&&e<=64255,"Arabic Presentation Forms-A":e=>e>=64336&&e<=65023,"Vertical Forms":e=>e>=65040&&e<=65055,"CJK Compatibility Forms":e=>e>=65072&&e<=65103,"Small Form Variants":e=>e>=65104&&e<=65135,"Arabic Presentation Forms-B":e=>e>=65136&&e<=65279,"Halfwidth and Fullwidth Forms":e=>e>=65280&&e<=65519};function to(e){for(const t of e)if(ro(t.charCodeAt(0)))return!0;return!1}function io(e){for(const t of e)if(!no(t.charCodeAt(0)))return!1;return!0}function no(e){return!(eo.Arabic(e)||eo["Arabic Supplement"](e)||eo["Arabic Extended-A"](e)||eo["Arabic Presentation Forms-A"](e)||eo["Arabic Presentation Forms-B"](e))}function ro(e){return!(746!==e&&747!==e&&(e<4352||!(eo["Bopomofo Extended"](e)||eo.Bopomofo(e)||eo["CJK Compatibility Forms"](e)&&!(e>=65097&&e<=65103)||eo["CJK Compatibility Ideographs"](e)||eo["CJK Compatibility"](e)||eo["CJK Radicals Supplement"](e)||eo["CJK Strokes"](e)||!(!eo["CJK Symbols and Punctuation"](e)||e>=12296&&e<=12305||e>=12308&&e<=12319||12336===e)||eo["CJK Unified Ideographs Extension A"](e)||eo["CJK Unified Ideographs"](e)||eo["Enclosed CJK Letters and Months"](e)||eo["Hangul Compatibility Jamo"](e)||eo["Hangul Jamo Extended-A"](e)||eo["Hangul Jamo Extended-B"](e)||eo["Hangul Jamo"](e)||eo["Hangul Syllables"](e)||eo.Hiragana(e)||eo["Ideographic Description Characters"](e)||eo.Kanbun(e)||eo["Kangxi Radicals"](e)||eo["Katakana Phonetic Extensions"](e)||eo.Katakana(e)&&12540!==e||!(!eo["Halfwidth and Fullwidth Forms"](e)||65288===e||65289===e||65293===e||e>=65306&&e<=65310||65339===e||65341===e||65343===e||e>=65371&&e<=65503||65507===e||e>=65512&&e<=65519)||!(!eo["Small Form Variants"](e)||e>=65112&&e<=65118||e>=65123&&e<=65126)||eo["Unified Canadian Aboriginal Syllabics"](e)||eo["Unified Canadian Aboriginal Syllabics Extended"](e)||eo["Vertical Forms"](e)||eo["Yijing Hexagram Symbols"](e)||eo["Yi Syllables"](e)||eo["Yi Radicals"](e))))}function oo(e){return!(ro(e)||function(e){return!!(eo["Latin-1 Supplement"](e)&&(167===e||169===e||174===e||177===e||188===e||189===e||190===e||215===e||247===e)||eo["General Punctuation"](e)&&(8214===e||8224===e||8225===e||8240===e||8241===e||8251===e||8252===e||8258===e||8263===e||8264===e||8265===e||8273===e)||eo["Letterlike Symbols"](e)||eo["Number Forms"](e)||eo["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||9003===e||e>=9085&&e<=9114||e>=9150&&e<=9165||9167===e||e>=9169&&e<=9179||e>=9186&&e<=9215)||eo["Control Pictures"](e)&&9251!==e||eo["Optical Character Recognition"](e)||eo["Enclosed Alphanumerics"](e)||eo["Geometric Shapes"](e)||eo["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||eo["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||eo["CJK Symbols and Punctuation"](e)||eo.Katakana(e)||eo["Private Use Area"](e)||eo["CJK Compatibility Forms"](e)||eo["Small Form Variants"](e)||eo["Halfwidth and Fullwidth Forms"](e)||8734===e||8756===e||8757===e||e>=9984&&e<=10087||e>=10102&&e<=10131||65532===e||65533===e)}(e))}function so(e){return e>=1424&&e<=2303||eo["Arabic Presentation Forms-A"](e)||eo["Arabic Presentation Forms-B"](e)}function ao(e,t){return!(!t&&so(e)||e>=2304&&e<=3583||e>=3840&&e<=4255||eo.Khmer(e))}function lo(e){for(const t of e)if(so(t.charCodeAt(0)))return!0;return!1}const co="deferred",uo="loading",ho="loaded";let po=null,fo="unavailable",mo=null;const _o=function(e){e&&"string"==typeof e&&e.indexOf("NetworkError")>-1&&(fo="error"),po&&po(e)};function go(){yo.fire(new Je("pluginStateChange",{pluginStatus:fo,pluginURL:mo}))}const yo=new Qe,bo=function(){return fo},vo=function(){if(fo!==co||!mo)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");fo=uo,go(),mo&&de({url:mo},(e=>{e?_o(e):(fo=ho,go())}))},xo={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>fo===ho||null!=xo.applyArabicShaping,isLoading:()=>fo===uo,setState(e){fo=e.pluginStatus,mo=e.pluginURL},isParsed:()=>null!=xo.applyArabicShaping&&null!=xo.processBidirectionalText&&null!=xo.processStyledBidirectionalText,getPluginURL:()=>mo};class wo{constructor(e,t){this.zoom=e,t?(this.now=t.now,this.fadeDuration=t.fadeDuration,this.transition=t.transition,this.pitch=t.pitch):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0)}isSupportedScript(e){return function(e,t){for(const i of e)if(!ao(i.charCodeAt(0),t))return!1;return!0}(e,xo.isLoaded())}}class Eo{constructor(e,t){this.property=e,this.value=t,this.expression=function(e,t){if(jn(e))return new er(e,t);if(Xn(e)){const i=Qn(e,t);if("error"===i.result)throw new Error(i.value.map((e=>`${e.key}: ${e.message}`)).join(", "));return i.value}{let i=e;return"string"==typeof e&&"color"===t.type&&(i=Pt.parse(e)),{kind:"constant",evaluate:()=>i}}}(void 0===t?e.specification.default:t,e.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(e,t,i){return this.property.possiblyEvaluate(this,e,t,i)}}class To{constructor(e){this.property=e,this.value=new Eo(e,void 0)}transitioned(e,t){return new Co(this.property,this.value,t,L({},e.transition,this.transition),e.now)}untransitioned(){return new Co(this.property,this.value,null,{},0)}}class ko{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return N(this._values[e].value.value)}setValue(e,t){this._values.hasOwnProperty(e)||(this._values[e]=new To(this._values[e].property)),this._values[e].value=new Eo(this._values[e].property,null===t?void 0:N(t))}getTransition(e){return N(this._values[e].transition)}setTransition(e,t){this._values.hasOwnProperty(e)||(this._values[e]=new To(this._values[e].property)),this._values[e].transition=N(t)||void 0}serialize(){const e={};for(const t of Object.keys(this._values)){const i=this.getValue(t);void 0!==i&&(e[t]=i);const n=this.getTransition(t);void 0!==n&&(e[`${t}-transition`]=n)}return e}transitioned(e,t){const i=new So(this._properties);for(const n of Object.keys(this._values))i._values[n]=this._values[n].transitioned(e,t._values[n]);return i}untransitioned(){const e=new So(this._properties);for(const t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}}class Co{constructor(e,t,i,n,r){const o=n.delay||0,s=n.duration||0;r=r||0,this.property=e,this.value=t,this.begin=r+o,this.end=this.begin+s,e.specification.transition&&(n.delay||n.duration)&&(this.prior=i)}possiblyEvaluate(e,t,i){const n=e.now||0,r=this.value.possiblyEvaluate(e,t,i),o=this.prior;if(o){if(n>this.end)return this.prior=null,r;if(this.value.isDataDriven())return this.prior=null,r;if(nthis.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}}_refreshViews(){throw new Error("_refreshViews() 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 Uo(e,t=1){let i=0,n=0;return{members:e.map((e=>{const r=Bo[e.type].BYTES_PER_ELEMENT,o=i=jo(i,Math.max(t,r)),s=e.components||1;return n=Math.max(n,r),i+=r*s,{name:e.name,type:e.type,components:s,offset:o}})),size:jo(i,Math.max(n,t)),alignment:t}}function jo(e,t){return Math.ceil(e/t)*t}class Vo extends Fo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const n=2*e;return this.int16[n+0]=t,this.int16[n+1]=i,e}}Vo.prototype.bytesPerElement=4,Xr(Vo,"StructArrayLayout2i4");class No extends Fo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i)}emplace(e,t,i,n){const r=3*e;return this.int16[r+0]=t,this.int16[r+1]=i,this.int16[r+2]=n,e}}No.prototype.bytesPerElement=6,Xr(No,"StructArrayLayout3i6");class $o extends Fo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,n){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i,n)}emplace(e,t,i,n,r){const o=4*e;return this.int16[o+0]=t,this.int16[o+1]=i,this.int16[o+2]=n,this.int16[o+3]=r,e}}$o.prototype.bytesPerElement=8,Xr($o,"StructArrayLayout4i8");class qo extends Fo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,o,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,n,r,o,s)}emplace(e,t,i,n,r,o,s,a){const l=6*e,c=12*e,u=3*e;return this.int16[l+0]=t,this.int16[l+1]=i,this.uint8[c+4]=n,this.uint8[c+5]=r,this.uint8[c+6]=o,this.uint8[c+7]=s,this.float32[u+2]=a,e}}qo.prototype.bytesPerElement=12,Xr(qo,"StructArrayLayout2i4ub1f12");class Go extends Fo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i,n)}emplace(e,t,i,n,r){const o=4*e;return this.float32[o+0]=t,this.float32[o+1]=i,this.float32[o+2]=n,this.float32[o+3]=r,e}}Go.prototype.bytesPerElement=16,Xr(Go,"StructArrayLayout4f16");class Zo extends Fo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,n,r)}emplace(e,t,i,n,r,o){const s=6*e,a=3*e;return this.uint16[s+0]=t,this.uint16[s+1]=i,this.uint16[s+2]=n,this.uint16[s+3]=r,this.float32[a+2]=o,e}}Zo.prototype.bytesPerElement=12,Xr(Zo,"StructArrayLayout4ui1f12");class Wo extends Fo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,n){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i,n)}emplace(e,t,i,n,r){const o=4*e;return this.uint16[o+0]=t,this.uint16[o+1]=i,this.uint16[o+2]=n,this.uint16[o+3]=r,e}}Wo.prototype.bytesPerElement=8,Xr(Wo,"StructArrayLayout4ui8");class Ho extends Fo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,o){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,n,r,o)}emplace(e,t,i,n,r,o,s){const a=6*e;return this.int16[a+0]=t,this.int16[a+1]=i,this.int16[a+2]=n,this.int16[a+3]=r,this.int16[a+4]=o,this.int16[a+5]=s,e}}Ho.prototype.bytesPerElement=12,Xr(Ho,"StructArrayLayout6i12");class Xo extends Fo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,o,s,a,l,c,u,h){const d=this.length;return this.resize(d+1),this.emplace(d,e,t,i,n,r,o,s,a,l,c,u,h)}emplace(e,t,i,n,r,o,s,a,l,c,u,h,d){const p=12*e;return this.int16[p+0]=t,this.int16[p+1]=i,this.int16[p+2]=n,this.int16[p+3]=r,this.uint16[p+4]=o,this.uint16[p+5]=s,this.uint16[p+6]=a,this.uint16[p+7]=l,this.int16[p+8]=c,this.int16[p+9]=u,this.int16[p+10]=h,this.int16[p+11]=d,e}}Xo.prototype.bytesPerElement=24,Xr(Xo,"StructArrayLayout4i4ui4i24");class Ko extends Fo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,o){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,n,r,o)}emplace(e,t,i,n,r,o,s){const a=10*e,l=5*e;return this.int16[a+0]=t,this.int16[a+1]=i,this.int16[a+2]=n,this.float32[l+2]=r,this.float32[l+3]=o,this.float32[l+4]=s,e}}Ko.prototype.bytesPerElement=20,Xr(Ko,"StructArrayLayout3i3f20");class Jo extends Fo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint32[1*e+0]=t,e}}Jo.prototype.bytesPerElement=4,Xr(Jo,"StructArrayLayout1ul4");class Yo extends Fo{_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,t,i,n,r,o,s,a,l,c,u,h,d){const p=this.length;return this.resize(p+1),this.emplace(p,e,t,i,n,r,o,s,a,l,c,u,h,d)}emplace(e,t,i,n,r,o,s,a,l,c,u,h,d,p){const f=20*e,m=10*e;return this.int16[f+0]=t,this.int16[f+1]=i,this.int16[f+2]=n,this.int16[f+3]=r,this.int16[f+4]=o,this.float32[m+3]=s,this.float32[m+4]=a,this.float32[m+5]=l,this.float32[m+6]=c,this.int16[f+14]=u,this.uint32[m+8]=h,this.uint16[f+18]=d,this.uint16[f+19]=p,e}}Yo.prototype.bytesPerElement=40,Xr(Yo,"StructArrayLayout5i4f1i1ul2ui40");class Qo extends Fo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r,o,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,n,r,o,s)}emplace(e,t,i,n,r,o,s,a){const l=8*e;return this.int16[l+0]=t,this.int16[l+1]=i,this.int16[l+2]=n,this.int16[l+4]=r,this.int16[l+5]=o,this.int16[l+6]=s,this.int16[l+7]=a,e}}Qo.prototype.bytesPerElement=16,Xr(Qo,"StructArrayLayout3i2i2i16");class es extends Fo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,n,r)}emplace(e,t,i,n,r,o){const s=4*e,a=8*e;return this.float32[s+0]=t,this.float32[s+1]=i,this.float32[s+2]=n,this.int16[a+6]=r,this.int16[a+7]=o,e}}es.prototype.bytesPerElement=16,Xr(es,"StructArrayLayout2f1f2i16");class ts extends Fo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i,n)}emplace(e,t,i,n,r){const o=12*e,s=3*e;return this.uint8[o+0]=t,this.uint8[o+1]=i,this.float32[s+1]=n,this.float32[s+2]=r,e}}ts.prototype.bytesPerElement=12,Xr(ts,"StructArrayLayout2ub2f12");class is extends Fo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i)}emplace(e,t,i,n){const r=3*e;return this.float32[r+0]=t,this.float32[r+1]=i,this.float32[r+2]=n,e}}is.prototype.bytesPerElement=12,Xr(is,"StructArrayLayout3f12");class ns extends Fo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i)}emplace(e,t,i,n){const r=3*e;return this.uint16[r+0]=t,this.uint16[r+1]=i,this.uint16[r+2]=n,e}}ns.prototype.bytesPerElement=6,Xr(ns,"StructArrayLayout3ui6");class rs extends Fo{_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,t,i,n,r,o,s,a,l,c,u,h,d,p,f,m,_,g,y,b,v){const x=this.length;return this.resize(x+1),this.emplace(x,e,t,i,n,r,o,s,a,l,c,u,h,d,p,f,m,_,g,y,b,v)}emplace(e,t,i,n,r,o,s,a,l,c,u,h,d,p,f,m,_,g,y,b,v,x){const w=30*e,E=15*e,T=60*e;return this.int16[w+0]=t,this.int16[w+1]=i,this.int16[w+2]=n,this.float32[E+2]=r,this.float32[E+3]=o,this.uint16[w+8]=s,this.uint16[w+9]=a,this.uint32[E+5]=l,this.uint32[E+6]=c,this.uint32[E+7]=u,this.uint16[w+16]=h,this.uint16[w+17]=d,this.uint16[w+18]=p,this.float32[E+10]=f,this.float32[E+11]=m,this.uint8[T+48]=_,this.uint8[T+49]=g,this.uint8[T+50]=y,this.uint32[E+13]=b,this.int16[w+28]=v,this.uint8[T+58]=x,e}}rs.prototype.bytesPerElement=60,Xr(rs,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class os extends Fo{_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,t,i,n,r,o,s,a,l,c,u,h,d,p,f,m,_,g,y,b,v,x,w,E,T,k,C,S,M,A){const I=this.length;return this.resize(I+1),this.emplace(I,e,t,i,n,r,o,s,a,l,c,u,h,d,p,f,m,_,g,y,b,v,x,w,E,T,k,C,S,M,A)}emplace(e,t,i,n,r,o,s,a,l,c,u,h,d,p,f,m,_,g,y,b,v,x,w,E,T,k,C,S,M,A,I){const P=38*e,L=19*e;return this.int16[P+0]=t,this.int16[P+1]=i,this.int16[P+2]=n,this.float32[L+2]=r,this.float32[L+3]=o,this.int16[P+8]=s,this.int16[P+9]=a,this.int16[P+10]=l,this.int16[P+11]=c,this.int16[P+12]=u,this.int16[P+13]=h,this.uint16[P+14]=d,this.uint16[P+15]=p,this.uint16[P+16]=f,this.uint16[P+17]=m,this.uint16[P+18]=_,this.uint16[P+19]=g,this.uint16[P+20]=y,this.uint16[P+21]=b,this.uint16[P+22]=v,this.uint16[P+23]=x,this.uint16[P+24]=w,this.uint16[P+25]=E,this.uint16[P+26]=T,this.uint16[P+27]=k,this.uint16[P+28]=C,this.uint32[L+15]=S,this.float32[L+16]=M,this.float32[L+17]=A,this.float32[L+18]=I,e}}os.prototype.bytesPerElement=76,Xr(os,"StructArrayLayout3i2f6i15ui1ul3f76");class ss extends Fo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.float32[1*e+0]=t,e}}ss.prototype.bytesPerElement=4,Xr(ss,"StructArrayLayout1f4");class as extends Fo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n,r){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,n,r)}emplace(e,t,i,n,r,o){const s=5*e;return this.float32[s+0]=t,this.float32[s+1]=i,this.float32[s+2]=n,this.float32[s+3]=r,this.float32[s+4]=o,e}}as.prototype.bytesPerElement=20,Xr(as,"StructArrayLayout5f20");class ls extends Fo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,n){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i,n)}emplace(e,t,i,n,r){const o=6*e;return this.uint32[3*e+0]=t,this.uint16[o+2]=i,this.uint16[o+3]=n,this.uint16[o+4]=r,e}}ls.prototype.bytesPerElement=12,Xr(ls,"StructArrayLayout1ul3ui12");class cs extends Fo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const n=2*e;return this.uint16[n+0]=t,this.uint16[n+1]=i,e}}cs.prototype.bytesPerElement=4,Xr(cs,"StructArrayLayout2ui4");class us extends Fo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint16[1*e+0]=t,e}}us.prototype.bytesPerElement=2,Xr(us,"StructArrayLayout1ui2");class hs extends Fo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const n=2*e;return this.float32[n+0]=t,this.float32[n+1]=i,e}}hs.prototype.bytesPerElement=8,Xr(hs,"StructArrayLayout2f8");class ds extends Ro{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]}}ds.prototype.size=40;class ps extends Yo{get(e){return new ds(this,e)}}Xr(ps,"CollisionBoxArray");class fs extends Ro{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}}fs.prototype.size=60;class ms extends rs{get(e){return new fs(this,e)}}Xr(ms,"PlacedSymbolArray");class _s extends Ro{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 rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+11]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+13]}get key(){return this._structArray.uint16[this._pos2+14]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+17]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+19]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+21]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+22]}get featureIndex(){return this._structArray.uint16[this._pos2+23]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+25]}get numIconVertices(){return this._structArray.uint16[this._pos2+26]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+27]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+28]}get crossTileID(){return this._structArray.uint32[this._pos4+15]}set crossTileID(e){this._structArray.uint32[this._pos4+15]=e}get textOffset0(){return this._structArray.float32[this._pos4+16]}get textOffset1(){return this._structArray.float32[this._pos4+17]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+18]}}_s.prototype.size=76;class gs extends os{get(e){return new _s(this,e)}}Xr(gs,"SymbolInstanceArray");class ys extends ss{getoffsetX(e){return this.float32[1*e+0]}}Xr(ys,"GlyphOffsetArray");class bs extends Vo{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}Xr(bs,"SymbolLineVertexArray");class vs extends Ro{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]}}vs.prototype.size=12;class xs extends ls{get(e){return new vs(this,e)}}Xr(xs,"FeatureIndexArray");class ws extends cs{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}Xr(ws,"FillExtrusionCentroidArray");const Es=Uo([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),Ts=Uo([{name:"a_dash",components:4,type:"Uint16"}]);var ks={exports:{}},Cs=function(e,t){var i,n,r,o,s,a,l,c;for(n=e.length-(i=3&e.length),r=t,s=3432918353,a=461845907,c=0;c>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<13|r>>>19))+((5*(r>>>16)&65535)<<16)&4294967295))+((58964+(o>>>16)&65535)<<16);switch(l=0,i){case 3:l^=(255&e.charCodeAt(c+2))<<16;case 2:l^=(255&e.charCodeAt(c+1))<<8;case 1:r^=l=(65535&(l=(l=(65535&(l^=255&e.charCodeAt(c)))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295}return r^=e.length,r=2246822507*(65535&(r^=r>>>16))+((2246822507*(r>>>16)&65535)<<16)&4294967295,r=3266489909*(65535&(r^=r>>>13))+((3266489909*(r>>>16)&65535)<<16)&4294967295,(r^=r>>>16)>>>0},Ss=function(e,t){for(var i,n=e.length,r=t^n,o=0;n>=4;)i=1540483477*(65535&(i=255&e.charCodeAt(o)|(255&e.charCodeAt(++o))<<8|(255&e.charCodeAt(++o))<<16|(255&e.charCodeAt(++o))<<24))+((1540483477*(i>>>16)&65535)<<16),r=1540483477*(65535&r)+((1540483477*(r>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),n-=4,++o;switch(n){case 3:r^=(255&e.charCodeAt(o+2))<<16;case 2:r^=(255&e.charCodeAt(o+1))<<8;case 1:r=1540483477*(65535&(r^=255&e.charCodeAt(o)))+((1540483477*(r>>>16)&65535)<<16)}return r=1540483477*(65535&(r^=r>>>13))+((1540483477*(r>>>16)&65535)<<16),(r^=r>>>15)>>>0};ks.exports=Cs,ks.exports.murmur3=Cs,ks.exports.murmur2=Ss;var Ms=d(ks.exports);class As{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,t,i,n){this.ids.push(Is(e)),this.positions.push(t,i,n)}getPositions(e){const t=Is(e);let i=0,n=this.ids.length-1;for(;i>1;this.ids[e]>=t?n=e:i=e+1}const r=[];for(;this.ids[i]===t;)r.push({index:this.positions[3*i],start:this.positions[3*i+1],end:this.positions[3*i+2]}),i++;return r}static serialize(e,t){const i=new Float64Array(e.ids),n=new Uint32Array(e.positions);return Ps(i,n,0,i.length-1),t&&t.push(i.buffer,n.buffer),{ids:i,positions:n}}static deserialize(e){const t=new As;return t.ids=e.ids,t.positions=e.positions,t.indexed=!0,t}}function Is(e){const t=+e;return!isNaN(t)&&Number.MIN_SAFE_INTEGER<=t&&t<=Number.MAX_SAFE_INTEGER?t:Ms(String(e))}function Ps(e,t,i,n){for(;i>1];let o=i-1,s=n+1;for(;;){do{o++}while(e[o]r);if(o>=s)break;Ls(e,o,s),Ls(t,3*o,3*s),Ls(t,3*o+1,3*s+1),Ls(t,3*o+2,3*s+2)}s-i`u_${e}`)),this.type=i}setUniform(e,t,i,n,r){t.set(e,r,n.constantOr(this.value))}getBinding(e,t){return"color"===this.type?new Bs(e):new zs(e)}}class Ns{constructor(e,t){this.uniformNames=t.map((e=>`u_${e}`)),this.pattern=null,this.pixelRatio=1}setConstantPatternPositions(e){this.pixelRatio=e.pixelRatio||1,this.pattern=e.tl.concat(e.br)}setUniform(e,t,i,n,r){const o="u_pattern"===r||"u_dash"===r?this.pattern:"u_pixel_ratio"===r?this.pixelRatio:null;o&&t.set(e,r,o)}getBinding(e,t){return"u_pattern"===t||"u_dash"===t?new Os(e):new zs(e)}}class $s{constructor(e,t,i,n){this.expression=e,this.type=i,this.maxValue=0,this.paintVertexAttributes=t.map((e=>({name:`a_${e}`,type:"Float32",components:"color"===i?2:1,offset:0}))),this.paintVertexArray=new n}populatePaintArray(e,t,i,n,r,o){const s=this.paintVertexArray.length,a=this.expression.evaluate(new wo(0),t,{},r,n,o);this.paintVertexArray.resize(e),this._setPaintValue(s,e,a)}updatePaintArray(e,t,i,n,r){const o=this.expression.evaluate({zoom:0},i,n,void 0,r);this._setPaintValue(e,t,o)}_setPaintValue(e,t,i){if("color"===this.type){const n=js(i);for(let i=e;i`u_${e}_t`)),this.type=i,this.useIntegerZoom=n,this.zoom=r,this.maxValue=0,this.paintVertexAttributes=t.map((e=>({name:`a_${e}`,type:"Float32",components:"color"===i?4:2,offset:0}))),this.paintVertexArray=new o}populatePaintArray(e,t,i,n,r,o){const s=this.expression.evaluate(new wo(this.zoom),t,{},r,n,o),a=this.expression.evaluate(new wo(this.zoom+1),t,{},r,n,o),l=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(l,e,s,a)}updatePaintArray(e,t,i,n,r){const o=this.expression.evaluate({zoom:this.zoom},i,n,void 0,r),s=this.expression.evaluate({zoom:this.zoom+1},i,n,void 0,r);this._setPaintValue(e,t,o,s)}_setPaintValue(e,t,i,n){if("color"===this.type){const r=js(i),o=js(n);for(let i=e;i!0)){this.binders={},this._buffers=[];const n=[];for(const r in e.paint._values){if(!i(r))continue;const o=e.paint.get(r);if(!(o instanceof Ao&&Bn(o.property.specification)))continue;const s=Xs(r,e.type),a=o.value,l=o.property.specification.type,c=!!o.property.useIntegerZoom,u="line-dasharray"===r||r.endsWith("pattern"),h="line-dasharray"===r&&"constant"!==e.layout.get("line-cap").value.kind;if("constant"!==a.kind||h)if("source"===a.kind||h||u){const t=Ys(r,l,"source");this.binders[r]=u?new Gs(a,s,l,t,e.id):new $s(a,s,l,t),n.push(`/a_${r}`)}else{const e=Ys(r,l,"composite");this.binders[r]=new qs(a,s,l,c,t,e),n.push(`/z_${r}`)}else this.binders[r]=u?new Ns(a.value,s):new Vs(a.value,s,l),n.push(`/u_${r}`)}this.cacheKey=n.sort().join("")}getMaxValue(e){const t=this.binders[e];return t instanceof $s||t instanceof qs?t.maxValue:0}populatePaintArrays(e,t,i,n,r,o){for(const s in this.binders){const a=this.binders[s];(a instanceof $s||a instanceof qs||a instanceof Gs)&&a.populatePaintArray(e,t,i,n,r,o)}}setConstantPatternPositions(e){for(const t in this.binders){const i=this.binders[t];i instanceof Ns&&i.setConstantPatternPositions(e)}}updatePaintArrays(e,t,i,n,r,o){let s=!1;for(const a in e){const l=t.getPositions(a);for(const t of l){const l=i.feature(t.index);for(const i in this.binders){const c=this.binders[i];if((c instanceof $s||c instanceof qs||c instanceof Gs)&&!0===c.expression.isStateDependent){const u=n.paint.get(i);c.expression=u.value,c.updatePaintArray(t.start,t.end,l,e[a],r,o),s=!0}}}}return s}defines(){const e=[];for(const t in this.binders){const i=this.binders[t];(i instanceof Vs||i instanceof Ns)&&e.push(...i.uniformNames.map((e=>`#define HAS_UNIFORM_${e}`)))}return e}getBinderAttributes(){const e=[];for(const t in this.binders){const i=this.binders[t];if(i instanceof $s||i instanceof qs||i instanceof Gs)for(let t=0;t!0)){this.programConfigurations={};for(const n of e)this.programConfigurations[n.id]=new Zs(n,t,i);this.needsUpload=!1,this._featureMap=new As,this._bufferOffset=0}populatePaintArrays(e,t,i,n,r,o,s){for(const i in this.programConfigurations)this.programConfigurations[i].populatePaintArrays(e,t,n,r,o,s);void 0!==t.id&&this._featureMap.add(t.id,i,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,i,n,r){for(const o of i)this.needsUpload=this.programConfigurations[o.id].updatePaintArrays(e,this._featureMap,t,o,n,r)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}const Hs={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern","pixel_ratio"],"fill-pattern":["pattern","pixel_ratio"],"fill-extrusion-pattern":["pattern","pixel_ratio"],"line-dasharray":["dash"]};function Xs(e,t){return Hs[e]||[e.replace(`${t}-`,"").replace(/-/g,"_")]}const Ks={"line-pattern":{source:Zo,composite:Zo},"fill-pattern":{source:Zo,composite:Zo},"fill-extrusion-pattern":{source:Zo,composite:Zo},"line-dasharray":{source:Wo,composite:Wo}},Js={color:{source:hs,composite:Go},number:{source:ss,composite:hs}};function Ys(e,t,i){const n=Ks[e];return n&&n[i]||Js[t][i]}Xr(Vs,"ConstantBinder"),Xr(Ns,"PatternConstantBinder"),Xr($s,"SourceExpressionBinder"),Xr(Gs,"PatternCompositeBinder"),Xr(qs,"CompositeExpressionBinder"),Xr(Zs,"ProgramConfiguration",{omit:["_buffers"]}),Xr(Ws,"ProgramConfigurationSet");const Qs="-transition";class ea extends Qe{constructor(e,t){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,"custom"!==e.type&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,"background"!==e.type&&"sky"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),t.layout&&(this._unevaluatedLayout=new Mo(t.layout)),t.paint)){this._transitionablePaint=new ko(t.paint);for(const t in e.paint)this.setPaintProperty(t,e.paint[t],{validate:!1});for(const t in e.layout)this.setLayoutProperty(t,e.layout[t],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Io(t.paint)}}getLayoutProperty(e){return"visibility"===e?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,t,i={}){null!=t&&this._validate(Vr,`layers.${this.id}.layout.${e}`,e,t,i)||("visibility"!==e?this._unevaluatedLayout.setValue(e,t):this.visibility=t)}getPaintProperty(e){return U(e,Qs)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,t,i={}){if(null!=t&&this._validate(jr,`layers.${this.id}.paint.${e}`,e,t,i))return!1;if(U(e,Qs))return this._transitionablePaint.setTransition(e.slice(0,-11),t||void 0),!1;{const i=this._transitionablePaint._values[e],n=i.value.isDataDriven(),r=i.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);const o=this._transitionablePaint._values[e].value,s=o.isDataDriven(),a=U(e,"pattern")||"line-dasharray"===e;return s||n||a||this._handleOverridablePaintPropertyUpdate(e,r,o)}}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getProgramConfiguration(e){return null}_handleOverridablePaintPropertyUpdate(e,t,i){return!1}isHidden(e){return!!(this.minzoom&&e=this.maxzoom)||"none"===this.visibility}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,t){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}serialize(){const e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),V(e,((e,t)=>!(void 0===e||"layout"===t&&!Object.keys(e).length||"paint"===t&&!Object.keys(e).length)))}_validate(e,t,i,n,r={}){return(!r||!1!==r.validate)&&$r(this,e.call(Ur,{key:t,layerType:this.type,objectKey:i,value:n,styleSpec:et,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const t=this.paint.get(e);if(t instanceof Ao&&Bn(t.property.specification)&&("source"===t.value.kind||"composite"===t.value.kind)&&t.value.isStateDependent)return!0}return!1}compileFilter(){this._filterCompiled||(this._featureFilter=hr(this.filter),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}}const ta=Uo([{name:"a_pos",components:2,type:"Int16"}],4),ia=Uo([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class na{constructor(e=[]){this.segments=e}prepareSegment(e,t,i,n){let r=this.segments[this.segments.length-1];return e>na.MAX_VERTEX_ARRAY_LENGTH&&q(`Max vertices per segment is ${na.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!r||r.vertexLength+e>na.MAX_VERTEX_ARRAY_LENGTH||r.sortKey!==n)&&(r={vertexOffset:t.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0},void 0!==n&&(r.sortKey=n),this.segments.push(r)),r}get(){return this.segments}destroy(){for(const e of this.segments)for(const t in e.vaos)e.vaos[t].destroy()}static simpleSegment(e,t,i,n){return new na([{vertexOffset:e,primitiveOffset:t,vertexLength:i,primitiveLength:n,vaos:{},sortKey:0}])}}na.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Xr(na,"SegmentVector");var ra=8192;class oa{constructor(e,t){e&&(t?this.setSouthWest(e).setNorthEast(t):4===e.length?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 Fl?new Fl(e.lng,e.lat):Fl.convert(e),this}setSouthWest(e){return this._sw=e instanceof Fl?new Fl(e.lng,e.lat):Fl.convert(e),this}extend(e){const t=this._sw,i=this._ne;let n,r;if(e instanceof Fl)n=e,r=e;else{if(!(e instanceof oa))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(oa.convert(e)):this.extend(Fl.convert(e)):"object"==typeof e&&null!==e&&e.hasOwnProperty("lat")&&(e.hasOwnProperty("lon")||e.hasOwnProperty("lng"))?this.extend(Fl.convert(e)):this;if(n=e._sw,r=e._ne,!n||!r)return this}return t||i?(t.lng=Math.min(n.lng,t.lng),t.lat=Math.min(n.lat,t.lat),i.lng=Math.max(r.lng,i.lng),i.lat=Math.max(r.lat,i.lat)):(this._sw=new Fl(n.lng,n.lat),this._ne=new Fl(r.lng,r.lat)),this}getCenter(){return new Fl((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 Fl(this.getWest(),this.getNorth())}getSouthEast(){return new Fl(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:t,lat:i}=Fl.convert(e);let n=this._sw.lng<=t&&t<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=t&&t>=this._ne.lng),this._sw.lat<=i&&i<=this._ne.lat&&n}static convert(e){return!e||e instanceof oa?e:new oa(e)}}var sa=1e-6,aa="undefined"!=typeof Float32Array?Float32Array:Array;function la(){var e=new aa(9);return aa!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function ca(e,t,i){var n=t[0],r=t[1],o=t[2],s=t[3],a=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=i[0],p=i[1],f=i[2],m=i[3],_=i[4],g=i[5],y=i[6],b=i[7],v=i[8];return e[0]=d*n+p*s+f*c,e[1]=d*r+p*a+f*u,e[2]=d*o+p*l+f*h,e[3]=m*n+_*s+g*c,e[4]=m*r+_*a+g*u,e[5]=m*o+_*l+g*h,e[6]=y*n+b*s+v*c,e[7]=y*r+b*a+v*u,e[8]=y*o+b*l+v*h,e}function ua(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function ha(e,t){var i=t[0],n=t[1],r=t[2],o=t[3],s=t[4],a=t[5],l=t[6],c=t[7],u=t[8],h=t[9],d=t[10],p=t[11],f=t[12],m=t[13],_=t[14],g=t[15],y=i*a-n*s,b=i*l-r*s,v=i*c-o*s,x=n*l-r*a,w=n*c-o*a,E=r*c-o*l,T=u*m-h*f,k=u*_-d*f,C=u*g-p*f,S=h*_-d*m,M=h*g-p*m,A=d*g-p*_,I=y*A-b*M+v*S+x*C-w*k+E*T;return I?(e[0]=(a*A-l*M+c*S)*(I=1/I),e[1]=(r*M-n*A-o*S)*I,e[2]=(m*E-_*w+g*x)*I,e[3]=(d*w-h*E-p*x)*I,e[4]=(l*C-s*A-c*k)*I,e[5]=(i*A-r*C+o*k)*I,e[6]=(_*v-f*E-g*b)*I,e[7]=(u*E-d*v+p*b)*I,e[8]=(s*M-a*C+c*T)*I,e[9]=(n*C-i*M-o*T)*I,e[10]=(f*w-m*v+g*y)*I,e[11]=(h*v-u*w-p*y)*I,e[12]=(a*k-s*S-l*T)*I,e[13]=(i*S-n*k+r*T)*I,e[14]=(m*b-f*x-_*y)*I,e[15]=(u*x-h*b+d*y)*I,e):null}function da(e,t,i){var n=t[0],r=t[1],o=t[2],s=t[3],a=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=t[9],p=t[10],f=t[11],m=t[12],_=t[13],g=t[14],y=t[15],b=i[0],v=i[1],x=i[2],w=i[3];return e[0]=b*n+v*a+x*h+w*m,e[1]=b*r+v*l+x*d+w*_,e[2]=b*o+v*c+x*p+w*g,e[3]=b*s+v*u+x*f+w*y,e[4]=(b=i[4])*n+(v=i[5])*a+(x=i[6])*h+(w=i[7])*m,e[5]=b*r+v*l+x*d+w*_,e[6]=b*o+v*c+x*p+w*g,e[7]=b*s+v*u+x*f+w*y,e[8]=(b=i[8])*n+(v=i[9])*a+(x=i[10])*h+(w=i[11])*m,e[9]=b*r+v*l+x*d+w*_,e[10]=b*o+v*c+x*p+w*g,e[11]=b*s+v*u+x*f+w*y,e[12]=(b=i[12])*n+(v=i[13])*a+(x=i[14])*h+(w=i[15])*m,e[13]=b*r+v*l+x*d+w*_,e[14]=b*o+v*c+x*p+w*g,e[15]=b*s+v*u+x*f+w*y,e}function pa(e,t,i){var n,r,o,s,a,l,c,u,h,d,p,f,m=i[0],_=i[1],g=i[2];return t===e?(e[12]=t[0]*m+t[4]*_+t[8]*g+t[12],e[13]=t[1]*m+t[5]*_+t[9]*g+t[13],e[14]=t[2]*m+t[6]*_+t[10]*g+t[14],e[15]=t[3]*m+t[7]*_+t[11]*g+t[15]):(r=t[1],o=t[2],s=t[3],a=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=t[9],p=t[10],f=t[11],e[0]=n=t[0],e[1]=r,e[2]=o,e[3]=s,e[4]=a,e[5]=l,e[6]=c,e[7]=u,e[8]=h,e[9]=d,e[10]=p,e[11]=f,e[12]=n*m+a*_+h*g+t[12],e[13]=r*m+l*_+d*g+t[13],e[14]=o*m+c*_+p*g+t[14],e[15]=s*m+u*_+f*g+t[15]),e}function fa(e,t,i){var n=i[0],r=i[1],o=i[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function ma(e,t,i){var n=Math.sin(i),r=Math.cos(i),o=t[4],s=t[5],a=t[6],l=t[7],c=t[8],u=t[9],h=t[10],d=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=o*r+c*n,e[5]=s*r+u*n,e[6]=a*r+h*n,e[7]=l*r+d*n,e[8]=c*r-o*n,e[9]=u*r-s*n,e[10]=h*r-a*n,e[11]=d*r-l*n,e}function _a(e,t,i){var n=Math.sin(i),r=Math.cos(i),o=t[0],s=t[1],a=t[2],l=t[3],c=t[8],u=t[9],h=t[10],d=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*r-c*n,e[1]=s*r-u*n,e[2]=a*r-h*n,e[3]=l*r-d*n,e[8]=o*n+c*r,e[9]=s*n+u*r,e[10]=a*n+h*r,e[11]=l*n+d*r,e}function ga(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function ya(e,t,i){var n,r,o,s=i[0],a=i[1],l=i[2],c=Math.hypot(s,a,l);return c0&&(o=1/Math.sqrt(o)),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e}function La(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Da(e,t,i){var n=t[0],r=t[1],o=t[2],s=i[0],a=i[1],l=i[2];return e[0]=r*l-o*a,e[1]=o*s-n*l,e[2]=n*a-r*s,e}function za(e,t,i){var n=t[0],r=t[1],o=t[2],s=i[3]*n+i[7]*r+i[11]*o+i[15];return e[0]=(i[0]*n+i[4]*r+i[8]*o+i[12])/(s=s||1),e[1]=(i[1]*n+i[5]*r+i[9]*o+i[13])/s,e[2]=(i[2]*n+i[6]*r+i[10]*o+i[14])/s,e}function Oa(e,t,i){var n=i[0],r=i[1],o=i[2],s=t[0],a=t[1],l=t[2],c=r*l-o*a,u=o*s-n*l,h=n*a-r*s,d=r*h-o*u,p=o*c-n*h,f=n*u-r*c,m=2*i[3];return u*=m,h*=m,p*=2,f*=2,e[0]=s+(c*=m)+(d*=2),e[1]=a+u+p,e[2]=l+h+f,e}var Ba,Ra=ka,Fa=Ca,Ua=wa;function ja(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e}function Va(e,t){var i=t[0],n=t[1],r=t[2],o=t[3],s=i*i+n*n+r*r+o*o;return s>0&&(s=1/Math.sqrt(s)),e[0]=i*s,e[1]=n*s,e[2]=r*s,e[3]=o*s,e}function Na(e,t,i){var n=t[0],r=t[1],o=t[2],s=t[3];return e[0]=i[0]*n+i[4]*r+i[8]*o+i[12]*s,e[1]=i[1]*n+i[5]*r+i[9]*o+i[13]*s,e[2]=i[2]*n+i[6]*r+i[10]*o+i[14]*s,e[3]=i[3]*n+i[7]*r+i[11]*o+i[15]*s,e}function $a(){var e=new aa(4);return aa!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function qa(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function Ga(e,t,i){i*=.5;var n=t[0],r=t[1],o=t[2],s=t[3],a=Math.sin(i),l=Math.cos(i);return e[0]=n*l+s*a,e[1]=r*l+o*a,e[2]=o*l-r*a,e[3]=s*l-n*a,e}function Za(e,t,i){i*=.5;var n=t[0],r=t[1],o=t[2],s=t[3],a=Math.sin(i),l=Math.cos(i);return e[0]=n*l-o*a,e[1]=r*l+s*a,e[2]=o*l+n*a,e[3]=s*l-r*a,e}va(),Ba=new aa(4),aa!=Float32Array&&(Ba[0]=0,Ba[1]=0,Ba[2]=0,Ba[3]=0);var Wa=Va;va(),Ea(1,0,0),Ea(0,1,0),$a(),$a(),la();const Ha=Uo([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:Xa}=Ha,Ka=Uo([{name:"a_pos_3",components:3,type:"Int16"}]);var Ja=Uo([{name:"a_pos",type:"Int16",components:2}]);class Ya{constructor(e,t){this.pos=e,this.dir=t}intersectsPlane(e,t,i){const n=La(t,this.dir);if(Math.abs(n)<1e-6)return!1;const r=((e[0]-this.pos[0])*t[0]+(e[1]-this.pos[1])*t[1]+(e[2]-this.pos[2])*t[2])/n;return i[0]=this.pos[0]+this.dir[0]*r,i[1]=this.pos[1]+this.dir[1]*r,i[2]=this.pos[2]+this.dir[2]*r,!0}closestPointOnSphere(e,t,i){if(function(e,t){var i=e[0],n=e[1],r=e[2],o=t[0],s=t[1],a=t[2];return Math.abs(i-o)<=sa*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(n-s)<=sa*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(r-a)<=sa*Math.max(1,Math.abs(r),Math.abs(a))}(this.pos,e)||0===t)return i[0]=i[1]=i[2]=0,!1;const[n,r,o]=this.dir,s=this.pos[0]-e[0],a=this.pos[1]-e[1],l=this.pos[2]-e[2],c=n*n+r*r+o*o,u=2*(s*n+a*r+l*o),h=u*u-4*c*(s*s+a*a+l*l-t*t);if(h<0){const e=Math.max(-u/2,0),c=s+n*e,h=a+r*e,d=l+o*e,p=Math.hypot(c,h,d);return i[0]=c*t/p,i[1]=h*t/p,i[2]=d*t/p,!1}{const e=(-u-Math.sqrt(h))/(2*c);if(e<0){const e=Math.hypot(s,a,l);return i[0]=s*t/e,i[1]=a*t/e,i[2]=l*t/e,!1}return i[0]=s+n*e,i[1]=a+r*e,i[2]=l+o*e,!0}}}class Qa{constructor(e,t,i,n,r){this.TL=e,this.TR=t,this.BR=i,this.BL=n,this.horizon=r}static fromInvProjectionMatrix(e,t,i){const n=[-1,1,1],r=[1,1,1],o=[1,-1,1],s=[-1,-1,1],a=za(n,n,e),l=za(r,r,e),c=za(o,o,e),u=za(s,s,e);return new Qa(a,l,c,u,t/i)}}class el{constructor(e,t){this.points=e,this.planes=t}static fromInvProjectionMatrix(e,t,i,n){const r=Math.pow(2,i),o=[[-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((i=>{const o=Na([],i,e),s=1/o[3]/t*r;return function(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],e[3]=t[3]*i[3],e}(o,o,[s,s,n?1/o[3]:s,s])})),s=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((e=>{const t=Pa([],Da([],Ra([],o[e[0]],o[e[1]]),Ra([],o[e[2]],o[e[1]]))),i=-La(t,o[e[1]]);return t.concat(i)}));return new el(o,s)}}class tl{static fromPoints(e){const t=[1/0,1/0,1/0],i=[-1/0,-1/0,-1/0];for(const n of e)Sa(t,t,n),Ma(i,i,n);return new tl(t,i)}static applyTransform(e,t){const i=e.getCorners();for(let e=0;e=0;if(0===o)return 0;o!==t.length&&(i=!1)}if(i)return 2;for(let t=0;t<3;t++){let i=Number.MAX_VALUE,n=-Number.MAX_VALUE;for(let r=0;rthis.max[t]-this.min[t])return 0}return 1}}const il=5,nl=6,rl=ra/Math.PI/2,ol=16383,sl=64,al=[sl,32,16],ll=-rl,cl=rl,ul=[new tl([ll,ll,ll],[cl,cl,cl]),new tl([ll,ll,ll],[0,0,cl]),new tl([0,ll,ll],[cl,0,cl]),new tl([ll,0,ll],[0,cl,cl]),new tl([0,0,ll],[cl,cl,cl])];function hl(e){return e*rl/Ol}function dl(e,t,i,n=!0){const r=Aa([],e._camera.position,e.worldSize),o=[t,i,1,1];Na(o,o,e.pixelMatrixInverse),ja(o,o,1/o[3]);const s=Pa([],Ra([],o,r)),a=e.globeMatrix,l=[a[12],a[13],a[14]],c=Ra([],l,r),u=wa(c),h=Pa([],c),d=e.worldSize/(2*Math.PI),p=La(h,s),f=Math.asin(d/u);if(f1?null:function(e,t,i,n){const r=Math.sin(i);return e*(Math.sin((1-n)*i)/r)+t*(Math.sin(n*i)/r)}(e.a[t],e.b[t],e.angle,S(i,0,1))+e.center[t]}function ml(e){if(e.z<=1)return ul[e.z+2*e.y+e.x];const t=vl(bl(e));return tl.fromPoints(t)}function _l(e,t,i){return Aa(e,e,1-i),Ia(e,e,t,i)}function gl(e,t){const i=Al(t.zoom);if(0===i)return ml(e);const n=bl(e),r=vl(n),o=jl(n.getWest())*t.worldSize,s=jl(n.getEast())*t.worldSize,a=Vl(n.getNorth())*t.worldSize,l=Vl(n.getSouth())*t.worldSize,c=[o,a,0],u=[s,a,0],h=[o,l,0],d=[s,l,0],p=ha([],t.globeMatrix);return za(c,c,p),za(u,u,p),za(h,h,p),za(d,d,p),r[0]=_l(r[0],h,i),r[1]=_l(r[1],d,i),r[2]=_l(r[2],u,i),r[3]=_l(r[3],c,i),tl.fromPoints(r)}function yl(e,t,i){for(const n of e)za(n,n,t),Aa(n,n,i)}function bl({x:e,y:t,z:i}){const n=1/(1<Math.PI/2*1.01}const Ll=x(85),Dl=Math.cos(Ll),zl=Math.sin(Ll),Ol=6371008.8,Bl=2*Math.PI*Ol;class Rl{constructor(e,t){if(isNaN(e)||isNaN(t))throw new Error(`Invalid LngLat object: (${e}, ${t})`);if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Rl(A(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const t=Math.PI/180,i=this.lat*t,n=e.lat*t,r=Math.sin(i)*Math.sin(n)+Math.cos(i)*Math.cos(n)*Math.cos((e.lng-this.lng)*t);return Ol*Math.acos(Math.min(r,1))}toBounds(e=0){const t=360*e/40075017,i=t/Math.cos(Math.PI/180*this.lat);return new oa(new Rl(this.lng-i,this.lat-t),new Rl(this.lng+i,this.lat+t))}toEcef(e){const t=hl(e);return wl(this.lat,this.lng,rl+t)}static convert(e){if(e instanceof Rl)return e;if(Array.isArray(e)&&(2===e.length||3===e.length))return new Rl(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return new Rl(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: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}var Fl=Rl;function Ul(e){return Bl*Math.cos(e*Math.PI/180)}function jl(e){return(180+e)/360}function Vl(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Nl(e,t){return e/Ul(t)}function $l(e){return 360*e-180}function ql(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}function Gl(e,t){return e*Ul(ql(t))}const Zl=85.051129;function Wl(e){return 1/Math.cos(e*Math.PI/180)}class Hl{constructor(e,t,i=0){this.x=+e,this.y=+t,this.z=+i}static fromLngLat(e,t=0){const i=Fl.convert(e);return new Hl(jl(i.lng),Vl(i.lat),Nl(t,i.lat))}toLngLat(){return new Fl($l(this.x),ql(this.y))}toAltitude(){return Gl(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Bl*Wl(ql(this.y))}}function Xl(e,t,i,n,r,o,s,a,l){const c=(t+n)/2,u=(i+r)/2,h=new y(c,u);a(h),function(e,t,i,n,r,o){const s=i-r,a=n-o;return Math.abs((n-t)*s-(i-e)*a)/Math.hypot(s,a)}(h.x,h.y,o.x,o.y,s.x,s.y)>=l?(Xl(e,t,i,c,u,o,h,a,l),Xl(e,c,u,n,r,h,s,a,l)):e.push(s)}function Kl(e,t,i){let n=e[0],r=n.x,o=n.y;t(n);const s=[n];for(let a=1;ae.x+1||ne.y+1)&&q("Geometry exceeds allowed extent, reduce your vector tile buffer size"),e}function ic(e,t,i){const n=e.loadGeometry(),r=e.extent,o=ra/r;if(t&&i&&i.projection.isReprojectedInTileSpace){const o=1<{const i=$l((t.x+e.x/r)/o),n=ql((t.y+e.y/r)/o),u=c.project(i,n);e.x=(u.x*s-a)*r,e.y=(u.y*s-l)*r};for(let t=0;t=r||i.y<0||i.y>=r||(u(i),e.push(i));n[t]=e}}for(const e of n)for(const t of e)tc(t,o);return n}function nc(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?ic(e):[]}}function rc(e,t,i,n,r){e.emplaceBack(2*t+(n+1)/2,2*i+(r+1)/2)}function oc(e,t,i){const n=16384;e.emplaceBack(t.x,t.y,t.z,i[0]*n,i[1]*n,i[2]*n)}class sc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasPattern=!1,this.projection=e.projection,this.layoutVertexArray=new Vo,this.indexArray=new ns,this.segments=new na,this.programConfigurations=new Ws(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,i,n){const r=this.layers[0],o=[];let s=null;"circle"===r.type&&(s=r.layout.get("circle-sort-key"));for(const{feature:t,id:r,index:a,sourceLayerIndex:l}of e){const e=this.layers[0]._featureFilter.needGeometry,c=nc(t,e);if(!this.layers[0]._featureFilter.filter(new wo(this.zoom),c,i))continue;const u=s?s.evaluate(c,{},i):void 0,h={id:r,properties:t.properties,type:t.type,sourceLayerIndex:l,index:a,geometry:e?c.geometry:ic(t,i,n),patterns:{},sortKey:u};o.push(h)}s&&o.sort(((e,t)=>e.sortKey-t.sortKey));let a=null;"globe"===n.projection.name&&(this.globeExtVertexArray=new Ho,a=n.projection);for(const n of o){const{geometry:r,index:o,sourceLayerIndex:s}=n,l=e[o].feature;this.addFeature(n,r,o,t.availableImages,i,a),t.featureIndex.insert(l,r,o,s,this.index)}}update(e,t,i,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ta.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,ia.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())}addFeature(e,t,i,n,r,o){for(const i of t)for(const t of i){const i=t.x,n=t.y;if(i<0||i>=ra||n<0||n>=ra)continue;if(o){const e=o.projectTilePoint(i,n,r),t=o.upVector(r,i,n),s=this.globeExtVertexArray;oc(s,e,t),oc(s,e,t),oc(s,e,t),oc(s,e,t)}const s=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),a=s.vertexLength;rc(this.layoutVertexArray,i,n,-1,-1),rc(this.layoutVertexArray,i,n,1,-1),rc(this.layoutVertexArray,i,n,1,1),rc(this.layoutVertexArray,i,n,-1,1),this.indexArray.emplaceBack(a,a+1,a+2),this.indexArray.emplaceBack(a,a+2,a+3),s.vertexLength+=4,s.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,{},n,r)}}function ac(e,t){for(let i=0;i1){if(hc(e,t))return!0;for(let n=0;n1?i:i.sub(t)._mult(r)._add(t))}function mc(e,t){let i,n,r,o=!1;for(let s=0;st.y!=r.y>t.y&&t.x<(r.x-n.x)*(t.y-n.y)/(r.y-n.y)+n.x&&(o=!o)}return o}function _c(e,t){let i=!1;for(let n=0,r=e.length-1;nt.y!=s.y>t.y&&t.x<(s.x-o.x)*(t.y-o.y)/(s.y-o.y)+o.x&&(i=!i)}return i}function gc(e,t,i,n,r){for(const o of e)if(t<=o.x&&i<=o.y&&n>=o.x&&r>=o.y)return!0;const o=[new y(t,i),new y(t,r),new y(n,r),new y(n,i)];if(e.length>2)for(const t of o)if(_c(e,t))return!0;for(let t=0;tr.x&&t.x>r.x||e.yr.y&&t.y>r.y)return!1;const o=G(e,t,i[0]);return o!==G(e,t,i[1])||o!==G(e,t,i[2])||o!==G(e,t,i[3])}function bc(e,t,i){const n=t.paint.get(e).value;return"constant"===n.kind?n.value:i.programConfigurations.get(t.id).getMaxValue(e)}function vc(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function xc(e,t,i,n,r){if(!t[0]&&!t[1])return e;const o=y.convert(t)._mult(r);"viewport"===i&&o._rotate(-n);const s=[];for(let t=0;t0){const e=i.projection.upVector(c,h.x,h.y);p.x+=e[0]*u*d,p.y+=e[1]*u*d,p.z+=e[2]*u*d}const f=o?h:Cc(p.x,p.y,p.z,n),m=o?e.tilespaceRays.map((e=>Ac(e,d))):e.queryGeometry.screenGeometry,_=Na([],[p.x,p.y,p.z,1],n);if(!s&&o?l*=_[3]/i.cameraToCenterDistance:s&&!o&&(l*=i.cameraToCenterDistance/_[3]),o){const e=ql((t.y/ra+c.y)/(1<e.width||r.height>e.height||i.x>e.width-r.width||i.y>e.height-r.height)throw new RangeError("out of range source coordinates for image copy");if(r.width>t.width||r.height>t.height||n.x>t.width-r.width||n.y>t.height-r.height)throw new RangeError("out of range destination coordinates for image copy");const s=e.data,a=t.data;for(let l=0;l{t[e.evaluationKey]=o;const s=e.expression.evaluate(t);r.data[i+n+0]=Math.floor(255*s.r/s.a),r.data[i+n+1]=Math.floor(255*s.g/s.a),r.data[i+n+2]=Math.floor(255*s.b/s.a),r.data[i+n+3]=Math.floor(255*s.a)};if(e.clips)for(let t=0,r=0;t80*i){n=o=e[0],r=s=e[1];for(var f=i;fo&&(o=a),l>s&&(s=l);c=0!==(c=Math.max(o-n,s-r))?32767/c:0}return Gc(d,p,i,n,r,c,0),p}function $c(e,t,i,n,r){var o,s;if(r===pu(e,t,i,n)>0)for(o=t;o=t;o-=n)s=uu(o,e[o],e[o+1],s);return s&&ru(s,s.next)&&(hu(s),s=s.next),s}function qc(e,t){if(!e)return e;t||(t=e);var i,n=e;do{if(i=!1,n.steiner||!ru(n,n.next)&&0!==nu(n.prev,n,n.next))n=n.next;else{if(hu(n),(n=t=n.prev)===n.next)break;i=!0}}while(i||n!==t);return t}function Gc(e,t,i,n,r,o,s){if(e){!s&&o&&function(e,t,i,n){var r=e;do{0===r.z&&(r.z=Qc(r.x,r.y,t,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){var t,i,n,r,o,s,a,l,c=1;do{for(i=e,e=null,o=null,s=0;i;){for(s++,n=i,a=0,t=0;t0||l>0&&n;)0!==a&&(0===l||!n||i.z<=n.z)?(r=i,i=i.nextZ,a--):(r=n,n=n.nextZ,l--),o?o.nextZ=r:e=r,r.prevZ=o,o=r;i=n}o.nextZ=null,c*=2}while(s>1)}(r)}(e,n,r,o);for(var a,l,c=e;e.prev!==e.next;)if(a=e.prev,l=e.next,o?Wc(e,n,r,o):Zc(e))t.push(a.i/i|0),t.push(e.i/i|0),t.push(l.i/i|0),hu(e),e=l.next,c=l.next;else if((e=l)===c){s?1===s?Gc(e=Hc(qc(e),t,i),t,i,n,r,o,2):2===s&&Xc(e,t,i,n,r,o):Gc(qc(e),t,i,n,r,o,1);break}}}function Zc(e){var t=e.prev,i=e,n=e.next;if(nu(t,i,n)>=0)return!1;for(var r=t.x,o=i.x,s=n.x,a=t.y,l=i.y,c=n.y,u=ro?r>s?r:s:o>s?o:s,p=a>l?a>c?a:c:l>c?l:c,f=n.next;f!==t;){if(f.x>=u&&f.x<=d&&f.y>=h&&f.y<=p&&tu(r,a,o,l,s,c,f.x,f.y)&&nu(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function Wc(e,t,i,n){var r=e.prev,o=e,s=e.next;if(nu(r,o,s)>=0)return!1;for(var a=r.x,l=o.x,c=s.x,u=r.y,h=o.y,d=s.y,p=al?a>c?a:c:l>c?l:c,_=u>h?u>d?u:d:h>d?h:d,g=Qc(p,f,t,i,n),y=Qc(m,_,t,i,n),b=e.prevZ,v=e.nextZ;b&&b.z>=g&&v&&v.z<=y;){if(b.x>=p&&b.x<=m&&b.y>=f&&b.y<=_&&b!==r&&b!==s&&tu(a,u,l,h,c,d,b.x,b.y)&&nu(b.prev,b,b.next)>=0)return!1;if(b=b.prevZ,v.x>=p&&v.x<=m&&v.y>=f&&v.y<=_&&v!==r&&v!==s&&tu(a,u,l,h,c,d,v.x,v.y)&&nu(v.prev,v,v.next)>=0)return!1;v=v.nextZ}for(;b&&b.z>=g;){if(b.x>=p&&b.x<=m&&b.y>=f&&b.y<=_&&b!==r&&b!==s&&tu(a,u,l,h,c,d,b.x,b.y)&&nu(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;v&&v.z<=y;){if(v.x>=p&&v.x<=m&&v.y>=f&&v.y<=_&&v!==r&&v!==s&&tu(a,u,l,h,c,d,v.x,v.y)&&nu(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function Hc(e,t,i){var n=e;do{var r=n.prev,o=n.next.next;!ru(r,o)&&ou(r,n,n.next,o)&&lu(r,o)&&lu(o,r)&&(t.push(r.i/i|0),t.push(n.i/i|0),t.push(o.i/i|0),hu(n),hu(n.next),n=e=o),n=n.next}while(n!==e);return qc(n)}function Xc(e,t,i,n,r,o){var s=e;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&iu(s,a)){var l=cu(s,a);return s=qc(s,s.next),l=qc(l,l.next),Gc(s,t,i,n,r,o,0),void Gc(l,t,i,n,r,o,0)}a=a.next}s=s.next}while(s!==e)}function Kc(e,t){return e.x-t.x}function Jc(e,t){var i=function(e,t){var i,n=t,r=e.x,o=e.y,s=-1/0;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){var a=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=r&&a>s&&(s=a,i=n.x=n.x&&n.x>=u&&r!==n.x&&tu(oi.x||n.x===i.x&&Yc(i,n)))&&(i=n,d=l)),n=n.next}while(n!==c);return i}(e,t);if(!i)return t;var n=cu(i,e);return qc(n,n.next),qc(i,i.next)}function Yc(e,t){return nu(e.prev,e,t.prev)<0&&nu(t.next,e,e.next)<0}function Qc(e,t,i,n,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function eu(e){var t=e,i=e;do{(t.x=(e-s)*(o-a)&&(e-s)*(n-a)>=(i-s)*(t-a)&&(i-s)*(o-a)>=(r-s)*(n-a)}function iu(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&ou(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&(lu(e,t)&&lu(t,e)&&function(e,t){var i=e,n=!1,r=(e.x+t.x)/2,o=(e.y+t.y)/2;do{i.y>o!=i.next.y>o&&i.next.y!==i.y&&r<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==e);return n}(e,t)&&(nu(e.prev,e,t.prev)||nu(e,t.prev,t))||ru(e,t)&&nu(e.prev,e,e.next)>0&&nu(t.prev,t,t.next)>0)}function nu(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function ru(e,t){return e.x===t.x&&e.y===t.y}function ou(e,t,i,n){var r=au(nu(e,t,i)),o=au(nu(e,t,n)),s=au(nu(i,n,e)),a=au(nu(i,n,t));return r!==o&&s!==a||!(0!==r||!su(e,i,t))||!(0!==o||!su(e,n,t))||!(0!==s||!su(i,e,n))||!(0!==a||!su(i,t,n))}function su(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function au(e){return e>0?1:e<0?-1:0}function lu(e,t){return nu(e.prev,e,e.next)<0?nu(e,t,e.next)>=0&&nu(e,e.prev,t)>=0:nu(e,t,e.prev)<0||nu(e,e.next,t)<0}function cu(e,t){var i=new du(e.i,e.x,e.y),n=new du(t.i,t.x,t.y),r=e.next,o=t.prev;return e.next=t,t.prev=e,i.next=r,r.prev=i,n.next=i,i.prev=n,o.next=n,n.prev=o,n}function uu(e,t,i,n){var r=new du(e,t,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function hu(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function du(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function pu(e,t,i,n){for(var r=0,o=t,s=i-n;o0&&i.holes.push(n+=e[r-1].length)}return i};var fu=d(Vc.exports);function mu(e,t,i,n,r){_u(e,t,i||0,n||e.length-1,r||yu)}function _u(e,t,i,n,r){for(;n>i;){if(n-i>600){var o=n-i+1,s=t-i+1,a=Math.log(o),l=.5*Math.exp(2*a/3),c=.5*Math.sqrt(a*l*(o-l)/o)*(s-o/2<0?-1:1);_u(e,t,Math.max(i,Math.floor(t-s*l/o+c)),Math.min(n,Math.floor(t+(o-s)*l/o+c)),r)}var u=e[t],h=i,d=n;for(gu(e,i,t),r(e[n],u)>0&&gu(e,i,n);h0;)d--}0===r(e[i],u)?gu(e,i,d):gu(e,++d,n),d<=t&&(i=d+1),t<=d&&(n=d-1)}}function gu(e,t,i){var n=e[t];e[t]=e[i],e[i]=n}function yu(e,t){return et?1:0}function bu(e,t){const i=e.length;if(i<=1)return[e];const n=[];let r,o;for(let t=0;t1)for(let e=0;ee.id)),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Vo,this.indexArray=new ns,this.indexArray2=new cs,this.programConfigurations=new Ws(e.layers,e.zoom),this.segments=new na,this.segments2=new na,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.projection=e.projection}populate(e,t,i,n){this.hasPattern=xu("fill",this.layers,t);const r=this.layers[0].layout.get("fill-sort-key"),o=[];for(const{feature:s,id:a,index:l,sourceLayerIndex:c}of e){const e=this.layers[0]._featureFilter.needGeometry,u=nc(s,e);if(!this.layers[0]._featureFilter.filter(new wo(this.zoom),u,i))continue;const h=r?r.evaluate(u,{},i,t.availableImages):void 0,d={id:a,properties:s.properties,type:s.type,sourceLayerIndex:c,index:l,geometry:e?u.geometry:ic(s,i,n),patterns:{},sortKey:h};o.push(d)}r&&o.sort(((e,t)=>e.sortKey-t.sortKey));for(const n of o){const{geometry:r,index:o,sourceLayerIndex:s}=n;if(this.hasPattern){const e=wu("fill",this.layers,n,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(n,r,o,i,{},t.availableImages);t.featureIndex.insert(e[o].feature,r,o,s,this.index)}}update(e,t,i,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i,n)}addFeatures(e,t,i,n,r){for(const e of this.patternFeatures)this.addFeature(e,e.geometry,e.index,t,i,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,jc),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,t,i,n,r,o=[]){for(const e of bu(t,500)){let t=0;for(const i of e)t+=i.length;const i=this.segments.prepareSegment(t,this.layoutVertexArray,this.indexArray),n=i.vertexLength,r=[],o=[];for(const t of e){if(0===t.length)continue;t!==e[0]&&o.push(r.length/2);const i=this.segments2.prepareSegment(t.length,this.layoutVertexArray,this.indexArray2),n=i.vertexLength;this.layoutVertexArray.emplaceBack(t[0].x,t[0].y),this.indexArray2.emplaceBack(n+t.length-1,n),r.push(t[0].x),r.push(t[0].y);for(let e=1;e>3}if(r--,1===n||2===n)o+=e.readSVarint(),s+=e.readSVarint(),1===n&&(t&&a.push(t),t=[]),t.push(new Pu(o,s));else{if(7!==n)throw new Error("unknown command "+n);t&&t.push(t[0].clone())}}return t&&a.push(t),a},Du.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,i=1,n=0,r=0,o=0,s=1/0,a=-1/0,l=1/0,c=-1/0;e.pos>3}if(n--,1===i||2===i)(r+=e.readSVarint())a&&(a=r),(o+=e.readSVarint())c&&(c=o);else if(7!==i)throw new Error("unknown command "+i)}return[s,l,a,c]},Du.prototype.toGeoJSON=function(e,t,i){var n,r,o=this.extent*Math.pow(2,i),s=this.extent*e,a=this.extent*t,l=this.loadGeometry(),c=Du.types[this.type];function u(e){for(var t=0;t>3;t=1===n?e.readString():2===n?e.readFloat():3===n?e.readDouble():4===n?e.readVarint64():5===n?e.readVarint():6===n?e.readSVarint():7===n?e.readBoolean():null}return t}(i))}Fu.prototype.feature=function(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];var t=this._pbf.readVarint()+this._pbf.pos;return new Bu(this._pbf,t,this.extent,this._keys,this._values)};var ju=Ru;function Vu(e,t,i){if(3===e){var n=new ju(i,i.readVarint()+i.pos);n.length&&(t[n.name]=n)}}var Nu=Iu.VectorTile=function(e,t){this.layers=e.readFields(Vu,{},t)},$u=Iu.VectorTileFeature=Lu;function qu(e,t,i,n){const r=[],o=0===n?(e,t,i,n,r,o)=>{e.push(new y(o,i+(o-t)/(n-t)*(r-i)))}:(e,t,i,n,r,o)=>{e.push(new y(t+(o-i)/(r-i)*(n-t),o))};for(const s of e){const e=[];for(const r of s){if(r.length<=2)continue;const s=[];for(let e=0;et&&o(s,a,l,c,u,t):h>i?d=t&&o(s,a,l,c,u,t),d>i&&h<=i&&o(s,a,l,c,u,i)}let a=r[r.length-1];const l=0===n?a.x:a.y;l>=t&&l<=i&&s.push(a),s.length&&(a=s[s.length-1],s[0].x===a.x&&s[0].y===a.y||s.push(s[0]),e.push(s))}e.length&&r.push(e)}return r}Iu.VectorTileLayer=Ru;const Gu=$u.types,Zu=Math.pow(2,13);function Wu(e,t,i,n,r,o,s,a){e.emplaceBack((t<<1)+s,(i<<1)+o,(Math.floor(n*Zu)<<1)+r,Math.round(a))}function Hu(e,t,i){const n=16384;e.emplaceBack(t.x,t.y,t.z,i[0]*n,i[1]*n,i[2]*n)}class Xu{constructor(){this.acc=new y(0,0),this.polyCount=[]}startRing(e){this.currentPolyCount={edges:0,top:0},this.polyCount.push(this.currentPolyCount),this.min||(this.min=new y(e.x,e.y),this.max=new y(e.x,e.y))}append(e,t){this.currentPolyCount.edges++,this.acc._add(e);const i=this.min,n=this.max;e.xn.x&&(n.x=e.x),e.yn.y&&(n.y=e.y),((0===e.x||e.x===ra)&&e.x===t.x)!=((0===e.y||e.y===ra)&&e.y===t.y)&&this.processBorderOverlap(e,t),t.x<0!=e.x<0&&this.addBorderIntersection(0,Pi(t.y,e.y,(0-t.x)/(e.x-t.x))),t.x>ra!=e.x>ra&&this.addBorderIntersection(1,Pi(t.y,e.y,(ra-t.x)/(e.x-t.x))),t.y<0!=e.y<0&&this.addBorderIntersection(2,Pi(t.x,e.x,(0-t.y)/(e.y-t.y))),t.y>ra!=e.y>ra&&this.addBorderIntersection(3,Pi(t.x,e.x,(ra-t.y)/(e.y-t.y)))}addBorderIntersection(e,t){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 i=this.borders[e];ti[1]&&(i[1]=t)}processBorderOverlap(e,t){if(e.x===t.x){if(e.y===t.y)return;const i=0===e.x?0:1;this.addBorderIntersection(i,t.y),this.addBorderIntersection(i,e.y)}else{const i=0===e.y?2:3;this.addBorderIntersection(i,t.x),this.addBorderIntersection(i,e.x)}}centroid(){const e=this.polyCount.reduce(((e,t)=>e+t.edges),0);return 0!==e?this.acc.div(e)._round():new y(0,0)}span(){return new y(this.max.x-this.min.x,this.max.y-this.min.y)}intersectsCount(){return this.borders.reduce(((e,t)=>e+ +(t[0]!==Number.MAX_VALUE)),0)}}class Ku{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=e.projection,this.layoutVertexArray=new $o,this.centroidVertexArray=new ws,this.indexArray=new ns,this.programConfigurations=new Ws(e.layers,e.zoom),this.segments=new na,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.enableTerrain=e.enableTerrain}populate(e,t,i,n){this.features=[],this.hasPattern=xu("fill-extrusion",this.layers,t),this.featuresOnBorder=[],this.borders=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.tileToMeter=function(e){const t=Math.exp(Math.PI*(1-e.y/(1<=0;e--){const t=d[e];(0===t.length||(p=t[0]).every((e=>e.x<=0))||p.every((e=>e.x>=ra))||p.every((e=>e.y<=0))||p.every((e=>e.y>=ra)))&&d.splice(e,1)}var p;let f;if(c)f=rh(d,a,n);else{f=[];for(const e of d)f.push({polygon:e,bounds:a})}const m=h?this.edgeRadius:0;for(const{polygon:e,bounds:t}of f){let i=0,r=0;for(const t of e)h&&!t[0].equals(t[t.length-1])&&t.push(t[0]),r+=h?t.length-1:t.length;const o=this.segments.prepareSegment((h?5:4)*r,this.layoutVertexArray,this.indexArray);if(h){const t=[],r=[];i=o.vertexLength;for(const i of e){let s,a;i.length&&i!==e[0]&&r.push(t.length/2),s=i[1].sub(i[0])._perp()._unit();for(let e=1;e4&&th(r[r.length-2],r[0],r[1]),p=m?Yu(r[r.length-2],r[0],r[1],m):0;s=r[1].sub(r[0])._perp()._unit();let f=!0;for(let _=1,g=0;_0?1:0,T=y.dist(b);if(g+T>32768&&(g=0),m){a=v.sub(b)._perp()._unit();let e=Qu(y,b,v,Ju(s,a),m);isNaN(e)&&(e=0);const t=b.sub(y)._unit();y=y.add(t.mult(p))._round(),b=b.add(t.mult(-e))._round(),p=e,s=a}const k=o.vertexLength,C=r.length>4&&th(y,b,v);let S=ih(g,d,f);if(Wu(this.layoutVertexArray,y.x,y.y,w,E,0,0,S),Wu(this.layoutVertexArray,y.x,y.y,w,E,0,1,S),g+=T,S=ih(g,C,!f),d=C,Wu(this.layoutVertexArray,b.x,b.y,w,E,0,0,S),Wu(this.layoutVertexArray,b.x,b.y,w,E,0,1,S),o.vertexLength+=4,this.indexArray.emplaceBack(k+0,k+1,k+2),this.indexArray.emplaceBack(k+1,k+3,k+2),o.primitiveLength+=2,m){const n=i+(1===_?r.length-2:_-2),s=1===_?i:n+1;if(this.indexArray.emplaceBack(k+1,n,k+3),this.indexArray.emplaceBack(n,s,k+3),o.primitiveLength+=2,void 0===e&&(e=k),!eh(v,r[_],t)){const t=_===r.length-1?e:o.vertexLength;this.indexArray.emplaceBack(k+2,k+3,t),this.indexArray.emplaceBack(k+3,t+1,t),this.indexArray.emplaceBack(k+3,s,t+1),o.primitiveLength+=3}f=!f}if(c){const e=this.layoutVertexExtArray,t=l.projectTilePoint(y.x,y.y,n),i=l.projectTilePoint(b.x,b.y,n),r=l.upVector(n,y.x,y.y),o=l.upVector(n,b.x,b.y);Hu(e,t,r),Hu(e,t,r),Hu(e,i,o),Hu(e,i,o)}}h&&(i+=r.length-1)}}if(u&&u.polyCount.length>0){if(u.borders){u.vertexArrayOffset=this.centroidVertexArray.length;const e=u.borders,t=this.featuresOnBorder.push(u)-1;for(let i=0;i<4;i++)e[i][0]!==Number.MAX_VALUE&&this.borders[i].push(t)}this.encodeCentroid(u.borders?void 0:u.centroid(),u)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,r,o,n)}sortBorders(){for(let e=0;e<4;e++)this.borders[e].sort(((t,i)=>this.featuresOnBorder[t].borders[e][0]-this.featuresOnBorder[i].borders[e][0]))}encodeCentroid(e,t,i=!0){let n,r;if(e)if(0!==e.y){const i=t.span()._mult(this.tileToMeter);n=(Math.max(e.x,1)<<3)+Math.min(7,Math.round(i.x/10)),r=(Math.max(e.y,1)<<3)+Math.min(7,Math.round(i.y/10))}else n=Math.ceil(7*(e.x+450)),r=0;else n=0,r=+i;let o=i?this.centroidVertexArray.length:t.vertexArrayOffset;for(const e of t.polyCount){i&&this.centroidVertexArray.resize(this.centroidVertexArray.length+4*e.edges+e.top);for(let t=0;ti[1].x&&t.x>i[1].x||e.yi[1].y&&t.y>i[1].y}function th(e,t,i){if(e.x<0||e.x>=ra||t.x<0||t.x>=ra||i.x<0||i.x>=ra)return!1;const n=i.sub(t),r=n.perp(),o=e.sub(t);return(n.x*o.x+n.y*o.y)/Math.sqrt((n.x*n.x+n.y*n.y)*(o.x*o.x+o.y*o.y))>-.866&&r.x*o.x+r.y*o.y<0}function ih(e,t,i){const n=t?2|e:-3&e;return i?1|n:-2&n}function nh(){const e=Math.PI/32,t=Math.tan(e),i=Ol;return i*Math.sqrt(1+2*t*t)-i}function rh(e,t,i){const n=1<{for(const i of e)s.push({polygon:i,bounds:t})},l=Math.ceil(Math.log2(i)),c=Math.ceil(Math.log2(n)),u=l-c,h=[];for(let e=0;e0?0:1);for(let e=0;et+1?p.push({polygons:d,bounds:e,depth:t+1}):a(d,e)}if(f.length){const e=[new y(0===i?u:n.x,1===i?u:n.y),s];h.length>t+1?p.push({polygons:f,bounds:e,depth:t+1}):a(f,e)}}return s}(e,t,Math.ceil((o-r)/11.25),Math.ceil((s-a)/11.25),1,((e,t,r)=>{if(0===e)return.5*(t+r);{const e=ql((i.y+t/ra)/n);return(Vl(.5*(ql((i.y+r/ra)/n)+e))*n-i.y)*ra}}))}Xr(Ku,"FillExtrusionBucket",{omit:["layers","features"]}),Xr(Xu,"PartMetadata");const oh=new zo({"fill-extrusion-edge-radius":new Po(et["layout_fill-extrusion"]["fill-extrusion-edge-radius"])});var sh={paint:new zo({"fill-extrusion-opacity":new Po(et["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Lo(et["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Po(et["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Po(et["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Lo(et["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Lo(et["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Lo(et["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Po(et["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new Po(et["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new Po(et["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-rounded-roof":new Po(et["paint_fill-extrusion"]["fill-extrusion-rounded-roof"])}),layout:oh};function ah(e,t,i){var n=2*Math.PI*6378137/256/Math.pow(2,i);return[e*n-2*Math.PI*6378137/2,t*n-2*Math.PI*6378137/2]}class lh{constructor(e,t,i){this.z=e,this.x=t,this.y=i,this.key=hh(0,e,e,t,i)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t){const i=function(e,t,i){var n=ah(256*e,256*(t=Math.pow(2,i)-t-1),i),r=ah(256*(e+1),256*(t+1),i);return n[0]+","+n[1]+","+r[0]+","+r[1]}(this.x,this.y,this.z),n=function(e,t,i){let n,r="";for(let o=e;o>0;o--)n=1<this.canonical.z?new uh(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new uh(e,this.wrap,e,this.canonical.x>>t,this.canonical.y>>t)}calculateScaledKey(e,t=!0){if(this.overscaledZ===e&&t)return this.key;if(e>this.canonical.z)return hh(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y);{const i=this.canonical.z-e;return hh(this.wrap*+t,e,e,this.canonical.x>>i,this.canonical.y>>i)}}isChildOf(e){if(e.wrap!==this.wrap)return!1;const t=this.canonical.z-e.canonical.z;return 0===e.overscaledZ||e.overscaledZ>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return[new uh(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const t=this.canonical.z+1,i=2*this.canonical.x,n=2*this.canonical.y;return[new uh(t,this.wrap,t,i,n),new uh(t,this.wrap,t,i+1,n),new uh(t,this.wrap,t,i,n+1),new uh(t,this.wrap,t,i+1,n+1)]}isLessThan(e){return this.wrape.wrap)&&(this.overscaledZe.overscaledZ)&&(this.canonical.xe.canonical.x)&&this.canonical.ye.id)),this.index=e.index,this.projection=e.projection,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((e=>{this.gradients[e.id]={}})),this.layoutVertexArray=new qo,this.layoutVertexArray2=new Go,this.indexArray=new ns,this.programConfigurations=new Ws(e.layers,e.zoom),this.segments=new na,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,i,n){this.hasPattern=xu("line",this.layers,t);const r=this.layers[0].layout.get("line-sort-key"),o=[];for(const{feature:t,id:s,index:a,sourceLayerIndex:l}of e){const e=this.layers[0]._featureFilter.needGeometry,c=nc(t,e);if(!this.layers[0]._featureFilter.filter(new wo(this.zoom),c,i))continue;const u=r?r.evaluate(c,{},i):void 0,h={id:s,properties:t.properties,type:t.type,sourceLayerIndex:l,index:a,geometry:e?c.geometry:ic(t,i,n),patterns:{},sortKey:u};o.push(h)}r&&o.sort(((e,t)=>e.sortKey-t.sortKey));const{lineAtlas:s,featureIndex:a}=t,l=this.addConstantDashes(s);for(const n of o){const{geometry:r,index:o,sourceLayerIndex:c}=n;if(l&&this.addFeatureDashes(n,s),this.hasPattern){const e=wu("line",this.layers,n,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(n,r,o,i,s.positions,t.availableImages);a.insert(e[o].feature,r,o,c,this.index)}}addConstantDashes(e){let t=!1;for(const i of this.layers){const n=i.paint.get("line-dasharray").value,r=i.layout.get("line-cap").value;if("constant"!==n.kind||"constant"!==r.kind)t=!0;else{const t=r.value,i=n.value;if(!i)continue;e.addDash(i,t)}}return t}addFeatureDashes(e,t){const i=this.zoom;for(const n of this.layers){const r=n.paint.get("line-dasharray").value,o=n.layout.get("line-cap").value;if("constant"===r.kind&&"constant"===o.kind)continue;let s,a;if("constant"===r.kind){if(s=r.value,!s)continue}else s=r.evaluate({zoom:i},e);a="constant"===o.kind?o.value:o.evaluate({zoom:i},e),t.addDash(s,a),e.patterns[n.id]=t.getKey(s,a)}}update(e,t,i,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i,n)}addFeatures(e,t,i,n,r){for(const e of this.patternFeatures)this.addFeature(e,e.geometry,e.index,t,i,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,bh)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,gh),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&e.properties.hasOwnProperty("mapbox_clip_start")&&e.properties.hasOwnProperty("mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,t,i,n,r,o){const s=this.layers[0].layout,a=s.get("line-join").evaluate(e,{}),l=s.get("line-cap").evaluate(e,{}),c=s.get("line-miter-limit"),u=s.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const i of t)this.addLine(i,e,a,l,c,u);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,r,o,n)}addLine(e,t,i,n,r,o){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineSoFar=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let t=0;t=2&&e[a-1].equals(e[a-2]);)a--;let l=0;for(;l0;if(x&&t>l){const e=h.dist(d);if(e>2*c){const t=h.sub(h.sub(d)._mult(c/e)._round());this.updateDistance(d,t),this.addCurrentVertex(t,f,0,0,u),d=t}}const E=d&&p;let T=E?i:s?"butt":n;if(E&&"round"===T&&(br&&(T="bevel"),"bevel"===T&&(b>2&&(T="flipbevel"),b100)_=m.mult(-1);else{const e=b*f.add(m).mag()/f.sub(m).mag();_._perp()._mult(e*(w?-1:1))}this.addCurrentVertex(h,_,0,0,u),this.addCurrentVertex(h,_.mult(-1),0,0,u)}else if("bevel"===T||"fakeround"===T){const e=-Math.sqrt(b*b-1),t=w?e:0,i=w?0:e;if(d&&this.addCurrentVertex(h,f,t,i,u),"fakeround"===T){const e=Math.round(180*v/Math.PI/20);for(let t=1;t2*c){const t=h.add(p.sub(h)._mult(c/e)._round());this.updateDistance(h,t),this.addCurrentVertex(t,m,0,0,u),h=t}}}}addCurrentVertex(e,t,i,n,r,o=!1){const s=t.y*n-t.x,a=-t.y-t.x*n;this.addHalfVertex(e,t.x+t.y*i,t.y-t.x*i,o,!1,i,r),this.addHalfVertex(e,s,a,o,!0,-n,r)}addHalfVertex({x:e,y:t},i,n,r,o,s,a){this.layoutVertexArray.emplaceBack((e<<1)+(r?1:0),(t<<1)+(o?1:0),Math.round(63*i)+128,Math.round(63*n)+128,1+(0===s?0:s<0?-1:1),0,this.lineSoFar),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineClips.start,this.lineClips.end);const l=a.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,l),a.primitiveLength++),o?this.e2=l:this.e1=l}updateScaledDistance(){if(this.lineClips){const e=this.totalDistance/(this.lineClips.end-this.lineClips.start);this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=e*this.lineClips.start+this.distance}else this.lineSoFar=this.distance}updateDistance(e,t){this.distance+=e.dist(t),this.updateScaledDistance()}}Xr(wh,"LineBucket",{omit:["layers","patternFeatures"]});const Eh=new zo({"line-cap":new Lo(et.layout_line["line-cap"]),"line-join":new Lo(et.layout_line["line-join"]),"line-miter-limit":new Po(et.layout_line["line-miter-limit"]),"line-round-limit":new Po(et.layout_line["line-round-limit"]),"line-sort-key":new Lo(et.layout_line["line-sort-key"])});var Th={paint:new zo({"line-opacity":new Lo(et.paint_line["line-opacity"]),"line-color":new Lo(et.paint_line["line-color"]),"line-translate":new Po(et.paint_line["line-translate"]),"line-translate-anchor":new Po(et.paint_line["line-translate-anchor"]),"line-width":new Lo(et.paint_line["line-width"]),"line-gap-width":new Lo(et.paint_line["line-gap-width"]),"line-offset":new Lo(et.paint_line["line-offset"]),"line-blur":new Lo(et.paint_line["line-blur"]),"line-dasharray":new Lo(et.paint_line["line-dasharray"]),"line-pattern":new Lo(et.paint_line["line-pattern"]),"line-gradient":new Do(et.paint_line["line-gradient"]),"line-trim-offset":new Po(et.paint_line["line-trim-offset"])}),layout:Eh};const kh=new class extends Lo{possiblyEvaluate(e,t){return t=new wo(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,i,n){return t=L({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,i,n)}}(Th.paint.properties["line-width"].specification);function Ch(e,t){return t>0?t+2*e:e}kh.useIntegerZoom=!0;const Sh=Uo([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Mh=Uo([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),Ah=Uo([{name:"a_projected_pos",components:4,type:"Float32"}],4);Uo([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Ih=Uo([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),Ph=Uo([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"}]);Uo([{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 Lh=Uo([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Dh=Uo([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);Uo([{name:"triangle",components:3,type:"Uint16"}]),Uo([{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"}]),Uo([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{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"}]),Uo([{type:"Float32",name:"offsetX"}]),Uo([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var zh=24;const Oh=128;function Bh(e,t){const{expression:i}=t;if("constant"===i.kind)return{kind:"constant",layoutSize:i.evaluate(new wo(e+1))};if("source"===i.kind)return{kind:"source"};{const{zoomStops:t,interpolationType:n}=i;let r=0;for(;r{e.text=function(e,t,i){const n=t.layout.get("text-transform").evaluate(i,{});return"uppercase"===n?e=e.toLocaleUpperCase():"lowercase"===n&&(e=e.toLocaleLowerCase()),xo.applyArabicShaping&&(e=xo.applyArabicShaping(e)),e}(e.text,t,i)})),e}const Vh={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function Nh(e){return"︶"===e||"﹈"===e||"︸"===e||"﹄"===e||"﹂"===e||"︾"===e||"︼"===e||"︺"===e||"︘"===e||"﹀"===e||"︐"===e||"︓"===e||"︔"===e||"`"===e||" ̄"===e||"︑"===e||"︒"===e}function $h(e){return"︵"===e||"﹇"===e||"︷"===e||"﹃"===e||"﹁"===e||"︽"===e||"︻"===e||"︹"===e||"︗"===e||"︿"===e}var qh=Wh,Gh=function(e,t,i,n,r){var o,s,a=8*r-n-1,l=(1<>1,u=-7,h=i?r-1:0,d=i?-1:1,p=e[t+h];for(h+=d,o=p&(1<<-u)-1,p>>=-u,u+=a;u>0;o=256*o+e[t+h],h+=d,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=n;u>0;s=256*s+e[t+h],h+=d,u-=8);if(0===o)o=1-c;else{if(o===l)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=c}return(p?-1:1)*s*Math.pow(2,o-n)},Zh=function(e,t,i,n,r,o){var s,a,l,c=8*o-r-1,u=(1<>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,f=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),(t+=s+h>=1?d/l:d*Math.pow(2,1-h))*l>=2&&(s++,l/=2),s+h>=u?(a=0,s=u):s+h>=1?(a=(t*l-1)*Math.pow(2,r),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,r),s=0));r>=8;e[i+p]=255&a,p+=f,a/=256,r-=8);for(s=s<0;e[i+p]=255&s,p+=f,s/=256,c-=8);e[i+p-f]|=128*m};function Wh(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}Wh.Varint=0,Wh.Fixed64=1,Wh.Bytes=2,Wh.Fixed32=5;var Hh=4294967296,Xh=1/Hh,Kh="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function Jh(e){return e.type===Wh.Bytes?e.readVarint()+e.pos:e.pos+1}function Yh(e,t,i){return i?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function Qh(e,t,i){var n=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));i.realloc(n);for(var r=i.pos-1;r>=e;r--)i.buf[r+n]=i.buf[r]}function ed(e,t){for(var i=0;i>>8,e[i+2]=t>>>16,e[i+3]=t>>>24}function hd(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}Wh.prototype={destroy:function(){this.buf=null},readFields:function(e,t,i){for(i=i||this.length;this.pos>3,o=this.pos;this.type=7&n,e(r,t,this),this.pos===o&&this.skip(n)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=cd(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=hd(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=cd(this.buf,this.pos)+cd(this.buf,this.pos+4)*Hh;return this.pos+=8,e},readSFixed64:function(){var e=cd(this.buf,this.pos)+hd(this.buf,this.pos+4)*Hh;return this.pos+=8,e},readFloat:function(){var e=Gh(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=Gh(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t,i,n=this.buf;return t=127&(i=n[this.pos++]),i<128?t:(t|=(127&(i=n[this.pos++]))<<7,i<128?t:(t|=(127&(i=n[this.pos++]))<<14,i<128?t:(t|=(127&(i=n[this.pos++]))<<21,i<128?t:function(e,t,i){var n,r,o=i.buf;if(n=(112&(r=o[i.pos++]))>>4,r<128)return Yh(e,n,t);if(n|=(127&(r=o[i.pos++]))<<3,r<128)return Yh(e,n,t);if(n|=(127&(r=o[i.pos++]))<<10,r<128)return Yh(e,n,t);if(n|=(127&(r=o[i.pos++]))<<17,r<128)return Yh(e,n,t);if(n|=(127&(r=o[i.pos++]))<<24,r<128)return Yh(e,n,t);if(n|=(1&(r=o[i.pos++]))<<31,r<128)return Yh(e,n,t);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(i=n[this.pos]))<<28,e,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2==1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&Kh?function(e,t,i){return Kh.decode(e.subarray(t,i))}(this.buf,t,e):function(e,t,i){for(var n="",r=t;r239?4:l>223?3:l>191?2:1;if(r+u>i)break;1===u?l<128&&(c=l):2===u?128==(192&(o=e[r+1]))&&(c=(31&l)<<6|63&o)<=127&&(c=null):3===u?(s=e[r+2],128==(192&(o=e[r+1]))&&128==(192&s)&&((c=(15&l)<<12|(63&o)<<6|63&s)<=2047||c>=55296&&c<=57343)&&(c=null)):4===u&&(s=e[r+2],a=e[r+3],128==(192&(o=e[r+1]))&&128==(192&s)&&128==(192&a)&&((c=(15&l)<<18|(63&o)<<12|(63&s)<<6|63&a)<=65535||c>=1114112)&&(c=null)),null===c?(c=65533,u=1):c>65535&&(c-=65536,n+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),n+=String.fromCharCode(c),r+=u}return n}(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==Wh.Bytes)return e.push(this.readVarint(t));var i=Jh(this);for(e=e||[];this.pos127;);else if(t===Wh.Bytes)this.pos=this.readVarint()+this.pos;else if(t===Wh.Fixed32)this.pos+=4;else{if(t!==Wh.Fixed64)throw new Error("Unimplemented type: "+t);this.pos+=8}},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t268435455||e<0?function(e,t){var i,n;if(e>=0?(i=e%4294967296|0,n=e/4294967296|0):(n=~(-e/4294967296),4294967295^(i=~(-e%4294967296))?i=i+1|0:(i=0,n=n+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,i){i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,i.buf[i.pos]=127&(e>>>=7)}(i,0,t),function(e,t){var i=(7&e)<<4;t.buf[t.pos++]|=i|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(n,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<0?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var t=this.pos;this.pos=function(e,t,i){for(var n,r,o=0;o55295&&n<57344){if(!r){n>56319||o+1===t.length?(e[i++]=239,e[i++]=191,e[i++]=189):r=n;continue}if(n<56320){e[i++]=239,e[i++]=191,e[i++]=189,r=n;continue}n=r-55296<<10|n-56320|65536,r=null}else r&&(e[i++]=239,e[i++]=191,e[i++]=189,r=null);n<128?e[i++]=n:(n<2048?e[i++]=n>>6|192:(n<65536?e[i++]=n>>12|224:(e[i++]=n>>18|240,e[i++]=n>>12&63|128),e[i++]=n>>6&63|128),e[i++]=63&n|128)}return i}(this.buf,e,this.pos);var i=this.pos-t;i>=128&&Qh(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i},writeFloat:function(e){this.realloc(4),Zh(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),Zh(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var i=0;i=128&&Qh(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n},writeMessage:function(e,t,i){this.writeTag(e,Wh.Bytes),this.writeRawMessage(t,i)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,ed,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,td,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,rd,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,id,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,nd,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,od,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,sd,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,ad,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,ld,t)},writeBytesField:function(e,t){this.writeTag(e,Wh.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,Wh.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,Wh.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,Wh.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,Wh.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,Wh.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,Wh.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,Wh.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,Wh.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,Wh.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}};var dd=d(qh);const pd=3;function fd(e,t,i){t.glyphs=[],1===e&&i.readMessage(md,t)}function md(e,t,i){if(3===e){const{id:e,bitmap:n,width:r,height:o,left:s,top:a,advance:l}=i.readMessage(_d,{});t.glyphs.push({id:e,bitmap:new zc({width:r+2*pd,height:o+2*pd},n),metrics:{width:r,height:o,left:s,top:a,advance:l}})}else 4===e?t.ascender=i.readSVarint():5===e&&(t.descender=i.readSVarint())}function _d(e,t,i){1===e?t.id=i.readVarint():2===e?t.bitmap=i.readBytes():3===e?t.width=i.readVarint():4===e?t.height=i.readVarint():5===e?t.left=i.readSVarint():6===e?t.top=i.readSVarint():7===e&&(t.advance=i.readVarint())}const gd=pd;function yd(e){let t=0,i=0;for(const n of e)t+=n.w*n.h,i=Math.max(i,n.w);e.sort(((e,t)=>t.h-e.h));const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),i),h:1/0}];let r=0,o=0;for(const t of e)for(let e=n.length-1;e>=0;e--){const i=n[e];if(!(t.w>i.w||t.h>i.h)){if(t.x=i.x,t.y=i.y,o=Math.max(o,t.y+t.h),r=Math.max(r,t.x+t.w),t.w===i.w&&t.h===i.h){const t=n.pop();ee.hasImage(t))),e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const i in e.updatedImages)this.patchUpdatedImage(this.iconPositions[i],e.getImage(i),t),this.patchUpdatedImage(this.patternPositions[i],e.getImage(i),t)}patchUpdatedImage(e,t,i){if(!e||!t)return;if(e.version===t.version)return;e.version=t.version;const[n,r]=e.tl;i.update(t.data,void 0,{x:n,y:r})}}Xr(vd,"ImagePosition"),Xr(xd,"ImageAtlas");const wd={horizontal:1,vertical:2,horizontalOnly:3},Ed=-17;class Td{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,t){const i=new Td;return i.scale=e||1,i.fontStack=t,i}static forImage(e){const t=new Td;return t.imageName=e,t}}class kd{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,t){const i=new kd;for(let n=0;n=0&&i>=e&&Sd[this.text.charCodeAt(i)];i--)t--;this.text=this.text.substring(e,t),this.sectionIndex=this.sectionIndex.slice(e,t)}substring(e,t){const i=new kd;return i.text=this.text.substring(e,t),i.sectionIndex=this.sectionIndex.slice(e,t),i.sections=this.sections,i}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((e,t)=>Math.max(e,this.sections[t].scale)),0)}addTextSection(e,t){this.text+=e.text,this.sections.push(Td.forText(e.scale,e.fontStack||t));const i=this.sections.length-1;for(let t=0;t=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Cd(e,t,i,n,r,o,s,a,l,c,u,h,d,p,f){const m=kd.fromFeature(e,r);h===wd.vertical&&m.verticalizePunctuation(d);let _=[];const g=function(e,t,i,n,r,o){if(!e)return[];const s=[],a=function(e,t,i,n,r,o){let s=0;for(let i=0;i=0;let c=0;for(let i=0;i0&&o>x&&(x=o)}else{const e=i[a.fontStack];if(!e)continue;e[m]&&(T=e[m]);const n=t[a.fontStack];if(!n)continue;const o=n.glyphs[m];if(!o)continue;if(b=o.metrics,C=8203!==m?zh:0,_){const e=void 0!==n.ascender?Math.abs(n.ascender):0,t=void 0!==n.descender?Math.abs(n.descender):0,i=(e+t)*g;w-i/2;){if(s--,s<0)return!1;a-=e[s].dist(o),o=e[s]}a+=e[s].dist(e[s+1]),s++;const l=[];let c=0;for(;an;)c-=l.shift().angleDelta;if(c>r)return!1;s++,a+=t.dist(i)}return!0}function jd(e){let t=0;for(let i=0;ic){const u=(c-l)/o,h=Pi(n.x,r.x,u),d=Pi(n.y,r.y,u),p=new Fd(h,d,0,r.angleTo(n),i);return!s||Ud(e,p,a,s,t)?p:void 0}l+=o}}function qd(e,t,i,n,r,o,s,a,l){const c=Vd(n,o,s),u=Nd(n,r),h=u*s,d=0===e[0].x||e[0].x===l||0===e[0].y||e[0].y===l;return t-h=0&&g=0&&y=0&&d+c<=u){const i=new Fd(g,y,0,m,t);i._round(),n&&!Ud(e,i,o,n,r)||p.push(i)}}h+=f}return a||p.length||s||(p=Gd(e,h/2,i,n,r,o,s,!0,l)),p}function Zd(e,t,i,n,r){const o=[];for(let s=0;s=n&&c.x>=n||(s.x>=n?s=new y(n,s.y+(n-s.x)/(c.x-s.x)*(c.y-s.y))._round():c.x>=n&&(c=new y(n,s.y+(n-s.x)/(c.x-s.x)*(c.y-s.y))._round()),s.y>=r&&c.y>=r||(s.y>=r?s=new y(s.x+(r-s.y)/(c.y-s.y)*(c.x-s.x),r)._round():c.y>=r&&(c=new y(s.x+(r-s.y)/(c.y-s.y)*(c.x-s.x),r)._round()),l&&s.equals(l[l.length-1])||(l=[s],o.push(l)),l.push(c)))))}}return o}Xr(Fd,"Anchor");const Wd=1e20;function Hd(e,t,i,n,r,o,s,a,l){for(let c=t;c-1);l++,o[l]=a,s[l]=c,s[l+1]=Wd}for(let a=0,l=0;a{let n=this.entries[e];n||(n=this.entries[e]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let r=n.glyphs[t];if(void 0!==r)return void i(null,{stack:e,id:t,glyph:r});if(r=this._tinySDF(n,e,t),r)return n.glyphs[t]=r,void i(null,{stack:e,id:t,glyph:r});const o=Math.floor(t/256);if(256*o>65535)return void i(new Error("glyphs > 65535 not supported"));if(n.ranges[o])return void i(null,{stack:e,id:t,glyph:r});let s=n.requests[o];s||(s=n.requests[o]=[],Yd.loadGlyphRange(e,o,this.url,this.requestManager,((e,t)=>{if(t){n.ascender=t.ascender,n.descender=t.descender;for(const e in t.glyphs)this._doesCharSupportLocalGlyph(+e)||(n.glyphs[+e]=t.glyphs[+e]);n.ranges[o]=!0}for(const i of s)i(e,t);delete n.requests[o]}))),s.push(((n,r)=>{n?i(n):r&&i(null,{stack:e,id:t,glyph:r.glyphs[t]||null})}))}),((e,i)=>{if(e)t(e);else if(i){const e={};for(const{stack:t,id:n,glyph:r}of i)void 0===e[t]&&(e[t]={}),void 0===e[t].glyphs&&(e[t].glyphs={}),e[t].glyphs[n]=r&&{id:r.id,bitmap:r.bitmap.clone(),metrics:r.metrics},e[t].ascender=this.entries[t].ascender,e[t].descender=this.entries[t].descender;t(null,e)}}))}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==Jd.none&&(this.localGlyphMode===Jd.all?!!this.localFontFamily:!!this.localFontFamily&&(eo["CJK Unified Ideographs"](e)||eo["Hangul Syllables"](e)||eo.Hiragana(e)||eo.Katakana(e)||eo["CJK Symbols and Punctuation"](e)))}_tinySDF(e,t,i){const n=this.localFontFamily;if(!n||!this._doesCharSupportLocalGlyph(i))return;let r=e.tinySDF;if(!r){let i="400";/bold/i.test(t)?i="900":/medium/i.test(t)?i="500":/light/i.test(t)&&(i="200"),r=e.tinySDF=new Yd.TinySDF({fontFamily:n,fontWeight:i,fontSize:24*Kd,buffer:3*Kd,radius:8*Kd}),r.fontWeight=i}if(this.localGlyphs[r.fontWeight][i])return this.localGlyphs[r.fontWeight][i];const o=String.fromCharCode(i),{data:s,width:a,height:l,glyphWidth:c,glyphHeight:u,glyphLeft:h,glyphTop:d,glyphAdvance:p}=r.draw(o);return this.localGlyphs[r.fontWeight][i]={id:i,bitmap:new zc({width:a,height:l},s),metrics:{width:c/Kd,height:u/Kd,left:h/Kd,top:d/Kd-27,advance:p/Kd,localGlyph:!0}}}}Yd.loadGlyphRange=function(e,t,i,n,r){const o=256*t,s=o+255,a=n.transformRequest(n.normalizeGlyphsURL(i).replace("{fontstack}",e).replace("{range}",`${o}-${s}`),le.Glyphs);de(a,((e,t)=>{if(e)r(e);else if(t){const e={},i=function(e){return new dd(e).readFields(fd,{})}(t);for(const t of i.glyphs)e[t.id]=t;r(null,{glyphs:e,ascender:i.ascender,descender:i.descender})}}))},Yd.TinySDF=class{constructor({fontSize:e=24,buffer:t=3,radius:i=8,cutoff:n=.25,fontFamily:r="sans-serif",fontWeight:o="normal",fontStyle:s="normal"}={}){this.buffer=t,this.cutoff=n,this.radius=i;const a=this.size=e+4*t,l=this._createCanvas(a),c=this.ctx=l.getContext("2d",{willReadFrequently:!0});c.font=`${s} ${o} ${e}px ${r}`,c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(a*a),this.gridInner=new Float64Array(a*a),this.f=new Float64Array(a),this.z=new Float64Array(a+1),this.v=new Uint16Array(a)}_createCanvas(e){const t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){const{width:t,actualBoundingBoxAscent:i,actualBoundingBoxDescent:n,actualBoundingBoxLeft:r,actualBoundingBoxRight:o}=this.ctx.measureText(e),s=Math.ceil(i),a=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o-r))),l=Math.min(this.size-this.buffer,s+Math.ceil(n)),c=a+2*this.buffer,u=l+2*this.buffer,h=Math.max(c*u,0),d=new Uint8ClampedArray(h),p={data:d,width:c,height:u,glyphWidth:a,glyphHeight:l,glyphTop:s,glyphLeft:0,glyphAdvance:t};if(0===a||0===l)return p;const{ctx:f,buffer:m,gridInner:_,gridOuter:g}=this;f.clearRect(m,m,a,l),f.fillText(e,m,m+s);const y=f.getImageData(m,m,a,l);g.fill(Wd,0,h),_.fill(0,0,h);for(let e=0;e0?e*e:0,_[n]=e<0?e*e:0}}Hd(g,0,0,c,u,c,this.f,this.v,this.z),Hd(_,m,m,a,l,c,this.f,this.v,this.z);for(let e=0;ee+t[1]-t[0],f=h.reduce(p,0),m=d.reduce(p,0),_=a-f,g=l-m;let b=0,v=f,x=0,w=m,E=0,T=_,k=0,C=g;if(o.content&&n){const e=o.content;b=tp(h,0,e[0]),x=tp(d,0,e[1]),v=tp(h,e[0],e[2]),w=tp(d,e[1],e[3]),E=e[0]-b,k=e[1]-x,T=e[2]-e[0]-v,C=e[3]-e[1]-w}const S=(n,r,a,l)=>{const h=np(n.stretch-b,v,c,e.left),d=rp(n.fixed-E,T,n.stretch,f),p=np(r.stretch-x,w,u,e.top),_=rp(r.fixed-k,C,r.stretch,m),g=np(a.stretch-b,v,c,e.left),S=rp(a.fixed-E,T,a.stretch,f),M=np(l.stretch-x,w,u,e.top),A=rp(l.fixed-k,C,l.stretch,m),I=new y(h,p),P=new y(g,p),L=new y(g,M),D=new y(h,M),z=new y(d/s,_/s),O=new y(S/s,A/s),B=t*Math.PI/180;if(B){const e=Math.sin(B),t=Math.cos(B),i=[t,-e,e,t];I._matMult(i),P._matMult(i),D._matMult(i),L._matMult(i)}const R=n.stretch+n.fixed,F=r.stretch+r.fixed;return{tl:I,tr:P,bl:D,br:L,tex:{x:o.paddedRect.x+Qd+R,y:o.paddedRect.y+Qd+F,w:a.stretch+a.fixed-R,h:l.stretch+l.fixed-F},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:z,pixelOffsetBR:O,minFontScaleX:T/s/c,minFontScaleY:C/s/u,isSDF:i}};if(n&&(o.stretchX||o.stretchY)){const e=ip(h,_,f),t=ip(d,g,m);for(let i=0;i0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const e=this.data[0],t=this.data.pop();return this.length--,this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:i}=this,n=t[e];for(;e>0;){const r=e-1>>1,o=t[r];if(i(n,o)>=0)break;t[e]=o,e=r}t[e]=n}_down(e){const{data:t,compare:i}=this,n=this.length>>1,r=t[e];for(;e=0)break;t[e]=o,e=n}t[e]=r}}function ap(e,t){return et?1:0}function lp(e,t=1,i=!1){let n=1/0,r=1/0,o=-1/0,s=-1/0;const a=e[0];for(let e=0;eo)&&(o=t.x),(!e||t.y>s)&&(s=t.y)}const l=Math.min(o-n,s-r);let c=l/2;const u=new sp([],cp);if(0===l)return new y(n,r);for(let t=n;th.d||!h.d)&&(h=n,i&&console.log("found best %d after %d probes",Math.round(1e4*n.d)/1e4,d)),n.max-h.d<=t||(c=n.h/2,u.push(new up(n.p.x-c,n.p.y-c,c,e)),u.push(new up(n.p.x+c,n.p.y-c,c,e)),u.push(new up(n.p.x-c,n.p.y+c,c,e)),u.push(new up(n.p.x+c,n.p.y+c,c,e)),d+=4)}return i&&(console.log(`num probes: ${d}`),console.log(`best distance: ${h.d}`)),h.p}function cp(e,t){return t.max-e.max}class up{constructor(e,t,i,n){this.p=new y(e,t),this.h=i,this.d=function(e,t){let i=!1,n=1/0;for(let r=0;re.y!=a.y>e.y&&e.x<(a.x-r.x)*(e.y-r.y)/(a.y-r.y)+r.x&&(i=!i),n=Math.min(n,fc(e,r,a))}}return(i?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}}const hp=7,dp=Number.POSITIVE_INFINITY,pp=Math.sqrt(2);function fp(e,[t,i]){let n=0,r=0;if(i===dp){t<0&&(t=0);const i=t/pp;switch(e){case"top-right":case"top-left":r=i-hp;break;case"bottom-right":case"bottom-left":r=-i+hp;break;case"bottom":r=-t+hp;break;case"top":r=t-hp}switch(e){case"top-right":case"bottom-right":n=-i;break;case"top-left":case"bottom-left":n=i;break;case"left":n=t;break;case"right":n=-t}}else{switch(t=Math.abs(t),i=Math.abs(i),e){case"top-right":case"top-left":case"top":r=i-hp;break;case"bottom-right":case"bottom-left":case"bottom":r=-i+hp}switch(e){case"top-right":case"bottom-right":case"right":n=-t;break;case"top-left":case"bottom-left":case"left":n=t}}return[n,r]}function mp(e,t,i,n,r,o,s,a,l,c){e.createArrays(),e.tilePixelRatio=ra/(512*e.overscaling),e.compareText={},e.iconsNeedLinear=!1;const u=e.layers[0].layout,h=e.layers[0]._unevaluatedLayout._values,d={};if("composite"===e.textSizeData.kind){const{minZoom:t,maxZoom:i}=e.textSizeData;d.compositeTextSizes=[h["text-size"].possiblyEvaluate(new wo(t),a),h["text-size"].possiblyEvaluate(new wo(i),a)]}if("composite"===e.iconSizeData.kind){const{minZoom:t,maxZoom:i}=e.iconSizeData;d.compositeIconSizes=[h["icon-size"].possiblyEvaluate(new wo(t),a),h["icon-size"].possiblyEvaluate(new wo(i),a)]}d.layoutTextSize=h["text-size"].possiblyEvaluate(new wo(l+1),a),d.layoutIconSize=h["icon-size"].possiblyEvaluate(new wo(l+1),a),d.textMaxSize=h["text-size"].possiblyEvaluate(new wo(18),a);const p="map"===u.get("text-rotation-alignment")&&"point"!==u.get("symbol-placement"),f=u.get("text-size");for(const o of e.features){const l=u.get("text-font").evaluate(o,{},a).join(","),h=f.evaluate(o,{},a),m=d.layoutTextSize.evaluate(o,{},a),_=(d.layoutIconSize.evaluate(o,{},a),{horizontal:{},vertical:void 0}),g=o.text;let y,b=[0,0];if(g){const n=g.toString(),s=u.get("text-letter-spacing").evaluate(o,{},a)*zh,c=u.get("text-line-height").evaluate(o,{},a)*zh,d=io(n)?s:0,f=u.get("text-anchor").evaluate(o,{},a),y=u.get("text-variable-anchor");if(!y){const e=u.get("text-radial-offset").evaluate(o,{},a);b=e?fp(f,[e*zh,dp]):u.get("text-offset").evaluate(o,{},a).map((e=>e*zh))}let v=p?"center":u.get("text-justify").evaluate(o,{},a);const x="point"===u.get("symbol-placement"),w=x?u.get("text-max-width").evaluate(o,{},a)*zh:1/0,E=o=>{e.allowVerticalPlacement&&to(n)&&(_.vertical=Cd(g,t,i,r,l,w,c,f,o,d,b,wd.vertical,!0,m,h))};if(!p&&y){const e="auto"===v?y.map((e=>_p(e))):[v];let n=!1;for(let o=0;o=0||!to(n)){const e=Cd(g,t,i,r,l,w,c,f,v,d,b,wd.horizontal,!1,m,h);e&&(_.horizontal[v]=e)}E(x?"left":v)}}let v=!1;if(o.icon&&o.icon.name){const t=n[o.icon.name];t&&(y=Bd(r[o.icon.name],u.get("icon-offset").evaluate(o,{},a),u.get("icon-anchor").evaluate(o,{},a)),v=t.sdf,void 0===e.sdfIcons?e.sdfIcons=t.sdf:e.sdfIcons!==t.sdf&&q("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(t.pixelRatio!==e.pixelRatio||0!==u.get("icon-rotate").constantOr(1))&&(e.iconsNeedLinear=!0))}const x=xp(_.horizontal)||_.vertical;e.iconsInText||(e.iconsInText=!!x&&x.iconsInText),(x||y)&&gp(e,o,_,y,n,d,m,0,b,v,s,a,c)}o&&e.generateCollisionDebugBuffers(l,e.collisionBoxArray)}function _p(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function gp(e,t,i,n,r,o,s,a,l,c,u,h,d){let p=o.textMaxSize.evaluate(t,{},h);void 0===p&&(p=s);const f=e.layers[0].layout,m=f.get("icon-offset").evaluate(t,{},h),_=xp(i.horizontal)||i.vertical,g="globe"===d.name,y=zh,b=s/y,v=e.tilePixelRatio*p/y,w=(I=e.overscaling,e.zoom>18&&I>2&&(I>>=1),Math.max(ra/(512*I),1)*f.get("symbol-spacing")),E=f.get("text-padding")*e.tilePixelRatio,T=f.get("icon-padding")*e.tilePixelRatio,k=x(f.get("text-max-angle")),C="map"===f.get("text-rotation-alignment")&&"point"!==f.get("symbol-placement"),S="map"===f.get("icon-rotation-alignment")&&"point"!==f.get("symbol-placement"),M=f.get("symbol-placement"),A=w/2;var I;const P=f.get("icon-text-fit");let L;n&&"none"!==P&&(e.allowVerticalPlacement&&i.vertical&&(L=Rd(n,i.vertical,P,f.get("icon-text-fit-padding"),m,b)),_&&(n=Rd(n,_,P,f.get("icon-text-fit-padding"),m,b)));const D=(s,a,p)=>{if(a.x<0||a.x>=ra||a.y<0||a.y>=ra)return;let f=null;if(g){const{x:e,y:t,z:i}=d.projectTilePoint(a.x,a.y,p);f={anchor:new Fd(e,t,i,0,void 0),up:d.upVector(p,a.x,a.y)}}!function(e,t,i,n,r,o,s,a,l,c,u,h,d,p,f,m,_,g,y,b,v,x,w,E,T){const k=e.addToLineVertexArray(t,n);let C,S,M,A,I,P,L,D=0,z=0,O=0,B=0,R=-1,F=-1;const U={};let j=Ms("");const V=i?i.anchor:t;let N=0,$=0;if(void 0===l._unevaluatedLayout.getValue("text-radial-offset")?[N,$]=l.layout.get("text-offset").evaluate(v,{},T).map((e=>e*zh)):(N=l.layout.get("text-radial-offset").evaluate(v,{},T)*zh,$=dp),e.allowVerticalPlacement&&r.vertical){const e=r.vertical;if(f)P=Ep(e),a&&(L=Ep(a));else{const i=l.layout.get("text-rotate").evaluate(v,{},T)+90;M=wp(c,V,t,u,h,d,e,p,i,m),a&&(A=wp(c,V,t,u,h,d,a,g,i))}}if(o){const n=l.layout.get("icon-rotate").evaluate(v,{},T),r="none"!==l.layout.get("icon-text-fit"),s=ep(o,n,w,r),p=a?ep(a,n,w,r):void 0;S=wp(c,V,t,u,h,d,o,g,n),D=4*s.length;const f=e.iconSizeData;let m=null;"source"===f.kind?(m=[Oh*l.layout.get("icon-size").evaluate(v,{},T)],m[0]>bp&&q(`${e.layerIds[0]}: Value for "icon-size" is >= ${yp}. Reduce your "icon-size".`)):"composite"===f.kind&&(m=[Oh*x.compositeIconSizes[0].evaluate(v,{},T),Oh*x.compositeIconSizes[1].evaluate(v,{},T)],(m[0]>bp||m[1]>bp)&&q(`${e.layerIds[0]}: Value for "icon-size" is >= ${yp}. Reduce your "icon-size".`)),e.addSymbols(e.icon,s,m,b,y,v,!1,i,t,k.lineStartIndex,k.lineLength,-1,E,T),R=e.icon.placedSymbolArray.length-1,p&&(z=4*p.length,e.addSymbols(e.icon,p,m,b,y,v,wd.vertical,i,t,k.lineStartIndex,k.lineLength,-1,E,T),F=e.icon.placedSymbolArray.length-1)}for(const n in r.horizontal){const o=r.horizontal[n];C||(j=Ms(o.text),f?I=Ep(o):C=wp(c,V,t,u,h,d,o,p,l.layout.get("text-rotate").evaluate(v,{},T),m));const a=1===o.positionedLines.length;if(O+=vp(e,i,t,o,s,l,f,v,m,k,r.vertical?wd.horizontal:wd.horizontalOnly,a?Object.keys(r.horizontal):[n],U,R,x,E,T),a)break}r.vertical&&(B+=vp(e,i,t,r.vertical,s,l,f,v,m,k,wd.vertical,["vertical"],U,F,x,E,T));let G=-1;const Z=(e,t)=>e?Math.max(e,t):t;G=Z(I,G),G=Z(P,G),G=Z(L,G);const W=G>-1?1:0;e.glyphOffsetArray.length>=nf.MAX_GLYPHS&&q("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==v.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,v.sortKey),e.symbolInstances.emplaceBack(V.x,V.y,V.z,t.x,t.y,U.right>=0?U.right:-1,U.center>=0?U.center:-1,U.left>=0?U.left:-1,U.vertical>=0?U.vertical:-1,R,F,j,void 0!==C?C:e.collisionBoxArray.length,void 0!==C?C+1:e.collisionBoxArray.length,void 0!==M?M:e.collisionBoxArray.length,void 0!==M?M+1:e.collisionBoxArray.length,void 0!==S?S:e.collisionBoxArray.length,void 0!==S?S+1:e.collisionBoxArray.length,A||e.collisionBoxArray.length,A?A+1:e.collisionBoxArray.length,u,O,B,D,z,W,0,N,$,G)}(e,a,f,s,i,n,r,L,e.layers[0],e.collisionBoxArray,t.index,t.sourceLayerIndex,e.index,E,C,l,0,T,S,m,t,o,c,u,h)};if("line"===M)for(const r of Zd(t.geometry,0,0,ra,ra)){const t=qd(r,w,k,i.vertical||_,n,y,v,e.overscaling,ra);for(const i of t)_&&Tp(e,_.text,A,i)||D(r,i,h)}else if("line-center"===M){for(const e of t.geometry)if(e.length>1){const t=$d(e,k,i.vertical||_,n,y,v);t&&D(e,t,h)}}else if("Polygon"===t.type)for(const e of bu(t.geometry,0)){const t=lp(e,16);D(e[0],new Fd(t.x,t.y,0,0,void 0),h)}else if("LineString"===t.type)for(const e of t.geometry)D(e,new Fd(e[0].x,e[0].y,0,0,void 0),h);else if("Point"===t.type)for(const e of t.geometry)for(const t of e)D([t],new Fd(t.x,t.y,0,0,void 0),h)}const yp=255,bp=yp*Oh;function vp(e,t,i,n,r,o,s,a,l,c,u,h,d,p,f,m,_){const g=function(e,t,i,n,r,o,s,a){const l=[];if(0===t.positionedLines.length)return l;const c=n.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,u=function(e){const t=e[0],i=e[1],n=t*i;return n>0?[t,-i]:n<0?[-t,i]:0===t?[i,t]:[i,-t]}(i);let h=Math.abs(t.top-t.bottom);for(const e of t.positionedLines)h-=e.lineOffset;const d=t.positionedLines.length,p=h/d;let f=t.top-i[1];for(let e=0;ebp&&q(`${e.layerIds[0]}: Value for "text-size" is >= ${yp}. Reduce your "text-size".`)):"composite"===b.kind&&(v=[Oh*f.compositeTextSizes[0].evaluate(a,{},_),Oh*f.compositeTextSizes[1].evaluate(a,{},_)],(v[0]>bp||v[1]>bp)&&q(`${e.layerIds[0]}: Value for "text-size" is >= ${yp}. Reduce your "text-size".`)),e.addSymbols(e.text,g,v,l,s,a,u,t,i,c.lineStartIndex,c.lineLength,p,m,_);for(const t of h)d[t]=e.text.placedSymbolArray.length-1;return 4*g.length}function xp(e){for(const t in e)return e[t];return null}function wp(e,t,i,n,r,o,s,a,l,c){let u=s.top,h=s.bottom,d=s.left,p=s.right;const f=s.collisionPadding;if(f&&(d-=f[0],u-=f[1],p+=f[2],h+=f[3]),l){const e=new y(d,u),t=new y(p,u),i=new y(d,h),n=new y(p,h),r=x(l);let o=new y(0,0);c&&(o=new y(c[0],c[1])),e._rotateAround(r,o),t._rotateAround(r,o),i._rotateAround(r,o),n._rotateAround(r,o),d=Math.min(e.x,t.x,i.x,n.x),p=Math.max(e.x,t.x,i.x,n.x),u=Math.min(e.y,t.y,i.y,n.y),h=Math.max(e.y,t.y,i.y,n.y)}return e.emplaceBack(t.x,t.y,t.z,i.x,i.y,d,u,p,h,a,n,r,o),e.length-1}function Ep(e){e.collisionPadding&&(e.top-=e.collisionPadding[1],e.bottom+=e.collisionPadding[3]);const t=e.bottom-e.top;return t>0?Math.max(10,t):null}function Tp(e,t,i,n){const r=e.compareText;if(t in r){const e=r[t];for(let t=e.length-1;t>=0;t--)if(n.dist(e[t])b&&(v(e,c,n,r,a,l),v(c,i,a,l,o,s))}v(h,d,n,o,r,o),v(d,p,r,o,r,s),v(p,f,r,s,n,s),v(f,h,n,s,n,o),m-=b,_-=b,g+=b,y+=b;const x=1/Math.max(g-m,y-_);return{scale:x,x:m*x,y:_*x,x2:g*x,y2:y*x,projection:t}}const Sp=ua(new Float32Array(16));class Mp{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,t){return{x:0,y:0,z:0}}unproject(e,t){return new Fl(0,0)}projectTilePoint(e,t,i){return{x:e,y:t,z:0}}locationPoint(e,t,i=!0){return e._coordinatePoint(e.locationCoordinate(t),i)}pixelsPerMeter(e,t){return Nl(1,e)*t}pixelSpaceConversion(e,t,i){return 1}farthestPixelDistance(e){return kp(e,e.pixelsPerMeter)}pointCoordinate(e,t,i,n){const r=e.horizonLineFromTop(!1),o=new y(t,Math.max(r,i));return e.rayIntersectionCoordinate(e.pointRayIntersection(o,n))}pointCoordinate3D(e,t,i){const n=new y(t,i);if(e.elevation)return e.elevation.pointCoordinate(n);{const t=this.pointCoordinate(e,n.x,n.y,0);return[t.x,t.y,t.z]}}isPointAboveHorizon(e,t){if(e.elevation)return!this.pointCoordinate3D(e,t.x,t.y);const i=e.horizonLineFromTop();return t.y0?t<-Rp+i&&(t=-Rp+i):t>Rp-i&&(t=Rp-i);const o=r/Math.pow(Fp(t),n);let s=o*Math.sin(n*e),a=r-o*Math.cos(n*e);return s=.5*(s/Math.PI+.5),a=.5*(a/Math.PI+.5),{x:s,y:this.southernCenter?a:1-a,z:0}}unproject(e,t){e=(2*e-.5)*Math.PI,this.southernCenter&&(t=1-t),t=(2*(1-t)-.5)*Math.PI;const{n:i,f:n}=this,r=n-t,o=Math.sign(r),s=Math.sign(i)*Math.sqrt(e*e+r*r);let a=Math.atan2(e,Math.abs(r))*o;r*i<0&&(a-=Math.PI*Math.sign(e)*o);const l=S(w(a/i)+this.center[0],-180,180),c=S(w(2*Math.atan(Math.pow(n/s,1/i))-Rp),-Zl,Zl);return new Fl(l,this.southernCenter?-c:c)}}class jp extends Mp{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,t){return{x:jl(e),y:Vl(t),z:0}}unproject(e,t){const i=$l(e),n=ql(t);return new Fl(i,n)}}const Vp=x(Zl);class Np extends Mp{project(e,t){const i=(t=x(t))*t,n=i*i;return{x:.5*((e=x(e))*(.8707-.131979*i+n*(n*(.003971*i-.001529*n)-.013791))/Math.PI+.5),y:1-.5*(t*(1.007226+i*(.015085+n*(.028874*i-.044475-.005916*n)))/Math.PI+1),z:0}}unproject(e,t){e=(2*e-.5)*Math.PI;let i=t=(2*(1-t)-1)*Math.PI,n=25,r=0,o=i*i;do{o=i*i;const e=o*o;r=(i*(1.007226+o*(.015085+e*(.028874*o-.044475-.005916*e)))-t)/(1.007226+o*(.045255+e*(.259866*o-.311325-.005916*11*e))),i=S(i-r,-Vp,Vp)}while(Math.abs(r)>1e-6&&--n>0);o=i*i;const s=S(w(e/(.8707+o*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979))),-180,180),a=w(i);return new Fl(s,a)}}const $p=x(Zl);class qp extends Mp{project(e,t){t=x(t),e=x(e);const i=Math.cos(t),n=2/Math.PI,r=Math.acos(i*Math.cos(e/2)),o=Math.sin(r)/r,s=.5*(e*n+2*i*Math.sin(e/2)/o)||0,a=.5*(t+Math.sin(t)/o)||0;return{x:.5*(s/Math.PI+.5),y:1-.5*(a/Math.PI+1),z:0}}unproject(e,t){let i=e=(2*e-.5)*Math.PI,n=t=(2*(1-t)-1)*Math.PI,r=25;const o=1e-6;let s=0,a=0;do{const r=Math.cos(n),o=Math.sin(n),l=2*o*r,c=o*o,u=r*r,h=Math.cos(i/2),d=Math.sin(i/2),p=2*h*d,f=d*d,m=1-u*h*h,_=m?1/m:0,g=m?Math.acos(r*h)*Math.sqrt(1/m):0,y=.5*(2*g*r*d+2*i/Math.PI)-e,b=.5*(g*o+n)-t,v=.5*_*(u*f+g*r*h*c)+1/Math.PI,x=_*(p*l/4-g*o*d),w=.125*_*(l*d-g*o*u*p),E=.5*_*(c*h+g*f*r)+.5,T=x*w-E*v;s=(b*x-y*E)/T,a=(y*w-b*v)/T,i=S(i-s,-Math.PI,Math.PI),n=S(n-a,-$p,$p)}while((Math.abs(s)>o||Math.abs(a)>o)&&--r>0);return new Fl(w(i),w(n))}}class Gp extends Mp{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(x(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(e,t){const{scale:i,cosPhi:n}=this;return{x:x(e)*n*i+.5,y:-Math.sin(x(t))/n*i+.5,z:0}}unproject(e,t){const{scale:i,cosPhi:n}=this,r=-(t-.5)/i,o=S(w((e-.5)/i)/n,-180,180),s=Math.asin(S(r*n,-1,1)),a=S(w(s),-Zl,Zl);return new Fl(o,a)}}class Zp extends jp{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,t,i){const n=El(e,t,i);return za(n,n,Cl(ml(i))),{x:n[0],y:n[1],z:n[2]}}locationPoint(e,t){const i=wl(t.lat,t.lng),n=Pa([],i),r=e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(t),e._centerAltitude):e._centerAltitude;Ia(i,i,n,Nl(1,0)*ra*r);const o=ua(new Float64Array(16));return da(o,e.pixelMatrix,e.globeMatrix),za(i,i,o),new y(i[0],i[1])}pixelsPerMeter(e,t){return Nl(1,0)*t}pixelSpaceConversion(e,t,i){const n=Nl(1,e)*t,r=Pi(Nl(1,45)*t,n,i);return this.pixelsPerMeter(e,t)/r}createTileMatrix(e,t,i){const n=Sl(ml(i.canonical));return da(new Float64Array(16),e.globeMatrix,n)}createInversionMatrix(e,t){const{center:i}=e,n=Cl(ml(t));return _a(n,n,x(i.lng)),ma(n,n,x(i.lat)),fa(n,n,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(n)}pointCoordinate(e,t,i,n){return dl(e,t,i,!0)||new Hl(0,0)}pointCoordinate3D(e,t,i){const n=this.pointCoordinate(e,t,i,0);return[n.x,n.y,n.z]}isPointAboveHorizon(e,t){return!dl(e,t.x,t.y,!1)}farthestPixelDistance(e){const t=function(e,t){const i=e.cameraToCenterDistance,n=e._centerAltitude*t,r=e._camera,o=e._camera.forward(),s=Ta([],Aa([],o,-i),[0,0,n]),a=e.worldSize/(2*Math.PI),l=[0,0,-a],c=e.width/e.height,u=Math.tan(e.fovAboveCenter),h=Aa([],r.up(),u),d=Aa([],r.right(),u*c),p=Pa([],Ta([],Ta([],o,h),d)),f=[];let m;if(new Ya(s,p).closestPointOnSphere(l,a,f)){const t=Ta([],f,l),i=Ra([],t,s);m=Math.cos(e.fovAboveCenter)*wa(i)}else{const e=Ra([],s,l),t=Ra([],l,s);Pa(t,t);const i=wa(e)-a;m=Math.sqrt(i*(i+2*a));const n=Math.acos(m/(a+i))-Math.acos(La(o,t));m*=Math.cos(n)}return 1.01*m}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),i=Al(e.zoom);if(i>0){const n=kp(e,Nl(1,e.center.lat)*e.worldSize),r=e.worldSize/(2*Math.PI),o=Math.max(e.width,e.height)/e.worldSize*Math.PI;return Pi(t,n+r*(1-Math.cos(o)),Math.pow(i,10))}return t}upVector(e,t,i){return El(t,i,e,1)}upVectorScale(e){return{metersToTile:hl(Tl(ml(e)))}}}function Wp(e){const t=e.parallels,i=!!t&&Math.abs(t[0]+t[1])<.01;switch(e.name){case"mercator":return new jp(e);case"equirectangular":return new Bp(e);case"naturalEarth":return new Np(e);case"equalEarth":return new Op(e);case"winkelTripel":return new qp(e);case"albers":return i?new Gp(e):new Ap(e);case"lambertConformalConic":return i?new Gp(e):new Up(e);case"globe":return new Zp(e)}throw new Error(`Invalid projection name: ${e.name}`)}const Hp=$u.types,Xp=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Kp(e,t,i,n,r,o,s,a,l,c,u,h,d){const p=a?Math.min(bp,Math.round(a[0])):0,f=a?Math.min(bp,Math.round(a[1])):0;e.emplaceBack(t,i,Math.round(32*n),Math.round(32*r),o,s,(p<<1)+(l?1:0),f,16*c,16*u,256*h,256*d)}function Jp(e,t,i,n,r,o,s){e.emplaceBack(t,i,n,r,o,s)}function Yp(e,t,i,n,r){e.emplaceBack(t,i,n,r),e.emplaceBack(t,i,n,r),e.emplaceBack(t,i,n,r),e.emplaceBack(t,i,n,r)}function Qp(e){for(const t of e.sections)if(lo(t.text))return!0;return!1}class ef{constructor(e){this.layoutVertexArray=new Xo,this.indexArray=new ns,this.programConfigurations=e,this.segments=new na,this.dynamicLayoutVertexArray=new Go,this.opacityVertexArray=new Jo,this.placedSymbolArray=new ms,this.globeExtVertexArray=new Ko}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(e,t,i,n){this.isEmpty()||(i&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Sh.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Ah.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,Xp,!0),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,Mh.members,!0)),this.opacityVertexBuffer.itemSize=1),(i||n)&&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.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}}Xr(ef,"SymbolBuffers");class tf{constructor(e,t,i){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new i,this.segments=new na,this.collisionVertexArray=new ts,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,Ih.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,Ph.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}Xr(tf,"CollisionBuffers");class nf{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=ua([]),this.placementViewportMatrix=ua([]);const t=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Bh(this.zoom,t["text-size"]),this.iconSizeData=Bh(this.zoom,t["icon-size"]);const i=this.layers[0].layout,n=i.get("symbol-sort-key"),r=i.get("symbol-z-order");this.canOverlap=i.get("text-allow-overlap")||i.get("icon-allow-overlap")||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==r&&void 0!==n.constantOr(1),this.sortFeaturesByY=("viewport-y"===r||"auto"===r&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=i.get("text-writing-mode").map((e=>wd[e])),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.sourceID=e.sourceID,this.projection=e.projection}createArrays(){this.text=new ef(new Ws(this.layers,this.zoom,(e=>/^text/.test(e)))),this.icon=new ef(new Ws(this.layers,this.zoom,(e=>/^icon/.test(e)))),this.glyphOffsetArray=new ys,this.lineVertexArray=new bs,this.symbolInstances=new gs}calculateGlyphDependencies(e,t,i,n,r){for(let i=0;i0)&&("constant"!==a.value.kind||a.value.value.length>0),h="constant"!==c.value.kind||!!c.value.value||Object.keys(c.parameters).length>0,d=o.get("symbol-sort-key");if(this.features=[],!u&&!h)return;const p=t.iconDependencies,f=t.glyphDependencies,m=t.availableImages,_=new wo(this.zoom);for(const{feature:t,id:l,index:c,sourceLayerIndex:g}of e){const e=r._featureFilter.needGeometry,y=nc(t,e);if(!r._featureFilter.filter(_,y,i))continue;if(e||(y.geometry=ic(t,i,n)),s&&1!==t.type&&i.z<=5){const e=y.geometry,t=.98078528056,n=(e,n)=>La(El(e.x,e.y,i,1),El(n.x,n.y,i,1))=0;for(const i of b.sections)if(i.image)p[i.image.name]=!0;else{const n=to(b.toString()),r=i.fontStack||e,o=f[r]=f[r]||{};this.calculateGlyphDependencies(i.text,o,t,this.allowVerticalPlacement,n)}}}"line"===o.get("symbol-placement")&&(this.features=function(e){const t={},i={},n=[];let r=0;function o(t){n.push(e[t]),r++}function s(e,t,r){const o=i[e];return delete i[e],i[t]=o,n[o].geometry[0].pop(),n[o].geometry[0]=n[o].geometry[0].concat(r[0]),o}function a(e,i,r){const o=t[i];return delete t[i],t[e]=o,n[o].geometry[0].shift(),n[o].geometry[0]=r[0].concat(n[o].geometry[0]),o}function l(e,t,i){const n=i?t[0][t[0].length-1]:t[0][0];return`${e}:${n.x}:${n.y}`}for(let c=0;ce.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((e,t)=>e.sortKey-t.sortKey))}update(e,t,i,n){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,i,n),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,i,n))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=Wp(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,t){const i=this.lineVertexArray.length;if(void 0!==e.segment)for(const{x:e,y:i}of t)this.lineVertexArray.emplaceBack(e,i);return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}addSymbols(e,t,i,n,r,o,s,a,l,c,u,h,d,p){const f=e.indexArray,m=e.layoutVertexArray,_=e.globeExtVertexArray,g=e.segments.prepareSegment(4*t.length,m,f,this.canOverlap?o.sortKey:void 0),y=this.glyphOffsetArray.length,b=g.vertexLength,v=this.allowVerticalPlacement&&s===wd.vertical?Math.PI/2:0,x=o.text&&o.text.sections;for(let n=0;n=0?t.rightJustifiedTextSymbolIndex:t.centerJustifiedTextSymbolIndex>=0?t.centerJustifiedTextSymbolIndex:t.leftJustifiedTextSymbolIndex>=0?t.leftJustifiedTextSymbolIndex:t.verticalPlacedTextSymbolIndex>=0?t.verticalPlacedTextSymbolIndex:n),o=Rh(this.textSizeData,e,r)/zh;return this.tilePixelRatio*o}getSymbolInstanceIconSize(e,t,i){const n=this.icon.placedSymbolArray.get(i),r=Rh(this.iconSizeData,e,n);return this.tilePixelRatio*r}_commitDebugCollisionVertexUpdate(e,t,i){e.emplaceBack(t,-i,-i),e.emplaceBack(t,i,-i),e.emplaceBack(t,i,i),e.emplaceBack(t,-i,i)}_updateTextDebugCollisionBoxes(e,t,i,n,r,o){for(let s=n;s0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,t){const i=e.placedSymbolArray.get(t),n=i.vertexStartIndex+4*i.numGlyphs;for(let t=i.vertexStartIndex;tn[e]-n[t]||r[t]-r[e])),o}addToSortKeyRanges(e,t){const i=this.sortKeyRanges[this.sortKeyRanges.length-1];i&&i.sortKey===t?i.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,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 e of this.symbolInstanceIndexes){const t=this.symbolInstances.get(e);this.featureSortOrder.push(t.featureIndex);const{rightJustifiedTextSymbolIndex:i,centerJustifiedTextSymbolIndex:n,leftJustifiedTextSymbolIndex:r,verticalPlacedTextSymbolIndex:o,placedIconSymbolIndex:s,verticalPlacedIconSymbolIndex:a}=t;i>=0&&this.addIndicesForPlacedSymbol(this.text,i),n>=0&&n!==i&&this.addIndicesForPlacedSymbol(this.text,n),r>=0&&r!==n&&r!==i&&this.addIndicesForPlacedSymbol(this.text,r),o>=0&&this.addIndicesForPlacedSymbol(this.text,o),s>=0&&this.addIndicesForPlacedSymbol(this.icon,s),a>=0&&this.addIndicesForPlacedSymbol(this.icon,a)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}Xr(nf,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),nf.MAX_GLYPHS=65535,nf.addDynamicAttributes=Yp;const rf=new zo({"symbol-placement":new Po(et.layout_symbol["symbol-placement"]),"symbol-spacing":new Po(et.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Po(et.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Lo(et.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Po(et.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Po(et.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Po(et.layout_symbol["icon-ignore-placement"]),"icon-optional":new Po(et.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Po(et.layout_symbol["icon-rotation-alignment"]),"icon-size":new Lo(et.layout_symbol["icon-size"]),"icon-text-fit":new Po(et.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Po(et.layout_symbol["icon-text-fit-padding"]),"icon-image":new Lo(et.layout_symbol["icon-image"]),"icon-rotate":new Lo(et.layout_symbol["icon-rotate"]),"icon-padding":new Po(et.layout_symbol["icon-padding"]),"icon-keep-upright":new Po(et.layout_symbol["icon-keep-upright"]),"icon-offset":new Lo(et.layout_symbol["icon-offset"]),"icon-anchor":new Lo(et.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Po(et.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Po(et.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Po(et.layout_symbol["text-rotation-alignment"]),"text-field":new Lo(et.layout_symbol["text-field"]),"text-font":new Lo(et.layout_symbol["text-font"]),"text-size":new Lo(et.layout_symbol["text-size"]),"text-max-width":new Lo(et.layout_symbol["text-max-width"]),"text-line-height":new Lo(et.layout_symbol["text-line-height"]),"text-letter-spacing":new Lo(et.layout_symbol["text-letter-spacing"]),"text-justify":new Lo(et.layout_symbol["text-justify"]),"text-radial-offset":new Lo(et.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Po(et.layout_symbol["text-variable-anchor"]),"text-anchor":new Lo(et.layout_symbol["text-anchor"]),"text-max-angle":new Po(et.layout_symbol["text-max-angle"]),"text-writing-mode":new Po(et.layout_symbol["text-writing-mode"]),"text-rotate":new Lo(et.layout_symbol["text-rotate"]),"text-padding":new Po(et.layout_symbol["text-padding"]),"text-keep-upright":new Po(et.layout_symbol["text-keep-upright"]),"text-transform":new Lo(et.layout_symbol["text-transform"]),"text-offset":new Lo(et.layout_symbol["text-offset"]),"text-allow-overlap":new Po(et.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Po(et.layout_symbol["text-ignore-placement"]),"text-optional":new Po(et.layout_symbol["text-optional"])});var of={paint:new zo({"icon-opacity":new Lo(et.paint_symbol["icon-opacity"]),"icon-color":new Lo(et.paint_symbol["icon-color"]),"icon-halo-color":new Lo(et.paint_symbol["icon-halo-color"]),"icon-halo-width":new Lo(et.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Lo(et.paint_symbol["icon-halo-blur"]),"icon-translate":new Po(et.paint_symbol["icon-translate"]),"icon-translate-anchor":new Po(et.paint_symbol["icon-translate-anchor"]),"text-opacity":new Lo(et.paint_symbol["text-opacity"]),"text-color":new Lo(et.paint_symbol["text-color"],{runtimeType:dt,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new Lo(et.paint_symbol["text-halo-color"]),"text-halo-width":new Lo(et.paint_symbol["text-halo-width"]),"text-halo-blur":new Lo(et.paint_symbol["text-halo-blur"]),"text-translate":new Po(et.paint_symbol["text-translate"]),"text-translate-anchor":new Po(et.paint_symbol["text-translate-anchor"])}),layout:rf};class sf{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:lt,this.defaultValue=e}evaluate(e){if(e.formattedSection){const t=this.defaultValue.property.overrides;if(t&&t.hasOverride(e.formattedSection))return t.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}}Xr(sf,"FormatSectionOverride",{omit:["defaultValue"]});class af extends ea{constructor(e){super(e,of)}recalculate(e,t){super.recalculate(e,t),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const i=this.layout.get("text-writing-mode");if(i){const e=[];for(const t of i)e.indexOf(t)<0&&e.push(t);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getValueAndResolveTokens(e,t,i,n){const r=this.layout.get(e).evaluate(t,{},i,n),o=this._unevaluatedLayout._values[e];return o.isDataDriven()||Xn(o.value)||!r?r:function(e,t){return t.replace(/{([^{}]+)}/g,((t,i)=>i in e?String(e[i]):""))}(t.properties,r)}createBucket(e){return new nf(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of of.paint.overridableProperties){if(!af.hasPaintOverride(this.layout,e))continue;const t=this.paint.get(e),i=new sf(t),n=new Hn(i,t.property.specification);let r=null;r="constant"===t.value.kind||"source"===t.value.kind?new Jn("source",n):new Yn("composite",n,t.value.zoomStops,t.value._interpolationType),this.paint._values[e]=new Ao(t.property,r,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,i){return!(!this.layout||t.isDataDriven()||i.isDataDriven())&&af.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){const i=e.get("text-field"),n=of.paint.properties[t];let r=!1;const o=e=>{for(const t of e)if(n.overrides&&n.overrides.hasOverride(t))return void(r=!0)};if("constant"===i.value.kind&&i.value.value instanceof zt)o(i.value.value.sections);else if("source"===i.value.kind){const e=t=>{r||(t instanceof Vt&&Ft(t.value)===_t?o(t.value.sections):t instanceof Zt?o(t.sections):t.eachChild(e))},t=i.value;t._styleExpression&&e(t._styleExpression.expression)}return r}getProgramConfiguration(e){return new Zs(this,e)}}var lf={paint:new zo({"background-color":new Po(et.paint_background["background-color"]),"background-pattern":new Po(et.paint_background["background-pattern"]),"background-opacity":new Po(et.paint_background["background-opacity"])})},cf={paint:new zo({"raster-opacity":new Po(et.paint_raster["raster-opacity"]),"raster-hue-rotate":new Po(et.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Po(et.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Po(et.paint_raster["raster-brightness-max"]),"raster-saturation":new Po(et.paint_raster["raster-saturation"]),"raster-contrast":new Po(et.paint_raster["raster-contrast"]),"raster-resampling":new Po(et.paint_raster["raster-resampling"]),"raster-fade-duration":new Po(et.paint_raster["raster-fade-duration"])})};class uf extends ea{constructor(e){super(e,{}),this.implementation=e}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}isLayerDraped(){return void 0!==this.implementation.renderToTile}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)}}var hf={paint:new zo({"sky-type":new Po(et.paint_sky["sky-type"]),"sky-atmosphere-sun":new Po(et.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new Po(et.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new Po(et.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new Po(et.paint_sky["sky-gradient-radius"]),"sky-gradient":new Do(et.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new Po(et.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new Po(et.paint_sky["sky-atmosphere-color"]),"sky-opacity":new Po(et.paint_sky["sky-opacity"])})};function df(e,t,i){const n=[0,0,1],r=qa([]);return Za(r,r,i?-x(e)+Math.PI:x(e)),Ga(r,r,-x(t)),Oa(n,n,r),Pa(n,n)}const pf={circle:class extends ea{constructor(e){super(e,Tc)}createBucket(e){return new sc(e)}queryRadius(e){const t=e;return bc("circle-radius",this,t)+bc("circle-stroke-width",this,t)+vc(this.paint.get("circle-translate"))}queryIntersectsFeature(e,t,i,n,r,o,s,a){const l=wc(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),c=this.paint.get("circle-radius").evaluate(t,i)+this.paint.get("circle-stroke-width").evaluate(t,i);return kc(e,n,o,s,a,"map"===this.paint.get("circle-pitch-alignment"),"map"===this.paint.get("circle-pitch-scale"),l,c)}getProgramIds(){return["circle"]}getProgramConfiguration(e){return new Zs(this,e)}},heatmap:class extends ea{createBucket(e){return new Ic(e)}constructor(e){super(e,Bc),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){"heatmap-color"===e&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Rc({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(e){return bc("heatmap-radius",this,e)}queryIntersectsFeature(e,t,i,n,r,o,s,a){const l=this.paint.get("heatmap-radius").evaluate(t,i);return kc(e,n,o,s,a,!0,!0,new y(0,0),l)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}getProgramIds(){return["heatmap","heatmapTexture"]}getProgramConfiguration(e){return new Zs(this,e)}},hillshade:class extends ea{constructor(e){super(e,Fc)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}getProgramIds(){return["hillshade","hillshadePrepare"]}},fill:class extends ea{constructor(e){super(e,ku)}getProgramIds(){const e=this.paint.get("fill-pattern"),t=e&&e.constantOr(1),i=[t?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&i.push(t&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),i}getProgramConfiguration(e){return new Zs(this,e)}recalculate(e,t){super.recalculate(e,t);const i=this.paint._values["fill-outline-color"];"constant"===i.value.kind&&void 0===i.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new Eu(e)}queryRadius(){return vc(this.paint.get("fill-translate"))}queryIntersectsFeature(e,t,i,n,r,o){return!e.queryGeometry.isAboveHorizon&&cc(xc(e.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),n)}isTileClipped(){return!0}},"fill-extrusion":class extends ea{constructor(e){super(e,sh)}createBucket(e){return new Ku(e)}queryRadius(){return vc(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}getProgramConfiguration(e){return new Zs(this,e)}queryIntersectsFeature(e,t,i,n,r,o,s,a,l){const c=wc(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),u=this.paint.get("fill-extrusion-height").evaluate(t,i),h=this.paint.get("fill-extrusion-base").evaluate(t,i),d=[0,0],p=a&&o.elevation,f=o.elevation?o.elevation.exaggeration():1,m=e.tile.getBucket(this);if(p&&m instanceof Ku){const e=m.centroidVertexArray,t=l+1;te.polygon)).flat());const _=p?a:null,[g,b]=function(e,t,i,n,r,o,s,a,l,c,u){return"globe"===e.projection.name?function(e,t,i,n,r,o,s,a,l,c,u){const h=[],d=[],p=e.projection.upVectorScale(u,e.center.lat,e.worldSize).metersToTile,f=[0,0,0,1],m=[0,0,0,1],_=(e,t,i,n)=>{e[0]=t,e[1]=i,e[2]=n,e[3]=1},g=nh();i>0&&(i+=g),n+=g;for(const g of t){const t=[],y=[];for(const h of g){const d=h.x+r.x,g=h.y+r.y,b=e.projection.projectTilePoint(d,g,u),v=e.projection.upVector(u,h.x,h.y);let x=i,w=n;if(s){const e=mh(d,g,i,n,s,a,l,c);x+=e.base,w+=e.top}0!==i?_(f,b.x+v[0]*p*x,b.y+v[1]*p*x,b.z+v[2]*p*x):_(f,b.x,b.y,b.z),_(m,b.x+v[0]*p*w,b.y+v[1]*p*w,b.z+v[2]*p*w),za(f,f,o),za(m,m,o),t.push(new dh(f[0],f[1],f[2])),y.push(new dh(m[0],m[1],m[2]))}h.push(t),d.push(y)}return[h,d]}(e,t,i,n,r,o,s,a,l,c,u):s?function(e,t,i,n,r,o,s,a,l){const c=[],u=[],h=[0,0,0,1];for(const d of e){const e=[],p=[];for(const c of d){const u=c.x+n.x,d=c.y+n.y,f=mh(u,d,t,i,o,s,a,l);h[0]=u,h[1]=d,h[2]=f.base,h[3]=1,Na(h,h,r),h[3]=Math.max(h[3],1e-5);const m=new dh(h[0]/h[3],h[1]/h[3],h[2]/h[3]);h[0]=u,h[1]=d,h[2]=f.top,h[3]=1,Na(h,h,r),h[3]=Math.max(h[3],1e-5);const _=new dh(h[0]/h[3],h[1]/h[3],h[2]/h[3]);e.push(m),p.push(_)}c.push(e),u.push(p)}return[c,u]}(t,i,n,r,o,s,a,l,c):function(e,t,i,n,r){const o=[],s=[],a=r[8]*t,l=r[9]*t,c=r[10]*t,u=r[11]*t,h=r[8]*i,d=r[9]*i,p=r[10]*i,f=r[11]*i;for(const t of e){const e=[],i=[];for(const o of t){const t=o.x+n.x,s=o.y+n.y,m=r[0]*t+r[4]*s+r[12],_=r[1]*t+r[5]*s+r[13],g=r[2]*t+r[6]*s+r[14],y=r[3]*t+r[7]*s+r[15],b=m+a,v=_+l,x=g+c,w=Math.max(y+u,1e-5),E=m+h,T=_+d,k=g+p,C=Math.max(y+f,1e-5);e.push(new dh(b/w,v/w,x/w)),i.push(new dh(E/C,T/C,k/C))}o.push(e),s.push(i)}return[o,s]}(t,i,n,r,o)}(o,n,h,u,c,s,_,d,f,o.center.lat,e.tileID.canonical),v=e.queryGeometry;return function(e,t,i){let n=1/0;cc(i,t)&&(n=fh(i,t[0]));for(let r=0;r=3)for(let t=0;t{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 _f{constructor(){this.tasks={},this.taskQueue=[],F(["process"],this),this.invoker=new mf(this.process),this.nextId=0}add(e,t){const i=this.nextId++,n=function({type:e,isSymbolTile:t,zoom:i}){return i=i||0,"message"===e?0:"maybePrepare"!==e||t?"parseTile"!==e||t?"parseTile"===e&&t?300-i:"maybePrepare"===e&&t?400-i:500:200-i:100-i}(t);if(0===n){W();try{e()}finally{}return{cancel:()=>{}}}return this.tasks[i]={fn:e,metadata:t,priority:n,id:i},this.taskQueue.push(i),this.invoker.trigger(),{cancel:()=>{delete this.tasks[i]}}}process(){W();try{if(this.taskQueue=this.taskQueue.filter((e=>!!this.tasks[e])),!this.taskQueue.length)return;const e=this.pick();if(null===e)return;const t=this.tasks[e];if(delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),!t)return;t.fn()}finally{}}pick(){let e=null,t=1/0;for(let i=0;i>=1)>1;){const e=i+r>>1,l=n+o>>1;1&t?(r=i,o=n,i=s,n=a):(i=r,n=o,r=s,o=a),s=e,a=l}const l=4*e;wf[l+0]=i,wf[l+1]=n,wf[l+2]=r,wf[l+3]=o}const Ef=new Uint16Array(2178),Tf=new Uint8Array(1089),kf=new Uint16Array(1089);function Cf(e){return 0===e?-.03125:32===e?.03125:0}var Sf=Uo([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);const Mf={type:2,extent:ra,loadGeometry:()=>[[new y(0,0),new y(ra+1,0),new y(ra+1,ra+1),new y(0,ra+1),new y(0,0)]]};class Af{constructor(e,t,i,n,r){this.tileID=e,this.uid=z(),this.uses=0,this.tileSize=t,this.tileZoom=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=r,this.expiredRequestCount=0,this.state="loading",n&&n.transform&&(this.projection=n.transform.projection)}registerFadeDuration(e){const t=e+this.timeAdded;tt.getLayer(e))).filter(Boolean);if(0!==e.length){n.layers=e,n.stateDependentLayerIds&&(n.stateDependentLayers=n.stateDependentLayerIds.map((t=>e.filter((e=>e.id===t))[0])));for(const t of e)i[t.id]=n}}return i}(e.buckets,t.style),this.hasSymbolBuckets=!1;for(const e in this.buckets){const t=this.buckets[e];if(t instanceof nf){if(this.hasSymbolBuckets=!0,!i)break;t.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const e in this.buckets){const t=this.buckets[e];if(t instanceof nf&&t.hasRTLText){this.hasRTLText=!0,xo.isLoading()||xo.isLoaded()||"deferred"!==bo()||vo();break}}this.queryPadding=0;for(const e in this.buckets){const i=this.buckets[e];this.queryPadding=Math.max(this.queryPadding,t.style.getLayer(e).queryRadius(i))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage),e.lineAtlas&&(this.lineAtlas=e.lineAtlas)}else this.collisionBoxArray=new ps}unloadVectorData(){if(this.hasData()){for(const e in this.buckets)this.buckets[e].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"}}getBucket(e){return this.buckets[e.id]}upload(e){for(const t in this.buckets){const i=this.buckets[t];i.uploadPending()&&i.upload(e)}const t=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new ff(e,this.imageAtlas.image,t.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new ff(e,this.glyphAtlasImage,t.ALPHA),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new ff(e,this.lineAtlas.image,t.ALPHA),this.lineAtlas.uploaded=!0)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,i,n,r,o,s,a){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({tileResult:n,pixelPosMatrix:s,transform:o,params:r,tileTransform:this.tileTransform},e,t,i):{}}querySourceFeatures(e,t){const i=this.latestFeatureIndex;if(!i||!i.rawTileData)return;const n=i.loadVTLayers(),r=t?t.sourceLayer:"",o=n._geojsonTileLayer||n[r];if(!o)return;const s=hr(t&&t.filter),{z:a,x:l,y:c}=this.tileID.canonical,u={z:a,x:l,y:c};for(let t=0;te)i=!1;else if(t)if(this.expirationTime=0;e--){const t=4*e,i=wf[t+0],n=wf[t+1],r=wf[t+2],o=wf[t+3],s=i+r>>1,a=n+o>>1,l=s+a-n,c=a+i-s,u=n*xf+i,h=o*xf+r,d=a*xf+s,p=Math.hypot((Ef[2*u+0]+Ef[2*h+0])/2-Ef[2*d+0],(Ef[2*u+1]+Ef[2*h+1])/2-Ef[2*d+1])>=16;Tf[d]=Tf[d]||(p?1:0),e<1022&&(Tf[d]=Tf[d]||Tf[(n+c>>1)*xf+(i+l>>1)]||Tf[(o+c>>1)*xf+(r+l>>1)])}const r=new $o,o=new ns;let s=0;function a(e,t){const i=t*xf+e;return 0===kf[i]&&(r.emplaceBack(Ef[2*i+0],Ef[2*i+1],e*ra/vf,t*ra/vf),kf[i]=++s),kf[i]-1}function l(e,t,i,n,r,s){const c=e+i>>1,u=t+n>>1;if(Math.abs(e-r)+Math.abs(t-s)>1&&Tf[u*xf+c])l(r,s,e,t,c,u),l(i,n,r,s,c,u);else{const l=a(e,t),c=a(i,n),u=a(r,s);o.emplaceBack(l,c,u)}}return l(0,0,vf,vf,vf,0),l(vf,vf,0,0,0,vf),{vertices:r,indices:o}}(this.tileID.canonical,t);n=e.vertices,r=e.indices}else{n=new $o,r=new ns;for(const{x:e,y:t}of i)n.emplaceBack(e,t,0,0);const e=fu(n.int16,void 0,4);for(let t=0;t0&&(s=ha(new Float64Array(16),t.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(e,n,t,r,s,o),this._makeGlobeTileDebugTextBuffer(e,n,t,r,s,o)}_globePoint(e,t,i,n,r,o,s){let a=El(e,t,i);if(o){const r=1<.5?h=-1:u<-.5&&(h=1);let d=(e/ra+i.x)/r+h,p=(t/ra+i.y)/r;d=(d-l)*n._pixelsPerMercatorPixel+l,p=(p-c)*n._pixelsPerMercatorPixel+c;const f=[d*n.worldSize,p*n.worldSize,0];za(f,f,o),a=_l(a,f,s)}return za(a,a,r)}_makeGlobeTileDebugBorderBuffer(e,t,i,n,r,o){const s=new Vo,a=new us,l=new No,c=(e,c,u,h,d)=>{const p=(u-e)/(d-1),f=(h-c)/(d-1),m=s.length;for(let u=0;uu*e+t;for(let e=0;et[s])return null}else{const a=1/n[s];let l=(e[s]-i[s])*a,c=(t[s]-i[s])*a;if(l>c){const e=l;l=c,c=e}if(l>r&&(r=l),co)return null}return r}function Df(e,t,i,n,r,o,s,a,l,c,u){const h=n-e,d=r-t,p=o-i,f=s-e,m=a-t,_=l-i,g=u[1]*_-u[2]*m,y=u[2]*f-u[0]*_,b=u[0]*m-u[1]*f,v=h*g+d*y+p*b;if(Math.abs(v)<1e-15)return null;const x=1/v,w=c[0]-e,E=c[1]-t,T=c[2]-i,k=(w*g+E*y+T*b)*x;if(k<0||k>1)return null;const C=E*p-T*d,S=T*h-w*p,M=w*d-E*h,A=(u[0]*C+u[1]*S+u[2]*M)*x;return A<0||k+A>1?null:(f*C+m*S+_*M)*x}function zf(e,t,i){return(e-t)/(i-t)}function Of(e,t,i,n,r,o,s,a,l){const c=1<{const o=n?1:0,s=(e+1)*i-o,a=t*i,l=(t+1)*i-o;r[0]=e*i,r[1]=a,r[2]=s,r[3]=l};let s=new Pf(n);const a=[];for(let t=0;t=1;n/=2){const e=i[i.length-1];s=new Pf(n);for(let t=0;t0;){const{idx:a,t:p,nodex:f,nodey:m,depth:_}=d.pop();if(this.leaves[a]){Of(f,m,_,e,t,i,n,u,h);const a=1<<_,l=(f+0)/a,c=(f+1)/a,d=(m+0)/a,g=(m+1)/a,y=Ff(l,d,this.dem)*s,b=Ff(c,d,this.dem)*s,v=Ff(c,g,this.dem)*s,x=Ff(l,g,this.dem)*s,w=Df(u[0],u[1],y,h[0],u[1],b,h[0],h[1],v,r,o),E=Df(h[0],h[1],v,u[0],h[1],x,u[0],u[1],y,r,o),T=Math.min(null!==w?w:Number.MAX_VALUE,null!==E?E:Number.MAX_VALUE);if(T!==Number.MAX_VALUE)return T;{const e=Ia([],r,o,p);if(Rf(y,b,x,v,zf(e[0],u[0],h[0]),zf(e[1],u[1],h[1]))>=e[2])return p}continue}let g=0;for(let d=0;d=l[c[i]]&&(c.splice(i,0,d),t=!0);t||(c[g]=d),g++}}for(let e=0;e=this.dim+1||t<-1||t>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(t+1)*this.stride+(e+1)}static pack(e,t){const i=[0,0,0,0],n=Nf.getUnpackVector(t);let r=Math.floor((e+n[3])/n[2]);return i[2]=r%256,r=Math.floor(r/256),i[1]=r%256,r=Math.floor(r/256),i[0]=r,i}getPixels(){return new Oc({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,t,i){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let n=t*this.dim,r=t*this.dim+this.dim,o=i*this.dim,s=i*this.dim+this.dim;switch(t){case-1:n=r-1;break;case 1:r=n+1}switch(i){case-1:o=s-1;break;case 1:s=o+1}const a=-t*this.dim,l=-i*this.dim;for(let t=o;t{this.remove(e,r)}),i)),this.data[n].push(r),this.order.push(n),this.order.length>this.max){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),0===this.data[e].length&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){const t=this.data[e];return t?t[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;const i=e.wrapped().key,n=void 0===t?0:this.data[i].indexOf(t),r=this.data[i][n];return this.data[i].splice(n,1),r.timeout&&clearTimeout(r.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(r.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(e){const t=[];for(const i in this.data)for(const n of this.data[i])e(n.value)||t.push(n);for(const e of t)this.remove(e.value.tileID,e)}}class qf{constructor(e,t,i){this.func=e,this.mask=t,this.range=i}}qf.ReadOnly=!1,qf.ReadWrite=!0,qf.disabled=new qf(519,qf.ReadOnly,[0,1]);const Gf=7680;class Zf{constructor(e,t,i,n,r,o){this.test=e,this.ref=t,this.mask=i,this.fail=n,this.depthFail=r,this.pass=o}}Zf.disabled=new Zf({func:519,mask:0},0,0,Gf,Gf,Gf);class Wf{constructor(e,t,i){this.blendFunction=e,this.blendColor=t,this.mask=i}}Wf.Replace=[1,0],Wf.disabled=new Wf(Wf.Replace,Pt.transparent,[!1,!1,!1,!1]),Wf.unblended=new Wf(Wf.Replace,Pt.transparent,[!0,!0,!0,!0]),Wf.alphaBlended=new Wf([1,771],Pt.transparent,[!0,!0,!0,!0]);const Hf=1029,Xf=2305;class Kf{constructor(e,t,i){this.enable=e,this.mode=t,this.frontFace=i}}Kf.disabled=new Kf(!1,Hf,Xf),Kf.backCCW=new Kf(!0,Hf,Xf),Kf.backCW=new Kf(!0,Hf,2304),Kf.frontCW=new Kf(!0,1028,2304),Kf.frontCCW=new Kf(!0,1028,Xf);class Jf extends Qe{constructor(e,t,i){super(),this.id=e,this._onlySymbols=i,t.on("data",(e=>{"source"===e.dataType&&"metadata"===e.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===e.dataType&&"content"===e.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform))})),t.on("error",(()=>{this._sourceErrored=!0})),this._source=t,this._tiles={},this._cache=new $f(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=t.minTileCacheSize,this._maxTileCacheSize=t.maxTileCacheSize,this._loadedParentTiles={},this._coveredTiles={},this._state=new If,this._isRaster="raster"===this._source.type||"raster-dem"===this._source.type||"custom"===this._source.type&&"raster"===this._source._dataType}onAdd(e){this.map=e,this._minTileCacheSize=void 0===this._minTileCacheSize&&e?e._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=void 0===this._maxTileCacheSize&&e?e._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;for(const e in this._tiles){const t=this._tiles[e];if("loaded"!==t.state&&"errored"!==t.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(e,t){return e.isSymbolTile=this._onlySymbols,this._source.loadTile(e,t)}_unloadTile(e){if(this._source.unloadTile)return this._source.unloadTile(e,(()=>{}))}_abortTile(e){if(this._source.abortTile)return this._source.abortTile(e,(()=>{}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const t in this._tiles){const i=this._tiles[t];i.upload(e),i.prepare(this.map.style.imageManager)}}getIds(){return P(this._tiles).map((e=>e.tileID)).sort(Yf).map((e=>e.key))}getRenderableIds(e){const t=[];for(const i in this._tiles)this._isIdRenderable(+i,e)&&t.push(this._tiles[i]);return e?t.sort(((e,t)=>{const i=e.tileID,n=t.tileID,r=new y(i.canonical.x,i.canonical.y)._rotate(this.transform.angle),o=new y(n.canonical.x,n.canonical.y)._rotate(this.transform.angle);return i.overscaledZ-n.overscaledZ||o.y-r.y||o.x-r.x})).map((e=>e.tileID.key)):t.map((e=>e.tileID)).sort(Yf).map((e=>e.key))}hasRenderableParent(e){const t=this.findLoadedParent(e,0);return!!t&&this._isIdRenderable(t.tileID.key)}_isIdRenderable(e,t){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(t||!this._tiles[e].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const e in this._tiles)"errored"!==this._tiles[e].state&&this._reloadTile(+e,"reloading")}}_reloadTile(e,t){const i=this._tiles[e];i&&("loading"!==i.state&&(i.state=t),this._loadTile(i,this._tileLoaded.bind(this,i,e,t)))}_tileLoaded(e,t,i,n){if(n)if(e.state="errored",404!==n.status)this._source.fire(new Ye(n,{tile:e}));else if("raster-dem"===this._source.type&&this.usedForTerrain&&this.map.painter.terrain){const e=this.map.painter.terrain;this.update(this.transform,e.getScaledDemTileSize(),!0),e.resetTileLookupCache(this.id)}else this.update(this.transform);else e.timeAdded=He.now(),"expired"===i&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(t,e),"raster-dem"===this._source.type&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),this._source.fire(new Je("data",{dataType:"source",tile:e,coord:e.tileID,sourceCacheId:this.id}))}_backfillDEM(e){const t=this.getRenderableIds();for(let n=0;n1||(Math.abs(i)>1&&(1===Math.abs(i+r)?i+=r:1===Math.abs(i-r)&&(i-=r)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,i,n),e.neighboringTiles&&e.neighboringTiles[o]&&(e.neighboringTiles[o].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,t,i,n){for(const r in this._tiles){let o=this._tiles[r];if(n[r]||!o.hasData()||o.tileID.overscaledZ<=t||o.tileID.overscaledZ>i)continue;let s=o.tileID;for(;o&&o.tileID.overscaledZ>t+1;){const e=o.tileID.scaledTo(o.tileID.overscaledZ-1);o=this._tiles[e.key],o&&o.hasData()&&(s=e)}let a=s;for(;a.overscaledZ>t;)if(a=a.scaledTo(a.overscaledZ-1),e[a.key]){n[s.key]=s;break}}}findLoadedParent(e,t){if(e.key in this._loadedParentTiles){const i=this._loadedParentTiles[e.key];return i&&i.tileID.overscaledZ>=t?i:null}for(let i=e.overscaledZ-1;i>=t;i--){const t=e.scaledTo(i),n=this._getLoadedTile(t);if(n)return n}}_getLoadedTile(e){const t=this._tiles[e.key];return t&&t.hasData()?t:this._cache.getByKey(this._source.reparseOverscaled?e.wrapped().key:e.canonical.key)}updateCacheSize(e,t){t=t||this._source.tileSize;const i=Math.ceil(e.width/t)+1,n=Math.ceil(e.height/t)+1,r=Math.floor(i*n*5),o="number"==typeof this._minTileCacheSize?Math.max(this._minTileCacheSize,r):r,s="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,o):o;this._cache.setMaxSize(s)}handleWrapJump(e){const t=Math.round((e-(void 0===this._prevLng?e:this._prevLng))/360);if(this._prevLng=e,t){const e={};for(const i in this._tiles){const n=this._tiles[i];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+t),e[n.tileID.key]=n}this._tiles=e;for(const e in this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(const e in this._tiles)this._setTileReloadTimer(+e,this._tiles[e])}}update(e,t,i){if(this.transform=e,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage)return;if(this.usedForTerrain&&!i)return;let n;this.updateCacheSize(e,t),"globe"!==this.transform.projection.name&&this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?n=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((e=>new uh(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y))):(n=e.coveringTiles({tileSize:t||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!i,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.hasTile&&(n=n.filter((e=>this._source.hasTile(e))))):n=[];const r=this._updateRetainedTiles(n);if(Qf(this._source.type)&&0!==n.length){const e={},t={},i=Object.keys(r);for(const n of i){const i=r[n],o=this._tiles[n];if(!o||o.fadeEndTime&&o.fadeEndTime<=He.now())continue;const s=this.findLoadedParent(i,Math.max(i.overscaledZ-Jf.maxOverzooming,this._source.minzoom));s&&(this._addTile(s.tileID),e[s.tileID.key]=s.tileID),t[n]=i}const o=n[n.length-1].overscaledZ;for(const e in this._tiles){const i=this._tiles[e];if(r[e]||!i.hasData())continue;let n=i.tileID;for(;n.overscaledZ>o;){n=n.scaledTo(n.overscaledZ-1);const o=this._tiles[n.key];if(o&&o.hasData()&&t[n.key]){r[e]=i.tileID;break}}}for(const t in e)r[t]||(this._coveredTiles[t]=!0,r[t]=e[t])}for(const e in r)this._tiles[e].clearFadeHold();const o=function(e,t){const i=[];for(const n in e)n in t||i.push(n);return i}(this._tiles,r);for(const e of o){const t=this._tiles[e];t.hasSymbolBuckets&&!t.holdingForFade()?t.setHoldDuration(this.map._fadeDuration):t.hasSymbolBuckets&&!t.symbolFadeFinished()||this._removeTile(+e)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(+e)}_updateRetainedTiles(e){const t={};if(0===e.length)return t;const i={},n=e.reduce(((e,t)=>Math.min(e,t.overscaledZ)),1/0),r=e[0].overscaledZ,o=Math.max(r-Jf.maxOverzooming,this._source.minzoom),s=Math.max(r+Jf.maxUnderzooming,this._source.minzoom),a={};for(const i of e){const e=this._addTile(i);t[i.key]=i,e.hasData()||n=this._source.maxzoom){const e=n.children(this._source.maxzoom)[0],i=this.getTile(e);if(i&&i.hasData()){t[e.key]=e;continue}}else{const e=n.children(this._source.maxzoom);if(t[e[0].key]&&t[e[1].key]&&t[e[2].key]&&t[e[3].key])continue}let r=e.wasRequested();for(let s=n.overscaledZ-1;s>=o;--s){const o=n.scaledTo(s);if(i[o.key])break;if(i[o.key]=!0,e=this.getTile(o),!e&&r&&(e=this._addTile(o)),e&&(t[o.key]=o,r=e.wasRequested(),e.hasData()))break}}return t}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const t=[];let i,n=this._tiles[e].tileID;for(;n.overscaledZ>0;){if(n.key in this._loadedParentTiles){i=this._loadedParentTiles[n.key];break}t.push(n.key);const e=n.scaledTo(n.overscaledZ-1);if(i=this._getLoadedTile(e),i)break;n=e}for(const e of t)this._loadedParentTiles[e]=i}}_addTile(e){let t=this._tiles[e.key];if(t)return t;t=this._cache.getAndRemove(e),t&&(this._setTileReloadTimer(e.key,t),t.tileID=e,this._state.initializeTileState(t,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,t)));const i=Boolean(t);if(!i){const i=this.map?this.map.painter:null;t=new Af(e,this._source.tileSize*e.overscaleFactor(),this.transform.tileZoom,i,this._isRaster),this._loadTile(t,this._tileLoaded.bind(this,t,e.key,t.state))}return t?(t.uses++,this._tiles[e.key]=t,i||this._source.fire(new Je("dataloading",{tile:t,coord:t.tileID,dataType:"source"})),t):null}_setTileReloadTimer(e,t){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const i=t.getExpiryTimeout();i&&(this._timers[e]=setTimeout((()=>{this._reloadTile(e,"expired"),delete this._timers[e]}),i))}_removeTile(e){const t=this._tiles[e];t&&(t.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),t.uses>0||(t.hasData()&&"reloading"!==t.state?this._cache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(+e);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(e,t,i){const n=[],r=this.transform;if(!r)return n;const o="globe"===r.projection.name,s=jl(r.center.lng);for(const a in this._tiles){const l=this._tiles[a];if(i&&l.clearQueryDebugViz(),l.holdingForFade())continue;let c;if(o){const e=l.tileID.canonical;if(0===e.z){const t=[Math.abs(S(s,...em(e,-1))-s),Math.abs(S(s,...em(e,1))-s)];c=[0,2*t.indexOf(Math.min(...t))-1]}else{const t=[Math.abs(S(s,...em(e,-1))-s),Math.abs(S(s,...em(e,0))-s),Math.abs(S(s,...em(e,1))-s)];c=[t.indexOf(Math.min(...t))-1]}}else c=[0];for(const i of c){const o=e.containsTile(l,r,t,i);o&&n.push(o)}}return n}getVisibleCoordinates(e){const t=this.getRenderableIds(e).map((e=>this._tiles[e].tileID));for(const e of t)e.projMatrix=this.transform.calculateProjMatrix(e.toUnwrapped());return t}hasTransition(){if(this._source.hasTransition())return!0;if(Qf(this._source.type))for(const e in this._tiles){const t=this._tiles[e];if(void 0!==t.fadeEndTime&&t.fadeEndTime>=He.now())return!0}return!1}setFeatureState(e,t,i){this._state.updateState(e=e||"_geojsonTileLayer",t,i)}removeFeatureState(e,t,i){this._state.removeFeatureState(e=e||"_geojsonTileLayer",t,i)}getFeatureState(e,t){return this._state.getState(e=e||"_geojsonTileLayer",t)}setDependencies(e,t,i){const n=this._tiles[e];n&&n.setDependencies(t,i)}reloadTilesForDependencies(e,t){for(const i in this._tiles)this._tiles[i].hasDependency(e,t)&&this._reloadTile(+i,"reloading");this._cache.filter((i=>!i.hasDependency(e,t)))}_preloadTiles(e,t){if(!this._sourceLoaded){const i=()=>{this._sourceLoaded&&(this._source.off("data",i),this._preloadTiles(e,t))};return void this._source.on("data",i)}const i=new Map,n=Array.isArray(e)?e:[e],r=this.map.painter.terrain,o=this.usedForTerrain&&r?r.getScaledDemTileSize():this._source.tileSize;for(const e of n){const t=e.coveringTiles({tileSize:o,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const e of t)i.set(e.key,e);this.usedForTerrain&&e.updateElevation(!1)}I(Array.from(i.values()),((e,t)=>{const i=new Af(e,this._source.tileSize*e.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster);this._loadTile(i,(e=>{"raster-dem"===this._source.type&&i.dem&&this._backfillDEM(i),t(e,i)}))}),t)}}function Yf(e,t){const i=Math.abs(2*e.wrap)-+(e.wrap<0),n=Math.abs(2*t.wrap)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||n-i||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}function Qf(e){return"raster"===e||"image"===e||"video"===e||"custom"===e}function em(e,t){const i=1<=0&&n[3]>=0&&a.insert(s,n[0],n[1],n[2],n[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new Nu(new dd(this.rawTileData)).layers,this.sourceLayerCoder=new gf(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const e in this.vtLayers)this.vtFeatures[e]=[]}return this.vtLayers}query(e,t,i,n){this.loadVTLayers();const r=e.params||{},o=hr(r.filter),s=e.tileResult,a=e.transform,l=s.bufferedTilespaceBounds,c=this.grid.query(l.min.x,l.min.y,l.max.x,l.max.y,((e,t,i,n)=>gc(s.bufferedTilespaceGeometry,e,t,i,n)));c.sort(rm);let u=null;a.elevation&&c.length>0&&(u=tm.create(a.elevation,this.tileID));const h={};let d;for(let a=0;a(f||(f=ic(t,this.tileID.canonical,e.tileTransform)),i.queryIntersectsFeature(s,t,n,f,this.z,e.transform,e.pixelPosMatrix,u,r))))}return h}loadMatchingFeature(e,t,i,n,r,o,s,a,l){const{featureIndex:c,bucketIndex:u,sourceLayerIndex:h,layoutVertexArrayOffset:d}=t,p=this.bucketLayerIDs[u];if(n&&!function(e,t){for(let i=0;i=0)return!0;return!1}(n,p))return;const f=this.sourceLayerCoder.decode(h),m=this.vtLayers[f].feature(c);if(i.needGeometry){const e=nc(m,!0);if(!i.filter(new wo(this.tileID.overscaledZ),e,this.tileID.canonical))return}else if(!i.filter(new wo(this.tileID.overscaledZ),m))return;const _=this.getId(m,f);for(let t=0;t{const s=t instanceof Io?t.get(o):null;return s&&s.evaluate?s.evaluate(i,n,r):s}))}function rm(e,t){return t-e}Xr(im,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});class om{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.image=new zc({width:e,height:t}),this.positions={},this.uploaded=!1}getDash(e,t){const i=this.getKey(e,t);return this.positions[i]}trim(){const e=this.width,t=this.height=B(this.nextRow);this.image.resize({width:e,height:t})}getKey(e,t){return e.join(",")+t}getDashRanges(e,t,i){const n=[];let r=e.length%2==1?-e[e.length-1]*i:0,o=e[0]*i,s=!0;n.push({left:r,right:o,isDash:s,zeroLength:0===e[0]});let a=e[0];for(let t=1;t1&&(s=e[++o]);const l=Math.abs(a-s.left),c=Math.abs(a-s.right),u=Math.min(l,c);let h;const d=t/i*(n+1);if(s.isDash){const e=n-Math.abs(d);h=Math.sqrt(u*u+e*e)}else h=n-Math.sqrt(u*u+d*d);this.image.data[r+a]=Math.max(0,Math.min(255,h+128))}}}addRegularDash(e,t){for(let t=e.length-1;t>=0;--t){const i=e[t],n=e[t+1];i.zeroLength?e.splice(t,1):n&&n.isDash===i.isDash&&(n.left=i.left,e.splice(t,1))}const i=e[0],n=e[e.length-1];i.isDash===n.isDash&&(i.left=n.left-this.width,n.right=i.right+this.width);const r=this.width*this.nextRow;let o=0,s=e[o];for(let i=0;i1&&(s=e[++o]);const n=Math.abs(i-s.left),a=Math.abs(i-s.right),l=Math.min(n,a);this.image.data[r+i]=Math.max(0,Math.min(255,(s.isDash?l:-l)+t+128))}}addDash(e,t){const i=this.getKey(e,t);if(this.positions[i])return this.positions[i];const n="round"===t,r=n?7:0,o=2*r+1;if(this.nextRow+o>this.height)return q("LineAtlas out of space"),null;0===e.length&&e.push(1);let s=0;for(let t=0;t=t.maxzoom||"none"!==t.visibility&&(cm(e,this.zoom,i),(a[t.id]=t.createBucket({index:s.bucketLayerIDs.length,layers:e,zoom:this.zoom,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:h,sourceID:this.source,enableTerrain:this.enableTerrain,projection:this.projection.spec,availableImages:i})).populate(d,c,this.tileID.canonical,this.tileTransform),s.bucketLayerIDs.push(e.map((e=>e.id))))}}let h,d,p,f;l.trim();const m={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},_=()=>{if(h)return r(h);if(d&&p&&f){const e=new am(d),t=new xd(p,f);for(const n in a){const r=a[n];r instanceof nf?(cm(r.layers,this.zoom,i),mp(r,d,e.positions,p,t.iconPositions,this.showCollisionBoxes,i,this.tileID.canonical,this.tileZoom,this.projection)):r.hasPattern&&(r instanceof wh||r instanceof Eu||r instanceof Ku)&&(cm(r.layers,this.zoom,i),r.addFeatures(c,this.tileID.canonical,t.patternPositions,i,this.tileTransform))}this.status="done",r(null,{buckets:P(a).filter((e=>!e.isEmpty())),featureIndex:s,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:e.image,lineAtlas:l,imageAtlas:t,glyphMap:this.returnDependencies?d:null,iconMap:this.returnDependencies?p:null,glyphPositions:this.returnDependencies?e.positions:null})}},g=j(c.glyphDependencies,(e=>Object.keys(e).map(Number)));Object.keys(g).length?n.send("getGlyphs",{uid:this.uid,stacks:g},((e,t)=>{h||(h=e,d=t,_())}),void 0,!1,m):d={};const y=Object.keys(c.iconDependencies);y.length?n.send("getImages",{icons:y,source:this.source,tileID:this.tileID,type:"icons"},((e,t)=>{h||(h=e,p=t,_())}),void 0,!1,m):p={};const b=Object.keys(c.patternDependencies);b.length?n.send("getImages",{icons:b,source:this.source,tileID:this.tileID,type:"patterns"},((e,t)=>{h||(h=e,f=t,_())}),void 0,!1,m):f={},_()}}function cm(e,t,i){const n=new wo(t);for(const t of e)t.recalculate(n,i)}class um{constructor(e){this.entries={},this.scheduler=e}request(e,t,i,n){const r=this.entries[e]=this.entries[e]||{callbacks:[]};if(r.result){const[e,i]=r.result;return this.scheduler?this.scheduler.add((()=>{n(e,i)}),t):n(e,i),()=>{}}return r.callbacks.push(n),r.cancel||(r.cancel=i(((i,n)=>{r.result=[i,n];for(const e of r.callbacks)this.scheduler?this.scheduler.add((()=>{e(i,n)}),t):e(i,n);setTimeout((()=>delete this.entries[e]),3e3)}))),()=>{r.result||(r.callbacks=r.callbacks.filter((e=>e!==n)),r.callbacks.length||(r.cancel(),delete this.entries[e]))}}}function hm(e,t,i){const n=JSON.stringify(e.request);return e.data&&(this.deduped.entries[n]={result:[null,e.data]}),this.deduped.request(n,{type:"parseTile",isSymbolTile:e.isSymbolTile,zoom:e.tileZoom},(t=>{const n=de(e.request,((e,n,r,o)=>{e?t(e):n&&t(null,{vectorTile:i?void 0:new Nu(new dd(n)),rawData:n,cacheControl:r,expires:o})}));return()=>{n.cancel(),t()}}),t)}const dm=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class pm{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[t,i]=new Uint8Array(e,0,2);if(219!==t)throw new Error("Data does not appear to be in a KDBush format.");const n=i>>4;if(1!==n)throw new Error(`Got v${n} data when expected v1.`);const r=dm[15&i];if(!r)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(e,2,1),[s]=new Uint32Array(e,4,1);return new pm(s,o,r,e)}constructor(e,t=64,i=Float64Array,n){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=i,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const r=dm.indexOf(this.ArrayType),o=2*e*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,a=(8-s%8)%8;if(r<0)throw new Error(`Unexpected typed array class: ${i}.`);n&&n instanceof ArrayBuffer?(this.data=n,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+s+a,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+o+s+a),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+s+a,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+r]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){const i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=e,this.coords[this._pos++]=t,i}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return fm(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,i,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:r,coords:o,nodeSize:s}=this,a=[0,r.length-1,0],l=[];for(;a.length;){const c=a.pop()||0,u=a.pop()||0,h=a.pop()||0;if(u-h<=s){for(let s=h;s<=u;s++){const a=o[2*s],c=o[2*s+1];a>=e&&a<=i&&c>=t&&c<=n&&l.push(r[s])}continue}const d=h+u>>1,p=o[2*d],f=o[2*d+1];p>=e&&p<=i&&f>=t&&f<=n&&l.push(r[d]),(0===c?e<=p:t<=f)&&(a.push(h),a.push(d-1),a.push(1-c)),(0===c?i>=p:n>=f)&&(a.push(d+1),a.push(u),a.push(1-c))}return l}within(e,t,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:r,nodeSize:o}=this,s=[0,n.length-1,0],a=[],l=i*i;for(;s.length;){const c=s.pop()||0,u=s.pop()||0,h=s.pop()||0;if(u-h<=o){for(let i=h;i<=u;i++)ym(r[2*i],r[2*i+1],e,t)<=l&&a.push(n[i]);continue}const d=h+u>>1,p=r[2*d],f=r[2*d+1];ym(p,f,e,t)<=l&&a.push(n[d]),(0===c?e-i<=p:t-i<=f)&&(s.push(h),s.push(d-1),s.push(1-c)),(0===c?e+i>=p:t+i>=f)&&(s.push(d+1),s.push(u),s.push(1-c))}return a}}function fm(e,t,i,n,r,o){if(r-n<=i)return;const s=n+r>>1;mm(e,t,s,n,r,o),fm(e,t,i,n,s-1,1-o),fm(e,t,i,s+1,r,1-o)}function mm(e,t,i,n,r,o){for(;r>n;){if(r-n>600){const s=r-n+1,a=i-n+1,l=Math.log(s),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(s-c)/s)*(a-s/2<0?-1:1);mm(e,t,i,Math.max(n,Math.floor(i-a*c/s+u)),Math.min(r,Math.floor(i+(s-a)*c/s+u)),o)}const s=t[2*i+o];let a=n,l=r;for(_m(e,t,n,i),t[2*r+o]>s&&_m(e,t,n,r);as;)l--}t[2*n+o]===s?_m(e,t,n,l):(l++,_m(e,t,l,r)),l<=i&&(n=l+1),i<=l&&(r=l-1)}}function _m(e,t,i,n){gm(e,i,n),gm(t,2*i,2*n),gm(t,2*i+1,2*n+1)}function gm(e,t,i){const n=e[t];e[t]=e[i],e[i]=n}function ym(e,t,i,n){const r=e-i,o=t-n;return r*r+o*o}e.ARRAY_TYPE=aa,e.AUTH_ERR_MSG=ye,e.Aabb=tl,e.Actor=class{constructor(e,i,n){this.target=e,this.parent=i,this.mapId=n,this.callbacks={},this.cancelCallbacks={},F(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.globalScope=W()?e:t,this.scheduler=new _f}send(e,t,i,n,r=!1,o){const s=Math.round(1e18*Math.random()).toString(36).substring(0,10);i&&(i.metadata=o,this.callbacks[s]=i);const a=K(this.globalScope)?void 0:[];return this.target.postMessage({id:s,type:e,hasCallback:!!i,targetMapId:n,mustQueue:r,sourceMapId:this.mapId,data:Yr(t,a)},a),{cancel:()=>{i&&delete this.callbacks[s],this.target.postMessage({id:s,type:"",targetMapId:n,sourceMapId:this.mapId})}}}receive(e){const t=e.data,i=t.id;if(i&&(!t.targetMapId||this.mapId===t.targetMapId))if(""===t.type){const e=this.cancelCallbacks[i];delete this.cancelCallbacks[i],e&&e.cancel()}else if(t.mustQueue||W()){const e=this.callbacks[i];this.cancelCallbacks[i]=this.scheduler.add((()=>this.processTask(i,t)),e&&e.metadata||{type:"message"})}else this.processTask(i,t)}processTask(e,t){if(""===t.type){const i=this.callbacks[e];delete this.callbacks[e],i&&(t.error?i(Qr(t.error)):i(null,Qr(t.data)))}else{const i=K(this.globalScope)?void 0:[],n=t.hasCallback?(t,n)=>{delete this.cancelCallbacks[e],this.target.postMessage({id:e,type:"",sourceMapId:this.mapId,error:t?Yr(t):null,data:Yr(n,i)},i)}:e=>{},r=Qr(t.data);if(this.parent[t.type])this.parent[t.type](t.sourceMapId,r,n);else if(this.parent.getWorkerSource){const e=t.type.split(".");this.parent.getWorkerSource(t.sourceMapId,e[0],r.source)[e[1]](r,n)}else n(new Error(`Could not find function ${t.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}},e.CanonicalTileID=lh,e.Color=Pt,e.ColorMode=Wf,e.CullFaceMode=Kf,e.DEMData=Nf,e.DataConstantProperty=Po,e.DedupedRequest=um,e.DepthMode=qf,e.EXTENT=ra,e.Elevation=class{isDataAvailableAtPoint(e){const t=this._source();if(this.isUsingMockSource()||!t||e.y<0||e.y>1)return!1;const i=t.getSource().maxzoom,n=1<1)return t;const r=n.getSource().maxzoom,o=1<{const o=this.getAtTileOffset(e,r.x,r.y),s=n.upVector(e.canonical,r.x,r.y);return Aa(s,s,o*n.upVectorScale(e.canonical,t,i).metersToTile),s}}getForTilePoints(e,t,i,n){if(this.isUsingMockSource())return!1;const r=tm.create(this,e,n);return!!r&&(t.forEach((e=>{e[2]=this.exaggeration()*r.getElevationAt(e[0],e[1],i)})),!0)}getMinMaxForTile(e){if(this.isUsingMockSource())return null;const t=this.findDEMTileFor(e);if(!t||!t.dem)return null;const i=t.dem.tree,n=t.tileID,r=1<{let n=e===o-1?e-2:0===e?e:e-1;return n+=i?24575:0,[n,t]};for(let e=0;ethis._skuTokenExpiresAt}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}normalizeStyleURL(e,t){if(!be(e))return e;const i=ke(e);return i.path=`/styles/v1${i.path}`,this._makeAPIURL(i,this._customAccessToken||t)}normalizeGlyphsURL(e,t){if(!be(e))return e;const i=ke(e);return i.path=`/fonts/v1${i.path}`,this._makeAPIURL(i,this._customAccessToken||t)}normalizeSourceURL(e,t,i,n){if(!be(e))return e;const r=ke(e);return r.path=`/v4/${r.authority}.json`,r.params.push("secure"),i&&r.params.push(`language=${i}`),n&&r.params.push(`worldview=${n}`),this._makeAPIURL(r,this._customAccessToken||t)}normalizeSpriteURL(e,t,i,n){const r=ke(e);return be(e)?(r.path=`/styles/v1${r.path}/sprite${t}${i}`,this._makeAPIURL(r,this._customAccessToken||n)):(r.path+=`${t}${i}`,Ce(r))}normalizeTileURL(e,t,i){if(this._isSkuTokenExpired()&&this._createSkuToken(),e&&!be(e))return e;const n=ke(e);n.path=n.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${t||i&&"raster"!==n.authority&&512===i?"@2x":""}${o.supported?".webp":"$1"}`),"raster"===n.authority?n.path=`/${r.RASTER_URL_PREFIX}${n.path}`:(n.path=n.path.replace(/^.+\/v4\//,"/"),n.path=`/${r.TILE_URL_VERSION}${n.path}`);const s=this._customAccessToken||function(e){for(const t of e){const e=t.match(/^access_token=(.*)$/);if(e)return e[1]}return null}(n.params)||r.ACCESS_TOKEN;return r.REQUIRE_ACCESS_TOKEN&&s&&this._skuToken&&n.params.push(`sku=${this._skuToken}`),this._makeAPIURL(n,s)}canonicalizeTileURL(e,t){const i=ke(e);if(!i.path.match(/^(\/v4\/|\/raster\/v1\/)/)||!i.path.match(/\.[\w]+$/))return e;let n="mapbox://";i.path.match(/^\/raster\/v1\//)?n+=`raster/${i.path.replace(`/${r.RASTER_URL_PREFIX}/`,"")}`:n+=`tiles/${i.path.replace(`/${r.TILE_URL_VERSION}/`,"")}`;let o=i.params;return t&&(o=o.filter((e=>!e.match(/^access_token=/)))),o.length&&(n+=`?${o.join("&")}`),n}canonicalizeTileset(e,t){const i=!!t&&be(t),n=[];for(const t of e.tiles||[])ve(t)?n.push(this.canonicalizeTileURL(t,i)):n.push(t);return n}_makeAPIURL(e,t){const i="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",n=ke(r.API_URL);if(e.protocol=n.protocol,e.authority=n.authority,"http"===e.protocol){const t=e.params.indexOf("secure");t>=0&&e.params.splice(t,1)}if("/"!==n.path&&(e.path=`${n.path}${e.path}`),!r.REQUIRE_ACCESS_TOKEN)return Ce(e);if(t=t||r.ACCESS_TOKEN,!this._silenceAuthErrors){if(!t)throw new Error(`An API access token is required to use Mapbox GL. ${i}`);if("s"===t[0])throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${i}`)}return e.params=e.params.filter((e=>-1===e.indexOf("access_token"))),e.params.push(`access_token=${t||""}`),Ce(e)}},e.ResourceType=le,e.SegmentVector=na,e.SourceCache=Jf,e.StencilMode=Zf,e.StructArrayLayout1ui2=us,e.StructArrayLayout2f1f2i16=es,e.StructArrayLayout2i4=Vo,e.StructArrayLayout2ui4=cs,e.StructArrayLayout3f12=is,e.StructArrayLayout3ui6=ns,e.StructArrayLayout4i8=$o,e.StructArrayLayout5f20=as,e.Texture=ff,e.Tile=Af,e.Transitionable=ko,e.Uniform1f=zs,e.Uniform1i=class extends Ds{constructor(e){super(e),this.current=0}set(e,t,i){this.fetchUniformLocation(e,t)&&this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},e.Uniform2f=class extends Ds{constructor(e){super(e),this.current=[0,0]}set(e,t,i){this.fetchUniformLocation(e,t)&&(i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1])))}},e.Uniform3f=class extends Ds{constructor(e){super(e),this.current=[0,0,0]}set(e,t,i){this.fetchUniformLocation(e,t)&&(i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2])))}},e.Uniform4f=Os,e.UniformColor=Bs,e.UniformMatrix2f=class extends Ds{constructor(e){super(e),this.current=Us}set(e,t,i){if(this.fetchUniformLocation(e,t))for(let e=0;e<4;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix2fv(this.location,!1,i);break}}},e.UniformMatrix3f=class extends Ds{constructor(e){super(e),this.current=Fs}set(e,t,i){if(this.fetchUniformLocation(e,t))for(let e=0;e<9;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix3fv(this.location,!1,i);break}}},e.UniformMatrix4f=class extends Ds{constructor(e){super(e),this.current=Rs}set(e,t,i){if(this.fetchUniformLocation(e,t)){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let e=1;e<16;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}}},e.UnwrappedTileID=ch,e.ValidationError=ir,e.VectorTileFeature=$u,e.VectorTileWorkerSource=class extends Qe{constructor(e,t,i,n,r){super(),this.actor=e,this.layerIndex=t,this.availableImages=i,this.loadVectorData=r||hm,this.loading={},this.loaded={},this.deduped=new um(e.scheduler),this.isSpriteLoaded=n,this.scheduler=e.scheduler}loadTile(e,t){const i=e.uid,n=e&&e.request,r=n&&n.collectResourceTiming,o=this.loading[i]=new lm(e);o.abort=this.loadVectorData(e,((s,a)=>{const l=!this.loading[i];if(delete this.loading[i],l||s||!a)return o.status="done",l||(this.loaded[i]=o),t(s);const c=a.rawData,u={};a.expires&&(u.expires=a.expires),a.cacheControl&&(u.cacheControl=a.cacheControl),o.vectorTile=a.vectorTile||new Nu(new dd(c));const h=()=>{o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,((e,i)=>{if(e||!i)return t(e);const o={};if(r){const e=$e(n);e.length>0&&(o.resourceTiming=JSON.parse(JSON.stringify(e)))}t(null,L({rawTileData:c.slice(0)},i,u,o))}))};this.isSpriteLoaded?h():this.once("isSpriteLoaded",(()=>{this.scheduler?this.scheduler.add(h,{type:"parseTile",isSymbolTile:e.isSymbolTile,zoom:e.tileZoom}):h()})),this.loaded=this.loaded||{},this.loaded[i]=o}))}reloadTile(e,t){const i=this.loaded,n=e.uid,r=this;if(i&&i[n]){const o=i[n];o.showCollisionBoxes=e.showCollisionBoxes,o.enableTerrain=!!e.enableTerrain,o.projection=e.projection,o.tileTransform=Cp(e.tileID.canonical,e.projection);const s=(e,i)=>{const n=o.reloadCallback;n&&(delete o.reloadCallback,o.parse(o.vectorTile,r.layerIndex,this.availableImages,r.actor,n)),t(e,i)};"parsing"===o.status?o.reloadCallback=s:"done"===o.status&&(o.vectorTile?o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,s):s())}}abortTile(e,t){const i=e.uid,n=this.loading[i];n&&(n.abort&&n.abort(),delete this.loading[i]),t()}removeTile(e,t){const i=this.loaded,n=e.uid;i&&i[n]&&delete i[n],t()}},e.WritingMode=wd,e.ZoomDependentExpression=Yn,e.add=Ta,e.addDynamicAttributes=Yp,e.adjoint=function(e,t){var i=t[0],n=t[1],r=t[2],o=t[3],s=t[4],a=t[5],l=t[6],c=t[7],u=t[8];return e[0]=s*u-a*c,e[1]=r*c-n*u,e[2]=n*a-r*s,e[3]=a*l-o*u,e[4]=i*u-r*l,e[5]=r*o-i*a,e[6]=o*c-s*l,e[7]=n*l-i*c,e[8]=i*s-n*o,e},e.asyncAll=I,e.bezier=k,e.bindAll=F,e.boundsAttributes=Sf,e.bufferConvexPolygon=function(e,t){const i=[];for(let n=0;nne&&(e.getActor().send("enforceCacheSizeLimit",ie),ae=0)},e.calculateGlobeLabelMatrix=function(e,t){const{x:i,y:n}=e.point,r=Ml(i,n,e.worldSize/e._pixelsPerMercatorPixel,0,0);return da(r,r,Sl(ml(t)))},e.calculateGlobeMatrix=function(e){const{x:t,y:i}=e.point,{lng:n,lat:r}=e._center;return Ml(t,i,e.worldSize,n,r)},e.calculateGlobeMercatorMatrix=function(e){const t=e.pixelsPerMeter,i=t/Nl(1,e.center.lat),n=ua(new Float64Array(16));return pa(n,n,[e.point.x,e.point.y,0]),fa(n,n,[i,i,t]),Float32Array.from(n)},e.circumferenceAtLatitude=Ul,e.clamp=S,e.clearTileCache=function(e){if(!re())return;const i=t.caches.delete(Q);e&&i.catch(e).then((()=>e()))},e.clipLine=Zd,e.clone=function(e){var t=new aa(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},e.clone$1=N,e.collisionCircleLayout=Dh,e.config=r,e.conjugate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e},e.create=function(){var e=new aa(16);return aa!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e},e.create$1=la,e.createExpression=Kn,e.createLayout=Uo,e.createStyleLayer=function(e){return"custom"===e.type?new uf(e):new pf[e.type](e)},e.cross=Da,e.degToRad=x,e.distance=function(e,t){return Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2])},e.div=function(e,t,i){return e[0]=t[0]/i[0],e[1]=t[1]/i[1],e[2]=t[2]/i[2],e},e.dot=La,e.earthRadius=Ol,e.ease=C,e.easeCubicInOut=T,e.ecefToLatLng=function([e,t,i]){const n=Math.hypot(e,t,i),r=Math.atan2(e,i),o=.5*Math.PI-Math.acos(-t/n);return new Fl(w(r),w(o))},e.emitValidationErrors=$r,e.endsWith=U,e.enforceCacheSizeLimit=function(e){oe(),ee&&ee.then((t=>{t.keys().then((i=>{for(let n=0;no&&(n+=(e[r]-o)*(e[r]-o)),t[r]0){const e=180/n;ca(p,p,[e/c+1,0,0,0,e/u+1,0,-.5*e/h,.5*e/d,1])}return p[2]=l,p[5]=e.x,p[8]=e.y,p},e.getImage=ge,e.getJSON=function(e,t){return he(L(e,{type:"json"}),t)},e.getLatitudinalLod=function(e){const t=Zl-5;e=S(e,-t,t)/t*90;const i=Math.pow(Math.abs(Math.sin(x(e))),3);return Math.round(i*(al.length-1))},e.getMapSessionAPI=Re,e.getPerformanceMeasurement=$e,e.getProjection=Wp,e.getRTLTextPluginStatus=bo,e.getReferrer=ue,e.getTilePoint=function(e,{x:t,y:i},n=0){return new y(((t-n)*e.scale-e.x)*ra,(i*e.scale-e.y)*ra)},e.getTileVec3=function(e,t,i=0){return Ea(((t.x-i)*e.scale-e.x)*ra,(t.y*e.scale-e.y)*ra,Gl(t.z,t.y))},e.getVideo=function(e,i){const n=t.document.createElement("video");n.muted=!0,n.onloadstart=function(){i(null,n)};for(let i=0;i{}}},e.globeCenterToScreenPoint=function(e){const t=[0,0,0],i=ua(new Float64Array(16));return da(i,e.pixelMatrix,e.globeMatrix),za(t,t,i),new y(t[0],t[1])},e.globeDenormalizeECEF=Sl,e.globeECEFOrigin=function(e,t){const i=[0,0,0];return za(i,i,Cl(ml(t.canonical))),za(i,i,e),i},e.globeMetersToEcef=hl,e.globeNormalizeECEF=Cl,e.globePixelsToTileUnits=function(e,t){return ra/(512*Math.pow(2,e))*Tl(ml(t))},e.globePoleMatrixForTile=function(e,t,i){const n=ua(new Float64Array(16)),r=(t/(1<0;return 0===n&&!r&&!s&&o},e.identity=ua,e.identity$1=qa,e.invert=ha,e.isFullscreen=function(){return!!t.document.fullscreenElement||!!t.document.webkitFullscreenElement},e.isLngLatBehindGlobe=Pl,e.isMapAuthenticated=function(e){return Fe.has(e)},e.isMapboxURL=be,e.isSafariWithAntialiasingBug=function(e){const t=e.navigator?e.navigator.userAgent:null;return!!K(e)&&t&&(t.match("Version/15.4")||t.match("Version/15.5")||t.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/))},e.latFromMercatorY=ql,e.latLngToECEF=wl,e.len=Ua,e.length=wa,e.length$1=function(e){return Math.hypot(e[0],e[1],e[2],e[3])},e.lngFromMercatorX=$l,e.loadVectorTile=hm,e.makeRequest=he,e.mapValue=function(e,t,i,n,r){return S((e-t)/(i-t)*(r-n)+n,n,r)},e.mercatorScale=Wl,e.mercatorXfromLng=jl,e.mercatorYfromLat=Vl,e.mercatorZfromAltitude=Nl,e.mul=ba,e.mul$1=Fa,e.multiply=da,e.multiply$1=ca,e.multiply$2=Ca,e.nextPowerOfTwo=B,e.normalize=Pa,e.normalize$1=Wa,e.normalize$2=Va,e.number=Pi,e.ortho=function(e,t,i,n,r,o,s){var a=1/(t-i),l=1/(n-r),c=1/(o-s);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(t+i)*a,e[13]=(r+n)*l,e[14]=(s+o)*c,e[15]=1,e},e.pbf=qh,e.perspective=function(e,t,i,n,r){var o,s=1/Math.tan(t/2);return e[0]=s/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=r&&r!==1/0?(e[10]=(r+n)*(o=1/(n-r)),e[14]=2*r*n*o):(e[10]=-1,e[14]=-2*n),e},e.pick=function(e,t){const i={};for(let n=0;n0&&i[0]<=e.width&&i[1]>0&&i[1]<=e.height&&!Pl(e,new Fl(e.center.lat,90)),n[0]>0&&n[0]<=e.width&&n[1]>0&&n[1]<=e.height&&!Pl(e,new Fl(e.center.lat,-90))]},e.polygonContainsPoint=_c,e.polygonIntersectsBox=gc,e.polygonIntersectsPolygon=ac,e.polygonizeBounds=function(e,t,i=0,n=!0){const r=new y(i,i),o=e.sub(r),s=t.add(r),a=[o,new y(s.x,o.y),s,new y(o.x,s.y)];return n&&a.push(o.clone()),a},e.posAttributes=Ja,e.postMapLoadEvent=De,e.postPerformanceEvent=Oe,e.postTurnstileEvent=Pe,e.potpack=yd,e.prevPowerOfTwo=function(e){return e<=1?1:Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},e.radToDeg=w,e.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],e.registerForPluginStateChange=function(e){return e({pluginStatus:fo,pluginURL:mo}),yo.on("pluginStateChange",e),e},e.removeAuthState=function(e){Fe.delete(e)},e.renderColorRamp=Rc,e.resample=Kl,e.rotateX=ma,e.rotateX$1=Ga,e.rotateY=_a,e.rotateY$1=Za,e.rotateZ=function(e,t,i){var n=Math.sin(i),r=Math.cos(i),o=t[0],s=t[1],a=t[2],l=t[3],c=t[4],u=t[5],h=t[6],d=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*r+c*n,e[1]=s*r+u*n,e[2]=a*r+h*n,e[3]=l*r+d*n,e[4]=c*r-o*n,e[5]=u*r-s*n,e[6]=h*r-a*n,e[7]=d*r-l*n,e},e.rotateZ$1=function(e,t,i){i*=.5;var n=t[0],r=t[1],o=t[2],s=t[3],a=Math.sin(i),l=Math.cos(i);return e[0]=n*l+r*a,e[1]=r*l-n*a,e[2]=o*l+s*a,e[3]=s*l-o*a,e},e.scale=fa,e.scale$1=ja,e.scale$2=Aa,e.scaleAndAdd=Ia,e.set=function(e,t,i,n){return e[0]=t,e[1]=i,e[2]=n,e},e.setCacheLimits=function(e,t){ie=e,ne=t},e.setColumn=function(e,t,i){e[4*t+0]=i[0],e[4*t+1]=i[1],e[4*t+2]=i[2],e[4*t+3]=i[3]},e.setRTLTextPlugin=function(e,t,i=!1){if(fo===co||fo===uo||fo===ho)throw new Error("setRTLTextPlugin cannot be called multiple times.");mo=He.resolveURL(e),fo=co,po=t,go(),i||vo()},e.smoothstep=M,e.spec=et,e.squaredLength=function(e){var t=e[0],i=e[1],n=e[2];return t*t+i*i+n*n},e.storeAuthState=function(e,t){t?Fe.add(e):Fe.delete(e)},e.sub=Ra,e.subtract=ka,e.symbolSize=Uh,e.tileAABB=function(e,t,i,n,r,o,s,a,l){if("globe"===l.name)return function(e,t,i){const n=t/e.worldSize,r=e.globeMatrix;if(i.z<=1){const e=ml(i).getCorners();return yl(e,r,n),tl.fromPoints(e)}const o=bl(i),s=vl(o);yl(s,r,n);const a=Number.MAX_VALUE,l=[-a,-a,-a],c=[a,a,a];if(o.contains(e.center)){for(const e of s)Sa(c,c,e),Ma(l,l,e);l[2]=0;const t=e.point,i=[t.x*n,t.y*n,0];return Sa(c,c,i),Ma(l,l,i),new tl(c,l)}const u=[r[12]*n,r[13]*n,r[14]*n],h=o.getCenter(),d=S(e.center.lat,-Zl,Zl),p=S(h.lat,-Zl,Zl),f=jl(e.center.lng),m=Vl(d);let _=f-jl(h.lng);const g=m-Vl(p);_>.5?_-=1:_<-.5&&(_+=1);let y=0;Math.abs(_)>Math.abs(g)?y=_>=0?1:3:(y=g>=0?0:2,Ia(u,u,[r[4]*n,r[5]*n,r[6]*n],-Math.sin(x(g>=0?o.getSouth():o.getNorth()))*rl));const b=s[y],v=s[(y+1)%4],w=new pl(b,v,u),E=[fl(w,0)||b[0],fl(w,1)||b[1],fl(w,2)||b[2]],T=Al(e.zoom);if(T>0){const n=function({x:e,y:t,z:i},n,r,o,s){const a=1/(1<.5?d=-1:p<-.5&&(d=1),l=((l+d)*n-(o*=n))*r+o,c=((c+d)*n-o)*r+o,u=(u*n-(s*=n))*r+s,h=(h*n-s)*r+s,[[l,h,0],[c,h,0],[c,u,0],[l,u,0]]}(i,t,e._pixelsPerMercatorPixel,f,m);for(let e=0;eNr(Er(e)),e.validateFog=e=>Nr(Or(e)),e.validateLayer=e=>Nr(Mr(e)),e.validateLight=e=>Nr(Dr(e)),e.validateSource=e=>Nr(Pr(e)),e.validateStyle=Ur,e.validateTerrain=e=>Nr(zr(e)),e.values=P,e.vectorTile=Iu,e.version=i,e.warnOnce=q,e.window=t,e.wrap=A})),n(0,(function(e){function t(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e||null==e)return JSON.stringify(e);if(Array.isArray(e)){let i="[";for(const n of e)i+=`${t(n)},`;return`${i}]`}let i="{";for(const n of Object.keys(e).sort())i+=`${n}:${t(e[n])},`;return`${i}}`}function i(i){let n="";for(const r of e.refProperties)n+=`/${t(i[r])}`;return n}class n{constructor(e){this.keyCache={},e&&this.replace(e)}replace(e){this._layerConfigs={},this._layers={},this.update(e,[])}update(t,n){for(const i of t)this._layerConfigs[i.id]=i,(this._layers[i.id]=e.createStyleLayer(i)).compileFilter(),this.keyCache[i.id]&&delete this.keyCache[i.id];for(const e of n)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];this.familiesBySource={};const r=function(e,t){const n={};for(let r=0;rthis._layers[e.id])),i=t[0];if("none"===i.visibility)continue;const n=i.source||"";let r=this.familiesBySource[n];r||(r=this.familiesBySource[n]={});const o=i.sourceLayer||"_geojsonTileLayer";let s=r[o];s||(s=r[o]=[]),s.push(t)}}}class r{loadTile(t,i){const{uid:n,encoding:r,rawImageData:o,padding:s,buildQuadTree:a}=t,l=e.window.ImageBitmap&&o instanceof e.window.ImageBitmap?this.getImageData(o,s):o;i(null,new e.DEMData(n,l,r,s<1,a))}getImageData(e,t){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(e.width,e.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=e.width,this.offscreenCanvas.height=e.height,this.offscreenCanvasContext.drawImage(e,0,0,e.width,e.height);const i=this.offscreenCanvasContext.getImageData(-t,-t,e.width+2*t,e.height+2*t);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),i}}function o(e,t){if(0!==e.length){s(e[0],t);for(var i=1;i=Math.abs(a)?i-l+a:a-l+i,i=l}i+n>=0!=!!t&&e.reverse()}var a=e.getDefaultExportFromCjs((function e(t,i){var n,r=t&&t.type;if("FeatureCollection"===r)for(n=0;n>31}function E(e,t){for(var i=e.loadGeometry(),n=e.type,r=0,o=0,s=i.length,a=0;ae},S=Math.fround||(M=new Float32Array(1),e=>(M[0]=+e,M[0]));var M;const A=3,I=5,P=6;class L{constructor(e){this.options=Object.assign(Object.create(C),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){const{log:t,minZoom:i,maxZoom:n}=this.options;t&&console.time("total time");const r=`prepare ${e.length} points`;t&&console.time(r),this.points=e;const o=[];for(let t=0;t=i;e--){const i=+Date.now();s=this.trees[e]=this._createTree(this._cluster(s,e)),t&&console.log("z%d: %d clusters in %dms",e,s.numItems,+Date.now()-i)}return t&&console.timeEnd("total time"),this}getClusters(e,t){let i=((e[0]+180)%360+360)%360-180;const n=Math.max(-90,Math.min(90,e[1]));let r=180===e[2]?180:((e[2]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)i=-180,r=180;else if(i>r){const e=this.getClusters([i,n,180,o],t),s=this.getClusters([-180,n,r,o],t);return e.concat(s)}const s=this.trees[this._limitZoom(t)],a=s.range(O(i),B(o),O(r),B(n)),l=s.data,c=[];for(const e of a){const t=this.stride*e;c.push(l[t+I]>1?D(l,t,this.clusterProps):this.points[l[t+A]])}return c}getChildren(e){const t=this._getOriginId(e),i=this._getOriginZoom(e),n="No cluster with the specified id.",r=this.trees[i];if(!r)throw new Error(n);const o=r.data;if(t*this.stride>=o.length)throw new Error(n);const s=this.options.radius/(this.options.extent*Math.pow(2,i-1)),a=r.within(o[t*this.stride],o[t*this.stride+1],s),l=[];for(const t of a){const i=t*this.stride;o[i+4]===e&&l.push(o[i+I]>1?D(o,i,this.clusterProps):this.points[o[i+A]])}if(0===l.length)throw new Error(n);return l}getLeaves(e,t,i){const n=[];return this._appendLeaves(n,e,t=t||10,i=i||0,0),n}getTile(e,t,i){const n=this.trees[this._limitZoom(e)],r=Math.pow(2,e),{extent:o,radius:s}=this.options,a=s/o,l=(i-a)/r,c=(i+1+a)/r,u={features:[]};return this._addTileFeatures(n.range((t-a)/r,l,(t+1+a)/r,c),n.data,t,i,r,u),0===t&&this._addTileFeatures(n.range(1-a/r,l,1,c),n.data,r,i,r,u),t===r-1&&this._addTileFeatures(n.range(0,l,a/r,c),n.data,-1,i,r,u),u.features.length?u:null}getClusterExpansionZoom(e){let t=this._getOriginZoom(e)-1;for(;t<=this.options.maxZoom;){const i=this.getChildren(e);if(t++,1!==i.length)break;e=i[0].properties.cluster_id}return t}_appendLeaves(e,t,i,n,r){const o=this.getChildren(t);for(const t of o){const o=t.properties;if(o&&o.cluster?r+o.point_count<=n?r+=o.point_count:r=this._appendLeaves(e,o.cluster_id,i,n,r):r1;let l,c,u;if(a)l=z(t,e,this.clusterProps),c=t[e],u=t[e+1];else{const i=this.points[t[e+A]];l=i.properties;const[n,r]=i.geometry.coordinates;c=O(n),u=B(r)}const h={type:1,geometry:[[Math.round(this.options.extent*(c*r-i)),Math.round(this.options.extent*(u*r-n))]],tags:l};let d;d=a||this.options.generateId?t[e+A]:this.points[t[e+A]].id,void 0!==d&&(h.id=d),o.features.push(h)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,t){const{radius:i,extent:n,reduce:r,minPoints:o}=this.options,s=i/(n*Math.pow(2,t)),a=e.data,l=[],c=this.stride;for(let i=0;it&&(p+=a[i+I])}if(p>d&&p>=o){let e,o=n*d,s=u*d,f=-1;const m=((i/c|0)<<5)+(t+1)+this.points.length;for(const n of h){const l=n*c;if(a[l+2]<=t)continue;a[l+2]=t;const u=a[l+I];o+=a[l]*u,s+=a[l+1]*u,a[l+4]=m,r&&(e||(e=this._map(a,i,!0),f=this.clusterProps.length,this.clusterProps.push(e)),r(e,this._map(a,l)))}a[i+4]=m,l.push(o/p,s/p,1/0,m,-1,p),r&&l.push(f)}else{for(let e=0;e1)for(const e of h){const i=e*c;if(!(a[i+2]<=t)){a[i+2]=t;for(let e=0;e>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,t,i){if(e[t+I]>1){const n=this.clusterProps[e[t+P]];return i?Object.assign({},n):n}const n=this.points[e[t+A]].properties,r=this.options.map(n);return i&&r===n?Object.assign({},r):r}}function D(e,t,i){return{type:"Feature",id:e[t+A],properties:z(e,t,i),geometry:{type:"Point",coordinates:[(n=e[t],360*(n-.5)),R(e[t+1])]}};var n}function z(e,t,i){const n=e[t+I],r=n>=1e4?`${Math.round(n/1e3)}k`:n>=1e3?Math.round(n/100)/10+"k":n,o=e[t+P],s=-1===o?{}:Object.assign({},i[o]);return Object.assign(s,{cluster:!0,cluster_id:e[t+A],point_count:n,point_count_abbreviated:r})}function O(e){return e/360+.5}function B(e){const t=Math.sin(e*Math.PI/180),i=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return i<0?0:i>1?1:i}function R(e){const t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function F(e,t,i,n){for(var r,o=n,s=i-t>>1,a=i-t,l=e[t],c=e[t+1],u=e[i],h=e[i+1],d=t+3;do)r=d,o=p;else if(p===o){var f=Math.abs(d-s);fn&&(r-t>3&&F(e,t,r,n),e[r+2]=o,i-r>3&&F(e,r,i,n))}function U(e,t,i,n,r,o){var s=r-i,a=o-n;if(0!==s||0!==a){var l=((e-i)*s+(t-n)*a)/(s*s+a*a);l>1?(i=r,n=o):l>0&&(i+=s*l,n+=a*l)}return(s=e-i)*s+(a=t-n)*a}function j(e,t,i,n){var r={id:void 0===e?null:e,type:t,geometry:i,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(e){var t=e.geometry,i=e.type;if("Point"===i||"MultiPoint"===i||"LineString"===i)V(e,t);else if("Polygon"===i||"MultiLineString"===i)for(var n=0;n0&&(s+=n?(r*c-l*o)/2:Math.sqrt(Math.pow(l-r,2)+Math.pow(c-o,2))),r=l,o=c}var u=t.length-3;t[2]=1,F(t,0,u,i),t[u+2]=1,t.size=Math.abs(s),t.start=0,t.end=t.size}function G(e,t,i,n){for(var r=0;r1?1:i}function H(e,t,i,n,r,o,s,a){if(n/=t,o>=(i/=t)&&s=n)return null;for(var l=[],c=0;c=i&&f=n)){var m=[];if("Point"===d||"MultiPoint"===d)X(h,m,i,n,r);else if("LineString"===d)K(h,m,i,n,r,!1,a.lineMetrics);else if("MultiLineString"===d)Y(h,m,i,n,r,!1);else if("Polygon"===d)Y(h,m,i,n,r,!0);else if("MultiPolygon"===d)for(var _=0;_=i&&s<=n&&(t.push(e[o]),t.push(e[o+1]),t.push(e[o+2]))}}function K(e,t,i,n,r,o,s){for(var a,l,c=J(e),u=0===r?ee:te,h=e.start,d=0;di&&(l=u(c,p,f,_,g,i),s&&(c.start=h+a*l)):y>n?b=i&&(l=u(c,p,f,_,g,i),v=!0),b>n&&y<=n&&(l=u(c,p,f,_,g,n),v=!0),!o&&v&&(s&&(c.end=h+a*l),t.push(c),c=J(e)),s&&(h+=a)}var x=e.length-3;p=e[x],f=e[x+1],m=e[x+2],(y=0===r?p:f)>=i&&y<=n&&Q(c,p,f,m),x=c.length-3,o&&x>=3&&(c[x]!==c[0]||c[x+1]!==c[1])&&Q(c,c[0],c[1],c[2]),c.length&&t.push(c)}function J(e){var t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function Y(e,t,i,n,r,o){for(var s=0;ss.maxX&&(s.maxX=u),h>s.maxY&&(s.maxY=h)}return s}function ae(e,t,i,n){var r=t.geometry,o=t.type,s=[];if("Point"===o||"MultiPoint"===o)for(var a=0;a0&&t.size<(r?s:n))i.numPoints+=t.length/3;else{for(var a=[],l=0;ls)&&(i.numSimplified++,a.push(t[l]),a.push(t[l+1])),i.numPoints++;r&&function(e,t){for(var i=0,n=0,r=e.length,o=r-2;n0===t)for(n=0,r=e.length;n24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");var n=function(e,t){var i=[];if("FeatureCollection"===e.type)for(var n=0;n1&&console.time("creation"),d=this.tiles[h]=se(e,t,i,n,l),this.tileCoords.push({z:t,x:i,y:n}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,i,n,d.numFeatures,d.numPoints,d.numSimplified),console.timeEnd("creation"));var p="z"+t;this.stats[p]=(this.stats[p]||0)+1,this.total++}if(d.source=e,r){if(t===l.maxZoom||t===r)continue;var f=1<1&&console.time("clipping");var m,_,g,y,b,v,x=.5*l.buffer/l.extent,w=.5-x,E=.5+x,T=1+x;m=_=g=y=null,b=H(e,u,i-x,i+E,0,d.minX,d.maxX,l),v=H(e,u,i+w,i+T,0,d.minX,d.maxX,l),e=null,b&&(m=H(b,u,n-x,n+E,1,d.minY,d.maxY,l),_=H(b,u,n+w,n+T,1,d.minY,d.maxY,l),b=null),v&&(g=H(v,u,n-x,n+E,1,d.minY,d.maxY,l),y=H(v,u,n+w,n+T,1,d.minY,d.maxY,l),v=null),c>1&&console.timeEnd("clipping"),a.push(m||[],t+1,2*i,2*n),a.push(_||[],t+1,2*i,2*n+1),a.push(g||[],t+1,2*i+1,2*n),a.push(y||[],t+1,2*i+1,2*n+1)}}},ce.prototype.getTile=function(e,t,i){var n=this.options,r=n.extent,o=n.debug;if(e<0||e>24)return null;var s=1<1&&console.log("drilling down to z%d-%d-%d",e,t,i);for(var l,c=e,u=t,h=i;!l&&c>0;)c--,u=Math.floor(u/2),h=Math.floor(h/2),l=this.tiles[ue(c,u,h)];return l&&l.source?(o>1&&console.log("found parent tile z%d-%d-%d",c,u,h),o>1&&console.time("drilling down"),this.splitTile(l.source,c,u,h,e,t,i),o>1&&console.timeEnd("drilling down"),this.tiles[a]?re(this.tiles[a],r):null):null};class de extends e.VectorTileWorkerSource{constructor(e,t,i,n,r){super(e,t,i,n,he),r&&(this.loadGeoJSON=r)}loadData(t,i){const n=t&&t.request,r=n&&n.collectResourceTiming;this.loadGeoJSON(t,((o,s)=>{if(o||!s)return i(o);if("object"!=typeof s)return i(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));{a(s,!0);try{if(t.filter){const i=e.createExpression(t.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===i.result)throw new Error(i.value.map((e=>`${e.key}: ${e.message}`)).join(", "));const n=s.features.filter((e=>i.value.evaluate({zoom:0},e)));s={type:"FeatureCollection",features:n}}this._geoJSONIndex=t.cluster?new L(function({superclusterOptions:t,clusterProperties:i}){if(!i||!t)return t;const n={},r={},o={accumulated:null,zoom:0},s={properties:null},a=Object.keys(i);for(const t of a){const[o,s]=i[t],a=e.createExpression(s),l=e.createExpression("string"==typeof o?[o,["accumulated"],["get",t]]:o);n[t]=a.value,r[t]=l.value}return t.map=e=>{s.properties=e;const t={};for(const e of a)t[e]=n[e].evaluate(o,s);return t},t.reduce=(e,t)=>{s.properties=t;for(const t of a)o.accumulated=e[t],e[t]=r[t].evaluate(o,s)},t}(t)).load(s.features):function(e,t){return new ce(e,t)}(s,t.geojsonVtOptions)}catch(o){return i(o)}this.loaded={};const l={};if(r){const i=e.getPerformanceMeasurement(n);i&&(l.resourceTiming={},l.resourceTiming[t.source]=JSON.parse(JSON.stringify(i)))}i(null,l)}}))}reloadTile(e,t){const i=this.loaded;return i&&i[e.uid]?super.reloadTile(e,t):this.loadTile(e,t)}loadGeoJSON(t,i){if(t.request)e.getJSON(t.request,i);else{if("string"!=typeof t.data)return i(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));try{return i(null,JSON.parse(t.data))}catch(e){return i(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(e,t){try{t(null,this._geoJSONIndex.getClusterExpansionZoom(e.clusterId))}catch(e){t(e)}}getClusterChildren(e,t){try{t(null,this._geoJSONIndex.getChildren(e.clusterId))}catch(e){t(e)}}getClusterLeaves(e,t){try{t(null,this._geoJSONIndex.getLeaves(e.clusterId,e.limit,e.offset))}catch(e){t(e)}}}class pe{constructor(t){this.self=t,this.actor=new e.Actor(t,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=e.getProjection({name:"mercator"}),this.workerSourceTypes={vector:e.VectorTileWorkerSource,geojson:de},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(e,t)=>{if(this.workerSourceTypes[e])throw new Error(`Worker source with name "${e}" already registered.`);this.workerSourceTypes[e]=t},this.self.registerRTLTextPlugin=t=>{if(e.plugin.isParsed())throw new Error("RTL text plugin already registered.");e.plugin.applyArabicShaping=t.applyArabicShaping,e.plugin.processBidirectionalText=t.processBidirectionalText,e.plugin.processStyledBidirectionalText=t.processStyledBidirectionalText}}clearCaches(e,t,i){delete this.layerIndexes[e],delete this.availableImages[e],delete this.workerSources[e],delete this.demWorkerSources[e],i()}checkIfReady(e,t,i){i()}setReferrer(e,t){this.referrer=t}spriteLoaded(t,i){this.isSpriteLoaded[t]=i;for(const n in this.workerSources[t]){const r=this.workerSources[t][n];for(const t in r)r[t]instanceof e.VectorTileWorkerSource&&(r[t].isSpriteLoaded=i,r[t].fire(new e.Event("isSpriteLoaded")))}}setImages(e,t,i){this.availableImages[e]=t;for(const i in this.workerSources[e]){const n=this.workerSources[e][i];for(const e in n)n[e].availableImages=t}i()}enableTerrain(e,t,i){this.terrain=t,i()}setProjection(t,i){this.projections[t]=e.getProjection(i)}setLayers(e,t,i){this.getLayerIndex(e).replace(t),i()}updateLayers(e,t,i){this.getLayerIndex(e).update(t.layers,t.removedIds),i()}loadTile(t,i,n){const r=this.enableTerrain?e.extend({enableTerrain:this.terrain},i):i;r.projection=this.projections[t]||this.defaultProjection,this.getWorkerSource(t,i.type,i.source).loadTile(r,n)}loadDEMTile(t,i,n){const r=this.enableTerrain?e.extend({buildQuadTree:this.terrain},i):i;this.getDEMWorkerSource(t,i.source).loadTile(r,n)}reloadTile(t,i,n){const r=this.enableTerrain?e.extend({enableTerrain:this.terrain},i):i;r.projection=this.projections[t]||this.defaultProjection,this.getWorkerSource(t,i.type,i.source).reloadTile(r,n)}abortTile(e,t,i){this.getWorkerSource(e,t.type,t.source).abortTile(t,i)}removeTile(e,t,i){this.getWorkerSource(e,t.type,t.source).removeTile(t,i)}removeSource(e,t,i){if(!this.workerSources[e]||!this.workerSources[e][t.type]||!this.workerSources[e][t.type][t.source])return;const n=this.workerSources[e][t.type][t.source];delete this.workerSources[e][t.type][t.source],void 0!==n.removeSource?n.removeSource(t,i):i()}loadWorkerSource(e,t,i){try{this.self.importScripts(t.url),i()}catch(e){i(e.toString())}}syncRTLPluginState(t,i,n){try{e.plugin.setState(i);const t=e.plugin.getPluginURL();if(e.plugin.isLoaded()&&!e.plugin.isParsed()&&null!=t){this.self.importScripts(t);const i=e.plugin.isParsed();n(i?void 0:new Error(`RTL Text Plugin failed to import scripts from ${t}`),i)}}catch(e){n(e.toString())}}getAvailableImages(e){let t=this.availableImages[e];return t||(t=[]),t}getLayerIndex(e){let t=this.layerIndexes[e];return t||(t=this.layerIndexes[e]=new n),t}getWorkerSource(e,t,i){if(this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][t]||(this.workerSources[e][t]={}),!this.workerSources[e][t][i]){const n={send:(t,i,n,r,o,s)=>{this.actor.send(t,i,n,e,o,s)},scheduler:this.actor.scheduler};this.workerSources[e][t][i]=new this.workerSourceTypes[t](n,this.getLayerIndex(e),this.getAvailableImages(e),this.isSpriteLoaded[e])}return this.workerSources[e][t][i]}getDEMWorkerSource(e,t){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][t]||(this.demWorkerSources[e][t]=new r),this.demWorkerSources[e][t]}enforceCacheSizeLimit(t,i){e.enforceCacheSizeLimit(i)}getWorkerPerformanceMetrics(e,t,i){i(void 0,void 0)}}return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new pe(self)),pe})),n(0,(function(e){function t(e,i){if(Array.isArray(e)){if(!Array.isArray(i)||e.length!==i.length)return!1;for(let n=0;n{e.window.removeEventListener("click",d,!0)}),0)}function f(e,t){const i=e.getBoundingClientRect();return g(e,i,t)}function m(e,t){const i=e.getBoundingClientRect(),n=[];for(let r=0;r=0?0:t.button}function g(t,i,n){const r=t.offsetWidth===i.width?1:t.offsetWidth/i.width;return new e.Point((n.clientX-i.left)*r,(n.clientY-i.top)*r)}function y(e,t){var i=t[0],n=t[1],r=t[2],o=t[3],s=i*o-r*n;return s?(e[0]=o*(s=1/s),e[1]=-n*s,e[2]=-r*s,e[3]=i*s,e):null}function b(e){const{userImage:t}=e;return!!(t&&t.render&&t.render())&&(e.data.replace(new Uint8Array(t.data.buffer)),!0)}class v extends e.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new e.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(const{ids:e,callback:t}of this.requestors)this._notify(e,t);this.requestors=[]}}hasImage(e){return!!this.getImage(e)}getImage(e){return this.images[e]}addImage(e,t){this._validate(e,t)&&(this.images[e]=t)}_validate(t,i){let n=!0;return this._validateStretch(i.stretchX,i.data&&i.data.width)||(this.fire(new e.ErrorEvent(new Error(`Image "${t}" has invalid "stretchX" value`))),n=!1),this._validateStretch(i.stretchY,i.data&&i.data.height)||(this.fire(new e.ErrorEvent(new Error(`Image "${t}" has invalid "stretchY" value`))),n=!1),this._validateContent(i.content,i)||(this.fire(new e.ErrorEvent(new Error(`Image "${t}" has invalid "content" value`))),n=!1),n}_validateStretch(e,t){if(!e)return!0;let i=0;for(const n of e){if(n[0]{this.ready=!0}))}broadcast(t,i,n){e.asyncAll(this.actors,((e,n)=>{e.send(t,i,n)}),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)}}function I(t,i,n){return i*(e.EXTENT/(t.tileSize*Math.pow(2,n-t.tileID.overscaledZ)))}A.Actor=e.Actor;class P{constructor(e,t,i,n){this.screenBounds=e,this.cameraPoint=t,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=i,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,n)}static createFromScreenPoints(t,i){let n,r;if(t instanceof e.Point||"number"==typeof t[0]){const o=e.Point.convert(t);n=[o],r=i.isPointAboveHorizon(o)}else{const o=e.Point.convert(t[0]),s=e.Point.convert(t[1]);n=[o,s],r=e.polygonizeBounds(o,s).every((e=>i.isPointAboveHorizon(e)))}return new P(n,i.getCameraPoint(),r,i)}isPointQuery(){return 1===this.screenBounds.length}bufferedScreenGeometry(t){return e.polygonizeBounds(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],t)}bufferedCameraGeometry(t){const i=this.screenBounds[0],n=1===this.screenBounds.length?this.screenBounds[0].add(new e.Point(1,1)):this.screenBounds[1],r=e.polygonizeBounds(i,n,0,!1);return this.cameraPoint.y>n.y&&(this.cameraPoint.x>i.x&&this.cameraPoint.x=n.x?r[2]=this.cameraPoint:this.cameraPoint.x<=i.x&&(r[3]=this.cameraPoint)),e.bufferConvexPolygon(r,t)}bufferedCameraGeometryGlobe(t){const i=this.screenBounds[0],n=1===this.screenBounds.length?this.screenBounds[0].add(new e.Point(1,1)):this.screenBounds[1],r=e.polygonizeBounds(i,n,t),o=this.cameraPoint.clone();switch(3*((o.y>i.y)+(o.y>n.y))+((o.x>i.x)+(o.x>n.x))){case 0:r[0]=o,r[4]=o.clone();break;case 1:r.splice(1,0,o);break;case 2:r[1]=o;break;case 3:r.splice(4,0,o);break;case 5:r.splice(2,0,o);break;case 6:r[3]=o;break;case 7:r.splice(3,0,o);break;case 8:r[2]=o}return r}containsTile(t,i,n,r=0){const o=t.queryPadding/i._pixelsPerMercatorPixel+1,s=n?this._bufferedCameraMercator(o,i):this._bufferedScreenMercator(o,i);let a=t.tileID.wrap+(s.unwrapped?r:0);const l=s.polygon.map((i=>e.getTilePoint(t.tileTransform,i,a)));if(!e.polygonIntersectsBox(l,0,0,e.EXTENT,e.EXTENT))return;a=t.tileID.wrap+(this.screenGeometryMercator.unwrapped?r:0);const c=this.screenGeometryMercator.polygon.map((i=>e.getTileVec3(t.tileTransform,i,a))),u=c.map((t=>new e.Point(t[0],t[1]))),h=i.getFreeCameraOptions().position||new e.MercatorCoordinate(0,0,0),d=e.getTileVec3(t.tileTransform,h,a),p=c.map((t=>{const i=e.sub(t,t,d);return e.normalize(i,i),new e.Ray(d,i)})),f=I(t,1,i.zoom)*i._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:u,tilespaceRays:p,bufferedTilespaceGeometry:l,bufferedTilespaceBounds:(m=e.getBounds(l),m.min.x=e.clamp(m.min.x,0,e.EXTENT),m.min.y=e.clamp(m.min.y,0,e.EXTENT),m.max.x=e.clamp(m.max.x,0,e.EXTENT),m.max.y=e.clamp(m.max.y,0,e.EXTENT),m),tile:t,tileID:t.tileID,pixelToTileUnitsFactor:f};var m}_bufferedScreenMercator(e,t){const i=z(e);if(this._screenRaycastCache[i])return this._screenRaycastCache[i];{let n;return n="globe"===t.projection.name?this._projectAndResample(this.bufferedScreenGeometry(e),t):{polygon:this.bufferedScreenGeometry(e).map((e=>t.pointCoordinate3D(e))),unwrapped:!0},this._screenRaycastCache[i]=n,n}}_bufferedCameraMercator(e,t){const i=z(e);if(this._cameraRaycastCache[i])return this._cameraRaycastCache[i];{let n;return n="globe"===t.projection.name?this._projectAndResample(this.bufferedCameraGeometryGlobe(e),t):{polygon:this.bufferedCameraGeometry(e).map((e=>t.pointCoordinate3D(e))),unwrapped:!0},this._cameraRaycastCache[i]=n,n}}_projectAndResample(t,i){const n=function(t,i){const n=e.multiply([],i.pixelMatrix,i.globeMatrix),r=[0,-e.GLOBE_RADIUS,0,1],o=[0,e.GLOBE_RADIUS,0,1],s=[0,0,0,1];e.transformMat4$1(r,r,n),e.transformMat4$1(o,o,n),e.transformMat4$1(s,s,n);const a=new e.Point(r[0]/r[3],r[1]/r[3]),l=new e.Point(o[0]/o[3],o[1]/o[3]),c=e.polygonContainsPoint(t,a)&&r[3]1?L(t.slice(0,d),i):[],m=dnew e.Point(D(t.x),t.y))),m=m.map((t=>new e.Point(D(t.x),t.y)));const _=[...f];0===_.length&&_.push(m[m.length-1]);const g=e.number(_[_.length-1].y,(0===m.length?f[0]:m[0]).y,p);let y;return y=c?[new e.Point(0,g),new e.Point(0,0),new e.Point(1,0),new e.Point(1,g)]:[new e.Point(1,g),new e.Point(1,1),new e.Point(0,1),new e.Point(0,g)],_.push(...y),0===m.length?_.push(f[0]):_.push(...m),{polygon:_.map((t=>new e.MercatorCoordinate(t.x,t.y))),unwrapped:!1}}(t,i);if(n)return n;const r=function(t,i){let n=!1,r=-1/0,o=0;for(let e=0;er&&(r=t[e].x,o=e);for(let e=0;e.5&&(r.x{e.x-=1})),{polygon:t,unwrapped:n}}(L(t,i).map((t=>new e.Point(D(t.x),t.y))),i);return{polygon:r.polygon.map((t=>new e.MercatorCoordinate(t.x,t.y))),unwrapped:r.unwrapped}}}function L(t,i){return e.resample(t,(e=>{const t=i.pointCoordinate3D(e);e.x=t.x,e.y=t.y}),1/256)}function D(e){return e<0?1+e%1:e%1}function z(e){return 100*e|0}function O(t,i,n,r,o){const s=function(n,r){if(n)return o(n);if(r){t.url&&r.tiles&&t.tiles&&delete t.tiles;const n=e.pick(e.extend(r,t),["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding"]);r.vector_layers&&(n.vectorLayers=r.vector_layers,n.vectorLayerIds=n.vectorLayers.map((e=>e.id))),n.tiles=i.canonicalizeTileset(n,t.url),o(null,n)}};return t.url?e.getJSON(i.transformRequest(i.normalizeSourceURL(t.url,null,n,r),e.ResourceType.Source),s):e.exported.frame((()=>s(null,t)))}class B{constructor(t,i,n){this.bounds=e.LngLatBounds.convert(this.validateBounds(t)),this.minzoom=i||0,this.maxzoom=n||24}validateBounds(e){return Array.isArray(e)&&4===e.length?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(t){const i=Math.pow(2,t.z),n=Math.floor(e.mercatorXfromLng(this.bounds.getWest())*i),r=Math.floor(e.mercatorYfromLat(this.bounds.getNorth())*i),o=Math.ceil(e.mercatorXfromLng(this.bounds.getEast())*i),s=Math.ceil(e.mercatorYfromLat(this.bounds.getSouth())*i);return t.x>=n&&t.x=r&&t.y{this._tileJSONRequest=null,this._loaded=!0,r?(i&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${i}`),n&&2!==n.length&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${n}`),this.fire(new e.ErrorEvent(r))):o&&(e.extend(this,o),o.bounds&&(this.tileBounds=new B(o.bounds,this.minzoom,this.maxzoom)),e.postTurnstileEvent(o.tiles,this.map._requestManager._customAccessToken),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"}))),t&&t(r)}))}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}reload(){this.cancelTileJSONRequest(),this.load((()=>this.map.style._clearSource(this.id)))}setTiles(e){return this._options.tiles=e,this.reload(),this}setUrl(e){return this.url=e,this._options.url=e,this.reload(),this}onRemove(){this.cancelTileJSONRequest()}serialize(){return e.extend({},this._options)}loadTile(t,i){const n=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme)),r={request:this.map._requestManager.transformRequest(n,e.ResourceType.Tile),data:void 0,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:e.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:t.isSymbolTile};if(r.request.collectResourceTiming=this._collectResourceTiming,t.actor&&"expired"!==t.state)"loading"===t.state?t.reloadCallback=i:t.request=t.actor.send("reloadTile",r,o.bind(this));else if(t.actor=this._tileWorkers[n]=this._tileWorkers[n]||this.dispatcher.getActor(),this.dispatcher.ready)t.request=t.actor.send("loadTile",r,o.bind(this),void 0,!0);else{const i=e.loadVectorTile.call({deduped:this._deduped},r,((e,i)=>{e||!i?o.call(this,e):(r.data={cacheControl:i.cacheControl,expires:i.expires,rawData:i.rawData.slice(0)},t.actor&&t.actor.send("loadTile",r,o.bind(this),void 0,!0))}),!0);t.request={cancel:i}}function o(n,r){return delete t.request,t.aborted?i(null):n&&404!==n.status?i(n):(r&&r.resourceTiming&&(t.resourceTiming=r.resourceTiming),this.map._refreshExpiredTiles&&r&&t.setExpiryData(r),t.loadVectorData(r,this.map.painter),e.cacheEntryPossiblyAdded(this.dispatcher),i(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.actor&&e.actor.send("abortTile",{uid:e.uid,type:this.type,source:this.id})}unloadTile(e){e.unloadVectorData(),e.actor&&e.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id})}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class Ce extends e.Evented{constructor(t,i,n,r){super(),this.id=t,this.dispatcher=n,this.setEventedParent(r),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=e.extend({type:"raster"},i),e.extend(this,e.pick(i,["url","scheme","tileSize"]))}load(t){this._loaded=!1,this.fire(new e.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=O(this._options,this.map._requestManager,null,null,((i,n)=>{this._tileJSONRequest=null,this._loaded=!0,i?this.fire(new e.ErrorEvent(i)):n&&(e.extend(this,n),n.bounds&&(this.tileBounds=new B(n.bounds,this.minzoom,this.maxzoom)),e.postTurnstileEvent(n.tiles),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"}))),t&&t(i)}))}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}reload(){this.cancelTileJSONRequest(),this.load((()=>this.map.style._clearSource(this.id)))}setTiles(e){return this._options.tiles=e,this.reload(),this}setUrl(e){return this.url=e,this._options.url=e,this.reload(),this}onRemove(){this.cancelTileJSONRequest()}serialize(){return e.extend({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(t,i){const n=e.exported.devicePixelRatio>=2,r=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),n,this.tileSize);t.request=e.getImage(this.map._requestManager.transformRequest(r,e.ResourceType.Tile),((n,r,o,s)=>(delete t.request,t.aborted?(t.state="unloaded",i(null)):n?(t.state="errored",i(n)):r?(this.map._refreshExpiredTiles&&t.setExpiryData({cacheControl:o,expires:s}),t.setTexture(r,this.map.painter),t.state="loaded",e.cacheEntryPossiblyAdded(this.dispatcher),void i(null)):i(null))))}static loadTileData(e,t,i){e.setTexture(t,i)}static unloadTileData(e,t){e.texture&&t.saveTileTexture(e.texture)}abortTile(e,t){e.request&&(e.request.cancel(),delete e.request),t()}unloadTile(e,t){e.texture&&this.map.painter.saveTileTexture(e.texture),t()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}function Se(t,i,n,r,o,s,a,l){const c=[t,n,o,i,r,s,1,1,1],u=[a,l,1],h=e.adjoint([],c),[d,p,f]=e.transformMat3(u,u,e.transpose(h,h));return e.multiply$1(c,[d,0,0,0,p,0,0,0,f],c)}class Me extends e.Evented{constructor(e,t,i,n){super(),this.id=e,this.dispatcher=i,this.coordinates=t.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(n),this.options=t,this._dirty=!1}load(t,i){this._loaded=i||!1,this.fire(new e.Event("dataloading",{dataType:"source"})),this.url=this.options.url,this._imageRequest=e.getImage(this.map._requestManager.transformRequest(this.url,e.ResourceType.Image),((i,n)=>{if(this._imageRequest=null,this._loaded=!0,i)this.fire(new e.ErrorEvent(i));else if(n){const{HTMLImageElement:i}=e.window;this.image=n instanceof i?e.exported.getImageData(n):n,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,t&&(this.coordinates=t),this._finishLoading()}}))}loaded(){return this._loaded}updateImage(e){return this.image&&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}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),this.texture&&this.texture.destroy()}setCoordinates(t){this.coordinates=t,this._boundsArray=void 0;const i=t.map(e.MercatorCoordinate.fromLngLat);return this.tileID=function(t){let i=1/0,n=1/0,r=-1/0,o=-1/0;for(const e of t)i=Math.min(i,e.x),n=Math.min(n,e.y),r=Math.max(r,e.x),o=Math.max(o,e.y);const s=Math.max(r-i,o-n),a=Math.max(0,Math.floor(-Math.log(s)/Math.LN2)),l=Math.pow(2,a);return new e.CanonicalTileID(a,Math.floor((i+r)/2*l),Math.floor((n+o)/2*l))}(i),this.minzoom=this.maxzoom=this.tileID.z,this.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){this._boundsArray=void 0}_prepareData(t){for(const e in this.tiles){const t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture)}if(this._boundsArray)return;const i=e.tileTransform(this.tileID,this.map.transform.projection),[n,r,o,s]=this.coordinates.map((t=>{const n=i.projection.project(t[0],t[1]);return e.getTilePoint(i,n)._round()}));this.perspectiveTransform=function(t,i,n,r,o,s,a,l,c,u){const h=Se(0,0,t,0,0,i,t,i),d=Se(n,r,o,s,a,l,c,u);return e.multiply$1(d,e.adjoint(h,h),d),[d[6]/d[8]*t/e.EXTENT,d[7]/d[8]*i/e.EXTENT]}(this.width,this.height,n.x,n.y,r.x,r.y,s.x,s.y,o.x,o.y);const a=this._boundsArray=new e.StructArrayLayout4i8;a.emplaceBack(n.x,n.y,0,0),a.emplaceBack(r.x,r.y,e.EXTENT,0),a.emplaceBack(s.x,s.y,0,e.EXTENT),a.emplaceBack(o.x,o.y,e.EXTENT,e.EXTENT),this.boundsBuffer&&this.boundsBuffer.destroy(),this.boundsBuffer=t.createVertexBuffer(a,e.boundsAttributes.members),this.boundsSegments=e.SegmentVector.simpleSegment(0,0,4,2)}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const t=this.map.painter.context,i=t.gl;this._dirty&&(this.texture?this.texture.update(this.image):(this.texture=new e.Texture(t,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE)),this._dirty=!1),this._prepareData(t)}loadTile(e,t){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={},t(null)):(e.state="errored",t(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}const Ae={vector:ke,raster:Ce,"raster-dem":class extends Ce{constructor(t,i,n,r){super(t,i,n,r),this.type="raster-dem",this.maxzoom=22,this._options=e.extend({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox"}loadTile(t,i){const n=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function r(e,n){e&&(t.state="errored",i(e)),n&&(t.dem=n,t.dem.onDeserialize(),t.needsHillshadePrepare=!0,t.needsDEMTextureUpload=!0,t.state="loaded",i(null))}t.request=e.getImage(this.map._requestManager.transformRequest(n,e.ResourceType.Tile),function(n,o,s,a){if(delete t.request,t.aborted)t.state="unloaded",i(null);else if(n)t.state="errored",i(n);else if(o){this.map._refreshExpiredTiles&&t.setExpiryData({cacheControl:s,expires:a});const i=e.window.ImageBitmap&&o instanceof e.window.ImageBitmap&&(null==se&&(se=e.window.OffscreenCanvas&&new e.window.OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof e.window.createImageBitmap),se),n=1-(o.width-e.prevPowerOfTwo(o.width))/2;n<1||t.neighboringTiles||(t.neighboringTiles=this._getNeighboringTiles(t.tileID));const l=i?o:e.exported.getImageData(o,n),c={uid:t.uid,coord:t.tileID,source:this.id,rawImageData:l,encoding:this.encoding,padding:n};t.actor&&"expired"!==t.state||(t.actor=this.dispatcher.getActor(),t.actor.send("loadDEMTile",c,r.bind(this),void 0,!0))}}.bind(this))}_getNeighboringTiles(t){const i=t.canonical,n=Math.pow(2,i.z),r=(i.x-1+n)%n,o=0===i.x?t.wrap-1:t.wrap,s=(i.x+1+n)%n,a=i.x+1===n?t.wrap+1:t.wrap,l={};return l[new e.OverscaledTileID(t.overscaledZ,o,i.z,r,i.y).key]={backfilled:!1},l[new e.OverscaledTileID(t.overscaledZ,a,i.z,s,i.y).key]={backfilled:!1},i.y>0&&(l[new e.OverscaledTileID(t.overscaledZ,o,i.z,r,i.y-1).key]={backfilled:!1},l[new e.OverscaledTileID(t.overscaledZ,t.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new e.OverscaledTileID(t.overscaledZ,a,i.z,s,i.y-1).key]={backfilled:!1}),i.y+1{if(this._loaded=!0,this._pendingLoad=null,t)this.fire(new e.ErrorEvent(t));else{const t={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&i&&i.resourceTiming&&i.resourceTiming[this.id]&&(t.resourceTiming=i.resourceTiming[this.id]),this.fire(new e.Event("data",t)),this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(),this._coalesce=!1)}))}loaded(){return this._loaded}loadTile(t,i){const n=t.actor?"reloadTile":"loadTile";t.actor=this.actor,t.request=this.actor.send(n,{type:this.type,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:e.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId},((e,r)=>(delete t.request,t.unloadVectorData(),t.aborted?i(null):e?i(e):(t.loadVectorData(r,this.map.painter,"reloadTile"===n),i(null)))),void 0,"loadTile"===n)}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.aborted=!0}unloadTile(e){e.unloadVectorData(),this.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id})}onRemove(){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return e.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends Me{constructor(e,t,i,n){super(e,t,i,n),this.roundZoom=!0,this.type="video",this.options=t}load(){this._loaded=!1;const t=this.options;this.urls=[];for(const i of t.urls)this.urls.push(this.map._requestManager.transformRequest(i,e.ResourceType.Source).url);e.getVideo(this.urls,((t,i)=>{this._loaded=!0,t?this.fire(new e.ErrorEvent(t)):i&&(this.video=i,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(t){if(this.video){const i=this.video.seekable;ti.end(0)?this.fire(new e.ErrorEvent(new e.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const t=this.map.painter.context,i=t.gl;this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new e.Texture(t,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(t)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:Me,canvas:class extends Me{constructor(t,i,n,r){super(t,i,n,r),i.coordinates?Array.isArray(i.coordinates)&&4===i.coordinates.length&&!i.coordinates.some((e=>!Array.isArray(e)||2!==e.length||e.some((e=>"number"!=typeof e))))||this.fire(new e.ErrorEvent(new e.ValidationError(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new e.ErrorEvent(new e.ValidationError(`sources.${t}`,null,'missing required property "coordinates"'))),i.animate&&"boolean"!=typeof i.animate&&this.fire(new e.ErrorEvent(new e.ValidationError(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),i.canvas?"string"==typeof i.canvas||i.canvas instanceof e.window.HTMLCanvasElement||this.fire(new e.ErrorEvent(new e.ValidationError(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new e.ErrorEvent(new e.ValidationError(`sources.${t}`,null,'missing required property "canvas"'))),this.options=i,this.animate=void 0===i.animate||i.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof e.window.HTMLCanvasElement?this.options.canvas:e.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new e.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions())return;if(0===Object.keys(this.tiles).length)return;const i=this.map.painter.context;this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new e.Texture(i,this.canvas,i.gl.RGBA,{premultiply:!0}),this._prepareData(i)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}},custom:class extends e.Evented{constructor(t,i,n,r){super(),this.id=t,this.type="custom",this._dataType="raster",this._dispatcher=n,this._implementation=i,this.setEventedParent(r),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new e.ErrorEvent(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new e.ErrorEvent(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new B(this._implementation.bounds,this.minzoom,this.maxzoom)),i.update=this._update.bind(this),i.clearTiles=this._clearTiles.bind(this),i.coveringTiles=this._coveringTiles.bind(this),e.extend(this,e.pick(i,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return e.pick(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new e.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(t){this._map=t,this._loaded=!1,this.fire(new e.Event("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(t),this.load()}onRemove(e){this._implementation.onRemove&&this._implementation.onRemove(e)}hasTile(e){if(this._implementation.hasTile){const{x:t,y:i,z:n}=e.canonical;return this._implementation.hasTile({x:t,y:i,z:n})}return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(t,i){const{x:n,y:r,z:o}=t.tileID.canonical,s=new e.window.AbortController;t.request=Promise.resolve(this._implementation.loadTile({x:n,y:r,z:o},{signal:s.signal})).then(function(n){return delete t.request,t.aborted?(t.state="unloaded",i(null)):void 0===n?(t.state="errored",i(null)):null===n?(this.loadTileData(t,{width:this.tileSize,height:this.tileSize,data:null}),t.state="loaded",i(null)):function(t){return t instanceof e.window.ImageData||t instanceof e.window.HTMLCanvasElement||t instanceof e.window.ImageBitmap||t instanceof e.window.HTMLImageElement}(n)?(this.loadTileData(t,n),t.state="loaded",void i(null)):(t.state="errored",i(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}.bind(this)).catch((e=>{20!==e.code&&(t.state="errored",i(e))})),t.request.cancel=()=>s.abort()}loadTileData(e,t){Ce.loadTileData(e,t,this._map.painter)}unloadTileData(e){Ce.unloadTileData(e,this._map.painter)}unloadTile(e,t){if(this.unloadTileData(e),this._implementation.unloadTile){const{x:t,y:i,z:n}=e.tileID.canonical;this._implementation.unloadTile({x:t,y:i,z:n})}t()}abortTile(e,t){e.request&&e.request.cancel&&(e.request.cancel(),delete e.request),t()}hasTransition(){return!1}_coveringTiles(){return this._map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map((e=>({x:e.canonical.x,y:e.canonical.y,z:e.canonical.z})))}_clearTiles(){this._map.style._clearSource(this.id)}_update(){this.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"}))}}},Ie=function(t,i,n,r){const o=new Ae[i.type](t,i,n,r);if(o.id!==t)throw new Error(`Expected Source id to be ${t} instead of ${o.id}`);return e.bindAll(["load","abort","unload","serialize","prepare"],o),o};function Pe(t,i){const n=e.identity([]);return e.scale(n,n,[.5*t.width,.5*-t.height,1]),e.translate(n,n,[1,-1,0]),e.multiply(n,n,t.calculateProjMatrix(i.toUnwrapped())),Float32Array.from(n)}function Le(e,t,i,n,r,o,s,a=!1){const l=e.tilesIn(n,s,a);l.sort(ze);const c=[];for(const n of l)c.push({wrappedTileID:n.tile.tileID.wrapped().key,queryResults:n.tile.queryRenderedFeatures(t,i,e._state,n,r,o,Pe(e.transform,n.tile.tileID),a)});const u=function(e){const t={},i={};for(const n of e){const e=n.queryResults,r=n.wrappedTileID,o=i[r]=i[r]||{};for(const i in e){const n=e[i],r=o[i]=o[i]||{},s=t[i]=t[i]||[];for(const e of n)r[e.featureIndex]||(r[e.featureIndex]=!0,s.push(e))}}return t}(c);for(const t in u)u[t].forEach((t=>{const i=t.feature,n=i.layer;n&&"background"!==n.type&&"sky"!==n.type&&(i.source=n.source,n["source-layer"]&&(i.sourceLayer=n["source-layer"]),i.state=void 0!==i.id?e.getFeatureState(n["source-layer"],i.id):{})}));return u}function De(e,t){const i=e.getRenderableIds().map((t=>e.getTileByID(t))),n=[],r={};for(let e=0;e{e.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[Be]}numActive(){return Object.keys(this.active).length}}let Fe;function Ue(){return Fe||(Fe=new Re),Fe}function je(t,i){const n={};for(const e in t)"ref"!==e&&(n[e]=t[e]);return e.refProperties.forEach((e=>{e in i&&(n[e]=i[e])})),n}function Ve(e){e=e.slice();const t=Object.create(null);for(let i=0;i0?(r-s)/a:0;return this.points[o].mult(1-l).add(this.points[i].mult(l))}}class Je{constructor(e,t,i){const n=this.boxCells=[],r=this.circleCells=[];this.xCellCount=Math.ceil(e/i),this.yCellCount=Math.ceil(t/i);for(let e=0;ethis.width||n<0||t>this.height)return!r&&[];const s=[];if(e<=0&&t<=0&&this.width<=i&&this.height<=n){if(r)return!0;for(let e=0;e0:s}_queryCircle(e,t,i,n,r){const o=e-i,s=e+i,a=t-i,l=t+i;if(s<0||o>this.width||l<0||a>this.height)return!n&&[];const c=[];return this._forEachCell(o,a,s,l,this._queryCellCircle,c,{hitTest:n,circle:{x:e,y:t,radius:i},seenUids:{box:{},circle:{}}},r),n?c.length>0:c}query(e,t,i,n,r){return this._query(e,t,i,n,!1,r)}hitTest(e,t,i,n,r){return this._query(e,t,i,n,!0,r)}hitTestCircle(e,t,i,n){return this._queryCircle(e,t,i,!0,n)}_queryCell(e,t,i,n,r,o,s,a){const l=s.seenUids,c=this.boxCells[r];if(null!==c){const r=this.bboxes;for(const u of c)if(!l.box[u]){l.box[u]=!0;const c=4*u;if(e<=r[c+2]&&t<=r[c+3]&&i>=r[c+0]&&n>=r[c+1]&&(!a||a(this.boxKeys[u]))){if(s.hitTest)return o.push(!0),!0;o.push({key:this.boxKeys[u],x1:r[c],y1:r[c+1],x2:r[c+2],y2:r[c+3]})}}}const u=this.circleCells[r];if(null!==u){const r=this.circles;for(const c of u)if(!l.circle[c]){l.circle[c]=!0;const u=3*c;if(this._circleAndRectCollide(r[u],r[u+1],r[u+2],e,t,i,n)&&(!a||a(this.circleKeys[c]))){if(s.hitTest)return o.push(!0),!0;{const e=r[u],t=r[u+1],i=r[u+2];o.push({key:this.circleKeys[c],x1:e-i,y1:t-i,x2:e+i,y2:t+i})}}}}}_queryCellCircle(e,t,i,n,r,o,s,a){const l=s.circle,c=s.seenUids,u=this.boxCells[r];if(null!==u){const e=this.bboxes;for(const t of u)if(!c.box[t]){c.box[t]=!0;const i=4*t;if(this._circleAndRectCollide(l.x,l.y,l.radius,e[i+0],e[i+1],e[i+2],e[i+3])&&(!a||a(this.boxKeys[t])))return o.push(!0),!0}}const h=this.circleCells[r];if(null!==h){const e=this.circles;for(const t of h)if(!c.circle[t]){c.circle[t]=!0;const i=3*t;if(this._circlesCollide(e[i],e[i+1],e[i+2],l.x,l.y,l.radius)&&(!a||a(this.circleKeys[t])))return o.push(!0),!0}}}_forEachCell(e,t,i,n,r,o,s,a){const l=this._convertToXCellCoord(e),c=this._convertToYCellCoord(t),u=this._convertToXCellCoord(i),h=this._convertToYCellCoord(n);for(let d=l;d<=u;d++)for(let l=c;l<=h;l++)if(r.call(this,e,t,i,n,this.xCellCount*l+d,o,s,a))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,i,n,r,o){const s=n-e,a=r-t,l=i+o;return l*l>s*s+a*a}_circleAndRectCollide(e,t,i,n,r,o,s){const a=(o-n)/2,l=Math.abs(e-(n+a));if(l>a+i)return!1;const c=(s-r)/2,u=Math.abs(t-(r+c));if(u>c+i)return!1;if(l<=a||u<=c)return!0;const h=l-a,d=u-c;return h*h+d*d<=i*i}}const Ye={unknown:0,flipRequired:1,flipNotRequired:2},Qe=Math.tan(85*Math.PI/180);function et(t,i,n,r,o,s,a){const l=e.create();if(n)if("globe"===s.name){const t=e.calculateGlobeLabelMatrix(o,i);e.multiply(l,l,t)}else{const t=y([],a);l[0]=t[0],l[1]=t[1],l[4]=t[2],l[5]=t[3],r||e.rotateZ(l,l,o.angle)}else e.multiply(l,o.labelPlaneMatrix,t);return l}function tt(e,t,i,n,r,o,s){const a=et(e,t,i,n,r,o,s);return"globe"===o.name&&i||(a[2]=a[6]=a[10]=a[14]=0),a}function it(t,i,n,r,o,s,a){if(n){if("globe"===s.name){const l=et(t,i,n,r,o,s,a);return e.invert(l,l),e.multiply(l,t,l),l}{const i=e.clone(t),n=e.identity([]);return n[0]=a[0],n[1]=a[1],n[4]=a[2],n[5]=a[3],e.multiply(i,i,n),r||e.rotateZ(i,i,-o.angle),i}}return o.glCoordMatrix}function nt(t,i,n,r){const o=[t,i,n,1];n?e.transformMat4$1(o,o,r):ft(o,o,r);const s=o[3];return o[0]/=s,o[1]/=s,o[2]/=s,o}function rt(e,t){return Math.min(.5+e/t*.5,1.5)}function ot(e,t){const i=e[0]/e[3],n=e[1]/e[3];return i>=-t[0]&&i<=t[0]&&n>=-t[1]&&n<=t[1]}function st(t,i,n,r,o,s,a,l,c,u){const h=n.transform,d=r?t.textSizeData:t.iconSizeData,p=e.evaluateSizeForZoom(d,n.transform.zoom),f="globe"===h.projection.name,m=[256/n.width*2+1,256/n.height*2+1],_=r?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;_.clear();let g=null;f&&(g=r?t.text.globeExtVertexArray:t.icon.globeExtVertexArray);const y=t.lineVertexArray,b=r?t.text.placedSymbolArray:t.icon.placedSymbolArray,v=n.transform.width/n.transform.height;let x,w=!1;for(let r=0;rMath.abs(n)?{useVertical:!0}:t===e.WritingMode.vertical?r>0?{needsFlipping:!0}:null:i!==Ye.unknown&&function(e,t){return 0===e||Math.abs(t/e)>Qe}(n,r)?i===Ye.flipRequired?{needsFlipping:!0}:null:n<0?{needsFlipping:!0}:null}function ct(t,i,n,r,o,s,a,l,c,u,h,d,p,f,m,_,g,y,b){const v=i/24,x=t.lineOffsetX*v,w=t.lineOffsetY*v,{lineStartIndex:E,glyphStartIndex:T,numGlyphs:k,segment:C,writingMode:S,flipState:M}=t,A=E+t.lineLength,I=t=>{if(h){const[i,n,r]=t.up,o=u.length;e.updateGlobeVertexNormal(h,o+0,i,n,r),e.updateGlobeVertexNormal(h,o+1,i,n,r),e.updateGlobeVertexNormal(h,o+2,i,n,r),e.updateGlobeVertexNormal(h,o+3,i,n,r)}const[i,n,r]=t.point;e.addDynamicAttributes(u,i,n,r,t.angle)};if(k>1){const e=at(v,l,x,w,n,d,p,t,c,s,f,_,!1,g,y,b);if(!e)return{notEnoughRoom:!0};if(r&&!n){let[i,n,r]=e.first.point,[o,s,l]=e.last.point;[i,n]=nt(i,n,r,a),[o,s]=nt(o,s,l,a);const c=lt(S,M,(o-i)*m,s-n);if(t.flipState=c&&c.needsFlipping?Ye.flipRequired:Ye.flipNotRequired,c)return c}I(e.first);for(let e=T+1;e0?s:ht(p,r,i,1,o,void 0,g,y.canonical),l=lt(S,M,(a[0]-i[0])*m,a[1]-i[1]);if(t.flipState=l&&l.needsFlipping?Ye.flipRequired:Ye.flipNotRequired,l)return l}const i=dt(v*l.getoffsetX(T),x,w,n,d,p,C,E,A,c,s,f,_,!1,!1,g,y,b);if(!i)return{notEnoughRoom:!0};I(i)}return{}}function ut(e,t,i,n,r){const{x:o,y:s,z:a}=n.projectTilePoint(e.x,e.y,t);if(!r)return nt(o,s,a,i);const[l,c,u]=r(e);return nt(o+l,s+c,a+u,i)}function ht(t,i,n,r,o,s,a,l){const c=ut(t.sub(i)._unit()._add(t),l,o,a,s);return e.sub(c,n,c),e.normalize(c,c),e.scaleAndAdd(c,n,c,r)}function dt(t,i,n,r,o,s,a,l,c,u,h,d,p,f,m,_,g,y){const b=r?t-i:t+i;let v=b>0?1:-1,x=0;r&&(v*=-1,x=Math.PI),v<0&&(x+=Math.PI);let w=l+a+(v>0?0:1)|0,E=o,T=o,k=0,C=0;const S=Math.abs(b),M=[],A=[];let I=s,P=I;const L=()=>ht(P,I,T,S-k+1,h,p,_,g.canonical);for(;k+C<=S;){if(w+=v,w=c)return null;if(T=E,P=I,M.push(T),f&&A.push(P),I=new e.Point(u.getx(w),u.gety(w)),E=d[w],!E){const e=ut(I,g.canonical,h,_,p);E=e[3]>0?d[w]=e:L()}k+=C,C=e.distance(T,E)}m&&p&&(d[w]&&(E=L(),C=e.distance(T,E)),d[w]=E);const D=(S-k)/C,z=I.sub(P)._mult(D)._add(P),O=e.sub([],E,T),B=e.scaleAndAdd([],T,O,D);let R=[0,0,1],F=O[0],U=O[1];if(y&&(R=_.upVector(g.canonical,z.x,z.y),0!==R[0]||0!==R[1]||1!==R[2])){const t=[R[2],0,-R[0]],i=e.cross([],R,t);e.normalize(t,t),e.normalize(i,i),F=e.dot(O,t),U=e.dot(O,i)}if(n){const t=e.cross([],R,O);e.normalize(t,t),e.scaleAndAdd(B,B,t,n*v)}const j=x+Math.atan2(U,F);return M.push(B),f&&A.push(z),{point:B,angle:j,path:M,tilePath:A,up:R}}function pt(e,t){const i=t.length,n=i+4*e;t.resize(n),t.float32.fill(-1/0,4*i,4*n)}function ft(e,t,i){const n=t[0],r=t[1];return e[0]=i[0]*n+i[4]*r+i[12],e[1]=i[1]*n+i[5]*r+i[13],e[3]=i[3]*n+i[7]*r+i[15],e}const mt=100;class _t{constructor(e,t,i=new Je(e.width+200,e.height+200,25),n=new Je(e.width+200,e.height+200,25)){this.transform=e,this.grid=i,this.ignoredGrid=n,this.pitchfactor=Math.cos(e._pitch)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+mt,this.screenBottomBoundary=e.height+mt,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.fogState=t}placeCollisionBox(e,t,i,n,r,o,s,a){let l=i.projectedAnchorX,c=i.projectedAnchorY,u=i.projectedAnchorZ;const h=i.elevation,d=i.tileID,p=e.getProjection();if(h&&d){const[e,t,n]=p.upVector(d.canonical,i.tileAnchorX,i.tileAnchorY),r=p.upVectorScale(d.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;l+=e*h*r,c+=t*h*r,u+=n*h*r}const f=this.projectAndGetPerspectiveRatio(s,l,c,u,i.tileID,"globe"===p.name||!!h||this.transform.pitch>0,p),m=o*f.perspectiveRatio,_=(i.x1*t+n.x-i.padding)*m+f.point.x,g=(i.y1*t+n.y-i.padding)*m+f.point.y,y=(i.x2*t+n.x+i.padding)*m+f.point.x,b=(i.y2*t+n.y+i.padding)*m+f.point.y,v=f.perspectiveRatio<=.55||f.occluded;return!this.isInsideGrid(_,g,y,b)||!r&&this.grid.hitTest(_,g,y,b,a)||v?{box:[],offscreen:!1,occluded:f.occluded}:{box:[_,g,y,b],offscreen:this.isOffscreen(_,g,y,b),occluded:!1}}placeCollisionCircles(t,i,n,r,o,s,a,l,c,u,h,d,p,f,m){const _=[],g=this.transform.elevation,y=t.getProjection(),b=g?g.getAtTileOffsetFunc(m,this.transform.center.lat,this.transform.worldSize,y):null,v=new e.Point(n.tileAnchorX,n.tileAnchorY);let{x,y:w,z:E}=y.projectTilePoint(v.x,v.y,m.canonical);if(b){const[e,t,i]=b(v);x+=e,w+=t,E+=i}const T="globe"===y.name,k=this.projectAndGetPerspectiveRatio(a,x,w,E,m,T||!!g||this.transform.pitch>0,y),{perspectiveRatio:C}=k,S=(h?s/C:s*C)/e.ONE_EM,M=nt(x,w,E,l),A=k.signedDistanceFromCamera>0?at(S,o,n.lineOffsetX*S,n.lineOffsetY*S,!1,M,v,n,r,l,{},g&&!h?b:null,h&&!!g,y,m,h):null;let I=!1,P=!1,L=!0;if(A&&!k.occluded){const t=.5*p*C+f,n=new e.Point(-100,-100),r=new e.Point(this.screenRightBoundary,this.screenBottomBoundary),o=new Ke,{first:s,last:a}=A,l=s.path.length;let h=[];for(let e=l-1;e>=1;e--)h.push(s.path[e]);for(let e=1;e(b&&!T&&(i=b(ne[3]<=0))&&(h=[]));let g=[];if(h.length>0){let t=1/0,i=-1/0,o=1/0,s=-1/0;for(const e of h)t=Math.min(t,e[0]),o=Math.min(o,e[1]),i=Math.max(i,e[0]),s=Math.max(s,e[1]);i>=n.x&&t<=r.x&&s>=n.y&&o<=r.y&&(g=[h.map((t=>new e.Point(t[0],t[1])))],(tr.x||or.y)&&(g=e.clipLine(g,n.x,n.y,r.x,r.y)))}for(const e of g){o.reset(e,.25*t);let n=0;n=o.length<=.5*t?1:Math.ceil(o.paddedLength/m)+1;for(let e=0;e0){if(e.transformMat4$1(l,l,t),this.fogState&&o&&"globe"!==a.name){const t=function(t,i,n,r,o,s){const a=s.calculateFogTileMatrix(o),l=[i,n,r];return e.transformMat4(l,l,a),k(t,l,s.pitch,s._fov)}(this.fogState,i,n,r,o.toUnwrapped(),this.transform);c=t>.9}}else ft(l,l,t);const u=l[3];return{point:new e.Point((l[0]/u+1)/2*this.transform.width+mt,(-l[1]/u+1)/2*this.transform.height+mt),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(a)/u*.5,1.5),signedDistanceFromCamera:u,occluded:s&&l[2]>u||c}}isOffscreen(e,t,i,n){return i=this.screenRightBoundary||nthis.screenBottomBoundary}isInsideGrid(e,t,i,n){return i>=0&&e=0&&te.collisionGroupID===t}}return this.collisionGroups[e]}}function Ct(t,i,n,r,o){const{horizontalAlign:s,verticalAlign:a}=e.getAnchorAlignment(t),l=-(s-.5)*i,c=-(a-.5)*n,u=e.evaluateVariableOffset(t,r);return new e.Point(l+u[0]*o,c+u[1]*o)}function St(t,i,n,r,o){const s=new e.Point(t,i);return n&&s._rotate(r?o:-o),s}class Mt{constructor(e,t,i,n,r){this.transform=e.clone(),this.projection=e.projection.name,this.collisionIndex=new _t(this.transform,r),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=t,this.retainedQueryData={},this.collisionGroups=new kt(i),this.collisionCircleArrays={},this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,i,n,r){const o=n.getBucket(i),s=n.latestFeatureIndex;if(!o||!s||i.id!==o.layerIds[0])return;const a=o.layers[0].layout,l=n.collisionBoxArray,c=Math.pow(2,this.transform.zoom-n.tileID.overscaledZ),u=n.tileSize/e.EXTENT,h=n.tileID.toUnwrapped();this.transform.setProjection(o.projection);const d=(p=n.tileID,f=o.getProjection(),m=this.transform,f.name===this.projection?m.calculateProjMatrix(p.toUnwrapped()):gt(m,f,p));var p,f,m;const _="map"===a.get("text-pitch-alignment"),g="map"===a.get("text-rotation-alignment");i.compileFilter();const y=i.dynamicFilter(),b=i.dynamicFilterNeedsFeature(),v=this.transform.calculatePixelsToTileUnitsMatrix(n),x=tt(d,n.tileID.canonical,_,g,this.transform,o.getProjection(),v);let w=null;if(_){const t=it(d,n.tileID.canonical,_,g,this.transform,o.getProjection(),v);w=e.multiply([],this.transform.labelPlaneMatrix,t)}let E=null;y&&n.latestFeatureIndex&&(E={unwrappedTileID:h,dynamicFilter:y,dynamicFilterNeedsFeature:b,featureIndex:n.latestFeatureIndex}),this.retainedQueryData[o.bucketInstanceId]=new Tt(o.bucketInstanceId,s,o.sourceLayerIndex,o.index,n.tileID);const T={bucket:o,layout:a,posMatrix:d,textLabelPlaneMatrix:x,labelToScreenMatrix:w,clippingData:E,scale:c,textPixelRatio:u,holdingForFade:n.holdingForFade(),collisionBoxArray:l,partiallyEvaluatedTextSize:e.evaluateSizeForZoom(o.textSizeData,this.transform.zoom),partiallyEvaluatedIconSize:e.evaluateSizeForZoom(o.iconSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(r)for(const e of o.sortKeyRanges){const{sortKey:i,symbolInstanceStart:n,symbolInstanceEnd:r}=e;t.push({sortKey:i,symbolInstanceStart:n,symbolInstanceEnd:r,parameters:T})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:T})}attemptAnchorPlacement(e,t,i,n,r,o,s,a,l,c,u,h,d,p,f,m,_,g){const{textOffset0:y,textOffset1:b,crossTileID:v}=h,x=[y,b],w=Ct(e,i,n,x,r),E=this.collisionIndex.placeCollisionBox(p,r,t,St(w.x,w.y,o,s,this.transform.angle),u,a,l,c.predicate);if(m){const e=p.getSymbolInstanceIconSize(g,this.transform.zoom,h.placedIconSymbolIndex);if(0===this.collisionIndex.placeCollisionBox(p,e,m,St(w.x,w.y,o,s,this.transform.angle),u,a,l,c.predicate).box.length)return}if(E.box.length>0){let t;return this.prevPlacement&&this.prevPlacement.variableOffsets[v]&&this.prevPlacement.placements[v]&&this.prevPlacement.placements[v].text&&(t=this.prevPlacement.variableOffsets[v].anchor),this.variableOffsets[v]={textOffset:x,width:i,height:n,anchor:e,textScale:r,prevAnchor:t},this.markUsedJustification(p,e,h,f),p.allowVerticalPlacement&&(this.markUsedOrientation(p,f,h),this.placedOrientations[v]=f),{shift:w,placedGlyphBoxes:E}}}placeLayerBucketPart(t,i,n,r){const{bucket:o,layout:s,posMatrix:a,textLabelPlaneMatrix:l,labelToScreenMatrix:c,clippingData:u,textPixelRatio:h,holdingForFade:d,collisionBoxArray:p,partiallyEvaluatedTextSize:f,partiallyEvaluatedIconSize:m,collisionGroup:_}=t.parameters,g=s.get("text-optional"),y=s.get("icon-optional"),b=s.get("text-allow-overlap"),v=s.get("icon-allow-overlap"),x="map"===s.get("text-rotation-alignment"),w="map"===s.get("text-pitch-alignment"),E="none"!==s.get("icon-text-fit"),T="viewport-y"===s.get("symbol-z-order");this.transform.setProjection(o.projection);let k=b&&(v||!o.hasIconData()||y),C=v&&(b||!o.hasTextData()||g);!o.collisionArrays&&p&&o.deserializeCollisionBoxes(p),n&&r&&o.updateCollisionDebugBuffers(this.transform.zoom,p);const S=(t,r,p)=>{const{crossTileID:T,numVerticalGlyphVertices:S}=t;if(u){const n={zoom:this.transform.zoom,pitch:this.transform.pitch};let r=null;if(u.dynamicFilterNeedsFeature){const e=this.retainedQueryData[o.bucketInstanceId];r=u.featureIndex.loadFeature({featureIndex:t.featureIndex,bucketIndex:e.bucketIndex,sourceLayerIndex:e.sourceLayerIndex,layoutVertexArrayOffset:0})}if(!(0,u.dynamicFilter)(n,r,this.retainedQueryData[o.bucketInstanceId].tileID.canonical,new e.Point(t.tileAnchorX,t.tileAnchorY),this.transform.calculateDistanceTileData(u.unwrappedTileID)))return this.placements[T]=new wt(!1,!1,!1,!0),void i.add(T)}if(i.has(T))return;if(d)return void(this.placements[T]=new wt(!1,!1,!1));let M=!1,A=!1,I=!0,P=!1,L=!1,D=null,z={box:null,offscreen:null,occluded:null},O={box:null,offscreen:null,occluded:null},B=null,R=null,F=null,U=0,j=0,V=0;p.textFeatureIndex?U=p.textFeatureIndex:t.useRuntimeCollisionCircles&&(U=t.featureIndex),p.verticalTextFeatureIndex&&(j=p.verticalTextFeatureIndex);const N=e=>{e.tileID=this.retainedQueryData[o.bucketInstanceId].tileID;const t=this.transform.elevation;(t||e.elevation)&&(e.elevation=t?t.getAtTileOffset(e.tileID,e.tileAnchorX,e.tileAnchorY):0)},$=p.textBox;if($){N($);const i=i=>{let n=e.WritingMode.horizontal;if(o.allowVerticalPlacement&&!i&&this.prevPlacement){const e=this.prevPlacement.placedOrientations[T];e&&(this.placedOrientations[T]=e,n=e,this.markUsedOrientation(o,n,t))}return n},n=(t,i)=>{if(o.allowVerticalPlacement&&S>0&&p.verticalTextBox){for(const n of o.writingModes)if(n===e.WritingMode.vertical?(z=i(),O=z):z=t(),z&&z.box&&z.box.length)break}else z=t()};if(s.get("text-variable-anchor")){let l=s.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[T]){const e=this.prevPlacement.variableOffsets[T];l.indexOf(e.anchor)>0&&(l=l.filter((t=>t!==e.anchor)),l.unshift(e.anchor))}const c=(e,i,n)=>{const s=o.getSymbolInstanceTextSize(f,t,this.transform.zoom,r),c=(e.x2-e.x1)*s+2*e.padding,u=(e.y2-e.y1)*s+2*e.padding,d=E&&!v?i:null;d&&N(d);let p={box:[],offscreen:!1,occluded:!1};const g=b?2*l.length:l.length;for(let i=0;i=l.length,t,r,o,n,d,f,m);if(g&&(p=g.placedGlyphBoxes,p&&p.box&&p.box.length)){M=!0,D=g.shift;break}}return p};n((()=>c($,p.iconBox,e.WritingMode.horizontal)),(()=>{const t=p.verticalTextBox;return t&&N(t),o.allowVerticalPlacement&&!(z&&z.box&&z.box.length)&&S>0&&t?c(t,p.verticalIconBox,e.WritingMode.vertical):{box:null,offscreen:null,occluded:null}})),z&&(M=z.box,I=z.offscreen,P=z.occluded);const u=i(!(!z||!z.box));if(!M&&this.prevPlacement){const e=this.prevPlacement.variableOffsets[T];e&&(this.variableOffsets[T]=e,this.markUsedJustification(o,e.anchor,t,u))}}else{const s=(i,n)=>{const s=o.getSymbolInstanceTextSize(f,t,this.transform.zoom,r),l=this.collisionIndex.placeCollisionBox(o,s,i,new e.Point(0,0),b,h,a,_.predicate);return l&&l.box&&l.box.length&&(this.markUsedOrientation(o,n,t),this.placedOrientations[T]=n),l};n((()=>s($,e.WritingMode.horizontal)),(()=>{const t=p.verticalTextBox;return o.allowVerticalPlacement&&S>0&&t?(N(t),s(t,e.WritingMode.vertical)):{box:null,offscreen:null,occluded:null}})),i(!!(z&&z.box&&z.box.length))}}if(B=z,M=B&&B.box&&B.box.length>0,I=B&&B.offscreen,P=B&&B.occluded,t.useRuntimeCollisionCircles){const i=o.text.placedSymbolArray.get(t.centerJustifiedTextSymbolIndex>=0?t.centerJustifiedTextSymbolIndex:t.verticalPlacedTextSymbolIndex),r=e.evaluateSizeForFeature(o.textSizeData,f,i),u=s.get("text-padding");R=this.collisionIndex.placeCollisionCircles(o,b,i,o.lineVertexArray,o.glyphOffsetArray,r,a,l,c,n,w,_.predicate,t.collisionCircleDiameter*r/e.ONE_EM,u,this.retainedQueryData[o.bucketInstanceId].tileID),M=b||R.circles.length>0&&!R.collisionDetected,I=I&&R.offscreen,P=R.occluded}if(p.iconFeatureIndex&&(V=p.iconFeatureIndex),p.iconBox){const i=i=>{N(i);const n=E&&D?St(D.x,D.y,x,w,this.transform.angle):new e.Point(0,0),r=o.getSymbolInstanceIconSize(m,this.transform.zoom,t.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(o,r,i,n,v,h,a,_.predicate)};O&&O.box&&O.box.length&&p.verticalIconBox?(F=i(p.verticalIconBox),A=F.box.length>0):(F=i(p.iconBox),A=F.box.length>0),I=I&&F.offscreen,L=F.occluded}const q=g||0===t.numHorizontalGlyphVertices&&0===S,G=y||0===t.numIconVertices;if(q||G?G?q||(A=A&&M):M=A&&M:A=M=A&&M,M&&B&&B.box&&this.collisionIndex.insertCollisionBox(B.box,s.get("text-ignore-placement"),o.bucketInstanceId,O&&O.box&&j?j:U,_.ID),A&&F&&this.collisionIndex.insertCollisionBox(F.box,s.get("icon-ignore-placement"),o.bucketInstanceId,V,_.ID),R&&(M&&this.collisionIndex.insertCollisionCircles(R.circles,s.get("text-ignore-placement"),o.bucketInstanceId,U,_.ID),n)){const e=o.bucketInstanceId;let t=this.collisionCircleArrays[e];void 0===t&&(t=this.collisionCircleArrays[e]=new Et);for(let e=0;e=0;--t){const i=e[t];S(o.symbolInstances.get(i),i,o.collisionArrays[i])}}else for(let e=t.symbolInstanceStart;e=0&&(t.text.placedSymbolArray.get(o).crossTileID=h>=0&&o!==h?0:c),s>=0&&(t.text.placedSymbolArray.get(s).crossTileID=h>=0&&s!==h?0:c),a>=0&&(t.text.placedSymbolArray.get(a).crossTileID=h>=0&&a!==h?0:c),l>=0&&(t.text.placedSymbolArray.get(l).crossTileID=h>=0&&l!==h?0:c)}markUsedOrientation(t,i,n){const r=i===e.WritingMode.horizontal||i===e.WritingMode.horizontalOnly?i:0,o=i===e.WritingMode.vertical?i:0,{leftJustifiedTextSymbolIndex:s,centerJustifiedTextSymbolIndex:a,rightJustifiedTextSymbolIndex:l,verticalPlacedTextSymbolIndex:c}=n,u=t.text.placedSymbolArray;s>=0&&(u.get(s).placedOrientation=r),a>=0&&(u.get(a).placedOrientation=r),l>=0&&(u.get(l).placedOrientation=r),c>=0&&(u.get(c).placedOrientation=o)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const t=this.prevPlacement;let i=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;const n=t?t.symbolFadeChange(e):1,r=t?t.opacities:{},o=t?t.variableOffsets:{},s=t?t.placedOrientations:{};for(const e in this.placements){const t=this.placements[e],o=r[e];o?(this.opacities[e]=new xt(o,n,t.text,t.icon,null,t.clipped),i=i||t.text!==o.text.placed||t.icon!==o.icon.placed):(this.opacities[e]=new xt(null,n,t.text,t.icon,t.skipFade,t.clipped),i=i||t.text||t.icon)}for(const e in r){const t=r[e];if(!this.opacities[e]){const r=new xt(t,n,!1,!1);r.isHidden()||(this.opacities[e]=r,i=i||t.text.placed||t.icon.placed)}}for(const e in o)this.variableOffsets[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.variableOffsets[e]=o[e]);for(const e in s)this.placedOrientations[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.placedOrientations[e]=s[e]);i?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t){const i=new Set;for(const n of t){const t=n.getBucket(e);t&&n.latestFeatureIndex&&e.id===t.layerIds[0]&&this.updateBucketOpacities(t,i,n.collisionBoxArray)}}updateBucketOpacities(t,i,n){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 r=t.layers[0].layout,o=!!t.layers[0].dynamicFilter(),s=new xt(null,0,!1,!1,!0),a=r.get("text-allow-overlap"),l=r.get("icon-allow-overlap"),c=r.get("text-variable-anchor"),u="map"===r.get("text-rotation-alignment"),h="map"===r.get("text-pitch-alignment"),d="none"!==r.get("icon-text-fit"),p=new xt(null,0,a&&(l||!t.hasIconData()||r.get("icon-optional")),l&&(a||!t.hasTextData()||r.get("text-optional")),!0);!t.collisionArrays&&n&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(n);const f=(e,t,i)=>{for(let n=0;n0||l>0,x=g>0,w=this.placedOrientations[_],E=w===e.WritingMode.vertical,T=w===e.WritingMode.horizontal||w===e.WritingMode.horizontalOnly;if(!v&&!x||b.isHidden()||m++,v){const e=Rt(b.text);f(t.text,a,E?Ft:e),f(t.text,l,T?Ft:e);const i=b.text.isHidden(),{leftJustifiedTextSymbolIndex:n,centerJustifiedTextSymbolIndex:o,rightJustifiedTextSymbolIndex:s,verticalPlacedTextSymbolIndex:c}=r,u=t.text.placedSymbolArray,h=i||E?1:0;n>=0&&(u.get(n).hidden=h),o>=0&&(u.get(o).hidden=h),s>=0&&(u.get(s).hidden=h),c>=0&&(u.get(c).hidden=i||T?1:0);const d=this.variableOffsets[_];d&&this.markUsedJustification(t,d.anchor,r,w);const p=this.placedOrientations[_];p&&(this.markUsedJustification(t,"left",r,p),this.markUsedOrientation(t,p,r))}if(x){const e=Rt(b.icon),{placedIconSymbolIndex:i,verticalPlacedIconSymbolIndex:n}=r,o=t.icon.placedSymbolArray,s=b.icon.isHidden()?1:0;i>=0&&(f(t.icon,g,E?Ft:e),o.get(i).hidden=s),n>=0&&(f(t.icon,r.numVerticalIconVertices,T?Ft:e),o.get(n).hidden=s)}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const i=t.collisionArrays[n];if(i){let n=new e.Point(0,0),r=!0;if(i.textBox||i.verticalTextBox){if(c){const e=this.variableOffsets[_];e?(n=Ct(e.anchor,e.width,e.height,e.textOffset,e.textScale),u&&n._rotate(h?this.transform.angle:-this.transform.angle)):r=!1}o&&(r=!b.clipped),i.textBox&&At(t.textCollisionBox.collisionVertexArray,b.text.placed,!r||E,n.x,n.y),i.verticalTextBox&&At(t.textCollisionBox.collisionVertexArray,b.text.placed,!r||T,n.x,n.y)}const s=r&&Boolean(!T&&i.verticalIconBox);i.iconBox&&At(t.iconCollisionBox.collisionVertexArray,b.icon.placed,s,d?n.x:0,d?n.y:0),i.verticalIconBox&&At(t.iconCollisionBox.collisionVertexArray,b.icon.placed,!s,d?n.x:0,d?n.y:0)}}}if(t.fullyClipped=0===m,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 e=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=e.invProjMatrix,t.placementViewportMatrix=e.viewportMatrix,t.collisionCircleArray=e.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(e){return 0===this.fadeDuration?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTimee}setStale(){this.stale=!0}}function At(e,t,i,n,r){e.emplaceBack(t?1:0,i?1:0,n||0,r||0),e.emplaceBack(t?1:0,i?1:0,n||0,r||0),e.emplaceBack(t?1:0,i?1:0,n||0,r||0),e.emplaceBack(t?1:0,i?1:0,n||0,r||0)}const It=Math.pow(2,25),Pt=Math.pow(2,24),Lt=Math.pow(2,17),Dt=Math.pow(2,16),zt=Math.pow(2,9),Ot=Math.pow(2,8),Bt=Math.pow(2,1);function Rt(e){if(0===e.opacity&&!e.placed)return 0;if(1===e.opacity&&e.placed)return 4294967295;const t=e.placed?1:0,i=Math.floor(127*e.opacity);return i*It+t*Pt+i*Lt+t*Dt+i*zt+t*Ot+i*Bt+t}const Ft=0;class Ut{constructor(e){this._sortAcrossTiles="viewport-y"!==e.layout.get("symbol-z-order")&&void 0!==e.layout.get("symbol-sort-key").constantOr(1),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(e,t,i,n,r){const o=this._bucketParts;for(;this._currentTileIndexe.sortKey-t.sortKey)));this._currentPartIndex{const t=e.exported.now()-r;return!this._forceFullPlacement&&t>2};for(;this._currentPlacementIndex>=0;){const e=i[t[this._currentPlacementIndex]],r=this.placement.collisionIndex.transform.zoom;if("symbol"===e.type&&(!e.minzoom||e.minzoom<=r)&&(!e.maxzoom||e.maxzoom>r)){if(this._inProgressLayer||(this._inProgressLayer=new Ut(e)),this._inProgressLayer.continuePlacement(n[e.source],this.placement,this._showCollisionBoxes,e,o))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}const Vt=512/e.EXTENT/2;class Nt{constructor(t,i,n){this.tileID=t,this.bucketInstanceId=n,this.index=new e.KDBush(i.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const r=t.canonical.x*e.EXTENT,o=t.canonical.y*e.EXTENT;for(let e=0;ee.overscaledZ)for(const i in r){const o=r[i];o.tileID.isChildOf(e)&&o.findMatches(t.symbolInstances,e,n)}else{const o=r[e.scaledTo(Number(i)).key];o&&o.findMatches(t.symbolInstances,e,n)}}for(let e=0;e{t[e]=!0}));for(const e in this.layerIndexes)t[e]||delete this.layerIndexes[e]}}const Zt=(t,i)=>e.emitValidationErrors(t,i&&i.filter((e=>"source.canvas"!==e.identifier))),Wt=e.pick(Ne,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setProjection"]),Ht=e.pick(Ne,["setCenter","setZoom","setBearing","setPitch"]),Xt={version:8,layers:[],sources:{}},Kt={fill:!0,line:!0,background:!0,hillshade:!0,raster:!0};class Jt extends e.Evented{constructor(t,i={}){super(),this.map=t,this.dispatcher=new A(Ue(),this),this.imageManager=new v,this.imageManager.setEventedParent(this),this.glyphManager=new e.GlyphManager(t._requestManager,i.localFontFamily?e.LocalGlyphMode.all:i.localIdeographFontFamily?e.LocalGlyphMode.ideographs:e.LocalGlyphMode.none,i.localFontFamily||i.localIdeographFontFamily),this.crossTileSymbolIndex=new Gt,this._layers={},this._num3DLayers=0,this._numSymbolLayers=0,this._numCircleLayers=0,this._serializedLayers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._availableImages=[],this._order=[],this._drapedFirstOrder=[],this._markersNeedUpdate=!1,this._resetUpdates(),this.dispatcher.broadcast("setReferrer",e.getReferrer());const n=this;this._rtlTextPluginCallback=Jt.registerForPluginStateChange((t=>{n.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:t.pluginStatus,pluginURL:t.pluginURL},((t,i)=>{if(e.triggerPluginCompletionEvent(t),i&&i.every((e=>e)))for(const e in n._sourceCaches){const t=n._sourceCaches[e],i=t.getSource().type;"vector"!==i&&"geojson"!==i||t.reload()}}))})),this.on("data",(e=>{if("source"!==e.dataType||"metadata"!==e.sourceDataType)return;const t=this.getSource(e.sourceId);if(t&&t.vectorLayerIds)for(const e in this._layers){const i=this._layers[e];i.source===t.id&&this._validateLayer(i)}}))}loadURL(t,i={}){this.fire(new e.Event("dataloading",{dataType:"style"}));const n="boolean"==typeof i.validate?i.validate:!e.isMapboxURL(t);t=this.map._requestManager.normalizeStyleURL(t,i.accessToken);const r=this.map._requestManager.transformRequest(t,e.ResourceType.Style);this._request=e.getJSON(r,((t,i)=>{this._request=null,t?this.fire(new e.ErrorEvent(t)):i&&this._load(i,n)}))}loadJSON(t,i={}){this.fire(new e.Event("dataloading",{dataType:"style"})),this._request=e.exported.frame((()=>{this._request=null,this._load(t,!1!==i.validate)}))}loadEmpty(){this.fire(new e.Event("dataloading",{dataType:"style"})),this._load(Xt,!1)}_updateLayerCount(e,t){const i=t?1:-1;e.is3D()&&(this._num3DLayers+=i),"circle"===e.type&&(this._numCircleLayers+=i),"symbol"===e.type&&(this._numSymbolLayers+=i)}_load(t,i){if(i&&Zt(this,e.validateStyle(t)))return;this._loaded=!0,this.stylesheet=e.clone$1(t),this._updateMapProjection();for(const e in t.sources)this.addSource(e,t.sources[e],{validate:!1});this._changed=!1,t.sprite?this._loadSprite(t.sprite):(this.imageManager.setLoaded(!0),this.dispatcher.broadcast("spriteLoaded",!0)),this.glyphManager.setURL(t.glyphs);const n=Ve(this.stylesheet.layers);this._order=n.map((e=>e.id)),this._layers={},this._serializedLayers={};for(const t of n){const i=e.createStyleLayer(t);i.setEventedParent(this,{layer:{id:i.id}}),this._layers[i.id]=i,this._serializedLayers[i.id]=i.serialize(),this._updateLayerCount(i,!0)}this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new w(this.stylesheet.light),this.stylesheet.terrain&&!this.terrainSetForDrapingOnly()&&this._createTerrain(this.stylesheet.terrain,1),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this._updateDrapeFirstLayers(),this.fire(new e.Event("data",{dataType:"style"})),this.fire(new e.Event("style.load"))}terrainSetForDrapingOnly(){return!!this.terrain&&0===this.terrain.drapeRenderMode}setProjection(e){e?this.stylesheet.projection=e:delete this.stylesheet.projection,this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?this.getTerrain()||this.stylesheet.terrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null))}_updateMapProjection(){this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.stylesheet.projection)}_loadSprite(t){this._spriteRequest=function(t,i,n){let r,o,s;const a=e.exported.devicePixelRatio>1?"@2x":"";let l=e.getJSON(i.transformRequest(i.normalizeSpriteURL(t,a,".json"),e.ResourceType.SpriteJSON),((e,t)=>{l=null,s||(s=e,r=t,u())})),c=e.getImage(i.transformRequest(i.normalizeSpriteURL(t,a,".png"),e.ResourceType.SpriteImage),((e,t)=>{c=null,s||(s=e,o=t,u())}));function u(){if(s)n(s);else if(r&&o){const t=e.exported.getImageData(o),i={};for(const n in r){const{width:o,height:s,x:a,y:l,sdf:c,pixelRatio:u,stretchX:h,stretchY:d,content:p}=r[n],f=new e.RGBAImage({width:o,height:s});e.RGBAImage.copy(t,f,{x:a,y:l},{x:0,y:0},{width:o,height:s}),i[n]={data:f,pixelRatio:u,sdf:c,stretchX:h,stretchY:d,content:p}}n(null,i)}}return{cancel(){l&&(l.cancel(),l=null),c&&(c.cancel(),c=null)}}}(t,this.map._requestManager,((t,i)=>{if(this._spriteRequest=null,t)this.fire(new e.ErrorEvent(t));else if(i)for(const e in i)this.imageManager.addImage(e,i[e]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.dispatcher.broadcast("spriteLoaded",!0),this.fire(new e.Event("data",{dataType:"style"}))}))}_validateLayer(t){const i=this.getSource(t.source);if(!i)return;const n=t.sourceLayer;n&&("geojson"===i.type||i.vectorLayerIds&&-1===i.vectorLayerIds.indexOf(n))&&this.fire(new e.ErrorEvent(new Error(`Source layer "${n}" does not exist on source "${i.id}" as specified by style layer "${t.id}"`)))}loaded(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(const e in this._sourceCaches)if(!this._sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(e){const t=[];for(const i of e){const e=this._layers[i];"custom"!==e.type&&t.push(e.serialize())}return t}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;if(this.fog&&this.fog.hasTransition())return!0;for(const e in this._sourceCaches)if(this._sourceCaches[e].hasTransition())return!0;for(const e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}get order(){return this.map._optimizeForTerrain&&this.terrain?this._drapedFirstOrder:this._order}isLayerDraped(e){return!!this.terrain&&("function"==typeof e.isLayerDraped?e.isLayerDraped():Kt[e.type])}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}update(t){if(!this._loaded)return;const i=this._changed;if(this._changed){const e=Object.keys(this._updatedLayers),i=Object.keys(this._removedLayers);(e.length||i.length)&&this._updateWorkerLayers(e,i);for(const e in this._updatedSources){const t=this._updatedSources[e];"reload"===t?this._reloadSource(e):"clear"===t&&this._clearSource(e)}this._updateTilesForChangedImages();for(const e in this._updatedPaintProps)this._layers[e].updateTransitions(t);this.light.updateTransitions(t),this.fog&&this.fog.updateTransitions(t),this._resetUpdates()}const n={};for(const e in this._sourceCaches){const t=this._sourceCaches[e];n[e]=t.used,t.used=!1}for(const e of this._order){const i=this._layers[e];if(i.recalculate(t,this._availableImages),!i.isHidden(t.zoom)){const e=this._getLayerSourceCache(i);e&&(e.used=!0)}const n=this.map.painter;if(n){const e=i.getProgramIds();if(!e)continue;const r=i.getProgramConfiguration(t.zoom);for(const t of e)n.useProgram(t,r)}}for(const t in n){const i=this._sourceCaches[t];n[t]!==i.used&&i.getSource().fire(new e.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:i.getSource().id}))}this.light.recalculate(t),this.terrain&&this.terrain.recalculate(t),this.fog&&this.fog.recalculate(t),this.z=t.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),i&&this.fire(new e.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const e=Object.keys(this._changedImages);if(e.length){for(const t in this._sourceCaches)this._sourceCaches[t].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateWorkerLayers(e,t){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(e),removedIds:t})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setState(i){if(this._checkLoaded(),Zt(this,e.validateStyle(i)))return!1;(i=e.clone$1(i)).layers=Ve(i.layers);const n=function(e,i){if(!e)return[{command:Ne.setStyle,args:[i]}];let n=[];try{if(!t(e.version,i.version))return[{command:Ne.setStyle,args:[i]}];t(e.center,i.center)||n.push({command:Ne.setCenter,args:[i.center]}),t(e.zoom,i.zoom)||n.push({command:Ne.setZoom,args:[i.zoom]}),t(e.bearing,i.bearing)||n.push({command:Ne.setBearing,args:[i.bearing]}),t(e.pitch,i.pitch)||n.push({command:Ne.setPitch,args:[i.pitch]}),t(e.sprite,i.sprite)||n.push({command:Ne.setSprite,args:[i.sprite]}),t(e.glyphs,i.glyphs)||n.push({command:Ne.setGlyphs,args:[i.glyphs]}),t(e.transition,i.transition)||n.push({command:Ne.setTransition,args:[i.transition]}),t(e.light,i.light)||n.push({command:Ne.setLight,args:[i.light]}),t(e.fog,i.fog)||n.push({command:Ne.setFog,args:[i.fog]}),t(e.projection,i.projection)||n.push({command:Ne.setProjection,args:[i.projection]});const r={},o=[];!function(e,i,n,r){let o;for(o in i=i||{},e=e||{})e.hasOwnProperty(o)&&(i.hasOwnProperty(o)||qe(o,n,r));for(o in i){if(!i.hasOwnProperty(o))continue;const s=i[o];e.hasOwnProperty(o)?t(e[o],s)||("geojson"===e[o].type&&"geojson"===s.type&&Ze(e,i,o)?n.push({command:Ne.setGeoJSONSourceData,args:[o,s.data]}):Ge(o,i,n,r)):$e(o,i,n)}}(e.sources,i.sources,o,r);const s=[];e.layers&&e.layers.forEach((e=>{e.source&&r[e.source]?n.push({command:Ne.removeLayer,args:[e.id]}):s.push(e)}));let a=e.terrain;a&&r[a.source]&&(n.push({command:Ne.setTerrain,args:[void 0]}),a=void 0),n=n.concat(o),t(a,i.terrain)||n.push({command:Ne.setTerrain,args:[i.terrain]}),function(e,i,n){i=i||[];const r=(e=e||[]).map(He),o=i.map(He),s=e.reduce(Xe,{}),a=i.reduce(Xe,{}),l=r.slice(),c=Object.create(null);let u,h,d,p,f,m,_;for(u=0,h=0;u!(e.command in Ht)));if(0===n.length)return!1;const r=n.filter((e=>!(e.command in Wt)));if(r.length>0)throw new Error(`Unimplemented: ${r.map((e=>e.command)).join(", ")}.`);return n.forEach((e=>{"setTransition"!==e.command&&"setProjection"!==e.command&&this[e.command].apply(this,e.args)})),this.stylesheet=i,this._updateMapProjection(),!0}addImage(t,i){return this.getImage(t)?this.fire(new e.ErrorEvent(new Error("An image with this name already exists."))):(this.imageManager.addImage(t,i),this._afterImageUpdated(t),this)}updateImage(e,t){this.imageManager.updateImage(e,t)}getImage(e){return this.imageManager.getImage(e)}removeImage(t){return this.getImage(t)?(this.imageManager.removeImage(t),this._afterImageUpdated(t),this):this.fire(new e.ErrorEvent(new Error("No image with this name exists.")))}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new e.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addSource(t,i,n={}){if(this._checkLoaded(),void 0!==this.getSource(t))throw new Error("There is already a source with this ID");if(!i.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(e.validateSource,`sources.${t}`,i,null,n))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const r=Ie(t,i,this.dispatcher,this);r.setEventedParent(this,(()=>({isSourceLoaded:this._isSourceCacheLoaded(t),source:r.serialize(),sourceId:t})));const o=i=>{const n=(i?"symbol:":"other:")+t,o=this._sourceCaches[n]=new e.SourceCache(n,r,i);(i?this._symbolSourceCaches:this._otherSourceCaches)[t]=o,o.style=this,o.onAdd(this.map)};o(!1),"vector"!==i.type&&"geojson"!==i.type||o(!0),r.onAdd&&r.onAdd(this.map),this._changed=!0}removeSource(t){this._checkLoaded();const i=this.getSource(t);if(!i)throw new Error("There is no source with this ID");for(const i in this._layers)if(this._layers[i].source===t)return this.fire(new e.ErrorEvent(new Error(`Source "${t}" cannot be removed while layer "${i}" is using it.`)));if(this.terrain&&this.terrain.get().source===t)return this.fire(new e.ErrorEvent(new Error(`Source "${t}" cannot be removed while terrain is using it.`)));const n=this._getSourceCaches(t);for(const t of n)delete this._sourceCaches[t.id],delete this._updatedSources[t.id],t.fire(new e.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:t.getSource().id})),t.setEventedParent(null),t.clearTiles();return delete this._otherSourceCaches[t],delete this._symbolSourceCaches[t],i.setEventedParent(null),i.onRemove&&i.onRemove(this.map),this._changed=!0,this}setGeoJSONSourceData(e,t){this._checkLoaded(),this.getSource(e).setData(t),this._changed=!0}getSource(e){const t=this._getSourceCache(e);return t&&t.getSource()}_getSources(){const e=[];for(const t in this._otherSourceCaches){const i=this._getSourceCache(t);i&&e.push(i.getSource())}return e}addLayer(t,i,n={}){this._checkLoaded();const r=t.id;if(this.getLayer(r))return void this.fire(new e.ErrorEvent(new Error(`Layer with id "${r}" already exists on this map`)));let o;if("custom"===t.type){if(Zt(this,e.validateCustomStyleLayer(t)))return;o=e.createStyleLayer(t)}else{if("object"==typeof t.source&&(this.addSource(r,t.source),t=e.clone$1(t),t=e.extend(t,{source:r})),this._validate(e.validateLayer,`layers.${r}`,t,{arrayIndex:-1},n))return;o=e.createStyleLayer(t),this._validateLayer(o),o.setEventedParent(this,{layer:{id:r}}),this._serializedLayers[o.id]=o.serialize(),this._updateLayerCount(o,!0)}const s=i?this._order.indexOf(i):this._order.length;if(i&&-1===s)return void this.fire(new e.ErrorEvent(new Error(`Layer with id "${i}" does not exist on this map.`)));this._order.splice(s,0,r),this._layerOrderChanged=!0,this._layers[r]=o;const a=this._getLayerSourceCache(o);if(this._removedLayers[r]&&o.source&&a&&"custom"!==o.type){const e=this._removedLayers[r];delete this._removedLayers[r],e.type!==o.type?this._updatedSources[o.source]="clear":(this._updatedSources[o.source]="reload",a.pause())}this._updateLayer(o),o.onAdd&&o.onAdd(this.map),this._updateDrapeFirstLayers()}moveLayer(t,i){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new e.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===i)return;const n=this._order.indexOf(t);this._order.splice(n,1);const r=i?this._order.indexOf(i):this._order.length;i&&-1===r?this.fire(new e.ErrorEvent(new Error(`Layer with id "${i}" does not exist on this map.`))):(this._order.splice(r,0,t),this._layerOrderChanged=!0,this._updateDrapeFirstLayers())}removeLayer(t){this._checkLoaded();const i=this._layers[t];if(!i)return void this.fire(new e.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be removed.`)));i.setEventedParent(null),this._updateLayerCount(i,!1);const n=this._order.indexOf(t);this._order.splice(n,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=i,delete this._layers[t],delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],i.onRemove&&i.onRemove(this.map),this._updateDrapeFirstLayers()}getLayer(e){return this._layers[e]}hasLayer(e){return e in this._layers}hasLayerType(e){for(const t in this._layers)if(this._layers[t].type===e)return!0;return!1}setLayerZoomRange(t,i,n){this._checkLoaded();const r=this.getLayer(t);r?r.minzoom===i&&r.maxzoom===n||(null!=i&&(r.minzoom=i),null!=n&&(r.maxzoom=n),this._updateLayer(r)):this.fire(new e.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot have zoom extent.`)))}setFilter(i,n,r={}){this._checkLoaded();const o=this.getLayer(i);if(o){if(!t(o.filter,n))return null==n?(o.filter=void 0,void this._updateLayer(o)):void(this._validate(e.validateFilter,`layers.${o.id}.filter`,n,{layerType:o.type},r)||(o.filter=e.clone$1(n),this._updateLayer(o)))}else this.fire(new e.ErrorEvent(new Error(`The layer '${i}' does not exist in the map's style and cannot be filtered.`)))}getFilter(t){const i=this.getLayer(t);return i&&e.clone$1(i.filter)}setLayoutProperty(i,n,r,o={}){this._checkLoaded();const s=this.getLayer(i);s?t(s.getLayoutProperty(n),r)||(s.setLayoutProperty(n,r,o),this._updateLayer(s)):this.fire(new e.ErrorEvent(new Error(`The layer '${i}' does not exist in the map's style and cannot be styled.`)))}getLayoutProperty(t,i){const n=this.getLayer(t);if(n)return n.getLayoutProperty(i);this.fire(new e.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style.`)))}setPaintProperty(i,n,r,o={}){this._checkLoaded();const s=this.getLayer(i);s?t(s.getPaintProperty(n),r)||(s.setPaintProperty(n,r,o)&&this._updateLayer(s),this._changed=!0,this._updatedPaintProps[i]=!0):this.fire(new e.ErrorEvent(new Error(`The layer '${i}' does not exist in the map's style and cannot be styled.`)))}getPaintProperty(e,t){const i=this.getLayer(e);return i&&i.getPaintProperty(t)}setFeatureState(t,i){this._checkLoaded();const n=t.source,r=t.sourceLayer,o=this.getSource(n);if(!o)return void this.fire(new e.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)));const s=o.type;if("geojson"===s&&r)return void this.fire(new e.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===s&&!r)return void this.fire(new e.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));void 0===t.id&&this.fire(new e.ErrorEvent(new Error("The feature id parameter must be provided.")));const a=this._getSourceCaches(n);for(const e of a)e.setFeatureState(r,t.id,i)}removeFeatureState(t,i){this._checkLoaded();const n=t.source,r=this.getSource(n);if(!r)return void this.fire(new e.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)));const o=r.type,s="vector"===o?t.sourceLayer:void 0;if("vector"===o&&!s)return void this.fire(new e.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));if(i&&"string"!=typeof t.id&&"number"!=typeof t.id)return void this.fire(new e.ErrorEvent(new Error("A feature id is required to remove its specific state property.")));const a=this._getSourceCaches(n);for(const e of a)e.removeFeatureState(s,t.id,i)}getFeatureState(t){this._checkLoaded();const i=t.source,n=t.sourceLayer,r=this.getSource(i);if(r){if("vector"!==r.type||n)return void 0===t.id&&this.fire(new e.ErrorEvent(new Error("The feature id parameter must be provided."))),this._getSourceCaches(i)[0].getFeatureState(n,t.id);this.fire(new e.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new e.ErrorEvent(new Error(`The source '${i}' does not exist in the map's style.`)))}getTransition(){return e.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){const t={};for(const e in this._sourceCaches){const i=this._sourceCaches[e].getSource();t[i.id]||(t[i.id]=i.serialize())}return e.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,terrain:this.getTerrain()||void 0,fog:this.stylesheet.fog,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:t,layers:this._serializeLayers(this._order)},(e=>void 0!==e))}_updateLayer(e){this._updatedLayers[e.id]=!0;const t=this._getLayerSourceCache(e);e.source&&!this._updatedSources[e.source]&&t&&"raster"!==t.getSource().type&&(this._updatedSources[e.source]="reload",t.pause()),this._changed=!0,e.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(e){const t=e=>"fill-extrusion"===this._layers[e].type,i={},n=[];for(let r=this._order.length-1;r>=0;r--){const o=this._order[r];if(t(o)){i[o]=r;for(const t of e){const e=t[o];if(e)for(const t of e)n.push(t)}}}n.sort(((e,t)=>t.intersectionZ-e.intersectionZ));const r=[];for(let o=this._order.length-1;o>=0;o--){const s=this._order[o];if(t(s))for(let e=n.length-1;e>=0;e--){const t=n[e].feature;if(i[t.layer.id]{const t=this.getLayer(e);return t&&t.is3D()})):this.has3DLayers(),a=P.createFromScreenPoints(t,n);for(const e in this._sourceCaches){const t=this._sourceCaches[e].getSource().id;i.layers&&!r[t]||o.push(Le(this._sourceCaches[e],this._layers,this._serializedLayers,a,i,n,s,!!this.map._showQueryGeometry))}return this.placement&&o.push(function(e,t,i,n,r,o,s){const a={},l=o.queryRenderedSymbols(n),c=[];for(const e of Object.keys(l).map(Number))c.push(s[e]);c.sort(ze);for(const i of c){const n=i.featureIndex.lookupSymbolFeatures(l[i.bucketInstanceId],t,i.bucketIndex,i.sourceLayerIndex,r.filter,r.layers,r.availableImages,e);for(const e in n){const t=a[e]=a[e]||[],r=n[e];r.sort(((e,t)=>{const n=i.featureSortOrder;if(n){const i=n.indexOf(e.featureIndex);return n.indexOf(t.featureIndex)-i}return t.featureIndex-e.featureIndex}));for(const e of r)t.push(e)}}for(const t in a)a[t].forEach((n=>{const r=n.feature,o=i(e[t]);if(!o)return;const s=o.getFeatureState(r.layer["source-layer"],r.id);r.source=r.layer.source,r.layer["source-layer"]&&(r.sourceLayer=r.layer["source-layer"]),r.state=s}));return a}(this._layers,this._serializedLayers,this._getLayerSourceCache.bind(this),a.screenGeometry,i,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(o)}querySourceFeatures(t,i){i&&i.filter&&this._validate(e.validateFilter,"querySourceFeatures.filter",i.filter,null,i);const n=this._getSourceCaches(t);let r=[];for(const e of n)r=r.concat(De(e,i));return r}addSourceType(e,t,i){return Jt.getSourceType(e)?i(new Error(`A source type called "${e}" already exists.`)):(Jt.setSourceType(e,t),t.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:e,url:t.workerSourceURL},i):i(null,null))}getLight(){return this.light.getLight()}setLight(e,i={}){this._checkLoaded();const n=this.light.getLight();let r=!1;for(const i in e)if(!t(e[i],n[i])){r=!0;break}if(!r)return;const o=this._setTransitionParameters({duration:300,delay:0});this.light.setLight(e,i),this.light.updateTransitions(o)}getTerrain(){return this.terrain&&1===this.terrain.drapeRenderMode?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}setTerrain(i,n=1){if(this._checkLoaded(),!i)return delete this.terrain,delete this.stylesheet.terrain,this.dispatcher.broadcast("enableTerrain",!1),this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);let r=i;if(1===n){if("object"==typeof r.source){const t="terrain-dem-src";this.addSource(t,r.source),r=e.clone$1(r),r=e.extend(r,{source:t})}if(this._validate(e.validateTerrain,"terrain",r))return}if(!this.terrain||this.terrain&&n!==this.terrain.drapeRenderMode){if(!r)return;this._createTerrain(r,n)}else{const i=this.terrain,n=i.get();for(const t of Object.keys(e.spec.terrain))!r.hasOwnProperty(t)&&e.spec.terrain[t].default&&(r[t]=e.spec.terrain[t].default);for(const e in r)if(!t(r[e],n[e])){i.set(r),this.stylesheet.terrain=r;const e=this._setTransitionParameters({duration:0});i.updateTransitions(e);break}}this._updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(e){const t=this.fog=new M(e,this.map.transform);this.stylesheet.fog=e;const i=this._setTransitionParameters({duration:0});t.updateTransitions(i)}_updateMarkersOpacity(){0!==this.map._markers.length&&this.map._requestDomTask((()=>{for(const e of this.map._markers)e._evaluateOpacity()}))}getFog(){return this.fog?this.fog.get():null}setFog(e){if(this._checkLoaded(),!e)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const i=this.fog,n=i.get();0===Object.keys(e).length&&i.set(e);for(const r in e)if(!t(e[r],n[r])){i.set(e),this.stylesheet.fog=e;const t=this._setTransitionParameters({duration:0});i.updateTransitions(t);break}}else this._createFog(e);this._markersNeedUpdate=!0}_setTransitionParameters(t){return{now:e.exported.now(),transition:e.extend(t,this.stylesheet.transition)}}_updateDrapeFirstLayers(){if(!this.map._optimizeForTerrain||!this.terrain)return;const e=this._order.filter((e=>this.isLayerDraped(this._layers[e]))),t=this._order.filter((e=>!this.isLayerDraped(this._layers[e])));this._drapedFirstOrder=[],this._drapedFirstOrder.push(...e),this._drapedFirstOrder.push(...t)}_createTerrain(e,t){const i=this.terrain=new T(e,t);this.stylesheet.terrain=e,this.dispatcher.broadcast("enableTerrain",!this.terrainSetForDrapingOnly()),this._force3DLayerUpdate();const n=this._setTransitionParameters({duration:0});i.updateTransitions(n)}_force3DLayerUpdate(){for(const e in this._layers){const t=this._layers[e];"fill-extrusion"===t.type&&this._updateLayer(t)}}_forceSymbolLayerUpdate(){for(const e in this._layers){const t=this._layers[e];"symbol"===t.type&&this._updateLayer(t)}}_validate(t,i,n,r,o={}){return(!o||!1!==o.validate)&&Zt(this,t.call(e.validateStyle,e.extend({key:i,style:this.serialize(),value:n,styleSpec:e.spec},r)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),e.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const e in this._layers)this._layers[e].setEventedParent(null);for(const e in this._sourceCaches)this._sourceCaches[e].clearTiles(),this._sourceCaches[e].setEventedParent(null);this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(e){const t=this._getSourceCaches(e);for(const e of t)e.clearTiles()}_reloadSource(e){const t=this._getSourceCaches(e);for(const e of t)e.resume(),e.reload()}_reloadSources(){for(const e of this._getSources())e.reload&&e.reload()}_updateSources(e){for(const t in this._sourceCaches)this._sourceCaches[t].update(e)}_generateCollisionBoxes(){for(const e in this._sourceCaches){const t=this._sourceCaches[e];t.resume(),t.reload()}}_updatePlacement(t,i,n,r,o=!1){let s=!1,a=!1;const l={};for(const e of this._order){const i=this._layers[e];if("symbol"!==i.type)continue;if(!l[i.source]){const e=this._getLayerSourceCache(i);if(!e)continue;l[i.source]=e.getRenderableIds(!0).map((t=>e.getTileByID(t))).sort(((e,t)=>t.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(t.tileID)?-1:1)))}const n=this.crossTileSymbolIndex.addLayer(i,l[i.source],t.center.lng,t.projection);s=s||n}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),o=o||this._layerOrderChanged||0===n,this._layerOrderChanged&&this.fire(new e.Event("neworder")),(o||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(e.exported.now(),t.zoom))&&(this.pauseablePlacement=new jt(t,this._order,o,i,n,r,this.placement,this.fog&&t.projection.supportsFog?this.fog.state:null),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,l),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(e.exported.now()),a=!0),s&&this.pauseablePlacement.placement.setStale()),a||s)for(const e of this._order){const t=this._layers[e];"symbol"===t.type&&this.placement.updateLayerOpacities(t,l[t.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(e.exported.now())}_releaseSymbolFadeTiles(){for(const e in this._sourceCaches)this._sourceCaches[e].releaseSymbolFadeTiles()}getImages(e,t,i){this.imageManager.getImages(t.icons,i),this._updateTilesForChangedImages();const n=e=>{e&&e.setDependencies(t.tileID.key,t.type,t.icons)};n(this._otherSourceCaches[t.source]),n(this._symbolSourceCaches[t.source])}getGlyphs(e,t,i){this.glyphManager.getGlyphs(t.stacks,i)}getResource(t,i,n){return e.makeRequest(i,n)}_getSourceCache(e){return this._otherSourceCaches[e]}_getLayerSourceCache(e){return"symbol"===e.type?this._symbolSourceCaches[e.source]:this._otherSourceCaches[e.source]}_getSourceCaches(e){const t=[];return this._otherSourceCaches[e]&&t.push(this._otherSourceCaches[e]),this._symbolSourceCaches[e]&&t.push(this._symbolSourceCaches[e]),t}_isSourceCacheLoaded(t){const i=this._getSourceCaches(t);return 0===i.length?(this.fire(new e.ErrorEvent(new Error(`There is no source with ID '${t}'`))),!1):i.every((e=>e.loaded()))}has3DLayers(){return this._num3DLayers>0}hasSymbolLayers(){return this._numSymbolLayers>0}hasCircleLayers(){return this._numCircleLayers>0}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}Jt.getSourceType=function(e){return Ae[e]},Jt.setSourceType=function(e,t){Ae[e]=t},Jt.registerForPluginStateChange=e.registerForPluginStateChange;var Yt="\n#define EPSILON 0.0000001\n#define PI 3.141592653589793\n#define EXTENT 8192.0\n#define HALF_PI PI/2.0\n#define QUARTER_PI PI/4.0\n#define RAD_TO_DEG 180.0/PI\n#define DEG_TO_RAD PI/180.0\n#define GLOBE_RADIUS EXTENT/PI/2.0",Qt="attribute highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;varying highp vec3 v_uv;void 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;}",ei="\n#define ELEVATION_SCALE 7.0\n#define ELEVATION_OFFSET 450.0\n#ifdef PROJECTION_GLOBE_VIEW\nuniform 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(\nmix(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;}\n#else\nvec3 elevationVector(vec2 pos) { return vec3(0,0,1); }\n#endif\nconst float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt)\n{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}\n#ifdef TERRAIN\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nuniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;\n#else\nuniform sampler2D u_dem;uniform sampler2D u_dem_prev;\n#endif\nuniform vec4 u_dem_unpack;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;uniform sampler2D u_depth;uniform vec2 u_depth_size_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 decodeElevation(vec4 v) {return dot(vec4(v.xyz*255.0,-1.0),u_dem_unpack);}float currentElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture2D(u_dem,pos).a;\n#else\nfloat 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=decodeElevation(texture2D(u_dem,pos));\n#ifdef TERRAIN_DEM_NEAREST_FILTER\nreturn u_exaggeration*tl;\n#endif\nfloat tr=decodeElevation(texture2D(u_dem,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}float prevElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 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*texture2D(u_dem_prev,pos).a;\n#else\nfloat 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=decodeElevation(texture2D(u_dem_prev,pos));float tr=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem_prev,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}\n#ifdef TERRAIN_VERTEX_MORPHING\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nfloat nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}\n#else\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nreturn currentElevation(apos);}\n#endif\nhighp float unpack_depth(highp vec4 rgba_depth)\n{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;}bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;float depth=unpack_depth(texture2D(u_depth,(coord.xy+1.0)*0.5));return coord.z > depth+0.0005;}float occlusionFade(vec4 frag) {vec3 coord=frag.xyz/frag.w;vec3 df=vec3(5.0*u_depth_size_inv,0.0);vec2 uv=0.5*coord.xy+0.5;vec4 depth=vec4(\nunpack_depth(texture2D(u_depth,uv-df.xz)),unpack_depth(texture2D(u_depth,uv+df.xz)),unpack_depth(texture2D(u_depth,uv-df.zy)),unpack_depth(texture2D(u_depth,uv+df.zy))\n);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z-0.001)-depth),0.0,1.0));}vec4 fourSample(vec2 pos,vec2 off) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nfloat tl=texture2D(u_dem,pos).a;float tr=texture2D(u_dem,pos+vec2(off.x,0.0)).a;float bl=texture2D(u_dem,pos+vec2(0.0,off.y)).a;float br=texture2D(u_dem,pos+off).a;\n#else\nvec4 demtl=vec4(texture2D(u_dem,pos).xyz*255.0,-1.0);float tl=dot(demtl,u_dem_unpack);vec4 demtr=vec4(texture2D(u_dem,pos+vec2(off.x,0.0)).xyz*255.0,-1.0);float tr=dot(demtr,u_dem_unpack);vec4 dembl=vec4(texture2D(u_dem,pos+vec2(0.0,off.y)).xyz*255.0,-1.0);float bl=dot(dembl,u_dem_unpack);vec4 dembr=vec4(texture2D(u_dem,pos+off).xyz*255.0,-1.0);float br=dot(dembr,u_dem_unpack);\n#endif\nreturn 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);}\n#else\nfloat elevation(vec2 pos) { return 0.0; }bool isOccluded(vec4 frag) { return false; }float occlusionFade(vec4 frag) { return 1.0; }\n#endif",ti="#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;varying 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);}\n#endif",ii="#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump float u_fog_temporal_offset;varying 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;highp vec3 ray_dir=mix(\nmix(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 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,opacity);}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;}vec3 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;}vec3 fog_dither(vec3 color) {vec2 dither_seed=gl_FragCoord.xy+u_fog_temporal_offset;return dither(color,dither_seed);}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}\n#endif";let ni={},ri={};const oi=[];ui(Yt,oi),ui(ei,oi),ui(ti,oi),ui(ii,oi),ni=hi("",ei),ri=hi(ii,ti);const si=hi("\n#if __VERSION__ >=300\n#define varying in\n#define gl_FragColor glFragColor\n#define texture2D texture\n#define textureCube texture\nout vec4 glFragColor;\n#endif\nhighp vec3 hash(highp vec2 p) {highp vec3 p3=fract(p.xyx*vec3(443.8975,397.2973,491.1871));p3+=dot(p3,p3.yxz+19.19);return fract((p3.xxy+p3.yzz)*p3.zyx);}vec3 dither(vec3 color,highp vec2 seed) {vec3 rnd=hash(seed)+hash(seed+0.59374)-0.5;return color+rnd/255.0;}highp float unpack_depth(highp vec4 rgba_depth)\n{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;}","\n#if __VERSION__ >=300\n#define attribute in\n#define varying out\n#define texture2D texture\n#endif\nfloat 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;}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {\n#ifndef PROJECTED_POS_ON_VIEWPORT\nfloat 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;\n#else\nreturn vec3(0.0);\n#endif\n}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);}\n#endif\nvec2 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(\nunpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);//Normalized device coordinate that is not rendered."),ai=Yt,li="\n#ifdef GL_ES\nprecision mediump float;\n#else\n\n#if !defined(lowp)\n#define lowp\n#endif\n\n#if !defined(mediump)\n#define mediump\n#endif\n\n#if !defined(highp)\n#define highp\n#endif\n\n#endif";var ci={background:hi("uniform vec4 u_color;uniform float u_opacity;\n#ifdef LIGHTING_3D_MODE\nvarying vec4 v_color;\n#endif\nvoid main() {vec4 out_color;\n#ifdef LIGHTING_3D_MODE\nout_color=v_color;\n#else\nout_color=u_color;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#ifdef LIGHTING_3D_MODE\nuniform vec4 u_color;varying vec4 v_color;\n#endif\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef LIGHTING_3D_MODE\nv_color=apply_lighting(u_color);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),backgroundPattern:hi("uniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos;void main() {vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=texture2D(u_image,pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying 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_tile_units_to_pixels,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),circle:hi("varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(\nantialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)\n);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_apply_premultiplied(out_color,v_fog_pos);\n#endif\ngl_FragColor=out_color*(v_visibility*opacity_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","#define NUM_VISIBILITY_RINGS 2\n#define INV_SQRT2 0.70710678\n#define ELEVATION_BIAS 0.0001\n#define NUM_SAMPLES_PER_RING 16\nuniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute 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;\n#endif\nvarying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_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) {\n#if defined(TERRAIN)\nreturn elevation(pos)+ELEVATION_BIAS;\n#else\nreturn 0.0;\n#endif\n}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);\n#ifdef PITCH_WITH_MAP\n#ifdef PROJECTION_GLOBE_VIEW\nreturn u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );\n#else\nreturn u_matrix*( world_center+vec4(sample_offset,0,0) );\n#endif\n#else\nreturn projected_center+vec4(sample_offset,0,0);\n#endif\n}float get_sample_step() {\n#ifdef PITCH_WITH_MAP\nreturn 2.0*PI/float(NUM_SAMPLES_PER_RING);\n#else\nreturn PI/float(NUM_SAMPLES_PER_RING);\n#endif\n}void main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 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;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 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);\n#else \nsurface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1);\n#endif\nvec4 projected_center=u_matrix*world_center;float view_scale=0.0;\n#ifdef PITCH_WITH_MAP\n#ifdef SCALE_WITH_MAP\nview_scale=1.0;\n#else\nview_scale=projected_center.w/u_camera_to_center_distance;\n#endif\n#else\n#ifdef SCALE_WITH_MAP\nview_scale=u_camera_to_center_distance;\n#else\nview_scale=projected_center.w;\n#endif\n#endif\ngl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0;\n#ifdef TERRAIN\nfloat step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;\n#ifdef PITCH_WITH_MAP\nfloat 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;\n#else\nocclusion_world_center=world_center;occlusion_projected_center=projected_center;\n#endif\nfor(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);\n#else\nvisibility=1.0;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nvisibility=1.0;\n#endif\nv_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);\n#ifdef FOG\nv_fog_pos=fog_position(world_center.xyz);\n#endif\n}"),clippingMask:hi("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:hi("uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef FOG\nif (u_is_globe==0) {gl_FragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute 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;\n#endif\nvarying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 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;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 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);\n#else\npos=vec3(tilePos+extrude,elevation(tilePos));\n#endif\ngl_Position=u_matrix*vec4(pos,1);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),heatmapTexture:hi("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}","attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:hi("varying float v_placed;varying 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);gl_FragColor =mix(red,blue,step(0.5,v_placed))*0.5;gl_FragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}","attribute vec3 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;attribute float a_size_scale;attribute vec2 a_padding;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_pos+elevationVector(a_anchor_pos)*elevation(a_anchor_pos),1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(\n0.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:hi("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos_2f;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(\nmix(-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(\n0.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:hi("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;\n#endif\nvarying 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;\n#ifdef PROJECTION_GLOBE_VIEW\ngl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1);\n#else\ngl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);\n#endif\n}"),fill:hi("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nvec4 out_color=color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillOutline:hi("varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillOutlinePattern:hi("uniform vec2 u_texsize;uniform sampler2D u_image;varying vec2 v_pos;varying vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=texture2D(u_image,pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform 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;attribute vec2 a_pos;varying vec2 v_pos;varying vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;gl_Position=u_matrix*vec4(a_pos,0,1);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);v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillPattern:hi("uniform vec2 u_texsize;uniform sampler2D u_image;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec4 out_color=texture2D(u_image,pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillExtrusion:hi("varying vec4 v_color;\n#ifdef RENDER_SHADOWS\nvarying highp vec4 v_pos_light_view_0;varying highp vec4 v_pos_light_view_1;varying float v_depth;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\n#ifdef ZERO_ROOF_RADIUS\nvarying vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)\nvarying highp vec3 v_normal;\n#endif\nvoid main() {\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)\nvec3 normal=v_normal;\n#endif\nfloat z;vec4 color;\n#ifdef ZERO_ROOF_RADIUS\nz=float(normal.z > 0.00001);color=mix(v_color,v_roof_color,z);\n#else\ncolor=v_color;\n#endif\n#ifdef FAUX_AO\nfloat 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),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;\n#ifdef ZERO_ROOF_RADIUS\nconcave*=(1.0-z);\n#endif\nfloat 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);color.rgb=color.rgb*shade;\n#endif\n#ifdef RENDER_SHADOWS\n#ifdef ZERO_ROOF_RADIUS\nnormal=mix(normal,vec3(0.0,0.0,1.0),z);\n#endif\ncolor.xyz=shadowed_color_normal(color.xyz,normalize(normal),v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;attribute vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute 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;\n#endif\nvarying vec4 v_color;\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;varying highp vec4 v_pos_light_view_0;varying highp vec4 v_pos_light_view_1;varying float v_depth;\n#endif\n#ifdef ZERO_ROOF_RADIUS\nvarying vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)\nvarying highp vec3 v_normal;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec4 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));\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)\nv_normal=normal;\n#endif\nbase=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);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=0.0;float c_ele;vec3 pos;\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);pos=vec3(pos_nx.xy,h);\n#else\nh=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat 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);\n#endif\nfloat hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);\n#ifdef RENDER_SHADOWS\nv_pos_light_view_0=u_light_matrix_0*vec4(pos,1);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1);v_depth=gl_Position.w;\n#endif\nfloat NdotL=0.0;float colorvalue=0.0;\n#ifdef LIGHTING_3D_MODE\nNdotL=calculate_NdotL(normal);\n#else\ncolorvalue=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);\n#endif\nif (normal.y !=0.0) {float r=0.84;\n#ifndef LIGHTING_3D_MODE\nr=mix(0.7,0.98,1.0-u_lightintensity);\n#endif\nNdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}v_color=vec4(0.0,0.0,0.0,1.0);\n#ifdef FAUX_AO\nfloat 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;\n#ifdef TERRAIN\ntop_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);\n#endif\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\nv_color=apply_lighting(color,NdotL);\n#else\nv_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));\n#endif\nv_color*=u_opacity;\n#ifdef ZERO_ROOF_RADIUS\nv_roof_color=vec4(0.0,0.0,0.0,1.0);\n#ifdef LIGHTING_3D_MODE\nv_roof_color=apply_lighting(color,calculate_NdotL(vec3(0.0,0.0,1.0)));\n#else\nfloat 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.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));\n#endif\nv_roof_color*=u_opacity;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),fillExtrusionPattern:hi("uniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nvarying float v_NdotL;\n#endif\nvarying vec2 v_pos;varying vec4 v_lighting;uniform lowp float u_opacity;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec4 out_color=texture2D(u_image,pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color,v_NdotL)*u_opacity;\n#else\nout_color=out_color*v_lighting;\n#endif\n#ifdef FAUX_AO\nfloat 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),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;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform 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 vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute 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;\n#endif\nvarying vec2 v_pos;varying vec4 v_lighting;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nvarying float v_NdotL;\n#endif\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nvec2 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);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=z;vec3 p;float c_ele;\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);p=vec3(pos_nx.xy,h);\n#else\np=vec3(pos_nx.xy,z);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat 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);\n#endif\nfloat hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0\n? pos_nx.xy\n: 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;\n#ifdef LIGHTING_3D_MODE\nNdotL=calculate_NdotL(normal);\n#else\nNdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);\n#endif\nif (normal.y !=0.0) {float r=0.84;\n#ifndef LIGHTING_3D_MODE\nr=mix(0.7,0.98,1.0-u_lightintensity);\n#endif\nNdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\n#ifdef FAUX_AO\nfloat 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;\n#ifdef TERRAIN\ntop_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);\n#endif\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\nv_NdotL=NdotL;\n#else\nv_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\n#endif \n#ifdef FOG\nv_fog_pos=fog_position(p);\n#endif\n}"),hillshadePrepare:hi("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nreturn texture2D(u_image,coord).a/4.0;\n#else\nvec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;\n#endif\n}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(\n(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)\n)/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(\nderiv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:hi("uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef LIGHTING_3D_MODE\ngl_FragColor=apply_lighting(gl_FragColor);\n#endif\n#ifdef FOG\ngl_FragColor=fog_dither(fog_apply_premultiplied(gl_FragColor,v_fog_pos));\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),line:hi("uniform lowp float u_device_pixel_ratio;uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec4 v_uv;\n#ifdef RENDER_LINE_DASH\nuniform sampler2D u_dash_image;varying vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform sampler2D u_gradient_image;\n#endif\nuniform float u_border_width;uniform vec4 u_border_color;float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nfloat linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);\n#ifdef RENDER_LINE_DASH\nfloat sdfdist=texture2D(u_dash_image,v_tex).a;float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;alpha*=linearstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);\n#endif\nhighp vec4 out_color;\n#ifdef RENDER_LINE_GRADIENT\nout_color=texture2D(u_gradient_image,v_uv.xy);\n#else\nout_color=color;\n#endif\nfloat trimmed=1.0;\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end > trim_start) {if (line_progress <=trim_end && line_progress >=trim_start) {out_color=vec4(0,0,0,0);trimmed=0.0;}}\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#ifdef RENDER_LINE_ALPHA_DISCARD\nif (alpha < u_alpha_discard_threshold) {discard;}\n#endif\n#ifdef RENDER_LINE_BORDER\nfloat edgeBlur=(u_border_width+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);\n#ifdef RENDER_LINE_BORDER_AUTO\nfloat 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);}\n#else\nout_color.rgb=mix(u_border_color.rgb*u_border_color.a*trimmed,out_color.rgb,smoothAlpha);\n#endif\n}\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define EXTRUDE_SCALE 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nattribute highp vec4 a_packed;\n#endif\n#ifdef RENDER_LINE_DASH\nattribute float a_linesofar;\n#endif\nuniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec4 v_uv;\n#ifdef RENDER_LINE_DASH\nuniform vec2 u_texsize;uniform float u_tile_units_to_pixels;varying vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform float u_image_height;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat 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;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*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);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nfloat a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3];\n#ifdef RENDER_LINE_GRADIENT\nhighp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec4(a_uv_x,a_split_index*texel_height-half_texel_height,a_clip_start,a_clip_end);\n#else\nv_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end);\n#endif\n#endif\n#ifdef RENDER_LINE_DASH\nfloat 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,(-normal.y*height+dash.x+0.5)/u_texsize.y);\n#endif\nv_width2=vec2(outset,inset);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),linePattern:hi("uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;vec2 pattern_size=vec2(display_size.x/u_tile_units_to_pixels,display_size.y);float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x=mod(v_linesofar/pattern_size.x*aspect,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));vec4 color=texture2D(u_image,pos);\n#ifdef LIGHTING_3D_MODE\ncolor=apply_lighting(color);\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_linesofar;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nfloat 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;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),raster:hi("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(\ndot(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);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply(out_color,v_fog_pos));\n#endif\ngl_FragColor=vec4(out_color*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {float w=1.0+dot(a_texture_pos,u_perspective_transform);gl_Position=u_matrix*vec4(a_pos*w,0,w);v_pos0=a_texture_pos/8192.0;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),symbolIcon:hi("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_projected_pos;attribute float a_fade_opacity;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_globe_anchor;attribute vec3 a_globe_normal;\n#endif\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform vec3 u_up_vector;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform 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;\n#endif\nvarying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 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);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 (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,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;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 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 ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.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;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetProjected_point=u_matrix*vec4(a_globe_anchor+displacement,1);\n#else\noffsetProjected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);\n#endif\nvec2 a=projected_point.xy/projected_point.w;vec2 b=offsetProjected_point.xy/offsetProjected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp 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);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 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);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#endif\nfloat projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nv_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change))*projection_transition_fade;}"),symbolSDF:hi("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_projected_pos;attribute float a_fade_opacity;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_globe_anchor;attribute vec3 a_globe_normal;\n#endif\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform 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;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform 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;\n#endif\nvarying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 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);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,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;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 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 ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);\n#else\noffsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);\n#endif\nvec2 a=projected_point.xy/projected_point.w;vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp 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*fontScale+a_pxoffset);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 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);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#endif\nfloat gamma_scale=gl_Position.w;float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nvec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity*projection_transition_fade);}"),symbolTextAndIcon:hi("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_projected_pos;attribute float a_fade_opacity;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_globe_anchor;attribute vec3 a_globe_normal;\n#endif\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform 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;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform 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;\n#endif\nvarying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 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 is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,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;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 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 ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offset_projected_point=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projected_point.xy/projected_point.w;vec2 b=offset_projected_point.xy/offset_projected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp 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*font_scale);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 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);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#endif\nfloat gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nv_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity*projection_transition_fade,is_sdf);}"),terrainRaster:hi("uniform sampler2D u_image0;varying vec2 v_pos0;\n#ifdef FOG\nvarying float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nvarying vec4 v_pos_light_view_0;varying vec4 v_pos_light_view_1;varying float v_depth;\n#endif\nvoid main() {vec4 color=texture2D(u_image0,v_pos0);\n#ifdef RENDER_SHADOWS\ncolor.xyz=shadowed_color(color.xyz,v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#endif\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#else\ncolor=fog_dither(fog_apply_from_vert(color,v_fog_opacity));\n#endif\n#endif\ngl_FragColor=color;\n#ifdef TERRAIN_WIREFRAME\ngl_FragColor=vec4(1.0,0.0,0.0,0.8);\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_skirt_height;attribute vec2 a_pos;varying vec2 v_pos0;\n#ifdef FOG\nvarying float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;varying vec4 v_pos_light_view_0;varying vec4 v_pos_light_view_1;varying float v_depth;\n#endif\nconst float wireframeOffset=0.00015;void main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;\n#ifdef TERRAIN_WIREFRAME\nelevation+=wireframeOffset;\n#endif\nv_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\nv_fog_pos=fog_position(decodedPos);\n#else\nv_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec3 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.);v_depth=gl_Position.w;\n#endif\n}"),terrainDepth:hi("#ifdef GL_ES\nprecision highp float;\n#endif\nvarying float v_depth;void main() {gl_FragColor=pack_depth(v_depth);}","uniform mat4 u_matrix;attribute vec2 a_pos;varying 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:hi("\nvarying 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(\ncos_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))/(end-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=textureCube(u_cubemap,uv).rgb;\n#ifdef FOG\nsky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);\n#endif\nsky_color.rgb=dither(sky_color.rgb,gl_FragCoord.xy+u_temporal_offset);sky_color+=0.1*sun_disk(v_uv,u_sun_direction);gl_FragColor=vec4(sky_color*u_opacity,u_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}",Qt),skyboxGradient:hi("varying 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=texture2D(u_color_ramp,vec2(progress,0.5));\n#ifdef FOG\ncolor.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;\n#endif\ncolor*=u_opacity;color.rgb=dither(color.rgb,gl_FragCoord.xy+u_temporal_offset);gl_FragColor=color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}",Qt),skyboxCapture:hi("\nvarying 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;\n#ifdef GL_ES\nprecision highp float;\n#endif\n#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6)\n#define BETA_M vec3(21e-6,21e-6,21e-6)\n#define MIE_G 0.76\n#define DENSITY_HEIGHT_SCALE_R 8000.0\n#define DENSITY_HEIGHT_SCALE_M 1200.0\n#define PLANET_RADIUS 6360e3\n#define ATMOSPHERE_RADIUS 6420e3\n#define SAMPLE_STEPS 10\n#define DENSITY_STEPS 4\nfloat 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;gl_FragColor=vec4(color,1.0);}","attribute highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;varying 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);}"),globeRaster:hi("uniform sampler2D u_image0;varying vec2 v_pos0;\n#ifndef FOG\nuniform 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;\n#endif\nvoid main() {vec4 color;\n#ifdef CUSTOM_ANTIALIASING\nvec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);vec3 dir=normalize(ray_dir);vec3 closest_point=dot(u_globe_pos,dir)*dir;float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture2D(u_image0,v_pos0);color=vec4(raster.rgb*antialias,raster.a*antialias);\n#else\ncolor=texture2D(u_image0,v_pos0);\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=color;\n#ifdef TERRAIN_WIREFRAME\ngl_FragColor=vec4(1.0,0.0,0.0,0.8);\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform 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;\n#ifdef GLOBE_POLES\nattribute vec3 a_globe_pos;attribute vec2 a_uv;\n#else\nattribute vec2 a_pos;\n#endif\nvarying vec2 v_pos0;const float wireframeOffset=1e3;float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(QUARTER_PI+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);}void main() {\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;vec2 uv=a_uv;\n#else\nfloat 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);\n#endif\nv_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale;\n#ifdef GLOBE_POLES\nvec3 up_vector=globe_derived_up_vector;\n#else\nvec3 up_vector=elevationVector(tile_pos);\n#endif\nfloat height=elevation(tile_pos);\n#ifdef TERRAIN_WIREFRAME\nheight+=wireframeOffset;\n#endif\nglobe_pos+=up_vector*height;\n#ifndef GLOBE_POLES\nglobe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z;\n#endif\n#ifdef GLOBE_POLES\nvec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);\n#else\nvec4 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);\n#endif\ngl_Position=u_proj_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n}"),globeAtmosphere:hi("uniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec3 u_start_color;uniform vec4 u_color;uniform vec4 u_space_color;uniform vec4 u_high_color;uniform float u_star_intensity;uniform float u_star_size;uniform float u_star_density;uniform float u_horizon_angle;uniform mat4 u_rotation_matrix;varying highp vec3 v_ray_dir;varying highp vec3 v_horizon_dir;highp float random(highp vec3 p) {p=fract(p*vec3(23.2342,97.1231,91.2342));p+=dot(p.zxy,p.yxz+123.1234);return fract(p.x*p.y);}float stars(vec3 p,float scale,vec2 offset) {vec2 uv_scale=(u_viewport/u_star_size)*scale;vec3 position=vec3(p.xy*uv_scale+offset*u_viewport,p.z);vec3 q=fract(position)-0.5;vec3 id=floor(position);float random_visibility=step(random(id),u_star_density);float circle=smoothstep(0.5+u_star_intensity,0.5,length(q));return circle*random_visibility;}void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir;\n#ifdef PROJECTION_GLOBE_VIEW\nglobe_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) {discard;return;}\n#endif\nhighp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?\n0.0 : max(acos(dot(dir,horizon_dir)),0.0);float horizon_angle;\n#ifdef PROJECTION_GLOBE_VIEW\nhighp vec3 closest_point=globe_pos_dot_dir*dir;float closest_point_to_center=length(closest_point-u_globe_pos);float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ?\nPI-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);\n#else\nhorizon_angle=horizon_angle_mercator;\n#endif\nhorizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_color.rgb;vec3 color_stop_1=u_high_color.rgb;vec3 color_stop_2=u_space_color.rgb;vec3 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 =mix(color_stop_2,c2,t);float 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);vec2 uv=gl_FragCoord.xy/u_viewport-0.5;float aspect_ratio=u_viewport.x/u_viewport.y;vec4 uv_dir=vec4(normalize(vec3(uv.x*aspect_ratio,uv.y,1.0)),1.0);uv_dir=u_rotation_matrix*uv_dir;vec3 n=abs(uv_dir.xyz);vec2 uv_remap=(n.x > n.y && n.x > n.z) ? uv_dir.yz/uv_dir.x:\n(n.y > n.x && n.y > n.z) ? uv_dir.zx/uv_dir.y:\nuv_dir.xy/uv_dir.z;uv_remap.x/=aspect_ratio;vec3 D=vec3(uv_remap,1.0);highp float star_field=0.0;if (u_star_intensity > 0.0) {star_field+=stars(D,1.2,vec2(0.0,0.0));star_field+=stars(D,1.0,vec2(1.0,0.0));star_field+=stars(D,0.8,vec2(0.0,1.0));star_field+=stars(D,0.6,vec2(1.0,1.0));star_field*=(1.0-pow(t,0.25+(1.0-u_high_color.a)*0.75));c+=star_field*alpha_2;}c=dither(c,gl_FragCoord.xy+u_temporal_offset);gl_FragColor=vec4(c,a);}","attribute vec3 a_pos;attribute 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;varying highp vec3 v_ray_dir;varying highp vec3 v_horizon_dir;void main() {v_ray_dir=mix(\nmix(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(\nmix(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);}")};function ui(e,t){const i=e.replace(/\s*\/\/[^\n]*\n/g,"\n").split("\n");for(let e of i)if(e=e.trim(),"#"===e[0]&&e.includes("if")&&!e.includes("endif")){e=e.replace("#","").replace(/ifdef|ifndef|elif|if/g,"").replace(/!|defined|\(|\)|\|\||&&/g,"").replace(/\s+/g," ").trim();const i=e.split(" ");for(const e of i)t.includes(e)||t.push(e)}}function hi(e,t){const i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,n=t.match(/attribute (highp |mediump |lowp )?([\w]+) ([\w]+)/g),r={},o=[...oi];return ui(e,o),ui(t,o),{fragmentSource:e=e.replace(i,((e,t,i,n,o)=>(r[o]=!0,"define"===t?`\n#ifndef HAS_UNIFORM_u_${o}\nvarying ${i} ${n} ${o};\n#else\nuniform ${i} ${n} u_${o};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${o}\n ${i} ${n} ${o} = u_${o};\n#endif\n`))),vertexSource:t=t.replace(i,((e,t,i,n,o)=>{const s="float"===n?"vec2":"vec4",a=o.match(/color/)?"color":s;return r[o]?"define"===t?`\n#ifndef HAS_UNIFORM_u_${o}\nuniform lowp float u_${o}_t;\nattribute ${i} ${s} a_${o};\nvarying ${i} ${n} ${o};\n#else\nuniform ${i} ${n} u_${o};\n#endif\n`:"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${o}\n ${o} = a_${o};\n#else\n ${i} ${n} ${o} = u_${o};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${o}\n ${o} = unpack_mix_${a}(a_${o}, u_${o}_t);\n#else\n ${i} ${n} ${o} = u_${o};\n#endif\n`:"define"===t?`\n#ifndef HAS_UNIFORM_u_${o}\nuniform lowp float u_${o}_t;\nattribute ${i} ${s} a_${o};\n#else\nuniform ${i} ${n} u_${o};\n#endif\n`:"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${o}\n ${i} ${n} ${o} = a_${o};\n#else\n ${i} ${n} ${o} = u_${o};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${o}\n ${i} ${n} ${o} = unpack_mix_${a}(a_${o}, u_${o}_t);\n#else\n ${i} ${n} ${o} = u_${o};\n#endif\n`})),staticAttributes:n,usedDefines:o}}class di{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(e,t,i,n,r,o,s){this.context=e;let a=this.boundPaintVertexBuffers.length!==n.length;for(let e=0;!a&&e{const r=i.paint.get("hillshade-shadow-color"),o=i.paint.get("hillshade-highlight-color"),s=i.paint.get("hillshade-accent-color");let a=i.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===i.paint.get("hillshade-illumination-anchor")&&(a-=e.transform.angle);const l=!e.options.moving;return{u_matrix:n||e.transform.calculateProjMatrix(t.tileID.toUnwrapped(),l),u_image:0,u_latrange:pi(0,t.tileID),u_light:[i.paint.get("hillshade-exaggeration"),a],u_shadow:r,u_highlight:o,u_accent:s}})(t,n,r,t.terrain?i.projMatrix:null);t.prepareDrawProgram(l,h,i.toUnwrapped());const{tileBoundsBuffer:p,tileBoundsIndexBuffer:f,tileBoundsSegments:m}=t.getTileBoundsBuffers(n);h.draw(l,c.TRIANGLES,o,s,a,e.CullFaceMode.disabled,d,r.id,p,f,m)}function mi(t,i,n){if(!i.needsDEMTextureUpload)return;const r=t.context,o=r.gl;r.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||t.getTileTexture(n.stride);const s=n.getPixels();i.demTexture?i.demTexture.update(s,{premultiply:!1}):i.demTexture=new e.Texture(r,s,o.RGBA,{premultiply:!1}),i.needsDEMTextureUpload=!1}function _i(t,i,n,r,o,s){const a=t.context,l=a.gl;if(!i.dem)return;const c=i.dem;if(a.activeTexture.set(l.TEXTURE1),mi(t,i,c),!i.demTexture)return;i.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);const u=c.dim;a.activeTexture.set(l.TEXTURE0);let h=i.fbo;if(!h){const t=new e.Texture(a,{width:u,height:u,data:null},l.RGBA);t.bind(l.LINEAR,l.CLAMP_TO_EDGE),h=i.fbo=a.createFramebuffer(u,u,!0),h.colorAttachment.set(t.texture)}a.bindFramebuffer.set(h.framebuffer),a.viewport.set([0,0,u,u]);const{tileBoundsBuffer:d,tileBoundsIndexBuffer:p,tileBoundsSegments:f}=t.getMercatorTileBoundsBuffers();t.useProgram("hillshadePrepare").draw(a,l.TRIANGLES,r,o,s,e.CullFaceMode.disabled,((t,i)=>{const n=i.stride,r=e.create();return e.ortho(r,0,e.EXTENT,-e.EXTENT,0,0,1),e.translate(r,r,[0,-e.EXTENT,0]),{u_matrix:r,u_image:1,u_dimension:[n,n],u_zoom:t.overscaledZ,u_unpack:i.unpackVector}})(i.tileID,c),n.id,d,p,f),i.needsHillshadePrepare=!1}const gi=t=>({u_matrix:new e.UniformMatrix4f(t),u_image0:new e.Uniform1i(t),u_skirt_height:new e.Uniform1f(t)}),yi=(e,t)=>({u_matrix:e,u_image0:0,u_skirt_height:t}),bi=(e,t,i,n,r,o,s,a,l,c,u,h,d,p,f)=>({u_proj_matrix:Float32Array.from(e),u_globe_matrix:t,u_normalize_matrix:Float32Array.from(n),u_merc_matrix:i,u_zoom_transition:r,u_merc_center:o,u_image0:0,u_frustum_tl:s,u_frustum_tr:a,u_frustum_br:l,u_frustum_bl:c,u_globe_pos:u,u_globe_radius:h,u_viewport:d,u_grid_matrix:f?Float32Array.from(f):new Float32Array(9),u_skirt_height:p});function vi(e,t){return null!=e&&null!=t&&!(!e.hasData()||!t.hasData())&&null!=e.demTexture&&null!=t.demTexture&&e.tileID.key!==t.tileID.key}const xi=new class{constructor(){this.operations={}}newMorphing(e,t,i,n,r){if(e in this.operations){const t=this.operations[e];t.to.tileID.key!==i.tileID.key&&(t.queued=i)}else this.operations[e]={startTime:n,phase:0,duration:r,from:t,to:i,queued:null}}getMorphValuesForProxy(e){if(!(e in this.operations))return null;const t=this.operations[e];return{from:t.from,to:t.to,phase:t.phase}}update(e){for(const t in this.operations){const i=this.operations[t];for(i.phase=(e-i.startTime)/i.duration;i.phase>=1||!this._validOp(i);)if(!this._nextOp(i,e)){delete this.operations[t];break}}}_nextOp(e,t){return!!e.queued&&(e.from=e.to,e.to=e.queued,e.queued=null,e.phase=0,e.startTime=t,!0)}_validOp(e){return e.from.hasData()&&e.to.hasData()}},wi={0:null,1:"TERRAIN_VERTEX_MORPHING",2:"TERRAIN_WIREFRAME"};function Ei(e){return 6*Math.pow(1.5,22-e)}function Ti(e,t){const i=1<({u_matrix:e});function Ci(t,i,n,r,o){if(o>0){const s=e.exported.now(),a=(s-t.timeAdded)/o,l=i?(s-i.timeAdded)/o:-1,c=n.getSource(),u=r.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),h=!i||Math.abs(i.tileID.overscaledZ-u)>Math.abs(t.tileID.overscaledZ-u),d=h&&t.refreshedUponExpiration?1:e.clamp(h?a:1-l,0,1);return t.refreshedUponExpiration&&a>=1&&(t.refreshedUponExpiration=!1),i?{opacity:1,mix:1-d}:{opacity:d,mix:0}}return{opacity:1,mix:0}}class Si extends e.SourceCache{constructor(e){const t={type:"raster-dem",maxzoom:e.transform.maxZoom},i=new A(Ue(),null),n=Ie("mock-dem",t,i,e.style);super("mock-dem",n,!1),n.setEventedParent(this),this._sourceLoaded=!0}_loadTile(e,t){e.state="loaded",t(null)}}class Mi extends e.SourceCache{constructor(e){const t=Ie("proxy",{type:"geojson",maxzoom:e.transform.maxZoom},new A(Ue(),null),e.style);super("proxy",t,!1),t.setEventedParent(this),this.map=this.getSource().map=e,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(t,i,n){if(t.freezeTileCoverage)return;this.transform=t;const r=t.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce(((i,n)=>{if(i[n.key]="",!this._tiles[n.key]){const i=new e.Tile(n,this._source.tileSize*n.overscaleFactor(),t.tileZoom);i.state="loaded",this._tiles[n.key]=i}return i}),{});for(const e in this._tiles)e in r||(this.freeFBO(e),this._tiles[e].unloadVectorData(),delete this._tiles[e])}freeFBO(e){const t=this.proxyCachedFBO[e];if(void 0!==t){const i=Object.values(t);this.renderCachePool.push(...i),delete this.proxyCachedFBO[e]}}deallocRenderCache(){this.renderCache.forEach((e=>e.fb.destroy())),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class Ai extends e.OverscaledTileID{constructor(e,t,i){super(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y),this.proxyTileKey=t,this.projMatrix=i}}class Ii extends e.Elevation{constructor(t,i){super(),this.painter=t,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[n,r,o]=function(t){const i=new e.StructArrayLayout2i4,n=new e.StructArrayLayout3ui6,r=131;i.reserve(17161),n.reserve(33800);const o=e.EXTENT/128,s=e.EXTENT+o/2,a=s+o;for(let t=-o;ts||t<0||t>s?24575:0,o=e.clamp(Math.round(n),0,e.EXTENT),a=e.clamp(Math.round(t),0,e.EXTENT);i.emplaceBack(o+r,a)}const l=(e,t)=>{const i=t*r+e;n.emplaceBack(i+1,i,i+r),n.emplaceBack(i+r,i+r+1,i+1)};for(let e=1;e<129;e++)for(let t=1;t<129;t++)l(t,e);return[0,129].forEach((e=>{for(let t=0;t<130;t++)l(t,e),l(e,t)})),[i,n,32768]}(),s=t.context;this.gridBuffer=s.createVertexBuffer(n,e.posAttributes.members),this.gridIndexBuffer=s.createIndexBuffer(r),this.gridSegments=e.SegmentVector.simpleSegment(0,0,n.length,r.length),this.gridNoSkirtSegments=e.SegmentVector.simpleSegment(0,0,n.length,o),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new Mi(i.map),this.orthoMatrix=e.create(),e.ortho(this.orthoMatrix,"globe"===this.painter.transform.projection.name?.015:0,e.EXTENT,0,e.EXTENT,0,1);const a=s.gl;this._overlapStencilMode=new e.StencilMode({func:a.GEQUAL,mask:255},0,255,a.KEEP,a.KEEP,a.REPLACE),this._previousZoom=t.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=i,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new Si(i.map)}set style(e){e.on("data",this._onStyleDataEvent.bind(this)),e.on("neworder",this._checkRenderCacheEfficiency.bind(this)),this._style=e,this._checkRenderCacheEfficiency(),this._style.map.on("moveend",(()=>{this._clearLineLayersFromRenderCache()}))}update(t,i,n){if(t&&t.terrain){this._style!==t&&(this.style=t),this.enabled=!0;const r=t.terrain.properties;this.sourceCache=0===t.terrain.drapeRenderMode?this._mockSourceCache:t._getSourceCache(r.get("source")),this._exaggeration=r.get("exaggeration");const o=()=>{this.sourceCache.used&&e.warnOnce(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source.\nThis leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const t=this.getScaledDemTileSize();this.sourceCache.update(i,t,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,o(),this._initializing=!0),o(),i.updateElevation(!0,n),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(i),this._emptyDEMTextureDirty=!0}else this._disable()}resetTileLookupCache(e){this._findCoveringTileCache[e]={}}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_checkRenderCacheEfficiency(){const t=this.renderCacheEfficiency(this._style);this._style.map._optimizeForTerrain||100!==t.efficiency&&e.warnOnce(`Terrain render cache efficiency is not optimal (${t.efficiency}%) and performance\n may be affected negatively, consider placing all background, fill and line layers before layer\n with id '${t.firstUndrapedLayer}' or create a map using optimizeForTerrain: true option.`)}_onStyleDataEvent(e){e.coord&&"source"===e.dataType?this._clearRenderCacheForTile(e.sourceCacheId,e.coord):"style"===e.dataType&&(this._invalidateRenderCache=!0)}_disable(){if(this.enabled&&(this.enabled=!1,this._sharedDepthStencil=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const e in this._style._sourceCaches)this._style._sourceCaches[e].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this._emptyDepthBufferTexture&&this._emptyDepthBufferTexture.destroy(),this.pool.forEach((e=>e.fb.destroy())),this.pool=[],this._depthFBO&&(this._depthFBO.destroy(),this._depthFBO=void 0,this._depthTexture=void 0)}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this._exaggeration}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const e=2*this.proxySourceCache.getSource().tileSize;return[e,e]}set useVertexMorphing(e){this._useVertexMorphing=e}updateTileBinding(t){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const i=this.proxySourceCache,n=this.painter.transform;this._initializing&&(this._initializing=0===n._centerAltitude&&-1===this.getAtPointOrZero(e.MercatorCoordinate.fromLngLat(n.center),-1),this._emptyDEMTextureDirty=!this._initializing);const r=this.proxyCoords=i.getIds().map((e=>{const t=i.getTileByID(e).tileID;return t.projMatrix=n.calculateProjMatrix(t.toUnwrapped()),t}));!function(t,i){const n=i.transform.pointCoordinate(i.transform.getCameraPoint()),r=new e.Point(n.x,n.y);t.sort(((t,i)=>{if(i.overscaledZ-t.overscaledZ)return i.overscaledZ-t.overscaledZ;const n=new e.Point(t.canonical.x+(1<{this.proxyToSource[e.key]={}})),this.terrainTileForTile={};const s=this._style._sourceCaches;for(const e in s){const i=s[e];if(!i.used)continue;if(i!==this.sourceCache&&this.resetTileLookupCache(i.id),this._setupProxiedCoordsForOrtho(i,t[e],o),i.usedForTerrain)continue;const n=t[e];i.getSource().reparseOverscaled&&this._assignTerrainTiles(n)}this.proxiedCoords[i.id]=r.map((e=>new Ai(e,e.key,this.orthoMatrix))),this._assignTerrainTiles(r),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(o),this.renderingToTexture=!1,this._updateTimestamp=e.exported.now();const a={};this._visibleDemTiles=[];for(const e of this.proxyCoords){const t=this.terrainTileForTile[e.key];if(!t)continue;const i=t.tileID.key;i in a||(this._visibleDemTiles.push(t),a[i]=i)}}_assignTerrainTiles(e){this._initializing||e.forEach((e=>{if(this.terrainTileForTile[e.key])return;const t=this._findTileCoveringTileID(e,this.sourceCache);t&&(this.terrainTileForTile[e.key]=t)}))}_prepareDEMTextures(){const e=this.painter.context,t=e.gl;for(const i in this.terrainTileForTile){const n=this.terrainTileForTile[i],r=n.dem;!r||n.demTexture&&!n.needsDEMTextureUpload||(e.activeTexture.set(t.TEXTURE1),mi(this.painter,n,r))}}_prepareDemTileUniforms(e,t,i,n){if(!t||null==t.demTexture)return!1;const r=e.tileID.canonical,o=Math.pow(2,t.tileID.canonical.z-r.z),s=n||"";return i[`u_dem_tl${s}`]=[r.x*o%1,r.y*o%1],i[`u_dem_scale${s}`]=o,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}get emptyDepthBufferTexture(){const t=this.painter.context,i=t.gl;if(!this._emptyDepthBufferTexture){const n=new e.RGBAImage({width:1,height:1},Uint8Array.of(255,255,255,255));this._emptyDepthBufferTexture=new e.Texture(t,n,i.RGBA,{premultiply:!1})}return this._emptyDepthBufferTexture}_getLoadedAreaMinimum(){let e=0;const t=this._visibleDemTiles.reduce(((t,i)=>{if(!i.dem)return t;const n=i.dem.tree.minimums[0];return n>0&&e++,t+n}),0);return e?t/e:0}_updateEmptyDEMTexture(){const t=this.painter.context,i=t.gl;t.activeTexture.set(i.TEXTURE2);const n=this._getLoadedAreaMinimum(),r=new e.RGBAImage({width:1,height:1},new Uint8Array(e.DEMData.pack(n,this.sourceCache.getSource().encoding)));this._emptyDEMTextureDirty=!1;let o=this._emptyDEMTexture;return o?o.update(r,{premultiply:!1}):o=this._emptyDEMTexture=new e.Texture(t,r,i.RGBA,{premultiply:!1}),o}setupElevationDraw(t,i,n){const r=this.painter.context,o=r.gl,s=(a=this.sourceCache.getSource().encoding,{u_dem:2,u_dem_prev:4,u_dem_unpack:e.DEMData.getUnpackVector(a),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_exaggeration:0});var a;s.u_dem_size=this.sourceCache.getSource().tileSize,s.u_exaggeration=this.exaggeration();let l=null,c=null,u=1;if(n&&n.morphing&&this._useVertexMorphing){const e=n.morphing.srcDemTile,i=n.morphing.dstDemTile;u=n.morphing.phase,e&&i&&(this._prepareDemTileUniforms(t,e,s,"_prev")&&(c=e),this._prepareDemTileUniforms(t,i,s)&&(l=i))}if(c&&l?(r.activeTexture.set(o.TEXTURE2),l.demTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE,o.NEAREST),r.activeTexture.set(o.TEXTURE4),c.demTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE,o.NEAREST),s.u_dem_lerp=u):(l=this.terrainTileForTile[t.tileID.key],r.activeTexture.set(o.TEXTURE2),(this._prepareDemTileUniforms(t,l,s)?l.demTexture:this.emptyDEMTexture).bind(o.NEAREST,o.CLAMP_TO_EDGE)),r.activeTexture.set(o.TEXTURE3),n&&n.useDepthForOcclusion?(this._depthTexture&&this._depthTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE),this._depthFBO&&(s.u_depth_size_inv=[1/this._depthFBO.width,1/this._depthFBO.height])):(this.emptyDepthBufferTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE),s.u_depth_size_inv=[1,1]),n&&n.useMeterToDem&&l){const t=(1<{if(c===e)return;const n=[wi[e],"PROJECTION_GLOBE_VIEW"];d&&n.push("CUSTOM_ANTIALIASING"),i&&n.push(wi[u]),l=t.useProgram("globeRaster",null,n),c=e},f=t.colorModeForRenderPass(),m=new e.DepthMode(a.LEQUAL,e.DepthMode.ReadWrite,t.depthRangeFor3D);xi.update(o);const _=e.calculateGlobeMercatorMatrix(h),g=[e.mercatorXfromLng(h.center.lng),e.mercatorYfromLat(h.center.lat)],y=u?[!1,!0]:[!1],b=t.globeSharedBuffers,v=[h.width*e.exported.devicePixelRatio,h.height*e.exported.devicePixelRatio],x=Float32Array.from(h.globeMatrix),w={useDenormalizedUpVectorScale:!0};if(y.forEach((u=>{const h=t.transform,d=Ei(h.zoom)*i.exaggeration();c=-1;const y=u?a.LINES:a.TRIANGLES;for(const c of r){const r=n.getTile(c),E=e.StencilMode.disabled,T=i.prevTerrainTileForTile[c.key],k=i.terrainTileForTile[c.key];vi(T,k)&&xi.newMorphing(c.key,T,k,o,250),s.activeTexture.set(a.TEXTURE0),r.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE);const C=xi.getMorphValuesForProxy(c.key),S=C?1:0;C&&e.extend$1(w,{morphing:{srcDemTile:C.from,dstDemTile:C.to,phase:e.easeCubicInOut(C.phase)}});const M=e.tileCornersToBounds(c.canonical),A=e.getLatitudinalLod(M.getCenter().lat),I=e.getGridMatrix(c.canonical,M,A,h.worldSize/h._pixelsPerMercatorPixel),P=e.globeNormalizeECEF(e.globeTileBounds(c.canonical)),L=bi(h.projMatrix,x,_,P,e.globeToMercatorTransition(h.zoom),g,h.frustumCorners.TL,h.frustumCorners.TR,h.frustumCorners.BR,h.frustumCorners.BL,h.globeCenterInViewSpace,h.globeRadius,v,d,I);if(p(S,u),i.setupElevationDraw(r,l,w),t.prepareDrawProgram(s,l,c.toUnwrapped()),b){const[i,n,r]=u?b.getWirefameBuffers(t.context,A):b.getGridBuffers(A,0!==d);l.draw(s,y,m,E,f,e.CullFaceMode.backCCW,L,"globe_raster",i,n,r)}}})),b){const o=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];d&&o.push("CUSTOM_ANTIALIASING"),l=t.useProgram("globeRaster",null,o);for(const o of r){const{x:r,y:c,z:u}=o.canonical,d=0===c,p=c===(1<t.draw(s,a.TRIANGLES,m,e.StencilMode.disabled,f,e.CullFaceMode.disabled,bi(h.projMatrix,b,b,T,0,g,h.frustumCorners.TL,h.frustumCorners.TR,h.frustumCorners.BR,h.frustumCorners.BL,h.globeCenterInViewSpace,h.globeRadius,v,0),"globe_pole_raster",i,x,E);i.setupElevationDraw(c,l,w),t.prepareDrawProgram(s,l,o.toUnwrapped()),d&&k(l,_),p&&(b=e.scale(e.create(),b,[1,-1,1]),k(l,y))}}}}(t,i,n,r,o);else{const s=t.context,a=s.gl;let l,c;const u=t.options.showTerrainWireframe?2:0,h=(e,i)=>{if(c===e)return;const n=[wi[e]];i&&n.push(wi[u]),l=t.useProgram("terrainRaster",null,n),c=e},d=t.colorModeForRenderPass(),p=new e.DepthMode(a.LEQUAL,e.DepthMode.ReadWrite,t.depthRangeFor3D);xi.update(o);const f=t.transform,m=Ei(f.zoom)*i.exaggeration();(u?[!1,!0]:[!1]).forEach((u=>{c=-1;const _=u?a.LINES:a.TRIANGLES,[g,y]=u?i.getWirefameBuffer():[i.gridIndexBuffer,i.gridSegments];for(const c of r){const r=n.getTile(c),b=e.StencilMode.disabled,v=i.prevTerrainTileForTile[c.key],x=i.terrainTileForTile[c.key];vi(v,x)&&xi.newMorphing(c.key,v,x,o,250),s.activeTexture.set(a.TEXTURE0),r.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE,a.LINEAR_MIPMAP_NEAREST);const w=xi.getMorphValuesForProxy(c.key),E=w?1:0;let T;w&&(T={morphing:{srcDemTile:w.from,dstDemTile:w.to,phase:e.easeCubicInOut(w.phase)}});const k=yi(c.projMatrix,Ti(c.canonical,f.renderWorldCopies)?m/10:m);h(E,u),i.setupElevationDraw(r,l,T),t.prepareDrawProgram(s,l,c.toUnwrapped()),l.draw(s,_,p,b,d,e.CullFaceMode.backCCW,k,"terrain_raster",i.gridBuffer,g,y)}}))}}(i,this,this.proxySourceCache,t,this._updateTimestamp),this.renderingToTexture=!0,i.gpuTimingDeferredRenderEnd(),t.splice(0,t.length))}renderBatch(t){if(0===this._drapedRenderBatches.length)return t+1;this.renderingToTexture=!0;const i=this.painter,n=this.painter.context,r=this.proxySourceCache,o=this.proxiedCoords[r.id],s=this._drapedRenderBatches.shift(),a=[],l=i.style.order;let c=0;for(const u of o){const o=r.getTileByID(u.proxyTileKey),h=r.proxyCachedFBO[u.key]?r.proxyCachedFBO[u.key][t]:void 0,d=void 0!==h?r.renderCache[h]:this.pool[c++],p=void 0!==h;if(o.texture=d.tex,p&&!d.dirty){a.push(o.tileID);continue}let f;n.bindFramebuffer.set(d.fb.framebuffer),this.renderedToTile=!1,d.dirty&&(n.clear({color:e.Color.transparent,stencil:0}),d.dirty=!1);for(let e=s.start;e<=s.end;++e){const t=i.style._layers[l[e]];if(t.isHidden(i.transform.zoom))continue;const r=i.style._getLayerSourceCache(t),o=r?this.proxyToSource[u.key][r.id]:[u];if(!o)continue;const s=o;n.viewport.set([0,0,d.fb.width,d.fb.height]),f!==(r?r.id:null)&&(this._setupStencil(d,o,t,r),f=r?r.id:null),i.renderLayer(i,r,t,s)}this.renderedToTile?(d.dirty=!0,a.push(o.tileID)):p||--c,5===c&&(c=0,this.renderToBackBuffer(a))}return this.renderToBackBuffer(a),this.renderingToTexture=!1,n.bindFramebuffer.set(null),n.viewport.set([0,0,i.width,i.height]),s.end+1}postRender(){}renderCacheEfficiency(e){const t=e.order.length;if(0===t)return{efficiency:100};let i,n=0,r=0,o=!1;for(let s=0;se.dem)).forEach((t=>{e=Math.min(e,t.dem.tree.minimums[0])})),0===e?e:(e-30)*this._exaggeration}raycast(e,t,i){if(!this._visibleDemTiles)return null;const n=this._visibleDemTiles.filter((e=>e.dem)).map((n=>{const r=n.tileID,o=1<(null!==e.t?e.t:Number.MAX_VALUE)-(null!==t.t?t.t:Number.MAX_VALUE)));for(const r of n){if(null==r.t)return null;const n=r.tile.dem.tree.raycast(r.minx,r.miny,r.maxx,r.maxy,e,t,i);if(null!=n)return n}return null}_createFBO(){const t=this.painter.context,i=t.gl,n=this.drapeBufferSize;t.activeTexture.set(i.TEXTURE0);const r=new e.Texture(t,{width:n[0],height:n[1],data:null},i.RGBA);r.bind(i.LINEAR,i.CLAMP_TO_EDGE);const o=t.createFramebuffer(n[0],n[1],!1);return o.colorAttachment.set(r.texture),o.depthAttachment=new we(t,o.framebuffer),void 0===this._sharedDepthStencil?(this._sharedDepthStencil=t.createRenderbuffer(t.gl.DEPTH_STENCIL,n[0],n[1]),this._stencilRef=0,o.depthAttachment.set(this._sharedDepthStencil),t.clear({stencil:0})):o.depthAttachment.set(this._sharedDepthStencil),t.extTextureFilterAnisotropic&&!t.extTextureFilterAnisotropicForceOff&&i.texParameterf(i.TEXTURE_2D,t.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,t.extTextureFilterAnisotropicMax),{fb:o,tex:r,dirty:!1}}_initFBOPool(){for(;this.pool.length{const t=this._style._layers[e],i=t.isHidden(this.painter.transform.zoom);return"custom"===t.type?!i&&t.shouldRedrape():!i&&t.hasTransition()}))}_clearLineLayersFromRenderCache(){let t=!1;for(const e of this._style._getSources())if(e instanceof ke){t=!0;break}if(!t)return;const i={};for(let t=0;tt.renderCachePool.length){const e=Object.values(t.proxyCachedFBO);t.proxyCachedFBO={};for(let i=0;i=0;r--){const o=i[r];if(t.getTileByID(o.key),void 0!==t.proxyCachedFBO[o.key]){const i=e[o.key],r=this.proxyToSource[o.key];let s=0;for(const e in r){const t=r[e],o=i[e];if(!o||o.length!==t.length||t.some(((t,i)=>t!==o[i]||n[e]&&n[e].hasOwnProperty(t.key)))){s=-1;break}++s}for(const e in t.proxyCachedFBO[o.key])t.renderCache[t.proxyCachedFBO[o.key][e]].dirty=s<0||s!==Object.values(i).length}}const r=[...this._drapedRenderBatches];r.sort(((e,t)=>t.end-t.start-(e.end-e.start)));for(const e of r)for(const n of i){if(t.proxyCachedFBO[n.key])continue;let i=t.renderCachePool.pop();void 0===i&&t.renderCache.length<50&&(i=t.renderCache.length,t.renderCache.push(this._createFBO())),void 0!==i&&(t.proxyCachedFBO[n.key]={},t.proxyCachedFBO[n.key][e.start]=i,t.renderCache[i].dirty=!0)}this._tilesDirty={}}_setupStencil(e,t,i,n){if(!n||!this._sourceTilesOverlap[n.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const r=this.painter.context,o=r.gl;if(t.length<=1)return void(this._overlapStencilType=!1);let s;if(i.isTileClipped())s=t.length,this._overlapStencilMode.test={func:o.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(t[0].overscaledZ>t[t.length-1].overscaledZ))return void(this._overlapStencilType=!1);s=1,this._overlapStencilMode.test={func:o.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+s>255&&(r.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=s,this._overlapStencilMode.ref=this._stencilRef,i.isTileClipped()&&this._renderTileClippingMasks(t,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return"Clip"===this._overlapStencilType||"Mask"===this._overlapStencilType}stencilModeForRTTOverlap(t){return this.renderingToTexture&&this._overlapStencilType?("Clip"===this._overlapStencilType&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[t.key]),this._overlapStencilMode):e.StencilMode.disabled}_renderTileClippingMasks(t,i){const n=this.painter,r=this.painter.context,o=r.gl;n._tileClippingMaskIDs={},r.setColorMode(e.ColorMode.disabled),r.setDepthMode(e.DepthMode.disabled);const s=n.useProgram("clippingMask");for(const a of t){const t=n._tileClippingMaskIDs[a.key]=--i;s.draw(r,o.TRIANGLES,e.DepthMode.disabled,new e.StencilMode({func:o.ALWAYS,mask:0},t,255,o.KEEP,o.KEEP,o.REPLACE),e.ColorMode.disabled,e.CullFaceMode.disabled,ki(a.projMatrix),"$clipping",n.tileExtentBuffer,n.quadTriangleIndexBuffer,n.tileExtentSegments)}}pointCoordinate(t){const i=this.painter.transform;if(t.x<0||t.x>i.width||t.y<0||t.y>i.height)return null;const n=[t.x,t.y,1,1];e.transformMat4$1(n,n,i.pixelMatrixInverse),e.scale$1(n,n,1/n[3]),n[0]/=i.worldSize,n[1]/=i.worldSize;const r=i._camera.position,o=e.mercatorZfromAltitude(1,i.center.lat),s=[r[0],r[1],r[2]/o,0],a=e.subtract([],n.slice(0,3),s);e.normalize(a,a);const l=this.raycast(s,a,this._exaggeration);return null!==l&&l?(e.scaleAndAdd(s,s,a,l),s[3]=s[2],s[2]*=o,s):null}drawDepth(){const t=this.painter,i=t.context,n=this.proxySourceCache,r=Math.ceil(t.width),o=Math.ceil(t.height);if(!this._depthFBO||this._depthFBO.width===r&&this._depthFBO.height===o||(this._depthFBO.destroy(),this._depthFBO=void 0,this._depthTexture=void 0),!this._depthFBO){const t=i.gl,n=i.createFramebuffer(r,o,!0);i.activeTexture.set(t.TEXTURE0);const s=new e.Texture(i,{width:r,height:o,data:null},t.RGBA);s.bind(t.NEAREST,t.CLAMP_TO_EDGE),n.colorAttachment.set(s.texture);const a=i.createRenderbuffer(i.gl.DEPTH_COMPONENT16,r,o);n.depthAttachment.set(a),this._depthFBO=n,this._depthTexture=s}i.bindFramebuffer.set(this._depthFBO.framebuffer),i.viewport.set([0,0,r,o]),function(t,i,n,r){if("globe"===t.transform.projection.name)return;const o=t.context,s=o.gl;o.clear({depth:1});const a=t.useProgram("terrainDepth"),l=new e.DepthMode(s.LESS,e.DepthMode.ReadWrite,t.depthRangeFor3D);for(const t of r){const r=n.getTile(t),c=yi(t.projMatrix,0);i.setupElevationDraw(r,a),a.draw(o,s.TRIANGLES,l,e.StencilMode.disabled,e.ColorMode.unblended,e.CullFaceMode.backCCW,c,"terrain_depth",i.gridBuffer,i.gridIndexBuffer,i.gridNoSkirtSegments)}}(t,this,n,this.proxyCoords)}_setupProxiedCoordsForOrtho(e,t,i){if(e.getSource()instanceof Me)return this._setupProxiedCoordsForImageSource(e,t,i);this._findCoveringTileCache[e.id]=this._findCoveringTileCache[e.id]||{};const n=this.proxiedCoords[e.id]=[],r=this.proxyCoords;for(let t=0;t(e.min.x=Math.min(e.min.x,t.x-a.x),e.min.y=Math.min(e.min.y,t.y-a.y),e.max.x=Math.max(e.max.x,t.x-a.x),e.max.y=Math.max(e.max.y,t.y-a.y),e)),{min:new e.Point(Number.MAX_VALUE,Number.MAX_VALUE),max:new e.Point(-Number.MAX_VALUE,-Number.MAX_VALUE)}),c=(t,i)=>{const n=t.wrap+t.canonical.x/(1<s+l.max.x||r+oa+l.max.y};for(let e=0;ee.key===i.tileID.key));if(e)return e}if(i.tileID.key!==t.key){const n=t.canonical.z-i.tileID.canonical.z;let o,s,a;r=e.create();const l=i.tileID.wrap-t.wrap<0?(o=e.EXTENT>>n,s=o*((i.tileID.canonical.x<=r){const n=t.canonical.z-r;i.getSource().reparseOverscaled?(a=Math.max(t.canonical.z+2,i.transform.tileZoom),s=new e.OverscaledTileID(a,t.wrap,r,t.canonical.x>>n,t.canonical.y>>n)):0!==n&&(a=r,s=new e.OverscaledTileID(a,t.wrap,r,t.canonical.x>>n,t.canonical.y>>n))}s.key!==t.key&&(c.push(s.key),n=i.getTile(s))}const u=e=>{c.forEach((t=>{r[t]=e})),c.length=0};for(a-=1;a>=l&&(!n||!n.hasData());a--){n&&u(n.tileID.key);const e=s.calculateScaledKey(a);if(n=i.getTileByID(e),n&&n.hasData())break;const t=r[e];if(null===t)break;void 0===t?c.push(e):n=i.getTileByID(t)}return u(n?n.tileID.key:null),n&&n.hasData()?n:null}findDEMTileFor(e){return this.enabled?this._findTileCoveringTileID(e,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(e,t){let i=this._tilesDirty[e];i||(i=this._tilesDirty[e]={}),i[t.key]=!0}getWirefameBuffer(){if(!this.wireframeSegments){const t=function(t){let i=0;const n=new e.StructArrayLayout2ui4,r=131;for(let e=1;e<129;e++){for(let t=1;t<129;t++)i=e*r+t,n.emplaceBack(i,i+1),n.emplaceBack(i,i+r),n.emplaceBack(i+1,i+r),128===e&&n.emplaceBack(i+r,i+r+1);n.emplaceBack(i+1,i+1+r)}return n}();this.wireframeIndexBuffer=this.painter.context.createIndexBuffer(t),this.wireframeSegments=e.SegmentVector.simpleSegment(0,0,this.gridBuffer.length,t.length)}return[this.wireframeIndexBuffer,this.wireframeSegments]}}class Pi{static cacheKey(e,t,i,n){let r=`${t}${n?n.cacheKey:""}`;for(const t of i)e.usedDefines.includes(t)&&(r+=`/${t}`);return r}constructor(t,i,n,r,o,s){const a=t.gl;this.program=a.createProgram();const l=function(e){const t=[];for(let i=0;i`#define ${e}`)));const d=t.isWebGL2?"#version 300 es\n":"",p=d+h.concat(t.extStandardDerivatives&&0===d.length?"#extension GL_OES_standard_derivatives : enable\n".concat(li):li,li,ai,si.fragmentSource,ri.fragmentSource,n.fragmentSource).join("\n"),f=d+h.concat("\n#ifdef GL_ES\nprecision highp float;\n#else\n\n#if !defined(lowp)\n#define lowp\n#endif\n\n#if !defined(mediump)\n#define mediump\n#endif\n\n#if !defined(highp)\n#define highp\n#endif\n\n#endif",ai,si.vertexSource,ri.vertexSource,ni.vertexSource,n.vertexSource).join("\n"),m=a.createShader(a.FRAGMENT_SHADER);if(a.isContextLost())return void(this.failedToCreate=!0);a.shaderSource(m,p),a.compileShader(m),a.attachShader(this.program,m);const _=a.createShader(a.VERTEX_SHADER);if(a.isContextLost())this.failedToCreate=!0;else{a.shaderSource(_,f),a.compileShader(_),a.attachShader(this.program,_),this.attributes={},this.numAttributes=u.length;for(let e=0;e({u_dem:new e.Uniform1i(t),u_dem_prev:new e.Uniform1i(t),u_dem_unpack:new e.Uniform4f(t),u_dem_tl:new e.Uniform2f(t),u_dem_scale:new e.Uniform1f(t),u_dem_tl_prev:new e.Uniform2f(t),u_dem_scale_prev:new e.Uniform1f(t),u_dem_size:new e.Uniform1f(t),u_dem_lerp:new e.Uniform1f(t),u_exaggeration:new e.Uniform1f(t),u_depth:new e.Uniform1i(t),u_depth_size_inv:new e.Uniform2f(t),u_meter_to_dem:new e.Uniform1f(t),u_label_plane_matrix_inv:new e.UniformMatrix4f(t)}))(t)),s.includes("GLOBE")&&(this.globeUniforms=(t=>({u_tile_tl_up:new e.Uniform3f(t),u_tile_tr_up:new e.Uniform3f(t),u_tile_br_up:new e.Uniform3f(t),u_tile_bl_up:new e.Uniform3f(t),u_tile_up_scale:new e.Uniform1f(t)}))(t)),s.includes("FOG")&&(this.fogUniforms=(t=>({u_fog_matrix:new e.UniformMatrix4f(t),u_fog_range:new e.Uniform2f(t),u_fog_color:new e.Uniform4f(t),u_fog_horizon_blend:new e.Uniform1f(t),u_fog_temporal_offset:new e.Uniform1f(t),u_frustum_tl:new e.Uniform3f(t),u_frustum_tr:new e.Uniform3f(t),u_frustum_br:new e.Uniform3f(t),u_frustum_bl:new e.Uniform3f(t),u_globe_pos:new e.Uniform3f(t),u_globe_radius:new e.Uniform1f(t),u_globe_transition:new e.Uniform1f(t),u_is_globe:new e.Uniform1i(t),u_viewport:new e.Uniform2f(t)}))(t))}}setTerrainUniformValues(e,t){if(!this.terrainUniforms)return;const i=this.terrainUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e]&&i[e].set(this.program,e,t[e])}}setGlobeUniformValues(e,t){if(!this.globeUniforms)return;const i=this.globeUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e]&&i[e].set(this.program,e,t[e])}}setFogUniformValues(e,t){if(!this.fogUniforms)return;const i=this.fogUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e].set(this.program,e,t[e])}}draw(e,t,i,n,r,o,s,a,l,c,u,h,d,p,f){const m=e.gl;if(this.failedToCreate)return;e.program.set(this.program),e.setDepthMode(i),e.setStencilMode(n),e.setColorMode(r),e.setCullFace(o);for(const e of Object.keys(this.fixedUniforms))this.fixedUniforms[e].set(this.program,e,s[e]);p&&p.setUniforms(this.program,e,this.binderUniforms,h,{zoom:d});const _={[m.LINES]:2,[m.TRIANGLES]:3,[m.LINE_STRIP]:1}[t];for(const i of u.get()){const n=i.vaos||(i.vaos={});(n[a]||(n[a]=new di)).bind(e,this,l,p?p.getPaintVertexBuffers():[],c,i.vertexOffset,f||[]),m.drawElements(t,i.primitiveLength*_,m.UNSIGNED_SHORT,i.primitiveOffset*_*2)}}}function Li(e,t){const i=Math.pow(2,t.tileID.overscaledZ),n=t.tileSize*Math.pow(2,e.transform.tileZoom)/i,r=n*(t.tileID.canonical.x+t.tileID.wrap*i),o=n*t.tileID.canonical.y;return{u_image:0,u_texsize:t.imageAtlasTexture.size,u_tile_units_to_pixels:1/I(t,1,e.transform.tileZoom),u_pixel_coord_upper:[r>>16,o>>16],u_pixel_coord_lower:[65535&r,65535&o]}}const Di=e.create(),zi=(t,i,n,r,o,s,a,l,c,u,h)=>{const d=i.style.light,p=d.properties.get("position"),f=[p.x,p.y,p.z],m=e.create$1();"viewport"===d.properties.get("anchor")&&(e.fromRotation(m,-i.transform.angle),e.transformMat3(f,f,m));const _=d.properties.get("color"),g=i.transform,y={u_matrix:t,u_lightpos:f,u_lightintensity:d.properties.get("intensity"),u_lightcolor:[_.r,_.g,_.b],u_vertical_gradient:+n,u_opacity:r,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Di,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_ao:o,u_edge_radius:s};return"globe"===g.projection.name&&(y.u_tile_id=[a.canonical.x,a.canonical.y,1<{const p=zi(t,i,n,r,o,s,a,c,u,h,d),f={u_height_factor:-Math.pow(2,a.overscaledZ)/l.tileSize/8};return e.extend(p,Li(i,l),f)},Bi=e=>({u_matrix:e}),Ri=(t,i,n)=>e.extend(Bi(t),Li(i,n)),Fi=(e,t)=>({u_matrix:e,u_world:t}),Ui=(t,i,n,r)=>e.extend(Ri(t,i,n),{u_world:r}),ji=e.create(),Vi=(t,i,n,r,o,s)=>{const a=t.transform,l="globe"===a.projection.name;let c;if("map"===s.paint.get("circle-pitch-alignment"))if(l){const t=e.globePixelsToTileUnits(a.zoom,i.canonical)*a._pixelsPerMercatorPixel;c=Float32Array.from([t,0,0,t])}else c=a.calculatePixelsToTileUnitsMatrix(n);else c=new Float32Array([a.pixelsToGLUnits[0],0,0,a.pixelsToGLUnits[1]]);const u={u_camera_to_center_distance:a.cameraToCenterDistance,u_matrix:t.translatePosMatrix(i.projMatrix,n,s.paint.get("circle-translate"),s.paint.get("circle-translate-anchor")),u_device_pixel_ratio:e.exported.devicePixelRatio,u_extrude_scale:c,u_inv_rot_matrix:ji,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(l){u.u_inv_rot_matrix=r,u.u_merc_center=o,u.u_tile_id=[i.canonical.x,i.canonical.y,1<{const t=[];return"map"===e.paint.get("circle-pitch-alignment")&&t.push("PITCH_WITH_MAP"),"map"===e.paint.get("circle-pitch-scale")&&t.push("SCALE_WITH_MAP"),t},$i=(t,i,n,r)=>{const o=e.EXTENT/n.tileSize;return{u_matrix:t,u_camera_to_center_distance:i.getCameraToCenterDistance(r),u_extrude_scale:[i.pixelsToGLUnits[0]/o,i.pixelsToGLUnits[1]/o]}},qi=(e,t,i=1)=>({u_matrix:e,u_color:t,u_overlay:0,u_overlay_scale:i}),Gi=e.create(),Zi=(t,i,n,r,o,s,a)=>{const l=t.transform,c="globe"===l.projection.name,u=c?e.globePixelsToTileUnits(l.zoom,i.canonical)*l._pixelsPerMercatorPixel:I(n,1,s),h={u_matrix:i.projMatrix,u_extrude_scale:u,u_intensity:a,u_inv_rot_matrix:Gi,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(c){h.u_inv_rot_matrix=r,h.u_merc_center=o,h.u_tile_id=[i.canonical.x,i.canonical.y,1<{const a=e.transform,l=a.calculatePixelsToTileUnitsMatrix(t);return{u_matrix:Ki(e,t,i,n),u_pixels_to_tile_units:l,u_device_pixel_ratio:o,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:r,u_texsize:Ji(i)?t.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:Xi(t,e.transform),u_alpha_discard_threshold:0,u_trim_offset:s}},Hi=(e,t,i,n,r)=>{const o=e.transform;return{u_matrix:Ki(e,t,i,n),u_texsize:t.imageAtlasTexture.size,u_pixels_to_tile_units:o.calculatePixelsToTileUnitsMatrix(t),u_device_pixel_ratio:r,u_image:0,u_tile_units_to_pixels:Xi(t,o),u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]],u_alpha_discard_threshold:0}};function Xi(e,t){return 1/I(e,1,t.tileZoom)}function Ki(e,t,i,n){return e.translatePosMatrix(n||t.tileID.projMatrix,t,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}function Ji(e){const t=e.paint.get("line-dasharray").value;return t.value||"constant"!==t.kind}const Yi=(e,t,i,n,r,o)=>{return{u_matrix:e,u_tl_parent:t,u_scale_parent:i,u_fade_t:n.mix,u_opacity:n.opacity*r.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:r.paint.get("raster-brightness-min"),u_brightness_high:r.paint.get("raster-brightness-max"),u_saturation_factor:(a=r.paint.get("raster-saturation"),a>0?1-1/(1.001-a):-a),u_contrast_factor:(s=r.paint.get("raster-contrast"),s>0?1/(1-s):1+s),u_spin_weights:Qi(r.paint.get("raster-hue-rotate")),u_perspective_transform:o};var s,a};function Qi(e){e*=Math.PI/180;const t=Math.sin(e),i=Math.cos(e);return[(2*i+1)/3,(-Math.sqrt(3)*t-i+1)/3,(Math.sqrt(3)*t-i+1)/3]}const en=e.create(),tn=(t,i,n,r,o,s,a,l,c,u,h,d,p,f,m,_)=>{const g=o.transform,y={u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:i?i.uSizeT:0,u_size:i?i.uSize:0,u_camera_to_center_distance:g.cameraToCenterDistance,u_rotate_symbol:+n,u_aspect_ratio:g.width/g.height,u_fade_change:o.options.fadeDuration?o.symbolFadeChange:1,u_matrix:s,u_label_plane_matrix:a,u_coord_matrix:l,u_is_text:+c,u_pitch_with_map:+r,u_texsize:u,u_texture:0,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:en,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:en,u_up_vector:[0,-1,0]};return"globe"===_.name&&(y.u_tile_id=[h.canonical.x,h.canonical.y,1<e.extend(tn(t,i,n,r,o,s,a,l,c,u,d,p,f,m,_,g),{u_gamma_scale:r?o.transform.cameraToCenterDistance*Math.cos(o.terrain?0:o.transform._pitch):1,u_device_pixel_ratio:e.exported.devicePixelRatio,u_is_halo:+h}),rn=(t,i,n,r,o,s,a,l,c,u,h,d,p,f,m,_)=>e.extend(nn(t,i,n,r,o,s,a,l,!0,c,!0,h,d,p,f,m,_),{u_texsize_icon:u,u_texture_icon:1}),on=(e,t,i)=>({u_matrix:e,u_opacity:t,u_color:i}),sn=(t,i,n,r,o)=>e.extend(function(e,t,i){const n=t.imageManager.getPattern(e.toString()),{width:r,height:o}=t.imageManager.getPixelSize(),s=Math.pow(2,i.tileID.overscaledZ),a=i.tileSize*Math.pow(2,t.transform.tileZoom)/s,l=a*(i.tileID.canonical.x+i.tileID.wrap*s),c=a*i.tileID.canonical.y;return{u_image:0,u_pattern_tl:n.tl,u_pattern_br:n.br,u_texsize:[r,o],u_pattern_size:n.displaySize,u_tile_units_to_pixels:1/I(i,1,t.transform.tileZoom),u_pixel_coord_upper:[l>>16,c>>16],u_pixel_coord_lower:[65535&l,65535&c]}}(r,n,o),{u_matrix:t,u_opacity:i}),an={fillExtrusion:t=>({u_matrix:new e.UniformMatrix4f(t),u_lightpos:new e.Uniform3f(t),u_lightintensity:new e.Uniform1f(t),u_lightcolor:new e.Uniform3f(t),u_vertical_gradient:new e.Uniform1f(t),u_opacity:new e.Uniform1f(t),u_edge_radius:new e.Uniform1f(t),u_ao:new e.Uniform2f(t),u_tile_id:new e.Uniform3f(t),u_zoom_transition:new e.Uniform1f(t),u_inv_rot_matrix:new e.UniformMatrix4f(t),u_merc_center:new e.Uniform2f(t),u_up_dir:new e.Uniform3f(t),u_height_lift:new e.Uniform1f(t)}),fillExtrusionPattern:t=>({u_matrix:new e.UniformMatrix4f(t),u_lightpos:new e.Uniform3f(t),u_lightintensity:new e.Uniform1f(t),u_lightcolor:new e.Uniform3f(t),u_vertical_gradient:new e.Uniform1f(t),u_height_factor:new e.Uniform1f(t),u_edge_radius:new e.Uniform1f(t),u_ao:new e.Uniform2f(t),u_tile_id:new e.Uniform3f(t),u_zoom_transition:new e.Uniform1f(t),u_inv_rot_matrix:new e.UniformMatrix4f(t),u_merc_center:new e.Uniform2f(t),u_up_dir:new e.Uniform3f(t),u_height_lift:new e.Uniform1f(t),u_image:new e.Uniform1i(t),u_texsize:new e.Uniform2f(t),u_pixel_coord_upper:new e.Uniform2f(t),u_pixel_coord_lower:new e.Uniform2f(t),u_tile_units_to_pixels:new e.Uniform1f(t),u_opacity:new e.Uniform1f(t)}),fill:t=>({u_matrix:new e.UniformMatrix4f(t)}),fillPattern:t=>({u_matrix:new e.UniformMatrix4f(t),u_image:new e.Uniform1i(t),u_texsize:new e.Uniform2f(t),u_pixel_coord_upper:new e.Uniform2f(t),u_pixel_coord_lower:new e.Uniform2f(t),u_tile_units_to_pixels:new e.Uniform1f(t)}),fillOutline:t=>({u_matrix:new e.UniformMatrix4f(t),u_world:new e.Uniform2f(t)}),fillOutlinePattern:t=>({u_matrix:new e.UniformMatrix4f(t),u_world:new e.Uniform2f(t),u_image:new e.Uniform1i(t),u_texsize:new e.Uniform2f(t),u_pixel_coord_upper:new e.Uniform2f(t),u_pixel_coord_lower:new e.Uniform2f(t),u_tile_units_to_pixels:new e.Uniform1f(t)}),circle:t=>({u_camera_to_center_distance:new e.Uniform1f(t),u_extrude_scale:new e.UniformMatrix2f(t),u_device_pixel_ratio:new e.Uniform1f(t),u_matrix:new e.UniformMatrix4f(t),u_inv_rot_matrix:new e.UniformMatrix4f(t),u_merc_center:new e.Uniform2f(t),u_tile_id:new e.Uniform3f(t),u_zoom_transition:new e.Uniform1f(t),u_up_dir:new e.Uniform3f(t)}),collisionBox:t=>({u_matrix:new e.UniformMatrix4f(t),u_camera_to_center_distance:new e.Uniform1f(t),u_extrude_scale:new e.Uniform2f(t)}),collisionCircle:t=>({u_matrix:new e.UniformMatrix4f(t),u_inv_matrix:new e.UniformMatrix4f(t),u_camera_to_center_distance:new e.Uniform1f(t),u_viewport_size:new e.Uniform2f(t)}),debug:t=>({u_color:new e.UniformColor(t),u_matrix:new e.UniformMatrix4f(t),u_overlay:new e.Uniform1i(t),u_overlay_scale:new e.Uniform1f(t)}),clippingMask:t=>({u_matrix:new e.UniformMatrix4f(t)}),heatmap:t=>({u_extrude_scale:new e.Uniform1f(t),u_intensity:new e.Uniform1f(t),u_matrix:new e.UniformMatrix4f(t),u_inv_rot_matrix:new e.UniformMatrix4f(t),u_merc_center:new e.Uniform2f(t),u_tile_id:new e.Uniform3f(t),u_zoom_transition:new e.Uniform1f(t),u_up_dir:new e.Uniform3f(t)}),heatmapTexture:t=>({u_image:new e.Uniform1i(t),u_color_ramp:new e.Uniform1i(t),u_opacity:new e.Uniform1f(t)}),hillshade:t=>({u_matrix:new e.UniformMatrix4f(t),u_image:new e.Uniform1i(t),u_latrange:new e.Uniform2f(t),u_light:new e.Uniform2f(t),u_shadow:new e.UniformColor(t),u_highlight:new e.UniformColor(t),u_accent:new e.UniformColor(t)}),hillshadePrepare:t=>({u_matrix:new e.UniformMatrix4f(t),u_image:new e.Uniform1i(t),u_dimension:new e.Uniform2f(t),u_zoom:new e.Uniform1f(t),u_unpack:new e.Uniform4f(t)}),line:t=>({u_matrix:new e.UniformMatrix4f(t),u_pixels_to_tile_units:new e.UniformMatrix2f(t),u_device_pixel_ratio:new e.Uniform1f(t),u_units_to_pixels:new e.Uniform2f(t),u_dash_image:new e.Uniform1i(t),u_gradient_image:new e.Uniform1i(t),u_image_height:new e.Uniform1f(t),u_texsize:new e.Uniform2f(t),u_tile_units_to_pixels:new e.Uniform1f(t),u_alpha_discard_threshold:new e.Uniform1f(t),u_trim_offset:new e.Uniform2f(t)}),linePattern:t=>({u_matrix:new e.UniformMatrix4f(t),u_texsize:new e.Uniform2f(t),u_pixels_to_tile_units:new e.UniformMatrix2f(t),u_device_pixel_ratio:new e.Uniform1f(t),u_image:new e.Uniform1i(t),u_units_to_pixels:new e.Uniform2f(t),u_tile_units_to_pixels:new e.Uniform1f(t),u_alpha_discard_threshold:new e.Uniform1f(t)}),raster:t=>({u_matrix:new e.UniformMatrix4f(t),u_tl_parent:new e.Uniform2f(t),u_scale_parent:new e.Uniform1f(t),u_fade_t:new e.Uniform1f(t),u_opacity:new e.Uniform1f(t),u_image0:new e.Uniform1i(t),u_image1:new e.Uniform1i(t),u_brightness_low:new e.Uniform1f(t),u_brightness_high:new e.Uniform1f(t),u_saturation_factor:new e.Uniform1f(t),u_contrast_factor:new e.Uniform1f(t),u_spin_weights:new e.Uniform3f(t),u_perspective_transform:new e.Uniform2f(t)}),symbolIcon:t=>({u_is_size_zoom_constant:new e.Uniform1i(t),u_is_size_feature_constant:new e.Uniform1i(t),u_size_t:new e.Uniform1f(t),u_size:new e.Uniform1f(t),u_camera_to_center_distance:new e.Uniform1f(t),u_rotate_symbol:new e.Uniform1i(t),u_aspect_ratio:new e.Uniform1f(t),u_fade_change:new e.Uniform1f(t),u_matrix:new e.UniformMatrix4f(t),u_label_plane_matrix:new e.UniformMatrix4f(t),u_coord_matrix:new e.UniformMatrix4f(t),u_is_text:new e.Uniform1i(t),u_pitch_with_map:new e.Uniform1i(t),u_texsize:new e.Uniform2f(t),u_tile_id:new e.Uniform3f(t),u_zoom_transition:new e.Uniform1f(t),u_inv_rot_matrix:new e.UniformMatrix4f(t),u_merc_center:new e.Uniform2f(t),u_camera_forward:new e.Uniform3f(t),u_tile_matrix:new e.UniformMatrix4f(t),u_up_vector:new e.Uniform3f(t),u_ecef_origin:new e.Uniform3f(t),u_texture:new e.Uniform1i(t)}),symbolSDF:t=>({u_is_size_zoom_constant:new e.Uniform1i(t),u_is_size_feature_constant:new e.Uniform1i(t),u_size_t:new e.Uniform1f(t),u_size:new e.Uniform1f(t),u_camera_to_center_distance:new e.Uniform1f(t),u_rotate_symbol:new e.Uniform1i(t),u_aspect_ratio:new e.Uniform1f(t),u_fade_change:new e.Uniform1f(t),u_matrix:new e.UniformMatrix4f(t),u_label_plane_matrix:new e.UniformMatrix4f(t),u_coord_matrix:new e.UniformMatrix4f(t),u_is_text:new e.Uniform1i(t),u_pitch_with_map:new e.Uniform1i(t),u_texsize:new e.Uniform2f(t),u_texture:new e.Uniform1i(t),u_gamma_scale:new e.Uniform1f(t),u_device_pixel_ratio:new e.Uniform1f(t),u_tile_id:new e.Uniform3f(t),u_zoom_transition:new e.Uniform1f(t),u_inv_rot_matrix:new e.UniformMatrix4f(t),u_merc_center:new e.Uniform2f(t),u_camera_forward:new e.Uniform3f(t),u_tile_matrix:new e.UniformMatrix4f(t),u_up_vector:new e.Uniform3f(t),u_ecef_origin:new e.Uniform3f(t),u_is_halo:new e.Uniform1i(t)}),symbolTextAndIcon:t=>({u_is_size_zoom_constant:new e.Uniform1i(t),u_is_size_feature_constant:new e.Uniform1i(t),u_size_t:new e.Uniform1f(t),u_size:new e.Uniform1f(t),u_camera_to_center_distance:new e.Uniform1f(t),u_rotate_symbol:new e.Uniform1i(t),u_aspect_ratio:new e.Uniform1f(t),u_fade_change:new e.Uniform1f(t),u_matrix:new e.UniformMatrix4f(t),u_label_plane_matrix:new e.UniformMatrix4f(t),u_coord_matrix:new e.UniformMatrix4f(t),u_is_text:new e.Uniform1i(t),u_pitch_with_map:new e.Uniform1i(t),u_texsize:new e.Uniform2f(t),u_texsize_icon:new e.Uniform2f(t),u_texture:new e.Uniform1i(t),u_texture_icon:new e.Uniform1i(t),u_gamma_scale:new e.Uniform1f(t),u_device_pixel_ratio:new e.Uniform1f(t),u_is_halo:new e.Uniform1i(t)}),background:t=>({u_matrix:new e.UniformMatrix4f(t),u_opacity:new e.Uniform1f(t),u_color:new e.UniformColor(t)}),backgroundPattern:t=>({u_matrix:new e.UniformMatrix4f(t),u_opacity:new e.Uniform1f(t),u_image:new e.Uniform1i(t),u_pattern_tl:new e.Uniform2f(t),u_pattern_br:new e.Uniform2f(t),u_texsize:new e.Uniform2f(t),u_pattern_size:new e.Uniform2f(t),u_pixel_coord_upper:new e.Uniform2f(t),u_pixel_coord_lower:new e.Uniform2f(t),u_tile_units_to_pixels:new e.Uniform1f(t)}),terrainRaster:gi,terrainDepth:gi,skybox:t=>({u_matrix:new e.UniformMatrix4f(t),u_sun_direction:new e.Uniform3f(t),u_cubemap:new e.Uniform1i(t),u_opacity:new e.Uniform1f(t),u_temporal_offset:new e.Uniform1f(t)}),skyboxGradient:t=>({u_matrix:new e.UniformMatrix4f(t),u_color_ramp:new e.Uniform1i(t),u_center_direction:new e.Uniform3f(t),u_radius:new e.Uniform1f(t),u_opacity:new e.Uniform1f(t),u_temporal_offset:new e.Uniform1f(t)}),skyboxCapture:t=>({u_matrix_3f:new e.UniformMatrix3f(t),u_sun_direction:new e.Uniform3f(t),u_sun_intensity:new e.Uniform1f(t),u_color_tint_r:new e.Uniform4f(t),u_color_tint_m:new e.Uniform4f(t),u_luminance:new e.Uniform1f(t)}),globeRaster:t=>({u_proj_matrix:new e.UniformMatrix4f(t),u_globe_matrix:new e.UniformMatrix4f(t),u_normalize_matrix:new e.UniformMatrix4f(t),u_merc_matrix:new e.UniformMatrix4f(t),u_zoom_transition:new e.Uniform1f(t),u_merc_center:new e.Uniform2f(t),u_image0:new e.Uniform1i(t),u_grid_matrix:new e.UniformMatrix3f(t),u_skirt_height:new e.Uniform1f(t),u_frustum_tl:new e.Uniform3f(t),u_frustum_tr:new e.Uniform3f(t),u_frustum_br:new e.Uniform3f(t),u_frustum_bl:new e.Uniform3f(t),u_globe_pos:new e.Uniform3f(t),u_globe_radius:new e.Uniform1f(t),u_viewport:new e.Uniform2f(t)}),globeAtmosphere:t=>({u_frustum_tl:new e.Uniform3f(t),u_frustum_tr:new e.Uniform3f(t),u_frustum_br:new e.Uniform3f(t),u_frustum_bl:new e.Uniform3f(t),u_horizon:new e.Uniform1f(t),u_transition:new e.Uniform1f(t),u_fadeout_range:new e.Uniform1f(t),u_color:new e.Uniform4f(t),u_high_color:new e.Uniform4f(t),u_space_color:new e.Uniform4f(t),u_star_intensity:new e.Uniform1f(t),u_star_density:new e.Uniform1f(t),u_star_size:new e.Uniform1f(t),u_temporal_offset:new e.Uniform1f(t),u_horizon_angle:new e.Uniform1f(t),u_rotation_matrix:new e.UniformMatrix4f(t)})};let ln;function cn(t,i,n,r,o,s,a){const l=t.context,c=l.gl,u=t.transform,h=t.useProgram("collisionBox"),d=[];let p=0,f=0;for(let m=0;m0){const t=e.create(),i=v;e.mul(t,y.placementInvProjMatrix,u.glCoordMatrix),e.mul(t,t,y.placementViewportMatrix),d.push({circleArray:w,circleOffset:f,transform:i,invTransform:t,projection:y.getProjection()}),p+=w.length/4,f=p}x&&(t.terrain&&t.terrain.setupElevationDraw(g,h),h.draw(l,c.LINES,e.DepthMode.disabled,e.StencilMode.disabled,t.colorModeForRenderPass(),e.CullFaceMode.disabled,$i(v,u,g,y.getProjection()),n.id,x.layoutVertexBuffer,x.indexBuffer,x.segments,null,u.zoom,null,[x.collisionVertexBuffer,x.collisionVertexBufferExt]))}if(!a||!d.length)return;const m=t.useProgram("collisionCircle"),_=new e.StructArrayLayout2f1f2i16;_.resize(4*p),_._trim();let g=0;for(const e of d)for(let t=0;t=0&&(m[v.associatedIconIndex]={x:k,y:C,z:S,angle:L})}else pt(E,p)}if(h){f.clear();const i=t.icon.placedSymbolArray;for(let t=0;te.sortKey-t.sortKey));for(const e of C){const i=e.state;if(t.terrain&&t.terrain.setupElevationDraw(i.tile,i.program,{useDepthForOcclusion:!k,labelPlaneMatrixInv:i.labelPlaneMatrixInv}),p.activeTexture.set(f.TEXTURE0),i.atlasTexture.bind(i.atlasInterpolation,f.CLAMP_TO_EDGE),i.atlasTextureIcon&&(p.activeTexture.set(f.TEXTURE1),i.atlasTextureIcon&&i.atlasTextureIcon.bind(i.atlasInterpolationIcon,f.CLAMP_TO_EDGE)),i.isSDF){const r=i.uniformValues;i.hasHalo&&(r.u_is_halo=1,mn(i.buffers,e.segments,n,t,i.program,w,h,d,r)),r.u_is_halo=0}mn(i.buffers,e.segments,n,t,i.program,w,h,d,i.uniformValues)}}function mn(t,i,n,r,o,s,a,l,c){const u=r.context,h=[t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer,t.globeExtVertexBuffer];o.draw(u,u.gl.TRIANGLES,s,a,l,e.CullFaceMode.disabled,c,n.id,t.layoutVertexBuffer,t.indexBuffer,i,n.paint,r.transform.zoom,t.programConfigurations.get(n.id),h)}function _n(t,i,n,r,o,s,a){const l=t.context.gl,c=n.paint.get("fill-pattern"),u=c&&c.constantOr(1);let h,d,p,f,m;a?(d=u&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",h=l.LINES):(d=u?"fillPattern":"fill",h=l.TRIANGLES);for(const _ of r){const r=i.getTile(_);if(u&&!r.patternsLoaded())continue;const g=r.getBucket(n);if(!g)continue;t.prepareDrawTile();const y=g.programConfigurations.get(n.id),b=t.useProgram(d,y);u&&(t.context.activeTexture.set(l.TEXTURE0),r.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),y.updatePaintBuffers());const v=c.constantOr(null);if(v&&r.imageAtlas){const e=r.imageAtlas.patternPositions[v.toString()];e&&y.setConstantPatternPositions(e)}const x=t.translatePosMatrix(_.projMatrix,r,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(a){f=g.indexBuffer2,m=g.segments2;const e=t.terrain&&t.terrain.renderingToTexture?t.terrain.drapeBufferSize:[l.drawingBufferWidth,l.drawingBufferHeight];p="fillOutlinePattern"===d&&u?Ui(x,t,r,e):Fi(x,e)}else f=g.indexBuffer,m=g.segments,p=u?Ri(x,t,r):Bi(x);t.prepareDrawProgram(t.context,b,_.toUnwrapped()),b.draw(t.context,h,o,t.stencilModeForClipping(_),s,e.CullFaceMode.disabled,p,n.id,g.layoutVertexBuffer,f,m,n.paint,t.transform.zoom,y)}}function gn(t,i,n,r,o,s,a){const l=t.context,c=l.gl,u=t.transform,h=n.paint.get("fill-extrusion-pattern"),d=h.constantOr(1),p=n.paint.get("fill-extrusion-opacity"),f=[n.paint.get("fill-extrusion-ambient-occlusion-intensity"),n.paint.get("fill-extrusion-ambient-occlusion-radius")],m=n.layout.get("fill-extrusion-edge-radius"),_=m>0&&!n.paint.get("fill-extrusion-rounded-roof"),g=_?0:m,y="globe"===u.projection.name?e.fillExtrusionHeightLift():0,b="globe"===u.projection.name,v=b?e.globeToMercatorTransition(u.zoom):0,x=[e.mercatorXfromLng(u.center.lng),e.mercatorYfromLat(u.center.lat)],w=[];b&&w.push("PROJECTION_GLOBE_VIEW"),f[0]>0&&w.push("FAUX_AO"),_&&w.push("ZERO_ROOF_RADIUS");for(const m of r){const r=i.getTile(m),_=r.getBucket(n);if(!_||_.projection.name!==u.projection.name)continue;const E=_.programConfigurations.get(n.id),T=t.useProgram(d?"fillExtrusionPattern":"fillExtrusion",E,w);if(t.terrain){const e=t.terrain;if(t.style.terrainSetForDrapingOnly())e.setupElevationDraw(r,T,{useMeterToDem:!0});else{if(!_.enableTerrain)continue;if(e.setupElevationDraw(r,T,{useMeterToDem:!0}),yn(l,i,m,_,n,e),!_.centroidVertexBuffer){const e=T.attributes.a_centroid_pos;void 0!==e&&c.vertexAttrib2f(e,0,0)}}}d&&(t.context.activeTexture.set(c.TEXTURE0),r.imageAtlasTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),E.updatePaintBuffers());const k=h.constantOr(null);if(k&&r.imageAtlas){const e=r.imageAtlas.patternPositions[k.toString()];e&&E.setConstantPatternPositions(e)}const C=t.translatePosMatrix(m.projMatrix,r,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),S=u.projection.createInversionMatrix(u,m.canonical),M=n.paint.get("fill-extrusion-vertical-gradient"),A=d?Oi(C,t,M,p,f,g,m,r,y,v,x,S):zi(C,t,M,p,f,g,m,y,v,x,S);t.prepareDrawProgram(l,T,m.toUnwrapped());const I=[];t.terrain&&I.push(_.centroidVertexBuffer),b&&I.push(_.layoutVertexExtBuffer),T.draw(l,l.gl.TRIANGLES,o,s,a,e.CullFaceMode.backCCW,A,n.id,_.layoutVertexBuffer,_.indexBuffer,_.segments,n.paint,t.transform.zoom,E,I)}}function yn(t,i,n,r,o,s){const a=[t=>{let i=t.canonical.x-1,n=t.wrap;return i<0&&(i=(1<{let i=t.canonical.x+1,n=t.wrap;return i===1<new e.OverscaledTileID(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,(0===t.canonical.y?1<new e.OverscaledTileID(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y===(1<{const t=i.getSource().minzoom,n=e=>{const t=i.getTileByID(e);if(t&&t.hasData())return t.getBucket(o)},r=[0,-1,1];for(const i of r){if(e.overscaledZ+i(c[0]=Math.min(t.min.y,i.min.y),c[1]=Math.max(t.max.y,i.max.y),c[2]=e.EXTENT-i.min.x>t.max.x?i.min.x-e.EXTENT:t.max.x,c),h=(t,i)=>(c[0]=Math.min(t.min.x,i.min.x),c[1]=Math.max(t.max.x,i.max.x),c[2]=e.EXTENT-i.min.y>t.max.y?i.min.y-e.EXTENT:t.max.y,c),d=[(e,t)=>u(e,t),(e,t)=>u(t,e),(e,t)=>h(e,t),(e,t)=>h(t,e)],p=new e.Point(0,0);let f,m,_;const g=(t,i,r,o,a)=>{const l=[[o?r:t,o?t:r,0],[o?r:i,o?i:r,0]],c=a<0?e.EXTENT+a:a,u=[o?c:(t+i)/2,o?(t+i)/2:c,0];return 0===r&&a<0||0!==r&&a>0?s.getForTilePoints(_,[u],!0,m):l.push(u),s.getForTilePoints(n,l,!0,f),Math.max(l[0][2],l[1][2],u[2])/s.exaggeration()};for(let t=0;t<4;t++){const i=(t<2?1:5)-t,o=r.borders[t];if(0===o.length)continue;const c=_=a[t](n),u=l(c);if(!(u&&u instanceof e.FillExtrusionBucket&&u.enableTerrain))continue;if(r.borderDoneWithNeighborZ[t]===u.canonical.z&&u.borderDoneWithNeighborZ[i]===r.canonical.z)continue;if(m=s.findDEMTileFor(c),!m||!m.dem)continue;if(!f){const e=s.findDEMTileFor(n);if(!e||!e.dem)return;f=e}const h=u.borders[i];let y=0;const b=u.borderDoneWithNeighborZ[i]!==r.canonical.z;if(r.canonical.z===u.canonical.z){for(let n=0;na[0]+3));)b&&u.encodeCentroid(void 0,l,!1),y++;if(l&&ya[1]-3)&&(o++,++y!==h.length);)l=u.featuresOnBorder[h[y]];if(l=u.featuresOnBorder[h[n]],s.intersectsCount()>1||l.intersectsCount()>1||1!==o){1!==o&&(y=n),r.encodeCentroid(void 0,s,!1),b&&u.encodeCentroid(void 0,l,!1);continue}const c=d[t](s,l),f=t%2?e.EXTENT-1:0;p.x=g(c[0],Math.min(e.EXTENT-1,c[1]),f,t<2,c[2]),p.y=0,r.encodeCentroid(p,s,!1),b&&u.encodeCentroid(p,l,!1)}else r.encodeCentroid(void 0,s,!1)}r.borderDoneWithNeighborZ[t]=u.canonical.z,r.needsCentroidUpdate=!0,b&&(u.borderDoneWithNeighborZ[i]=r.canonical.z,u.needsCentroidUpdate=!0)}else{for(const e of o)r.encodeCentroid(void 0,r.featuresOnBorder[e],!1);if(b){for(const e of h)u.encodeCentroid(void 0,u.featuresOnBorder[e],!1);u.borderDoneWithNeighborZ[i]=r.canonical.z,u.needsCentroidUpdate=!0}r.borderDoneWithNeighborZ[t]=u.canonical.z,r.needsCentroidUpdate=!0}}(r.needsCentroidUpdate||!r.centroidVertexBuffer&&0!==r.centroidVertexArray.length)&&r.uploadCentroid(t)}const bn=new e.Color(1,0,0,1),vn=new e.Color(0,1,0,1),xn=new e.Color(0,0,1,1),wn=new e.Color(1,0,1,1),En=new e.Color(0,1,1,1);function Tn(t,i,n){const r=t.context,o=t.transform,s=r.gl,a="globe"===o.projection.name,l=a?["PROJECTION_GLOBE_VIEW"]:null;let c=n.projMatrix;if(a&&e.globeToMercatorTransition(o.zoom)>0){const t=e.transitionTileAABBinECEF(n.canonical,o),i=e.globeDenormalizeECEF(t);c=e.multiply(new Float32Array(16),o.globeMatrix,i),e.multiply(c,o.projMatrix,c)}const u=t.useProgram("debug",null,l),h=i.getTileByID(n.key);t.terrain&&t.terrain.setupElevationDraw(h,u);const d=e.DepthMode.disabled,p=e.StencilMode.disabled,f=t.colorModeForRenderPass(),m="$debug";r.activeTexture.set(s.TEXTURE0),t.emptyTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE),a?h._makeGlobeTileDebugBuffers(t.context,o):h._makeDebugTileBoundsBuffers(t.context,o.projection);const _=h._tileDebugBuffer||t.debugBuffer,g=h._tileDebugIndexBuffer||t.debugIndexBuffer,y=h._tileDebugSegments||t.debugSegments;u.draw(r,s.LINE_STRIP,d,p,f,e.CullFaceMode.disabled,qi(c,e.Color.red),m,_,g,y,null,null,null,[h._globeTileDebugBorderBuffer]);const b=h.latestRawTileData,v=Math.floor((b&&b.byteLength||0)/1024),x=i.getTile(n).tileSize,w=512/Math.min(x,512)*(n.overscaledZ/o.zoom)*.5;let E=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(E+=` => ${n.overscaledZ}`),E+=` ${v}kb`,function(e,t){e.initDebugOverlayCanvas();const i=e.debugOverlayCanvas,n=e.context.gl,r=e.debugOverlayCanvas.getContext("2d");r.clearRect(0,0,i.width,i.height),r.shadowColor="white",r.shadowBlur=2,r.lineWidth=1.5,r.strokeStyle="white",r.textBaseline="top",r.font="bold 36px Open Sans, sans-serif",r.fillText(t,5,5),r.strokeText(t,5,5),e.debugOverlayTexture.update(i),e.debugOverlayTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}(t,E);const T=h._tileDebugTextBuffer||t.debugBuffer,k=h._tileDebugTextIndexBuffer||t.quadTriangleIndexBuffer,C=h._tileDebugTextSegments||t.debugSegments;u.draw(r,s.TRIANGLES,d,p,e.ColorMode.alphaBlended,e.CullFaceMode.disabled,qi(c,e.Color.transparent,w),m,T,k,C,null,null,null,[h._globeTileDebugTextBuffer])}function kn(e,t,i,n){Sn(e,0,t+i/2,e.transform.width,i,n)}function Cn(e,t,i,n){Sn(e,t-i/2,0,i,e.transform.height,n)}function Sn(t,i,n,r,o,s){const a=t.context,l=a.gl;l.enable(l.SCISSOR_TEST),l.scissor(i*e.exported.devicePixelRatio,n*e.exported.devicePixelRatio,r*e.exported.devicePixelRatio,o*e.exported.devicePixelRatio),a.clear({color:s}),l.disable(l.SCISSOR_TEST)}const Mn=e.createLayout([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:An}=Mn;function In(e,t,i,n){e.emplaceBack(t,i,n)}class Pn{constructor(t){this.vertexArray=new e.StructArrayLayout3f12,this.indices=new e.StructArrayLayout3ui6,In(this.vertexArray,-1,-1,1),In(this.vertexArray,1,-1,1),In(this.vertexArray,-1,1,1),In(this.vertexArray,1,1,1),In(this.vertexArray,-1,-1,-1),In(this.vertexArray,1,-1,-1),In(this.vertexArray,-1,1,-1),In(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,An),this.indexBuffer=t.createIndexBuffer(this.indices),this.segment=e.SegmentVector.simpleSegment(0,0,36,12)}}function Ln(t,i,n,r,o,s){const a=t.gl,l=i.paint.get("sky-atmosphere-color"),c=i.paint.get("sky-atmosphere-halo-color"),u=i.paint.get("sky-atmosphere-sun-intensity"),h=((e,t,i,n,r)=>({u_matrix_3f:e,u_sun_direction:t,u_sun_intensity:i,u_color_tint_r:[n.r,n.g,n.b,n.a],u_color_tint_m:[r.r,r.g,r.b,r.a],u_luminance:5e-5}))(e.fromMat4(e.create$1(),r),o,u,l,c);a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_CUBE_MAP_POSITIVE_X+s,i.skyboxTexture,0),n.draw(t,a.TRIANGLES,e.DepthMode.disabled,e.StencilMode.disabled,e.ColorMode.unblended,e.CullFaceMode.frontCW,h,"skyboxCapture",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}const Dn=e.createLayout([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class zn{constructor(t){const i=new e.StructArrayLayout5f20;i.emplaceBack(-1,1,1,0,0),i.emplaceBack(1,1,1,1,0),i.emplaceBack(1,-1,1,1,1),i.emplaceBack(-1,-1,1,0,1);const n=new e.StructArrayLayout3ui6;n.emplaceBack(0,1,2),n.emplaceBack(2,3,0),this.vertexBuffer=t.createVertexBuffer(i,Dn.members),this.indexBuffer=t.createIndexBuffer(n),this.segments=e.SegmentVector.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const On={symbol:function(t,i,n,r,o){if("translucent"!==t.renderPass)return;const s=e.StencilMode.disabled,a=t.colorModeForRenderPass();n.layout.get("text-variable-anchor")&&function(t,i,n,r,o,s,a){const l=i.transform,c="map"===o,u="map"===s;for(const i of t){const t=r.getTile(i),o=t.getBucket(n);if(!o||!o.text||!o.text.segments.get().length)continue;const s=e.evaluateSizeForZoom(o.textSizeData,l.zoom),h=bt(i,o.getProjection(),l),d=l.calculatePixelsToTileUnitsMatrix(t),p=et(h,t.tileID.canonical,u,c,l,o.getProjection(),d),f="none"!==n.layout.get("icon-text-fit")&&o.hasIconData();if(s){const n=Math.pow(2,l.zoom-t.tileID.overscaledZ);dn(o,c,u,a,e.symbolSize,l,p,i,n,s,f)}}}(r,t,n,i,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),o),0!==n.paint.get("icon-opacity").constantOr(1)&&fn(t,i,n,r,!1,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),n.layout.get("icon-rotation-alignment"),n.layout.get("icon-pitch-alignment"),n.layout.get("icon-keep-upright"),s,a),0!==n.paint.get("text-opacity").constantOr(1)&&fn(t,i,n,r,!0,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),n.layout.get("text-keep-upright"),s,a),i.map.showCollisionBoxes&&(cn(t,i,n,r,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),cn(t,i,n,r,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))},circle:function(t,i,n,r){if("translucent"!==t.renderPass)return;const o=n.paint.get("circle-opacity"),s=n.paint.get("circle-stroke-width"),a=n.paint.get("circle-stroke-opacity"),l=void 0!==n.layout.get("circle-sort-key").constantOr(1);if(0===o.constantOr(1)&&(0===s.constantOr(1)||0===a.constantOr(1)))return;const c=t.context,u=c.gl,h=t.transform,d=t.depthModeForSublayer(0,e.DepthMode.ReadOnly),p=e.StencilMode.disabled,f=t.colorModeForRenderPass(),m="globe"===h.projection.name,_=[e.mercatorXfromLng(h.center.lng),e.mercatorYfromLat(h.center.lat)],g=[];for(let o=0;oe.sortKey-t.sortKey));const y={useDepthForOcclusion:!m};for(const i of g){const{programConfiguration:r,program:o,layoutVertexBuffer:s,globeExtVertexBuffer:a,indexBuffer:l,uniformValues:m,tile:_}=i.state,g=i.segments;t.terrain&&t.terrain.setupElevationDraw(_,o,y),t.prepareDrawProgram(c,o,_.tileID.toUnwrapped()),o.draw(c,u.TRIANGLES,d,p,f,e.CullFaceMode.disabled,m,n.id,s,l,g,n.paint,h.zoom,r,[a])}},heatmap:function(t,i,n,r){if(0!==n.paint.get("heatmap-opacity"))if("offscreen"===t.renderPass){const o=t.context,s=o.gl,a=e.StencilMode.disabled,l=new e.ColorMode([s.ONE,s.ONE],e.Color.transparent,[!0,!0,!0,!0]);!function(e,t,i,n){const r=e.gl,o=t.width*n,s=t.height*n;e.activeTexture.set(r.TEXTURE1),e.viewport.set([0,0,o,s]);let a=i.heatmapFbo;if(!a||a&&(a.width!==o||a.height!==s)){a&&a.destroy();const t=r.createTexture();r.bindTexture(r.TEXTURE_2D,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),a=i.heatmapFbo=e.createFramebuffer(o,s,!1),function(e,t,i,n,r,o){const s=e.gl;s.texImage2D(s.TEXTURE_2D,0,e.isWebGL2&&e.extRenderToTextureHalfFloat?s.RGBA16F:s.RGBA,r,o,0,s.RGBA,e.extRenderToTextureHalfFloat?e.isWebGL2?s.HALF_FLOAT:e.extTextureHalfFloat.HALF_FLOAT_OES:s.UNSIGNED_BYTE,null),n.colorAttachment.set(i)}(e,0,t,a,o,s)}else r.bindTexture(r.TEXTURE_2D,a.colorAttachment.get()),e.bindFramebuffer.set(a.framebuffer)}(o,t,n,"globe"===t.transform.projection.name?.5:.25),o.clear({color:e.Color.transparent});const c=t.transform,u="globe"===c.projection.name,h=u?["PROJECTION_GLOBE_VIEW"]:null,d=u?e.CullFaceMode.frontCCW:e.CullFaceMode.disabled,p=[e.mercatorXfromLng(c.center.lng),e.mercatorYfromLat(c.center.lat)];for(let f=0;f({u_image:0,u_color_ramp:1,u_opacity:t.paint.get("heatmap-opacity")}))(0,i),i.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments,i.paint,t.transform.zoom)}(t,n))},line:function(t,i,n,r){if("translucent"!==t.renderPass)return;const o=n.paint.get("line-opacity"),s=n.paint.get("line-width");if(0===o.constantOr(1)||0===s.constantOr(1))return;const a=t.depthModeForSublayer(0,e.DepthMode.ReadOnly),l=t.colorModeForRenderPass(),c=t.terrain&&t.terrain.renderingToTexture?1:e.exported.devicePixelRatio,u=n.paint.get("line-dasharray"),h=u.constantOr(1),d=n.layout.get("line-cap"),p=n.paint.get("line-pattern"),f=p.constantOr(1),m=n.paint.get("line-gradient"),_=f?"linePattern":"line",g=t.context,y=g.gl,b=(e=>{const t=[];Ji(e)&&t.push("RENDER_LINE_DASH"),e.paint.get("line-gradient")&&t.push("RENDER_LINE_GRADIENT");const i=e.paint.get("line-trim-offset");0===i[0]&&0===i[1]||t.push("RENDER_LINE_TRIM_OFFSET");const n=e.paint.get("line-pattern").constantOr(1),r=1!==e.paint.get("line-opacity").constantOr(1);return!n&&r&&t.push("RENDER_LINE_ALPHA_DISCARD"),t})(n);let v=b.includes("RENDER_LINE_ALPHA_DISCARD");t.terrain&&t.terrain.clipOrMaskOverlapStencilType()&&(v=!1);for(const o of r){const r=i.getTile(o);if(f&&!r.patternsLoaded())continue;const s=r.getBucket(n);if(!s)continue;t.prepareDrawTile();const x=s.programConfigurations.get(n.id),w=t.useProgram(_,x,b),E=p.constantOr(null);if(E&&r.imageAtlas){const e=r.imageAtlas.patternPositions[E.toString()];e&&x.setConstantPatternPositions(e)}const T=u.constantOr(null),k=d.constantOr(null);if(!f&&T&&k&&r.lineAtlas){const e=r.lineAtlas.getDash(T,k);e&&x.setConstantPatternPositions(e)}let[C,S]=n.paint.get("line-trim-offset");if("round"===k||"square"===k){const e=1;C!==S&&(0===C&&(C-=e),1===S&&(S+=e))}const M=t.terrain?o.projMatrix:null,A=f?Hi(t,r,n,M,c):Wi(t,r,n,M,s.lineClipsArray.length,c,[C,S]);if(m){const r=s.gradients[n.id];let a=r.texture;if(n.gradientVersion!==r.version){let l=256;if(n.stepInterpolant){const n=i.getSource().maxzoom,r=o.canonical.z===n?Math.ceil(1<{w.draw(g,y.TRIANGLES,a,i,l,e.CullFaceMode.disabled,A,n.id,s.layoutVertexBuffer,s.indexBuffer,s.segments,n.paint,t.transform.zoom,x,[s.layoutVertexBuffer2])};if(v){const i=t.stencilModeForClipping(o).ref;0===i&&t.terrain&&g.clear({stencil:0});const n={func:y.EQUAL,mask:255};A.u_alpha_discard_threshold=.8,I(new e.StencilMode(n,i,255,y.KEEP,y.KEEP,y.INVERT)),A.u_alpha_discard_threshold=0,I(new e.StencilMode(n,i,255,y.KEEP,y.KEEP,y.KEEP))}else I(t.stencilModeForClipping(o))}v&&(t.resetStencilClippingMasks(),t.terrain&&g.clear({stencil:0}))},fill:function(t,i,n,r){const o=n.paint.get("fill-color"),s=n.paint.get("fill-opacity");if(0===s.constantOr(1))return;const a=t.colorModeForRenderPass(),l=n.paint.get("fill-pattern"),c=t.opaquePassEnabledForLayer()&&!l.constantOr(1)&&1===o.constantOr(e.Color.transparent).a&&1===s.constantOr(0)?"opaque":"translucent";if(t.renderPass===c){const o=t.depthModeForSublayer(1,"opaque"===t.renderPass?e.DepthMode.ReadWrite:e.DepthMode.ReadOnly);_n(t,i,n,r,o,a,!1)}if("translucent"===t.renderPass&&n.paint.get("fill-antialias")){const o=t.depthModeForSublayer(n.getPaintProperty("fill-outline-color")?2:0,e.DepthMode.ReadOnly);_n(t,i,n,r,o,a,!0)}},"fill-extrusion":function(t,i,n,r){const o=n.paint.get("fill-extrusion-opacity");if(0!==o&&"translucent"===t.renderPass){const s=new e.DepthMode(t.context.gl.LEQUAL,e.DepthMode.ReadWrite,t.depthRangeFor3D);if(1!==o||n.paint.get("fill-extrusion-pattern").constantOr(1))gn(t,i,n,r,s,e.StencilMode.disabled,e.ColorMode.disabled),gn(t,i,n,r,s,t.stencilModeFor3D(),t.colorModeForRenderPass()),t.resetStencilClippingMasks();else{const o=t.colorModeForRenderPass();gn(t,i,n,r,s,e.StencilMode.disabled,o)}}},hillshade:function(t,i,n,r){if("offscreen"!==t.renderPass&&"translucent"!==t.renderPass)return;const o=t.context,s=t.depthModeForSublayer(0,e.DepthMode.ReadOnly),a=t.colorModeForRenderPass(),l=t.terrain&&t.terrain.renderingToTexture,[c,u]="translucent"!==t.renderPass||l?[{},r]:t.stencilConfigForOverlap(r);for(const r of u){const o=i.getTile(r);if(o.needsHillshadePrepare&&"offscreen"===t.renderPass)_i(t,o,n,s,e.StencilMode.disabled,a);else if("translucent"===t.renderPass){const e=l&&t.terrain?t.terrain.stencilModeForRTTOverlap(r):c[r.overscaledZ];fi(t,r,o,n,s,e,a)}}o.viewport.set([0,0,t.width,t.height]),t.resetStencilClippingMasks()},raster:function(t,i,n,r,o,s){if("translucent"!==t.renderPass)return;if(0===n.paint.get("raster-opacity"))return;if(!r.length)return;const a=t.context,l=a.gl,c=i.getSource(),u=t.useProgram("raster"),h=t.colorModeForRenderPass(),d=t.terrain&&t.terrain.renderingToTexture,[p,f]=c instanceof Me||d?[{},r]:t.stencilConfigForOverlap(r),m=f[f.length-1].overscaledZ,_=!t.options.moving;for(const r of f){const o=d?e.DepthMode.disabled:t.depthModeForSublayer(r.overscaledZ-m,1===n.paint.get("raster-opacity")?e.DepthMode.ReadWrite:e.DepthMode.ReadOnly,l.LESS),f=r.toUnwrapped(),g=i.getTile(r);if(d&&(!g||!g.hasData()))continue;const y=d?r.projMatrix:t.transform.calculateProjMatrix(f,_),b=t.terrain&&d?t.terrain.stencilModeForRTTOverlap(r):p[r.overscaledZ],v=s?0:n.paint.get("raster-fade-duration");g.registerFadeDuration(v);const x=i.findLoadedParent(r,0),w=Ci(g,x,i,t.transform,v);let E,T;t.terrain&&t.terrain.prepareDrawTile();const k="nearest"===n.paint.get("raster-resampling")?l.NEAREST:l.LINEAR;a.activeTexture.set(l.TEXTURE0),g.texture.bind(k,l.CLAMP_TO_EDGE),a.activeTexture.set(l.TEXTURE1),x?(x.texture.bind(k,l.CLAMP_TO_EDGE),E=Math.pow(2,x.tileID.overscaledZ-g.tileID.overscaledZ),T=[g.tileID.canonical.x*E%1,g.tileID.canonical.y*E%1]):g.texture.bind(k,l.CLAMP_TO_EDGE),g.texture.useMipmap&&a.extTextureFilterAnisotropic&&t.transform.pitch>20&&l.texParameterf(l.TEXTURE_2D,a.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,a.extTextureFilterAnisotropicMax);const C=Yi(y,T||[0,0],E||1,w,n,c instanceof Me?c.perspectiveTransform:[0,0]);if(t.prepareDrawProgram(a,u,f),c instanceof Me)c.boundsBuffer&&c.boundsSegments&&u.draw(a,l.TRIANGLES,o,e.StencilMode.disabled,h,e.CullFaceMode.disabled,C,n.id,c.boundsBuffer,t.quadTriangleIndexBuffer,c.boundsSegments);else{const{tileBoundsBuffer:i,tileBoundsIndexBuffer:r,tileBoundsSegments:s}=t.getTileBoundsBuffers(g);u.draw(a,l.TRIANGLES,o,b,h,e.CullFaceMode.disabled,C,n.id,i,r,s)}}t.resetStencilClippingMasks()},background:function(t,i,n,r){const o=n.paint.get("background-color"),s=n.paint.get("background-opacity");if(0===s)return;const a=t.context,l=a.gl,c=t.transform,u=c.tileSize,h=n.paint.get("background-pattern");if(t.isPatternMissing(h))return;const d=!h&&1===o.a&&1===s&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(t.renderPass!==d)return;const p=e.StencilMode.disabled,f=t.depthModeForSublayer(0,"opaque"===d?e.DepthMode.ReadWrite:e.DepthMode.ReadOnly),m=t.colorModeForRenderPass(),_=t.useProgram(h?"backgroundPattern":"background");let g,y=r;y||(g=t.getBackgroundTiles(),y=Object.values(g).map((e=>e.tileID))),h&&(a.activeTexture.set(l.TEXTURE0),t.imageManager.bind(t.context));for(const d of y){const y=d.toUnwrapped(),b=r?d.projMatrix:t.transform.calculateProjMatrix(y);t.prepareDrawTile();const v=i?i.getTile(d):g?g[d.key]:new e.Tile(d,u,c.zoom,t),x=h?sn(b,s,t,h,{tileID:d,tileSize:u}):on(b,s,o);t.prepareDrawProgram(a,_,y);const{tileBoundsBuffer:w,tileBoundsIndexBuffer:E,tileBoundsSegments:T}=t.getTileBoundsBuffers(v);_.draw(a,l.TRIANGLES,f,p,m,e.CullFaceMode.disabled,x,n.id,w,E,T)}},sky:function(t,i,n){const r=t.transform,o="mercator"===r.projection.name||"globe"===r.projection.name?1:e.smoothstep(7,8,r.zoom),s=n.paint.get("sky-opacity")*o;if(0===s)return;const a=t.context,l=n.paint.get("sky-type"),c=new e.DepthMode(a.gl.LEQUAL,e.DepthMode.ReadOnly,[0,1]),u=t.frameCounter/1e3%1;"atmosphere"===l?"offscreen"===t.renderPass?n.needsSkyboxCapture(t)&&(function(t,i,n,r){const o=t.context,s=o.gl;let a=i.skyboxFbo;if(!a){a=i.skyboxFbo=o.createFramebuffer(32,32,!1),i.skyboxGeometry=new Pn(o),i.skyboxTexture=o.gl.createTexture(),s.bindTexture(s.TEXTURE_CUBE_MAP,i.skyboxTexture),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_MAG_FILTER,s.LINEAR);for(let e=0;e<6;++e)s.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,s.RGBA,32,32,0,s.RGBA,s.UNSIGNED_BYTE,null)}o.bindFramebuffer.set(a.framebuffer),o.viewport.set([0,0,32,32]);const l=i.getCenter(t,!0),c=t.useProgram("skyboxCapture"),u=new Float64Array(16);e.identity(u),e.rotateY(u,u,.5*-Math.PI),Ln(o,i,c,u,l,0),e.identity(u),e.rotateY(u,u,.5*Math.PI),Ln(o,i,c,u,l,1),e.identity(u),e.rotateX(u,u,.5*-Math.PI),Ln(o,i,c,u,l,2),e.identity(u),e.rotateX(u,u,.5*Math.PI),Ln(o,i,c,u,l,3),e.identity(u),Ln(o,i,c,u,l,4),e.identity(u),e.rotateY(u,u,Math.PI),Ln(o,i,c,u,l,5),o.viewport.set([0,0,t.width,t.height])}(t,n),n.markSkyboxValid(t)):"sky"===t.renderPass&&function(t,i,n,r,o){const s=t.context,a=s.gl,l=t.transform,c=t.useProgram("skybox");s.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_CUBE_MAP,i.skyboxTexture);const u=((e,t,i,n,r)=>({u_matrix:e,u_sun_direction:t,u_cubemap:0,u_opacity:n,u_temporal_offset:r}))(l.skyboxMatrix,i.getCenter(t,!1),0,r,o);t.prepareDrawProgram(s,c),c.draw(s,a.TRIANGLES,n,e.StencilMode.disabled,t.colorModeForRenderPass(),e.CullFaceMode.backCW,u,"skybox",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}(t,n,c,s,u):"gradient"===l&&"sky"===t.renderPass&&function(t,i,n,r,o){const s=t.context,a=s.gl,l=t.transform,c=t.useProgram("skyboxGradient");i.skyboxGeometry||(i.skyboxGeometry=new Pn(s)),s.activeTexture.set(a.TEXTURE0);let u=i.colorRampTexture;u||(u=i.colorRampTexture=new e.Texture(s,i.colorRamp,a.RGBA)),u.bind(a.LINEAR,a.CLAMP_TO_EDGE);const h=((t,i,n,r,o)=>({u_matrix:t,u_color_ramp:0,u_center_direction:i,u_radius:e.degToRad(n),u_opacity:r,u_temporal_offset:o}))(l.skyboxMatrix,i.getCenter(t,!1),i.paint.get("sky-gradient-radius"),r,o);t.prepareDrawProgram(s,c),c.draw(s,a.TRIANGLES,n,e.StencilMode.disabled,t.colorModeForRenderPass(),e.CullFaceMode.backCW,h,"skyboxGradient",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}(t,n,c,s,u)},debug:function(e,t,i){for(let n=0;nn)return void(this.transform.fogCullDistSq=null);const r=i+.78*(n-i);this.transform.fogCullDistSq=r*r}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled?this._terrain:null}resize(t,i){if(this.width=t*e.exported.devicePixelRatio,this.height=i*e.exported.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const e of this.style.order)this.style._layers[e].resize()}setup(){const t=this.context,i=new e.StructArrayLayout2i4;i.emplaceBack(0,0),i.emplaceBack(e.EXTENT,0),i.emplaceBack(0,e.EXTENT),i.emplaceBack(e.EXTENT,e.EXTENT),this.tileExtentBuffer=t.createVertexBuffer(i,e.posAttributes.members),this.tileExtentSegments=e.SegmentVector.simpleSegment(0,0,4,2);const n=new e.StructArrayLayout2i4;n.emplaceBack(0,0),n.emplaceBack(e.EXTENT,0),n.emplaceBack(0,e.EXTENT),n.emplaceBack(e.EXTENT,e.EXTENT),this.debugBuffer=t.createVertexBuffer(n,e.posAttributes.members),this.debugSegments=e.SegmentVector.simpleSegment(0,0,4,5);const r=new e.StructArrayLayout2i4;r.emplaceBack(-1,-1),r.emplaceBack(1,-1),r.emplaceBack(-1,1),r.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(r,e.posAttributes.members),this.viewportSegments=e.SegmentVector.simpleSegment(0,0,4,2);const o=new e.StructArrayLayout4i8;o.emplaceBack(0,0,0,0),o.emplaceBack(e.EXTENT,0,e.EXTENT,0),o.emplaceBack(0,e.EXTENT,0,e.EXTENT),o.emplaceBack(e.EXTENT,e.EXTENT,e.EXTENT,e.EXTENT),this.mercatorBoundsBuffer=t.createVertexBuffer(o,e.boundsAttributes.members),this.mercatorBoundsSegments=e.SegmentVector.simpleSegment(0,0,4,2);const s=new e.StructArrayLayout3ui6;s.emplaceBack(0,1,2),s.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(s);const a=new e.StructArrayLayout1ui2;for(const e of[0,1,3,2,0])a.emplaceBack(e);this.debugIndexBuffer=t.createIndexBuffer(a),this.emptyTexture=new e.Texture(t,new e.RGBAImage({width:1,height:1},Uint8Array.of(0,0,0,0)),t.gl.RGBA),this.identityMat=e.create();const l=this.context.gl;this.stencilClearMode=new e.StencilMode({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO),this.loadTimeStamps.push(e.window.performance.now()),this.atmosphereBuffer=new zn(this.context)}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(e){return e._makeTileBoundsBuffers(this.context,this.transform.projection),e._tileBoundsBuffer?{tileBoundsBuffer:e._tileBoundsBuffer,tileBoundsIndexBuffer:e._tileBoundsIndexBuffer,tileBoundsSegments:e._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const t=this.context,i=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.useProgram("clippingMask").draw(t,i.TRIANGLES,e.DepthMode.disabled,this.stencilClearMode,e.ColorMode.disabled,e.CullFaceMode.disabled,ki(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(t,i,n){if(!i||this.currentStencilSource===i.id||!t.isTileClipped()||!n||0===n.length)return;if(this._tileClippingMaskIDs&&!this.terrain){let e=!1;for(const t of n)if(void 0===this._tileClippingMaskIDs[t.key]){e=!0;break}if(!e)return}this.currentStencilSource=i.id;const r=this.context,o=r.gl;this.nextStencilID+n.length>256&&this.clearStencil(),r.setColorMode(e.ColorMode.disabled),r.setDepthMode(e.DepthMode.disabled);const s=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const t of n){const n=i.getTile(t),a=this._tileClippingMaskIDs[t.key]=this.nextStencilID++,{tileBoundsBuffer:l,tileBoundsIndexBuffer:c,tileBoundsSegments:u}=this.getTileBoundsBuffers(n);s.draw(r,o.TRIANGLES,e.DepthMode.disabled,new e.StencilMode({func:o.ALWAYS,mask:0},a,255,o.KEEP,o.KEEP,o.REPLACE),e.ColorMode.disabled,e.CullFaceMode.disabled,ki(t.projMatrix),"$clipping",l,c,u)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,i=this.context.gl;return new e.StencilMode({func:i.NOTEQUAL,mask:255},t,255,i.KEEP,i.KEEP,i.REPLACE)}stencilModeForClipping(t){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(t);const i=this.context.gl;return new e.StencilMode({func:i.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,i.KEEP,i.KEEP,i.REPLACE)}stencilConfigForOverlap(t){const i=this.context.gl,n=t.sort(((e,t)=>t.overscaledZ-e.overscaledZ)),r=n[n.length-1].overscaledZ,o=n[0].overscaledZ-r+1;if(o>1){this.currentStencilSource=void 0,this.nextStencilID+o>256&&this.clearStencil();const t={};for(let n=0;n=0;this.currentLayer--){const e=this.style._layers[n[this.currentLayer]],i=t._getLayerSourceCache(e);if(e.isSky())continue;const r=i?s[i.id]:void 0;this._renderTileClippingMasks(e,i,r),this.renderLayer(this,i,e,r)}if(this.style.fog&&this.transform.projection.supportsFog&&function(t,i){const n=t.context,r=n.gl,o=t.transform,s=new e.DepthMode(r.LEQUAL,e.DepthMode.ReadOnly,[0,1]),a=t.useProgram("globeAtmosphere",null,"globe"===o.projection.name?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"]),l=e.globeToMercatorTransition(o.zoom),c=i.properties.get("color").toArray01(),u=i.properties.get("high-color").toArray01(),h=i.properties.get("space-color").toArray01PremultipliedAlpha(),d=e.identity$1([]);e.rotateY$1(d,d,-e.degToRad(o._center.lng)),e.rotateX$1(d,d,e.degToRad(o._center.lat)),e.rotateZ$1(d,d,o.angle),e.rotateX$1(d,d,-o._pitch);const p=e.fromQuat(new Float32Array(16),d),f=e.mapValue(i.properties.get("star-intensity"),0,1,0,.25),m=5e-4,_=e.mapValue(i.properties.get("horizon-blend"),0,1,m,.25),g=e.globeUseCustomAntiAliasing(t,n,o)&&_===m?o.worldSize/(2*Math.PI*1.025)-1:o.globeRadius,y=t.frameCounter/1e3%1,b=e.length(o.globeCenterInViewSpace),v=Math.sqrt(Math.pow(b,2)-Math.pow(g,2)),x=Math.acos(v/b),w=((t,i,n,r,o,s,a,l,c,u,h,d,p,f)=>({u_frustum_tl:t,u_frustum_tr:i,u_frustum_br:n,u_frustum_bl:r,u_horizon:o,u_transition:s,u_fadeout_range:a,u_color:l,u_high_color:c,u_space_color:u,u_star_intensity:h,u_star_size:5*e.exported.devicePixelRatio,u_star_density:0,u_temporal_offset:d,u_horizon_angle:p,u_rotation_matrix:f}))(o.frustumCorners.TL,o.frustumCorners.TR,o.frustumCorners.BR,o.frustumCorners.BL,o.frustumCorners.horizon,l,_,c,u,h,f,y,x,p);t.prepareDrawProgram(n,a);const E=t.atmosphereBuffer;E&&a.draw(n,r.TRIANGLES,s,e.StencilMode.disabled,e.ColorMode.alphaBlended,e.CullFaceMode.backCW,w,"skybox",E.vertexBuffer,E.indexBuffer,E.segments)}(this,this.style.fog),this.renderPass="sky",(e.globeToMercatorTransition(this.transform.zoom)>0||"globe"!==this.transform.projection.name)&&this.transform.isHorizonVisible())for(this.currentLayer=0;this.currentLayer{const n=t._getLayerSourceCache(e);n&&!e.isHidden(this.transform.zoom)&&(!i||i.getSource().maxzoom0?t.pop():null}isPatternMissing(e){return null===e||void 0!==e&&!this.imageManager.getPattern(e.toString())}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture}currentGlobalDefines(){const e=this.terrain&&this.terrain.renderingToTexture,t=this.terrain&&0===this.terrain.exaggeration(),i=this.style&&this.style.fog,n=[];return this.terrainRenderModeElevated()&&n.push("TERRAIN"),"globe"===this.transform.projection.name&&n.push("GLOBE"),t&&n.push("ZERO_EXAGGERATION"),i&&!e&&0!==i.getOpacity(this.transform.pitch)&&n.push("FOG"),e&&n.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&n.push("OVERDRAW_INSPECTOR"),n}useProgram(e,t,i){this.cache=this.cache||{};const n=i||[],r=this.currentGlobalDefines().concat(n),o=Pi.cacheKey(ci[e],e,r,t);return this.cache[o]||(this.cache[o]=new Pi(this.context,e,ci[e],t,an[e],r)),this.cache[o]}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 e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=e.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new e.Texture(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this._terrain&&this._terrain.destroy(),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.atmosphereBuffer&&this.atmosphereBuffer.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}prepareDrawProgram(t,i,n){if(this.terrain&&this.terrain.renderingToTexture)return;const r=this.style.fog;if(r){const o=r.getOpacity(this.transform.pitch),s=((t,i,n,r,o,s,a,l,c,u,h)=>{const d=t.transform,p=i.properties.get("color").toArray01();p[3]=r;const f=t.frameCounter/1e3%1;return{u_fog_matrix:n?d.calculateFogTileMatrix(n):t.identityMat,u_fog_range:i.getFovAdjustedRange(d._fov),u_fog_color:p,u_fog_horizon_blend:i.properties.get("horizon-blend"),u_fog_temporal_offset:f,u_frustum_tl:o,u_frustum_tr:s,u_frustum_br:a,u_frustum_bl:l,u_globe_pos:c,u_globe_radius:u,u_viewport:h,u_globe_transition:e.globeToMercatorTransition(d.zoom),u_is_globe:+("globe"===d.projection.name)}})(this,r,n,o,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*e.exported.devicePixelRatio,this.transform.height*e.exported.devicePixelRatio]);i.setFogUniformValues(t,s)}}setTileLoadedFlag(e){this.tileLoaded=e}saveCanvasCopy(){const e=this.canvasCopy();e&&(this.frameCopies.push(e),this.tileLoaded=!1)}canvasCopy(){const e=this.context.gl,t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.copyTexImage2D(e.TEXTURE_2D,0,e.RGBA,0,0,e.drawingBufferWidth,e.drawingBufferHeight,0),t}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const e=this.style&&this.style.fog;return!!e&&0!==e.getOpacity(this.transform.pitch)}getBackgroundTiles(){const t=this._backgroundTiles,i=this._backgroundTiles={},n=this.transform.coveringTiles({tileSize:512});for(const r of n)i[r.key]=t[r.key]||new e.Tile(r,512,this.transform.tileZoom,this);return i}clearBackgroundTiles(){this._backgroundTiles={}}}class Rn{constructor(e=0,t=0,i=0,n=0){if(isNaN(e)||e<0||isNaN(t)||t<0||isNaN(i)||i<0||isNaN(n)||n<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=t,this.left=i,this.right=n}interpolate(t,i,n){return null!=i.top&&null!=t.top&&(this.top=e.number(t.top,i.top,n)),null!=i.bottom&&null!=t.bottom&&(this.bottom=e.number(t.bottom,i.bottom,n)),null!=i.left&&null!=t.left&&(this.left=e.number(t.left,i.left,n)),null!=i.right&&null!=t.right&&(this.right=e.number(t.right,i.right,n)),this}getCenter(t,i){const n=e.clamp((this.left+t-this.right)/2,0,t),r=e.clamp((this.top+i-this.bottom)/2,0,i);return new e.Point(n,r)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new Rn(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function Fn(t,i){const n=e.getColumn(t,3);e.fromQuat(t,i),e.setColumn(t,3,n)}function Un(t,i){const n=e.identity$1([]);return e.rotateZ$1(n,n,-i),e.rotateX$1(n,n,-t),n}function jn(t,i){const n=[t[0],t[1],0],r=[i[0],i[1],0];if(e.length(n)>=1e-15){const t=e.normalize([],n);e.scale$2(r,t,e.dot(r,t)),i[0]=r[0],i[1]=r[1]}const o=e.cross([],i,t);if(e.len(o)<1e-15)return null;const s=Math.atan2(-o[1],o[0]);return Un(Math.atan2(Math.sqrt(t[0]*t[0]+t[1]*t[1]),-t[2]),s)}class Vn{constructor(e,t){this.position=e,this.orientation=t}get position(){return this._position}set position(t){if(t){const i=t instanceof e.MercatorCoordinate?t:new e.MercatorCoordinate(t[0],t[1],t[2]);this._renderWorldCopies&&(i.x=e.wrap(i.x,0,1)),this._position=i}else this._position=null}lookAtPoint(t,i){if(this.orientation=null,!this.position)return;const n=this.position,r=this._elevation?this._elevation.getAtPointOrZero(e.MercatorCoordinate.fromLngLat(t)):0,o=e.MercatorCoordinate.fromLngLat(t,r),s=[o.x-n.x,o.y-n.y,o.z-n.z];i||(i=[0,0,1]),i[2]=Math.abs(i[2]),this.orientation=jn(s,i)}setPitchBearing(t,i){this.orientation=Un(e.degToRad(t),e.degToRad(-i))}}class Nn{constructor(t,i){this._transform=e.identity([]),this.orientation=i,this.position=t}get mercatorPosition(){const t=this.position;return new e.MercatorCoordinate(t[0],t[1],t[2])}get position(){const t=e.getColumn(this._transform,3);return[t[0],t[1],t[2]]}set position(t){var i;t&&e.setColumn(this._transform,3,[(i=t)[0],i[1],i[2],1])}get orientation(){return this._orientation}set orientation(t){this._orientation=t||e.identity$1([]),t&&Fn(this._transform,this._orientation)}getPitchBearing(){const e=this.forward(),t=this.right();return{bearing:Math.atan2(-t[1],t[0]),pitch:Math.atan2(Math.sqrt(e[0]*e[0]+e[1]*e[1]),-e[2])}}setPitchBearing(e,t){this._orientation=Un(e,t),Fn(this._transform,this._orientation)}forward(){const t=e.getColumn(this._transform,2);return[-t[0],-t[1],-t[2]]}up(){const t=e.getColumn(this._transform,1);return[-t[0],-t[1],-t[2]]}right(){const t=e.getColumn(this._transform,0);return[t[0],t[1],t[2]]}getCameraToWorld(t,i){const n=new Float64Array(16);return e.invert(n,this.getWorldToCamera(t,i)),n}getWorldToCameraPosition(t,i,n){const r=this.position;e.scale$2(r,r,-t);const o=new Float64Array(16);return e.fromScaling(o,[n,n,n]),e.translate(o,o,r),o[10]*=i,o}getWorldToCamera(t,i){const n=new Float64Array(16),r=new Float64Array(4),o=this.position;return e.conjugate(r,this._orientation),e.scale$2(o,o,-t),e.fromQuat(n,r),e.translate(n,n,o),n[1]*=-1,n[5]*=-1,n[9]*=-1,n[13]*=-1,n[8]*=i,n[9]*=i,n[10]*=i,n[11]*=i,n}getCameraToClipPerspective(t,i,n,r){const o=new Float64Array(16);return e.perspective(o,t,i,n,r),o}getDistanceToElevation(t,i=!1){const n=0===t?0:e.mercatorZfromAltitude(t,i?e.latFromMercatorY(this.position[1]):this.position[1]),r=this.forward();return(n-this.position[2])/r[2]}clone(){return new Nn([...this.position],[...this.orientation])}}function $n(t,i){const n=Gn(t.projection,t.zoom,t.width,t.height),r=function(t,i,n,r,o){const s=new e.LngLat(n.lng-180*Zn,n.lat),a=new e.LngLat(n.lng+180*Zn,n.lat),l=t.project(s.lng,s.lat),c=t.project(a.lng,a.lat),u=-Math.atan2(c.y-l.y,c.x-l.x),h=e.MercatorCoordinate.fromLngLat(n);h.y=e.clamp(h.y,-1+Zn,1-Zn);const d=h.toLngLat(),p=t.project(d.lng,d.lat),f=e.MercatorCoordinate.fromLngLat(d);f.x+=Zn;const m=f.toLngLat(),_=t.project(m.lng,m.lat),g=Hn(_.x-p.x,_.y-p.y,u),y=e.MercatorCoordinate.fromLngLat(d);y.y+=Zn;const b=y.toLngLat(),v=t.project(b.lng,b.lat),x=Hn(v.x-p.x,v.y-p.y,u),w=Math.abs(g.x)/Math.abs(x.y),E=e.identity([]);e.rotateZ(E,E,-u*(1-(o?0:r)));const T=e.identity([]);return e.scale(T,T,[1,1-(1-w)*r,1]),T[4]=-x.x/x.y*r,e.rotateZ(T,T,u),e.multiply(T,E,T),T}(t.projection,0,t.center,n,i),o=qn(t);return e.scale(r,r,[o,o,1]),r}function qn(t){const i=t.projection,n=Gn(t.projection,t.zoom,t.width,t.height),r=Wn(i,t.center),o=Wn(i,e.LngLat.convert(i.center));return Math.pow(2,r*n+(1-n)*o)}function Gn(t,i,n,r,o=1/0){const s=t.range;if(!s)return 0;const a=Math.min(o,Math.max(n,r)),l=Math.log(a/1024)/Math.LN2;return e.smoothstep(s[0]+l,s[1]+l,i)}const Zn=1/4e4;function Wn(t,i){const n=e.clamp(i.lat,-e.MAX_MERCATOR_LATITUDE,e.MAX_MERCATOR_LATITUDE),r=new e.LngLat(i.lng-180*Zn,n),o=new e.LngLat(i.lng+180*Zn,n),s=t.project(r.lng,n),a=t.project(o.lng,n),l=e.MercatorCoordinate.fromLngLat(r),c=e.MercatorCoordinate.fromLngLat(o),u=a.x-s.x,h=a.y-s.y,d=c.x-l.x,p=c.y-l.y,f=Math.sqrt((d*d+p*p)/(u*u+h*h));return Math.log(f)/Math.LN2}function Hn(e,t,i){const n=Math.cos(i),r=Math.sin(i);return{x:e*n-t*r,y:e*r+t*n}}class Xn{constructor(t,i,n,r,o,s,a){this.tileSize=512,this._renderWorldCopies=void 0===o||o,this._minZoom=t||0,this._maxZoom=i||22,this._minPitch=null==n?0:n,this._maxPitch=null==r?60:r,this.setProjection(s),this.setMaxBounds(a),this.width=0,this.height=0,this._center=new e.LngLat(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 Rn,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._distanceTileDataCache={},this._camera=new Nn,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._horizonShift=.1}clone(){const e=new Xn(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection());return e._elevation=this._elevation,e._centerAltitude=this._centerAltitude,e._centerAltitudeValidForExaggeration=this._centerAltitudeValidForExaggeration,e.tileSize=this.tileSize,e.mercatorFromTransition=this.mercatorFromTransition,e.width=this.width,e.height=this.height,e.cameraElevationReference=this.cameraElevationReference,e._center=this._center,e._setZoom(this.zoom),e._seaLevelZoom=this._seaLevelZoom,e.angle=this.angle,e._fov=this._fov,e._pitch=this._pitch,e._nearZ=this._nearZ,e._farZ=this._farZ,e._averageElevation=this._averageElevation,e._unmodified=this._unmodified,e._edgeInsets=this._edgeInsets.clone(),e._camera=this._camera.clone(),e._calcMatrices(),e.freezeTileCoverage=this.freezeTileCoverage,e.frustumCorners=this.frustumCorners,e}get elevation(){return this._elevation}set elevation(e){this._elevation!==e&&(this._elevation=e,this._updateCameraOnTerrain(),this._calcMatrices())}updateElevation(e,t=!1){const i=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForExaggeration;(null==this._seaLevelZoom||i)&&this._updateCameraOnTerrain(),(e||i)&&this._constrainCamera(t),this._calcMatrices()}getProjection(){return e.pick(this.projection,["name","center","parallels"])}setProjection(i){this.projectionOptions=i||{name:"mercator"};const n=this.projection?this.getProjection():void 0;this.projection=e.getProjection(this.projectionOptions);const r=!t(n,this.getProjection());return r&&this._calcMatrices(),this.mercatorFromTransition=!1,r}setMercatorFromTransition(){const t=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=e.getProjection({name:"mercator"});const i=t!==this.projection.name;return i&&this._calcMatrices(),i}get minZoom(){return this._minZoom}set minZoom(e){this._minZoom!==e&&(this._minZoom=e,this.zoom=Math.max(this.zoom,e))}get maxZoom(){return this._maxZoom}set maxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.zoom=Math.min(this.zoom,e))}get minPitch(){return this._minPitch}set minPitch(e){this._minPitch!==e&&(this._minPitch=e,this.pitch=Math.max(this.pitch,e))}get maxPitch(){return this._maxPitch}set maxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.pitch=Math.min(this.pitch,e))}get renderWorldCopies(){return this._renderWorldCopies&&!0===this.projection.supportsWorldCopies}set renderWorldCopies(e){void 0===e?e=!0:null===e&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){const e=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(e))}get cameraWorldSize(){const e=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(e))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return e.mercatorZfromAltitude(this.center.lat,this.cameraWorldSizeForFog)}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new e.Point(this.width,this.height)}get bearing(){return e.wrap(this.rotation,-180,180)}set bearing(e){this.rotation=e}get rotation(){return-this.angle/Math.PI*180}set rotation(t){const i=-t*Math.PI/180;var n;this.angle!==i&&(this._unmodified=!1,this.angle=i,this._calcMatrices(),this.rotationMatrix=(n=new e.ARRAY_TYPE(4),e.ARRAY_TYPE!=Float32Array&&(n[1]=0,n[2]=0),n[0]=1,n[3]=1,n),function(e,t,i){var n=t[0],r=t[1],o=t[2],s=t[3],a=Math.sin(i),l=Math.cos(i);e[0]=n*l+o*a,e[1]=r*l+s*a,e[2]=n*-a+o*l,e[3]=r*-a+s*l}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const i=e.clamp(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==i&&(this._unmodified=!1,this._pitch=i,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}get fovX(){return this._fov}get fovY(){const e=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/e)}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=e.degToRad(t),this._calcMatrices())}get averageElevation(){return this._averageElevation}set averageElevation(e){this._averageElevation=e,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(e){const t=Math.min(Math.max(e,this.minZoom),this.maxZoom);this._zoom!==t&&(this._unmodified=!1,this._setZoom(t),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(e){this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom}_updateCameraOnTerrain(){if(!this._elevation||!this._elevation.isDataAvailableAtPoint(this.locationCoordinate(this.center)))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const e=this._elevation;this._centerAltitude=e.getAtPointOrZero(this.locationCoordinate(this.center)),this._centerAltitudeValidForExaggeration=e.exaggeration(),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){void 0!==this._centerAltitudeValidForExaggeration&&(this._seaLevelZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize))}sampleAverageElevation(){if(!this._elevation)return 0;const t=this._elevation,i=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],n=this.horizonLineFromTop();let r=0,o=0;for(let s=0;st.maxzoom&&(i=t.maxzoom);const s=this.locationCoordinate(this.center),a=this.center.lat,l=1<{const i=1/4e4,n=new e.MercatorCoordinate(t.x+i,t.y,t.z),r=new e.MercatorCoordinate(t.x,t.y+i,t.z),o=t.toLngLat(),s=n.toLngLat(),a=r.toLngLat(),l=this.locationCoordinate(o),c=this.locationCoordinate(s),u=this.locationCoordinate(a),h=Math.hypot(c.x-l.x,c.y-l.y),d=Math.hypot(u.x-l.x,u.y-l.y);return Math.sqrt(h*d)*x/i},E=t=>{const i=b,n=v;return{aabb:e.tileAABB(this,l,0,0,0,t,n,i,this.projection),zoom:0,x:0,y:0,minZ:n,maxZ:i,wrap:t,fullyVisible:!1}},T=[];let k=[];const C=i,S=t.reparseOverscaled?n:i,M=e=>e*e,A=M((m-this._centerAltitude)*f),I=e=>{if(!this._elevation||!e.tileID||!o)return;const t=this._elevation.getMinMaxForTile(e.tileID),i=e.aabb;t?(i.min[2]=t.min,i.max[2]=t.max,i.center[2]=(i.min[2]+i.max[2])/2):(e.shouldSplit=P(e),e.shouldSplit||(i.min[2]=i.max[2]=i.center[2]=this._centerAltitude))},P=t=>{if(t.zoom=.9)return!0}else if(r&&(s=M(t.aabb.distanceZ(_)*f)),this.projection.isReprojectedInTileSpace&&n<=5){const i=Math.pow(2,t.zoom),n=w(new e.MercatorCoordinate((t.x+.5)/i,(t.y+.5)/i));l=n>.85?1:n}const c=i*i+o*o+s,h=M((1<{if(t*M(.707)0;){const n=T.pop(),s=n.x,a=n.y;let h=n.fullyVisible;if(!h){const e=n.aabb.intersects(d);if(0===e)continue;h=2===e}if(n.zoom!==C&&P(n))for(let t=0;t<4;t++){const i=(s<<1)+t%2,c=(a<<1)+(t>>1),d={aabb:o?n.aabb.quadrant(t):e.tileAABB(this,l,n.zoom+1,i,c,n.wrap,n.minZ,n.maxZ,this.projection),zoom:n.zoom+1,x:i,y:c,wrap:n.wrap,fullyVisible:h,tileID:void 0,shouldSplit:void 0,minZ:n.minZ,maxZ:n.maxZ};r&&!u&&(d.tileID=new e.OverscaledTileID(n.zoom+1===C?S:n.zoom+1,n.wrap,n.zoom+1,i,c),I(d)),T.push(d)}else{const r=n.zoom===C?S:n.zoom;if(t.minzoom&&t.minzoom>r)continue;const o=c[0]-(.5+s+(n.wrap<{const o=[0,0,0,1],s=[e.EXTENT,e.EXTENT,0,1],a=this.calculateFogTileMatrix(r.tileID.toUnwrapped());e.transformMat4$1(o,o,a),e.transformMat4$1(s,s,a);const l=e.getAABBPointSquareDist(o,s);if(0===l)return!0;let c=!1;const u=this._elevation;if(u&&l>i&&0!==n){const i=this.calculateProjMatrix(r.tileID.toUnwrapped());let o;t.isTerrainDEM||(o=u.getMinMaxForTile(r.tileID)),o||(o={min:v,max:b});const s=e.furthestTileCorner(this.rotation),a=[s[0]*e.EXTENT,s[1]*e.EXTENT,o.max];e.transformMat4(a,a,i),c=(1-a[1])*this.height*.5e.distanceSq-t.distanceSq)).map((e=>e.tileID))}resize(e,t){this.width=e,this.height=t,this.pixelsToGLUnits=[2/e,-2/t],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(e){return Math.pow(2,e)}scaleZoom(e){return Math.log(e)/Math.LN2}project(t){const i=e.clamp(t.lat,-e.MAX_MERCATOR_LATITUDE,e.MAX_MERCATOR_LATITUDE),n=this.projection.project(t.lng,i);return new e.Point(n.x*this.worldSize,n.y*this.worldSize)}unproject(e){return this.projection.unproject(e.x/this.worldSize,e.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/e.mercatorZfromAltitude(1,this.center.lat)/this.worldSize}setLocationAtPoint(t,i){let n,r;const o=this.centerPoint;if("globe"===this.projection.name){const e=this.worldSize;n=(i.x-o.x)/e,r=(i.y-o.y)/e}else{const e=this.pointCoordinate(i),t=this.pointCoordinate(o);n=e.x-t.x,r=e.y-t.y}const s=this.locationCoordinate(t);this.setLocation(new e.MercatorCoordinate(s.x-n,s.y-r))}setLocation(e){this.center=this.coordinateLocation(e),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(e){return this.projection.locationPoint(this,e)}locationPoint3D(e){return this.projection.locationPoint(this,e,!0)}pointLocation(e){return this.coordinateLocation(this.pointCoordinate(e))}pointLocation3D(e){return this.coordinateLocation(this.pointCoordinate3D(e))}locationCoordinate(t,i){const n=i?e.mercatorZfromAltitude(i,t.lat):void 0,r=this.projection.project(t.lng,t.lat);return new e.MercatorCoordinate(r.x,r.y,n)}coordinateLocation(e){return this.projection.unproject(e.x,e.y)}pointRayIntersection(t,i){const n=null!=i?i:this._centerAltitude,r=[t.x,t.y,0,1],o=[t.x,t.y,1,1];e.transformMat4$1(r,r,this.pixelMatrixInverse),e.transformMat4$1(o,o,this.pixelMatrixInverse);const s=o[3];e.scale$1(r,r,1/r[3]),e.scale$1(o,o,1/s);const a=r[2],l=o[2];return{p0:r,p1:o,t:a===l?0:(n-a)/(l-a)}}screenPointToMercatorRay(t){const i=[t.x,t.y,0,1],n=[t.x,t.y,1,1];return e.transformMat4$1(i,i,this.pixelMatrixInverse),e.transformMat4$1(n,n,this.pixelMatrixInverse),e.scale$1(i,i,1/i[3]),e.scale$1(n,n,1/n[3]),i[2]=e.mercatorZfromAltitude(i[2],this._center.lat)*this.worldSize,n[2]=e.mercatorZfromAltitude(n[2],this._center.lat)*this.worldSize,e.scale$1(i,i,1/this.worldSize),e.scale$1(n,n,1/this.worldSize),new e.Ray([i[0],i[1],i[2]],e.normalize([],e.sub([],n,i)))}rayIntersectionCoordinate(t){const{p0:i,p1:n,t:r}=t,o=e.mercatorZfromAltitude(i[2],this._center.lat),s=e.mercatorZfromAltitude(n[2],this._center.lat);return new e.MercatorCoordinate(e.number(i[0],n[0],r)/this.worldSize,e.number(i[1],n[1],r)/this.worldSize,e.number(o,s,r))}pointCoordinate(e,t=this._centerAltitude){return this.projection.pointCoordinate(this,e.x,e.y,t)}pointCoordinate3D(t){if(!this.elevation)return this.pointCoordinate(t);let i=this.projection.pointCoordinate3D(this,t.x,t.y);if(i)return new e.MercatorCoordinate(i[0],i[1],i[2]);let n=0,r=this.horizonLineFromTop();if(t.y>r)return this.pointCoordinate(t);const o=.02*r,s=t.clone();for(let t=0;t<10&&r-n>o;t++){s.y=e.number(n,r,.66);const t=this.projection.pointCoordinate3D(this,s.x,s.y);t?(r=s.y,i=t):n=s.y}return i?new e.MercatorCoordinate(i[0],i[1],i[2]):this.pointCoordinate(t)}isPointAboveHorizon(e){return this.projection.isPointAboveHorizon(this,e)}isPointOnSurface(t){if(t.y<0||t.y>this.height||t.x<0||t.x>this.width)return!1;if(this.elevation||this.zoom>=e.GLOBE_ZOOM_THRESHOLD_MAX)return!this.isPointAboveHorizon(t);const i=this.pointCoordinate(t);return i.y>=0&&i.y<=1}_coordinatePoint(t,i){const n=i&&this.elevation?this.elevation.getAtPointOrZero(t,this._centerAltitude):this._centerAltitude,r=[t.x*this.worldSize,t.y*this.worldSize,n+t.toAltitude(),1];return e.transformMat4$1(r,r,this.pixelMatrix),r[3]>0?new e.Point(r[0]/r[3],r[1]/r[3]):new e.Point(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:t,left:i}=this._edgeInsets,n=this.height-this._edgeInsets.bottom,r=this.width-this._edgeInsets.right,o=this.pointLocation3D(new e.Point(i,t)),s=this.pointLocation3D(new e.Point(r,t)),a=this.pointLocation3D(new e.Point(r,n)),l=this.pointLocation3D(new e.Point(i,n));let c=Math.min(o.lng,s.lng,a.lng,l.lng),u=Math.max(o.lng,s.lng,a.lng,l.lng),h=Math.min(o.lat,s.lat,a.lat,l.lat),d=Math.max(o.lat,s.lat,a.lat,l.lat);const p=Math.pow(2,-this.zoom)/16*270,f="globe"===this.projection.name?1:4,m=(t,i,n,r,o)=>{const s=(t+n)/2,a=(i+r)/2,l=new e.Point(s,a),{lng:_,lat:g}=this.pointLocation3D(l),y=Math.max(0,c-_,h-g,_-u,g-d);c=Math.min(c,_),u=Math.max(u,_),h=Math.min(h,g),d=Math.max(d,g),(op)&&(m(t,i,s,a,o+1),m(s,a,n,r,o+1))};if(m(i,t,r,t,1),m(r,t,r,n,1),m(r,n,i,n,1),m(i,n,i,t,1),"globe"===this.projection.name){const[t,i]=e.polesInViewport(this);t?(d=90,u=180,c=-180):i&&(h=-90,u=180,c=-180)}return new e.LngLatBounds(new e.LngLat(c,h),new e.LngLat(u,d))}_getBoundsRectangular(t,i){const{top:n,left:r}=this._edgeInsets,o=this.height-this._edgeInsets.bottom,s=this.width-this._edgeInsets.right,a=new e.Point(r,n),l=new e.Point(s,n),c=new e.Point(s,o),u=new e.Point(r,o);let h=this.pointCoordinate(a,t),d=this.pointCoordinate(l,t);const p=this.pointCoordinate(c,i),f=this.pointCoordinate(u,i),m=(e,t)=>(t.y-e.y)/(t.x-e.x);return h.y>1&&d.y>=0?h=new e.MercatorCoordinate((1-f.y)/m(f,h)+f.x,1):h.y<0&&d.y<=1&&(h=new e.MercatorCoordinate(-f.y/m(f,h)+f.x,0)),d.y>1&&h.y>=0?d=new e.MercatorCoordinate((1-p.y)/m(p,d)+p.x,1):d.y<0&&h.y<=1&&(d=new e.MercatorCoordinate(-p.y/m(p,d)+p.x,0)),(new e.LngLatBounds).extend(this.coordinateLocation(h)).extend(this.coordinateLocation(d)).extend(this.coordinateLocation(f)).extend(this.coordinateLocation(p))}_getBoundsRectangularTerrain(){const e=this.elevation;if(!e.visibleDemTiles.length||e.isUsingMockSource())return this._getBoundsRectangular(0,0);const t=e.visibleDemTiles.reduce(((e,t)=>{if(t.dem){const i=t.dem.tree;e.min=Math.min(e.min,i.minimums[0]),e.max=Math.max(e.max,i.maximums[0])}return e}),{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(t.min*e.exaggeration(),t.max*e.exaggeration())}getBounds(){return"mercator"===this.projection.name||"equirectangular"===this.projection.name?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(e=!0){const t=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))+this.centerOffset.y,i=this.height/2-t*(1-this._horizonShift);return e?Math.max(0,i):i}getMaxBounds(){return this.maxBounds}setMaxBounds(t){this.maxBounds=t,this.minLat=-e.MAX_MERCATOR_LATITUDE,this.maxLat=e.MAX_MERCATOR_LATITUDE,this.minLng=-180,this.maxLng=180,t&&(this.minLat=t.getSouth(),this.maxLat=t.getNorth(),this.minLng=t.getWest(),this.maxLng=t.getEast(),this.maxLngh&&(a=h-c),h-ut&&(s=t-l),t-e.5?v-1:v,x>.5?x-1:x,0]),this.alignedProjMatrix=w,a=e.create(),e.scale(a,a,[this.width/2,-this.height/2,1]),e.translate(a,a,[1,-1,0]),this.labelPlaneMatrix=a,a=e.create(),e.scale(a,a,[1,-1,1]),e.translate(a,a,[-1,-1,0]),e.scale(a,a,[2/this.width,2/this.height,1]),this.glCoordMatrix=a,this.pixelMatrix=e.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),this._calcFogMatrices(),this._distanceTileDataCache={},a=e.invert(new Float64Array(16),this.pixelMatrix),!a)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=a,"globe"===this.projection.name||this.mercatorFromTransition){this.globeMatrix=e.calculateGlobeMatrix(this);const t=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=e.transformMat4(t,t,o),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=a;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const t=this.cameraWorldSizeForFog,i=this.cameraPixelsPerMeter,n=this._camera.position,r=1/this.height/this._pixelsPerMercatorPixel,o=[t,t,i];e.scale$2(o,o,r),e.scale$2(n,n,-1),e.multiply$2(n,n,o);const s=e.create();e.translate(s,s,n),e.scale(s,s,o),this.mercatorFogMatrix=s,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(t,i,r)}_computeCameraPosition(e){const t=(e=e||this.pixelsPerMeter)/this.pixelsPerMeter,i=this._camera.forward(),n=this.point,r=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*t-e/this.worldSize*this._centerAltitude;return[n.x/this.worldSize-i[0]*r,n.y/this.worldSize-i[1]*r,e/this.worldSize*this._centerAltitude-i[2]*r]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(t){const i=this._maxCameraBoundsDistance()*Math.cos(this._pitch),n=this._camera.position[2],r=t[2];let o=1;this.projection.wrap&&(this.center=this.center.wrap()),r>0&&(o=Math.min((i-n)/r,1)),this._camera.position=e.scaleAndAdd([],this._camera.position,t,o),this._updateStateFromCamera()}_updateStateFromCamera(){const t=this._camera.position,i=this._camera.forward(),{pitch:n,bearing:r}=this._camera.getPitchBearing(),o=e.mercatorZfromAltitude(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,s=this._mercatorZfromZoom(this._maxZoom)*Math.cos(e.degToRad(this._maxPitch)),a=Math.max((t[2]-o)/Math.cos(n),s),l=this._zoomFromMercatorZ(a);e.scaleAndAdd(t,t,i,a),this._pitch=e.clamp(n,e.degToRad(this.minPitch),e.degToRad(this.maxPitch)),this.angle=e.wrap(r,-Math.PI,Math.PI),this._setZoom(e.clamp(l,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new e.MercatorCoordinate(t[0],t[1],t[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(e){return Math.pow(2,e)*this.tileSize}_mercatorZfromZoom(e){return this.cameraToCenterDistance/this._worldSizeFromZoom(e)}_minimumHeightOverTerrain(){const e=Math.min((null!=this._seaLevelZoom?this._seaLevelZoom:this._zoom)+4,this._maxZoom);return this._mercatorZfromZoom(e)}_zoomFromMercatorZ(e){return this.scaleZoom(this.cameraToCenterDistance/(e*this.tileSize))}zoomFromMercatorZAdjusted(t){let i=0,n=e.GLOBE_ZOOM_THRESHOLD_MAX,r=0,o=1/0;for(;n-i>1e-6&&n>i;){const e=i+.5*(n-i),s=this.tileSize*Math.pow(2,e),a=this.getCameraToCenterDistance(this.projection,e,s),l=this.scaleZoom(a/(t*this.tileSize)),c=Math.abs(e-l);cc||i.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+e.radToDeg(this.fovAboveCenter)>88||this.anyCornerOffEdge(new e.Point(0,0),new e.Point(this.width,this.height))}zoomDeltaToMovement(t,i){const n=e.length(e.sub([],this._camera.position,t)),r=this._zoomFromMercatorZ(n)+i;return n-this._mercatorZfromZoom(r)}getCameraPoint(){if("globe"===this.projection.name){const t=function([t,i,n],r){const o=[t,i,n,1];e.transformMat4$1(o,o,r);const s=o[3]=Math.max(o[3],1e-6);return o[0]/=s,o[1]/=s,o[2]/=s,o}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new e.Point(t[0],t[1])}{const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new e.Point(0,t))}}getCameraToCenterDistance(e,t=this.zoom,i=this.worldSize){const n=Gn(e,t,this.width,this.height,1024),r=e.pixelSpaceConversion(this.center.lat,i,n);return.5/Math.tan(.5*this._fov)*this.height*r}getWorldToCameraMatrix(){const t=this._camera.getWorldToCamera(this.worldSize,"meters"===this.projection.zAxisUnit?this.pixelsPerMeter:1);return"globe"===this.projection.name&&e.multiply(t,t,this.globeMatrix),t}}function Kn(e,t){let i=!1,n=null;const r=()=>{n=null,i&&(e(),n=setTimeout(r,t),i=!1)};return()=>(i=!0,n||r(),n)}class Jn{constructor(t){this._hashName=t&&encodeURIComponent(t),e.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=Kn(this._updateHashUnthrottled.bind(this),300)}addTo(t){return this._map=t,e.window.addEventListener("hashchange",this._onHashChange,!1),t.on("moveend",this._updateHash),this}remove(){return this._map?(this._map.off("moveend",this._updateHash),e.window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}getHashString(){const t=this._map;if(!t)return"";const i=Yn(t);if(this._hashName){const t=this._hashName;let n=!1;const r=e.window.location.hash.slice(1).split("&").map((e=>{const r=e.split("=")[0];return r===t?(n=!0,`${r}=${i}`):e})).filter((e=>e));return n||r.push(`${t}=${i}`),`#${r.join("&")}`}return`#${i}`}_getCurrentHash(){const t=e.window.location.hash.replace("#","");if(this._hashName){let e;return t.split("&").map((e=>e.split("="))).forEach((t=>{t[0]===this._hashName&&(e=t)})),(e&&e[1]||"").split("/")}return t.split("/")}_onHashChange(){const e=this._map;if(!e)return!1;const t=this._getCurrentHash();if(t.length>=3&&!t.some((e=>isNaN(e)))){const i=e.dragRotate.isEnabled()&&e.touchZoomRotate.isEnabled()?+(t[3]||0):e.getBearing();return e.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:i,pitch:+(t[4]||0)}),!0}return!1}_updateHashUnthrottled(){const t=e.window.location.href.replace(/(#.+)?$/,this.getHashString());e.window.history.replaceState(e.window.history.state,null,t)}}function Yn(e,t){const i=e.getCenter(),n=Math.round(100*e.getZoom())/100,r=Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),o=Math.pow(10,r),s=Math.round(i.lng*o)/o,a=Math.round(i.lat*o)/o,l=e.getBearing(),c=e.getPitch();let u=t?`/${s}/${a}/${n}`:`${n}/${a}/${s}`;return(l||c)&&(u+="/"+Math.round(10*l)/10),c&&(u+=`/${Math.round(c)}`),u}const Qn={linearity:.3,easing:e.bezier(0,0,.3,1)},er=e.extend({deceleration:2500,maxSpeed:1400},Qn),tr=e.extend({deceleration:20,maxSpeed:1400},Qn),ir=e.extend({deceleration:1e3,maxSpeed:360},Qn),nr=e.extend({deceleration:1e3,maxSpeed:90},Qn);class rr{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:e.exported.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,i=e.exported.now();for(;t.length>0&&i-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._map._prefersReducedMotion())return;if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,pan:new e.Point(0,0),pinchAround:void 0,around:void 0};for(const{settings:e}of this._inertiaBuffer)i.zoom+=e.zoomDelta||0,i.bearing+=e.bearingDelta||0,i.pitch+=e.pitchDelta||0,e.panDelta&&i.pan._add(e.panDelta),e.around&&(i.around=e.around),e.pinchAround&&(i.pinchAround=e.pinchAround);const n=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,r={};if(i.pan.mag()){const o=sr(i.pan.mag(),n,e.extend({},er,t||{}));r.offset=i.pan.mult(o.amount/i.pan.mag()),r.center=this._map.transform.center,or(r,o)}if(i.zoom){const e=sr(i.zoom,n,tr);r.zoom=this._map.transform.zoom+e.amount,or(r,e)}if(i.bearing){const t=sr(i.bearing,n,ir);r.bearing=this._map.transform.bearing+e.clamp(t.amount,-179,179),or(r,t)}if(i.pitch){const e=sr(i.pitch,n,nr);r.pitch=this._map.transform.pitch+e.amount,or(r,e)}if(r.zoom||r.bearing){const e=void 0===i.pinchAround?i.around:i.pinchAround;r.around=e?this._map.unproject(e):this._map.getCenter()}return this.clear(),r.noMoveStart=!0,r}}function or(e,t){(!e.duration||e.durationi.unproject(e))),a=o.reduce(((e,t,i,n)=>e.add(t.div(n.length))),new e.Point(0,0));super(t,{points:o,point:a,lngLats:s,lngLat:i.unproject(a),originalEvent:n}),this._defaultPrevented=!1}}class cr extends e.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i){super(e,{originalEvent:i}),this._defaultPrevented=!1}}class ur{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){this._mousedownPos=void 0}wheel(e){return this._firePreventable(new cr(e.type,this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new ar(e.type,this._map,e))}mouseup(e){this._map.fire(new ar(e.type,this._map,e))}preclick(t){const i=e.extend({},t);i.type="preclick",this._map.fire(new ar(i.type,this._map,i))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||(this.preclick(e),this._map.fire(new ar(e.type,this._map,e)))}dblclick(e){return this._firePreventable(new ar(e.type,this._map,e))}mouseover(e){this._map.fire(new ar(e.type,this._map,e))}mouseout(e){this._map.fire(new ar(e.type,this._map,e))}touchstart(e){return this._firePreventable(new lr(e.type,this._map,e))}touchmove(e){this._map.fire(new lr(e.type,this._map,e))}touchend(e){this._map.fire(new lr(e.type,this._map,e))}touchcancel(e){this._map.fire(new lr(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class hr{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(e){this._map.fire(new ar(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new ar("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._map.fire(new ar(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class dr{constructor(e,t){this._map=e,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&0===e.button&&(u(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;const i=t,n=this._startPos,r=this._lastPos;if(!n||!r||r.equals(i)||!this._box&&i.dist(n){this._box&&(this._box.style.transform=`translate(${s}px,${l}px)`,this._box.style.width=a-s+"px",this._box.style.height=c-l+"px")}))}mouseupWindow(t,i){if(!this._active)return;const n=this._startPos,r=i;if(n&&0===t.button){if(this.reset(),p(),n.x!==r.x||n.y!==r.y)return this._map.fire(new e.Event("boxzoomend",{originalEvent:t})),{cameraAnimation:e=>e.fitScreenCoordinates(n,r,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",t)}}keydown(e){this._active&&27===e.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",e))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),h(),delete this._startPos,delete this._lastPos}_fireEvent(t,i){return this._map.fire(new e.Event(t,{originalEvent:i}))}}function pr(e,t){const i={};for(let n=0;nthis.numTouches)&&(this.aborted=!0),this.aborted||(0===this.startTime&&(this.startTime=t.timeStamp),n.length===this.numTouches&&(this.centroid=function(t){const i=new e.Point(0,0);for(const e of t)i._add(e);return i.div(t.length)}(i),this.touches=pr(n,i)))}touchmove(e,t,i){if(this.aborted||!this.centroid)return;const n=pr(i,t);for(const e in this.touches){const t=n[e];(!t||t.dist(this.touches[e])>30)&&(this.aborted=!0)}}touchend(e,t,i){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){const e=!this.aborted&&this.centroid;if(this.reset(),e)return e}}}class mr{constructor(e){this.singleTap=new fr(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(e,t,i){this.singleTap.touchstart(e,t,i)}touchmove(e,t,i){this.singleTap.touchmove(e,t,i)}touchend(e,t,i){const n=this.singleTap.touchend(e,t,i);if(n){const t=e.timeStamp-this.lastTime<500,i=!this.lastTap||this.lastTap.dist(n)<30;if(t&&i||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=n,this.count===this.numTaps)return this.reset(),n}}}class _r{constructor(){this._zoomIn=new mr({numTouches:1,numTaps:2}),this._zoomOut=new mr({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,i){this._zoomIn.touchstart(e,t,i),this._zoomOut.touchstart(e,t,i)}touchmove(e,t,i){this._zoomIn.touchmove(e,t,i),this._zoomOut.touchmove(e,t,i)}touchend(e,t,i){const n=this._zoomIn.touchend(e,t,i),r=this._zoomOut.touchend(e,t,i);return n?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:t.getZoom()+1,around:t.unproject(n)},{originalEvent:e})}):r?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:t.getZoom()-1,around:t.unproject(r)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const gr={0:1,2:2};class yr{constructor(e){this.reset(),this._clickTolerance=e.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(e,t){return!1}_move(e,t){return{}}mousedown(e,t){if(this._lastPoint)return;const i=_(e);this._correctButton(e,i)&&(this._lastPoint=t,this._eventButton=i)}mousemoveWindow(e,t){const i=this._lastPoint;if(i)if(e.preventDefault(),null!=this._eventButton&&function(e,t){const i=gr[t];return void 0===e.buttons||(e.buttons&i)!==i}(e,this._eventButton))this.reset();else if(this._moved||!(t.dist(i)0&&(this._active=!0);const r=pr(n,i),o=new e.Point(0,0),s=new e.Point(0,0);let a=0;for(const e in r){const t=r[e],i=this._touches[e];i&&(o._add(t),s._add(t.sub(i)),a++,r[e]=t)}if(this._touches=r,a{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.setAttribute("role","null")}),500)}}class Er{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(e){}_move(e,t,i){return{}}touchstart(e,t,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([t[0],t[1]]))}touchmove(e,t,i){const n=this._firstTwoTouches;if(!n)return;e.preventDefault();const[r,o]=n,s=Tr(i,t,r),a=Tr(i,t,o);if(!s||!a)return;const l=this._aroundCenter?null:s.add(a).div(2);return this._move([s,a],l,e)}touchend(e,t,i){if(!this._firstTwoTouches)return;const[n,r]=this._firstTwoTouches,o=Tr(i,t,n),s=Tr(i,t,r);o&&s||(this._active&&p(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Tr(e,t,i){for(let n=0;nMath.abs(e.x)}class Ir extends Er{constructor(e){super(),this._map=e}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(e){this._lastPoints=e,Ar(e[0].sub(e[1]))&&(this._valid=!1)}_move(t,i,n){const r=this._lastPoints;if(!r)return;const o=t[0].sub(r[0]),s=t[1].sub(r[1]);return this._map._cooperativeGestures&&!e.isFullscreen()&&n.touches.length<3||(this._valid=this.gestureBeginsVertically(o,s,n.timeStamp),!this._valid)?void 0:(this._lastPoints=t,this._active=!0,{pitchDelta:(o.y+s.y)/2*-.5})}gestureBeginsVertically(e,t,i){if(void 0!==this._valid)return this._valid;const n=e.mag()>=2,r=t.mag()>=2;if(!n&&!r)return;if(!n||!r)return null==this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;const o=e.y>0==t.y>0;return Ar(e)&&Ar(t)&&o}}const Pr={panStep:100,bearingStep:15,pitchStep:10};class Lr{constructor(){const e=Pr;this._panStep=e.panStep,this._bearingStep=e.bearingStep,this._pitchStep=e.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=0,i=0,n=0,r=0,o=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t=1;break;case 189:case 109:case 173:t=-1;break;case 37:e.shiftKey?i=-1:(e.preventDefault(),r=-1);break;case 39:e.shiftKey?i=1:(e.preventDefault(),r=1);break;case 38:e.shiftKey?n=1:(e.preventDefault(),o=-1);break;case 40:e.shiftKey?n=-1:(e.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(i=0,n=0),{cameraAnimation:s=>{const a=s.getZoom();s.easeTo({duration:300,easeId:"keyboardHandler",easing:Dr,zoom:t?Math.round(a)+t*(e.shiftKey?2:1):a,bearing:s.getBearing()+i*this._bearingStep,pitch:s.getPitch()+n*this._pitchStep,offset:[-r*this._panStep,-o*this._panStep],center:s.getCenter()},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Dr(e){return e*(2-e)}const zr=4.000244140625;class Or{constructor(t,i){this._map=t,this._el=t.getCanvasContainer(),this._handler=i,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,e.bindAll(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around,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()||e.isFullscreen()))return void this._showBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let i=t.deltaMode===e.window.WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const n=e.exported.now(),r=n-(this._lastWheelEventTime||0);this._lastWheelEventTime=n,0!==i&&i%zr==0?this._type="wheel":0!==i&&Math.abs(i)<4?this._type="trackpad":r>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(r*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),t.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=t,this._delta-=i,this._active||this._start(t)),t.preventDefault()}_onTimeout(e){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const t=f(this._el,e);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:t,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const t=this._map.transform;"wheel"===this._type&&t.projection.wrap&&(t._center.lng>=180||t._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const i=()=>t._terrainEnabled()&&this._aroundCoord?t.computeZoomRelativeTo(this._aroundCoord):t.zoom;if(0!==this._delta){const e="wheel"===this._type&&Math.abs(this._delta)>zr?this._wheelZoomRate:this._defaultZoomRate;let n=2/(1+Math.exp(-Math.abs(this._delta*e)));this._delta<0&&0!==n&&(n=1/n);const r=i(),o=Math.pow(2,r),s="number"==typeof this._targetZoom?t.zoomScale(this._targetZoom):o;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(s*n))),"wheel"===this._type&&(this._startZoom=r,this._easing=this._smoothOutEasing(200)),this._delta=0}const n="number"==typeof this._targetZoom?this._targetZoom:i(),r=this._startZoom,o=this._easing;let s,a=!1;if("wheel"===this._type&&r&&o){const t=Math.min((e.exported.now()-this._lastWheelEventTime)/200,1),i=o(t);s=e.number(r,n,i),t<1?this._frameId||(this._frameId=!0):a=!0}else s=n,a=!0;return this._active=!0,a&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout}),200)),{noInertia:!0,needsRenderFrame:!a,zoomDelta:s-i(),around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let i=e.ease;if(this._prevEase){const t=this._prevEase,n=(e.exported.now()-t.start)/t.duration,r=t.easing(n+.01)-t.easing(n),o=.27/Math.sqrt(r*r+1e-4)*.01,s=Math.sqrt(.0729-o*o);i=e.bezier(o,s,.25,1)}return this._prevEase={start:e.exported.now(),duration:t,easing:i},i}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=o("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(e.window.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=setTimeout((()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","null")}),200)}}class Br{constructor(e,t){this._clickZoom=e,this._tapZoom=t}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 Rr{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(e,t){return e.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:i.getZoom()+(e.shiftKey?-1:1),around:i.unproject(t)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Fr{constructor(){this._tap=new mr({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(e,t,i){this._swipePoint||(this._tapTime&&e.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?i.length>0&&(this._swipePoint=t[0],this._swipeTouch=i[0].identifier):this._tap.touchstart(e,t,i))}touchmove(e,t,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;const n=t[0],r=n.y-this._swipePoint.y;return this._swipePoint=n,e.preventDefault(),this._active=!0,{zoomDelta:r/128}}}else this._tap.touchmove(e,t,i)}touchend(e,t,i){this._tapTime?this._swipePoint&&0===i.length&&this.reset():this._tap.touchend(e,t,i)&&(this._tapTime=e.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ur{constructor(e,t,i){this._el=e,this._mousePan=t,this._touchPan=i}enable(e){this._inertiaOptions=e||{},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 jr{constructor(e,t,i){this._pitchWithRotate=e.pitchWithRotate,this._mouseRotate=t,this._mousePitch=i}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 Vr{constructor(e,t,i,n){this._el=e,this._touchZoom=t,this._touchRotate=i,this._tapDragZoom=n,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("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 Nr=e=>e.zoom||e.drag||e.pitch||e.rotate;class $r extends e.Event{}class qr{constructor(){this.constants=[1,1,.01],this.radius=0}setup(t,i){const n=e.sub([],i,t);this.radius=e.length(n[2]<0?e.div([],n,this.constants):[n[0],n[1],0])}projectRay(t){e.div(t,t,this.constants),e.normalize(t,t),e.mul$1(t,t,this.constants);const i=e.scale$2([],t,this.radius);if(i[2]>0){const t=e.scale$2([],[0,0,1],e.dot(i,[0,0,1])),n=e.scale$2([],e.normalize([],[i[0],i[1],0]),this.radius),r=e.add([],i,e.scale$2([],e.sub([],e.add([],n,t),i),2));i[0]=r[0],i[1]=r[1]}return i}}function Gr(e){return e.panDelta&&e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta}class Zr{constructor(t,i){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new rr(t),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new qr,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(i),e.bindAll(["handleEvent","handleWindowEvent"],this);const n=this._el;this._listeners=[[n,"touchstart",{passive:!0}],[n,"touchmove",{passive:!1}],[n,"touchend",void 0],[n,"touchcancel",void 0],[n,"mousedown",void 0],[n,"mousemove",void 0],[n,"mouseup",void 0],[e.window.document,"mousemove",{capture:!0}],[e.window.document,"mouseup",void 0],[n,"mouseover",void 0],[n,"mouseout",void 0],[n,"dblclick",void 0],[n,"click",void 0],[n,"keydown",{capture:!1}],[n,"keyup",void 0],[n,"wheel",{passive:!1}],[n,"contextmenu",void 0],[e.window,"blur",void 0]];for(const[t,i,n]of this._listeners)t.addEventListener(i,t===e.window.document?this.handleWindowEvent:this.handleEvent,n)}destroy(){for(const[t,i,n]of this._listeners)t.removeEventListener(i,t===e.window.document?this.handleWindowEvent:this.handleEvent,n)}_addDefaultHandlers(e){const t=this._map,i=t.getCanvasContainer();this._add("mapEvent",new ur(t,e));const n=t.boxZoom=new dr(t,e);this._add("boxZoom",n);const r=new _r,o=new Rr;t.doubleClickZoom=new Br(o,r),this._add("tapZoom",r),this._add("clickZoom",o);const s=new Fr;this._add("tapDragZoom",s);const a=t.touchPitch=new Ir(t);this._add("touchPitch",a);const l=new vr(e),c=new xr(e);t.dragRotate=new jr(e,l,c),this._add("mouseRotate",l,["mousePitch"]),this._add("mousePitch",c,["mouseRotate"]);const u=new br(e),h=new wr(t,e);t.dragPan=new Ur(i,u,h),this._add("mousePan",u),this._add("touchPan",h,["touchZoom","touchRotate"]);const d=new Mr,p=new Cr;t.touchZoomRotate=new Vr(i,p,d,s),this._add("touchRotate",d,["touchPan","touchZoom"]),this._add("touchZoom",p,["touchPan","touchRotate"]),this._add("blockableMapEvent",new hr(t));const f=t.scrollZoom=new Or(t,this);this._add("scrollZoom",f,["mousePan"]);const m=t.keyboard=new Lr;this._add("keyboard",m);for(const i of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])e.interactive&&e[i]&&t[i].enable(e[i])}_add(e,t,i){this._handlers.push({handlerName:e,handler:t,allowed:i}),this._handlersById[e]=t}stop(e){if(!this._updatingCamera){for(const{handler:e}of this._handlers)e.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(const{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Nr(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(e,t,i){for(const n in e)if(n!==i&&(!t||t.indexOf(n)<0))return!0;return!1}handleWindowEvent(e){this.handleEvent(e,`${e.type}Window`)}_getMapTouches(e){const t=[];for(const i of e)this._el.contains(i.target)&&t.push(i);return t}handleEvent(e,t){this._updatingCamera=!0;const i="renderFrame"===e.type,n=i?void 0:e,r={needsRenderFrame:!1},o={},s={},a=e.touches?this._getMapTouches(e.touches):void 0,l=a?m(this._el,a):i?void 0:f(this._el,e);for(const{handlerName:i,handler:c,allowed:u}of this._handlers){if(!c.isEnabled())continue;let h;this._blockedByActive(s,u,i)?c.reset():c[t||e.type]&&(h=c[t||e.type](e,l,a),this.mergeHandlerResult(r,o,h,i,n),h&&h.needsRenderFrame&&this._triggerRenderFrame()),(h||c.isActive())&&(s[i]=c)}const c={};for(const e in this._previousActiveHandlers)s[e]||(c[e]=n);this._previousActiveHandlers=s,(Object.keys(c).length||Gr(r))&&(this._changes.push([r,o,c]),this._triggerRenderFrame()),(Object.keys(s).length||Gr(r))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:u}=r;u&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],u(this._map))}mergeHandlerResult(t,i,n,r,o){if(!n)return;e.extend(t,n);const s={handlerName:r,originalEvent:n.originalEvent||o};void 0!==n.zoomDelta&&(i.zoom=s),void 0!==n.panDelta&&(i.drag=s),void 0!==n.pitchDelta&&(i.pitch=s),void 0!==n.bearingDelta&&(i.rotate=s)}_applyChanges(){const t={},i={},n={};for(const[r,o,s]of this._changes)r.panDelta&&(t.panDelta=(t.panDelta||new e.Point(0,0))._add(r.panDelta)),r.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+r.zoomDelta),r.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+r.bearingDelta),r.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+r.pitchDelta),void 0!==r.around&&(t.around=r.around),void 0!==r.aroundCoord&&(t.aroundCoord=r.aroundCoord),void 0!==r.pinchAround&&(t.pinchAround=r.pinchAround),r.noInertia&&(t.noInertia=r.noInertia),e.extend(i,o),e.extend(n,s);this._updateMapTransform(t,i,n),this._changes=[]}_updateMapTransform(t,i,n){const r=this._map,o=r.transform,s=e=>[e.x,e.y,e.z];if((e=>{const t=this._eventsInProgress.drag;return t&&!this._handlersById[t.handlerName].isActive()})()&&!Gr(t)){const e=o.zoom;o.cameraElevationReference="sea",o.recenterOnTerrain(),o.cameraElevationReference="ground",e!==o.zoom&&this._map._update(!0)}if(o._isCameraConstrained&&r._stop(!0),!Gr(t))return void this._fireEvents(i,n,!0);let{panDelta:a,zoomDelta:l,bearingDelta:c,pitchDelta:u,around:h,aroundCoord:d,pinchAround:p}=t;o._isCameraConstrained&&(l>0&&(l=0),o._isCameraConstrained=!1),void 0!==p&&(h=p),(l||(e=>i[e]&&!this._eventsInProgress[e])("drag"))&&h&&(this._dragOrigin=s(o.pointCoordinate3D(h)),this._trackingEllipsoid.setup(o._camera.position,this._dragOrigin)),o.cameraElevationReference="sea",r._stop(!0),h=h||r.transform.centerPoint,c&&(o.bearing+=c),u&&(o.pitch+=u),o._updateCameraState();const f=[0,0,0];if(a)if("mercator"===o.projection.name){const e=this._trackingEllipsoid.projectRay(o.screenPointToMercatorRay(h).dir),t=this._trackingEllipsoid.projectRay(o.screenPointToMercatorRay(h.sub(a)).dir);f[0]=t[0]-e[0],f[1]=t[1]-e[1]}else{const t=o.pointCoordinate(h);if("globe"===o.projection.name){a=a.rotate(-o.angle);const i=o._pixelsPerMercatorPixel/o.worldSize;f[0]=-a.x*e.mercatorScale(e.latFromMercatorY(t.y))*i,f[1]=-a.y*e.mercatorScale(o.center.lat)*i}else{const e=o.pointCoordinate(h.sub(a));t&&e&&(f[0]=e.x-t.x,f[1]=e.y-t.y)}}const m=o.zoom,_=[0,0,0];if(l){const t=s(d||o.pointCoordinate3D(h)),i={dir:e.normalize([],e.sub([],t,o._camera.position))};if(i.dir[2]<0){const n=o.zoomDeltaToMovement(t,l);e.scale$2(_,i.dir,n)}}const g=e.add(f,f,_);o._translateCameraConstrained(g),l&&Math.abs(o.zoom-m)>1e-4&&o.recenterOnTerrain(),o.cameraElevationReference="ground",this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(i,n,!0)}_fireEvents(t,i,n){const r=Nr(this._eventsInProgress),o=Nr(t),s={};for(const e in t){const{originalEvent:i}=t[e];this._eventsInProgress[e]||(s[`${e}start`]=i),this._eventsInProgress[e]=t[e]}!r&&o&&this._fireEvent("movestart",o.originalEvent);for(const e in s)this._fireEvent(e,s[e]);o&&this._fireEvent("move",o.originalEvent);for(const e in t){const{originalEvent:i}=t[e];this._fireEvent(e,i)}const a={};let l;for(const e in this._eventsInProgress){const{handlerName:t,originalEvent:n}=this._eventsInProgress[e];this._handlersById[t].isActive()||(delete this._eventsInProgress[e],l=i[t]||n,a[`${e}end`]=l)}for(const e in a)this._fireEvent(e,a[e]);const c=Nr(this._eventsInProgress);if(n&&(r||o)&&!c){this._updatingCamera=!0;const t=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),i=e=>0!==e&&-this._bearingSnap{this._frameId=void 0,this.handleEvent(new $r("renderFrame",{timeStamp:e})),this._applyChanges()}))}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}const Wr="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class Hr extends e.Evented{constructor(t,i){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=i.bearingSnap,this._respectPrefersReducedMotion=!1!==i.respectPrefersReducedMotion,e.bindAll(["_renderFrameCallback"],this)}getCenter(){return new e.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t){return this.jumpTo({center:e},t)}panBy(t,i,n){return t=e.Point.convert(t).mult(-1),this.panTo(this.transform.center,e.extend({offset:t},i),n)}panTo(t,i,n){return this.easeTo(e.extend({center:t},i),n)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(t,i,n){return this.easeTo(e.extend({zoom:t},i),n)}zoomIn(e,t){return this.zoomTo(this.getZoom()+1,e,t),this}zoomOut(e,t){return this.zoomTo(this.getZoom()-1,e,t),this}getBearing(){return this.transform.bearing}setBearing(e,t){return this.jumpTo({bearing:e},t),this}getPadding(){return this.transform.padding}setPadding(e,t){return this.jumpTo({padding:e},t),this}rotateTo(t,i,n){return this.easeTo(e.extend({bearing:t},i),n)}resetNorth(t,i){return this.rotateTo(0,e.extend({duration:1e3},t),i),this}resetNorthPitch(t,i){return this.easeTo(e.extend({bearing:0,pitch:0,duration:1e3},t),i),this}snapToNorth(e,t){return Math.abs(this.getBearing())e.aspect?i/(2*Math.tan(.5*e.fovX)*e.aspect):n/(2*Math.tan(.5*e.fovY)*e.aspect)}_cameraForBoundsOnGlobe(t,i,n,r,o,s){const a=t.clone(),l=this._extendCameraOptions(s);a.bearing=r,a.pitch=o;const c=e.LngLat.convert(i),u=e.LngLat.convert(n),h=.5*(c.lat+u.lat),d=.5*(c.lng+u.lng),p=e.latLngToECEF(h,d),f=e.normalize([],p),m=e.normalize([],e.cross([],f,[0,1,0])),_=e.cross([],m,f),g=[m[0],m[1],m[2],0,_[0],_[1],_[2],0,f[0],f[1],f[2],0,0,0,0,1],y=[p,e.latLngToECEF(c.lat,c.lng),e.latLngToECEF(u.lat,c.lng),e.latLngToECEF(u.lat,u.lng),e.latLngToECEF(c.lat,u.lng),e.latLngToECEF(h,c.lng),e.latLngToECEF(h,u.lng),e.latLngToECEF(c.lat,d),e.latLngToECEF(u.lat,d)];let b=e.Aabb.fromPoints(y.map((t=>[e.dot(m,t),e.dot(_,t),e.dot(f,t)])));const v=e.transformMat4([],b.center,g);0===e.squaredLength(v)&&e.set(v,0,0,1),e.normalize(v,v),e.scale$2(v,v,e.GLOBE_RADIUS),a.center=e.ecefToLatLng(v);const x=a.getWorldToCameraMatrix(),w=e.invert(new Float64Array(16),x);b=e.Aabb.applyTransform(b,e.multiply([],x,g)),e.transformMat4(v,v,x);const E=.5*(b.max[2]-b.min[2]),T=this._minimumAABBFrustumDistance(a,b),k=e.scale$2([],[0,0,1],E),C=e.add(k,v,k),S=T+(0===a.pitch?0:e.distance(v,C)),M=a.globeCenterInViewSpace,A=e.sub([],v,[M[0],M[1],M[2]]);e.normalize(A,A),e.scale$2(A,A,S);const I=e.add([],v,A);e.transformMat4(I,I,w);const P=e.earthRadius/e.GLOBE_RADIUS,L=e.length(I),D=e.mercatorZfromAltitude(Math.max(L*P-e.earthRadius,Number.EPSILON),0),z=Math.min(a.zoomFromMercatorZAdjusted(D),l.maxZoom);return z>.5*(e.GLOBE_ZOOM_THRESHOLD_MIN+e.GLOBE_ZOOM_THRESHOLD_MAX)?(a.setProjection({name:"mercator"}),a.zoom=z,this._cameraForBounds(a,i,n,r,o,s)):{center:a.center,zoom:z,bearing:r,pitch:o}}queryTerrainElevation(t,i){const n=this.transform.elevation;return n?(i=e.extend({},{exaggerated:!0},i),n.getAtPoint(e.MercatorCoordinate.fromLngLat(t),null,i.exaggerated)):null}_cameraForBounds(t,i,n,r,o,s){if("globe"===t.projection.name)return this._cameraForBoundsOnGlobe(t,i,n,r,o,s);const a=t.clone(),l=this._extendCameraOptions(s),c=a.padding;a.bearing=r,a.pitch=o;const u=e.LngLat.convert(i),h=e.LngLat.convert(n),d=new e.LngLat(u.lng,h.lat),p=new e.LngLat(h.lng,u.lat),f=a.project(u),m=a.project(h),_=this.queryTerrainElevation(u),g=this.queryTerrainElevation(h),y=this.queryTerrainElevation(d),b=this.queryTerrainElevation(p),v=[[f.x,f.y,Math.min(_||0,g||0,y||0,b||0)],[m.x,m.y,Math.max(_||0,g||0,y||0,b||0)]];let x=e.Aabb.fromPoints(v);const w=a.getWorldToCameraMatrix(),E=e.invert(new Float64Array(16),w);x=e.Aabb.applyTransform(x,w);const T=e.sub([],x.max,x.min),k=c.left||0,C=c.right||0,S=c.bottom||0,M=c.top||0,{left:A,right:I,top:P,bottom:L}=l.padding,D=.5*(k+C),z=.5*(M+S),O=Math.min(a.scaleZoom(a.scale*Math.min((a.width-(k+C+A+I))/T[0],(a.height-(S+M+L+P))/T[1])),l.maxZoom),B=a.scale/a.zoomScale(O);x=new e.Aabb([x.min[0]-(A+D)*B,x.min[1]-(L+z)*B,x.min[2]],[x.max[0]+(I+D)*B,x.max[1]+(P+z)*B,x.max[2]]);const R=.5*T[2],F=this._minimumAABBFrustumDistance(a,x),U=[0,0,1,0];e.transformMat4$1(U,U,w),e.normalize$2(U,U);const j=e.scale$2([],U,F+R),V=e.add([],x.center,j),N=("number"==typeof l.offset.x&&"number"==typeof l.offset.y?new e.Point(l.offset.x,l.offset.y):e.Point.convert(l.offset)).rotate(-e.degToRad(r));x.center[0]-=N.x*B,x.center[1]+=N.y*B,e.transformMat4(x.center,x.center,E),e.transformMat4(V,V,E);const $=[x.center[0],x.center[1],V[2]*a.pixelsPerMeter];e.scale$2($,$,1/a.worldSize);const q=e.lngFromMercatorX($[0]),G=e.latFromMercatorY($[1]),Z=Math.min(a._zoomFromMercatorZ($[2]),l.maxZoom),W=new e.LngLat(q,G);return a.mercatorFromTransition&&Z<.5*(e.GLOBE_ZOOM_THRESHOLD_MIN+e.GLOBE_ZOOM_THRESHOLD_MAX)?(a.setProjection({name:"globe"}),a.zoom=Z,this._cameraForBounds(a,i,n,r,o,s)):{center:W,zoom:Z,bearing:r,pitch:o}}fitBounds(e,t,i){const n=this.cameraForBounds(e,t);return this._fitInternal(n,t,i)}fitScreenCoordinates(t,i,n,r,o){const s=e.Point.convert(t),a=e.Point.convert(i),l=new e.Point(Math.min(s.x,a.x),Math.min(s.y,a.y)),c=new e.Point(Math.max(s.x,a.x),Math.max(s.y,a.y));if("mercator"===this.transform.projection.name&&this.transform.anyCornerOffEdge(s,a))return this;const u=this.transform.pointLocation3D(l),h=this.transform.pointLocation3D(c),d=this.transform.pointLocation3D(new e.Point(l.x,c.y)),p=this.transform.pointLocation3D(new e.Point(c.x,l.y)),f=[Math.min(u.lng,h.lng,d.lng,p.lng),Math.min(u.lat,h.lat,d.lat,p.lat)],m=[Math.max(u.lng,h.lng,d.lng,p.lng),Math.max(u.lat,h.lat,d.lat,p.lat)],_=r&&r.pitch?r.pitch:this.getPitch(),g=this._cameraForBounds(this.transform,f,m,n,_,r);return this._fitInternal(g,r,o)}_fitInternal(t,i,n){return t?(delete(i=e.extend(t,i)).padding,i.linear?this.easeTo(i,n):this.flyTo(i,n)):this}jumpTo(t,i){this.stop();const n=t.preloadOnly?this.transform.clone():this.transform;let r=!1,o=!1,s=!1;return"zoom"in t&&n.zoom!==+t.zoom&&(r=!0,n.zoom=+t.zoom),void 0!==t.center&&(n.center=e.LngLat.convert(t.center)),"bearing"in t&&n.bearing!==+t.bearing&&(o=!0,n.bearing=+t.bearing),"pitch"in t&&n.pitch!==+t.pitch&&(s=!0,n.pitch=+t.pitch),null==t.padding||n.isPaddingEqual(t.padding)||(n.padding=t.padding),t.preloadOnly?(this._preloadTiles(n),this):(this.fire(new e.Event("movestart",i)).fire(new e.Event("move",i)),r&&this.fire(new e.Event("zoomstart",i)).fire(new e.Event("zoom",i)).fire(new e.Event("zoomend",i)),o&&this.fire(new e.Event("rotatestart",i)).fire(new e.Event("rotate",i)).fire(new e.Event("rotateend",i)),s&&this.fire(new e.Event("pitchstart",i)).fire(new e.Event("pitch",i)).fire(new e.Event("pitchend",i)),this.fire(new e.Event("moveend",i)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||e.warnOnce(Wr),this.transform.getFreeCameraOptions()}setFreeCameraOptions(t,i){const n=this.transform;if(!n.projection.supportsFreeCamera)return e.warnOnce(Wr),this;this.stop();const r=n.zoom,o=n.pitch,s=n.bearing;n.setFreeCameraOptions(t);const a=r!==n.zoom,l=o!==n.pitch,c=s!==n.bearing;return this.fire(new e.Event("movestart",i)).fire(new e.Event("move",i)),a&&this.fire(new e.Event("zoomstart",i)).fire(new e.Event("zoom",i)).fire(new e.Event("zoomend",i)),c&&this.fire(new e.Event("rotatestart",i)).fire(new e.Event("rotate",i)).fire(new e.Event("rotateend",i)),l&&this.fire(new e.Event("pitchstart",i)).fire(new e.Event("pitch",i)).fire(new e.Event("pitchend",i)),this.fire(new e.Event("moveend",i)),this}easeTo(t,i){this._stop(!1,t.easeId),(!1===(t=e.extend({offset:[0,0],duration:500,easing:e.ease},t)).animate||this._prefersReducedMotion(t))&&(t.duration=0);const n=this.transform,r=this.getZoom(),o=this.getBearing(),s=this.getPitch(),a=this.getPadding(),l="zoom"in t?+t.zoom:r,c="bearing"in t?this._normalizeBearing(t.bearing,o):o,u="pitch"in t?+t.pitch:s,h="padding"in t?t.padding:n.padding,d=e.Point.convert(t.offset);let p,f,m;if("globe"===n.projection.name){const i=e.MercatorCoordinate.fromLngLat(n.center),r=d.rotate(-n.angle);i.x+=r.x/n.worldSize,i.y+=r.y/n.worldSize;const o=i.toLngLat(),s=e.LngLat.convert(t.center||o);this._normalizeCenter(s),p=n.centerPoint.add(r),f=new e.Point(i.x,i.y).mult(n.worldSize),m=new e.Point(e.mercatorXfromLng(s.lng),e.mercatorYfromLat(s.lat)).mult(n.worldSize).sub(f)}else{p=n.centerPoint.add(d);const i=n.pointLocation(p),r=e.LngLat.convert(t.center||i);this._normalizeCenter(r),f=n.project(i),m=n.project(r).sub(f)}const _=n.zoomScale(l-r);let g,y;t.around&&(g=e.LngLat.convert(t.around),y=n.locationPoint(g));const b=this._zooming||l!==r,v=this._rotating||o!==c,x=this._pitching||u!==s,w=!n.isPaddingEqual(h),E=n=>E=>{if(b&&(n.zoom=e.number(r,l,E)),v&&(n.bearing=e.number(o,c,E)),x&&(n.pitch=e.number(s,u,E)),w&&(n.interpolatePadding(a,h,E),p=n.centerPoint.add(d)),g)n.setLocationAtPoint(g,y);else{const e=n.zoomScale(n.zoom-r),t=l>r?Math.min(2,_):Math.max(.5,_),i=Math.pow(t,1-E),o=n.unproject(f.add(m.mult(E*i)).mult(e));n.setLocationAtPoint(n.renderWorldCopies?o.wrap():o,p)}return t.preloadOnly||this._fireMoveEvents(i),n};if(t.preloadOnly){const e=this._emulate(E,t.duration,n);return this._preloadTiles(e),this}const T={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=b,this._rotating=v,this._pitching=x,this._padding=w,this._easeId=t.easeId,this._prepareEase(i,t.noMoveStart,T),this._ease(E(n),(e=>{n.recenterOnTerrain(),this._afterEase(i,e)}),t),this}_prepareEase(t,i,n={}){this._moving=!0,this.transform.cameraElevationReference="sea",i||n.moving||this.fire(new e.Event("movestart",t)),this._zooming&&!n.zooming&&this.fire(new e.Event("zoomstart",t)),this._rotating&&!n.rotating&&this.fire(new e.Event("rotatestart",t)),this._pitching&&!n.pitching&&this.fire(new e.Event("pitchstart",t))}_fireMoveEvents(t){this.fire(new e.Event("move",t)),this._zooming&&this.fire(new e.Event("zoom",t)),this._rotating&&this.fire(new e.Event("rotate",t)),this._pitching&&this.fire(new e.Event("pitch",t))}_afterEase(t,i){if(this._easeId&&i&&this._easeId===i)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const n=this._zooming,r=this._rotating,o=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,n&&this.fire(new e.Event("zoomend",t)),r&&this.fire(new e.Event("rotateend",t)),o&&this.fire(new e.Event("pitchend",t)),this.fire(new e.Event("moveend",t))}flyTo(t,i){if(this._prefersReducedMotion(t)){const n=e.pick(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(n,i)}this.stop(),t=e.extend({offset:[0,0],speed:1.2,curve:1.42,easing:e.ease},t);const n=this.transform,r=this.getZoom(),o=this.getBearing(),s=this.getPitch(),a=this.getPadding(),l="zoom"in t?e.clamp(+t.zoom,n.minZoom,n.maxZoom):r,c="bearing"in t?this._normalizeBearing(t.bearing,o):o,u="pitch"in t?+t.pitch:s,h="padding"in t?t.padding:n.padding,d=n.zoomScale(l-r),p=e.Point.convert(t.offset);let f=n.centerPoint.add(p);const m=n.pointLocation(f),_=e.LngLat.convert(t.center||m);this._normalizeCenter(_);const g=n.project(m),y=n.project(_).sub(g);let b=t.curve;const v=Math.max(n.width,n.height),x=v/d,w=y.mag();if("minZoom"in t){const i=e.clamp(Math.min(t.minZoom,r,l),n.minZoom,n.maxZoom),o=v/n.zoomScale(i-r);b=Math.sqrt(o/w*2)}const E=b*b;function T(e){const t=(x*x-v*v+(e?-1:1)*E*E*w*w)/(2*(e?x:v)*E*w);return Math.log(Math.sqrt(t*t+1)-t)}function k(e){return(Math.exp(e)-Math.exp(-e))/2}function C(e){return(Math.exp(e)+Math.exp(-e))/2}const S=T(0);let M=function(e){return C(S)/C(S+b*e)},A=function(e){return v*((C(S)*(k(t=S+b*e)/C(t))-k(S))/E)/w;var t},I=(T(1)-S)/b;if(Math.abs(w)<1e-6||!isFinite(I)){if(Math.abs(v-x)<1e-6)return this.easeTo(t,i);const e=xt.maxDuration&&(t.duration=0);const P=o!==c,L=u!==s,D=!n.isPaddingEqual(h),z=n=>d=>{const m=d*I,b=1/M(m);n.zoom=1===d?l:r+n.scaleZoom(b),P&&(n.bearing=e.number(o,c,d)),L&&(n.pitch=e.number(s,u,d)),D&&(n.interpolatePadding(a,h,d),f=n.centerPoint.add(p));const v=1===d?_:n.unproject(g.add(y.mult(A(m))).mult(b));return n.setLocationAtPoint(n.renderWorldCopies?v.wrap():v,f),n._updateCameraOnTerrain(),t.preloadOnly||this._fireMoveEvents(i),n};if(t.preloadOnly){const e=this._emulate(z,t.duration,n);return this._preloadTiles(e),this}return this._zooming=!0,this._rotating=P,this._pitching=L,this._padding=D,this._prepareEase(i,!1),this._ease(z(n),(()=>this._afterEase(i)),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,t){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const e=this._onEaseEnd;this._onEaseEnd=void 0,e.call(this,t)}if(!e){const e=this.handlers;e&&e.stop(!1)}return this}_ease(t,i,n){!1===n.animate||0===n.duration?(t(1),i()):(this._easeStart=e.exported.now(),this._easeOptions=n,this._onEaseFrame=t,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((e.exported.now()-this._easeStart)/this._easeOptions.duration,1),i=this._onEaseFrame;i&&i(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,i){t=e.wrap(t,-180,180);const n=Math.abs(t-i);return Math.abs(t-360-i)180?-360:i<-180?360:0}_prefersReducedMotion(t){return this._respectPrefersReducedMotion&&e.exported.prefersReducedMotion&&!(t&&t.essential)}_emulate(e,t,i){const n=Math.ceil(15*t/1e3),r=[],o=e(i.clone());for(let e=0;e<=n;e++){const t=o(e/n);r.push(t.clone())}return r}}class Xr{constructor(t={}){this.options=t,e.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(e){const t=this.options&&this.options.compact;return this._map=e,this._container=o("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=o("button","mapboxgl-ctrl-attrib-button",this._container),o("span","mapboxgl-ctrl-icon",this._compactButton).setAttribute("aria-hidden","true"),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=o("div","mapboxgl-ctrl-attrib-inner",this._container),this._innerContainer.setAttribute("role","list"),t&&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),void 0===t&&(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}_setElementTitle(e,t){const i=this._map._getUIString(`AttributionControl.${t}`);e.setAttribute("aria-label",i),e.removeAttribute("title"),e.firstElementChild&&e.firstElementChild.setAttribute("title",i)}_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 i=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||e.config.ACCESS_TOKEN}];if(t){const n=i.reduce(((e,t,n)=>(t.value&&(e+=`${t.key}=${t.value}${ne.length-t.length)),e=e.filter(((t,i)=>{for(let n=i+1;n=0)return!1;return!0})),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=[...this.options.customAttribution,...e]:e.unshift(this.options.customAttribution));const i=e.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,e.length?(this._innerContainer.innerHTML=i,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 Kr{constructor(){e.bindAll(["_updateLogo","_updateCompact"],this)}onAdd(e){this._map=e,this._container=o("div","mapboxgl-ctrl");const t=o("a","mapboxgl-ctrl-logo");return t.target="_blank",t.rel="noopener nofollow",t.href="https://www.mapbox.com/",t.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),t.setAttribute("rel","noopener nofollow"),this._container.appendChild(t),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(e){e&&"metadata"!==e.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const e=this._map.style._sourceCaches;if(0===Object.entries(e).length)return!0;for(const t in e){const i=e[t].getSource();if(i.hasOwnProperty("mapbox_logo")&&!i.mapbox_logo)return!1}return!0}_updateCompact(){const e=this._container.children;if(e.length){const t=e[0];this._map.getCanvasContainer().offsetWidth<250?t.classList.add("mapboxgl-compact"):t.classList.remove("mapboxgl-compact")}}}class Jr{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}remove(e){const t=this._currentlyRunning,i=t?this._queue.concat(t):this._queue;for(const t of i)if(t.id===e)return void(t.cancelled=!0)}run(e=0){const t=this._currentlyRunning=this._queue;this._queue=[];for(const i of t)if(!i.cancelled&&(i.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}function Yr(t,i,n){if(t=new e.LngLat(t.lng,t.lat),i){const r=new e.LngLat(t.lng-360,t.lat),o=new e.LngLat(t.lng+360,t.lat),s=360*Math.ceil(Math.abs(t.lng-n.center.lng)/360),a=n.locationPoint(t).distSqr(i),l=i.x<0||i.y<0||i.x>n.width||i.y>n.height;n.locationPoint(r).distSqr(i)180;){const e=n.locationPoint(t);if(e.x>=0&&e.y>=0&&e.x<=n.width&&e.y<=n.height)break;t.lng>n.center.lng?t.lng-=360:t.lng+=360}return t}const Qr={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%)"};class eo extends e.Evented{constructor(t,i){if(super(),(t instanceof e.window.HTMLElement||i)&&(t=e.extend({element:t},i)),e.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this),this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment||"auto",this._updateMoving=()=>this._update(!0),this._occludedOpacity=t&&t.occludedOpacity||.2,t&&t.element)this._element=t.element,this._offset=e.Point.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=o("div");const i=41,n=27,r=s("svg",{display:"block",height:i*this._scale+"px",width:n*this._scale+"px",viewBox:`0 0 ${n} ${i}`},this._element),a=s("radialGradient",{id:"shadowGradient"},s("defs",{},r));s("stop",{offset:"10%","stop-opacity":.4},a),s("stop",{offset:"100%","stop-opacity":.05},a),s("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},r),s("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"},r),s("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"},r),s("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},r),this._offset=e.Point.convert(t&&t.offset||[0,-14])}this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",(e=>{e.preventDefault()})),this._element.addEventListener("mousedown",(e=>{e.preventDefault()}));const n=this._element.classList;for(const e in Qr)n.remove(`mapboxgl-marker-anchor-${e}`);n.add(`mapboxgl-marker-anchor-${this._anchor}`),this._popup=null}addTo(e){return e===this._map||(this.remove(),this._map=e,e.getCanvasContainer().appendChild(this._element),e.on("move",this._updateMoving),e.on("moveend",this._update),e.on("remove",this._clearFadeTimer),e._addMarker(this),this.setDraggable(this._draggable),this._update(),e.on("click",this._onMapClick)),this}remove(){const e=this._map;return e&&(e.off("click",this._onMapClick),e.off("move",this._updateMoving),e.off("moveend",this._update),e.off("mousedown",this._addDragHandler),e.off("touchstart",this._addDragHandler),e.off("mouseup",this._onUp),e.off("touchend",this._onUp),e.off("mousemove",this._onMove),e.off("touchmove",this._onMove),e.off("remove",this._clearFadeTimer),e._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=e.LngLat.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}getElement(){return this._element}setPopup(e){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")),e){if(!("offset"in e.options)){const t=38.1,i=13.5,n=Math.sqrt(Math.pow(i,2)/2);e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-t],"bottom-left":[n,-1*(t-i+n)],"bottom-right":[-n,-1*(t-i+n)],left:[i,-1*(t-i)],right:[-i,-1*(t-i)]}:this._offset}this._popup=e,e._marker=this,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(e){const t=e.code,i=e.charCode||e.keyCode;"Space"!==t&&"Enter"!==t&&32!==i&&13!==i||this.togglePopup()}_onMapClick(e){const t=e.originalEvent.target,i=this._element;this._popup&&(t===i||i.contains(t))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const e=this._popup;return e?(e.isOpen()?(e.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(e.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const e=this._map,t=this._pos;if(!e||!t)return!1;const i=e.unproject(t),n=e.getFreeCameraOptions();if(!n.position)return!1;const r=n.position.toLngLat();return r.distanceTo(i)<.9*r.distanceTo(this._lngLat)}_evaluateOpacity(){const t=this._map;if(!t)return;const i=this._pos;if(!i||i.x<0||i.x>t.transform.width||i.y<0||i.y>t.transform.height)return void this._clearFadeTimer();const n=t.unproject(i);let r;t._showingGlobe()&&e.isLngLatBehindGlobe(t.transform,this._lngLat)?r=0:(r=1-t._queryFogOpacity(n),t.transform._terrainEnabled()&&t.getTerrain()&&this._behindTerrain()&&(r*=this._occludedOpacity)),this._element.style.opacity=`${r}`,this._element.style.pointerEvents=r>0?"auto":"none",this._popup&&this._popup._setOpacity(r),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const e=this._pos;if(!e||!this._map)return;const t=this._offset.mult(this._scale);this._element.style.transform=`\n translate(${e.x}px,${e.y}px)\n ${Qr[this._anchor]}\n ${this._calculateXYTransform()} ${this._calculateZTransform()}\n translate(${t.x}px,${t.y}px)\n `}_calculateXYTransform(){const t=this._pos,i=this._map,n=this.getPitchAlignment();if(!i||!t||"map"!==n)return"";if(!i._showingGlobe()){const e=i.getPitch();return e?`rotateX(${e}deg)`:""}const r=e.radToDeg(e.globeTiltAtLngLat(i.transform,this._lngLat)),o=t.sub(e.globeCenterToScreenPoint(i.transform)),s=Math.abs(o.x)+Math.abs(o.y);if(0===s)return"";const a=r/s;return`rotateX(${-o.y*a}deg) rotateY(${o.x*a}deg)`}_calculateZTransform(){const t=this._pos,i=this._map;if(!i||!t)return"";let n=0;const r=this.getRotationAlignment();if("map"===r)if(i._showingGlobe()){const t=i.project(new e.LngLat(this._lngLat.lng,this._lngLat.lat+.001)),r=i.project(new e.LngLat(this._lngLat.lng,this._lngLat.lat-.001)).sub(t);n=e.radToDeg(Math.atan2(r.y,r.x))-90}else n=-i.getBearing();else if("horizon"===r){const r=e.smoothstep(4,6,i.getZoom()),o=e.globeCenterToScreenPoint(i.transform);o.y+=r*i.transform.height;const s=t.sub(o),a=e.radToDeg(Math.atan2(s.y,s.x));n=(a>90?a-270:a+90)*(1-r)}return n+=this._rotation,n?`rotateZ(${n}deg)`:""}_update(t){e.window.cancelAnimationFrame(this._updateFrameId);const i=this._map;i&&(i.transform.renderWorldCopies&&(this._lngLat=Yr(this._lngLat,this._pos,i.transform)),this._pos=i.project(this._lngLat),!0===t?this._updateFrameId=e.window.requestAnimationFrame((()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())})):this._pos=this._pos.round(),i._requestDomTask((()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(i._showingGlobe()||i.getTerrain()||i.getFog())&&!this._fadeTimer&&(this._fadeTimer=setTimeout(this._evaluateOpacity.bind(this),60)))})))}getOffset(){return this._offset}setOffset(t){return this._offset=e.Point.convert(t),this._update(),this}_onMove(t){const i=this._map;if(!i)return;const n=this._pointerdownPos,r=this._positionDelta;if(n&&r){if(!this._isDragging){const e=this._clickTolerance||i._clickTolerance;if(t.point.dist(n)=this._endTime)return this._end;const i=e.easeCubicInOut((t-this._startTime)/(this._endTime-this._startTime));return this._start*(1-i)+this._end*i}isEasing(e){return e>=this._startTime&&e<=this._endTime}jumpTo(e){this._startTime=-1/0,this._endTime=-1/0,this._start=e,this._end=e}easeTo(e,t,i){this._start=this.getValue(t),this._end=e,this._startTime=t,this._endTime=t+i}}const oo={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","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"},so={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,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,optimizeForTerrain:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0},ao={showCompass:!0,showZoom:!0,visualizePitch:!1};class lo{constructor(t,i,n=!1){this._clickTolerance=10,this.element=i,this.mouseRotate=new vr({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,n&&(this.mousePitch=new xr({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),e.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),i.addEventListener("mousedown",this.mousedown),i.addEventListener("touchstart",this.touchstart,{passive:!1}),i.addEventListener("touchmove",this.touchmove),i.addEventListener("touchend",this.touchend),i.addEventListener("touchcancel",this.reset)}down(e,t){this.mouseRotate.mousedown(e,t),this.mousePitch&&this.mousePitch.mousedown(e,t),u()}move(e,t){const i=this.map,n=this.mouseRotate.mousemoveWindow(e,t),r=n&&n.bearingDelta;if(r&&i.setBearing(i.getBearing()+r),this.mousePitch){const n=this.mousePitch.mousemoveWindow(e,t),r=n&&n.pitchDelta;r&&i.setPitch(i.getPitch()+r)}}off(){const e=this.element;e.removeEventListener("mousedown",this.mousedown),e.removeEventListener("touchstart",this.touchstart,{passive:!1}),e.removeEventListener("touchmove",this.touchmove),e.removeEventListener("touchend",this.touchend),e.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){h(),e.window.removeEventListener("mousemove",this.mousemove),e.window.removeEventListener("mouseup",this.mouseup)}mousedown(t){this.down(e.extend({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),f(this.element,t)),e.window.addEventListener("mousemove",this.mousemove),e.window.addEventListener("mouseup",this.mouseup)}mousemove(e){this.move(e,f(this.element,e))}mouseup(e){this.mouseRotate.mouseupWindow(e),this.mousePitch&&this.mousePitch.mouseupWindow(e),this.offTemp()}touchstart(e){1!==e.targetTouches.length?this.reset():(this._startPos=this._lastPos=m(this.element,e.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>e.preventDefault()},this._startPos))}touchmove(e){1!==e.targetTouches.length?this.reset():(this._lastPos=m(this.element,e.targetTouches)[0],this.move({preventDefault:()=>e.preventDefault()},this._lastPos))}touchend(e){0===e.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)t.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=t.minPitch&&null!=t.maxPitch&&t.minPitch>t.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=t.minPitch&&t.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=t.maxPitch&&t.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(t.antialias&&e.isSafariWithAntialiasingBug(e.window)&&(t.antialias=!1,e.warnOnce("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new Xn(t.minZoom,t.maxZoom,t.minPitch,t.maxPitch,t.renderWorldCopies),t),this._interactive=t.interactive,this._minTileCacheSize=t.minTileCacheSize,this._maxTileCacheSize=t.maxTileCacheSize,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=t.preserveDrawingBuffer,this._antialias=t.antialias,this._useWebGL2=t.useWebGL2,this._trackResize=t.trackResize,this._bearingSnap=t.bearingSnap,this._refreshExpiredTiles=t.refreshExpiredTiles,this._fadeDuration=t.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=t.crossSourceCollisions,this._collectResourceTiming=t.collectResourceTiming,this._optimizeForTerrain=t.optimizeForTerrain,this._language=this._parseLanguage(t.language),this._worldview=t.worldview,this._renderTaskQueue=new Jr,this._domRenderTaskQueue=new Jr,this._controls=[],this._markers=[],this._popups=[],this._mapId=e.uniqueId(),this._locale=e.extend({},oo,t.locale),this._clickTolerance=t.clickTolerance,this._cooperativeGestures=t.cooperativeGestures,this._performanceMetricsCollection=t.performanceMetricsCollection,this._containerWidth=0,this._containerHeight=0,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new ro(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._requestManager=new e.RequestManager(t.transformRequest,t.accessToken,t.testMode),this._silenceAuthErrors=!!t.testMode,"string"==typeof t.container){if(this._container=e.window.document.getElementById(t.container),!this._container)throw new Error(`Container '${t.container}' not found.`)}else{if(!(t.container instanceof e.window.HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=t.container}if(this._container.childNodes.length>0&&e.warnOnce("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."),t.maxBounds&&this.setMaxBounds(t.maxBounds),e.bindAll(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw new Error("Failed to initialize WebGL.");this.on("move",(()=>this._update(!1))),this.on("moveend",(()=>this._update(!1))),this.on("zoom",(()=>this._update(!0))),void 0!==e.window&&(e.window.addEventListener("online",this._onWindowOnline,!1),e.window.addEventListener("resize",this._onWindowResize,!1),e.window.addEventListener("orientationchange",this._onWindowResize,!1),e.window.addEventListener("webkitfullscreenchange",this._onWindowResize,!1),e.window.addEventListener("visibilitychange",this._onVisibilityChange,!1)),this.handlers=new Zr(this,t),this._localFontFamily=t.localFontFamily,this._localIdeographFontFamily=t.localIdeographFontFamily,t.style&&this.setStyle(t.style,{localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),t.projection&&this.setProjection(t.projection),this._hash=t.hash&&new Jn("string"==typeof t.hash&&t.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}),t.bounds&&(this.resize(),this.fitBounds(t.bounds,e.extend({},t.fitBoundsOptions,{duration:0})))),this.resize(),t.attributionControl&&this.addControl(new Xr({customAttribution:t.customAttribution})),this._logoControl=new Kr,this.addControl(this._logoControl,t.logoPosition),this.on("style.load",(()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)})),this.on("data",(t=>{this._update("style"===t.dataType),this.fire(new e.Event(`${t.dataType}data`,t))})),this.on("dataloading",(t=>{this.fire(new e.Event(`${t.dataType}dataloading`,t))}))}_getMapId(){return this._mapId}addControl(t,i){if(void 0===i&&(i=t.getDefaultPosition?t.getDefaultPosition():"top-right"),!t||!t.onAdd)return this.fire(new e.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=t.onAdd(this);this._controls.push(t);const r=this._controlPositions[i];return-1!==i.indexOf("bottom")?r.insertBefore(n,r.firstChild):r.appendChild(n),this}removeControl(t){if(!t||!t.onRemove)return this.fire(new e.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const i=this._controls.indexOf(t);return i>-1&&this._controls.splice(i,1),t.onRemove(this),this}hasControl(e){return this._controls.indexOf(e)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(t){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 i=!this._moving;return i&&this.fire(new e.Event("movestart",t)).fire(new e.Event("move",t)),this.fire(new e.Event("resize",t)),i&&this.fire(new e.Event("moveend",t)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(t){return this.transform.setMaxBounds(e.LngLatBounds.convert(t)),this._update()}setMinZoom(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t?this.setZoom(t):this.fire(new e.Event("zoomstart")).fire(new e.Event("zoom")).fire(new e.Event("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(t){if((t=null==t?0:t)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t?this.setPitch(t):this.fire(new e.Event("pitchstart")).fire(new e.Event("pitch")).fire(new e.Event("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.renderWorldCopies=e,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(t){return"auto"===t?e.window.navigator.language:Array.isArray(t)?0===t.length?void 0:t.map((t=>"auto"===t?e.window.navigator.language:t)):t}setLanguage(e){const t=this._parseLanguage(e);if(!this.style||t===this._language)return this;this._language=t,this.style._reloadSources();for(const e of this._controls)e._setLanguage&&e._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(e){return this.style&&e!==this._worldview?(this._worldview=e,this.style._reloadSources(),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return"globe"===this.transform.projection.name}setProjection(e){return this._lazyInitEmptyStyle(),e?"string"==typeof e&&(e={name:e}):e=null,this._useExplicitProjection=!!e,this._prioritizeAndUpdateProjection(e,this.style.stylesheet?this.style.stylesheet.projection:null)}_updateProjectionTransition(){if("globe"!==this.getProjection().name)return;const t=this.transform,i=t.projection.name;let n;"globe"===i&&t.zoom>=e.GLOBE_ZOOM_THRESHOLD_MAX?(t.setMercatorFromTransition(),n=!0):"mercator"===i&&t.zoom=e.GLOBE_ZOOM_THRESHOLD_MAX?this.transform.setMercatorFromTransition():this.transform.setProjection(t),this.style.applyProjectionUpdate(),i){this.painter.clearBackgroundTiles();for(const e in this.style._sourceCaches)this.style._sourceCaches[e].clearTiles();this._update(!0),this._forceMarkerAndPopupUpdate(!0)}return this}project(t){return this.transform.locationPoint3D(e.LngLat.convert(t))}unproject(t){return this.transform.pointLocation3D(e.Point.convert(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(e,t,i){if("mouseenter"===e||"mouseover"===e){let n=!1;const r=r=>{const o=t.filter((e=>this.getLayer(e))),s=o.length?this.queryRenderedFeatures(r.point,{layers:o}):[];s.length?n||(n=!0,i.call(this,new ar(e,this,r.originalEvent,{features:s}))):n=!1},o=()=>{n=!1};return{layers:new Set(t),listener:i,delegates:{mousemove:r,mouseout:o}}}if("mouseleave"===e||"mouseout"===e){let n=!1;const r=r=>{const o=t.filter((e=>this.getLayer(e)));(o.length?this.queryRenderedFeatures(r.point,{layers:o}):[]).length?n=!0:n&&(n=!1,i.call(this,new ar(e,this,r.originalEvent)))},o=t=>{n&&(n=!1,i.call(this,new ar(e,this,t.originalEvent)))};return{layers:new Set(t),listener:i,delegates:{mousemove:r,mouseout:o}}}{const n=e=>{const n=t.filter((e=>this.getLayer(e))),r=n.length?this.queryRenderedFeatures(e.point,{layers:n}):[];r.length&&(e.features=r,i.call(this,e),delete e.features)};return{layers:new Set(t),listener:i,delegates:{[e]:n}}}}on(e,t,i){if(void 0===i)return super.on(e,t);Array.isArray(t)||(t=[t]);const n=this._createDelegatedListener(e,t,i);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(n);for(const e in n.delegates)this.on(e,n.delegates[e]);return this}once(e,t,i){if(void 0===i)return super.once(e,t);Array.isArray(t)||(t=[t]);const n=this._createDelegatedListener(e,t,i);for(const e in n.delegates)this.once(e,n.delegates[e]);return this}off(e,t,i){if(void 0===i)return super.off(e,t);t=new Set(Array.isArray(t)?t:[t]);const n=(e,t)=>{if(e.size!==t.size)return!1;for(const i of e)if(!t.has(i))return!1;return!0},r=this._delegatedListeners?this._delegatedListeners[e]:void 0;return r&&(e=>{for(let r=0;r{t?this.fire(new e.ErrorEvent(t)):n&&this._updateDiff(n,i)}))}else"object"==typeof t&&this._updateDiff(t,i)}_updateDiff(t,i){try{this.style.setState(t)&&this._update(!0)}catch(n){e.warnOnce(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(t,i)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(e.warnOnce("There is no style added to the map."),!1)}addSource(e,t){return this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)}isSourceLoaded(e){return!!this.style&&this.style._isSourceCacheLoaded(e)}areTilesLoaded(){const e=this.style&&this.style._sourceCaches;for(const t in e){const i=e[t]._tiles;for(const e in i){const t=i[e];if("loaded"!==t.state&&"errored"!==t.state)return!1}}return!0}addSourceType(e,t,i){this._lazyInitEmptyStyle(),this.style.addSourceType(e,t,i)}removeSource(e){return this.style.removeSource(e),this._updateTerrain(),this._update(!0)}getSource(e){return this.style.getSource(e)}addImage(t,i,{pixelRatio:n=1,sdf:r=!1,stretchX:o,stretchY:s,content:a}={}){if(this._lazyInitEmptyStyle(),i instanceof e.window.HTMLImageElement||e.window.ImageBitmap&&i instanceof e.window.ImageBitmap){const{width:l,height:c,data:u}=e.exported.getImageData(i);this.style.addImage(t,{data:new e.RGBAImage({width:l,height:c},u),pixelRatio:n,stretchX:o,stretchY:s,content:a,sdf:r,version:0})}else if(void 0===i.width||void 0===i.height)this.fire(new e.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{const{width:l,height:c}=i,u=i;this.style.addImage(t,{data:new e.RGBAImage({width:l,height:c},new Uint8Array(u.data)),pixelRatio:n,stretchX:o,stretchY:s,content:a,sdf:r,version:0,userImage:u}),u.onAdd&&u.onAdd(this,t)}}updateImage(t,i){const n=this.style.getImage(t);if(!n)return void this.fire(new e.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const r=i instanceof e.window.HTMLImageElement||e.window.ImageBitmap&&i instanceof e.window.ImageBitmap?e.exported.getImageData(i):i,{width:o,height:s}=r;void 0!==o&&void 0!==s?o===n.data.width&&s===n.data.height?(n.data.replace(r.data,!(i instanceof e.window.HTMLImageElement||e.window.ImageBitmap&&i instanceof e.window.ImageBitmap)),this.style.updateImage(t,n)):this.fire(new e.ErrorEvent(new Error(`The width and height of the updated image (${o}, ${s})\n must be that same as the previous version of the image\n (${n.data.width}, ${n.data.height})`))):this.fire(new e.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")))}hasImage(t){return t?!!this.style.getImage(t):(this.fire(new e.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}loadImage(t,i){e.getImage(this._requestManager.transformRequest(t,e.ResourceType.Image),((t,n)=>{i(t,n instanceof e.window.HTMLImageElement?e.exported.getImageData(n):n)}))}listImages(){return this.style.listImages()}addLayer(e,t){return this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)}moveLayer(e,t){return this.style.moveLayer(e,t),this._update(!0)}removeLayer(e){return this.style.removeLayer(e),this._update(!0)}getLayer(e){return this.style.getLayer(e)}setLayerZoomRange(e,t,i){return this.style.setLayerZoomRange(e,t,i),this._update(!0)}setFilter(e,t,i={}){return this.style.setFilter(e,t,i),this._update(!0)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,t,i,n={}){return this.style.setPaintProperty(e,t,i,n),this._update(!0)}getPaintProperty(e,t){return this.style.getPaintProperty(e,t)}setLayoutProperty(e,t,i,n={}){return this.style.setLayoutProperty(e,t,i,n),this._update(!0)}getLayoutProperty(e,t){return this.style.getLayoutProperty(e,t)}setLight(e,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(e,t),this._update(!0)}getLight(){return this.style.getLight()}setTerrain(e){return this._lazyInitEmptyStyle(),!e&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(e),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(e){return this._lazyInitEmptyStyle(),this.style.setFog(e),this._update(!0)}getFog(){return this.style?this.style.getFog():null}_queryFogOpacity(t){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(e.LngLat.convert(t),this.transform):0}setFeatureState(e,t){return this.style.setFeatureState(e,t),this._update()}removeFeatureState(e,t){return this.style.removeFeatureState(e,t),this._update()}getFeatureState(e){return this.style.getFeatureState(e)}_updateContainerDimensions(){if(!this._container)return;const t=this._container.getBoundingClientRect().width||400,i=this._container.getBoundingClientRect().height||300;let n,r,o,s=this._container;for(;s&&(!r||!o);){const t=e.window.getComputedStyle(s).transform;t&&"none"!==t&&(n=t.match(/matrix.*\((.+)\)/)[1].split(", "),n[0]&&"0"!==n[0]&&"1"!==n[0]&&(r=n[0]),n[3]&&"0"!==n[3]&&"1"!==n[3]&&(o=n[3])),s=s.parentElement}this._containerWidth=r?Math.abs(t/r):t,this._containerHeight=o?Math.abs(i/o):i}_detectMissingCSS(){"rgb(250, 128, 114)"!==e.window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&e.warnOnce("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 e=this._container;e.classList.add("mapboxgl-map"),(this._missingCSSCanary=o("div","mapboxgl-canary",e)).style.visibility="hidden",this._detectMissingCSS();const t=this._canvasContainer=o("div","mapboxgl-canvas-container",e);this._interactive&&t.classList.add("mapboxgl-interactive"),this._canvas=o("canvas","mapboxgl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const i=this._controlContainer=o("div","mapboxgl-control-container",e),n=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((e=>{n[e]=o("div",`mapboxgl-ctrl-${e}`,i)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(t,i){const n=e.exported.devicePixelRatio||1;this._canvas.width=n*Math.ceil(t),this._canvas.height=n*Math.ceil(i),this._canvas.style.width=`${t}px`,this._canvas.style.height=`${i}px`}_addMarker(e){this._markers.push(e)}_removeMarker(e){const t=this._markers.indexOf(e);-1!==t&&this._markers.splice(t,1)}_addPopup(e){this._popups.push(e)}_removePopup(e){const t=this._popups.indexOf(e);-1!==t&&this._popups.splice(t,1)}_setupPainter(){const t=e.extend({},i.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),n=this._useWebGL2&&this._canvas.getContext("webgl2",t),r=n||this._canvas.getContext("webgl",t)||this._canvas.getContext("experimental-webgl",t);r?(this._useWebGL2&&!n&&e.warnOnce("Failed to create WebGL 2 context. Using WebGL 1."),e.storeAuthState(r,!0),this.painter=new Bn(r,this.transform,!!n),this.on("data",(e=>{"source"===e.dataType&&this.painter.setTileLoadedFlag(!0)})),e.exported$1.testSupport(r)):this.fire(new e.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(t){t.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new e.Event("webglcontextlost",{originalEvent:t}))}_contextRestored(t){this._setupPainter(),this.resize(),this._update(),this.fire(new e.Event("webglcontextrestored",{originalEvent:t}))}_onMapScroll(e){if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){return this.style?(this._styleDirty=this._styleDirty||e,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_requestDomTask(e){!this.loaded()||this.loaded()&&!this.isMoving()?e():this._domRenderTaskQueue.add(e)}_render(t){let i;const n=this.painter.context.extTimerQuery,r=e.exported.now();if(this.listens("gpu-timing-frame")&&(i=n.createQueryEXT(),n.beginQueryEXT(n.TIME_ELAPSED_EXT,i)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&(this._interactionRange[0]=Math.min(this._interactionRange[0],e.window.performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],e.window.performance.now())),this._renderTaskQueue.run(t),this._domRenderTaskQueue.run(t),this._removed)return;this._updateProjectionTransition();const o=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const t=this.transform.zoom,i=this.transform.pitch,n=e.exported.now(),r=new e.EvaluationParameters(t,{now:n,fadeDuration:o,pitch:i,transition:this.style.getTransition()});this.style.update(r)}this.style&&this.style.fog&&this.style.fog.hasTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let s=!1;if(this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),s=this._updateAverageElevation(r),this.style._updateSources(this.transform),this._forceMarkerAndPopupUpdate()):s=this._updateAverageElevation(r),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,o,this._crossSourceCollisions),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showTerrainWireframe:this.showTerrainWireframe,showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:o,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 e.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new e.Event("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),i){const t=e.exported.now()-r;n.endQueryEXT(n.TIME_ELAPSED_EXT,i),setTimeout((()=>{const o=n.getQueryObjectEXT(i,n.QUERY_RESULT_EXT)/1e6;n.deleteQueryEXT(i),this.fire(new e.Event("gpu-timing-frame",{cpuTime:t,gpuTime:o})),e.window.performance.mark("frame-gpu",{startTime:r,detail:{gpuTime:o}})}),50)}if(this.listens("gpu-timing-layer")){const t=this.painter.collectGpuTimers();setTimeout((()=>{const i=this.painter.queryGpuTimers(t);this.fire(new e.Event("gpu-timing-layer",{layerTimes:i}))}),50)}if(this.listens("gpu-timing-deferred-render")){const t=this.painter.collectDeferredRenderGpuQueries();setTimeout((()=>{const i=this.painter.queryGpuTimeDeferredRender(t);this.fire(new e.Event("gpu-timing-deferred-render",{gpuTime:i}))}),50)}const a=this._sourcesDirty||this._styleDirty||this._placementDirty||s;if(a||this._repaint)this.triggerRepaint();else{const t=!this.isMoving()&&this.loaded();if(t&&(s=this._updateAverageElevation(r,!0)),s)this.triggerRepaint();else if(this._triggerFrame(!1),t&&(this.fire(new e.Event("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const t=this._calculateSpeedIndex();this.fire(new e.Event("speedindexcompleted",{speedIndex:t})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||a||(this._fullyLoaded=!0,e.LivePerformanceUtils.mark(e.PerformanceMarkers.fullLoad),this._performanceMetricsCollection&&e.postPerformanceEvent(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(e){for(const t of this._markers)e&&!this.getRenderWorldCopies()&&(t._lngLat=t._lngLat.wrap()),t._update();for(const t of this._popups)!e||this.getRenderWorldCopies()||t._trackPointer||(t._lngLat=t._lngLat.wrap()),t._update()}_updateAverageElevation(e,t=!1){const i=e=>(this.transform.averageElevation=e,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return 0!==this.transform.averageElevation&&i(0);if((t||e-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(e)){const t=this.transform.averageElevation;let n=this.transform.sampleAverageElevation(),r=!1;this.transform.elevation&&(r=this.transform.elevation.exaggeration()!==this._averageElevationExaggeration,this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(n)?n=0:this._averageElevationLastSampledAt=e;const o=Math.abs(t-n);if(o>1){if(this._isInitialLoad||r)return this._averageElevation.jumpTo(n),i(n);this._averageElevation.easeTo(n,e,300)}else if(o>1e-4)return this._averageElevation.jumpTo(n),i(n)}return!!this._averageElevation.isEasing(e)&&i(this._averageElevation.getValue(e))}_authenticate(){e.getMapSessionAPI(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,(t=>{if(t&&(t.message===e.AUTH_ERR_MSG||401===t.status)){const t=this.painter.context.gl;e.storeAuthState(t,!1),this._logoControl instanceof Kr&&this._logoControl._updateLogo(),t&&t.clear(t.DEPTH_BUFFER_BIT|t.COLOR_BUFFER_BIT|t.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new e.ErrorEvent(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/")))}})),e.postMapLoadEvent(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,(()=>{}))}_updateTerrain(){const e=this._isDragging();this.painter.updateTerrain(this.style,e)}_calculateSpeedIndex(){const e=this.painter.canvasCopy(),t=this.painter.getCanvasCopiesAndTimestamps();t.timeStamps.push(performance.now());const i=this.painter.context.gl,n=i.createFramebuffer();function r(e){i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e,0);const t=new Uint8Array(i.drawingBufferWidth*i.drawingBufferHeight*4);return i.readPixels(0,0,i.drawingBufferWidth,i.drawingBufferHeight,i.RGBA,i.UNSIGNED_BYTE,t),t}return i.bindFramebuffer(i.FRAMEBUFFER,n),this._canvasPixelComparison(r(e),t.canvasCopies.map(r),t.timeStamps)}_canvasPixelComparison(e,t,i){let n=i[1]-i[0];const r=e.length/4;for(let o=0;o{const t=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,t&&this._render(e)})))}_preloadTiles(t){const i=this.style?Object.values(this.style._sourceCaches):[];return e.asyncAll(i,((e,i)=>e._preloadTiles(t,i)),(()=>{this.triggerRepaint()})),this}_onWindowOnline(){this._update()}_onWindowResize(e){this._trackResize&&this.resize({originalEvent:e})._update()}_onVisibilityChange(){"hidden"===e.window.document.visibilityState&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(e){this._showTerrainWireframe!==e&&(this._showTerrainWireframe=e,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(e){this._speedIndexTiming!==e&&(this._speedIndexTiming=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(e){this._showTileAABBs!==e&&(this._showTileAABBs=e,e&&this._update())}_setCacheLimits(t,i){e.setCacheLimits(t,i)}get version(){return e.version}},NavigationControl:class{constructor(t){this.options=e.extend({},ao,t),this._container=o("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",(e=>e.preventDefault())),this.options.showZoom&&(e.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",(e=>{this._map&&this._map.zoomIn({},{originalEvent:e})})),o("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",(e=>{this._map&&this._map.zoomOut({},{originalEvent:e})})),o("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(e.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",(e=>{const t=this._map;t&&(this.options.visualizePitch?t.resetNorthPitch({},{originalEvent:e}):t.resetNorth({},{originalEvent:e}))})),this._compassIcon=o("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const e=this._map;if(!e)return;const t=e.getZoom(),i=t===e.getMaxZoom(),n=t===e.getMinZoom();this._zoomInButton.disabled=i,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute("aria-disabled",i.toString()),this._zoomOutButton.setAttribute("aria-disabled",n.toString())}_rotateCompassArrow(){const e=this._map;if(!e)return;const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(e.transform.pitch*(Math.PI/180)),.5)}) rotateX(${e.transform.pitch}deg) rotateZ(${e.transform.angle*(180/Math.PI)}deg)`:`rotate(${e.transform.angle*(180/Math.PI)}deg)`;e._requestDomTask((()=>{this._compassIcon&&(this._compassIcon.style.transform=t)}))}onAdd(e){return this._map=e,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),e.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&e.on("pitch",this._rotateCompassArrow),e.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new lo(e,this._compass,this.options.visualizePitch)),this._container}onRemove(){const e=this._map;e&&(this._container.remove(),this.options.showZoom&&e.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&e.off("pitch",this._rotateCompassArrow),e.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(e,t){const i=o("button",e,this._container);return i.type="button",i.addEventListener("click",t),i}_setButtonTitle(e,t){if(!this._map)return;const i=this._map._getUIString(`NavigationControl.${t}`);e.setAttribute("aria-label",i),e.firstElementChild&&e.firstElementChild.setAttribute("title",i)}},GeolocateControl:class extends e.Evented{constructor(t){super(),this.options=e.extend({geolocation:e.window.navigator.geolocation},co,t),e.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=Kn(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(e){return this._map=e,this._container=o("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){void 0!==this._geolocationWatchID&&(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(t){const i=(e=!!this.options.geolocation)=>{this._supportsGeolocation=e,t(e)};void 0!==this._supportsGeolocation?t(this._supportsGeolocation):void 0!==e.window.navigator.permissions?e.window.navigator.permissions.query({name:"geolocation"}).then((e=>i("denied"!==e.state))).catch((()=>i())):i()}_isOutOfMapMaxBounds(e){const t=this._map.getMaxBounds(),i=e.coords;return!!t&&(i.longitudet.getEast()||i.latitudet.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(t){if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new e.Event("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");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&&"OFF"!==this._watchState&&this._updateMarker(t),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire(new e.Event("geolocate",t)),this._finish()}}_updateCamera(t){const i=new e.LngLat(t.coords.longitude,t.coords.latitude),n=t.coords.accuracy,r=this._map.getBearing(),o=e.extend({bearing:r},this.options.fitBoundsOptions);this._map.fitBounds(i.toBounds(n),o,{geolocateSource:!0})}_updateMarker(t){if(t){const i=new e.LngLat(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const t=this._map.transform,i=e.mercatorZfromAltitude(1,t._center.lat)*t.worldSize,n=Math.ceil(2*this._accuracy*i);this._circleElement.style.width=`${n}px`,this._circleElement.style.height=`${n}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&"number"==typeof this._heading?(this._userLocationDotMarker.setRotation(this._heading),this._dotElement.classList.add("mapboxgl-user-location-show-heading")):(this._dotElement.classList.remove("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(t){if(this._map){if(this.options.trackUserLocation)if(1===t.code){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 e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",e),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",e),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===t.code&&this._noTimeout)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire(new e.Event("error",t)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(t){if(void 0!==this._map){if(this._container.addEventListener("contextmenu",(e=>e.preventDefault())),this._geolocateButton=o("button","mapboxgl-ctrl-geolocate",this._container),o("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===t){e.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t)}else{const e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",e),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=o("div","mapboxgl-user-location"),this._dotElement.appendChild(o("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(o("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new eo({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=o("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new eo({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(t=>{t.geolocateSource||"ACTIVE_LOCK"!==this._watchState||t.originalEvent&&"resize"===t.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new e.Event("trackuserlocationend")))}))}}_onDeviceOrientation(e){this._userLocationDotMarker&&(e.webkitCompassHeading?this._heading=e.webkitCompassHeading:!0===e.absolute&&(this._heading=-1*e.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return e.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new e.Event("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 e.Event("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 e.Event("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("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let e;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(e={maximumAge:6e5,timeout:0},this._noTimeout=!0):(e=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,e),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const t=()=>{e.window.addEventListener("ondeviceorientationabsolute"in e.window?"deviceorientationabsolute":"deviceorientation",this._onDeviceOrientation)};void 0!==e.window.DeviceMotionEvent&&"function"==typeof e.window.DeviceMotionEvent.requestPermission?DeviceOrientationEvent.requestPermission().then((e=>{"granted"===e&&t()})).catch(console.error):t()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),e.window.removeEventListener("deviceorientation",this._onDeviceOrientation),e.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:Xr,ScaleControl:class{constructor(t){this.options=e.extend({},uo,t),this._isNumberFormatSupported=function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"short",unit:"meter"}),!0}catch(e){return!1}}(),e.bindAll(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const e=this.options.maxWidth||100,t=this._map,i=t._containerHeight/2,n=t._containerWidth/2-e/2,r=t.unproject([n,i]),o=t.unproject([n+e,i]),s=r.distanceTo(o);if("imperial"===this.options.unit){const t=3.2808*s;t>5280?this._setScale(e,t/5280,"mile"):this._setScale(e,t,"foot")}else"nautical"===this.options.unit?this._setScale(e,s/1852,"nautical-mile"):s>=1e3?this._setScale(e,s/1e3,"kilometer"):this._setScale(e,s,"meter")}_setScale(e,t,i){this._map._requestDomTask((()=>{const n=function(e){const t=Math.pow(10,`${Math.floor(e)}`.length-1);let i=e/t;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:function(e){const t=Math.pow(10,Math.ceil(-Math.log(e)/Math.LN10));return Math.round(e*t)/t}(i),t*i}(t),r=n/t;this._container.innerHTML=this._isNumberFormatSupported&&"nautical-mile"!==i?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:i}).format(n):`${n} ${ho[i]}`,this._container.style.width=e*r+"px"}))}onAdd(e){return this._map=e,this._language=e.getLanguage(),this._container=o("div","mapboxgl-ctrl mapboxgl-ctrl-scale",e.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(e){this._language=e,this._update()}setUnit(e){this.options.unit=e,this._update()}},FullscreenControl:class{constructor(t){this._fullscreen=!1,t&&t.container&&(t.container instanceof e.window.HTMLElement?this._container=t.container:e.warnOnce("Full screen control 'container' must be a DOM element.")),e.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in e.window.document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in e.window.document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=o("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",e.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,e.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!e.window.document.fullscreenEnabled&&!e.window.document.webkitFullscreenEnabled)}_setupUI(){const t=this._fullscreenButton=o("button","mapboxgl-ctrl-fullscreen",this._controlContainer);o("span","mapboxgl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),e.window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const e=this._getTitle();this._fullscreenButton.setAttribute("aria-label",e),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",e)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(e.window.document.fullscreenElement||e.window.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()?e.window.document.exitFullscreen?e.window.document.exitFullscreen():e.window.document.webkitCancelFullScreen&&e.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends e.Evented{constructor(t){super(),this.options=e.extend(Object.create(to),t),e.bindAll(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(t&&t.className?t.className.trim().split(/\s+/):[])}addTo(t){return this._map&&this.remove(),this._map=t,this.options.closeOnClick&&t.on("preclick",this._onClose),this.options.closeOnMove&&t.on("move",this._onClose),t.on("remove",this.remove),this._update(),t._addPopup(this),this._focusFirstElement(),this._trackPointer?(t.on("mousemove",this._onMouseEvent),t.on("mouseup",this._onMouseEvent),t._canvasContainer.classList.add("mapboxgl-track-pointer")):t.on("move",this._update),this.fire(new e.Event("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const t=this._map;return t&&(t.off("move",this._update),t.off("move",this._onClose),t.off("preclick",this._onClose),t.off("click",this._onClose),t.off("remove",this.remove),t.off("mousemove",this._onMouseEvent),t.off("mouseup",this._onMouseEvent),t.off("drag",this._onMouseEvent),t._canvasContainer&&t._canvasContainer.classList.remove("mapboxgl-track-pointer"),t._removePopup(this),this._map=void 0),this.fire(new e.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(t){this._lngLat=e.LngLat.convert(t),this._pos=null,this._trackPointer=!1,this._update();const i=this._map;return i&&(i.on("move",this._update),i.off("mousemove",this._onMouseEvent),i._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const e=this._map;return e&&(e.off("move",this._update),e.on("mousemove",this._onMouseEvent),e.on("drag",this._onMouseEvent),e._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(t){return this.setDOMContent(e.window.document.createTextNode(t))}setHTML(t){const i=e.window.document.createDocumentFragment(),n=e.window.document.createElement("body");let r;for(n.innerHTML=t;r=n.firstChild,r;)i.appendChild(r);return this.setDOMContent(i)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){let t=this._content;if(t)for(;t.hasChildNodes();)t.firstChild&&t.removeChild(t.firstChild);else t=this._content=o("div","mapboxgl-popup-content",this._container||void 0);if(t.appendChild(e),this.options.closeButton){const e=this._closeButton=o("button","mapboxgl-popup-close-button",t);e.type="button",e.setAttribute("aria-label","Close popup"),e.setAttribute("aria-hidden","true"),e.innerHTML="×",e.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(e){return this._classList.add(e),this._updateClassList(),this}removeClassName(e){return this._classList.delete(e),this._updateClassList(),this}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){let t;return this._classList.delete(e)?t=!1:(this._classList.add(e),t=!0),this._updateClassList(),t}_onMouseEvent(e){this._update(e.point)}_getAnchor(e){if(this.options.anchor)return this.options.anchor;const t=this._map,i=this._container,n=this._pos;if(!t||!i||!n)return"bottom";const r=i.offsetWidth,o=i.offsetHeight,s=n.xt.transform.width-r/2;if(n.y+et.transform.height-o){if(s)return"bottom-left";if(a)return"bottom-right"}return s?"left":a?"right":"bottom"}_updateClassList(){const e=this._container;if(!e)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"),e.className=t.join(" ")}_update(t){const i=this._map,n=this._content;if(!i||!this._lngLat&&!this._trackPointer||!n)return;let r=this._container;if(r||(r=this._container=o("div","mapboxgl-popup",i.getContainer()),this._tip=o("div","mapboxgl-popup-tip",r),r.appendChild(n)),this.options.maxWidth&&r.style.maxWidth!==this.options.maxWidth&&(r.style.maxWidth=this.options.maxWidth),i.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Yr(this._lngLat,this._pos,i.transform)),!this._trackPointer||t){const e=this._pos=this._trackPointer&&t?t:i.project(this._lngLat),n=no(this.options.offset),r=this._anchor=this._getAnchor(n.y),o=no(this.options.offset,r),s=e.add(o).round();i._requestDomTask((()=>{this._container&&r&&(this._container.style.transform=`${Qr[r]} translate(${s.x}px,${s.y}px)`)}))}if(!this._marker&&i._showingGlobe()){const t=e.isLngLatBehindGlobe(i.transform,this._lngLat)?0:1;this._setOpacity(t)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const e=this._container.querySelector(io);e&&e.focus()}_onClose(){this.remove()}_setOpacity(e){this._container&&(this._container.style.opacity=`${e}`),this._content&&(this._content.style.pointerEvents=e?"auto":"none")}},Marker:eo,Style:Jt,LngLat:e.LngLat,LngLatBounds:e.LngLatBounds,Point:e.Point,MercatorCoordinate:e.MercatorCoordinate,FreeCameraOptions:Vn,Evented:e.Evented,config:e.config,prewarm:function(){Ue().acquire(Be)},clearPrewarmedResources:function(){const e=Fe;e&&(e.isPreloaded()&&1===e.numActive()?(e.release(Be),Fe=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get accessToken(){return e.config.ACCESS_TOKEN},set accessToken(t){e.config.ACCESS_TOKEN=t},get baseApiUrl(){return e.config.API_URL},set baseApiUrl(t){e.config.API_URL=t},get workerCount(){return Re.workerCount},set workerCount(e){Re.workerCount=e},get maxParallelImageRequests(){return e.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(t){e.config.MAX_PARALLEL_IMAGE_REQUESTS=t},clearStorage(t){e.clearTileCache(t)},workerUrl:"",workerClass:null,setNow:e.exported.setNow,restoreNow:e.exported.restoreNow};return po})),i}()},929:(e,t,i)=>{"use strict";var n=i(3379),r=i.n(n),o=i(7795),s=i.n(o),a=i(569),l=i.n(a),c=i(3565),u=i.n(c),h=i(9216),d=i.n(h),p=i(4589),f=i.n(p),m=i(7802),_={};_.styleTagTransform=f(),_.setAttributes=u(),_.insert=l().bind(null,"head"),_.domAPI=s(),_.insertStyleElement=d(),r()(m.Z,_),m.Z&&m.Z.locals&&m.Z.locals},3379:e=>{"use strict";var t=[];function i(e){for(var i=-1,n=0;n{"use strict";var t={};e.exports=function(e,i){var n=function(e){if(void 0===t[e]){var i=document.querySelector(e);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(e){i=null}t[e]=i}return t[e]}(e);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");n.appendChild(i)}},9216:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},3565:(e,t,i)=>{"use strict";e.exports=function(e){var t=i.nc;t&&e.setAttribute("nonce",t)}},7795:e=>{"use strict";e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(i){!function(e,t,i){var n="";i.supports&&(n+="@supports (".concat(i.supports,") {")),i.media&&(n+="@media ".concat(i.media," {"));var r=void 0!==i.layer;r&&(n+="@layer".concat(i.layer.length>0?" ".concat(i.layer):""," {")),n+=i.css,r&&(n+="}"),i.media&&(n+="}"),i.supports&&(n+="}");var o=i.sourceMap;o&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),t.styleTagTransform(n,e,t.options)}(t,e,i)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},4589:e=>{"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},4395:function(e){var t;t=function(){var e="",t=/^([a-zA-Z]{2,3})(?:[_-]+([a-zA-Z]{3})(?=$|[_-]+))?(?:[_-]+([a-zA-Z]{4})(?=$|[_-]+))?(?:[_-]+([a-zA-Z]{2}|[0-9]{3})(?=$|[_-]+))?/;function i(e){return e.match(t)||[]}function n(t){return{language:(t=i(t))[1]||e,extlang:t[2]||e,script:t[3]||e,region:t[4]||e}}function r(e,t,i){Object.defineProperty(e,t,{value:i,enumerable:!0})}function o(t,o,s){function a(n){return i(n)[t]||e}r(a,"pattern",o),r(n,s,a)}return o(1,/^[a-zA-Z]{2,3}$/,"language"),o(2,/^[a-zA-Z]{3}$/,"extlang"),o(3,/^[a-zA-Z]{4}$/,"script"),o(4,/^[a-zA-Z]{2}$|^[0-9]{3}$/,"region"),r(n,"split",(function(e){return i(e).filter((function(e,t){return e&&t}))})),n},e.exports?e.exports=t():this.subtag=t()},504:(e,t,i)=>{"use strict";var n=i(7247);e.exports=n,"undefined"!=typeof window&&(window.Suggestions=n)},5397:e=>{"use strict";var t=function(e){return this.component=e,this.items=[],this.active=0,this.wrapper=document.createElement("div"),this.wrapper.className="suggestions-wrapper",this.element=document.createElement("ul"),this.element.className="suggestions",this.wrapper.appendChild(this.element),this.selectingListItem=!1,e.el.parentNode.insertBefore(this.wrapper,e.el.nextSibling),this};t.prototype.show=function(){this.element.style.display="block"},t.prototype.hide=function(){this.element.style.display="none"},t.prototype.add=function(e){this.items.push(e)},t.prototype.clear=function(){this.items=[],this.active=0},t.prototype.isEmpty=function(){return!this.items.length},t.prototype.isVisible=function(){return"block"===this.element.style.display},t.prototype.draw=function(){if(this.element.innerHTML="",0!==this.items.length){for(var e=0;e{"use strict";var n=i(7529),r=i(3261),o=i(5397),s=function(e,t,i){return i=i||{},this.options=n({minLength:2,limit:5,filter:!0,hideOnBlur:!0},i),this.el=e,this.data=t||[],this.list=new o(this),this.query="",this.selected=null,this.list.draw(),this.el.addEventListener("keyup",function(e){this.handleKeyUp(e.keyCode)}.bind(this),!1),this.el.addEventListener("keydown",function(e){this.handleKeyDown(e)}.bind(this)),this.el.addEventListener("focus",function(){this.handleFocus()}.bind(this)),this.el.addEventListener("blur",function(){this.handleBlur()}.bind(this)),this.el.addEventListener("paste",function(e){this.handlePaste(e)}.bind(this)),this.render=this.options.render?this.options.render.bind(this):this.render.bind(this),this.getItemValue=this.options.getItemValue?this.options.getItemValue.bind(this):this.getItemValue.bind(this),this};s.prototype.handleKeyUp=function(e){40!==e&&38!==e&&27!==e&&13!==e&&9!==e&&this.handleInputChange(this.el.value)},s.prototype.handleKeyDown=function(e){switch(e.keyCode){case 13:case 9:this.list.isEmpty()||(this.list.isVisible()&&e.preventDefault(),this.value(this.list.items[this.list.active].original),this.list.hide());break;case 27:this.list.isEmpty()||this.list.hide();break;case 38:this.list.previous();break;case 40:this.list.next()}},s.prototype.handleBlur=function(){!this.list.selectingListItem&&this.options.hideOnBlur&&this.list.hide()},s.prototype.handlePaste=function(e){if(e.clipboardData)this.handleInputChange(e.clipboardData.getData("Text"));else{var t=this;setTimeout((function(){t.handleInputChange(e.target.value)}),100)}},s.prototype.handleInputChange=function(e){this.query=this.normalize(e),this.list.clear(),this.query.length-1},s.prototype.value=function(e){if(this.selected=e,this.el.value=this.getItemValue(e),document.createEvent){var t=document.createEvent("HTMLEvents");t.initEvent("change",!0,!1),this.el.dispatchEvent(t)}else this.el.fireEvent("onchange")},s.prototype.getCandidates=function(e){var t={pre:"",post:"",extract:function(e){return this.getItemValue(e)}.bind(this)};e(this.options.filter?r.filter(this.query,this.data,t).map(function(e){return{original:e.original,string:this.render(e.original,e.string)}}.bind(this)):this.data.map(function(e){return{original:e,string:this.render(e)}}.bind(this)))},s.prototype.getItemValue=function(e){return e},s.prototype.render=function(e,t){if(t)return t;for(var i=e.original?this.getItemValue(e.original):this.getItemValue(e),n=this.normalize(i),r=n.lastIndexOf(this.query);r>-1;){var o=r+this.query.length;i=i.slice(0,r)+""+i.slice(r,o)+""+i.slice(o),r=n.slice(0,r).lastIndexOf(this.query)}return i},s.prototype.renderError=function(e){this.list.drawError(e)},e.exports=s},73:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AddEntryDialogBox=void 0;const n=i(1370),r=i(1173),o=i(3189),s=i(9984),a=i(6578),l=i(7001),c=i(2052);class u extends c.profile_dialog_box{constructor(e,t,i){super(),this._invariants=e,this._communityKey=t,this._callback=i,this._dlgElem=document.getElementById("cbeb-add-entry-modal"),this._extraOkBtnElem=void 0,this._extraCancelBtnElem=void 0,this._containerElem=document.getElementById("cbeb-add-entry-modal-field-container"),this._spinnerElem=document.getElementById("cbeb-add-entry-spinner"),this._titleElem=document.getElementById("cbeb-addentry-dlg-title"),this._editCtrls=[],n.DialogBoxMgr.registerDialogBox(this._dlgElem),this._titleElem.innerHTML=e.config.toolbarBtnLabel("add_entry")}addButtonsToBottomOf(e,t,i){const n=document.createElement("div");n.innerHTML='
'+t.toolbarBtnLabel("add_entry")+'
Cancel
',n.className="cbeb-extra-button-row",this._extraOkBtnElem=n.querySelector("#cbeb-extra-dlg-add-btn"),this._extraOkBtnElem.addEventListener("click",(()=>{this.onOK(i)})),this._extraCancelBtnElem=n.querySelector("#cbeb-extra-dlg-cancel-btn"),this._extraCancelBtnElem.addEventListener("click",(()=>{this._dlgElem.style.display="none"})),e.appendChild(n)}empty(e){for(;e.firstChild;)e.removeChild(e.firstChild)}populateFieldInput(e,t,i,n,r){const o=document.createElement("div");o.classList.add("cbeb-add-entry-error-msg"),e.appendChild(o),this._editCtrls=i.mapFields((e=>e)).sort(((e,t)=>e.rank(0,l.FieldEditCtrlFactory)(t,e,this._invariants,this._dlgElem))),this._editCtrls.forEach((t=>e.appendChild(t.inputHtmlElem()))),this._editCtrls.forEach((e=>e.post_dom_add()));const s=document.createElement("div");s.classList.add("cbeb-add-entry-error-msg"),e.appendChild(s)}add_prologue_to(e,t){const i=t.get_wording("add-profile-prologue");if(i.length>0){const t=document.createElement("p");t.setAttribute("add-profile-prologue",""),t.textContent=i,t.style.marginTop="17px",e.appendChild(t)}}showForBox(e){this._editCtrls=[];const t=new r.EntryWrapper({addedbyKey:"",boxKey:e.box,entryKey:"",value:{}});this.empty(this._containerElem),this.add_prologue_to(this._containerElem,e.config),this.populateFieldInput(this._containerElem,t,e.template,e.config,e.box),this.addButtonsToBottomOf(this._containerElem,e.config,e.template),n.DialogBoxMgr.hideAll(),this.showButtons(),o.Styling.applyAllStylesTo({rootElem:this._dlgElem,withConfig:e.config}),this._spinnerElem.style.display="none",this._dlgElem.style.display="block",this._containerElem.style.display="block",this._containerElem.scrollTop=0}showButtons(){this._extraOkBtnElem&&(this._extraOkBtnElem.style.visibility="visible"),this._extraCancelBtnElem&&(this._extraCancelBtnElem.style.visibility="visible")}hideButtons(){this._extraOkBtnElem&&(this._extraOkBtnElem.style.visibility="hidden"),this._extraCancelBtnElem&&(this._extraCancelBtnElem.style.visibility="hidden")}spin(){this._containerElem.style.display="none",this._spinnerElem.style.display="block"}collectEntryData(){return this._editCtrls.reduce(((e,t)=>{const i=t.data();return void 0!==i&&(e[t.fieldKey]=i),e}),{})}onOK(e){const t=this.collectEntryData(),i=this._dlgElem.querySelector(".cbeb-modal-content");"some_fields_are_missing"!==this.handle_missing_fields(t,e,i)&&(this.hideButtons(),this.spin(),(0,s.PostRequest)({url:"/memberaddboxentry",payload:{payload:{boxID:this._invariants.directory,communityID:this._communityKey,entryData:t},auth:{authID:a.AuthCache.getAuth().authID,token:a.AuthCache.getAuth().token}},callback:{onResult:e=>{n.DialogBoxMgr.hideAll(),this._callback.onAdded({profile:e.entryID,values:t})},onFailure:e=>{n.DialogBoxMgr.hideAll(),console.error(e),this._callback.onFailure(e)}}}))}}t.AddEntryDialogBox=u},6578:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AuthCache=void 0;const n=i(9984);function r(e){for(var t=e+"=",i=decodeURIComponent(document.cookie).split(";"),n=0;n{t.hasOwnProperty("outcome")&&"ok"===t.outcome?e.yes(t.type):e.no()},onFailure:t=>{e.no()}}})}static getAuth(){return this._authID&&this._authToken?{authID:this._authID,token:this._authToken}:void 0}static getMemberKey(){return this._authID}static cacheAuthLocally(e){this._authID=e.member,this._authToken=e.token,document.cookie="member_identifier="+e.member+"; path=/; domain=.communitybox.co",document.cookie="member_identifier_dev="+e.member+"; path=/",document.cookie="auth_token="+e.token+"; path=/; domain=.communitybox.co",document.cookie="auth_token_dev="+e.token+"; path=/"}static clearCredentials(){this._authID=void 0,this._authToken=void 0,["user_identifier","user_identifier_dev","member_identifier","member_identifier_dev","auth_token","auth_token_dev","member_email","member_email_dev"].forEach((e=>{this.eraseCookie(e)}))}}t.AuthCache=o,o._authID=(r("member_identifier")?r("member_identifier"):r("member_identifier_dev"))||void 0,o._authToken=(r("auth_token")?r("auth_token"):r("auth_token_dev"))||void 0,o.eraseCookie=function(e){document.cookie=e+"=; Max-Age=-99999999; path=/; domain=.communitybox.co",document.cookie=e+"=; Max-Age=-99999999; path=/;"}},1158:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BoxCache=void 0;const n=i(1173),r=i(9786),o=i(9699),s=i(8945);t.BoxCache=class{constructor(e,t,i,n,r){this._currBoxKey=e,this.rawBox=t,this._config=r,this._templateEntryKeyToIdxDict={},this._locationKey=void 0,this._lastEntryOnDisplay=0,this._categoryKey=void 0,this._entries=[],this._entryDict={},this._paginationLimit="none",this._pre_filter=[],this._pre_filter=i.map((e=>e.toLowerCase())),this.addBoxContents(t,n)}get key(){return this._currBoxKey}setPaginationLimit(e){this._paginationLimit=e}resetPagination(){this._lastEntryOnDisplay=0}moreEntriesToShow(){return this._lastEntryOnDisplay{const n=e.getAnyKeyWithInputType("location-input");n&&i.hasValueForField(n)&&t(i)}))}getEntry(e){return this._entryDict.hasOwnProperty(e)?this._entries[this._entryDict[e]]:void 0}mostRecentOutOf(e,t){const i=e.getValueOf("date_modified")||e.getValueOf("date_added")||0;return(t.getValueOf("date_modified")||t.getValueOf("date_added")||0)-i}formattedDisplayNameFrom(e){if(void 0!==e)return"string"==typeof e?e.trim().toLowerCase():e.length>0?e[0].trim().toLowerCase():void 0}shuffle(e){for(let t=e.length-1;t>0;t--){const i=Math.floor(Math.random()*(t+1));[e[t],e[i]]=[e[i],e[t]]}}sortByRecency(e,t){"date_added"===t?e.sort(((e,t)=>{const i=e.getValueOf("date_added")||0;return(t.getValueOf("date_added")||0)-i})):e.sort(((e,t)=>{const i=e.getValueOf("date_modified")||e.getValueOf("date_added")||0;return(t.getValueOf("date_modified")||t.getValueOf("date_added")||0)-i}))}sortByField(e,t){e.sort(((e,i)=>{const n=e.getValueOf(t),r=i.getValueOf(t),o=this.formattedDisplayNameFrom(n),s=this.formattedDisplayNameFrom(r);return void 0===o&&void 0===s?this.mostRecentOutOf(e,i):void 0===o?1:void 0===s?-1:o.localeCompare(s)}))}reSort(e,t,i){const n=e.profiles;switch(t.directory_ordering.type){case"default":case"random":case"most-recent":{const i=n.filter((e=>!0===e.isFeatured())),r=n.filter((e=>!1===e.isFeatured()));"random"===t.directory_ordering.type?(this.shuffle(i),this.shuffle(r)):(this.sortByRecency(i),this.sortByRecency(r)),e.profiles=[...i,...r]}break;case"by-field":{const i=n.filter((e=>e.isFeatured())),r=n.filter((e=>!1===e.isFeatured())),o=t.directory_ordering.field;this.sortByField(i,o),this.sortByField(r,o),e.profiles=[...i,...r]}break;case"by-profile-picture-then-mr":case"by-profile-picture":{const r={featured:{profile_picture:n.filter((e=>!0===e.isFeatured()&&!0===e.hasNativeProfilePicture(i))),no_profile_picture:n.filter((e=>!0===e.isFeatured()&&!1===e.hasNativeProfilePicture(i)))},not_featured:{profile_picture:n.filter((e=>!1===e.isFeatured()&&!0===e.hasNativeProfilePicture(i))),no_profile_picture:n.filter((e=>!1===e.isFeatured()&&!1===e.hasNativeProfilePicture(i)))}};"by-profile-picture-then-mr"===t.directory_ordering.type?(this.sortByRecency(r.featured.profile_picture,"date_added"),this.sortByRecency(r.featured.no_profile_picture,"date_added"),this.sortByRecency(r.not_featured.profile_picture,"date_added"),this.sortByRecency(r.not_featured.no_profile_picture,"date_added")):(this.shuffle(r.featured.profile_picture),this.shuffle(r.featured.no_profile_picture),this.shuffle(r.not_featured.profile_picture),this.shuffle(r.not_featured.no_profile_picture)),e.profiles=[...r.featured.profile_picture,...r.featured.no_profile_picture,...r.not_featured.profile_picture,...r.not_featured.no_profile_picture]}}}reSortEntriesBy(e,t){const i={profiles:this._entries};this.reSort(i,e,t),this._entries=i.profiles,this._entryDict=this._entries.reduce(((e,t,i)=>(e[t.key]=i,e)),{})}static isValidDownloadedField(e){return!(null==e||"object"!=typeof e||!("ctrltype"in e)||!e.ctrltype||"string"!=typeof e.ctrltype)&&o.FieldCtrlTypeArray.includes(e.ctrltype)}static ebUnpackFormat3IfNecessary(e){if(e&&e.templateEntries&&1===e.templateEntries.length&&e.templateEntries[0].hasOwnProperty("elem")&&e.templateEntries[0].elem.hasOwnProperty("template_entryID")&&"format 3"===e.templateEntries[0].elem.template_entryID){const t=JSON.parse(e.templateEntries[0].elem.template_data);for(const i in t.fields){const n=t.fields[i];this.isValidDownloadedField(n)&&e.templateEntries.push({elem:{template_entryID:i,ui_rank:n.uiRank,field_ctrltype:n.ctrltype,overview_specialfield:n.specialField,required:n.required,field_label:n.label,editable_by:n.editable_by,field_choices:n.fieldChoices?n.fieldChoices:void 0,detail_label:n.detail_label?n.detail_label:void 0,visibility:n.visibility?n.visibility:void 0,multi_select:n.multi_select,searchable:n.searchable,placeholder:n.placeholder,sortingTactic:n.sortingTactic,tagDiscoverability:n.tagDiscoverability}})}t.hasOwnProperty("rules")&&("string"==typeof t.rules&&(t.rules=JSON.parse(t.rules)),e.templateEntries.push({elem:{rules:t.rules}})),t.cookiecutter&&(e.cookiecutter={css:t.cookiecutter.css,markup:t.cookiecutter.markup,"css-detail":t.cookiecutter["css-detail"],"markup-detail":t.cookiecutter["markup-detail"]})}}forEachEntryWithValueFor(e,t){this._entries.filter((t=>t.hasValueForFieldArray(e))).map((e=>t(e)))}addBoxContents(e,t){if(e.templateEntries.sort((function(e,t){return(e.elem.ui_rank?e.elem.ui_rank:0)-(t.elem.ui_rank?t.elem.ui_rank:0)})),e.templateEntries.forEach(((e,t)=>{this._templateEntryKeyToIdxDict[e.elem.template_entryID]=t,"location-input"===e.elem.field_ctrltype&&(this._locationKey=e.elem.template_entryID),"category-input"===e.elem.field_ctrltype&&(this._categoryKey=e.elem.template_entryID)})),e.entries=e.entries.filter((e=>void 0!==e.value)),e.entries.forEach(((e,t)=>{if(this._categoryKey&&e.value.hasOwnProperty(this._categoryKey)&&"string"==typeof e.value[this._categoryKey]&&(e.value[this._categoryKey]=e.value[this._categoryKey].split(",")),this._locationKey&&e.value.hasOwnProperty(this._locationKey)&&"string"==typeof e.value[this._locationKey])try{e.value[this._locationKey]=JSON.parse(e.value[this._locationKey])}catch(t){e.value[this._locationKey]=void 0}})),this._entries=e.entries.map((e=>new n.EntryWrapper({addedbyKey:e.addedbyID,boxKey:e.boxID,entryKey:e.entryID,moderation:e.moderation,value:e.value}))),this._pre_filter.length>0){t.clearAllFilters(),t.updateCategoryListFilter(this._pre_filter);const i=new r.TemplateWrapper(e.templateEntries);this._entries=this._entries.filter((e=>t.Filter(e,i)===s.FilterOutcome.Keep))}this._config.only_show_featured_profiles&&(this._entries=this._entries.filter((e=>e.isFeatured()))),this._entryDict=this._entries.reduce(((e,t,i)=>(e[t.key]=i,e)),{})}for_ever_profile_owned_by_member(e,t){this.for_every_profile((function(i){i.addedByKey===e&&t(i)}))}get nb_filter_results(){return"none"===this._paginationLimit?0:this._paginationLimit}AddProfile(e){this._entries.push(e),this._entryDict[e.key]=this._entries.length-1}getMorePaginatedEntries(e,t){for(;("none"===this._paginationLimit||this._lastEntryOnDisplay0;)t(this._entries[this._lastEntryOnDisplay]),e-=1,this._lastEntryOnDisplay=this._lastEntryOnDisplay+1}any_profile_fits_filter(e){for(const t of this._entries)if(e(t)===s.FilterOutcome.Keep)return!0;return!1}map(e){return this._entries.map((t=>e(t)))}mapFiltered(e){return this._entries.filter(((e,t)=>"number"==typeof this._paginationLimit&&te(t)))}for_every_profile(e){for(const t of this._entries)e(t)}nbEntriesInBox(){return this._entries.length}reflectFilterSettings(e,t,i){const n=this.splitProfilesBy(this._entries,e),r={profiles:n.keep};if(this.reSort(r,t.ordering,i),n.keep=r.profiles,!0===t.includeFeaturedProfilesInFilterResult){const e=this.splitProfilesBy(n.reject,(e=>e.isFeatured()?s.FilterOutcome.Keep:s.FilterOutcome.Discard));this.setPaginationLimit(n.keep.length+e.keep.length),this._entries=[...n.keep,...e.keep,...e.reject]}else this.setPaginationLimit(n.keep.length),this._entries=[...n.keep,...n.reject];this._entryDict=this._entries.reduce(((e,t,i)=>(e[t.key]=i,e)),{})}splitProfilesBy(e,t){const i=[],n=[];for(const r of e)t(r)===s.FilterOutcome.Keep?i.push(r):n.push(r);return{keep:i,reject:n}}}},329:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BoxConfigWrapper=void 0,t.BoxConfigWrapper=class{login_type_allowed(e){return!(this._enforce_federated_login.length>0)||-1!==this._enforce_federated_login.indexOf(e)}overview_click_action(){return this._overview_click_action}delinquent(){return this._delinquent}for_every_connect_question(e){for(const t of this._connect_questionnaire)e(t)}override_layout(e){try{this._layout=JSON.parse(e),this.apply_palette_to_layout()}catch(e){console.error(e)}}override_filter_bar(e){this._filter_bar=e}override_map_and_loc_config(e){this._mapDesign=e,this._mapDesign.overridden=!0}get connection_made_msg(){return this._connection_made_msg}filter_bar_design(e){return this._filter_bar.design[e]}filter_bar_components(e){return this._filter_bar[e]}get upload_image(){return this._upload_img}get filter_config(){return this._filter_config}get toolbar_active(){return"none"!==this._toolbar_configuration}get postAddEntry(){return this._postAddEntryFlow}get default_proximity_distance(){return this._default_proximity_distance}get distanceUnit(){return this._distanceUnit}get overviewDesign(){return this._overviewDesign}get profilePictureAspect(){return this._profilePicAspect}get phoneNbFormat(){return this._phoneNbFormat}get overviewLocationDisplay(){return this._overviewLocDisp}get ignoreMemberspace(){return this._mspInteg.ignore_memberspace_context}get ordering(){return this._orderingConfig}get link_behaviour(){return this._link_behaviour}get initialEntryCount(){return this._pagination.initial_count}get showmoreEntryCount(){return this._pagination.showmore_count}get welcomeFlow(){return this._welcomeFlow}get has_custom_pin_design(){return void 0!==this._mapDesign.map_design.pin_dictionary}get single_map_pin_should_popup(){return"popup_single"===this._mapDesign.map_design.pin_click||void 0===this._mapDesign.map_design.pin_click}mapDesign(){return this._mapDesign}pin_design_for(e){if(void 0!==this._mapDesign.map_design.pin_dictionary)for(const t of e)if(t in this._mapDesign.map_design.pin_dictionary)return this._mapDesign.map_design.pin_dictionary[t]}get loginMsg(){return this._loginMsg}set ordering(e){this._orderingConfig=e}get only_show_featured_profiles(){return this._featured.only_featured_by_default}get includeFeaturedProfilesInFilterResult(){return this._featured.includeInFilterResult}get featuredBannerText(){return this._featured.text}get fontFamily(){return this._fontFamily||"quicksand"}get fontWeight(){return this._fontWeight}get showLocationSearch(){return this._searchLayout.show_location_field}get location_search_placeholder(){return this._location_search_placeholder}get matchMakeDestinationChoice(){return this._bespokeMatchMakeChoice}get matchMakeBespokeDestination(){return this._matchmakeBespokeDestination}get bannerText(){return this._bannerText}get keepHostedBannerSize(){return void 0!==this._keep_hosted_banner_size&&"on"===this._keep_hosted_banner_size}get hostedPageLogo(){return this._hostedPageLogo}get isExampleBox(){return void 0!==this._isExample&&!0===this._isExample}get mapConfiguration(){return this._mapconfiguration}get hideMap(){return void 0!==this._hidemap&&"on"===this._hidemap}get searchType(){return this._search_type}get sharingUrl(){return this._sharing_url||""}get cutoff_limit(){return this._cutoff_limit}get grayscaleMap(){return"mapbox_grayscale"===this._mapDesign.map_design.appearance}get matchMakingEnabled(){return void 0!==this._matchmaking&&"on"===this._matchmaking}get defaultProfilePictureKey(){return this._defaultProfilePicture}get isModerated(){return"moderated"===this._moderation}extractDomainFrom(e){const t=e.match(/http[s]?:\/\/(.*?)([\/|\#]|$)/);if((null==t?void 0:t.length)&&t.length>2)return t[1]}domainAllowed(e){return void 0===this.input_config.allowedDomains||void 0===this.input_config.generation||-1!==this.input_config.allowedDomains.indexOf(e)||-1!==["my.communitybox.co","squarespace.com","localhost:3000","thinkific.com"].indexOf(e)}preFilterTagsForThisPage(e){const t=e.toLowerCase().split(/[\?|\#]/)[0].replace(/http[s]?:\/\//,"").replace(/\/$/,"");return this.input_config.pagesettings&&t in this.input_config.pagesettings?this.input_config.pagesettings[t].prefilterList:[]}overrideButtonConfig(e){for(const t in this._toolbarBtnConfig)-1===e.indexOf(t)?this._toolbarBtnConfig[t].disposition="hide":this._toolbarBtnConfig[t].disposition="show"}get_wording(e){return this._localisation_dict[e]}hideToolbarBtn(e,t){switch(this._toolbarBtnConfig[e].disposition){case"show":return!1;case"hide":return!0;case"msp_only":return!1===t}return!1}toolbarBtnLabel(e){return this._toolbarBtnConfig[e].label}hideContactDetails(){return"on"===this._hide_contact_details}labelOf(e){return this._uiElemList[e].label}bgColourOf(e){return this._uiElemList[e].bgColour}fgColourOf(e){return this._uiElemList[e].fgColour}get_layout(e){return e.for_component in this._layout?this._layout[e.for_component]:void 0}constructor(e,t,i){this.input_config=e,this._localisation_dict={"saf-dlg-title":"Search & Filter","saf-text-label":"Text","saf-categories":"Categories","saf-freetext-label":"Search directory for mentions of:","saf-location":"Location","saf-placename":"Placename","saf-radius":"Range of search","launch-search-btn":"Search",recover_pw_title:"Recover password",recover_pw_greeting:"Please enter your email below to start the password recovery",okay_btn:"Okay",cancel_btn:"Cancel","email-placeholder":"e.g. member@example.com",send_recovery_link_btn:"Send recovery link",please_wait:"Please wait...",pw_recovery_email_sent:"A recovery link has been sent to your email account.",close:"Close","claim-profile-dlg-title":"Claim your profile","claim-profile-dlg-greeting":"Enter your email below to claim your profile!","claim-profile-dlg-congrat":"Check your email for a link to finish claiming the profile","claim-profile-ok-btn-label":"Send link",connect:"Connect","search-fail-ack":"Browse all profiles","search-fail-body":"No profiles matched your search","search-fail-title":"Search results","share-dlg-title":"Share profile","share-dlg-msg":"Press the button below to copy a shareable link for this profile to your clipboard.","share-dlg-link-copied":"Profile link copied to clipboard!","auth-type-fail-dlg-title":"Login type not allowed","auth-type-fail-dlg-msg":"No login detected, please log in to your membership account first.","auth-type-fail-dlg-btn":"Okay","add-profile-prologue":"","pfe-select-a-tag":"Select a tag","pfe-select-tags":"Select tag(s)"},this._enforce_federated_login=[],this._overview_click_action="popup",this._delinquent=!1,this._filter_bar={desktop:[],mobile:[],design:{desktop:{internal_frame:"",external_frame:""},mobile:{internal_frame:"",external_frame:""}}},this._mapconfiguration="onToggle",this._pagination={initial_count:15,showmore_count:15},this._welcomeFlow="login-and-signup",this._mapDesign={map_design:{appearance:"mapbox_colour",pin_click:"popup_single"},interaction:"standard",overridden:!1},this._toolbarBtnConfig={search:{label:"Search",disposition:"show"},add_entry:{label:"Add entry",disposition:"show"},map_toggle:{label:"",disposition:"show"},edit_entry:{label:"Edit",disposition:"show"},account:{label:"Account",disposition:"show"},tag:{label:"Tags",disposition:"show"},ordering:{label:"Order by...",disposition:"show"}},this._moderation="open",this._filter_config={tag_match:"all",respect_word_boundary:"yes"},this._search_type="basic",this._searchLayout={show_location_field:!0},this._featured={text:"Featured",includeInFilterResult:!1,only_featured_by_default:!1},this._uiElemList={button:{fgColour:"ffffff",bgColour:"1fca98",label:"Button"},social_media:{fgColour:"55606b",bgColour:void 0,label:"Social media"},link:{fgColour:"77b3f4",bgColour:void 0,label:"Link"},tag:{fgColour:"ffffff",bgColour:"55606b",label:"Tag"},dialog_title:{fgColour:"ffffff",bgColour:"77b3f4",label:"Dialog box"},profile_name:{fgColour:"5d257c",bgColour:void 0,label:"Title"},label:{fgColour:"5d257c",bgColour:void 0,label:"Label"},location_text:{fgColour:"5d257c",bgColour:void 0,label:"Location"},paragraph:{fgColour:"000000",bgColour:void 0,label:"Paragraph"},subtitle:{fgColour:"55606b",bgColour:void 0,label:"Subtitle"},location:{fgColour:"55606b",bgColour:void 0,label:"Location"},connect:{fgColour:"ffffff",bgColour:"55606b",label:"Connect"},tag_dlg_title:{fgColour:void 0,bgColour:void 0,label:"Filter"},tag_filter_prompt:{fgColour:void 0,bgColour:void 0,label:"search..."}},this._mspInteg={ignore_memberspace_context:!1},this._link_behaviour="_blank",this._cutoff_limit=25,this._overviewLocDisp="default",this._phoneNbFormat="freeform",this._profilePicAspect="circle",this._upload_img="upload-image",this._overviewDesign="default",this._distanceUnit="mile",this._orderingConfig={directory_ordering:{type:"most-recent"}},this._postAddEntryFlow={title:"Entry submitted",text:"Your entry has been submitted, it will become visible once the directory owner has reviewed it.",redirect:void 0},this._layout={},this._toolbar_configuration="default",this._location_search_placeholder="e.g. Vancouver, British Columbia",this._connect_questionnaire=[{question:"Please enter your website",input_type:"one-line",key:"matchmaker-website"},{question:"Add a note",input_type:"paragraph",key:"note-for-connection"}],this._connection_made_msg="Your connection request has been sent.",this._default_proximity_distance=5,this._uiElemList.button.bgColour=e.settings.colour.button,this._uiElemList.social_media.fgColour=e.settings.colour.social_media,this._uiElemList.link.fgColour=e.settings.colour.link,this._uiElemList.tag.bgColour=e.settings.colour.tags,this._uiElemList.tag.fgColour=e.settings.colour.tag_label,this._uiElemList.dialog_title.bgColour=e.settings.colour.dialog_title,this._uiElemList.profile_name.fgColour=e.settings.colour.profile_name,this._uiElemList.paragraph.fgColour=e.settings.colour.paragraph,this._uiElemList.subtitle.fgColour=e.settings.colour.businessname_text,this._uiElemList.connect.bgColour=e.settings.colour.connect_bkg,this._uiElemList.connect.fgColour=e.settings.colour.connect_fg,this._uiElemList.label.fgColour=e.settings.colour.label,this._uiElemList.location.fgColour=e.settings.colour.location_text,e.settings.colour.hasOwnProperty("button_label")&&(this._uiElemList.button.fgColour=e.settings.colour.button_label),e.settings.colour.hasOwnProperty("tag_label")&&(this._uiElemList.tag.fgColour=e.settings.colour.tag_label);for(const t in e.settings.uiElemList)console,this._uiElemList[t]=e.settings.uiElemList[t];void 0!==e.settings.toolbar_btn_config&&Object.keys(e.settings.toolbar_btn_config).forEach((t=>{this._toolbarBtnConfig[t]=e.settings.toolbar_btn_config[t]})),void 0!==e.settings.search_layout&&Object.keys(e.settings.search_layout).forEach((t=>{this._searchLayout[t]=e.settings.search_layout[t]})),void 0!==e.settings.ordering_config&&void 0!==e.settings.ordering_config.directory_ordering&&(this._orderingConfig.directory_ordering=e.settings.ordering_config.directory_ordering),void 0!==e.settings.hideAddEntry&&"on"===e.settings.hideAddEntry&&(this._toolbarBtnConfig.add_entry.disposition="hide",this._toolbarBtnConfig.edit_entry.disposition="hide",this._toolbarBtnConfig.account.disposition="hide"),e["link behaviour"]&&(this._link_behaviour=e["link behaviour"]["external links"]),e.cutoff_limit&&(this._cutoff_limit=e.cutoff_limit);const n={_moderation:"moderation",_postAddEntryFlow:"post_add_entry_flow",_welcomeFlow:"welcome_flow",_pagination:"pagination",_overviewLocDisp:"overview_loc_disp",_phoneNbFormat:"phone_nb_format",_profilePicAspect:"profile_img_aspect",_overviewDesign:"overview_design",_distanceUnit:"distance_unit",_sharing_url:"sharing_url",_hidemap:"hidemap",_mapconfiguration:"mapconfiguration",_defaultProfilePicture:"defaultProfilePicture",_hostedPageLogo:"hostedPageLogo",_bannerText:"bannerText",_matchmaking:"matchmaking",_hide_contact_details:"hide_contact_details",_keep_hosted_banner_size:"keep_hosted_banner_size",_isExample:"isExample",_search_type:"search_type",_bespokeMatchMakeChoice:"connection_destination_choice",_matchmakeBespokeDestination:"bespoke_connection_destination",_fontFamily:"font_family",_fontWeight:"font_weight",_toolbar_configuration:"toolbar_configuration",_location_search_placeholder:"location_search_placeholder",_upload_img:"upload_img",_add_profile_prologue:"add_profile_prologue",_default_proximity_distance:"default_proximity_distance",_filter_config:"filter_config",_connection_made_msg:"connection_made_msg",_overview_click_action:"overview_click_action",_enforce_federated_login:"enforce_federated_login"};if(void 0!==e.wording)for(const t in e.wording)this._localisation_dict[t]=e.wording[t];!0!==this._mapDesign.overridden&&void 0!==e.settings.map_design&&(this._mapDesign={map_design:e.settings.map_design,interaction:"standard"});for(const t in n)void 0!==e.settings[n[t]]&&(this[t]=e.settings[n[t]]);if("open"===this._moderation&&void 0===e.settings.post_add_entry_flow&&(this._postAddEntryFlow=void 0),void 0!==e.settings.connect_form)try{this._connect_questionnaire=e.settings.connect_form.questions}catch(e){console.error(e)}if(void 0!==e.settings.layout&&"string"==typeof e.settings.layout&&e.settings.layout.length>0)try{this._layout=JSON.parse(e.settings.layout)}catch(e){console.error(e)}const r=e.settings.filter_bar_components;r instanceof Array?this._filter_bar={desktop:r,mobile:r,design:{desktop:{internal_frame:"",external_frame:""},mobile:{internal_frame:"",external_frame:""}}}:r&&(this._filter_bar=r,void 0===this._filter_bar.design&&(this._filter_bar.design={desktop:{internal_frame:"",external_frame:""},mobile:{internal_frame:"",external_frame:""}})),void 0!==e.settings.featured_banner_text&&(this._featured.text=e.settings.featured_banner_text),void 0!==e.settings.include_featured_in_result&&(this._featured.includeInFilterResult=e.settings.include_featured_in_result),void 0!==e.settings.login_msg&&(this._loginMsg=0===e.settings.login_msg.length?void 0:e.settings.login_msg),void 0!==e.settings.ignore_memberspace_context&&(this._mspInteg.ignore_memberspace_context=e.settings.ignore_memberspace_context),this.apply_palette_to_layout(),i&&this.apply_overrides(t,i),this._delinquent=!0===e.delinquent}apply_palette_to_layout(){for(const e in this._layout){let t=JSON.stringify(this._layout[e]);t=this.apply_palette_to({palette:this._layout[e].palette,data:t}),t=this.apply_type_to({fonts:this._layout[e].font,data:t}),this._layout[e]=JSON.parse(t);for(const t in this._layout[e].patterns)void 0===this._layout[e].patterns[t].type&&(this._layout[e].patterns[t].type="default")}}apply_overrides(e,t){for(const i in e)switch(i){case"map_config":switch(e[i]){case"off":this._hidemap="on";break;case"toggle":this._mapconfiguration="onToggle";break;case"front_page":this._mapconfiguration="alwaysVisible"}break;case"featured-only":this._featured.only_featured_by_default=!0;break;case"name_clr":this._uiElemList.profile_name.fgColour=e[i].slice(1);break;case"subtitle_clr":this._uiElemList.subtitle.fgColour=e[i].slice(1);break;case"button_clr":this._uiElemList.button.bgColour=e[i].slice(1);break;case"tag_clr":this._uiElemList.tag.bgColour=e[i].slice(1);break;case"h_margin":t.style.marginRight=`${e[i]}px`,t.style.marginLeft=`${e[i]}px`;break;case"v_margin":t.style.marginTop=`${e[i]}px`,t.style.marginBottom=`${e[i]}px`;break;case"font_type":"theme"===e[i]?t.style.fontFamily="inherit":t.style.fontFamily="quicksand"}}apply_type_to(e){if(void 0===e.fonts)return e.data;for(const t in e.fonts){const i=new RegExp(`f_${t}_f`,"g");e.data=e.data.replace(i,`${e.fonts[t]}`)}return e.data}apply_palette_to(e){if(void 0===e.palette)return e.data;for(const t in e.palette){const i=new RegExp(`c_${t}_c`,"g");e.data=e.data.replace(i,`#${e.palette[t]}`)}return e.data}}},1375:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.category_edit_ctrl=void 0;const n=i(1372),r=i(9882),o=i(7102),s=i(4405),a=i(8278);class l extends n.field_edit_ctrl{data(){return this._chosenTags.join(",")}has_data(){return this._chosenTags.length>0}viewHtmlElem(){let e=this.leftOfViewRow()+'
'+(this._field.detailLabel?`
${this._field.detailLabel}
`:"")+'
"+this.rightOfViewRow();const t=o.div("",[]);t.innerHTML=e;const i=t.querySelector("[flexrow]");return(0,r.ExtractCategoryArrayFrom)(this._entry.getValueOf(this._field.key)).forEach((e=>{if(0===e.length)return;const t=e.replace(/&/g,"&"),n=o.div("nobreak",[],{text:t,classes:["cbeb-entry-tag","cbeb-detail-tag","cbeb-custom-clr-tag"],on_click:()=>{this._launch_search&&this._launch_search(e)}});n.setAttribute("category",this._field.label),n.setAttribute("tag",t),i.appendChild(n)})),t}buildTagWithDelete(e,t){const i=new s.Colour(this._config.fgColourOf("tag")||"ffffff");return o.div("tag-workbench",[o.p("tag-workbench-label",e,{design:`color: ${i.colourCode()};`}),o.button("svg flex","",(()=>{t(e)}),{svg:"bin",svgColour:i,svgDim:{width:new a.Measure(15,"px"),height:new a.Measure(15,"px")}})],{design:`background-color: ${this._config.bgColourOf("tag")};`})}handleTagDeletion(e,t){setTimeout((()=>{t.availableTags.push(e),t.availableTags=(0,r.SortTags)(t.availableTags,t.field),this._chosenTags=this._chosenTags.filter((t=>t!==e)),this.buildWorkbench(t)}))}buildTagWorkbench(e){return o.div("tag-workbench-frame",this._chosenTags.map((t=>this.buildTagWithDelete(t,(()=>{this.handleTagDeletion(t,e)})))))}buildTagSelectCtrl(e,t){const i=1===this._field.multiSelect?this._config.get_wording("pfe-select-a-tag"):this._config.get_wording("pfe-select-tags"),n=1===this._field.multiSelect&&this._chosenTags.length>0?this._chosenTags[0]:void 0,r=o.select("tag-workbench-select-ctrl",e.map((e=>({value:e,label:e}))),{on_selection_change:e=>{t(e)},placeholder:i,default:n});return 1===this._field.multiSelect?r:o.div("flex row",[r],{design:"column-gap: 7px"})}removeChosenTagsFrom(e){return e.filter((e=>!1===this._chosenTags.includes(e)))}onTagSelection(e,t,i){var n;if(null===(n=i.container.parentElement)||void 0===n||n.removeAttribute("missing_required_field"),1!==i.field.multiSelect){const n=i.field.multiSelect;if("number"==typeof n&&this._chosenTags.length>=n)return o.remove_all_child_elements_from(t),void t.appendChild(o.p("tag-workbench-error-msg",`You may select at most ${n} tags from the list`));setTimeout((()=>{this._chosenTags.push(e),this._chosenTags=(0,r.SortTags)(this._chosenTags,i.field),i.availableTags=i.availableTags.filter((t=>t!==e)),this.buildWorkbench(i)}))}else this._chosenTags=[e]}buildWorkbench(e){const t=o.div("flex row",[]);o.remove_all_child_elements_from(e.container),1!==e.field.multiSelect&&this._chosenTags.length>0&&(e.container.appendChild(this.buildTagWorkbench(e)),e.container.appendChild(t)),e.container.appendChild(this.buildTagSelectCtrl(e.availableTags,(i=>{this.onTagSelection(i,t,e)})))}inputHtmlElem(){const e=(0,r.ExtractCategoryArrayFrom)(this._field.get().fieldChoices),t=(0,r.SortTags)(e,this._field),i=1===this._field.multiSelect?t:this.removeChosenTagsFrom(t),n=o.div("category-workbench-container",[]);this.buildWorkbench({container:n,field:this._field,availableTags:i});const s=o.div("flex col",[o.p("cbeb-entry-input-label",`${this._field.label}${!0===this._field.required?" (required)":""}`),n]);return s.setAttribute("fieldkey",this._field.key),s}constructor(e,t,i,n){super(e,t),this._entry=e,this._field=t,this._config=i,this._launch_search=n,this._chosenTags=[],this._chosenTags=(0,r.SortTags)((0,r.ExtractCategoryArrayFrom)(this._entry.getValueOf(this._field.key)),this._field)}}t.category_edit_ctrl=l},2712:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.copy=void 0,t.copy=function(e){let t=document.createElement("textarea");t.value=e,document.body.appendChild(t),t.select();try{document.execCommand("copy")}catch(e){}document.body.removeChild(t)}},4405:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Colour=void 0,t.Colour=class{colourCode(){return this._input.includes("#")?this._input:`#${this._input}`}constructor(e){this._input=e}}},2705:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CommunityCache=void 0,t.CommunityCache=class{constructor(e,t){this._key=e,this._communityDetails=t}get key(){return this._key}IsOnFreePlan(){return!(/positiveimpactevents/.test(window.location.href)||this._communityDetails.hasOwnProperty("plan")&&"starter - free"!==this._communityDetails.plan)}GetGDPROptinMsg(){return this._communityDetails.hasOwnProperty("gdpr_msg")?this._communityDetails.gdpr_msg:""}PromptForPword(){return!this._communityDetails.hasOwnProperty("nopword")||"on"!==this._communityDetails.nopword}GetSignupMsg(){return this._communityDetails.hasOwnProperty("signup_msg")?this._communityDetails.signup_msg:""}GetCommunityName(){return this._communityDetails&&this._communityDetails.hasOwnProperty("community_name")?this._communityDetails.community_name:"n/a"}GetEmailContact(){return this._communityDetails&&this._communityDetails.hasOwnProperty("community_email_contact")?this._communityDetails.community_email_contact:"n/a"}HasTandC(){return this._communityDetails.hasOwnProperty("t_and_c_url")&&this._communityDetails.t_and_c_url.length>0}TandC(){return this.HasTandC()?this._communityDetails.t_and_c_url:""}}},5743:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConfirmEmailDialogBox=void 0;const n=i(1370),r=i(3189),o=i(9984);t.ConfirmEmailDialogBox=class{constructor(){this._dlgElem=document.getElementById("cbeb-confirmemail-modal"),this._msgElem=document.getElementById("cbeb-confirmemail-msg"),this._spinnerElem=document.getElementById("cbeb-confirmemail-loader"),this._okButtonElem=document.getElementById("cbeb-confirmemail-ok-btn"),n.DialogBoxMgr.registerDialogBox(this._dlgElem)}show(e){this._okButtonElem.style.display="none",r.Styling.applyAllStylesTo({rootElem:this._dlgElem,withConfig:e}),n.DialogBoxMgr.show(this._dlgElem),this.TryToVerifyMemberEmail({onSuccess:()=>{this._spinnerElem.style.display="none",this._msgElem.innerHTML="

🎉

Your email has been verified and your account is now active!

",this._okButtonElem.style.display="flex"},onFailure:e=>{this._spinnerElem.style.display="none",this._msgElem.innerHTML=JSON.stringify(e),this._okButtonElem.style.display="flex"}})}getQueryParams(e){e=e.split("+").join(" ");for(var t,i={},n=/[?&]?([^=]+)=([^&]*)/g;t=n.exec(e);)i[decodeURIComponent(t[1])]=decodeURIComponent(t[2]);return i.hasOwnProperty("a")&&i.hasOwnProperty("b")?{authID:i.a,validationToken:i.b}:i.hasOwnProperty("c")&&i.hasOwnProperty("d")?{authID:i.c,pwResetValidationToken:i.d}:i.hasOwnProperty("mk")&&i.hasOwnProperty("invite")?{memberKey:i.mk,invitationToken:i.invite}:i.hasOwnProperty("mk")&&i.hasOwnProperty("cr")?{memberKey:i.mk,connectionToken:i.cr}:i.hasOwnProperty("overlay")?{entryKey:i.overlay}:{}}getQueryPartOfUrl(){var e=window.location.href.split("?");return e.length>1?"?"+e[1]:""}TryToVerifyMemberEmail(e){var t=this.getQueryParams(this.getQueryPartOfUrl());new XMLHttpRequest,(0,o.PostRequest)({url:"https://api.communitybox.co/verify/memberemail",payload:t,callback:{onResult:t=>{t.hasOwnProperty("err")?e.onFailure(t.err):e.onSuccess()},onFailure:t=>{e.onFailure(t)}}})}Close(){n.DialogBoxMgr.close(),document.getElementById("cbeb-toolbar-post").className+=" cbeb-pulse-colour"}}},7304:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectionDialogBox=void 0;const n=i(1370),r=i(3189),o=i(9984),s=i(3061),a=i(7102),l=i(5902),c=i(6852);t.ConnectionDialogBox=class{constructor(){this._dlgElem=document.querySelector("[cbeb-connection-modal]"),this._requestingElem=this._dlgElem.querySelector("[requesting-connection]"),this._connectionMade=this._dlgElem.querySelector("[connection-made]"),this._containerElem=document.getElementById("cbeb-view-connection-modal-field-container"),n.DialogBoxMgr.registerDialogBox(this._dlgElem),this._requestingElem.style.display="none",this._connectionMade.style.display="none"}photoFileInitValue(e,t){const i=(0,c.PictureDataFrom)(t);return['style="',`background-image: url('${void 0!==i.key&&i.key.length>0?(0,s.PictureLinkFrom)(i,`https://dashboard.communitybox.co/img/uploaded/${e.defaultProfilePictureKey}.jpeg`):"https://dashboard.communitybox.co/img/uploaded/"+e.defaultProfilePictureKey+".jpeg"}');`,`transform: rotate(${i.rotation}deg);`,`background-position-x: ${i.offset.x};`,`background-position-y: ${i.offset.y};`,`border-radius: ${"circle"===e.profilePictureAspect?"50%":"0%"};`,"fit"===e.profilePictureAspect?"background-size: contain; background-color: transparent;":"",'"'].join("")}leftOfInputRow(e){return`
\n
\n
`}rightOfInputRow(){return'
'}populateConnectionFields(e,t,i,n){var r="";i.forEachField((e=>{if("image-input"===e.ctrlType&&"image-input"===e.ctrlType){const i='
';r+=i}})),r+='
';var o=this.leftOfInputRow()+'
Please enter your name
'+this.rightOfInputRow();r+=o,o=this.leftOfInputRow()+'
Please enter your email address
'+this.rightOfInputRow(),r+=o,n.for_every_connect_question((e=>{var t=this.leftOfInputRow()+`
${e.question}
\n
\n ${"one-line"===e.input_type?``:``}\n
`;this.rightOfInputRow(),r+=t})),r+='
',r+="
",e.innerHTML=r}showForEntry(e,t,i,o){this._containerElem.style.display="block",this._requestingElem.style.display="none",this._connectionMade.style.display="none";const s=this._dlgElem.querySelector("#cbeb-connection-dlg-title");s.textContent="Connect with "+e.getDisplayNameForTemplate(t),s.style.visibility="hidden",this.populateConnectionFields(this._containerElem,e,t,i),this._dlgElem.querySelectorAll("[connect-button]")[0].addEventListener("click",(()=>{this.onConnect(e,t,i,o)})),r.Styling.applyAllStylesTo({rootElem:this._dlgElem,withConfig:i}),n.DialogBoxMgr.show(this._dlgElem),this._containerElem.scrollTop=0}onConnect(e,t,i,n){this._containerElem.style.display="none",this._requestingElem.style.display="flex";const r=this._dlgElem.querySelector("[matchmaker-email]"),s=this._dlgElem.querySelector("[matchmaker-name]"),c=[];i.for_every_connect_question((e=>{const t="one-line"===e.input_type?this._dlgElem.querySelector(`input[key="${e.key}"]`):this._dlgElem.querySelector(`textarea[key="${e.key}"]`);t&&c.push({question:e.question,answer:t.value})}));const u={box:n,initiatorEmail:r.value,initiatorName:s.value,answers:c,destinationKey:e.key};void 0!==i.matchMakeDestinationChoice&&"bespoke"===i.matchMakeDestinationChoice&&(u.bespoke_destination=i.matchMakeBespokeDestination,u.destinationDisplayName=e.getDisplayNameForTemplate(t)),(0,o.PostRequest)({url:"/matchmaking/initiate/connection",payload:u,callback:{onResult:()=>{this._requestingElem.style.display="none",(0,l.empty)(this._connectionMade),this._connectionMade.appendChild(a.p("",i.connection_made_msg)),this._connectionMade.style.display="flex"},onFailure:function(e){console.error(e)}}})}}},7522:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectionLookupDialogBox=void 0;const n=i(1370),r=i(3189),o=i(9984);t.ConnectionLookupDialogBox=class{constructor(e){this._dlgElem=document.querySelector("[cbeb-connection-lookup-dlg]"),this._foundElem=this._dlgElem.querySelector("[found-connection]"),this._mailLink=this._dlgElem.querySelector("[mail-link]"),this._lookingUpElem=this._dlgElem.querySelector("[looking-up-data]"),n.DialogBoxMgr.registerDialogBox(this._dlgElem),r.Styling.applyAllStylesTo({rootElem:this._dlgElem,withConfig:e}),this._foundElem.style.display="none"}Show(e){n.DialogBoxMgr.show(this._dlgElem),(0,o.PostRequest)({url:"https://api.communitybox.co/matchmaking/make/connection",payload:{destinationKey:e.destinationKey,connectionToken:e.connectionToken},callback:{onResult:e=>{this._lookingUpElem.style.display="none",this._foundElem.style.display="flex",this._mailLink.href="mailto:"+e.email,this._mailLink.textContent=e.email},onFailure:function(e){console.error(e)}}})}Close(){n.DialogBoxMgr.hideAll()}}},4650:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CookieCutterTemplate=void 0,t.CookieCutterTemplate=class{getMarkup(e){return this._cookiecutter["markup"+(e||"")]}getStyle(e){return this._cookiecutter["css"+(e||"")]}constructor(e){this._cookiecutter=e}}},3523:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.read_cookie=t.write_cookie=void 0,t.write_cookie=function(e,t){document.cookie=`${e}=${t}; path=/`},t.read_cookie=function(e){if(document.cookie.length>0){let t=document.cookie.indexOf(`${e}=`);if(-1!==t){t=t+e.length+1;let i=document.cookie.indexOf(";",t);return-1===i&&(i=document.cookie.length),unescape(document.cookie.substring(t,i))}}}},940:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultOverviewBuilder=void 0;const n=i(3291),r=i(9786),o=i(3061),s=i(2725),a=i(6852),l=i(9882);class c extends n.OverviewBuilder{buildOverviewFeaturedBannerHtml(e,t){return["
",e.isFeatured()&&e.featureLevel()>0?`
${t.featuredBannerText}
`:"","
"].join("")}buildOverviewPhotoHtml(e,t,i){const n="circle"===i.profilePictureAspect?"50%":"0",s=t.getRuleForType(r.TemplateRuleType.Picture),l=s.length>0?e.getValueOf(s[0].key):void 0,c=(0,a.PictureDataFrom)(l);return`\n
\n
`}buildDisplayNameHtml(e,t,i){return[`
',e.getDisplayNameForTemplate(t),"
"].join("")}buildOverviewOtherNameHtml(e,t,i){const n=t.getRuleForType(r.TemplateRuleType.OtherTitle);let o="";if("e52472c4-095a-4670-9c79-dea8d0933421"===e.box){let t=0;return n.forEach((t=>{e.hasValueForField(t.key)&&(o+=`

${e.getValueOf(t.key)}

`)})),""!==o?[`
0?"flex-direction: column;":"flex-direction: row;"}">`,o,"
"].join(""):""}return n.forEach((t=>{e.hasValueForField(t.key)&&(o+=e.getValueOf(t.key)+t.interval)})),""!==o?['
',o,"
"].join(""):""}getRuleValue(e,t){return t&&e.hasValueForField(t)?e.getValueOf(t):void 0}buildOverviewCategoriesHtml(e,t,i){const n=t.getRuleForType(r.TemplateRuleType.Category);return['
',Object.keys(n).map((e=>n[e].key)).map((i=>({category_name:t.getLabelFor(i)||"unknown",tags:(0,l.ExtractCategoryArrayFrom)(e.getValueOf(i))}))).map((e=>e.tags.map((t=>`
\n ${t}
`)).join(""))).join(""),"
"].join("")}addOverviewBioSnippet(e,t,i){if(null===t)return"";let n="";if(t.length<100)n=t;else{for(var r=0,o=0;o<100;o++)" "===t[o]&&(r=o);n=t.substring(0,r)+"..."}return['
',n,"
",`
read more
"].join("")}buildOverviewParagraphHtml(e,t,i){const n=t.getRuleForType(r.TemplateRuleType.Paragraph).map((t=>e.hasValueForField(t.key)?`${this.getRuleValue(e,t.key)}${t.interval}`:"")).join("");return n?this.addOverviewBioSnippet(e,n,i):""}mapsUrlFrom(e){return void 0!==e.place_URL?e.place_URL:`https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(e.formatted_address)}&query_place_id=${e.placeID}`}formatted_location_display_for(e,t){switch(t){case"default":return s.default_format(e);case"street only":return s.street_only(e);case"city & state":return s.city_and_state(e);case"city only":return s.city_only(e);case"full":return e}}overviewLocationFrom(e,t){return void 0===e?"":-1===e.indexOf(",")?e:this.formatted_location_display_for(e,t.overviewLocationDisplay)}buildOverviewLocationHtml(e,t,i){const n=t.getRuleForType(r.TemplateRuleType.Location);let o=n&&n.length>0?this.getRuleValue(e,n[0].key):void 0;if("string"==typeof o)try{o=JSON.parse(o)}catch(e){o={formatted_address:o.trim(),lat:0,lng:0,place_URL:`https://www.google.com/maps/search/?api=1&query='${o.trim()}'`}}return"object"==typeof o&&o.hasOwnProperty("formatted_address")?['"].join(""):""}addSocialMediaSummary(e,t,i){let n='
';return t.forEach((t=>{const r=(0,l.GetURLandGlyphForSocialMedia)(e,t);n+=``})),n+="
",n}buildOverviewSocialMediaHtml(e,t,i){let n=t.getRuleForType(r.TemplateRuleType.SocialMedia).map((e=>t.getField(e.key))).filter((e=>void 0!==e)).filter((e=>e.isSocialMediaField())).filter((t=>e.hasValueForField(t.key)));return this.addSocialMediaSummary(e,n,i)}buildOverviewConnectHtml(e,t,i){return i.matchMakingEnabled&&e.has_valid_email_address(t)||i.matchMakingEnabled&&"bespoke"===i.matchMakeDestinationChoice?`
`:""}buildOverviewHtml(e,t,i){const n=[this.buildOverviewFeaturedBannerHtml(e,i),t.hasImageField()?this.buildOverviewPhotoHtml(e,t,i):"",this.buildDisplayNameHtml(e,t,i),this.buildOverviewOtherNameHtml(e,t,i),this.buildOverviewCategoriesHtml(e,t,i),this.buildOverviewParagraphHtml(e,t,i),this.buildOverviewLocationHtml(e,t,i),this.buildOverviewSocialMediaHtml(e,t,i),this.buildOverviewConnectHtml(e,t,i)].join(""),r=document.createElement("div");return r.setAttribute("class","box-entry-overview-container"),r.setAttribute("id","emb-"+e.key),r.innerHTML=n,r}build_top_row(){}getProfileFlexBasis(e){var t=100,i=e.forClientWidth;return[{width:449,basis:50},{width:624,basis:33},{width:779,basis:25},{width:999,basis:20},{width:1219,basis:16},{width:1439,basis:14}].forEach((function(e){i>e.width&&(t=e.basis)})),t}}t.DefaultOverviewBuilder=c},3838:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DeleteDialogBox=void 0;const n=i(3189),r=i(6578),o=i(9984),s=i(1370);t.DeleteDialogBox=class{constructor(e){this._dlgElem=document.getElementById("cbeb-delete-entry-modal"),this._loaderElem=document.getElementById("cbeb-delete-entry-loader"),this._callbacks={onDelete:()=>{},onFailure:e=>{}},n.Styling.applyAllStylesTo({rootElem:this._dlgElem,withConfig:e}),s.DialogBoxMgr.registerDialogBox(this._dlgElem)}ShowForEntry(e,t,i,n,r){this._callbacks=e,document.getElementById("cbeb-delete-confirmation-msg").innerHTML="Are you sure you want to delete "+t.getDisplayNameForTemplate(i)+"?",this._loaderElem.style.display="none",this._dlgElem.style.display="block",document.getElementById("cbeb-confirm-delete-btn").addEventListener("click",(()=>{this.Spin(),this.TryToDeleteEntry(t,n,r,{onDelete:()=>{this._dlgElem.style.display="none",this._callbacks.onDelete()},onFailure:e=>{this._callbacks.onFailure(e)}})}))}Close(){this._dlgElem.style.display="none"}TryToDeleteEntry(e,t,i,n){const s=r.AuthCache.getAuth();if(void 0!==s){var a={payload:{entryID:e.key,boxID:t,communityID:i},auth:{authID:s.authID,token:s.token}};(0,o.PostRequest)({url:"https://api.communitybox.co/memberdeleteentry",payload:a,callback:{onResult:e=>{e.hasOwnProperty("err")?n.onFailure(e.err):n.onDelete()},onFailure:e=>{n.onFailure(e)}}})}}Spin(){this._dlgElem.style.display="none",this._loaderElem.style.display="block"}}},9725:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mobile_aspect=void 0,t.mobile_aspect=function(){return(window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth)<511}},1370:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DialogBoxMgr=void 0;class i{static registerDialogBox(e){i._dlgBoxElems.push(e)}static hideAll(){i._dlgBoxElems.forEach((function(e){e.style.display="none",document.body.classList.remove("cbeb-noscroll")}))}static show(e){i.hideAll(),e.style.display="block",document.body.classList.add("cbeb-noscroll")}static close(){i.hideAll(),document.body.classList.remove("cbeb-noscroll")}static buildAndRegisterDialogElement(e){const t=document.createElement("div");return t.setAttribute(e.key,""),t.classList.add("cbeb-modal"),t.innerHTML=`\n
\n
\n
${e.title}
\n ${e.default_close?'\n \n \n \n \n ':""}\n
\n
\n ${e.body}\n
\n
`,this.registerDialogBox(t),t}}t.DialogBoxMgr=i,i._dlgBoxElems=[]},7102:(e,t)=>{"use strict";function i(e,t){for(const i of e.split(" ").filter((e=>e.length>0)))if(-1!==i.indexOf("=")){const e=i.split("=");t.setAttribute(e[0],e[1])}else t.setAttribute(i,"")}function n(e){var i,n;const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("height",e.dimensions?e.dimensions.height.composite():"19px"),r.setAttribute("width",e.dimensions?e.dimensions.width.composite():"19px"),r.setAttribute("viewBox",`0 0 ${(null===(i=t.pathDictionary[e.path].viewBox)||void 0===i?void 0:i.width)||2048} ${(null===(n=t.pathDictionary[e.path].viewBox)||void 0===n?void 0:n.height)||2048}`);const o=document.createElementNS("http://www.w3.org/2000/svg","path");o.setAttribute("d","M0 0h24v24H0V0z"),o.setAttribute("fill","none");const s=document.createElementNS("http://www.w3.org/2000/svg","path");return s.setAttribute("d",t.pathDictionary[e.path].path),e.colour&&s.setAttribute("fill",e.colour.colourCode()),r.appendChild(o),r.appendChild(s),r}Object.defineProperty(t,"__esModule",{value:!0}),t.button=t.svg=t.pathDictionary=t.input=t.datalist=t.video=t.spacer=t.div=t.progress=t.title=t.elem=t.li=t.i=t.span=t.ul=t.img=t.p=t.anchor=t.select=t.textarea=t.h=t.option=t.remove_all_child_elements_from=void 0,t.remove_all_child_elements_from=function(e){for(;e.firstChild;)null!==e.lastChild&&e.removeChild(e.lastChild)},t.option=function(e){const t=document.createElement("option");return t.defaultSelected=!0===e.default,t.value=e.value,t.textContent=e.text||e.value,t},t.h=function(e,t){const i=document.createElement(`h${e}`);return i.textContent=t,i},t.textarea=function(e,t,i,n){const r=document.createElement("textarea");return r.value=e,r.rows=i,r.cols=t,r.wrap=n?"wrap":"off",r},t.select=function(e,t,n){const r=document.createElement("select");if(n&&(n.dropdown_design&&r.setAttribute("style",n.dropdown_design),n.on_selection_change&&r.addEventListener("change",(()=>{n.on_selection_change&&n.on_selection_change(r.value)})),n.placeholder)){const e=document.createElement("option");e.value="placeholder-default",e.textContent=n.placeholder,e.defaultSelected=!0,e.disabled=!0,r.appendChild(e)}for(const e of t.sort(((e,t)=>e.label.localeCompare(t.label)))){const t=document.createElement("option");t.value=e.value,t.textContent=e.label,n&&n.choice_design&&t.setAttribute("style",n.choice_design),n&&n.default&&n.default===e.value&&(t.defaultSelected=!0),r.appendChild(t)}return i(e,r),r},t.anchor=function(e,t,n,r){const o=document.createElement("a");return o.textContent=t,o.href=n,(null==r?void 0:r.design)&&o.setAttribute("style",r.design),"yes"===(null==r?void 0:r.open_in_new_tab)&&(o.target="_blank"),i(e,o),o},t.p=function(e,t,n){const r=document.createElement("p");return r.textContent=t,i(e,r),(null==n?void 0:n.design)&&r.setAttribute("style",n.design),r},t.img=function(e,t,n){const r=document.createElement("img");return r.src=t,i(e,r),(null==n?void 0:n.design)&&r.setAttribute("style",null==n?void 0:n.design),r},t.ul=function(e,t,n){const r=document.createElement("ul");r.style.listStyle="none",i(e,r);for(const e of t)r.appendChild(e);return n&&r.setAttribute("style",n),r},t.span=function(e){const t=document.createElement("span");return t.textContent=e,t},t.i=function(e){const t=document.createElement("i");return e&&e.class&&t.setAttribute("class",e.class),t},t.li=function(e,t,n,r){const o=document.createElement("li");return o.textContent=t,i(e,o),n&&o.setAttribute("style",n),r&&o.addEventListener("click",(()=>{r()})),o},t.elem=function(e,t,n){const r=document.createElement(e);if(void 0!==t&&i(t,r),void 0!==n)for(const e of n)r.appendChild(e);return r},t.title=function(e){const t=document.createElement("title");return t.textContent=e,t},t.progress=function(){const e=document.createElement("progress");return e.value=0,e.max=100,e},t.div=function(e,t,n){const r=document.createElement("div");i(e,r);for(const e of t)e&&r.appendChild(e);return n&&(n.design&&r.setAttribute("style",n.design),n.text&&(r.textContent=n.text),n.on_click&&r.addEventListener("click",n.on_click),n.classes&&r.setAttribute("class",n.classes.join(" ")),n.key&&(r.id=n.key)),r},t.spacer=function(e){const t=document.createElement("div");return e.height&&(t.style.height=`${e.height}px`),e.width&&(t.style.width=`${e.width}px`),t},t.video=function(e,t){const n=document.createElement("iframe");return n.src=t,n.frameBorder="0",n.allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",n.allowFullscreen=!0,n.style.width="71vw",n.style.height="39vw",i(e,n),n},t.datalist=function(e,t){const i=document.createElement("datalist");i.id=e;for(const e of t){const t=document.createElement("option");t.textContent=e.label,t.value=e.value,i.appendChild(t)}return i},t.input=function(e,t,n,r){const o=document.createElement("input");return i(e,o),n&&o.setAttribute("style",n),(null==r?void 0:r.classes)&&o.setAttribute("class",r.classes.join(" ")),(null==r?void 0:r.placeholder)&&(o.placeholder=r.placeholder),(null==r?void 0:r.datalist)&&o.setAttribute("list",r.datalist),(null==r?void 0:r.type)&&(o.type=r.type),(null==r?void 0:r.initialValue)&&(o.value=r.initialValue),void 0!==t&&o.addEventListener("keyup",(e=>{t(e,o)})),o},t.pathDictionary={bin:{path:"M1792 384h-128v1472q0 40-15 75t-41 61-61 41-75 15H448q-40 0-75-15t-61-41-41-61-15-75V384H128V256h512V128q0-27 10-50t27-40 41-28 50-10h384q27 0 50 10t40 27 28 41 10 50v128h512v128zM768 256h384V128H768v128zm768 128H384v1472q0 26 19 45t45 19h1024q26 0 45-19t19-45V384zM768 1664H640V640h128v1024zm256 0H896V640h128v1024zm256 0h-128V640h128v1024z"},configure:{path:"M19.43 12.98c.04-.32.07-.64.07-.98 0-.34-.03-.66-.07-.98l2.11-1.65c.19-.15.24-.42.12-.64l-2-3.46c-.09-.16-.26-.25-.44-.25-.06 0-.12.01-.17.03l-2.49 1c-.52-.4-1.08-.73-1.69-.98l-.38-2.65C14.46 2.18 14.25 2 14 2h-4c-.25 0-.46.18-.49.42l-.38 2.65c-.61.25-1.17.59-1.69.98l-2.49-1c-.06-.02-.12-.03-.18-.03-.17 0-.34.09-.43.25l-2 3.46c-.13.22-.07.49.12.64l2.11 1.65c-.04.32-.07.65-.07.98 0 .33.03.66.07.98l-2.11 1.65c-.19.15-.24.42-.12.64l2 3.46c.09.16.26.25.44.25.06 0 .12-.01.17-.03l2.49-1c.52.4 1.08.73 1.69.98l.38 2.65c.03.24.24.42.49.42h4c.25 0 .46-.18.49-.42l.38-2.65c.61-.25 1.17-.59 1.69-.98l2.49 1c.06.02.12.03.18.03.17 0 .34-.09.43-.25l2-3.46c.12-.22.07-.49-.12-.64l-2.11-1.65zm-1.98-1.71c.04.31.05.52.05.73 0 .21-.02.43-.05.73l-.14 1.13.89.7 1.08.84-.7 1.21-1.27-.51-1.04-.42-.9.68c-.43.32-.84.56-1.25.73l-1.06.43-.16 1.13-.2 1.35h-1.4l-.19-1.35-.16-1.13-1.06-.43c-.43-.18-.83-.41-1.23-.71l-.91-.7-1.06.43-1.27.51-.7-1.21 1.08-.84.89-.7-.14-1.13c-.03-.31-.05-.54-.05-.74s.02-.43.05-.73l.14-1.13-.89-.7-1.08-.84.7-1.21 1.27.51 1.04.42.9-.68c.43-.32.84-.56 1.25-.73l1.06-.43.16-1.13.2-1.35h1.39l.19 1.35.16 1.13 1.06.43c.43.18.83.41 1.23.71l.91.7 1.06-.43 1.27-.51.7 1.21-1.07.85-.89.7.14 1.13zM12 8c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm0 6c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z"},grab:{path:"M3 15h18v-2H3v2zm0 4h18v-2H3v2zm0-8h18V9H3v2zm0-6v2h18V5H3z"},"back-arrow":{path:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"},share:{viewBox:{width:206.99,height:238.11},path:"m68.39,90.58c7.42-4.59,14.83-9.16,22.24-13.74,12.15-7.51,24.28-15.06,36.46-22.51,1.45-.89,1.78-1.65,1.32-3.34C121.81,26.81,137.82,3.25,162.79.27c24.09-2.88,45.8,17.87,44.08,42.1-1.4,19.69-15.32,34.92-34.8,37.5-11.2,1.48-21.43-1.42-30.33-8.57-.9-.72-1.77-1.49-2.71-2.27-13.75,8.5-27.45,16.98-41.14,25.45-6,3.71-11.99,7.45-18.01,11.12-1.14.7-1.56,1.28-1.14,2.76,1.87,6.68,1.97,13.42.42,20.21-.17.75.4,2.13,1.06,2.55,19.17,12.41,38.4,24.72,57.57,37.13,1.53.99,2.2.17,3.15-.64,22.41-18.8,56.43-8.65,64.43,19.4,7.26,25.45-10.94,48.56-34.27,50.88-24.72,2.46-45.79-17.64-44.16-42.46.18-2.71.68-5.46,1.46-8.06.61-2.01.04-2.89-1.61-3.94-11.23-7.11-22.38-14.32-33.56-21.5-7.27-4.67-14.56-9.3-21.78-14.04-1.46-.96-2.33-1.08-3.77.24-11.51,10.51-24.99,13.76-39.75,9.03-15-4.8-24.07-15.54-27.2-30.98-4.43-21.85,11.87-44.08,33.93-46.74,12.48-1.51,23.31,1.93,32.67,10.22.31.27.63.53,1.05.89Zm77.41-50.7c-.21,11.8,8.98,21.36,20.77,21.61,11.55.24,21.48-9.35,21.66-20.9.18-11.84-9.18-21.6-21.07-21.69-13.77-.11-21.97,11.68-21.36,20.99Zm-.06,158.29c.03,11.96,9.4,21.2,21.45,21.16,11.7-.04,21.06-9.58,21.02-21.42-.04-11.7-9.56-21.05-21.41-21.03-11.79.02-21.1,9.44-21.06,21.29ZM40.23,98.01c-11.24-.69-21.52,9.76-21.29,21.01.25,11.9,9.33,21.35,21.04,21.39,11.9.03,21.45-9.43,21.45-21.27,0-11.8-9.36-21.13-21.21-21.13Z"},close:{path:"M1169 1024l879 879-145 145-879-879-879 879L0 1903l879-879L0 145 145 0l879 879L1903 0l145 145-879 879z"},rotateRight:{path:"M1939 915l90 90-301 301-301-301 90-90 147 146v-37q0-106-27-204t-78-183-120-156-155-120-184-77-204-28q-106 0-204 27t-183 78-156 120-120 155-77 184-28 204q0 106 27 204t78 183 120 156 155 120 184 77 204 28v128q-124 0-238-32t-214-90-181-140-140-181-91-214-32-239q0-124 32-238t90-214 140-181 181-140 214-91 239-32q135 0 261 39t234 110 193 172 138 226q40 94 55 189t15 197l147-146zM896 768q53 0 99 20t82 55 55 81 20 100q0 53-20 99t-55 82-81 55-100 20q-53 0-99-20t-82-55-55-81-20-100q0-53 20-99t55-82 81-55 100-20zm0 384q27 0 50-10t40-27 28-41 10-50q0-27-10-50t-27-40-41-28-50-10q-27 0-50 10t-40 27-28 41-10 50q0 27 10 50t27 40 41 28 50 10z"},rotateLeft:{path:"M2048 1024q0 124-32 238t-90 214-140 181-181 140-214 91-239 32v-128q106 0 204-27t183-78 156-120 120-155 77-184 28-204q0-106-27-204t-78-183-120-156-155-120-184-77-204-28q-106 0-204 27t-183 78-156 120-120 155-77 184-28 204v37l147-146 90 90-301 301-301-301 90-90 147 146v-10q0-98 16-191t54-185q52-124 137-225t193-172 235-111 261-39q124 0 238 32t214 90 181 140 140 181 91 214 32 239zm-640 0q0 53-20 99t-55 82-81 55-100 20q-53 0-99-20t-82-55-55-81-20-100q0-53 20-99t55-82 81-55 100-20q53 0 99 20t82 55 55 81 20 100zm-384 0q0 27 10 50t27 40 41 28 50 10q27 0 50-10t40-27 28-41 10-50q0-27-10-50t-27-40-41-28-50-10q-27 0-50 10t-40 27-28 41-10 50z"},upload:{path:"M1536 0v128H384V0h1152zm45 979l-90 90-467-470v1449H896V599l-467 470-90-90 621-626 621 626z"},previous:{path:"M256 1792V256h128v1536H256zm448-768l1088-768v1536L704 1024zm960 521V503l-738 521 738 521z"},next:{path:"M1664 256h128v1536h-128V256zM256 1792V256l1088 768-1088 768zM384 503v1042l738-521-738-521z"}},t.svg=n,t.button=function(e,t,r,o){const s=document.createElement("button");return t.length>0&&(s.textContent=t),o&&o.design&&s.setAttribute("style",o.design),(null==o?void 0:o.classes)&&s.setAttribute("class",o.classes.join(" ")),i(e,s),s.addEventListener("click",(()=>{r(s)})),void 0!==o&&void 0!==o.svg&&s.appendChild(n({path:o.svg,colour:o.svgColour,dimensions:o.svgDim})),s}},9628:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewElemCache=void 0,t.OverviewElemCache=class{constructor(){this._overviewElems=[]}refresh(e){var t=document.getElementsByClassName(e);this._overviewElems=[];for(var i=0;i{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EditEntryDialogBox=void 0;const n=i(1370),r=i(3189),o=i(9984),s=i(6578),a=i(7001),l=i(2052);class c extends l.profile_dialog_box{constructor(e){super(),this._invariants=e,this._dlgElem=document.getElementById("cbeb-edit-entry-modal"),this._containerElem=this._dlgElem.querySelector("#cbeb-edit-entry-modal-field-container"),this._spinnerElem=this._dlgElem.querySelector("#cbeb-edit-entry-spinner"),this._onApplyCallback=()=>{},this._editCtrls=[],n.DialogBoxMgr.registerDialogBox(this._dlgElem),this._dlgElem.addEventListener("click",(e=>{e.target.matches("button[apply-change]")&&this._onApplyCallback()}))}AddButtonsToBottomOf(e){var t=document.createElement("div");t.innerHTML='
',t.className="cbeb-extra-button-row",e.appendChild(t)}empty(e){for(;e.firstChild;)e.removeChild(e.firstChild)}populateFieldEdit(e,t,i,n,r){this.empty(e);const o=document.createElement("div");o.classList.add("cbeb-edit-entry-error-msg"),e.appendChild(o),this._editCtrls=i.mapFields((e=>e)).sort(((e,t)=>e.rank(0,a.FieldEditCtrlFactory)(t,e,this._invariants,this._dlgElem))),this._editCtrls.forEach((t=>e.appendChild(t.inputHtmlElem()))),this._editCtrls.forEach((e=>e.post_dom_add()));const s=document.createElement("div");s.classList.add("cbeb-edit-entry-error-msg"),e.appendChild(s)}ShowForEntry(e){this._editCtrls=[],this.populateFieldEdit(this._containerElem,e.entry,e.withTemplate,e.withConfig,e.box),this.AddButtonsToBottomOf(this._containerElem),r.Styling.applyAllStylesTo({rootElem:this._dlgElem,withConfig:e.withConfig}),void 0!==e.withConfig.fontFamily?this._dlgElem.style.fontFamily=e.withConfig.fontFamily:this._dlgElem.style.fontFamily="quicksand",n.DialogBoxMgr.hideAll(),this.ShowButtons(),console.log("Updating display value of",this._dlgElem),this._spinnerElem.style.display="none",this._dlgElem.style.display="block",this._containerElem.style.display="block",this._containerElem.scrollTop=0,this._onApplyCallback=()=>{this.onOK(e.box,e.community,e.withTemplate,e.entry,e.refreshBoxCallback,e.failureCallback)}}ShowButtons(){this._dlgElem.querySelectorAll("button").forEach((e=>{e.style.visibility="visible"}))}HideButtons(){this._dlgElem.querySelectorAll("button").forEach((e=>{e.style.visibility="hidden"}))}Spin(){this._containerElem.style.display="none",this._spinnerElem.style.display="block"}TryToUpdateEntry(e,t){(0,o.PostRequest)({url:"https://api.communitybox.co/membereditboxentry",payload:e,callback:{onResult:e=>{e.hasOwnProperty("err")?t.onFailure(e.err):t.onSuccess(e)},onFailure:e=>{t.onFailure(e)}}})}collectEntryData(){return this._editCtrls.reduce(((e,t)=>{const i=t.data();return void 0!==i&&(e[t.fieldKey]=i),e}),{})}onOK(e,t,i,r,o,a){const l=s.AuthCache.getAuth();if(void 0===l)return;const c=this.collectEntryData();c.date_modified=Date.now().toString(),r.hasValueForField("date_added")&&(c.date_added=r.getValueOf("date_added")),r.hasValueForField("user_verified")&&(c.user_verified=r.getValueOf("user_verified")),r.hasValueForField("feature_level")&&(c.feature_level=r.getValueOf("feature_level"));const u=this._dlgElem.querySelector(".cbeb-modal-content");"some_fields_are_missing"!==this.handle_missing_fields(c,i,u)&&(this.HideButtons(),this.Spin(),this.TryToUpdateEntry({payload:{boxID:e,entryID:r.key,communityID:t.key,entryData:c},auth:{authID:l.authID,token:l.token}},{onSuccess:function(){n.DialogBoxMgr.hideAll(),o()},onFailure:function(e){a(e)}}))}}t.EditEntryDialogBox=c},8782:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EmailEditCtrl=void 0;const n=i(1372);class r extends n.field_edit_ctrl{data(){return void 0!==this._inputElem&&this._inputElem.value||""}has_data(){return this._entry.hasValueForField(this._field.key)}cleanedUpLink(e){return`${e}`}viewHtmlElem(){const e=this._field.isBusinessName(),t=[this.leftOfViewRow(),'
',this._field.detailLabel?`
${this._field.detailLabel}
`:"",`
`,this.getDetailGlyph(this._field.ctrlType),this.cleanedUpLink(this._entry.getValueOf(this._field.key)),"
","
",this.rightOfViewRow()].join(""),i=document.createElement("div");return i.innerHTML=t,i}inputHtmlElem(){const e=this._entry.getValueOf(this._field.key),t=this.leftOfInputRow()+'
'+this._field.label+(!0===this._field.required?" (required)":"")+(!0===this._field.readonly?'  ':"")+'
'+`
"+this.rightOfInputRow(),i=document.createElement("div");return i.innerHTML=t,this.install_input_handler_for(i,"input"),this._inputElem=i.querySelector("input"),i}constructor(e,t,i){super(e,t),this._entry=e,this._field=t,this._config=i}}t.EmailEditCtrl=r},4932:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ebPresentBoxContentUI=t.handle_profile_click=t.cbebOnShowMore=t.GetDocumentWideState=t.ebFilterManager=t.box_cache=void 0;const r=i(9628),o=i(1158),s=i(8945),a=i(9786),l=i(329),c=i(4650),u=i(2705),h=i(3189),d=i(7304),p=i(6578),f=i(9984),m=i(1921),_=i(73),g=i(2873),y=i(719),b=i(7341),v=i(3838),x=i(6122),w=i(5743),E=i(3950),T=i(7635),k=i(2997),C=i(6081),S=i(7716),M=i(4595),A=i(7522),I=i(8604),P=i(1370),L=i(180),D=i(6996),z=i(205),O=i(7964),B=i(940),R=i(9821),F=i(8399),U=i(4787),j=i(9725),V=i(5941),N=i(5848),$=i(7102),q=i(3523),G=i(9882),Z=i(1459);let W,H,X,K,J,Y,Q,ee,te,ie,ne,re,oe,se,ae,le,ce,ue,he,de,pe,fe,me,_e,ge="";var ye,be="";function ve(){return document.cbDocumentWideState}function xe(e){if(!0===(0,j.mobile_aspect)())le.forEachElem((function(e){e.style.flexBasis="auto"}));else{const t=_e.getProfileFlexBasis({forClientWidth:e});le.forEachElem((function(e){e.style.flexBasis=`${t}%`}))}}function we(e,i,n){t.box_cache.getMorePaginatedEntries(Math.max(i,t.box_cache.nb_filter_results),(t=>{let i;if(fe){let e="";e=t.buildCookieCutterHtml(fe),i=document.createElement("div"),i.setAttribute("class","box-entry-overview-container"),i.setAttribute("id","emb-"+t.key),i.innerHTML=e}else i=_e.buildOverviewHtml(t,n,pe);void 0!==i&&(h.Styling.applyButtonStyleTo({rootElem:i,withConfig:pe}),h.Styling.applyParagraphStyleTo({rootElem:i,withConfig:pe}),h.Styling.applyLocationStyleTo({rootElem:i,withConfig:pe}),e.appendChild(i))})),le.refresh("box-entry-overview-container");var r=document.getElementById("cbeb-main-div");if(r&&xe(r.clientWidth),!1===t.box_cache.moreEntriesToShow()){const e=document.querySelector("[showmore-row]");e&&(e.style.visibility="hidden")}}function Ee(e,t){if("popup"===t.config.overview_click_action()&&void 0!==e.bespokeDetailLink&&e.bespokeDetailLink.length>0)e.bespokeDetailLink.startsWith("http")?window.location.href=e.bespokeDetailLink:window.location.href=`https://${e.bespokeDetailLink}`;else{if(-1!==t.config.overview_click_action().indexOf("field-")){const i=t.config.overview_click_action().slice(6);if(e.hasValueForField(i)){const t=e.getValueOf(i);if(t&&t.length>0)return void(t.startsWith("http")?window.location.href=t:window.location.href=`https://${t}`)}}new F.profile_popup_dialog_box(t,ge,(e=>{Ce(e,t)})).showForEntry(e,t.template)}}function Te(e,i){const n=t.box_cache.getEntry(e);n&&Ee(n,i)}function ke(e,i){!0===t.box_cache.any_profile_fits_filter((i=>t.ebFilterManager.Filter(i,e.template)))?(t.box_cache.reflectFilterSettings((i=>t.ebFilterManager.Filter(i,e.template)),pe,e.template),je(e),e.map.UpdateMarkers(t.box_cache.mapFiltered((e=>e))),e.clearSearchBtn.Show(),i&&i.on_result&&i.on_result()):i&&i.on_no_result?(i.on_no_result(),t.box_cache.reflectFilterSettings((i=>t.ebFilterManager.Filter(i,e.template)),pe,e.template),je(e)):W.Show({title:e.config.get_wording("search-fail-title"),msg:e.config.get_wording("search-fail-body"),btn_label:e.config.get_wording("search-fail-ack"),onClose:()=>{}})}function Ce(e,i){t.ebFilterManager.updateCategoryFilter(e),ke(i)}function Se(e,i){t.box_cache.setPaginationLimit("none"),t.box_cache.resetPagination(),t.box_cache.reSortEntriesBy(pe.ordering,i.template),t.ebFilterManager.clearAllFilters(),je(i),e()}t.GetDocumentWideState=ve,ye=!1,window.addEventListener("resize",(function(){ye||(ye=!0,window.requestAnimationFrame((function(){window.dispatchEvent(new CustomEvent("optimizedResize")),ye=!1})))})),t.cbebOnShowMore=we,t.handle_profile_click=Ee;let Me,Ae=!1;function Ie(e){if("alwaysVisible"===e.config.mapConfiguration&&!1===e.config.hideMap||"onToggle"===e.config.mapConfiguration&&!0===Ae){const i=t.box_cache.map((e=>e));e.map.ReloadWith(i)}}function Pe(e){if(e.length<15)return e;{const t=String.fromCharCode(8230);return`${(0,G.take)(Array.from(e),15).join("")}${t}`}}function Le(e,i){switch(i){case"basic":return function(e,i){const n=$.input("cbeb-search-inputfield-basic",(()=>{}),"",{initialValue:`${t.ebFilterManager.GetFreeSearchTerm()}`,classes:["cbeb-search-inputfield"],placeholder:"search..."});n.addEventListener("keydown",(e=>{if("Enter"===e.key){var r=n.value;t.ebFilterManager.updateFreeSearchTerm(r.split(" ")),ke(i)}}));const r=!1===e.for_desktop?$.button("","",(()=>{const e=n.value;t.ebFilterManager.updateFreeSearchTerm(e.split(" ")),ke(i)}),{design:"background-color:transparent; outline: none; border: none; flex-grow: 1; cursor: pointer;"}):void 0;return r&&r.appendChild($.i({class:"fas fa-search"})),$.div("",[n,r],{classes:["cbeb-search-container"]})}({for_desktop:!1===(0,j.mobile_aspect)()},e);case"advanced":return function(e){const i=$.button("","",(()=>{H.Show()}),{classes:["cbeb-toolbar-button","cbeb-custom-clr-button"],design:`color: #${e.config.fgColourOf("button")}; background-color: #${e.config.bgColourOf("button")}; column-gap: 7px; font-family: "${e.config.fontFamily}"; }`});i.appendChild($.i({class:"fas fa-search"})),!0!==(0,j.mobile_aspect)()&&i.appendChild($.span(pe.toolbarBtnLabel("search")));const n=!1===pe.hideToolbarBtn("tag",De())?$.button("","",(()=>{I.Show(e.template,pe,t.box_cache,(i=>{t.ebFilterManager.updateCategoryFilter(i),ke(e)}))}),{classes:["cbeb-toolbar-button","cbeb-custom-clr-button"],design:`color: #${e.config.fgColourOf("button")}; background-color: #${e.config.bgColourOf("button")}; column-gap: 7px; font-family: "${e.config.fontFamily}";}`}):void 0;n&&(n.appendChild($.i({class:"fas fa-tags"})),!0!==(0,j.mobile_aspect)()&&n.appendChild($.span(e.config.toolbarBtnLabel("tag"))));const r=!1===pe.hideToolbarBtn("ordering",De())?function(e){return $.div("select-container",[$.select("entry-ordering",(i=e.template,[...i.fieldsOfType("category-input"),...i.fieldsOfType("single-line-text-input")].map((e=>i.getField(e))).filter((e=>e&&e.label&&e.label.length>0)).filter((e=>!0===e.searchable)).sort(((e,t)=>e.label.localeCompare(t.label))).map((e=>({value:e.key,label:Pe(e.label)})))),{dropdown_design:`font-family: "${e.config.fontFamily}";`,on_selection_change:i=>{window.setTimeout((()=>{!function(e,i){const n="most-recent"===e?{type:"most-recent"}:{type:"by-field",field:e};pe.ordering.directory_ordering=n,t.box_cache.reSortEntriesBy(pe.ordering,i.template),t.box_cache.reflectFilterSettings((e=>t.ebFilterManager.Filter(e,i.template)),i.config,i.template),je(i)}(i,e)}))}})],{classes:["cbeb-custom-clr-button"],design:`color: #${e.config.fgColourOf("button")}; background-color: #${e.config.bgColourOf("button")};`});var i}(e):void 0;return $.div("flexrow",[i,n,!0===(0,j.mobile_aspect)()?void 0:r],{design:"column-gap: 14px"})}(e)}}function De(){return null!=ve().cbeb_md}function ze(e,i){return new Promise(((n,r)=>{(0,f.PostRequest)({url:"https://api.communitybox.co/getboxcontents",payload:{boxID:e},callback:{onResult:r=>{r&&r.hasOwnProperty("details")&&(r.details.entries=r.details.entries.map((e=>("string"==typeof e.value&&(e.value=JSON.parse(e.value)),e))),o.BoxCache.ebUnpackFormat3IfNecessary(r.details),t.box_cache=new o.BoxCache(e,r.details,me,t.ebFilterManager,pe),t.box_cache.reSortEntriesBy({directory_ordering:{type:"most-recent"}},i),n())},onFailure:e=>{console.error(e)}}})}))}function Oe(e,t){const i=document.getElementById("cbeb-content-container");i.innerHTML='
',Ve(),ze(e,t).then((()=>{!function(e){$.remove_all_child_elements_from(e.targetDiv);var t='
';t=(t+=['
','
','','','',"
","
"].join(""))+"
",e.targetDiv.innerHTML=t,h.Styling.applyAllStylesTo({rootElem:e.targetDiv,withConfig:pe})}({userID:p.AuthCache.getMemberKey(),targetDiv:i})}))}function Be(e){return n(this,void 0,void 0,(function*(){document.getElementById("cbeb-content-container").innerHTML='
',function(){const e=document.querySelector("#cbeb-map");e&&(e.style.display="none")}(),Ve(),yield ze(e.directory,e.template);const t=p.AuthCache.getMemberKey();void 0!==t&&$e({member_key:t},e)}))}function Re(e,i){return n(this,void 0,void 0,(function*(){const n=t.box_cache.map((e=>e)).filter((t=>t.addedByKey===e));switch(n.length){case 0:Je(i);break;case 1:He(n[0],i);break;default:Be(i)}}))}function Fe(){return pe.isExampleBox}function Ue(){const e=window.location.href.split("?");return e.length>1?"?"+e[1].split("#")[0]:""}function je(e){qe(e)}function Ve(){const e=document.querySelector("[showmore-row]");null!==e&&null!==e.parentNode&&e.parentNode.removeChild(e)}function Ne(e,t){return $.div("",[$.button("","Edit",(()=>{He(e,t)}),{classes:["cbeb-toolbar-button","cbeb-custom-clr-button"]}),$.button("","Delete",(()=>{!function(e,t){re.ShowForEntry({onDelete:()=>{Be(t)}},e,t.template,t.directory,ce.key)}(e,t)}),{classes:["cbeb-toolbar-button","cbeb-custom-clr-button"]})],{classes:["cbeb-act-button-group"]})}function $e(e,i){$.remove_all_child_elements_from(i.contentContainer);const n=[];t.box_cache.for_ever_profile_owned_by_member(e.member_key,(e=>{const t=e.getDisplayNameForTemplate(i.template);var r,o;n.push({escapedName:(r=t,o=r,o=(o=o.replace(/"/gi,""")).replace(/'/gi,"’")),wrapper:e})}));const r=n.sort(((e,t)=>e.escapedName>t.escapedName?1:-1)),o=r.map((e=>function(e,t){return $.div("",[(i=e.escapedName,$.div("",[],{classes:["cbeb-act-name"],design:`color: #${pe.fgColourOf("paragraph")}`,text:i})),Ne(e.wrapper,t)],{classes:["cbeb-act-row"]});var i}(e,i)));i.contentContainer.appendChild($.div("",[$.p("","Here you can edit your profiles. You can return to the directory at any time."),$.div("flex row",[$.button("cbeb-button","Return to directory",(()=>{Xe(i)}),{design:`background-color: #${i.config.bgColourOf("button")}`})]),...o],{classes:["cbeb-act-container"],design:`color: #${pe.fgColourOf("paragraph")}`})),h.Styling.applyAllStylesTo({rootElem:i.contentContainer,withConfig:pe})}function qe(e){var i;$.remove_all_child_elements_from(e.contentContainer);let n="";const r=null===(i=Ye())||void 0===i?void 0:i.content_container;n+=void 0!==r?`
`:"
",n+="
",t.box_cache.moreEntriesToShow()&&pe.showmoreEntryCount>0&&(n+=["
","","
"].join("")),!ce.IsOnFreePlan()&&!0!==pe.delinquent()||25!==pe.cutoff_limit||(n+=['
','
🔌 by Community Box
',"
"].join("")),e.contentContainer.innerHTML=n,t.box_cache.resetPagination();const o=_e.build_top_row();var s;if(o&&Math.max(pe.initialEntryCount,t.box_cache.nb_filter_results)>0&&e.contentContainer.querySelector("#cbeb-content-container").appendChild(o),we(e.contentContainer.querySelector("#cbeb-content-container"),pe.initialEntryCount,e.template),h.Styling.applyButtonStyleTo({rootElem:e.contentContainer,withConfig:pe}),h.Styling.applyParagraphStyleTo({rootElem:e.contentContainer,withConfig:pe}),h.Styling.applyLocationStyleTo({rootElem:e.contentContainer,withConfig:pe}),0===e.contentContainer.clientWidth?window.setTimeout((()=>{xe(e.contentContainer.clientWidth)}),500):xe(e.contentContainer.clientWidth),(s=document.getElementById("privacy-policy"))&&s.addEventListener("click",(function(){te.show()})),pe.fgColourOf("paragraph")){var a=document.querySelectorAll("[cbeb-search-inputfield-basic]");for(let e=0;en(this,void 0,void 0,(function*(){yield ze(i.directory,i.template),je(i)})),failureCallback:()=>{}})}function Xe(e){return n(this,void 0,void 0,(function*(){yield ze(e.directory,e.template),je(e),Ie(e)}))}function Ke(e){if(Fe())return void he.Show();const t=ve().cbeb_md;if(t&&!1===pe.ignoreMemberspace)console.log("ping 1"),de.show({onLogin:t=>{Re(t,e)},identifier:t.u,community:ce,directory:e.directory,federated_auth:t.m});else{console.log("ping 2");const t=p.AuthCache.getMemberKey();if(t)Re(t,e);else{const t=p.AuthCache.getMemberKey();se.show({onLogin:i=>{t&&Re(t,e)},onFailure:e=>{console.error(e)}},ce,"manual",W)}}}function Je(e){if(Fe())he.Show();else{const t=ve().cbeb_md;t&&!1===pe.ignoreMemberspace?p.AuthCache.hasValidAuth({no:()=>{t&&de.show({onLogin:()=>{Ze(e)},identifier:t.u,community:ce,directory:e.directory,federated_auth:t.m})},yes:()=>{Ze(e)}}):p.AuthCache.hasValidAuth({no:()=>{ae.Show({showTandC:()=>{oe.Show((()=>{ae.NowTryToSignup(e.directory,ce)}),pe,ce)},allSignedUp:()=>{Ze(e)}},ce)},yes:()=>{Ze(e)}})}}function Ye(){return!0===(0,j.mobile_aspect)()?pe.get_layout({for_component:"mobile"}):pe.get_layout({for_component:"overview"})}function Qe(e){let i=0;return t.box_cache.for_ever_profile_owned_by_member(e,(()=>{i++})),i}function et(e,t,i){const n=e.split("?")[0];if("#cbeb-edit-profile"===n&&(window.location.hash="#",Ke(i)),"#cbeb-edit-m-profile"===n){if(e.split("?").length>1)return void console.log("bailing out of edit-m-profile flow because of query parameter");if(console.log("in edit-m-profile flow"),window.location.hash="#",De()){const e=ve().cbeb_md;e&&de.show({onLogin:e=>{0===Qe(e)?Je(i):Ke(i),P.DialogBoxMgr.hideAll()},identifier:e.u,community:ce,directory:i.directory,federated_auth:e.m})}else{const e=document.querySelector('a[href="https://members.freelancingfemales.com/member/sign_in"]');e&&e.click()}}if("#cbeb-add-or-edit-profile"===n){window.location.hash="#";const e=ve().cbeb_md;e&&(0,f.PostRequest)({stage:"cfapi",url:"/get/member/from/email",payload:{email:e.u,directory:i.directory},callback:{onResult:e=>{Qe(e.member_key)>0?Ke(i):Je(i)},onFailure:()=>{Je(i)}}})}"#cbeb-add-profile"===n&&(window.location.hash="#",Je(i)),"#cbeb-launch-search"===n&&(window.location.hash="#",it(i)),"#cbeb-clear-search"===n&&(window.location.hash="#",Se(t,i))}function tt(e){for(const t of e.template.fieldsOfType("category-input")){const i=document.body.querySelector(`[cbeb-detached-category-search="${t}"]`);i&&e.template.forEachTagInCategory(t,(e=>{const t=document.createElement("option");t.value=e,t.text=e,i.appendChild(t)}))}const t=document.body.querySelector("button[cbeb-launch-filter]");t&&t.addEventListener("click",(function(){it(e)}))}function it(e){const i=e.template.fieldsOfType("category-input").map((e=>`[cbeb-detached-category-search="${e}"]`)).map((e=>{const t=document.body.querySelector(e);return null===t?null:t.value})).filter((e=>null!==e)).filter((e=>"default"!==e)),n=document.body.querySelector("[cbeb-detached-free-text-search]");n&&t.ebFilterManager.updateFreeSearchTerm([...n.value.split(" ")]),t.ebFilterManager.updateCategoryListFilter(i),ke(e)}function nt(e,i,r,h){Ue().toLowerCase().startsWith("?tags=")&&(me=Ue().split("=")[1].split(",").map((e=>decodeURIComponent(e))).map((e=>e.startsWith("tagref-")?atob(e.slice(7)):e)));const f=$.div((!0===(0,j.mobile_aspect)()?"mobile":"desktop")+" toolbar",[]),b=$.div("flexcol",[]),w=$.div("flexcol",[]);$.remove_all_child_elements_from(r),r.appendChild(f),r.appendChild(b),r.appendChild(w),o.BoxCache.ebUnpackFormat3IfNecessary(e);const T=new a.TemplateWrapper(e.templateEntries),I=new l.BoxConfigWrapper(e,(F=i.attributes,Array.prototype.slice.call(F).reduce(((e,t)=>(e[t.name]=t.value,e)),{})),i);var F;t.ebFilterManager=new s.FilterManager(I),I.preFilterTagsForThisPage(window.location.href).length>0&&(me=I.preFilterTagsForThisPage(window.location.href)),t.box_cache=new o.BoxCache(h,e,me,t.ebFilterManager,I),e.hasOwnProperty("layout")&&I.override_layout(e.layout),e.hasOwnProperty("filter_bar")&&I.override_filter_bar(e.filter_bar),e.hasOwnProperty("map_and_loc_config")&&I.override_map_and_loc_config(e.map_and_loc_config);const V=i.hasAttribute("buttons")?i.getAttribute("buttons").split(",").map((e=>e.toLowerCase())):void 0;V&&I.overrideButtonConfig(V),pe=I;const G={contentContainer:w,mapContainer:b,toolbarContainer:f,directory:h,config:I,template:T,documentState:ve(),map:new Z.PlaceholderMap,clearSearchBtn:new We};var le,ye,be;G.map=function(e){if("string"==typeof g_allow_google_map&&"true"===g_allow_google_map)return new Z.GoogleMap(e);const t=ve().mbk;return t?new Z.MapboxMap(e,t):new Z.PlaceholderMap}(G),_e=function(e,t){const i=Ye();if(i)return new U.layout_builder(pe,i,t.template,ge,(e=>{Ce(e,t)}),(e=>{Te(e,t)}));switch(e){default:case"default":return new B.DefaultOverviewBuilder;case"horizontal":return new R.ListOverviewBuilder}}(I.overviewDesign,G),t.box_cache.reSortEntriesBy(I.ordering,T),ge=e.communityID,(le=document.createElement("style"))&&(le.innerHTML=[".cbeb-modal-content::-webkit-scrollbar-track","{","background-color: #fcfcfc;","}",".cbeb-modal-content::-webkit-scrollbar","{","background-color: #fcfcfc;","}",".cbeb-modal-content::-webkit-scrollbar-thumb","{","\tbackground-color: #"+pe.bgColourOf("dialog_title")+";","\tborder: 0;","}"].join(" "),document.body.appendChild(le)),!1===i.hasAttribute("font_type")&&(void 0!==(ye={to:i,withConfig:I}).withConfig.fontFamily?ye.to.style.fontFamily=ye.withConfig.fontFamily:ye.to.style.fontFamily="quicksand",void 0!==ye.withConfig.fontWeight&&(ye.to.style.fontWeight=ye.withConfig.fontWeight)),e.hasOwnProperty("cookiecutter")&&(fe=new c.CookieCutterTemplate(e.cookiecutter)),re=new v.DeleteDialogBox(I),ce=new u.CommunityCache(ge,e.community),(be=(0,N.extract_query_param_from)(Ue())).hasOwnProperty("authID")&&be.hasOwnProperty("validationToken")&&ne.show(I),function(){var e=(0,N.extract_query_param_from)(Ue());return e.hasOwnProperty("authID")&&e.hasOwnProperty("pwResetValidationToken")}()&&ee.show(I),function(){document.querySelector("[signup][dialogbox] [welcome-msg]").innerHTML=ce.GetSignupMsg().replace(/\n/,"
");const e=ce.GetGDPROptinMsg();e.length>0?document.getElementById("cbeb-gdpr-optin-label").innerHTML=e:document.querySelector("[gdpr-optin-container]").style.visibility="hidden"}(),ae=new y.SignupDialogBox(I,ce);const Pe=ve().cbeb_md;se=new m.LoginDialogBox(I,ce,h,null==Pe?void 0:Pe.m),Q=new k.send_pw_reset_link_dlg(h,I),J=new d.ConnectionDialogBox,Y=new C.ShareEntryDialogBox(I),K=new S.InvitationLookupDlgBox(ce,G,Ge,Ze),H=new M.FilterAndSearchDlg(G,t.ebFilterManager,ke,t.box_cache),X=new A.ConnectionLookupDialogBox(I),W=new D.MsgDialogBox(document.body,I),z.Init(I,i),O.Init(I,i),ue=new _.AddEntryDialogBox(G,ce.key,{onAdded:e=>{!function(e){n(this,void 0,void 0,(function*(){pe.postAddEntry?W.Show({title:pe.postAddEntry.title,msg:pe.postAddEntry.text,btn_label:"Okay",onClose:()=>{var t;void 0!==(null===(t=pe.postAddEntry)||void 0===t?void 0:t.redirect)?window.location.href=pe.postAddEntry.redirect:ze(e.directory,e.template).then((()=>{je(e)}))}}):(yield ze(e.directory,e.template),je(e))}))}(G)},onFailure:e=>{console.error(e)}}),ie=new x.EditEntryDialogBox(G),te=new E.PrivacyPolicyDlgBox(I),he=new g.ExampleBox(I),de=new L.MemberSpaceAutoLoginDlg(I);const Be=I.extractDomainFrom(window.location.href);void 0===Be||!0===I.domainAllowed(Be)?(function(e){if($.remove_all_child_elements_from(e.toolbarContainer),"none"!==e.config.searchType){e.toolbarContainer.appendChild(Le(e,e.config.searchType));const i=$.button("","",(()=>{t.ebFilterManager.clearAllFilters(),t.box_cache.reflectFilterSettings((i=>t.ebFilterManager.Filter(i,e.template)),pe,e.template),je(e),e.map.UpdateMarkers(t.box_cache.mapFiltered((e=>e))),e.clearSearchBtn.Hide()}),{classes:["cbeb-toolbar-button","cbeb-custom-clr-button"],design:`margin-left: 17px; visibility: hidden; color: #${e.config.fgColourOf("button")}; background-color: #${e.config.bgColourOf("button")}; column-gap: 7px; font-family: "${e.config.fontFamily}"; }`});i.appendChild($.i({class:"fas fa-sliders-h"})),!1===(0,j.mobile_aspect)()&&i.appendChild($.span("Clear filter")),e.clearSearchBtn.UpdateElement(i),e.toolbarContainer.appendChild(i)}e.toolbarContainer.appendChild($.div("flexrow grow",[])),e.toolbarContainer.appendChild(function(e){const t=`color: #${e.config.fgColourOf("button")};\nbackground-color: #${e.config.bgColourOf("button")};\ncolumn-gap: 7px;\nfont-family: ${e.config.fontFamily};`,i=$.div("flexrow",[],{design:"column-gap: 14px;"});if(!1===e.config.hideMap&&"onToggle"===pe.mapConfiguration){const n=$.i({class:"fas fa-map-marker-alt cbeb-toolbar-btnlabel"}),r=$.button("toggle-map-btn","",(()=>{!function(e,t){if(!1===Ae){$.remove_all_child_elements_from(t.contentContainer);const i=$.div("cbeb-map",[],{key:"cbeb-map"});t.mapContainer.appendChild(i),Ae=!Ae,Ie(t),e.classList.remove("fa-map-marker-alt"),e.classList.add("fa-user-circle")}else Ae=!Ae,$.remove_all_child_elements_from(t.mapContainer),je(t),e.classList.remove("fa-user-circle"),e.classList.add("fa-map-marker-alt")}(n,e)}),{classes:["cbeb-toolbar-button","cbeb-custom-clr-button"],design:t});r.appendChild(n),!0!==(0,j.mobile_aspect)()&&r.appendChild($.span(pe.toolbarBtnLabel("map_toggle"))),i.appendChild(r)}if(!1===pe.hideToolbarBtn("add_entry",De())){const n=$.button("add-entry-btn","",(()=>{Je(e)}),{classes:["cbeb-toolbar-button","cbeb-custom-clr-button"],design:t});n.appendChild($.i({class:"fas fa-plus cbeb-toolbar-btnlabel-plus"})),!0!==(0,j.mobile_aspect)()&&n.appendChild($.span(pe.toolbarBtnLabel("add_entry"))),i.appendChild(n)}if(!1===pe.hideToolbarBtn("edit_entry",De())){const n=$.button("edit-entry-btn","",(()=>{Ke(e)}),{classes:["cbeb-toolbar-button","cbeb-custom-clr-button"],design:t});n.appendChild($.i({class:"fas fa-pencil-alt cbeb-toolbar-btnlabel"})),!0!==(0,j.mobile_aspect)()&&n.appendChild($.span(pe.toolbarBtnLabel("edit_entry"))),i.appendChild(n)}if(!1===pe.hideToolbarBtn("account",De())){const n=$.button("","",(()=>{const t=document.getElementById("cbeb-content-container");p.AuthCache.hasValidAuth({no:()=>{var t;se.show({onLogin:()=>{Oe(e.directory,e.template)},onFailure:e=>{console.error(e)}},ce,(null===(t=ve().cbeb_md)||void 0===t?void 0:t.m)||"manual",W)},yes:()=>{t.innerHTML='
',Oe(e.directory,e.template)}})}),{classes:["cbeb-toolbar-button","cbeb-custom-clr-button"],design:t});n.appendChild($.i({class:"fas fa-cog cbeb-toolbar-btnlabel"})),!0!==(0,j.mobile_aspect)()&&n.appendChild($.span(pe.toolbarBtnLabel("account"))),i.appendChild(n)}return i}(e))}(G),qe(G)):function(e,t){const i=-1!==window.location.href.indexOf("localhost")?"localhost:4000":"account.communitybox.co";$.remove_all_child_elements_from(e),e.appendChild($.div("maperrorcontainer",[$.h(3,"Unregistered Domain")])),e.appendChild($.div("maperrorcontainer",[$.p("",`The current domain ${t} has not been registered.`),$.anchor("","Click here to register it now",`https://${i}/domains`,{open_in_new_tab:"yes",design:"text-decoration: none; color: white; background-color: #0078d4; box-sizing: border-box; padding: 10px 21px 10px 21px;"})]))}(r,Be);const Re=ot(G,t.box_cache,T,(0,j.mobile_aspect)()?"mobile":"desktop");if(function(e,t,i){e.addEventListener("click",(function(e){e.target.matches("[clear-search-filter], [clear-search-filter] > *")&&Se(t,i)}))}(r,Re.clear_filters,G),tt(G),function(e){const t=document.body.querySelector("button[cbeb-detached-add-entry-btn]");t&&t.addEventListener("click",(()=>{p.AuthCache.hasValidAuth({no:()=>{const t=ve().cbeb_md;se.show({onLogin:()=>{Ze(e)},onFailure:e=>{console.error(e)}},ce,(null==t?void 0:t.m)||"manual",W)},yes:()=>{Ze(e)}})}))}(G),function(e,t){window.addEventListener("hashchange",(function(){"true"===(0,q.read_cookie)("post_m_signup")?((0,q.write_cookie)("post_m_signup","false"),et("#cbeb-edit-m-profile",e,t)):et(window.location.hash,e,t)}))}(Re.clear_filters,G),function(){const e=document.body.querySelector("[cbeb-detached-search-button]");e&&e.addEventListener("click",(function(){H.Show()}))}(),function(){var e=(0,N.extract_query_param_from)(Ue());return e.hasOwnProperty("memberKey")&&e.hasOwnProperty("invitationToken")}()){let e=(0,N.extract_query_param_from)(Ue());K.Show({memberKey:e.memberKey,invitationToken:e.invitationToken},I)}if(function(){var e=(0,N.extract_query_param_from)(Ue());return e.hasOwnProperty("memberKey")&&e.hasOwnProperty("connectionToken")}()){let e=(0,N.extract_query_param_from)(Ue());X.Show({destinationKey:e.memberKey,connectionToken:e.connectionToken})}if((0,N.extract_query_param_from)(Ue()).hasOwnProperty("entryKey")&&Te((0,N.extract_query_param_from)(Ue()).entryKey,G),"?signup"===Ue().toLowerCase()&&Je(G),-1!==window.location.href.indexOf("#confirm-account")&&window.setTimeout((()=>{Q.show({title:I.get_wording("claim-profile-dlg-title"),greeting:I.get_wording("claim-profile-dlg-greeting"),congratulations:I.get_wording("claim-profile-dlg-congrat"),okay_btn_label:I.get_wording("claim-profile-ok-btn-label"),config:I,context:"confirm-account"})})),"true"===(0,q.read_cookie)("post_m_signup")?((0,q.write_cookie)("post_m_signup","false"),et("#cbeb-edit-m-profile",Re.clear_filters,G)):window.location.hash.length>1&&et(window.location.hash,Re.clear_filters,G),!0===function(){const e=(0,N.extract_query_param_from)(Ue());return"text"in e||"region"in e||"location"in e||"lat"in e&&"lng"in e||(t=e,Object.keys(t).filter((e=>e.startsWith("category-filter-"))).length>0);var t}()){const e=(0,N.extract_query_param_from)(Ue());if("text"in e&&t.ebFilterManager.updateFreeSearchTerm(e.text.split(" ")),"region"in e&&t.ebFilterManager.update_region(e.region),"location"in e){const[i,n]=e.location.split(",");t.ebFilterManager.updateProximityFilter({lat:Number(i),lng:Number(n)},pe.default_proximity_distance)}"lng"in e&&"lat"in e&&t.ebFilterManager.updateProximityFilter({lat:e.lat,lng:e.lng},"radius"in e?e.radius:pe.default_proximity_distance);const i=[];for(const t in e)if(t.startsWith("category-filter-")){const n=decodeURIComponent(e[t]);i.push(n)}t.ebFilterManager.updateCategoryListFilter(i),ke(G)}!function(e){const t=document.body.querySelectorAll("button[toggle-password-visibility]");for(let e=0;e
'):(e.setAttribute("type","password"),this.innerHTML='')}}))}(),function(e,i){e.addEventListener("click",(function(e){const n=e.target;if(n.matches("[show-overview-on-click], [show-overview-on-click] > *")){const e=t.box_cache.getEntry(n.getAttribute("entryKey"));e&&Ee(e,i)}}))}(w,G),document.addEventListener("click",(function(e){e.target.matches("[close-dialog-btn], [close-dialog-btn] > *")&&P.DialogBoxMgr.close()})),function(e,t){e.addEventListener("click",(function(e){e.target.matches("[present-content-btn], [present-content-btn] > *")&&Xe(t)}))}(w,G),function(e,t){e.addEventListener("click",(function(e){e.target.matches("[logout], [logout] > *")&&function(e){p.AuthCache.clearCredentials(),je(e)}(t)}))}(w,G),function(e,t){e.addEventListener("click",(function(e){e.target.matches("[show-forgot-pw-dlg], [show-forgot-pw-dlg] > *")&&Q.show({config:t,title:t.get_wording("recover_pw_title"),greeting:t.get_wording("recover_pw_greeting"),congratulations:t.get_wording("pw_recovery_email_sent"),okay_btn_label:t.get_wording("send_recovery_link_btn"),context:"forgot-password"})}))}(document.body,I),document.addEventListener("click",(function(e){e.target.matches("[close-dialog-and-redirect-btn], [close-dialog-and-redirect-btn] > *")&&(P.DialogBoxMgr.close(),window.location.href=function(e){const t=e.indexOf("?");return e.substring(0,-1===t?e.length:t)}(window.location.href))})),function(e,t){e.addEventListener("click",(function(e){var i;e.target.matches("[show-login-dlg], [show-login-dlg] > *")&&(P.DialogBoxMgr.hideAll(),se.show({onLogin:e=>{$e({member_key:e.member},t),P.DialogBoxMgr.hideAll()},onFailure:e=>{}},ce,(null===(i=ve().cbeb_md)||void 0===i?void 0:i.m)||"manual",W))}))}(document.body,G),function(e){document.addEventListener("click",(function(t){t.target.matches("button[signup-dlg], button[signup-dlg] > *")&&(P.DialogBoxMgr.hideAll(),ae.Show({showTandC:()=>{oe.Show((()=>{ae.NowTryToSignup(e.directory,ce)}),pe,ce)},allSignedUp:()=>{Ze(e)}},ce))}))}(G),function(e,t){e.addEventListener("click",(function(i){i.target.matches("[showmore]")&&we(e.querySelector("#cbeb-content-container"),pe.showmoreEntryCount,t)}))}(w,T),function(e){document.addEventListener("click",(function(i){if(i.target.matches("[display-share-entry-dlg], [display-share-entry-dlg] > *")){const n=i.target.getAttribute("entryKey"),r=t.box_cache.getEntry(n);r&&Y.ShowFor(r,pe,e)}}))}(T),function(e,i,n){e.addEventListener("click",(function(e){if(e.target.matches("[connect], [connect] > *")){const r=e.target.getAttribute("entryKey"),o=t.box_cache.getEntry(r);o&&J.showForEntry(o,n,pe,i)}}))}(w,h,T),function(e,i){e.addEventListener("click",(function(e){if(e.target.matches("[tag-button], [tag-button] > *")){const n=e.target.getAttribute("tag");t.ebFilterManager.updateCategoryFilter(n),ke(i)}}))}(w,G),function(e,i){let n=(0,j.mobile_aspect)();window.addEventListener("optimizedResize",(function(){e&&xe(e.clientWidth),n!==(0,j.mobile_aspect)()&&(n=(0,j.mobile_aspect)(),je(i),ot(i,t.box_cache,i.template,(0,j.mobile_aspect)()?"mobile":"desktop")),void 0!==Me&&Me.resize()}))}(r,G),Ie(G)}function rt(e){return(i,n)=>{if(n&&n.destination.length>0&&!1===n.destination.startsWith("#"))return void(window.location.href=`${n.destination}/?${i}`);const r=i.split("&");t.ebFilterManager.clearAllFilters();for(const i of r){const[n,r]=decodeURIComponent(i).split("=");switch(n){case"region":t.ebFilterManager.update_region(r);break;case"text":t.ebFilterManager.updateFreeSearchTerm([r]);break;case"location":{const i=r.split(",");t.ebFilterManager.updateProximityFilter({lat:Number(i[0]),lng:Number(i[1])},e.config.default_proximity_distance)}break;default:void 0!==r&&t.ebFilterManager.add_to_category_filter(r)}}if(ke(e,n),n&&!0===n.destination.startsWith("#")){const e=document.querySelector(`[name="${n.destination.replace("#","")}"]`);e&&e.scrollIntoView({block:"start",behavior:"smooth"})}}}function ot(e,t,i,n){return(0,V.initialise_filter_bar)({config:e.config,directory:t,template:i,aspect:n,launch_search:rt(e),documentState:ve()})}function st(e){return new Promise((t=>{window.setTimeout((()=>{t()}),e)}))}function at(e,t,i){if(!0===ve().expectCache)!function(e,t,i){n(this,void 0,void 0,(function*(){yield function(){return n(this,void 0,void 0,(function*(){for(;null==ve().db;)yield st(100)}))}();const r=ve().db;if(null==r)return void console.log("Cannot proceed with OldSchoolInit as document-wide database not yet available");const o=yield(s=r.details.communityID,new Promise(((e,t)=>{const i={communityID:s},n=new XMLHttpRequest;n.open("POST","https://api.communitybox.co/get/community/parameters",!0),n.setRequestHeader("Content-type","application/json; charset=utf-8"),n.onload=function(){if(4===n.readyState&&200===n.status){var i=JSON.parse(n.responseText);i&&i.hasOwnProperty("parameters")?e(i.parameters):t(n.responseText)}else t(n.responseText)},n.send(JSON.stringify(i))})));var s;r.details.community=o,nt(r.details,e,t,i)}))}(e,t,i);else{const n=ve().db;n?nt(n.details,e,t,i):window.setTimeout((()=>at(e,t,i)),500)}}function lt(e){const t=e||document.getElementById("communitybox-target");if(t){if(!t||!1!==t.hasAttribute("initialised"))return;ut&&ut.disconnect(),t.removeAttribute("uninitialised"),t.setAttribute("initialised","");{const e=document.querySelector("[cbeb-filter-bar]")||document.querySelector("[communitybox-search-bar]");e&&e.setAttribute("initialised","")}(function(e){const t=document.getElementById("communitybox-target");t.innerHTML=e,["[tag-filter][dialogbox]","[filter-and-search]","[m-auto-login-dlg]","#cbeb-rpw-modal","#cbeb-connection-modal","#cbeb-view-entry-modal","#cbeb-add-entry-modal","#cbeb-edit-entry-modal","#cbeb-delete-entry-modal","#cbeb-login-modal","#cbeb-signup-modal","#cbeb-tc-modal"].forEach((e=>{const i=t.querySelector(e);document.body.appendChild(i)})),"undefined"!=typeof twttr&&twttr&&twttr.widgets&&twttr.widgets.load()})(be),function(){const e=document.getElementById("cbeb-main-div");e.innerHTML='
';const t=document.getElementById("communitybox-target"),i=t.getAttribute("box");me=t.hasAttribute("tags")?t.getAttribute("tags").split(",").map((e=>e.toLowerCase())):[],le=new r.OverviewElemCache,ne=new w.ConfirmEmailDialogBox,ee=new T.ResetPwDialogBox,oe=new b.TandCDialogBox,p.AuthCache.hasValidAuth({yes:()=>{},no:function(){p.AuthCache.clearCredentials()}}),at(t,e,i)}()}const i=document.querySelector("[cbeb-filter-bar]")||document.querySelector("[communitybox-search-bar]");i&&!1===i.hasAttribute("initialised")&&(i.setAttribute("initialised",""),ct(i))}function ct(e){const i=ve().db;i?function(e,i){const n=e.getAttribute("directory");o.BoxCache.ebUnpackFormat3IfNecessary(i);const r=new a.TemplateWrapper(i.templateEntries),s=new l.BoxConfigWrapper(i,{},e),c={template:r,config:s,directory:n,toolbarContainer:document.querySelector("div[toolbar]"),contentContainer:document.querySelector("div[main-div]"),mapContainer:$.div("",[]),documentState:ve(),map:new Z.PlaceholderMap,clearSearchBtn:new We};e.hasAttribute("communitybox-search-bar")?tt(c):(i.hasOwnProperty("filter_bar")&&s.override_filter_bar(i.filter_bar),ot(c,new o.BoxCache(n,i,[],t.ebFilterManager,s),r,(0,j.mobile_aspect)()?"mobile":"desktop"))}(e,i.details):window.setTimeout((()=>ct(e)),500)}be=["",'
',"","\t\t\t\t\t\t\x3c!-- Signup dialog box --\x3e",'
','
','
','
Sign Up
','
Sign up
','
Cancel
',"
",'
','\t\t\t\t\t\t\t\t\t
',"
",'
',"\t\t\t\t\t\t\t\t\t\tAlready have an account?",'\t\t\t\t\t\t\t\t\t\tYou can log in here.',"\t
","",'\t\t\t\t\t\t\t\t
','\t\t\t\t\t
','\t\t\t\t\t\t \t\t \t
email address
','\t
','\t\t ',"\t\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t
","",'\t\t\t\t\t\t\t\t
','\t\t\t\t
','\t\t\t\t\t \t\t \t
password
',"
",'\t ','',"\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t
","",'\t\t\t\t\t\t\t\t
','\t\t\t\t\t
','\t
','\t\t\t\t\t\t\t\t\t\t \t ','\t\t\t\t\t\t\t\t\t\t\t
','\t\t\t ',"\t\t\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t
","",'\t\t\t\t\t
','\t\t\t\t\t\t
Sign Up
','\t\t\t\t\t\t
Cancel
',"\t\t\t\t\t
","\t\t\t\t\t\t
","",'\t\t\t\t\t\t
',"",'\t\t\t\t\t\t
','\t\t\t\t\t\t \t
',"\t\t\t\t\t\t\t
",'\t\t\t\t\t
','\t\t\t\t\t
Try Again
','\t\t\t\t\t
Cancel
',"\t\t\t\t\t\t\t
","\t\t\t\t\t\t
","\t\t\t\t\t
","\t\t\t\t
","","\t\t\t\t\t\t\x3c!-- Login dialog box --\x3e",'
','
','
','
Log In
','
Log In
','
Cancel
',"
",'
',"

","

Don't have an account? It's quick and easy to !

","",'\t\t\t\t\t\t\t\t
','\t\t\t\t\t
','\t\t\t\t\t\t \t\t \t
email address
','\t
','\t\t ',"\t\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t
","",'\t\t\t\t\t\t\t\t
','\t\t\t\t
','\t\t\t\t\t \t\t \t
password
',"
",'\t ','',"\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t
","","\t\t\t\t\t\t\t
",'\t\t\t\t\t\t
','\t\t\t\t\t\t\t
Login
','\t\t\t\t\t\t\t
Cancel
',"\t\t\t\t\t\t
",'\t\t\t\t\t\t\t\t
','\t\t\t\t\t\t\t\t\tforgot password?',"\t\t\t\t\t\t\t\t
","","\t\t\t\t\t\t
","",'\t\t\t\t\t\t
',"",'\t\t\t\t\t\t
','\t\t\t\t\t\t \t
',"\t\t\t\t\t\t\t
",'\t\t\t\t\t
','\t\t\t\t\t
Try Again
','\t\t\t\t\t
Cancel
',"\t\t\t\t\t\t\t
","\t\t\t\t\t\t
","\t\t\t\t\t
","\t\t\t\t
","\t\t\t\t\t\t\x3c!-- Password-reset dialog box --\x3e",'\t\t\t\t\t
','\t\t\t\t\t
','\t\t\t\t\t
','\t\t\t\t\t
Reset Password
','\t\t\t\t\t ','\t\t\t\t\t ','\t\t\t\t\t ','\t\t\t\t\t ',"\t\t\t\t\t ","\t\t\t\t\t ","\t\t\t\t\t
",'\t\t\t\t\t
','\t\t\t\t\t
',"\t\t\t\t\t Please enter your new password below.","\t\t\t\t\t
",'\t\t\t\t\t\t\t\t
','\t\t\t\t\t\t
','\t\t\t\t\t\t
','\t\t\t\t\t\t
new password
','\t\t\t\t\t\t
','\t\t\t\t\t\t ',"\t\t\t\t\t\t
","\t\t\t\t\t\t
","\t\t\t\t\t\t
",'\t\t\t\t\t\t\t
','\t\t\t\t\t\t\t
','\t\t\t\t\t\t\t
new password (again)
','\t\t\t\t\t\t\t
','\t\t\t\t\t\t\t ',"\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t
","\t\t\t\t\t\t
","\t\t\t\t\t\t\t
","",'\t\t\t\t\t
','\t\t\t\t\t
Reset
','\t\t\t\t\t
Cancel
',"\t\t\t\t\t
","",'\t\t\t\t\t
',"",'\t\t\t\t\t
','\t\t\t\t\t
',"\t\t\t\t\t
",'\t\t\t\t\t
','\t\t\t\t\t
Try Again
','\t\t\t\t\t
Cancel
',"\t\t\t\t\t
","\t\t\t\t\t
","\t\t\t\t\t
","\t\t\t\t\t
","","","\t\t\t\t\t \x3c!-- Add-entry dialog box --\x3e",'
','
','
','
Add Entry
',"
",'
','\t\t\t\t\t\t\t\t
',"
","
","","","\t\t\t\t\t \x3c!-- Edit-entry dialog box --\x3e",'
','
','
','
Edit Entry
',' ','\t\t\t\t\t\t\t\t\t\t','\t\t\t\t\t\t\t\t\t\t ','\t\t\t\t\t\t\t\t\t\t ',"\t\t\t\t\t\t\t\t\t\t","\t\t\t\t\t\t\t\t\t","
",'
','\t\t\t\t\t\t\t\t
',"
","
","","",'\n\x3c!-- MemberSpace auto-login/signup dialog box --\x3e\n
\n
\n
\n
Please wait...
\n
\n
\n

Loading profile...

\n
\n
\n \n
\n
\n
\n',"","","\t\t\t\t\t \x3c!-- View-entry dialog box --\x3e",'
','
','
','
Details
',' ','\t\t\t\t\t\t\t\t\t\t','\t\t\t\t\t\t\t\t\t\t ','\t\t\t\t\t\t\t\t\t\t ',"\t\t\t\t\t\t\t\t\t\t","\t\t\t\t\t\t\t\t\t","
",'
',"
","
","
","","\t\t\t\t\t \x3c!-- Connection dialog box --\x3e",'
','
','
','
Details
',' ','\t\t\t\t\t\t\t\t\t\t','\t\t\t\t\t\t\t\t\t\t ','\t\t\t\t\t\t\t\t\t\t ',"\t\t\t\t\t\t\t\t\t\t","\t\t\t\t\t\t\t\t\t","
",'
',"
","\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t

Requesting connection...

",'\t\t\t\t\t\t\t\t\t
',"\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t
","
","
","","\t\t\t\t\t \x3c!-- Connection lookup dialog box --\x3e",'
','
','
','
Connection request
',' ','\t\t\t\t\t\t\t\t\t\t','\t\t\t\t\t\t\t\t\t\t ','\t\t\t\t\t\t\t\t\t\t ',"\t\t\t\t\t\t\t\t\t\t","\t\t\t\t\t\t\t\t\t","
","\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t

Fetching connection details...

",'\t\t\t\t\t\t\t\t\t
',"\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t

The person wishing to contact you is",'\t\t\t\t\t\t\t\t\t\t',"\t\t\t\t\t\t\t\t\t

","\t\t\t\t\t\t\t\t
","
","
","","\t\t\t\t\t \x3c!-- Share-entry dialog box --\x3e",'
','
','
','
Share this story
',' ','\t\t\t\t\t\t\t\t\t\t','\t\t\t\t\t\t\t\t\t\t ','\t\t\t\t\t\t\t\t\t\t ',"\t\t\t\t\t\t\t\t\t\t","\t\t\t\t\t\t\t\t\t","
","\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t
","
","
","","","\t\t\t\t\t \x3c!-- Invitation lookup dialog box --\x3e",'
','
','
','
Invitation
',' ','\t\t\t\t\t\t\t\t\t\t','\t\t\t\t\t\t\t\t\t\t ','\t\t\t\t\t\t\t\t\t\t ',"\t\t\t\t\t\t\t\t\t\t","\t\t\t\t\t\t\t\t\t","
","
","\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t\t

Looking up invitation details 🔍...

",'\t\t\t\t\t\t\t\t\t\t
',"\t\t\t\t\t\t\t\t\t
","","\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t\t

Signing up...📋

",'\t\t\t\t\t\t\t\t\t\t
',"\t\t\t\t\t\t\t\t\t
","","\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t\t

Welcome, ! Please fill in the fields","\t\t\t\t\t\t\t\t\t\tbelow to complete your registration.

","\t\t\t\t\t\t\t\t\t\t",'\t\t\t\t\t\t\t\t\t\t
','\t\t\t\t\t\t\t\t\t\t\t
','\t\t\t\t\t\t\t\t\t\t\t\t
password
','\t\t\t\t\t\t\t\t\t\t\t\t
','\t\t\t\t\t\t\t\t\t\t\t\t\t',"\t\t\t\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t\t
","",'\t\t\t\t\t\t\t\t\t\t
','\t\t\t\t\t\t\t\t\t\t\t
','\t\t\t\t\t\t\t\t\t\t\t\t
','\t\t\t\t\t\t\t\t\t\t\t\t\t','\t\t\t\t\t\t\t\t\t\t\t\t\t
','\t\t\t\t\t\t\t\t\t\t\t\t\t\t',"\t\t\t\t\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t\t
","",'\t\t\t\t\t\t\t\t\t\t
','\t\t\t\t\t\t\t\t\t\t\t',"\t\t\t\t\t\t\t\t\t\t
","\t\t\t\t\t\t\t\t\t
","
","
","
","","\t\t\t\t\t \x3c!-- Advanced-search dialog box --\x3e",'
','
','
','
',' ','\t\t\t\t\t\t\t\t\t\t','\t\t\t\t\t\t\t\t\t\t ','\t\t\t\t\t\t\t\t\t\t ',"\t\t\t\t\t\t\t\t\t\t"," ","
","
","
","
","
"," Text","
","
","
","
","
"," Search directory for mentions of:","
",' ',"
","
","
","
","
","
"," Location","
","
","
","
","
"," Placename","
",'
','',"
"," ","
","
"," Range of search","
"," ","
","
","
","
","
","
"," Categories","
","
","
","
","
","
","
","
","
","
","
","
","
",'\t\t\t\t\t\t\t
','\t\t\t\t\t\t\t
Search
','\t\t\t\t\t\t\t
Cancel
',"\t\t\t\t\t\t\t\t\t
","
","
","",'\n \x3c!-- Tag filter/search dialog box --\x3e\n
\n
\n \n
\n
Filter
\n \n
\n \n
\n \n
\n\n
\n
\n\n
\n
\n',"\t\t\t\t\t \x3c!-- Delete-entry dialog box --\x3e",'
','
','
','
Confirm deletion
',' ','\t\t\t\t\t\t\t\t\t\t','\t\t\t\t\t\t\t\t\t\t ','\t\t\t\t\t\t\t\t\t\t ',"\t\t\t\t\t\t\t\t\t\t"," ","
",'
','\t\t\t\t\t\t\t\t\t
',"\t
",'\t\t\t\t\t\t\t
','\t\t\t\t\t\t\t ','\t\t\t\t\t\t\t ',"\t\t\t\t\t\t\t\t\t
","
",'\t\t\t\t\t\t\t\t
',"
","
","","\t\t\t\t\t \x3c!-- Accept-T&C dialog box --\x3e",'
','
','
','
Community Guidelines
',' ','\t\t\t\t\t\t\t\t\t\t','\t\t\t\t\t\t\t\t\t\t ','\t\t\t\t\t\t\t\t\t\t ',"\t\t\t\t\t\t\t\t\t\t","\t\t\t\t\t\t\t\t\t","
",'
',"",'\t\t\t\t\t\t\t\t\t
',"\t\t\t\t\t\t\t\t\t\tPlease read through, and agree, to the following Community Guidelines.","\t
","",'\t\t\t\t\t\t\t\t\t
',"\t\t\t\t\t\t\t\t\t\tWe want to create a friendly and tolerant community that is safe for everyone. Please don't add anything that infringes on other people's copyright, violates any laws, includes images of an exploitative or sexual nature, promotes hate speech or intolerance or discriminates against groups or individuals based on their gender, race, ethnicity or sexual orientation.","\t\t\t\t\t\t\t\t\t
","",'\t\t\t\t\t\t\t
','\t\t\t\t\t\t\t
Agree
','\t\t\t\t\t\t\t
Cancel
',"\t\t\t\t\t\t\t\t\t
","","
","
","
","","","\t\t\t\t\t \x3c!-- Confirm-email dialog box --\x3e",'
','
','
','
Confirm email
',' ','\t\t\t\t\t\t\t\t\t\t','\t\t\t\t\t\t\t\t\t\t ','\t\t\t\t\t\t\t\t\t\t ',"\t\t\t\t\t\t\t\t\t\t","\t\t\t\t\t\t\t\t\t","
",'
','\t\t\t\t\t\t\t\t\t
',"\t\t\t\t\t\t\t\t\t\tValidating your email address, please wait...","\t
",'\t\t\t\t\t\t\t\t\t
','\t\t\t\t\t\t\t
','\t\t\t\t\t\t\t ',"\t\t\t\t\t\t\t\t\t
","
","
","
","","\t\t\t\t\t \x3c!-- Example add-entry dialog box --\x3e",'
','
','
','
Demo Box 🎁
',' ','\t\t\t\t\t\t\t\t\t\t','\t\t\t\t\t\t\t\t\t\t ','\t\t\t\t\t\t\t\t\t\t ',"\t\t\t\t\t\t\t\t\t\t","\t\t\t\t\t\t\t\t\t","
",'
','\t\t\t\t\t\t\t\t\t
',"\t\t\t\t\t\t\t\t\t\tYou're currently viewing one of our demo listings! To set up a directory for your own Community free of charge,",'\t\t\t\t\t\t\t\t\t\tsimply head over to our website and sign up. We can\'t wait',"\t\t\t\t\t\t\t\t\t\tto help you grow your community 🌱 🚿","\t
",'\t\t\t\t\t\t\t
','\t\t\t\t\t\t\t
Okay
',"\t\t\t\t\t\t\t\t\t
","
","
","
","","\t\t\t\t\t \x3c!-- Privacy Policy dialog box --\x3e",'
','
','
','
Privacy Policy
',' ','\t\t\t\t\t\t\t\t\t\t','\t\t\t\t\t\t\t\t\t\t ','\t\t\t\t\t\t\t\t\t\t ',"\t\t\t\t\t\t\t\t\t\t","\t\t\t\t\t\t\t\t\t","
",'
','\t\t\t\t\t\t\t\t\t
',"\t\t\t\t\t\t\t\t\t

"," In the following Policy,","

",' "We" refers to Fraction 7, Ltd, makers of Community Box',"

"," 1. What data we store on your device","

",' We may store "cookies" on your device. These enable us to customise the directory experience for you. We do not use them to track you or otherwise gain information about you.',"

"," 2. What we track","

"," We monitor activity in, and uploads to, Boxes. This is both to ensure there are no violations of the Terms and Conditions, or in order to comply with requests from law enforcement or other authorised government agencies.","

"," 3. What data we store","

"," We store any data that is necessary for the display and processing of a Box (e.g., the box contents themselves, and any settings or customisations that have been made to the Boxes). We also store your contact details so that we can get in touch with you for purposes in connection with the business. We also store usage metrics in order for our internal teams to improve the Community Box experience.","

"," 4. What data we share","

"," We are committed to your privacy and we do not share data with any 3rd parties, except in the case of requests from law enforcement and other authorised government agencies.","

"," 5. How we process your data","

"," Your data is stored and processed in the form of reports, and real-time monitoring and metrics. These are used internally within our company to allow us to improve our services so we can improve the Community Box user experience.","

"," 6. How you can obtain and erase the data we store about you","

",' If you wish to obtain copies of any data we store about you, or for us to erase that data (note that this would imply terminating your account with us), then you can email hello@communitybox.co with the subject line "GDPR request" and we will follow up with you to ascertain what action is required.

',"\t
",'\t\t\t\t\t\t\t
','\t\t\t\t\t\t\t
Let\'s go!
',"\t\t\t\t\t\t\t\t\t
","
","
","
"].join("");const ut=new MutationObserver((function(){const e=document.body.querySelector('div[id="communitybox-target"][uninitialised]');e&&(ut.disconnect(),e.removeAttribute("uninitialised"),window.setTimeout((function(){lt(e)}),250))}));ut.observe(document.body,{childList:!0,subtree:!0}),lt()},1173:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EntryWrapper=void 0;const n=i(9786);t.EntryWrapper=class{get key(){return this._data.entryKey}get box(){return this._data.boxKey}get addedByKey(){return this._data.addedbyKey}buildCookieCutterHtml(e,t){var i=document.createElement("div");i.innerHTML=e.getMarkup(t);var n=e.getStyle(t),r=new RegExp("\\[(.*?)\\]","g");do{var o=r.exec(n);if(o){const e=new RegExp("\\["+o[1]+"\\]\\s*?{(.*?)}","g").exec(n)[1],t=i.querySelectorAll("["+o[1]+"]");for(var s=0;s0?this.getValueOf(t[0].key):void 0;return t.length>0&&void 0!==i&&"object"==typeof i?void 0!==i.key:"string"==typeof i&&i.length>0&&-1===i.indexOf("gravatar")}getDisplayNameForTemplate(e){return e.getRuleForType(n.TemplateRuleType.DisplayName).filter((e=>void 0!==this._data.value[e.key])).map((e=>this._data.value[e.key]+e.interval)).join("")}hasValueForField(e){return!1!==this._data.value.hasOwnProperty(e)&&("string"!=typeof this._data.value[e]||0!==this._data.value[e].length)&&this._data.value.hasOwnProperty(e)}hasValueForFieldArray(e){for(const t of e)if(this._data.value.hasOwnProperty(t))return!0;return!1}get_all_tags(e){const t=e.categories,i=[];for(const e of t){const t=this.getValueOf(e);if(null==t)continue;const n="string"==typeof t?t.split(","):t;i.push(...n)}return i}try_to_parse(e){try{return JSON.parse(e)}catch(e){return}}getGeoDataForTemplate(e){return e.fieldsOfType("location-input").map((e=>e in this._data.value?"string"==typeof this._data.value[e]&&this._data.value[e].length>0?this.try_to_parse(this._data.value[e]):this._data.value[e]:void 0)).reduce(((e,t)=>(t&&e.push(t),e)),[])}get isNotApproved(){return"awaiting"===this._data.moderation}for_each_value_key(e){Object.keys(this._data.value).forEach((t=>e(t)))}getValueOf(e){return this._data.value[e]}get bespokeDetailLink(){return this._data.value.bespoke_detail}isFeatured(){return this._data.value&&void 0!==this._data.value.feature_level&&this.featureLevel()>0}featureLevel(){try{return parseInt(this._data.value.feature_level)}catch(e){}return 0}constructor(e){this._data=e;for(const e in this._data.value)null===this._data.value[e]&&delete this._data.value[e]}}},2873:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExampleBox=void 0;const n=i(1370),r=i(3189);t.ExampleBox=class{constructor(e){this._dlgElem=document.getElementById("cbeb-example-modal"),n.DialogBoxMgr.registerDialogBox(this._dlgElem),r.Styling.applyAllStylesTo({rootElem:this._dlgElem,withConfig:e})}Show(){n.DialogBoxMgr.show(this._dlgElem)}}},1372:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.field_edit_ctrl=void 0,t.field_edit_ctrl=class{get fieldKey(){return this._field.key}post_dom_add(){}leftOfViewRow(){return`
`}rightOfViewRow(e){return`
${e||""}
`}getDetailGlyph(e){switch(e){case"website-input":return'';case"email-input":return'';case"phone-input":return'';case"date-input":return'';case"location-input":return'';default:return""}}leftOfInputRow(e){return'
'+(e||"")+'
'}rightOfInputRow(e){return'
'+(e||"")+"
"}install_input_handler_for(e,t){const i=e.querySelector(t),n=e.querySelector("[fieldKey]");i.addEventListener("keyup",(()=>{i.value.length>0&&n.removeAttribute("missing_required_field")})),i.addEventListener("change",(()=>{i.value.length>0&&n.removeAttribute("missing_required_field")}))}constructor(e,t){this._entry=e,this._field=t}}},7001:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FieldEditCtrlFactory=void 0;const n=i(3160),r=i(1375),o=i(2309),s=i(6101),a=i(3592),l=i(6374),c=i(6852),u=i(4683),h=i(8782),d=i(5718),p=i(18),f=i(2480);t.FieldEditCtrlFactory=function(e,t,i,m,_){switch(t.ctrlType){case"category-input":return new r.category_edit_ctrl(e,t,i.config,_);case"date-input":case"facebook-input":case"instagram-input":case"linkedin-input":case"pinterest-input":case"twitter-input":case"slack-input":case"single-line-text-input":default:return new n.SingleLineEditCtrl(e,t,i.config);case"email-input":return new h.EmailEditCtrl(e,t,i.config);case"image-gallery":return new o.ImageGallery(e,t,i.directory);case"phone-input":return new d.PhoneNbEditCtrl(e,t,i.config);case"product-picture":return new a.ProductPictureEditCtrl(e,t);case"multi-line-text-input":return new s.MultiLineEditCtrl(e,t);case"location-input":return new l.LocationEditCtrl(e,t,i.config,i);case"image-input":return new c.ProfilePictureEditCtrl(e,t,i.config,i.template,i.directory);case"website-input":return new u.WebsiteEditCtrl(e,t,i.config);case"file-input":return new p.FileEditCtrl(e,t,i.config,m);case"youtube-input":case"vimeo-input":case"video-input":return new f.VideoEmbedCtrl(e,t)}}},18:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileEditCtrl=void 0;const n=i(1372),r=i(205),o=i(2702),s=i(7964),a=i(2131);class l extends n.field_edit_ctrl{data(){return JSON.stringify(this._files)}has_data(){return this._files.length>0}fileDownloadHtml(e){return`\n \n
\n
\n
${e.title}
\n
${e.desc}
\n
\n
\n ${this.glyphForFileType(e)}\n
\n
\n
`}viewHtmlElem(){const e=[this.leftOfViewRow(),`
\n ${this._field.detailLabel?`
${this._field.detailLabel}
`:""}\n ${this._files.reduce(((e,t)=>e+this.fileDownloadHtml(t)),"")}\n
`,this.rightOfViewRow()].join(""),t=document.createElement("div");return t.innerHTML=e,t}encodeToBase64(e){return new o.Promise(((t,i)=>{const n=new FileReader;n.readAsDataURL(e),n.onload=()=>{t(n.result.slice(n.result.indexOf("base64,")+7))},n.onerror=e=>{i(e)}}))}promiseSerial(e){return e.reduce(((e,t)=>e.then((e=>t().then(Array.prototype.concat.bind(e))))),o.Promise.resolve([]))}uploadPart(e){return new o.Promise(((t,i)=>{const n=new XMLHttpRequest;n.open("post","https://api.communitybox.co/upload/file",!0),n.upload.addEventListener("progress",(function(e){r.UpdateMeter(e.loaded/e.total)})),n.onload=function(){4===n.readyState&&200===n.status?t(JSON.parse(n.responseText)):i(n.responseText)},n.send(JSON.stringify({box:this._entry.box,profile:"temp",filename:e.filename,part:e.partIdx,total_parts:e.nbParts,key:e.uploadKey,b64_data:e.b64data}))}))}uploadNewFile(e){return new o.Promise(((t,i)=>{this.encodeToBase64(e).then((i=>{const n=131072,r=Math.ceil(i.length/n),o=(0,a.uuidv4)(),s=[];for(let t=0;tthis.uploadPart({b64data:a,filename:e.name,uploadKey:o,partIdx:t,nbParts:r})))}this.promiseSerial(s).then((()=>{const s=i.length-(r-1)*n,a=i.slice(i.length-s,i.length);this.uploadPart({b64data:a,filename:e.name,uploadKey:o,partIdx:r-1,nbParts:r}).then((e=>{const i=e;t({bucket_path:i.bucket_path,tag:i.tag})}))}))}))}))}glyphForFileType(e){switch("linked-file"===e.type?e.location.toLowerCase().split(".").pop():e.bucket_path.toLowerCase().split(".").pop()){case"pdf":return'';case"doc":case"docx":return'';default:return''}}fileAmendHtml(e){return`\n
\n
\n

${e.title}

\n
${e.desc}
\n
\n \n
`}hideParentDlg(){void 0!==this._parentDlg&&(this._parentDlg.style.display="none")}showParentDlg(){void 0!==this._parentDlg&&(this._parentDlg.style.display="block")}inputKey(e){return e}handleFileUpload(e,t){this.hideParentDlg(),r.Show(),this.uploadNewFile(t.target.files[0]).then((t=>{r.Hide(),s.Show({title:"File description",inputArray:[{label:"Title of file",placeholder:"e.g., Sustainability Report 2018",key:this.inputKey("file-title")},{label:"One-line description of file",placeholder:"e.g., Our most comprehensive report yet...",key:this.inputKey("file-desc")}],onResult:i=>{const n={type:"uploaded-file",tag:t.tag,bucket_path:t.bucket_path,title:i[this.inputKey("file-title")],desc:i[this.inputKey("file-desc")],key:(0,a.uuidv4)()},r=document.createElement("div");r.innerHTML=this.fileAmendHtml(n),e.appendChild(r);const o=r.querySelector("button[delete]");this.addDeleteHandler(this,o),this._files.push(n)},onClose:()=>{s.Hide(),this.showParentDlg()}})})).catch((e=>{console.error(e),r.Hide(),this.showParentDlg()}))}addDeleteHandler(e,t){t.addEventListener("click",(function(){const t=this.getAttribute("key"),i=this.parentElement;i.parentElement.removeChild(i),e._files=e._files.filter((e=>e.key!==t))}))}handleLinkUpload(e){this.hideParentDlg(),s.Show({title:"Add report link",inputArray:[{label:"Title of report",placeholder:"e.g., Sustainability Report 2018",key:this.inputKey("file-title")},{label:"One-line description of report",placeholder:"e.g., Our most comprehensive report yet...",key:this.inputKey("file-desc")},{label:"Location of report",placeholder:"https://example.com/report.pdf",key:this.inputKey("file-location")}],onResult:t=>{const i={type:"linked-file",location:t[this.inputKey("file-location")],title:t[this.inputKey("file-title")],desc:t[this.inputKey("file-desc")],key:(0,a.uuidv4)()},n=document.createElement("div");n.innerHTML=this.fileAmendHtml(i),e.appendChild(n);const r=n.querySelector("button[delete]");this.addDeleteHandler(this,r),this._files.push(i)},onClose:()=>{s.Hide(),this.showParentDlg()}})}inputHtmlElem(){const e=this.leftOfInputRow()+'
'+this._field.label+(!0===this._field.required?" (required)":"")+(!0===this._field.readonly?'  ':"")+"
"+`
\n
\n \n \n
\n \n
\n ${this._files.map((e=>this.fileAmendHtml(e))).join("")}\n
\n
`;this.rightOfInputRow();const t=document.createElement("div");t.innerHTML=e;const i=t.querySelector("[existing-file-container]"),n=i.querySelectorAll("button[delete]");for(let e=0;e{this.handleFileUpload(i,e)})),t.querySelector("button[add-file]").addEventListener("click",(()=>{r.click()})),t.querySelector("button[add-link]").addEventListener("click",(()=>{this.handleLinkUpload(i)})),t}constructor(e,t,i,n){if(super(e,t),this._entry=e,this._field=t,this._config=i,this._parentDlg=n,this._files=[],e.hasValueForField(t.key))try{this._files=JSON.parse(e.getValueOf(t.key)),!1===Array.isArray(this._files)&&(this._files=[])}catch(e){this._files=[]}}}t.FileEditCtrl=l},5941:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.initialise_filter_bar=void 0;const n=i(7102),r=i(2607),o=i(8945),s=i(9651);class a{set_launch_search_function(e){}post_document_add(){}}class l extends a{reset(){}get_search_term(){}set_launch_search_function(e){this._launch_search=e}build(){return n.button("",this._label,(()=>{this._launch_search({destination:this._destination})}),{design:this._design})}constructor(e,t,i){super(),this._design=e,this._label=t,this._destination=i,this._launch_search=()=>{}}}class c extends a{reset(){this._chosen_value=void 0,this._input_field&&(this._input_field.value="")}set_launch_search_function(e){this._launch_search=e}get_search_term(){return void 0===this._chosen_value?void 0:this._search_term_for(this._chosen_value)}handle_on_result(e){if(this._result_display_div){const t=this._result_display_div.querySelector("[cbeb-fb-search-term-rf]")||null;t&&(t.textContent=e),this._result_display_div.style.display="flex",this._no_result_display_div&&(this._no_result_display_div.style.display="none")}}handle_no_result(e){if(this._no_result_display_div){const t=this._no_result_display_div.querySelector("[cbeb-fb-search-term-rf]")||null;t&&(t.textContent=e),this._no_result_display_div.style.display="flex",this._result_display_div&&(this._result_display_div.style.display="none")}}handle_enter_key(e){this._chosen_value=e,this._launch_search({on_result:this._result_display_div?()=>{this.handle_on_result(e)}:void 0,on_no_result:this._no_result_display_div?()=>{this.handle_no_result(e)}:void 0,destination:this._destination})}build(){const e=n.datalist(this._field_key,Object.keys(this._tag_dict).map((e=>({value:e,label:e}))));this._input_field=n.input("data-lpignore=true",(function(e,i){"Enter"===e.key&&t.handle_enter_key(i.value)}),this._design.input,{placeholder:this._placeholder,datalist:this._field_key});const t=this;return n.div("",[e,this._input_field],{design:this._design["typable-container"]})}constructor(e,t,i,n,r,o){super(),this._design=e,this._placeholder=t,this._tag_dict=i,this._search_term_for=n,this._field_key=r,this._destination=o,this._result_display_div=document.querySelector("[cbeb-fb-search-result]"),this._result_display_div&&(this._result_display_div.style.display="none"),this._no_result_display_div=document.querySelector("[cbeb-fb-search-no-result]"),this._no_result_display_div&&(this._no_result_display_div.style.display="none"),this._launch_search=()=>{}}}class u extends a{reset(){this._region=void 0,this._latitude=void 0,this._longitude=void 0,this._mpt_geocoder.clear()}build(){return this._container=n.div("",[],{design:this._design.container}),this._container}post_document_add(){window.setTimeout((()=>{if(this._mpt_geocoder=new s({accessToken:this._mapboxKey,types:"country,region,place,postcode,locality,neighborhood",placeholder:this._placeholder}),this._mpt_geocoder.on("clear",(()=>{this._region=void 0,this._latitude=void 0,this._longitude=void 0})),this._mpt_geocoder.on("result",(e=>{if(e.result.place_type&&e.result.place_type instanceof Array&&e.result.place_type.length>0&&("region"===e.result.place_type[0]||"country"===e.result.place_type[0]))this._region=e.result.text,this._latitude=void 0,this._longitude=void 0;else{const t=e.result.center[0],i=e.result.center[1];this._latitude=i,this._longitude=t,this._region=void 0}})),this._mpt_geocoder.addTo(this._container),this._container){const e=this._container.querySelector(".mapboxgl-ctrl-geocoder--input");e&&(e.setAttribute("autocomplete","chrome-off"),e.setAttribute("data-lpignore","true"))}}),500)}get_search_term(){return void 0!==this._region&&this._region.length>0?`region=${encodeURIComponent(this._region)}`:void 0!==this._longitude&&void 0!==this._latitude?`location=${encodeURIComponent(this._latitude)},${encodeURIComponent(this._longitude)}`:void 0}constructor(e,t,i){super(),this._design=e,this._placeholder=t,this._mapboxKey=i}}class h extends a{reset(){this._input_ctrl.value=""}build(){return this._input_ctrl}get_search_term(){return this._input_ctrl.value.length>0?`text=${encodeURIComponent(this._input_ctrl.value)}`:void 0}constructor(e,t){super(),this._design=e,this._placeholder=t,this._input_ctrl=n.input("",(()=>{}),this._design.input,{placeholder:this._placeholder}),this._input_ctrl.setAttribute("autocomplete","off")}}class d extends a{reset(){this._select_ctrl&&(this._select_ctrl.value="placeholder-default"),this._chosen_value=void 0}get_search_term(){return void 0===this._chosen_value?void 0:this._search_term_for(this._chosen_value)}build(){return this._select_ctrl=n.select("",Object.keys(this._option_dict).reduce(((e,t)=>(e.push({value:this._option_dict[t],label:t}),e)),[]),{dropdown_design:this._design.selector,choice_design:this._design.option,placeholder:this._placeholder,on_selection_change:e=>{this._chosen_value="placeholder-default"===e?void 0:e}}),this._select_ctrl}constructor(e,t,i,n){super(),this._design=e,this._placeholder=t,this._option_dict=i,this._search_term_for=n}}function p(e,t,i){return!0===t.has_field(i)?r.from(e,[t.getField(i)]):{}}function f(e){return Object.keys(e).reduce(((t,i)=>(t[i.split(" ").map((e=>"of"===e?"of":function(e){return e.charAt(0).toUpperCase()+e.slice(1)}(e))).join(" ")]=e[i],t)),{})}function m(e,t,i){t(e.map((e=>e.get_search_term())).filter((e=>void 0!==e)).join("&"),i)}t.initialise_filter_bar=function(e){const t=document.querySelector("[cbeb-filter-bar]");if(null==t)return{clear_filters:()=>{}};t.setAttribute("initialised",""),n.remove_all_child_elements_from(t);const i=n.div("",[],{design:e.config.filter_bar_design(e.aspect).external_frame}),r=n.div("",[],{design:e.config.filter_bar_design(e.aspect).internal_frame}),s=function(e){const t=e.config.filter_bar_components(e.aspect).map((t=>function(e,t,i,n){switch(e.type){case"location":if(n.mbk)return new u(e.design,e.placeholder,n.mbk);throw"Can't initialise location search field as there is no Mapbox key available";case"free-text":return new h(e.design,e.placeholder);case"typable-category":return new c(e.design,e.placeholder,p(t,i,e.field),(t=>`${e.field}=${encodeURIComponent(t)}`),e.field,"");case"typable-state":return new c(e.design,e.placeholder,Object.keys(o.state_dict).reduce(((e,t)=>(e[t]=1,e)),{}),(e=>`region=${encodeURIComponent(e)}`),"typable-state","");case"dropdown-category":return new d(e.design,e.placeholder,f(function(e,t,i){const n=p(e,i,t);return Object.keys(n).reduce(((e,t)=>(e[t]=t,e)),{})}(t,e.field,i)),(t=>`category-filter-${e.field}=${encodeURIComponent(t)}`));case"dropdown-state":return new d(e.design,e.placeholder,f(o.state_dict),(e=>`region=${encodeURIComponent(e)}`));case"launch":return new l(e.design,e.label,e.destination)}}(t,e.directory,e.template,e.documentState)));for(const i of t)i.set_launch_search_function((i=>{m(t,e.launch_search,i)}));return t}(e);for(const e of s)r.appendChild(e.build());for(const e of s)e.post_document_add();return i.appendChild(r),t.appendChild(i),{clear_filters:()=>{for(const e of s)e.reset()}}}},4595:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FilterAndSearchDlg=void 0;const n=i(1370),r=i(3189),o=i(9882),s=i(9651);t.FilterAndSearchDlg=class{extract_category_array_from(e){if(void 0!==e)return"string"==typeof e&&e.length>0?e.split(","):e}trimTag(e){return e.trim().replace("&","&").replace("<","<")}extractTagsFrom(e,t){const i=new Set;if("all"===t.get().tagDiscoverability)for(const e of t.categoryChoiceList)i.add(this.trimTag(e));return e.forEachEntryWithValueFor([t.key],(e=>{(this.extract_category_array_from(e.getValueOf(t.key))||[]).forEach((e=>{i.add(this.trimTag(e))}))})),Array.from(i)}append_tag_options_to(e,t,i){const n=this.extractTagsFrom(i,t),r=(0,o.SortTags)(n,t);for(const t of r){const i=document.createElement("option");i.value=t,i.text=t.replace(/&/g,"&"),e.appendChild(i)}}location_input_is_blank(){const e=this._dlgElem.querySelector(".mapboxgl-ctrl-geocoder--input");return!e||0===e.value.length}constructor(e,t,i,o){this._invariants=e,this.filterMgr=t,this.launchSearch=i,this._box=o,this._dlgElem=document.querySelector("[filter-and-search]"),this._tagListElem=this._dlgElem.querySelector("[tag-list]"),this._selectListElem=this._dlgElem.querySelector("[selectorlist]"),this._location_input_elem=this._dlgElem.querySelector("input[placename]"),this._freeTextElem=this._dlgElem.querySelector("[free-text-input]"),this._radiusElem=this._dlgElem.querySelector("select[radius]"),this._locationElem=this._dlgElem.querySelector("[location][fields]"),this._autocompleteElem=void 0,this._categoryList=[],this._selectorElem=[],this._mpt_geocoder=void 0,this._freeTextElem.value="";const s=this._dlgElem.querySelector(".cbeb-modal-title-text");s&&(s.textContent=e.config.get_wording("saf-dlg-title"));const a=this._dlgElem.querySelector("[launch-advanced-search]");a.textContent=e.config.get_wording("launch-search-btn"),this._dlgElem.querySelector(".cbeb-extra-button-row [close-dialog-btn]").textContent=e.config.get_wording("cancel_btn");const l=["saf-text-label","saf-categories","saf-freetext-label","saf-location","saf-placename","saf-radius"];for(const t of l){const i=this._dlgElem.querySelector(`[${t}]`);i&&i instanceof HTMLElement&&(i.textContent=e.config.get_wording(t))}n.DialogBoxMgr.registerDialogBox(this._dlgElem),r.Styling.applyAllStylesTo({rootElem:this._dlgElem,withConfig:e.config}),!1===e.config.showLocationSearch&&(this._locationElem.style.display="none");const c="kilometre"===e.config.distanceUnit?"kilometres":"miles",u=[5,10,25,50,100,250];-1===u.indexOf(e.config.default_proximity_distance)&&(u.push(e.config.default_proximity_distance),u.sort(((e,t)=>t-e))),u.forEach((t=>{const i=document.createElement("option");i.value=`${t}`,i.text=`${t} ${c}`,t===e.config.default_proximity_distance&&(i.defaultSelected=!0),this._radiusElem.appendChild(i)}));const h=e.template.categories.map((t=>e.template.getField(t))).filter((e=>e.searchable)).sort(((e,t)=>e.rank-t.rank));for(const e of h){const t=document.createElement("select");t.setAttribute("category-selector",""),t.setAttribute("mb10","");const i=e.detailLabel||e.label,n=document.createElement("option");n.value=i,n.text=i,n.setAttribute("disabled",""),n.setAttribute("selected",""),t.appendChild(n),this.append_tag_options_to(t,e,this._box),t.addEventListener("change",(()=>{const e=t.value,i=document.createElement("div"),n=document.createElement("button");n.textContent=String.fromCharCode(215),n.addEventListener("click",(()=>{window.setTimeout((()=>{this._tagListElem.removeChild(i),this._categoryList=this._categoryList.filter((t=>t!==e))}),100)}));const r=document.createElement("label");r.textContent=e.replace(/&/g,"&"),i.setAttribute("tag",""),i.setAttribute("flex",""),i.setAttribute("row",""),i.appendChild(r),i.appendChild(n),this._categoryList.push(e),this._tagListElem.appendChild(i)})),this._selectListElem.appendChild(t),this._selectorElem.push(t)}for(;this._tagListElem.firstChild;)this._tagListElem.removeChild(this._tagListElem.firstChild);a.addEventListener("click",(()=>{const r=this._freeTextElem.value,o=this.getSearchRadiusAsNumber();r.length>0?t.updateFreeSearchTerm(r.split(" ")):t.clear_free_search_term(),t.updateCategoryListFilter(this._categoryList),this.location_input_is_blank()&&(this._locLat=void 0,this._locLng=void 0),this._region?(t.update_region(this._region),t.clearProximityFilter()):this._locLat&&this._locLng?t.updateProximityFilter({lat:this._locLat,lng:this._locLng},o):t.clearProximityFilter(),n.DialogBoxMgr.close(),i(e)}))}Show(){for(this.filterMgr.clearAllFilters(),void 0===this._autocompleteElem&&void 0===this._mpt_geocoder&&this.initLocationAutocomplete(),this._selectorElem.forEach((e=>e.selectedIndex=0)),this._categoryList=[];this._tagListElem.firstChild;)this._tagListElem.removeChild(this._tagListElem.firstChild);n.DialogBoxMgr.show(this._dlgElem)}getSearchRadiusAsNumber(){return Number(this._radiusElem.value)}use_google_for_autocomplete(){this._autocompleteElem=new google.maps.places.Autocomplete(this._location_input_elem,{fields:["geometry.location"]}),void 0!==this._autocompleteElem&&this._autocompleteElem.addListener("place_changed",(()=>{const e=this._autocompleteElem.getPlace();this._locLat=e.geometry.location.lat(),this._locLng=e.geometry.location.lng()}))}use_mapbox_for_autocomplete(e){const t=new s({accessToken:this._invariants.documentState.mbk,types:"country,region,place,postcode,locality,neighborhood",placeholder:e.location_search_placeholder});this._mpt_geocoder=t,this._mpt_geocoder.on("result",(e=>{if(e.result.place_type&&e.result.place_type instanceof Array&&e.result.place_type.length>0&&"region"===e.result.place_type[0])this._region=e.result.text,this._locLat=void 0,this._locLng=void 0;else{const t=e.result.center[0],i=e.result.center[1];this._locLat=i,this._locLng=t,this._region=void 0}})),this._mpt_geocoder.addTo("#cbeb-placename-autocomplete"),this._location_input_elem.style.display="none";const i=this._dlgElem.querySelector(".mapboxgl-ctrl-geocoder--input");i&&(i.setAttribute("autocomplete","chrome-off"),i.setAttribute("data-lpignore","true"))}initLocationAutocomplete(){"undefined"!=typeof google&&"undefined"!=typeof g_bespoke_google_api_key&&void 0!==g_bespoke_google_api_key?this.use_google_for_autocomplete():null!=this._invariants.documentState.mbk?this.use_mapbox_for_autocomplete(this._invariants.config):this.use_google_for_autocomplete()}}},8945:(e,t)=>{"use strict";var i,n;Object.defineProperty(t,"__esModule",{value:!0}),t.FilterManager=t.FilterOutcome=t.reverse_state_dict=t.state_dict=void 0,t.state_dict={alabama:"al",alaska:"ak","american samoa":"as",arizona:"az",arkansas:"ar",california:"ca",colorado:"co",connecticut:"ct",delaware:"de","district of columbia":"dc","federated states of micronesia":"fm",florida:"fl",georgia:"ga",guam:"gu",hawaii:"hi",idaho:"id",illinois:"il",indiana:"in",iowa:"ia",kansas:"ks",kentucky:"ky",louisiana:"la",maine:"me","marshall islands":"mh",maryland:"md",massachusetts:"ma",michigan:"mi",minnesota:"mn",mississippi:"ms",missouri:"mo",montana:"mt",nebraska:"ne",nevada:"nv","new hampshire":"nh","new jersey":"nj","new mexico":"nm","new york":"ny","north carolina":"nc","north dakota":"nd","northern mariana islands":"mp",ohio:"oh",oklahoma:"ok",oregon:"or",palau:"pw",pennsylvania:"pa","puerto rico":"pr","rhode island":"ri","south carolina":"sc","south dakota":"sd",tennessee:"tn",texas:"tx",utah:"ut",vermont:"vt","virgin islands":"vi",virginia:"va",washington:"wa","west virginia":"wv",wisconsin:"wi",wyoming:"wy"},t.reverse_state_dict=Object.keys(t.state_dict).reduce(((e,i)=>(e[t.state_dict[i]]=i,e)),{}),function(e){e[e.Keep=0]="Keep",e[e.Discard=1]="Discard"}(i||(t.FilterOutcome=i={})),function(e){e[e.Match=0]="Match",e[e.NoMatch=1]="NoMatch",e[e.EmptyCriterion=2]="EmptyCriterion"}(n||(n={})),t.FilterManager=class{constructor(e){this._config=e,this._freeSearchTerm=[],this._categoryFilter=[],this._bespokeSearchResults={},this._bespokeSearchActive=!1,this._referenceDist=e.default_proximity_distance}clearAllFilters(){this._freeSearchTerm=[],this._categoryFilter=[],this._geoLoc=void 0,this._bespokeSearchResults={},this._bespokeSearchActive=!1,this._state_lookup=void 0}onlyShowTheseEntries(e){this._bespokeSearchActive=!0,this._bespokeSearchResults=e.reduce(((e,t)=>(e[t]=!1,e)),{})}HasActiveFilter(){return this._categoryFilter.length>0||void 0!==this._geoLoc||void 0!==this._state_lookup||this._freeSearchTerm.length>0||!0===this._bespokeSearchActive}update_region(e){const i=e.toLowerCase();i in t.reverse_state_dict?this._state_lookup=new RegExp(`\\b(${i}|${t.reverse_state_dict[i]})\\b`,"i"):this._state_lookup=new RegExp(`\\b(${i}|${t.state_dict[i]})\\b`,"i")}updateFreeSearchTerm(e){this._freeSearchTerm=e;const i=e.map((e=>e.toLowerCase())).filter((e=>e in t.state_dict));i.length>0&&this.update_region(t.state_dict[i[0]])}transform_category_for_filtering(e){return e.trim().toLowerCase().replace(/&(?!amp;)/g,"&")}updateCategoryFilter(e){this._categoryFilter=[this.transform_category_for_filtering(e)]}add_to_category_filter(e){this._categoryFilter.push(this.transform_category_for_filtering(e))}updateCategoryListFilter(e){this._categoryFilter=e.map((e=>this.transform_category_for_filtering(e)))}GetFreeSearchTerm(){return this._freeSearchTerm}clearProximityFilter(){this._geoLoc=void 0,this._referenceDist=this._config.default_proximity_distance}updateProximityFilter(e,t){this._geoLoc=e,this._referenceDist=t}categoryFilter(e,t){if(0===this._categoryFilter.length)return n.EmptyCriterion;const i=t.fieldsOfType("category-input").filter((e=>!0===t.getField(e).searchable)).reduce(((t,i)=>{const n=e.getValueOf(i),r="string"==typeof n?n.split(","):n;return void 0!==r?t.concat(r.map((e=>this.transform_category_for_filtering(e)))):t}),[]);return"all"===this._config.filter_config.tag_match?this._categoryFilter.filter((e=>i.filter((t=>t===e)).length>0)).length===this._categoryFilter.length?n.Match:n.NoMatch:this._categoryFilter.filter((e=>i.filter((t=>t===e)).length>0)).length>0?n.Match:n.NoMatch}any_matches(e,t,i){let n=!0;for(const r of e){let e=!1;t.for_each_value_key((n=>{if(i.has_field(n)&&!0===i.getField(n).searchable){const i=t.getValueOf(n),o=JSON.stringify(i);!0===r.test(o)&&(e=!0)}})),n=n&&e}return n}mapDistConversionFactor(){switch(this._config.distanceUnit){case"mile":return.621371;case"kilometre":return 1}}distance_between(e){const t=this.deg2rad(e.b.lat-e.a.lat),i=this.deg2rad(e.b.lng-e.a.lng),n=Math.sin(t/2)*Math.sin(t/2)+Math.cos(this.deg2rad(e.a.lat))*Math.cos(this.deg2rad(e.b.lat))*Math.sin(i/2)*Math.sin(i/2);return 2*Math.atan2(Math.sqrt(n),Math.sqrt(1-n))*6371}deg2rad(e){return e*(Math.PI/180)}clear_free_search_term(){this._freeSearchTerm=[]}escape_regex_special_characters(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}init_regexp_for(e){return"yes"===this._config.filter_config.respect_word_boundary?new RegExp(`\\b[n]?${this.escape_regex_special_characters(e)}\\b`,"i"):new RegExp(`${this.escape_regex_special_characters(e)}`,"i")}Filter(e,t){if(!0===this._bespokeSearchActive)return e.key in this._bespokeSearchResults?i.Keep:i.Discard;if(0===this._freeSearchTerm.length&&0===this._categoryFilter.length&&void 0===this._geoLoc&&void 0===this._state_lookup)return i.Keep;{let r=this._freeSearchTerm.map((e=>this.init_regexp_for(e))),o=this.categoryFilter(e,t),s=n.EmptyCriterion;this._freeSearchTerm.length>0&&(s=this.any_matches(r,e,t)?n.Match:n.NoMatch);let a=n.EmptyCriterion;if(void 0!==this._state_lookup){a=n.NoMatch;const i=e.getGeoDataForTemplate(t);for(const e of i)this._state_lookup.test(e.formatted_address)&&(a=n.Match)}let l=this._geoLoc?n.NoMatch:n.EmptyCriterion;if(this._geoLoc){const i=e.getGeoDataForTemplate(t);for(const e of i){if(l===n.Match)continue;const t={lat:e.lat,lng:e.lng};l=this.distance_between({a:t,b:this._geoLoc})*this.mapDistConversionFactor()e!==n.EmptyCriterion)).reduce(((e,t)=>e&&t===n.Match),!0)?i.Keep:i.Discard}}}},2997:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.send_pw_reset_link_dlg=void 0;const r=i(7102),o=i(2673);t.send_pw_reset_link_dlg=class{constructor(e,t){this._directory=e,this._button_design=`background-color: #${t.bgColourOf("button")};color: #${t.fgColourOf("button")}`,this._secondary_button_design=`background-color: #${t.fgColourOf("button")};color: #${t.bgColourOf("button")}; border: 1px solid ${t.bgColourOf("button")}`}cleaned_up_location(e){return e.split(/[\?\#]/g)[0]}build_stage_1_buttons(e){r.remove_all_child_elements_from(e.container),e.container.appendChild(r.div("flex row",[r.button("basic mr17",e.okay_btn_label,(()=>{e.error_text.textContent=" ",0!==e.email_input.value.length&&-1!==e.email_input.value.indexOf("@")&&-1!==e.email_input.value.indexOf(".")?(window.setTimeout((()=>{r.remove_all_child_elements_from(e.container),e.container.appendChild(r.p("mt0 mb0",e.config.get_wording("please_wait")))})),this.TryToRecover({member_email:e.email_input.value.toLowerCase().trim(),originatingURL:this.cleaned_up_location(window.location.href),directory:this._directory,context:e.context},{onResult:()=>{window.setTimeout((()=>{this.build_stage_3(e.root_container,e.outer_elem,e.config,e.congratulations)}))},onFailure:t=>{"unrecognised username"===t.err?e.error_text.textContent="Unrecognised email":e.error_text.textContent="string"==typeof t?t:JSON.stringify(t),window.setTimeout((()=>{this.build_stage_1_buttons(e)}))}})):e.error_text.textContent="Please enter a valid email"}),{design:this._button_design}),r.button("basic",e.config.get_wording("cancel_btn"),(()=>{this.close_dialog(e.outer_elem)}),{design:this._secondary_button_design})]))}build_stage_3(e,t,i,n){r.remove_all_child_elements_from(e);const o=`font-family: ${i.fontFamily||"inherit"};`;e.appendChild(r.div("flex col",[r.p("mt0 mb0",n,{design:`${o}; box-sizing: border-box; padding: 31px; background-color: white;`}),r.div("flex row justify-center",[r.button("basic mr17",i.get_wording("close"),(()=>{this.close_dialog(t)}),{design:this._button_design})])]))}show(e){const t=r.div("dialogbox block",[],{design:`font-family: ${e.config.fontFamily};`}),i=r.input("basic",(()=>{}),"",{placeholder:e.config.get_wording("email-placeholder")}),n=r.p("mt7 mb0 red"," ",{design:"font-family: inherit; font-size: 14px;"}),o=`font-family: ${e.config.fontFamily||"inherit"};`,s=r.div("flex col",[],{design:"box-sizing: border-box; padding: 31px;"}),a=r.div("flex row justify-center",[]);this.build_stage_1_buttons({root_container:s,container:a,outer_elem:t,error_text:n,email_input:i,config:e.config,congratulations:e.congratulations,okay_btn_label:e.okay_btn_label,context:e.context}),s.appendChild(r.div("flex col",[r.p("mt0 mb0",e.greeting,{design:`${o}; box-sizing: border-box; padding: 31px; background-color: white;`}),r.div("flex col justify-center",[i,n],{design:"padding: 7px 31px 31px 31px"}),r.div("h17",[]),a,r.div("h37",[])]));const l=r.div("flex col",[r.p("mt0 mb0",e.title,{design:`${o}; color: #${e.config.fgColourOf("dialog_title")}; box-sizing: border-box; padding: 31px; background-color: #${e.config.bgColourOf("dialog_title")}`}),s],{design:"width: 500px; margin-left: auto; margin-right: auto; background-color: white;"});t.appendChild(l),t.addEventListener("click",(e=>{e.target!==t&&e.target!==l||window.setTimeout((()=>{this.close_dialog(t)}))})),document.body.appendChild(t),document.body.classList.add("cbeb-noscroll")}close_dialog(e){window.setTimeout((function(){document.body.removeChild(e),document.body.classList.remove("cbeb-noscroll")}))}TryToRecover(e,t){return n(this,void 0,void 0,(function*(){try{const i=yield o.Member.Lambda({request:"send password reset email",member_email:e.member_email,originatingURL:e.originatingURL,directory:e.directory,context:e.context});t.onResult(i)}catch(e){t.onFailure(`${e}`)}}))}}},2309:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ImageGallery=void 0;const n=i(5328),r=i(1372),o=i(6852),s=i(9699),a=i(7102),l=i(3061);class c extends r.field_edit_ctrl{data(){return this._pictures}has_data(){return this._pictures.length>0}update(){const e="https://dashboard.communitybox.co/img/uploaded/img_gallery_dflt2.jpeg";if(this._pictureElem)if(this._pictures.length>0){const t=(0,l.PictureLinkFrom)(this._pictures[this._currImgIdx]);t?(this._pictureElem.setAttribute("src",t),this._pictureElem.style.transform=`rotate(${this._pictures[this._currImgIdx].rotation}deg)`):this._pictureElem.setAttribute("src",e)}else this._pictureElem.setAttribute("src",e);this.updateImageGalleryBrowseButtons()}show_progress(e,t){this._upload_progress_meter&&this._upload_progress_label&&(this._upload_progress_meter.value=100*e,this._upload_progress_label.textContent=t)}registerFileUploadCallback(e){let t=this;e.addEventListener("change",(e=>{this._upload_progress_container&&this._img_frame&&(this._upload_progress_container.style.display="flex",this._img_frame.style.display="none"),(0,n.upload_image)(e.target.files[0],this._directory,((e,t)=>this.show_progress(e,t))).then((e=>{t._pictures.push((0,o.PictureDataFrom)(e)),t._currImgIdx=t._pictures.length-1,t.update(),this._upload_progress_container&&this._img_frame&&(this._upload_progress_container.style.display="none",this._img_frame.style.display="flex")})).catch((e=>{console.error(e)}))}))}updateImageGalleryBrowseButtons(){window.setTimeout((()=>{this._nextBtn&&this._prevBtn&&this._deleteBtn&&(this._pictures.length>0?(this._deleteBtn.style.visibility="visible",this._editingControls.forEach((e=>e.style.visibility="visible"))):(this._deleteBtn.style.visibility="hidden",this._editingControls.forEach((e=>e.style.visibility="hidden"))),this._pictures.length>1?(this._nextBtn.style.visibility="visible",this._prevBtn.style.visibility="visible"):(this._nextBtn.style.visibility="hidden",this._prevBtn.style.visibility="hidden"))}))}viewHtmlElem(){const e=document.createElement("div");return e.innerHTML=`\n ${this.leftOfViewRow()}\n
\n ${this._field.detailLabel?`
${this._field.detailLabel}
`:""}\n
\n
\n \n \n
\n \n
\n
\n ${this.rightOfViewRow()}\n `,this._pictureElem=e.querySelector("img"),this._prevBtn=e.querySelector("button[prev-img]"),this._nextBtn=e.querySelector("button[next-img]"),this._prevBtn.addEventListener("click",(()=>{this._currImgIdx>0?this._currImgIdx--:this._pictures.length>0&&(this._currImgIdx=this._pictures.length-1),this.update()})),this._nextBtn.addEventListener("click",(()=>{this._currImgIdx{const e=this._pictures[this._currImgIdx];this._pictures=this._pictures.filter((t=>t!==e)),this._currImgIdx=0,this.update()}),{design:`${e}; padding-left: 8px; padding-top: 4px;`,svg:"bin"})}buildRotationButton(e,t,i){return a.button("","",(()=>{this._pictures[this._currImgIdx].rotation=(0,s.Degrees)((this._pictures[this._currImgIdx].rotation+t)%360),this.update()}),{design:`${e}; padding-left: 8px; padding-top: 4px;`,svg:i})}buildRotateLeftButton(e){return this.buildRotationButton(e,270,"rotateLeft")}buildRotateRightButton(e){return this.buildRotationButton(e,90,"rotateRight")}buildUploadPictureButton(e,t){return a.button("","",(()=>{t.click()}),{design:`${e}; padding-top: 5px;`,svg:"upload"})}swapToPrev(){this._currImgIdx>0?this._currImgIdx--:this._pictures.length>0&&(this._currImgIdx=this._pictures.length-1),this.update()}swapToNext(){this._currImgIdx{}),"",{type:"file"});this.registerFileUploadCallback(t),this._pictureElem=a.img("","https://dashboard.communitybox.co/img/uploaded/img_gallery_test.jpeg",{design:"width: auto;height: 100%;"}),this._nextBtn=a.button("","",(()=>{this.swapToNext()}),{design:"border: none; font-size: 27px; color: #aeb4b9; background: transparent; position: absolute; right: 50px; top: 47%; cursor: pointer;",svg:"next"}),this._prevBtn=a.button("","",(()=>{this.swapToPrev()}),{design:"border: none; font-size: 27px; color: #aeb4b9; background: transparent; position: absolute; left: 50px; top: 47%; cursor: pointer;",svg:"previous"}),this._deleteBtn=this.buildDeleteButton(e);const i=this.buildRotateRightButton(e),n=this.buildRotateLeftButton(e);return this._editingControls=[i,n],this._img_frame=a.div("image-frame",[a.div("image-gallery-overlay",[this.buildUploadPictureButton(e,t),this._deleteBtn,i,n],{design:"z-index: 1; row-gap: 7px; position: absolute; top: 0px; right: 0px; display: flex; box-sizing: border-box; flex-direction: column;"}),this._nextBtn,this._prevBtn,this._pictureElem,t],{design:"width:100%; height: 255px; margin-top: 10px; display: flex; justify-content: center; position: relative;"}),this._img_frame}buildPictureEditorProgressBar(){return this._upload_progress_label=a.elem("label"),this._upload_progress_label.textContent="Uploading",this._upload_progress_meter=a.progress(),this._upload_progress_container=a.div("flex col cntr vcntr upload-progress",[this._upload_progress_meter,this._upload_progress_label],{design:"width: 100%; height: 255px; display: none;"}),this._upload_progress_container}buildPictureEditorInnerFrame(){return a.div("inputcontent",[a.div("label",[],{text:this._field.label}),this.buildPictureEditorProgressBar(),this.buildPictureEditorEasel()])}buildPictureEditor(){return a.div("",[this.buildPictureEditorInnerFrame()],{classes:["cbeb-entry-input-label"]})}inputHtmlElem(){const e=this.buildPictureEditor();return this.update(),e}constructor(e,t,i){if(super(e,t),this._entry=e,this._field=t,this._directory=i,this._pictures=[],this._currImgIdx=0,this._editingControls=[],e.hasValueForField(t.key)){const i=e.getValueOf(t.key);if(i instanceof Array)this._pictures=i.map((e=>(0,o.PictureDataFrom)(e)));else{const e=i.length>0?i.split(","):[];this._pictures=e.map((e=>(0,o.PictureDataFrom)(e)))}}}}t.ImageGallery=c},3061:(e,t)=>{"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.PictureLinkFrom=void 0,function(e){e[e.uploaded=0]="uploaded",e[e.linked=1]="linked",e[e.drive=2]="drive",e[e.grav=3]="grav"}(i||(i={})),t.PictureLinkFrom=function(e,t){if(void 0===e.key)return t;switch(-1!==(n=e.key).indexOf("drive.google.com")?i.drive:-1!==n.indexOf("gravatar")?i.grav:n.length>8&&"https://"===n.substr(0,8)?i.linked:i.uploaded){case i.linked:return e.key.split("?")[0];case i.uploaded:return`https://dashboard.communitybox.co/img/uploaded/${e.key}.jpeg`;case i.drive:return function(e){const t=new RegExp("[\\/=]([_-\\w]{31,})[\\/]?").exec(e);return t&&t.length>1?`https://drive.google.com/uc?export=view&id=${t[1]}`:""}(e.key);case i.grav:return function(e,t){return`${e.split("?")[0].split(",")[0]}?s=150${void 0!==t?`&d=${encodeURIComponent(t)}`:""}`}(e.key,t)}var n}},5328:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.upload_image=void 0;const n=i(2702),r=i(2131),o=i(205),s=i(9984);function a(e){return new n.Promise(((t,i)=>{const n=new XMLHttpRequest;n.open("post","https://api.communitybox.co/upload/file",!0),n.upload.addEventListener("progress",(function(e){o.UpdateMeter(e.loaded/e.total)})),n.onload=function(){4===n.readyState&&200===n.status?t(JSON.parse(n.responseText)):i(n.responseText)},n.send(JSON.stringify({box:e.directory,profile:"temp",filename:e.filename,part:e.partIdx,total_parts:e.nbParts,key:e.uploadKey,b64_data:e.b64data}))}))}t.upload_image=function(e,t,i){return new n.Promise(((o,l)=>{(function(e,t,i){return new n.Promise(((o,s)=>{const l=(0,r.uuidv4)();var c;(c=e,new n.Promise(((e,t)=>{const i=new FileReader;i.readAsDataURL(c),i.onload=()=>{e(i.result.slice(i.result.indexOf("base64,")+7))},i.onerror=e=>{t(e)}}))).then((e=>{const s=131072,c=Math.ceil(e.length/s),u=(0,r.uuidv4)(),h=[];for(let n=0;n(i(n/c),a({b64data:r,filename:l,uploadKey:u,partIdx:n,nbParts:c,directory:t}))))}var d;(d=h,d.reduce(((e,t)=>e.then((e=>t().then(Array.prototype.concat.bind(e))))),n.Promise.resolve([]))).then((()=>{const n=e.length-(c-1)*s;a({b64data:e.slice(e.length-n,e.length),filename:l,uploadKey:u,partIdx:c-1,nbParts:c,directory:t}).then((e=>{i(1),o(e)}))}))}))}))})(e,t,(e=>i(.71*e,"uploading..."))).then((e=>{const t=e.bucket_path.split("/").filter(((e,t)=>t>0)).join("/");var r;i(.71,"processing..."),(r=t,new n.Promise(((e,t)=>{(0,s.PostRequest)({stage:"cfapi",url:"/resize/image",payload:{image_key:r},callback:{onResult:t=>e(t),onFailure:e=>{console.error(e),t(e)}}})}))).then((e=>{i(1,""),o(e.resized_image_key)})).catch((e=>{l(e)}))})).catch((e=>{l(e)}))}))}},7716:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InvitationLookupDlgBox=void 0;const n=i(1370),r=i(3189),o=i(6578),s=i(9984);t.InvitationLookupDlgBox=class{constructor(e,t,i,r){this._invariants=t,this._dlgElem=document.querySelector("[cbeb-invitation-lookup-modal]"),this._lookupMsgElem=this._dlgElem.querySelector("[cbeb-lookup-msg]"),this._okBtnElem=this._dlgElem.querySelector("[okay-button]"),this._containerElem=this._dlgElem.querySelector("[cbeb-signup-container]"),this._gdprLabelElem=this._dlgElem.querySelector("label"),this._gdprElem=this._dlgElem.querySelector("[cbeb-gdpr-optin]"),this._pwordElem=this._dlgElem.querySelector("[cbeb-pword-input] input"),this._inviteEmailElem=this._dlgElem.querySelector("[invite-email]"),this._signingUpElem=this._dlgElem.querySelector("[cbeb-signing-up]"),this._cachedMemberKey="",this._cachedInvitationToken="",n.DialogBoxMgr.registerDialogBox(this._dlgElem),this._containerElem.style.visibility="hidden",this._signingUpElem.style.display="none",this._gdprLabelElem.textContent=e.GetGDPROptinMsg(),this._pwordElem.addEventListener("input",(e=>{this._pwordElem.value.length>0?(this._okBtnElem.removeAttribute("disabled"),this._okBtnElem.style.backgroundColor="#1abc9c"):(this._okBtnElem.removeAttribute("disabled"),this._okBtnElem.style.backgroundColor="#dddddd")})),this._okBtnElem.addEventListener("click",(()=>{this.onOK(i,r)}))}Show(e,t){this._cachedMemberKey=e.memberKey,this._cachedInvitationToken=e.invitationToken,n.DialogBoxMgr.show(this._dlgElem),r.Styling.applyDialogTitleStyleTo({dlgElem:this._dlgElem,withConfig:t}),(0,s.PostRequest)({url:"https://api.communitybox.co/verify/invitation",payload:{memberKey:e.memberKey,invitationToken:e.invitationToken},callback:{onResult:e=>{this._inviteEmailElem.textContent=e.memberEmail,this._lookupMsgElem.style.display="none",this._containerElem.style.visibility="visible"},onFailure:function(e){console.error(e)}}})}onOK(e,t){e((()=>{this._containerElem.style.display="none",this._signingUpElem.style.display="flex",n.DialogBoxMgr.show(this._dlgElem),(0,s.PostRequest)({url:"https://api.communitybox.co/member/accept/invitation",payload:{memberKey:this._cachedMemberKey,invitationToken:this._cachedInvitationToken,gdprOptin:null!==document.querySelector("[cbeb-gdpr-optin]:checked"),pword:this._pwordElem.value},callback:{onResult:e=>{o.AuthCache.cacheAuthLocally({member:this._cachedMemberKey,token:e.authToken}),t(this._invariants)},onFailure:function(e){console.error(e)}}})}))}}},8543:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.layout_renderer_generic=t.layout_renderer=void 0;const n=i(3061),r=i(7304),o=i(9725),s=i(2725),a=i(6852),l=i(7102),c=i(3734),u=i(9882),h=String.fromCharCode(8212);class d{}t.layout_renderer=d,t.layout_renderer_generic=class extends d{build_spacer(e){const t=document.createElement("div");return t.style.height=`${e}px`,t.style.flexShrink="0",t}export_city_location(e){const t=e.formatted_address.split(",").map((e=>e.trim()));return t.length>2?t[t.length-3]:s.default_format(e.formatted_address)}export_full_location(e){return e.formatted_address}translate_timestamp_to(e){const t=Number(e),i=new Date(t);return`${i.getMonth()+1}.${i.getDate()}`}translated_field_value(e,t){if("image"===t.translator)return this.translate_image_value((0,a.PictureDataFrom)(e));if(void 0===e)return"";switch(t.translator){case"loc-city":return this.export_city_location(e);case"loc-full":return this.export_full_location(e);case"timestamp_mm.dd":return this.translate_timestamp_to(e);default:return e}}overviewLocationFrom(e,t){if(void 0===e)return"";if(-1===e.indexOf(","))return e;switch(t.overviewLocationDisplay){case"default":return s.default_format(e);case"street only":return s.street_only(e);case"city & state":return s.city_and_state(e);case"city only":return s.city_only(e);case"full":return e}}translate_image_value(e){const t="https://dashboard.communitybox.co/img/uploaded/"+this._config.defaultProfilePictureKey+".jpeg";return void 0!==e&&void 0!==e.key&&e.key.length>0&&-1===e.key.indexOf("gravatar")?(0,n.PictureLinkFrom)(e,t):t}remove_protocol_from(e){return-1!==(e=e.trim()).indexOf("https://")?e.slice(8,e.length):-1!==e.indexOf("http://")?e.slice(7,e.length):e}build_multi_paragraph_field(e,t,i){const n=document.createElement("div"),r=e.split("\n").filter((e=>e.length>0));for(const[e,o]of r.entries()){const s=this.build_field({value:o,pattern:t,is_tag:!1,profile:i});s&&(n.appendChild(s),e{this._activate_tag_filter_fun(s)})),void 0!==e.pattern.link){const t=document.createElement("a");if(t.target="_blank",e.pattern.link.startsWith("field:")){const i=e.pattern.link.slice(6,e.pattern.link.length),n=e.profile.getValueOf(i);t.href=n||"",t.style.textDecoration="none"}else t.href=e.pattern.link.replace(/value_goes_here/gi,this.checked_link(null!==(r=e.value)&&void 0!==r?r:""));return t.appendChild(o),t}return o}build_label_elem(e){const t=document.createElement("div");return t.setAttribute("style",e.design),t.textContent=e.html.replace(/value_goes_here/gi,e.label),t}properInstagramUrlFrom(e){const t="instagram",i=e.replace("@","");return-1===e.indexOf(t)?`http://www.${t}.com/${i}`:null===e.match(/http/)?`http://${i}`:e}properSocMedUrlFrom(e,t){return-1===e.indexOf(t)?`http://www.${t}.com/${e}`:null===e.match(/http/)?`http://${e}`:e}properLinkedInUrlFrom(e){return-1===e.indexOf("linkedin")?`http://www.linkedin.com/in/${e}`:null===e.match(/http/)?`http://${e}`:e}checked_link(e){return-1!==(e=e.trim()).indexOf("https://")||-1!==e.indexOf("http://")||-1!==e.indexOf("mailto:")?e:`https://${e}`}format_link(e,t){switch(t){case"slack":case"website":return this.checked_link(e);case"linkedin":return this.properLinkedInUrlFrom(e);case"instagram":return this.properInstagramUrlFrom(e);default:return this.properSocMedUrlFrom(e,t)}}is_social_media_field(e){switch(e.ctrlType){case"linkedin-input":return"linkedin";case"twitter-input":return"twitter";case"facebook-input":return"facebook";case"instagram-input":return"instagram";default:return}}build_social_media_elem(e,t,i){const n=document.createElement("div");n.setAttribute("my_div",""),n.setAttribute("flex",""),n.setAttribute("row",""),n.setAttribute("wrap","");const r=e.made_up_of.map((n=>{const r=e.meta&&e.meta[n]?e.meta[n]:this.is_social_media_field(i.getField(n));if(void 0===r)return;const o=t.getValueOf(n);if(void 0===o||0===o.trim().length)return;const s=document.createElement("i");switch(r){case"facebook":case"twitter":case"youtube":case"vimeo":case"linkedin":case"instagram":case"soundcloud":case"pinterest":s.classList.add("fab",`fa-${r}`);break;case"website":s.classList.add("fas","fa-link");break;case"slack":s.classList.add("fab","fa-slack-hash")}const a=document.createElement("a");return a.href=this.format_link(o,r),a.target="_blank",a.setAttribute("style",e.design),a.appendChild(s),a})).filter((e=>void 0!==e));for(const e of r)n.appendChild(e);return n}mapsUrlFrom(e){return void 0!==e.place_URL?e.place_URL:`https://www.google.com/maps/search/?api=1&query="${e.formatted_address}"&query_place_id=${e.placeID}`}build_email_elem(e,t){if(0===e.made_up_of.length)return;const i=t.getValueOf(e.made_up_of[0]);if(void 0===i||0===i.length)return;const n=document.createElement("a");return n.href=`mailto:${i}`,n.textContent=e.html.replace(/value_goes_here/gi,null!=i?i:""),n.setAttribute("style",e.design.replace(/value_goes_here/gi,null!=i?i:"")),n}build_location_elem(e,t){let i=t.getValueOf(e.made_up_of[0]);if(void 0===i)return;if("string"==typeof i)try{i=JSON.parse(i)}catch(e){return void console.error(e)}let n="";n="loc-full"===e.translator?i.formatted_address:this.overviewLocationFrom(i.formatted_address,this._config);const r=document.createElement("div");r.setAttribute("style",e.design.replace(/value_goes_here/gi,null!=n?n:""));const o=document.createElement("span");switch(o.textContent=e.html.replace(/value_goes_here/gi,null!=n?n:""),void 0===e.viewmap_separator&&(o.textContent+=` ${h} `),e.viewmap_separator){case"none":r.appendChild(o);break;case"loc_is_link":{const t=document.createElement("a");t.href=this.mapsUrlFrom(i),t.textContent=e.html.replace(/value_goes_here/gi,null!=n?n:""),t.target="_blank",t.style.color=this._config.fgColourOf("link"),r.appendChild(t)}break;default:{r.appendChild(o);const e=document.createElement("a");e.href=this.mapsUrlFrom(i),e.textContent="view on map",e.target="_blank",e.style.color=this._config.fgColourOf("link"),r.appendChild(e)}}return r}build_tag_elem(e,t){const i=document.createElement("div");if(i.setAttribute("flex",""),i.setAttribute("row",""),i.setAttribute("vcntr",""),void 0!==t.meta&&e in t.meta){const n=document.createElement("img");n.src=`https://cdn.communitybox.co/images/${t.meta[e]}`,n.style.objectFit="contain",n.style.width=t.dimensions?`${t.dimensions.width}px`:"25px",n.style.height=t.dimensions?`${t.dimensions.height}px`:"20px",n.style.marginRight="7px",i.appendChild(n)}{const n=document.createElement("div"),r=t.html.replace(/value_goes_here/gi,(()=>null!=e?e:""));n.setAttribute("style",t.design.replace(/value_goes_here/gi,null!=e?e:"")),n.addEventListener("click",(()=>{this._activate_tag_filter_fun(r)})),n.textContent=r,i.appendChild(n)}return i}build_tag_collection_elem(e,t){const i=e.made_up_of.reduce(((e,i)=>{const n=t.getValueOf(i);return void 0!==n?[...e,..."string"==typeof n?n.split(","):n]:e}),[]).filter((e=>e.length>0));if(0===i.length)return;const n=i.map((t=>this.build_tag_elem(t,e))),r=document.createElement("div");r.setAttribute("tag-collection",""),r.setAttribute("flex",""),r.style.flexWrap="wrap","column"===e.direction||"column-center"===e.direction?r.setAttribute("col",""):r.setAttribute("row",""),"column-center"===e.direction&&(r.style.alignItems="center");for(const e of n)r.appendChild(e);return r}extract_video_identifer(e){if(void 0!==e){if(-1!==e.indexOf("youtube")&&-1!==e.indexOf("playlist?list=")){const t=e.split("list=");return{player:"youtube",key:`videoseries?list=${t[t.length-1]}`}}if(e.startsWith("https://youtu.be/")){const t=e.split("/");return{player:"youtube",key:t[t.length-1]}}if(e.startsWith("https://vimeo.com")){const t=e.split("/");return{player:"vimeo",key:t[t.length-1]}}}}player_src_for(e){switch(e.player){case"youtube":return`https://www.youtube.com/embed/${e.key}`;case"vimeo":return`https://player.vimeo.com/video/${e.key}`}}build_video_elem(e,t){if(0===e.made_up_of.length)return;const i=this.extract_video_identifer(t.getValueOf(e.made_up_of[0]));if(void 0===i||0===i.key.length)return;const n=document.createElement("iframe");return n.src=this.player_src_for(i),n.allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",n.allowFullscreen=!0,n.setAttribute("style",e.design),n}get_override_value(e,t){const i=t.getValueOf(e);return void 0===i?"":"string"==typeof i?i:i instanceof Array?i.join(","):""}display_value_for(e,t){return void 0!==e.override&&-1!==this.get_override_value(e.override.if,t).indexOf(e.override.contains)?e.override.value:e.made_up_of.reduce(((i,n)=>{const r=this.translated_field_value(t.getValueOf(n),e);return void 0===r||0===r.length?i:[i,this.translated_field_value(t.getValueOf(n),e)].join(" ").trim()}),"")}crop(e,t){if(void 0!==t.max_words){const i=e.split(" ");if(i.length>t.max_words)return`${i.slice(0,t.max_words).join(" ")}...`}return e}build_regular_pattern_elem(e,t,i){switch(e.special){default:{const i=this.crop(this.display_value_for(e,t),e);return void 0===i||0===i.length?void 0:!0===e.respect_newline?this.build_multi_paragraph_field(i,e,t):this.build_field({value:i,pattern:e,is_tag:!1,profile:t})}case"socmed":return this.build_social_media_elem(e,t,i);case"tags":return this.build_tag_collection_elem(e,t);case"location":return this.build_location_elem(e,t);case"email":return this.build_email_elem(e,t);case"video":return this.build_video_elem(e,t)}}build_img_elem(e,t){const i=document.createElement("img");i.src=e.origin,i.setAttribute("style",e.design);const n=document.createElement("a");n.target="_blank";let r=t.getValueOf(e.made_up_of);return r&&-1!==r.indexOf("@")&&(r=`mailto:${r}`),n.href=r||"",n.style.textDecoration="none",n.appendChild(i),n}buildBannerElem(e){const t=e.getValueOf("feature_level");return void 0!==t&&"string"==typeof t&&"1"===t?l.div("cornerbanner",[l.p("mt0 mb0",this._config.featuredBannerText)],{design:"z-index: 4; position: absolute; top: 46px; left: -63px; background-color: #D62281; display: flex; justify-content: center; align-items: center; transform: rotate(-45deg); box-sizing: border-box; padding: 10px 100px 10px 100px; color: white; box-shadow: 7px 7px 5px 0px rgb(0 0 0 / 16%);"}):void 0}build_picture_elem(e,t){const i=t.getValueOf(e.made_up_of),r=(0,n.PictureLinkFrom)((0,a.PictureDataFrom)(i||e.made_up_of));if(void 0===r)return;const o=document.createElement("img");return o.src=r,o.setAttribute("style",e.design),l.div("flex col w100p",[this.buildBannerElem(t),o],{design:"position: relative; overflow: hidden;"})}build_connect_btn_elem(e,t){const i=document.createElement("button");return i.setAttribute("style",e.design),i.textContent=e.button_label,i.addEventListener("click",(()=>{(new r.ConnectionDialogBox).showForEntry(t,this._template,this._config,t.box)})),i}build_readmore_btn_elem(e,t){const i=document.createElement("button");return i.setAttribute("style",e.design),i.textContent=e.label,i.addEventListener("click",(()=>{this._activate_popup_fun(t.key)})),i}build_share_btn_elem(e,t){return l.button("",e.button_label,(()=>{(0,c.handle_sharing_req)(t,this._config,this._template)}),{design:e.design})}build_link_btn_elem(e,t){const i=t.getValueOf(e.made_up_of);if(void 0===i||0===i.length)return;const n=t.getValueOf(e.made_up_of),r=-1!==n.indexOf("@")?`mailto:${n}`:n;return l.anchor("",e.button_label,r,{design:e.design,open_in_new_tab:"yes"})}build_directions_btn_elem(e,t){const i=t.getValueOf(e.made_up_of);if(void 0===i)return;const n=document.createElement("button");return n.setAttribute("style",e.design),n.textContent=e.button_label,n.addEventListener("click",(()=>{const e=`https://www.google.co.uk/maps/dir//${i.lat},${i.lng}`;window.location.href=e})),n}add_desktop_gallery_elem_to(e,t,i,n,r){let o=0;for(const s of(0,u.take)(t,i)){const a=document.createElement("img");a.src=s,a.style.objectFit="cover";const l=document.createElement("div");if(l.style.display="flex",l.style.flexDirection="row",l.style.justifyContent="center",l.style.height="inherit",void 0===r.dimensions||"variable"===r.dimensions?l.style.flexBasis=`${Math.floor(99/(i/n))}%`:(l.style.width=`${r.dimensions}px`,l.style.height=`${r.dimensions}px`,o>0&&(l.style.marginLeft="10px")),"yes"===r.arrows){a.style.width="85%",a.style.height="inherit";const e=this.build_img_gallery_arrow_ctrls(a,t);l.appendChild(e.left),l.appendChild(a),l.appendChild(e.right)}else a.style.width="100%",l.appendChild(a);e.appendChild(l),o+=1}}build_img_gallery_arrow_ctrls(e,t){let i=0;const n=document.createElement("div"),r=document.createElement("div");for(const e of[n,r])e.style.display="flex",e.style.justifyContent="center",e.style.alignItems="center";const o=document.createElement("button");o.textContent="<",o.addEventListener("click",(function(){0===i?i=t.length-1:i-=1,e.src=t[i]})),n.appendChild(o);const s=document.createElement("button");s.textContent=">",s.addEventListener("click",(function(){i=(i+1)%t.length,e.src=t[i]})),r.appendChild(s);for(const e of[o,s])e.style.fontSize="33px",e.style.height="35px",e.style.backgroundColor="transparent",e.style.color="#555",e.style.border="none";return{left:n,right:r}}add_mobile_gallery_elem_to(e,t){const i=document.createElement("img");i.src=t[0],i.style.objectFit="cover",i.style.width="85%",i.style.height="210px";const n=document.createElement("div");n.style.display="flex",n.style.flexDirection="row",n.style.justifyContent="center";const r=this.build_img_gallery_arrow_ctrls(i,t);n.appendChild(r.left),n.appendChild(i),n.appendChild(r.right),e.appendChild(n)}build_gallery_elem(e,t){const i=t.getValueOf(e.field);if(void 0===i)return;const r=(i instanceof Array?i:i.split(",").map((e=>(0,a.PictureDataFrom)(e)))).filter((e=>void 0!==e.key&&e.key.length>0)).map((e=>(0,n.PictureLinkFrom)(e))).filter((e=>"string"==typeof e));if(0===r.length)return;const s=document.createElement("div");return s.setAttribute("style",e.design),!0===(0,o.mobile_aspect)()?this.add_mobile_gallery_elem_to(s,r):this.add_desktop_gallery_elem_to(s,r,e.nb_images_on_display||3,e.nb_rows||1,e),s}build_call_btn_elem(e,t){const i=t.getValueOf(e.made_up_of);if(void 0===i)return;const n=document.createElement("button");return n.setAttribute("style",e.design),n.textContent="value_goes_here"===e.button_label?i:e.button_label,n.addEventListener("click",(()=>{const e=`tel:${i}`;window.location.href=e})),n}build_pattern_elem(e,t,i){switch(e.type){case"connect-btn":return this.build_connect_btn_elem(e,t);case"directions_btn":return this.build_directions_btn_elem(e,t);case"link_btn":return this.build_link_btn_elem(e,t);case"share_btn":return this.build_share_btn_elem(e,t);case"call_btn":return this.build_call_btn_elem(e,t);case"gallery":return this.build_gallery_elem(e,t);case"image":return this.build_img_elem(e,t);case"picture":return this.build_picture_elem(e,t);case"readmore-btn":return this.build_readmore_btn_elem(e,t);case"default":return this.build_regular_pattern_elem(e,t,i)}}build_top_row(){if(void 0!==this._layout.top_row){const e=document.createElement("div");return e.innerHTML=this._layout.top_row.html,e.setAttribute("style",this._layout.top_row.design),e}}build(e){const t=document.createElement("div");t.setAttribute("style",this._layout.frame.design),t.innerHTML=this._layout.frame.html;for(const i in this._layout.area_map){const n=t.querySelector(`[area='${i}']`);if(null!==n)for(const t of this._layout.area_map[i])if(t in this._layout.patterns){const i=this._layout.patterns[t],r=this.build_pattern_elem(i,e.profile,e.template);r&&(i.top_margin>0&&n.appendChild(this.build_spacer(i.top_margin)),"default"===i.type&&void 0!==i.label&&void 0!==this._layout.label&&n.appendChild(this.build_label_elem({label:i.label,design:this._layout.label.design,html:this._layout.label.html})),"default"===i.type&&!0===i.activate_popup&&r.addEventListener("click",(()=>{this._activate_popup_fun(e.profile.key)})),n.appendChild(r))}else console.error(`No pattern for area component ${t} in area ${i}`);else console.error(`Could not find element matching selector [area='${i}']`)}return t}constructor(e,t,i,n,r,o){super(),this._config=e,this._layout=t,this._community=i,this._template=n,this._activate_tag_filter_fun=r,this._activate_popup_fun=o}}},4787:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.layout_builder=void 0;const n=i(3291),r=i(8543);class o extends n.OverviewBuilder{constructor(e,t,i,n,o,s){super(),this._config=e,this.layout=t,this._template=i,this._community=n,this._activate_tag_filter_fun=o,this._activate_popup=s,this._layout=new r.layout_renderer_generic(e,t,n,i,o,s)}buildOverviewHtml(e,t){return this._layout.build({profile:e,template:t})}build_top_row(){return this._layout.build_top_row()}getProfileFlexBasis(){return 100}}t.layout_builder=o},9821:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ListOverviewBuilder=void 0;const n=i(3291),r=i(9786),o=i(3061),s=i(6852);class a extends n.OverviewBuilder{buildOverviewPhotoHtml(e,t,i){const n="https://dashboard.communitybox.co/img/uploaded/"+i.defaultProfilePictureKey+".jpeg",a="circle"===i.profilePictureAspect?"50%":"0",l=t.getRuleForType(r.TemplateRuleType.Picture),c=l.length>0?e.getValueOf(l[0].key):void 0;return`\n
0&&-1===c.indexOf("gravatar")?(0,o.PictureLinkFrom)((0,s.PictureDataFrom)(c),n):n}');\n border-radius: ${a};\n "\n show-overview-on-click\n entryKey="${e.key}" >\n
`}buildDisplayNameHtml(e,t,i){const n=`\n cursor: pointer;\n font-weight: bold;\n color: #${i.fgColourOf("profile_name")};\n line-height: 1em;\n `;return[`
`,e.getDisplayNameForTemplate(t),"
"].join("")}buildOverviewOtherNameHtml(e,t,i){var n=t.getRuleForType(r.TemplateRuleType.OtherTitle),o="";return n.forEach((t=>{e.hasValueForField(t.key)&&(o+=e.getValueOf(t.key)+t.interval)})),i.fgColourOf("subtitle"),""!==o?['
',o,"
"].join(""):""}getRuleValue(e,t){return t&&e.hasValueForField(t)?e.getValueOf(t):void 0}extractCategoryArrayFrom(e){if(void 0!==e)return"string"==typeof e&&e.length>0?e.split(","):e}isCategoryArray(e){return void 0!==e}buildOverviewCategoriesHtml(e,t,i){const n=t.getRuleForType(r.TemplateRuleType.Category),o=n&&n.length>0?n.map((t=>this.getRuleValue(e,t.key))).map((e=>this.extractCategoryArrayFrom(e))).filter((e=>this.isCategoryArray(e))).reduce(((e,t)=>e.concat(t)),[]):void 0;let s=this.extractCategoryArrayFrom(o);return s?(s=s.filter((function(e,t,i){return i.indexOf(e)===t})),['
',s.filter((e=>""!==e)).map((function(e){return[`
",e,"
"].join("")})).join(""),"
"].join("")):""}addOverviewBioSnippet(e,t,i){if(null===t)return"";let n="";if(t.length<100)n=t;else{for(var r=0,o=0;o<100;o++)" "===t[o]&&(r=o);n=t.substring(0,r)+"..."}const s=`\n display: flex;\n justify-content: flex-start;\n text-decoration: underline;\n cursor: pointer;\n font-size: 12px;\n margin-top: 17px;\n color:#${i.fgColourOf("social_media")};\n `;return["
",'
',n,"
",`
read more
","
"].join("")}buildOverviewParagraphHtml(e,t,i){const n=t.getRuleForType(r.TemplateRuleType.Paragraph),o=n&&n.length>0?this.getRuleValue(e,n[0].key):void 0;return o?this.addOverviewBioSnippet(e,o,i):""}mapsUrlFrom(e){return void 0!==e.place_URL?e.place_URL:`https://www.google.com/maps/search/?api=1&query="${e.formatted_address}"&query_place_id=${e.placeID}`}defaultLocDisp(e){var t=e.split(","),i=(t.length>1?t[t.length-2]:t[t.length-1]).split(" "),n=[];return i.forEach((e=>{!1===/\b[A-Z0-9]+?\b/.test(e)&&n.push(e)})),""===n.join(" ")&&t.length>2&&(i=t[t.length-3].split(" ")).forEach((function(e){!1===/\b[A-Z0-9]+?\b/.test(e)&&n.push(e)})),n.join(" ")}streetOnlyLocDisp(e){const t=e.split(",");return t.length>0?t[0]:e}cityAndStateLocDisp(e){const t=e.split(/[,\ ]/g).map((e=>e.trim())).filter((e=>e.length>0));let i=0;for(let e=0;e0?`${t[i-1]}, ${t[i]}`:this.defaultLocDisp(e)}overviewLocationFrom(e,t){if(void 0===e)return"";if(-1===e.indexOf(","))return e;switch(t.overviewLocationDisplay){case"default":return this.defaultLocDisp(e);case"street only":return this.streetOnlyLocDisp(e);case"city & state":return this.cityAndStateLocDisp(e)}}buildOverviewEmailHtml(e,t,i){const n=t.getAnyKeyWithInputType("email-input");if(void 0===n)return"";const r=e.getValueOf(n);return null==r||"string"!=typeof r||0===r.length?"":`
${r}
`}buildOverviewLocationHtml(e,t,i){const n=t.getRuleForType(r.TemplateRuleType.Location);let o=n&&n.length>0?this.getRuleValue(e,n[0].key):void 0;if("string"==typeof o)try{o=JSON.parse(o)}catch(e){o={formatted_address:o.trim(),lat:0,lng:0,place_URL:`https://www.google.com/maps/search/?api=1&query='${o.trim()}'`}}const s=`\n font-size: 16px;\n margin-top: 19px;\n margin-left: 17px;\n margin-right: 17px;\n color: #${i.fgColourOf("location")};\n `;return o?[`"].join(""):""}properSocMedUrlFrom(e,t){return-1===e.indexOf(t)?`http://www.${t}.com/${e}`:null===e.match(/http/)?`http://${e}`:e}properLinkedInUrlFrom(e){return-1===e.indexOf("linkedin")?`http://www.linkedin.com/in/${e}`:null===e.match(/http/)?`http://${e}`:e}getURLandGlyphForSocialMedia(e,t){switch(t.ctrlType){case"website-input":return{dstURL:"https://"+e.getValueOf(t.key),faGlyph:"fas fa-link"};case"twitter-input":return{dstURL:this.properSocMedUrlFrom(e.getValueOf(t.key),"twitter"),faGlyph:"fab fa-twitter"};case"linkedin-input":return{dstURL:this.properLinkedInUrlFrom(e.getValueOf(t.key)),faGlyph:"fab fa-linkedin-in"};case"facebook-input":return{dstURL:this.properSocMedUrlFrom(e.getValueOf(t.key),"facebook"),faGlyph:"fab fa-facebook-f"};case"instagram-input":return{dstURL:this.properSocMedUrlFrom(e.getValueOf(t.key),"instagram"),faGlyph:"fab fa-instagram"};case"pinterest-input":return{dstURL:this.properSocMedUrlFrom(e.getValueOf(t.key),"pinterest"),faGlyph:"fab fa-pinterest"}}return{dstURL:"",faGlyph:""}}addSocialMediaSummary(e,t,i){let n='
';return t.forEach((t=>{const r=this.getURLandGlyphForSocialMedia(e,t);n=n+''})),n+="
",n}buildOverviewSocialMediaHtml(e,t,i){let n=t.getRuleForType(r.TemplateRuleType.SocialMedia).map((e=>t.getField(e.key))).filter((e=>void 0!==e)).filter((e=>e.isSocialMediaField())).filter((t=>e.hasValueForField(t.key)));return this.addSocialMediaSummary(e,n,i)}hasEmailAddress(e,t){const i=t.getAnyKeyWithInputType("email-input");if(void 0===i)return!1;const n=e.getValueOf(i);return null!=n&&"string"==typeof n&&n.length>0}buildOverviewConnectHtml(e,t,i){return i.matchMakingEnabled&&this.hasEmailAddress(e,t)||i.matchMakingEnabled&&"bespoke"===i.matchMakeDestinationChoice?`
':""}buildOverviewHtml(e,t,i){const n=[t.hasImageField()?this.buildOverviewPhotoHtml(e,t,i):"",'
',this.buildDisplayNameHtml(e,t,i),this.buildOverviewOtherNameHtml(e,t,i),"
",this.buildOverviewCategoriesHtml(e,t,i),this.buildOverviewParagraphHtml(e,t,i),this.buildOverviewEmailHtml(e,t,i),this.buildOverviewLocationHtml(e,t,i),this.buildOverviewSocialMediaHtml(e,t,i),this.buildOverviewConnectHtml(e,t,i)].join(""),r=document.createElement("div");return r.style.display="flex",r.style.flexDirection="row",r.style.flexBasis="100%",r.style.paddingLeft="20px",r.style.paddingRight="20px",r.setAttribute("id","emb-"+e.key),r.innerHTML=n,r}build_top_row(){}getProfileFlexBasis(e){return 100}}t.ListOverviewBuilder=a},2725:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.city_only=t.city_and_state=t.street_only=t.default_format=void 0;const n=i(8945);function r(e){var t=e.split(","),i=(t.length>1?t[t.length-2]:t[t.length-1]).split(" "),n=[];return i.forEach((e=>{!1===/\b[A-Z0-9]+?\b/.test(e)&&n.push(e)})),""===n.join(" ")&&t.length>2&&(i=t[t.length-3].split(" ")).forEach((function(e){!1===/\b[A-Z0-9]+?\b/.test(e)&&n.push(e)})),n.join(" ").trim()}function o(e){return e.split(" ").map((e=>"of"===e?e:e.slice(0,1).toUpperCase()+e.slice(1))).join(" ")}t.default_format=r,t.street_only=function(e){const t=e.split(",");return t.length>0?t[0]:e},t.city_and_state=function(e){const t=/^\b([A-Za-z\ ]+?)\b\s+([0-9]+)$/,i=(s=e,s.replace("WA, District of Columbia","Washington, DC")).split(",").map((e=>e.trim())).map((e=>{if(!0===t.test(e)){const t=e.split(/\s/);return t.pop(),t.join(" ")}return e})).filter((e=>e.length>0));var s;for(let e=i.length-1;e>=0;e--){const t=i[e].toLowerCase();if(t in n.state_dict)return`${i[e-1]}, ${n.state_dict[t].toUpperCase()}`;if(t in n.reverse_state_dict)return e>0?`${i[e-1]}, ${i[e]}`:o(n.reverse_state_dict[t])}return r(e)},t.city_only=function(e){const t=/^\b([A-Za-z\ ]+?)\b\s+([0-9]+)$/,i=e.split(",").map((e=>e.trim())).filter((e=>e.length>0));if("USA"!==(n=i)[n.length-1])return i.length>2?i[i.length-3]:i.length>0?function(e){return e.trim().split(" ").filter((e=>e!==e.toUpperCase()&&!1===/[0-9]/.test(e))).join(" ")}(i[0]):"";var n;let o=0;for(let e=0;e0?`${i[o-1]}`:r(e)}},6374:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LocationEditCtrl=void 0;const n=i(1372),r=i(8945),o=i(9651),s=i(7102);class a extends n.field_edit_ctrl{fillinLocation(e){this._mruPlace={formatted_address:e.formatted_address,placeID:e.place,place_URL:`https://maps.google.com/?q=${e.formatted_address.split(", ").join("+")}`,lat:e.lat,lng:e.lng}}geocoding_service(){return"undefined"!=typeof google&&"undefined"!=typeof g_bespoke_google_api_key&&void 0!==g_bespoke_google_api_key?"google":null!=this._invariants.documentState.mbk?"mapbox":"google"}init_autocomplete(e,t){"google"===this.geocoding_service()?this.use_google_for_autocomplete(e,t):this.use_mapbox_for_autocomplete(this._config)}replace_state_with_abbreviation(e){const t=e.split(","),i=[];for(const e of t){const t=e.toLowerCase().trim();t in r.state_dict?i.push(` ${r.state_dict[t].toUpperCase()}`):i.push(e)}return i.join(",")}use_mapbox_for_autocomplete(e){this._mpt_geocoder=new o({accessToken:this._invariants.documentState.mbk,types:"address,country,region,place,postcode,locality,neighborhood",placeholder:e.location_search_placeholder,mode:"mapbox.places-permanent",minLength:5}),this._mpt_geocoder.on("result",(e=>{const t=e.result.center[0],i=e.result.center[1];this.fillinLocation({formatted_address:this.replace_state_with_abbreviation(e.result.place_name),place:e.result.id,lat:i,lng:t})}))}post_dom_add(){if(this._mpt_geocoder){const e=`#for-field-${this._field.key}-${this._uuid}`;this._mpt_geocoder.addTo(e),this._mruPlace&&this._mruPlace.formatted_address&&(document.body.querySelector(e).querySelector(".mapboxgl-ctrl-geocoder--input").value=this._mruPlace.formatted_address)}}use_google_for_autocomplete(e,t){this._loc_elem=e.querySelector(`input[fieldKey="${t}"]`),this._autocompleteElem=new google.maps.places.Autocomplete(this._loc_elem,{fields:["geometry.location","place_id","formatted_address"]}),this._autocompleteElem.addListener("place_changed",(()=>{const e=this._autocompleteElem.getPlace();this.fillinLocation({formatted_address:e.formatted_address,place:e.place_id,lat:e.geometry?e.geometry.location.lat():void 0,lng:e.geometry?e.geometry.location.lng():void 0})}))}data(){return this._mruPlace?this._mruPlace:void 0}has_data(){return this._entry.hasValueForField(this._field.key)}labelHtml(e){return`
${e.label}${!0===e.required?" (required)":""}${!0===e.readonly?'  ':""}
`}viewHtmlElem(){let e=this._entry.getValueOf(this._field.key);if("string"==typeof e)try{e=JSON.parse(e)}catch(t){e=void 0}let t="";if("object"==typeof e&&e.hasOwnProperty("formatted_address")&&e.hasOwnProperty("place_URL")){const t=e.manual_full?e.manual_full.split("\n"):[e.formatted_address];return s.div(`field=${this._field.key}`,[s.div("",[s.div("",[this._field.detailLabel&&this._field.detailLabel.length>0?s.p("detail-label",this._field.detailLabel):s.i({class:"fas fa-map-marker-alt cbeb-detailleft"}),...t.map((e=>s.p("",e)))],{classes:["cbeb-entry-view","cbeb-center","cbeb-entry-viewfield-container"]})],{classes:["cbeb-entry-input-row-input"]})],{classes:["cbeb-entry-view-row"]})}t="";const i=document.createElement("div");return i.innerHTML="",i}inputHtmlElem(){var e="";if(this._entry.hasValueForField(this._field.key)){let t=this._entry.getValueOf(this._field.key);if("string"==typeof t)try{t=JSON.parse(t)}catch(e){t=void 0}"object"==typeof t&&(this._mruPlace={formatted_address:t.formatted_address,placeID:t.placeID,place_URL:t.place_URL,lat:t.lat,lng:t.lng},e=t.formatted_address)}const t=this.leftOfInputRow()+this.labelHtml(this._field)+`
`+("google"===this.geocoding_service()?`':"")+"
"+this.rightOfInputRow(),i=document.createElement("div");return i.innerHTML=t,this.init_autocomplete(i,this._field.key),i}constructor(e,t,i,n){super(e,t),this._entry=e,this._field=t,this._config=i,this._invariants=n,this._mpt_geocoder=void 0,this._uuid=(new Date).getTime().toString()}}t.LocationEditCtrl=a},1921:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.LoginDialogBox=void 0;const r=i(1370),o=i(3189),s=i(6578),a=i(3523),l=i(2673);t.LoginDialogBox=class{constructor(e,t,i,n){this._config=e,this._dlgElem=document.getElementById("cbeb-login-modal"),this._okBtnElem=document.getElementById("cbeb-login-dialog-ok-btn"),this._extraOkBtnElem=document.getElementById("cbeb-extra-logindlg-login-btn"),this._cancelBtnElem=document.getElementById("cbeb-login-dialog-cancel-btn"),this._extraCancelBtnElem=document.getElementById("cbeb-extra-logindlg-cancel-btn"),this._dlgBodyElem=document.getElementById("cbeb-login-field-container"),this._spinnerElem=document.getElementById("cbeb-login-spinner"),this._errorContainerElem=document.getElementById("cbeb-login-dlg-error-container"),this._errorMsgElem=document.getElementById("cbeb-login-dlg-error-msg"),this._pwordRowElem=this._dlgElem.querySelector("[pword-input-row]"),this._loginMsg=this._dlgElem.querySelector("[login-msg]"),this._signupPrompt=this._dlgElem.querySelector("[signup-prompt]"),this._callbacks={onLogin:()=>{},onFailure:()=>{}},r.DialogBoxMgr.registerDialogBox(this._dlgElem),o.Styling.applyAllStylesTo({rootElem:this._dlgElem,withConfig:this._config}),this._spinnerElem.style.display="none",this._errorContainerElem.style.display="none",this._okBtnElem.addEventListener("click",(()=>{this.OnOK(t,i,n)})),this._extraOkBtnElem.addEventListener("click",(()=>{this.OnOK(t,i,n)})),this._cancelBtnElem.addEventListener("click",(()=>{this._dlgElem.style.display="none"})),this._extraCancelBtnElem.addEventListener("click",(()=>{this._dlgElem.style.display="none"})),"login-only"===this._config.welcomeFlow&&(this._signupPrompt.style.display="none"),void 0===this._config.loginMsg?this._loginMsg.style.display="none":this._loginMsg.textContent=this._config.loginMsg,document.getElementById("cbeb-login-dlg-tryagain-btn").addEventListener("click",(()=>{this._dlgBodyElem.style.display="flex",this._errorContainerElem.style.display="none"}))}show(e,t,i,n){if(r.DialogBoxMgr.hideAll(),!1===this._config.login_type_allowed(i)){let e="";e="object"==typeof UserAccountApi?!0===UserAccountApi.isUserAuthenticated()?`registered login: ${(0,a.read_cookie)("logged_in_maybe")}`:"User not authenticated":"No UserAccountApi object",n.Show({onClose:()=>{},title:this._config.get_wording("auth-type-fail-dlg-title"),msg:`${this._config.get_wording("auth-type-fail-dlg-msg")} (${e} / auth type: ${i})`,btn_label:this._config.get_wording("auth-type-fail-dlg-btn")})}else!1===t.PromptForPword()&&(this._pwordRowElem.style.display="none"),this._dlgElem.style.display="block",this._dlgBodyElem.style.display="flex",this._errorContainerElem.style.display="none",this._spinnerElem.style.display="none",this._callbacks=e}CollectEmail(){return document.getElementById("cbeb-login-email").value}CollectPassword(){return document.getElementById("cbeb-login-password").value}HideButtons(){this._okBtnElem.style.visibility="hidden",this._cancelBtnElem.style.visibility="hidden"}ErrorForMissingEmail(){document.getElementById("cbeb-login-email-label").innerHTML="email address

- please provide a valid email

"}ErrorForMissingPassword(){document.getElementById("cbeb-login-password-label").innerHTML="password

- please provide a password

"}Spin(){this._dlgBodyElem.style.display="none",this._spinnerElem.style.display="block"}HideSpinner(){this._spinnerElem.style.display="none"}TryToLogin(e,t){return n(this,void 0,void 0,(function*(){try{const i=yield l.Member.Lambda({request:"login-with-email",email:e.email,password:e.password,directory:e.directory});t.onLogin({member:i.member,token:i.token})}catch(e){t.onFailure(`An error occurred: ${e}`)}}))}ProblemWithEmailField(){var e=this.CollectEmail();return 0===e.length||!1===/@/.test(e)}ProblemWithPasswordField(e){return 0===(e.PromptForPword()?this.CollectPassword():"___").length}ClearEmailError(){document.getElementById("cbeb-login-email-label").innerHTML="email address"}ClearPwError(){document.getElementById("cbeb-login-password-label").innerHTML="password"}OnOK(e,t,i){if(this.ProblemWithEmailField())return void this.ErrorForMissingEmail();if(this.ClearEmailError(),this.ProblemWithPasswordField(e))return void this.ErrorForMissingPassword();this.ClearPwError();const n=this.CollectEmail().toLowerCase(),o=e.PromptForPword()?this.CollectPassword():"___";this.HideButtons(),this.Spin(),this.TryToLogin({email:n.toLowerCase().trim(),password:o.trim(),directory:t,federated_auth:i},{onLogin:e=>{s.AuthCache.cacheAuthLocally(e),this.HideSpinner(),r.DialogBoxMgr.hideAll(),this._callbacks.onLogin(e)},onFailure:e=>{"unrecognised e-mail address"===e&&(e="Sorry, that email wasn't recognised."),this._spinnerElem.style.display="none",this._errorMsgElem.innerHTML="🤖 "+e,this._errorContainerElem.style.display="flex"}})}}},1459:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PlaceholderMap=t.MapboxMap=t.GoogleMap=t.MapBase=void 0;const n=i(7102),r=i(4932),o=i(9984),s=i(6158);function a(e){if(null!==e){const t=Math.floor(e.getBoundingClientRect().bottom);window.scrollBy({top:t,left:0,behavior:"smooth"})}}function l(e,t){const i={};for(const o of e){const e=o.getGeoDataForTemplate(t);for(const t of e)if(void 0!==t.lat&&void 0!==t.lng){const e=(n=t.lng,r=t.lat,`${Math.round(1e4*n)/1e4}-${Math.round(1e4*r)/1e4}`);e in i?i[e].profiles.push(o):i[e]={position:{lng:t.lng,lat:t.lat},profiles:[o]}}}var n,r;return i}class c{}t.MapBase=c,t.GoogleMap=class extends c{UploadTelemetry(){(0,o.PostRequest)({url:"/telemetry",stage:"cfapi",payload:{box:this._invariants.directory,origin:window.location.href,event:"google_maps_alloc"}})}UpdateMarkers(e){this._activeMapMarkerList=[];const t=l(e,this._invariants.template),i=new google.maps.LatLngBounds;Object.keys(t).forEach((e=>{const n=t[e],o=new google.maps.Marker({position:n.position,map:this._map});this._activeMapMarkerList.push(o),i.extend(n.position),o.addListener("click",(()=>{1===n.profiles.length?(0,r.handle_profile_click)(n.profiles[0],this._invariants):(r.ebFilterManager.onlyShowTheseEntries(n.profiles),(0,r.ebPresentBoxContentUI)(this._invariants))}))})),this._map.fitBounds(i)}ReloadWith(e){if("undefined"==typeof google)return;n.remove_all_child_elements_from(this._invariants.mapContainer);const t=n.div("cbeb-map",[],{key:"cbeb-map"});this._invariants.mapContainer.appendChild(t),this._invariants.config.grayscaleMap&&(t.style.filter="grayscale(100%)"),this.UploadTelemetry(),this._map=new google.maps.Map(t,{zoom:16,mapTypeId:"roadmap"}),this.UpdateMarkers(e)}constructor(e){super(),this._invariants=e,this._activeMapMarkerList=[]}},t.MapboxMap=class extends c{add_markers_to_map(e){e.forEach((e=>{if(void 0===this._map)return;let t,i;if(this._invariants.config.has_custom_pin_design){const r=e.profiles[0].get_all_tags(this._invariants.template);let o=this._invariants.config.pin_design_for(r);if(void 0===o){const n=this._invariants.config.pin_design_for(["_default_"]);n&&("colour"===n.type?i=new s.Marker({color:`#${n.value}`}).setLngLat([e.position.lng,e.position.lat]).addTo(this._map):(t=document.createElement("div"),t.setAttribute("style",`\nbackground-image: url('${n.value}');\nbackground-size: cover;\nwidth: 33px;\nheight: 40px;\ncursor: pointer;`),i=new s.Marker(t).setLngLat([e.position.lng,e.position.lat]).addTo(this._map)))}void 0!==o&&("image"===o.type&&(t=n.div("",[]),t.setAttribute("style",`\nbackground-image: url('${o.value}');\nbackground-size: cover;\nwidth: 33px;\nheight: 40px;\ncursor: pointer;\n\t\t\t\t\t\t`),i=new s.Marker(t).setLngLat([e.position.lng,e.position.lat]).addTo(this._map)),"colour"===o.type&&(i=new s.Marker({color:"#"+o.value}).setLngLat([e.position.lng,e.position.lat]).addTo(this._map)))}void 0===i&&(i=new s.Marker(t).setLngLat([e.position.lng,e.position.lat]).addTo(this._map)),this._markerList.push(i),i.getElement().addEventListener("click",(()=>{1===e.profiles.length?this.single_profile_pin_click(e):this.multi_profile_pin_click(e)}))}))}multi_profile_pin_click(e){r.ebFilterManager.onlyShowTheseEntries(e.profiles.map((e=>e.key))),r.box_cache.reflectFilterSettings((e=>r.ebFilterManager.Filter(e,this._invariants.template)),this._invariants.config,this._invariants.template),n.remove_all_child_elements_from(this._invariants.contentContainer),r.box_cache.resetPagination(),(0,r.cbebOnShowMore)(this._invariants.contentContainer,this._invariants.config.initialEntryCount,this._invariants.template),a(document.getElementById("cbeb-map")),this._map&&this._map.flyTo({center:e.position,zoom:9,bearing:0,speed:.5,curve:1})}single_profile_pin_click(e){if(!0===this._invariants.config.single_map_pin_should_popup){const t=e.profiles[0];void 0!==t&&(0,r.handle_profile_click)(t,this._invariants)}else this._map&&this._map.flyTo({center:e.position,zoom:9,bearing:0,speed:.5,curve:1}),r.ebFilterManager.onlyShowTheseEntries(e.profiles.map((e=>e.key))),r.box_cache.reflectFilterSettings((e=>r.ebFilterManager.Filter(e,this._invariants.template)),this._invariants.config,this._invariants.template),n.remove_all_child_elements_from(this._invariants.contentContainer),r.box_cache.resetPagination(),(0,r.cbebOnShowMore)(this._invariants.contentContainer,this._invariants.config.initialEntryCount,this._invariants.template),a(document.getElementById("cbeb-map"))}ChunkLoadMarkers(e,t,i){const n=e.splice(0,250);this.add_markers_to_map(n),e.length>0&&window.setTimeout((()=>{this.ChunkLoadMarkers(e,t,i)}),100)}ReloadWith(e){n.remove_all_child_elements_from(this._invariants.mapContainer);const t=n.div("cbeb-map",[],{key:"cbeb-map"});this._invariants.mapContainer.appendChild(t),this._map=new s.Map({accessToken:this._mapboxKey,container:"cbeb-map",style:this._invariants.config.grayscaleMap?"mapbox://styles/mapbox/light-v10":"mapbox://styles/mapbox/outdoors-v11",cooperativeGestures:"cooperative gesture"===this._invariants.config.mapDesign().interaction}),this._map.addControl(new s.NavigationControl),this._map.addControl(new s.FullscreenControl),this.UpdateMarkers(e)}UpdateMarkers(e){if(void 0===this._map)return;for(const e of this._markerList)e.remove();this._markerList=[];const t=l(e,this._invariants.template),i=Object.keys(t).map((e=>({position:t[e].position,profiles:t[e].profiles})));let n=new s.LngLatBounds;i.length>0&&i.forEach((e=>{n.extend([e.position.lng,e.position.lat])}));try{this._map.fitBounds(0===i.length?[-10,10,-10,10]:n,{padding:{left:50,top:50,bottom:50,right:50},maxZoom:10})}catch(e){console.log("Tried to fit bounds but failed")}this._mapHasLoaded?this.ChunkLoadMarkers(i,this._invariants.contentContainer,this._invariants):this.DoPostMapLoadStuff(i),this._map.on("load",(()=>{this._mapHasLoaded=!0,window.setTimeout((()=>{this._map&&this._map.resize(),window.setTimeout((()=>{this.ChunkLoadMarkers(i,this._invariants.contentContainer,this._invariants)}))}))}))}DoPostMapLoadStuff(e){void 0!==this._map&&this._map.on("load",(()=>{this._mapHasLoaded=!0,window.setTimeout((()=>{this._map&&this._map.resize(),window.setTimeout((()=>{this.ChunkLoadMarkers(e,this._invariants.contentContainer,this._invariants)}))}))}))}constructor(e,t){super(),this._invariants=e,this._mapboxKey=t,this._markerList=[],this._mapHasLoaded=!1}},t.PlaceholderMap=class extends c{ReloadWith(){}UpdateMarkers(){}constructor(){super()}}},180:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.MemberSpaceAutoLoginDlg=void 0;const r=i(1370),o=i(3189),s=i(2673),a=i(6578),l=i(9882);t.MemberSpaceAutoLoginDlg=class{constructor(e){this._dlgElem=document.querySelector("[m-auto-login-dlg]"),this._closeBtnRowElem=this._dlgElem.querySelector("[btn-row]"),this._msgElem=this._dlgElem.querySelector("p[msg]"),r.DialogBoxMgr.registerDialogBox(this._dlgElem),o.Styling.applyAllStylesTo({rootElem:this._dlgElem,withConfig:e})}printErrorMsg(e){this._msgElem.textContent=(0,l.TrimQuotationMarksFrom)(e)}show(e){return n(this,void 0,void 0,(function*(){this._closeBtnRowElem.style.visibility="none",this.printErrorMsg("Logging in..."),r.DialogBoxMgr.show(this._dlgElem);const t=yield function(e,t,i){return n(this,void 0,void 0,(function*(){try{const n=yield s.Member.Lambda({request:"federated-login",identifier:e,directory:t,federated_auth:i});return{type:"success",member:n.member,token:n.token}}catch(e){return{type:"failure",failureMsg:"string"==typeof e?e:"Unknown login problem"}}}))}(e.identifier,e.directory,e.federated_auth);if("success"===t.type)return a.AuthCache.cacheAuthLocally({member:t.member,token:t.token}),void e.onLogin(t.member);this.printErrorMsg(t.failureMsg),this._closeBtnRowElem.style.visibility="visible"}))}}},8278:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Measure=void 0,t.Measure=class{composite(){return`${this._value}${this._unit}`}constructor(e,t){this._value=e,this._unit=t}}},6996:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MsgDialogBox=void 0;const n=i(7102);t.MsgDialogBox=class{constructor(e,t){this._container=e,this._config=t}close_dialog(e,t){window.setTimeout((function(){document.body.removeChild(e),document.body.classList.remove("cbeb-noscroll"),t()}))}Show(e){const t=n.div("dialogbox block",[],{design:`font-family: ${this._config.fontFamily};`}),i=`font-family: ${this._config.fontFamily||"inherit"}; font-size: 17px; color: #${this._config.fgColourOf("paragraph")};`,r=n.div("flex col",[],{design:"box-sizing: border-box; padding: 31px;"}),o=n.div("flex row justify-center",[n.button("basic mr17",e.btn_label,(()=>{this.close_dialog(t,e.onClose)}),{design:`color: #${this._config.fgColourOf("button")}; background-color: #${this._config.bgColourOf("button")}`})]);r.appendChild(n.div("flex col",[n.p("mt0 mb0 cntr-text",e.msg,{design:`${i}; box-sizing: border-box; padding: 31px; background-color: white;`}),n.div("h17",[]),o,n.div("h37",[])]));const s=n.div("flex col",[n.p("mt0 mb0",e.title,{design:`${i}; color: #${this._config.fgColourOf("dialog_title")}; box-sizing: border-box; padding: 31px; background-color: #${this._config.bgColourOf("dialog_title")}`}),r],{design:"width: 500px; margin-left: auto; margin-right: auto; background-color: white;"});t.appendChild(s),t.addEventListener("click",(i=>{i.target!==t&&i.target!==s||window.setTimeout((()=>{this.close_dialog(t,e.onClose)}))})),document.body.appendChild(t),document.body.classList.add("cbeb-noscroll")}}},6101:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MultiLineEditCtrl=void 0;const n=i(1372);class r extends n.field_edit_ctrl{data(){return void 0!==this._inputElem&&this._inputElem.value||""}has_data(){return this._entry.hasValueForField(this._field.key)}viewHtmlElem(){const e=this._entry.getValueOf(this._field.key),t=[this.leftOfViewRow(),`
`,this._field.detailLabel?`
${this._field.detailLabel}
`:"",'
',e.split("\n").map((e=>["

",e,"

"].join(""))).join(""),"
","
",this.rightOfViewRow()].join(""),i=document.createElement("div");return i.innerHTML=t,i}inputHtmlElem(){var e;const t=this.leftOfInputRow()+'
'+this._field.label+(!0===this._field.required?" (required)":"")+(!0===this._field.readonly?" (locked)":"")+'
'+`
"+this.rightOfInputRow(),i=document.createElement("div");return i.innerHTML=t,this.install_input_handler_for(i,"textarea"),this._inputElem=i.querySelector("textarea"),i}constructor(e,t){super(e,t),this._entry=e,this._field=t}}t.MultiLineEditCtrl=r},9984:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PostRequest=void 0,t.PostRequest=function(e){const t=-1!==window.location.href.indexOf("localhost");!0===t&&console.log(JSON.stringify(e.payload));const i=new XMLHttpRequest,n=function(e,t){return"https://"!==e.slice(0,8)?`${function(e){return"cfapi"===e?"https://cfapi.communitybox.co":"https://api.communitybox.co"}(t)}${e}`:e}(e.url,e.stage);!0===t&&console.log(`-> ${n}`),i&&(i.open("post",n,!0),i.setRequestHeader("Content-type","application/json; charset=utf-8"),i.onload=function(){var n,r,o;if(4===i.readyState&&200===i.status){var s=JSON.parse(i.responseText);!0===t&&console.log(i.responseText),s.hasOwnProperty("err")?null===(n=e.callback)||void 0===n||n.onFailure(s.err):null===(r=e.callback)||void 0===r||r.onResult(s)}else null===(o=e.callback)||void 0===o||o.onFailure(i.responseText)}),i.send(JSON.stringify(e.payload))}},3291:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewBuilder=void 0,t.OverviewBuilder=class{}},5718:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PhoneNbEditCtrl=void 0;const n=i(1372);class r extends n.field_edit_ctrl{data(){return void 0!==this._inputElem&&this._inputElem.value||""}has_data(){return this._entry.hasValueForField(this._field.key)}extractNumbersFrom(e){return e.replace(/\D/g,"").split("")}usaFormat(e){const t=this.extractNumbersFrom(e).reverse(),i=[];let n="",r=0;for(;r<=t.length;)0===i.length&&n.length<4||i.length>0&&n.length<3?n+=t[r++]:(i.push(n.split("").reverse().join("")),n="");return i.reverse().join("-")}formattedPhoneNb(e){switch(this._config.phoneNbFormat){case"freeform":return e;case"nnn-nnn-nnnn":return this.usaFormat(e)}}viewHtmlElem(){const e=this._entry.getValueOf(this._field.key),t=[this.leftOfViewRow(),'
',this._field.detailLabel?`
${this._field.detailLabel}
`:"",'
',this.getDetailGlyph(this._field.ctrlType),`\n ${this.formattedPhoneNb(e)}\n `,"
","
",this.rightOfViewRow()].join(""),i=document.createElement("div");return i.innerHTML=t,i}inputHtmlElem(){const e=this._entry.getValueOf(this._field.key),t=this.leftOfInputRow()+'
'+this._field.label+(!0===this._field.required?" (required)":"")+(!0===this._field.readonly?'  ':"")+'
'+`
"+this.rightOfInputRow(),i=document.createElement("div");return i.innerHTML=t,this.install_input_handler_for(i,"input"),this._inputElem=i.querySelector("input"),i}constructor(e,t,i){super(e,t),this._entry=e,this._field=t,this._config=i}}t.PhoneNbEditCtrl=r},2673:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Member=void 0;const n=i(9984);var r;!function(e){e.Lambda=function(e){return new Promise(((t,i)=>{(0,n.PostRequest)({url:"/members",stage:"cfapi",payload:e,callback:{onResult:e=>{e.hasOwnProperty("err")?i(e.err):t(e)},onFailure:e=>{i(e)}}})}))}}(r||(t.Member=r={}))},3950:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PrivacyPolicyDlgBox=void 0;const n=i(1370),r=i(3189);t.PrivacyPolicyDlgBox=class{constructor(e){this._dlgElem=document.getElementById("cbeb-pp-modal"),n.DialogBoxMgr.registerDialogBox(this._dlgElem),r.Styling.applyAllStylesTo({rootElem:this._dlgElem,withConfig:e})}show(){n.DialogBoxMgr.show(this._dlgElem)}}},3592:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ProductPictureEditCtrl=void 0;const n=i(1372);class r extends n.field_edit_ctrl{data(){const e=this._domParent;var t=[e.querySelector('[for="cbeb-img-uploader-'+this._field.key+'-0"]').getAttribute("imageKey"),e.querySelector('[for="cbeb-img-uploader-'+this._field.key+'-1"]').getAttribute("imageKey"),e.querySelector('[for="cbeb-img-uploader-'+this._field.key+'-2"]').getAttribute("imageKey")],i=[e.querySelector('input[galleryidx="0"]').value,e.querySelector('input[galleryidx="1"]').value,e.querySelector('input[galleryidx="2"]').value];return JSON.stringify({img:t,url:i})}has_data(){return this._entry.hasValueForField(this._field.key)}viewHtmlElem(){var e="",t=JSON.parse(this._entry.getValueOf(this._field.key));if(t.img&&t.url){var i=0;e+="
",t.img.forEach((function(n){n&&(e+=["
","
"].join("")),i++})),e+="
"}const n=document.createElement("div");return n.innerHTML=e,n}inputHtmlElem(){const e=["","",""],t=[void 0,void 0,void 0],i=this._entry.getValueOf(this._field.key);if(i)for(var n=0;n<3;n++)i.img[n]&&(e[n]="style='background-image: url(\"https://dashboard.communitybox.co/img/uploaded/"+i.img[n]+".jpeg\")'",t[n]=i.img[n]);const r=[this.leftOfInputRow(),"
",'
'+this._field.label+(!0===this._field.required?" (required)":"")+(!0===this._field.readonly?'  ':"")+'
',"
",'
",'",'',"
",'
",'",'',"
",'
",'",'',"
","
","
","
",'
Link for picture #1
','
','',"
","
","
",'
Link for picture #2
','
','',"
","
","
",'
Link for picture #3
','
','',"
","
","
",this.rightOfInputRow()].join(""),o=document.createElement("div");return o.innerHTML=r,o}constructor(e,t){super(e,t),this._entry=e,this._field=t}}t.ProductPictureEditCtrl=r},2052:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.profile_dialog_box=void 0;const n=i(6852);t.profile_dialog_box=class{isMissingContent(e,t){return"image-input"===t.ctrlType?void 0===(0,n.PictureDataFrom)(e).key:null==e||"string"==typeof e&&0===e.length||e instanceof Array&&0===e.length}search_for_missing_fields(e,t){var i=[];return t.forEachField((t=>{!0===t.required&&this.isMissingContent(e[t.key],t)&&i.push(t)})),i.map((e=>e.key))}handle_missing_fields(e,t,i){const n=this.search_for_missing_fields(e,t);if(n.length>0){const e=i.querySelector(`[fieldkey="${n[0]}"]`);if(e){const t=e.getBoundingClientRect(),n=i.getBoundingClientRect().height/2,r=t.top-n;i.scrollBy({top:r,behavior:"smooth"}),e.setAttribute("missing_required_field","")}return"some_fields_are_missing"}return"all_filled_in"}}},6852:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ProfilePictureEditCtrl=t.PictureDataFrom=void 0;const n=i(5328),r=i(1372),o=i(9786),s=i(3061),a=i(9699),l=i(7102);var c;function u(e){switch(typeof e){case"string":return{key:e,rotation:(0,a.Degrees)(0),offset:{x:"center",y:"center"}};case"object":return e;default:return{key:void 0,rotation:(0,a.Degrees)(0),offset:{x:"center",y:"center"}}}}!function(e){e[e.for_viewing=0]="for_viewing",e[e.for_editing=1]="for_editing"}(c||(c={})),t.PictureDataFrom=u;class h extends r.field_edit_ctrl{getPicUrlFromRule(){const e="https://dashboard.communitybox.co/img/uploaded/"+this._config.defaultProfilePictureKey+".jpeg";if(this._picture_data.key)return(0,s.PictureLinkFrom)(this._picture_data,e);{const t=this._template.getRuleForType(o.TemplateRuleType.Picture);return t.length>0&&void 0!==this._entry.getValueOf(t[0].key)&&this._entry.getValueOf(t[0].key).length>0?(0,s.PictureLinkFrom)(u(this._entry.getValueOf(t[0].key)),e):e}}updateImage(e){const t="https://dashboard.communitybox.co/img/uploaded/"+this._config.defaultProfilePictureKey+".jpeg";if(e===c.for_editing)void 0!==this._image_holder&&(void 0!==this._picture_data.key?(this._image_holder.style.backgroundImage=`url(${(0,s.PictureLinkFrom)(this._picture_data,t)})`,this._image_holder.style.borderRadius="circle"===this._config.profilePictureAspect?"50%":"0%",this._image_holder.style.transform=`rotate(${this._picture_data.rotation}deg)`,"fit"===this._config.profilePictureAspect&&(this._image_holder.style.backgroundSize="contain",this._image_holder.style.backgroundColor="transparent")):this._image_holder.style.backgroundImage=`url("https://dashboard.communitybox.co/img/uploaded/${this._config.upload_image}.jpeg")`);else if(void 0!==this._image_holder){const e=this.getPicUrlFromRule();this._image_holder.style.backgroundImage=`url(${e})`,this._image_holder.style.borderRadius="circle"===this._config.profilePictureAspect?"50%":"0%","fit"===this._config.profilePictureAspect&&(this._image_holder.style.backgroundSize="contain",this._image_holder.style.backgroundColor="transparent"),this._image_holder.style.transform=`rotate(${this._picture_data.rotation}deg)`,this._image_holder.style.backgroundPositionX=this._picture_data.offset.x.toString(),this._image_holder.style.backgroundPositionY=this._picture_data.offset.y.toString()}}photoLabelInitValue(e,t){return t&&t.hasOwnProperty(e)?'imageKey="'+t[e]+'"':""}data(){return this._picture_data}has_data(){return!0}viewHtmlElem(){return this._image_holder=l.div("imageholder",[l.div("",[],{design:"display: none;"})],{classes:["cb-image-upload-readonly"]}),this.updateImage(c.for_viewing),l.div("",[this._image_holder],{classes:["cbeb-entry-image-input-container"]})}show_progress(e,t){this._upload_progress_meter&&this._upload_progress_label&&(this._upload_progress_meter.value=100*e,this._upload_progress_label.textContent=t)}registerFileUploadCallback(e,t){let i=this;e.addEventListener("change",(e=>{this._upload_progress_container&&this._image_holder&&(this._upload_progress_container.style.display="flex",this._image_holder.style.display="none"),(0,n.upload_image)(e.target.files[0],t,((e,t)=>this.show_progress(e,t))).then((e=>{i._picture_data=u(e),i.updateImage(c.for_editing),this._upload_progress_container&&this._image_holder&&(this._upload_progress_container.style.display="none",this._image_holder.style.display="flex")})).catch((e=>{console.error(e)}))}))}inputHtmlElem(){const e=`\n
${this._field.label}${!0===this._field.required?" (required)":""}${!0===this._field.readonly?'  ':""}
\n
\n
\n \n \n
\n
\n \n ${!1===this._field.readonly?'':""}\n
\n
`,t=this.leftOfInputRow()+e+this.rightOfInputRow(),i=document.createElement("div");i.innerHTML=t,this._image_holder=i.querySelector("[imageholder]"),this._upload_progress_container=i.querySelector("[upload-progress]"),this._upload_progress_meter=i.querySelector("progress"),this._upload_progress_label=this._upload_progress_container.querySelector("label"),!1===this._field.readonly&&(this._inputElem=i.querySelector("input"),this.registerFileUploadCallback(this._inputElem,this._directory),this.install_input_handler_for(i,"input")),this.updateImage(c.for_editing);const n=l.button("svg","",(()=>{this.rotate((0,a.Degrees)(-90)),this.updateImage(c.for_editing)}),{svg:"rotateLeft"}),r=l.button("svg","",(()=>{this.rotate((0,a.Degrees)(90)),this.updateImage(c.for_editing)}),{svg:"rotateRight"}),o=l.div("flex row justify-center",[n,r],{design:"column-gap: 7px"});return l.div("flex col",[i,o])}rotate(e){this._picture_data.rotation=(0,a.Degrees)((this._picture_data.rotation+e)%360)}constructor(e,t,i,n,r){super(e,t),this._entry=e,this._field=t,this._config=i,this._template=n,this._directory=r,this._picture_data=u(e.getValueOf(t.key))}}t.ProfilePictureEditCtrl=h},205:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Hide=t.Show=t.UpdateMeter=t.Init=void 0;const n=i(1370),r=i(3189);let o,s;function a(e){void 0!==s&&(s.style.width=100*e+"%")}t.Init=function(e,t){o=n.DialogBoxMgr.buildAndRegisterDialogElement({title:"Uploading file...",key:"file-upload-prog",default_close:!0,body:`\n
\n
\n
\n
\n
`}),r.Styling.applyAllStylesTo({rootElem:o,withConfig:e}),s=o.querySelector("[bar]"),t.appendChild(o)},t.UpdateMeter=a,t.Show=function(){a(0),n.DialogBoxMgr.show(o)},t.Hide=function(){n.DialogBoxMgr.hideAll()}},5848:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extract_query_param_from=void 0,t.extract_query_param_from=function(e){const t=e.split("+").join(" "),i={};let n=null;const r=/[?&]?([^=]+)=([^&]*)/g;for(;n=r.exec(t);)i[decodeURIComponent(n[1])]=decodeURIComponent(n[2]);return i.hasOwnProperty("a")&&i.hasOwnProperty("b")?{authID:i.a,validationToken:i.b}:i.hasOwnProperty("c")&&i.hasOwnProperty("d")?{authID:i.c,pwResetValidationToken:i.d}:i.hasOwnProperty("mk")&&i.hasOwnProperty("invite")?{memberKey:i.mk,invitationToken:i.invite}:i.hasOwnProperty("mk")&&i.hasOwnProperty("cr")?{memberKey:i.mk,connectionToken:i.cr}:i.hasOwnProperty("overlay")?{entryKey:i.overlay}:i}},7635:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ResetPwDialogBox=void 0;const r=i(1370),o=i(3189),s=i(5848),a=i(2673);t.ResetPwDialogBox=class{constructor(){this._dlgElem=document.getElementById("cbeb-rpw-modal"),this._buttonRowElem=document.getElementById("cbeb-rpw-button-row"),this._errorElem=document.getElementById("cbeb-rpw-dlg-error-container"),this._resetBtnElem=document.getElementById("cbeb-extra-rpw-reset-btn"),this._msgElem=document.getElementById("cbeb-rpw-msg"),this._inputContainerElem=document.getElementById("cbeb-rpw-input-container"),this._inputField1Elem=document.getElementById("cbeb-rpw-pw1"),this._spinnerElem=document.getElementById("cbeb-rpw-spinner"),r.DialogBoxMgr.registerDialogBox(this._dlgElem),this._resetBtnElem.addEventListener("click",(()=>n(this,void 0,void 0,(function*(){this._msgElem.innerHTML="Please wait...",this._inputContainerElem.style.display="none",this._spinnerElem.style.display="block",this._buttonRowElem.style.display="none";const e=(0,s.extract_query_param_from)(this.getQueryPartOfUrl());try{yield a.Member.Lambda({request:"reset password",member:e.authID,newPassword:this._inputField1Elem.value.trim(),validationToken:e.pwResetValidationToken}),this._msgElem.innerHTML="Your password was successfully reset.",this._spinnerElem.style.display="none"}catch(e){this._msgElem.innerHTML=`${e}`,this._spinnerElem.style.display="none"}}))))}show(e){this._errorElem.style.display="none",this._spinnerElem.style.display="none",o.Styling.applyAllStylesTo({rootElem:this._dlgElem,withConfig:e}),r.DialogBoxMgr.show(this._dlgElem)}getQueryPartOfUrl(){var e=window.location.href.split("?");return e.length>1?"?"+e[1]:""}}},6081:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ShareEntryDialogBox=void 0;const n=i(1370),r=i(3189);t.ShareEntryDialogBox=class{constructor(e){this._dlgElem=document.querySelector("[cbeb-share-entry-dlg]"),this._fbElem=this._dlgElem.querySelector("[facebook]"),this._twElem=this._dlgElem.querySelector("[twitter]"),this._liElem=this._dlgElem.querySelector("[linkedin]"),n.DialogBoxMgr.registerDialogBox(this._dlgElem),r.Styling.applyAllStylesTo({rootElem:this._dlgElem,withConfig:e})}ShowFor(e,t,i){this.InitFacebookParamsFor(e,t,i),this.InitTwitterParamsFor(e,t,i),this.InitLinkedInParamsFor(e,t),n.DialogBoxMgr.show(this._dlgElem)}InitLinkedInParamsFor(e,t){var i=['