extra-map-card 1.2.5 β†’ 1.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,439 +0,0 @@
1
- function e(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a}console.groupCollapsed("%cπŸ“ EXTRA-MAP-CARD πŸ—ΊοΈ%cv1.2.5","background-color: #434347;color: #fff;padding: 2px 4px;border: 1px solid #434347;border-radius: 2px 0 0 2px;font-family: Roboto,Verdana,Geneva,sans-serif;text-shadow: 0 1px 0 rgba(1, 1, 1, 0.3)","background-color: transparent;color: #434347;padding: 2px 3px;border: 1px solid #434347; border-radius: 0 2px 2px 0;font-family: Roboto,Verdana,Geneva,sans-serif"),console.info("Lovelace custom map card for Home Assistant"),console.info("Github: git+https://github.com/ngocjohn/extra-map-card.git"),console.info("If you like the card, consider supporting the developer: https://github.com/sponsors/ngocjohn"),console.groupEnd(),"function"==typeof SuppressedError&&SuppressedError;const t=(e,t)=>e&&e.config.components.includes(t);function i(){let e=document.querySelector("home-assistant");if(e=e&&e.shadowRoot,e=e&&e.querySelector("home-assistant-main"),e=e&&e.shadowRoot,e=e&&e.querySelector("app-drawer-layout partial-panel-resolver, ha-drawer partial-panel-resolver"),e=e&&e.shadowRoot||e,e=e&&e.querySelector("ha-panel-lovelace"),e=e&&e.shadowRoot,e=e&&e.querySelector("hui-root"),e){const t=e.lovelace;return t.current_view=e.___curView,t}return null}const r=e=>{let t=e;for(;t;){if("HUI-CARD-OPTIONS"===t.tagName)return t;t=t.parentNode}return t};function n(e){const t=i();return t?(t.setEditMode(!0),new Promise((i=>{setTimeout((()=>{const n=r(e.parentNode);if(!n)return t.setEditMode(!1),void i(null);const o=n.__path,a=`${n.lovelace.urlPath}-${o.join("-")}`;t.setEditMode(!1),i(a)}),100)}))):Promise.reject("Lovelace not found")}const o=e=>2===e.length?{viewIndex:e[0],cardIndex:e[1]}:{viewIndex:e[0],sectionIndex:e[1],cardIndex:e[2]},a=e=>1===e.length?{viewIndex:e[0]}:{viewIndex:e[0],sectionIndex:e[1]},s=e=>e.slice(0,-1),l=(e,t)=>{var i;const{viewIndex:r,sectionIndex:n}=a(t),o=e.views[r];if(!o)throw new Error("View does not exist");if(void 0===n)return o;if(g(o))throw new Error("Can not find section in a strategy view");const s=null===(i=o.sections)||void 0===i?void 0:i[n];if(!s)throw new Error("Section does not exist");return s},c=(e,t)=>{var i;const{viewIndex:r,sectionIndex:n}=a(t),o=e.views[r];if(!o)throw new Error("View does not exist");if(g(o))throw new Error("Can not find cards in a strategy view");if(void 0===n)return o.cards;const s=null===(i=o.sections)||void 0===i?void 0:i[n];if(!s)throw new Error("Section does not exist");if(y(s))throw new Error("Can not find cards in a strategy section");return s.cards},u=(e,t,i)=>{const{viewIndex:r,sectionIndex:n}=a(t);let o=!1;const s=e.views.map(((e,t)=>{if(t!==r)return e;if(void 0===n)return o=!0,i;if(g(e))throw new Error("Can not update section in a strategy view");if(void 0===e.sections)throw new Error("Section does not exist");const a=e.sections.map(((e,t)=>t!==n?e:(o=!0,i)));return Object.assign(Object.assign({},e),{sections:a})}));if(!o)throw new Error("Can not update cards in a non-existing view/section");return Object.assign(Object.assign({},e),{views:s})},h=(e,t,i)=>{const{viewIndex:r,sectionIndex:n}=a(t);let o=!1;const s=e.views.map(((e,t)=>{if(t!==r)return e;if(g(e))throw new Error("Can not update cards in a strategy view");if(void 0===n)return o=!0,Object.assign(Object.assign({},e),{cards:i});if(void 0===e.sections)throw new Error("Section does not exist");const a=e.sections.map(((e,t)=>{if(t!==n)return e;if(y(e))throw new Error("Can not update cards in a strategy section");return o=!0,Object.assign(Object.assign({},e),{cards:i})}));return Object.assign(Object.assign({},e),{sections:a})}));if(!o)throw new Error("Can not update cards in a non-existing view/section");return Object.assign(Object.assign({},e),{views:s})};function p(e){return"strategy"in e}const d=(e,t,i)=>e.sendMessagePromise({type:"lovelace/config",url_path:t,force:i}),m=(e,t,i)=>e.callWS({type:"lovelace/config/save",url_path:t,config:i}),f=(e,t)=>e.callWS({type:"lovelace/config/delete",url_path:t});function g(e){return"strategy"in e}function y(e){return"strategy"in e}const _=e=>"string"==typeof e?{type:"entity",entity:e,show_name:!0}:"type"in e&&e.type?e:Object.assign({type:"entity"},e),v=e=>e.sendMessagePromise({type:"lovelace/resources"}),x=(e,t)=>e.callWS(Object.assign({type:"lovelace/resources/create"},t)),b=(e,t,i)=>e.callWS(Object.assign({type:"lovelace/resources/update",resource_id:t},i)),w=(e,t)=>e.callWS({type:"lovelace/resources/delete",resource_id:t}),C=(e,t,i,r)=>{r=r||{},i=null==i?{}:i;const n=new Event(t,{bubbles:void 0===r.bubbles||r.bubbles,cancelable:Boolean(r.cancelable),composed:void 0===r.composed||r.composed});return n.detail=i,e.dispatchEvent(n),n},T=(e,t,i)=>e.subscribeMessage((e=>t(e)),Object.assign({type:"render_template"},i));var S,A;!function(e){e.language="language",e.system="system",e.comma_decimal="comma_decimal",e.decimal_comma="decimal_comma",e.space_comma="space_comma",e.none="none"}(S||(S={})),function(e){e.language="language",e.system="system",e.am_pm="12",e.twenty_four="24"}(A||(A={}));var M=function(e){if(e.time_format===A.language||e.time_format===A.system){var t=e.time_format===A.language?e.language:void 0,i=(new Date).toLocaleString(t);return i.includes("AM")||i.includes("PM")}return e.time_format===A.am_pm},E=function(e,t){return P(t).format(e)},P=function(e){return new Intl.DateTimeFormat(e.language,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit",hour12:M(e)})},I=function(e,t){return k(t).format(e)},k=function(e){return new Intl.DateTimeFormat(e.language,{hour:M(e)?"numeric":"2-digit",minute:"2-digit",second:"2-digit",hour12:M(e)})};function z(e){return e.substr(0,e.indexOf("."))}function L(e){return z(e.entity_id)}const D=["climate","humidifier","input_datetime","thermostat","water_heater","person","device_tracker"];class F{constructor(e,t){this.hass=e,this.hoursToShow=t,this.combinedHistory={}}processMessage(e){if(!this.combinedHistory||!Object.keys(this.combinedHistory).length)return this.combinedHistory=e.states,this.combinedHistory;if(!Object.keys(e.states).length)return this.combinedHistory;const t=this.hoursToShow?((new Date).getTime()-3600*this.hoursToShow*1e3)/1e3:void 0,i={};for(const e of Object.keys(this.combinedHistory))i[e]=[];for(const t of Object.keys(e.states))i[t]=[];for(const r of Object.keys(i)){if(r in this.combinedHistory&&r in e.states){const t=this.combinedHistory[r],n=t[t.length-1];i[r]=t.concat(e.states[r]),e.states[r][0].lu<n.lu&&(i[r]=i[r].sort(((e,t)=>e.lu-t.lu)))}else r in this.combinedHistory?i[r]=this.combinedHistory[r]:i[r]=e.states[r];if(t&&r in this.combinedHistory){const e=i[r].filter((e=>e.lu<t));if(!e.length)continue;if(i[r]=i[r].filter((e=>e.lu>=t)),i[r].length&&i[r][0].lu===t)continue;const n=e[e.length-1];n.lu=t,i[r].unshift(n)}}return this.combinedHistory=i,this.combinedHistory}}const R=(e,t)=>!e.states[t]||D.includes(z(t)),B=(e,t,i,r)=>{const n={type:"history/history_during_period",start_time:t.toISOString(),end_time:i.toISOString(),minimal_response:!0,no_attributes:!r.some((t=>R(e,t)))};return 0!==r.length?e.callWS(Object.assign(Object.assign({},n),{entity_ids:r})):e.callWS(n)},O=(e,t,i,r,n,o=!0,a=!0)=>{const s={type:"history/stream",entity_ids:r,start_time:new Date((new Date).getTime()-3600*i*1e3).toISOString(),minimal_response:o,significant_changes_only:a,no_attributes:null!=n?n:!r.some((t=>R(e,t)))},l=new F(e,i);return e.connection.subscribeMessage((e=>t(l.processMessage(e))),s)},j=(e,t,i,r,n)=>{const o={type:"history/stream",entity_ids:n,start_time:i.toISOString(),end_time:r.toISOString(),minimal_response:!1,no_attributes:!1,significant_changes_only:!1},a=new F(e);return e.connection.subscribeMessage((e=>t(a.processMessage(e))),o)},N=globalThis,$=N.ShadowRoot&&(void 0===N.ShadyCSS||N.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,V=Symbol(),U=new WeakMap;let q=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==V)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if($&&void 0===e){const i=void 0!==t&&1===t.length;i&&(e=U.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&U.set(t,e))}return e}toString(){return this.cssText}};const Z=e=>new q("string"==typeof e?e:e+"",void 0,V),G=(e,...t)=>{const i=1===e.length?e[0]:t.reduce(((t,i,r)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+e[r+1]),e[0]);return new q(i,e,V)},H=(e,t)=>{if($)e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const i of t){const t=document.createElement("style"),r=N.litNonce;void 0!==r&&t.setAttribute("nonce",r),t.textContent=i.cssText,e.appendChild(t)}},W=$?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return Z(t)})(e):e
2
- /**
3
- * @license
4
- * Copyright 2017 Google LLC
5
- * SPDX-License-Identifier: BSD-3-Clause
6
- */,{is:K,defineProperty:X,getOwnPropertyDescriptor:Y,getOwnPropertyNames:J,getOwnPropertySymbols:Q,getPrototypeOf:ee}=Object,te=globalThis,ie=te.trustedTypes,re=ie?ie.emptyScript:"",ne=te.reactiveElementPolyfillSupport,oe=(e,t)=>e,ae={toAttribute(e,t){switch(t){case Boolean:e=e?re:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=null!==e;break;case Number:i=null===e?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch(e){i=null}}return i}},se=(e,t)=>!K(e,t),le={attribute:!0,type:String,converter:ae,reflect:!1,hasChanged:se};Symbol.metadata??=Symbol("metadata"),te.litPropertyMetadata??=new WeakMap;class ce extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=le){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),r=this.getPropertyDescriptor(e,i,t);void 0!==r&&X(this.prototype,e,r)}}static getPropertyDescriptor(e,t,i){const{get:r,set:n}=Y(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get(){return r?.call(this)},set(t){const o=r?.call(this);n.call(this,t),this.requestUpdate(e,o,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??le}static _$Ei(){if(this.hasOwnProperty(oe("elementProperties")))return;const e=ee(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(oe("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(oe("properties"))){const e=this.properties,t=[...J(e),...Q(e)];for(const i of t)this.createProperty(i,e[i])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,i]of t)this.elementProperties.set(e,i)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const i=this._$Eu(e,t);void 0!==i&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const e of i)t.unshift(W(e))}else void 0!==e&&t.push(W(e));return t}static _$Eu(e,t){const i=t.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((e=>e(this)))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return H(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((e=>e.hostConnected?.()))}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach((e=>e.hostDisconnected?.()))}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$EC(e,t){const i=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,i);if(void 0!==r&&!0===i.reflect){const n=(void 0!==i.converter?.toAttribute?i.converter:ae).toAttribute(t,i.type);this._$Em=e,null==n?this.removeAttribute(r):this.setAttribute(r,n),this._$Em=null}}_$AK(e,t){const i=this.constructor,r=i._$Eh.get(e);if(void 0!==r&&this._$Em!==r){const e=i.getPropertyOptions(r),n="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:ae;this._$Em=r,this[r]=n.fromAttribute(t,e.type),this._$Em=null}}requestUpdate(e,t,i){if(void 0!==e){if(i??=this.constructor.getPropertyOptions(e),!(i.hasChanged??se)(this[e],t))return;this.P(e,t,i)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(e,t,i){this._$AL.has(e)||this._$AL.set(e,t),!0===i.reflect&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,i]of e)!0!==i.wrapped||this._$AL.has(t)||void 0===this[t]||this.P(t,this[t],i)}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach((e=>e.hostUpdate?.())),this.update(t)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach((e=>this._$EC(e,this[e]))),this._$EU()}updated(e){}firstUpdated(e){}}ce.elementStyles=[],ce.shadowRootOptions={mode:"open"},ce[oe("elementProperties")]=new Map,ce[oe("finalized")]=new Map,ne?.({ReactiveElement:ce}),(te.reactiveElementVersions??=[]).push("2.0.4");
7
- /**
8
- * @license
9
- * Copyright 2017 Google LLC
10
- * SPDX-License-Identifier: BSD-3-Clause
11
- */
12
- const ue=globalThis,he=ue.trustedTypes,pe=he?he.createPolicy("lit-html",{createHTML:e=>e}):void 0,de="$lit$",me=`lit$${Math.random().toFixed(9).slice(2)}$`,fe="?"+me,ge=`<${fe}>`,ye=document,_e=()=>ye.createComment(""),ve=e=>null===e||"object"!=typeof e&&"function"!=typeof e,xe=Array.isArray,be=e=>xe(e)||"function"==typeof e?.[Symbol.iterator],we="[ \t\n\f\r]",Ce=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Te=/-->/g,Se=/>/g,Ae=RegExp(`>|${we}(?:([^\\s"'>=/]+)(${we}*=${we}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),Me=/'/g,Ee=/"/g,Pe=/^(?:script|style|textarea|title)$/i,Ie=e=>(t,...i)=>({_$litType$:e,strings:t,values:i}),ke=Ie(1),ze=Symbol.for("lit-noChange"),Le=Symbol.for("lit-nothing"),De=new WeakMap,Fe=ye.createTreeWalker(ye,129);function Re(e,t){if(!xe(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==pe?pe.createHTML(t):t}const Be=(e,t)=>{const i=e.length-1,r=[];let n,o=2===t?"<svg>":3===t?"<math>":"",a=Ce;for(let t=0;t<i;t++){const i=e[t];let s,l,c=-1,u=0;for(;u<i.length&&(a.lastIndex=u,l=a.exec(i),null!==l);)u=a.lastIndex,a===Ce?"!--"===l[1]?a=Te:void 0!==l[1]?a=Se:void 0!==l[2]?(Pe.test(l[2])&&(n=RegExp("</"+l[2],"g")),a=Ae):void 0!==l[3]&&(a=Ae):a===Ae?">"===l[0]?(a=n??Ce,c=-1):void 0===l[1]?c=-2:(c=a.lastIndex-l[2].length,s=l[1],a=void 0===l[3]?Ae:'"'===l[3]?Ee:Me):a===Ee||a===Me?a=Ae:a===Te||a===Se?a=Ce:(a=Ae,n=void 0);const h=a===Ae&&e[t+1].startsWith("/>")?" ":"";o+=a===Ce?i+ge:c>=0?(r.push(s),i.slice(0,c)+de+i.slice(c)+me+h):i+me+(-2===c?t:h)}return[Re(e,o+(e[i]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),r]};let Oe=class e{constructor({strings:t,_$litType$:i},r){let n;this.parts=[];let o=0,a=0;const s=t.length-1,l=this.parts,[c,u]=Be(t,i);if(this.el=e.createElement(c,r),Fe.currentNode=this.el.content,2===i||3===i){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(n=Fe.nextNode())&&l.length<s;){if(1===n.nodeType){if(n.hasAttributes())for(const e of n.getAttributeNames())if(e.endsWith(de)){const t=u[a++],i=n.getAttribute(e).split(me),r=/([.?@])?(.*)/.exec(t);l.push({type:1,index:o,name:r[2],strings:i,ctor:"."===r[1]?Ue:"?"===r[1]?qe:"@"===r[1]?Ze:Ve}),n.removeAttribute(e)}else e.startsWith(me)&&(l.push({type:6,index:o}),n.removeAttribute(e));if(Pe.test(n.tagName)){const e=n.textContent.split(me),t=e.length-1;if(t>0){n.textContent=he?he.emptyScript:"";for(let i=0;i<t;i++)n.append(e[i],_e()),Fe.nextNode(),l.push({type:2,index:++o});n.append(e[t],_e())}}}else if(8===n.nodeType)if(n.data===fe)l.push({type:2,index:o});else{let e=-1;for(;-1!==(e=n.data.indexOf(me,e+1));)l.push({type:7,index:o}),e+=me.length-1}o++}}static createElement(e,t){const i=ye.createElement("template");return i.innerHTML=e,i}};function je(e,t,i=e,r){if(t===ze)return t;let n=void 0!==r?i._$Co?.[r]:i._$Cl;const o=ve(t)?void 0:t._$litDirective$;return n?.constructor!==o&&(n?._$AO?.(!1),void 0===o?n=void 0:(n=new o(e),n._$AT(e,i,r)),void 0!==r?(i._$Co??=[])[r]=n:i._$Cl=n),void 0!==n&&(t=je(e,n._$AS(e,t.values),n,r)),t}let Ne=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:i}=this._$AD,r=(e?.creationScope??ye).importNode(t,!0);Fe.currentNode=r;let n=Fe.nextNode(),o=0,a=0,s=i[0];for(;void 0!==s;){if(o===s.index){let t;2===s.type?t=new $e(n,n.nextSibling,this,e):1===s.type?t=new s.ctor(n,s.name,s.strings,this,e):6===s.type&&(t=new Ge(n,this,e)),this._$AV.push(t),s=i[++a]}o!==s?.index&&(n=Fe.nextNode(),o++)}return Fe.currentNode=ye,r}p(e){let t=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}};class $e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,i,r){this.type=2,this._$AH=Le,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=je(this,e,t),ve(e)?e===Le||null==e||""===e?(this._$AH!==Le&&this._$AR(),this._$AH=Le):e!==this._$AH&&e!==ze&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):be(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==Le&&ve(this._$AH)?this._$AA.nextSibling.data=e:this.T(ye.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:i}=e,r="number"==typeof i?this._$AC(e):(void 0===i.el&&(i.el=Oe.createElement(Re(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===r)this._$AH.p(t);else{const e=new Ne(r,this),i=e.u(this.options);e.p(t),this.T(i),this._$AH=e}}_$AC(e){let t=De.get(e.strings);return void 0===t&&De.set(e.strings,t=new Oe(e)),t}k(e){xe(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,r=0;for(const n of e)r===t.length?t.push(i=new $e(this.O(_e()),this.O(_e()),this,this.options)):i=t[r],i._$AI(n),r++;r<t.length&&(this._$AR(i&&i._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e&&e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}let Ve=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,r,n){this.type=1,this._$AH=Le,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=n,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=Le}_$AI(e,t=this,i,r){const n=this.strings;let o=!1;if(void 0===n)e=je(this,e,t,0),o=!ve(e)||e!==this._$AH&&e!==ze,o&&(this._$AH=e);else{const r=e;let a,s;for(e=n[0],a=0;a<n.length-1;a++)s=je(this,r[i+a],t,a),s===ze&&(s=this._$AH[a]),o||=!ve(s)||s!==this._$AH[a],s===Le?e=Le:e!==Le&&(e+=(s??"")+n[a+1]),this._$AH[a]=s}o&&!r&&this.j(e)}j(e){e===Le?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Ue=class extends Ve{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Le?void 0:e}},qe=class extends Ve{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Le)}},Ze=class extends Ve{constructor(e,t,i,r,n){super(e,t,i,r,n),this.type=5}_$AI(e,t=this){if((e=je(this,e,t,0)??Le)===ze)return;const i=this._$AH,r=e===Le&&i!==Le||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,n=e!==Le&&(i===Le||r);r&&this.element.removeEventListener(this.name,this,i),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Ge=class{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){je(this,e)}};const He=ue.litHtmlPolyfillSupport;He?.(Oe,$e),(ue.litHtmlVersions??=[]).push("3.2.1");const We=(e,t,i)=>{const r=i?.renderBefore??t;let n=r._$litPart$;if(void 0===n){const e=i?.renderBefore??null;r._$litPart$=n=new $e(t.insertBefore(_e(),e),e,void 0,i??{})}return n._$AI(e),n
13
- /**
14
- * @license
15
- * Copyright 2017 Google LLC
16
- * SPDX-License-Identifier: BSD-3-Clause
17
- */};let Ke=class extends ce{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=We(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return ze}};Ke._$litElement$=!0,Ke.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:Ke});const Xe=globalThis.litElementPolyfillSupport;Xe?.({LitElement:Ke}),(globalThis.litElementVersions??=[]).push("4.1.1");
18
- /**
19
- * @license
20
- * Copyright 2017 Google LLC
21
- * SPDX-License-Identifier: BSD-3-Clause
22
- */
23
- const Ye={attribute:!0,type:String,converter:ae,reflect:!1,hasChanged:se},Je=(e=Ye,t,i)=>{const{kind:r,metadata:n}=i;let o=globalThis.litPropertyMetadata.get(n);if(void 0===o&&globalThis.litPropertyMetadata.set(n,o=new Map),o.set(i.name,e),"accessor"===r){const{name:r}=i;return{set(i){const n=t.get.call(this);t.set.call(this,i),this.requestUpdate(r,n,e)},init(t){return void 0!==t&&this.P(r,void 0,e),t}}}if("setter"===r){const{name:r}=i;return function(i){const n=this[r];t.call(this,i),this.requestUpdate(r,n,e)}}throw Error("Unsupported decorator location: "+r)};function Qe(e){return(t,i)=>"object"==typeof i?Je(e,t,i):((e,t,i)=>{const r=t.hasOwnProperty(i);return t.constructor.createProperty(i,r?{...e,wrapped:!0}:e),r?Object.getOwnPropertyDescriptor(t,i):void 0})(e,t,i)
24
- /**
25
- * @license
26
- * Copyright 2017 Google LLC
27
- * SPDX-License-Identifier: BSD-3-Clause
28
- */}function et(e){return Qe({...e,state:!0,attribute:!1})}
29
- /**
30
- * @license
31
- * Copyright 2017 Google LLC
32
- * SPDX-License-Identifier: BSD-3-Clause
33
- */const tt=(e,t,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,i),i)
34
- /**
35
- * @license
36
- * Copyright 2017 Google LLC
37
- * SPDX-License-Identifier: BSD-3-Clause
38
- */;function it(e,t){return(t,i,r)=>tt(t,i,{get(){return(t=>t.renderRoot?.querySelector(e)??null)(this)}})}var rt=Number.isNaN||function(e){return"number"==typeof e&&e!=e};function nt(e,t){return e===t||!(!rt(e)||!rt(t))}function ot(e,t){if(e.length!==t.length)return!1;for(var i=0;i<e.length;i++)if(!nt(e[i],t[i]))return!1;return!0}function at(e,t){void 0===t&&(t=ot);var i=null;function r(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(i&&i.lastThis===this&&t(r,i.lastArgs))return i.lastResult;var o=e.apply(this,r);return i={lastResult:o,lastArgs:r,lastThis:this},o}return r.clear=function(){i=null},r}const st=["#4269d0","#f4bd4a","#ff725c","#6cc5b0","#a463f2","#ff8ab7","#9c6b4e","#97bbf5","#01ab63","#9498a0","#094bad","#c99000","#d84f3e","#49a28f","#048732","#d96895","#8043ce","#7599d1","#7a4c31","#74787f","#6989f4","#ffd444","#ff957c","#8fe9d3","#62cc71","#ffadda","#c884ff","#badeff","#bf8b6d","#b6bac2","#927acc","#97ee3f","#bf3947","#9f5b00","#f48758","#8caed6","#f2b94f","#eff26e","#e43872","#d9b100","#9d7a00","#698cff","#d9d9d9","#00d27e","#d06800","#009f82","#c49200","#cbe8ff","#fecddf","#c27eb6","#8cd2ce","#c4b8d9","#f883b0","#a49100","#f48800","#27d0df","#a04a9b"];function lt(e){return st[e%st.length]}const ct=e=>e.substr(e.indexOf(".")+1),ut=(e,t)=>{var i;return void 0===t.friendly_name?ct(e).replace(/_/g," "):(null!==(i=t.friendly_name)&&void 0!==i?i:"").toString()},ht=e=>ut(e.entity_id,e.attributes),pt=(e,t,i)=>{(!i||i>e.length)&&(i=e.length);const r=[];for(let n=0;n<e.length&&r.length<i;n++){let i=!0;for(const r of t)if(!r(e[n])){i=!1;break}i&&r.push(e[n])}return r},dt=(e,t,i,r,n,o)=>{const a=[];(null==n?void 0:n.length)&&a.push((e=>n.includes(z(e)))),o&&a.push((t=>e.states[t]&&o(e.states[t])));const s=pt(i,a,t);if(s.length<t&&r.length){const i=dt(e,t-s.length,r,[],n,o);s.push(...i)}return s},mt=/^(\w+)\.(\w+)$/,ft=e=>mt.test(e),gt=(e,t=!0)=>{if(!e||!Array.isArray(e))throw new Error("Entities need to be an array");return e.map(((e,i)=>{if("object"==typeof e&&!Array.isArray(e)&&e.type)return e;let r;if("string"==typeof e)r={entity:e};else{if("object"!=typeof e||Array.isArray(e))throw new Error(`Invalid entity ID at position ${i}`);if(!("entity"in e))throw new Error(`Object at position ${i} is missing entity field`);r=e}if(t&&!ft(r.entity))throw new Error(`Invalid entity ID at position ${i}: ${r.entity}`);return r}))};function yt(e,t){if(t.has("_config"))return!0;if(!t.has("hass"))return!1;const i=t.get("hass");return!i||(i.connected!==e.hass.connected||i.themes!==e.hass.themes||i.locale!==e.hass.locale||i.localize!==e.hass.localize||i.formatEntityState!==e.hass.formatEntityState||i.formatEntityAttributeName!==e.hass.formatEntityAttributeName||i.formatEntityAttributeValue!==e.hass.formatEntityAttributeValue||i.config.state!==e.hass.config.state)}function _t(e,t,i){return e.states[i]!==t.states[i]}function vt(e,t,i){const r=e.entities[i],n=t.entities[i];return(null==r?void 0:r.display_precision)!==(null==n?void 0:n.display_precision)}function xt(e,t){if(yt(e,t))return!0;if(!t.has("hass"))return!1;const i=t.get("hass"),r=e.hass;return _t(i,r,e._config.entity)||vt(i,r,e._config.entity)}function bt(e,t){if(yt(e,t))return!0;if(!t.has("hass"))return!1;const i=t.get("hass"),r=e.hass;return gt(e._config.entities,!1).some((e=>"entity"in e&&(_t(i,r,e.entity)||vt(i,r,e.entity))))}const wt=e=>{const t=parseFloat(e);if(isNaN(t))throw new Error(`${e} is not a number`);return t};function Ct(e){if(!e)return null;try{if(e.endsWith("%"))return{w:100,h:wt(e.substr(0,e.length-1))};const t=e.replace(":","x").split("x");return 0===t.length?null:1===t.length?{w:wt(t[0]),h:1}:{w:wt(t[0]),h:wt(t[1])}}catch(e){console.warn(`Error parsing aspect ratio: ${e.message}`)}return null}function Tt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var St,At={exports:{}},Mt=At.exports;
39
- /**
40
- * MapLibre GL JS
41
- * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v5.3.0/LICENSE.txt
42
- */function Et(){return St||(St=1,At.exports=function(){var e={},t={};function i(i,r,n){if(t[i]=n,"index"===i){var o="var sharedModule = {}; ("+t.shared+")(sharedModule); ("+t.worker+")(sharedModule);",a={};return t.shared(a),t.index(e,a),"undefined"!=typeof window&&e.setWorkerUrl(window.URL.createObjectURL(new Blob([o],{type:"text/javascript"}))),e}}return i("shared",["exports"],(function(e){function t(e,t,i,r){return new(i||(i=Promise))((function(n,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))}function i(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var r,n;function o(){if(n)return r;function e(e,t){this.x=e,this.y=t}return n=1,r=e,e.prototype={clone:function(){return new e(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),r=i*this.x+t*this.y;return this.x=t*this.x-i*this.y,this.y=r,this},_rotateAround:function(e,t){var i=Math.cos(e),r=Math.sin(e),n=t.y+r*(this.x-t.x)+i*(this.y-t.y);return this.x=t.x+i*(this.x-t.x)-r*(this.y-t.y),this.y=n,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},e.convert=function(t){return t instanceof e?t:Array.isArray(t)?new e(t[0],t[1]):t},r}"function"==typeof SuppressedError&&SuppressedError;var a,s,l=i(o()),c=function(){if(s)return a;function e(e,t,i,r){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*(r-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=i,this.p2y=r}return s=1,a=e,e.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,r=0;r<8;r++){var n=this.sampleCurveX(i)-e;if(Math.abs(n)<t)return i;var o=this.sampleCurveDerivativeX(i);if(Math.abs(o)<1e-6)break;i-=n/o}var a=0,s=1;for(i=e,r=0;r<20&&(n=this.sampleCurveX(i),!(Math.abs(n-e)<t));r++)e>n?a=i:s=i,i=.5*(s-a)+a;return i},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},a}(),u=i(c);let h,p;function d(){return null==h&&(h="undefined"!=typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),h}function m(){if(null==p&&(p=!1,d())){const e=5,t=new OffscreenCanvas(e,e).getContext("2d",{willReadFrequently:!0});if(t){for(let i=0;i<e*e;i++){const r=4*i;t.fillStyle=`rgb(${r},${r+1},${r+2})`,t.fillRect(i%e,Math.floor(i/e),1,1)}const i=t.getImageData(0,0,e,e).data;for(let t=0;t<e*e*4;t++)if(t%4!=3&&i[t]!==t){p=!0;break}}}return p||!1}var f,g=1e-6,y="undefined"!=typeof Float32Array?Float32Array:Array;function _(){var e=new y(9);return y!=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 v(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 x(){var e=new y(3);return y!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function b(e,t,i){var r=new y(3);return r[0]=e,r[1]=t,r[2]=i,r}function w(e,t,i){var r=t[0],n=t[1],o=t[2],a=t[3];return e[0]=i[0]*r+i[4]*n+i[8]*o+i[12]*a,e[1]=i[1]*r+i[5]*n+i[9]*o+i[13]*a,e[2]=i[2]*r+i[6]*n+i[10]*o+i[14]*a,e[3]=i[3]*r+i[7]*n+i[11]*o+i[15]*a,e}function C(){var e=new y(4);return y!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function T(){var e=new y(2);return y!=Float32Array&&(e[0]=0,e[1]=0),e}function S(e,t){var i=new y(2);return i[0]=e,i[1]=t,i}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)}),x(),f=new y(4),y!=Float32Array&&(f[0]=0,f[1]=0,f[2]=0,f[3]=0),x(),b(1,0,0),b(0,1,0),C(),C(),_(),T();const A=8192;function M(e,t,i){return t*(A/(e.tileSize*Math.pow(2,i-e.tileID.overscaledZ)))}function E(e,t){return(e%t+t)%t}function P(e,t,i){return e*(1-i)+t*i}function I(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,r){const n=new u(e,t,i,r);return e=>n.solve(e)}const z=k(.25,.1,.25,1);function L(e,t,i){return Math.min(i,Math.max(t,e))}function D(e,t,i){const r=i-t,n=((e-t)%r+r)%r+t;return n===t?i:n}function F(e,...t){for(const i of t)for(const t in i)e[t]=i[t];return e}let R=1;function B(e,t,i){const r={};for(const i in e)r[i]=t.call(this,e[i],i,e);return r}function O(e,t,i){const r={};for(const i in e)t.call(this,e[i],i,e)&&(r[i]=e[i]);return r}function j(e){return Array.isArray(e)?e.map(j):"object"==typeof e&&e?B(e,j):e}const N={};function $(e){N[e]||("undefined"!=typeof console&&console.warn(e),N[e]=!0)}function V(e,t,i){return(i.y-e.y)*(t.x-e.x)>(t.y-e.y)*(i.x-e.x)}function U(e){return"undefined"!=typeof WorkerGlobalScope&&void 0!==e&&e instanceof WorkerGlobalScope}let q=null;function Z(e){return"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap}const G="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function H(e,i,r,n,o){return t(this,void 0,void 0,(function*(){if("undefined"==typeof VideoFrame)throw new Error("VideoFrame not supported");const t=new VideoFrame(e,{timestamp:0});try{const a=null==t?void 0:t.format;if(!a||!a.startsWith("BGR")&&!a.startsWith("RGB"))throw new Error(`Unrecognized format ${a}`);const s=a.startsWith("BGR"),l=new Uint8ClampedArray(n*o*4);if(yield t.copyTo(l,function(e,t,i,r,n){const o=4*Math.max(1,0),a=(Math.max(0,i)-i)*r*4+o,s=4*r,l=Math.max(0,t),c=Math.max(0,i);return{rect:{x:l,y:c,width:Math.min(e.width,t+r)-l,height:Math.min(e.height,i+n)-c},layout:[{offset:a,stride:s}]}}(e,i,r,n,o)),s)for(let e=0;e<l.length;e+=4){const t=l[e];l[e]=l[e+2],l[e+2]=t}return l}finally{t.close()}}))}let W,K;function X(e,t,i,r){return e.addEventListener(t,i,r),{unsubscribe:()=>{e.removeEventListener(t,i,r)}}}function Y(e){return e/Math.PI*180}const J={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},Q={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},ee="AbortError";function te(){return new Error(ee)}const ie={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function re(e){return ie.REGISTERED_PROTOCOLS[e.substring(0,e.indexOf("://"))]}const ne="global-dispatcher";class oe extends Error{constructor(e,t,i,r){super(`AJAXError: ${t} (${e}): ${i}`),this.status=e,this.statusText=t,this.url=i,this.body=r}}const ae=()=>U(self)?self.worker&&self.worker.referrer:("blob:"===window.location.protocol?window.parent:window).location.href,se=function(e,i){if(/:\/\//.test(e.url)&&!/^https?:|^file:/.test(e.url)){const t=re(e.url);if(t)return t(e,i);if(U(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:e,targetMapId:ne},i)}if(!(/^file:/.test(r=e.url)||/^file:/.test(ae())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(e,i){return t(this,void 0,void 0,(function*(){const t=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,cache:e.cache,referrer:ae(),signal:i.signal});let r,n;"json"!==e.type||t.headers.has("Accept")||t.headers.set("Accept","application/json");try{r=yield fetch(t)}catch(t){throw new oe(0,t.message,e.url,new Blob)}if(!r.ok){const t=yield r.blob();throw new oe(r.status,r.statusText,e.url,t)}n="arrayBuffer"===e.type||"image"===e.type?r.arrayBuffer():"json"===e.type?r.json():r.text();const o=yield n;if(i.signal.aborted)throw te();return{data:o,cacheControl:r.headers.get("Cache-Control"),expires:r.headers.get("Expires")}}))}(e,i);if(U(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:e,mustQueue:!0,targetMapId:ne},i)}var r;return function(e,t){return new Promise(((i,r)=>{var n;const o=new XMLHttpRequest;o.open(e.method||"GET",e.url,!0),"arrayBuffer"!==e.type&&"image"!==e.type||(o.responseType="arraybuffer");for(const t in e.headers)o.setRequestHeader(t,e.headers[t]);"json"===e.type&&(o.responseType="text",(null===(n=e.headers)||void 0===n?void 0:n.Accept)||o.setRequestHeader("Accept","application/json")),o.withCredentials="include"===e.credentials,o.onerror=()=>{r(new Error(o.statusText))},o.onload=()=>{if(!t.signal.aborted)if((o.status>=200&&o.status<300||0===o.status)&&null!==o.response){let t=o.response;if("json"===e.type)try{t=JSON.parse(o.response)}catch(e){return void r(e)}i({data:t,cacheControl:o.getResponseHeader("Cache-Control"),expires:o.getResponseHeader("Expires")})}else{const t=new Blob([o.response],{type:o.getResponseHeader("Content-Type")});r(new oe(o.status,o.statusText,e.url,t))}},t.signal.addEventListener("abort",(()=>{o.abort(),r(te())})),o.send(e.body)}))}(e,i)};function le(e){if(!e||e.indexOf("://")<=0||0===e.indexOf("data:image/")||0===e.indexOf("blob:"))return!0;const t=new URL(e),i=window.location;return t.protocol===i.protocol&&t.host===i.host}function ce(e,t,i){i[e]&&-1!==i[e].indexOf(t)||(i[e]=i[e]||[],i[e].push(t))}function ue(e,t,i){if(i&&i[e]){const r=i[e].indexOf(t);-1!==r&&i[e].splice(r,1)}}class he{constructor(e,t={}){F(this,t),this.type=e}}class pe extends he{constructor(e,t={}){super("error",F({error:e},t))}}class de{on(e,t){return this._listeners=this._listeners||{},ce(e,t,this._listeners),{unsubscribe:()=>{this.off(e,t)}}}off(e,t){return ue(e,t,this._listeners),ue(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners=this._oneTimeListeners||{},ce(e,t,this._oneTimeListeners),this):new Promise((t=>this.once(e,t)))}fire(e,t){"string"==typeof e&&(e=new he(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 r=this._oneTimeListeners&&this._oneTimeListeners[i]?this._oneTimeListeners[i].slice():[];for(const t of r)ue(i,t,this._oneTimeListeners),t.call(this,e);const n=this._eventedParent;n&&(F(e,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),n.fire(e))}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 me={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const fe=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function ge(e,t){const i={};for(const t in e)"ref"!==t&&(i[t]=e[t]);return fe.forEach((e=>{e in t&&(i[e]=t[e])})),i}function ye(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!ye(e[i],t[i]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==t){if("object"!=typeof t)return!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const i in e)if(!ye(e[i],t[i]))return!1;return!0}return e===t}function _e(e,t){e.push(t)}function ve(e,t,i){_e(i,{command:"addSource",args:[e,t[e]]})}function xe(e,t,i){_e(t,{command:"removeSource",args:[e]}),i[e]=!0}function be(e,t,i,r){xe(e,i,r),ve(e,t,i)}function we(e,t,i){let r;for(r in e[i])if(Object.prototype.hasOwnProperty.call(e[i],r)&&"data"!==r&&!ye(e[i][r],t[i][r]))return!1;for(r in t[i])if(Object.prototype.hasOwnProperty.call(t[i],r)&&"data"!==r&&!ye(e[i][r],t[i][r]))return!1;return!0}function Ce(e,t,i,r,n,o){e=e||{},t=t||{};for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(ye(e[a],t[a])||i.push({command:o,args:[r,a,t[a],n]}));for(const a in t)Object.prototype.hasOwnProperty.call(t,a)&&!Object.prototype.hasOwnProperty.call(e,a)&&(ye(e[a],t[a])||i.push({command:o,args:[r,a,t[a],n]}))}function Te(e){return e.id}function Se(e,t){return e[t.id]=t,e}class Ae{constructor(e,t,i,r){this.message=(e?`${e}: `:"")+i,r&&(this.identifier=r),null!=t&&t.__line__&&(this.line=t.__line__)}}function Me(e,...t){for(const i of t)for(const t in i)e[t]=i[t];return e}class Ee extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class Pe{constructor(e,t=[]){this.parent=e,this.bindings={};for(const[e,i]of t)this.bindings[e]=i}concat(e){return new Pe(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const Ie={kind:"null"},ke={kind:"number"},ze={kind:"string"},Le={kind:"boolean"},De={kind:"color"},Fe={kind:"projectionDefinition"},Re={kind:"object"},Be={kind:"value"},Oe={kind:"collator"},je={kind:"formatted"},Ne={kind:"padding"},$e={kind:"resolvedImage"},Ve={kind:"variableAnchorOffsetCollection"};function Ue(e,t){return{kind:"array",itemType:e,N:t}}function qe(e){if("array"===e.kind){const t=qe(e.itemType);return"number"==typeof e.N?`array<${t}, ${e.N}>`:"value"===e.itemType.kind?"array":`array<${t}>`}return e.kind}const Ze=[Ie,ke,ze,Le,De,Fe,je,Re,Ue(Be),Ne,$e,Ve];function Ge(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!Ge(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 Ze)if(!Ge(e,t))return null}return`Expected ${qe(e)} but found ${qe(t)} instead.`}function He(e,t){return t.some((t=>t.kind===e.kind))}function We(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))}function Ke(e,t){return"array"===e.kind&&"array"===t.kind?e.itemType.kind===t.itemType.kind&&"number"==typeof e.N:e.kind===t.kind}const Xe=.96422,Ye=.82521,Je=4/29,Qe=6/29,et=3*Qe*Qe,tt=Qe*Qe*Qe,it=Math.PI/180,rt=180/Math.PI;function nt(e){return(e%=360)<0&&(e+=360),e}function ot([e,t,i,r]){let n,o;const a=st((.2225045*(e=at(e))+.7168786*(t=at(t))+.0606169*(i=at(i)))/1);e===t&&t===i?n=o=a:(n=st((.4360747*e+.3850649*t+.1430804*i)/Xe),o=st((.0139322*e+.0971045*t+.7141733*i)/Ye));const s=116*a-16;return[s<0?0:s,500*(n-a),200*(a-o),r]}function at(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function st(e){return e>tt?Math.pow(e,1/3):e/et+Je}function lt([e,t,i,r]){let n=(e+16)/116,o=isNaN(t)?n:n+t/500,a=isNaN(i)?n:n-i/200;return n=1*ut(n),o=Xe*ut(o),a=Ye*ut(a),[ct(3.1338561*o-1.6168667*n-.4906146*a),ct(-.9787684*o+1.9161415*n+.033454*a),ct(.0719453*o-.2289914*n+1.4052427*a),r]}function ct(e){return(e=e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055)<0?0:e>1?1:e}function ut(e){return e>Qe?e*e*e:et*(e-Je)}function ht(e){return parseInt(e.padEnd(2,e),16)/255}function pt(e,t){return dt(t?e/100:e,0,1)}function dt(e,t,i){return Math.min(Math.max(t,e),i)}function mt(e){return!e.some(Number.isNaN)}const ft={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function gt(e,t,i){return e+i*(t-e)}function yt(e,t,i){return e.map(((e,r)=>gt(e,t[r],i)))}class _t{constructor(e,t,i,r=1,n=!0){this.r=e,this.g=t,this.b=i,this.a=r,n||(this.r*=r,this.g*=r,this.b*=r,r||this.overwriteGetter("rgb",[e,t,i,r]))}static parse(e){if(e instanceof _t)return e;if("string"!=typeof e)return;const t=function(e){if("transparent"===(e=e.toLowerCase().trim()))return[0,0,0,0];const t=ft[e];if(t){const[e,i,r]=t;return[e/255,i/255,r/255,1]}if(e.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){const t=e.length<6?1:2;let i=1;return[ht(e.slice(i,i+=t)),ht(e.slice(i,i+=t)),ht(e.slice(i,i+=t)),ht(e.slice(i,i+t)||"ff")]}if(e.startsWith("rgb")){const t=e.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(t){const[e,i,r,n,o,a,s,l,c,u,h,p]=t,d=[n||" ",s||" ",u].join("");if(" "===d||" /"===d||",,"===d||",,,"===d){const e=[r,a,c].join(""),t="%%%"===e?100:""===e?255:0;if(t){const e=[dt(+i/t,0,1),dt(+o/t,0,1),dt(+l/t,0,1),h?pt(+h,p):1];if(mt(e))return e}}return}}const i=e.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(i){const[e,t,r,n,o,a,s,l,c]=i,u=[r||" ",o||" ",s].join("");if(" "===u||" /"===u||",,"===u||",,,"===u){const e=[+t,dt(+n,0,100),dt(+a,0,100),l?pt(+l,c):1];if(mt(e))return function([e,t,i,r]){function n(r){const n=(r+e/30)%12,o=t*Math.min(i,1-i);return i-o*Math.max(-1,Math.min(n-3,9-n,1))}return e=nt(e),t/=100,i/=100,[n(0),n(8),n(4),r]}(e)}}}(e);return t?new _t(...t,!1):void 0}get rgb(){const{r:e,g:t,b:i,a:r}=this,n=r||1/0;return this.overwriteGetter("rgb",[e/n,t/n,i/n,r])}get hcl(){return this.overwriteGetter("hcl",function(e){const[t,i,r,n]=ot(e),o=Math.sqrt(i*i+r*r);return[Math.round(1e4*o)?nt(Math.atan2(r,i)*rt):NaN,o,t,n]}(this.rgb))}get lab(){return this.overwriteGetter("lab",ot(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){const[e,t,i,r]=this.rgb;return`rgba(${[e,t,i].map((e=>Math.round(255*e))).join(",")},${r})`}static interpolate(e,t,i,r="rgb"){switch(r){case"rgb":{const[r,n,o,a]=yt(e.rgb,t.rgb,i);return new _t(r,n,o,a,!1)}case"hcl":{const[r,n,o,a]=e.hcl,[s,l,c,u]=t.hcl;let h,p;if(isNaN(r)||isNaN(s))isNaN(r)?isNaN(s)?h=NaN:(h=s,1!==o&&0!==o||(p=l)):(h=r,1!==c&&0!==c||(p=n));else{let e=s-r;s>r&&e>180?e-=360:s<r&&r-s>180&&(e+=360),h=r+i*e}const[d,m,f,g]=function([e,t,i,r]){return e=isNaN(e)?0:e*it,lt([i,Math.cos(e)*t,Math.sin(e)*t,r])}([h,null!=p?p:gt(n,l,i),gt(o,c,i),gt(a,u,i)]);return new _t(d,m,f,g,!1)}case"lab":{const[r,n,o,a]=lt(yt(e.lab,t.lab,i));return new _t(r,n,o,a,!1)}}}}_t.black=new _t(0,0,0,1),_t.white=new _t(1,1,1,1),_t.transparent=new _t(0,0,0,0),_t.red=new _t(1,0,0,1);class vt{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}}const xt=["bottom","center","top"];class bt{constructor(e,t,i,r,n,o){this.text=e,this.image=t,this.scale=i,this.fontStack=r,this.textColor=n,this.verticalAlign=o}}class wt{constructor(e){this.sections=e}static fromString(e){return new wt([new bt(e,null,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 wt?e:wt.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map((e=>e.text)).join("")}}class Ct{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Ct)return e;if("number"==typeof e)return new Ct([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const t of e)if("number"!=typeof t)return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new Ct(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,i){return new Ct(yt(e.values,t.values,i))}}class Tt{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const St=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class At{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof At)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let t=0;t<e.length;t+=2){const i=e[t],r=e[t+1];if("string"!=typeof i||!St.has(i))return;if(!Array.isArray(r)||2!==r.length||"number"!=typeof r[0]||"number"!=typeof r[1])return}return new At(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,i){const r=e.values,n=t.values;if(r.length!==n.length)throw new Tt(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${t.toString()}`);const o=[];for(let e=0;e<r.length;e+=2){if(r[e]!==n[e])throw new Tt(`Cannot interpolate values containing mismatched anchors. from[${e}]: ${r[e]}, to[${e}]: ${n[e]}`);o.push(r[e]);const[t,a]=r[e+1],[s,l]=n[e+1];o.push([gt(t,s,i),gt(a,l,i)])}return new At(o)}}class Mt{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new Mt({name:e,available:!1}):null}}class Et{constructor(e,t,i){this.from=e,this.to=t,this.transition=i}static interpolate(e,t,i){return new Et(e,t,i)}static parse(e){return e instanceof Et?e:Array.isArray(e)&&3===e.length&&"string"==typeof e[0]&&"string"==typeof e[1]&&"number"==typeof e[2]?new Et(e[0],e[1],e[2]):"object"==typeof e&&"string"==typeof e.from&&"string"==typeof e.to&&"number"==typeof e.transition?new Et(e.from,e.to,e.transition):"string"==typeof e?new Et(e,e,1):void 0}}function Pt(e,t,i,r){return"number"==typeof e&&e>=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:`Invalid rgba value [${[e,t,i,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof r?[e,t,i,r]:[e,t,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function It(e){if(null===e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||e instanceof Et||e instanceof _t||e instanceof vt||e instanceof wt||e instanceof Ct||e instanceof At||e instanceof Mt)return!0;if(Array.isArray(e)){for(const t of e)if(!It(t))return!1;return!0}if("object"==typeof e){for(const t in e)if(!It(e[t]))return!1;return!0}return!1}function kt(e){if(null===e)return Ie;if("string"==typeof e)return ze;if("boolean"==typeof e)return Le;if("number"==typeof e)return ke;if(e instanceof _t)return De;if(e instanceof Et)return Fe;if(e instanceof vt)return Oe;if(e instanceof wt)return je;if(e instanceof Ct)return Ne;if(e instanceof At)return Ve;if(e instanceof Mt)return $e;if(Array.isArray(e)){const t=e.length;let i;for(const t of e){const e=kt(t);if(i){if(i===e)continue;i=Be;break}i=e}return Ue(i||Be,t)}return Re}function zt(e){const t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof _t||e instanceof Et||e instanceof wt||e instanceof Ct||e instanceof At||e instanceof Mt?e.toString():JSON.stringify(e)}class Lt{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(!It(e[1]))return t.error("invalid value");const i=e[1];let r=kt(i);const n=t.expectedType;return"array"!==r.kind||0!==r.N||!n||"array"!==n.kind||"number"==typeof n.N&&0!==n.N||(r=n),new Lt(r,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const Dt={string:ze,number:ke,boolean:Le,object:Re};class Ft{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,r=1;const n=e[0];if("array"===n){let n,o;if(e.length>2){const i=e[1];if("string"!=typeof i||!(i in Dt)||"object"===i)return t.error('The item type argument of "array" must be one of string, number, boolean',1);n=Dt[i],r++}else n=Be;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],r++}i=Ue(n,o)}else{if(!Dt[n])throw new Error(`Types doesn't contain name = ${n}`);i=Dt[n]}const o=[];for(;r<e.length;r++){const i=t.parse(e[r],r,Be);if(!i)return null;o.push(i)}return new Ft(i,o)}evaluate(e){for(let t=0;t<this.args.length;t++){const i=this.args[t].evaluate(e);if(!Ge(this.type,kt(i)))return i;if(t===this.args.length-1)throw new Tt(`Expected value to be of type ${qe(this.type)}, but found ${qe(kt(i))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}const Rt={"to-boolean":Le,"to-color":De,"to-number":ke,"to-string":ze};class Bt{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(!Rt[i])throw new Error(`Can't parse ${i} as it is not part of the known types`);if(("to-boolean"===i||"to-string"===i)&&2!==e.length)return t.error("Expected one argument.");const r=Rt[i],n=[];for(let i=1;i<e.length;i++){const r=t.parse(e[i],i,Be);if(!r)return null;n.push(r)}return new Bt(r,n)}evaluate(e){switch(this.type.kind){case"boolean":return Boolean(this.args[0].evaluate(e));case"color":{let t,i;for(const r of this.args){if(t=r.evaluate(e),i=null,t instanceof _t)return t;if("string"==typeof t){const i=e.parseColor(t);if(i)return i}else if(Array.isArray(t)&&(i=t.length<3||t.length>4?`Invalid rgba value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:Pt(t[0],t[1],t[2],t[3]),!i))return new _t(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new Tt(i||`Could not parse color from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"padding":{let t;for(const i of this.args){t=i.evaluate(e);const r=Ct.parse(t);if(r)return r}throw new Tt(`Could not parse padding from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"variableAnchorOffsetCollection":{let t;for(const i of this.args){t=i.evaluate(e);const r=At.parse(t);if(r)return r}throw new Tt(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"number":{let t=null;for(const i of this.args){if(t=i.evaluate(e),null===t)return 0;const r=Number(t);if(!isNaN(r))return r}throw new Tt(`Could not convert ${JSON.stringify(t)} to number.`)}case"formatted":return wt.fromString(zt(this.args[0].evaluate(e)));case"resolvedImage":return Mt.fromString(zt(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return zt(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}const Ot=["Unknown","Point","LineString","Polygon"];class jt{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?Ot[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let t=this._parseColorCache[e];return t||(t=this._parseColorCache[e]=_t.parse(e)),t}}class Nt{constructor(e,t,i=[],r,n=new Pe,o=[]){this.registry=e,this.path=i,this.key=i.map((e=>`[${e}]`)).join(""),this.scope=n,this.errors=o,this.expectedType=r,this._isConstant=t}parse(e,t,i,r,n={}){return t?this.concat(t,i,r)._parse(e,n):this._parse(e,n)}_parse(e,t){function i(e,t,i){return"assert"===i?new Ft(t,[e]):"coerce"===i?new Bt(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 r=e[0];if("string"!=typeof r)return this.error(`Expression name must be a string, but found ${typeof r} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const n=this.registry[r];if(n){let r=n.parse(e,this);if(!r)return null;if(this.expectedType){const e=this.expectedType,n=r.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==n.kind)if("projectionDefinition"!==e.kind||"string"!==n.kind&&"array"!==n.kind)if("color"!==e.kind&&"formatted"!==e.kind&&"resolvedImage"!==e.kind||"value"!==n.kind&&"string"!==n.kind)if("padding"!==e.kind||"value"!==n.kind&&"number"!==n.kind&&"array"!==n.kind)if("variableAnchorOffsetCollection"!==e.kind||"value"!==n.kind&&"array"!==n.kind){if(this.checkSubtype(e,n))return null}else r=i(r,e,t.typeAnnotation||"coerce");else r=i(r,e,t.typeAnnotation||"coerce");else r=i(r,e,t.typeAnnotation||"coerce");else r=i(r,e,t.typeAnnotation||"coerce");else r=i(r,e,t.typeAnnotation||"assert")}if(!(r instanceof Lt)&&"resolvedImage"!==r.type.kind&&this._isConstant(r)){const t=new jt;try{r=new Lt(r.type,r.evaluate(t))}catch(e){return this.error(e.message),null}}return r}return this.error(`Unknown expression "${r}". 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 r="number"==typeof e?this.path.concat(e):this.path,n=i?this.scope.concat(i):this.scope;return new Nt(this.registry,this._isConstant,r,t||null,n,this.errors)}error(e,...t){const i=`${this.key}${t.map((e=>`[${e}]`)).join("")}`;this.errors.push(new Ee(i,e))}checkSubtype(e,t){const i=Ge(e,t);return i&&this.error(i),i}}class $t{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 r=1;r<e.length-1;r+=2){const n=e[r];if("string"!=typeof n)return t.error(`Expected string, but found ${typeof n} instead.`,r);if(/[^a-zA-Z0-9_]/.test(n))return t.error("Variable names must contain only alphanumeric characters or '_'.",r);const o=t.parse(e[r+1],r+1);if(!o)return null;i.push([n,o])}const r=t.parse(e[e.length-1],e.length-1,t.expectedType,i);return r?new $t(i,r):null}outputDefined(){return this.result.outputDefined()}}class Vt{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 Vt(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}}class Ut{constructor(e,t,i){this.type=e,this.index=t,this.input=i}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,ke),r=t.parse(e[2],2,Ue(t.expectedType||Be));return i&&r?new Ut(r.type.itemType,i,r):null}evaluate(e){const t=this.index.evaluate(e),i=this.input.evaluate(e);if(t<0)throw new Tt(`Array index out of bounds: ${t} < 0.`);if(t>=i.length)throw new Tt(`Array index out of bounds: ${t} > ${i.length-1}.`);if(t!==Math.floor(t))throw new Tt(`Array index must be an integer, but found ${t} instead.`);return i[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class qt{constructor(e,t){this.type=Le,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,Be),r=t.parse(e[2],2,Be);return i&&r?He(i.type,[Le,ze,ke,Ie,Be])?new qt(i,r):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${qe(i.type)} instead`):null}evaluate(e){const t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!i)return!1;if(!We(t,["boolean","string","number","null"]))throw new Tt(`Expected first argument to be of type boolean, string, number or null, but found ${qe(kt(t))} instead.`);if(!We(i,["string","array"]))throw new Tt(`Expected second argument to be of type array or string, but found ${qe(kt(i))} instead.`);return i.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Zt{constructor(e,t,i){this.type=ke,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,Be),r=t.parse(e[2],2,Be);if(!i||!r)return null;if(!He(i.type,[Le,ze,ke,Ie,Be]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${qe(i.type)} instead`);if(4===e.length){const n=t.parse(e[3],3,ke);return n?new Zt(i,r,n):null}return new Zt(i,r)}evaluate(e){const t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!We(t,["boolean","string","number","null"]))throw new Tt(`Expected first argument to be of type boolean, string, number or null, but found ${qe(kt(t))} instead.`);let r;if(this.fromIndex&&(r=this.fromIndex.evaluate(e)),We(i,["string"])){const e=i.indexOf(t,r);return-1===e?-1:[...i.slice(0,e)].length}if(We(i,["array"]))return i.indexOf(t,r);throw new Tt(`Expected second argument to be of type array or string, but found ${qe(kt(i))} instead.`)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class Gt{constructor(e,t,i,r,n,o){this.inputType=e,this.type=t,this.input=i,this.cases=r,this.outputs=n,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,r;t.expectedType&&"value"!==t.expectedType.kind&&(r=t.expectedType);const n={},o=[];for(let a=2;a<e.length-1;a+=2){let s=e[a];const l=e[a+1];Array.isArray(s)||(s=[s]);const c=t.concat(a);if(0===s.length)return c.error("Expected at least one branch label.");for(const e of s){if("number"!=typeof e&&"string"!=typeof e)return c.error("Branch labels must be numbers or strings.");if("number"==typeof e&&Math.abs(e)>Number.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,kt(e)))return null}else i=kt(e);if(void 0!==n[String(e)])return c.error("Branch labels must be unique.");n[String(e)]=o.length}const u=t.parse(l,a,r);if(!u)return null;r=r||u.type,o.push(u)}const a=t.parse(e[1],1,Be);if(!a)return null;const s=t.parse(e[e.length-1],e.length-1,r);return s?"value"!==a.type.kind&&t.concat(1).checkSubtype(i,a.type)?null:new Gt(i,r,a,n,o,s):null}evaluate(e){const t=this.input.evaluate(e);return(kt(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()}}class Ht{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 r=[];for(let n=1;n<e.length-1;n+=2){const o=t.parse(e[n],n,Le);if(!o)return null;const a=t.parse(e[n+1],n+1,i);if(!a)return null;r.push([o,a]),i=i||a.type}const n=t.parse(e[e.length-1],e.length-1,i);if(!n)return null;if(!i)throw new Error("Can't infer output type");return new Ht(i,r,n)}evaluate(e){for(const[t,i]of this.branches)if(t.evaluate(e))return i.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[t,i]of this.branches)e(t),e(i);e(this.otherwise)}outputDefined(){return this.branches.every((([e,t])=>t.outputDefined()))&&this.otherwise.outputDefined()}}class Wt{constructor(e,t,i,r){this.type=e,this.input=t,this.beginIndex=i,this.endIndex=r}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,Be),r=t.parse(e[2],2,ke);if(!i||!r)return null;if(!He(i.type,[Ue(Be),ze,Be]))return t.error(`Expected first argument to be of type array or string, but found ${qe(i.type)} instead`);if(4===e.length){const n=t.parse(e[3],3,ke);return n?new Wt(i.type,i,r,n):null}return new Wt(i.type,i,r)}evaluate(e){const t=this.input.evaluate(e),i=this.beginIndex.evaluate(e);let r;if(this.endIndex&&(r=this.endIndex.evaluate(e)),We(t,["string"]))return[...t].slice(i,r).join("");if(We(t,["array"]))return t.slice(i,r);throw new Tt(`Expected first argument to be of type array or string, but found ${qe(kt(t))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Kt(e,t){const i=e.length-1;let r,n,o=0,a=i,s=0;for(;o<=a;)if(s=Math.floor((o+a)/2),r=e[s],n=e[s+1],r<=t){if(s===i||t<n)return s;o=s+1}else{if(!(r>t))throw new Tt("Input is not a number.");a=s-1}return 0}class Xt{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,ke);if(!i)return null;const r=[];let n=null;t.expectedType&&"value"!==t.expectedType.kind&&(n=t.expectedType);for(let i=1;i<e.length;i+=2){const o=1===i?-1/0:e[i],a=e[i+1],s=i,l=i+1;if("number"!=typeof o)return t.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',s);if(r.length&&r[r.length-1][0]>=o)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',s);const c=t.parse(a,l,n);if(!c)return null;n=n||c.type,r.push([o,c])}return new Xt(n,i,r)}evaluate(e){const t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);const r=this.input.evaluate(e);if(r<=t[0])return i[0].evaluate(e);const n=t.length;return r>=t[n-1]?i[n-1].evaluate(e):i[Kt(t,r)].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function Yt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Jt,Qt,ei=function(){if(Qt)return Jt;function e(e,t,i,r){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*(r-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=i,this.p2y=r}return Qt=1,Jt=e,e.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,r=0;r<8;r++){var n=this.sampleCurveX(i)-e;if(Math.abs(n)<t)return i;var o=this.sampleCurveDerivativeX(i);if(Math.abs(o)<1e-6)break;i-=n/o}var a=0,s=1;for(i=e,r=0;r<20&&(n=this.sampleCurveX(i),!(Math.abs(n-e)<t));r++)e>n?a=i:s=i,i=.5*(s-a)+a;return i},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},Jt}(),ti=Yt(ei);class ii{constructor(e,t,i,r,n){this.type=e,this.operator=t,this.interpolation=i,this.input=r,this.labels=[],this.outputs=[];for(const[e,t]of n)this.labels.push(e),this.outputs.push(t)}static interpolationFactor(e,t,i,r){let n=0;if("exponential"===e.name)n=ri(t,e.base,i,r);else if("linear"===e.name)n=ri(t,1,i,r);else if("cubic-bezier"===e.name){const o=e.controlPoints;n=new ti(o[0],o[1],o[2],o[3]).solve(ri(t,1,i,r))}return n}static parse(e,t){let[i,r,n,...o]=e;if(!Array.isArray(r)||0===r.length)return t.error("Expected an interpolation type expression.",1);if("linear"===r[0])r={name:"linear"};else if("exponential"===r[0]){const e=r[1];if("number"!=typeof e)return t.error("Exponential interpolation requires a numeric base.",1,1);r={name:"exponential",base:e}}else{if("cubic-bezier"!==r[0])return t.error(`Unknown interpolation type ${String(r[0])}`,1,0);{const e=r.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);r={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(n=t.parse(n,2,ke),!n)return null;const a=[];let s=null;"interpolate-hcl"===i||"interpolate-lab"===i?s=De:t.expectedType&&"value"!==t.expectedType.kind&&(s=t.expectedType);for(let e=0;e<o.length;e+=2){const i=o[e],r=o[e+1],n=e+3,l=e+4;if("number"!=typeof i)return t.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',n);if(a.length&&a[a.length-1][0]>=i)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',n);const c=t.parse(r,l,s);if(!c)return null;s=s||c.type,a.push([i,c])}return Ke(s,ke)||Ke(s,Fe)||Ke(s,De)||Ke(s,Ne)||Ke(s,Ve)||Ke(s,Ue(ke))?new ii(s,i,r,n,a):t.error(`Type ${qe(s)} is not interpolatable.`)}evaluate(e){const t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);const r=this.input.evaluate(e);if(r<=t[0])return i[0].evaluate(e);const n=t.length;if(r>=t[n-1])return i[n-1].evaluate(e);const o=Kt(t,r),a=ii.interpolationFactor(this.interpolation,r,t[o],t[o+1]),s=i[o].evaluate(e),l=i[o+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return gt(s,l,a);case"color":return _t.interpolate(s,l,a);case"padding":return Ct.interpolate(s,l,a);case"variableAnchorOffsetCollection":return At.interpolate(s,l,a);case"array":return yt(s,l,a);case"projectionDefinition":return Et.interpolate(s,l,a)}case"interpolate-hcl":return _t.interpolate(s,l,a,"hcl");case"interpolate-lab":return _t.interpolate(s,l,a,"lab")}}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function ri(e,t,i,r){const n=r-i,o=e-i;return 0===n?0:1===t?o/n:(Math.pow(t,o)-1)/(Math.pow(t,n)-1)}const ni={color:_t.interpolate,number:gt,padding:Ct.interpolate,variableAnchorOffsetCollection:At.interpolate,array:yt};class oi{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=null;const r=t.expectedType;r&&"value"!==r.kind&&(i=r);const n=[];for(const r of e.slice(1)){const e=t.parse(r,1+n.length,i,void 0,{typeAnnotation:"omit"});if(!e)return null;i=i||e.type,n.push(e)}if(!i)throw new Error("No output type");const o=r&&n.some((e=>Ge(r,e.type)));return new oi(o?Be:i,n)}evaluate(e){let t,i=null,r=0;for(const n of this.args)if(r++,i=n.evaluate(e),i&&i instanceof Mt&&!i.available&&(t||(t=i.name),i=null,r===this.args.length&&(i=t)),null!==i)break;return i}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}function ai(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 si(e,t,i,r){return 0===r.compare(t,i)}function li(e,t,i){const r="=="!==e&&"!="!==e;return class n{constructor(e,t,i){this.type=Le,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,Be);if(!o)return null;if(!ai(i,o.type))return t.concat(1).error(`"${i}" comparisons are not supported for type '${qe(o.type)}'.`);let a=t.parse(e[2],2,Be);if(!a)return null;if(!ai(i,a.type))return t.concat(2).error(`"${i}" comparisons are not supported for type '${qe(a.type)}'.`);if(o.type.kind!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return t.error(`Cannot compare types '${qe(o.type)}' and '${qe(a.type)}'.`);r&&("value"===o.type.kind&&"value"!==a.type.kind?o=new Ft(a.type,[o]):"value"!==o.type.kind&&"value"===a.type.kind&&(a=new Ft(o.type,[a])));let s=null;if(4===e.length){if("string"!==o.type.kind&&"string"!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return t.error("Cannot use collator to compare non-string types.");if(s=t.parse(e[3],3,Oe),!s)return null}return new n(o,a,s)}evaluate(n){const o=this.lhs.evaluate(n),a=this.rhs.evaluate(n);if(r&&this.hasUntypedArgument){const t=kt(o),i=kt(a);if(t.kind!==i.kind||"string"!==t.kind&&"number"!==t.kind)throw new Tt(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${i.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){const e=kt(o),i=kt(a);if("string"!==e.kind||"string"!==i.kind)return t(n,o,a)}return this.collator?i(n,o,a,this.collator.evaluate(n)):t(n,o,a)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}}}const ci=li("==",(function(e,t,i){return t===i}),si),ui=li("!=",(function(e,t,i){return t!==i}),(function(e,t,i,r){return!si(0,t,i,r)})),hi=li("<",(function(e,t,i){return t<i}),(function(e,t,i,r){return r.compare(t,i)<0})),pi=li(">",(function(e,t,i){return t>i}),(function(e,t,i,r){return r.compare(t,i)>0})),di=li("<=",(function(e,t,i){return t<=i}),(function(e,t,i,r){return r.compare(t,i)<=0})),mi=li(">=",(function(e,t,i){return t>=i}),(function(e,t,i,r){return r.compare(t,i)>=0}));class fi{constructor(e,t,i){this.type=Oe,this.locale=i,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(2!==e.length)return t.error("Expected one argument.");const i=e[1];if("object"!=typeof i||Array.isArray(i))return t.error("Collator options argument must be an object.");const r=t.parse(void 0!==i["case-sensitive"]&&i["case-sensitive"],1,Le);if(!r)return null;const n=t.parse(void 0!==i["diacritic-sensitive"]&&i["diacritic-sensitive"],1,Le);if(!n)return null;let o=null;return i.locale&&(o=t.parse(i.locale,1,ze),!o)?null:new fi(r,n,o)}evaluate(e){return new vt(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}class gi{constructor(e,t,i,r,n){this.type=ze,this.number=e,this.locale=t,this.currency=i,this.minFractionDigits=r,this.maxFractionDigits=n}static parse(e,t){if(3!==e.length)return t.error("Expected two arguments.");const i=t.parse(e[1],1,ke);if(!i)return null;const r=e[2];if("object"!=typeof r||Array.isArray(r))return t.error("NumberFormat options argument must be an object.");let n=null;if(r.locale&&(n=t.parse(r.locale,1,ze),!n))return null;let o=null;if(r.currency&&(o=t.parse(r.currency,1,ze),!o))return null;let a=null;if(r["min-fraction-digits"]&&(a=t.parse(r["min-fraction-digits"],1,ke),!a))return null;let s=null;return r["max-fraction-digits"]&&(s=t.parse(r["max-fraction-digits"],1,ke),!s)?null:new gi(i,n,o,a,s)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class yi{constructor(e){this.type=je,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 r=[];let n=!1;for(let i=1;i<=e.length-1;++i){const o=e[i];if(n&&"object"==typeof o&&!Array.isArray(o)){n=!1;let e=null;if(o["font-scale"]&&(e=t.parse(o["font-scale"],1,ke),!e))return null;let i=null;if(o["text-font"]&&(i=t.parse(o["text-font"],1,Ue(ze)),!i))return null;let a=null;if(o["text-color"]&&(a=t.parse(o["text-color"],1,De),!a))return null;let s=null;if(o["vertical-align"]){if("string"==typeof o["vertical-align"]&&!xt.includes(o["vertical-align"]))return t.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${o["vertical-align"]}' instead.`);if(s=t.parse(o["vertical-align"],1,ze),!s)return null}const l=r[r.length-1];l.scale=e,l.font=i,l.textColor=a,l.verticalAlign=s}else{const o=t.parse(e[i],1,Be);if(!o)return null;const a=o.type.kind;if("string"!==a&&"value"!==a&&"null"!==a&&"resolvedImage"!==a)return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");n=!0,r.push({content:o,scale:null,font:null,textColor:null,verticalAlign:null})}}return new yi(r)}evaluate(e){return new wt(this.sections.map((t=>{const i=t.content.evaluate(e);return kt(i)===$e?new bt("",i,null,null,null,t.verticalAlign?t.verticalAlign.evaluate(e):null):new bt(zt(i),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(","):null,t.textColor?t.textColor.evaluate(e):null,t.verticalAlign?t.verticalAlign.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),t.verticalAlign&&e(t.verticalAlign)}outputDefined(){return!1}}class _i{constructor(e){this.type=$e,this.input=e}static parse(e,t){if(2!==e.length)return t.error("Expected two arguments.");const i=t.parse(e[1],1,ze);return i?new _i(i):t.error("No image name provided.")}evaluate(e){const t=this.input.evaluate(e),i=Mt.fromString(t);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(t)>-1),i}eachChild(e){e(this.input)}outputDefined(){return!1}}class vi{constructor(e){this.type=ke,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 ${qe(i.type)} instead.`):new vi(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 Tt(`Expected value to be of type string or array, but found ${qe(kt(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const xi=8192;function bi(e,t){const i=(180+e[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e[1]*Math.PI/360)))/360,n=Math.pow(2,t.z);return[Math.round(i*n*xi),Math.round(r*n*xi)]}function wi(e,t){const i=Math.pow(2,t.z);return[(n=(e[0]/xi+t.x)/i,360*n-180),(r=(e[1]/xi+t.y)/i,360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90)];var r,n}function Ci(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function Ti(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function Si(e,t,i){const r=e[0]-t[0],n=e[1]-t[1],o=e[0]-i[0],a=e[1]-i[1];return r*a-o*n==0&&r*o<=0&&n*a<=0}function Ai(e,t,i,r){return 0!=(n=[r[0]-i[0],r[1]-i[1]])[0]*(o=[t[0]-e[0],t[1]-e[1]])[1]-n[1]*o[0]&&!(!zi(e,t,i,r)||!zi(i,r,e,t));var n,o}function Mi(e,t,i){for(const r of i)for(let i=0;i<r.length-1;++i)if(Ai(e,t,r[i],r[i+1]))return!0;return!1}function Ei(e,t,i=!1){let r=!1;for(const s of t)for(let t=0;t<s.length-1;t++){if(Si(e,s[t],s[t+1]))return i;(o=s[t])[1]>(n=e)[1]!=(a=s[t+1])[1]>n[1]&&n[0]<(a[0]-o[0])*(n[1]-o[1])/(a[1]-o[1])+o[0]&&(r=!r)}var n,o,a;return r}function Pi(e,t){for(const i of t)if(Ei(e,i))return!0;return!1}function Ii(e,t){for(const i of e)if(!Ei(i,t))return!1;for(let i=0;i<e.length-1;++i)if(Mi(e[i],e[i+1],t))return!1;return!0}function ki(e,t){for(const i of t)if(Ii(e,i))return!0;return!1}function zi(e,t,i,r){const n=r[0]-i[0],o=r[1]-i[1],a=(e[0]-i[0])*o-n*(e[1]-i[1]),s=(t[0]-i[0])*o-n*(t[1]-i[1]);return a>0&&s<0||a<0&&s>0}function Li(e,t,i){const r=[];for(let n=0;n<e.length;n++){const o=[];for(let r=0;r<e[n].length;r++){const a=bi(e[n][r],i);Ci(t,a),o.push(a)}r.push(o)}return r}function Di(e,t,i){const r=[];for(let n=0;n<e.length;n++){const o=Li(e[n],t,i);r.push(o)}return r}function Fi(e,t,i,r){if(e[0]<i[0]||e[0]>i[2]){const t=.5*r;let n=e[0]-i[0]>t?-r:i[0]-e[0]>t?r:0;0===n&&(n=e[0]-i[2]>t?-r:i[2]-e[0]>t?r:0),e[0]+=n}Ci(t,e)}function Ri(e,t,i,r){const n=Math.pow(2,r.z)*xi,o=[r.x*xi,r.y*xi],a=[];for(const r of e)for(const e of r){const r=[e.x+o[0],e.y+o[1]];Fi(r,t,i,n),a.push(r)}return a}function Bi(e,t,i,r){const n=Math.pow(2,r.z)*xi,o=[r.x*xi,r.y*xi],a=[];for(const i of e){const e=[];for(const r of i){const i=[r.x+o[0],r.y+o[1]];Ci(t,i),e.push(i)}a.push(e)}if(t[2]-t[0]<=n/2){(s=t)[0]=s[1]=1/0,s[2]=s[3]=-1/0;for(const e of a)for(const r of e)Fi(r,t,i,n)}var s;return a}class Oi{constructor(e,t){this.type=Le,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(It(e[1])){const t=e[1];if("FeatureCollection"===t.type){const e=[];for(const i of t.features){const{type:t,coordinates:r}=i.geometry;"Polygon"===t&&e.push(r),"MultiPolygon"===t&&e.push(...r)}if(e.length)return new Oi(t,{type:"MultiPolygon",coordinates:e})}else if("Feature"===t.type){const e=t.geometry.type;if("Polygon"===e||"MultiPolygon"===e)return new Oi(t,t.geometry)}else if("Polygon"===t.type||"MultiPolygon"===t.type)return new Oi(t,t)}return t.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){const i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if("Polygon"===t.type){const o=Li(t.coordinates,r,n),a=Ri(e.geometry(),i,r,n);if(!Ti(i,r))return!1;for(const e of a)if(!Ei(e,o))return!1}if("MultiPolygon"===t.type){const o=Di(t.coordinates,r,n),a=Ri(e.geometry(),i,r,n);if(!Ti(i,r))return!1;for(const e of a)if(!Pi(e,o))return!1}return!0}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){const i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if("Polygon"===t.type){const o=Li(t.coordinates,r,n),a=Bi(e.geometry(),i,r,n);if(!Ti(i,r))return!1;for(const e of a)if(!Ii(e,o))return!1}if("MultiPolygon"===t.type){const o=Di(t.coordinates,r,n),a=Bi(e.geometry(),i,r,n);if(!Ti(i,r))return!1;for(const e of a)if(!ki(e,o))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let ji=class{constructor(e=[],t=(e,t)=>e<t?-1:e>t?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;const e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:i}=this,r=t[e];for(;e>0;){const n=e-1>>1,o=t[n];if(i(r,o)>=0)break;t[e]=o,e=n}t[e]=r}_down(e){const{data:t,compare:i}=this,r=this.length>>1,n=t[e];for(;e<r;){let r=1+(e<<1);const o=r+1;if(o<this.length&&i(t[o],t[r])<0&&(r=o),i(t[r],n)>=0)break;t[e]=t[r],e=r}t[e]=n}};function Ni(e,t,i=0,r=e.length-1,n=Vi){for(;r>i;){if(r-i>600){const o=r-i+1,a=t-i+1,s=Math.log(o),l=.5*Math.exp(2*s/3),c=.5*Math.sqrt(s*l*(o-l)/o)*(a-o/2<0?-1:1);Ni(e,t,Math.max(i,Math.floor(t-a*l/o+c)),Math.min(r,Math.floor(t+(o-a)*l/o+c)),n)}const o=e[t];let a=i,s=r;for($i(e,i,t),n(e[r],o)>0&&$i(e,i,r);a<s;){for($i(e,a,s),a++,s--;n(e[a],o)<0;)a++;for(;n(e[s],o)>0;)s--}0===n(e[i],o)?$i(e,i,s):(s++,$i(e,s,r)),s<=t&&(i=s+1),t<=s&&(r=s-1)}}function $i(e,t,i){const r=e[t];e[t]=e[i],e[i]=r}function Vi(e,t){return e<t?-1:e>t?1:0}function Ui(e,t){if(e.length<=1)return[e];const i=[];let r,n;for(const t of e){const e=Zi(t);0!==e&&(t.area=Math.abs(e),void 0===n&&(n=e<0),n===e<0?(r&&i.push(r),r=[t]):r.push(t))}if(r&&i.push(r),t>1)for(let e=0;e<i.length;e++)i[e].length<=t||(Ni(i[e],t,1,i[e].length-1,qi),i[e]=i[e].slice(0,t));return i}function qi(e,t){return t.area-e.area}function Zi(e){let t=0;for(let i,r,n=0,o=e.length,a=o-1;n<o;a=n++)i=e[n],r=e[a],t+=(r.x-i.x)*(i.y+r.y);return t}const Gi=1/298.257223563,Hi=Gi*(2-Gi),Wi=Math.PI/180;class Ki{constructor(e){const t=6378.137*Wi*1e3,i=Math.cos(e*Wi),r=1/(1-Hi*(1-i*i)),n=Math.sqrt(r);this.kx=t*n*i,this.ky=t*n*r*(1-Hi)}distance(e,t){const i=this.wrap(e[0]-t[0])*this.kx,r=(e[1]-t[1])*this.ky;return Math.sqrt(i*i+r*r)}pointOnLine(e,t){let i,r,n,o,a=1/0;for(let s=0;s<e.length-1;s++){let l=e[s][0],c=e[s][1],u=this.wrap(e[s+1][0]-l)*this.kx,h=(e[s+1][1]-c)*this.ky,p=0;0===u&&0===h||(p=(this.wrap(t[0]-l)*this.kx*u+(t[1]-c)*this.ky*h)/(u*u+h*h),p>1?(l=e[s+1][0],c=e[s+1][1]):p>0&&(l+=u/this.kx*p,c+=h/this.ky*p)),u=this.wrap(t[0]-l)*this.kx,h=(t[1]-c)*this.ky;const d=u*u+h*h;d<a&&(a=d,i=l,r=c,n=s,o=p)}return{point:[i,r],index:n,t:Math.max(0,Math.min(1,o))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}}function Xi(e,t){return t[0]-e[0]}function Yi(e){return e[1]-e[0]+1}function Ji(e,t){return e[1]>=e[0]&&e[1]<t}function Qi(e,t){if(e[0]>e[1])return[null,null];const i=Yi(e);if(t){if(2===i)return[e,null];const t=Math.floor(i/2);return[[e[0],e[0]+t],[e[0]+t,e[1]]]}if(1===i)return[e,null];const r=Math.floor(i/2)-1;return[[e[0],e[0]+r],[e[0]+r+1,e[1]]]}function er(e,t){if(!Ji(t,e.length))return[1/0,1/0,-1/0,-1/0];const i=[1/0,1/0,-1/0,-1/0];for(let r=t[0];r<=t[1];++r)Ci(i,e[r]);return i}function tr(e){const t=[1/0,1/0,-1/0,-1/0];for(const i of e)for(const e of i)Ci(t,e);return t}function ir(e){return e[0]!==-1/0&&e[1]!==-1/0&&e[2]!==1/0&&e[3]!==1/0}function rr(e,t,i){if(!ir(e)||!ir(t))return NaN;let r=0,n=0;return e[2]<t[0]&&(r=t[0]-e[2]),e[0]>t[2]&&(r=e[0]-t[2]),e[1]>t[3]&&(n=e[1]-t[3]),e[3]<t[1]&&(n=t[1]-e[3]),i.distance([0,0],[r,n])}function nr(e,t,i){const r=i.pointOnLine(t,e);return i.distance(e,r.point)}function or(e,t,i,r,n){const o=Math.min(nr(e,[i,r],n),nr(t,[i,r],n)),a=Math.min(nr(i,[e,t],n),nr(r,[e,t],n));return Math.min(o,a)}function ar(e,t,i,r,n){if(!Ji(t,e.length)||!Ji(r,i.length))return 1/0;let o=1/0;for(let a=t[0];a<t[1];++a){const t=e[a],s=e[a+1];for(let e=r[0];e<r[1];++e){const r=i[e],a=i[e+1];if(Ai(t,s,r,a))return 0;o=Math.min(o,or(t,s,r,a,n))}}return o}function sr(e,t,i,r,n){if(!Ji(t,e.length)||!Ji(r,i.length))return NaN;let o=1/0;for(let a=t[0];a<=t[1];++a)for(let t=r[0];t<=r[1];++t)if(o=Math.min(o,n.distance(e[a],i[t])),0===o)return o;return o}function lr(e,t,i){if(Ei(e,t,!0))return 0;let r=1/0;for(const n of t){const t=n[0],o=n[n.length-1];if(t!==o&&(r=Math.min(r,nr(e,[o,t],i)),0===r))return r;const a=i.pointOnLine(n,e);if(r=Math.min(r,i.distance(e,a.point)),0===r)return r}return r}function cr(e,t,i,r){if(!Ji(t,e.length))return NaN;for(let r=t[0];r<=t[1];++r)if(Ei(e[r],i,!0))return 0;let n=1/0;for(let o=t[0];o<t[1];++o){const t=e[o],a=e[o+1];for(const e of i)for(let i=0,o=e.length,s=o-1;i<o;s=i++){const o=e[s],l=e[i];if(Ai(t,a,o,l))return 0;n=Math.min(n,or(t,a,o,l,r))}}return n}function ur(e,t){for(const i of e)for(const e of i)if(Ei(e,t,!0))return!0;return!1}function hr(e,t,i,r=1/0){const n=tr(e),o=tr(t);if(r!==1/0&&rr(n,o,i)>=r)return r;if(Ti(n,o)){if(ur(e,t))return 0}else if(ur(t,e))return 0;let a=1/0;for(const r of e)for(let e=0,n=r.length,o=n-1;e<n;o=e++){const n=r[o],s=r[e];for(const e of t)for(let t=0,r=e.length,o=r-1;t<r;o=t++){const r=e[o],l=e[t];if(Ai(n,s,r,l))return 0;a=Math.min(a,or(n,s,r,l,i))}}return a}function pr(e,t,i,r,n,o){if(!o)return;const a=rr(er(r,o),n,i);a<t&&e.push([a,o,[0,0]])}function dr(e,t,i,r,n,o,a){if(!o||!a)return;const s=rr(er(r,o),er(n,a),i);s<t&&e.push([s,o,a])}function mr(e,t,i,r,n=1/0){let o=Math.min(r.distance(e[0],i[0][0]),n);if(0===o)return o;const a=new ji([[0,[0,e.length-1],[0,0]]],Xi),s=tr(i);for(;a.length>0;){const n=a.pop();if(n[0]>=o)continue;const l=n[1],c=t?50:100;if(Yi(l)<=c){if(!Ji(l,e.length))return NaN;if(t){const t=cr(e,l,i,r);if(isNaN(t)||0===t)return t;o=Math.min(o,t)}else for(let t=l[0];t<=l[1];++t){const n=lr(e[t],i,r);if(o=Math.min(o,n),0===o)return 0}}else{const i=Qi(l,t);pr(a,o,r,e,s,i[0]),pr(a,o,r,e,s,i[1])}}return o}function fr(e,t,i,r,n,o=1/0){let a=Math.min(o,n.distance(e[0],i[0]));if(0===a)return a;const s=new ji([[0,[0,e.length-1],[0,i.length-1]]],Xi);for(;s.length>0;){const o=s.pop();if(o[0]>=a)continue;const l=o[1],c=o[2],u=t?50:100,h=r?50:100;if(Yi(l)<=u&&Yi(c)<=h){if(!Ji(l,e.length)&&Ji(c,i.length))return NaN;let o;if(t&&r)o=ar(e,l,i,c,n),a=Math.min(a,o);else if(t&&!r){const t=e.slice(l[0],l[1]+1);for(let e=c[0];e<=c[1];++e)if(o=nr(i[e],t,n),a=Math.min(a,o),0===a)return a}else if(!t&&r){const t=i.slice(c[0],c[1]+1);for(let i=l[0];i<=l[1];++i)if(o=nr(e[i],t,n),a=Math.min(a,o),0===a)return a}else o=sr(e,l,i,c,n),a=Math.min(a,o)}else{const o=Qi(l,t),u=Qi(c,r);dr(s,a,n,e,i,o[0],u[0]),dr(s,a,n,e,i,o[0],u[1]),dr(s,a,n,e,i,o[1],u[0]),dr(s,a,n,e,i,o[1],u[1])}}return a}function gr(e){return"MultiPolygon"===e.type?e.coordinates.map((e=>({type:"Polygon",coordinates:e}))):"MultiLineString"===e.type?e.coordinates.map((e=>({type:"LineString",coordinates:e}))):"MultiPoint"===e.type?e.coordinates.map((e=>({type:"Point",coordinates:e}))):[e]}class yr{constructor(e,t){this.type=ke,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(It(e[1])){const t=e[1];if("FeatureCollection"===t.type)return new yr(t,t.features.map((e=>gr(e.geometry))).flat());if("Feature"===t.type)return new yr(t,gr(t.geometry));if("type"in t&&"coordinates"in t)return new yr(t,gr(t))}return t.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){const i=e.geometry(),r=i.flat().map((t=>wi([t.x,t.y],e.canonical)));if(0===i.length)return NaN;const n=new Ki(r[0][1]);let o=1/0;for(const e of t){switch(e.type){case"Point":o=Math.min(o,fr(r,!1,[e.coordinates],!1,n,o));break;case"LineString":o=Math.min(o,fr(r,!1,e.coordinates,!0,n,o));break;case"Polygon":o=Math.min(o,mr(r,!1,e.coordinates,n,o))}if(0===o)return o}return o}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){const i=e.geometry(),r=i.flat().map((t=>wi([t.x,t.y],e.canonical)));if(0===i.length)return NaN;const n=new Ki(r[0][1]);let o=1/0;for(const e of t){switch(e.type){case"Point":o=Math.min(o,fr(r,!0,[e.coordinates],!1,n,o));break;case"LineString":o=Math.min(o,fr(r,!0,e.coordinates,!0,n,o));break;case"Polygon":o=Math.min(o,mr(r,!0,e.coordinates,n,o))}if(0===o)return o}return o}(e,this.geometries);if("Polygon"===e.geometryType())return function(e,t){const i=e.geometry();if(0===i.length||0===i[0].length)return NaN;const r=Ui(i,0).map((t=>t.map((t=>t.map((t=>wi([t.x,t.y],e.canonical))))))),n=new Ki(r[0][0][0][1]);let o=1/0;for(const e of t)for(const t of r){switch(e.type){case"Point":o=Math.min(o,mr([e.coordinates],!1,t,n,o));break;case"LineString":o=Math.min(o,mr(e.coordinates,!0,t,n,o));break;case"Polygon":o=Math.min(o,hr(t,e.coordinates,n,o))}if(0===o)return o}return o}(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const _r={"==":ci,"!=":ui,">":pi,"<":hi,">=":mi,"<=":di,array:Ft,at:Ut,boolean:Ft,case:Ht,coalesce:oi,collator:fi,format:yi,image:_i,in:qt,"index-of":Zt,interpolate:ii,"interpolate-hcl":ii,"interpolate-lab":ii,length:vi,let:$t,literal:Lt,match:Gt,number:Ft,"number-format":gi,object:Ft,slice:Wt,step:Xt,string:Ft,"to-boolean":Bt,"to-color":Bt,"to-number":Bt,"to-string":Bt,var:Vt,within:Oi,distance:yr};class vr{constructor(e,t,i,r){this.name=e,this.type=t,this._evaluate=i,this.args=r}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,t){const i=e[0],r=vr.definitions[i];if(!r)return t.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const n=Array.isArray(r)?r[0]:r.type,o=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,a=o.filter((([t])=>!Array.isArray(t)||t.length===e.length-1));let s=null;for(const[r,o]of a){s=new Nt(t.registry,Tr,t.path,null,t.scope);const a=[];let l=!1;for(let t=1;t<e.length;t++){const i=e[t],n=Array.isArray(r)?r[t-1]:r.type,o=s.parse(i,1+a.length,n);if(!o){l=!0;break}a.push(o)}if(!l)if(Array.isArray(r)&&r.length!==a.length)s.error(`Expected ${r.length} arguments, but found ${a.length} instead.`);else{for(let e=0;e<a.length;e++){const t=Array.isArray(r)?r[e]:r.type,i=a[e];s.concat(e+1).checkSubtype(t,i.type)}if(0===s.errors.length)return new vr(i,n,o,a)}}if(1===a.length)t.errors.push(...s.errors);else{const i=(a.length?a:o).map((([e])=>{return t=e,Array.isArray(t)?`(${t.map(qe).join(", ")})`:`(${qe(t.type)}...)`;var t})).join(" | "),r=[];for(let i=1;i<e.length;i++){const n=t.parse(e[i],1+r.length);if(!n)return null;r.push(qe(n.type))}t.error(`Expected arguments of type ${i}, but found (${r.join(", ")}) instead.`)}return null}static register(e,t){vr.definitions=t;for(const i in t)e[i]=vr}}function xr(e,[t,i,r,n]){t=t.evaluate(e),i=i.evaluate(e),r=r.evaluate(e);const o=n?n.evaluate(e):1,a=Pt(t,i,r,o);if(a)throw new Tt(a);return new _t(t/255,i/255,r/255,o,!1)}function br(e,t){return e in t}function wr(e,t){const i=t[e];return void 0===i?null:i}function Cr(e){return{type:e}}function Tr(e){if(e instanceof Vt)return Tr(e.boundExpression);if(e instanceof vr&&"error"===e.name)return!1;if(e instanceof fi)return!1;if(e instanceof Oi)return!1;if(e instanceof yr)return!1;const t=e instanceof Bt||e instanceof Ft;let i=!0;return e.eachChild((e=>{i=t?i&&Tr(e):i&&e instanceof Lt})),!!i&&Sr(e)&&Mr(e,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Sr(e){if(e instanceof vr){if("get"===e.name&&1===e.args.length)return!1;if("feature-state"===e.name)return!1;if("has"===e.name&&1===e.args.length)return!1;if("properties"===e.name||"geometry-type"===e.name||"id"===e.name)return!1;if(/^filter-/.test(e.name))return!1}if(e instanceof Oi)return!1;if(e instanceof yr)return!1;let t=!0;return e.eachChild((e=>{t&&!Sr(e)&&(t=!1)})),t}function Ar(e){if(e instanceof vr&&"feature-state"===e.name)return!1;let t=!0;return e.eachChild((e=>{t&&!Ar(e)&&(t=!1)})),t}function Mr(e,t){if(e instanceof vr&&t.indexOf(e.name)>=0)return!1;let i=!0;return e.eachChild((e=>{i&&!Mr(e,t)&&(i=!1)})),i}function Er(e){return{result:"success",value:e}}function Pr(e){return{result:"error",value:e}}function Ir(e){return"data-driven"===e["property-type"]||"cross-faded-data-driven"===e["property-type"]}function kr(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function zr(e){return!!e.expression&&e.expression.interpolated}function Lr(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}function Dr(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function Fr(e){return e}function Rr(e,t){const i="color"===t.type,r=e.stops&&"object"==typeof e.stops[0][0],n=r||!(r||void 0!==e.property),o=e.type||(zr(t)?"exponential":"interval");if(i||"padding"===t.type){const r=i?_t.parse:Ct.parse;(e=Me({},e)).stops&&(e.stops=e.stops.map((e=>[e[0],r(e[1])]))),e.default=r(e.default?e.default:t.default)}if(e.colorSpace&&"rgb"!==(a=e.colorSpace)&&"hcl"!==a&&"lab"!==a)throw new Error(`Unknown color space: "${e.colorSpace}"`);var a;let s,l,c;if("exponential"===o)s=Nr;else if("interval"===o)s=jr;else if("categorical"===o){s=Or,l=Object.create(null);for(const t of e.stops)l[t[0]]=t[1];c=typeof e.stops[0][0]}else{if("identity"!==o)throw new Error(`Unknown function type "${o}"`);s=$r}if(r){const i={},r=[];for(let t=0;t<e.stops.length;t++){const n=e.stops[t],o=n[0].zoom;void 0===i[o]&&(i[o]={zoom:o,type:e.type,property:e.property,default:e.default,stops:[]},r.push(o)),i[o].stops.push([n[0].value,n[1]])}const n=[];for(const e of r)n.push([i[e].zoom,Rr(i[e],t)]);const o={name:"linear"};return{kind:"composite",interpolationType:o,interpolationFactor:ii.interpolationFactor.bind(void 0,o),zoomStops:n.map((e=>e[0])),evaluate:({zoom:i},r)=>Nr({stops:n,base:e.base},t,i).evaluate(i,r)}}if(n){const i="exponential"===o?{name:"exponential",base:void 0!==e.base?e.base:1}:null;return{kind:"camera",interpolationType:i,interpolationFactor:ii.interpolationFactor.bind(void 0,i),zoomStops:e.stops.map((e=>e[0])),evaluate:({zoom:i})=>s(e,t,i,l,c)}}return{kind:"source",evaluate(i,r){const n=r&&r.properties?r.properties[e.property]:void 0;return void 0===n?Br(e.default,t.default):s(e,t,n,l,c)}}}function Br(e,t,i){return void 0!==e?e:void 0!==t?t:void 0!==i?i:void 0}function Or(e,t,i,r,n){return Br(typeof i===n?r[i]:void 0,e.default,t.default)}function jr(e,t,i){if("number"!==Lr(i))return Br(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 n=Kt(e.stops.map((e=>e[0])),i);return e.stops[n][1]}function Nr(e,t,i){const r=void 0!==e.base?e.base:1;if("number"!==Lr(i))return Br(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 o=Kt(e.stops.map((e=>e[0])),i),a=function(e,t,i,r){const n=r-i,o=e-i;return 0===n?0:1===t?o/n:(Math.pow(t,o)-1)/(Math.pow(t,n)-1)}(i,r,e.stops[o][0],e.stops[o+1][0]),s=e.stops[o][1],l=e.stops[o+1][1],c=ni[t.type]||Fr;return"function"==typeof s.evaluate?{evaluate(...t){const i=s.evaluate.apply(void 0,t),r=l.evaluate.apply(void 0,t);if(void 0!==i&&void 0!==r)return c(i,r,a,e.colorSpace)}}:c(s,l,a,e.colorSpace)}function $r(e,t,i){switch(t.type){case"color":i=_t.parse(i);break;case"formatted":i=wt.fromString(i.toString());break;case"resolvedImage":i=Mt.fromString(i.toString());break;case"padding":i=Ct.parse(i);break;default:Lr(i)===t.type||"enum"===t.type&&t.values[i]||(i=void 0)}return Br(i,e.default,t.default)}vr.register(_r,{error:[{kind:"error"},[ze],(e,[t])=>{throw new Tt(t.evaluate(e))}],typeof:[ze,[Be],(e,[t])=>qe(kt(t.evaluate(e)))],"to-rgba":[Ue(ke,4),[De],(e,[t])=>{const[i,r,n,o]=t.evaluate(e).rgb;return[255*i,255*r,255*n,o]}],rgb:[De,[ke,ke,ke],xr],rgba:[De,[ke,ke,ke,ke],xr],has:{type:Le,overloads:[[[ze],(e,[t])=>br(t.evaluate(e),e.properties())],[[ze,Re],(e,[t,i])=>br(t.evaluate(e),i.evaluate(e))]]},get:{type:Be,overloads:[[[ze],(e,[t])=>wr(t.evaluate(e),e.properties())],[[ze,Re],(e,[t,i])=>wr(t.evaluate(e),i.evaluate(e))]]},"feature-state":[Be,[ze],(e,[t])=>wr(t.evaluate(e),e.featureState||{})],properties:[Re,[],e=>e.properties()],"geometry-type":[ze,[],e=>e.geometryType()],id:[Be,[],e=>e.id()],zoom:[ke,[],e=>e.globals.zoom],"heatmap-density":[ke,[],e=>e.globals.heatmapDensity||0],"line-progress":[ke,[],e=>e.globals.lineProgress||0],accumulated:[Be,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[ke,Cr(ke),(e,t)=>{let i=0;for(const r of t)i+=r.evaluate(e);return i}],"*":[ke,Cr(ke),(e,t)=>{let i=1;for(const r of t)i*=r.evaluate(e);return i}],"-":{type:ke,overloads:[[[ke,ke],(e,[t,i])=>t.evaluate(e)-i.evaluate(e)],[[ke],(e,[t])=>-t.evaluate(e)]]},"/":[ke,[ke,ke],(e,[t,i])=>t.evaluate(e)/i.evaluate(e)],"%":[ke,[ke,ke],(e,[t,i])=>t.evaluate(e)%i.evaluate(e)],ln2:[ke,[],()=>Math.LN2],pi:[ke,[],()=>Math.PI],e:[ke,[],()=>Math.E],"^":[ke,[ke,ke],(e,[t,i])=>Math.pow(t.evaluate(e),i.evaluate(e))],sqrt:[ke,[ke],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[ke,[ke],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[ke,[ke],(e,[t])=>Math.log(t.evaluate(e))],log2:[ke,[ke],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[ke,[ke],(e,[t])=>Math.sin(t.evaluate(e))],cos:[ke,[ke],(e,[t])=>Math.cos(t.evaluate(e))],tan:[ke,[ke],(e,[t])=>Math.tan(t.evaluate(e))],asin:[ke,[ke],(e,[t])=>Math.asin(t.evaluate(e))],acos:[ke,[ke],(e,[t])=>Math.acos(t.evaluate(e))],atan:[ke,[ke],(e,[t])=>Math.atan(t.evaluate(e))],min:[ke,Cr(ke),(e,t)=>Math.min(...t.map((t=>t.evaluate(e))))],max:[ke,Cr(ke),(e,t)=>Math.max(...t.map((t=>t.evaluate(e))))],abs:[ke,[ke],(e,[t])=>Math.abs(t.evaluate(e))],round:[ke,[ke],(e,[t])=>{const i=t.evaluate(e);return i<0?-Math.round(-i):Math.round(i)}],floor:[ke,[ke],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[ke,[ke],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[Le,[ze,Be],(e,[t,i])=>e.properties()[t.value]===i.value],"filter-id-==":[Le,[Be],(e,[t])=>e.id()===t.value],"filter-type-==":[Le,[ze],(e,[t])=>e.geometryType()===t.value],"filter-<":[Le,[ze,Be],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r<n}],"filter-id-<":[Le,[Be],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i<r}],"filter->":[Le,[ze,Be],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r>n}],"filter-id->":[Le,[Be],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i>r}],"filter-<=":[Le,[ze,Be],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r<=n}],"filter-id-<=":[Le,[Be],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i<=r}],"filter->=":[Le,[ze,Be],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r>=n}],"filter-id->=":[Le,[Be],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i>=r}],"filter-has":[Le,[Be],(e,[t])=>t.value in e.properties()],"filter-has-id":[Le,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[Le,[Ue(ze)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[Le,[Ue(Be)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[Le,[ze,Ue(Be)],(e,[t,i])=>i.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[Le,[ze,Ue(Be)],(e,[t,i])=>function(e,t,i,r){for(;i<=r;){const n=i+r>>1;if(t[n]===e)return!0;t[n]>e?r=n-1:i=n+1}return!1}(e.properties()[t.value],i.value,0,i.value.length-1)],all:{type:Le,overloads:[[[Le,Le],(e,[t,i])=>t.evaluate(e)&&i.evaluate(e)],[Cr(Le),(e,t)=>{for(const i of t)if(!i.evaluate(e))return!1;return!0}]]},any:{type:Le,overloads:[[[Le,Le],(e,[t,i])=>t.evaluate(e)||i.evaluate(e)],[Cr(Le),(e,t)=>{for(const i of t)if(i.evaluate(e))return!0;return!1}]]},"!":[Le,[Le],(e,[t])=>!t.evaluate(e)],"is-supported-script":[Le,[ze],(e,[t])=>{const i=e.globals&&e.globals.isSupportedScript;return!i||i(t.evaluate(e))}],upcase:[ze,[ze],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[ze,[ze],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[ze,Cr(Be),(e,t)=>t.map((t=>zt(t.evaluate(e)))).join("")],"resolved-locale":[ze,[Oe],(e,[t])=>t.evaluate(e).resolvedLocale()]});class Vr{constructor(e,t){var i;this.expression=e,this._warningHistory={},this._evaluator=new jt,this._defaultValue=t?"color"===(i=t).type&&Dr(i.default)?new _t(0,0,0,0):"color"===i.type?_t.parse(i.default)||null:"padding"===i.type?Ct.parse(i.default)||null:"variableAnchorOffsetCollection"===i.type?At.parse(i.default)||null:"projectionDefinition"===i.type?Et.parse(i.default)||null:void 0===i.default?null:i.default:null,this._enumValues=t&&"enum"===t.type?t.values:null}evaluateWithoutErrorHandling(e,t,i,r,n,o){return this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=i,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)}evaluate(e,t,i,r,n,o){this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=i||null,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o||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 Tt(`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 Ur(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in _r}function qr(e,t){const i=new Nt(_r,Tr,[],t?function(e){const t={color:De,string:ze,number:ke,enum:ze,boolean:Le,formatted:je,padding:Ne,projectionDefinition:Fe,resolvedImage:$e,variableAnchorOffsetCollection:Ve};return"array"===e.type?Ue(t[e.value]||Be,e.length):t[e.type]}(t):void 0),r=i.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return r?Er(new Vr(r,t)):Pr(i.errors)}class Zr{constructor(e,t){this.kind=e,this._styleExpression=t,this.isStateDependent="constant"!==e&&!Ar(t.expression)}evaluateWithoutErrorHandling(e,t,i,r,n,o){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,n,o)}evaluate(e,t,i,r,n,o){return this._styleExpression.evaluate(e,t,i,r,n,o)}}class Gr{constructor(e,t,i,r){this.kind=e,this.zoomStops=i,this._styleExpression=t,this.isStateDependent="camera"!==e&&!Ar(t.expression),this.interpolationType=r}evaluateWithoutErrorHandling(e,t,i,r,n,o){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,n,o)}evaluate(e,t,i,r,n,o){return this._styleExpression.evaluate(e,t,i,r,n,o)}interpolationFactor(e,t,i){return this.interpolationType?ii.interpolationFactor(this.interpolationType,e,t,i):0}}function Hr(e,t){const i=qr(e,t);if("error"===i.result)return i;const r=i.value.expression,n=Sr(r);if(!n&&!Ir(t))return Pr([new Ee("","data expressions not supported")]);const o=Mr(r,["zoom"]);if(!o&&!kr(t))return Pr([new Ee("","zoom expressions not supported")]);const a=Kr(r);return a||o?a instanceof Ee?Pr([a]):a instanceof ii&&!zr(t)?Pr([new Ee("",'"interpolate" expressions cannot be used with this property')]):Er(a?new Gr(n?"camera":"composite",i.value,a.labels,a instanceof ii?a.interpolation:void 0):new Zr(n?"constant":"source",i.value)):Pr([new Ee("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Wr{constructor(e,t){this._parameters=e,this._specification=t,Me(this,Rr(this._parameters,this._specification))}static deserialize(e){return new Wr(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Kr(e){let t=null;if(e instanceof $t)t=Kr(e.result);else if(e instanceof oi){for(const i of e.args)if(t=Kr(i),t)break}else(e instanceof Xt||e instanceof ii)&&e.input instanceof vr&&"zoom"===e.input.name&&(t=e);return t instanceof Ee||e.eachChild((e=>{const i=Kr(e);i instanceof Ee?t=i:!t&&i?t=new Ee("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&i&&t!==i&&(t=new Ee("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),t}function Xr(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(!Xr(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}}const Yr={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Jr(e){if(null==e)return{filter:()=>!0,needGeometry:!1};Xr(e)||(e=tn(e));const t=qr(e,Yr);if("error"===t.result)throw new Error(t.value.map((e=>`${e.key}: ${e.message}`)).join(", "));return{filter:(e,i,r)=>t.value.evaluate(e,i,{},r),needGeometry:en(e)}}function Qr(e,t){return e<t?-1:e>t?1:0}function en(e){if(!Array.isArray(e))return!1;if("within"===e[0]||"distance"===e[0])return!0;for(let t=1;t<e.length;t++)if(en(e[t]))return!0;return!1}function tn(e){if(!e)return!0;const t=e[0];return e.length<=1?"any"!==t:"=="===t?rn(e[1],e[2],"=="):"!="===t?an(rn(e[1],e[2],"==")):"<"===t||">"===t||"<="===t||">="===t?rn(e[1],e[2],t):"any"===t?(i=e.slice(1),["any"].concat(i.map(tn))):"all"===t?["all"].concat(e.slice(1).map(tn)):"none"===t?["all"].concat(e.slice(1).map(tn).map(an)):"in"===t?nn(e[1],e.slice(2)):"!in"===t?an(nn(e[1],e.slice(2))):"has"===t?on(e[1]):"!has"!==t||an(on(e[1]));var i}function rn(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 nn(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(Qr)]]:["filter-in-small",e,["literal",t]]}}function on(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function an(e){return["!",e]}function sn(e){const t=typeof e;if("number"===t||"boolean"===t||"string"===t||null==e)return JSON.stringify(e);if(Array.isArray(e)){let t="[";for(const i of e)t+=`${sn(i)},`;return`${t}]`}const i=Object.keys(e).sort();let r="{";for(let t=0;t<i.length;t++)r+=`${JSON.stringify(i[t])}:${sn(e[i[t]])},`;return`${r}}`}function ln(e){let t="";for(const i of fe)t+=`/${sn(e[i])}`;return t}function cn(e){const t=e.value;return t?[new Ae(e.key,t,"constants have been deprecated as of v8")]:[]}function un(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function hn(e){if(Array.isArray(e))return e.map(hn);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){const t={};for(const i in e)t[i]=hn(e[i]);return t}return un(e)}function pn(e){const t=e.key,i=e.value,r=e.valueSpec||{},n=e.objectElementValidators||{},o=e.style,a=e.styleSpec,s=e.validateSpec;let l=[];const c=Lr(i);if("object"!==c)return[new Ae(t,i,`object expected, ${c} found`)];for(const e in i){const c=e.split(".")[0],u=r[c]||r["*"];let h;if(n[c])h=n[c];else if(r[c])h=s;else if(n["*"])h=n["*"];else{if(!r["*"]){l.push(new Ae(t,i[e],`unknown property "${e}"`));continue}h=s}l=l.concat(h({key:(t?`${t}.`:t)+e,value:i[e],valueSpec:u,style:o,styleSpec:a,object:i,objectKey:e,validateSpec:s},i))}for(const e in r)n[e]||r[e].required&&void 0===r[e].default&&void 0===i[e]&&l.push(new Ae(t,i,`missing required property "${e}"`));return l}function dn(e){const t=e.value,i=e.valueSpec,r=e.style,n=e.styleSpec,o=e.key,a=e.arrayElementValidator||e.validateSpec;if("array"!==Lr(t))return[new Ae(o,t,`array expected, ${Lr(t)} found`)];if(i.length&&t.length!==i.length)return[new Ae(o,t,`array length ${i.length} expected, length ${t.length} found`)];if(i["min-length"]&&t.length<i["min-length"])return[new Ae(o,t,`array length at least ${i["min-length"]} expected, length ${t.length} found`)];let s={type:i.value,values:i.values};n.$version<7&&(s.function=i.function),"object"===Lr(i.value)&&(s=i.value);let l=[];for(let i=0;i<t.length;i++)l=l.concat(a({array:t,arrayIndex:i,value:t[i],valueSpec:s,validateSpec:e.validateSpec,style:r,styleSpec:n,key:`${o}[${i}]`}));return l}function mn(e){const t=e.key,i=e.value,r=e.valueSpec;let n=Lr(i);return"number"===n&&i!=i&&(n="NaN"),"number"!==n?[new Ae(t,i,`number expected, ${n} found`)]:"minimum"in r&&i<r.minimum?[new Ae(t,i,`${i} is less than the minimum value ${r.minimum}`)]:"maximum"in r&&i>r.maximum?[new Ae(t,i,`${i} is greater than the maximum value ${r.maximum}`)]:[]}function fn(e){const t=e.valueSpec,i=un(e.value.type);let r,n,o,a={};const s="categorical"!==i&&void 0===e.value.property,l=!s,c="array"===Lr(e.value.stops)&&"array"===Lr(e.value.stops[0])&&"object"===Lr(e.value.stops[0][0]),u=pn({key:e.key,value:e.value,valueSpec:e.styleSpec.function,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:function(e){if("identity"===i)return[new Ae(e.key,e.value,'identity function may not have a "stops" property')];let t=[];const r=e.value;return t=t.concat(dn({key:e.key,value:r,valueSpec:e.valueSpec,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:h})),"array"===Lr(r)&&0===r.length&&t.push(new Ae(e.key,r,"array must have at least one stop")),t},default:function(e){return e.validateSpec({key:e.key,value:e.value,valueSpec:t,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===i&&s&&u.push(new Ae(e.key,e.value,'missing required property "property"')),"identity"===i||e.value.stops||u.push(new Ae(e.key,e.value,'missing required property "stops"')),"exponential"===i&&e.valueSpec.expression&&!zr(e.valueSpec)&&u.push(new Ae(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!Ir(e.valueSpec)?u.push(new Ae(e.key,e.value,"property functions not supported")):s&&!kr(e.valueSpec)&&u.push(new Ae(e.key,e.value,"zoom functions not supported"))),"categorical"!==i&&!c||void 0!==e.value.property||u.push(new Ae(e.key,e.value,'"property" property is required')),u;function h(e){let i=[];const r=e.value,s=e.key;if("array"!==Lr(r))return[new Ae(s,r,`array expected, ${Lr(r)} found`)];if(2!==r.length)return[new Ae(s,r,`array length 2 expected, length ${r.length} found`)];if(c){if("object"!==Lr(r[0]))return[new Ae(s,r,`object expected, ${Lr(r[0])} found`)];if(void 0===r[0].zoom)return[new Ae(s,r,"object stop key must have zoom")];if(void 0===r[0].value)return[new Ae(s,r,"object stop key must have value")];if(o&&o>un(r[0].zoom))return[new Ae(s,r[0].zoom,"stop zoom values must appear in ascending order")];un(r[0].zoom)!==o&&(o=un(r[0].zoom),n=void 0,a={}),i=i.concat(pn({key:`${s}[0]`,value:r[0],valueSpec:{zoom:{}},validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:mn,value:p}}))}else i=i.concat(p({key:`${s}[0]`,value:r[0],validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec},r));return Ur(hn(r[1]))?i.concat([new Ae(`${s}[1]`,r[1],"expressions are not allowed in function stops.")]):i.concat(e.validateSpec({key:`${s}[1]`,value:r[1],valueSpec:t,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec}))}function p(e,o){const s=Lr(e.value),l=un(e.value),c=null!==e.value?e.value:o;if(r){if(s!==r)return[new Ae(e.key,c,`${s} stop domain type must match previous stop domain type ${r}`)]}else r=s;if("number"!==s&&"string"!==s&&"boolean"!==s)return[new Ae(e.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==i){let r=`number expected, ${s} found`;return Ir(t)&&void 0===i&&(r+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ae(e.key,c,r)]}return"categorical"!==i||"number"!==s||isFinite(l)&&Math.floor(l)===l?"categorical"!==i&&"number"===s&&void 0!==n&&l<n?[new Ae(e.key,c,"stop domain values must appear in ascending order")]:(n=l,"categorical"===i&&l in a?[new Ae(e.key,c,"stop domain values must be unique")]:(a[l]=!0,[])):[new Ae(e.key,c,`integer expected, found ${l}`)]}}function gn(e){const t=("property"===e.expressionContext?Hr:qr)(hn(e.value),e.valueSpec);if("error"===t.result)return t.value.map((t=>new Ae(`${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 Ae(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&&!Ar(i))return[new Ae(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===e.expressionContext&&!Ar(i))return[new Ae(e.key,e.value,'"feature-state" data expressions are not supported with filters.')];if(e.expressionContext&&0===e.expressionContext.indexOf("cluster")){if(!Mr(i,["zoom","feature-state"]))return[new Ae(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===e.expressionContext&&!Sr(i))return[new Ae(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function yn(e){const t=e.key,i=e.value,r=e.valueSpec,n=[];return Array.isArray(r.values)?-1===r.values.indexOf(un(i))&&n.push(new Ae(t,i,`expected one of [${r.values.join(", ")}], ${JSON.stringify(i)} found`)):-1===Object.keys(r.values).indexOf(un(i))&&n.push(new Ae(t,i,`expected one of [${Object.keys(r.values).join(", ")}], ${JSON.stringify(i)} found`)),n}function _n(e){return Xr(hn(e.value))?gn(Me({},e,{expressionContext:"filter",valueSpec:{value:"boolean"}})):vn(e)}function vn(e){const t=e.value,i=e.key;if("array"!==Lr(t))return[new Ae(i,t,`array expected, ${Lr(t)} found`)];const r=e.styleSpec;let n,o=[];if(t.length<1)return[new Ae(i,t,"filter array must have at least 1 element")];switch(o=o.concat(yn({key:`${i}[0]`,value:t[0],valueSpec:r.filter_operator,style:e.style,styleSpec:e.styleSpec})),un(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&"$type"===un(t[1])&&o.push(new Ae(i,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":3!==t.length&&o.push(new Ae(i,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(n=Lr(t[1]),"string"!==n&&o.push(new Ae(`${i}[1]`,t[1],`string expected, ${n} found`)));for(let a=2;a<t.length;a++)n=Lr(t[a]),"$type"===un(t[1])?o=o.concat(yn({key:`${i}[${a}]`,value:t[a],valueSpec:r.geometry_type,style:e.style,styleSpec:e.styleSpec})):"string"!==n&&"number"!==n&&"boolean"!==n&&o.push(new Ae(`${i}[${a}]`,t[a],`string, number, or boolean expected, ${n} found`));break;case"any":case"all":case"none":for(let r=1;r<t.length;r++)o=o.concat(vn({key:`${i}[${r}]`,value:t[r],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":n=Lr(t[1]),2!==t.length?o.push(new Ae(i,t,`filter array for "${t[0]}" operator must have 2 elements`)):"string"!==n&&o.push(new Ae(`${i}[1]`,t[1],`string expected, ${n} found`))}return o}function xn(e,t){const i=e.key,r=e.validateSpec,n=e.style,o=e.styleSpec,a=e.value,s=e.objectKey,l=o[`${t}_${e.layerType}`];if(!l)return[];const c=s.match(/^(.*)-transition$/);if("paint"===t&&c&&l[c[1]]&&l[c[1]].transition)return r({key:i,value:a,valueSpec:o.transition,style:n,styleSpec:o});const u=e.valueSpec||l[s];if(!u)return[new Ae(i,a,`unknown property "${s}"`)];let h;if("string"===Lr(a)&&Ir(u)&&!u.tokens&&(h=/^{([^}]+)}$/.exec(a)))return[new Ae(i,a,`"${s}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(h[1])} }\`.`)];const p=[];return"symbol"===e.layerType&&("text-field"===s&&n&&!n.glyphs&&p.push(new Ae(i,a,'use of "text-field" requires a style "glyphs" property')),"text-font"===s&&Dr(hn(a))&&"identity"===un(a.type)&&p.push(new Ae(i,a,'"text-font" does not support identity functions'))),p.concat(r({key:e.key,value:a,valueSpec:u,style:n,styleSpec:o,expressionContext:"property",propertyType:t,propertyKey:s}))}function bn(e){return xn(e,"paint")}function wn(e){return xn(e,"layout")}function Cn(e){let t=[];const i=e.value,r=e.key,n=e.style,o=e.styleSpec;i.type||i.ref||t.push(new Ae(r,i,'either "type" or "ref" is required'));let a=un(i.type);const s=un(i.ref);if(i.id){const o=un(i.id);for(let a=0;a<e.arrayIndex;a++){const e=n.layers[a];un(e.id)===o&&t.push(new Ae(r,i.id,`duplicate layer id "${i.id}", previously used at line ${e.id.__line__}`))}}if("ref"in i){let e;["type","source","source-layer","filter","layout"].forEach((e=>{e in i&&t.push(new Ae(r,i[e],`"${e}" is prohibited for ref layers`))})),n.layers.forEach((t=>{un(t.id)===s&&(e=t)})),e?e.ref?t.push(new Ae(r,i.ref,"ref cannot reference another ref layer")):a=un(e.type):t.push(new Ae(r,i.ref,`ref layer "${s}" not found`))}else if("background"!==a)if(i.source){const e=n.sources&&n.sources[i.source],o=e&&un(e.type);e?"vector"===o&&"raster"===a?t.push(new Ae(r,i.source,`layer "${i.id}" requires a raster source`)):"raster-dem"!==o&&"hillshade"===a?t.push(new Ae(r,i.source,`layer "${i.id}" requires a raster-dem source`)):"raster"===o&&"raster"!==a?t.push(new Ae(r,i.source,`layer "${i.id}" requires a vector source`)):"vector"!==o||i["source-layer"]?"raster-dem"===o&&"hillshade"!==a?t.push(new Ae(r,i.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==a||!i.paint||!i.paint["line-gradient"]||"geojson"===o&&e.lineMetrics||t.push(new Ae(r,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new Ae(r,i,`layer "${i.id}" must specify a "source-layer"`)):t.push(new Ae(r,i.source,`source "${i.source}" not found`))}else t.push(new Ae(r,i,'missing required property "source"'));return t=t.concat(pn({key:r,value:i,valueSpec:o.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":()=>[],type:()=>e.validateSpec({key:`${r}.type`,value:i.type,valueSpec:o.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:i,objectKey:"type"}),filter:_n,layout:e=>pn({layer:i,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>wn(Me({layerType:a},e))}}),paint:e=>pn({layer:i,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>bn(Me({layerType:a},e))}})}})),t}function Tn(e){const t=e.value,i=e.key,r=Lr(t);return"string"!==r?[new Ae(i,t,`string expected, ${r} found`)]:[]}const Sn={promoteId:function({key:e,value:t}){if("string"===Lr(t))return Tn({key:e,value:t});{const i=[];for(const r in t)i.push(...Tn({key:`${e}.${r}`,value:t[r]}));return i}}};function An(e){const t=e.value,i=e.key,r=e.styleSpec,n=e.style,o=e.validateSpec;if(!t.type)return[new Ae(i,t,'"type" is required')];const a=un(t.type);let s;switch(a){case"vector":case"raster":return s=pn({key:i,value:t,valueSpec:r[`source_${a.replace("-","_")}`],style:e.style,styleSpec:r,objectElementValidators:Sn,validateSpec:o}),s;case"raster-dem":return s=function(e){var t;const i=null!==(t=e.sourceName)&&void 0!==t?t:"",r=e.value,n=e.styleSpec,o=n.source_raster_dem,a=e.style;let s=[];const l=Lr(r);if(void 0===r)return s;if("object"!==l)return s.push(new Ae("source_raster_dem",r,`object expected, ${l} found`)),s;const c="custom"===un(r.encoding),u=["redFactor","greenFactor","blueFactor","baseShift"],h=e.value.encoding?`"${e.value.encoding}"`:"Default";for(const t in r)!c&&u.includes(t)?s.push(new Ae(t,r[t],`In "${i}": "${t}" is only valid when "encoding" is set to "custom". ${h} encoding found`)):o[t]?s=s.concat(e.validateSpec({key:t,value:r[t],valueSpec:o[t],validateSpec:e.validateSpec,style:a,styleSpec:n})):s.push(new Ae(t,r[t],`unknown property "${t}"`));return s}({sourceName:i,value:t,style:e.style,styleSpec:r,validateSpec:o}),s;case"geojson":if(s=pn({key:i,value:t,valueSpec:r.source_geojson,style:n,styleSpec:r,validateSpec:o,objectElementValidators:Sn}),t.cluster)for(const e in t.clusterProperties){const[r,n]=t.clusterProperties[e],o="string"==typeof r?[r,["accumulated"],["get",e]]:r;s.push(...gn({key:`${i}.${e}.map`,value:n,expressionContext:"cluster-map"})),s.push(...gn({key:`${i}.${e}.reduce`,value:o,expressionContext:"cluster-reduce"}))}return s;case"video":return pn({key:i,value:t,valueSpec:r.source_video,style:n,validateSpec:o,styleSpec:r});case"image":return pn({key:i,value:t,valueSpec:r.source_image,style:n,validateSpec:o,styleSpec:r});case"canvas":return[new Ae(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return yn({key:`${i}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function Mn(e){const t=e.value,i=e.styleSpec,r=i.light,n=e.style;let o=[];const a=Lr(t);if(void 0===t)return o;if("object"!==a)return o=o.concat([new Ae("light",t,`object expected, ${a} found`)]),o;for(const a in t){const s=a.match(/^(.*)-transition$/);o=o.concat(s&&r[s[1]]&&r[s[1]].transition?e.validateSpec({key:a,value:t[a],valueSpec:i.transition,validateSpec:e.validateSpec,style:n,styleSpec:i}):r[a]?e.validateSpec({key:a,value:t[a],valueSpec:r[a],validateSpec:e.validateSpec,style:n,styleSpec:i}):[new Ae(a,t[a],`unknown property "${a}"`)])}return o}function En(e){const t=e.value,i=e.styleSpec,r=i.sky,n=e.style,o=Lr(t);if(void 0===t)return[];if("object"!==o)return[new Ae("sky",t,`object expected, ${o} found`)];let a=[];for(const o in t)a=a.concat(r[o]?e.validateSpec({key:o,value:t[o],valueSpec:r[o],style:n,styleSpec:i}):[new Ae(o,t[o],`unknown property "${o}"`)]);return a}function Pn(e){const t=e.value,i=e.styleSpec,r=i.terrain,n=e.style;let o=[];const a=Lr(t);if(void 0===t)return o;if("object"!==a)return o=o.concat([new Ae("terrain",t,`object expected, ${a} found`)]),o;for(const a in t)o=o.concat(r[a]?e.validateSpec({key:a,value:t[a],valueSpec:r[a],validateSpec:e.validateSpec,style:n,styleSpec:i}):[new Ae(a,t[a],`unknown property "${a}"`)]);return o}function In(e){let t=[];const i=e.value,r=e.key;if(Array.isArray(i)){const n=[],o=[];for(const a in i)i[a].id&&n.includes(i[a].id)&&t.push(new Ae(r,i,`all the sprites' ids must be unique, but ${i[a].id} is duplicated`)),n.push(i[a].id),i[a].url&&o.includes(i[a].url)&&t.push(new Ae(r,i,`all the sprites' URLs must be unique, but ${i[a].url} is duplicated`)),o.push(i[a].url),t=t.concat(pn({key:`${r}[${a}]`,value:i[a],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:e.validateSpec}));return t}return Tn({key:r,value:i})}const kn={"*":()=>[],array:dn,boolean:function(e){const t=e.value,i=e.key,r=Lr(t);return"boolean"!==r?[new Ae(i,t,`boolean expected, ${r} found`)]:[]},number:mn,color:function(e){const t=e.key,i=e.value,r=Lr(i);return"string"!==r?[new Ae(t,i,`color expected, ${r} found`)]:_t.parse(String(i))?[]:[new Ae(t,i,`color expected, "${i}" found`)]},constants:cn,enum:yn,filter:_n,function:fn,layer:Cn,object:pn,source:An,light:Mn,sky:En,terrain:Pn,projection:function(e){const t=e.value,i=e.styleSpec,r=i.projection,n=e.style,o=Lr(t);if(void 0===t)return[];if("object"!==o)return[new Ae("projection",t,`object expected, ${o} found`)];let a=[];for(const o in t)a=a.concat(r[o]?e.validateSpec({key:o,value:t[o],valueSpec:r[o],style:n,styleSpec:i}):[new Ae(o,t[o],`unknown property "${o}"`)]);return a},projectionDefinition:function(e){const t=e.key;let i=e.value;i=i instanceof String?i.valueOf():i;const r=Lr(i);return"array"!==r||function(e){return Array.isArray(e)&&3===e.length&&"string"==typeof e[0]&&"string"==typeof e[1]&&"number"==typeof e[2]}(i)||function(e){return!!["interpolate","step","literal"].includes(e[0])}(i)?["array","string"].includes(r)?[]:[new Ae(t,i,`projection expected, invalid type "${r}" found`)]:[new Ae(t,i,`projection expected, invalid array ${JSON.stringify(i)} found`)]},string:Tn,formatted:function(e){return 0===Tn(e).length?[]:gn(e)},resolvedImage:function(e){return 0===Tn(e).length?[]:gn(e)},padding:function(e){const t=e.key,i=e.value;if("array"===Lr(i)){if(i.length<1||i.length>4)return[new Ae(t,i,`padding requires 1 to 4 values; ${i.length} values found`)];const r={type:"number"};let n=[];for(let o=0;o<i.length;o++)n=n.concat(e.validateSpec({key:`${t}[${o}]`,value:i[o],validateSpec:e.validateSpec,valueSpec:r}));return n}return mn({key:t,value:i,valueSpec:{}})},variableAnchorOffsetCollection:function(e){const t=e.key,i=e.value,r=Lr(i),n=e.styleSpec;if("array"!==r||i.length<1||i.length%2!=0)return[new Ae(t,i,"variableAnchorOffsetCollection requires a non-empty array of even length")];let o=[];for(let r=0;r<i.length;r+=2)o=o.concat(yn({key:`${t}[${r}]`,value:i[r],valueSpec:n.layout_symbol["text-anchor"]})),o=o.concat(dn({key:`${t}[${r+1}]`,value:i[r+1],valueSpec:{length:2,value:"number"},validateSpec:e.validateSpec,style:e.style,styleSpec:n}));return o},sprite:In};function zn(e){const t=e.value,i=e.valueSpec,r=e.styleSpec;return e.validateSpec=zn,i.expression&&Dr(un(t))?fn(e):i.expression&&Ur(hn(t))?gn(e):i.type&&kn[i.type]?kn[i.type](e):pn(Me({},e,{valueSpec:i.type?r[i.type]:i}))}function Ln(e){const t=e.value,i=e.key,r=Tn(e);return r.length||(-1===t.indexOf("{fontstack}")&&r.push(new Ae(i,t,'"glyphs" url must include a "{fontstack}" token')),-1===t.indexOf("{range}")&&r.push(new Ae(i,t,'"glyphs" url must include a "{range}" token'))),r}function Dn(e,t=me){let i=[];return i=i.concat(zn({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,validateSpec:zn,objectElementValidators:{glyphs:Ln,"*":()=>[]}})),e.constants&&(i=i.concat(cn({key:"constants",value:e.constants}))),Rn(i)}function Fn(e){return function(t){return e({...t,validateSpec:zn})}}function Rn(e){return[].concat(e).sort(((e,t)=>e.line-t.line))}function Bn(e){return function(...t){return Rn(e.apply(this,t))}}Dn.source=Bn(Fn(An)),Dn.sprite=Bn(Fn(In)),Dn.glyphs=Bn(Fn(Ln)),Dn.light=Bn(Fn(Mn)),Dn.sky=Bn(Fn(En)),Dn.terrain=Bn(Fn(Pn)),Dn.layer=Bn(Fn(Cn)),Dn.filter=Bn(Fn(_n)),Dn.paintProperty=Bn(Fn(bn)),Dn.layoutProperty=Bn(Fn(wn));const On=Dn,jn=On.light,Nn=On.sky,$n=On.paintProperty,Vn=On.layoutProperty;function Un(e,t){let i=!1;if(t&&t.length)for(const r of t)e.fire(new pe(new Error(r.message))),i=!0;return i}class qn{constructor(e,t,i){const r=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const n=new Int32Array(this.arrayBuffer);e=n[0],this.d=(t=n[1])+2*(i=n[2]);for(let e=0;e<this.d*this.d;e++){const t=n[3+e],i=n[3+e+1];r.push(t===i?null:n.subarray(t,i))}const o=n[3+r.length+1];this.keys=n.subarray(n[3+r.length],o),this.bboxes=n.subarray(o),this.insert=this._insertReadonly}else{this.d=t+2*i;for(let e=0;e<this.d*this.d;e++)r.push([]);this.keys=[],this.bboxes=[]}this.n=t,this.extent=e,this.padding=i,this.scale=t/e,this.uid=0;const n=i/t*e;this.min=-n,this.max=e+n}insert(e,t,i,r,n){this._forEachCell(t,i,r,n,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(t),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,t,i,r,n,o){this.cells[n].push(o)}query(e,t,i,r,n){const o=this.min,a=this.max;if(e<=o&&t<=o&&a<=i&&a<=r&&!n)return Array.prototype.slice.call(this.keys);{const o=[];return this._forEachCell(e,t,i,r,this._queryCell,o,{},n),o}}_queryCell(e,t,i,r,n,o,a,s){const l=this.cells[n];if(null!==l){const n=this.keys,c=this.bboxes;for(let u=0;u<l.length;u++){const h=l[u];if(void 0===a[h]){const l=4*h;(s?s(c[l+0],c[l+1],c[l+2],c[l+3]):e<=c[l+2]&&t<=c[l+3]&&i>=c[l+0]&&r>=c[l+1])?(a[h]=!0,o.push(n[h])):a[h]=!1}}}}_forEachCell(e,t,i,r,n,o,a,s){const l=this._convertToCellCoord(e),c=this._convertToCellCoord(t),u=this._convertToCellCoord(i),h=this._convertToCellCoord(r);for(let p=l;p<=u;p++)for(let l=c;l<=h;l++){const c=this.d*l+p;if((!s||s(this._convertFromCellCoord(p),this._convertFromCellCoord(l),this._convertFromCellCoord(p+1),this._convertFromCellCoord(l+1)))&&n.call(this,e,t,i,r,c,o,a,s))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,t=3+this.cells.length+1+1;let i=0;for(let e=0;e<this.cells.length;e++)i+=this.cells[e].length;const r=new Int32Array(t+i+this.keys.length+this.bboxes.length);r[0]=this.extent,r[1]=this.n,r[2]=this.padding;let n=t;for(let t=0;t<e.length;t++){const i=e[t];r[3+t]=n,r.set(i,n),n+=i.length}return r[3+e.length]=n,r.set(this.keys,n),n+=this.keys.length,r[3+e.length+1]=n,r.set(this.bboxes,n),n+=this.bboxes.length,r.buffer}static serialize(e,t){const i=e.toArrayBuffer();return t&&t.push(i),{buffer:i}}static deserialize(e){return new qn(e.buffer)}}const Zn={};function Gn(e,t,i={}){if(Zn[e])throw new Error(`${e} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:e,writeable:!1}),Zn[e]={klass:t,omit:i.omit||[],shallow:i.shallow||[]}}Gn("Object",Object),Gn("TransferableGridIndex",qn),Gn("Color",_t),Gn("Error",Error),Gn("AJAXError",oe),Gn("ResolvedImage",Mt),Gn("StylePropertyFunction",Wr),Gn("StyleExpression",Vr,{omit:["_evaluator"]}),Gn("ZoomDependentExpression",Gr),Gn("ZoomConstantExpression",Zr),Gn("CompoundExpression",vr,{omit:["_evaluate"]});for(const e in _r)_r[e]._classRegistryKey||Gn(`Expression_${e}`,_r[e]);function Hn(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}function Wn(e){return e.$name||e.constructor._classRegistryKey}function Kn(e){return!function(e){if(null===e||"object"!=typeof e)return!1;const t=Wn(e);return!(!t||"Object"===t)}(e)&&(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||e instanceof Blob||e instanceof Error||Hn(e)||Z(e)||ArrayBuffer.isView(e)||e instanceof ImageData)}function Xn(e,t){if(Kn(e))return(Hn(e)||Z(e))&&t&&t.push(e),ArrayBuffer.isView(e)&&t&&t.push(e.buffer),e instanceof ImageData&&t&&t.push(e.data.buffer),e;if(Array.isArray(e)){const i=[];for(const r of e)i.push(Xn(r,t));return i}if("object"!=typeof e)throw new Error("can't serialize object of type "+typeof e);const i=Wn(e);if(!i)throw new Error(`can't serialize object of unregistered class ${e.constructor.name}`);if(!Zn[i])throw new Error(`${i} is not registered.`);const{klass:r}=Zn[i],n=r.serialize?r.serialize(e,t):{};if(r.serialize){if(t&&n===t[t.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const r in e){if(!e.hasOwnProperty(r))continue;if(Zn[i].omit.indexOf(r)>=0)continue;const o=e[r];n[r]=Zn[i].shallow.indexOf(r)>=0?o:Xn(o,t)}e instanceof Error&&(n.message=e.message)}if(n.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==i&&(n.$name=i),n}function Yn(e){if(Kn(e))return e;if(Array.isArray(e))return e.map(Yn);if("object"!=typeof e)throw new Error("can't deserialize object of type "+typeof e);const t=Wn(e)||"Object";if(!Zn[t])throw new Error(`can't deserialize unregistered class ${t}`);const{klass:i}=Zn[t];if(!i)throw new Error(`can't deserialize unregistered class ${t}`);if(i.deserialize)return i.deserialize(e);const r=Object.create(i.prototype);for(const i of Object.keys(e)){if("$name"===i)continue;const n=e[i];r[i]=Zn[t].shallow.indexOf(i)>=0?n:Yn(n)}return r}class Jn{constructor(){this.first=!0}update(e,t){const i=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=i,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=i,!0):(this.lastFloorZoom>i?(this.lastIntegerZoom=i+1,this.lastIntegerZoomTime=t):this.lastFloorZoom<i&&(this.lastIntegerZoom=i,this.lastIntegerZoomTime=t),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=i,!0))}}const Qn={"Latin-1 Supplement":e=>e>=128&&e<=255,"Hangul Jamo":e=>e>=4352&&e<=4607,Khmer:e=>e>=6016&&e<=6143,"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,"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,Kanbun:e=>e>=12688&&e<=12703,"CJK Strokes":e=>e>=12736&&e<=12783,"Enclosed CJK Letters and Months":e=>e>=12800&&e<=13055,"CJK Compatibility":e=>e>=13056&&e<=13311,"Yijing Hexagram Symbols":e=>e>=19904&&e<=19967,"CJK Unified Ideographs":e=>e>=19968&&e<=40959,"Hangul Syllables":e=>e>=44032&&e<=55215,"Private Use Area":e=>e>=57344&&e<=63743,"Vertical Forms":e=>e>=65040&&e<=65055,"CJK Compatibility Forms":e=>e>=65072&&e<=65103,"Small Form Variants":e=>e>=65104&&e<=65135,"Halfwidth and Fullwidth Forms":e=>e>=65280&&e<=65519};function eo(e){for(const t of e)if(ao(t.charCodeAt(0)))return!0;return!1}function to(e){for(const t of e)if(!no(t.charCodeAt(0)))return!1;return!0}function io(e){const t=e.map((e=>{try{return new RegExp(`\\p{sc=${e}}`,"u").source}catch(e){return null}})).filter((e=>e));return new RegExp(t.join("|"),"u")}const ro=io(["Arab","Dupl","Mong","Ougr","Syrc"]);function no(e){return!ro.test(String.fromCodePoint(e))}const oo=io(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function ao(e){return!(746!==e&&747!==e&&(e<4352||!(Qn["CJK Compatibility Forms"](e)&&!(e>=65097&&e<=65103)||Qn["CJK Compatibility"](e)||Qn["CJK Strokes"](e)||!(!Qn["CJK Symbols and Punctuation"](e)||e>=12296&&e<=12305||e>=12308&&e<=12319||12336===e)||Qn["Enclosed CJK Letters and Months"](e)||Qn["Ideographic Description Characters"](e)||Qn.Kanbun(e)||Qn.Katakana(e)&&12540!==e||!(!Qn["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)||!(!Qn["Small Form Variants"](e)||e>=65112&&e<=65118||e>=65123&&e<=65126)||Qn["Vertical Forms"](e)||Qn["Yijing Hexagram Symbols"](e)||/\p{sc=Cans}/u.test(String.fromCodePoint(e))||/\p{sc=Hang}/u.test(String.fromCodePoint(e))||oo.test(String.fromCodePoint(e)))))}function so(e){return!(ao(e)||function(e){return!!(Qn["Latin-1 Supplement"](e)&&(167===e||169===e||174===e||177===e||188===e||189===e||190===e||215===e||247===e)||Qn["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)||Qn["Letterlike Symbols"](e)||Qn["Number Forms"](e)||Qn["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)||Qn["Control Pictures"](e)&&9251!==e||Qn["Optical Character Recognition"](e)||Qn["Enclosed Alphanumerics"](e)||Qn["Geometric Shapes"](e)||Qn["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||Qn["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Qn["CJK Symbols and Punctuation"](e)||Qn.Katakana(e)||Qn["Private Use Area"](e)||Qn["CJK Compatibility Forms"](e)||Qn["Small Form Variants"](e)||Qn["Halfwidth and Fullwidth Forms"](e)||8734===e||8756===e||8757===e||e>=9984&&e<=10087||e>=10102&&e<=10131||65532===e||65533===e)}(e))}const lo=io(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function co(e){return lo.test(String.fromCodePoint(e))}function uo(e,t){return!(!t&&co(e)||e>=2304&&e<=3583||e>=3840&&e<=4255||Qn.Khmer(e))}function ho(e){for(const t of e)if(co(t.charCodeAt(0)))return!0;return!1}const po=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(e){this.pluginStatus=e.pluginStatus,this.pluginURL=e.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(e){if(po.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=e.applyArabicShaping,this.processBidirectionalText=e.processBidirectionalText,this.processStyledBidirectionalText=e.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return null!=this.applyArabicShaping&&null!=this.processBidirectionalText&&null!=this.processStyledBidirectionalText}getRTLTextPluginStatus(){return this.pluginStatus}syncState(e,i){return t(this,void 0,void 0,(function*(){if(this.isParsed())return this.getState();if("loading"!==e.pluginStatus)return this.setState(e),e;const t=e.pluginURL,r=new Promise((e=>{this.loadScriptResolve=e}));i(t);const n=new Promise((e=>setTimeout((()=>e()),this.TIMEOUT)));if(yield Promise.race([r,n]),this.isParsed()){const e={pluginStatus:"loaded",pluginURL:t};return this.setState(e),e}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${t}`)}))}};class mo{constructor(e,t){this.zoom=e,t?(this.now=t.now,this.fadeDuration=t.fadeDuration,this.zoomHistory=t.zoomHistory,this.transition=t.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Jn,this.transition={})}isSupportedScript(e){return function(e,t){for(const i of e)if(!uo(i.charCodeAt(0),t))return!1;return!0}(e,"loaded"===po.getRTLTextPluginStatus())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,t=e-Math.floor(e),i=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:t+(1-t)*i}:{fromScale:.5,toScale:1,t:1-(1-i)*t}}}class fo{constructor(e,t){this.property=e,this.value=t,this.expression=function(e,t){if(Dr(e))return new Wr(e,t);if(Ur(e)){const i=Hr(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"color"===t.type&&"string"==typeof e?i=_t.parse(e):"padding"!==t.type||"number"!=typeof e&&!Array.isArray(e)?"variableAnchorOffsetCollection"===t.type&&Array.isArray(e)?i=At.parse(e):"projectionDefinition"===t.type&&"string"==typeof e&&(i=Et.parse(e)):i=Ct.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 go{constructor(e){this.property=e,this.value=new fo(e,void 0)}transitioned(e,t){return new _o(this.property,this.value,t,F({},e.transition,this.transition),e.now)}untransitioned(){return new _o(this.property,this.value,null,{},0)}}class yo{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return j(this._values[e].value.value)}setValue(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new go(this._values[e].property)),this._values[e].value=new fo(this._values[e].property,null===t?void 0:j(t))}getTransition(e){return j(this._values[e].transition)}setTransition(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new go(this._values[e].property)),this._values[e].transition=j(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 r=this.getTransition(t);void 0!==r&&(e[`${t}-transition`]=r)}return e}transitioned(e,t){const i=new vo(this._properties);for(const r of Object.keys(this._values))i._values[r]=this._values[r].transitioned(e,t._values[r]);return i}untransitioned(){const e=new vo(this._properties);for(const t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}}class _o{constructor(e,t,i,r,n){this.property=e,this.value=t,this.begin=n+r.delay||0,this.end=this.begin+r.duration||0,e.specification.transition&&(r.delay||r.duration)&&(this.prior=i)}possiblyEvaluate(e,t,i){const r=e.now||0,n=this.value.possiblyEvaluate(e,t,i),o=this.prior;if(o){if(r>this.end)return this.prior=null,n;if(this.value.isDataDriven())return this.prior=null,n;if(r<this.begin)return o.possiblyEvaluate(e,t,i);{const a=(r-this.begin)/(this.end-this.begin);return this.property.interpolate(o.possiblyEvaluate(e,t,i),n,I(a))}}return n}}class vo{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,i){const r=new wo(this._properties);for(const n of Object.keys(this._values))r._values[n]=this._values[n].possiblyEvaluate(e,t,i);return r}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class xo{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return void 0!==this._values[e].value}getValue(e){return j(this._values[e].value)}setValue(e,t){this._values[e]=new fo(this._values[e].property,null===t?void 0:j(t))}serialize(){const e={};for(const t of Object.keys(this._values)){const i=this.getValue(t);void 0!==i&&(e[t]=i)}return e}possiblyEvaluate(e,t,i){const r=new wo(this._properties);for(const n of Object.keys(this._values))r._values[n]=this._values[n].possiblyEvaluate(e,t,i);return r}}class bo{constructor(e,t,i){this.property=e,this.value=t,this.parameters=i}isConstant(){return"constant"===this.value.kind}constantOr(e){return"constant"===this.value.kind?this.value.value:e}evaluate(e,t,i,r){return this.property.evaluate(this.value,this.parameters,e,t,i,r)}}class wo{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Co{constructor(e){this.specification=e}possiblyEvaluate(e,t){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(t)}interpolate(e,t,i){const r=ni[this.specification.type];return r?r(e,t,i):e}}class To{constructor(e,t){this.specification=e,this.overrides=t}possiblyEvaluate(e,t,i,r){return new bo(this,"constant"===e.expression.kind||"camera"===e.expression.kind?{kind:"constant",value:e.expression.evaluate(t,null,{},i,r)}:e.expression,t)}interpolate(e,t,i){if("constant"!==e.value.kind||"constant"!==t.value.kind)return e;if(void 0===e.value.value||void 0===t.value.value)return new bo(this,{kind:"constant",value:void 0},e.parameters);const r=ni[this.specification.type];if(r){const n=r(e.value.value,t.value.value,i);return new bo(this,{kind:"constant",value:n},e.parameters)}return e}evaluate(e,t,i,r,n,o){return"constant"===e.kind?e.value:e.evaluate(t,i,r,n,o)}}class So extends To{possiblyEvaluate(e,t,i,r){if(void 0===e.value)return new bo(this,{kind:"constant",value:void 0},t);if("constant"===e.expression.kind){const n=e.expression.evaluate(t,null,{},i,r),o="resolvedImage"===e.property.specification.type&&"string"!=typeof n?n.name:n,a=this._calculate(o,o,o,t);return new bo(this,{kind:"constant",value:a},t)}if("camera"===e.expression.kind){const i=this._calculate(e.expression.evaluate({zoom:t.zoom-1}),e.expression.evaluate({zoom:t.zoom}),e.expression.evaluate({zoom:t.zoom+1}),t);return new bo(this,{kind:"constant",value:i},t)}return new bo(this,e.expression,t)}evaluate(e,t,i,r,n,o){if("source"===e.kind){const a=e.evaluate(t,i,r,n,o);return this._calculate(a,a,a,t)}return"composite"===e.kind?this._calculate(e.evaluate({zoom:Math.floor(t.zoom)-1},i,r),e.evaluate({zoom:Math.floor(t.zoom)},i,r),e.evaluate({zoom:Math.floor(t.zoom)+1},i,r),t):e.value}_calculate(e,t,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:i,to:t}}interpolate(e){return e}}class Ao{constructor(e){this.specification=e}possiblyEvaluate(e,t,i,r){if(void 0!==e.value){if("constant"===e.expression.kind){const n=e.expression.evaluate(t,null,{},i,r);return this._calculate(n,n,n,t)}return this._calculate(e.expression.evaluate(new mo(Math.floor(t.zoom-1),t)),e.expression.evaluate(new mo(Math.floor(t.zoom),t)),e.expression.evaluate(new mo(Math.floor(t.zoom+1),t)),t)}}_calculate(e,t,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:i,to:t}}interpolate(e){return e}}class Mo{constructor(e){this.specification=e}possiblyEvaluate(e,t,i,r){return!!e.expression.evaluate(t,null,{},i,r)}interpolate(){return!1}}class Eo{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const t in e){const i=e[t];i.specification.overridable&&this.overridableProperties.push(t);const r=this.defaultPropertyValues[t]=new fo(i,void 0),n=this.defaultTransitionablePropertyValues[t]=new go(i);this.defaultTransitioningPropertyValues[t]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[t]=r.possiblyEvaluate({})}}}Gn("DataDrivenProperty",To),Gn("DataConstantProperty",Co),Gn("CrossFadedDataDrivenProperty",So),Gn("CrossFadedProperty",Ao),Gn("ColorRampProperty",Mo);const Po="-transition";class Io extends de{constructor(e,t){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},"custom"!==e.type&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,"background"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),t.layout&&(this._unevaluatedLayout=new xo(t.layout)),t.paint)){this._transitionablePaint=new yo(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 wo(t.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return"visibility"===e?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,t,i={}){null!=t&&this._validate(Vn,`layers.${this.id}.layout.${e}`,e,t,i)||("visibility"!==e?this._unevaluatedLayout.setValue(e,t):this.visibility=t)}getPaintProperty(e){return e.endsWith(Po)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,t,i={}){if(null!=t&&this._validate($n,`layers.${this.id}.paint.${e}`,e,t,i))return!1;if(e.endsWith(Po))return this._transitionablePaint.setTransition(e.slice(0,-11),t||void 0),!1;{const i=this._transitionablePaint._values[e],r="cross-faded-data-driven"===i.property.specification["property-type"],n=i.value.isDataDriven(),o=i.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);const a=this._transitionablePaint._values[e].value;return a.isDataDriven()||n||r||this._handleOverridablePaintPropertyUpdate(e,o,a)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,t,i){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||"none"===this.visibility}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,t){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),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),O(e,((e,t)=>!(void 0===e||"layout"===t&&!Object.keys(e).length||"paint"===t&&!Object.keys(e).length)))}_validate(e,t,i,r,n={}){return(!n||!1!==n.validate)&&Un(this,e.call(On,{key:t,layerType:this.type,objectKey:i,value:r,styleSpec:me,style:{glyphs:!0,sprite:!0}}))}is3D(){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 bo&&Ir(t.property.specification)&&("source"===t.value.kind||"composite"===t.value.kind)&&t.value.isStateDependent)return!0}return!1}}const ko={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class zo{constructor(e,t){this._structArray=e,this._pos1=t*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Lo{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,t){return e._trim(),t&&(e.isTransferred=!0,t.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const t=Object.create(this.prototype);return t.arrayBuffer=e.arrayBuffer,t.length=e.length,t.capacity=e.arrayBuffer.byteLength/t.bytesPerElement,t._refreshViews(),t}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Do(e,t=1){let i=0,r=0;return{members:e.map((e=>{const n=ko[e.type].BYTES_PER_ELEMENT,o=i=Fo(i,Math.max(t,n)),a=e.components||1;return r=Math.max(r,n),i+=n*a,{name:e.name,type:e.type,components:a,offset:o}})),size:Fo(i,Math.max(r,t)),alignment:t}}function Fo(e,t){return Math.ceil(e/t)*t}class Ro extends Lo{_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 r=2*e;return this.int16[r+0]=t,this.int16[r+1]=i,e}}Ro.prototype.bytesPerElement=4,Gn("StructArrayLayout2i4",Ro);class Bo extends Lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=3*e;return this.int16[n+0]=t,this.int16[n+1]=i,this.int16[n+2]=r,e}}Bo.prototype.bytesPerElement=6,Gn("StructArrayLayout3i6",Bo);class Oo extends Lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){const o=4*e;return this.int16[o+0]=t,this.int16[o+1]=i,this.int16[o+2]=r,this.int16[o+3]=n,e}}Oo.prototype.bytesPerElement=8,Gn("StructArrayLayout4i8",Oo);class jo extends Lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,r,n,o)}emplace(e,t,i,r,n,o,a){const s=6*e;return this.int16[s+0]=t,this.int16[s+1]=i,this.int16[s+2]=r,this.int16[s+3]=n,this.int16[s+4]=o,this.int16[s+5]=a,e}}jo.prototype.bytesPerElement=12,Gn("StructArrayLayout2i4i12",jo);class No extends Lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,r,n,o)}emplace(e,t,i,r,n,o,a){const s=4*e,l=8*e;return this.int16[s+0]=t,this.int16[s+1]=i,this.uint8[l+4]=r,this.uint8[l+5]=n,this.uint8[l+6]=o,this.uint8[l+7]=a,e}}No.prototype.bytesPerElement=8,Gn("StructArrayLayout2i4ub8",No);class $o extends Lo{_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 r=2*e;return this.float32[r+0]=t,this.float32[r+1]=i,e}}$o.prototype.bytesPerElement=8,Gn("StructArrayLayout2f8",$o);class Vo extends Lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,a,s,l,c){const u=this.length;return this.resize(u+1),this.emplace(u,e,t,i,r,n,o,a,s,l,c)}emplace(e,t,i,r,n,o,a,s,l,c,u){const h=10*e;return this.uint16[h+0]=t,this.uint16[h+1]=i,this.uint16[h+2]=r,this.uint16[h+3]=n,this.uint16[h+4]=o,this.uint16[h+5]=a,this.uint16[h+6]=s,this.uint16[h+7]=l,this.uint16[h+8]=c,this.uint16[h+9]=u,e}}Vo.prototype.bytesPerElement=20,Gn("StructArrayLayout10ui20",Vo);class Uo extends Lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,a,s,l,c,u,h){const p=this.length;return this.resize(p+1),this.emplace(p,e,t,i,r,n,o,a,s,l,c,u,h)}emplace(e,t,i,r,n,o,a,s,l,c,u,h,p){const d=12*e;return this.int16[d+0]=t,this.int16[d+1]=i,this.int16[d+2]=r,this.int16[d+3]=n,this.uint16[d+4]=o,this.uint16[d+5]=a,this.uint16[d+6]=s,this.uint16[d+7]=l,this.int16[d+8]=c,this.int16[d+9]=u,this.int16[d+10]=h,this.int16[d+11]=p,e}}Uo.prototype.bytesPerElement=24,Gn("StructArrayLayout4i4ui4i24",Uo);class qo extends Lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=3*e;return this.float32[n+0]=t,this.float32[n+1]=i,this.float32[n+2]=r,e}}qo.prototype.bytesPerElement=12,Gn("StructArrayLayout3f12",qo);class Zo extends Lo{_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}}Zo.prototype.bytesPerElement=4,Gn("StructArrayLayout1ul4",Zo);class Go extends Lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,a,s,l){const c=this.length;return this.resize(c+1),this.emplace(c,e,t,i,r,n,o,a,s,l)}emplace(e,t,i,r,n,o,a,s,l,c){const u=10*e,h=5*e;return this.int16[u+0]=t,this.int16[u+1]=i,this.int16[u+2]=r,this.int16[u+3]=n,this.int16[u+4]=o,this.int16[u+5]=a,this.uint32[h+3]=s,this.uint16[u+8]=l,this.uint16[u+9]=c,e}}Go.prototype.bytesPerElement=20,Gn("StructArrayLayout6i1ul2ui20",Go);class Ho extends Lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,r,n,o)}emplace(e,t,i,r,n,o,a){const s=6*e;return this.int16[s+0]=t,this.int16[s+1]=i,this.int16[s+2]=r,this.int16[s+3]=n,this.int16[s+4]=o,this.int16[s+5]=a,e}}Ho.prototype.bytesPerElement=12,Gn("StructArrayLayout2i2i2i12",Ho);class Wo extends Lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n)}emplace(e,t,i,r,n,o){const a=4*e,s=8*e;return this.float32[a+0]=t,this.float32[a+1]=i,this.float32[a+2]=r,this.int16[s+6]=n,this.int16[s+7]=o,e}}Wo.prototype.bytesPerElement=16,Gn("StructArrayLayout2f1f2i16",Wo);class Ko extends Lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,r,n,o)}emplace(e,t,i,r,n,o,a){const s=16*e,l=4*e,c=8*e;return this.uint8[s+0]=t,this.uint8[s+1]=i,this.float32[l+1]=r,this.float32[l+2]=n,this.int16[c+6]=o,this.int16[c+7]=a,e}}Ko.prototype.bytesPerElement=16,Gn("StructArrayLayout2ub2f2i16",Ko);class Xo extends Lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=3*e;return this.uint16[n+0]=t,this.uint16[n+1]=i,this.uint16[n+2]=r,e}}Xo.prototype.bytesPerElement=6,Gn("StructArrayLayout3ui6",Xo);class Yo extends Lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,a,s,l,c,u,h,p,d,m,f,g){const y=this.length;return this.resize(y+1),this.emplace(y,e,t,i,r,n,o,a,s,l,c,u,h,p,d,m,f,g)}emplace(e,t,i,r,n,o,a,s,l,c,u,h,p,d,m,f,g,y){const _=24*e,v=12*e,x=48*e;return this.int16[_+0]=t,this.int16[_+1]=i,this.uint16[_+2]=r,this.uint16[_+3]=n,this.uint32[v+2]=o,this.uint32[v+3]=a,this.uint32[v+4]=s,this.uint16[_+10]=l,this.uint16[_+11]=c,this.uint16[_+12]=u,this.float32[v+7]=h,this.float32[v+8]=p,this.uint8[x+36]=d,this.uint8[x+37]=m,this.uint8[x+38]=f,this.uint32[v+10]=g,this.int16[_+22]=y,e}}Yo.prototype.bytesPerElement=48,Gn("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Yo);class Jo extends Lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,a,s,l,c,u,h,p,d,m,f,g,y,_,v,x,b,w,C,T,S,A,M){const E=this.length;return this.resize(E+1),this.emplace(E,e,t,i,r,n,o,a,s,l,c,u,h,p,d,m,f,g,y,_,v,x,b,w,C,T,S,A,M)}emplace(e,t,i,r,n,o,a,s,l,c,u,h,p,d,m,f,g,y,_,v,x,b,w,C,T,S,A,M,E){const P=32*e,I=16*e;return this.int16[P+0]=t,this.int16[P+1]=i,this.int16[P+2]=r,this.int16[P+3]=n,this.int16[P+4]=o,this.int16[P+5]=a,this.int16[P+6]=s,this.int16[P+7]=l,this.uint16[P+8]=c,this.uint16[P+9]=u,this.uint16[P+10]=h,this.uint16[P+11]=p,this.uint16[P+12]=d,this.uint16[P+13]=m,this.uint16[P+14]=f,this.uint16[P+15]=g,this.uint16[P+16]=y,this.uint16[P+17]=_,this.uint16[P+18]=v,this.uint16[P+19]=x,this.uint16[P+20]=b,this.uint16[P+21]=w,this.uint16[P+22]=C,this.uint32[I+12]=T,this.float32[I+13]=S,this.float32[I+14]=A,this.uint16[P+30]=M,this.uint16[P+31]=E,e}}Jo.prototype.bytesPerElement=64,Gn("StructArrayLayout8i15ui1ul2f2ui64",Jo);class Qo extends Lo{_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}}Qo.prototype.bytesPerElement=4,Gn("StructArrayLayout1f4",Qo);class ea extends Lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=3*e;return this.uint16[6*e+0]=t,this.float32[n+1]=i,this.float32[n+2]=r,e}}ea.prototype.bytesPerElement=12,Gn("StructArrayLayout1ui2f12",ea);class ta extends Lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=4*e;return this.uint32[2*e+0]=t,this.uint16[n+2]=i,this.uint16[n+3]=r,e}}ta.prototype.bytesPerElement=8,Gn("StructArrayLayout1ul2ui8",ta);class ia extends Lo{_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 r=2*e;return this.uint16[r+0]=t,this.uint16[r+1]=i,e}}ia.prototype.bytesPerElement=4,Gn("StructArrayLayout2ui4",ia);class ra extends Lo{_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}}ra.prototype.bytesPerElement=2,Gn("StructArrayLayout1ui2",ra);class na extends Lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){const o=4*e;return this.float32[o+0]=t,this.float32[o+1]=i,this.float32[o+2]=r,this.float32[o+3]=n,e}}na.prototype.bytesPerElement=16,Gn("StructArrayLayout4f16",na);class oa extends zo{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new l(this.anchorPointX,this.anchorPointY)}}oa.prototype.size=20;class aa extends Go{get(e){return new oa(this,e)}}Gn("CollisionBoxArray",aa);class sa extends zo{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}sa.prototype.size=48;class la extends Yo{get(e){return new sa(this,e)}}Gn("PlacedSymbolArray",la);class ca extends zo{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}ca.prototype.size=64;class ua extends Jo{get(e){return new ca(this,e)}}Gn("SymbolInstanceArray",ua);class ha extends Qo{getoffsetX(e){return this.float32[1*e+0]}}Gn("GlyphOffsetArray",ha);class pa extends Bo{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}Gn("SymbolLineVertexArray",pa);class da extends zo{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}da.prototype.size=12;class ma extends ea{get(e){return new da(this,e)}}Gn("TextAnchorOffsetArray",ma);class fa extends zo{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]}}fa.prototype.size=8;class ga extends ta{get(e){return new fa(this,e)}}Gn("FeatureIndexArray",ga);class ya extends Ro{}class _a extends Ro{}class va extends Ro{}class xa extends jo{}class ba extends No{}class wa extends $o{}class Ca extends Vo{}class Ta extends Uo{}class Sa extends qo{}class Aa extends Zo{}class Ma extends Ho{}class Ea extends Ko{}class Pa extends Xo{}class Ia extends ia{}const ka=Do([{name:"a_pos",components:2,type:"Int16"}],4),{members:za}=ka;class La{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=e}prepareSegment(e,t,i,r){const n=this.segments[this.segments.length-1];return e>La.MAX_VERTEX_ARRAY_LENGTH&&$(`Max vertices per segment is ${La.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${La.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!n||n.vertexLength+e>La.MAX_VERTEX_ARRAY_LENGTH||n.sortKey!==r?this.createNewSegment(t,i,r):n}createNewSegment(e,t,i){const r={vertexOffset:e.length,primitiveOffset:t.length,vertexLength:0,primitiveLength:0,vaos:{}};return void 0!==i&&(r.sortKey=i),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(r),r}getOrCreateLatestSegment(e,t,i){return this.prepareSegment(0,e,t,i)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}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,r){return new La([{vertexOffset:e,primitiveOffset:t,vertexLength:i,primitiveLength:r,vaos:{},sortKey:0}])}}function Da(e,t){return 256*(e=L(Math.floor(e),0,255))+L(Math.floor(t),0,255)}La.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Gn("SegmentVector",La);const Fa=Do([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var Ra,Ba,Oa,ja={exports:{}},Na={exports:{}},$a={exports:{}},Va=function(){if(Oa)return ja.exports;Oa=1;var e=(Ra||(Ra=1,Na.exports=function(e,t){var i,r,n,o,a,s,l,c;for(r=e.length-(i=3&e.length),n=t,a=3432918353,s=461845907,c=0;c<r;)l=255&e.charCodeAt(c)|(255&e.charCodeAt(++c))<<8|(255&e.charCodeAt(++c))<<16|(255&e.charCodeAt(++c))<<24,++c,n=27492+(65535&(o=5*(65535&(n=(n^=l=(65535&(l=(l=(65535&l)*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<13|n>>>19))+((5*(n>>>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:n^=l=(65535&(l=(l=(65535&(l^=255&e.charCodeAt(c)))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295}return n^=e.length,n=2246822507*(65535&(n^=n>>>16))+((2246822507*(n>>>16)&65535)<<16)&4294967295,n=3266489909*(65535&(n^=n>>>13))+((3266489909*(n>>>16)&65535)<<16)&4294967295,(n^=n>>>16)>>>0}),Na.exports),t=(Ba||(Ba=1,$a.exports=function(e,t){for(var i,r=e.length,n=t^r,o=0;r>=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),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),r-=4,++o;switch(r){case 3:n^=(255&e.charCodeAt(o+2))<<16;case 2:n^=(255&e.charCodeAt(o+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(o)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0}),$a.exports);return ja.exports=e,ja.exports.murmur3=e,ja.exports.murmur2=t,ja.exports}(),Ua=i(Va);class qa{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,t,i,r){this.ids.push(Za(e)),this.positions.push(t,i,r)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const t=Za(e);let i=0,r=this.ids.length-1;for(;i<r;){const e=i+r>>1;this.ids[e]>=t?r=e:i=e+1}const n=[];for(;this.ids[i]===t;)n.push({index:this.positions[3*i],start:this.positions[3*i+1],end:this.positions[3*i+2]}),i++;return n}static serialize(e,t){const i=new Float64Array(e.ids),r=new Uint32Array(e.positions);return Ga(i,r,0,i.length-1),t&&t.push(i.buffer,r.buffer),{ids:i,positions:r}}static deserialize(e){const t=new qa;return t.ids=e.ids,t.positions=e.positions,t.indexed=!0,t}}function Za(e){const t=+e;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:Ua(String(e))}function Ga(e,t,i,r){for(;i<r;){const n=e[i+r>>1];let o=i-1,a=r+1;for(;;){do{o++}while(e[o]<n);do{a--}while(e[a]>n);if(o>=a)break;Ha(e,o,a),Ha(t,3*o,3*a),Ha(t,3*o+1,3*a+1),Ha(t,3*o+2,3*a+2)}a-i<r-a?(Ga(e,t,i,a),i=a+1):(Ga(e,t,a+1,r),r=a)}}function Ha(e,t,i){const r=e[t];e[t]=e[i],e[i]=r}Gn("FeaturePositionMap",qa);class Wa{constructor(e,t){this.gl=e.gl,this.location=t}}class Ka extends Wa{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class Xa extends Wa{constructor(e,t){super(e,t),this.current=[0,0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]&&e[3]===this.current[3]||(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}}class Ya extends Wa{constructor(e,t){super(e,t),this.current=_t.transparent}set(e){e.r===this.current.r&&e.g===this.current.g&&e.b===this.current.b&&e.a===this.current.a||(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}}const Ja=new Float32Array(16);function Qa(e){return[Da(255*e.r,255*e.g),Da(255*e.b,255*e.a)]}class es{constructor(e,t,i){this.value=e,this.uniformNames=t.map((e=>`u_${e}`)),this.type=i}setUniform(e,t,i){e.set(i.constantOr(this.value))}getBinding(e,t,i){return"color"===this.type?new Ya(e,t):new Ka(e,t)}}class ts{constructor(e,t){this.uniformNames=t.map((e=>`u_${e}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,t){this.pixelRatioFrom=t.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=t.tlbr,this.patternTo=e.tlbr}setUniform(e,t,i,r){const n="u_pattern_to"===r?this.patternTo:"u_pattern_from"===r?this.patternFrom:"u_pixel_ratio_to"===r?this.pixelRatioTo:"u_pixel_ratio_from"===r?this.pixelRatioFrom:null;n&&e.set(n)}getBinding(e,t,i){return"u_pattern"===i.substr(0,9)?new Xa(e,t):new Ka(e,t)}}class is{constructor(e,t,i,r){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 r}populatePaintArray(e,t,i,r,n){const o=this.paintVertexArray.length,a=this.expression.evaluate(new mo(0),t,{},r,[],n);this.paintVertexArray.resize(e),this._setPaintValue(o,e,a)}updatePaintArray(e,t,i,r){const n=this.expression.evaluate({zoom:0},i,r);this._setPaintValue(e,t,n)}_setPaintValue(e,t,i){if("color"===this.type){const r=Qa(i);for(let i=e;i<t;i++)this.paintVertexArray.emplace(i,r[0],r[1])}else{for(let r=e;r<t;r++)this.paintVertexArray.emplace(r,i);this.maxValue=Math.max(this.maxValue,Math.abs(i))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class rs{constructor(e,t,i,r,n,o){this.expression=e,this.uniformNames=t.map((e=>`u_${e}_t`)),this.type=i,this.useIntegerZoom=r,this.zoom=n,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,r,n){const o=this.expression.evaluate(new mo(this.zoom),t,{},r,[],n),a=this.expression.evaluate(new mo(this.zoom+1),t,{},r,[],n),s=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(s,e,o,a)}updatePaintArray(e,t,i,r){const n=this.expression.evaluate({zoom:this.zoom},i,r),o=this.expression.evaluate({zoom:this.zoom+1},i,r);this._setPaintValue(e,t,n,o)}_setPaintValue(e,t,i,r){if("color"===this.type){const n=Qa(i),o=Qa(r);for(let i=e;i<t;i++)this.paintVertexArray.emplace(i,n[0],n[1],o[0],o[1])}else{for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,i,r);this.maxValue=Math.max(this.maxValue,Math.abs(i),Math.abs(r))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,t){const i=this.useIntegerZoom?Math.floor(t.zoom):t.zoom,r=L(this.expression.interpolationFactor(i,this.zoom,this.zoom+1),0,1);e.set(r)}getBinding(e,t,i){return new Ka(e,t)}}class ns{constructor(e,t,i,r,n,o){this.expression=e,this.type=t,this.useIntegerZoom=i,this.zoom=r,this.layerId=o,this.zoomInPaintVertexArray=new n,this.zoomOutPaintVertexArray=new n}populatePaintArray(e,t,i){const r=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(r,e,t.patterns&&t.patterns[this.layerId],i)}updatePaintArray(e,t,i,r,n){this._setPaintValues(e,t,i.patterns&&i.patterns[this.layerId],n)}_setPaintValues(e,t,i,r){if(!r||!i)return;const{min:n,mid:o,max:a}=i,s=r[n],l=r[o],c=r[a];if(s&&l&&c)for(let i=e;i<t;i++)this.zoomInPaintVertexArray.emplace(i,l.tl[0],l.tl[1],l.br[0],l.br[1],s.tl[0],s.tl[1],s.br[0],s.br[1],l.pixelRatio,s.pixelRatio),this.zoomOutPaintVertexArray.emplace(i,l.tl[0],l.tl[1],l.br[0],l.br[1],c.tl[0],c.tl[1],c.br[0],c.br[1],l.pixelRatio,c.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,Fa.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,Fa.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class os{constructor(e,t,i){this.binders={},this._buffers=[];const r=[];for(const n in e.paint._values){if(!i(n))continue;const o=e.paint.get(n);if(!(o instanceof bo&&Ir(o.property.specification)))continue;const a=ss(n,e.type),s=o.value,l=o.property.specification.type,c=o.property.useIntegerZoom,u=o.property.specification["property-type"],h="cross-faded"===u||"cross-faded-data-driven"===u;if("constant"===s.kind)this.binders[n]=h?new ts(s.value,a):new es(s.value,a,l),r.push(`/u_${n}`);else if("source"===s.kind||h){const i=ls(n,l,"source");this.binders[n]=h?new ns(s,l,c,t,i,e.id):new is(s,a,l,i),r.push(`/a_${n}`)}else{const e=ls(n,l,"composite");this.binders[n]=new rs(s,a,l,c,t,e),r.push(`/z_${n}`)}}this.cacheKey=r.sort().join("")}getMaxValue(e){const t=this.binders[e];return t instanceof is||t instanceof rs?t.maxValue:0}populatePaintArrays(e,t,i,r,n){for(const o in this.binders){const a=this.binders[o];(a instanceof is||a instanceof rs||a instanceof ns)&&a.populatePaintArray(e,t,i,r,n)}}setConstantPatternPositions(e,t){for(const i in this.binders){const r=this.binders[i];r instanceof ts&&r.setConstantPatternPositions(e,t)}}updatePaintArrays(e,t,i,r,n){let o=!1;for(const a in e){const s=t.getPositions(a);for(const t of s){const s=i.feature(t.index);for(const i in this.binders){const l=this.binders[i];if((l instanceof is||l instanceof rs||l instanceof ns)&&!0===l.expression.isStateDependent){const c=r.paint.get(i);l.expression=c.value,l.updatePaintArray(t.start,t.end,s,e[a],n),o=!0}}}}return o}defines(){const e=[];for(const t in this.binders){const i=this.binders[t];(i instanceof es||i instanceof ts)&&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 is||i instanceof rs)for(let t=0;t<i.paintVertexAttributes.length;t++)e.push(i.paintVertexAttributes[t].name);else if(i instanceof ns)for(let t=0;t<Fa.members.length;t++)e.push(Fa.members[t].name)}return e}getBinderUniforms(){const e=[];for(const t in this.binders){const i=this.binders[t];if(i instanceof es||i instanceof ts||i instanceof rs)for(const t of i.uniformNames)e.push(t)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,t){const i=[];for(const r in this.binders){const n=this.binders[r];if(n instanceof es||n instanceof ts||n instanceof rs)for(const o of n.uniformNames)if(t[o]){const a=n.getBinding(e,t[o],o);i.push({name:o,property:r,binding:a})}}return i}setUniforms(e,t,i,r){for(const{name:e,property:n,binding:o}of t)this.binders[n].setUniform(o,r,i.get(n),e)}updatePaintBuffers(e){this._buffers=[];for(const t in this.binders){const i=this.binders[t];if(e&&i instanceof ns){const t=2===e.fromScale?i.zoomInPaintVertexBuffer:i.zoomOutPaintVertexBuffer;t&&this._buffers.push(t)}else(i instanceof is||i instanceof rs)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(e){for(const t in this.binders){const i=this.binders[t];(i instanceof is||i instanceof rs||i instanceof ns)&&i.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const t=this.binders[e];(t instanceof is||t instanceof rs||t instanceof ns)&&t.destroy()}}}class as{constructor(e,t,i=()=>!0){this.programConfigurations={};for(const r of e)this.programConfigurations[r.id]=new os(r,t,i);this.needsUpload=!1,this._featureMap=new qa,this._bufferOffset=0}populatePaintArrays(e,t,i,r,n,o){for(const i in this.programConfigurations)this.programConfigurations[i].populatePaintArrays(e,t,r,n,o);void 0!==t.id&&this._featureMap.add(t.id,i,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,i,r){for(const n of i)this.needsUpload=this.programConfigurations[n.id].updatePaintArrays(e,this._featureMap,t,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()}}function ss(e,t){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[e]||[e.replace(`${t}-`,"").replace(/-/g,"_")]}function ls(e,t,i){const r={color:{source:$o,composite:na},number:{source:Qo,composite:$o}},n=function(e){return{"line-pattern":{source:Ca,composite:Ca},"fill-pattern":{source:Ca,composite:Ca},"fill-extrusion-pattern":{source:Ca,composite:Ca}}[e]}(e);return n&&n[i]||r[t][i]}Gn("ConstantBinder",es),Gn("CrossFadedConstantBinder",ts),Gn("SourceExpressionBinder",is),Gn("CrossFadedCompositeBinder",ns),Gn("CompositeExpressionBinder",rs),Gn("ProgramConfiguration",os,{omit:["_buffers"]}),Gn("ProgramConfigurationSet",as);const cs=Math.pow(2,14)-1,us=-cs-1;function hs(e){const t=A/e.extent,i=e.loadGeometry();for(let e=0;e<i.length;e++){const r=i[e];for(let e=0;e<r.length;e++){const i=r[e],n=Math.round(i.x*t),o=Math.round(i.y*t);i.x=L(n,us,cs),i.y=L(o,us,cs),(n<i.x||n>i.x+1||o<i.y||o>i.y+1)&&$("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return i}function ps(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?hs(e):[]}}const ds=-32768;function ms(e,t,i,r,n){e.emplaceBack(ds+8*t+r,ds+8*i+n)}class fs{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.layoutVertexArray=new _a,this.indexArray=new Pa,this.segments=new La,this.programConfigurations=new as(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,i){const r=this.layers[0],n=[];let o=null,a=!1,s="heatmap"===r.type;if("circle"===r.type){const e=r;o=e.layout.get("circle-sort-key"),a=!o.isConstant(),s=s||"map"===e.paint.get("circle-pitch-alignment")}const l=s?t.subdivisionGranularity.circle:1;for(const{feature:t,id:r,index:s,sourceLayerIndex:l}of e){const e=this.layers[0]._featureFilter.needGeometry,c=ps(t,e);if(!this.layers[0]._featureFilter.filter(new mo(this.zoom),c,i))continue;const u=a?o.evaluate(c,{},i):void 0,h={id:r,properties:t.properties,type:t.type,sourceLayerIndex:l,index:s,geometry:e?c.geometry:hs(t),patterns:{},sortKey:u};n.push(h)}a&&n.sort(((e,t)=>e.sortKey-t.sortKey));for(const r of n){const{geometry:n,index:o,sourceLayerIndex:a}=r,s=e[o].feature;this.addFeature(r,n,o,i,l),t.featureIndex.insert(s,n,o,a,this.index)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,za),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,t,i,r,n=1){let o;switch(n){case 1:o=[0,7];break;case 3:o=[0,2,5,7];break;case 5:o=[0,1,3,4,6,7];break;case 7:o=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${n}; valid values are 1, 3, 5, 7.`)}const a=o.length;for(const i of t)for(const t of i){const i=t.x,r=t.y;if(i<0||i>=A||r<0||r>=A)continue;const n=this.segments.prepareSegment(a*a,this.layoutVertexArray,this.indexArray,e.sortKey),s=n.vertexLength;for(let e=0;e<a;e++)for(let t=0;t<a;t++)ms(this.layoutVertexArray,i,r,o[t],o[e]);for(let e=0;e<a-1;e++)for(let t=0;t<a-1;t++){const i=s+e*a+t,r=s+(e+1)*a+t;this.indexArray.emplaceBack(i,r+1,i+1),this.indexArray.emplaceBack(i,r,r+1)}n.vertexLength+=a*a,n.primitiveLength+=(a-1)*(a-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,{},r)}}function gs(e,t){for(let i=0;i<e.length;i++)if(Ss(t,e[i]))return!0;for(let i=0;i<t.length;i++)if(Ss(e,t[i]))return!0;return!!xs(e,t)}function ys(e,t,i){return!!Ss(e,t)||!!ws(t,e,i)}function _s(e,t){if(1===e.length)return Ts(t,e[0]);for(let i=0;i<t.length;i++){const r=t[i];for(let t=0;t<r.length;t++)if(Ss(e,r[t]))return!0}for(let i=0;i<e.length;i++)if(Ts(t,e[i]))return!0;for(let i=0;i<t.length;i++)if(xs(e,t[i]))return!0;return!1}function vs(e,t,i){if(e.length>1){if(xs(e,t))return!0;for(let r=0;r<t.length;r++)if(ws(t[r],e,i))return!0}for(let r=0;r<e.length;r++)if(ws(e[r],t,i))return!0;return!1}function xs(e,t){if(0===e.length||0===t.length)return!1;for(let i=0;i<e.length-1;i++){const r=e[i],n=e[i+1];for(let e=0;e<t.length-1;e++)if(bs(r,n,t[e],t[e+1]))return!0}return!1}function bs(e,t,i,r){return V(e,i,r)!==V(t,i,r)&&V(e,t,i)!==V(e,t,r)}function ws(e,t,i){const r=i*i;if(1===t.length)return e.distSqr(t[0])<r;for(let i=1;i<t.length;i++)if(Cs(e,t[i-1],t[i])<r)return!0;return!1}function Cs(e,t,i){const r=t.distSqr(i);if(0===r)return e.distSqr(t);const n=((e.x-t.x)*(i.x-t.x)+(e.y-t.y)*(i.y-t.y))/r;return e.distSqr(n<0?t:n>1?i:i.sub(t)._mult(n)._add(t))}function Ts(e,t){for(let i=0;i<e.length;i++)if(Ss(e[i],t))return!0;return!1}function Ss(e,t){let i=!1;for(let r=0,n=e.length-1;r<e.length;n=r++){const o=e[r],a=e[n];o.y>t.y!=a.y>t.y&&t.x<(a.x-o.x)*(t.y-o.y)/(a.y-o.y)+o.x&&(i=!i)}return i}function As(e,t,i){const r=i[0],n=i[2];if(e.x<r.x&&t.x<r.x||e.x>n.x&&t.x>n.x||e.y<r.y&&t.y<r.y||e.y>n.y&&t.y>n.y)return!1;const o=V(e,t,i[0]);return o!==V(e,t,i[1])||o!==V(e,t,i[2])||o!==V(e,t,i[3])}function Ms(e,t,i){const r=t.paint.get(e).value;return"constant"===r.kind?r.value:i.programConfigurations.get(t.id).getMaxValue(e)}function Es(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function Ps(e,t,i,r,n){if(!t[0]&&!t[1])return e;const o=l.convert(t)._mult(n);"viewport"===i&&o._rotate(-r);const a=[];for(let t=0;t<e.length;t++)a.push(e[t].sub(o));return a}let Is,ks;Gn("CircleBucket",fs,{omit:["layers"]});var zs={get paint(){return ks=ks||new Eo({"circle-radius":new To(me.paint_circle["circle-radius"]),"circle-color":new To(me.paint_circle["circle-color"]),"circle-blur":new To(me.paint_circle["circle-blur"]),"circle-opacity":new To(me.paint_circle["circle-opacity"]),"circle-translate":new Co(me.paint_circle["circle-translate"]),"circle-translate-anchor":new Co(me.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Co(me.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Co(me.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new To(me.paint_circle["circle-stroke-width"]),"circle-stroke-color":new To(me.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new To(me.paint_circle["circle-stroke-opacity"])})},get layout(){return Is=Is||new Eo({"circle-sort-key":new To(me.layout_circle["circle-sort-key"])})}};class Ls extends Io{constructor(e){super(e,zs)}createBucket(e){return new fs(e)}queryRadius(e){const t=e;return Ms("circle-radius",this,t)+Ms("circle-stroke-width",this,t)+Es(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:r,transform:n,pixelsToTileUnits:o,unwrappedTileID:a,getElevation:s}){const l=Ps(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-n.bearingInRadians,o),c=this.paint.get("circle-radius").evaluate(t,i)+this.paint.get("circle-stroke-width").evaluate(t,i),u="map"===this.paint.get("circle-pitch-alignment"),h=u?l:function(e,t,i,r){return e.map((e=>Ds(e,t,i,r)))}(l,n,a,s),p=u?c*o:c;for(const e of r)for(const t of e){const e=u?t:Ds(t,n,a,s);let i=p;const r=n.projectTileCoordinates(t.x,t.y,a,s).signedDistanceFromCamera;if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?i*=r/n.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(i*=n.cameraToCenterDistance/r),ys(h,e,i))return!0}return!1}}function Ds(e,t,i,r){const n=t.projectTileCoordinates(e.x,e.y,i,r).point;return new l((.5*n.x+.5)*t.width,(.5*-n.y+.5)*t.height)}class Fs extends fs{}let Rs;Gn("HeatmapBucket",Fs,{omit:["layers"]});var Bs={get paint(){return Rs=Rs||new Eo({"heatmap-radius":new To(me.paint_heatmap["heatmap-radius"]),"heatmap-weight":new To(me.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Co(me.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Mo(me.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Co(me.paint_heatmap["heatmap-opacity"])})}};function Os(e,{width:t,height:i},r,n){if(n){if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==t*i*r)throw new RangeError(`mismatched image size. expected: ${n.length} but got: ${t*i*r}`)}else n=new Uint8Array(t*i*r);return e.width=t,e.height=i,e.data=n,e}function js(e,{width:t,height:i},r){if(t===e.width&&i===e.height)return;const n=Os({},{width:t,height:i},r);Ns(e,n,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,t),height:Math.min(e.height,i)},r),e.width=t,e.height=i,e.data=n.data}function Ns(e,t,i,r,n,o){if(0===n.width||0===n.height)return t;if(n.width>e.width||n.height>e.height||i.x>e.width-n.width||i.y>e.height-n.height)throw new RangeError("out of range source coordinates for image copy");if(n.width>t.width||n.height>t.height||r.x>t.width-n.width||r.y>t.height-n.height)throw new RangeError("out of range destination coordinates for image copy");const a=e.data,s=t.data;if(a===s)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<n.height;l++){const c=((i.y+l)*e.width+i.x)*o,u=((r.y+l)*t.width+r.x)*o;for(let e=0;e<n.width*o;e++)s[u+e]=a[c+e]}return t}class $s{constructor(e,t){Os(this,e,1,t)}resize(e){js(this,e,1)}clone(){return new $s({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,i,r,n){Ns(e,t,i,r,n,1)}}class Vs{constructor(e,t){Os(this,e,4,t)}resize(e){js(this,e,4)}replace(e,t){t?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new Vs({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,i,r,n){Ns(e,t,i,r,n,4)}}function Us(e){const t={},i=e.resolution||256,r=e.clips?e.clips.length:1,n=e.image||new Vs({width:i,height:r});if(Math.log(i)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${i}`);const o=(i,r,o)=>{t[e.evaluationKey]=o;const a=e.expression.evaluate(t);n.data[i+r+0]=Math.floor(255*a.r/a.a),n.data[i+r+1]=Math.floor(255*a.g/a.a),n.data[i+r+2]=Math.floor(255*a.b/a.a),n.data[i+r+3]=Math.floor(255*a.a)};if(e.clips)for(let t=0,n=0;t<r;++t,n+=4*i)for(let r=0,a=0;r<i;r++,a+=4){const s=r/(i-1),{start:l,end:c}=e.clips[t];o(n,a,l*(1-s)+c*s)}else for(let e=0,t=0;e<i;e++,t+=4)o(0,t,e/(i-1));return n}Gn("AlphaImage",$s),Gn("RGBAImage",Vs);const qs="big-fb";class Zs extends Io{createBucket(e){return new Fs(e)}constructor(e){super(e,Bs),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){"heatmap-color"===e&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Us({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(qs)&&this.heatmapFbos.delete(qs)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}}let Gs;var Hs={get paint(){return Gs=Gs||new Eo({"hillshade-illumination-direction":new Co(me.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Co(me.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Co(me.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Co(me.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Co(me.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Co(me.paint_hillshade["hillshade-accent-color"])})}};class Ws extends Io{constructor(e){super(e,Hs)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}}const Ks=Do([{name:"a_pos",components:2,type:"Int16"}],4),{members:Xs}=Ks;function Ys(e,t,i){const r=i.patternDependencies;let n=!1;for(const i of t){const t=i.paint.get(`${e}-pattern`);t.isConstant()||(n=!0);const o=t.constantOr(null);o&&(n=!0,r[o.to]=!0,r[o.from]=!0)}return n}function Js(e,t,i,r,n){const o=n.patternDependencies;for(const a of t){const t=a.paint.get(`${e}-pattern`).value;if("constant"!==t.kind){let e=t.evaluate({zoom:r-1},i,{},n.availableImages),s=t.evaluate({zoom:r},i,{},n.availableImages),l=t.evaluate({zoom:r+1},i,{},n.availableImages);e=e&&e.name?e.name:e,s=s&&s.name?s.name:s,l=l&&l.name?l.name:l,o[e]=!0,o[s]=!0,o[l]=!0,i.patterns[a.id]={min:e,mid:s,max:l}}}return i}function Qs(e,t,i,r,n){let o;if(n===function(e,t,i,r){let n=0;for(let o=t,a=i-r;o<i;o+=r)n+=(e[a]-e[o])*(e[o+1]+e[a+1]),a=o;return n}(e,t,i,r)>0)for(let n=t;n<i;n+=r)o=bl(n/r|0,e[n],e[n+1],o);else for(let n=i-r;n>=t;n-=r)o=bl(n/r|0,e[n],e[n+1],o);return o&&fl(o,o.next)&&(wl(o),o=o.next),o}function el(e,t){if(!e)return e;t||(t=e);let i,r=e;do{if(i=!1,r.steiner||!fl(r,r.next)&&0!==ml(r.prev,r,r.next))r=r.next;else{if(wl(r),r=t=r.prev,r===r.next)break;i=!0}}while(i||r!==t);return t}function tl(e,t,i,r,n,o,a){if(!e)return;!a&&o&&function(e,t,i,r){let n=e;do{0===n.z&&(n.z=cl(n.x,n.y,t,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,function(e){let t,i=1;do{let r,n=e;e=null;let o=null;for(t=0;n;){t++;let a=n,s=0;for(let e=0;e<i&&(s++,a=a.nextZ,a);e++);let l=i;for(;s>0||l>0&&a;)0!==s&&(0===l||!a||n.z<=a.z)?(r=n,n=n.nextZ,s--):(r=a,a=a.nextZ,l--),o?o.nextZ=r:e=r,r.prevZ=o,o=r;n=a}o.nextZ=null,i*=2}while(t>1)}(n)}(e,r,n,o);let s=e;for(;e.prev!==e.next;){const l=e.prev,c=e.next;if(o?rl(e,r,n,o):il(e))t.push(l.i,e.i,c.i),wl(e),e=c.next,s=c.next;else if((e=c)===s){a?1===a?tl(e=nl(el(e),t),t,i,r,n,o,2):2===a&&ol(e,t,i,r,n,o):tl(el(e),t,i,r,n,o,1);break}}}function il(e){const t=e.prev,i=e,r=e.next;if(ml(t,i,r)>=0)return!1;const n=t.x,o=i.x,a=r.x,s=t.y,l=i.y,c=r.y,u=Math.min(n,o,a),h=Math.min(s,l,c),p=Math.max(n,o,a),d=Math.max(s,l,c);let m=r.next;for(;m!==t;){if(m.x>=u&&m.x<=p&&m.y>=h&&m.y<=d&&pl(n,s,o,l,a,c,m.x,m.y)&&ml(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function rl(e,t,i,r){const n=e.prev,o=e,a=e.next;if(ml(n,o,a)>=0)return!1;const s=n.x,l=o.x,c=a.x,u=n.y,h=o.y,p=a.y,d=Math.min(s,l,c),m=Math.min(u,h,p),f=Math.max(s,l,c),g=Math.max(u,h,p),y=cl(d,m,t,i,r),_=cl(f,g,t,i,r);let v=e.prevZ,x=e.nextZ;for(;v&&v.z>=y&&x&&x.z<=_;){if(v.x>=d&&v.x<=f&&v.y>=m&&v.y<=g&&v!==n&&v!==a&&pl(s,u,l,h,c,p,v.x,v.y)&&ml(v.prev,v,v.next)>=0)return!1;if(v=v.prevZ,x.x>=d&&x.x<=f&&x.y>=m&&x.y<=g&&x!==n&&x!==a&&pl(s,u,l,h,c,p,x.x,x.y)&&ml(x.prev,x,x.next)>=0)return!1;x=x.nextZ}for(;v&&v.z>=y;){if(v.x>=d&&v.x<=f&&v.y>=m&&v.y<=g&&v!==n&&v!==a&&pl(s,u,l,h,c,p,v.x,v.y)&&ml(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;x&&x.z<=_;){if(x.x>=d&&x.x<=f&&x.y>=m&&x.y<=g&&x!==n&&x!==a&&pl(s,u,l,h,c,p,x.x,x.y)&&ml(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function nl(e,t){let i=e;do{const r=i.prev,n=i.next.next;!fl(r,n)&&gl(r,i,i.next,n)&&vl(r,n)&&vl(n,r)&&(t.push(r.i,i.i,n.i),wl(i),wl(i.next),i=e=n),i=i.next}while(i!==e);return el(i)}function ol(e,t,i,r,n,o){let a=e;do{let e=a.next.next;for(;e!==a.prev;){if(a.i!==e.i&&dl(a,e)){let s=xl(a,e);return a=el(a,a.next),s=el(s,s.next),tl(a,t,i,r,n,o,0),void tl(s,t,i,r,n,o,0)}e=e.next}a=a.next}while(a!==e)}function al(e,t){let i=e.x-t.x;return 0===i&&(i=e.y-t.y,0===i)&&(i=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)),i}function sl(e,t){const i=function(e,t){let i=t;const r=e.x,n=e.y;let o,a=-1/0;if(fl(e,i))return i;do{if(fl(e,i.next))return i.next;if(n<=i.y&&n>=i.next.y&&i.next.y!==i.y){const e=i.x+(n-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(e<=r&&e>a&&(a=e,o=i.x<i.next.x?i:i.next,e===r))return o}i=i.next}while(i!==t);if(!o)return null;const s=o,l=o.x,c=o.y;let u=1/0;i=o;do{if(r>=i.x&&i.x>=l&&r!==i.x&&hl(n<c?r:a,n,l,c,n<c?a:r,n,i.x,i.y)){const t=Math.abs(n-i.y)/(r-i.x);vl(i,e)&&(t<u||t===u&&(i.x>o.x||i.x===o.x&&ll(o,i)))&&(o=i,u=t)}i=i.next}while(i!==s);return o}(e,t);if(!i)return t;const r=xl(i,e);return el(r,r.next),el(i,i.next)}function ll(e,t){return ml(e.prev,e,t.prev)<0&&ml(t.next,e,e.next)<0}function cl(e,t,i,r,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function ul(e){let t=e,i=e;do{(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next}while(t!==e);return i}function hl(e,t,i,r,n,o,a,s){return(n-a)*(t-s)>=(e-a)*(o-s)&&(e-a)*(r-s)>=(i-a)*(t-s)&&(i-a)*(o-s)>=(n-a)*(r-s)}function pl(e,t,i,r,n,o,a,s){return!(e===a&&t===s)&&hl(e,t,i,r,n,o,a,s)}function dl(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&gl(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&(vl(e,t)&&vl(t,e)&&function(e,t){let i=e,r=!1;const n=(e.x+t.x)/2,o=(e.y+t.y)/2;do{i.y>o!=i.next.y>o&&i.next.y!==i.y&&n<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==e);return r}(e,t)&&(ml(e.prev,e,t.prev)||ml(e,t.prev,t))||fl(e,t)&&ml(e.prev,e,e.next)>0&&ml(t.prev,t,t.next)>0)}function ml(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function fl(e,t){return e.x===t.x&&e.y===t.y}function gl(e,t,i,r){const n=_l(ml(e,t,i)),o=_l(ml(e,t,r)),a=_l(ml(i,r,e)),s=_l(ml(i,r,t));return n!==o&&a!==s||!(0!==n||!yl(e,i,t))||!(0!==o||!yl(e,r,t))||!(0!==a||!yl(i,e,r))||!(0!==s||!yl(i,t,r))}function yl(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 _l(e){return e>0?1:e<0?-1:0}function vl(e,t){return ml(e.prev,e,e.next)<0?ml(e,t,e.next)>=0&&ml(e,e.prev,t)>=0:ml(e,t,e.prev)<0||ml(e,e.next,t)<0}function xl(e,t){const i=Cl(e.i,e.x,e.y),r=Cl(t.i,t.x,t.y),n=e.next,o=t.prev;return e.next=t,t.prev=e,i.next=n,n.prev=i,r.next=i,i.prev=r,o.next=r,r.prev=o,r}function bl(e,t,i,r){const n=Cl(e,t,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function wl(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 Cl(e,t,i){return{i:e,x:t,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class Tl{constructor(e,t){if(t>e)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=e,this._minGranularity=t}getGranularityForZoomLevel(e){return Math.max(Math.floor(this._baseZoomGranularity/(1<<e)),this._minGranularity,1)}}class Sl{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}}Sl.noSubdivision=new Sl({fill:new Tl(0,0),line:new Tl(0,0),tile:new Tl(0,0),stencil:new Tl(0,0),circle:1}),Gn("SubdivisionGranularityExpression",Tl),Gn("SubdivisionGranularitySetting",Sl);const Al=-32768,Ml=32767;class El{constructor(e,t){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=e,this._granularityCellSize=A/e,this._canonical=t}_getKey(e,t){return(e+=32768)<<16|(t+=32768)}_vertexToIndex(e,t){if(e<-32768||t<-32768||e>32767||t>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const i=0|Math.round(e),r=0|Math.round(t),n=this._getKey(i,r);if(this._vertexDictionary.has(n))return this._vertexDictionary.get(n);const o=this._vertexBuffer.length/2;return this._vertexDictionary.set(n,o),this._vertexBuffer.push(i,r),o}_subdivideTrianglesScanline(e){if(this._granularity<2)return function(e,t){const i=[];for(let r=0;r<t.length;r+=3){const n=t[r],o=t[r+1],a=t[r+2],s=e[2*n],l=e[2*n+1];(e[2*o]-s)*(e[2*a+1]-l)-(e[2*o+1]-l)*(e[2*a]-s)>0?(i.push(n),i.push(a),i.push(o)):(i.push(n),i.push(o),i.push(a))}return i}(this._vertexBuffer,e);const t=[],i=e.length;for(let r=0;r<i;r+=3){const i=[e[r+0],e[r+1],e[r+2]],n=[this._vertexBuffer[2*e[r+0]+0],this._vertexBuffer[2*e[r+0]+1],this._vertexBuffer[2*e[r+1]+0],this._vertexBuffer[2*e[r+1]+1],this._vertexBuffer[2*e[r+2]+0],this._vertexBuffer[2*e[r+2]+1]];let o=1/0,a=1/0,s=-1/0,l=-1/0;for(let e=0;e<3;e++){const t=n[2*e],i=n[2*e+1];o=Math.min(o,t),s=Math.max(s,t),a=Math.min(a,i),l=Math.max(l,i)}if(o===s||a===l)continue;const c=Math.floor(o/this._granularityCellSize),u=Math.ceil(s/this._granularityCellSize),h=Math.floor(a/this._granularityCellSize),p=Math.ceil(l/this._granularityCellSize);if(c!==u||h!==p)for(let e=h;e<p;e++){const r=this._scanlineGenerateVertexRingForCellRow(e,n,i);kl(this._vertexBuffer,r,t)}else t.push(...i)}return t}_scanlineGenerateVertexRingForCellRow(e,t,i){const r=e*this._granularityCellSize,n=r+this._granularityCellSize,o=[];for(let e=0;e<3;e++){const a=t[2*e],s=t[2*e+1],l=t[2*(e+1)%6],c=t[(2*(e+1)+1)%6],u=t[2*(e+2)%6],h=t[(2*(e+2)+1)%6],p=l-a,d=c-s,m=0===p,f=0===d,g=(r-s)/d,y=(n-s)/d,_=Math.min(g,y),v=Math.max(g,y);if(!f&&(_>=1||v<=0)||f&&(s<r||s>n)){c>=r&&c<=n&&o.push(i[(e+1)%3]);continue}!f&&_>0&&o.push(this._vertexToIndex(a+p*_,s+d*_));const x=a+p*Math.max(_,0),b=a+p*Math.min(v,1);m||this._generateIntraEdgeVertices(o,a,s,l,c,x,b),!f&&v<1&&o.push(this._vertexToIndex(a+p*v,s+d*v)),(f||c>=r&&c<=n)&&o.push(i[(e+1)%3]),!f&&(c<=r||c>=n)&&this._generateInterEdgeVertices(o,a,s,l,c,u,h,b,r,n)}return o}_generateIntraEdgeVertices(e,t,i,r,n,o,a){const s=r-t,l=n-i,c=0===l,u=c?Math.min(t,r):Math.min(o,a),h=c?Math.max(t,r):Math.max(o,a),p=Math.floor(u/this._granularityCellSize)+1,d=Math.ceil(h/this._granularityCellSize)-1;if(c?t<r:o<a)for(let r=p;r<=d;r++){const n=r*this._granularityCellSize;e.push(this._vertexToIndex(n,i+l*(n-t)/s))}else for(let r=d;r>=p;r--){const n=r*this._granularityCellSize;e.push(this._vertexToIndex(n,i+l*(n-t)/s))}}_generateInterEdgeVertices(e,t,i,r,n,o,a,s,l,c){const u=n-i,h=o-r,p=a-n,d=(l-n)/p,m=(c-n)/p,f=Math.min(d,m),g=Math.max(d,m),y=r+h*f;let _=Math.floor(Math.min(y,s)/this._granularityCellSize)+1,v=Math.ceil(Math.max(y,s)/this._granularityCellSize)-1,x=s<y;const b=0===p;if(b&&(a===l||a===c))return;if(b||f>=1||g<=0){const e=i-a,r=o+(t-o)*Math.min((l-a)/e,(c-a)/e);_=Math.floor(Math.min(r,s)/this._granularityCellSize)+1,v=Math.ceil(Math.max(r,s)/this._granularityCellSize)-1,x=s<r}const w=u>0?c:l;if(x)for(let t=_;t<=v;t++)e.push(this._vertexToIndex(t*this._granularityCellSize,w));else for(let t=v;t>=_;t--)e.push(this._vertexToIndex(t*this._granularityCellSize,w))}_generateOutline(e){const t=[];for(const i of e){const e=Il(i,this._granularity,!0),r=this._pointArrayToIndices(e),n=[];for(let e=1;e<r.length;e++)n.push(r[e-1]),n.push(r[e]);t.push(n)}return t}_handlePoles(e){let t=!1,i=!1;this._canonical&&(0===this._canonical.y&&(t=!0),this._canonical.y===(1<<this._canonical.z)-1&&(i=!0)),(t||i)&&this._fillPoles(e,t,i)}_ensureNoPoleVertices(){const e=this._vertexBuffer;for(let t=0;t<e.length;t+=2){const i=e[t+1];i===Al&&(e[t+1]=-32767),i===Ml&&(e[t+1]=32766)}}_generatePoleQuad(e,t,i,r,n,o){r>n!=(o===Al)?(e.push(t),e.push(i),e.push(this._vertexToIndex(r,o)),e.push(i),e.push(this._vertexToIndex(n,o)),e.push(this._vertexToIndex(r,o))):(e.push(i),e.push(t),e.push(this._vertexToIndex(r,o)),e.push(this._vertexToIndex(n,o)),e.push(i),e.push(this._vertexToIndex(r,o)))}_fillPoles(e,t,i){const r=this._vertexBuffer,n=A,o=e.length;for(let a=2;a<o;a+=3){const o=e[a-2],s=e[a-1],l=e[a],c=r[2*o],u=r[2*o+1],h=r[2*s],p=r[2*s+1],d=r[2*l],m=r[2*l+1];t&&(0===u&&0===p&&this._generatePoleQuad(e,o,s,c,h,Al),0===p&&0===m&&this._generatePoleQuad(e,s,l,h,d,Al),0===m&&0===u&&this._generatePoleQuad(e,l,o,d,c,Al)),i&&(u===n&&p===n&&this._generatePoleQuad(e,o,s,c,h,Ml),p===n&&m===n&&this._generatePoleQuad(e,s,l,h,d,Ml),m===n&&u===n&&this._generatePoleQuad(e,l,o,d,c,Ml))}}_initializeVertices(e){for(let t=0;t<e.length;t+=2)this._vertexToIndex(e[t],e[t+1])}subdividePolygonInternal(e,t){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:i,holeIndices:r}=function(e){const t=[],i=[];for(const r of e)if(0!==r.length){r!==e[0]&&t.push(i.length/2);for(let e=0;e<r.length;e++)i.push(r[e].x),i.push(r[e].y)}return{flattened:i,holeIndices:t}}(e);let n;this._initializeVertices(i);try{const e=function(e,t,i=2){const r=t&&t.length,n=r?t[0]*i:e.length;let o=Qs(e,0,n,i,!0);const a=[];if(!o||o.next===o.prev)return a;let s,l,c;if(r&&(o=function(e,t,i,r){const n=[];for(let i=0,o=t.length;i<o;i++){const a=Qs(e,t[i]*r,i<o-1?t[i+1]*r:e.length,r,!1);a===a.next&&(a.steiner=!0),n.push(ul(a))}n.sort(al);for(let e=0;e<n.length;e++)i=sl(n[e],i);return i}(e,t,o,i)),e.length>80*i){s=1/0,l=1/0;let t=-1/0,r=-1/0;for(let o=i;o<n;o+=i){const i=e[o],n=e[o+1];i<s&&(s=i),n<l&&(l=n),i>t&&(t=i),n>r&&(r=n)}c=Math.max(t-s,r-l),c=0!==c?32767/c:0}return tl(o,a,i,s,l,c,0),a}(i,r),t=this._convertIndices(i,e);n=this._subdivideTrianglesScanline(t)}catch(e){}let o=[];return t&&(o=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(n),{verticesFlattened:this._vertexBuffer,indicesTriangles:n,indicesLineList:o}}_convertIndices(e,t){const i=[];for(let r=0;r<t.length;r++)i.push(this._vertexToIndex(e[2*t[r]],e[2*t[r]+1]));return i}_pointArrayToIndices(e){const t=[];for(let i=0;i<e.length;i++){const r=e[i];t.push(this._vertexToIndex(r.x,r.y))}return t}}function Pl(e,t,i,r=!0){return new El(i,t).subdividePolygonInternal(e,r)}function Il(e,t,i=!1){if(!e||e.length<1)return[];if(e.length<2)return[];const r=e[0],n=e[e.length-1],o=i&&(r.x!==n.x||r.y!==n.y);if(t<2)return o?[...e,e[0]]:[...e];const a=Math.floor(A/t),s=[];s.push(new l(e[0].x,e[0].y));const c=e.length,u=o?c:c-1;for(let t=0;t<u;t++){const i=e[t],r=t<c-1?e[t+1]:e[0],n=i.x,o=i.y,u=r.x,h=r.y,p=n!==u,d=o!==h;if(!p&&!d)continue;const m=u-n,f=h-o,g=Math.abs(m),y=Math.abs(f);let _=n,v=o;for(;;){const e=m>0?(Math.floor(_/a)+1)*a:(Math.ceil(_/a)-1)*a,t=f>0?(Math.floor(v/a)+1)*a:(Math.ceil(v/a)-1)*a,i=Math.abs(_-e),r=Math.abs(v-t),n=Math.abs(_-u),o=Math.abs(v-h),c=p?i/g:Number.POSITIVE_INFINITY,x=d?r/y:Number.POSITIVE_INFINITY;if((n<=i||!p)&&(o<=r||!d))break;if(c<x&&p||!d){_=e,v+=f*c;const t=new l(_,Math.round(v));s[s.length-1].x===t.x&&s[s.length-1].y===t.y||s.push(t)}else{_+=m*x,v=t;const e=new l(Math.round(_),v);s[s.length-1].x===e.x&&s[s.length-1].y===e.y||s.push(e)}}const x=new l(u,h);s[s.length-1].x===x.x&&s[s.length-1].y===x.y||s.push(x)}return s}function kl(e,t,i){if(0===t.length)throw new Error("Subdivision vertex ring is empty.");let r=0,n=e[2*t[0]];for(let i=1;i<t.length;i++){const o=e[2*t[i]];o<n&&(n=o,r=i)}const o=t.length;let a=r,s=(a+1)%o;for(;;){const r=a-1>=0?a-1:o-1,n=(s+1)%o,l=e[2*t[r]],c=e[2*t[n]],u=e[2*t[a]],h=e[2*t[a]+1],p=e[2*t[s]+1];let d=!1;if(l<c)d=!0;else if(l>c)d=!1;else{const i=p-h,o=-(e[2*t[s]]-u),a=h<p?1:-1;((l-u)*i+(e[2*t[r]+1]-h)*o)*a>((c-u)*i+(e[2*t[n]+1]-h)*o)*a&&(d=!0)}if(d){const e=t[r],n=t[a],l=t[s];e!==n&&e!==l&&n!==l&&i.push(l,n,e),a--,a<0&&(a=o-1)}else{const e=t[n],r=t[a],l=t[s];e!==r&&e!==l&&r!==l&&i.push(l,r,e),s++,s>=o&&(s=0)}if(r===n)break}}function zl(e,t,i,r,n,o,a,s,l){const c=n.length/2,u=a&&s&&l;if(c<La.MAX_VERTEX_ARRAY_LENGTH){const h=t.prepareSegment(c,i,r),p=h.vertexLength;for(let e=0;e<o.length;e+=3)r.emplaceBack(p+o[e],p+o[e+1],p+o[e+2]);let d,m;h.vertexLength+=c,h.primitiveLength+=o.length/3,u&&(m=a.prepareSegment(c,i,s),d=m.vertexLength,m.vertexLength+=c);for(let t=0;t<n.length;t+=2)e(n[t],n[t+1]);if(u)for(let e=0;e<l.length;e++){const t=l[e];for(let e=1;e<t.length;e+=2)s.emplaceBack(d+t[e-1],d+t[e]);m.primitiveLength+=t.length/2}}else!function(e,t,i,r,n,o){const a=[];for(let e=0;e<r.length/2;e++)a.push(-1);const s={count:0};let l=0,c=e.getOrCreateLatestSegment(t,i),u=c.vertexLength;for(let h=2;h<n.length;h+=3){const p=n[h-2],d=n[h-1],m=n[h];let f=a[p]<l,g=a[d]<l,y=a[m]<l;c.vertexLength+((f?1:0)+(g?1:0)+(y?1:0))>La.MAX_VERTEX_ARRAY_LENGTH&&(c=e.createNewSegment(t,i),l=s.count,f=!0,g=!0,y=!0,u=0);const _=Ll(a,r,o,s,p,f,c),v=Ll(a,r,o,s,d,g,c),x=Ll(a,r,o,s,m,y,c);i.emplaceBack(u+_-l,u+v-l,u+x-l),c.primitiveLength++}}(t,i,r,n,o,e),u&&function(e,t,i,r,n,o){const a=[];for(let e=0;e<r.length/2;e++)a.push(-1);const s={count:0};let l=0,c=e.getOrCreateLatestSegment(t,i),u=c.vertexLength;for(let h=0;h<n.length;h++){const p=n[h];for(let d=1;d<n[h].length;d+=2){const n=p[d-1],h=p[d];let m=a[n]<l,f=a[h]<l;c.vertexLength+((m?1:0)+(f?1:0))>La.MAX_VERTEX_ARRAY_LENGTH&&(c=e.createNewSegment(t,i),l=s.count,m=!0,f=!0,u=0);const g=Ll(a,r,o,s,n,m,c),y=Ll(a,r,o,s,h,f,c);i.emplaceBack(u+g-l,u+y-l),c.primitiveLength++}}}(a,i,s,n,l,e),t.forceNewSegmentOnNextPrepare(),null==a||a.forceNewSegmentOnNextPrepare()}function Ll(e,t,i,r,n,o,a){if(o){const o=r.count;return i(t[2*n],t[2*n+1]),e[n]=r.count,r.count++,a.vertexLength++,o}return e[n]}class Dl{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.patternFeatures=[],this.layoutVertexArray=new va,this.indexArray=new Pa,this.indexArray2=new Ia,this.programConfigurations=new as(e.layers,e.zoom),this.segments=new La,this.segments2=new La,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,i){this.hasPattern=Ys("fill",this.layers,t);const r=this.layers[0].layout.get("fill-sort-key"),n=!r.isConstant(),o=[];for(const{feature:a,id:s,index:l,sourceLayerIndex:c}of e){const e=this.layers[0]._featureFilter.needGeometry,u=ps(a,e);if(!this.layers[0]._featureFilter.filter(new mo(this.zoom),u,i))continue;const h=n?r.evaluate(u,{},i,t.availableImages):void 0,p={id:s,properties:a.properties,type:a.type,sourceLayerIndex:c,index:l,geometry:e?u.geometry:hs(a),patterns:{},sortKey:h};o.push(p)}n&&o.sort(((e,t)=>e.sortKey-t.sortKey));for(const r of o){const{geometry:n,index:o,sourceLayerIndex:a}=r;if(this.hasPattern){const e=Js("fill",this.layers,r,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(r,n,o,i,{},t.subdivisionGranularity);t.featureIndex.insert(e[o].feature,n,o,a,this.index)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i)}addFeatures(e,t,i){for(const r of this.patternFeatures)this.addFeature(r,r.geometry,r.index,t,i,e.subdivisionGranularity)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Xs),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,r,n,o){for(const e of Ui(t,500)){const t=Pl(e,r,o.fill.getGranularityForZoomLevel(r.z)),i=this.layoutVertexArray;zl(((e,t)=>{i.emplaceBack(e,t)}),this.segments,this.layoutVertexArray,this.indexArray,t.verticesFlattened,t.indicesTriangles,this.segments2,this.indexArray2,t.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,n,r)}}let Fl,Rl;Gn("FillBucket",Dl,{omit:["layers","patternFeatures"]});var Bl={get paint(){return Rl=Rl||new Eo({"fill-antialias":new Co(me.paint_fill["fill-antialias"]),"fill-opacity":new To(me.paint_fill["fill-opacity"]),"fill-color":new To(me.paint_fill["fill-color"]),"fill-outline-color":new To(me.paint_fill["fill-outline-color"]),"fill-translate":new Co(me.paint_fill["fill-translate"]),"fill-translate-anchor":new Co(me.paint_fill["fill-translate-anchor"]),"fill-pattern":new So(me.paint_fill["fill-pattern"])})},get layout(){return Fl=Fl||new Eo({"fill-sort-key":new To(me.layout_fill["fill-sort-key"])})}};class Ol extends Io{constructor(e){super(e,Bl)}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 Dl(e)}queryRadius(){return Es(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:t,transform:i,pixelsToTileUnits:r}){return _s(Ps(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-i.bearingInRadians,r),t)}isTileClipped(){return!0}}const jl=Do([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Nl=Do([{name:"a_centroid",components:2,type:"Int16"}],4),{members:$l}=jl;var Vl,Ul,ql,Zl,Gl,Hl,Wl,Kl={};function Xl(){if(Ul)return Vl;Ul=1;var e=o();function t(e,t,r,n,o){this.properties={},this.extent=r,this.type=0,this._pbf=e,this._geometry=-1,this._keys=n,this._values=o,e.readFields(i,this,t)}function i(e,t,i){1==e?t.id=i.readVarint():2==e?function(e,t){for(var i=e.readVarint()+e.pos;e.pos<i;){var r=t._keys[e.readVarint()],n=t._values[e.readVarint()];t.properties[r]=n}}(i,t):3==e?t.type=i.readVarint():4==e&&(t._geometry=i.pos)}function r(e){for(var t,i,r=0,n=0,o=e.length,a=o-1;n<o;a=n++)r+=((i=e[a]).x-(t=e[n]).x)*(t.y+i.y);return r}return Vl=t,t.types=["Unknown","Point","LineString","Polygon"],t.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var i,r=t.readVarint()+t.pos,n=1,o=0,a=0,s=0,l=[];t.pos<r;){if(o<=0){var c=t.readVarint();n=7&c,o=c>>3}if(o--,1===n||2===n)a+=t.readSVarint(),s+=t.readSVarint(),1===n&&(i&&l.push(i),i=[]),i.push(new e(a,s));else{if(7!==n)throw new Error("unknown command "+n);i&&i.push(i[0].clone())}}return i&&l.push(i),l},t.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,i=1,r=0,n=0,o=0,a=1/0,s=-1/0,l=1/0,c=-1/0;e.pos<t;){if(r<=0){var u=e.readVarint();i=7&u,r=u>>3}if(r--,1===i||2===i)(n+=e.readSVarint())<a&&(a=n),n>s&&(s=n),(o+=e.readSVarint())<l&&(l=o),o>c&&(c=o);else if(7!==i)throw new Error("unknown command "+i)}return[a,l,s,c]},t.prototype.toGeoJSON=function(e,i,n){var o,a,s=this.extent*Math.pow(2,n),l=this.extent*e,c=this.extent*i,u=this.loadGeometry(),h=t.types[this.type];function p(e){for(var t=0;t<e.length;t++){var i=e[t];e[t]=[360*(i.x+l)/s-180,360/Math.PI*Math.atan(Math.exp((180-360*(i.y+c)/s)*Math.PI/180))-90]}}switch(this.type){case 1:var d=[];for(o=0;o<u.length;o++)d[o]=u[o][0];p(u=d);break;case 2:for(o=0;o<u.length;o++)p(u[o]);break;case 3:for(u=function(e){var t=e.length;if(t<=1)return[e];for(var i,n,o=[],a=0;a<t;a++){var s=r(e[a]);0!==s&&(void 0===n&&(n=s<0),n===s<0?(i&&o.push(i),i=[e[a]]):i.push(e[a]))}return i&&o.push(i),o}(u),o=0;o<u.length;o++)for(a=0;a<u[o].length;a++)p(u[o][a])}1===u.length?u=u[0]:h="Multi"+h;var m={type:"Feature",geometry:{type:h,coordinates:u},properties:this.properties};return"id"in this&&(m.id=this.id),m},Vl}function Yl(){if(Zl)return ql;Zl=1;var e=Xl();function t(e,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(i,this,t),this.length=this._features.length}function i(e,t,i){15===e?t.version=i.readVarint():1===e?t.name=i.readString():5===e?t.extent=i.readVarint():2===e?t._features.push(i.pos):3===e?t._keys.push(i.readString()):4===e&&t._values.push(function(e){for(var t=null,i=e.readVarint()+e.pos;e.pos<i;){var r=e.readVarint()>>3;t=1===r?e.readString():2===r?e.readFloat():3===r?e.readDouble():4===r?e.readVarint64():5===r?e.readVarint():6===r?e.readSVarint():7===r?e.readBoolean():null}return t}(i))}return ql=t,t.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var i=this._pbf.readVarint()+this._pbf.pos;return new e(this._pbf,i,this.extent,this._keys,this._values)},ql}function Jl(){return Wl||(Wl=1,Kl.VectorTile=function(){if(Hl)return Gl;Hl=1;var e=Yl();function t(t,i,r){if(3===t){var n=new e(r,r.readVarint()+r.pos);n.length&&(i[n.name]=n)}}return Gl=function(e,i){this.layers=e.readFields(t,{},i)},Gl}(),Kl.VectorTileFeature=Xl(),Kl.VectorTileLayer=Yl()),Kl}var Ql=i(Jl());const ec=Ql.VectorTileFeature.types,tc=Math.pow(2,13);function ic(e,t,i,r,n,o,a,s){e.emplaceBack(t,i,2*Math.floor(r*tc)+a,n*tc*2,o*tc*2,Math.round(s))}class rc{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.layoutVertexArray=new xa,this.centroidVertexArray=new ya,this.indexArray=new Pa,this.programConfigurations=new as(e.layers,e.zoom),this.segments=new La,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,i){this.features=[],this.hasPattern=Ys("fill-extrusion",this.layers,t);for(const{feature:r,id:n,index:o,sourceLayerIndex:a}of e){const e=this.layers[0]._featureFilter.needGeometry,s=ps(r,e);if(!this.layers[0]._featureFilter.filter(new mo(this.zoom),s,i))continue;const l={id:n,sourceLayerIndex:a,index:o,geometry:e?s.geometry:hs(r),properties:r.properties,type:r.type,patterns:{}};this.hasPattern?this.features.push(Js("fill-extrusion",this.layers,l,this.zoom,t)):this.addFeature(l,l.geometry,o,i,{},t.subdivisionGranularity),t.featureIndex.insert(r,l.geometry,o,a,this.index,!0)}}addFeatures(e,t,i){for(const r of this.features){const{geometry:n}=r;this.addFeature(r,n,r.index,t,i,e.subdivisionGranularity)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i)}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.centroidVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,$l),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Nl.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,t,i,r,n,o){for(const i of Ui(t,500)){const t={x:0,y:0,sampleCount:0},n=this.layoutVertexArray.length;this.processPolygon(t,r,e,i,o);const a=this.layoutVertexArray.length-n,s=Math.floor(t.x/t.sampleCount),l=Math.floor(t.y/t.sampleCount);for(let e=0;e<a;e++)this.centroidVertexArray.emplaceBack(s,l)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,n,r)}processPolygon(e,t,i,r,n){if(r.length<1)return;if(ac(r[0]))return;for(const t of r)0!==t.length&&nc(e,t);const o={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},a=n.fill.getGranularityForZoomLevel(t.z),s="Polygon"===ec[i.type];for(const e of r){if(0===e.length)continue;if(ac(e))continue;const t=Il(e,a,s);this._generateSideFaces(t,o)}if(!s)return;const l=Pl(r,t,a,!1),c=this.layoutVertexArray;zl(((e,t)=>{ic(c,e,t,0,0,1,1,0)}),this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles)}_generateSideFaces(e,t){let i=0;for(let r=1;r<e.length;r++){const n=e[r],o=e[r-1];if(oc(n,o))continue;t.segment.vertexLength+4>La.MAX_VERTEX_ARRAY_LENGTH&&(t.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const a=n.sub(o)._perp()._unit(),s=o.dist(n);i+s>32768&&(i=0),ic(this.layoutVertexArray,n.x,n.y,a.x,a.y,0,0,i),ic(this.layoutVertexArray,n.x,n.y,a.x,a.y,0,1,i),i+=s,ic(this.layoutVertexArray,o.x,o.y,a.x,a.y,0,0,i),ic(this.layoutVertexArray,o.x,o.y,a.x,a.y,0,1,i);const l=t.segment.vertexLength;this.indexArray.emplaceBack(l,l+2,l+1),this.indexArray.emplaceBack(l+1,l+2,l+3),t.segment.vertexLength+=4,t.segment.primitiveLength+=2}}}function nc(e,t){for(let i=0;i<t.length;i++){const r=t[i];i===t.length-1&&t[0].x===r.x&&t[0].y===r.y||(e.x+=r.x,e.y+=r.y,e.sampleCount++)}}function oc(e,t){return e.x===t.x&&(e.x<0||e.x>A)||e.y===t.y&&(e.y<0||e.y>A)}function ac(e){return e.every((e=>e.x<0))||e.every((e=>e.x>A))||e.every((e=>e.y<0))||e.every((e=>e.y>A))}let sc;Gn("FillExtrusionBucket",rc,{omit:["layers","features"]});var lc={get paint(){return sc=sc||new Eo({"fill-extrusion-opacity":new Co(me["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new To(me["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Co(me["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Co(me["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new So(me["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new To(me["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new To(me["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Co(me["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class cc extends Io{constructor(e){super(e,lc)}createBucket(e){return new rc(e)}queryRadius(){return Es(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:r,transform:n,pixelsToTileUnits:o,pixelPosMatrix:a}){const s=Ps(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-n.bearingInRadians,o),c=this.paint.get("fill-extrusion-height").evaluate(t,i),u=this.paint.get("fill-extrusion-base").evaluate(t,i),h=function(e,t){const i=[];for(const r of e){const e=[r.x,r.y,0,1];w(e,e,t),i.push(new l(e[0]/e[3],e[1]/e[3]))}return i}(s,a),p=function(e,t,i,r){const n=[],o=[],a=r[8]*t,s=r[9]*t,c=r[10]*t,u=r[11]*t,h=r[8]*i,p=r[9]*i,d=r[10]*i,m=r[11]*i;for(const t of e){const e=[],i=[];for(const n of t){const t=n.x,o=n.y,f=r[0]*t+r[4]*o+r[12],g=r[1]*t+r[5]*o+r[13],y=r[2]*t+r[6]*o+r[14],_=r[3]*t+r[7]*o+r[15],v=y+c,x=_+u,b=f+h,w=g+p,C=y+d,T=_+m,S=new l((f+a)/x,(g+s)/x);S.z=v/x,e.push(S);const A=new l(b/T,w/T);A.z=C/T,i.push(A)}n.push(e),o.push(i)}return[n,o]}(r,u,c,a);return function(e,t,i){let r=1/0;_s(i,t)&&(r=hc(i,t[0]));for(let n=0;n<t.length;n++){const o=t[n],a=e[n];for(let e=0;e<o.length-1;e++){const t=o[e],n=[t,o[e+1],a[e+1],a[e],t];gs(i,n)&&(r=Math.min(r,hc(i,n)))}}return r!==1/0&&r}(p[0],p[1],h)}}function uc(e,t){return e.x*t.x+e.y*t.y}function hc(e,t){if(1===e.length){let i=0;const r=t[i++];let n;for(;!n||r.equals(n);)if(n=t[i++],!n)return 1/0;for(;i<t.length;i++){const o=t[i],a=e[0],s=n.sub(r),l=o.sub(r),c=a.sub(r),u=uc(s,s),h=uc(s,l),p=uc(l,l),d=uc(c,s),m=uc(c,l),f=u*p-h*h,g=(p*d-h*m)/f,y=(u*m-h*d)/f,_=r.z*(1-g-y)+n.z*g+o.z*y;if(isFinite(_))return _}return 1/0}{let e=1/0;for(const i of t)e=Math.min(e,i.z);return e}}const pc=Do([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:dc}=pc,mc=Do([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:fc}=mc,gc=Ql.VectorTileFeature.types,yc=Math.cos(Math.PI/180*37.5),_c=Math.pow(2,14)/.5;class vc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((e=>{this.gradients[e.id]={}})),this.layoutVertexArray=new ba,this.layoutVertexArray2=new wa,this.indexArray=new Pa,this.programConfigurations=new as(e.layers,e.zoom),this.segments=new La,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,i){this.hasPattern=Ys("line",this.layers,t);const r=this.layers[0].layout.get("line-sort-key"),n=!r.isConstant(),o=[];for(const{feature:t,id:a,index:s,sourceLayerIndex:l}of e){const e=this.layers[0]._featureFilter.needGeometry,c=ps(t,e);if(!this.layers[0]._featureFilter.filter(new mo(this.zoom),c,i))continue;const u=n?r.evaluate(c,{},i):void 0,h={id:a,properties:t.properties,type:t.type,sourceLayerIndex:l,index:s,geometry:e?c.geometry:hs(t),patterns:{},sortKey:u};o.push(h)}n&&o.sort(((e,t)=>e.sortKey-t.sortKey));for(const r of o){const{geometry:n,index:o,sourceLayerIndex:a}=r;if(this.hasPattern){const e=Js("line",this.layers,r,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(r,n,o,i,{},t.subdivisionGranularity);t.featureIndex.insert(e[o].feature,n,o,a,this.index)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i)}addFeatures(e,t,i){for(const r of this.patternFeatures)this.addFeature(r,r.geometry,r.index,t,i,e.subdivisionGranularity)}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,fc)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,dc),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,t,i,r,n,o){const a=this.layers[0].layout,s=a.get("line-join").evaluate(e,{}),l=a.get("line-cap"),c=a.get("line-miter-limit"),u=a.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const i of t)this.addLine(i,e,s,l,c,u,r,o);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,n,r)}addLine(e,t,i,r,n,o,a,s){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,e=Il(e,a?s.line.getGranularityForZoomLevel(a.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let t=0;t<e.length-1;t++)this.totalDistance+=e[t].dist(e[t+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const l="Polygon"===gc[t.type];let c=e.length;for(;c>=2&&e[c-1].equals(e[c-2]);)c--;let u=0;for(;u<c-1&&e[u].equals(e[u+1]);)u++;if(c<(l?3:2))return;"bevel"===i&&(n=1.05);const h=this.overscaling<=16?15*A/(512*this.overscaling):0,p=this.segments.prepareSegment(10*c,this.layoutVertexArray,this.indexArray);let d,m,f,g,y;this.e1=this.e2=-1,l&&(d=e[c-2],y=e[u].sub(d)._unit()._perp());for(let t=u;t<c;t++){if(f=t===c-1?l?e[u+1]:void 0:e[t+1],f&&e[t].equals(f))continue;y&&(g=y),d&&(m=d),d=e[t],y=f?f.sub(d)._unit()._perp():g,g=g||y;let a=g.add(y);0===a.x&&0===a.y||a._unit();const s=g.x*y.x+g.y*y.y,_=a.x*y.x+a.y*y.y,v=0!==_?1/_:1/0,x=2*Math.sqrt(2-2*_),b=_<yc&&m&&f,w=g.x*y.y-g.y*y.x>0;if(b&&t>u){const e=d.dist(m);if(e>2*h){const t=d.sub(d.sub(m)._mult(h/e)._round());this.updateDistance(m,t),this.addCurrentVertex(t,g,0,0,p),m=t}}const C=m&&f;let T=C?i:l?"butt":r;if(C&&"round"===T&&(v<o?T="miter":v<=2&&(T="fakeround")),"miter"===T&&v>n&&(T="bevel"),"bevel"===T&&(v>2&&(T="flipbevel"),v<n&&(T="miter")),m&&this.updateDistance(m,d),"miter"===T)a._mult(v),this.addCurrentVertex(d,a,0,0,p);else if("flipbevel"===T){if(v>100)a=y.mult(-1);else{const e=v*g.add(y).mag()/g.sub(y).mag();a._perp()._mult(e*(w?-1:1))}this.addCurrentVertex(d,a,0,0,p),this.addCurrentVertex(d,a.mult(-1),0,0,p)}else if("bevel"===T||"fakeround"===T){const e=-Math.sqrt(v*v-1),t=w?e:0,i=w?0:e;if(m&&this.addCurrentVertex(d,g,t,i,p),"fakeround"===T){const e=Math.round(180*x/Math.PI/20);for(let t=1;t<e;t++){let i=t/e;if(.5!==i){const e=i-.5;i+=i*e*(i-1)*((1.0904+s*(s*(3.55645-1.43519*s)-3.2452))*e*e+(.848013+s*(.215638*s-1.06021)))}const r=y.sub(g)._mult(i)._add(g)._unit()._mult(w?-1:1);this.addHalfVertex(d,r.x,r.y,!1,w,0,p)}}f&&this.addCurrentVertex(d,y,-t,-i,p)}else if("butt"===T)this.addCurrentVertex(d,a,0,0,p);else if("square"===T){const e=m?1:-1;this.addCurrentVertex(d,a,e,e,p)}else"round"===T&&(m&&(this.addCurrentVertex(d,g,0,0,p),this.addCurrentVertex(d,g,1,1,p,!0)),f&&(this.addCurrentVertex(d,y,-1,-1,p,!0),this.addCurrentVertex(d,y,0,0,p)));if(b&&t<c-1){const e=d.dist(f);if(e>2*h){const t=d.add(f.sub(d)._mult(h/e)._round());this.updateDistance(d,t),this.addCurrentVertex(t,y,0,0,p),d=t}}}}addCurrentVertex(e,t,i,r,n,o=!1){const a=t.y*r-t.x,s=-t.y-t.x*r;this.addHalfVertex(e,t.x+t.y*i,t.y-t.x*i,o,!1,i,n),this.addHalfVertex(e,a,s,o,!0,-r,n),this.distance>_c/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,t,i,r,n,o))}addHalfVertex({x:e,y:t},i,r,n,o,a,s){const l=.5*(this.lineClips?this.scaledDistance*(_c-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(n?1:0),(t<<1)+(o?1:0),Math.round(63*i)+128,Math.round(63*r)+128,1+(0===a?0:a<0?-1:1)|(63&l)<<2,l>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const c=s.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,c,this.e2),s.primitiveLength++),o?this.e2=c:this.e1=c}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,t){this.distance+=e.dist(t),this.updateScaledDistance()}}let xc,bc;Gn("LineBucket",vc,{omit:["layers","patternFeatures"]});var wc={get paint(){return bc=bc||new Eo({"line-opacity":new To(me.paint_line["line-opacity"]),"line-color":new To(me.paint_line["line-color"]),"line-translate":new Co(me.paint_line["line-translate"]),"line-translate-anchor":new Co(me.paint_line["line-translate-anchor"]),"line-width":new To(me.paint_line["line-width"]),"line-gap-width":new To(me.paint_line["line-gap-width"]),"line-offset":new To(me.paint_line["line-offset"]),"line-blur":new To(me.paint_line["line-blur"]),"line-dasharray":new Ao(me.paint_line["line-dasharray"]),"line-pattern":new So(me.paint_line["line-pattern"]),"line-gradient":new Mo(me.paint_line["line-gradient"])})},get layout(){return xc=xc||new Eo({"line-cap":new Co(me.layout_line["line-cap"]),"line-join":new To(me.layout_line["line-join"]),"line-miter-limit":new Co(me.layout_line["line-miter-limit"]),"line-round-limit":new Co(me.layout_line["line-round-limit"]),"line-sort-key":new To(me.layout_line["line-sort-key"])})}};class Cc extends To{possiblyEvaluate(e,t){return t=new mo(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,i,r){return t=F({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,i,r)}}let Tc;class Sc extends Io{constructor(e){super(e,wc),this.gradientVersion=0,Tc||(Tc=new Cc(wc.paint.properties["line-width"].specification),Tc.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if("line-gradient"===e){const e=this.gradientExpression();this.stepInterpolant=!!function(e){return void 0!==e._styleExpression}(e)&&e._styleExpression.expression instanceof Xt,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,t){super.recalculate(e,t),this.paint._values["line-floorwidth"]=Tc.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new vc(e)}queryRadius(e){const t=e,i=Ac(Ms("line-width",this,t),Ms("line-gap-width",this,t)),r=Ms("line-offset",this,t);return i/2+Math.abs(r)+Es(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:r,transform:n,pixelsToTileUnits:o}){const a=Ps(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-n.bearingInRadians,o),s=o/2*Ac(this.paint.get("line-width").evaluate(t,i),this.paint.get("line-gap-width").evaluate(t,i)),c=this.paint.get("line-offset").evaluate(t,i);return c&&(r=function(e,t){const i=[];for(let r=0;r<e.length;r++){const n=e[r],o=[];for(let e=0;e<n.length;e++){const i=n[e-1],r=n[e],a=n[e+1],s=0===e?new l(0,0):r.sub(i)._unit()._perp(),c=e===n.length-1?new l(0,0):a.sub(r)._unit()._perp(),u=s._add(c)._unit(),h=u.x*c.x+u.y*c.y;0!==h&&u._mult(1/h),o.push(u._mult(t)._add(r))}i.push(o)}return i}(r,c*o)),function(e,t,i){for(let r=0;r<t.length;r++){const n=t[r];if(e.length>=3)for(let t=0;t<n.length;t++)if(Ss(e,n[t]))return!0;if(vs(e,n,i))return!0}return!1}(a,r,s)}isTileClipped(){return!0}}function Ac(e,t){return t>0?t+2*e:e}const Mc=Do([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Ec=Do([{name:"a_projected_pos",components:3,type:"Float32"}],4);Do([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Pc=Do([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);Do([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Ic=Do([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),kc=Do([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function zc(e,t,i){return e.sections.forEach((e=>{e.text=function(e,t,i){const r=t.layout.get("text-transform").evaluate(i,{});return"uppercase"===r?e=e.toLocaleUpperCase():"lowercase"===r&&(e=e.toLocaleLowerCase()),po.applyArabicShaping&&(e=po.applyArabicShaping(e)),e}(e.text,t,i)})),e}Do([{name:"triangle",components:3,type:"Uint16"}]),Do([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),Do([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),Do([{type:"Float32",name:"offsetX"}]),Do([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Do([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Lc={"!":"οΈ•","#":"οΌƒ",$:"οΌ„","%":"οΌ…","&":"οΌ†","(":"οΈ΅",")":"οΈΆ","*":"*","+":"οΌ‹",",":"︐","-":"οΈ²",".":"・","/":"/",":":"οΈ“",";":"οΈ”","<":"οΈΏ","=":"=",">":"οΉ€","?":"οΈ–","@":"οΌ ","[":"οΉ‡","\\":"οΌΌ","]":"﹈","^":"οΌΎ",_:"οΈ³","`":"ο½€","{":"οΈ·","|":"―","}":"οΈΈ","~":"~","Β’":"οΏ ","Β£":"οΏ‘","Β₯":"οΏ₯","Β¦":"οΏ€","Β¬":"οΏ’","Β―":"οΏ£","–":"οΈ²","β€”":"οΈ±","β€˜":"οΉƒ","’":"οΉ„","β€œ":"﹁","”":"οΉ‚","…":"οΈ™","β€§":"・","β‚©":"οΏ¦","、":"οΈ‘","。":"οΈ’","γ€ˆ":"οΈΏ","〉":"οΉ€","γ€Š":"οΈ½","》":"οΈΎ","γ€Œ":"﹁","」":"οΉ‚","γ€Ž":"οΉƒ","』":"οΉ„","【":"οΈ»","】":"οΈΌ","γ€”":"οΈΉ","〕":"οΈΊ","γ€–":"οΈ—","γ€—":"︘","!":"οΈ•","(":"οΈ΅","οΌ‰":"οΈΆ",",":"︐","-":"οΈ²",".":"・",":":"οΈ“","οΌ›":"οΈ”","<":"οΈΏ",">":"οΉ€","?":"οΈ–","οΌ»":"οΉ‡","οΌ½":"﹈","οΌΏ":"οΈ³","ο½›":"οΈ·","|":"―","}":"οΈΈ","⦅":"οΈ΅","ο½ ":"οΈΆ","q":"οΈ’","ο½’":"﹁","ο½£":"οΉ‚"};var Dc,Fc,Rc,Bc=24,Oc={};function jc(){return Dc||(Dc=1,Oc.read=function(e,t,i,r,n){var o,a,s=8*n-r-1,l=(1<<s)-1,c=l>>1,u=-7,h=i?n-1:0,p=i?-1:1,d=e[t+h];for(h+=p,o=d&(1<<-u)-1,d>>=-u,u+=s;u>0;o=256*o+e[t+h],h+=p,u-=8);for(a=o&(1<<-u)-1,o>>=-u,u+=r;u>0;a=256*a+e[t+h],h+=p,u-=8);if(0===o)o=1-c;else{if(o===l)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,r),o-=c}return(d?-1:1)*a*Math.pow(2,o-r)},Oc.write=function(e,t,i,r,n,o){var a,s,l,c=8*o-n-1,u=(1<<c)-1,h=u>>1,p=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,m=r?1:-1,f=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=u):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),(t+=a+h>=1?p/l:p*Math.pow(2,1-h))*l>=2&&(a++,l/=2),a+h>=u?(s=0,a=u):a+h>=1?(s=(t*l-1)*Math.pow(2,n),a+=h):(s=t*Math.pow(2,h-1)*Math.pow(2,n),a=0));n>=8;e[i+d]=255&s,d+=m,s/=256,n-=8);for(a=a<<n|s,c+=n;c>0;e[i+d]=255&a,d+=m,a/=256,c-=8);e[i+d-m]|=128*f}),Oc}function Nc(){if(Rc)return Fc;Rc=1,Fc=t;var e=jc();function t(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}t.Varint=0,t.Fixed64=1,t.Bytes=2,t.Fixed32=5;var i=4294967296,r=1/i,n="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");function o(e){return e.type===t.Bytes?e.readVarint()+e.pos:e.pos+1}function a(e,t,i){return i?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function s(e,t,i){var r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));i.realloc(r);for(var n=i.pos-1;n>=e;n--)i.buf[n+r]=i.buf[n]}function l(e,t){for(var i=0;i<e.length;i++)t.writeVarint(e[i])}function c(e,t){for(var i=0;i<e.length;i++)t.writeSVarint(e[i])}function u(e,t){for(var i=0;i<e.length;i++)t.writeFloat(e[i])}function h(e,t){for(var i=0;i<e.length;i++)t.writeDouble(e[i])}function p(e,t){for(var i=0;i<e.length;i++)t.writeBoolean(e[i])}function d(e,t){for(var i=0;i<e.length;i++)t.writeFixed32(e[i])}function m(e,t){for(var i=0;i<e.length;i++)t.writeSFixed32(e[i])}function f(e,t){for(var i=0;i<e.length;i++)t.writeFixed64(e[i])}function g(e,t){for(var i=0;i<e.length;i++)t.writeSFixed64(e[i])}function y(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+16777216*e[t+3]}function _(e,t,i){e[i]=t,e[i+1]=t>>>8,e[i+2]=t>>>16,e[i+3]=t>>>24}function v(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}return t.prototype={destroy:function(){this.buf=null},readFields:function(e,t,i){for(i=i||this.length;this.pos<i;){var r=this.readVarint(),n=r>>3,o=this.pos;this.type=7&r,e(n,t,this),this.pos===o&&this.skip(r)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=y(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=v(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=y(this.buf,this.pos)+y(this.buf,this.pos+4)*i;return this.pos+=8,e},readSFixed64:function(){var e=y(this.buf,this.pos)+v(this.buf,this.pos+4)*i;return this.pos+=8,e},readFloat:function(){var t=e.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=e.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(e){var t,i,r=this.buf;return t=127&(i=r[this.pos++]),i<128?t:(t|=(127&(i=r[this.pos++]))<<7,i<128?t:(t|=(127&(i=r[this.pos++]))<<14,i<128?t:(t|=(127&(i=r[this.pos++]))<<21,i<128?t:function(e,t,i){var r,n,o=i.buf;if(r=(112&(n=o[i.pos++]))>>4,n<128)return a(e,r,t);if(r|=(127&(n=o[i.pos++]))<<3,n<128)return a(e,r,t);if(r|=(127&(n=o[i.pos++]))<<10,n<128)return a(e,r,t);if(r|=(127&(n=o[i.pos++]))<<17,n<128)return a(e,r,t);if(r|=(127&(n=o[i.pos++]))<<24,n<128)return a(e,r,t);if(r|=(1&(n=o[i.pos++]))<<31,n<128)return a(e,r,t);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(i=r[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&&n?function(e,t,i){return n.decode(e.subarray(t,i))}(this.buf,t,e):function(e,t,i){for(var r="",n=t;n<i;){var o,a,s,l=e[n],c=null,u=l>239?4:l>223?3:l>191?2:1;if(n+u>i)break;1===u?l<128&&(c=l):2===u?128==(192&(o=e[n+1]))&&(c=(31&l)<<6|63&o)<=127&&(c=null):3===u?(a=e[n+2],128==(192&(o=e[n+1]))&&128==(192&a)&&((c=(15&l)<<12|(63&o)<<6|63&a)<=2047||c>=55296&&c<=57343)&&(c=null)):4===u&&(a=e[n+2],s=e[n+3],128==(192&(o=e[n+1]))&&128==(192&a)&&128==(192&s)&&((c=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)<=65535||c>=1114112)&&(c=null)),null===c?(c=65533,u=1):c>65535&&(c-=65536,r+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),r+=String.fromCharCode(c),n+=u}return r}(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,i){if(this.type!==t.Bytes)return e.push(this.readVarint(i));var r=o(this);for(e=e||[];this.pos<r;)e.push(this.readVarint(i));return e},readPackedSVarint:function(e){if(this.type!==t.Bytes)return e.push(this.readSVarint());var i=o(this);for(e=e||[];this.pos<i;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==t.Bytes)return e.push(this.readBoolean());var i=o(this);for(e=e||[];this.pos<i;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==t.Bytes)return e.push(this.readFloat());var i=o(this);for(e=e||[];this.pos<i;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==t.Bytes)return e.push(this.readDouble());var i=o(this);for(e=e||[];this.pos<i;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==t.Bytes)return e.push(this.readFixed32());var i=o(this);for(e=e||[];this.pos<i;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==t.Bytes)return e.push(this.readSFixed32());var i=o(this);for(e=e||[];this.pos<i;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==t.Bytes)return e.push(this.readFixed64());var i=o(this);for(e=e||[];this.pos<i;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==t.Bytes)return e.push(this.readSFixed64());var i=o(this);for(e=e||[];this.pos<i;)e.push(this.readSFixed64());return e},skip:function(e){var i=7&e;if(i===t.Varint)for(;this.buf[this.pos++]>127;);else if(i===t.Bytes)this.pos=this.readVarint()+this.pos;else if(i===t.Fixed32)this.pos+=4;else{if(i!==t.Fixed64)throw new Error("Unimplemented type: "+i);this.pos+=8}},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var i=new Uint8Array(t);i.set(this.buf),this.buf=i,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),_(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),_(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),_(this.buf,-1&e,this.pos),_(this.buf,Math.floor(e*r),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),_(this.buf,-1&e,this.pos),_(this.buf,Math.floor(e*r),this.pos+4),this.pos+=8},writeVarint:function(e){(e=+e||0)>268435455||e<0?function(e,t){var i,r;if(e>=0?(i=e%4294967296|0,r=e/4294967296|0):(r=~(-e/4294967296),4294967295^(i=~(-e%4294967296))?i=i+1|0:(i=0,r=r+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)))))}(r,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 r,n,o=0;o<t.length;o++){if((r=t.charCodeAt(o))>55295&&r<57344){if(!n){r>56319||o+1===t.length?(e[i++]=239,e[i++]=191,e[i++]=189):n=r;continue}if(r<56320){e[i++]=239,e[i++]=191,e[i++]=189,n=r;continue}r=n-55296<<10|r-56320|65536,n=null}else n&&(e[i++]=239,e[i++]=191,e[i++]=189,n=null);r<128?e[i++]=r:(r<2048?e[i++]=r>>6|192:(r<65536?e[i++]=r>>12|224:(e[i++]=r>>18|240,e[i++]=r>>12&63|128),e[i++]=r>>6&63|128),e[i++]=63&r|128)}return i}(this.buf,e,this.pos);var i=this.pos-t;i>=128&&s(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),e.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),e.write(this.buf,t,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<t;i++)this.buf[this.pos++]=e[i]},writeRawMessage:function(e,t){this.pos++;var i=this.pos;e(t,this);var r=this.pos-i;r>=128&&s(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,i,r){this.writeTag(e,t.Bytes),this.writeRawMessage(i,r)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,l,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,c,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,p,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,u,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,h,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,d,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,m,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,f,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,g,t)},writeBytesField:function(e,i){this.writeTag(e,t.Bytes),this.writeBytes(i)},writeFixed32Field:function(e,i){this.writeTag(e,t.Fixed32),this.writeFixed32(i)},writeSFixed32Field:function(e,i){this.writeTag(e,t.Fixed32),this.writeSFixed32(i)},writeFixed64Field:function(e,i){this.writeTag(e,t.Fixed64),this.writeFixed64(i)},writeSFixed64Field:function(e,i){this.writeTag(e,t.Fixed64),this.writeSFixed64(i)},writeVarintField:function(e,i){this.writeTag(e,t.Varint),this.writeVarint(i)},writeSVarintField:function(e,i){this.writeTag(e,t.Varint),this.writeSVarint(i)},writeStringField:function(e,i){this.writeTag(e,t.Bytes),this.writeString(i)},writeFloatField:function(e,i){this.writeTag(e,t.Fixed32),this.writeFloat(i)},writeDoubleField:function(e,i){this.writeTag(e,t.Fixed64),this.writeDouble(i)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}},Fc}var $c=i(Nc());const Vc=3;function Uc(e,t,i){1===e&&i.readMessage(qc,t)}function qc(e,t,i){if(3===e){const{id:e,bitmap:r,width:n,height:o,left:a,top:s,advance:l}=i.readMessage(Zc,{});t.push({id:e,bitmap:new $s({width:n+2*Vc,height:o+2*Vc},r),metrics:{width:n,height:o,left:a,top:s,advance:l}})}}function Zc(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 Gc=Vc;function Hc(e){let t=0,i=0;for(const r of e)t+=r.w*r.h,i=Math.max(i,r.w);e.sort(((e,t)=>t.h-e.h));const r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),i),h:1/0}];let n=0,o=0;for(const t of e)for(let e=r.length-1;e>=0;e--){const i=r[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),n=Math.max(n,t.x+t.w),t.w===i.w&&t.h===i.h){const t=r.pop();e<r.length&&(r[e]=t)}else t.h===i.h?(i.x+=t.w,i.w-=t.w):t.w===i.w?(i.y+=t.h,i.h-=t.h):(r.push({x:i.x+t.w,y:i.y,w:i.w-t.w,h:t.h}),i.y+=t.h,i.h-=t.h);break}}return{w:n,h:o,fill:t/(n*o)||0}}const Wc=1;class Kc{constructor(e,{pixelRatio:t,version:i,stretchX:r,stretchY:n,content:o,textFitWidth:a,textFitHeight:s}){this.paddedRect=e,this.pixelRatio=t,this.stretchX=r,this.stretchY=n,this.content=o,this.version=i,this.textFitWidth=a,this.textFitHeight=s}get tl(){return[this.paddedRect.x+Wc,this.paddedRect.y+Wc]}get br(){return[this.paddedRect.x+this.paddedRect.w-Wc,this.paddedRect.y+this.paddedRect.h-Wc]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*Wc)/this.pixelRatio,(this.paddedRect.h-2*Wc)/this.pixelRatio]}}class Xc{constructor(e,t){const i={},r={};this.haveRenderCallbacks=[];const n=[];this.addImages(e,i,n),this.addImages(t,r,n);const{w:o,h:a}=Hc(n),s=new Vs({width:o||1,height:a||1});for(const t in e){const r=e[t],n=i[t].paddedRect;Vs.copy(r.data,s,{x:0,y:0},{x:n.x+Wc,y:n.y+Wc},r.data)}for(const e in t){const i=t[e],n=r[e].paddedRect,o=n.x+Wc,a=n.y+Wc,l=i.data.width,c=i.data.height;Vs.copy(i.data,s,{x:0,y:0},{x:o,y:a},i.data),Vs.copy(i.data,s,{x:0,y:c-1},{x:o,y:a-1},{width:l,height:1}),Vs.copy(i.data,s,{x:0,y:0},{x:o,y:a+c},{width:l,height:1}),Vs.copy(i.data,s,{x:l-1,y:0},{x:o-1,y:a},{width:1,height:c}),Vs.copy(i.data,s,{x:0,y:0},{x:o+l,y:a},{width:1,height:c})}this.image=s,this.iconPositions=i,this.patternPositions=r}addImages(e,t,i){for(const r in e){const n=e[r],o={x:0,y:0,w:n.data.width+2*Wc,h:n.data.height+2*Wc};i.push(o),t[r]=new Kc(o,n),n.hasRenderCallback&&this.haveRenderCallbacks.push(r)}}patchUpdatedImages(e,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[r,n]=e.tl;i.update(t.data,void 0,{x:r,y:n})}}var Yc;Gn("ImagePosition",Kc),Gn("ImageAtlas",Xc),e.ah=void 0,(Yc=e.ah||(e.ah={}))[Yc.none=0]="none",Yc[Yc.horizontal=1]="horizontal",Yc[Yc.vertical=2]="vertical",Yc[Yc.horizontalOnly=3]="horizontalOnly";const Jc=-17;class Qc{constructor(){this.scale=1,this.fontStack="",this.imageName=null,this.verticalAlign="bottom"}static forText(e,t,i){const r=new Qc;return r.scale=e||1,r.fontStack=t,r.verticalAlign=i||"bottom",r}static forImage(e,t){const i=new Qc;return i.imageName=e,i.verticalAlign=t||"bottom",i}}class eu{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,t){const i=new eu;for(let r=0;r<e.sections.length;r++){const n=e.sections[r];n.image?i.addImageSection(n):i.addTextSection(n,t)}return i}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}getCharCode(e){return this.text.charCodeAt(e)}verticalizePunctuation(){this.text=function(e){let t="";for(let i=0;i<e.length;i++){const r=e.charCodeAt(i+1)||null,n=e.charCodeAt(i-1)||null;t+=r&&so(r)&&!Lc[e[i+1]]||n&&so(n)&&!Lc[e[i-1]]||!Lc[e[i]]?e[i]:Lc[e[i]]}return t}(this.text)}trim(){let e=0;for(let t=0;t<this.text.length&&iu[this.text.charCodeAt(t)];t++)e++;let t=this.text.length;for(let i=this.text.length-1;i>=0&&i>=e&&iu[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 eu;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)}getMaxImageSize(e){let t=0,i=0;for(let r=0;r<this.length();r++){const n=this.getSection(r);if(n.imageName){const r=e[n.imageName];if(!r)continue;const o=r.displaySize;t=Math.max(t,o[0]),i=Math.max(i,o[1])}}return{maxImageWidth:t,maxImageHeight:i}}addTextSection(e,t){this.text+=e.text,this.sections.push(Qc.forText(e.scale,e.fontStack||t,e.verticalAlign));const i=this.sections.length-1;for(let t=0;t<e.text.length;++t)this.sectionIndex.push(i)}addImageSection(e){const t=e.image?e.image.name:"";if(0===t.length)return void $("Can't add FormattedSection with an empty image.");const i=this.getNextImageSectionCharCode();i?(this.text+=String.fromCharCode(i),this.sections.push(Qc.forImage(t,e.verticalAlign)),this.sectionIndex.push(this.sections.length-1)):$("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function tu(t,i,r,n,o,a,s,l,c,u,h,p,d,m,f){const g=eu.fromFeature(t,o);let y;p===e.ah.vertical&&g.verticalizePunctuation();const{processBidirectionalText:_,processStyledBidirectionalText:v}=po;if(_&&1===g.sections.length){y=[];const e=_(g.toString(),uu(g,u,a,i,n,m));for(const t of e){const e=new eu;e.text=t,e.sections=g.sections;for(let i=0;i<t.length;i++)e.sectionIndex.push(0);y.push(e)}}else if(v){y=[];const e=v(g.text,g.sectionIndex,uu(g,u,a,i,n,m));for(const t of e){const e=new eu;e.text=t[0],e.sectionIndex=t[1],e.sections=g.sections,y.push(e)}}else y=function(e,t){const i=[],r=e.text;let n=0;for(const r of t)i.push(e.substring(n,r)),n=r;return n<r.length&&i.push(e.substring(n,r.length)),i}(g,uu(g,u,a,i,n,m));const x=[],b={positionedLines:x,text:g.toString(),top:h[1],bottom:h[1],left:h[0],right:h[0],writingMode:p,iconsInText:!1,verticalizable:!1};return function(e,t,i,r,n,o,a,s,l,c,u,h){let p=0,d=0,m=0,f=0;const g="right"===s?1:"left"===s?0:.5,y=Bc/h;let _=0;for(const a of n){a.trim();const n=a.getMaxScale(),s={positionedGlyphs:[],lineOffset:0};e.positionedLines[_]=s;const h=s.positionedGlyphs;let v=0;if(!a.length()){d+=o,++_;continue}const x=pu(r,a,y);for(let o=0;o<a.length();o++){const s=a.getSection(o),m=a.getSectionIndex(o),f=a.getCharCode(o),g=mu(l,u,f);let _;if(s.imageName){if(e.iconsInText=!0,s.scale=s.scale*y,_=gu(s,g,n,x,r),!_)continue;v=Math.max(v,_.imageOffset)}else if(_=fu(s,f,g,x,t,i),!_)continue;const{rect:b,metrics:w,baselineOffset:C}=_;h.push({glyph:f,imageName:s.imageName,x:p,y:d+C+Jc,vertical:g,scale:s.scale,fontStack:s.fontStack,sectionIndex:m,metrics:w,rect:b}),g?(e.verticalizable=!0,p+=(s.imageName?w.advance:Bc)*s.scale+c):p+=w.advance*s.scale+c}0!==h.length&&(m=Math.max(p-c,m),yu(h,0,h.length-1,g)),p=0,s.lineOffset=Math.max(v,(n-1)*Bc);const b=o*n+v;d+=b,f=Math.max(b,f),++_}const{horizontalAlign:v,verticalAlign:x}=hu(a);(function(e,t,i,r,n,o,a,s,l){const c=(t-i)*n;let u=0;u=o!==a?-s*r-Jc:-r*l*a+.5*a;for(const t of e)for(const e of t.positionedGlyphs)e.x+=c,e.y+=u})(e.positionedLines,g,v,x,m,f,o,d,n.length),e.top+=-x*d,e.bottom=e.top+d,e.left+=-v*m,e.right=e.left+m}(b,i,r,n,y,s,l,c,p,u,d,f),!function(e){for(const t of e)if(0!==t.positionedGlyphs.length)return!1;return!0}(x)&&b}const iu={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},ru={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},nu={40:!0};function ou(e,t,i,r,n,o){if(t.imageName){const e=r[t.imageName];return e?e.displaySize[0]*t.scale*Bc/o+n:0}{const r=i[t.fontStack],o=r&&r[e];return o?o.metrics.advance*t.scale+n:0}}function au(e,t,i,r){const n=Math.pow(e-t,2);return r?e<t?n/2:2*n:n+Math.abs(i)*i}function su(e,t,i){let r=0;return 10===e&&(r-=1e4),i&&(r+=150),40!==e&&65288!==e||(r+=50),41!==t&&65289!==t||(r+=50),r}function lu(e,t,i,r,n,o){let a=null,s=au(t,i,n,o);for(const e of r){const r=au(t-e.x,i,n,o)+e.badness;r<=s&&(a=e,s=r)}return{index:e,x:t,priorBreak:a,badness:s}}function cu(e){return e?cu(e.priorBreak).concat(e.index):[]}function uu(e,t,i,r,n,o){if(!e)return[];const a=[],s=function(e,t,i,r,n,o){let a=0;for(let i=0;i<e.length();i++){const s=e.getSection(i);a+=ou(e.getCharCode(i),s,r,n,t,o)}return a/Math.max(1,Math.ceil(a/i))}(e,t,i,r,n,o),l=e.text.indexOf("​")>=0;let c=0;for(let i=0;i<e.length();i++){const h=e.getSection(i),p=e.getCharCode(i);if(iu[p]||(c+=ou(p,h,r,n,t,o)),i<e.length()-1){const t=!((u=p)<11904)&&(!!Qn["CJK Compatibility Forms"](u)||!!Qn["CJK Compatibility"](u)||!!Qn["CJK Strokes"](u)||!!Qn["CJK Symbols and Punctuation"](u)||!!Qn["Enclosed CJK Letters and Months"](u)||!!Qn["Halfwidth and Fullwidth Forms"](u)||!!Qn["Ideographic Description Characters"](u)||!!Qn["Vertical Forms"](u)||oo.test(String.fromCodePoint(u)));(ru[p]||t||h.imageName||i!==e.length()-2&&nu[e.getCharCode(i+1)])&&a.push(lu(i+1,c,s,a,su(p,e.getCharCode(i+1),t&&l),!1))}}var u;return cu(lu(e.length(),c,s,a,0,!0))}function hu(e){let t=.5,i=.5;switch(e){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(e){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:t,verticalAlign:i}}function pu(e,t,i){const r=t.getMaxScale()*Bc,{maxImageWidth:n,maxImageHeight:o}=t.getMaxImageSize(e),a=Math.max(r,o*i);return{verticalLineContentWidth:Math.max(r,n*i),horizontalLineContentHeight:a}}function du(e){switch(e){case"top":return 0;case"center":return.5;default:return 1}}function mu(t,i,r){return!(t===e.ah.horizontal||!i&&!ao(r)||i&&(iu[r]||(n=r,/\p{sc=Arab}/u.test(String.fromCodePoint(n)))));var n}function fu(e,t,i,r,n,o){const a=o[e.fontStack],s=function(e,t,i,r){if(e&&e.rect)return e;const n=t[i.fontStack],o=n&&n[r];return o?{rect:null,metrics:o.metrics}:null}(a&&a[t],n,e,t);if(null===s)return null;let l;if(i)l=r.verticalLineContentWidth-e.scale*Bc;else{const t=du(e.verticalAlign);l=(r.horizontalLineContentHeight-e.scale*Bc)*t}return{rect:s.rect,metrics:s.metrics,baselineOffset:l}}function gu(e,t,i,r,n){const o=n[e.imageName];if(!o)return null;const a=o.paddedRect,s=o.displaySize,l={width:s[0],height:s[1],left:Wc,top:-3,advance:t?s[1]:s[0]};let c;if(t)c=r.verticalLineContentWidth-s[1]*e.scale;else{const t=du(e.verticalAlign);c=(r.horizontalLineContentHeight-s[1]*e.scale)*t}return{rect:a,metrics:l,baselineOffset:c,imageOffset:(t?s[0]:s[1])*e.scale-Bc*i}}function yu(e,t,i,r){if(0===r)return;const n=e[i],o=(e[i].x+n.metrics.advance*n.scale)*r;for(let r=t;r<=i;r++)e[r].x-=o}function _u(e,t,i){const{horizontalAlign:r,verticalAlign:n}=hu(i),o=t[0]-e.displaySize[0]*r,a=t[1]-e.displaySize[1]*n;return{image:e,top:a,bottom:a+e.displaySize[1],left:o,right:o+e.displaySize[0]}}function vu(e){var t,i;let r=e.left,n=e.top,o=e.right-r,a=e.bottom-n;const s=null!==(t=e.image.textFitWidth)&&void 0!==t?t:"stretchOrShrink",l=null!==(i=e.image.textFitHeight)&&void 0!==i?i:"stretchOrShrink",c=(e.image.content[2]-e.image.content[0])/(e.image.content[3]-e.image.content[1]);if("proportional"===l){if("stretchOnly"===s&&o/a<c||"proportional"===s){const e=Math.ceil(a*c);r*=e/o,o=e}}else if("proportional"===s&&"stretchOnly"===l&&0!==c&&o/a>c){const e=Math.ceil(o/c);n*=e/a,a=e}return{x1:r,y1:n,x2:r+o,y2:n+a}}function xu(e,t,i,r,n,o){const a=e.image;let s;if(a.content){const e=a.content,t=a.pixelRatio||1;s=[e[0]/t,e[1]/t,a.displaySize[0]-e[2]/t,a.displaySize[1]-e[3]/t]}const l=t.left*o,c=t.right*o;let u,h,p,d;"width"===i||"both"===i?(d=n[0]+l-r[3],h=n[0]+c+r[1]):(d=n[0]+(l+c-a.displaySize[0])/2,h=d+a.displaySize[0]);const m=t.top*o,f=t.bottom*o;return"height"===i||"both"===i?(u=n[1]+m-r[0],p=n[1]+f+r[2]):(u=n[1]+(m+f-a.displaySize[1])/2,p=u+a.displaySize[1]),{image:a,top:u,right:h,bottom:p,left:d,collisionPadding:s}}const bu=255,wu=128,Cu=bu*wu;function Tu(e,t){const{expression:i}=t;if("constant"===i.kind)return{kind:"constant",layoutSize:i.evaluate(new mo(e+1))};if("source"===i.kind)return{kind:"source"};{const{zoomStops:t,interpolationType:r}=i;let n=0;for(;n<t.length&&t[n]<=e;)n++;n=Math.max(0,n-1);let o=n;for(;o<t.length&&t[o]<e+1;)o++;o=Math.min(t.length-1,o);const a=t[n],s=t[o];return"composite"===i.kind?{kind:"composite",minZoom:a,maxZoom:s,interpolationType:r}:{kind:"camera",minZoom:a,maxZoom:s,minSize:i.evaluate(new mo(a)),maxSize:i.evaluate(new mo(s)),interpolationType:r}}}function Su(e,t,i){let r="never";const n=e.get(t);return n?r=n:e.get(i)&&(r="always"),r}const Au=Ql.VectorTileFeature.types,Mu=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Eu(e,t,i,r,n,o,a,s,l,c,u,h,p){const d=s?Math.min(Cu,Math.round(s[0])):0,m=s?Math.min(Cu,Math.round(s[1])):0;e.emplaceBack(t,i,Math.round(32*r),Math.round(32*n),o,a,(d<<1)+(l?1:0),m,16*c,16*u,256*h,256*p)}function Pu(e,t,i){e.emplaceBack(t.x,t.y,i),e.emplaceBack(t.x,t.y,i),e.emplaceBack(t.x,t.y,i),e.emplaceBack(t.x,t.y,i)}function Iu(e){for(const t of e.sections)if(ho(t.text))return!0;return!1}class ku{constructor(e){this.layoutVertexArray=new Ta,this.indexArray=new Pa,this.programConfigurations=e,this.segments=new La,this.dynamicLayoutVertexArray=new Sa,this.opacityVertexArray=new Aa,this.hasVisibleVertices=!1,this.placedSymbolArray=new la}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(e,t,i,r){this.isEmpty()||(i&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Mc.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Ec.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,Mu,!0),this.opacityVertexBuffer.itemSize=1),(i||r)&&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())}}Gn("SymbolBuffers",ku);class zu{constructor(e,t,i){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new i,this.segments=new La,this.collisionVertexArray=new Ea}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Pc.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Gn("CollisionBuffers",zu);class Lu{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Tu(this.zoom,i["text-size"]),this.iconSizeData=Tu(this.zoom,i["icon-size"]);const r=this.layers[0].layout,n=r.get("symbol-sort-key"),o=r.get("symbol-z-order");this.canOverlap="never"!==Su(r,"text-overlap","text-allow-overlap")||"never"!==Su(r,"icon-overlap","icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==o&&!n.isConstant(),this.sortFeaturesByY=("viewport-y"===o||"auto"===o&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===r.get("symbol-placement")&&(this.writingModes=r.get("text-writing-mode").map((t=>e.ah[t]))),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.sourceID=t.sourceID}createArrays(){this.text=new ku(new as(this.layers,this.zoom,(e=>/^text/.test(e)))),this.icon=new ku(new as(this.layers,this.zoom,(e=>/^icon/.test(e)))),this.glyphOffsetArray=new ha,this.lineVertexArray=new pa,this.symbolInstances=new ua,this.textAnchorOffsets=new ma}calculateGlyphDependencies(e,t,i,r,n){for(let o=0;o<e.length;o++)if(t[e.charCodeAt(o)]=!0,(i||r)&&n){const i=Lc[e.charAt(o)];i&&(t[i.charCodeAt(0)]=!0)}}populate(t,i,r){const n=this.layers[0],o=n.layout,a=o.get("text-font"),s=o.get("text-field"),l=o.get("icon-image"),c=("constant"!==s.value.kind||s.value.value instanceof wt&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&("constant"!==a.value.kind||a.value.value.length>0),u="constant"!==l.value.kind||!!l.value.value||Object.keys(l.parameters).length>0,h=o.get("symbol-sort-key");if(this.features=[],!c&&!u)return;const p=i.iconDependencies,d=i.glyphDependencies,m=i.availableImages,f=new mo(this.zoom);for(const{feature:i,id:s,index:l,sourceLayerIndex:g}of t){const t=n._featureFilter.needGeometry,y=ps(i,t);if(!n._featureFilter.filter(f,y,r))continue;let _,v;if(t||(y.geometry=hs(i)),c){const e=n.getValueAndResolveTokens("text-field",y,r,m),t=wt.factory(e),i=this.hasRTLText=this.hasRTLText||Iu(t);(!i||"unavailable"===po.getRTLTextPluginStatus()||i&&po.isParsed())&&(_=zc(t,n,y))}if(u){const e=n.getValueAndResolveTokens("icon-image",y,r,m);v=e instanceof Mt?e:Mt.fromString(e)}if(!_&&!v)continue;const x=this.sortFeaturesByKey?h.evaluate(y,{},r):void 0;if(this.features.push({id:s,text:_,icon:v,index:l,sourceLayerIndex:g,geometry:y.geometry,properties:i.properties,type:Au[i.type],sortKey:x}),v&&(p[v.name]=!0),_){const t=a.evaluate(y,{},r).join(","),i="viewport"!==o.get("text-rotation-alignment")&&"point"!==o.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(e.ah.vertical)>=0;for(const e of _.sections)if(e.image)p[e.image.name]=!0;else{const r=eo(_.toString()),n=e.fontStack||t,o=d[n]=d[n]||{};this.calculateGlyphDependencies(e.text,o,i,this.allowVerticalPlacement,r)}}}"line"===o.get("symbol-placement")&&(this.features=function(e){const t={},i={},r=[];let n=0;function o(t){r.push(e[t]),n++}function a(e,t,n){const o=i[e];return delete i[e],i[t]=o,r[o].geometry[0].pop(),r[o].geometry[0]=r[o].geometry[0].concat(n[0]),o}function s(e,i,n){const o=t[i];return delete t[i],t[e]=o,r[o].geometry[0].shift(),r[o].geometry[0]=n[0].concat(r[o].geometry[0]),o}function l(e,t,i){const r=i?t[0][t[0].length-1]:t[0][0];return`${e}:${r.x}:${r.y}`}for(let c=0;c<e.length;c++){const u=e[c],h=u.geometry,p=u.text?u.text.toString():null;if(!p){o(c);continue}const d=l(p,h),m=l(p,h,!0);if(d in i&&m in t&&i[d]!==t[m]){const e=s(d,m,h),n=a(d,m,r[e].geometry);delete t[d],delete i[m],i[l(p,r[n].geometry,!0)]=n,r[e].geometry=null}else d in i?a(d,m,h):m in t?s(d,m,h):(o(c),t[d]=n-1,i[m]=n-1)}return r.filter((e=>e.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((e,t)=>e.sortKey-t.sortKey))}update(e,t,i){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,i),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,i))}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()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,t){const i=this.lineVertexArray.length;if(void 0!==e.segment){let i=e.dist(t[e.segment+1]),r=e.dist(t[e.segment]);const n={};for(let r=e.segment+1;r<t.length;r++)n[r]={x:t[r].x,y:t[r].y,tileUnitDistanceFromAnchor:i},r<t.length-1&&(i+=t[r+1].dist(t[r]));for(let i=e.segment||0;i>=0;i--)n[i]={x:t[i].x,y:t[i].y,tileUnitDistanceFromAnchor:r},i>0&&(r+=t[i-1].dist(t[i]));for(let e=0;e<t.length;e++){const t=n[e];this.lineVertexArray.emplaceBack(t.x,t.y,t.tileUnitDistanceFromAnchor)}}return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}addSymbols(t,i,r,n,o,a,s,l,c,u,h,p){const d=t.indexArray,m=t.layoutVertexArray,f=t.segments.prepareSegment(4*i.length,m,d,this.canOverlap?a.sortKey:void 0),g=this.glyphOffsetArray.length,y=f.vertexLength,_=this.allowVerticalPlacement&&s===e.ah.vertical?Math.PI/2:0,v=a.text&&a.text.sections;for(let e=0;e<i.length;e++){const{tl:n,tr:o,bl:s,br:c,tex:u,pixelOffsetTL:h,pixelOffsetBR:g,minFontScaleX:y,minFontScaleY:x,glyphOffset:b,isSDF:w,sectionIndex:C}=i[e],T=f.vertexLength,S=b[1];Eu(m,l.x,l.y,n.x,S+n.y,u.x,u.y,r,w,h.x,h.y,y,x),Eu(m,l.x,l.y,o.x,S+o.y,u.x+u.w,u.y,r,w,g.x,h.y,y,x),Eu(m,l.x,l.y,s.x,S+s.y,u.x,u.y+u.h,r,w,h.x,g.y,y,x),Eu(m,l.x,l.y,c.x,S+c.y,u.x+u.w,u.y+u.h,r,w,g.x,g.y,y,x),Pu(t.dynamicLayoutVertexArray,l,_),d.emplaceBack(T,T+2,T+1),d.emplaceBack(T+1,T+2,T+3),f.vertexLength+=4,f.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(b[0]),e!==i.length-1&&C===i[e+1].sectionIndex||t.programConfigurations.populatePaintArrays(m.length,a,a.index,{},p,v&&v[C])}t.placedSymbolArray.emplaceBack(l.x,l.y,g,this.glyphOffsetArray.length-g,y,c,u,l.segment,r?r[0]:0,r?r[1]:0,n[0],n[1],s,0,!1,0,h)}_addCollisionDebugVertex(e,t,i,r,n,o){return t.emplaceBack(0,0),e.emplaceBack(i.x,i.y,r,n,Math.round(o.x),Math.round(o.y))}addCollisionDebugVertices(e,t,i,r,n,o,a){const s=n.segments.prepareSegment(4,n.layoutVertexArray,n.indexArray),c=s.vertexLength,u=n.layoutVertexArray,h=n.collisionVertexArray,p=a.anchorX,d=a.anchorY;this._addCollisionDebugVertex(u,h,o,p,d,new l(e,t)),this._addCollisionDebugVertex(u,h,o,p,d,new l(i,t)),this._addCollisionDebugVertex(u,h,o,p,d,new l(i,r)),this._addCollisionDebugVertex(u,h,o,p,d,new l(e,r)),s.vertexLength+=4;const m=n.indexArray;m.emplaceBack(c,c+1),m.emplaceBack(c+1,c+2),m.emplaceBack(c+2,c+3),m.emplaceBack(c+3,c),s.primitiveLength+=4}addDebugCollisionBoxes(e,t,i,r){for(let n=e;n<t;n++){const e=this.collisionBoxArray.get(n);this.addCollisionDebugVertices(e.x1,e.y1,e.x2,e.y2,r?this.textCollisionBox:this.iconCollisionBox,e.anchorPoint,i)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new zu(Ma,Ic.members,Ia),this.iconCollisionBox=new zu(Ma,Ic.members,Ia);for(let e=0;e<this.symbolInstances.length;e++){const t=this.symbolInstances.get(e);this.addDebugCollisionBoxes(t.textBoxStartIndex,t.textBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.verticalTextBoxStartIndex,t.verticalTextBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.iconBoxStartIndex,t.iconBoxEndIndex,t,!1),this.addDebugCollisionBoxes(t.verticalIconBoxStartIndex,t.verticalIconBoxEndIndex,t,!1)}}_deserializeCollisionBoxesForSymbol(e,t,i,r,n,o,a,s,l){const c={};for(let r=t;r<i;r++){const t=e.get(r);c.textBox={x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,anchorPointX:t.anchorPointX,anchorPointY:t.anchorPointY},c.textFeatureIndex=t.featureIndex;break}for(let t=r;t<n;t++){const i=e.get(t);c.verticalTextBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},c.verticalTextFeatureIndex=i.featureIndex;break}for(let t=o;t<a;t++){const i=e.get(t);c.iconBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},c.iconFeatureIndex=i.featureIndex;break}for(let t=s;t<l;t++){const i=e.get(t);c.verticalIconBox={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,anchorPointX:i.anchorPointX,anchorPointY:i.anchorPointY},c.verticalIconFeatureIndex=i.featureIndex;break}return c}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let t=0;t<this.symbolInstances.length;t++){const i=this.symbolInstances.get(t);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,i.textBoxStartIndex,i.textBoxEndIndex,i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i.iconBoxStartIndex,i.iconBoxEndIndex,i.verticalIconBoxStartIndex,i.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,t){const i=e.placedSymbolArray.get(t),r=i.vertexStartIndex+4*i.numGlyphs;for(let t=i.vertexStartIndex;t<r;t+=4)e.indexArray.emplaceBack(t,t+2,t+1),e.indexArray.emplaceBack(t+1,t+2,t+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;const t=Math.sin(e),i=Math.cos(e),r=[],n=[],o=[];for(let e=0;e<this.symbolInstances.length;++e){o.push(e);const a=this.symbolInstances.get(e);r.push(0|Math.round(t*a.anchorX+i*a.anchorY)),n.push(a.featureIndex)}return o.sort(((e,t)=>r[e]-r[t]||n[t]-n[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),[t.rightJustifiedTextSymbolIndex,t.centerJustifiedTextSymbolIndex,t.leftJustifiedTextSymbolIndex].forEach(((e,t,i)=>{e>=0&&i.indexOf(e)===t&&this.addIndicesForPlacedSymbol(this.text,e)})),t.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,t.verticalPlacedTextSymbolIndex),t.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.placedIconSymbolIndex),t.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Du,Fu;Gn("SymbolBucket",Lu,{omit:["layers","collisionBoxArray","features","compareText"]}),Lu.MAX_GLYPHS=65535,Lu.addDynamicAttributes=Pu;var Ru={get paint(){return Fu=Fu||new Eo({"icon-opacity":new To(me.paint_symbol["icon-opacity"]),"icon-color":new To(me.paint_symbol["icon-color"]),"icon-halo-color":new To(me.paint_symbol["icon-halo-color"]),"icon-halo-width":new To(me.paint_symbol["icon-halo-width"]),"icon-halo-blur":new To(me.paint_symbol["icon-halo-blur"]),"icon-translate":new Co(me.paint_symbol["icon-translate"]),"icon-translate-anchor":new Co(me.paint_symbol["icon-translate-anchor"]),"text-opacity":new To(me.paint_symbol["text-opacity"]),"text-color":new To(me.paint_symbol["text-color"],{runtimeType:De,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new To(me.paint_symbol["text-halo-color"]),"text-halo-width":new To(me.paint_symbol["text-halo-width"]),"text-halo-blur":new To(me.paint_symbol["text-halo-blur"]),"text-translate":new Co(me.paint_symbol["text-translate"]),"text-translate-anchor":new Co(me.paint_symbol["text-translate-anchor"])})},get layout(){return Du=Du||new Eo({"symbol-placement":new Co(me.layout_symbol["symbol-placement"]),"symbol-spacing":new Co(me.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Co(me.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new To(me.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Co(me.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Co(me.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Co(me.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Co(me.layout_symbol["icon-ignore-placement"]),"icon-optional":new Co(me.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Co(me.layout_symbol["icon-rotation-alignment"]),"icon-size":new To(me.layout_symbol["icon-size"]),"icon-text-fit":new Co(me.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Co(me.layout_symbol["icon-text-fit-padding"]),"icon-image":new To(me.layout_symbol["icon-image"]),"icon-rotate":new To(me.layout_symbol["icon-rotate"]),"icon-padding":new To(me.layout_symbol["icon-padding"]),"icon-keep-upright":new Co(me.layout_symbol["icon-keep-upright"]),"icon-offset":new To(me.layout_symbol["icon-offset"]),"icon-anchor":new To(me.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Co(me.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Co(me.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Co(me.layout_symbol["text-rotation-alignment"]),"text-field":new To(me.layout_symbol["text-field"]),"text-font":new To(me.layout_symbol["text-font"]),"text-size":new To(me.layout_symbol["text-size"]),"text-max-width":new To(me.layout_symbol["text-max-width"]),"text-line-height":new Co(me.layout_symbol["text-line-height"]),"text-letter-spacing":new To(me.layout_symbol["text-letter-spacing"]),"text-justify":new To(me.layout_symbol["text-justify"]),"text-radial-offset":new To(me.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Co(me.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new To(me.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new To(me.layout_symbol["text-anchor"]),"text-max-angle":new Co(me.layout_symbol["text-max-angle"]),"text-writing-mode":new Co(me.layout_symbol["text-writing-mode"]),"text-rotate":new To(me.layout_symbol["text-rotate"]),"text-padding":new Co(me.layout_symbol["text-padding"]),"text-keep-upright":new Co(me.layout_symbol["text-keep-upright"]),"text-transform":new To(me.layout_symbol["text-transform"]),"text-offset":new To(me.layout_symbol["text-offset"]),"text-allow-overlap":new Co(me.layout_symbol["text-allow-overlap"]),"text-overlap":new Co(me.layout_symbol["text-overlap"]),"text-ignore-placement":new Co(me.layout_symbol["text-ignore-placement"]),"text-optional":new Co(me.layout_symbol["text-optional"])})}};class Bu{constructor(e){if(void 0===e.property.overrides)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:Ie,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}}Gn("FormatSectionOverride",Bu,{omit:["defaultValue"]});class Ou extends Io{constructor(e){super(e,Ru)}recalculate(e,t){if(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"]="map"===this.layout.get("text-rotation-alignment")?"map":"viewport"),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){const e=this.layout.get("text-writing-mode");if(e){const t=[];for(const i of e)t.indexOf(i)<0&&t.push(i);this.layout._values["text-writing-mode"]=t}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,t,i,r){const n=this.layout.get(e).evaluate(t,{},i,r),o=this._unevaluatedLayout._values[e];return o.isDataDriven()||Ur(o.value)||!n?n:function(e,t){return t.replace(/{([^{}]+)}/g,((t,i)=>e&&i in e?String(e[i]):""))}(t.properties,n)}createBucket(e){return new Lu(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of Ru.paint.overridableProperties){if(!Ou.hasPaintOverride(this.layout,e))continue;const t=this.paint.get(e),i=new Bu(t),r=new Vr(i,t.property.specification);let n=null;n="constant"===t.value.kind||"source"===t.value.kind?new Zr("source",r):new Gr("composite",r,t.value.zoomStops),this.paint._values[e]=new bo(t.property,n,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,i){return!(!this.layout||t.isDataDriven()||i.isDataDriven())&&Ou.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){const i=e.get("text-field"),r=Ru.paint.properties[t];let n=!1;const o=e=>{for(const t of e)if(r.overrides&&r.overrides.hasOverride(t))return void(n=!0)};if("constant"===i.value.kind&&i.value.value instanceof wt)o(i.value.value.sections);else if("source"===i.value.kind){const e=t=>{n||(t instanceof Lt&&kt(t.value)===je?o(t.value.sections):t instanceof yi?o(t.sections):t.eachChild(e))},t=i.value;t._styleExpression&&e(t._styleExpression.expression)}return n}}let ju;var Nu={get paint(){return ju=ju||new Eo({"background-color":new Co(me.paint_background["background-color"]),"background-pattern":new Ao(me.paint_background["background-pattern"]),"background-opacity":new Co(me.paint_background["background-opacity"])})}};class $u extends Io{constructor(e){super(e,Nu)}}let Vu;var Uu={get paint(){return Vu=Vu||new Eo({"raster-opacity":new Co(me.paint_raster["raster-opacity"]),"raster-hue-rotate":new Co(me.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Co(me.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Co(me.paint_raster["raster-brightness-max"]),"raster-saturation":new Co(me.paint_raster["raster-saturation"]),"raster-contrast":new Co(me.paint_raster["raster-contrast"]),"raster-resampling":new Co(me.paint_raster["raster-resampling"]),"raster-fade-duration":new Co(me.paint_raster["raster-fade-duration"])})}};class qu extends Io{constructor(e){super(e,Uu)}}class Zu extends Io{constructor(e){super(e,{}),this.onAdd=e=>{this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)},this.onRemove=e=>{this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)},this.implementation=e}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class Gu{constructor(e){this._methodToThrottle=e,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._methodToThrottle()}),0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const Hu={once:!0},Wu=6371008.8;class Ku{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 Ku(D(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,r=e.lat*t,n=Math.sin(i)*Math.sin(r)+Math.cos(i)*Math.cos(r)*Math.cos((e.lng-this.lng)*t);return Wu*Math.acos(Math.min(n,1))}static convert(e){if(e instanceof Ku)return e;if(Array.isArray(e)&&(2===e.length||3===e.length))return new Ku(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return new Ku(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const Xu=2*Math.PI*Wu;function Yu(e){return Xu*Math.cos(e*Math.PI/180)}function Ju(e){return(180+e)/360}function Qu(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function eh(e,t){return e/Yu(t)}function th(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}function ih(e,t){return e*Yu(th(t))}class rh{constructor(e,t,i=0){this.x=+e,this.y=+t,this.z=+i}static fromLngLat(e,t=0){const i=Ku.convert(e);return new rh(Ju(i.lng),Qu(i.lat),eh(t,i.lat))}toLngLat(){return new Ku(360*this.x-180,th(this.y))}toAltitude(){return ih(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Xu*(e=th(this.y),1/Math.cos(e*Math.PI/180));var e}}function nh(e,t,i){var r=2*Math.PI*6378137/256/Math.pow(2,i);return[e*r-2*Math.PI*6378137/2,t*r-2*Math.PI*6378137/2]}class oh{constructor(e,t,i){if(!function(e,t,i){return!(e<0||e>25||i<0||i>=Math.pow(2,e)||t<0||t>=Math.pow(2,e))}(e,t,i))throw new Error(`x=${t}, y=${i}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=t,this.y=i,this.key=lh(0,e,e,t,i)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t,i){const r=(o=this.y,a=this.z,s=nh(256*(n=this.x),256*(o=Math.pow(2,a)-o-1),a),l=nh(256*(n+1),256*(o+1),a),s[0]+","+s[1]+","+l[0]+","+l[1]);var n,o,a,s,l;const c=function(e,t,i){let r,n="";for(let o=e;o>0;o--)r=1<<o-1,n+=(t&r?1:0)+(i&r?2:0);return n}(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String("tms"===i?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,t>1?"@2x":"").replace(/{quadkey}/g,c).replace(/{bbox-epsg-3857}/g,r)}isChildOf(e){const t=this.z-e.z;return t>0&&e.x===this.x>>t&&e.y===this.y>>t}getTilePoint(e){const t=Math.pow(2,this.z);return new l((e.x*t-this.x)*A,(e.y*t-this.y)*A)}toString(){return`${this.z}/${this.x}/${this.y}`}}class ah{constructor(e,t){this.wrap=e,this.canonical=t,this.key=lh(e,t.z,t.z,t.x,t.y)}}class sh{constructor(e,t,i,r,n){if(this.terrainRttPosMatrix32f=null,e<i)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${i}`);this.overscaledZ=e,this.wrap=t,this.canonical=new oh(i,+r,+n),this.key=lh(t,e,i,r,n)}clone(){return new sh(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const t=this.canonical.z-e;return e>this.canonical.z?new sh(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new sh(e,this.wrap,e,this.canonical.x>>t,this.canonical.y>>t)}calculateScaledKey(e,t){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const i=this.canonical.z-e;return e>this.canonical.z?lh(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y):lh(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<this.overscaledZ&&e.canonical.x===this.canonical.x>>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return[new sh(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,r=2*this.canonical.y;return[new sh(t,this.wrap,t,i,r),new sh(t,this.wrap,t,i+1,r),new sh(t,this.wrap,t,i,r+1),new sh(t,this.wrap,t,i+1,r+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new sh(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new sh(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new ah(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new rh(e.x-this.wrap,e.y))}}function lh(e,t,i,r,n){(e*=2)<0&&(e=-1*e-1);const o=1<<i;return(o*o*e+o*n+r).toString(36)+i.toString(36)+t.toString(36)}Gn("CanonicalTileID",oh),Gn("OverscaledTileID",sh,{omit:["terrainRttPosMatrix32f"]});class ch{constructor(e,t,i,r=1,n=1,o=1,a=0){if(this.uid=e,t.height!==t.width)throw new RangeError("DEM tiles must be square");if(i&&!["mapbox","terrarium","custom"].includes(i))return void $(`"${i}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=t.height;const s=this.dim=t.height-2;switch(this.data=new Uint32Array(t.data.buffer),i){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=r,this.greenFactor=n,this.blueFactor=o,this.baseShift=a;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let e=0;e<s;e++)this.data[this._idx(-1,e)]=this.data[this._idx(0,e)],this.data[this._idx(s,e)]=this.data[this._idx(s-1,e)],this.data[this._idx(e,-1)]=this.data[this._idx(e,0)],this.data[this._idx(e,s)]=this.data[this._idx(e,s-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(s,-1)]=this.data[this._idx(s-1,0)],this.data[this._idx(-1,s)]=this.data[this._idx(0,s-1)],this.data[this._idx(s,s)]=this.data[this._idx(s-1,s-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let e=0;e<s;e++)for(let t=0;t<s;t++){const i=this.get(e,t);i>this.max&&(this.max=i),i<this.min&&(this.min=i)}}get(e,t){const i=new Uint8Array(this.data.buffer),r=4*this._idx(e,t);return this.unpack(i[r],i[r+1],i[r+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,t){if(e<-1||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)}unpack(e,t,i){return e*this.redFactor+t*this.greenFactor+i*this.blueFactor-this.baseShift}getPixels(){return new Vs({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,t,i){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let r=t*this.dim,n=t*this.dim+this.dim,o=i*this.dim,a=i*this.dim+this.dim;switch(t){case-1:r=n-1;break;case 1:n=r+1}switch(i){case-1:o=a-1;break;case 1:a=o+1}const s=-t*this.dim,l=-i*this.dim;for(let t=o;t<a;t++)for(let i=r;i<n;i++)this.data[this._idx(i,t)]=e.data[this._idx(i+s,t+l)]}}Gn("DEMData",ch);class uh{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t<e.length;t++){const i=e[t];this._stringToNumber[i]=t,this._numberToString[t]=i}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class hh{constructor(e,t,i,r,n){this.type="Feature",this._vectorTileFeature=e,e._z=t,e._x=i,e._y=r,this.properties=e.properties,this.id=n}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const t in this)"_geometry"!==t&&"_vectorTileFeature"!==t&&(e[t]=this[t]);return e}}class ph{constructor(e,t){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new qn(A,16,0),this.grid3D=new qn(A,16,0),this.featureIndexArray=new ga,this.promoteId=t}insert(e,t,i,r,n,o){const a=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,r,n);const s=o?this.grid3D:this.grid;for(let e=0;e<t.length;e++){const i=t[e],r=[1/0,1/0,-1/0,-1/0];for(let e=0;e<i.length;e++){const t=i[e];r[0]=Math.min(r[0],t.x),r[1]=Math.min(r[1],t.y),r[2]=Math.max(r[2],t.x),r[3]=Math.max(r[3],t.y)}r[0]<A&&r[1]<A&&r[2]>=0&&r[3]>=0&&s.insert(a,r[0],r[1],r[2],r[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Ql.VectorTile(new $c(this.rawTileData)).layers,this.sourceLayerCoder=new uh(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,t,i,r){this.loadVTLayers();const n=e.params,o=A/e.tileSize/e.scale,a=Jr(n.filter),s=e.queryGeometry,c=e.queryPadding*o,u=mh(s),h=this.grid.query(u.minX-c,u.minY-c,u.maxX+c,u.maxY+c),p=mh(e.cameraQueryGeometry),d=this.grid3D.query(p.minX-c,p.minY-c,p.maxX+c,p.maxY+c,((t,i,r,n)=>function(e,t,i,r,n){for(const o of e)if(t<=o.x&&i<=o.y&&r>=o.x&&n>=o.y)return!0;const o=[new l(t,i),new l(t,n),new l(r,n),new l(r,i)];if(e.length>2)for(const t of o)if(Ss(e,t))return!0;for(let t=0;t<e.length-1;t++)if(As(e[t],e[t+1],o))return!0;return!1}(e.cameraQueryGeometry,t-c,i-c,r+c,n+c)));for(const e of d)h.push(e);h.sort(fh);const m={};let f;for(let l=0;l<h.length;l++){const c=h[l];if(c===f)continue;f=c;const u=this.featureIndexArray.get(c);let p=null;this.loadMatchingFeature(m,u.bucketIndex,u.sourceLayerIndex,u.featureIndex,a,n.layers,n.availableImages,t,i,r,((t,i,r)=>(p||(p=hs(t)),i.queryIntersectsFeature({queryGeometry:s,feature:t,featureState:r,geometry:p,zoom:this.z,transform:e.transform,pixelsToTileUnits:o,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation}))))}return m}loadMatchingFeature(e,t,i,r,n,o,a,s,l,c,u){const h=this.bucketLayerIDs[t];if(o&&!h.some((e=>o.has(e))))return;const p=this.sourceLayerCoder.decode(i),d=this.vtLayers[p].feature(r);if(n.needGeometry){const e=ps(d,!0);if(!n.filter(new mo(this.tileID.overscaledZ),e,this.tileID.canonical))return}else if(!n.filter(new mo(this.tileID.overscaledZ),d))return;const m=this.getId(d,p);for(let t=0;t<h.length;t++){const i=h[t];if(o&&!o.has(i))continue;const n=s[i];if(!n)continue;let p={};m&&c&&(p=c.getState(n.sourceLayer||"_geojsonTileLayer",m));const f=F({},l[i]);f.paint=dh(f.paint,n.paint,d,p,a),f.layout=dh(f.layout,n.layout,d,p,a);const g=!u||u(d,n,p);if(!g)continue;const y=new hh(d,this.z,this.x,this.y,m);y.layer=f;let _=e[i];void 0===_&&(_=e[i]=[]),_.push({featureIndex:r,feature:y,intersectionZ:g})}}lookupSymbolFeatures(e,t,i,r,n,o,a,s){const l={};this.loadVTLayers();const c=Jr(n);for(const n of e)this.loadMatchingFeature(l,i,r,n,c,o,a,s,t);return l}hasLayer(e){for(const t of this.bucketLayerIDs)for(const i of t)if(e===i)return!0;return!1}getId(e,t){var i;let r=e.id;return this.promoteId&&(r=e.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[t]],"boolean"==typeof r&&(r=Number(r)),void 0===r&&(null===(i=e.properties)||void 0===i?void 0:i.cluster)&&this.promoteId&&(r=Number(e.properties.cluster_id))),r}}function dh(e,t,i,r,n){return B(e,((e,o)=>{const a=t instanceof wo?t.get(o):null;return a&&a.evaluate?a.evaluate(i,r,n):a}))}function mh(e){let t=1/0,i=1/0,r=-1/0,n=-1/0;for(const o of e)t=Math.min(t,o.x),i=Math.min(i,o.y),r=Math.max(r,o.x),n=Math.max(n,o.y);return{minX:t,minY:i,maxX:r,maxY:n}}function fh(e,t){return t-e}function gh(e,t,i,r,n){const o=[];for(let a=0;a<e.length;a++){const s=e[a];let c;for(let e=0;e<s.length-1;e++){let a=s[e],u=s[e+1];a.x<t&&u.x<t||(a.x<t?a=new l(t,a.y+(t-a.x)/(u.x-a.x)*(u.y-a.y))._round():u.x<t&&(u=new l(t,a.y+(t-a.x)/(u.x-a.x)*(u.y-a.y))._round()),a.y<i&&u.y<i||(a.y<i?a=new l(a.x+(i-a.y)/(u.y-a.y)*(u.x-a.x),i)._round():u.y<i&&(u=new l(a.x+(i-a.y)/(u.y-a.y)*(u.x-a.x),i)._round()),a.x>=r&&u.x>=r||(a.x>=r?a=new l(r,a.y+(r-a.x)/(u.x-a.x)*(u.y-a.y))._round():u.x>=r&&(u=new l(r,a.y+(r-a.x)/(u.x-a.x)*(u.y-a.y))._round()),a.y>=n&&u.y>=n||(a.y>=n?a=new l(a.x+(n-a.y)/(u.y-a.y)*(u.x-a.x),n)._round():u.y>=n&&(u=new l(a.x+(n-a.y)/(u.y-a.y)*(u.x-a.x),n)._round()),c&&a.equals(c[c.length-1])||(c=[a],o.push(c)),c.push(u)))))}}return o}Gn("FeatureIndex",ph,{omit:["rawTileData","sourceLayerCoder"]});class yh extends l{constructor(e,t,i,r){super(e,t),this.angle=i,void 0!==r&&(this.segment=r)}clone(){return new yh(this.x,this.y,this.angle,this.segment)}}function _h(e,t,i,r,n){if(void 0===t.segment||0===i)return!0;let o=t,a=t.segment+1,s=0;for(;s>-i/2;){if(a--,a<0)return!1;s-=e[a].dist(o),o=e[a]}s+=e[a].dist(e[a+1]),a++;const l=[];let c=0;for(;s<i/2;){const t=e[a],i=e[a+1];if(!i)return!1;let o=e[a-1].angleTo(t)-t.angleTo(i);for(o=Math.abs((o+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:s,angleDelta:o}),c+=o;s-l[0].distance>r;)c-=l.shift().angleDelta;if(c>n)return!1;a++,s+=t.dist(i)}return!0}function vh(e){let t=0;for(let i=0;i<e.length-1;i++)t+=e[i].dist(e[i+1]);return t}function xh(e,t,i){return e?.6*t*i:0}function bh(e,t){return Math.max(e?e.right-e.left:0,t?t.right-t.left:0)}function wh(e,t,i,r,n,o){const a=xh(i,n,o),s=bh(i,r)*o;let l=0;const c=vh(e)/2;for(let i=0;i<e.length-1;i++){const r=e[i],n=e[i+1],o=r.dist(n);if(l+o>c){const u=(c-l)/o,h=ni.number(r.x,n.x,u),p=ni.number(r.y,n.y,u),d=new yh(h,p,n.angleTo(r),i);return d._round(),!a||_h(e,d,s,a,t)?d:void 0}l+=o}}function Ch(e,t,i,r,n,o,a,s,l){const c=xh(r,o,a),u=bh(r,n),h=u*a,p=0===e[0].x||e[0].x===l||0===e[0].y||e[0].y===l;return t-h<t/4&&(t=h+t/4),Th(e,p?t/2*s%t:(u/2+2*o)*a*s%t,t,c,i,h,p,!1,l)}function Th(e,t,i,r,n,o,a,s,l){const c=o/2,u=vh(e);let h=0,p=t-i,d=[];for(let t=0;t<e.length-1;t++){const a=e[t],s=e[t+1],m=a.dist(s),f=s.angleTo(a);for(;p+i<h+m;){p+=i;const g=(p-h)/m,y=ni.number(a.x,s.x,g),_=ni.number(a.y,s.y,g);if(y>=0&&y<l&&_>=0&&_<l&&p-c>=0&&p+c<=u){const i=new yh(y,_,f,t);i._round(),r&&!_h(e,i,o,r,n)||d.push(i)}}h+=m}return s||d.length||a||(d=Th(e,h/2,i,r,n,o,a,!0,l)),d}Gn("Anchor",yh);const Sh=Wc;function Ah(e,t,i,r){const n=[],o=e.image,a=o.pixelRatio,s=o.paddedRect.w-2*Sh,c=o.paddedRect.h-2*Sh;let u={x1:e.left,y1:e.top,x2:e.right,y2:e.bottom};const h=o.stretchX||[[0,s]],p=o.stretchY||[[0,c]],d=(e,t)=>e+t[1]-t[0],m=h.reduce(d,0),f=p.reduce(d,0),g=s-m,y=c-f;let _=0,v=m,x=0,b=f,w=0,C=g,T=0,S=y;if(o.content&&r){const t=o.content,i=t[2]-t[0],r=t[3]-t[1];(o.textFitWidth||o.textFitHeight)&&(u=vu(e)),_=Mh(h,0,t[0]),x=Mh(p,0,t[1]),v=Mh(h,t[0],t[2]),b=Mh(p,t[1],t[3]),w=t[0]-_,T=t[1]-x,C=i-v,S=r-b}const A=u.x1,M=u.y1,E=u.x2-A,P=u.y2-M,I=(e,r,n,s)=>{const c=Ph(e.stretch-_,v,E,A),u=Ih(e.fixed-w,C,e.stretch,m),h=Ph(r.stretch-x,b,P,M),p=Ih(r.fixed-T,S,r.stretch,f),d=Ph(n.stretch-_,v,E,A),g=Ih(n.fixed-w,C,n.stretch,m),y=Ph(s.stretch-x,b,P,M),I=Ih(s.fixed-T,S,s.stretch,f),k=new l(c,h),z=new l(d,h),L=new l(d,y),D=new l(c,y),F=new l(u/a,p/a),R=new l(g/a,I/a),B=t*Math.PI/180;if(B){const e=Math.sin(B),t=Math.cos(B),i=[t,-e,e,t];k._matMult(i),z._matMult(i),D._matMult(i),L._matMult(i)}const O=e.stretch+e.fixed,j=r.stretch+r.fixed;return{tl:k,tr:z,bl:D,br:L,tex:{x:o.paddedRect.x+Sh+O,y:o.paddedRect.y+Sh+j,w:n.stretch+n.fixed-O,h:s.stretch+s.fixed-j},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:F,pixelOffsetBR:R,minFontScaleX:C/a/E,minFontScaleY:S/a/P,isSDF:i}};if(r&&(o.stretchX||o.stretchY)){const e=Eh(h,g,m),t=Eh(p,y,f);for(let i=0;i<e.length-1;i++){const r=e[i],o=e[i+1];for(let e=0;e<t.length-1;e++)n.push(I(r,t[e],o,t[e+1]))}}else n.push(I({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:s+1},{fixed:0,stretch:c+1}));return n}function Mh(e,t,i){let r=0;for(const n of e)r+=Math.max(t,Math.min(i,n[1]))-Math.max(t,Math.min(i,n[0]));return r}function Eh(e,t,i){const r=[{fixed:-1,stretch:0}];for(const[t,i]of e){const e=r[r.length-1];r.push({fixed:t-e.stretch,stretch:e.stretch}),r.push({fixed:t-e.stretch,stretch:e.stretch+(i-t)})}return r.push({fixed:t+Sh,stretch:i}),r}function Ph(e,t,i,r){return e/t*i+r}function Ih(e,t,i,r){return e-t*i/r}class kh{constructor(e,t,i,r,n,o,a,s,c,u){var h;if(this.boxStartIndex=e.length,c){let e=o.top,t=o.bottom;const i=o.collisionPadding;i&&(e-=i[1],t+=i[3]);let r=t-e;r>0&&(r=Math.max(10,r),this.circleDiameter=r)}else{const c=(null===(h=o.image)||void 0===h?void 0:h.content)&&(o.image.textFitWidth||o.image.textFitHeight)?vu(o):{x1:o.left,y1:o.top,x2:o.right,y2:o.bottom};c.y1=c.y1*a-s[0],c.y2=c.y2*a+s[2],c.x1=c.x1*a-s[3],c.x2=c.x2*a+s[1];const p=o.collisionPadding;if(p&&(c.x1-=p[0]*a,c.y1-=p[1]*a,c.x2+=p[2]*a,c.y2+=p[3]*a),u){const e=new l(c.x1,c.y1),t=new l(c.x2,c.y1),i=new l(c.x1,c.y2),r=new l(c.x2,c.y2),n=u*Math.PI/180;e._rotate(n),t._rotate(n),i._rotate(n),r._rotate(n),c.x1=Math.min(e.x,t.x,i.x,r.x),c.x2=Math.max(e.x,t.x,i.x,r.x),c.y1=Math.min(e.y,t.y,i.y,r.y),c.y2=Math.max(e.y,t.y,i.y,r.y)}e.emplaceBack(t.x,t.y,c.x1,c.y1,c.x2,c.y2,i,r,n)}this.boxEndIndex=e.length}}class zh{constructor(e=[],t=(e,t)=>e<t?-1:e>t?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;const e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:i}=this,r=t[e];for(;e>0;){const n=e-1>>1,o=t[n];if(i(r,o)>=0)break;t[e]=o,e=n}t[e]=r}_down(e){const{data:t,compare:i}=this,r=this.length>>1,n=t[e];for(;e<r;){let r=1+(e<<1);const o=r+1;if(o<this.length&&i(t[o],t[r])<0&&(r=o),i(t[r],n)>=0)break;t[e]=t[r],e=r}t[e]=n}}function Lh(e,t=1,i=!1){let r=1/0,n=1/0,o=-1/0,a=-1/0;const s=e[0];for(let e=0;e<s.length;e++){const t=s[e];(!e||t.x<r)&&(r=t.x),(!e||t.y<n)&&(n=t.y),(!e||t.x>o)&&(o=t.x),(!e||t.y>a)&&(a=t.y)}const c=Math.min(o-r,a-n);let u=c/2;const h=new zh([],Dh);if(0===c)return new l(r,n);for(let t=r;t<o;t+=c)for(let i=n;i<a;i+=c)h.push(new Fh(t+u,i+u,u,e));let p=function(e){let t=0,i=0,r=0;const n=e[0];for(let e=0,o=n.length,a=o-1;e<o;a=e++){const o=n[e],s=n[a],l=o.x*s.y-s.x*o.y;i+=(o.x+s.x)*l,r+=(o.y+s.y)*l,t+=3*l}return new Fh(i/t,r/t,0,e)}(e),d=h.length;for(;h.length;){const i=h.pop();(i.d>p.d||!p.d)&&(p=i),i.max-p.d<=t||(u=i.h/2,h.push(new Fh(i.p.x-u,i.p.y-u,u,e)),h.push(new Fh(i.p.x+u,i.p.y-u,u,e)),h.push(new Fh(i.p.x-u,i.p.y+u,u,e)),h.push(new Fh(i.p.x+u,i.p.y+u,u,e)),d+=4)}return p.p}function Dh(e,t){return t.max-e.max}function Fh(e,t,i,r){this.p=new l(e,t),this.h=i,this.d=function(e,t){let i=!1,r=1/0;for(let n=0;n<t.length;n++){const o=t[n];for(let t=0,n=o.length,a=n-1;t<n;a=t++){const n=o[t],s=o[a];n.y>e.y!=s.y>e.y&&e.x<(s.x-n.x)*(e.y-n.y)/(s.y-n.y)+n.x&&(i=!i),r=Math.min(r,Cs(e,n,s))}}return(i?1:-1)*Math.sqrt(r)}(this.p,r),this.max=this.d+this.h*Math.SQRT2}var Rh;e.ay=void 0,(Rh=e.ay||(e.ay={}))[Rh.center=1]="center",Rh[Rh.left=2]="left",Rh[Rh.right=3]="right",Rh[Rh.top=4]="top",Rh[Rh.bottom=5]="bottom",Rh[Rh["top-left"]=6]="top-left",Rh[Rh["top-right"]=7]="top-right",Rh[Rh["bottom-left"]=8]="bottom-left",Rh[Rh["bottom-right"]=9]="bottom-right";const Bh=7,Oh=Number.POSITIVE_INFINITY;function jh(e,t){return t[1]!==Oh?function(e,t,i){let r=0,n=0;switch(t=Math.abs(t),i=Math.abs(i),e){case"top-right":case"top-left":case"top":n=i-Bh;break;case"bottom-right":case"bottom-left":case"bottom":n=-i+Bh}switch(e){case"top-right":case"bottom-right":case"right":r=-t;break;case"top-left":case"bottom-left":case"left":r=t}return[r,n]}(e,t[0],t[1]):function(e,t){let i=0,r=0;t<0&&(t=0);const n=t/Math.SQRT2;switch(e){case"top-right":case"top-left":r=n-Bh;break;case"bottom-right":case"bottom-left":r=-n+Bh;break;case"bottom":r=-t+Bh;break;case"top":r=t-Bh}switch(e){case"top-right":case"bottom-right":i=-n;break;case"top-left":case"bottom-left":i=n;break;case"left":i=t;break;case"right":i=-t}return[i,r]}(e,t[0])}function Nh(e,t,i){var r;const n=e.layout,o=null===(r=n.get("text-variable-anchor-offset"))||void 0===r?void 0:r.evaluate(t,{},i);if(o){const e=o.values,t=[];for(let i=0;i<e.length;i+=2){const r=t[i]=e[i],n=e[i+1].map((e=>e*Bc));r.startsWith("top")?n[1]-=Bh:r.startsWith("bottom")&&(n[1]+=Bh),t[i+1]=n}return new At(t)}const a=n.get("text-variable-anchor");if(a){let r;r=void 0!==e._unevaluatedLayout.getValue("text-radial-offset")?[n.get("text-radial-offset").evaluate(t,{},i)*Bc,Oh]:n.get("text-offset").evaluate(t,{},i).map((e=>e*Bc));const o=[];for(const e of a)o.push(e,jh(e,r));return new At(o)}return null}function $h(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 Vh(t,i,r,n,o,a,s,l,c,u,h,p){let d=a.textMaxSize.evaluate(i,{});void 0===d&&(d=s);const m=t.layers[0].layout,f=m.get("icon-offset").evaluate(i,{},h),g=qh(r.horizontal),y=s/24,_=t.tilePixelRatio*y,v=t.tilePixelRatio*d/24,x=t.tilePixelRatio*l,b=t.tilePixelRatio*m.get("symbol-spacing"),w=m.get("text-padding")*t.tilePixelRatio,C=function(e,t,i,r=1){const n=e.get("icon-padding").evaluate(t,{},i),o=n&&n.values;return[o[0]*r,o[1]*r,o[2]*r,o[3]*r]}(m,i,h,t.tilePixelRatio),T=m.get("text-max-angle")/180*Math.PI,S="viewport"!==m.get("text-rotation-alignment")&&"point"!==m.get("symbol-placement"),M="map"===m.get("icon-rotation-alignment")&&"point"!==m.get("symbol-placement"),E=m.get("symbol-placement"),P=b/2,I=m.get("icon-text-fit");let k;n&&"none"!==I&&(t.allowVerticalPlacement&&r.vertical&&(k=xu(n,r.vertical,I,m.get("icon-text-fit-padding"),f,y)),g&&(n=xu(n,g,I,m.get("icon-text-fit-padding"),f,y)));const z=h?p.line.getGranularityForZoomLevel(h.z):1,L=(l,p)=>{p.x<0||p.x>=A||p.y<0||p.y>=A||function(t,i,r,n,o,a,s,l,c,u,h,p,d,m,f,g,y,_,v,x,b,w,C,T,S){const A=t.addToLineVertexArray(i,r);let M,E,P,I,k=0,z=0,L=0,D=0,F=-1,R=-1;const B={};let O=Ua("");if(t.allowVerticalPlacement&&n.vertical){const e=l.layout.get("text-rotate").evaluate(b,{},T)+90;P=new kh(c,i,u,h,p,n.vertical,d,m,f,e),s&&(I=new kh(c,i,u,h,p,s,y,_,f,e))}if(o){const r=l.layout.get("icon-rotate").evaluate(b,{}),n="none"!==l.layout.get("icon-text-fit"),a=Ah(o,r,C,n),d=s?Ah(s,r,C,n):void 0;E=new kh(c,i,u,h,p,o,y,_,!1,r),k=4*a.length;const m=t.iconSizeData;let f=null;"source"===m.kind?(f=[wu*l.layout.get("icon-size").evaluate(b,{})],f[0]>Cu&&$(`${t.layerIds[0]}: Value for "icon-size" is >= ${bu}. Reduce your "icon-size".`)):"composite"===m.kind&&(f=[wu*w.compositeIconSizes[0].evaluate(b,{},T),wu*w.compositeIconSizes[1].evaluate(b,{},T)],(f[0]>Cu||f[1]>Cu)&&$(`${t.layerIds[0]}: Value for "icon-size" is >= ${bu}. Reduce your "icon-size".`)),t.addSymbols(t.icon,a,f,x,v,b,e.ah.none,i,A.lineStartIndex,A.lineLength,-1,T),F=t.icon.placedSymbolArray.length-1,d&&(z=4*d.length,t.addSymbols(t.icon,d,f,x,v,b,e.ah.vertical,i,A.lineStartIndex,A.lineLength,-1,T),R=t.icon.placedSymbolArray.length-1)}const j=Object.keys(n.horizontal);for(const r of j){const o=n.horizontal[r];if(!M){O=Ua(o.text);const e=l.layout.get("text-rotate").evaluate(b,{},T);M=new kh(c,i,u,h,p,o,d,m,f,e)}const s=1===o.positionedLines.length;if(L+=Uh(t,i,o,a,l,f,b,g,A,n.vertical?e.ah.horizontal:e.ah.horizontalOnly,s?j:[r],B,F,w,T),s)break}n.vertical&&(D+=Uh(t,i,n.vertical,a,l,f,b,g,A,e.ah.vertical,["vertical"],B,R,w,T));const N=M?M.boxStartIndex:t.collisionBoxArray.length,V=M?M.boxEndIndex:t.collisionBoxArray.length,U=P?P.boxStartIndex:t.collisionBoxArray.length,q=P?P.boxEndIndex:t.collisionBoxArray.length,Z=E?E.boxStartIndex:t.collisionBoxArray.length,G=E?E.boxEndIndex:t.collisionBoxArray.length,H=I?I.boxStartIndex:t.collisionBoxArray.length,W=I?I.boxEndIndex:t.collisionBoxArray.length;let K=-1;const X=(e,t)=>e&&e.circleDiameter?Math.max(e.circleDiameter,t):t;K=X(M,K),K=X(P,K),K=X(E,K),K=X(I,K);const Y=K>-1?1:0;Y&&(K*=S/Bc),t.glyphOffsetArray.length>=Lu.MAX_GLYPHS&&$("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==b.sortKey&&t.addToSortKeyRanges(t.symbolInstances.length,b.sortKey);const J=Nh(l,b,T),[Q,ee]=function(t,i){const r=t.length,n=null==i?void 0:i.values;if((null==n?void 0:n.length)>0)for(let i=0;i<n.length;i+=2){const r=n[i+1];t.emplaceBack(e.ay[n[i]],r[0],r[1])}return[r,t.length]}(t.textAnchorOffsets,J);t.symbolInstances.emplaceBack(i.x,i.y,B.right>=0?B.right:-1,B.center>=0?B.center:-1,B.left>=0?B.left:-1,B.vertical||-1,F,R,O,N,V,U,q,Z,G,H,W,u,L,D,k,z,Y,0,d,K,Q,ee)}(t,p,l,r,n,o,k,t.layers[0],t.collisionBoxArray,i.index,i.sourceLayerIndex,t.index,_,[w,w,w,w],S,c,x,C,M,f,i,a,u,h,s)};if("line"===E)for(const e of gh(i.geometry,0,0,A,A)){const i=Il(e,z),o=Ch(i,b,T,r.vertical||g,n,24,v,t.overscaling,A);for(const e of o)g&&Zh(t,g.text,P,e)||L(i,e)}else if("line-center"===E){for(const e of i.geometry)if(e.length>1){const t=Il(e,z),i=wh(t,T,r.vertical||g,n,24,v);i&&L(t,i)}}else if("Polygon"===i.type)for(const e of Ui(i.geometry,0)){const t=Lh(e,16);L(Il(e[0],z,!0),new yh(t.x,t.y,0))}else if("LineString"===i.type)for(const e of i.geometry){const t=Il(e,z);L(t,new yh(t[0].x,t[0].y,0))}else if("Point"===i.type)for(const e of i.geometry)for(const t of e)L([t],new yh(t.x,t.y,0))}function Uh(e,t,i,r,n,o,a,s,c,u,h,p,d,m,f){const g=function(e,t,i,r,n,o,a,s){const c=r.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,u=[];for(const e of t.positionedLines)for(const r of e.positionedGlyphs){if(!r.rect)continue;const o=r.rect||{};let h=Gc+1,p=!0,d=1,m=0;const f=(n||s)&&r.vertical,g=r.metrics.advance*r.scale/2;if(s&&t.verticalizable&&(m=e.lineOffset/2-(r.imageName?-(Bc-r.metrics.width*r.scale)/2:(r.scale-1)*Bc)),r.imageName){const e=a[r.imageName];p=e.sdf,d=e.pixelRatio,h=Wc/d}const y=n?[r.x+g,r.y]:[0,0];let _=n?[0,0]:[r.x+g+i[0],r.y+i[1]-m],v=[0,0];f&&(v=_,_=[0,0]);const x=r.metrics.isDoubleResolution?2:1,b=(r.metrics.left-h)*r.scale-g+_[0],w=(-r.metrics.top-h)*r.scale+_[1],C=b+o.w/x*r.scale/d,T=w+o.h/x*r.scale/d,S=new l(b,w),A=new l(C,w),M=new l(b,T),E=new l(C,T);if(f){const e=new l(-g,g-Jc),t=-Math.PI/2,i=Bc/2-g,n=new l(5-Jc-i,-(r.imageName?i:0)),o=new l(...v);S._rotateAround(t,e)._add(n)._add(o),A._rotateAround(t,e)._add(n)._add(o),M._rotateAround(t,e)._add(n)._add(o),E._rotateAround(t,e)._add(n)._add(o)}if(c){const e=Math.sin(c),t=Math.cos(c),i=[t,-e,e,t];S._matMult(i),A._matMult(i),M._matMult(i),E._matMult(i)}const P=new l(0,0),I=new l(0,0);u.push({tl:S,tr:A,bl:M,br:E,tex:o,writingMode:t.writingMode,glyphOffset:y,sectionIndex:r.sectionIndex,isSDF:p,pixelOffsetTL:P,pixelOffsetBR:I,minFontScaleX:0,minFontScaleY:0})}return u}(0,i,s,n,o,a,r,e.allowVerticalPlacement),y=e.textSizeData;let _=null;"source"===y.kind?(_=[wu*n.layout.get("text-size").evaluate(a,{})],_[0]>Cu&&$(`${e.layerIds[0]}: Value for "text-size" is >= ${bu}. Reduce your "text-size".`)):"composite"===y.kind&&(_=[wu*m.compositeTextSizes[0].evaluate(a,{},f),wu*m.compositeTextSizes[1].evaluate(a,{},f)],(_[0]>Cu||_[1]>Cu)&&$(`${e.layerIds[0]}: Value for "text-size" is >= ${bu}. Reduce your "text-size".`)),e.addSymbols(e.text,g,_,s,o,a,u,t,c.lineStartIndex,c.lineLength,d,f);for(const t of h)p[t]=e.text.placedSymbolArray.length-1;return 4*g.length}function qh(e){for(const t in e)return e[t];return null}function Zh(e,t,i,r){const n=e.compareText;if(t in n){const e=n[t];for(let t=e.length-1;t>=0;t--)if(r.dist(e[t])<i)return!0}else n[t]=[];return n[t].push(r),!1}const Gh=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Hh{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 r=i>>4;if(1!==r)throw new Error(`Got v${r} data when expected v1.`);const n=Gh[15&i];if(!n)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(e,2,1),[a]=new Uint32Array(e,4,1);return new Hh(a,o,n,e)}constructor(e,t=64,i=Float64Array,r){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 n=Gh.indexOf(this.ArrayType),o=2*e*this.ArrayType.BYTES_PER_ELEMENT,a=e*this.IndexArrayType.BYTES_PER_ELEMENT,s=(8-a%8)%8;if(n<0)throw new Error(`Unexpected typed array class: ${i}.`);r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+a+s,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+o+a+s),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+a+s,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+n]),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 Wh(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,i,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:o,nodeSize:a}=this,s=[0,n.length-1,0],l=[];for(;s.length;){const c=s.pop()||0,u=s.pop()||0,h=s.pop()||0;if(u-h<=a){for(let a=h;a<=u;a++){const s=o[2*a],c=o[2*a+1];s>=e&&s<=i&&c>=t&&c<=r&&l.push(n[a])}continue}const p=h+u>>1,d=o[2*p],m=o[2*p+1];d>=e&&d<=i&&m>=t&&m<=r&&l.push(n[p]),(0===c?e<=d:t<=m)&&(s.push(h),s.push(p-1),s.push(1-c)),(0===c?i>=d:r>=m)&&(s.push(p+1),s.push(u),s.push(1-c))}return l}within(e,t,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:r,coords:n,nodeSize:o}=this,a=[0,r.length-1,0],s=[],l=i*i;for(;a.length;){const c=a.pop()||0,u=a.pop()||0,h=a.pop()||0;if(u-h<=o){for(let i=h;i<=u;i++)Jh(n[2*i],n[2*i+1],e,t)<=l&&s.push(r[i]);continue}const p=h+u>>1,d=n[2*p],m=n[2*p+1];Jh(d,m,e,t)<=l&&s.push(r[p]),(0===c?e-i<=d:t-i<=m)&&(a.push(h),a.push(p-1),a.push(1-c)),(0===c?e+i>=d:t+i>=m)&&(a.push(p+1),a.push(u),a.push(1-c))}return s}}function Wh(e,t,i,r,n,o){if(n-r<=i)return;const a=r+n>>1;Kh(e,t,a,r,n,o),Wh(e,t,i,r,a-1,1-o),Wh(e,t,i,a+1,n,1-o)}function Kh(e,t,i,r,n,o){for(;n>r;){if(n-r>600){const a=n-r+1,s=i-r+1,l=Math.log(a),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(a-c)/a)*(s-a/2<0?-1:1);Kh(e,t,i,Math.max(r,Math.floor(i-s*c/a+u)),Math.min(n,Math.floor(i+(a-s)*c/a+u)),o)}const a=t[2*i+o];let s=r,l=n;for(Xh(e,t,r,i),t[2*n+o]>a&&Xh(e,t,r,n);s<l;){for(Xh(e,t,s,l),s++,l--;t[2*s+o]<a;)s++;for(;t[2*l+o]>a;)l--}t[2*r+o]===a?Xh(e,t,r,l):(l++,Xh(e,t,l,n)),l<=i&&(r=l+1),i<=l&&(n=l-1)}}function Xh(e,t,i,r){Yh(e,i,r),Yh(t,2*i,2*r),Yh(t,2*i+1,2*r+1)}function Yh(e,t,i){const r=e[t];e[t]=e[i],e[i]=r}function Jh(e,t,i,r){const n=e-i,o=t-r;return n*n+o*o}var Qh;e.ck=void 0,(Qh=e.ck||(e.ck={})).create="create",Qh.load="load",Qh.fullLoad="fullLoad";let ep=null,tp=[];const ip=1e3/60,rp="loadTime",np="fullLoadTime",op={mark(e){performance.mark(e)},frame(e){const t=e;null!=ep&&tp.push(t-ep),ep=t},clearMetrics(){ep=null,tp=[],performance.clearMeasures(rp),performance.clearMeasures(np);for(const t in e.ck)performance.clearMarks(e.ck[t])},getPerformanceMetrics(){performance.measure(rp,e.ck.create,e.ck.load),performance.measure(np,e.ck.create,e.ck.fullLoad);const t=performance.getEntriesByName(rp)[0].duration,i=performance.getEntriesByName(np)[0].duration,r=tp.length,n=1/(tp.reduce(((e,t)=>e+t),0)/r/1e3),o=tp.filter((e=>e>ip)).reduce(((e,t)=>e+(t-ip)/ip),0);return{loadTime:t,fullLoadTime:i,fps:n,percentDroppedFrames:o/(r+o)*100,totalFrames:r}}};e.$=rh,e.A=y,e.B=ni,e.C=mo,e.D=Co,e.E=de,e.F=Nn,e.G=function(e){if(null==q){const t=e.navigator?e.navigator.userAgent:null;q=!!e.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return q},e.H=class{constructor(e,t){this.target=e,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Gu((()=>this.process())),this.subscription=X(this.target,"message",(e=>this.receive(e)),!1),this.globalScope=U(self)?e:window}registerMessageHandler(e,t){this.messageHandlers[e]=t}sendAsync(e,t){return new Promise(((i,r)=>{const n=Math.round(1e18*Math.random()).toString(36).substring(0,10),o=t?X(t.signal,"abort",(()=>{null==o||o.unsubscribe(),delete this.resolveRejects[n];const t={id:n,type:"<cancel>",origin:location.origin,targetMapId:e.targetMapId,sourceMapId:this.mapId};this.target.postMessage(t)}),Hu):null;this.resolveRejects[n]={resolve:e=>{null==o||o.unsubscribe(),i(e)},reject:e=>{null==o||o.unsubscribe(),r(e)}};const a=[],s=Object.assign(Object.assign({},e),{id:n,sourceMapId:this.mapId,origin:location.origin,data:Xn(e.data,a)});this.target.postMessage(s,{transfer:a})}))}receive(e){const t=e.data,i=t.id;if(!("file://"!==t.origin&&"file://"!==location.origin&&"resource://android"!==t.origin&&"resource://android"!==location.origin&&t.origin!==location.origin||t.targetMapId&&this.mapId!==t.targetMapId)){if("<cancel>"===t.type){delete this.tasks[i];const e=this.abortControllers[i];return delete this.abortControllers[i],void(e&&e.abort())}if(U(self)||t.mustQueue)return this.tasks[i]=t,this.taskQueue.push(i),void this.invoker.trigger();this.processTask(i,t)}}process(){if(0===this.taskQueue.length)return;const e=this.taskQueue.shift(),t=this.tasks[e];delete this.tasks[e],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(e,t)}processTask(e,i){return t(this,void 0,void 0,(function*(){if("<response>"===i.type){const t=this.resolveRejects[e];if(delete this.resolveRejects[e],!t)return;return void(i.error?t.reject(Yn(i.error)):t.resolve(Yn(i.data)))}if(!this.messageHandlers[i.type])return void this.completeTask(e,new Error(`Could not find a registered handler for ${i.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const t=Yn(i.data),r=new AbortController;this.abortControllers[e]=r;try{const n=yield this.messageHandlers[i.type](i.sourceMapId,t,r);this.completeTask(e,null,n)}catch(t){this.completeTask(e,t)}}))}completeTask(e,t,i){const r=[];delete this.abortControllers[e];const n={id:e,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?Xn(t):null,data:Xn(i,r)};this.target.postMessage(n,{transfer:r})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},e.I=Kc,e.J=ne,e.K=function(){var e=new y(16);return y!=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.L=function(e,t,i){var r,n,o,a,s,l,c,u,h,p,d,m,f=i[0],g=i[1],y=i[2];return t===e?(e[12]=t[0]*f+t[4]*g+t[8]*y+t[12],e[13]=t[1]*f+t[5]*g+t[9]*y+t[13],e[14]=t[2]*f+t[6]*g+t[10]*y+t[14],e[15]=t[3]*f+t[7]*g+t[11]*y+t[15]):(n=t[1],o=t[2],a=t[3],s=t[4],l=t[5],c=t[6],u=t[7],h=t[8],p=t[9],d=t[10],m=t[11],e[0]=r=t[0],e[1]=n,e[2]=o,e[3]=a,e[4]=s,e[5]=l,e[6]=c,e[7]=u,e[8]=h,e[9]=p,e[10]=d,e[11]=m,e[12]=r*f+s*g+h*y+t[12],e[13]=n*f+l*g+p*y+t[13],e[14]=o*f+c*g+d*y+t[14],e[15]=a*f+u*g+m*y+t[15]),e},e.M=function(e,t,i){var r=i[0],n=i[1],o=i[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,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},e.N=function(e,t,i){var r=t[0],n=t[1],o=t[2],a=t[3],s=t[4],l=t[5],c=t[6],u=t[7],h=t[8],p=t[9],d=t[10],m=t[11],f=t[12],g=t[13],y=t[14],_=t[15],v=i[0],x=i[1],b=i[2],w=i[3];return e[0]=v*r+x*s+b*h+w*f,e[1]=v*n+x*l+b*p+w*g,e[2]=v*o+x*c+b*d+w*y,e[3]=v*a+x*u+b*m+w*_,e[4]=(v=i[4])*r+(x=i[5])*s+(b=i[6])*h+(w=i[7])*f,e[5]=v*n+x*l+b*p+w*g,e[6]=v*o+x*c+b*d+w*y,e[7]=v*a+x*u+b*m+w*_,e[8]=(v=i[8])*r+(x=i[9])*s+(b=i[10])*h+(w=i[11])*f,e[9]=v*n+x*l+b*p+w*g,e[10]=v*o+x*c+b*d+w*y,e[11]=v*a+x*u+b*m+w*_,e[12]=(v=i[12])*r+(x=i[13])*s+(b=i[14])*h+(w=i[15])*f,e[13]=v*n+x*l+b*p+w*g,e[14]=v*o+x*c+b*d+w*y,e[15]=v*a+x*u+b*m+w*_,e},e.O=function(e,t){const i={};for(let r=0;r<t.length;r++){const n=t[r];n in e&&(i[n]=e[n])}return i},e.P=l,e.Q=Ku,e.R=Vs,e.S=Qu,e.T=yo,e.U=Ju,e.V=d,e.W=m,e.X=H,e.Y=sh,e.Z=A,e._=t,e.a=ie,e.a$=function(e,t,i){var r=Math.sin(i),n=Math.cos(i),o=t[4],a=t[5],s=t[6],l=t[7],c=t[8],u=t[9],h=t[10],p=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*n+c*r,e[5]=a*n+u*r,e[6]=s*n+h*r,e[7]=l*n+p*r,e[8]=c*n-o*r,e[9]=u*n-a*r,e[10]=h*n-s*r,e[11]=p*n-l*r,e},e.a0=25,e.a1=oh,e.a2=e=>{const t=window.document.createElement("video");return t.muted=!0,new Promise((i=>{t.onloadstart=()=>{i(t)};for(const i of e){const e=window.document.createElement("source");le(i)||(t.crossOrigin="Anonymous"),e.src=i,t.appendChild(e)}}))},e.a3=Ae,e.a4=function(){return R++},e.a5=aa,e.a6=Lu,e.a7=Jr,e.a8=ps,e.a9=hh,e.aA=$h,e.aB=hu,e.aC=Hh,e.aD=Do,e.aE=Sl,e.aF=ya,e.aG=La,e.aH=Pa,e.aI=function(e){return Math.pow(2,e)},e.aJ=85.051129,e.aK=eh,e.aL=D,e.aM=Y,e.aN=ih,e.aO=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e},e.aP=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.aQ=function(e){var t=new y(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},e.aR=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},e.aS=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.aT=function(e,t){var i=t[0],r=t[1],n=t[2],o=i*i+r*r+n*n;return o>0&&(o=1/Math.sqrt(o)),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e},e.aU=function(e,t,i){var r=t[0],n=t[1],o=t[2],a=i[0],s=i[1],l=i[2];return e[0]=n*l-o*s,e[1]=o*a-r*l,e[2]=r*s-n*a,e},e.aV=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},e.aW=ah,e.aX=lh,e.aY=function(e,t,i,r,n){var o,a=1/Math.tan(t/2);return e[0]=a/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,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!=n&&n!==1/0?(e[10]=(n+r)*(o=1/(r-n)),e[14]=2*n*r*o):(e[10]=-1,e[14]=-2*r),e},e.aZ=function(e){var t=new y(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.a_=function(e,t,i){var r=Math.sin(i),n=Math.cos(i),o=t[0],a=t[1],s=t[2],l=t[3],c=t[4],u=t[5],h=t[6],p=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*n+c*r,e[1]=a*n+u*r,e[2]=s*n+h*r,e[3]=l*n+p*r,e[4]=c*n-o*r,e[5]=u*n-a*r,e[6]=h*n-s*r,e[7]=p*n-l*r,e},e.aa=function(e){const t={};if(e.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((e,i,r,n)=>{const o=r||n;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},e.ab=function(e){return Math.log(e)/Math.LN2},e.ac=function(e){var t=e[0],i=e[1];return t*t+i*i},e.ad=function(e){return e*Math.PI/180},e.ae=L,e.af=function(e,t){const i=[];for(const r in e)r in t||i.push(r);return i},e.ag=function(e,t){let i=0,r=0;if("constant"===e.kind)r=e.layoutSize;else if("source"!==e.kind){const{interpolationType:n,minZoom:o,maxZoom:a}=e,s=n?L(ii.interpolationFactor(n,t,o,a),0,1):0;"camera"===e.kind?r=ni.number(e.minSize,e.maxSize,s):i=s}return{uSizeT:i,uSize:r}},e.ai=function(e,{uSize:t,uSizeT:i},{lowerSize:r,upperSize:n}){return"source"===e.kind?r/wu:"composite"===e.kind?ni.number(r/wu,n/wu,i):t},e.aj=function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],a=t[4],s=t[5],l=t[6],c=t[7],u=t[8],h=t[9],p=t[10],d=t[11],m=t[12],f=t[13],g=t[14],y=t[15],_=i*s-r*a,v=i*l-n*a,x=i*c-o*a,b=r*l-n*s,w=r*c-o*s,C=n*c-o*l,T=u*f-h*m,S=u*g-p*m,A=u*y-d*m,M=h*g-p*f,E=h*y-d*f,P=p*y-d*g,I=_*P-v*E+x*M+b*A-w*S+C*T;return I?(e[0]=(s*P-l*E+c*M)*(I=1/I),e[1]=(n*E-r*P-o*M)*I,e[2]=(f*C-g*w+y*b)*I,e[3]=(p*w-h*C-d*b)*I,e[4]=(l*A-a*P-c*S)*I,e[5]=(i*P-n*A+o*S)*I,e[6]=(g*x-m*C-y*v)*I,e[7]=(u*C-p*x+d*v)*I,e[8]=(a*E-s*A+c*T)*I,e[9]=(r*A-i*E-o*T)*I,e[10]=(m*w-f*x+y*_)*I,e[11]=(h*x-u*w-d*_)*I,e[12]=(s*S-a*M-l*T)*I,e[13]=(i*M-r*S+n*T)*I,e[14]=(f*v-m*b-g*_)*I,e[15]=(u*b-h*v+p*_)*I,e):null},e.ak=T,e.al=function(e){return Math.hypot(e[0],e[1])},e.am=function(e){return e[0]=0,e[1]=0,e},e.an=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e},e.ao=Pu,e.ap=w,e.aq=function(e,t,i,r){const n=t.y-e.y,o=t.x-e.x,a=r.y-i.y,s=r.x-i.x,c=a*o-s*n;if(0===c)return null;const u=(s*(e.y-i.y)-a*(e.x-i.x))/c;return new l(e.x+u*o,e.y+u*n)},e.ar=gh,e.as=gs,e.at=v,e.au=function(e){let t=1/0,i=1/0,r=-1/0,n=-1/0;for(const o of e)t=Math.min(t,o.x),i=Math.min(i,o.y),r=Math.max(r,o.x),n=Math.max(n,o.y);return[t,i,r,n]},e.av=Bc,e.aw=M,e.ax=function(e,t,i,r,n=!1){if(!i[0]&&!i[1])return[0,0];const o=n?"map"===r?-e.bearingInRadians:0:"viewport"===r?e.bearingInRadians:0;if(o){const e=Math.sin(o),t=Math.cos(o);i=[i[0]*t-i[1]*e,i[0]*e+i[1]*t]}return[n?i[0]:M(t,i[0],e.zoom),n?i[1]:M(t,i[1],e.zoom)]},e.az=Su,e.b=Z,e.b$=e=>"symbol"===e.type,e.b0=function(){const e=new Float32Array(16);return v(e),e},e.b1=function(){const e=new Float64Array(16);return v(e),e},e.b2=function(){return new Float64Array(16)},e.b3=function(e,t,i){const r=new Float64Array(4);return function(e,t,i,r){var n=.5*Math.PI/180;t*=n,i*=n,r*=n;var o=Math.sin(t),a=Math.cos(t),s=Math.sin(i),l=Math.cos(i),c=Math.sin(r),u=Math.cos(r);e[0]=o*l*u-a*s*c,e[1]=a*s*u+o*l*c,e[2]=a*l*c-o*s*u,e[3]=a*l*u+o*s*c}(r,e,t-90,i),r},e.b4=function(e,t,i,r){var n,o,a,s,l,c=t[0],u=t[1],h=t[2],p=t[3],d=i[0],m=i[1],f=i[2],y=i[3];return(o=c*d+u*m+h*f+p*y)<0&&(o=-o,d=-d,m=-m,f=-f,y=-y),1-o>g?(n=Math.acos(o),a=Math.sin(n),s=Math.sin((1-r)*n)/a,l=Math.sin(r*n)/a):(s=1-r,l=r),e[0]=s*c+l*d,e[1]=s*u+l*m,e[2]=s*h+l*f,e[3]=s*p+l*y,e},e.b5=function(e){const t=new Float64Array(9);var i,r,n,o,a,s,l,c,u,h,p,d,m,f,g,y,_,v;h=(n=(r=e)[0])*(l=n+n),p=(o=r[1])*l,m=(a=r[2])*l,f=a*(c=o+o),y=(s=r[3])*l,_=s*c,v=s*(u=a+a),(i=t)[0]=1-(d=o*c)-(g=a*u),i[3]=p-v,i[6]=m+_,i[1]=p+v,i[4]=1-h-g,i[7]=f-y,i[2]=m-_,i[5]=f+y,i[8]=1-h-d;const x=Y(-Math.asin(L(t[2],-1,1)));let b,w;return Math.hypot(t[5],t[8])<.001?(b=0,w=-Y(Math.atan2(t[3],t[4]))):(b=Y(0===t[5]&&0===t[8]?0:Math.atan2(t[5],t[8])),w=Y(0===t[1]&&0===t[0]?0:Math.atan2(t[1],t[0]))),{roll:b,pitch:x+90,bearing:w}},e.b6=function(e,t){return e.roll==t.roll&&e.pitch==t.pitch&&e.bearing==t.bearing},e.b7=_t,e.b8=Ka,e.b9=Al,e.bA=function(e,t){if(!e)return[{command:"setStyle",args:[t]}];let i=[];try{if(!ye(e.version,t.version))return[{command:"setStyle",args:[t]}];ye(e.center,t.center)||i.push({command:"setCenter",args:[t.center]}),ye(e.centerAltitude,t.centerAltitude)||i.push({command:"setCenterAltitude",args:[t.centerAltitude]}),ye(e.zoom,t.zoom)||i.push({command:"setZoom",args:[t.zoom]}),ye(e.bearing,t.bearing)||i.push({command:"setBearing",args:[t.bearing]}),ye(e.pitch,t.pitch)||i.push({command:"setPitch",args:[t.pitch]}),ye(e.roll,t.roll)||i.push({command:"setRoll",args:[t.roll]}),ye(e.sprite,t.sprite)||i.push({command:"setSprite",args:[t.sprite]}),ye(e.glyphs,t.glyphs)||i.push({command:"setGlyphs",args:[t.glyphs]}),ye(e.transition,t.transition)||i.push({command:"setTransition",args:[t.transition]}),ye(e.light,t.light)||i.push({command:"setLight",args:[t.light]}),ye(e.terrain,t.terrain)||i.push({command:"setTerrain",args:[t.terrain]}),ye(e.sky,t.sky)||i.push({command:"setSky",args:[t.sky]}),ye(e.projection,t.projection)||i.push({command:"setProjection",args:[t.projection]});const r={},n=[];!function(e,t,i,r){let n;for(n in t=t||{},e=e||{})Object.prototype.hasOwnProperty.call(e,n)&&(Object.prototype.hasOwnProperty.call(t,n)||xe(n,i,r));for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&(Object.prototype.hasOwnProperty.call(e,n)?ye(e[n],t[n])||("geojson"===e[n].type&&"geojson"===t[n].type&&we(e,t,n)?_e(i,{command:"setGeoJSONSourceData",args:[n,t[n].data]}):be(n,t,i,r)):ve(n,t,i))}(e.sources,t.sources,n,r);const o=[];e.layers&&e.layers.forEach((e=>{"source"in e&&r[e.source]?i.push({command:"removeLayer",args:[e.id]}):o.push(e)})),i=i.concat(n),function(e,t,i){t=t||[];const r=(e=e||[]).map(Te),n=t.map(Te),o=e.reduce(Se,{}),a=t.reduce(Se,{}),s=r.slice(),l=Object.create(null);let c,u,h,p,d;for(let e=0,t=0;e<r.length;e++)c=r[e],Object.prototype.hasOwnProperty.call(a,c)?t++:(_e(i,{command:"removeLayer",args:[c]}),s.splice(s.indexOf(c,t),1));for(let e=0,t=0;e<n.length;e++)c=n[n.length-1-e],s[s.length-1-e]!==c&&(Object.prototype.hasOwnProperty.call(o,c)?(_e(i,{command:"removeLayer",args:[c]}),s.splice(s.lastIndexOf(c,s.length-t),1)):t++,p=s[s.length-e],_e(i,{command:"addLayer",args:[a[c],p]}),s.splice(s.length-e,0,c),l[c]=!0);for(let e=0;e<n.length;e++)if(c=n[e],u=o[c],h=a[c],!l[c]&&!ye(u,h))if(ye(u.source,h.source)&&ye(u["source-layer"],h["source-layer"])&&ye(u.type,h.type)){for(d in Ce(u.layout,h.layout,i,c,null,"setLayoutProperty"),Ce(u.paint,h.paint,i,c,null,"setPaintProperty"),ye(u.filter,h.filter)||_e(i,{command:"setFilter",args:[c,h.filter]}),ye(u.minzoom,h.minzoom)&&ye(u.maxzoom,h.maxzoom)||_e(i,{command:"setLayerZoomRange",args:[c,h.minzoom,h.maxzoom]}),u)Object.prototype.hasOwnProperty.call(u,d)&&"layout"!==d&&"paint"!==d&&"filter"!==d&&"metadata"!==d&&"minzoom"!==d&&"maxzoom"!==d&&(0===d.indexOf("paint.")?Ce(u[d],h[d],i,c,d.slice(6),"setPaintProperty"):ye(u[d],h[d])||_e(i,{command:"setLayerProperty",args:[c,d,h[d]]}));for(d in h)Object.prototype.hasOwnProperty.call(h,d)&&!Object.prototype.hasOwnProperty.call(u,d)&&"layout"!==d&&"paint"!==d&&"filter"!==d&&"metadata"!==d&&"minzoom"!==d&&"maxzoom"!==d&&(0===d.indexOf("paint.")?Ce(u[d],h[d],i,c,d.slice(6),"setPaintProperty"):ye(u[d],h[d])||_e(i,{command:"setLayerProperty",args:[c,d,h[d]]}))}else _e(i,{command:"removeLayer",args:[c]}),p=s[s.lastIndexOf(c)+1],_e(i,{command:"addLayer",args:[h,p]})}(o,t.layers,i)}catch(e){console.warn("Unable to compute style diff:",e),i=[{command:"setStyle",args:[t]}]}return i},e.bB=function(e){const t=[],i=e.id;return void 0===i&&t.push({message:`layers.${i}: missing required property "id"`}),void 0===e.render&&t.push({message:`layers.${i}: missing required method "render"`}),e.renderingMode&&"2d"!==e.renderingMode&&"3d"!==e.renderingMode&&t.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),t},e.bC=function e(t,i){if(Array.isArray(t)){if(!Array.isArray(i)||t.length!==i.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],i[r]))return!1;return!0}if("object"==typeof t&&null!==t&&null!==i){if("object"!=typeof i)return!1;if(Object.keys(t).length!==Object.keys(i).length)return!1;for(const r in t)if(!e(t[r],i[r]))return!1;return!0}return t===i},e.bD=B,e.bE=O,e.bF=class extends Wa{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1i(this.location,e))}},e.bG=Ya,e.bH=class extends Wa{constructor(e,t){super(e,t),this.current=Ja}set(e){if(e[12]!==this.current[12]||e[0]!==this.current[0])return this.current=e,void this.gl.uniformMatrix4fv(this.location,!1,e);for(let t=1;t<16;t++)if(e[t]!==this.current[t]){this.current=e,this.gl.uniformMatrix4fv(this.location,!1,e);break}}},e.bI=Xa,e.bJ=class extends Wa{constructor(e,t){super(e,t),this.current=[0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]||(this.current=e,this.gl.uniform3f(this.location,e[0],e[1],e[2]))}},e.bK=class extends Wa{constructor(e,t){super(e,t),this.current=[0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]||(this.current=e,this.gl.uniform2f(this.location,e[0],e[1]))}},e.bL=_,e.bM=function(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=i,e[2]=0,e[3]=-i,e[4]=r,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},e.bN=function(e,t,i){var r=t[0],n=t[1],o=t[2];return e[0]=r*i[0]+n*i[3]+o*i[6],e[1]=r*i[1]+n*i[4]+o*i[7],e[2]=r*i[2]+n*i[5]+o*i[8],e},e.bO=function(e,t,i,r,n,o,a){var s=1/(t-i),l=1/(r-n),c=1/(o-a);return e[0]=-2*s,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)*s,e[13]=(n+r)*l,e[14]=(a+o)*c,e[15]=1,e},e.bP=class extends Wo{},e.bQ=kc,e.bR=class extends Xo{},e.bS=qs,e.bT=function(e){return e<=1?1:Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},e.bU=Us,e.bV=function(e,t,i){var r=t[0],n=t[1],o=t[2],a=i[3]*r+i[7]*n+i[11]*o+i[15];return e[0]=(i[0]*r+i[4]*n+i[8]*o+i[12])/(a=a||1),e[1]=(i[1]*r+i[5]*n+i[9]*o+i[13])/a,e[2]=(i[2]*r+i[6]*n+i[10]*o+i[14])/a,e},e.bW=class extends Oo{},e.bX=class extends ra{},e.bY=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&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.bZ=function(e,t){var i=e[0],r=e[1],n=e[2],o=e[3],a=e[4],s=e[5],l=e[6],c=e[7],u=e[8],h=e[9],p=e[10],d=e[11],m=e[12],f=e[13],y=e[14],_=e[15],v=t[0],x=t[1],b=t[2],w=t[3],C=t[4],T=t[5],S=t[6],A=t[7],M=t[8],E=t[9],P=t[10],I=t[11],k=t[12],z=t[13],L=t[14],D=t[15];return Math.abs(i-v)<=g*Math.max(1,Math.abs(i),Math.abs(v))&&Math.abs(r-x)<=g*Math.max(1,Math.abs(r),Math.abs(x))&&Math.abs(n-b)<=g*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(o-w)<=g*Math.max(1,Math.abs(o),Math.abs(w))&&Math.abs(a-C)<=g*Math.max(1,Math.abs(a),Math.abs(C))&&Math.abs(s-T)<=g*Math.max(1,Math.abs(s),Math.abs(T))&&Math.abs(l-S)<=g*Math.max(1,Math.abs(l),Math.abs(S))&&Math.abs(c-A)<=g*Math.max(1,Math.abs(c),Math.abs(A))&&Math.abs(u-M)<=g*Math.max(1,Math.abs(u),Math.abs(M))&&Math.abs(h-E)<=g*Math.max(1,Math.abs(h),Math.abs(E))&&Math.abs(p-P)<=g*Math.max(1,Math.abs(p),Math.abs(P))&&Math.abs(d-I)<=g*Math.max(1,Math.abs(d),Math.abs(I))&&Math.abs(m-k)<=g*Math.max(1,Math.abs(m),Math.abs(k))&&Math.abs(f-z)<=g*Math.max(1,Math.abs(f),Math.abs(z))&&Math.abs(y-L)<=g*Math.max(1,Math.abs(y),Math.abs(L))&&Math.abs(_-D)<=g*Math.max(1,Math.abs(_),Math.abs(D))},e.b_=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],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},e.ba=Ml,e.bb=Tl,e.bc=P,e.bd=I,e.be=Et,e.bf=function(e,t,i,r,n){return P(r,n,L((e-t)/(i-t),0,1))},e.bg=E,e.bh=function(){return new Float64Array(4)},e.bi=function(){return new Float64Array(3)},e.bj=function(e,t,i,r){var n=[],o=[];return n[0]=t[0]-i[0],n[1]=t[1]-i[1],n[2]=t[2]-i[2],o[0]=n[0]*Math.cos(r)-n[1]*Math.sin(r),o[1]=n[0]*Math.sin(r)+n[1]*Math.cos(r),o[2]=n[2],e[0]=o[0]+i[0],e[1]=o[1]+i[1],e[2]=o[2]+i[2],e},e.bk=function(e,t,i,r){var n=[],o=[];return n[0]=t[0]-i[0],n[1]=t[1]-i[1],n[2]=t[2]-i[2],o[0]=n[0],o[1]=n[1]*Math.cos(r)-n[2]*Math.sin(r),o[2]=n[1]*Math.sin(r)+n[2]*Math.cos(r),e[0]=o[0]+i[0],e[1]=o[1]+i[1],e[2]=o[2]+i[2],e},e.bl=function(e,t,i,r){var n=[],o=[];return n[0]=t[0]-i[0],n[1]=t[1]-i[1],n[2]=t[2]-i[2],o[0]=n[2]*Math.sin(r)+n[0]*Math.cos(r),o[1]=n[1],o[2]=n[2]*Math.cos(r)-n[0]*Math.sin(r),e[0]=o[0]+i[0],e[1]=o[1]+i[1],e[2]=o[2]+i[2],e},e.bm=function(e,t,i){var r=Math.sin(i),n=Math.cos(i),o=t[0],a=t[1],s=t[2],l=t[3],c=t[8],u=t[9],h=t[10],p=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*n-c*r,e[1]=a*n-u*r,e[2]=s*n-h*r,e[3]=l*n-p*r,e[8]=o*r+c*n,e[9]=a*r+u*n,e[10]=s*r+h*n,e[11]=l*r+p*n,e},e.bn=function(e,t){const i=E(e,360),r=E(t,360),n=r-i,o=r>i?n-360:n+360;return Math.abs(n)<Math.abs(o)?n:o},e.bo=function(e){return e[0]=0,e[1]=0,e[2]=0,e},e.bp=function(e,t,i,r){const n=Math.sqrt(e*e+t*t),o=Math.sqrt(i*i+r*r);e/=n,t/=n,i/=o,r/=o;const a=Math.acos(e*i+t*r);return-t*i+e*r>0?a:-a},e.bq=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]},e.br=Wu,e.bs=function(e,t){const i=E(e,2*Math.PI),r=E(t,2*Math.PI);return Math.min(Math.abs(i-r),Math.abs(i-r+2*Math.PI),Math.abs(i-r-2*Math.PI))},e.bt=function(e){return Math.hypot(e[0],e[1],e[2])},e.bu=function(){const e={},t=me.$version;for(const i in me.$root){const r=me.$root[i];if(r.required){let n=null;n="version"===i?t:"array"===r.type?[]:{},null!=n&&(e[i]=n)}}return e},e.bv=Jn,e.bw=ae,e.bx=function(e){e=e.slice();const t=Object.create(null);for(let i=0;i<e.length;i++)t[e[i].id]=e[i];for(let i=0;i<e.length;i++)"ref"in e[i]&&(e[i]=ge(e[i],t[e[i].ref]));return e},e.by=function(e){if("custom"===e.type)return new Zu(e);switch(e.type){case"background":return new $u(e);case"circle":return new Ls(e);case"fill":return new Ol(e);case"fill-extrusion":return new cc(e);case"heatmap":return new Zs(e);case"hillshade":return new Ws(e);case"line":return new Sc(e);case"raster":return new qu(e);case"symbol":return new Ou(e)}},e.bz=j,e.c=te,e.c0=e=>"circle"===e.type,e.c1=e=>"heatmap"===e.type,e.c2=e=>"line"===e.type,e.c3=e=>"fill"===e.type,e.c4=e=>"fill-extrusion"===e.type,e.c5=e=>"hillshade"===e.type,e.c6=e=>"raster"===e.type,e.c7=e=>"background"===e.type,e.c8=e=>"custom"===e.type,e.c9=k,e.cA=class{constructor(e){this._marks={start:[e.url,"start"].join("#"),end:[e.url,"end"].join("#"),measure:e.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let e=performance.getEntriesByName(this._marks.measure);return 0===e.length&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),e=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),e}},e.cB=function(e,i,r,n,o){return t(this,void 0,void 0,(function*(){if(m())try{return yield H(e,i,r,n,o)}catch(e){}return function(e,t,i,r,n){const o=e.width,a=e.height;W&&K||(W=new OffscreenCanvas(o,a),K=W.getContext("2d",{willReadFrequently:!0})),W.width=o,W.height=a,K.drawImage(e,0,0,o,a);const s=K.getImageData(t,i,r,n);return K.clearRect(0,0,o,a),s.data}(e,i,r,n,o)}))},e.cC=ch,e.cD=i,e.cE=o,e.cF=Jl,e.cG=Nc,e.cH=qr,e.cI=po,e.ca=function(e,t,i){const r=S(t.x-i.x,t.y-i.y),n=S(e.x-i.x,e.y-i.y);var o,a;return Y(Math.atan2(r[0]*n[1]-r[1]*n[0],(o=r)[0]*(a=n)[0]+o[1]*a[1]))},e.cb=z,e.cc=function(e,t){return Q[t]&&(e instanceof MouseEvent||e instanceof WheelEvent)},e.cd=function(e,t){return J[t]&&"touches"in e},e.ce=function(e){return J[e]||Q[e]},e.cf=function(e,t,i){var r=t[0],n=t[1];return e[0]=i[0]*r+i[4]*n+i[12],e[1]=i[1]*r+i[5]*n+i[13],e},e.cg=function(e,t){const{x:i,y:r}=rh.fromLngLat(t);return!(e<0||e>25||r<0||r>=1||i<0||i>=1)},e.ch=function(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},e.ci=class extends Bo{},e.cj=op,e.cl=function(e){return e.message===ee},e.cm=oe,e.cn=function(e,t){ie.REGISTERED_PROTOCOLS[e]=t},e.co=function(e){delete ie.REGISTERED_PROTOCOLS[e]},e.cp=function(e,t){const i={};for(let r=0;r<e.length;r++){const n=t&&t[e[r].id]||ln(e[r]);t&&(t[e[r].id]=n);let o=i[n];o||(o=i[n]=[]),o.push(e[r])}const r=[];for(const e in i)r.push(i[e]);return r},e.cq=Gn,e.cr=uh,e.cs=ph,e.ct=Xc,e.cu=function(t){t.bucket.createArrays(),t.bucket.tilePixelRatio=A/(512*t.bucket.overscaling),t.bucket.compareText={},t.bucket.iconsNeedLinear=!1;const i=t.bucket.layers[0],r=i.layout,n=i._unevaluatedLayout._values,o={layoutIconSize:n["icon-size"].possiblyEvaluate(new mo(t.bucket.zoom+1),t.canonical),layoutTextSize:n["text-size"].possiblyEvaluate(new mo(t.bucket.zoom+1),t.canonical),textMaxSize:n["text-size"].possiblyEvaluate(new mo(18))};if("composite"===t.bucket.textSizeData.kind){const{minZoom:e,maxZoom:i}=t.bucket.textSizeData;o.compositeTextSizes=[n["text-size"].possiblyEvaluate(new mo(e),t.canonical),n["text-size"].possiblyEvaluate(new mo(i),t.canonical)]}if("composite"===t.bucket.iconSizeData.kind){const{minZoom:e,maxZoom:i}=t.bucket.iconSizeData;o.compositeIconSizes=[n["icon-size"].possiblyEvaluate(new mo(e),t.canonical),n["icon-size"].possiblyEvaluate(new mo(i),t.canonical)]}const a=r.get("text-line-height")*Bc,s="viewport"!==r.get("text-rotation-alignment")&&"point"!==r.get("symbol-placement"),l=r.get("text-keep-upright"),c=r.get("text-size");for(const n of t.bucket.features){const u=r.get("text-font").evaluate(n,{},t.canonical).join(","),h=c.evaluate(n,{},t.canonical),p=o.layoutTextSize.evaluate(n,{},t.canonical),d=o.layoutIconSize.evaluate(n,{},t.canonical),m={horizontal:{},vertical:void 0},f=n.text;let g,y=[0,0];if(f){const o=f.toString(),c=r.get("text-letter-spacing").evaluate(n,{},t.canonical)*Bc,d=to(o)?c:0,g=r.get("text-anchor").evaluate(n,{},t.canonical),_=Nh(i,n,t.canonical);if(!_){const e=r.get("text-radial-offset").evaluate(n,{},t.canonical);y=e?jh(g,[e*Bc,Oh]):r.get("text-offset").evaluate(n,{},t.canonical).map((e=>e*Bc))}let v=s?"center":r.get("text-justify").evaluate(n,{},t.canonical);const x="point"===r.get("symbol-placement")?r.get("text-max-width").evaluate(n,{},t.canonical)*Bc:1/0,b=()=>{t.bucket.allowVerticalPlacement&&eo(o)&&(m.vertical=tu(f,t.glyphMap,t.glyphPositions,t.imagePositions,u,x,a,g,"left",d,y,e.ah.vertical,!0,p,h))};if(!s&&_){const i=new Set;if("auto"===v)for(let e=0;e<_.values.length;e+=2)i.add($h(_.values[e]));else i.add(v);let r=!1;for(const n of i)if(!m.horizontal[n])if(r)m.horizontal[n]=m.horizontal[0];else{const i=tu(f,t.glyphMap,t.glyphPositions,t.imagePositions,u,x,a,"center",n,d,y,e.ah.horizontal,!1,p,h);i&&(m.horizontal[n]=i,r=1===i.positionedLines.length)}b()}else{"auto"===v&&(v=$h(g));const i=tu(f,t.glyphMap,t.glyphPositions,t.imagePositions,u,x,a,g,v,d,y,e.ah.horizontal,!1,p,h);i&&(m.horizontal[v]=i),b(),eo(o)&&s&&l&&(m.vertical=tu(f,t.glyphMap,t.glyphPositions,t.imagePositions,u,x,a,g,v,d,y,e.ah.vertical,!1,p,h))}}let _=!1;if(n.icon&&n.icon.name){const e=t.imageMap[n.icon.name];e&&(g=_u(t.imagePositions[n.icon.name],r.get("icon-offset").evaluate(n,{},t.canonical),r.get("icon-anchor").evaluate(n,{},t.canonical)),_=!!e.sdf,void 0===t.bucket.sdfIcons?t.bucket.sdfIcons=_:t.bucket.sdfIcons!==_&&$("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(e.pixelRatio!==t.bucket.pixelRatio||0!==r.get("icon-rotate").constantOr(1))&&(t.bucket.iconsNeedLinear=!0))}const v=qh(m.horizontal)||m.vertical;t.bucket.iconsInText=!!v&&v.iconsInText,(v||g)&&Vh(t.bucket,n,m,g,t.imageMap,o,p,d,y,_,t.canonical,t.subdivisionGranularity)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()},e.cv=vc,e.cw=Dl,e.cx=rc,e.cy=Ql,e.cz=$c,e.d=le,e.e=F,e.f=e=>t(void 0,void 0,void 0,(function*(){if(0===e.byteLength)return createImageBitmap(new ImageData(1,1));const t=new Blob([new Uint8Array(e)],{type:"image/png"});try{return createImageBitmap(t)}catch(e){throw 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.`)}})),e.g=re,e.h=e=>new Promise(((t,i)=>{const r=new Image;r.onload=()=>{t(r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame((()=>{r.src=G}))},r.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 n=new Blob([new Uint8Array(e)],{type:"image/png"});r.src=e.byteLength?URL.createObjectURL(n):G})),e.i=U,e.j=(e,t)=>se(F(e,{type:"json"}),t),e.k=pe,e.l=he,e.m=se,e.n=(e,t)=>se(F(e,{type:"arrayBuffer"}),t),e.o=function(e){return new $c(e).readFields(Uc,[])},e.p=Hc,e.q=$s,e.r=Eo,e.s=X,e.t=jn,e.u=Qn,e.v=me,e.w=$,e.x=Un,e.y=On,e.z=function([e,t,i]){return t+=90,t*=Math.PI/180,i*=Math.PI/180,{x:e*Math.cos(t)*Math.sin(i),y:e*Math.sin(t)*Math.sin(i),z:e*Math.cos(i)}}})),i("worker",["./shared"],(function(e){class t{constructor(e){this.keyCache={},e&&this.replace(e)}replace(e){this._layerConfigs={},this._layers={},this.update(e,[])}update(t,i){for(const i of t){this._layerConfigs[i.id]=i;const t=this._layers[i.id]=e.by(i);t._featureFilter=e.a7(t.filter),this.keyCache[i.id]&&delete this.keyCache[i.id]}for(const e of i)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];this.familiesBySource={};const r=e.cp(Object.values(this._layerConfigs),this.keyCache);for(const e of r){const t=e.map((e=>this._layers[e.id])),i=t[0];if("none"===i.visibility)continue;const r=i.source||"";let n=this.familiesBySource[r];n||(n=this.familiesBySource[r]={});const o=i.sourceLayer||"_geojsonTileLayer";let a=n[o];a||(a=n[o]=[]),a.push(t)}}}class i{constructor(t){const i={},r=[];for(const e in t){const n=t[e],o=i[e]={};for(const e in n){const t=n[+e];if(!t||0===t.bitmap.width||0===t.bitmap.height)continue;const i={x:0,y:0,w:t.bitmap.width+2,h:t.bitmap.height+2};r.push(i),o[e]={rect:i,metrics:t.metrics}}}const{w:n,h:o}=e.p(r),a=new e.q({width:n||1,height:o||1});for(const r in t){const n=t[r];for(const t in n){const o=n[+t];if(!o||0===o.bitmap.width||0===o.bitmap.height)continue;const s=i[r][t].rect;e.q.copy(o.bitmap,a,{x:0,y:0},{x:s.x+1,y:s.y+1},o.bitmap)}}this.image=a,this.positions=i}}e.cq("GlyphAtlas",i);class r{constructor(t){this.tileID=new e.Y(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.uid=t.uid,this.zoom=t.zoom,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.returnDependencies=!!t.returnDependencies,this.promoteId=t.promoteId,this.inFlightDependencies=[]}parse(t,r,o,a,s){return e._(this,void 0,void 0,(function*(){this.status="parsing",this.data=t,this.collisionBoxArray=new e.a5;const l=new e.cr(Object.keys(t.layers).sort()),c=new e.cs(this.tileID,this.promoteId);c.bucketLayerIDs=[];const u={},h={featureIndex:c,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:o,subdivisionGranularity:s},p=r.familiesBySource[this.source];for(const i in p){const r=t.layers[i];if(!r)continue;1===r.version&&e.w(`Vector tile source "${this.source}" layer "${i}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const a=l.encode(i),s=[];for(let e=0;e<r.length;e++){const t=r.feature(e),n=c.getId(t,i);s.push({feature:t,id:n,index:e,sourceLayerIndex:a})}for(const t of p[i]){const i=t[0];i.source!==this.source&&e.w(`layer.source = ${i.source} does not equal this.source = ${this.source}`),i.minzoom&&this.zoom<Math.floor(i.minzoom)||i.maxzoom&&this.zoom>=i.maxzoom||"none"!==i.visibility&&(n(t,this.zoom,o),(u[i.id]=i.createBucket({index:c.bucketLayerIDs.length,layers:t,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:a,sourceID:this.source})).populate(s,h,this.tileID.canonical),c.bucketLayerIDs.push(t.map((e=>e.id))))}}const d=e.bD(h.glyphDependencies,(e=>Object.keys(e).map(Number)));this.inFlightDependencies.forEach((e=>null==e?void 0:e.abort())),this.inFlightDependencies=[];let m=Promise.resolve({});if(Object.keys(d).length){const e=new AbortController;this.inFlightDependencies.push(e),m=a.sendAsync({type:"GG",data:{stacks:d,source:this.source,tileID:this.tileID,type:"glyphs"}},e)}const f=Object.keys(h.iconDependencies);let g=Promise.resolve({});if(f.length){const e=new AbortController;this.inFlightDependencies.push(e),g=a.sendAsync({type:"GI",data:{icons:f,source:this.source,tileID:this.tileID,type:"icons"}},e)}const y=Object.keys(h.patternDependencies);let _=Promise.resolve({});if(y.length){const e=new AbortController;this.inFlightDependencies.push(e),_=a.sendAsync({type:"GI",data:{icons:y,source:this.source,tileID:this.tileID,type:"patterns"}},e)}const[v,x,b]=yield Promise.all([m,g,_]),w=new i(v),C=new e.ct(x,b);for(const t in u){const i=u[t];i instanceof e.a6?(n(i.layers,this.zoom,o),e.cu({bucket:i,glyphMap:v,glyphPositions:w.positions,imageMap:x,imagePositions:C.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:h.subdivisionGranularity})):i.hasPattern&&(i instanceof e.cv||i instanceof e.cw||i instanceof e.cx)&&(n(i.layers,this.zoom,o),i.addFeatures(h,this.tileID.canonical,C.patternPositions))}return this.status="done",{buckets:Object.values(u).filter((e=>!e.isEmpty())),featureIndex:c,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:w.image,imageAtlas:C,glyphMap:this.returnDependencies?v:null,iconMap:this.returnDependencies?x:null,glyphPositions:this.returnDependencies?w.positions:null}}))}}function n(t,i,r){const n=new e.C(i);for(const e of t)e.recalculate(n,r)}class o{constructor(e,t,i){this.actor=e,this.layerIndex=t,this.availableImages=i,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(t,i){return e._(this,void 0,void 0,(function*(){const r=yield e.n(t.request,i);try{return{vectorTile:new e.cy.VectorTile(new e.cz(r.data)),rawData:r.data,cacheControl:r.cacheControl,expires:r.expires}}catch(e){const i=new Uint8Array(r.data);let n=`Unable to parse the tile at ${t.request.url}, `;throw n+=31===i[0]&&139===i[1]?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${e.message}`,new Error(n)}}))}loadTile(t){return e._(this,void 0,void 0,(function*(){const i=t.uid,n=!!(t&&t.request&&t.request.collectResourceTiming)&&new e.cA(t.request),o=new r(t);this.loading[i]=o;const a=new AbortController;o.abort=a;try{const r=yield this.loadVectorTile(t,a);if(delete this.loading[i],!r)return null;const s=r.rawData,l={};r.expires&&(l.expires=r.expires),r.cacheControl&&(l.cacheControl=r.cacheControl);const c={};if(n){const e=n.finish();e&&(c.resourceTiming=JSON.parse(JSON.stringify(e)))}o.vectorTile=r.vectorTile;const u=o.parse(r.vectorTile,this.layerIndex,this.availableImages,this.actor,t.subdivisionGranularity);this.loaded[i]=o,this.fetching[i]={rawTileData:s,cacheControl:l,resourceTiming:c};try{const t=yield u;return e.e({rawTileData:s.slice(0)},t,l,c)}finally{delete this.fetching[i]}}catch(e){throw delete this.loading[i],o.status="done",this.loaded[i]=o,e}}))}reloadTile(t){return e._(this,void 0,void 0,(function*(){const i=t.uid;if(!this.loaded||!this.loaded[i])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const r=this.loaded[i];if(r.showCollisionBoxes=t.showCollisionBoxes,"parsing"===r.status){const n=yield r.parse(r.vectorTile,this.layerIndex,this.availableImages,this.actor,t.subdivisionGranularity);let o;if(this.fetching[i]){const{rawTileData:t,cacheControl:r,resourceTiming:a}=this.fetching[i];delete this.fetching[i],o=e.e({rawTileData:t.slice(0)},n,r,a)}else o=n;return o}if("done"===r.status&&r.vectorTile)return r.parse(r.vectorTile,this.layerIndex,this.availableImages,this.actor,t.subdivisionGranularity)}))}abortTile(t){return e._(this,void 0,void 0,(function*(){const e=this.loading,i=t.uid;e&&e[i]&&e[i].abort&&(e[i].abort.abort(),delete e[i])}))}removeTile(t){return e._(this,void 0,void 0,(function*(){this.loaded&&this.loaded[t.uid]&&delete this.loaded[t.uid]}))}}class a{constructor(){this.loaded={}}loadTile(t){return e._(this,void 0,void 0,(function*(){const{uid:i,encoding:r,rawImageData:n,redFactor:o,greenFactor:a,blueFactor:s,baseShift:l}=t,c=n.width+2,u=n.height+2,h=e.b(n)?new e.R({width:c,height:u},yield e.cB(n,-1,-1,c,u)):n,p=new e.cC(i,h,r,o,a,s,l);return this.loaded=this.loaded||{},this.loaded[i]=p,p}))}removeTile(e){const t=this.loaded,i=e.uid;t&&t[i]&&delete t[i]}}var s,l,c=function(){if(l)return s;function e(e,i){if(0!==e.length){t(e[0],i);for(var r=1;r<e.length;r++)t(e[r],!i)}}function t(e,t){for(var i=0,r=0,n=0,o=e.length,a=o-1;n<o;a=n++){var s=(e[n][0]-e[a][0])*(e[a][1]+e[n][1]),l=i+s;r+=Math.abs(i)>=Math.abs(s)?i-l+s:s-l+i,i=l}i+r>=0!=!!t&&e.reverse()}return l=1,s=function t(i,r){var n,o=i&&i.type;if("FeatureCollection"===o)for(n=0;n<i.features.length;n++)t(i.features[n],r);else if("GeometryCollection"===o)for(n=0;n<i.geometries.length;n++)t(i.geometries[n],r);else if("Feature"===o)t(i.geometry,r);else if("Polygon"===o)e(i.coordinates,r);else if("MultiPolygon"===o)for(n=0;n<i.coordinates.length;n++)e(i.coordinates[n],r);return i}}(),u=e.cD(c);const h=e.cy.VectorTileFeature.prototype.toGeoJSON;class p{constructor(t){this._feature=t,this.extent=e.Z,this.type=t.type,this.properties=t.tags,"id"in t&&!isNaN(t.id)&&(this.id=parseInt(t.id,10))}loadGeometry(){if(1===this._feature.type){const t=[];for(const i of this._feature.geometry)t.push([new e.P(i[0],i[1])]);return t}{const t=[];for(const i of this._feature.geometry){const r=[];for(const t of i)r.push(new e.P(t[0],t[1]));t.push(r)}return t}}toGeoJSON(e,t,i){return h.call(this,e,t,i)}}class d{constructor(t){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=e.Z,this.length=t.length,this._features=t}feature(e){return new p(this._features[e])}}var m,f,g,y={exports:{}},_=function(){if(g)return y.exports;g=1;var t=e.cG(),i=function(){if(f)return m;f=1;var t=e.cE(),i=e.cF().VectorTileFeature;function r(e,t){this.options=t||{},this.features=e,this.length=e.length}function n(e,t){this.id="number"==typeof e.id?e.id:void 0,this.type=e.type,this.rawGeometry=1===e.type?[e.geometry]:e.geometry,this.properties=e.tags,this.extent=t||4096}return m=r,r.prototype.feature=function(e){return new n(this.features[e],this.options.extent)},n.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var i=0;i<e.length;i++){for(var r=e[i],n=[],o=0;o<r.length;o++)n.push(new t(r[o][0],r[o][1]));this.geometry.push(n)}return this.geometry},n.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var e=this.geometry,t=1/0,i=-1/0,r=1/0,n=-1/0,o=0;o<e.length;o++)for(var a=e[o],s=0;s<a.length;s++){var l=a[s];t=Math.min(t,l.x),i=Math.max(i,l.x),r=Math.min(r,l.y),n=Math.max(n,l.y)}return[t,r,i,n]},n.prototype.toGeoJSON=i.prototype.toGeoJSON,m}();function r(e){var i=new t;return function(e,t){for(var i in e.layers)t.writeMessage(3,n,e.layers[i])}(e,i),i.finish()}function n(e,t){var i;t.writeVarintField(15,e.version||1),t.writeStringField(1,e.name||""),t.writeVarintField(5,e.extent||4096);var r={keys:[],values:[],keycache:{},valuecache:{}};for(i=0;i<e.length;i++)r.feature=e.feature(i),t.writeMessage(2,o,r);var n=r.keys;for(i=0;i<n.length;i++)t.writeStringField(3,n[i]);var a=r.values;for(i=0;i<a.length;i++)t.writeMessage(4,u,a[i])}function o(e,t){var i=e.feature;void 0!==i.id&&t.writeVarintField(1,i.id),t.writeMessage(2,a,e),t.writeVarintField(3,i.type),t.writeMessage(4,c,i)}function a(e,t){var i=e.feature,r=e.keys,n=e.values,o=e.keycache,a=e.valuecache;for(var s in i.properties){var l=i.properties[s],c=o[s];if(null!==l){void 0===c&&(r.push(s),o[s]=c=r.length-1),t.writeVarint(c);var u=typeof l;"string"!==u&&"boolean"!==u&&"number"!==u&&(l=JSON.stringify(l));var h=u+":"+l,p=a[h];void 0===p&&(n.push(l),a[h]=p=n.length-1),t.writeVarint(p)}}}function s(e,t){return(t<<3)+(7&e)}function l(e){return e<<1^e>>31}function c(e,t){for(var i=e.loadGeometry(),r=e.type,n=0,o=0,a=i.length,c=0;c<a;c++){var u=i[c],h=1;1===r&&(h=u.length),t.writeVarint(s(1,h));for(var p=3===r?u.length-1:u.length,d=0;d<p;d++){1===d&&1!==r&&t.writeVarint(s(2,p-1));var m=u[d].x-n,f=u[d].y-o;t.writeVarint(l(m)),t.writeVarint(l(f)),n+=m,o+=f}3===r&&t.writeVarint(s(7,1))}}function u(e,t){var i=typeof e;"string"===i?t.writeStringField(1,e):"boolean"===i?t.writeBooleanField(7,e):"number"===i&&(e%1!=0?t.writeDoubleField(3,e):e<0?t.writeSVarintField(6,e):t.writeVarintField(5,e))}return y.exports=r,y.exports.fromVectorTileJs=r,y.exports.fromGeojsonVt=function(e,t){t=t||{};var n={};for(var o in e)n[o]=new i(e[o].features,t),n[o].name=o,n[o].version=t.version,n[o].extent=t.extent;return r({layers:n})},y.exports.GeoJSONWrapper=i,y.exports}(),v=e.cD(_);const x={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},b=Math.fround||(w=new Float32Array(1),e=>(w[0]=+e,w[0]));var w;const C=3,T=5,S=6;class A{constructor(e){this.options=Object.assign(Object.create(x),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:r}=this.options;t&&console.time("total time");const n=`prepare ${e.length} points`;t&&console.time(n),this.points=e;const o=[];for(let t=0;t<e.length;t++){const i=e[t];if(!i.geometry)continue;const[r,n]=i.geometry.coordinates,a=b(P(r)),s=b(I(n));o.push(a,s,1/0,t,-1,1),this.options.reduce&&o.push(0)}let a=this.trees[r+1]=this._createTree(o);t&&console.timeEnd(n);for(let e=r;e>=i;e--)Date.now(),a=this.trees[e]=this._createTree(this._cluster(a,e));return t&&console.timeEnd("total time"),this}getClusters(e,t){let i=((e[0]+180)%360+360)%360-180;const r=Math.max(-90,Math.min(90,e[1]));let n=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,n=180;else if(i>n){const e=this.getClusters([i,r,180,o],t),a=this.getClusters([-180,r,n,o],t);return e.concat(a)}const a=this.trees[this._limitZoom(t)],s=a.range(P(i),I(o),P(n),I(r)),l=a.data,c=[];for(const e of s){const t=this.stride*e;c.push(l[t+T]>1?M(l,t,this.clusterProps):this.points[l[t+C]])}return c}getChildren(e){const t=this._getOriginId(e),i=this._getOriginZoom(e),r="No cluster with the specified id.",n=this.trees[i];if(!n)throw new Error(r);const o=n.data;if(t*this.stride>=o.length)throw new Error(r);const a=this.options.radius/(this.options.extent*Math.pow(2,i-1)),s=n.within(o[t*this.stride],o[t*this.stride+1],a),l=[];for(const t of s){const i=t*this.stride;o[i+4]===e&&l.push(o[i+T]>1?M(o,i,this.clusterProps):this.points[o[i+C]])}if(0===l.length)throw new Error(r);return l}getLeaves(e,t,i){const r=[];return this._appendLeaves(r,e,t=t||10,i=i||0,0),r}getTile(e,t,i){const r=this.trees[this._limitZoom(e)],n=Math.pow(2,e),{extent:o,radius:a}=this.options,s=a/o,l=(i-s)/n,c=(i+1+s)/n,u={features:[]};return this._addTileFeatures(r.range((t-s)/n,l,(t+1+s)/n,c),r.data,t,i,n,u),0===t&&this._addTileFeatures(r.range(1-s/n,l,1,c),r.data,n,i,n,u),t===n-1&&this._addTileFeatures(r.range(0,l,s/n,c),r.data,-1,i,n,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,r,n){const o=this.getChildren(t);for(const t of o){const o=t.properties;if(o&&o.cluster?n+o.point_count<=r?n+=o.point_count:n=this._appendLeaves(e,o.cluster_id,i,r,n):n<r?n++:e.push(t),e.length===i)break}return n}_createTree(t){const i=new e.aC(t.length/this.stride|0,this.options.nodeSize,Float32Array);for(let e=0;e<t.length;e+=this.stride)i.add(t[e],t[e+1]);return i.finish(),i.data=t,i}_addTileFeatures(e,t,i,r,n,o){for(const a of e){const e=a*this.stride,s=t[e+T]>1;let l,c,u;if(s)l=E(t,e,this.clusterProps),c=t[e],u=t[e+1];else{const i=this.points[t[e+C]];l=i.properties;const[r,n]=i.geometry.coordinates;c=P(r),u=I(n)}const h={type:1,geometry:[[Math.round(this.options.extent*(c*n-i)),Math.round(this.options.extent*(u*n-r))]],tags:l};let p;p=s||this.options.generateId?t[e+C]:this.points[t[e+C]].id,void 0!==p&&(h.id=p),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:r,reduce:n,minPoints:o}=this.options,a=i/(r*Math.pow(2,t)),s=e.data,l=[],c=this.stride;for(let i=0;i<s.length;i+=c){if(s[i+2]<=t)continue;s[i+2]=t;const r=s[i],u=s[i+1],h=e.within(s[i],s[i+1],a),p=s[i+T];let d=p;for(const e of h){const i=e*c;s[i+2]>t&&(d+=s[i+T])}if(d>p&&d>=o){let e,o=r*p,a=u*p,m=-1;const f=(i/c<<5)+(t+1)+this.points.length;for(const r of h){const l=r*c;if(s[l+2]<=t)continue;s[l+2]=t;const u=s[l+T];o+=s[l]*u,a+=s[l+1]*u,s[l+4]=f,n&&(e||(e=this._map(s,i,!0),m=this.clusterProps.length,this.clusterProps.push(e)),n(e,this._map(s,l)))}s[i+4]=f,l.push(o/d,a/d,1/0,f,-1,d),n&&l.push(m)}else{for(let e=0;e<c;e++)l.push(s[i+e]);if(d>1)for(const e of h){const i=e*c;if(!(s[i+2]<=t)){s[i+2]=t;for(let e=0;e<c;e++)l.push(s[i+e])}}}}return l}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,t,i){if(e[t+T]>1){const r=this.clusterProps[e[t+S]];return i?Object.assign({},r):r}const r=this.points[e[t+C]].properties,n=this.options.map(r);return i&&n===r?Object.assign({},n):n}}function M(e,t,i){return{type:"Feature",id:e[t+C],properties:E(e,t,i),geometry:{type:"Point",coordinates:[(r=e[t],360*(r-.5)),k(e[t+1])]}};var r}function E(e,t,i){const r=e[t+T],n=r>=1e4?`${Math.round(r/1e3)}k`:r>=1e3?Math.round(r/100)/10+"k":r,o=e[t+S],a=-1===o?{}:Object.assign({},i[o]);return Object.assign(a,{cluster:!0,cluster_id:e[t+C],point_count:r,point_count_abbreviated:n})}function P(e){return e/360+.5}function I(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 k(e){const t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function z(e,t,i,r){let n=r;const o=t+(i-t>>1);let a,s=i-t;const l=e[t],c=e[t+1],u=e[i],h=e[i+1];for(let r=t+3;r<i;r+=3){const t=L(e[r],e[r+1],l,c,u,h);if(t>n)a=r,n=t;else if(t===n){const e=Math.abs(r-o);e<s&&(a=r,s=e)}}n>r&&(a-t>3&&z(e,t,a,r),e[a+2]=n,i-a>3&&z(e,a,i,r))}function L(e,t,i,r,n,o){let a=n-i,s=o-r;if(0!==a||0!==s){const l=((e-i)*a+(t-r)*s)/(a*a+s*s);l>1?(i=n,r=o):l>0&&(i+=a*l,r+=s*l)}return a=e-i,s=t-r,a*a+s*s}function D(e,t,i,r){const n={id:null==e?null:e,type:t,geometry:i,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if("Point"===t||"MultiPoint"===t||"LineString"===t)F(n,i);else if("Polygon"===t)F(n,i[0]);else if("MultiLineString"===t)for(const e of i)F(n,e);else if("MultiPolygon"===t)for(const e of i)F(n,e[0]);return n}function F(e,t){for(let i=0;i<t.length;i+=3)e.minX=Math.min(e.minX,t[i]),e.minY=Math.min(e.minY,t[i+1]),e.maxX=Math.max(e.maxX,t[i]),e.maxY=Math.max(e.maxY,t[i+1])}function R(e,t,i,r){if(!t.geometry)return;const n=t.geometry.coordinates;if(n&&0===n.length)return;const o=t.geometry.type,a=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2);let s=[],l=t.id;if(i.promoteId?l=t.properties[i.promoteId]:i.generateId&&(l=r||0),"Point"===o)B(n,s);else if("MultiPoint"===o)for(const e of n)B(e,s);else if("LineString"===o)O(n,s,a,!1);else if("MultiLineString"===o){if(i.lineMetrics){for(const i of n)s=[],O(i,s,a,!1),e.push(D(l,"LineString",s,t.properties));return}j(n,s,a,!1)}else if("Polygon"===o)j(n,s,a,!0);else{if("MultiPolygon"!==o){if("GeometryCollection"===o){for(const n of t.geometry.geometries)R(e,{id:l,geometry:n,properties:t.properties},i,r);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const e of n){const t=[];j(e,t,a,!0),s.push(t)}}e.push(D(l,o,s,t.properties))}function B(e,t){t.push(N(e[0]),$(e[1]),0)}function O(e,t,i,r){let n,o,a=0;for(let i=0;i<e.length;i++){const s=N(e[i][0]),l=$(e[i][1]);t.push(s,l,0),i>0&&(a+=r?(n*l-s*o)/2:Math.sqrt(Math.pow(s-n,2)+Math.pow(l-o,2))),n=s,o=l}const s=t.length-3;t[2]=1,z(t,0,s,i),t[s+2]=1,t.size=Math.abs(a),t.start=0,t.end=t.size}function j(e,t,i,r){for(let n=0;n<e.length;n++){const o=[];O(e[n],o,i,r),t.push(o)}}function N(e){return e/360+.5}function $(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 V(e,t,i,r,n,o,a,s){if(r/=t,o>=(i/=t)&&a<r)return e;if(a<i||o>=r)return null;const l=[];for(const t of e){const e=t.geometry;let o=t.type;const a=0===n?t.minX:t.minY,c=0===n?t.maxX:t.maxY;if(a>=i&&c<r){l.push(t);continue}if(c<i||a>=r)continue;let u=[];if("Point"===o||"MultiPoint"===o)U(e,u,i,r,n);else if("LineString"===o)q(e,u,i,r,n,!1,s.lineMetrics);else if("MultiLineString"===o)G(e,u,i,r,n,!1);else if("Polygon"===o)G(e,u,i,r,n,!0);else if("MultiPolygon"===o)for(const t of e){const e=[];G(t,e,i,r,n,!0),e.length&&u.push(e)}if(u.length){if(s.lineMetrics&&"LineString"===o){for(const e of u)l.push(D(t.id,o,e,t.tags));continue}"LineString"!==o&&"MultiLineString"!==o||(1===u.length?(o="LineString",u=u[0]):o="MultiLineString"),"Point"!==o&&"MultiPoint"!==o||(o=3===u.length?"Point":"MultiPoint"),l.push(D(t.id,o,u,t.tags))}}return l.length?l:null}function U(e,t,i,r,n){for(let o=0;o<e.length;o+=3){const a=e[o+n];a>=i&&a<=r&&H(t,e[o],e[o+1],e[o+2])}}function q(e,t,i,r,n,o,a){let s=Z(e);const l=0===n?W:K;let c,u,h=e.start;for(let p=0;p<e.length-3;p+=3){const d=e[p],m=e[p+1],f=e[p+2],g=e[p+3],y=e[p+4],_=0===n?d:m,v=0===n?g:y;let x=!1;a&&(c=Math.sqrt(Math.pow(d-g,2)+Math.pow(m-y,2))),_<i?v>i&&(u=l(s,d,m,g,y,i),a&&(s.start=h+c*u)):_>r?v<r&&(u=l(s,d,m,g,y,r),a&&(s.start=h+c*u)):H(s,d,m,f),v<i&&_>=i&&(u=l(s,d,m,g,y,i),x=!0),v>r&&_<=r&&(u=l(s,d,m,g,y,r),x=!0),!o&&x&&(a&&(s.end=h+c*u),t.push(s),s=Z(e)),a&&(h+=c)}let p=e.length-3;const d=e[p],m=e[p+1],f=0===n?d:m;f>=i&&f<=r&&H(s,d,m,e[p+2]),p=s.length-3,o&&p>=3&&(s[p]!==s[0]||s[p+1]!==s[1])&&H(s,s[0],s[1],s[2]),s.length&&t.push(s)}function Z(e){const t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function G(e,t,i,r,n,o){for(const a of e)q(a,t,i,r,n,o,!1)}function H(e,t,i,r){e.push(t,i,r)}function W(e,t,i,r,n,o){const a=(o-t)/(r-t);return H(e,o,i+(n-i)*a,1),a}function K(e,t,i,r,n,o){const a=(o-i)/(n-i);return H(e,t+(r-t)*a,o,1),a}function X(e,t){const i=[];for(let r=0;r<e.length;r++){const n=e[r],o=n.type;let a;if("Point"===o||"MultiPoint"===o||"LineString"===o)a=Y(n.geometry,t);else if("MultiLineString"===o||"Polygon"===o){a=[];for(const e of n.geometry)a.push(Y(e,t))}else if("MultiPolygon"===o){a=[];for(const e of n.geometry){const i=[];for(const r of e)i.push(Y(r,t));a.push(i)}}i.push(D(n.id,o,a,n.tags))}return i}function Y(e,t){const i=[];i.size=e.size,void 0!==e.start&&(i.start=e.start,i.end=e.end);for(let r=0;r<e.length;r+=3)i.push(e[r]+t,e[r+1],e[r+2]);return i}function J(e,t){if(e.transformed)return e;const i=1<<e.z,r=e.x,n=e.y;for(const o of e.features){const e=o.geometry,a=o.type;if(o.geometry=[],1===a)for(let a=0;a<e.length;a+=2)o.geometry.push(Q(e[a],e[a+1],t,i,r,n));else for(let a=0;a<e.length;a++){const s=[];for(let o=0;o<e[a].length;o+=2)s.push(Q(e[a][o],e[a][o+1],t,i,r,n));o.geometry.push(s)}}return e.transformed=!0,e}function Q(e,t,i,r,n,o){return[Math.round(i*(e*r-n)),Math.round(i*(t*r-o))]}function ee(e,t,i,r,n){const o=t===n.maxZoom?0:n.tolerance/((1<<t)*n.extent),a={features:[],numPoints:0,numSimplified:0,numFeatures:e.length,source:null,x:i,y:r,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const t of e)te(a,t,o,n);return a}function te(e,t,i,r){const n=t.geometry,o=t.type,a=[];if(e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),"Point"===o||"MultiPoint"===o)for(let t=0;t<n.length;t+=3)a.push(n[t],n[t+1]),e.numPoints++,e.numSimplified++;else if("LineString"===o)ie(a,n,e,i,!1,!1);else if("MultiLineString"===o||"Polygon"===o)for(let t=0;t<n.length;t++)ie(a,n[t],e,i,"Polygon"===o,0===t);else if("MultiPolygon"===o)for(let t=0;t<n.length;t++){const r=n[t];for(let t=0;t<r.length;t++)ie(a,r[t],e,i,!0,0===t)}if(a.length){let i=t.tags||null;if("LineString"===o&&r.lineMetrics){i={};for(const e in t.tags)i[e]=t.tags[e];i.mapbox_clip_start=n.start/n.size,i.mapbox_clip_end=n.end/n.size}const s={geometry:a,type:"Polygon"===o||"MultiPolygon"===o?3:"LineString"===o||"MultiLineString"===o?2:1,tags:i};null!==t.id&&(s.id=t.id),e.features.push(s)}}function ie(e,t,i,r,n,o){const a=r*r;if(r>0&&t.size<(n?a:r))return void(i.numPoints+=t.length/3);const s=[];for(let e=0;e<t.length;e+=3)(0===r||t[e+2]>a)&&(i.numSimplified++,s.push(t[e],t[e+1])),i.numPoints++;n&&function(e,t){let i=0;for(let t=0,r=e.length,n=r-2;t<r;n=t,t+=2)i+=(e[t]-e[n])*(e[t+1]+e[n+1]);if(i>0===t)for(let t=0,i=e.length;t<i/2;t+=2){const r=e[t],n=e[t+1];e[t]=e[i-2-t],e[t+1]=e[i-1-t],e[i-2-t]=r,e[i-1-t]=n}}(s,o),e.push(s)}const re={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class ne{constructor(e,t){const i=(t=this.options=function(e,t){for(const i in t)e[i]=t[i];return e}(Object.create(re),t)).debug;if(i&&console.time("preprocess data"),t.maxZoom<0||t.maxZoom>24)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.");let r=function(e,t){const i=[];if("FeatureCollection"===e.type)for(let r=0;r<e.features.length;r++)R(i,e.features[r],t,r);else R(i,"Feature"===e.type?e:{geometry:e},t);return i}(e,t);this.tiles={},this.tileCoords=[],i&&(console.timeEnd("preprocess data"),console.time("generate tiles"),this.stats={},this.total=0),r=function(e,t){const i=t.buffer/t.extent;let r=e;const n=V(e,1,-1-i,i,0,-1,2,t),o=V(e,1,1-i,2+i,0,-1,2,t);return(n||o)&&(r=V(e,1,-i,1+i,0,-1,2,t)||[],n&&(r=X(n,1).concat(r)),o&&(r=r.concat(X(o,-1)))),r}(r,t),r.length&&this.splitTile(r,0,0,0),i&&(r.length,console.timeEnd("generate tiles"))}splitTile(e,t,i,r,n,o,a){const s=[e,t,i,r],l=this.options,c=l.debug;for(;s.length;){r=s.pop(),i=s.pop(),t=s.pop(),e=s.pop();const u=1<<t,h=oe(t,i,r);let p=this.tiles[h];if(!p&&(c>1&&console.time("creation"),p=this.tiles[h]=ee(e,t,i,r,l),this.tileCoords.push({z:t,x:i,y:r}),c)){c>1&&console.timeEnd("creation");const e=`z${t}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}if(p.source=e,null==n){if(t===l.indexMaxZoom||p.numPoints<=l.indexMaxPoints)continue}else{if(t===l.maxZoom||t===n)continue;if(null!=n){const e=n-t;if(i!==o>>e||r!==a>>e)continue}}if(p.source=null,0===e.length)continue;c>1&&console.time("clipping");const d=.5*l.buffer/l.extent,m=.5-d,f=.5+d,g=1+d;let y=null,_=null,v=null,x=null,b=V(e,u,i-d,i+f,0,p.minX,p.maxX,l),w=V(e,u,i+m,i+g,0,p.minX,p.maxX,l);e=null,b&&(y=V(b,u,r-d,r+f,1,p.minY,p.maxY,l),_=V(b,u,r+m,r+g,1,p.minY,p.maxY,l),b=null),w&&(v=V(w,u,r-d,r+f,1,p.minY,p.maxY,l),x=V(w,u,r+m,r+g,1,p.minY,p.maxY,l),w=null),c>1&&console.timeEnd("clipping"),s.push(y||[],t+1,2*i,2*r),s.push(_||[],t+1,2*i,2*r+1),s.push(v||[],t+1,2*i+1,2*r),s.push(x||[],t+1,2*i+1,2*r+1)}}getTile(e,t,i){e=+e,t=+t,i=+i;const r=this.options,{extent:n,debug:o}=r;if(e<0||e>24)return null;const a=1<<e,s=oe(e,t=t+a&a-1,i);if(this.tiles[s])return J(this.tiles[s],n);let l,c=e,u=t,h=i;for(;!l&&c>0;)c--,u>>=1,h>>=1,l=this.tiles[oe(c,u,h)];return l&&l.source?(o>1&&console.time("drilling down"),this.splitTile(l.source,c,u,h,e,t,i),o>1&&console.timeEnd("drilling down"),this.tiles[s]?J(this.tiles[s],n):null):null}}function oe(e,t,i){return 32*((1<<e)*i+t)+e}function ae(e,t){return t?e.properties[t]:e.id}function se(e,t){if(null==e)return!0;if("Feature"===e.type)return null!=ae(e,t);if("FeatureCollection"===e.type){const i=new Set;for(const r of e.features){const e=ae(r,t);if(null==e)return!1;if(i.has(e))return!1;i.add(e)}return!0}return!1}function le(e,t){const i=new Map;if(null==e);else if("Feature"===e.type)i.set(ae(e,t),e);else for(const r of e.features)i.set(ae(r,t),r);return i}class ce extends o{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(t,i){return e._(this,void 0,void 0,(function*(){const e=t.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const i=this._geoJSONIndex.getTile(e.z,e.x,e.y);if(!i)return null;const r=new d(i.features);let n=v(r);return 0===n.byteOffset&&n.byteLength===n.buffer.byteLength||(n=new Uint8Array(n)),{vectorTile:r,rawData:n.buffer}}))}loadData(t){return e._(this,void 0,void 0,(function*(){var i;null===(i=this._pendingRequest)||void 0===i||i.abort();const r=!!(t&&t.request&&t.request.collectResourceTiming)&&new e.cA(t.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(t,this._pendingRequest),this._geoJSONIndex=t.cluster?new A(function({superclusterOptions:t,clusterProperties:i}){if(!i||!t)return t;const r={},n={},o={accumulated:null,zoom:0},a={properties:null},s=Object.keys(i);for(const t of s){const[o,a]=i[t],s=e.cH(a),l=e.cH("string"==typeof o?[o,["accumulated"],["get",t]]:o);r[t]=s.value,n[t]=l.value}return t.map=e=>{a.properties=e;const t={};for(const e of s)t[e]=r[e].evaluate(o,a);return t},t.reduce=(e,t)=>{a.properties=t;for(const t of s)o.accumulated=e[t],e[t]=n[t].evaluate(o,a)},t}(t)).load((yield this._pendingData).features):(n=yield this._pendingData,new ne(n,t.geojsonVtOptions)),this.loaded={};const i={};if(r){const e=r.finish();e&&(i.resourceTiming={},i.resourceTiming[t.source]=JSON.parse(JSON.stringify(e)))}return i}catch(t){if(delete this._pendingRequest,e.cl(t))return{abandoned:!0};throw t}var n}))}getData(){return e._(this,void 0,void 0,(function*(){return this._pendingData}))}reloadTile(e){const t=this.loaded;return t&&t[e.uid]?super.reloadTile(e):this.loadTile(e)}loadAndProcessGeoJSON(t,i){return e._(this,void 0,void 0,(function*(){let r=yield this.loadGeoJSON(t,i);if(delete this._pendingRequest,"object"!=typeof r)throw new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`);if(u(r,!0),t.filter){const i=e.cH(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=r.features.filter((e=>i.value.evaluate({zoom:0},e)));r={type:"FeatureCollection",features:n}}return r}))}loadGeoJSON(t,i){return e._(this,void 0,void 0,(function*(){const{promoteId:r}=t;if(t.request){const n=yield e.j(t.request,i);return this._dataUpdateable=se(n.data,r)?le(n.data,r):void 0,n.data}if("string"==typeof t.data)try{const e=JSON.parse(t.data);return this._dataUpdateable=se(e,r)?le(e,r):void 0,e}catch(e){throw new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`)}if(!t.dataDiff)throw new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${t.source}`);return function(e,t,i){var r,n,o,a;if(t.removeAll&&e.clear(),t.remove)for(const i of t.remove)e.delete(i);if(t.add)for(const r of t.add){const t=ae(r,i);null!=t&&e.set(t,r)}if(t.update)for(const i of t.update){let t=e.get(i.id);if(null==t)continue;const s=!i.removeAllProperties&&((null===(r=i.removeProperties)||void 0===r?void 0:r.length)>0||(null===(n=i.addOrUpdateProperties)||void 0===n?void 0:n.length)>0);if((i.newGeometry||i.removeAllProperties||s)&&(t=Object.assign({},t),e.set(i.id,t),s&&(t.properties=Object.assign({},t.properties))),i.newGeometry&&(t.geometry=i.newGeometry),i.removeAllProperties)t.properties={};else if((null===(o=i.removeProperties)||void 0===o?void 0:o.length)>0)for(const e of i.removeProperties)Object.prototype.hasOwnProperty.call(t.properties,e)&&delete t.properties[e];if((null===(a=i.addOrUpdateProperties)||void 0===a?void 0:a.length)>0)for(const{key:e,value:r}of i.addOrUpdateProperties)t.properties[e]=r}}(this._dataUpdateable,t.dataDiff,r),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}}))}removeSource(t){return e._(this,void 0,void 0,(function*(){this._pendingRequest&&this._pendingRequest.abort()}))}getClusterExpansionZoom(e){return this._geoJSONIndex.getClusterExpansionZoom(e.clusterId)}getClusterChildren(e){return this._geoJSONIndex.getChildren(e.clusterId)}getClusterLeaves(e){return this._geoJSONIndex.getLeaves(e.clusterId,e.limit,e.offset)}}class ue{constructor(t){this.self=t,this.actor=new e.H(t),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(e,t)=>{if(this.externalWorkerSourceTypes[e])throw new Error(`Worker source with name "${e}" already registered.`);this.externalWorkerSourceTypes[e]=t},this.self.addProtocol=e.cn,this.self.removeProtocol=e.co,this.self.registerRTLTextPlugin=t=>{e.cI.setMethods(t)},this.actor.registerMessageHandler("LDT",((e,t)=>this._getDEMWorkerSource(e,t.source).loadTile(t))),this.actor.registerMessageHandler("RDT",((t,i)=>e._(this,void 0,void 0,(function*(){this._getDEMWorkerSource(t,i.source).removeTile(i)})))),this.actor.registerMessageHandler("GCEZ",((t,i)=>e._(this,void 0,void 0,(function*(){return this._getWorkerSource(t,i.type,i.source).getClusterExpansionZoom(i)})))),this.actor.registerMessageHandler("GCC",((t,i)=>e._(this,void 0,void 0,(function*(){return this._getWorkerSource(t,i.type,i.source).getClusterChildren(i)})))),this.actor.registerMessageHandler("GCL",((t,i)=>e._(this,void 0,void 0,(function*(){return this._getWorkerSource(t,i.type,i.source).getClusterLeaves(i)})))),this.actor.registerMessageHandler("LD",((e,t)=>this._getWorkerSource(e,t.type,t.source).loadData(t))),this.actor.registerMessageHandler("GD",((e,t)=>this._getWorkerSource(e,t.type,t.source).getData())),this.actor.registerMessageHandler("LT",((e,t)=>this._getWorkerSource(e,t.type,t.source).loadTile(t))),this.actor.registerMessageHandler("RT",((e,t)=>this._getWorkerSource(e,t.type,t.source).reloadTile(t))),this.actor.registerMessageHandler("AT",((e,t)=>this._getWorkerSource(e,t.type,t.source).abortTile(t))),this.actor.registerMessageHandler("RMT",((e,t)=>this._getWorkerSource(e,t.type,t.source).removeTile(t))),this.actor.registerMessageHandler("RS",((t,i)=>e._(this,void 0,void 0,(function*(){if(!this.workerSources[t]||!this.workerSources[t][i.type]||!this.workerSources[t][i.type][i.source])return;const e=this.workerSources[t][i.type][i.source];delete this.workerSources[t][i.type][i.source],void 0!==e.removeSource&&e.removeSource(i)})))),this.actor.registerMessageHandler("RM",(t=>e._(this,void 0,void 0,(function*(){delete this.layerIndexes[t],delete this.availableImages[t],delete this.workerSources[t],delete this.demWorkerSources[t]})))),this.actor.registerMessageHandler("SR",((t,i)=>e._(this,void 0,void 0,(function*(){this.referrer=i})))),this.actor.registerMessageHandler("SRPS",((e,t)=>this._syncRTLPluginState(e,t))),this.actor.registerMessageHandler("IS",((t,i)=>e._(this,void 0,void 0,(function*(){this.self.importScripts(i)})))),this.actor.registerMessageHandler("SI",((e,t)=>this._setImages(e,t))),this.actor.registerMessageHandler("UL",((t,i)=>e._(this,void 0,void 0,(function*(){this._getLayerIndex(t).update(i.layers,i.removedIds)})))),this.actor.registerMessageHandler("SL",((t,i)=>e._(this,void 0,void 0,(function*(){this._getLayerIndex(t).replace(i)}))))}_setImages(t,i){return e._(this,void 0,void 0,(function*(){this.availableImages[t]=i;for(const e in this.workerSources[t]){const r=this.workerSources[t][e];for(const e in r)r[e].availableImages=i}}))}_syncRTLPluginState(t,i){return e._(this,void 0,void 0,(function*(){return yield e.cI.syncState(i,this.self.importScripts)}))}_getAvailableImages(e){let t=this.availableImages[e];return t||(t=[]),t}_getLayerIndex(e){let i=this.layerIndexes[e];return i||(i=this.layerIndexes[e]=new t),i}_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 r={sendAsync:(t,i)=>(t.targetMapId=e,this.actor.sendAsync(t,i))};switch(t){case"vector":this.workerSources[e][t][i]=new o(r,this._getLayerIndex(e),this._getAvailableImages(e));break;case"geojson":this.workerSources[e][t][i]=new ce(r,this._getLayerIndex(e),this._getAvailableImages(e));break;default:this.workerSources[e][t][i]=new this.externalWorkerSourceTypes[t](r,this._getLayerIndex(e),this._getAvailableImages(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 a),this.demWorkerSources[e][t]}}return e.i(self)&&(self.worker=new ue(self)),ue})),i("index",["exports","./shared"],(function(e,t){var i="5.3.0";function r(){var e=new t.A(4);return t.A!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}let n,o;const a={now:"undefined"!=typeof performance&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(e,i,r){const n=requestAnimationFrame((e=>{o(),i(e)})),{unsubscribe:o}=t.s(e.signal,"abort",(()=>{o(),cancelAnimationFrame(n),r(t.c())}),!1)},frameAsync(e){return new Promise(((t,i)=>{this.frame(e,t,i)}))},getImageData(e,t=0){return this.getImageCanvasContext(e).getImageData(-t,-t,e.width+2*t,e.height+2*t)},getImageCanvasContext(e){const t=window.document.createElement("canvas"),i=t.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("failed to create canvas 2d context");return t.width=e.width,t.height=e.height,i.drawImage(e,0,0,e.width,e.height),i},resolveURL:e=>(n||(n=document.createElement("a")),n.href=e,n.href),hardwareConcurrency:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(null==o&&(o=matchMedia("(prefers-reduced-motion: reduce)")),o.matches)}};class s{static testProp(e){if(!s.docStyle)return e[0];for(let t=0;t<e.length;t++)if(e[t]in s.docStyle)return e[t];return e[0]}static create(e,t,i){const r=window.document.createElement(e);return void 0!==t&&(r.className=t),i&&i.appendChild(r),r}static createNS(e,t){return window.document.createElementNS(e,t)}static disableDrag(){s.docStyle&&s.selectProp&&(s.userSelect=s.docStyle[s.selectProp],s.docStyle[s.selectProp]="none")}static enableDrag(){s.docStyle&&s.selectProp&&(s.docStyle[s.selectProp]=s.userSelect)}static setTransform(e,t){e.style[s.transformProp]=t}static addEventListener(e,t,i,r={}){e.addEventListener(t,i,"passive"in r?r:r.capture)}static removeEventListener(e,t,i,r={}){e.removeEventListener(t,i,"passive"in r?r:r.capture)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",s.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",s.suppressClickInternal,!0),window.setTimeout((()=>{window.removeEventListener("click",s.suppressClickInternal,!0)}),0)}static getScale(e){const t=e.getBoundingClientRect();return{x:t.width/e.offsetWidth||1,y:t.height/e.offsetHeight||1,boundingClientRect:t}}static getPoint(e,i,r){const n=i.boundingClientRect;return new t.P((r.clientX-n.left)/i.x-e.clientLeft,(r.clientY-n.top)/i.y-e.clientTop)}static mousePos(e,t){const i=s.getScale(e);return s.getPoint(e,i,t)}static touchPos(e,t){const i=[],r=s.getScale(e);for(let n=0;n<t.length;n++)i.push(s.getPoint(e,r,t[n]));return i}static mouseButton(e){return e.button}static remove(e){e.parentNode&&e.parentNode.removeChild(e)}static sanitize(e){const t=(new DOMParser).parseFromString(e,"text/html").body||document.createElement("body"),i=t.querySelectorAll("script");for(const e of i)e.remove();return s.clean(t),t.innerHTML}static isPossiblyDangerous(e,t){const i=t.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(e)||!i.includes("javascript:")&&!i.includes("data:"))||!!e.startsWith("on")||void 0}static clean(e){const t=e.children;for(const e of t)s.removeAttributes(e),s.clean(e)}static removeAttributes(e){for(const{name:t,value:i}of e.attributes)s.isPossiblyDangerous(t,i)&&e.removeAttribute(t)}}s.docStyle="undefined"!=typeof window&&window.document&&window.document.documentElement.style,s.selectProp=s.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),s.transformProp=s.testProp(["transform","WebkitTransform"]);const l={supported:!1,testSupport:function(e){!h&&u&&(p?d(e):c=e)}};let c,u,h=!1,p=!1;function d(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,u),e.isContextLost())return;l.supported=!0}catch(e){}e.deleteTexture(t),h=!0}var m;"undefined"!=typeof document&&(u=document.createElement("img"),u.onload=()=>{c&&d(c),c=null,p=!0},u.onerror=()=>{h=!0,c=null},u.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(e){let i,r,n,o;e.resetRequestQueue=()=>{i=[],r=0,n=0,o={}},e.addThrottleControl=e=>{const t=n++;return o[t]=e,t},e.removeThrottleControl=e=>{delete o[e],s()},e.getImage=(e,r,n=!0)=>new Promise(((o,a)=>{l.supported&&(e.headers||(e.headers={}),e.headers.accept="image/webp,*/*"),t.e(e,{type:"image"}),i.push({abortController:r,requestParameters:e,supportImageRefresh:n,state:"queued",onError:e=>{a(e)},onSuccess:e=>{o(e)}}),s()}));const a=e=>t._(this,void 0,void 0,(function*(){e.state="running";const{requestParameters:i,supportImageRefresh:n,onError:o,onSuccess:a,abortController:l}=e,u=!1===n&&!t.i(self)&&!t.g(i.url)&&(!i.headers||Object.keys(i.headers).reduce(((e,t)=>e&&"accept"===t),!0));r++;const h=u?c(i,l):t.m(i,l);try{const i=yield h;delete e.abortController,e.state="completed",i.data instanceof HTMLImageElement||t.b(i.data)?a(i):i.data&&a({data:yield(p=i.data,"function"==typeof createImageBitmap?t.f(p):t.h(p)),cacheControl:i.cacheControl,expires:i.expires})}catch(t){delete e.abortController,o(t)}finally{r--,s()}var p})),s=()=>{const e=(()=>{for(const e of Object.keys(o))if(o[e]())return!0;return!1})()?t.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:t.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let t=r;t<e&&i.length>0;t++){const e=i.shift();e.abortController.signal.aborted?t--:a(e)}},c=(e,i)=>new Promise(((r,n)=>{const o=new Image,a=e.url,s=e.credentials;s&&"include"===s?o.crossOrigin="use-credentials":(s&&"same-origin"===s||!t.d(a))&&(o.crossOrigin="anonymous"),i.signal.addEventListener("abort",(()=>{o.src="",n(t.c())})),o.fetchPriority="high",o.onload=()=>{o.onerror=o.onload=null,r({data:o})},o.onerror=()=>{o.onerror=o.onload=null,i.signal.aborted||n(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."))},o.src=a}))}(m||(m={})),m.resetRequestQueue();class f{constructor(e){this._transformRequestFn=e}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function g(e){const t=[];if("string"==typeof e)t.push({id:"default",url:e});else if(e&&e.length>0){const i=[];for(const{id:r,url:n}of e){const e=`${r}${n}`;-1===i.indexOf(e)&&(i.push(e),t.push({id:r,url:n}))}}return t}function y(e,t,i){try{const r=new URL(e);return r.pathname+=`${t}${i}`,r.toString()}catch(t){throw new Error(`Invalid sprite URL "${e}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}class _{constructor(e,t,i,r){this.context=e,this.format=i,this.texture=e.gl.createTexture(),this.update(t,r)}update(e,i,r){const{width:n,height:o}=e,a=!(this.size&&this.size[0]===n&&this.size[1]===o||r),{context:s}=this,{gl:l}=s;if(this.useMipmap=Boolean(i&&i.useMipmap),l.bindTexture(l.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1),s.pixelStoreUnpackPremultiplyAlpha.set(this.format===l.RGBA&&(!i||!1!==i.premultiply)),a)this.size=[n,o],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||t.b(e)?l.texImage2D(l.TEXTURE_2D,0,this.format,this.format,l.UNSIGNED_BYTE,e):l.texImage2D(l.TEXTURE_2D,0,this.format,n,o,0,this.format,l.UNSIGNED_BYTE,e.data);else{const{x:i,y:a}=r||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||t.b(e)?l.texSubImage2D(l.TEXTURE_2D,0,i,a,l.RGBA,l.UNSIGNED_BYTE,e):l.texSubImage2D(l.TEXTURE_2D,0,i,a,n,o,l.RGBA,l.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D)}bind(e,t,i){const{context:r}=this,{gl:n}=r;n.bindTexture(n.TEXTURE_2D,this.texture),i!==n.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(i=n.LINEAR),e!==this.filter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,i||e),this.filter=e),t!==this.wrap&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,t),this.wrap=t)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}function v(e){const{userImage:t}=e;return!!(t&&t.render&&t.render())&&(e.data.replace(new Uint8Array(t.data.buffer)),!0)}class x extends t.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.R({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,promiseResolve:t}of this.requestors)t(this._getImagesForIds(e));this.requestors=[]}}getImage(e){const i=this.images[e];if(i&&!i.data&&i.spriteData){const e=i.spriteData;i.data=new t.R({width:e.width,height:e.height},e.context.getImageData(e.x,e.y,e.width,e.height).data),i.spriteData=null}return i}addImage(e,t){if(this.images[e])throw new Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,t)&&(this.images[e]=t)}_validate(e,i){let r=!0;const n=i.data||i.spriteData;return this._validateStretch(i.stretchX,n&&n.width)||(this.fire(new t.k(new Error(`Image "${e}" has invalid "stretchX" value`))),r=!1),this._validateStretch(i.stretchY,n&&n.height)||(this.fire(new t.k(new Error(`Image "${e}" has invalid "stretchY" value`))),r=!1),this._validateContent(i.content,i)||(this.fire(new t.k(new Error(`Image "${e}" has invalid "content" value`))),r=!1),r}_validateStretch(e,t){if(!e)return!0;let i=0;for(const r of e){if(r[0]<i||r[1]<r[0]||t<r[1])return!1;i=r[1]}return!0}_validateContent(e,t){if(!e)return!0;if(4!==e.length)return!1;const i=t.spriteData,r=i&&i.width||t.data.width,n=i&&i.height||t.data.height;return!(e[0]<0||r<e[0]||e[1]<0||n<e[1]||e[2]<0||r<e[2]||e[3]<0||n<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,t,i=!0){const r=this.getImage(e);if(i&&(r.data.width!==t.data.width||r.data.height!==t.data.height))throw new Error(`size mismatch between old image (${r.data.width}x${r.data.height}) and new image (${t.data.width}x${t.data.height}).`);t.version=r.version+1,this.images[e]=t,this.updatedImages[e]=!0}removeImage(e){const t=this.images[e];delete this.images[e],delete this.patterns[e],t.userImage&&t.userImage.onRemove&&t.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e){return new Promise(((t,i)=>{let r=!0;if(!this.isLoaded())for(const t of e)this.images[t]||(r=!1);this.isLoaded()||r?t(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:t})}))}_getImagesForIds(e){const i={};for(const r of e){let e=this.getImage(r);e||(this.fire(new t.l("styleimagemissing",{id:r})),e=this.getImage(r)),e?i[r]={data:e.data.clone(),pixelRatio:e.pixelRatio,sdf:e.sdf,version:e.version,stretchX:e.stretchX,stretchY:e.stretchY,content:e.content,textFitWidth:e.textFitWidth,textFitHeight:e.textFitHeight,hasRenderCallback:Boolean(e.userImage&&e.userImage.render)}:t.w(`Image "${r}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return i}getPixelSize(){const{width:e,height:t}=this.atlasImage;return{width:e,height:t}}getPattern(e){const i=this.patterns[e],r=this.getImage(e);if(!r)return null;if(i&&i.position.version===r.version)return i.position;if(i)i.position.version=r.version;else{const i={w:r.data.width+2,h:r.data.height+2,x:0,y:0},n=new t.I(i,r);this.patterns[e]={bin:i,position:n}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){const t=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new _(e,this.atlasImage,t.RGBA),this.atlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE)}_updatePatternAtlas(){const e=[];for(const t in this.patterns)e.push(this.patterns[t].bin);const{w:i,h:r}=t.p(e),n=this.atlasImage;n.resize({width:i||1,height:r||1});for(const e in this.patterns){const{bin:i}=this.patterns[e],r=i.x+1,o=i.y+1,a=this.getImage(e).data,s=a.width,l=a.height;t.R.copy(a,n,{x:0,y:0},{x:r,y:o},{width:s,height:l}),t.R.copy(a,n,{x:0,y:l-1},{x:r,y:o-1},{width:s,height:1}),t.R.copy(a,n,{x:0,y:0},{x:r,y:o+l},{width:s,height:1}),t.R.copy(a,n,{x:s-1,y:0},{x:r-1,y:o},{width:1,height:l}),t.R.copy(a,n,{x:0,y:0},{x:r+s,y:o},{width:1,height:l})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(const i of e){if(this.callbackDispatchedThisFrame[i])continue;this.callbackDispatchedThisFrame[i]=!0;const e=this.getImage(i);e||t.w(`Image with ID: "${i}" was not found`),v(e)&&this.updateImage(i,e)}}}const b=1e20;function w(e,t,i,r,n,o,a,s,l){for(let c=t;c<t+r;c++)C(e,i*o+c,o,n,a,s,l);for(let c=i;c<i+n;c++)C(e,c*o+t,1,r,a,s,l)}function C(e,t,i,r,n,o,a){o[0]=0,a[0]=-1e20,a[1]=b,n[0]=e[t];for(let s=1,l=0,c=0;s<r;s++){n[s]=e[t+s*i];const r=s*s;do{const e=o[l];c=(n[s]-n[e]+r-e*e)/(s-e)/2}while(c<=a[l]&&--l>-1);l++,o[l]=s,a[l]=c,a[l+1]=b}for(let s=0,l=0;s<r;s++){for(;a[l+1]<s;)l++;const r=o[l],c=s-r;e[t+s*i]=n[r]+c*c}}class T{constructor(e,t){this.requestManager=e,this.localIdeographFontFamily=t,this.entries={}}setURL(e){this.url=e}getGlyphs(e){return t._(this,void 0,void 0,(function*(){const t=[];for(const i in e)for(const r of e[i])t.push(this._getAndCacheGlyphsPromise(i,r));const i=yield Promise.all(t),r={};for(const{stack:e,id:t,glyph:n}of i)r[e]||(r[e]={}),r[e][t]=n&&{id:n.id,bitmap:n.bitmap.clone(),metrics:n.metrics};return r}))}_getAndCacheGlyphsPromise(e,i){return t._(this,void 0,void 0,(function*(){let t=this.entries[e];t||(t=this.entries[e]={glyphs:{},requests:{},ranges:{}});let r=t.glyphs[i];if(void 0!==r)return{stack:e,id:i,glyph:r};if(r=this._tinySDF(t,e,i),r)return t.glyphs[i]=r,{stack:e,id:i,glyph:r};const n=Math.floor(i/256);if(256*n>65535)throw new Error("glyphs > 65535 not supported");if(t.ranges[n])return{stack:e,id:i,glyph:r};if(!this.url)throw new Error("glyphsUrl is not set");if(!t.requests[n]){const i=T.loadGlyphRange(e,n,this.url,this.requestManager);t.requests[n]=i}const o=yield t.requests[n];for(const e in o)this._doesCharSupportLocalGlyph(+e)||(t.glyphs[+e]=o[+e]);return t.ranges[n]=!0,{stack:e,id:i,glyph:o[i]||null}}))}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&(/\p{Ideo}|\p{sc=Hang}|\p{sc=Hira}|\p{sc=Kana}/u.test(String.fromCodePoint(e))||t.u["CJK Unified Ideographs"](e)||t.u["Hangul Syllables"](e)||t.u.Hiragana(e)||t.u.Katakana(e)||t.u["CJK Symbols and Punctuation"](e)||t.u["Halfwidth and Fullwidth Forms"](e))}_tinySDF(e,i,r){const n=this.localIdeographFontFamily;if(!n)return;if(!this._doesCharSupportLocalGlyph(r))return;let o=e.tinySDF;if(!o){let t="400";/bold/i.test(i)?t="900":/medium/i.test(i)?t="500":/light/i.test(i)&&(t="200"),o=e.tinySDF=new T.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:n,fontWeight:t})}const a=o.draw(String.fromCharCode(r));return{id:r,bitmap:new t.q({width:a.width||60,height:a.height||60},a.data),metrics:{width:a.glyphWidth/2||24,height:a.glyphHeight/2||24,left:a.glyphLeft/2+.5||0,top:a.glyphTop/2-27.5||-8,advance:a.glyphAdvance/2||24,isDoubleResolution:!0}}}}T.loadGlyphRange=function(e,i,r,n){return t._(this,void 0,void 0,(function*(){const o=256*i,a=o+255,s=n.transformRequest(r.replace("{fontstack}",e).replace("{range}",`${o}-${a}`),"Glyphs"),l=yield t.n(s,new AbortController);if(!l||!l.data)throw new Error(`Could not load glyph range. range: ${i}, ${o}-${a}`);const c={};for(const e of t.o(l.data))c[e.id]=e;return c}))},T.TinySDF=class{constructor({fontSize:e=24,buffer:t=3,radius:i=8,cutoff:r=.25,fontFamily:n="sans-serif",fontWeight:o="normal",fontStyle:a="normal"}={}){this.buffer=t,this.cutoff=r,this.radius=i;const s=this.size=e+4*t,l=this._createCanvas(s),c=this.ctx=l.getContext("2d",{willReadFrequently:!0});c.font=`${a} ${o} ${e}px ${n}`,c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(s*s),this.gridInner=new Float64Array(s*s),this.f=new Float64Array(s),this.z=new Float64Array(s+1),this.v=new Uint16Array(s)}_createCanvas(e){const t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){const{width:t,actualBoundingBoxAscent:i,actualBoundingBoxDescent:r,actualBoundingBoxLeft:n,actualBoundingBoxRight:o}=this.ctx.measureText(e),a=Math.ceil(i),s=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o-n))),l=Math.min(this.size-this.buffer,a+Math.ceil(r)),c=s+2*this.buffer,u=l+2*this.buffer,h=Math.max(c*u,0),p=new Uint8ClampedArray(h),d={data:p,width:c,height:u,glyphWidth:s,glyphHeight:l,glyphTop:a,glyphLeft:0,glyphAdvance:t};if(0===s||0===l)return d;const{ctx:m,buffer:f,gridInner:g,gridOuter:y}=this;m.clearRect(f,f,s,l),m.fillText(e,f,f+a);const _=m.getImageData(f,f,s,l);y.fill(b,0,h),g.fill(0,0,h);for(let e=0;e<l;e++)for(let t=0;t<s;t++){const i=_.data[4*(e*s+t)+3]/255;if(0===i)continue;const r=(e+f)*c+t+f;if(1===i)y[r]=0,g[r]=b;else{const e=.5-i;y[r]=e>0?e*e:0,g[r]=e<0?e*e:0}}w(y,0,0,c,u,c,this.f,this.v,this.z),w(g,f,f,s,l,c,this.f,this.v,this.z);for(let e=0;e<h;e++){const t=Math.sqrt(y[e])-Math.sqrt(g[e]);p[e]=Math.round(255-255*(t/this.radius+this.cutoff))}return d}};class S{constructor(){this.specification=t.v.light.position}possiblyEvaluate(e,i){return t.z(e.expression.evaluate(i))}interpolate(e,i,r){return{x:t.B.number(e.x,i.x,r),y:t.B.number(e.y,i.y,r),z:t.B.number(e.z,i.z,r)}}}let A;class M extends t.E{constructor(e){super(),A=A||new t.r({anchor:new t.D(t.v.light.anchor),position:new S,color:new t.D(t.v.light.color),intensity:new t.D(t.v.light.intensity)}),this._transitionable=new t.T(A),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,i={}){if(!this._validate(t.t,e,i))for(const t in e){const i=e[t];t.endsWith("-transition")?this._transitionable.setTransition(t.slice(0,-11),i):this._transitionable.setValue(t,i)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,i,r){return(!r||!1!==r.validate)&&t.x(this,e.call(t.y,{value:i,style:{glyphs:!0,sprite:!0},styleSpec:t.v}))}}const E=new t.r({"sky-color":new t.D(t.v.sky["sky-color"]),"horizon-color":new t.D(t.v.sky["horizon-color"]),"fog-color":new t.D(t.v.sky["fog-color"]),"fog-ground-blend":new t.D(t.v.sky["fog-ground-blend"]),"horizon-fog-blend":new t.D(t.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new t.D(t.v.sky["sky-horizon-blend"]),"atmosphere-blend":new t.D(t.v.sky["atmosphere-blend"])});class P extends t.E{constructor(e){super(),this._transitionable=new t.T(E),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new t.C(0))}setSky(e,i={}){if(!this._validate(t.F,e,i)){e||(e={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const t in e){const i=e[t];t.endsWith("-transition")?this._transitionable.setTransition(t.slice(0,-11),i):this._transitionable.setValue(t,i)}}}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,i,r={}){return!1!==(null==r?void 0:r.validate)&&t.x(this,e.call(t.y,t.e({value:i,style:{glyphs:!0,sprite:!0},styleSpec:t.v})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}}class I{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,t){const i=e.join(",")+String(t);return this.dashEntry[i]||(this.dashEntry[i]=this.addDash(e,t)),this.dashEntry[i]}getDashRanges(e,t,i){const r=[];let n=e.length%2==1?-e[e.length-1]*i:0,o=e[0]*i,a=!0;r.push({left:n,right:o,isDash:a,zeroLength:0===e[0]});let s=e[0];for(let t=1;t<e.length;t++){a=!a;const l=e[t];n=s*i,s+=l,o=s*i,r.push({left:n,right:o,isDash:a,zeroLength:0===l})}return r}addRoundDash(e,t,i){const r=t/2;for(let t=-i;t<=i;t++){const n=this.width*(this.nextRow+i+t);let o=0,a=e[o];for(let s=0;s<this.width;s++){s/a.right>1&&(a=e[++o]);const l=Math.abs(s-a.left),c=Math.abs(s-a.right),u=Math.min(l,c);let h;const p=t/i*(r+1);if(a.isDash){const e=r-Math.abs(p);h=Math.sqrt(u*u+e*e)}else h=r-Math.sqrt(u*u+p*p);this.data[n+s]=Math.max(0,Math.min(255,h+128))}}}addRegularDash(e){for(let t=e.length-1;t>=0;--t){const i=e[t],r=e[t+1];i.zeroLength?e.splice(t,1):r&&r.isDash===i.isDash&&(r.left=i.left,e.splice(t,1))}const t=e[0],i=e[e.length-1];t.isDash===i.isDash&&(t.left=i.left-this.width,i.right=t.right+this.width);const r=this.width*this.nextRow;let n=0,o=e[n];for(let t=0;t<this.width;t++){t/o.right>1&&(o=e[++n]);const i=Math.abs(t-o.left),a=Math.abs(t-o.right),s=Math.min(i,a);this.data[r+t]=Math.max(0,Math.min(255,(o.isDash?s:-s)+128))}}addDash(e,i){const r=i?7:0,n=2*r+1;if(this.nextRow+n>this.height)return t.w("LineAtlas out of space"),null;let o=0;for(let t=0;t<e.length;t++)o+=e[t];if(0!==o){const t=this.width/o,n=this.getDashRanges(e,this.width,t);i?this.addRoundDash(n,t,r):this.addRegularDash(n)}const a={y:(this.nextRow+r+.5)/this.height,height:2*r/this.height,width:o};return this.nextRow+=n,this.dirty=!0,a}bind(e){const t=e.gl;this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.ALPHA,t.UNSIGNED_BYTE,this.data))):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,this.width,this.height,0,t.ALPHA,t.UNSIGNED_BYTE,this.data))}}const k="maplibre_preloaded_worker_pool";class z{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<z.workerCount;)this.workers.push(new Worker(t.a.WORKER_URL));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],0===this.numActive()&&(this.workers.forEach((e=>{e.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[k]}numActive(){return Object.keys(this.active).length}}const L=Math.floor(a.hardwareConcurrency/2);let D,F;function R(){return D||(D=new z),D}z.workerCount=t.G(globalThis)?Math.max(Math.min(L,3),1):1;class B{constructor(e,i){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=i;const r=this.workerPool.acquire(i);for(let e=0;e<r.length;e++){const n=new t.H(r[e],i);n.name=`Worker ${e}`,this.actors.push(n)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,t){const i=[];for(const r of this.actors)i.push(r.sendAsync({type:e,data:t}));return Promise.all(i)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.actors.forEach((e=>{e.remove()})),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,t){for(const i of this.actors)i.registerMessageHandler(e,t)}}function O(){return F||(F=new B(R(),t.J),F.registerMessageHandler("GR",((e,i,r)=>t.m(i,r)))),F}function j(e,i){const r=t.K();return t.L(r,r,[1,1,0]),t.M(r,r,[.5*e.width,.5*e.height,1]),e.calculatePosMatrix?t.N(r,r,e.calculatePosMatrix(i.toUnwrapped())):r}function N(e,t,i,r,n,o,a){var s;const l=function(e,t,i){if(e)for(const r of e){const e=t[r];if(e&&e.source===i&&"fill-extrusion"===e.type)return!0}else for(const e in t){const r=t[e];if(r.source===i&&"fill-extrusion"===r.type)return!0}return!1}(null!==(s=null==n?void 0:n.layers)&&void 0!==s?s:null,t,e.id),c=o.maxPitchScaleFactor(),u=e.tilesIn(r,c,l);u.sort($);const h=[];for(const r of u)h.push({wrappedTileID:r.tileID.wrapped().key,queryResults:r.tile.queryRenderedFeatures(t,i,e._state,r.queryGeometry,r.cameraQueryGeometry,r.scale,n,o,c,j(e.transform,r.tileID),a?(e,t)=>a(r.tileID,e,t):void 0)});return function(e,t){for(const i in e)for(const r of e[i])V(r,t);return e}(function(e){const t={},i={};for(const r of e){const e=r.queryResults,n=r.wrappedTileID,o=i[n]=i[n]||{};for(const i in e){const r=e[i],n=o[i]=o[i]||{},a=t[i]=t[i]||[];for(const e of r)n[e.featureIndex]||(n[e.featureIndex]=!0,a.push(e))}}return t}(h),e)}function $(e,t){const i=e.tileID,r=t.tileID;return i.overscaledZ-r.overscaledZ||i.canonical.y-r.canonical.y||i.wrap-r.wrap||i.canonical.x-r.canonical.x}function V(e,t){const i=e.feature,r=t.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=r}function U(e,i,r){return t._(this,void 0,void 0,(function*(){let n=e;if(e.url?n=(yield t.j(i.transformRequest(e.url,"Source"),r)).data:yield a.frameAsync(r),!n)return null;const o=t.O(t.e(n,e),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in n&&n.vector_layers&&(o.vectorLayerIds=n.vector_layers.map((e=>e.id))),o}))}class q{constructor(e,t){e&&(t?this.setSouthWest(e).setNorthEast(t):Array.isArray(e)&&(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 t.Q?new t.Q(e.lng,e.lat):t.Q.convert(e),this}setSouthWest(e){return this._sw=e instanceof t.Q?new t.Q(e.lng,e.lat):t.Q.convert(e),this}extend(e){const i=this._sw,r=this._ne;let n,o;if(e instanceof t.Q)n=e,o=e;else{if(!(e instanceof q))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(q.convert(e)):this.extend(t.Q.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(t.Q.convert(e)):this;if(n=e._sw,o=e._ne,!n||!o)return this}return i||r?(i.lng=Math.min(n.lng,i.lng),i.lat=Math.min(n.lat,i.lat),r.lng=Math.max(o.lng,r.lng),r.lat=Math.max(o.lat,r.lat)):(this._sw=new t.Q(n.lng,n.lat),this._ne=new t.Q(o.lng,o.lat)),this}getCenter(){return new t.Q((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 t.Q(this.getWest(),this.getNorth())}getSouthEast(){return new t.Q(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:i,lat:r}=t.Q.convert(e);let n=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&n}static convert(e){return e instanceof q?e:e?new q(e):e}static fromLngLat(e,i=0){const r=360*i/40075017,n=r/Math.cos(Math.PI/180*e.lat);return new q(new t.Q(e.lng-n,e.lat-r),new t.Q(e.lng+n,e.lat+r))}adjustAntiMeridian(){const e=new t.Q(this._sw.lng,this._sw.lat),i=new t.Q(this._ne.lng,this._ne.lat);return new q(e,e.lng>i.lng?new t.Q(i.lng+360,i.lat):i)}}class Z{constructor(e,t,i){this.bounds=q.convert(this.validateBounds(e)),this.minzoom=t||0,this.maxzoom=i||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(e){const i=Math.pow(2,e.z),r=Math.floor(t.U(this.bounds.getWest())*i),n=Math.floor(t.S(this.bounds.getNorth())*i),o=Math.ceil(t.U(this.bounds.getEast())*i),a=Math.ceil(t.S(this.bounds.getSouth())*i);return e.x>=r&&e.x<o&&e.y>=n&&e.y<a}}class G extends t.E{constructor(e,i,r,n){if(super(),this.id=e,this.dispatcher=r,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,t.e(this,t.O(i,["url","scheme","tileSize","promoteId"])),this._options=t.e({type:"vector"},i),this._collectResourceTiming=i.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(n)}load(){return t._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new t.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const e=yield U(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e&&(t.e(this,e),e.bounds&&(this.tileBounds=new Z(e.bounds,this.minzoom,this.maxzoom)),this.fire(new t.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.l("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new t.k(e))}}))}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load()}setTiles(e){return this.setSourceProperty((()=>{this._options.tiles=e})),this}setUrl(e){return this.setSourceProperty((()=>{this.url=e,this._options.url=e})),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return t.e({},this._options)}loadTile(e){return t._(this,void 0,void 0,(function*(){const t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i={request:this.map._requestManager.transformRequest(t,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};i.request.collectResourceTiming=this._collectResourceTiming;let r="RT";if(e.actor&&"expired"!==e.state){if("loading"===e.state)return new Promise(((t,i)=>{e.reloadPromise={resolve:t,reject:i}}))}else e.actor=this.dispatcher.getActor(),r="LT";e.abortController=new AbortController;try{const t=yield e.actor.sendAsync({type:r,data:i},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,t)}catch(t){if(delete e.abortController,e.aborted)return;if(t&&404!==t.status)throw t;this._afterTileLoadWorkerResponse(e,null)}}))}_afterTileLoadWorkerResponse(e,t){if(t&&t.resourceTiming&&(e.resourceTiming=t.resourceTiming),t&&this.map._refreshExpiredTiles&&e.setExpiryData(t),e.loadVectorData(t,this.map.painter),e.reloadPromise){const t=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(t.resolve).catch(t.reject)}}abortTile(e){return t._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&(yield e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}}))}))}unloadTile(e){return t._(this,void 0,void 0,(function*(){e.unloadVectorData(),e.actor&&(yield e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}}))}))}hasTransition(){return!1}}class H extends t.E{constructor(e,i,r,n){super(),this.id=e,this.dispatcher=r,this.setEventedParent(n),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=t.e({type:"raster"},i),t.e(this,t.O(i,["url","scheme","tileSize"]))}load(){return t._(this,arguments,void 0,(function*(e=!1){this._loaded=!1,this.fire(new t.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const i=yield U(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,i&&(t.e(this,i),i.bounds&&(this.tileBounds=new Z(i.bounds,this.minzoom,this.maxzoom)),this.fire(new t.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new t.l("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:e})))}catch(e){this._tileJSONRequest=null,this.fire(new t.k(e))}}))}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),e(),this.load(!0)}setTiles(e){return this.setSourceProperty((()=>{this._options.tiles=e})),this}setUrl(e){return this.setSourceProperty((()=>{this.url=e,this._options.url=e})),this}serialize(){return t.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e){return t._(this,void 0,void 0,(function*(){const t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{const i=yield m.getImage(this.map._requestManager.transformRequest(t,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(i&&i.data){this.map._refreshExpiredTiles&&i.cacheControl&&i.expires&&e.setExpiryData({cacheControl:i.cacheControl,expires:i.expires});const t=this.map.painter.context,r=t.gl,n=i.data;e.texture=this.map.painter.getTileTexture(n.width),e.texture?e.texture.update(n,{useMipmap:!0}):(e.texture=new _(t,n,r.RGBA,{useMipmap:!0}),e.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE,r.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(t){if(delete e.abortController,e.aborted)e.state="unloaded";else if(t)throw e.state="errored",t}}))}abortTile(e){return t._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController)}))}unloadTile(e){return t._(this,void 0,void 0,(function*(){e.texture&&this.map.painter.saveTileTexture(e.texture)}))}hasTransition(){return!1}}class W extends H{constructor(e,i,r,n){super(e,i,r,n),this.type="raster-dem",this.maxzoom=22,this._options=t.e({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox",this.redFactor=i.redFactor,this.greenFactor=i.greenFactor,this.blueFactor=i.blueFactor,this.baseShift=i.baseShift}loadTile(e){return t._(this,void 0,void 0,(function*(){const i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r=this.map._requestManager.transformRequest(i,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{const i=yield m.getImage(r,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(i&&i.data){const r=i.data;this.map._refreshExpiredTiles&&i.cacheControl&&i.expires&&e.setExpiryData({cacheControl:i.cacheControl,expires:i.expires});const n=t.b(r)&&t.V()?r:yield this.readImageNow(r),o={type:this.type,uid:e.uid,source:this.id,rawImageData:n,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||"expired"===e.state){e.actor=this.dispatcher.getActor();const t=yield e.actor.sendAsync({type:"LDT",data:o});e.dem=t,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(t){if(delete e.abortController,e.aborted)e.state="unloaded";else if(t)throw e.state="errored",t}}))}readImageNow(e){return t._(this,void 0,void 0,(function*(){if("undefined"!=typeof VideoFrame&&t.W()){const i=e.width+2,r=e.height+2;try{return new t.R({width:i,height:r},yield t.X(e,-1,-1,i,r))}catch(e){}}return a.getImageData(e,1)}))}_getNeighboringTiles(e){const i=e.canonical,r=Math.pow(2,i.z),n=(i.x-1+r)%r,o=0===i.x?e.wrap-1:e.wrap,a=(i.x+1+r)%r,s=i.x+1===r?e.wrap+1:e.wrap,l={};return l[new t.Y(e.overscaledZ,o,i.z,n,i.y).key]={backfilled:!1},l[new t.Y(e.overscaledZ,s,i.z,a,i.y).key]={backfilled:!1},i.y>0&&(l[new t.Y(e.overscaledZ,o,i.z,n,i.y-1).key]={backfilled:!1},l[new t.Y(e.overscaledZ,e.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new t.Y(e.overscaledZ,s,i.z,a,i.y-1).key]={backfilled:!1}),i.y+1<r&&(l[new t.Y(e.overscaledZ,o,i.z,n,i.y+1).key]={backfilled:!1},l[new t.Y(e.overscaledZ,e.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},l[new t.Y(e.overscaledZ,s,i.z,a,i.y+1).key]={backfilled:!1}),l}unloadTile(e){return t._(this,void 0,void 0,(function*(){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&(yield e.actor.sendAsync({type:"RDT",data:{type:this.type,uid:e.uid,source:this.id}}))}))}}class K extends t.E{constructor(e,i,r,n){super(),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=r.getActor(),this.setEventedParent(n),this._data=i.data,this._options=t.e({},i),this._collectResourceTiming=i.collectResourceTiming,void 0!==i.maxzoom&&(this.maxzoom=i.maxzoom),i.type&&(this.type=i.type),i.attribution&&(this.attribution=i.attribution),this.promoteId=i.promoteId,void 0!==i.clusterMaxZoom&&this.maxzoom<=i.clusterMaxZoom&&t.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${i.clusterMaxZoom}".`),this.workerOptions=t.e({source:this.id,cluster:i.cluster||!1,geojsonVtOptions:{buffer:this._pixelsToTileUnits(void 0!==i.buffer?i.buffer:128),tolerance:this._pixelsToTileUnits(void 0!==i.tolerance?i.tolerance:.375),extent:t.Z,maxZoom:this.maxzoom,lineMetrics:i.lineMetrics||!1,generateId:i.generateId||!1},superclusterOptions:{maxZoom:void 0!==i.clusterMaxZoom?i.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,i.clusterMinPoints||2),extent:t.Z,radius:this._pixelsToTileUnits(i.clusterRadius||50),log:!1,generateId:i.generateId||!1},clusterProperties:i.clusterProperties,filter:i.filter},i.workerOptions),"string"==typeof this.promoteId&&(this.workerOptions.promoteId=this.promoteId)}_pixelsToTileUnits(e){return e*(t.Z/this.tileSize)}load(){return t._(this,void 0,void 0,(function*(){yield this._updateWorkerData()}))}onAdd(e){this.map=e,this.load()}setData(e){return this._data=e,this._updateWorkerData(),this}updateData(e){return this._updateWorkerData(e),this}getData(){return t._(this,void 0,void 0,(function*(){const e=t.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:e})}))}getCoordinatesFromGeometry(e){return"GeometryCollection"===e.type?e.geometries.map((e=>e.coordinates)).flat(1/0):e.coordinates.flat(1/0)}getBounds(){return t._(this,void 0,void 0,(function*(){const e=new q,t=yield this.getData();let i;switch(t.type){case"FeatureCollection":i=t.features.map((e=>this.getCoordinatesFromGeometry(e.geometry))).flat(1/0);break;case"Feature":i=this.getCoordinatesFromGeometry(t.geometry);break;default:i=this.getCoordinatesFromGeometry(t)}if(0==i.length)return e;for(let t=0;t<i.length-1;t+=2)e.extend([i[t],i[t+1]]);return e}))}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,e&&(void 0!==e.clusterRadius&&(this.workerOptions.superclusterOptions.radius=this._pixelsToTileUnits(e.clusterRadius)),void 0!==e.clusterMaxZoom&&(this.workerOptions.superclusterOptions.maxZoom=e.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(e){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:e,source:this.id}})}getClusterChildren(e){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:e,source:this.id}})}getClusterLeaves(e,t,i){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:t,offset:i}})}_updateWorkerData(e){return t._(this,void 0,void 0,(function*(){const i=t.e({type:this.type},this.workerOptions);e?i.dataDiff=e:"string"==typeof this._data?(i.request=this.map._requestManager.transformRequest(a.resolveURL(this._data),"Source"),i.request.collectResourceTiming=this._collectResourceTiming):i.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new t.l("dataloading",{dataType:"source"}));try{const e=yield this.actor.sendAsync({type:"LD",data:i});if(this._pendingLoads--,this._removed||e.abandoned)return void this.fire(new t.l("dataabort",{dataType:"source"}));let r=null;e.resourceTiming&&e.resourceTiming[this.id]&&(r=e.resourceTiming[this.id].slice(0));const n={dataType:"source"};this._collectResourceTiming&&r&&r.length>0&&t.e(n,{resourceTiming:r}),this.fire(new t.l("data",Object.assign(Object.assign({},n),{sourceDataType:"metadata"}))),this.fire(new t.l("data",Object.assign(Object.assign({},n),{sourceDataType:"content"})))}catch(e){if(this._pendingLoads--,this._removed)return void this.fire(new t.l("dataabort",{dataType:"source"}));this.fire(new t.k(e))}}))}loaded(){return 0===this._pendingLoads}loadTile(e){return t._(this,void 0,void 0,(function*(){const t=e.actor?"RT":"LT";e.actor=this.actor;const i={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};e.abortController=new AbortController;const r=yield this.actor.sendAsync({type:t,data:i},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(r,this.map.painter,"RT"===t)}))}abortTile(e){return t._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0}))}unloadTile(e){return t._(this,void 0,void 0,(function*(){e.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})}))}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return t.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}class X extends t.E{constructor(e,t,i,r){super(),this.flippedWindingOrder=!1,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(r),this.options=t}load(e){return t._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new t.l("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const t=yield m.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,t&&t.data&&(this.image=t.data,e&&(this.coordinates=e),this._finishLoading())}catch(e){this._request=null,this._loaded=!0,this.fire(new t.k(e))}}))}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=e.url,this.load(e.coordinates).finally((()=>{this.texture=null})),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.l("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(e){this.coordinates=e;const i=e.map(t.$.fromLngLat);var r;return this.tileID=function(e){let i=1/0,r=1/0,n=-1/0,o=-1/0;for(const t of e)i=Math.min(i,t.x),r=Math.min(r,t.y),n=Math.max(n,t.x),o=Math.max(o,t.y);const a=Math.max(n-i,o-r),s=Math.max(0,Math.floor(-Math.log(a)/Math.LN2)),l=Math.pow(2,s);return new t.a1(s,Math.floor((i+n)/2*l),Math.floor((r+o)/2*l))}(i),this.terrainTileRanges=this._getOverlappingTileRanges(i),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=i.map((e=>this.tileID.getTilePoint(e)._round())),this.flippedWindingOrder=((r=this.tileCoords)[1].x-r[0].x)*(r[2].y-r[0].y)-(r[1].y-r[0].y)*(r[2].x-r[0].x)<0,this.fire(new t.l("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const e=this.map.painter.context,i=e.gl;this.texture||(this.texture=new _(e,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let r=!1;for(const e in this.tiles){const t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,r=!0)}r&&this.fire(new t.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(e){return t._(this,void 0,void 0,(function*(){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"}))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(e){let i=1/0,r=1/0,n=-1/0,o=-1/0;for(const t of e)i=Math.min(i,t.x),r=Math.min(r,t.y),n=Math.max(n,t.x),o=Math.max(o,t.y);const a={};for(let e=0;e<=t.a0;e++){const t=Math.pow(2,e),s=Math.floor(i*t),l=Math.floor(r*t),c=Math.floor(n*t),u=Math.floor(o*t);a[e]={minTileX:s,minTileY:l,maxTileX:c,maxTileY:u}}return a}}class Y extends X{constructor(e,t,i,r){super(e,t,i,r),this.roundZoom=!0,this.type="video",this.options=t}load(){return t._(this,void 0,void 0,(function*(){this._loaded=!1;const e=this.options;this.urls=[];for(const t of e.urls)this.urls.push(this.map._requestManager.transformRequest(t,"Source").url);try{const e=yield t.a2(this.urls);if(this._loaded=!0,!e)return;this.video=e,this.video.loop=!0,this.video.addEventListener("playing",(()=>{this.map.triggerRepaint()})),this.map&&this.video.play(),this._finishLoading()}catch(e){this.fire(new t.k(e))}}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){const i=this.video.seekable;e<i.start(0)||e>i.end(0)?this.fire(new t.k(new t.a3(`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=e}}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 e=this.map.painter.context,i=e.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,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let r=!1;for(const e in this.tiles){const t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,r=!0)}r&&this.fire(new t.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class J extends X{constructor(e,i,r,n){super(e,i,r,n),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 t.k(new t.a3(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.k(new t.a3(`sources.${e}`,null,'missing required property "coordinates"'))),i.animate&&"boolean"!=typeof i.animate&&this.fire(new t.k(new t.a3(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),i.canvas?"string"==typeof i.canvas||i.canvas instanceof HTMLCanvasElement||this.fire(new t.k(new t.a3(`sources.${e}`,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 t.k(new t.a3(`sources.${e}`,null,'missing required property "canvas"'))),this.options=i,this.animate=void 0===i.animate||i.animate}load(){return t._(this,void 0,void 0,(function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new t.k(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}))}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions())return;if(0===Object.keys(this.tiles).length)return;const i=this.map.painter.context,r=i.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new _(i,this.canvas,r.RGBA,{premultiply:!0});let n=!1;for(const e in this.tiles){const t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,n=!0)}n&&this.fire(new t.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}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}}const Q={},ee=e=>{switch(e){case"geojson":return K;case"image":return X;case"raster":return H;case"raster-dem":return W;case"vector":return G;case"video":return Y;case"canvas":return J}return Q[e]},te="RTLPluginLoaded";class ie extends t.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=O()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch((e=>{throw this.status="error",e}))}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(e){return t._(this,arguments,void 0,(function*(e,t=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=a.resolveURL(e),!this.url)throw new Error(`requested url ${e} is invalid`);if("unavailable"===this.status){if(!t)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if("requested"===this.status)return this._requestImport()}))}_requestImport(){return t._(this,void 0,void 0,(function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new t.l(te))}))}lazyLoad(){"unavailable"===this.status?this.status="requested":"deferred"===this.status&&this._requestImport()}}let re=null;function ne(){return re||(re=new ie),re}class oe{constructor(e,i){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=t.a4(),this.uses=0,this.tileSize=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(e){const t=e+this.timeAdded;t<this.fadeEndTime||(this.fadeEndTime=t)}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,i,r){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(e,t){const i={};if(!t)return i;for(const r of e){const e=r.layerIds.map((e=>t.getLayer(e))).filter(Boolean);if(0!==e.length){r.layers=e,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map((t=>e.filter((e=>e.id===t))[0])));for(const t of e)i[t.id]=r}}return i}(e.buckets,null==i?void 0:i.style),this.hasSymbolBuckets=!1;for(const e in this.buckets){const i=this.buckets[e];if(i instanceof t.a6){if(this.hasSymbolBuckets=!0,!r)break;i.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const e in this.buckets){const i=this.buckets[e];if(i instanceof t.a6&&i.hasRTLText){this.hasRTLText=!0,ne().lazyLoad();break}}this.queryPadding=0;for(const e in this.buckets){const t=this.buckets[e];this.queryPadding=Math.max(this.queryPadding,i.style.getLayer(e).queryRadius(t))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new t.a5}unloadVectorData(){for(const e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(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 _(e,this.imageAtlas.image,t.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new _(e,this.glyphAtlasImage,t.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,i,r,n,o,a,s,l,c,u){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:r,cameraQueryGeometry:n,scale:o,tileSize:this.tileSize,pixelPosMatrix:c,transform:s,params:a,queryPadding:this.queryPadding*l,getElevation:u},e,t,i):{}}querySourceFeatures(e,i){const r=this.latestFeatureIndex;if(!r||!r.rawTileData)return;const n=r.loadVTLayers(),o=i&&i.sourceLayer?i.sourceLayer:"",a=n._geojsonTileLayer||n[o];if(!a)return;const s=t.a7(i&&i.filter),{z:l,x:c,y:u}=this.tileID.canonical,h={z:l,x:c,y:u};for(let i=0;i<a.length;i++){const n=a.feature(i);if(s.needGeometry){const e=t.a8(n,!0);if(!s.filter(new t.C(this.tileID.overscaledZ),e,this.tileID.canonical))continue}else if(!s.filter(new t.C(this.tileID.overscaledZ),n))continue;const p=r.getId(n,o),d=new t.a9(n,l,c,u,p);d.tile=h,e.push(d)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){const i=this.expirationTime;if(e.cacheControl){const i=t.aa(e.cacheControl);i["max-age"]&&(this.expirationTime=Date.now()+1e3*i["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){const e=Date.now();let t=!1;if(this.expirationTime>e)t=!1;else if(i)if(this.expirationTime<i)t=!0;else{const r=this.expirationTime-i;r?this.expirationTime=e+Math.max(r,3e4):t=!0}else t=!0;t?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),Math.pow(2,31)-1)}setFeatureState(e,t){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||0===Object.keys(e).length)return;const i=this.latestFeatureIndex.loadVTLayers();for(const r in this.buckets){if(!t.style.hasLayer(r))continue;const n=this.buckets[r],o=n.layers[0].sourceLayer||"_geojsonTileLayer",a=i[o],s=e[o];if(!a||!s||0===Object.keys(s).length)continue;n.update(s,a,this.imageAtlas&&this.imageAtlas.patternPositions||{});const l=t&&t.style&&t.style.getLayer(r);l&&(this.queryPadding=Math.max(this.queryPadding,l.queryRadius(n)))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<a.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=a.now()+e}setDependencies(e,t){const i={};for(const e of t)i[e]=!0;this.dependencies[e]=i}hasDependency(e,t){for(const i of e){const e=this.dependencies[i];if(e)for(const i of t)if(e[i])return!0}return!1}}class ae{constructor(e,t){this.max=e,this.onRemove=t,this.reset()}reset(){for(const e in this.data)for(const t of this.data[e])t.timeout&&clearTimeout(t.timeout),this.onRemove(t.value);return this.data={},this.order=[],this}add(e,t,i){const r=e.wrapped().key;void 0===this.data[r]&&(this.data[r]=[]);const n={value:t,timeout:void 0};if(void 0!==i&&(n.timeout=setTimeout((()=>{this.remove(e,n)}),i)),this.data[r].push(n),this.order.push(r),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,r=void 0===t?0:this.data[i].indexOf(t),n=this.data[i][r];return this.data[i].splice(r,1),n.timeout&&clearTimeout(n.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(n.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 r of this.data[i])e(r.value)||t.push(r);for(const e of t)this.remove(e.value.tileID,e)}}class se{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,i,r){const n=String(i);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][n]=this.stateChanges[e][n]||{},t.e(this.stateChanges[e][n],r),null===this.deletedStates[e]){this.deletedStates[e]={};for(const t in this.state[e])t!==n&&(this.deletedStates[e][t]=null)}else if(this.deletedStates[e]&&null===this.deletedStates[e][n]){this.deletedStates[e][n]={};for(const t in this.state[e][n])r[t]||(this.deletedStates[e][n][t]=null)}else for(const t in r)this.deletedStates[e]&&this.deletedStates[e][n]&&null===this.deletedStates[e][n][t]&&delete this.deletedStates[e][n][t]}removeFeatureState(e,t,i){if(null===this.deletedStates[e])return;const r=String(t);if(this.deletedStates[e]=this.deletedStates[e]||{},i&&void 0!==t)null!==this.deletedStates[e][r]&&(this.deletedStates[e][r]=this.deletedStates[e][r]||{},this.deletedStates[e][r][i]=null);else if(void 0!==t)if(this.stateChanges[e]&&this.stateChanges[e][r])for(i in this.deletedStates[e][r]={},this.stateChanges[e][r])this.deletedStates[e][r][i]=null;else this.deletedStates[e][r]=null;else this.deletedStates[e]=null}getState(e,i){const r=String(i),n=t.e({},(this.state[e]||{})[r],(this.stateChanges[e]||{})[r]);if(null===this.deletedStates[e])return{};if(this.deletedStates[e]){const t=this.deletedStates[e][i];if(null===t)return{};for(const e in t)delete n[e]}return n}initializeTileState(e,t){e.setFeatureState(this.state,t)}coalesceChanges(e,i){const r={};for(const e in this.stateChanges){this.state[e]=this.state[e]||{};const i={};for(const r in this.stateChanges[e])this.state[e][r]||(this.state[e][r]={}),t.e(this.state[e][r],this.stateChanges[e][r]),i[r]=this.state[e][r];r[e]=i}for(const e in this.deletedStates){this.state[e]=this.state[e]||{};const i={};if(null===this.deletedStates[e])for(const t in this.state[e])i[t]={},this.state[e][t]={};else for(const t in this.deletedStates[e]){if(null===this.deletedStates[e][t])this.state[e][t]={};else for(const i of Object.keys(this.deletedStates[e][t]))delete this.state[e][t][i];i[t]=this.state[e][t]}r[e]=r[e]||{},t.e(r[e],i)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(r).length)for(const t in e)e[t].setFeatureState(r,i)}}function le(e,t,i){const r=t.intersectsFrustum(e);if(!i)return r;const n=t.intersectsPlane(i);return 0===r||0===n?0:2===r&&2===n?2:1}function ce(e,i,r,n,o){let a=e;const s=Math.atan(i/r),l=Math.hypot(i,r);return a=e+t.ab(n/l/Math.max(.5,Math.cos(t.ad(o/2)))),a+=1*t.ab(Math.cos(s))/2,a+=t.ae(e-a,-0,0),a}function ue(e,i){const r=(i.roundZoom?Math.round:Math.floor)(e.zoom+t.ab(e.tileSize/i.tileSize));return Math.max(0,r)}function he(e,i){const r=e.getCameraFrustum(),n=e.getClippingPlane(),o=e.screenPointToMercatorCoordinate(e.getCameraPoint()),a=t.$.fromLngLat(e.center,e.elevation);o.z=a.z+Math.cos(e.pitchInRadians)*e.cameraToCenterDistance/e.worldSize;const s=e.getCoveringTilesDetailsProvider(),l=s.allowVariableZoom(e,i),c=ue(e,i),u=i.minzoom||0,h=void 0!==i.maxzoom?i.maxzoom:e.maxZoom,p=Math.min(Math.max(0,c),h),d=Math.pow(2,p),m=[d*o.x,d*o.y,0],f=[d*a.x,d*a.y,0],g=Math.hypot(a.x-o.x,a.y-o.y),y=Math.abs(a.z-o.z),_=Math.hypot(g,y),v=e=>({zoom:0,x:0,y:0,wrap:e,fullyVisible:!1}),x=[],b=[];if(e.renderWorldCopies&&s.allowWorldCopies())for(let e=1;e<=3;e++)x.push(v(-e)),x.push(v(e));for(x.push(v(0));x.length>0;){const d=x.pop(),g=d.x,v=d.y;let w=d.fullyVisible;const C={x:g,y:v,z:d.zoom},T=s.getTileAABB(C,d.wrap,e.elevation,i);if(!w){const e=le(r,T,n);if(0===e)continue;w=2===e}const S=s.distanceToTile2d(o.x,o.y,C,T);let A=c;l&&(A=(i.calculateTileZoom||ce)(e.zoom+t.ab(e.tileSize/i.tileSize),S,y,_,e.fov)),A=(i.roundZoom?Math.round:Math.floor)(A),A=Math.max(0,A);const M=Math.min(A,h);if(d.wrap=s.getWrap(a,C,d.wrap),d.zoom>=M){if(d.zoom<u)continue;const e=p-d.zoom,r=m[0]-.5-(g<<e),n=m[1]-.5-(v<<e),o=i.reparseOverscaled?Math.max(d.zoom,A):d.zoom;b.push({tileID:new t.Y(d.zoom===h?o:d.zoom,d.wrap,d.zoom,g,v),distanceSq:t.ac([f[0]-.5-g,f[1]-.5-v]),tileDistanceToCamera:Math.sqrt(r*r+n*n)})}else for(let e=0;e<4;e++)x.push({zoom:d.zoom+1,x:(g<<1)+e%2,y:(v<<1)+(e>>1),wrap:d.wrap,fullyVisible:w})}return b.sort(((e,t)=>e.distanceSq-t.distanceSq)).map((e=>e.tileID))}class pe extends t.E{constructor(e,t,i){super(),this.id=e,this.dispatcher=i,this.on("data",(e=>this._dataHandler(e))),this.on("dataloading",(()=>{this._sourceErrored=!1})),this.on("error",(()=>{this._sourceErrored=this._source.loaded()})),this._source=((e,t,i,r)=>{const n=new(ee(t.type))(e,t,i,r);if(n.id!==e)throw new Error(`Expected Source id to be ${e} instead of ${n.id}`);return n})(e,t,i,this),this._tiles={},this._cache=new ae(0,(e=>this._unloadTile(e))),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new se,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;if(!(void 0===this.used&&void 0===this.usedForTerrain||this.used||this.usedForTerrain))return!0;if(!this._updated)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,this.terrain)}_loadTile(e,i,r){return t._(this,void 0,void 0,(function*(){try{yield this._source.loadTile(e),this._tileLoaded(e,i,r)}catch(i){e.state="errored",404!==i.status?this._source.fire(new t.k(i,{tile:e})):this.update(this.transform,this.terrain)}}))}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new t.l("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}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 Object.values(this._tiles).map((e=>e.tileID)).sort(de).map((e=>e.key))}getRenderableIds(e){const i=[];for(const t in this._tiles)this._isIdRenderable(t,e)&&i.push(this._tiles[t]);return e?i.sort(((e,i)=>{const r=e.tileID,n=i.tileID,o=new t.P(r.canonical.x,r.canonical.y)._rotate(-this.transform.bearingInRadians),a=new t.P(n.canonical.x,n.canonical.y)._rotate(-this.transform.bearingInRadians);return r.overscaledZ-n.overscaledZ||a.y-o.y||a.x-o.x})).map((e=>e.tileID.key)):i.map((e=>e.tileID)).sort(de).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(e){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)(e||"errored"!==this._tiles[t].state)&&this._reloadTile(t,"reloading")}}_reloadTile(e,i){return t._(this,void 0,void 0,(function*(){const t=this._tiles[e];t&&("loading"!==t.state&&(t.state=i),yield this._loadTile(t,e,i))}))}_tileLoaded(e,i,r){e.timeAdded=a.now(),"expired"===r&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(i,e),"raster-dem"===this.getSource().type&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new t.l("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){const t=this.getRenderableIds();for(let r=0;r<t.length;r++){const n=t[r];if(e.neighboringTiles&&e.neighboringTiles[n]){const t=this.getTileByID(n);i(e,t),i(t,e)}}function i(e,t){e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0;let i=t.tileID.canonical.x-e.tileID.canonical.x;const r=t.tileID.canonical.y-e.tileID.canonical.y,n=Math.pow(2,e.tileID.canonical.z),o=t.tileID.key;0===i&&0===r||Math.abs(r)>1||(Math.abs(i)>1&&(1===Math.abs(i+n)?i+=n:1===Math.abs(i-n)&&(i-=n)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,i,r),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,r){for(const n in this._tiles){let o=this._tiles[n];if(r[n]||!o.hasData()||o.tileID.overscaledZ<=t||o.tileID.overscaledZ>i)continue;let a=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()&&(a=e)}let s=a;for(;s.overscaledZ>t;)if(s=s.scaledTo(s.overscaledZ-1),e[s.key]||e[s.canonical.key]){r[a.key]=a;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),r=this._getLoadedTile(t);if(r)return r}}findLoadedSibling(e){return this._getLoadedTile(e)}_getLoadedTile(e){const t=this._tiles[e.key];return t&&t.hasData()?t:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){const i=Math.ceil(e.width/this._source.tileSize)+1,r=Math.ceil(e.height/this._source.tileSize)+1,n=Math.floor(i*r*(null===this._maxTileCacheZoomLevels?t.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),o="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,n):n;this._cache.setMaxSize(o)}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 r=this._tiles[i];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+t),e[r.tileID.key]=r}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])}}_updateCoveredAndRetainedTiles(e,t,i,r,n,o){const s={},l={},c=Object.keys(e),u=a.now();for(const i of c){const r=e[i],n=this._tiles[i];if(!n||0!==n.fadeEndTime&&n.fadeEndTime<=u)continue;const o=this.findLoadedParent(r,t),a=this.findLoadedSibling(r),c=o||a||null;c&&(this._addTile(c.tileID),s[c.tileID.key]=c.tileID),l[i]=r}this._retainLoadedChildren(l,r,i,e);for(const t in s)e[t]||(this._coveredTiles[t]=!0,e[t]=s[t]);if(o){const t={},i={};for(const e of n)this._tiles[e.key].hasData()?t[e.key]=e:i[e.key]=e;for(const r in i){const n=i[r].children(this._source.maxzoom);this._tiles[n[0].key]&&this._tiles[n[1].key]&&this._tiles[n[2].key]&&this._tiles[n[3].key]&&(t[n[0].key]=e[n[0].key]=n[0],t[n[1].key]=e[n[1].key]=n[1],t[n[2].key]=e[n[2].key]=n[2],t[n[3].key]=e[n[3].key]=n[3],delete i[r])}for(const r in i){const n=i[r],o=this.findLoadedParent(n,this._source.minzoom),a=this.findLoadedSibling(n),s=o||a||null;if(s){t[s.tileID.key]=e[s.tileID.key]=s.tileID;for(const e in t)t[e].isChildOf(s.tileID)&&delete t[e]}}for(const e in this._tiles)t[e]||(this._coveredTiles[e]=!0)}}update(e,i){if(!this._sourceLoaded||this._paused)return;let r;this.transform=e,this.terrain=i,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?r=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((e=>new t.Y(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y))):(r=he(e,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:i,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(r=r.filter((e=>this._source.hasTile(e))))):r=[];const n=ue(e,this._source),o=Math.max(n-pe.maxOverzooming,this._source.minzoom),a=Math.max(n+pe.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const e={};for(const t of r)if(t.canonical.z>this._source.minzoom){const i=t.scaledTo(t.canonical.z-1);e[i.key]=i;const r=t.scaledTo(Math.max(this._source.minzoom,Math.min(t.canonical.z,5)));e[r.key]=r}r=r.concat(Object.values(e))}const s=0===r.length&&!this._updated&&this._didEmitContent;this._updated=!0,s&&this.fire(new t.l("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const l=this._updateRetainedTiles(r,n);me(this._source.type)&&this._updateCoveredAndRetainedTiles(l,o,a,n,r,i);for(const e in l)this._tiles[e].clearFadeHold();const c=t.af(this._tiles,l);for(const e of c){const t=this._tiles[e];t.hasSymbolBuckets&&!t.holdingForFade()?t.setHoldDuration(this.map._fadeDuration):t.hasSymbolBuckets&&!t.symbolFadeFinished()||this._removeTile(e)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,t){var i;const r={},n={},o=Math.max(t-pe.maxOverzooming,this._source.minzoom),a=Math.max(t+pe.maxUnderzooming,this._source.minzoom),s={};for(const i of e){const e=this._addTile(i);r[i.key]=i,e.hasData()||t<this._source.maxzoom&&(s[i.key]=i)}this._retainLoadedChildren(s,t,a,r);for(const a of e){let e=this._tiles[a.key];if(e.hasData())continue;if(t+1>this._source.maxzoom){const e=a.children(this._source.maxzoom)[0],t=this.getTile(e);if(t&&t.hasData()){r[e.key]=e;continue}}else{const e=a.children(this._source.maxzoom);if(r[e[0].key]&&r[e[1].key]&&r[e[2].key]&&r[e[3].key])continue}let s=e.wasRequested();for(let t=a.overscaledZ-1;t>=o;--t){const o=a.scaledTo(t);if(n[o.key])break;if(n[o.key]=!0,e=this.getTile(o),!e&&s&&(e=this._addTile(o)),e){const t=e.hasData();if((t||!(null===(i=this.map)||void 0===i?void 0:i.cancelPendingTileRequestsWhileZooming)||s)&&(r[o.key]=o),s=e.wasRequested(),t)break}}}return r}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const t=[];let i,r=this._tiles[e].tileID;for(;r.overscaledZ>0;){if(r.key in this._loadedParentTiles){i=this._loadedParentTiles[r.key];break}t.push(r.key);const e=r.scaledTo(r.overscaledZ-1);if(i=this._getLoadedTile(e),i)break;r=e}for(const e of t)this._loadedParentTiles[e]=i}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const e in this._tiles){const t=this._tiles[e].tileID,i=this._getLoadedTile(t);this._loadedSiblingTiles[t.key]=i}}_addTile(e){let i=this._tiles[e.key];if(i)return i;i=this._cache.getAndRemove(e),i&&(this._setTileReloadTimer(e.key,i),i.tileID=e,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,i)));const r=i;return i||(i=new oe(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(i,e.key,i.state)),i.uses++,this._tiles[e.key]=i,r||this._source.fire(new t.l("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i}_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))))}_dataHandler(e){const t=e.sourceDataType;"source"===e.dataType&&"metadata"===t&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===e.dataType&&"content"===t&&(this.reload(e.sourceDataChanged),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,i,r){const n=[],o=this.transform;if(!o)return n;const a=r?o.getCameraQueryGeometry(e):e,s=e.map((e=>o.screenPointToMercatorCoordinate(e,this.terrain))),l=a.map((e=>o.screenPointToMercatorCoordinate(e,this.terrain))),c=this.getIds();let u=1/0,h=1/0,p=-1/0,d=-1/0;for(const e of l)u=Math.min(u,e.x),h=Math.min(h,e.y),p=Math.max(p,e.x),d=Math.max(d,e.y);for(let e=0;e<c.length;e++){const r=this._tiles[c[e]];if(r.holdingForFade())continue;const a=r.tileID,m=Math.pow(2,o.zoom-r.tileID.overscaledZ),f=i*r.queryPadding*t.Z/r.tileSize/m,g=[a.getTilePoint(new t.$(u,h)),a.getTilePoint(new t.$(p,d))];if(g[0].x-f<t.Z&&g[0].y-f<t.Z&&g[1].x+f>=0&&g[1].y+f>=0){const e=s.map((e=>a.getTilePoint(e))),t=l.map((e=>a.getTilePoint(e)));n.push({tile:r,tileID:a,queryGeometry:e,cameraQueryGeometry:t,scale:m})}}return n}getVisibleCoordinates(e){const t=this.getRenderableIds(e).map((e=>this._tiles[e].tileID));return this.transform&&this.transform.populateCache(t),t}hasTransition(){if(this._source.hasTransition())return!0;if(me(this._source.type)){const e=a.now();for(const t in this._tiles)if(this._tiles[t].fadeEndTime>=e)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 r=this._tiles[e];r&&r.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)))}}function de(e,t){const i=Math.abs(2*e.wrap)-+(e.wrap<0),r=Math.abs(2*t.wrap)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||r-i||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}function me(e){return"raster"===e||"image"===e||"video"===e}pe.maxOverzooming=10,pe.maxUnderzooming=3;class fe{constructor(e,t){this.reset(e,t)}reset(e,t){this.points=e||[],this._distances=[0];for(let e=1;e<this.points.length;e++)this._distances[e]=this._distances[e-1]+this.points[e].dist(this.points[e-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(t||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(1===this.points.length)return this.points[0];e=t.ae(e,0,1);let i=1,r=this._distances[i];const n=e*this.paddedLength+this.padding;for(;r<n&&i<this._distances.length;)r=this._distances[++i];const o=i-1,a=this._distances[o],s=r-a,l=s>0?(n-a)/s:0;return this.points[o].mult(1-l).add(this.points[i].mult(l))}}function ge(e,t){let i=!0;return"always"===e||"never"!==e&&"never"!==t||(i=!1),i}class ye{constructor(e,t,i){const r=this.boxCells=[],n=this.circleCells=[];this.xCellCount=Math.ceil(e/i),this.yCellCount=Math.ceil(t/i);for(let e=0;e<this.xCellCount*this.yCellCount;e++)r.push([]),n.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=t,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/t,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,t,i,r,n){this._forEachCell(t,i,r,n,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n)}insertCircle(e,t,i,r){this._forEachCell(t-r,i-r,t+r,i+r,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(i),this.circles.push(r)}_insertBoxCell(e,t,i,r,n,o){this.boxCells[n].push(o)}_insertCircleCell(e,t,i,r,n,o){this.circleCells[n].push(o)}_query(e,t,i,r,n,o,a){if(i<0||e>this.width||r<0||t>this.height)return[];const s=[];if(e<=0&&t<=0&&this.width<=i&&this.height<=r){if(n)return[{key:null,x1:e,y1:t,x2:i,y2:r}];for(let e=0;e<this.boxKeys.length;e++)s.push({key:this.boxKeys[e],x1:this.bboxes[4*e],y1:this.bboxes[4*e+1],x2:this.bboxes[4*e+2],y2:this.bboxes[4*e+3]});for(let e=0;e<this.circleKeys.length;e++){const t=this.circles[3*e],i=this.circles[3*e+1],r=this.circles[3*e+2];s.push({key:this.circleKeys[e],x1:t-r,y1:i-r,x2:t+r,y2:i+r})}}else this._forEachCell(e,t,i,r,this._queryCell,s,{hitTest:n,overlapMode:o,seenUids:{box:{},circle:{}}},a);return s}query(e,t,i,r){return this._query(e,t,i,r,!1,null)}hitTest(e,t,i,r,n,o){return this._query(e,t,i,r,!0,n,o).length>0}hitTestCircle(e,t,i,r,n){const o=e-i,a=e+i,s=t-i,l=t+i;if(a<0||o>this.width||l<0||s>this.height)return!1;const c=[];return this._forEachCell(o,s,a,l,this._queryCellCircle,c,{hitTest:!0,overlapMode:r,circle:{x:e,y:t,radius:i},seenUids:{box:{},circle:{}}},n),c.length>0}_queryCell(e,t,i,r,n,o,a,s){const{seenUids:l,hitTest:c,overlapMode:u}=a,h=this.boxCells[n];if(null!==h){const n=this.bboxes;for(const a of h)if(!l.box[a]){l.box[a]=!0;const h=4*a,p=this.boxKeys[a];if(e<=n[h+2]&&t<=n[h+3]&&i>=n[h+0]&&r>=n[h+1]&&(!s||s(p))&&(!c||!ge(u,p.overlapMode))&&(o.push({key:p,x1:n[h],y1:n[h+1],x2:n[h+2],y2:n[h+3]}),c))return!0}}const p=this.circleCells[n];if(null!==p){const n=this.circles;for(const a of p)if(!l.circle[a]){l.circle[a]=!0;const h=3*a,p=this.circleKeys[a];if(this._circleAndRectCollide(n[h],n[h+1],n[h+2],e,t,i,r)&&(!s||s(p))&&(!c||!ge(u,p.overlapMode))){const e=n[h],t=n[h+1],i=n[h+2];if(o.push({key:p,x1:e-i,y1:t-i,x2:e+i,y2:t+i}),c)return!0}}}return!1}_queryCellCircle(e,t,i,r,n,o,a,s){const{circle:l,seenUids:c,overlapMode:u}=a,h=this.boxCells[n];if(null!==h){const e=this.bboxes;for(const t of h)if(!c.box[t]){c.box[t]=!0;const i=4*t,r=this.boxKeys[t];if(this._circleAndRectCollide(l.x,l.y,l.radius,e[i+0],e[i+1],e[i+2],e[i+3])&&(!s||s(r))&&!ge(u,r.overlapMode))return o.push(!0),!0}}const p=this.circleCells[n];if(null!==p){const e=this.circles;for(const t of p)if(!c.circle[t]){c.circle[t]=!0;const i=3*t,r=this.circleKeys[t];if(this._circlesCollide(e[i],e[i+1],e[i+2],l.x,l.y,l.radius)&&(!s||s(r))&&!ge(u,r.overlapMode))return o.push(!0),!0}}}_forEachCell(e,t,i,r,n,o,a,s){const l=this._convertToXCellCoord(e),c=this._convertToYCellCoord(t),u=this._convertToXCellCoord(i),h=this._convertToYCellCoord(r);for(let p=l;p<=u;p++)for(let l=c;l<=h;l++)if(n.call(this,e,t,i,r,this.xCellCount*l+p,o,a,s))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,r,n,o){const a=r-e,s=n-t,l=i+o;return l*l>a*a+s*s}_circleAndRectCollide(e,t,i,r,n,o,a){const s=(o-r)/2,l=Math.abs(e-(r+s));if(l>s+i)return!1;const c=(a-n)/2,u=Math.abs(t-(n+c));if(u>c+i)return!1;if(l<=s||u<=c)return!0;const h=l-s,p=u-c;return h*h+p*p<=i*i}}function _e(e,i,n){const o=t.K();if(!e){const{vecSouth:e,vecEast:t}=xe(i),n=r();n[0]=t[0],n[1]=t[1],n[2]=e[0],n[3]=e[1],a=n,(p=(l=(s=n)[0])*(h=s[3])-(u=s[2])*(c=s[1]))&&(a[0]=h*(p=1/p),a[1]=-c*p,a[2]=-u*p,a[3]=l*p),o[0]=n[0],o[1]=n[1],o[4]=n[2],o[5]=n[3]}var a,s,l,c,u,h,p;return t.M(o,o,[1/n,1/n,1]),o}function ve(e,i,r,n){if(e){const e=t.K();if(!i){const{vecSouth:t,vecEast:i}=xe(r);e[0]=i[0],e[1]=i[1],e[4]=t[0],e[5]=t[1]}return t.M(e,e,[n,n,1]),e}return r.pixelsToClipSpaceMatrix}function xe(e){const i=Math.cos(e.rollInRadians),r=Math.sin(e.rollInRadians),n=Math.cos(e.pitchInRadians),o=Math.cos(e.bearingInRadians),a=Math.sin(e.bearingInRadians),s=t.ak();s[0]=-o*n*r-a*i,s[1]=-a*n*r+o*i;const l=t.al(s);l<1e-9?t.am(s):t.an(s,s,1/l);const c=t.ak();c[0]=o*n*i-a*r,c[1]=a*n*i+o*r;const u=t.al(c);return u<1e-9?t.am(c):t.an(c,c,1/u),{vecEast:c,vecSouth:s}}function be(e,i,r,n){let o;n?(o=[e,i,n(e,i),1],t.ap(o,o,r)):(o=[e,i,0,1],Oe(o,o,r));const a=o[3];return{point:new t.P(o[0]/a,o[1]/a),signedDistanceFromCamera:a,isOccluded:!1}}function we(e,t){return.5+e/t*.5}function Ce(e,t){return e.x>=-t[0]&&e.x<=t[0]&&e.y>=-t[1]&&e.y<=t[1]}function Te(e,i,r,n,o,a,s,l,c,u,h,p,d){const m=r?e.textSizeData:e.iconSizeData,f=t.ag(m,i.transform.zoom),g=[256/i.width*2+1,256/i.height*2+1],y=r?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;y.clear();const _=e.lineVertexArray,v=r?e.text.placedSymbolArray:e.icon.placedSymbolArray,x=i.transform.width/i.transform.height;let b=!1;for(let r=0;r<v.length;r++){const w=v.get(r);if(w.hidden||w.writingMode===t.ah.vertical&&!b){Be(w.numGlyphs,y);continue}b=!1;const C=new t.P(w.anchorX,w.anchorY),T={getElevation:d,pitchedLabelPlaneMatrix:n,lineVertexArray:_,pitchWithMap:a,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:i.transform,tileAnchorPoint:C,unwrappedTileID:c,width:u,height:h,translation:p},S=ze(w.anchorX,w.anchorY,T);if(!Ce(S.point,g)){Be(w.numGlyphs,y);continue}const A=we(i.transform.cameraToCenterDistance,S.signedDistanceFromCamera),M=t.ai(m,f,w),E=a?M*i.transform.getPitchedTextCorrection(w.anchorX,w.anchorY,c)/A:M*A,P=Me({projectionContext:T,pitchedLabelPlaneMatrixInverse:o,symbol:w,fontSize:E,flip:!1,keepUpright:s,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:y,aspectRatio:x,rotateToLine:l});b=P.useVertical,(P.notEnoughRoom||b||P.needsFlipping&&Me({projectionContext:T,pitchedLabelPlaneMatrixInverse:o,symbol:w,fontSize:E,flip:!0,keepUpright:s,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:y,aspectRatio:x,rotateToLine:l}).notEnoughRoom)&&Be(w.numGlyphs,y)}r?e.text.dynamicLayoutVertexBuffer.updateData(y):e.icon.dynamicLayoutVertexBuffer.updateData(y)}function Se(e,t,i,r,n,o,a,s){const l=o.glyphStartIndex+o.numGlyphs,c=o.lineStartIndex,u=o.lineStartIndex+o.lineLength,h=t.getoffsetX(o.glyphStartIndex),p=t.getoffsetX(l-1),d=Fe(e*h,i,r,n,o.segment,c,u,s,a);if(!d)return null;const m=Fe(e*p,i,r,n,o.segment,c,u,s,a);return m?s.projectionCache.anyProjectionOccluded?null:{first:d,last:m}:null}function Ae(e,i,r,n){return e===t.ah.horizontal&&Math.abs(r.y-i.y)>Math.abs(r.x-i.x)*n?{useVertical:!0}:(e===t.ah.vertical?i.y<r.y:i.x>r.x)?{needsFlipping:!0}:null}function Me(e){const{projectionContext:i,pitchedLabelPlaneMatrixInverse:r,symbol:n,fontSize:o,flip:a,keepUpright:s,glyphOffsetArray:l,dynamicLayoutVertexArray:c,aspectRatio:u,rotateToLine:h}=e,p=o/24,d=n.lineOffsetX*p,m=n.lineOffsetY*p;let f;if(n.numGlyphs>1){const e=n.glyphStartIndex+n.numGlyphs,t=n.lineStartIndex,o=n.lineStartIndex+n.lineLength,c=Se(p,l,d,m,a,n,h,i);if(!c)return{notEnoughRoom:!0};const g=ke(c.first.point.x,c.first.point.y,i,r),y=ke(c.last.point.x,c.last.point.y,i,r);if(s&&!a){const e=Ae(n.writingMode,g,y,u);if(e)return e}f=[c.first];for(let r=n.glyphStartIndex+1;r<e-1;r++)f.push(Fe(p*l.getoffsetX(r),d,m,a,n.segment,t,o,i,h));f.push(c.last)}else{if(s&&!a){const e=Ie(i.tileAnchorPoint.x,i.tileAnchorPoint.y,i).point,o=n.lineStartIndex+n.segment+1,a=new t.P(i.lineVertexArray.getx(o),i.lineVertexArray.gety(o)),s=Ie(a.x,a.y,i),l=s.signedDistanceFromCamera>0?s.point:Ee(i.tileAnchorPoint,a,e,1,i),c=ke(e.x,e.y,i,r),h=ke(l.x,l.y,i,r),p=Ae(n.writingMode,c,h,u);if(p)return p}const e=Fe(p*l.getoffsetX(n.glyphStartIndex),d,m,a,n.segment,n.lineStartIndex,n.lineStartIndex+n.lineLength,i,h);if(!e||i.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};f=[e]}for(const e of f)t.ao(c,e.point,e.angle);return{}}function Ee(e,t,i,r,n){const o=e.add(e.sub(t)._unit()),a=Ie(o.x,o.y,n).point,s=i.sub(a);return i.add(s._mult(r/s.mag()))}function Pe(e,i,r){const n=i.projectionCache;if(n.projections[e])return n.projections[e];const o=new t.P(i.lineVertexArray.getx(e),i.lineVertexArray.gety(e)),a=Ie(o.x,o.y,i);if(a.signedDistanceFromCamera>0)return n.projections[e]=a.point,n.anyProjectionOccluded=n.anyProjectionOccluded||a.isOccluded,a.point;const s=e-r.direction;return Ee(0===r.distanceFromAnchor?i.tileAnchorPoint:new t.P(i.lineVertexArray.getx(s),i.lineVertexArray.gety(s)),o,r.previousVertex,r.absOffsetX-r.distanceFromAnchor+1,i)}function Ie(e,t,i){const r=e+i.translation[0],n=t+i.translation[1];let o;return i.pitchWithMap?(o=be(r,n,i.pitchedLabelPlaneMatrix,i.getElevation),o.isOccluded=!1):(o=i.transform.projectTileCoordinates(r,n,i.unwrappedTileID,i.getElevation),o.point.x=(.5*o.point.x+.5)*i.width,o.point.y=(.5*-o.point.y+.5)*i.height),o}function ke(e,i,r,n){if(r.pitchWithMap){const o=[e,i,0,1];return t.ap(o,o,n),r.transform.projectTileCoordinates(o[0]/o[3],o[1]/o[3],r.unwrappedTileID,r.getElevation).point}return{x:e/r.width*2-1,y:i/r.height*2-1}}function ze(e,t,i){return i.transform.projectTileCoordinates(e,t,i.unwrappedTileID,i.getElevation)}function Le(e,t,i){return e._unit()._perp()._mult(t*i)}function De(e,i,r,n,o,a,s,l,c){if(l.projectionCache.offsets[e])return l.projectionCache.offsets[e];const u=r.add(i);if(e+c.direction<n||e+c.direction>=o)return l.projectionCache.offsets[e]=u,u;const h=Pe(e+c.direction,l,c),p=Le(h.sub(r),s,c.direction),d=r.add(p),m=h.add(p);return l.projectionCache.offsets[e]=t.aq(a,u,d,m)||u,l.projectionCache.offsets[e]}function Fe(e,t,i,r,n,o,a,s,l){const c=r?e-t:e+t;let u=c>0?1:-1,h=0;r&&(u*=-1,h=Math.PI),u<0&&(h+=Math.PI);let p,d=u>0?o+n:o+n+1;s.projectionCache.cachedAnchorPoint?p=s.projectionCache.cachedAnchorPoint:(p=Ie(s.tileAnchorPoint.x,s.tileAnchorPoint.y,s).point,s.projectionCache.cachedAnchorPoint=p);let m,f,g=p,y=p,_=0,v=0;const x=Math.abs(c),b=[];let w;for(;_+v<=x;){if(d+=u,d<o||d>=a)return null;_+=v,y=g,f=m;const e={absOffsetX:x,direction:u,distanceFromAnchor:_,previousVertex:y};if(g=Pe(d,s,e),0===i)b.push(y),w=g.sub(y);else{let t;const r=g.sub(y);t=0===r.mag()?Le(Pe(d+u,s,e).sub(g),i,u):Le(r,i,u),f||(f=y.add(t)),m=De(d,t,g,o,a,f,i,s,e),b.push(f),w=m.sub(f)}v=w.mag()}const C=w._mult((x-_)/v)._add(f||y),T=h+Math.atan2(g.y-y.y,g.x-y.x);return b.push(C),{point:C,angle:l?T:0,path:b}}const Re=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Be(e,t){for(let i=0;i<e;i++){const e=t.length;t.resize(e+4),t.float32.set(Re,3*e)}}function Oe(e,t,i){const r=t[0],n=t[1];return e[0]=i[0]*r+i[4]*n+i[12],e[1]=i[1]*r+i[5]*n+i[13],e[3]=i[3]*r+i[7]*n+i[15],e}const je=100;class Ne{constructor(e,t=new ye(e.width+200,e.height+200,25),i=new ye(e.width+200,e.height+200,25)){this.transform=e,this.grid=t,this.ignoredGrid=i,this.pitchFactor=Math.cos(e.pitch*Math.PI/180)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+je,this.screenBottomBoundary=e.height+je,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,t,i,r,n,o,a,s,l,c,u,h){const p=this.projectAndGetPerspectiveRatio(e.anchorPointX+s[0],e.anchorPointY+s[1],n,c,h),d=i*p.perspectiveRatio;let m;if(o||a)m=this._projectCollisionBox(e,d,r,n,o,a,s,p,c,u,h);else{const t=p.x+(u?u.x*d:0),i=p.y+(u?u.y*d:0);m={allPointsOccluded:!1,box:[t+e.x1*d,i+e.y1*d,t+e.x2*d,i+e.y2*d]}}const[f,g,y,_]=m.box,v=o?m.allPointsOccluded:p.isOccluded;let x=v;return x||(x=p.perspectiveRatio<this.perspectiveRatioCutoff),x||(x=!this.isInsideGrid(f,g,y,_)),x||"always"!==t&&this.grid.hitTest(f,g,y,_,t,l)?{box:[f,g,y,_],placeable:!1,offscreen:!1,occluded:v}:{box:[f,g,y,_],placeable:!0,offscreen:this.isOffscreen(f,g,y,_),occluded:v}}placeCollisionCircles(e,i,r,n,o,a,s,l,c,u,h,p,d,m){const f=[],g=new t.P(i.anchorX,i.anchorY),y=this.getPerspectiveRatio(g.x,g.y,a,m),_=(c?o*this.transform.getPitchedTextCorrection(i.anchorX,i.anchorY,a)/y:o*y)/t.av,v={getElevation:m,pitchedLabelPlaneMatrix:s,lineVertexArray:r,pitchWithMap:c,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:g,unwrappedTileID:a,width:this.transform.width,height:this.transform.height,translation:d},x=Se(_,n,i.lineOffsetX*_,i.lineOffsetY*_,!1,i,!1,v);let b=!1,w=!1,C=!0;if(x){const i=.5*h*y+p,r=new t.P(-100,-100),n=new t.P(this.screenRightBoundary,this.screenBottomBoundary),o=new fe,a=x.first,s=x.last;let d=[];for(let e=a.path.length-1;e>=1;e--)d.push(a.path[e]);for(let e=1;e<s.path.length;e++)d.push(s.path[e]);const m=2.5*i;if(c){const e=this.projectPathToScreenSpace(d,v);d=e.some((e=>e.signedDistanceFromCamera<=0))?[]:e.map((e=>e.point))}let g=[];if(d.length>0){const e=d[0].clone(),i=d[0].clone();for(let t=1;t<d.length;t++)e.x=Math.min(e.x,d[t].x),e.y=Math.min(e.y,d[t].y),i.x=Math.max(i.x,d[t].x),i.y=Math.max(i.y,d[t].y);g=e.x>=r.x&&i.x<=n.x&&e.y>=r.y&&i.y<=n.y?[d]:i.x<r.x||e.x>n.x||i.y<r.y||e.y>n.y?[]:t.ar([d],r.x,r.y,n.x,n.y)}for(const t of g){o.reset(t,.25*i);let r=0;r=o.length<=.5*i?1:Math.ceil(o.paddedLength/m)+1;for(let t=0;t<r;t++){const n=t/Math.max(r-1,1),a=o.lerp(n),s=a.x+je,c=a.y+je;f.push(s,c,i,0);const h=s-i,p=c-i,d=s+i,m=c+i;if(C=C&&this.isOffscreen(h,p,d,m),w=w||this.isInsideGrid(h,p,d,m),"always"!==e&&this.grid.hitTestCircle(s,c,i,e,u)&&(b=!0,!l))return{circles:[],offscreen:!1,collisionDetected:b}}}}return{circles:!l&&b||!w||y<this.perspectiveRatioCutoff?[]:f,offscreen:C,collisionDetected:b}}projectPathToScreenSpace(e,i){const r=function(e,i){const r=t.K();return t.aj(r,i.pitchedLabelPlaneMatrix),e.map((e=>{const t=be(e.x,e.y,r,i.getElevation),n=i.transform.projectTileCoordinates(t.point.x,t.point.y,i.unwrappedTileID,i.getElevation);return n.point.x=(.5*n.point.x+.5)*i.width,n.point.y=(.5*-n.point.y+.5)*i.height,n}))}(e,i);return function(e){let t=0,i=0,r=0,n=0;for(let o=0;o<e.length;o++)e[o].isOccluded?(r=o+1,n=0):(n++,n>i&&(i=n,t=r));return e.slice(t,t+i)}(r)}queryRenderedSymbols(e){if(0===e.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};const i=[];let r=1/0,n=1/0,o=-1/0,a=-1/0;for(const s of e){const e=new t.P(s.x+je,s.y+je);r=Math.min(r,e.x),n=Math.min(n,e.y),o=Math.max(o,e.x),a=Math.max(a,e.y),i.push(e)}const s=this.grid.query(r,n,o,a).concat(this.ignoredGrid.query(r,n,o,a)),l={},c={};for(const e of s){const r=e.key;if(void 0===l[r.bucketInstanceId]&&(l[r.bucketInstanceId]={}),l[r.bucketInstanceId][r.featureIndex])continue;const n=[new t.P(e.x1,e.y1),new t.P(e.x2,e.y1),new t.P(e.x2,e.y2),new t.P(e.x1,e.y2)];t.as(i,n)&&(l[r.bucketInstanceId][r.featureIndex]=!0,void 0===c[r.bucketInstanceId]&&(c[r.bucketInstanceId]=[]),c[r.bucketInstanceId].push(r.featureIndex))}return c}insertCollisionBox(e,t,i,r,n,o){(i?this.ignoredGrid:this.grid).insert({bucketInstanceId:r,featureIndex:n,collisionGroupID:o,overlapMode:t},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,i,r,n,o){const a=i?this.ignoredGrid:this.grid,s={bucketInstanceId:r,featureIndex:n,collisionGroupID:o,overlapMode:t};for(let t=0;t<e.length;t+=4)a.insertCircle(s,e[t],e[t+1],e[t+2])}projectAndGetPerspectiveRatio(e,i,r,n,o){if(o){let r;n?(r=[e,i,n(e,i),1],t.ap(r,r,o)):(r=[e,i,0,1],Oe(r,r,o));const a=r[3];return{x:(r[0]/a+1)/2*this.transform.width+je,y:(-r[1]/a+1)/2*this.transform.height+je,perspectiveRatio:.5+this.transform.cameraToCenterDistance/a*.5,isOccluded:!1,signedDistanceFromCamera:a}}{const t=this.transform.projectTileCoordinates(e,i,r,n);return{x:(t.point.x+1)/2*this.transform.width+je,y:(1-t.point.y)/2*this.transform.height+je,perspectiveRatio:.5+this.transform.cameraToCenterDistance/t.signedDistanceFromCamera*.5,isOccluded:t.isOccluded,signedDistanceFromCamera:t.signedDistanceFromCamera}}}getPerspectiveRatio(e,t,i,r){const n=this.transform.projectTileCoordinates(e,t,i,r);return.5+this.transform.cameraToCenterDistance/n.signedDistanceFromCamera*.5}isOffscreen(e,t,i,r){return i<je||e>=this.screenRightBoundary||r<je||t>this.screenBottomBoundary}isInsideGrid(e,t,i,r){return i>=0&&e<this.gridRightBoundary&&r>=0&&t<this.gridBottomBoundary}getViewportMatrix(){const e=t.at([]);return t.L(e,e,[-100,-100,0]),e}_projectCollisionBox(e,i,r,n,o,a,s,l,c,u,h){let p=1,d=0,m=0,f=1;const g=e.anchorPointX+s[0],y=e.anchorPointY+s[1];if(a&&!o){const e=this.projectAndGetPerspectiveRatio(g+1,y,n,c,h),t=e.x-l.x,i=Math.atan((e.y-l.y)/t)+(t<0?Math.PI:0),r=Math.sin(i),o=Math.cos(i);p=o,d=r,m=-r,f=o}else if(!a&&o){const e=xe(this.transform);p=e.vecEast[0],d=e.vecEast[1],m=e.vecSouth[0],f=e.vecSouth[1]}let _=l.x,v=l.y,x=i;o&&(_=g,v=y,x=Math.pow(2,-(this.transform.zoom-r.overscaledZ)),x*=this.transform.getPitchedTextCorrection(g,y,n),u||(x*=t.ae(.5+l.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),u&&(_+=p*u.x*x+m*u.y*x,v+=d*u.x*x+f*u.y*x);const b=e.x1*x,w=e.x2*x,C=(b+w)/2,T=e.y1*x,S=e.y2*x,A=(T+S)/2,M=[{offsetX:b,offsetY:T},{offsetX:C,offsetY:T},{offsetX:w,offsetY:T},{offsetX:w,offsetY:A},{offsetX:w,offsetY:S},{offsetX:C,offsetY:S},{offsetX:b,offsetY:S},{offsetX:b,offsetY:A}];let E=[];for(const{offsetX:e,offsetY:i}of M)E.push(new t.P(_+p*e+m*i,v+d*e+f*i));let P=!1;if(o){const e=E.map((e=>this.projectAndGetPerspectiveRatio(e.x,e.y,n,c,h)));P=e.some((e=>!e.isOccluded)),E=e.map((e=>new t.P(e.x,e.y)))}else P=!0;return{box:t.au(E),allPointsOccluded:!P}}}class $e{constructor(e,t,i,r){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):r&&i?1:0,this.placed=i}isHidden(){return 0===this.opacity&&!this.placed}}class Ve{constructor(e,t,i,r,n){this.text=new $e(e?e.text:null,t,i,n),this.icon=new $e(e?e.icon:null,t,r,n)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Ue{constructor(e,t,i){this.text=e,this.icon=t,this.skipFade=i}}class qe{constructor(e,t,i,r,n){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=i,this.bucketIndex=r,this.tileID=n}}class Ze{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){const t=++this.maxGroupID;this.collisionGroups[e]={ID:t,predicate:e=>e.collisionGroupID===t}}return this.collisionGroups[e]}}function Ge(e,i,r,n,o){const{horizontalAlign:a,verticalAlign:s}=t.aB(e);return new t.P(-(a-.5)*i+n[0]*o,-(s-.5)*r+n[1]*o)}class He{constructor(e,t,i,r,n){this.transform=e.clone(),this.terrain=t,this.collisionIndex=new Ne(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new Ze(r),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){const t=this.terrain;return t?(i,r)=>t.getElevation(e,i,r):null}getBucketParts(e,i,r,n){const o=r.getBucket(i),a=r.latestFeatureIndex;if(!o||!a||i.id!==o.layerIds[0])return;const s=r.collisionBoxArray,l=o.layers[0].layout,c=o.layers[0].paint,u=Math.pow(2,this.transform.zoom-r.tileID.overscaledZ),h=r.tileSize/t.Z,p=r.tileID.toUnwrapped(),d="map"===l.get("text-rotation-alignment"),m=t.aw(r,1,this.transform.zoom),f=t.ax(this.collisionIndex.transform,r,c.get("text-translate"),c.get("text-translate-anchor")),g=t.ax(this.collisionIndex.transform,r,c.get("icon-translate"),c.get("icon-translate-anchor")),y=_e(d,this.transform,m);this.retainedQueryData[o.bucketInstanceId]=new qe(o.bucketInstanceId,a,o.sourceLayerIndex,o.index,r.tileID);const _={bucket:o,layout:l,translationText:f,translationIcon:g,unwrappedTileID:p,pitchedLabelPlaneMatrix:y,scale:u,textPixelRatio:h,holdingForFade:r.holdingForFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:t.ag(o.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(n)for(const t of o.sortKeyRanges){const{sortKey:i,symbolInstanceStart:r,symbolInstanceEnd:n}=t;e.push({sortKey:i,symbolInstanceStart:r,symbolInstanceEnd:n,parameters:_})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:_})}attemptAnchorPlacement(e,i,r,n,o,a,s,l,c,u,h,p,d,m,f,g,y,_,v,x){const b=t.ay[e.textAnchor],w=[e.textOffset0,e.textOffset1],C=Ge(b,r,n,w,o),T=this.collisionIndex.placeCollisionBox(i,p,l,c,u,s,a,g,h.predicate,v,C,x);if((!_||this.collisionIndex.placeCollisionBox(_,p,l,c,u,s,a,y,h.predicate,v,C,x).placeable)&&T.placeable){let e;if(this.prevPlacement&&this.prevPlacement.variableOffsets[d.crossTileID]&&this.prevPlacement.placements[d.crossTileID]&&this.prevPlacement.placements[d.crossTileID].text&&(e=this.prevPlacement.variableOffsets[d.crossTileID].anchor),0===d.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[d.crossTileID]={textOffset:w,width:r,height:n,anchor:b,textBoxScale:o,prevAnchor:e},this.markUsedJustification(m,b,d,f),m.allowVerticalPlacement&&(this.markUsedOrientation(m,f,d),this.placedOrientations[d.crossTileID]=f),{shift:C,placedGlyphBoxes:T}}}placeLayerBucketPart(e,i,r){const{bucket:n,layout:o,translationText:a,translationIcon:s,unwrappedTileID:l,pitchedLabelPlaneMatrix:c,textPixelRatio:u,holdingForFade:h,collisionBoxArray:p,partiallyEvaluatedTextSize:d,collisionGroup:m}=e.parameters,f=o.get("text-optional"),g=o.get("icon-optional"),y=t.az(o,"text-overlap","text-allow-overlap"),_="always"===y,v=t.az(o,"icon-overlap","icon-allow-overlap"),x="always"===v,b="map"===o.get("text-rotation-alignment"),w="map"===o.get("text-pitch-alignment"),C="none"!==o.get("icon-text-fit"),T="viewport-y"===o.get("symbol-z-order"),S=_&&(x||!n.hasIconData()||g),A=x&&(_||!n.hasTextData()||f);!n.collisionArrays&&p&&n.deserializeCollisionBoxes(p);const M=this.retainedQueryData[n.bucketInstanceId].tileID,E=this._getTerrainElevationFunc(M),P=this.transform.getFastPathSimpleProjectionMatrix(M),I=(e,p,x)=>{var T,I;if(i[e.crossTileID])return;if(h)return void(this.placements[e.crossTileID]=new Ue(!1,!1,!1));let k=!1,z=!1,L=!0,D=null,F={box:null,placeable:!1,offscreen:null,occluded:!1},R={placeable:!1},B=null,O=null,j=null,N=0,$=0,V=0;p.textFeatureIndex?N=p.textFeatureIndex:e.useRuntimeCollisionCircles&&(N=e.featureIndex),p.verticalTextFeatureIndex&&($=p.verticalTextFeatureIndex);const U=p.textBox;if(U){const i=i=>{let r=t.ah.horizontal;if(n.allowVerticalPlacement&&!i&&this.prevPlacement){const t=this.prevPlacement.placedOrientations[e.crossTileID];t&&(this.placedOrientations[e.crossTileID]=t,r=t,this.markUsedOrientation(n,r,e))}return r},o=(i,r)=>{if(n.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&p.verticalTextBox){for(const e of n.writingModes)if(e===t.ah.vertical?(F=r(),R=F):F=i(),F&&F.placeable)break}else F=i()},c=e.textAnchorOffsetStartIndex,h=e.textAnchorOffsetEndIndex;if(h===c){const r=(t,i)=>{const r=this.collisionIndex.placeCollisionBox(t,y,u,M,l,w,b,a,m.predicate,E,void 0,P);return r&&r.placeable&&(this.markUsedOrientation(n,i,e),this.placedOrientations[e.crossTileID]=i),r};o((()=>r(U,t.ah.horizontal)),(()=>{const i=p.verticalTextBox;return n.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&i?r(i,t.ah.vertical):{box:null,offscreen:null}})),i(F&&F.placeable)}else{let d=t.ay[null===(I=null===(T=this.prevPlacement)||void 0===T?void 0:T.variableOffsets[e.crossTileID])||void 0===I?void 0:I.anchor];const f=(t,i,o)=>{const p=t.x2-t.x1,f=t.y2-t.y1,g=e.textBoxScale,_=C&&"never"===v?i:null;let x=null,T="never"===y?1:2,S="never";d&&T++;for(let i=0;i<T;i++){for(let i=c;i<h;i++){const r=n.textAnchorOffsets.get(i);if(d&&r.textAnchor!==d)continue;const c=this.attemptAnchorPlacement(r,t,p,f,g,b,w,u,M,l,m,S,e,n,o,a,s,_,E);if(c&&(x=c.placedGlyphBoxes,x&&x.placeable))return k=!0,D=c.shift,x}d?d=null:S=y}return r&&!x&&(x={box:this.collisionIndex.placeCollisionBox(U,"always",u,M,l,w,b,a,m.predicate,E,void 0,P).box,offscreen:!1,placeable:!1,occluded:!1}),x};o((()=>f(U,p.iconBox,t.ah.horizontal)),(()=>{const i=p.verticalTextBox;return n.allowVerticalPlacement&&(!F||!F.placeable)&&e.numVerticalGlyphVertices>0&&i?f(i,p.verticalIconBox,t.ah.vertical):{box:null,occluded:!0,offscreen:null}})),F&&(k=F.placeable,L=F.offscreen);const g=i(F&&F.placeable);if(!k&&this.prevPlacement){const t=this.prevPlacement.variableOffsets[e.crossTileID];t&&(this.variableOffsets[e.crossTileID]=t,this.markUsedJustification(n,t.anchor,e,g))}}}if(B=F,k=B&&B.placeable,L=B&&B.offscreen,e.useRuntimeCollisionCircles){const i=n.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),s=t.ai(n.textSizeData,d,i),u=o.get("text-padding");O=this.collisionIndex.placeCollisionCircles(y,i,n.lineVertexArray,n.glyphOffsetArray,s,l,c,r,w,m.predicate,e.collisionCircleDiameter,u,a,E),O.circles.length&&O.collisionDetected&&!r&&t.w("Collisions detected, but collision boxes are not shown"),k=_||O.circles.length>0&&!O.collisionDetected,L=L&&O.offscreen}if(p.iconFeatureIndex&&(V=p.iconFeatureIndex),p.iconBox){const e=e=>this.collisionIndex.placeCollisionBox(e,v,u,M,l,w,b,s,m.predicate,E,C&&D?D:void 0,P);R&&R.placeable&&p.verticalIconBox?(j=e(p.verticalIconBox),z=j.placeable):(j=e(p.iconBox),z=j.placeable),L=L&&j.offscreen}const q=f||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,Z=g||0===e.numIconVertices;q||Z?Z?q||(z=z&&k):k=z&&k:z=k=z&&k;const G=z&&j.placeable;if(k&&B.placeable&&this.collisionIndex.insertCollisionBox(B.box,y,o.get("text-ignore-placement"),n.bucketInstanceId,R&&R.placeable&&$?$:N,m.ID),G&&this.collisionIndex.insertCollisionBox(j.box,v,o.get("icon-ignore-placement"),n.bucketInstanceId,V,m.ID),O&&k&&this.collisionIndex.insertCollisionCircles(O.circles,y,o.get("text-ignore-placement"),n.bucketInstanceId,N,m.ID),r&&this.storeCollisionData(n.bucketInstanceId,x,p,B,j,O),0===e.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");if(0===n.bucketInstanceId)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[e.crossTileID]=new Ue((k||S)&&!(null==B?void 0:B.occluded),(z||A)&&!(null==j?void 0:j.occluded),L||n.justReloaded),i[e.crossTileID]=!0};if(T){if(0!==e.symbolInstanceStart)throw new Error("bucket.bucketInstanceId should be 0");const t=n.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let e=t.length-1;e>=0;--e){const i=t[e];I(n.symbolInstances.get(i),n.collisionArrays[i],i)}}else for(let t=e.symbolInstanceStart;t<e.symbolInstanceEnd;t++)I(n.symbolInstances.get(t),n.collisionArrays[t],t);n.justReloaded=!1}storeCollisionData(e,t,i,r,n,o){if(i.textBox||i.iconBox){let o,a;this.collisionBoxArrays.has(e)?o=this.collisionBoxArrays.get(e):(o=new Map,this.collisionBoxArrays.set(e,o)),o.has(t)?a=o.get(t):(a={text:null,icon:null},o.set(t,a)),i.textBox&&(a.text=r.box),i.iconBox&&(a.icon=n.box)}if(o){let t=this.collisionCircleArrays[e];void 0===t&&(t=this.collisionCircleArrays[e]=[]);for(let e=0;e<o.circles.length;e+=4)t.push(o.circles[e+0]-je),t.push(o.circles[e+1]-je),t.push(o.circles[e+2]),t.push(o.collisionDetected?1:0)}}markUsedJustification(e,i,r,n){let o;o=n===t.ah.vertical?r.verticalPlacedTextSymbolIndex:{left:r.leftJustifiedTextSymbolIndex,center:r.centerJustifiedTextSymbolIndex,right:r.rightJustifiedTextSymbolIndex}[t.aA(i)];const a=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex,r.verticalPlacedTextSymbolIndex];for(const t of a)t>=0&&(e.text.placedSymbolArray.get(t).crossTileID=o>=0&&t!==o?0:r.crossTileID)}markUsedOrientation(e,i,r){const n=i===t.ah.horizontal||i===t.ah.horizontalOnly?i:0,o=i===t.ah.vertical?i:0,a=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex];for(const t of a)e.text.placedSymbolArray.get(t).placedOrientation=n;r.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).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 r=t?t.symbolFadeChange(e):1,n=t?t.opacities:{},o=t?t.variableOffsets:{},a=t?t.placedOrientations:{};for(const e in this.placements){const t=this.placements[e],o=n[e];o?(this.opacities[e]=new Ve(o,r,t.text,t.icon),i=i||t.text!==o.text.placed||t.icon!==o.icon.placed):(this.opacities[e]=new Ve(null,r,t.text,t.icon,t.skipFade),i=i||t.text||t.icon)}for(const e in n){const t=n[e];if(!this.opacities[e]){const n=new Ve(t,r,!1,!1);n.isHidden()||(this.opacities[e]=n,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 a)this.placedOrientations[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.placedOrientations[e]=a[e]);if(t&&void 0===t.lastPlacementChangeTime)throw new Error("Last placement time for previous placement is not defined");i?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t){const i={};for(const r of t){const t=r.getBucket(e);t&&r.latestFeatureIndex&&e.id===t.layerIds[0]&&this.updateBucketOpacities(t,r.tileID,i,r.collisionBoxArray)}}updateBucketOpacities(e,i,r,n){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();const o=e.layers[0],a=o.layout,s=new Ve(null,0,!1,!1,!0),l=a.get("text-allow-overlap"),c=a.get("icon-allow-overlap"),u=o._unevaluatedLayout.hasValue("text-variable-anchor")||o._unevaluatedLayout.hasValue("text-variable-anchor-offset"),h="map"===a.get("text-rotation-alignment"),p="map"===a.get("text-pitch-alignment"),d="none"!==a.get("icon-text-fit"),m=new Ve(null,0,l&&(c||!e.hasIconData()||a.get("icon-optional")),c&&(l||!e.hasTextData()||a.get("text-optional")),!0);!e.collisionArrays&&n&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(n);const f=(e,t,i)=>{for(let r=0;r<t/4;r++)e.opacityVertexArray.emplaceBack(i);e.hasVisibleVertices=e.hasVisibleVertices||i!==rt},g=this.collisionBoxArrays.get(e.bucketInstanceId);for(let i=0;i<e.symbolInstances.length;i++){const n=e.symbolInstances.get(i),{numHorizontalGlyphVertices:o,numVerticalGlyphVertices:a,crossTileID:l}=n;let c=this.opacities[l];r[l]?c=s:c||(c=m,this.opacities[l]=c),r[l]=!0;const y=n.numIconVertices>0,_=this.placedOrientations[n.crossTileID],v=_===t.ah.vertical,x=_===t.ah.horizontal||_===t.ah.horizontalOnly;if(o>0||a>0){const t=it(c.text);f(e.text,o,v?rt:t),f(e.text,a,x?rt:t);const i=c.text.isHidden();[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex].forEach((t=>{t>=0&&(e.text.placedSymbolArray.get(t).hidden=i||v?1:0)})),n.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(n.verticalPlacedTextSymbolIndex).hidden=i||x?1:0);const r=this.variableOffsets[n.crossTileID];r&&this.markUsedJustification(e,r.anchor,n,_);const s=this.placedOrientations[n.crossTileID];s&&(this.markUsedJustification(e,"left",n,s),this.markUsedOrientation(e,s,n))}if(y){const t=it(c.icon),i=!(d&&n.verticalPlacedIconSymbolIndex&&v);n.placedIconSymbolIndex>=0&&(f(e.icon,n.numIconVertices,i?t:rt),e.icon.placedSymbolArray.get(n.placedIconSymbolIndex).hidden=c.icon.isHidden()),n.verticalPlacedIconSymbolIndex>=0&&(f(e.icon,n.numVerticalIconVertices,i?rt:t),e.icon.placedSymbolArray.get(n.verticalPlacedIconSymbolIndex).hidden=c.icon.isHidden())}const b=g&&g.has(i)?g.get(i):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const r=e.collisionArrays[i];if(r){let i=new t.P(0,0);if(r.textBox||r.verticalTextBox){let t=!0;if(u){const e=this.variableOffsets[l];e?(i=Ge(e.anchor,e.width,e.height,e.textOffset,e.textBoxScale),h&&i._rotate(p?-this.transform.bearingInRadians:this.transform.bearingInRadians)):t=!1}if(r.textBox||r.verticalTextBox){let n;r.textBox&&(n=v),r.verticalTextBox&&(n=x),We(e.textCollisionBox.collisionVertexArray,c.text.placed,!t||n,b.text,i.x,i.y)}}if(r.iconBox||r.verticalIconBox){const t=Boolean(!x&&r.verticalIconBox);let n;r.iconBox&&(n=t),r.verticalIconBox&&(n=!t),We(e.iconCollisionBox.collisionVertexArray,c.icon.placed,n,b.icon,d?i.x:0,d?i.y:0)}}}}if(e.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);e.bucketInstanceId in this.collisionCircleArrays&&(e.collisionCircleArray=this.collisionCircleArrays[e.bucketInstanceId],delete this.collisionCircleArrays[e.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.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,t){const i=this.zoomAtLastRecencyCheck===t?1-this.zoomAdjustment(t):1;return this.zoomAtLastRecencyCheck=t,this.commitTime+this.fadeDuration*i>e}setStale(){this.stale=!0}}function We(e,t,i,r,n,o){r&&0!==r.length||(r=[0,0,0,0]);const a=r[0]-je,s=r[1]-je,l=r[2]-je,c=r[3]-je;e.emplaceBack(t?1:0,i?1:0,n||0,o||0,a,s),e.emplaceBack(t?1:0,i?1:0,n||0,o||0,l,s),e.emplaceBack(t?1:0,i?1:0,n||0,o||0,l,c),e.emplaceBack(t?1:0,i?1:0,n||0,o||0,a,c)}const Ke=Math.pow(2,25),Xe=Math.pow(2,24),Ye=Math.pow(2,17),Je=Math.pow(2,16),Qe=Math.pow(2,9),et=Math.pow(2,8),tt=Math.pow(2,1);function it(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*Ke+t*Xe+i*Ye+t*Je+i*Qe+t*et+i*tt+t}const rt=0;class nt{constructor(e){this._sortAcrossTiles="viewport-y"!==e.layout.get("symbol-z-order")&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,t,i,r,n){const o=this._bucketParts;for(;this._currentTileIndex<e.length;)if(t.getBucketParts(o,r,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,n())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,o.sort(((e,t)=>e.sortKey-t.sortKey)));this._currentPartIndex<o.length;)if(t.placeLayerBucketPart(o[this._currentPartIndex],this._seenCrossTileIDs,i),this._currentPartIndex++,n())return!0;return!1}}class ot{constructor(e,t,i,r,n,o,a,s){this.placement=new He(e,t,o,a,s),this._currentPlacementIndex=i.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=n,this._done=!1}isDone(){return this._done}continuePlacement(e,t,i){const r=a.now(),n=()=>!this._forceFullPlacement&&a.now()-r>2;for(;this._currentPlacementIndex>=0;){const r=t[e[this._currentPlacementIndex]],o=this.placement.collisionIndex.transform.zoom;if("symbol"===r.type&&(!r.minzoom||r.minzoom<=o)&&(!r.maxzoom||r.maxzoom>o)){if(this._inProgressLayer||(this._inProgressLayer=new nt(r)),this._inProgressLayer.continuePlacement(i[r.source],this.placement,this._showCollisionBoxes,r,n))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}const at=512/t.Z/2;class st{constructor(e,i,r){this.tileID=e,this.bucketInstanceId=r,this._symbolsByKey={};const n=new Map;for(let e=0;e<i.length;e++){const t=i.get(e),r=t.key,o=n.get(r);o?o.push(t):n.set(r,[t])}for(const[e,i]of n){const r={positions:i.map((e=>({x:Math.floor(e.anchorX*at),y:Math.floor(e.anchorY*at)}))),crossTileIDs:i.map((e=>e.crossTileID))};if(r.positions.length>128){const e=new t.aC(r.positions.length,16,Uint16Array);for(const{x:t,y:i}of r.positions)e.add(t,i);e.finish(),delete r.positions,r.index=e}this._symbolsByKey[e]=r}}getScaledCoordinates(e,i){const{x:r,y:n,z:o}=this.tileID.canonical,{x:a,y:s,z:l}=i.canonical,c=at/Math.pow(2,l-o),u=(s*t.Z+e.anchorY)*c,h=n*t.Z*at;return{x:Math.floor((a*t.Z+e.anchorX)*c-r*t.Z*at),y:Math.floor(u-h)}}findMatches(e,t,i){const r=this.tileID.canonical.z<t.canonical.z?1:Math.pow(2,this.tileID.canonical.z-t.canonical.z);for(let n=0;n<e.length;n++){const o=e.get(n);if(o.crossTileID)continue;const a=this._symbolsByKey[o.key];if(!a)continue;const s=this.getScaledCoordinates(o,t);if(a.index){const e=a.index.range(s.x-r,s.y-r,s.x+r,s.y+r).sort();for(const t of e){const e=a.crossTileIDs[t];if(!i[e]){i[e]=!0,o.crossTileID=e;break}}}else if(a.positions)for(let e=0;e<a.positions.length;e++){const t=a.positions[e],n=a.crossTileIDs[e];if(Math.abs(t.x-s.x)<=r&&Math.abs(t.y-s.y)<=r&&!i[n]){i[n]=!0,o.crossTileID=n;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map((({crossTileIDs:e})=>e))}}class lt{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class ct{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){const t=Math.round((e-this.lng)/360);if(0!==t)for(const e in this.indexes){const i=this.indexes[e],r={};for(const e in i){const n=i[e];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+t),r[n.tileID.key]=n}this.indexes[e]=r}this.lng=e}addBucket(e,t,i){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===t.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let e=0;e<t.symbolInstances.length;e++)t.symbolInstances.get(e).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});const r=this.usedCrossTileIDs[e.overscaledZ];for(const i in this.indexes){const n=this.indexes[i];if(Number(i)>e.overscaledZ)for(const i in n){const o=n[i];o.tileID.isChildOf(e)&&o.findMatches(t.symbolInstances,e,r)}else{const o=n[e.scaledTo(Number(i)).key];o&&o.findMatches(t.symbolInstances,e,r)}}for(let e=0;e<t.symbolInstances.length;e++){const n=t.symbolInstances.get(e);n.crossTileID||(n.crossTileID=i.generate(),r[n.crossTileID]=!0)}return void 0===this.indexes[e.overscaledZ]&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new st(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(const i of t.getCrossTileIDsLists())for(const t of i)delete this.usedCrossTileIDs[e][t]}removeStaleBuckets(e){let t=!1;for(const i in this.indexes){const r=this.indexes[i];for(const n in r)e[r[n].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,r[n]),delete r[n],t=!0)}return t}}class ut{constructor(){this.layerIndexes={},this.crossTileIDs=new lt,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,i){let r=this.layerIndexes[e.id];void 0===r&&(r=this.layerIndexes[e.id]=new ct);let n=!1;const o={};r.handleWrapJump(i);for(const i of t){const t=i.getBucket(e);t&&e.id===t.layerIds[0]&&(t.bucketInstanceId||(t.bucketInstanceId=++this.maxBucketInstanceId),r.addBucket(i.tileID,t,this.crossTileIDs)&&(n=!0),o[t.bucketInstanceId]=!0)}return r.removeStaleBuckets(o)&&(n=!0),n}pruneUnusedLayers(e){const t={};e.forEach((e=>{t[e]=!0}));for(const e in this.layerIndexes)t[e]||delete this.layerIndexes[e]}}var ht="void main() {fragColor=vec4(1.0);}";const pt={prelude:dt("#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nout highp vec4 fragColor;","#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\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(unpack_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;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+ c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+ c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+ c\n);}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\n#ifdef GLOBE\nif ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}\n#endif\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}const float PI=3.141592653589793;uniform mat4 u_projection_matrix;"),projectionMercator:dt("","float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}"),projectionGlobe:dt("","#define GLOBE_RADIUS 6371008.8\nuniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos\n);}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float spherical_y=2.0*atan(exp(PI-(mercator_pos_y*PI*2.0)))-PI*0.5;return cos(spherical_y);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY); \nif (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;vec2 spherical;spherical.x=mercator_pos.x*PI*2.0+PI;spherical.y=2.0*atan(exp(PI-(mercator_pos.y*PI*2.0)))-PI*0.5;float len=cos(spherical.y);vec3 pos=vec3(sin(spherical.x)*len,sin(spherical.y),cos(spherical.x)*len\n);if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}"),background:dt("uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:dt("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:dt("in vec3 v_data;in 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);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;in vec2 a_pos;out vec3 v_data;out float v_visibility;\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(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 pos_raw=a_pos+32768.0;vec2 extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);vec2 circle_center=floor(pos_raw/8.0)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) {\n#ifdef GLOBE\nvec3 center_vector=projectToSphere(circle_center);\n#endif\nfloat angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {\n#ifdef GLOBE\nvec4 projected_center=interpolateProjection(circle_center,center_vector,ele);\n#else\nvec4 projected_center=projectTileWithElevation(circle_center,ele);\n#endif\ncorner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}\n#ifdef GLOBE\nvec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);\n#else\ngl_Position=projectTileWithElevation(corner_position,ele);\n#endif\n} else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}"),clippingMask:dt(ht,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:dt("uniform highp float u_intensity;in 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);fragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;in vec2 a_pos;out vec2 v_extrude;\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 pos_raw=a_pos+32768.0;vec2 unscaled_extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=floor(pos_raw/8.0);\n#ifdef GLOBE\nvec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);\n#else\ngl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));\n#endif\n}"),heatmapTexture:dt("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(0.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:dt("in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}","in vec2 a_anchor_pos;in vec2 a_placed;in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;out float v_placed;out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:dt("in float v_radius;in vec2 v_extrude;in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);fragColor=color*alpha*opacity_t;}","in vec2 a_pos;in float a_radius;in vec2 a_flags;uniform vec2 u_viewport_size;out float v_radius;out vec2 v_extrude;out float v_collision;void main() {float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:dt("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}","in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}"),depth:dt(ht,"in vec2 a_pos;void main() {\n#ifdef GLOBE\ngl_Position=projectTileFor3D(a_pos,0.0);\n#else\ngl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);\n#endif\n}"),fill:dt("#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\nfragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_fill_translate;in vec2 a_pos;\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=projectTile(a_pos+u_fill_translate,a_pos);}"),fillOutline:dt("in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\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);fragColor=outline_color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\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=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillOutlinePattern:dt("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillPattern:dt("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"),fillExtrusion:dt("in vec4 v_color;void main() {fragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\nout vec4 v_color;\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\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nfloat colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);\n#ifdef GLOBE\nmat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);\n#endif\ndirectional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}"),fillExtrusionPattern:dt("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;in vec2 a_pos;in vec4 a_normal_ed;\n#ifdef TERRAIN3D\nin vec2 a_centroid;\n#endif\n#ifdef GLOBE\nout vec3 v_sphere_pos;\n#endif\nout vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nvec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,elevation*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}"),hillshadePrepare:dt("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));fragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:dt("uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),line:dt("uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\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);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\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 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;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),lineGradient:dt("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\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);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;\n#ifdef GLOBE\nout float v_depth;\n#endif\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 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;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),linePattern:dt("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width;\n#ifdef GLOBE\nout float v_depth;\n#endif\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_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\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_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\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;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),lineSDF:dt("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\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);float sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nin vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\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\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\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\n#pragma mapbox: initialize lowp float floorwidth\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;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}"),raster:dt("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture(u_image0,v_pos0);vec4 color1=texture(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;in vec2 a_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);v_pos0=((fractionalPos-0.5)/u_buffer_scale)+0.5;\n#ifdef GLOBE\nif (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}\n#endif\nv_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:dt("uniform sampler2D u_texture;in vec2 v_tex;in 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;fragColor=texture(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_tex;out float v_fade_opacity;\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_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}"),symbolSDF:dt("#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;in vec2 v_data0;in 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 inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}fragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_data0;out vec3 v_data1;\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_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"),symbolTextAndIcon:dt("#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;in vec4 v_data0;in 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;fragColor=texture(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=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=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);fragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec4 v_data0;out vec4 v_data1;\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_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}"),terrain:dt("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}","in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:dt("in float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {fragColor=pack(v_depth);}","in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:dt("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","in vec3 a_pos3d;uniform float u_ele_delta;out vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);}"),projectionErrorMeasurement:dt("in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}","in vec2 a_pos;uniform highp float u_input;uniform highp float u_output_expected;out vec4 v_output_error_encoded;void main() {float real_output=2.0*atan(exp(PI-(u_input*PI*2.0)))-PI*0.5;float error=real_output-u_output_expected;float abs_error=abs(error)*128.0;v_output_error_encoded.x=min(floor(abs_error*256.0),255.0)/255.0;abs_error-=v_output_error_encoded.x;v_output_error_encoded.y=min(floor(abs_error*65536.0),255.0)/255.0;abs_error-=v_output_error_encoded.x/255.0;v_output_error_encoded.z=min(floor(abs_error*16777216.0),255.0)/255.0;v_output_error_encoded.w=error >=0.0 ? 1.0 : 0.0;gl_Position=vec4(a_pos,0.0,1.0);}"),atmosphere:dt("in vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758\n);color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}","in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:dt("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}","in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function dt(e,t){const i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,r=t.match(/in ([\w]+) ([\w]+)/g),n=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),a=o?o.concat(n):n,s={};return{fragmentSource:e=e.replace(i,((e,t,i,r,n)=>(s[n]=!0,"define"===t?`\n#ifndef HAS_UNIFORM_u_${n}\nin ${i} ${r} ${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${n}\n ${i} ${r} ${n} = u_${n};\n#endif\n`))),vertexSource:t=t.replace(i,((e,t,i,r,n)=>{const o="float"===r?"vec2":"vec4",a=n.match(/color/)?"color":o;return s[n]?"define"===t?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nin ${i} ${o} a_${n};\nout ${i} ${r} ${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${n}\n ${n} = a_${n};\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n ${n} = unpack_mix_${a}(a_${n}, u_${n}_t);\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`:"define"===t?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nin ${i} ${o} a_${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${n}\n ${i} ${r} ${n} = a_${n};\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n ${i} ${r} ${n} = unpack_mix_${a}(a_${n}, u_${n}_t);\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`})),staticAttributes:r,staticUniforms:a}}class mt{constructor(e,t,i){this.vertexBuffer=e,this.indexBuffer=t,this.segments=i}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var ft=t.aD([{name:"a_pos",type:"Int16",components:2}]);const gt="#define PROJECTION_MERCATOR",yt="mercator";class _t{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return yt}get shaderDefine(){return gt}get shaderPreludeCode(){return pt.projectionMercator}get vertexShaderPreludeCode(){return pt.projectionMercator.vertexSource}get subdivisionGranularity(){return t.aE.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(e){}getMeshFromTileID(e,i,r,n,o){if(this._cachedMesh)return this._cachedMesh;const a=new t.aF;a.emplaceBack(0,0),a.emplaceBack(t.Z,0),a.emplaceBack(0,t.Z),a.emplaceBack(t.Z,t.Z);const s=e.createVertexBuffer(a,ft.members),l=t.aG.simpleSegment(0,0,4,2),c=new t.aH;c.emplaceBack(1,0,2),c.emplaceBack(1,2,3);const u=e.createIndexBuffer(c);return this._cachedMesh=new mt(s,u,l),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(e){}}function vt(e,i){const r=t.ae(i.lat,-85.051129,t.aJ);return new t.P(t.U(i.lng)*e,t.S(r)*e)}function xt(e,i){return new t.$(i.x/e,i.y/e).toLngLat()}function bt(e){return e.cameraToCenterDistance*Math.min(.85*Math.tan(t.ad(90-e.pitch)),Math.tan(t.ad(89.25-e.pitch)))}function wt(e,i){const r=e.canonical,n=i/t.aI(r.z),o=r.x+Math.pow(2,r.z)*e.wrap,a=t.at(new Float64Array(16));return t.L(a,a,[o*n,r.y*n,0]),t.M(a,a,[n/t.Z,n/t.Z,1]),a}function Ct(e,i,r,n,o){const a=t.$.fromLngLat(e,i),s=o*t.aK(1,e.lat),l=s*Math.cos(t.ad(r)),c=Math.sqrt(s*s-l*l),u=c*Math.sin(t.ad(-n)),h=c*Math.cos(t.ad(-n));return new t.$(a.x+u,a.y+h,a.z+l)}class Tt{constructor(e=0,t=0,i=0,r=0){if(isNaN(e)||e<0||isNaN(t)||t<0||isNaN(i)||i<0||isNaN(r)||r<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=r}interpolate(e,i,r){return null!=i.top&&null!=e.top&&(this.top=t.B.number(e.top,i.top,r)),null!=i.bottom&&null!=e.bottom&&(this.bottom=t.B.number(e.bottom,i.bottom,r)),null!=i.left&&null!=e.left&&(this.left=t.B.number(e.left,i.left,r)),null!=i.right&&null!=e.right&&(this.right=t.B.number(e.right,i.right,r)),this}getCenter(e,i){const r=t.ae((this.left+e-this.right)/2,0,e),n=t.ae((this.top+i-this.bottom)/2,0,i);return new t.P(r,n)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new Tt(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function St(e,t){if(!e.renderWorldCopies||e.lngRange)return;const i=t.lng-e.center.lng;t.lng+=i>180?-360:i<-180?360:0}function At(e){return Math.max(0,Math.floor(e))}class Mt{constructor(e,i,r,n,o,a){this._callbacks=e,this._tileSize=512,this._renderWorldCopies=void 0===a||!!a,this._minZoom=i||0,this._maxZoom=r||22,this._minPitch=null==n?0:n,this._maxPitch=null==o?60:o,this.setMaxBounds(),this._width=0,this._height=0,this._center=new t.Q(0,0),this._elevation=0,this._zoom=0,this._tileZoom=At(this._zoom),this._scale=t.aI(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new Tt,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(e,i,r){this._latRange=e.latRange,this._lngRange=e.lngRange,this._width=e.width,this._height=e.height,this._center=e.center,this._elevation=e.elevation,this._minElevationForCurrentTile=e.minElevationForCurrentTile,this._zoom=e.zoom,this._tileZoom=At(this._zoom),this._scale=t.aI(this._zoom),this._bearingInRadians=e.bearingInRadians,this._fovInRadians=e.fovInRadians,this._pitchInRadians=e.pitchInRadians,this._rollInRadians=e.rollInRadians,this._unmodified=e.unmodified,this._edgeInsets=new Tt(e.padding.top,e.padding.bottom,e.padding.left,e.padding.right),this._minZoom=e.minZoom,this._maxZoom=e.maxZoom,this._minPitch=e.minPitch,this._maxPitch=e.maxPitch,this._renderWorldCopies=e.renderWorldCopies,this._cameraToCenterDistance=e.cameraToCenterDistance,this._nearZ=e.nearZ,this._farZ=e.farZ,this._autoCalculateNearFarZ=!r&&e.autoCalculateNearFarZ,i&&this._constrain(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(e){this._minElevationForCurrentTile=e}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(e){this._minZoom!==e&&(this._minZoom=e,this.setZoom(this.getConstrained(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.setZoom(this.getConstrained(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(e){this._minPitch!==e&&(this._minPitch=e,this.setPitch(Math.max(this.pitch,e)))}get maxPitch(){return this._maxPitch}setMaxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.setPitch(Math.min(this.pitch,e)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(e){void 0===e?e=!0:null===e&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new t.P(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(e){const i=t.aL(e,-180,180)*Math.PI/180;var n,o,a,s,l,c,u,h,p;this._bearingInRadians!==i&&(this._unmodified=!1,this._bearingInRadians=i,this._calcMatrices(),this._rotationMatrix=r(),n=this._rotationMatrix,a=-this._bearingInRadians,s=(o=this._rotationMatrix)[0],l=o[1],c=o[2],u=o[3],h=Math.sin(a),p=Math.cos(a),n[0]=s*p+c*h,n[1]=l*p+u*h,n[2]=s*-h+c*p,n[3]=l*-h+u*p)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(e){const i=t.ae(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==i&&(this._unmodified=!1,this._pitchInRadians=i,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(e){const t=e/180*Math.PI;this._rollInRadians!==t&&(this._unmodified=!1,this._rollInRadians=t,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return t.aM(this._fovInRadians)}setFov(e){e=t.ae(e,.1,150),this.fov!==e&&(this._unmodified=!1,this._fovInRadians=t.ad(e),this._calcMatrices())}get zoom(){return this._zoom}setZoom(e){const i=this.getConstrained(this._center,e).zoom;this._zoom!==i&&(this._unmodified=!1,this._zoom=i,this._tileZoom=Math.max(0,Math.floor(i)),this._scale=t.aI(i),this._constrain(),this._calcMatrices())}get center(){return this._center}setCenter(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(e){e!==this._elevation&&(this._elevation=e,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this._width,this._height)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(e,t){this._autoCalculateNearFarZ=!1,this._nearZ=e,this._farZ=t,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,t,i){this._unmodified=!1,this._edgeInsets.interpolate(e,t,i),this._constrain(),this._calcMatrices()}resize(e,t,i=!0){this._width=e,this._height=t,i&&this._constrain(),this._calcMatrices()}getMaxBounds(){return this._latRange&&2===this._latRange.length&&this._lngRange&&2===this._lngRange.length?new q([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]]):null}setMaxBounds(e){e?(this._lngRange=[e.getWest(),e.getEast()],this._latRange=[e.getSouth(),e.getNorth()],this._constrain()):(this._lngRange=null,this._latRange=[-85.051129,t.aJ])}getConstrained(e,t){return this._callbacks.getConstrained(e,t)}getCameraQueryGeometry(e,i){if(1===i.length)return[i[0],e];{let r=e.x,n=e.y,o=e.x,a=e.y;for(const e of i)r=Math.min(r,e.x),n=Math.min(n,e.y),o=Math.max(o,e.x),a=Math.max(a,e.y);return[new t.P(r,n),new t.P(o,n),new t.P(o,a),new t.P(r,a),new t.P(r,n)]}}_constrain(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;const e=this._unmodified,{center:t,zoom:i}=this.getConstrained(this.center,this.zoom);this.setCenter(t),this.setZoom(i),this._unmodified=e,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let e=t.at(new Float64Array(16));t.M(e,e,[this._width/2,-this._height/2,1]),t.L(e,e,[1,-1,0]),this._clipSpaceToPixelsMatrix=e,e=t.at(new Float64Array(16)),t.M(e,e,[1,-1,1]),t.L(e,e,[-1,-1,0]),t.M(e,e,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=e,this._cameraToCenterDistance=.5/Math.tan(this.fovInRadians/2)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(e,i,r,n){const o=void 0!==r?r:this.bearing,a=n=void 0!==n?n:this.pitch,s=t.$.fromLngLat(e,i),l=-Math.cos(t.ad(a)),c=Math.sin(t.ad(a)),u=c*Math.sin(t.ad(o)),h=-c*Math.cos(t.ad(o));let p=this.elevation;const d=i-p;let m;l*d>=0||Math.abs(l)<.1?(m=1e4,p=i+m*l):m=-d/l;let f,g,y=t.aN(1,s.y),_=0;do{if(_+=1,_>10)break;g=m/y,f=new t.$(s.x+u*g,s.y+h*g),y=1/f.meterInMercatorCoordinateUnits()}while(Math.abs(m-g*y)>1e-12);return{center:f.toLngLat(),elevation:p,zoom:t.ab(this.height/2/Math.tan(this.fovInRadians/2)/g/this.tileSize)}}recalculateZoomAndCenter(e){if(this.elevation-e==0)return;const i=t.aK(1,this.center.lat)*this.worldSize,r=this.cameraToCenterDistance/i,n=t.$.fromLngLat(this.center,this.elevation),o=Ct(this.center,this.elevation,this.pitch,this.bearing,r);this._elevation=e;const a=this.calculateCenterFromCameraLngLatAlt(o.toLngLat(),t.aN(o.z,n.y),this.bearing,this.pitch);this._elevation=a.elevation,this._center=a.center,this.setZoom(a.zoom)}getCameraPoint(){const e=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.P(e*Math.sin(this.rollInRadians),e*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){const e=t.aK(1,this.center.lat)*this.worldSize;return Ct(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/e).toLngLat()}getMercatorTileCoordinates(e){if(!e)return[0,0,1,1];const i=e.canonical.z>=0?1<<e.canonical.z:Math.pow(2,e.canonical.z);return[e.canonical.x/i,e.canonical.y/i,1/i/t.Z,1/i/t.Z]}}class Et{constructor(e,i){this.min=e,this.max=i,this.center=t.aO([],t.aP([],this.min,this.max),.5)}quadrant(e){const i=[e%2==0,e<2],r=t.aQ(this.min),n=t.aQ(this.max);for(let e=0;e<i.length;e++)r[e]=i[e]?this.min[e]:this.center[e],n[e]=i[e]?this.center[e]:this.max[e];return n[2]=this.max[2],new Et(r,n)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}intersectsFrustum(e){let t=!0;for(let i=0;i<e.planes.length;i++){const r=this.intersectsPlane(e.planes[i]);if(0===r)return 0;1===r&&(t=!1)}return t?2:e.aabb.min[0]>this.max[0]||e.aabb.min[1]>this.max[1]||e.aabb.min[2]>this.max[2]||e.aabb.max[0]<this.min[0]||e.aabb.max[1]<this.min[1]||e.aabb.max[2]<this.min[2]?0:1}intersectsPlane(e){let t=e[3],i=e[3];for(let r=0;r<3;r++)e[r]>0?(t+=e[r]*this.min[r],i+=e[r]*this.max[r]):(i+=e[r]*this.min[r],t+=e[r]*this.max[r]);return t>=0?2:i<0?0:1}}class Pt{distanceToTile2d(e,t,i,r){const n=r.distanceX([e,t]),o=r.distanceY([e,t]);return Math.hypot(n,o)}getWrap(e,t,i){return i}getTileAABB(e,i,r,n){var o,a;let s=r,l=r;if(n.terrain){const c=new t.Y(e.z,i,e.z,e.x,e.y),u=n.terrain.getMinMaxElevation(c);s=null!==(o=u.minElevation)&&void 0!==o?o:r,l=null!==(a=u.maxElevation)&&void 0!==a?a:r}const c=1<<e.z;return new Et([i+e.x/c,e.y/c,s],[i+(e.x+1)/c,(e.y+1)/c,l])}allowVariableZoom(e,i){const r=e.fov*(Math.abs(Math.cos(e.rollInRadians))*e.height+Math.abs(Math.sin(e.rollInRadians))*e.width)/e.height,n=t.ae(78.5-r/2,0,60);return!!i.terrain||e.pitch>n}allowWorldCopies(){return!0}recalculateCache(){}}class It{constructor(e,t,i){this.points=e,this.planes=t,this.aabb=i}static fromInvProjectionMatrix(e,i=1,r=0){const n=Math.pow(2,r),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((r=>{const o=1/(r=t.ap([],r,e))[3]/i*n;return t.aR(r,r,[o,o,1/r[3],o])})),a=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((e=>{const i=t.aS([],o[e[0]],o[e[1]]),r=t.aS([],o[e[2]],o[e[1]]),n=t.aT([],t.aU([],i,r)),a=-t.aV(n,o[e[1]]);return n.concat(a)})),s=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],l=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(const e of o)for(let t=0;t<3;t++)s[t]=Math.min(s[t],e[t]),l[t]=Math.max(l[t],e[t]);return new It(o,a,new Et(s,l))}}class kt{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,i){return this._helper.interpolatePadding(e,t,i)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t,i=!0){this._helper.resize(e,t,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e,t){}constructor(e,t,i,r,n){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this._helper=new Mt({calcMatrices:()=>{this._calcMatrices()},getConstrained:(e,t)=>this.getConstrained(e,t)},e,t,i,r,n),this._coveringTilesDetailsProvider=new Pt}clone(){const e=new kt;return e.apply(this),e}apply(e,t,i){this._helper.apply(e,t,i)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(e){const i=[new t.aW(0,e)];if(this._helper._renderWorldCopies){const r=this.screenPointToMercatorCoordinate(new t.P(0,0)),n=this.screenPointToMercatorCoordinate(new t.P(this._helper._width,0)),o=this.screenPointToMercatorCoordinate(new t.P(this._helper._width,this._helper._height)),a=this.screenPointToMercatorCoordinate(new t.P(0,this._helper._height)),s=Math.floor(Math.min(r.x,n.x,o.x,a.x)),l=Math.floor(Math.max(r.x,n.x,o.x,a.x)),c=1;for(let r=s-c;r<=l+c;r++)0!==r&&i.push(new t.aW(r,e))}return i}getCameraFrustum(){return It.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){const t=this.screenPointToLocation(this.centerPoint,e),i=e?e.getElevationForLngLatZoom(t,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(i)}setLocationAtPoint(e,i){const r=t.aK(this.elevation,this.center.lat),n=this.screenPointToMercatorCoordinateAtZ(i,r),o=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,r),a=t.$.fromLngLat(e),s=new t.$(a.x-(n.x-o.x),a.y-(n.y-o.y));this.setCenter(null==s?void 0:s.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(e,i){return i?this.coordinatePoint(t.$.fromLngLat(e),i.getElevationForLngLatZoom(e,this._helper._tileZoom),this._pixelMatrix3D):this.coordinatePoint(t.$.fromLngLat(e))}screenPointToLocation(e,t){var i;return null===(i=this.screenPointToMercatorCoordinate(e,t))||void 0===i?void 0:i.toLngLat()}screenPointToMercatorCoordinate(e,t){if(t){const i=t.pointCoordinate(e);if(null!=i)return i}return this.screenPointToMercatorCoordinateAtZ(e)}screenPointToMercatorCoordinateAtZ(e,i){const r=i||0,n=[e.x,e.y,0,1],o=[e.x,e.y,1,1];t.ap(n,n,this._pixelMatrixInverse),t.ap(o,o,this._pixelMatrixInverse);const a=n[3],s=o[3],l=n[1]/a,c=o[1]/s,u=n[2]/a,h=o[2]/s,p=u===h?0:(r-u)/(h-u);return new t.$(t.B.number(n[0]/a,o[0]/s,p)/this.worldSize,t.B.number(l,c,p)/this.worldSize,r)}coordinatePoint(e,i=0,r=this._pixelMatrix){const n=[e.x*this.worldSize,e.y*this.worldSize,i,1];return t.ap(n,n,r),new t.P(n[0]/n[3],n[1]/n[3])}getBounds(){const e=Math.max(0,this._helper._height/2-bt(this));return(new q).extend(this.screenPointToLocation(new t.P(0,e))).extend(this.screenPointToLocation(new t.P(this._helper._width,e))).extend(this.screenPointToLocation(new t.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new t.P(0,this._helper._height)))}isPointOnMapSurface(e,t){return t?null!=t.pointCoordinate(e):e.y>this.height/2-bt(this)}calculatePosMatrix(e,i=!1,r){var n;const o=null!==(n=e.key)&&void 0!==n?n:t.aX(e.wrap,e.canonical.z,e.canonical.z,e.canonical.x,e.canonical.y),a=i?this._alignedPosMatrixCache:this._posMatrixCache;if(a.has(o)){const e=a.get(o);return r?e.f32:e.f64}const s=wt(e,this.worldSize);t.N(s,i?this._alignedProjMatrix:this._viewProjMatrix,s);const l={f64:s,f32:new Float32Array(s)};return a.set(o,l),r?l.f32:l.f64}calculateFogMatrix(e){const i=e.key,r=this._fogMatrixCacheF32;if(r.has(i))return r.get(i);const n=wt(e,this.worldSize);return t.N(n,this._fogMatrix,n),r.set(i,new Float32Array(n)),r.get(i)}getConstrained(e,i){i=t.ae(+i,this.minZoom,this.maxZoom);const r={center:new t.Q(e.lng,e.lat),zoom:i};let n=this._helper._lngRange;this._helper._renderWorldCopies||null!==n||(n=[-179.9999999999,180-1e-10]);const o=this.tileSize*t.aI(r.zoom);let a=0,s=o,l=0,c=o,u=0,h=0;const{x:p,y:d}=this.size;if(this._helper._latRange){const e=this._helper._latRange;a=t.S(e[1])*o,s=t.S(e[0])*o,s-a<d&&(u=d/(s-a))}n&&(l=t.aL(t.U(n[0])*o,0,o),c=t.aL(t.U(n[1])*o,0,o),c<l&&(c+=o),c-l<p&&(h=p/(c-l)));const{x:m,y:f}=vt(o,e);let g,y;const _=Math.max(h||0,u||0);if(_){const e=new t.P(h?(c+l)/2:m,u?(s+a)/2:f);return r.center=xt(o,e).wrap(),r.zoom+=t.ab(_),r}if(this._helper._latRange){const e=d/2;f-e<a&&(y=a+e),f+e>s&&(y=s-e)}if(n){const e=(l+c)/2;let i=m;this._helper._renderWorldCopies&&(i=t.aL(m,e-o/2,e+o/2));const r=p/2;i-r<l&&(g=l+r),i+r>c&&(g=c-r)}if(void 0!==g||void 0!==y){const e=new t.P(null!=g?g:m,null!=y?y:f);r.center=xt(o,e).wrap()}return r}calculateCenterFromCameraLngLatAlt(e,t,i,r){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,i,r)}_calculateNearFarZIfNeeded(e,i,r){if(!this._helper.autoCalculateNearFarZ)return;const n=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),o=e-n*this._helper._pixelPerMeter/Math.cos(i),a=n<0?o:e,s=Math.PI/2+this.pitchInRadians,l=t.ad(this.fov)*(Math.abs(Math.cos(t.ad(this.roll)))*this.height+Math.abs(Math.sin(t.ad(this.roll)))*this.width)/this.height*(.5+r.y/this.height),c=Math.sin(l)*a/Math.sin(t.ae(Math.PI-s-l,.01,Math.PI-.01)),u=bt(this),h=Math.atan(u/this._helper.cameraToCenterDistance),p=t.ad(.75),d=h>p?2*h*(.5+r.y/(2*u)):p,m=Math.sin(d)*a/Math.sin(t.ae(Math.PI-s-d,.01,Math.PI-.01)),f=Math.min(c,m);this._helper._farZ=1.01*(Math.cos(Math.PI/2-i)*f+a),this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;const e=this.centerOffset,i=vt(this.worldSize,this.center),r=i.x,n=i.y;this._helper._pixelPerMeter=t.aK(1,this.center.lat)*this.worldSize;const o=t.ad(Math.min(this.pitch,89.25)),a=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(o));let s;this._calculateNearFarZIfNeeded(a,o,e),s=new Float64Array(16),t.aY(s,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),t.aj(this._invProjMatrix,s),s[8]=2*-e.x/this._helper._width,s[9]=2*e.y/this._helper._height,this._projectionMatrix=t.aZ(s),t.M(s,s,[1,-1,1]),t.L(s,s,[0,0,-this._helper.cameraToCenterDistance]),t.a_(s,s,-this.rollInRadians),t.a$(s,s,this.pitchInRadians),t.a_(s,s,-this.bearingInRadians),t.L(s,s,[-r,-n,0]),this._mercatorMatrix=t.M([],s,[this.worldSize,this.worldSize,this.worldSize]),t.M(s,s,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=t.N(new Float64Array(16),this.clipSpaceToPixelsMatrix,s),t.L(s,s,[0,0,-this.elevation]),this._viewProjMatrix=s,this._invViewProjMatrix=t.aj([],s);const l=[0,0,-1,1];t.ap(l,l,this._invViewProjMatrix),this._cameraPosition=[l[0]/l[3],l[1]/l[3],l[2]/l[3]],this._fogMatrix=new Float64Array(16),t.aY(this._fogMatrix,this.fovInRadians,this.width/this.height,a,this._helper._farZ),this._fogMatrix[8]=2*-e.x/this.width,this._fogMatrix[9]=2*e.y/this.height,t.M(this._fogMatrix,this._fogMatrix,[1,-1,1]),t.L(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),t.a_(this._fogMatrix,this._fogMatrix,-this.rollInRadians),t.a$(this._fogMatrix,this._fogMatrix,this.pitchInRadians),t.a_(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),t.L(this._fogMatrix,this._fogMatrix,[-r,-n,0]),t.M(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),t.L(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=t.N(new Float64Array(16),this.clipSpaceToPixelsMatrix,s);const c=this._helper._width%2/2,u=this._helper._height%2/2,h=Math.cos(this.bearingInRadians),p=Math.sin(-this.bearingInRadians),d=r-Math.round(r)+h*c+p*u,m=n-Math.round(n)+h*u+p*c,f=new Float64Array(s);if(t.L(f,f,[d>.5?d-1:d,m>.5?m-1:m,0]),this._alignedProjMatrix=f,s=t.aj(new Float64Array(16),this._pixelMatrix),!s)throw new Error("failed to invert matrix");this._pixelMatrixInverse=s,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;const e=this.screenPointToMercatorCoordinate(new t.P(0,0)),i=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.ap(i,i,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){const e=t.aK(1,this.center.lat)*this.worldSize;return Ct(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/e).toLngLat()}lngLatToCameraDepth(e,i){const r=t.$.fromLngLat(e),n=[r.x*this.worldSize,r.y*this.worldSize,i,1];return t.ap(n,n,this._viewProjMatrix),n[2]/n[3]}getProjectionData(e){const{overscaledTileID:i,aligned:r,applyTerrainMatrix:n}=e,o=this._helper.getMercatorTileCoordinates(i),a=i?this.calculatePosMatrix(i,r,!0):null;let s;return s=i&&i.terrainRttPosMatrix32f&&n?i.terrainRttPosMatrix32f:a||t.b0(),{mainMatrix:s,tileMercatorCoords:o,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:s}}isLocationOccluded(e){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(e,t,i){return 1}transformLightDirection(e){return t.aQ(e)}getRayDirectionFromPixel(e){throw new Error("Not implemented.")}projectTileCoordinates(e,i,r,n){const o=this.calculatePosMatrix(r);let a;n?(a=[e,i,n(e,i),1],t.ap(a,a,o)):(a=[e,i,0,1],Oe(a,a,o));const s=a[3];return{point:new t.P(a[0]/s,a[1]/s),signedDistanceFromCamera:s,isOccluded:!1}}populateCache(e){for(const t of e)this.calculatePosMatrix(t)}getMatrixForModel(e,i){const r=t.$.fromLngLat(e,i),n=r.meterInMercatorCoordinateUnits(),o=t.b1();return t.L(o,o,[r.x,r.y,r.z]),t.a_(o,o,Math.PI),t.a$(o,o,Math.PI/2),t.M(o,o,[-n,n,n]),o}getProjectionDataForCustomLayer(e=!0){const i=new t.Y(0,0,0,0,0),r=this.getProjectionData({overscaledTileID:i,applyGlobeMatrix:e}),n=wt(i,this.worldSize);t.N(n,this._viewProjMatrix,n),r.tileMercatorCoords=[0,0,1,1];const o=[t.Z,t.Z,this.worldSize/this._helper.pixelsPerMeter],a=t.b2();return t.M(a,n,o),r.fallbackMatrix=a,r.mainMatrix=a,r}getFastPathSimpleProjectionMatrix(e){return this.calculatePosMatrix(e)}}function zt(){t.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function Lt(e){if(e.useSlerp)if(e.k<1){const i=t.b3(e.startEulerAngles.roll,e.startEulerAngles.pitch,e.startEulerAngles.bearing),r=t.b3(e.endEulerAngles.roll,e.endEulerAngles.pitch,e.endEulerAngles.bearing),n=new Float64Array(4);t.b4(n,i,r,e.k);const o=t.b5(n);e.tr.setRoll(o.roll),e.tr.setPitch(o.pitch),e.tr.setBearing(o.bearing)}else e.tr.setRoll(e.endEulerAngles.roll),e.tr.setPitch(e.endEulerAngles.pitch),e.tr.setBearing(e.endEulerAngles.bearing);else e.tr.setRoll(t.B.number(e.startEulerAngles.roll,e.endEulerAngles.roll,e.k)),e.tr.setPitch(t.B.number(e.startEulerAngles.pitch,e.endEulerAngles.pitch,e.k)),e.tr.setBearing(t.B.number(e.startEulerAngles.bearing,e.endEulerAngles.bearing,e.k))}function Dt(e,i,r,n,o){const a=o.padding,s=vt(o.worldSize,r.getNorthWest()),l=vt(o.worldSize,r.getNorthEast()),c=vt(o.worldSize,r.getSouthEast()),u=vt(o.worldSize,r.getSouthWest()),h=t.ad(-n),p=s.rotate(h),d=l.rotate(h),m=c.rotate(h),f=u.rotate(h),g=new t.P(Math.max(p.x,d.x,f.x,m.x),Math.max(p.y,d.y,f.y,m.y)),y=new t.P(Math.min(p.x,d.x,f.x,m.x),Math.min(p.y,d.y,f.y,m.y)),_=g.sub(y),v=(o.width-(a.left+a.right+i.left+i.right))/_.x,x=(o.height-(a.top+a.bottom+i.top+i.bottom))/_.y;if(x<0||v<0)return void zt();const b=Math.min(t.ab(o.scale*Math.min(v,x)),e.maxZoom),w=t.P.convert(e.offset),C=new t.P((i.left-i.right)/2,(i.top-i.bottom)/2).rotate(t.ad(n)),T=w.add(C).mult(o.scale/t.aI(b));return{center:xt(o.worldSize,s.add(c).div(2).sub(T)),zoom:b,bearing:n}}class Ft{get useGlobeControls(){return!1}handlePanInertia(e,t){return{easingOffset:e,easingCenter:t.center}}handleMapControlsRollPitchBearingZoom(e,t){e.bearingDelta&&t.setBearing(t.bearing+e.bearingDelta),e.pitchDelta&&t.setPitch(t.pitch+e.pitchDelta),e.rollDelta&&t.setRoll(t.roll+e.rollDelta),e.zoomDelta&&t.setZoom(t.zoom+e.zoomDelta)}handleMapControlsPan(e,t,i){e.around.distSqr(t.centerPoint)<.01||t.setLocationAtPoint(i,e.around)}cameraForBoxAndBearing(e,t,i,r,n){return Dt(e,t,i,r,n)}handleJumpToCenterZoom(e,i){e.zoom!==(void 0!==i.zoom?+i.zoom:e.zoom)&&e.setZoom(+i.zoom),void 0!==i.center&&e.setCenter(t.Q.convert(i.center))}handleEaseTo(e,i){const r=e.zoom,n=e.padding,o={roll:e.roll,pitch:e.pitch,bearing:e.bearing},a={roll:void 0===i.roll?e.roll:i.roll,pitch:void 0===i.pitch?e.pitch:i.pitch,bearing:void 0===i.bearing?e.bearing:i.bearing},s=void 0!==i.zoom,l=!e.isPaddingEqual(i.padding);let c=!1;const u=s?+i.zoom:e.zoom;let h=e.centerPoint.add(i.offsetAsPoint);const p=e.screenPointToLocation(h),{center:d,zoom:m}=e.getConstrained(t.Q.convert(i.center||p),null!=u?u:r);St(e,d);const f=vt(e.worldSize,p),g=vt(e.worldSize,d).sub(f),y=t.aI(m-r);return c=m!==r,{easeFunc:s=>{if(c&&e.setZoom(t.B.number(r,m,s)),t.b6(o,a)||Lt({startEulerAngles:o,endEulerAngles:a,tr:e,k:s,useSlerp:o.roll!=a.roll}),l&&(e.interpolatePadding(n,i.padding,s),h=e.centerPoint.add(i.offsetAsPoint)),i.around)e.setLocationAtPoint(i.around,i.aroundPoint);else{const i=t.aI(e.zoom-r),n=m>r?Math.min(2,y):Math.max(.5,y),o=Math.pow(n,1-s),a=xt(e.worldSize,f.add(g.mult(s*o)).mult(i));e.setLocationAtPoint(e.renderWorldCopies?a.wrap():a,h)}},isZooming:c,elevationCenter:d}}handleFlyTo(e,i){const r=void 0!==i.zoom,n=e.zoom,o=e.getConstrained(t.Q.convert(i.center||i.locationAtOffset),r?+i.zoom:n),a=o.center,s=o.zoom;St(e,a);const l=vt(e.worldSize,i.locationAtOffset),c=vt(e.worldSize,a).sub(l),u=c.mag(),h=t.aI(s-n);let p;if(void 0!==i.minZoom){const r=Math.min(+i.minZoom,n,s),o=e.getConstrained(a,r).zoom;p=t.aI(o-n)}return{easeFunc:(i,r,o,u)=>{e.setZoom(1===i?s:n+t.ab(r));const h=1===i?a:xt(e.worldSize,l.add(c.mult(o)).mult(r));e.setLocationAtPoint(e.renderWorldCopies?h.wrap():h,u)},scaleOfZoom:h,targetCenter:a,scaleOfMinZoom:p,pixelPathLength:u}}}class Rt{constructor(e,t,i){this.blendFunction=e,this.blendColor=t,this.mask=i}}Rt.Replace=[1,0],Rt.disabled=new Rt(Rt.Replace,t.b7.transparent,[!1,!1,!1,!1]),Rt.unblended=new Rt(Rt.Replace,t.b7.transparent,[!0,!0,!0,!0]),Rt.alphaBlended=new Rt([1,771],t.b7.transparent,[!0,!0,!0,!0]);const Bt=2305;class Ot{constructor(e,t,i){this.enable=e,this.mode=t,this.frontFace=i}}Ot.disabled=new Ot(!1,1029,Bt),Ot.backCCW=new Ot(!0,1029,Bt),Ot.frontCCW=new Ot(!0,1028,Bt);class jt{constructor(e,t,i){this.func=e,this.mask=t,this.range=i}}jt.ReadOnly=!1,jt.ReadWrite=!0,jt.disabled=new jt(519,jt.ReadOnly,[0,1]);const Nt=7680;class $t{constructor(e,t,i,r,n,o){this.test=e,this.ref=t,this.mask=i,this.fail=r,this.depthFail=n,this.pass=o}}$t.disabled=new $t({func:519,mask:0},0,0,Nt,Nt,Nt);const Vt=new WeakMap;function Ut(e){var t;if(Vt.has(e))return Vt.get(e);{const i=null===(t=e.getParameter(e.VERSION))||void 0===t?void 0:t.startsWith("WebGL 2.0");return Vt.set(e,i),i}}class qt{get awaitingQuery(){return!!this._readbackQueue}constructor(e){this._readbackWaitFrames=4,this._measureWaitFrames=6,this._texWidth=1,this._texHeight=1,this._measuredError=0,this._updateCount=0,this._lastReadbackFrame=-1e3,this._readbackQueue=null,this._cachedRenderContext=e;const i=e.context,r=i.gl;this._texFormat=r.RGBA,this._texType=r.UNSIGNED_BYTE;const n=new t.aF;n.emplaceBack(-1,-1),n.emplaceBack(2,-1),n.emplaceBack(-1,2);const o=new t.aH;o.emplaceBack(0,1,2),this._fullscreenTriangle=new mt(i.createVertexBuffer(n,ft.members),i.createIndexBuffer(o),t.aG.simpleSegment(0,0,n.length,o.length)),this._resultBuffer=new Uint8Array(4),i.activeTexture.set(r.TEXTURE1);const a=r.createTexture();r.bindTexture(r.TEXTURE_2D,a),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.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texImage2D(r.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=i.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(a),Ut(r)&&(this._pbo=r.createBuffer(),r.bindBuffer(r.PIXEL_PACK_BUFFER,this._pbo),r.bufferData(r.PIXEL_PACK_BUFFER,4,r.STREAM_READ),r.bindBuffer(r.PIXEL_PACK_BUFFER,null))}destroy(){const e=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),e.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(e,t){const i=this._updateCount;return this._readbackQueue?i>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():i>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(e,t),this._updateCount++,this._measuredError}_bindFramebuffer(){const e=this._cachedRenderContext.context,t=e.gl;e.activeTexture.set(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,this._fbo.colorAttachment.get()),e.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(e,i){const r=this._cachedRenderContext.context,n=r.gl;if(this._bindFramebuffer(),r.viewport.set([0,0,this._texWidth,this._texHeight]),r.clear({color:t.b7.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(r,n.TRIANGLES,jt.disabled,$t.disabled,Rt.unblended,Ot.disabled,((e,t)=>({u_input:e,u_output_expected:t}))(e,i),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&Ut(n)){n.bindBuffer(n.PIXEL_PACK_BUFFER,this._pbo),n.readBuffer(n.COLOR_ATTACHMENT0),n.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),n.bindBuffer(n.PIXEL_PACK_BUFFER,null);const e=n.fenceSync(n.SYNC_GPU_COMMANDS_COMPLETE,0);n.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:e}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){const e=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&Ut(e)){const i=e.clientWaitSync(this._readbackQueue.sync,0,0);if(i===e.WAIT_FAILED)return t.w("WebGL2 clientWaitSync failed."),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(i===e.TIMEOUT_EXPIRED)return;e.bindBuffer(e.PIXEL_PACK_BUFFER,this._pbo),e.getBufferSubData(e.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),e.bindBuffer(e.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),e.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=qt._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(e){let t=0;return t+=e[0]/256,t+=e[1]/65536,t+=e[2]/16777216,e[3]<127&&(t=-t),t/128}}const Zt=t.Z/128;function Gt(e,i){const r=void 0!==e.granularity?Math.max(e.granularity,1):1,n=r+(e.generateBorders?2:0),o=r+(e.extendToNorthPole||e.generateBorders?1:0)+(e.extendToSouthPole||e.generateBorders?1:0),a=n+1,s=o+1,l=e.generateBorders?-1:0,c=e.generateBorders||e.extendToNorthPole?-1:0,u=r+(e.generateBorders?1:0),h=r+(e.generateBorders||e.extendToSouthPole?1:0),p=a*s,d=n*o*6,m=a*s>65536;if(m&&"16bit"===i)throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");const f=m||"32bit"===i,g=new Int16Array(2*p);let y=0;for(let i=c;i<=h;i++)for(let n=l;n<=u;n++){let o=n/r*t.Z;-1===n&&(o=-64),n===r+1&&(o=t.Z+Zt);let a=i/r*t.Z;-1===i&&(a=e.extendToNorthPole?t.b9:-64),i===r+1&&(a=e.extendToSouthPole?t.ba:t.Z+Zt),g[y++]=o,g[y++]=a}const _=f?new Uint32Array(d):new Uint16Array(d);let v=0;for(let e=0;e<o;e++)for(let t=0;t<n;t++){const i=t+1+e*a,r=t+(e+1)*a,n=t+1+(e+1)*a;_[v++]=t+e*a,_[v++]=r,_[v++]=i,_[v++]=i,_[v++]=r,_[v++]=n}return{vertices:g.buffer.slice(0),indices:_.buffer.slice(0),uses32bitIndices:f}}const Ht=new t.aE({fill:new t.bb(128,2),line:new t.bb(512,0),tile:new t.bb(128,32),stencil:new t.bb(128,1),circle:3});class Wt{constructor(){this._tileMeshCache={},this._errorCorrectionUsable=0,this._errorMeasurementLastValue=0,this._errorCorrectionPreviousValue=0,this._errorMeasurementLastChangeTime=-1e3}get name(){return"vertical-perspective"}get transitionState(){return 1}get useSubdivision(){return!0}get shaderVariantName(){return"globe"}get shaderDefine(){return"#define GLOBE"}get shaderPreludeCode(){return pt.projectionGlobe}get vertexShaderPreludeCode(){return pt.projectionMercator.vertexSource}get subdivisionGranularity(){return Ht}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(e){this._errorMeasurement||(this._errorMeasurement=new qt(e));const i=t.S(this._errorQueryLatitudeDegrees),r=2*Math.atan(Math.exp(Math.PI-i*Math.PI*2))-.5*Math.PI,n=this._errorMeasurement.updateErrorLoop(i,r),o=a.now();n!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=n,this._errorMeasurementLastChangeTime=o);const s=Math.min(Math.max((o-this._errorMeasurementLastChangeTime)/1e3/.5,0),1);this._errorCorrectionUsable=t.bc(this._errorCorrectionPreviousValue,-this._errorMeasurementLastValue,t.bd(s))}_getMeshKey(e){return`${e.granularity.toString(36)}_${e.generateBorders?"b":""}${e.extendToNorthPole?"n":""}${e.extendToSouthPole?"s":""}`}getMeshFromTileID(e,t,i,r,n){const o=("stencil"===n?Ht.stencil:Ht.tile).getGranularityForZoomLevel(t.z);return this._getMesh(e,{granularity:o,generateBorders:i,extendToNorthPole:0===t.y&&r,extendToSouthPole:t.y===(1<<t.z)-1&&r})}_getMesh(e,i){const r=this._getMeshKey(i);if(r in this._tileMeshCache)return this._tileMeshCache[r];const n=function(e,i){const r=Gt(i,"16bit"),n=t.aF.deserialize({arrayBuffer:r.vertices,length:r.vertices.byteLength/2/2}),o=t.aH.deserialize({arrayBuffer:r.indices,length:r.indices.byteLength/2/3});return new mt(e.createVertexBuffer(n,ft.members),e.createIndexBuffer(o),t.aG.simpleSegment(0,0,n.length,o.length))}(e,i);return this._tileMeshCache[r]=n,n}recalculate(e){}hasTransition(){const e=a.now();let t=!1;return t=t||(e-this._errorMeasurementLastChangeTime)/1e3<.7,t=t||this._errorMeasurement&&this._errorMeasurement.awaitingQuery,t}setErrorQueryLatitudeDegrees(e){this._errorQueryLatitudeDegrees=e}}const Kt=new t.r({type:new t.D(t.v.projection.type)});class Xt extends t.E{constructor(e){super(),this._transitionable=new t.T(Kt),this.setProjection(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new t.C(0)),this._mercatorProjection=new _t,this._verticalPerspectiveProjection=new Wt}get transitionState(){const e=this.properties.get("type");if("string"==typeof e&&"mercator"===e)return 0;if("string"==typeof e&&"vertical-perspective"===e)return 1;if(e instanceof t.be){if("vertical-perspective"===e.from&&"mercator"===e.to)return 1-e.transition;if("mercator"===e.from&&"vertical-perspective"===e.to)return e.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get latitudeErrorCorrectionRadians(){return this._verticalPerspectiveProjection.latitudeErrorCorrectionRadians}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}updateGPUdependent(e){this._mercatorProjection.updateGPUdependent(e),this._verticalPerspectiveProjection.updateGPUdependent(e)}getMeshFromTileID(e,t,i,r,n){return this.currentProjection.getMeshFromTileID(e,t,i,r,n)}setProjection(e){this._transitionable.setValue("type",(null==e?void 0:e.type)||"mercator")}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}setErrorQueryLatitudeDegrees(e){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(e),this._mercatorProjection.setErrorQueryLatitudeDegrees(e)}}function Yt(e){const t=ei(e.worldSize,e.center.lat);return 2*Math.PI*t}function Jt(e,i,r,n,o){const a=1/(1<<o),s=i/t.Z*a+n*a,l=t.bg((e/t.Z*a+r*a)*Math.PI*2+Math.PI,2*Math.PI),c=2*Math.atan(Math.exp(Math.PI-s*Math.PI*2))-.5*Math.PI,u=Math.cos(c),h=new Float64Array(3);return h[0]=Math.sin(l)*u,h[1]=Math.sin(c),h[2]=Math.cos(l)*u,h}function Qt(e){return function(e,t){const i=Math.cos(t),r=new Float64Array(3);return r[0]=Math.sin(e)*i,r[1]=Math.sin(t),r[2]=Math.cos(e)*i,r}(e.lng*Math.PI/180,e.lat*Math.PI/180)}function ei(e,t){return e/(2*Math.PI)/Math.cos(t*Math.PI/180)}function ti(e){const i=Math.asin(e[1])/Math.PI*180,r=Math.sqrt(e[0]*e[0]+e[2]*e[2]);if(r>1e-6){const n=e[0]/r,o=Math.acos(e[2]/r),a=(n>0?o:-o)/Math.PI*180;return new t.Q(t.aL(a,-180,180),i)}return new t.Q(0,i)}function ii(e){return Math.cos(e*Math.PI/180)}function ri(e,i){const r=ii(e),n=ii(i);return t.ab(n/r)}function ni(e,i){const r=e.rotate(i.bearingInRadians),n=i.zoom+ri(i.center.lat,0),o=t.bc(1/ii(i.center.lat),1/ii(Math.min(Math.abs(i.center.lat),60)),t.bf(n,7,3,0,1)),a=360/Yt({worldSize:i.worldSize,center:{lat:i.center.lat}});return new t.Q(i.center.lng-r.x*a*o,t.ae(i.center.lat+r.y*a,-85.051129,t.aJ))}function oi(e){const t=.5*e,i=Math.sin(t),r=Math.cos(t);return Math.log(i+r)-Math.log(r-i)}function ai(e,i,r,n){const o=e.lat+r*n;if(Math.abs(r)>1){const a=(Math.sign(e.lat+r)!==Math.sign(e.lat)?-Math.abs(e.lat):Math.abs(e.lat))*Math.PI/180,s=Math.abs(e.lat+r)*Math.PI/180,l=oi(a+n*(s-a)),c=oi(a),u=oi(s);return new t.Q(e.lng+i*((l-c)/(u-c)),o)}return new t.Q(e.lng+i*n,o)}class si{constructor(e){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._aabbFactory=e}recalculateCache(){if(!this._hadAnyChanges)return;const e=this._cachePrevious;this._cachePrevious=this._cache,this._cache=e,this._cache.clear(),this._hadAnyChanges=!1}getTileAABB(e,t,i,r){const n=`${e.z}_${e.x}_${e.y}`,o=this._cache.get(n);if(o)return o;const a=this._cachePrevious.get(n);if(a)return this._cache.set(n,a),a;const s=this._aabbFactory(e,t,i,r);return this._cache.set(n,s),this._hadAnyChanges=!0,s}}function li(e,t,i){const r=e-t;return r<0?-r:Math.max(0,r-i)}function ci(e,t,i,r,n){const o=e-i;let a;return a=o<0?Math.min(-o,1+o-n):o>1?Math.min(Math.max(o-n,0),1-o):0,Math.max(a,li(t,r,n))}class ui{constructor(){this._aabbCache=new si(this._computeTileAABB)}recalculateCache(){this._aabbCache.recalculateCache()}distanceToTile2d(e,t,i,r){const n=1<<i.z,o=1/n,a=i.x/n,s=i.y/n;let l=2;return l=Math.min(l,ci(e,t,a,s,o)),l=Math.min(l,ci(e,t,a+.5,-s-o,o)),l=Math.min(l,ci(e,t,a+.5,2-s-o,o)),l}getWrap(e,t,i){const r=1<<t.z,n=1/r,o=t.x/r,a=li(e.x,o,n),s=li(e.x,o-1,n),l=li(e.x,o+1,n),c=Math.min(a,s,l);return c===l?1:c===s?-1:0}allowVariableZoom(e,t){return ue(e,t)>4}allowWorldCopies(){return!1}getTileAABB(e,t,i,r){return this._aabbCache.getTileAABB(e,t,i,r)}_computeTileAABB(e,i,r,n){if(e.z<=0)return new Et([-1,-1,-1],[1,1,1]);if(1===e.z)return new Et([0===e.x?-1:0,0===e.y?0:-1,-1],[0===e.x?0:1,0===e.y?1:0,1]);{const i=[Jt(0,0,e.x,e.y,e.z),Jt(t.Z,0,e.x,e.y,e.z),Jt(t.Z,t.Z,e.x,e.y,e.z),Jt(0,t.Z,e.x,e.y,e.z)],r=[1,1,1],n=[-1,-1,-1];for(const e of i)for(let t=0;t<3;t++)r[t]=Math.min(r[t],e[t]),n[t]=Math.max(n[t],e[t]);if(0===e.y||e.y===(1<<e.z)-1){const t=[0,0===e.y?1:-1,0];for(let e=0;e<3;e++)r[e]=Math.min(r[e],t[e]),n[e]=Math.max(n[e],t[e])}return new Et(r,n)}}}class hi{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,i){return this._helper.interpolatePadding(e,t,i)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t){this._helper.resize(e,t)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e){}constructor(){this._cachedClippingPlane=t.bh(),this._projectionMatrix=t.b1(),this._globeViewProjMatrix32f=t.b0(),this._globeViewProjMatrixNoCorrection=t.b1(),this._globeViewProjMatrixNoCorrectionInverted=t.b1(),this._globeProjMatrixInverted=t.b1(),this._cameraPosition=t.bi(),this._globeLatitudeErrorCorrectionRadians=0,this._helper=new Mt({calcMatrices:()=>{this._calcMatrices()},getConstrained:(e,t)=>this.getConstrained(e,t)}),this._coveringTilesDetailsProvider=new ui}clone(){const e=new hi;return e.apply(this),e}apply(e,t){this._globeLatitudeErrorCorrectionRadians=t||0,this._helper.apply(e)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){const e=t.bi();return e[0]=this._cameraPosition[0],e[1]=this._cameraPosition[1],e[2]=this._cameraPosition[2],e}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(e){const{overscaledTileID:t,applyGlobeMatrix:i}=e,r=this._helper.getMercatorTileCoordinates(t);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:r,clippingPlane:this._cachedClippingPlane,projectionTransition:i?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(e){const i=this.pitchInRadians,r=this.cameraToCenterDistance/e,n=Math.sin(i)*r,o=Math.cos(i)*r+1,a=1/Math.sqrt(n*n+o*o)*1;let s=-n,l=o;const c=Math.sqrt(s*s+l*l);s/=c,l/=c;const u=[0,s,l];return t.bj(u,u,[0,0,0],-this.bearingInRadians),t.bk(u,u,[0,0,0],-1*this.center.lat*Math.PI/180),t.bl(u,u,[0,0,0],this.center.lng*Math.PI/180),t.aO(u,u,.25),[...u,.25*-a]}isLocationOccluded(e){return!this.isSurfacePointVisible(Qt(e))}transformLightDirection(e){const i=this._helper._center.lng*Math.PI/180,r=this._helper._center.lat*Math.PI/180,n=Math.cos(r),o=[Math.sin(i)*n,Math.sin(r),Math.cos(i)*n],a=[o[2],0,-o[0]],s=[0,0,0];t.aU(s,a,o),t.aT(a,a),t.aT(s,s);const l=[0,0,0];return t.aT(l,[a[0]*e[0]+s[0]*e[1]+o[0]*e[2],a[1]*e[0]+s[1]*e[1]+o[1]*e[2],a[2]*e[0]+s[2]*e[1]+o[2]*e[2]]),l}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(e,i,r){const n=function(e,i,r){const n=1/(1<<r.z);return new t.$(e/t.Z*n+r.x*n,i/t.Z*n+r.y*n)}(e,i,r.canonical),o=(a=n.y,[t.bg(n.x*Math.PI*2+Math.PI,2*Math.PI),2*Math.atan(Math.exp(Math.PI-a*Math.PI*2))-.5*Math.PI]);var a;return this.getCircleRadiusCorrection()/Math.cos(o[1])}projectTileCoordinates(e,i,r,n){const o=r.canonical,a=Jt(e,i,o.x,o.y,o.z),s=1+(n?n(e,i):0)/t.br,l=[a[0]*s,a[1]*s,a[2]*s,1];t.ap(l,l,this._globeViewProjMatrixNoCorrection);const c=this._cachedClippingPlane,u=c[0]*a[0]+c[1]*a[1]+c[2]*a[2]+c[3]<0;return{point:new t.P(l[0]/l[3],l[1]/l[3]),signedDistanceFromCamera:l[3],isOccluded:u}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;const e=ei(this.worldSize,this.center.lat),i=t.b2(),r=t.b2();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*e),t.aY(i,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);const n=this.centerOffset;i[8]=2*-n.x/this._helper._width,i[9]=2*n.y/this._helper._height,this._projectionMatrix=t.aZ(i),this._globeProjMatrixInverted=t.b2(),t.aj(this._globeProjMatrixInverted,i),t.L(i,i,[0,0,-this.cameraToCenterDistance]),t.a_(i,i,this.rollInRadians),t.a$(i,i,-this.pitchInRadians),t.a_(i,i,this.bearingInRadians),t.L(i,i,[0,0,-e]);const o=t.bi();o[0]=e,o[1]=e,o[2]=e,t.a$(r,i,this.center.lat*Math.PI/180),t.bm(r,r,-this.center.lng*Math.PI/180),t.M(r,r,o),this._globeViewProjMatrixNoCorrection=r,t.a$(i,i,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),t.bm(i,i,-this.center.lng*Math.PI/180),t.M(i,i,o),this._globeViewProjMatrix32f=new Float32Array(i),this._globeViewProjMatrixNoCorrectionInverted=t.b2(),t.aj(this._globeViewProjMatrixNoCorrectionInverted,r);const a=t.bi();this._cameraPosition=t.bi(),this._cameraPosition[2]=this.cameraToCenterDistance/e,t.bj(this._cameraPosition,this._cameraPosition,a,-this.rollInRadians),t.bk(this._cameraPosition,this._cameraPosition,a,this.pitchInRadians),t.bj(this._cameraPosition,this._cameraPosition,a,-this.bearingInRadians),t.aP(this._cameraPosition,this._cameraPosition,[0,0,1]),t.bk(this._cameraPosition,this._cameraPosition,a,-this.center.lat*Math.PI/180),t.bl(this._cameraPosition,this._cameraPosition,a,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(e);const s=t.aZ(this._globeViewProjMatrixNoCorrectionInverted);t.M(s,s,[1,1,-1]),this._cachedFrustum=It.fromInvProjectionMatrix(s)}calculateFogMatrix(e){t.w("calculateFogMatrix is not supported on globe projection.");const i=t.b2();return t.at(i),i}getVisibleUnwrappedCoordinates(e){return[new t.aW(0,e)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){e&&t.w("terrain is not fully supported on vertical perspective projection."),this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(e,i){if(!this._globeViewProjMatrixNoCorrection)return 1;const r=Qt(e);t.aO(r,r,1+i/t.br);const n=t.bh();return t.ap(n,[r[0],r[1],r[2],1],this._globeViewProjMatrixNoCorrection),n[2]/n[3]}populateCache(e){}getBounds(){const e=.5*this.width,i=.5*this.height,r=[new t.P(0,0),new t.P(e,0),new t.P(this.width,0),new t.P(this.width,i),new t.P(this.width,this.height),new t.P(e,this.height),new t.P(0,this.height),new t.P(0,i)],n=[];for(const e of r)n.push(this.unprojectScreenPoint(e));let o=0,a=0,s=0,l=0;const c=this.center;for(const e of n){const i=t.bn(c.lng,e.lng),r=t.bn(c.lat,e.lat);i<a&&(a=i),i>o&&(o=i),r<l&&(l=r),r>s&&(s=r)}const u=[c.lng+a,c.lat+l,c.lng+o,c.lat+s];return this.isSurfacePointOnScreen([0,1,0])&&(u[3]=90,u[0]=-180,u[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(u[1]=-90,u[0]=-180,u[2]=180),new q(u)}getConstrained(e,i){const r=t.ae(e.lat,-85.051129,t.aJ),n=t.ae(+i,this.minZoom+ri(0,r),this.maxZoom);return{center:new t.Q(e.lng,r),zoom:n}}calculateCenterFromCameraLngLatAlt(e,t,i,r){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,i,r)}setLocationAtPoint(e,i){const r=Qt(this.unprojectScreenPoint(i)),n=Qt(e),o=t.bi();t.bo(o);const a=t.bi();t.bl(a,r,o,-this.center.lng*Math.PI/180),t.bk(a,a,o,this.center.lat*Math.PI/180);const s=n[0]*n[0]+n[2]*n[2],l=a[0]*a[0];if(s<l)return;const c=Math.sqrt(s-l),u=-c,h=t.bp(n[0],n[2],a[0],c),p=t.bp(n[0],n[2],a[0],u),d=t.bi();t.bl(d,n,o,-h);const m=t.bp(d[1],d[2],a[1],a[2]),f=t.bi();t.bl(f,n,o,-p);const g=t.bp(f[1],f[2],a[1],a[2]),y=.5*Math.PI,_=m>=-y&&m<=y,v=g>=-y&&g<=y;let x,b;if(_&&v){const e=this.center.lng*Math.PI/180,i=this.center.lat*Math.PI/180;t.bs(h,e)+t.bs(m,i)<t.bs(p,e)+t.bs(g,i)?(x=h,b=m):(x=p,b=g)}else if(_)x=h,b=m;else{if(!v)return;x=p,b=g}const w=x/Math.PI*180,C=b/Math.PI*180,T=this.center.lat;this.setCenter(new t.Q(w,t.ae(C,-90,90))),this.setZoom(this.zoom+ri(T,this.center.lat))}locationToScreenPoint(e,i){const r=Qt(e);if(i){const n=i.getElevationForLngLatZoom(e,this._helper._tileZoom);t.aO(r,r,1+n/t.br)}return this._projectSurfacePointToScreen(r)}_projectSurfacePointToScreen(e){const i=t.bh();return t.ap(i,[...e,1],this._globeViewProjMatrixNoCorrection),i[0]/=i[3],i[1]/=i[3],new t.P((.5*i[0]+.5)*this.width,(.5*-i[1]+.5)*this.height)}screenPointToMercatorCoordinate(e,i){if(i){const t=i.pointCoordinate(e);if(t)return t}return t.$.fromLngLat(this.unprojectScreenPoint(e))}screenPointToLocation(e,t){var i;return null===(i=this.screenPointToMercatorCoordinate(e,t))||void 0===i?void 0:i.toLngLat()}isPointOnMapSurface(e,t){const i=this._cameraPosition,r=this.getRayDirectionFromPixel(e);return!!this.rayPlanetIntersection(i,r)}getRayDirectionFromPixel(e){const i=t.bh();i[0]=e.x/this.width*2-1,i[1]=-1*(e.y/this.height*2-1),i[2]=1,i[3]=1,t.ap(i,i,this._globeViewProjMatrixNoCorrectionInverted),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3];const r=t.bi();r[0]=i[0]-this._cameraPosition[0],r[1]=i[1]-this._cameraPosition[1],r[2]=i[2]-this._cameraPosition[2];const n=t.bi();return t.aT(n,r),n}isSurfacePointVisible(e){const t=this._cachedClippingPlane;return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]>=0}isSurfacePointOnScreen(e){if(!this.isSurfacePointVisible(e))return!1;const i=t.bh();return t.ap(i,[...e,1],this._globeViewProjMatrixNoCorrection),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3],i[0]>-1&&i[0]<1&&i[1]>-1&&i[1]<1&&i[2]>-1&&i[2]<1}rayPlanetIntersection(e,i){const r=t.aV(e,i),n=t.bi(),o=t.bi();t.aO(o,i,r),t.aS(n,e,o);const a=1-t.aV(n,n);if(a<0)return null;const s=t.aV(e,e)-1,l=-r+(r<0?1:-1)*Math.sqrt(a),c=s/l,u=l;return{tMin:Math.min(c,u),tMax:Math.max(c,u)}}unprojectScreenPoint(e){const i=this._cameraPosition,r=this.getRayDirectionFromPixel(e),n=this.rayPlanetIntersection(i,r);if(n){const e=t.bi();t.aP(e,i,[r[0]*n.tMin,r[1]*n.tMin,r[2]*n.tMin]);const o=t.bi();return t.aT(o,e),ti(o)}const o=this._cachedClippingPlane[0]*r[0]+this._cachedClippingPlane[1]*r[1]+this._cachedClippingPlane[2]*r[2],a=-t.bq(this._cachedClippingPlane,i)/o,s=t.bi();if(a>0)t.aP(s,i,[r[0]*a,r[1]*a,r[2]*a]);else{const e=t.bi();t.aP(e,i,[2*r[0],2*r[1],2*r[2]]);const n=t.bq(this._cachedClippingPlane,e);t.aS(s,e,[this._cachedClippingPlane[0]*n,this._cachedClippingPlane[1]*n,this._cachedClippingPlane[2]*n])}const l=t.bi();return t.aT(l,s),ti(l)}getMatrixForModel(e,i){const r=t.Q.convert(e),n=1/t.br,o=t.b1();return t.bm(o,o,r.lng/180*Math.PI),t.a$(o,o,-r.lat/180*Math.PI),t.L(o,o,[0,0,1+i/t.br]),t.a$(o,o,.5*Math.PI),t.M(o,o,[n,n,n]),o}getProjectionDataForCustomLayer(e=!0){const i=this.getProjectionData({overscaledTileID:new t.Y(0,0,0,0,0),applyGlobeMatrix:e});return i.tileMercatorCoords=[0,0,1,1],i}getFastPathSimpleProjectionMatrix(e){}}class pi{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,i){return this._helper.interpolatePadding(e,t,i)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t,i=!0){this._helper.resize(e,t,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(e,t){this._globeness=e,this._globeLatitudeErrorCorrectionRadians=t,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().recalculateCache(),this._mercatorTransform.getCoveringTilesDetailsProvider().recalculateCache()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this._helper=new Mt({calcMatrices:()=>{this._calcMatrices()},getConstrained:(e,t)=>this.getConstrained(e,t)}),this._globeness=1,this._mercatorTransform=new kt,this._verticalPerspectiveTransform=new hi}clone(){const e=new pi;return e._globeness=this._globeness,e._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,e.apply(this),e}apply(e){this._helper.apply(e),this._mercatorTransform.apply(this),this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(e){const t=this._mercatorTransform.getProjectionData(e),i=this._verticalPerspectiveTransform.getProjectionData(e);return{mainMatrix:this.isGlobeRendering?i.mainMatrix:t.mainMatrix,clippingPlane:i.clippingPlane,tileMercatorCoords:i.tileMercatorCoords,projectionTransition:e.applyGlobeMatrix?this._globeness:0,fallbackMatrix:t.fallbackMatrix}}isLocationOccluded(e){return this.currentTransform.isLocationOccluded(e)}transformLightDirection(e){return this.currentTransform.transformLightDirection(e)}getPixelScale(){return t.bc(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return t.bc(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(e,i,r){const n=this._mercatorTransform.getPitchedTextCorrection(e,i,r),o=this._verticalPerspectiveTransform.getPitchedTextCorrection(e,i,r);return t.bc(n,o,this._globeness)}projectTileCoordinates(e,t,i,r){return this.currentTransform.projectTileCoordinates(e,t,i,r)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(e){return this.currentTransform.calculateFogMatrix(e)}getVisibleUnwrappedCoordinates(e){return this.currentTransform.getVisibleUnwrappedCoordinates(e)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(e){this._mercatorTransform.recalculateZoomAndCenter(e),this._verticalPerspectiveTransform.recalculateZoomAndCenter(e)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(e,t){return this.currentTransform.lngLatToCameraDepth(e,t)}populateCache(e){this._mercatorTransform.populateCache(e),this._verticalPerspectiveTransform.populateCache(e)}getBounds(){return this.currentTransform.getBounds()}getConstrained(e,t){return this.currentTransform.getConstrained(e,t)}calculateCenterFromCameraLngLatAlt(e,t,i,r){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,i,r)}setLocationAtPoint(e,t){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(e,t),void this.apply(this._mercatorTransform);this._verticalPerspectiveTransform.setLocationAtPoint(e,t),this.apply(this._verticalPerspectiveTransform)}locationToScreenPoint(e,t){return this.currentTransform.locationToScreenPoint(e,t)}screenPointToMercatorCoordinate(e,t){return this.currentTransform.screenPointToMercatorCoordinate(e,t)}screenPointToLocation(e,t){return this.currentTransform.screenPointToLocation(e,t)}isPointOnMapSurface(e,t){return this.currentTransform.isPointOnMapSurface(e,t)}getRayDirectionFromPixel(e){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(e)}getMatrixForModel(e,t){return this.currentTransform.getMatrixForModel(e,t)}getProjectionDataForCustomLayer(e=!0){const t=this._mercatorTransform.getProjectionDataForCustomLayer(e);if(!this.isGlobeRendering)return t;const i=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(e);return i.fallbackMatrix=t.mainMatrix,i}getFastPathSimpleProjectionMatrix(e){return this.currentTransform.getFastPathSimpleProjectionMatrix(e)}}class di{get useGlobeControls(){return!0}handlePanInertia(e,i){const r=ni(e,i);return Math.abs(r.lng-i.center.lng)>180&&(r.lng=i.center.lng+179.5*Math.sign(r.lng-i.center.lng)),{easingCenter:r,easingOffset:new t.P(0,0)}}handleMapControlsRollPitchBearingZoom(e,i){const r=e.around,n=i.screenPointToLocation(r);e.bearingDelta&&i.setBearing(i.bearing+e.bearingDelta),e.pitchDelta&&i.setPitch(i.pitch+e.pitchDelta),e.rollDelta&&i.setRoll(i.roll+e.rollDelta);const o=i.zoom;e.zoomDelta&&i.setZoom(i.zoom+e.zoomDelta);const a=i.zoom-o;if(0===a)return;const s=t.bn(i.center.lng,n.lng),l=s/(Math.abs(s/180)+1),c=t.bn(i.center.lat,n.lat),u=i.getRayDirectionFromPixel(r),h=i.cameraPosition,p=-1*t.aV(h,u),d=t.bi();t.aP(d,h,[u[0]*p,u[1]*p,u[2]*p]);const m=t.bt(d)-1,f=Math.exp(.5*-Math.max(m-.3,0)),g=ei(i.worldSize,i.center.lat)/Math.min(i.width,i.height),y=t.bf(g,.9,.5,1,.25),_=(1-t.aI(-a))*Math.min(f,y),v=i.center.lat,x=i.zoom,b=new t.Q(i.center.lng+l*_,t.ae(i.center.lat+c*_,-85.051129,t.aJ));i.setLocationAtPoint(n,r);const w=i.center,C=t.bf(Math.abs(s),45,85,0,1),T=t.bf(g,.75,.35,0,1),S=Math.pow(Math.max(C,T),.25),A=t.bn(w.lng,b.lng),M=t.bn(w.lat,b.lat);i.setCenter(new t.Q(w.lng+A*S,w.lat+M*S).wrap()),i.setZoom(x+ri(v,i.center.lat))}handleMapControlsPan(e,t,i){if(!e.panDelta)return;const r=t.center.lat,n=t.zoom;t.setCenter(ni(e.panDelta,t).wrap()),t.setZoom(n+ri(r,t.center.lat))}cameraForBoxAndBearing(e,i,r,n,o){const a=Dt(e,i,r,n,o),s=i.left/o.width*2-1,l=(o.width-i.right)/o.width*2-1,c=i.top/o.height*-2+1,u=(o.height-i.bottom)/o.height*-2+1,h=t.bn(r.getWest(),r.getEast())<0,p=h?r.getEast():r.getWest(),d=h?r.getWest():r.getEast(),m=Math.max(r.getNorth(),r.getSouth()),f=Math.min(r.getNorth(),r.getSouth()),g=p+.5*t.bn(p,d),y=m+.5*t.bn(m,f),_=o.clone();_.setCenter(a.center),_.setBearing(a.bearing),_.setPitch(0),_.setRoll(0),_.setZoom(a.zoom);const v=_.modelViewProjectionMatrix,x=[Qt(r.getNorthWest()),Qt(r.getNorthEast()),Qt(r.getSouthWest()),Qt(r.getSouthEast()),Qt(new t.Q(d,y)),Qt(new t.Q(p,y)),Qt(new t.Q(g,m)),Qt(new t.Q(g,f))],b=Qt(a.center);let w=Number.POSITIVE_INFINITY;for(const e of x)s<0&&(w=di.getLesserNonNegativeNonNull(w,di.solveVectorScale(e,b,v,"x",s))),l>0&&(w=di.getLesserNonNegativeNonNull(w,di.solveVectorScale(e,b,v,"x",l))),c>0&&(w=di.getLesserNonNegativeNonNull(w,di.solveVectorScale(e,b,v,"y",c))),u<0&&(w=di.getLesserNonNegativeNonNull(w,di.solveVectorScale(e,b,v,"y",u)));if(Number.isFinite(w)&&0!==w)return a.zoom=_.zoom+t.ab(w),a;zt()}handleJumpToCenterZoom(e,i){const r=e.center.lat,n=e.getConstrained(i.center?t.Q.convert(i.center):e.center,e.zoom).center;e.setCenter(n.wrap());const o=void 0!==i.zoom?+i.zoom:e.zoom+ri(r,n.lat);e.zoom!==o&&e.setZoom(o)}handleEaseTo(e,i){const r=e.zoom,n=e.center,o=e.padding,a={roll:e.roll,pitch:e.pitch,bearing:e.bearing},s={roll:void 0===i.roll?e.roll:i.roll,pitch:void 0===i.pitch?e.pitch:i.pitch,bearing:void 0===i.bearing?e.bearing:i.bearing},l=void 0!==i.zoom,c=!e.isPaddingEqual(i.padding);let u=!1;const h=i.center?t.Q.convert(i.center):n,p=e.getConstrained(h,r).center;St(e,p);const d=e.clone();d.setCenter(p),d.setZoom(l?+i.zoom:r+ri(n.lat,h.lat)),d.setBearing(i.bearing);const m=new t.P(t.ae(e.centerPoint.x+i.offsetAsPoint.x,0,e.width),t.ae(e.centerPoint.y+i.offsetAsPoint.y,0,e.height));d.setLocationAtPoint(p,m);const f=(i.offset&&i.offsetAsPoint.mag())>0?d.center:p,g=l?+i.zoom:r+ri(n.lat,f.lat),y=r+ri(n.lat,0),_=g+ri(f.lat,0),v=t.bn(n.lng,f.lng),x=t.bn(n.lat,f.lat),b=t.aI(_-y);return u=g!==r,{easeFunc:r=>{if(t.b6(a,s)||Lt({startEulerAngles:a,endEulerAngles:s,tr:e,k:r,useSlerp:a.roll!=s.roll}),c&&e.interpolatePadding(o,i.padding,r),i.around)t.w("Easing around a point is not supported under globe projection."),e.setLocationAtPoint(i.around,i.aroundPoint);else{const t=_>y?Math.min(2,b):Math.max(.5,b),i=Math.pow(t,1-r),o=ai(n,v,x,r*i);e.setCenter(o.wrap())}if(u){const i=t.B.number(y,_,r)+ri(0,e.center.lat);e.setZoom(i)}},isZooming:u,elevationCenter:f}}handleFlyTo(e,i){const r=void 0!==i.zoom,n=e.center,o=e.zoom,a=e.padding,s=!e.isPaddingEqual(i.padding),l=e.getConstrained(t.Q.convert(i.center||i.locationAtOffset),o).center,c=r?+i.zoom:e.zoom+ri(e.center.lat,l.lat),u=e.clone();u.setCenter(l),u.setZoom(c),u.setBearing(i.bearing);const h=new t.P(t.ae(e.centerPoint.x+i.offsetAsPoint.x,0,e.width),t.ae(e.centerPoint.y+i.offsetAsPoint.y,0,e.height));u.setLocationAtPoint(l,h);const p=u.center;St(e,p);const d=function(e,i,r){const n=Qt(i),o=Qt(r),a=t.aV(n,o),s=Math.acos(a),l=Yt(e);return s/(2*Math.PI)*l}(e,n,p),m=o+ri(n.lat,0),f=c+ri(p.lat,0),g=t.aI(f-m);let y;if("number"==typeof i.minZoom){const r=+i.minZoom+ri(p.lat,0),n=Math.min(r,m,f)+ri(0,p.lat),o=e.getConstrained(p,n).zoom+ri(p.lat,0);y=t.aI(o-m)}const _=t.bn(n.lng,p.lng),v=t.bn(n.lat,p.lat);return{easeFunc:(r,o,l,u)=>{const h=ai(n,_,v,l);s&&e.interpolatePadding(a,i.padding,r);const d=1===r?p:h;e.setCenter(d.wrap());const f=m+t.ab(o);e.setZoom(1===r?c:f+ri(0,d.lat))},scaleOfZoom:g,targetCenter:p,scaleOfMinZoom:y,pixelPathLength:d}}static solveVectorScale(e,t,i,r,n){const o="x"===r?[i[0],i[4],i[8],i[12]]:[i[1],i[5],i[9],i[13]],a=[i[3],i[7],i[11],i[15]],s=e[0]*o[0]+e[1]*o[1]+e[2]*o[2],l=e[0]*a[0]+e[1]*a[1]+e[2]*a[2],c=t[0]*o[0]+t[1]*o[1]+t[2]*o[2],u=t[0]*a[0]+t[1]*a[1]+t[2]*a[2];return c+n*l===s+n*u||a[3]*(s-c)+o[3]*(u-l)+s*u==c*l?null:(c+o[3]-n*u-n*a[3])/(c-s-n*u+n*l)}static getLesserNonNegativeNonNull(e,t){return null!==t&&t>=0&&t<e?t:e}}class mi{constructor(e){this._globe=e,this._mercatorCameraHelper=new Ft,this._verticalPerspectiveCameraHelper=new di}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(e,t){return this.currentHelper.handlePanInertia(e,t)}handleMapControlsRollPitchBearingZoom(e,t){return this.currentHelper.handleMapControlsRollPitchBearingZoom(e,t)}handleMapControlsPan(e,t,i){this.currentHelper.handleMapControlsPan(e,t,i)}cameraForBoxAndBearing(e,t,i,r,n){return this.currentHelper.cameraForBoxAndBearing(e,t,i,r,n)}handleJumpToCenterZoom(e,t){this.currentHelper.handleJumpToCenterZoom(e,t)}handleEaseTo(e,t){return this.currentHelper.handleEaseTo(e,t)}handleFlyTo(e,t){return this.currentHelper.handleFlyTo(e,t)}}const fi=(e,i)=>t.x(e,i&&i.filter((e=>"source.canvas"!==e.identifier))),gi=t.bu();class yi extends t.E{constructor(e,i={}){super(),this._rtlPluginLoaded=()=>{for(const e in this.sourceCaches){const t=this.sourceCaches[e].getSource().type;"vector"!==t&&"geojson"!==t||this.sourceCaches[e].reload()}},this.map=e,this.dispatcher=new B(R(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",((e,t)=>this.getGlyphs(e,t))),this.dispatcher.registerMessageHandler("GI",((e,t)=>this.getImages(e,t))),this.imageManager=new x,this.imageManager.setEventedParent(this),this.glyphManager=new T(e._requestManager,i.localIdeographFontFamily),this.lineAtlas=new I(256,512),this.crossTileSymbolIndex=new ut,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new t.bv,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",t.bw()),ne().on(te,this._rtlPluginLoaded),this.on("data",(e=>{if("source"!==e.dataType||"metadata"!==e.sourceDataType)return;const t=this.sourceCaches[e.sourceId];if(!t)return;const i=t.getSource();if(i&&i.vectorLayerIds)for(const e in this._layers){const t=this._layers[e];t.source===i.id&&this._validateLayer(t)}}))}loadURL(e,i={},r){this.fire(new t.l("dataloading",{dataType:"style"})),i.validate="boolean"!=typeof i.validate||i.validate;const n=this.map._requestManager.transformRequest(e,"Style");this._loadStyleRequest=new AbortController;const o=this._loadStyleRequest;t.j(n,this._loadStyleRequest).then((e=>{this._loadStyleRequest=null,this._load(e.data,i,r)})).catch((e=>{this._loadStyleRequest=null,e&&!o.signal.aborted&&this.fire(new t.k(e))}))}loadJSON(e,i={},r){this.fire(new t.l("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,a.frameAsync(this._frameRequest).then((()=>{this._frameRequest=null,i.validate=!1!==i.validate,this._load(e,i,r)})).catch((()=>{}))}loadEmpty(){this.fire(new t.l("dataloading",{dataType:"style"})),this._load(gi,{validate:!1})}_load(e,i,r){var n,o;const a=i.transformStyle?i.transformStyle(r,e):e;if(!i.validate||!fi(this,t.y(a))){this._loaded=!0,this.stylesheet=a;for(const e in a.sources)this.addSource(e,a.sources[e],{validate:!1});a.sprite?this._loadSprite(a.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(a.glyphs),this._createLayers(),this.light=new M(this.stylesheet.light),this._setProjectionInternal((null===(n=this.stylesheet.projection)||void 0===n?void 0:n.type)||"mercator"),this.sky=new P(this.stylesheet.sky),this.map.setTerrain(null!==(o=this.stylesheet.terrain)&&void 0!==o?o:null),this.fire(new t.l("data",{dataType:"style"})),this.fire(new t.l("style.load"))}}_createLayers(){const e=t.bx(this.stylesheet.layers);this.dispatcher.broadcast("SL",e),this._order=e.map((e=>e.id)),this._layers={},this._serializedLayers=null;for(const i of e){const e=t.by(i);e.setEventedParent(this,{layer:{id:i.id}}),this._layers[i.id]=e}}_loadSprite(e,i=!1,r=void 0){let n;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(e,i,r,n){return t._(this,void 0,void 0,(function*(){const o=g(e),s=r>1?"@2x":"",l={},c={};for(const{id:e,url:r}of o){const o=i.transformRequest(y(r,s,".json"),"SpriteJSON");l[e]=t.j(o,n);const a=i.transformRequest(y(r,s,".png"),"SpriteImage");c[e]=m.getImage(a,n)}return yield Promise.all([...Object.values(l),...Object.values(c)]),function(e,i){return t._(this,void 0,void 0,(function*(){const t={};for(const r in e){t[r]={};const n=a.getImageCanvasContext((yield i[r]).data),o=(yield e[r]).data;for(const e in o){const{width:i,height:a,x:s,y:l,sdf:c,pixelRatio:u,stretchX:h,stretchY:p,content:d,textFitWidth:m,textFitHeight:f}=o[e];t[r][e]={data:null,pixelRatio:u,sdf:c,stretchX:h,stretchY:p,content:d,textFitWidth:m,textFitHeight:f,spriteData:{width:i,height:a,x:s,y:l,context:n}}}}return t}))}(l,c)}))}(e,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then((e=>{if(this._spriteRequest=null,e)for(const t in e){this._spritesImagesIds[t]=[];const r=this._spritesImagesIds[t]?this._spritesImagesIds[t].filter((t=>!(t in e))):[];for(const e of r)this.imageManager.removeImage(e),this._changedImages[e]=!0;for(const r in e[t]){const n="default"===t?r:`${t}:${r}`;this._spritesImagesIds[t].push(n),n in this.imageManager.images?this.imageManager.updateImage(n,e[t][r],!1):this.imageManager.addImage(n,e[t][r]),i&&(this._changedImages[n]=!0)}}})).catch((e=>{this._spriteRequest=null,n=e,this.fire(new t.k(n))})).finally((()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),i&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new t.l("data",{dataType:"style"})),r&&r(n)}))}_unloadSprite(){for(const e of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(e),this._changedImages[e]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new t.l("data",{dataType:"style"}))}_validateLayer(e){const i=this.sourceCaches[e.source];if(!i)return;const r=e.sourceLayer;if(!r)return;const n=i.getSource();("geojson"===n.type||n.vectorLayerIds&&-1===n.vectorLayerIds.indexOf(r))&&this.fire(new t.k(new Error(`Source layer "${r}" does not exist on source "${n.id}" as specified by style layer "${e.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()}_serializeByIds(e,i=!1){const r=this._serializedAllLayers();if(!e||0===e.length)return Object.values(i?t.bz(r):r);const n=[];for(const o of e)if(r[o]){const e=i?t.bz(r[o]):r[o];n.push(e)}return n}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};const t=Object.keys(this._layers);for(const i of t){const t=this._layers[i];"custom"!==t.type&&(e[i]=t.serialize())}return e}hasTransitions(){var e,t,i;if(null===(e=this.light)||void 0===e?void 0:e.hasTransition())return!0;if(null===(t=this.sky)||void 0===t?void 0:t.hasTransition())return!0;if(null===(i=this.projection)||void 0===i?void 0:i.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}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;const i=this._changed;if(i){const t=Object.keys(this._updatedLayers),i=Object.keys(this._removedLayers);(t.length||i.length)&&this._updateWorkerLayers(t,i);for(const e in this._updatedSources){const t=this._updatedSources[e];if("reload"===t)this._reloadSource(e);else{if("clear"!==t)throw new Error(`Invalid action ${t}`);this._clearSource(e)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const t in this._updatedPaintProps)this._layers[t].updateTransitions(e);this.light.updateTransitions(e),this.sky.updateTransitions(e),this._resetUpdates()}const r={};for(const e in this.sourceCaches){const t=this.sourceCaches[e];r[e]=t.used,t.used=!1}for(const t of this._order){const i=this._layers[t];i.recalculate(e,this._availableImages),!i.isHidden(e.zoom)&&i.source&&(this.sourceCaches[i.source].used=!0)}for(const e in r){const i=this.sourceCaches[e];!!r[e]!=!!i.used&&i.fire(new t.l("data",{sourceDataType:"visibility",dataType:"source",sourceId:e}))}this.light.recalculate(e),this.sky.recalculate(e),this.projection.recalculate(e),this.z=e.zoom,i&&this.fire(new t.l("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={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,t){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,!1),removedIds:t})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,i={}){var r;this._checkLoaded();const n=this.serialize();if(e=i.transformStyle?i.transformStyle(n,e):e,(null===(r=i.validate)||void 0===r||r)&&fi(this,t.y(e)))return!1;(e=t.bz(e)).layers=t.bx(e.layers);const o=t.bA(n,e),a=this._getOperationsToPerform(o);if(a.unimplemented.length>0)throw new Error(`Unimplemented: ${a.unimplemented.join(", ")}.`);if(0===a.operations.length)return!1;for(const e of a.operations)e();return this.stylesheet=e,this._serializedLayers=null,!0}_getOperationsToPerform(e){const t=[],i=[];for(const r of e)switch(r.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":t.push((()=>this.addLayer.apply(this,r.args)));break;case"removeLayer":t.push((()=>this.removeLayer.apply(this,r.args)));break;case"setPaintProperty":t.push((()=>this.setPaintProperty.apply(this,r.args)));break;case"setLayoutProperty":t.push((()=>this.setLayoutProperty.apply(this,r.args)));break;case"setFilter":t.push((()=>this.setFilter.apply(this,r.args)));break;case"addSource":t.push((()=>this.addSource.apply(this,r.args)));break;case"removeSource":t.push((()=>this.removeSource.apply(this,r.args)));break;case"setLayerZoomRange":t.push((()=>this.setLayerZoomRange.apply(this,r.args)));break;case"setLight":t.push((()=>this.setLight.apply(this,r.args)));break;case"setGeoJSONSourceData":t.push((()=>this.setGeoJSONSourceData.apply(this,r.args)));break;case"setGlyphs":t.push((()=>this.setGlyphs.apply(this,r.args)));break;case"setSprite":t.push((()=>this.setSprite.apply(this,r.args)));break;case"setTerrain":t.push((()=>this.map.setTerrain.apply(this,r.args)));break;case"setSky":t.push((()=>this.setSky.apply(this,r.args)));break;case"setProjection":this.setProjection.apply(this,r.args);break;case"setTransition":t.push((()=>{}));break;default:i.push(r.command)}return{operations:t,unimplemented:i}}addImage(e,i){if(this.getImage(e))return this.fire(new t.k(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,i),this._afterImageUpdated(e)}updateImage(e,t){this.imageManager.updateImage(e,t)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new t.k(new Error(`An image named "${e}" does not exist.`)));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new t.l("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,i,r={}){if(this._checkLoaded(),void 0!==this.sourceCaches[e])throw new Error(`Source "${e}" already exists.`);if(!i.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(t.y.source,`sources.${e}`,i,null,r))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const n=this.sourceCaches[e]=new pe(e,i,this.dispatcher);n.style=this,n.setEventedParent(this,(()=>({isSourceLoaded:n.loaded(),source:n.serialize(),sourceId:e}))),n.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID");for(const i in this._layers)if(this._layers[i].source===e)return this.fire(new t.k(new Error(`Source "${e}" cannot be removed while layer "${i}" is using it.`)));const i=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],i.fire(new t.l("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),i.setEventedParent(null),i.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,t){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error(`There is no source with this ID=${e}`);const i=this.sourceCaches[e].getSource();if("geojson"!==i.type)throw new Error(`geojsonSource.type is ${i.type}, which is !== 'geojson`);i.setData(t),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(e,i,r={}){this._checkLoaded();const n=e.id;if(this.getLayer(n))return void this.fire(new t.k(new Error(`Layer "${n}" already exists on this map.`)));let o;if("custom"===e.type){if(fi(this,t.bB(e)))return;o=t.by(e)}else{if("source"in e&&"object"==typeof e.source&&(this.addSource(n,e.source),e=t.bz(e),e=t.e(e,{source:n})),this._validate(t.y.layer,`layers.${n}`,e,{arrayIndex:-1},r))return;o=t.by(e),this._validateLayer(o),o.setEventedParent(this,{layer:{id:n}})}const a=i?this._order.indexOf(i):this._order.length;if(i&&-1===a)this.fire(new t.k(new Error(`Cannot add layer "${n}" before non-existing layer "${i}".`)));else{if(this._order.splice(a,0,n),this._layerOrderChanged=!0,this._layers[n]=o,this._removedLayers[n]&&o.source&&"custom"!==o.type){const e=this._removedLayers[n];delete this._removedLayers[n],e.type!==o.type?this._updatedSources[o.source]="clear":(this._updatedSources[o.source]="reload",this.sourceCaches[o.source].pause())}this._updateLayer(o),o.onAdd&&o.onAdd(this.map)}}moveLayer(e,i){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new t.k(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===i)return;const r=this._order.indexOf(e);this._order.splice(r,1);const n=i?this._order.indexOf(i):this._order.length;i&&-1===n?this.fire(new t.k(new Error(`Cannot move layer "${e}" before non-existing layer "${i}".`))):(this._order.splice(n,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();const i=this._layers[e];if(!i)return void this.fire(new t.k(new Error(`Cannot remove non-existing layer "${e}".`)));i.setEventedParent(null);const r=this._order.indexOf(e);this._order.splice(r,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=i,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],i.onRemove&&i.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,i,r){this._checkLoaded();const n=this.getLayer(e);n?n.minzoom===i&&n.maxzoom===r||(null!=i&&(n.minzoom=i),null!=r&&(n.maxzoom=r),this._updateLayer(n)):this.fire(new t.k(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,i,r={}){this._checkLoaded();const n=this.getLayer(e);if(n){if(!t.bC(n.filter,i))return null==i?(n.filter=void 0,void this._updateLayer(n)):void(this._validate(t.y.filter,`layers.${n.id}.filter`,i,null,r)||(n.filter=t.bz(i),this._updateLayer(n)))}else this.fire(new t.k(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return t.bz(this.getLayer(e).filter)}setLayoutProperty(e,i,r,n={}){this._checkLoaded();const o=this.getLayer(e);o?t.bC(o.getLayoutProperty(i),r)||(o.setLayoutProperty(i,r,n),this._updateLayer(o)):this.fire(new t.k(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,i){const r=this.getLayer(e);if(r)return r.getLayoutProperty(i);this.fire(new t.k(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,i,r,n={}){this._checkLoaded();const o=this.getLayer(e);o?t.bC(o.getPaintProperty(i),r)||(o.setPaintProperty(i,r,n)&&this._updateLayer(o),this._changed=!0,this._updatedPaintProps[e]=!0,this._serializedLayers=null):this.fire(new t.k(new Error(`Cannot style non-existing layer "${e}".`)))}getPaintProperty(e,t){return this.getLayer(e).getPaintProperty(t)}setFeatureState(e,i){this._checkLoaded();const r=e.source,n=e.sourceLayer,o=this.sourceCaches[r];if(void 0===o)return void this.fire(new t.k(new Error(`The source '${r}' does not exist in the map's style.`)));const a=o.getSource().type;"geojson"===a&&n?this.fire(new t.k(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==a||n?(void 0===e.id&&this.fire(new t.k(new Error("The feature id parameter must be provided."))),o.setFeatureState(n,e.id,i)):this.fire(new t.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,i){this._checkLoaded();const r=e.source,n=this.sourceCaches[r];if(void 0===n)return void this.fire(new t.k(new Error(`The source '${r}' does not exist in the map's style.`)));const o=n.getSource().type,a="vector"===o?e.sourceLayer:void 0;"vector"!==o||a?i&&"string"!=typeof e.id&&"number"!=typeof e.id?this.fire(new t.k(new Error("A feature id is required to remove its specific state property."))):n.removeFeatureState(a,e.id,i):this.fire(new t.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();const i=e.source,r=e.sourceLayer,n=this.sourceCaches[i];if(void 0!==n)return"vector"!==n.getSource().type||r?(void 0===e.id&&this.fire(new t.k(new Error("The feature id parameter must be provided."))),n.getFeatureState(r,e.id)):void this.fire(new t.k(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new t.k(new Error(`The source '${i}' does not exist in the map's style.`)))}getTransition(){return t.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const e=t.bD(this.sourceCaches,(e=>e.serialize())),i=this._serializeByIds(this._order,!0),r=this.map.getTerrain()||void 0,n=this.stylesheet;return t.bE({version:n.version,name:n.name,metadata:n.metadata,light:n.light,sky:n.sky,center:n.center,zoom:n.zoom,bearing:n.bearing,pitch:n.pitch,sprite:n.sprite,glyphs:n.glyphs,transition:n.transition,projection:n.projection,sources:e,layers:i,terrain:r},(e=>void 0!==e))}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&"raster"!==this.sourceCaches[e.source].getSource().type&&(this._updatedSources[e.source]="reload",this.sourceCaches[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){const t=e=>"fill-extrusion"===this._layers[e].type,i={},r=[];for(let n=this._order.length-1;n>=0;n--){const o=this._order[n];if(t(o)){i[o]=n;for(const t of e){const e=t[o];if(e)for(const t of e)r.push(t)}}}r.sort(((e,t)=>t.intersectionZ-e.intersectionZ));const n=[];for(let o=this._order.length-1;o>=0;o--){const a=this._order[o];if(t(a))for(let e=r.length-1;e>=0;e--){const t=r[e].feature;if(i[t.layer.id]<o)break;n.push(t),r.pop()}else for(const t of e){const e=t[a];if(e)for(const t of e)n.push(t.feature)}}return n}queryRenderedFeatures(e,i,r){i&&i.filter&&this._validate(t.y.filter,"queryRenderedFeatures.filter",i.filter,null,i);const n={};if(i&&i.layers){if(!(Array.isArray(i.layers)||i.layers instanceof Set))return this.fire(new t.k(new Error("parameters.layers must be an Array or a Set of strings"))),[];for(const e of i.layers){const i=this._layers[e];if(!i)return this.fire(new t.k(new Error(`The layer '${e}' does not exist in the map's style and cannot be queried for features.`))),[];n[i.source]=!0}}const o=[];i.availableImages=this._availableImages;const a=this._serializedAllLayers(),s=i.layers instanceof Set?i.layers:Array.isArray(i.layers)?new Set(i.layers):null,l=Object.assign(Object.assign({},i),{layers:s});for(const t in this.sourceCaches)i.layers&&!n[t]||o.push(N(this.sourceCaches[t],this._layers,a,e,l,r,this.map.terrain?(e,t,i)=>this.map.terrain.getElevation(e,t,i):void 0));return this.placement&&o.push(function(e,t,i,r,n,o,a){const s={},l=o.queryRenderedSymbols(r),c=[];for(const e of Object.keys(l).map(Number))c.push(a[e]);c.sort($);for(const i of c){const r=i.featureIndex.lookupSymbolFeatures(l[i.bucketInstanceId],t,i.bucketIndex,i.sourceLayerIndex,n.filter,n.layers,n.availableImages,e);for(const e in r){const t=s[e]=s[e]||[],n=r[e];n.sort(((e,t)=>{const r=i.featureSortOrder;if(r){const i=r.indexOf(e.featureIndex);return r.indexOf(t.featureIndex)-i}return t.featureIndex-e.featureIndex}));for(const e of n)t.push(e)}}return function(e,t,i){for(const r in e)for(const n of e[r])V(n,i[t[r].source]);return e}(s,e,i)}(this._layers,a,this.sourceCaches,e,l,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(o)}querySourceFeatures(e,i){i&&i.filter&&this._validate(t.y.filter,"querySourceFeatures.filter",i.filter,null,i);const r=this.sourceCaches[e];return r?function(e,t){const i=e.getRenderableIds().map((t=>e.getTileByID(t))),r=[],n={};for(let e=0;e<i.length;e++){const o=i[e],a=o.tileID.canonical.key;n[a]||(n[a]=!0,o.querySourceFeatures(r,t))}return r}(r,i):[]}getLight(){return this.light.getLight()}setLight(e,i={}){this._checkLoaded();const r=this.light.getLight();let n=!1;for(const i in e)if(!t.bC(e[i],r[i])){n=!0;break}if(!n)return;const o={now:a.now(),transition:t.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,i),this.light.updateTransitions(o)}getProjection(){var e;return null===(e=this.stylesheet)||void 0===e?void 0:e.projection}setProjection(e){if(this._checkLoaded(),this.projection){if(this.projection.name===e.type)return;this.projection.destroy(),delete this.projection}this.stylesheet.projection=e,this._setProjectionInternal(e.type)}getSky(){var e;return null===(e=this.stylesheet)||void 0===e?void 0:e.sky}setSky(e,i={}){this._checkLoaded();const r=this.getSky();let n=!1;if(!e&&!r)return;if(e&&!r)n=!0;else if(!e&&r)n=!0;else for(const i in e)if(!t.bC(e[i],r[i])){n=!0;break}if(!n)return;const o={now:a.now(),transition:t.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=e,this.sky.setSky(e,i),this.sky.updateTransitions(o)}_setProjectionInternal(e){const i=function(e){if(Array.isArray(e)){const t=new Xt({type:e});return{projection:t,transform:new pi,cameraHelper:new mi(t)}}switch(e){case"mercator":return{projection:new _t,transform:new kt,cameraHelper:new Ft};case"globe":{const e=new Xt({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:e,transform:new pi,cameraHelper:new mi(e)}}case"vertical-perspective":return{projection:new Wt,transform:new hi,cameraHelper:new di};default:return t.w(`Unknown projection name: ${e}. Falling back to mercator projection.`),{projection:new _t,transform:new kt,cameraHelper:new Ft}}}(e);this.projection=i.projection,this.map.migrateProjection(i.transform,i.cameraHelper);for(const e in this.sourceCaches)this.sourceCaches[e].reload()}_validate(e,i,r,n,o={}){return(!o||!1!==o.validate)&&fi(this,e.call(t.y,t.e({key:i,style:this.serialize(),value:r,styleSpec:t.v},n)))}_remove(e=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),ne().off(te,this._rtlPluginLoaded);for(const e in this._layers)this._layers[e].setEventedParent(null);for(const e in this.sourceCaches){const t=this.sourceCaches[e];t.setEventedParent(null),t.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),e&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(e)}_clearSource(e){this.sourceCaches[e].clearTiles()}_reloadSource(e){this.sourceCaches[e].resume(),this.sourceCaches[e].reload()}_updateSources(e){for(const t in this.sourceCaches)this.sourceCaches[t].update(e,this.map.terrain)}_generateCollisionBoxes(){for(const e in this.sourceCaches)this._reloadSource(e)}_updatePlacement(e,t,i,r,n=!1){let o=!1,s=!1;const l={};for(const t of this._order){const i=this._layers[t];if("symbol"!==i.type)continue;if(!l[i.source]){const e=this.sourceCaches[i.source];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 r=this.crossTileSymbolIndex.addLayer(i,l[i.source],e.center.lng);o=o||r}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((n=n||this._layerOrderChanged||0===i)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(a.now(),e.zoom))&&(this.pauseablePlacement=new ot(e,this.map.terrain,this._order,n,t,i,r,this.placement),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(a.now()),s=!0),o&&this.pauseablePlacement.placement.setStale()),s||o)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(a.now())}_releaseSymbolFadeTiles(){for(const e in this.sourceCaches)this.sourceCaches[e].releaseSymbolFadeTiles()}getImages(e,i){return t._(this,void 0,void 0,(function*(){const e=yield this.imageManager.getImages(i.icons);this._updateTilesForChangedImages();const t=this.sourceCaches[i.source];return t&&t.setDependencies(i.tileID.key,i.type,i.icons),e}))}getGlyphs(e,i){return t._(this,void 0,void 0,(function*(){const e=yield this.glyphManager.getGlyphs(i.stacks),t=this.sourceCaches[i.source];return t&&t.setDependencies(i.tileID.key,i.type,[""]),e}))}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,i={}){this._checkLoaded(),e&&this._validate(t.y.glyphs,"glyphs",e,null,i)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,i,r={},n){this._checkLoaded();const o=[{id:e,url:i}],a=[...g(this.stylesheet.sprite),...o];this._validate(t.y.sprite,"sprite",a,null,r)||(this.stylesheet.sprite=a,this._loadSprite(o,!0,n))}removeSprite(e){this._checkLoaded();const i=g(this.stylesheet.sprite);if(i.find((t=>t.id===e))){if(this._spritesImagesIds[e])for(const t of this._spritesImagesIds[e])this.imageManager.removeImage(t),this._changedImages[t]=!0;i.splice(i.findIndex((t=>t.id===e)),1),this.stylesheet.sprite=i.length>0?i:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new t.l("data",{dataType:"style"}))}else this.fire(new t.k(new Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return g(this.stylesheet.sprite)}setSprite(e,i={},r){this._checkLoaded(),e&&this._validate(t.y.sprite,"sprite",e,null,i)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,r):(this._unloadSprite(),r&&r(null)))}}var _i=t.aD([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class vi{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,t,i,r,n,o,a,s,l){this.context=e;let c=this.boundPaintVertexBuffers.length!==r.length;for(let e=0;!c&&e<r.length;e++)this.boundPaintVertexBuffers[e]!==r[e]&&(c=!0);!this.vao||this.boundProgram!==t||this.boundLayoutVertexBuffer!==i||c||this.boundIndexBuffer!==n||this.boundVertexOffset!==o||this.boundDynamicVertexBuffer!==a||this.boundDynamicVertexBuffer2!==s||this.boundDynamicVertexBuffer3!==l?this.freshBind(t,i,r,n,o,a,s,l):(e.bindVertexArray.set(this.vao),a&&a.bind(),n&&n.dynamicDraw&&n.bind(),s&&s.bind(),l&&l.bind())}freshBind(e,t,i,r,n,o,a,s){const l=e.numAttributes,c=this.context,u=c.gl;this.vao&&this.destroy(),this.vao=c.createVertexArray(),c.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=t,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=r,this.boundVertexOffset=n,this.boundDynamicVertexBuffer=o,this.boundDynamicVertexBuffer2=a,this.boundDynamicVertexBuffer3=s,t.enableAttributes(u,e);for(const t of i)t.enableAttributes(u,e);o&&o.enableAttributes(u,e),a&&a.enableAttributes(u,e),s&&s.enableAttributes(u,e),t.bind(),t.setVertexAttribPointers(u,e,n);for(const t of i)t.bind(),t.setVertexAttribPointers(u,e,n);o&&(o.bind(),o.setVertexAttribPointers(u,e,n)),r&&r.bind(),a&&(a.bind(),a.setVertexAttribPointers(u,e,n)),s&&(s.bind(),s.setVertexAttribPointers(u,e,n)),c.currentNumAttributes=l}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const xi=(e,i,r,n,o)=>({u_texture:0,u_ele_delta:e,u_fog_matrix:i,u_fog_color:r?r.properties.get("fog-color"):t.b7.white,u_fog_ground_blend:r?r.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:o?0:r?r.calculateFogBlendOpacity(n):0,u_horizon_color:r?r.properties.get("horizon-color"):t.b7.white,u_horizon_fog_blend:r?r.properties.get("horizon-fog-blend"):1,u_is_globe_mode:o?1:0}),bi={mainMatrix:"u_projection_matrix",tileMercatorCoords:"u_projection_tile_mercator_coords",clippingPlane:"u_projection_clipping_plane",projectionTransition:"u_projection_transition",fallbackMatrix:"u_projection_fallback_matrix"};function wi(e){const t=[];for(let i=0;i<e.length;i++){if(null===e[i])continue;const r=e[i].split(" ");t.push(r.pop())}return t}class Ci{constructor(e,i,r,n,o,a,s,l){const c=e.gl;this.program=c.createProgram();const u=wi(i.staticAttributes),h=r?r.getBinderAttributes():[],p=u.concat(h),d=pt.prelude.staticUniforms?wi(pt.prelude.staticUniforms):[],m=s.staticUniforms?wi(s.staticUniforms):[],f=i.staticUniforms?wi(i.staticUniforms):[],g=r?r.getBinderUniforms():[],y=d.concat(m).concat(f).concat(g),_=[];for(const e of y)_.indexOf(e)<0&&_.push(e);const v=r?r.defines():[];Ut(c)&&v.unshift("#version 300 es"),o&&v.push("#define OVERDRAW_INSPECTOR;"),a&&v.push("#define TERRAIN3D;"),l&&v.push(l);let x=v.concat(pt.prelude.fragmentSource,s.fragmentSource,i.fragmentSource).join("\n"),b=v.concat(pt.prelude.vertexSource,s.vertexSource,i.vertexSource).join("\n");Ut(c)||(x=function(e){return e.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")}(x),b=function(e){return e.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}(b));const w=c.createShader(c.FRAGMENT_SHADER);if(c.isContextLost())return void(this.failedToCreate=!0);if(c.shaderSource(w,x),c.compileShader(w),!c.getShaderParameter(w,c.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${c.getShaderInfoLog(w)}`);c.attachShader(this.program,w);const C=c.createShader(c.VERTEX_SHADER);if(c.isContextLost())return void(this.failedToCreate=!0);if(c.shaderSource(C,b),c.compileShader(C),!c.getShaderParameter(C,c.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${c.getShaderInfoLog(C)}`);c.attachShader(this.program,C),this.attributes={};const T={};this.numAttributes=p.length;for(let e=0;e<this.numAttributes;e++)p[e]&&(c.bindAttribLocation(this.program,e,p[e]),this.attributes[p[e]]=e);if(c.linkProgram(this.program),!c.getProgramParameter(this.program,c.LINK_STATUS))throw new Error(`Program failed to link: ${c.getProgramInfoLog(this.program)}`);c.deleteShader(C),c.deleteShader(w);for(let e=0;e<_.length;e++){const t=_[e];if(t&&!T[t]){const e=c.getUniformLocation(this.program,t);e&&(T[t]=e)}}this.fixedUniforms=n(e,T),this.terrainUniforms=((e,i)=>({u_depth:new t.bF(e,i.u_depth),u_terrain:new t.bF(e,i.u_terrain),u_terrain_dim:new t.b8(e,i.u_terrain_dim),u_terrain_matrix:new t.bH(e,i.u_terrain_matrix),u_terrain_unpack:new t.bI(e,i.u_terrain_unpack),u_terrain_exaggeration:new t.b8(e,i.u_terrain_exaggeration)}))(e,T),this.projectionUniforms=((e,i)=>({u_projection_matrix:new t.bH(e,i.u_projection_matrix),u_projection_tile_mercator_coords:new t.bI(e,i.u_projection_tile_mercator_coords),u_projection_clipping_plane:new t.bI(e,i.u_projection_clipping_plane),u_projection_transition:new t.b8(e,i.u_projection_transition),u_projection_fallback_matrix:new t.bH(e,i.u_projection_fallback_matrix)}))(e,T),this.binderUniforms=r?r.getUniforms(e,T):[]}draw(e,t,i,r,n,o,a,s,l,c,u,h,p,d,m,f,g,y,_){const v=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(i),e.setStencilMode(r),e.setColorMode(n),e.setCullFace(o),s){e.activeTexture.set(v.TEXTURE2),v.bindTexture(v.TEXTURE_2D,s.depthTexture),e.activeTexture.set(v.TEXTURE3),v.bindTexture(v.TEXTURE_2D,s.texture);for(const e in this.terrainUniforms)this.terrainUniforms[e].set(s[e])}if(l)for(const e in l)this.projectionUniforms[bi[e]].set(l[e]);if(a)for(const e in this.fixedUniforms)this.fixedUniforms[e].set(a[e]);f&&f.setUniforms(e,this.binderUniforms,d,{zoom:m});let x=0;switch(t){case v.LINES:x=2;break;case v.TRIANGLES:x=3;break;case v.LINE_STRIP:x=1}for(const i of p.get()){const r=i.vaos||(i.vaos={});(r[c]||(r[c]=new vi)).bind(e,this,u,f?f.getPaintVertexBuffers():[],h,i.vertexOffset,g,y,_),v.drawElements(t,i.primitiveLength*x,v.UNSIGNED_SHORT,i.primitiveOffset*x*2)}}}function Ti(e,i,r){const n=1/t.aw(r,1,i.transform.tileZoom),o=Math.pow(2,r.tileID.overscaledZ),a=r.tileSize*Math.pow(2,i.transform.tileZoom)/o,s=a*(r.tileID.canonical.x+r.tileID.wrap*o),l=a*r.tileID.canonical.y;return{u_image:0,u_texsize:r.imageAtlasTexture.size,u_scale:[n,e.fromScale,e.toScale],u_fade:e.t,u_pixel_coord_upper:[s>>16,l>>16],u_pixel_coord_lower:[65535&s,65535&l]}}const Si=(e,i,r,n)=>{const o=e.style.light,a=o.properties.get("position"),s=[a.x,a.y,a.z],l=t.bL();"viewport"===o.properties.get("anchor")&&t.bM(l,e.transform.bearingInRadians),t.bN(s,s,l);const c=e.transform.transformLightDirection(s),u=o.properties.get("color");return{u_lightpos:s,u_lightpos_globe:c,u_lightintensity:o.properties.get("intensity"),u_lightcolor:[u.r,u.g,u.b],u_vertical_gradient:+i,u_opacity:r,u_fill_translate:n}},Ai=(e,i,r,n,o,a,s)=>t.e(Si(e,i,r,n),Ti(a,e,s),{u_height_factor:-Math.pow(2,o.overscaledZ)/s.tileSize/8}),Mi=(e,i,r,n)=>t.e(Ti(i,e,r),{u_fill_translate:n}),Ei=(e,t)=>({u_world:e,u_fill_translate:t}),Pi=(e,i,r,n,o)=>t.e(Mi(e,i,r,o),{u_world:n}),Ii=(e,i,r,n,o)=>{const a=e.transform;let s,l,c=0;if("map"===r.paint.get("circle-pitch-alignment")){const e=t.aw(i,1,a.zoom);s=!0,l=[e,e],c=e/(t.Z*Math.pow(2,i.tileID.overscaledZ))*2*Math.PI*o}else s=!1,l=a.pixelsToGLUnits;return{u_camera_to_center_distance:a.cameraToCenterDistance,u_scale_with_map:+("map"===r.paint.get("circle-pitch-scale")),u_pitch_with_map:+s,u_device_pixel_ratio:e.pixelRatio,u_extrude_scale:l,u_globe_extrude_scale:c,u_translate:n}},ki=e=>({u_pixel_extrude_scale:[1/e.width,1/e.height]}),zi=e=>({u_viewport_size:[e.width,e.height]}),Li=(e,t=1)=>({u_color:e,u_overlay:0,u_overlay_scale:t}),Di=(e,i,r,n)=>{const o=t.aw(e,1,i)/(t.Z*Math.pow(2,e.tileID.overscaledZ))*2*Math.PI*n;return{u_extrude_scale:t.aw(e,1,i),u_intensity:r,u_globe_extrude_scale:o}},Fi=(e,i,r,n)=>{const o=t.K();t.bO(o,0,e.width,e.height,0,0,1);const a=e.context.gl;return{u_matrix:o,u_world:[a.drawingBufferWidth,a.drawingBufferHeight],u_image:r,u_color_ramp:n,u_opacity:i.paint.get("heatmap-opacity")}},Ri=(e,t,i)=>{const r=i.paint.get("hillshade-shadow-color"),n=i.paint.get("hillshade-highlight-color"),o=i.paint.get("hillshade-accent-color");let a=i.paint.get("hillshade-illumination-direction")*(Math.PI/180);return"viewport"===i.paint.get("hillshade-illumination-anchor")&&(a+=e.transform.bearingInRadians),{u_image:0,u_latrange:Oi(0,t.tileID),u_light:[i.paint.get("hillshade-exaggeration"),a],u_shadow:r,u_highlight:n,u_accent:o}},Bi=(e,i)=>{const r=i.stride,n=t.K();return t.bO(n,0,t.Z,-8192,0,0,1),t.L(n,n,[0,-8192,0]),{u_matrix:n,u_image:1,u_dimension:[r,r],u_zoom:e.overscaledZ,u_unpack:i.getUnpackVector()}};function Oi(e,i){const r=Math.pow(2,i.canonical.z),n=i.canonical.y;return[new t.$(0,n/r).toLngLat().lat,new t.$(0,(n+1)/r).toLngLat().lat]}const ji=(e,i,r,n)=>{const o=e.transform;return{u_translation:qi(e,i,r),u_ratio:n/t.aw(i,1,o.zoom),u_device_pixel_ratio:e.pixelRatio,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},Ni=(e,i,r,n,o)=>t.e(ji(e,i,r,n),{u_image:0,u_image_height:o}),$i=(e,i,r,n,o)=>{const a=e.transform,s=Ui(i,a);return{u_translation:qi(e,i,r),u_texsize:i.imageAtlasTexture.size,u_ratio:n/t.aw(i,1,a.zoom),u_device_pixel_ratio:e.pixelRatio,u_image:0,u_scale:[s,o.fromScale,o.toScale],u_fade:o.t,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]]}},Vi=(e,i,r,n,o,a)=>{const s=e.lineAtlas,l=Ui(i,e.transform),c="round"===r.layout.get("line-cap"),u=s.getDash(o.from,c),h=s.getDash(o.to,c),p=u.width*a.fromScale,d=h.width*a.toScale;return t.e(ji(e,i,r,n),{u_patternscale_a:[l/p,-u.height/2],u_patternscale_b:[l/d,-h.height/2],u_sdfgamma:s.width/(256*Math.min(p,d)*e.pixelRatio)/2,u_image:0,u_tex_y_a:u.y,u_tex_y_b:h.y,u_mix:a.t})};function Ui(e,i){return 1/t.aw(e,1,i.tileZoom)}function qi(e,i,r){return t.ax(e.transform,i,r.paint.get("line-translate"),r.paint.get("line-translate-anchor"))}const Zi=(e,t,i,r,n)=>{return{u_tl_parent:e,u_scale_parent:t,u_buffer_scale:1,u_fade_t:i.mix,u_opacity:i.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:(o=r.paint.get("raster-contrast"),o>0?1/(1-o):1+o),u_spin_weights:Gi(r.paint.get("raster-hue-rotate")),u_coords_top:[n[0].x,n[0].y,n[1].x,n[1].y],u_coords_bottom:[n[3].x,n[3].y,n[2].x,n[2].y]};var o,a};function Gi(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 Hi=(e,t,i,r,n,o,a,s,l,c,u,h,p)=>{const d=a.transform;return{u_is_size_zoom_constant:+("constant"===e||"source"===e),u_is_size_feature_constant:+("constant"===e||"camera"===e),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:d.cameraToCenterDistance,u_pitch:d.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:d.width/d.height,u_fade_change:a.options.fadeDuration?a.symbolFadeChange:1,u_label_plane_matrix:s,u_coord_matrix:l,u_is_text:+u,u_pitch_with_map:+r,u_is_along_line:n,u_is_variable_anchor:o,u_texsize:h,u_texture:0,u_translation:c,u_pitched_scale:p}},Wi=(e,i,r,n,o,a,s,l,c,u,h,p,d,m)=>{const f=s.transform;return t.e(Hi(e,i,r,n,o,a,s,l,c,u,h,p,m),{u_gamma_scale:n?Math.cos(f.pitch*Math.PI/180)*f.cameraToCenterDistance:1,u_device_pixel_ratio:s.pixelRatio,u_is_halo:1})},Ki=(e,i,r,n,o,a,s,l,c,u,h,p,d)=>t.e(Wi(e,i,r,n,o,a,s,l,c,u,!0,h,0,d),{u_texsize_icon:p,u_texture_icon:1}),Xi=(e,t)=>({u_opacity:e,u_color:t}),Yi=(e,i,r,n,o)=>t.e(function(e,i,r,n){const o=r.imageManager.getPattern(e.from.toString()),a=r.imageManager.getPattern(e.to.toString()),{width:s,height:l}=r.imageManager.getPixelSize(),c=Math.pow(2,n.tileID.overscaledZ),u=n.tileSize*Math.pow(2,r.transform.tileZoom)/c,h=u*(n.tileID.canonical.x+n.tileID.wrap*c),p=u*n.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:o.tl,u_pattern_br_a:o.br,u_pattern_tl_b:a.tl,u_pattern_br_b:a.br,u_texsize:[s,l],u_mix:i.t,u_pattern_size_a:o.displaySize,u_pattern_size_b:a.displaySize,u_scale_a:i.fromScale,u_scale_b:i.toScale,u_tile_units_to_pixels:1/t.aw(n,1,r.transform.tileZoom),u_pixel_coord_upper:[h>>16,p>>16],u_pixel_coord_lower:[65535&h,65535&p]}}(r,o,i,n),{u_opacity:e}),Ji=(e,t)=>{},Qi={fillExtrusion:(e,i)=>({u_lightpos:new t.bJ(e,i.u_lightpos),u_lightpos_globe:new t.bJ(e,i.u_lightpos_globe),u_lightintensity:new t.b8(e,i.u_lightintensity),u_lightcolor:new t.bJ(e,i.u_lightcolor),u_vertical_gradient:new t.b8(e,i.u_vertical_gradient),u_opacity:new t.b8(e,i.u_opacity),u_fill_translate:new t.bK(e,i.u_fill_translate)}),fillExtrusionPattern:(e,i)=>({u_lightpos:new t.bJ(e,i.u_lightpos),u_lightpos_globe:new t.bJ(e,i.u_lightpos_globe),u_lightintensity:new t.b8(e,i.u_lightintensity),u_lightcolor:new t.bJ(e,i.u_lightcolor),u_vertical_gradient:new t.b8(e,i.u_vertical_gradient),u_height_factor:new t.b8(e,i.u_height_factor),u_opacity:new t.b8(e,i.u_opacity),u_fill_translate:new t.bK(e,i.u_fill_translate),u_image:new t.bF(e,i.u_image),u_texsize:new t.bK(e,i.u_texsize),u_pixel_coord_upper:new t.bK(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.bK(e,i.u_pixel_coord_lower),u_scale:new t.bJ(e,i.u_scale),u_fade:new t.b8(e,i.u_fade)}),fill:(e,i)=>({u_fill_translate:new t.bK(e,i.u_fill_translate)}),fillPattern:(e,i)=>({u_image:new t.bF(e,i.u_image),u_texsize:new t.bK(e,i.u_texsize),u_pixel_coord_upper:new t.bK(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.bK(e,i.u_pixel_coord_lower),u_scale:new t.bJ(e,i.u_scale),u_fade:new t.b8(e,i.u_fade),u_fill_translate:new t.bK(e,i.u_fill_translate)}),fillOutline:(e,i)=>({u_world:new t.bK(e,i.u_world),u_fill_translate:new t.bK(e,i.u_fill_translate)}),fillOutlinePattern:(e,i)=>({u_world:new t.bK(e,i.u_world),u_image:new t.bF(e,i.u_image),u_texsize:new t.bK(e,i.u_texsize),u_pixel_coord_upper:new t.bK(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.bK(e,i.u_pixel_coord_lower),u_scale:new t.bJ(e,i.u_scale),u_fade:new t.b8(e,i.u_fade),u_fill_translate:new t.bK(e,i.u_fill_translate)}),circle:(e,i)=>({u_camera_to_center_distance:new t.b8(e,i.u_camera_to_center_distance),u_scale_with_map:new t.bF(e,i.u_scale_with_map),u_pitch_with_map:new t.bF(e,i.u_pitch_with_map),u_extrude_scale:new t.bK(e,i.u_extrude_scale),u_device_pixel_ratio:new t.b8(e,i.u_device_pixel_ratio),u_globe_extrude_scale:new t.b8(e,i.u_globe_extrude_scale),u_translate:new t.bK(e,i.u_translate)}),collisionBox:(e,i)=>({u_pixel_extrude_scale:new t.bK(e,i.u_pixel_extrude_scale)}),collisionCircle:(e,i)=>({u_viewport_size:new t.bK(e,i.u_viewport_size)}),debug:(e,i)=>({u_color:new t.bG(e,i.u_color),u_overlay:new t.bF(e,i.u_overlay),u_overlay_scale:new t.b8(e,i.u_overlay_scale)}),depth:Ji,clippingMask:Ji,heatmap:(e,i)=>({u_extrude_scale:new t.b8(e,i.u_extrude_scale),u_intensity:new t.b8(e,i.u_intensity),u_globe_extrude_scale:new t.b8(e,i.u_globe_extrude_scale)}),heatmapTexture:(e,i)=>({u_matrix:new t.bH(e,i.u_matrix),u_world:new t.bK(e,i.u_world),u_image:new t.bF(e,i.u_image),u_color_ramp:new t.bF(e,i.u_color_ramp),u_opacity:new t.b8(e,i.u_opacity)}),hillshade:(e,i)=>({u_image:new t.bF(e,i.u_image),u_latrange:new t.bK(e,i.u_latrange),u_light:new t.bK(e,i.u_light),u_shadow:new t.bG(e,i.u_shadow),u_highlight:new t.bG(e,i.u_highlight),u_accent:new t.bG(e,i.u_accent)}),hillshadePrepare:(e,i)=>({u_matrix:new t.bH(e,i.u_matrix),u_image:new t.bF(e,i.u_image),u_dimension:new t.bK(e,i.u_dimension),u_zoom:new t.b8(e,i.u_zoom),u_unpack:new t.bI(e,i.u_unpack)}),line:(e,i)=>({u_translation:new t.bK(e,i.u_translation),u_ratio:new t.b8(e,i.u_ratio),u_device_pixel_ratio:new t.b8(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.bK(e,i.u_units_to_pixels)}),lineGradient:(e,i)=>({u_translation:new t.bK(e,i.u_translation),u_ratio:new t.b8(e,i.u_ratio),u_device_pixel_ratio:new t.b8(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.bK(e,i.u_units_to_pixels),u_image:new t.bF(e,i.u_image),u_image_height:new t.b8(e,i.u_image_height)}),linePattern:(e,i)=>({u_translation:new t.bK(e,i.u_translation),u_texsize:new t.bK(e,i.u_texsize),u_ratio:new t.b8(e,i.u_ratio),u_device_pixel_ratio:new t.b8(e,i.u_device_pixel_ratio),u_image:new t.bF(e,i.u_image),u_units_to_pixels:new t.bK(e,i.u_units_to_pixels),u_scale:new t.bJ(e,i.u_scale),u_fade:new t.b8(e,i.u_fade)}),lineSDF:(e,i)=>({u_translation:new t.bK(e,i.u_translation),u_ratio:new t.b8(e,i.u_ratio),u_device_pixel_ratio:new t.b8(e,i.u_device_pixel_ratio),u_units_to_pixels:new t.bK(e,i.u_units_to_pixels),u_patternscale_a:new t.bK(e,i.u_patternscale_a),u_patternscale_b:new t.bK(e,i.u_patternscale_b),u_sdfgamma:new t.b8(e,i.u_sdfgamma),u_image:new t.bF(e,i.u_image),u_tex_y_a:new t.b8(e,i.u_tex_y_a),u_tex_y_b:new t.b8(e,i.u_tex_y_b),u_mix:new t.b8(e,i.u_mix)}),raster:(e,i)=>({u_tl_parent:new t.bK(e,i.u_tl_parent),u_scale_parent:new t.b8(e,i.u_scale_parent),u_buffer_scale:new t.b8(e,i.u_buffer_scale),u_fade_t:new t.b8(e,i.u_fade_t),u_opacity:new t.b8(e,i.u_opacity),u_image0:new t.bF(e,i.u_image0),u_image1:new t.bF(e,i.u_image1),u_brightness_low:new t.b8(e,i.u_brightness_low),u_brightness_high:new t.b8(e,i.u_brightness_high),u_saturation_factor:new t.b8(e,i.u_saturation_factor),u_contrast_factor:new t.b8(e,i.u_contrast_factor),u_spin_weights:new t.bJ(e,i.u_spin_weights),u_coords_top:new t.bI(e,i.u_coords_top),u_coords_bottom:new t.bI(e,i.u_coords_bottom)}),symbolIcon:(e,i)=>({u_is_size_zoom_constant:new t.bF(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.bF(e,i.u_is_size_feature_constant),u_size_t:new t.b8(e,i.u_size_t),u_size:new t.b8(e,i.u_size),u_camera_to_center_distance:new t.b8(e,i.u_camera_to_center_distance),u_pitch:new t.b8(e,i.u_pitch),u_rotate_symbol:new t.bF(e,i.u_rotate_symbol),u_aspect_ratio:new t.b8(e,i.u_aspect_ratio),u_fade_change:new t.b8(e,i.u_fade_change),u_label_plane_matrix:new t.bH(e,i.u_label_plane_matrix),u_coord_matrix:new t.bH(e,i.u_coord_matrix),u_is_text:new t.bF(e,i.u_is_text),u_pitch_with_map:new t.bF(e,i.u_pitch_with_map),u_is_along_line:new t.bF(e,i.u_is_along_line),u_is_variable_anchor:new t.bF(e,i.u_is_variable_anchor),u_texsize:new t.bK(e,i.u_texsize),u_texture:new t.bF(e,i.u_texture),u_translation:new t.bK(e,i.u_translation),u_pitched_scale:new t.b8(e,i.u_pitched_scale)}),symbolSDF:(e,i)=>({u_is_size_zoom_constant:new t.bF(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.bF(e,i.u_is_size_feature_constant),u_size_t:new t.b8(e,i.u_size_t),u_size:new t.b8(e,i.u_size),u_camera_to_center_distance:new t.b8(e,i.u_camera_to_center_distance),u_pitch:new t.b8(e,i.u_pitch),u_rotate_symbol:new t.bF(e,i.u_rotate_symbol),u_aspect_ratio:new t.b8(e,i.u_aspect_ratio),u_fade_change:new t.b8(e,i.u_fade_change),u_label_plane_matrix:new t.bH(e,i.u_label_plane_matrix),u_coord_matrix:new t.bH(e,i.u_coord_matrix),u_is_text:new t.bF(e,i.u_is_text),u_pitch_with_map:new t.bF(e,i.u_pitch_with_map),u_is_along_line:new t.bF(e,i.u_is_along_line),u_is_variable_anchor:new t.bF(e,i.u_is_variable_anchor),u_texsize:new t.bK(e,i.u_texsize),u_texture:new t.bF(e,i.u_texture),u_gamma_scale:new t.b8(e,i.u_gamma_scale),u_device_pixel_ratio:new t.b8(e,i.u_device_pixel_ratio),u_is_halo:new t.bF(e,i.u_is_halo),u_translation:new t.bK(e,i.u_translation),u_pitched_scale:new t.b8(e,i.u_pitched_scale)}),symbolTextAndIcon:(e,i)=>({u_is_size_zoom_constant:new t.bF(e,i.u_is_size_zoom_constant),u_is_size_feature_constant:new t.bF(e,i.u_is_size_feature_constant),u_size_t:new t.b8(e,i.u_size_t),u_size:new t.b8(e,i.u_size),u_camera_to_center_distance:new t.b8(e,i.u_camera_to_center_distance),u_pitch:new t.b8(e,i.u_pitch),u_rotate_symbol:new t.bF(e,i.u_rotate_symbol),u_aspect_ratio:new t.b8(e,i.u_aspect_ratio),u_fade_change:new t.b8(e,i.u_fade_change),u_label_plane_matrix:new t.bH(e,i.u_label_plane_matrix),u_coord_matrix:new t.bH(e,i.u_coord_matrix),u_is_text:new t.bF(e,i.u_is_text),u_pitch_with_map:new t.bF(e,i.u_pitch_with_map),u_is_along_line:new t.bF(e,i.u_is_along_line),u_is_variable_anchor:new t.bF(e,i.u_is_variable_anchor),u_texsize:new t.bK(e,i.u_texsize),u_texsize_icon:new t.bK(e,i.u_texsize_icon),u_texture:new t.bF(e,i.u_texture),u_texture_icon:new t.bF(e,i.u_texture_icon),u_gamma_scale:new t.b8(e,i.u_gamma_scale),u_device_pixel_ratio:new t.b8(e,i.u_device_pixel_ratio),u_is_halo:new t.bF(e,i.u_is_halo),u_translation:new t.bK(e,i.u_translation),u_pitched_scale:new t.b8(e,i.u_pitched_scale)}),background:(e,i)=>({u_opacity:new t.b8(e,i.u_opacity),u_color:new t.bG(e,i.u_color)}),backgroundPattern:(e,i)=>({u_opacity:new t.b8(e,i.u_opacity),u_image:new t.bF(e,i.u_image),u_pattern_tl_a:new t.bK(e,i.u_pattern_tl_a),u_pattern_br_a:new t.bK(e,i.u_pattern_br_a),u_pattern_tl_b:new t.bK(e,i.u_pattern_tl_b),u_pattern_br_b:new t.bK(e,i.u_pattern_br_b),u_texsize:new t.bK(e,i.u_texsize),u_mix:new t.b8(e,i.u_mix),u_pattern_size_a:new t.bK(e,i.u_pattern_size_a),u_pattern_size_b:new t.bK(e,i.u_pattern_size_b),u_scale_a:new t.b8(e,i.u_scale_a),u_scale_b:new t.b8(e,i.u_scale_b),u_pixel_coord_upper:new t.bK(e,i.u_pixel_coord_upper),u_pixel_coord_lower:new t.bK(e,i.u_pixel_coord_lower),u_tile_units_to_pixels:new t.b8(e,i.u_tile_units_to_pixels)}),terrain:(e,i)=>({u_texture:new t.bF(e,i.u_texture),u_ele_delta:new t.b8(e,i.u_ele_delta),u_fog_matrix:new t.bH(e,i.u_fog_matrix),u_fog_color:new t.bG(e,i.u_fog_color),u_fog_ground_blend:new t.b8(e,i.u_fog_ground_blend),u_fog_ground_blend_opacity:new t.b8(e,i.u_fog_ground_blend_opacity),u_horizon_color:new t.bG(e,i.u_horizon_color),u_horizon_fog_blend:new t.b8(e,i.u_horizon_fog_blend),u_is_globe_mode:new t.b8(e,i.u_is_globe_mode)}),terrainDepth:(e,i)=>({u_ele_delta:new t.b8(e,i.u_ele_delta)}),terrainCoords:(e,i)=>({u_texture:new t.bF(e,i.u_texture),u_terrain_coords_id:new t.b8(e,i.u_terrain_coords_id),u_ele_delta:new t.b8(e,i.u_ele_delta)}),projectionErrorMeasurement:(e,i)=>({u_input:new t.b8(e,i.u_input),u_output_expected:new t.b8(e,i.u_output_expected)}),atmosphere:(e,i)=>({u_sun_pos:new t.bJ(e,i.u_sun_pos),u_atmosphere_blend:new t.b8(e,i.u_atmosphere_blend),u_globe_position:new t.bJ(e,i.u_globe_position),u_globe_radius:new t.b8(e,i.u_globe_radius),u_inv_proj_matrix:new t.bH(e,i.u_inv_proj_matrix)}),sky:(e,i)=>({u_sky_color:new t.bG(e,i.u_sky_color),u_horizon_color:new t.bG(e,i.u_horizon_color),u_horizon:new t.bK(e,i.u_horizon),u_horizon_normal:new t.bK(e,i.u_horizon_normal),u_sky_horizon_blend:new t.b8(e,i.u_sky_horizon_blend),u_sky_blend:new t.b8(e,i.u_sky_blend)})};class er{constructor(e,t,i){this.context=e;const r=e.gl;this.buffer=r.createBuffer(),this.dynamicDraw=Boolean(i),this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||delete t.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){const t=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const tr={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class ir{constructor(e,t,i,r){this.length=t.length,this.attributes=i,this.itemSize=t.bytesPerElement,this.dynamicDraw=r,this.context=e;const n=e.gl;this.buffer=n.createBuffer(),e.bindVertexBuffer.set(this.buffer),n.bufferData(n.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||delete t.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw new Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);const t=this.context.gl;this.bind(),t.bufferSubData(t.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,t){for(let i=0;i<this.attributes.length;i++){const r=t.attributes[this.attributes[i].name];void 0!==r&&e.enableVertexAttribArray(r)}}setVertexAttribPointers(e,t,i){for(let r=0;r<this.attributes.length;r++){const n=this.attributes[r],o=t.attributes[n.name];void 0!==o&&e.vertexAttribPointer(o,n.components,e[tr[n.type]],!1,this.itemSize,n.offset+this.itemSize*(i||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class rr{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class nr extends rr{getDefault(){return t.b7.transparent}set(e){const t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class or extends rr{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class ar extends rr{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class sr extends rr{getDefault(){return[!0,!0,!0,!0]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class lr extends rr{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class cr extends rr{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class ur extends rr{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){const t=this.current;(e.func!==t.func||e.ref!==t.ref||e.mask!==t.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class hr extends rr{getDefault(){const e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class pr extends rr{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.current=e,this.dirty=!1}}class dr extends rr{getDefault(){return[0,1]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class mr extends rr{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),this.current=e,this.dirty=!1}}class fr extends rr{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class gr extends rr{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.BLEND):t.disable(t.BLEND),this.current=e,this.dirty=!1}}class yr extends rr{getDefault(){const e=this.gl;return[e.ONE,e.ZERO]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}}class _r extends rr{getDefault(){return t.b7.transparent}set(e){const t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class vr extends rr{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class xr extends rr{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),this.current=e,this.dirty=!1}}class br extends rr{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class wr extends rr{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class Cr extends rr{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class Tr extends rr{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class Sr extends rr{getDefault(){const e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class Ar extends rr{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class Mr extends rr{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindRenderbuffer(t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Er extends rr{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindTexture(t.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class Pr extends rr{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class Ir extends rr{getDefault(){return null}set(e){const t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class kr extends rr{getDefault(){return null}set(e){var t;if(e===this.current&&!this.dirty)return;const i=this.gl;Ut(i)?i.bindVertexArray(e):null===(t=i.getExtension("OES_vertex_array_object"))||void 0===t||t.bindVertexArrayOES(e),this.current=e,this.dirty=!1}}class zr extends rr{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class Lr extends rr{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class Dr extends rr{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class Fr extends rr{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}}class Rr extends Fr{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class Br extends Fr{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Or extends Fr{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}const jr="Framebuffer is not complete";class Nr{constructor(e,t,i,r,n){this.context=e,this.width=t,this.height=i;const o=e.gl,a=this.framebuffer=o.createFramebuffer();if(this.colorAttachment=new Rr(e,a),r)this.depthAttachment=n?new Or(e,a):new Br(e,a);else if(n)throw new Error("Stencil cannot be set without depth");if(o.checkFramebufferStatus(o.FRAMEBUFFER)!==o.FRAMEBUFFER_COMPLETE)throw new Error(jr)}destroy(){const e=this.context.gl,t=this.colorAttachment.get();if(t&&e.deleteTexture(t),this.depthAttachment){const t=this.depthAttachment.get();t&&e.deleteRenderbuffer(t)}e.deleteFramebuffer(this.framebuffer)}}class $r{constructor(e){var t,i;if(this.gl=e,this.clearColor=new nr(this),this.clearDepth=new or(this),this.clearStencil=new ar(this),this.colorMask=new sr(this),this.depthMask=new lr(this),this.stencilMask=new cr(this),this.stencilFunc=new ur(this),this.stencilOp=new hr(this),this.stencilTest=new pr(this),this.depthRange=new dr(this),this.depthTest=new mr(this),this.depthFunc=new fr(this),this.blend=new gr(this),this.blendFunc=new yr(this),this.blendColor=new _r(this),this.blendEquation=new vr(this),this.cullFace=new xr(this),this.cullFaceSide=new br(this),this.frontFace=new wr(this),this.program=new Cr(this),this.activeTexture=new Tr(this),this.viewport=new Sr(this),this.bindFramebuffer=new Ar(this),this.bindRenderbuffer=new Mr(this),this.bindTexture=new Er(this),this.bindVertexBuffer=new Pr(this),this.bindElementBuffer=new Ir(this),this.bindVertexArray=new kr(this),this.pixelStoreUnpack=new zr(this),this.pixelStoreUnpackPremultiplyAlpha=new Lr(this),this.pixelStoreUnpackFlipY=new Dr(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),Ut(e)){this.HALF_FLOAT=e.HALF_FLOAT;const r=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=null!==(t=e.RGBA16F)&&void 0!==t?t:null==r?void 0:r.RGBA16F_EXT,this.RGB16F=null!==(i=e.RGB16F)&&void 0!==i?i:null==r?void 0:r.RGB16F_EXT,e.getExtension("EXT_color_buffer_float")}else{e.getExtension("EXT_color_buffer_half_float"),e.getExtension("OES_texture_half_float_linear");const t=e.getExtension("OES_texture_half_float");this.HALF_FLOAT=null==t?void 0:t.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(e,t){return new er(this,e,t)}createVertexBuffer(e,t,i){return new ir(this,e,t,i)}createRenderbuffer(e,t,i){const r=this.gl,n=r.createRenderbuffer();return this.bindRenderbuffer.set(n),r.renderbufferStorage(r.RENDERBUFFER,e,t,i),this.bindRenderbuffer.set(null),n}createFramebuffer(e,t,i,r){return new Nr(this,e,t,i,r)}clear({color:e,depth:t,stencil:i}){const r=this.gl;let n=0;e&&(n|=r.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),void 0!==t&&(n|=r.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),void 0!==i&&(n|=r.STENCIL_BUFFER_BIT,this.clearStencil.set(i),this.stencilMask.set(255)),r.clear(n)}setCullFace(e){!1===e.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(e){t.bC(e.blendFunction,Rt.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){var e;return Ut(this.gl)?this.gl.createVertexArray():null===(e=this.gl.getExtension("OES_vertex_array_object"))||void 0===e?void 0:e.createVertexArrayOES()}deleteVertexArray(e){var t;return Ut(this.gl)?this.gl.deleteVertexArray(e):null===(t=this.gl.getExtension("OES_vertex_array_object"))||void 0===t?void 0:t.deleteVertexArrayOES(e)}unbindVAO(){this.bindVertexArray.set(null)}}let Vr;function Ur(e,i,r,n,o){const a=e.context,s=e.transform,l=a.gl,c=e.useProgram("collisionBox"),u=[];let h=0,p=0;for(let t=0;t<n.length;t++){const d=n[t],m=i.getTile(d).getBucket(r);if(!m)continue;const f=o?m.textCollisionBox:m.iconCollisionBox,g=m.collisionCircleArray;g.length>0&&(u.push({circleArray:g,circleOffset:p,coord:d}),h+=g.length/4,p=h),f&&c.draw(a,l.LINES,jt.disabled,$t.disabled,e.colorModeForRenderPass(),Ot.disabled,ki(e.transform),e.style.map.terrain&&e.style.map.terrain.getTerrainData(d),s.getProjectionData({overscaledTileID:d,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),r.id,f.layoutVertexBuffer,f.indexBuffer,f.segments,null,e.transform.zoom,null,null,f.collisionVertexBuffer)}if(!o||!u.length)return;const d=e.useProgram("collisionCircle"),m=new t.bP;m.resize(4*h),m._trim();let f=0;for(const e of u)for(let t=0;t<e.circleArray.length/4;t++){const i=4*t,r=e.circleArray[i+0],n=e.circleArray[i+1],o=e.circleArray[i+2],a=e.circleArray[i+3];m.emplace(f++,r,n,o,a,0),m.emplace(f++,r,n,o,a,1),m.emplace(f++,r,n,o,a,2),m.emplace(f++,r,n,o,a,3)}(!Vr||Vr.length<2*h)&&(Vr=function(e){const i=2*e,r=new t.bR;r.resize(i),r._trim();for(let e=0;e<i;e++){const t=6*e;r.uint16[t+0]=4*e+0,r.uint16[t+1]=4*e+1,r.uint16[t+2]=4*e+2,r.uint16[t+3]=4*e+2,r.uint16[t+4]=4*e+3,r.uint16[t+5]=4*e+0}return r}(h));const g=a.createIndexBuffer(Vr,!0),y=a.createVertexBuffer(m,t.bQ.members,!0);for(const i of u){const n=zi(e.transform);d.draw(a,l.TRIANGLES,jt.disabled,$t.disabled,e.colorModeForRenderPass(),Ot.disabled,n,e.style.map.terrain&&e.style.map.terrain.getTerrainData(i.coord),null,r.id,y,g,t.aG.simpleSegment(0,2*i.circleOffset,i.circleArray.length,i.circleArray.length/2),null,e.transform.zoom,null,null,null)}y.destroy(),g.destroy()}const qr=t.at(new Float32Array(16));function Zr(e,i,r,n,o,a){const{horizontalAlign:s,verticalAlign:l}=t.aB(e);return new t.P((-(s-.5)*i/o+n[0])*a,(-(l-.5)*r/o+n[1])*a)}function Gr(e,i,r,n,o,a){const s=i.tileAnchorPoint.add(new t.P(i.translation[0],i.translation[1]));if(i.pitchWithMap){let e=n.mult(a);r||(e=e.rotate(-o));const t=s.add(e);return be(t.x,t.y,i.pitchedLabelPlaneMatrix,i.getElevation).point}if(r){const t=Ie(i.tileAnchorPoint.x+1,i.tileAnchorPoint.y,i).point.sub(e),r=Math.atan(t.y/t.x)+(t.x<0?Math.PI:0);return e.add(n.rotate(r))}return e.add(n)}function Hr(e,i,r,n,o,a,s,l,c,u,h,p){const d=e.text.placedSymbolArray,m=e.text.dynamicLayoutVertexArray,f=e.icon.dynamicLayoutVertexArray,g={};m.clear();for(let f=0;f<d.length;f++){const y=d.get(f),_=y.hidden||!y.crossTileID||e.allowVerticalPlacement&&!y.placedOrientation?null:n[y.crossTileID];if(_){const n=new t.P(y.anchorX,y.anchorY),d={getElevation:p,width:o.width,height:o.height,pitchedLabelPlaneMatrix:a,pitchWithMap:r,transform:o,tileAnchorPoint:n,translation:u,unwrappedTileID:h},f=r?ze(n.x,n.y,d):Ie(n.x,n.y,d),v=we(o.cameraToCenterDistance,f.signedDistanceFromCamera);let x=t.ai(e.textSizeData,l,y)*v/t.av;r&&(x*=e.tilePixelRatio/s);const{width:b,height:w,anchor:C,textOffset:T,textBoxScale:S}=_,A=Zr(C,b,w,T,S,x),M=o.getPitchedTextCorrection(n.x+u[0],n.y+u[1],h),E=Gr(f.point,d,i,A,-o.bearingInRadians,M),P=e.allowVerticalPlacement&&y.placedOrientation===t.ah.vertical?Math.PI/2:0;for(let e=0;e<y.numGlyphs;e++)t.ao(m,E,P);c&&y.associatedIconIndex>=0&&(g[y.associatedIconIndex]={shiftedAnchor:E,angle:P})}else Be(y.numGlyphs,m)}if(c){f.clear();const i=e.icon.placedSymbolArray;for(let e=0;e<i.length;e++){const r=i.get(e);if(r.hidden)Be(r.numGlyphs,f);else{const i=g[e];if(i)for(let e=0;e<r.numGlyphs;e++)t.ao(f,i.shiftedAnchor,i.angle);else Be(r.numGlyphs,f)}}e.icon.dynamicLayoutVertexBuffer.updateData(f)}e.text.dynamicLayoutVertexBuffer.updateData(m)}function Wr(e,t,i){return i.iconsInText&&t?"symbolTextAndIcon":e?"symbolSDF":"symbolIcon"}function Kr(e,i,r,n,o,a,s,l,c,u,h,p,d){const m=e.context,f=m.gl,g=e.transform,y="map"===l,_="map"===c,v="viewport"!==l&&"point"!==r.layout.get("symbol-placement"),x=y&&!_&&!v,b=!r.layout.get("symbol-sort-key").isConstant();let w=!1;const C=e.getDepthModeForSublayer(0,jt.ReadOnly),T=r._unevaluatedLayout.hasValue("text-variable-anchor")||r._unevaluatedLayout.hasValue("text-variable-anchor-offset"),S=[],A=g.getCircleRadiusCorrection();for(const l of n){const n=i.getTile(l),c=n.getBucket(r);if(!c)continue;const h=o?c.text:c.icon;if(!h||!h.segments.get().length||!h.hasVisibleVertices)continue;const p=h.programConfigurations.get(r.id),m=o||c.sdfIcons,C=o?c.textSizeData:c.iconSizeData,M=_||0!==g.pitch,E=e.useProgram(Wr(m,o,c),p),P=t.ag(C,g.zoom),I=e.style.map.terrain&&e.style.map.terrain.getTerrainData(l);let k,z,L,D,F=[0,0],R=null;if(o)z=n.glyphAtlasTexture,L=f.LINEAR,k=n.glyphAtlasTexture.size,c.iconsInText&&(F=n.imageAtlasTexture.size,R=n.imageAtlasTexture,D=M||e.options.rotating||e.options.zooming||"composite"===C.kind||"camera"===C.kind?f.LINEAR:f.NEAREST);else{const t=1!==r.layout.get("icon-size").constantOr(0)||c.iconsNeedLinear;z=n.imageAtlasTexture,L=m||e.options.rotating||e.options.zooming||t||M?f.LINEAR:f.NEAREST,k=n.imageAtlasTexture.size}const B=t.aw(n,1,e.transform.zoom),O=_e(y,e.transform,B),j=t.K();t.aj(j,O);const N=ve(_,y,e.transform,B),$=t.ax(g,n,a,s),V=g.getProjectionData({overscaledTileID:l,applyGlobeMatrix:!d,applyTerrainMatrix:!0}),U=T&&c.hasTextData(),q="none"!==r.layout.get("icon-text-fit")&&U&&c.hasIconData();if(v){const t=e.style.map.terrain?(t,i)=>e.style.map.terrain.getElevation(l,t,i):null,i="map"===r.layout.get("text-rotation-alignment");Te(c,e,o,O,j,_,u,i,l.toUnwrapped(),g.width,g.height,$,t)}const Z=o&&T||q,G=v||Z?qr:_?O:e.transform.clipSpaceToPixelsMatrix,H=m&&0!==r.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1);let W;W=m?c.iconsInText?Ki(C.kind,P,x,_,v,Z,e,G,N,$,k,F,A):Wi(C.kind,P,x,_,v,Z,e,G,N,$,o,k,0,A):Hi(C.kind,P,x,_,v,Z,e,G,N,$,o,k,A);const K={program:E,buffers:h,uniformValues:W,projectionData:V,atlasTexture:z,atlasTextureIcon:R,atlasInterpolation:L,atlasInterpolationIcon:D,isSDF:m,hasHalo:H};if(b&&c.canOverlap){w=!0;const e=h.segments.get();for(const i of e)S.push({segments:new t.aG([i]),sortKey:i.sortKey,state:K,terrainData:I})}else S.push({segments:h.segments,sortKey:0,state:K,terrainData:I})}w&&S.sort(((e,t)=>e.sortKey-t.sortKey));for(const t of S){const i=t.state;if(m.activeTexture.set(f.TEXTURE0),i.atlasTexture.bind(i.atlasInterpolation,f.CLAMP_TO_EDGE),i.atlasTextureIcon&&(m.activeTexture.set(f.TEXTURE1),i.atlasTextureIcon&&i.atlasTextureIcon.bind(i.atlasInterpolationIcon,f.CLAMP_TO_EDGE)),i.isSDF){const n=i.uniformValues;i.hasHalo&&(n.u_is_halo=1,Xr(i.buffers,t.segments,r,e,i.program,C,h,p,n,i.projectionData,t.terrainData)),n.u_is_halo=0}Xr(i.buffers,t.segments,r,e,i.program,C,h,p,i.uniformValues,i.projectionData,t.terrainData)}}function Xr(e,t,i,r,n,o,a,s,l,c,u){const h=r.context;n.draw(h,h.gl.TRIANGLES,o,a,s,Ot.backCCW,l,u,c,i.id,e.layoutVertexBuffer,e.indexBuffer,t,i.paint,r.transform.zoom,e.programConfigurations.get(i.id),e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer)}function Yr(e,i,r,n,o){const a=e.context,s=a.gl,l=$t.disabled,c=new Rt([s.ONE,s.ONE],t.b7.transparent,[!0,!0,!0,!0]),u=i.getBucket(r);if(!u)return;const h=n.key;let p=r.heatmapFbos.get(h);p||(p=Qr(a,i.tileSize,i.tileSize),r.heatmapFbos.set(h,p)),a.bindFramebuffer.set(p.framebuffer),a.viewport.set([0,0,i.tileSize,i.tileSize]),a.clear({color:t.b7.transparent});const d=u.programConfigurations.get(r.id),m=e.useProgram("heatmap",d,!o),f=e.transform.getProjectionData({overscaledTileID:i.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),g=e.style.map.terrain.getTerrainData(n);m.draw(a,s.TRIANGLES,jt.disabled,l,c,Ot.disabled,Di(i,e.transform.zoom,r.paint.get("heatmap-intensity"),1),g,f,r.id,u.layoutVertexBuffer,u.indexBuffer,u.segments,r.paint,e.transform.zoom,d)}function Jr(e,t,i,r,n){const o=e.context,a=o.gl,s=e.transform;o.setColorMode(e.colorModeForRenderPass());const l=en(o,t),c=i.key,u=t.heatmapFbos.get(c);if(!u)return;o.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,u.colorAttachment.get()),o.activeTexture.set(a.TEXTURE1),l.bind(a.LINEAR,a.CLAMP_TO_EDGE);const h=s.getProjectionData({overscaledTileID:i,applyTerrainMatrix:n,applyGlobeMatrix:!r});e.useProgram("heatmapTexture").draw(o,a.TRIANGLES,jt.disabled,$t.disabled,e.colorModeForRenderPass(),Ot.disabled,Fi(e,t,0,1),null,h,t.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments,t.paint,s.zoom),u.destroy(),t.heatmapFbos.delete(c)}function Qr(e,t,i){var r,n;const o=e.gl,a=o.createTexture();o.bindTexture(o.TEXTURE_2D,a),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR);const s=null!==(r=e.HALF_FLOAT)&&void 0!==r?r:o.UNSIGNED_BYTE,l=null!==(n=e.RGBA16F)&&void 0!==n?n:o.RGBA;o.texImage2D(o.TEXTURE_2D,0,l,t,i,0,o.RGBA,s,null);const c=e.createFramebuffer(t,i,!1,!1);return c.colorAttachment.set(a),c}function en(e,t){return t.colorRampTexture||(t.colorRampTexture=new _(e,t.colorRamp,e.gl.RGBA)),t.colorRampTexture}function tn(e,t,i,r,n){if(!i||!r||!r.imageAtlas)return;const o=r.imageAtlas.patternPositions;let a=o[i.to.toString()],s=o[i.from.toString()];if(!a&&s&&(a=s),!s&&a&&(s=a),!a||!s){const e=n.getPaintProperty(t);a=o[e],s=o[e]}a&&s&&e.setConstantPatternPositions(a,s)}function rn(e,i,r,n,o,a,s,l){const c=e.context.gl,u="fill-pattern",h=r.paint.get(u),p=h&&h.constantOr(1),d=r.getCrossfadeParameters();let m,f,g,y,_;const v=e.transform,x=r.paint.get("fill-translate"),b=r.paint.get("fill-translate-anchor");s?(f=p&&!r.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",m=c.LINES):(f=p?"fillPattern":"fill",m=c.TRIANGLES);const w=h.constantOr(null);for(const h of n){const C=i.getTile(h);if(p&&!C.patternsLoaded())continue;const T=C.getBucket(r);if(!T)continue;const S=T.programConfigurations.get(r.id),A=e.useProgram(f,S),M=e.style.map.terrain&&e.style.map.terrain.getTerrainData(h);p&&(e.context.activeTexture.set(c.TEXTURE0),C.imageAtlasTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),S.updatePaintBuffers(d)),tn(S,u,w,C,r);const E=v.getProjectionData({overscaledTileID:h,applyGlobeMatrix:!l,applyTerrainMatrix:!0}),P=t.ax(v,C,x,b);if(s){y=T.indexBuffer2,_=T.segments2;const t=[c.drawingBufferWidth,c.drawingBufferHeight];g="fillOutlinePattern"===f&&p?Pi(e,d,C,t,P):Ei(t,P)}else y=T.indexBuffer,_=T.segments,g=p?Mi(e,d,C,P):{u_fill_translate:P};let I;if("translucent"===e.renderPass&&l){const[t]=e.getStencilConfigForOverlapAndUpdateStencilID(n);I=t[h.overscaledZ]}else I=e.stencilModeForClipping(h);A.draw(e.context,m,o,I,a,Ot.backCCW,g,M,E,r.id,T.layoutVertexBuffer,y,_,r.paint,e.transform.zoom,S)}}function nn(e,i,r,n,o,a,s,l){const c=e.context,u=c.gl,h="fill-extrusion-pattern",p=r.paint.get(h),d=p.constantOr(1),m=r.getCrossfadeParameters(),f=r.paint.get("fill-extrusion-opacity"),g=p.constantOr(null),y=e.transform;for(const p of n){const n=i.getTile(p),_=n.getBucket(r);if(!_)continue;const v=e.style.map.terrain&&e.style.map.terrain.getTerrainData(p),x=_.programConfigurations.get(r.id),b=e.useProgram(d?"fillExtrusionPattern":"fillExtrusion",x);d&&(e.context.activeTexture.set(u.TEXTURE0),n.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),x.updatePaintBuffers(m));const w=y.getProjectionData({overscaledTileID:p,applyGlobeMatrix:!l,applyTerrainMatrix:!0});tn(x,h,g,n,r);const C=t.ax(y,n,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),T=r.paint.get("fill-extrusion-vertical-gradient"),S=d?Ai(e,T,f,C,p,m,n):Si(e,T,f,C);b.draw(c,c.gl.TRIANGLES,o,a,s,Ot.backCCW,S,v,w,r.id,_.layoutVertexBuffer,_.indexBuffer,_.segments,r.paint,e.transform.zoom,x,e.style.map.terrain&&_.centroidVertexBuffer)}}function on(e,t,i,r,n,o,a,s,l){var c;const u=e.style.projection,h=e.context,p=e.transform,d=h.gl,m=e.useProgram("hillshade"),f=!e.options.moving;for(const g of r){const r=t.getTile(g),y=r.fbo;if(!y)continue;const _=u.getMeshFromTileID(h,g.canonical,s,!0,"raster"),v=null===(c=e.style.map.terrain)||void 0===c?void 0:c.getTerrainData(g);h.activeTexture.set(d.TEXTURE0),d.bindTexture(d.TEXTURE_2D,y.colorAttachment.get());const x=p.getProjectionData({overscaledTileID:g,aligned:f,applyGlobeMatrix:!l,applyTerrainMatrix:!0});m.draw(h,d.TRIANGLES,o,n[g.overscaledZ],a,Ot.backCCW,Ri(e,r,i),v,x,i.id,_.vertexBuffer,_.indexBuffer,_.segments)}}const an=[new t.P(0,0),new t.P(t.Z,0),new t.P(t.Z,t.Z),new t.P(0,t.Z)];function sn(e,t,i,r,n,o,a,s,l=!1,c=!1){const u=r[r.length-1].overscaledZ,h=e.context,p=h.gl,d=e.useProgram("raster"),m=e.transform,f=e.style.projection,g=e.colorModeForRenderPass(),y=!e.options.moving;for(const _ of r){const r=e.getDepthModeForSublayer(_.overscaledZ-u,1===i.paint.get("raster-opacity")?jt.ReadWrite:jt.ReadOnly,p.LESS),v=t.getTile(_);v.registerFadeDuration(i.paint.get("raster-fade-duration"));const x=t.findLoadedParent(_,0),b=t.findLoadedSibling(_),w=ln(v,x||b||null,t,i,e.transform,e.style.map.terrain);let C,T;const S="nearest"===i.paint.get("raster-resampling")?p.NEAREST:p.LINEAR;h.activeTexture.set(p.TEXTURE0),v.texture.bind(S,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),h.activeTexture.set(p.TEXTURE1),x?(x.texture.bind(S,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),C=Math.pow(2,x.tileID.overscaledZ-v.tileID.overscaledZ),T=[v.tileID.canonical.x*C%1,v.tileID.canonical.y*C%1]):v.texture.bind(S,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),v.texture.useMipmap&&h.extTextureFilterAnisotropic&&e.transform.pitch>20&&p.texParameterf(p.TEXTURE_2D,h.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,h.extTextureFilterAnisotropicMax);const A=e.style.map.terrain&&e.style.map.terrain.getTerrainData(_),M=m.getProjectionData({overscaledTileID:_,aligned:y,applyGlobeMatrix:!c,applyTerrainMatrix:!0}),E=Zi(T||[0,0],C||1,w,i,s),P=f.getMeshFromTileID(h,_.canonical,o,a,"raster");d.draw(h,p.TRIANGLES,r,n?n[_.overscaledZ]:$t.disabled,g,l?Ot.frontCCW:Ot.backCCW,E,A,M,i.id,P.vertexBuffer,P.indexBuffer,P.segments)}}function ln(e,i,r,n,o,s){const l=n.paint.get("raster-fade-duration");if(!s&&l>0){const n=a.now(),s=(n-e.timeAdded)/l,c=i?(n-i.timeAdded)/l:-1,u=r.getSource(),h=ue(o,{tileSize:u.tileSize,roundZoom:u.roundZoom}),p=!i||Math.abs(i.tileID.overscaledZ-h)>Math.abs(e.tileID.overscaledZ-h),d=p&&e.refreshedUponExpiration?1:t.ae(p?s:1-c,0,1);return e.refreshedUponExpiration&&s>=1&&(e.refreshedUponExpiration=!1),i?{opacity:1,mix:1-d}:{opacity:d,mix:0}}return{opacity:1,mix:0}}const cn=new t.b7(1,0,0,1),un=new t.b7(0,1,0,1),hn=new t.b7(0,0,1,1),pn=new t.b7(1,0,1,1),dn=new t.b7(0,1,1,1);function mn(e,t,i,r){gn(e,0,t+i/2,e.transform.width,i,r)}function fn(e,t,i,r){gn(e,t-i/2,0,i,e.transform.height,r)}function gn(e,t,i,r,n,o){const a=e.context,s=a.gl;s.enable(s.SCISSOR_TEST),s.scissor(t*e.pixelRatio,i*e.pixelRatio,r*e.pixelRatio,n*e.pixelRatio),a.clear({color:o}),s.disable(s.SCISSOR_TEST)}function yn(e,i,r){const n=e.context,o=n.gl,a=e.useProgram("debug"),s=jt.disabled,l=$t.disabled,c=e.colorModeForRenderPass(),u="$debug",h=e.style.map.terrain&&e.style.map.terrain.getTerrainData(r);n.activeTexture.set(o.TEXTURE0);const p=i.getTileByID(r.key).latestRawTileData,d=Math.floor((p&&p.byteLength||0)/1024),m=i.getTile(r).tileSize,f=512/Math.min(m,512)*(r.overscaledZ/e.transform.zoom)*.5;let g=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(g+=` => ${r.overscaledZ}`),function(e,t){e.initDebugOverlayCanvas();const i=e.debugOverlayCanvas,r=e.context.gl,n=e.debugOverlayCanvas.getContext("2d");n.clearRect(0,0,i.width,i.height),n.shadowColor="white",n.shadowBlur=2,n.lineWidth=1.5,n.strokeStyle="white",n.textBaseline="top",n.font="bold 36px Open Sans, sans-serif",n.fillText(t,5,5),n.strokeText(t,5,5),e.debugOverlayTexture.update(i),e.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}(e,`${g} ${d}kB`);const y=e.transform.getProjectionData({overscaledTileID:r,applyGlobeMatrix:!0,applyTerrainMatrix:!0});a.draw(n,o.TRIANGLES,s,l,Rt.alphaBlended,Ot.disabled,Li(t.b7.transparent,f),null,y,u,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments),a.draw(n,o.LINE_STRIP,s,l,c,Ot.disabled,Li(t.b7.red),h,y,u,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments)}function _n(e,t,i,r){const{isRenderingGlobe:n}=r,o=e.context,a=o.gl,s=e.transform,l=e.colorModeForRenderPass(),c=e.getDepthModeFor3D(),u=e.useProgram("terrain");o.bindFramebuffer.set(null),o.viewport.set([0,0,e.width,e.height]);for(const r of i){const i=t.getTerrainMesh(r.tileID),h=e.renderToTexture.getTexture(r),p=t.getTerrainData(r.tileID);o.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,h.texture);const d=t.getMeshFrameDelta(s.zoom),m=s.calculateFogMatrix(r.tileID.toUnwrapped()),f=xi(d,m,e.style.sky,s.pitch,n),g=s.getProjectionData({overscaledTileID:r.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});u.draw(o,a.TRIANGLES,c,$t.disabled,l,Ot.backCCW,f,p,g,"terrain",i.vertexBuffer,i.indexBuffer,i.segments)}}function vn(e,i){if(!i.mesh){const r=new t.aF;r.emplaceBack(-1,-1),r.emplaceBack(1,-1),r.emplaceBack(1,1),r.emplaceBack(-1,1);const n=new t.aH;n.emplaceBack(0,1,2),n.emplaceBack(0,2,3),i.mesh=new mt(e.createVertexBuffer(r,ft.members),e.createIndexBuffer(n),t.aG.simpleSegment(0,0,r.length,n.length))}return i.mesh}class xn{constructor(e,i){this.context=new $r(e),this.transform=i,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:t.at(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=pe.maxUnderzooming+pe.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new ut}resize(e,t,i){if(this.width=Math.floor(e*i),this.height=Math.floor(t*i),this.pixelRatio=i,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 e=this.context,i=new t.aF;i.emplaceBack(0,0),i.emplaceBack(t.Z,0),i.emplaceBack(0,t.Z),i.emplaceBack(t.Z,t.Z),this.tileExtentBuffer=e.createVertexBuffer(i,ft.members),this.tileExtentSegments=t.aG.simpleSegment(0,0,4,2);const r=new t.aF;r.emplaceBack(0,0),r.emplaceBack(t.Z,0),r.emplaceBack(0,t.Z),r.emplaceBack(t.Z,t.Z),this.debugBuffer=e.createVertexBuffer(r,ft.members),this.debugSegments=t.aG.simpleSegment(0,0,4,5);const n=new t.bW;n.emplaceBack(0,0,0,0),n.emplaceBack(t.Z,0,t.Z,0),n.emplaceBack(0,t.Z,0,t.Z),n.emplaceBack(t.Z,t.Z,t.Z,t.Z),this.rasterBoundsBuffer=e.createVertexBuffer(n,_i.members),this.rasterBoundsSegments=t.aG.simpleSegment(0,0,4,2);const o=new t.aF;o.emplaceBack(0,0),o.emplaceBack(t.Z,0),o.emplaceBack(0,t.Z),o.emplaceBack(t.Z,t.Z),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(o,ft.members),this.rasterBoundsSegmentsPosOnly=t.aG.simpleSegment(0,0,4,5);const a=new t.aF;a.emplaceBack(0,0),a.emplaceBack(1,0),a.emplaceBack(0,1),a.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(a,ft.members),this.viewportSegments=t.aG.simpleSegment(0,0,4,2);const s=new t.bX;s.emplaceBack(0),s.emplaceBack(1),s.emplaceBack(3),s.emplaceBack(2),s.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(s);const l=new t.aH;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(l);const c=this.context.gl;this.stencilClearMode=new $t({func:c.ALWAYS,mask:0},0,255,c.ZERO,c.ZERO,c.ZERO),this.tileExtentMesh=new mt(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){const e=this.context,i=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const r=t.K();t.bO(r,0,this.width,this.height,0,0,1),t.M(r,r,[i.drawingBufferWidth,i.drawingBufferHeight,0]);const n={mainMatrix:r,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:r};this.useProgram("clippingMask",null,!0).draw(e,i.TRIANGLES,jt.disabled,this.stencilClearMode,Rt.disabled,Ot.disabled,null,null,n,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,t,i){if(this.currentStencilSource===e.source||!e.isTileClipped()||!t||!t.length)return;this.currentStencilSource=e.source,this.nextStencilID+t.length>256&&this.clearStencil();const r=this.context;r.setColorMode(Rt.disabled),r.setDepthMode(jt.disabled);const n={};for(const e of t)n[e.key]=this.nextStencilID++;this._renderTileMasks(n,t,i,!0),this._renderTileMasks(n,t,i,!1),this._tileClippingMaskIDs=n}_renderTileMasks(e,t,i,r){const n=this.context,o=n.gl,a=this.style.projection,s=this.transform,l=this.useProgram("clippingMask");for(const c of t){const t=e[c.key],u=this.style.map.terrain&&this.style.map.terrain.getTerrainData(c),h=a.getMeshFromTileID(this.context,c.canonical,r,!0,"stencil"),p=s.getProjectionData({overscaledTileID:c,applyGlobeMatrix:!0,applyTerrainMatrix:!0});l.draw(n,o.TRIANGLES,jt.disabled,new $t({func:o.ALWAYS,mask:0},t,255,o.KEEP,o.KEEP,o.REPLACE),Rt.disabled,i?Ot.disabled:Ot.backCCW,null,u,p,"$clipping",h.vertexBuffer,h.indexBuffer,h.segments)}}_renderTilesDepthBuffer(){const e=this.context,t=e.gl,i=this.style.projection,r=this.transform,n=this.useProgram("depth"),o=this.getDepthModeFor3D(),a=he(r,{tileSize:r.tileSize});for(const s of a){const a=this.style.map.terrain&&this.style.map.terrain.getTerrainData(s),l=i.getMeshFromTileID(this.context,s.canonical,!0,!0,"raster"),c=r.getProjectionData({overscaledTileID:s,applyGlobeMatrix:!0,applyTerrainMatrix:!0});n.draw(e,t.TRIANGLES,o,$t.disabled,Rt.disabled,Ot.backCCW,null,a,c,"$clipping",l.vertexBuffer,l.indexBuffer,l.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,t=this.context.gl;return new $t({func:t.NOTEQUAL,mask:255},e,255,t.KEEP,t.KEEP,t.REPLACE)}stencilModeForClipping(e){const t=this.context.gl;return new $t({func:t.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,t.KEEP,t.KEEP,t.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){const t=this.context.gl,i=e.sort(((e,t)=>t.overscaledZ-e.overscaledZ)),r=i[i.length-1].overscaledZ,n=i[0].overscaledZ-r+1;if(n>1){this.currentStencilSource=void 0,this.nextStencilID+n>256&&this.clearStencil();const e={};for(let i=0;i<n;i++)e[i+r]=new $t({func:t.GEQUAL,mask:255},i+this.nextStencilID,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID+=n,[e,i]}return[{[r]:$t.disabled},i]}stencilConfigForOverlapTwoPass(e){const t=this.context.gl,i=e.sort(((e,t)=>t.overscaledZ-e.overscaledZ)),r=i[i.length-1].overscaledZ,n=i[0].overscaledZ-r+1;if(this.clearStencil(),n>1){const e={},o={};for(let i=0;i<n;i++)e[i+r]=new $t({func:t.GREATER,mask:255},n+1+i,255,t.KEEP,t.KEEP,t.REPLACE),o[i+r]=new $t({func:t.GREATER,mask:255},1+i,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID=2*n+1,[e,o,i]}return this.nextStencilID=3,[{[r]:new $t({func:t.GREATER,mask:255},2,255,t.KEEP,t.KEEP,t.REPLACE)},{[r]:new $t({func:t.GREATER,mask:255},1,255,t.KEEP,t.KEEP,t.REPLACE)},i]}colorModeForRenderPass(){const e=this.context.gl;if(this._showOverdrawInspector){const i=1/8;return new Rt([e.CONSTANT_COLOR,e.ONE],new t.b7(i,i,i,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?Rt.unblended:Rt.alphaBlended}getDepthModeForSublayer(e,t,i){if(!this.opaquePassEnabledForLayer())return jt.disabled;const r=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new jt(i||this.context.gl.LEQUAL,t,[r,r])}getDepthModeFor3D(){return new jt(this.context.gl.LEQUAL,jt.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,i){var r,n;this.style=e,this.options=i,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(a.now()),this.imageManager.beginFrame();const o=this.style._order,s=this.style.sourceCaches,l={},c={},u={},h={isRenderingToTexture:!1,isRenderingGlobe:(null===(r=e.projection)||void 0===r?void 0:r.transitionState)>0};for(const e in s){const t=s[e];t.used&&t.prepare(this.context),l[e]=t.getVisibleCoordinates(!1),c[e]=l[e].slice().reverse(),u[e]=t.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let e=0;e<o.length;e++)if(this.style._layers[o[e]].is3D()){this.opaquePassCutoff=e;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const e of o){const t=this.style._layers[e];if(!t.hasOffscreenPass()||t.isHidden(this.transform.zoom))continue;const i=c[t.source];("custom"===t.type||i.length)&&this.renderLayer(this,s[t.source],t,i,h)}if(null===(n=this.style.projection)||void 0===n||n.updateGPUdependent({context:this.context,useProgram:e=>this.useProgram(e)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:i.showOverdrawInspector?t.b7.black:t.b7.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(e,t){const i=e.context,r=i.gl,n=((e,t,i)=>{const r=Math.cos(t.rollInRadians),n=Math.sin(t.rollInRadians),o=bt(t),a=t.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:e.properties.get("sky-color"),u_horizon_color:e.properties.get("horizon-color"),u_horizon:[(t.width/2-o*n)*i,(t.height/2+o*r)*i],u_horizon_normal:[-n,r],u_sky_horizon_blend:e.properties.get("sky-horizon-blend")*t.height/2*i,u_sky_blend:a}})(t,e.style.map.transform,e.pixelRatio),o=new jt(r.LEQUAL,jt.ReadWrite,[0,1]),a=$t.disabled,s=e.colorModeForRenderPass(),l=e.useProgram("sky"),c=vn(i,t);l.draw(i,r.TRIANGLES,o,a,s,Ot.disabled,n,null,void 0,"sky",c.vertexBuffer,c.indexBuffer,c.segments)}(this,this.style.sky),this._showOverdrawInspector=i.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=o.length-1;this.currentLayer>=0;this.currentLayer--){const e=this.style._layers[o[this.currentLayer]],t=s[e.source],i=l[e.source];this._renderTileClippingMasks(e,i,!1),this.renderLayer(this,t,e,i,h)}this.renderPass="translucent";let p=!1;for(this.currentLayer=0;this.currentLayer<o.length;this.currentLayer++){const e=this.style._layers[o[this.currentLayer]],t=s[e.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(e,h))continue;this.opaquePassEnabledForLayer()||p||(p=!0,h.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const i=("symbol"===e.type?u:c)[e.source];this._renderTileClippingMasks(e,l[e.source],!1),this.renderLayer(this,t,e,i,h)}if(h.isRenderingGlobe&&function(e,i,r){const n=e.context,o=n.gl,a=e.useProgram("atmosphere"),s=new jt(o.LEQUAL,jt.ReadOnly,[0,1]),l=e.transform,c=function(e,i){const r=e.properties.get("position"),n=[-r.x,-r.y,-r.z],o=t.at(new Float64Array(16));return"map"===e.properties.get("anchor")&&(t.a_(o,o,i.rollInRadians),t.a$(o,o,-i.pitchInRadians),t.a_(o,o,i.bearingInRadians),t.a$(o,o,i.center.lat*Math.PI/180),t.bm(o,o,-i.center.lng*Math.PI/180)),t.bV(n,n,o),n}(r,e.transform),u=l.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),h=i.properties.get("atmosphere-blend")*u.projectionTransition;if(0===h)return;const p=ei(l.worldSize,l.center.lat),d=l.inverseProjectionMatrix,m=new Float64Array(4);m[3]=1,t.ap(m,m,l.modelViewProjectionMatrix),m[0]/=m[3],m[1]/=m[3],m[2]/=m[3],m[3]=1,t.ap(m,m,d),m[0]/=m[3],m[1]/=m[3],m[2]/=m[3],m[3]=1;const f=((e,t,i,r,n)=>({u_sun_pos:e,u_atmosphere_blend:t,u_globe_position:i,u_globe_radius:r,u_inv_proj_matrix:n}))(c,h,[m[0],m[1],m[2]],p,d),g=vn(n,i);a.draw(n,o.TRIANGLES,s,$t.disabled,Rt.alphaBlended,Ot.disabled,f,null,null,"atmosphere",g.vertexBuffer,g.indexBuffer,g.segments)}(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const e=function(e,t){let i=null;const r=Object.values(e._layers).flatMap((i=>i.source&&!i.isHidden(t)?[e.sourceCaches[i.source]]:[])),n=r.filter((e=>"vector"===e.getSource().type)),o=r.filter((e=>"vector"!==e.getSource().type)),a=e=>{(!i||i.getSource().maxzoom<e.getSource().maxzoom)&&(i=e)};return n.forEach((e=>a(e))),i||o.forEach((e=>a(e))),i}(this.style,this.transform.zoom);e&&function(e,t,i){for(let r=0;r<i.length;r++)yn(e,t,i[r])}(this,e,e.getVisibleCoordinates())}this.options.showPadding&&function(e){const t=e.transform.padding;mn(e,e.transform.height-(t.top||0),3,cn),mn(e,t.bottom||0,3,un),fn(e,t.left||0,3,hn),fn(e,e.transform.width-(t.right||0),3,pn);const i=e.transform.centerPoint;!function(e,t,i,r){gn(e,t-1,i-10,2,20,r),gn(e,t-10,i-1,20,2,r)}(e,i.x,e.transform.height-i.y,dn)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(e){if(!this.style||!this.style.map||!this.style.map.terrain)return;const i=this.terrainFacilitator.matrix,r=this.transform.modelViewProjectionMatrix;let n=this.terrainFacilitator.dirty;n||(n=e?!t.bY(i,r):!t.bZ(i,r)),n||(n=this.style.map.terrain.sourceCache.anyTilesAfterTime(this.terrainFacilitator.renderTime)),n&&(t.b_(i,r),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(e,i){const r=e.context,n=r.gl,o=e.transform,a=Rt.unblended,s=new jt(n.LEQUAL,jt.ReadWrite,[0,1]),l=i.sourceCache.getRenderableTiles(),c=e.useProgram("terrainDepth");r.bindFramebuffer.set(i.getFramebuffer("depth").framebuffer),r.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),r.clear({color:t.b7.transparent,depth:1});for(const e of l){const t=i.getTerrainMesh(e.tileID),l=i.getTerrainData(e.tileID),u=o.getProjectionData({overscaledTileID:e.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),h={u_ele_delta:i.getMeshFrameDelta(o.zoom)};c.draw(r,n.TRIANGLES,s,$t.disabled,a,Ot.backCCW,h,l,u,"terrain",t.vertexBuffer,t.indexBuffer,t.segments)}r.bindFramebuffer.set(null),r.viewport.set([0,0,e.width,e.height])}(this,this.style.map.terrain),function(e,i){const r=e.context,n=r.gl,o=e.transform,a=Rt.unblended,s=new jt(n.LEQUAL,jt.ReadWrite,[0,1]),l=i.getCoordsTexture(),c=i.sourceCache.getRenderableTiles(),u=e.useProgram("terrainCoords");r.bindFramebuffer.set(i.getFramebuffer("coords").framebuffer),r.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),r.clear({color:t.b7.transparent,depth:1}),i.coordsIndex=[];for(const e of c){const t=i.getTerrainMesh(e.tileID),c=i.getTerrainData(e.tileID);r.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,l.texture);const h={u_terrain_coords_id:(255-i.coordsIndex.length)/255,u_texture:0,u_ele_delta:i.getMeshFrameDelta(o.zoom)},p=o.getProjectionData({overscaledTileID:e.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});u.draw(r,n.TRIANGLES,s,$t.disabled,a,Ot.backCCW,h,c,p,"terrain",t.vertexBuffer,t.indexBuffer,t.segments),i.coordsIndex.push(e.tileID.key)}r.bindFramebuffer.set(null),r.viewport.set([0,0,e.width,e.height])}(this,this.style.map.terrain))}renderLayer(e,i,r,n,o){r.isHidden(this.transform.zoom)||("background"===r.type||"custom"===r.type||(n||[]).length)&&(this.id=r.id,t.b$(r)?function(e,i,r,n,o,a){if("translucent"!==e.renderPass)return;const{isRenderingToTexture:s}=a,l=$t.disabled,c=e.colorModeForRenderPass();(r._unevaluatedLayout.hasValue("text-variable-anchor")||r._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(e,i,r,n,o,a,s,l,c){const u=i.transform,h=i.style.map.terrain,p="map"===o,d="map"===a;for(const o of e){const e=n.getTile(o),a=e.getBucket(r);if(!a||!a.text||!a.text.segments.get().length)continue;const m=t.ag(a.textSizeData,u.zoom),f=t.aw(e,1,i.transform.zoom),g=_e(p,i.transform,f),y="none"!==r.layout.get("icon-text-fit")&&a.hasIconData();if(m){const i=Math.pow(2,u.zoom-e.tileID.overscaledZ),r=h?(e,t)=>h.getElevation(o,e,t):null;Hr(a,p,d,c,u,g,i,m,y,t.ax(u,e,s,l),o.toUnwrapped(),r)}}}(n,e,r,i,r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),o),0!==r.paint.get("icon-opacity").constantOr(1)&&Kr(e,i,r,n,!1,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),r.layout.get("icon-rotation-alignment"),r.layout.get("icon-pitch-alignment"),r.layout.get("icon-keep-upright"),l,c,s),0!==r.paint.get("text-opacity").constantOr(1)&&Kr(e,i,r,n,!0,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.layout.get("text-keep-upright"),l,c,s),i.map.showCollisionBoxes&&(Ur(e,i,r,n,!0),Ur(e,i,r,n,!1))}(e,i,r,n,this.style.placement.variableOffsets,o):t.c0(r)?function(e,i,r,n,o){if("translucent"!==e.renderPass)return;const{isRenderingToTexture:a}=o,s=r.paint.get("circle-opacity"),l=r.paint.get("circle-stroke-width"),c=r.paint.get("circle-stroke-opacity"),u=!r.layout.get("circle-sort-key").isConstant();if(0===s.constantOr(1)&&(0===l.constantOr(1)||0===c.constantOr(1)))return;const h=e.context,p=h.gl,d=e.transform,m=e.getDepthModeForSublayer(0,jt.ReadOnly),f=$t.disabled,g=e.colorModeForRenderPass(),y=[],_=d.getCircleRadiusCorrection();for(let o=0;o<n.length;o++){const s=n[o],l=i.getTile(s),c=l.getBucket(r);if(!c)continue;const h=r.paint.get("circle-translate"),p=r.paint.get("circle-translate-anchor"),m=t.ax(d,l,h,p),f=c.programConfigurations.get(r.id),g=e.useProgram("circle",f),v=c.layoutVertexBuffer,x=c.indexBuffer,b=e.style.map.terrain&&e.style.map.terrain.getTerrainData(s),w={programConfiguration:f,program:g,layoutVertexBuffer:v,indexBuffer:x,uniformValues:Ii(e,l,r,m,_),terrainData:b,projectionData:d.getProjectionData({overscaledTileID:s,applyGlobeMatrix:!a,applyTerrainMatrix:!0})};if(u){const e=c.segments.get();for(const i of e)y.push({segments:new t.aG([i]),sortKey:i.sortKey,state:w})}else y.push({segments:c.segments,sortKey:0,state:w})}u&&y.sort(((e,t)=>e.sortKey-t.sortKey));for(const t of y){const{programConfiguration:i,program:n,layoutVertexBuffer:o,indexBuffer:a,uniformValues:s,terrainData:l,projectionData:c}=t.state;n.draw(h,p.TRIANGLES,m,f,g,Ot.backCCW,s,l,c,r.id,o,a,t.segments,r.paint,e.transform.zoom,i)}}(e,i,r,n,o):t.c1(r)?function(e,i,r,n,o){if(0===r.paint.get("heatmap-opacity"))return;const a=e.context,{isRenderingToTexture:s,isRenderingGlobe:l}=o;if(e.style.map.terrain){for(const t of n){const n=i.getTile(t);i.hasRenderableParent(t)||("offscreen"===e.renderPass?Yr(e,n,r,t,l):"translucent"===e.renderPass&&Jr(e,r,t,s,l))}a.viewport.set([0,0,e.width,e.height])}else"offscreen"===e.renderPass?function(e,i,r,n){const o=e.context,a=o.gl,s=e.transform,l=$t.disabled,c=new Rt([a.ONE,a.ONE],t.b7.transparent,[!0,!0,!0,!0]);(function(e,i,r){const n=e.gl;e.activeTexture.set(n.TEXTURE1),e.viewport.set([0,0,i.width/4,i.height/4]);let o=r.heatmapFbos.get(t.bS);o?(n.bindTexture(n.TEXTURE_2D,o.colorAttachment.get()),e.bindFramebuffer.set(o.framebuffer)):(o=Qr(e,i.width/4,i.height/4),r.heatmapFbos.set(t.bS,o))})(o,e,r),o.clear({color:t.b7.transparent});for(let t=0;t<n.length;t++){const u=n[t];if(i.hasRenderableParent(u))continue;const h=i.getTile(u),p=h.getBucket(r);if(!p)continue;const d=p.programConfigurations.get(r.id),m=e.useProgram("heatmap",d),f=s.getProjectionData({overscaledTileID:u,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),g=s.getCircleRadiusCorrection();m.draw(o,a.TRIANGLES,jt.disabled,l,c,Ot.backCCW,Di(h,s.zoom,r.paint.get("heatmap-intensity"),g),null,f,r.id,p.layoutVertexBuffer,p.indexBuffer,p.segments,r.paint,s.zoom,d)}o.viewport.set([0,0,e.width,e.height])}(e,i,r,n):"translucent"===e.renderPass&&function(e,i){const r=e.context,n=r.gl;r.setColorMode(e.colorModeForRenderPass());const o=i.heatmapFbos.get(t.bS);o&&(r.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,o.colorAttachment.get()),r.activeTexture.set(n.TEXTURE1),en(r,i).bind(n.LINEAR,n.CLAMP_TO_EDGE),e.useProgram("heatmapTexture").draw(r,n.TRIANGLES,jt.disabled,$t.disabled,e.colorModeForRenderPass(),Ot.disabled,Fi(e,i,0,1),null,null,i.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,i.paint,e.transform.zoom))}(e,r)}(e,i,r,n,o):t.c2(r)?function(e,i,r,n,o){if("translucent"!==e.renderPass)return;const{isRenderingToTexture:a}=o,s=r.paint.get("line-opacity"),l=r.paint.get("line-width");if(0===s.constantOr(1)||0===l.constantOr(1))return;const c=e.getDepthModeForSublayer(0,jt.ReadOnly),u=e.colorModeForRenderPass(),h=r.paint.get("line-dasharray"),p=r.paint.get("line-pattern"),d=p.constantOr(1),m=r.paint.get("line-gradient"),f=r.getCrossfadeParameters(),g=d?"linePattern":h?"lineSDF":m?"lineGradient":"line",y=e.context,v=y.gl,x=e.transform;let b=!0;for(const o of n){const s=i.getTile(o);if(d&&!s.patternsLoaded())continue;const l=s.getBucket(r);if(!l)continue;const w=l.programConfigurations.get(r.id),C=e.context.program.get(),T=e.useProgram(g,w),S=b||T.program!==C,A=e.style.map.terrain&&e.style.map.terrain.getTerrainData(o),M=p.constantOr(null);if(M&&s.imageAtlas){const e=s.imageAtlas,t=e.patternPositions[M.to.toString()],i=e.patternPositions[M.from.toString()];t&&i&&w.setConstantPatternPositions(t,i)}const E=x.getProjectionData({overscaledTileID:o,applyGlobeMatrix:!a,applyTerrainMatrix:!0}),P=x.getPixelScale(),I=d?$i(e,s,r,P,f):h?Vi(e,s,r,P,h,f):m?Ni(e,s,r,P,l.lineClipsArray.length):ji(e,s,r,P);if(d)y.activeTexture.set(v.TEXTURE0),s.imageAtlasTexture.bind(v.LINEAR,v.CLAMP_TO_EDGE),w.updatePaintBuffers(f);else if(h&&(S||e.lineAtlas.dirty))y.activeTexture.set(v.TEXTURE0),e.lineAtlas.bind(y);else if(m){const n=l.gradients[r.id];let a=n.texture;if(r.gradientVersion!==n.version){let s=256;if(r.stepInterpolant){const r=i.getSource().maxzoom,n=o.canonical.z===r?Math.ceil(1<<e.transform.maxZoom-o.canonical.z):1;s=t.ae(t.bT(l.maxLineLength/t.Z*1024*n),256,y.maxTextureSize)}n.gradient=t.bU({expression:r.gradientExpression(),evaluationKey:"lineProgress",resolution:s,image:n.gradient||void 0,clips:l.lineClipsArray}),n.texture?n.texture.update(n.gradient):n.texture=new _(y,n.gradient,v.RGBA),n.version=r.gradientVersion,a=n.texture}y.activeTexture.set(v.TEXTURE0),a.bind(r.stepInterpolant?v.NEAREST:v.LINEAR,v.CLAMP_TO_EDGE)}let k;if(a){const[t]=e.getStencilConfigForOverlapAndUpdateStencilID(n);k=t[o.overscaledZ]}else k=e.stencilModeForClipping(o);T.draw(y,v.TRIANGLES,c,k,u,Ot.disabled,I,A,E,r.id,l.layoutVertexBuffer,l.indexBuffer,l.segments,r.paint,e.transform.zoom,w,l.layoutVertexBuffer2),b=!1}}(e,i,r,n,o):t.c3(r)?function(e,i,r,n,o){const a=r.paint.get("fill-color"),s=r.paint.get("fill-opacity");if(0===s.constantOr(1))return;const{isRenderingToTexture:l}=o,c=e.colorModeForRenderPass(),u=r.paint.get("fill-pattern"),h=e.opaquePassEnabledForLayer()&&!u.constantOr(1)&&1===a.constantOr(t.b7.transparent).a&&1===s.constantOr(0)?"opaque":"translucent";if(e.renderPass===h){const t=e.getDepthModeForSublayer(1,"opaque"===e.renderPass?jt.ReadWrite:jt.ReadOnly);rn(e,i,r,n,t,c,!1,l)}if("translucent"===e.renderPass&&r.paint.get("fill-antialias")){const t=e.getDepthModeForSublayer(r.getPaintProperty("fill-outline-color")?2:0,jt.ReadOnly);rn(e,i,r,n,t,c,!0,l)}}(e,i,r,n,o):t.c4(r)?function(e,t,i,r,n){const o=i.paint.get("fill-extrusion-opacity");if(0===o)return;const{isRenderingToTexture:a}=n;if("translucent"===e.renderPass){const n=new jt(e.context.gl.LEQUAL,jt.ReadWrite,e.depthRangeFor3D);if(1!==o||i.paint.get("fill-extrusion-pattern").constantOr(1))nn(e,t,i,r,n,$t.disabled,Rt.disabled,a),nn(e,t,i,r,n,e.stencilModeFor3D(),e.colorModeForRenderPass(),a);else{const o=e.colorModeForRenderPass();nn(e,t,i,r,n,$t.disabled,o,a)}}}(e,i,r,n,o):t.c5(r)?function(e,t,i,r,n){if("offscreen"!==e.renderPass&&"translucent"!==e.renderPass)return;const{isRenderingToTexture:o}=n,a=e.context,s=e.style.projection.useSubdivision,l=e.getDepthModeForSublayer(0,jt.ReadOnly),c=e.colorModeForRenderPass();if("offscreen"===e.renderPass)!function(e,t,i,r,n,o,a){const s=e.context,l=s.gl;for(const c of i){const i=t.getTile(c),u=i.dem;if(!u||!u.data)continue;if(!i.needsHillshadePrepare)continue;const h=u.dim,p=u.stride,d=u.getPixels();if(s.activeTexture.set(l.TEXTURE1),s.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||e.getTileTexture(p),i.demTexture){const e=i.demTexture;e.update(d,{premultiply:!1}),e.bind(l.NEAREST,l.CLAMP_TO_EDGE)}else i.demTexture=new _(s,d,l.RGBA,{premultiply:!1}),i.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);s.activeTexture.set(l.TEXTURE0);let m=i.fbo;if(!m){const e=new _(s,{width:h,height:h,data:null},l.RGBA);e.bind(l.LINEAR,l.CLAMP_TO_EDGE),m=i.fbo=s.createFramebuffer(h,h,!0,!1),m.colorAttachment.set(e.texture)}s.bindFramebuffer.set(m.framebuffer),s.viewport.set([0,0,h,h]),e.useProgram("hillshadePrepare").draw(s,l.TRIANGLES,n,o,a,Ot.disabled,Bi(i.tileID,u),null,null,r.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),i.needsHillshadePrepare=!1}}(e,t,r,i,l,$t.disabled,c),a.viewport.set([0,0,e.width,e.height]);else if("translucent"===e.renderPass)if(s){const[n,a,s]=e.stencilConfigForOverlapTwoPass(r);on(e,t,i,s,n,l,c,!1,o),on(e,t,i,s,a,l,c,!0,o)}else{const[n,a]=e.getStencilConfigForOverlapAndUpdateStencilID(r);on(e,t,i,a,n,l,c,!1,o)}}(e,i,r,n,o):t.c6(r)?function(e,t,i,r,n){if("translucent"!==e.renderPass)return;if(0===i.paint.get("raster-opacity"))return;if(!r.length)return;const{isRenderingToTexture:o}=n,a=t.getSource(),s=e.style.projection.useSubdivision;if(a instanceof X)sn(e,t,i,r,null,!1,!1,a.tileCoords,a.flippedWindingOrder,o);else if(s){const[n,a,s]=e.stencilConfigForOverlapTwoPass(r);sn(e,t,i,s,n,!1,!0,an,!1,o),sn(e,t,i,s,a,!0,!0,an,!1,o)}else{const[n,a]=e.getStencilConfigForOverlapAndUpdateStencilID(r);sn(e,t,i,a,n,!1,!0,an,!1,o)}}(e,i,r,n,o):t.c7(r)?function(e,t,i,r,n){const o=i.paint.get("background-color"),a=i.paint.get("background-opacity");if(0===a)return;const{isRenderingToTexture:s}=n,l=e.context,c=l.gl,u=e.style.projection,h=e.transform,p=h.tileSize,d=i.paint.get("background-pattern");if(e.isPatternMissing(d))return;const m=!d&&1===o.a&&1===a&&e.opaquePassEnabledForLayer()?"opaque":"translucent";if(e.renderPass!==m)return;const f=$t.disabled,g=e.getDepthModeForSublayer(0,"opaque"===m?jt.ReadWrite:jt.ReadOnly),y=e.colorModeForRenderPass(),_=e.useProgram(d?"backgroundPattern":"background"),v=r||he(h,{tileSize:p,terrain:e.style.map.terrain});d&&(l.activeTexture.set(c.TEXTURE0),e.imageManager.bind(e.context));const x=i.getCrossfadeParameters();for(const t of v){const r=h.getProjectionData({overscaledTileID:t,applyGlobeMatrix:!s,applyTerrainMatrix:!0}),n=d?Yi(a,e,d,{tileID:t,tileSize:p},x):Xi(a,o),m=e.style.map.terrain&&e.style.map.terrain.getTerrainData(t),v=u.getMeshFromTileID(l,t.canonical,!1,!0,"raster");_.draw(l,c.TRIANGLES,g,f,y,Ot.backCCW,n,m,r,i.id,v.vertexBuffer,v.indexBuffer,v.segments)}}(e,0,r,n,o):t.c8(r)&&function(e,t,i,r){const{isRenderingGlobe:n}=r,o=e.context,a=i.implementation,s=e.style.projection,l=e.transform,c=l.getProjectionDataForCustomLayer(n),u={farZ:l.farZ,nearZ:l.nearZ,fov:l.fov*Math.PI/180,modelViewProjectionMatrix:l.modelViewProjectionMatrix,projectionMatrix:l.projectionMatrix,shaderData:{variantName:s.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;\nuniform mat4 u_projection_matrix;\n${s.shaderPreludeCode.vertexSource}`,define:s.shaderDefine},defaultProjectionData:c},h=a.renderingMode?a.renderingMode:"2d";if("offscreen"===e.renderPass){const t=a.prerender;t&&(e.setCustomLayerDefaults(),o.setColorMode(e.colorModeForRenderPass()),t.call(a,o.gl,u),o.setDirty(),e.setBaseState())}else if("translucent"===e.renderPass){e.setCustomLayerDefaults(),o.setColorMode(e.colorModeForRenderPass()),o.setStencilMode($t.disabled);const t="3d"===h?e.getDepthModeFor3D():e.getDepthModeForSublayer(0,jt.ReadOnly);o.setDepthMode(t),a.render(o.gl,u),o.setDirty(),e.setBaseState(),o.bindFramebuffer.set(null)}}(e,0,r,o))}saveTileTexture(e){const t=this._tileTextures[e.size[0]];t?t.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){const t=this._tileTextures[e];return t&&t.length>0?t.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;const t=this.imageManager.getPattern(e.from.toString()),i=this.imageManager.getPattern(e.to.toString());return!t||!i}useProgram(e,t,i=!1){this.cache=this.cache||{};const r=!!this.style.map.terrain,n=this.style.projection,o=e+(t?t.cacheKey:"")+`/${i?yt:n.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(r?"/terrain":"");return this.cache[o]||(this.cache[o]=new Ci(this.context,pt[e],t,Qi[e],this._showOverdrawInspector,r,i?pt.projectionMercator:n.shaderPreludeCode,i?gt:n.shaderDefine)),this.cache[o]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const 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=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new _(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:e,drawingBufferHeight:t}=this.context.gl;return this.width!==e||this.height!==t}}function bn(e,t){let i,r=!1,n=null,o=null;const a=()=>{n=null,r&&(e.apply(o,i),n=setTimeout(a,t),r=!1)};return(...e)=>(r=!0,o=this,i=e,n||a(),n)}class wn{constructor(e){this._getCurrentHash=()=>{const e=window.location.hash.replace("#","");if(this._hashName){let t;return e.split("&").map((e=>e.split("="))).forEach((e=>{e[0]===this._hashName&&(t=e)})),(t&&t[1]||"").split("/")}return e.split("/")},this._onHashChange=()=>{const e=this._getCurrentHash();if(!this._isValidHash(e))return!1;const t=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(e[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+e[2],+e[1]],zoom:+e[0],bearing:t,pitch:+(e[4]||0)}),!0},this._updateHashUnthrottled=()=>{const e=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,e)},this._removeHash=()=>{const e=this._getCurrentHash();if(0===e.length)return;const t=e.join("/");let i=t;i.split("&").length>0&&(i=i.split("&")[0]),this._hashName&&(i=`${this._hashName}=${t}`);let r=window.location.hash.replace(i,"");r.startsWith("#&")?r=r.slice(0,1)+r.slice(2):"#"===r&&(r="");let n=window.location.href.replace(/(#.+)?$/,r);n=n.replace("&&","&"),window.history.replaceState(window.history.state,null,n)},this._updateHash=bn(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(e){const t=this._map.getCenter(),i=Math.round(100*this._map.getZoom())/100,r=Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),n=Math.pow(10,r),o=Math.round(t.lng*n)/n,a=Math.round(t.lat*n)/n,s=this._map.getBearing(),l=this._map.getPitch();let c="";if(c+=e?`/${o}/${a}/${i}`:`${i}/${a}/${o}`,(s||l)&&(c+="/"+Math.round(10*s)/10),l&&(c+=`/${Math.round(l)}`),this._hashName){const e=this._hashName;let t=!1;const i=window.location.hash.slice(1).split("&").map((i=>{const r=i.split("=")[0];return r===e?(t=!0,`${r}=${c}`):i})).filter((e=>e));return t||i.push(`${e}=${c}`),`#${i.join("&")}`}return`#${c}`}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new t.Q(+e[2],+e[1])}catch(e){return!1}const i=+e[0],r=+(e[3]||0),n=+(e[4]||0);return i>=this._map.getMinZoom()&&i<=this._map.getMaxZoom()&&r>=-180&&r<=180&&n>=this._map.getMinPitch()&&n<=this._map.getMaxPitch()}}const Cn={linearity:.3,easing:t.c9(0,0,.3,1)},Tn=t.e({deceleration:2500,maxSpeed:1400},Cn),Sn=t.e({deceleration:20,maxSpeed:1400},Cn),An=t.e({deceleration:1e3,maxSpeed:360},Cn),Mn=t.e({deceleration:1e3,maxSpeed:90},Cn),En=t.e({deceleration:1e3,maxSpeed:360},Cn);class Pn{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:a.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,t=a.now();for(;e.length>0&&t-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,roll:0,pan:new t.P(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,i.roll+=e.rollDelta||0,e.panDelta&&i.pan._add(e.panDelta),e.around&&(i.around=e.around),e.pinchAround&&(i.pinchAround=e.pinchAround);const r=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,n={};if(i.pan.mag()){const o=kn(i.pan.mag(),r,t.e({},Tn,e||{})),a=i.pan.mult(o.amount/i.pan.mag()),s=this._map.cameraHelper.handlePanInertia(a,this._map.transform);n.center=s.easingCenter,n.offset=s.easingOffset,In(n,o)}if(i.zoom){const e=kn(i.zoom,r,Sn);n.zoom=this._map.transform.zoom+e.amount,In(n,e)}if(i.bearing){const e=kn(i.bearing,r,An);n.bearing=this._map.transform.bearing+t.ae(e.amount,-179,179),In(n,e)}if(i.pitch){const e=kn(i.pitch,r,Mn);n.pitch=this._map.transform.pitch+e.amount,In(n,e)}if(i.roll){const e=kn(i.roll,r,En);n.roll=this._map.transform.roll+t.ae(e.amount,-179,179),In(n,e)}if(n.zoom||n.bearing){const e=void 0===i.pinchAround?i.around:i.pinchAround;n.around=e?this._map.unproject(e):this._map.getCenter()}return this.clear(),t.e(n,{noMoveStart:!0})}}function In(e,t){(!e.duration||e.duration<t.duration)&&(e.duration=t.duration,e.easing=t.easing)}function kn(e,i,r){const{maxSpeed:n,linearity:o,deceleration:a}=r,s=t.ae(e*o/(i/1e3),-n,n),l=Math.abs(s)/(a*o);return{easing:r.easing,duration:1e3*l,amount:s*(l/2)}}class zn extends t.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,r,n={}){r=r instanceof MouseEvent?r:new MouseEvent(e,r);const o=s.mousePos(i.getCanvas(),r),a=i.unproject(o);super(e,t.e({point:o,lngLat:a,originalEvent:r},n)),this._defaultPrevented=!1,this.target=i}}class Ln extends t.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,r){const n="touchend"===e?r.changedTouches:r.touches,o=s.touchPos(i.getCanvasContainer(),n),a=o.map((e=>i.unproject(e))),l=o.reduce(((e,t,i,r)=>e.add(t.div(r.length))),new t.P(0,0));super(e,{points:o,point:l,lngLats:a,lngLat:i.unproject(l),originalEvent:r}),this._defaultPrevented=!1}}class Dn extends t.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i){super(e,{originalEvent:i}),this._defaultPrevented=!1}}class Fn{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new Dn(e.type,this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new zn(e.type,this._map,e))}mouseup(e){this._map.fire(new zn(e.type,this._map,e))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||this._map.fire(new zn(e.type,this._map,e))}dblclick(e){return this._firePreventable(new zn(e.type,this._map,e))}mouseover(e){this._map.fire(new zn(e.type,this._map,e))}mouseout(e){this._map.fire(new zn(e.type,this._map,e))}touchstart(e){return this._firePreventable(new Ln(e.type,this._map,e))}touchmove(e){this._map.fire(new Ln(e.type,this._map,e))}touchend(e){this._map.fire(new Ln(e.type,this._map,e))}touchcancel(e){this._map.fire(new Ln(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Rn{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new zn(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new zn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new zn(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Bn{constructor(e){this._map=e}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.screenPointToLocation(t.P.convert(e),this._map.terrain)}}class On{constructor(e,t){this._map=e,this._tr=new Bn(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&&(s.disableDrag(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;const i=t;if(this._lastPos.equals(i)||!this._box&&i.dist(this._startPos)<this._clickTolerance)return;const r=this._startPos;this._lastPos=i,this._box||(this._box=s.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));const n=Math.min(r.x,i.x),o=Math.max(r.x,i.x),a=Math.min(r.y,i.y),l=Math.max(r.y,i.y);s.setTransform(this._box,`translate(${n}px,${a}px)`),this._box.style.width=o-n+"px",this._box.style.height=l-a+"px"}mouseupWindow(e,i){if(!this._active)return;if(0!==e.button)return;const r=this._startPos,n=i;if(this.reset(),s.suppressClick(),r.x!==n.x||r.y!==n.y)return this._map.fire(new t.l("boxzoomend",{originalEvent:e})),{cameraAnimation:e=>e.fitScreenCoordinates(r,n,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&27===e.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(s.remove(this._box),this._box=null),s.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new t.l(e,{originalEvent:i}))}}function jn(e,t){if(e.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${e.length}, points ${t.length}`);const i={};for(let r=0;r<e.length;r++)i[e[r].identifier]=t[r];return i}class Nn{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,i,r){(this.centroid||r.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=e.timeStamp),r.length===this.numTouches&&(this.centroid=function(e){const i=new t.P(0,0);for(const t of e)i._add(t);return i.div(e.length)}(i),this.touches=jn(r,i)))}touchmove(e,t,i){if(this.aborted||!this.centroid)return;const r=jn(i,t);for(const e in this.touches){const t=r[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 $n{constructor(e){this.singleTap=new Nn(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,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 r=this.singleTap.touchend(e,t,i);if(r){const t=e.timeStamp-this.lastTime<500,i=!this.lastTap||this.lastTap.dist(r)<30;if(t&&i||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}}}class Vn{constructor(e){this._tr=new Bn(e),this._zoomIn=new $n({numTouches:1,numTaps:2}),this._zoomOut=new $n({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 r=this._zoomIn.touchend(e,t,i),n=this._zoomOut.touchend(e,t,i),o=this._tr;return r?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:o.zoom+1,around:o.unproject(r)},{originalEvent:e})}):n?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:o.zoom-1,around:o.unproject(n)},{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}}class Un{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){const t=this._moveFunction(...e);if(t.bearingDelta||t.pitchDelta||t.rollDelta||t.around||t.panDelta)return this._active=!0,t}dragStart(e,t){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(t)?t[0]:t,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,t){if(!this.isEnabled())return;const i=this._lastPoint;if(!i)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);const r=Array.isArray(t)?t[0]:t;return!this._moved&&r.dist(i)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=r,this._move(i,r))}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&s.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const qn={0:1,2:2};class Zn{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){const t=s.mouseButton(e);this._eventButton=t}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(e,t){const i=qn[t];return void 0===e.buttons||(e.buttons&i)!==i}(e,this._eventButton)}isValidEndEvent(e){return s.mouseButton(e)===this._eventButton}}class Gn{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return 1===e.targetTouches.length}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){this._firstTouch=e.targetTouches[0].identifier}endMove(e){delete this._firstTouch}isValidStartEvent(e){return this._isOneFingerTouch(e)}isValidMoveEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}isValidEndEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}}class Hn{constructor(e=new Zn({checkCorrectEvent:()=>!0}),t=new Gn){this.mouseMoveStateManager=e,this.oneFingerTouchMoveStateManager=t}_executeRelevantHandler(e,t,i){return e instanceof MouseEvent?t(e):"undefined"!=typeof TouchEvent&&e instanceof TouchEvent?i(e):void 0}startMove(e){this._executeRelevantHandler(e,(e=>this.mouseMoveStateManager.startMove(e)),(e=>this.oneFingerTouchMoveStateManager.startMove(e)))}endMove(e){this._executeRelevantHandler(e,(e=>this.mouseMoveStateManager.endMove(e)),(e=>this.oneFingerTouchMoveStateManager.endMove(e)))}isValidStartEvent(e){return this._executeRelevantHandler(e,(e=>this.mouseMoveStateManager.isValidStartEvent(e)),(e=>this.oneFingerTouchMoveStateManager.isValidStartEvent(e)))}isValidMoveEvent(e){return this._executeRelevantHandler(e,(e=>this.mouseMoveStateManager.isValidMoveEvent(e)),(e=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(e)))}isValidEndEvent(e){return this._executeRelevantHandler(e,(e=>this.mouseMoveStateManager.isValidEndEvent(e)),(e=>this.oneFingerTouchMoveStateManager.isValidEndEvent(e)))}}const Wn=e=>{e.mousedown=e.dragStart,e.mousemoveWindow=e.dragMove,e.mouseup=e.dragEnd,e.contextmenu=e=>{e.preventDefault()}};class Kn{constructor(e,t){this._clickTolerance=e.clickTolerance||1,this._map=t,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new t.P(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,t,i){return this._calculateTransform(e,t,i)}touchmove(e,t,i){if(this._active){if(!this._shouldBePrevented(i.length))return e.preventDefault(),this._calculateTransform(e,t,i);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,t,i){this._calculateTransform(e,t,i),this._active&&this._shouldBePrevented(i.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,i,r){r.length>0&&(this._active=!0);const n=jn(r,i),o=new t.P(0,0),a=new t.P(0,0);let s=0;for(const e in n){const t=n[e],i=this._touches[e];i&&(o._add(t),a._add(t.sub(i)),s++,n[e]=t)}if(this._touches=n,this._shouldBePrevented(s)||!a.mag())return;const l=a.div(s);return this._sum._add(l),this._sum.mag()<this._clickTolerance?void 0:{around:o.div(s),panDelta:l}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Xn{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}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){if(!this._firstTwoTouches)return;e.preventDefault();const[r,n]=this._firstTwoTouches,o=Yn(i,t,r),a=Yn(i,t,n);if(!o||!a)return;const s=this._aroundCenter?null:o.add(a).div(2);return this._move([o,a],s,e)}touchend(e,t,i){if(!this._firstTwoTouches)return;const[r,n]=this._firstTwoTouches,o=Yn(i,t,r),a=Yn(i,t,n);o&&a||(this._active&&s.suppressClick(),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 Yn(e,t,i){for(let r=0;r<e.length;r++)if(e[r].identifier===i)return t[r]}function Jn(e,t){return Math.log(e/t)/Math.LN2}class Qn extends Xn{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,t){const i=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(Jn(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Jn(this._distance,i),pinchAround:t}}}function eo(e,t){return 180*e.angleWith(t)/Math.PI}class to extends Xn{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,t,i){const r=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:eo(this._vector,r),pinchAround:t}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const t=25/(Math.PI*this._minDiameter)*360,i=eo(e,this._startVector);return Math.abs(i)<t}}function io(e){return Math.abs(e.y)>Math.abs(e.x)}class ro extends Xn{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,t,i){super.touchstart(e,t,i),this._currentTouchCount=i.length}_start(e){this._lastPoints=e,io(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,t,i){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const r=e[0].sub(this._lastPoints[0]),n=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(r,n,i.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(r.y+n.y)/2*-.5}):void 0}gestureBeginsVertically(e,t,i){if(void 0!==this._valid)return this._valid;const r=e.mag()>=2,n=t.mag()>=2;if(!r&&!n)return;if(!r||!n)return void 0===this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;const o=e.y>0==t.y>0;return io(e)&&io(t)&&o}}const no={panStep:100,bearingStep:15,pitchStep:10};class oo{constructor(e){this._tr=new Bn(e);const t=no;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=0,i=0,r=0,n=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(),n=-1);break;case 39:e.shiftKey?i=1:(e.preventDefault(),n=1);break;case 38:e.shiftKey?r=1:(e.preventDefault(),o=-1);break;case 40:e.shiftKey?r=-1:(e.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(i=0,r=0),{cameraAnimation:a=>{const s=this._tr;a.easeTo({duration:300,easeId:"keyboardHandler",easing:ao,zoom:t?Math.round(s.zoom)+t*(e.shiftKey?2:1):s.zoom,bearing:s.bearing+i*this._bearingStep,pitch:s.pitch+r*this._pitchStep,offset:[-n*this._panStep,-o*this._panStep],center:s.center},{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 ao(e){return e*(2-e)}const so=4.000244140625;class lo{constructor(e,t){this._onTimeout=e=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)},this._map=e,this._tr=new Bn(e),this._triggerRenderFrame=t,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}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)}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return!!this._map.cooperativeGestures.isEnabled()&&!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e))}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);let t=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const i=a.now(),r=i-(this._lastWheelEventTime||0);this._lastWheelEventTime=i,0!==t&&t%so==0?this._type="wheel":0!==t&&Math.abs(t)<4?this._type="trackpad":r>400?(this._type=null,this._lastValue=t,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(r*t)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,t+=this._lastValue)),e.shiftKey&&t&&(t/=4),this._type&&(this._lastWheelEvent=e,this._delta-=t,this._active||this._start(e)),e.preventDefault()}_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 i=s.mousePos(this._map.getCanvas(),e),r=this._tr;this._aroundPoint=this._aroundCenter?r.transform.locationToScreenPoint(t.Q.convert(r.center)):i,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const e=this._tr.transform;if("number"==typeof this._lastExpectedZoom){const t=e.zoom-this._lastExpectedZoom;"number"==typeof this._startZoom&&(this._startZoom+=t),"number"==typeof this._targetZoom&&(this._targetZoom+=t)}if(0!==this._delta){const i="wheel"===this._type&&Math.abs(this._delta)>so?this._wheelZoomRate:this._defaultZoomRate;let r=2/(1+Math.exp(-Math.abs(this._delta*i)));this._delta<0&&0!==r&&(r=1/r);const n="number"!=typeof this._targetZoom?e.scale:t.aI(this._targetZoom);this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,t.ab(n*r))),"wheel"===this._type&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const i="number"!=typeof this._targetZoom?e.zoom:this._targetZoom,r=this._startZoom,n=this._easing;let o,s=!1;if("wheel"===this._type&&r&&n){const e=a.now()-this._lastWheelEventTime,l=Math.min((e+5)/200,1),c=n(l);o=t.B.number(r,i,c),l<1?this._frameId||(this._frameId=!0):s=!0}else o=i,s=!0;return this._active=!0,s&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout}),200)),this._lastExpectedZoom=o,{noInertia:!0,needsRenderFrame:!s,zoomDelta:o-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let i=t.cb;if(this._prevEase){const e=this._prevEase,r=(a.now()-e.start)/e.duration,n=e.easing(r+.01)-e.easing(r),o=.27/Math.sqrt(n*n+1e-4)*.01,s=Math.sqrt(.0729-o*o);i=t.c9(o,s,.25,1)}return this._prevEase={start:a.now(),duration:e,easing:i},i}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class co{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 uo{constructor(e){this._tr=new Bn(e),this.reset()}reset(){this._active=!1}dblclick(e,t){return e.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(t)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ho{constructor(){this._tap=new $n({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,t,i){if(!this._swipePoint)if(this._tapTime){const r=t[0],n=e.timeStamp-this._tapTime<500,o=this._tapPoint.dist(r)<30;n&&o?i.length>0&&(this._swipePoint=r,this._swipeTouch=i[0].identifier):this.reset()}else this._tap.touchstart(e,t,i)}touchmove(e,t,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;const r=t[0],n=r.y-this._swipePoint.y;return this._swipePoint=r,e.preventDefault(),this._active=!0,{zoomDelta:n/128}}}else this._tap.touchmove(e,t,i)}touchend(e,t,i){if(this._tapTime)this._swipePoint&&0===i.length&&this.reset();else{const r=this._tap.touchend(e,t,i);r&&(this._tapTime=e.timeStamp,this._tapPoint=r)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class po{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("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class mo{constructor(e,t,i,r){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=t,this._mousePitch=i,this._mouseRoll=r}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class fo{constructor(e,t,i,r){this._el=e,this._touchZoom=t,this._touchRotate=i,this._tapDragZoom=r,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("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class go{constructor(e,t){this._bypassKey=-1!==navigator.userAgent.indexOf("Mac")?"metaKey":"ctrlKey",this._map=e,this._options=t,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=s.create("div","maplibregl-cooperative-gesture-screen",e);let t=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");"metaKey"===this._bypassKey&&(t=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const i=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),r=document.createElement("div");r.className="maplibregl-desktop-message",r.textContent=t,this._container.appendChild(r);const n=document.createElement("div");n.className="maplibregl-mobile-message",n.textContent=i,this._container.appendChild(n),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(s.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,i){this._enabled&&(this._map.fire(new t.l("cooperativegestureprevented",{gestureType:e,originalEvent:i})),this._container.classList.add("maplibregl-show"),setTimeout((()=>{this._container.classList.remove("maplibregl-show")}),100))}}const yo=e=>e.zoom||e.drag||e.roll||e.pitch||e.rotate;class _o extends t.l{}function vo(e){return e.panDelta&&e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta||e.rollDelta}class xo{constructor(e,i){this.handleWindowEvent=e=>{this.handleEvent(e,`${e.type}Window`)},this.handleEvent=(e,i)=>{if("blur"===e.type)return void this.stop(!0);this._updatingCamera=!0;const r="renderFrame"===e.type?void 0:e,n={needsRenderFrame:!1},o={},a={};for(const{handlerName:l,handler:c,allowed:u}of this._handlers){if(!c.isEnabled())continue;let h;if(this._blockedByActive(a,u,l))c.reset();else if(c[i||e.type]){if(t.cc(e,i||e.type)){const t=s.mousePos(this._map.getCanvas(),e);h=c[i||e.type](e,t)}else if(t.cd(e,i||e.type)){const t=this._getMapTouches(e.touches),r=s.touchPos(this._map.getCanvas(),t);h=c[i||e.type](e,r,t)}else t.ce(i||e.type)||(h=c[i||e.type](e));this.mergeHandlerResult(n,o,h,l,r),h&&h.needsRenderFrame&&this._triggerRenderFrame()}(h||c.isActive())&&(a[l]=c)}const l={};for(const e in this._previousActiveHandlers)a[e]||(l[e]=r);this._previousActiveHandlers=a,(Object.keys(l).length||vo(n))&&(this._changes.push([n,o,l]),this._triggerRenderFrame()),(Object.keys(a).length||vo(n))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:c}=n;c&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],c(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Pn(e),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i);const r=this._el;this._listeners=[[r,"touchstart",{passive:!0}],[r,"touchmove",{passive:!1}],[r,"touchend",void 0],[r,"touchcancel",void 0],[r,"mousedown",void 0],[r,"mousemove",void 0],[r,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[r,"mouseover",void 0],[r,"mouseout",void 0],[r,"dblclick",void 0],[r,"click",void 0],[r,"keydown",{capture:!1}],[r,"keyup",void 0],[r,"wheel",{passive:!1}],[r,"contextmenu",void 0],[window,"blur",void 0]];for(const[e,t,i]of this._listeners)s.addEventListener(e,t,e===document?this.handleWindowEvent:this.handleEvent,i)}destroy(){for(const[e,t,i]of this._listeners)s.removeEventListener(e,t,e===document?this.handleWindowEvent:this.handleEvent,i)}_addDefaultHandlers(e){const i=this._map,r=i.getCanvasContainer();this._add("mapEvent",new Fn(i,e));const n=i.boxZoom=new On(i,e);this._add("boxZoom",n),e.interactive&&e.boxZoom&&n.enable();const o=i.cooperativeGestures=new go(i,e.cooperativeGestures);this._add("cooperativeGestures",o),e.cooperativeGestures&&o.enable();const a=new Vn(i),l=new uo(i);i.doubleClickZoom=new co(l,a),this._add("tapZoom",a),this._add("clickZoom",l),e.interactive&&e.doubleClickZoom&&i.doubleClickZoom.enable();const c=new ho;this._add("tapDragZoom",c);const u=i.touchPitch=new ro(i);this._add("touchPitch",u),e.interactive&&e.touchPitch&&i.touchPitch.enable(e.touchPitch);const h=()=>i.project(i.getCenter()),p=function({enable:e,clickTolerance:i,aroundCenter:r=!0,minPixelCenterThreshold:n=100,rotateDegreesPerPixelMoved:o=.8},a){const l=new Zn({checkCorrectEvent:e=>0===s.mouseButton(e)&&e.ctrlKey||2===s.mouseButton(e)&&!e.ctrlKey});return new Un({clickTolerance:i,move:(e,i)=>{const s=a();if(r&&Math.abs(s.y-e.y)>n)return{bearingDelta:t.ca(new t.P(e.x,i.y),i,s)};let l=(i.x-e.x)*o;return r&&i.y<s.y&&(l=-l),{bearingDelta:l}},moveStateManager:l,enable:e,assignEvents:Wn})}(e,h),d=function({enable:e,clickTolerance:t,pitchDegreesPerPixelMoved:i=-.5}){const r=new Zn({checkCorrectEvent:e=>0===s.mouseButton(e)&&e.ctrlKey||2===s.mouseButton(e)});return new Un({clickTolerance:t,move:(e,t)=>({pitchDelta:(t.y-e.y)*i}),moveStateManager:r,enable:e,assignEvents:Wn})}(e),m=function({enable:e,clickTolerance:t,rollDegreesPerPixelMoved:i=.3},r){const n=new Zn({checkCorrectEvent:e=>2===s.mouseButton(e)&&e.ctrlKey});return new Un({clickTolerance:t,move:(e,t)=>{const n=r();let o=(t.x-e.x)*i;return t.y<n.y&&(o=-o),{rollDelta:o}},moveStateManager:n,enable:e,assignEvents:Wn})}(e,h);i.dragRotate=new mo(e,p,d,m),this._add("mouseRotate",p,["mousePitch"]),this._add("mousePitch",d,["mouseRotate","mouseRoll"]),this._add("mouseRoll",m,["mousePitch"]),e.interactive&&e.dragRotate&&i.dragRotate.enable();const f=function({enable:e,clickTolerance:t}){const i=new Zn({checkCorrectEvent:e=>0===s.mouseButton(e)&&!e.ctrlKey});return new Un({clickTolerance:t,move:(e,t)=>({around:t,panDelta:t.sub(e)}),activateOnStart:!0,moveStateManager:i,enable:e,assignEvents:Wn})}(e),g=new Kn(e,i);i.dragPan=new po(r,f,g),this._add("mousePan",f),this._add("touchPan",g,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&i.dragPan.enable(e.dragPan);const y=new to,_=new Qn;i.touchZoomRotate=new fo(r,_,y,c),this._add("touchRotate",y,["touchPan","touchZoom"]),this._add("touchZoom",_,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&i.touchZoomRotate.enable(e.touchZoomRotate);const v=i.scrollZoom=new lo(i,(()=>this._triggerRenderFrame()));this._add("scrollZoom",v,["mousePan"]),e.interactive&&e.scrollZoom&&i.scrollZoom.enable(e.scrollZoom);const x=i.keyboard=new oo(i);this._add("keyboard",x),e.interactive&&e.keyboard&&i.keyboard.enable(),this._add("blockableMapEvent",new Rn(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 Boolean(yo(this._eventsInProgress))||this.isZooming()}_blockedByActive(e,t,i){for(const r in e)if(r!==i&&(!t||t.indexOf(r)<0))return!0;return!1}_getMapTouches(e){const t=[];for(const i of e)this._el.contains(i.target)&&t.push(i);return t}mergeHandlerResult(e,i,r,n,o){if(!r)return;t.e(e,r);const a={handlerName:n,originalEvent:r.originalEvent||o};void 0!==r.zoomDelta&&(i.zoom=a),void 0!==r.panDelta&&(i.drag=a),void 0!==r.rollDelta&&(i.roll=a),void 0!==r.pitchDelta&&(i.pitch=a),void 0!==r.bearingDelta&&(i.rotate=a)}_applyChanges(){const e={},i={},r={};for(const[n,o,a]of this._changes)n.panDelta&&(e.panDelta=(e.panDelta||new t.P(0,0))._add(n.panDelta)),n.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+n.zoomDelta),n.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+n.bearingDelta),n.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+n.pitchDelta),n.rollDelta&&(e.rollDelta=(e.rollDelta||0)+n.rollDelta),void 0!==n.around&&(e.around=n.around),void 0!==n.pinchAround&&(e.pinchAround=n.pinchAround),n.noInertia&&(e.noInertia=n.noInertia),t.e(i,o),t.e(r,a);this._updateMapTransform(e,i,r),this._changes=[]}_updateMapTransform(e,t,i){const r=this._map,n=r._getTransformForUpdate(),o=r.terrain;if(!(vo(e)||o&&this._terrainMovement))return this._fireEvents(t,i,!0);r._stop(!0);let{panDelta:a,zoomDelta:s,bearingDelta:l,pitchDelta:c,rollDelta:u,around:h,pinchAround:p}=e;void 0!==p&&(h=p),h=h||r.transform.centerPoint,o&&!n.isPointOnMapSurface(h)&&(h=n.centerPoint);const d={panDelta:a,zoomDelta:s,rollDelta:u,pitchDelta:c,bearingDelta:l,around:h};this._map.cameraHelper.useGlobeControls&&!n.isPointOnMapSurface(h)&&(h=n.centerPoint);const m=h.distSqr(n.centerPoint)<.01?n.center:n.screenPointToLocation(a?h.sub(a):h);o?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(d,n),this._terrainMovement||!t.drag&&!t.zoom?t.drag&&this._terrainMovement?n.setCenter(n.screenPointToLocation(n.centerPoint.sub(a))):this._map.cameraHelper.handleMapControlsPan(d,n,m):(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(d,n,m))):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(d,n),this._map.cameraHelper.handleMapControlsPan(d,n,m)),r._applyUpdatedTransform(n),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(t,i,!0)}_fireEvents(e,i,r){const n=yo(this._eventsInProgress),o=yo(e),s={};for(const t in e){const{originalEvent:i}=e[t];this._eventsInProgress[t]||(s[`${t}start`]=i),this._eventsInProgress[t]=e[t]}!n&&o&&this._fireEvent("movestart",o.originalEvent);for(const e in s)this._fireEvent(e,s[e]);o&&this._fireEvent("move",o.originalEvent);for(const t in e){const{originalEvent:i}=e[t];this._fireEvent(t,i)}const l={};let c;for(const e in this._eventsInProgress){const{handlerName:t,originalEvent:r}=this._eventsInProgress[e];this._handlersById[t].isActive()||(delete this._eventsInProgress[e],c=i[t]||r,l[`${e}end`]=c)}for(const e in l)this._fireEvent(e,l[e]);const u=yo(this._eventsInProgress),h=(n||o)&&!u;if(h&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const e=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&e.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(e)}if(r&&h){this._updatingCamera=!0;const e=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),i=e=>0!==e&&-this._bearingSnap<e&&e<this._bearingSnap;!e||!e.essential&&a.prefersReducedMotion?(this._map.fire(new t.l("moveend",{originalEvent:c})),i(this._map.getBearing())&&this._map.resetNorth()):(i(e.bearing||this._map.getBearing())&&(e.bearing=0),e.freezeElevation=!0,this._map.easeTo(e,{originalEvent:c})),this._updatingCamera=!1}}_fireEvent(e,i){this._map.fire(new t.l(e,i?{originalEvent:i}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((e=>{delete this._frameId,this.handleEvent(new _o("renderFrame",{timeStamp:e})),this._applyChanges()}))}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}class bo extends t.E{constructor(e,t,i){super(),this._renderFrameCallback=()=>{const e=Math.min((a.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=i.bearingSnap,this.cameraHelper=t,this.on("moveend",(()=>{delete this._requestedCameraState}))}migrateProjection(e,t){e.apply(this.transform),this.transform=e,this.cameraHelper=t}getCenter(){return new t.Q(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t){return this.jumpTo({center:e},t)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,t){return this.jumpTo({elevation:e},t),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,i,r){return e=t.P.convert(e).mult(-1),this.panTo(this.transform.center,t.e({offset:e},i),r)}panTo(e,i,r){return this.easeTo(t.e({center:e},i),r)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(e,i,r){return this.easeTo(t.e({zoom:e},i),r)}zoomIn(e,t){return this.zoomTo(this.getZoom()+1,e,t),this}zoomOut(e,t){return this.zoomTo(this.getZoom()-1,e,t),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,i){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new t.l("movestart",i)).fire(new t.l("move",i)).fire(new t.l("moveend",i))),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(e,i,r){return this.easeTo(t.e({bearing:e},i),r)}resetNorth(e,i){return this.rotateTo(0,t.e({duration:1e3},e),i),this}resetNorthPitch(e,i){return this.easeTo(t.e({bearing:0,pitch:0,roll:0,duration:1e3},e),i),this}snapToNorth(e,t){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,t):this}getPitch(){return this.transform.pitch}setPitch(e,t){return this.jumpTo({pitch:e},t),this}getRoll(){return this.transform.roll}setRoll(e,t){return this.jumpTo({roll:e},t),this}cameraForBounds(e,t){e=q.convert(e).adjustAntiMeridian();const i=t&&t.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),i,t)}_cameraForBoxAndBearing(e,i,r,n){const o={top:0,bottom:0,right:0,left:0};if("number"==typeof(n=t.e({padding:o,offset:[0,0],maxZoom:this.transform.maxZoom},n)).padding){const e=n.padding;n.padding={top:e,bottom:e,right:e,left:e}}const a=t.e(o,n.padding);n.padding=a;const s=this.transform,l=new q(e,i);return this.cameraHelper.cameraForBoxAndBearing(n,a,l,r,s)}fitBounds(e,t,i){return this._fitInternal(this.cameraForBounds(e,t),t,i)}fitScreenCoordinates(e,i,r,n,o){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(t.P.convert(e)),this.transform.screenPointToLocation(t.P.convert(i)),r,n),n,o)}_fitInternal(e,i,r){return e?(delete(i=t.e(e,i)).padding,i.linear?this.easeTo(i,r):this.flyTo(i,r)):this}jumpTo(e,i){this.stop();const r=this._getTransformForUpdate();let n=!1,o=!1,a=!1;const s=r.zoom;this.cameraHelper.handleJumpToCenterZoom(r,e);const l=r.zoom!==s;return"elevation"in e&&r.elevation!==+e.elevation&&r.setElevation(+e.elevation),"bearing"in e&&r.bearing!==+e.bearing&&(n=!0,r.setBearing(+e.bearing)),"pitch"in e&&r.pitch!==+e.pitch&&(o=!0,r.setPitch(+e.pitch)),"roll"in e&&r.roll!==+e.roll&&(a=!0,r.setRoll(+e.roll)),null==e.padding||r.isPaddingEqual(e.padding)||r.setPadding(e.padding),this._applyUpdatedTransform(r),this.fire(new t.l("movestart",i)).fire(new t.l("move",i)),l&&this.fire(new t.l("zoomstart",i)).fire(new t.l("zoom",i)).fire(new t.l("zoomend",i)),n&&this.fire(new t.l("rotatestart",i)).fire(new t.l("rotate",i)).fire(new t.l("rotateend",i)),o&&this.fire(new t.l("pitchstart",i)).fire(new t.l("pitch",i)).fire(new t.l("pitchend",i)),a&&this.fire(new t.l("rollstart",i)).fire(new t.l("roll",i)).fire(new t.l("rollend",i)),this.fire(new t.l("moveend",i))}calculateCameraOptionsFromTo(e,i,r,n=0){const o=t.$.fromLngLat(e,i),a=t.$.fromLngLat(r,n),s=a.x-o.x,l=a.y-o.y,c=a.z-o.z,u=Math.hypot(s,l,c);if(0===u)throw new Error("Can't calculate camera options with same From and To");const h=Math.hypot(s,l),p=t.ab(this.transform.cameraToCenterDistance/u/this.transform.tileSize),d=180*Math.atan2(s,-l)/Math.PI;let m=180*Math.acos(h/u)/Math.PI;return m=c<0?90-m:90+m,{center:a.toLngLat(),elevation:n,zoom:p,pitch:m,bearing:d}}calculateCameraOptionsFromCameraLngLatAltRotation(e,t,i,r,n){const o=this.transform.calculateCenterFromCameraLngLatAlt(e,t,i,r);return{center:o.center,elevation:o.elevation,zoom:o.zoom,bearing:i,pitch:r,roll:n}}easeTo(e,i){this._stop(!1,e.easeId),(!1===(e=t.e({offset:[0,0],duration:500,easing:t.cb},e)).animate||!e.essential&&a.prefersReducedMotion)&&(e.duration=0);const r=this._getTransformForUpdate(),n=this.getBearing(),o=r.pitch,s=r.roll,l="bearing"in e?this._normalizeBearing(e.bearing,n):n,c="pitch"in e?+e.pitch:o,u="roll"in e?this._normalizeBearing(e.roll,s):s,h="padding"in e?e.padding:r.padding,p=t.P.convert(e.offset);let d,m;e.around&&(d=t.Q.convert(e.around),m=r.locationToScreenPoint(d));const f={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},g=this.cameraHelper.handleEaseTo(r,{bearing:l,pitch:c,roll:u,padding:h,around:d,aroundPoint:m,offsetAsPoint:p,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating=this._rotating||n!==l,this._pitching=this._pitching||c!==o,this._rolling=this._rolling||u!==s,this._padding=!r.isPaddingEqual(h),this._zooming=this._zooming||g.isZooming,this._easeId=e.easeId,this._prepareEase(i,e.noMoveStart,f),this.terrain&&this._prepareElevation(g.elevationCenter),this._ease((t=>{g.easeFunc(t),this.terrain&&!e.freezeElevation&&this._updateElevation(t),this._applyUpdatedTransform(r),this._fireMoveEvents(i)}),(t=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i,t)}),e),this}_prepareEase(e,i,r={}){this._moving=!0,i||r.moving||this.fire(new t.l("movestart",e)),this._zooming&&!r.zooming&&this.fire(new t.l("zoomstart",e)),this._rotating&&!r.rotating&&this.fire(new t.l("rotatestart",e)),this._pitching&&!r.pitching&&this.fire(new t.l("pitchstart",e)),this._rolling&&!r.rolling&&this.fire(new t.l("rollstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const i=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&i!==this._elevationTarget){const t=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(t-(i-(t*e+this._elevationStart))/(1-e)),this._elevationTarget=i}this.transform.setElevation(t.B.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};const t=e.getCameraLngLat(),i=e.getCameraAltitude(),r=this.terrain?this.terrain.getElevationForLngLatZoom(t,e.zoom):0;if(i<r){const i=this.calculateCameraOptionsFromTo(t,r,e.center,e.elevation);return{pitch:i.pitch,zoom:i.zoom}}return{}}_applyUpdatedTransform(e){const t=[];if(t.push((e=>this._elevateCameraIfInsideTerrain(e))),this.transformCameraUpdate&&t.push((e=>this.transformCameraUpdate(e))),!t.length)return;const i=e.clone();for(const e of t){const t=i.clone(),{center:r,zoom:n,roll:o,pitch:a,bearing:s,elevation:l}=e(t);r&&t.setCenter(r),void 0!==l&&t.setElevation(l),void 0!==n&&t.setZoom(n),void 0!==o&&t.setRoll(o),void 0!==a&&t.setPitch(a),void 0!==s&&t.setBearing(s),i.apply(t)}this.transform.apply(i)}_fireMoveEvents(e){this.fire(new t.l("move",e)),this._zooming&&this.fire(new t.l("zoom",e)),this._rotating&&this.fire(new t.l("rotate",e)),this._pitching&&this.fire(new t.l("pitch",e)),this._rolling&&this.fire(new t.l("roll",e))}_afterEase(e,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;const r=this._zooming,n=this._rotating,o=this._pitching,a=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,r&&this.fire(new t.l("zoomend",e)),n&&this.fire(new t.l("rotateend",e)),o&&this.fire(new t.l("pitchend",e)),a&&this.fire(new t.l("rollend",e)),this.fire(new t.l("moveend",e))}flyTo(e,i){if(!e.essential&&a.prefersReducedMotion){const r=t.O(e,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(r,i)}this.stop(),e=t.e({offset:[0,0],speed:1.2,curve:1.42,easing:t.cb},e);const r=this._getTransformForUpdate(),n=r.bearing,o=r.pitch,s=r.roll,l=r.padding,c="bearing"in e?this._normalizeBearing(e.bearing,n):n,u="pitch"in e?+e.pitch:o,h="roll"in e?this._normalizeBearing(e.roll,s):s,p="padding"in e?e.padding:r.padding,d=t.P.convert(e.offset);let m=r.centerPoint.add(d);const f=r.screenPointToLocation(m),g=this.cameraHelper.handleFlyTo(r,{bearing:c,pitch:u,roll:h,padding:p,locationAtOffset:f,offsetAsPoint:d,center:e.center,minZoom:e.minZoom,zoom:e.zoom});let y=e.curve;const _=Math.max(r.width,r.height),v=_/g.scaleOfZoom,x=g.pixelPathLength;"number"==typeof g.scaleOfMinZoom&&(y=Math.sqrt(_/g.scaleOfMinZoom/x*2));const b=y*y;function w(e){const t=(v*v-_*_+(e?-1:1)*b*b*x*x)/(2*(e?v:_)*b*x);return Math.log(Math.sqrt(t*t+1)-t)}function C(e){return(Math.exp(e)-Math.exp(-e))/2}function T(e){return(Math.exp(e)+Math.exp(-e))/2}const S=w(!1);let A=function(e){return T(S)/T(S+y*e)},M=function(e){return _*((T(S)*(C(t=S+y*e)/T(t))-C(S))/b)/x;var t},E=(w(!0)-S)/y;if(Math.abs(x)<2e-6||!isFinite(E)){if(Math.abs(_-v)<1e-6)return this.easeTo(e,i);const t=v<_?-1:1;E=Math.abs(Math.log(v/_))/y,M=()=>0,A=e=>Math.exp(t*y*e)}return e.duration="duration"in e?+e.duration:1e3*E/("screenSpeed"in e?+e.screenSpeed/y:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=n!==c,this._pitching=u!==o,this._rolling=h!==s,this._padding=!r.isPaddingEqual(p),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(g.targetCenter),this._ease((a=>{const f=a*E,y=1/A(f),_=M(f);this._rotating&&r.setBearing(t.B.number(n,c,a)),this._pitching&&r.setPitch(t.B.number(o,u,a)),this._rolling&&r.setRoll(t.B.number(s,h,a)),this._padding&&(r.interpolatePadding(l,p,a),m=r.centerPoint.add(d)),g.easeFunc(a,y,_,m),this.terrain&&!e.freezeElevation&&this._updateElevation(a),this._applyUpdatedTransform(r),this._fireMoveEvents(i)}),(()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i)}),e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,t){var i;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const e=this._onEaseEnd;delete this._onEaseEnd,e.call(this,t)}return e||null===(i=this.handlers)||void 0===i||i.stop(!1),this}_ease(e,t,i){!1===i.animate||0===i.duration?(e(1),t()):(this._easeStart=a.now(),this._easeOptions=i,this._onEaseFrame=e,this._onEaseEnd=t,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,i){e=t.aL(e,-180,180);const r=Math.abs(e-i);return Math.abs(e-360-i)<r&&(e-=360),Math.abs(e+360-i)<r&&(e+=360),e}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(t.Q.convert(e),this.transform.tileZoom):null}}const wo={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Co{constructor(e=wo){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=e=>{!e||"metadata"!==e.sourceDataType&&"visibility"!==e.sourceDataType&&"style"!==e.dataType&&"terrain"!==e.type||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=s.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=s.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=s.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){s.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(e,t){const i=this._map._getUIString(`AttributionControl.${t}`);e.title=i,e.setAttribute("aria-label",i)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map((e=>"string"!=typeof e?"":e))):"string"==typeof this.options.customAttribution&&e.push(this.options.customAttribution)),this._map.style.stylesheet){const e=this._map.style.stylesheet;this.styleOwner=e.owner,this.styleId=e.id}const t=this._map.style.sourceCaches;for(const i in t){const r=t[i];if(r.used||r.usedForTerrain){const t=r.getSource();t.attribution&&e.indexOf(t.attribution)<0&&e.push(t.attribution)}}e=e.filter((e=>String(e).trim())),e.sort(((e,t)=>e.length-t.length)),e=e.filter(((t,i)=>{for(let r=i+1;r<e.length;r++)if(e[r].indexOf(t)>=0)return!1;return!0}));const i=e.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,e.length?(this._innerContainer.innerHTML=s.sanitize(i),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class To{constructor(e={}){this._updateCompact=()=>{const e=this._container.children;if(e.length){const t=e[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&t.classList.add("maplibregl-compact"):t.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=s.create("div","maplibregl-ctrl");const t=s.create("a","maplibregl-ctrl-logo");return t.target="_blank",t.rel="noopener nofollow",t.href="https://maplibre.org/",t.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),t.setAttribute("rel","noopener nofollow"),this._container.appendChild(t),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){s.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class So{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){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");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=[]}}var Ao=t.aD([{name:"a_pos3d",type:"Int16",components:3}]);class Mo extends t.E{constructor(e){super(),this._lastTilesetChange=a.now(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,i){this.sourceCache.update(e,i),this._renderableTilesKeys=[];const r={};for(const n of he(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i,calculateTileZoom:this.sourceCache._source.calculateTileZoom}))r[n.key]=!0,this._renderableTilesKeys.push(n.key),this._tiles[n.key]||(n.terrainRttPosMatrix32f=new Float64Array(16),t.bO(n.terrainRttPosMatrix32f,0,t.Z,t.Z,0,0,1),this._tiles[n.key]=new oe(n,this.tileSize),this._lastTilesetChange=a.now());for(const e in this._tiles)r[e]||delete this._tiles[e]}freeRtt(e){for(const t in this._tiles){const i=this._tiles[t];(!e||i.tileID.equals(e)||i.tileID.isChildOf(e)||e.isChildOf(i.tileID))&&(i.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map((e=>this.getTileByID(e)))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e,t){return t?this._getTerrainCoordsForTileRanges(e,t):this._getTerrainCoordsForRegularTile(e)}_getTerrainCoordsForRegularTile(e){const i={};for(const r of this._renderableTilesKeys){const n=this._tiles[r].tileID,o=e.clone(),a=t.b2();if(n.canonical.equals(e.canonical))t.bO(a,0,t.Z,t.Z,0,0,1);else if(n.canonical.isChildOf(e.canonical)){const i=n.canonical.z-e.canonical.z,r=n.canonical.x-(n.canonical.x>>i<<i),o=n.canonical.y-(n.canonical.y>>i<<i),s=t.Z>>i;t.bO(a,0,s,s,0,0,1),t.L(a,a,[-r*s,-o*s,0])}else{if(!e.canonical.isChildOf(n.canonical))continue;{const i=e.canonical.z-n.canonical.z,r=e.canonical.x-(e.canonical.x>>i<<i),o=e.canonical.y-(e.canonical.y>>i<<i),s=t.Z>>i;t.bO(a,0,t.Z,t.Z,0,0,1),t.L(a,a,[r*s,o*s,0]),t.M(a,a,[1/2**i,1/2**i,0])}}o.terrainRttPosMatrix32f=new Float32Array(a),i[r]=o}return i}_getTerrainCoordsForTileRanges(e,i){const r={};for(const n of this._renderableTilesKeys){const o=this._tiles[n].tileID;if(!this._isWithinTileRanges(o,i))continue;const a=e.clone(),s=t.b2();if(o.canonical.z===e.canonical.z){const i=e.canonical.x-o.canonical.x,r=e.canonical.y-o.canonical.y;t.bO(s,0,t.Z,t.Z,0,0,1),t.L(s,s,[i*t.Z,r*t.Z,0])}else if(o.canonical.z>e.canonical.z){const i=o.canonical.z-e.canonical.z,r=o.canonical.x-(o.canonical.x>>i<<i),n=o.canonical.y-(o.canonical.y>>i<<i),a=e.canonical.x-(o.canonical.x>>i),l=e.canonical.y-(o.canonical.y>>i),c=t.Z>>i;t.bO(s,0,c,c,0,0,1),t.L(s,s,[-r*c+a*t.Z,-n*c+l*t.Z,0])}else{const i=e.canonical.z-o.canonical.z,r=e.canonical.x-(e.canonical.x>>i<<i),n=e.canonical.y-(e.canonical.y>>i<<i),a=(e.canonical.x>>i)-o.canonical.x,l=(e.canonical.y>>i)-o.canonical.y,c=t.Z<<i;t.bO(s,0,c,c,0,0,1),t.L(s,s,[r*t.Z+a*c,n*t.Z+l*c,0])}a.terrainRttPosMatrix32f=new Float32Array(s),r[n]=a}return r}getSourceTile(e,t){const i=this.sourceCache._source;let r=e.overscaledZ-this.deltaZoom;if(r>i.maxzoom&&(r=i.maxzoom),r<i.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(r).key);let n=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if((!n||!n.dem)&&t)for(;r>=i.minzoom&&(!n||!n.dem);)n=this.sourceCache.getTileByID(e.scaledTo(r--).key);return n}anyTilesAfterTime(e=Date.now()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,t){return t[e.canonical.z]&&e.canonical.x>=t[e.canonical.z].minTileX&&e.canonical.x<=t[e.canonical.z].maxTileX&&e.canonical.y>=t[e.canonical.z].minTileY&&e.canonical.y<=t[e.canonical.z].maxTileY}}class Eo{constructor(e,t,i){this._meshCache={},this.painter=e,this.sourceCache=new Mo(t),this.options=i,this.exaggeration="number"==typeof i.exaggeration?i.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,i,r,n=t.Z){var o;if(!(i>=0&&i<n&&r>=0&&r<n))return 0;const a=this.getTerrainData(e),s=null===(o=a.tile)||void 0===o?void 0:o.dem;if(!s)return 0;const l=t.cf([],[i/n*t.Z,r/n*t.Z],a.u_terrain_matrix),c=[l[0]*s.dim,l[1]*s.dim],u=Math.floor(c[0]),h=Math.floor(c[1]),p=c[0]-u,d=c[1]-h;return s.get(u,h)*(1-p)*(1-d)+s.get(u+1,h)*p*(1-d)+s.get(u,h+1)*(1-p)*d+s.get(u+1,h+1)*p*d}getElevationForLngLatZoom(e,i){if(!t.cg(i,e.wrap()))return 0;const{tileID:r,mercatorX:n,mercatorY:o}=this._getOverscaledTileIDFromLngLatZoom(e,i);return this.getElevation(r,n%t.Z,o%t.Z,t.Z)}getElevation(e,i,r,n=t.Z){return this.getDEMElevation(e,i,r,n)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){const e=this.painter.context,i=new t.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new _(e,i,e.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new _(e,new t.R({width:1,height:1}),e.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=t.at([])}const i=this.sourceCache.getSourceTile(e,!0);if(i&&i.dem&&(!i.demTexture||i.needsTerrainPrepare)){const e=this.painter.context;i.demTexture=this.painter.getTileTexture(i.dem.stride),i.demTexture?i.demTexture.update(i.dem.getPixels(),{premultiply:!1}):i.demTexture=new _(e,i.dem.getPixels(),e.gl.RGBA,{premultiply:!1}),i.demTexture.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),i.needsTerrainPrepare=!1}const r=i&&i+i.tileID.key+e.key;if(r&&!this._demMatrixCache[r]){const r=this.sourceCache.sourceCache._source.maxzoom;let n=e.canonical.z-i.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=r?n=e.canonical.z-r:t.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const o=e.canonical.x-(e.canonical.x>>n<<n),a=e.canonical.y-(e.canonical.y>>n<<n),s=t.ch(new Float64Array(16),[1/(t.Z<<n),1/(t.Z<<n),0]);t.L(s,s,[o*t.Z,a*t.Z,0]),this._demMatrixCache[e.key]={matrix:s,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:i&&i.dem&&i.dem.dim||1,u_terrain_matrix:r?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:i&&i.dem&&i.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(i&&i.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:i}}getFramebuffer(e){const t=this.painter,i=t.width/devicePixelRatio,r=t.height/devicePixelRatio;return!this._fbo||this._fbo.width===i&&this._fbo.height===r||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new _(t.context,{width:i,height:r,data:null},t.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(t.context.gl.NEAREST,t.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new _(t.context,{width:i,height:r,data:null},t.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(t.context.gl.NEAREST,t.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=t.context.createFramebuffer(i,r,!0,!1),this._fbo.depthAttachment.set(t.context.createRenderbuffer(t.context.gl.DEPTH_COMPONENT16,i,r))),this._fbo.colorAttachment.set("coords"===e?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const i=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let e=0,t=0;e<this._coordsTextureSize;e++)for(let r=0;r<this._coordsTextureSize;r++,t+=4)i[t+0]=255&r,i[t+1]=255&e,i[t+2]=r>>8<<4|e>>8,i[t+3]=0;const r=new t.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),n=new _(e,r,e.gl.RGBA,{premultiply:!1});return n.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=n,n}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);const i=new Uint8Array(4),r=this.painter.context,n=r.gl,o=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),a=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),s=Math.round(this.painter.height/devicePixelRatio);r.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),n.readPixels(o,s-a-1,1,1,n.RGBA,n.UNSIGNED_BYTE,i),r.bindFramebuffer.set(null);const l=i[0]+(i[2]>>4<<8),c=i[1]+((15&i[2])<<8),u=this.coordsIndex[255-i[3]],h=u&&this.sourceCache.getTileByID(u);if(!h)return null;const p=this._coordsTextureSize,d=(1<<h.tileID.canonical.z)*p;return new t.$((h.tileID.canonical.x*p+l)/d+h.tileID.wrap,(h.tileID.canonical.y*p+c)/d,this.getElevation(h.tileID,l,c,p))}depthAtPoint(e){const t=new Uint8Array(4),i=this.painter.context,r=i.gl;return i.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),r.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,r.RGBA,r.UNSIGNED_BYTE,t),i.bindFramebuffer.set(null),(t[0]/16777216+t[1]/65536+t[2]/256+t[3])/256}getTerrainMesh(e){var i;const r=(null===(i=this.painter.style.projection)||void 0===i?void 0:i.transitionState)>0,n=r&&0===e.canonical.y,o=r&&e.canonical.y===(1<<e.canonical.z)-1,a=`m_${n?"n":""}_${o?"s":""}`;if(this._meshCache[a])return this._meshCache[a];const s=this.painter.context,l=new t.ci,c=new t.aH,u=this.meshSize,h=t.Z/u,p=u*u;for(let e=0;e<=u;e++)for(let t=0;t<=u;t++)l.emplaceBack(t*h,e*h,0);for(let e=0;e<p;e+=u+1)for(let t=0;t<u;t++)c.emplaceBack(t+e,u+t+e+1,u+t+e+2),c.emplaceBack(t+e,u+t+e+2,t+e+1);const d=l.length,m=d+(u+1),f=(u+1)*u,g=n?t.b9:0,y=n?0:1,_=o?t.ba:t.Z,v=o?0:1;for(let e=0;e<=u;e++)l.emplaceBack(e*h,g,y);for(let e=0;e<=u;e++)l.emplaceBack(e*h,_,v);for(let e=0;e<u;e++)c.emplaceBack(f+e,m+e,m+e+1),c.emplaceBack(f+e,m+e+1,f+e+1),c.emplaceBack(0+e,d+e+1,d+e),c.emplaceBack(0+e,0+e+1,d+e+1);const x=l.length,b=x+2*(u+1);for(const e of[0,1])for(let i=0;i<=u;i++)for(const r of[0,1])l.emplaceBack(e*t.Z,i*h,r);for(let e=0;e<2*u;e+=2)c.emplaceBack(x+e,x+e+1,x+e+3),c.emplaceBack(x+e,x+e+3,x+e+2),c.emplaceBack(b+e,b+e+3,b+e+1),c.emplaceBack(b+e,b+e+2,b+e+3);const w=new mt(s.createVertexBuffer(l,Ao.members),s.createIndexBuffer(c),t.aG.simpleSegment(0,0,l.length,c.length));return this._meshCache[a]=w,w}getMeshFrameDelta(e){return 2*Math.PI*t.br/Math.pow(2,Math.max(e,0))/5}getMinTileElevationForLngLatZoom(e,t){var i;const{tileID:r}=this._getOverscaledTileIDFromLngLatZoom(e,t);return null!==(i=this.getMinMaxElevation(r).minElevation)&&void 0!==i?i:0}getMinMaxElevation(e){const t=this.getTerrainData(e).tile,i={minElevation:null,maxElevation:null};return t&&t.dem&&(i.minElevation=t.dem.min*this.exaggeration,i.maxElevation=t.dem.max*this.exaggeration),i}_getOverscaledTileIDFromLngLatZoom(e,i){const r=t.$.fromLngLat(e.wrap()),n=(1<<i)*t.Z,o=r.x*n,a=r.y*n,s=Math.floor(o/t.Z),l=Math.floor(a/t.Z);return{tileID:new t.Y(i,0,i,s,l),mercatorX:o,mercatorY:a}}}class Po{constructor(e,t,i){this._context=e,this._size=t,this._tileSize=i,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const e of this._objects)e.texture.destroy(),e.fbo.destroy()}_createObject(e){const t=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),i=new _(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return i.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),t.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),t.colorAttachment.set(i.texture),{id:e,fbo:t,texture:i,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter((t=>e.id!==t)),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(const e of this._recentlyUsed)if(!this._objects[e].inUse)return this._objects[e];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(const e of this._objects)this.freeObject(e)}isFull(){return!(this._objects.length<this._size)&&!1===this._objects.some((e=>!e.inUse))}}const Io={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class ko{constructor(e,t){this.painter=e,this.terrain=t,this.pool=new Po(e.context,30,t.sourceCache.tileSize*t.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,t){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter((i=>!e._layers[i].isHidden(t))),this._coordsAscending={};for(const t in e.sourceCaches){this._coordsAscending[t]={};const i=e.sourceCaches[t].getVisibleCoordinates(),r=e.sourceCaches[t].getSource(),n=r instanceof X?r.terrainTileRanges:null;for(const e of i){const i=this.terrain.sourceCache.getTerrainCoords(e,n);for(const e in i)this._coordsAscending[t][e]||(this._coordsAscending[t][e]=[]),this._coordsAscending[t][e].push(i[e])}}this._coordsAscendingStr={};for(const t of e._order){const i=e._layers[t],r=i.source;if(Io[i.type]&&!this._coordsAscendingStr[r]){this._coordsAscendingStr[r]={};for(const e in this._coordsAscending[r])this._coordsAscendingStr[r][e]=this._coordsAscending[r][e].map((e=>e.key)).sort().join()}}for(const e of this._renderableTiles)for(const t in this._coordsAscendingStr){const i=this._coordsAscendingStr[t][e.tileID.key];i&&i!==e.rttCoords[t]&&(e.rtt=[])}}renderLayer(e,i){if(e.isHidden(this.painter.transform.zoom))return!1;const r=Object.assign(Object.assign({},i),{isRenderingToTexture:!0}),n=e.type,o=this.painter,a=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(Io[n]&&(this._prevType&&Io[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(e.id),!a))return!0;if(Io[this._prevType]||Io[n]&&a){this._prevType=n;const e=this._stacks.length-1,i=this._stacks[e]||[];for(const n of this._renderableTiles){if(this.pool.isFull()&&(_n(this.painter,this.terrain,this._rttTiles,r),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(n),n.rtt[e]){const t=this.pool.getObjectForId(n.rtt[e].id);if(t.stamp===n.rtt[e].stamp){this.pool.useObject(t);continue}}const a=this.pool.getOrCreateFreeObject();this.pool.useObject(a),this.pool.stampObject(a),n.rtt[e]={id:a.id,stamp:a.stamp},o.context.bindFramebuffer.set(a.fbo.framebuffer),o.context.clear({color:t.b7.transparent,stencil:0}),o.currentStencilSource=void 0;for(let e=0;e<i.length;e++){const t=o.style._layers[i[e]],s=t.source?this._coordsAscending[t.source][n.tileID.key]:[n.tileID];o.context.viewport.set([0,0,a.fbo.width,a.fbo.height]),o._renderTileClippingMasks(t,s,!0),o.renderLayer(o,o.style.sourceCaches[t.source],t,s,r),t.source&&(n.rttCoords[t.source]=this._coordsAscendingStr[t.source][n.tileID.key])}}return _n(this.painter,this.terrain,this._rttTiles,r),this._rttTiles=[],this.pool.freeAllObjects(),Io[n]}return!1}}const zo={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},Lo=i,Do={hash:!1,interactive:!0,bearingSnap:7,attributionControl:wo,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:t.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0},Fo={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class Ro{constructor(e,i,r=!1){this.mousedown=e=>{this.startMove(e,s.mousePos(this.element,e)),s.addEventListener(window,"mousemove",this.mousemove),s.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=e=>{this.move(e,s.mousePos(this.element,e))},this.mouseup=e=>{this._rotatePitchHanlder.dragEnd(e),this.offTemp()},this.touchstart=e=>{1!==e.targetTouches.length?this.reset():(this._startPos=this._lastPos=s.touchPos(this.element,e.targetTouches)[0],this.startMove(e,this._startPos),s.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),s.addEventListener(window,"touchend",this.touchend))},this.touchmove=e=>{1!==e.targetTouches.length?this.reset():(this._lastPos=s.touchPos(this.element,e.targetTouches)[0],this.move(e,this._lastPos))},this.touchend=e=>{0===e.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this._rotatePitchHanlder.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=i;const n=new Hn;this._rotatePitchHanlder=new Un({clickTolerance:3,move:(e,n)=>{const o=i.getBoundingClientRect(),a=new t.P((o.bottom-o.top)/2,(o.right-o.left)/2);return{bearingDelta:t.ca(new t.P(e.x,n.y),n,a),pitchDelta:r?-.5*(n.y-e.y):void 0}},moveStateManager:n,enable:!0,assignEvents:()=>{}}),this.map=e,s.addEventListener(i,"mousedown",this.mousedown),s.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),s.addEventListener(i,"touchcancel",this.reset)}startMove(e,t){this._rotatePitchHanlder.dragStart(e,t),s.disableDrag()}move(e,t){const i=this.map,{bearingDelta:r,pitchDelta:n}=this._rotatePitchHanlder.dragMove(e,t)||{};r&&i.setBearing(i.getBearing()+r),n&&i.setPitch(i.getPitch()+n)}off(){const e=this.element;s.removeEventListener(e,"mousedown",this.mousedown),s.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),s.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),s.removeEventListener(window,"touchend",this.touchend),s.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){s.enableDrag(),s.removeEventListener(window,"mousemove",this.mousemove),s.removeEventListener(window,"mouseup",this.mouseup),s.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),s.removeEventListener(window,"touchend",this.touchend)}}let Bo;function Oo(e,i,r){const n=new t.Q(e.lng,e.lat);if(e=new t.Q(e.lng,e.lat),i){const n=new t.Q(e.lng-360,e.lat),o=new t.Q(e.lng+360,e.lat),a=r.locationToScreenPoint(e).distSqr(i);r.locationToScreenPoint(n).distSqr(i)<a?e=n:r.locationToScreenPoint(o).distSqr(i)<a&&(e=o)}for(;Math.abs(e.lng-r.center.lng)>180;){const t=r.locationToScreenPoint(e);if(t.x>=0&&t.y>=0&&t.x<=r.width&&t.y<=r.height)break;e.lng>r.center.lng?e.lng-=360:e.lng+=360}return e.lng!==n.lng&&r.isPointOnMapSurface(r.locationToScreenPoint(e))?e:n}const jo={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function No(e,t,i){const r=e.classList;for(const e in jo)r.remove(`maplibregl-${i}-anchor-${e}`);r.add(`maplibregl-${i}-anchor-${t}`)}class $o extends t.E{constructor(e){if(super(),this._onKeyPress=e=>{const t=e.code,i=e.charCode||e.keyCode;"Space"!==t&&"Enter"!==t&&32!==i&&13!==i||this.togglePopup()},this._onMapClick=e=>{const t=e.originalEvent.target,i=this._element;this._popup&&(t===i||i.contains(t))&&this.togglePopup()},this._update=e=>{var t;if(!this._map)return;const i=this._map.loaded()&&!this._map.isMoving();("terrain"===(null==e?void 0:e.type)||"render"===(null==e?void 0:e.type)&&!i)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?Oo(this._lngLat,this._flatPos,this._map.transform):null===(t=this._lngLat)||void 0===t?void 0:t.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let r="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?r=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(r=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let n="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?n="rotateX(0deg)":"map"===this._pitchAlignment&&(n=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||e&&"moveend"!==e.type||(this._pos=this._pos.round()),s.setTransform(this._element,`${jo[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${n} ${r}`),a.frameAsync(new AbortController).then((()=>{this._updateOpacity(e&&"moveend"===e.type)})).catch((()=>{}))},this._onMove=e=>{if(!this._isDragging){const t=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=t}this._isDragging&&(this._pos=e.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new t.l("dragstart"))),this.fire(new t.l("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new t.l("dragend")),this._state="inactive"},this._addDragHandler=e=>{this._element.contains(e.originalEvent.target)&&(e.preventDefault(),this._positionDelta=e.point.sub(this._pos).add(this._offset),this._pointerdownPos=e.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._subpixelPositioning=e&&e.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&"auto"!==e.pitchAlignment?e.pitchAlignment:this._rotationAlignment,this.setOpacity(null==e?void 0:e.opacity,null==e?void 0:e.opacityWhenCovered),e&&e.element)this._element=e.element,this._offset=t.P.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=s.create("div");const i=s.createNS("http://www.w3.org/2000/svg","svg"),r=41,n=27;i.setAttributeNS(null,"display","block"),i.setAttributeNS(null,"height",`${r}px`),i.setAttributeNS(null,"width",`${n}px`),i.setAttributeNS(null,"viewBox",`0 0 ${n} ${r}`);const o=s.createNS("http://www.w3.org/2000/svg","g");o.setAttributeNS(null,"stroke","none"),o.setAttributeNS(null,"stroke-width","1"),o.setAttributeNS(null,"fill","none"),o.setAttributeNS(null,"fill-rule","evenodd");const a=s.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"fill-rule","nonzero");const l=s.createNS("http://www.w3.org/2000/svg","g");l.setAttributeNS(null,"transform","translate(3.0, 29.0)"),l.setAttributeNS(null,"fill","#000000");const c=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const e of c){const t=s.createNS("http://www.w3.org/2000/svg","ellipse");t.setAttributeNS(null,"opacity","0.04"),t.setAttributeNS(null,"cx","10.5"),t.setAttributeNS(null,"cy","5.80029008"),t.setAttributeNS(null,"rx",e.rx),t.setAttributeNS(null,"ry",e.ry),l.appendChild(t)}const u=s.createNS("http://www.w3.org/2000/svg","g");u.setAttributeNS(null,"fill",this._color);const h=s.createNS("http://www.w3.org/2000/svg","path");h.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),u.appendChild(h);const p=s.createNS("http://www.w3.org/2000/svg","g");p.setAttributeNS(null,"opacity","0.25"),p.setAttributeNS(null,"fill","#000000");const d=s.createNS("http://www.w3.org/2000/svg","path");d.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),p.appendChild(d);const m=s.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"transform","translate(6.0, 7.0)"),m.setAttributeNS(null,"fill","#FFFFFF");const f=s.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"transform","translate(8.0, 8.0)");const g=s.createNS("http://www.w3.org/2000/svg","circle");g.setAttributeNS(null,"fill","#000000"),g.setAttributeNS(null,"opacity","0.25"),g.setAttributeNS(null,"cx","5.5"),g.setAttributeNS(null,"cy","5.5"),g.setAttributeNS(null,"r","5.4999962");const y=s.createNS("http://www.w3.org/2000/svg","circle");y.setAttributeNS(null,"fill","#FFFFFF"),y.setAttributeNS(null,"cx","5.5"),y.setAttributeNS(null,"cy","5.5"),y.setAttributeNS(null,"r","5.4999962"),f.appendChild(g),f.appendChild(y),a.appendChild(l),a.appendChild(u),a.appendChild(p),a.appendChild(m),a.appendChild(f),i.appendChild(a),i.setAttributeNS(null,"height",r*this._scale+"px"),i.setAttributeNS(null,"width",n*this._scale+"px"),this._element.appendChild(i),this._offset=t.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",(e=>{e.preventDefault()})),this._element.addEventListener("mousedown",(e=>{e.preventDefault()})),No(this._element,this._anchor,"marker"),e&&e.className)for(const t of e.className.split(" "))this._element.classList.add(t);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),e.on("projectiontransition",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),s.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.Q.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,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,r=Math.abs(i)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[r,-1*(t-i+r)],"bottom-right":[-r,-1*(t-i+r)],left:[i,-1*(t-i)],right:[-13.5,-1*(t-i)]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){const e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){var i,r;if(!(null===(i=this._map)||void 0===i?void 0:i.terrain)){const e=this._map.transform.isLocationOccluded(this._lngLat)?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==e&&(this._element.style.opacity=e))}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout((()=>{this._opacityTimeout=null}),100)}const n=this._map,o=n.terrain.depthAtPoint(this._pos),a=n.terrain.getElevationForLngLatZoom(this._lngLat,n.transform.tileZoom);if(n.transform.lngLatToCameraDepth(this._lngLat,a)-o<.006)return void(this._element.style.opacity=this._opacity);const s=-this._offset.y/n.transform.pixelsPerMeter,l=Math.sin(n.getPitch()*Math.PI/180)*s,c=n.terrain.depthAtPoint(new t.P(this._pos.x,this._pos.y-this._offset.y)),u=n.transform.lngLatToCameraDepth(this._lngLat,a+l)-c>.006;(null===(r=this._popup)||void 0===r?void 0:r.isOpen())&&u&&this._popup.remove(),this._element.style.opacity=u?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(e){return this._offset=t.P.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&"auto"!==e?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,t){return(void 0===this._opacity||void 0===e&&void 0===t)&&(this._opacity="1",this._opacityWhenCovered="0.2"),void 0!==e&&(this._opacity=e),void 0!==t&&(this._opacityWhenCovered=t),this._map&&this._updateOpacity(!0),this}}const Vo={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Uo=0,qo=!1;const Zo={maxWidth:100,unit:"metric"};function Go(e,t,i){const r=i&&i.maxWidth||100,n=e._container.clientHeight/2,o=e._container.clientWidth/2,a=e.unproject([o-r/2,n]),s=e.unproject([o+r/2,n]),l=Math.round(e.project(s).x-e.project(a).x),c=Math.min(r,l,e._container.clientWidth),u=a.distanceTo(s);if(i&&"imperial"===i.unit){const i=3.2808*u;i>5280?Ho(t,c,i/5280,e._getUIString("ScaleControl.Miles")):Ho(t,c,i,e._getUIString("ScaleControl.Feet"))}else i&&"nautical"===i.unit?Ho(t,c,u/1852,e._getUIString("ScaleControl.NauticalMiles")):u>=1e3?Ho(t,c,u/1e3,e._getUIString("ScaleControl.Kilometers")):Ho(t,c,u,e._getUIString("ScaleControl.Meters"))}function Ho(e,t,i,r){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}(i);e.style.width=t*(n/i)+"px",e.innerHTML=`${n}&nbsp;${r}`}const Wo={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0},Ko=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Xo(e){if(e){if("number"==typeof e){const i=Math.round(Math.abs(e)/Math.SQRT2);return{center:new t.P(0,0),top:new t.P(0,e),"top-left":new t.P(i,i),"top-right":new t.P(-i,i),bottom:new t.P(0,-e),"bottom-left":new t.P(i,-i),"bottom-right":new t.P(-i,-i),left:new t.P(e,0),right:new t.P(-e,0)}}if(e instanceof t.P||Array.isArray(e)){const i=t.P.convert(e);return{center:i,top:i,"top-left":i,"top-right":i,bottom:i,"bottom-left":i,"bottom-right":i,left:i,right:i}}return{center:t.P.convert(e.center||[0,0]),top:t.P.convert(e.top||[0,0]),"top-left":t.P.convert(e["top-left"]||[0,0]),"top-right":t.P.convert(e["top-right"]||[0,0]),bottom:t.P.convert(e.bottom||[0,0]),"bottom-left":t.P.convert(e["bottom-left"]||[0,0]),"bottom-right":t.P.convert(e["bottom-right"]||[0,0]),left:t.P.convert(e.left||[0,0]),right:t.P.convert(e.right||[0,0])}}return Xo(new t.P(0,0))}const Yo=i;e.AJAXError=t.cm,e.Event=t.l,e.Evented=t.E,e.LngLat=t.Q,e.MercatorCoordinate=t.$,e.Point=t.P,e.addProtocol=t.cn,e.config=t.a,e.removeProtocol=t.co,e.AttributionControl=Co,e.BoxZoomHandler=On,e.CanvasSource=J,e.CooperativeGesturesHandler=go,e.DoubleClickZoomHandler=co,e.DragPanHandler=po,e.DragRotateHandler=mo,e.EdgeInsets=Tt,e.FullscreenControl=class extends t.E{constructor(e={}){super(),this._onFullscreenChange=()=>{var e;let t=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;null===(e=null==t?void 0:t.shadowRoot)||void 0===e?void 0:e.fullscreenElement;)t=t.shadowRoot.fullscreenElement;t===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,e&&e.container&&(e.container instanceof HTMLElement?this._container=e.container:t.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=s.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){s.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const e=this._fullscreenButton=s.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);s.create("span","maplibregl-ctrl-icon",e).setAttribute("aria-hidden","true"),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const e=this._getTitle();this._fullscreenButton.setAttribute("aria-label",e),this._fullscreenButton.title=e}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new t.l("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new t.l("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},e.GeoJSONSource=K,e.GeolocateControl=class extends t.E{constructor(e){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new t.l("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(e),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new t.l("geolocate",e)),this._finish()}},this._updateCamera=e=>{const i=new t.Q(e.coords.longitude,e.coords.latitude),r=e.coords.accuracy,n=this._map.getBearing(),o=t.e({bearing:n},this.options.fitBoundsOptions),a=q.fromLngLat(i,r);this._map.fitBounds(a,o,{geolocateSource:!0})},this._updateMarker=e=>{if(e){const i=new t.Q(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=e=>{if(this._map){if(this.options.trackUserLocation)if(1===e.code){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===e.code&&qo)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new t.l("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",(e=>e.preventDefault())),this._geolocateButton=s.create("button","maplibregl-ctrl-geolocate",this._container),s.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(!1===e){t.w("Geolocation support is not available so the GeolocateControl will be disabled.");const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}else{const e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=s.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new $o({element:this._dotElement}),this._circleElement=s.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new $o({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",(()=>this.trigger())),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(e=>{e.geolocateSource||"ACTIVE_LOCK"!==this._watchState||e.originalEvent&&"resize"===e.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new t.l("trackuserlocationend")),this.fire(new t.l("userlocationlostfocus")))}))}},this.options=t.e({},Vo,e)}onAdd(e){return this._map=e,this._container=s.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return t._(this,arguments,void 0,(function*(e=!1){if(void 0!==Bo&&!e)return Bo;if(void 0===window.navigator.permissions)return Bo=!!window.navigator.geolocation,Bo;try{const e=yield window.navigator.permissions.query({name:"geolocation"});Bo="denied"!==e.state}catch(e){Bo=!!window.navigator.geolocation}return Bo}))}().then((e=>this._finishSetupUI(e))),this._container}onRemove(){void 0!==this._geolocationWatchID&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),s.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Uo=0,qo=!1}_isOutOfMapMaxBounds(e){const t=this._map.getMaxBounds(),i=e.coords;return t&&(i.longitude<t.getWest()||i.longitude>t.getEast()||i.latitude<t.getSouth()||i.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const e=this._map.getBounds(),t=e.getSouthEast(),i=e.getNorthEast(),r=t.distanceTo(i),n=Math.ceil(this._accuracy/(r/this._map._container.clientHeight)*2);this._circleElement.style.width=`${n}px`,this._circleElement.style.height=`${n}px`}trigger(){if(!this._setup)return t.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new t.l("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Uo--,qo=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new t.l("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new t.l("trackuserlocationstart")),this.fire(new t.l("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let e;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Uo++,Uo>1?(e={maximumAge:6e5,timeout:0},qo=!0):(e=this.options.positionOptions,qo=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},e.GlobeControl=class{constructor(){this._toggleProjection=()=>{var e;const t=null===(e=this._map.getProjection())||void 0===e?void 0:e.type;this._map.setProjection("mercator"!==t&&t?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var e;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),"globe"===(null===(e=this._map.getProjection())||void 0===e?void 0:e.type)?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(e){return this._map=e,this._container=s.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=s.create("button","maplibregl-ctrl-globe",this._container),s.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._container}onRemove(){s.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},e.Hash=wn,e.ImageSource=X,e.KeyboardHandler=oo,e.LngLatBounds=q,e.LogoControl=To,e.Map=class extends bo{constructor(e){var i,r;t.cj.mark(t.ck.create);const n=Object.assign(Object.assign(Object.assign({},Do),e),{canvasContextAttributes:Object.assign(Object.assign({},Do.canvasContextAttributes),e.canvasContextAttributes)});if(null!=n.minZoom&&null!=n.maxZoom&&n.minZoom>n.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=n.minPitch&&null!=n.maxPitch&&n.minPitch>n.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=n.minPitch&&n.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=n.maxPitch&&n.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const o=new kt,a=new Ft;if(void 0!==n.minZoom&&o.setMinZoom(n.minZoom),void 0!==n.maxZoom&&o.setMaxZoom(n.maxZoom),void 0!==n.minPitch&&o.setMinPitch(n.minPitch),void 0!==n.maxPitch&&o.setMaxPitch(n.maxPitch),void 0!==n.renderWorldCopies&&o.setRenderWorldCopies(n.renderWorldCopies),super(o,a,{bearingSnap:n.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new So,this._controls=[],this._mapId=t.a4(),this._contextLost=e=>{e.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new t.l("webglcontextlost",{originalEvent:e}))},this._contextRestored=e=>{this._setupPainter(),this.resize(),this._update(),this.fire(new t.l("webglcontextrestored",{originalEvent:e}))},this._onMapScroll=e=>{if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=n.interactive,this._maxTileCacheSize=n.maxTileCacheSize,this._maxTileCacheZoomLevels=n.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},n.canvasContextAttributes),this._trackResize=!0===n.trackResize,this._bearingSnap=n.bearingSnap,this._centerClampedToGround=n.centerClampedToGround,this._refreshExpiredTiles=!0===n.refreshExpiredTiles,this._fadeDuration=n.fadeDuration,this._crossSourceCollisions=!0===n.crossSourceCollisions,this._collectResourceTiming=!0===n.collectResourceTiming,this._locale=Object.assign(Object.assign({},zo),n.locale),this._clickTolerance=n.clickTolerance,this._overridePixelRatio=n.pixelRatio,this._maxCanvasSize=n.maxCanvasSize,this.transformCameraUpdate=n.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=!0===n.cancelPendingTileRequestsWhileZooming,this._imageQueueHandle=m.addThrottleControl((()=>this.isMoving())),this._requestManager=new f(n.transformRequest),"string"==typeof n.container){if(this._container=document.getElementById(n.container),!this._container)throw new Error(`Container '${n.container}' not found.`)}else{if(!(n.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=n.container}if(n.maxBounds&&this.setMaxBounds(n.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",(()=>this._update(!1))),this.on("moveend",(()=>this._update(!1))),this.on("zoom",(()=>this._update(!0))),this.on("terrain",(()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)})),this.once("idle",(()=>{this._idleTriggered=!0})),"undefined"!=typeof window){addEventListener("online",this._onWindowOnline,!1);let e=!1;const t=bn((e=>{this._trackResize&&!this._removed&&(this.resize(e),this.redraw())}),50);this._resizeObserver=new ResizeObserver((i=>{e?t(i):e=!0})),this._resizeObserver.observe(this._container)}this.handlers=new xo(this,n),this._hash=n.hash&&new wn("string"==typeof n.hash&&n.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:n.center,elevation:n.elevation,zoom:n.zoom,bearing:n.bearing,pitch:n.pitch,roll:n.roll}),n.bounds&&(this.resize(),this.fitBounds(n.bounds,t.e({},n.fitBoundsOptions,{duration:0}))));const s="string"==typeof n.style||!("globe"===(null===(r=null===(i=n.style)||void 0===i?void 0:i.projection)||void 0===r?void 0:r.type));this.resize(null,s),this._localIdeographFontFamily=n.localIdeographFontFamily,this._validateStyle=n.validateStyle,n.style&&this.setStyle(n.style,{localIdeographFontFamily:n.localIdeographFontFamily}),n.attributionControl&&this.addControl(new Co("boolean"==typeof n.attributionControl?void 0:n.attributionControl)),n.maplibreLogo&&this.addControl(new To,n.logoPosition),this.on("style.load",(()=>{if(s||this._resizeTransform(),this.transform.unmodified){const e=t.O(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(e)}})),this.on("data",(e=>{this._update("style"===e.dataType),this.fire(new t.l(`${e.dataType}data`,e))})),this.on("dataloading",(e=>{this.fire(new t.l(`${e.dataType}dataloading`,e))})),this.on("dataabort",(e=>{this.fire(new t.l("sourcedataabort",e))}))}_getMapId(){return this._mapId}addControl(e,i){if(void 0===i&&(i=e.getDefaultPosition?e.getDefaultPosition():"top-right"),!e||!e.onAdd)return this.fire(new t.k(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const r=e.onAdd(this);this._controls.push(e);const n=this._controlPositions[i];return-1!==i.indexOf("bottom")?n.insertBefore(r,n.firstChild):n.appendChild(r),this}removeControl(e){if(!e||!e.onRemove)return this.fire(new t.k(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const i=this._controls.indexOf(e);return i>-1&&this._controls.splice(i,1),e.onRemove(this),this}hasControl(e){return this._controls.indexOf(e)>-1}calculateCameraOptionsFromTo(e,t,i,r){return null==r&&this.terrain&&(r=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(e,t,i,r)}resize(e,i=!0){const[r,n]=this._containerDimensions(),o=this._getClampedPixelRatio(r,n);if(this._resizeCanvas(r,n,o),this.painter.resize(r,n,o),this.painter.overLimit()){const e=this.painter.context.gl;this._maxCanvasSize=[e.drawingBufferWidth,e.drawingBufferHeight];const t=this._getClampedPixelRatio(r,n);this._resizeCanvas(r,n,t),this.painter.resize(r,n,t)}this._resizeTransform(i);const a=!this._moving;return a&&(this.stop(),this.fire(new t.l("movestart",e)).fire(new t.l("move",e))),this.fire(new t.l("resize",e)),a&&this.fire(new t.l("moveend",e)),this}_resizeTransform(e=!0){var t;const[i,r]=this._containerDimensions();this.transform.resize(i,r,e),null===(t=this._requestedCameraState)||void 0===t||t.resize(i,r,e)}_getClampedPixelRatio(e,t){const{0:i,1:r}=this._maxCanvasSize,n=this.getPixelRatio(),o=e*n,a=t*n;return Math.min(o>i?i/o:1,a>r?r/a:1)*n}getPixelRatio(){var e;return null!==(e=this._overridePixelRatio)&&void 0!==e?e:devicePixelRatio}setPixelRatio(e){this._overridePixelRatio=e,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(e){return this.transform.setMaxBounds(q.convert(e)),this._update()}setMinZoom(e){if((e=null==e?-2:e)>=-2&&e<=this.transform.maxZoom)return this.transform.setMinZoom(e),this._update(),this.getZoom()<e&&this.setZoom(e),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(e){if((e=null==e?22:e)>=this.transform.minZoom)return this.transform.setMaxZoom(e),this._update(),this.getZoom()>e&&this.setZoom(e),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(e){if((e=null==e?0:e)<0)throw new Error("minPitch must be greater than or equal to 0");if(e>=0&&e<=this.transform.maxPitch)return this.transform.setMinPitch(e),this._update(),this.getPitch()<e&&this.setPitch(e),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(e){if((e=null==e?60:e)>180)throw new Error("maxPitch must be less than or equal to 180");if(e>=this.transform.minPitch)return this.transform.setMaxPitch(e),this._update(),this.getPitch()>e&&this.setPitch(e),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.setRenderWorldCopies(e),this._update()}project(e){return this.transform.locationToScreenPoint(t.Q.convert(e),this.style&&this.terrain)}unproject(e){return this.transform.screenPointToLocation(t.P.convert(e),this.terrain)}isMoving(){var e;return this._moving||(null===(e=this.handlers)||void 0===e?void 0:e.isMoving())}isZooming(){var e;return this._zooming||(null===(e=this.handlers)||void 0===e?void 0:e.isZooming())}isRotating(){var e;return this._rotating||(null===(e=this.handlers)||void 0===e?void 0:e.isRotating())}_createDelegatedListener(e,t,i){if("mouseenter"===e||"mouseover"===e){let r=!1;const n=n=>{const o=t.filter((e=>this.getLayer(e))),a=0!==o.length?this.queryRenderedFeatures(n.point,{layers:o}):[];a.length?r||(r=!0,i.call(this,new zn(e,this,n.originalEvent,{features:a}))):r=!1};return{layers:t,listener:i,delegates:{mousemove:n,mouseout:()=>{r=!1}}}}if("mouseleave"===e||"mouseout"===e){let r=!1;const n=n=>{const o=t.filter((e=>this.getLayer(e)));(0!==o.length?this.queryRenderedFeatures(n.point,{layers:o}):[]).length?r=!0:r&&(r=!1,i.call(this,new zn(e,this,n.originalEvent)))},o=t=>{r&&(r=!1,i.call(this,new zn(e,this,t.originalEvent)))};return{layers:t,listener:i,delegates:{mousemove:n,mouseout:o}}}{const r=e=>{const r=t.filter((e=>this.getLayer(e))),n=0!==r.length?this.queryRenderedFeatures(e.point,{layers:r}):[];n.length&&(e.features=n,i.call(this,e),delete e.features)};return{layers:t,listener:i,delegates:{[e]:r}}}}_saveDelegatedListener(e,t){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(t)}_removeDelegatedListener(e,t,i){if(!this._delegatedListeners||!this._delegatedListeners[e])return;const r=this._delegatedListeners[e];for(let e=0;e<r.length;e++){const n=r[e];if(n.listener===i&&n.layers.length===t.length&&n.layers.every((e=>t.includes(e)))){for(const e in n.delegates)this.off(e,n.delegates[e]);return void r.splice(e,1)}}}on(e,t,i){if(void 0===i)return super.on(e,t);const r="string"==typeof t?[t]:t,n=this._createDelegatedListener(e,r,i);this._saveDelegatedListener(e,n);for(const e in n.delegates)this.on(e,n.delegates[e]);return{unsubscribe:()=>{this._removeDelegatedListener(e,r,i)}}}once(e,t,i){if(void 0===i)return super.once(e,t);const r="string"==typeof t?[t]:t,n=this._createDelegatedListener(e,r,i);for(const t in n.delegates){const o=n.delegates[t];n.delegates[t]=(...t)=>{this._removeDelegatedListener(e,r,i),o(...t)}}this._saveDelegatedListener(e,n);for(const e in n.delegates)this.once(e,n.delegates[e]);return this}off(e,t,i){return void 0===i?super.off(e,t):(this._removeDelegatedListener(e,"string"==typeof t?[t]:t,i),this)}queryRenderedFeatures(e,i){if(!this.style)return[];let r;const n=e instanceof t.P||Array.isArray(e),o=n?e:[[0,0],[this.transform.width,this.transform.height]];if(i=i||(n?{}:e)||{},o instanceof t.P||"number"==typeof o[0])r=[t.P.convert(o)];else{const e=t.P.convert(o[0]),i=t.P.convert(o[1]);r=[e,new t.P(i.x,e.y),i,new t.P(e.x,i.y),e]}return this.style.queryRenderedFeatures(r,i,this.transform)}querySourceFeatures(e,t){return this.style.querySourceFeatures(e,t)}setStyle(e,i){return!1!==(i=t.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},i)).diff&&i.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,i),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._updateStyle(e,i))}setTransformRequest(e){return this._requestManager.setTransformRequest(e),this}_getUIString(e){const t=this._locale[e];if(null==t)throw new Error(`Missing UI string '${e}'`);return t}_updateStyle(e,t){var i,r;if(t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",(()=>this._updateStyle(e,t)));const n=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!e)),e?(this.style=new yi(this,t||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof e?this.style.loadURL(e,t,n):this.style.loadJSON(e,t,n),this):(null===(r=null===(i=this.style)||void 0===i?void 0:i.projection)||void 0===r||r.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new yi(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(e,i){if("string"==typeof e){const r=this._requestManager.transformRequest(e,"Style");t.j(r,new AbortController).then((e=>{this._updateDiff(e.data,i)})).catch((e=>{e&&this.fire(new t.k(e))}))}else"object"==typeof e&&this._updateDiff(e,i)}_updateDiff(e,i){try{this.style.setState(e,i)&&this._update(!0)}catch(r){t.w(`Unable to perform style diff: ${r.message||r.error||r}. Rebuilding the style from scratch.`),this._updateStyle(e,i)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():t.w("There is no style added to the map.")}addSource(e,t){return this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)}isSourceLoaded(e){const i=this.style&&this.style.sourceCaches[e];if(void 0!==i)return i.loaded();this.fire(new t.k(new Error(`There is no source with ID '${e}'`)))}setTerrain(e){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),e){const i=this.style.sourceCaches[e.source];if(!i)throw new Error(`cannot load terrain, because there exists no source with ID: ${e.source}`);null===this.terrain&&i.reload();for(const i in this.style._layers){const r=this.style._layers[i];"hillshade"===r.type&&r.source===e.source&&t.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new Eo(this.painter,i,e),this.painter.renderToTexture=new ko(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=t=>{var i;"style"===t.dataType?this.terrain.sourceCache.freeRtt():"source"===t.dataType&&t.tile&&(t.sourceId!==e.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),"image"===(null===(i=t.source)||void 0===i?void 0:i.type)?this.terrain.sourceCache.freeRtt():this.terrain.sourceCache.freeRtt(t.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new t.l("terrain",{terrain:e})),this}getTerrain(){var e,t;return null!==(t=null===(e=this.terrain)||void 0===e?void 0:e.options)&&void 0!==t?t:null}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}removeSource(e){return this.style.removeSource(e),this._update(!0)}getSource(e){return this.style.getSource(e)}addImage(e,i,r={}){const{pixelRatio:n=1,sdf:o=!1,stretchX:s,stretchY:l,content:c,textFitWidth:u,textFitHeight:h}=r;if(this._lazyInitEmptyStyle(),!(i instanceof HTMLImageElement||t.b(i))){if(void 0===i.width||void 0===i.height)return this.fire(new t.k(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:r,height:a,data:p}=i,d=i;return this.style.addImage(e,{data:new t.R({width:r,height:a},new Uint8Array(p)),pixelRatio:n,stretchX:s,stretchY:l,content:c,textFitWidth:u,textFitHeight:h,sdf:o,version:0,userImage:d}),d.onAdd&&d.onAdd(this,e),this}}{const{width:r,height:p,data:d}=a.getImageData(i);this.style.addImage(e,{data:new t.R({width:r,height:p},d),pixelRatio:n,stretchX:s,stretchY:l,content:c,textFitWidth:u,textFitHeight:h,sdf:o,version:0})}}updateImage(e,i){const r=this.style.getImage(e);if(!r)return this.fire(new t.k(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const n=i instanceof HTMLImageElement||t.b(i)?a.getImageData(i):i,{width:o,height:s,data:l}=n;if(void 0===o||void 0===s)return this.fire(new t.k(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(o!==r.data.width||s!==r.data.height)return this.fire(new t.k(new Error("The width and height of the updated image must be that same as the previous version of the image")));const c=!(i instanceof HTMLImageElement||t.b(i));return r.data.replace(l,c),this.style.updateImage(e,r),this}getImage(e){return this.style.getImage(e)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new t.k(new Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}loadImage(e){return m.getImage(this._requestManager.transformRequest(e,"Image"),new AbortController)}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)}getLayersOrder(){return this.style.getLayersOrder()}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,r={}){return this.style.setPaintProperty(e,t,i,r),this._update(!0)}getPaintProperty(e,t){return this.style.getPaintProperty(e,t)}setLayoutProperty(e,t,i,r={}){return this.style.setLayoutProperty(e,t,i,r),this._update(!0)}getLayoutProperty(e,t){return this.style.getLayoutProperty(e,t)}setGlyphs(e,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(e,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(e,t,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(e,t,i,(e=>{e||this._update(!0)})),this}removeSprite(e){return this._lazyInitEmptyStyle(),this.style.removeSprite(e),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(e,t,(e=>{e||this._update(!0)})),this}setLight(e,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(e,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSky(e,t),this._update(!0)}getSky(){return this.style.getSky()}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)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let e=0,t=0;return this._container&&(e=this._container.clientWidth||400,t=this._container.clientHeight||300),[e,t]}_setupContainer(){const e=this._container;e.classList.add("maplibregl-map");const t=this._canvasContainer=s.create("div","maplibregl-canvas-container",e);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=s.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const i=this._containerDimensions(),r=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],r);const n=this._controlContainer=s.create("div","maplibregl-control-container",e),o=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((e=>{o[e]=s.create("div",`maplibregl-ctrl-${e} `,n)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(e,t,i){this._canvas.width=Math.floor(i*e),this._canvas.height=Math.floor(i*t),this._canvas.style.width=`${e}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const e=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let t=null;this._canvas.addEventListener("webglcontextcreationerror",(i=>{t={requestedAttributes:e},i&&(t.statusMessage=i.statusMessage,t.type=i.type)}),{once:!0});let i=null;if(i=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,e):this._canvas.getContext("webgl2",e)||this._canvas.getContext("webgl",e),!i){const e="Failed to initialize WebGL";throw t?(t.message=e,new Error(JSON.stringify(t))):new Error(e)}this.painter=new xn(i,this.transform),l.testSupport(i)}migrateProjection(e,i){super.migrateProjection(e,i),this.painter.transform=e,this.fire(new t.l("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){return this.style&&this.style._loaded?(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)}_render(e){var i,r,n,o,s;const l=this._idleTriggered?this._fadeDuration:0,c=(null===(i=this.style.projection)||void 0===i?void 0:i.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let u=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const e=this.transform.zoom,i=a.now();this.style.zoomHistory.update(e,i);const r=new t.C(e,{now:i,fadeDuration:l,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),n=r.crossFadingFactor();1===n&&n===this._crossFadingFactor||(u=!0,this._crossFadingFactor=n),this.style.update(r)}const h=(null===(r=this.style.projection)||void 0===r?void 0:r.transitionState)>0!==c;null===(n=this.style.projection)||void 0===n||n.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState(null===(o=this.style.projection)||void 0===o?void 0:o.transitionState,null===(s=this.style.projection)||void 0===s?void 0:s.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||h)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,l,this._crossSourceCollisions,h),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:l,showPadding:this.showPadding}),this.fire(new t.l("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,t.cj.mark(t.ck.load),this.fire(new t.l("load"))),this.style&&(this.style.hasTransitions()||u)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const p=this._sourcesDirty||this._styleDirty||this._placementDirty;return p||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new t.l("idle")),!this._loaded||this._fullyLoaded||p||(this._fullyLoaded=!0,t.cj.mark(t.ck.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var e;this._hash&&this._hash.remove();for(const e of this._controls)e.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),"undefined"!=typeof window&&removeEventListener("online",this._onWindowOnline,!1),m.removeThrottleControl(this._imageQueueHandle),null===(e=this._resizeObserver)||void 0===e||e.disconnect();const i=this.painter.context.gl.getExtension("WEBGL_lose_context");(null==i?void 0:i.loseContext)&&i.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),s.remove(this._canvasContainer),s.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),t.cj.clearMetrics(),this._removed=!0,this.fire(new t.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,a.frame(this._frameRequest,(e=>{t.cj.frame(e),this._frameRequest=null;try{this._render(e)}catch(e){if(!t.cl(e)&&!function(e){return e.message===jr}(e))throw e}}),(()=>{})))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=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 version(){return Lo}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(e){return this._lazyInitEmptyStyle(),this.style.setProjection(e),this._update(!0)}},e.MapMouseEvent=zn,e.MapTouchEvent=Ln,e.MapWheelEvent=Dn,e.Marker=$o,e.NavigationControl=class{constructor(e){this._updateZoomButtons=()=>{const e=this._map.getZoom(),t=e===this._map.getMaxZoom(),i=e===this._map.getMinZoom();this._zoomInButton.disabled=t,this._zoomOutButton.disabled=i,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",i.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(e,t)=>{const i=this._map._getUIString(`NavigationControl.${t}`);e.title=i,e.setAttribute("aria-label",i)},this.options=t.e({},Fo,e),this._container=s.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",(e=>e.preventDefault())),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",(e=>this._map.zoomIn({},{originalEvent:e}))),s.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",(e=>this._map.zoomOut({},{originalEvent:e}))),s.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",(e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})})),this._compassIcon=s.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(e){return this._map=e,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Ro(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){s.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(e,t){const i=s.create("button",e,this._container);return i.type="button",i.addEventListener("click",t),i}},e.Popup=class extends t.E{constructor(e){super(),this._updateOpacity=()=>{void 0!==this.options.locationOccludedOpacity&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:void 0)},this.remove=()=>(this._content&&s.remove(this._content),this._container&&(s.remove(this._container),delete this._container),this._closeButton&&this._closeButton.removeEventListener("click",this._onClose),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new t.l("close"))),this),this._onMouseUp=e=>{this._update(e.point)},this._onMouseMove=e=>{this._update(e.point)},this._onDrag=e=>{this._update(e.point)},this._update=e=>{var t;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=s.create("div","maplibregl-popup",this._map.getContainer()),this._tip=s.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const e of this.options.className.split(" "))this._container.classList.add(e);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?Oo(this._lngLat,this._flatPos,this._map.transform):null===(t=this._lngLat)||void 0===t?void 0:t.wrap(),this._trackPointer&&!e)return;const i=this._flatPos=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&e?e:this._map.transform.locationToScreenPoint(this._lngLat));let r=this.options.anchor;const n=Xo(this.options.offset);if(!r){const e=this._container.offsetWidth,t=this._container.offsetHeight;let o;o=i.y+n.bottom.y<t?["top"]:i.y>this._map.transform.height-t?["bottom"]:[],i.x<e/2?o.push("left"):i.x>this._map.transform.width-e/2&&o.push("right"),r=0===o.length?"bottom":o.join("-")}let o=i.add(n[r]);this.options.subpixelPositioning||(o=o.round()),s.setTransform(this._container,`${jo[r]} translate(${o.x}px,${o.y}px)`),No(this._container,r,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=t.e(Object.create(Wo),e)}addTo(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new t.l("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.Q.convert(e),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(e){return this.setDOMContent(document.createTextNode(e))}setHTML(e){const t=document.createDocumentFragment(),i=document.createElement("body");let r;for(i.innerHTML=e;r=i.firstChild,r;)t.appendChild(r);return this.setDOMContent(t)}getMaxWidth(){var e;return null===(e=this._container)||void 0===e?void 0:e.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=s.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(e),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(e){return this._container&&this._container.classList.add(e),this}removeClassName(e){return this._container&&this._container.classList.remove(e),this}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){if(this._container)return this._container.classList.toggle(e)}setSubpixelPositioning(e){this.options.subpixelPositioning=e}_createCloseButton(){this.options.closeButton&&(this._closeButton=s.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const e=this._container.querySelector(Ko);e&&e.focus()}},e.RasterDEMTileSource=W,e.RasterTileSource=H,e.ScaleControl=class{constructor(e){this._onMove=()=>{Go(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,Go(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Zo),e)}getDefaultPosition(){return"bottom-left"}onAdd(e){return this._map=e,this._container=s.create("div","maplibregl-ctrl maplibregl-ctrl-scale",e.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){s.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},e.ScrollZoomHandler=lo,e.Style=yi,e.TerrainControl=class{constructor(e){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=e}onAdd(e){return this._map=e,this._container=s.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=s.create("button","maplibregl-ctrl-terrain",this._container),s.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){s.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},e.TwoFingersTouchPitchHandler=ro,e.TwoFingersTouchRotateHandler=to,e.TwoFingersTouchZoomHandler=Qn,e.TwoFingersTouchZoomRotateHandler=fo,e.VectorTileSource=G,e.VideoSource=Y,e.addSourceType=(e,i)=>t._(void 0,void 0,void 0,(function*(){if(ee(e))throw new Error(`A source type called "${e}" already exists.`);((e,t)=>{Q[e]=t})(e,i)})),e.clearPrewarmedResources=function(){const e=D;e&&(e.isPreloaded()&&1===e.numActive()?(e.release(k),D=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()"))},e.createTileMesh=Gt,e.getMaxParallelImageRequests=function(){return t.a.MAX_PARALLEL_IMAGE_REQUESTS},e.getRTLTextPluginStatus=function(){return ne().getRTLTextPluginStatus()},e.getVersion=function(){return Yo},e.getWorkerCount=function(){return z.workerCount},e.getWorkerUrl=function(){return t.a.WORKER_URL},e.importScriptInWorkers=function(e){return O().broadcast("IS",e)},e.prewarm=function(){R().acquire(k)},e.setMaxParallelImageRequests=function(e){t.a.MAX_PARALLEL_IMAGE_REQUESTS=e},e.setRTLTextPlugin=function(e,t){return ne().setRTLTextPlugin(e,t)},e.setWorkerCount=function(e){z.workerCount=e},e.setWorkerUrl=function(e){t.a.WORKER_URL=e}})),e}()),At.exports}var Pt=Et(),It=Tt(Pt);function kt(){return"undefined"!=typeof self?fetch.bind(self):"undefined"!=typeof global&&global.fetch?global.fetch:null}class zt{constructor(){this._apiKey="",this._fetch=kt(),this.tileCacheSize=200}set apiKey(e){this._apiKey=e}get apiKey(){return this._apiKey}set fetch(e){this._fetch=e}get fetch(){return this._fetch}}const Lt=new zt,Dt={AUTO:{code:null,flag:"auto",name:"Auto",latin:!1,isMode:!0,geocoding:!0},LATIN:{code:"latin",flag:"name:latin",name:"Latin",latin:!0,isMode:!1,geocoding:!1},NON_LATIN:{code:"nonlatin",flag:"name:nonlatin",name:"Non Latin",latin:!1,isMode:!1,geocoding:!1},LOCAL:{code:null,flag:"name",name:"Local",latin:!0,isMode:!1,geocoding:!1}},Ft={ALBANIAN:{code:"sq",flag:"name:sq",name:"Albanian",latin:!0,isMode:!1,geocoding:!0},AMHARIC:{code:"am",flag:"name:am",name:"Amharic",latin:!1,isMode:!1,geocoding:!1},ARABIC:{code:"ar",flag:"name:ar",name:"Arabic",latin:!1,isMode:!1,geocoding:!0},ARMENIAN:{code:"hy",flag:"name:hy",name:"Armenian",latin:!1,isMode:!1,geocoding:!0},AZERBAIJANI:{code:"az",flag:"name:az",name:"Azerbaijani",latin:!0,isMode:!1,geocoding:!0},BASQUE:{code:"eu",flag:"name:eu",name:"Basque",latin:!0,isMode:!1,geocoding:!1},BELARUSIAN:{code:"be",flag:"name:be",name:"Belarusian",latin:!1,isMode:!1,geocoding:!0},BENGALI:{code:"bn",flag:"name:bn",name:"Bengali",latin:!0,isMode:!1,geocoding:!1},BOSNIAN:{code:"bs",flag:"name:bs",name:"Bosnian",latin:!0,isMode:!1,geocoding:!0},BRETON:{code:"br",flag:"name:br",name:"Breton",latin:!0,isMode:!1,geocoding:!0},BULGARIAN:{code:"bg",flag:"bg",name:"Bulgarian",latin:!1,isMode:!1,geocoding:!0},CATALAN:{code:"ca",flag:"name:ca",name:"Catalan",latin:!0,isMode:!1,geocoding:!0},CHINESE:{code:"zh",flag:"name:zh",name:"Chinese",latin:!1,isMode:!1,geocoding:!0},TRADITIONAL_CHINESE:{code:"zh-Hant",flag:"name:zh-Hant",name:"Chinese (traditional)",latin:!1,isMode:!1,geocoding:!1},SIMPLIFIED_CHINESE:{code:"zh-Hans",flag:"name:zh-Hans",name:"Chinese (simplified)",latin:!1,isMode:!1,geocoding:!1},CORSICAN:{code:"co",flag:"name:co",name:"Corsican",latin:!0,isMode:!1,geocoding:!1},CROATIAN:{code:"hr",flag:"name:hr",name:"Croatian",latin:!0,isMode:!1,geocoding:!0},CZECH:{code:"cs",flag:"name:cs",name:"Czech",latin:!0,isMode:!1,geocoding:!0},DANISH:{code:"da",flag:"name:da",name:"Danish",latin:!0,isMode:!1,geocoding:!0},DUTCH:{code:"nl",flag:"name:nl",name:"Dutch",latin:!0,isMode:!1,geocoding:!0},GERMAN:{code:"de",flag:"name:de",name:"German",latin:!0,isMode:!1,geocoding:!0},GREEK:{code:"el",flag:"name:el",name:"Greek",latin:!1,isMode:!1,geocoding:!0},ENGLISH:{code:"en",flag:"name:en",name:"English",latin:!0,isMode:!1,geocoding:!0},ESPERANTO:{code:"eo",flag:"name:eo",name:"Esperanto",latin:!0,isMode:!1,geocoding:!0},ESTONIAN:{code:"et",flag:"name:et",name:"Estonian",latin:!0,isMode:!1,geocoding:!0},FINNISH:{code:"fi",flag:"name:fi",name:"Finnish",latin:!0,isMode:!1,geocoding:!0},FRENCH:{code:"fr",flag:"name:fr",name:"French",latin:!0,isMode:!1,geocoding:!0},FRISIAN:{code:"fy",flag:"name:fy",name:"Frisian (West)",latin:!0,isMode:!1,geocoding:!0},GEORGIAN:{code:"ka",flag:"name:ka",name:"Georgian",latin:!1,isMode:!1,geocoding:!0},HEBREW:{code:"he",flag:"name:he",name:"Hebrew",latin:!1,isMode:!1,geocoding:!0},HINDI:{code:"hi",flag:"name:hi",name:"Hindi",latin:!1,isMode:!1,geocoding:!1},HUNGARIAN:{code:"hu",flag:"name:hu",name:"Hungarian",latin:!0,isMode:!1,geocoding:!0},ICELANDIC:{code:"is",flag:"name:is",name:"Icelandic",latin:!0,isMode:!1,geocoding:!0},INDONESIAN:{code:"id",flag:"name:id",name:"Indonesian",latin:!0,isMode:!1,geocoding:!1},IRISH:{code:"ga",flag:"name:ga",name:"Irish",latin:!0,isMode:!1,geocoding:!0},ITALIAN:{code:"it",flag:"name:it",name:"Italian",latin:!0,isMode:!1,geocoding:!0},JAPANESE:{code:"ja",flag:"name:ja",name:"Japanese",latin:!1,isMode:!1,geocoding:!0},JAPANESE_HIRAGANA:{code:"ja-Hira",flag:"name:ja-Hira",name:"Japanese Hiragana form",latin:!1,isMode:!1,geocoding:!1},JAPANESE_2018:{code:"ja-Latn",flag:"name:ja-Latn",name:"Japanese (Latin 2018)",latin:!0,isMode:!1,geocoding:!1},JAPANESE_KANA:{code:"ja_kana",flag:"name:ja_kana",name:"Japanese (Kana)",latin:!1,isMode:!1,geocoding:!1},JAPANESE_LATIN:{code:"ja_rm",flag:"name:ja_rm",name:"Japanese (Latin script)",latin:!0,isMode:!1,geocoding:!1},KANNADA:{code:"kn",flag:"name:kn",name:"Kannada",latin:!0,isMode:!1,geocoding:!0},KAZAKH:{code:"kk",flag:"name:kk",name:"Kazakh",latin:!1,isMode:!1,geocoding:!0},KOREAN:{code:"ko",flag:"name:ko",name:"Korean",latin:!1,isMode:!1,geocoding:!0},KOREAN_LATIN:{code:"ko-Latn",flag:"name:ko-Latn",name:"Korean (Latin script)",latin:!0,isMode:!1,geocoding:!1},KURDISH:{code:"ku",flag:"name:ku",name:"Kurdish",latin:!0,isMode:!1,geocoding:!1},CLASSICAL_LATIN:{code:"la",flag:"name:la",name:"Latin",latin:!0,isMode:!1,geocoding:!0},LATVIAN:{code:"lv",flag:"name:lv",name:"Latvian",latin:!0,isMode:!1,geocoding:!0},LITHUANIAN:{code:"lt",flag:"name:lt",name:"Lithuanian",latin:!0,isMode:!1,geocoding:!0},LUXEMBOURGISH:{code:"lb",flag:"name:lb",name:"Luxembourgish",latin:!0,isMode:!1,geocoding:!0},MACEDONIAN:{code:"mk",flag:"name:mk",name:"Macedonian",latin:!1,isMode:!1,geocoding:!0},MALAYALAM:{code:"ml",flag:"name:ml",name:"Malayalam",latin:!1,isMode:!1,geocoding:!1},MALTESE:{code:"mt",flag:"name:mt",name:"Maltese",latin:!0,isMode:!1,geocoding:!0},NORWEGIAN:{code:"no",flag:"name:no",name:"Norwegian",latin:!0,isMode:!1,geocoding:!0},OCCITAN:{code:"oc",flag:"name:oc",name:"Occitan",latin:!0,isMode:!1,geocoding:!1},PERSIAN:{code:"fa",flag:"name:fa",name:"Persian",latin:!1,isMode:!1,geocoding:!1},POLISH:{code:"pl",flag:"name:pl",name:"Polish",latin:!0,isMode:!1,geocoding:!0},PORTUGUESE:{code:"pt",flag:"name:pt",name:"Portuguese",latin:!0,isMode:!1,geocoding:!0},PUNJABI:{code:"pa",flag:"name:pa",name:"Punjabi",latin:!1,isMode:!1,geocoding:!1},WESTERN_PUNJABI:{code:"pnb",flag:"name:pnb",name:"Western Punjabi",latin:!1,isMode:!1,geocoding:!1},ROMANIAN:{code:"ro",flag:"name:ro",name:"Romanian",latin:!0,isMode:!1,geocoding:!0},ROMANSH:{code:"rm",flag:"name:rm",name:"Romansh",latin:!0,isMode:!1,geocoding:!0},RUSSIAN:{code:"ru",flag:"name:ru",name:"Russian",latin:!1,isMode:!1,geocoding:!0},SERBIAN_CYRILLIC:{code:"sr",flag:"name:sr",name:"Serbian (Cyrillic script)",latin:!1,isMode:!1,geocoding:!0},SERBIAN_LATIN:{code:"sr-Latn",flag:"name:sr-Latn",name:"Serbian (Latin script)",latin:!0,isMode:!1,geocoding:!1},SCOTTISH_GAELIC:{code:"gd",flag:"name:gd",name:"Scottish Gaelic",latin:!0,isMode:!1,geocoding:!0},SLOVAK:{code:"sk",flag:"name:sk",name:"Slovak",latin:!0,isMode:!1,geocoding:!0},SLOVENE:{code:"sl",flag:"name:sl",name:"Slovene",latin:!0,isMode:!1,geocoding:!0},SPANISH:{code:"es",flag:"name:es",name:"Spanish",latin:!0,isMode:!1,geocoding:!0},SWEDISH:{code:"sv",flag:"name:sv",name:"Swedish",latin:!0,isMode:!1,geocoding:!0},TAMIL:{code:"ta",flag:"name:ta",name:"Tamil",latin:!1,isMode:!1,geocoding:!1},TELUGU:{code:"te",flag:"name:te",name:"Telugu",latin:!1,isMode:!1,geocoding:!1},THAI:{code:"th",flag:"name:th",name:"Thai",latin:!1,isMode:!1,geocoding:!0},TURKISH:{code:"tr",flag:"name:tr",name:"Turkish",latin:!0,isMode:!1,geocoding:!0},UKRAINIAN:{code:"uk",flag:"name:uk",name:"Ukrainian",latin:!1,isMode:!1,geocoding:!0},VIETNAMESE:{code:"vi",flag:"name:vi",name:"Vietnamese (Latin script)",latin:!0,isMode:!1,geocoding:!1},WELSH:{code:"cy",flag:"name:cy",name:"Welsh",latin:!0,isMode:!1,geocoding:!0}},Rt={...Dt,...Ft};function Bt(e,t=Rt){return e in t?e[e]:null}function Ot(e,t=Rt){for(const i of Object.values(t))if(i.code===e)return i;return null}function jt(e,t=Rt){for(const i of Object.values(t))if(i.flag===e)return i;return null}function Nt(e){return null!==e&&"object"==typeof e&&"code"in e&&"flag"in e&&"name"in e&&"latin"in e&&"isMode"in e&&"geocoding"in e&&("string"==typeof e.code||null===e.code)&&"string"==typeof e.flag&&"string"==typeof e.name&&"boolean"==typeof e.latin&&"boolean"==typeof e.isMode&&"boolean"==typeof e.geocoding}function $t(e,t=Rt){return Nt(e)?jt(e.flag,t):"string"!=typeof e?null:Bt(e,t)||Ot(e,t)||jt(e,t)||null}async function Vt(e,t={}){if(null===Lt.fetch)throw new Error("The fetch function was not found. If on NodeJS < 18 please specify the fetch function with config.fetch");if(""===new URL(e).searchParams.get("key").trim())throw new Error("The MapTiler Cloud API key is missing. Set it in `config.apiKey` or get one for free at https://maptiler.com");return Lt.fetch(e,t)}const Ut={maptilerApiURL:"https://api.maptiler.com/",mapStyle:"streets-v2"};Object.freeze(Ut);class qt extends Error{constructor(e,t=""){super(`Call to enpoint ${e.url} failed with the status code ${e.status}. ${t}`),this.res=e}}const Zt={403:"Key is missing, invalid or restricted"};async function Gt(e={}){const t=new URL("geolocation/ip.json",Ut.maptilerApiURL);t.searchParams.set("key",e.apiKey??Lt.apiKey);const i=t.toString(),r=await Vt(i);if(!r.ok)throw new qt(r,r.status in Zt?Zt[r.status]:"");return await r.json()}const Ht={info:Gt};function Wt(e){let t;const i=e.trim();let r;return r=i.startsWith("http://")||i.startsWith("https://")?i:null!==(t=/^maptiler:\/\/(.*)/.exec(i))?`https://api.maptiler.com/maps/${t[1]}/style.json`:`https://api.maptiler.com/maps/${i}/style.json`,r}class Kt{constructor(e,t,i,r,n,o){this.name=e,this.variantType=t,this.id=i,this.referenceStyle=r,this.description=n,this.imageURL=o}getName(){return this.name}getFullName(){return`${this.referenceStyle.getName()} ${this.name}`}getType(){return this.variantType}getId(){return this.id}getDescription(){return this.description}getReferenceStyle(){return this.referenceStyle}hasVariant(e){return this.referenceStyle.hasVariant(e)}getVariant(e){return this.referenceStyle.getVariant(e)}getVariants(){return this.referenceStyle.getVariants().filter((e=>e!==this))}getImageURL(){return this.imageURL}getExpandedStyleURL(){return Wt(this.getId())}}class Xt{constructor(e,t){this.name=e,this.id=t,this.variants={},this.orderedVariants=[]}getName(){return this.name}getId(){return this.id}addVariant(e){this.variants[e.getType()]=e,this.orderedVariants.push(e)}hasVariant(e){return e in this.variants}getVariant(e){return e in this.variants?this.variants[e]:this.orderedVariants[0]}getVariants(){return Object.values(this.variants)}getDefaultVariant(){return this.orderedVariants[0]}}const Yt=[{referenceStyleID:"STREETS",name:"Streets",description:"",variants:[{id:"streets-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"streets-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"streets-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""},{id:"streets-v2-night",name:"Night",variantType:"NIGHT",description:"",imageURL:""},{id:"streets-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""}]},{referenceStyleID:"OUTDOOR",name:"Outdoor",description:"",variants:[{id:"outdoor-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"outdoor-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""}]},{referenceStyleID:"WINTER",name:"Winter",description:"",variants:[{id:"winter-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"winter-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""}]},{referenceStyleID:"SATELLITE",name:"Satellite",description:"",variants:[{id:"satellite",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"HYBRID",name:"Hybrid",description:"",variants:[{id:"hybrid",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"BASIC",name:"Basic",description:"",variants:[{id:"basic-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"basic-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"basic-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"BRIGHT",name:"Bright",description:"",variants:[{id:"bright-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"bright-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"bright-v2-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""},{id:"bright-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""}]},{referenceStyleID:"OPENSTREETMAP",name:"OpenStreetMap",description:"",variants:[{id:"openstreetmap",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]},{referenceStyleID:"TOPO",name:"Topo",description:"",variants:[{id:"topo-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"topo-v2-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"topo-v2-shiny",name:"Shiny",variantType:"SHINY",description:"",imageURL:""},{id:"topo-v2-pastel",name:"Pastel",variantType:"PASTEL",description:"",imageURL:""},{id:"topo-v2-topographique",name:"Topographique",variantType:"TOPOGRAPHIQUE",description:"",imageURL:""}]},{referenceStyleID:"VOYAGER",name:"Voyager",description:"",variants:[{id:"voyager-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"voyager-v2-darkmatter",name:"Darkmatter",variantType:"DARK",description:"",imageURL:""},{id:"voyager-v2-positron",name:"Positron",variantType:"LIGHT",description:"",imageURL:""},{id:"voyager-v2-vintage",name:"Vintage",variantType:"VINTAGE",description:"",imageURL:""}]},{referenceStyleID:"TONER",name:"Toner",description:"",variants:[{id:"toner-v2",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"toner-v2-background",name:"Background",variantType:"BACKGROUND",description:"",imageURL:""},{id:"toner-v2-lite",name:"Lite",variantType:"LITE",description:"",imageURL:""},{id:"toner-v2-lines",name:"Lines",variantType:"LINES",description:"",imageURL:""}]},{referenceStyleID:"DATAVIZ",name:"Dataviz",description:"",variants:[{id:"dataviz",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"dataviz-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"dataviz-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"BACKDROP",name:"Backdrop",description:"",variants:[{id:"backdrop",name:"Default",variantType:"DEFAULT",description:"",imageURL:""},{id:"backdrop-dark",name:"Dark",variantType:"DARK",description:"",imageURL:""},{id:"backdrop-light",name:"Light",variantType:"LIGHT",description:"",imageURL:""}]},{referenceStyleID:"OCEAN",name:"Ocean",description:"",variants:[{id:"ocean",name:"Default",variantType:"DEFAULT",description:"",imageURL:""}]}];function Jt(e){return new Proxy(e,{get:(t,i,r)=>t.hasVariant(i)?t.getVariant(i):i.toString().toUpperCase()===i?e.getDefaultVariant():Reflect.get(t,i,r)})}function Qt(){const e={};for(let t=0;t<Yt.length;t+=1){const i=Yt[t],r=Jt(new Xt(i.name,i.referenceStyleID));for(let e=0;e<i.variants.length;e+=1){const t=i.variants[e],n=new Kt(t.name,t.variantType,t.id,r,t.description,t.imageURL);r.addVariant(n)}e[i.referenceStyleID]=r}return e}const ei=Qt();var ti,ii={exports:{}};function ri(){if(ti)return ii.exports;ti=1;var e,t="object"==typeof Reflect?Reflect:null,i=t&&"function"==typeof t.apply?t.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)};e=t&&"function"==typeof t.ownKeys?t.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 n(){n.init.call(this)}ii.exports=n,ii.exports.once=function(e,t){return new Promise((function(i,r){function n(i){e.removeListener(t,o),r(i)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",n),i([].slice.call(arguments))}m(e,t,o,{once:!0}),"error"!==t&&function(e,t,i){"function"==typeof e.on&&m(e,"error",t,i)}(e,n,{once:!0})}))},n.EventEmitter=n,n.prototype._events=void 0,n.prototype._eventsCount=0,n.prototype._maxListeners=void 0;var o=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function s(e){return void 0===e._maxListeners?n.defaultMaxListeners:e._maxListeners}function l(e,t,i,r){var n,o,l,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),l=o[t]),void 0===l)l=o[t]=i,++e._eventsCount;else if("function"==typeof l?l=o[t]=r?[i,l]:[l,i]:r?l.unshift(i):l.push(i),(n=s(e))>0&&l.length>n&&!l.warned){l.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+l.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=l.length,c=u,console&&console.warn&&console.warn(c)}return e}function c(){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 u(e,t,i){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:i},n=c.bind(r);return n.listener=i,r.wrapFn=n,n}function h(e,t,i){var r=e._events;if(void 0===r)return[];var n=r[t];return void 0===n?[]:"function"==typeof n?i?[n.listener||n]:[n]:i?function(e){for(var t=new Array(e.length),i=0;i<t.length;++i)t[i]=e[i].listener||e[i];return t}(n):d(n,n.length)}function p(e){var t=this._events;if(void 0!==t){var i=t[e];if("function"==typeof i)return 1;if(void 0!==i)return i.length}return 0}function d(e,t){for(var i=new Array(t),r=0;r<t;++r)i[r]=e[r];return i}function m(e,t,i,r){if("function"==typeof e.on)r.once?e.once(t,i):e.on(t,i);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function n(o){r.once&&e.removeEventListener(t,n),i(o)}))}}return Object.defineProperty(n,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");o=e}}),n.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},n.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},n.prototype.getMaxListeners=function(){return s(this)},n.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,o=this._events;if(void 0!==o)n=n&&void 0===o.error;else if(!n)return!1;if(n){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var l=o[e];if(void 0===l)return!1;if("function"==typeof l)i(l,this,t);else{var c=l.length,u=d(l,c);for(r=0;r<c;++r)i(u[r],this,t)}return!0},n.prototype.addListener=function(e,t){return l(this,e,t,!1)},n.prototype.on=n.prototype.addListener,n.prototype.prependListener=function(e,t){return l(this,e,t,!0)},n.prototype.once=function(e,t){return a(t),this.on(e,u(this,e,t)),this},n.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,u(this,e,t)),this},n.prototype.removeListener=function(e,t){var i,r,n,o,s;if(a(t),void 0===(r=this._events))return this;if(void 0===(i=r[e]))return this;if(i===t||i.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,i.listener||t));else if("function"!=typeof i){for(n=-1,o=i.length-1;o>=0;o--)if(i[o]===t||i[o].listener===t){s=i[o].listener,n=o;break}if(n<0)return this;0===n?i.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(i,n),1===i.length&&(r[e]=i[0]),void 0!==r.removeListener&&this.emit("removeListener",e,s||t)}return this},n.prototype.off=n.prototype.removeListener,n.prototype.removeAllListeners=function(e){var t,i,r;if(void 0===(i=this._events))return this;if(void 0===i.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==i[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete i[e]),this;if(0===arguments.length){var n,o=Object.keys(i);for(r=0;r<o.length;++r)"removeListener"!==(n=o[r])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=i[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},n.prototype.listeners=function(e){return h(this,e,!0)},n.prototype.rawListeners=function(e){return h(this,e,!1)},n.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},n.prototype.listenerCount=p,n.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]},ii.exports}var ni=ri(),oi=Tt(ni);const ai=[];for(let e=0;e<256;++e)ai.push((e+256).toString(16).slice(1));function si(e,t=0){return(ai[e[t+0]]+ai[e[t+1]]+ai[e[t+2]]+ai[e[t+3]]+"-"+ai[e[t+4]]+ai[e[t+5]]+"-"+ai[e[t+6]]+ai[e[t+7]]+"-"+ai[e[t+8]]+ai[e[t+9]]+"-"+ai[e[t+10]]+ai[e[t+11]]+ai[e[t+12]]+ai[e[t+13]]+ai[e[t+14]]+ai[e[t+15]]).toLowerCase()}let li;const ci=new Uint8Array(16);function ui(){if(!li){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");li=crypto.getRandomValues.bind(crypto)}return li(ci)}const hi="undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);var pi={randomUUID:hi};function di(e,t,i){if(pi.randomUUID&&!e)return pi.randomUUID();const r=(e=e||{}).random??e.rng?.()??ui();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=15&r[6]|64,r[8]=63&r[8]|128,si(r)}const mi="3.7.7",fi=mi,gi="function"==typeof Buffer,yi="function"==typeof TextDecoder?new TextDecoder:void 0,_i="function"==typeof TextEncoder?new TextEncoder:void 0,vi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",xi=Array.prototype.slice.call(vi),bi=(()=>{let e={};return xi.forEach(((t,i)=>e[t]=i)),e})(),wi=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,Ci=String.fromCharCode.bind(String),Ti="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),Si=e=>e.replace(/=/g,"").replace(/[+\/]/g,(e=>"+"==e?"-":"_")),Ai=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),Mi=e=>{let t,i,r,n,o="";const a=e.length%3;for(let a=0;a<e.length;){if((i=e.charCodeAt(a++))>255||(r=e.charCodeAt(a++))>255||(n=e.charCodeAt(a++))>255)throw new TypeError("invalid character found");t=i<<16|r<<8|n,o+=xi[t>>18&63]+xi[t>>12&63]+xi[t>>6&63]+xi[63&t]}return a?o.slice(0,a-3)+"===".substring(a):o},Ei="function"==typeof btoa?e=>btoa(e):gi?e=>Buffer.from(e,"binary").toString("base64"):Mi,Pi=gi?e=>Buffer.from(e).toString("base64"):e=>{let t=[];for(let i=0,r=e.length;i<r;i+=4096)t.push(Ci.apply(null,e.subarray(i,i+4096)));return Ei(t.join(""))},Ii=(e,t=!1)=>t?Si(Pi(e)):Pi(e),ki=e=>{if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?Ci(192|t>>>6)+Ci(128|63&t):Ci(224|t>>>12&15)+Ci(128|t>>>6&63)+Ci(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return Ci(240|t>>>18&7)+Ci(128|t>>>12&63)+Ci(128|t>>>6&63)+Ci(128|63&t)},zi=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Li=e=>e.replace(zi,ki),Di=gi?e=>Buffer.from(e,"utf8").toString("base64"):_i?e=>Pi(_i.encode(e)):e=>Ei(Li(e)),Fi=(e,t=!1)=>t?Si(Di(e)):Di(e),Ri=e=>Fi(e,!0),Bi=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Oi=e=>{switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return Ci(55296+(t>>>10))+Ci(56320+(1023&t));case 3:return Ci((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return Ci((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},ji=e=>e.replace(Bi,Oi),Ni=e=>{if(e=e.replace(/\s+/g,""),!wi.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(3&e.length));let t,i,r,n="";for(let o=0;o<e.length;)t=bi[e.charAt(o++)]<<18|bi[e.charAt(o++)]<<12|(i=bi[e.charAt(o++)])<<6|(r=bi[e.charAt(o++)]),n+=64===i?Ci(t>>16&255):64===r?Ci(t>>16&255,t>>8&255):Ci(t>>16&255,t>>8&255,255&t);return n},$i="function"==typeof atob?e=>atob(Ai(e)):gi?e=>Buffer.from(e,"base64").toString("binary"):Ni,Vi=gi?e=>Ti(Buffer.from(e,"base64")):e=>Ti($i(e).split("").map((e=>e.charCodeAt(0)))),Ui=e=>Vi(Zi(e)),qi=gi?e=>Buffer.from(e,"base64").toString("utf8"):yi?e=>yi.decode(Vi(e)):e=>ji($i(e)),Zi=e=>Ai(e.replace(/[-_]/g,(e=>"-"==e?"+":"/"))),Gi=e=>qi(Zi(e)),Hi=e=>{if("string"!=typeof e)return!1;const t=e.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},Wi=e=>({value:e,enumerable:!1,writable:!0,configurable:!0}),Ki=function(){const e=(e,t)=>Object.defineProperty(String.prototype,e,Wi(t));e("fromBase64",(function(){return Gi(this)})),e("toBase64",(function(e){return Fi(this,e)})),e("toBase64URI",(function(){return Fi(this,!0)})),e("toBase64URL",(function(){return Fi(this,!0)})),e("toUint8Array",(function(){return Ui(this)}))},Xi=function(){const e=(e,t)=>Object.defineProperty(Uint8Array.prototype,e,Wi(t));e("toBase64",(function(e){return Ii(this,e)})),e("toBase64URI",(function(){return Ii(this,!0)})),e("toBase64URL",(function(){return Ii(this,!0)}))},Yi=()=>{Ki(),Xi()},Ji={version:mi,VERSION:fi,atob:$i,atobPolyfill:Ni,btoa:Ei,btoaPolyfill:Mi,fromBase64:Gi,toBase64:Fi,encode:Fi,encodeURI:Ri,encodeURL:Ri,utob:Li,btou:ji,decode:Gi,isValid:Hi,fromUint8Array:Ii,toUint8Array:Ui,extendString:Ki,extendUint8Array:Xi,extendBuiltins:Yi};var Qi=Object.defineProperty,er=e=>{throw TypeError(e)},tr=(e,t,i)=>t in e?Qi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,ir=(e,t,i)=>tr(e,"symbol"!=typeof t?t+"":t,i),rr=(e,t,i)=>t.has(e)||er("Cannot "+i),nr=(e,t,i)=>(rr(e,t,"read from private field"),i?i.call(e):t.get(e)),or=(e,t,i)=>t.has(e)?er("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),ar=(e,t,i,r)=>(rr(e,t,"write to private field"),t.set(e,i),i),sr=(e,t,i)=>(rr(e,t,"access private method"),i);const lr="3.0.1",cr={version:lr},ur={VISITOR:{code:null,flag:"visitor",name:"Visitor",latin:!0,isMode:!0,geocoding:!1},VISITOR_ENGLISH:{code:null,flag:"visitor_en",name:"Visitor English",latin:!0,isMode:!0,geocoding:!1},STYLE:{code:null,flag:"style",name:"Style",latin:!1,isMode:!0,geocoding:!1},STYLE_LOCK:{code:null,flag:"style_lock",name:"Style Lock",latin:!1,isMode:!0,geocoding:!1},...Rt};function hr(){if(typeof navigator>"u"){return Ot(Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0])||ur.ENGLISH}return Array.from(new Set(navigator.languages.map((e=>e.split("-")[0])))).map((e=>Ot(e))).filter((e=>e))[0]??ur.LOCAL}const pr={maptilerLogoURL:"https://api.maptiler.com/resources/logo.svg",maptilerURL:"https://www.maptiler.com/",maptilerApiHost:"api.maptiler.com",telemetryURL:"https://api.maptiler.com/metrics",rtlPluginURL:"https://cdn.maptiler.com/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.min.js",primaryLanguage:ur.STYLE,secondaryLanguage:ur.LOCAL,terrainSourceURL:"https://api.maptiler.com/tiles/terrain-rgb-v2/tiles.json",terrainSourceId:"maptiler-terrain"};Object.freeze(pr);const dr=di();class mr extends oi{constructor(){super(...arguments),ir(this,"primaryLanguage",pr.primaryLanguage),ir(this,"secondaryLanguage"),ir(this,"session",!0),ir(this,"caching",!0),ir(this,"telemetry",!0),ir(this,"_unit","metric"),ir(this,"_apiKey","")}set unit(e){this._unit=e,this.emit("unit",e)}get unit(){return this._unit}set apiKey(e){this._apiKey=e,Lt.apiKey=e,this.emit("apiKey",e)}get apiKey(){return this._apiKey}set fetch(e){Lt.fetch=e}get fetch(){return Lt.fetch}}const fr=new mr,{addProtocol:gr}=It,yr="localcache_source",_r="localcache",vr="maptiler_sdk",xr=1e3,br=100,wr=typeof caches<"u";function Cr(e,t){if(wr&&fr.caching&&fr.session&&e.host===pr.maptilerApiHost){if("Source"===t&&e.href.includes("tiles.json"))return e.href.replace("https://",`${yr}://`);if("Tile"===t||"Glyphs"===t)return e.href.replace("https://",`${_r}://`)}return e.href}let Tr;async function Sr(){return Tr||(Tr=await caches.open(vr)),Tr}let Ar=0;async function Mr(){const e=await Sr(),t=await e.keys(),i=t.slice(0,Math.max(t.length-xr,0));for(const t of i)e.delete(t)}function Er(){gr(yr,(async(e,t)=>{if(!e.url)throw new Error("");e.url=e.url.replace(`${yr}://`,"https://");const i=e;i.signal=t.signal;const r=await fetch(e.url,i),n=await r.json();return n.tiles&&n.tiles.length>0&&(n.tiles[0]+=`&last-modified=${r.headers.get("Last-Modified")}`),{data:n,cacheControl:r.headers.get("Cache-Control"),expires:r.headers.get("Expires")}})),gr(_r,(async(e,t)=>{if(!e.url)throw new Error("");e.url=e.url.replace(`${_r}://`,"https://");const i=new URL(e.url),r=new URL(i);r.searchParams.delete("mtsid"),r.searchParams.delete("key");const n=r.toString(),o=new URL(i);o.searchParams.delete("last-modified");const a=o.toString(),s=async e=>({data:await e.arrayBuffer(),cacheControl:e.headers.get("Cache-Control"),expires:e.headers.get("Expires")}),l=await Sr(),c=await l.match(n);if(c)return s(c);const u=e;u.signal=t.signal;const h=await fetch(a,u);return h.status>=200&&h.status<300&&(l.put(n,h.clone()).catch((()=>{})),++Ar>br&&(Mr(),Ar=0)),s(h)}))}function Pr(){if(typeof window>"u")return;const e=It.getRTLTextPluginStatus();if("unavailable"===e||"requested"===e)try{It.setRTLTextPlugin(pr.rtlPluginURL,!0)}catch{}}function Ir(e,t){for(const i of e)"function"==typeof t[i]&&(t[i]=t[i].bind(t))}function kr(e,t,i){const r=window.document.createElement(e);return void 0!==t&&(r.className=t),i&&i.appendChild(r),r}function zr(e){e.parentNode&&e.parentNode.removeChild(e)}function Lr(e,t){let i=null;try{i=new URL(e)}catch{return{url:e}}return i.host===pr.maptilerApiHost&&(i.searchParams.has("key")||i.searchParams.append("key",fr.apiKey),fr.session&&i.searchParams.append("mtsid",dr)),{url:Cr(i,t)}}function Dr(e){return(t,i)=>{if(null!=e){const r=e(t,i),n=Lr((null==r?void 0:r.url)??"",i);return{...r,...n}}return Lr(t,i)}}function Fr(){return Math.random().toString(36).substring(2)}function Rr(e){return/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/gi.test(e)}function Br(e){try{return JSON.parse(e)}catch{}return null}function Or(){return document.createElement("canvas").getContext("webgl2")?null:typeof WebGL2RenderingContext<"u"?"Graphic rendering with WebGL2 has been disabled or is not supported by your graphic card. The map cannot be displayed.":"Your browser does not support graphic rendering with WebGL2. The map cannot be displayed."}function jr(e){const t=Or();if(!t)return;let i=null;if("string"==typeof e?i=document.getElementById(e):e instanceof HTMLElement&&(i=e),!i)throw new Error("The Map container must be provided.");const r=document.createElement("div");throw r.innerHTML=t,r.classList.add("webgl-warning-div"),i.appendChild(r),new Error(t)}function Nr(e){let t=null;if("string"==typeof e?t=document.getElementById(e):e instanceof HTMLElement&&(t=e),!t)throw new Error("The Map container must be provided.");const i=document.createElement("div");i.innerHTML="The WebGL context was lost.",i.classList.add("webgl-warning-div"),t.appendChild(i)}function $r(e,t){return!(!Array.isArray(e)||2!==e.length||"get"!==e[0]||"string"!=typeof e[1]||t&&!e[1].startsWith("name:")||!t&&"name"!==e[1])}function Vr(e,t,i){const r=structuredClone(e),n=e=>{if("string"!=typeof e)for(let r=0;r<e.length;r+=1)$r(e[r],i)?e[r]=structuredClone(t):n(e[r])};return $r(r,i)?t:(n(r),r)}function Ur(e,t){const i=t?/\{name:\S+\}/:/\{name\}/;return{contains:i.test(e),exactMatch:new RegExp(`^${i.source}$`).test(e)}}function qr(e,t,i){const r=i?/\{name:\S+\}/:/\{name\}/,n=e.split(r);return["concat",...n.flatMap(((e,i)=>i===n.length-1?[e]:[e,t]))]}function Zr(e){var t;const i=/\{name(?:\:(?<language>\S+))?\}/g,r=[];for(;;){const n=i.exec(e);if(!n)break;const o=(null==(t=n.groups)?void 0:t.language)??null;r.push(o)}return r}function Gr(e){return Array.isArray(e)&&2===e.length&&"get"===e[0]&&"string"==typeof e[1]?"name"===e[1].trim()?{isLanguage:!0,localization:null}:e[1].trim().startsWith("name:")?{isLanguage:!0,localization:e[1].trim().split(":").pop()}:null:null}function Hr(e){const t=[],i=structuredClone(e),r=e=>{if("string"!=typeof e)for(let i=0;i<e.length;i+=1){const n=Gr(e[i]);n?t.push(n.localization):r(e[i])}};return r([i]),t}function Wr(e,t){const i=[];for(const r of e){if("symbol"!==r.type)continue;const e=r,{id:n,layout:o}=e;if(!o||!("text-field"in o))continue;const a=t.getLayoutProperty(n,"text-field");if(a)if("string"==typeof a){const e=Zr(a);i.push(e)}else{const e=Hr(a);i.push(e)}}const r=i.flat(),n={unlocalized:0,localized:{}};for(const e of r)null===e?n.unlocalized+=1:(e in n.localized||(n.localized[e]=0),n.localized[e]+=1);return n}let Kr=class extends It.Marker{addTo(e){return super.addTo(e)}};class Xr extends It.Popup{addTo(e){return super.addTo(e)}}class Yr extends It.Style{constructor(e,t={}){super(e,t)}}class Jr extends It.CanvasSource{onAdd(e){super.onAdd(e)}}class Qr extends It.GeoJSONSource{onAdd(e){super.onAdd(e)}}class en extends It.ImageSource{onAdd(e){super.onAdd(e)}}class tn extends It.RasterTileSource{onAdd(e){super.onAdd(e)}}class rn extends It.RasterDEMTileSource{onAdd(e){super.onAdd(e)}}class nn extends It.VectorTileSource{onAdd(e){super.onAdd(e)}}class on extends It.VideoSource{onAdd(e){super.onAdd(e)}}class an extends It.NavigationControl{onAdd(e){return super.onAdd(e)}}class sn extends It.GeolocateControl{onAdd(e){return super.onAdd(e)}}class ln extends It.AttributionControl{onAdd(e){return super.onAdd(e)}}class cn extends It.LogoControl{onAdd(e){return super.onAdd(e)}}class un extends It.ScaleControl{onAdd(e){return super.onAdd(e)}}class hn extends It.FullscreenControl{onAdd(e){return super.onAdd(e)}}class pn extends It.TerrainControl{onAdd(e){return super.onAdd(e)}}class dn extends It.BoxZoomHandler{constructor(e,t){super(e,t)}}class mn extends It.ScrollZoomHandler{constructor(e,t){super(e,t)}}class fn extends It.CooperativeGesturesHandler{constructor(e,t){super(e,t)}}class gn extends It.KeyboardHandler{constructor(e){super(e)}}class yn extends It.TwoFingersTouchPitchHandler{constructor(e){super(e)}}class _n extends It.MapWheelEvent{constructor(e,t,i){super(e,t,i)}}class vn extends It.MapTouchEvent{constructor(e,t,i){super(e,t,i)}}class xn extends It.MapMouseEvent{constructor(e,t,i,r={}){super(e,t,i,r)}}class bn extends cn{constructor(e={}){super(e),ir(this,"logoURL",""),ir(this,"linkURL",""),this.logoURL=e.logoURL??pr.maptilerLogoURL,this.linkURL=e.linkURL??pr.maptilerURL}onAdd(e){this._map=e,this._compact=this.options.compact??!1,this._container=window.document.createElement("div"),this._container.className="maplibregl-ctrl";const t=window.document.createElement("a");return t.style.backgroundRepeat="no-repeat",t.style.cursor="pointer",t.style.display="block",t.style.height="23px",t.style.margin="0 0 -4px -4px",t.style.overflow="hidden",t.style.width="88px",t.style.backgroundImage=`url(${this.logoURL})`,t.style.backgroundSize="100px 30px",t.style.width="100px",t.style.height="30px",t.target="_blank",t.rel="noopener",t.href=this.linkURL,t.setAttribute("aria-label","MapTiler logo"),t.setAttribute("rel","noopener"),this._container.appendChild(t),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}}var wn=8,Cn={version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},Tn={"*":{type:"source"}},Sn=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],An={type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},Mn={type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},En={type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},Pn={type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},In={type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},kn={type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},zn={id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},Ln=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],Dn={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Fn={"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Rn={"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Bn={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},On={"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},jn={"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Nn={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},$n={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Vn={type:"array",value:"*"},Un={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},qn={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},Zn={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},Gn={type:"array",value:"*",minimum:1},Hn={anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},Wn={"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},Kn={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},Xn={type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},Yn=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],Jn={"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},Qn={"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},eo={"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},to={"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},io={"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},ro={"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},no={"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},oo={"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},ao={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},so={"*":{type:"string"}},lo={$version:wn,$root:Cn,sources:Tn,source:Sn,source_vector:An,source_raster:Mn,source_raster_dem:En,source_geojson:Pn,source_video:In,source_image:kn,layer:zn,layout:Ln,layout_background:Dn,layout_fill:Fn,layout_circle:Rn,layout_heatmap:Bn,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:On,layout_symbol:jn,layout_raster:Nn,layout_hillshade:$n,filter:Vn,filter_operator:Un,geometry_type:qn,function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:Zn,expression:Gn,light:Hn,sky:Wn,terrain:Kn,projection:Xn,paint:Yn,paint_fill:Jn,"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:Qn,paint_circle:eo,paint_heatmap:to,paint_symbol:io,paint_raster:ro,paint_hillshade:no,paint_background:oo,transition:ao,"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:so};class co{constructor(e,t,i,r){this.message=(e?`${e}: `:"")+i,r&&(this.identifier=r),null!=t&&t.__line__&&(this.line=t.__line__)}}function uo(e,...t){for(const i of t)for(const t in i)e[t]=i[t];return e}class ho extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class po{constructor(e,t=[]){this.parent=e,this.bindings={};for(const[e,i]of t)this.bindings[e]=i}concat(e){return new po(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const mo={kind:"null"},fo={kind:"number"},go={kind:"string"},yo={kind:"boolean"},_o={kind:"color"},vo={kind:"projectionDefinition"},xo={kind:"object"},bo={kind:"value"},wo={kind:"error"},Co={kind:"collator"},To={kind:"formatted"},So={kind:"padding"},Ao={kind:"resolvedImage"},Mo={kind:"variableAnchorOffsetCollection"};function Eo(e,t){return{kind:"array",itemType:e,N:t}}function Po(e){if("array"===e.kind){const t=Po(e.itemType);return"number"==typeof e.N?`array<${t}, ${e.N}>`:"value"===e.itemType.kind?"array":`array<${t}>`}return e.kind}const Io=[mo,fo,go,yo,_o,vo,To,xo,Eo(bo),So,Ao,Mo];function ko(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!ko(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 Io)if(!ko(e,t))return null}return`Expected ${Po(e)} but found ${Po(t)} instead.`}function zo(e,t){return t.some((t=>t.kind===e.kind))}function Lo(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))}function Do(e,t){return"array"===e.kind&&"array"===t.kind?e.itemType.kind===t.itemType.kind&&"number"==typeof e.N:e.kind===t.kind}const Fo=.96422,Ro=1,Bo=.82521,Oo=4/29,jo=6/29,No=3*jo*jo,$o=jo*jo*jo,Vo=Math.PI/180,Uo=180/Math.PI;function qo(e){return(e%=360)<0&&(e+=360),e}function Zo([e,t,i,r]){let n,o;const a=Ho((.2225045*(e=Go(e))+.7168786*(t=Go(t))+.0606169*(i=Go(i)))/1);e===t&&t===i?n=o=a:(n=Ho((.4360747*e+.3850649*t+.1430804*i)/Fo),o=Ho((.0139322*e+.0971045*t+.7141733*i)/Bo));const s=116*a-16;return[s<0?0:s,500*(n-a),200*(a-o),r]}function Go(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Ho(e){return e>$o?Math.pow(e,1/3):e/No+Oo}function Wo([e,t,i,r]){let n=(e+16)/116,o=isNaN(t)?n:n+t/500,a=isNaN(i)?n:n-i/200;return n=1*Xo(n),o=Fo*Xo(o),a=Bo*Xo(a),[Ko(3.1338561*o-1.6168667*n-.4906146*a),Ko(-.9787684*o+1.9161415*n+.033454*a),Ko(.0719453*o-.2289914*n+1.4052427*a),r]}function Ko(e){return(e=e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055)<0?0:e>1?1:e}function Xo(e){return e>jo?e*e*e:No*(e-Oo)}function Yo(e){const[t,i,r,n]=Zo(e),o=Math.sqrt(i*i+r*r);return[Math.round(1e4*o)?qo(Math.atan2(r,i)*Uo):NaN,o,t,n]}function Jo([e,t,i,r]){return e=isNaN(e)?0:e*Vo,Wo([i,Math.cos(e)*t,Math.sin(e)*t,r])}function Qo([e,t,i,r]){function n(r){const n=(r+e/30)%12,o=t*Math.min(i,1-i);return i-o*Math.max(-1,Math.min(n-3,9-n,1))}return e=qo(e),t/=100,i/=100,[n(0),n(8),n(4),r]}function ea(e){if("transparent"===(e=e.toLowerCase().trim()))return[0,0,0,0];const t=oa[e];if(t){const[e,i,r]=t;return[e/255,i/255,r/255,1]}if(e.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){const t=e.length<6?1:2;let i=1;return[ta(e.slice(i,i+=t)),ta(e.slice(i,i+=t)),ta(e.slice(i,i+=t)),ta(e.slice(i,i+t)||"ff")]}if(e.startsWith("rgb")){const t=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,i=e.match(t);if(i){const[e,t,r,n,o,a,s,l,c,u,h,p]=i,d=[n||" ",s||" ",u].join("");if(" "===d||" /"===d||",,"===d||",,,"===d){const e=[r,a,c].join(""),i="%%%"===e?100:""===e?255:0;if(i){const e=[ra(+t/i,0,1),ra(+o/i,0,1),ra(+l/i,0,1),h?ia(+h,p):1];if(na(e))return e}}return}}const i=e.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(i){const[e,t,r,n,o,a,s,l,c]=i,u=[r||" ",o||" ",s].join("");if(" "===u||" /"===u||",,"===u||",,,"===u){const e=[+t,ra(+n,0,100),ra(+a,0,100),l?ia(+l,c):1];if(na(e))return Qo(e)}}}function ta(e){return parseInt(e.padEnd(2,e),16)/255}function ia(e,t){return ra(t?e/100:e,0,1)}function ra(e,t,i){return Math.min(Math.max(t,e),i)}function na(e){return!e.some(Number.isNaN)}const oa={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function aa(e,t,i){return e+i*(t-e)}function sa(e,t,i){return e.map(((e,r)=>aa(e,t[r],i)))}class la{constructor(e,t,i,r=1,n=!0){this.r=e,this.g=t,this.b=i,this.a=r,n||(this.r*=r,this.g*=r,this.b*=r,r||this.overwriteGetter("rgb",[e,t,i,r]))}static parse(e){if(e instanceof la)return e;if("string"!=typeof e)return;const t=ea(e);return t?new la(...t,!1):void 0}get rgb(){const{r:e,g:t,b:i,a:r}=this,n=r||1/0;return this.overwriteGetter("rgb",[e/n,t/n,i/n,r])}get hcl(){return this.overwriteGetter("hcl",Yo(this.rgb))}get lab(){return this.overwriteGetter("lab",Zo(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){const[e,t,i,r]=this.rgb;return`rgba(${[e,t,i].map((e=>Math.round(255*e))).join(",")},${r})`}static interpolate(e,t,i,r="rgb"){switch(r){case"rgb":{const[r,n,o,a]=sa(e.rgb,t.rgb,i);return new la(r,n,o,a,!1)}case"hcl":{const[r,n,o,a]=e.hcl,[s,l,c,u]=t.hcl;let h,p;if(isNaN(r)||isNaN(s))isNaN(r)?isNaN(s)?h=NaN:(h=s,(1===o||0===o)&&(p=l)):(h=r,(1===c||0===c)&&(p=n));else{let e=s-r;s>r&&e>180?e-=360:s<r&&r-s>180&&(e+=360),h=r+i*e}const[d,m,f,g]=Jo([h,p??aa(n,l,i),aa(o,c,i),aa(a,u,i)]);return new la(d,m,f,g,!1)}case"lab":{const[r,n,o,a]=Wo(sa(e.lab,t.lab,i));return new la(r,n,o,a,!1)}}}}la.black=new la(0,0,0,1),la.white=new la(1,1,1,1),la.transparent=new la(0,0,0,0),la.red=new la(1,0,0,1);class ca{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 ua{constructor(e,t,i,r,n){this.text=e,this.image=t,this.scale=i,this.fontStack=r,this.textColor=n}}class ha{constructor(e){this.sections=e}static fromString(e){return new ha([new ua(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 ha?e:ha.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map((e=>e.text)).join("")}}class pa{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof pa)return e;if("number"==typeof e)return new pa([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const t of e)if("number"!=typeof t)return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new pa(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,i){return new pa(sa(e.values,t.values,i))}}class da{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const ma=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class fa{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof fa)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let t=0;t<e.length;t+=2){const i=e[t],r=e[t+1];if("string"!=typeof i||!ma.has(i)||!Array.isArray(r)||2!==r.length||"number"!=typeof r[0]||"number"!=typeof r[1])return}return new fa(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,i){const r=e.values,n=t.values;if(r.length!==n.length)throw new da(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${t.toString()}`);const o=[];for(let e=0;e<r.length;e+=2){if(r[e]!==n[e])throw new da(`Cannot interpolate values containing mismatched anchors. from[${e}]: ${r[e]}, to[${e}]: ${n[e]}`);o.push(r[e]);const[t,a]=r[e+1],[s,l]=n[e+1];o.push([aa(t,s,i),aa(a,l,i)])}return new fa(o)}}class ga{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new ga({name:e,available:!1}):null}}class ya{constructor(e,t,i){this.from=e,this.to=t,this.transition=i}static interpolate(e,t,i){return new ya(e,t,i)}static parse(e){return e instanceof ya?e:Array.isArray(e)&&3===e.length&&"string"==typeof e[0]&&"string"==typeof e[1]&&"number"==typeof e[2]?new ya(e[0],e[1],e[2]):"object"==typeof e&&"string"==typeof e.from&&"string"==typeof e.to&&"number"==typeof e.transition?new ya(e.from,e.to,e.transition):"string"==typeof e?new ya(e,e,1):void 0}}function _a(e,t,i,r){return"number"==typeof e&&e>=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof i&&i>=0&&i<=255?typeof r>"u"||"number"==typeof r&&r>=0&&r<=1?null:`Invalid rgba value [${[e,t,i,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof r?[e,t,i,r]:[e,t,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function va(e){if(null===e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||e instanceof ya||e instanceof la||e instanceof ca||e instanceof ha||e instanceof pa||e instanceof fa||e instanceof ga)return!0;if(Array.isArray(e)){for(const t of e)if(!va(t))return!1;return!0}if("object"==typeof e){for(const t in e)if(!va(e[t]))return!1;return!0}return!1}function xa(e){if(null===e)return mo;if("string"==typeof e)return go;if("boolean"==typeof e)return yo;if("number"==typeof e)return fo;if(e instanceof la)return _o;if(e instanceof ya)return vo;if(e instanceof ca)return Co;if(e instanceof ha)return To;if(e instanceof pa)return So;if(e instanceof fa)return Mo;if(e instanceof ga)return Ao;if(Array.isArray(e)){const t=e.length;let i;for(const t of e){const e=xa(t);if(i){if(i===e)continue;i=bo;break}i=e}return Eo(i||bo,t)}return xo}function ba(e){const t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof la||e instanceof ya||e instanceof ha||e instanceof pa||e instanceof fa||e instanceof ga?e.toString():JSON.stringify(e)}class wa{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(!va(e[1]))return t.error("invalid value");const i=e[1];let r=xa(i);const n=t.expectedType;return"array"===r.kind&&0===r.N&&n&&"array"===n.kind&&("number"!=typeof n.N||0===n.N)&&(r=n),new wa(r,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const Ca={string:go,number:fo,boolean:yo,object:xo};class Ta{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,r=1;const n=e[0];if("array"===n){let n,o;if(e.length>2){const i=e[1];if("string"!=typeof i||!(i in Ca)||"object"===i)return t.error('The item type argument of "array" must be one of string, number, boolean',1);n=Ca[i],r++}else n=bo;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],r++}i=Eo(n,o)}else{if(!Ca[n])throw new Error(`Types doesn't contain name = ${n}`);i=Ca[n]}const o=[];for(;r<e.length;r++){const i=t.parse(e[r],r,bo);if(!i)return null;o.push(i)}return new Ta(i,o)}evaluate(e){for(let t=0;t<this.args.length;t++){const i=this.args[t].evaluate(e);if(!ko(this.type,xa(i)))return i;if(t===this.args.length-1)throw new da(`Expected value to be of type ${Po(this.type)}, but found ${Po(xa(i))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}const Sa={"to-boolean":yo,"to-color":_o,"to-number":fo,"to-string":go};class Aa{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(!Sa[i])throw new Error(`Can't parse ${i} as it is not part of the known types`);if(("to-boolean"===i||"to-string"===i)&&2!==e.length)return t.error("Expected one argument.");const r=Sa[i],n=[];for(let i=1;i<e.length;i++){const r=t.parse(e[i],i,bo);if(!r)return null;n.push(r)}return new Aa(r,n)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let t,i;for(const r of this.args){if(t=r.evaluate(e),i=null,t instanceof la)return t;if("string"==typeof t){const i=e.parseColor(t);if(i)return i}else if(Array.isArray(t)&&(i=t.length<3||t.length>4?`Invalid rgba value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:_a(t[0],t[1],t[2],t[3]),!i))return new la(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new da(i||`Could not parse color from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"padding":{let t;for(const i of this.args){t=i.evaluate(e);const r=pa.parse(t);if(r)return r}throw new da(`Could not parse padding from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"variableAnchorOffsetCollection":{let t;for(const i of this.args){t=i.evaluate(e);const r=fa.parse(t);if(r)return r}throw new da(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"number":{let t=null;for(const i of this.args){if(t=i.evaluate(e),null===t)return 0;const r=Number(t);if(!isNaN(r))return r}throw new da(`Could not convert ${JSON.stringify(t)} to number.`)}case"formatted":return ha.fromString(ba(this.args[0].evaluate(e)));case"resolvedImage":return ga.fromString(ba(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return ba(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}const Ma=["Unknown","Point","LineString","Polygon"];class Ea{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?Ma[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let t=this._parseColorCache[e];return t||(t=this._parseColorCache[e]=la.parse(e)),t}}class Pa{constructor(e,t,i=[],r,n=new po,o=[]){this.registry=e,this.path=i,this.key=i.map((e=>`[${e}]`)).join(""),this.scope=n,this.errors=o,this.expectedType=r,this._isConstant=t}parse(e,t,i,r,n={}){return t?this.concat(t,i,r)._parse(e,n):this._parse(e,n)}_parse(e,t){function i(e,t,i){return"assert"===i?new Ta(t,[e]):"coerce"===i?new Aa(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 r=e[0];if("string"!=typeof r)return this.error(`Expression name must be a string, but found ${typeof r} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const n=this.registry[r];if(n){let r=n.parse(e,this);if(!r)return null;if(this.expectedType){const e=this.expectedType,n=r.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==n.kind)if("projectionDefinition"!==e.kind||"string"!==n.kind&&"array"!==n.kind)if("color"!==e.kind&&"formatted"!==e.kind&&"resolvedImage"!==e.kind||"value"!==n.kind&&"string"!==n.kind)if("padding"!==e.kind||"value"!==n.kind&&"number"!==n.kind&&"array"!==n.kind)if("variableAnchorOffsetCollection"!==e.kind||"value"!==n.kind&&"array"!==n.kind){if(this.checkSubtype(e,n))return null}else r=i(r,e,t.typeAnnotation||"coerce");else r=i(r,e,t.typeAnnotation||"coerce");else r=i(r,e,t.typeAnnotation||"coerce");else r=i(r,e,t.typeAnnotation||"coerce");else r=i(r,e,t.typeAnnotation||"assert")}if(!(r instanceof wa)&&"resolvedImage"!==r.type.kind&&this._isConstant(r)){const e=new Ea;try{r=new wa(r.type,r.evaluate(e))}catch(e){return this.error(e.message),null}}return r}return this.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0)}return typeof e>"u"?this.error("'undefined' value invalid. Use null instead."):"object"==typeof e?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof e} instead.`)}concat(e,t,i){const r="number"==typeof e?this.path.concat(e):this.path,n=i?this.scope.concat(i):this.scope;return new Pa(this.registry,this._isConstant,r,t||null,n,this.errors)}error(e,...t){const i=`${this.key}${t.map((e=>`[${e}]`)).join("")}`;this.errors.push(new ho(i,e))}checkSubtype(e,t){const i=ko(e,t);return i&&this.error(i),i}}class Ia{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 r=1;r<e.length-1;r+=2){const n=e[r];if("string"!=typeof n)return t.error(`Expected string, but found ${typeof n} instead.`,r);if(/[^a-zA-Z0-9_]/.test(n))return t.error("Variable names must contain only alphanumeric characters or '_'.",r);const o=t.parse(e[r+1],r+1);if(!o)return null;i.push([n,o])}const r=t.parse(e[e.length-1],e.length-1,t.expectedType,i);return r?new Ia(i,r):null}outputDefined(){return this.result.outputDefined()}}class ka{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 ka(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}}class za{constructor(e,t,i){this.type=e,this.index=t,this.input=i}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,fo),r=t.parse(e[2],2,Eo(t.expectedType||bo));if(!i||!r)return null;const n=r.type;return new za(n.itemType,i,r)}evaluate(e){const t=this.index.evaluate(e),i=this.input.evaluate(e);if(t<0)throw new da(`Array index out of bounds: ${t} < 0.`);if(t>=i.length)throw new da(`Array index out of bounds: ${t} > ${i.length-1}.`);if(t!==Math.floor(t))throw new da(`Array index must be an integer, but found ${t} instead.`);return i[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class La{constructor(e,t){this.type=yo,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,bo),r=t.parse(e[2],2,bo);return i&&r?zo(i.type,[yo,go,fo,mo,bo])?new La(i,r):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${Po(i.type)} instead`):null}evaluate(e){const t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!i)return!1;if(!Lo(t,["boolean","string","number","null"]))throw new da(`Expected first argument to be of type boolean, string, number or null, but found ${Po(xa(t))} instead.`);if(!Lo(i,["string","array"]))throw new da(`Expected second argument to be of type array or string, but found ${Po(xa(i))} instead.`);return i.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Da{constructor(e,t,i){this.type=fo,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,bo),r=t.parse(e[2],2,bo);if(!i||!r)return null;if(!zo(i.type,[yo,go,fo,mo,bo]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${Po(i.type)} instead`);if(4===e.length){const n=t.parse(e[3],3,fo);return n?new Da(i,r,n):null}return new Da(i,r)}evaluate(e){const t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!Lo(t,["boolean","string","number","null"]))throw new da(`Expected first argument to be of type boolean, string, number or null, but found ${Po(xa(t))} instead.`);let r;if(this.fromIndex&&(r=this.fromIndex.evaluate(e)),Lo(i,["string"])){const e=i.indexOf(t,r);return-1===e?-1:[...i.slice(0,e)].length}if(Lo(i,["array"]))return i.indexOf(t,r);throw new da(`Expected second argument to be of type array or string, but found ${Po(xa(i))} instead.`)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class Fa{constructor(e,t,i,r,n,o){this.inputType=e,this.type=t,this.input=i,this.cases=r,this.outputs=n,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,r;t.expectedType&&"value"!==t.expectedType.kind&&(r=t.expectedType);const n={},o=[];for(let a=2;a<e.length-1;a+=2){let s=e[a];const l=e[a+1];Array.isArray(s)||(s=[s]);const c=t.concat(a);if(0===s.length)return c.error("Expected at least one branch label.");for(const e of s){if("number"!=typeof e&&"string"!=typeof e)return c.error("Branch labels must be numbers or strings.");if("number"==typeof e&&Math.abs(e)>Number.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,xa(e)))return null}else i=xa(e);if(typeof n[String(e)]<"u")return c.error("Branch labels must be unique.");n[String(e)]=o.length}const u=t.parse(l,a,r);if(!u)return null;r=r||u.type,o.push(u)}const a=t.parse(e[1],1,bo);if(!a)return null;const s=t.parse(e[e.length-1],e.length-1,r);return!s||"value"!==a.type.kind&&t.concat(1).checkSubtype(i,a.type)?null:new Fa(i,r,a,n,o,s)}evaluate(e){const t=this.input.evaluate(e);return(xa(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()}}class Ra{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 r=[];for(let n=1;n<e.length-1;n+=2){const o=t.parse(e[n],n,yo);if(!o)return null;const a=t.parse(e[n+1],n+1,i);if(!a)return null;r.push([o,a]),i=i||a.type}const n=t.parse(e[e.length-1],e.length-1,i);if(!n)return null;if(!i)throw new Error("Can't infer output type");return new Ra(i,r,n)}evaluate(e){for(const[t,i]of this.branches)if(t.evaluate(e))return i.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[t,i]of this.branches)e(t),e(i);e(this.otherwise)}outputDefined(){return this.branches.every((([e,t])=>t.outputDefined()))&&this.otherwise.outputDefined()}}class Ba{constructor(e,t,i,r){this.type=e,this.input=t,this.beginIndex=i,this.endIndex=r}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,bo),r=t.parse(e[2],2,fo);if(!i||!r)return null;if(!zo(i.type,[Eo(bo),go,bo]))return t.error(`Expected first argument to be of type array or string, but found ${Po(i.type)} instead`);if(4===e.length){const n=t.parse(e[3],3,fo);return n?new Ba(i.type,i,r,n):null}return new Ba(i.type,i,r)}evaluate(e){const t=this.input.evaluate(e),i=this.beginIndex.evaluate(e);let r;if(this.endIndex&&(r=this.endIndex.evaluate(e)),Lo(t,["string"]))return[...t].slice(i,r).join("");if(Lo(t,["array"]))return t.slice(i,r);throw new da(`Expected first argument to be of type array or string, but found ${Po(xa(t))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Oa(e,t){const i=e.length-1;let r,n,o=0,a=i,s=0;for(;o<=a;)if(s=Math.floor((o+a)/2),r=e[s],n=e[s+1],r<=t){if(s===i||t<n)return s;o=s+1}else{if(!(r>t))throw new da("Input is not a number.");a=s-1}return 0}class ja{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,fo);if(!i)return null;const r=[];let n=null;t.expectedType&&"value"!==t.expectedType.kind&&(n=t.expectedType);for(let i=1;i<e.length;i+=2){const o=1===i?-1/0:e[i],a=e[i+1],s=i,l=i+1;if("number"!=typeof o)return t.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',s);if(r.length&&r[r.length-1][0]>=o)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',s);const c=t.parse(a,l,n);if(!c)return null;n=n||c.type,r.push([o,c])}return new ja(n,i,r)}evaluate(e){const t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);const r=this.input.evaluate(e);if(r<=t[0])return i[0].evaluate(e);const n=t.length;if(r>=t[n-1])return i[n-1].evaluate(e);return i[Oa(t,r)].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function Na(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var $a,Va;function Ua(){if(Va)return $a;function e(e,t,i,r){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*(r-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=i,this.p2y=r}return Va=1,$a=e,e.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,r=0;r<8;r++){var n=this.sampleCurveX(i)-e;if(Math.abs(n)<t)return i;var o=this.sampleCurveDerivativeX(i);if(Math.abs(o)<1e-6)break;i-=n/o}var a=0,s=1;for(i=e,r=0;r<20&&(n=this.sampleCurveX(i),!(Math.abs(n-e)<t));r++)e>n?a=i:s=i,i=.5*(s-a)+a;return i},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},$a}var qa=Ua(),Za=Na(qa);class Ga{constructor(e,t,i,r,n){this.type=e,this.operator=t,this.interpolation=i,this.input=r,this.labels=[],this.outputs=[];for(const[e,t]of n)this.labels.push(e),this.outputs.push(t)}static interpolationFactor(e,t,i,r){let n=0;if("exponential"===e.name)n=Ha(t,e.base,i,r);else if("linear"===e.name)n=Ha(t,1,i,r);else if("cubic-bezier"===e.name){const o=e.controlPoints;n=new Za(o[0],o[1],o[2],o[3]).solve(Ha(t,1,i,r))}return n}static parse(e,t){let[i,r,n,...o]=e;if(!Array.isArray(r)||0===r.length)return t.error("Expected an interpolation type expression.",1);if("linear"===r[0])r={name:"linear"};else if("exponential"===r[0]){const e=r[1];if("number"!=typeof e)return t.error("Exponential interpolation requires a numeric base.",1,1);r={name:"exponential",base:e}}else{if("cubic-bezier"!==r[0])return t.error(`Unknown interpolation type ${String(r[0])}`,1,0);{const e=r.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);r={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(n=t.parse(n,2,fo),!n)return null;const a=[];let s=null;"interpolate-hcl"===i||"interpolate-lab"===i?s=_o:t.expectedType&&"value"!==t.expectedType.kind&&(s=t.expectedType);for(let e=0;e<o.length;e+=2){const i=o[e],r=o[e+1],n=e+3,l=e+4;if("number"!=typeof i)return t.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',n);if(a.length&&a[a.length-1][0]>=i)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',n);const c=t.parse(r,l,s);if(!c)return null;s=s||c.type,a.push([i,c])}return Do(s,fo)||Do(s,vo)||Do(s,_o)||Do(s,So)||Do(s,Mo)||Do(s,Eo(fo))?new Ga(s,i,r,n,a):t.error(`Type ${Po(s)} is not interpolatable.`)}evaluate(e){const t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);const r=this.input.evaluate(e);if(r<=t[0])return i[0].evaluate(e);const n=t.length;if(r>=t[n-1])return i[n-1].evaluate(e);const o=Oa(t,r),a=t[o],s=t[o+1],l=Ga.interpolationFactor(this.interpolation,r,a,s),c=i[o].evaluate(e),u=i[o+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return aa(c,u,l);case"color":return la.interpolate(c,u,l);case"padding":return pa.interpolate(c,u,l);case"variableAnchorOffsetCollection":return fa.interpolate(c,u,l);case"array":return sa(c,u,l);case"projectionDefinition":return ya.interpolate(c,u,l)}case"interpolate-hcl":return la.interpolate(c,u,l,"hcl");case"interpolate-lab":return la.interpolate(c,u,l,"lab")}}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function Ha(e,t,i,r){const n=r-i,o=e-i;return 0===n?0:1===t?o/n:(Math.pow(t,o)-1)/(Math.pow(t,n)-1)}class Wa{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=null;const r=t.expectedType;r&&"value"!==r.kind&&(i=r);const n=[];for(const r of e.slice(1)){const e=t.parse(r,1+n.length,i,void 0,{typeAnnotation:"omit"});if(!e)return null;i=i||e.type,n.push(e)}if(!i)throw new Error("No output type");return r&&n.some((e=>ko(r,e.type)))?new Wa(bo,n):new Wa(i,n)}evaluate(e){let t,i=null,r=0;for(const n of this.args)if(r++,i=n.evaluate(e),i&&i instanceof ga&&!i.available&&(t||(t=i.name),i=null,r===this.args.length&&(i=t)),null!==i)break;return i}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}function Ka(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 Xa(e,t,i){return t===i}function Ya(e,t,i){return t!==i}function Ja(e,t,i){return t<i}function Qa(e,t,i){return t>i}function es(e,t,i){return t<=i}function ts(e,t,i){return t>=i}function is(e,t,i,r){return 0===r.compare(t,i)}function rs(e,t,i,r){return!is(e,t,i,r)}function ns(e,t,i,r){return r.compare(t,i)<0}function os(e,t,i,r){return r.compare(t,i)>0}function as(e,t,i,r){return r.compare(t,i)<=0}function ss(e,t,i,r){return r.compare(t,i)>=0}function ls(e,t,i){const r="=="!==e&&"!="!==e;return class n{constructor(e,t,i){this.type=yo,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,bo);if(!o)return null;if(!Ka(i,o.type))return t.concat(1).error(`"${i}" comparisons are not supported for type '${Po(o.type)}'.`);let a=t.parse(e[2],2,bo);if(!a)return null;if(!Ka(i,a.type))return t.concat(2).error(`"${i}" comparisons are not supported for type '${Po(a.type)}'.`);if(o.type.kind!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return t.error(`Cannot compare types '${Po(o.type)}' and '${Po(a.type)}'.`);r&&("value"===o.type.kind&&"value"!==a.type.kind?o=new Ta(a.type,[o]):"value"!==o.type.kind&&"value"===a.type.kind&&(a=new Ta(o.type,[a])));let s=null;if(4===e.length){if("string"!==o.type.kind&&"string"!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return t.error("Cannot use collator to compare non-string types.");if(s=t.parse(e[3],3,Co),!s)return null}return new n(o,a,s)}evaluate(n){const o=this.lhs.evaluate(n),a=this.rhs.evaluate(n);if(r&&this.hasUntypedArgument){const t=xa(o),i=xa(a);if(t.kind!==i.kind||"string"!==t.kind&&"number"!==t.kind)throw new da(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${i.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){const e=xa(o),i=xa(a);if("string"!==e.kind||"string"!==i.kind)return t(n,o,a)}return this.collator?i(n,o,a,this.collator.evaluate(n)):t(n,o,a)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}}}const cs=ls("==",Xa,is),us=ls("!=",Ya,rs),hs=ls("<",Ja,ns),ps=ls(">",Qa,os),ds=ls("<=",es,as),ms=ls(">=",ts,ss);class fs{constructor(e,t,i){this.type=Co,this.locale=i,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(2!==e.length)return t.error("Expected one argument.");const i=e[1];if("object"!=typeof i||Array.isArray(i))return t.error("Collator options argument must be an object.");const r=t.parse(void 0!==i["case-sensitive"]&&i["case-sensitive"],1,yo);if(!r)return null;const n=t.parse(void 0!==i["diacritic-sensitive"]&&i["diacritic-sensitive"],1,yo);if(!n)return null;let o=null;return i.locale&&(o=t.parse(i.locale,1,go),!o)?null:new fs(r,n,o)}evaluate(e){return new ca(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}class gs{constructor(e,t,i,r,n){this.type=go,this.number=e,this.locale=t,this.currency=i,this.minFractionDigits=r,this.maxFractionDigits=n}static parse(e,t){if(3!==e.length)return t.error("Expected two arguments.");const i=t.parse(e[1],1,fo);if(!i)return null;const r=e[2];if("object"!=typeof r||Array.isArray(r))return t.error("NumberFormat options argument must be an object.");let n=null;if(r.locale&&(n=t.parse(r.locale,1,go),!n))return null;let o=null;if(r.currency&&(o=t.parse(r.currency,1,go),!o))return null;let a=null;if(r["min-fraction-digits"]&&(a=t.parse(r["min-fraction-digits"],1,fo),!a))return null;let s=null;return r["max-fraction-digits"]&&(s=t.parse(r["max-fraction-digits"],1,fo),!s)?null:new gs(i,n,o,a,s)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class ys{constructor(e){this.type=To,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 r=[];let n=!1;for(let i=1;i<=e.length-1;++i){const o=e[i];if(n&&"object"==typeof o&&!Array.isArray(o)){n=!1;let e=null;if(o["font-scale"]&&(e=t.parse(o["font-scale"],1,fo),!e))return null;let i=null;if(o["text-font"]&&(i=t.parse(o["text-font"],1,Eo(go)),!i))return null;let a=null;if(o["text-color"]&&(a=t.parse(o["text-color"],1,_o),!a))return null;const s=r[r.length-1];s.scale=e,s.font=i,s.textColor=a}else{const o=t.parse(e[i],1,bo);if(!o)return null;const a=o.type.kind;if("string"!==a&&"value"!==a&&"null"!==a&&"resolvedImage"!==a)return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");n=!0,r.push({content:o,scale:null,font:null,textColor:null})}}return new ys(r)}evaluate(e){return new ha(this.sections.map((t=>{const i=t.content.evaluate(e);return xa(i)===Ao?new ua("",i,null,null,null):new ua(ba(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}}class _s{constructor(e){this.type=Ao,this.input=e}static parse(e,t){if(2!==e.length)return t.error("Expected two arguments.");const i=t.parse(e[1],1,go);return i?new _s(i):t.error("No image name provided.")}evaluate(e){const t=this.input.evaluate(e),i=ga.fromString(t);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(t)>-1),i}eachChild(e){e(this.input)}outputDefined(){return!1}}class vs{constructor(e){this.type=fo,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 ${Po(i.type)} instead.`):new vs(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 da(`Expected value to be of type string or array, but found ${Po(xa(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const xs=8192;function bs(e,t){const i=Cs(e[0]),r=Ss(e[1]),n=Math.pow(2,t.z);return[Math.round(i*n*xs),Math.round(r*n*xs)]}function ws(e,t){const i=Math.pow(2,t.z),r=(e[0]/xs+t.x)/i,n=(e[1]/xs+t.y)/i;return[Ts(r),As(n)]}function Cs(e){return(180+e)/360}function Ts(e){return 360*e-180}function Ss(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function As(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}function Ms(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function Es(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function Ps(e,t,i){return t[1]>e[1]!=i[1]>e[1]&&e[0]<(i[0]-t[0])*(e[1]-t[1])/(i[1]-t[1])+t[0]}function Is(e,t,i){const r=e[0]-t[0],n=e[1]-t[1],o=e[0]-i[0],a=e[1]-i[1];return r*a-o*n==0&&r*o<=0&&n*a<=0}function ks(e,t,i,r){const n=[t[0]-e[0],t[1]-e[1]];return 0!==Bs([r[0]-i[0],r[1]-i[1]],n)&&!(!Os(e,t,i,r)||!Os(i,r,e,t))}function zs(e,t,i){for(const r of i)for(let i=0;i<r.length-1;++i)if(ks(e,t,r[i],r[i+1]))return!0;return!1}function Ls(e,t,i=!1){let r=!1;for(const n of t)for(let t=0;t<n.length-1;t++){if(Is(e,n[t],n[t+1]))return i;Ps(e,n[t],n[t+1])&&(r=!r)}return r}function Ds(e,t){for(const i of t)if(Ls(e,i))return!0;return!1}function Fs(e,t){for(const i of e)if(!Ls(i,t))return!1;for(let i=0;i<e.length-1;++i)if(zs(e[i],e[i+1],t))return!1;return!0}function Rs(e,t){for(const i of t)if(Fs(e,i))return!0;return!1}function Bs(e,t){return e[0]*t[1]-e[1]*t[0]}function Os(e,t,i,r){const n=e[0]-i[0],o=e[1]-i[1],a=t[0]-i[0],s=t[1]-i[1],l=r[0]-i[0],c=r[1]-i[1],u=n*c-l*o,h=a*c-l*s;return u>0&&h<0||u<0&&h>0}function js(e,t,i){const r=[];for(let n=0;n<e.length;n++){const o=[];for(let r=0;r<e[n].length;r++){const a=bs(e[n][r],i);Ms(t,a),o.push(a)}r.push(o)}return r}function Ns(e,t,i){const r=[];for(let n=0;n<e.length;n++){const o=js(e[n],t,i);r.push(o)}return r}function $s(e,t,i,r){if(e[0]<i[0]||e[0]>i[2]){const t=.5*r;let n=e[0]-i[0]>t?-r:i[0]-e[0]>t?r:0;0===n&&(n=e[0]-i[2]>t?-r:i[2]-e[0]>t?r:0),e[0]+=n}Ms(t,e)}function Vs(e){e[0]=e[1]=1/0,e[2]=e[3]=-1/0}function Us(e,t,i,r){const n=Math.pow(2,r.z)*xs,o=[r.x*xs,r.y*xs],a=[];for(const r of e)for(const e of r){const r=[e.x+o[0],e.y+o[1]];$s(r,t,i,n),a.push(r)}return a}function qs(e,t,i,r){const n=Math.pow(2,r.z)*xs,o=[r.x*xs,r.y*xs],a=[];for(const i of e){const e=[];for(const r of i){const i=[r.x+o[0],r.y+o[1]];Ms(t,i),e.push(i)}a.push(e)}if(t[2]-t[0]<=n/2){Vs(t);for(const e of a)for(const r of e)$s(r,t,i,n)}return a}function Zs(e,t){const i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if("Polygon"===t.type){const o=js(t.coordinates,r,n),a=Us(e.geometry(),i,r,n);if(!Es(i,r))return!1;for(const e of a)if(!Ls(e,o))return!1}if("MultiPolygon"===t.type){const o=Ns(t.coordinates,r,n),a=Us(e.geometry(),i,r,n);if(!Es(i,r))return!1;for(const e of a)if(!Ds(e,o))return!1}return!0}function Gs(e,t){const i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if("Polygon"===t.type){const o=js(t.coordinates,r,n),a=qs(e.geometry(),i,r,n);if(!Es(i,r))return!1;for(const e of a)if(!Fs(e,o))return!1}if("MultiPolygon"===t.type){const o=Ns(t.coordinates,r,n),a=qs(e.geometry(),i,r,n);if(!Es(i,r))return!1;for(const e of a)if(!Rs(e,o))return!1}return!0}class Hs{constructor(e,t){this.type=yo,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(va(e[1])){const t=e[1];if("FeatureCollection"===t.type){const e=[];for(const i of t.features){const{type:t,coordinates:r}=i.geometry;"Polygon"===t&&e.push(r),"MultiPolygon"===t&&e.push(...r)}if(e.length){return new Hs(t,{type:"MultiPolygon",coordinates:e})}}else if("Feature"===t.type){const e=t.geometry.type;if("Polygon"===e||"MultiPolygon"===e)return new Hs(t,t.geometry)}else if("Polygon"===t.type||"MultiPolygon"===t.type)return new Hs(t,t)}return t.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return Zs(e,this.geometries);if("LineString"===e.geometryType())return Gs(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class Ws{constructor(e=[],t=(e,t)=>e<t?-1:e>t?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;const e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:i}=this,r=t[e];for(;e>0;){const n=e-1>>1,o=t[n];if(i(r,o)>=0)break;t[e]=o,e=n}t[e]=r}_down(e){const{data:t,compare:i}=this,r=this.length>>1,n=t[e];for(;e<r;){let r=1+(e<<1);const o=r+1;if(o<this.length&&i(t[o],t[r])<0&&(r=o),i(t[r],n)>=0)break;t[e]=t[r],e=r}t[e]=n}}function Ks(e,t){if(e.length<=1)return[e];const i=[];let r,n;for(const t of e){const e=Xs(t);0!==e&&(t.area=Math.abs(e),void 0===n&&(n=e<0),n===e<0?(r&&i.push(r),r=[t]):r.push(t))}return r&&i.push(r),i}function Xs(e){let t=0;for(let i,r,n=0,o=e.length,a=o-1;n<o;a=n++)i=e[n],r=e[a],t+=(r.x-i.x)*(i.y+r.y);return t}const Ys=6378.137,Js=1/298.257223563,Qs=Js*(2-Js),el=Math.PI/180;class tl{constructor(e){const t=el*Ys*1e3,i=Math.cos(e*el),r=1/(1-Qs*(1-i*i)),n=Math.sqrt(r);this.kx=t*n*i,this.ky=t*n*r*(1-Qs)}distance(e,t){const i=this.wrap(e[0]-t[0])*this.kx,r=(e[1]-t[1])*this.ky;return Math.sqrt(i*i+r*r)}pointOnLine(e,t){let i,r,n,o,a=1/0;for(let s=0;s<e.length-1;s++){let l=e[s][0],c=e[s][1],u=this.wrap(e[s+1][0]-l)*this.kx,h=(e[s+1][1]-c)*this.ky,p=0;(0!==u||0!==h)&&(p=(this.wrap(t[0]-l)*this.kx*u+(t[1]-c)*this.ky*h)/(u*u+h*h),p>1?(l=e[s+1][0],c=e[s+1][1]):p>0&&(l+=u/this.kx*p,c+=h/this.ky*p)),u=this.wrap(t[0]-l)*this.kx,h=(t[1]-c)*this.ky;const d=u*u+h*h;d<a&&(a=d,i=l,r=c,n=s,o=p)}return{point:[i,r],index:n,t:Math.max(0,Math.min(1,o))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}}const il=100,rl=50;function nl(e,t){return t[0]-e[0]}function ol(e){return e[1]-e[0]+1}function al(e,t){return e[1]>=e[0]&&e[1]<t}function sl(e,t){if(e[0]>e[1])return[null,null];const i=ol(e);if(t){if(2===i)return[e,null];const t=Math.floor(i/2);return[[e[0],e[0]+t],[e[0]+t,e[1]]]}if(1===i)return[e,null];const r=Math.floor(i/2)-1;return[[e[0],e[0]+r],[e[0]+r+1,e[1]]]}function ll(e,t){if(!al(t,e.length))return[1/0,1/0,-1/0,-1/0];const i=[1/0,1/0,-1/0,-1/0];for(let r=t[0];r<=t[1];++r)Ms(i,e[r]);return i}function cl(e){const t=[1/0,1/0,-1/0,-1/0];for(const i of e)for(const e of i)Ms(t,e);return t}function ul(e){return e[0]!==-1/0&&e[1]!==-1/0&&e[2]!==1/0&&e[3]!==1/0}function hl(e,t,i){if(!ul(e)||!ul(t))return NaN;let r=0,n=0;return e[2]<t[0]&&(r=t[0]-e[2]),e[0]>t[2]&&(r=e[0]-t[2]),e[1]>t[3]&&(n=e[1]-t[3]),e[3]<t[1]&&(n=t[1]-e[3]),i.distance([0,0],[r,n])}function pl(e,t,i){const r=i.pointOnLine(t,e);return i.distance(e,r.point)}function dl(e,t,i,r,n){const o=Math.min(pl(e,[i,r],n),pl(t,[i,r],n)),a=Math.min(pl(i,[e,t],n),pl(r,[e,t],n));return Math.min(o,a)}function ml(e,t,i,r,n){if(!al(t,e.length)||!al(r,i.length))return 1/0;let o=1/0;for(let a=t[0];a<t[1];++a){const t=e[a],s=e[a+1];for(let e=r[0];e<r[1];++e){const r=i[e],a=i[e+1];if(ks(t,s,r,a))return 0;o=Math.min(o,dl(t,s,r,a,n))}}return o}function fl(e,t,i,r,n){if(!al(t,e.length)||!al(r,i.length))return NaN;let o=1/0;for(let a=t[0];a<=t[1];++a)for(let t=r[0];t<=r[1];++t)if(o=Math.min(o,n.distance(e[a],i[t])),0===o)return o;return o}function gl(e,t,i){if(Ls(e,t,!0))return 0;let r=1/0;for(const n of t){const t=n[0],o=n[n.length-1];if(t!==o&&(r=Math.min(r,pl(e,[o,t],i)),0===r))return r;const a=i.pointOnLine(n,e);if(r=Math.min(r,i.distance(e,a.point)),0===r)return r}return r}function yl(e,t,i,r){if(!al(t,e.length))return NaN;for(let r=t[0];r<=t[1];++r)if(Ls(e[r],i,!0))return 0;let n=1/0;for(let o=t[0];o<t[1];++o){const t=e[o],a=e[o+1];for(const e of i)for(let i=0,o=e.length,s=o-1;i<o;s=i++){const o=e[s],l=e[i];if(ks(t,a,o,l))return 0;n=Math.min(n,dl(t,a,o,l,r))}}return n}function _l(e,t){for(const i of e)for(const e of i)if(Ls(e,t,!0))return!0;return!1}function vl(e,t,i,r=1/0){const n=cl(e),o=cl(t);if(r!==1/0&&hl(n,o,i)>=r)return r;if(Es(n,o)){if(_l(e,t))return 0}else if(_l(t,e))return 0;let a=1/0;for(const r of e)for(let e=0,n=r.length,o=n-1;e<n;o=e++){const n=r[o],s=r[e];for(const e of t)for(let t=0,r=e.length,o=r-1;t<r;o=t++){const r=e[o],l=e[t];if(ks(n,s,r,l))return 0;a=Math.min(a,dl(n,s,r,l,i))}}return a}function xl(e,t,i,r,n,o){if(!o)return;const a=hl(ll(r,o),n,i);a<t&&e.push([a,o,[0,0]])}function bl(e,t,i,r,n,o,a){if(!o||!a)return;const s=hl(ll(r,o),ll(n,a),i);s<t&&e.push([s,o,a])}function wl(e,t,i,r,n=1/0){let o=Math.min(r.distance(e[0],i[0][0]),n);if(0===o)return o;const a=new Ws([[0,[0,e.length-1],[0,0]]],nl),s=cl(i);for(;a.length>0;){const n=a.pop();if(n[0]>=o)continue;const l=n[1],c=t?rl:il;if(ol(l)<=c){if(!al(l,e.length))return NaN;if(t){const t=yl(e,l,i,r);if(isNaN(t)||0===t)return t;o=Math.min(o,t)}else for(let t=l[0];t<=l[1];++t){const n=gl(e[t],i,r);if(o=Math.min(o,n),0===o)return 0}}else{const i=sl(l,t);xl(a,o,r,e,s,i[0]),xl(a,o,r,e,s,i[1])}}return o}function Cl(e,t,i,r,n,o=1/0){let a=Math.min(o,n.distance(e[0],i[0]));if(0===a)return a;const s=new Ws([[0,[0,e.length-1],[0,i.length-1]]],nl);for(;s.length>0;){const o=s.pop();if(o[0]>=a)continue;const l=o[1],c=o[2],u=t?rl:il,h=r?rl:il;if(ol(l)<=u&&ol(c)<=h){if(!al(l,e.length)&&al(c,i.length))return NaN;let o;if(t&&r)o=ml(e,l,i,c,n),a=Math.min(a,o);else if(t&&!r){const t=e.slice(l[0],l[1]+1);for(let e=c[0];e<=c[1];++e)if(o=pl(i[e],t,n),a=Math.min(a,o),0===a)return a}else if(!t&&r){const t=i.slice(c[0],c[1]+1);for(let i=l[0];i<=l[1];++i)if(o=pl(e[i],t,n),a=Math.min(a,o),0===a)return a}else o=fl(e,l,i,c,n),a=Math.min(a,o)}else{const o=sl(l,t),u=sl(c,r);bl(s,a,n,e,i,o[0],u[0]),bl(s,a,n,e,i,o[0],u[1]),bl(s,a,n,e,i,o[1],u[0]),bl(s,a,n,e,i,o[1],u[1])}}return a}function Tl(e,t){const i=e.geometry(),r=i.flat().map((t=>ws([t.x,t.y],e.canonical)));if(0===i.length)return NaN;const n=new tl(r[0][1]);let o=1/0;for(const e of t){switch(e.type){case"Point":o=Math.min(o,Cl(r,!1,[e.coordinates],!1,n,o));break;case"LineString":o=Math.min(o,Cl(r,!1,e.coordinates,!0,n,o));break;case"Polygon":o=Math.min(o,wl(r,!1,e.coordinates,n,o))}if(0===o)return o}return o}function Sl(e,t){const i=e.geometry(),r=i.flat().map((t=>ws([t.x,t.y],e.canonical)));if(0===i.length)return NaN;const n=new tl(r[0][1]);let o=1/0;for(const e of t){switch(e.type){case"Point":o=Math.min(o,Cl(r,!0,[e.coordinates],!1,n,o));break;case"LineString":o=Math.min(o,Cl(r,!0,e.coordinates,!0,n,o));break;case"Polygon":o=Math.min(o,wl(r,!0,e.coordinates,n,o))}if(0===o)return o}return o}function Al(e,t){const i=e.geometry();if(0===i.length||0===i[0].length)return NaN;const r=Ks(i).map((t=>t.map((t=>t.map((t=>ws([t.x,t.y],e.canonical))))))),n=new tl(r[0][0][0][1]);let o=1/0;for(const e of t)for(const t of r){switch(e.type){case"Point":o=Math.min(o,wl([e.coordinates],!1,t,n,o));break;case"LineString":o=Math.min(o,wl(e.coordinates,!0,t,n,o));break;case"Polygon":o=Math.min(o,vl(t,e.coordinates,n,o))}if(0===o)return o}return o}function Ml(e){return"MultiPolygon"===e.type?e.coordinates.map((e=>({type:"Polygon",coordinates:e}))):"MultiLineString"===e.type?e.coordinates.map((e=>({type:"LineString",coordinates:e}))):"MultiPoint"===e.type?e.coordinates.map((e=>({type:"Point",coordinates:e}))):[e]}class El{constructor(e,t){this.type=fo,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(va(e[1])){const t=e[1];if("FeatureCollection"===t.type)return new El(t,t.features.map((e=>Ml(e.geometry))).flat());if("Feature"===t.type)return new El(t,Ml(t.geometry));if("type"in t&&"coordinates"in t)return new El(t,Ml(t))}return t.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return Tl(e,this.geometries);if("LineString"===e.geometryType())return Sl(e,this.geometries);if("Polygon"===e.geometryType())return Al(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const Pl={"==":cs,"!=":us,">":ps,"<":hs,">=":ms,"<=":ds,array:Ta,at:za,boolean:Ta,case:Ra,coalesce:Wa,collator:fs,format:ys,image:_s,in:La,"index-of":Da,interpolate:Ga,"interpolate-hcl":Ga,"interpolate-lab":Ga,length:vs,let:Ia,literal:wa,match:Fa,number:Ta,"number-format":gs,object:Ta,slice:Ba,step:ja,string:Ta,"to-boolean":Aa,"to-color":Aa,"to-number":Aa,"to-string":Aa,var:ka,within:Hs,distance:El};class Il{constructor(e,t,i,r){this.name=e,this.type=t,this._evaluate=i,this.args=r}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,t){const i=e[0],r=Il.definitions[i];if(!r)return t.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const n=Array.isArray(r)?r[0]:r.type,o=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,a=o.filter((([t])=>!Array.isArray(t)||t.length===e.length-1));let s=null;for(const[r,o]of a){s=new Pa(t.registry,Bl,t.path,null,t.scope);const a=[];let l=!1;for(let t=1;t<e.length;t++){const i=e[t],n=Array.isArray(r)?r[t-1]:r.type,o=s.parse(i,1+a.length,n);if(!o){l=!0;break}a.push(o)}if(!l){if(Array.isArray(r)&&r.length!==a.length){s.error(`Expected ${r.length} arguments, but found ${a.length} instead.`);continue}for(let e=0;e<a.length;e++){const t=Array.isArray(r)?r[e]:r.type,i=a[e];s.concat(e+1).checkSubtype(t,i.type)}if(0===s.errors.length)return new Il(i,n,o,a)}}if(1===a.length)t.errors.push(...s.errors);else{const i=(a.length?a:o).map((([e])=>Rl(e))).join(" | "),r=[];for(let i=1;i<e.length;i++){const n=t.parse(e[i],1+r.length);if(!n)return null;r.push(Po(n.type))}t.error(`Expected arguments of type ${i}, but found (${r.join(", ")}) instead.`)}return null}static register(e,t){Il.definitions=t;for(const i in t)e[i]=Il}}function kl(e,[t,i,r,n]){t=t.evaluate(e),i=i.evaluate(e),r=r.evaluate(e);const o=n?n.evaluate(e):1,a=_a(t,i,r,o);if(a)throw new da(a);return new la(t/255,i/255,r/255,o,!1)}function zl(e,t){return e in t}function Ll(e,t){const i=t[e];return typeof i>"u"?null:i}function Dl(e,t,i,r){for(;i<=r;){const n=i+r>>1;if(t[n]===e)return!0;t[n]>e?r=n-1:i=n+1}return!1}function Fl(e){return{type:e}}function Rl(e){return Array.isArray(e)?`(${e.map(Po).join(", ")})`:`(${Po(e.type)}...)`}function Bl(e){if(e instanceof ka)return Bl(e.boundExpression);if(e instanceof Il&&"error"===e.name)return!1;if(e instanceof fs)return!1;if(e instanceof Hs)return!1;if(e instanceof El)return!1;const t=e instanceof Aa||e instanceof Ta;let i=!0;return e.eachChild((e=>{i=t?i&&Bl(e):i&&e instanceof wa})),!!i&&(Ol(e)&&Nl(e,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"]))}function Ol(e){if(e instanceof Il){if("get"===e.name&&1===e.args.length)return!1;if("feature-state"===e.name)return!1;if("has"===e.name&&1===e.args.length)return!1;if("properties"===e.name||"geometry-type"===e.name||"id"===e.name)return!1;if(/^filter-/.test(e.name))return!1}if(e instanceof Hs||e instanceof El)return!1;let t=!0;return e.eachChild((e=>{t&&!Ol(e)&&(t=!1)})),t}function jl(e){if(e instanceof Il&&"feature-state"===e.name)return!1;let t=!0;return e.eachChild((e=>{t&&!jl(e)&&(t=!1)})),t}function Nl(e,t){if(e instanceof Il&&t.indexOf(e.name)>=0)return!1;let i=!0;return e.eachChild((e=>{i&&!Nl(e,t)&&(i=!1)})),i}function $l(e){return{result:"success",value:e}}function Vl(e){return{result:"error",value:e}}function Ul(e){return"data-driven"===e["property-type"]||"cross-faded-data-driven"===e["property-type"]}function ql(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function Zl(e){return!!e.expression&&e.expression.interpolated}function Gl(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}function Hl(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}Il.register(Pl,{error:[wo,[go],(e,[t])=>{throw new da(t.evaluate(e))}],typeof:[go,[bo],(e,[t])=>Po(xa(t.evaluate(e)))],"to-rgba":[Eo(fo,4),[_o],(e,[t])=>{const[i,r,n,o]=t.evaluate(e).rgb;return[255*i,255*r,255*n,o]}],rgb:[_o,[fo,fo,fo],kl],rgba:[_o,[fo,fo,fo,fo],kl],has:{type:yo,overloads:[[[go],(e,[t])=>zl(t.evaluate(e),e.properties())],[[go,xo],(e,[t,i])=>zl(t.evaluate(e),i.evaluate(e))]]},get:{type:bo,overloads:[[[go],(e,[t])=>Ll(t.evaluate(e),e.properties())],[[go,xo],(e,[t,i])=>Ll(t.evaluate(e),i.evaluate(e))]]},"feature-state":[bo,[go],(e,[t])=>Ll(t.evaluate(e),e.featureState||{})],properties:[xo,[],e=>e.properties()],"geometry-type":[go,[],e=>e.geometryType()],id:[bo,[],e=>e.id()],zoom:[fo,[],e=>e.globals.zoom],"heatmap-density":[fo,[],e=>e.globals.heatmapDensity||0],"line-progress":[fo,[],e=>e.globals.lineProgress||0],accumulated:[bo,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[fo,Fl(fo),(e,t)=>{let i=0;for(const r of t)i+=r.evaluate(e);return i}],"*":[fo,Fl(fo),(e,t)=>{let i=1;for(const r of t)i*=r.evaluate(e);return i}],"-":{type:fo,overloads:[[[fo,fo],(e,[t,i])=>t.evaluate(e)-i.evaluate(e)],[[fo],(e,[t])=>-t.evaluate(e)]]},"/":[fo,[fo,fo],(e,[t,i])=>t.evaluate(e)/i.evaluate(e)],"%":[fo,[fo,fo],(e,[t,i])=>t.evaluate(e)%i.evaluate(e)],ln2:[fo,[],()=>Math.LN2],pi:[fo,[],()=>Math.PI],e:[fo,[],()=>Math.E],"^":[fo,[fo,fo],(e,[t,i])=>Math.pow(t.evaluate(e),i.evaluate(e))],sqrt:[fo,[fo],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[fo,[fo],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[fo,[fo],(e,[t])=>Math.log(t.evaluate(e))],log2:[fo,[fo],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[fo,[fo],(e,[t])=>Math.sin(t.evaluate(e))],cos:[fo,[fo],(e,[t])=>Math.cos(t.evaluate(e))],tan:[fo,[fo],(e,[t])=>Math.tan(t.evaluate(e))],asin:[fo,[fo],(e,[t])=>Math.asin(t.evaluate(e))],acos:[fo,[fo],(e,[t])=>Math.acos(t.evaluate(e))],atan:[fo,[fo],(e,[t])=>Math.atan(t.evaluate(e))],min:[fo,Fl(fo),(e,t)=>Math.min(...t.map((t=>t.evaluate(e))))],max:[fo,Fl(fo),(e,t)=>Math.max(...t.map((t=>t.evaluate(e))))],abs:[fo,[fo],(e,[t])=>Math.abs(t.evaluate(e))],round:[fo,[fo],(e,[t])=>{const i=t.evaluate(e);return i<0?-Math.round(-i):Math.round(i)}],floor:[fo,[fo],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[fo,[fo],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[yo,[go,bo],(e,[t,i])=>e.properties()[t.value]===i.value],"filter-id-==":[yo,[bo],(e,[t])=>e.id()===t.value],"filter-type-==":[yo,[go],(e,[t])=>e.geometryType()===t.value],"filter-<":[yo,[go,bo],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r<n}],"filter-id-<":[yo,[bo],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i<r}],"filter->":[yo,[go,bo],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r>n}],"filter-id->":[yo,[bo],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i>r}],"filter-<=":[yo,[go,bo],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r<=n}],"filter-id-<=":[yo,[bo],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i<=r}],"filter->=":[yo,[go,bo],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r>=n}],"filter-id->=":[yo,[bo],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i>=r}],"filter-has":[yo,[bo],(e,[t])=>t.value in e.properties()],"filter-has-id":[yo,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[yo,[Eo(go)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[yo,[Eo(bo)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[yo,[go,Eo(bo)],(e,[t,i])=>i.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[yo,[go,Eo(bo)],(e,[t,i])=>Dl(e.properties()[t.value],i.value,0,i.value.length-1)],all:{type:yo,overloads:[[[yo,yo],(e,[t,i])=>t.evaluate(e)&&i.evaluate(e)],[Fl(yo),(e,t)=>{for(const i of t)if(!i.evaluate(e))return!1;return!0}]]},any:{type:yo,overloads:[[[yo,yo],(e,[t,i])=>t.evaluate(e)||i.evaluate(e)],[Fl(yo),(e,t)=>{for(const i of t)if(i.evaluate(e))return!0;return!1}]]},"!":[yo,[yo],(e,[t])=>!t.evaluate(e)],"is-supported-script":[yo,[go],(e,[t])=>{const i=e.globals&&e.globals.isSupportedScript;return!i||i(t.evaluate(e))}],upcase:[go,[go],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[go,[go],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[go,Fl(bo),(e,t)=>t.map((t=>ba(t.evaluate(e)))).join("")],"resolved-locale":[go,[Co],(e,[t])=>t.evaluate(e).resolvedLocale()]});class Wl{constructor(e,t){this.expression=e,this._warningHistory={},this._evaluator=new Ea,this._defaultValue=t?ic(t):null,this._enumValues=t&&"enum"===t.type?t.values:null}evaluateWithoutErrorHandling(e,t,i,r,n,o){return this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=i,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)}evaluate(e,t,i,r,n,o){this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=i||null,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o||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 da(`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,typeof console<"u"&&console.warn(e.message)),this._defaultValue}}}function Kl(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in Pl}function Xl(e,t){const i=new Pa(Pl,Bl,[],t?tc(t):void 0),r=i.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return r?$l(new Wl(r,t)):Vl(i.errors)}class Yl{constructor(e,t){this.kind=e,this._styleExpression=t,this.isStateDependent="constant"!==e&&!jl(t.expression)}evaluateWithoutErrorHandling(e,t,i,r,n,o){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,n,o)}evaluate(e,t,i,r,n,o){return this._styleExpression.evaluate(e,t,i,r,n,o)}}class Jl{constructor(e,t,i,r){this.kind=e,this.zoomStops=i,this._styleExpression=t,this.isStateDependent="camera"!==e&&!jl(t.expression),this.interpolationType=r}evaluateWithoutErrorHandling(e,t,i,r,n,o){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,n,o)}evaluate(e,t,i,r,n,o){return this._styleExpression.evaluate(e,t,i,r,n,o)}interpolationFactor(e,t,i){return this.interpolationType?Ga.interpolationFactor(this.interpolationType,e,t,i):0}}function Ql(e,t){const i=Xl(e,t);if("error"===i.result)return i;const r=i.value.expression,n=Ol(r);if(!n&&!Ul(t))return Vl([new ho("","data expressions not supported")]);const o=Nl(r,["zoom"]);if(!o&&!ql(t))return Vl([new ho("","zoom expressions not supported")]);const a=ec(r);if(!a&&!o)return Vl([new ho("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(a instanceof ho)return Vl([a]);if(a instanceof Ga&&!Zl(t))return Vl([new ho("",'"interpolate" expressions cannot be used with this property')]);if(!a)return $l(new Yl(n?"constant":"source",i.value));const s=a instanceof Ga?a.interpolation:void 0;return $l(new Jl(n?"camera":"composite",i.value,a.labels,s))}function ec(e){let t=null;if(e instanceof Ia)t=ec(e.result);else if(e instanceof Wa){for(const i of e.args)if(t=ec(i),t)break}else(e instanceof ja||e instanceof Ga)&&e.input instanceof Il&&"zoom"===e.input.name&&(t=e);return t instanceof ho||e.eachChild((e=>{const i=ec(e);i instanceof ho?t=i:!t&&i?t=new ho("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&i&&t!==i&&(t=new ho("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),t}function tc(e){const t={color:_o,string:go,number:fo,enum:go,boolean:yo,formatted:To,padding:So,projectionDefinition:vo,resolvedImage:Ao,variableAnchorOffsetCollection:Mo};return"array"===e.type?Eo(t[e.value]||bo,e.length):t[e.type]}function ic(e){return"color"===e.type&&Hl(e.default)?new la(0,0,0,0):"color"===e.type?la.parse(e.default)||null:"padding"===e.type?pa.parse(e.default)||null:"variableAnchorOffsetCollection"===e.type?fa.parse(e.default)||null:"projectionDefinition"===e.type?ya.parse(e.default)||null:void 0===e.default?null:e.default}function rc(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(!rc(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}}function nc(e){const t=e.key,i=e.value;return i?[new co(t,i,"constants have been deprecated as of v8")]:[]}function oc(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function ac(e){if(Array.isArray(e))return e.map(ac);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){const t={};for(const i in e)t[i]=ac(e[i]);return t}return oc(e)}function sc(e){const t=e.key,i=e.value,r=e.valueSpec||{},n=e.objectElementValidators||{},o=e.style,a=e.styleSpec,s=e.validateSpec;let l=[];const c=Gl(i);if("object"!==c)return[new co(t,i,`object expected, ${c} found`)];for(const e in i){const c=e.split(".")[0],u=r[c]||r["*"];let h;if(n[c])h=n[c];else if(r[c])h=s;else if(n["*"])h=n["*"];else{if(!r["*"]){l.push(new co(t,i[e],`unknown property "${e}"`));continue}h=s}l=l.concat(h({key:(t&&`${t}.`)+e,value:i[e],valueSpec:u,style:o,styleSpec:a,object:i,objectKey:e,validateSpec:s},i))}for(const e in r)n[e]||r[e].required&&void 0===r[e].default&&void 0===i[e]&&l.push(new co(t,i,`missing required property "${e}"`));return l}function lc(e){const t=e.value,i=e.valueSpec,r=e.validateSpec,n=e.style,o=e.styleSpec,a=e.key,s=e.arrayElementValidator||r;if("array"!==Gl(t))return[new co(a,t,`array expected, ${Gl(t)} found`)];if(i.length&&t.length!==i.length)return[new co(a,t,`array length ${i.length} expected, length ${t.length} found`)];if(i["min-length"]&&t.length<i["min-length"])return[new co(a,t,`array length at least ${i["min-length"]} expected, length ${t.length} found`)];let l={type:i.value,values:i.values};o.$version<7&&(l.function=i.function),"object"===Gl(i.value)&&(l=i.value);let c=[];for(let i=0;i<t.length;i++)c=c.concat(s({array:t,arrayIndex:i,value:t[i],valueSpec:l,validateSpec:e.validateSpec,style:n,styleSpec:o,key:`${a}[${i}]`}));return c}function cc(e){const t=e.key,i=e.value,r=e.valueSpec;let n=Gl(i);return"number"===n&&i!=i&&(n="NaN"),"number"!==n?[new co(t,i,`number expected, ${n} found`)]:"minimum"in r&&i<r.minimum?[new co(t,i,`${i} is less than the minimum value ${r.minimum}`)]:"maximum"in r&&i>r.maximum?[new co(t,i,`${i} is greater than the maximum value ${r.maximum}`)]:[]}function uc(e){const t=e.valueSpec,i=oc(e.value.type);let r,n,o,a={};const s="categorical"!==i&&void 0===e.value.property,l=!s,c="array"===Gl(e.value.stops)&&"array"===Gl(e.value.stops[0])&&"object"===Gl(e.value.stops[0][0]),u=sc({key:e.key,value:e.value,valueSpec:e.styleSpec.function,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:function(e){if("identity"===i)return[new co(e.key,e.value,'identity function may not have a "stops" property')];let t=[];const r=e.value;return t=t.concat(lc({key:e.key,value:r,valueSpec:e.valueSpec,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:h})),"array"===Gl(r)&&0===r.length&&t.push(new co(e.key,r,"array must have at least one stop")),t},default:function(e){return e.validateSpec({key:e.key,value:e.value,valueSpec:t,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===i&&s&&u.push(new co(e.key,e.value,'missing required property "property"')),"identity"!==i&&!e.value.stops&&u.push(new co(e.key,e.value,'missing required property "stops"')),"exponential"===i&&e.valueSpec.expression&&!Zl(e.valueSpec)&&u.push(new co(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!Ul(e.valueSpec)?u.push(new co(e.key,e.value,"property functions not supported")):s&&!ql(e.valueSpec)&&u.push(new co(e.key,e.value,"zoom functions not supported"))),("categorical"===i||c)&&void 0===e.value.property&&u.push(new co(e.key,e.value,'"property" property is required')),u;function h(e){let i=[];const r=e.value,s=e.key;if("array"!==Gl(r))return[new co(s,r,`array expected, ${Gl(r)} found`)];if(2!==r.length)return[new co(s,r,`array length 2 expected, length ${r.length} found`)];if(c){if("object"!==Gl(r[0]))return[new co(s,r,`object expected, ${Gl(r[0])} found`)];if(void 0===r[0].zoom)return[new co(s,r,"object stop key must have zoom")];if(void 0===r[0].value)return[new co(s,r,"object stop key must have value")];if(o&&o>oc(r[0].zoom))return[new co(s,r[0].zoom,"stop zoom values must appear in ascending order")];oc(r[0].zoom)!==o&&(o=oc(r[0].zoom),n=void 0,a={}),i=i.concat(sc({key:`${s}[0]`,value:r[0],valueSpec:{zoom:{}},validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:cc,value:p}}))}else i=i.concat(p({key:`${s}[0]`,value:r[0],validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec},r));return Kl(ac(r[1]))?i.concat([new co(`${s}[1]`,r[1],"expressions are not allowed in function stops.")]):i.concat(e.validateSpec({key:`${s}[1]`,value:r[1],valueSpec:t,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec}))}function p(e,o){const s=Gl(e.value),l=oc(e.value),c=null!==e.value?e.value:o;if(r){if(s!==r)return[new co(e.key,c,`${s} stop domain type must match previous stop domain type ${r}`)]}else r=s;if("number"!==s&&"string"!==s&&"boolean"!==s)return[new co(e.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==i){let r=`number expected, ${s} found`;return Ul(t)&&void 0===i&&(r+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new co(e.key,c,r)]}return"categorical"!==i||"number"!==s||isFinite(l)&&Math.floor(l)===l?"categorical"!==i&&"number"===s&&void 0!==n&&l<n?[new co(e.key,c,"stop domain values must appear in ascending order")]:(n=l,"categorical"===i&&l in a?[new co(e.key,c,"stop domain values must be unique")]:(a[l]=!0,[])):[new co(e.key,c,`integer expected, found ${l}`)]}}function hc(e){const t=("property"===e.expressionContext?Ql:Xl)(ac(e.value),e.valueSpec);if("error"===t.result)return t.value.map((t=>new co(`${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 co(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&&!jl(i))return[new co(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===e.expressionContext&&!jl(i))return[new co(e.key,e.value,'"feature-state" data expressions are not supported with filters.')];if(e.expressionContext&&0===e.expressionContext.indexOf("cluster")){if(!Nl(i,["zoom","feature-state"]))return[new co(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===e.expressionContext&&!Ol(i))return[new co(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function pc(e){const t=e.value,i=e.key,r=Gl(t);return"boolean"!==r?[new co(i,t,`boolean expected, ${r} found`)]:[]}function dc(e){const t=e.key,i=e.value,r=Gl(i);return"string"!==r?[new co(t,i,`color expected, ${r} found`)]:la.parse(String(i))?[]:[new co(t,i,`color expected, "${i}" found`)]}function mc(e){const t=e.key,i=e.value,r=e.valueSpec,n=[];return Array.isArray(r.values)?-1===r.values.indexOf(oc(i))&&n.push(new co(t,i,`expected one of [${r.values.join(", ")}], ${JSON.stringify(i)} found`)):-1===Object.keys(r.values).indexOf(oc(i))&&n.push(new co(t,i,`expected one of [${Object.keys(r.values).join(", ")}], ${JSON.stringify(i)} found`)),n}function fc(e){return rc(ac(e.value))?hc(uo({},e,{expressionContext:"filter",valueSpec:{value:"boolean"}})):gc(e)}function gc(e){const t=e.value,i=e.key;if("array"!==Gl(t))return[new co(i,t,`array expected, ${Gl(t)} found`)];const r=e.styleSpec;let n,o=[];if(t.length<1)return[new co(i,t,"filter array must have at least 1 element")];switch(o=o.concat(mc({key:`${i}[0]`,value:t[0],valueSpec:r.filter_operator,style:e.style,styleSpec:e.styleSpec})),oc(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&"$type"===oc(t[1])&&o.push(new co(i,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":3!==t.length&&o.push(new co(i,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(n=Gl(t[1]),"string"!==n&&o.push(new co(`${i}[1]`,t[1],`string expected, ${n} found`)));for(let a=2;a<t.length;a++)n=Gl(t[a]),"$type"===oc(t[1])?o=o.concat(mc({key:`${i}[${a}]`,value:t[a],valueSpec:r.geometry_type,style:e.style,styleSpec:e.styleSpec})):"string"!==n&&"number"!==n&&"boolean"!==n&&o.push(new co(`${i}[${a}]`,t[a],`string, number, or boolean expected, ${n} found`));break;case"any":case"all":case"none":for(let r=1;r<t.length;r++)o=o.concat(gc({key:`${i}[${r}]`,value:t[r],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":n=Gl(t[1]),2!==t.length?o.push(new co(i,t,`filter array for "${t[0]}" operator must have 2 elements`)):"string"!==n&&o.push(new co(`${i}[1]`,t[1],`string expected, ${n} found`))}return o}function yc(e,t){const i=e.key,r=e.validateSpec,n=e.style,o=e.styleSpec,a=e.value,s=e.objectKey,l=o[`${t}_${e.layerType}`];if(!l)return[];const c=s.match(/^(.*)-transition$/);if("paint"===t&&c&&l[c[1]]&&l[c[1]].transition)return r({key:i,value:a,valueSpec:o.transition,style:n,styleSpec:o});const u=e.valueSpec||l[s];if(!u)return[new co(i,a,`unknown property "${s}"`)];let h;if("string"===Gl(a)&&Ul(u)&&!u.tokens&&(h=/^{([^}]+)}$/.exec(a)))return[new co(i,a,`"${s}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(h[1])} }\`.`)];const p=[];return"symbol"===e.layerType&&("text-field"===s&&n&&!n.glyphs&&p.push(new co(i,a,'use of "text-field" requires a style "glyphs" property')),"text-font"===s&&Hl(ac(a))&&"identity"===oc(a.type)&&p.push(new co(i,a,'"text-font" does not support identity functions'))),p.concat(r({key:e.key,value:a,valueSpec:u,style:n,styleSpec:o,expressionContext:"property",propertyType:t,propertyKey:s}))}function _c(e){return yc(e,"paint")}function vc(e){return yc(e,"layout")}function xc(e){let t=[];const i=e.value,r=e.key,n=e.style,o=e.styleSpec;!i.type&&!i.ref&&t.push(new co(r,i,'either "type" or "ref" is required'));let a=oc(i.type);const s=oc(i.ref);if(i.id){const o=oc(i.id);for(let a=0;a<e.arrayIndex;a++){const e=n.layers[a];oc(e.id)===o&&t.push(new co(r,i.id,`duplicate layer id "${i.id}", previously used at line ${e.id.__line__}`))}}if("ref"in i){let e;["type","source","source-layer","filter","layout"].forEach((e=>{e in i&&t.push(new co(r,i[e],`"${e}" is prohibited for ref layers`))})),n.layers.forEach((t=>{oc(t.id)===s&&(e=t)})),e?e.ref?t.push(new co(r,i.ref,"ref cannot reference another ref layer")):a=oc(e.type):t.push(new co(r,i.ref,`ref layer "${s}" not found`))}else if("background"!==a)if(i.source){const e=n.sources&&n.sources[i.source],o=e&&oc(e.type);e?"vector"===o&&"raster"===a?t.push(new co(r,i.source,`layer "${i.id}" requires a raster source`)):"raster-dem"!==o&&"hillshade"===a?t.push(new co(r,i.source,`layer "${i.id}" requires a raster-dem source`)):"raster"===o&&"raster"!==a?t.push(new co(r,i.source,`layer "${i.id}" requires a vector source`)):"vector"!==o||i["source-layer"]?"raster-dem"===o&&"hillshade"!==a?t.push(new co(r,i.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"===a&&i.paint&&i.paint["line-gradient"]&&("geojson"!==o||!e.lineMetrics)&&t.push(new co(r,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new co(r,i,`layer "${i.id}" must specify a "source-layer"`)):t.push(new co(r,i.source,`source "${i.source}" not found`))}else t.push(new co(r,i,'missing required property "source"'));return t=t.concat(sc({key:r,value:i,valueSpec:o.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":()=>[],type:()=>e.validateSpec({key:`${r}.type`,value:i.type,valueSpec:o.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:i,objectKey:"type"}),filter:fc,layout:e=>sc({layer:i,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>vc(uo({layerType:a},e))}}),paint:e=>sc({layer:i,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>_c(uo({layerType:a},e))}})}})),t}function bc(e){const t=e.value,i=e.key,r=Gl(t);return"string"!==r?[new co(i,t,`string expected, ${r} found`)]:[]}function wc(e){var t;const i=null!==(t=e.sourceName)&&void 0!==t?t:"",r=e.value,n=e.styleSpec,o=n.source_raster_dem,a=e.style;let s=[];const l=Gl(r);if(void 0===r)return s;if("object"!==l)return s.push(new co("source_raster_dem",r,`object expected, ${l} found`)),s;const c="custom"===oc(r.encoding),u=["redFactor","greenFactor","blueFactor","baseShift"],h=e.value.encoding?`"${e.value.encoding}"`:"Default";for(const t in r)!c&&u.includes(t)?s.push(new co(t,r[t],`In "${i}": "${t}" is only valid when "encoding" is set to "custom". ${h} encoding found`)):o[t]?s=s.concat(e.validateSpec({key:t,value:r[t],valueSpec:o[t],validateSpec:e.validateSpec,style:a,styleSpec:n})):s.push(new co(t,r[t],`unknown property "${t}"`));return s}const Cc={promoteId:Sc};function Tc(e){const t=e.value,i=e.key,r=e.styleSpec,n=e.style,o=e.validateSpec;if(!t.type)return[new co(i,t,'"type" is required')];const a=oc(t.type);let s;switch(a){case"vector":case"raster":return s=sc({key:i,value:t,valueSpec:r[`source_${a.replace("-","_")}`],style:e.style,styleSpec:r,objectElementValidators:Cc,validateSpec:o}),s;case"raster-dem":return s=wc({sourceName:i,value:t,style:e.style,styleSpec:r,validateSpec:o}),s;case"geojson":if(s=sc({key:i,value:t,valueSpec:r.source_geojson,style:n,styleSpec:r,validateSpec:o,objectElementValidators:Cc}),t.cluster)for(const e in t.clusterProperties){const[r,n]=t.clusterProperties[e],o="string"==typeof r?[r,["accumulated"],["get",e]]:r;s.push(...hc({key:`${i}.${e}.map`,value:n,expressionContext:"cluster-map"})),s.push(...hc({key:`${i}.${e}.reduce`,value:o,expressionContext:"cluster-reduce"}))}return s;case"video":return sc({key:i,value:t,valueSpec:r.source_video,style:n,validateSpec:o,styleSpec:r});case"image":return sc({key:i,value:t,valueSpec:r.source_image,style:n,validateSpec:o,styleSpec:r});case"canvas":return[new co(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return mc({key:`${i}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function Sc({key:e,value:t}){if("string"===Gl(t))return bc({key:e,value:t});{const i=[];for(const r in t)i.push(...bc({key:`${e}.${r}`,value:t[r]}));return i}}function Ac(e){const t=e.value,i=e.styleSpec,r=i.light,n=e.style;let o=[];const a=Gl(t);if(void 0===t)return o;if("object"!==a)return o=o.concat([new co("light",t,`object expected, ${a} found`)]),o;for(const a in t){const s=a.match(/^(.*)-transition$/);o=s&&r[s[1]]&&r[s[1]].transition?o.concat(e.validateSpec({key:a,value:t[a],valueSpec:i.transition,validateSpec:e.validateSpec,style:n,styleSpec:i})):r[a]?o.concat(e.validateSpec({key:a,value:t[a],valueSpec:r[a],validateSpec:e.validateSpec,style:n,styleSpec:i})):o.concat([new co(a,t[a],`unknown property "${a}"`)])}return o}function Mc(e){const t=e.value,i=e.styleSpec,r=i.sky,n=e.style,o=Gl(t);if(void 0===t)return[];if("object"!==o)return[new co("sky",t,`object expected, ${o} found`)];let a=[];for(const o in t)a=r[o]?a.concat(e.validateSpec({key:o,value:t[o],valueSpec:r[o],style:n,styleSpec:i})):a.concat([new co(o,t[o],`unknown property "${o}"`)]);return a}function Ec(e){const t=e.value,i=e.styleSpec,r=i.terrain,n=e.style;let o=[];const a=Gl(t);if(void 0===t)return o;if("object"!==a)return o=o.concat([new co("terrain",t,`object expected, ${a} found`)]),o;for(const a in t)o=r[a]?o.concat(e.validateSpec({key:a,value:t[a],valueSpec:r[a],validateSpec:e.validateSpec,style:n,styleSpec:i})):o.concat([new co(a,t[a],`unknown property "${a}"`)]);return o}function Pc(e){return 0===bc(e).length?[]:hc(e)}function Ic(e){return 0===bc(e).length?[]:hc(e)}function kc(e){const t=e.key,i=e.value;if("array"===Gl(i)){if(i.length<1||i.length>4)return[new co(t,i,`padding requires 1 to 4 values; ${i.length} values found`)];const r={type:"number"};let n=[];for(let o=0;o<i.length;o++)n=n.concat(e.validateSpec({key:`${t}[${o}]`,value:i[o],validateSpec:e.validateSpec,valueSpec:r}));return n}return cc({key:t,value:i,valueSpec:{}})}function zc(e){const t=e.key,i=e.value,r=Gl(i),n=e.styleSpec;if("array"!==r||i.length<1||i.length%2!=0)return[new co(t,i,"variableAnchorOffsetCollection requires a non-empty array of even length")];let o=[];for(let r=0;r<i.length;r+=2)o=o.concat(mc({key:`${t}[${r}]`,value:i[r],valueSpec:n.layout_symbol["text-anchor"]})),o=o.concat(lc({key:`${t}[${r+1}]`,value:i[r+1],valueSpec:{length:2,value:"number"},validateSpec:e.validateSpec,style:e.style,styleSpec:n}));return o}function Lc(e){let t=[];const i=e.value,r=e.key;if(Array.isArray(i)){const n=[],o=[];for(const a in i){i[a].id&&n.includes(i[a].id)&&t.push(new co(r,i,`all the sprites' ids must be unique, but ${i[a].id} is duplicated`)),n.push(i[a].id),i[a].url&&o.includes(i[a].url)&&t.push(new co(r,i,`all the sprites' URLs must be unique, but ${i[a].url} is duplicated`)),o.push(i[a].url);const s={id:{type:"string",required:!0},url:{type:"string",required:!0}};t=t.concat(sc({key:`${r}[${a}]`,value:i[a],valueSpec:s,validateSpec:e.validateSpec}))}return t}return bc({key:r,value:i})}function Dc(e){const t=e.value,i=e.styleSpec,r=i.projection,n=e.style,o=Gl(t);if(void 0===t)return[];if("object"!==o)return[new co("projection",t,`object expected, ${o} found`)];let a=[];for(const o in t)a=r[o]?a.concat(e.validateSpec({key:o,value:t[o],valueSpec:r[o],style:n,styleSpec:i})):a.concat([new co(o,t[o],`unknown property "${o}"`)]);return a}function Fc(e){const t=e.key;let i=e.value;i=i instanceof String?i.valueOf():i;const r=Gl(i);return"array"!==r||Bc(i)||Rc(i)?["array","string"].includes(r)?[]:[new co(t,i,`projection expected, invalid type "${r}" found`)]:[new co(t,i,`projection expected, invalid array ${JSON.stringify(i)} found`)]}function Rc(e){return!!["interpolate","step","literal"].includes(e[0])}function Bc(e){return Array.isArray(e)&&3===e.length&&"string"==typeof e[0]&&"string"==typeof e[1]&&"number"==typeof e[2]}const Oc={"*":()=>[],array:lc,boolean:pc,number:cc,color:dc,constants:nc,enum:mc,filter:fc,function:uc,layer:xc,object:sc,source:Tc,light:Ac,sky:Mc,terrain:Ec,projection:Dc,projectionDefinition:Fc,string:bc,formatted:Pc,resolvedImage:Ic,padding:kc,variableAnchorOffsetCollection:zc,sprite:Lc};function jc(e){const t=e.value,i=e.valueSpec,r=e.styleSpec;return e.validateSpec=jc,i.expression&&Hl(oc(t))?uc(e):i.expression&&Kl(ac(t))?hc(e):i.type&&Oc[i.type]?Oc[i.type](e):sc(uo({},e,{valueSpec:i.type?r[i.type]:i}))}function Nc(e){const t=e.value,i=e.key,r=bc(e);return r.length||(-1===t.indexOf("{fontstack}")&&r.push(new co(i,t,'"glyphs" url must include a "{fontstack}" token')),-1===t.indexOf("{range}")&&r.push(new co(i,t,'"glyphs" url must include a "{range}" token'))),r}function $c(e,t=lo){let i=[];return i=i.concat(jc({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,validateSpec:jc,objectElementValidators:{glyphs:Nc,"*":()=>[]}})),e.constants&&(i=i.concat(nc({key:"constants",value:e.constants}))),Uc(i)}function Vc(e){return function(t){return e({...t,validateSpec:jc})}}function Uc(e){return[].concat(e).sort(((e,t)=>e.line-t.line))}function qc(e){return function(...t){return Uc(e.apply(this,t))}}function Zc(e){if(!e)return{style:ei[Yt[0].referenceStyleID].getDefaultVariant().getExpandedStyleURL(),requiresUrlMonitoring:!1,isFallback:!0};if("string"==typeof e){const t=Hc(e);return t.isValidStyle?{style:t.styleObject,requiresUrlMonitoring:!1,isFallback:!1}:t.isValidJSON?{style:ei[Yt[0].referenceStyleID].getDefaultVariant().getExpandedStyleURL(),requiresUrlMonitoring:!1,isFallback:!0}:e.startsWith("http")?{style:e,requiresUrlMonitoring:!0,isFallback:!1}:e.toLowerCase().includes(".json")?{style:Gc(e),requiresUrlMonitoring:!0,isFallback:!1}:{style:Wt(e),requiresUrlMonitoring:!0,isFallback:!1}}return e instanceof Kt?{style:e.getExpandedStyleURL(),requiresUrlMonitoring:!1,isFallback:!1}:e instanceof Xt?{style:e.getDefaultVariant().getExpandedStyleURL(),requiresUrlMonitoring:!1,isFallback:!1}:0===$c(e).length?{style:e,requiresUrlMonitoring:!1,isFallback:!1}:{style:ei[Yt[0].referenceStyleID].getDefaultVariant().getExpandedStyleURL(),requiresUrlMonitoring:!1,isFallback:!0}}function Gc(e){try{return new URL(e).href}catch{}return new URL(e,location.origin).href}function Hc(e){try{const t=JSON.parse(e),i=$c(t);return{isValidJSON:!0,isValidStyle:0===i.length,styleObject:0===i.length?t:null}}catch{return{isValidJSON:!1,isValidStyle:!1,styleObject:null}}}$c.source=qc(Vc(Tc)),$c.sprite=qc(Vc(Lc)),$c.glyphs=qc(Vc(Nc)),$c.light=qc(Vc(Ac)),$c.sky=qc(Vc(Mc)),$c.terrain=qc(Vc(Ec)),$c.layer=qc(Vc(xc)),$c.filter=qc(Vc(fc)),$c.paintProperty=qc(Vc(_c)),$c.layoutProperty=qc(Vc(vc));class Wc{constructor(){ir(this,"_map"),ir(this,"_container"),ir(this,"_terrainButton"),Ir(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(e){return this._map=e,this._container=kr("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=kr("button","maplibregl-ctrl-terrain",this._container),kr("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){zr(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.hasTerrain()?this._map.disableTerrain():this._map.enableTerrain(),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.hasTerrain()?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))}}class Kc extends an{constructor(e={}){super({showCompass:e.showCompass??!0,showZoom:e.showZoom??!0,visualizePitch:e.visualizePitch??!0}),ir(this,"_rotateCompassArrow",(()=>{const e=this._map.getBearing(),t=this._map.getPitch(),i=this.options.visualizePitch?`scale(${Math.min(1.5,1/Math.cos(t*(Math.PI/180))**.5)}) rotateX(${Math.min(70,t)}deg) rotateZ(${-e}deg)`:`rotate(${-e}deg)`;this._compassIcon.style.transform=i})),this._compass&&(this._compass.removeEventListener("click",this._compass.clickFunction),this._compass.addEventListener("click",(e=>{0===this._map.getPitch()?this._map.easeTo({pitch:Math.min(this._map.getMaxPitch(),80)}):this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})})))}_createButton(e,t){const i=super._createButton(e,t);return i.clickFunction=t,i}}const Xc=It.Marker,Yc=It.LngLat,Jc=It.LngLatBounds;class Qc extends sn{constructor(){super(...arguments),ir(this,"lastUpdatedCenter",new Yc(0,0)),ir(this,"_updateCamera",(e=>{var t,i;const r=new Yc(e.coords.longitude,e.coords.latitude),n=e.coords.accuracy,o={bearing:this._map.getBearing(),...this.options.fitBoundsOptions,linear:!0},a=this._map.getZoom();a>((null==(i=null==(t=this.options)?void 0:t.fitBoundsOptions)?void 0:i.maxZoom)??30)&&(o.zoom=a),this._map.fitBounds(Jc.fromLngLat(r,n),o,{geolocateSource:!0});let s=!1;const l=()=>{s=!0};this._map.once("click",l),this._map.once("dblclick",l),this._map.once("dragstart",l),this._map.once("mousedown",l),this._map.once("touchstart",l),this._map.once("wheel",l),this._map.once("moveend",(()=>{this._map.off("click",l),this._map.off("dblclick",l),this._map.off("dragstart",l),this._map.off("mousedown",l),this._map.off("touchstart",l),this._map.off("wheel",l),!s&&(this.lastUpdatedCenter=this._map.getCenter())}))})),ir(this,"_finishSetupUI",(e=>{if(this._map){if(!1===e){const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}else{const e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=kr("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Xc({element:this._dotElement}),this._circleElement=kr("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Xc({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("move",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("moveend",(e=>{const t=e.originalEvent&&"resize"===e.originalEvent.type,i=this.lastUpdatedCenter.distanceTo(this._map.getCenter());!e.geolocateSource&&"ACTIVE_LOCK"===this._watchState&&!t&&i>1&&(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new Event("trackuserlocationend")))}))}})),ir(this,"_onZoom",(()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}))}_updateCircleRadius(){if("BACKGROUND"!==this._watchState&&"ACTIVE_LOCK"!==this._watchState)return;const e=[this._lastKnownPosition.coords.longitude,this._lastKnownPosition.coords.latitude],t=this._map.project(e),i=this._map.unproject([t.x,t.y]),r=this._map.unproject([t.x+20,t.y]),n=i.distanceTo(r)/20,o=Math.ceil(2*this._accuracy/n);this._circleElement.style.width=`${o}px`,this._circleElement.style.height=`${o}px`}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":case"BACKGROUND_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}}var eu,tu,iu,ru,nu,ou,au,su,lu,cu;class uu{constructor(e,t){or(this,au),or(this,eu),ir(this,"map"),or(this,tu),or(this,iu),or(this,ru),or(this,nu,!1),or(this,ou),void 0!==e.style&&ar(this,nu,!0),ar(this,eu,{zoomAdjust:-4,position:"top-right",...t,forceNoAttributionControl:!0,attributionControl:!1,navigationControl:!1,geolocateControl:!1,maptilerLogo:!1,minimap:!1,hash:!1,pitchAdjust:!1,...e,containerStyle:{border:"1px solid #000",width:"400px",height:"300px",...e.containerStyle??{}}}),void 0!==e.lockZoom&&(nr(this,eu).minZoom=e.lockZoom,nr(this,eu).maxZoom=e.lockZoom)}setStyle(e,t){nr(this,nu)||this.map.setStyle(e,t),sr(this,au,lu).call(this)}addLayer(e,t){return nr(this,nu)||this.map.addLayer(e,t),sr(this,au,lu).call(this),this.map}moveLayer(e,t){return nr(this,nu)||this.map.moveLayer(e,t),sr(this,au,lu).call(this),this.map}removeLayer(e){return nr(this,nu)||this.map.removeLayer(e),sr(this,au,lu).call(this),this}setLayerZoomRange(e,t,i){return nr(this,nu)||this.map.setLayerZoomRange(e,t,i),sr(this,au,lu).call(this),this}setFilter(e,t,i){return nr(this,nu)||this.map.setFilter(e,t,i),sr(this,au,lu).call(this),this}setPaintProperty(e,t,i,r){return nr(this,nu)||this.map.setPaintProperty(e,t,i,r),sr(this,au,lu).call(this),this}setLayoutProperty(e,t,i,r){return nr(this,nu)||this.map.setLayoutProperty(e,t,i,r),sr(this,au,lu).call(this),this}setGlyphs(e,t){return nr(this,nu)||this.map.setGlyphs(e,t),sr(this,au,lu).call(this),this}onAdd(e){ar(this,tu,e),ar(this,iu,kr("div","maplibregl-ctrl maplibregl-ctrl-group"));for(const[e,t]of Object.entries(nr(this,eu).containerStyle))nr(this,iu).style.setProperty(e,t);return nr(this,eu).container=nr(this,iu),nr(this,eu).zoom=e.getZoom()+nr(this,eu).zoomAdjust,this.map=new mu(nr(this,eu)),this.map.once("style.load",(()=>{this.map.resize()})),this.map.once("load",(()=>{sr(this,au,su).call(this,nr(this,eu).parentRect),ar(this,ou,sr(this,au,cu).call(this))})),nr(this,iu)}onRemove(){var e;null==(e=nr(this,ou))||e.call(this),zr(nr(this,iu))}}eu=new WeakMap,tu=new WeakMap,iu=new WeakMap,ru=new WeakMap,nu=new WeakMap,ou=new WeakMap,au=new WeakSet,su=function(e){void 0===e||void 0===e.linePaint&&void 0===e.fillPaint||(ar(this,ru,{type:"Feature",properties:{name:"parentRect"},geometry:{type:"Polygon",coordinates:[[[],[],[],[],[]]]}}),this.map.addSource("parentRect",{type:"geojson",data:nr(this,ru)}),(void 0!==e.lineLayout||void 0!==e.linePaint)&&this.map.addLayer({id:"parentRectOutline",type:"line",source:"parentRect",layout:{...e.lineLayout},paint:{"line-color":"#FFF","line-width":1,"line-opacity":.85,...e.linePaint}}),void 0!==e.fillPaint&&this.map.addLayer({id:"parentRectFill",type:"fill",source:"parentRect",layout:{},paint:{"fill-color":"#08F","fill-opacity":.135,...e.fillPaint}}),sr(this,au,lu).call(this))},lu=function(){if(void 0===nr(this,ru))return;const{devicePixelRatio:e}=window,t=nr(this,tu).getCanvas(),i=t.width/e,r=t.height/e,n=nr(this,tu).unproject.bind(nr(this,tu)),o=n([0,0]),a=n([i,0]),s=n([0,r]),l=n([i,r]);nr(this,ru).geometry.coordinates=[[s.toArray(),l.toArray(),a.toArray(),o.toArray(),s.toArray()]],this.map.getSource("parentRect").setData(nr(this,ru))},cu=function(){const{pitchAdjust:e}=nr(this,eu),t=()=>{o("parent")},i=()=>{o("minimap")},r=()=>{nr(this,tu).on("move",t),this.map.on("move",i)},n=()=>{nr(this,tu).off("move",t),this.map.off("move",i)},o=t=>{n();const i="parent"===t?nr(this,tu):this.map,o="parent"===t?this.map:nr(this,tu),a=i.getCenter(),s=i.getZoom()+nr(this,eu).zoomAdjust*("parent"===t?1:-1),l=i.getBearing(),c=i.getPitch();o.jumpTo({center:a,zoom:s,bearing:l,pitch:e?c:0}),sr(this,au,lu).call(this),r()};return r(),()=>{n()}};class hu{constructor(){ir(this,"map"),ir(this,"container"),ir(this,"projectionButton")}onAdd(e){return this.map=e,this.container=kr("div","maplibregl-ctrl maplibregl-ctrl-group"),this.projectionButton=kr("button","maplibregl-ctrl-projection",this.container),kr("span","maplibregl-ctrl-icon",this.projectionButton).setAttribute("aria-hidden","true"),this.projectionButton.type="button",this.projectionButton.addEventListener("click",this.toggleProjection.bind(this)),e.on("projectiontransition",this.updateProjectionIcon.bind(this)),this.updateProjectionIcon(),this.container}onRemove(){zr(this.container),this.map.off("projectiontransition",this.updateProjectionIcon),this.map=void 0}toggleProjection(){void 0===this.map.getProjection()&&this.map.setProjection({type:"mercator"}),this.map.isGlobeProjection()?this.map.enableMercatorProjection():this.map.enableGlobeProjection(),this.updateProjectionIcon()}updateProjectionIcon(){this.projectionButton.classList.remove("maplibregl-ctrl-projection-globe"),this.projectionButton.classList.remove("maplibregl-ctrl-projection-mercator"),this.map.isGlobeProjection()?(this.projectionButton.classList.add("maplibregl-ctrl-projection-mercator"),this.projectionButton.title="Enable Mercator projection"):(this.projectionButton.classList.add("maplibregl-ctrl-projection-globe"),this.projectionButton.title="Enable Globe projection")}}class pu{constructor(e,t=2e3){ir(this,"map"),ir(this,"registeredModules",new Set),this.map=e,setTimeout((async()=>{if(!fr.telemetry)return;const e=this.preparePayload();try{(await fetch(e,{method:"POST"})).ok||console.warn("The metrics could not be sent to MapTiler Cloud")}catch(e){console.warn("The metrics could not be sent to MapTiler Cloud",e)}}),Math.max(1e3,t))}registerModule(e,t){this.registeredModules.add(`${e}:${t}`)}preparePayload(){const e=new URL(pr.telemetryURL);return e.searchParams.append("sdk",cr.version),e.searchParams.append("key",fr.apiKey),e.searchParams.append("mtsid",dr),e.searchParams.append("session",fr.session?"1":"0"),e.searchParams.append("caching",fr.caching?"1":"0"),e.searchParams.append("lang-updated",this.map.isLanguageUpdated()?"1":"0"),e.searchParams.append("terrain",this.map.getTerrain()?"1":"0"),e.searchParams.append("globe",this.map.isGlobeProjection()?"1":"0"),this.registeredModules.size>0&&e.searchParams.append("modules",Array.from(this.registeredModules).join("|")),e.href}}const du={POINT:"POINT",COUNTRY:"COUNTRY"};class mu extends It.Map{constructor(e){jr(e.container),e.apiKey&&(fr.apiKey=e.apiKey);const{style:t,requiresUrlMonitoring:i,isFallback:r}=Zc(e.style);r&&console.warn("Invalid style. A style must be a valid URL to a style.json, a JSON string representing a valid StyleSpecification or a valid StyleSpecification object. Fallback to default MapTiler style."),fr.apiKey||console.warn("MapTiler Cloud API key is not set. Visit https://maptiler.com and try Cloud for free!");const n=location.hash;let o={compact:!1};e.customAttribution?o.customAttribution=e.customAttribution:e.attributionControl&&"object"==typeof e.attributionControl&&(o={...o,...e.attributionControl});const a={...e,style:t,maplibreLogo:!1,transformRequest:Dr(e.transformRequest),attributionControl:!0!==e.forceNoAttributionControl&&o};delete a.style,super(a),ir(this,"telemetry"),ir(this,"isTerrainEnabled",!1),ir(this,"terrainExaggeration",1),ir(this,"primaryLanguage"),ir(this,"terrainGrowing",!1),ir(this,"terrainFlattening",!1),ir(this,"minimap"),ir(this,"forceLanguageUpdate"),ir(this,"languageAlwaysBeenStyle"),ir(this,"isReady",!1),ir(this,"terrainAnimationDuration",1e3),ir(this,"monitoredStyleUrls"),ir(this,"styleInProcess",!1),ir(this,"curentProjection"),ir(this,"originalLabelStyle",new window.Map),ir(this,"isStyleLocalized",!1),ir(this,"languageIsUpdated",!1),this.setStyle(t),i&&this.monitorStyleUrl(t);const s=()=>{let e="The distant style could not be loaded.";this.getStyle()?e+="Leaving the style as is.":(this.setStyle(ei.STREETS),e+=`Loading default MapTiler Cloud style "${ei.STREETS.getDefaultVariant().getId()}" as a fallback.`),console.warn(e)};if(this.on("style.load",(()=>{this.styleInProcess=!1})),this.on("error",(e=>{if(e.error instanceof It.AJAXError){const t=e.error.url,i=new URL(t);i.search="";const r=i.href;this.monitoredStyleUrls&&this.monitoredStyleUrls.has(r)&&(this.monitoredStyleUrls.delete(r),s())}else if(this.styleInProcess)return s()})),fr.caching&&!wr&&console.warn("The cache API is only available in secure contexts. More info at https://developer.mozilla.org/en-US/docs/Web/API/Cache"),fr.caching&&wr&&Er(),typeof e.language>"u")this.primaryLanguage=fr.primaryLanguage;else{const t=$t(e.language,ur);this.primaryLanguage=t??fr.primaryLanguage}this.forceLanguageUpdate=!(this.primaryLanguage===ur.STYLE||this.primaryLanguage===ur.STYLE_LOCK),this.languageAlwaysBeenStyle=this.primaryLanguage===ur.STYLE,this.terrainExaggeration=e.terrainExaggeration??this.terrainExaggeration,this.curentProjection=e.projection,this.on("styledata",(()=>{"mercator"===this.curentProjection?this.setProjection({type:"mercator"}):"globe"===this.curentProjection&&this.setProjection({type:"globe"})})),this.once("styledata",(async()=>{if(!e.geolocate||e.center||e.hash&&n)return;try{if(e.geolocate===du.COUNTRY)return void await this.fitToIpBounds()}catch(e){console.warn(e.message)}let t;try{await this.centerOnIpPoint(e.zoom),t=this.getCameraHash()}catch(e){console.warn(e.message)}"granted"===(await navigator.permissions.query({name:"geolocation"})).state&&navigator.geolocation.getCurrentPosition((i=>{t===this.getCameraHash()&&(this.terrain?this.easeTo({center:[i.coords.longitude,i.coords.latitude],zoom:e.zoom||12,duration:2e3}):this.once("terrain",(()=>{this.easeTo({center:[i.coords.longitude,i.coords.latitude],zoom:e.zoom||12,duration:2e3})})))}),null,{maximumAge:864e5,timeout:5e3,enableHighAccuracy:!1})})),this.on("styledata",(()=>{this.setPrimaryLanguage(this.primaryLanguage)})),this.on("styledata",(()=>{null===this.getTerrain()&&this.isTerrainEnabled&&this.enableTerrain(this.terrainExaggeration)})),this.once("load",(async()=>{let t={logo:null};try{const e=Object.keys(this.style.sourceCaches).map((e=>this.getSource(e))).filter((e=>e&&"url"in e&&"string"==typeof e.url&&(null==e?void 0:e.url.includes("tiles.json")))),i=new URL(e[0].url);i.searchParams.has("key")||i.searchParams.append("key",fr.apiKey),t=await(await fetch(i.href)).json()}catch{}if(!0!==e.forceNoAttributionControl)if("logo"in t&&t.logo){const i=t.logo;this.addControl(new bn({logoURL:i}),e.logoPosition)}else e.maptilerLogo&&this.addControl(new bn,e.logoPosition);if(e.scaleControl){const t=!0===e.scaleControl||void 0===e.scaleControl?"bottom-right":e.scaleControl,i=new un({unit:fr.unit});this.addControl(i,t),fr.on("unit",(e=>{i.setUnit(e)}))}if(!1!==e.navigationControl){const t=!0===e.navigationControl||void 0===e.navigationControl?"top-right":e.navigationControl;this.addControl(new Kc,t)}if(!1!==e.geolocateControl){const t=!0===e.geolocateControl||void 0===e.geolocateControl?"top-right":e.geolocateControl;this.addControl(new Qc({positionOptions:{enableHighAccuracy:!0,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!0,showAccuracyCircle:!0,showUserLocation:!0}),t)}if(e.terrainControl){const t=!0===e.terrainControl||void 0===e.terrainControl?"top-right":e.terrainControl;this.addControl(new Wc,t)}if(e.projectionControl){const t=!0===e.projectionControl||void 0===e.projectionControl?"top-right":e.projectionControl;this.addControl(new hu,t)}if(e.fullscreenControl){const t=!0===e.fullscreenControl||void 0===e.fullscreenControl?"top-right":e.fullscreenControl;this.addControl(new hn({}),t)}this.isReady=!0,this.fire("ready",{target:this})}));let l,c=!1,u=!1;this.once("ready",(()=>{c=!0,u&&this.fire("loadWithTerrain",l)})),this.once("style.load",(()=>{const{minimap:t}=e;if("object"==typeof t){const{zoom:i,center:r,style:n,language:o,apiKey:a,maptilerLogo:s,canvasContextAttributes:l,refreshExpiredTiles:c,maxBounds:u,scrollZoom:h,minZoom:p,maxZoom:d,boxZoom:m,locale:f,fadeDuration:g,crossSourceCollisions:y,clickTolerance:_,bounds:v,fitBoundsOptions:x,pixelRatio:b,validateStyle:w}=e;this.minimap=new uu(t,{zoom:i,center:r,style:n,language:o,apiKey:a,container:"null",maptilerLogo:s,canvasContextAttributes:l,refreshExpiredTiles:c,maxBounds:u,scrollZoom:h,minZoom:p,maxZoom:d,boxZoom:m,locale:f,fadeDuration:g,crossSourceCollisions:y,clickTolerance:_,bounds:v,fitBoundsOptions:x,pixelRatio:b,validateStyle:w}),this.addControl(this.minimap,t.position??"bottom-left")}else!0===t?(this.minimap=new uu({},e),this.addControl(this.minimap,"bottom-left")):void 0!==t&&!1!==t&&(this.minimap=new uu({},e),this.addControl(this.minimap,t))}));const h=e=>{e.terrain&&(u=!0,l={type:"loadWithTerrain",target:this,terrain:e.terrain},this.off("terrain",h),c&&this.fire("loadWithTerrain",l))};this.on("terrain",h),e.terrain&&this.enableTerrain(e.terrainExaggeration??this.terrainExaggeration),this.once("load",(()=>{this.getCanvas().addEventListener("webglcontextlost",(t=>{console.warn(t),Nr(e.container),this.fire("webglContextLost",{error:t})}))})),this.telemetry=new pu(this)}setTerrainAnimationDuration(e){this.terrainAnimationDuration=Math.max(e,0)}async onLoadAsync(){return new Promise((e=>{if(this.loaded())return e(this);this.once("load",(()=>{e(this)}))}))}async onReadyAsync(){return new Promise((e=>{if(this.isReady)return e(this);this.once("ready",(()=>{e(this)}))}))}async onLoadWithTerrainAsync(){return new Promise((e=>{if(this.isReady&&this.terrain)return e(this);this.once("loadWithTerrain",(()=>{e(this)}))}))}monitorStyleUrl(e){typeof this.monitoredStyleUrls>"u"&&(this.monitoredStyleUrls=new Set);const t=new URL(e);t.search="",this.monitoredStyleUrls.add(t.href)}setStyle(e,t){var i;this.originalLabelStyle.clear(),null==(i=this.minimap)||i.setStyle(e),this.forceLanguageUpdate=!0,this.once("idle",(()=>{this.forceLanguageUpdate=!1}));const r=Zc(e);if(r.requiresUrlMonitoring&&this.monitorStyleUrl(r.style),r.isFallback){if(this.getStyle())return console.warn("Invalid style. A style must be a valid URL to a style.json, a JSON string representing a valid StyleSpecification or a valid StyleSpecification object. Keeping the curent style instead."),this;console.warn("Invalid style. A style must be a valid URL to a style.json, a JSON string representing a valid StyleSpecification or a valid StyleSpecification object. Fallback to default MapTiler style.")}return this.styleInProcess=!0,super.setStyle(r.style,t),this}addLayer(e,t){var i;return null==(i=this.minimap)||i.addLayer(e,t),super.addLayer(e,t)}moveLayer(e,t){var i;return null==(i=this.minimap)||i.moveLayer(e,t),super.moveLayer(e,t)}removeLayer(e){var t;return null==(t=this.minimap)||t.removeLayer(e),super.removeLayer(e)}setLayerZoomRange(e,t,i){var r;return null==(r=this.minimap)||r.setLayerZoomRange(e,t,i),super.setLayerZoomRange(e,t,i)}setFilter(e,t,i){var r;return null==(r=this.minimap)||r.setFilter(e,t,i),super.setFilter(e,t,i)}setPaintProperty(e,t,i,r){var n;return null==(n=this.minimap)||n.setPaintProperty(e,t,i,r),super.setPaintProperty(e,t,i,r)}setLayoutProperty(e,t,i,r){var n;return null==(n=this.minimap)||n.setLayoutProperty(e,t,i,r),super.setLayoutProperty(e,t,i,r)}setGlyphs(e,t){var i;return null==(i=this.minimap)||i.setGlyphs(e,t),super.setGlyphs(e,t)}getStyleLanguage(){return this.style&&this.style.stylesheet&&this.style.stylesheet.metadata&&"object"==typeof this.style.stylesheet.metadata&&"maptiler:language"in this.style.stylesheet.metadata&&"string"==typeof this.style.stylesheet.metadata["maptiler:language"]?jt(this.style.stylesheet.metadata["maptiler:language"]):null}setLanguage(e){var t,i;null==(i=null==(t=this.minimap)?void 0:t.map)||i.setLanguage(e),this.onStyleReady((()=>{this.setPrimaryLanguage(e)}))}setPrimaryLanguage(e){const t=this.getStyleLanguage(),i=$t(e,ur);if(!i)return void console.warn(`The language "${i}" is not supported.`);if((i.flag!==ur.STYLE.flag||!t||t.flag!==ur.AUTO.flag&&t.flag!==ur.VISITOR.flag)&&(i.flag!==ur.STYLE.flag&&(this.languageAlwaysBeenStyle=!1),this.languageAlwaysBeenStyle||this.primaryLanguage===i&&!this.forceLanguageUpdate))return;if(this.primaryLanguage.flag===ur.STYLE_LOCK.flag)return void console.warn("The language cannot be changed because this map has been instantiated with the STYLE_LOCK language flag.");this.primaryLanguage=i;let r=i;if(i.flag===ur.STYLE.flag){if(!t)return void console.warn("The style has no default languages or has an invalid one.");r=t}let n=ur.LOCAL.flag,o=["get",n];r.flag===ur.VISITOR.flag?(n=hr().flag,o=["case",["all",["has",n],["has",ur.LOCAL.flag]],["case",["==",["get",n],["get",ur.LOCAL.flag]],["get",ur.LOCAL.flag],["format",["get",n],{"font-scale":.8},"\n",["get",ur.LOCAL.flag],{"font-scale":1.1}]],["get",ur.LOCAL.flag]]):r.flag===ur.VISITOR_ENGLISH.flag?(n=ur.ENGLISH.flag,o=["case",["all",["has",n],["has",ur.LOCAL.flag]],["case",["==",["get",n],["get",ur.LOCAL.flag]],["get",ur.LOCAL.flag],["format",["get",n],{"font-scale":.8},"\n",["get",ur.LOCAL.flag],{"font-scale":1.1}]],["get",ur.LOCAL.flag]]):r.flag===ur.AUTO.flag?(n=hr().flag,o=["coalesce",["get",n],["get",ur.LOCAL.flag]]):r===ur.LOCAL?(n=ur.LOCAL.flag,o=["get",n]):(n=r.flag,o=["coalesce",["get",n],["get",ur.LOCAL.flag]]);const{layers:a}=this.getStyle(),s=0===this.originalLabelStyle.size;if(s){const e=Wr(a,this);this.isStyleLocalized=Object.keys(e.localized).length>0}for(const e of a){if("symbol"!==e.type)continue;const t=e,i=this.getSource(t.source);if(!i||!("url"in i)||"string"!=typeof i.url||new URL(i.url).host!==pr.maptilerApiHost)continue;const{id:r,layout:n}=t;if(!n||!("text-field"in n))continue;let a;if(s?(a=this.getLayoutProperty(r,"text-field"),this.originalLabelStyle.set(r,a)):a=this.originalLabelStyle.get(r),"string"==typeof a){const{contains:e,exactMatch:t}=Ur(a,this.isStyleLocalized);if(!e)continue;if(t)this.setLayoutProperty(r,"text-field",o);else{const e=qr(a,o,this.isStyleLocalized);this.setLayoutProperty(r,"text-field",e)}}else{const e=Vr(a,o,this.isStyleLocalized);this.setLayoutProperty(r,"text-field",e)}}this.languageIsUpdated=!0}getPrimaryLanguage(){return this.primaryLanguage}getTerrainExaggeration(){return this.terrainExaggeration}hasTerrain(){return this.isTerrainEnabled}growTerrain(e){if(!this.terrain)return;const t=performance.now(),i=this.terrain.exaggeration,r=e-i,n=()=>{if(!this.terrain||this.terrainFlattening)return;const o=(performance.now()-t)/this.terrainAnimationDuration;if(o<.99){const e=i+(1-(1-o)**4)*r;this.terrain.exaggeration=e,requestAnimationFrame(n)}else this.terrainGrowing=!1,this.terrainFlattening=!1,this.terrain.exaggeration=e,this.fire("terrainAnimationStop",{terrain:this.terrain});this._elevationFreeze=!1,this.triggerRepaint()};!this.terrainGrowing&&!this.terrainFlattening&&this.fire("terrainAnimationStart",{terrain:this.terrain}),this.terrainGrowing=!0,this.terrainFlattening=!1,requestAnimationFrame(n)}enableTerrain(e=this.terrainExaggeration){if(e<0)return void console.warn("Terrain exaggeration cannot be negative.");const t=async i=>{!this.terrain||"data"!==i.type||"source"!==i.dataType||!("source"in i)||"maptiler-terrain"!==i.sourceId||"raster-dem"!==i.source.type||i.isSourceLoaded&&(this.off("data",t),this.growTerrain(e))},i=()=>{this.isTerrainEnabled=!0,this.terrainExaggeration=e,this.on("data",t),this.addSource(pr.terrainSourceId,{type:"raster-dem",url:pr.terrainSourceURL}),this.setTerrain({source:pr.terrainSourceId,exaggeration:0})};if(this.getTerrain())return this.isTerrainEnabled=!0,void this.growTerrain(e);this.loaded()||this.isTerrainEnabled?i():this.once("load",(()=>{this.getTerrain()&&this.getSource(pr.terrainSourceId)||i()}))}disableTerrain(){if(!this.terrain)return;this.isTerrainEnabled=!1;const e=performance.now(),t=this.terrain.exaggeration,i=()=>{if(!this.terrain||this.terrainGrowing)return;const r=(performance.now()-e)/this.terrainAnimationDuration;if(this._elevationFreeze=!1,r<.99){const e=t*(1-r)**4;this.terrain.exaggeration=e,requestAnimationFrame(i)}else this.terrain.exaggeration=0,this.terrainGrowing=!1,this.terrainFlattening=!1,this.setTerrain(),this.getSource(pr.terrainSourceId)&&this.removeSource(pr.terrainSourceId),this.fire("terrainAnimationStop",{terrain:null});this.triggerRepaint()};!this.terrainGrowing&&!this.terrainFlattening&&this.fire("terrainAnimationStart",{terrain:this.terrain}),this.terrainGrowing=!1,this.terrainFlattening=!0,requestAnimationFrame(i)}setTerrainExaggeration(e,t=!0){!t&&this.terrain?(this.terrainExaggeration=e,this.terrain.exaggeration=e,this.triggerRepaint()):this.enableTerrain(e)}onStyleReady(e){this.isStyleLoaded()?e():this.once("styledata",(()=>{e()}))}async fitToIpBounds(){const e=await Ht.info();this.fitBounds(e.country_bounds,{duration:0,padding:100})}async centerOnIpPoint(e){const t=await Ht.info();this.jumpTo({center:[(null==t?void 0:t.longitude)??0,(null==t?void 0:t.latitude)??0],zoom:e||11})}getCameraHash(){const e=new Float32Array(5),t=this.getCenter();return e[0]=t.lng,e[1]=t.lat,e[2]=this.getZoom(),e[3]=this.getPitch(),e[4]=this.getBearing(),Ji.fromUint8Array(new Uint8Array(e.buffer))}getSdkConfig(){return fr}getMaptilerSessionId(){return dr}setTransformRequest(e){return super.setTransformRequest(Dr(e)),this}isGlobeProjection(){const e=this.getProjection();return"globe"===(null==e?void 0:e.type)}enableGlobeProjection(){!0!==this.isGlobeProjection()&&(this.setProjection({type:"globe"}),this.curentProjection="globe")}enableMercatorProjection(){!1!==this.isGlobeProjection()&&(this.setProjection({type:"mercator"}),this.curentProjection="mercator")}isLanguageUpdated(){return this.languageIsUpdated}}function fu(e){if(typeof DOMParser<"u"){const t=(new DOMParser).parseFromString(e,"application/xml");if(t.querySelector("parsererror"))throw new Error("The provided string is not valid XML");return t}throw new Error("No XML parser found")}function gu(e,t){if(!e.hasChildNodes())return!1;for(const i of Array.from(e.childNodes)){const e=i.nodeName;if("string"==typeof e&&e.trim().toLowerCase()===t.toLowerCase())return!0}return!1}function yu(e){if(typeof XMLSerializer<"u")return(new XMLSerializer).serializeToString(e);throw new Error("No XML serializer found")}function _u(e){const t="string"==typeof e?fu(e):e;if(!gu(t,"gpx"))throw new Error("The XML document is not valid GPX");const i=zu(t,"trk"),r=zu(t,"rte"),n=zu(t,"wpt"),o={type:"FeatureCollection",features:[]};for(const e of Array.from(i)){const t=Au(e);t&&o.features.push(t)}for(const e of Array.from(r)){const t=Mu(e);t&&o.features.push(t)}for(const e of Array.from(n))o.features.push(Eu(e));return o}function vu(e,t){let i=e;if("string"==typeof i&&(i=fu(i)),!gu(i,"kml"))throw new Error("The XML document is not valid KML");const r={type:"FeatureCollection",features:[]},n={},o={},a={},s=zu(i,"Placemark"),l=zu(i,"Style"),c=zu(i,"StyleMap");for(const e of Array.from(l)){const t=ku(yu(e)).toString(16);n[`#${Lu(e,"id")}`]=t,o[t]=e}for(const e of Array.from(c)){n[`#${Lu(e,"id")}`]=ku(yu(e)).toString(16);const t=zu(e,"Pair"),i={};for(const e of Array.from(t))i[Ou(Fu(e,"key"))??""]=Ou(Fu(e,"styleUrl"));a[`#${Lu(e,"id")}`]=i}for(const e of Array.from(s))r.features=r.features.concat(Tu(e,n,o,a));return r}function xu(e){if(null===e)return["#000000",1];let t="",i=1,r=e;return"#"===r.substring(0,1)&&(r=r.substring(1)),(6===r.length||3===r.length)&&(t=r),8===r.length&&(i=Number.parseInt(r.substring(0,2),16)/255,t=`#${r.substring(6,8)}${r.substring(4,6)}${r.substring(2,4)}`),[t??"#000000",i??1]}function bu(e){return Bu(e.split(" "))}function wu(e){let t=zu(e,"coord");const i=[],r=[];0===t.length&&(t=zu(e,"gx:coord"));for(const e of Array.from(t))i.push(bu(Ou(e)??""));const n=zu(e,"when");for(const e of Array.from(n))r.push(Ou(e));return{coords:i,times:r}}function Cu(e){const t=["Polygon","LineString","Point","Track","gx:Track"];let i,r,n,o,a;const s=[],l=[];if(null!==Fu(e,"MultiGeometry"))return Cu(Fu(e,"MultiGeometry"));if(null!==Fu(e,"MultiTrack"))return Cu(Fu(e,"MultiTrack"));if(null!==Fu(e,"gx:MultiTrack"))return Cu(Fu(e,"gx:MultiTrack"));for(n=0;n<t.length;n++)if(r=zu(e,t[n]),r)for(o=0;o<r.length;o++)if(i=r[o],"Point"===t[n])s.push({type:"Point",coordinates:Nu(Ou(Fu(i,"coordinates"))??"")});else if("LineString"===t[n])s.push({type:"LineString",coordinates:$u(Ou(Fu(i,"coordinates"))??"")});else if("Polygon"===t[n]){const e=zu(i,"LinearRing"),t=[];for(a=0;a<e.length;a++)t.push($u(Ou(Fu(e[a],"coordinates"))??""));s.push({type:"Polygon",coordinates:t})}else if("Track"===t[n]||"gx:Track"===t[n]){const e=wu(i);s.push({type:"LineString",coordinates:e.coords}),e.times.length&&l.push(e.times)}return{geoms:s,coordTimes:l}}function Tu(e,t,i,r){const n=Cu(e),o={},a=Ou(Fu(e,"name")),s=Ou(Fu(e,"address")),l=Ou(Fu(e,"description")),c=Fu(e,"TimeSpan"),u=Fu(e,"TimeStamp"),h=Fu(e,"ExtendedData"),p=Fu(e,"visibility");let d,m=Ou(Fu(e,"styleUrl")),f=Fu(e,"LineStyle"),g=Fu(e,"PolyStyle");if(!n.geoms.length)return[];if(a&&(o.name=a),s&&(o.address=s),m){"#"!==m[0]&&(m=`#${m}`),o.styleUrl=m,t[m]&&(o.styleHash=t[m]),r[m]&&(o.styleMapHash=r[m],o.styleHash=t[r[m].normal??""]);const e=i[o.styleHash??""];if(e){f||(f=Fu(e,"LineStyle")),g||(g=Fu(e,"PolyStyle"));const t=Fu(e,"IconStyle");if(t){const e=Fu(t,"Icon");if(e){const t=Ou(Fu(e,"href"));t&&(o.icon=t)}}}}if(l&&(o.description=l),c){const e=Ou(Fu(c,"begin")),t=Ou(Fu(c,"end"));e&&t&&(o.timespan={begin:e,end:t})}if(null!==u&&(o.timestamp=Ou(Fu(u,"when"))??(new Date).toISOString()),null!==f){const e=xu(Ou(Fu(f,"color"))),t=e[0],i=e[1],r=Number.parseFloat(Ou(Fu(f,"width"))??"");t&&(o.stroke=t),Number.isNaN(i)||(o["stroke-opacity"]=i),Number.isNaN(r)||(o["stroke-width"]=r)}if(g){const e=xu(Ou(Fu(g,"color"))),t=e[0],i=e[1],r=Ou(Fu(g,"fill")),n=Ou(Fu(g,"outline"));t&&(o.fill=t),Number.isNaN(i)||(o["fill-opacity"]=i),r&&(o["fill-opacity"]="1"===r?o["fill-opacity"]||1:0),n&&(o["stroke-opacity"]="1"===n?o["stroke-opacity"]||1:0)}if(h){const e=zu(h,"Data"),t=zu(h,"SimpleData");for(d=0;d<e.length;d++)o[e[d].getAttribute("name")??""]=Ou(Fu(e[d],"value"))??"";for(d=0;d<t.length;d++)o[t[d].getAttribute("name")??""]=Ou(t[d])??""}null!==p&&(o.visibility=Ou(p)??""),0!==n.coordTimes.length&&(o.coordTimes=1===n.coordTimes.length?n.coordTimes[0]:n.coordTimes);const y={type:"Feature",geometry:1===n.geoms.length?n.geoms[0]:{type:"GeometryCollection",geometries:n.geoms},properties:o};return Lu(e,"id")&&(y.id=Lu(e,"id")??void 0),[y]}function Su(e,t){const i=zu(e,t),r=[],n=[];let o=[];const a=i.length;if(!(a<2)){for(let e=0;e<a;e++){const t=Vu(i[e]);r.push(t.coordinates),t.time&&n.push(t.time),(t.heartRate||o.length)&&(0===o.length&&(o=new Array(e).fill(null)),o.push(t.heartRate))}return{line:r,times:n,heartRates:o}}}function Au(e){const t=zu(e,"trkseg"),i=[],r=[],n=[];let o;for(let e=0;e<t.length;e++)if(o=Su(t[e],"trkpt"),void 0!==o&&(o.line&&i.push(o.line),o.times&&o.times.length&&r.push(o.times),n.length||o.heartRates&&o.heartRates.length)){if(!n.length)for(let t=0;t<e;t++)n.push(new Array(i[t].length).fill(null));o.heartRates&&o.heartRates.length?n.push(o.heartRates):n.push(new Array(o.line.length).fill(null))}if(0===i.length)return;const a={...Iu(e),...Pu(Fu(e,"extensions"))};return 0!==r.length&&(a.coordTimes=1===i.length?r[0]:r),0!==n.length&&(a.heartRates=1===i.length?n[0]:n),1===i.length?{type:"Feature",properties:a,geometry:{type:"LineString",coordinates:i[0]}}:{type:"Feature",properties:a,geometry:{type:"MultiLineString",coordinates:i}}}function Mu(e){const t=Su(e,"rtept");return void 0===t?void 0:{type:"Feature",properties:{...Iu(e),...Pu(Fu(e,"extensions"))},geometry:{type:"LineString",coordinates:t.line}}}function Eu(e){return{type:"Feature",properties:{...Iu(e),...ju(e,["sym"])},geometry:{type:"Point",coordinates:Vu(e).coordinates}}}function Pu(e){const t={};if(e){const i=Fu(e,"line");if(i){const e=Ou(Fu(i,"color")),r=Number.parseFloat(Ou(Fu(i,"opacity"))??"0"),n=Number.parseFloat(Ou(Fu(i,"width"))??"0");e&&(t.stroke=e),Number.isNaN(r)||(t["stroke-opacity"]=r),Number.isNaN(n)||(t["stroke-width"]=96*n/25.4)}}return t}function Iu(e){const t=ju(e,["name","cmt","desc","type","time","keywords"]),i=zu(e,"link");if(0!==i.length){t.links=[];for(const e of Array.from(i)){const i={href:Lu(e,"href"),...ju(e,["text","type"])};t.links.push(i)}}return t}function ku(e){let t=0;if(!e||!e.length)return t;for(let i=0;i<e.length;i++)t=(t<<5)-t+e.charCodeAt(i)|0;return t}function zu(e,t){return e.getElementsByTagName(t)}function Lu(e,t){return e.getAttribute(t)}function Du(e,t){return Number.parseFloat(Lu(e,t)??"0")}function Fu(e,t){const i=zu(e,t);return i.length?i[0]:null}function Ru(e){return e.normalize&&e.normalize(),e}function Bu(e){return e.map(Number.parseFloat).map((e=>Number.isNaN(e)?null:e))}function Ou(e){return e&&Ru(e),e&&e.textContent}function ju(e,t){const i={};let r,n;for(n=0;n<t.length;n++)r=Fu(e,t[n]),r&&(i[t[n]]=Ou(r)??"");return i}function Nu(e){return Bu(e.replace(/\s*/g,"").split(","))}function $u(e){const t=e.replace(/^\s*|\s*$/g,"").split(/\s+/),i=[];for(const e of t)i.push(Nu(e));return i}function Vu(e){const t=[Du(e,"lon"),Du(e,"lat")],i=Fu(e,"ele"),r=Fu(e,"gpxtpx:hr")||Fu(e,"hr"),n=Fu(e,"time");let o;return i&&(o=Number.parseFloat(Ou(i)??"0"),Number.isNaN(o)||t.push(o)),{coordinates:t,time:n?Ou(n):null,heartRate:null!==r?Number.parseFloat(Ou(r)??"0"):null}}function Uu(e){let t=e;try{"string"==typeof t&&(t=fu(t))}catch{return null}try{return _u(t)}catch{}try{return vu(t)}catch{}return null}function qu(e){const t=e.toString(16);return 1===t.length?`0${t}`:t}function Zu(e){return`#${qu(e[0])}${qu(e[1])}${qu(e[2])}${4===e.length?qu(e[3]):""}`}class Gu extends Array{constructor(e={}){super(),ir(this,"min",0),ir(this,"max",1),"min"in e&&(this.min=e.min),"max"in e&&(this.max=e.max),"stops"in e&&this.setStops(e.stops,{clone:!1})}static fromArrayDefinition(e){return new Gu({stops:e.map((e=>({value:e[0],color:e[1]})))})}setStops(e,t={clone:!0}){const i=t.clone?this.clone():this;i.length=0;let r=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY;for(let t=0;t<e.length;t+=1)r=Math.min(r,e[t].value),n=Math.max(n,e[t].value),i.push({value:e[t].value,color:e[t].color.slice()});return i.sort(((e,t)=>e.value<t.value?-1:1)),this.min=r,this.max=n,i}scale(e,t,i={clone:!0}){const r=i.clone,n=this[0].value,o=this.at(-1).value-n,a=t-e,s=[];for(let t=0;t<this.length;t+=1){const i=(this[t].value-n)/o*a+e;r?s.push({value:i,color:this[t].color.slice()}):this[t].value=i}return r?new Gu({stops:s}):this}at(e){return e<0?this[this.length+e]:this[e]}clone(){return new Gu({stops:this.getRawColorStops()})}getRawColorStops(){const e=[];for(let t=0;t<this.length;t+=1)e.push({value:this[t].value,color:this[t].color});return e}reverse(e={clone:!0}){const t=e.clone?this.clone():this;for(let e=0;e<~~(t.length/2);e+=1){const i=t[e].color;t[e].color=t.at(-(e+1)).color,t.at(-(e+1)).color=i}return t}getBounds(){return{min:this.min,max:this.max}}getColor(e,t={smooth:!0}){if(e<=this[0].value)return this[0].color;if(e>=this.at(-1).value)return this.at(-1).color;for(let i=0;i<this.length-1;i+=1){if(e>this[i+1].value)continue;const r=this[i].color;if(!t.smooth)return r.slice();const n=this[i].value,o=this[i+1].value,a=this[i+1].color,s=(o-e)/(o-n);return r.map(((e,t)=>Math.round(e*s+a[t]*(1-s))))}return[0,0,0]}getColorHex(e,t={smooth:!0,withAlpha:!1}){return Zu(this.getColor(e,t))}getColorRelative(e,t={smooth:!0}){const i=this.getBounds();return this.getColor(i.min+e*(i.max-i.min),t)}getCanvasStrip(e={horizontal:!0,size:512,smooth:!0}){const t=document.createElement("canvas");t.width=e.horizontal?e.size:1,t.height=e.horizontal?1:e.size;const i=t.getContext("2d");if(!i)throw new Error("Canvs context is missing");const r=i.getImageData(0,0,t.width,t.height),n=r.data,o=e.size,a=this[0].value,s=(this.at(-1).value-a)/o;for(let t=0;t<o;t+=1){const i=this.getColor(a+t*s,{smooth:e.smooth});n[4*t]=i[0],n[4*t+1]=i[1],n[4*t+2]=i[2],n[4*t+3]=i.length>3?i[3]:255}return i.putImageData(r,0,0),t}resample(e,t=15){const i=this.getBounds(),r=this.scale(0,1),n=1/(t-1);let o;if("ease-in-square"===e)o=Array.from({length:t},((e,t)=>{const i=t*n,o=i**2;return{value:i,color:r.getColor(o)}}));else if("ease-out-square"===e)o=Array.from({length:t},((e,t)=>{const i=t*n,o=1-(1-i)**2;return{value:i,color:r.getColor(o)}}));else if("ease-out-sqrt"===e)o=Array.from({length:t},((e,t)=>{const i=t*n,o=i**.5;return{value:i,color:r.getColor(o)}}));else if("ease-in-sqrt"===e)o=Array.from({length:t},((e,t)=>{const i=t*n,o=1-(1-i)**.5;return{value:i,color:r.getColor(o)}}));else if("ease-out-exp"===e)o=Array.from({length:t},((e,t)=>{const i=t*n,o=1-2**(-10*i);return{value:i,color:r.getColor(o)}}));else{if("ease-in-exp"!==e)throw new Error("Invalid ressampling method.");o=Array.from({length:t},((e,t)=>{const i=t*n,o=2**(10*i-10);return{value:i,color:r.getColor(o)}}))}return new Gu({stops:o}).scale(i.min,i.max)}transparentStart(){const e=this.getRawColorStops();e.unshift({value:e[0].value,color:e[0].color.slice()}),e[1].value+=.001;for(const t of e)3===t.color.length&&t.color.push(255);return e[0].color[3]=0,new Gu({stops:e})}hasTransparentStart(){return 4===this[0].color.length&&0===this[0].color[3]}}const Hu={NULL:new Gu({stops:[{value:0,color:[0,0,0,0]},{value:1,color:[0,0,0,0]}]}),GRAY:new Gu({stops:[{value:0,color:[0,0,0]},{value:1,color:[255,255,255]}]}),JET:new Gu({stops:[{value:0,color:[0,0,131]},{value:.125,color:[0,60,170]},{value:.375,color:[5,255,255]},{value:.625,color:[255,255,0]},{value:.875,color:[250,0,0]},{value:1,color:[128,0,0]}]}),HSV:new Gu({stops:[{value:0,color:[255,0,0]},{value:.169,color:[253,255,2]},{value:.173,color:[247,255,2]},{value:.337,color:[0,252,4]},{value:.341,color:[0,252,10]},{value:.506,color:[1,249,255]},{value:.671,color:[2,0,253]},{value:.675,color:[8,0,253]},{value:.839,color:[255,0,251]},{value:.843,color:[255,0,245]},{value:1,color:[255,0,6]}]}),HOT:new Gu({stops:[{value:0,color:[0,0,0]},{value:.3,color:[230,0,0]},{value:.6,color:[255,210,0]},{value:1,color:[255,255,255]}]}),SPRING:new Gu({stops:[{value:0,color:[255,0,255]},{value:1,color:[255,255,0]}]}),SUMMER:new Gu({stops:[{value:0,color:[0,128,102]},{value:1,color:[255,255,102]}]}),AUTOMN:new Gu({stops:[{value:0,color:[255,0,0]},{value:1,color:[255,255,0]}]}),WINTER:new Gu({stops:[{value:0,color:[0,0,255]},{value:1,color:[0,255,128]}]}),BONE:new Gu({stops:[{value:0,color:[0,0,0]},{value:.376,color:[84,84,116]},{value:.753,color:[169,200,200]},{value:1,color:[255,255,255]}]}),COPPER:new Gu({stops:[{value:0,color:[0,0,0]},{value:.804,color:[255,160,102]},{value:1,color:[255,199,127]}]}),GREYS:new Gu({stops:[{value:0,color:[0,0,0]},{value:1,color:[255,255,255]}]}),YIGNBU:new Gu({stops:[{value:0,color:[8,29,88]},{value:.125,color:[37,52,148]},{value:.25,color:[34,94,168]},{value:.375,color:[29,145,192]},{value:.5,color:[65,182,196]},{value:.625,color:[127,205,187]},{value:.75,color:[199,233,180]},{value:.875,color:[237,248,217]},{value:1,color:[255,255,217]}]}),GREENS:new Gu({stops:[{value:0,color:[0,68,27]},{value:.125,color:[0,109,44]},{value:.25,color:[35,139,69]},{value:.375,color:[65,171,93]},{value:.5,color:[116,196,118]},{value:.625,color:[161,217,155]},{value:.75,color:[199,233,192]},{value:.875,color:[229,245,224]},{value:1,color:[247,252,245]}]}),YIORRD:new Gu({stops:[{value:0,color:[128,0,38]},{value:.125,color:[189,0,38]},{value:.25,color:[227,26,28]},{value:.375,color:[252,78,42]},{value:.5,color:[253,141,60]},{value:.625,color:[254,178,76]},{value:.75,color:[254,217,118]},{value:.875,color:[255,237,160]},{value:1,color:[255,255,204]}]}),BLUERED:new Gu({stops:[{value:0,color:[0,0,255]},{value:1,color:[255,0,0]}]}),RDBU:new Gu({stops:[{value:0,color:[5,10,172]},{value:.35,color:[106,137,247]},{value:.5,color:[190,190,190]},{value:.6,color:[220,170,132]},{value:.7,color:[230,145,90]},{value:1,color:[178,10,28]}]}),PICNIC:new Gu({stops:[{value:0,color:[0,0,255]},{value:.1,color:[51,153,255]},{value:.2,color:[102,204,255]},{value:.3,color:[153,204,255]},{value:.4,color:[204,204,255]},{value:.5,color:[255,255,255]},{value:.6,color:[255,204,255]},{value:.7,color:[255,153,255]},{value:.8,color:[255,102,204]},{value:.9,color:[255,102,102]},{value:1,color:[255,0,0]}]}),RAINBOW:new Gu({stops:[{value:0,color:[150,0,90]},{value:.125,color:[0,0,200]},{value:.25,color:[0,25,255]},{value:.375,color:[0,152,255]},{value:.5,color:[44,255,150]},{value:.625,color:[151,255,0]},{value:.75,color:[255,234,0]},{value:.875,color:[255,111,0]},{value:1,color:[255,0,0]}]}),PORTLAND:new Gu({stops:[{value:0,color:[12,51,131]},{value:.25,color:[10,136,186]},{value:.5,color:[242,211,56]},{value:.75,color:[242,143,56]},{value:1,color:[217,30,30]}]}),BLACKBODY:new Gu({stops:[{value:0,color:[0,0,0]},{value:.2,color:[230,0,0]},{value:.4,color:[230,210,0]},{value:.7,color:[255,255,255]},{value:1,color:[160,200,255]}]}),EARTH:new Gu({stops:[{value:0,color:[0,0,130]},{value:.1,color:[0,180,180]},{value:.2,color:[40,210,40]},{value:.4,color:[230,230,50]},{value:.6,color:[120,70,20]},{value:1,color:[255,255,255]}]}),ELECTRIC:new Gu({stops:[{value:0,color:[0,0,0]},{value:.15,color:[30,0,100]},{value:.4,color:[120,0,100]},{value:.6,color:[160,90,0]},{value:.8,color:[230,200,0]},{value:1,color:[255,250,220]}]}),VIRIDIS:new Gu({stops:[{value:0,color:[68,1,84]},{value:.13,color:[71,44,122]},{value:.25,color:[59,81,139]},{value:.38,color:[44,113,142]},{value:.5,color:[33,144,141]},{value:.63,color:[39,173,129]},{value:.75,color:[92,200,99]},{value:.88,color:[170,220,50]},{value:1,color:[253,231,37]}]}),INFERNO:new Gu({stops:[{value:0,color:[0,0,4]},{value:.13,color:[31,12,72]},{value:.25,color:[85,15,109]},{value:.38,color:[136,34,106]},{value:.5,color:[186,54,85]},{value:.63,color:[227,89,51]},{value:.75,color:[249,140,10]},{value:.88,color:[249,201,50]},{value:1,color:[252,255,164]}]}),MAGMA:new Gu({stops:[{value:0,color:[0,0,4]},{value:.13,color:[28,16,68]},{value:.25,color:[79,18,123]},{value:.38,color:[129,37,129]},{value:.5,color:[181,54,122]},{value:.63,color:[229,80,100]},{value:.75,color:[251,135,97]},{value:.88,color:[254,194,135]},{value:1,color:[252,253,191]}]}),PLASMA:new Gu({stops:[{value:0,color:[13,8,135]},{value:.13,color:[75,3,161]},{value:.25,color:[125,3,168]},{value:.38,color:[168,34,150]},{value:.5,color:[203,70,121]},{value:.63,color:[229,107,93]},{value:.75,color:[248,148,65]},{value:.88,color:[253,195,40]},{value:1,color:[240,249,33]}]}),WARM:new Gu({stops:[{value:0,color:[125,0,179]},{value:.13,color:[172,0,187]},{value:.25,color:[219,0,170]},{value:.38,color:[255,0,130]},{value:.5,color:[255,63,74]},{value:.63,color:[255,123,0]},{value:.75,color:[234,176,0]},{value:.88,color:[190,228,0]},{value:1,color:[147,255,0]}]}),COOL:new Gu({stops:[{value:0,color:[125,0,179]},{value:.13,color:[116,0,218]},{value:.25,color:[98,74,237]},{value:.38,color:[68,146,231]},{value:.5,color:[0,204,197]},{value:.63,color:[0,247,146]},{value:.75,color:[0,255,88]},{value:.88,color:[40,255,8]},{value:1,color:[147,255,0]}]}),RAINBOW_SOFT:new Gu({stops:[{value:0,color:[125,0,179]},{value:.1,color:[199,0,180]},{value:.2,color:[255,0,121]},{value:.3,color:[255,108,0]},{value:.4,color:[222,194,0]},{value:.5,color:[150,255,0]},{value:.6,color:[0,255,55]},{value:.7,color:[0,246,150]},{value:.8,color:[50,167,222]},{value:.9,color:[103,51,235]},{value:1,color:[124,0,186]}]}),BATHYMETRY:new Gu({stops:[{value:0,color:[40,26,44]},{value:.13,color:[59,49,90]},{value:.25,color:[64,76,139]},{value:.38,color:[63,110,151]},{value:.5,color:[72,142,158]},{value:.63,color:[85,174,163]},{value:.75,color:[120,206,163]},{value:.88,color:[187,230,172]},{value:1,color:[253,254,204]}]}),CDOM:new Gu({stops:[{value:0,color:[47,15,62]},{value:.13,color:[87,23,86]},{value:.25,color:[130,28,99]},{value:.38,color:[171,41,96]},{value:.5,color:[206,67,86]},{value:.63,color:[230,106,84]},{value:.75,color:[242,149,103]},{value:.88,color:[249,193,135]},{value:1,color:[254,237,176]}]}),CHLOROPHYLL:new Gu({stops:[{value:0,color:[18,36,20]},{value:.13,color:[25,63,41]},{value:.25,color:[24,91,59]},{value:.38,color:[13,119,72]},{value:.5,color:[18,148,80]},{value:.63,color:[80,173,89]},{value:.75,color:[132,196,122]},{value:.88,color:[175,221,162]},{value:1,color:[215,249,208]}]}),DENSITY:new Gu({stops:[{value:0,color:[54,14,36]},{value:.13,color:[89,23,80]},{value:.25,color:[110,45,132]},{value:.38,color:[120,77,178]},{value:.5,color:[120,113,213]},{value:.63,color:[115,151,228]},{value:.75,color:[134,185,227]},{value:.88,color:[177,214,227]},{value:1,color:[230,241,241]}]}),FREESURFACE_BLUE:new Gu({stops:[{value:0,color:[30,4,110]},{value:.13,color:[47,14,176]},{value:.25,color:[41,45,236]},{value:.38,color:[25,99,212]},{value:.5,color:[68,131,200]},{value:.63,color:[114,156,197]},{value:.75,color:[157,181,203]},{value:.88,color:[200,208,216]},{value:1,color:[241,237,236]}]}),FREESURFACE_RED:new Gu({stops:[{value:0,color:[60,9,18]},{value:.13,color:[100,17,27]},{value:.25,color:[142,20,29]},{value:.38,color:[177,43,27]},{value:.5,color:[192,87,63]},{value:.63,color:[205,125,105]},{value:.75,color:[216,162,148]},{value:.88,color:[227,199,193]},{value:1,color:[241,237,236]}]}),OXYGEN:new Gu({stops:[{value:0,color:[64,5,5]},{value:.13,color:[106,6,15]},{value:.25,color:[144,26,7]},{value:.38,color:[168,64,3]},{value:.5,color:[188,100,4]},{value:.63,color:[206,136,11]},{value:.75,color:[220,174,25]},{value:.88,color:[231,215,44]},{value:1,color:[248,254,105]}]}),PAR:new Gu({stops:[{value:0,color:[51,20,24]},{value:.13,color:[90,32,35]},{value:.25,color:[129,44,34]},{value:.38,color:[159,68,25]},{value:.5,color:[182,99,19]},{value:.63,color:[199,134,22]},{value:.75,color:[212,171,35]},{value:.88,color:[221,210,54]},{value:1,color:[225,253,75]}]}),PHASE:new Gu({stops:[{value:0,color:[145,105,18]},{value:.13,color:[184,71,38]},{value:.25,color:[186,58,115]},{value:.38,color:[160,71,185]},{value:.5,color:[110,97,218]},{value:.63,color:[50,123,164]},{value:.75,color:[31,131,110]},{value:.88,color:[77,129,34]},{value:1,color:[145,105,18]}]}),SALINITY:new Gu({stops:[{value:0,color:[42,24,108]},{value:.13,color:[33,50,162]},{value:.25,color:[15,90,145]},{value:.38,color:[40,118,137]},{value:.5,color:[59,146,135]},{value:.63,color:[79,175,126]},{value:.75,color:[120,203,104]},{value:.88,color:[193,221,100]},{value:1,color:[253,239,154]}]}),TEMPERATURE:new Gu({stops:[{value:0,color:[4,35,51]},{value:.13,color:[23,51,122]},{value:.25,color:[85,59,157]},{value:.38,color:[129,79,143]},{value:.5,color:[175,95,130]},{value:.63,color:[222,112,101]},{value:.75,color:[249,146,66]},{value:.88,color:[249,196,65]},{value:1,color:[232,250,91]}]}),TURBIDITY:new Gu({stops:[{value:0,color:[34,31,27]},{value:.13,color:[65,50,41]},{value:.25,color:[98,69,52]},{value:.38,color:[131,89,57]},{value:.5,color:[161,112,59]},{value:.63,color:[185,140,66]},{value:.75,color:[202,174,88]},{value:.88,color:[216,209,126]},{value:1,color:[233,246,171]}]}),VELOCITY_BLUE:new Gu({stops:[{value:0,color:[17,32,64]},{value:.13,color:[35,52,116]},{value:.25,color:[29,81,156]},{value:.38,color:[31,113,162]},{value:.5,color:[50,144,169]},{value:.63,color:[87,173,176]},{value:.75,color:[149,196,189]},{value:.88,color:[203,221,211]},{value:1,color:[254,251,230]}]}),VELOCITY_GREEN:new Gu({stops:[{value:0,color:[23,35,19]},{value:.13,color:[24,64,38]},{value:.25,color:[11,95,45]},{value:.38,color:[39,123,35]},{value:.5,color:[95,146,12]},{value:.63,color:[152,165,18]},{value:.75,color:[201,186,69]},{value:.88,color:[233,216,137]},{value:1,color:[255,253,205]}]}),CUBEHELIX:new Gu({stops:[{value:0,color:[0,0,0]},{value:.07,color:[22,5,59]},{value:.13,color:[60,4,105]},{value:.2,color:[109,1,135]},{value:.27,color:[161,0,147]},{value:.33,color:[210,2,142]},{value:.4,color:[251,11,123]},{value:.47,color:[255,29,97]},{value:.53,color:[255,54,69]},{value:.6,color:[255,85,46]},{value:.67,color:[255,120,34]},{value:.73,color:[255,157,37]},{value:.8,color:[241,191,57]},{value:.87,color:[224,220,93]},{value:.93,color:[218,241,142]},{value:1,color:[227,253,198]}]}),CIVIDIS:new Gu({stops:[{value:0,color:[0,32,77,255]},{value:.125,color:[5,54,110,255]},{value:.25,color:[65,77,108,255]},{value:.375,color:[97,100,111,255]},{value:.5,color:[125,124,121,255]},{value:.625,color:[156,149,120,255]},{value:.75,color:[190,175,111,255]},{value:.875,color:[225,204,94,255]},{value:1,color:[255,235,70,255]}]}),TURBO:new Gu({stops:[{value:0,color:[48,18,59,255]},{value:.125,color:[70,107,227,255]},{value:.25,color:[40,187,236,255]},{value:.375,color:[49,242,153,255]},{value:.5,color:[162,252,60,255]},{value:.625,color:[237,208,58,255]},{value:.75,color:[251,128,34,255]},{value:.875,color:[210,49,5,255]},{value:1,color:[122,4,3,255]}]}),ROCKET:new Gu({stops:[{value:0,color:[250,235,221,0]},{value:.133,color:[250,235,221,255]},{value:.266,color:[246,170,130,255]},{value:.4,color:[240,96,67,255]},{value:.533,color:[203,27,79,255]},{value:.666,color:[132,30,90,255]},{value:.8,color:[63,27,68,255]},{value:1,color:[3,5,26,255]}]}),MAKO:new Gu({stops:[{value:0,color:[11,4,5,255]},{value:.125,color:[43,28,53,255]},{value:.25,color:[62,53,107,255]},{value:.375,color:[59,86,152,255]},{value:.5,color:[53,123,162,255]},{value:.625,color:[53,158,170,255]},{value:.75,color:[73,193,173,255]},{value:.875,color:[150,221,181,255]},{value:1,color:[222,245,229,255]}]})};async function Wu(e,t={}){const i=t.download??!1,r=await Ku(e);if(i){const e=t.filename??"maptiler_screenshot.png",i=document.createElement("a");i.style.display="none",document.body.appendChild(i),i.href=URL.createObjectURL(r),i.download=e,i.click(),setTimeout((()=>{document.body.removeChild(i),URL.revokeObjectURL(i.href)}),0)}return r}function Ku(e){return new Promise(((t,i)=>{e.redraw(),e.once("idle",(()=>{e.getCanvas().toBlob((e=>{if(!e)return i(Error("Screenshot could not be created."));t(e)}),"image/png")}))}))}const Xu=[["#1D5B79","#468B97","#EF6262","#F3AA60"],["#614BC3","#33BBC5","#85E6C5","#C8FFE0"],["#461959","#7A316F","#CD6688","#AED8CC"],["#0079FF","#00DFA2","#F6FA70","#FF0060"],["#39B5E0","#A31ACB","#FF78F0","#F5EA5A"],["#37E2D5","#590696","#C70A80","#FBCB0A"],["#FFD36E","#FFF56D","#99FFCD","#9FB4FF"],["#00EAD3","#FFF5B7","#FF449F","#005F99"],["#10A19D","#540375","#FF7000","#FFBF00"]];function Yu(){return Xu[~~(Math.random()*Xu.length)][~~(4*Math.random())]}function Ju(){return`maptiler_source_${Fr()}`}function Qu(){return`maptiler_layer_${Fr()}`}function eh(e,t){if(t<=e[0].zoom)return e[0].value;if(t>=e[e.length-1].zoom)return e[e.length-1].value;for(let i=0;i<e.length-1;i+=1)if(t>=e[i].zoom&&t<e[i+1].zoom){const r=e[i+1].zoom-e[i].zoom,n=(t-e[i].zoom)/r;return n*e[i+1].value+(1-n)*e[i].value}return 0}function th(e){return["interpolate",["linear"],["zoom"],...e.flatMap((e=>[e.zoom,e.value]))]}function ih(e){return["interpolate",["linear"],["zoom"],...e.flatMap((e=>[e.zoom,e.value]))]}function rh(e,t){if("number"==typeof t&&"number"==typeof e)return 2*t+e;if("number"==typeof t&&Array.isArray(e))return["interpolate",["linear"],["zoom"],...e.flatMap((e=>[e.zoom,2*t+e.value]))];if("number"==typeof e&&Array.isArray(t))return["interpolate",["linear"],["zoom"],...t.flatMap((t=>[t.zoom,2*t.value+e]))];if(Array.isArray(e)&&Array.isArray(t)){const i=Array.from(new Set([...e.map((e=>e.zoom)),...t.map((e=>e.zoom))])).sort(((e,t)=>e<t?-1:1));return["interpolate",["linear"],["zoom"],...i.flatMap((i=>[i,2*eh(t,i)+eh(e,i)]))]}return 0}function nh(e,t){return["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.propertyValue,e.value]))]}function oh(e){const t=e.trimStart(),i=`${t}${" ".repeat(e.length-t.length)}`,r=Array.from(i);if(!r.every((e=>" "===e||"_"===e)))throw new Error("A dash pattern must be composed only of whitespace and underscore characters.");if(!r.some((e=>"_"===e))||!r.some((e=>" "===e)))throw new Error("A dash pattern must contain at least one underscore and one whitespace character");const n=[1];for(let e=1;e<r.length;e+=1){r[e-1]===r[e]?n[n.length-1]+=1:n.push(1)}return n}function ah(e,t){return["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.value,e.color]))]}function sh(e,t,i=!0){return i?["interpolate",["linear"],["zoom"],0,["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.value,.025*e.pointRadius]))],2,["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.value,.05*e.pointRadius]))],4,["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.value,.1*e.pointRadius]))],8,["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.value,.25*e.pointRadius]))],16,["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.value,e.pointRadius]))]]:["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.value,e.pointRadius]))]}function lh(e,t,i=!0){return i?["interpolate",["linear"],["zoom"],0,["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.propertyValue,.025*e.value]))],2,["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.propertyValue,.05*e.value]))],4,["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.propertyValue,.1*e.value]))],8,["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.propertyValue,.25*e.value]))],16,["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.propertyValue,e.value]))]]:["interpolate",["linear"],["get",t],...e.flatMap((e=>[e.propertyValue,e.value]))]}function ch(e,t){return e.every((t=>t.color[3]===e[0].color[3]))?e[0].color[3]?e[0].color[3]/255:1:["interpolate",["linear"],["get",t],...e.getRawColorStops().flatMap((e=>{const t=e.value,i=e.color;return[t,4===i.length?i[3]/255:1]}))]}function uh(e,t=10){return["interpolate",["linear"],["heatmap-density"],...Array.from({length:t+1},((i,r)=>{const n=r/t;return[n,e.getColorHex(n)]})).flat()]}async function hh(e,t,i={}){var r,n;if(!t.sourceId&&!t.data)throw new Error("Creating a polyline layer requires an existing .sourceId or a valid .data property");let o=t.data;if("string"==typeof o){if(Rr(o))o=`https://api.maptiler.com/data/${t.data}/features.json?key=${fr.apiKey}`;else if("gpx"===(null==(r=o.split(".").pop())?void 0:r.toLowerCase().trim())){o=_u(await(await fetch(o,i)).text())}else if("kml"===(null==(n=o.split(".").pop())?void 0:n.toLowerCase().trim())){o=vu(await(await fetch(o,i)).text())}else{const e=Br(o)??Uu(o);e&&(o=e)}if(!o)throw new Error("Polyline data was provided as string but is incompatible with valid formats.")}return ph(e,{...t,data:o})}function ph(e,t){if(t.layerId&&e.getLayer(t.layerId))throw new Error(`A layer already exists with the layer id: ${t.layerId}`);const i=t.sourceId??Ju(),r=t.layerId??Qu(),n={polylineLayerId:r,polylineOutlineLayerId:"",polylineSourceId:i};t.data&&!e.getSource(i)&&e.addSource(i,{type:"geojson",data:t.data});const o=t.lineWidth??3,a=t.lineColor??Yu(),s=t.lineOpacity??1,l=t.lineBlur??0,c=t.lineGapWidth??0;let u=t.lineDashArray??null;const h=t.outlineWidth??1,p=t.outlineColor??"#FFFFFF",d=t.outlineOpacity??1,m=t.outlineBlur??0;if("string"==typeof u&&(u=oh(u)),!0===t.outline){const a=`${r}_outline`;n.polylineOutlineLayerId=a,e.addLayer({id:a,type:"line",source:i,layout:{"line-join":t.lineJoin??"round","line-cap":t.lineCap??"round"},minzoom:t.minzoom??0,maxzoom:t.maxzoom??23,paint:{"line-opacity":"number"==typeof d?d:ih(d),"line-color":"string"==typeof p?p:th(p),"line-width":rh(o,h),"line-blur":"number"==typeof m?m:ih(m)}},t.beforeId)}return e.addLayer({id:r,type:"line",source:i,layout:{"line-join":t.lineJoin??"round","line-cap":t.lineCap??"round"},minzoom:t.minzoom??0,maxzoom:t.maxzoom??23,paint:{"line-opacity":"number"==typeof s?s:ih(s),"line-color":"string"==typeof a?a:th(a),"line-width":"number"==typeof o?o:ih(o),"line-blur":"number"==typeof l?l:ih(l),"line-gap-width":"number"==typeof c?c:ih(c),...u&&{"line-dasharray":u}}},t.beforeId),n}function dh(e,t){if(t.layerId&&e.getLayer(t.layerId))throw new Error(`A layer already exists with the layer id: ${t.layerId}`);const i=t.sourceId??Ju(),r=t.layerId??Qu(),n={polygonLayerId:r,polygonOutlineLayerId:t.outline?`${r}_outline`:"",polygonSourceId:i};if(t.data&&!e.getSource(i)){let r=t.data;"string"==typeof r&&Rr(r)&&(r=`https://api.maptiler.com/data/${r}/features.json?key=${fr.apiKey}`),e.addSource(i,{type:"geojson",data:r})}let o=t.outlineDashArray??null;const a=t.outlineWidth??1,s=t.outlineColor??"#FFFFFF",l=t.outlineOpacity??1,c=t.outlineBlur??0,u=t.fillColor??Yu(),h=t.fillOpacity??1,p=t.outlinePosition??"center",d=t.pattern??null;"string"==typeof o&&(o=oh(o));const m=(d=null)=>{if(e.addLayer({id:r,type:"fill",source:i,minzoom:t.minzoom??0,maxzoom:t.maxzoom??23,paint:{"fill-color":"string"==typeof u?u:th(u),"fill-opacity":"number"==typeof h?h:ih(h),...d&&{"fill-pattern":d}}},t.beforeId),!0===t.outline){let r;r="inside"===p?"number"==typeof a?.5*a:ih(a.map((({zoom:e,value:t})=>({zoom:e,value:.5*t})))):"outside"===p?"number"==typeof a?-.5*a:ih(a.map((e=>({zoom:e.zoom,value:-.5*e.value})))):0,e.addLayer({id:n.polygonOutlineLayerId,type:"line",source:i,layout:{"line-join":t.outlineJoin??"round","line-cap":t.outlineCap??"butt"},minzoom:t.minzoom??0,maxzoom:t.maxzoom??23,paint:{"line-opacity":"number"==typeof l?l:ih(l),"line-color":"string"==typeof s?s:th(s),"line-width":"number"==typeof a?a:ih(a),"line-blur":"number"==typeof c?c:ih(c),"line-offset":r,...o&&{"line-dasharray":o}}},t.beforeId)}};return d?e.hasImage(d)?m(d):e.loadImage(d).then((t=>{e.addImage(d,t.data),m(d)})).catch((e=>m())):m(),n}function mh(e,t){if(t.layerId&&e.getLayer(t.layerId))throw new Error(`A layer already exists with the layer id: ${t.layerId}`);const i=t.minPointRadius??10,r=t.maxPointRadius??50,n=t.cluster??!1,o=20,a=Array.isArray(t.pointColor)?t.pointColor:Hu.TURBO.scale(10,t.cluster?1e4:1e3).resample("ease-out-square"),s=a.getBounds(),l=t.sourceId??Ju(),c=t.layerId??Qu(),u=t.showLabel??n,h=t.alignOnViewport??!0,p=t.outline??!1,d=t.outlineOpacity??1,m=t.outlineWidth??1,f=t.outlineColor??"#FFFFFF";let g;const y=t.zoomCompensation??!0,_=t.minzoom??0,v=t.maxzoom??23;g="number"==typeof t.pointOpacity?t.pointOpacity:Array.isArray(t.pointOpacity)?ih(t.pointOpacity):t.cluster?ch(a,"point_count"):t.property?ch(a,t.property):ih([{zoom:_,value:0},{zoom:_+.25,value:1},{zoom:v-.25,value:1},{zoom:v,value:0}]);const x={pointLayerId:c,clusterLayerId:"",labelLayerId:"",pointSourceId:l};if(t.data&&!e.getSource(l)){let i=t.data;"string"==typeof i&&Rr(i)&&(i=`https://api.maptiler.com/data/${i}/features.json?key=${fr.apiKey}`),e.addSource(l,{type:"geojson",data:i,cluster:n})}if(n){x.clusterLayerId=`${c}_cluster`;const n=Array.from({length:o},((e,t)=>{const n=s.min+t*(s.max-s.min)/19;return{value:n,pointRadius:i+(r-i)*(t/19)**.5,color:a.getColorHex(n)}}));e.addLayer({id:x.clusterLayerId,type:"circle",source:l,filter:["has","point_count"],paint:{"circle-color":"string"==typeof t.pointColor?t.pointColor:ah(n,"point_count"),"circle-radius":"number"==typeof t.pointRadius?t.pointRadius:Array.isArray(t.pointRadius)?ih(t.pointRadius):sh(n,"point_count",!1),"circle-pitch-alignment":h?"viewport":"map","circle-pitch-scale":"map","circle-opacity":g,...p&&{"circle-stroke-opacity":"number"==typeof d?d:ih(d),"circle-stroke-width":"number"==typeof m?m:ih(m),"circle-stroke-color":"string"==typeof f?f:th(f)}},minzoom:_,maxzoom:v},t.beforeId),e.addLayer({id:x.pointLayerId,type:"circle",source:l,filter:["!",["has","point_count"]],paint:{"circle-pitch-alignment":h?"viewport":"map","circle-pitch-scale":"map","circle-color":"string"==typeof t.pointColor?t.pointColor:a.getColorHex(a.getBounds().min),"circle-radius":"number"==typeof t.pointRadius?t.pointRadius:Array.isArray(t.pointRadius)?ih(t.pointRadius):.75*n[0].pointRadius,"circle-opacity":g,...p&&{"circle-stroke-opacity":"number"==typeof d?d:ih(d),"circle-stroke-width":"number"==typeof m?m:ih(m),"circle-stroke-color":"string"==typeof f?f:th(f)}},minzoom:_,maxzoom:v},t.beforeId)}else{let n="string"==typeof t.pointColor?t.pointColor:Array.isArray(t.pointColor)?t.pointColor.getColorHex(t.pointColor.getBounds().min):Yu(),c="number"==typeof t.pointRadius?y?ih([{zoom:0,value:.025*t.pointRadius},{zoom:2,value:.05*t.pointRadius},{zoom:4,value:.1*t.pointRadius},{zoom:8,value:.25*t.pointRadius},{zoom:16,value:1*t.pointRadius}]):t.pointRadius:Array.isArray(t.pointRadius)?ih(t.pointRadius):y?ih([{zoom:0,value:.05*i},{zoom:2,value:.1*i},{zoom:4,value:.2*i},{zoom:8,value:.5*i},{zoom:16,value:1*i}]):i;if(t.property&&Array.isArray(t.pointColor)){const e=Array.from({length:o},((e,n)=>{const o=s.min+n*(s.max-s.min)/19;return{value:o,pointRadius:"number"==typeof t.pointRadius?t.pointRadius:i+(r-i)*(n/19)**.5,color:"string"==typeof t.pointColor?t.pointColor:a.getColorHex(o)}}));n=ah(e,t.property),c=sh(e,t.property,y)}e.addLayer({id:x.pointLayerId,type:"circle",source:l,layout:{"circle-sort-key":t.property?["/",1,["get",t.property]]:0},paint:{"circle-pitch-alignment":h?"viewport":"map","circle-pitch-scale":"map","circle-color":n,"circle-opacity":g,"circle-radius":c,...p&&{"circle-stroke-opacity":"number"==typeof d?d:ih(d),"circle-stroke-width":"number"==typeof m?m:ih(m),"circle-stroke-color":"string"==typeof f?f:th(f)}},minzoom:_,maxzoom:v},t.beforeId)}if(!1!==u&&(t.cluster||t.property)){x.labelLayerId=`${c}_label`;const i=t.labelColor??"#fff",r=t.labelSize??12;e.addLayer({id:x.labelLayerId,type:"symbol",source:l,filter:["has",t.cluster?"point_count":t.property],layout:{"text-field":t.cluster?"{point_count_abbreviated}":`{${t.property}}`,"text-font":["Noto Sans Regular"],"text-size":r,"text-pitch-alignment":h?"viewport":"map","symbol-sort-key":["/",1,["get",t.cluster?"point_count":t.property]]},paint:{"text-color":i,"text-opacity":g},minzoom:_,maxzoom:v},t.beforeId)}return x}function fh(e,t){if(t.layerId&&e.getLayer(t.layerId))throw new Error(`A layer already exists with the layer id: ${t.layerId}`);const i=t.sourceId??Ju(),r=t.layerId??Qu(),n=t.minzoom??0,o=t.maxzoom??23,a=t.zoomCompensation??!0,s=t.opacity??[{zoom:n,value:0},{zoom:n+.25,value:1},{zoom:o-.25,value:1},{zoom:o,value:0}];let l=Array.isArray(t.colorRamp)?t.colorRamp:Hu.TURBO.transparentStart();const c=l.getBounds();(0!==c.min||1!==c.max)&&(l=l.scale(0,1)),l.hasTransparentStart()||(l=l.transparentStart());const u=t.intensity??[{zoom:0,value:.01},{zoom:4,value:.2},{zoom:16,value:1}],h=t.property??null,p=t.weight??1;let d=1;h?"number"==typeof p?(d=p,"number"==typeof t.weight&&console.warn("The option `.property` is ignored when `.propertyValueWeights` is not of type `PropertyValueWeights`")):Array.isArray(p)?d=nh(p,h):console.warn("The option `.property` is ignored when `.propertyValueWeights` is not of type `PropertyValueWeights`"):"number"==typeof p?d=p:Array.isArray(p)&&console.warn("The options `.propertyValueWeights` can only be used when `.property` is provided.");const m=[{zoom:0,value:1.25},{zoom:2,value:2.5},{zoom:4,value:5},{zoom:8,value:12.5},{zoom:16,value:50}],f=t.radius??(a?m:10);let g=1;"number"==typeof f?g=f:Array.isArray(f)&&"zoom"in f[0]?g=ih(f):h&&Array.isArray(f)&&"propertyValue"in f[0]?g=lh(f,h,a):!h&&Array.isArray(f)&&"propertyValue"in f[0]?(g=ih(m),console.warn("The option `.radius` can only be property-driven if the option `.property` is provided.")):g=ih(m);const y={heatmapLayerId:r,heatmapSourceId:i};if(t.data&&!e.getSource(i)){let r=t.data;"string"==typeof r&&Rr(r)&&(r=`https://api.maptiler.com/data/${r}/features.json?key=${fr.apiKey}`),e.addSource(i,{type:"geojson",data:r})}return e.addLayer({id:r,type:"heatmap",source:i,minzoom:n,maxzoom:o,paint:{"heatmap-weight":d,"heatmap-intensity":"number"==typeof u?u:ih(u),"heatmap-color":uh(l),"heatmap-radius":g,"heatmap-opacity":"number"==typeof s?s:ih(s)}},t.beforeId),y}const gh={addPolyline:hh,addPolygon:dh,addPoint:mh,addHeatmap:fh,takeScreenshot:Wu};Pr(),It.Map,It.Marker,It.Popup,It.Style,It.CanvasSource,It.GeoJSONSource,It.ImageSource,It.RasterTileSource,It.RasterDEMTileSource,It.VectorTileSource,It.VideoSource,It.NavigationControl,It.GeolocateControl,It.AttributionControl,It.LogoControl,It.ScaleControl,It.FullscreenControl,It.TerrainControl,It.BoxZoomHandler,It.ScrollZoomHandler,It.CooperativeGesturesHandler,It.KeyboardHandler,It.TwoFingersTouchPitchHandler,It.MapWheelEvent,It.MapTouchEvent,It.MapMouseEvent,It.config,It.getVersion;const{setRTLTextPlugin:yh,getRTLTextPluginStatus:_h,LngLat:vh,LngLatBounds:xh,MercatorCoordinate:bh,Evented:wh,AJAXError:Ch,prewarm:Th,clearPrewarmedResources:Sh,Hash:Ah,Point:Mh,EdgeInsets:Eh,DragRotateHandler:Ph,DragPanHandler:Ih,TwoFingersTouchZoomRotateHandler:kh,DoubleClickZoomHandler:zh,TwoFingersTouchZoomHandler:Lh,TwoFingersTouchRotateHandler:Dh,getWorkerCount:Fh,setWorkerCount:Rh,getMaxParallelImageRequests:Bh,setMaxParallelImageRequests:Oh,getWorkerUrl:jh,setWorkerUrl:Nh,addSourceType:$h,importScriptInWorkers:Vh,addProtocol:Uh,removeProtocol:qh}=It;var Zh=G`.maplibregl-map{font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative;-webkit-tap-highlight-color:rgba(0, 0, 0, 0)}.maplibregl-canvas{left:0;position:absolute;top:0}.maplibregl-map:fullscreen{height:100%;width:100%}.maplibregl-ctrl-group button.maplibregl-ctrl-compass{touch-action:none}.maplibregl-canvas-container.maplibregl-interactive,.maplibregl-ctrl-group button.maplibregl-ctrl-compass{cursor:grab;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer{cursor:pointer}.maplibregl-canvas-container.maplibregl-interactive:active,.maplibregl-ctrl-group button.maplibregl-ctrl-compass:active{cursor:grabbing}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-canvas-container.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:pinch-zoom}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:none}.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures,.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-ctrl-bottom-left,.maplibregl-ctrl-bottom-right,.maplibregl-ctrl-top-left,.maplibregl-ctrl-top-right{pointer-events:none;position:absolute;z-index:2}.maplibregl-ctrl-top-left{left:0;top:0}.maplibregl-ctrl-top-right{right:0;top:0}.maplibregl-ctrl-bottom-left{bottom:0;left:0}.maplibregl-ctrl-bottom-right{bottom:0;right:0}.maplibregl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.maplibregl-ctrl-top-left .maplibregl-ctrl{float:left;margin:10px 0 0 10px}.maplibregl-ctrl-top-right .maplibregl-ctrl{float:right;margin:10px 10px 0 0}.maplibregl-ctrl-bottom-left .maplibregl-ctrl{float:left;margin:0 0 10px 10px}.maplibregl-ctrl-bottom-right .maplibregl-ctrl{float:right;margin:0 10px 10px 0}.maplibregl-ctrl-group{background:#fff;border-radius:4px}.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px rgba(0,0,0,.1)}@media (forced-colors:active){.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}}.maplibregl-ctrl-group button{background-color:transparent;border:0;box-sizing:border-box;cursor:pointer;display:block;height:29px;outline:none;padding:0;width:29px}.maplibregl-ctrl-group button+button{border-top:1px solid #ddd}.maplibregl-ctrl button .maplibregl-ctrl-icon{background-position:50%;background-repeat:no-repeat;display:block;height:100%;width:100%}@media (forced-colors:active){.maplibregl-ctrl-icon{background-color:transparent}.maplibregl-ctrl-group button+button{border-top:1px solid ButtonText}}.maplibregl-ctrl button::-moz-focus-inner{border:0;padding:0}.maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl button:disabled{cursor:not-allowed}.maplibregl-ctrl button:disabled .maplibregl-ctrl-icon{opacity:.25}@media (hover:hover){.maplibregl-ctrl button:not(:disabled):hover{background-color:rgba(0, 0, 0, 0.05)}}.maplibregl-ctrl button:not(:disabled):active{background-color:rgba(0, 0, 0, 0.05)}.maplibregl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.maplibregl-ctrl-group button:focus:first-child{border-radius:4px 4px 0 0}.maplibregl-ctrl-group button:focus:last-child{border-radius:0 0 4px 4px}.maplibregl-ctrl-group button:focus:only-child{border-radius:inherit}.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E")}}.maplibregl-ctrl button.maplibregl-ctrl-globe .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='none' stroke='%23333' viewBox='0 0 22 22'%3E%3Ccircle cx='11' cy='11' r='8.5'/%3E%3Cpath d='M17.5 11c0 4.819-3.02 8.5-6.5 8.5S4.5 15.819 4.5 11 7.52 2.5 11 2.5s6.5 3.681 6.5 8.5Z'/%3E%3Cpath d='M13.5 11c0 2.447-.331 4.64-.853 6.206-.262.785-.562 1.384-.872 1.777-.314.399-.58.517-.775.517s-.461-.118-.775-.517c-.31-.393-.61-.992-.872-1.777C8.831 15.64 8.5 13.446 8.5 11s.331-4.64.853-6.206c.262-.785.562-1.384.872-1.777.314-.399.58-.517.775-.517s.461.118.775.517c.31.393.61.992.872 1.777.522 1.565.853 3.76.853 6.206Z'/%3E%3Cpath d='M11 7.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138q.07-.058.224-.138c.299-.151.763-.302 1.379-.434C7.378 5.666 9.091 5.5 11 5.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138q-.07.058-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428ZM4.486 6.436ZM11 16.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138 1.3 1.3 0 0 1 .224-.138c.299-.151.763-.302 1.379-.434C7.378 14.666 9.091 14.5 11 14.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138a1.3 1.3 0 0 1-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428Zm-6.514-1.064ZM11 12.5c-2.46 0-4.672-.222-6.255-.574-.796-.177-1.406-.38-1.805-.59a1.5 1.5 0 0 1-.39-.272.3.3 0 0 1-.047-.064.3.3 0 0 1 .048-.064c.066-.073.189-.167.389-.272.399-.21 1.009-.413 1.805-.59C6.328 9.722 8.54 9.5 11 9.5s4.672.222 6.256.574c.795.177 1.405.38 1.804.59.2.105.323.2.39.272a.3.3 0 0 1 .047.064.3.3 0 0 1-.048.064 1.4 1.4 0 0 1-.389.272c-.399.21-1.009.413-1.804.59-1.584.352-3.796.574-6.256.574Zm-8.501-1.51v.002zm0 .018v.002zm17.002.002v-.002zm0-.018v-.002z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-globe-enabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='none' stroke='%2333b5e5' viewBox='0 0 22 22'%3E%3Ccircle cx='11' cy='11' r='8.5'/%3E%3Cpath d='M17.5 11c0 4.819-3.02 8.5-6.5 8.5S4.5 15.819 4.5 11 7.52 2.5 11 2.5s6.5 3.681 6.5 8.5Z'/%3E%3Cpath d='M13.5 11c0 2.447-.331 4.64-.853 6.206-.262.785-.562 1.384-.872 1.777-.314.399-.58.517-.775.517s-.461-.118-.775-.517c-.31-.393-.61-.992-.872-1.777C8.831 15.64 8.5 13.446 8.5 11s.331-4.64.853-6.206c.262-.785.562-1.384.872-1.777.314-.399.58-.517.775-.517s.461.118.775.517c.31.393.61.992.872 1.777.522 1.565.853 3.76.853 6.206Z'/%3E%3Cpath d='M11 7.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138q.07-.058.224-.138c.299-.151.763-.302 1.379-.434C7.378 5.666 9.091 5.5 11 5.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138q-.07.058-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428ZM4.486 6.436ZM11 16.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.3 1.3 0 0 1-.224-.138 1.3 1.3 0 0 1 .224-.138c.299-.151.763-.302 1.379-.434C7.378 14.666 9.091 14.5 11 14.5s3.622.166 4.845.428c.616.132 1.08.283 1.379.434.105.053.177.1.224.138a1.3 1.3 0 0 1-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428Zm-6.514-1.064ZM11 12.5c-2.46 0-4.672-.222-6.255-.574-.796-.177-1.406-.38-1.805-.59a1.5 1.5 0 0 1-.39-.272.3.3 0 0 1-.047-.064.3.3 0 0 1 .048-.064c.066-.073.189-.167.389-.272.399-.21 1.009-.413 1.805-.59C6.328 9.722 8.54 9.5 11 9.5s4.672.222 6.256.574c.795.177 1.405.38 1.804.59.2.105.323.2.39.272a.3.3 0 0 1 .047.064.3.3 0 0 1-.048.064 1.4 1.4 0 0 1-.389.272c-.399.21-1.009.413-1.804.59-1.584.352-3.796.574-6.256.574Zm-8.501-1.51v.002zm0 .018v.002zm17.002.002v-.002zm0-.018v-.002z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-terrain .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%23333' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-terrain-enabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='%2333b5e5' viewBox='0 0 22 22'%3E%3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23333' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23aaa' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-waiting .maplibregl-ctrl-icon{animation:maplibregl-spin 2s linear infinite}@media (forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23fff' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23999' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e58978' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2333b5e5' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23e54e33' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3C/svg%3E")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%23666' viewBox='0 0 20 20'%3E%3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E%3Ccircle cx='10' cy='10' r='2'/%3E%3Cpath fill='red' d='m14 5 1 1-9 9-1-1z'/%3E%3C/svg%3E")}}@keyframes maplibregl-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E");background-repeat:no-repeat;cursor:pointer;display:block;height:23px;margin:0 0 -4px -4px;overflow:hidden;width:88px}a.maplibregl-ctrl-logo.maplibregl-compact{width:14px}@media (forced-colors:active){a.maplibregl-ctrl-logo{background-color:transparent;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E")}}@media (forced-colors:active) and (prefers-color-scheme:light){a.maplibregl-ctrl-logo{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E%3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E%3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E%3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E%3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E%3Cg style='stroke-width:1.12603545'%3E%3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E%3C/g%3E%3C/svg%3E")}}.maplibregl-ctrl.maplibregl-ctrl-attrib{background-color:hsla(0,0%,100%,.5);margin:0;padding:0 5px}@media screen{.maplibregl-ctrl-attrib.maplibregl-compact{background-color:#fff;border-radius:12px;box-sizing:content-box;color:#000;margin:10px;min-height:20px;padding:2px 24px 2px 0;position:relative}.maplibregl-ctrl-attrib.maplibregl-compact-show{padding:2px 28px 2px 8px;visibility:visible}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact-show,.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact-show{border-radius:12px;padding:2px 8px 2px 28px}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner{display:none}.maplibregl-ctrl-attrib-button{background-color:hsla(0,0%,100%,.5);background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E");border:0;border-radius:12px;box-sizing:border-box;cursor:pointer;display:none;height:24px;outline:none;position:absolute;right:0;top:0;width:24px}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button{-webkit-appearance:none;-moz-appearance:none;appearance:none;list-style:none}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button::-webkit-details-marker{display:none}.maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button{left:0}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner{display:block}.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button{background-color:rgba(0, 0, 0, 0.05)}.maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;right:0}.maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{right:0;top:0}.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{left:0;top:0}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;left:0}}@media screen and (forced-colors:active){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='%23fff' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}@media screen and (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")}}.maplibregl-ctrl-attrib a{color:rgba(0,0,0,.75);-webkit-text-decoration:none;text-decoration:none}.maplibregl-ctrl-attrib a:hover{color:inherit;-webkit-text-decoration:underline;text-decoration:underline}.maplibregl-attrib-empty{display:none}.maplibregl-ctrl-scale{background-color:hsla(0,0%,100%,.75);border:2px solid #333;border-top:#333;box-sizing:border-box;color:#333;font-size:10px;padding:0 5px}.maplibregl-popup{display:flex;left:0;pointer-events:none;position:absolute;top:0;will-change:transform}.maplibregl-popup-anchor-top,.maplibregl-popup-anchor-top-left,.maplibregl-popup-anchor-top-right{flex-direction:column}.maplibregl-popup-anchor-bottom,.maplibregl-popup-anchor-bottom-left,.maplibregl-popup-anchor-bottom-right{flex-direction:column-reverse}.maplibregl-popup-anchor-left{flex-direction:row}.maplibregl-popup-anchor-right{flex-direction:row-reverse}.maplibregl-popup-tip{border:10px solid transparent;height:0;width:0;z-index:1}.maplibregl-popup-anchor-top .maplibregl-popup-tip{align-self:center;border-bottom-color:#fff;border-top:none}.maplibregl-popup-anchor-top-left .maplibregl-popup-tip{align-self:flex-start;border-bottom-color:#fff;border-left:none;border-top:none}.maplibregl-popup-anchor-top-right .maplibregl-popup-tip{align-self:flex-end;border-bottom-color:#fff;border-right:none;border-top:none}.maplibregl-popup-anchor-bottom .maplibregl-popup-tip{align-self:center;border-bottom:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip{align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.maplibregl-popup-anchor-left .maplibregl-popup-tip{align-self:center;border-left:none;border-right-color:#fff}.maplibregl-popup-anchor-right .maplibregl-popup-tip{align-self:center;border-left-color:#fff;border-right:none}.maplibregl-popup-close-button{background-color:transparent;border:0;border-radius:0 3px 0 0;cursor:pointer;position:absolute;right:0;top:0}.maplibregl-popup-close-button:hover{background-color:rgba(0, 0, 0, 0.05)}.maplibregl-popup-content{background:#fff;border-radius:3px;box-shadow:0 1px 2px rgba(0,0,0,.1);padding:15px 10px;pointer-events:auto;position:relative}.maplibregl-popup-anchor-top-left .maplibregl-popup-content{border-top-left-radius:0}.maplibregl-popup-anchor-top-right .maplibregl-popup-content{border-top-right-radius:0}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-content{border-bottom-left-radius:0}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-content{border-bottom-right-radius:0}.maplibregl-popup-track-pointer{display:none}.maplibregl-popup-track-pointer *{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-map:hover .maplibregl-popup-track-pointer{display:flex}.maplibregl-map:active .maplibregl-popup-track-pointer{display:none}.maplibregl-marker{left:0;position:absolute;top:0;transition:opacity .2s;will-change:transform}.maplibregl-user-location-dot,.maplibregl-user-location-dot:before{background-color:#1da1f2;border-radius:50%;height:15px;width:15px}.maplibregl-user-location-dot:before{animation:maplibregl-user-location-dot-pulse 2s infinite;content:"";position:absolute}.maplibregl-user-location-dot:after{border:2px solid #fff;border-radius:50%;box-shadow:0 0 3px rgba(0,0,0,.35);box-sizing:border-box;content:"";height:19px;left:-2px;position:absolute;top:-2px;width:19px}@keyframes maplibregl-user-location-dot-pulse{0%{opacity:1;transform:scale(1)}70%{opacity:0;transform:scale(3)}to{opacity:0;transform:scale(1)}}.maplibregl-user-location-dot-stale{background-color:#aaa}.maplibregl-user-location-dot-stale:after{display:none}.maplibregl-user-location-accuracy-circle{background-color:rgba(29,161,242,0.2);border-radius:100%;height:1px;width:1px}.maplibregl-crosshair,.maplibregl-crosshair .maplibregl-interactive,.maplibregl-crosshair .maplibregl-interactive:active{cursor:crosshair}.maplibregl-boxzoom{background:#fff;border:2px dotted #202020;height:0;left:0;opacity:.5;position:absolute;top:0;width:0}.maplibregl-cooperative-gesture-screen{align-items:center;background:rgba(0,0,0,.4);color:#fff;display:flex;font-size:1.4em;top:0;right:0;bottom:0;left:0;justify-content:center;line-height:1.2;opacity:0;padding:1rem;pointer-events:none;position:absolute;transition:opacity 1s ease 1s;z-index:99999}.maplibregl-cooperative-gesture-screen.maplibregl-show{opacity:1;transition:opacity .05s}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:none}@media (hover:none),(pointer:coarse){.maplibregl-cooperative-gesture-screen .maplibregl-desktop-message{display:none}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:block}}.maplibregl-pseudo-fullscreen{height:100%!important;left:0!important;position:fixed!important;top:0!important;width:100%!important;z-index:99999}
43
- .mapboxgl-ctrl-group:not(:empty), .maplibregl-ctrl-group:not(:empty) {
44
- box-shadow: 0 0 6px 2px rgba(0, 0, 0, 0.08);
45
- }
46
-
47
-
48
- .mapboxgl-ctrl-group, .maplibregl-ctrl-group {
49
- background: #fff;
50
- border-radius: 3px;
51
- }
52
-
53
-
54
- .mapboxgl-ctrl-group button:focus:first-child,.maplibregl-ctrl-group button:focus:first-child {
55
- border-radius: 3px 3px 0 0;
56
- }
57
-
58
- .mapboxgl-ctrl-group button:focus:last-child,.maplibregl-ctrl-group button:focus:last-child {
59
- border-radius: 0 0 3px 3px;
60
- }
61
-
62
- /* We do not want opacity to be lowered when buttons are disabled */
63
- .maplibregl-ctrl button:disabled .maplibregl-ctrl-icon {
64
- opacity: 1;
65
- }
66
-
67
- /* Hovering adds a blue hue */
68
- .mapboxgl-ctrl .mapboxgl-ctrl-icon:hover,.maplibregl-ctrl .maplibregl-ctrl-icon:hover
69
- {
70
- filter: invert(39%) sepia(77%) saturate(909%) hue-rotate(182deg) brightness(89%) contrast(85%);
71
- }
72
-
73
-
74
- .mapboxgl-ctrl button.mapboxgl-ctrl-zoom-in .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon
75
- {
76
- background-image: url("data:image/svg+xml;charset=utf-8,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%20standalone%3D%22no%22%3F%3E%0A%3C!DOCTYPE%20svg%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20SVG%201.1%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%0A%3Csvg%20width%3D%22100%25%22%20height%3D%22100%25%22%20viewBox%3D%220%200%2033%2033%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20xml%3Aspace%3D%22preserve%22%20xmlns%3Aserif%3D%22http%3A%2F%2Fwww.serif.com%2F%22%20style%3D%22fill-rule%3Aevenodd%3Bclip-rule%3Aevenodd%3Bstroke-linejoin%3Around%3Bstroke-miterlimit%3A2%3B%22%3E%0A%20%20%20%20%3Cg%20transform%3D%22matrix(1%2C0%2C0%2C1%2C9.5%2C9.25)%22%3E%0A%20%20%20%20%20%20%20%20%3Cpath%20d%3D%22M7%2C13.75C6.737%2C13.75%206.509%2C13.653%206.315%2C13.46C6.122%2C13.266%206.025%2C13.038%206.025%2C12.775L6.025%2C8.225L1.475%2C8.225C1.212%2C8.225%200.984%2C8.128%200.79%2C7.935C0.597%2C7.741%200.5%2C7.513%200.5%2C7.25C0.5%2C6.987%200.597%2C6.759%200.79%2C6.565C0.984%2C6.372%201.212%2C6.275%201.475%2C6.275L6.025%2C6.275L6.025%2C1.725C6.025%2C1.462%206.122%2C1.234%206.315%2C1.04C6.509%2C0.847%206.737%2C0.75%207%2C0.75C7.263%2C0.75%207.491%2C0.847%207.685%2C1.04C7.878%2C1.234%207.975%2C1.462%207.975%2C1.725L7.975%2C6.275L12.525%2C6.275C12.788%2C6.275%2013.016%2C6.372%2013.21%2C6.565C13.403%2C6.759%2013.5%2C6.987%2013.5%2C7.25C13.5%2C7.513%2013.403%2C7.741%2013.21%2C7.935C13.016%2C8.128%2012.788%2C8.225%2012.525%2C8.225L7.975%2C8.225L7.975%2C12.775C7.975%2C13.038%207.878%2C13.266%207.685%2C13.46C7.491%2C13.653%207.263%2C13.75%207%2C13.75Z%22%20style%3D%22fill%3Argb(68%2C73%2C82)%3Bfill-rule%3Anonzero%3B%22%2F%3E%0A%20%20%20%20%3C%2Fg%3E%0A%3C%2Fsvg%3E%0A");
77
- }
78
-
79
-
80
- .mapboxgl-ctrl button.mapboxgl-ctrl-zoom-out .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon
81
- {
82
- background-image: url("data:image/svg+xml;charset=utf-8,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%20standalone%3D%22no%22%3F%3E%0A%3C!DOCTYPE%20svg%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20SVG%201.1%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%0A%3Csvg%20width%3D%22100%25%22%20height%3D%22100%25%22%20viewBox%3D%220%200%2033%2033%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20xml%3Aspace%3D%22preserve%22%20xmlns%3Aserif%3D%22http%3A%2F%2Fwww.serif.com%2F%22%20style%3D%22fill-rule%3Aevenodd%3Bclip-rule%3Aevenodd%3Bstroke-linejoin%3Around%3Bstroke-miterlimit%3A2%3B%22%3E%0A%20%20%20%20%3Cg%20transform%3D%22matrix(1%2C0%2C0%2C1%2C9.5%2C15.25)%22%3E%0A%20%20%20%20%20%20%20%20%3Cpath%20d%3D%22M1.475%2C2.225C1.212%2C2.225%200.984%2C2.128%200.79%2C1.935C0.597%2C1.741%200.5%2C1.513%200.5%2C1.25C0.5%2C0.987%200.597%2C0.759%200.79%2C0.566C0.984%2C0.372%201.212%2C0.275%201.475%2C0.275L12.525%2C0.275C12.788%2C0.275%2013.016%2C0.372%2013.21%2C0.566C13.403%2C0.759%2013.5%2C0.987%2013.5%2C1.25C13.5%2C1.513%2013.403%2C1.741%2013.21%2C1.935C13.016%2C2.128%2012.788%2C2.225%2012.525%2C2.225L1.475%2C2.225Z%22%20style%3D%22fill%3Argb(68%2C73%2C82)%3Bfill-rule%3Anonzero%3B%22%2F%3E%0A%20%20%20%20%3C%2Fg%3E%0A%3C%2Fsvg%3E%0A");
83
- }
84
-
85
-
86
- .mapboxgl-ctrl button.mapboxgl-ctrl-compass .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon
87
- {
88
- /* Custom based on Google compass icon but without the circle */
89
- background-image: url("data:image/svg+xml;charset=utf-8,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%20standalone%3D%22no%22%3F%3E%0A%3C!DOCTYPE%20svg%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20SVG%201.1%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%0A%3Csvg%20width%3D%22100%25%22%20height%3D%22100%25%22%20viewBox%3D%220%200%2033%2033%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20xml%3Aspace%3D%22preserve%22%20xmlns%3Aserif%3D%22http%3A%2F%2Fwww.serif.com%2F%22%20style%3D%22fill-rule%3Aevenodd%3Bclip-rule%3Aevenodd%3Bstroke-linejoin%3Around%3Bstroke-miterlimit%3A2%3B%22%3E%0A%20%20%20%20%3Cg%20transform%3D%22matrix(1%2C0%2C0%2C1%2C-3.24298%2C2.63257)%22%3E%0A%20%20%20%20%20%20%20%20%3Cg%20transform%3D%22matrix(1.20712%2C0%2C0%2C1.20712%2C14.9145%2C2.51292)%22%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20d%3D%22M2.5%2C9.406L0%2C9.406L4%2C17.875L8%2C9.406L5.5%2C9.406C5.483%2C10.22%204.818%2C10.875%204%2C10.875C3.182%2C10.875%202.517%2C10.22%202.5%2C9.406Z%22%20style%3D%22fill%3Argb(29%2C50%2C98)%3Bfill-opacity%3A0.35%3B%22%2F%3E%0A%20%20%20%20%20%20%20%20%3C%2Fg%3E%0A%20%20%20%20%20%20%20%20%3Cg%20transform%3D%22matrix(1.20712%2C0%2C0%2C1.20712%2C14.9145%2C2.51292)%22%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20d%3D%22M4%2C0.938L0%2C9.406L2.5%2C9.406L2.5%2C9.375C2.5%2C8.547%203.172%2C7.875%204%2C7.875C4.828%2C7.875%205.5%2C8.547%205.5%2C9.375L5.5%2C9.406L8%2C9.406L4%2C0.938Z%22%20style%3D%22fill%3Argb(68%2C73%2C82)%3B%22%2F%3E%0A%20%20%20%20%20%20%20%20%3C%2Fg%3E%0A%20%20%20%20%3C%2Fg%3E%0A%3C%2Fsvg%3E%0A");
90
- }
91
-
92
-
93
- .mapboxgl-ctrl-group button,.maplibregl-ctrl-group button
94
- {
95
- height: 33px;
96
- width: 33px;
97
- }
98
-
99
-
100
- .mapboxgl-ctrl-group button+button,.maplibregl-ctrl-group button+button
101
- {
102
- border-top: 1px solid rgba(0,0,0,0.1098);
103
- }
104
-
105
-
106
- @keyframes blinker {
107
- 50% {
108
- opacity: 0.3;
109
- }
110
- }
111
-
112
- /* Geolocate button: default button state before being clicked */
113
- .mapboxgl-ctrl button.mapboxgl-ctrl-geolocate .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon
114
- {
115
- background-image: url("data:image/svg+xml;charset=utf-8,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%20standalone%3D%22no%22%3F%3E%0A%3C!DOCTYPE%20svg%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20SVG%201.1%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%0A%3Csvg%20width%3D%22100%25%22%20height%3D%22100%25%22%20viewBox%3D%220%200%2033%2033%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20xml%3Aspace%3D%22preserve%22%20xmlns%3Aserif%3D%22http%3A%2F%2Fwww.serif.com%2F%22%20style%3D%22fill-rule%3Aevenodd%3Bclip-rule%3Aevenodd%3Bstroke-linejoin%3Around%3Bstroke-miterlimit%3A2%3B%22%3E%0A%20%20%20%20%3Cg%20transform%3D%22matrix(1%2C0%2C0%2C1%2C9.50001%2C9.25)%22%3E%0A%20%20%20%20%20%20%20%20%3Cpath%20d%3D%22M5.673%2C8.577L0.567%2C6.51C0.391%2C6.443%200.253%2C6.335%200.152%2C6.186C0.051%2C6.037%200%2C5.868%200%2C5.68C0%2C5.49%200.051%2C5.325%200.152%2C5.183C0.253%2C5.041%200.391%2C4.936%200.567%2C4.869L12.846%2C0.31C13.021%2C0.242%2013.187%2C0.232%2013.343%2C0.279C13.498%2C0.326%2013.629%2C0.404%2013.738%2C0.513C13.846%2C0.621%2013.924%2C0.752%2013.971%2C0.907C14.018%2C1.063%2014.008%2C1.229%2013.94%2C1.404L9.381%2C13.703C9.3%2C13.892%209.186%2C14.031%209.037%2C14.119C8.888%2C14.206%208.732%2C14.25%208.57%2C14.25C8.408%2C14.25%208.253%2C14.203%208.104%2C14.108C7.956%2C14.013%207.841%2C13.879%207.76%2C13.703L5.673%2C8.577ZM8.53%2C11.11L11.691%2C2.559L3.14%2C5.72L6.991%2C7.259L8.53%2C11.11Z%22%20style%3D%22fill%3Argb(68%2C73%2C82)%3Bfill-rule%3Anonzero%3B%22%2F%3E%0A%20%20%20%20%3C%2Fg%3E%0A%3C%2Fsvg%3E%0A");
116
- }
117
-
118
-
119
- /* Geolocate button: searching for location */
120
- .maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-waiting .maplibregl-ctrl-icon {
121
- animation: blinker 1s linear infinite;
122
- }
123
-
124
- /* Geolocate button: permission was not granted */
125
- .mapboxgl-ctrl button.mapboxgl-ctrl-geolocate:disabled .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon
126
- {
127
- background-image: url("data:image/svg+xml;charset=utf-8,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%20standalone%3D%22no%22%3F%3E%0A%3C!DOCTYPE%20svg%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20SVG%201.1%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%0A%3Csvg%20width%3D%22100%25%22%20height%3D%22100%25%22%20viewBox%3D%220%200%2033%2033%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20xml%3Aspace%3D%22preserve%22%20xmlns%3Aserif%3D%22http%3A%2F%2Fwww.serif.com%2F%22%20style%3D%22fill-rule%3Aevenodd%3Bclip-rule%3Aevenodd%3Bstroke-linejoin%3Around%3Bstroke-miterlimit%3A2%3B%22%3E%0A%20%20%20%20%3Cg%20transform%3D%22matrix(1%2C0%2C0%2C1%2C9.50001%2C9.25)%22%3E%0A%20%20%20%20%20%20%20%20%3Cpath%20d%3D%22M5.673%2C8.577L0.567%2C6.51C0.391%2C6.443%200.253%2C6.335%200.152%2C6.186C0.051%2C6.037%200%2C5.868%200%2C5.68C0%2C5.49%200.051%2C5.325%200.152%2C5.183C0.253%2C5.041%200.391%2C4.936%200.567%2C4.869L12.846%2C0.31C13.021%2C0.242%2013.187%2C0.232%2013.343%2C0.279C13.498%2C0.326%2013.629%2C0.404%2013.738%2C0.513C13.846%2C0.621%2013.924%2C0.752%2013.971%2C0.907C14.018%2C1.063%2014.008%2C1.229%2013.94%2C1.404L9.381%2C13.703C9.3%2C13.892%209.186%2C14.031%209.037%2C14.119C8.888%2C14.206%208.732%2C14.25%208.57%2C14.25C8.408%2C14.25%208.253%2C14.203%208.104%2C14.108C7.956%2C14.013%207.841%2C13.879%207.76%2C13.703L5.673%2C8.577ZM8.53%2C11.11L11.691%2C2.559L3.14%2C5.72L6.991%2C7.259L8.53%2C11.11Z%22%20style%3D%22fill%3Argb(68%2C73%2C82)%3Bfill-rule%3Anonzero%3B%22%2F%3E%0A%20%20%20%20%3C%2Fg%3E%0A%20%20%20%20%3Cg%20transform%3D%22matrix(0.598546%2C0.598546%2C-0.707107%2C0.707107%2C11.7313%2C1.9674)%22%3E%0A%20%20%20%20%20%20%20%20%3Crect%20x%3D%226.516%22%20y%3D%223.78%22%20width%3D%2219.271%22%20height%3D%220.716%22%20style%3D%22fill%3Argb(229%2C0%2C0)%3B%22%2F%3E%0A%20%20%20%20%3C%2Fg%3E%0A%3C%2Fsvg%3E%0A");
128
- }
129
-
130
- /* Geolocate button: location is active */
131
- .mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon
132
- {
133
- background-image: url("data:image/svg+xml;charset=utf-8,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%20standalone%3D%22no%22%3F%3E%0A%3C!DOCTYPE%20svg%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20SVG%201.1%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%0A%3Csvg%20width%3D%22100%25%22%20height%3D%22100%25%22%20viewBox%3D%220%200%2033%2033%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20xml%3Aspace%3D%22preserve%22%20xmlns%3Aserif%3D%22http%3A%2F%2Fwww.serif.com%2F%22%20style%3D%22fill-rule%3Aevenodd%3Bclip-rule%3Aevenodd%3Bstroke-linejoin%3Around%3Bstroke-miterlimit%3A2%3B%22%3E%0A%20%20%20%20%3Cg%20transform%3D%22matrix(1%2C0%2C0%2C1%2C9.50001%2C8.89492)%22%3E%0A%20%20%20%20%20%20%20%20%3Cpath%20d%3D%22M5.673%2C8.932L0.567%2C6.865C0.391%2C6.798%200.253%2C6.69%200.152%2C6.541C0.051%2C6.392%200%2C6.223%200%2C6.035C0%2C5.846%200.051%2C5.68%200.152%2C5.538C0.253%2C5.396%200.391%2C5.291%200.567%2C5.224L12.846%2C0.665C13.021%2C0.597%2013.187%2C0.587%2013.343%2C0.634C13.498%2C0.682%2013.629%2C0.759%2013.738%2C0.868C13.846%2C0.976%2013.924%2C1.107%2013.971%2C1.262C14.018%2C1.418%2014.008%2C1.584%2013.94%2C1.759L9.381%2C14.059C9.3%2C14.247%209.186%2C14.386%209.037%2C14.474C8.888%2C14.561%208.732%2C14.605%208.57%2C14.605C8.408%2C14.605%208.253%2C14.558%208.104%2C14.463C7.956%2C14.368%207.841%2C14.233%207.76%2C14.059L5.673%2C8.932Z%22%20style%3D%22fill%3Argb(68%2C73%2C82)%3Bfill-rule%3Anonzero%3B%22%2F%3E%0A%20%20%20%20%3C%2Fg%3E%0A%3C%2Fsvg%3E%0A");
134
- }
135
-
136
- /* Geolocate button: an error occured */
137
- .mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active-error .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon
138
- {
139
- background-image: url("data:image/svg+xml;charset=utf-8,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%20standalone%3D%22no%22%3F%3E%0A%3C!DOCTYPE%20svg%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20SVG%201.1%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%0A%3Csvg%20width%3D%22100%25%22%20height%3D%22100%25%22%20viewBox%3D%220%200%2033%2033%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20xml%3Aspace%3D%22preserve%22%20xmlns%3Aserif%3D%22http%3A%2F%2Fwww.serif.com%2F%22%20style%3D%22fill-rule%3Aevenodd%3Bclip-rule%3Aevenodd%3Bstroke-linejoin%3Around%3Bstroke-miterlimit%3A2%3B%22%3E%0A%20%20%20%20%3Cg%20transform%3D%22matrix(1%2C0%2C0%2C1%2C9.50001%2C8.89492)%22%3E%0A%20%20%20%20%20%20%20%20%3Cpath%20d%3D%22M5.673%2C8.932L0.567%2C6.865C0.391%2C6.798%200.253%2C6.69%200.152%2C6.541C0.051%2C6.392%200%2C6.223%200%2C6.035C0%2C5.846%200.051%2C5.68%200.152%2C5.538C0.253%2C5.396%200.391%2C5.291%200.567%2C5.224L12.846%2C0.665C13.021%2C0.597%2013.187%2C0.587%2013.343%2C0.634C13.498%2C0.682%2013.629%2C0.759%2013.738%2C0.868C13.846%2C0.976%2013.924%2C1.107%2013.971%2C1.262C14.018%2C1.418%2014.008%2C1.584%2013.94%2C1.759L9.381%2C14.059C9.3%2C14.247%209.186%2C14.386%209.037%2C14.474C8.888%2C14.561%208.732%2C14.605%208.57%2C14.605C8.408%2C14.605%208.253%2C14.558%208.104%2C14.463C7.956%2C14.368%207.841%2C14.233%207.76%2C14.059L5.673%2C8.932Z%22%20style%3D%22fill%3Argb(68%2C73%2C82)%3Bfill-rule%3Anonzero%3B%22%2F%3E%0A%20%20%20%20%3C%2Fg%3E%0A%20%20%20%20%3Cg%20transform%3D%22matrix(0.598546%2C0.598546%2C-0.707107%2C0.707107%2C11.7313%2C1.9674)%22%3E%0A%20%20%20%20%20%20%20%20%3Crect%20x%3D%226.516%22%20y%3D%223.78%22%20width%3D%2219.271%22%20height%3D%220.716%22%20style%3D%22fill%3Argb(229%2C0%2C0)%3B%22%2F%3E%0A%20%20%20%20%3C%2Fg%3E%0A%3C%2Fsvg%3E%0A");
140
- }
141
-
142
- /* Geolocate button: searching location */
143
- .mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon
144
- {
145
- background-image: url("data:image/svg+xml;charset=utf-8,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%20standalone%3D%22no%22%3F%3E%0A%3C!DOCTYPE%20svg%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20SVG%201.1%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%0A%3Csvg%20width%3D%22100%25%22%20height%3D%22100%25%22%20viewBox%3D%220%200%2033%2033%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20xml%3Aspace%3D%22preserve%22%20xmlns%3Aserif%3D%22http%3A%2F%2Fwww.serif.com%2F%22%20style%3D%22fill-rule%3Aevenodd%3Bclip-rule%3Aevenodd%3Bstroke-linejoin%3Around%3Bstroke-miterlimit%3A2%3B%22%3E%0A%20%20%20%20%3Cpath%20d%3D%22M10.685%2C14.817L22.511%2C10.669L18.217%2C22.082L15.824%2C17.233L10.685%2C14.817Z%22%20style%3D%22fill%3Argb(29%2C50%2C98)%3Bfill-opacity%3A0.2%3B%22%2F%3E%0A%20%20%20%20%3Cg%20transform%3D%22matrix(1%2C0%2C0%2C1%2C9.50001%2C9.25)%22%3E%0A%20%20%20%20%20%20%20%20%3Cpath%20d%3D%22M5.673%2C8.577L0.567%2C6.51C0.391%2C6.443%200.253%2C6.335%200.152%2C6.186C0.051%2C6.037%200%2C5.868%200%2C5.68C0%2C5.49%200.051%2C5.325%200.152%2C5.183C0.253%2C5.041%200.391%2C4.936%200.567%2C4.869L12.846%2C0.31C13.021%2C0.242%2013.187%2C0.232%2013.343%2C0.279C13.498%2C0.326%2013.629%2C0.404%2013.738%2C0.513C13.846%2C0.621%2013.924%2C0.752%2013.971%2C0.907C14.018%2C1.063%2014.008%2C1.229%2013.94%2C1.404L9.381%2C13.703C9.3%2C13.892%209.186%2C14.031%209.037%2C14.119C8.888%2C14.206%208.732%2C14.25%208.57%2C14.25C8.408%2C14.25%208.253%2C14.203%208.104%2C14.108C7.956%2C14.013%207.841%2C13.879%207.76%2C13.703L5.673%2C8.577ZM8.53%2C11.11L11.691%2C2.559L3.14%2C5.72L6.991%2C7.259L8.53%2C11.11Z%22%20style%3D%22fill%3Argb(68%2C73%2C82)%3Bfill-rule%3Anonzero%3B%22%2F%3E%0A%20%20%20%20%3C%2Fg%3E%0A%3C%2Fsvg%3E%0A");
146
- }
147
-
148
- /* Geolocate button: an error occured while searching */
149
- .mapboxgl-ctrl button.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background-error .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon
150
- {
151
- background-image: url("data:image/svg+xml;charset=utf-8,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%20standalone%3D%22no%22%3F%3E%0A%3C!DOCTYPE%20svg%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20SVG%201.1%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%0A%3Csvg%20width%3D%22100%25%22%20height%3D%22100%25%22%20viewBox%3D%220%200%2033%2033%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20xml%3Aspace%3D%22preserve%22%20xmlns%3Aserif%3D%22http%3A%2F%2Fwww.serif.com%2F%22%20style%3D%22fill-rule%3Aevenodd%3Bclip-rule%3Aevenodd%3Bstroke-linejoin%3Around%3Bstroke-miterlimit%3A2%3B%22%3E%0A%20%20%20%20%3Cg%20transform%3D%22matrix(1%2C0%2C0%2C1%2C9.50001%2C8.89492)%22%3E%0A%20%20%20%20%20%20%20%20%3Cpath%20d%3D%22M5.673%2C8.932L0.567%2C6.865C0.391%2C6.798%200.253%2C6.69%200.152%2C6.541C0.051%2C6.392%200%2C6.223%200%2C6.035C0%2C5.846%200.051%2C5.68%200.152%2C5.538C0.253%2C5.396%200.391%2C5.291%200.567%2C5.224L12.846%2C0.665C13.021%2C0.597%2013.187%2C0.587%2013.343%2C0.634C13.498%2C0.682%2013.629%2C0.759%2013.738%2C0.868C13.846%2C0.976%2013.924%2C1.107%2013.971%2C1.262C14.018%2C1.418%2014.008%2C1.584%2013.94%2C1.759L9.381%2C14.059C9.3%2C14.247%209.186%2C14.386%209.037%2C14.474C8.888%2C14.561%208.732%2C14.605%208.57%2C14.605C8.408%2C14.605%208.253%2C14.558%208.104%2C14.463C7.956%2C14.368%207.841%2C14.233%207.76%2C14.059L5.673%2C8.932Z%22%20style%3D%22fill%3Argb(68%2C73%2C82)%3Bfill-rule%3Anonzero%3B%22%2F%3E%0A%20%20%20%20%3C%2Fg%3E%0A%20%20%20%20%3Cg%20transform%3D%22matrix(0.598546%2C0.598546%2C-0.707107%2C0.707107%2C11.7313%2C1.9674)%22%3E%0A%20%20%20%20%20%20%20%20%3Crect%20x%3D%226.516%22%20y%3D%223.78%22%20width%3D%2219.271%22%20height%3D%220.716%22%20style%3D%22fill%3Argb(229%2C0%2C0)%3B%22%2F%3E%0A%20%20%20%20%3C%2Fg%3E%0A%3C%2Fsvg%3E%0A");
152
- }
153
-
154
- /* Terrain control icon (disabled, to enable) */
155
- .mapboxgl-ctrl button.mapboxgl-ctrl-terrain .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-terrain .maplibregl-ctrl-icon
156
- {
157
- background-image: url("data:image/svg+xml;charset=utf-8,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%20standalone%3D%22no%22%3F%3E%0A%3C!DOCTYPE%20svg%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20SVG%201.1%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%0A%3Csvg%20width%3D%22100%25%22%20height%3D%22100%25%22%20viewBox%3D%220%200%2033%2033%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20xml%3Aspace%3D%22preserve%22%20xmlns%3Aserif%3D%22http%3A%2F%2Fwww.serif.com%2F%22%20style%3D%22fill-rule%3Aevenodd%3Bclip-rule%3Aevenodd%3Bstroke-linejoin%3Around%3Bstroke-miterlimit%3A2%3B%22%3E%0A%20%20%20%20%3Cg%20transform%3D%22matrix(1%2C0%2C0%2C1%2C8.00023%2C11)%22%3E%0A%20%20%20%20%20%20%20%20%3Cpath%20d%3D%22M1.083%2C10.209C0.722%2C10.209%200.458%2C10.049%200.292%2C9.73C0.125%2C9.41%200.153%2C9.105%200.375%2C8.813L3.625%2C4.48C3.805%2C4.244%204.041%2C4.126%204.333%2C4.126C4.625%2C4.126%204.861%2C4.244%205.042%2C4.48L8.021%2C8.459L14.167%2C8.459L10.167%2C3.147L8.188%2C5.751L7.104%2C4.313L9.458%2C1.147C9.638%2C0.91%209.875%2C0.792%2010.167%2C0.792C10.458%2C0.792%2010.694%2C0.91%2010.875%2C1.147L16.625%2C8.813C16.847%2C9.105%2016.874%2C9.41%2016.708%2C9.73C16.541%2C10.049%2016.277%2C10.209%2015.917%2C10.209L1.083%2C10.209ZM2.833%2C8.459L5.833%2C8.459L4.333%2C6.459L2.833%2C8.459ZM2.833%2C8.459L5.833%2C8.459L2.833%2C8.459Z%22%20style%3D%22fill%3Argb(68%2C73%2C82)%3Bfill-rule%3Anonzero%3B%22%2F%3E%0A%20%20%20%20%3C%2Fg%3E%0A%3C%2Fsvg%3E%0A");
158
- }
159
-
160
- /* Terrain control icon (enabled, to disable) */
161
- .mapboxgl-ctrl button.mapboxgl-ctrl-terrain-enabled .mapboxgl-ctrl-icon,.maplibregl-ctrl button.maplibregl-ctrl-terrain-enabled .maplibregl-ctrl-icon
162
- {
163
- background-image: url("data:image/svg+xml;charset=utf-8,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%20standalone%3D%22no%22%3F%3E%0A%3C!DOCTYPE%20svg%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20SVG%201.1%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%0A%3Csvg%20width%3D%22100%25%22%20height%3D%22100%25%22%20viewBox%3D%220%200%2033%2033%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20xml%3Aspace%3D%22preserve%22%20xmlns%3Aserif%3D%22http%3A%2F%2Fwww.serif.com%2F%22%20style%3D%22fill-rule%3Aevenodd%3Bclip-rule%3Aevenodd%3Bstroke-linejoin%3Around%3Bstroke-miterlimit%3A2%3B%22%3E%0A%20%20%20%20%3Cg%20transform%3D%22matrix(1%2C0%2C0%2C1%2C7.99998%2C11)%22%3E%0A%20%20%20%20%20%20%20%20%3Cpath%20d%3D%22M1.083%2C10.209C0.722%2C10.209%200.459%2C10.049%200.292%2C9.73C0.125%2C9.41%200.153%2C9.105%200.375%2C8.813L3.625%2C4.48C3.806%2C4.244%204.042%2C4.126%204.333%2C4.126C4.625%2C4.126%204.861%2C4.244%205.042%2C4.48L7.5%2C7.751C7.653%2C7.944%207.847%2C8.063%208.083%2C8.105C8.32%2C8.146%208.535%2C8.09%208.729%2C7.938C8.924%2C7.799%209.038%2C7.619%209.073%2C7.396C9.108%2C7.174%209.069%2C6.965%208.958%2C6.771L7.104%2C4.313L9.458%2C1.147C9.639%2C0.91%209.875%2C0.792%2010.167%2C0.792C10.458%2C0.792%2010.694%2C0.91%2010.875%2C1.147L16.625%2C8.813C16.847%2C9.105%2016.875%2C9.41%2016.708%2C9.73C16.541%2C10.049%2016.278%2C10.209%2015.917%2C10.209L1.083%2C10.209Z%22%20style%3D%22fill%3Argb(68%2C73%2C82)%3Bfill-rule%3Anonzero%3B%22%2F%3E%0A%20%20%20%20%3C%2Fg%3E%0A%3C%2Fsvg%3E%0A");
164
- }
165
-
166
- /* Fullscreen control icon (disabled, to enable) */
167
- .maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon
168
- {
169
- background-image: url("data:image/svg+xml;charset=utf-8,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%20standalone%3D%22no%22%3F%3E%0A%3C!DOCTYPE%20svg%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20SVG%201.1%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%0A%3Csvg%20width%3D%22100%25%22%20height%3D%22100%25%22%20viewBox%3D%220%200%2033%2033%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20xml%3Aspace%3D%22preserve%22%20xmlns%3Aserif%3D%22http%3A%2F%2Fwww.serif.com%2F%22%20style%3D%22fill-rule%3Aevenodd%3Bclip-rule%3Aevenodd%3Bstroke-linejoin%3Around%3Bstroke-miterlimit%3A2%3B%22%3E%0A%20%20%20%20%3Cg%20transform%3D%22matrix(1%2C0%2C0%2C1%2C9%2C9)%22%3E%0A%20%20%20%20%20%20%20%20%3Cpath%20d%3D%22M0.875%2C5.042C0.639%2C5.042%200.434%2C4.955%200.26%2C4.781C0.087%2C4.608%200%2C4.403%200%2C4.167L0%2C0.875C0%2C0.639%200.087%2C0.434%200.26%2C0.26C0.434%2C0.087%200.639%2C0%200.875%2C0L4.167%2C0C4.403%2C0%204.608%2C0.087%204.781%2C0.26C4.955%2C0.434%205.042%2C0.639%205.042%2C0.875C5.042%2C1.111%204.955%2C1.316%204.781%2C1.49C4.608%2C1.663%204.403%2C1.75%204.167%2C1.75L2.958%2C1.75L4.875%2C3.667C5.042%2C3.834%205.122%2C4.031%205.115%2C4.26C5.108%2C4.489%205.021%2C4.687%204.854%2C4.854C4.687%2C5.021%204.486%2C5.104%204.25%2C5.104C4.014%2C5.104%203.813%2C5.021%203.646%2C4.854L1.75%2C2.958L1.75%2C4.167C1.75%2C4.403%201.663%2C4.608%201.49%2C4.781C1.316%2C4.955%201.111%2C5.042%200.875%2C5.042ZM10.146%2C4.854C9.979%2C4.687%209.896%2C4.486%209.896%2C4.25C9.896%2C4.014%209.979%2C3.813%2010.146%2C3.646L12.042%2C1.75L10.833%2C1.75C10.597%2C1.75%2010.392%2C1.663%2010.219%2C1.49C10.045%2C1.316%209.958%2C1.111%209.958%2C0.875C9.958%2C0.639%2010.045%2C0.434%2010.219%2C0.26C10.392%2C0.087%2010.597%2C0%2010.833%2C0L14.125%2C0C14.361%2C0%2014.566%2C0.087%2014.74%2C0.26C14.913%2C0.434%2015%2C0.639%2015%2C0.875L15%2C4.167C15%2C4.403%2014.913%2C4.608%2014.74%2C4.781C14.566%2C4.955%2014.361%2C5.042%2014.125%2C5.042C13.889%2C5.042%2013.684%2C4.955%2013.51%2C4.781C13.337%2C4.608%2013.25%2C4.403%2013.25%2C4.167L13.25%2C2.958L11.333%2C4.875C11.166%2C5.042%2010.969%2C5.122%2010.74%2C5.115C10.511%2C5.108%2010.313%2C5.021%2010.146%2C4.854ZM10.833%2C15C10.597%2C15%2010.392%2C14.913%2010.219%2C14.74C10.045%2C14.566%209.958%2C14.361%209.958%2C14.125C9.958%2C13.889%2010.045%2C13.684%2010.219%2C13.51C10.392%2C13.337%2010.597%2C13.25%2010.833%2C13.25L12.021%2C13.25L10.125%2C11.354C9.958%2C11.187%209.875%2C10.986%209.875%2C10.75C9.875%2C10.514%209.965%2C10.306%2010.146%2C10.125C10.313%2C9.958%2010.517%2C9.875%2010.76%2C9.875C11.003%2C9.875%2011.208%2C9.958%2011.375%2C10.125L13.25%2C12.021L13.25%2C10.833C13.25%2C10.597%2013.337%2C10.392%2013.51%2C10.219C13.684%2C10.045%2013.889%2C9.958%2014.125%2C9.958C14.361%2C9.958%2014.566%2C10.045%2014.74%2C10.219C14.913%2C10.392%2015%2C10.597%2015%2C10.833L15%2C14.125C15%2C14.361%2014.913%2C14.566%2014.74%2C14.74C14.566%2C14.913%2014.361%2C15%2014.125%2C15L10.833%2C15ZM0.875%2C15C0.639%2C15%200.434%2C14.913%200.26%2C14.74C0.087%2C14.566%200%2C14.361%200%2C14.125L0%2C10.833C0%2C10.597%200.087%2C10.392%200.26%2C10.219C0.434%2C10.045%200.639%2C9.958%200.875%2C9.958C1.111%2C9.958%201.316%2C10.045%201.49%2C10.219C1.663%2C10.392%201.75%2C10.597%201.75%2C10.833L1.75%2C12.021L3.646%2C10.125C3.813%2C9.958%204.014%2C9.872%204.25%2C9.865C4.486%2C9.858%204.694%2C9.944%204.875%2C10.125C5.042%2C10.292%205.125%2C10.497%205.125%2C10.74C5.125%2C10.983%205.042%2C11.187%204.875%2C11.354L2.979%2C13.25L4.167%2C13.25C4.403%2C13.25%204.608%2C13.337%204.781%2C13.51C4.955%2C13.684%205.042%2C13.889%205.042%2C14.125C5.042%2C14.361%204.955%2C14.566%204.781%2C14.74C4.608%2C14.913%204.403%2C15%204.167%2C15L0.875%2C15Z%22%20style%3D%22fill%3Argb(68%2C73%2C82)%3Bfill-rule%3Anonzero%3B%22%2F%3E%0A%20%20%20%20%3C%2Fg%3E%0A%3C%2Fsvg%3E%0A");
170
- }
171
-
172
- /* Fullscreen control icon (enabled, to disable) */
173
- .maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon {
174
- background-image: url("data:image/svg+xml;charset=utf-8,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%20standalone%3D%22no%22%3F%3E%0A%3C!DOCTYPE%20svg%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20SVG%201.1%2F%2FEN%22%20%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%0A%3Csvg%20width%3D%22100%25%22%20height%3D%22100%25%22%20viewBox%3D%220%200%2033%2033%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20xml%3Aspace%3D%22preserve%22%20xmlns%3Aserif%3D%22http%3A%2F%2Fwww.serif.com%2F%22%20style%3D%22fill-rule%3Aevenodd%3Bclip-rule%3Aevenodd%3Bstroke-linejoin%3Around%3Bstroke-miterlimit%3A2%3B%22%3E%0A%20%20%20%20%3Cg%20transform%3D%22matrix(1%2C0%2C0%2C1%2C8.49996%2C8.5)%22%3E%0A%20%20%20%20%20%20%20%20%3Cpath%20d%3D%22M1.434%2C5.576C1.2%2C5.576%200.997%2C5.49%200.825%2C5.317C0.653%2C5.146%200.567%2C4.943%200.567%2C4.709C0.567%2C4.475%200.653%2C4.272%200.825%2C4.1C0.997%2C3.929%201.2%2C3.843%201.434%2C3.843L2.609%2C3.843L0.732%2C1.965C0.567%2C1.8%200.488%2C1.597%200.495%2C1.356C0.502%2C1.115%200.588%2C0.913%200.753%2C0.748C0.918%2C0.583%201.121%2C0.5%201.361%2C0.5C1.602%2C0.5%201.805%2C0.583%201.97%2C0.748L3.828%2C2.624L3.828%2C1.449C3.828%2C1.215%203.913%2C1.012%204.085%2C0.84C4.257%2C0.668%204.46%2C0.582%204.694%2C0.582C4.928%2C0.582%205.131%2C0.668%205.302%2C0.84C5.475%2C1.012%205.561%2C1.215%205.561%2C1.449L5.561%2C4.709C5.561%2C4.943%205.475%2C5.146%205.302%2C5.317C5.131%2C5.49%204.928%2C5.576%204.694%2C5.576L1.434%2C5.576ZM14.557%2C5.576L11.296%2C5.576C11.063%2C5.576%2010.86%2C5.49%2010.688%2C5.317C10.516%2C5.146%2010.43%2C4.943%2010.43%2C4.709L10.43%2C1.449C10.43%2C1.215%2010.516%2C1.012%2010.688%2C0.84C10.86%2C0.668%2011.063%2C0.582%2011.296%2C0.582C11.531%2C0.582%2011.734%2C0.668%2011.906%2C0.84C12.077%2C1.012%2012.163%2C1.215%2012.163%2C1.449L12.163%2C2.624L14.041%2C0.748C14.206%2C0.583%2014.409%2C0.5%2014.65%2C0.5C14.89%2C0.5%2015.093%2C0.583%2015.258%2C0.748C15.423%2C0.913%2015.506%2C1.115%2015.506%2C1.356C15.506%2C1.597%2015.423%2C1.8%2015.258%2C1.965L13.381%2C3.843L14.557%2C3.843C14.791%2C3.843%2014.994%2C3.929%2015.166%2C4.1C15.338%2C4.272%2015.424%2C4.475%2015.424%2C4.709C15.424%2C4.943%2015.338%2C5.146%2015.166%2C5.317C14.994%2C5.49%2014.791%2C5.576%2014.557%2C5.576ZM0.753%2C15.252C0.588%2C15.087%200.506%2C14.888%200.506%2C14.654C0.506%2C14.42%200.588%2C14.221%200.753%2C14.056L2.63%2C12.178L1.434%2C12.178C1.2%2C12.178%200.997%2C12.092%200.825%2C11.921C0.653%2C11.749%200.567%2C11.546%200.567%2C11.312C0.567%2C11.078%200.653%2C10.875%200.825%2C10.703C0.997%2C10.531%201.2%2C10.445%201.434%2C10.445L4.694%2C10.445C4.928%2C10.445%205.131%2C10.531%205.302%2C10.703C5.475%2C10.875%205.561%2C11.078%205.561%2C11.312L5.561%2C14.572C5.561%2C14.806%205.475%2C15.009%205.302%2C15.181C5.131%2C15.353%204.928%2C15.439%204.694%2C15.439C4.46%2C15.439%204.257%2C15.353%204.085%2C15.181C3.913%2C15.009%203.828%2C14.806%203.828%2C14.572L3.828%2C13.376L1.95%2C15.252C1.785%2C15.418%201.585%2C15.5%201.351%2C15.5C1.118%2C15.5%200.918%2C15.418%200.753%2C15.252ZM11.296%2C15.439C11.063%2C15.439%2010.86%2C15.353%2010.688%2C15.181C10.516%2C15.009%2010.43%2C14.806%2010.43%2C14.572L10.43%2C11.312C10.43%2C11.078%2010.516%2C10.875%2010.688%2C10.703C10.86%2C10.531%2011.063%2C10.445%2011.296%2C10.445L14.557%2C10.445C14.791%2C10.445%2014.994%2C10.531%2015.166%2C10.703C15.338%2C10.875%2015.424%2C11.078%2015.424%2C11.312C15.424%2C11.546%2015.338%2C11.749%2015.166%2C11.921C14.994%2C12.092%2014.791%2C12.178%2014.557%2C12.178L13.36%2C12.178L15.237%2C14.056C15.402%2C14.221%2015.485%2C14.42%2015.485%2C14.654C15.485%2C14.888%2015.402%2C15.087%2015.237%2C15.252C15.072%2C15.418%2014.873%2C15.5%2014.639%2C15.5C14.405%2C15.5%2014.206%2C15.418%2014.041%2C15.252L12.163%2C13.376L12.163%2C14.572C12.163%2C14.806%2012.077%2C15.009%2011.906%2C15.181C11.734%2C15.353%2011.531%2C15.439%2011.296%2C15.439Z%22%20style%3D%22fill%3Argb(68%2C73%2C82)%3Bfill-rule%3Anonzero%3B%22%2F%3E%0A%20%20%20%20%3C%2Fg%3E%0A%3C%2Fsvg%3E%0A");
175
- }
176
-
177
- /* Projection control icon - globe */
178
- .maplibregl-ctrl button.maplibregl-ctrl-projection-globe .maplibregl-ctrl-icon {
179
- background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2233%22%20height%3D%2233%22%20viewBox%3D%220%200%2033%2033%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M16.5%2023.15C20.1727%2023.15%2023.15%2020.1727%2023.15%2016.5C23.15%2012.8273%2020.1727%209.85%2016.5%209.85C12.8273%209.85%209.85%2012.8273%209.85%2016.5C9.85%2020.1727%2012.8273%2023.15%2016.5%2023.15ZM16.5%2025C21.1944%2025%2025%2021.1944%2025%2016.5C25%2011.8056%2021.1944%208%2016.5%208C11.8056%208%208%2011.8056%208%2016.5C8%2021.1944%2011.8056%2025%2016.5%2025Z%22%20fill%3D%22%23444952%22%2F%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M14.9069%2024.6315C11.9661%2019.4851%2011.9661%2013.5794%2014.9069%208.43297L16.5131%209.35083C13.8973%2013.9285%2013.8973%2019.136%2016.5131%2023.7136L14.9069%2024.6315Z%22%20fill%3D%22%23444952%22%2F%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M18.0231%2024.6315C20.9639%2019.4851%2020.9639%2013.5794%2018.0231%208.43297L16.4169%209.35083C19.0327%2013.9285%2019.0327%2019.136%2016.4169%2023.7136L18.0231%2024.6315Z%22%20fill%3D%22%23444952%22%2F%3E%0A%3Cpath%20d%3D%22M9.01758%2012.8H24V14.65H9.01758V12.8Z%22%20fill%3D%22%23444952%22%2F%3E%0A%3Cpath%20d%3D%22M9.45752%2018.35H23.5601V20.2H9.45752V18.35Z%22%20fill%3D%22%23444952%22%2F%3E%0A%3C%2Fsvg%3E%0A");
180
- }
181
-
182
- /* Projection control icon - mercator */
183
- .maplibregl-ctrl button.maplibregl-ctrl-projection-mercator .maplibregl-ctrl-icon {
184
- background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2233%22%20height%3D%2233%22%20viewBox%3D%220%200%2033%2033%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M26.5%209.85H6.5C6.41716%209.85%206.35%209.91716%206.35%2010V23C6.35%2023.0828%206.41716%2023.15%206.5%2023.15H26.5C26.5828%2023.15%2026.65%2023.0828%2026.65%2023V10C26.65%209.91716%2026.5828%209.85%2026.5%209.85ZM6.5%208C5.39543%208%204.5%208.89543%204.5%2010V23C4.5%2024.1046%205.39543%2025%206.5%2025H26.5C27.6046%2025%2028.5%2024.1046%2028.5%2023V10C28.5%208.89543%2027.6046%208%2026.5%208H6.5Z%22%20fill%3D%22%23444952%22%2F%3E%0A%3Cpath%20d%3D%22M5.5%2012.8H28.5V14.65H5.5V12.8Z%22%20fill%3D%22%23444952%22%2F%3E%0A%3Cpath%20d%3D%22M10.0375%2025L10.0375%208L11.8875%208L11.8875%2025H10.0375Z%22%20fill%3D%22%23444952%22%2F%3E%0A%3Cpath%20d%3D%22M15.5751%2025L15.5751%208L17.4251%208L17.4251%2025H15.5751Z%22%20fill%3D%22%23444952%22%2F%3E%0A%3Cpath%20d%3D%22M21.1127%2025V8L22.9627%208L22.9627%2025H21.1127Z%22%20fill%3D%22%23444952%22%2F%3E%0A%3Cpath%20d%3D%22M5.5%2018.35H28.5V20.2H5.5V18.35Z%22%20fill%3D%22%23444952%22%2F%3E%0A%3C%2Fsvg%3E%0A");
185
- }
186
-
187
- .maplibregl-ctrl-scale {
188
- background-color: hsla(0,0%,100%,.75);
189
- border: 1px solid #444952;
190
- border-top: #444952;
191
- box-sizing: border-box;
192
- color: #444952;
193
- font-size: 10px;
194
- padding: 0 5px;
195
- text-align: right;
196
- line-height: 14px;
197
- }
198
-
199
- .webgl-warning-div {
200
- position: absolute;
201
- top: 0;
202
- left: 0;
203
- bottom: 0;
204
- right: 0;
205
- margin: auto;
206
- width: -moz-fit-content;
207
- width: fit-content;
208
- height: -moz-fit-content;
209
- height: fit-content;
210
- padding: 10px;
211
- background: white;
212
- border-radius: 3px;
213
- color: #fb8600;
214
- text-align: center;
215
- font-family: sans-serif;
216
- font-weight: 300;
217
- font-size: 16px;
218
- max-width: calc(100% - 80px);
219
- }`,Gh=6371008.8,Hh={centimeters:100*Gh,centimetres:100*Gh,degrees:360/(2*Math.PI),feet:3.28084*Gh,inches:39.37*Gh,kilometers:Gh/1e3,kilometres:Gh/1e3,meters:Gh,metres:Gh,miles:Gh/1609.344,millimeters:1e3*Gh,millimetres:1e3*Gh,nauticalmiles:Gh/1852,radians:1,yards:1.0936*Gh};function Wh(e,t,i={}){const r={type:"Feature"};return(0===i.id||i.id)&&(r.id=i.id),i.bbox&&(r.bbox=i.bbox),r.properties=t||{},r.geometry=e,r}function Kh(e,t,i={}){if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!ep(e[0])||!ep(e[1]))throw new Error("coordinates must contain numbers");return Wh({type:"Point",coordinates:e},t,i)}function Xh(e,t,i={}){for(const t of e){if(t.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(t[t.length-1].length!==t[0].length)throw new Error("First and last Position are not equivalent.");for(let e=0;e<t[t.length-1].length;e++)if(t[t.length-1][e]!==t[0][e])throw new Error("First and last Position are not equivalent.")}return Wh({type:"Polygon",coordinates:e},t,i)}function Yh(e,t="kilometers"){const i=Hh[t];if(!i)throw new Error(t+" units is invalid");return e/i}function Jh(e){return 180*(e%(2*Math.PI))/Math.PI}function Qh(e){return e%360*Math.PI/180}function ep(e){return!isNaN(e)&&null!==e&&!Array.isArray(e)}function tp(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if("Feature"===e.type&&null!==e.geometry&&"Point"===e.geometry.type)return[...e.geometry.coordinates];if("Point"===e.type)return[...e.coordinates]}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return[...e];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function ip(e,t,i,r={}){const n=tp(e),o=Qh(n[0]),a=Qh(n[1]),s=Qh(i),l=Yh(t,r.units),c=Math.asin(Math.sin(a)*Math.cos(l)+Math.cos(a)*Math.sin(l)*Math.cos(s));return Kh([Jh(o+Math.atan2(Math.sin(s)*Math.sin(l)*Math.cos(a),Math.cos(l)-Math.sin(a)*Math.sin(c))),Jh(c)],r.properties)}function rp(e,t,i={}){const r=i.steps||64,n=i.properties?i.properties:!Array.isArray(e)&&"Feature"===e.type&&e.properties?e.properties:{},o=[];for(let n=0;n<r;n++)o.push(ip(e,t,-360*n/r,i).geometry.coordinates);return o.push(o[0]),Xh([o],n)}var np="M17.5,12A1.5,1.5 0 0,1 16,10.5A1.5,1.5 0 0,1 17.5,9A1.5,1.5 0 0,1 19,10.5A1.5,1.5 0 0,1 17.5,12M14.5,8A1.5,1.5 0 0,1 13,6.5A1.5,1.5 0 0,1 14.5,5A1.5,1.5 0 0,1 16,6.5A1.5,1.5 0 0,1 14.5,8M9.5,8A1.5,1.5 0 0,1 8,6.5A1.5,1.5 0 0,1 9.5,5A1.5,1.5 0 0,1 11,6.5A1.5,1.5 0 0,1 9.5,8M6.5,12A1.5,1.5 0 0,1 5,10.5A1.5,1.5 0 0,1 6.5,9A1.5,1.5 0 0,1 8,10.5A1.5,1.5 0 0,1 6.5,12M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A1.5,1.5 0 0,0 13.5,19.5C13.5,19.11 13.35,18.76 13.11,18.5C12.88,18.23 12.73,17.88 12.73,17.5A1.5,1.5 0 0,1 14.23,16H16A5,5 0 0,0 21,11C21,6.58 16.97,3 12,3Z",op="1.2.5";const ap=op,sp=[{name:"Navigation and city exploration",selector:{select:{options:["STREETS","STREETS.DARK","STREETS.LIGHT","STREETS.PASTEL"]}}},{name:"Data visualization",selector:{select:{options:["DATAVIZ","DATAVIZ.DARK","DATAVIZ.LIGHT"]}}},{name:"Minimalist and general purpose",selector:{select:{options:["BASIC","BASIC.DARK","BASIC.LIGHT"]}}},{name:"High contrast navigation",selector:{select:{options:["BRIGHT","BRIGHT.DARK","BRIGHT.LIGHT","BRIGHT.PASTEL"]}}},{name:"Topographic study",selector:{select:{options:["TOPO","TOPO.SHINY","TOPO.PASTEL","TOPO.TOPOGRAPHIQUE"]}}},{name:"Minimalist",selector:{select:{options:["VOYAGER","VOYAGER.DARK","VOYAGER.LIGHT","VOYAGER.VINTAGE"]}}},{name:"High contrast",selector:{select:{options:["TONER","TONER.BACKGROUND","TONER.LITE","TONER.LINES"]}}},{name:"Neutral greyscale style with hillshading",selector:{select:{options:["BACKDROP","BACKDROP.DARK","BACKDROP.LIGHT"]}}},{name:"Other",selector:{select:{options:["OPENSTREETMAP","OUTDOOR","WINTER","SATELLITE","HYBRID"]}}}],lp=["STREETS","BASIC","BRIGHT","DATAVIZ","VOYAGER","BACKDROP"],cp=()=>sp.reduce(((e,t)=>{const i=t.selector.select.options;return e.concat(i.map((e=>({value:e,label:e}))))}),[]),up=cp(),hp=0,pp=13,dp=["auto","light","dark"],mp=[{name:"aspect_ratio",label:"Aspect Ratio",selector:{text:{}}},{name:"default_zoom",label:"Default Zoom",default:pp,selector:{number:{mode:"box",min:0}}},{name:"theme_mode",label:"Theme Mode",default:"auto",selector:{select:{mode:"dropdown",options:dp.map((e=>({value:e,label:e.charAt(0).toUpperCase()+e.slice(1)})))}}},{name:"hours_to_show",label:"Hours to Show",default:0,selector:{number:{mode:"box",min:0}}},{name:"history_period",label:"History Period",default:"",selector:{select:{mode:"dropdown",options:[{value:"today",label:"Today"},{value:"yesterday",label:"Yesterday"}]}}},{name:"auto_fit",label:"Auto Fit",default:!1,selector:{boolean:{}}},{name:"fit_zones",label:"Fit Zones",default:!1,selector:{boolean:{}}},{name:"use_more_info",label:"Marker more info",default:!1,selector:{boolean:{}}}],fp={name:"custom_styles",type:"expandable",iconPath:np,title:"Custom Styles",schema:[{name:"",type:"grid",schema:[{name:"light",label:"Light Style",selector:{select:{mode:"dropdown",options:up}}},{name:"dark",label:"Dark Style",selector:{select:{mode:"dropdown",options:up}}}]}]},gp=at((e=>[{name:"",type:"expandable",iconPath:np,title:e("ui.panel.lovelace.editor.card.map.appearance"),schema:[{name:"",type:"grid",schema:[...mp]},fp]}])),yp=at((()=>[{name:"title",label:"Title",selector:{text:{type:"text"}}},{name:"api_key",label:"MapTiler API Key (required)",required:!0,selector:{text:{type:"text"}}}])),_p=at((e=>[...yp(),...gp(e)])),vp=Symbol.for("constructDateFrom");function xp(e,t){return"function"==typeof e?e(t):e&&"object"==typeof e&&vp in e?e[vp](t):e instanceof Date?new e.constructor(t):new Date(t)}function bp(e,t){return xp(e,e)}function wp(e,...t){const i=xp.bind(null,t.find((e=>"object"==typeof e)));return t.map(i)}function Cp(e,t){const i=bp(e);return i.setHours(0,0,0,0),i}function Tp(e){return xp(e,Date.now())}function Sp(e,t,i){const[r,n]=wp(i?.in,e,t);return+Cp(r)==+Cp(n)}function Ap(e,t){return Sp(xp(e,e),Tp(e))}const Mp=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],Ep=1,Pp=8;class Ip{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 r=i>>4;if(1!==r)throw new Error(`Got v${r} data when expected v1.`);const n=Mp[15&i];if(!n)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(e,2,1),[a]=new Uint32Array(e,4,1);return new Ip(a,o,n,e)}constructor(e,t=64,i=Float64Array,r){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 n=Mp.indexOf(this.ArrayType),o=2*e*this.ArrayType.BYTES_PER_ELEMENT,a=e*this.IndexArrayType.BYTES_PER_ELEMENT,s=(8-a%8)%8;if(n<0)throw new Error(`Unexpected typed array class: ${i}.`);r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+a+s,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+o+a+s),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+a+s,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+n]),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 kp(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,i,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:o,nodeSize:a}=this,s=[0,n.length-1,0],l=[];for(;s.length;){const c=s.pop()||0,u=s.pop()||0,h=s.pop()||0;if(u-h<=a){for(let a=h;a<=u;a++){const s=o[2*a],c=o[2*a+1];s>=e&&s<=i&&c>=t&&c<=r&&l.push(n[a])}continue}const p=h+u>>1,d=o[2*p],m=o[2*p+1];d>=e&&d<=i&&m>=t&&m<=r&&l.push(n[p]),(0===c?e<=d:t<=m)&&(s.push(h),s.push(p-1),s.push(1-c)),(0===c?i>=d:r>=m)&&(s.push(p+1),s.push(u),s.push(1-c))}return l}within(e,t,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:r,coords:n,nodeSize:o}=this,a=[0,r.length-1,0],s=[],l=i*i;for(;a.length;){const c=a.pop()||0,u=a.pop()||0,h=a.pop()||0;if(u-h<=o){for(let i=h;i<=u;i++)Fp(n[2*i],n[2*i+1],e,t)<=l&&s.push(r[i]);continue}const p=h+u>>1,d=n[2*p],m=n[2*p+1];Fp(d,m,e,t)<=l&&s.push(r[p]),(0===c?e-i<=d:t-i<=m)&&(a.push(h),a.push(p-1),a.push(1-c)),(0===c?e+i>=d:t+i>=m)&&(a.push(p+1),a.push(u),a.push(1-c))}return s}}function kp(e,t,i,r,n,o){if(n-r<=i)return;const a=r+n>>1;zp(e,t,a,r,n,o),kp(e,t,i,r,a-1,1-o),kp(e,t,i,a+1,n,1-o)}function zp(e,t,i,r,n,o){for(;n>r;){if(n-r>600){const a=n-r+1,s=i-r+1,l=Math.log(a),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(a-c)/a)*(s-a/2<0?-1:1);zp(e,t,i,Math.max(r,Math.floor(i-s*c/a+u)),Math.min(n,Math.floor(i+(a-s)*c/a+u)),o)}const a=t[2*i+o];let s=r,l=n;for(Lp(e,t,r,i),t[2*n+o]>a&&Lp(e,t,r,n);s<l;){for(Lp(e,t,s,l),s++,l--;t[2*s+o]<a;)s++;for(;t[2*l+o]>a;)l--}t[2*r+o]===a?Lp(e,t,r,l):(l++,Lp(e,t,l,n)),l<=i&&(r=l+1),i<=l&&(n=l-1)}}function Lp(e,t,i,r){Dp(e,i,r),Dp(t,2*i,2*r),Dp(t,2*i+1,2*r+1)}function Dp(e,t,i){const r=e[t];e[t]=e[i],e[i]=r}function Fp(e,t,i,r){const n=e-i,o=t-r;return n*n+o*o}const Rp={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},Bp=Math.fround||(e=>t=>(e[0]=+t,e[0]))(new Float32Array(1)),Op=2,jp=3,Np=4,$p=5,Vp=6;class Up{constructor(e){this.options=Object.assign(Object.create(Rp),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:r}=this.options;t&&console.time("total time");const n=`prepare ${e.length} points`;t&&console.time(n),this.points=e;const o=[];for(let t=0;t<e.length;t++){const i=e[t];if(!i.geometry)continue;const[r,n]=i.geometry.coordinates,a=Bp(Gp(r)),s=Bp(Hp(n));o.push(a,s,1/0,t,-1,1),this.options.reduce&&o.push(0)}let a=this.trees[r+1]=this._createTree(o);t&&console.timeEnd(n);for(let e=r;e>=i;e--){Date.now();a=this.trees[e]=this._createTree(this._cluster(a,e))}return t&&console.timeEnd("total time"),this}getClusters(e,t){let i=((e[0]+180)%360+360)%360-180;const r=Math.max(-90,Math.min(90,e[1]));let n=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,n=180;else if(i>n){const e=this.getClusters([i,r,180,o],t),a=this.getClusters([-180,r,n,o],t);return e.concat(a)}const a=this.trees[this._limitZoom(t)],s=a.range(Gp(i),Hp(o),Gp(n),Hp(r)),l=a.data,c=[];for(const e of s){const t=this.stride*e;c.push(l[t+5]>1?qp(l,t,this.clusterProps):this.points[l[t+3]])}return c}getChildren(e){const t=this._getOriginId(e),i=this._getOriginZoom(e),r="No cluster with the specified id.",n=this.trees[i];if(!n)throw new Error(r);const o=n.data;if(t*this.stride>=o.length)throw new Error(r);const a=this.options.radius/(this.options.extent*Math.pow(2,i-1)),s=o[t*this.stride],l=o[t*this.stride+1],c=n.within(s,l,a),u=[];for(const t of c){const i=t*this.stride;o[i+4]===e&&u.push(o[i+5]>1?qp(o,i,this.clusterProps):this.points[o[i+3]])}if(0===u.length)throw new Error(r);return u}getLeaves(e,t,i){t=t||10,i=i||0;const r=[];return this._appendLeaves(r,e,t,i,0),r}getTile(e,t,i){const r=this.trees[this._limitZoom(e)],n=Math.pow(2,e),{extent:o,radius:a}=this.options,s=a/o,l=(i-s)/n,c=(i+1+s)/n,u={features:[]};return this._addTileFeatures(r.range((t-s)/n,l,(t+1+s)/n,c),r.data,t,i,n,u),0===t&&this._addTileFeatures(r.range(1-s/n,l,1,c),r.data,n,i,n,u),t===n-1&&this._addTileFeatures(r.range(0,l,s/n,c),r.data,-1,i,n,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,r,n){const o=this.getChildren(t);for(const t of o){const o=t.properties;if(o&&o.cluster?n+o.point_count<=r?n+=o.point_count:n=this._appendLeaves(e,o.cluster_id,i,r,n):n<r?n++:e.push(t),e.length===i)break}return n}_createTree(e){const t=new Ip(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let i=0;i<e.length;i+=this.stride)t.add(e[i],e[i+1]);return t.finish(),t.data=e,t}_addTileFeatures(e,t,i,r,n,o){for(const a of e){const e=a*this.stride,s=t[e+5]>1;let l,c,u;if(s)l=Zp(t,e,this.clusterProps),c=t[e],u=t[e+1];else{const i=this.points[t[e+3]];l=i.properties;const[r,n]=i.geometry.coordinates;c=Gp(r),u=Hp(n)}const h={type:1,geometry:[[Math.round(this.options.extent*(c*n-i)),Math.round(this.options.extent*(u*n-r))]],tags:l};let p;p=s||this.options.generateId?t[e+3]:this.points[t[e+3]].id,void 0!==p&&(h.id=p),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:r,reduce:n,minPoints:o}=this.options,a=i/(r*Math.pow(2,t)),s=e.data,l=[],c=this.stride;for(let i=0;i<s.length;i+=c){if(s[i+2]<=t)continue;s[i+2]=t;const r=s[i],u=s[i+1],h=e.within(s[i],s[i+1],a),p=s[i+5];let d=p;for(const e of h){const i=e*c;s[i+2]>t&&(d+=s[i+5])}if(d>p&&d>=o){let e,o=r*p,a=u*p,m=-1;const f=(i/c<<5)+(t+1)+this.points.length;for(const r of h){const l=r*c;if(s[l+2]<=t)continue;s[l+2]=t;const u=s[l+5];o+=s[l]*u,a+=s[l+1]*u,s[l+4]=f,n&&(e||(e=this._map(s,i,!0),m=this.clusterProps.length,this.clusterProps.push(e)),n(e,this._map(s,l)))}s[i+4]=f,l.push(o/d,a/d,1/0,f,-1,d),n&&l.push(m)}else{for(let e=0;e<c;e++)l.push(s[i+e]);if(d>1)for(const e of h){const i=e*c;if(!(s[i+2]<=t)){s[i+2]=t;for(let e=0;e<c;e++)l.push(s[i+e])}}}}return l}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,t,i){if(e[t+5]>1){const r=this.clusterProps[e[t+6]];return i?Object.assign({},r):r}const r=this.points[e[t+3]].properties,n=this.options.map(r);return i&&n===r?Object.assign({},n):n}}function qp(e,t,i){return{type:"Feature",id:e[t+3],properties:Zp(e,t,i),geometry:{type:"Point",coordinates:[Wp(e[t]),Kp(e[t+1])]}}}function Zp(e,t,i){const r=e[t+5],n=r>=1e4?`${Math.round(r/1e3)}k`:r>=1e3?Math.round(r/100)/10+"k":r,o=e[t+6],a=-1===o?{}:Object.assign({},i[o]);return Object.assign(a,{cluster:!0,cluster_id:e[t+3],point_count:r,point_count_abbreviated:n})}function Gp(e){return e/360+.5}function Hp(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 Wp(e){return 360*(e-.5)}function Kp(e){const t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}const Xp=window.loadCardHelpers?window.loadCardHelpers():void 0,Yp=()=>{var e,t,i,r,n,o;customElements.get("ha-entity-marker")||null===(e=customElements.get("hui-map-card"))||void 0===e||e.getConfigElement(),customElements.get("ha-form")||null===(t=customElements.get("hui-button-card"))||void 0===t||t.getConfigElement(),customElements.get("ha-entity-picker")||null===(i=customElements.get("hui-entities-card"))||void 0===i||i.getConfigElement(),customElements.get("ha-card-conditions-editor")||null===(r=customElements.get("hui-conditional-card"))||void 0===r||r.getConfigElement(),customElements.get("ha-form-multi_select")||null===(n=customElements.get("hui-entities-card"))||void 0===n||n.getConfigElement(),customElements.get("hui-entity-editor")||null===(o=customElements.get("hui-glance-card"))||void 0===o||o.getConfigElement()},Jp=async e=>{if(!customElements.get("ha-entity-marker")){const t={type:"map",entities:e,theme_mode:"auto"};let i;if(window.loadCardHelpers?i=await window.loadCardHelpers():Xp&&(i=Xp),!i||!i.createCardElement)return;if(!await i.createCardElement(t))return}};var Qp,ed,td,id,rd,nd,od,ad;!function(e){e.language="language",e.system="system",e.comma_decimal="comma_decimal",e.decimal_comma="decimal_comma",e.space_comma="space_comma",e.none="none"}(Qp||(Qp={})),function(e){e.language="language",e.system="system",e.am_pm="12",e.twenty_four="24"}(ed||(ed={})),function(e){e.local="local",e.server="server"}(td||(td={})),function(e){e.language="language",e.system="system",e.DMY="DMY",e.MDY="MDY",e.YMD="YMD"}(id||(id={})),function(e){e.language="language",e.monday="monday",e.tuesday="tuesday",e.wednesday="wednesday",e.thursday="thursday",e.friday="friday",e.saturday="saturday",e.sunday="sunday"}(rd||(rd={}));const sd=e=>"string"==typeof e?e:e.entity_id,ld=at((async(e,t,i)=>{const r={address:"streetName",locality:"sublocality",municipality:"city"},n=`https://api.maptiler.com/geocoding/${t},${e}.json?key=${i}`;try{const e=await fetch(n);if(!e.ok)throw new Error("Failed to fetch address from MapTiler");const t=await e.json();if(t&&t.features&&t.features.length>0){let e={};if(t.features.forEach((t=>{const i=t.place_type[0];if(r[i]){const n=r[i],o=t.text;"address"===i&&(e.streetNumber=t.address?`${t.address}`:""),e[n]=`${o}`}})),e.streetName&&e.city)return e}return null}catch(e){return console.warn("Error fetching address from MapTiler:",e),null}})),cd=null===(ad=null===(nd=Intl.DateTimeFormat)||void 0===nd?void 0:(od=nd.call(Intl)).resolvedOptions)||void 0===ad?void 0:ad.call(od).timeZone,ud=null!=cd?cd:"UTC",hd=(e,t)=>e===td.local&&cd?ud:t,pd=at((e=>{if(e.time_format===ed.language||e.time_format===ed.system){const t=e.time_format===ed.language?e.language:void 0;return new Date("January 1, 2023 22:00:00").toLocaleString(t).includes("10")}return e.time_format===ed.am_pm})),dd=(e,t,i)=>md(t,i.time_zone).format(e),md=at(((e,t)=>new Intl.DateTimeFormat(e.language,{weekday:"long",hour:pd(e)?"numeric":"2-digit",minute:"2-digit",hour12:pd(e),timeZone:hd(e.time_zone,t)}))),fd={dark:ei.STREETS.DARK,light:ei.DATAVIZ.LIGHT,demo:"https://demotiles.maplibre.org/style.json"},gd={backgroundColor:{light:"#fff",dark:"#222222"},fill:{light:"#222222",dark:"#c1c1c1"},boxShadow:{light:"0 0 0 2px rgba(0, 0, 0, 0.1)",dark:"0 0 0 2px rgba(255, 255, 255, 0.1)"},borderTop:{light:"1px solid #ddd",dark:"1px solid #424242"},themeBtn:{light:"mdi:weather-sunny",dark:"mdi:weather-night"}};class yd extends Ke{constructor(){super(...arguments),this.autoFit=!1,this.fitZones=!1,this.zoom=pp,this.themeMode="auto",this.useMoreInfo=!1,this._darkStyle=!1,this._mapItems=[],this._zoneItems=[],this._mapFocusZones=[],this._mapFocusItems=[],this._mapPaths=[],this._mapHelper=gh,this._clusters=[],this._clustersZoom=0,this._circleLoaded=!1,this._mapClusterItems=[],this._mapClusterFocusItems=[],this._loaded=!1,this._clustersLoaded=!1,this._createButton=(e,t)=>{const i=document.createElement("div");i.classList.add("maplibregl-ctrl","maplibregl-ctrl-group");const r=document.createElement("button"),n=document.createElement("ha-icon");return n.setAttribute("icon",e),n.style.color="var(--emc-btn-color)",r.appendChild(n),r.title=t,i.appendChild(r),i.style.display="none",i},this.getModeColor=(e,t)=>t?gd[e][t]:this._darkMode?gd[e].dark:gd[e].light}get _darkMode(){return"dark"===this.themeMode||"auto"===this.themeMode&&Boolean(this.hass.themes.darkMode)}async firstUpdated(){await Jp(this.entities),await new Promise((e=>setTimeout(e,0))),this._initMap()}render(){const e=this._renderLoadError();return ke`
220
- <div class="maptiler-map">
221
- ${e}
222
- <div id="map"></div>
223
- </div>
224
- `}_renderLoadError(){if(!this._error)return ke``;const{code:e,message:t}=this._error;return ke` <ha-alert alert-type="${e}" id="error"> ${t} </ha-alert> `}updated(e){var t,i,r,n;if(super.updated(e),!this._loaded)return;let o=!1;const a=e.get("hass");if(e.has("_loaded")||e.has("entities"))this._drawEntities(),o=!0;else if(this._loaded&&a&&this.entities)for(const e of this.entities)if(a.states[sd(e)]!==this.hass.states[sd(e)]){this._drawEntities(),o=!0;break}if((e.has("_loaded")||this.autoFit&&o)&&this._fitMap(),e.has("hass")&&a){if((null===(t=a.themes)||void 0===t?void 0:t.darkMode)!==(null===(i=this.hass.themes)||void 0===i?void 0:i.darkMode)){const e=this._getInitStyle();this._map.setStyle(e,{diff:!1})}}e.has("themeMode")||e.has("hass")&&(!a||(null===(r=a.themes)||void 0===r||r.darkMode,null===(n=this.hass.themes)||void 0===n||n.darkMode))}_drawEntities(){const e=this.hass,t=this._map;if(!t||!e)return;if(this._mapItems.length&&(this._mapItems.forEach((e=>e.remove())),this._mapItems=[],this._mapFocusItems=[]),this._mapClusterItems.length&&(this._clusterIndex=void 0,this._mapClusterItems.forEach((e=>e.remove())),this._mapClusterItems=[],this._mapClusterFocusItems=[]),this._zoneItems.length&&(this._zoneItems.forEach((e=>e.remove())),this._zoneItems=[],this._mapFocusZones=[]),!this.entities)return;const i=[],r=[],n=getComputedStyle(this),o=n.getPropertyValue("--accent-color"),a=n.getPropertyValue("--secondary-text-color"),s=n.getPropertyValue("--dark-primary-color"),l=this._darkStyle?"dark":"light";for(const n of this.entities){const s=e.states[sd(n)];if(!s)continue;const c="string"!=typeof n?n.name:void 0,u=null!=c?c:ht(s),{latitude:h,longitude:p,passive:d,icon:m,radius:f,gps_accuracy:g}=s.attributes;if(!h||!p)continue;const y=[p,h];if("zone"!==L(s))i.push({type:"Feature",geometry:{type:"Point",coordinates:y},properties:{title:u,entity:n,entityId:sd(n),gpsAccuracy:g}});else{let e="";if(m){const t=document.createElement("ha-icon");t.setAttribute("icon",m),e=t.outerHTML}else{const t=document.createElement("span");t.innerHTML=u,e=t.outerHTML}const i=rp(y,f,{steps:150,units:"meters",properties:{color:d?a:o,title:u,opacity:d?.2:.3}});r.push(i);const s=document.createElement("div");s.className=`marker ${l}`,s.innerHTML=e,s.title=u;const c=new Kr({element:s}).setLngLat(y).addTo(t);this._zoneItems.push(c),!this.fitZones||"string"!=typeof n&&!1===n.focus||this._mapFocusZones.push(i.geometry)}}this._clusterIndex=new Up({radius:100,maxZoom:11}),this._clusterIndex.load(i);const c=t.getBounds().toArray().flat(),u=Math.floor(t.getZoom()),h=this._clusterIndex.getClusters(c,u);for(const i of h){const[n,o]=i.geometry.coordinates;if(i.properties.cluster){const e=i.properties.point_count,r=i.properties.cluster_id,a=document.createElement("div");a.className="cluster-marker",a.innerHTML=`<div><span>${e.toString()}</span></div>`,a.addEventListener("click",(()=>{var e;try{const i=null===(e=this._clusterIndex)||void 0===e?void 0:e.getClusterExpansionZoom(r);void 0!==i&&t.easeTo({center:[n,o],zoom:i})}catch(e){}}));const s=new Kr({element:a}).setLngLat([n,o]).addTo(t);this._mapClusterItems.push(s),this._mapFocusItems.push(s),this._mapClusterFocusItems.push(s),this._mapItems.push(s)}else{const a=i.properties.entity,l=e.states[i.properties.entityId],c=i.properties.title,u=i.properties.gpsAccuracy,h="string"!=typeof a&&"state"===a.label_mode?this.hass.formatEntityState(l):"string"!=typeof a&&"attribute"===a.label_mode&&void 0!==a.attribute?this.hass.formatEntityAttributeValue(l,a.attribute):c.split(" ").map((e=>e[0])).join("").substring(0,3),p=document.createElement("ha-entity-marker");p.hass=this.hass,p.showIcon="string"!=typeof a&&"icon"===a.label_mode,p.entityId=sd(a),p.entityName=h,p.entityPicture=!l.attributes.entity_picture||"string"!=typeof a&&a.label_mode?"":this.hass.hassUrl(l.attributes.entity_picture),"string"!=typeof a&&(p.entityColor=a.color),p.addEventListener("click",(e=>{e.stopImmediatePropagation(),e.preventDefault(),this.useMoreInfo&&C(this,"hass-more-info",{entityId:p.entityId})}),!0);const d=new Kr({element:p}).setLngLat([n,o]).addTo(t);if(this._mapItems.push(d),"string"!=typeof a&&!1===a.focus||this._mapFocusItems.push(d),u){const e=rp([n,o],u,{steps:64,units:"meters",properties:{color:s,title:c,opacity:.5}});r.push(e)}}}const p={type:"geojson",data:{type:"FeatureCollection",features:r}};this._circleLoaded||(t.getLayer("circles")&&t.removeLayer("circles"),t.getLayer("circles-stroke")&&t.removeLayer("circles-stroke"),t.getSource("circles")&&t.removeSource("circles"),t.addSource("circles",p),t.addLayer({id:"circles",type:"fill",source:"circles",paint:{"fill-color":["get","color"],"fill-opacity":["get","opacity"]}}),t.addLayer({id:"circles-stroke",type:"line",source:"circles",paint:{"line-color":["get","color"],"line-width":2}}),this._circleLoaded=!0)}_drawCircles(e,t){e.getLayer("circles")&&e.removeLayer("circles"),e.getLayer("circles-stroke")&&e.removeLayer("circles-stroke"),e.getSource("circles")&&e.removeSource("circles"),e.addSource("circles",t),e.addLayer({id:"circles",type:"fill",source:"circles",paint:{"fill-color":["get","color"],"fill-opacity":["get","opacity"]}}),e.addLayer({id:"circles-stroke",type:"line",source:"circles",paint:{"line-color":["get","color"],"line-width":2}})}_computePathTooltip(e,t){let i;return i=e.fullDatetime?E(t.timestamp,this.hass.locale):Ap(t.timestamp)?I(t.timestamp,this.hass.locale):dd(t.timestamp,this.hass.locale,this.hass.config),`<b>${e.name}</b><br><i>${i}</i>`}_drawPaths(){const e=this.hass,t=this._map;if(!t||!e)return;if(this._mapPaths.length&&(this._mapPaths.forEach((e=>{t.removeLayer(e.id)})),this._mapPaths=[]),!this.paths)return;const i=getComputedStyle(this).getPropertyValue("--dark-primary-color"),r=[],n=[];this.paths.forEach((e=>{if(!e.points||e.points.length<2)return;let t,o;e.gradualOpacity&&(t=e.gradualOpacity/(e.points.length-2),o=1-e.gradualOpacity);for(let a=0;a<e.points.length-1;a++){const s=e.points[a].point,l=e.points[a+1].point,c=e.gradualOpacity?o+a*t:void 0,u=this._computePathTooltip(e,e.points[a]),h={type:"Feature",geometry:{type:"Point",coordinates:s},properties:{friendlyName:e.name,color:e.color||i,opacity:c,fillOpacity:c,lastUpdated:e.points[a].timestamp,popupContent:u}};n.push(h);const p={type:"Feature",geometry:{type:"LineString",coordinates:[s,l]},properties:{color:e.color||i,opacity:c,fillOpacity:c}};r.push(p)}}));const o={type:"geojson",data:{type:"FeatureCollection",features:n}},a={type:"geojson",data:{type:"FeatureCollection",features:r}};t.getSource("points")&&t.removeSource("points"),t.getSource("lines")&&t.removeSource("lines"),t.addSource("points",o),t.addSource("lines",a);const s={id:"lines",type:"line",source:"lines",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["get","color"],"line-width":2,"line-opacity":["get","opacity"]}},l={id:"points",type:"circle",source:"points",paint:{"circle-radius":5,"circle-color":["get","color"],"circle-opacity":["get","fillOpacity"],"circle-stroke-width":1,"circle-stroke-color":["get","color"]}};t.addLayer(s),t.addLayer(l),this._mapPaths.push(s,l),this._setupPointInteraction()}_setupPointInteraction(){const e=this._map;if(!e)return;const t=new Xr({closeButton:!1,closeOnClick:!1,offset:8});let i;e.on("mousemove","points",(async r=>{var n;if(e.getZoom()<10)return e.getCanvas().style.cursor="",t.remove(),void(i=void 0);const o=null===(n=r.features)||void 0===n?void 0:n[0];if(!o)return;const a=o.geometry.coordinates.toString();if(i!==a){i=a,e.getCanvas().style.cursor="pointer";const n=r.features[0].geometry.coordinates.slice(),{popupContent:s}=o.properties;for(;Math.abs(r.lngLat.lng-n[0])>180;)n[0]+=r.lngLat.lng>n[0]?360:-360;t.setLngLat(n).setHTML(s).addTo(e);const l=await ld(n[1],n[0],this.apiKey);if(l){const e=`${s}<br>${l.streetName}`;t.isOpen()&&t.setHTML(e)}}})),e.on("mouseleave","points",(()=>{e.getCanvas().style.cursor="",t.remove(),i=void 0}))}_fitMap(e){var t,i,r,n,o;const a=this._map;if(!a)return;if(!this._mapClusterFocusItems.length&&!this._mapFocusItems.length&&!this._mapFocusZones.length)return void this._map.setCenter([this.hass.config.longitude,this.hass.config.latitude]);let s=new xh;!this._mapFocusItems||this._mapFocusItems.map((e=>{const t=e.getLngLat();s.extend([t.lng,t.lat])})),null===(t=this._mapFocusZones)||void 0===t||t.forEach((e=>{e.coordinates[0].forEach((e=>{s.extend([e[0],e[1]])}))})),null===(i=this._mapClusterFocusItems)||void 0===i||i.forEach((e=>{s.extend(e.getLngLat())})),s.isEmpty()||(this._fitBounds=s,a.fitBounds(s,{padding:null!==(r=null==e?void 0:e.pad)&&void 0!==r?r:{top:50,right:75,bottom:50,left:50},maxZoom:null!==(n=null==e?void 0:e.zoom)&&void 0!==n?n:this.zoom,animate:null!==(o=null==e?void 0:e.animate)&&void 0!==o&&o,linear:!0}))}_initMap(){const{zoom:e,apiKey:t}=this,i=[this.hass.config.longitude,this.hass.config.latitude],r=t?this._getInitStyle():fd.demo;this.zoom=t?this.zoom:5,this._error=t?void 0:{code:"info",message:"API key is required"};const n=this.shadowRoot.getElementById("map");fr.apiKey=t;const o={geolocateControl:!1,fullscreenControl:!1,navigationControl:!1,attributionControl:!1,fadeDuration:0,canvasContextAttributes:{antialias:!0},maxZoom:20,container:n,zoom:e,style:r,center:i};this._map=new mu(o),this._map.on("load",(async()=>{this._loaded=!0})),this._map.on("style.load",(async()=>{const e=this._map.getStyle().name,t=/dark/i.test(e);this._darkStyle=t,this._changeControlTheme(t?"dark":"light"),this._drawPaths()}));const a=new an({visualizePitch:!0,visualizeRoll:!0});this._map.addControl(a,"top-right"),this._addMapControl("mdi:image-filter-center-focus","Center","top-right",this._centerMap.bind(this)),this._map.on("styleimagemissing",(e=>{var t;null===(t=this._map)||void 0===t||t.addImage(e.id,{width:0,height:0,data:new Uint8Array(0)})})),this._map.on("error",(e=>{void 0!==e.style&&(this._error={code:"error",message:"Error fetching the map. Please verify your API key and try again."},this._map.setStyle(fd.demo),this.zoom=0)})),this._map.on("zoomend",(async()=>{this._drawEntities()}))}_getClusterCenter(){const e=this._map;let t=0,i=-1,r=[];for(let n=0;n<=11;n+=.2){const o=e.getBounds().toArray().flat(),a=this._clusterIndex.getClusters(o,n),s=a.length;if(s<=i)break;r=a,i=s,t=n}const n=this._clusterIndex.getClusterExpansionZoom(r[0].properties.cluster_id),o=r[0].geometry.coordinates;e.easeTo({center:[o[0],o[1]],zoom:n,duration:0,padding:{top:50,right:75,bottom:50,left:50}}),this._clustersLoaded=!0}_centerMap(){const e=this._fitBounds;e?this._map.fitBounds(e,{padding:{top:50,right:75,bottom:50,left:50},animate:!0,maxZoom:this.zoom,linear:!0}):(this._map.setCenter([this.hass.config.longitude,this.hass.config.latitude]),this._map.setZoom(this.zoom))}_addMapControl(e,t,i,r){this._map.addControl({onAdd:()=>{const i=this._createButton(e,t);return i.style.display="unset",i.addEventListener("click",r),i},onRemove:()=>null},i)}_getInitStyle(){const{light:e,dark:t}=this.customStyles||{},i=e=>{const t=e.split(".");return 2===t.length?ei[t[0]][t[1]]:ei[t[0]]};return this._darkMode?t?i(t):fd.dark:e?i(e):fd.light}_changeControlTheme(e){const t=t=>this.getModeColor(t,e),i=Array.from(this.shadowRoot.querySelectorAll(".maplibregl-ctrl"));for(const e of i){const i=Array.from(e.querySelectorAll("button"));for(const e of i){const i=e;i.style.backgroundColor=t("backgroundColor"),i.style.boxShadow=t("boxShadow");const r=e.querySelector("span");if(r){const e=window.getComputedStyle(r).backgroundImage;if(e.startsWith('url("data:image/svg+xml')){const i=t("fill"),n=e.slice(5,-2),o=decodeURIComponent(n.split(",")[1]).replace(/fill:[^;"]*/g,`fill:${i}`).replace(/fill="[^"]*"/g,`fill="${i}"`),a=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(o)}`;r.style.backgroundImage=`url("${a}")`}}}}}static get styles(){return[Z(Zh),G`
225
- :host {
226
- --tooltip-color: rgba(80, 80, 80, 0.9);
227
- }
228
- :host(:not([dark-style])) button > ha-icon,
229
- :host(:not([dark-style])) .marker {
230
- color: #222222 !important;
231
- }
232
-
233
- .maptiler-map {
234
- height: 100%;
235
- width: 100%;
236
- }
237
- #error {
238
- position: absolute;
239
- bottom: 0.5rem;
240
- left: 50%;
241
- transform: translateX(-50%);
242
- background: var(--card-background-color);
243
- height: fit-content;
244
- display: flex;
245
- justify-content: center;
246
- z-index: 3;
247
- width: max-content;
248
- word-wrap: break-word;
249
- }
250
- #map {
251
- position: absolute;
252
- top: 0;
253
- bottom: 0;
254
- width: 100%;
255
- }
256
-
257
- .maplibregl-popup-content {
258
- padding: 8px;
259
- background: var(--tooltip-color) !important;
260
- color: white !important;
261
- border-radius: 4px;
262
- box-shadow: none !important;
263
- text-align: center;
264
- letter-spacing: 1px;
265
- }
266
-
267
- .cluster-marker {
268
- position: relative;
269
- background-clip: padding-box;
270
- background-color: rgb(from var(--primary-color) r g b / 0.5);
271
- /* background-color: var(--primary-color); */
272
- width: 40px;
273
- height: 40px;
274
- border-radius: 50%;
275
- display: flex;
276
- justify-content: center;
277
- align-items: center;
278
- text-align: center;
279
- }
280
-
281
- .cluster-marker > div {
282
- display: flex;
283
- width: 30px;
284
- height: 30px;
285
- text-align: center;
286
- border-radius: 15px;
287
- background-color: var(--primary-color);
288
- justify-content: center;
289
- align-items: center;
290
- }
291
-
292
- .cluster-marker span {
293
- font-size: 14px;
294
- color: var(--text-primary-color);
295
- }
296
-
297
- .maplibregl-popup-tip,
298
- .maplibregl-popup-anchor-top-left .maplibregl-popup-tip,
299
- .maplibregl-popup-anchor-top-right .maplibregl-popup-tip {
300
- border-bottom-color: var(--tooltip-color) !important;
301
- }
302
- .maplibregl-popup-anchor-bottom .maplibregl-popup-tip,
303
- .maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,
304
- .maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip {
305
- border-top-color: var(--tooltip-color) !important;
306
- }
307
- .maplibregl-popup-anchor-left .maplibregl-popup-tip {
308
- border-right-color: var(--tooltip-color) !important;
309
- }
310
- .maplibregl-popup-anchor-right .maplibregl-popup-tip {
311
- border-left-color: var(--tooltip-color) !important;
312
- }
313
-
314
- .maplibregl-ctrl-bottom-right > details,
315
- .maplibregl-ctrl-bottom-left > .maplibregl-ctrl:not(.maplibregl-map) {
316
- display: none !important;
317
- }
318
- .mapboxgl-ctrl-group button,
319
- .maplibregl-ctrl-group button {
320
- width: 30px;
321
- height: 30px;
322
- --mdc-icon-size: 18px;
323
- }
324
-
325
- .maplibregl-ctrl.maplibregl-ctrl-group > button:hover > ha-icon {
326
- filter: invert(39%) sepia(77%) saturate(909%) hue-rotate(182deg) brightness(89%) contrast(85%);
327
- }
328
- `]}}e([Qe({attribute:!1})],yd.prototype,"hass",void 0),e([Qe({attribute:!1})],yd.prototype,"entities",void 0),e([Qe({attribute:!1})],yd.prototype,"paths",void 0),e([Qe({attribute:"auto-fit",type:Boolean})],yd.prototype,"autoFit",void 0),e([Qe({attribute:"fit-zones",type:Boolean})],yd.prototype,"fitZones",void 0),e([Qe({type:Number})],yd.prototype,"zoom",void 0),e([Qe({attribute:"theme-mode",type:String})],yd.prototype,"themeMode",void 0),e([Qe({type:String})],yd.prototype,"apiKey",void 0),e([Qe({type:Boolean})],yd.prototype,"useMoreInfo",void 0),e([Qe({type:Object})],yd.prototype,"customStyles",void 0),e([Qe({attribute:"dark-style",type:Boolean,reflect:!0})],yd.prototype,"_darkStyle",void 0),e([et()],yd.prototype,"_loaded",void 0),e([et()],yd.prototype,"_error",void 0),customElements.get("emc-map")||customElements.define("emc-map",yd);class _d extends Ke{constructor(){super(...arguments),this._mapEntities=[],this._colorDict={},this._colorIndex=0,this._zoom=pp,this._getHistoryPaths=at(((e,t)=>{var i,r,n,o;if(!t)return;const a=[];for(const s of Object.keys(t)){if("zone"===z(s))continue;const l=t[s];if(!(null==l?void 0:l.length))continue;const c=[];for(const e of l){const t=e.a.latitude,i=e.a.longitude;if(!t||!i)continue;const r={};r.point=[i,t],r.timestamp=new Date(1e3*e.lu),c.push(r)}const u=null===(i=this._configEntities)||void 0===i?void 0:i.find((e=>e.entity===s)),h=null!==(r=null==u?void 0:u.name)&&void 0!==r?r:s in this.hass.states?ht(this.hass.states[s]):s,p=null!==(n=null==u?void 0:u.color)&&void 0!==n?n:this._getColor(s);a.push({points:c,name:h,fullDatetime:(null!==(o=e.hours_to_show)&&void 0!==o?o:0)>=144,color:p,gradualOpacity:.8})}return a}))}_getAllEntities(){const e=this.hass,t=new Set,i=[];return Object.values(e.states).forEach((e=>{"latitude"in e.attributes&&"longitude"in e.attributes&&(i.push(e.entity_id),"person"===L(e)&&e.attributes.source&&t.add(e.attributes.source))})),i.filter((e=>!t.has(e)))}static async getConfigElement(){return await Promise.resolve().then((function(){return wd})),document.createElement("extra-map-editor")}static getStubConfig(e,t,i){return{type:"custom:extra-map-card",entities:dt(e,2,t,i,["device_tracker"]),theme_mode:"auto",use_more_info:!0}}setConfig(e){var t;if(!e)throw new Error("Invalid configuration");if(!e.show_all&&!(null===(t=e.entities)||void 0===t?void 0:t.length))throw new Error("Either entities or show_all is required");if(e.entities&&!Array.isArray(e.entities))throw new Error("Entities need to be an array");if(e.show_all&&e.entities)throw new Error("Cannot specify show_all and entities at the same time");if(this._config=Object.assign({},e),this._config.default_zoom)this._zoom=this._config.default_zoom;else if(this._config.aspect_ratio){const e=Ct(this._config.aspect_ratio),t=e&&e.w>0&&e.h>0?`${(100*e.h/e.w).toFixed(2)}`:"100";t&&Number(t)<=100?this._zoom=12:this._zoom=pp}this.hass&&e.show_all&&(this._config.entities=this._getAllEntities()),this._configEntities=this._config.entities?gt(this._config.entities):[],this._mapEntities=this._getMapEntities()}getCardSize(){var e;if(!(null===(e=this._config)||void 0===e?void 0:e.aspect_ratio))return 7;const t=Ct(this._config.aspect_ratio),i=t&&t.w>0&&t.h>0?`${(100*t.h/t.w).toFixed(2)}`:"100";return 1+Math.floor(Number(i)/25)||3}getGridOptions(){return{columns:"full",rows:"auto",min_columns:6,min_rows:2}}render(){var e;if(!this._config)return Le;if(this._error)return ke`<ha-alert alert-type="error">
329
- ${this.hass.localize("ui.components.map.error")}: ${this._error.message} (${this._error.code})
330
- </ha-alert>`;const t=this._config.theme_mode||(this._config.dark_mode?"dark":"auto"),i=this._config.custom_styles||{};return ke`
331
- <ha-card id="card" .header=${this._config.title}>
332
- <div id="root">
333
- <emc-map
334
- .hass=${this.hass}
335
- .entities=${this._mapEntities}
336
- .paths=${this._getHistoryPaths(this._config,this._stateHistory)}
337
- .autoFit=${this._config.auto_fit||!1}
338
- .fitZones=${this._config.fit_zones||!1}
339
- .zoom=${this._zoom}
340
- .themeMode=${t}
341
- .apiKey=${this._config.api_key}
342
- .useMoreInfo=${null!==(e=this._config.use_more_info)&&void 0!==e&&e}
343
- .customStyles=${i}
344
- ></emc-map>
345
- </div>
346
- </ha-card>
347
- `}shouldUpdate(e){var t;if(!e.has("hass")||e.size>1)return!0;const i=e.get("hass");return!i||!this._configEntities||(i.themes.darkMode!==this.hass.themes.darkMode||(!!e.has("_stateHistory")||((null===(t=this._config)||void 0===t?void 0:t.entities)?bt(this,e):yt(this,e))))}willUpdate(e){var t,i;super.willUpdate(e),(null===(t=this._config)||void 0===t?void 0:t.show_all)&&!(null===(i=this._config)||void 0===i?void 0:i.entities)&&this.hass&&e.has("hass")&&(this._config.entities=this._getAllEntities(),this._configEntities=gt(this._config.entities),this._mapEntities=this._getMapEntities())}connectedCallback(){var e;super.connectedCallback(),window.ExtraMapCard=this,this.hasUpdated&&(null===(e=this._configEntities)||void 0===e?void 0:e.length)&&this._subscribeHistory()}disconnectedCallback(){super.disconnectedCallback(),this._unsubscribeHistory()}_subscribeHistory(){var e,i;if(!t(this.hass,"history")||this._subscribed||!(null===(e=this._config)||void 0===e?void 0:e.history_period)&&!(null===(i=this._config)||void 0===i?void 0:i.hours_to_show))return;const r=this._config;let n=0;if(void 0!==r.history_period){const e=new Date;if("today"===r.history_period)n=e.getHours();else if("yesterday"===r.history_period){const t=new Date(e);t.setDate(e.getDate()-1),n=t.getHours()+24}}else n=r.hours_to_show||0;this._subscribed=O(this.hass,(e=>{this._subscribed&&(this._stateHistory=e)}),n,(this._configEntities||[]).map((e=>e.entity)),!1,!1,!1).catch((e=>{this._subscribed=void 0,this._error=e}))}_unsubscribeHistory(){this._subscribed&&(this._subscribed.then((e=>null==e?void 0:e())),this._subscribed=void 0)}updated(e){var t;(null===(t=this._configEntities)||void 0===t?void 0:t.length)?this._subscribed&&!e.has("_config")||(this._unsubscribeHistory(),this._subscribeHistory()):this._unsubscribeHistory(),e.has("_config")&&this._computePadding()}_computePadding(){const e=this.shadowRoot.getElementById("root"),t="panel"===this.layout;if(!this._config||t||!e)return;if(!this._config.aspect_ratio)return void(e.style.paddingBottom="100%");e.style.height="auto";const i=Ct(this._config.aspect_ratio);e.style.paddingBottom=i&&i.w>0&&i.h>0?`${(100*i.h/i.w).toFixed(2)}%`:e.style.paddingBottom="100%"}_getColor(e){let t=this._colorDict[e];return t||(t=lt(this._colorIndex),this._colorIndex++,this._colorDict[e]=t,t)}_getMapEntities(){return[...(this._configEntities||[]).map((e=>({entity_id:e.entity,color:e.color?e.color:this._getColor(e.entity),label_mode:e.label_mode,attribute:e.attribute,focus:e.focus,name:e.name})))]}}function vd(e){return e.map((e=>"string"==typeof e?{entity:e}:e))}_d.styles=G`
348
- ha-card {
349
- overflow: hidden;
350
- width: 100%;
351
- height: 100%;
352
- display: flex;
353
- flex-direction: column;
354
- }
355
- #root {
356
- position: relative;
357
- height: 100%;
358
- }
359
- `,e([Qe({attribute:!1})],_d.prototype,"hass",void 0),e([Qe({attribute:!1})],_d.prototype,"layout",void 0),e([et()],_d.prototype,"_config",void 0),e([et()],_d.prototype,"_mapEntities",void 0),e([et()],_d.prototype,"_stateHistory",void 0),e([et()],_d.prototype,"_error",void 0),e([it("emc-map")],_d.prototype,"_mapTiler",void 0),customElements.get("extra-map-card")||customElements.define("extra-map-card",_d),window.customCards=window.customCards||[],window.customCards.find((e=>"extra-map-card"===e.type))||window.customCards.push({description:"Extra Map Card using MapTiler",name:"Extra Map Card",preview:!0,type:"extra-map-card"});const xd=e=>"latitude"in e.attributes&&"longitude"in e.attributes;class bd extends Ke{constructor(){super(...arguments),this._computeLabelCallback=e=>{var t,i;let r=null===(t=this.hass)||void 0===t?void 0:t.localize(`ui.panel.lovelace.editor.card.generic.${e.name}`);return r||(r=null===(i=this.hass)||void 0===i?void 0:i.localize(`ui.panel.lovelace.editor.card.${e.label}`),r||e.label)}}connectedCallback(){super.connectedCallback(),Yp()}disconnectedCallback(){super.disconnectedCallback()}setConfig(e){this._config=e,this._configEntities=e.entities?vd(e.entities):[]}render(){if(!this.hass||!this._config)return Le;const e=_p(this.hass.localize);return ke`
360
- <ha-form
361
- .hass=${this.hass}
362
- .data=${this._config}
363
- .schema=${e}
364
- .computeLabel=${this._computeLabelCallback}
365
- @value-changed=${this._valueChanged}
366
- >
367
- </ha-form>
368
-
369
- <hui-entity-editor
370
- .hass=${this.hass}
371
- .label=${"Entities"}
372
- .entities=${this._configEntities}
373
- .entityFilter=${xd}
374
- @entities-changed=${this._entitiesValueChanged}
375
- ></hui-entity-editor>
376
- <div class="card-version">${ap}</div>
377
- `}_valueChanged(e){e.stopPropagation(),C(this,"config-changed",{config:e.detail.value})}_entitiesValueChanged(e){e.detail&&e.detail.entities&&(this._config=Object.assign(Object.assign({},this._config),{entities:e.detail.entities}),this._configEntities=vd(this._config.entities||[]),C(this,"config-changed",{config:this._config}))}static get styles(){return G`
378
- .card-config {
379
- /* Cancels overlapping Margins for HAForm + Card Config options */
380
- overflow: auto;
381
- }
382
- ha-switch {
383
- padding: 16px 6px;
384
- }
385
- .side-by-side {
386
- display: flex;
387
- align-items: flex-end;
388
- }
389
- .side-by-side > * {
390
- flex: 1;
391
- padding-right: 8px;
392
- padding-inline-end: 8px;
393
- padding-inline-start: initial;
394
- }
395
- .side-by-side > *:last-child {
396
- flex: 1;
397
- padding-right: 0;
398
- padding-inline-end: 0;
399
- padding-inline-start: initial;
400
- }
401
- .suffix {
402
- margin: 0 8px;
403
- }
404
- hui-action-editor,
405
- ha-select,
406
- ha-textfield,
407
- ha-icon-picker {
408
- margin-top: 8px;
409
- display: block;
410
- }
411
- ha-expansion-panel {
412
- display: block;
413
- --expansion-panel-content-padding: 0;
414
- border-radius: 6px;
415
- --ha-card-border-radius: 6px;
416
- }
417
- ha-expansion-panel .content {
418
- padding: 12px;
419
- }
420
- ha-expansion-panel > *[slot='header'] {
421
- margin: 0;
422
- font-size: inherit;
423
- font-weight: inherit;
424
- }
425
- ha-expansion-panel ha-svg-icon {
426
- color: var(--secondary-text-color);
427
- }
428
- .card-version {
429
- font-size: 12px;
430
- color: var(--secondary-text-color);
431
- padding: 8px 16px;
432
- text-align: center;
433
- margin-top: 8px;
434
- place-self: flex-end;
435
- display: flex;
436
- justify-content: center;
437
- align-items: center;
438
- }
439
- `}}e([Qe({attribute:!1})],bd.prototype,"hass",void 0),e([et()],bd.prototype,"_config",void 0),e([et()],bd.prototype,"_configEntities",void 0),customElements.get("extra-map-editor")||customElements.define("extra-map-editor",bd);var wd=Object.freeze({__proto__:null,ExtraMapEditor:bd});export{ap as CARD_VERSION,st as COLORS,lp as DARK_AVAILABLE_STYLES,hp as DEFAULT_HOURS_TO_SHOW,pp as DEFAULT_ZOOM,yd as EmcMap,_d as ExtraMapCard,ud as LOCAL_TIME_ZONE,up as STYLE_OPTIONS,sp as STYLE_SCHEMA,yp as baseMapConfigSchema,ct as computeObjectId,ht as computeStateName,ut as computeStateNameFromEntityAttributes,x as createResource,f as deleteConfig,w as deleteResource,_ as ensureBadgeConfig,R as entityIdHistoryNeedsAttributes,d as fetchConfig,B as fetchDateWS,v as fetchResources,n as findCardIndex,dt as findEntities,c as findLovelaceCards,l as findLovelaceContainer,C as fireEvent,dd as formatTimeWeekday,ld as getAddress,lt as getColorByIndex,sd as getEntityId,i as getLovelace,s as getLovelaceContainerPath,yt as hasConfigChanged,bt as hasConfigOrEntitiesChanged,xt as hasConfigOrEntityChanged,xd as hasLocation,t as isComponentLoaded,p as isStrategyDashboard,y as isStrategySection,g as isStrategyView,ft as isValidEntityId,_p as mapConfigSchema,o as parseLovelaceCardPath,a as parseLovelaceContainerPath,gt as processConfigEntities,vd as processEditorEntities,hd as resolveTimeZone,m as saveConfig,gp as singleMapConfingSchema,j as subscribeHistory,O as subscribeHistoryStatesTimeWindow,T as subscribeRenderTemplate,h as updateLovelaceCards,u as updateLovelaceContainer,b as updateResource,pd as useAmPm};