@mapvx/web-components 0.0.32 → 0.0.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{base-floor-selector-IDYKUTl3.cjs → base-floor-selector-_si0OaKV.cjs} +2 -2
- package/dist/cjs/{class-map-CGHo1D7M.cjs → class-map-CIFK_Nvk.cjs} +3 -3
- package/dist/cjs/{compact-floor-selector-Co8Y3T2c.cjs → compact-floor-selector-CjEWEJM8.cjs} +3 -3
- package/dist/cjs/{consume-BWIh7rxI.cjs → consume-BhigA9qa.cjs} +2 -2
- package/dist/cjs/{custom-map--UZ5N3Lg.cjs → custom-map-D3dQQyOb.cjs} +2 -2
- package/dist/cjs/{floor-selector-CNuGDuNc.cjs → floor-selector-DFyRRyAb.cjs} +3 -3
- package/dist/cjs/lazy-load-BE9-keHk.cjs +56 -0
- package/dist/cjs/map-view-with-modal.cjs +2 -2
- package/dist/cjs/{qr-modal-Dq7dOqh6.cjs → qr-modal-B4BqIRX4.cjs} +2 -2
- package/dist/cjs/{route-options-B45xnSu4.cjs → route-options-DQc0dugR.cjs} +4 -4
- package/dist/cjs/route-view-totems.cjs +2 -2
- package/dist/es/assets/{compact-floor-selector-BQ0lsGyg.js → compact-floor-selector-BTOhdipy.js} +2 -2
- package/dist/es/assets/{components-CNuu24gs.js → components-_AwIbCu4.js} +2 -2
- package/dist/es/assets/{map-view-with-modal-JX4bFkkK.js → map-view-with-modal-BP3m9mf6.js} +2 -2
- package/dist/es/assets/{route-view-totems-B-1OEdkb.js → route-view-totems-B9nWTUnc.js} +9 -9
- package/dist/es/assets/utils-DKJkAKFi.js +2 -0
- package/dist/es/index.js +1 -1
- package/dist/es/route-view-totems.js +1 -1
- package/dist/iife/map-view-with-modal.js +21 -21
- package/dist/iife/route-view-totems.js +24 -24
- package/dist/sw/mvx-tiles-sw.js +4 -4
- package/package.json +20 -16
- package/dist/cjs/lazy-load-Dy0Wc6yS.cjs +0 -56
- package/dist/es/assets/utils-DslQaI0J.js +0 -2
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @license
|
|
4
|
-
* Copyright 2019 Google LLC
|
|
5
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
|
-
*/const e=globalThis,t=e.ShadowRoot&&(void 0===e.ShadyCSS||e.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,r=Symbol(),i=new WeakMap;let n=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==r)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const r=this.t;if(t&&void 0===e){const t=void 0!==r&&1===r.length;t&&(e=i.get(r)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),t&&i.set(r,e))}return e}toString(){return this.cssText}};const o=e=>new n("string"==typeof e?e:e+"",void 0,r),a=t?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const r of e.cssRules)t+=r.cssText;return o(t)})(e):e,{is:s,defineProperty:l,getOwnPropertyDescriptor:c,getOwnPropertyNames:u,getOwnPropertySymbols:h,getPrototypeOf:d}=Object,p=globalThis,f=p.trustedTypes,m=f?f.emptyScript:"",g=p.reactiveElementPolyfillSupport,_=(e,t)=>e,y={toAttribute(e,t){switch(t){case Boolean:e=e?m:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=null!==e;break;case Number:r=null===e?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch(e){r=null}}return r}},v=(e,t)=>!s(e,t),b={attribute:!0,type:String,converter:y,reflect:!1,useDefault:!1,hasChanged:v};
|
|
7
|
-
/**
|
|
8
|
-
* @license
|
|
9
|
-
* Copyright 2017 Google LLC
|
|
10
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
|
-
*/Symbol.metadata??=Symbol("metadata"),p.litPropertyMetadata??=new WeakMap;let x=class 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=b){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const r=Symbol(),i=this.getPropertyDescriptor(e,r,t);void 0!==i&&l(this.prototype,e,i)}}static getPropertyDescriptor(e,t,r){const{get:i,set:n}=c(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:i,set(t){const o=i?.call(this);n?.call(this,t),this.requestUpdate(e,o,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??b}static _$Ei(){if(this.hasOwnProperty(_("elementProperties")))return;const e=d(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(_("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(_("properties"))){const e=this.properties,t=[...u(e),...h(e)];for(const r of t)this.createProperty(r,e[r])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,r]of t)this.elementProperties.set(e,r)}this._$Eh=new Map;for(const[t,r]of this.elementProperties){const e=this._$Eu(t,r);void 0!==e&&this._$Eh.set(e,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const r=new Set(e.flat(1/0).reverse());for(const e of r)t.unshift(a(e))}else void 0!==e&&t.push(a(e));return t}static _$Eu(e,t){const r=t.attribute;return!1===r?void 0:"string"==typeof r?r:"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 r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const r=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((r,i)=>{if(t)r.adoptedStyleSheets=i.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const t of i){const i=document.createElement("style"),n=e.litNonce;void 0!==n&&i.setAttribute("nonce",n),i.textContent=t.cssText,r.appendChild(i)}})(r,this.constructor.elementStyles),r}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,r){this._$AK(e,r)}_$ET(e,t){const r=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,r);if(void 0!==i&&!0===r.reflect){const n=(void 0!==r.converter?.toAttribute?r.converter:y).toAttribute(t,r.type);this._$Em=e,null==n?this.removeAttribute(i):this.setAttribute(i,n),this._$Em=null}}_$AK(e,t){const r=this.constructor,i=r._$Eh.get(e);if(void 0!==i&&this._$Em!==i){const e=r.getPropertyOptions(i),n="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:y;this._$Em=i;const o=n.fromAttribute(t,e.type);this[i]=o??this._$Ej?.get(i)??o,this._$Em=null}}requestUpdate(e,t,r){if(void 0!==e){const i=this.constructor,n=this[e];if(r??=i.getPropertyOptions(e),!((r.hasChanged??v)(n,t)||r.useDefault&&r.reflect&&n===this._$Ej?.get(e)&&!this.hasAttribute(i._$Eu(e,r))))return;this.C(e,t,r)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:r,reflect:i,wrapped:n},o){r&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,o??t??this[e]),!0!==n||void 0!==o)||(this._$AL.has(e)||(this.hasUpdated||r||(t=void 0),this._$AL.set(e,t)),!0===i&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){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,r]of e){const{wrapped:e}=r,i=this[t];!0!==e||this._$AL.has(t)||void 0===i||this.C(t,void 0,r,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._$EM()}catch(t){throw e=!1,this._$EM(),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)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};x.elementStyles=[],x.shadowRootOptions={mode:"open"},x[_("elementProperties")]=new Map,x[_("finalized")]=new Map,g?.({ReactiveElement:x}),(p.reactiveElementVersions??=[]).push("2.1.1");
|
|
12
|
-
/**
|
|
13
|
-
* @license
|
|
14
|
-
* Copyright 2017 Google LLC
|
|
15
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
16
|
-
*/
|
|
17
|
-
const w=globalThis,T=w.trustedTypes,S=T?T.createPolicy("lit-html",{createHTML:e=>e}):void 0,E="$lit$",I=`lit$${Math.random().toFixed(9).slice(2)}$`,P="?"+I,k=`<${P}>`,A=document,C=()=>A.createComment(""),M=e=>null===e||"object"!=typeof e&&"function"!=typeof e,D=Array.isArray,R="[ \t\n\f\r]",L=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,F=/-->/g,O=/>/g,z=RegExp(`>|${R}(?:([^\\s"'>=/]+)(${R}*=${R}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),B=/'/g,N=/"/g,j=/^(?:script|style|textarea|title)$/i,V=(e=>(t,...r)=>({_$litType$:e,strings:t,values:r}))(1),U=Symbol.for("lit-noChange"),G=Symbol.for("lit-nothing"),q=new WeakMap,$=A.createTreeWalker(A,129);function W(e,t){if(!D(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==S?S.createHTML(t):t}const Z=(e,t)=>{const r=e.length-1,i=[];let n,o=2===t?"<svg>":3===t?"<math>":"",a=L;for(let s=0;s<r;s++){const t=e[s];let r,l,c=-1,u=0;for(;u<t.length&&(a.lastIndex=u,l=a.exec(t),null!==l);)u=a.lastIndex,a===L?"!--"===l[1]?a=F:void 0!==l[1]?a=O:void 0!==l[2]?(j.test(l[2])&&(n=RegExp("</"+l[2],"g")),a=z):void 0!==l[3]&&(a=z):a===z?">"===l[0]?(a=n??L,c=-1):void 0===l[1]?c=-2:(c=a.lastIndex-l[2].length,r=l[1],a=void 0===l[3]?z:'"'===l[3]?N:B):a===N||a===B?a=z:a===F||a===O?a=L:(a=z,n=void 0);const h=a===z&&e[s+1].startsWith("/>")?" ":"";o+=a===L?t+k:c>=0?(i.push(r),t.slice(0,c)+E+t.slice(c)+I+h):t+I+(-2===c?s:h)}return[W(e,o+(e[r]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),i]};class H{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let n=0,o=0;const a=e.length-1,s=this.parts,[l,c]=Z(e,t);if(this.el=H.createElement(l,r),$.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(i=$.nextNode())&&s.length<a;){if(1===i.nodeType){if(i.hasAttributes())for(const e of i.getAttributeNames())if(e.endsWith(E)){const t=c[o++],r=i.getAttribute(e).split(I),a=/([.?@])?(.*)/.exec(t);s.push({type:1,index:n,name:a[2],strings:r,ctor:"."===a[1]?Q:"?"===a[1]?ee:"@"===a[1]?te:K}),i.removeAttribute(e)}else e.startsWith(I)&&(s.push({type:6,index:n}),i.removeAttribute(e));if(j.test(i.tagName)){const e=i.textContent.split(I),t=e.length-1;if(t>0){i.textContent=T?T.emptyScript:"";for(let r=0;r<t;r++)i.append(e[r],C()),$.nextNode(),s.push({type:2,index:++n});i.append(e[t],C())}}}else if(8===i.nodeType)if(i.data===P)s.push({type:2,index:n});else{let e=-1;for(;-1!==(e=i.data.indexOf(I,e+1));)s.push({type:7,index:n}),e+=I.length-1}n++}}static createElement(e,t){const r=A.createElement("template");return r.innerHTML=e,r}}function X(e,t,r=e,i){if(t===U)return t;let n=void 0!==i?r._$Co?.[i]:r._$Cl;const o=M(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,r,i)),void 0!==i?(r._$Co??=[])[i]=n:r._$Cl=n),void 0!==n&&(t=X(e,n._$AS(e,t.values),n,i)),t}class Y{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:r}=this._$AD,i=(e?.creationScope??A).importNode(t,!0);$.currentNode=i;let n=$.nextNode(),o=0,a=0,s=r[0];for(;void 0!==s;){if(o===s.index){let t;2===s.type?t=new J(n,n.nextSibling,this,e):1===s.type?t=new s.ctor(n,s.name,s.strings,this,e):6===s.type&&(t=new re(n,this,e)),this._$AV.push(t),s=r[++a]}o!==s?.index&&(n=$.nextNode(),o++)}return $.currentNode=A,i}p(e){let t=0;for(const r of this._$AV)void 0!==r&&(void 0!==r.strings?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}}class J{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,i){this.type=2,this._$AH=G,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=i,this._$Cv=i?.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=X(this,e,t),M(e)?e===G||null==e||""===e?(this._$AH!==G&&this._$AR(),this._$AH=G):e!==this._$AH&&e!==U&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>D(e)||"function"==typeof e?.[Symbol.iterator])(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!==G&&M(this._$AH)?this._$AA.nextSibling.data=e:this.T(A.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:r}=e,i="number"==typeof r?this._$AC(e):(void 0===r.el&&(r.el=H.createElement(W(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(t);else{const e=new Y(i,this),r=e.u(this.options);e.p(t),this.T(r),this._$AH=e}}_$AC(e){let t=q.get(e.strings);return void 0===t&&q.set(e.strings,t=new H(e)),t}k(e){D(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let r,i=0;for(const n of e)i===t.length?t.push(r=new J(this.O(C()),this.O(C()),this,this.options)):r=t[i],r._$AI(n),i++;i<t.length&&(this._$AR(r&&r._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}class K{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,i,n){this.type=1,this._$AH=G,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=n,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=G}_$AI(e,t=this,r,i){const n=this.strings;let o=!1;if(void 0===n)e=X(this,e,t,0),o=!M(e)||e!==this._$AH&&e!==U,o&&(this._$AH=e);else{const i=e;let a,s;for(e=n[0],a=0;a<n.length-1;a++)s=X(this,i[r+a],t,a),s===U&&(s=this._$AH[a]),o||=!M(s)||s!==this._$AH[a],s===G?e=G:e!==G&&(e+=(s??"")+n[a+1]),this._$AH[a]=s}o&&!i&&this.j(e)}j(e){e===G?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class Q extends K{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===G?void 0:e}}class ee extends K{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==G)}}class te extends K{constructor(e,t,r,i,n){super(e,t,r,i,n),this.type=5}_$AI(e,t=this){if((e=X(this,e,t,0)??G)===U)return;const r=this._$AH,i=e===G&&r!==G||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,n=e!==G&&(r===G||i);i&&this.element.removeEventListener(this.name,this,r),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)}}class re{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){X(this,e)}}const ie=w.litHtmlPolyfillSupport;ie?.(H,J),(w.litHtmlVersions??=[]).push("3.3.1");const ne=globalThis;
|
|
18
|
-
/**
|
|
19
|
-
* @license
|
|
20
|
-
* Copyright 2017 Google LLC
|
|
21
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
22
|
-
*/let oe=class extends x{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=((e,t,r)=>{const i=r?.renderBefore??t;let n=i._$litPart$;if(void 0===n){const e=r?.renderBefore??null;i._$litPart$=n=new J(t.insertBefore(C(),e),e,void 0,r??{})}return n._$AI(e),n})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return U}};oe._$litElement$=!0,oe.finalized=!0,ne.litElementHydrateSupport?.({LitElement:oe});const ae=ne.litElementPolyfillSupport;ae?.({LitElement:oe}),(ne.litElementVersions??=[]).push("4.2.1");
|
|
23
|
-
/**
|
|
24
|
-
* @license
|
|
25
|
-
* Copyright 2017 Google LLC
|
|
26
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
|
-
*/
|
|
28
|
-
const se={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:v},le=(e=se,t,r)=>{const{kind:i,metadata:n}=r;let o=globalThis.litPropertyMetadata.get(n);if(void 0===o&&globalThis.litPropertyMetadata.set(n,o=new Map),"setter"===i&&((e=Object.create(e)).wrapped=!0),o.set(r.name,e),"accessor"===i){const{name:i}=r;return{set(r){const n=t.get.call(this);t.set.call(this,r),this.requestUpdate(i,n,e)},init(t){return void 0!==t&&this.C(i,void 0,e,t),t}}}if("setter"===i){const{name:i}=r;return function(r){const n=this[i];t.call(this,r),this.requestUpdate(i,n,e)}}throw Error("Unsupported decorator location: "+i)};
|
|
29
|
-
/**
|
|
30
|
-
* @license
|
|
31
|
-
* Copyright 2017 Google LLC
|
|
32
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
33
|
-
*/
|
|
34
|
-
/**
|
|
35
|
-
* @license
|
|
36
|
-
* Copyright 2021 Google LLC
|
|
37
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
38
|
-
*/
|
|
39
|
-
let ce=class extends Event{constructor(e,t,r,i){super("context-request",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t,this.callback=r,this.subscribe=i??!1}};
|
|
40
|
-
/**
|
|
41
|
-
* @license
|
|
42
|
-
* Copyright 2021 Google LLC
|
|
43
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
44
|
-
*/
|
|
45
|
-
/**
|
|
46
|
-
* @license
|
|
47
|
-
* Copyright 2021 Google LLC
|
|
48
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
49
|
-
*/
|
|
50
|
-
class ue{get value(){return this.o}set value(e){this.setValue(e)}setValue(e,t=!1){const r=t||!Object.is(e,this.o);this.o=e,r&&this.updateObservers()}constructor(e){this.subscriptions=new Map,this.updateObservers=()=>{for(const[e,{disposer:t}]of this.subscriptions)e(this.o,t)},void 0!==e&&(this.value=e)}addCallback(e,t,r){if(!r)return void e(this.value);this.subscriptions.has(e)||this.subscriptions.set(e,{disposer:()=>{this.subscriptions.delete(e)},consumerHost:t});const{disposer:i}=this.subscriptions.get(e);e(this.value,i)}clearCallbacks(){this.subscriptions.clear()}}
|
|
51
|
-
/**
|
|
52
|
-
* @license
|
|
53
|
-
* Copyright 2021 Google LLC
|
|
54
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
55
|
-
*/class he extends Event{constructor(e,t){super("context-provider",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t}}class de extends ue{constructor(e,t,r){super(void 0!==t.context?t.initialValue:r),this.onContextRequest=e=>{if(e.context!==this.context)return;const t=e.contextTarget??e.composedPath()[0];t!==this.host&&(e.stopPropagation(),this.addCallback(e.callback,t,e.subscribe))},this.onProviderRequest=e=>{if(e.context!==this.context)return;if((e.contextTarget??e.composedPath()[0])===this.host)return;const t=new Set;for(const[r,{consumerHost:i}]of this.subscriptions)t.has(r)||(t.add(r),i.dispatchEvent(new ce(this.context,i,r,!0)));e.stopPropagation()},this.host=e,void 0!==t.context?this.context=t.context:this.context=t,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new he(this.context,this.host))}}var pe,fe,me={exports:{}},ge={exports:{}};function _e(){return pe||(pe=1,ge.exports=function(){var e={},t={};function r(r,i,n){if(t[r]=n,"index"===r){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 r("shared",["exports"],function(e){function t(e,t,r,i){return new(r||(r=Promise))(function(n,o){function a(e){try{l(i.next(e))}catch(e){o(e)}}function s(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,s)}l((i=i.apply(e,t||[])).next())})}function r(e,t){this.x=e,this.y=t}function i(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var n,o;"function"==typeof SuppressedError&&SuppressedError,r.prototype={clone(){return new r(this.x,this.y)},add(e){return this.clone()._add(e)},sub(e){return this.clone()._sub(e)},multByPoint(e){return this.clone()._multByPoint(e)},divByPoint(e){return this.clone()._divByPoint(e)},mult(e){return this.clone()._mult(e)},div(e){return this.clone()._div(e)},rotate(e){return this.clone()._rotate(e)},rotateAround(e,t){return this.clone()._rotateAround(e,t)},matMult(e){return this.clone()._matMult(e)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(e){return this.x===e.x&&this.y===e.y},dist(e){return Math.sqrt(this.distSqr(e))},distSqr(e){const t=e.x-this.x,r=e.y-this.y;return t*t+r*r},angle(){return Math.atan2(this.y,this.x)},angleTo(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith(e){return this.angleWithSep(e.x,e.y)},angleWithSep(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult(e){const 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(e){return this.x+=e.x,this.y+=e.y,this},_sub(e){return this.x-=e.x,this.y-=e.y,this},_mult(e){return this.x*=e,this.y*=e,this},_div(e){return this.x/=e,this.y/=e,this},_multByPoint(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint(e){return this.x/=e.x,this.y/=e.y,this},_unit(){return this._div(this.mag()),this},_perp(){const e=this.y;return this.y=this.x,this.x=-e,this},_rotate(e){const t=Math.cos(e),r=Math.sin(e),i=r*this.x+t*this.y;return this.x=t*this.x-r*this.y,this.y=i,this},_rotateAround(e,t){const r=Math.cos(e),i=Math.sin(e),n=t.y+i*(this.x-t.x)+r*(this.y-t.y);return this.x=t.x+r*(this.x-t.x)-i*(this.y-t.y),this.y=n,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:r},r.convert=function(e){if(e instanceof r)return e;if(Array.isArray(e))return new r(+e[0],+e[1]);if(void 0!==e.x&&void 0!==e.y)return new r(+e.x,+e.y);throw new Error("Expected [x, y] or {x, y} point format")};var a=function(){if(o)return n;function e(e,t,r,i){this.cx=3*e,this.bx=3*(r-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(i-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=r,this.p2y=i}return o=1,n=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 r=e,i=0;i<8;i++){var n=this.sampleCurveX(r)-e;if(Math.abs(n)<t)return r;var o=this.sampleCurveDerivativeX(r);if(Math.abs(o)<1e-6)break;r-=n/o}var a=0,s=1;for(r=e,i=0;i<20&&(n=this.sampleCurveX(r),!(Math.abs(n-e)<t));i++)e>n?a=r:s=r,r=.5*(s-a)+a;return r},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},n}(),s=i(a);let l,c;function u(){return null==l&&(l="undefined"!=typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),l}function h(){if(null==c&&(c=!1,u())){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 r=t.getImageData(0,0,e,e).data;for(let t=0;t<e*e*4;t++)if(t%4!=3&&r[t]!==t){c=!0;break}}}return c||!1}var d=1e-6,p="undefined"!=typeof Float32Array?Float32Array:Array;function f(){var e=new p(9);return p!=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 m(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 g(){var e=new p(3);return p!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function _(e){var t=e[0],r=e[1],i=e[2];return Math.sqrt(t*t+r*r+i*i)}function y(e,t,r){var i=new p(3);return i[0]=e,i[1]=t,i[2]=r,i}function v(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e}function b(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e}function x(e,t,r){var i=t[0],n=t[1],o=t[2],a=r[0],s=r[1],l=r[2];return e[0]=n*l-o*s,e[1]=o*a-i*l,e[2]=i*s-n*a,e}var w,T=_;function S(e,t,r){var i=t[0],n=t[1],o=t[2],a=t[3];return e[0]=r[0]*i+r[4]*n+r[8]*o+r[12]*a,e[1]=r[1]*i+r[5]*n+r[9]*o+r[13]*a,e[2]=r[2]*i+r[6]*n+r[10]*o+r[14]*a,e[3]=r[3]*i+r[7]*n+r[11]*o+r[15]*a,e}function E(){var e=new p(4);return p!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function I(e,t,r,i){var n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"zyx",o=Math.PI/360;t*=o,i*=o,r*=o;var a=Math.sin(t),s=Math.cos(t),l=Math.sin(r),c=Math.cos(r),u=Math.sin(i),h=Math.cos(i);switch(n){case"xyz":e[0]=a*c*h+s*l*u,e[1]=s*l*h-a*c*u,e[2]=s*c*u+a*l*h,e[3]=s*c*h-a*l*u;break;case"xzy":e[0]=a*c*h-s*l*u,e[1]=s*l*h-a*c*u,e[2]=s*c*u+a*l*h,e[3]=s*c*h+a*l*u;break;case"yxz":e[0]=a*c*h+s*l*u,e[1]=s*l*h-a*c*u,e[2]=s*c*u-a*l*h,e[3]=s*c*h+a*l*u;break;case"yzx":e[0]=a*c*h+s*l*u,e[1]=s*l*h+a*c*u,e[2]=s*c*u-a*l*h,e[3]=s*c*h-a*l*u;break;case"zxy":e[0]=a*c*h-s*l*u,e[1]=s*l*h+a*c*u,e[2]=s*c*u+a*l*h,e[3]=s*c*h-a*l*u;break;case"zyx":e[0]=a*c*h-s*l*u,e[1]=s*l*h+a*c*u,e[2]=s*c*u-a*l*h,e[3]=s*c*h+a*l*u;break;default:throw new Error("Unknown angle order "+n)}return e}function P(){var e=new p(2);return p!=Float32Array&&(e[0]=0,e[1]=0),e}function k(e,t){var r=new p(2);return r[0]=e,r[1]=t,r}g(),w=new p(4),p!=Float32Array&&(w[0]=0,w[1]=0,w[2]=0,w[3]=0),g(),y(1,0,0),y(0,1,0),E(),E(),f(),P();const A=8192;function C(e,t,r){return t*(A/(e.tileSize*Math.pow(2,r-e.tileID.overscaledZ)))}function M(e,t){return(e%t+t)%t}function D(e,t,r){return e*(1-r)+t*r}function R(e){if(e<=0)return 0;if(e>=1)return 1;const t=e*e,r=t*e;return 4*(e<.5?r:3*(e-t)+r-.75)}function L(e,t,r,i){const n=new s(e,t,r,i);return e=>n.solve(e)}const F=L(.25,.1,.25,1);function O(e,t,r){return Math.min(r,Math.max(t,e))}function z(e,t,r){const i=r-t,n=((e-t)%i+i)%i+t;return n===t?r:n}function B(e,...t){for(const r of t)for(const t in r)e[t]=r[t];return e}let N=1;function j(e,t,r){const i={};for(const n in e)i[n]=t.call(this,e[n],n,e);return i}function V(e,t,r){const i={};for(const n in e)t.call(this,e[n],n,e)&&(i[n]=e[n]);return i}function U(e){return Array.isArray(e)?e.map(U):"object"==typeof e&&e?j(e,U):e}const G={};function q(e){G[e]||("undefined"!=typeof console&&console.warn(e),G[e]=!0)}function $(e,t,r){return(r.y-e.y)*(t.x-e.x)>(t.y-e.y)*(r.x-e.x)}function W(e){return"undefined"!=typeof WorkerGlobalScope&&void 0!==e&&e instanceof WorkerGlobalScope}let Z=null;function H(e){return"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap}const X="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Y(e,r,i,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,r,i,n){const o=4*Math.max(-t,0),a=(Math.max(0,r)-r)*i*4+o,s=4*i,l=Math.max(0,t),c=Math.max(0,r);return{rect:{x:l,y:c,width:Math.min(e.width,t+i)-l,height:Math.min(e.height,r+n)-c},layout:[{offset:a,stride:s}]}}(e,r,i,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 J,K;function Q(e,t,r,i){return e.addEventListener(t,r,i),{unsubscribe:()=>{e.removeEventListener(t,r,i)}}}function ee(e){return e*Math.PI/180}function te(e){return e/Math.PI*180}const re={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},ie={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},ne="AbortError";function oe(){return new Error(ne)}const ae={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function se(e){return ae.REGISTERED_PROTOCOLS[e.substring(0,e.indexOf("://"))]}const le="global-dispatcher";class ce extends Error{constructor(e,t,r,i){super(`AJAXError: ${t} (${e}): ${r}`),this.status=e,this.statusText=t,this.url=r,this.body=i}}const ue=()=>W(self)?self.worker&&self.worker.referrer:("blob:"===window.location.protocol?window.parent:window).location.href,he=function(e,r){if(/:\/\//.test(e.url)&&!/^https?:|^file:/.test(e.url)){const t=se(e.url);if(t)return t(e,r);if(W(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:e,targetMapId:le},r)}if(!(/^file:/.test(i=e.url)||/^file:/.test(ue())&&!/^\w+:/.test(i))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(e,r){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:ue(),signal:r.signal});let i,n;"json"!==e.type||t.headers.has("Accept")||t.headers.set("Accept","application/json");try{i=yield fetch(t)}catch(t){throw new ce(0,t.message,e.url,new Blob)}if(!i.ok){const t=yield i.blob();throw new ce(i.status,i.statusText,e.url,t)}n="arrayBuffer"===e.type||"image"===e.type?i.arrayBuffer():"json"===e.type?i.json():i.text();const o=yield n;if(r.signal.aborted)throw oe();return{data:o,cacheControl:i.headers.get("Cache-Control"),expires:i.headers.get("Expires")}})}(e,r);if(W(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:e,mustQueue:!0,targetMapId:le},r)}var i;return function(e,t){return new Promise((r,i)=>{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=()=>{i(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 i(e)}r({data:t,cacheControl:o.getResponseHeader("Cache-Control"),expires:o.getResponseHeader("Expires")})}else{const t=new Blob([o.response],{type:o.getResponseHeader("Content-Type")});i(new ce(o.status,o.statusText,e.url,t))}},t.signal.addEventListener("abort",()=>{o.abort(),i(oe())}),o.send(e.body)})}(e,r)};function de(e){if(!e||e.indexOf("://")<=0||0===e.indexOf("data:image/")||0===e.indexOf("blob:"))return!0;const t=new URL(e),r=window.location;return t.protocol===r.protocol&&t.host===r.host}function pe(e,t,r){r[e]&&-1!==r[e].indexOf(t)||(r[e]=r[e]||[],r[e].push(t))}function fe(e,t,r){if(r&&r[e]){const i=r[e].indexOf(t);-1!==i&&r[e].splice(i,1)}}class me{constructor(e,t={}){B(this,t),this.type=e}}class ge extends me{constructor(e,t={}){super("error",B({error:e},t))}}class _e{on(e,t){return this._listeners=this._listeners||{},pe(e,t,this._listeners),{unsubscribe:()=>{this.off(e,t)}}}off(e,t){return fe(e,t,this._listeners),fe(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners=this._oneTimeListeners||{},pe(e,t,this._oneTimeListeners),this):new Promise(t=>this.once(e,t))}fire(e,t){"string"==typeof e&&(e=new me(e,t||{}));const r=e.type;if(this.listens(r)){e.target=this;const t=this._listeners&&this._listeners[r]?this._listeners[r].slice():[];for(const r of t)r.call(this,e);const i=this._oneTimeListeners&&this._oneTimeListeners[r]?this._oneTimeListeners[r].slice():[];for(const o of i)fe(r,o,this._oneTimeListeners),o.call(this,e);const n=this._eventedParent;n&&(B(e,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),n.fire(e))}else e instanceof ge&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}}var ye={$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"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"array",value:"fontFaces"},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},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{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:{},"color-relief":{},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_color-relief","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"}},"layout_color-relief":{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_color-relief","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","feature"]},"property-type":"cross-faded-data-driven"},"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:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,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:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",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"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"}},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 ve=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function be(e,t){const r={};for(const i in e)"ref"!==i&&(r[i]=e[i]);return ve.forEach(e=>{e in t&&(r[e]=t[e])}),r}function xe(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!xe(e[r],t[r]))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 r in e)if(!xe(e[r],t[r]))return!1;return!0}return e===t}function we(e,t){e.push(t)}function Te(e,t,r){we(r,{command:"addSource",args:[e,t[e]]})}function Se(e,t,r){we(t,{command:"removeSource",args:[e]}),r[e]=!0}function Ee(e,t,r,i){Se(e,r,i),Te(e,t,r)}function Ie(e,t,r){let i;for(i in e[r])if(Object.prototype.hasOwnProperty.call(e[r],i)&&"data"!==i&&!xe(e[r][i],t[r][i]))return!1;for(i in t[r])if(Object.prototype.hasOwnProperty.call(t[r],i)&&"data"!==i&&!xe(e[r][i],t[r][i]))return!1;return!0}function Pe(e,t,r,i,n,o){e=e||{},t=t||{};for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(xe(e[a],t[a])||r.push({command:o,args:[i,a,t[a],n]}));for(const a in t)Object.prototype.hasOwnProperty.call(t,a)&&!Object.prototype.hasOwnProperty.call(e,a)&&(xe(e[a],t[a])||r.push({command:o,args:[i,a,t[a],n]}))}function ke(e){return e.id}function Ae(e,t){return e[t.id]=t,e}class Ce{constructor(e,t,r,i){this.message=(e?`${e}: `:"")+r,i&&(this.identifier=i),null!=t&&t.__line__&&(this.line=t.__line__)}}function Me(e,...t){for(const r of t)for(const t in r)e[t]=r[t];return e}class De extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class Re{constructor(e,t=[]){this.parent=e,this.bindings={};for(const[r,i]of t)this.bindings[r]=i}concat(e){return new Re(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 Le={kind:"null"},Fe={kind:"number"},Oe={kind:"string"},ze={kind:"boolean"},Be={kind:"color"},Ne={kind:"projectionDefinition"},je={kind:"object"},Ve={kind:"value"},Ue={kind:"collator"},Ge={kind:"formatted"},qe={kind:"padding"},$e={kind:"colorArray"},We={kind:"numberArray"},Ze={kind:"resolvedImage"},He={kind:"variableAnchorOffsetCollection"};function Xe(e,t){return{kind:"array",itemType:e,N:t}}function Ye(e){if("array"===e.kind){const t=Ye(e.itemType);return"number"==typeof e.N?`array<${t}, ${e.N}>`:"value"===e.itemType.kind?"array":`array<${t}>`}return e.kind}const Je=[Le,Fe,Oe,ze,Be,Ne,Ge,je,Xe(Ve),qe,We,$e,Ze,He];function Ke(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!Ke(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 Je)if(!Ke(e,t))return null}return`Expected ${Ye(e)} but found ${Ye(t)} instead.`}function Qe(e,t){return t.some(t=>t.kind===e.kind)}function et(e,t){return t.some(t=>"null"===t?null===e:"array"===t?Array.isArray(e):"object"===t?e&&!Array.isArray(e)&&"object"==typeof e:t===typeof e)}function tt(e,t){return"array"===e.kind&&"array"===t.kind?e.itemType.kind===t.itemType.kind&&"number"==typeof e.N:e.kind===t.kind}const rt=.96422,it=.82521,nt=4/29,ot=6/29,at=3*ot*ot,st=ot*ot*ot,lt=Math.PI/180,ct=180/Math.PI;function ut(e){return(e%=360)<0&&(e+=360),e}function ht([e,t,r,i]){let n,o;const a=pt((.2225045*(e=dt(e))+.7168786*(t=dt(t))+.0606169*(r=dt(r)))/1);e===t&&t===r?n=o=a:(n=pt((.4360747*e+.3850649*t+.1430804*r)/rt),o=pt((.0139322*e+.0971045*t+.7141733*r)/it));const s=116*a-16;return[s<0?0:s,500*(n-a),200*(a-o),i]}function dt(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function pt(e){return e>st?Math.pow(e,1/3):e/at+nt}function ft([e,t,r,i]){let n=(e+16)/116,o=isNaN(t)?n:n+t/500,a=isNaN(r)?n:n-r/200;return n=1*gt(n),o=rt*gt(o),a=it*gt(a),[mt(3.1338561*o-1.6168667*n-.4906146*a),mt(-.9787684*o+1.9161415*n+.033454*a),mt(.0719453*o-.2289914*n+1.4052427*a),i]}function mt(e){return(e=e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055)<0?0:e>1?1:e}function gt(e){return e>ot?e*e*e:at*(e-nt)}const _t=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function yt(e,t){return _t(e,t)?e[t]:void 0}function vt(e){return parseInt(e.padEnd(2,e),16)/255}function bt(e,t){return xt(t?e/100:e,0,1)}function xt(e,t,r){return Math.min(Math.max(t,e),r)}function wt(e){return!e.some(Number.isNaN)}const Tt={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 St(e,t,r){return e+r*(t-e)}function Et(e,t,r){return e.map((e,i)=>St(e,t[i],r))}class It{constructor(e,t,r,i=1,n=!0){this.r=e,this.g=t,this.b=r,this.a=i,n||(this.r*=i,this.g*=i,this.b*=i,i||this.overwriteGetter("rgb",[e,t,r,i]))}static parse(e){if(e instanceof It)return e;if("string"!=typeof e)return;const t=function(e){if("transparent"===(e=e.toLowerCase().trim()))return[0,0,0,0];const t=yt(Tt,e);if(t){const[e,r,i]=t;return[e/255,r/255,i/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 r=1;return[vt(e.slice(r,r+=t)),vt(e.slice(r,r+=t)),vt(e.slice(r,r+=t)),vt(e.slice(r,r+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,r,i,n,o,a,s,l,c,u,h,d]=t,p=[n||" ",s||" ",u].join("");if(" "===p||" /"===p||",,"===p||",,,"===p){const e=[i,a,c].join(""),t="%%%"===e?100:""===e?255:0;if(t){const e=[xt(+r/t,0,1),xt(+o/t,0,1),xt(+l/t,0,1),h?bt(+h,d):1];if(wt(e))return e}}return}}const r=e.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(r){const[e,t,i,n,o,a,s,l,c]=r,u=[i||" ",o||" ",s].join("");if(" "===u||" /"===u||",,"===u||",,,"===u){const e=[+t,xt(+n,0,100),xt(+a,0,100),l?bt(+l,c):1];if(wt(e))return function([e,t,r,i]){function n(i){const n=(i+e/30)%12,o=t*Math.min(r,1-r);return r-o*Math.max(-1,Math.min(n-3,9-n,1))}return e=ut(e),t/=100,r/=100,[n(0),n(8),n(4),i]}(e)}}}(e);return t?new It(...t,!1):void 0}get rgb(){const{r:e,g:t,b:r,a:i}=this,n=i||1/0;return this.overwriteGetter("rgb",[e/n,t/n,r/n,i])}get hcl(){return this.overwriteGetter("hcl",function(e){const[t,r,i,n]=ht(e),o=Math.sqrt(r*r+i*i);return[Math.round(1e4*o)?ut(Math.atan2(i,r)*ct):NaN,o,t,n]}(this.rgb))}get lab(){return this.overwriteGetter("lab",ht(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){const[e,t,r,i]=this.rgb;return`rgba(${[e,t,r].map(e=>Math.round(255*e)).join(",")},${i})`}static interpolate(e,t,r,i="rgb"){switch(i){case"rgb":{const[i,n,o,a]=Et(e.rgb,t.rgb,r);return new It(i,n,o,a,!1)}case"hcl":{const[i,n,o,a]=e.hcl,[s,l,c,u]=t.hcl;let h,d;if(isNaN(i)||isNaN(s))isNaN(i)?isNaN(s)?h=NaN:(h=s,1!==o&&0!==o||(d=l)):(h=i,1!==c&&0!==c||(d=n));else{let e=s-i;s>i&&e>180?e-=360:s<i&&i-s>180&&(e+=360),h=i+r*e}const[p,f,m,g]=function([e,t,r,i]){return e=isNaN(e)?0:e*lt,ft([r,Math.cos(e)*t,Math.sin(e)*t,i])}([h,null!=d?d:St(n,l,r),St(o,c,r),St(a,u,r)]);return new It(p,f,m,g,!1)}case"lab":{const[i,n,o,a]=ft(Et(e.lab,t.lab,r));return new It(i,n,o,a,!1)}}}}It.black=new It(0,0,0,1),It.white=new It(1,1,1,1),It.transparent=new It(0,0,0,0),It.red=new It(1,0,0,1);class Pt{constructor(e,t,r){this.sensitivity=e?t?"variant":"case":t?"accent":"base",this.locale=r,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 kt=["bottom","center","top"];class At{constructor(e,t,r,i,n,o){this.text=e,this.image=t,this.scale=r,this.fontStack=i,this.textColor=n,this.verticalAlign=o}}class Ct{constructor(e){this.sections=e}static fromString(e){return new Ct([new At(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 Ct?e:Ct.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map(e=>e.text).join("")}}class Mt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Mt)return e;if("number"==typeof e)return new Mt([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 Mt(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,r){return new Mt(Et(e.values,t.values,r))}}class Dt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Dt)return e;if("number"==typeof e)return new Dt([e]);if(Array.isArray(e)){for(const t of e)if("number"!=typeof t)return;return new Dt(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,r){return new Dt(Et(e.values,t.values,r))}}class Rt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Rt)return e;if("string"==typeof e){const t=It.parse(e);if(!t)return;return new Rt([t])}if(!Array.isArray(e))return;const t=[];for(const r of e){if("string"!=typeof r)return;const e=It.parse(r);if(!e)return;t.push(e)}return new Rt(t)}toString(){return JSON.stringify(this.values)}static interpolate(e,t,r,i="rgb"){const n=[];if(e.values.length!=t.values.length)throw new Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${t.values.length}), cannot interpolate.`);for(let o=0;o<e.values.length;o++)n.push(It.interpolate(e.values[o],t.values[o],r,i));return new Rt(n)}}class Lt extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}}const Ft=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Ot{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Ot)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let t=0;t<e.length;t+=2){const r=e[t],i=e[t+1];if("string"!=typeof r||!Ft.has(r))return;if(!Array.isArray(i)||2!==i.length||"number"!=typeof i[0]||"number"!=typeof i[1])return}return new Ot(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,r){const i=e.values,n=t.values;if(i.length!==n.length)throw new Lt(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${t.toString()}`);const o=[];for(let a=0;a<i.length;a+=2){if(i[a]!==n[a])throw new Lt(`Cannot interpolate values containing mismatched anchors. from[${a}]: ${i[a]}, to[${a}]: ${n[a]}`);o.push(i[a]);const[e,t]=i[a+1],[s,l]=n[a+1];o.push([St(e,s,r),St(t,l,r)])}return new Ot(o)}}class zt{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new zt({name:e,available:!1}):null}}class Bt{constructor(e,t,r){this.from=e,this.to=t,this.transition=r}static interpolate(e,t,r){return new Bt(e,t,r)}static parse(e){return e instanceof Bt?e:Array.isArray(e)&&3===e.length&&"string"==typeof e[0]&&"string"==typeof e[1]&&"number"==typeof e[2]?new Bt(e[0],e[1],e[2]):"object"==typeof e&&"string"==typeof e.from&&"string"==typeof e.to&&"number"==typeof e.transition?new Bt(e.from,e.to,e.transition):"string"==typeof e?new Bt(e,e,1):void 0}}function Nt(e,t,r,i){return"number"==typeof e&&e>=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===i||"number"==typeof i&&i>=0&&i<=1?null:`Invalid rgba value [${[e,t,r,i].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof i?[e,t,r,i]:[e,t,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function jt(e){if(null===e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||e instanceof Bt||e instanceof It||e instanceof Pt||e instanceof Ct||e instanceof Mt||e instanceof Dt||e instanceof Rt||e instanceof Ot||e instanceof zt)return!0;if(Array.isArray(e)){for(const t of e)if(!jt(t))return!1;return!0}if("object"==typeof e){for(const t in e)if(!jt(e[t]))return!1;return!0}return!1}function Vt(e){if(null===e)return Le;if("string"==typeof e)return Oe;if("boolean"==typeof e)return ze;if("number"==typeof e)return Fe;if(e instanceof It)return Be;if(e instanceof Bt)return Ne;if(e instanceof Pt)return Ue;if(e instanceof Ct)return Ge;if(e instanceof Mt)return qe;if(e instanceof Dt)return We;if(e instanceof Rt)return $e;if(e instanceof Ot)return He;if(e instanceof zt)return Ze;if(Array.isArray(e)){const t=e.length;let r;for(const i of e){const e=Vt(i);if(r){if(r===e)continue;r=Ve;break}r=e}return Xe(r||Ve,t)}return je}function Ut(e){const t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof It||e instanceof Bt||e instanceof Ct||e instanceof Mt||e instanceof Dt||e instanceof Rt||e instanceof Ot||e instanceof zt?e.toString():JSON.stringify(e)}class Gt{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(!jt(e[1]))return t.error("invalid value");const r=e[1];let i=Vt(r);const n=t.expectedType;return"array"!==i.kind||0!==i.N||!n||"array"!==n.kind||"number"==typeof n.N&&0!==n.N||(i=n),new Gt(i,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const qt={string:Oe,number:Fe,boolean:ze,object:je};class $t{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 r,i=1;const n=e[0];if("array"===n){let n,o;if(e.length>2){const r=e[1];if("string"!=typeof r||!(r in qt)||"object"===r)return t.error('The item type argument of "array" must be one of string, number, boolean',1);n=qt[r],i++}else n=Ve;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],i++}r=Xe(n,o)}else{if(!qt[n])throw new Error(`Types doesn't contain name = ${n}`);r=qt[n]}const o=[];for(;i<e.length;i++){const r=t.parse(e[i],i,Ve);if(!r)return null;o.push(r)}return new $t(r,o)}evaluate(e){for(let t=0;t<this.args.length;t++){const r=this.args[t].evaluate(e);if(!Ke(this.type,Vt(r)))return r;if(t===this.args.length-1)throw new Lt(`Expected value to be of type ${Ye(this.type)}, but found ${Ye(Vt(r))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const Wt={"to-boolean":ze,"to-color":Be,"to-number":Fe,"to-string":Oe};class Zt{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 r=e[0];if(!Wt[r])throw new Error(`Can't parse ${r} as it is not part of the known types`);if(("to-boolean"===r||"to-string"===r)&&2!==e.length)return t.error("Expected one argument.");const i=Wt[r],n=[];for(let o=1;o<e.length;o++){const r=t.parse(e[o],o,Ve);if(!r)return null;n.push(r)}return new Zt(i,n)}evaluate(e){switch(this.type.kind){case"boolean":return Boolean(this.args[0].evaluate(e));case"color":{let t,r;for(const i of this.args){if(t=i.evaluate(e),r=null,t instanceof It)return t;if("string"==typeof t){const r=e.parseColor(t);if(r)return r}else if(Array.isArray(t)&&(r=t.length<3||t.length>4?`Invalid rgba value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:Nt(t[0],t[1],t[2],t[3]),!r))return new It(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new Lt(r||`Could not parse color from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"padding":{let t;for(const r of this.args){t=r.evaluate(e);const i=Mt.parse(t);if(i)return i}throw new Lt(`Could not parse padding from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"numberArray":{let t;for(const r of this.args){t=r.evaluate(e);const i=Dt.parse(t);if(i)return i}throw new Lt(`Could not parse numberArray from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"colorArray":{let t;for(const r of this.args){t=r.evaluate(e);const i=Rt.parse(t);if(i)return i}throw new Lt(`Could not parse colorArray from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"variableAnchorOffsetCollection":{let t;for(const r of this.args){t=r.evaluate(e);const i=Ot.parse(t);if(i)return i}throw new Lt(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"number":{let t=null;for(const r of this.args){if(t=r.evaluate(e),null===t)return 0;const i=Number(t);if(!isNaN(i))return i}throw new Lt(`Could not convert ${JSON.stringify(t)} to number.`)}case"formatted":return Ct.fromString(Ut(this.args[0].evaluate(e)));case"resolvedImage":return zt.fromString(Ut(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return Ut(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const Ht=["Unknown","Point","LineString","Polygon"];class Xt{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,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?Ht[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let t=this._parseColorCache.get(e);return t||(t=It.parse(e),this._parseColorCache.set(e,t)),t}}class Yt{constructor(e,t,r=[],i,n=new Re,o=[]){this.registry=e,this.path=r,this.key=r.map(e=>`[${e}]`).join(""),this.scope=n,this.errors=o,this.expectedType=i,this._isConstant=t}parse(e,t,r,i,n={}){return t?this.concat(t,r,i)._parse(e,n):this._parse(e,n)}_parse(e,t){function r(e,t,r){return"assert"===r?new $t(t,[e]):"coerce"===r?new Zt(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 i=e[0];if("string"!=typeof i)return this.error(`Expression name must be a string, but found ${typeof i} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const n=this.registry[i];if(n){let i=n.parse(e,this);if(!i)return null;if(this.expectedType){const e=this.expectedType,n=i.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","array"].includes(n.kind)||["color","formatted","resolvedImage"].includes(e.kind)&&["value","string"].includes(n.kind)||["padding","numberArray"].includes(e.kind)&&["value","number","array"].includes(n.kind)||"colorArray"===e.kind&&["value","string","array"].includes(n.kind)||"variableAnchorOffsetCollection"===e.kind&&["value","array"].includes(n.kind))i=r(i,e,t.typeAnnotation||"coerce");else if(this.checkSubtype(e,n))return null}else i=r(i,e,t.typeAnnotation||"assert")}if(!(i instanceof Gt)&&"resolvedImage"!==i.type.kind&&this._isConstant(i)){const t=new Xt;try{i=new Gt(i.type,i.evaluate(t))}catch(e){return this.error(e.message),null}}return i}return this.error(`Unknown expression "${i}". 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,r){const i="number"==typeof e?this.path.concat(e):this.path,n=r?this.scope.concat(r):this.scope;return new Yt(this.registry,this._isConstant,i,t||null,n,this.errors)}error(e,...t){const r=`${this.key}${t.map(e=>`[${e}]`).join("")}`;this.errors.push(new De(r,e))}checkSubtype(e,t){const r=Ke(e,t);return r&&this.error(r),r}}class Jt{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 r=[];for(let n=1;n<e.length-1;n+=2){const i=e[n];if("string"!=typeof i)return t.error(`Expected string, but found ${typeof i} instead.`,n);if(/[^a-zA-Z0-9_]/.test(i))return t.error("Variable names must contain only alphanumeric characters or '_'.",n);const o=t.parse(e[n+1],n+1);if(!o)return null;r.push([i,o])}const i=t.parse(e[e.length-1],e.length-1,t.expectedType,r);return i?new Jt(r,i):null}outputDefined(){return this.result.outputDefined()}}class Kt{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 r=e[1];return t.scope.has(r)?new Kt(r,t.scope.get(r)):t.error(`Unknown variable "${r}". Make sure "${r}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class Qt{constructor(e,t,r){this.type=e,this.index=t,this.input=r}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const r=t.parse(e[1],1,Fe),i=t.parse(e[2],2,Xe(t.expectedType||Ve));return r&&i?new Qt(i.type.itemType,r,i):null}evaluate(e){const t=this.index.evaluate(e),r=this.input.evaluate(e);if(t<0)throw new Lt(`Array index out of bounds: ${t} < 0.`);if(t>=r.length)throw new Lt(`Array index out of bounds: ${t} > ${r.length-1}.`);if(t!==Math.floor(t))throw new Lt(`Array index must be an integer, but found ${t} instead.`);return r[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class er{constructor(e,t){this.type=ze,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 r=t.parse(e[1],1,Ve),i=t.parse(e[2],2,Ve);return r&&i?Qe(r.type,[ze,Oe,Fe,Le,Ve])?new er(r,i):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ye(r.type)} instead`):null}evaluate(e){const t=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(!r)return!1;if(!et(t,["boolean","string","number","null"]))throw new Lt(`Expected first argument to be of type boolean, string, number or null, but found ${Ye(Vt(t))} instead.`);if(!et(r,["string","array"]))throw new Lt(`Expected second argument to be of type array or string, but found ${Ye(Vt(r))} instead.`);return r.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class tr{constructor(e,t,r){this.type=Fe,this.needle=e,this.haystack=t,this.fromIndex=r}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const r=t.parse(e[1],1,Ve),i=t.parse(e[2],2,Ve);if(!r||!i)return null;if(!Qe(r.type,[ze,Oe,Fe,Le,Ve]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ye(r.type)} instead`);if(4===e.length){const n=t.parse(e[3],3,Fe);return n?new tr(r,i,n):null}return new tr(r,i)}evaluate(e){const t=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(!et(t,["boolean","string","number","null"]))throw new Lt(`Expected first argument to be of type boolean, string, number or null, but found ${Ye(Vt(t))} instead.`);let i;if(this.fromIndex&&(i=this.fromIndex.evaluate(e)),et(r,["string"])){const e=r.indexOf(t,i);return-1===e?-1:[...r.slice(0,e)].length}if(et(r,["array"]))return r.indexOf(t,i);throw new Lt(`Expected second argument to be of type array or string, but found ${Ye(Vt(r))} instead.`)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class rr{constructor(e,t,r,i,n,o){this.inputType=e,this.type=t,this.input=r,this.cases=i,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 r,i;t.expectedType&&"value"!==t.expectedType.kind&&(i=t.expectedType);const n={},o=[];for(let l=2;l<e.length-1;l+=2){let a=e[l];const s=e[l+1];Array.isArray(a)||(a=[a]);const c=t.concat(l);if(0===a.length)return c.error("Expected at least one branch label.");for(const e of a){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(r){if(c.checkSubtype(r,Vt(e)))return null}else r=Vt(e);if(void 0!==n[String(e)])return c.error("Branch labels must be unique.");n[String(e)]=o.length}const u=t.parse(s,l,i);if(!u)return null;i=i||u.type,o.push(u)}const a=t.parse(e[1],1,Ve);if(!a)return null;const s=t.parse(e[e.length-1],e.length-1,i);return s?"value"!==a.type.kind&&t.concat(1).checkSubtype(r,a.type)?null:new rr(r,i,a,n,o,s):null}evaluate(e){const t=this.input.evaluate(e);return(Vt(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 ir{constructor(e,t,r){this.type=e,this.branches=t,this.otherwise=r}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 r;t.expectedType&&"value"!==t.expectedType.kind&&(r=t.expectedType);const i=[];for(let o=1;o<e.length-1;o+=2){const n=t.parse(e[o],o,ze);if(!n)return null;const a=t.parse(e[o+1],o+1,r);if(!a)return null;i.push([n,a]),r=r||a.type}const n=t.parse(e[e.length-1],e.length-1,r);if(!n)return null;if(!r)throw new Error("Can't infer output type");return new ir(r,i,n)}evaluate(e){for(const[t,r]of this.branches)if(t.evaluate(e))return r.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[t,r]of this.branches)e(t),e(r);e(this.otherwise)}outputDefined(){return this.branches.every(([e,t])=>t.outputDefined())&&this.otherwise.outputDefined()}}class nr{constructor(e,t,r,i){this.type=e,this.input=t,this.beginIndex=r,this.endIndex=i}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const r=t.parse(e[1],1,Ve),i=t.parse(e[2],2,Fe);if(!r||!i)return null;if(!Qe(r.type,[Xe(Ve),Oe,Ve]))return t.error(`Expected first argument to be of type array or string, but found ${Ye(r.type)} instead`);if(4===e.length){const n=t.parse(e[3],3,Fe);return n?new nr(r.type,r,i,n):null}return new nr(r.type,r,i)}evaluate(e){const t=this.input.evaluate(e),r=this.beginIndex.evaluate(e);let i;if(this.endIndex&&(i=this.endIndex.evaluate(e)),et(t,["string"]))return[...t].slice(r,i).join("");if(et(t,["array"]))return t.slice(r,i);throw new Lt(`Expected first argument to be of type array or string, but found ${Ye(Vt(t))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function or(e,t){const r=e.length-1;let i,n,o=0,a=r,s=0;for(;o<=a;)if(s=Math.floor((o+a)/2),i=e[s],n=e[s+1],i<=t){if(s===r||t<n)return s;o=s+1}else{if(!(i>t))throw new Lt("Input is not a number.");a=s-1}return 0}class ar{constructor(e,t,r){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[i,n]of r)this.labels.push(i),this.outputs.push(n)}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 r=t.parse(e[1],1,Fe);if(!r)return null;const i=[];let n=null;t.expectedType&&"value"!==t.expectedType.kind&&(n=t.expectedType);for(let o=1;o<e.length;o+=2){const r=1===o?-1/0:e[o],a=e[o+1],s=o,l=o+1;if("number"!=typeof r)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(i.length&&i[i.length-1][0]>=r)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,i.push([r,c])}return new ar(n,r,i)}evaluate(e){const t=this.labels,r=this.outputs;if(1===t.length)return r[0].evaluate(e);const i=this.input.evaluate(e);if(i<=t[0])return r[0].evaluate(e);const n=t.length;return i>=t[n-1]?r[n-1].evaluate(e):r[or(t,i)].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function sr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var lr,cr,ur=function(){if(cr)return lr;function e(e,t,r,i){this.cx=3*e,this.bx=3*(r-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(i-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=r,this.p2y=i}return cr=1,lr=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 r=e,i=0;i<8;i++){var n=this.sampleCurveX(r)-e;if(Math.abs(n)<t)return r;var o=this.sampleCurveDerivativeX(r);if(Math.abs(o)<1e-6)break;r-=n/o}var a=0,s=1;for(r=e,i=0;i<20&&(n=this.sampleCurveX(r),!(Math.abs(n-e)<t));i++)e>n?a=r:s=r,r=.5*(s-a)+a;return r},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},lr}(),hr=sr(ur);class dr{constructor(e,t,r,i,n){this.type=e,this.operator=t,this.interpolation=r,this.input=i,this.labels=[],this.outputs=[];for(const[o,a]of n)this.labels.push(o),this.outputs.push(a)}static interpolationFactor(e,t,r,i){let n=0;if("exponential"===e.name)n=pr(t,e.base,r,i);else if("linear"===e.name)n=pr(t,1,r,i);else if("cubic-bezier"===e.name){const o=e.controlPoints;n=new hr(o[0],o[1],o[2],o[3]).solve(pr(t,1,r,i))}return n}static parse(e,t){let[r,i,n,...o]=e;if(!Array.isArray(i)||0===i.length)return t.error("Expected an interpolation type expression.",1);if("linear"===i[0])i={name:"linear"};else if("exponential"===i[0]){const e=i[1];if("number"!=typeof e)return t.error("Exponential interpolation requires a numeric base.",1,1);i={name:"exponential",base:e}}else{if("cubic-bezier"!==i[0])return t.error(`Unknown interpolation type ${String(i[0])}`,1,0);{const e=i.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);i={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,Fe),!n)return null;const a=[];let s=null;"interpolate-hcl"!==r&&"interpolate-lab"!==r||t.expectedType==$e?t.expectedType&&"value"!==t.expectedType.kind&&(s=t.expectedType):s=Be;for(let l=0;l<o.length;l+=2){const e=o[l],r=o[l+1],i=l+3,n=l+4;if("number"!=typeof e)return t.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',i);if(a.length&&a[a.length-1][0]>=e)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',i);const c=t.parse(r,n,s);if(!c)return null;s=s||c.type,a.push([e,c])}return tt(s,Fe)||tt(s,Ne)||tt(s,Be)||tt(s,qe)||tt(s,We)||tt(s,$e)||tt(s,He)||tt(s,Xe(Fe))?new dr(s,r,i,n,a):t.error(`Type ${Ye(s)} is not interpolatable.`)}evaluate(e){const t=this.labels,r=this.outputs;if(1===t.length)return r[0].evaluate(e);const i=this.input.evaluate(e);if(i<=t[0])return r[0].evaluate(e);const n=t.length;if(i>=t[n-1])return r[n-1].evaluate(e);const o=or(t,i),a=dr.interpolationFactor(this.interpolation,i,t[o],t[o+1]),s=r[o].evaluate(e),l=r[o+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return St(s,l,a);case"color":return It.interpolate(s,l,a);case"padding":return Mt.interpolate(s,l,a);case"colorArray":return Rt.interpolate(s,l,a);case"numberArray":return Dt.interpolate(s,l,a);case"variableAnchorOffsetCollection":return Ot.interpolate(s,l,a);case"array":return Et(s,l,a);case"projectionDefinition":return Bt.interpolate(s,l,a)}case"interpolate-hcl":switch(this.type.kind){case"color":return It.interpolate(s,l,a,"hcl");case"colorArray":return Rt.interpolate(s,l,a,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return It.interpolate(s,l,a,"lab");case"colorArray":return Rt.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 pr(e,t,r,i){const n=i-r,o=e-r;return 0===n?0:1===t?o/n:(Math.pow(t,o)-1)/(Math.pow(t,n)-1)}const fr={color:It.interpolate,number:St,padding:Mt.interpolate,numberArray:Dt.interpolate,colorArray:Rt.interpolate,variableAnchorOffsetCollection:Ot.interpolate,array:Et};class mr{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 r=null;const i=t.expectedType;i&&"value"!==i.kind&&(r=i);const n=[];for(const a of e.slice(1)){const e=t.parse(a,1+n.length,r,void 0,{typeAnnotation:"omit"});if(!e)return null;r=r||e.type,n.push(e)}if(!r)throw new Error("No output type");const o=i&&n.some(e=>Ke(i,e.type));return new mr(o?Ve:r,n)}evaluate(e){let t,r=null,i=0;for(const n of this.args)if(i++,r=n.evaluate(e),r&&r instanceof zt&&!r.available&&(t||(t=r.name),r=null,i===this.args.length&&(r=t)),null!==r)break;return r}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}function gr(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 _r(e,t,r,i){return 0===i.compare(t,r)}function yr(e,t,r){const i="=="!==e&&"!="!==e;return class n{constructor(e,t,r){this.type=ze,this.lhs=e,this.rhs=t,this.collator=r,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 r=e[0];let o=t.parse(e[1],1,Ve);if(!o)return null;if(!gr(r,o.type))return t.concat(1).error(`"${r}" comparisons are not supported for type '${Ye(o.type)}'.`);let a=t.parse(e[2],2,Ve);if(!a)return null;if(!gr(r,a.type))return t.concat(2).error(`"${r}" comparisons are not supported for type '${Ye(a.type)}'.`);if(o.type.kind!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return t.error(`Cannot compare types '${Ye(o.type)}' and '${Ye(a.type)}'.`);i&&("value"===o.type.kind&&"value"!==a.type.kind?o=new $t(a.type,[o]):"value"!==o.type.kind&&"value"===a.type.kind&&(a=new $t(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,Ue),!s)return null}return new n(o,a,s)}evaluate(n){const o=this.lhs.evaluate(n),a=this.rhs.evaluate(n);if(i&&this.hasUntypedArgument){const t=Vt(o),r=Vt(a);if(t.kind!==r.kind||"string"!==t.kind&&"number"!==t.kind)throw new Lt(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${r.kind}) instead.`)}if(this.collator&&!i&&this.hasUntypedArgument){const e=Vt(o),r=Vt(a);if("string"!==e.kind||"string"!==r.kind)return t(n,o,a)}return this.collator?r(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 vr=yr("==",function(e,t,r){return t===r},_r),br=yr("!=",function(e,t,r){return t!==r},function(e,t,r,i){return!_r(0,t,r,i)}),xr=yr("<",function(e,t,r){return t<r},function(e,t,r,i){return i.compare(t,r)<0}),wr=yr(">",function(e,t,r){return t>r},function(e,t,r,i){return i.compare(t,r)>0}),Tr=yr("<=",function(e,t,r){return t<=r},function(e,t,r,i){return i.compare(t,r)<=0}),Sr=yr(">=",function(e,t,r){return t>=r},function(e,t,r,i){return i.compare(t,r)>=0});class Er{constructor(e,t,r){this.type=Ue,this.locale=r,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(2!==e.length)return t.error("Expected one argument.");const r=e[1];if("object"!=typeof r||Array.isArray(r))return t.error("Collator options argument must be an object.");const i=t.parse(void 0!==r["case-sensitive"]&&r["case-sensitive"],1,ze);if(!i)return null;const n=t.parse(void 0!==r["diacritic-sensitive"]&&r["diacritic-sensitive"],1,ze);if(!n)return null;let o=null;return r.locale&&(o=t.parse(r.locale,1,Oe),!o)?null:new Er(i,n,o)}evaluate(e){return new Pt(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 Ir{constructor(e,t,r,i,n){this.type=Oe,this.number=e,this.locale=t,this.currency=r,this.minFractionDigits=i,this.maxFractionDigits=n}static parse(e,t){if(3!==e.length)return t.error("Expected two arguments.");const r=t.parse(e[1],1,Fe);if(!r)return null;const i=e[2];if("object"!=typeof i||Array.isArray(i))return t.error("NumberFormat options argument must be an object.");let n=null;if(i.locale&&(n=t.parse(i.locale,1,Oe),!n))return null;let o=null;if(i.currency&&(o=t.parse(i.currency,1,Oe),!o))return null;let a=null;if(i["min-fraction-digits"]&&(a=t.parse(i["min-fraction-digits"],1,Fe),!a))return null;let s=null;return i["max-fraction-digits"]&&(s=t.parse(i["max-fraction-digits"],1,Fe),!s)?null:new Ir(r,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 Pr{constructor(e){this.type=Ge,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const r=e[1];if(!Array.isArray(r)&&"object"==typeof r)return t.error("First argument must be an image or text section.");const i=[];let n=!1;for(let o=1;o<=e.length-1;++o){const r=e[o];if(n&&"object"==typeof r&&!Array.isArray(r)){n=!1;let e=null;if(r["font-scale"]&&(e=t.parse(r["font-scale"],1,Fe),!e))return null;let o=null;if(r["text-font"]&&(o=t.parse(r["text-font"],1,Xe(Oe)),!o))return null;let a=null;if(r["text-color"]&&(a=t.parse(r["text-color"],1,Be),!a))return null;let s=null;if(r["vertical-align"]){if("string"==typeof r["vertical-align"]&&!kt.includes(r["vertical-align"]))return t.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${r["vertical-align"]}' instead.`);if(s=t.parse(r["vertical-align"],1,Oe),!s)return null}const l=i[i.length-1];l.scale=e,l.font=o,l.textColor=a,l.verticalAlign=s}else{const r=t.parse(e[o],1,Ve);if(!r)return null;const a=r.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,i.push({content:r,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Pr(i)}evaluate(e){return new Ct(this.sections.map(t=>{const r=t.content.evaluate(e);return Vt(r)===Ze?new At("",r,null,null,null,t.verticalAlign?t.verticalAlign.evaluate(e):null):new At(Ut(r),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 kr{constructor(e){this.type=Ze,this.input=e}static parse(e,t){if(2!==e.length)return t.error("Expected two arguments.");const r=t.parse(e[1],1,Oe);return r?new kr(r):t.error("No image name provided.")}evaluate(e){const t=this.input.evaluate(e),r=zt.fromString(t);return r&&e.availableImages&&(r.available=e.availableImages.indexOf(t)>-1),r}eachChild(e){e(this.input)}outputDefined(){return!1}}class Ar{constructor(e){this.type=Fe,this.input=e}static parse(e,t){if(2!==e.length)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const r=t.parse(e[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?t.error(`Expected argument of type string or array, but found ${Ye(r.type)} instead.`):new Ar(r):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 Lt(`Expected value to be of type string or array, but found ${Ye(Vt(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const Cr=8192;function Mr(e,t){const r=(180+e[0])/360,i=(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(r*n*Cr),Math.round(i*n*Cr)]}function Dr(e,t){const r=Math.pow(2,t.z);return[(n=(e[0]/Cr+t.x)/r,360*n-180),(i=(e[1]/Cr+t.y)/r,360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90)];var i,n}function Rr(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 Lr(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function Fr(e,t,r){const i=e[0]-t[0],n=e[1]-t[1],o=e[0]-r[0],a=e[1]-r[1];return i*a-o*n==0&&i*o<=0&&n*a<=0}function Or(e,t,r,i){return 0!=(n=[i[0]-r[0],i[1]-r[1]])[0]*(o=[t[0]-e[0],t[1]-e[1]])[1]-n[1]*o[0]&&!(!Ur(e,t,r,i)||!Ur(r,i,e,t));var n,o}function zr(e,t,r){for(const i of r)for(let r=0;r<i.length-1;++r)if(Or(e,t,i[r],i[r+1]))return!0;return!1}function Br(e,t,r=!1){let i=!1;for(const s of t)for(let t=0;t<s.length-1;t++){if(Fr(e,s[t],s[t+1]))return r;(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]&&(i=!i)}var n,o,a;return i}function Nr(e,t){for(const r of t)if(Br(e,r))return!0;return!1}function jr(e,t){for(const r of e)if(!Br(r,t))return!1;for(let r=0;r<e.length-1;++r)if(zr(e[r],e[r+1],t))return!1;return!0}function Vr(e,t){for(const r of t)if(jr(e,r))return!0;return!1}function Ur(e,t,r,i){const n=i[0]-r[0],o=i[1]-r[1],a=(e[0]-r[0])*o-n*(e[1]-r[1]),s=(t[0]-r[0])*o-n*(t[1]-r[1]);return a>0&&s<0||a<0&&s>0}function Gr(e,t,r){const i=[];for(let n=0;n<e.length;n++){const o=[];for(let i=0;i<e[n].length;i++){const a=Mr(e[n][i],r);Rr(t,a),o.push(a)}i.push(o)}return i}function qr(e,t,r){const i=[];for(let n=0;n<e.length;n++){const o=Gr(e[n],t,r);i.push(o)}return i}function $r(e,t,r,i){if(e[0]<r[0]||e[0]>r[2]){const t=.5*i;let n=e[0]-r[0]>t?-i:r[0]-e[0]>t?i:0;0===n&&(n=e[0]-r[2]>t?-i:r[2]-e[0]>t?i:0),e[0]+=n}Rr(t,e)}function Wr(e,t,r,i){const n=Math.pow(2,i.z)*Cr,o=[i.x*Cr,i.y*Cr],a=[];for(const s of e)for(const e of s){const i=[e.x+o[0],e.y+o[1]];$r(i,t,r,n),a.push(i)}return a}function Zr(e,t,r,i){const n=Math.pow(2,i.z)*Cr,o=[i.x*Cr,i.y*Cr],a=[];for(const l of e){const e=[];for(const r of l){const i=[r.x+o[0],r.y+o[1]];Rr(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 i of e)$r(i,t,r,n)}var s;return a}class Hr{constructor(e,t){this.type=ze,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(jt(e[1])){const t=e[1];if("FeatureCollection"===t.type){const e=[];for(const r of t.features){const{type:t,coordinates:i}=r.geometry;"Polygon"===t&&e.push(i),"MultiPolygon"===t&&e.push(...i)}if(e.length)return new Hr(t,{type:"MultiPolygon",coordinates:e})}else if("Feature"===t.type){const e=t.geometry.type;if("Polygon"===e||"MultiPolygon"===e)return new Hr(t,t.geometry)}else if("Polygon"===t.type||"MultiPolygon"===t.type)return new Hr(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 r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if("Polygon"===t.type){const o=Gr(t.coordinates,i,n),a=Wr(e.geometry(),r,i,n);if(!Lr(r,i))return!1;for(const e of a)if(!Br(e,o))return!1}if("MultiPolygon"===t.type){const o=qr(t.coordinates,i,n),a=Wr(e.geometry(),r,i,n);if(!Lr(r,i))return!1;for(const e of a)if(!Nr(e,o))return!1}return!0}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){const r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if("Polygon"===t.type){const o=Gr(t.coordinates,i,n),a=Zr(e.geometry(),r,i,n);if(!Lr(r,i))return!1;for(const e of a)if(!jr(e,o))return!1}if("MultiPolygon"===t.type){const o=qr(t.coordinates,i,n),a=Zr(e.geometry(),r,i,n);if(!Lr(r,i))return!1;for(const e of a)if(!Vr(e,o))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Xr=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 r=(this.length>>1)-1;r>=0;r--)this._down(r)}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:r}=this,i=t[e];for(;e>0;){const n=e-1>>1,o=t[n];if(r(i,o)>=0)break;t[e]=o,e=n}t[e]=i}_down(e){const{data:t,compare:r}=this,i=this.length>>1,n=t[e];for(;e<i;){let i=1+(e<<1);const o=i+1;if(o<this.length&&r(t[o],t[i])<0&&(i=o),r(t[i],n)>=0)break;t[e]=t[i],e=i}t[e]=n}};function Yr(e,t,r=0,i=e.length-1,n=Kr){for(;i>r;){if(i-r>600){const o=i-r+1,a=t-r+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);Yr(e,t,Math.max(r,Math.floor(t-a*l/o+c)),Math.min(i,Math.floor(t+(o-a)*l/o+c)),n)}const o=e[t];let a=r,s=i;for(Jr(e,r,t),n(e[i],o)>0&&Jr(e,r,i);a<s;){for(Jr(e,a,s),a++,s--;n(e[a],o)<0;)a++;for(;n(e[s],o)>0;)s--}0===n(e[r],o)?Jr(e,r,s):(s++,Jr(e,s,i)),s<=t&&(r=s+1),t<=s&&(i=s-1)}}function Jr(e,t,r){const i=e[t];e[t]=e[r],e[r]=i}function Kr(e,t){return e<t?-1:e>t?1:0}function Qr(e,t){if(e.length<=1)return[e];const r=[];let i,n;for(const o of e){const e=ti(o);0!==e&&(o.area=Math.abs(e),void 0===n&&(n=e<0),n===e<0?(i&&r.push(i),i=[o]):i.push(o))}if(i&&r.push(i),t>1)for(let o=0;o<r.length;o++)r[o].length<=t||(Yr(r[o],t,1,r[o].length-1,ei),r[o]=r[o].slice(0,t));return r}function ei(e,t){return t.area-e.area}function ti(e){let t=0;for(let r,i,n=0,o=e.length,a=o-1;n<o;a=n++)r=e[n],i=e[a],t+=(i.x-r.x)*(r.y+i.y);return t}const ri=1/298.257223563,ii=ri*(2-ri),ni=Math.PI/180;class oi{constructor(e){const t=6378.137*ni*1e3,r=Math.cos(e*ni),i=1/(1-ii*(1-r*r)),n=Math.sqrt(i);this.kx=t*n*r,this.ky=t*n*i*(1-ii)}distance(e,t){const r=this.wrap(e[0]-t[0])*this.kx,i=(e[1]-t[1])*this.ky;return Math.sqrt(r*r+i*i)}pointOnLine(e,t){let r,i,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,d=0;0===u&&0===h||(d=(this.wrap(t[0]-l)*this.kx*u+(t[1]-c)*this.ky*h)/(u*u+h*h),d>1?(l=e[s+1][0],c=e[s+1][1]):d>0&&(l+=u/this.kx*d,c+=h/this.ky*d)),u=this.wrap(t[0]-l)*this.kx,h=(t[1]-c)*this.ky;const p=u*u+h*h;p<a&&(a=p,r=l,i=c,n=s,o=d)}return{point:[r,i],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 ai(e,t){return t[0]-e[0]}function si(e){return e[1]-e[0]+1}function li(e,t){return e[1]>=e[0]&&e[1]<t}function ci(e,t){if(e[0]>e[1])return[null,null];const r=si(e);if(t){if(2===r)return[e,null];const t=Math.floor(r/2);return[[e[0],e[0]+t],[e[0]+t,e[1]]]}if(1===r)return[e,null];const i=Math.floor(r/2)-1;return[[e[0],e[0]+i],[e[0]+i+1,e[1]]]}function ui(e,t){if(!li(t,e.length))return[1/0,1/0,-1/0,-1/0];const r=[1/0,1/0,-1/0,-1/0];for(let i=t[0];i<=t[1];++i)Rr(r,e[i]);return r}function hi(e){const t=[1/0,1/0,-1/0,-1/0];for(const r of e)for(const e of r)Rr(t,e);return t}function di(e){return e[0]!==-1/0&&e[1]!==-1/0&&e[2]!==1/0&&e[3]!==1/0}function pi(e,t,r){if(!di(e)||!di(t))return NaN;let i=0,n=0;return e[2]<t[0]&&(i=t[0]-e[2]),e[0]>t[2]&&(i=e[0]-t[2]),e[1]>t[3]&&(n=e[1]-t[3]),e[3]<t[1]&&(n=t[1]-e[3]),r.distance([0,0],[i,n])}function fi(e,t,r){const i=r.pointOnLine(t,e);return r.distance(e,i.point)}function mi(e,t,r,i,n){const o=Math.min(fi(e,[r,i],n),fi(t,[r,i],n)),a=Math.min(fi(r,[e,t],n),fi(i,[e,t],n));return Math.min(o,a)}function gi(e,t,r,i,n){if(!li(t,e.length)||!li(i,r.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=i[0];e<i[1];++e){const i=r[e],a=r[e+1];if(Or(t,s,i,a))return 0;o=Math.min(o,mi(t,s,i,a,n))}}return o}function _i(e,t,r,i,n){if(!li(t,e.length)||!li(i,r.length))return NaN;let o=1/0;for(let a=t[0];a<=t[1];++a)for(let t=i[0];t<=i[1];++t)if(o=Math.min(o,n.distance(e[a],r[t])),0===o)return o;return o}function yi(e,t,r){if(Br(e,t,!0))return 0;let i=1/0;for(const n of t){const t=n[0],o=n[n.length-1];if(t!==o&&(i=Math.min(i,fi(e,[o,t],r)),0===i))return i;const a=r.pointOnLine(n,e);if(i=Math.min(i,r.distance(e,a.point)),0===i)return i}return i}function vi(e,t,r,i){if(!li(t,e.length))return NaN;for(let o=t[0];o<=t[1];++o)if(Br(e[o],r,!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 r)for(let r=0,o=e.length,s=o-1;r<o;s=r++){const o=e[s],l=e[r];if(Or(t,a,o,l))return 0;n=Math.min(n,mi(t,a,o,l,i))}}return n}function bi(e,t){for(const r of e)for(const e of r)if(Br(e,t,!0))return!0;return!1}function xi(e,t,r,i=1/0){const n=hi(e),o=hi(t);if(i!==1/0&&pi(n,o,r)>=i)return i;if(Lr(n,o)){if(bi(e,t))return 0}else if(bi(t,e))return 0;let a=1/0;for(const s of e)for(let e=0,i=s.length,n=i-1;e<i;n=e++){const i=s[n],o=s[e];for(const e of t)for(let t=0,n=e.length,s=n-1;t<n;s=t++){const n=e[s],l=e[t];if(Or(i,o,n,l))return 0;a=Math.min(a,mi(i,o,n,l,r))}}return a}function wi(e,t,r,i,n,o){if(!o)return;const a=pi(ui(i,o),n,r);a<t&&e.push([a,o,[0,0]])}function Ti(e,t,r,i,n,o,a){if(!o||!a)return;const s=pi(ui(i,o),ui(n,a),r);s<t&&e.push([s,o,a])}function Si(e,t,r,i,n=1/0){let o=Math.min(i.distance(e[0],r[0][0]),n);if(0===o)return o;const a=new Xr([[0,[0,e.length-1],[0,0]]],ai),s=hi(r);for(;a.length>0;){const n=a.pop();if(n[0]>=o)continue;const l=n[1],c=t?50:100;if(si(l)<=c){if(!li(l,e.length))return NaN;if(t){const t=vi(e,l,r,i);if(isNaN(t)||0===t)return t;o=Math.min(o,t)}else for(let t=l[0];t<=l[1];++t){const n=yi(e[t],r,i);if(o=Math.min(o,n),0===o)return 0}}else{const r=ci(l,t);wi(a,o,i,e,s,r[0]),wi(a,o,i,e,s,r[1])}}return o}function Ei(e,t,r,i,n,o=1/0){let a=Math.min(o,n.distance(e[0],r[0]));if(0===a)return a;const s=new Xr([[0,[0,e.length-1],[0,r.length-1]]],ai);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=i?50:100;if(si(l)<=u&&si(c)<=h){if(!li(l,e.length)&&li(c,r.length))return NaN;let o;if(t&&i)o=gi(e,l,r,c,n),a=Math.min(a,o);else if(t&&!i){const t=e.slice(l[0],l[1]+1);for(let e=c[0];e<=c[1];++e)if(o=fi(r[e],t,n),a=Math.min(a,o),0===a)return a}else if(!t&&i){const t=r.slice(c[0],c[1]+1);for(let r=l[0];r<=l[1];++r)if(o=fi(e[r],t,n),a=Math.min(a,o),0===a)return a}else o=_i(e,l,r,c,n),a=Math.min(a,o)}else{const o=ci(l,t),u=ci(c,i);Ti(s,a,n,e,r,o[0],u[0]),Ti(s,a,n,e,r,o[0],u[1]),Ti(s,a,n,e,r,o[1],u[0]),Ti(s,a,n,e,r,o[1],u[1])}}return a}function Ii(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 Pi{constructor(e,t){this.type=Fe,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(jt(e[1])){const t=e[1];if("FeatureCollection"===t.type)return new Pi(t,t.features.map(e=>Ii(e.geometry)).flat());if("Feature"===t.type)return new Pi(t,Ii(t.geometry));if("type"in t&&"coordinates"in t)return new Pi(t,Ii(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 r=e.geometry(),i=r.flat().map(t=>Dr([t.x,t.y],e.canonical));if(0===r.length)return NaN;const n=new oi(i[0][1]);let o=1/0;for(const a of t){switch(a.type){case"Point":o=Math.min(o,Ei(i,!1,[a.coordinates],!1,n,o));break;case"LineString":o=Math.min(o,Ei(i,!1,a.coordinates,!0,n,o));break;case"Polygon":o=Math.min(o,Si(i,!1,a.coordinates,n,o))}if(0===o)return o}return o}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){const r=e.geometry(),i=r.flat().map(t=>Dr([t.x,t.y],e.canonical));if(0===r.length)return NaN;const n=new oi(i[0][1]);let o=1/0;for(const a of t){switch(a.type){case"Point":o=Math.min(o,Ei(i,!0,[a.coordinates],!1,n,o));break;case"LineString":o=Math.min(o,Ei(i,!0,a.coordinates,!0,n,o));break;case"Polygon":o=Math.min(o,Si(i,!0,a.coordinates,n,o))}if(0===o)return o}return o}(e,this.geometries);if("Polygon"===e.geometryType())return function(e,t){const r=e.geometry();if(0===r.length||0===r[0].length)return NaN;const i=Qr(r,0).map(t=>t.map(t=>t.map(t=>Dr([t.x,t.y],e.canonical)))),n=new oi(i[0][0][0][1]);let o=1/0;for(const a of t)for(const e of i){switch(a.type){case"Point":o=Math.min(o,Si([a.coordinates],!1,e,n,o));break;case"LineString":o=Math.min(o,Si(a.coordinates,!0,e,n,o));break;case"Polygon":o=Math.min(o,xi(e,a.coordinates,n,o))}if(0===o)return o}return o}(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class ki{constructor(e){this.type=Ve,this.key=e}static parse(e,t){if(2!==e.length)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const r=e[1];return null==r?t.error("Global state property must be defined."):"string"!=typeof r?t.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new ki(r)}evaluate(e){var t;const r=null===(t=e.globals)||void 0===t?void 0:t.globalState;return r&&0!==Object.keys(r).length?yt(r,this.key):null}eachChild(){}outputDefined(){return!1}}const Ai={"==":vr,"!=":br,">":wr,"<":xr,">=":Sr,"<=":Tr,array:$t,at:Qt,boolean:$t,case:ir,coalesce:mr,collator:Er,format:Pr,image:kr,in:er,"index-of":tr,interpolate:dr,"interpolate-hcl":dr,"interpolate-lab":dr,length:Ar,let:Jt,literal:Gt,match:rr,number:$t,"number-format":Ir,object:$t,slice:nr,step:ar,string:$t,"to-boolean":Zt,"to-color":Zt,"to-number":Zt,"to-string":Zt,var:Kt,within:Hr,distance:Pi,"global-state":ki};class Ci{constructor(e,t,r,i){this.name=e,this.type=t,this._evaluate=r,this.args=i}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,t){const r=e[0],i=Ci.definitions[r];if(!i)return t.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0);const n=Array.isArray(i)?i[0]:i.type,o=Array.isArray(i)?[[i[1],i[2]]]:i.overloads,a=o.filter(([t])=>!Array.isArray(t)||t.length===e.length-1);let s=null;for(const[l,c]of a){s=new Yt(t.registry,Fi,t.path,null,t.scope);const i=[];let o=!1;for(let t=1;t<e.length;t++){const r=e[t],n=Array.isArray(l)?l[t-1]:l.type,a=s.parse(r,1+i.length,n);if(!a){o=!0;break}i.push(a)}if(!o)if(Array.isArray(l)&&l.length!==i.length)s.error(`Expected ${l.length} arguments, but found ${i.length} instead.`);else{for(let e=0;e<i.length;e++){const t=Array.isArray(l)?l[e]:l.type,r=i[e];s.concat(e+1).checkSubtype(t,r.type)}if(0===s.errors.length)return new Ci(r,n,c,i)}}if(1===a.length)t.errors.push(...s.errors);else{const r=(a.length?a:o).map(([e])=>{return t=e,Array.isArray(t)?`(${t.map(Ye).join(", ")})`:`(${Ye(t.type)}...)`;var t}).join(" | "),i=[];for(let n=1;n<e.length;n++){const r=t.parse(e[n],1+i.length);if(!r)return null;i.push(Ye(r.type))}t.error(`Expected arguments of type ${r}, but found (${i.join(", ")}) instead.`)}return null}static register(e,t){Ci.definitions=t;for(const r in t)e[r]=Ci}}function Mi(e,[t,r,i,n]){t=t.evaluate(e),r=r.evaluate(e),i=i.evaluate(e);const o=n?n.evaluate(e):1,a=Nt(t,r,i,o);if(a)throw new Lt(a);return new It(t/255,r/255,i/255,o,!1)}function Di(e,t){return e in t}function Ri(e,t){const r=t[e];return void 0===r?null:r}function Li(e){return{type:e}}function Fi(e){if(e instanceof Kt)return Fi(e.boundExpression);if(e instanceof Ci&&"error"===e.name)return!1;if(e instanceof Er)return!1;if(e instanceof Hr)return!1;if(e instanceof Pi)return!1;if(e instanceof ki)return!1;const t=e instanceof Zt||e instanceof $t;let r=!0;return e.eachChild(e=>{r=t?r&&Fi(e):r&&e instanceof Gt}),!!r&&Oi(e)&&Bi(e,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function Oi(e){if(e instanceof Ci){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 Hr)return!1;if(e instanceof Pi)return!1;let t=!0;return e.eachChild(e=>{t&&!Oi(e)&&(t=!1)}),t}function zi(e){if(e instanceof Ci&&"feature-state"===e.name)return!1;let t=!0;return e.eachChild(e=>{t&&!zi(e)&&(t=!1)}),t}function Bi(e,t){if(e instanceof Ci&&t.indexOf(e.name)>=0)return!1;let r=!0;return e.eachChild(e=>{r&&!Bi(e,t)&&(r=!1)}),r}function Ni(e){return{result:"success",value:e}}function ji(e){return{result:"error",value:e}}function Vi(e){return"data-driven"===e["property-type"]||"cross-faded-data-driven"===e["property-type"]}function Ui(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function Gi(e){return!!e.expression&&e.expression.interpolated}function qi(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}function $i(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)&&Vt(e)===je}function Wi(e){return e}function Zi(e,t){const r=e.stops&&"object"==typeof e.stops[0][0],i=r||!(r||void 0!==e.property),n=e.type||(Gi(t)?"exponential":"interval"),o=function(e){switch(e.type){case"color":return It.parse;case"padding":return Mt.parse;case"numberArray":return Dt.parse;case"colorArray":return Rt.parse;default:return null}}(t);if(o&&((e=Me({},e)).stops&&(e.stops=e.stops.map(e=>[e[0],o(e[1])])),e.default=o(e.default?e.default:t.default)),e.colorSpace&&"rgb"!==(a=e.colorSpace)&&"hcl"!==a&&"lab"!==a)throw new Error(`Unknown color space: "${e.colorSpace}"`);var a;const s=function(e){switch(e){case"exponential":return Ji;case"interval":return Yi;case"categorical":return Xi;case"identity":return Ki;default:throw new Error(`Unknown function type "${e}"`)}}(n);let l,c;if("categorical"===n){l=Object.create(null);for(const t of e.stops)l[t[0]]=t[1];c=typeof e.stops[0][0]}if(r){const r={},i=[];for(let t=0;t<e.stops.length;t++){const n=e.stops[t],o=n[0].zoom;void 0===r[o]&&(r[o]={zoom:o,type:e.type,property:e.property,default:e.default,stops:[]},i.push(o)),r[o].stops.push([n[0].value,n[1]])}const n=[];for(const e of i)n.push([r[e].zoom,Zi(r[e],t)]);const o={name:"linear"};return{kind:"composite",interpolationType:o,interpolationFactor:dr.interpolationFactor.bind(void 0,o),zoomStops:n.map(e=>e[0]),evaluate:({zoom:r},i)=>Ji({stops:n,base:e.base},t,r).evaluate(r,i)}}if(i){const r="exponential"===n?{name:"exponential",base:void 0!==e.base?e.base:1}:null;return{kind:"camera",interpolationType:r,interpolationFactor:dr.interpolationFactor.bind(void 0,r),zoomStops:e.stops.map(e=>e[0]),evaluate:({zoom:r})=>s(e,t,r,l,c)}}return{kind:"source",evaluate(r,i){const n=i&&i.properties?i.properties[e.property]:void 0;return void 0===n?Hi(e.default,t.default):s(e,t,n,l,c)}}}function Hi(e,t,r){return void 0!==e?e:void 0!==t?t:void 0!==r?r:void 0}function Xi(e,t,r,i,n){return Hi(typeof r===n?i[r]:void 0,e.default,t.default)}function Yi(e,t,r){if("number"!==qi(r))return Hi(e.default,t.default);const i=e.stops.length;if(1===i)return e.stops[0][1];if(r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[i-1][0])return e.stops[i-1][1];const n=or(e.stops.map(e=>e[0]),r);return e.stops[n][1]}function Ji(e,t,r){const i=void 0!==e.base?e.base:1;if("number"!==qi(r))return Hi(e.default,t.default);const n=e.stops.length;if(1===n)return e.stops[0][1];if(r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[n-1][0])return e.stops[n-1][1];const o=or(e.stops.map(e=>e[0]),r),a=function(e,t,r,i){const n=i-r,o=e-r;return 0===n?0:1===t?o/n:(Math.pow(t,o)-1)/(Math.pow(t,n)-1)}(r,i,e.stops[o][0],e.stops[o+1][0]),s=e.stops[o][1],l=e.stops[o+1][1],c=fr[t.type]||Wi;return"function"==typeof s.evaluate?{evaluate(...t){const r=s.evaluate.apply(void 0,t),i=l.evaluate.apply(void 0,t);if(void 0!==r&&void 0!==i)return c(r,i,a,e.colorSpace)}}:c(s,l,a,e.colorSpace)}function Ki(e,t,r){switch(t.type){case"color":r=It.parse(r);break;case"formatted":r=Ct.fromString(r.toString());break;case"resolvedImage":r=zt.fromString(r.toString());break;case"padding":r=Mt.parse(r);break;case"colorArray":r=Rt.parse(r);break;case"numberArray":r=Dt.parse(r);break;default:qi(r)===t.type||"enum"===t.type&&t.values[r]||(r=void 0)}return Hi(r,e.default,t.default)}Ci.register(Ai,{error:[{kind:"error"},[Oe],(e,[t])=>{throw new Lt(t.evaluate(e))}],typeof:[Oe,[Ve],(e,[t])=>Ye(Vt(t.evaluate(e)))],"to-rgba":[Xe(Fe,4),[Be],(e,[t])=>{const[r,i,n,o]=t.evaluate(e).rgb;return[255*r,255*i,255*n,o]}],rgb:[Be,[Fe,Fe,Fe],Mi],rgba:[Be,[Fe,Fe,Fe,Fe],Mi],has:{type:ze,overloads:[[[Oe],(e,[t])=>Di(t.evaluate(e),e.properties())],[[Oe,je],(e,[t,r])=>Di(t.evaluate(e),r.evaluate(e))]]},get:{type:Ve,overloads:[[[Oe],(e,[t])=>Ri(t.evaluate(e),e.properties())],[[Oe,je],(e,[t,r])=>Ri(t.evaluate(e),r.evaluate(e))]]},"feature-state":[Ve,[Oe],(e,[t])=>Ri(t.evaluate(e),e.featureState||{})],properties:[je,[],e=>e.properties()],"geometry-type":[Oe,[],e=>e.geometryType()],id:[Ve,[],e=>e.id()],zoom:[Fe,[],e=>e.globals.zoom],"heatmap-density":[Fe,[],e=>e.globals.heatmapDensity||0],elevation:[Fe,[],e=>e.globals.elevation||0],"line-progress":[Fe,[],e=>e.globals.lineProgress||0],accumulated:[Ve,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[Fe,Li(Fe),(e,t)=>{let r=0;for(const i of t)r+=i.evaluate(e);return r}],"*":[Fe,Li(Fe),(e,t)=>{let r=1;for(const i of t)r*=i.evaluate(e);return r}],"-":{type:Fe,overloads:[[[Fe,Fe],(e,[t,r])=>t.evaluate(e)-r.evaluate(e)],[[Fe],(e,[t])=>-t.evaluate(e)]]},"/":[Fe,[Fe,Fe],(e,[t,r])=>t.evaluate(e)/r.evaluate(e)],"%":[Fe,[Fe,Fe],(e,[t,r])=>t.evaluate(e)%r.evaluate(e)],ln2:[Fe,[],()=>Math.LN2],pi:[Fe,[],()=>Math.PI],e:[Fe,[],()=>Math.E],"^":[Fe,[Fe,Fe],(e,[t,r])=>Math.pow(t.evaluate(e),r.evaluate(e))],sqrt:[Fe,[Fe],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[Fe,[Fe],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[Fe,[Fe],(e,[t])=>Math.log(t.evaluate(e))],log2:[Fe,[Fe],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[Fe,[Fe],(e,[t])=>Math.sin(t.evaluate(e))],cos:[Fe,[Fe],(e,[t])=>Math.cos(t.evaluate(e))],tan:[Fe,[Fe],(e,[t])=>Math.tan(t.evaluate(e))],asin:[Fe,[Fe],(e,[t])=>Math.asin(t.evaluate(e))],acos:[Fe,[Fe],(e,[t])=>Math.acos(t.evaluate(e))],atan:[Fe,[Fe],(e,[t])=>Math.atan(t.evaluate(e))],min:[Fe,Li(Fe),(e,t)=>Math.min(...t.map(t=>t.evaluate(e)))],max:[Fe,Li(Fe),(e,t)=>Math.max(...t.map(t=>t.evaluate(e)))],abs:[Fe,[Fe],(e,[t])=>Math.abs(t.evaluate(e))],round:[Fe,[Fe],(e,[t])=>{const r=t.evaluate(e);return r<0?-Math.round(-r):Math.round(r)}],floor:[Fe,[Fe],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[Fe,[Fe],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[ze,[Oe,Ve],(e,[t,r])=>e.properties()[t.value]===r.value],"filter-id-==":[ze,[Ve],(e,[t])=>e.id()===t.value],"filter-type-==":[ze,[Oe],(e,[t])=>e.geometryType()===t.value],"filter-<":[ze,[Oe,Ve],(e,[t,r])=>{const i=e.properties()[t.value],n=r.value;return typeof i==typeof n&&i<n}],"filter-id-<":[ze,[Ve],(e,[t])=>{const r=e.id(),i=t.value;return typeof r==typeof i&&r<i}],"filter->":[ze,[Oe,Ve],(e,[t,r])=>{const i=e.properties()[t.value],n=r.value;return typeof i==typeof n&&i>n}],"filter-id->":[ze,[Ve],(e,[t])=>{const r=e.id(),i=t.value;return typeof r==typeof i&&r>i}],"filter-<=":[ze,[Oe,Ve],(e,[t,r])=>{const i=e.properties()[t.value],n=r.value;return typeof i==typeof n&&i<=n}],"filter-id-<=":[ze,[Ve],(e,[t])=>{const r=e.id(),i=t.value;return typeof r==typeof i&&r<=i}],"filter->=":[ze,[Oe,Ve],(e,[t,r])=>{const i=e.properties()[t.value],n=r.value;return typeof i==typeof n&&i>=n}],"filter-id->=":[ze,[Ve],(e,[t])=>{const r=e.id(),i=t.value;return typeof r==typeof i&&r>=i}],"filter-has":[ze,[Ve],(e,[t])=>t.value in e.properties()],"filter-has-id":[ze,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[ze,[Xe(Oe)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[ze,[Xe(Ve)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[ze,[Oe,Xe(Ve)],(e,[t,r])=>r.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[ze,[Oe,Xe(Ve)],(e,[t,r])=>function(e,t,r,i){for(;r<=i;){const n=r+i>>1;if(t[n]===e)return!0;t[n]>e?i=n-1:r=n+1}return!1}(e.properties()[t.value],r.value,0,r.value.length-1)],all:{type:ze,overloads:[[[ze,ze],(e,[t,r])=>t.evaluate(e)&&r.evaluate(e)],[Li(ze),(e,t)=>{for(const r of t)if(!r.evaluate(e))return!1;return!0}]]},any:{type:ze,overloads:[[[ze,ze],(e,[t,r])=>t.evaluate(e)||r.evaluate(e)],[Li(ze),(e,t)=>{for(const r of t)if(r.evaluate(e))return!0;return!1}]]},"!":[ze,[ze],(e,[t])=>!t.evaluate(e)],"is-supported-script":[ze,[Oe],(e,[t])=>{const r=e.globals&&e.globals.isSupportedScript;return!r||r(t.evaluate(e))}],upcase:[Oe,[Oe],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[Oe,[Oe],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[Oe,Li(Ve),(e,t)=>t.map(t=>Ut(t.evaluate(e))).join("")],"resolved-locale":[Oe,[Ue],(e,[t])=>t.evaluate(e).resolvedLocale()]});class Qi{constructor(e,t,r){this.expression=e,this._warningHistory={},this._evaluator=new Xt,this._defaultValue=t?function(e){if("color"===e.type&&$i(e.default))return new It(0,0,0,0);switch(e.type){case"color":return It.parse(e.default)||null;case"padding":return Mt.parse(e.default)||null;case"numberArray":return Dt.parse(e.default)||null;case"colorArray":return Rt.parse(e.default)||null;case"variableAnchorOffsetCollection":return Ot.parse(e.default)||null;case"projectionDefinition":return Bt.parse(e.default)||null;default:return void 0===e.default?null:e.default}}(t):null,this._enumValues=t&&"enum"===t.type?t.values:null,this._globalState=r}evaluateWithoutErrorHandling(e,t,r,i,n,o){return this._globalState&&(e=cn(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=r,this._evaluator.canonical=i,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)}evaluate(e,t,r,i,n,o){this._globalState&&(e=cn(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=r||null,this._evaluator.canonical=i,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 Lt(`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 en(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in Ai}function tn(e,t,r){const i=new Yt(Ai,Fi,[],t?function(e){const t={color:Be,string:Oe,number:Fe,enum:Oe,boolean:ze,formatted:Ge,padding:qe,numberArray:We,colorArray:$e,projectionDefinition:Ne,resolvedImage:Ze,variableAnchorOffsetCollection:He};return"array"===e.type?Xe(t[e.value]||Ve,e.length):t[e.type]}(t):void 0),n=i.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return n?Ni(new Qi(n,t,r)):ji(i.errors)}class rn{constructor(e,t,r){this.kind=e,this._styleExpression=t,this.isStateDependent="constant"!==e&&!zi(t.expression),this.globalStateRefs=ln(t.expression),this._globalState=r}evaluateWithoutErrorHandling(e,t,r,i,n,o){return this._globalState&&(e=cn(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,r,i,n,o)}evaluate(e,t,r,i,n,o){return this._globalState&&(e=cn(e,this._globalState)),this._styleExpression.evaluate(e,t,r,i,n,o)}}class nn{constructor(e,t,r,i,n){this.kind=e,this.zoomStops=r,this._styleExpression=t,this.isStateDependent="camera"!==e&&!zi(t.expression),this.globalStateRefs=ln(t.expression),this.interpolationType=i,this._globalState=n}evaluateWithoutErrorHandling(e,t,r,i,n,o){return this._globalState&&(e=cn(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,r,i,n,o)}evaluate(e,t,r,i,n,o){return this._globalState&&(e=cn(e,this._globalState)),this._styleExpression.evaluate(e,t,r,i,n,o)}interpolationFactor(e,t,r){return this.interpolationType?dr.interpolationFactor(this.interpolationType,e,t,r):0}}function on(e,t,r){const i=tn(e,t,r);if("error"===i.result)return i;const n=i.value.expression,o=Oi(n);if(!o&&!Vi(t))return ji([new De("","data expressions not supported")]);const a=Bi(n,["zoom"]);if(!a&&!Ui(t))return ji([new De("","zoom expressions not supported")]);const s=sn(n);return s||a?s instanceof De?ji([s]):s instanceof dr&&!Gi(t)?ji([new De("",'"interpolate" expressions cannot be used with this property')]):Ni(s?new nn(o?"camera":"composite",i.value,s.labels,s instanceof dr?s.interpolation:void 0,r):new rn(o?"constant":"source",i.value,r)):ji([new De("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class an{constructor(e,t){this._parameters=e,this._specification=t,Me(this,Zi(this._parameters,this._specification))}static deserialize(e){return new an(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function sn(e){let t=null;if(e instanceof Jt)t=sn(e.result);else if(e instanceof mr){for(const r of e.args)if(t=sn(r),t)break}else(e instanceof ar||e instanceof dr)&&e.input instanceof Ci&&"zoom"===e.input.name&&(t=e);return t instanceof De||e.eachChild(e=>{const r=sn(e);r instanceof De?t=r:!t&&r?t=new De("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&r&&t!==r&&(t=new De("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function ln(e,t=new Set){return e instanceof ki&&t.add(e.key),e.eachChild(e=>{ln(e,t)}),t}function cn(e,t){const{zoom:r,heatmapDensity:i,elevation:n,lineProgress:o,isSupportedScript:a,accumulated:s}=null!=e?e:{};return{zoom:r,heatmapDensity:i,elevation:n,lineProgress:o,isSupportedScript:a,accumulated:s,globalState:t}}function un(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(!un(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}}const hn={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function dn(e,t){if(null==e)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};un(e)||(e=mn(e));const r=tn(e,hn,t);if("error"===r.result)throw new Error(r.value.map(e=>`${e.key}: ${e.message}`).join(", "));return{filter:(e,t,i)=>r.value.evaluate(e,t,{},i),needGeometry:fn(e),getGlobalStateRefs:()=>ln(r.value.expression)}}function pn(e,t){return e<t?-1:e>t?1:0}function fn(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(fn(e[t]))return!0;return!1}function mn(e){if(!e)return!0;const t=e[0];return e.length<=1?"any"!==t:"=="===t?gn(e[1],e[2],"=="):"!="===t?vn(gn(e[1],e[2],"==")):"<"===t||">"===t||"<="===t||">="===t?gn(e[1],e[2],t):"any"===t?(r=e.slice(1),["any"].concat(r.map(mn))):"all"===t?["all"].concat(e.slice(1).map(mn)):"none"===t?["all"].concat(e.slice(1).map(mn).map(vn)):"in"===t?_n(e[1],e.slice(2)):"!in"===t?vn(_n(e[1],e.slice(2))):"has"===t?yn(e[1]):"!has"!==t||vn(yn(e[1]));var r}function gn(e,t,r){switch(e){case"$type":return[`filter-type-${r}`,t];case"$id":return[`filter-id-${r}`,t];default:return[`filter-${r}`,e,t]}}function _n(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(pn)]]:["filter-in-small",e,["literal",t]]}}function yn(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function vn(e){return["!",e]}function bn(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 r of e)t+=`${bn(r)},`;return`${t}]`}const r=Object.keys(e).sort();let i="{";for(let n=0;n<r.length;n++)i+=`${JSON.stringify(r[n])}:${bn(e[r[n]])},`;return`${i}}`}function xn(e){let t="";for(const r of ve)t+=`/${bn(e[r])}`;return t}function wn(e){const t=e.value;return t?[new Ce(e.key,t,"constants have been deprecated as of v8")]:[]}function Tn(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function Sn(e){if(Array.isArray(e))return e.map(Sn);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){const t={};for(const r in e)t[r]=Sn(e[r]);return t}return Tn(e)}function En(e){const t=e.key,r=e.value,i=e.valueSpec||{},n=e.objectElementValidators||{},o=e.style,a=e.styleSpec,s=e.validateSpec;let l=[];const c=qi(r);if("object"!==c)return[new Ce(t,r,`object expected, ${c} found`)];for(const u in r){const e=u.split(".")[0],c=yt(i,e)||i["*"];let h;if(yt(n,e))h=n[e];else if(yt(i,e))h=s;else if(n["*"])h=n["*"];else{if(!i["*"]){l.push(new Ce(t,r[u],`unknown property "${u}"`));continue}h=s}l=l.concat(h({key:(t?`${t}.`:t)+u,value:r[u],valueSpec:c,style:o,styleSpec:a,object:r,objectKey:u,validateSpec:s},r))}for(const u in i)n[u]||i[u].required&&void 0===i[u].default&&void 0===r[u]&&l.push(new Ce(t,r,`missing required property "${u}"`));return l}function In(e){const t=e.value,r=e.valueSpec,i=e.style,n=e.styleSpec,o=e.key,a=e.arrayElementValidator||e.validateSpec;if("array"!==qi(t))return[new Ce(o,t,`array expected, ${qi(t)} found`)];if(r.length&&t.length!==r.length)return[new Ce(o,t,`array length ${r.length} expected, length ${t.length} found`)];if(r["min-length"]&&t.length<r["min-length"])return[new Ce(o,t,`array length at least ${r["min-length"]} expected, length ${t.length} found`)];let s={type:r.value,values:r.values};n.$version<7&&(s.function=r.function),"object"===qi(r.value)&&(s=r.value);let l=[];for(let c=0;c<t.length;c++)l=l.concat(a({array:t,arrayIndex:c,value:t[c],valueSpec:s,validateSpec:e.validateSpec,style:i,styleSpec:n,key:`${o}[${c}]`}));return l}function Pn(e){const t=e.key,r=e.value,i=e.valueSpec;let n=qi(r);return"number"===n&&r!=r&&(n="NaN"),"number"!==n?[new Ce(t,r,`number expected, ${n} found`)]:"minimum"in i&&r<i.minimum?[new Ce(t,r,`${r} is less than the minimum value ${i.minimum}`)]:"maximum"in i&&r>i.maximum?[new Ce(t,r,`${r} is greater than the maximum value ${i.maximum}`)]:[]}function kn(e){const t=e.valueSpec,r=Tn(e.value.type);let i,n,o,a={};const s="categorical"!==r&&void 0===e.value.property,l=!s,c="array"===qi(e.value.stops)&&"array"===qi(e.value.stops[0])&&"object"===qi(e.value.stops[0][0]),u=En({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"===r)return[new Ce(e.key,e.value,'identity function may not have a "stops" property')];let t=[];const i=e.value;return t=t.concat(In({key:e.key,value:i,valueSpec:e.valueSpec,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:h})),"array"===qi(i)&&0===i.length&&t.push(new Ce(e.key,i,"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"===r&&s&&u.push(new Ce(e.key,e.value,'missing required property "property"')),"identity"===r||e.value.stops||u.push(new Ce(e.key,e.value,'missing required property "stops"')),"exponential"===r&&e.valueSpec.expression&&!Gi(e.valueSpec)&&u.push(new Ce(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!Vi(e.valueSpec)?u.push(new Ce(e.key,e.value,"property functions not supported")):s&&!Ui(e.valueSpec)&&u.push(new Ce(e.key,e.value,"zoom functions not supported"))),"categorical"!==r&&!c||void 0!==e.value.property||u.push(new Ce(e.key,e.value,'"property" property is required')),u;function h(e){let r=[];const i=e.value,s=e.key;if("array"!==qi(i))return[new Ce(s,i,`array expected, ${qi(i)} found`)];if(2!==i.length)return[new Ce(s,i,`array length 2 expected, length ${i.length} found`)];if(c){if("object"!==qi(i[0]))return[new Ce(s,i,`object expected, ${qi(i[0])} found`)];if(void 0===i[0].zoom)return[new Ce(s,i,"object stop key must have zoom")];if(void 0===i[0].value)return[new Ce(s,i,"object stop key must have value")];if(o&&o>Tn(i[0].zoom))return[new Ce(s,i[0].zoom,"stop zoom values must appear in ascending order")];Tn(i[0].zoom)!==o&&(o=Tn(i[0].zoom),n=void 0,a={}),r=r.concat(En({key:`${s}[0]`,value:i[0],valueSpec:{zoom:{}},validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:Pn,value:d}}))}else r=r.concat(d({key:`${s}[0]`,value:i[0],validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec},i));return en(Sn(i[1]))?r.concat([new Ce(`${s}[1]`,i[1],"expressions are not allowed in function stops.")]):r.concat(e.validateSpec({key:`${s}[1]`,value:i[1],valueSpec:t,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec}))}function d(e,o){const s=qi(e.value),l=Tn(e.value),c=null!==e.value?e.value:o;if(i){if(s!==i)return[new Ce(e.key,c,`${s} stop domain type must match previous stop domain type ${i}`)]}else i=s;if("number"!==s&&"string"!==s&&"boolean"!==s)return[new Ce(e.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==r){let i=`number expected, ${s} found`;return Vi(t)&&void 0===r&&(i+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ce(e.key,c,i)]}return"categorical"!==r||"number"!==s||isFinite(l)&&Math.floor(l)===l?"categorical"!==r&&"number"===s&&void 0!==n&&l<n?[new Ce(e.key,c,"stop domain values must appear in ascending order")]:(n=l,"categorical"===r&&l in a?[new Ce(e.key,c,"stop domain values must be unique")]:(a[l]=!0,[])):[new Ce(e.key,c,`integer expected, found ${l}`)]}}function An(e){const t=("property"===e.expressionContext?on:tn)(Sn(e.value),e.valueSpec);if("error"===t.result)return t.value.map(t=>new Ce(`${e.key}${t.key}`,e.value,t.message));const r=t.value.expression||t.value._styleExpression.expression;if("property"===e.expressionContext&&"text-font"===e.propertyKey&&!r.outputDefined())return[new Ce(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&&!zi(r))return[new Ce(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===e.expressionContext&&!zi(r))return[new Ce(e.key,e.value,'"feature-state" data expressions are not supported with filters.')];if(e.expressionContext&&0===e.expressionContext.indexOf("cluster")){if(!Bi(r,["zoom","feature-state"]))return[new Ce(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===e.expressionContext&&!Oi(r))return[new Ce(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Cn(e){const t=e.key,r=e.value,i=qi(r);return"string"!==i?[new Ce(t,r,`color expected, ${i} found`)]:It.parse(String(r))?[]:[new Ce(t,r,`color expected, "${r}" found`)]}function Mn(e){const t=e.key,r=e.value,i=e.valueSpec,n=[];return Array.isArray(i.values)?-1===i.values.indexOf(Tn(r))&&n.push(new Ce(t,r,`expected one of [${i.values.join(", ")}], ${JSON.stringify(r)} found`)):-1===Object.keys(i.values).indexOf(Tn(r))&&n.push(new Ce(t,r,`expected one of [${Object.keys(i.values).join(", ")}], ${JSON.stringify(r)} found`)),n}function Dn(e){return un(Sn(e.value))?An(Me({},e,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Rn(e)}function Rn(e){const t=e.value,r=e.key;if("array"!==qi(t))return[new Ce(r,t,`array expected, ${qi(t)} found`)];const i=e.styleSpec;let n,o=[];if(t.length<1)return[new Ce(r,t,"filter array must have at least 1 element")];switch(o=o.concat(Mn({key:`${r}[0]`,value:t[0],valueSpec:i.filter_operator,style:e.style,styleSpec:e.styleSpec})),Tn(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&"$type"===Tn(t[1])&&o.push(new Ce(r,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":3!==t.length&&o.push(new Ce(r,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(n=qi(t[1]),"string"!==n&&o.push(new Ce(`${r}[1]`,t[1],`string expected, ${n} found`)));for(let a=2;a<t.length;a++)n=qi(t[a]),"$type"===Tn(t[1])?o=o.concat(Mn({key:`${r}[${a}]`,value:t[a],valueSpec:i.geometry_type,style:e.style,styleSpec:e.styleSpec})):"string"!==n&&"number"!==n&&"boolean"!==n&&o.push(new Ce(`${r}[${a}]`,t[a],`string, number, or boolean expected, ${n} found`));break;case"any":case"all":case"none":for(let i=1;i<t.length;i++)o=o.concat(Rn({key:`${r}[${i}]`,value:t[i],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":n=qi(t[1]),2!==t.length?o.push(new Ce(r,t,`filter array for "${t[0]}" operator must have 2 elements`)):"string"!==n&&o.push(new Ce(`${r}[1]`,t[1],`string expected, ${n} found`))}return o}function Ln(e,t){const r=e.key,i=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 i({key:r,value:a,valueSpec:o.transition,style:n,styleSpec:o});const u=e.valueSpec||l[s];if(!u)return[new Ce(r,a,`unknown property "${s}"`)];let h;if("string"===qi(a)&&Vi(u)&&!u.tokens&&(h=/^{([^}]+)}$/.exec(a)))return[new Ce(r,a,`"${s}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(h[1])} }\`.`)];const d=[];return"symbol"===e.layerType&&"text-font"===s&&$i(Sn(a))&&"identity"===Tn(a.type)&&d.push(new Ce(r,a,'"text-font" does not support identity functions')),d.concat(i({key:e.key,value:a,valueSpec:u,style:n,styleSpec:o,expressionContext:"property",propertyType:t,propertyKey:s}))}function Fn(e){return Ln(e,"paint")}function On(e){return Ln(e,"layout")}function zn(e){let t=[];const r=e.value,i=e.key,n=e.style,o=e.styleSpec;if("object"!==qi(r))return[new Ce(i,r,`object expected, ${qi(r)} found`)];r.type||r.ref||t.push(new Ce(i,r,'either "type" or "ref" is required'));let a=Tn(r.type);const s=Tn(r.ref);if(r.id){const o=Tn(r.id);for(let a=0;a<e.arrayIndex;a++){const e=n.layers[a];Tn(e.id)===o&&t.push(new Ce(i,r.id,`duplicate layer id "${r.id}", previously used at line ${e.id.__line__}`))}}if("ref"in r){let e;["type","source","source-layer","filter","layout"].forEach(e=>{e in r&&t.push(new Ce(i,r[e],`"${e}" is prohibited for ref layers`))}),n.layers.forEach(t=>{Tn(t.id)===s&&(e=t)}),e?e.ref?t.push(new Ce(i,r.ref,"ref cannot reference another ref layer")):a=Tn(e.type):t.push(new Ce(i,r.ref,`ref layer "${s}" not found`))}else if("background"!==a)if(r.source){const e=n.sources&&n.sources[r.source],o=e&&Tn(e.type);e?"vector"===o&&"raster"===a?t.push(new Ce(i,r.source,`layer "${r.id}" requires a raster source`)):"raster-dem"!==o&&"hillshade"===a||"raster-dem"!==o&&"color-relief"===a?t.push(new Ce(i,r.source,`layer "${r.id}" requires a raster-dem source`)):"raster"===o&&"raster"!==a?t.push(new Ce(i,r.source,`layer "${r.id}" requires a vector source`)):"vector"!==o||r["source-layer"]?"raster-dem"===o&&"hillshade"!==a&&"color-relief"!==a?t.push(new Ce(i,r.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):"line"!==a||!r.paint||!r.paint["line-gradient"]||"geojson"===o&&e.lineMetrics||t.push(new Ce(i,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new Ce(i,r,`layer "${r.id}" must specify a "source-layer"`)):t.push(new Ce(i,r.source,`source "${r.source}" not found`))}else t.push(new Ce(i,r,'missing required property "source"'));return t=t.concat(En({key:i,value:r,valueSpec:o.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":()=>[],type:()=>e.validateSpec({key:`${i}.type`,value:r.type,valueSpec:o.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:r,objectKey:"type"}),filter:Dn,layout:e=>En({layer:r,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>On(Me({layerType:a},e))}}),paint:e=>En({layer:r,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>Fn(Me({layerType:a},e))}})}})),t}function Bn(e){const t=e.value,r=e.key,i=qi(t);return"string"!==i?[new Ce(r,t,`string expected, ${i} found`)]:[]}const Nn={promoteId:function({key:e,value:t}){if("string"===qi(t))return Bn({key:e,value:t});{const r=[];for(const i in t)r.push(...Bn({key:`${e}.${i}`,value:t[i]}));return r}}};function jn(e){const t=e.value,r=e.key,i=e.styleSpec,n=e.style,o=e.validateSpec;if(!t.type)return[new Ce(r,t,'"type" is required')];const a=Tn(t.type);let s;switch(a){case"vector":case"raster":return s=En({key:r,value:t,valueSpec:i[`source_${a.replace("-","_")}`],style:e.style,styleSpec:i,objectElementValidators:Nn,validateSpec:o}),s;case"raster-dem":return s=function(e){var t;const r=null!==(t=e.sourceName)&&void 0!==t?t:"",i=e.value,n=e.styleSpec,o=n.source_raster_dem,a=e.style;let s=[];const l=qi(i);if(void 0===i)return s;if("object"!==l)return s.push(new Ce("source_raster_dem",i,`object expected, ${l} found`)),s;const c="custom"===Tn(i.encoding),u=["redFactor","greenFactor","blueFactor","baseShift"],h=e.value.encoding?`"${e.value.encoding}"`:"Default";for(const d in i)!c&&u.includes(d)?s.push(new Ce(d,i[d],`In "${r}": "${d}" is only valid when "encoding" is set to "custom". ${h} encoding found`)):o[d]?s=s.concat(e.validateSpec({key:d,value:i[d],valueSpec:o[d],validateSpec:e.validateSpec,style:a,styleSpec:n})):s.push(new Ce(d,i[d],`unknown property "${d}"`));return s}({sourceName:r,value:t,style:e.style,styleSpec:i,validateSpec:o}),s;case"geojson":if(s=En({key:r,value:t,valueSpec:i.source_geojson,style:n,styleSpec:i,validateSpec:o,objectElementValidators:Nn}),t.cluster)for(const e in t.clusterProperties){const[i,n]=t.clusterProperties[e],o="string"==typeof i?[i,["accumulated"],["get",e]]:i;s.push(...An({key:`${r}.${e}.map`,value:n,expressionContext:"cluster-map"})),s.push(...An({key:`${r}.${e}.reduce`,value:o,expressionContext:"cluster-reduce"}))}return s;case"video":return En({key:r,value:t,valueSpec:i.source_video,style:n,validateSpec:o,styleSpec:i});case"image":return En({key:r,value:t,valueSpec:i.source_image,style:n,validateSpec:o,styleSpec:i});case"canvas":return[new Ce(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Mn({key:`${r}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function Vn(e){const t=e.value,r=e.styleSpec,i=r.light,n=e.style;let o=[];const a=qi(t);if(void 0===t)return o;if("object"!==a)return o=o.concat([new Ce("light",t,`object expected, ${a} found`)]),o;for(const s in t){const a=s.match(/^(.*)-transition$/);o=o.concat(a&&i[a[1]]&&i[a[1]].transition?e.validateSpec({key:s,value:t[s],valueSpec:r.transition,validateSpec:e.validateSpec,style:n,styleSpec:r}):i[s]?e.validateSpec({key:s,value:t[s],valueSpec:i[s],validateSpec:e.validateSpec,style:n,styleSpec:r}):[new Ce(s,t[s],`unknown property "${s}"`)])}return o}function Un(e){const t=e.value,r=e.styleSpec,i=r.sky,n=e.style,o=qi(t);if(void 0===t)return[];if("object"!==o)return[new Ce("sky",t,`object expected, ${o} found`)];let a=[];for(const s in t)a=a.concat(i[s]?e.validateSpec({key:s,value:t[s],valueSpec:i[s],style:n,styleSpec:r}):[new Ce(s,t[s],`unknown property "${s}"`)]);return a}function Gn(e){const t=e.value,r=e.styleSpec,i=r.terrain,n=e.style;let o=[];const a=qi(t);if(void 0===t)return o;if("object"!==a)return o=o.concat([new Ce("terrain",t,`object expected, ${a} found`)]),o;for(const s in t)o=o.concat(i[s]?e.validateSpec({key:s,value:t[s],valueSpec:i[s],validateSpec:e.validateSpec,style:n,styleSpec:r}):[new Ce(s,t[s],`unknown property "${s}"`)]);return o}function qn(e){let t=[];const r=e.value,i=e.key;if(Array.isArray(r)){const n=[],o=[];for(const a in r)r[a].id&&n.includes(r[a].id)&&t.push(new Ce(i,r,`all the sprites' ids must be unique, but ${r[a].id} is duplicated`)),n.push(r[a].id),r[a].url&&o.includes(r[a].url)&&t.push(new Ce(i,r,`all the sprites' URLs must be unique, but ${r[a].url} is duplicated`)),o.push(r[a].url),t=t.concat(En({key:`${i}[${a}]`,value:r[a],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:e.validateSpec}));return t}return Bn({key:i,value:r})}function $n(e){return t=e.value,Boolean(t)&&t.constructor===Object?[]:[new Ce(e.key,e.value,`object expected, ${qi(e.value)} found`)];var t}const Wn={"*":()=>[],array:In,boolean:function(e){const t=e.value,r=e.key,i=qi(t);return"boolean"!==i?[new Ce(r,t,`boolean expected, ${i} found`)]:[]},number:Pn,color:Cn,constants:wn,enum:Mn,filter:Dn,function:kn,layer:zn,object:En,source:jn,light:Vn,sky:Un,terrain:Gn,projection:function(e){const t=e.value,r=e.styleSpec,i=r.projection,n=e.style,o=qi(t);if(void 0===t)return[];if("object"!==o)return[new Ce("projection",t,`object expected, ${o} found`)];let a=[];for(const s in t)a=a.concat(i[s]?e.validateSpec({key:s,value:t[s],valueSpec:i[s],style:n,styleSpec:r}):[new Ce(s,t[s],`unknown property "${s}"`)]);return a},projectionDefinition:function(e){const t=e.key;let r=e.value;r=r instanceof String?r.valueOf():r;const i=qi(r);return"array"!==i||function(e){return Array.isArray(e)&&3===e.length&&"string"==typeof e[0]&&"string"==typeof e[1]&&"number"==typeof e[2]}(r)||function(e){return!!["interpolate","step","literal"].includes(e[0])}(r)?["array","string"].includes(i)?[]:[new Ce(t,r,`projection expected, invalid type "${i}" found`)]:[new Ce(t,r,`projection expected, invalid array ${JSON.stringify(r)} found`)]},string:Bn,formatted:function(e){return 0===Bn(e).length?[]:An(e)},resolvedImage:function(e){return 0===Bn(e).length?[]:An(e)},padding:function(e){const t=e.key,r=e.value;if("array"===qi(r)){if(r.length<1||r.length>4)return[new Ce(t,r,`padding requires 1 to 4 values; ${r.length} values found`)];const i={type:"number"};let n=[];for(let o=0;o<r.length;o++)n=n.concat(e.validateSpec({key:`${t}[${o}]`,value:r[o],validateSpec:e.validateSpec,valueSpec:i}));return n}return Pn({key:t,value:r,valueSpec:{}})},numberArray:function(e){const t=e.key,r=e.value;if("array"===qi(r)){const i={type:"number"};if(r.length<1)return[new Ce(t,r,"array length at least 1 expected, length 0 found")];let n=[];for(let o=0;o<r.length;o++)n=n.concat(e.validateSpec({key:`${t}[${o}]`,value:r[o],validateSpec:e.validateSpec,valueSpec:i}));return n}return Pn({key:t,value:r,valueSpec:{}})},colorArray:function(e){const t=e.key,r=e.value;if("array"===qi(r)){if(r.length<1)return[new Ce(t,r,"array length at least 1 expected, length 0 found")];let e=[];for(let i=0;i<r.length;i++)e=e.concat(Cn({key:`${t}[${i}]`,value:r[i]}));return e}return Cn({key:t,value:r})},variableAnchorOffsetCollection:function(e){const t=e.key,r=e.value,i=qi(r),n=e.styleSpec;if("array"!==i||r.length<1||r.length%2!=0)return[new Ce(t,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let o=[];for(let a=0;a<r.length;a+=2)o=o.concat(Mn({key:`${t}[${a}]`,value:r[a],valueSpec:n.layout_symbol["text-anchor"]})),o=o.concat(In({key:`${t}[${a+1}]`,value:r[a+1],valueSpec:{length:2,value:"number"},validateSpec:e.validateSpec,style:e.style,styleSpec:n}));return o},sprite:qn,state:$n};function Zn(e){const t=e.value,r=e.valueSpec,i=e.styleSpec;return e.validateSpec=Zn,r.expression&&$i(Tn(t))?kn(e):r.expression&&en(Sn(t))?An(e):r.type&&Wn[r.type]?Wn[r.type](e):En(Me({},e,{valueSpec:r.type?i[r.type]:r}))}function Hn(e){const t=e.value,r=e.key,i=Bn(e);return i.length||(-1===t.indexOf("{fontstack}")&&i.push(new Ce(r,t,'"glyphs" url must include a "{fontstack}" token')),-1===t.indexOf("{range}")&&i.push(new Ce(r,t,'"glyphs" url must include a "{range}" token'))),i}function Xn(e,t=ye){let r=[];return r=r.concat(Zn({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,validateSpec:Zn,objectElementValidators:{glyphs:Hn,"*":()=>[]}})),e.constants&&(r=r.concat(wn({key:"constants",value:e.constants}))),Jn(r)}function Yn(e){return function(t){return e(Object.assign({},t,{validateSpec:Zn}))}}function Jn(e){return[].concat(e).sort((e,t)=>e.line-t.line)}function Kn(e){return function(...t){return Jn(e.apply(this,t))}}Xn.source=Kn(Yn(jn)),Xn.sprite=Kn(Yn(qn)),Xn.glyphs=Kn(Yn(Hn)),Xn.light=Kn(Yn(Vn)),Xn.sky=Kn(Yn(Un)),Xn.terrain=Kn(Yn(Gn)),Xn.state=Kn(Yn($n)),Xn.layer=Kn(Yn(zn)),Xn.filter=Kn(Yn(Dn)),Xn.paintProperty=Kn(Yn(Fn)),Xn.layoutProperty=Kn(Yn(On));const Qn=ye,eo=Xn,to=eo.light,ro=eo.sky,io=eo.paintProperty,no=eo.layoutProperty;function oo(e,t){let r=!1;if(t&&t.length)for(const i of t)e.fire(new ge(new Error(i.message))),r=!0;return r}class ao{constructor(e,t,r){const i=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const n=new Int32Array(this.arrayBuffer);e=n[0],this.d=(t=n[1])+2*(r=n[2]);for(let e=0;e<this.d*this.d;e++){const t=n[3+e],r=n[3+e+1];i.push(t===r?null:n.subarray(t,r))}const o=n[3+i.length+1];this.keys=n.subarray(n[3+i.length],o),this.bboxes=n.subarray(o),this.insert=this._insertReadonly}else{this.d=t+2*r;for(let e=0;e<this.d*this.d;e++)i.push([]);this.keys=[],this.bboxes=[]}this.n=t,this.extent=e,this.padding=r,this.scale=t/e,this.uid=0;const n=r/t*e;this.min=-n,this.max=e+n}insert(e,t,r,i,n){this._forEachCell(t,r,i,n,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(t),this.bboxes.push(r),this.bboxes.push(i),this.bboxes.push(n)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,t,r,i,n,o){this.cells[n].push(o)}query(e,t,r,i,n){const o=this.min,a=this.max;if(e<=o&&t<=o&&a<=r&&a<=i&&!n)return Array.prototype.slice.call(this.keys);{const o=[];return this._forEachCell(e,t,r,i,this._queryCell,o,{},n),o}}_queryCell(e,t,r,i,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]&&r>=c[l+0]&&i>=c[l+1])?(a[h]=!0,o.push(n[h])):a[h]=!1}}}}_forEachCell(e,t,r,i,n,o,a,s){const l=this._convertToCellCoord(e),c=this._convertToCellCoord(t),u=this._convertToCellCoord(r),h=this._convertToCellCoord(i);for(let d=l;d<=u;d++)for(let l=c;l<=h;l++){const c=this.d*l+d;if((!s||s(this._convertFromCellCoord(d),this._convertFromCellCoord(l),this._convertFromCellCoord(d+1),this._convertFromCellCoord(l+1)))&&n.call(this,e,t,r,i,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 r=0;for(let o=0;o<this.cells.length;o++)r+=this.cells[o].length;const i=new Int32Array(t+r+this.keys.length+this.bboxes.length);i[0]=this.extent,i[1]=this.n,i[2]=this.padding;let n=t;for(let o=0;o<e.length;o++){const t=e[o];i[3+o]=n,i.set(t,n),n+=t.length}return i[3+e.length]=n,i.set(this.keys,n),n+=this.keys.length,i[3+e.length+1]=n,i.set(this.bboxes,n),n+=this.bboxes.length,i.buffer}static serialize(e,t){const r=e.toArrayBuffer();return t&&t.push(r),{buffer:r}}static deserialize(e){return new ao(e.buffer)}}const so={};function lo(e,t,r={}){if(so[e])throw new Error(`${e} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:e,writeable:!1}),so[e]={klass:t,omit:r.omit||[],shallow:r.shallow||[]}}lo("Object",Object),lo("Set",Set),lo("TransferableGridIndex",ao),lo("Color",It),lo("Error",Error),lo("AJAXError",ce),lo("ResolvedImage",zt),lo("StylePropertyFunction",an),lo("StyleExpression",Qi,{omit:["_evaluator"]}),lo("ZoomDependentExpression",nn),lo("ZoomConstantExpression",rn),lo("CompoundExpression",Ci,{omit:["_evaluate"]});for(const _f in Ai)Ai[_f]._classRegistryKey||lo(`Expression_${_f}`,Ai[_f]);function co(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}function uo(e){return e.$name||e.constructor._classRegistryKey}function ho(e){return!function(e){if(null===e||"object"!=typeof e)return!1;const t=uo(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||co(e)||H(e)||ArrayBuffer.isView(e)||e instanceof ImageData)}function po(e,t){if(ho(e))return(co(e)||H(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 r=[];for(const i of e)r.push(po(i,t));return r}if("object"!=typeof e)throw new Error("can't serialize object of type "+typeof e);const r=uo(e);if(!r)throw new Error(`can't serialize object of unregistered class ${e.constructor.name}`);if(!so[r])throw new Error(`${r} is not registered.`);const{klass:i}=so[r],n=i.serialize?i.serialize(e,t):{};if(i.serialize){if(t&&n===t[t.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const i in e){if(!e.hasOwnProperty(i))continue;if(so[r].omit.indexOf(i)>=0)continue;const o=e[i];n[i]=so[r].shallow.indexOf(i)>=0?o:po(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"!==r&&(n.$name=r),n}function fo(e){if(ho(e))return e;if(Array.isArray(e))return e.map(fo);if("object"!=typeof e)throw new Error("can't deserialize object of type "+typeof e);const t=uo(e)||"Object";if(!so[t])throw new Error(`can't deserialize unregistered class ${t}`);const{klass:r}=so[t];if(!r)throw new Error(`can't deserialize unregistered class ${t}`);if(r.deserialize)return r.deserialize(e);const i=Object.create(r.prototype);for(const n of Object.keys(e)){if("$name"===n)continue;const r=e[n];i[n]=so[t].shallow.indexOf(n)>=0?r:fo(r)}return i}class mo{constructor(){this.first=!0}update(e,t){const r=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=t):this.lastFloorZoom<r&&(this.lastIntegerZoom=r,this.lastIntegerZoomTime=t),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=r,!0))}}function go(e){return/[\u02EA\u02EB\u2E80-\u2FDF\u2FF0-\u303F\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FD-\u30FF\u3105-\u312F\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(e))}function _o(e){return/[\u02EA\u02EB\u1100-\u11FF\u1400-\u167F\u18B0-\u18F5\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u3007\u3012\u3013\u3020-\u302F\u3031-\u303F\u3041-\u3096\u309D-\u30FB\u30FD-\u30FF\u3105-\u312F\u3131-\u318E\u3190-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE48\uFE50-\uFE57\uFE5F-\uFE62\uFE67-\uFE6F\uFF00-\uFF07\uFF0A-\uFF0C\uFF0E-\uFF19\uFF1F-\uFF3A\uFF3C\uFF3E\uFF40-\uFF5A\uFFE0-\uFFE2\uFFE4-\uFFE7]|\uD802[\uDD80-\uDD9F]|\uD805[\uDD80-\uDDFF]|\uD806[\uDE00-\uDEBF]|\uD811[\uDC00-\uDE7F]|\uD81B[\uDFE0-\uDFE4\uDFF0-\uDFF6]|[\uD81C-\uD822\uD83D\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD30-\uDEFB]|\uD833[\uDEC0-\uDFCF]|\uD834[\uDC00-\uDDFF\uDEE0-\uDF7F]|\uD836[\uDC00-\uDEAF]|\uD83C[\uDC00-\uDE00\uDF00-\uDFFF]|\uD83E[\uDD00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(e))}function yo(e){return/\s/u.test(String.fromCodePoint(e))}function vo(e){for(const t of e)if(_o(t.codePointAt(0)))return!0;return!1}function bo(e){for(const t of e)if(!To(t.codePointAt(0)))return!1;return!0}function xo(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 wo=xo(["Arab","Dupl","Mong","Ougr","Syrc"]);function To(e){return!wo.test(String.fromCodePoint(e))}function So(e){return!(_o(e)||(t=e,/[\xA7\xA9\xAE\xB1\xBC-\xBE\xD7\xF7\u2016\u2020\u2021\u2030\u2031\u203B\u203C\u2042\u2047-\u2049\u2051\u2100-\u218F\u221E\u2234\u2235\u2300-\u2307\u230C-\u231F\u2324-\u2328\u232B\u237D-\u239A\u23BE-\u23CD\u23CF\u23D1-\u23DB\u23E2-\u2422\u2424-\u24FF\u25A0-\u2619\u2620-\u2767\u2776-\u2793\u2B12-\u2B2F\u2B50-\u2B59\u2BB8-\u2BEB\u3000-\u303F\u30A0-\u30FF\uE000-\uF8FF\uFE30-\uFE6F\uFF00-\uFFEF\uFFFC\uFFFD]|[\uDB80-\uDBFF][\uDC00-\uDFFF]/gim.test(String.fromCodePoint(t))));var t}const Eo=xo(["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 Io(e){return Eo.test(String.fromCodePoint(e))}function Po(e,t){return!(!t&&Io(e)||/[\u0900-\u0DFF\u0F00-\u109F\u1780-\u17FF]/gim.test(String.fromCodePoint(e)))}function ko(e){for(const t of e)if(Io(t.codePointAt(0)))return!0;return!1}const Ao=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(Ao.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,r){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,i=new Promise(e=>{this.loadScriptResolve=e});r(t);const n=new Promise(e=>setTimeout(()=>e(),this.TIMEOUT));if(yield Promise.race([i,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 Co{constructor(e,t){this.isSupportedScript=Mo,this.zoom=e,t?(this.now=t.now||0,this.fadeDuration=t.fadeDuration||0,this.zoomHistory=t.zoomHistory||new mo,this.transition=t.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new mo,this.transition={})}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),r=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:t+(1-t)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*t}}}function Mo(e){return function(e,t){for(const r of e)if(!Po(r.codePointAt(0),t))return!1;return!0}(e,"loaded"===Ao.getRTLTextPluginStatus())}const Do="-transition";class Ro{constructor(e,t,r){this.property=e,this.value=t,this.expression=function(e,t,r){if($i(e))return new an(e,t);if(en(e)){const i=on(e,t,r);if("error"===i.result)throw new Error(i.value.map(e=>`${e.key}: ${e.message}`).join(", "));return i.value}{let r=e;return"color"===t.type&&"string"==typeof e?r=It.parse(e):"padding"!==t.type||"number"!=typeof e&&!Array.isArray(e)?"numberArray"!==t.type||"number"!=typeof e&&!Array.isArray(e)?"colorArray"!==t.type||"string"!=typeof e&&!Array.isArray(e)?"variableAnchorOffsetCollection"===t.type&&Array.isArray(e)?r=Ot.parse(e):"projectionDefinition"===t.type&&"string"==typeof e&&(r=Bt.parse(e)):r=Rt.parse(e):r=Dt.parse(e):r=Mt.parse(e),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>r}}}(void 0===t?e.specification.default:t,e.specification,r)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(e,t,r){return this.property.possiblyEvaluate(this,e,t,r)}}class Lo{constructor(e,t){this.property=e,this.value=new Ro(e,void 0,t)}transitioned(e,t){return new Oo(this.property,this.value,t,B({},e.transition,this.transition),e.now)}untransitioned(){return new Oo(this.property,this.value,null,{},0)}}class Fo{constructor(e,t){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._globalState=t}getValue(e){return U(this._values[e].value.value)}setValue(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Lo(this._values[e].property,this._globalState)),this._values[e].value=new Ro(this._values[e].property,null===t?void 0:U(t),this._globalState)}getTransition(e){return U(this._values[e].transition)}setTransition(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Lo(this._values[e].property,this._globalState)),this._values[e].transition=U(t)||void 0}serialize(){const e={};for(const t of Object.keys(this._values)){const r=this.getValue(t);void 0!==r&&(e[t]=r);const i=this.getTransition(t);void 0!==i&&(e[`${t}${Do}`]=i)}return e}transitioned(e,t){const r=new zo(this._properties);for(const i of Object.keys(this._values))r._values[i]=this._values[i].transitioned(e,t._values[i]);return r}untransitioned(){const e=new zo(this._properties);for(const t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}}class Oo{constructor(e,t,r,i,n){this.property=e,this.value=t,this.begin=n+i.delay||0,this.end=this.begin+i.duration||0,e.specification.transition&&(i.delay||i.duration)&&(this.prior=r)}possiblyEvaluate(e,t,r){const i=e.now||0,n=this.value.possiblyEvaluate(e,t,r),o=this.prior;if(o){if(i>this.end)return this.prior=null,n;if(this.value.isDataDriven())return this.prior=null,n;if(i<this.begin)return o.possiblyEvaluate(e,t,r);{const a=(i-this.begin)/(this.end-this.begin);return this.property.interpolate(o.possiblyEvaluate(e,t,r),n,R(a))}}return n}}class zo{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,r){const i=new jo(this._properties);for(const n of Object.keys(this._values))i._values[n]=this._values[n].possiblyEvaluate(e,t,r);return i}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Bo{constructor(e,t){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._globalState=t}hasValue(e){return void 0!==this._values[e].value}getValue(e){return U(this._values[e].value)}setValue(e,t){this._values[e]=new Ro(this._values[e].property,null===t?void 0:U(t),this._globalState)}serialize(){const e={};for(const t of Object.keys(this._values)){const r=this.getValue(t);void 0!==r&&(e[t]=r)}return e}possiblyEvaluate(e,t,r){const i=new jo(this._properties);for(const n of Object.keys(this._values))i._values[n]=this._values[n].possiblyEvaluate(e,t,r);return i}}class No{constructor(e,t,r){this.property=e,this.value=t,this.parameters=r}isConstant(){return"constant"===this.value.kind}constantOr(e){return"constant"===this.value.kind?this.value.value:e}evaluate(e,t,r,i){return this.property.evaluate(this.value,this.parameters,e,t,r,i)}}class jo{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Vo{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,r){const i=fr[this.specification.type];return i?i(e,t,r):e}}class Uo{constructor(e,t){this.specification=e,this.overrides=t}possiblyEvaluate(e,t,r,i){return new No(this,"constant"===e.expression.kind||"camera"===e.expression.kind?{kind:"constant",value:e.expression.evaluate(t,null,{},r,i)}:e.expression,t)}interpolate(e,t,r){if("constant"!==e.value.kind||"constant"!==t.value.kind)return e;if(void 0===e.value.value||void 0===t.value.value)return new No(this,{kind:"constant",value:void 0},e.parameters);const i=fr[this.specification.type];if(i){const n=i(e.value.value,t.value.value,r);return new No(this,{kind:"constant",value:n},e.parameters)}return e}evaluate(e,t,r,i,n,o){return"constant"===e.kind?e.value:e.evaluate(t,r,i,n,o)}}class Go extends Uo{possiblyEvaluate(e,t,r,i){if(void 0===e.value)return new No(this,{kind:"constant",value:void 0},t);if("constant"===e.expression.kind){const n=e.expression.evaluate(t,null,{},r,i),o="resolvedImage"===e.property.specification.type&&"string"!=typeof n?n.name:n,a=this._calculate(o,o,o,t);return new No(this,{kind:"constant",value:a},t)}if("camera"===e.expression.kind){const r=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 No(this,{kind:"constant",value:r},t)}return new No(this,e.expression,t)}evaluate(e,t,r,i,n,o){if("source"===e.kind){const a=e.evaluate(t,r,i,n,o);return this._calculate(a,a,a,t)}return"composite"===e.kind?this._calculate(e.evaluate({zoom:Math.floor(t.zoom)-1},r,i),e.evaluate({zoom:Math.floor(t.zoom)},r,i),e.evaluate({zoom:Math.floor(t.zoom)+1},r,i),t):e.value}_calculate(e,t,r,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:r,to:t}}interpolate(e){return e}}class qo{constructor(e){this.specification=e}possiblyEvaluate(e,t,r,i){if(void 0!==e.value){if("constant"===e.expression.kind){const n=e.expression.evaluate(t,null,{},r,i);return this._calculate(n,n,n,t)}return this._calculate(e.expression.evaluate(new Co(Math.floor(t.zoom-1),t)),e.expression.evaluate(new Co(Math.floor(t.zoom),t)),e.expression.evaluate(new Co(Math.floor(t.zoom+1),t)),t)}}_calculate(e,t,r,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:r,to:t}}interpolate(e){return e}}class $o{constructor(e){this.specification=e}possiblyEvaluate(e,t,r,i){return!!e.expression.evaluate(t,null,{},r,i)}interpolate(){return!1}}class Wo{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const t in e){const r=e[t];r.specification.overridable&&this.overridableProperties.push(t);const i=this.defaultPropertyValues[t]=new Ro(r,void 0,void 0),n=this.defaultTransitionablePropertyValues[t]=new Lo(r,void 0);this.defaultTransitioningPropertyValues[t]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[t]=i.possiblyEvaluate({})}}}lo("DataDrivenProperty",Uo),lo("DataConstantProperty",Vo),lo("CrossFadedDataDrivenProperty",Go),lo("CrossFadedProperty",qo),lo("ColorRampProperty",$o);class Zo extends _e{constructor(e,t,r){if(super(),this.id=e.id,this.type=e.type,this._globalState=r,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},"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,this._featureFilter=dn(e.filter,r)),t.layout&&(this._unevaluatedLayout=new Bo(t.layout,r)),t.paint)){this._transitionablePaint=new Fo(t.paint,r);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 jo(t.paint)}}setFilter(e){this.filter=e,this._featureFilter=dn(e,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return"visibility"===e?this.visibility:this._unevaluatedLayout.getValue(e)}getLayoutAffectingGlobalStateRefs(){const e=new Set;if(this._unevaluatedLayout)for(const t in this._unevaluatedLayout._values){const r=this._unevaluatedLayout._values[t];for(const t of r.getGlobalStateRefs())e.add(t)}for(const t of this._featureFilter.getGlobalStateRefs())e.add(t);return e}getPaintAffectingGlobalStateRefs(){var e;const t=new globalThis.Map;if(this._transitionablePaint)for(const r in this._transitionablePaint._values){const i=this._transitionablePaint._values[r].value;for(const n of i.getGlobalStateRefs()){const o=null!==(e=t.get(n))&&void 0!==e?e:[];o.push({name:r,value:i.value}),t.set(n,o)}}return t}setLayoutProperty(e,t,r={}){null!=t&&this._validate(no,`layers.${this.id}.layout.${e}`,e,t,r)||("visibility"!==e?this._unevaluatedLayout.setValue(e,t):this.visibility=t)}getPaintProperty(e){return e.endsWith(Do)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,t,r={}){if(null!=t&&this._validate(io,`layers.${this.id}.paint.${e}`,e,t,r))return!1;if(e.endsWith(Do))return this._transitionablePaint.setTransition(e.slice(0,-11),t||void 0),!1;{const r=this._transitionablePaint._values[e],i="cross-faded-data-driven"===r.property.specification["property-type"],n=r.value.isDataDriven(),o=r.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);const a=this._transitionablePaint._values[e].value;return a.isDataDriven()||n||i||this._handleOverridablePaintPropertyUpdate(e,o,a)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,t,r){return!1}isHidden(e,t=!1){return!!(this.minzoom&&e<(t?Math.floor(this.minzoom):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),V(e,(e,t)=>!(void 0===e||"layout"===t&&!Object.keys(e).length||"paint"===t&&!Object.keys(e).length))}_validate(e,t,r,i,n={}){return(!n||!1!==n.validate)&&oo(this,e.call(eo,{key:t,layerType:this.type,objectKey:r,value:i,styleSpec:ye,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const t=this.paint.get(e);if(t instanceof No&&Vi(t.property.specification)&&("source"===t.value.kind||"composite"===t.value.kind)&&t.value.isStateDependent)return!0}return!1}}let Ho;var Xo={get paint(){return Ho=Ho||new Wo({"raster-opacity":new Vo(ye.paint_raster["raster-opacity"]),"raster-hue-rotate":new Vo(ye.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Vo(ye.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Vo(ye.paint_raster["raster-brightness-max"]),"raster-saturation":new Vo(ye.paint_raster["raster-saturation"]),"raster-contrast":new Vo(ye.paint_raster["raster-contrast"]),"raster-resampling":new Vo(ye.paint_raster["raster-resampling"]),"raster-fade-duration":new Vo(ye.paint_raster["raster-fade-duration"])})}};class Yo extends Zo{constructor(e,t){super(e,Xo,t)}}const Jo={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Ko{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 Qo{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 ea(e,t=1){let r=0,i=0;return{members:e.map(e=>{const n=Jo[e.type].BYTES_PER_ELEMENT,o=r=ta(r,Math.max(t,n)),a=e.components||1;return i=Math.max(i,n),r+=n*a,{name:e.name,type:e.type,components:a,offset:o}}),size:ta(r,Math.max(i,t)),alignment:t}}function ta(e,t){return Math.ceil(e/t)*t}class ra extends Qo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){const r=this.length;return this.resize(r+1),this.emplace(r,e,t)}emplace(e,t,r){const i=2*e;return this.int16[i+0]=t,this.int16[i+1]=r,e}}ra.prototype.bytesPerElement=4,lo("StructArrayLayout2i4",ra);class ia extends Qo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r){const i=this.length;return this.resize(i+1),this.emplace(i,e,t,r)}emplace(e,t,r,i){const n=3*e;return this.int16[n+0]=t,this.int16[n+1]=r,this.int16[n+2]=i,e}}ia.prototype.bytesPerElement=6,lo("StructArrayLayout3i6",ia);class na extends Qo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,r,i)}emplace(e,t,r,i,n){const o=4*e;return this.int16[o+0]=t,this.int16[o+1]=r,this.int16[o+2]=i,this.int16[o+3]=n,e}}na.prototype.bytesPerElement=8,lo("StructArrayLayout4i8",na);class oa extends Qo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,r,i,n,o)}emplace(e,t,r,i,n,o,a){const s=6*e;return this.int16[s+0]=t,this.int16[s+1]=r,this.int16[s+2]=i,this.int16[s+3]=n,this.int16[s+4]=o,this.int16[s+5]=a,e}}oa.prototype.bytesPerElement=12,lo("StructArrayLayout2i4i12",oa);class aa extends Qo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,r,i,n,o)}emplace(e,t,r,i,n,o,a){const s=4*e,l=8*e;return this.int16[s+0]=t,this.int16[s+1]=r,this.uint8[l+4]=i,this.uint8[l+5]=n,this.uint8[l+6]=o,this.uint8[l+7]=a,e}}aa.prototype.bytesPerElement=8,lo("StructArrayLayout2i4ub8",aa);class sa extends Qo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){const r=this.length;return this.resize(r+1),this.emplace(r,e,t)}emplace(e,t,r){const i=2*e;return this.float32[i+0]=t,this.float32[i+1]=r,e}}sa.prototype.bytesPerElement=8,lo("StructArrayLayout2f8",sa);class la extends Qo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,o,a,s,l,c){const u=this.length;return this.resize(u+1),this.emplace(u,e,t,r,i,n,o,a,s,l,c)}emplace(e,t,r,i,n,o,a,s,l,c,u){const h=10*e;return this.uint16[h+0]=t,this.uint16[h+1]=r,this.uint16[h+2]=i,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}}la.prototype.bytesPerElement=20,lo("StructArrayLayout10ui20",la);class ca extends Qo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,o,a,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,t,r,i,n,o,a,s)}emplace(e,t,r,i,n,o,a,s,l){const c=8*e;return this.uint16[c+0]=t,this.uint16[c+1]=r,this.uint16[c+2]=i,this.uint16[c+3]=n,this.uint16[c+4]=o,this.uint16[c+5]=a,this.uint16[c+6]=s,this.uint16[c+7]=l,e}}ca.prototype.bytesPerElement=16,lo("StructArrayLayout8ui16",ca);class ua extends Qo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,o,a,s,l,c,u,h){const d=this.length;return this.resize(d+1),this.emplace(d,e,t,r,i,n,o,a,s,l,c,u,h)}emplace(e,t,r,i,n,o,a,s,l,c,u,h,d){const p=12*e;return this.int16[p+0]=t,this.int16[p+1]=r,this.int16[p+2]=i,this.int16[p+3]=n,this.uint16[p+4]=o,this.uint16[p+5]=a,this.uint16[p+6]=s,this.uint16[p+7]=l,this.int16[p+8]=c,this.int16[p+9]=u,this.int16[p+10]=h,this.int16[p+11]=d,e}}ua.prototype.bytesPerElement=24,lo("StructArrayLayout4i4ui4i24",ua);class ha extends Qo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r){const i=this.length;return this.resize(i+1),this.emplace(i,e,t,r)}emplace(e,t,r,i){const n=3*e;return this.float32[n+0]=t,this.float32[n+1]=r,this.float32[n+2]=i,e}}ha.prototype.bytesPerElement=12,lo("StructArrayLayout3f12",ha);class da extends Qo{_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}}da.prototype.bytesPerElement=4,lo("StructArrayLayout1ul4",da);class pa extends Qo{_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,r,i,n,o,a,s,l){const c=this.length;return this.resize(c+1),this.emplace(c,e,t,r,i,n,o,a,s,l)}emplace(e,t,r,i,n,o,a,s,l,c){const u=10*e,h=5*e;return this.int16[u+0]=t,this.int16[u+1]=r,this.int16[u+2]=i,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}}pa.prototype.bytesPerElement=20,lo("StructArrayLayout6i1ul2ui20",pa);class fa extends Qo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,r,i,n,o)}emplace(e,t,r,i,n,o,a){const s=6*e;return this.int16[s+0]=t,this.int16[s+1]=r,this.int16[s+2]=i,this.int16[s+3]=n,this.int16[s+4]=o,this.int16[s+5]=a,e}}fa.prototype.bytesPerElement=12,lo("StructArrayLayout2i2i2i12",fa);class ma extends Qo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,r,i,n)}emplace(e,t,r,i,n,o){const a=4*e,s=8*e;return this.float32[a+0]=t,this.float32[a+1]=r,this.float32[a+2]=i,this.int16[s+6]=n,this.int16[s+7]=o,e}}ma.prototype.bytesPerElement=16,lo("StructArrayLayout2f1f2i16",ma);class ga extends Qo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,r,i,n,o)}emplace(e,t,r,i,n,o,a){const s=16*e,l=4*e,c=8*e;return this.uint8[s+0]=t,this.uint8[s+1]=r,this.float32[l+1]=i,this.float32[l+2]=n,this.int16[c+6]=o,this.int16[c+7]=a,e}}ga.prototype.bytesPerElement=16,lo("StructArrayLayout2ub2f2i16",ga);class _a extends Qo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r){const i=this.length;return this.resize(i+1),this.emplace(i,e,t,r)}emplace(e,t,r,i){const n=3*e;return this.uint16[n+0]=t,this.uint16[n+1]=r,this.uint16[n+2]=i,e}}_a.prototype.bytesPerElement=6,lo("StructArrayLayout3ui6",_a);class ya extends Qo{_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,r,i,n,o,a,s,l,c,u,h,d,p,f,m,g){const _=this.length;return this.resize(_+1),this.emplace(_,e,t,r,i,n,o,a,s,l,c,u,h,d,p,f,m,g)}emplace(e,t,r,i,n,o,a,s,l,c,u,h,d,p,f,m,g,_){const y=24*e,v=12*e,b=48*e;return this.int16[y+0]=t,this.int16[y+1]=r,this.uint16[y+2]=i,this.uint16[y+3]=n,this.uint32[v+2]=o,this.uint32[v+3]=a,this.uint32[v+4]=s,this.uint16[y+10]=l,this.uint16[y+11]=c,this.uint16[y+12]=u,this.float32[v+7]=h,this.float32[v+8]=d,this.uint8[b+36]=p,this.uint8[b+37]=f,this.uint8[b+38]=m,this.uint32[v+10]=g,this.int16[y+22]=_,e}}ya.prototype.bytesPerElement=48,lo("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",ya);class va extends Qo{_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,r,i,n,o,a,s,l,c,u,h,d,p,f,m,g,_,y,v,b,x,w,T,S,E,I,P){const k=this.length;return this.resize(k+1),this.emplace(k,e,t,r,i,n,o,a,s,l,c,u,h,d,p,f,m,g,_,y,v,b,x,w,T,S,E,I,P)}emplace(e,t,r,i,n,o,a,s,l,c,u,h,d,p,f,m,g,_,y,v,b,x,w,T,S,E,I,P,k){const A=32*e,C=16*e;return this.int16[A+0]=t,this.int16[A+1]=r,this.int16[A+2]=i,this.int16[A+3]=n,this.int16[A+4]=o,this.int16[A+5]=a,this.int16[A+6]=s,this.int16[A+7]=l,this.uint16[A+8]=c,this.uint16[A+9]=u,this.uint16[A+10]=h,this.uint16[A+11]=d,this.uint16[A+12]=p,this.uint16[A+13]=f,this.uint16[A+14]=m,this.uint16[A+15]=g,this.uint16[A+16]=_,this.uint16[A+17]=y,this.uint16[A+18]=v,this.uint16[A+19]=b,this.uint16[A+20]=x,this.uint16[A+21]=w,this.uint16[A+22]=T,this.uint32[C+12]=S,this.float32[C+13]=E,this.float32[C+14]=I,this.uint16[A+30]=P,this.uint16[A+31]=k,e}}va.prototype.bytesPerElement=64,lo("StructArrayLayout8i15ui1ul2f2ui64",va);class ba extends Qo{_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}}ba.prototype.bytesPerElement=4,lo("StructArrayLayout1f4",ba);class xa extends Qo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r){const i=this.length;return this.resize(i+1),this.emplace(i,e,t,r)}emplace(e,t,r,i){const n=3*e;return this.uint16[6*e+0]=t,this.float32[n+1]=r,this.float32[n+2]=i,e}}xa.prototype.bytesPerElement=12,lo("StructArrayLayout1ui2f12",xa);class wa extends Qo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r){const i=this.length;return this.resize(i+1),this.emplace(i,e,t,r)}emplace(e,t,r,i){const n=4*e;return this.uint32[2*e+0]=t,this.uint16[n+2]=r,this.uint16[n+3]=i,e}}wa.prototype.bytesPerElement=8,lo("StructArrayLayout1ul2ui8",wa);class Ta extends Qo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){const r=this.length;return this.resize(r+1),this.emplace(r,e,t)}emplace(e,t,r){const i=2*e;return this.uint16[i+0]=t,this.uint16[i+1]=r,e}}Ta.prototype.bytesPerElement=4,lo("StructArrayLayout2ui4",Ta);class Sa extends Qo{_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}}Sa.prototype.bytesPerElement=2,lo("StructArrayLayout1ui2",Sa);class Ea extends Qo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,r,i)}emplace(e,t,r,i,n){const o=4*e;return this.float32[o+0]=t,this.float32[o+1]=r,this.float32[o+2]=i,this.float32[o+3]=n,e}}Ea.prototype.bytesPerElement=16,lo("StructArrayLayout4f16",Ea);class Ia extends Ko{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 r(this.anchorPointX,this.anchorPointY)}}Ia.prototype.size=20;class Pa extends pa{get(e){return new Ia(this,e)}}lo("CollisionBoxArray",Pa);class ka extends Ko{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]}}ka.prototype.size=48;class Aa extends ya{get(e){return new ka(this,e)}}lo("PlacedSymbolArray",Aa);class Ca extends Ko{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 Ma extends va{get(e){return new Ca(this,e)}}lo("SymbolInstanceArray",Ma);class Da extends ba{getoffsetX(e){return this.float32[1*e+0]}}lo("GlyphOffsetArray",Da);class Ra extends ia{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}lo("SymbolLineVertexArray",Ra);class La extends Ko{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]}}La.prototype.size=12;class Fa extends xa{get(e){return new La(this,e)}}lo("TextAnchorOffsetArray",Fa);class Oa extends Ko{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]}}Oa.prototype.size=8;class za extends wa{get(e){return new Oa(this,e)}}lo("FeatureIndexArray",za);class Ba extends ra{}class Na extends ra{}class ja extends ra{}class Va extends oa{}class Ua extends aa{}class Ga extends sa{}class qa extends la{}class $a extends ca{}class Wa extends ua{}class Za extends ha{}class Ha extends da{}class Xa extends fa{}class Ya extends ga{}class Ja extends _a{}class Ka extends Ta{}const Qa=ea([{name:"a_pos",components:2,type:"Int16"}],4),{members:es}=Qa;class ts{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=e}prepareSegment(e,t,r,i){const n=this.segments[this.segments.length-1];return e>ts.MAX_VERTEX_ARRAY_LENGTH&&q(`Max vertices per segment is ${ts.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${ts.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!n||n.vertexLength+e>ts.MAX_VERTEX_ARRAY_LENGTH||n.sortKey!==i?this.createNewSegment(t,r,i):n}createNewSegment(e,t,r){const i={vertexOffset:e.length,primitiveOffset:t.length,vertexLength:0,primitiveLength:0,vaos:{}};return void 0!==r&&(i.sortKey=r),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(i),i}getOrCreateLatestSegment(e,t,r){return this.prepareSegment(0,e,t,r)}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,r,i){return new ts([{vertexOffset:e,primitiveOffset:t,vertexLength:r,primitiveLength:i,vaos:{},sortKey:0}])}}function rs(e,t){return 256*(e=O(Math.floor(e),0,255))+O(Math.floor(t),0,255)}ts.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,lo("SegmentVector",ts);const is=ea([{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"}]),ns=ea([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]);var os,as,ss,ls={exports:{}},cs={exports:{}},us={exports:{}},hs=function(){if(ss)return ls.exports;ss=1;var e=(os||(os=1,cs.exports=function(e,t){var r,i,n,o,a,s,l,c;for(i=e.length-(r=3&e.length),n=t,a=3432918353,s=461845907,c=0;c<i;)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,r){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}),cs.exports),t=(as||(as=1,us.exports=function(e,t){for(var r,i=e.length,n=t^i,o=0;i>=4;)r=1540483477*(65535&(r=255&e.charCodeAt(o)|(255&e.charCodeAt(++o))<<8|(255&e.charCodeAt(++o))<<16|(255&e.charCodeAt(++o))<<24))+((1540483477*(r>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),i-=4,++o;switch(i){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}),us.exports);return ls.exports=e,ls.exports.murmur3=e,ls.exports.murmur2=t,ls.exports}(),ds=i(hs);class ps{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,t,r,i){this.ids.push(fs(e)),this.positions.push(t,r,i)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const t=fs(e);let r=0,i=this.ids.length-1;for(;r<i;){const e=r+i>>1;this.ids[e]>=t?i=e:r=e+1}const n=[];for(;this.ids[r]===t;)n.push({index:this.positions[3*r],start:this.positions[3*r+1],end:this.positions[3*r+2]}),r++;return n}static serialize(e,t){const r=new Float64Array(e.ids),i=new Uint32Array(e.positions);return ms(r,i,0,r.length-1),t&&t.push(r.buffer,i.buffer),{ids:r,positions:i}}static deserialize(e){const t=new ps;return t.ids=e.ids,t.positions=e.positions,t.indexed=!0,t}}function fs(e){const t=+e;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:ds(String(e))}function ms(e,t,r,i){for(;r<i;){const n=e[r+i>>1];let o=r-1,a=i+1;for(;;){do{o++}while(e[o]<n);do{a--}while(e[a]>n);if(o>=a)break;gs(e,o,a),gs(t,3*o,3*a),gs(t,3*o+1,3*a+1),gs(t,3*o+2,3*a+2)}a-r<i-a?(ms(e,t,r,a),r=a+1):(ms(e,t,a+1,i),i=a)}}function gs(e,t,r){const i=e[t];e[t]=e[r],e[r]=i}lo("FeaturePositionMap",ps);class _s{constructor(e,t){this.gl=e.gl,this.location=t}}class ys extends _s{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class vs extends _s{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 bs extends _s{constructor(e,t){super(e,t),this.current=It.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 xs=new Float32Array(16);function ws(e){return[rs(255*e.r,255*e.g),rs(255*e.b,255*e.a)]}class Ts{constructor(e,t,r){this.value=e,this.uniformNames=t.map(e=>`u_${e}`),this.type=r}setUniform(e,t,r){e.set(r.constantOr(this.value))}getBinding(e,t,r){return"color"===this.type?new bs(e,t):new ys(e,t)}}class Ss{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}setConstantDashPositions(e,t){this.dashTo=[0,e.y,e.height,e.width],this.dashFrom=[0,t.y,t.height,t.width]}setUniform(e,t,r,i){let n=null;"u_pattern_to"===i?n=this.patternTo:"u_pattern_from"===i?n=this.patternFrom:"u_dasharray_to"===i?n=this.dashTo:"u_dasharray_from"===i?n=this.dashFrom:"u_pixel_ratio_to"===i?n=this.pixelRatioTo:"u_pixel_ratio_from"===i&&(n=this.pixelRatioFrom),null!==n&&e.set(n)}getBinding(e,t,r){return"u_pattern"===r.substr(0,9)||"u_dasharray_"===r.substr(0,12)?new vs(e,t):new ys(e,t)}}class Es{constructor(e,t,r,i){this.expression=e,this.type=r,this.maxValue=0,this.paintVertexAttributes=t.map(e=>({name:`a_${e}`,type:"Float32",components:"color"===r?2:1,offset:0})),this.paintVertexArray=new i}populatePaintArray(e,t,r){const i=this.paintVertexArray.length,n=this.expression.evaluate(new Co(0,r),t,{},r.canonical,[],r.formattedSection);this.paintVertexArray.resize(e),this._setPaintValue(i,e,n)}updatePaintArray(e,t,r,i,n){const o=this.expression.evaluate(new Co(0,n),r,i);this._setPaintValue(e,t,o)}_setPaintValue(e,t,r){if("color"===this.type){const i=ws(r);for(let r=e;r<t;r++)this.paintVertexArray.emplace(r,i[0],i[1])}else{for(let i=e;i<t;i++)this.paintVertexArray.emplace(i,r);this.maxValue=Math.max(this.maxValue,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()}}class Is{constructor(e,t,r,i,n,o){this.expression=e,this.uniformNames=t.map(e=>`u_${e}_t`),this.type=r,this.useIntegerZoom=i,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=t.map(e=>({name:`a_${e}`,type:"Float32",components:"color"===r?4:2,offset:0})),this.paintVertexArray=new o}populatePaintArray(e,t,r){const i=this.expression.evaluate(new Co(this.zoom,r),t,{},r.canonical,[],r.formattedSection),n=this.expression.evaluate(new Co(this.zoom+1,r),t,{},r.canonical,[],r.formattedSection),o=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(o,e,i,n)}updatePaintArray(e,t,r,i,n){const o=this.expression.evaluate(new Co(this.zoom,n),r,i),a=this.expression.evaluate(new Co(this.zoom+1,n),r,i);this._setPaintValue(e,t,o,a)}_setPaintValue(e,t,r,i){if("color"===this.type){const n=ws(r),o=ws(i);for(let r=e;r<t;r++)this.paintVertexArray.emplace(r,n[0],n[1],o[0],o[1])}else{for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,r,i);this.maxValue=Math.max(this.maxValue,Math.abs(r),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()}setUniform(e,t){const r=this.useIntegerZoom?Math.floor(t.zoom):t.zoom,i=O(this.expression.interpolationFactor(r,this.zoom,this.zoom+1),0,1);e.set(i)}getBinding(e,t,r){return new ys(e,t)}}class Ps{constructor(e,t,r,i,n,o){this.expression=e,this.type=t,this.useIntegerZoom=r,this.zoom=i,this.layerId=o,this.zoomInPaintVertexArray=new n,this.zoomOutPaintVertexArray=new n}populatePaintArray(e,t,r){const i=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(i,e,this.getPositionIds(t),r)}updatePaintArray(e,t,r,i,n){this._setPaintValues(e,t,this.getPositionIds(r),n)}_setPaintValues(e,t,r,i){const n=this.getPositions(i);if(!n||!r)return;const o=n[r.min],a=n[r.mid],s=n[r.max];if(o&&a&&s)for(let l=e;l<t;l++)this.emplace(this.zoomInPaintVertexArray,l,a,o),this.emplace(this.zoomOutPaintVertexArray,l,a,s)}upload(e){if(this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer){const t=this.getVertexAttributes();this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,t,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,t,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class ks extends Ps{getPositions(e){return e.imagePositions}getPositionIds(e){return e.patterns&&e.patterns[this.layerId]}getVertexAttributes(){return is.members}emplace(e,t,r,i){e.emplace(t,r.tlbr[0],r.tlbr[1],r.tlbr[2],r.tlbr[3],i.tlbr[0],i.tlbr[1],i.tlbr[2],i.tlbr[3],r.pixelRatio,i.pixelRatio)}}class As extends Ps{getPositions(e){return e.dashPositions}getPositionIds(e){return e.dashes&&e.dashes[this.layerId]}getVertexAttributes(){return ns.members}emplace(e,t,r,i){e.emplace(t,0,r.y,r.height,r.width,0,i.y,i.height,i.width)}}class Cs{constructor(e,t,r){this.binders={},this._buffers=[];const i=[];for(const n in e.paint._values){if(!r(n))continue;const o=e.paint.get(n);if(!(o instanceof No&&Vi(o.property.specification)))continue;const a=Ds(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 Ss(s.value,a):new Ts(s.value,a,l),i.push(`/u_${n}`);else if("source"===s.kind||h){const r=Rs(n,l,"source");this.binders[n]=h?"line-dasharray"===n?new As(s,l,c,t,r,e.id):new ks(s,l,c,t,r,e.id):new Es(s,a,l,r),i.push(`/a_${n}`)}else{const e=Rs(n,l,"composite");this.binders[n]=new Is(s,a,l,c,t,e),i.push(`/z_${n}`)}}this.cacheKey=i.sort().join("")}getMaxValue(e){const t=this.binders[e];return t instanceof Es||t instanceof Is?t.maxValue:0}populatePaintArrays(e,t,r){for(const i in this.binders){const n=this.binders[i];(n instanceof Es||n instanceof Is||n instanceof Ps)&&n.populatePaintArray(e,t,r)}}setConstantPatternPositions(e,t){for(const r in this.binders){const i=this.binders[r];i instanceof Ss&&i.setConstantPatternPositions(e,t)}}setConstantDashPositions(e,t){for(const r in this.binders){const i=this.binders[r];i instanceof Ss&&i.setConstantDashPositions(e,t)}}updatePaintArrays(e,t,r,i,n){let o=!1;for(const a in e){const s=t.getPositions(a);for(const t of s){const s=r.feature(t.index);for(const r in this.binders){const l=this.binders[r];if((l instanceof Es||l instanceof Is||l instanceof Ps)&&!0===l.expression.isStateDependent){const c=i.paint.get(r);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 r=this.binders[t];(r instanceof Ts||r instanceof Ss)&&e.push(...r.uniformNames.map(e=>`#define HAS_UNIFORM_${e}`))}return e}getBinderAttributes(){const e=[];for(const t in this.binders){const r=this.binders[t];if(r instanceof Es||r instanceof Is)for(let t=0;t<r.paintVertexAttributes.length;t++)e.push(r.paintVertexAttributes[t].name);else if(r instanceof Ps){const t=r.getVertexAttributes();for(const r of t)e.push(r.name)}}return e}getBinderUniforms(){const e=[];for(const t in this.binders){const r=this.binders[t];if(r instanceof Ts||r instanceof Ss||r instanceof Is)for(const t of r.uniformNames)e.push(t)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,t){const r=[];for(const i in this.binders){const n=this.binders[i];if(n instanceof Ts||n instanceof Ss||n instanceof Is)for(const o of n.uniformNames)if(t[o]){const a=n.getBinding(e,t[o],o);r.push({name:o,property:i,binding:a})}}return r}setUniforms(e,t,r,i){for(const{name:n,property:o,binding:a}of t)this.binders[o].setUniform(a,i,r.get(o),n)}updatePaintBuffers(e){this._buffers=[];for(const t in this.binders){const r=this.binders[t];if(e&&r instanceof Ps){const t=2===e.fromScale?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;t&&this._buffers.push(t)}else(r instanceof Es||r instanceof Is)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer)}}upload(e){for(const t in this.binders){const r=this.binders[t];(r instanceof Es||r instanceof Is||r instanceof Ps)&&r.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const t=this.binders[e];(t instanceof Es||t instanceof Is||t instanceof Ps)&&t.destroy()}}}class Ms{constructor(e,t,r=()=>!0){this.programConfigurations={};for(const i of e)this.programConfigurations[i.id]=new Cs(i,t,r);this.needsUpload=!1,this._featureMap=new ps,this._bufferOffset=0}populatePaintArrays(e,t,r,i){for(const n in this.programConfigurations)this.programConfigurations[n].populatePaintArrays(e,t,i);void 0!==t.id&&this._featureMap.add(t.id,r,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,r,i){for(const n of r)this.needsUpload=this.programConfigurations[n.id].updatePaintArrays(e,this._featureMap,t,n,i)||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 Ds(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-dasharray":["dasharray_to","dasharray_from"],"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 Rs(e,t,r){const i={color:{source:sa,composite:Ea},number:{source:ba,composite:sa}},n=function(e){return{"line-pattern":{source:qa,composite:qa},"fill-pattern":{source:qa,composite:qa},"fill-extrusion-pattern":{source:qa,composite:qa},"line-dasharray":{source:$a,composite:$a}}[e]}(e);return n&&n[r]||i[t][r]}lo("ConstantBinder",Ts),lo("CrossFadedConstantBinder",Ss),lo("SourceExpressionBinder",Es),lo("CrossFadedPatternBinder",ks),lo("CrossFadedDasharrayBinder",As),lo("CompositeExpressionBinder",Is),lo("ProgramConfiguration",Cs,{omit:["_buffers"]}),lo("ProgramConfigurationSet",Ms);const Ls=Math.pow(2,14)-1,Fs=-Ls-1;function Os(e){const t=A/e.extent,r=e.loadGeometry();for(let i=0;i<r.length;i++){const e=r[i];for(let r=0;r<e.length;r++){const i=e[r],n=Math.round(i.x*t),o=Math.round(i.y*t);i.x=O(n,Fs,Ls),i.y=O(o,Fs,Ls),(n<i.x||n>i.x+1||o<i.y||o>i.y+1)&&q("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function zs(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?Os(e):[]}}const Bs=-32768;function Ns(e,t,r,i,n){e.emplaceBack(Bs+8*t+i,Bs+8*r+n)}class js{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.hasDependencies=!1,this.layoutVertexArray=new Na,this.indexArray=new Ja,this.segments=new ts,this.programConfigurations=new Ms(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,r){const i=this.layers[0],n=[];let o=null,a=!1,s="heatmap"===i.type;if("circle"===i.type){const e=i;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:c,id:u,index:h,sourceLayerIndex:d}of e){const e=this.layers[0]._featureFilter.needGeometry,t=zs(c,e);if(!this.layers[0]._featureFilter.filter(new Co(this.zoom),t,r))continue;const i=a?o.evaluate(t,{},r):void 0,s={id:u,properties:c.properties,type:c.type,sourceLayerIndex:d,index:h,geometry:e?t.geometry:Os(c),patterns:{},sortKey:i};n.push(s)}a&&n.sort((e,t)=>e.sortKey-t.sortKey);for(const c of n){const{geometry:i,index:n,sourceLayerIndex:o}=c,a=e[n].feature;this.addFeature(c,i,n,r,l),t.featureIndex.insert(a,i,n,o,this.index)}}update(e,t,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:r})}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,es),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,r,i,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 s of t)for(const t of s){const r=t.x,i=t.y;if(r<0||r>=A||i<0||i>=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++)Ns(this.layoutVertexArray,r,i,o[t],o[e]);for(let e=0;e<a-1;e++)for(let t=0;t<a-1;t++){const r=s+e*a+t,i=s+(e+1)*a+t;this.indexArray.emplaceBack(r,i+1,r+1),this.indexArray.emplaceBack(r,i,i+1)}n.vertexLength+=a*a,n.primitiveLength+=(a-1)*(a-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,{imagePositions:{},canonical:i})}}function Vs(e,t){for(let r=0;r<e.length;r++)if(Ys(t,e[r]))return!0;for(let r=0;r<t.length;r++)if(Ys(e,t[r]))return!0;return!!$s(e,t)}function Us(e,t,r){return!!Ys(e,t)||!!Zs(t,e,r)}function Gs(e,t){if(1===e.length)return Xs(t,e[0]);for(let r=0;r<t.length;r++){const i=t[r];for(let t=0;t<i.length;t++)if(Ys(e,i[t]))return!0}for(let r=0;r<e.length;r++)if(Xs(t,e[r]))return!0;for(let r=0;r<t.length;r++)if($s(e,t[r]))return!0;return!1}function qs(e,t,r){if(e.length>1){if($s(e,t))return!0;for(let i=0;i<t.length;i++)if(Zs(t[i],e,r))return!0}for(let i=0;i<e.length;i++)if(Zs(e[i],t,r))return!0;return!1}function $s(e,t){if(0===e.length||0===t.length)return!1;for(let r=0;r<e.length-1;r++){const i=e[r],n=e[r+1];for(let e=0;e<t.length-1;e++)if(Ws(i,n,t[e],t[e+1]))return!0}return!1}function Ws(e,t,r,i){return $(e,r,i)!==$(t,r,i)&&$(e,t,r)!==$(e,t,i)}function Zs(e,t,r){const i=r*r;if(1===t.length)return e.distSqr(t[0])<i;for(let n=1;n<t.length;n++)if(Hs(e,t[n-1],t[n])<i)return!0;return!1}function Hs(e,t,r){const i=t.distSqr(r);if(0===i)return e.distSqr(t);const n=((e.x-t.x)*(r.x-t.x)+(e.y-t.y)*(r.y-t.y))/i;return e.distSqr(n<0?t:n>1?r:r.sub(t)._mult(n)._add(t))}function Xs(e,t){let r,i,n,o=!1;for(let a=0;a<e.length;a++){r=e[a];for(let e=0,a=r.length-1;e<r.length;a=e++)i=r[e],n=r[a],i.y>t.y!=n.y>t.y&&t.x<(n.x-i.x)*(t.y-i.y)/(n.y-i.y)+i.x&&(o=!o)}return o}function Ys(e,t){let r=!1;for(let i=0,n=e.length-1;i<e.length;n=i++){const o=e[i],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&&(r=!r)}return r}function Js(e,t,r){const i=r[0],n=r[2];if(e.x<i.x&&t.x<i.x||e.x>n.x&&t.x>n.x||e.y<i.y&&t.y<i.y||e.y>n.y&&t.y>n.y)return!1;const o=$(e,t,r[0]);return o!==$(e,t,r[1])||o!==$(e,t,r[2])||o!==$(e,t,r[3])}function Ks(e,t,r){const i=t.paint.get(e).value;return"constant"===i.kind?i.value:r.programConfigurations.get(t.id).getMaxValue(e)}function Qs(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function el(e,t,i,n,o){if(!t[0]&&!t[1])return e;const a=r.convert(t)._mult(o);"viewport"===i&&a._rotate(-n);const s=[];for(let r=0;r<e.length;r++)s.push(e[r].sub(a));return s}function tl({queryGeometry:e,size:t},r){return Us(e,r,t)}function rl({queryGeometry:e,size:t,transform:r,unwrappedTileID:i,getElevation:n},o){return Us(e,o,t*(r.projectTileCoordinates(o.x,o.y,i,n).signedDistanceFromCamera/r.cameraToCenterDistance))}function il({queryGeometry:e,size:t,transform:r,unwrappedTileID:i,getElevation:n},o){const a=r.projectTileCoordinates(o.x,o.y,i,n).signedDistanceFromCamera,s=t*(r.cameraToCenterDistance/a);return Us(e,al(o,r,i,n),s)}function nl({queryGeometry:e,size:t,transform:r,unwrappedTileID:i,getElevation:n},o){return Us(e,al(o,r,i,n),t)}function ol({queryGeometry:e,size:t,transform:r,unwrappedTileID:i,getElevation:n,pitchAlignment:o="map",pitchScale:a="map"},s){const l="map"===o?"map"===a?tl:rl:"map"===a?il:nl,c={queryGeometry:e,size:t,transform:r,unwrappedTileID:i,getElevation:n};for(const u of s)for(const e of u)if(l(c,e))return!0;return!1}function al(e,t,i,n){const o=t.projectTileCoordinates(e.x,e.y,i,n).point;return new r((.5*o.x+.5)*t.width,(.5*-o.y+.5)*t.height)}let sl,ll;lo("CircleBucket",js,{omit:["layers"]});var cl={get paint(){return ll=ll||new Wo({"circle-radius":new Uo(ye.paint_circle["circle-radius"]),"circle-color":new Uo(ye.paint_circle["circle-color"]),"circle-blur":new Uo(ye.paint_circle["circle-blur"]),"circle-opacity":new Uo(ye.paint_circle["circle-opacity"]),"circle-translate":new Vo(ye.paint_circle["circle-translate"]),"circle-translate-anchor":new Vo(ye.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Vo(ye.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Vo(ye.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Uo(ye.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Uo(ye.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Uo(ye.paint_circle["circle-stroke-opacity"])})},get layout(){return sl=sl||new Wo({"circle-sort-key":new Uo(ye.layout_circle["circle-sort-key"])})}};class ul extends Zo{constructor(e,t){super(e,cl,t)}createBucket(e){return new js(e)}queryRadius(e){const t=e;return Ks("circle-radius",this,t)+Ks("circle-stroke-width",this,t)+Qs(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:r,geometry:i,transform:n,pixelsToTileUnits:o,unwrappedTileID:a,getElevation:s}){const l=el(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-n.bearingInRadians,o),c=this.paint.get("circle-radius").evaluate(t,r)+this.paint.get("circle-stroke-width").evaluate(t,r),u=this.paint.get("circle-pitch-scale"),h=this.paint.get("circle-pitch-alignment");let d,p;return"map"===h?(d=l,p=c*o):(d=function(e,t,r,i){return e.map(e=>al(e,t,r,i))}(l,n,a,s),p=c),ol({queryGeometry:d,size:p,transform:n,unwrappedTileID:a,getElevation:s,pitchAlignment:h,pitchScale:u},i)}}class hl extends js{}let dl;lo("HeatmapBucket",hl,{omit:["layers"]});var pl={get paint(){return dl=dl||new Wo({"heatmap-radius":new Uo(ye.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Uo(ye.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Vo(ye.paint_heatmap["heatmap-intensity"]),"heatmap-color":new $o(ye.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Vo(ye.paint_heatmap["heatmap-opacity"])})}};function fl(e,{width:t,height:r},i,n){if(n){if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==t*r*i)throw new RangeError(`mismatched image size. expected: ${n.length} but got: ${t*r*i}`)}else n=new Uint8Array(t*r*i);return e.width=t,e.height=r,e.data=n,e}function ml(e,{width:t,height:r},i){if(t===e.width&&r===e.height)return;const n=fl({},{width:t,height:r},i);gl(e,n,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,t),height:Math.min(e.height,r)},i),e.width=t,e.height=r,e.data=n.data}function gl(e,t,r,i,n,o){if(0===n.width||0===n.height)return t;if(n.width>e.width||n.height>e.height||r.x>e.width-n.width||r.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||i.x>t.width-n.width||i.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=((r.y+l)*e.width+r.x)*o,u=((i.y+l)*t.width+i.x)*o;for(let e=0;e<n.width*o;e++)s[u+e]=a[c+e]}return t}class _l{constructor(e,t){fl(this,e,1,t)}resize(e){ml(this,e,1)}clone(){return new _l({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,r,i,n){gl(e,t,r,i,n,1)}}class yl{constructor(e,t){fl(this,e,4,t)}resize(e){ml(this,e,4)}replace(e,t){t?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new yl({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,r,i,n){gl(e,t,r,i,n,4)}setPixel(e,t,r){const i=4*(e*this.width+t);this.data[i+0]=Math.round(255*r.r/r.a),this.data[i+1]=Math.round(255*r.g/r.a),this.data[i+2]=Math.round(255*r.b/r.a),this.data[i+3]=Math.round(255*r.a)}}function vl(e){const t={},r=e.resolution||256,i=e.clips?e.clips.length:1,n=e.image||new yl({width:r,height:i});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const o=(i,o,a)=>{t[e.evaluationKey]=a;const s=e.expression.evaluate(t);n.setPixel(i/4/r,o/4,s)};if(e.clips)for(let a=0,s=0;a<i;++a,s+=4*r)for(let t=0,i=0;t<r;t++,i+=4){const n=t/(r-1),{start:l,end:c}=e.clips[a];o(s,i,l*(1-n)+c*n)}else for(let a=0,s=0;a<r;a++,s+=4)o(0,s,a/(r-1));return n}lo("AlphaImage",_l),lo("RGBAImage",yl);const bl="big-fb";class xl extends Zo{createBucket(e){return new hl(e)}constructor(e,t){super(e,pl,t),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){"heatmap-color"===e&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=vl({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(bl)&&this.heatmapFbos.delete(bl)}queryRadius(e){return Ks("heatmap-radius",this,e)}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:r,geometry:i,transform:n,pixelsToTileUnits:o,unwrappedTileID:a,getElevation:s}){return ol({queryGeometry:e,size:this.paint.get("heatmap-radius").evaluate(t,r)*o,transform:n,unwrappedTileID:a,getElevation:s},i)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}}let wl;var Tl={get paint(){return wl=wl||new Wo({"hillshade-illumination-direction":new Vo(ye.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new Vo(ye.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new Vo(ye.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Vo(ye.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Vo(ye.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Vo(ye.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Vo(ye.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new Vo(ye.paint_hillshade["hillshade-method"])})}};class Sl extends Zo{constructor(e,t){super(e,Tl,t),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let e=this.paint.get("hillshade-illumination-direction").values,t=this.paint.get("hillshade-illumination-altitude").values,r=this.paint.get("hillshade-highlight-color").values,i=this.paint.get("hillshade-shadow-color").values;const n=Math.max(e.length,t.length,r.length,i.length);e=e.concat(Array(n-e.length).fill(e.at(-1))),t=t.concat(Array(n-t.length).fill(t.at(-1))),r=r.concat(Array(n-r.length).fill(r.at(-1))),i=i.concat(Array(n-i.length).fill(i.at(-1)));const o=t.map(ee);return{directionRadians:e.map(ee),altitudeRadians:o,shadowColor:i,highlightColor:r}}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}}let El;var Il={get paint(){return El=El||new Wo({"color-relief-opacity":new Vo(ye["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new $o(ye["paint_color-relief"]["color-relief-color"])})}};class Pl{constructor(e,t,r,i){this.context=e,this.format=r,this.texture=e.gl.createTexture(),this.update(t,i)}update(e,t,r){const{width:i,height:n}=e,o=!(this.size&&this.size[0]===i&&this.size[1]===n||r),{context:a}=this,{gl:s}=a;if(this.useMipmap=Boolean(t&&t.useMipmap),s.bindTexture(s.TEXTURE_2D,this.texture),a.pixelStoreUnpackFlipY.set(!1),a.pixelStoreUnpack.set(1),a.pixelStoreUnpackPremultiplyAlpha.set(this.format===s.RGBA&&(!t||!1!==t.premultiply)),o)this.size=[i,n],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||H(e)?s.texImage2D(s.TEXTURE_2D,0,this.format,this.format,s.UNSIGNED_BYTE,e):s.texImage2D(s.TEXTURE_2D,0,this.format,i,n,0,this.format,s.UNSIGNED_BYTE,e.data);else{const{x:t,y:o}=r||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||H(e)?s.texSubImage2D(s.TEXTURE_2D,0,t,o,s.RGBA,s.UNSIGNED_BYTE,e):s.texSubImage2D(s.TEXTURE_2D,0,t,o,i,n,s.RGBA,s.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&s.generateMipmap(s.TEXTURE_2D),a.pixelStoreUnpackFlipY.setDefault(),a.pixelStoreUnpack.setDefault(),a.pixelStoreUnpackPremultiplyAlpha.setDefault()}bind(e,t,r){const{context:i}=this,{gl:n}=i;n.bindTexture(n.TEXTURE_2D,this.texture),r!==n.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(r=n.LINEAR),e!==this.filter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,r||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}}class kl{constructor(e,t,r,i=1,n=1,o=1,a=0){if(this.uid=e,t.height!==t.width)throw new RangeError("DEM tiles must be square");if(r&&!["mapbox","terrarium","custom"].includes(r))return void q(`"${r}" 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),r){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=i,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 l=0;l<s;l++)this.data[this._idx(-1,l)]=this.data[this._idx(0,l)],this.data[this._idx(s,l)]=this.data[this._idx(s-1,l)],this.data[this._idx(l,-1)]=this.data[this._idx(l,0)],this.data[this._idx(l,s)]=this.data[this._idx(l,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 l=0;l<s;l++)for(let e=0;e<s;e++){const t=this.get(l,e);t>this.max&&(this.max=t),t<this.min&&(this.min=t)}}get(e,t){const r=new Uint8Array(this.data.buffer),i=4*this._idx(e,t);return this.unpack(r[i],r[i+1],r[i+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,r){return e*this.redFactor+t*this.greenFactor+r*this.blueFactor-this.baseShift}pack(e){return Al(e,this.getUnpackVector())}getPixels(){return new yl({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,t,r){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let i=t*this.dim,n=t*this.dim+this.dim,o=r*this.dim,a=r*this.dim+this.dim;switch(t){case-1:i=n-1;break;case 1:n=i+1}switch(r){case-1:o=a-1;break;case 1:a=o+1}const s=-t*this.dim,l=-r*this.dim;for(let c=o;c<a;c++)for(let t=i;t<n;t++)this.data[this._idx(t,c)]=e.data[this._idx(t+s,c+l)]}}function Al(e,t){const r=t[0],i=t[1],n=t[2],o=t[3],a=Math.min(r,i,n),s=Math.round((e+o)/a);return{r:Math.floor(s*a/r)%256,g:Math.floor(s*a/i)%256,b:Math.floor(s*a/n)%256}}lo("DEMData",kl);class Cl extends Zo{constructor(e,t){super(e,Il,t)}_createColorRamp(e){const t={elevationStops:[],colorStops:[]},r=this._transitionablePaint._values["color-relief-color"].value.expression;if(r instanceof rn&&r._styleExpression.expression instanceof dr){this.colorRampExpression=r;const e=r._styleExpression.expression;t.elevationStops=e.labels,t.colorStops=[];for(const r of t.elevationStops)t.colorStops.push(e.evaluate({globals:{elevation:r}}))}if(t.elevationStops.length<1&&(t.elevationStops=[0],t.colorStops=[It.transparent]),t.elevationStops.length<2&&(t.elevationStops.push(t.elevationStops[0]+1),t.colorStops.push(t.colorStops[0])),t.elevationStops.length<=e)return t;const i={elevationStops:[],colorStops:[]},n=(t.elevationStops.length-1)/(e-1);for(let o=0;o<t.elevationStops.length-.5;o+=n)i.elevationStops.push(t.elevationStops[Math.round(o)]),i.colorStops.push(t.colorStops[Math.round(o)]);return q(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${e}, provided: ${t.elevationStops.length}`),i}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(e,t,r){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;const i=this._createColorRamp(t),n=new yl({width:i.colorStops.length,height:1}),o=new yl({width:i.colorStops.length,height:1});for(let a=0;a<i.elevationStops.length;a++){const e=Al(i.elevationStops[a],r);o.setPixel(0,a,new It(e.r/255,e.g/255,e.b/255,1)),n.setPixel(0,a,i.colorStops[a])}return this.colorRampTextures={elevationTexture:new Pl(e,o,e.gl.RGBA),colorTexture:new Pl(e,n,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return"none"!==this.visibility&&!!this.colorRampTextures}}const Ml=ea([{name:"a_pos",components:2,type:"Int16"}],4),{members:Dl}=Ml;function Rl(e,t,r){const i=r.patternDependencies;let n=!1;for(const o of t){const t=o.paint.get(`${e}-pattern`);t.isConstant()||(n=!0);const r=t.constantOr(null);r&&(n=!0,i[r.to]=!0,i[r.from]=!0)}return n}function Ll(e,t,r,i,n){const{zoom:o}=i,a=n.patternDependencies;for(const s of t){const t=s.paint.get(`${e}-pattern`).value;if("constant"!==t.kind){let e=t.evaluate({zoom:o-1},r,{},n.availableImages),i=t.evaluate({zoom:o},r,{},n.availableImages),l=t.evaluate({zoom:o+1},r,{},n.availableImages);e=e&&e.name?e.name:e,i=i&&i.name?i.name:i,l=l&&l.name?l.name:l,a[e]=!0,a[i]=!0,a[l]=!0,r.patterns[s.id]={min:e,mid:i,max:l}}}return r}function Fl(e,t,r,i,n){let o;if(n===function(e,t,r,i){let n=0;for(let o=t,a=r-i;o<r;o+=i)n+=(e[a]-e[o])*(e[o+1]+e[a+1]),a=o;return n}(e,t,r,i)>0)for(let a=t;a<r;a+=i)o=ic(a/i|0,e[a],e[a+1],o);else for(let a=r-i;a>=t;a-=i)o=ic(a/i|0,e[a],e[a+1],o);return o&&Jl(o,o.next)&&(nc(o),o=o.next),o}function Ol(e,t){if(!e)return e;t||(t=e);let r,i=e;do{if(r=!1,i.steiner||!Jl(i,i.next)&&0!==Yl(i.prev,i,i.next))i=i.next;else{if(nc(i),i=t=i.prev,i===i.next)break;r=!0}}while(r||i!==t);return t}function zl(e,t,r,i,n,o,a){if(!e)return;!a&&o&&function(e,t,r,i){let n=e;do{0===n.z&&(n.z=$l(n.x,n.y,t,r,i)),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,r=1;do{let i,n=e;e=null;let o=null;for(t=0;n;){t++;let a=n,s=0;for(let e=0;e<r&&(s++,a=a.nextZ,a);e++);let l=r;for(;s>0||l>0&&a;)0!==s&&(0===l||!a||n.z<=a.z)?(i=n,n=n.nextZ,s--):(i=a,a=a.nextZ,l--),o?o.nextZ=i:e=i,i.prevZ=o,o=i;n=a}o.nextZ=null,r*=2}while(t>1)}(n)}(e,i,n,o);let s=e;for(;e.prev!==e.next;){const l=e.prev,c=e.next;if(o?Nl(e,i,n,o):Bl(e))t.push(l.i,e.i,c.i),nc(e),e=c.next,s=c.next;else if((e=c)===s){a?1===a?zl(e=jl(Ol(e),t),t,r,i,n,o,2):2===a&&Vl(e,t,r,i,n,o):zl(Ol(e),t,r,i,n,o,1);break}}}function Bl(e){const t=e.prev,r=e,i=e.next;if(Yl(t,r,i)>=0)return!1;const n=t.x,o=r.x,a=i.x,s=t.y,l=r.y,c=i.y,u=Math.min(n,o,a),h=Math.min(s,l,c),d=Math.max(n,o,a),p=Math.max(s,l,c);let f=i.next;for(;f!==t;){if(f.x>=u&&f.x<=d&&f.y>=h&&f.y<=p&&Hl(n,s,o,l,a,c,f.x,f.y)&&Yl(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function Nl(e,t,r,i){const n=e.prev,o=e,a=e.next;if(Yl(n,o,a)>=0)return!1;const s=n.x,l=o.x,c=a.x,u=n.y,h=o.y,d=a.y,p=Math.min(s,l,c),f=Math.min(u,h,d),m=Math.max(s,l,c),g=Math.max(u,h,d),_=$l(p,f,t,r,i),y=$l(m,g,t,r,i);let v=e.prevZ,b=e.nextZ;for(;v&&v.z>=_&&b&&b.z<=y;){if(v.x>=p&&v.x<=m&&v.y>=f&&v.y<=g&&v!==n&&v!==a&&Hl(s,u,l,h,c,d,v.x,v.y)&&Yl(v.prev,v,v.next)>=0)return!1;if(v=v.prevZ,b.x>=p&&b.x<=m&&b.y>=f&&b.y<=g&&b!==n&&b!==a&&Hl(s,u,l,h,c,d,b.x,b.y)&&Yl(b.prev,b,b.next)>=0)return!1;b=b.nextZ}for(;v&&v.z>=_;){if(v.x>=p&&v.x<=m&&v.y>=f&&v.y<=g&&v!==n&&v!==a&&Hl(s,u,l,h,c,d,v.x,v.y)&&Yl(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;b&&b.z<=y;){if(b.x>=p&&b.x<=m&&b.y>=f&&b.y<=g&&b!==n&&b!==a&&Hl(s,u,l,h,c,d,b.x,b.y)&&Yl(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function jl(e,t){let r=e;do{const i=r.prev,n=r.next.next;!Jl(i,n)&&Kl(i,r,r.next,n)&&tc(i,n)&&tc(n,i)&&(t.push(i.i,r.i,n.i),nc(r),nc(r.next),r=e=n),r=r.next}while(r!==e);return Ol(r)}function Vl(e,t,r,i,n,o){let a=e;do{let e=a.next.next;for(;e!==a.prev;){if(a.i!==e.i&&Xl(a,e)){let s=rc(a,e);return a=Ol(a,a.next),s=Ol(s,s.next),zl(a,t,r,i,n,o,0),void zl(s,t,r,i,n,o,0)}e=e.next}a=a.next}while(a!==e)}function Ul(e,t){let r=e.x-t.x;return 0===r&&(r=e.y-t.y,0===r)&&(r=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)),r}function Gl(e,t){const r=function(e,t){let r=t;const i=e.x,n=e.y;let o,a=-1/0;if(Jl(e,r))return r;do{if(Jl(e,r.next))return r.next;if(n<=r.y&&n>=r.next.y&&r.next.y!==r.y){const e=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(e<=i&&e>a&&(a=e,o=r.x<r.next.x?r:r.next,e===i))return o}r=r.next}while(r!==t);if(!o)return null;const s=o,l=o.x,c=o.y;let u=1/0;r=o;do{if(i>=r.x&&r.x>=l&&i!==r.x&&Zl(n<c?i:a,n,l,c,n<c?a:i,n,r.x,r.y)){const t=Math.abs(n-r.y)/(i-r.x);tc(r,e)&&(t<u||t===u&&(r.x>o.x||r.x===o.x&&ql(o,r)))&&(o=r,u=t)}r=r.next}while(r!==s);return o}(e,t);if(!r)return t;const i=rc(r,e);return Ol(i,i.next),Ol(r,r.next)}function ql(e,t){return Yl(e.prev,e,t.prev)<0&&Yl(t.next,e,e.next)<0}function $l(e,t,r,i,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Wl(e){let t=e,r=e;do{(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next}while(t!==e);return r}function Zl(e,t,r,i,n,o,a,s){return(n-a)*(t-s)>=(e-a)*(o-s)&&(e-a)*(i-s)>=(r-a)*(t-s)&&(r-a)*(o-s)>=(n-a)*(i-s)}function Hl(e,t,r,i,n,o,a,s){return!(e===a&&t===s)&&Zl(e,t,r,i,n,o,a,s)}function Xl(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&Kl(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}(e,t)&&(tc(e,t)&&tc(t,e)&&function(e,t){let r=e,i=!1;const n=(e.x+t.x)/2,o=(e.y+t.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&n<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next}while(r!==e);return i}(e,t)&&(Yl(e.prev,e,t.prev)||Yl(e,t.prev,t))||Jl(e,t)&&Yl(e.prev,e,e.next)>0&&Yl(t.prev,t,t.next)>0)}function Yl(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function Jl(e,t){return e.x===t.x&&e.y===t.y}function Kl(e,t,r,i){const n=ec(Yl(e,t,r)),o=ec(Yl(e,t,i)),a=ec(Yl(r,i,e)),s=ec(Yl(r,i,t));return n!==o&&a!==s||!(0!==n||!Ql(e,r,t))||!(0!==o||!Ql(e,i,t))||!(0!==a||!Ql(r,e,i))||!(0!==s||!Ql(r,t,i))}function Ql(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function ec(e){return e>0?1:e<0?-1:0}function tc(e,t){return Yl(e.prev,e,e.next)<0?Yl(e,t,e.next)>=0&&Yl(e,e.prev,t)>=0:Yl(e,t,e.prev)<0||Yl(e,e.next,t)<0}function rc(e,t){const r=oc(e.i,e.x,e.y),i=oc(t.i,t.x,t.y),n=e.next,o=t.prev;return e.next=t,t.prev=e,r.next=n,n.prev=r,i.next=r,r.prev=i,o.next=i,i.prev=o,i}function ic(e,t,r,i){const n=oc(e,t,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function nc(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 oc(e,t,r){return{i:e,x:t,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class ac{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 sc{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}}sc.noSubdivision=new sc({fill:new ac(0,0),line:new ac(0,0),tile:new ac(0,0),stencil:new ac(0,0),circle:1}),lo("SubdivisionGranularityExpression",ac),lo("SubdivisionGranularitySetting",sc);const lc=-32768,cc=32767;class uc{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 r=0|Math.round(e),i=0|Math.round(t),n=this._getKey(r,i);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(r,i),o}_subdivideTrianglesScanline(e){if(this._granularity<2)return function(e,t){const r=[];for(let i=0;i<t.length;i+=3){const n=t[i],o=t[i+1],a=t[i+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?(r.push(n),r.push(a),r.push(o)):(r.push(n),r.push(o),r.push(a))}return r}(this._vertexBuffer,e);const t=[],r=e.length;for(let i=0;i<r;i+=3){const r=[e[i+0],e[i+1],e[i+2]],n=[this._vertexBuffer[2*e[i+0]+0],this._vertexBuffer[2*e[i+0]+1],this._vertexBuffer[2*e[i+1]+0],this._vertexBuffer[2*e[i+1]+1],this._vertexBuffer[2*e[i+2]+0],this._vertexBuffer[2*e[i+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],r=n[2*e+1];o=Math.min(o,t),s=Math.max(s,t),a=Math.min(a,r),l=Math.max(l,r)}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),d=Math.ceil(l/this._granularityCellSize);if(c!==u||h!==d)for(let e=h;e<d;e++){const i=this._scanlineGenerateVertexRingForCellRow(e,n,r);pc(this._vertexBuffer,i,t)}else t.push(...r)}return t}_scanlineGenerateVertexRingForCellRow(e,t,r){const i=e*this._granularityCellSize,n=i+this._granularityCellSize,o=[];for(let a=0;a<3;a++){const e=t[2*a],s=t[2*a+1],l=t[2*(a+1)%6],c=t[(2*(a+1)+1)%6],u=t[2*(a+2)%6],h=t[(2*(a+2)+1)%6],d=l-e,p=c-s,f=0===d,m=0===p,g=(i-s)/p,_=(n-s)/p,y=Math.min(g,_),v=Math.max(g,_);if(!m&&(y>=1||v<=0)||m&&(s<i||s>n)){c>=i&&c<=n&&o.push(r[(a+1)%3]);continue}!m&&y>0&&o.push(this._vertexToIndex(e+d*y,s+p*y));const b=e+d*Math.max(y,0),x=e+d*Math.min(v,1);f||this._generateIntraEdgeVertices(o,e,s,l,c,b,x),!m&&v<1&&o.push(this._vertexToIndex(e+d*v,s+p*v)),(m||c>=i&&c<=n)&&o.push(r[(a+1)%3]),!m&&(c<=i||c>=n)&&this._generateInterEdgeVertices(o,e,s,l,c,u,h,x,i,n)}return o}_generateIntraEdgeVertices(e,t,r,i,n,o,a){const s=i-t,l=n-r,c=0===l,u=c?Math.min(t,i):Math.min(o,a),h=c?Math.max(t,i):Math.max(o,a),d=Math.floor(u/this._granularityCellSize)+1,p=Math.ceil(h/this._granularityCellSize)-1;if(c?t<i:o<a)for(let f=d;f<=p;f++){const i=f*this._granularityCellSize;e.push(this._vertexToIndex(i,r+l*(i-t)/s))}else for(let f=p;f>=d;f--){const i=f*this._granularityCellSize;e.push(this._vertexToIndex(i,r+l*(i-t)/s))}}_generateInterEdgeVertices(e,t,r,i,n,o,a,s,l,c){const u=n-r,h=o-i,d=a-n,p=(l-n)/d,f=(c-n)/d,m=Math.min(p,f),g=Math.max(p,f),_=i+h*m;let y=Math.floor(Math.min(_,s)/this._granularityCellSize)+1,v=Math.ceil(Math.max(_,s)/this._granularityCellSize)-1,b=s<_;const x=0===d;if(x&&(a===l||a===c))return;if(x||m>=1||g<=0){const e=r-a,i=o+(t-o)*Math.min((l-a)/e,(c-a)/e);y=Math.floor(Math.min(i,s)/this._granularityCellSize)+1,v=Math.ceil(Math.max(i,s)/this._granularityCellSize)-1,b=s<i}const w=u>0?c:l;if(b)for(let T=y;T<=v;T++)e.push(this._vertexToIndex(T*this._granularityCellSize,w));else for(let T=v;T>=y;T--)e.push(this._vertexToIndex(T*this._granularityCellSize,w))}_generateOutline(e){const t=[];for(const r of e){const e=dc(r,this._granularity,!0),i=this._pointArrayToIndices(e),n=[];for(let t=1;t<i.length;t++)n.push(i[t-1]),n.push(i[t]);t.push(n)}return t}_handlePoles(e){let t=!1,r=!1;this._canonical&&(0===this._canonical.y&&(t=!0),this._canonical.y===(1<<this._canonical.z)-1&&(r=!0)),(t||r)&&this._fillPoles(e,t,r)}_ensureNoPoleVertices(){const e=this._vertexBuffer;for(let t=0;t<e.length;t+=2){const r=e[t+1];r===lc&&(e[t+1]=-32767),r===cc&&(e[t+1]=32766)}}_generatePoleQuad(e,t,r,i,n,o){i>n!=(o===lc)?(e.push(t),e.push(r),e.push(this._vertexToIndex(i,o)),e.push(r),e.push(this._vertexToIndex(n,o)),e.push(this._vertexToIndex(i,o))):(e.push(r),e.push(t),e.push(this._vertexToIndex(i,o)),e.push(this._vertexToIndex(n,o)),e.push(r),e.push(this._vertexToIndex(i,o)))}_fillPoles(e,t,r){const i=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=i[2*o],u=i[2*o+1],h=i[2*s],d=i[2*s+1],p=i[2*l],f=i[2*l+1];t&&(0===u&&0===d&&this._generatePoleQuad(e,o,s,c,h,lc),0===d&&0===f&&this._generatePoleQuad(e,s,l,h,p,lc),0===f&&0===u&&this._generatePoleQuad(e,l,o,p,c,lc)),r&&(u===n&&d===n&&this._generatePoleQuad(e,o,s,c,h,cc),d===n&&f===n&&this._generatePoleQuad(e,s,l,h,p,cc),f===n&&u===n&&this._generatePoleQuad(e,l,o,p,c,cc))}}_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:r,holeIndices:i}=function(e){const t=[],r=[];for(const i of e)if(0!==i.length){i!==e[0]&&t.push(r.length/2);for(let e=0;e<i.length;e++)r.push(i[e].x),r.push(i[e].y)}return{flattened:r,holeIndices:t}}(e);let n;this._initializeVertices(r);try{const e=function(e,t,r=2){const i=t&&t.length,n=i?t[0]*r:e.length;let o=Fl(e,0,n,r,!0);const a=[];if(!o||o.next===o.prev)return a;let s,l,c;if(i&&(o=function(e,t,r,i){const n=[];for(let o=0,a=t.length;o<a;o++){const r=Fl(e,t[o]*i,o<a-1?t[o+1]*i:e.length,i,!1);r===r.next&&(r.steiner=!0),n.push(Wl(r))}n.sort(Ul);for(let o=0;o<n.length;o++)r=Gl(n[o],r);return r}(e,t,o,r)),e.length>80*r){s=e[0],l=e[1];let t=s,i=l;for(let o=r;o<n;o+=r){const r=e[o],n=e[o+1];r<s&&(s=r),n<l&&(l=n),r>t&&(t=r),n>i&&(i=n)}c=Math.max(t-s,i-l),c=0!==c?32767/c:0}return zl(o,a,r,s,l,c,0),a}(r,i),t=this._convertIndices(r,e);n=this._subdivideTrianglesScanline(t)}catch(e){console.error(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 r=[];for(let i=0;i<t.length;i++)r.push(this._vertexToIndex(e[2*t[i]],e[2*t[i]+1]));return r}_pointArrayToIndices(e){const t=[];for(let r=0;r<e.length;r++){const i=e[r];t.push(this._vertexToIndex(i.x,i.y))}return t}}function hc(e,t,r,i=!0){return new uc(r,t).subdividePolygonInternal(e,i)}function dc(e,t,i=!1){if(!e||e.length<1)return[];if(e.length<2)return[];const n=e[0],o=e[e.length-1],a=i&&(n.x!==o.x||n.y!==o.y);if(t<2)return a?[...e,e[0]]:[...e];const s=Math.floor(A/t),l=[];l.push(new r(e[0].x,e[0].y));const c=e.length,u=a?c:c-1;for(let h=0;h<u;h++){const t=e[h],i=h<c-1?e[h+1]:e[0],n=t.x,o=t.y,a=i.x,u=i.y,d=n!==a,p=o!==u;if(!d&&!p)continue;const f=a-n,m=u-o,g=Math.abs(f),_=Math.abs(m);let y=n,v=o;for(;;){const e=f>0?(Math.floor(y/s)+1)*s:(Math.ceil(y/s)-1)*s,t=m>0?(Math.floor(v/s)+1)*s:(Math.ceil(v/s)-1)*s,i=Math.abs(y-e),n=Math.abs(v-t),o=Math.abs(y-a),c=Math.abs(v-u),h=d?i/g:Number.POSITIVE_INFINITY,b=p?n/_:Number.POSITIVE_INFINITY;if((o<=i||!d)&&(c<=n||!p))break;if(h<b&&d||!p){y=e,v+=m*h;const t=new r(y,Math.round(v));l[l.length-1].x===t.x&&l[l.length-1].y===t.y||l.push(t)}else{y+=f*b,v=t;const e=new r(Math.round(y),v);l[l.length-1].x===e.x&&l[l.length-1].y===e.y||l.push(e)}}const b=new r(a,u);l[l.length-1].x===b.x&&l[l.length-1].y===b.y||l.push(b)}return l}function pc(e,t,r){if(0===t.length)throw new Error("Subdivision vertex ring is empty.");let i=0,n=e[2*t[0]];for(let l=1;l<t.length;l++){const r=e[2*t[l]];r<n&&(n=r,i=l)}const o=t.length;let a=i,s=(a+1)%o;for(;;){const i=a-1>=0?a-1:o-1,n=(s+1)%o,l=e[2*t[i]],c=e[2*t[n]],u=e[2*t[a]],h=e[2*t[a]+1],d=e[2*t[s]+1];let p=!1;if(l<c)p=!0;else if(l>c)p=!1;else{const r=d-h,o=-(e[2*t[s]]-u),a=h<d?1:-1;((l-u)*r+(e[2*t[i]+1]-h)*o)*a>((c-u)*r+(e[2*t[n]+1]-h)*o)*a&&(p=!0)}if(p){const e=t[i],n=t[a],l=t[s];e!==n&&e!==l&&n!==l&&r.push(l,n,e),a--,a<0&&(a=o-1)}else{const e=t[n],i=t[a],l=t[s];e!==i&&e!==l&&i!==l&&r.push(l,i,e),s++,s>=o&&(s=0)}if(i===n)break}}function fc(e,t,r,i,n,o,a,s,l){const c=n.length/2,u=a&&s&&l;if(c<ts.MAX_VERTEX_ARRAY_LENGTH){const h=t.prepareSegment(c,r,i),d=h.vertexLength;for(let e=0;e<o.length;e+=3)i.emplaceBack(d+o[e],d+o[e+1],d+o[e+2]);let p,f;h.vertexLength+=c,h.primitiveLength+=o.length/3,u&&(f=a.prepareSegment(c,r,s),p=f.vertexLength,f.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(p+t[e-1],p+t[e]);f.primitiveLength+=t.length/2}}else!function(e,t,r,i,n,o){const a=[];for(let h=0;h<i.length/2;h++)a.push(-1);const s={count:0};let l=0,c=e.getOrCreateLatestSegment(t,r),u=c.vertexLength;for(let h=2;h<n.length;h+=3){const d=n[h-2],p=n[h-1],f=n[h];let m=a[d]<l,g=a[p]<l,_=a[f]<l;c.vertexLength+((m?1:0)+(g?1:0)+(_?1:0))>ts.MAX_VERTEX_ARRAY_LENGTH&&(c=e.createNewSegment(t,r),l=s.count,m=!0,g=!0,_=!0,u=0);const y=mc(a,i,o,s,d,m,c),v=mc(a,i,o,s,p,g,c),b=mc(a,i,o,s,f,_,c);r.emplaceBack(u+y-l,u+v-l,u+b-l),c.primitiveLength++}}(t,r,i,n,o,e),u&&function(e,t,r,i,n,o){const a=[];for(let h=0;h<i.length/2;h++)a.push(-1);const s={count:0};let l=0,c=e.getOrCreateLatestSegment(t,r),u=c.vertexLength;for(let h=0;h<n.length;h++){const d=n[h];for(let p=1;p<n[h].length;p+=2){const n=d[p-1],h=d[p];let f=a[n]<l,m=a[h]<l;c.vertexLength+((f?1:0)+(m?1:0))>ts.MAX_VERTEX_ARRAY_LENGTH&&(c=e.createNewSegment(t,r),l=s.count,f=!0,m=!0,u=0);const g=mc(a,i,o,s,n,f,c),_=mc(a,i,o,s,h,m,c);r.emplaceBack(u+g-l,u+_-l),c.primitiveLength++}}}(a,r,s,n,l,e),t.forceNewSegmentOnNextPrepare(),null==a||a.forceNewSegmentOnNextPrepare()}function mc(e,t,r,i,n,o,a){if(o){const o=i.count;return r(t[2*n],t[2*n+1]),e[n]=i.count,i.count++,a.vertexLength++,o}return e[n]}class gc{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.hasDependencies=!1,this.patternFeatures=[],this.layoutVertexArray=new ja,this.indexArray=new Ja,this.indexArray2=new Ka,this.programConfigurations=new Ms(e.layers,e.zoom),this.segments=new ts,this.segments2=new ts,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,r){this.hasDependencies=Rl("fill",this.layers,t);const i=this.layers[0].layout.get("fill-sort-key"),n=!i.isConstant(),o=[];for(const{feature:a,id:s,index:l,sourceLayerIndex:c}of e){const e=this.layers[0]._featureFilter.needGeometry,u=zs(a,e);if(!this.layers[0]._featureFilter.filter(new Co(this.zoom),u,r))continue;const h=n?i.evaluate(u,{},r,t.availableImages):void 0,d={id:s,properties:a.properties,type:a.type,sourceLayerIndex:c,index:l,geometry:e?u.geometry:Os(a),patterns:{},sortKey:h};o.push(d)}n&&o.sort((e,t)=>e.sortKey-t.sortKey);for(const a of o){const{geometry:i,index:n,sourceLayerIndex:o}=a;if(this.hasDependencies){const e=Ll("fill",this.layers,a,{zoom:this.zoom},t);this.patternFeatures.push(e)}else this.addFeature(a,i,n,r,{},t.subdivisionGranularity);t.featureIndex.insert(e[n].feature,i,n,o,this.index)}}update(e,t,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:r})}addFeatures(e,t,r){for(const i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,t,r,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,Dl),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,r,i,n,o){for(const a of Qr(t,500)){const e=hc(a,i,o.fill.getGranularityForZoomLevel(i.z)),t=this.layoutVertexArray;fc((e,r)=>{t.emplaceBack(e,r)},this.segments,this.layoutVertexArray,this.indexArray,e.verticesFlattened,e.indicesTriangles,this.segments2,this.indexArray2,e.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,{imagePositions:n,canonical:i})}}let _c,yc;lo("FillBucket",gc,{omit:["layers","patternFeatures"]});var vc={get paint(){return yc=yc||new Wo({"fill-antialias":new Vo(ye.paint_fill["fill-antialias"]),"fill-opacity":new Uo(ye.paint_fill["fill-opacity"]),"fill-color":new Uo(ye.paint_fill["fill-color"]),"fill-outline-color":new Uo(ye.paint_fill["fill-outline-color"]),"fill-translate":new Vo(ye.paint_fill["fill-translate"]),"fill-translate-anchor":new Vo(ye.paint_fill["fill-translate-anchor"]),"fill-pattern":new Go(ye.paint_fill["fill-pattern"])})},get layout(){return _c=_c||new Wo({"fill-sort-key":new Uo(ye.layout_fill["fill-sort-key"])})}};class bc extends Zo{constructor(e,t){super(e,vc,t)}recalculate(e,t){super.recalculate(e,t);const r=this.paint._values["fill-outline-color"];"constant"===r.value.kind&&void 0===r.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new gc(e)}queryRadius(){return Qs(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:t,transform:r,pixelsToTileUnits:i}){return Gs(el(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-r.bearingInRadians,i),t)}isTileClipped(){return!0}}const xc=ea([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),wc=ea([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Tc}=xc;class Sc{constructor(e,t,r,i,n){this.properties={},this.extent=r,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=i,this._values=n,e.readFields(Ec,this,t)}loadGeometry(){const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos,i=[];let n,o=1,a=0,s=0,l=0;for(;e.pos<t;){if(a<=0){const t=e.readVarint();o=7&t,a=t>>3}if(a--,1===o||2===o)s+=e.readSVarint(),l+=e.readSVarint(),1===o&&(n&&i.push(n),n=[]),n&&n.push(new r(s,l));else{if(7!==o)throw new Error(`unknown command ${o}`);n&&n.push(n[0].clone())}}return n&&i.push(n),i}bbox(){const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos;let r=1,i=0,n=0,o=0,a=1/0,s=-1/0,l=1/0,c=-1/0;for(;e.pos<t;){if(i<=0){const t=e.readVarint();r=7&t,i=t>>3}if(i--,1===r||2===r)n+=e.readSVarint(),o+=e.readSVarint(),n<a&&(a=n),n>s&&(s=n),o<l&&(l=o),o>c&&(c=o);else if(7!==r)throw new Error(`unknown command ${r}`)}return[a,l,s,c]}toGeoJSON(e,t,r){const i=this.extent*Math.pow(2,r),n=this.extent*e,o=this.extent*t,a=this.loadGeometry();function s(e){return[360*(e.x+n)/i-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+o)/i)*Math.PI))-90]}function l(e){return e.map(s)}let c;if(1===this.type){const e=[];for(const r of a)e.push(r[0]);const t=l(e);c=1===e.length?{type:"Point",coordinates:t[0]}:{type:"MultiPoint",coordinates:t}}else if(2===this.type){const e=a.map(l);c=1===e.length?{type:"LineString",coordinates:e[0]}:{type:"MultiLineString",coordinates:e}}else{if(3!==this.type)throw new Error("unknown feature type");{const e=function(e){const t=e.length;if(t<=1)return[e];const r=[];let i,n;for(let o=0;o<t;o++){const t=Ic(e[o]);0!==t&&(void 0===n&&(n=t<0),n===t<0?(i&&r.push(i),i=[e[o]]):i&&i.push(e[o]))}return i&&r.push(i),r}(a),t=[];for(const r of e)t.push(r.map(l));c=1===t.length?{type:"Polygon",coordinates:t[0]}:{type:"MultiPolygon",coordinates:t}}}const u={type:"Feature",geometry:c,properties:this.properties};return null!=this.id&&(u.id=this.id),u}}function Ec(e,t,r){1===e?t.id=r.readVarint():2===e?function(e,t){const r=e.readVarint()+e.pos;for(;e.pos<r;){const r=t._keys[e.readVarint()],i=t._values[e.readVarint()];t.properties[r]=i}}(r,t):3===e?t.type=r.readVarint():4===e&&(t._geometry=r.pos)}function Ic(e){let t=0;for(let r,i,n=0,o=e.length,a=o-1;n<o;a=n++)r=e[n],i=e[a],t+=(i.x-r.x)*(r.y+i.y);return t}Sc.types=["Unknown","Point","LineString","Polygon"];class Pc{constructor(e,t){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(kc,this,t),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];const t=this._pbf.readVarint()+this._pbf.pos;return new Sc(this._pbf,t,this.extent,this._keys,this._values)}}function kc(e,t,r){15===e?t.version=r.readVarint():1===e?t.name=r.readString():5===e?t.extent=r.readVarint():2===e?t._features.push(r.pos):3===e?t._keys.push(r.readString()):4===e&&t._values.push(function(e){let t=null;const r=e.readVarint()+e.pos;for(;e.pos<r;){const 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}if(null==t)throw new Error("unknown feature value");return t}(r))}class Ac{constructor(e,t){this.layers=e.readFields(Cc,{},t)}}function Cc(e,t,r){if(3===e){const e=new Pc(r,r.readVarint()+r.pos);e.length&&(t[e.name]=e)}}const Mc=Math.pow(2,13);function Dc(e,t,r,i,n,o,a,s){e.emplaceBack(t,r,2*Math.floor(i*Mc)+a,n*Mc*2,o*Mc*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.hasDependencies=!1,this.layoutVertexArray=new Va,this.centroidVertexArray=new Ba,this.indexArray=new Ja,this.programConfigurations=new Ms(e.layers,e.zoom),this.segments=new ts,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,r){this.features=[],this.hasDependencies=Rl("fill-extrusion",this.layers,t);for(const{feature:i,id:n,index:o,sourceLayerIndex:a}of e){const e=this.layers[0]._featureFilter.needGeometry,s=zs(i,e);if(!this.layers[0]._featureFilter.filter(new Co(this.zoom),s,r))continue;const l={id:n,sourceLayerIndex:a,index:o,geometry:e?s.geometry:Os(i),properties:i.properties,type:i.type,patterns:{}};this.hasDependencies?this.features.push(Ll("fill-extrusion",this.layers,l,{zoom:this.zoom},t)):this.addFeature(l,l.geometry,o,r,{},t.subdivisionGranularity),t.featureIndex.insert(i,l.geometry,o,a,this.index,!0)}}addFeatures(e,t,r){for(const i of this.features){const{geometry:n}=i;this.addFeature(i,n,i.index,t,r,e.subdivisionGranularity)}}update(e,t,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:r})}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,Tc),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,wc.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,r,i,n,o){for(const a of Qr(t,500)){const t={x:0,y:0,sampleCount:0},r=this.layoutVertexArray.length;this.processPolygon(t,i,e,a,o);const n=this.layoutVertexArray.length-r,s=Math.floor(t.x/t.sampleCount),l=Math.floor(t.y/t.sampleCount);for(let e=0;e<n;e++)this.centroidVertexArray.emplaceBack(s,l)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,{imagePositions:n,canonical:i})}processPolygon(e,t,r,i,n){if(i.length<1)return;if(Oc(i[0]))return;for(const u of i)0!==u.length&&Lc(e,u);const o={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},a=n.fill.getGranularityForZoomLevel(t.z),s="Polygon"===Sc.types[r.type];for(const u of i){if(0===u.length)continue;if(Oc(u))continue;const e=dc(u,a,s);this._generateSideFaces(e,o)}if(!s)return;const l=hc(i,t,a,!1),c=this.layoutVertexArray;fc((e,t)=>{Dc(c,e,t,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles)}_generateSideFaces(e,t){let r=0;for(let i=1;i<e.length;i++){const n=e[i],o=e[i-1];if(Fc(n,o))continue;t.segment.vertexLength+4>ts.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);r+s>32768&&(r=0),Dc(this.layoutVertexArray,n.x,n.y,a.x,a.y,0,0,r),Dc(this.layoutVertexArray,n.x,n.y,a.x,a.y,0,1,r),r+=s,Dc(this.layoutVertexArray,o.x,o.y,a.x,a.y,0,0,r),Dc(this.layoutVertexArray,o.x,o.y,a.x,a.y,0,1,r);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 Lc(e,t){for(let r=0;r<t.length;r++){const i=t[r];r===t.length-1&&t[0].x===i.x&&t[0].y===i.y||(e.x+=i.x,e.y+=i.y,e.sampleCount++)}}function Fc(e,t){return e.x===t.x&&(e.x<0||e.x>A)||e.y===t.y&&(e.y<0||e.y>A)}function Oc(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 zc;lo("FillExtrusionBucket",Rc,{omit:["layers","features"]});var Bc={get paint(){return zc=zc||new Wo({"fill-extrusion-opacity":new Vo(ye["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Uo(ye["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Vo(ye["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Vo(ye["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Go(ye["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Uo(ye["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Uo(ye["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Vo(ye["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Nc extends Zo{constructor(e,t){super(e,Bc,t)}createBucket(e){return new Rc(e)}queryRadius(){return Qs(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:n,transform:o,pixelsToTileUnits:a,pixelPosMatrix:s}){const l=el(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-o.bearingInRadians,a),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 n of e){const e=[n.x,n.y,0,1];S(e,e,t),i.push(new r(e[0]/e[3],e[1]/e[3]))}return i}(l,s),d=function(e,t,i,n){const o=[],a=[],s=n[8]*t,l=n[9]*t,c=n[10]*t,u=n[11]*t,h=n[8]*i,d=n[9]*i,p=n[10]*i,f=n[11]*i;for(const m of e){const e=[],t=[];for(const i of m){const o=i.x,a=i.y,m=n[0]*o+n[4]*a+n[12],g=n[1]*o+n[5]*a+n[13],_=n[2]*o+n[6]*a+n[14],y=n[3]*o+n[7]*a+n[15],v=_+c,b=y+u,x=m+h,w=g+d,T=_+p,S=y+f,E=new r((m+s)/b,(g+l)/b);E.z=v/b,e.push(E);const I=new r(x/S,w/S);I.z=T/S,t.push(I)}o.push(e),a.push(t)}return[o,a]}(n,u,c,s);return function(e,t,r){let i=1/0;Gs(r,t)&&(i=Vc(r,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];Vs(r,n)&&(i=Math.min(i,Vc(r,n)))}}return i!==1/0&&i}(d[0],d[1],h)}}function jc(e,t){return e.x*t.x+e.y*t.y}function Vc(e,t){if(1===e.length){let r=0;const i=t[r++];let n;for(;!n||i.equals(n);)if(n=t[r++],!n)return 1/0;for(;r<t.length;r++){const o=t[r],a=e[0],s=n.sub(i),l=o.sub(i),c=a.sub(i),u=jc(s,s),h=jc(s,l),d=jc(l,l),p=jc(c,s),f=jc(c,l),m=u*d-h*h,g=(d*p-h*f)/m,_=(u*f-h*p)/m,y=i.z*(1-g-_)+n.z*g+o.z*_;if(isFinite(y))return y}return 1/0}{let e=1/0;for(const r of t)e=Math.min(e,r.z);return e}}const Uc=ea([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Gc}=Uc,qc=ea([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:$c}=qc,Wc=Math.cos(Math.PI/180*37.5),Zc=Math.pow(2,14)/.5;class Hc{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.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(e=>{this.gradients[e.id]={}}),this.layoutVertexArray=new Ua,this.layoutVertexArray2=new Ga,this.indexArray=new Ja,this.programConfigurations=new Ms(e.layers,e.zoom),this.segments=new ts,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,r){this.hasDependencies=Rl("line",this.layers,t)||this.hasLineDasharray(this.layers);const i=this.layers[0].layout.get("line-sort-key"),n=!i.isConstant(),o=[];for(const{feature:a,id:s,index:l,sourceLayerIndex:c}of e){const e=this.layers[0]._featureFilter.needGeometry,t=zs(a,e);if(!this.layers[0]._featureFilter.filter(new Co(this.zoom),t,r))continue;const u=n?i.evaluate(t,{},r):void 0,h={id:s,properties:a.properties,type:a.type,sourceLayerIndex:c,index:l,geometry:e?t.geometry:Os(a),patterns:{},dashes:{},sortKey:u};o.push(h)}n&&o.sort((e,t)=>e.sortKey-t.sortKey);for(const a of o){const{geometry:i,index:n,sourceLayerIndex:o}=a;this.hasDependencies?(Rl("line",this.layers,t)?Ll("line",this.layers,a,{zoom:this.zoom},t):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,a,this.zoom,t),this.patternFeatures.push(a)):this.addFeature(a,i,n,r,{},{},t.subdivisionGranularity),t.featureIndex.insert(e[n].feature,i,n,o,this.index)}}update(e,t,r,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:r,dashPositions:i})}addFeatures(e,t,r,i){for(const n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,t,r,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,$c)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Gc),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,r,i,n,o,a){const s=this.layers[0].layout,l=s.get("line-join").evaluate(e,{}),c=s.get("line-cap"),u=s.get("line-miter-limit"),h=s.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const d of t)this.addLine(d,e,l,c,u,h,i,a);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,{imagePositions:n,dashPositions:o,canonical:i})}addLine(e,t,r,i,n,o,a,s){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,e=dc(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"===Sc.types[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"===r&&(n=1.05);const h=this.overscaling<=16?122880/(512*this.overscaling):0,d=this.segments.prepareSegment(10*c,this.layoutVertexArray,this.indexArray);let p,f,m,g,_;this.e1=this.e2=-1,l&&(p=e[c-2],_=e[u].sub(p)._unit()._perp());for(let y=u;y<c;y++){if(m=y===c-1?l?e[u+1]:void 0:e[y+1],m&&e[y].equals(m))continue;_&&(g=_),p&&(f=p),p=e[y],_=m?m.sub(p)._unit()._perp():g,g=g||_;let t=g.add(_);0===t.x&&0===t.y||t._unit();const a=g.x*_.x+g.y*_.y,s=t.x*_.x+t.y*_.y,v=0!==s?1/s:1/0,b=2*Math.sqrt(2-2*s),x=s<Wc&&f&&m,w=g.x*_.y-g.y*_.x>0;if(x&&y>u){const e=p.dist(f);if(e>2*h){const t=p.sub(p.sub(f)._mult(h/e)._round());this.updateDistance(f,t),this.addCurrentVertex(t,g,0,0,d),f=t}}const T=f&&m;let S=T?r:l?"butt":i;if(T&&"round"===S&&(v<o?S="miter":v<=2&&(S="fakeround")),"miter"===S&&v>n&&(S="bevel"),"bevel"===S&&(v>2&&(S="flipbevel"),v<n&&(S="miter")),f&&this.updateDistance(f,p),"miter"===S)t._mult(v),this.addCurrentVertex(p,t,0,0,d);else if("flipbevel"===S){if(v>100)t=_.mult(-1);else{const e=v*g.add(_).mag()/g.sub(_).mag();t._perp()._mult(e*(w?-1:1))}this.addCurrentVertex(p,t,0,0,d),this.addCurrentVertex(p,t.mult(-1),0,0,d)}else if("bevel"===S||"fakeround"===S){const e=-Math.sqrt(v*v-1),t=w?e:0,r=w?0:e;if(f&&this.addCurrentVertex(p,g,t,r,d),"fakeround"===S){const e=Math.round(180*b/Math.PI/20);for(let t=1;t<e;t++){let r=t/e;if(.5!==r){const e=r-.5;r+=r*e*(r-1)*((1.0904+a*(a*(3.55645-1.43519*a)-3.2452))*e*e+(.848013+a*(.215638*a-1.06021)))}const i=_.sub(g)._mult(r)._add(g)._unit()._mult(w?-1:1);this.addHalfVertex(p,i.x,i.y,!1,w,0,d)}}m&&this.addCurrentVertex(p,_,-t,-r,d)}else if("butt"===S)this.addCurrentVertex(p,t,0,0,d);else if("square"===S){const e=f?1:-1;this.addCurrentVertex(p,t,e,e,d)}else"round"===S&&(f&&(this.addCurrentVertex(p,g,0,0,d),this.addCurrentVertex(p,g,1,1,d,!0)),m&&(this.addCurrentVertex(p,_,-1,-1,d,!0),this.addCurrentVertex(p,_,0,0,d)));if(x&&y<c-1){const e=p.dist(m);if(e>2*h){const t=p.add(m.sub(p)._mult(h/e)._round());this.updateDistance(p,t),this.addCurrentVertex(t,_,0,0,d),p=t}}}}addCurrentVertex(e,t,r,i,n,o=!1){const a=t.y*i-t.x,s=-t.y-t.x*i;this.addHalfVertex(e,t.x+t.y*r,t.y-t.x*r,o,!1,r,n),this.addHalfVertex(e,a,s,o,!0,-i,n),this.distance>Zc/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,t,r,i,n,o))}addHalfVertex({x:e,y:t},r,i,n,o,a,s){const l=.5*(this.lineClips?this.scaledDistance*(Zc-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(n?1:0),(t<<1)+(o?1:0),Math.round(63*r)+128,Math.round(63*i)+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()}hasLineDasharray(e){for(const t of e){const e=t.paint.get("line-dasharray");if(e&&!e.isConstant())return!0}return!1}addLineDashDependencies(e,t,r,i){for(const n of e){const e=n.paint.get("line-dasharray");if(!e||"constant"===e.value.kind)continue;const o="round"===n.layout.get("line-cap"),a={dasharray:e.value.evaluate({zoom:r-1},t,{}),round:o},s={dasharray:e.value.evaluate({zoom:r},t,{}),round:o},l={dasharray:e.value.evaluate({zoom:r+1},t,{}),round:o},c=`${a.dasharray.join(",")},${a.round}`,u=`${s.dasharray.join(",")},${s.round}`,h=`${l.dasharray.join(",")},${l.round}`;i.dashDependencies[c]=a,i.dashDependencies[u]=s,i.dashDependencies[h]=l,t.dashes[n.id]={min:c,mid:u,max:h}}}}let Xc,Yc;lo("LineBucket",Hc,{omit:["layers","patternFeatures"]});var Jc={get paint(){return Yc=Yc||new Wo({"line-opacity":new Uo(ye.paint_line["line-opacity"]),"line-color":new Uo(ye.paint_line["line-color"]),"line-translate":new Vo(ye.paint_line["line-translate"]),"line-translate-anchor":new Vo(ye.paint_line["line-translate-anchor"]),"line-width":new Uo(ye.paint_line["line-width"]),"line-gap-width":new Uo(ye.paint_line["line-gap-width"]),"line-offset":new Uo(ye.paint_line["line-offset"]),"line-blur":new Uo(ye.paint_line["line-blur"]),"line-dasharray":new Go(ye.paint_line["line-dasharray"]),"line-pattern":new Go(ye.paint_line["line-pattern"]),"line-gradient":new $o(ye.paint_line["line-gradient"])})},get layout(){return Xc=Xc||new Wo({"line-cap":new Vo(ye.layout_line["line-cap"]),"line-join":new Uo(ye.layout_line["line-join"]),"line-miter-limit":new Vo(ye.layout_line["line-miter-limit"]),"line-round-limit":new Vo(ye.layout_line["line-round-limit"]),"line-sort-key":new Uo(ye.layout_line["line-sort-key"])})}};class Kc extends Uo{possiblyEvaluate(e,t){return t=new Co(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,r,i){return t=B({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,r,i)}}let Qc;class eu extends Zo{constructor(e,t){super(e,Jc,t),this.gradientVersion=0,Qc||(Qc=new Kc(Jc.paint.properties["line-width"].specification),Qc.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 ar,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"]=Qc.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new Hc(e)}queryRadius(e){const t=e,r=tu(Ks("line-width",this,t),Ks("line-gap-width",this,t)),i=Ks("line-offset",this,t);return r/2+Math.abs(i)+Qs(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:n,transform:o,pixelsToTileUnits:a}){const s=el(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-o.bearingInRadians,a),l=a/2*tu(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&&(n=function(e,t){const i=[];for(let n=0;n<e.length;n++){const o=e[n],a=[];for(let e=0;e<o.length;e++){const i=o[e-1],n=o[e],s=o[e+1],l=0===e?new r(0,0):n.sub(i)._unit()._perp(),c=e===o.length-1?new r(0,0):s.sub(n)._unit()._perp(),u=l._add(c)._unit(),h=u.x*c.x+u.y*c.y;0!==h&&u._mult(1/h),a.push(u._mult(t)._add(n))}i.push(a)}return i}(n,c*a)),function(e,t,r){for(let i=0;i<t.length;i++){const n=t[i];if(e.length>=3)for(let t=0;t<n.length;t++)if(Ys(e,n[t]))return!0;if(qs(e,n,r))return!0}return!1}(s,n,l)}isTileClipped(){return!0}}function tu(e,t){return t>0?t+2*e:e}const ru=ea([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),iu=ea([{name:"a_projected_pos",components:3,type:"Float32"}],4);ea([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const nu=ea([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);ea([{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 ou=ea([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),au=ea([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function su(e,t,r){return e.sections.forEach(e=>{e.text=function(e,t,r){const i=t.layout.get("text-transform").evaluate(r,{});return"uppercase"===i?e=e.toLocaleUpperCase():"lowercase"===i&&(e=e.toLocaleLowerCase()),Ao.applyArabicShaping&&(e=Ao.applyArabicShaping(e)),e}(e.text,t,r)}),e}ea([{name:"triangle",components:3,type:"Uint16"}]),ea([{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"}]),ea([{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"}]),ea([{type:"Float32",name:"offsetX"}]),ea([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),ea([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var lu=24;const cu={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","⋯":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},uu={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},hu={40:!0};function du(e,t,r,i,n,o){if("fontStack"in t){const i=r[t.fontStack],o=i&&i[e];return o?o.metrics.advance*t.scale+n:0}{const e=i[t.imageName];return e?e.displaySize[0]*t.scale*lu/o+n:0}}function pu(e,t,r,i){const n=Math.pow(e-t,2);return i?e<t?n/2:2*n:n+Math.abs(r)*r}function fu(e,t,r){let i=0;return 10===e&&(i-=1e4),r&&(i+=150),40!==e&&65288!==e||(i+=50),41!==t&&65289!==t||(i+=50),i}function mu(e,t,r,i,n,o){let a=null,s=pu(t,r,n,o);for(const l of i){const e=pu(t-l.x,r,n,o)+l.badness;e<=s&&(a=l,s=e)}return{index:e,x:t,priorBreak:a,badness:s}}function gu(e){return e?gu(e.priorBreak).concat(e.index):[]}class _u{constructor(e="",t=[],r=[]){this.text=e,this.sections=t,this.sectionIndex=r,this.imageSectionID=null}static fromFeature(e,t){const r=new _u;for(let i=0;i<e.sections.length;i++){const n=e.sections[i];n.image?r.addImageSection(n):r.addTextSection(n,t)}return r}length(){return[...this.text].length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}verticalizePunctuation(){this.text=function(e){let t="",r={premature:!0,value:void 0};const i=e[Symbol.iterator]();let n=i.next();const o=e[Symbol.iterator]();o.next();let a=o.next();for(;!n.done;)t+=!a.done&&So(a.value.codePointAt(0))&&!cu[a.value]||!r.premature&&So(r.value.codePointAt(0))&&!cu[r.value]||!cu[n.value]?n.value:cu[n.value],r={value:n.value,premature:!1},n=i.next(),a=o.next();return t}(this.text)}hasZeroWidthSpaces(){return this.text.includes("")}trim(){const e=this.text.match(/^\s*/),t=e?e[0].length:0,r=this.text.match(/\S\s*$/),i=r?r[0].length-1:0;this.text=this.text.substring(t,this.text.length-i),this.sectionIndex=this.sectionIndex.slice(t,this.sectionIndex.length-i)}substring(e,t){const r=[...this.text].slice(e,t).join(""),i=this.sectionIndex.slice(e,t);return new _u(r,this.sections,i)}toCodeUnitIndex(e){return[...this.text].slice(0,e).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,t)=>Math.max(e,this.sections[t].scale),0)}getMaxImageSize(e){let t=0,r=0;for(let i=0;i<this.length();i++){const n=this.getSection(i);if("imageName"in n){const i=e[n.imageName];if(!i)continue;const o=i.displaySize;t=Math.max(t,o[0]),r=Math.max(r,o[1])}}return{maxImageWidth:t,maxImageHeight:r}}addTextSection(e,t){this.text+=e.text,this.sections.push({scale:e.scale||1,verticalAlign:e.verticalAlign||"bottom",fontStack:e.fontStack||t});const r=this.sections.length-1;this.sectionIndex.push(...[...e.text].map(()=>r))}addImageSection(e){const t=e.image?e.image.name:"";if(0===t.length)return void q("Can't add FormattedSection with an empty image.");const r=this.getNextImageSectionCharCode();r?(this.text+=String.fromCharCode(r),this.sections.push({scale:1,verticalAlign:e.verticalAlign||"bottom",imageName:t}),this.sectionIndex.push(this.sections.length-1)):q("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(e,t,r,i,n){const o=[],a=this.determineAverageLineWidth(e,t,r,i,n),s=this.hasZeroWidthSpaces();let l=0,c=0;const u=this.text[Symbol.iterator]();let h=u.next();const d=this.text[Symbol.iterator]();d.next();let p=d.next();const f=this.text[Symbol.iterator]();f.next(),f.next();let m=f.next();for(;!h.done;){const t=this.getSection(c),g=h.value.codePointAt(0);if(yo(g)||(l+=du(g,t,r,i,e,n)),!p.done){const e=go(g),r=p.value.codePointAt(0);(uu[g]||e||"imageName"in t||!m.done&&hu[r])&&o.push(mu(c+1,l,a,o,fu(g,r,e&&s),!1))}c++,h=u.next(),p=d.next(),m=f.next()}return gu(mu(this.length(),l,a,o,0,!0))}determineAverageLineWidth(e,t,r,i,n){let o=0,a=0;for(const s of this.text){const t=this.getSection(a);o+=du(s.codePointAt(0),t,r,i,e,n),a++}return o/Math.max(1,Math.ceil(o/t))}}const yu=4294967296,vu=1/yu,bu="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");class xu{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,t,r=this.length){for(;this.pos<r;){const r=this.readVarint(),i=r>>3,n=this.pos;this.type=7&r,e(i,t,this),this.pos===n&&this.skip(r)}return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*yu;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*yu;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const t=this.buf;let r,i;return i=t[this.pos++],r=127&i,i<128?r:(i=t[this.pos++],r|=(127&i)<<7,i<128?r:(i=t[this.pos++],r|=(127&i)<<14,i<128?r:(i=t[this.pos++],r|=(127&i)<<21,i<128?r:(i=t[this.pos],r|=(15&i)<<28,function(e,t,r){const i=r.buf;let n,o;if(o=i[r.pos++],n=(112&o)>>4,o<128)return wu(e,n,t);if(o=i[r.pos++],n|=(127&o)<<3,o<128)return wu(e,n,t);if(o=i[r.pos++],n|=(127&o)<<10,o<128)return wu(e,n,t);if(o=i[r.pos++],n|=(127&o)<<17,o<128)return wu(e,n,t);if(o=i[r.pos++],n|=(127&o)<<24,o<128)return wu(e,n,t);if(o=i[r.pos++],n|=(1&o)<<31,o<128)return wu(e,n,t);throw new Error("Expected varint not more than 10 bytes")}(r,e,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return Boolean(this.readVarint())}readString(){const e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&bu?bu.decode(this.buf.subarray(t,e)):function(e,t,r){let i="",n=t;for(;n<r;){const t=e[n];let o,a,s,l=null,c=t>239?4:t>223?3:t>191?2:1;if(n+c>r)break;1===c?t<128&&(l=t):2===c?(o=e[n+1],128==(192&o)&&(l=(31&t)<<6|63&o,l<=127&&(l=null))):3===c?(o=e[n+1],a=e[n+2],128==(192&o)&&128==(192&a)&&(l=(15&t)<<12|(63&o)<<6|63&a,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===c&&(o=e[n+1],a=e[n+2],s=e[n+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(l=(15&t)<<18|(63&o)<<12|(63&a)<<6|63&s,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,c=1):l>65535&&(l-=65536,i+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),i+=String.fromCharCode(l),n+=c}return i}(this.buf,t,e)}readBytes(){const e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){const r=this.readPackedEnd();for(;this.pos<r;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}skip(e){const t=7&e;if(0===t)for(;this.buf[this.pos++]>127;);else if(2===t)this.pos=this.readVarint()+this.pos;else if(5===t)this.pos+=4;else{if(1!==t)throw new Error(`Unimplemented type: ${t}`);this.pos+=8}}writeTag(e,t){this.writeVarint(e<<3|t)}realloc(e){let t=this.length||16;for(;t<this.pos+e;)t*=2;if(t!==this.length){const e=new Uint8Array(t);e.set(this.buf),this.buf=e,this.dataView=new DataView(e.buffer),this.length=t}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*vu),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*vu),!0),this.pos+=8}writeVarint(e){(e=+e||0)>268435455||e<0?function(e,t){let r,i;if(e>=0?(r=e%4294967296|0,i=e/4294967296|0):(r=~(-e%4294967296),i=~(-e/4294967296),4294967295^r?r=r+1|0:(r=0,i=i+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,r){r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos++]=127&e|128,r.buf[r.pos]=127&(e>>>=7)}(r,0,t),function(e,t){const r=(7&e)<<4;t.buf[t.pos++]|=r|((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)))))}(i,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(e){this.writeVarint(e<0?2*-e-1:2*e)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(4*e.length),this.pos++;const t=this.pos;this.pos=function(e,t,r){for(let i,n,o=0;o<t.length;o++){if(i=t.charCodeAt(o),i>55295&&i<57344){if(!n){i>56319||o+1===t.length?(e[r++]=239,e[r++]=191,e[r++]=189):n=i;continue}if(i<56320){e[r++]=239,e[r++]=191,e[r++]=189,n=i;continue}i=n-55296<<10|i-56320|65536,n=null}else n&&(e[r++]=239,e[r++]=191,e[r++]=189,n=null);i<128?e[r++]=i:(i<2048?e[r++]=i>>6|192:(i<65536?e[r++]=i>>12|224:(e[r++]=i>>18|240,e[r++]=i>>12&63|128),e[r++]=i>>6&63|128),e[r++]=63&i|128)}return r}(this.buf,e,this.pos);const r=this.pos-t;r>=128&&Tu(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){const t=e.length;this.writeVarint(t),this.realloc(t);for(let r=0;r<t;r++)this.buf[this.pos++]=e[r]}writeRawMessage(e,t){this.pos++;const r=this.pos;e(t,this);const i=this.pos-r;i>=128&&Tu(r,i,this),this.pos=r-1,this.writeVarint(i),this.pos+=i}writeMessage(e,t,r){this.writeTag(e,2),this.writeRawMessage(t,r)}writePackedVarint(e,t){t.length&&this.writeMessage(e,Su,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,Eu,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,ku,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,Iu,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,Pu,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,Au,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,Cu,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,Mu,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,Du,t)}writeBytesField(e,t){this.writeTag(e,2),this.writeBytes(t)}writeFixed32Field(e,t){this.writeTag(e,5),this.writeFixed32(t)}writeSFixed32Field(e,t){this.writeTag(e,5),this.writeSFixed32(t)}writeFixed64Field(e,t){this.writeTag(e,1),this.writeFixed64(t)}writeSFixed64Field(e,t){this.writeTag(e,1),this.writeSFixed64(t)}writeVarintField(e,t){this.writeTag(e,0),this.writeVarint(t)}writeSVarintField(e,t){this.writeTag(e,0),this.writeSVarint(t)}writeStringField(e,t){this.writeTag(e,2),this.writeString(t)}writeFloatField(e,t){this.writeTag(e,5),this.writeFloat(t)}writeDoubleField(e,t){this.writeTag(e,1),this.writeDouble(t)}writeBooleanField(e,t){this.writeVarintField(e,+t)}}function wu(e,t,r){return r?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function Tu(e,t,r){const i=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));r.realloc(i);for(let n=r.pos-1;n>=e;n--)r.buf[n+i]=r.buf[n]}function Su(e,t){for(let r=0;r<e.length;r++)t.writeVarint(e[r])}function Eu(e,t){for(let r=0;r<e.length;r++)t.writeSVarint(e[r])}function Iu(e,t){for(let r=0;r<e.length;r++)t.writeFloat(e[r])}function Pu(e,t){for(let r=0;r<e.length;r++)t.writeDouble(e[r])}function ku(e,t){for(let r=0;r<e.length;r++)t.writeBoolean(e[r])}function Au(e,t){for(let r=0;r<e.length;r++)t.writeFixed32(e[r])}function Cu(e,t){for(let r=0;r<e.length;r++)t.writeSFixed32(e[r])}function Mu(e,t){for(let r=0;r<e.length;r++)t.writeFixed64(e[r])}function Du(e,t){for(let r=0;r<e.length;r++)t.writeSFixed64(e[r])}function Ru(e,t,r){1===e&&r.readMessage(Lu,t)}function Lu(e,t,r){if(3===e){const{id:e,bitmap:i,width:n,height:o,left:a,top:s,advance:l}=r.readMessage(Fu,{});t.push({id:e,bitmap:new _l({width:n+6,height:o+6},i),metrics:{width:n,height:o,left:a,top:s,advance:l}})}}function Fu(e,t,r){1===e?t.id=r.readVarint():2===e?t.bitmap=r.readBytes():3===e?t.width=r.readVarint():4===e?t.height=r.readVarint():5===e?t.left=r.readSVarint():6===e?t.top=r.readSVarint():7===e&&(t.advance=r.readVarint())}function Ou(e){let t=0,r=0;for(const a of e)t+=a.w*a.h,r=Math.max(r,a.w);e.sort((e,t)=>t.h-e.h);const i=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),r),h:1/0}];let n=0,o=0;for(const a of e)for(let e=i.length-1;e>=0;e--){const t=i[e];if(!(a.w>t.w||a.h>t.h)){if(a.x=t.x,a.y=t.y,o=Math.max(o,a.y+a.h),n=Math.max(n,a.x+a.w),a.w===t.w&&a.h===t.h){const t=i.pop();t&&e<i.length&&(i[e]=t)}else a.h===t.h?(t.x+=a.w,t.w-=a.w):a.w===t.w?(t.y+=a.h,t.h-=a.h):(i.push({x:t.x+a.w,y:t.y,w:t.w-a.w,h:a.h}),t.y+=a.h,t.h-=a.h);break}}return{w:n,h:o,fill:t/(n*o)||0}}class zu{constructor(e,{pixelRatio:t,version:r,stretchX:i,stretchY:n,content:o,textFitWidth:a,textFitHeight:s}){this.paddedRect=e,this.pixelRatio=t,this.stretchX=i,this.stretchY=n,this.content=o,this.version=r,this.textFitWidth=a,this.textFitHeight=s}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class Bu{constructor(e,t){const r={},i={};this.haveRenderCallbacks=[];const n=[];this.addImages(e,r,n),this.addImages(t,i,n);const{w:o,h:a}=Ou(n),s=new yl({width:o||1,height:a||1});for(const l in e){const t=e[l],i=r[l].paddedRect;yl.copy(t.data,s,{x:0,y:0},{x:i.x+1,y:i.y+1},t.data)}for(const l in t){const e=t[l],r=i[l].paddedRect,n=r.x+1,o=r.y+1,a=e.data.width,c=e.data.height;yl.copy(e.data,s,{x:0,y:0},{x:n,y:o},e.data),yl.copy(e.data,s,{x:0,y:c-1},{x:n,y:o-1},{width:a,height:1}),yl.copy(e.data,s,{x:0,y:0},{x:n,y:o+c},{width:a,height:1}),yl.copy(e.data,s,{x:a-1,y:0},{x:n-1,y:o},{width:1,height:c}),yl.copy(e.data,s,{x:0,y:0},{x:n+a,y:o},{width:1,height:c})}this.image=s,this.iconPositions=r,this.patternPositions=i}addImages(e,t,r){for(const i in e){const n=e[i],o={x:0,y:0,w:n.data.width+2,h:n.data.height+2};r.push(o),t[i]=new zu(o,n),n.hasRenderCallback&&this.haveRenderCallbacks.push(i)}}patchUpdatedImages(e,t){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const r in e.updatedImages)this.patchUpdatedImage(this.iconPositions[r],e.getImage(r),t),this.patchUpdatedImage(this.patternPositions[r],e.getImage(r),t)}patchUpdatedImage(e,t,r){if(!e||!t)return;if(e.version===t.version)return;e.version=t.version;const[i,n]=e.tl;r.update(t.data,void 0,{x:i,y:n})}}var Nu;function ju(t,r,i,n,o,a,s,l,c,u,h,d,p,f,m){const g=_u.fromFeature(t,o);let _;d===e.ay.vertical&&g.verticalizePunctuation();let y=g.determineLineBreaks(u,a,r,n,f);const{processBidirectionalText:v,processStyledBidirectionalText:b}=Ao;if(v&&1===g.sections.length){_=[],y=y.map(e=>g.toCodeUnitIndex(e));const e=v(g.toString(),y);for(const t of e){const e=[...t].map(()=>0);_.push(new _u(t,g.sections,e))}}else if(b){_=[],y=y.map(e=>g.toCodeUnitIndex(e));let e=0;const t=[];for(const i of g.text)t.push(...Array(i.length).fill(g.sectionIndex[e])),e++;const r=b(g.text,t,y);for(const i of r){const e=[];let t="";for(const r of i[0])e.push(i[1][t.length]),t+=r;_.push(new _u(i[0],g.sections,e))}}else _=function(e,t){const r=[];let i=0;for(const n of t)r.push(e.substring(i,n)),i=n;return i<e.length()&&r.push(e.substring(i,e.length())),r}(g,y);const x=[],w={positionedLines:x,text:g.toString(),top:h[1],bottom:h[1],left:h[0],right:h[0],writingMode:d,iconsInText:!1,verticalizable:!1};return function(e,t,r,i,n,o,a,s,l,c,u,h){let d=0,p=0,f=0,m=0;const g="right"===s?1:"left"===s?0:.5,_=lu/h;let y=0;for(const x of n){x.trim();const n=x.getMaxScale(),a={positionedGlyphs:[],lineOffset:0};e.positionedLines[y]=a;const s=a.positionedGlyphs;let h=0;if(!x.length()){p+=o,++y;continue}const v=Uu(i,x,_);let b=0;for(const o of x.text){const a=x.getSection(b),f=o.codePointAt(0),m=qu(l,u,f),g={glyph:f,imageName:null,x:d,y:p+-17,vertical:m,scale:1,fontStack:"",sectionIndex:x.getSectionIndex(b),metrics:null,rect:null};let y;if("fontStack"in a){if(y=$u(a,f,m,v,t,r),!y)continue;g.fontStack=a.fontStack}else{if(e.iconsInText=!0,a.scale*=_,y=Wu(a,m,n,v,i),!y)continue;h=Math.max(h,y.imageOffset),g.imageName=a.imageName}const{rect:w,metrics:T,baselineOffset:S}=y;g.y+=S,g.scale=a.scale,g.metrics=T,g.rect=w,s.push(g),m?(e.verticalizable=!0,d+=("imageName"in a?T.advance:lu)*a.scale+c):d+=T.advance*a.scale+c,b++}0!==s.length&&(f=Math.max(d-c,f),Zu(s,0,s.length-1,g)),d=0,a.lineOffset=Math.max(h,(n-1)*lu);const w=o*n+h;p+=w,m=Math.max(w,m),++y}const{horizontalAlign:v,verticalAlign:b}=Vu(a);(function(e,t,r,i,n,o,a,s,l){const c=(t-r)*n;let u=0;u=o!==a?-s*i- -17:-i*l*a+.5*a;for(const h of e)for(const e of h.positionedGlyphs)e.x+=c,e.y+=u})(e.positionedLines,g,v,b,f,m,o,p,n.length),e.top+=-b*p,e.bottom=e.top+p,e.left+=-v*f,e.right=e.left+f}(w,r,i,n,_,s,l,c,d,u,p,m),!function(e){for(const t of e)if(0!==t.positionedGlyphs.length)return!1;return!0}(x)&&w}function Vu(e){let t=.5,r=.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":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:t,verticalAlign:r}}function Uu(e,t,r){const i=t.getMaxScale()*lu,{maxImageWidth:n,maxImageHeight:o}=t.getMaxImageSize(e),a=Math.max(i,o*r);return{verticalLineContentWidth:Math.max(i,n*r),horizontalLineContentHeight:a}}function Gu(e){switch(e){case"top":return 0;case"center":return.5;default:return 1}}function qu(t,r,i){return!(t===e.ay.horizontal||!r&&!_o(i)||r&&(yo(i)||(n=i,/\p{sc=Arab}/u.test(String.fromCodePoint(n)))));var n}function $u(e,t,r,i,n,o){const a=o[e.fontStack],s=function(e,t,r,i){if(e&&e.rect)return e;const n=t[r.fontStack],o=n&&n[i];return o?{rect:null,metrics:o.metrics}:null}(a&&a[t],n,e,t);if(null===s)return null;let l;if(r)l=i.verticalLineContentWidth-e.scale*lu;else{const t=Gu(e.verticalAlign);l=(i.horizontalLineContentHeight-e.scale*lu)*t}return{rect:s.rect,metrics:s.metrics,baselineOffset:l}}function Wu(e,t,r,i,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:1,top:-3,advance:t?s[1]:s[0]};let c;if(t)c=i.verticalLineContentWidth-s[1]*e.scale;else{const t=Gu(e.verticalAlign);c=(i.horizontalLineContentHeight-s[1]*e.scale)*t}return{rect:a,metrics:l,baselineOffset:c,imageOffset:(t?s[0]:s[1])*e.scale-lu*r}}function Zu(e,t,r,i){if(0===i)return;const n=e[r],o=(e[r].x+n.metrics.advance*n.scale)*i;for(let a=t;a<=r;a++)e[a].x-=o}function Hu(e,t,r){const{horizontalAlign:i,verticalAlign:n}=Vu(r),o=t[0]-e.displaySize[0]*i,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 Xu(e){var t,r;let i=e.left,n=e.top,o=e.right-i,a=e.bottom-n;const s=null!==(t=e.image.textFitWidth)&&void 0!==t?t:"stretchOrShrink",l=null!==(r=e.image.textFitHeight)&&void 0!==r?r:"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);i*=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:i,y1:n,x2:i+o,y2:n+a}}function Yu(e,t,r,i,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,d,p;"width"===r||"both"===r?(p=n[0]+l-i[3],h=n[0]+c+i[1]):(p=n[0]+(l+c-a.displaySize[0])/2,h=p+a.displaySize[0]);const f=t.top*o,m=t.bottom*o;return"height"===r||"both"===r?(u=n[1]+f-i[0],d=n[1]+m+i[2]):(u=n[1]+(f+m-a.displaySize[1])/2,d=u+a.displaySize[1]),{image:a,top:u,right:h,bottom:d,left:p,collisionPadding:s}}lo("ImagePosition",zu),lo("ImageAtlas",Bu),e.ay=void 0,(Nu=e.ay||(e.ay={}))[Nu.none=0]="none",Nu[Nu.horizontal=1]="horizontal",Nu[Nu.vertical=2]="vertical",Nu[Nu.horizontalOnly=3]="horizontalOnly";const Ju=128,Ku=32640;function Qu(e,t){const{expression:r}=t;if("constant"===r.kind)return{kind:"constant",layoutSize:r.evaluate(new Co(e+1))};if("source"===r.kind)return{kind:"source"};{const{zoomStops:t,interpolationType:i}=r;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"===r.kind?{kind:"composite",minZoom:a,maxZoom:s,interpolationType:i}:{kind:"camera",minZoom:a,maxZoom:s,minSize:r.evaluate(new Co(a)),maxSize:r.evaluate(new Co(s)),interpolationType:i}}}function eh(e,t,r){let i="never";const n=e.get(t);return n?i=n:e.get(r)&&(i="always"),i}const th=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function rh(e,t,r,i,n,o,a,s,l,c,u,h,d){const p=s?Math.min(Ku,Math.round(s[0])):0,f=s?Math.min(Ku,Math.round(s[1])):0;e.emplaceBack(t,r,Math.round(32*i),Math.round(32*n),o,a,(p<<1)+(l?1:0),f,16*c,16*u,256*h,256*d)}function ih(e,t,r){e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r)}function nh(e){for(const t of e.sections)if(ko(t.text))return!0;return!1}class oh{constructor(e){this.layoutVertexArray=new Wa,this.indexArray=new Ja,this.programConfigurations=e,this.segments=new ts,this.dynamicLayoutVertexArray=new Za,this.opacityVertexArray=new Ha,this.hasVisibleVertices=!1,this.placedSymbolArray=new Aa}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(e,t,r,i){this.isEmpty()||(r&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ru.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,iu.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,th,!0),this.opacityVertexBuffer.itemSize=1),(r||i)&&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())}}lo("SymbolBuffers",oh);class ah{constructor(e,t,r){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new r,this.segments=new ts,this.collisionVertexArray=new Ya}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,nu.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}lo("CollisionBuffers",ah);class sh{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.hasDependencies=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Qu(this.zoom,r["text-size"]),this.iconSizeData=Qu(this.zoom,r["icon-size"]);const i=this.layers[0].layout,n=i.get("symbol-sort-key"),o=i.get("symbol-z-order");this.canOverlap="never"!==eh(i,"text-overlap","text-allow-overlap")||"never"!==eh(i,"icon-overlap","icon-allow-overlap")||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==o&&!n.isConstant(),this.sortFeaturesByY=("viewport-y"===o||"auto"===o&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===i.get("symbol-placement")&&(this.writingModes=i.get("text-writing-mode").map(t=>e.ay[t])),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.sourceID=t.sourceID}createArrays(){this.text=new oh(new Ms(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new oh(new Ms(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Da,this.lineVertexArray=new Ra,this.symbolInstances=new Ma,this.textAnchorOffsets=new Fa}calculateGlyphDependencies(e,t,r,i,n){for(const o of e)if(t[o.codePointAt(0)]=!0,(r||i)&&n){const e=cu[o];e&&(t[e.codePointAt(0)]=!0)}}populate(t,r,i){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 Ct&&!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 d=r.iconDependencies,p=r.glyphDependencies,f=r.availableImages,m=new Co(this.zoom);for(const{feature:g,id:_,index:y,sourceLayerIndex:v}of t){const t=n._featureFilter.needGeometry,r=zs(g,t);if(!n._featureFilter.filter(m,r,i))continue;let s,l;if(t||(r.geometry=Os(g)),c){const e=n.getValueAndResolveTokens("text-field",r,i,f),t=Ct.factory(e),o=this.hasRTLText=this.hasRTLText||nh(t);(!o||"unavailable"===Ao.getRTLTextPluginStatus()||o&&Ao.isParsed())&&(s=su(t,n,r))}if(u){const e=n.getValueAndResolveTokens("icon-image",r,i,f);l=e instanceof zt?e:zt.fromString(e)}if(!s&&!l)continue;const b=this.sortFeaturesByKey?h.evaluate(r,{},i):void 0;if(this.features.push({id:_,text:s,icon:l,index:y,sourceLayerIndex:v,geometry:r.geometry,properties:g.properties,type:Sc.types[g.type],sortKey:b}),l&&(d[l.name]=!0),s){const t=a.evaluate(r,{},i).join(","),n="viewport"!==o.get("text-rotation-alignment")&&"point"!==o.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(e.ay.vertical)>=0;for(const e of s.sections)if(e.image)d[e.image.name]=!0;else{const r=vo(s.toString()),i=e.fontStack||t,o=p[i]=p[i]||{};this.calculateGlyphDependencies(e.text,o,n,this.allowVerticalPlacement,r)}}}"line"===o.get("symbol-placement")&&(this.features=function(e){const t={},r={},i=[];let n=0;function o(t){i.push(e[t]),n++}function a(e,t,n){const o=r[e];return delete r[e],r[t]=o,i[o].geometry[0].pop(),i[o].geometry[0]=i[o].geometry[0].concat(n[0]),o}function s(e,r,n){const o=t[r];return delete t[r],t[e]=o,i[o].geometry[0].shift(),i[o].geometry[0]=n[0].concat(i[o].geometry[0]),o}function l(e,t,r){const i=r?t[0][t[0].length-1]:t[0][0];return`${e}:${i.x}:${i.y}`}for(let c=0;c<e.length;c++){const u=e[c],h=u.geometry,d=u.text?u.text.toString():null;if(!d){o(c);continue}const p=l(d,h),f=l(d,h,!0);if(p in r&&f in t&&r[p]!==t[f]){const e=s(p,f,h),n=a(p,f,i[e].geometry);delete t[p],delete r[f],r[l(d,i[n].geometry,!0)]=n,i[e].geometry=null}else p in r?a(p,f,h):f in t?s(p,f,h):(o(c),t[p]=n-1,r[f]=n-1)}return i.filter(e=>e.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((e,t)=>e.sortKey-t.sortKey)}update(e,t,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,{imagePositions:r}),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,{imagePositions:r}))}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 r=this.lineVertexArray.length;if(void 0!==e.segment){let r=e.dist(t[e.segment+1]),i=e.dist(t[e.segment]);const n={};for(let o=e.segment+1;o<t.length;o++)n[o]={x:t[o].x,y:t[o].y,tileUnitDistanceFromAnchor:r},o<t.length-1&&(r+=t[o+1].dist(t[o]));for(let o=e.segment||0;o>=0;o--)n[o]={x:t[o].x,y:t[o].y,tileUnitDistanceFromAnchor:i},o>0&&(i+=t[o-1].dist(t[o]));for(let e=0;e<t.length;e++){const t=n[e];this.lineVertexArray.emplaceBack(t.x,t.y,t.tileUnitDistanceFromAnchor)}}return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(t,r,i,n,o,a,s,l,c,u,h,d){const p=t.indexArray,f=t.layoutVertexArray,m=t.segments.prepareSegment(4*r.length,f,p,this.canOverlap?a.sortKey:void 0),g=this.glyphOffsetArray.length,_=m.vertexLength,y=this.allowVerticalPlacement&&s===e.ay.vertical?Math.PI/2:0,v=a.text&&a.text.sections;for(let e=0;e<r.length;e++){const{tl:n,tr:o,bl:s,br:c,tex:u,pixelOffsetTL:h,pixelOffsetBR:g,minFontScaleX:_,minFontScaleY:b,glyphOffset:x,isSDF:w,sectionIndex:T}=r[e],S=m.vertexLength,E=x[1];rh(f,l.x,l.y,n.x,E+n.y,u.x,u.y,i,w,h.x,h.y,_,b),rh(f,l.x,l.y,o.x,E+o.y,u.x+u.w,u.y,i,w,g.x,h.y,_,b),rh(f,l.x,l.y,s.x,E+s.y,u.x,u.y+u.h,i,w,h.x,g.y,_,b),rh(f,l.x,l.y,c.x,E+c.y,u.x+u.w,u.y+u.h,i,w,g.x,g.y,_,b),ih(t.dynamicLayoutVertexArray,l,y),p.emplaceBack(S,S+2,S+1),p.emplaceBack(S+1,S+2,S+3),m.vertexLength+=4,m.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(x[0]),e!==r.length-1&&T===r[e+1].sectionIndex||t.programConfigurations.populatePaintArrays(f.length,a,a.index,{imagePositions:{},canonical:d,formattedSection:v&&v[T]})}t.placedSymbolArray.emplaceBack(l.x,l.y,g,this.glyphOffsetArray.length-g,_,c,u,l.segment,i?i[0]:0,i?i[1]:0,n[0],n[1],s,0,!1,0,h)}_addCollisionDebugVertex(e,t,r,i,n,o){return t.emplaceBack(0,0),e.emplaceBack(r.x,r.y,i,n,Math.round(o.x),Math.round(o.y))}addCollisionDebugVertices(e,t,i,n,o,a,s){const l=o.segments.prepareSegment(4,o.layoutVertexArray,o.indexArray),c=l.vertexLength,u=o.layoutVertexArray,h=o.collisionVertexArray,d=s.anchorX,p=s.anchorY;this._addCollisionDebugVertex(u,h,a,d,p,new r(e,t)),this._addCollisionDebugVertex(u,h,a,d,p,new r(i,t)),this._addCollisionDebugVertex(u,h,a,d,p,new r(i,n)),this._addCollisionDebugVertex(u,h,a,d,p,new r(e,n)),l.vertexLength+=4;const f=o.indexArray;f.emplaceBack(c,c+1),f.emplaceBack(c+1,c+2),f.emplaceBack(c+2,c+3),f.emplaceBack(c+3,c),l.primitiveLength+=4}addDebugCollisionBoxes(e,t,r,i){for(let n=e;n<t;n++){const e=this.collisionBoxArray.get(n);this.addCollisionDebugVertices(e.x1,e.y1,e.x2,e.y2,i?this.textCollisionBox:this.iconCollisionBox,e.anchorPoint,r)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new ah(Xa,ou.members,Ka),this.iconCollisionBox=new ah(Xa,ou.members,Ka);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,r,i,n,o,a,s,l){const c={};for(let u=t;u<r;u++){const t=e.get(u);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 u=i;u<n;u++){const t=e.get(u);c.verticalTextBox={x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,anchorPointX:t.anchorPointX,anchorPointY:t.anchorPointY},c.verticalTextFeatureIndex=t.featureIndex;break}for(let u=o;u<a;u++){const t=e.get(u);c.iconBox={x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,anchorPointX:t.anchorPointX,anchorPointY:t.anchorPointY},c.iconFeatureIndex=t.featureIndex;break}for(let u=s;u<l;u++){const t=e.get(u);c.verticalIconBox={x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,anchorPointX:t.anchorPointX,anchorPointY:t.anchorPointY},c.verticalIconFeatureIndex=t.featureIndex;break}return c}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let t=0;t<this.symbolInstances.length;t++){const r=this.symbolInstances.get(t);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,r.textBoxStartIndex,r.textBoxEndIndex,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r.iconBoxStartIndex,r.iconBoxEndIndex,r.verticalIconBoxStartIndex,r.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 r=e.placedSymbolArray.get(t),i=r.vertexStartIndex+4*r.numGlyphs;for(let n=r.vertexStartIndex;n<i;n+=4)e.indexArray.emplaceBack(n,n+2,n+1),e.indexArray.emplaceBack(n+1,n+2,n+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;const t=Math.sin(e),r=Math.cos(e),i=[],n=[],o=[];for(let a=0;a<this.symbolInstances.length;++a){o.push(a);const e=this.symbolInstances.get(a);i.push(0|Math.round(t*e.anchorX+r*e.anchorY)),n.push(e.featureIndex)}return o.sort((e,t)=>i[e]-i[t]||n[t]-n[e]),o}addToSortKeyRanges(e,t){const r=this.sortKeyRanges[this.sortKeyRanges.length-1];r&&r.sortKey===t?r.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,r)=>{e>=0&&r.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 lh,ch;lo("SymbolBucket",sh,{omit:["layers","collisionBoxArray","features","compareText"]}),sh.MAX_GLYPHS=65535,sh.addDynamicAttributes=ih;var uh={get paint(){return ch=ch||new Wo({"icon-opacity":new Uo(ye.paint_symbol["icon-opacity"]),"icon-color":new Uo(ye.paint_symbol["icon-color"]),"icon-halo-color":new Uo(ye.paint_symbol["icon-halo-color"]),"icon-halo-width":new Uo(ye.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Uo(ye.paint_symbol["icon-halo-blur"]),"icon-translate":new Vo(ye.paint_symbol["icon-translate"]),"icon-translate-anchor":new Vo(ye.paint_symbol["icon-translate-anchor"]),"text-opacity":new Uo(ye.paint_symbol["text-opacity"]),"text-color":new Uo(ye.paint_symbol["text-color"],{runtimeType:Be,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new Uo(ye.paint_symbol["text-halo-color"]),"text-halo-width":new Uo(ye.paint_symbol["text-halo-width"]),"text-halo-blur":new Uo(ye.paint_symbol["text-halo-blur"]),"text-translate":new Vo(ye.paint_symbol["text-translate"]),"text-translate-anchor":new Vo(ye.paint_symbol["text-translate-anchor"])})},get layout(){return lh=lh||new Wo({"symbol-placement":new Vo(ye.layout_symbol["symbol-placement"]),"symbol-spacing":new Vo(ye.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Vo(ye.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Uo(ye.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Vo(ye.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Vo(ye.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Vo(ye.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Vo(ye.layout_symbol["icon-ignore-placement"]),"icon-optional":new Vo(ye.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Vo(ye.layout_symbol["icon-rotation-alignment"]),"icon-size":new Uo(ye.layout_symbol["icon-size"]),"icon-text-fit":new Vo(ye.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Vo(ye.layout_symbol["icon-text-fit-padding"]),"icon-image":new Uo(ye.layout_symbol["icon-image"]),"icon-rotate":new Uo(ye.layout_symbol["icon-rotate"]),"icon-padding":new Uo(ye.layout_symbol["icon-padding"]),"icon-keep-upright":new Vo(ye.layout_symbol["icon-keep-upright"]),"icon-offset":new Uo(ye.layout_symbol["icon-offset"]),"icon-anchor":new Uo(ye.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Vo(ye.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Vo(ye.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Vo(ye.layout_symbol["text-rotation-alignment"]),"text-field":new Uo(ye.layout_symbol["text-field"]),"text-font":new Uo(ye.layout_symbol["text-font"]),"text-size":new Uo(ye.layout_symbol["text-size"]),"text-max-width":new Uo(ye.layout_symbol["text-max-width"]),"text-line-height":new Vo(ye.layout_symbol["text-line-height"]),"text-letter-spacing":new Uo(ye.layout_symbol["text-letter-spacing"]),"text-justify":new Uo(ye.layout_symbol["text-justify"]),"text-radial-offset":new Uo(ye.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Vo(ye.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Uo(ye.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Uo(ye.layout_symbol["text-anchor"]),"text-max-angle":new Vo(ye.layout_symbol["text-max-angle"]),"text-writing-mode":new Vo(ye.layout_symbol["text-writing-mode"]),"text-rotate":new Uo(ye.layout_symbol["text-rotate"]),"text-padding":new Vo(ye.layout_symbol["text-padding"]),"text-keep-upright":new Vo(ye.layout_symbol["text-keep-upright"]),"text-transform":new Uo(ye.layout_symbol["text-transform"]),"text-offset":new Uo(ye.layout_symbol["text-offset"]),"text-allow-overlap":new Vo(ye.layout_symbol["text-allow-overlap"]),"text-overlap":new Vo(ye.layout_symbol["text-overlap"]),"text-ignore-placement":new Vo(ye.layout_symbol["text-ignore-placement"]),"text-optional":new Vo(ye.layout_symbol["text-optional"])})}};class hh{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:Le,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}}lo("FormatSectionOverride",hh,{omit:["defaultValue"]});class dh extends Zo{constructor(e,t){super(e,uh,t)}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 r of e)t.indexOf(r)<0&&t.push(r);this.layout._values["text-writing-mode"]=t}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,t,r,i){const n=this.layout.get(e).evaluate(t,{},r,i),o=this._unevaluatedLayout._values[e];return o.isDataDriven()||en(o.value)||!n?n:function(e,t){return t.replace(/{([^{}]+)}/g,(t,r)=>e&&r in e?String(e[r]):"")}(t.properties,n)}createBucket(e){return new sh(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of uh.paint.overridableProperties){if(!dh.hasPaintOverride(this.layout,e))continue;const t=this.paint.get(e),r=new hh(t),i=new Qi(r,t.property.specification);let n=null;n="constant"===t.value.kind||"source"===t.value.kind?new rn("source",i):new nn("composite",i,t.value.zoomStops),this.paint._values[e]=new No(t.property,n,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,r){return!(!this.layout||t.isDataDriven()||r.isDataDriven())&&dh.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){const r=e.get("text-field"),i=uh.paint.properties[t];let n=!1;const o=e=>{for(const t of e)if(i.overrides&&i.overrides.hasOverride(t))return void(n=!0)};if("constant"===r.value.kind&&r.value.value instanceof Ct)o(r.value.value.sections);else if("source"===r.value.kind||"composite"===r.value.kind){const e=t=>{n||(t instanceof Gt&&Vt(t.value)===Ge?o(t.value.sections):t instanceof Pr?o(t.sections):t.eachChild(e))},t=r.value;t._styleExpression&&e(t._styleExpression.expression)}return n}}let ph;var fh={get paint(){return ph=ph||new Wo({"background-color":new Vo(ye.paint_background["background-color"]),"background-pattern":new qo(ye.paint_background["background-pattern"]),"background-opacity":new Vo(ye.paint_background["background-opacity"])})}};class mh extends Zo{constructor(e,t){super(e,fh,t)}}class gh extends Zo{constructor(e,t){super(e,{},t),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 _h{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 yh={once:!0},vh=6371008.8;class bh{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 bh(z(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,r=this.lat*t,i=e.lat*t,n=Math.sin(r)*Math.sin(i)+Math.cos(r)*Math.cos(i)*Math.cos((e.lng-this.lng)*t);return vh*Math.acos(Math.min(n,1))}static convert(e){if(e instanceof bh)return e;if(Array.isArray(e)&&(2===e.length||3===e.length))return new bh(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return new bh(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 xh=2*Math.PI*vh;function wh(e){return xh*Math.cos(e*Math.PI/180)}function Th(e){return(180+e)/360}function Sh(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Eh(e,t){return e/wh(t)}function Ih(e){return 360*e-180}function Ph(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}function kh(e,t){return e*wh(Ph(t))}class Ah{constructor(e,t,r=0){this.x=+e,this.y=+t,this.z=+r}static fromLngLat(e,t=0){const r=bh.convert(e);return new Ah(Th(r.lng),Sh(r.lat),Eh(t,r.lat))}toLngLat(){return new bh(Ih(this.x),Ph(this.y))}toAltitude(){return kh(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/xh*(e=Ph(this.y),1/Math.cos(e*Math.PI/180));var e}}function Ch(e,t,r){var i=2*Math.PI*6378137/256/Math.pow(2,r);return[e*i-2*Math.PI*6378137/2,t*i-2*Math.PI*6378137/2]}class Mh{constructor(e,t,r){if(!function(e,t,r){return!(e<0||e>25||r<0||r>=Math.pow(2,e)||t<0||t>=Math.pow(2,e))}(e,t,r))throw new Error(`x=${t}, y=${r}, 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=r,this.key=Lh(0,e,e,t,r)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t,r){const i=(o=this.y,a=this.z,s=Ch(256*(n=this.x),256*(o=Math.pow(2,a)-o-1),a),l=Ch(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,r){let i,n="";for(let o=e;o>0;o--)i=1<<o-1,n+=(t&i?1:0)+(r&i?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"===r?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,i)}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 r((e.x*t-this.x)*A,(e.y*t-this.y)*A)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Dh{constructor(e,t){this.wrap=e,this.canonical=t,this.key=Lh(e,t.z,t.z,t.x,t.y)}}class Rh{constructor(e,t,r,i,n){if(this.terrainRttPosMatrix32f=null,e<r)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${r}`);this.overscaledZ=e,this.wrap=t,this.canonical=new Mh(r,+i,+n),this.key=Lh(t,e,r,i,n)}clone(){return new Rh(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 Rh(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Rh(e,this.wrap,e,this.canonical.x>>t,this.canonical.y>>t)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(e,t){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-e;return e>this.canonical.z?Lh(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y):Lh(this.wrap*+t,e,e,this.canonical.x>>r,this.canonical.y>>r)}isChildOf(e){if(e.wrap!==this.wrap)return!1;if(this.overscaledZ-e.overscaledZ<=0)return!1;if(0===e.overscaledZ)return this.overscaledZ>0;const t=this.canonical.z-e.canonical.z;return!(t<0)&&e.canonical.x===this.canonical.x>>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return[new Rh(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const t=this.canonical.z+1,r=2*this.canonical.x,i=2*this.canonical.y;return[new Rh(t,this.wrap,t,r,i),new Rh(t,this.wrap,t,r+1,i),new Rh(t,this.wrap,t,r,i+1),new Rh(t,this.wrap,t,r+1,i+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 Rh(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Rh(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Dh(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new Ah(e.x-this.wrap,e.y))}}function Lh(e,t,r,i,n){(e*=2)<0&&(e=-1*e-1);const o=1<<r;return(o*o*e+o*n+i).toString(36)+r.toString(36)+t.toString(36)}function Fh(e,t){return t?e.properties[t]:e.id}function Oh(e,t){const r={id:e.id};if(t.removeAllProperties&&(delete e.removeProperties,delete e.addOrUpdateProperties,delete t.removeProperties),t.removeProperties)for(const i of t.removeProperties){const t=e.addOrUpdateProperties.findIndex(e=>e.key===i);t>-1&&e.addOrUpdateProperties.splice(t,1)}return(e.removeAllProperties||t.removeAllProperties)&&(r.removeAllProperties=!0),(e.removeProperties||t.removeProperties)&&(r.removeProperties=[...e.removeProperties||[],...t.removeProperties||[]]),(e.addOrUpdateProperties||t.addOrUpdateProperties)&&(r.addOrUpdateProperties=[...e.addOrUpdateProperties||[],...t.addOrUpdateProperties||[]]),(e.newGeometry||t.newGeometry)&&(r.newGeometry=t.newGeometry||e.newGeometry),r}function zh(e){var t,r;if(!e)return{};const i={};return i.removeAll=e.removeAll,i.remove=new Set(e.remove||[]),i.add=new Map(null===(t=e.add)||void 0===t?void 0:t.map(e=>[e.id,e])),i.update=new Map(null===(r=e.update)||void 0===r?void 0:r.map(e=>[e.id,e])),i}lo("CanonicalTileID",Mh),lo("OverscaledTileID",Rh,{omit:["terrainRttPosMatrix32f"]});class Bh{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t<e.length;t++){const r=e[t];this._stringToNumber[r]=t,this._numberToString[t]=r}}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 Nh{constructor(e,t,r,i,n){this.type="Feature",this._vectorTileFeature=e,e._z=t,e._x=r,e._y=i,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 jh{_name;dataBuffer;nullabilityBuffer;_size;constructor(e,t,r){this._name=e,this.dataBuffer=t,"number"==typeof r?this._size=r:(this.nullabilityBuffer=r,this._size=r.size())}getValue(e){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(e)?null:this.getValueFromBuffer(e)}has(e){return this.nullabilityBuffer&&this.nullabilityBuffer.get(e)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}}class Vh extends jh{}class Uh extends Vh{getValueFromBuffer(e){return this.dataBuffer[e]}}class Gh extends Vh{getValueFromBuffer(e){return this.dataBuffer[e]}}class qh extends jh{delta;constructor(e,t,r,i){super(e,t,i),this.delta=r}}class $h extends qh{constructor(e,t,r,i){super(e,Int32Array.of(t),r,i)}getValueFromBuffer(e){return this.dataBuffer[0]+e*this.delta}}class Wh extends jh{constructor(e,t,r){super(e,Int32Array.of(t),r)}getValueFromBuffer(e){return this.dataBuffer[0]}}class Zh{_name;_geometryVector;_idVector;_propertyVectors;_extent;propertyVectorsMap;constructor(e,t,r,i,n=4096){this._name=e,this._geometryVector=t,this._idVector=r,this._propertyVectors=i,this._extent=n}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors}getPropertyVector(e){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this._propertyVectors.map(e=>[e.name,e]))),this.propertyVectorsMap.get(e)}*[Symbol.iterator](){const e=this.geometryVector[Symbol.iterator]();let t=0;for(;t<this.numFeatures;){let r;this.idVector&&(r=this.containsMaxSaveIntegerValues(this.idVector)?Number(this.idVector.getValue(t)):this.idVector.getValue(t));const i=e?.next().value,n={};for(const e of this.propertyVectors){if(!e)continue;const r=e.name,i=e.getValue(t);null!==i&&(n[r]=i)}t++,yield{id:r,geometry:i,properties:n}}}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){const e=[],t=this.geometryVector.getGeometries();for(let r=0;r<this.numFeatures;r++){let i;this.idVector&&(i=this.containsMaxSaveIntegerValues(this.idVector)?Number(this.idVector.getValue(r)):this.idVector.getValue(r));const n={coordinates:t[r],type:this.geometryVector.geometryType(r)},o={};for(const e of this.propertyVectors){if(!e)continue;const t=e.name,i=e.getValue(r);null!==i&&(o[t]=i)}e.push({id:i,geometry:n,properties:o})}return e}containsMaxSaveIntegerValues(e){return e instanceof Uh||e instanceof Wh&&e instanceof $h||e instanceof Gh}}class Hh{value;constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}increment(){return this.value++}add(e){this.value+=e}}var Xh,Yh,Jh,Kh,Qh,ed,td,rd,id,nd;!function(e){e.PRESENT="PRESENT",e.DATA="DATA",e.OFFSET="OFFSET",e.LENGTH="LENGTH"}(Xh||(Xh={}));class od{_dictionaryType;_offsetType;_lengthType;constructor(e,t,r){this._dictionaryType=e,this._offsetType=t,this._lengthType=r}get dictionaryType(){return this._dictionaryType}get offsetType(){return this._offsetType}get lengthType(){return this._lengthType}}function ad(e,t,r){const i=new Int32Array(r);let n=0,o=t.get();for(let a=0;a<i.length;a++){let t=e[o++],r=127&t;t<128||(t=e[o++],r|=(127&t)<<7,t<128||(t=e[o++],r|=(127&t)<<14,t<128||(t=e[o++],r|=(127&t)<<21,t<128||(t=e[o++],r|=(15&t)<<28)))),i[n++]=r}return t.set(o),i}function sd(e,t,r){const i=new BigInt64Array(r);for(let n=0;n<i.length;n++)i[n]=dd(e,t);return i}function ld(e,t){let r,i;return i=e[t.get()],t.increment(),r=127&i,i<128?r:(i=e[t.get()],t.increment(),r|=(127&i)<<7,i<128?r:(i=e[t.get()],t.increment(),r|=(127&i)<<14,i<128?r:(i=e[t.get()],t.increment(),r|=(127&i)<<21,i<128?r:(i=e[t.get()],r|=(15&i)<<28,function(e,t,r){let i,n;if(n=t[r.get()],r.increment(),i=(112&n)>>4,n<128)return 4294967296*i+(e>>>0);if(n=t[r.get()],r.increment(),i|=(127&n)<<3,n<128)return 4294967296*i+(e>>>0);if(n=t[r.get()],r.increment(),i|=(127&n)<<10,n<128)return 4294967296*i+(e>>>0);if(n=t[r.get()],r.increment(),i|=(127&n)<<17,n<128)return 4294967296*i+(e>>>0);if(n=t[r.get()],r.increment(),i|=(127&n)<<24,n<128)return 4294967296*i+(e>>>0);if(n=t[r.get()],r.increment(),i|=(1&n)<<31,n<128)return 4294967296*i+(e>>>0);throw new Error("Expected varint not more than 10 bytes")}(r,e,t)))))}function cd(e,t,r,i){throw new Error("FastPFor is not implemented yet.")}function ud(e){return e>>>1^-(1&e)}function hd(e){return e>>1n^-(1n&e)}function dd(e,t){let r=0n,i=0,n=t.get();for(;n<e.length;){const t=e[n++];if(r|=BigInt(127&t)<<BigInt(i),!(128&t))break;if(i+=7,i>=64)throw new Error("Varint too long")}return t.set(n),r}function pd(e,t,r){const i=new Int32Array(r);let n=0;for(let o=0;o<t;o++){const r=e[o];i.fill(e[o+t],n,n+r),n+=r}return i}function fd(e,t,r){const i=new BigInt64Array(r);let n=0;for(let o=0;o<t;o++){const r=Number(e[o]);i.fill(e[o+t],n,n+r),n+=r}return i}function md(e,t,r){const i=new Float64Array(r);let n=0;for(let o=0;o<t;o++){const r=e[o];i.fill(e[o+t],n,n+r),n+=r}return i}function gd(e){const t=e.length/4*4;let r=1;if(t>=4)for(let i=e[0];r<t-4;r+=4)i=e[r]+=i,i=e[r+1]+=i,i=e[r+2]+=i,i=e[r+3]+=i;for(;r!=e.length;)e[r]+=e[r-1],++r}function _d(e){e[0]=e[0]>>>1^-(1&e[0]),e[1]=e[1]>>>1^-(1&e[1]);const t=e.length/4*4;let r=2;if(t>=4)for(;r<t-4;r+=4){const t=e[r],i=e[r+1],n=e[r+2],o=e[r+3];e[r]=(t>>>1^-(1&t))+e[r-2],e[r+1]=(i>>>1^-(1&i))+e[r-1],e[r+2]=(n>>>1^-(1&n))+e[r],e[r+3]=(o>>>1^-(1&o))+e[r+1]}for(;r!=e.length;r+=2)e[r]=(e[r]>>>1^-(1&e[r]))+e[r-2],e[r+1]=(e[r+1]>>>1^-(1&e[r+1]))+e[r-1]}function yd(e,t,r){return Math.min(r,Math.max(t,e))}!function(e){e.NONE="NONE",e.DELTA="DELTA",e.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",e.RLE="RLE",e.MORTON="MORTON",e.PDE="PDE"}(Yh||(Yh={})),function(e){e.NONE="NONE",e.FAST_PFOR="FAST_PFOR",e.VARINT="VARINT",e.ALP="ALP"}(Jh||(Jh={})),function(e){e.NONE="NONE",e.SINGLE="SINGLE",e.SHARED="SHARED",e.VERTEX="VERTEX",e.MORTON="MORTON",e.FSST="FSST"}(Kh||(Kh={})),function(e){e.VERTEX="VERTEX",e.INDEX="INDEX",e.STRING="STRING",e.KEY="KEY"}(Qh||(Qh={})),function(e){e.VAR_BINARY="VAR_BINARY",e.GEOMETRIES="GEOMETRIES",e.PARTS="PARTS",e.RINGS="RINGS",e.TRIANGLES="TRIANGLES",e.SYMBOL="SYMBOL",e.DICTIONARY="DICTIONARY"}(ed||(ed={}));class vd{_physicalStreamType;_logicalStreamType;_logicalLevelTechnique1;_logicalLevelTechnique2;_physicalLevelTechnique;_numValues;_byteLength;constructor(e,t,r,i,n,o,a){this._physicalStreamType=e,this._logicalStreamType=t,this._logicalLevelTechnique1=r,this._logicalLevelTechnique2=i,this._physicalLevelTechnique=n,this._numValues=o,this._byteLength=a}static decode(e,t){const r=e[t.get()],i=Object.values(Xh)[r>>4];let n=null;switch(i){case Xh.DATA:n=new od(Object.values(Kh)[15&r]);break;case Xh.OFFSET:n=new od(null,Object.values(Qh)[15&r]);break;case Xh.LENGTH:n=new od(null,null,Object.values(ed)[15&r])}t.increment();const o=e[t.get()],a=Object.values(Yh)[o>>5],s=Object.values(Yh)[o>>2&7],l=Object.values(Jh)[3&o];t.increment();const c=ad(e,t,2);return new vd(i,n,a,s,l,c[0],c[1])}get physicalStreamType(){return this._physicalStreamType}get logicalStreamType(){return this._logicalStreamType}get logicalLevelTechnique1(){return this._logicalLevelTechnique1}get logicalLevelTechnique2(){return this._logicalLevelTechnique2}get physicalLevelTechnique(){return this._physicalLevelTechnique}get numValues(){return this._numValues}get byteLength(){return this._byteLength}getDecompressedCount(){return this._numValues}}class bd extends vd{num_bits;coordinate_shift;constructor(e,t,r,i,n,o,a,s,l){super(e,t,r,i,n,o,a),this.num_bits=s,this.coordinate_shift=l}static decode(e,t){const r=vd.decode(e,t),i=ad(e,t,2);return new bd(r.physicalStreamType,r.logicalStreamType,r.logicalLevelTechnique1,r.logicalLevelTechnique2,r.physicalLevelTechnique,r.numValues,r.byteLength,i[0],i[1])}static decodePartial(e,t,r){const i=ad(t,r,2);return new bd(e.physicalStreamType,e.logicalStreamType,e.logicalLevelTechnique1,e.logicalLevelTechnique2,e.physicalLevelTechnique,e.numValues,e.byteLength,i[0],i[1])}numBits(){return this.num_bits}coordinateShift(){return this.coordinate_shift}}class xd extends vd{_runs;_numRleValues;constructor(e,t,r,i,n,o,a,s,l){super(e,t,r,i,n,o,a),this._runs=s,this._numRleValues=l}static decode(e,t){const r=vd.decode(e,t),i=ad(e,t,2);return new xd(r.physicalStreamType,r.logicalStreamType,r.logicalLevelTechnique1,r.logicalLevelTechnique2,r.physicalLevelTechnique,r.numValues,r.byteLength,i[0],i[1])}static decodePartial(e,t,r){const i=ad(t,r,2);return new xd(e.physicalStreamType,e.logicalStreamType,e.logicalLevelTechnique1,e.logicalLevelTechnique2,e.physicalLevelTechnique,e.numValues,e.byteLength,i[0],i[1])}get runs(){return this._runs}get numRleValues(){return this._numRleValues}getDecompressedCount(){return this._numRleValues}}class wd{static decode(e,t){const r=vd.decode(e,t);return r.logicalLevelTechnique1===Yh.MORTON?bd.decodePartial(r,e,t):Yh.RLE!==r.logicalLevelTechnique1&&Yh.RLE!==r.logicalLevelTechnique2||Jh.NONE===r.physicalLevelTechnique?r:xd.decodePartial(r,e,t)}}!function(e){e[e.FLAT=0]="FLAT",e[e.CONST=1]="CONST",e[e.SEQUENCE=2]="SEQUENCE",e[e.DICTIONARY=3]="DICTIONARY",e[e.FSST_DICTIONARY=4]="FSST_DICTIONARY"}(td||(td={}));class Td{values;_size;constructor(e,t){this.values=e,this._size=t}get(e){const t=Math.floor(e/8);return 1==(this.values[t]>>e%8&1)}set(e,t){const r=Math.floor(e/8);this.values[r]=this.values[r]|(t?1:0)<<e%8}getInt(e){const t=Math.floor(e/8);return this.values[t]>>e%8&1}size(){return this._size}getBuffer(){return this.values}}class Sd{constructor(){}static decodeIntStream(e,t,r,i,n){const o=Sd.decodePhysicalLevelTechnique(e,t,r);return this.decodeIntBuffer(o,r,i,n)}static decodeLengthStreamToOffsetBuffer(e,t,r){const i=Sd.decodePhysicalLevelTechnique(e,t,r);return this.decodeLengthToOffsetBuffer(i,r)}static decodePhysicalLevelTechnique(e,t,r){const i=r.physicalLevelTechnique;if(i===Jh.FAST_PFOR)return cd();if(i===Jh.VARINT)return ad(e,t,r.numValues);if(i===Jh.NONE){const i=t.get();t.add(r.byteLength);const n=e.subarray(i,t.get());return new Int32Array(n)}throw new Error("Specified physicalLevelTechnique is not supported (yet).")}static decodeConstIntStream(e,t,r,i){const n=Sd.decodePhysicalLevelTechnique(e,t,r);if(1===n.length){const e=n[0];return i?ud(e):e}return i?function(e){return ud(e[1])}(n):function(e){return e[1]}(n)}static decodeSequenceIntStream(e,t,r){return function(e){if(2==e.length){const t=ud(e[1]);return[t,t]}return[ud(e[2]),ud(e[3])]}(Sd.decodePhysicalLevelTechnique(e,t,r))}static decodeSequenceLongStream(e,t,r){return function(e){if(2==e.length){const t=hd(e[1]);return[t,t]}return[hd(e[2]),hd(e[3])]}(sd(e,t,r.numValues))}static decodeLongStream(e,t,r,i){const n=sd(e,t,r.numValues);return this.decodeLongBuffer(n,r,i)}static decodeLongFloat64Stream(e,t,r,i){const n=function(e,t,r){const i=new Float64Array(t);for(let n=0;n<t;n++)i[n]=ld(e,r);return i}(e,r.numValues,t);return this.decodeFloat64Buffer(n,r,i)}static decodeConstLongStream(e,t,r,i){const n=sd(e,t,r.numValues);if(1===n.length){const e=n[0];return i?hd(e):e}return i?function(e){return hd(e[1])}(n):function(e){return e[1]}(n)}static decodeIntBuffer(e,t,r,i){switch(t.logicalLevelTechnique1){case Yh.DELTA:return t.logicalLevelTechnique2===Yh.RLE?function(e,t,r){const i=new Int32Array(r);let n=0,o=0;for(let a=0;a<t;a++){const r=e[a],s=ud(e[a+t]);for(let e=0;e<r;e++)o+=s,i[n++]=o}return i}(e,t.runs,t.numRleValues):(function(e){e[0]=e[0]>>>1^-(1&e[0]);const t=e.length/4*4;let r=1;if(t>=4)for(;r<t-4;r+=4){const t=e[r],i=e[r+1],n=e[r+2],o=e[r+3];e[r]=(t>>>1^-(1&t))+e[r-1],e[r+1]=(i>>>1^-(1&i))+e[r],e[r+2]=(n>>>1^-(1&n))+e[r+1],e[r+3]=(o>>>1^-(1&o))+e[r+2]}for(;r!=e.length;++r)e[r]=(e[r]>>>1^-(1&e[r]))+e[r-1]}(e),e);case Yh.RLE:return function(e,t,r){return r?function(e,t,r){const i=new Int32Array(r);let n=0;for(let o=0;o<t;o++){const r=e[o];let a=e[o+t];a=a>>>1^-(1&a),i.fill(a,n,n+r),n+=r}return i}(e,t.runs,t.numRleValues):pd(e,t.runs,t.numRleValues)}(e,t,r);case Yh.MORTON:return gd(e),e;case Yh.COMPONENTWISE_DELTA:return i?(function(e,t,r,i){let n=e[0]>>>1^-(1&e[0]),o=e[1]>>>1^-(1&e[1]);e[0]=yd(Math.round(n*t),r,i),e[1]=yd(Math.round(o*t),r,i);const a=e.length/16;let s=2;if(a>=4)for(;s<a-4;s+=4){const a=e[s],l=e[s+1],c=(a>>>1^-(1&a))+n,u=(l>>>1^-(1&l))+o;e[s]=yd(Math.round(c*t),r,i),e[s+1]=yd(Math.round(u*t),r,i);const h=e[s+2],d=e[s+3];n=(h>>>1^-(1&h))+c,o=(d>>>1^-(1&d))+u,e[s+2]=yd(Math.round(n*t),r,i),e[s+3]=yd(Math.round(o*t),r,i)}for(;s!=e.length;s+=2)n+=e[s]>>>1^-(1&e[s]),o+=e[s+1]>>>1^-(1&e[s+1]),e[s]=yd(Math.round(n*t),r,i),e[s+1]=yd(Math.round(o*t),r,i)}(e,i.scale,i.min,i.max),e):(_d(e),e);case Yh.NONE:return r&&function(e){for(let t=0;t<e.length;t++){const r=e[t];e[t]=r>>>1^-(1&r)}}(e),e;default:throw new Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}}static decodeLongBuffer(e,t,r){switch(t.logicalLevelTechnique1){case Yh.DELTA:return t.logicalLevelTechnique2===Yh.RLE?function(e,t,r){const i=new BigInt64Array(r);let n=0,o=0n;for(let a=0;a<t;a++){const r=Number(e[a]),s=hd(e[a+t]);for(let e=0;e<r;e++)o+=s,i[n++]=o}return i}(e,t.runs,t.numRleValues):(function(e){e[0]=e[0]>>1n^-(1n&e[0]);const t=e.length/4*4;let r=1;if(t>=4)for(;r<t-4;r+=4){const t=e[r],i=e[r+1],n=e[r+2],o=e[r+3];e[r]=(t>>1n^-(1n&t))+e[r-1],e[r+1]=(i>>1n^-(1n&i))+e[r],e[r+2]=(n>>1n^-(1n&n))+e[r+1],e[r+3]=(o>>1n^-(1n&o))+e[r+2]}for(;r!=e.length;++r)e[r]=(e[r]>>1n^-(1n&e[r]))+e[r-1]}(e),e);case Yh.RLE:return function(e,t,r){return r?function(e,t,r){const i=new BigInt64Array(r);let n=0;for(let o=0;o<t;o++){const r=Number(e[o]);let a=e[o+t];a=a>>1n^-(1n&a),i.fill(a,n,n+r),n+=r}return i}(e,t.runs,t.numRleValues):fd(e,t.runs,t.numRleValues)}(e,t,r);case Yh.NONE:return r&&function(e){for(let t=0;t<e.length;t++){const r=e[t];e[t]=r>>1n^-(1n&r)}}(e),e;default:throw new Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}}static decodeFloat64Buffer(e,t,r){switch(t.logicalLevelTechnique1){case Yh.DELTA:return t.logicalLevelTechnique2===Yh.RLE&&(e=md(e,t.runs,t.numRleValues)),function(e){e[0]=e[0]%2==1?(e[0]+1)/-2:e[0]/2;const t=e.length/4*4;let r=1;if(t>=4)for(;r<t-4;r+=4){const t=e[r],i=e[r+1],n=e[r+2],o=e[r+3];e[r]=(t%2==1?(t+1)/-2:t/2)+e[r-1],e[r+1]=(i%2==1?(i+1)/-2:i/2)+e[r],e[r+2]=(n%2==1?(n+1)/-2:n/2)+e[r+1],e[r+3]=(o%2==1?(o+1)/-2:o/2)+e[r+2]}for(;r!=e.length;++r)e[r]=(e[r]%2==1?(e[r]+1)/-2:e[r]/2)+e[r-1]}(e),e;case Yh.RLE:return function(e,t,r){return r?function(e,t,r){const i=new Float64Array(r);let n=0;for(let o=0;o<t;o++){const r=e[o];let a=e[o+t];a=a%2==1?(a+1)/-2:a/2,i.fill(a,n,n+r),n+=r}return i}(e,t.runs,t.numRleValues):md(e,t.runs,t.numRleValues)}(e,t,r);case Yh.NONE:return r&&function(e){for(let t=0;t<e.length;t++){const r=e[t];e[t]=r%2==1?(r+1)/-2:r/2}}(e),e;default:throw new Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}}static decodeLengthToOffsetBuffer(e,t){if(t.logicalLevelTechnique1===Yh.DELTA&&t.logicalLevelTechnique2===Yh.NONE)return function(e){const t=new Int32Array(e.length+1);t[0]=0,t[1]=ud(e[0]);let r=t[1],i=2;for(;i!=t.length;++i){const n=e[i-1];r+=n>>>1^-(1&n),t[i]=t[i-1]+r}return t}(e);if(t.logicalLevelTechnique1===Yh.RLE&&t.logicalLevelTechnique2===Yh.NONE)return function(e,t,r){const i=new Int32Array(r+1);i[0]=0;let n=1,o=i[0];for(let a=0;a<t;a++){const r=e[a],s=e[a+t];for(let e=n;e<n+r;e++)i[e]=s+o,o=i[e];n+=r}return i}(e,t.runs,t.numRleValues);if(t.logicalLevelTechnique1===Yh.NONE&&t.logicalLevelTechnique2===Yh.NONE){!function(e){let t=0;for(let r=0;r<e.length;r++)e[r]+=t,t=e[r]}(e);const r=new Int32Array(t.numValues+1);return r[0]=0,r.set(e,1),r}if(t.logicalLevelTechnique1===Yh.DELTA&&t.logicalLevelTechnique2===Yh.RLE){const r=function(e,t,r){const i=new Int32Array(r+1);i[0]=0;let n=1,o=i[0];for(let a=0;a<t;a++){const r=e[a];let s=e[a+t];s=s>>>1^-(1&s);for(let e=n;e<n+r;e++)i[e]=s+o,o=i[e];n+=r}return i}(e,t.runs,t.numRleValues);return gd(r),r}throw new Error("Only delta encoding is supported for transforming length to offset streams yet.")}static decodeNullableIntStream(e,t,r,i,n){const o=r.physicalLevelTechnique===Jh.FAST_PFOR?cd():ad(e,t,r.numValues);return this.decodeNullableIntBuffer(o,r,i,n)}static decodeNullableLongStream(e,t,r,i,n){const o=sd(e,t,r.numValues);return this.decodeNullableLongBuffer(o,r,i,n)}static decodeNullableIntBuffer(e,t,r,i){switch(t.logicalLevelTechnique1){case Yh.DELTA:return t.logicalLevelTechnique2===Yh.RLE&&(e=pd(e,t.runs,t.numRleValues)),function(e,t){const r=new Int32Array(e.size());let i=0;e.get(0)?(r[0]=e.get(0)?t[0]>>>1^-(1&t[0]):0,i=1):r[0]=0;let n=1;for(;n!=r.length;++n)r[n]=e.get(n)?r[n-1]+(t[i]>>>1^-(1&t[i++])):r[n-1];return r}(i,e);case Yh.RLE:return function(e,t,r,i){const n=t;return r?function(e,t,r){const i=new Int32Array(e.size());let n=0;for(let o=0;o<r;o++){const a=t[o];let s=t[o+r];s=s>>>1^-(1&s);for(let t=n;t<n+a;t++)e.get(t)?i[t]=s:(i[t]=0,n++);n+=a}return i}(i,e,n.runs):function(e,t,r){const i=new Int32Array(e.size());let n=0;for(let o=0;o<r;o++){const a=t[o],s=t[o+r];for(let t=n;t<n+a;t++)e.get(t)?i[t]=s:(i[t]=0,n++);n+=a}return i}(i,e,n.runs)}(e,t,r,i);case Yh.MORTON:return gd(e),e;case Yh.COMPONENTWISE_DELTA:return _d(e),e;case Yh.NONE:return e=r?function(e,t){const r=new Int32Array(e.size());let i=0,n=0;for(;n!=r.length;++n)if(e.get(n)){const e=t[i++];r[n]=e>>>1^-(1&e)}else r[n]=0;return r}(i,e):function(e,t){const r=new Int32Array(e.size());let i=0,n=0;for(;n!=r.length;++n)r[n]=e.get(n)?t[i++]:0;return r}(i,e),e;default:throw new Error("The specified Logical level technique is not supported")}}static decodeNullableLongBuffer(e,t,r,i){switch(t.logicalLevelTechnique1){case Yh.DELTA:return t.logicalLevelTechnique2===Yh.RLE&&(e=fd(e,t.runs,t.numRleValues)),function(e,t){const r=new BigInt64Array(e.size());let i=0;e.get(0)?(r[0]=e.get(0)?t[0]>>1n^-(1n&t[0]):0n,i=1):r[0]=0n;let n=1;for(;n!=r.length;++n)r[n]=e.get(n)?r[n-1]+(t[i]>>1n^-(1n&t[i++])):r[n-1];return r}(i,e);case Yh.RLE:return function(e,t,r,i){const n=t;return r?function(e,t,r){const i=new BigInt64Array(e.size());let n=0;for(let o=0;o<r;o++){const a=Number(t[o]);let s=t[o+r];s=s>>1n^-(1n&s);for(let t=n;t<n+a;t++)e.get(t)?i[t]=s:(i[t]=0n,n++);n+=a}return i}(i,e,n.runs):function(e,t,r){const i=new BigInt64Array(e.size());let n=0;for(let o=0;o<r;o++){const a=Number(t[o]),s=t[o+r];for(let t=n;t<n+a;t++)e.get(t)?i[t]=s:(i[t]=0n,n++);n+=a}return i}(i,e,n.runs)}(e,t,r,i);case Yh.NONE:return e=r?function(e,t){const r=new BigInt64Array(e.size());let i=0,n=0;for(;n!=r.length;++n)if(e.get(n)){const e=t[i++];r[n]=e>>1n^-(1n&e)}else r[n]=0n;return r}(i,e):function(e,t){const r=new BigInt64Array(e.size());let i=0,n=0;for(;n!=r.length;++n)r[n]=e.get(n)?t[i++]:0n;return r}(i,e),e;default:throw new Error("The specified Logical level technique is not supported")}}static getVectorType(e,t,r,i){const n=e.logicalLevelTechnique1;if(n===Yh.RLE)return 1===e.runs?td.CONST:td.FLAT;const o=t instanceof Td?t.size():t;if(n===Yh.DELTA&&e.logicalLevelTechnique2===Yh.RLE){const t=e.runs,n=2;if(e.numRleValues!==o)return td.FLAT;if(1===t)return td.SEQUENCE;if(2===t){const t=i.get();let o;if(e.physicalLevelTechnique===Jh.VARINT)o=ad(r,i,4);else{const e=i.get();o=new Int32Array(r.buffer,r.byteOffset+e,4)}if(i.set(t),o[2]===n&&o[3]===n)return td.SEQUENCE}}return 1===e.numValues?td.CONST:td.FLAT}}class Ed extends Vh{getValueFromBuffer(e){return this.dataBuffer[e]}}class Id extends qh{constructor(e,t,r,i){super(e,BigInt64Array.of(t),r,i)}getValueFromBuffer(e){return this.dataBuffer[0]+BigInt(e)*this.delta}}class Pd{_geometryOffsets;_partOffsets;_ringOffsets;constructor(e,t,r){this._geometryOffsets=e,this._partOffsets=t,this._ringOffsets=r}get geometryOffsets(){return this._geometryOffsets}get partOffsets(){return this._partOffsets}get ringOffsets(){return this._ringOffsets}}class kd{tileExtent;_numBits;_coordinateShift;minBound;maxBound;constructor(e,t){this._coordinateShift=e<0?Math.abs(e):0,this.tileExtent=t+this._coordinateShift,this._numBits=Math.ceil(Math.log2(this.tileExtent)),this.minBound=e,this.maxBound=t}validateCoordinates(e){if(e.x<this.minBound||e.y<this.minBound||e.x>this.maxBound||e.y>this.maxBound)throw new Error("The specified tile buffer size is currently not supported.")}numBits(){return this._numBits}coordinateShift(){return this._coordinateShift}}class Ad extends kd{encode(e){this.validateCoordinates(e);const t=e.x+this._coordinateShift,r=e.y+this._coordinateShift;let i=0;for(let n=0;n<this._numBits;n++)i|=(t&1<<n)<<n|(r&1<<n)<<n+1;return i}decode(e){return{x:this.decodeMorton(e)-this._coordinateShift,y:this.decodeMorton(e>>1)-this._coordinateShift}}decodeMorton(e){let t=0;for(let r=0;r<this._numBits;r++)t|=(e&1<<2*r)>>r;return t}static decode(e,t,r){return{x:Ad.decodeMorton(e,t)-r,y:Ad.decodeMorton(e>>1,t)-r}}static decodeMorton(e,t){let r=0;for(let i=0;i<t;i++)r|=(e&1<<2*i)>>i;return r}}!function(e){e[e.POINT=0]="POINT",e[e.LINESTRING=1]="LINESTRING",e[e.POLYGON=2]="POLYGON",e[e.MULTIPOINT=3]="MULTIPOINT",e[e.MULTILINESTRING=4]="MULTILINESTRING",e[e.MULTIPOLYGON=5]="MULTIPOLYGON"}(rd||(rd={})),function(e){e[e.POINT=0]="POINT",e[e.LINESTRING=1]="LINESTRING",e[e.POLYGON=2]="POLYGON"}(id||(id={})),function(e){e[e.MORTON=0]="MORTON",e[e.VEC_2=1]="VEC_2",e[e.VEC_3=2]="VEC_3"}(nd||(nd={}));class Cd{createPoint(e){return[[e]]}createMultiPoint(e){return e.map(e=>[e])}createLineString(e){return[e]}createMultiLineString(e){return e}createPolygon(e,t){return[e,...t]}createMultiPolygon(e){return e.flat()}}function Md(e){const t=new Array(e.numGeometries);let i=1,n=1,o=1,a=0;const s=new Cd;let l=0,c=0;const u=e.mortonSettings,h=e.topologyVector,d=h.geometryOffsets,p=h.partOffsets,f=h.ringOffsets,m=e.vertexOffsets,g=e.containsPolygonGeometry(),_=e.vertexBuffer;for(let y=0;y<e.numGeometries;y++){const h=e.geometryType(y);if(h===rd.POINT){if(m&&0!==m.length)if(e.vertexBufferType===nd.VEC_2){const e=2*m[c++],i=new r(_[e],_[e+1]);t[a++]=s.createPoint(i)}else{const e=m[c++],i=Ad.decode(_[e],u.numBits,u.coordinateShift),n=new r(i.x,i.y);t[a++]=s.createPoint(n)}else{const e=new r(_[l++],_[l++]);t[a++]=s.createPoint(e)}d&&o++,p&&i++,f&&n++}else if(h===rd.MULTIPOINT){const e=d[o]-d[o-1];o++;const i=new Array(e);if(m&&0!==m.length){for(let t=0;t<e;t++){const e=2*m[c++];i[t]=new r(_[e],_[e+1])}t[a++]=s.createMultiPoint(i)}else{for(let t=0;t<e;t++){const e=_[l++],n=_[l++];i[t]=new r(e,n)}t[a++]=s.createMultiPoint(i)}}else if(h===rd.LINESTRING){let r,h=0;g?(h=f[n]-f[n-1],n++):h=p[i]-p[i-1],i++,m&&0!==m.length?(r=e.vertexBufferType===nd.VEC_2?Od(_,m,c,h,!1):zd(_,m,c,h,!1,u),c+=h):(r=Fd(_,l,h,!1),l+=2*h),t[a++]=s.createLineString(r),d&&o++}else if(h===rd.POLYGON){const r=p[i]-p[i-1];i++;const h=new Array(r-1);let g=f[n]-f[n-1];if(n++,m&&0!==m.length){const r=e.vertexBufferType===nd.VEC_2?Rd(_,m,c,g):Ld(_,m,c,g,0,u);c+=g;for(let t=0;t<h.length;t++)g=f[n]-f[n-1],n++,h[t]=e.vertexBufferType===nd.VEC_2?Rd(_,m,c,g):Ld(_,m,c,g,0,u),c+=g;t[a++]=s.createPolygon(r,h)}else{const e=Dd(_,l,g);l+=2*g;for(let t=0;t<h.length;t++)g=f[n]-f[n-1],n++,h[t]=Dd(_,l,g),l+=2*g;t[a++]=s.createPolygon(e,h)}d&&o++}else if(h===rd.MULTILINESTRING){const r=d[o]-d[o-1];o++;const h=new Array(r);if(m&&0!==m.length){for(let t=0;t<r;t++){let r=0;g?(r=f[n]-f[n-1],n++):r=p[i]-p[i-1],i++;const o=e.vertexBufferType===nd.VEC_2?Od(_,m,c,r,!1):zd(_,m,c,r,!1,u);h[t]=o,c+=r}t[a++]=s.createMultiLineString(h)}else{for(let e=0;e<r;e++){let t=0;g?(t=f[n]-f[n-1],n++):t=p[i]-p[i-1],i++,h[e]=Fd(_,l,t,!1),l+=2*t}t[a++]=s.createMultiLineString(h)}}else{if(h!==rd.MULTIPOLYGON)throw new Error("The specified geometry type is currently not supported.");{const r=d[o]-d[o-1];o++;const h=new Array(r);let g=0;if(m&&0!==m.length){for(let t=0;t<r;t++){const r=p[i]-p[i-1];i++;const o=new Array(r-1);g=f[n]-f[n-1],n++;const a=e.vertexBufferType===nd.VEC_2?Rd(_,m,c,g):Ld(_,m,c,g,0,u);c+=g;for(let t=0;t<o.length;t++)g=f[n]-f[n-1],n++,o[t]=e.vertexBufferType===nd.VEC_2?Rd(_,m,c,g):Ld(_,m,c,g,0,u),c+=g;h[t]=s.createPolygon(a,o)}t[a++]=s.createMultiPolygon(h)}else{for(let e=0;e<r;e++){const t=p[i]-p[i-1];i++;const r=new Array(t-1);g=f[n]-f[n-1],n++;const o=Dd(_,l,g);l+=2*g;for(let e=0;e<r.length;e++){const t=f[n]-f[n-1];n++,r[e]=Dd(_,l,t),l+=2*t}h[e]=s.createPolygon(o,r)}t[a++]=s.createMultiPolygon(h)}}}}return t}function Dd(e,t,r){return Fd(e,t,r,!0)}function Rd(e,t,r,i){return Od(e,t,r,i,!0)}function Ld(e,t,r,i,n,o){return zd(e,t,r,i,!0,o)}function Fd(e,t,i,n){const o=new Array(n?i+1:i);for(let a=0;a<2*i;a+=2)o[a/2]=new r(e[t+a],e[t+a+1]);return n&&(o[o.length-1]=o[0]),o}function Od(e,t,i,n,o){const a=new Array(o?n+1:n);for(let s=0;s<2*n;s+=2){const n=2*t[i+s/2];a[s/2]=new r(e[n],e[n+1])}return o&&(a[a.length-1]=a[0]),a}function zd(e,t,i,n,o,a){const s=new Array(o?n+1:n);for(let l=0;l<n;l++){const n=Ad.decode(e[t[i+l]],a.numBits,a.coordinateShift);s[l]=new r(n.x,n.y)}return o&&(s[s.length-1]=s[0]),s}class Bd{_vertexBufferType;_topologyVector;_vertexOffsets;_vertexBuffer;_mortonSettings;constructor(e,t,r,i,n){this._vertexBufferType=e,this._topologyVector=t,this._vertexOffsets=r,this._vertexBuffer=i,this._mortonSettings=n}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}*[Symbol.iterator](){const e=Md(this);let t=0;for(;t<this.numGeometries;)yield{coordinates:e[t],type:this.geometryType(t)},t++}getSimpleEncodedVertex(e){const t=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[t],this.vertexBuffer[t+1]]}getVertex(e){if(this.vertexOffsets&&this.mortonSettings){const t=Ad.decode(this.vertexBuffer[this.vertexOffsets[e]],this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[t.x,t.y]}const t=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[t],this.vertexBuffer[t+1]]}getGeometries(){return Md(this)}get mortonSettings(){return this._mortonSettings}}class Nd extends Bd{_numGeometries;_geometryType;constructor(e,t,r,i,n,o,a){super(r,i,n,o,a),this._numGeometries=e,this._geometryType=t}static createMortonEncoded(e,t,r,i,n,o){return new Nd(e,t,nd.MORTON,r,i,n,o)}static create(e,t,r,i,n){return new Nd(e,t,nd.VEC_2,r,i,n)}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===rd.POLYGON||this._geometryType===rd.MULTIPOLYGON}containsSingleGeometryType(){return!0}}class jd extends Bd{_geometryTypes;constructor(e,t,r,i,n,o){super(e,r,i,n,o),this._geometryTypes=t}static createMortonEncoded(e,t,r,i,n){return new jd(nd.MORTON,e,t,r,i,n)}static create(e,t,r,i){return new jd(nd.VEC_2,e,t,r,i)}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let e=0;e<this.numGeometries;e++)if(this.geometryType(e)===rd.POLYGON||this.geometryType(e)===rd.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}}class Vd{_triangleOffsets;_indexBuffer;_vertexBuffer;_topologyVector;constructor(e,t,r,i){this._triangleOffsets=e,this._indexBuffer=t,this._vertexBuffer=r,this._topologyVector=i}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw new Error("Cannot convert GpuVector to coordinates without topology information");const e=new Array(this.numGeometries),t=this._topologyVector,i=t.partOffsets,n=t.ringOffsets,o=t.geometryOffsets;let a=0,s=1,l=1,c=1;for(let u=0;u<this.numGeometries;u++)switch(this.geometryType(u)){case rd.POLYGON:{const t=i[s]-i[s-1];s++;const h=[];for(let e=0;e<t;e++){const e=n[l]-n[l-1];l++;const t=[];for(let i=0;i<e;i++){const e=this._vertexBuffer[a++],i=this._vertexBuffer[a++];t.push(new r(e,i))}t.length>0&&t.push(t[0]),h.push(t)}e[u]=h,o&&c++}break;case rd.MULTIPOLYGON:{const t=o[c]-o[c-1];c++;const h=[];for(let e=0;e<t;e++){const e=i[s]-i[s-1];s++;for(let t=0;t<e;t++){const e=n[l]-n[l-1];l++;const t=[];for(let i=0;i<e;i++){const e=this._vertexBuffer[a++],i=this._vertexBuffer[a++];t.push(new r(e,i))}t.length>0&&t.push(t[0]),h.push(t)}}e[u]=h}}return e}[Symbol.iterator](){return null}}class Ud extends Vd{_numGeometries;_geometryType;constructor(e,t,r,i,n,o){super(r,i,n,o),this._numGeometries=e,this._geometryType=t}static create(e,t,r,i,n,o){return new Ud(e,t,r,i,n,o)}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}}class Gd extends Vd{_geometryTypes;constructor(e,t,r,i,n){super(t,r,i,n),this._geometryTypes=e}static create(e,t,r,i,n){return new Gd(e,t,r,i,n)}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}}function qd(e,t,r,i,n){const o=wd.decode(e,r);let a=null,s=null,l=null,c=null,u=null,h=null,d=null,p=null;if(Sd.getVectorType(o,i,e,r)===td.CONST){const f=Sd.decodeConstIntStream(e,r,o,!1);for(let i=0;i<t-1;i++){const t=wd.decode(e,r);switch(t.physicalStreamType){case Xh.LENGTH:switch(t.logicalStreamType.lengthType){case ed.GEOMETRIES:a=Sd.decodeLengthStreamToOffsetBuffer(e,r,t);break;case ed.PARTS:s=Sd.decodeLengthStreamToOffsetBuffer(e,r,t);break;case ed.RINGS:l=Sd.decodeLengthStreamToOffsetBuffer(e,r,t);break;case ed.TRIANGLES:d=Sd.decodeLengthStreamToOffsetBuffer(e,r,t)}break;case Xh.OFFSET:switch(t.logicalStreamType.offsetType){case Qh.VERTEX:c=Sd.decodeIntStream(e,r,t,!1);break;case Qh.INDEX:p=Sd.decodeIntStream(e,r,t,!1)}break;case Xh.DATA:if(Kh.VERTEX===t.logicalStreamType.dictionaryType)u=Sd.decodeIntStream(e,r,t,!0,n);else{const i=t;h={numBits:i.numBits(),coordinateShift:i.coordinateShift()},u=Sd.decodeIntStream(e,r,t,!1,n)}}}if(null!==p){if(null!=a||null!=s){const e=new Pd(a,s,l);return Ud.create(i,f,d,p,u,e)}return Ud.create(i,f,d,p,u)}return null===h?Nd.create(i,f,new Pd(a,s,l),c,u):Nd.createMortonEncoded(i,f,new Pd(a,s,l),c,u,h)}const f=Sd.decodeIntStream(e,r,o,!1);for(let m=0;m<t-1;m++){const t=wd.decode(e,r);switch(t.physicalStreamType){case Xh.LENGTH:switch(t.logicalStreamType.lengthType){case ed.GEOMETRIES:a=Sd.decodeIntStream(e,r,t,!1);break;case ed.PARTS:s=Sd.decodeIntStream(e,r,t,!1);break;case ed.RINGS:l=Sd.decodeIntStream(e,r,t,!1);break;case ed.TRIANGLES:d=Sd.decodeLengthStreamToOffsetBuffer(e,r,t)}break;case Xh.OFFSET:switch(t.logicalStreamType.offsetType){case Qh.VERTEX:c=Sd.decodeIntStream(e,r,t,!1);break;case Qh.INDEX:p=Sd.decodeIntStream(e,r,t,!1)}break;case Xh.DATA:if(Kh.VERTEX===t.logicalStreamType.dictionaryType)u=Sd.decodeIntStream(e,r,t,!0,n);else{const i=t;h={numBits:i.numBits(),coordinateShift:i.coordinateShift()},u=Sd.decodeIntStream(e,r,t,!1,n)}}}return null!==p&&null===s?Gd.create(f,d,p,u):(null!==a?(a=$d(f,a,2),null!==s&&null!==l?(s=Wd(f,a,s,!1),l=function(e,t,r,i){const n=new Int32Array(r[r.length-1]+1);let o=0;n[0]=o;let a=1,s=1,l=0;for(let c=0;c<e.length;c++){const u=e[c],h=t[c+1]-t[c];if(0!==u&&3!==u)for(let e=0;e<h;e++){const e=r[a]-r[a-1];a++;for(let t=0;t<e;t++)o=n[s++]=o+i[l++]}else for(let e=0;e<h;e++)n[s++]=++o,a++}return n}(f,a,s,l)):null!==s&&(s=function(e,t,r){const i=new Int32Array(t[t.length-1]+1);let n=0;i[0]=n;let o=1,a=0;for(let s=0;s<e.length;s++){const l=e[s],c=t[s+1]-t[s];if(4===l||1===l)for(let e=0;e<c;e++)n=i[o++]=n+r[a++];else for(let e=0;e<c;e++)i[o++]=++n}return i}(f,a,s))):null!==s&&null!==l?(s=$d(f,s,1),l=Wd(f,s,l,!0)):null!==s&&(s=$d(f,s,0)),null!==p?Gd.create(f,d,p,u,new Pd(a,s,l)):null===h?jd.create(f,new Pd(a,s,l),c,u):jd.createMortonEncoded(f,new Pd(a,s,l),c,u,h))}function $d(e,t,r){const i=new Int32Array(e.length+1);let n=0;i[0]=n;let o=0;for(let a=0;a<e.length;a++)n=i[a+1]=n+(e[a]>r?t[o++]:1);return i}function Wd(e,t,r,i){const n=new Int32Array(t[t.length-1]+1);let o=0;n[0]=o;let a=1,s=0;for(let l=0;l<e.length;l++){const c=e[l],u=t[l+1]-t[l];if(5===c||2===c||i&&(4===c||1===c))for(let e=0;e<u;e++)o=n[a++]=o+r[s++];else for(let e=0;e<u;e++)n[a++]=++o}return n}class Zd extends jh{dataVector;constructor(e,t,r){super(e,t.getBuffer(),r),this.dataVector=t}getValueFromBuffer(e){return this.dataVector.get(e)}}class Hd extends Vh{getValueFromBuffer(e){return this.dataBuffer[e]}}class Xd extends jh{constructor(e,t,r){super(e,BigInt64Array.of(t),r)}getValueFromBuffer(e){return this.dataBuffer[0]}}function Yd(e,t,r){for(let i=0;i<e;i++){const e=wd.decode(t,r);r.add(e.byteLength)}}function Jd(e,t,r){return Kd(e,Math.ceil(t/8),r)}function Kd(e,t,r){const i=new Uint8Array(t);let n=0;for(;n<t;){const t=e[r.increment()];if(t<=127){const o=t+3,a=e[r.increment()],s=n+o;i.fill(a,n,s),n=s}else{const o=256-t;for(let t=0;t<o;t++)i[n++]=e[r.increment()]}}return i}const Qd=new TextDecoder;function ep(e,t,r){return r-t>=12?Qd.decode(e.subarray(t,r)):function(e,t,r){let i="",n=t;for(;n<r;){const t=e[n];let o,a,s,l=null,c=t>239?4:t>223?3:t>191?2:1;if(n+c>r)break;1===c?t<128&&(l=t):2===c?(o=e[n+1],128==(192&o)&&(l=(31&t)<<6|63&o,l<=127&&(l=null))):3===c?(o=e[n+1],a=e[n+2],128==(192&o)&&128==(192&a)&&(l=(15&t)<<12|(63&o)<<6|63&a,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===c&&(o=e[n+1],a=e[n+2],s=e[n+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(l=(15&t)<<18|(63&o)<<12|(63&a)<<6|63&s,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,c=1):l>65535&&(l-=65536,i+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),i+=String.fromCharCode(l),n+=c}return i}(e,t,r)}class tp extends jh{offsetBuffer;constructor(e,t,r,i){super(e,r,i),this.offsetBuffer=t}}class rp extends tp{textEncoder;constructor(e,t,r,i){super(e,t,r,i??t.length-1),this.textEncoder=new TextEncoder}getValueFromBuffer(e){return ep(this.dataBuffer,this.offsetBuffer[e],this.offsetBuffer[e+1])}}class ip extends tp{indexBuffer;textEncoder;constructor(e,t,r,i,n){super(e,r,i,n??t.length),this.indexBuffer=t,this.indexBuffer=t,this.textEncoder=new TextEncoder}getValueFromBuffer(e){const t=this.indexBuffer[e];return ep(this.dataBuffer,this.offsetBuffer[t],this.offsetBuffer[t+1])}}class np extends tp{indexBuffer;symbolOffsetBuffer;symbolTableBuffer;textEncoder;symbolLengthBuffer;lengthBuffer;decodedDictionary;constructor(e,t,r,i,n,o,a){super(e,r,i,a),this.indexBuffer=t,this.symbolOffsetBuffer=n,this.symbolTableBuffer=o,this.textEncoder=new TextEncoder}getValueFromBuffer(e){null==this.decodedDictionary&&(null==this.symbolLengthBuffer&&(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer),this.lengthBuffer=this.offsetToLengthBuffer(this.offsetBuffer)),this.decodedDictionary=function(e,t,r){const i=[],n=new Array(t.length).fill(0);for(let o=1;o<t.length;o++)n[o]=n[o-1]+t[o-1];for(let o=0;o<r.length;o++)if(255===r[o])i.push(r[++o]);else{const a=t[r[o]],s=n[r[o]];for(let t=0;t<a;t++)i.push(e[s+t])}return new Uint8Array(i)}(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer));const t=this.indexBuffer[e];return ep(this.decodedDictionary,this.offsetBuffer[t],this.offsetBuffer[t+1])}offsetToLengthBuffer(e){const t=new Uint32Array(e.length-1);let r=e[0];for(let i=1;i<e.length;i++){const n=e[i];t[i-1]=n-r,r=n}return t}}class op{static ROOT_COLUMN_NAME="default";static NESTED_COLUMN_SEPARATOR=":";constructor(){}static decode(e,t,r,i,n){let o=null,a=null,s=null,l=null,c=null,u=null,h=null,d=null;for(let p=0;p<i;p++){const e=wd.decode(t,r);if(0!==e.byteLength)switch(e.physicalStreamType){case Xh.PRESENT:{const i=Jd(t,e.numValues,r);u=new Td(i,e.numValues);break}case Xh.OFFSET:a=null!=n||null!=u?Sd.decodeNullableIntStream(t,r,e,!1,n??u):Sd.decodeIntStream(t,r,e,!1);break;case Xh.LENGTH:{const i=Sd.decodeLengthStreamToOffsetBuffer(t,r,e);ed.DICTIONARY===e.logicalStreamType.lengthType?o=i:ed.SYMBOL===e.logicalStreamType.lengthType?l=i:h=i;break}case Xh.DATA:{const i=t.subarray(r.get(),r.get()+e.byteLength);r.add(e.byteLength);const n=e.logicalStreamType.dictionaryType;Kh.FSST===n?c=i:Kh.SINGLE===n||Kh.SHARED===n?s=i:Kh.NONE===n&&(d=i);break}}}return this.decodeFsstDictionaryVector(e,c,a,o,s,l,n??u)??this.decodeDictionaryVector(e,s,a,o,n??u)??this.decodePlainStringVector(e,h,d,a,n??u)}static decodeFsstDictionaryVector(e,t,r,i,n,o,a){return t?new np(e,r,i,n,o,t,a):null}static decodeDictionaryVector(e,t,r,i,n){return t?n?new ip(e,r,i,t,n):new ip(e,r,i,t):null}static decodePlainStringVector(e,t,r,i,n){if(!t||!r)return null;if(i)return n?new ip(e,i,t,r,n):new ip(e,i,t,r);if(n&&n.size()!==t.length-1){const i=new Int32Array(n.size());let o=0;for(let e=0;e<n.size();e++)i[e]=n.get(e)?o++:0;return new ip(e,i,t,r,n)}return n?new rp(e,t,r,n):new rp(e,t,r)}static decodeSharedDictionary(e,t,r,i,n){let o=null,a=null,s=null,l=null,c=!1;for(;!c;){const r=wd.decode(e,t);switch(r.physicalStreamType){case Xh.LENGTH:ed.DICTIONARY===r.logicalStreamType.lengthType?o=Sd.decodeLengthStreamToOffsetBuffer(e,t,r):s=Sd.decodeLengthStreamToOffsetBuffer(e,t,r);break;case Xh.DATA:Kh.SINGLE===r.logicalStreamType.dictionaryType||Kh.SHARED===r.logicalStreamType.dictionaryType?(a=e.subarray(t.get(),t.get()+r.byteLength),c=!0):l=e.subarray(t.get(),t.get()+r.byteLength),t.add(r.byteLength)}}const u=r.complexType.children,h=[];let d=0;for(const p of u){const c=ad(e,t,1)[0];if(0==c)continue;const u=`${r.name}${p.name===op.ROOT_COLUMN_NAME?"":op.NESTED_COLUMN_SEPARATOR+p.name}`;if(n&&!n.has(u)){Yd(c,e,t);continue}if(2!==c||"scalarField"!==p.type||9!==p.scalarField.physicalType)throw new Error("Currently only optional string fields are implemented for a struct.");const f=wd.decode(e,t),m=Jd(e,f.numValues,t),g=wd.decode(e,t),_=(g instanceof xd?g.numRleValues:g.numValues)!==i?Sd.decodeNullableIntStream(e,t,g,!1,new Td(m,f.numValues)):Sd.decodeIntStream(e,t,g,!1);h[d++]=l?new np(u,_,o,a,s,l,new Td(m,f.numValues)):new ip(u,_,o,a,new Td(m,f.numValues))}return h}}function ap(e,t,r,i,n,o){return"scalarType"===r.type?function(e,t,r,i,n,o){let a=null,s=0;if(0===e)return null;if(o.nullable){const e=wd.decode(t,r);s=e.numValues;const i=r.get(),n=Jd(t,s,r);r.set(i+e.byteLength),a=new Td(n,e.numValues)}const l=a??i;switch(n.physicalType){case 4:case 3:return function(e,t,r,i,n){const o=wd.decode(e,t),a=Sd.getVectorType(o,n,e,t),s=3===i.physicalType;if(a===td.FLAT){const i=sp(n)?Sd.decodeNullableIntStream(e,t,o,s,n):Sd.decodeIntStream(e,t,o,s);return new Uh(r.name,i,n)}if(a===td.SEQUENCE){const i=Sd.decodeSequenceIntStream(e,t,o);return new $h(r.name,i[0],i[1],o.numRleValues)}{const i=Sd.decodeConstIntStream(e,t,o,s);return new Wh(r.name,i,n)}}(t,r,o,n,l);case 9:return op.decode(o.name,t,r,o.nullable?e-1:e,a);case 0:return function(e,t,r,i,n){const o=wd.decode(e,t),a=o.numValues,s=t.get(),l=sp(n)?function(e,t,r,i){const n=Kd(e,Math.ceil(t/8),r),o=new Td(n,t),a=i.size(),s=new Td(new Uint8Array(a),a);let l=0;for(let c=0;c<i.size();c++){const e=!!i.get(c)&&o.get(l++);s.set(c,e)}return s.getBuffer()}(e,a,t,n):Jd(e,a,t);t.set(s+o.byteLength);const c=new Td(l,a);return new Zd(r.name,c,n)}(t,r,o,0,l);case 6:case 5:return function(e,t,r,i,n){const o=wd.decode(e,t),a=Sd.getVectorType(o,i,e,t),s=5===n.physicalType;if(a===td.FLAT){const n=sp(i)?Sd.decodeNullableLongStream(e,t,o,s,i):Sd.decodeLongStream(e,t,o,s);return new Ed(r.name,n,i)}if(a===td.SEQUENCE){const i=Sd.decodeSequenceLongStream(e,t,o);return new Id(r.name,i[0],i[1],o.numRleValues)}{const n=Sd.decodeConstLongStream(e,t,o,s);return new Xd(r.name,n,i)}}(t,r,o,l,n);case 7:return function(e,t,r,i){const n=wd.decode(e,t),o=sp(i)?function(e,t,r,i){const n=t.get(),o=n+i*Float32Array.BYTES_PER_ELEMENT,a=new Uint8Array(e.subarray(n,o)).buffer,s=new Float32Array(a);t.set(o);const l=r.size(),c=new Float32Array(l);let u=0;for(let h=0;h<l;h++)c[h]=r.get(h)?s[u++]:0;return c}(e,t,i,n.numValues):function(e,t,r){const i=t.get(),n=i+r*Float32Array.BYTES_PER_ELEMENT,o=new Uint8Array(e.subarray(i,n)).buffer,a=new Float32Array(o);return t.set(n),a}(e,t,n.numValues);return new Hd(r.name,o,i)}(t,r,o,l);case 8:return function(e,t,r,i){const n=wd.decode(e,t),o=sp(i)?function(e,t,r,i){const n=t.get(),o=n+i*Float64Array.BYTES_PER_ELEMENT,a=new Uint8Array(e.subarray(n,o)).buffer,s=new Float64Array(a);t.set(o);const l=r.size(),c=new Float64Array(l);let u=0;for(let h=0;h<l;h++)c[h]=r.get(h)?s[u++]:0;return c}(e,t,i,n.numValues):function(e,t,r){const i=t.get(),n=i+r*Float64Array.BYTES_PER_ELEMENT,o=new Uint8Array(e.subarray(i,n)).buffer,a=new Float64Array(o);return t.set(n),a}(e,t,n.numValues);return new Gh(r.name,o,i)}(t,r,o,l);default:throw new Error(`The specified data type for the field is currently not supported: ${n}`)}}(i,e,t,n,r.scalarType,r):1!=i?null:op.decodeSharedDictionary(e,t,r,n,o)}function sp(e){return e instanceof Td}class lp{static decodeColumnType(e){switch(e){case 0:case 1:case 2:case 3:{const t={};t.nullable=!!(1&e),t.columnScope=0;const r={};return r.physicalType=e>1?6:4,r.type="physicalType",t.scalarType=r,t.type="scalarType",t}case 4:{const e={nullable:!1,columnScope:0},t={type:"physicalType",physicalType:0};return e.type="complexType",e.complexType=t,e}case 30:{const e={nullable:!1,columnScope:0},t={type:"physicalType",physicalType:1};return e.type="complexType",e.complexType=t,e}default:return this.mapScalarType(e)}}static columnTypeHasName(e){return e>=10}static columnTypeHasChildren(e){return 30===e}static hasStreamCount(e){if("id"===e.name)return!1;if("scalarType"===e.type){const t=e.scalarType;if("physicalType"===t.type)switch(t.physicalType){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:default:return!1;case 9:return!0}else if("logicalType"===t.type)return!1}else if("complexType"===e.type){const t=e.complexType;if("physicalType"===t.type)switch(t.physicalType){case 0:case 1:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",e),!1}static mapScalarType(e){let t=null;switch(e){case 10:case 11:t=0;break;case 12:case 13:t=1;break;case 14:case 15:t=2;break;case 16:case 17:t=3;break;case 18:case 19:t=4;break;case 20:case 21:t=5;break;case 22:case 23:t=6;break;case 24:case 25:t=7;break;case 26:case 27:t=8;break;case 28:case 29:t=9;break;default:return null}const r={};r.nullable=!!(1&e),r.columnScope=0;const i={type:"physicalType"};return i.physicalType=t,r.type="scalarType",r.scalarType=i,r}}const cp=new TextDecoder;function up(e,t){const r=ad(e,t,1)[0];if(0===r)return"";const i=t.get(),n=e.subarray(i,i+r);return t.add(r),cp.decode(n)}function hp(e,t){const r=ad(e,t,1)[0]>>>0,i=!!(4&r),n=!!(2&r),o=ad(e,t,1)[0]>>>0,a={};if(1&r&&(a.nullable=!0),n){const n={};if(i?(n.type="logicalType",n.logicalType=o):(n.type="physicalType",n.physicalType=o),8&r){const r=ad(e,t,1)[0]>>>0;n.children=new Array(r);for(let i=0;i<r;i++)n.children[i]=hp(e,t)}a.type="complexField",a.complexField=n}else{const e={};i?(e.type="logicalType",e.logicalType=o):(e.type="physicalType",e.physicalType=o),a.type="scalarField",a.scalarField=e}return a}function dp(e,t){const r=ad(e,t,1)[0]>>>0,i=lp.decodeColumnType(r);if(!i)throw new Error(`Unsupported column type code: ${r}`);if(lp.columnTypeHasName(r)?i.name=up(e,t):r>=0&&r<=3?i.name="id":4===r&&(i.name="geometry"),lp.columnTypeHasChildren(r)){const r=ad(e,t,1)[0]>>>0,n=i.complexType;n.children=new Array(r);for(let i=0;i<r;i++)n.children[i]=hp(e,t)}return i}function pp(e,t){const r={featureTables:[]},i={};i.name=up(e,t);const n=ad(e,t,1)[0]>>>0,o=ad(e,t,1)[0]>>>0;i.columns=new Array(o);for(let a=0;a<o;a++)i.columns[a]=dp(e,t);return r.featureTables.push(i),[r,n]}function fp(e,t,r,i,n,o,a=!1){const s=t.scalarType.physicalType,l=Sd.getVectorType(n,o,e,r);if(4===s)switch(l){case td.FLAT:{const t=Sd.decodeIntStream(e,r,n,!1);return new Uh(i,t,o)}case td.SEQUENCE:{const t=Sd.decodeSequenceIntStream(e,r,n);return new $h(i,t[0],t[1],n.numRleValues)}case td.CONST:{const t=Sd.decodeConstIntStream(e,r,n,!1);return new Wh(i,t,o)}}else switch(l){case td.FLAT:{if(a){const t=Sd.decodeLongFloat64Stream(e,r,n,!1);return new Gh(i,t,o)}const t=Sd.decodeLongStream(e,r,n,!1);return new Ed(i,t,o)}case td.SEQUENCE:{const t=Sd.decodeSequenceLongStream(e,r,n);return new Id(i,t[0],t[1],n.numRleValues)}case td.CONST:{const t=Sd.decodeConstLongStream(e,r,n,!1);return new Xd(i,t,o)}}throw new Error("Vector type not supported for id column.")}class mp{constructor(e,t){var r;switch(this._featureData=e,this.properties=this._featureData.properties||{},null===(r=this._featureData.geometry)||void 0===r?void 0:r.type){case rd.POINT:case rd.MULTIPOINT:this.type=1;break;case rd.LINESTRING:case rd.MULTILINESTRING:this.type=2;break;case rd.POLYGON:case rd.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=t,this.id=Number(this._featureData.id)}projectPoint(e,t,r,i){return[360*(e.x+t)/i-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+r)/i)*Math.PI))-90]}projectLine(e,t,r,i){return e.map(e=>this.projectPoint(e,t,r,i))}toGeoJSON(e,t,r){const i=this.extent*Math.pow(2,r),n=this.extent*e,o=this.extent*t,a=this.loadGeometry();let s;switch(this.type){case 1:{const e=[];for(const r of a)e.push(r[0]);const t=this.projectLine(e,n,o,i);s=1===e.length?{type:"Point",coordinates:t[0]}:{type:"MultiPoint",coordinates:t};break}case 2:{const e=a.map(e=>this.projectLine(e,n,o,i));s=1===e.length?{type:"LineString",coordinates:e[0]}:{type:"MultiLineString",coordinates:e};break}case 3:{const e=Qr(a),t=[];for(const r of e)t.push(r.map(e=>this.projectLine(e,n,o,i)));s=1===t.length?{type:"Polygon",coordinates:t[0]}:{type:"MultiPolygon",coordinates:t};break}default:throw new Error(`unknown feature type: ${this.type}`)}const l={type:"Feature",geometry:s,properties:this.properties};return null!=this.id&&(l.id=this.id),l}loadGeometry(){const e=[];for(const t of this._featureData.geometry.coordinates){const i=[];for(const e of t)i.push(new r(e.x,e.y));e.push(i)}return e}bbox(){return[0,0,0,0]}}class gp{constructor(e){this.features=[],this.featureTable=e,this.name=e.name,this.extent=e.extent,this.version=2,this.features=e.getFeatures(),this.length=this.features.length}feature(e){return new mp(this.features[e],this.extent)}}class _p{constructor(e){this.layers={};const t=function(e,t,r=!0){const i=new Hh(0),n=[];for(;i.get()<e.length;){const o=ad(e,i,1)[0]>>>0,a=i.get()+o;if(a>e.length)throw new Error(`Block overruns tile: ${a} > ${e.length}`);if(1!=ad(e,i,1)[0]>>>0){i.set(a);continue}const s=pp(e,i),l=s[1],c=s[0].featureTables[0];let u=null,h=null;const d=[];let p=0;for(const n of c.columns){const o=n.name;if("id"===o){let t=null;if(n.nullable){const r=wd.decode(e,i),n=i.get(),o=Jd(e,r.numValues,i);i.set(n+r.byteLength),t=new Td(o,r.numValues)}const a=wd.decode(e,i);p=a.getDecompressedCount(),u=fp(e,n,i,o,a,t??p,r)}else if("geometry"===o){const r=ad(e,i,1)[0];if(0===p){const t=i.get();p=wd.decode(e,i).getDecompressedCount(),i.set(t)}h=qd(e,r,i,p,t)}else{const t=lp.hasStreamCount(n)?ad(e,i,1)[0]:1;if(0===t&&"scalarType"===n.type)continue;const r=ap(e,i,n,t,p,void 0);r&&(Array.isArray(r)?d.push(...r):d.push(r))}}const f=new Zh(c.name,h,u,d,l);n.push(f),i.set(a)}return n}(new Uint8Array(e));this.layers=t.reduce((e,t)=>Object.assign(Object.assign({},e),{[t.name]:new gp(t)}),{})}}class yp{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(e){return this.minX=Math.min(this.minX,e.x),this.minY=Math.min(this.minY,e.y),this.maxX=Math.max(this.maxX,e.x),this.maxY=Math.max(this.maxY,e.y),this}expandBy(e){return this.minX-=e,this.minY-=e,this.maxX+=e,this.maxY+=e,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(e){return this.expandBy(-e)}map(e){const t=new yp;return t.extend(e(new r(this.minX,this.minY))),t.extend(e(new r(this.maxX,this.minY))),t.extend(e(new r(this.minX,this.maxY))),t.extend(e(new r(this.maxX,this.maxY))),t}static fromPoints(e){const t=new yp;for(const r of e)t.extend(r);return t}contains(e){return e.x>=this.minX&&e.x<=this.maxX&&e.y>=this.minY&&e.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(e){return!this.empty()&&!e.empty()&&e.minX>=this.minX&&e.maxX<=this.maxX&&e.minY>=this.minY&&e.maxY<=this.maxY}intersects(e){return!this.empty()&&!e.empty()&&e.minX<=this.maxX&&e.maxX>=this.minX&&e.minY<=this.maxY&&e.maxY>=this.minY}}const vp="_geojsonTileLayer";class bp{constructor(e,t){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new ao(A,16,0),this.grid3D=new ao(A,16,0),this.featureIndexArray=new za,this.promoteId=t}insert(e,t,r,i,n,o){const a=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,i,n);const s=o?this.grid3D:this.grid;for(let l=0;l<t.length;l++){const e=t[l],r=[1/0,1/0,-1/0,-1/0];for(let t=0;t<e.length;t++){const i=e[t];r[0]=Math.min(r[0],i.x),r[1]=Math.min(r[1],i.y),r[2]=Math.max(r[2],i.x),r[3]=Math.max(r[3],i.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="mlt"!==this.encoding?new Ac(new xu(this.rawTileData)).layers:new _p(this.rawTileData).layers,this.sourceLayerCoder=new Bh(this.vtLayers?Object.keys(this.vtLayers).sort():[vp])),this.vtLayers}query(e,t,i,n){this.loadVTLayers();const o=e.params,a=A/e.tileSize/e.scale,s=dn(o.filter,o.globalState),l=e.queryGeometry,c=e.queryPadding*a,u=yp.fromPoints(l),h=this.grid.query(u.minX-c,u.minY-c,u.maxX+c,u.maxY+c),d=yp.fromPoints(e.cameraQueryGeometry).expandBy(c),p=this.grid3D.query(d.minX,d.minY,d.maxX,d.maxY,(t,i,n,o)=>function(e,t,i,n,o){for(const r of e)if(t<=r.x&&i<=r.y&&n>=r.x&&o>=r.y)return!0;const a=[new r(t,i),new r(t,o),new r(n,o),new r(n,i)];if(e.length>2)for(const r of a)if(Ys(e,r))return!0;for(let r=0;r<e.length-1;r++)if(Js(e[r],e[r+1],a))return!0;return!1}(e.cameraQueryGeometry,t-c,i-c,n+c,o+c));for(const r of p)h.push(r);h.sort(wp);const f={};let m;for(let r=0;r<h.length;r++){const c=h[r];if(c===m)continue;m=c;const u=this.featureIndexArray.get(c);let d=null;this.loadMatchingFeature(f,u.bucketIndex,u.sourceLayerIndex,u.featureIndex,s,o.layers,o.availableImages,t,i,n,(t,r,i)=>(d||(d=Os(t)),r.queryIntersectsFeature({queryGeometry:l,feature:t,featureState:i,geometry:d,zoom:this.z,transform:e.transform,pixelsToTileUnits:a,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation})))}return f}loadMatchingFeature(e,t,r,i,n,o,a,s,l,c,u){const h=this.bucketLayerIDs[t];if(o&&!h.some(e=>o.has(e)))return;const d=this.sourceLayerCoder.decode(r),p=this.vtLayers[d].feature(i);if(n.needGeometry){const e=zs(p,!0);if(!n.filter(new Co(this.tileID.overscaledZ),e,this.tileID.canonical))return}else if(!n.filter(new Co(this.tileID.overscaledZ),p))return;const f=this.getId(p,d);for(let m=0;m<h.length;m++){const t=h[m];if(o&&!o.has(t))continue;const r=s[t];if(!r)continue;let n={};f&&c&&(n=c.getState(r.sourceLayer||vp,f));const d=B({},l[t]);d.paint=xp(d.paint,r.paint,p,n,a),d.layout=xp(d.layout,r.layout,p,n,a);const g=!u||u(p,r,n);if(!g)continue;const _=new Nh(p,this.z,this.x,this.y,f);_.layer=d;let y=e[t];void 0===y&&(y=e[t]=[]),y.push({featureIndex:i,feature:_,intersectionZ:g})}}lookupSymbolFeatures(e,t,r,i,n,o,a,s){const l={};this.loadVTLayers();const c=dn(n.filterSpec,n.globalState);for(const u of e)this.loadMatchingFeature(l,r,i,u,c,o,a,s,t);return l}hasLayer(e){for(const t of this.bucketLayerIDs)for(const r of t)if(e===r)return!0;return!1}getId(e,t){var r;let i=e.id;return this.promoteId&&(i=e.properties["string"==typeof this.promoteId?this.promoteId:this.promoteId[t]],"boolean"==typeof i&&(i=Number(i)),void 0===i&&(null===(r=e.properties)||void 0===r?void 0:r.cluster)&&this.promoteId&&(i=Number(e.properties.cluster_id))),i}}function xp(e,t,r,i,n){return j(e,(e,o)=>{const a=t instanceof jo?t.get(o):null;return a&&a.evaluate?a.evaluate(r,i,n):a})}function wp(e,t){return t-e}function Tp(e,t,i,n,o){const a=[];for(let s=0;s<e.length;s++){const l=e[s];let c;for(let e=0;e<l.length-1;e++){let s=l[e],u=l[e+1];s.x<t&&u.x<t||(s.x<t?s=new r(t,s.y+(t-s.x)/(u.x-s.x)*(u.y-s.y))._round():u.x<t&&(u=new r(t,s.y+(t-s.x)/(u.x-s.x)*(u.y-s.y))._round()),s.y<i&&u.y<i||(s.y<i?s=new r(s.x+(i-s.y)/(u.y-s.y)*(u.x-s.x),i)._round():u.y<i&&(u=new r(s.x+(i-s.y)/(u.y-s.y)*(u.x-s.x),i)._round()),s.x>=n&&u.x>=n||(s.x>=n?s=new r(n,s.y+(n-s.x)/(u.x-s.x)*(u.y-s.y))._round():u.x>=n&&(u=new r(n,s.y+(n-s.x)/(u.x-s.x)*(u.y-s.y))._round()),s.y>=o&&u.y>=o||(s.y>=o?s=new r(s.x+(o-s.y)/(u.y-s.y)*(u.x-s.x),o)._round():u.y>=o&&(u=new r(s.x+(o-s.y)/(u.y-s.y)*(u.x-s.x),o)._round()),c&&s.equals(c[c.length-1])||(c=[s],a.push(c)),c.push(u)))))}}return a}function Sp(e,t,r,i,n){switch(t){case 1:return function(e,t,r,i){const n=[];for(const o of e)for(const e of o){const o=0===i?e.x:e.y;o>=t&&o<=r&&n.push([e])}return n}(e,r,i,n);case 2:return Ip(e,r,i,n,!1);case 3:return Ip(e,r,i,n,!0)}return[]}function Ep(e,t,i,n,o){const a=0===n?Pp:kp;let s=[];const l=[];for(let r=0;r<e.length-1;r++){const c=e[r],u=e[r+1],h=0===n?c.x:c.y,d=0===n?u.x:u.y;let p=!1;h<t?d>t&&s.push(a(c,u,t)):h>i?d<i&&s.push(a(c,u,i)):s.push(c),d<t&&h>=t&&(s.push(a(c,u,t)),p=!0),d>i&&h<=i&&(s.push(a(c,u,i)),p=!0),!o&&p&&(l.push(s),s=[])}const c=e.length-1,u=0===n?e[c].x:e[c].y;return u>=t&&u<=i&&s.push(e[c]),o&&s.length>0&&!s[0].equals(s[s.length-1])&&s.push(new r(s[0].x,s[0].y)),s.length>0&&l.push(s),l}function Ip(e,t,r,i,n){const o=[];for(const a of e){const e=Ep(a,t,r,i,n);e.length>0&&o.push(...e)}return o}function Pp(e,t,i){return new r(i,e.y+(i-e.x)/(t.x-e.x)*(t.y-e.y))}function kp(e,t,i){return new r(e.x+(i-e.y)/(t.y-e.y)*(t.x-e.x),i)}lo("FeatureIndex",bp,{omit:["rawTileData","sourceLayerCoder"]});class Ap extends r{constructor(e,t,r,i){super(e,t),this.angle=r,void 0!==i&&(this.segment=i)}clone(){return new Ap(this.x,this.y,this.angle,this.segment)}}function Cp(e,t,r,i,n){if(void 0===t.segment||0===r)return!0;let o=t,a=t.segment+1,s=0;for(;s>-r/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<r/2;){const t=e[a],r=e[a+1];if(!r)return!1;let o=e[a-1].angleTo(t)-t.angleTo(r);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>i;)c-=l.shift().angleDelta;if(c>n)return!1;a++,s+=t.dist(r)}return!0}function Mp(e){let t=0;for(let r=0;r<e.length-1;r++)t+=e[r].dist(e[r+1]);return t}function Dp(e,t,r){return e?.6*t*r:0}function Rp(e,t){return Math.max(e?e.right-e.left:0,t?t.right-t.left:0)}function Lp(e,t,r,i,n,o){const a=Dp(r,n,o),s=Rp(r,i)*o;let l=0;const c=Mp(e)/2;for(let u=0;u<e.length-1;u++){const r=e[u],i=e[u+1],n=r.dist(i);if(l+n>c){const o=(c-l)/n,h=fr.number(r.x,i.x,o),d=fr.number(r.y,i.y,o),p=new Ap(h,d,i.angleTo(r),u);return p._round(),!a||Cp(e,p,s,a,t)?p:void 0}l+=n}}function Fp(e,t,r,i,n,o,a,s,l){const c=Dp(i,o,a),u=Rp(i,n),h=u*a,d=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),Op(e,d?t/2*s%t:(u/2+2*o)*a*s%t,t,c,r,h,d,!1,l)}function Op(e,t,r,i,n,o,a,s,l){const c=o/2,u=Mp(e);let h=0,d=t-r,p=[];for(let f=0;f<e.length-1;f++){const t=e[f],a=e[f+1],s=t.dist(a),m=a.angleTo(t);for(;d+r<h+s;){d+=r;const g=(d-h)/s,_=fr.number(t.x,a.x,g),y=fr.number(t.y,a.y,g);if(_>=0&&_<l&&y>=0&&y<l&&d-c>=0&&d+c<=u){const t=new Ap(_,y,m,f);t._round(),i&&!Cp(e,t,o,i,n)||p.push(t)}}h+=s}return s||p.length||a||(p=Op(e,h/2,r,i,n,o,a,!0,l)),p}function zp(e,t,i,n){const o=[],a=e.image,s=a.pixelRatio,l=a.paddedRect.w-2,c=a.paddedRect.h-2;let u={x1:e.left,y1:e.top,x2:e.right,y2:e.bottom};const h=a.stretchX||[[0,l]],d=a.stretchY||[[0,c]],p=(e,t)=>e+t[1]-t[0],f=h.reduce(p,0),m=d.reduce(p,0),g=l-f,_=c-m;let y=0,v=f,b=0,x=m,w=0,T=g,S=0,E=_;if(a.content&&n){const t=a.content,r=t[2]-t[0],i=t[3]-t[1];(a.textFitWidth||a.textFitHeight)&&(u=Xu(e)),y=Bp(h,0,t[0]),b=Bp(d,0,t[1]),v=Bp(h,t[0],t[2]),x=Bp(d,t[1],t[3]),w=t[0]-y,S=t[1]-b,T=r-v,E=i-x}const I=u.x1,P=u.y1,k=u.x2-I,A=u.y2-P,C=(e,n,o,l)=>{const c=jp(e.stretch-y,v,k,I),u=Vp(e.fixed-w,T,e.stretch,f),h=jp(n.stretch-b,x,A,P),d=Vp(n.fixed-S,E,n.stretch,m),p=jp(o.stretch-y,v,k,I),g=Vp(o.fixed-w,T,o.stretch,f),_=jp(l.stretch-b,x,A,P),C=Vp(l.fixed-S,E,l.stretch,m),M=new r(c,h),D=new r(p,h),R=new r(p,_),L=new r(c,_),F=new r(u/s,d/s),O=new r(g/s,C/s),z=t*Math.PI/180;if(z){const e=Math.sin(z),t=Math.cos(z),r=[t,-e,e,t];M._matMult(r),D._matMult(r),L._matMult(r),R._matMult(r)}const B=e.stretch+e.fixed,N=n.stretch+n.fixed;return{tl:M,tr:D,bl:L,br:R,tex:{x:a.paddedRect.x+1+B,y:a.paddedRect.y+1+N,w:o.stretch+o.fixed-B,h:l.stretch+l.fixed-N},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:F,pixelOffsetBR:O,minFontScaleX:T/s/k,minFontScaleY:E/s/A,isSDF:i}};if(n&&(a.stretchX||a.stretchY)){const e=Np(h,g,f),t=Np(d,_,m);for(let r=0;r<e.length-1;r++){const i=e[r],n=e[r+1];for(let e=0;e<t.length-1;e++)o.push(C(i,t[e],n,t[e+1]))}}else o.push(C({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:c+1}));return o}function Bp(e,t,r){let i=0;for(const n of e)i+=Math.max(t,Math.min(r,n[1]))-Math.max(t,Math.min(r,n[0]));return i}function Np(e,t,r){const i=[{fixed:-1,stretch:0}];for(const[n,o]of e){const e=i[i.length-1];i.push({fixed:n-e.stretch,stretch:e.stretch}),i.push({fixed:n-e.stretch,stretch:e.stretch+(o-n)})}return i.push({fixed:t+1,stretch:r}),i}function jp(e,t,r,i){return e/t*r+i}function Vp(e,t,r,i){return e-t*r/i}lo("Anchor",Ap);class Up{constructor(e,t,i,n,o,a,s,l,c,u){var h;if(this.boxStartIndex=e.length,c){let e=a.top,t=a.bottom;const r=a.collisionPadding;r&&(e-=r[1],t+=r[3]);let i=t-e;i>0&&(i=Math.max(10,i),this.circleDiameter=i)}else{const c=(null===(h=a.image)||void 0===h?void 0:h.content)&&(a.image.textFitWidth||a.image.textFitHeight)?Xu(a):{x1:a.left,y1:a.top,x2:a.right,y2:a.bottom};c.y1=c.y1*s-l[0],c.y2=c.y2*s+l[2],c.x1=c.x1*s-l[3],c.x2=c.x2*s+l[1];const d=a.collisionPadding;if(d&&(c.x1-=d[0]*s,c.y1-=d[1]*s,c.x2+=d[2]*s,c.y2+=d[3]*s),u){const e=new r(c.x1,c.y1),t=new r(c.x2,c.y1),i=new r(c.x1,c.y2),n=new r(c.x2,c.y2),o=u*Math.PI/180;e._rotate(o),t._rotate(o),i._rotate(o),n._rotate(o),c.x1=Math.min(e.x,t.x,i.x,n.x),c.x2=Math.max(e.x,t.x,i.x,n.x),c.y1=Math.min(e.y,t.y,i.y,n.y),c.y2=Math.max(e.y,t.y,i.y,n.y)}e.emplaceBack(t.x,t.y,c.x1,c.y1,c.x2,c.y2,i,n,o)}this.boxEndIndex=e.length}}class Gp{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 r=(this.length>>1)-1;r>=0;r--)this._down(r)}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:r}=this,i=t[e];for(;e>0;){const n=e-1>>1,o=t[n];if(r(i,o)>=0)break;t[e]=o,e=n}t[e]=i}_down(e){const{data:t,compare:r}=this,i=this.length>>1,n=t[e];for(;e<i;){let i=1+(e<<1);const o=i+1;if(o<this.length&&r(t[o],t[i])<0&&(i=o),r(t[i],n)>=0)break;t[e]=t[i],e=i}t[e]=n}}function qp(e,t=1,i=!1){const n=yp.fromPoints(e[0]),o=Math.min(n.width(),n.height());let a=o/2;const s=new Gp([],$p),{minX:l,minY:c,maxX:u,maxY:h}=n;if(0===o)return new r(l,c);for(let r=l;r<u;r+=o)for(let t=c;t<h;t+=o)s.push(new Wp(r+a,t+a,a,e));let d=function(e){let t=0,r=0,i=0;const n=e[0];for(let o=0,a=n.length,s=a-1;o<a;s=o++){const e=n[o],a=n[s],l=e.x*a.y-a.x*e.y;r+=(e.x+a.x)*l,i+=(e.y+a.y)*l,t+=3*l}return new Wp(r/t,i/t,0,e)}(e),p=s.length;for(;s.length;){const r=s.pop();(r.d>d.d||!d.d)&&(d=r,i&&console.log("found best %d after %d probes",Math.round(1e4*r.d)/1e4,p)),r.max-d.d<=t||(a=r.h/2,s.push(new Wp(r.p.x-a,r.p.y-a,a,e)),s.push(new Wp(r.p.x+a,r.p.y-a,a,e)),s.push(new Wp(r.p.x-a,r.p.y+a,a,e)),s.push(new Wp(r.p.x+a,r.p.y+a,a,e)),p+=4)}return i&&(console.log(`num probes: ${p}`),console.log(`best distance: ${d.d}`)),d.p}function $p(e,t){return t.max-e.max}function Wp(e,t,i,n){this.p=new r(e,t),this.h=i,this.d=function(e,t){let r=!1,i=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&&(r=!r),i=Math.min(i,Hs(e,n,s))}}return(r?1:-1)*Math.sqrt(i)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}var Zp;e.aO=void 0,(Zp=e.aO||(e.aO={}))[Zp.center=1]="center",Zp[Zp.left=2]="left",Zp[Zp.right=3]="right",Zp[Zp.top=4]="top",Zp[Zp.bottom=5]="bottom",Zp[Zp["top-left"]=6]="top-left",Zp[Zp["top-right"]=7]="top-right",Zp[Zp["bottom-left"]=8]="bottom-left",Zp[Zp["bottom-right"]=9]="bottom-right";const Hp=Number.POSITIVE_INFINITY;function Xp(e,t){return t[1]!==Hp?function(e,t,r){let i=0,n=0;switch(t=Math.abs(t),r=Math.abs(r),e){case"top-right":case"top-left":case"top":n=r-7;break;case"bottom-right":case"bottom-left":case"bottom":n=7-r}switch(e){case"top-right":case"bottom-right":case"right":i=-t;break;case"top-left":case"bottom-left":case"left":i=t}return[i,n]}(e,t[0],t[1]):function(e,t){let r=0,i=0;t<0&&(t=0);const n=t/Math.SQRT2;switch(e){case"top-right":case"top-left":i=n-7;break;case"bottom-right":case"bottom-left":i=7-n;break;case"bottom":i=7-t;break;case"top":i=t-7}switch(e){case"top-right":case"bottom-right":r=-n;break;case"top-left":case"bottom-left":r=n;break;case"left":r=t;break;case"right":r=-t}return[r,i]}(e,t[0])}function Yp(e,t,r){var i;const n=e.layout,o=null===(i=n.get("text-variable-anchor-offset"))||void 0===i?void 0:i.evaluate(t,{},r);if(o){const e=o.values,t=[];for(let r=0;r<e.length;r+=2){const i=t[r]=e[r],n=e[r+1].map(e=>e*lu);i.startsWith("top")?n[1]-=7:i.startsWith("bottom")&&(n[1]+=7),t[r+1]=n}return new Ot(t)}const a=n.get("text-variable-anchor");if(a){let i;i=void 0!==e._unevaluatedLayout.getValue("text-radial-offset")?[n.get("text-radial-offset").evaluate(t,{},r)*lu,Hp]:n.get("text-offset").evaluate(t,{},r).map(e=>e*lu);const o=[];for(const e of a)o.push(e,Xp(e,i));return new Ot(o)}return null}function Jp(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 Kp(t,r,i,n,o,a,s,l,c,u,h,d){let p=a.textMaxSize.evaluate(r,{});void 0===p&&(p=s);const f=t.layers[0].layout,m=f.get("icon-offset").evaluate(r,{},h),g=ef(i.horizontal),_=s/24,y=t.tilePixelRatio*_,v=t.tilePixelRatio*p/24,b=t.tilePixelRatio*l,x=t.tilePixelRatio*f.get("symbol-spacing"),w=f.get("text-padding")*t.tilePixelRatio,T=function(e,t,r,i=1){const n=e.get("icon-padding").evaluate(t,{},r),o=n&&n.values;return[o[0]*i,o[1]*i,o[2]*i,o[3]*i]}(f,r,h,t.tilePixelRatio),S=f.get("text-max-angle")/180*Math.PI,E="viewport"!==f.get("text-rotation-alignment")&&"point"!==f.get("symbol-placement"),I="map"===f.get("icon-rotation-alignment")&&"point"!==f.get("symbol-placement"),P=f.get("symbol-placement"),k=x/2,C=f.get("icon-text-fit");let M;n&&"none"!==C&&(t.allowVerticalPlacement&&i.vertical&&(M=Yu(n,i.vertical,C,f.get("icon-text-fit-padding"),m,_)),g&&(n=Yu(n,g,C,f.get("icon-text-fit-padding"),m,_)));const D=h?d.line.getGranularityForZoomLevel(h.z):1,R=(l,d)=>{d.x<0||d.x>=A||d.y<0||d.y>=A||function(t,r,i,n,o,a,s,l,c,u,h,d,p,f,m,g,_,y,v,b,x,w,T,S,E){const I=t.addToLineVertexArray(r,i);let P,k,A,C,M=0,D=0,R=0,L=0,F=-1,O=-1;const z={};let B=ds("");if(t.allowVerticalPlacement&&n.vertical){const e=l.layout.get("text-rotate").evaluate(x,{},S)+90;A=new Up(c,r,u,h,d,n.vertical,p,f,m,e),s&&(C=new Up(c,r,u,h,d,s,_,y,m,e))}if(o){const i=l.layout.get("icon-rotate").evaluate(x,{}),n="none"!==l.layout.get("icon-text-fit"),a=zp(o,i,T,n),p=s?zp(s,i,T,n):void 0;k=new Up(c,r,u,h,d,o,_,y,!1,i),M=4*a.length;const f=t.iconSizeData;let m=null;"source"===f.kind?(m=[Ju*l.layout.get("icon-size").evaluate(x,{})],m[0]>Ku&&q(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):"composite"===f.kind&&(m=[Ju*w.compositeIconSizes[0].evaluate(x,{},S),Ju*w.compositeIconSizes[1].evaluate(x,{},S)],(m[0]>Ku||m[1]>Ku)&&q(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),t.addSymbols(t.icon,a,m,b,v,x,e.ay.none,r,I.lineStartIndex,I.lineLength,-1,S),F=t.icon.placedSymbolArray.length-1,p&&(D=4*p.length,t.addSymbols(t.icon,p,m,b,v,x,e.ay.vertical,r,I.lineStartIndex,I.lineLength,-1,S),O=t.icon.placedSymbolArray.length-1)}const N=Object.keys(n.horizontal);for(const q of N){const i=n.horizontal[q];if(!P){B=ds(i.text);const e=l.layout.get("text-rotate").evaluate(x,{},S);P=new Up(c,r,u,h,d,i,p,f,m,e)}const o=1===i.positionedLines.length;if(R+=Qp(t,r,i,a,l,m,x,g,I,n.vertical?e.ay.horizontal:e.ay.horizontalOnly,o?N:[q],z,F,w,S),o)break}n.vertical&&(L+=Qp(t,r,n.vertical,a,l,m,x,g,I,e.ay.vertical,["vertical"],z,O,w,S));const j=P?P.boxStartIndex:t.collisionBoxArray.length,V=P?P.boxEndIndex:t.collisionBoxArray.length,U=A?A.boxStartIndex:t.collisionBoxArray.length,G=A?A.boxEndIndex:t.collisionBoxArray.length,$=k?k.boxStartIndex:t.collisionBoxArray.length,W=k?k.boxEndIndex:t.collisionBoxArray.length,Z=C?C.boxStartIndex:t.collisionBoxArray.length,H=C?C.boxEndIndex:t.collisionBoxArray.length;let X=-1;const Y=(e,t)=>e&&e.circleDiameter?Math.max(e.circleDiameter,t):t;X=Y(P,X),X=Y(A,X),X=Y(k,X),X=Y(C,X);const J=X>-1?1:0;J&&(X*=E/lu),t.glyphOffsetArray.length>=sh.MAX_GLYPHS&&q("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==x.sortKey&&t.addToSortKeyRanges(t.symbolInstances.length,x.sortKey);const K=Yp(l,x,S),[Q,ee]=function(t,r){const i=t.length,n=null==r?void 0:r.values;if((null==n?void 0:n.length)>0)for(let o=0;o<n.length;o+=2){const r=n[o+1];t.emplaceBack(e.aO[n[o]],r[0],r[1])}return[i,t.length]}(t.textAnchorOffsets,K);t.symbolInstances.emplaceBack(r.x,r.y,z.right>=0?z.right:-1,z.center>=0?z.center:-1,z.left>=0?z.left:-1,z.vertical||-1,F,O,B,j,V,U,G,$,W,Z,H,u,R,L,M,D,J,0,p,X,Q,ee)}(t,d,l,i,n,o,M,t.layers[0],t.collisionBoxArray,r.index,r.sourceLayerIndex,t.index,y,[w,w,w,w],E,c,b,T,I,m,r,a,u,h,s)};if("line"===P)for(const e of Tp(r.geometry,0,0,A,A)){const r=dc(e,D),o=Fp(r,x,S,i.vertical||g,n,24,v,t.overscaling,A);for(const e of o)g&&tf(t,g.text,k,e)||R(r,e)}else if("line-center"===P){for(const e of r.geometry)if(e.length>1){const t=dc(e,D),r=Lp(t,S,i.vertical||g,n,24,v);r&&R(t,r)}}else if("Polygon"===r.type)for(const e of Qr(r.geometry,0)){const t=qp(e,16);R(dc(e[0],D,!0),new Ap(t.x,t.y,0))}else if("LineString"===r.type)for(const e of r.geometry){const t=dc(e,D);R(t,new Ap(t[0].x,t[0].y,0))}else if("Point"===r.type)for(const e of r.geometry)for(const t of e)R([t],new Ap(t.x,t.y,0))}function Qp(e,t,i,n,o,a,s,l,c,u,h,d,p,f,m){const g=function(e,t,i,n,o,a,s,l){const c=n.layout.get("text-rotate").evaluate(a,{})*Math.PI/180,u=[];for(const h of t.positionedLines)for(const e of h.positionedGlyphs){if(!e.rect)continue;const n=e.rect||{};let a=4,d=!0,p=1,f=0;const m=(o||l)&&e.vertical,g=e.metrics.advance*e.scale/2;if(l&&t.verticalizable&&(f=h.lineOffset/2-(e.imageName?-(lu-e.metrics.width*e.scale)/2:(e.scale-1)*lu)),e.imageName){const t=s[e.imageName];d=t.sdf,p=t.pixelRatio,a=1/p}const _=o?[e.x+g,e.y]:[0,0];let y=o?[0,0]:[e.x+g+i[0],e.y+i[1]-f],v=[0,0];m&&(v=y,y=[0,0]);const b=e.metrics.isDoubleResolution?2:1,x=(e.metrics.left-a)*e.scale-g+y[0],w=(-e.metrics.top-a)*e.scale+y[1],T=x+n.w/b*e.scale/p,S=w+n.h/b*e.scale/p,E=new r(x,w),I=new r(T,w),P=new r(x,S),k=new r(T,S);if(m){const t=new r(-g,g- -17),i=-Math.PI/2,n=12-g,o=new r(22-n,-(e.imageName?n:0)),a=new r(...v);E._rotateAround(i,t)._add(o)._add(a),I._rotateAround(i,t)._add(o)._add(a),P._rotateAround(i,t)._add(o)._add(a),k._rotateAround(i,t)._add(o)._add(a)}if(c){const e=Math.sin(c),t=Math.cos(c),r=[t,-e,e,t];E._matMult(r),I._matMult(r),P._matMult(r),k._matMult(r)}const A=new r(0,0),C=new r(0,0);u.push({tl:E,tr:I,bl:P,br:k,tex:n,writingMode:t.writingMode,glyphOffset:_,sectionIndex:e.sectionIndex,isSDF:d,pixelOffsetTL:A,pixelOffsetBR:C,minFontScaleX:0,minFontScaleY:0})}return u}(0,i,l,o,a,s,n,e.allowVerticalPlacement),_=e.textSizeData;let y=null;"source"===_.kind?(y=[Ju*o.layout.get("text-size").evaluate(s,{})],y[0]>Ku&&q(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):"composite"===_.kind&&(y=[Ju*f.compositeTextSizes[0].evaluate(s,{},m),Ju*f.compositeTextSizes[1].evaluate(s,{},m)],(y[0]>Ku||y[1]>Ku)&&q(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),e.addSymbols(e.text,g,y,l,a,s,u,t,c.lineStartIndex,c.lineLength,p,m);for(const r of h)d[r]=e.text.placedSymbolArray.length-1;return 4*g.length}function ef(e){for(const t in e)return e[t];return null}function tf(e,t,r,i){const n=e.compareText;if(t in n){const e=n[t];for(let t=e.length-1;t>=0;t--)if(i.dist(e[t])<r)return!0}else n[t]=[];return n[t].push(i),!1}const rf=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class nf{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[t,r]=new Uint8Array(e,0,2);if(219!==t)throw new Error("Data does not appear to be in a KDBush format.");const i=r>>4;if(1!==i)throw new Error(`Got v${i} data when expected v1.`);const n=rf[15&r];if(!n)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(e,2,1),[a]=new Uint32Array(e,4,1);return new nf(a,o,n,e)}constructor(e,t=64,r=Float64Array,i){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=r,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const n=rf.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: ${r}.`);i&&i instanceof ArrayBuffer?(this.data=i,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 r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=e,this.coords[this._pos++]=t,r}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return of(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,r,i){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<=r&&c>=t&&c<=i&&l.push(n[a])}continue}const d=h+u>>1,p=o[2*d],f=o[2*d+1];p>=e&&p<=r&&f>=t&&f<=i&&l.push(n[d]),(0===c?e<=p:t<=f)&&(s.push(h),s.push(d-1),s.push(1-c)),(0===c?r>=p:i>=f)&&(s.push(d+1),s.push(u),s.push(1-c))}return l}within(e,t,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:n,nodeSize:o}=this,a=[0,i.length-1,0],s=[],l=r*r;for(;a.length;){const c=a.pop()||0,u=a.pop()||0,h=a.pop()||0;if(u-h<=o){for(let r=h;r<=u;r++)cf(n[2*r],n[2*r+1],e,t)<=l&&s.push(i[r]);continue}const d=h+u>>1,p=n[2*d],f=n[2*d+1];cf(p,f,e,t)<=l&&s.push(i[d]),(0===c?e-r<=p:t-r<=f)&&(a.push(h),a.push(d-1),a.push(1-c)),(0===c?e+r>=p:t+r>=f)&&(a.push(d+1),a.push(u),a.push(1-c))}return s}}function of(e,t,r,i,n,o){if(n-i<=r)return;const a=i+n>>1;af(e,t,a,i,n,o),of(e,t,r,i,a-1,1-o),of(e,t,r,a+1,n,1-o)}function af(e,t,r,i,n,o){for(;n>i;){if(n-i>600){const a=n-i+1,s=r-i+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);af(e,t,r,Math.max(i,Math.floor(r-s*c/a+u)),Math.min(n,Math.floor(r+(a-s)*c/a+u)),o)}const a=t[2*r+o];let s=i,l=n;for(sf(e,t,i,r),t[2*n+o]>a&&sf(e,t,i,n);s<l;){for(sf(e,t,s,l),s++,l--;t[2*s+o]<a;)s++;for(;t[2*l+o]>a;)l--}t[2*i+o]===a?sf(e,t,i,l):(l++,sf(e,t,l,n)),l<=r&&(i=l+1),r<=l&&(n=l-1)}}function sf(e,t,r,i){lf(e,r,i),lf(t,2*r,2*i),lf(t,2*r+1,2*i+1)}function lf(e,t,r){const i=e[t];e[t]=e[r],e[r]=i}function cf(e,t,r,i){const n=e-r,o=t-i;return n*n+o*o}var uf;e.cG=void 0,(uf=e.cG||(e.cG={})).create="create",uf.load="load",uf.fullLoad="fullLoad";let hf=null,df=[];const pf=1e3/60,ff="loadTime",mf="fullLoadTime",gf={mark(e){performance.mark(e)},frame(e){const t=e;null!=hf&&df.push(t-hf),hf=t},clearMetrics(){hf=null,df=[],performance.clearMeasures(ff),performance.clearMeasures(mf);for(const t in e.cG)performance.clearMarks(e.cG[t])},getPerformanceMetrics(){performance.measure(ff,e.cG.create,e.cG.load),performance.measure(mf,e.cG.create,e.cG.fullLoad);const t=performance.getEntriesByName(ff)[0].duration,r=performance.getEntriesByName(mf)[0].duration,i=df.length,n=1/(df.reduce((e,t)=>e+t,0)/i/1e3),o=df.filter(e=>e>pf).reduce((e,t)=>e+(t-pf)/pf,0);return{loadTime:t,fullLoadTime:r,fps:n,percentDroppedFrames:o/(i+o)*100,totalFrames:i}}};e.$=h,e.A=p,e.B=oo,e.C=eo,e.D=Vo,e.E=_e,e.F=function([e,t,r]){return t+=90,t*=Math.PI/180,r*=Math.PI/180,{x:e*Math.cos(t)*Math.sin(r),y:e*Math.sin(t)*Math.sin(r),z:e*Math.cos(r)}},e.G=fr,e.H=Co,e.I=zu,e.J=ro,e.K=function(e){if(null==Z){const t=e.navigator?e.navigator.userAgent:null;Z=!!e.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return Z},e.L=class{constructor(e,t){this.target=e,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new _h(()=>this.process()),this.subscription=Q(this.target,"message",e=>this.receive(e),!1),this.globalScope=W(self)?e:window}registerMessageHandler(e,t){this.messageHandlers[e]=t}unregisterMessageHandler(e){delete this.messageHandlers[e]}sendAsync(e,t){return new Promise((r,i)=>{const n=Math.round(1e18*Math.random()).toString(36).substring(0,10),o=t?Q(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)},yh):null;this.resolveRejects[n]={resolve:e=>{null==o||o.unsubscribe(),r(e)},reject:e=>{null==o||o.unsubscribe(),i(e)}};const a=[],s=Object.assign(Object.assign({},e),{id:n,sourceMapId:this.mapId,origin:location.origin,data:po(e.data,a)});this.target.postMessage(s,{transfer:a})})}receive(e){const t=e.data,r=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[r];const e=this.abortControllers[r];return delete this.abortControllers[r],void(e&&e.abort())}if(W(self)||t.mustQueue)return this.tasks[r]=t,this.taskQueue.push(r),void this.invoker.trigger();this.processTask(r,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,r){return t(this,void 0,void 0,function*(){if("<response>"===r.type){const t=this.resolveRejects[e];if(delete this.resolveRejects[e],!t)return;return void(r.error?t.reject(fo(r.error)):t.resolve(fo(r.data)))}if(!this.messageHandlers[r.type])return void this.completeTask(e,new Error(`Could not find a registered handler for ${r.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const t=fo(r.data),i=new AbortController;this.abortControllers[e]=i;try{const n=yield this.messageHandlers[r.type](r.sourceMapId,t,i);this.completeTask(e,null,n)}catch(t){this.completeTask(e,t)}})}completeTask(e,t,r){const i=[];delete this.abortControllers[e];const n={id:e,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?po(t):null,data:po(r,i)};this.target.postMessage(n,{transfer:i})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},e.M=le,e.N=function(){var e=new p(16);return p!=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.O=function(e,t,r){var i,n,o,a,s,l,c,u,h,d,p,f,m=r[0],g=r[1],_=r[2];return t===e?(e[12]=t[0]*m+t[4]*g+t[8]*_+t[12],e[13]=t[1]*m+t[5]*g+t[9]*_+t[13],e[14]=t[2]*m+t[6]*g+t[10]*_+t[14],e[15]=t[3]*m+t[7]*g+t[11]*_+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],d=t[9],p=t[10],f=t[11],e[0]=i=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]=d,e[10]=p,e[11]=f,e[12]=i*m+s*g+h*_+t[12],e[13]=n*m+l*g+d*_+t[13],e[14]=o*m+c*g+p*_+t[14],e[15]=a*m+u*g+f*_+t[15]),e},e.P=r,e.Q=function(e,t,r){var i=r[0],n=r[1],o=r[2];return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,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.R=yl,e.S=function(e,t,r){var i=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],d=t[9],p=t[10],f=t[11],m=t[12],g=t[13],_=t[14],y=t[15],v=r[0],b=r[1],x=r[2],w=r[3];return e[0]=v*i+b*s+x*h+w*m,e[1]=v*n+b*l+x*d+w*g,e[2]=v*o+b*c+x*p+w*_,e[3]=v*a+b*u+x*f+w*y,e[4]=(v=r[4])*i+(b=r[5])*s+(x=r[6])*h+(w=r[7])*m,e[5]=v*n+b*l+x*d+w*g,e[6]=v*o+b*c+x*p+w*_,e[7]=v*a+b*u+x*f+w*y,e[8]=(v=r[8])*i+(b=r[9])*s+(x=r[10])*h+(w=r[11])*m,e[9]=v*n+b*l+x*d+w*g,e[10]=v*o+b*c+x*p+w*_,e[11]=v*a+b*u+x*f+w*y,e[12]=(v=r[12])*i+(b=r[13])*s+(x=r[14])*h+(w=r[15])*m,e[13]=v*n+b*l+x*d+w*g,e[14]=v*o+b*c+x*p+w*_,e[15]=v*a+b*u+x*f+w*y,e},e.T=Pl,e.U=function(e,t){const r={};for(let i=0;i<t.length;i++){const n=t[i];n in e&&(r[n]=e[n])}return r},e.V=bh,e.W=z,e.X=Sh,e.Y=Th,e.Z=u,e._=t,e.a=ae,e.a$=v,e.a0=Y,e.a1=Rh,e.a2=Ih,e.a3=Ph,e.a4=A,e.a5=function(e,t,r){if(!e)return t||{};if(!t)return e||{};const i=zh(e),n=zh(t);!function(e,t){t.removeAll&&(e.add.clear(),e.update.clear(),e.remove.clear(),t.remove.clear());for(const r of t.remove)e.add.delete(r),e.update.delete(r);for(const[r,i]of t.update){const n=e.update.get(r);n&&(t.update.set(r,Oh(n,i)),e.update.delete(r))}}(i,n);const o={};if((i.removeAll||n.removeAll)&&(o.removeAll=!0),o.remove=new Set([...i.remove,...n.remove]),o.add=new Map([...i.add,...n.add]),o.update=new Map([...i.update,...n.update]),o.remove.size&&o.add.size)for(const a of o.add.keys())o.remove.delete(a);return function(e){const t={};return e.removeAll&&(t.removeAll=e.removeAll),e.remove&&(t.remove=Array.from(e.remove)),e.add&&(t.add=Array.from(e.add.values())),e.update&&(t.update=Array.from(e.update.values())),t}(o)},e.a6=function(e,t){if(null==e)return!0;if("Feature"===e.type)return null!=Fh(e,t);if("FeatureCollection"===e.type){const r=new Set;for(const i of e.features){const e=Fh(i,t);if(null==e)return!1;if(r.has(e))return!1;r.add(e)}return!0}return!1},e.a7=function(e,t){const r=new Map;if(null==e);else if("Feature"===e.type)r.set(Fh(e,t),e);else for(const i of e.features)r.set(Fh(i,t),i);return r},e.a8=function(e,t,r){var i,n;if(t.removeAll)e.clear();else if(t.remove)for(const o of t.remove)e.delete(o);if(t.add)for(const o of t.add){const t=Fh(o,r);null!=t&&e.set(t,o)}if(t.update)for(const o of t.update){let t=e.get(o.id);if(!t)continue;const r=!!o.newGeometry,a=o.removeAllProperties||(null===(i=o.removeProperties)||void 0===i?void 0:i.length)>0||(null===(n=o.addOrUpdateProperties)||void 0===n?void 0:n.length)>0;if((r||a)&&(t=Object.assign({},t),e.set(o.id,t),r&&(t.geometry=o.newGeometry),a)){if(t.properties=o.removeAllProperties?{}:Object.assign({},t.properties||{}),o.removeProperties)for(const e of o.removeProperties)delete t.properties[e];if(o.addOrUpdateProperties)for(const{key:e,value:r}of o.addOrUpdateProperties)t.properties[e]=r}}},e.a9=vp,e.aA=function(e,t){var r=t[0],i=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],d=t[10],p=t[11],f=t[12],m=t[13],g=t[14],_=t[15],y=r*s-i*a,v=r*l-n*a,b=r*c-o*a,x=i*l-n*s,w=i*c-o*s,T=n*c-o*l,S=u*m-h*f,E=u*g-d*f,I=u*_-p*f,P=h*g-d*m,k=h*_-p*m,A=d*_-p*g,C=y*A-v*k+b*P+x*I-w*E+T*S;return C?(e[0]=(s*A-l*k+c*P)*(C=1/C),e[1]=(n*k-i*A-o*P)*C,e[2]=(m*T-g*w+_*x)*C,e[3]=(d*w-h*T-p*x)*C,e[4]=(l*I-a*A-c*E)*C,e[5]=(r*A-n*I+o*E)*C,e[6]=(g*b-f*T-_*v)*C,e[7]=(u*T-d*b+p*v)*C,e[8]=(a*k-s*I+c*S)*C,e[9]=(i*I-r*k-o*S)*C,e[10]=(f*w-m*b+_*y)*C,e[11]=(h*b-u*w-p*y)*C,e[12]=(s*E-a*P-l*S)*C,e[13]=(r*P-i*E+n*S)*C,e[14]=(m*v-f*x-g*y)*C,e[15]=(u*x-h*v+d*y)*C,e):null},e.aB=P,e.aC=function(e){var t=e[0],r=e[1];return Math.sqrt(t*t+r*r)},e.aD=function(e){return e[0]=0,e[1]=0,e},e.aE=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e},e.aF=ih,e.aG=S,e.aH=function(e,t,i,n){const o=t.y-e.y,a=t.x-e.x,s=n.y-i.y,l=n.x-i.x,c=s*a-l*o;if(0===c)return null;const u=(l*(e.y-i.y)-s*(e.x-i.x))/c;return new r(e.x+u*a,e.y+u*o)},e.aI=Tp,e.aJ=Vs,e.aK=function(e){let t=1/0,r=1/0,i=-1/0,n=-1/0;for(const o of e)t=Math.min(t,o.x),r=Math.min(r,o.y),i=Math.max(i,o.x),n=Math.max(n,o.y);return[t,r,i,n]},e.aL=lu,e.aM=C,e.aN=function(e,t,r,i,n=!1){if(!r[0]&&!r[1])return[0,0];const o=n?"map"===i?-e.bearingInRadians:0:"viewport"===i?e.bearingInRadians:0;if(o){const e=Math.sin(o),t=Math.cos(o);r=[r[0]*t-r[1]*e,r[0]*e+r[1]*t]}return[n?r[0]:C(t,r[0],e.zoom),n?r[1]:C(t,r[1],e.zoom)]},e.aP=eh,e.aQ=Jp,e.aR=Vu,e.aS=nf,e.aT=ea,e.aU=sc,e.aV=Ba,e.aW=ts,e.aX=Ja,e.aY=te,e.aZ=kh,e.a_=b,e.aa=Ah,e.ab=yp,e.ac=25,e.ad=Mh,e.ae=e=>{const t=window.document.createElement("video");return t.muted=!0,new Promise(r=>{t.onloadstart=()=>{r(t)};for(const i of e){const e=window.document.createElement("source");de(i)||(t.crossOrigin="Anonymous"),e.src=i,t.appendChild(e)}})},e.af=Ce,e.ag=function(){return N++},e.ah=Pa,e.ai=sh,e.aj=dn,e.ak=zs,e.al=Nh,e.am=function(e){const t={};if(e.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(e,r,i,n)=>{const o=i||n;return t[r]=!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.an=O,e.ao=85.051129,e.ap=ee,e.aq=function(e){return Math.pow(2,e)},e.ar=m,e.as=Eh,e.at=function(e){return Math.log(e)/Math.LN2},e.au=function(e){var t=e[0],r=e[1];return t*t+r*r},e.av=class{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,r){const i=e.wrapped().key;void 0===this.data[i]&&(this.data[i]=[]);const n={value:t,timeout:void 0};if(void 0!==r&&(n.timeout=setTimeout(()=>{this.remove(e,n)},r)),this.data[i].push(n),this.order.push(i),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 r=e.wrapped().key,i=void 0===t?0:this.data[r].indexOf(t),n=this.data[r][i];return this.data[r].splice(i,1),n.timeout&&clearTimeout(n.timeout),0===this.data[r].length&&delete this.data[r],this.onRemove(n.value),this.order.splice(this.order.indexOf(r),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 r in this.data)for(const i of this.data[r])e(i.value)||t.push(i);for(const r of t)this.remove(r.value.tileID,r)}},e.aw=function(e){if(!e.length)return new Set;const t=Math.max(...e.map(e=>e.canonical.z));let r=1/0,i=-1/0,n=1/0,o=-1/0;const a=[];for(const l of e){const{x:e,y:s,z:c}=l.canonical,u=Math.pow(2,t-c),h=e*u,d=s*u;a.push({id:l,x:h,y:d}),h<r&&(r=h),h>i&&(i=h),d<n&&(n=d),d>o&&(o=d)}const s=new Set;for(const l of a)l.x!==r&&l.x!==i&&l.y!==n&&l.y!==o||s.add(l.id);return s},e.ax=function(e,t){let r=0,i=0;if("constant"===e.kind)i=e.layoutSize;else if("source"!==e.kind){const{interpolationType:n,minZoom:o,maxZoom:a}=e,s=n?O(dr.interpolationFactor(n,t,o,a),0,1):0;"camera"===e.kind?i=fr.number(e.minSize,e.maxSize,s):r=s}return{uSizeT:r,uSize:i}},e.az=function(e,{uSize:t,uSizeT:r},{lowerSize:i,upperSize:n}){return"source"===e.kind?i/Ju:"composite"===e.kind?fr.number(i/Ju,n/Ju,r):t},e.b=H,e.b$=class extends _s{constructor(e,t){super(e,t),this.current=xs}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.b0=function(e){var t=new p(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},e.b1=function(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e},e.b2=function(e,t){var r=t[0],i=t[1],n=t[2],o=r*r+i*i+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.b3=x,e.b4=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},e.b5=function(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e[3]=t[3]*r[3],e},e.b6=_,e.b7=function(e,t,r){const i=t[0]*r[0]+t[1]*r[1]+t[2]*r[2];return 0===i?null:(-(e[0]*r[0]+e[1]*r[1]+e[2]*r[2])-r[3])/i},e.b8=T,e.b9=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e},e.bA=I,e.bB=function(e,t,r){var i=r[0],n=r[1],o=r[2],a=r[3],s=t[0],l=t[1],c=t[2],u=n*c-o*l,h=o*s-i*c,d=i*l-n*s;return e[0]=s+a*(u+=u)+n*(d+=d)-o*(h+=h),e[1]=l+a*h+o*u-i*d,e[2]=c+a*d+i*h-n*u,e},e.bC=function(e,t,r){const i=(n=[e[0],e[1],e[2],t[0],t[1],t[2],r[0],r[1],r[2]])[0]*((u=n[8])*(a=n[4])-(s=n[5])*(c=n[7]))+n[1]*(-u*(o=n[3])+s*(l=n[6]))+n[2]*(c*o-a*l);var n,o,a,s,l,c,u;if(0===i)return null;const h=x([],[t[0],t[1],t[2]],[r[0],r[1],r[2]]),d=x([],[r[0],r[1],r[2]],[e[0],e[1],e[2]]),p=x([],[e[0],e[1],e[2]],[t[0],t[1],t[2]]),f=b([],h,-e[3]);return v(f,f,b([],d,-t[3])),v(f,f,b([],p,-r[3])),b(f,f,1/i),f},e.bD=vh,e.bE=function(){return new Float64Array(4)},e.bF=function(e,t,r,i){var n=[],o=[];return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],o[0]=n[0]*Math.cos(i)-n[1]*Math.sin(i),o[1]=n[0]*Math.sin(i)+n[1]*Math.cos(i),o[2]=n[2],e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e},e.bG=function(e,t,r,i){var n=[],o=[];return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],o[0]=n[0],o[1]=n[1]*Math.cos(i)-n[2]*Math.sin(i),o[2]=n[1]*Math.sin(i)+n[2]*Math.cos(i),e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e},e.bH=function(e,t,r,i){var n=[],o=[];return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],o[0]=n[2]*Math.sin(i)+n[0]*Math.cos(i),o[1]=n[1],o[2]=n[2]*Math.cos(i)-n[0]*Math.sin(i),e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e},e.bI=function(e,t,r){var i=Math.sin(r),n=Math.cos(r),o=t[0],a=t[1],s=t[2],l=t[3],c=t[8],u=t[9],h=t[10],d=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*n-c*i,e[1]=a*n-u*i,e[2]=s*n-h*i,e[3]=l*n-d*i,e[8]=o*i+c*n,e[9]=a*i+u*n,e[10]=s*i+h*n,e[11]=l*i+d*n,e},e.bJ=function(e,t){const r=M(e,360),i=M(t,360),n=i-r,o=i>r?n-360:n+360;return Math.abs(n)<Math.abs(o)?n:o},e.bK=function(e){return e[0]=0,e[1]=0,e[2]=0,e},e.bL=function(e,t,r,i){const n=Math.sqrt(e*e+t*t),o=Math.sqrt(r*r+i*i);e/=n,t/=n,r/=o,i/=o;const a=Math.acos(e*r+t*i);return-t*r+e*i>0?a:-a},e.bM=function(e,t){const r=M(e,2*Math.PI),i=M(t,2*Math.PI);return Math.min(Math.abs(r-i),Math.abs(r-i+2*Math.PI),Math.abs(r-i-2*Math.PI))},e.bN=function(){const e={},t=ye.$version;for(const r in ye.$root){const i=ye.$root[r];if(i.required){let n=null;n="version"===r?t:"array"===i.type?[]:{},null!=n&&(e[r]=n)}}return e},e.bO=ue,e.bP=mo,e.bQ=function e(t,r){if(Array.isArray(t)){if(!Array.isArray(r)||t.length!==r.length)return!1;for(let i=0;i<t.length;i++)if(!e(t[i],r[i]))return!1;return!0}if("object"==typeof t&&null!==t&&null!==r){if("object"!=typeof r)return!1;if(Object.keys(t).length!==Object.keys(r).length)return!1;for(const i in t)if(!e(t[i],r[i]))return!1;return!0}return t===r},e.bR=function(e){e=e.slice();const t=Object.create(null);for(let r=0;r<e.length;r++)t[e[r].id]=e[r];for(let r=0;r<e.length;r++)"ref"in e[r]&&(e[r]=be(e[r],t[e[r].ref]));return e},e.bS=function(e,t){if("custom"===e.type)return new gh(e,t);switch(e.type){case"background":return new mh(e,t);case"circle":return new ul(e,t);case"color-relief":return new Cl(e,t);case"fill":return new bc(e,t);case"fill-extrusion":return new Nc(e,t);case"heatmap":return new xl(e,t);case"hillshade":return new Sl(e,t);case"line":return new eu(e,t);case"raster":return new Yo(e,t);case"symbol":return new dh(e,t)}},e.bT=e=>"raster"===e.type,e.bU=U,e.bV=function(e,t){if(!e)return[{command:"setStyle",args:[t]}];let r=[];try{if(!xe(e.version,t.version))return[{command:"setStyle",args:[t]}];xe(e.center,t.center)||r.push({command:"setCenter",args:[t.center]}),xe(e.state,t.state)||r.push({command:"setGlobalState",args:[t.state]}),xe(e.centerAltitude,t.centerAltitude)||r.push({command:"setCenterAltitude",args:[t.centerAltitude]}),xe(e.zoom,t.zoom)||r.push({command:"setZoom",args:[t.zoom]}),xe(e.bearing,t.bearing)||r.push({command:"setBearing",args:[t.bearing]}),xe(e.pitch,t.pitch)||r.push({command:"setPitch",args:[t.pitch]}),xe(e.roll,t.roll)||r.push({command:"setRoll",args:[t.roll]}),xe(e.sprite,t.sprite)||r.push({command:"setSprite",args:[t.sprite]}),xe(e.glyphs,t.glyphs)||r.push({command:"setGlyphs",args:[t.glyphs]}),xe(e.transition,t.transition)||r.push({command:"setTransition",args:[t.transition]}),xe(e.light,t.light)||r.push({command:"setLight",args:[t.light]}),xe(e.terrain,t.terrain)||r.push({command:"setTerrain",args:[t.terrain]}),xe(e.sky,t.sky)||r.push({command:"setSky",args:[t.sky]}),xe(e.projection,t.projection)||r.push({command:"setProjection",args:[t.projection]});const i={},n=[];!function(e,t,r,i){let n;for(n in t=t||{},e=e||{})Object.prototype.hasOwnProperty.call(e,n)&&(Object.prototype.hasOwnProperty.call(t,n)||Se(n,r,i));for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&(Object.prototype.hasOwnProperty.call(e,n)?xe(e[n],t[n])||("geojson"===e[n].type&&"geojson"===t[n].type&&Ie(e,t,n)?we(r,{command:"setGeoJSONSourceData",args:[n,t[n].data]}):Ee(n,t,r,i)):Te(n,t,r))}(e.sources,t.sources,n,i);const o=[];e.layers&&e.layers.forEach(e=>{"source"in e&&i[e.source]?r.push({command:"removeLayer",args:[e.id]}):o.push(e)}),r=r.concat(n),function(e,t,r){t=t||[];const i=(e=e||[]).map(ke),n=t.map(ke),o=e.reduce(Ae,{}),a=t.reduce(Ae,{}),s=i.slice(),l=Object.create(null);let c,u,h,d,p;for(let f=0,m=0;f<i.length;f++)c=i[f],Object.prototype.hasOwnProperty.call(a,c)?m++:(we(r,{command:"removeLayer",args:[c]}),s.splice(s.indexOf(c,m),1));for(let f=0,m=0;f<n.length;f++)c=n[n.length-1-f],s[s.length-1-f]!==c&&(Object.prototype.hasOwnProperty.call(o,c)?(we(r,{command:"removeLayer",args:[c]}),s.splice(s.lastIndexOf(c,s.length-m),1)):m++,d=s[s.length-f],we(r,{command:"addLayer",args:[a[c],d]}),s.splice(s.length-f,0,c),l[c]=!0);for(let f=0;f<n.length;f++)if(c=n[f],u=o[c],h=a[c],!l[c]&&!xe(u,h))if(xe(u.source,h.source)&&xe(u["source-layer"],h["source-layer"])&&xe(u.type,h.type)){for(p in Pe(u.layout,h.layout,r,c,null,"setLayoutProperty"),Pe(u.paint,h.paint,r,c,null,"setPaintProperty"),xe(u.filter,h.filter)||we(r,{command:"setFilter",args:[c,h.filter]}),xe(u.minzoom,h.minzoom)&&xe(u.maxzoom,h.maxzoom)||we(r,{command:"setLayerZoomRange",args:[c,h.minzoom,h.maxzoom]}),u)Object.prototype.hasOwnProperty.call(u,p)&&"layout"!==p&&"paint"!==p&&"filter"!==p&&"metadata"!==p&&"minzoom"!==p&&"maxzoom"!==p&&(0===p.indexOf("paint.")?Pe(u[p],h[p],r,c,p.slice(6),"setPaintProperty"):xe(u[p],h[p])||we(r,{command:"setLayerProperty",args:[c,p,h[p]]}));for(p in h)Object.prototype.hasOwnProperty.call(h,p)&&!Object.prototype.hasOwnProperty.call(u,p)&&"layout"!==p&&"paint"!==p&&"filter"!==p&&"metadata"!==p&&"minzoom"!==p&&"maxzoom"!==p&&(0===p.indexOf("paint.")?Pe(u[p],h[p],r,c,p.slice(6),"setPaintProperty"):xe(u[p],h[p])||we(r,{command:"setLayerProperty",args:[c,p,h[p]]}))}else we(r,{command:"removeLayer",args:[c]}),d=s[s.lastIndexOf(c)+1],we(r,{command:"addLayer",args:[h,d]})}(o,t.layers,r)}catch(e){console.warn("Unable to compute style diff:",e),r=[{command:"setStyle",args:[t]}]}return r},e.bW=function(e){const t=[],r=e.id;return void 0===r&&t.push({message:`layers.${r}: missing required property "id"`}),void 0===e.render&&t.push({message:`layers.${r}: missing required method "render"`}),e.renderingMode&&"2d"!==e.renderingMode&&"3d"!==e.renderingMode&&t.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),t},e.bX=j,e.bY=V,e.bZ=class extends _s{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1i(this.location,e))}},e.b_=bs,e.ba=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]},e.bb=Dh,e.bc=Lh,e.bd=function(e,t,r,i,n){var o=1/Math.tan(t/2);if(e[0]=o/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,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){var a=1/(i-n);e[10]=(n+i)*a,e[14]=2*n*i*a}else e[10]=-1,e[14]=-2*i;return e},e.be=function(e){var t=new p(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.bf=function(e,t,r){var i=Math.sin(r),n=Math.cos(r),o=t[0],a=t[1],s=t[2],l=t[3],c=t[4],u=t[5],h=t[6],d=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*n+c*i,e[1]=a*n+u*i,e[2]=s*n+h*i,e[3]=l*n+d*i,e[4]=c*n-o*i,e[5]=u*n-a*i,e[6]=h*n-s*i,e[7]=d*n-l*i,e},e.bg=function(e,t,r){var i=Math.sin(r),n=Math.cos(r),o=t[4],a=t[5],s=t[6],l=t[7],c=t[8],u=t[9],h=t[10],d=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=o*n+c*i,e[5]=a*n+u*i,e[6]=s*n+h*i,e[7]=l*n+d*i,e[8]=c*n-o*i,e[9]=u*n-a*i,e[10]=h*n-s*i,e[11]=d*n-l*i,e},e.bh=function(){const e=new Float32Array(16);return m(e),e},e.bi=function(){const e=new Float64Array(16);return m(e),e},e.bj=function(){return new Float64Array(16)},e.bk=function(e,t,r){const i=new Float64Array(4);return I(i,e,t-90,r),i},e.bl=function(e,t,r,i){var n,o,a,s,l,c=t[0],u=t[1],h=t[2],p=t[3],f=r[0],m=r[1],g=r[2],_=r[3];return(o=c*f+u*m+h*g+p*_)<0&&(o=-o,f=-f,m=-m,g=-g,_=-_),1-o>d?(n=Math.acos(o),a=Math.sin(n),s=Math.sin((1-i)*n)/a,l=Math.sin(i*n)/a):(s=1-i,l=i),e[0]=s*c+l*f,e[1]=s*u+l*m,e[2]=s*h+l*g,e[3]=s*p+l*_,e},e.bm=function(e){const t=new Float64Array(9);var r,i,n,o,a,s,l,c,u,h,d,p,f,m,g,_,y,v;h=(n=(i=e)[0])*(l=n+n),d=(o=i[1])*l,f=(a=i[2])*l,m=a*(c=o+o),_=(s=i[3])*l,y=s*c,v=s*(u=a+a),(r=t)[0]=1-(p=o*c)-(g=a*u),r[3]=d-v,r[6]=f+y,r[1]=d+v,r[4]=1-h-g,r[7]=m-_,r[2]=f-y,r[5]=m+_,r[8]=1-h-p;const b=te(-Math.asin(O(t[2],-1,1)));let x,w;return Math.hypot(t[5],t[8])<.001?(x=0,w=-te(Math.atan2(t[3],t[4]))):(x=te(0===t[5]&&0===t[8]?0:Math.atan2(t[5],t[8])),w=te(0===t[1]&&0===t[0]?0:Math.atan2(t[1],t[0]))),{roll:x,pitch:b+90,bearing:w}},e.bn=function(e,t){return e.roll==t.roll&&e.pitch==t.pitch&&e.bearing==t.bearing},e.bo=It,e.bp=ys,e.bq=lc,e.br=cc,e.bs=ac,e.bt=D,e.bu=R,e.bv=Bt,e.bw=function(e,t,r,i,n){return D(i,n,O((e-t)/(r-t),0,1))},e.bx=M,e.by=function(){return new Float64Array(3)},e.bz=function(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e},e.c=oe,e.c$=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.c0=vs,e.c1=class extends _s{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.c2=class extends _s{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.c3=f,e.c4=function(e,t){var r=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=r,e[2]=0,e[3]=-r,e[4]=i,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},e.c5=function(e,t,r){var i=t[0],n=t[1],o=t[2];return e[0]=i*r[0]+n*r[3]+o*r[6],e[1]=i*r[1]+n*r[4]+o*r[7],e[2]=i*r[2]+n*r[5]+o*r[8],e},e.c6=function(e,t,r,i,n,o,a){var s=1/(t-r),l=1/(i-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+r)*s,e[13]=(n+i)*l,e[14]=(a+o)*c,e[15]=1,e},e.c7=class extends _s{constructor(e,t){super(e,t),this.current=new Array}set(e){if(e!=this.current){this.current=e;const t=new Float32Array(4*e.length);for(let r=0;r<e.length;r++)t[4*r]=e[r].r,t[4*r+1]=e[r].g,t[4*r+2]=e[r].b,t[4*r+3]=e[r].a;this.gl.uniform4fv(this.location,t)}}},e.c8=class extends _s{constructor(e,t){super(e,t),this.current=new Array}set(e){if(e!=this.current){this.current=e;const t=new Float32Array(e);this.gl.uniform1fv(this.location,t)}}},e.c9=class extends ma{},e.cA=function(e){return re[e]||ie[e]},e.cB=function(e,t,r){var i=t[0],n=t[1];return e[0]=r[0]*i+r[4]*n+r[12],e[1]=r[1]*i+r[5]*n+r[13],e},e.cC=function(e,t){const{x:r,y:i}=Ah.fromLngLat(t);return!(e<0||e>25||i<0||i>=1||r<0||r>=1)},e.cD=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.cE=class extends ia{},e.cF=gf,e.cH=function(e){return e.message===ne},e.cI=ce,e.cJ=function(e,t){ae.REGISTERED_PROTOCOLS[e]=t},e.cK=function(e){delete ae.REGISTERED_PROTOCOLS[e]},e.cL=function(e,t){const r={};for(let n=0;n<e.length;n++){const i=t&&t[e[n].id]||xn(e[n]);t&&(t[e[n].id]=i);let o=r[i];o||(o=r[i]=[]),o.push(e[n])}const i=[];for(const n in r)i.push(r[n]);return i},e.cM=lo,e.cN=Bh,e.cO=bp,e.cP=Bu,e.cQ=function(t){t.bucket.createArrays(),t.bucket.tilePixelRatio=A/(512*t.bucket.overscaling),t.bucket.compareText={},t.bucket.iconsNeedLinear=!1;const r=t.bucket.layers[0],i=r.layout,n=r._unevaluatedLayout._values,o={layoutIconSize:n["icon-size"].possiblyEvaluate(new Co(t.bucket.zoom+1),t.canonical),layoutTextSize:n["text-size"].possiblyEvaluate(new Co(t.bucket.zoom+1),t.canonical),textMaxSize:n["text-size"].possiblyEvaluate(new Co(18))};if("composite"===t.bucket.textSizeData.kind){const{minZoom:e,maxZoom:r}=t.bucket.textSizeData;o.compositeTextSizes=[n["text-size"].possiblyEvaluate(new Co(e),t.canonical),n["text-size"].possiblyEvaluate(new Co(r),t.canonical)]}if("composite"===t.bucket.iconSizeData.kind){const{minZoom:e,maxZoom:r}=t.bucket.iconSizeData;o.compositeIconSizes=[n["icon-size"].possiblyEvaluate(new Co(e),t.canonical),n["icon-size"].possiblyEvaluate(new Co(r),t.canonical)]}const a=i.get("text-line-height")*lu,s="viewport"!==i.get("text-rotation-alignment")&&"point"!==i.get("symbol-placement"),l=i.get("text-keep-upright"),c=i.get("text-size");for(const u of t.bucket.features){const n=i.get("text-font").evaluate(u,{},t.canonical).join(","),h=c.evaluate(u,{},t.canonical),d=o.layoutTextSize.evaluate(u,{},t.canonical),p=o.layoutIconSize.evaluate(u,{},t.canonical),f={horizontal:{},vertical:void 0},m=u.text;let g,_=[0,0];if(m){const o=m.toString(),c=i.get("text-letter-spacing").evaluate(u,{},t.canonical)*lu,p=bo(o)?c:0,g=i.get("text-anchor").evaluate(u,{},t.canonical),y=Yp(r,u,t.canonical);if(!y){const e=i.get("text-radial-offset").evaluate(u,{},t.canonical);_=e?Xp(g,[e*lu,Hp]):i.get("text-offset").evaluate(u,{},t.canonical).map(e=>e*lu)}let v=s?"center":i.get("text-justify").evaluate(u,{},t.canonical);const b="point"===i.get("symbol-placement")?i.get("text-max-width").evaluate(u,{},t.canonical)*lu:1/0,x=()=>{t.bucket.allowVerticalPlacement&&vo(o)&&(f.vertical=ju(m,t.glyphMap,t.glyphPositions,t.imagePositions,n,b,a,g,"left",p,_,e.ay.vertical,!0,d,h))};if(!s&&y){const r=new Set;if("auto"===v)for(let e=0;e<y.values.length;e+=2)r.add(Jp(y.values[e]));else r.add(v);let i=!1;for(const o of r)if(!f.horizontal[o])if(i)f.horizontal[o]=f.horizontal[0];else{const r=ju(m,t.glyphMap,t.glyphPositions,t.imagePositions,n,b,a,"center",o,p,_,e.ay.horizontal,!1,d,h);r&&(f.horizontal[o]=r,i=1===r.positionedLines.length)}x()}else{"auto"===v&&(v=Jp(g));const r=ju(m,t.glyphMap,t.glyphPositions,t.imagePositions,n,b,a,g,v,p,_,e.ay.horizontal,!1,d,h);r&&(f.horizontal[v]=r),x(),vo(o)&&s&&l&&(f.vertical=ju(m,t.glyphMap,t.glyphPositions,t.imagePositions,n,b,a,g,v,p,_,e.ay.vertical,!1,d,h))}}let y=!1;if(u.icon&&u.icon.name){const e=t.imageMap[u.icon.name];e&&(g=Hu(t.imagePositions[u.icon.name],i.get("icon-offset").evaluate(u,{},t.canonical),i.get("icon-anchor").evaluate(u,{},t.canonical)),y=!!e.sdf,void 0===t.bucket.sdfIcons?t.bucket.sdfIcons=y:t.bucket.sdfIcons!==y&&q("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(e.pixelRatio!==t.bucket.pixelRatio||0!==i.get("icon-rotate").constantOr(1))&&(t.bucket.iconsNeedLinear=!0))}const v=ef(f.horizontal)||f.vertical;t.bucket.iconsInText=!!v&&v.iconsInText,(v||g)&&Kp(t.bucket,u,f,g,t.imageMap,o,d,p,_,y,t.canonical,t.subdivisionGranularity)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()},e.cR=gc,e.cS=Rc,e.cT=Hc,e.cU=Pc,e.cV=xu,e.cW=Sc,e.cX=function(e,t,r,i,n,o){let a=Sp(e,t,r,n,0);return a=Sp(a,t,i,o,1),a},e.cY=class{constructor(e){this.maxEntries=e,this.map=new Map}get(e){const t=this.map.get(e);return void 0!==t&&(this.map.delete(e),this.map.set(e,t)),t}set(e,t){if(this.map.has(e))this.map.delete(e);else if(this.map.size>=this.maxEntries){const e=this.map.keys().next().value;this.map.delete(e)}this.map.set(e,t)}clear(){this.map.clear()}},e.cZ=Ac,e.c_=_p,e.ca=au,e.cb=class extends _a{},e.cc=bl,e.cd=function(e){return e<=1?1:Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},e.ce=vl,e.cf=function(e,t,r){var i=t[0],n=t[1],o=t[2],a=r[3]*i+r[7]*n+r[11]*o+r[15];return e[0]=(r[0]*i+r[4]*n+r[8]*o+r[12])/(a=a||1),e[1]=(r[1]*i+r[5]*n+r[9]*o+r[13])/a,e[2]=(r[2]*i+r[6]*n+r[10]*o+r[14])/a,e},e.cg=class extends na{},e.ch=class extends Sa{},e.ci=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.cj=function(e,t){var r=e[0],i=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],f=e[11],m=e[12],g=e[13],_=e[14],y=e[15],v=t[0],b=t[1],x=t[2],w=t[3],T=t[4],S=t[5],E=t[6],I=t[7],P=t[8],k=t[9],A=t[10],C=t[11],M=t[12],D=t[13],R=t[14],L=t[15];return Math.abs(r-v)<=d*Math.max(1,Math.abs(r),Math.abs(v))&&Math.abs(i-b)<=d*Math.max(1,Math.abs(i),Math.abs(b))&&Math.abs(n-x)<=d*Math.max(1,Math.abs(n),Math.abs(x))&&Math.abs(o-w)<=d*Math.max(1,Math.abs(o),Math.abs(w))&&Math.abs(a-T)<=d*Math.max(1,Math.abs(a),Math.abs(T))&&Math.abs(s-S)<=d*Math.max(1,Math.abs(s),Math.abs(S))&&Math.abs(l-E)<=d*Math.max(1,Math.abs(l),Math.abs(E))&&Math.abs(c-I)<=d*Math.max(1,Math.abs(c),Math.abs(I))&&Math.abs(u-P)<=d*Math.max(1,Math.abs(u),Math.abs(P))&&Math.abs(h-k)<=d*Math.max(1,Math.abs(h),Math.abs(k))&&Math.abs(p-A)<=d*Math.max(1,Math.abs(p),Math.abs(A))&&Math.abs(f-C)<=d*Math.max(1,Math.abs(f),Math.abs(C))&&Math.abs(m-M)<=d*Math.max(1,Math.abs(m),Math.abs(M))&&Math.abs(g-D)<=d*Math.max(1,Math.abs(g),Math.abs(D))&&Math.abs(_-R)<=d*Math.max(1,Math.abs(_),Math.abs(R))&&Math.abs(y-L)<=d*Math.max(1,Math.abs(y),Math.abs(L))},e.ck=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.cl=e=>"symbol"===e.type,e.cm=e=>"circle"===e.type,e.cn=e=>"heatmap"===e.type,e.co=e=>"line"===e.type,e.cp=e=>"fill"===e.type,e.cq=e=>"fill-extrusion"===e.type,e.cr=e=>"hillshade"===e.type,e.cs=e=>"color-relief"===e.type,e.ct=e=>"background"===e.type,e.cu=e=>"custom"===e.type,e.cv=L,e.cw=function(e,t,r){const i=k(t.x-r.x,t.y-r.y),n=k(e.x-r.x,e.y-r.y);var o,a;return te(Math.atan2(i[0]*n[1]-i[1]*n[0],(o=i)[0]*(a=n)[0]+o[1]*a[1]))},e.cx=F,e.cy=function(e,t){return ie[t]&&(e instanceof MouseEvent||e instanceof WheelEvent)},e.cz=function(e,t){return re[t]&&"touches"in e},e.d=de,e.d0=function(e,r,i,n,o){return t(this,void 0,void 0,function*(){if(h())try{return yield Y(e,r,i,n,o)}catch(e){}return function(e,t,r,i,n){const o=e.width,a=e.height;J&&K||(J=new OffscreenCanvas(o,a),K=J.getContext("2d",{willReadFrequently:!0})),J.width=o,J.height=a,K.drawImage(e,0,0,o,a);const s=K.getImageData(t,r,i,n);return K.clearRect(0,0,o,a),s.data}(e,r,i,n,o)})},e.d1=kl,e.d2=i,e.d3=tn,e.d4=Ao,e.e=B,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=se,e.h=e=>new Promise((t,r)=>{const i=new Image;i.onload=()=>{t(i),URL.revokeObjectURL(i.src),i.onload=null,window.requestAnimationFrame(()=>{i.src=X})},i.onerror=()=>r(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"});i.src=e.byteLength?URL.createObjectURL(n):X}),e.i=W,e.j=(e,t)=>he(B(e,{type:"json"}),t),e.k=ge,e.l=me,e.m=he,e.n=(e,t)=>he(B(e,{type:"arrayBuffer"}),t),e.o=function(e){return new xu(e).readFields(Ru,[])},e.p=Ou,e.q=function(e){return/[\u02EA\u02EB\u1100-\u11FF\u2E80-\u2FDF\u3000-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(e))},e.r=_l,e.s=Q,e.t=Wo,e.u=ye,e.v=Qn,e.w=q,e.x=Fo,e.y=to,e.z=Do}),r("worker",["./shared"],function(e){class t{constructor(e,t){this.keyCache={},e&&this.replace(e,t)}replace(e,t){this._layerConfigs={},this._layers={},this.update(e,[],t)}update(t,r,i){for(const o of t){this._layerConfigs[o.id]=o;const t=this._layers[o.id]=e.bS(o,i);t._featureFilter=e.aj(t.filter,i),this.keyCache[o.id]&&delete this.keyCache[o.id]}for(const e of r)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];this.familiesBySource={};const n=e.cL(Object.values(this._layerConfigs),this.keyCache);for(const o of n){const t=o.map(e=>this._layers[e.id]),r=t[0];if("none"===r.visibility)continue;const i=r.source||"";let n=this.familiesBySource[i];n||(n=this.familiesBySource[i]={});const a=r.sourceLayer||e.a9;let s=n[a];s||(s=n[a]=[]),s.push(t)}}}class r{constructor(t){const r={},i=[];for(const e in t){const n=t[e],o=r[e]={};for(const e in n){const t=n[+e];if(!t||0===t.bitmap.width||0===t.bitmap.height)continue;const r={x:0,y:0,w:t.bitmap.width+2,h:t.bitmap.height+2};i.push(r),o[e]={rect:r,metrics:t.metrics}}}const{w:n,h:o}=e.p(i),a=new e.r({width:n||1,height:o||1});for(const s in t){const i=t[s];for(const t in i){const n=i[+t];if(!n||0===n.bitmap.width||0===n.bitmap.height)continue;const o=r[s][t].rect;e.r.copy(n.bitmap,a,{x:0,y:0},{x:o.x+1,y:o.y+1},n.bitmap)}}this.image=a,this.positions=r}}e.cM("GlyphAtlas",r);class i{constructor(t){this.tileID=new e.a1(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,i,o,a,s){return e._(this,void 0,void 0,function*(){this.status="parsing",this.data=t,this.collisionBoxArray=new e.ah;const l=new e.cN(Object.keys(t.layers).sort()),c=new e.cO(this.tileID,this.promoteId);c.bucketLayerIDs=[];const u={},h={featureIndex:c,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:o,subdivisionGranularity:s},d=i.familiesBySource[this.source];for(const r in d){const i=t.layers[r];if(!i)continue;1===i.version&&e.w(`Vector tile source "${this.source}" layer "${r}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const a=l.encode(r),s=[];for(let e=0;e<i.length;e++){const t=i.feature(e),n=c.getId(t,r);s.push({feature:t,id:n,index:e,sourceLayerIndex:a})}for(const t of d[r]){const r=t[0];r.source!==this.source&&e.w(`layer.source = ${r.source} does not equal this.source = ${this.source}`),r.isHidden(this.zoom,!0)||(n(t,this.zoom,o),(u[r.id]=r.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 p=e.bX(h.glyphDependencies,e=>Object.keys(e).map(Number));this.inFlightDependencies.forEach(e=>null==e?void 0:e.abort()),this.inFlightDependencies=[];let f=Promise.resolve({});if(Object.keys(p).length){const e=new AbortController;this.inFlightDependencies.push(e),f=a.sendAsync({type:"GG",data:{stacks:p,source:this.source,tileID:this.tileID,type:"glyphs"}},e)}const m=Object.keys(h.iconDependencies);let g=Promise.resolve({});if(m.length){const e=new AbortController;this.inFlightDependencies.push(e),g=a.sendAsync({type:"GI",data:{icons:m,source:this.source,tileID:this.tileID,type:"icons"}},e)}const _=Object.keys(h.patternDependencies);let y=Promise.resolve({});if(_.length){const e=new AbortController;this.inFlightDependencies.push(e),y=a.sendAsync({type:"GI",data:{icons:_,source:this.source,tileID:this.tileID,type:"patterns"}},e)}const v=h.dashDependencies;let b=Promise.resolve({});if(Object.keys(v).length){const e=new AbortController;this.inFlightDependencies.push(e),b=a.sendAsync({type:"GDA",data:{dashes:v}},e)}const[x,w,T,S]=yield Promise.all([f,g,y,b]),E=new r(x),I=new e.cP(w,T);for(const t in u){const r=u[t];r instanceof e.ai?(n(r.layers,this.zoom,o),e.cQ({bucket:r,glyphMap:x,glyphPositions:E.positions,imageMap:w,imagePositions:I.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:h.subdivisionGranularity})):r.hasDependencies&&(r instanceof e.cR||r instanceof e.cS||r instanceof e.cT)&&(n(r.layers,this.zoom,o),r.addFeatures(h,this.tileID.canonical,I.patternPositions,S))}return this.status="done",{buckets:Object.values(u).filter(e=>!e.isEmpty()),featureIndex:c,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:E.image,imageAtlas:I,dashPositions:S,glyphMap:this.returnDependencies?x:null,iconMap:this.returnDependencies?w:null,glyphPositions:this.returnDependencies?E.positions:null}})}}function n(t,r,i){const n=new e.H(r);for(const e of t)e.recalculate(n,i)}class o extends e.cW{constructor(t,r){super(new e.cV,0,r,[],[]),this.feature=t,this.type=t.type,this.properties=t.tags?t.tags:{},"id"in t&&("string"==typeof t.id?this.id=parseInt(t.id,10):"number"!=typeof t.id||isNaN(t.id)||(this.id=t.id))}loadGeometry(){const t=[],r=1===this.feature.type?[this.feature.geometry]:this.feature.geometry;for(const i of r){const r=[];for(const t of i)r.push(new e.P(t[0],t[1]));t.push(r)}return t}}class a extends e.cU{constructor(t,r){super(new e.cV),this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.version=r?r.version:1,this.extent=r?r.extent:4096,this.length=t.length,this.features=t}feature(e){return new o(this.features[e],this.extent)}}function s(e,t){t.writeVarintField(15,e.version||1),t.writeStringField(1,e.name||""),t.writeVarintField(5,e.extent||4096);const r={keys:[],values:[],keycache:{},valuecache:{}};for(let o=0;o<e.length;o++)r.feature=e.feature(o),t.writeMessage(2,l,r);const i=r.keys;for(const o of i)t.writeStringField(3,o);const n=r.values;for(const o of n)t.writeMessage(4,p,o)}function l(e,t){if(!e.feature)return;const r=e.feature;void 0!==r.id&&t.writeVarintField(1,r.id),t.writeMessage(2,c,e),t.writeVarintField(3,r.type),t.writeMessage(4,d,r)}function c(e,t){for(const r in e.feature?.properties){let i=e.feature.properties[r],n=e.keycache[r];if(null===i)continue;void 0===n&&(e.keys.push(r),n=e.keys.length-1,e.keycache[r]=n),t.writeVarint(n),"string"!=typeof i&&"boolean"!=typeof i&&"number"!=typeof i&&(i=JSON.stringify(i));const o=typeof i+":"+i;let a=e.valuecache[o];void 0===a&&(e.values.push(i),a=e.values.length-1,e.valuecache[o]=a),t.writeVarint(a)}}function u(e,t){return(t<<3)+(7&e)}function h(e){return e<<1^e>>31}function d(e,t){const r=e.loadGeometry(),i=e.type;let n=0,o=0;for(const a of r){let r=1;1===i&&(r=a.length),t.writeVarint(u(1,r));const s=3===i?a.length-1:a.length;for(let e=0;e<s;e++){1===e&&1!==i&&t.writeVarint(u(2,s-1));const r=a[e].x-n,l=a[e].y-o;t.writeVarint(h(r)),t.writeVarint(h(l)),n+=r,o+=l}3===e.type&&t.writeVarint(u(7,1))}}function p(e,t){const r=typeof e;"string"===r?t.writeStringField(1,e):"boolean"===r?t.writeBooleanField(7,e):"number"===r&&(e%1!=0?t.writeDoubleField(3,e):e<0?t.writeSVarintField(6,e):t.writeVarintField(5,e))}class f extends e.cW{constructor(t,r,i,n,o){super(new e.cV,0,o,[],[]),this.type=t,this.properties=i||{},this.extent=o,this.pointsArray=r,this.id=n}loadGeometry(){return this.pointsArray.map(t=>t.map(t=>new e.P(t.x,t.y)))}}class m extends e.cU{constructor(t,r,i){super(new e.cV),this.version=2,this._myFeatures=t,this.name=r,this.length=t.length,this.extent=i}feature(e){return this._myFeatures[e]}}class g{constructor(){this.layers={}}addLayer(e){this.layers[e.name]=e}}function _(t){let r=function(t){const r=new e.cV;return function(e,t){for(const r in e.layers)t.writeMessage(3,s,e.layers[r])}(t,r),r.finish()}(t);return 0===r.byteOffset&&r.byteLength===r.buffer.byteLength||(r=new Uint8Array(r)),{vectorTile:t,rawData:r.buffer}}function y(t,r,i){const{extent:n}=t,o=Math.pow(2,i.z-r.z),a=(i.x-r.x*o)*n,s=(i.y-r.y*o)*n,l=[];for(let c=0;c<t.length;c++){const r=t.feature(c);let i=r.loadGeometry();for(const e of i)for(const t of e)t.x=t.x*o-a,t.y=t.y*o-s;const u=128;i=e.cX(i,r.type,-u,-u,n+u,n+u),0!==i.length&&l.push(new f(r.type,i,r.properties,r.id,n))}return new m(l,t.name,n)}class v{constructor(t,r,i){this.actor=t,this.layerIndex=r,this.availableImages=i,this.fetching={},this.loading={},this.loaded={},this.overzoomedTileResultCache=new e.cY(1e3)}loadVectorTile(t,r){return e._(this,void 0,void 0,function*(){const i=yield e.n(t.request,r);try{return{vectorTile:"mlt"!==t.encoding?new e.cZ(new e.cV(i.data)):new e.c_(i.data),rawData:i.data,cacheControl:i.cacheControl,expires:i.expires}}catch(e){const n=new Uint8Array(i.data);let o=`Unable to parse the tile at ${t.request.url}, `;throw o+=31===n[0]&&139===n[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(o)}})}loadTile(t){return e._(this,void 0,void 0,function*(){const{uid:r,overzoomParameters:n}=t;n&&(t.request=n.overzoomRequest);const o=!!(t&&t.request&&t.request.collectResourceTiming)&&new e.c$(t.request),a=new i(t);this.loading[r]=a;const s=new AbortController;a.abort=s;try{const i=yield this.loadVectorTile(t,s);if(delete this.loading[r],!i)return null;if(n){const e=this._getOverzoomTile(t,i.vectorTile);i.rawData=e.rawData,i.vectorTile=e.vectorTile}const l=i.rawData,c={};i.expires&&(c.expires=i.expires),i.cacheControl&&(c.cacheControl=i.cacheControl);const u={};if(o){const e=o.finish();e&&(u.resourceTiming=JSON.parse(JSON.stringify(e)))}a.vectorTile=i.vectorTile;const h=a.parse(i.vectorTile,this.layerIndex,this.availableImages,this.actor,t.subdivisionGranularity);this.loaded[r]=a,this.fetching[r]={rawTileData:l,cacheControl:c,resourceTiming:u};try{const r=yield h;return e.e({rawTileData:l.slice(0),encoding:t.encoding},r,c,u)}finally{delete this.fetching[r]}}catch(e){throw delete this.loading[r],a.status="done",this.loaded[r]=a,e}})}_getOverzoomTile(e,t){const{tileID:r,source:i,overzoomParameters:n}=e,{maxZoomTileID:o}=n,a=`${o.key}_${r.key}`,s=this.overzoomedTileResultCache.get(a);if(s)return s;const l=new g,c=this.layerIndex.familiesBySource[i];for(const h in c){const e=t.layers[h];if(!e)continue;const i=y(e,o,r.canonical);i.length>0&&l.addLayer(i)}const u=_(l);return this.overzoomedTileResultCache.set(a,u),u}reloadTile(t){return e._(this,void 0,void 0,function*(){const r=t.uid;if(!this.loaded||!this.loaded[r])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const i=this.loaded[r];if(i.showCollisionBoxes=t.showCollisionBoxes,"parsing"===i.status){const n=yield i.parse(i.vectorTile,this.layerIndex,this.availableImages,this.actor,t.subdivisionGranularity);let o;if(this.fetching[r]){const{rawTileData:i,cacheControl:a,resourceTiming:s}=this.fetching[r];delete this.fetching[r],o=e.e({rawTileData:i.slice(0),encoding:t.encoding},n,a,s)}else o=n;return o}if("done"===i.status&&i.vectorTile)return i.parse(i.vectorTile,this.layerIndex,this.availableImages,this.actor,t.subdivisionGranularity)})}abortTile(t){return e._(this,void 0,void 0,function*(){const e=this.loading,r=t.uid;e&&e[r]&&e[r].abort&&(e[r].abort.abort(),delete e[r])})}removeTile(t){return e._(this,void 0,void 0,function*(){this.loaded&&this.loaded[t.uid]&&delete this.loaded[t.uid]})}}class b{constructor(){this.loaded={}}loadTile(t){return e._(this,void 0,void 0,function*(){const{uid:r,encoding:i,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.d0(n,-1,-1,c,u)):n,d=new e.d1(r,h,i,o,a,s,l);return this.loaded=this.loaded||{},this.loaded[r]=d,d})}removeTile(e){const t=this.loaded,r=e.uid;t&&t[r]&&delete t[r]}}var x,w,T=function(){if(w)return x;function e(e,r){if(0!==e.length){t(e[0],r);for(var i=1;i<e.length;i++)t(e[i],!r)}}function t(e,t){for(var r=0,i=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=r+s;i+=Math.abs(r)>=Math.abs(s)?r-l+s:s-l+r,r=l}r+i>=0!=!!t&&e.reverse()}return w=1,x=function t(r,i){var n,o=r&&r.type;if("FeatureCollection"===o)for(n=0;n<r.features.length;n++)t(r.features[n],i);else if("GeometryCollection"===o)for(n=0;n<r.geometries.length;n++)t(r.geometries[n],i);else if("Feature"===o)t(r.geometry,i);else if("Polygon"===o)e(r.coordinates,i);else if("MultiPolygon"===o)for(n=0;n<r.coordinates.length;n++)e(r.coordinates[n],i);return r}}(),S=e.d2(T);const E={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},I=Math.fround||(P=new Float32Array(1),e=>(P[0]=+e,P[0]));var P;class k{constructor(e){this.options=Object.assign(Object.create(E),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){const{log:t,minZoom:r,maxZoom:i}=this.options;t&&console.time("total time");const n=`prepare ${e.length} points`;t&&console.time(n),this.points=e;const o=[];for(let s=0;s<e.length;s++){const t=e[s];if(!t.geometry)continue;const[r,i]=t.geometry.coordinates,n=I(M(r)),a=I(D(i));o.push(n,a,1/0,s,-1,1),this.options.reduce&&o.push(0)}let a=this.trees[i+1]=this._createTree(o);t&&console.timeEnd(n);for(let s=i;s>=r;s--){const e=+Date.now();a=this.trees[s]=this._createTree(this._cluster(a,s)),t&&console.log("z%d: %d clusters in %dms",s,a.numItems,+Date.now()-e)}return t&&console.timeEnd("total time"),this}getClusters(e,t){let r=((e[0]+180)%360+360)%360-180;const i=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)r=-180,n=180;else if(r>n){const e=this.getClusters([r,i,180,o],t),a=this.getClusters([-180,i,n,o],t);return e.concat(a)}const a=this.trees[this._limitZoom(t)],s=a.range(M(r),D(o),M(n),D(i)),l=a.data,c=[];for(const u of s){const e=this.stride*u;c.push(l[e+5]>1?A(l,e,this.clusterProps):this.points[l[e+3]])}return c}getChildren(e){const t=this._getOriginId(e),r=this._getOriginZoom(e),i="No cluster with the specified id.",n=this.trees[r];if(!n)throw new Error(i);const o=n.data;if(t*this.stride>=o.length)throw new Error(i);const a=this.options.radius/(this.options.extent*Math.pow(2,r-1)),s=n.within(o[t*this.stride],o[t*this.stride+1],a),l=[];for(const c of s){const t=c*this.stride;o[t+4]===e&&l.push(o[t+5]>1?A(o,t,this.clusterProps):this.points[o[t+3]])}if(0===l.length)throw new Error(i);return l}getLeaves(e,t,r){const i=[];return this._appendLeaves(i,e,t=t||10,r=r||0,0),i}getTile(e,t,r){const i=this.trees[this._limitZoom(e)],n=Math.pow(2,e),{extent:o,radius:a}=this.options,s=a/o,l=(r-s)/n,c=(r+1+s)/n,u={features:[]};return this._addTileFeatures(i.range((t-s)/n,l,(t+1+s)/n,c),i.data,t,r,n,u),0===t&&this._addTileFeatures(i.range(1-s/n,l,1,c),i.data,n,r,n,u),t===n-1&&this._addTileFeatures(i.range(0,l,s/n,c),i.data,-1,r,n,u),u.features.length?u:null}getClusterExpansionZoom(e){let t=this._getOriginZoom(e)-1;for(;t<=this.options.maxZoom;){const r=this.getChildren(e);if(t++,1!==r.length)break;e=r[0].properties.cluster_id}return t}_appendLeaves(e,t,r,i,n){const o=this.getChildren(t);for(const a of o){const t=a.properties;if(t&&t.cluster?n+t.point_count<=i?n+=t.point_count:n=this._appendLeaves(e,t.cluster_id,r,i,n):n<i?n++:e.push(a),e.length===r)break}return n}_createTree(t){const r=new e.aS(t.length/this.stride|0,this.options.nodeSize,Float32Array);for(let e=0;e<t.length;e+=this.stride)r.add(t[e],t[e+1]);return r.finish(),r.data=t,r}_addTileFeatures(e,t,r,i,n,o){for(const a of e){const e=a*this.stride,s=t[e+5]>1;let l,c,u;if(s)l=C(t,e,this.clusterProps),c=t[e],u=t[e+1];else{const r=this.points[t[e+3]];l=r.properties;const[i,n]=r.geometry.coordinates;c=M(i),u=D(n)}const h={type:1,geometry:[[Math.round(this.options.extent*(c*n-r)),Math.round(this.options.extent*(u*n-i))]],tags:l};let d;d=s||this.options.generateId?t[e+3]:this.points[t[e+3]].id,void 0!==d&&(h.id=d),o.features.push(h)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,t){const{radius:r,extent:i,reduce:n,minPoints:o}=this.options,a=r/(i*Math.pow(2,t)),s=e.data,l=[],c=this.stride;for(let u=0;u<s.length;u+=c){if(s[u+2]<=t)continue;s[u+2]=t;const r=s[u],i=s[u+1],h=e.within(s[u],s[u+1],a),d=s[u+5];let p=d;for(const e of h){const r=e*c;s[r+2]>t&&(p+=s[r+5])}if(p>d&&p>=o){let e,o=r*d,a=i*d,f=-1;const m=(u/c<<5)+(t+1)+this.points.length;for(const r of h){const i=r*c;if(s[i+2]<=t)continue;s[i+2]=t;const l=s[i+5];o+=s[i]*l,a+=s[i+1]*l,s[i+4]=m,n&&(e||(e=this._map(s,u,!0),f=this.clusterProps.length,this.clusterProps.push(e)),n(e,this._map(s,i)))}s[u+4]=m,l.push(o/p,a/p,1/0,m,-1,p),n&&l.push(f)}else{for(let e=0;e<c;e++)l.push(s[u+e]);if(p>1)for(const e of h){const r=e*c;if(!(s[r+2]<=t)){s[r+2]=t;for(let e=0;e<c;e++)l.push(s[r+e])}}}}return l}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,t,r){if(e[t+5]>1){const i=this.clusterProps[e[t+6]];return r?Object.assign({},i):i}const i=this.points[e[t+3]].properties,n=this.options.map(i);return r&&n===i?Object.assign({},n):n}}function A(e,t,r){return{type:"Feature",id:e[t+3],properties:C(e,t,r),geometry:{type:"Point",coordinates:[(i=e[t],360*(i-.5)),R(e[t+1])]}};var i}function C(e,t,r){const i=e[t+5],n=i>=1e4?`${Math.round(i/1e3)}k`:i>=1e3?Math.round(i/100)/10+"k":i,o=e[t+6],a=-1===o?{}:Object.assign({},r[o]);return Object.assign(a,{cluster:!0,cluster_id:e[t+3],point_count:i,point_count_abbreviated:n})}function M(e){return e/360+.5}function D(e){const t=Math.sin(e*Math.PI/180),r=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return r<0?0:r>1?1:r}function R(e){const t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function L(e,t,r,i){let n=i;const o=t+(r-t>>1);let a,s=r-t;const l=e[t],c=e[t+1],u=e[r],h=e[r+1];for(let d=t+3;d<r;d+=3){const t=F(e[d],e[d+1],l,c,u,h);if(t>n)a=d,n=t;else if(t===n){const e=Math.abs(d-o);e<s&&(a=d,s=e)}}n>i&&(a-t>3&&L(e,t,a,i),e[a+2]=n,r-a>3&&L(e,a,r,i))}function F(e,t,r,i,n,o){let a=n-r,s=o-i;if(0!==a||0!==s){const l=((e-r)*a+(t-i)*s)/(a*a+s*s);l>1?(r=n,i=o):l>0&&(r+=a*l,i+=s*l)}return a=e-r,s=t-i,a*a+s*s}function O(e,t,r,i){const n={id:null==e?null:e,type:t,geometry:r,tags:i,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if("Point"===t||"MultiPoint"===t||"LineString"===t)z(n,r);else if("Polygon"===t)z(n,r[0]);else if("MultiLineString"===t)for(const o of r)z(n,o);else if("MultiPolygon"===t)for(const o of r)z(n,o[0]);return n}function z(e,t){for(let r=0;r<t.length;r+=3)e.minX=Math.min(e.minX,t[r]),e.minY=Math.min(e.minY,t[r+1]),e.maxX=Math.max(e.maxX,t[r]),e.maxY=Math.max(e.maxY,t[r+1])}function B(e,t,r,i){if(!t.geometry)return;const n=t.geometry.coordinates;if(n&&0===n.length)return;const o=t.geometry.type,a=Math.pow(r.tolerance/((1<<r.maxZoom)*r.extent),2);let s=[],l=t.id;if(r.promoteId?l=t.properties[r.promoteId]:r.generateId&&(l=i||0),"Point"===o)N(n,s);else if("MultiPoint"===o)for(const c of n)N(c,s);else if("LineString"===o)j(n,s,a,!1);else if("MultiLineString"===o){if(r.lineMetrics){for(const r of n)s=[],j(r,s,a,!1),e.push(O(l,"LineString",s,t.properties));return}V(n,s,a,!1)}else if("Polygon"===o)V(n,s,a,!0);else{if("MultiPolygon"!==o){if("GeometryCollection"===o){for(const n of t.geometry.geometries)B(e,{id:l,geometry:n,properties:t.properties},r,i);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const e of n){const t=[];V(e,t,a,!0),s.push(t)}}e.push(O(l,o,s,t.properties))}function N(e,t){t.push(U(e[0]),G(e[1]),0)}function j(e,t,r,i){let n,o,a=0;for(let l=0;l<e.length;l++){const r=U(e[l][0]),s=G(e[l][1]);t.push(r,s,0),l>0&&(a+=i?(n*s-r*o)/2:Math.sqrt(Math.pow(r-n,2)+Math.pow(s-o,2))),n=r,o=s}const s=t.length-3;t[2]=1,L(t,0,s,r),t[s+2]=1,t.size=Math.abs(a),t.start=0,t.end=t.size}function V(e,t,r,i){for(let n=0;n<e.length;n++){const o=[];j(e[n],o,r,i),t.push(o)}}function U(e){return e/360+.5}function G(e){const t=Math.sin(e*Math.PI/180),r=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return r<0?0:r>1?1:r}function q(e,t,r,i,n,o,a,s){if(i/=t,o>=(r/=t)&&a<i)return e;if(a<r||o>=i)return null;const l=[];for(const c of e){const e=c.geometry;let t=c.type;const o=0===n?c.minX:c.minY,a=0===n?c.maxX:c.maxY;if(o>=r&&a<i){l.push(c);continue}if(a<r||o>=i)continue;let u=[];if("Point"===t||"MultiPoint"===t)$(e,u,r,i,n);else if("LineString"===t)W(e,u,r,i,n,!1,s.lineMetrics);else if("MultiLineString"===t)H(e,u,r,i,n,!1);else if("Polygon"===t)H(e,u,r,i,n,!0);else if("MultiPolygon"===t)for(const s of e){const e=[];H(s,e,r,i,n,!0),e.length&&u.push(e)}if(u.length){if(s.lineMetrics&&"LineString"===t){for(const e of u)l.push(O(c.id,t,e,c.tags));continue}"LineString"!==t&&"MultiLineString"!==t||(1===u.length?(t="LineString",u=u[0]):t="MultiLineString"),"Point"!==t&&"MultiPoint"!==t||(t=3===u.length?"Point":"MultiPoint"),l.push(O(c.id,t,u,c.tags))}}return l.length?l:null}function $(e,t,r,i,n){for(let o=0;o<e.length;o+=3){const a=e[o+n];a>=r&&a<=i&&X(t,e[o],e[o+1],e[o+2])}}function W(e,t,r,i,n,o,a){let s=Z(e);const l=0===n?Y:J;let c,u,h=e.start;for(let g=0;g<e.length-3;g+=3){const d=e[g],p=e[g+1],f=e[g+2],m=e[g+3],_=e[g+4],y=0===n?d:p,v=0===n?m:_;let b=!1;a&&(c=Math.sqrt(Math.pow(d-m,2)+Math.pow(p-_,2))),y<r?v>r&&(u=l(s,d,p,m,_,r),a&&(s.start=h+c*u)):y>i?v<i&&(u=l(s,d,p,m,_,i),a&&(s.start=h+c*u)):X(s,d,p,f),v<r&&y>=r&&(u=l(s,d,p,m,_,r),b=!0),v>i&&y<=i&&(u=l(s,d,p,m,_,i),b=!0),!o&&b&&(a&&(s.end=h+c*u),t.push(s),s=Z(e)),a&&(h+=c)}let d=e.length-3;const p=e[d],f=e[d+1],m=0===n?p:f;m>=r&&m<=i&&X(s,p,f,e[d+2]),d=s.length-3,o&&d>=3&&(s[d]!==s[0]||s[d+1]!==s[1])&&X(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 H(e,t,r,i,n,o){for(const a of e)W(a,t,r,i,n,o,!1)}function X(e,t,r,i){e.push(t,r,i)}function Y(e,t,r,i,n,o){const a=(o-t)/(i-t);return X(e,o,r+(n-r)*a,1),a}function J(e,t,r,i,n,o){const a=(o-r)/(n-r);return X(e,t+(i-t)*a,o,1),a}function K(e,t){const r=[];for(let i=0;i<e.length;i++){const n=e[i],o=n.type;let a;if("Point"===o||"MultiPoint"===o||"LineString"===o)a=Q(n.geometry,t);else if("MultiLineString"===o||"Polygon"===o){a=[];for(const e of n.geometry)a.push(Q(e,t))}else if("MultiPolygon"===o){a=[];for(const e of n.geometry){const r=[];for(const i of e)r.push(Q(i,t));a.push(r)}}r.push(O(n.id,o,a,n.tags))}return r}function Q(e,t){const r=[];r.size=e.size,void 0!==e.start&&(r.start=e.start,r.end=e.end);for(let i=0;i<e.length;i+=3)r.push(e[i]+t,e[i+1],e[i+2]);return r}function ee(e,t){if(e.transformed)return e;const r=1<<e.z,i=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 s=0;s<e.length;s+=2)o.geometry.push(te(e[s],e[s+1],t,r,i,n));else for(let s=0;s<e.length;s++){const a=[];for(let o=0;o<e[s].length;o+=2)a.push(te(e[s][o],e[s][o+1],t,r,i,n));o.geometry.push(a)}}return e.transformed=!0,e}function te(e,t,r,i,n,o){return[Math.round(r*(e*i-n)),Math.round(r*(t*i-o))]}function re(e,t,r,i,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:r,y:i,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const s of e)ie(a,s,o,n);return a}function ie(e,t,r,i){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 s=0;s<n.length;s+=3)a.push(n[s],n[s+1]),e.numPoints++,e.numSimplified++;else if("LineString"===o)ne(a,n,e,r,!1,!1);else if("MultiLineString"===o||"Polygon"===o)for(let s=0;s<n.length;s++)ne(a,n[s],e,r,"Polygon"===o,0===s);else if("MultiPolygon"===o)for(let s=0;s<n.length;s++){const t=n[s];for(let i=0;i<t.length;i++)ne(a,t[i],e,r,!0,0===i)}if(a.length){let r=t.tags||null;if("LineString"===o&&i.lineMetrics){r={};for(const e in t.tags)r[e]=t.tags[e];r.mapbox_clip_start=n.start/n.size,r.mapbox_clip_end=n.end/n.size}const s={geometry:a,type:"Polygon"===o||"MultiPolygon"===o?3:"LineString"===o||"MultiLineString"===o?2:1,tags:r};null!==t.id&&(s.id=t.id),e.features.push(s)}}function ne(e,t,r,i,n,o){const a=i*i;if(i>0&&t.size<(n?a:i))return void(r.numPoints+=t.length/3);const s=[];for(let l=0;l<t.length;l+=3)(0===i||t[l+2]>a)&&(r.numSimplified++,s.push(t[l],t[l+1])),r.numPoints++;n&&function(e,t){let r=0;for(let i=0,n=e.length,o=n-2;i<n;o=i,i+=2)r+=(e[i]-e[o])*(e[i+1]+e[o+1]);if(r>0===t)for(let i=0,n=e.length;i<n/2;i+=2){const t=e[i],r=e[i+1];e[i]=e[n-2-i],e[i+1]=e[n-1-i],e[n-2-i]=t,e[n-1-i]=r}}(s,o),e.push(s)}const oe={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class ae{constructor(e,t){const r=(t=this.options=function(e,t){for(const r in t)e[r]=t[r];return e}(Object.create(oe),t)).debug;if(r&&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 i=function(e,t){const r=[];if("FeatureCollection"===e.type)for(let i=0;i<e.features.length;i++)B(r,e.features[i],t,i);else B(r,"Feature"===e.type?e:{geometry:e},t);return r}(e,t);this.tiles={},this.tileCoords=[],r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),i=function(e,t){const r=t.buffer/t.extent;let i=e;const n=q(e,1,-1-r,r,0,-1,2,t),o=q(e,1,1-r,2+r,0,-1,2,t);return(n||o)&&(i=q(e,1,-r,1+r,0,-1,2,t)||[],n&&(i=K(n,1).concat(i)),o&&(i=i.concat(K(o,-1)))),i}(i,t),i.length&&this.splitTile(i,0,0,0),r&&(i.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(e,t,r,i,n,o,a){const s=[e,t,r,i],l=this.options,c=l.debug;for(;s.length;){i=s.pop(),r=s.pop(),t=s.pop(),e=s.pop();const u=1<<t,h=se(t,r,i);let d=this.tiles[h];if(!d&&(c>1&&console.time("creation"),d=this.tiles[h]=re(e,t,r,i,l),this.tileCoords.push({z:t,x:r,y:i}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,r,i,d.numFeatures,d.numPoints,d.numSimplified),console.timeEnd("creation"));const e=`z${t}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}if(d.source=e,null==n){if(t===l.indexMaxZoom||d.numPoints<=l.indexMaxPoints)continue}else{if(t===l.maxZoom||t===n)continue;if(null!=n){const e=n-t;if(r!==o>>e||i!==a>>e)continue}}if(d.source=null,0===e.length)continue;c>1&&console.time("clipping");const p=.5*l.buffer/l.extent,f=.5-p,m=.5+p,g=1+p;let _=null,y=null,v=null,b=null,x=q(e,u,r-p,r+m,0,d.minX,d.maxX,l),w=q(e,u,r+f,r+g,0,d.minX,d.maxX,l);e=null,x&&(_=q(x,u,i-p,i+m,1,d.minY,d.maxY,l),y=q(x,u,i+f,i+g,1,d.minY,d.maxY,l),x=null),w&&(v=q(w,u,i-p,i+m,1,d.minY,d.maxY,l),b=q(w,u,i+f,i+g,1,d.minY,d.maxY,l),w=null),c>1&&console.timeEnd("clipping"),s.push(_||[],t+1,2*r,2*i),s.push(y||[],t+1,2*r,2*i+1),s.push(v||[],t+1,2*r+1,2*i),s.push(b||[],t+1,2*r+1,2*i+1)}}getTile(e,t,r){e=+e,t=+t,r=+r;const i=this.options,{extent:n,debug:o}=i;if(e<0||e>24)return null;const a=1<<e,s=se(e,t=t+a&a-1,r);if(this.tiles[s])return ee(this.tiles[s],n);o>1&&console.log("drilling down to z%d-%d-%d",e,t,r);let l,c=e,u=t,h=r;for(;!l&&c>0;)c--,u>>=1,h>>=1,l=this.tiles[se(c,u,h)];return l&&l.source?(o>1&&(console.log("found parent tile z%d-%d-%d",c,u,h),console.time("drilling down")),this.splitTile(l.source,c,u,h,e,t,r),o>1&&console.timeEnd("drilling down"),this.tiles[s]?ee(this.tiles[s],n):null):null}}function se(e,t,r){return 32*((1<<e)*r+t)+e}class le extends v{constructor(e,t,r,i=ce){super(e,t,r),this._dataUpdateable=new Map,this._createGeoJSONIndex=i}loadVectorTile(t,r){return e._(this,void 0,void 0,function*(){const r=t.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const i=this._geoJSONIndex.getTile(r.z,r.x,r.y);return i?_(new a(i.features,{version:2,extent:e.a4})):null})}loadData(t){return e._(this,void 0,void 0,function*(){var r;null===(r=this._pendingRequest)||void 0===r||r.abort();const i=this._startPerformance(t);this._pendingRequest=new AbortController;try{(!this._pendingData||t.request||t.data||t.dataDiff)&&(this._pendingData=this.loadAndProcessGeoJSON(t,this._pendingRequest));const r=yield this._pendingData;this._geoJSONIndex=this._createGeoJSONIndex(r,t),this.loaded={};const n=t.dataDiff&&e.a6(r)?{applyDiff:!0}:{data:r};return this._finishPerformance(i,t,n),n}catch(t){if(delete this._pendingRequest,e.cH(t))return{abandoned:!0};throw t}})}_startPerformance(t){var r;if(null===(r=null==t?void 0:t.request)||void 0===r?void 0:r.collectResourceTiming)return new e.c$(t.request)}_finishPerformance(e,t,r){if(!e)return;const i=e.finish();i&&(r.resourceTiming={},r.resourceTiming[t.source]=JSON.parse(JSON.stringify(i)))}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,r){return e._(this,void 0,void 0,function*(){let e;if(t.request?e=yield this.loadGeoJSONFromUrl(t.request,t.promoteId,r):t.data?e=this._loadGeoJSONFromObject(t.data,t.promoteId):t.dataDiff&&(e=this._loadGeoJSONFromDiff(t.dataDiff,t.promoteId,t.source)),delete this._pendingRequest,"object"!=typeof e)throw new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`);return S(e,!0),t.filter&&(e=this._filterGeoJSON(e,t.filter)),e})}loadGeoJSONFromUrl(t,r,i){return e._(this,void 0,void 0,function*(){const n=yield e.j(t,i);return this._dataUpdateable=e.a6(n.data,r)?e.a7(n.data,r):void 0,n.data})}_loadGeoJSONFromObject(t,r){return this._dataUpdateable=e.a6(t,r)?e.a7(t,r):void 0,t}_loadGeoJSONFromDiff(t,r,i){if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${i}`);e.a8(this._dataUpdateable,t,r);const n=Array.from(this._dataUpdateable.values());return this._toFeatureCollection(n)}_filterGeoJSON(t,r){const i=e.d3(r,{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=t.features.filter(e=>i.value.evaluate({zoom:0},e));return this._toFeatureCollection(n)}_toFeatureCollection(e){return{type:"FeatureCollection",features:e}}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)}}function ce(t,r){return r.cluster?new k(function({superclusterOptions:t,clusterProperties:r}){if(!r||!t)return t;const i={},n={},o={accumulated:null,zoom:0},a={properties:null},s=Object.keys(r);for(const l of s){const[t,o]=r[l],a=e.d3(o),s=e.d3("string"==typeof t?[t,["accumulated"],["get",l]]:t);i[l]=a.value,n[l]=s.value}return t.map=e=>{a.properties=e;const t={};for(const r of s)t[r]=i[r].evaluate(o,a);return t},t.reduce=(e,t)=>{a.properties=t;for(const r of s)o.accumulated=e[r],e[r]=n[r].evaluate(o,a)},t}(r)).load(t.features):function(e,t){return new ae(e,t)}(t,r.geojsonVtOptions)}class ue{constructor(t){this.self=t,this.actor=new e.L(t),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.globalStates=new Map,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.cJ,this.self.removeProtocol=e.cK,this.self.registerRTLTextPlugin=t=>{e.d4.setMethods(t)},this.actor.registerMessageHandler("LDT",(e,t)=>this._getDEMWorkerSource(e,t.source).loadTile(t)),this.actor.registerMessageHandler("RDT",(t,r)=>e._(this,void 0,void 0,function*(){this._getDEMWorkerSource(t,r.source).removeTile(r)})),this.actor.registerMessageHandler("GCEZ",(t,r)=>e._(this,void 0,void 0,function*(){return this._getWorkerSource(t,r.type,r.source).getClusterExpansionZoom(r)})),this.actor.registerMessageHandler("GCC",(t,r)=>e._(this,void 0,void 0,function*(){return this._getWorkerSource(t,r.type,r.source).getClusterChildren(r)})),this.actor.registerMessageHandler("GCL",(t,r)=>e._(this,void 0,void 0,function*(){return this._getWorkerSource(t,r.type,r.source).getClusterLeaves(r)})),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,r)=>e._(this,void 0,void 0,function*(){if(!this.workerSources[t]||!this.workerSources[t][r.type]||!this.workerSources[t][r.type][r.source])return;const e=this.workerSources[t][r.type][r.source];delete this.workerSources[t][r.type][r.source],void 0!==e.removeSource&&e.removeSource(r)})),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.globalStates.delete(t)})),this.actor.registerMessageHandler("SR",(t,r)=>e._(this,void 0,void 0,function*(){this.referrer=r})),this.actor.registerMessageHandler("SRPS",(e,t)=>this._syncRTLPluginState(e,t)),this.actor.registerMessageHandler("IS",(t,r)=>e._(this,void 0,void 0,function*(){this.self.importScripts(r)})),this.actor.registerMessageHandler("SI",(e,t)=>this._setImages(e,t)),this.actor.registerMessageHandler("UL",(t,r)=>e._(this,void 0,void 0,function*(){this._getLayerIndex(t).update(r.layers,r.removedIds,this._getGlobalState(t))})),this.actor.registerMessageHandler("UGS",(t,r)=>e._(this,void 0,void 0,function*(){const e=this._getGlobalState(t);for(const t in r)e[t]=r[t]})),this.actor.registerMessageHandler("SL",(t,r)=>e._(this,void 0,void 0,function*(){this._getLayerIndex(t).replace(r,this._getGlobalState(t))}))}_getGlobalState(e){let t=this.globalStates.get(e);return t||(t={},this.globalStates.set(e,t)),t}_setImages(t,r){return e._(this,void 0,void 0,function*(){this.availableImages[t]=r;for(const e in this.workerSources[t]){const i=this.workerSources[t][e];for(const e in i)i[e].availableImages=r}})}_syncRTLPluginState(t,r){return e._(this,void 0,void 0,function*(){return yield e.d4.syncState(r,this.self.importScripts)})}_getAvailableImages(e){let t=this.availableImages[e];return t||(t=[]),t}_getLayerIndex(e){let r=this.layerIndexes[e];return r||(r=this.layerIndexes[e]=new t),r}_getWorkerSource(e,t,r){if(this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][t]||(this.workerSources[e][t]={}),!this.workerSources[e][t][r]){const i={sendAsync:(t,r)=>(t.targetMapId=e,this.actor.sendAsync(t,r))};switch(t){case"vector":this.workerSources[e][t][r]=new v(i,this._getLayerIndex(e),this._getAvailableImages(e));break;case"geojson":this.workerSources[e][t][r]=new le(i,this._getLayerIndex(e),this._getAvailableImages(e));break;default:this.workerSources[e][t][r]=new this.externalWorkerSourceTypes[t](i,this._getLayerIndex(e),this._getAvailableImages(e))}}return this.workerSources[e][t][r]}_getDEMWorkerSource(e,t){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][t]||(this.demWorkerSources[e][t]=new b),this.demWorkerSources[e][t]}}return e.i(self)&&(self.worker=new ue(self)),ue}),r("index",["exports","./shared"],function(e,t){var r="5.13.0";function i(){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,a;const s={frame(e,r,i){const n=requestAnimationFrame(e=>{o(),r(e)}),{unsubscribe:o}=t.s(e.signal,"abort",()=>{o(),cancelAnimationFrame(n),i(t.c())},!1)},frameAsync(e){return new Promise((t,r)=>{this.frame(e,t,r)})},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"),r=t.getContext("2d",{willReadFrequently:!0});if(!r)throw new Error("failed to create canvas 2d context");return t.width=e.width,t.height=e.height,r.drawImage(e,0,0,e.width,e.height),r},resolveURL:e=>(n||(n=document.createElement("a")),n.href=e,n.href),hardwareConcurrency:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return void 0!==a?a:!!matchMedia&&(null==o&&(o=matchMedia("(prefers-reduced-motion: reduce)")),o.matches)},set prefersReducedMotion(e){a=e}},l=new class{constructor(){this._realTime="undefined"!=typeof performance&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),this._frozenAt=null}getCurrentTime(){return null!==this._frozenAt?this._frozenAt:this._realTime()}setNow(e){this._frozenAt=e}restoreNow(){this._frozenAt=null}isFrozen(){return null!==this._frozenAt}};function c(){return l.getCurrentTime()}class u{static testProp(e){if(!u.docStyle)return e[0];for(let t=0;t<e.length;t++)if(e[t]in u.docStyle)return e[t];return e[0]}static create(e,t,r){const i=window.document.createElement(e);return void 0!==t&&(i.className=t),r&&r.appendChild(i),i}static createNS(e,t){return window.document.createElementNS(e,t)}static disableDrag(){u.docStyle&&u.selectProp&&(u.userSelect=u.docStyle[u.selectProp],u.docStyle[u.selectProp]="none")}static enableDrag(){u.docStyle&&u.selectProp&&(u.docStyle[u.selectProp]=u.userSelect)}static setTransform(e,t){e.style[u.transformProp]=t}static addEventListener(e,t,r,i={}){e.addEventListener(t,r,"passive"in i?i:i.capture)}static removeEventListener(e,t,r,i={}){e.removeEventListener(t,r,"passive"in i?i:i.capture)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",u.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",u.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",u.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,r,i){const n=r.boundingClientRect;return new t.P((i.clientX-n.left)/r.x-e.clientLeft,(i.clientY-n.top)/r.y-e.clientTop)}static mousePos(e,t){const r=u.getScale(e);return u.getPoint(e,r,t)}static touchPos(e,t){const r=[],i=u.getScale(e);for(let n=0;n<t.length;n++)r.push(u.getPoint(e,i,t[n]));return r}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"),r=t.querySelectorAll("script");for(const i of r)i.remove();return u.clean(t),t.innerHTML}static isPossiblyDangerous(e,t){const r=t.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(e)||!r.includes("javascript:")&&!r.includes("data:"))||!!e.startsWith("on")||void 0}static clean(e){const t=e.children;for(const r of t)u.removeAttributes(r),u.clean(r)}static removeAttributes(e){for(const{name:t,value:r}of e.attributes)u.isPossiblyDangerous(t,r)&&e.removeAttribute(t)}}u.docStyle="undefined"!=typeof window&&window.document&&window.document.documentElement.style,u.selectProp=u.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),u.transformProp=u.testProp(["transform","WebkitTransform"]);const h={supported:!1,testSupport:function(e){!f&&p&&(m?g(e):d=e)}};let d,p,f=!1,m=!1;function g(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,p),e.isContextLost())return;h.supported=!0}catch(e){}e.deleteTexture(t),f=!0}var _;"undefined"!=typeof document&&(p=document.createElement("img"),p.onload=()=>{d&&g(d),d=null,m=!0},p.onerror=()=>{f=!0,d=null},p.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(e){let r,i,n,o;e.resetRequestQueue=()=>{r=[],i=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,i,n=!0)=>new Promise((o,a)=>{h.supported&&(e.headers||(e.headers={}),e.headers.accept="image/webp,*/*"),t.e(e,{type:"image"}),r.push({abortController:i,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:r,supportImageRefresh:n,onError:o,onSuccess:a,abortController:c}=e,u=!1===n&&!t.i(self)&&!t.g(r.url)&&(!r.headers||Object.keys(r.headers).reduce((e,t)=>e&&"accept"===t,!0));i++;const h=u?l(r,c):t.m(r,c);try{const r=yield h;delete e.abortController,e.state="completed",r.data instanceof HTMLImageElement||t.b(r.data)?a(r):r.data&&a({data:yield(d=r.data,"function"==typeof createImageBitmap?t.f(d):t.h(d)),cacheControl:r.cacheControl,expires:r.expires})}catch(t){delete e.abortController,o(t)}finally{i--,s()}var d}),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=i;t<e&&r.length>0;t++){const e=r.shift();e.abortController.signal.aborted?t--:a(e)}},l=(e,r)=>new Promise((i,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"),r.signal.addEventListener("abort",()=>{o.src="",n(t.c())}),o.fetchPriority="high",o.onload=()=>{o.onerror=o.onload=null,i({data:o})},o.onerror=()=>{o.onerror=o.onload=null,r.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})}(_||(_={})),_.resetRequestQueue();class y{constructor(e){this._transformRequestFn=null!=e?e:null}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function v(e){const t=[];if("string"==typeof e)t.push({id:"default",url:e});else if(e&&e.length>0){const r=[];for(const{id:i,url:n}of e){const e=`${i}${n}`;-1===r.indexOf(e)&&(r.push(e),t.push({id:i,url:n}))}}return t}function b(e,t,r){try{const i=new URL(e);return i.pathname+=`${t}${r}`,i.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`)}}function x(e){const{userImage:t}=e;return!!(t&&t.render&&t.render())&&(e.data.replace(new Uint8Array(t.data.buffer)),!0)}class w 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}destroy(){this.atlasTexture&&(this.atlasTexture.destroy(),this.atlasTexture=null);for(const e of Object.keys(this.images))this.removeImage(e);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 r=this.images[e];if(r&&!r.data&&r.spriteData){const e=r.spriteData;r.data=new t.R({width:e.width,height:e.height},e.context.getImageData(e.x,e.y,e.width,e.height).data),r.spriteData=null}return r}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,r){let i=!0;const n=r.data||r.spriteData;return this._validateStretch(r.stretchX,n&&n.width)||(this.fire(new t.k(new Error(`Image "${e}" has invalid "stretchX" value`))),i=!1),this._validateStretch(r.stretchY,n&&n.height)||(this.fire(new t.k(new Error(`Image "${e}" has invalid "stretchY" value`))),i=!1),this._validateContent(r.content,r)||(this.fire(new t.k(new Error(`Image "${e}" has invalid "content" value`))),i=!1),i}_validateStretch(e,t){if(!e)return!0;let r=0;for(const i of e){if(i[0]<r||i[1]<i[0]||t<i[1])return!1;r=i[1]}return!0}_validateContent(e,t){if(!e)return!0;if(4!==e.length)return!1;const r=t.spriteData,i=r&&r.width||t.data.width,n=r&&r.height||t.data.height;return!(e[0]<0||i<e[0]||e[1]<0||n<e[1]||e[2]<0||i<e[2]||e[3]<0||n<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,t,r=!0){const i=this.getImage(e);if(r&&(i.data.width!==t.data.width||i.data.height!==t.data.height))throw new Error(`size mismatch between old image (${i.data.width}x${i.data.height}) and new image (${t.data.width}x${t.data.height}).`);t.version=i.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,r)=>{let i=!0;if(!this.isLoaded())for(const n of e)this.images[n]||(i=!1);this.isLoaded()||i?t(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:t})})}_getImagesForIds(e){const r={};for(const i of e){let e=this.getImage(i);e||(this.fire(new t.l("styleimagemissing",{id:i})),e=this.getImage(i)),e?r[i]={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 "${i}" 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 r}getPixelSize(){const{width:e,height:t}=this.atlasImage;return{width:e,height:t}}getPattern(e){const r=this.patterns[e],i=this.getImage(e);if(!i)return null;if(r&&r.position.version===i.version)return r.position;if(r)r.position.version=i.version;else{const r={w:i.data.width+2,h:i.data.height+2,x:0,y:0},n=new t.I(r,i);this.patterns[e]={bin:r,position:n}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){const r=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new t.T(e,this.atlasImage,r.RGBA),this.atlasTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}_updatePatternAtlas(){const e=[];for(const t in this.patterns)e.push(this.patterns[t].bin);const{w:r,h:i}=t.p(e),n=this.atlasImage;n.resize({width:r||1,height:i||1});for(const o in this.patterns){const{bin:e}=this.patterns[o],r=e.x+1,i=e.y+1,a=this.getImage(o).data,s=a.width,l=a.height;t.R.copy(a,n,{x:0,y:0},{x:r,y:i},{width:s,height:l}),t.R.copy(a,n,{x:0,y:l-1},{x:r,y:i-1},{width:s,height:1}),t.R.copy(a,n,{x:0,y:0},{x:r,y:i+l},{width:s,height:1}),t.R.copy(a,n,{x:s-1,y:0},{x:r-1,y:i},{width:1,height:l}),t.R.copy(a,n,{x:0,y:0},{x:r+s,y:i},{width:1,height:l})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(const r of e){if(this.callbackDispatchedThisFrame[r])continue;this.callbackDispatchedThisFrame[r]=!0;const e=this.getImage(r);e||t.w(`Image with ID: "${r}" was not found`),x(e)&&this.updateImage(r,e)}}cloneImages(){const e={};for(const t in this.images){const r=this.images[t];e[t]=Object.assign(Object.assign({},r),{data:r.data?r.data.clone():null})}return e}}const T=1e20;function S(e,t,r,i,n,o,a,s,l){for(let c=t;c<t+i;c++)E(e,r*o+c,o,n,a,s,l);for(let c=r;c<r+n;c++)E(e,c*o+t,1,i,a,s,l)}function E(e,t,r,i,n,o,a){o[0]=0,a[0]=-T,a[1]=T,n[0]=e[t];for(let s=1,l=0,c=0;s<i;s++){n[s]=e[t+s*r];const i=s*s;do{const e=o[l];c=(n[s]-n[e]+i-e*e)/(s-e)/2}while(c<=a[l]&&--l>-1);l++,o[l]=s,a[l]=c,a[l+1]=T}for(let s=0,l=0;s<i;s++){for(;a[l+1]<s;)l++;const i=o[l],c=s-i;e[t+s*r]=n[i]+c*c}}const I=t.v.layout_symbol["text-font"].default.join(",");class P{constructor(e,t,r){this.requestManager=e,this.localIdeographFontFamily=t,this.entries={},this.lang=r}setURL(e){this.url=e}getGlyphs(e){return t._(this,void 0,void 0,function*(){const t=[];for(const n in e)for(const r of e[n])t.push(this._getAndCacheGlyphsPromise(n,r));const r=yield Promise.all(t),i={};for(const{stack:e,id:n,glyph:o}of r)i[e]||(i[e]={}),i[e][n]=o&&{id:o.id,bitmap:o.bitmap.clone(),metrics:o.metrics};return i})}_getAndCacheGlyphsPromise(e,r){return t._(this,void 0,void 0,function*(){let t=this.entries[e];t||(t=this.entries[e]={glyphs:{},requests:{},ranges:{}});let i=t.glyphs[r];return void 0!==i?{stack:e,id:r,glyph:i}:!this.url||this._charUsesLocalIdeographFontFamily(r)?(i=t.glyphs[r]=this._drawGlyph(t,e,r),{stack:e,id:r,glyph:i}):yield this._downloadAndCacheRangePromise(e,r)})}_downloadAndCacheRangePromise(e,r){return t._(this,void 0,void 0,function*(){const t=this.entries[e],i=Math.floor(r/256);if(t.ranges[i])return{stack:e,id:r,glyph:null};if(!t.requests[i]){const r=P.loadGlyphRange(e,i,this.url,this.requestManager);t.requests[i]=r}try{const n=yield t.requests[i];for(const e in n)t.glyphs[+e]=n[+e];return t.ranges[i]=!0,{stack:e,id:r,glyph:n[r]||null}}catch(n){const a=t.glyphs[r]=this._drawGlyph(t,e,r);return this._warnOnMissingGlyphRange(a,i,r,n),{stack:e,id:r,glyph:a}}})}_warnOnMissingGlyphRange(e,r,i,n){const o=256*r,a=o+255,s=i.toString(16).padStart(4,"0").toUpperCase();t.w(`Unable to load glyph range ${r}, ${o}-${a}. Rendering codepoint U+${s} locally instead. ${n}`)}_charUsesLocalIdeographFontFamily(e){return!!this.localIdeographFontFamily&&t.q(e)}_drawGlyph(e,r,i){const n=r===I&&""!==this.localIdeographFontFamily&&this._charUsesLocalIdeographFontFamily(i),o=n?"ideographTinySDF":"tinySDF";e[o]||(e[o]=this._createTinySDF(n?this.localIdeographFontFamily:r));const a=e[o].draw(String.fromCodePoint(i));return{id:i,bitmap:new t.r({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}}}_createTinySDF(e){const t=e?e.split(","):[];t.push("sans-serif");const r=t.map(e=>/[-\w]+/.test(e)?e:`'${CSS.escape(e)}'`).join(",");return new P.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:r,fontWeight:this._fontWeight(t[0]),fontStyle:this._fontStyle(t[0]),lang:this.lang})}_fontStyle(e){return/italic/i.test(e)?"italic":/oblique/i.test(e)?"oblique":"normal"}_fontWeight(e){const t={thin:100,hairline:100,"extra light":200,"ultra light":200,light:300,normal:400,regular:400,medium:500,semibold:600,demibold:600,bold:700,"extra bold":800,"ultra bold":800,black:900,heavy:900,"extra black":950,"ultra black":950};let r;for(const[i,n]of Object.entries(t))new RegExp(`\\b${i}\\b`,"i").test(e)&&(r=`${n}`);return r}destroy(){for(const e in this.entries){const t=this.entries[e];t.tinySDF&&(t.tinySDF=null),t.ideographTinySDF&&(t.ideographTinySDF=null),t.glyphs={},t.requests={},t.ranges={}}this.entries={}}}P.loadGlyphRange=function(e,r,i,n){return t._(this,void 0,void 0,function*(){const o=256*r,a=o+255,s=n.transformRequest(i.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: ${r}, ${o}-${a}`);const c={};for(const e of t.o(l.data))c[e.id]=e;return c})},P.TinySDF=class{constructor({fontSize:e=24,buffer:t=3,radius:r=8,cutoff:i=.25,fontFamily:n="sans-serif",fontWeight:o="normal",fontStyle:a="normal",lang:s=null}={}){this.buffer=t,this.cutoff=i,this.radius=r,this.lang=s;const l=this.size=e+4*t,c=this._createCanvas(l),u=this.ctx=c.getContext("2d",{willReadFrequently:!0});u.font=`${a} ${o} ${e}px ${n}`,u.textBaseline="alphabetic",u.textAlign="left",u.fillStyle="black",this.gridOuter=new Float64Array(l*l),this.gridInner=new Float64Array(l*l),this.f=new Float64Array(l),this.z=new Float64Array(l+1),this.v=new Uint16Array(l)}_createCanvas(e){const t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){const{width:t,actualBoundingBoxAscent:r,actualBoundingBoxDescent:i,actualBoundingBoxLeft:n,actualBoundingBoxRight:o}=this.ctx.measureText(e),a=Math.ceil(r),s=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o-n))),l=Math.min(this.size-this.buffer,a+Math.ceil(i)),c=s+2*this.buffer,u=l+2*this.buffer,h=Math.max(c*u,0),d=new Uint8ClampedArray(h),p={data:d,width:c,height:u,glyphWidth:s,glyphHeight:l,glyphTop:a,glyphLeft:0,glyphAdvance:t};if(0===s||0===l)return p;const{ctx:f,buffer:m,gridInner:g,gridOuter:_}=this;this.lang&&(f.lang=this.lang),f.clearRect(m,m,s,l),f.fillText(e,m,m+a);const y=f.getImageData(m,m,s,l);_.fill(T,0,h),g.fill(0,0,h);for(let v=0;v<l;v++)for(let e=0;e<s;e++){const t=y.data[4*(v*s+e)+3]/255;if(0===t)continue;const r=(v+m)*c+e+m;if(1===t)_[r]=0,g[r]=T;else{const e=.5-t;_[r]=e>0?e*e:0,g[r]=e<0?e*e:0}}S(_,0,0,c,u,c,this.f,this.v,this.z),S(g,m,m,s,l,c,this.f,this.v,this.z);for(let v=0;v<h;v++){const e=Math.sqrt(_[v])-Math.sqrt(g[v]);d[v]=Math.round(255-255*(e/this.radius+this.cutoff))}return p}};class k{constructor(){this.specification=t.u.light.position}possiblyEvaluate(e,r){return t.F(e.expression.evaluate(r))}interpolate(e,r,i){return{x:t.G.number(e.x,r.x,i),y:t.G.number(e.y,r.y,i),z:t.G.number(e.z,r.z,i)}}}let A;class C extends t.E{constructor(e){super(),A=A||new t.t({anchor:new t.D(t.u.light.anchor),position:new k,color:new t.D(t.u.light.color),intensity:new t.D(t.u.light.intensity)}),this._transitionable=new t.x(A,void 0),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,r={}){if(!this._validate(t.y,e,r))for(const i in e){const r=e[i];i.endsWith(t.z)?this._transitionable.setTransition(i.slice(0,-t.z.length),r):this._transitionable.setValue(i,r)}}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,r,i){return(!i||!1!==i.validate)&&t.B(this,e.call(t.C,{value:r,style:{glyphs:!0,sprite:!0},styleSpec:t.u}))}}const M=new t.t({"sky-color":new t.D(t.u.sky["sky-color"]),"horizon-color":new t.D(t.u.sky["horizon-color"]),"fog-color":new t.D(t.u.sky["fog-color"]),"fog-ground-blend":new t.D(t.u.sky["fog-ground-blend"]),"horizon-fog-blend":new t.D(t.u.sky["horizon-fog-blend"]),"sky-horizon-blend":new t.D(t.u.sky["sky-horizon-blend"]),"atmosphere-blend":new t.D(t.u.sky["atmosphere-blend"])});class D extends t.E{constructor(e){super(),this._transitionable=new t.x(M,void 0),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new t.H(0))}setSky(e,r={}){if(!this._validate(t.J,e,r)){e||(e={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const r in e){const i=e[r];r.endsWith(t.z)?this._transitionable.setTransition(r.slice(0,-t.z.length),i):this._transitionable.setValue(r,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,r,i={}){return!1!==(null==i?void 0:i.validate)&&t.B(this,e.call(t.C,t.e({value:r,style:{glyphs:!0,sprite:!0},styleSpec:t.u})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}}class R{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 r=e.join(",")+String(t);return this.dashEntry[r]||(this.dashEntry[r]=this.addDash(e,t)),this.dashEntry[r]}getDashRanges(e,t,r){const i=[];let n=e.length%2==1?-e[e.length-1]*r:0,o=e[0]*r,a=!0;i.push({left:n,right:o,isDash:a,zeroLength:0===e[0]});let s=e[0];for(let l=1;l<e.length;l++){a=!a;const t=e[l];n=s*r,s+=t,o=s*r,i.push({left:n,right:o,isDash:a,zeroLength:0===t})}return i}addRoundDash(e,t,r){const i=t/2;for(let n=-r;n<=r;n++){const t=this.width*(this.nextRow+r+n);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 d=n/r*(i+1);if(a.isDash){const e=i-Math.abs(d);h=Math.sqrt(u*u+e*e)}else h=i-Math.sqrt(u*u+d*d);this.data[t+s]=Math.max(0,Math.min(255,h+128))}}}addRegularDash(e){for(let a=e.length-1;a>=0;--a){const t=e[a],r=e[a+1];t.zeroLength?e.splice(a,1):r&&r.isDash===t.isDash&&(r.left=t.left,e.splice(a,1))}const t=e[0],r=e[e.length-1];t.isDash===r.isDash&&(t.left=r.left-this.width,r.right=t.right+this.width);const i=this.width*this.nextRow;let n=0,o=e[n];for(let a=0;a<this.width;a++){a/o.right>1&&(o=e[++n]);const t=Math.abs(a-o.left),r=Math.abs(a-o.right),s=Math.min(t,r);this.data[i+a]=Math.max(0,Math.min(255,(o.isDash?s:-s)+128))}}addDash(e,r){const i=r?7:0,n=2*i+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);r?this.addRoundDash(n,t,i):this.addRegularDash(n)}const a={y:this.nextRow+i,height:2*i,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 L="maplibre_preloaded_worker_pool";class F{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<F.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[L]}numActive(){return Object.keys(this.active).length}}const O=Math.floor(s.hardwareConcurrency/2);let z,B;function N(){return z||(z=new F),z}F.workerCount=t.K(globalThis)?Math.max(Math.min(O,3),1):1;class j{constructor(e,r){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=r;const i=this.workerPool.acquire(r);for(let n=0;n<i.length;n++){const e=new t.L(i[n],r);e.name=`Worker ${n}`,this.actors.push(e)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,t){const r=[];for(const i of this.actors)r.push(i.sendAsync({type:e,data:t}));return Promise.all(r)}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 r of this.actors)r.registerMessageHandler(e,t)}unregisterMessageHandler(e){for(const t of this.actors)t.unregisterMessageHandler(e)}}function V(){return B||(B=new j(N(),t.M),B.registerMessageHandler("GR",(e,r,i)=>t.m(r,i))),B}function U(e,r){const i=t.N();return t.O(i,i,[1,1,0]),t.Q(i,i,[.5*e.width,.5*e.height,1]),e.calculatePosMatrix?t.S(i,i,e.calculatePosMatrix(r.toUnwrapped())):i}function G(e,t,r,i,n,o,a){var s;const l=function(e,t,r){if(e)for(const i of e){const e=t[i];if(e&&e.source===r&&"fill-extrusion"===e.type)return!0}else for(const i in t){const e=t[i];if(e.source===r&&"fill-extrusion"===e.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(i,c,l);u.sort(q);const h=[];for(const d of u)h.push({wrappedTileID:d.tileID.wrapped().key,queryResults:d.tile.queryRenderedFeatures(t,r,e.getState(),d.queryGeometry,d.cameraQueryGeometry,d.scale,n,o,c,U(o,d.tileID),a?(e,t)=>a(d.tileID,e,t):void 0)});return function(e,t){for(const r in e)for(const i of e[r])$(i,t);return e}(function(e){const t={},r={};for(const i of e){const e=i.queryResults,n=i.wrappedTileID,o=r[n]=r[n]||{};for(const r in e){const i=e[r],n=o[r]=o[r]||{},a=t[r]=t[r]||[];for(const e of i)n[e.featureIndex]||(n[e.featureIndex]=!0,a.push(e))}}return t}(h),e)}function q(e,t){const r=e.tileID,i=t.tileID;return r.overscaledZ-i.overscaledZ||r.canonical.y-i.canonical.y||r.wrap-i.wrap||r.canonical.x-i.canonical.x}function $(e,t){const r=e.feature,i=t.getFeatureState(r.layer["source-layer"],r.id);r.source=r.layer.source,r.layer["source-layer"]&&(r.sourceLayer=r.layer["source-layer"]),r.state=i}function W(e,r,i){return t._(this,void 0,void 0,function*(){let n=e;if(e.url?n=(yield t.j(r.transformRequest(e.url,"Source"),i)).data:yield s.frameAsync(i),!n)return null;const o=t.U(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 Z{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.V?new t.V(e.lng,e.lat):t.V.convert(e),this}setSouthWest(e){return this._sw=e instanceof t.V?new t.V(e.lng,e.lat):t.V.convert(e),this}extend(e){const r=this._sw,i=this._ne;let n,o;if(e instanceof t.V)n=e,o=e;else{if(!(e instanceof Z))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(Z.convert(e)):this.extend(t.V.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(t.V.convert(e)):this;if(n=e._sw,o=e._ne,!n||!o)return this}return r||i?(r.lng=Math.min(n.lng,r.lng),r.lat=Math.min(n.lat,r.lat),i.lng=Math.max(o.lng,i.lng),i.lat=Math.max(o.lat,i.lat)):(this._sw=new t.V(n.lng,n.lat),this._ne=new t.V(o.lng,o.lat)),this}getCenter(){return new t.V((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.V(this.getWest(),this.getNorth())}getSouthEast(){return new t.V(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:r,lat:i}=t.V.convert(e);let n=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=i&&i<=this._ne.lat&&n}intersects(e){if((e=Z.convert(e)).getNorth()<this.getSouth()||e.getSouth()>this.getNorth())return!1;const r=t.W(this.getWest(),-180,180),i=t.W(this.getEast(),-180,180),n=t.W(e.getWest(),-180,180),o=t.W(e.getEast(),-180,180),a=r>i,s=n>o;return!(!a||!s)||(a?o>=r||n<=i:s?i>=n||r<=o:!(n>i||o<r))}static convert(e){return e instanceof Z?e:e?new Z(e):e}static fromLngLat(e,r=0){const i=360*r/40075017,n=i/Math.cos(Math.PI/180*e.lat);return new Z(new t.V(e.lng-n,e.lat-i),new t.V(e.lng+n,e.lat+i))}adjustAntiMeridian(){const e=new t.V(this._sw.lng,this._sw.lat),r=new t.V(this._ne.lng,this._ne.lat);return new Z(e,e.lng>r.lng?new t.V(r.lng+360,r.lat):r)}}class H{constructor(e,t,r){this.bounds=Z.convert(this.validateBounds(e)),this.minzoom=t||0,this.maxzoom=r||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 r=Math.pow(2,e.z),i=Math.floor(t.Y(this.bounds.getWest())*r),n=Math.floor(t.X(this.bounds.getNorth())*r),o=Math.ceil(t.Y(this.bounds.getEast())*r),a=Math.ceil(t.X(this.bounds.getSouth())*r);return e.x>=i&&e.x<o&&e.y>=n&&e.y<a}}class X extends t.E{constructor(e,r,i,n){if(super(),this.id=e,this.dispatcher=i,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.U(r,["url","scheme","tileSize","promoteId","encoding"])),this._options=t.e({type:"vector"},r),this._collectResourceTiming=r.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 W(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.tileManagers[this.id].clearTiles(),e&&(t.e(this,e),e.bounds&&(this.tileBounds=new H(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._loaded=!0,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),r={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,encoding:this.encoding,overzoomParameters:this._getOverzoomParameters(e)};r.request.collectResourceTiming=this._collectResourceTiming;let i="RT";if(e.actor&&"expired"!==e.state){if("loading"===e.state)return new Promise((t,r)=>{e.reloadPromise={resolve:t,reject:r}})}else e.actor=this.dispatcher.getActor(),i="LT";e.abortController=new AbortController;try{const t=yield e.actor.sendAsync({type:i,data:r},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)}})}_getOverzoomParameters(e){if(e.tileID.canonical.z<=this.maxzoom)return;if(void 0===this.map._zoomLevelsToOverscale)return;const t=e.tileID.scaledTo(this.maxzoom).canonical,r=t.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:t,overzoomRequest:this.map._requestManager.transformRequest(r,"Tile")}}_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 Y extends t.E{constructor(e,r,i,n){super(),this.id=e,this.dispatcher=i,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"},r),t.e(this,t.U(r,["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 r=yield W(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,r&&(t.e(this,r),r.bounds&&(this.tileBounds=new H(r.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._loaded=!0,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 r=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{const i=yield _.getImage(this.map._requestManager.transformRequest(r,"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 r=this.map.painter.context,n=r.gl,o=i.data;e.texture=this.map.painter.getTileTexture(o.width),e.texture?e.texture.update(o,{useMipmap:!0}):(e.texture=new t.T(r,o,n.RGBA,{useMipmap:!0}),e.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE,n.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 J extends Y{constructor(e,r,i,n){super(e,r,i,n),this.type="raster-dem",this.maxzoom=22,this._options=t.e({type:"raster-dem"},r),this.encoding=r.encoding||"mapbox",this.redFactor=r.redFactor,this.greenFactor=r.greenFactor,this.blueFactor=r.blueFactor,this.baseShift=r.baseShift}loadTile(e){return t._(this,void 0,void 0,function*(){const r=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i=this.map._requestManager.transformRequest(r,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{const r=yield _.getImage(i,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(r&&r.data){const i=r.data;this.map._refreshExpiredTiles&&(r.cacheControl||r.expires)&&e.setExpiryData({cacheControl:r.cacheControl,expires:r.expires});const n=t.b(i)&&t.Z()?i:yield this.readImageNow(i),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.$()){const r=e.width+2,i=e.height+2;try{return new t.R({width:r,height:i},yield t.a0(e,-1,-1,r,i))}catch(e){}}return s.getImageData(e,1)})}_getNeighboringTiles(e){const r=e.canonical,i=Math.pow(2,r.z),n=(r.x-1+i)%i,o=0===r.x?e.wrap-1:e.wrap,a=(r.x+1+i)%i,s=r.x+1===i?e.wrap+1:e.wrap,l={};return l[new t.a1(e.overscaledZ,o,r.z,n,r.y).key]={backfilled:!1},l[new t.a1(e.overscaledZ,s,r.z,a,r.y).key]={backfilled:!1},r.y>0&&(l[new t.a1(e.overscaledZ,o,r.z,n,r.y-1).key]={backfilled:!1},l[new t.a1(e.overscaledZ,e.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},l[new t.a1(e.overscaledZ,s,r.z,a,r.y-1).key]={backfilled:!1}),r.y+1<i&&(l[new t.a1(e.overscaledZ,o,r.z,n,r.y+1).key]={backfilled:!1},l[new t.a1(e.overscaledZ,e.wrap,r.z,r.x,r.y+1).key]={backfilled:!1},l[new t.a1(e.overscaledZ,s,r.z,a,r.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}}))})}}function K(e){return"GeometryCollection"===e.type?e.geometries.map(e=>e.coordinates).flat(1/0):e.coordinates.flat(1/0)}function Q(e){const t=new Z;let r;switch(e.type){case"FeatureCollection":r=e.features.map(e=>K(e.geometry)).flat(1/0);break;case"Feature":r=K(e.geometry);break;default:r=K(e)}if(0==r.length)return t;for(let i=0;i<r.length-1;i+=2)t.extend([r[i],r[i+1]]);return t}class ee extends t.E{constructor(e,r,i,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._isUpdatingWorker=!1,this._pendingWorkerUpdate={data:r.data},this.actor=i.getActor(),this.setEventedParent(n),this._data="string"==typeof r.data?{url:r.data}:{geojson:r.data},this._options=t.e({},r),this._collectResourceTiming=r.collectResourceTiming,void 0!==r.maxzoom&&(this.maxzoom=r.maxzoom),r.type&&(this.type=r.type),r.attribution&&(this.attribution=r.attribution),this.promoteId=r.promoteId,void 0!==r.clusterMaxZoom&&this.maxzoom<=r.clusterMaxZoom&&t.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${r.clusterMaxZoom}".`),this.workerOptions=t.e({source:this.id,cluster:r.cluster||!1,geojsonVtOptions:{buffer:this._pixelsToTileUnits(void 0!==r.buffer?r.buffer:128),tolerance:this._pixelsToTileUnits(void 0!==r.tolerance?r.tolerance:.375),extent:t.a4,maxZoom:this.maxzoom,lineMetrics:r.lineMetrics||!1,generateId:r.generateId||!1},superclusterOptions:{maxZoom:this._getClusterMaxZoom(r.clusterMaxZoom),minPoints:Math.max(2,r.clusterMinPoints||2),extent:t.a4,radius:this._pixelsToTileUnits(r.clusterRadius||50),log:!1,generateId:r.generateId||!1},clusterProperties:r.clusterProperties,filter:r.filter},r.workerOptions),"string"==typeof this.promoteId&&(this.workerOptions.promoteId=this.promoteId)}_hasPendingWorkerUpdate(){return void 0!==this._pendingWorkerUpdate.data||void 0!==this._pendingWorkerUpdate.diff||this._pendingWorkerUpdate.optionsChanged}_pixelsToTileUnits(e){return e*(t.a4/this.tileSize)}_getClusterMaxZoom(e){const r=e?Math.round(e):this.maxzoom-1;return Number.isInteger(e)||void 0===e||t.w(`Integer expected for option 'clusterMaxZoom': provided value "${e}" rounded to "${r}"`),r}load(){return t._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(e){this.map=e,this.load()}setData(e,t){this._data="string"==typeof e?{url:e}:{geojson:e},this._pendingWorkerUpdate={data:e};const r=this._updateWorkerData();return t?r:this}updateData(e,r){this._pendingWorkerUpdate.diff=t.a5(this._pendingWorkerUpdate.diff,e);const i=this._updateWorkerData();return r?i: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})})}getBounds(){return t._(this,void 0,void 0,function*(){return Q(yield this.getData())})}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,void 0!==e.clusterRadius&&(this.workerOptions.superclusterOptions.radius=this._pixelsToTileUnits(e.clusterRadius)),void 0!==e.clusterMaxZoom&&(this.workerOptions.superclusterOptions.maxZoom=this._getClusterMaxZoom(e.clusterMaxZoom)),this._pendingWorkerUpdate.optionsChanged=!0,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,r){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:t,offset:r}})}_updateWorkerData(){return t._(this,void 0,void 0,function*(){if(this._isUpdatingWorker)return;if(!this._hasPendingWorkerUpdate())return void t.w(`No pending worker updates for GeoJSONSource ${this.id}.`);const{data:e,diff:r}=this._pendingWorkerUpdate,i=t.e({type:this.type},this.workerOptions);e?("string"==typeof e?(i.request=this.map._requestManager.transformRequest(s.resolveURL(e),"Source"),i.request.collectResourceTiming=this._collectResourceTiming):i.data=e,this._pendingWorkerUpdate.data=void 0):r&&(i.dataDiff=r,this._pendingWorkerUpdate.diff=void 0),this._pendingWorkerUpdate.optionsChanged=void 0,this._isUpdatingWorker=!0,this.fire(new t.l("dataloading",{dataType:"source"}));try{const e=yield this.actor.sendAsync({type:"LD",data:i});if(this._isUpdatingWorker=!1,this._removed||e.abandoned)return void this.fire(new t.l("dataabort",{dataType:"source"}));e.applyDiff?this._applyDiff(r):this._data={geojson:e.data};let n=null;e.resourceTiming&&e.resourceTiming[this.id]&&(n=e.resourceTiming[this.id].slice(0));const o={dataType:"source"};this._collectResourceTiming&&n&&n.length>0&&t.e(o,{resourceTiming:n}),this.fire(new t.l("data",Object.assign(Object.assign({},o),{sourceDataType:"metadata"}))),this.fire(new t.l("data",Object.assign(Object.assign({},o),{sourceDataType:"content",shouldReloadTileOptions:this._getShouldReloadTileOptions(r)})))}catch(e){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new t.l("dataabort",{dataType:"source"}));this.fire(new t.k(e))}finally{this._hasPendingWorkerUpdate()&&this._updateWorkerData()}})}_applyDiff(e){const r="string"==typeof this.promoteId?this.promoteId:void 0;this._data.url||this._data.updateable||!t.a6(this._data.geojson,r)||(this._data={updateable:t.a7(this._data.geojson,r)}),e&&this._data.updateable?t.a8(this._data.updateable,e,r):t.w("Cannot apply GeoJSONSource#updateData due to internal error")}_getShouldReloadTileOptions(e){if(this._options.cluster||!e||e.removeAll)return;const{add:r=[],update:i=[],remove:n=[]}=e||{},o=new Set([...i.map(e=>e.id),...n]);for(const a of o.values())if("number"!=typeof a&&null==this.promoteId)return void t.w(`GeoJSONSource "${this.id}": updateData is slower when using string GeoJSON feature IDs (e.g. "${a}"). Consider using promoteId or numeric IDs for better performance.`);return{nextBounds:[...i.map(e=>e.newGeometry),...r.map(e=>e.geometry)].filter(Boolean).map(e=>Q(e)),prevIds:o}}shouldReloadTile(e,{nextBounds:r,prevIds:i}){if(!e.latestFeatureIndex)return"unloaded"!==e.state;const n=e.latestFeatureIndex.loadVTLayers();for(let l=0;l<e.latestFeatureIndex.featureIndexArray.length;l++){const r=e.latestFeatureIndex.featureIndexArray.get(l),o=n[t.a9].feature(r.featureIndex),a=e.latestFeatureIndex.getId(o,t.a9);if(i.has(a))return!0}const{buffer:o,extent:a}=this.workerOptions.geojsonVtOptions,s=function({x:e,y:r,z:i},n=0){const o=t.a2((e-n)/Math.pow(2,i)),a=t.a3((r+1+n)/Math.pow(2,i)),s=t.a2((e+1+n)/Math.pow(2,i)),l=t.a3((r-n)/Math.pow(2,i));return new Z([o,a],[s,l])}(e.tileID.canonical,o/a);for(const t of r)if(s.intersects(t))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}loadTile(e){return t._(this,void 0,void 0,function*(){const t=e.actor?"RT":"LT";e.actor=this.actor;const r={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 i=yield this.actor.sendAsync({type:t,data:r},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(i,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.updateable?{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}:this._data.url||this._data.geojson})}hasTransition(){return!1}}class te extends t.E{constructor(e,t,r,i){super(),this.flippedWindingOrder=!1,this.id=e,this.dispatcher=r,this.coordinates=t.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(i),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 _.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 r=e.map(t.aa.fromLngLat);var i;return this.tileID=function(e){const r=t.ab.fromPoints(e),i=r.width(),n=r.height(),o=Math.max(i,n),a=Math.max(0,Math.floor(-Math.log(o)/Math.LN2)),s=Math.pow(2,a);return new t.ad(a,Math.floor((r.minX+r.maxX)/2*s),Math.floor((r.minY+r.maxY)/2*s))}(r),this.terrainTileRanges=this._getOverlappingTileRanges(r),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=r.map(e=>this.tileID.getTilePoint(e)._round()),this.flippedWindingOrder=((i=this.tileCoords)[1].x-i[0].x)*(i[2].y-i[0].y)-(i[1].y-i[0].y)*(i[2].x-i[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,r=e.gl;this.texture||(this.texture=new t.T(e,this.image,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE));let i=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,i=!0)}i&&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){const{minX:r,minY:i,maxX:n,maxY:o}=t.ab.fromPoints(e),a={};for(let s=0;s<=t.ac;s++){const e=Math.pow(2,s),t=Math.floor(r*e),l=Math.floor(i*e),c=Math.floor(n*e),u=Math.floor(o*e);a[s]={minTileX:t,minTileY:l,maxTileX:c,maxTileY:u}}return a}}class re extends te{constructor(e,t,r,i){super(e,t,r,i),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.ae(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 r=this.video.seekable;e<r.start(0)||e>r.end(0)?this.fire(new t.k(new t.af(`sources.${this.id}`,null,`Playback for this video can be set only between the ${r.start(0)} and ${r.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,r=e.gl;this.texture?this.video.paused||(this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),r.texSubImage2D(r.TEXTURE_2D,0,0,0,r.RGBA,r.UNSIGNED_BYTE,this.video)):(this.texture=new t.T(e,this.video,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE));let i=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,i=!0)}i&&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 ie extends te{constructor(e,r,i,n){super(e,r,i,n),r.coordinates?Array.isArray(r.coordinates)&&4===r.coordinates.length&&!r.coordinates.some(e=>!Array.isArray(e)||2!==e.length||e.some(e=>"number"!=typeof e))||this.fire(new t.k(new t.af(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.k(new t.af(`sources.${e}`,null,'missing required property "coordinates"'))),r.animate&&"boolean"!=typeof r.animate&&this.fire(new t.k(new t.af(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),r.canvas?"string"==typeof r.canvas||r.canvas instanceof HTMLCanvasElement||this.fire(new t.k(new t.af(`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.af(`sources.${e}`,null,'missing required property "canvas"'))),this.options=r,this.animate=void 0===r.animate||r.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 r=this.map.painter.context,i=r.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new t.T(r,this.canvas,i.RGBA,{premultiply:!0});let n=!1;for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture,n=!0)}n&&this.fire(new t.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",animate:this.animate,canvas:this.options.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 ne={},oe=e=>{switch(e){case"geojson":return ee;case"image":return te;case"raster":return Y;case"raster-dem":return J;case"vector":return X;case"video":return re;case"canvas":return ie}return ne[e]},ae="RTLPluginLoaded";class se extends t.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=V()}_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=s.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(ae))})}lazyLoad(){"unavailable"===this.status?this.status="requested":"deferred"===this.status&&this._requestImport()}}let le=null;function ce(){return le||(le=new se),le}var ue,he;!function(e){e[e.Base=0]="Base",e[e.Parent=1]="Parent"}(ue||(ue={})),function(e){e[e.Departing=0]="Departing",e[e.Incoming=1]="Incoming"}(he||(he={}));class de{constructor(e,r){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=e,this.uid=t.ag(),this.uses=0,this.tileSize=r,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"}isRenderable(e){return this.hasData()&&(!this.fadeEndTime||this.fadeOpacity>0)&&(e||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:e,fadingDirection:t,fadingParentID:r,fadeEndTime:i}){this.resetFadeLogic(),this.fadingRole=e,this.fadingDirection=t,this.fadingParentID=r,this.fadeEndTime=i}setSelfFadeLogic(e){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=e}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=c(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,r,i){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.latestFeatureIndex.encoding=e.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(e,t){const r={};if(!t)return r;for(const i of e){const e=i.layerIds.map(e=>t.getLayer(e)).filter(Boolean);if(0!==e.length){i.layers=e,i.stateDependentLayerIds&&(i.stateDependentLayers=i.stateDependentLayerIds.map(t=>e.filter(e=>e.id===t)[0]));for(const t of e)r[t.id]=i}}return r}(e.buckets,null==r?void 0:r.style),this.hasSymbolBuckets=!1;for(const e in this.buckets){const r=this.buckets[e];if(r instanceof t.ai){if(this.hasSymbolBuckets=!0,!i)break;r.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const e in this.buckets){const r=this.buckets[e];if(r instanceof t.ai&&r.hasRTLText){this.hasRTLText=!0,ce().lazyLoad();break}}this.queryPadding=0;for(const e in this.buckets){const t=this.buckets[e];this.queryPadding=Math.max(this.queryPadding,r.style.getLayer(e).queryRadius(t))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage),this.dashPositions=e.dashPositions}else this.collisionBoxArray=new t.ah}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.dashPositions&&(this.dashPositions=null),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(const t in this.buckets){const r=this.buckets[t];r.uploadPending()&&r.upload(e)}const r=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new t.T(e,this.imageAtlas.image,r.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new t.T(e,this.glyphAtlasImage,r.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,r,i,n,o,a,s,l,c,u){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:i,cameraQueryGeometry:n,scale:o,tileSize:this.tileSize,pixelPosMatrix:c,transform:s,params:a,queryPadding:this.queryPadding*l,getElevation:u},e,t,r):{}}querySourceFeatures(e,r){const i=this.latestFeatureIndex;if(!i||!i.rawTileData)return;const n=i.loadVTLayers(),o=r&&r.sourceLayer?r.sourceLayer:"",a=n[t.a9]||n[o];if(!a)return;const s=t.aj(null==r?void 0:r.filter,null==r?void 0:r.globalState),{z:l,x:c,y:u}=this.tileID.canonical,h={z:l,x:c,y:u};for(let d=0;d<a.length;d++){const r=a.feature(d);if(s.needGeometry){const e=t.ak(r,!0);if(!s.filter(new t.H(this.tileID.overscaledZ),e,this.tileID.canonical))continue}else if(!s.filter(new t.H(this.tileID.overscaledZ),r))continue;const n=i.getId(r,o),p=new t.al(r,l,c,u,n);p.tile=h,e.push(p)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){const r=this.expirationTime;if(e.cacheControl){const r=t.am(e.cacheControl);r["max-age"]&&(this.expirationTime=Date.now()+1e3*r["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(r)if(this.expirationTime<r)t=!0;else{const i=this.expirationTime-r;i?this.expirationTime=e+Math.max(i,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,r){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||0===Object.keys(e).length)return;const i=this.latestFeatureIndex.loadVTLayers();for(const n in this.buckets){if(!r.style.hasLayer(n))continue;const o=this.buckets[n],a=o.layers[0].sourceLayer||t.a9,s=i[a],l=e[a];if(!s||!l||0===Object.keys(l).length)continue;o.update(l,s,this.imageAtlas&&this.imageAtlas.patternPositions||{},this.dashPositions||{});const c=r&&r.style&&r.style.getLayer(n);c&&(this.queryPadding=Math.max(this.queryPadding,c.queryRadius(o)))}}holdingForSymbolFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<c()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(e){this.symbolFadeHoldUntil=c()+e}setDependencies(e,t){const r={};for(const i of t)r[i]=!0;this.dependencies[e]=r}hasDependency(e,t){for(const r of e){const e=this.dependencies[r];if(e)for(const r of t)if(e[r])return!0}return!1}}class pe{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,r,i){const n=String(r);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][n]=this.stateChanges[e][n]||{},t.e(this.stateChanges[e][n],i),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])i[t]||(this.deletedStates[e][n][t]=null)}else for(const t in i)this.deletedStates[e]&&this.deletedStates[e][n]&&null===this.deletedStates[e][n][t]&&delete this.deletedStates[e][n][t]}removeFeatureState(e,t,r){if(null===this.deletedStates[e])return;const i=String(t);if(this.deletedStates[e]=this.deletedStates[e]||{},r&&void 0!==t)null!==this.deletedStates[e][i]&&(this.deletedStates[e][i]=this.deletedStates[e][i]||{},this.deletedStates[e][i][r]=null);else if(void 0!==t)if(this.stateChanges[e]&&this.stateChanges[e][i])for(r in this.deletedStates[e][i]={},this.stateChanges[e][i])this.deletedStates[e][i][r]=null;else this.deletedStates[e][i]=null;else this.deletedStates[e]=null}getState(e,r){const i=String(r),n=t.e({},(this.state[e]||{})[i],(this.stateChanges[e]||{})[i]);if(null===this.deletedStates[e])return{};if(this.deletedStates[e]){const t=this.deletedStates[e][r];if(null===t)return{};for(const e in t)delete n[e]}return n}initializeTileState(e,t){e.setFeatureState(this.state,t)}coalesceChanges(e,r){const i={};for(const n in this.stateChanges){this.state[n]=this.state[n]||{};const e={};for(const r in this.stateChanges[n])this.state[n][r]||(this.state[n][r]={}),t.e(this.state[n][r],this.stateChanges[n][r]),e[r]=this.state[n][r];i[n]=e}for(const n in this.deletedStates){this.state[n]=this.state[n]||{};const e={};if(null===this.deletedStates[n])for(const t in this.state[n])e[t]={},this.state[n][t]={};else for(const t in this.deletedStates[n]){if(null===this.deletedStates[n][t])this.state[n][t]={};else for(const e of Object.keys(this.deletedStates[n][t]))delete this.state[n][t][e];e[t]=this.state[n][t]}i[n]=i[n]||{},t.e(i[n],e)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(i).length)for(const t in e)e[t].setFeatureState(i,r)}}const fe=89.25;function me(e,r){const i=t.an(r.lat,-t.ao,t.ao);return new t.P(t.Y(r.lng)*e,t.X(i)*e)}function ge(e,r){return new t.aa(r.x/e,r.y/e).toLngLat()}function _e(e){return e.cameraToCenterDistance*Math.min(.85*Math.tan(t.ap(90-e.pitch)),Math.tan(t.ap(fe-e.pitch)))}function ye(e,r){const i=e.canonical,n=r/t.aq(i.z),o=i.x+Math.pow(2,i.z)*e.wrap,a=t.ar(new Float64Array(16));return t.O(a,a,[o*n,i.y*n,0]),t.Q(a,a,[n/t.a4,n/t.a4,1]),a}function ve(e,r,i,n,o){const a=t.aa.fromLngLat(e,r),s=o*t.as(1,e.lat),l=s*Math.cos(t.ap(i)),c=Math.sqrt(s*s-l*l),u=c*Math.sin(t.ap(-n)),h=c*Math.cos(t.ap(-n));return new t.aa(a.x+u,a.y+h,a.z+l)}function be(e,t,r){const i=t.intersectsFrustum(e);if(!r||0===i)return i;const n=t.intersectsPlane(r);return 0===n?0:2===i&&2===n?2:1}function xe(e,t,r){let i=0;const n=(r-t)/10;for(let o=0;o<10;o++)i+=n*Math.pow(Math.cos(t+(o+.5)/10*(r-t)),e);return i}function we(e,r){return function(i,n,o,a,s){const l=2*((e-1)/t.at(Math.cos(t.ap(fe-s))/Math.cos(t.ap(fe)))-1),c=Math.acos(o/a),u=2*xe(l-1,0,t.ap(s/2)),h=Math.min(t.ap(fe),c+t.ap(s/2)),d=xe(l-1,Math.min(h,c-t.ap(s/2)),h),p=Math.atan(n/o),f=Math.hypot(n,o);let m=i;return m+=t.at(a/f/Math.max(.5,Math.cos(t.ap(s/2)))),m+=l*t.at(Math.cos(p))/2,m-=t.at(Math.max(1,d/u/r))/2,m}}const Te=we(9.314,3);function Se(e,r){const i=(r.roundZoom?Math.round:Math.floor)(e.zoom+t.at(e.tileSize/r.tileSize));return Math.max(0,i)}function Ee(e,r){const i=e.getCameraFrustum(),n=e.getClippingPlane(),o=e.screenPointToMercatorCoordinate(e.getCameraPoint()),a=t.aa.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,r),c=Se(e,r),u=r.minzoom||0,h=void 0!==r.maxzoom?r.maxzoom:e.maxZoom,d=Math.min(Math.max(0,c),h),p=Math.pow(2,d),f=[p*o.x,p*o.y,0],m=[p*a.x,p*a.y,0],g=Math.hypot(a.x-o.x,a.y-o.y),_=Math.abs(a.z-o.z),y=Math.hypot(g,_),v=e=>({zoom:0,x:0,y:0,wrap:e,fullyVisible:!1}),b=[],x=[];if(e.renderWorldCopies&&s.allowWorldCopies())for(let t=1;t<=3;t++)b.push(v(-t)),b.push(v(t));for(b.push(v(0));b.length>0;){const p=b.pop(),g=p.x,v=p.y;let w=p.fullyVisible;const T={x:g,y:v,z:p.zoom},S=s.getTileBoundingVolume(T,p.wrap,e.elevation,r);if(!w){const e=be(i,S,n);if(0===e)continue;w=2===e}const E=s.distanceToTile2d(o.x,o.y,T,S);let I=c;l&&(I=(r.calculateTileZoom||Te)(e.zoom+t.at(e.tileSize/r.tileSize),E,_,y,e.fov)),I=(r.roundZoom?Math.round:Math.floor)(I),I=Math.max(0,I);const P=Math.min(I,h);if(p.wrap=s.getWrap(a,T,p.wrap),p.zoom>=P){if(p.zoom<u)continue;const e=d-p.zoom,i=f[0]-.5-(g<<e),n=f[1]-.5-(v<<e),o=r.reparseOverscaled?Math.max(p.zoom,I):p.zoom;x.push({tileID:new t.a1(p.zoom===h?o:p.zoom,p.wrap,p.zoom,g,v),distanceSq:t.au([m[0]-.5-g,m[1]-.5-v]),tileDistanceToCamera:Math.sqrt(i*i+n*n)})}else for(let e=0;e<4;e++)b.push({zoom:p.zoom+1,x:(g<<1)+e%2,y:(v<<1)+(e>>1),wrap:p.wrap,fullyVisible:w})}return x.sort((e,t)=>e.distanceSq-t.distanceSq).map(e=>e.tileID)}const Ie=t.ab.fromPoints([new t.P(0,0),new t.P(t.a4,t.a4)]);class Pe extends t.E{constructor(e,r,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,r,i)=>{const n=new(oe(t.type))(e,t,r,i);if(n.id!==e)throw new Error(`Expected Source id to be ${e} instead of ${n.id}`);return n})(e,r,i,this),this._tiles={},this._cache=new t.av(0,e=>this._unloadTile(e)),this._timers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new pe,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}getState(){return this._state}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,r,i){return t._(this,void 0,void 0,function*(){try{yield this._source.loadTile(e),this._tileLoaded(e,r,i)}catch(r){e.state="errored",404!==r.status?this._source.fire(new t.k(r,{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 r=this._tiles[t];r.upload(e),r.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(ke).map(e=>e.key)}getRenderableIds(e){const r=[];for(const t in this._tiles)this._isIdRenderable(t,e)&&r.push(this._tiles[t]);return e?r.sort((e,r)=>{const i=e.tileID,n=r.tileID,o=new t.P(i.canonical.x,i.canonical.y)._rotate(-this.transform.bearingInRadians),a=new t.P(n.canonical.x,n.canonical.y)._rotate(-this.transform.bearingInRadians);return i.overscaledZ-n.overscaledZ||a.y-o.y||a.x-o.x}).map(e=>e.tileID.key):r.map(e=>e.tileID).sort(ke).map(e=>e.key)}hasRenderableParent(e){const t=e.overscaledZ-1;if(t>=this._source.minzoom){const r=this.getLoadedTile(e.scaledTo(t));if(r)return this._isIdRenderable(r.tileID.key)}return!1}_isIdRenderable(e,t=!1){var r;return null===(r=this._tiles[e])||void 0===r?void 0:r.isRenderable(t)}reload(e,t=void 0){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const r in this._tiles)t&&this._source.shouldReloadTile&&!this._source.shouldReloadTile(this._tiles[r],t)||(e?this._reloadTile(r,"expired"):"errored"!==this._tiles[r].state&&this._reloadTile(r,"reloading"))}}_reloadTile(e,r){return t._(this,void 0,void 0,function*(){const t=this._tiles[e];t&&("loading"!==t.state&&(t.state=r),yield this._loadTile(t,e,r))})}_tileLoaded(e,r,i){e.timeAdded=c(),e.selfFading&&(e.fadeEndTime=e.timeAdded+this._rasterFadeDuration),"expired"===i&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(r,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 i=0;i<t.length;i++){const n=t[i];if(e.neighboringTiles&&e.neighboringTiles[n]){const t=this.getTileByID(n);r(e,t),r(t,e)}}function r(e,t){e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0;let r=t.tileID.canonical.x-e.tileID.canonical.x;const i=t.tileID.canonical.y-e.tileID.canonical.y,n=Math.pow(2,e.tileID.canonical.z),o=t.tileID.key;0===r&&0===i||Math.abs(i)>1||(Math.abs(r)>1&&(1===Math.abs(r+n)?r+=n:1===Math.abs(r-n)&&(r-=n)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,r,i),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){const r=this._getLoadedDescendents(t),i=new Set;for(const n of t){const t=r[n.key];if(!(null==t?void 0:t.length)){i.add(n);continue}const o=n.overscaledZ+Pe.maxOverzooming,a=t.filter(e=>e.tileID.overscaledZ<=o);if(!a.length){i.add(n);continue}const s=Math.min(...a.map(e=>e.tileID.overscaledZ)),l=a.filter(e=>e.tileID.overscaledZ===s).map(e=>e.tileID);for(const r of l)e[r.key]=r;this._areDescendentsComplete(l,s,n.overscaledZ)||i.add(n)}return i}_getLoadedDescendents(e){var t;const r={};for(const i in this._tiles){const n=this._tiles[i];if(n.hasData())for(const i of e)n.tileID.isChildOf(i)&&(r[t=i.key]||(r[t]=[])).push(n)}return r}_areDescendentsComplete(e,t,r){return 1===e.length&&e[0].isOverscaled()?e[0].overscaledZ===t:Math.pow(4,t-r)===e.length}getLoadedTile(e){const t=this._tiles[e.key];return(null==t?void 0:t.hasData())?t:null}updateCacheSize(e){const r=Math.ceil(e.width/this._source.tileSize)+1,i=Math.ceil(e.height/this._source.tileSize)+1,n=Math.floor(r*i*(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 r in this._tiles){const i=this._tiles[r];i.tileID=i.tileID.unwrapTo(i.tileID.wrap+t),e[i.tileID.key]=i}this._tiles=e,this._resetTileReloadTimers()}}update(e,r){if(!this._sourceLoaded||this._paused)return;let i;this.transform=e,this.terrain=r,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this.used||this.usedForTerrain?this._source.tileID?i=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(e=>new t.a1(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y)):(i=Ee(e,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:"vector"===this._source.type&&void 0!==this.map._zoomLevelsToOverscale?e.maxZoom-this.map._zoomLevelsToOverscale:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:r,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(i=i.filter(e=>this._source.hasTile(e)))):i=[],this.usedForTerrain&&(i=this._addTerrainIdealTiles(i));const n=0===i.length&&!this._updated&&this._didEmitContent;this._updated=!0,n&&this.fire(new t.l("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const o=Se(e,this._source),a=this._updateRetainedTiles(i,o),s=Ae(this._source.type);s&&this._rasterFadeDuration>0&&!r&&this._updateFadingTiles(i,a),s?this._cleanUpRasterTiles(a):this._cleanUpVectorTiles(a)}_cleanUpRasterTiles(e){for(const t in this._tiles)e[t]||this._removeTile(t)}_cleanUpVectorTiles(e){for(const t in this._tiles){const r=this._tiles[t];e[t]?r.clearSymbolFadeHold():r.hasSymbolBuckets?r.holdingForSymbolFade()?r.symbolFadeFinished()&&this._removeTile(t):r.setSymbolHoldDuration(this.map._fadeDuration):this._removeTile(t)}}_addTerrainIdealTiles(e){const t=[];for(const r of e)if(r.canonical.z>this._source.minzoom){const e=r.scaledTo(r.canonical.z-1);t.push(e);const i=r.scaledTo(Math.max(this._source.minzoom,Math.min(r.canonical.z,5)));t.push(i)}return e.concat(t)}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForSymbolFade()&&this._removeTile(e)}_updateRetainedTiles(e,t){var r;const i=new Set;for(const l of e)this._addTile(l).hasData()||i.add(l);const n=e.reduce((e,t)=>(e[t.key]=t,e),{}),o=this._retainLoadedChildren(n,i),a={},s=Math.max(t-Pe.maxUnderzooming,this._source.minzoom);for(const l of o){let e=this._tiles[l.key],t=null==e?void 0:e.wasRequested();for(let i=l.overscaledZ-1;i>=s;--i){const o=l.scaledTo(i);if(a[o.key])break;if(a[o.key]=!0,e=this.getTile(o),!e&&t&&(e=this._addTile(o)),e){const i=e.hasData();if((i||!(null===(r=this.map)||void 0===r?void 0:r.cancelPendingTileRequestsWhileZooming)||t)&&(n[o.key]=o),t=e.wasRequested(),i)break}}}return n}_updateFadingTiles(e,r){const i=c(),n=t.aw(e);for(const t of e){const e=this._tiles[t.key];e.fadingDirection!==he.Departing&&0!==e.fadeOpacity||e.resetFadeLogic(),this._updateFadingAncestor(e,r,i)||this._updateFadingDescendents(e,r,i)||this._updateFadingEdge(e,n,i)||e.resetFadeLogic()}}_updateFadingAncestor(e,t,r){if(!e.hasData())return!1;const{tileID:i,fadingRole:n,fadingDirection:o,fadingParentID:a}=e;if(n===ue.Base&&o===he.Incoming&&a)return t[a.key]=a,!0;const s=Math.max(i.overscaledZ-this._maxFadingAncestorLevels,this._source.minzoom);for(let l=i.overscaledZ-1;l>=s;l--){const n=i.scaledTo(l),o=this.getLoadedTile(n);if(o)return e.setCrossFadeLogic({fadingRole:ue.Base,fadingDirection:he.Incoming,fadingParentID:o.tileID,fadeEndTime:r+this._rasterFadeDuration}),o.setCrossFadeLogic({fadingRole:ue.Parent,fadingDirection:he.Departing,fadeEndTime:r+this._rasterFadeDuration}),t[n.key]=n,!0}return!1}_updateFadingDescendents(e,t,r){if(!e.hasData())return!1;const i=e.tileID.children(this._source.maxzoom);let n=this._updateFadingChildren(e,i,t,r);if(n)return!0;for(const o of i){const i=o.children(this._source.maxzoom);this._updateFadingChildren(e,i,t,r)&&(n=!0)}return n}_updateFadingChildren(e,t,r,i){if(t[0].overscaledZ>=this._source.maxzoom)return!1;let n=!1;for(const o of t){const t=this.getLoadedTile(o);if(!t)continue;const{fadingRole:a,fadingDirection:s,fadingParentID:l}=t;a===ue.Base&&s===he.Departing&&l||(t.setCrossFadeLogic({fadingRole:ue.Base,fadingDirection:he.Departing,fadingParentID:e.tileID,fadeEndTime:i+this._rasterFadeDuration}),e.setCrossFadeLogic({fadingRole:ue.Parent,fadingDirection:he.Incoming,fadeEndTime:i+this._rasterFadeDuration})),r[o.key]=o,n=!0}return n}_updateFadingEdge(e,t,r){const i=e.tileID;return!!e.selfFading||!e.hasData()&&!!t.has(i)&&(e.setSelfFadeLogic(r+this._rasterFadeDuration),!0)}_addTile(e){let r=this._tiles[e.key];if(r)return r;r=this._cache.getAndRemove(e),r&&(r.resetFadeLogic(),this._setTileReloadTimer(e.key,r),r.tileID=e,this._state.initializeTileState(r,this.map?this.map.painter:null));const i=r;return r||(r=new de(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(r,e.key,r.state)),r.uses++,this._tiles[e.key]=r,i||this._source.fire(new t.l("dataloading",{tile:r,coord:r.tileID,dataType:"source"})),r}_setTileReloadTimer(e,t){this._clearTileReloadTimer(e);const r=t.getExpiryTimeout();r&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},r))}_clearTileReloadTimer(e){const t=this._timers[e];t&&(clearTimeout(t),delete this._timers[e])}_resetTileReloadTimers(){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])}refreshTiles(e){for(const t in this._tiles)(this._isIdRenderable(t)||"errored"==this._tiles[t].state)&&e.some(e=>e.equals(this._tiles[t].tileID.canonical))&&this._reloadTile(t,"expired")}_removeTile(e){const t=this._tiles[e];t&&(t.uses--,delete this._tiles[e],this._clearTileReloadTimer(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){"source"===e.dataType&&("metadata"!==e.sourceDataType?"content"===e.sourceDataType&&this._sourceLoaded&&!this._paused&&(this.reload(e.sourceDataChanged,e.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0):this._sourceLoaded=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,r,i){const n=[],o=this.transform;if(!o)return n;const a=o.getCoveringTilesDetailsProvider().allowWorldCopies(),s=i?o.getCameraQueryGeometry(e):e,l=e=>o.screenPointToMercatorCoordinate(e,this.terrain),c=this.transformBbox(e,l,!a),u=this.transformBbox(s,l,!a),h=this.getIds(),d=t.ab.fromPoints(u);for(let p=0;p<h.length;p++){const e=this._tiles[h[p]];if(e.holdingForSymbolFade())continue;const i=a?[e.tileID]:[e.tileID.unwrapTo(-1),e.tileID.unwrapTo(0)],s=Math.pow(2,o.zoom-e.tileID.overscaledZ),l=r*e.queryPadding*t.a4/e.tileSize/s;for(const r of i){const i=d.map(e=>r.getTilePoint(new t.aa(e.x,e.y)));if(i.expandBy(l),i.intersects(Ie)){const t=c.map(e=>r.getTilePoint(e)),i=u.map(e=>r.getTilePoint(e));n.push({tile:e,tileID:a?r:r.unwrapTo(0),queryGeometry:t,cameraQueryGeometry:i,scale:s})}}}return n}transformBbox(e,r,i){let n=e.map(r);if(i){const i=t.ab.fromPoints(e);i.shrinkBy(.001*Math.min(i.width(),i.height()));const o=i.map(r);t.ab.fromPoints(n).covers(o)||(n=n.map(e=>e.x>.5?new t.aa(e.x-1,e.y,e.z):e))}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(Ae(this._source.type)&&this._rasterFadeDuration>0){const e=c();for(const t in this._tiles)if(this._tiles[t].fadeEndTime>=e)return!0}return!1}setRasterFadeDuration(e){this._rasterFadeDuration=e}setFeatureState(e,r,i){this._state.updateState(e=e||t.a9,r,i)}removeFeatureState(e,r,i){this._state.removeFeatureState(e=e||t.a9,r,i)}getFeatureState(e,r){return this._state.getState(e=e||t.a9,r)}setDependencies(e,t,r){const i=this._tiles[e];i&&i.setDependencies(t,r)}reloadTilesForDependencies(e,t){for(const r in this._tiles)this._tiles[r].hasDependency(e,t)&&this._reloadTile(r,"reloading");this._cache.filter(r=>!r.hasDependency(e,t))}}function ke(e,t){const r=Math.abs(2*e.wrap)-+(e.wrap<0),i=Math.abs(2*t.wrap)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||i-r||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}function Ae(e){return"raster"===e||"image"===e||"video"===e}Pe.maxUnderzooming=10,Pe.maxOverzooming=3;class Ce{constructor(e,t){this.reset(e,t)}reset(e,t){this.points=e||[],this._distances=[0];for(let r=1;r<this.points.length;r++)this._distances[r]=this._distances[r-1]+this.points[r].dist(this.points[r-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.an(e,0,1);let r=1,i=this._distances[r];const n=e*this.paddedLength+this.padding;for(;i<n&&r<this._distances.length;)i=this._distances[++r];const o=r-1,a=this._distances[o],s=i-a,l=s>0?(n-a)/s:0;return this.points[o].mult(1-l).add(this.points[r].mult(l))}}function Me(e,t){let r=!0;return"always"===e||"never"!==e&&"never"!==t||(r=!1),r}class De{constructor(e,t,r){const i=this.boxCells=[],n=this.circleCells=[];this.xCellCount=Math.ceil(e/r),this.yCellCount=Math.ceil(t/r);for(let o=0;o<this.xCellCount*this.yCellCount;o++)i.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,r,i,n){this._forEachCell(t,r,i,n,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(r),this.bboxes.push(i),this.bboxes.push(n)}insertCircle(e,t,r,i){this._forEachCell(t-i,r-i,t+i,r+i,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(r),this.circles.push(i)}_insertBoxCell(e,t,r,i,n,o){this.boxCells[n].push(o)}_insertCircleCell(e,t,r,i,n,o){this.circleCells[n].push(o)}_query(e,t,r,i,n,o,a){if(r<0||e>this.width||i<0||t>this.height)return[];const s=[];if(e<=0&&t<=0&&this.width<=r&&this.height<=i){if(n)return[{key:null,x1:e,y1:t,x2:r,y2:i}];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],r=this.circles[3*e+1],i=this.circles[3*e+2];s.push({key:this.circleKeys[e],x1:t-i,y1:r-i,x2:t+i,y2:r+i})}}else this._forEachCell(e,t,r,i,this._queryCell,s,{hitTest:n,overlapMode:o,seenUids:{box:{},circle:{}}},a);return s}query(e,t,r,i){return this._query(e,t,r,i,!1,null)}hitTest(e,t,r,i,n,o){return this._query(e,t,r,i,!0,n,o).length>0}hitTestCircle(e,t,r,i,n){const o=e-r,a=e+r,s=t-r,l=t+r;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:i,circle:{x:e,y:t,radius:r},seenUids:{box:{},circle:{}}},n),c.length>0}_queryCell(e,t,r,i,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,d=this.boxKeys[a];if(e<=n[h+2]&&t<=n[h+3]&&r>=n[h+0]&&i>=n[h+1]&&(!s||s(d))&&(!c||!Me(u,d.overlapMode))&&(o.push({key:d,x1:n[h],y1:n[h+1],x2:n[h+2],y2:n[h+3]}),c))return!0}}const d=this.circleCells[n];if(null!==d){const n=this.circles;for(const a of d)if(!l.circle[a]){l.circle[a]=!0;const h=3*a,d=this.circleKeys[a];if(this._circleAndRectCollide(n[h],n[h+1],n[h+2],e,t,r,i)&&(!s||s(d))&&(!c||!Me(u,d.overlapMode))){const e=n[h],t=n[h+1],r=n[h+2];if(o.push({key:d,x1:e-r,y1:t-r,x2:e+r,y2:t+r}),c)return!0}}}return!1}_queryCellCircle(e,t,r,i,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 r=4*t,i=this.boxKeys[t];if(this._circleAndRectCollide(l.x,l.y,l.radius,e[r+0],e[r+1],e[r+2],e[r+3])&&(!s||s(i))&&!Me(u,i.overlapMode))return o.push(!0),!0}}const d=this.circleCells[n];if(null!==d){const e=this.circles;for(const t of d)if(!c.circle[t]){c.circle[t]=!0;const r=3*t,i=this.circleKeys[t];if(this._circlesCollide(e[r],e[r+1],e[r+2],l.x,l.y,l.radius)&&(!s||s(i))&&!Me(u,i.overlapMode))return o.push(!0),!0}}}_forEachCell(e,t,r,i,n,o,a,s){const l=this._convertToXCellCoord(e),c=this._convertToYCellCoord(t),u=this._convertToXCellCoord(r),h=this._convertToYCellCoord(i);for(let d=l;d<=u;d++)for(let l=c;l<=h;l++)if(n.call(this,e,t,r,i,this.xCellCount*l+d,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,r,i,n,o){const a=i-e,s=n-t,l=r+o;return l*l>a*a+s*s}_circleAndRectCollide(e,t,r,i,n,o,a){const s=(o-i)/2,l=Math.abs(e-(i+s));if(l>s+r)return!1;const c=(a-n)/2,u=Math.abs(t-(n+c));if(u>c+r)return!1;if(l<=s||u<=c)return!0;const h=l-s,d=u-c;return h*h+d*d<=r*r}}function Re(e,r,n){const o=t.N();if(!e){const{vecSouth:e,vecEast:t}=Fe(r),n=i();n[0]=t[0],n[1]=t[1],n[2]=e[0],n[3]=e[1],a=n,(d=(l=(s=n)[0])*(h=s[3])-(u=s[2])*(c=s[1]))&&(a[0]=h*(d=1/d),a[1]=-c*d,a[2]=-u*d,a[3]=l*d),o[0]=n[0],o[1]=n[1],o[4]=n[2],o[5]=n[3]}var a,s,l,c,u,h,d;return t.Q(o,o,[1/n,1/n,1]),o}function Le(e,r,i,n){if(e){const e=t.N();if(!r){const{vecSouth:t,vecEast:r}=Fe(i);e[0]=r[0],e[1]=r[1],e[4]=t[0],e[5]=t[1]}return t.Q(e,e,[n,n,1]),e}return i.pixelsToClipSpaceMatrix}function Fe(e){const r=Math.cos(e.rollInRadians),i=Math.sin(e.rollInRadians),n=Math.cos(e.pitchInRadians),o=Math.cos(e.bearingInRadians),a=Math.sin(e.bearingInRadians),s=t.aB();s[0]=-o*n*i-a*r,s[1]=-a*n*i+o*r;const l=t.aC(s);l<1e-9?t.aD(s):t.aE(s,s,1/l);const c=t.aB();c[0]=o*n*r-a*i,c[1]=a*n*r+o*i;const u=t.aC(c);return u<1e-9?t.aD(c):t.aE(c,c,1/u),{vecEast:c,vecSouth:s}}function Oe(e,r,i,n){let o;n?(o=[e,r,n(e,r),1],t.aG(o,o,i)):(o=[e,r,0,1],Qe(o,o,i));const a=o[3];return{point:new t.P(o[0]/a,o[1]/a),signedDistanceFromCamera:a,isOccluded:!1}}function ze(e,t){return.5+e/t*.5}function Be(e,t){return e.x>=-t[0]&&e.x<=t[0]&&e.y>=-t[1]&&e.y<=t[1]}function Ne(e,r,i,n,o,a,s,l,c,u,h,d,p){const f=i?e.textSizeData:e.iconSizeData,m=t.ax(f,r.transform.zoom),g=[256/r.width*2+1,256/r.height*2+1],_=i?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;_.clear();const y=e.lineVertexArray,v=i?e.text.placedSymbolArray:e.icon.placedSymbolArray,b=r.transform.width/r.transform.height;let x=!1;for(let w=0;w<v.length;w++){const i=v.get(w);if(i.hidden||i.writingMode===t.ay.vertical&&!x){Ke(i.numGlyphs,_);continue}x=!1;const T=new t.P(i.anchorX,i.anchorY),S={getElevation:p,pitchedLabelPlaneMatrix:n,lineVertexArray:y,pitchWithMap:a,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:r.transform,tileAnchorPoint:T,unwrappedTileID:c,width:u,height:h,translation:d},E=Ze(i.anchorX,i.anchorY,S);if(!Be(E.point,g)){Ke(i.numGlyphs,_);continue}const I=ze(r.transform.cameraToCenterDistance,E.signedDistanceFromCamera),P=t.az(f,m,i),k=a?P*r.transform.getPitchedTextCorrection(i.anchorX,i.anchorY,c)/I:P*I,A=Ue({projectionContext:S,pitchedLabelPlaneMatrixInverse:o,symbol:i,fontSize:k,flip:!1,keepUpright:s,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:_,aspectRatio:b,rotateToLine:l});x=A.useVertical,(A.notEnoughRoom||x||A.needsFlipping&&Ue({projectionContext:S,pitchedLabelPlaneMatrixInverse:o,symbol:i,fontSize:k,flip:!0,keepUpright:s,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:_,aspectRatio:b,rotateToLine:l}).notEnoughRoom)&&Ke(i.numGlyphs,_)}i?e.text.dynamicLayoutVertexBuffer.updateData(_):e.icon.dynamicLayoutVertexBuffer.updateData(_)}function je(e,t,r,i,n,o,a,s){const l=o.glyphStartIndex+o.numGlyphs,c=o.lineStartIndex,u=o.lineStartIndex+o.lineLength,h=t.getoffsetX(o.glyphStartIndex),d=t.getoffsetX(l-1),p=Ye(e*h,r,i,n,o.segment,c,u,s,a);if(!p)return null;const f=Ye(e*d,r,i,n,o.segment,c,u,s,a);return f?s.projectionCache.anyProjectionOccluded?null:{first:p,last:f}:null}function Ve(e,r,i,n){return e===t.ay.horizontal&&Math.abs(i.y-r.y)>Math.abs(i.x-r.x)*n?{useVertical:!0}:(e===t.ay.vertical?r.y<i.y:r.x>i.x)?{needsFlipping:!0}:null}function Ue(e){const{projectionContext:r,pitchedLabelPlaneMatrixInverse:i,symbol:n,fontSize:o,flip:a,keepUpright:s,glyphOffsetArray:l,dynamicLayoutVertexArray:c,aspectRatio:u,rotateToLine:h}=e,d=o/24,p=n.lineOffsetX*d,f=n.lineOffsetY*d;let m;if(n.numGlyphs>1){const e=n.glyphStartIndex+n.numGlyphs,t=n.lineStartIndex,o=n.lineStartIndex+n.lineLength,c=je(d,l,p,f,a,n,h,r);if(!c)return{notEnoughRoom:!0};const g=We(c.first.point.x,c.first.point.y,r,i),_=We(c.last.point.x,c.last.point.y,r,i);if(s&&!a){const e=Ve(n.writingMode,g,_,u);if(e)return e}m=[c.first];for(let i=n.glyphStartIndex+1;i<e-1;i++){const e=Ye(d*l.getoffsetX(i),p,f,a,n.segment,t,o,r,h);if(!e)return{notEnoughRoom:!0};m.push(e)}m.push(c.last)}else{if(s&&!a){const e=$e(r.tileAnchorPoint.x,r.tileAnchorPoint.y,r).point,o=n.lineStartIndex+n.segment+1,a=new t.P(r.lineVertexArray.getx(o),r.lineVertexArray.gety(o)),s=$e(a.x,a.y,r),l=s.signedDistanceFromCamera>0?s.point:Ge(r.tileAnchorPoint,a,e,1,r),c=We(e.x,e.y,r,i),h=We(l.x,l.y,r,i),d=Ve(n.writingMode,c,h,u);if(d)return d}const e=Ye(d*l.getoffsetX(n.glyphStartIndex),p,f,a,n.segment,n.lineStartIndex,n.lineStartIndex+n.lineLength,r,h);if(!e||r.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};m=[e]}for(const g of m)t.aF(c,g.point,g.angle);return{}}function Ge(e,t,r,i,n){const o=e.add(e.sub(t)._unit()),a=$e(o.x,o.y,n).point,s=r.sub(a);return r.add(s._mult(i/s.mag()))}function qe(e,r,i){const n=r.projectionCache;if(n.projections[e])return n.projections[e];const o=new t.P(r.lineVertexArray.getx(e),r.lineVertexArray.gety(e)),a=$e(o.x,o.y,r);if(a.signedDistanceFromCamera>0)return n.projections[e]=a.point,n.anyProjectionOccluded=n.anyProjectionOccluded||a.isOccluded,a.point;const s=e-i.direction;return Ge(0===i.distanceFromAnchor?r.tileAnchorPoint:new t.P(r.lineVertexArray.getx(s),r.lineVertexArray.gety(s)),o,i.previousVertex,i.absOffsetX-i.distanceFromAnchor+1,r)}function $e(e,t,r){const i=e+r.translation[0],n=t+r.translation[1];let o;return r.pitchWithMap?(o=Oe(i,n,r.pitchedLabelPlaneMatrix,r.getElevation),o.isOccluded=!1):(o=r.transform.projectTileCoordinates(i,n,r.unwrappedTileID,r.getElevation),o.point.x=(.5*o.point.x+.5)*r.width,o.point.y=(.5*-o.point.y+.5)*r.height),o}function We(e,r,i,n){if(i.pitchWithMap){const o=[e,r,0,1];return t.aG(o,o,n),i.transform.projectTileCoordinates(o[0]/o[3],o[1]/o[3],i.unwrappedTileID,i.getElevation).point}return{x:e/i.width*2-1,y:1-r/i.height*2}}function Ze(e,t,r){return r.transform.projectTileCoordinates(e,t,r.unwrappedTileID,r.getElevation)}function He(e,t,r){return e._unit()._perp()._mult(t*r)}function Xe(e,r,i,n,o,a,s,l,c){if(l.projectionCache.offsets[e])return l.projectionCache.offsets[e];const u=i.add(r);if(e+c.direction<n||e+c.direction>=o)return l.projectionCache.offsets[e]=u,u;const h=qe(e+c.direction,l,c),d=He(h.sub(i),s,c.direction),p=i.add(d),f=h.add(d);return l.projectionCache.offsets[e]=t.aH(a,u,p,f)||u,l.projectionCache.offsets[e]}function Ye(e,t,r,i,n,o,a,s,l){const c=i?e-t:e+t;let u=c>0?1:-1,h=0;i&&(u*=-1,h=Math.PI),u<0&&(h+=Math.PI);let d,p=u>0?o+n:o+n+1;s.projectionCache.cachedAnchorPoint?d=s.projectionCache.cachedAnchorPoint:(d=$e(s.tileAnchorPoint.x,s.tileAnchorPoint.y,s).point,s.projectionCache.cachedAnchorPoint=d);let f,m,g=d,_=d,y=0,v=0;const b=Math.abs(c),x=[];let w;for(;y+v<=b;){if(p+=u,p<o||p>=a)return null;y+=v,_=g,m=f;const e={absOffsetX:b,direction:u,distanceFromAnchor:y,previousVertex:_};if(g=qe(p,s,e),0===r)x.push(_),w=g.sub(_);else{let t;const i=g.sub(_);t=0===i.mag()?He(qe(p+u,s,e).sub(g),r,u):He(i,r,u),m||(m=_.add(t)),f=Xe(p,t,g,o,a,m,r,s,e),x.push(m),w=f.sub(m)}v=w.mag()}const T=w._mult((b-y)/v)._add(m||_),S=h+Math.atan2(g.y-_.y,g.x-_.x);return x.push(T),{point:T,angle:l?S:0,path:x}}const Je=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Ke(e,t){for(let r=0;r<e;r++){const e=t.length;t.resize(e+4),t.float32.set(Je,3*e)}}function Qe(e,t,r){const i=t[0],n=t[1];return e[0]=r[0]*i+r[4]*n+r[12],e[1]=r[1]*i+r[5]*n+r[13],e[3]=r[3]*i+r[7]*n+r[15],e}const et=100;class tt{constructor(e,t=new De(e.width+200,e.height+200,25),r=new De(e.width+200,e.height+200,25)){this.transform=e,this.grid=t,this.ignoredGrid=r,this.pitchFactor=Math.cos(e.pitch*Math.PI/180)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+et,this.screenBottomBoundary=e.height+et,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,t,r,i,n,o,a,s,l,c,u,h){const d=this.projectAndGetPerspectiveRatio(e.anchorPointX+s[0],e.anchorPointY+s[1],n,c,h),p=r*d.perspectiveRatio;let f;if(o||a)f=this._projectCollisionBox(e,p,i,n,o,a,s,d,c,u,h);else{const t=d.x+(u?u.x*p:0),r=d.y+(u?u.y*p:0);f={allPointsOccluded:!1,box:[t+e.x1*p,r+e.y1*p,t+e.x2*p,r+e.y2*p]}}const[m,g,_,y]=f.box,v=o?f.allPointsOccluded:d.isOccluded;let b=v;return b||(b=d.perspectiveRatio<this.perspectiveRatioCutoff),b||(b=!this.isInsideGrid(m,g,_,y)),b||"always"!==t&&this.grid.hitTest(m,g,_,y,t,l)?{box:[m,g,_,y],placeable:!1,offscreen:!1,occluded:v}:{box:[m,g,_,y],placeable:!0,offscreen:this.isOffscreen(m,g,_,y),occluded:v}}placeCollisionCircles(e,r,i,n,o,a,s,l,c,u,h,d,p,f){const m=[],g=new t.P(r.anchorX,r.anchorY),_=this.getPerspectiveRatio(g.x,g.y,a,f),y=(c?o*this.transform.getPitchedTextCorrection(r.anchorX,r.anchorY,a)/_:o*_)/t.aL,v={getElevation:f,pitchedLabelPlaneMatrix:s,lineVertexArray:i,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:p},b=je(y,n,r.lineOffsetX*y,r.lineOffsetY*y,!1,r,!1,v);let x=!1,w=!1,T=!0;if(b){const r=.5*h*_+d,i=new t.P(-100,-100),n=new t.P(this.screenRightBoundary,this.screenBottomBoundary),o=new Ce,a=b.first,s=b.last;let p=[];for(let e=a.path.length-1;e>=1;e--)p.push(a.path[e]);for(let e=1;e<s.path.length;e++)p.push(s.path[e]);const f=2.5*r;if(c){const e=this.projectPathToScreenSpace(p,v);p=e.some(e=>e.signedDistanceFromCamera<=0)?[]:e.map(e=>e.point)}let g=[];if(p.length>0){const e=p[0].clone(),r=p[0].clone();for(let t=1;t<p.length;t++)e.x=Math.min(e.x,p[t].x),e.y=Math.min(e.y,p[t].y),r.x=Math.max(r.x,p[t].x),r.y=Math.max(r.y,p[t].y);g=e.x>=i.x&&r.x<=n.x&&e.y>=i.y&&r.y<=n.y?[p]:r.x<i.x||e.x>n.x||r.y<i.y||e.y>n.y?[]:t.aI([p],i.x,i.y,n.x,n.y)}for(const t of g){o.reset(t,.25*r);let i=0;i=o.length<=.5*r?1:Math.ceil(o.paddedLength/f)+1;for(let t=0;t<i;t++){const n=t/Math.max(i-1,1),a=o.lerp(n),s=a.x+et,c=a.y+et;m.push(s,c,r,0);const h=s-r,d=c-r,p=s+r,f=c+r;if(T=T&&this.isOffscreen(h,d,p,f),w=w||this.isInsideGrid(h,d,p,f),"always"!==e&&this.grid.hitTestCircle(s,c,r,e,u)&&(x=!0,!l))return{circles:[],offscreen:!1,collisionDetected:x}}}}return{circles:!l&&x||!w||_<this.perspectiveRatioCutoff?[]:m,offscreen:T,collisionDetected:x}}projectPathToScreenSpace(e,r){const i=function(e,r){const i=t.N();return t.aA(i,r.pitchedLabelPlaneMatrix),e.map(e=>{const t=Oe(e.x,e.y,i,r.getElevation),n=r.transform.projectTileCoordinates(t.point.x,t.point.y,r.unwrappedTileID,r.getElevation);return n.point.x=(.5*n.point.x+.5)*r.width,n.point.y=(.5*-n.point.y+.5)*r.height,n})}(e,r);return function(e){let t=0,r=0,i=0,n=0;for(let o=0;o<e.length;o++)e[o].isOccluded?(i=o+1,n=0):(n++,n>r&&(r=n,t=i));return e.slice(t,t+r)}(i)}queryRenderedSymbols(e){if(0===e.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};const r=[],i=new t.ab;for(const h of e){const e=new t.P(h.x+et,h.y+et);i.extend(e),r.push(e)}const{minX:n,minY:o,maxX:a,maxY:s}=i,l=this.grid.query(n,o,a,s).concat(this.ignoredGrid.query(n,o,a,s)),c={},u={};for(const h of l){const e=h.key;if(void 0===c[e.bucketInstanceId]&&(c[e.bucketInstanceId]={}),c[e.bucketInstanceId][e.featureIndex])continue;const i=[new t.P(h.x1,h.y1),new t.P(h.x2,h.y1),new t.P(h.x2,h.y2),new t.P(h.x1,h.y2)];t.aJ(r,i)&&(c[e.bucketInstanceId][e.featureIndex]=!0,void 0===u[e.bucketInstanceId]&&(u[e.bucketInstanceId]=[]),u[e.bucketInstanceId].push(e.featureIndex))}return u}insertCollisionBox(e,t,r,i,n,o){(r?this.ignoredGrid:this.grid).insert({bucketInstanceId:i,featureIndex:n,collisionGroupID:o,overlapMode:t},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,r,i,n,o){const a=r?this.ignoredGrid:this.grid,s={bucketInstanceId:i,featureIndex:n,collisionGroupID:o,overlapMode:t};for(let l=0;l<e.length;l+=4)a.insertCircle(s,e[l],e[l+1],e[l+2])}projectAndGetPerspectiveRatio(e,r,i,n,o){if(o){let i;n?(i=[e,r,n(e,r),1],t.aG(i,i,o)):(i=[e,r,0,1],Qe(i,i,o));const a=i[3];return{x:(i[0]/a+1)/2*this.transform.width+et,y:(-i[1]/a+1)/2*this.transform.height+et,perspectiveRatio:.5+this.transform.cameraToCenterDistance/a*.5,isOccluded:!1,signedDistanceFromCamera:a}}{const t=this.transform.projectTileCoordinates(e,r,i,n);return{x:(t.point.x+1)/2*this.transform.width+et,y:(1-t.point.y)/2*this.transform.height+et,perspectiveRatio:.5+this.transform.cameraToCenterDistance/t.signedDistanceFromCamera*.5,isOccluded:t.isOccluded,signedDistanceFromCamera:t.signedDistanceFromCamera}}}getPerspectiveRatio(e,t,r,i){const n=this.transform.projectTileCoordinates(e,t,r,i);return.5+this.transform.cameraToCenterDistance/n.signedDistanceFromCamera*.5}isOffscreen(e,t,r,i){return r<et||e>=this.screenRightBoundary||i<et||t>this.screenBottomBoundary}isInsideGrid(e,t,r,i){return r>=0&&e<this.gridRightBoundary&&i>=0&&t<this.gridBottomBoundary}getViewportMatrix(){const e=t.ar([]);return t.O(e,e,[-100,-100,0]),e}_projectCollisionBox(e,r,i,n,o,a,s,l,c,u,h){let d=1,p=0,f=0,m=1;const g=e.anchorPointX+s[0],_=e.anchorPointY+s[1];if(a&&!o){const e=this.projectAndGetPerspectiveRatio(g+1,_,n,c,h),t=e.x-l.x,r=Math.atan((e.y-l.y)/t)+(t<0?Math.PI:0),i=Math.sin(r),o=Math.cos(r);d=o,p=i,f=-i,m=o}else if(!a&&o){const e=Fe(this.transform);d=e.vecEast[0],p=e.vecEast[1],f=e.vecSouth[0],m=e.vecSouth[1]}let y=l.x,v=l.y,b=r;o&&(y=g,v=_,b=Math.pow(2,-(this.transform.zoom-i.overscaledZ)),b*=this.transform.getPitchedTextCorrection(g,_,n),u||(b*=t.an(.5+l.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),u&&(y+=d*u.x*b+f*u.y*b,v+=p*u.x*b+m*u.y*b);const x=e.x1*b,w=e.x2*b,T=(x+w)/2,S=e.y1*b,E=e.y2*b,I=(S+E)/2,P=[{offsetX:x,offsetY:S},{offsetX:T,offsetY:S},{offsetX:w,offsetY:S},{offsetX:w,offsetY:I},{offsetX:w,offsetY:E},{offsetX:T,offsetY:E},{offsetX:x,offsetY:E},{offsetX:x,offsetY:I}];let k=[];for(const{offsetX:C,offsetY:M}of P)k.push(new t.P(y+d*C+f*M,v+p*C+m*M));let A=!1;if(o){const e=k.map(e=>this.projectAndGetPerspectiveRatio(e.x,e.y,n,c,h));A=e.some(e=>!e.isOccluded),k=e.map(e=>new t.P(e.x,e.y))}else A=!0;return{box:t.aK(k),allPointsOccluded:!A}}}class rt{constructor(e,t,r,i){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):i&&r?1:0,this.placed=r}isHidden(){return 0===this.opacity&&!this.placed}}class it{constructor(e,t,r,i,n){this.text=new rt(e?e.text:null,t,r,n),this.icon=new rt(e?e.icon:null,t,i,n)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class nt{constructor(e,t,r){this.text=e,this.icon=t,this.skipFade=r}}class ot{constructor(e,t,r,i,n){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=r,this.bucketIndex=i,this.tileID=n}}class at{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 st(e,r,i,n,o){const{horizontalAlign:a,verticalAlign:s}=t.aR(e);return new t.P(-(a-.5)*r+n[0]*o,-(s-.5)*i+n[1]*o)}class lt{constructor(e,t,r,i,n){this.transform=e.clone(),this.terrain=t,this.collisionIndex=new tt(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=r,this.retainedQueryData={},this.collisionGroups=new at(i),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){const t=this.terrain;return t?(r,i)=>t.getElevation(e,r,i):null}getBucketParts(e,r,i,n){const o=i.getBucket(r),a=i.latestFeatureIndex;if(!o||!a||r.id!==o.layerIds[0])return;const s=i.collisionBoxArray,l=o.layers[0].layout,c=o.layers[0].paint,u=Math.pow(2,this.transform.zoom-i.tileID.overscaledZ),h=i.tileSize/t.a4,d=i.tileID.toUnwrapped(),p="map"===l.get("text-rotation-alignment"),f=t.aM(i,1,this.transform.zoom),m=t.aN(this.collisionIndex.transform,i,c.get("text-translate"),c.get("text-translate-anchor")),g=t.aN(this.collisionIndex.transform,i,c.get("icon-translate"),c.get("icon-translate-anchor")),_=Re(p,this.transform,f);this.retainedQueryData[o.bucketInstanceId]=new ot(o.bucketInstanceId,a,o.sourceLayerIndex,o.index,i.tileID);const y={bucket:o,layout:l,translationText:m,translationIcon:g,unwrappedTileID:d,pitchedLabelPlaneMatrix:_,scale:u,textPixelRatio:h,holdingForFade:i.holdingForSymbolFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:t.ax(o.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(n)for(const t of o.sortKeyRanges){const{sortKey:r,symbolInstanceStart:i,symbolInstanceEnd:n}=t;e.push({sortKey:r,symbolInstanceStart:i,symbolInstanceEnd:n,parameters:y})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:y})}attemptAnchorPlacement(e,r,i,n,o,a,s,l,c,u,h,d,p,f,m,g,_,y,v,b){const x=t.aO[e.textAnchor],w=[e.textOffset0,e.textOffset1],T=st(x,i,n,w,o),S=this.collisionIndex.placeCollisionBox(r,d,l,c,u,s,a,g,h.predicate,v,T,b);if((!y||this.collisionIndex.placeCollisionBox(y,d,l,c,u,s,a,_,h.predicate,v,T,b).placeable)&&S.placeable){let e;if(this.prevPlacement&&this.prevPlacement.variableOffsets[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID]&&this.prevPlacement.placements[p.crossTileID].text&&(e=this.prevPlacement.variableOffsets[p.crossTileID].anchor),0===p.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[p.crossTileID]={textOffset:w,width:i,height:n,anchor:x,textBoxScale:o,prevAnchor:e},this.markUsedJustification(f,x,p,m),f.allowVerticalPlacement&&(this.markUsedOrientation(f,m,p),this.placedOrientations[p.crossTileID]=m),{shift:T,placedGlyphBoxes:S}}}placeLayerBucketPart(e,r,i){const{bucket:n,layout:o,translationText:a,translationIcon:s,unwrappedTileID:l,pitchedLabelPlaneMatrix:c,textPixelRatio:u,holdingForFade:h,collisionBoxArray:d,partiallyEvaluatedTextSize:p,collisionGroup:f}=e.parameters,m=o.get("text-optional"),g=o.get("icon-optional"),_=t.aP(o,"text-overlap","text-allow-overlap"),y="always"===_,v=t.aP(o,"icon-overlap","icon-allow-overlap"),b="always"===v,x="map"===o.get("text-rotation-alignment"),w="map"===o.get("text-pitch-alignment"),T="none"!==o.get("icon-text-fit"),S="viewport-y"===o.get("symbol-z-order"),E=y&&(b||!n.hasIconData()||g),I=b&&(y||!n.hasTextData()||m);!n.collisionArrays&&d&&n.deserializeCollisionBoxes(d);const P=this.retainedQueryData[n.bucketInstanceId].tileID,k=this._getTerrainElevationFunc(P),A=this.transform.getFastPathSimpleProjectionMatrix(P),C=(e,d,b)=>{var S,C;if(r[e.crossTileID])return;if(h)return void(this.placements[e.crossTileID]=new nt(!1,!1,!1));let M=!1,D=!1,R=!0,L=null,F={box:null,placeable:!1,offscreen:null,occluded:!1},O={placeable:!1},z=null,B=null,N=null,j=0,V=0,U=0;d.textFeatureIndex?j=d.textFeatureIndex:e.useRuntimeCollisionCircles&&(j=e.featureIndex),d.verticalTextFeatureIndex&&(V=d.verticalTextFeatureIndex);const G=d.textBox;if(G){const r=r=>{let i=t.ay.horizontal;if(n.allowVerticalPlacement&&!r&&this.prevPlacement){const t=this.prevPlacement.placedOrientations[e.crossTileID];t&&(this.placedOrientations[e.crossTileID]=t,i=t,this.markUsedOrientation(n,i,e))}return i},o=(r,i)=>{if(n.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&d.verticalTextBox){for(const e of n.writingModes)if(e===t.ay.vertical?(F=i(),O=F):F=r(),F&&F.placeable)break}else F=r()},c=e.textAnchorOffsetStartIndex,h=e.textAnchorOffsetEndIndex;if(h===c){const i=(t,r)=>{const i=this.collisionIndex.placeCollisionBox(t,_,u,P,l,w,x,a,f.predicate,k,void 0,A);return i&&i.placeable&&(this.markUsedOrientation(n,r,e),this.placedOrientations[e.crossTileID]=r),i};o(()=>i(G,t.ay.horizontal),()=>{const r=d.verticalTextBox;return n.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&r?i(r,t.ay.vertical):{box:null,offscreen:null}}),r(F&&F.placeable)}else{let p=t.aO[null===(C=null===(S=this.prevPlacement)||void 0===S?void 0:S.variableOffsets[e.crossTileID])||void 0===C?void 0:C.anchor];const m=(t,r,o)=>{const d=t.x2-t.x1,m=t.y2-t.y1,g=e.textBoxScale,y=T&&"never"===v?r:null;let b=null,S="never"===_?1:2,E="never";p&&S++;for(let i=0;i<S;i++){for(let r=c;r<h;r++){const i=n.textAnchorOffsets.get(r);if(p&&i.textAnchor!==p)continue;const c=this.attemptAnchorPlacement(i,t,d,m,g,x,w,u,P,l,f,E,e,n,o,a,s,y,k);if(c&&(b=c.placedGlyphBoxes,b&&b.placeable))return M=!0,L=c.shift,b}p?p=null:E=_}return i&&!b&&(b={box:this.collisionIndex.placeCollisionBox(G,"always",u,P,l,w,x,a,f.predicate,k,void 0,A).box,offscreen:!1,placeable:!1,occluded:!1}),b};o(()=>m(G,d.iconBox,t.ay.horizontal),()=>{const r=d.verticalTextBox;return n.allowVerticalPlacement&&(!F||!F.placeable)&&e.numVerticalGlyphVertices>0&&r?m(r,d.verticalIconBox,t.ay.vertical):{box:null,occluded:!0,offscreen:null}}),F&&(M=F.placeable,R=F.offscreen);const g=r(F&&F.placeable);if(!M&&this.prevPlacement){const t=this.prevPlacement.variableOffsets[e.crossTileID];t&&(this.variableOffsets[e.crossTileID]=t,this.markUsedJustification(n,t.anchor,e,g))}}}if(z=F,M=z&&z.placeable,R=z&&z.offscreen,e.useRuntimeCollisionCircles&&e.centerJustifiedTextSymbolIndex>=0){const r=n.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),s=t.az(n.textSizeData,p,r),u=o.get("text-padding");B=this.collisionIndex.placeCollisionCircles(_,r,n.lineVertexArray,n.glyphOffsetArray,s,l,c,i,w,f.predicate,e.collisionCircleDiameter,u,a,k),B.circles.length&&B.collisionDetected&&!i&&t.w("Collisions detected, but collision boxes are not shown"),M=y||B.circles.length>0&&!B.collisionDetected,R=R&&B.offscreen}if(d.iconFeatureIndex&&(U=d.iconFeatureIndex),d.iconBox){const e=e=>this.collisionIndex.placeCollisionBox(e,v,u,P,l,w,x,s,f.predicate,k,T&&L?L:void 0,A);O&&O.placeable&&d.verticalIconBox?(N=e(d.verticalIconBox),D=N.placeable):(N=e(d.iconBox),D=N.placeable),R=R&&N.offscreen}const q=m||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,$=g||0===e.numIconVertices;q||$?$?q||(D=D&&M):M=D&&M:D=M=D&&M;const W=D&&N.placeable;if(M&&z.placeable&&this.collisionIndex.insertCollisionBox(z.box,_,o.get("text-ignore-placement"),n.bucketInstanceId,O&&O.placeable&&V?V:j,f.ID),W&&this.collisionIndex.insertCollisionBox(N.box,v,o.get("icon-ignore-placement"),n.bucketInstanceId,U,f.ID),B&&M&&this.collisionIndex.insertCollisionCircles(B.circles,_,o.get("text-ignore-placement"),n.bucketInstanceId,j,f.ID),i&&this.storeCollisionData(n.bucketInstanceId,b,d,z,N,B),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 nt((M||E)&&!(null==z?void 0:z.occluded),(D||I)&&!(null==N?void 0:N.occluded),R||n.justReloaded),r[e.crossTileID]=!0};if(S){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 r=t[e];C(n.symbolInstances.get(r),n.collisionArrays[r],r)}}else for(let t=e.symbolInstanceStart;t<e.symbolInstanceEnd;t++)C(n.symbolInstances.get(t),n.collisionArrays[t],t);n.justReloaded=!1}storeCollisionData(e,t,r,i,n,o){if(r.textBox||r.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)),r.textBox&&(a.text=i.box),r.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]-et),t.push(o.circles[e+1]-et),t.push(o.circles[e+2]),t.push(o.collisionDetected?1:0)}}markUsedJustification(e,r,i,n){let o;o=n===t.ay.vertical?i.verticalPlacedTextSymbolIndex:{left:i.leftJustifiedTextSymbolIndex,center:i.centerJustifiedTextSymbolIndex,right:i.rightJustifiedTextSymbolIndex}[t.aQ(r)];const a=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex,i.verticalPlacedTextSymbolIndex];for(const t of a)t>=0&&(e.text.placedSymbolArray.get(t).crossTileID=o>=0&&t!==o?0:i.crossTileID)}markUsedOrientation(e,r,i){const n=r===t.ay.horizontal||r===t.ay.horizontalOnly?r:0,o=r===t.ay.vertical?r:0,a=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex];for(const t of a)e.text.placedSymbolArray.get(t).placedOrientation=n;i.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(i.verticalPlacedTextSymbolIndex).placedOrientation=o)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const t=this.prevPlacement;let r=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;const i=t?t.symbolFadeChange(e):1,n=t?t.opacities:{},o=t?t.variableOffsets:{},a=t?t.placedOrientations:{};for(const s in this.placements){const e=this.placements[s],t=n[s];t?(this.opacities[s]=new it(t,i,e.text,e.icon),r=r||e.text!==t.text.placed||e.icon!==t.icon.placed):(this.opacities[s]=new it(null,i,e.text,e.icon,e.skipFade),r=r||e.text||e.icon)}for(const s in n){const e=n[s];if(!this.opacities[s]){const t=new it(e,i,!1,!1);t.isHidden()||(this.opacities[s]=t,r=r||e.text.placed||e.icon.placed)}}for(const s in o)this.variableOffsets[s]||!this.opacities[s]||this.opacities[s].isHidden()||(this.variableOffsets[s]=o[s]);for(const s in a)this.placedOrientations[s]||!this.opacities[s]||this.opacities[s].isHidden()||(this.placedOrientations[s]=a[s]);if(t&&void 0===t.lastPlacementChangeTime)throw new Error("Last placement time for previous placement is not defined");r?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t){const r={};for(const i of t){const t=i.getBucket(e);t&&i.latestFeatureIndex&&e.id===t.layerIds[0]&&this.updateBucketOpacities(t,i.tileID,r,i.collisionBoxArray)}}updateBucketOpacities(e,r,i,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 it(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"),d="map"===a.get("text-pitch-alignment"),p="none"!==a.get("icon-text-fit"),f=new it(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 m=(e,t,r)=>{for(let i=0;i<t/4;i++)e.opacityVertexArray.emplaceBack(r);e.hasVisibleVertices=e.hasVisibleVertices||r!==yt},g=this.collisionBoxArrays.get(e.bucketInstanceId);for(let _=0;_<e.symbolInstances.length;_++){const r=e.symbolInstances.get(_),{numHorizontalGlyphVertices:n,numVerticalGlyphVertices:o,crossTileID:a}=r;let l=this.opacities[a];i[a]?l=s:l||(l=f,this.opacities[a]=l),i[a]=!0;const c=r.numIconVertices>0,y=this.placedOrientations[r.crossTileID],v=y===t.ay.vertical,b=y===t.ay.horizontal||y===t.ay.horizontalOnly;if(n>0||o>0){const t=_t(l.text);m(e.text,n,v?yt:t),m(e.text,o,b?yt:t);const i=l.text.isHidden();[r.rightJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.leftJustifiedTextSymbolIndex].forEach(t=>{t>=0&&(e.text.placedSymbolArray.get(t).hidden=i||v?1:0)}),r.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).hidden=i||b?1:0);const a=this.variableOffsets[r.crossTileID];a&&this.markUsedJustification(e,a.anchor,r,y);const s=this.placedOrientations[r.crossTileID];s&&(this.markUsedJustification(e,"left",r,s),this.markUsedOrientation(e,s,r))}if(c){const t=_t(l.icon),i=!(p&&r.verticalPlacedIconSymbolIndex&&v);r.placedIconSymbolIndex>=0&&(m(e.icon,r.numIconVertices,i?t:yt),e.icon.placedSymbolArray.get(r.placedIconSymbolIndex).hidden=l.icon.isHidden()),r.verticalPlacedIconSymbolIndex>=0&&(m(e.icon,r.numVerticalIconVertices,i?yt:t),e.icon.placedSymbolArray.get(r.verticalPlacedIconSymbolIndex).hidden=l.icon.isHidden())}const x=g&&g.has(_)?g.get(_):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const r=e.collisionArrays[_];if(r){let i=new t.P(0,0);if(r.textBox||r.verticalTextBox){let t=!0;if(u){const e=this.variableOffsets[a];e?(i=st(e.anchor,e.width,e.height,e.textOffset,e.textBoxScale),h&&i._rotate(d?-this.transform.bearingInRadians:this.transform.bearingInRadians)):t=!1}if(r.textBox||r.verticalTextBox){let n;r.textBox&&(n=v),r.verticalTextBox&&(n=b),ct(e.textCollisionBox.collisionVertexArray,l.text.placed,!t||n,x.text,i.x,i.y)}}if(r.iconBox||r.verticalIconBox){const t=Boolean(!b&&r.verticalIconBox);let n;r.iconBox&&(n=t),r.verticalIconBox&&(n=!t),ct(e.iconCollisionBox.collisionVertexArray,l.icon.placed,n,x.icon,p?i.x:0,p?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 r=this.zoomAtLastRecencyCheck===t?1-this.zoomAdjustment(t):1;return this.zoomAtLastRecencyCheck=t,this.commitTime+this.fadeDuration*r>e}setStale(){this.stale=!0}}function ct(e,t,r,i,n,o){i&&0!==i.length||(i=[0,0,0,0]);const a=i[0]-et,s=i[1]-et,l=i[2]-et,c=i[3]-et;e.emplaceBack(t?1:0,r?1:0,n||0,o||0,a,s),e.emplaceBack(t?1:0,r?1:0,n||0,o||0,l,s),e.emplaceBack(t?1:0,r?1:0,n||0,o||0,l,c),e.emplaceBack(t?1:0,r?1:0,n||0,o||0,a,c)}const ut=Math.pow(2,25),ht=Math.pow(2,24),dt=Math.pow(2,17),pt=Math.pow(2,16),ft=Math.pow(2,9),mt=Math.pow(2,8),gt=Math.pow(2,1);function _t(e){if(0===e.opacity&&!e.placed)return 0;if(1===e.opacity&&e.placed)return 4294967295;const t=e.placed?1:0,r=Math.floor(127*e.opacity);return r*ut+t*ht+r*dt+t*pt+r*ft+t*mt+r*gt+t}const yt=0;class vt{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,r,i,n){const o=this._bucketParts;for(;this._currentTileIndex<e.length;)if(t.getBucketParts(o,i,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,r),this._currentPartIndex++,n())return!0;return!1}}class bt{constructor(e,t,r,i,n,o,a,s){this.placement=new lt(e,t,o,a,s),this._currentPlacementIndex=r.length-1,this._forceFullPlacement=i,this._showCollisionBoxes=n,this._done=!1}isDone(){return this._done}continuePlacement(e,t,r){const i=c(),n=()=>!this._forceFullPlacement&&c()-i>2;for(;this._currentPlacementIndex>=0;){const i=t[e[this._currentPlacementIndex]],o=this.placement.collisionIndex.transform.zoom;if("symbol"===i.type&&(!i.minzoom||i.minzoom<=o)&&(!i.maxzoom||i.maxzoom>o)){if(this._inProgressLayer||(this._inProgressLayer=new vt(i)),this._inProgressLayer.continuePlacement(r[i.source],this.placement,this._showCollisionBoxes,i,n))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}const xt=512/t.a4/2;class wt{constructor(e,r,i){this.tileID=e,this.bucketInstanceId=i,this._symbolsByKey={};const n=new Map;for(let t=0;t<r.length;t++){const e=r.get(t),i=e.key,o=n.get(i);o?o.push(e):n.set(i,[e])}for(const[o,a]of n){const e={positions:a.map(e=>({x:Math.floor(e.anchorX*xt),y:Math.floor(e.anchorY*xt)})),crossTileIDs:a.map(e=>e.crossTileID)};if(e.positions.length>128){const r=new t.aS(e.positions.length,16,Uint16Array);for(const{x:t,y:i}of e.positions)r.add(t,i);r.finish(),delete e.positions,e.index=r}this._symbolsByKey[o]=e}}getScaledCoordinates(e,r){const{x:i,y:n,z:o}=this.tileID.canonical,{x:a,y:s,z:l}=r.canonical,c=xt/Math.pow(2,l-o),u=(s*t.a4+e.anchorY)*c,h=n*t.a4*xt;return{x:Math.floor((a*t.a4+e.anchorX)*c-i*t.a4*xt),y:Math.floor(u-h)}}findMatches(e,t,r){const i=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-i,s.y-i,s.x+i,s.y+i).sort();for(const t of e){const e=a.crossTileIDs[t];if(!r[e]){r[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)<=i&&Math.abs(t.y-s.y)<=i&&!r[n]){r[n]=!0,o.crossTileID=n;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}}class Tt{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class St{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){const t=Math.round((e-this.lng)/360);if(0!==t)for(const r in this.indexes){const e=this.indexes[r],i={};for(const r in e){const n=e[r];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+t),i[n.tileID.key]=n}this.indexes[r]=i}this.lng=e}addBucket(e,t,r){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 n=0;n<t.symbolInstances.length;n++)t.symbolInstances.get(n).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});const i=this.usedCrossTileIDs[e.overscaledZ];for(const n in this.indexes){const r=this.indexes[n];if(Number(n)>e.overscaledZ)for(const n in r){const o=r[n];o.tileID.isChildOf(e)&&o.findMatches(t.symbolInstances,e,i)}else{const o=r[e.scaledTo(Number(n)).key];o&&o.findMatches(t.symbolInstances,e,i)}}for(let n=0;n<t.symbolInstances.length;n++){const e=t.symbolInstances.get(n);e.crossTileID||(e.crossTileID=r.generate(),i[e.crossTileID]=!0)}return void 0===this.indexes[e.overscaledZ]&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new wt(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(const r of t.getCrossTileIDsLists())for(const t of r)delete this.usedCrossTileIDs[e][t]}removeStaleBuckets(e){let t=!1;for(const r in this.indexes){const i=this.indexes[r];for(const n in i)e[i[n].bucketInstanceId]||(this.removeBucketCrossTileIDs(r,i[n]),delete i[n],t=!0)}return t}}class Et{constructor(){this.layerIndexes={},this.crossTileIDs=new Tt,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,r){let i=this.layerIndexes[e.id];void 0===i&&(i=this.layerIndexes[e.id]=new St);let n=!1;const o={};i.handleWrapJump(r);for(const a of t){const t=a.getBucket(e);t&&e.id===t.layerIds[0]&&(t.bucketInstanceId||(t.bucketInstanceId=++this.maxBucketInstanceId),i.addBucket(a.tileID,t,this.crossTileIDs)&&(n=!0),o[t.bucketInstanceId]=!0)}return i.removeStaleBuckets(o)&&(n=!0),n}pruneUnusedLayers(e){const t={};e.forEach(e=>{t[e]=!0});for(const r in this.layerIndexes)t[r]||delete this.layerIndexes[r]}}var It="void main() {fragColor=vec4(1.0);}";const Pt={prelude:kt("#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:kt("","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:kt("","#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:kt("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:kt("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:kt("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:kt(It,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:kt("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:kt("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:kt("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:kt("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);}"),colorRelief:kt("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform int u_color_ramp_size;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {float x=(float(stop)+0.5)/float(u_color_ramp_size);vec4 data=texture(u_elevation_stops,vec2(x,0))*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int r=(u_color_ramp_size-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else\n{l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(u_color_ramp_size);fragColor=u_opacity*texture(u_color_stops,vec2(x,0));\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_dimension;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),debug:kt("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:kt(It,"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:kt("#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:kt("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:kt("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:kt("#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:kt("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:kt("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:kt("#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);}void main() {vec2 epsilon=1.0/u_dimension;float tileSize=u_dimension.x-2.0;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))*tileSize/pow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.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:kt("uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES];\n#define PI 3.141592653589793\n#define STANDARD 0\n#define COMBINED 1\n#define IGOR 2\n#define MULTIDIRECTIONAL 3\n#define BASIC 4\nfloat get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;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_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else\n{fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else\n{fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {vec4 pixel=texture(u_image,v_pos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;if (u_method==BASIC) {basic_hillshade(deriv);} else if (u_method==COMBINED) {combined_hillshade(deriv);} else if (u_method==IGOR) {igor_hillshade(deriv);} else if (u_method==MULTIDIRECTIONAL) {multidirectional_hillshade(deriv);} else if (u_method==STANDARD) {standard_hillshade(deriv);} else {standard_hillshade(deriv);}\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:kt("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:kt("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:kt("#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:kt("uniform lowp float u_device_pixel_ratio;uniform lowp float u_lineatlas_width;uniform sampler2D u_image;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\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\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\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\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);float sdfgamma=(u_lineatlas_width/256.0/u_device_pixel_ratio)/min(dasharray_from.w,dasharray_to.w);alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+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_units_to_pixels;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;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\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\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\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_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\nfloat u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}"),lineGradientSDF:kt("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform sampler2D u_image_dash;uniform float u_mix;uniform lowp float u_lineatlas_width;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;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\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\nvoid main() {\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\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_to\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);float sdfdist_a=texture(u_image_dash,v_tex_a).a;float sdfdist_b=texture(u_image_dash,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0)/min(dasharray_from.w,dasharray_to.w);float dash_alpha=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*dash_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;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;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;out vec2 v_tex_a;out vec2 v_tex_b;\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\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump vec4 dasharray_from\n#pragma mapbox: define mediump vec4 dasharray_to\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\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 dasharray_from\n#pragma mapbox: initialize mediump vec4 dasharray_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;float texel_height=1.0/u_image_height;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\nfloat u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}"),raster:kt("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:kt("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:kt("#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:kt("#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:kt("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:kt("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:kt("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:kt("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:kt("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:kt("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 kt(e,t){const r=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,i=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(r,(e,t,r,i,n)=>(s[n]=!0,"define"===t?`\n#ifndef HAS_UNIFORM_u_${n}\nin ${r} ${i} ${n};\n#else\nuniform ${r} ${i} u_${n};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${n}\n ${r} ${i} ${n} = u_${n};\n#endif\n`)),vertexSource:t=t.replace(r,(e,t,r,i,n)=>{const o="float"===i?"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 ${r} ${o} a_${n};\nout ${r} ${i} ${n};\n#else\nuniform ${r} ${i} u_${n};\n#endif\n`:"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${n}\n ${n} = a_${n};\n#else\n ${r} ${i} ${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 ${r} ${i} ${n} = u_${n};\n#endif\n`:"define"===t?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nin ${r} ${o} a_${n};\n#else\nuniform ${r} ${i} u_${n};\n#endif\n`:"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${n}\n ${r} ${i} ${n} = a_${n};\n#else\n ${r} ${i} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n ${r} ${i} ${n} = unpack_mix_${a}(a_${n}, u_${n}_t);\n#else\n ${r} ${i} ${n} = u_${n};\n#endif\n`}),staticAttributes:i,staticUniforms:a}}class At{constructor(e,t,r){this.vertexBuffer=e,this.indexBuffer=t,this.segments=r}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var Ct=t.aT([{name:"a_pos",type:"Int16",components:2}]);const Mt="#define PROJECTION_MERCATOR",Dt="mercator";class Rt{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return Dt}get shaderDefine(){return Mt}get shaderPreludeCode(){return Pt.projectionMercator}get vertexShaderPreludeCode(){return Pt.projectionMercator.vertexSource}get subdivisionGranularity(){return t.aU.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(e){}getMeshFromTileID(e,r,i,n,o){if(this._cachedMesh)return this._cachedMesh;const a=new t.aV;a.emplaceBack(0,0),a.emplaceBack(t.a4,0),a.emplaceBack(0,t.a4),a.emplaceBack(t.a4,t.a4);const s=e.createVertexBuffer(a,Ct.members),l=t.aW.simpleSegment(0,0,4,2),c=new t.aX;c.emplaceBack(1,0,2),c.emplaceBack(1,2,3);const u=e.createIndexBuffer(c);return this._cachedMesh=new At(s,u,l),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(e){}}class Lt{constructor(e=0,t=0,r=0,i=0){if(isNaN(e)||e<0||isNaN(t)||t<0||isNaN(r)||r<0||isNaN(i)||i<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=r,this.right=i}interpolate(e,r,i){return null!=r.top&&null!=e.top&&(this.top=t.G.number(e.top,r.top,i)),null!=r.bottom&&null!=e.bottom&&(this.bottom=t.G.number(e.bottom,r.bottom,i)),null!=r.left&&null!=e.left&&(this.left=t.G.number(e.left,r.left,i)),null!=r.right&&null!=e.right&&(this.right=t.G.number(e.right,r.right,i)),this}getCenter(e,r){const i=t.an((this.left+e-this.right)/2,0,e),n=t.an((this.top+r-this.bottom)/2,0,r);return new t.P(i,n)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new Lt(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function Ft(e,t){if(!e.renderWorldCopies||e.lngRange)return;const r=t.lng-e.center.lng;t.lng+=r>180?-360:r<-180?360:0}function Ot(e){return Math.max(0,Math.floor(e))}class zt{constructor(e,r){var i;this.applyConstrain=(e,t)=>null!==this._constrainOverride?this._constrainOverride(e,t):this._callbacks.defaultConstrain(e,t),this._callbacks=e,this._tileSize=512,this._renderWorldCopies=void 0===(null==r?void 0:r.renderWorldCopies)||!!(null==r?void 0:r.renderWorldCopies),this._minZoom=(null==r?void 0:r.minZoom)||0,this._maxZoom=(null==r?void 0:r.maxZoom)||22,this._minPitch=null==(null==r?void 0:r.minPitch)?0:null==r?void 0:r.minPitch,this._maxPitch=null==(null==r?void 0:r.maxPitch)?60:null==r?void 0:r.maxPitch,this._constrainOverride=null!==(i=null==r?void 0:r.constrainOverride)&&void 0!==i?i:null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new t.V(0,0),this._elevation=0,this._zoom=0,this._tileZoom=Ot(this._zoom),this._scale=t.aq(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new Lt,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(e,r,i){this._constrainOverride=e.constrainOverride,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=Ot(this._zoom),this._scale=t.aq(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 Lt(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=!i&&e.autoCalculateNearFarZ,r&&this.constrainInternal(),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.applyConstrain(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.setZoom(this.applyConstrain(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 constrainOverride(){return this._constrainOverride}setConstrainOverride(e){void 0===e&&(e=null),this._constrainOverride!==e&&(this._constrainOverride=e,this.constrainInternal(),this._calcMatrices())}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 r=t.W(e,-180,180)*Math.PI/180;var n,o,a,s,l,c,u,h,d;this._bearingInRadians!==r&&(this._unmodified=!1,this._bearingInRadians=r,this._calcMatrices(),this._rotationMatrix=i(),n=this._rotationMatrix,a=-this._bearingInRadians,s=(o=this._rotationMatrix)[0],l=o[1],c=o[2],u=o[3],h=Math.sin(a),d=Math.cos(a),n[0]=s*d+c*h,n[1]=l*d+u*h,n[2]=s*-h+c*d,n[3]=l*-h+u*d)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(e){const r=t.an(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==r&&(this._unmodified=!1,this._pitchInRadians=r,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.aY(this._fovInRadians)}setFov(e){e=t.an(e,.1,150),this.fov!==e&&(this._unmodified=!1,this._fovInRadians=t.ap(e),this._calcMatrices())}get zoom(){return this._zoom}setZoom(e){const r=this.applyConstrain(this._center,e).zoom;this._zoom!==r&&(this._unmodified=!1,this._zoom=r,this._tileZoom=Math.max(0,Math.floor(r)),this._scale=t.aq(r),this.constrainInternal(),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.constrainInternal(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(e){e!==this._elevation&&(this._elevation=e,this.constrainInternal(),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,r){this._unmodified=!1,this._edgeInsets.interpolate(e,t,r),this.constrainInternal(),this._calcMatrices()}resize(e,t,r=!0){this._width=e,this._height=t,r&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){return this._latRange&&2===this._latRange.length&&this._lngRange&&2===this._lngRange.length?new Z([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.constrainInternal()):(this._lngRange=null,this._latRange=[-t.ao,t.ao])}getCameraQueryGeometry(e,r){if(1===r.length)return[r[0],e];{const{minX:i,minY:n,maxX:o,maxY:a}=t.ab.fromPoints(r).extend(e);return[new t.P(i,n),new t.P(o,n),new t.P(o,a),new t.P(i,a),new t.P(i,n)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;const e=this._unmodified,{center:t,zoom:r}=this.applyConstrain(this.center,this.zoom);this.setCenter(t),this.setZoom(r),this._unmodified=e,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let e=t.ar(new Float64Array(16));t.Q(e,e,[this._width/2,-this._height/2,1]),t.O(e,e,[1,-1,0]),this._clipSpaceToPixelsMatrix=e,e=t.ar(new Float64Array(16)),t.Q(e,e,[1,-1,1]),t.O(e,e,[-1,-1,0]),t.Q(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,r,i,n){const o=void 0!==i?i:this.bearing,a=n=void 0!==n?n:this.pitch,s=t.aa.fromLngLat(e,r),l=-Math.cos(t.ap(a)),c=Math.sin(t.ap(a)),u=c*Math.sin(t.ap(o)),h=-c*Math.cos(t.ap(o));let d=this.elevation;const p=r-d;let f;l*p>=0||Math.abs(l)<.1?(f=1e4,d=r+f*l):f=-p/l;let m,g,_=t.aZ(1,s.y),y=0;do{if(y+=1,y>10)break;g=f/_,m=new t.aa(s.x+u*g,s.y+h*g),_=1/m.meterInMercatorCoordinateUnits()}while(Math.abs(f-g*_)>1e-12);return{center:m.toLngLat(),elevation:d,zoom:t.at(this.height/2/Math.tan(this.fovInRadians/2)/g/this.tileSize)}}recalculateZoomAndCenter(e){if(this.elevation-e==0)return;const r=t.as(1,this.center.lat)*this.worldSize,i=this.cameraToCenterDistance/r,n=t.aa.fromLngLat(this.center,this.elevation),o=ve(this.center,this.elevation,this.pitch,this.bearing,i);this._elevation=e;const a=this.calculateCenterFromCameraLngLatAlt(o.toLngLat(),t.aZ(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.as(1,this.center.lat)*this.worldSize;return ve(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/e).toLngLat()}getMercatorTileCoordinates(e){if(!e)return[0,0,1,1];const r=e.canonical.z>=0?1<<e.canonical.z:Math.pow(2,e.canonical.z);return[e.canonical.x/r,e.canonical.y/r,1/r/t.a4,1/r/t.a4]}}class Bt{constructor(e,r){this.min=e,this.max=r,this.center=t.a_([],t.a$([],this.min,this.max),.5)}quadrant(e){const r=[e%2==0,e<2],i=t.b0(this.min),n=t.b0(this.max);for(let t=0;t<r.length;t++)i[t]=r[t]?this.min[t]:this.center[t],n[t]=r[t]?this.center[t]:this.max[t];return n[2]=this.max[2],new Bt(i,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 r=0;r<e.planes.length;r++){const i=this.intersectsPlane(e.planes[r]);if(0===i)return 0;1===i&&(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],r=e[3];for(let i=0;i<3;i++)e[i]>0?(t+=e[i]*this.min[i],r+=e[i]*this.max[i]):(r+=e[i]*this.min[i],t+=e[i]*this.max[i]);return t>=0?2:r<0?0:1}}class Nt{distanceToTile2d(e,t,r,i){const n=i.distanceX([e,t]),o=i.distanceY([e,t]);return Math.hypot(n,o)}getWrap(e,t,r){return r}getTileBoundingVolume(e,r,i,n){var o,a;let s=0,l=0;if(null==n?void 0:n.terrain){const c=new t.a1(e.z,r,e.z,e.x,e.y),u=n.terrain.getMinMaxElevation(c);s=null!==(o=u.minElevation)&&void 0!==o?o:Math.min(0,i),l=null!==(a=u.maxElevation)&&void 0!==a?a:Math.max(0,i)}const c=1<<e.z;return new Bt([r+e.x/c,e.y/c,s],[r+(e.x+1)/c,(e.y+1)/c,l])}allowVariableZoom(e,r){const i=e.fov*(Math.abs(Math.cos(e.rollInRadians))*e.height+Math.abs(Math.sin(e.rollInRadians))*e.width)/e.height,n=t.an(78.5-i/2,0,60);return!!r.terrain||e.pitch>n}allowWorldCopies(){return!0}prepareNextFrame(){}}class jt{constructor(e,t,r){this.points=e,this.planes=t,this.aabb=r}static fromInvProjectionMatrix(e,r=1,i=0,n,o){const a=o?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],s=Math.pow(2,i),l=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(i=>function(e,r,i,n){const o=t.aG([],e,r),a=1/o[3]/i*n;return t.b5(o,o,[a,a,1/o[3],a])}(i,e,r,s));n&&function(e,r,i,n){const o=n?4:0,a=n?0:4;let s=0;const l=[],c=[];for(let d=0;d<4;d++){const r=t.b1([],e[d+a],e[d+o]),i=t.b6(r);t.a_(r,r,1/i),l.push(i),c.push(r)}for(let d=0;d<4;d++){const r=t.b7(e[d+o],c[d],i);s=null!==r&&r>=0?Math.max(s,r):Math.max(s,l[d])}const u=function(e,r){const i=t.b1([],e[r[0]],e[r[1]]),n=t.b1([],e[r[2]],e[r[1]]),o=[0,0,0,0];return t.b2(o,t.b3([],i,n)),o[3]=-t.b4(o,e[r[0]]),o}(e,r),h=function(e,r){const i=t.b8(e),n=t.b9([],e,1/i),o=t.b1([],r,t.a_([],n,t.b4(r,n))),a=t.b8(o);if(a>0){const e=Math.sqrt(1-n[3]*n[3]),i=t.a_([],n,-n[3]),s=t.a$([],i,t.a_([],o,e/a));return t.ba(r,s)}return null}(i,u);if(null!==h){const e=h/t.b4(c[0],u);s=Math.min(s,e)}for(let t=0;t<4;t++){const r=Math.min(s,l[t]);e[t+a]=[e[t+o][0]+c[t][0]*r,e[t+o][1]+c[t][1]*r,e[t+o][2]+c[t][2]*r,1]}}(l,a[0],n,o);const c=a.map(e=>{const r=t.b1([],l[e[0]],l[e[1]]),i=t.b1([],l[e[2]],l[e[1]]),n=t.b2([],t.b3([],r,i)),o=-t.b4(n,l[e[1]]);return n.concat(o)}),u=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],h=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(const t of l)for(let e=0;e<3;e++)u[e]=Math.min(u[e],t[e]),h[e]=Math.max(h[e],t[e]);return new jt(l,c,new Bt(u,h))}}class Vt{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,r){return this._helper.interpolatePadding(e,t,r)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t,r=!0){this._helper.resize(e,t,r)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}setConstrainOverride(e){this._helper.setConstrainOverride(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 constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e,t){}constructor(e){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this.defaultConstrain=(e,r)=>{r=t.an(+r,this.minZoom,this.maxZoom);const i={center:new t.V(e.lng,e.lat),zoom:r};let n=this._helper._lngRange;if(!this._helper._renderWorldCopies&&null===n){const e=180-1e-10;n=[-e,e]}const o=this.tileSize*t.aq(i.zoom);let a=0,s=o,l=0,c=o,u=0,h=0;const{x:d,y:p}=this.size;if(this._helper._latRange){const e=this._helper._latRange;a=t.X(e[1])*o,s=t.X(e[0])*o,s-a<p&&(u=p/(s-a))}n&&(l=t.W(t.Y(n[0])*o,0,o),c=t.W(t.Y(n[1])*o,0,o),c<l&&(c+=o),c-l<d&&(h=d/(c-l)));const{x:f,y:m}=me(o,e);let g,_;const y=Math.max(h||0,u||0);if(y){const e=new t.P(h?(c+l)/2:f,u?(s+a)/2:m);return i.center=ge(o,e).wrap(),i.zoom+=t.at(y),i}if(this._helper._latRange){const e=p/2;m-e<a&&(_=a+e),m+e>s&&(_=s-e)}if(n){const e=(l+c)/2;let r=f;this._helper._renderWorldCopies&&(r=t.W(f,e-o/2,e+o/2));const i=d/2;r-i<l&&(g=l+i),r+i>c&&(g=c-i)}if(void 0!==g||void 0!==_){const e=new t.P(null!=g?g:f,null!=_?_:m);i.center=ge(o,e).wrap()}return i},this.applyConstrain=(e,t)=>this._helper.applyConstrain(e,t),this._helper=new zt({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(e,t)=>this.defaultConstrain(e,t)},e),this._coveringTilesDetailsProvider=new Nt}clone(){const e=new Vt;return e.apply(this),e}apply(e,t,r){this._helper.apply(e,t,r)}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 r=[new t.bb(0,e)];if(this._helper._renderWorldCopies){const i=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(i.x,n.x,o.x,a.x)),l=Math.floor(Math.max(i.x,n.x,o.x,a.x)),c=1;for(let u=s-c;u<=l+c;u++)0!==u&&r.push(new t.bb(u,e))}return r}getCameraFrustum(){return jt.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){const t=this.screenPointToLocation(this.centerPoint,e),r=e?e.getElevationForLngLatZoom(t,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(r)}setLocationAtPoint(e,r){const i=t.as(this.elevation,this.center.lat),n=this.screenPointToMercatorCoordinateAtZ(r,i),o=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,i),a=t.aa.fromLngLat(e),s=new t.aa(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,r){return r?this.coordinatePoint(t.aa.fromLngLat(e),r.getElevationForLngLatZoom(e,this._helper._tileZoom),this._pixelMatrix3D):this.coordinatePoint(t.aa.fromLngLat(e))}screenPointToLocation(e,t){var r;return null===(r=this.screenPointToMercatorCoordinate(e,t))||void 0===r?void 0:r.toLngLat()}screenPointToMercatorCoordinate(e,t){if(t){const r=t.pointCoordinate(e);if(null!=r)return r}return this.screenPointToMercatorCoordinateAtZ(e)}screenPointToMercatorCoordinateAtZ(e,r){const i=r||0,n=[e.x,e.y,0,1],o=[e.x,e.y,1,1];t.aG(n,n,this._pixelMatrixInverse),t.aG(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,d=u===h?0:(i-u)/(h-u);return new t.aa(t.G.number(n[0]/a,o[0]/s,d)/this.worldSize,t.G.number(l,c,d)/this.worldSize,i)}coordinatePoint(e,r=0,i=this._pixelMatrix){const n=[e.x*this.worldSize,e.y*this.worldSize,r,1];return t.aG(n,n,i),new t.P(n[0]/n[3],n[1]/n[3])}getBounds(){const e=Math.max(0,this._helper._height/2-_e(this));return(new Z).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-_e(this)}calculatePosMatrix(e,r=!1,i){var n;const o=null!==(n=e.key)&&void 0!==n?n:t.bc(e.wrap,e.canonical.z,e.canonical.z,e.canonical.x,e.canonical.y),a=r?this._alignedPosMatrixCache:this._posMatrixCache;if(a.has(o)){const e=a.get(o);return i?e.f32:e.f64}const s=ye(e,this.worldSize);t.S(s,r?this._alignedProjMatrix:this._viewProjMatrix,s);const l={f64:s,f32:new Float32Array(s)};return a.set(o,l),i?l.f32:l.f64}calculateFogMatrix(e){const r=e.key,i=this._fogMatrixCacheF32;if(i.has(r))return i.get(r);const n=ye(e,this.worldSize);return t.S(n,this._fogMatrix,n),i.set(r,new Float32Array(n)),i.get(r)}calculateCenterFromCameraLngLatAlt(e,t,r,i){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,r,i)}_calculateNearFarZIfNeeded(e,r,i){if(!this._helper.autoCalculateNearFarZ)return;const n=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),o=e-n*this._helper._pixelPerMeter/Math.cos(r),a=n<0?o:e,s=Math.PI/2+this.pitchInRadians,l=t.ap(this.fov)*(Math.abs(Math.cos(t.ap(this.roll)))*this.height+Math.abs(Math.sin(t.ap(this.roll)))*this.width)/this.height*(.5+i.y/this.height),c=Math.sin(l)*a/Math.sin(t.an(Math.PI-s-l,.01,Math.PI-.01)),u=_e(this),h=Math.atan(u/this._helper.cameraToCenterDistance),d=t.ap(.75),p=h>d?2*h*(.5+i.y/(2*u)):d,f=Math.sin(p)*a/Math.sin(t.an(Math.PI-s-p,.01,Math.PI-.01)),m=Math.min(c,f);this._helper._farZ=1.01*(Math.cos(Math.PI/2-r)*m+a),this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;const e=this.centerOffset,r=me(this.worldSize,this.center),i=r.x,n=r.y;this._helper._pixelPerMeter=t.as(1,this.center.lat)*this.worldSize;const o=t.ap(Math.min(this.pitch,fe)),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.bd(s,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),t.aA(this._invProjMatrix,s),s[8]=2*-e.x/this._helper._width,s[9]=2*e.y/this._helper._height,this._projectionMatrix=t.be(s),t.Q(s,s,[1,-1,1]),t.O(s,s,[0,0,-this._helper.cameraToCenterDistance]),t.bf(s,s,-this.rollInRadians),t.bg(s,s,this.pitchInRadians),t.bf(s,s,-this.bearingInRadians),t.O(s,s,[-i,-n,0]),this._mercatorMatrix=t.Q([],s,[this.worldSize,this.worldSize,this.worldSize]),t.Q(s,s,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=t.S(new Float64Array(16),this.clipSpaceToPixelsMatrix,s),t.O(s,s,[0,0,-this.elevation]),this._viewProjMatrix=s,this._invViewProjMatrix=t.aA([],s);const l=[0,0,-1,1];t.aG(l,l,this._invViewProjMatrix),this._cameraPosition=[l[0]/l[3],l[1]/l[3],l[2]/l[3]],this._fogMatrix=new Float64Array(16),t.bd(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.Q(this._fogMatrix,this._fogMatrix,[1,-1,1]),t.O(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),t.bf(this._fogMatrix,this._fogMatrix,-this.rollInRadians),t.bg(this._fogMatrix,this._fogMatrix,this.pitchInRadians),t.bf(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),t.O(this._fogMatrix,this._fogMatrix,[-i,-n,0]),t.Q(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),t.O(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=t.S(new Float64Array(16),this.clipSpaceToPixelsMatrix,s);const c=this._helper._width%2/2,u=this._helper._height%2/2,h=Math.cos(this.bearingInRadians),d=Math.sin(-this.bearingInRadians),p=i-Math.round(i)+h*c+d*u,f=n-Math.round(n)+h*u+d*c,m=new Float64Array(s);if(t.O(m,m,[p>.5?p-1:p,f>.5?f-1:f,0]),this._alignedProjMatrix=m,s=t.aA(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)),r=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.aG(r,r,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){const e=t.as(1,this.center.lat)*this.worldSize;return ve(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/e).toLngLat()}lngLatToCameraDepth(e,r){const i=t.aa.fromLngLat(e),n=[i.x*this.worldSize,i.y*this.worldSize,r,1];return t.aG(n,n,this._viewProjMatrix),n[2]/n[3]}getProjectionData(e){const{overscaledTileID:r,aligned:i,applyTerrainMatrix:n}=e,o=this._helper.getMercatorTileCoordinates(r),a=r?this.calculatePosMatrix(r,i,!0):null;let s;return s=r&&r.terrainRttPosMatrix32f&&n?r.terrainRttPosMatrix32f:a||t.bh(),{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,r){return 1}transformLightDirection(e){return t.b0(e)}getRayDirectionFromPixel(e){throw new Error("Not implemented.")}projectTileCoordinates(e,r,i,n){const o=this.calculatePosMatrix(i);let a;n?(a=[e,r,n(e,r),1],t.aG(a,a,o)):(a=[e,r,0,1],Qe(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,r){const i=t.aa.fromLngLat(e,r),n=i.meterInMercatorCoordinateUnits(),o=t.bi();return t.O(o,o,[i.x,i.y,i.z]),t.bf(o,o,Math.PI),t.bg(o,o,Math.PI/2),t.Q(o,o,[-n,n,n]),o}getProjectionDataForCustomLayer(e=!0){const r=new t.a1(0,0,0,0,0),i=this.getProjectionData({overscaledTileID:r,applyGlobeMatrix:e}),n=ye(r,this.worldSize);t.S(n,this._viewProjMatrix,n),i.tileMercatorCoords=[0,0,1,1];const o=[t.a4,t.a4,this.worldSize/this._helper.pixelsPerMeter],a=t.bj();return t.Q(a,n,o),i.fallbackMatrix=a,i.mainMatrix=a,i}getFastPathSimpleProjectionMatrix(e){return this.calculatePosMatrix(e)}}function Ut(){t.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function Gt(e){if(e.useSlerp)if(e.k<1){const r=t.bk(e.startEulerAngles.roll,e.startEulerAngles.pitch,e.startEulerAngles.bearing),i=t.bk(e.endEulerAngles.roll,e.endEulerAngles.pitch,e.endEulerAngles.bearing),n=new Float64Array(4);t.bl(n,r,i,e.k);const o=t.bm(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.G.number(e.startEulerAngles.roll,e.endEulerAngles.roll,e.k)),e.tr.setPitch(t.G.number(e.startEulerAngles.pitch,e.endEulerAngles.pitch,e.k)),e.tr.setBearing(t.G.number(e.startEulerAngles.bearing,e.endEulerAngles.bearing,e.k))}function qt(e,r,i,n,o){const a=o.padding,s=me(o.worldSize,i.getNorthWest()),l=me(o.worldSize,i.getNorthEast()),c=me(o.worldSize,i.getSouthEast()),u=me(o.worldSize,i.getSouthWest()),h=t.ap(-n),d=s.rotate(h),p=l.rotate(h),f=c.rotate(h),m=u.rotate(h),g=new t.P(Math.max(d.x,p.x,m.x,f.x),Math.max(d.y,p.y,m.y,f.y)),_=new t.P(Math.min(d.x,p.x,m.x,f.x),Math.min(d.y,p.y,m.y,f.y)),y=g.sub(_),v=(o.width-(a.left+a.right+r.left+r.right))/y.x,b=(o.height-(a.top+a.bottom+r.top+r.bottom))/y.y;if(b<0||v<0)return void Ut();const x=Math.min(t.at(o.scale*Math.min(v,b)),e.maxZoom),w=t.P.convert(e.offset),T=new t.P((r.left-r.right)/2,(r.top-r.bottom)/2).rotate(t.ap(n)),S=w.add(T).mult(o.scale/t.aq(x));return{center:ge(o.worldSize,s.add(c).div(2).sub(S)),zoom:x,bearing:n}}class $t{get useGlobeControls(){return!1}handlePanInertia(e,t){const r=e.mag(),i=Math.abs(_e(t));return{easingOffset:e.mult(Math.min(.75*i/r,1)),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,r){e.around.distSqr(t.centerPoint)<.01||t.setLocationAtPoint(r,e.around)}cameraForBoxAndBearing(e,t,r,i,n){return qt(e,t,r,i,n)}handleJumpToCenterZoom(e,r){e.zoom!==(void 0!==r.zoom?+r.zoom:e.zoom)&&e.setZoom(+r.zoom),void 0!==r.center&&e.setCenter(t.V.convert(r.center))}handleEaseTo(e,r){const i=e.zoom,n=e.padding,o={roll:e.roll,pitch:e.pitch,bearing:e.bearing},a={roll:void 0===r.roll?e.roll:r.roll,pitch:void 0===r.pitch?e.pitch:r.pitch,bearing:void 0===r.bearing?e.bearing:r.bearing},s=void 0!==r.zoom,l=!e.isPaddingEqual(r.padding);let c=!1;const u=s?+r.zoom:e.zoom;let h=e.centerPoint.add(r.offsetAsPoint);const d=e.screenPointToLocation(h),{center:p,zoom:f}=e.applyConstrain(t.V.convert(r.center||d),null!=u?u:i);Ft(e,p);const m=me(e.worldSize,d),g=me(e.worldSize,p).sub(m),_=t.aq(f-i);return c=f!==i,{easeFunc:s=>{if(c&&e.setZoom(t.G.number(i,f,s)),t.bn(o,a)||Gt({startEulerAngles:o,endEulerAngles:a,tr:e,k:s,useSlerp:o.roll!=a.roll}),l&&(e.interpolatePadding(n,r.padding,s),h=e.centerPoint.add(r.offsetAsPoint)),r.around)e.setLocationAtPoint(r.around,r.aroundPoint);else{const r=t.aq(e.zoom-i),n=f>i?Math.min(2,_):Math.max(.5,_),o=Math.pow(n,1-s),a=ge(e.worldSize,m.add(g.mult(s*o)).mult(r));e.setLocationAtPoint(e.renderWorldCopies?a.wrap():a,h)}},isZooming:c,elevationCenter:p}}handleFlyTo(e,r){const i=void 0!==r.zoom,n=e.zoom,o=e.applyConstrain(t.V.convert(r.center||r.locationAtOffset),i?+r.zoom:n),a=o.center,s=o.zoom;Ft(e,a);const l=me(e.worldSize,r.locationAtOffset),c=me(e.worldSize,a).sub(l),u=c.mag(),h=t.aq(s-n);let d;if(void 0!==r.minZoom){const i=Math.min(+r.minZoom,n,s),o=e.applyConstrain(a,i).zoom;d=t.aq(o-n)}return{easeFunc:(r,i,o,u)=>{e.setZoom(1===r?s:n+t.at(i));const h=1===r?a:ge(e.worldSize,l.add(c.mult(o)).mult(i));e.setLocationAtPoint(e.renderWorldCopies?h.wrap():h,u)},scaleOfZoom:h,targetCenter:a,scaleOfMinZoom:d,pixelPathLength:u}}}class Wt{constructor(e,t,r){this.blendFunction=e,this.blendColor=t,this.mask=r}}Wt.Replace=[1,0],Wt.disabled=new Wt(Wt.Replace,t.bo.transparent,[!1,!1,!1,!1]),Wt.unblended=new Wt(Wt.Replace,t.bo.transparent,[!0,!0,!0,!0]),Wt.alphaBlended=new Wt([1,771],t.bo.transparent,[!0,!0,!0,!0]);const Zt=2305;class Ht{constructor(e,t,r){this.enable=e,this.mode=t,this.frontFace=r}}Ht.disabled=new Ht(!1,1029,Zt),Ht.backCCW=new Ht(!0,1029,Zt),Ht.frontCCW=new Ht(!0,1028,Zt);class Xt{constructor(e,t,r){this.func=e,this.mask=t,this.range=r}}Xt.ReadOnly=!1,Xt.ReadWrite=!0,Xt.disabled=new Xt(519,Xt.ReadOnly,[0,1]);const Yt=7680;class Jt{constructor(e,t,r,i,n,o){this.test=e,this.ref=t,this.mask=r,this.fail=i,this.depthFail=n,this.pass=o}}Jt.disabled=new Jt({func:519,mask:0},0,0,Yt,Yt,Yt);const Kt=new WeakMap;function Qt(e){var t;if(Kt.has(e))return Kt.get(e);{const r=null===(t=e.getParameter(e.VERSION))||void 0===t?void 0:t.startsWith("WebGL 2.0");return Kt.set(e,r),r}}class er{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 r=e.context,i=r.gl;this._texFormat=i.RGBA,this._texType=i.UNSIGNED_BYTE;const n=new t.aV;n.emplaceBack(-1,-1),n.emplaceBack(2,-1),n.emplaceBack(-1,2);const o=new t.aX;o.emplaceBack(0,1,2),this._fullscreenTriangle=new At(r.createVertexBuffer(n,Ct.members),r.createIndexBuffer(o),t.aW.simpleSegment(0,0,n.length,o.length)),this._resultBuffer=new Uint8Array(4),r.activeTexture.set(i.TEXTURE1);const a=i.createTexture();i.bindTexture(i.TEXTURE_2D,a),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.NEAREST),i.texImage2D(i.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=r.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(a),Qt(i)&&(this._pbo=i.createBuffer(),i.bindBuffer(i.PIXEL_PACK_BUFFER,this._pbo),i.bufferData(i.PIXEL_PACK_BUFFER,4,i.STREAM_READ),i.bindBuffer(i.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 r=this._updateCount;return this._readbackQueue?r>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():r>=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,r){const i=this._cachedRenderContext.context,n=i.gl;if(this._bindFramebuffer(),i.viewport.set([0,0,this._texWidth,this._texHeight]),i.clear({color:t.bo.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(i,n.TRIANGLES,Xt.disabled,Jt.disabled,Wt.unblended,Ht.disabled,((e,t)=>({u_input:e,u_output_expected:t}))(e,r),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&Qt(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&&Qt(e)){const r=e.clientWaitSync(this._readbackQueue.sync,0,0);if(r===e.WAIT_FAILED)return t.w("WebGL2 clientWaitSync failed."),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(r===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=er._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 tr=t.a4/128;function rr(e,r){const i=void 0!==e.granularity?Math.max(e.granularity,1):1,n=i+(e.generateBorders?2:0),o=i+(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=i+(e.generateBorders?1:0),h=i+(e.generateBorders||e.extendToSouthPole?1:0),d=a*s,p=n*o*6,f=a*s>65536;if(f&&"16bit"===r)throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");const m=f||"32bit"===r,g=new Int16Array(2*d);let _=0;for(let b=c;b<=h;b++)for(let r=l;r<=u;r++){let n=r/i*t.a4;-1===r&&(n=-tr),r===i+1&&(n=t.a4+tr);let o=b/i*t.a4;-1===b&&(o=e.extendToNorthPole?t.bq:-tr),b===i+1&&(o=e.extendToSouthPole?t.br:t.a4+tr),g[_++]=n,g[_++]=o}const y=m?new Uint32Array(p):new Uint16Array(p);let v=0;for(let t=0;t<o;t++)for(let e=0;e<n;e++){const r=e+1+t*a,i=e+(t+1)*a,n=e+1+(t+1)*a;y[v++]=e+t*a,y[v++]=i,y[v++]=r,y[v++]=r,y[v++]=i,y[v++]=n}return{vertices:g.buffer.slice(0),indices:y.buffer.slice(0),uses32bitIndices:m}}const ir=new t.aU({fill:new t.bs(128,2),line:new t.bs(512,0),tile:new t.bs(128,32),stencil:new t.bs(128,1),circle:3});class nr{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 ir}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(e){this._errorMeasurement||(this._errorMeasurement=new er(e));const r=t.X(this._errorQueryLatitudeDegrees),i=2*Math.atan(Math.exp(Math.PI-r*Math.PI*2))-.5*Math.PI,n=this._errorMeasurement.updateErrorLoop(r,i),o=c();n!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=n,this._errorMeasurementLastChangeTime=o);const a=Math.min(Math.max((o-this._errorMeasurementLastChangeTime)/1e3/.5,0),1);this._errorCorrectionUsable=t.bt(this._errorCorrectionPreviousValue,-this._errorMeasurementLastValue,t.bu(a))}_getMeshKey(e){return`${e.granularity.toString(36)}_${e.generateBorders?"b":""}${e.extendToNorthPole?"n":""}${e.extendToSouthPole?"s":""}`}getMeshFromTileID(e,t,r,i,n){const o=("stencil"===n?ir.stencil:ir.tile).getGranularityForZoomLevel(t.z);return this._getMesh(e,{granularity:o,generateBorders:r,extendToNorthPole:0===t.y&&i,extendToSouthPole:t.y===(1<<t.z)-1&&i})}_getMesh(e,r){const i=this._getMeshKey(r);if(i in this._tileMeshCache)return this._tileMeshCache[i];const n=function(e,r){const i=rr(r,"16bit"),n=t.aV.deserialize({arrayBuffer:i.vertices,length:i.vertices.byteLength/2/2}),o=t.aX.deserialize({arrayBuffer:i.indices,length:i.indices.byteLength/2/3});return new At(e.createVertexBuffer(n,Ct.members),e.createIndexBuffer(o),t.aW.simpleSegment(0,0,n.length,o.length))}(e,r);return this._tileMeshCache[i]=n,n}recalculate(e){}hasTransition(){const e=c();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 or=new t.t({type:new t.D(t.u.projection.type)});class ar extends t.E{constructor(e){super(),this._transitionable=new t.x(or,void 0),this.setProjection(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new t.H(0)),this._mercatorProjection=new Rt,this._verticalPerspectiveProjection=new nr}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.bv){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,r,i,n){return this.currentProjection.getMeshFromTileID(e,t,r,i,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 sr(e){const t=ur(e.worldSize,e.center.lat);return 2*Math.PI*t}function lr(e,r,i,n,o){const a=1/(1<<o),s=r/t.a4*a+n*a,l=t.bx((e/t.a4*a+i*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 cr(e){return function(e,t){const r=Math.cos(t),i=new Float64Array(3);return i[0]=Math.sin(e)*r,i[1]=Math.sin(t),i[2]=Math.cos(e)*r,i}(e.lng*Math.PI/180,e.lat*Math.PI/180)}function ur(e,t){return e/(2*Math.PI)/Math.cos(t*Math.PI/180)}function hr(e){const r=Math.asin(e[1])/Math.PI*180,i=Math.sqrt(e[0]*e[0]+e[2]*e[2]);if(i>1e-6){const n=e[0]/i,o=Math.acos(e[2]/i),a=(n>0?o:-o)/Math.PI*180;return new t.V(t.W(a,-180,180),r)}return new t.V(0,r)}function dr(e){return Math.cos(e*Math.PI/180)}function pr(e,r){const i=dr(e),n=dr(r);return t.at(n/i)}function fr(e,r){const i=e.rotate(r.bearingInRadians),n=r.zoom+pr(r.center.lat,0),o=t.bt(1/dr(r.center.lat),1/dr(Math.min(Math.abs(r.center.lat),60)),t.bw(n,7,3,0,1)),a=360/sr({worldSize:r.worldSize,center:{lat:r.center.lat}});return new t.V(r.center.lng-i.x*a*o,t.an(r.center.lat+i.y*a,-t.ao,t.ao))}function mr(e){const t=.5*e,r=Math.sin(t),i=Math.cos(t);return Math.log(r+i)-Math.log(i-r)}function gr(e,r,i,n){const o=e.lat+i*n;if(Math.abs(i)>1){const a=(Math.sign(e.lat+i)!==Math.sign(e.lat)?-Math.abs(e.lat):Math.abs(e.lat))*Math.PI/180,s=Math.abs(e.lat+i)*Math.PI/180,l=mr(a+n*(s-a)),c=mr(a),u=mr(s);return new t.V(e.lng+r*((l-c)/(u-c)),o)}return new t.V(e.lng+r*n,o)}class _r{constructor(e){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=e}swapBuffers(){if(!this._hadAnyChanges)return;const e=this._cachePrevious;this._cachePrevious=this._cache,this._cache=e,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(e,t,r,i){const n=`${e.z}_${e.x}_${e.y}_${(null==i?void 0:i.terrain)?"t":""}`,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._boundingVolumeFactory(e,t,r,i);return this._cache.set(n,s),this._hadAnyChanges=!0,s}}class yr{constructor(e,t,r,i){this.min=r,this.max=i,this.points=e,this.planes=t}static fromAabb(e,t){const r=[];for(let i=0;i<8;i++)r.push([1&~i?e[0]:t[0],1==(i>>1&1)?t[1]:e[1],1==(i>>2&1)?t[2]:e[2]]);return new yr(r,[[-1,0,0,t[0]],[1,0,0,-e[0]],[0,-1,0,t[1]],[0,1,0,-e[1]],[0,0,-1,t[2]],[0,0,1,-e[2]]],e,t)}static fromCenterSizeAngles(e,r,i){const n=t.bA([],i[0],i[1],i[2]),o=t.bB([],[r[0],0,0],n),a=t.bB([],[0,r[1],0],n),s=t.bB([],[0,0,r[2]],n),l=[...e],c=[...e];for(let t=0;t<8;t++)for(let r=0;r<3;r++){const i=e[r]+o[r]*(1&~t?-1:1)+a[r]*(1==(t>>1&1)?1:-1)+s[r]*(1==(t>>2&1)?1:-1);l[r]=Math.min(l[r],i),c[r]=Math.max(c[r],i)}const u=[];for(let h=0;h<8;h++){const r=[...e];t.a$(r,r,t.a_([],o,1&~h?-1:1)),t.a$(r,r,t.a_([],a,1==(h>>1&1)?1:-1)),t.a$(r,r,t.a_([],s,1==(h>>2&1)?1:-1)),u.push(r)}return new yr(u,[[...o,-t.b4(o,u[0])],[...a,-t.b4(a,u[0])],[...s,-t.b4(s,u[0])],[-o[0],-o[1],-o[2],-t.b4(o,u[7])],[-a[0],-a[1],-a[2],-t.b4(a,u[7])],[-s[0],-s[1],-s[2],-t.b4(s,u[7])]],l,c)}intersectsFrustum(e){let t=!0;const r=this.points.length,i=this.planes.length,n=e.planes.length,o=e.points.length;for(let a=0;a<n;a++){const i=e.planes[a];let n=0;for(let e=0;e<r;e++){const t=this.points[e];i[0]*t[0]+i[1]*t[1]+i[2]*t[2]+i[3]>=0&&n++}if(0===n)return 0;n<r&&(t=!1)}if(t)return 2;for(let a=0;a<i;a++){const t=this.planes[a];let r=0;for(let i=0;i<o;i++){const n=e.points[i];t[0]*n[0]+t[1]*n[1]+t[2]*n[2]+t[3]>=0&&r++}if(0===r)return 0}return 1}intersectsPlane(e){const t=this.points.length;let r=0;for(let i=0;i<t;i++){const t=this.points[i];e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]>=0&&r++}return r===t?2:0===r?0:1}}function vr(e,t,r){const i=e-t;return i<0?-i:Math.max(0,i-r)}function br(e,t,r,i,n){const o=e-r;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,vr(t,i,n))}class xr{constructor(){this._boundingVolumeCache=new _r(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(e,t,r,i){const n=1<<r.z,o=1/n,a=r.x/n,s=r.y/n;let l=2;return l=Math.min(l,br(e,t,a,s,o)),l=Math.min(l,br(e,t,a+.5,-s-o,o)),l=Math.min(l,br(e,t,a+.5,2-s-o,o)),l}getWrap(e,t,r){const i=1<<t.z,n=1/i,o=t.x/i,a=vr(e.x,o,n),s=vr(e.x,o-1,n),l=vr(e.x,o+1,n),c=Math.min(a,s,l);return c===l?1:c===s?-1:0}allowVariableZoom(e,t){return Se(e,t)>4}allowWorldCopies(){return!1}getTileBoundingVolume(e,t,r,i){return this._boundingVolumeCache.getTileBoundingVolume(e,t,r,i)}_computeTileBoundingVolume(e,r,i,n){var o,a;let s=0,l=0;if(null==n?void 0:n.terrain){const c=new t.a1(e.z,r,e.z,e.x,e.y),u=n.terrain.getMinMaxElevation(c);s=null!==(o=u.minElevation)&&void 0!==o?o:Math.min(0,i),l=null!==(a=u.maxElevation)&&void 0!==a?a:Math.max(0,i)}if(s/=t.bD,l/=t.bD,s+=1,l+=1,e.z<=0)return yr.fromAabb([-l,-l,-l],[l,l,l]);if(1===e.z)return yr.fromAabb([0===e.x?-l:0,0===e.y?0:-l,-l],[0===e.x?0:l,0===e.y?l:0,l]);{const r=[lr(0,0,e.x,e.y,e.z),lr(t.a4,0,e.x,e.y,e.z),lr(t.a4,t.a4,e.x,e.y,e.z),lr(0,t.a4,e.x,e.y,e.z)],i=[];for(const e of r)i.push(t.a_([],e,l));if(l!==s)for(const e of r)i.push(t.a_([],e,s));0===e.y&&i.push([0,1,0]),e.y===(1<<e.z)-1&&i.push([0,-1,0]);const n=[1,1,1],o=[-1,-1,-1];for(const e of i)for(let t=0;t<3;t++)n[t]=Math.min(n[t],e[t]),o[t]=Math.max(o[t],e[t]);const a=lr(t.a4/2,t.a4/2,e.x,e.y,e.z),c=t.b3([],[0,1,0],a);t.b2(c,c);const u=t.b3([],a,c);t.b2(u,u);const h=t.b3([],r[2],r[1]);t.b2(h,h);const d=t.b3([],r[0],r[3]);t.b2(d,d),i.push(t.a_([],a,l)),e.y>=(1<<e.z)/2&&i.push(t.a_([],lr(t.a4/2,0,e.x,e.y,e.z),l)),e.y<(1<<e.z)/2&&i.push(t.a_([],lr(t.a4/2,t.a4,e.x,e.y,e.z),l));const p=wr(a,i),f=wr(u,i),m=[-a[0],-a[1],-a[2],p.max],g=[a[0],a[1],a[2],-p.min],_=[-u[0],-u[1],-u[2],f.max],y=[u[0],u[1],u[2],-f.min],v=[...h,0],b=[...d,0],x=[];return 0===e.y?x.push(t.bC(b,v,m),t.bC(b,v,g)):x.push(t.bC(_,v,m),t.bC(_,v,g),t.bC(_,b,m),t.bC(_,b,g)),e.y===(1<<e.z)-1?x.push(t.bC(b,v,m),t.bC(b,v,g)):x.push(t.bC(y,v,m),t.bC(y,v,g),t.bC(y,b,m),t.bC(y,b,g)),new yr(x,[m,g,_,y,v,b],n,o)}}}function wr(e,r){let i=1/0,n=-1/0;for(const o of r){const r=t.b4(e,o);i=Math.min(i,r),n=Math.max(n,r)}return{min:i,max:n}}class Tr{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,r){return this._helper.interpolatePadding(e,t,r)}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)}setConstrainOverride(e){this._helper.setConstrainOverride(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 constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e){}constructor(e){this._cachedClippingPlane=t.bE(),this._projectionMatrix=t.bi(),this._globeViewProjMatrix32f=t.bh(),this._globeViewProjMatrixNoCorrection=t.bi(),this._globeViewProjMatrixNoCorrectionInverted=t.bi(),this._globeProjMatrixInverted=t.bi(),this._cameraPosition=t.by(),this._globeLatitudeErrorCorrectionRadians=0,this.defaultConstrain=(e,r)=>{const i=t.an(e.lat,-t.ao,t.ao),n=t.an(+r,this.minZoom+pr(0,i),this.maxZoom);return{center:new t.V(e.lng,i),zoom:n}},this.applyConstrain=(e,t)=>this._helper.applyConstrain(e,t),this._helper=new zt({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(e,t)=>this.defaultConstrain(e,t)},e),this._coveringTilesDetailsProvider=new xr}clone(){const e=new Tr;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.by();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:r}=e,i=this._helper.getMercatorTileCoordinates(t);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:i,clippingPlane:this._cachedClippingPlane,projectionTransition:r?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(e){const r=this.pitchInRadians,i=this.cameraToCenterDistance/e,n=Math.sin(r)*i,o=Math.cos(r)*i+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];t.bF(u,u,[0,0,0],-this.bearingInRadians),t.bG(u,u,[0,0,0],-1*this.center.lat*Math.PI/180),t.bH(u,u,[0,0,0],this.center.lng*Math.PI/180);const h=1/t.b6(u);return t.a_(u,u,h),[...u,-a*h]}isLocationOccluded(e){return!this.isSurfacePointVisible(cr(e))}transformLightDirection(e){const r=this._helper._center.lng*Math.PI/180,i=this._helper._center.lat*Math.PI/180,n=Math.cos(i),o=[Math.sin(r)*n,Math.sin(i),Math.cos(r)*n],a=[o[2],0,-o[0]],s=[0,0,0];t.b3(s,a,o),t.b2(a,a),t.b2(s,s);const l=[0,0,0];return t.b2(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,r,i){const n=function(e,r,i){const n=1/(1<<i.z);return new t.aa(e/t.a4*n+i.x*n,r/t.a4*n+i.y*n)}(e,r,i.canonical),o=(a=n.y,[t.bx(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,r,i,n){const o=i.canonical,a=lr(e,r,o.x,o.y,o.z),s=1+(n?n(e,r):0)/t.bD,l=[a[0]*s,a[1]*s,a[2]*s,1];t.aG(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=ur(this.worldSize,this.center.lat),r=t.bj(),i=t.bj();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*e),t.bd(r,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);const n=this.centerOffset;r[8]=2*-n.x/this._helper._width,r[9]=2*n.y/this._helper._height,this._projectionMatrix=t.be(r),this._globeProjMatrixInverted=t.bj(),t.aA(this._globeProjMatrixInverted,r),t.O(r,r,[0,0,-this.cameraToCenterDistance]),t.bf(r,r,this.rollInRadians),t.bg(r,r,-this.pitchInRadians),t.bf(r,r,this.bearingInRadians),t.O(r,r,[0,0,-e]);const o=t.by();o[0]=e,o[1]=e,o[2]=e,t.bg(i,r,this.center.lat*Math.PI/180),t.bI(i,i,-this.center.lng*Math.PI/180),t.Q(i,i,o),this._globeViewProjMatrixNoCorrection=i,t.bg(r,r,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),t.bI(r,r,-this.center.lng*Math.PI/180),t.Q(r,r,o),this._globeViewProjMatrix32f=new Float32Array(r),this._globeViewProjMatrixNoCorrectionInverted=t.bj(),t.aA(this._globeViewProjMatrixNoCorrectionInverted,i);const a=t.by();this._cameraPosition=t.by(),this._cameraPosition[2]=this.cameraToCenterDistance/e,t.bF(this._cameraPosition,this._cameraPosition,a,-this.rollInRadians),t.bG(this._cameraPosition,this._cameraPosition,a,this.pitchInRadians),t.bF(this._cameraPosition,this._cameraPosition,a,-this.bearingInRadians),t.a$(this._cameraPosition,this._cameraPosition,[0,0,1]),t.bG(this._cameraPosition,this._cameraPosition,a,-this.center.lat*Math.PI/180),t.bH(this._cameraPosition,this._cameraPosition,a,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(e);const s=t.be(this._globeViewProjMatrixNoCorrectionInverted);t.Q(s,s,[1,1,-1]),this._cachedFrustum=jt.fromInvProjectionMatrix(s,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(e){t.w("calculateFogMatrix is not supported on globe projection.");const r=t.bj();return t.ar(r),r}getVisibleUnwrappedCoordinates(e){return[new t.bb(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,r){if(!this._globeViewProjMatrixNoCorrection)return 1;const i=cr(e);t.a_(i,i,1+r/t.bD);const n=t.bE();return t.aG(n,[i[0],i[1],i[2],1],this._globeViewProjMatrixNoCorrection),n[2]/n[3]}populateCache(e){}getBounds(){const e=.5*this.width,r=.5*this.height,i=[new t.P(0,0),new t.P(e,0),new t.P(this.width,0),new t.P(this.width,r),new t.P(this.width,this.height),new t.P(e,this.height),new t.P(0,this.height),new t.P(0,r)],n=[];for(const t of i)n.push(this.unprojectScreenPoint(t));let o=0,a=0,s=0,l=0;const c=this.center;for(const h of n){const e=t.bJ(c.lng,h.lng),r=t.bJ(c.lat,h.lat);e<a&&(a=e),e>o&&(o=e),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 Z(u)}calculateCenterFromCameraLngLatAlt(e,t,r,i){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,r,i)}setLocationAtPoint(e,r){const i=cr(this.unprojectScreenPoint(r)),n=cr(e),o=t.by();t.bK(o);const a=t.by();t.bH(a,i,o,-this.center.lng*Math.PI/180),t.bG(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.bL(n[0],n[2],a[0],c),d=t.bL(n[0],n[2],a[0],u),p=t.by();t.bH(p,n,o,-h);const f=t.bL(p[1],p[2],a[1],a[2]),m=t.by();t.bH(m,n,o,-d);const g=t.bL(m[1],m[2],a[1],a[2]),_=.5*Math.PI,y=f>=-_&&f<=_,v=g>=-_&&g<=_;let b,x;if(y&&v){const e=this.center.lng*Math.PI/180,r=this.center.lat*Math.PI/180;t.bM(h,e)+t.bM(f,r)<t.bM(d,e)+t.bM(g,r)?(b=h,x=f):(b=d,x=g)}else if(y)b=h,x=f;else{if(!v)return;b=d,x=g}const w=b/Math.PI*180,T=x/Math.PI*180,S=this.center.lat;this.setCenter(new t.V(w,t.an(T,-90,90))),this.setZoom(this.zoom+pr(S,this.center.lat))}locationToScreenPoint(e,r){const i=cr(e);if(r){const n=r.getElevationForLngLatZoom(e,this._helper._tileZoom);t.a_(i,i,1+n/t.bD)}return this._projectSurfacePointToScreen(i)}_projectSurfacePointToScreen(e){const r=t.bE();return t.aG(r,[...e,1],this._globeViewProjMatrixNoCorrection),r[0]/=r[3],r[1]/=r[3],new t.P((.5*r[0]+.5)*this.width,(.5*-r[1]+.5)*this.height)}screenPointToMercatorCoordinate(e,r){if(r){const t=r.pointCoordinate(e);if(t)return t}return t.aa.fromLngLat(this.unprojectScreenPoint(e))}screenPointToLocation(e,t){var r;return null===(r=this.screenPointToMercatorCoordinate(e,t))||void 0===r?void 0:r.toLngLat()}isPointOnMapSurface(e,t){const r=this._cameraPosition,i=this.getRayDirectionFromPixel(e);return!!this.rayPlanetIntersection(r,i)}getRayDirectionFromPixel(e){const r=t.bE();r[0]=e.x/this.width*2-1,r[1]=-1*(e.y/this.height*2-1),r[2]=1,r[3]=1,t.aG(r,r,this._globeViewProjMatrixNoCorrectionInverted),r[0]/=r[3],r[1]/=r[3],r[2]/=r[3];const i=t.by();i[0]=r[0]-this._cameraPosition[0],i[1]=r[1]-this._cameraPosition[1],i[2]=r[2]-this._cameraPosition[2];const n=t.by();return t.b2(n,i),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 r=t.bE();return t.aG(r,[...e,1],this._globeViewProjMatrixNoCorrection),r[0]/=r[3],r[1]/=r[3],r[2]/=r[3],r[0]>-1&&r[0]<1&&r[1]>-1&&r[1]<1&&r[2]>-1&&r[2]<1}rayPlanetIntersection(e,r){const i=t.b4(e,r),n=t.by(),o=t.by();t.a_(o,r,i),t.b1(n,e,o);const a=1-t.b4(n,n);if(a<0)return null;const s=t.b4(e,e)-1,l=-i+(i<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 r=this._cameraPosition,i=this.getRayDirectionFromPixel(e),n=this.rayPlanetIntersection(r,i);if(n){const e=t.by();t.a$(e,r,[i[0]*n.tMin,i[1]*n.tMin,i[2]*n.tMin]);const o=t.by();return t.b2(o,e),hr(o)}const o=this._cachedClippingPlane,a=o[0]*i[0]+o[1]*i[1]+o[2]*i[2],s=-t.ba(o,r)/a,l=t.by();if(s>0)t.a$(l,r,[i[0]*s,i[1]*s,i[2]*s]);else{const e=t.by();t.a$(e,r,[2*i[0],2*i[1],2*i[2]]);const n=t.ba(this._cachedClippingPlane,e);t.b1(l,e,[this._cachedClippingPlane[0]*n,this._cachedClippingPlane[1]*n,this._cachedClippingPlane[2]*n])}const c=function(e){const r=t.by();return r[0]=e[0]*-e[3],r[1]=e[1]*-e[3],r[2]=e[2]*-e[3],{center:r,radius:Math.sqrt(1-e[3]*e[3])}}(o);return hr(function(e,r,i){const n=t.by();t.b1(n,i,e);const o=t.by();return t.bz(o,e,n,r/t.b8(n)),o}(c.center,c.radius,l))}getMatrixForModel(e,r){const i=t.V.convert(e),n=1/t.bD,o=t.bi();return t.bI(o,o,i.lng/180*Math.PI),t.bg(o,o,-i.lat/180*Math.PI),t.O(o,o,[0,0,1+r/t.bD]),t.bg(o,o,.5*Math.PI),t.Q(o,o,[n,n,n]),o}getProjectionDataForCustomLayer(e=!0){const r=this.getProjectionData({overscaledTileID:new t.a1(0,0,0,0,0),applyGlobeMatrix:e});return r.tileMercatorCoords=[0,0,1,1],r}getFastPathSimpleProjectionMatrix(e){}}class Sr{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,r){return this._helper.interpolatePadding(e,t,r)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t,r=!0){this._helper.resize(e,t,r)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}setConstrainOverride(e){this._helper.setConstrainOverride(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 constrainOverride(){return this._helper.constrainOverride}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().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(e){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this.defaultConstrain=(e,t)=>this.currentTransform.defaultConstrain(e,t),this.applyConstrain=(e,t)=>this._helper.applyConstrain(e,t),this._helper=new zt({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(e,t)=>this.defaultConstrain(e,t)},e),this._globeness=1,this._mercatorTransform=new Vt,this._verticalPerspectiveTransform=new Tr}clone(){const e=new Sr;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),r=this._verticalPerspectiveTransform.getProjectionData(e);return{mainMatrix:this.isGlobeRendering?r.mainMatrix:t.mainMatrix,clippingPlane:r.clippingPlane,tileMercatorCoords:r.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.bt(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return t.bt(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(e,r,i){const n=this._mercatorTransform.getPitchedTextCorrection(e,r,i),o=this._verticalPerspectiveTransform.getPitchedTextCorrection(e,r,i);return t.bt(n,o,this._globeness)}projectTileCoordinates(e,t,r,i){return this.currentTransform.projectTileCoordinates(e,t,r,i)}_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()}calculateCenterFromCameraLngLatAlt(e,t,r,i){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,r,i)}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 r=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(e);return r.fallbackMatrix=t.mainMatrix,r}getFastPathSimpleProjectionMatrix(e){return this.currentTransform.getFastPathSimpleProjectionMatrix(e)}}class Er{get useGlobeControls(){return!0}handlePanInertia(e,r){const i=fr(e,r);return Math.abs(i.lng-r.center.lng)>180&&(i.lng=r.center.lng+179.5*Math.sign(i.lng-r.center.lng)),{easingCenter:i,easingOffset:new t.P(0,0)}}handleMapControlsRollPitchBearingZoom(e,r){const i=e.around,n=r.screenPointToLocation(i);e.bearingDelta&&r.setBearing(r.bearing+e.bearingDelta),e.pitchDelta&&r.setPitch(r.pitch+e.pitchDelta),e.rollDelta&&r.setRoll(r.roll+e.rollDelta);const o=r.zoom;e.zoomDelta&&r.setZoom(r.zoom+e.zoomDelta);const a=r.zoom-o;if(0===a)return;const s=t.bJ(r.center.lng,n.lng),l=s/(Math.abs(s/180)+1),c=t.bJ(r.center.lat,n.lat),u=r.getRayDirectionFromPixel(i),h=r.cameraPosition,d=-1*t.b4(h,u),p=t.by();t.a$(p,h,[u[0]*d,u[1]*d,u[2]*d]);const f=t.b6(p)-1,m=Math.exp(.5*-Math.max(f-.3,0)),g=ur(r.worldSize,r.center.lat)/Math.min(r.width,r.height),_=t.bw(g,.9,.5,1,.25),y=(1-t.aq(-a))*Math.min(m,_),v=r.center.lat,b=r.zoom,x=new t.V(r.center.lng+l*y,t.an(r.center.lat+c*y,-t.ao,t.ao));r.setLocationAtPoint(n,i);const w=r.center,T=t.bw(Math.abs(s),45,85,0,1),S=t.bw(g,.75,.35,0,1),E=Math.pow(Math.max(T,S),.25),I=t.bJ(w.lng,x.lng),P=t.bJ(w.lat,x.lat);r.setCenter(new t.V(w.lng+I*E,w.lat+P*E).wrap()),r.setZoom(b+pr(v,r.center.lat))}handleMapControlsPan(e,t,r){if(!e.panDelta)return;const i=t.center.lat,n=t.zoom;t.setCenter(fr(e.panDelta,t).wrap()),t.setZoom(n+pr(i,t.center.lat))}cameraForBoxAndBearing(e,r,i,n,o){const a=qt(e,r,i,n,o),s=r.left/o.width*2-1,l=(o.width-r.right)/o.width*2-1,c=r.top/o.height*-2+1,u=(o.height-r.bottom)/o.height*-2+1,h=t.bJ(i.getWest(),i.getEast())<0,d=h?i.getEast():i.getWest(),p=h?i.getWest():i.getEast(),f=Math.max(i.getNorth(),i.getSouth()),m=Math.min(i.getNorth(),i.getSouth()),g=d+.5*t.bJ(d,p),_=f+.5*t.bJ(f,m),y=o.clone();y.setCenter(a.center),y.setBearing(a.bearing),y.setPitch(0),y.setRoll(0),y.setZoom(a.zoom);const v=y.modelViewProjectionMatrix,b=[cr(i.getNorthWest()),cr(i.getNorthEast()),cr(i.getSouthWest()),cr(i.getSouthEast()),cr(new t.V(p,_)),cr(new t.V(d,_)),cr(new t.V(g,f)),cr(new t.V(g,m))],x=cr(a.center);let w=Number.POSITIVE_INFINITY;for(const t of b)s<0&&(w=Er.getLesserNonNegativeNonNull(w,Er.solveVectorScale(t,x,v,"x",s))),l>0&&(w=Er.getLesserNonNegativeNonNull(w,Er.solveVectorScale(t,x,v,"x",l))),c>0&&(w=Er.getLesserNonNegativeNonNull(w,Er.solveVectorScale(t,x,v,"y",c))),u<0&&(w=Er.getLesserNonNegativeNonNull(w,Er.solveVectorScale(t,x,v,"y",u)));if(Number.isFinite(w)&&0!==w)return a.zoom=y.zoom+t.at(w),a;Ut()}handleJumpToCenterZoom(e,r){const i=e.center.lat,n=e.applyConstrain(r.center?t.V.convert(r.center):e.center,e.zoom).center;e.setCenter(n.wrap());const o=void 0!==r.zoom?+r.zoom:e.zoom+pr(i,n.lat);e.zoom!==o&&e.setZoom(o)}handleEaseTo(e,r){const i=e.zoom,n=e.center,o=e.padding,a={roll:e.roll,pitch:e.pitch,bearing:e.bearing},s={roll:void 0===r.roll?e.roll:r.roll,pitch:void 0===r.pitch?e.pitch:r.pitch,bearing:void 0===r.bearing?e.bearing:r.bearing},l=void 0!==r.zoom,c=!e.isPaddingEqual(r.padding);let u=!1;const h=r.center?t.V.convert(r.center):n,d=e.applyConstrain(h,i).center;Ft(e,d);const p=e.clone();p.setCenter(d),p.setZoom(l?+r.zoom:i+pr(n.lat,h.lat)),p.setBearing(r.bearing);const f=new t.P(t.an(e.centerPoint.x+r.offsetAsPoint.x,0,e.width),t.an(e.centerPoint.y+r.offsetAsPoint.y,0,e.height));p.setLocationAtPoint(d,f);const m=(r.offset&&r.offsetAsPoint.mag())>0?p.center:d,g=l?+r.zoom:i+pr(n.lat,m.lat),_=i+pr(n.lat,0),y=g+pr(m.lat,0),v=t.bJ(n.lng,m.lng),b=t.bJ(n.lat,m.lat),x=t.aq(y-_);return u=g!==i,{easeFunc:i=>{if(t.bn(a,s)||Gt({startEulerAngles:a,endEulerAngles:s,tr:e,k:i,useSlerp:a.roll!=s.roll}),c&&e.interpolatePadding(o,r.padding,i),r.around)t.w("Easing around a point is not supported under globe projection."),e.setLocationAtPoint(r.around,r.aroundPoint);else{const t=y>_?Math.min(2,x):Math.max(.5,x),r=Math.pow(t,1-i),o=gr(n,v,b,i*r);e.setCenter(o.wrap())}if(u){const r=t.G.number(_,y,i)+pr(0,e.center.lat);e.setZoom(r)}},isZooming:u,elevationCenter:m}}handleFlyTo(e,r){const i=void 0!==r.zoom,n=e.center,o=e.zoom,a=e.padding,s=!e.isPaddingEqual(r.padding),l=e.applyConstrain(t.V.convert(r.center||r.locationAtOffset),o).center,c=i?+r.zoom:e.zoom+pr(e.center.lat,l.lat),u=e.clone();u.setCenter(l),u.setZoom(c),u.setBearing(r.bearing);const h=new t.P(t.an(e.centerPoint.x+r.offsetAsPoint.x,0,e.width),t.an(e.centerPoint.y+r.offsetAsPoint.y,0,e.height));u.setLocationAtPoint(l,h);const d=u.center;Ft(e,d);const p=function(e,r,i){const n=cr(r),o=cr(i),a=t.b4(n,o),s=Math.acos(a),l=sr(e);return s/(2*Math.PI)*l}(e,n,d),f=o+pr(n.lat,0),m=c+pr(d.lat,0),g=t.aq(m-f);let _;if("number"==typeof r.minZoom){const i=+r.minZoom+pr(d.lat,0),n=Math.min(i,f,m)+pr(0,d.lat),o=e.applyConstrain(d,n).zoom+pr(d.lat,0);_=t.aq(o-f)}const y=t.bJ(n.lng,d.lng),v=t.bJ(n.lat,d.lat);return{easeFunc:(i,o,l,u)=>{const h=gr(n,y,v,l);s&&e.interpolatePadding(a,r.padding,i);const p=1===i?d:h;e.setCenter(p.wrap());const m=f+t.at(o);e.setZoom(1===i?c:m+pr(0,p.lat))},scaleOfZoom:g,targetCenter:d,scaleOfMinZoom:_,pixelPathLength:p}}static solveVectorScale(e,t,r,i,n){const o="x"===i?[r[0],r[4],r[8],r[12]]:[r[1],r[5],r[9],r[13]],a=[r[3],r[7],r[11],r[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 Ir{constructor(e){this._globe=e,this._mercatorCameraHelper=new $t,this._verticalPerspectiveCameraHelper=new Er}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,r){this.currentHelper.handleMapControlsPan(e,t,r)}cameraForBoxAndBearing(e,t,r,i,n){return this.currentHelper.cameraForBoxAndBearing(e,t,r,i,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 Pr=(e,r)=>t.B(e,r&&r.filter(e=>"source.canvas"!==e.identifier)),kr=t.bN();class Ar extends t.E{constructor(e,r={}){var i,n;super(),this._rtlPluginLoaded=()=>{for(const e in this.tileManagers){const t=this.tileManagers[e].getSource().type;"vector"!==t&&"geojson"!==t||this.tileManagers[e].reload()}},this.map=e,this.dispatcher=new j(N(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",(e,t)=>this.getGlyphs(e,t)),this.dispatcher.registerMessageHandler("GI",(e,t)=>this.getImages(e,t)),this.dispatcher.registerMessageHandler("GDA",(e,t)=>this.getDashes(e,t)),this.imageManager=new w,this.imageManager.setEventedParent(this);const o=(null===(i=e._container)||void 0===i?void 0:i.lang)||"undefined"!=typeof document&&(null===(n=document.documentElement)||void 0===n?void 0:n.lang)||void 0;this.glyphManager=new P(e._requestManager,r.localIdeographFontFamily,o),this.lineAtlas=new R(256,512),this.crossTileSymbolIndex=new Et,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast("SR",t.bO()),ce().on(ae,this._rtlPluginLoaded),this.on("data",e=>{if("source"!==e.dataType||"metadata"!==e.sourceDataType)return;const t=this.tileManagers[e.sourceId];if(!t)return;const r=t.getSource();if(r&&r.vectorLayerIds)for(const i in this._layers){const e=this._layers[i];e.source===r.id&&this._validateLayer(e)}})}_setInitialValues(){var e;this._spritesImagesIds={},this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new t.bP,this._availableImages=[],this._globalState={},this._serializedLayers={},this.stylesheet=null,this.light=null,this.sky=null,this.projection&&(this.projection.destroy(),delete this.projection),this._loaded=!1,this._changed=!1,this._updatedLayers={},this._updatedSources={},this._changedImages={},this._glyphsDidChange=!1,this._updatedPaintProps={},this._layerOrderChanged=!1,this.crossTileSymbolIndex=new((null===(e=this.crossTileSymbolIndex)||void 0===e?void 0:e.constructor)||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}setGlobalStateProperty(e,r){var i,n,o;this._checkLoaded();const a=null===r?null!==(o=null===(n=null===(i=this.stylesheet.state)||void 0===i?void 0:i[e])||void 0===n?void 0:n.default)&&void 0!==o?o:null:r;if(t.bQ(a,this._globalState[e]))return this;this._globalState[e]=a,this._applyGlobalStateChanges([e])}getGlobalState(){return this._globalState}setGlobalState(e){this._checkLoaded();const r=[];for(const i in e)!t.bQ(this._globalState[i],e[i].default)&&(r.push(i),this._globalState[i]=e[i].default);this._applyGlobalStateChanges(r)}_applyGlobalStateChanges(e){if(0===e.length)return;const t=new Set,r={};for(const i of e){r[i]=this._globalState[i];for(const e in this._layers){const r=this._layers[e],n=r.getLayoutAffectingGlobalStateRefs(),o=r.getPaintAffectingGlobalStateRefs();if(n.has(i)&&t.add(r.source),o.has(i))for(const{name:e,value:t}of o.get(i))this._updatePaintProperty(r,e,t)}}this.dispatcher.broadcast("UGS",r);for(const i in this.tileManagers)t.has(i)&&(this._reloadSource(i),this._changed=!0)}loadURL(e,r={},i){this.fire(new t.l("dataloading",{dataType:"style"})),r.validate="boolean"!=typeof r.validate||r.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,r,i)}).catch(e=>{this._loadStyleRequest=null,e&&!o.signal.aborted&&this.fire(new t.k(e))})}loadJSON(e,r={},i){this.fire(new t.l("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,s.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,r.validate=!1!==r.validate,this._load(e,r,i)}).catch(()=>{})}loadEmpty(){this.fire(new t.l("dataloading",{dataType:"style"})),this._load(kr,{validate:!1})}_load(e,r,i){var n,o;let a=r.transformStyle?r.transformStyle(i,e):e;if(!r.validate||!Pr(this,t.C(a))){a=Object.assign({},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 C(this.stylesheet.light),this._setProjectionInternal((null===(n=this.stylesheet.projection)||void 0===n?void 0:n.type)||"mercator"),this.sky=new D(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(){var e,r,i;const n=t.bR(this.stylesheet.layers);this.setGlobalState(null!==(e=this.stylesheet.state)&&void 0!==e?e:null),this.dispatcher.broadcast("SL",n),this._order=n.map(e=>e.id),this._layers={},this._serializedLayers=null;for(const o of n){const e=t.bS(o,this._globalState);if(e.setEventedParent(this,{layer:{id:o.id}}),this._layers[o.id]=e,t.bT(e)&&this.tileManagers[e.source]){const t=null!==(i=null===(r=o.paint)||void 0===r?void 0:r["raster-fade-duration"])&&void 0!==i?i:e.paint.get("raster-fade-duration");this.tileManagers[e.source].setRasterFadeDuration(t)}}}_loadSprite(e,r=!1,i=void 0){let n;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(e,r,i,n){return t._(this,void 0,void 0,function*(){const o=v(e),a=i>1?"@2x":"",l={},c={};for(const{id:e,url:i}of o){const o=r.transformRequest(b(i,a,".json"),"SpriteJSON");l[e]=t.j(o,n);const s=r.transformRequest(b(i,a,".png"),"SpriteImage");c[e]=_.getImage(s,n)}return yield Promise.all([...Object.values(l),...Object.values(c)]),function(e,r){return t._(this,void 0,void 0,function*(){const t={};for(const i in e){t[i]={};const n=s.getImageCanvasContext((yield r[i]).data),o=(yield e[i]).data;for(const e in o){const{width:r,height:a,x:s,y:l,sdf:c,pixelRatio:u,stretchX:h,stretchY:d,content:p,textFitWidth:f,textFitHeight:m}=o[e];t[i][e]={data:null,pixelRatio:u,sdf:c,stretchX:h,stretchY:d,content:p,textFitWidth:f,textFitHeight:m,spriteData:{width:r,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 i=this._spritesImagesIds[t]?this._spritesImagesIds[t].filter(t=>!(t in e)):[];for(const e of i)this.imageManager.removeImage(e),this._changedImages[e]=!0;for(const n in e[t]){const i="default"===t?n:`${t}:${n}`;this._spritesImagesIds[t].push(i),i in this.imageManager.images?this.imageManager.updateImage(i,e[t][n],!1):this.imageManager.addImage(i,e[t][n]),r&&(this._changedImages[i]=!0)}}}).catch(e=>{this._spriteRequest=null,n=e,this.fire(new t.k(n))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),r&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new t.l("data",{dataType:"style"})),i&&i(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 r=this.tileManagers[e.source];if(!r)return;const i=e.sourceLayer;if(!i)return;const n=r.getSource();("geojson"===n.type||n.vectorLayerIds&&-1===n.vectorLayerIds.indexOf(i))&&this.fire(new t.k(new Error(`Source layer "${i}" 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.tileManagers)if(!this.tileManagers[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(e,r=!1){const i=this._serializedAllLayers();if(!e||0===e.length)return Object.values(r?t.bU(i):i);const n=[];for(const o of e)if(i[o]){const e=r?t.bU(i[o]):i[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 r of t){const t=this._layers[r];"custom"!==t.type&&(e[r]=t.serialize())}return e}hasTransitions(){var e,t,r;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===(r=this.projection)||void 0===r?void 0:r.hasTransition())return!0;for(const i in this.tileManagers)if(this.tileManagers[i].hasTransition())return!0;for(const i in this._layers)if(this._layers[i].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;const r=this._changed;if(r){const t=Object.keys(this._updatedLayers),r=Object.keys(this._removedLayers);(t.length||r.length)&&this._updateWorkerLayers(t,r);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 i in this._updatedPaintProps)this._layers[i].updateTransitions(e);this.light.updateTransitions(e),this.sky.updateTransitions(e),this._resetUpdates()}const i={};for(const t in this.tileManagers){const e=this.tileManagers[t];i[t]=e.used,e.used=!1}for(const t of this._order){const r=this._layers[t];r.recalculate(e,this._availableImages),!r.isHidden(e.zoom)&&r.source&&(this.tileManagers[r.source].used=!0)}for(const n in i){const e=this.tileManagers[n];!!i[n]!=!!e.used&&e.fire(new t.l("data",{sourceDataType:"visibility",dataType:"source",sourceId:n}))}this.light.recalculate(e),this.sky.recalculate(e),this.projection.recalculate(e),this.z=e.zoom,r&&this.fire(new t.l("data",{dataType:"style"}))}_updateTilesForChangedImages(){const e=Object.keys(this._changedImages);if(e.length){for(const t in this.tileManagers)this.tileManagers[t].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const e in this.tileManagers)this.tileManagers[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,r={}){var i;this._checkLoaded();const n=this.serialize();if(e=r.transformStyle?r.transformStyle(n,e):e,(null===(i=r.validate)||void 0===i||i)&&Pr(this,t.C(e)))return!1;(e=t.bU(e)).layers=t.bR(e.layers);const o=t.bV(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 t of a.operations)t();return this.stylesheet=e,this._serializedLayers=null,!0}_getOperationsToPerform(e){const t=[],r=[];for(const i of e)switch(i.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":t.push(()=>this.addLayer.apply(this,i.args));break;case"removeLayer":t.push(()=>this.removeLayer.apply(this,i.args));break;case"setPaintProperty":t.push(()=>this.setPaintProperty.apply(this,i.args));break;case"setLayoutProperty":t.push(()=>this.setLayoutProperty.apply(this,i.args));break;case"setFilter":t.push(()=>this.setFilter.apply(this,i.args));break;case"addSource":t.push(()=>this.addSource.apply(this,i.args));break;case"removeSource":t.push(()=>this.removeSource.apply(this,i.args));break;case"setLayerZoomRange":t.push(()=>this.setLayerZoomRange.apply(this,i.args));break;case"setLight":t.push(()=>this.setLight.apply(this,i.args));break;case"setGeoJSONSourceData":t.push(()=>this.setGeoJSONSourceData.apply(this,i.args));break;case"setGlyphs":t.push(()=>this.setGlyphs.apply(this,i.args));break;case"setSprite":t.push(()=>this.setSprite.apply(this,i.args));break;case"setTerrain":t.push(()=>this.map.setTerrain.apply(this,i.args));break;case"setSky":t.push(()=>this.setSky.apply(this,i.args));break;case"setProjection":this.setProjection.apply(this,i.args);break;case"setGlobalState":t.push(()=>this.setGlobalState.apply(this,i.args));break;case"setTransition":t.push(()=>{});break;default:r.push(i.command)}return{operations:t,unimplemented:r}}addImage(e,r){if(this.getImage(e))return this.fire(new t.k(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,r),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,r,i={}){if(this._checkLoaded(),void 0!==this.tileManagers[e])throw new Error(`Source "${e}" already exists.`);if(!r.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(r).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(r.type)>=0&&this._validate(t.C.source,`sources.${e}`,r,null,i))return;this.map&&this.map._collectResourceTiming&&(r.collectResourceTiming=!0);const n=this.tileManagers[e]=new Pe(e,r,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.tileManagers[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 r=this.tileManagers[e];delete this.tileManagers[e],delete this._updatedSources[e],r.fire(new t.l("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),r.setEventedParent(null),r.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,t){if(this._checkLoaded(),void 0===this.tileManagers[e])throw new Error(`There is no source with this ID=${e}`);const r=this.tileManagers[e].getSource();if("geojson"!==r.type)throw new Error(`geojsonSource.type is ${r.type}, which is !== 'geojson`);r.setData(t),this._changed=!0}getSource(e){return this.tileManagers[e]&&this.tileManagers[e].getSource()}addLayer(e,r,i={}){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(Pr(this,t.bW(e)))return;o=t.bS(e,this._globalState)}else{if("source"in e&&"object"==typeof e.source&&(this.addSource(n,e.source),e=t.bU(e),e=t.e(e,{source:n})),this._validate(t.C.layer,`layers.${n}`,e,{arrayIndex:-1},i))return;o=t.bS(e,this._globalState),this._validateLayer(o),o.setEventedParent(this,{layer:{id:n}})}const a=r?this._order.indexOf(r):this._order.length;if(r&&-1===a)this.fire(new t.k(new Error(`Cannot add layer "${n}" before non-existing layer "${r}".`)));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.tileManagers[o.source].pause())}this._updateLayer(o),o.onAdd&&o.onAdd(this.map)}}moveLayer(e,r){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===r)return;const i=this._order.indexOf(e);this._order.splice(i,1);const n=r?this._order.indexOf(r):this._order.length;r&&-1===n?this.fire(new t.k(new Error(`Cannot move layer "${e}" before non-existing layer "${r}".`))):(this._order.splice(n,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();const r=this._layers[e];if(!r)return void this.fire(new t.k(new Error(`Cannot remove non-existing layer "${e}".`)));r.setEventedParent(null);const i=this._order.indexOf(e);this._order.splice(i,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=r,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],r.onRemove&&r.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,r,i){this._checkLoaded();const n=this.getLayer(e);n?n.minzoom===r&&n.maxzoom===i||(null!=r&&(n.minzoom=r),null!=i&&(n.maxzoom=i),this._updateLayer(n)):this.fire(new t.k(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,r,i={}){this._checkLoaded();const n=this.getLayer(e);if(n){if(!t.bQ(n.filter,r))return null==r?(n.setFilter(void 0),void this._updateLayer(n)):void(this._validate(t.C.filter,`layers.${n.id}.filter`,r,null,i)||(n.setFilter(t.bU(r)),this._updateLayer(n)))}else this.fire(new t.k(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return t.bU(this.getLayer(e).filter)}setLayoutProperty(e,r,i,n={}){this._checkLoaded();const o=this.getLayer(e);o?t.bQ(o.getLayoutProperty(r),i)||(o.setLayoutProperty(r,i,n),this._updateLayer(o)):this.fire(new t.k(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,r){const i=this.getLayer(e);if(i)return i.getLayoutProperty(r);this.fire(new t.k(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,r,i,n={}){this._checkLoaded();const o=this.getLayer(e);o?t.bQ(o.getPaintProperty(r),i)||this._updatePaintProperty(o,r,i,n):this.fire(new t.k(new Error(`Cannot style non-existing layer "${e}".`)))}_updatePaintProperty(e,r,i,n={}){e.setPaintProperty(r,i,n)&&this._updateLayer(e),t.bT(e)&&"raster-fade-duration"===r&&this.tileManagers[e.source].setRasterFadeDuration(i),this._changed=!0,this._updatedPaintProps[e.id]=!0,this._serializedLayers=null}getPaintProperty(e,t){return this.getLayer(e).getPaintProperty(t)}setFeatureState(e,r){this._checkLoaded();const i=e.source,n=e.sourceLayer,o=this.tileManagers[i];if(void 0===o)return void this.fire(new t.k(new Error(`The source '${i}' 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,r)):this.fire(new t.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,r){this._checkLoaded();const i=e.source,n=this.tileManagers[i];if(void 0===n)return void this.fire(new t.k(new Error(`The source '${i}' does not exist in the map's style.`)));const o=n.getSource().type,a="vector"===o?e.sourceLayer:void 0;"vector"!==o||a?r&&"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,r):this.fire(new t.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();const r=e.source,i=e.sourceLayer,n=this.tileManagers[r];if(void 0!==n)return"vector"!==n.getSource().type||i?(void 0===e.id&&this.fire(new t.k(new Error("The feature id parameter must be provided."))),n.getFeatureState(i,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 '${r}' 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.bX(this.tileManagers,e=>e.serialize()),r=this._serializeByIds(this._order,!0),i=this.map.getTerrain()||void 0,n=this.stylesheet;return t.bY({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:r,terrain:i},e=>void 0!==e)}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&"raster"!==this.tileManagers[e.source].getSource().type&&(this._updatedSources[e.source]="reload",this.tileManagers[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){const t=e=>"fill-extrusion"===this._layers[e].type,r={},i=[];for(let o=this._order.length-1;o>=0;o--){const n=this._order[o];if(t(n)){r[n]=o;for(const t of e){const e=t[n];if(e)for(const t of e)i.push(t)}}}i.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=i.length-1;e>=0;e--){const t=i[e].feature;if(r[t.layer.id]<o)break;n.push(t),i.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,r,i){r&&r.filter&&this._validate(t.C.filter,"queryRenderedFeatures.filter",r.filter,null,r);const n={};if(r&&r.layers){if(!(Array.isArray(r.layers)||r.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 r.layers){const r=this._layers[e];if(!r)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[r.source]=!0}}const o=[];r.availableImages=this._availableImages;const a=this._serializedAllLayers(),s=r.layers instanceof Set?r.layers:Array.isArray(r.layers)?new Set(r.layers):null,l=Object.assign(Object.assign({},r),{layers:s,globalState:this._globalState});for(const t in this.tileManagers)r.layers&&!n[t]||o.push(G(this.tileManagers[t],this._layers,a,e,l,i,this.map.terrain?(e,t,r)=>this.map.terrain.getElevation(e,t,r):void 0));return this.placement&&o.push(function(e,t,r,i,n,o,a){const s={},l=o.queryRenderedSymbols(i),c=[];for(const u of Object.keys(l).map(Number))c.push(a[u]);c.sort(q);for(const u of c){const r=u.featureIndex.lookupSymbolFeatures(l[u.bucketInstanceId],t,u.bucketIndex,u.sourceLayerIndex,{filterSpec:n.filter,globalState:n.globalState},n.layers,n.availableImages,e);for(const e in r){const t=s[e]=s[e]||[],i=r[e];i.sort((e,t)=>{const r=u.featureSortOrder;if(r){const i=r.indexOf(e.featureIndex);return r.indexOf(t.featureIndex)-i}return t.featureIndex-e.featureIndex});for(const e of i)t.push(e)}}return function(e,t,r){for(const i in e)for(const n of e[i])$(n,r[t[i].source]);return e}(s,e,r)}(this._layers,a,this.tileManagers,e,l,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(o)}querySourceFeatures(e,r){(null==r?void 0:r.filter)&&this._validate(t.C.filter,"querySourceFeatures.filter",r.filter,null,r);const i=this.tileManagers[e];return i?function(e,t){const r=e.getRenderableIds().map(t=>e.getTileByID(t)),i=[],n={};for(let o=0;o<r.length;o++){const e=r[o],a=e.tileID.canonical.key;n[a]||(n[a]=!0,e.querySourceFeatures(i,t))}return i}(i,r?Object.assign(Object.assign({},r),{globalState:this._globalState}):{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(e,r={}){this._checkLoaded();const i=this.light.getLight();let n=!1;for(const a in e)if(!t.bQ(e[a],i[a])){n=!0;break}if(!n)return;const o={now:c(),transition:t.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,r),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,r={}){this._checkLoaded();const i=this.getSky();let n=!1;if(!e&&!i)return;if(e&&!i)n=!0;else if(!e&&i)n=!0;else for(const a in e)if(!t.bQ(e[a],i[a])){n=!0;break}if(!n)return;const o={now:c(),transition:t.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=e,this.sky.setSky(e,r),this.sky.updateTransitions(o)}_setProjectionInternal(e){const r=function(e,r){const i={constrainOverride:r};if(Array.isArray(e)){const t=new ar({type:e});return{projection:t,transform:new Sr(i),cameraHelper:new Ir(t)}}switch(e){case"mercator":return{projection:new Rt,transform:new Vt(i),cameraHelper:new $t};case"globe":{const e=new ar({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:e,transform:new Sr(i),cameraHelper:new Ir(e)}}case"vertical-perspective":return{projection:new nr,transform:new Tr(i),cameraHelper:new Er};default:return t.w(`Unknown projection name: ${e}. Falling back to mercator projection.`),{projection:new Rt,transform:new Vt(i),cameraHelper:new $t}}}(e,this.map.transformConstrain);this.projection=r.projection,this.map.migrateProjection(r.transform,r.cameraHelper);for(const t in this.tileManagers)this.tileManagers[t].reload()}_validate(e,r,i,n,o={}){return(!o||!1!==o.validate)&&Pr(this,e.call(t.C,t.e({key:r,style:this.serialize(),value:i,styleSpec:t.u},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),ce().off(ae,this._rtlPluginLoaded);for(const t in this._layers)this._layers[t].setEventedParent(null);for(const t in this.tileManagers){const e=this.tileManagers[t];e.setEventedParent(null),e.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),e&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(e)}_clearSource(e){this.tileManagers[e].clearTiles()}_reloadSource(e){this.tileManagers[e].resume(),this.tileManagers[e].reload()}_updateSources(e){for(const t in this.tileManagers)this.tileManagers[t].update(e,this.map.terrain)}_generateCollisionBoxes(){for(const e in this.tileManagers)this._reloadSource(e)}_updatePlacement(e,t,r,i,n=!1){let o=!1,a=!1;const s={};for(const l of this._order){const t=this._layers[l];if("symbol"!==t.type)continue;if(!s[t.source]){const e=this.tileManagers[t.source];s[t.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(t,s[t.source],e.center.lng);o=o||r}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((n=n||this._layerOrderChanged||0===r)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(c(),e.zoom))&&(this.pauseablePlacement=new bt(e,this.map.terrain,this._order,n,t,r,i,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,s),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(c()),a=!0),o&&this.pauseablePlacement.placement.setStale()),a||o)for(const l of this._order){const e=this._layers[l];"symbol"===e.type&&this.placement.updateLayerOpacities(e,s[e.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(c())}_releaseSymbolFadeTiles(){for(const e in this.tileManagers)this.tileManagers[e].releaseSymbolFadeTiles()}getImages(e,r){return t._(this,void 0,void 0,function*(){const e=yield this.imageManager.getImages(r.icons);this._updateTilesForChangedImages();const t=this.tileManagers[r.source];return t&&t.setDependencies(r.tileID.key,r.type,r.icons),e})}getGlyphs(e,r){return t._(this,void 0,void 0,function*(){const e=yield this.glyphManager.getGlyphs(r.stacks),t=this.tileManagers[r.source];return t&&t.setDependencies(r.tileID.key,r.type,[""]),e})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,r={}){this._checkLoaded(),e&&this._validate(t.C.glyphs,"glyphs",e,null,r)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}getDashes(e,r){return t._(this,void 0,void 0,function*(){const e={};for(const[t,i]of Object.entries(r.dashes))e[t]=this.lineAtlas.getDash(i.dasharray,i.round);return e})}addSprite(e,r,i={},n){this._checkLoaded();const o=[{id:e,url:r}],a=[...v(this.stylesheet.sprite),...o];this._validate(t.C.sprite,"sprite",a,null,i)||(this.stylesheet.sprite=a,this._loadSprite(o,!0,n))}removeSprite(e){this._checkLoaded();const r=v(this.stylesheet.sprite);if(r.find(t=>t.id===e)){if(this._spritesImagesIds[e])for(const t of this._spritesImagesIds[e])this.imageManager.removeImage(t),this._changedImages[t]=!0;r.splice(r.findIndex(t=>t.id===e),1),this.stylesheet.sprite=r.length>0?r: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 v(this.stylesheet.sprite)}setSprite(e,r={},i){this._checkLoaded(),e&&this._validate(t.C.sprite,"sprite",e,null,r)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,i):(this._unloadSprite(),i&&i(null)))}destroy(){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null);for(const e in this.tileManagers){const t=this.tileManagers[e];if(t.setEventedParent(null),t._tiles){for(const e in t._tiles)t._tiles[e].unloadVectorData();t._tiles={}}t._cache.reset(),t.onRemove(this.map)}this.tileManagers={},this.imageManager&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this._availableImages=[],this._spritesImagesIds={}),this.glyphManager&&this.glyphManager.destroy();for(const e in this._layers){const t=this._layers[e];t.setEventedParent(null),t.onRemove&&t.onRemove(this.map)}this._setInitialValues(),this.setEventedParent(null),this.dispatcher.unregisterMessageHandler("GG"),this.dispatcher.unregisterMessageHandler("GI"),this.dispatcher.unregisterMessageHandler("GDA"),this.dispatcher.remove(!0),this._listeners={},this._oneTimeListeners={}}}var Cr=t.aT([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Mr{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,t,r,i,n,o,a,s,l){this.context=e;let c=this.boundPaintVertexBuffers.length!==i.length;for(let u=0;!c&&u<i.length;u++)this.boundPaintVertexBuffers[u]!==i[u]&&(c=!0);!this.vao||this.boundProgram!==t||this.boundLayoutVertexBuffer!==r||c||this.boundIndexBuffer!==n||this.boundVertexOffset!==o||this.boundDynamicVertexBuffer!==a||this.boundDynamicVertexBuffer2!==s||this.boundDynamicVertexBuffer3!==l?this.freshBind(t,r,i,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,r,i,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=r,this.boundIndexBuffer=i,this.boundVertexOffset=n,this.boundDynamicVertexBuffer=o,this.boundDynamicVertexBuffer2=a,this.boundDynamicVertexBuffer3=s,t.enableAttributes(u,e);for(const h of r)h.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 h of r)h.bind(),h.setVertexAttribPointers(u,e,n);o&&(o.bind(),o.setVertexAttribPointers(u,e,n)),i&&i.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 Dr=(e,r,i,n,o)=>({u_texture:0,u_ele_delta:e,u_fog_matrix:r,u_fog_color:i?i.properties.get("fog-color"):t.bo.white,u_fog_ground_blend:i?i.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:o?0:i?i.calculateFogBlendOpacity(n):0,u_horizon_color:i?i.properties.get("horizon-color"):t.bo.white,u_horizon_fog_blend:i?i.properties.get("horizon-fog-blend"):1,u_is_globe_mode:o?1:0}),Rr={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 Lr(e){const t=[];for(let r=0;r<e.length;r++){if(null===e[r])continue;const i=e[r].split(" ");t.push(i.pop())}return t}class Fr{constructor(e,r,i,n,o,a,s,l,c=[]){const u=e.gl;this.program=u.createProgram();const h=Lr(r.staticAttributes),d=i?i.getBinderAttributes():[],p=h.concat(d),f=Pt.prelude.staticUniforms?Lr(Pt.prelude.staticUniforms):[],m=s.staticUniforms?Lr(s.staticUniforms):[],g=r.staticUniforms?Lr(r.staticUniforms):[],_=i?i.getBinderUniforms():[],y=f.concat(m).concat(g).concat(_),v=[];for(const t of y)v.indexOf(t)<0&&v.push(t);const b=i?i.defines():[];Qt(u)&&b.unshift("#version 300 es"),o&&b.push("#define OVERDRAW_INSPECTOR;"),a&&b.push("#define TERRAIN3D;"),l&&b.push(l),c&&b.push(...c);let x=b.concat(Pt.prelude.fragmentSource,s.fragmentSource,r.fragmentSource).join("\n"),w=b.concat(Pt.prelude.vertexSource,s.vertexSource,r.vertexSource).join("\n");Qt(u)||(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),w=function(e){return e.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}(w));const T=u.createShader(u.FRAGMENT_SHADER);if(u.isContextLost())return void(this.failedToCreate=!0);if(u.shaderSource(T,x),u.compileShader(T),!u.getShaderParameter(T,u.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${u.getShaderInfoLog(T)}`);u.attachShader(this.program,T);const S=u.createShader(u.VERTEX_SHADER);if(u.isContextLost())return void(this.failedToCreate=!0);if(u.shaderSource(S,w),u.compileShader(S),!u.getShaderParameter(S,u.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${u.getShaderInfoLog(S)}`);u.attachShader(this.program,S),this.attributes={};const E={};this.numAttributes=p.length;for(let t=0;t<this.numAttributes;t++)p[t]&&(u.bindAttribLocation(this.program,t,p[t]),this.attributes[p[t]]=t);if(u.linkProgram(this.program),!u.getProgramParameter(this.program,u.LINK_STATUS))throw new Error(`Program failed to link: ${u.getProgramInfoLog(this.program)}`);u.deleteShader(S),u.deleteShader(T);for(let t=0;t<v.length;t++){const e=v[t];if(e&&!E[e]){const t=u.getUniformLocation(this.program,e);t&&(E[e]=t)}}this.fixedUniforms=n(e,E),this.terrainUniforms=((e,r)=>({u_depth:new t.bZ(e,r.u_depth),u_terrain:new t.bZ(e,r.u_terrain),u_terrain_dim:new t.bp(e,r.u_terrain_dim),u_terrain_matrix:new t.b$(e,r.u_terrain_matrix),u_terrain_unpack:new t.c0(e,r.u_terrain_unpack),u_terrain_exaggeration:new t.bp(e,r.u_terrain_exaggeration)}))(e,E),this.projectionUniforms=((e,r)=>({u_projection_matrix:new t.b$(e,r.u_projection_matrix),u_projection_tile_mercator_coords:new t.c0(e,r.u_projection_tile_mercator_coords),u_projection_clipping_plane:new t.c0(e,r.u_projection_clipping_plane),u_projection_transition:new t.bp(e,r.u_projection_transition),u_projection_fallback_matrix:new t.b$(e,r.u_projection_fallback_matrix)}))(e,E),this.binderUniforms=i?i.getUniforms(e,E):[]}draw(e,t,r,i,n,o,a,s,l,c,u,h,d,p,f,m,g,_,y){const v=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(r),e.setStencilMode(i),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 x in l)this.projectionUniforms[Rr[x]].set(l[x]);if(a)for(const x in this.fixedUniforms)this.fixedUniforms[x].set(a[x]);m&&m.setUniforms(e,this.binderUniforms,p,{zoom:f});let b=0;switch(t){case v.LINES:b=2;break;case v.TRIANGLES:b=3;break;case v.LINE_STRIP:b=1}for(const x of d.get()){const r=x.vaos||(x.vaos={});(r[c]||(r[c]=new Mr)).bind(e,this,u,m?m.getPaintVertexBuffers():[],h,x.vertexOffset,g,_,y),v.drawElements(t,x.primitiveLength*b,v.UNSIGNED_SHORT,x.primitiveOffset*b*2)}}}function Or(e,r,i){const n=1/t.aM(i,1,r.transform.tileZoom),o=Math.pow(2,i.tileID.overscaledZ),a=i.tileSize*Math.pow(2,r.transform.tileZoom)/o,s=a*(i.tileID.canonical.x+i.tileID.wrap*o),l=a*i.tileID.canonical.y;return{u_image:0,u_texsize:i.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 zr=(e,r,i,n)=>{const o=e.style.light,a=o.properties.get("position"),s=[a.x,a.y,a.z],l=t.c3();"viewport"===o.properties.get("anchor")&&t.c4(l,e.transform.bearingInRadians),t.c5(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:+r,u_opacity:i,u_fill_translate:n}},Br=(e,r,i,n,o,a,s)=>t.e(zr(e,r,i,n),Or(a,e,s),{u_height_factor:-Math.pow(2,o.overscaledZ)/s.tileSize/8}),Nr=(e,r,i,n)=>t.e(Or(r,e,i),{u_fill_translate:n}),jr=(e,t)=>({u_world:e,u_fill_translate:t}),Vr=(e,r,i,n,o)=>t.e(Nr(e,r,i,o),{u_world:n}),Ur=(e,r,i,n,o)=>{const a=e.transform;let s,l,c=0;if("map"===i.paint.get("circle-pitch-alignment")){const e=t.aM(r,1,a.zoom);s=!0,l=[e,e],c=e/(t.a4*Math.pow(2,r.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"===i.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}},Gr=e=>({u_pixel_extrude_scale:[1/e.width,1/e.height]}),qr=e=>({u_viewport_size:[e.width,e.height]}),$r=(e,t=1)=>({u_color:e,u_overlay:0,u_overlay_scale:t}),Wr=(e,r,i,n)=>{const o=t.aM(e,1,r)/(t.a4*Math.pow(2,e.tileID.overscaledZ))*2*Math.PI*n;return{u_extrude_scale:t.aM(e,1,r),u_intensity:i,u_globe_extrude_scale:o}},Zr=(e,r,i,n)=>{const o=t.N();t.c6(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:i,u_color_ramp:n,u_opacity:r.paint.get("heatmap-opacity")}},Hr=(e,t,r)=>{const i=r.paint.get("hillshade-accent-color");let n;switch(r.paint.get("hillshade-method")){case"basic":n=4;break;case"combined":n=1;break;case"igor":n=2;break;case"multidirectional":n=3;break;default:n=0}const o=r.getIlluminationProperties();for(let a=0;a<o.directionRadians.length;a++)"viewport"===r.paint.get("hillshade-illumination-anchor")&&(o.directionRadians[a]+=e.transform.bearingInRadians);return{u_image:0,u_latrange:Yr(0,t.tileID),u_exaggeration:r.paint.get("hillshade-exaggeration"),u_altitudes:o.altitudeRadians,u_azimuths:o.directionRadians,u_accent:i,u_method:n,u_highlights:o.highlightColor,u_shadows:o.shadowColor}},Xr=(e,r)=>{const i=r.stride,n=t.N();return t.c6(n,0,t.a4,-t.a4,0,0,1),t.O(n,n,[0,-t.a4,0]),{u_matrix:n,u_image:1,u_dimension:[i,i],u_zoom:e.overscaledZ,u_unpack:r.getUnpackVector()}};function Yr(e,r){const i=Math.pow(2,r.canonical.z),n=r.canonical.y;return[new t.aa(0,n/i).toLngLat().lat,new t.aa(0,(n+1)/i).toLngLat().lat]}const Jr=(e,t,r=0)=>({u_image:0,u_unpack:t.getUnpackVector(),u_dimension:[t.stride,t.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:r,u_opacity:e.paint.get("color-relief-opacity")}),Kr=(e,r,i,n)=>{const o=e.transform;return{u_translation:ni(e,r,i),u_ratio:n/t.aM(r,1,o.zoom),u_device_pixel_ratio:e.pixelRatio,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},Qr=(e,r,i,n,o)=>t.e(Kr(e,r,i,n),{u_image:0,u_image_height:o}),ei=(e,r,i,n,o)=>{const a=e.transform,s=ii(r,a);return{u_translation:ni(e,r,i),u_texsize:r.imageAtlasTexture.size,u_ratio:n/t.aM(r,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]]}},ti=(e,r,i,n,o)=>{const a=ii(r,e.transform);return t.e(Kr(e,r,i,n),{u_tileratio:a,u_crossfade_from:o.fromScale,u_crossfade_to:o.toScale,u_image:0,u_mix:o.t,u_lineatlas_width:e.lineAtlas.width,u_lineatlas_height:e.lineAtlas.height})},ri=(e,r,i,n,o,a)=>{const s=ii(r,e.transform);return t.e(Kr(e,r,i,n),{u_image:0,u_image_height:a,u_tileratio:s,u_crossfade_from:o.fromScale,u_crossfade_to:o.toScale,u_image_dash:1,u_mix:o.t,u_lineatlas_width:e.lineAtlas.width,u_lineatlas_height:e.lineAtlas.height})};function ii(e,r){return 1/t.aM(e,1,r.tileZoom)}function ni(e,r,i){return t.aN(e.transform,r,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const oi=(e,t,r,i,n)=>{return{u_tl_parent:e,u_scale_parent:t,u_buffer_scale:1,u_fade_t:r.mix,u_opacity:r.opacity*i.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:i.paint.get("raster-brightness-min"),u_brightness_high:i.paint.get("raster-brightness-max"),u_saturation_factor:(a=i.paint.get("raster-saturation"),a>0?1-1/(1.001-a):-a),u_contrast_factor:(o=i.paint.get("raster-contrast"),o>0?1/(1-o):1+o),u_spin_weights:ai(i.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 ai(e){e*=Math.PI/180;const t=Math.sin(e),r=Math.cos(e);return[(2*r+1)/3,(-Math.sqrt(3)*t-r+1)/3,(Math.sqrt(3)*t-r+1)/3]}const si=(e,t,r,i,n,o,a,s,l,c,u,h,d)=>{const p=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:p.cameraToCenterDistance,u_pitch:p.pitch/360*2*Math.PI,u_rotate_symbol:+r,u_aspect_ratio:p.width/p.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:+i,u_is_along_line:n,u_is_variable_anchor:o,u_texsize:h,u_texture:0,u_translation:c,u_pitched_scale:d}},li=(e,r,i,n,o,a,s,l,c,u,h,d,p,f)=>{const m=s.transform;return t.e(si(e,r,i,n,o,a,s,l,c,u,h,d,f),{u_gamma_scale:n?Math.cos(m.pitch*Math.PI/180)*m.cameraToCenterDistance:1,u_device_pixel_ratio:s.pixelRatio,u_is_halo:1})},ci=(e,r,i,n,o,a,s,l,c,u,h,d,p)=>t.e(li(e,r,i,n,o,a,s,l,c,u,!0,h,0,p),{u_texsize_icon:d,u_texture_icon:1}),ui=(e,t)=>({u_opacity:e,u_color:t}),hi=(e,r,i,n,o)=>t.e(function(e,r,i,n){const o=i.imageManager.getPattern(e.from.toString()),a=i.imageManager.getPattern(e.to.toString()),{width:s,height:l}=i.imageManager.getPixelSize(),c=Math.pow(2,n.tileID.overscaledZ),u=n.tileSize*Math.pow(2,i.transform.tileZoom)/c,h=u*(n.tileID.canonical.x+n.tileID.wrap*c),d=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:r.t,u_pattern_size_a:o.displaySize,u_pattern_size_b:a.displaySize,u_scale_a:r.fromScale,u_scale_b:r.toScale,u_tile_units_to_pixels:1/t.aM(n,1,i.transform.tileZoom),u_pixel_coord_upper:[h>>16,d>>16],u_pixel_coord_lower:[65535&h,65535&d]}}(i,o,r,n),{u_opacity:e}),di=(e,t)=>{},pi={fillExtrusion:(e,r)=>({u_lightpos:new t.c1(e,r.u_lightpos),u_lightpos_globe:new t.c1(e,r.u_lightpos_globe),u_lightintensity:new t.bp(e,r.u_lightintensity),u_lightcolor:new t.c1(e,r.u_lightcolor),u_vertical_gradient:new t.bp(e,r.u_vertical_gradient),u_opacity:new t.bp(e,r.u_opacity),u_fill_translate:new t.c2(e,r.u_fill_translate)}),fillExtrusionPattern:(e,r)=>({u_lightpos:new t.c1(e,r.u_lightpos),u_lightpos_globe:new t.c1(e,r.u_lightpos_globe),u_lightintensity:new t.bp(e,r.u_lightintensity),u_lightcolor:new t.c1(e,r.u_lightcolor),u_vertical_gradient:new t.bp(e,r.u_vertical_gradient),u_height_factor:new t.bp(e,r.u_height_factor),u_opacity:new t.bp(e,r.u_opacity),u_fill_translate:new t.c2(e,r.u_fill_translate),u_image:new t.bZ(e,r.u_image),u_texsize:new t.c2(e,r.u_texsize),u_pixel_coord_upper:new t.c2(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.c2(e,r.u_pixel_coord_lower),u_scale:new t.c1(e,r.u_scale),u_fade:new t.bp(e,r.u_fade)}),fill:(e,r)=>({u_fill_translate:new t.c2(e,r.u_fill_translate)}),fillPattern:(e,r)=>({u_image:new t.bZ(e,r.u_image),u_texsize:new t.c2(e,r.u_texsize),u_pixel_coord_upper:new t.c2(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.c2(e,r.u_pixel_coord_lower),u_scale:new t.c1(e,r.u_scale),u_fade:new t.bp(e,r.u_fade),u_fill_translate:new t.c2(e,r.u_fill_translate)}),fillOutline:(e,r)=>({u_world:new t.c2(e,r.u_world),u_fill_translate:new t.c2(e,r.u_fill_translate)}),fillOutlinePattern:(e,r)=>({u_world:new t.c2(e,r.u_world),u_image:new t.bZ(e,r.u_image),u_texsize:new t.c2(e,r.u_texsize),u_pixel_coord_upper:new t.c2(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.c2(e,r.u_pixel_coord_lower),u_scale:new t.c1(e,r.u_scale),u_fade:new t.bp(e,r.u_fade),u_fill_translate:new t.c2(e,r.u_fill_translate)}),circle:(e,r)=>({u_camera_to_center_distance:new t.bp(e,r.u_camera_to_center_distance),u_scale_with_map:new t.bZ(e,r.u_scale_with_map),u_pitch_with_map:new t.bZ(e,r.u_pitch_with_map),u_extrude_scale:new t.c2(e,r.u_extrude_scale),u_device_pixel_ratio:new t.bp(e,r.u_device_pixel_ratio),u_globe_extrude_scale:new t.bp(e,r.u_globe_extrude_scale),u_translate:new t.c2(e,r.u_translate)}),collisionBox:(e,r)=>({u_pixel_extrude_scale:new t.c2(e,r.u_pixel_extrude_scale)}),collisionCircle:(e,r)=>({u_viewport_size:new t.c2(e,r.u_viewport_size)}),debug:(e,r)=>({u_color:new t.b_(e,r.u_color),u_overlay:new t.bZ(e,r.u_overlay),u_overlay_scale:new t.bp(e,r.u_overlay_scale)}),depth:di,clippingMask:di,heatmap:(e,r)=>({u_extrude_scale:new t.bp(e,r.u_extrude_scale),u_intensity:new t.bp(e,r.u_intensity),u_globe_extrude_scale:new t.bp(e,r.u_globe_extrude_scale)}),heatmapTexture:(e,r)=>({u_matrix:new t.b$(e,r.u_matrix),u_world:new t.c2(e,r.u_world),u_image:new t.bZ(e,r.u_image),u_color_ramp:new t.bZ(e,r.u_color_ramp),u_opacity:new t.bp(e,r.u_opacity)}),hillshade:(e,r)=>({u_image:new t.bZ(e,r.u_image),u_latrange:new t.c2(e,r.u_latrange),u_exaggeration:new t.bp(e,r.u_exaggeration),u_altitudes:new t.c8(e,r.u_altitudes),u_azimuths:new t.c8(e,r.u_azimuths),u_accent:new t.b_(e,r.u_accent),u_method:new t.bZ(e,r.u_method),u_shadows:new t.c7(e,r.u_shadows),u_highlights:new t.c7(e,r.u_highlights)}),hillshadePrepare:(e,r)=>({u_matrix:new t.b$(e,r.u_matrix),u_image:new t.bZ(e,r.u_image),u_dimension:new t.c2(e,r.u_dimension),u_zoom:new t.bp(e,r.u_zoom),u_unpack:new t.c0(e,r.u_unpack)}),colorRelief:(e,r)=>({u_image:new t.bZ(e,r.u_image),u_unpack:new t.c0(e,r.u_unpack),u_dimension:new t.c2(e,r.u_dimension),u_elevation_stops:new t.bZ(e,r.u_elevation_stops),u_color_stops:new t.bZ(e,r.u_color_stops),u_color_ramp_size:new t.bZ(e,r.u_color_ramp_size),u_opacity:new t.bp(e,r.u_opacity)}),line:(e,r)=>({u_translation:new t.c2(e,r.u_translation),u_ratio:new t.bp(e,r.u_ratio),u_device_pixel_ratio:new t.bp(e,r.u_device_pixel_ratio),u_units_to_pixels:new t.c2(e,r.u_units_to_pixels)}),lineGradient:(e,r)=>({u_translation:new t.c2(e,r.u_translation),u_ratio:new t.bp(e,r.u_ratio),u_device_pixel_ratio:new t.bp(e,r.u_device_pixel_ratio),u_units_to_pixels:new t.c2(e,r.u_units_to_pixels),u_image:new t.bZ(e,r.u_image),u_image_height:new t.bp(e,r.u_image_height)}),linePattern:(e,r)=>({u_translation:new t.c2(e,r.u_translation),u_texsize:new t.c2(e,r.u_texsize),u_ratio:new t.bp(e,r.u_ratio),u_device_pixel_ratio:new t.bp(e,r.u_device_pixel_ratio),u_image:new t.bZ(e,r.u_image),u_units_to_pixels:new t.c2(e,r.u_units_to_pixels),u_scale:new t.c1(e,r.u_scale),u_fade:new t.bp(e,r.u_fade)}),lineSDF:(e,r)=>({u_translation:new t.c2(e,r.u_translation),u_ratio:new t.bp(e,r.u_ratio),u_device_pixel_ratio:new t.bp(e,r.u_device_pixel_ratio),u_units_to_pixels:new t.c2(e,r.u_units_to_pixels),u_image:new t.bZ(e,r.u_image),u_mix:new t.bp(e,r.u_mix),u_tileratio:new t.bp(e,r.u_tileratio),u_crossfade_from:new t.bp(e,r.u_crossfade_from),u_crossfade_to:new t.bp(e,r.u_crossfade_to),u_lineatlas_width:new t.bp(e,r.u_lineatlas_width),u_lineatlas_height:new t.bp(e,r.u_lineatlas_height)}),lineGradientSDF:(e,r)=>({u_translation:new t.c2(e,r.u_translation),u_ratio:new t.bp(e,r.u_ratio),u_device_pixel_ratio:new t.bp(e,r.u_device_pixel_ratio),u_units_to_pixels:new t.c2(e,r.u_units_to_pixels),u_image:new t.bZ(e,r.u_image),u_image_height:new t.bp(e,r.u_image_height),u_tileratio:new t.bp(e,r.u_tileratio),u_crossfade_from:new t.bp(e,r.u_crossfade_from),u_crossfade_to:new t.bp(e,r.u_crossfade_to),u_image_dash:new t.bZ(e,r.u_image_dash),u_mix:new t.bp(e,r.u_mix),u_lineatlas_width:new t.bp(e,r.u_lineatlas_width),u_lineatlas_height:new t.bp(e,r.u_lineatlas_height)}),raster:(e,r)=>({u_tl_parent:new t.c2(e,r.u_tl_parent),u_scale_parent:new t.bp(e,r.u_scale_parent),u_buffer_scale:new t.bp(e,r.u_buffer_scale),u_fade_t:new t.bp(e,r.u_fade_t),u_opacity:new t.bp(e,r.u_opacity),u_image0:new t.bZ(e,r.u_image0),u_image1:new t.bZ(e,r.u_image1),u_brightness_low:new t.bp(e,r.u_brightness_low),u_brightness_high:new t.bp(e,r.u_brightness_high),u_saturation_factor:new t.bp(e,r.u_saturation_factor),u_contrast_factor:new t.bp(e,r.u_contrast_factor),u_spin_weights:new t.c1(e,r.u_spin_weights),u_coords_top:new t.c0(e,r.u_coords_top),u_coords_bottom:new t.c0(e,r.u_coords_bottom)}),symbolIcon:(e,r)=>({u_is_size_zoom_constant:new t.bZ(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new t.bZ(e,r.u_is_size_feature_constant),u_size_t:new t.bp(e,r.u_size_t),u_size:new t.bp(e,r.u_size),u_camera_to_center_distance:new t.bp(e,r.u_camera_to_center_distance),u_pitch:new t.bp(e,r.u_pitch),u_rotate_symbol:new t.bZ(e,r.u_rotate_symbol),u_aspect_ratio:new t.bp(e,r.u_aspect_ratio),u_fade_change:new t.bp(e,r.u_fade_change),u_label_plane_matrix:new t.b$(e,r.u_label_plane_matrix),u_coord_matrix:new t.b$(e,r.u_coord_matrix),u_is_text:new t.bZ(e,r.u_is_text),u_pitch_with_map:new t.bZ(e,r.u_pitch_with_map),u_is_along_line:new t.bZ(e,r.u_is_along_line),u_is_variable_anchor:new t.bZ(e,r.u_is_variable_anchor),u_texsize:new t.c2(e,r.u_texsize),u_texture:new t.bZ(e,r.u_texture),u_translation:new t.c2(e,r.u_translation),u_pitched_scale:new t.bp(e,r.u_pitched_scale)}),symbolSDF:(e,r)=>({u_is_size_zoom_constant:new t.bZ(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new t.bZ(e,r.u_is_size_feature_constant),u_size_t:new t.bp(e,r.u_size_t),u_size:new t.bp(e,r.u_size),u_camera_to_center_distance:new t.bp(e,r.u_camera_to_center_distance),u_pitch:new t.bp(e,r.u_pitch),u_rotate_symbol:new t.bZ(e,r.u_rotate_symbol),u_aspect_ratio:new t.bp(e,r.u_aspect_ratio),u_fade_change:new t.bp(e,r.u_fade_change),u_label_plane_matrix:new t.b$(e,r.u_label_plane_matrix),u_coord_matrix:new t.b$(e,r.u_coord_matrix),u_is_text:new t.bZ(e,r.u_is_text),u_pitch_with_map:new t.bZ(e,r.u_pitch_with_map),u_is_along_line:new t.bZ(e,r.u_is_along_line),u_is_variable_anchor:new t.bZ(e,r.u_is_variable_anchor),u_texsize:new t.c2(e,r.u_texsize),u_texture:new t.bZ(e,r.u_texture),u_gamma_scale:new t.bp(e,r.u_gamma_scale),u_device_pixel_ratio:new t.bp(e,r.u_device_pixel_ratio),u_is_halo:new t.bZ(e,r.u_is_halo),u_translation:new t.c2(e,r.u_translation),u_pitched_scale:new t.bp(e,r.u_pitched_scale)}),symbolTextAndIcon:(e,r)=>({u_is_size_zoom_constant:new t.bZ(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new t.bZ(e,r.u_is_size_feature_constant),u_size_t:new t.bp(e,r.u_size_t),u_size:new t.bp(e,r.u_size),u_camera_to_center_distance:new t.bp(e,r.u_camera_to_center_distance),u_pitch:new t.bp(e,r.u_pitch),u_rotate_symbol:new t.bZ(e,r.u_rotate_symbol),u_aspect_ratio:new t.bp(e,r.u_aspect_ratio),u_fade_change:new t.bp(e,r.u_fade_change),u_label_plane_matrix:new t.b$(e,r.u_label_plane_matrix),u_coord_matrix:new t.b$(e,r.u_coord_matrix),u_is_text:new t.bZ(e,r.u_is_text),u_pitch_with_map:new t.bZ(e,r.u_pitch_with_map),u_is_along_line:new t.bZ(e,r.u_is_along_line),u_is_variable_anchor:new t.bZ(e,r.u_is_variable_anchor),u_texsize:new t.c2(e,r.u_texsize),u_texsize_icon:new t.c2(e,r.u_texsize_icon),u_texture:new t.bZ(e,r.u_texture),u_texture_icon:new t.bZ(e,r.u_texture_icon),u_gamma_scale:new t.bp(e,r.u_gamma_scale),u_device_pixel_ratio:new t.bp(e,r.u_device_pixel_ratio),u_is_halo:new t.bZ(e,r.u_is_halo),u_translation:new t.c2(e,r.u_translation),u_pitched_scale:new t.bp(e,r.u_pitched_scale)}),background:(e,r)=>({u_opacity:new t.bp(e,r.u_opacity),u_color:new t.b_(e,r.u_color)}),backgroundPattern:(e,r)=>({u_opacity:new t.bp(e,r.u_opacity),u_image:new t.bZ(e,r.u_image),u_pattern_tl_a:new t.c2(e,r.u_pattern_tl_a),u_pattern_br_a:new t.c2(e,r.u_pattern_br_a),u_pattern_tl_b:new t.c2(e,r.u_pattern_tl_b),u_pattern_br_b:new t.c2(e,r.u_pattern_br_b),u_texsize:new t.c2(e,r.u_texsize),u_mix:new t.bp(e,r.u_mix),u_pattern_size_a:new t.c2(e,r.u_pattern_size_a),u_pattern_size_b:new t.c2(e,r.u_pattern_size_b),u_scale_a:new t.bp(e,r.u_scale_a),u_scale_b:new t.bp(e,r.u_scale_b),u_pixel_coord_upper:new t.c2(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.c2(e,r.u_pixel_coord_lower),u_tile_units_to_pixels:new t.bp(e,r.u_tile_units_to_pixels)}),terrain:(e,r)=>({u_texture:new t.bZ(e,r.u_texture),u_ele_delta:new t.bp(e,r.u_ele_delta),u_fog_matrix:new t.b$(e,r.u_fog_matrix),u_fog_color:new t.b_(e,r.u_fog_color),u_fog_ground_blend:new t.bp(e,r.u_fog_ground_blend),u_fog_ground_blend_opacity:new t.bp(e,r.u_fog_ground_blend_opacity),u_horizon_color:new t.b_(e,r.u_horizon_color),u_horizon_fog_blend:new t.bp(e,r.u_horizon_fog_blend),u_is_globe_mode:new t.bp(e,r.u_is_globe_mode)}),terrainDepth:(e,r)=>({u_ele_delta:new t.bp(e,r.u_ele_delta)}),terrainCoords:(e,r)=>({u_texture:new t.bZ(e,r.u_texture),u_terrain_coords_id:new t.bp(e,r.u_terrain_coords_id),u_ele_delta:new t.bp(e,r.u_ele_delta)}),projectionErrorMeasurement:(e,r)=>({u_input:new t.bp(e,r.u_input),u_output_expected:new t.bp(e,r.u_output_expected)}),atmosphere:(e,r)=>({u_sun_pos:new t.c1(e,r.u_sun_pos),u_atmosphere_blend:new t.bp(e,r.u_atmosphere_blend),u_globe_position:new t.c1(e,r.u_globe_position),u_globe_radius:new t.bp(e,r.u_globe_radius),u_inv_proj_matrix:new t.b$(e,r.u_inv_proj_matrix)}),sky:(e,r)=>({u_sky_color:new t.b_(e,r.u_sky_color),u_horizon_color:new t.b_(e,r.u_horizon_color),u_horizon:new t.c2(e,r.u_horizon),u_horizon_normal:new t.c2(e,r.u_horizon_normal),u_sky_horizon_blend:new t.bp(e,r.u_sky_horizon_blend),u_sky_blend:new t.bp(e,r.u_sky_blend)})};class fi{constructor(e,t,r){this.context=e;const i=e.gl;this.buffer=i.createBuffer(),this.dynamicDraw=Boolean(r),this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),i.bufferData(i.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?i.DYNAMIC_DRAW:i.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 mi={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class gi{constructor(e,t,r,i){this.length=t.length,this.attributes=r,this.itemSize=t.bytesPerElement,this.dynamicDraw=i,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 r=0;r<this.attributes.length;r++){const i=t.attributes[this.attributes[r].name];void 0!==i&&e.enableVertexAttribArray(i)}}setVertexAttribPointers(e,t,r){for(let i=0;i<this.attributes.length;i++){const n=this.attributes[i],o=t.attributes[n.name];void 0!==o&&e.vertexAttribPointer(o,n.components,e[mi[n.type]],!1,this.itemSize,n.offset+this.itemSize*(r||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class _i{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 yi extends _i{getDefault(){return t.bo.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 vi extends _i{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class bi extends _i{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class xi extends _i{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 wi extends _i{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class Ti extends _i{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class Si extends _i{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 Ei extends _i{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 Ii extends _i{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 Pi extends _i{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 ki extends _i{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 Ai extends _i{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class Ci extends _i{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 Mi extends _i{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 Di extends _i{getDefault(){return t.bo.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 Ri extends _i{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class Li extends _i{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 Fi extends _i{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class Oi extends _i{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class zi extends _i{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class Bi extends _i{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class Ni extends _i{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 ji extends _i{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 Vi extends _i{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 Ui extends _i{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 Gi extends _i{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 qi extends _i{getDefault(){return null}set(e){const t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class $i extends _i{getDefault(){return null}set(e){var t;if(e===this.current&&!this.dirty)return;const r=this.gl;Qt(r)?r.bindVertexArray(e):null===(t=r.getExtension("OES_vertex_array_object"))||void 0===t||t.bindVertexArrayOES(e),this.current=e,this.dirty=!1}}class Wi extends _i{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 Zi extends _i{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 Hi extends _i{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 Xi extends _i{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}}class Yi extends Xi{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 Ji extends Xi{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 Ki extends Xi{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 Qi="Framebuffer is not complete";class en{constructor(e,t,r,i,n){this.context=e,this.width=t,this.height=r;const o=e.gl,a=this.framebuffer=o.createFramebuffer();if(this.colorAttachment=new Yi(e,a),i)this.depthAttachment=n?new Ki(e,a):new Ji(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(Qi)}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 tn{constructor(e){var t,r;if(this.gl=e,this.clearColor=new yi(this),this.clearDepth=new vi(this),this.clearStencil=new bi(this),this.colorMask=new xi(this),this.depthMask=new wi(this),this.stencilMask=new Ti(this),this.stencilFunc=new Si(this),this.stencilOp=new Ei(this),this.stencilTest=new Ii(this),this.depthRange=new Pi(this),this.depthTest=new ki(this),this.depthFunc=new Ai(this),this.blend=new Ci(this),this.blendFunc=new Mi(this),this.blendColor=new Di(this),this.blendEquation=new Ri(this),this.cullFace=new Li(this),this.cullFaceSide=new Fi(this),this.frontFace=new Oi(this),this.program=new zi(this),this.activeTexture=new Bi(this),this.viewport=new Ni(this),this.bindFramebuffer=new ji(this),this.bindRenderbuffer=new Vi(this),this.bindTexture=new Ui(this),this.bindVertexBuffer=new Gi(this),this.bindElementBuffer=new qi(this),this.bindVertexArray=new $i(this),this.pixelStoreUnpack=new Wi(this),this.pixelStoreUnpackPremultiplyAlpha=new Zi(this),this.pixelStoreUnpackFlipY=new Hi(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),Qt(e)){this.HALF_FLOAT=e.HALF_FLOAT;const i=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=null!==(t=e.RGBA16F)&&void 0!==t?t:null==i?void 0:i.RGBA16F_EXT,this.RGB16F=null!==(r=e.RGB16F)&&void 0!==r?r:null==i?void 0:i.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 fi(this,e,t)}createVertexBuffer(e,t,r){return new gi(this,e,t,r)}createRenderbuffer(e,t,r){const i=this.gl,n=i.createRenderbuffer();return this.bindRenderbuffer.set(n),i.renderbufferStorage(i.RENDERBUFFER,e,t,r),this.bindRenderbuffer.set(null),n}createFramebuffer(e,t,r,i){return new en(this,e,t,r,i)}clear({color:e,depth:t,stencil:r}){const i=this.gl;let n=0;e&&(n|=i.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),void 0!==t&&(n|=i.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),void 0!==r&&(n|=i.STENCIL_BUFFER_BIT,this.clearStencil.set(r),this.stencilMask.set(255)),i.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.bQ(e.blendFunction,Wt.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 Qt(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 Qt(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 rn;function nn(e,r,i,n,o){const a=e.context,s=e.transform,l=a.gl,c=e.useProgram("collisionBox"),u=[];let h=0,d=0;for(let t=0;t<n.length;t++){const p=n[t],f=r.getTile(p).getBucket(i);if(!f)continue;const m=o?f.textCollisionBox:f.iconCollisionBox,g=f.collisionCircleArray;g.length>0&&(u.push({circleArray:g,circleOffset:d,coord:p}),h+=g.length/4,d=h),m&&c.draw(a,l.LINES,Xt.disabled,Jt.disabled,e.colorModeForRenderPass(),Ht.disabled,Gr(e.transform),e.style.map.terrain&&e.style.map.terrain.getTerrainData(p),s.getProjectionData({overscaledTileID:p,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),i.id,m.layoutVertexBuffer,m.indexBuffer,m.segments,null,e.transform.zoom,null,null,m.collisionVertexBuffer)}if(!o||!u.length)return;const p=e.useProgram("collisionCircle"),f=new t.c9;f.resize(4*h),f._trim();let m=0;for(const t of u)for(let e=0;e<t.circleArray.length/4;e++){const r=4*e,i=t.circleArray[r+0],n=t.circleArray[r+1],o=t.circleArray[r+2],a=t.circleArray[r+3];f.emplace(m++,i,n,o,a,0),f.emplace(m++,i,n,o,a,1),f.emplace(m++,i,n,o,a,2),f.emplace(m++,i,n,o,a,3)}(!rn||rn.length<2*h)&&(rn=function(e){const r=2*e,i=new t.cb;i.resize(r),i._trim();for(let t=0;t<r;t++){const e=6*t;i.uint16[e+0]=4*t+0,i.uint16[e+1]=4*t+1,i.uint16[e+2]=4*t+2,i.uint16[e+3]=4*t+2,i.uint16[e+4]=4*t+3,i.uint16[e+5]=4*t+0}return i}(h));const g=a.createIndexBuffer(rn,!0),_=a.createVertexBuffer(f,t.ca.members,!0);for(const y of u){const r=qr(e.transform);p.draw(a,l.TRIANGLES,Xt.disabled,Jt.disabled,e.colorModeForRenderPass(),Ht.disabled,r,e.style.map.terrain&&e.style.map.terrain.getTerrainData(y.coord),null,i.id,_,g,t.aW.simpleSegment(0,2*y.circleOffset,y.circleArray.length,y.circleArray.length/2),null,e.transform.zoom,null,null,null)}_.destroy(),g.destroy()}const on=t.ar(new Float32Array(16));function an(e,r,i,n,o,a){const{horizontalAlign:s,verticalAlign:l}=t.aR(e);return new t.P((-(s-.5)*r/o+n[0])*a,(-(l-.5)*i/o+n[1])*a)}function sn(e,r,i,n,o,a){const s=r.tileAnchorPoint.add(new t.P(r.translation[0],r.translation[1]));if(r.pitchWithMap){let e=n.mult(a);i||(e=e.rotate(-o));const t=s.add(e);return Oe(t.x,t.y,r.pitchedLabelPlaneMatrix,r.getElevation).point}if(i){const t=$e(r.tileAnchorPoint.x+1,r.tileAnchorPoint.y,r).point.sub(e),i=Math.atan(t.y/t.x)+(t.x<0?Math.PI:0);return e.add(n.rotate(i))}return e.add(n)}function ln(e,r,i,n,o,a,s,l,c,u,h,d){const p=e.text.placedSymbolArray,f=e.text.dynamicLayoutVertexArray,m=e.icon.dynamicLayoutVertexArray,g={};f.clear();for(let _=0;_<p.length;_++){const m=p.get(_),y=m.hidden||!m.crossTileID||e.allowVerticalPlacement&&!m.placedOrientation?null:n[m.crossTileID];if(y){const n=new t.P(m.anchorX,m.anchorY),p={getElevation:d,width:o.width,height:o.height,pitchedLabelPlaneMatrix:a,pitchWithMap:i,transform:o,tileAnchorPoint:n,translation:u,unwrappedTileID:h},_=i?Ze(n.x,n.y,p):$e(n.x,n.y,p),v=ze(o.cameraToCenterDistance,_.signedDistanceFromCamera);let b=t.az(e.textSizeData,l,m)*v/t.aL;i&&(b*=e.tilePixelRatio/s);const{width:x,height:w,anchor:T,textOffset:S,textBoxScale:E}=y,I=an(T,x,w,S,E,b),P=o.getPitchedTextCorrection(n.x+u[0],n.y+u[1],h),k=sn(_.point,p,r,I,-o.bearingInRadians,P),A=e.allowVerticalPlacement&&m.placedOrientation===t.ay.vertical?Math.PI/2:0;for(let e=0;e<m.numGlyphs;e++)t.aF(f,k,A);c&&m.associatedIconIndex>=0&&(g[m.associatedIconIndex]={shiftedAnchor:k,angle:A})}else Ke(m.numGlyphs,f)}if(c){m.clear();const r=e.icon.placedSymbolArray;for(let e=0;e<r.length;e++){const i=r.get(e);if(i.hidden)Ke(i.numGlyphs,m);else{const r=g[e];if(r)for(let e=0;e<i.numGlyphs;e++)t.aF(m,r.shiftedAnchor,r.angle);else Ke(i.numGlyphs,m)}}e.icon.dynamicLayoutVertexBuffer.updateData(m)}e.text.dynamicLayoutVertexBuffer.updateData(f)}function cn(e,t,r){return r.iconsInText&&t?"symbolTextAndIcon":e?"symbolSDF":"symbolIcon"}function un(e,r,i,n,o,a,s,l,c,u,h,d,p){const f=e.context,m=f.gl,g=e.transform,_="map"===l,y="map"===c,v="viewport"!==l&&"point"!==i.layout.get("symbol-placement"),b=_&&!y&&!v,x=!i.layout.get("symbol-sort-key").isConstant();let w=!1;const T=e.getDepthModeForSublayer(0,Xt.ReadOnly),S=i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"),E=[],I=g.getCircleRadiusCorrection();for(const P of n){const n=r.getTile(P),l=n.getBucket(i);if(!l)continue;const c=o?l.text:l.icon;if(!c||!c.segments.get().length||!c.hasVisibleVertices)continue;const h=c.programConfigurations.get(i.id),d=o||l.sdfIcons,f=o?l.textSizeData:l.iconSizeData,T=y||0!==g.pitch,k=e.useProgram(cn(d,o,l),h),A=t.ax(f,g.zoom),C=e.style.map.terrain&&e.style.map.terrain.getTerrainData(P);let M,D,R,L,F=[0,0],O=null;if(o)D=n.glyphAtlasTexture,R=m.LINEAR,M=n.glyphAtlasTexture.size,l.iconsInText&&(F=n.imageAtlasTexture.size,O=n.imageAtlasTexture,L=T||e.options.rotating||e.options.zooming||"composite"===f.kind||"camera"===f.kind?m.LINEAR:m.NEAREST);else{const t=1!==i.layout.get("icon-size").constantOr(0)||l.iconsNeedLinear;D=n.imageAtlasTexture,R=d||e.options.rotating||e.options.zooming||t||T?m.LINEAR:m.NEAREST,M=n.imageAtlasTexture.size}const z=t.aM(n,1,e.transform.zoom),B=Re(_,e.transform,z),N=t.N();t.aA(N,B);const j=Le(y,_,e.transform,z),V=t.aN(g,n,a,s),U=g.getProjectionData({overscaledTileID:P,applyGlobeMatrix:!p,applyTerrainMatrix:!0}),G=S&&l.hasTextData(),q="none"!==i.layout.get("icon-text-fit")&&G&&l.hasIconData();if(v){const t=e.style.map.terrain?(t,r)=>e.style.map.terrain.getElevation(P,t,r):null,r="map"===i.layout.get("text-rotation-alignment");Ne(l,e,o,B,N,y,u,r,P.toUnwrapped(),g.width,g.height,V,t)}const $=o&&S||q,W=v||$?on:y?B:e.transform.clipSpaceToPixelsMatrix,Z=d&&0!==i.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1);let H;H=d?l.iconsInText?ci(f.kind,A,b,y,v,$,e,W,j,V,M,F,I):li(f.kind,A,b,y,v,$,e,W,j,V,o,M,0,I):si(f.kind,A,b,y,v,$,e,W,j,V,o,M,I);const X={program:k,buffers:c,uniformValues:H,projectionData:U,atlasTexture:D,atlasTextureIcon:O,atlasInterpolation:R,atlasInterpolationIcon:L,isSDF:d,hasHalo:Z};if(x&&l.canOverlap){w=!0;const e=c.segments.get();for(const r of e)E.push({segments:new t.aW([r]),sortKey:r.sortKey,state:X,terrainData:C})}else E.push({segments:c.segments,sortKey:0,state:X,terrainData:C})}w&&E.sort((e,t)=>e.sortKey-t.sortKey);for(const t of E){const r=t.state;if(f.activeTexture.set(m.TEXTURE0),r.atlasTexture.bind(r.atlasInterpolation,m.CLAMP_TO_EDGE),r.atlasTextureIcon&&(f.activeTexture.set(m.TEXTURE1),r.atlasTextureIcon&&r.atlasTextureIcon.bind(r.atlasInterpolationIcon,m.CLAMP_TO_EDGE)),r.isSDF){const n=r.uniformValues;r.hasHalo&&(n.u_is_halo=1,hn(r.buffers,t.segments,i,e,r.program,T,h,d,n,r.projectionData,t.terrainData)),n.u_is_halo=0}hn(r.buffers,t.segments,i,e,r.program,T,h,d,r.uniformValues,r.projectionData,t.terrainData)}}function hn(e,t,r,i,n,o,a,s,l,c,u){const h=i.context;n.draw(h,h.gl.TRIANGLES,o,a,s,Ht.backCCW,l,u,c,r.id,e.layoutVertexBuffer,e.indexBuffer,t,r.paint,i.transform.zoom,e.programConfigurations.get(r.id),e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer)}function dn(e,r,i,n,o){const a=e.context,s=a.gl,l=Jt.disabled,c=new Wt([s.ONE,s.ONE],t.bo.transparent,[!0,!0,!0,!0]),u=r.getBucket(i);if(!u)return;const h=n.key;let d=i.heatmapFbos.get(h);d||(d=fn(a,r.tileSize,r.tileSize),i.heatmapFbos.set(h,d)),a.bindFramebuffer.set(d.framebuffer),a.viewport.set([0,0,r.tileSize,r.tileSize]),a.clear({color:t.bo.transparent});const p=u.programConfigurations.get(i.id),f=e.useProgram("heatmap",p,!o),m=e.transform.getProjectionData({overscaledTileID:r.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),g=e.style.map.terrain.getTerrainData(n);f.draw(a,s.TRIANGLES,Xt.disabled,l,c,Ht.disabled,Wr(r,e.transform.zoom,i.paint.get("heatmap-intensity"),1),g,m,i.id,u.layoutVertexBuffer,u.indexBuffer,u.segments,i.paint,e.transform.zoom,p)}function pn(e,t,r,i,n){const o=e.context,a=o.gl,s=e.transform;o.setColorMode(e.colorModeForRenderPass());const l=mn(o,t),c=r.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:r,applyTerrainMatrix:n,applyGlobeMatrix:!i});e.useProgram("heatmapTexture").draw(o,a.TRIANGLES,Xt.disabled,Jt.disabled,e.colorModeForRenderPass(),Ht.disabled,Zr(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 fn(e,t,r){var i,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!==(i=e.HALF_FLOAT)&&void 0!==i?i:o.UNSIGNED_BYTE,l=null!==(n=e.RGBA16F)&&void 0!==n?n:o.RGBA;o.texImage2D(o.TEXTURE_2D,0,l,t,r,0,o.RGBA,s,null);const c=e.createFramebuffer(t,r,!1,!1);return c.colorAttachment.set(a),c}function mn(e,r){return r.colorRampTexture||(r.colorRampTexture=new t.T(e,r.colorRamp,e.gl.RGBA)),r.colorRampTexture}function gn(e,r,i,n,o,a,s,l){let c=256;if(o.stepInterpolant){const n=r.getSource().maxzoom,o=s.canonical.z===n?Math.ceil(1<<e.transform.maxZoom-s.canonical.z):1;c=t.an(t.cd(a.maxLineLength/t.a4*1024*o),256,i.maxTextureSize)}return l.gradient=t.ce({expression:o.gradientExpression(),evaluationKey:"lineProgress",resolution:c,image:l.gradient||void 0,clips:a.lineClipsArray}),l.texture?l.texture.update(l.gradient):l.texture=new t.T(i,l.gradient,n.RGBA),l.version=o.gradientVersion,l.texture}function _n(e,t,r,i,n){e.activeTexture.set(t.TEXTURE0),r.imageAtlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE),i.updatePaintBuffers(n)}function yn(e,t,r,i,n,o){(n||e.lineAtlas.dirty)&&(t.activeTexture.set(r.TEXTURE0),e.lineAtlas.bind(t)),i.updatePaintBuffers(o)}function vn(e,t,r,i,n,o,a){const s=o.gradients[n.id];let l=s.texture;n.gradientVersion!==s.version&&(l=gn(e,t,r,i,n,o,a,s)),r.activeTexture.set(i.TEXTURE0),l.bind(n.stepInterpolant?i.NEAREST:i.LINEAR,i.CLAMP_TO_EDGE)}function bn(e,t,r,i,n,o,a,s,l){const c=o.gradients[n.id];let u=c.texture;n.gradientVersion!==c.version&&(u=gn(e,t,r,i,n,o,a,c)),r.activeTexture.set(i.TEXTURE0),u.bind(n.stepInterpolant?i.NEAREST:i.LINEAR,i.CLAMP_TO_EDGE),r.activeTexture.set(i.TEXTURE1),e.lineAtlas.bind(r),s.updatePaintBuffers(l)}function xn(e,t,r,i,n){if(!r||!i||!i.imageAtlas)return;const o=i.imageAtlas.patternPositions;let a=o[r.to.toString()],s=o[r.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 wn(e,r,i,n,o,a,s,l){const c=e.context.gl,u="fill-pattern",h=i.paint.get(u),d=h&&h.constantOr(1),p=i.getCrossfadeParameters();let f,m,g,_,y;const v=e.transform,b=i.paint.get("fill-translate"),x=i.paint.get("fill-translate-anchor");s?(m=d&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",f=c.LINES):(m=d?"fillPattern":"fill",f=c.TRIANGLES);const w=h.constantOr(null);for(const T of n){const n=r.getTile(T);if(d&&!n.patternsLoaded())continue;const h=n.getBucket(i);if(!h)continue;const S=h.programConfigurations.get(i.id),E=e.useProgram(m,S),I=e.style.map.terrain&&e.style.map.terrain.getTerrainData(T);d&&(e.context.activeTexture.set(c.TEXTURE0),n.imageAtlasTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),S.updatePaintBuffers(p)),xn(S,u,w,n,i);const P=v.getProjectionData({overscaledTileID:T,applyGlobeMatrix:!l,applyTerrainMatrix:!0}),k=t.aN(v,n,b,x);if(s){_=h.indexBuffer2,y=h.segments2;const t=[c.drawingBufferWidth,c.drawingBufferHeight];g="fillOutlinePattern"===m&&d?Vr(e,p,n,t,k):jr(t,k)}else _=h.indexBuffer,y=h.segments,g=d?Nr(e,p,n,k):{u_fill_translate:k};const A=e.stencilModeForClipping(T);E.draw(e.context,f,o,A,a,Ht.backCCW,g,I,P,i.id,h.layoutVertexBuffer,_,y,i.paint,e.transform.zoom,S)}}function Tn(e,r,i,n,o,a,s,l){const c=e.context,u=c.gl,h="fill-extrusion-pattern",d=i.paint.get(h),p=d.constantOr(1),f=i.getCrossfadeParameters(),m=i.paint.get("fill-extrusion-opacity"),g=d.constantOr(null),_=e.transform;for(const y of n){const n=r.getTile(y),d=n.getBucket(i);if(!d)continue;const v=e.style.map.terrain&&e.style.map.terrain.getTerrainData(y),b=d.programConfigurations.get(i.id),x=e.useProgram(p?"fillExtrusionPattern":"fillExtrusion",b);p&&(e.context.activeTexture.set(u.TEXTURE0),n.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),b.updatePaintBuffers(f));const w=_.getProjectionData({overscaledTileID:y,applyGlobeMatrix:!l,applyTerrainMatrix:!0});xn(b,h,g,n,i);const T=t.aN(_,n,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),S=i.paint.get("fill-extrusion-vertical-gradient"),E=p?Br(e,S,m,T,y,f,n):zr(e,S,m,T);x.draw(c,c.gl.TRIANGLES,o,a,s,Ht.backCCW,E,v,w,i.id,d.layoutVertexBuffer,d.indexBuffer,d.segments,i.paint,e.transform.zoom,b,e.style.map.terrain&&d.centroidVertexBuffer)}}function Sn(e,t,r,i,n,o,a,s,l){var c;const u=e.style.projection,h=e.context,d=e.transform,p=h.gl,f=[`#define NUM_ILLUMINATION_SOURCES ${r.paint.get("hillshade-highlight-color").values.length}`],m=e.useProgram("hillshade",null,!1,f),g=!e.options.moving;for(const _ of i){const i=t.getTile(_),f=i.fbo;if(!f)continue;const y=u.getMeshFromTileID(h,_.canonical,s,!0,"raster"),v=null===(c=e.style.map.terrain)||void 0===c?void 0:c.getTerrainData(_);h.activeTexture.set(p.TEXTURE0),p.bindTexture(p.TEXTURE_2D,f.colorAttachment.get());const b=d.getProjectionData({overscaledTileID:_,aligned:g,applyGlobeMatrix:!l,applyTerrainMatrix:!0});m.draw(h,p.TRIANGLES,o,n[_.overscaledZ],a,Ht.backCCW,Hr(e,i,r),v,b,r.id,y.vertexBuffer,y.indexBuffer,y.segments)}}function En(e,r,i,n,o,a,s,l,c){var u;const h=e.style.projection,d=e.context,p=e.transform,f=d.gl,m=e.useProgram("colorRelief"),g=!e.options.moving;let _=!0,y=0;for(const v of n){const n=r.getTile(v),b=n.dem;if(_){const e=f.getParameter(f.MAX_TEXTURE_SIZE),{elevationTexture:t,colorTexture:r}=i.getColorRampTextures(d,e,b.getUnpackVector());d.activeTexture.set(f.TEXTURE1),t.bind(f.NEAREST,f.CLAMP_TO_EDGE),d.activeTexture.set(f.TEXTURE4),r.bind(f.LINEAR,f.CLAMP_TO_EDGE),_=!1,y=t.size[0]}if(!b||!b.data)continue;const x=b.stride,w=b.getPixels();if(d.activeTexture.set(f.TEXTURE0),d.pixelStoreUnpackPremultiplyAlpha.set(!1),n.demTexture=n.demTexture||e.getTileTexture(x),n.demTexture){const e=n.demTexture;e.update(w,{premultiply:!1}),e.bind(f.LINEAR,f.CLAMP_TO_EDGE)}else n.demTexture=new t.T(d,w,f.RGBA,{premultiply:!1}),n.demTexture.bind(f.LINEAR,f.CLAMP_TO_EDGE);const T=h.getMeshFromTileID(d,v.canonical,l,!0,"raster"),S=null===(u=e.style.map.terrain)||void 0===u?void 0:u.getTerrainData(v),E=p.getProjectionData({overscaledTileID:v,aligned:g,applyGlobeMatrix:!c,applyTerrainMatrix:!0});m.draw(d,f.TRIANGLES,a,o[v.overscaledZ],s,Ht.backCCW,Jr(i,n.dem,y),S,E,i.id,T.vertexBuffer,T.indexBuffer,T.segments)}}const In=[new t.P(0,0),new t.P(t.a4,0),new t.P(t.a4,t.a4),new t.P(0,t.a4)];function Pn(e,t,r,i,n,o,a,s,l=!1,c=!1){const u=i[i.length-1].overscaledZ,h=e.context,d=h.gl,p=e.useProgram("raster"),f=e.transform,m=e.style.projection,g=e.colorModeForRenderPass(),_=!e.options.moving,y=r.paint.get("raster-opacity"),v=r.paint.get("raster-resampling"),b=r.paint.get("raster-fade-duration"),x=!!e.style.map.terrain;for(const w of i){const i=e.getDepthModeForSublayer(w.overscaledZ-u,1===y?Xt.ReadWrite:Xt.ReadOnly,d.LESS),T=t.getTile(w),S="nearest"===v?d.NEAREST:d.LINEAR;h.activeTexture.set(d.TEXTURE0),T.texture.bind(S,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST),h.activeTexture.set(d.TEXTURE1);const{parentTile:E,parentScaleBy:I,parentTopLeft:P,fadeValues:k}=kn(T,t,b,x);T.fadeOpacity=k.tileOpacity,E?(E.fadeOpacity=k.parentTileOpacity,E.texture.bind(S,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST)):T.texture.bind(S,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST),T.texture.useMipmap&&h.extTextureFilterAnisotropic&&e.transform.pitch>20&&d.texParameterf(d.TEXTURE_2D,h.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,h.extTextureFilterAnisotropicMax);const A=e.style.map.terrain&&e.style.map.terrain.getTerrainData(w),C=f.getProjectionData({overscaledTileID:w,aligned:_,applyGlobeMatrix:!c,applyTerrainMatrix:!0}),M=oi(P,I,k.fadeMix,r,s),D=m.getMeshFromTileID(h,w.canonical,o,a,"raster");p.draw(h,d.TRIANGLES,i,n?n[w.overscaledZ]:Jt.disabled,g,l?Ht.frontCCW:Ht.backCCW,M,A,C,r.id,D.vertexBuffer,D.indexBuffer,D.segments)}}function kn(e,r,i,n){const o={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(0===i||n)return o;if(e.fadingParentID){const n=r.getLoadedTile(e.fadingParentID);if(!n)return o;const a=Math.pow(2,n.tileID.overscaledZ-e.tileID.overscaledZ),s=[e.tileID.canonical.x*a%1,e.tileID.canonical.y*a%1],l=function(e,r,i){const n=c(),o=(n-r.timeAdded)/i,a=e.fadingDirection===he.Incoming,s=t.an((n-e.timeAdded)/i,0,1),l=t.an(1-o,0,1),u=a?s:l;return{tileOpacity:u,parentTileOpacity:a?l:s,fadeMix:{opacity:1,mix:1-u}}}(e,n,i);return{parentTile:n,parentScaleBy:a,parentTopLeft:s,fadeValues:l}}if(e.selfFading){const r=function(e,r){const i=(c()-e.timeAdded)/r,n=t.an(i,0,1);return{tileOpacity:n,fadeMix:{opacity:n,mix:0}}}(e,i);return{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:r}}return o}const An=new t.bo(1,0,0,1),Cn=new t.bo(0,1,0,1),Mn=new t.bo(0,0,1,1),Dn=new t.bo(1,0,1,1),Rn=new t.bo(0,1,1,1);function Ln(e,t,r,i){On(e,0,t+r/2,e.transform.width,r,i)}function Fn(e,t,r,i){On(e,t-r/2,0,r,e.transform.height,i)}function On(e,t,r,i,n,o){const a=e.context,s=a.gl;s.enable(s.SCISSOR_TEST),s.scissor(t*e.pixelRatio,r*e.pixelRatio,i*e.pixelRatio,n*e.pixelRatio),a.clear({color:o}),s.disable(s.SCISSOR_TEST)}function zn(e,r,i){const n=e.context,o=n.gl,a=e.useProgram("debug"),s=Xt.disabled,l=Jt.disabled,c=e.colorModeForRenderPass(),u="$debug",h=e.style.map.terrain&&e.style.map.terrain.getTerrainData(i);n.activeTexture.set(o.TEXTURE0);const d=r.getTileByID(i.key).latestRawTileData,p=Math.floor((d&&d.byteLength||0)/1024),f=r.getTile(i).tileSize,m=512/Math.min(f,512)*(i.overscaledZ/e.transform.zoom)*.5;let g=i.canonical.toString();i.overscaledZ!==i.canonical.z&&(g+=` => ${i.overscaledZ}`),function(e,t){e.initDebugOverlayCanvas();const r=e.debugOverlayCanvas,i=e.context.gl,n=e.debugOverlayCanvas.getContext("2d");n.clearRect(0,0,r.width,r.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(r),e.debugOverlayTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE)}(e,`${g} ${p}kB`);const _=e.transform.getProjectionData({overscaledTileID:i,applyGlobeMatrix:!0,applyTerrainMatrix:!0});a.draw(n,o.TRIANGLES,s,l,Wt.alphaBlended,Ht.disabled,$r(t.bo.transparent,m),null,_,u,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments),a.draw(n,o.LINE_STRIP,s,l,c,Ht.disabled,$r(t.bo.red),h,_,u,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments)}function Bn(e,t,r,i){const{isRenderingGlobe:n}=i,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 h of r){const r=t.getTerrainMesh(h.tileID),i=e.renderToTexture.getTexture(h),d=t.getTerrainData(h.tileID);o.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,i.texture);const p=t.getMeshFrameDelta(s.zoom),f=s.calculateFogMatrix(h.tileID.toUnwrapped()),m=Dr(p,f,e.style.sky,s.pitch,n),g=s.getProjectionData({overscaledTileID:h.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});u.draw(o,a.TRIANGLES,c,Jt.disabled,l,Ht.backCCW,m,d,g,"terrain",r.vertexBuffer,r.indexBuffer,r.segments)}}function Nn(e,r){if(!r.mesh){const i=new t.aV;i.emplaceBack(-1,-1),i.emplaceBack(1,-1),i.emplaceBack(1,1),i.emplaceBack(-1,1);const n=new t.aX;n.emplaceBack(0,1,2),n.emplaceBack(0,2,3),r.mesh=new At(e.createVertexBuffer(i,Ct.members),e.createIndexBuffer(n),t.aW.simpleSegment(0,0,i.length,n.length))}return r.mesh}class jn{constructor(e,r){this.context=new tn(e),this.transform=r,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:t.ar(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Pe.maxOverzooming+Pe.maxUnderzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Et}resize(e,t,r){if(this.width=Math.floor(e*r),this.height=Math.floor(t*r),this.pixelRatio=r,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const i of this.style._order)this.style._layers[i].resize()}setup(){const e=this.context,r=new t.aV;r.emplaceBack(0,0),r.emplaceBack(t.a4,0),r.emplaceBack(0,t.a4),r.emplaceBack(t.a4,t.a4),this.tileExtentBuffer=e.createVertexBuffer(r,Ct.members),this.tileExtentSegments=t.aW.simpleSegment(0,0,4,2);const i=new t.aV;i.emplaceBack(0,0),i.emplaceBack(t.a4,0),i.emplaceBack(0,t.a4),i.emplaceBack(t.a4,t.a4),this.debugBuffer=e.createVertexBuffer(i,Ct.members),this.debugSegments=t.aW.simpleSegment(0,0,4,5);const n=new t.cg;n.emplaceBack(0,0,0,0),n.emplaceBack(t.a4,0,t.a4,0),n.emplaceBack(0,t.a4,0,t.a4),n.emplaceBack(t.a4,t.a4,t.a4,t.a4),this.rasterBoundsBuffer=e.createVertexBuffer(n,Cr.members),this.rasterBoundsSegments=t.aW.simpleSegment(0,0,4,2);const o=new t.aV;o.emplaceBack(0,0),o.emplaceBack(t.a4,0),o.emplaceBack(0,t.a4),o.emplaceBack(t.a4,t.a4),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(o,Ct.members),this.rasterBoundsSegmentsPosOnly=t.aW.simpleSegment(0,0,4,5);const a=new t.aV;a.emplaceBack(0,0),a.emplaceBack(1,0),a.emplaceBack(0,1),a.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(a,Ct.members),this.viewportSegments=t.aW.simpleSegment(0,0,4,2);const s=new t.ch;s.emplaceBack(0),s.emplaceBack(1),s.emplaceBack(3),s.emplaceBack(2),s.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(s);const l=new t.aX;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(l);const c=this.context.gl;this.stencilClearMode=new Jt({func:c.ALWAYS,mask:0},0,255,c.ZERO,c.ZERO,c.ZERO),this.tileExtentMesh=new At(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){const e=this.context,r=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const i=t.N();t.c6(i,0,this.width,this.height,0,0,1),t.Q(i,i,[r.drawingBufferWidth,r.drawingBufferHeight,0]);const n={mainMatrix:i,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:i};this.useProgram("clippingMask",null,!0).draw(e,r.TRIANGLES,Xt.disabled,this.stencilClearMode,Wt.disabled,Ht.disabled,null,null,n,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,t,r){if(this.currentStencilSource===e.source||!e.isTileClipped()||!t||!t.length)return;this.currentStencilSource=e.source,this.nextStencilID+t.length>256&&this.clearStencil();const i=this.context;i.setColorMode(Wt.disabled),i.setDepthMode(Xt.disabled);const n={};for(const o of t)n[o.key]=this.nextStencilID++;this._renderTileMasks(n,t,r,!0),this._renderTileMasks(n,t,r,!1),this._tileClippingMaskIDs=n}_renderTileMasks(e,t,r,i){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,i,!0,"stencil"),d=s.getProjectionData({overscaledTileID:c,applyGlobeMatrix:!r,applyTerrainMatrix:!0});l.draw(n,o.TRIANGLES,Xt.disabled,new Jt({func:o.ALWAYS,mask:0},t,255,o.KEEP,o.KEEP,o.REPLACE),Wt.disabled,r?Ht.disabled:Ht.backCCW,null,u,d,"$clipping",h.vertexBuffer,h.indexBuffer,h.segments)}}_renderTilesDepthBuffer(){const e=this.context,t=e.gl,r=this.style.projection,i=this.transform,n=this.useProgram("depth"),o=this.getDepthModeFor3D(),a=Ee(i,{tileSize:i.tileSize});for(const s of a){const a=this.style.map.terrain&&this.style.map.terrain.getTerrainData(s),l=r.getMeshFromTileID(this.context,s.canonical,!0,!0,"raster"),c=i.getProjectionData({overscaledTileID:s,applyGlobeMatrix:!0,applyTerrainMatrix:!0});n.draw(e,t.TRIANGLES,o,Jt.disabled,Wt.disabled,Ht.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 Jt({func:t.NOTEQUAL,mask:255},e,255,t.KEEP,t.KEEP,t.REPLACE)}stencilModeForClipping(e){const t=this.context.gl;return new Jt({func:t.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,t.KEEP,t.KEEP,t.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){const t=this.context.gl,r=e.sort((e,t)=>t.overscaledZ-e.overscaledZ),i=r[r.length-1].overscaledZ,n=r[0].overscaledZ-i+1;if(n>1){this.currentStencilSource=void 0,this.nextStencilID+n>256&&this.clearStencil();const e={};for(let r=0;r<n;r++)e[r+i]=new Jt({func:t.GEQUAL,mask:255},r+this.nextStencilID,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID+=n,[e,r]}return[{[i]:Jt.disabled},r]}stencilConfigForOverlapTwoPass(e){const t=this.context.gl,r=e.sort((e,t)=>t.overscaledZ-e.overscaledZ),i=r[r.length-1].overscaledZ,n=r[0].overscaledZ-i+1;if(this.clearStencil(),n>1){const e={},o={};for(let r=0;r<n;r++)e[r+i]=new Jt({func:t.GREATER,mask:255},n+1+r,255,t.KEEP,t.KEEP,t.REPLACE),o[r+i]=new Jt({func:t.GREATER,mask:255},1+r,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID=2*n+1,[e,o,r]}return this.nextStencilID=3,[{[i]:new Jt({func:t.GREATER,mask:255},2,255,t.KEEP,t.KEEP,t.REPLACE)},{[i]:new Jt({func:t.GREATER,mask:255},1,255,t.KEEP,t.KEEP,t.REPLACE)},r]}colorModeForRenderPass(){const e=this.context.gl;if(this._showOverdrawInspector){const r=1/8;return new Wt([e.CONSTANT_COLOR,e.ONE],new t.bo(r,r,r,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?Wt.unblended:Wt.alphaBlended}getDepthModeForSublayer(e,t,r){if(!this.opaquePassEnabledForLayer())return Xt.disabled;const i=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new Xt(r||this.context.gl.LEQUAL,t,[i,i])}getDepthModeFor3D(){return new Xt(this.context.gl.LEQUAL,Xt.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,r){var i,n;this.style=e,this.options=r,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(c()),this.imageManager.beginFrame();const o=this.style._order,a=this.style.tileManagers,s={},l={},u={},h={isRenderingToTexture:!1,isRenderingGlobe:(null===(i=e.projection)||void 0===i?void 0:i.transitionState)>0};for(const t in a){const e=a[t];e.used&&e.prepare(this.context),s[t]=e.getVisibleCoordinates(!1),l[t]=s[t].slice().reverse(),u[t]=e.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let t=0;t<o.length;t++)if(this.style._layers[o[t]].is3D()){this.opaquePassCutoff=t;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const t of o){const e=this.style._layers[t];if(!e.hasOffscreenPass()||e.isHidden(this.transform.zoom))continue;const r=l[e.source];("custom"===e.type||r.length)&&this.renderLayer(this,a[e.source],e,r,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:r.showOverdrawInspector?t.bo.black:t.bo.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(e,t){const r=e.context,i=r.gl,n=((e,t,r)=>{const i=Math.cos(t.rollInRadians),n=Math.sin(t.rollInRadians),o=_e(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)*r,(t.height/2+o*i)*r],u_horizon_normal:[-n,i],u_sky_horizon_blend:e.properties.get("sky-horizon-blend")*t.height/2*r,u_sky_blend:a}})(t,e.style.map.transform,e.pixelRatio),o=new Xt(i.LEQUAL,Xt.ReadWrite,[0,1]),a=Jt.disabled,s=e.colorModeForRenderPass(),l=e.useProgram("sky"),c=Nn(r,t);l.draw(r,i.TRIANGLES,o,a,s,Ht.disabled,n,null,void 0,"sky",c.vertexBuffer,c.indexBuffer,c.segments)}(this,this.style.sky),this._showOverdrawInspector=r.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=a[e.source],r=s[e.source];this._renderTileClippingMasks(e,r,!1),this.renderLayer(this,t,e,r,h)}this.renderPass="translucent";let d=!1;for(this.currentLayer=0;this.currentLayer<o.length;this.currentLayer++){const e=this.style._layers[o[this.currentLayer]],t=a[e.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(e,h))continue;this.opaquePassEnabledForLayer()||d||(d=!0,h.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const r=("symbol"===e.type?u:l)[e.source];this._renderTileClippingMasks(e,s[e.source],!!this.renderToTexture),this.renderLayer(this,t,e,r,h)}if(h.isRenderingGlobe&&function(e,r,i){const n=e.context,o=n.gl,a=e.useProgram("atmosphere"),s=new Xt(o.LEQUAL,Xt.ReadOnly,[0,1]),l=e.transform,c=function(e,r){const i=e.properties.get("position"),n=[-i.x,-i.y,-i.z],o=t.ar(new Float64Array(16));return"map"===e.properties.get("anchor")&&(t.bf(o,o,r.rollInRadians),t.bg(o,o,-r.pitchInRadians),t.bf(o,o,r.bearingInRadians),t.bg(o,o,r.center.lat*Math.PI/180),t.bI(o,o,-r.center.lng*Math.PI/180)),t.cf(n,n,o),n}(i,e.transform),u=l.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),h=r.properties.get("atmosphere-blend")*u.projectionTransition;if(0===h)return;const d=ur(l.worldSize,l.center.lat),p=l.inverseProjectionMatrix,f=new Float64Array(4);f[3]=1,t.aG(f,f,l.modelViewProjectionMatrix),f[0]/=f[3],f[1]/=f[3],f[2]/=f[3],f[3]=1,t.aG(f,f,p),f[0]/=f[3],f[1]/=f[3],f[2]/=f[3],f[3]=1;const m=((e,t,r,i,n)=>({u_sun_pos:e,u_atmosphere_blend:t,u_globe_position:r,u_globe_radius:i,u_inv_proj_matrix:n}))(c,h,[f[0],f[1],f[2]],d,p),g=Nn(n,r);a.draw(n,o.TRIANGLES,s,Jt.disabled,Wt.alphaBlended,Ht.disabled,m,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 r=null;const i=Object.values(e._layers).flatMap(r=>r.source&&!r.isHidden(t)?[e.tileManagers[r.source]]:[]),n=i.filter(e=>"vector"===e.getSource().type),o=i.filter(e=>"vector"!==e.getSource().type),a=e=>{(!r||r.getSource().maxzoom<e.getSource().maxzoom)&&(r=e)};return n.forEach(e=>a(e)),r||o.forEach(e=>a(e)),r}(this.style,this.transform.zoom);e&&function(e,t,r){for(let i=0;i<r.length;i++)zn(e,t,r[i])}(this,e,e.getVisibleCoordinates())}this.options.showPadding&&function(e){const t=e.transform.padding;Ln(e,e.transform.height-(t.top||0),3,An),Ln(e,t.bottom||0,3,Cn),Fn(e,t.left||0,3,Mn),Fn(e,e.transform.width-(t.right||0),3,Dn);const r=e.transform.centerPoint;!function(e,t,r,i){On(e,t-1,r-10,2,20,i),On(e,t-10,r-1,20,2,i)}(e,r.x,e.transform.height-r.y,Rn)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(e){if(!this.style||!this.style.map||!this.style.map.terrain)return;const r=this.terrainFacilitator.matrix,i=this.transform.modelViewProjectionMatrix;let n=this.terrainFacilitator.dirty;n||(n=e?!t.ci(r,i):!t.cj(r,i)),n||(n=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime)),n&&(t.ck(r,i),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(e,r){const i=e.context,n=i.gl,o=e.transform,a=Wt.unblended,s=new Xt(n.LEQUAL,Xt.ReadWrite,[0,1]),l=r.tileManager.getRenderableTiles(),c=e.useProgram("terrainDepth");i.bindFramebuffer.set(r.getFramebuffer("depth").framebuffer),i.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),i.clear({color:t.bo.transparent,depth:1});for(const t of l){const e=r.getTerrainMesh(t.tileID),l=r.getTerrainData(t.tileID),u=o.getProjectionData({overscaledTileID:t.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),h={u_ele_delta:r.getMeshFrameDelta(o.zoom)};c.draw(i,n.TRIANGLES,s,Jt.disabled,a,Ht.backCCW,h,l,u,"terrain",e.vertexBuffer,e.indexBuffer,e.segments)}i.bindFramebuffer.set(null),i.viewport.set([0,0,e.width,e.height])}(this,this.style.map.terrain),function(e,r){const i=e.context,n=i.gl,o=e.transform,a=Wt.unblended,s=new Xt(n.LEQUAL,Xt.ReadWrite,[0,1]),l=r.getCoordsTexture(),c=r.tileManager.getRenderableTiles(),u=e.useProgram("terrainCoords");i.bindFramebuffer.set(r.getFramebuffer("coords").framebuffer),i.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),i.clear({color:t.bo.transparent,depth:1}),r.coordsIndex=[];for(const t of c){const e=r.getTerrainMesh(t.tileID),c=r.getTerrainData(t.tileID);i.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,l.texture);const h={u_terrain_coords_id:(255-r.coordsIndex.length)/255,u_texture:0,u_ele_delta:r.getMeshFrameDelta(o.zoom)},d=o.getProjectionData({overscaledTileID:t.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});u.draw(i,n.TRIANGLES,s,Jt.disabled,a,Ht.backCCW,h,c,d,"terrain",e.vertexBuffer,e.indexBuffer,e.segments),r.coordsIndex.push(t.tileID.key)}i.bindFramebuffer.set(null),i.viewport.set([0,0,e.width,e.height])}(this,this.style.map.terrain))}renderLayer(e,r,i,n,o){i.isHidden(this.transform.zoom)||("background"===i.type||"custom"===i.type||(n||[]).length)&&(this.id=i.id,t.cl(i)?function(e,r,i,n,o,a){if("translucent"!==e.renderPass)return;const{isRenderingToTexture:s}=a,l=Jt.disabled,c=e.colorModeForRenderPass();(i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(e,r,i,n,o,a,s,l,c){const u=r.transform,h=r.style.map.terrain,d="map"===o,p="map"===a;for(const f of e){const e=n.getTile(f),o=e.getBucket(i);if(!o||!o.text||!o.text.segments.get().length)continue;const a=t.ax(o.textSizeData,u.zoom),m=t.aM(e,1,r.transform.zoom),g=Re(d,r.transform,m),_="none"!==i.layout.get("icon-text-fit")&&o.hasIconData();if(a){const r=Math.pow(2,u.zoom-e.tileID.overscaledZ),i=h?(e,t)=>h.getElevation(f,e,t):null;ln(o,d,p,c,u,g,r,a,_,t.aN(u,e,s,l),f.toUnwrapped(),i)}}}(n,e,i,r,i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),o),0!==i.paint.get("icon-opacity").constantOr(1)&&un(e,r,i,n,!1,i.paint.get("icon-translate"),i.paint.get("icon-translate-anchor"),i.layout.get("icon-rotation-alignment"),i.layout.get("icon-pitch-alignment"),i.layout.get("icon-keep-upright"),l,c,s),0!==i.paint.get("text-opacity").constantOr(1)&&un(e,r,i,n,!0,i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),i.layout.get("text-keep-upright"),l,c,s),r.map.showCollisionBoxes&&(nn(e,r,i,n,!0),nn(e,r,i,n,!1))}(e,r,i,n,this.style.placement.variableOffsets,o):t.cm(i)?function(e,r,i,n,o){if("translucent"!==e.renderPass)return;const{isRenderingToTexture:a}=o,s=i.paint.get("circle-opacity"),l=i.paint.get("circle-stroke-width"),c=i.paint.get("circle-stroke-opacity"),u=!i.layout.get("circle-sort-key").isConstant();if(0===s.constantOr(1)&&(0===l.constantOr(1)||0===c.constantOr(1)))return;const h=e.context,d=h.gl,p=e.transform,f=e.getDepthModeForSublayer(0,Xt.ReadOnly),m=Jt.disabled,g=e.colorModeForRenderPass(),_=[],y=p.getCircleRadiusCorrection();for(let v=0;v<n.length;v++){const o=n[v],s=r.getTile(o),l=s.getBucket(i);if(!l)continue;const c=i.paint.get("circle-translate"),h=i.paint.get("circle-translate-anchor"),d=t.aN(p,s,c,h),f=l.programConfigurations.get(i.id),m=e.useProgram("circle",f),g=l.layoutVertexBuffer,b=l.indexBuffer,x=e.style.map.terrain&&e.style.map.terrain.getTerrainData(o),w={programConfiguration:f,program:m,layoutVertexBuffer:g,indexBuffer:b,uniformValues:Ur(e,s,i,d,y),terrainData:x,projectionData:p.getProjectionData({overscaledTileID:o,applyGlobeMatrix:!a,applyTerrainMatrix:!0})};if(u){const e=l.segments.get();for(const r of e)_.push({segments:new t.aW([r]),sortKey:r.sortKey,state:w})}else _.push({segments:l.segments,sortKey:0,state:w})}u&&_.sort((e,t)=>e.sortKey-t.sortKey);for(const t of _){const{programConfiguration:r,program:n,layoutVertexBuffer:o,indexBuffer:a,uniformValues:s,terrainData:l,projectionData:c}=t.state;n.draw(h,d.TRIANGLES,f,m,g,Ht.backCCW,s,l,c,i.id,o,a,t.segments,i.paint,e.transform.zoom,r)}}(e,r,i,n,o):t.cn(i)?function(e,r,i,n,o){if(0===i.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=r.getTile(t);r.hasRenderableParent(t)||("offscreen"===e.renderPass?dn(e,n,i,t,l):"translucent"===e.renderPass&&pn(e,i,t,s,l))}a.viewport.set([0,0,e.width,e.height])}else"offscreen"===e.renderPass?function(e,r,i,n){const o=e.context,a=o.gl,s=e.transform,l=Jt.disabled,c=new Wt([a.ONE,a.ONE],t.bo.transparent,[!0,!0,!0,!0]);(function(e,r,i){const n=e.gl;e.activeTexture.set(n.TEXTURE1),e.viewport.set([0,0,r.width/4,r.height/4]);let o=i.heatmapFbos.get(t.cc);o?(n.bindTexture(n.TEXTURE_2D,o.colorAttachment.get()),e.bindFramebuffer.set(o.framebuffer)):(o=fn(e,r.width/4,r.height/4),i.heatmapFbos.set(t.cc,o))})(o,e,i),o.clear({color:t.bo.transparent});for(let t=0;t<n.length;t++){const u=n[t];if(r.hasRenderableParent(u))continue;const h=r.getTile(u),d=h.getBucket(i);if(!d)continue;const p=d.programConfigurations.get(i.id),f=e.useProgram("heatmap",p),m=s.getProjectionData({overscaledTileID:u,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),g=s.getCircleRadiusCorrection();f.draw(o,a.TRIANGLES,Xt.disabled,l,c,Ht.backCCW,Wr(h,s.zoom,i.paint.get("heatmap-intensity"),g),null,m,i.id,d.layoutVertexBuffer,d.indexBuffer,d.segments,i.paint,s.zoom,p)}o.viewport.set([0,0,e.width,e.height])}(e,r,i,n):"translucent"===e.renderPass&&function(e,r){const i=e.context,n=i.gl;i.setColorMode(e.colorModeForRenderPass());const o=r.heatmapFbos.get(t.cc);o&&(i.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,o.colorAttachment.get()),i.activeTexture.set(n.TEXTURE1),mn(i,r).bind(n.LINEAR,n.CLAMP_TO_EDGE),e.useProgram("heatmapTexture").draw(i,n.TRIANGLES,Xt.disabled,Jt.disabled,e.colorModeForRenderPass(),Ht.disabled,Zr(e,r,0,1),null,null,r.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,r.paint,e.transform.zoom))}(e,i)}(e,r,i,n,o):t.co(i)?function(e,t,r,i,n){if("translucent"!==e.renderPass)return;const{isRenderingToTexture:o}=n,a=r.paint.get("line-opacity"),s=r.paint.get("line-width");if(0===a.constantOr(1)||0===s.constantOr(1))return;const l=e.getDepthModeForSublayer(0,Xt.ReadOnly),c=e.colorModeForRenderPass(),u=r.paint.get("line-dasharray"),h=u.constantOr(1),d=r.paint.get("line-pattern"),p=d.constantOr(1),f=r.paint.get("line-gradient"),m=r.getCrossfadeParameters();let g;g=p?"linePattern":h&&f?"lineGradientSDF":h?"lineSDF":f?"lineGradient":"line";const _=e.context,y=_.gl,v=e.transform;let b=!0;for(const x of i){const i=t.getTile(x);if(p&&!i.patternsLoaded())continue;const n=i.getBucket(r);if(!n)continue;const a=n.programConfigurations.get(r.id),s=e.context.program.get(),w=e.useProgram(g,a),T=b||w.program!==s,S=e.style.map.terrain&&e.style.map.terrain.getTerrainData(x),E=d.constantOr(null),I=u&&u.constantOr(null);if(E&&i.imageAtlas){const e=i.imageAtlas,t=e.patternPositions[E.to.toString()],r=e.patternPositions[E.from.toString()];t&&r&&a.setConstantPatternPositions(t,r)}else if(I){const t="round"===r.layout.get("line-cap"),i=e.lineAtlas.getDash(I.to,t),n=e.lineAtlas.getDash(I.from,t);a.setConstantDashPositions(i,n)}const P=v.getProjectionData({overscaledTileID:x,applyGlobeMatrix:!o,applyTerrainMatrix:!0}),k=v.getPixelScale();let A;p?(A=ei(e,i,r,k,m),_n(_,y,i,a,m)):h&&f?(A=ri(e,i,r,k,m,n.lineClipsArray.length),bn(e,t,_,y,r,n,x,a,m)):h?(A=ti(e,i,r,k,m),yn(e,_,y,a,T,m)):f?(A=Qr(e,i,r,k,n.lineClipsArray.length),vn(e,t,_,y,r,n,x)):A=Kr(e,i,r,k);const C=e.stencilModeForClipping(x);w.draw(_,y.TRIANGLES,l,C,c,Ht.disabled,A,S,P,r.id,n.layoutVertexBuffer,n.indexBuffer,n.segments,r.paint,e.transform.zoom,a,n.layoutVertexBuffer2),b=!1}}(e,r,i,n,o):t.cp(i)?function(e,r,i,n,o){const a=i.paint.get("fill-color"),s=i.paint.get("fill-opacity");if(0===s.constantOr(1))return;const{isRenderingToTexture:l}=o,c=e.colorModeForRenderPass(),u=i.paint.get("fill-pattern"),h=e.opaquePassEnabledForLayer()&&!u.constantOr(1)&&1===a.constantOr(t.bo.transparent).a&&1===s.constantOr(0)?"opaque":"translucent";if(e.renderPass===h){const t=e.getDepthModeForSublayer(1,"opaque"===e.renderPass?Xt.ReadWrite:Xt.ReadOnly);wn(e,r,i,n,t,c,!1,l)}if("translucent"===e.renderPass&&i.paint.get("fill-antialias")){const t=e.getDepthModeForSublayer(i.getPaintProperty("fill-outline-color")?2:0,Xt.ReadOnly);wn(e,r,i,n,t,c,!0,l)}}(e,r,i,n,o):t.cq(i)?function(e,t,r,i,n){const o=r.paint.get("fill-extrusion-opacity");if(0===o)return;const{isRenderingToTexture:a}=n;if("translucent"===e.renderPass){const n=new Xt(e.context.gl.LEQUAL,Xt.ReadWrite,e.depthRangeFor3D);if(1!==o||r.paint.get("fill-extrusion-pattern").constantOr(1))Tn(e,t,r,i,n,Jt.disabled,Wt.disabled,a),Tn(e,t,r,i,n,e.stencilModeFor3D(),e.colorModeForRenderPass(),a);else{const o=e.colorModeForRenderPass();Tn(e,t,r,i,n,Jt.disabled,o,a)}}}(e,r,i,n,o):t.cr(i)?function(e,r,i,n,o){if("offscreen"!==e.renderPass&&"translucent"!==e.renderPass)return;const{isRenderingToTexture:a}=o,s=e.context,l=e.style.projection.useSubdivision,c=e.getDepthModeForSublayer(0,Xt.ReadOnly),u=e.colorModeForRenderPass();if("offscreen"===e.renderPass)!function(e,r,i,n,o,a,s){const l=e.context,c=l.gl;for(const u of i){const i=r.getTile(u),h=i.dem;if(!h||!h.data)continue;if(!i.needsHillshadePrepare)continue;const d=h.dim,p=h.stride,f=h.getPixels();if(l.activeTexture.set(c.TEXTURE1),l.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||e.getTileTexture(p),i.demTexture){const e=i.demTexture;e.update(f,{premultiply:!1}),e.bind(c.NEAREST,c.CLAMP_TO_EDGE)}else i.demTexture=new t.T(l,f,c.RGBA,{premultiply:!1}),i.demTexture.bind(c.NEAREST,c.CLAMP_TO_EDGE);l.activeTexture.set(c.TEXTURE0);let m=i.fbo;if(!m){const e=new t.T(l,{width:d,height:d,data:null},c.RGBA);e.bind(c.LINEAR,c.CLAMP_TO_EDGE),m=i.fbo=l.createFramebuffer(d,d,!0,!1),m.colorAttachment.set(e.texture)}l.bindFramebuffer.set(m.framebuffer),l.viewport.set([0,0,d,d]),e.useProgram("hillshadePrepare").draw(l,c.TRIANGLES,o,a,s,Ht.disabled,Xr(i.tileID,h),null,null,n.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),i.needsHillshadePrepare=!1}}(e,r,n,i,c,Jt.disabled,u),s.viewport.set([0,0,e.width,e.height]);else if("translucent"===e.renderPass)if(l){const[t,o,s]=e.stencilConfigForOverlapTwoPass(n);Sn(e,r,i,s,t,c,u,!1,a),Sn(e,r,i,s,o,c,u,!0,a)}else{const[t,o]=e.getStencilConfigForOverlapAndUpdateStencilID(n);Sn(e,r,i,o,t,c,u,!1,a)}}(e,r,i,n,o):t.cs(i)?function(e,t,r,i,n){if("translucent"!==e.renderPass)return;if(!i.length)return;const{isRenderingToTexture:o}=n,a=e.style.projection.useSubdivision,s=e.getDepthModeForSublayer(0,Xt.ReadOnly),l=e.colorModeForRenderPass();if(a){const[n,a,c]=e.stencilConfigForOverlapTwoPass(i);En(e,t,r,c,n,s,l,!1,o),En(e,t,r,c,a,s,l,!0,o)}else{const[n,a]=e.getStencilConfigForOverlapAndUpdateStencilID(i);En(e,t,r,a,n,s,l,!1,o)}}(e,r,i,n,o):t.bT(i)?function(e,t,r,i,n){if("translucent"!==e.renderPass)return;if(0===r.paint.get("raster-opacity"))return;if(!i.length)return;const{isRenderingToTexture:o}=n,a=t.getSource(),s=e.style.projection.useSubdivision;if(a instanceof te)Pn(e,t,r,i,null,!1,!1,a.tileCoords,a.flippedWindingOrder,o);else if(s){const[n,a,s]=e.stencilConfigForOverlapTwoPass(i);Pn(e,t,r,s,n,!1,!0,In,!1,o),Pn(e,t,r,s,a,!0,!0,In,!1,o)}else{const[n,a]=e.getStencilConfigForOverlapAndUpdateStencilID(i);Pn(e,t,r,a,n,!1,!0,In,!1,o)}}(e,r,i,n,o):t.ct(i)?function(e,t,r,i,n){const o=r.paint.get("background-color"),a=r.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,d=h.tileSize,p=r.paint.get("background-pattern");if(e.isPatternMissing(p))return;const f=!p&&1===o.a&&1===a&&e.opaquePassEnabledForLayer()?"opaque":"translucent";if(e.renderPass!==f)return;const m=Jt.disabled,g=e.getDepthModeForSublayer(0,"opaque"===f?Xt.ReadWrite:Xt.ReadOnly),_=e.colorModeForRenderPass(),y=e.useProgram(p?"backgroundPattern":"background"),v=i||Ee(h,{tileSize:d,terrain:e.style.map.terrain});p&&(l.activeTexture.set(c.TEXTURE0),e.imageManager.bind(e.context));const b=r.getCrossfadeParameters();for(const x of v){const t=h.getProjectionData({overscaledTileID:x,applyGlobeMatrix:!s,applyTerrainMatrix:!0}),i=p?hi(a,e,p,{tileID:x,tileSize:d},b):ui(a,o),n=e.style.map.terrain&&e.style.map.terrain.getTerrainData(x),f=u.getMeshFromTileID(l,x.canonical,!1,!0,"raster");y.draw(l,c.TRIANGLES,g,m,_,Ht.backCCW,i,n,t,r.id,f.vertexBuffer,f.indexBuffer,f.segments)}}(e,0,i,n,o):t.cu(i)&&function(e,t,r,i){const{isRenderingGlobe:n}=i,o=e.context,a=r.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(Jt.disabled);const t="3d"===h?e.getDepthModeFor3D():e.getDepthModeForSublayer(0,Xt.ReadOnly);o.setDepthMode(t),a.render(o.gl,u),o.setDirty(),e.setBaseState(),o.bindFramebuffer.set(null)}}(e,0,i,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()),r=this.imageManager.getPattern(e.to.toString());return!t||!r}useProgram(e,t,r=!1,i=[]){this.cache=this.cache||{};const n=!!this.style.map.terrain,o=this.style.projection,a=r?Pt.projectionMercator:o.shaderPreludeCode,s=r?Mt:o.shaderDefine,l=e+(t?t.cacheKey:"")+`/${r?Dt:o.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(n?"/terrain":"")+(i?`/${i.join("/")}`:"");return this.cache[l]||(this.cache[l]=new Fr(this.context,Pt[e],t,pi[e],this._showOverdrawInspector,n,a,s,i)),this.cache[l]}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 t.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){var e,t;if(this._tileTextures){for(const e in this._tileTextures){const t=this._tileTextures[e];if(t)for(const e of t)e.destroy()}this._tileTextures={}}if(this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&(null===(e=this.tileExtentMesh.vertexBuffer)||void 0===e||e.destroy()),this.tileExtentMesh&&(null===(t=this.tileExtentMesh.indexBuffer)||void 0===t||t.destroy()),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.cache){for(const e in this.cache){const t=this.cache[e];t&&t.program&&this.context.gl.deleteProgram(t.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){const{drawingBufferWidth:e,drawingBufferHeight:t}=this.context.gl;return this.width!==e||this.height!==t}}function Vn(e,t){let r,i=!1,n=null,o=null;const a=()=>{n=null,i&&(e.apply(o,r),n=setTimeout(a,t),i=!1)};return(...e)=>(i=!0,o=this,r=e,n||a(),n)}class Un{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 r=t;r.split("&").length>0&&(r=r.split("&")[0]),this._hashName&&(r=`${this._hashName}=${t}`);let i=window.location.hash.replace(r,"");i.startsWith("#&")?i=i.slice(0,1)+i.slice(2):"#"===i&&(i="");let n=window.location.href.replace(/(#.+)?$/,i);n=n.replace("&&","&"),window.history.replaceState(window.history.state,null,n)},this._updateHash=Vn(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(),r=Math.round(100*this._map.getZoom())/100,i=Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),n=Math.pow(10,i),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}/${r}`:`${r}/${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 r=window.location.hash.slice(1).split("&").map(r=>{const i=r.split("=")[0];return i===e?(t=!0,`${i}=${c}`):r}).filter(e=>e);return t||r.push(`${e}=${c}`),`#${r.join("&")}`}return`#${c}`}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new t.V(+e[2],+e[1])}catch(e){return!1}const r=+e[0],i=+(e[3]||0),n=+(e[4]||0);return r>=this._map.getMinZoom()&&r<=this._map.getMaxZoom()&&i>=-180&&i<=180&&n>=this._map.getMinPitch()&&n<=this._map.getMaxPitch()}}const Gn={linearity:.3,easing:t.cv(0,0,.3,1)},qn=t.e({deceleration:2500,maxSpeed:1400},Gn),$n=t.e({deceleration:20,maxSpeed:1400},Gn),Wn=t.e({deceleration:1e3,maxSpeed:360},Gn),Zn=t.e({deceleration:1e3,maxSpeed:90},Gn),Hn=t.e({deceleration:1e3,maxSpeed:360},Gn);class Xn{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:c(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,t=c();for(;e.length>0&&t-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const r={zoom:0,bearing:0,pitch:0,roll:0,pan:new t.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:t}of this._inertiaBuffer)r.zoom+=t.zoomDelta||0,r.bearing+=t.bearingDelta||0,r.pitch+=t.pitchDelta||0,r.roll+=t.rollDelta||0,t.panDelta&&r.pan._add(t.panDelta),t.around&&(r.around=t.around),t.pinchAround&&(r.pinchAround=t.pinchAround);const i=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,n={};if(r.pan.mag()){const o=Jn(r.pan.mag(),i,t.e({},qn,e||{})),a=r.pan.mult(o.amount/r.pan.mag()),s=this._map.cameraHelper.handlePanInertia(a,this._map.transform);n.center=s.easingCenter,n.offset=s.easingOffset,Yn(n,o)}if(r.zoom){const e=Jn(r.zoom,i,$n);n.zoom=this._map.transform.zoom+e.amount,Yn(n,e)}if(r.bearing){const e=Jn(r.bearing,i,Wn);n.bearing=this._map.transform.bearing+t.an(e.amount,-179,179),Yn(n,e)}if(r.pitch){const e=Jn(r.pitch,i,Zn);n.pitch=this._map.transform.pitch+e.amount,Yn(n,e)}if(r.roll){const e=Jn(r.roll,i,Hn);n.roll=this._map.transform.roll+t.an(e.amount,-179,179),Yn(n,e)}if(n.zoom||n.bearing){const e=void 0===r.pinchAround?r.around:r.pinchAround;n.around=e?this._map.unproject(e):this._map.getCenter()}return this.clear(),t.e(n,{noMoveStart:!0})}}function Yn(e,t){(!e.duration||e.duration<t.duration)&&(e.duration=t.duration,e.easing=t.easing)}function Jn(e,r,i){const{maxSpeed:n,linearity:o,deceleration:a}=i,s=t.an(e*o/(r/1e3),-n,n),l=Math.abs(s)/(a*o);return{easing:i.easing,duration:1e3*l,amount:s*(l/2)}}class Kn extends t.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,r,i,n={}){i=i instanceof MouseEvent?i:new MouseEvent(e,i);const o=u.mousePos(r.getCanvas(),i),a=r.unproject(o);super(e,t.e({point:o,lngLat:a,originalEvent:i},n)),this._defaultPrevented=!1,this.target=r}}class Qn extends t.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,r,i){const n="touchend"===e?i.changedTouches:i.touches,o=u.touchPos(r.getCanvasContainer(),n),a=o.map(e=>r.unproject(e)),s=o.reduce((e,t,r,i)=>e.add(t.div(i.length)),new t.P(0,0));super(e,{points:o,point:s,lngLats:a,lngLat:r.unproject(s),originalEvent:i}),this._defaultPrevented=!1}}class eo extends t.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,r){super(e,{originalEvent:r}),this._defaultPrevented=!1}}class to{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new eo(e.type,this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new Kn(e.type,this._map,e))}mouseup(e){this._map.fire(new Kn(e.type,this._map,e))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||this._map.fire(new Kn(e.type,this._map,e))}dblclick(e){return this._firePreventable(new Kn(e.type,this._map,e))}mouseover(e){this._map.fire(new Kn(e.type,this._map,e))}mouseout(e){this._map.fire(new Kn(e.type,this._map,e))}touchstart(e){return this._firePreventable(new Qn(e.type,this._map,e))}touchmove(e){this._map.fire(new Qn(e.type,this._map,e))}touchend(e){this._map.fire(new Qn(e.type,this._map,e))}touchcancel(e){this._map.fire(new Qn(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ro{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new Kn(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Kn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new Kn(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class io{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 no{constructor(e,t){this._map=e,this._tr=new io(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&0===e.button&&(u.disableDrag(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;const r=t;if(this._lastPos.equals(r)||!this._box&&r.dist(this._startPos)<this._clickTolerance)return;const i=this._startPos;this._lastPos=r,this._box||(this._box=u.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));const n=Math.min(i.x,r.x),o=Math.max(i.x,r.x),a=Math.min(i.y,r.y),s=Math.max(i.y,r.y);u.setTransform(this._box,`translate(${n}px,${a}px)`),this._box.style.width=o-n+"px",this._box.style.height=s-a+"px"}mouseupWindow(e,r){if(!this._active)return;if(0!==e.button)return;const i=this._startPos,n=r;if(this.reset(),u.suppressClick(),i.x!==n.x||i.y!==n.y)return this._map.fire(new t.l("boxzoomend",{originalEvent:e})),{cameraAnimation:e=>e.fitScreenCoordinates(i,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&&(u.remove(this._box),this._box=null),u.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,r){return this._map.fire(new t.l(e,{originalEvent:r}))}}function oo(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 r={};for(let i=0;i<e.length;i++)r[e[i].identifier]=t[i];return r}class ao{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,r,i){(this.centroid||i.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=e.timeStamp),i.length===this.numTouches&&(this.centroid=function(e){const r=new t.P(0,0);for(const t of e)r._add(t);return r.div(e.length)}(r),this.touches=oo(i,r)))}touchmove(e,t,r){if(this.aborted||!this.centroid)return;const i=oo(r,t);for(const n in this.touches){const e=i[n];(!e||e.dist(this.touches[n])>30)&&(this.aborted=!0)}}touchend(e,t,r){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),0===r.length){const e=!this.aborted&&this.centroid;if(this.reset(),e)return e}}}class so{constructor(e){this.singleTap=new ao(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,t,r){this.singleTap.touchstart(e,t,r)}touchmove(e,t,r){this.singleTap.touchmove(e,t,r)}touchend(e,t,r){const i=this.singleTap.touchend(e,t,r);if(i){const t=e.timeStamp-this.lastTime<500,r=!this.lastTap||this.lastTap.dist(i)<30;if(t&&r||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=i,this.count===this.numTaps)return this.reset(),i}}}class lo{constructor(e){this._tr=new io(e),this._zoomIn=new so({numTouches:1,numTaps:2}),this._zoomOut=new so({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,r){this._zoomIn.touchstart(e,t,r),this._zoomOut.touchstart(e,t,r)}touchmove(e,t,r){this._zoomIn.touchmove(e,t,r),this._zoomOut.touchmove(e,t,r)}touchend(e,t,r){const i=this._zoomIn.touchend(e,t,r),n=this._zoomOut.touchend(e,t,r),o=this._tr;return i?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:o.zoom+1,around:o.unproject(i)},{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 co{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 r=this._lastPoint;if(!r)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);const i=Array.isArray(t)?t[0]:t;return!this._moved&&i.dist(r)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=i,this._move(r,i))}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&u.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 uo=0,ho=2,po={[uo]:1,[ho]:2};class fo{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){const t=u.mouseButton(e);this._eventButton=t}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(e,t){const r=po[t];return void 0===e.buttons||(e.buttons&r)!==r}(e,this._eventButton)}isValidEndEvent(e){return u.mouseButton(e)===this._eventButton}}class mo{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 go{constructor(e=new fo({checkCorrectEvent:()=>!0}),t=new mo){this.mouseMoveStateManager=e,this.oneFingerTouchMoveStateManager=t}_executeRelevantHandler(e,t,r){return e instanceof MouseEvent?t(e):"undefined"!=typeof TouchEvent&&e instanceof TouchEvent?r(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 _o=e=>{e.mousedown=e.dragStart,e.mousemoveWindow=e.dragMove,e.mouseup=e.dragEnd,e.contextmenu=e=>{e.preventDefault()}};class yo{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,r){return this._calculateTransform(e,t,r)}touchmove(e,t,r){if(this._active){if(!this._shouldBePrevented(r.length))return e.preventDefault(),this._calculateTransform(e,t,r);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,t,r){this._calculateTransform(e,t,r),this._active&&this._shouldBePrevented(r.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,r,i){i.length>0&&(this._active=!0);const n=oo(i,r),o=new t.P(0,0),a=new t.P(0,0);let s=0;for(const t in n){const e=n[t],r=this._touches[t];r&&(o._add(e),a._add(e.sub(r)),s++,n[t]=e)}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 vo{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,t,r){this._firstTwoTouches||r.length<2||(this._firstTwoTouches=[r[0].identifier,r[1].identifier],this._start([t[0],t[1]]))}touchmove(e,t,r){if(!this._firstTwoTouches)return;e.preventDefault();const[i,n]=this._firstTwoTouches,o=bo(r,t,i),a=bo(r,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,r){if(!this._firstTwoTouches)return;const[i,n]=this._firstTwoTouches,o=bo(r,t,i),a=bo(r,t,n);o&&a||(this._active&&u.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 bo(e,t,r){for(let i=0;i<e.length;i++)if(e[i].identifier===r)return t[i]}function xo(e,t){return Math.log(e/t)/Math.LN2}class wo extends vo{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,t){const r=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(xo(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:xo(this._distance,r),pinchAround:t}}}function To(e,t){return 180*e.angleWith(t)/Math.PI}class So extends vo{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,r){const i=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:To(this._vector,i),pinchAround:t}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const t=25/(Math.PI*this._minDiameter)*360,r=To(e,this._startVector);return Math.abs(r)<t}}function Eo(e){return Math.abs(e.y)>Math.abs(e.x)}class Io extends vo{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,r){super.touchstart(e,t,r),this._currentTouchCount=r.length}_start(e){this._lastPoints=e,Eo(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,t,r){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const i=e[0].sub(this._lastPoints[0]),n=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(i,n,r.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(i.y+n.y)/2*-.5}):void 0}gestureBeginsVertically(e,t,r){if(void 0!==this._valid)return this._valid;const i=e.mag()>=2,n=t.mag()>=2;if(!i&&!n)return;if(!i||!n)return void 0===this._firstMove&&(this._firstMove=r),r-this._firstMove<100&&void 0;const o=e.y>0==t.y>0;return Eo(e)&&Eo(t)&&o}}const Po={panStep:100,bearingStep:15,pitchStep:10};class ko{constructor(e){this._tr=new io(e);const t=Po;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,r=0,i=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?r=-1:(e.preventDefault(),n=-1);break;case 39:e.shiftKey?r=1:(e.preventDefault(),n=1);break;case 38:e.shiftKey?i=1:(e.preventDefault(),o=-1);break;case 40:e.shiftKey?i=-1:(e.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(r=0,i=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+r*this._bearingStep,pitch:s.pitch+i*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 Co=4.000244140625,Mo=1/450;class Do{constructor(e,t){this._onTimeout=e=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)},this._map=e,this._tr=new io(e),this._triggerRenderFrame=t,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=Mo}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 r=c(),i=r-(this._lastWheelEventTime||0);this._lastWheelEventTime=r,0!==t&&t%Co==0?this._type="wheel":0!==t&&Math.abs(t)<4?this._type="trackpad":i>400?(this._type=null,this._lastValue=t,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(i*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 r=u.mousePos(this._map.getCanvas(),e),i=this._tr;this._aroundPoint=this._aroundCenter?i.transform.locationToScreenPoint(t.V.convert(i.center)):r,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 r="wheel"===this._type&&Math.abs(this._delta)>Co?this._wheelZoomRate:this._defaultZoomRate;let i=2/(1+Math.exp(-Math.abs(this._delta*r)));this._delta<0&&0!==i&&(i=1/i);const n="number"!=typeof this._targetZoom?e.scale:t.aq(this._targetZoom);this._targetZoom=e.applyConstrain(e.getCameraLngLat(),t.at(n*i)).zoom,"wheel"===this._type&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const r="number"!=typeof this._targetZoom?e.zoom:this._targetZoom,i=this._startZoom,n=this._easing;let o,a=!1;if("wheel"===this._type&&i&&n){const e=c()-this._lastWheelEventTime,s=Math.min((e+5)/200,1),l=n(s);o=t.G.number(i,r,l),s<1?this._frameId||(this._frameId=!0):a=!0}else o=r,a=!0;return this._active=!0,a&&(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:!a,zoomDelta:o-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let r=t.cx;if(this._prevEase){const e=this._prevEase,i=(c()-e.start)/e.duration,n=e.easing(i+.01)-e.easing(i),o=.27/Math.sqrt(n*n+1e-4)*.01,a=Math.sqrt(.0729-o*o);r=t.cv(o,a,.25,1)}return this._prevEase={start:c(),duration:e,easing:r},r}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Ro{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 Lo{constructor(e){this._tr=new io(e),this.reset()}reset(){this._active=!1}dblclick(e,t){return e.preventDefault(),{cameraAnimation:r=>{r.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 Fo{constructor(){this._tap=new so({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,r){if(!this._swipePoint)if(this._tapTime){const i=t[0],n=e.timeStamp-this._tapTime<500,o=this._tapPoint.dist(i)<30;n&&o?r.length>0&&(this._swipePoint=i,this._swipeTouch=r[0].identifier):this.reset()}else this._tap.touchstart(e,t,r)}touchmove(e,t,r){if(this._tapTime){if(this._swipePoint){if(r[0].identifier!==this._swipeTouch)return;const i=t[0],n=i.y-this._swipePoint.y;return this._swipePoint=i,e.preventDefault(),this._active=!0,{zoomDelta:n/128}}}else this._tap.touchmove(e,t,r)}touchend(e,t,r){if(this._tapTime)this._swipePoint&&0===r.length&&this.reset();else{const i=this._tap.touchend(e,t,r);i&&(this._tapTime=e.timeStamp,this._tapPoint=i)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Oo{constructor(e,t,r){this._el=e,this._mousePan=t,this._touchPan=r}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 zo{constructor(e,t,r,i){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=t,this._mousePitch=r,this._mouseRoll=i}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 Bo{constructor(e,t,r,i){this._el=e,this._touchZoom=t,this._touchRotate=r,this._tapDragZoom=i,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 No{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=u.create("div","maplibregl-cooperative-gesture-screen",e);let t=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");"metaKey"===this._bypassKey&&(t=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const r=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),i=document.createElement("div");i.className="maplibregl-desktop-message",i.textContent=t,this._container.appendChild(i);const n=document.createElement("div");n.className="maplibregl-mobile-message",n.textContent=r,this._container.appendChild(n),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(u.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,r){this._enabled&&(this._map.fire(new t.l("cooperativegestureprevented",{gestureType:e,originalEvent:r})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const jo=e=>e.zoom||e.drag||e.roll||e.pitch||e.rotate;class Vo extends t.l{}function Uo(e){return e.panDelta&&e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta||e.rollDelta}class Go{constructor(e,r){this.handleWindowEvent=e=>{this.handleEvent(e,`${e.type}Window`)},this.handleEvent=(e,r)=>{if("blur"===e.type)return void this.stop(!0);this._updatingCamera=!0;const i="renderFrame"===e.type?void 0:e,n={needsRenderFrame:!1},o={},a={};for(const{handlerName:c,handler:h,allowed:d}of this._handlers){if(!h.isEnabled())continue;let s;if(this._blockedByActive(a,d,c))h.reset();else if(h[r||e.type]){if(t.cy(e,r||e.type)){const t=u.mousePos(this._map.getCanvas(),e);s=h[r||e.type](e,t)}else if(t.cz(e,r||e.type)){const t=this._getMapTouches(e.touches),i=u.touchPos(this._map.getCanvas(),t);s=h[r||e.type](e,i,t)}else t.cA(r||e.type)||(s=h[r||e.type](e));this.mergeHandlerResult(n,o,s,c,i),s&&s.needsRenderFrame&&this._triggerRenderFrame()}(s||h.isActive())&&(a[c]=h)}const s={};for(const t in this._previousActiveHandlers)a[t]||(s[t]=i);this._previousActiveHandlers=a,(Object.keys(s).length||Uo(n))&&(this._changes.push([n,o,s]),this._triggerRenderFrame()),(Object.keys(a).length||Uo(n))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:l}=n;l&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],l(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Xn(e),this._bearingSnap=r.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(r);const i=this._el;this._listeners=[[i,"touchstart",{passive:!0}],[i,"touchmove",{passive:!1}],[i,"touchend",void 0],[i,"touchcancel",void 0],[i,"mousedown",void 0],[i,"mousemove",void 0],[i,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[i,"mouseover",void 0],[i,"mouseout",void 0],[i,"dblclick",void 0],[i,"click",void 0],[i,"keydown",{capture:!1}],[i,"keyup",void 0],[i,"wheel",{passive:!1}],[i,"contextmenu",void 0],[window,"blur",void 0]];for(const[t,n,o]of this._listeners)u.addEventListener(t,n,t===document?this.handleWindowEvent:this.handleEvent,o)}destroy(){for(const[e,t,r]of this._listeners)u.removeEventListener(e,t,e===document?this.handleWindowEvent:this.handleEvent,r)}_addDefaultHandlers(e){const r=this._map,i=r.getCanvasContainer();this._add("mapEvent",new to(r,e));const n=r.boxZoom=new no(r,e);this._add("boxZoom",n),e.interactive&&e.boxZoom&&n.enable();const o=r.cooperativeGestures=new No(r,e.cooperativeGestures);this._add("cooperativeGestures",o),e.cooperativeGestures&&o.enable();const a=new lo(r),s=new Lo(r);r.doubleClickZoom=new Ro(s,a),this._add("tapZoom",a),this._add("clickZoom",s),e.interactive&&e.doubleClickZoom&&r.doubleClickZoom.enable();const l=new Fo;this._add("tapDragZoom",l);const c=r.touchPitch=new Io(r);this._add("touchPitch",c),e.interactive&&e.touchPitch&&r.touchPitch.enable(e.touchPitch);const h=()=>r.project(r.getCenter()),d=function({enable:e,clickTolerance:r,aroundCenter:i=!0,minPixelCenterThreshold:n=100,rotateDegreesPerPixelMoved:o=.8},a){const s=new fo({checkCorrectEvent:e=>0===u.mouseButton(e)&&e.ctrlKey||2===u.mouseButton(e)&&!e.ctrlKey});return new co({clickTolerance:r,move:(e,r)=>{const s=a();if(i&&Math.abs(s.y-e.y)>n)return{bearingDelta:t.cw(new t.P(e.x,r.y),r,s)};let l=(r.x-e.x)*o;return i&&r.y<s.y&&(l=-l),{bearingDelta:l}},moveStateManager:s,enable:e,assignEvents:_o})}(e,h),p=function({enable:e,clickTolerance:t,pitchDegreesPerPixelMoved:r=-.5}){const i=new fo({checkCorrectEvent:e=>0===u.mouseButton(e)&&e.ctrlKey||2===u.mouseButton(e)});return new co({clickTolerance:t,move:(e,t)=>({pitchDelta:(t.y-e.y)*r}),moveStateManager:i,enable:e,assignEvents:_o})}(e),f=function({enable:e,clickTolerance:t,rollDegreesPerPixelMoved:r=.3},i){const n=new fo({checkCorrectEvent:e=>2===u.mouseButton(e)&&e.ctrlKey});return new co({clickTolerance:t,move:(e,t)=>{const n=i();let o=(t.x-e.x)*r;return t.y<n.y&&(o=-o),{rollDelta:o}},moveStateManager:n,enable:e,assignEvents:_o})}(e,h);r.dragRotate=new zo(e,d,p,f),this._add("mouseRotate",d,["mousePitch"]),this._add("mousePitch",p,["mouseRotate","mouseRoll"]),this._add("mouseRoll",f,["mousePitch"]),e.interactive&&e.dragRotate&&r.dragRotate.enable();const m=function({enable:e,clickTolerance:t}){const r=new fo({checkCorrectEvent:e=>0===u.mouseButton(e)&&!e.ctrlKey});return new co({clickTolerance:t,move:(e,t)=>({around:t,panDelta:t.sub(e)}),activateOnStart:!0,moveStateManager:r,enable:e,assignEvents:_o})}(e),g=new yo(e,r);r.dragPan=new Oo(i,m,g),this._add("mousePan",m),this._add("touchPan",g,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&r.dragPan.enable(e.dragPan);const _=new So,y=new wo;r.touchZoomRotate=new Bo(i,y,_,l),this._add("touchRotate",_,["touchPan","touchZoom"]),this._add("touchZoom",y,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&r.touchZoomRotate.enable(e.touchZoomRotate),this._add("blockableMapEvent",new ro(r));const v=r.scrollZoom=new Do(r,()=>this._triggerRenderFrame());this._add("scrollZoom",v,["mousePan"]),e.interactive&&e.scrollZoom&&r.scrollZoom.enable(e.scrollZoom);const b=r.keyboard=new ko(r);this._add("keyboard",b),e.interactive&&e.keyboard&&r.keyboard.enable()}_add(e,t,r){this._handlers.push({handlerName:e,handler:t,allowed:r}),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(jo(this._eventsInProgress))||this.isZooming()}_blockedByActive(e,t,r){for(const i in e)if(i!==r&&(!t||t.indexOf(i)<0))return!0;return!1}_getMapTouches(e){const t=[];for(const r of e)this._el.contains(r.target)&&t.push(r);return t}mergeHandlerResult(e,r,i,n,o){if(!i)return;t.e(e,i);const a={handlerName:n,originalEvent:i.originalEvent||o};void 0!==i.zoomDelta&&(r.zoom=a),void 0!==i.panDelta&&(r.drag=a),void 0!==i.rollDelta&&(r.roll=a),void 0!==i.pitchDelta&&(r.pitch=a),void 0!==i.bearingDelta&&(r.rotate=a)}_applyChanges(){const e={},r={},i={};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(r,o),t.e(i,a);this._updateMapTransform(e,r,i),this._changes=[]}_updateMapTransform(e,t,r){const i=this._map,n=i._getTransformForUpdate(),o=i.terrain;if(!(Uo(e)||o&&this._terrainMovement))return this._fireEvents(t,r,!0);i._stop(!0);let{panDelta:a,zoomDelta:s,bearingDelta:l,pitchDelta:c,rollDelta:u,around:h,pinchAround:d}=e;void 0!==d&&(h=d),h=h||i.transform.centerPoint,o&&!n.isPointOnMapSurface(h)&&(h=n.centerPoint);const p={panDelta:a,zoomDelta:s,rollDelta:u,pitchDelta:c,bearingDelta:l,around:h};this._map.cameraHelper.useGlobeControls&&!n.isPointOnMapSurface(h)&&(h=n.centerPoint);const f=h.distSqr(n.centerPoint)<.01?n.center:n.screenPointToLocation(a?h.sub(a):h);this._handleMapControls({terrain:o,tr:n,deltasForHelper:p,preZoomAroundLoc:f,combinedEventsInProgress:t,panDelta:a}),i._applyUpdatedTransform(n),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(t,r,!0)}_handleMapControls({terrain:e,tr:t,deltasForHelper:r,preZoomAroundLoc:i,combinedEventsInProgress:n,panDelta:o}){const a=this._map.cameraHelper;if(a.handleMapControlsRollPitchBearingZoom(r,t),e)return a.useGlobeControls?(this._terrainMovement||!n.drag&&!n.zoom||(this._terrainMovement=!0,this._map._elevationFreeze=!0),void a.handleMapControlsPan(r,t,i)):this._terrainMovement||!n.drag&&!n.zoom?void(n.drag&&this._terrainMovement&&o?t.setCenter(t.screenPointToLocation(t.centerPoint.sub(o))):a.handleMapControlsPan(r,t,i)):(this._terrainMovement=!0,this._map._elevationFreeze=!0,void a.handleMapControlsPan(r,t,i));a.handleMapControlsPan(r,t,i)}_fireEvents(e,r,i){const n=jo(this._eventsInProgress),o=jo(e),a={};for(const t in e){const{originalEvent:r}=e[t];this._eventsInProgress[t]||(a[`${t}start`]=r),this._eventsInProgress[t]=e[t]}!n&&o&&this._fireEvent("movestart",o.originalEvent);for(const t in a)this._fireEvent(t,a[t]);o&&this._fireEvent("move",o.originalEvent);for(const t in e){const{originalEvent:r}=e[t];this._fireEvent(t,r)}const l={};let c;for(const t in this._eventsInProgress){const{handlerName:e,originalEvent:i}=this._eventsInProgress[t];this._handlersById[e].isActive()||(delete this._eventsInProgress[t],c=r[e]||i,l[`${t}end`]=c)}for(const t in l)this._fireEvent(t,l[t]);const u=jo(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(i&&h){this._updatingCamera=!0;const e=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),r=e=>0!==e&&-this._bearingSnap<e&&e<this._bearingSnap;!e||!e.essential&&s.prefersReducedMotion?(this._map.fire(new t.l("moveend",{originalEvent:c})),r(this._map.getBearing())&&this._map.resetNorth()):(r(e.bearing||this._map.getBearing())&&(e.bearing=0),e.freezeElevation=!0,this._map.easeTo(e,{originalEvent:c})),this._updatingCamera=!1}}_fireEvent(e,r){this._map.fire(new t.l(e,r?{originalEvent:r}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new Vo("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}class qo extends t.E{constructor(e,t,r){super(),this._renderFrameCallback=()=>{const e=Math.min((c()-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=r.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.V(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,r,i){return e=t.P.convert(e).mult(-1),this.panTo(this.transform.center,t.e({offset:e},r),i)}panTo(e,r,i){return this.easeTo(t.e({center:e},r),i)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(e,r,i){return this.easeTo(t.e({zoom:e},r),i)}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,r){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new t.l("movestart",r)).fire(new t.l("move",r)).fire(new t.l("moveend",r))),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,r,i){return this.easeTo(t.e({bearing:e},r),i)}resetNorth(e,r){return this.rotateTo(0,t.e({duration:1e3},e),r),this}resetNorthPitch(e,r){return this.easeTo(t.e({bearing:0,pitch:0,roll:0,duration:1e3},e),r),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=Z.convert(e).adjustAntiMeridian();const r=t&&t.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),r,t)}_cameraForBoxAndBearing(e,r,i,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 Z(e,r);return this.cameraHelper.cameraForBoxAndBearing(n,a,l,i,s)}fitBounds(e,t,r){return this._fitInternal(this.cameraForBounds(e,t),t,r)}fitScreenCoordinates(e,r,i,n,o){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(t.P.convert(e)),this.transform.screenPointToLocation(t.P.convert(r)),i,n),n,o)}_fitInternal(e,r,i){return e?(delete(r=t.e(e,r)).padding,r.linear?this.easeTo(r,i):this.flyTo(r,i)):this}jumpTo(e,r){this.stop();const i=this._getTransformForUpdate();let n=!1,o=!1,a=!1;const s=i.zoom;this.cameraHelper.handleJumpToCenterZoom(i,e);const l=i.zoom!==s;return"elevation"in e&&i.elevation!==+e.elevation&&i.setElevation(+e.elevation),"bearing"in e&&i.bearing!==+e.bearing&&(n=!0,i.setBearing(+e.bearing)),"pitch"in e&&i.pitch!==+e.pitch&&(o=!0,i.setPitch(+e.pitch)),"roll"in e&&i.roll!==+e.roll&&(a=!0,i.setRoll(+e.roll)),null==e.padding||i.isPaddingEqual(e.padding)||i.setPadding(e.padding),this._applyUpdatedTransform(i),this.fire(new t.l("movestart",r)).fire(new t.l("move",r)),l&&this.fire(new t.l("zoomstart",r)).fire(new t.l("zoom",r)).fire(new t.l("zoomend",r)),n&&this.fire(new t.l("rotatestart",r)).fire(new t.l("rotate",r)).fire(new t.l("rotateend",r)),o&&this.fire(new t.l("pitchstart",r)).fire(new t.l("pitch",r)).fire(new t.l("pitchend",r)),a&&this.fire(new t.l("rollstart",r)).fire(new t.l("roll",r)).fire(new t.l("rollend",r)),this.fire(new t.l("moveend",r))}calculateCameraOptionsFromTo(e,r,i,n=0){const o=t.aa.fromLngLat(e,r),a=t.aa.fromLngLat(i,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),d=t.at(this.transform.cameraToCenterDistance/u/this.transform.tileSize),p=180*Math.atan2(s,-l)/Math.PI;let f=180*Math.acos(h/u)/Math.PI;return f=c<0?90-f:90+f,{center:a.toLngLat(),elevation:n,zoom:d,pitch:f,bearing:p}}calculateCameraOptionsFromCameraLngLatAltRotation(e,t,r,i,n){const o=this.transform.calculateCenterFromCameraLngLatAlt(e,t,r,i);return{center:o.center,elevation:o.elevation,zoom:o.zoom,bearing:r,pitch:i,roll:n}}easeTo(e,r){this._stop(!1,e.easeId),(!1===(e=t.e({offset:[0,0],duration:500,easing:t.cx},e)).animate||!e.essential&&s.prefersReducedMotion)&&(e.duration=0);const i=this._getTransformForUpdate(),n=this.getBearing(),o=i.pitch,a=i.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,a):a,h="padding"in e?e.padding:i.padding,d=t.P.convert(e.offset);let p,f;e.around&&(p=t.V.convert(e.around),f=i.locationToScreenPoint(p));const m={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},g=this.cameraHelper.handleEaseTo(i,{bearing:l,pitch:c,roll:u,padding:h,around:p,aroundPoint:f,offsetAsPoint:d,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!==a,this._padding=!i.isPaddingEqual(h),this._zooming=this._zooming||g.isZooming,this._easeId=e.easeId,this._prepareEase(r,e.noMoveStart,m),this.terrain&&this._prepareElevation(g.elevationCenter),this._ease(t=>{g.easeFunc(t),this.terrain&&!e.freezeElevation&&this._updateElevation(t),this._applyUpdatedTransform(i),this._fireMoveEvents(r)},t=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(r,t)},e),this}_prepareEase(e,r,i={}){this._moving=!0,r||i.moving||this.fire(new t.l("movestart",e)),this._zooming&&!i.zooming&&this.fire(new t.l("zoomstart",e)),this._rotating&&!i.rotating&&this.fire(new t.l("rotatestart",e)),this._pitching&&!i.pitching&&this.fire(new t.l("pitchstart",e)),this._rolling&&!i.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){void 0!==this._elevationStart&&void 0!==this._elevationCenter||this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const r=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&r!==this._elevationTarget){const t=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(t-(r-(t*e+this._elevationStart))/(1-e)),this._elevationTarget=r}this.transform.setElevation(t.G.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(),r=e.getCameraAltitude(),i=this.terrain?this.terrain.getElevationForLngLatZoom(t,e.zoom):0;if(r<i){const r=this.calculateCameraOptionsFromTo(t,i,e.center,e.elevation);return{pitch:r.pitch,zoom:r.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 r=e.clone();for(const i of t){const e=r.clone(),{center:t,zoom:n,roll:o,pitch:a,bearing:s,elevation:l}=i(e);t&&e.setCenter(t),void 0!==l&&e.setElevation(l),void 0!==n&&e.setZoom(n),void 0!==o&&e.setRoll(o),void 0!==a&&e.setPitch(a),void 0!==s&&e.setBearing(s),r.apply(e)}this.transform.apply(r)}_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,r){if(this._easeId&&r&&this._easeId===r)return;delete this._easeId;const i=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,i&&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,r){if(!e.essential&&s.prefersReducedMotion){const i=t.U(e,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(i,r)}this.stop(),e=t.e({offset:[0,0],speed:1.2,curve:1.42,easing:t.cx},e);const i=this._getTransformForUpdate(),n=i.bearing,o=i.pitch,a=i.roll,l=i.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,a):a,d="padding"in e?e.padding:i.padding,p=t.P.convert(e.offset);let f=i.centerPoint.add(p);const m=i.screenPointToLocation(f),g=this.cameraHelper.handleFlyTo(i,{bearing:c,pitch:u,roll:h,padding:d,locationAtOffset:m,offsetAsPoint:p,center:e.center,minZoom:e.minZoom,zoom:e.zoom});let _=e.curve;const y=Math.max(i.width,i.height),v=y/g.scaleOfZoom,b=g.pixelPathLength;"number"==typeof g.scaleOfMinZoom&&(_=Math.sqrt(y/g.scaleOfMinZoom/b*2));const x=_*_;function w(e){const t=(v*v-y*y+(e?-1:1)*x*x*b*b)/(2*(e?v:y)*x*b);return Math.log(Math.sqrt(t*t+1)-t)}function T(e){return(Math.exp(e)-Math.exp(-e))/2}function S(e){return(Math.exp(e)+Math.exp(-e))/2}const E=w(!1);let I=function(e){return S(E)/S(E+_*e)},P=function(e){return y*((S(E)*(T(t=E+_*e)/S(t))-T(E))/x)/b;var t},k=(w(!0)-E)/_;if(Math.abs(b)<2e-6||!isFinite(k)){if(Math.abs(y-v)<1e-6)return this.easeTo(e,r);const t=v<y?-1:1;k=Math.abs(Math.log(v/y))/_,P=()=>0,I=e=>Math.exp(t*_*e)}return e.duration="duration"in e?+e.duration:1e3*k/("screenSpeed"in e?+e.screenSpeed/_:+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!==a,this._padding=!i.isPaddingEqual(d),this._prepareEase(r,!1),this.terrain&&this._prepareElevation(g.targetCenter),this._ease(s=>{const m=s*k,_=1/I(m),y=P(m);this._rotating&&i.setBearing(t.G.number(n,c,s)),this._pitching&&i.setPitch(t.G.number(o,u,s)),this._rolling&&i.setRoll(t.G.number(a,h,s)),this._padding&&(i.interpolatePadding(l,d,s),f=i.centerPoint.add(p)),g.easeFunc(s,_,y,f),this.terrain&&!e.freezeElevation&&this._updateElevation(s),this._applyUpdatedTransform(i),this._fireMoveEvents(r)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(r)},e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,t){var r;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===(r=this.handlers)||void 0===r||r.stop(!1),this}_ease(e,t,r){!1===r.animate||0===r.duration?(e(1),t()):(this._easeStart=c(),this._easeOptions=r,this._onEaseFrame=e,this._onEaseEnd=t,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,r){e=t.W(e,-180,180);const i=Math.abs(e-r);return Math.abs(e-360-r)<i&&(e-=360),Math.abs(e+360-r)<i&&(e+=360),e}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(t.V.convert(e),this.transform.tileZoom):null}}const $o={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Wo{constructor(e=$o){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=u.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=u.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=u.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(){u.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 r=this._map._getUIString(`AttributionControl.${t}`);e.title=r,e.setAttribute("aria-label",r)}_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.tileManagers;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,r)=>{for(let i=r+1;i<e.length;i++)if(e[i].indexOf(t)>=0)return!1;return!0});const r=e.join(" | ");r!==this._attribHTML&&(this._attribHTML=r,e.length?(this._innerContainer.innerHTML=u.sanitize(r),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Zo{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=u.create("div","maplibregl-ctrl");const t=u.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(){u.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Ho{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,r=t?this._queue.concat(t):this._queue;for(const i of r)if(i.id===e)return void(i.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 r of t)if(!r.cancelled&&(r.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Xo=t.aT([{name:"a_pos3d",type:"Int16",components:3}]);class Yo extends t.E{constructor(e){super(),this._lastTilesetChange=c(),this.tileManager=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.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null}getSource(){return this.tileManager._source}update(e,r){this.tileManager.update(e,r),this._renderableTilesKeys=[];const i={};for(const n of Ee(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:r,calculateTileZoom:this.tileManager._source.calculateTileZoom}))i[n.key]=!0,this._renderableTilesKeys.push(n.key),this._tiles[n.key]||(n.terrainRttPosMatrix32f=new Float64Array(16),t.c6(n.terrainRttPosMatrix32f,0,t.a4,t.a4,0,0,1),this._tiles[n.key]=new de(n,this.tileSize),this._lastTilesetChange=c());for(const t in this._tiles)i[t]||delete this._tiles[t]}freeRtt(e){for(const t in this._tiles){const r=this._tiles[t];(!e||r.tileID.equals(e)||r.tileID.isChildOf(e)||e.isChildOf(r.tileID))&&(r.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 r={};for(const i of this._renderableTilesKeys){const n=this._tiles[i].tileID,o=e.clone(),a=t.bj();if(n.canonical.equals(e.canonical))t.c6(a,0,t.a4,t.a4,0,0,1);else if(n.canonical.isChildOf(e.canonical)){const r=n.canonical.z-e.canonical.z,i=n.canonical.x-(n.canonical.x>>r<<r),o=n.canonical.y-(n.canonical.y>>r<<r),s=t.a4>>r;t.c6(a,0,s,s,0,0,1),t.O(a,a,[-i*s,-o*s,0])}else{if(!e.canonical.isChildOf(n.canonical))continue;{const r=e.canonical.z-n.canonical.z,i=e.canonical.x-(e.canonical.x>>r<<r),o=e.canonical.y-(e.canonical.y>>r<<r),s=t.a4>>r;t.c6(a,0,t.a4,t.a4,0,0,1),t.O(a,a,[i*s,o*s,0]),t.Q(a,a,[1/2**r,1/2**r,0])}}o.terrainRttPosMatrix32f=new Float32Array(a),r[i]=o}return r}_getTerrainCoordsForTileRanges(e,r){const i={};for(const n of this._renderableTilesKeys){const o=this._tiles[n].tileID;if(!this._isWithinTileRanges(o,r))continue;const a=e.clone(),s=t.bj();if(o.canonical.z===e.canonical.z){const r=e.canonical.x-o.canonical.x,i=e.canonical.y-o.canonical.y;t.c6(s,0,t.a4,t.a4,0,0,1),t.O(s,s,[r*t.a4,i*t.a4,0])}else if(o.canonical.z>e.canonical.z){const r=o.canonical.z-e.canonical.z,i=o.canonical.x-(o.canonical.x>>r<<r),n=o.canonical.y-(o.canonical.y>>r<<r),a=e.canonical.x-(o.canonical.x>>r),l=e.canonical.y-(o.canonical.y>>r),c=t.a4>>r;t.c6(s,0,c,c,0,0,1),t.O(s,s,[-i*c+a*t.a4,-n*c+l*t.a4,0])}else{const r=e.canonical.z-o.canonical.z,i=e.canonical.x-(e.canonical.x>>r<<r),n=e.canonical.y-(e.canonical.y>>r<<r),a=(e.canonical.x>>r)-o.canonical.x,l=(e.canonical.y>>r)-o.canonical.y,c=t.a4<<r;t.c6(s,0,c,c,0,0,1),t.O(s,s,[i*t.a4+a*c,n*t.a4+l*c,0])}a.terrainRttPosMatrix32f=new Float32Array(s),i[n]=a}return i}getSourceTile(e,t){const r=this.tileManager._source;let i=e.overscaledZ-this.deltaZoom;if(i>r.maxzoom&&(i=r.maxzoom),i<r.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(i).key);let n=this.tileManager.getTileByID(this._sourceTileCache[e.key]);if((!n||!n.dem)&&t)for(;i>=r.minzoom&&(!n||!n.dem);)n=this.tileManager.getTileByID(e.scaledTo(i--).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 Jo{constructor(e,t,r){this._meshCache={},this.painter=e,this.tileManager=new Yo(t),this.options=r,this.exaggeration="number"==typeof r.exaggeration?r.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,r,i,n=t.a4){var o;if(!(r>=0&&r<n&&i>=0&&i<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.cB([],[r/n*t.a4,i/n*t.a4],a.u_terrain_matrix),c=[l[0]*s.dim,l[1]*s.dim],u=Math.floor(c[0]),h=Math.floor(c[1]),d=c[0]-u,p=c[1]-h;return s.get(u,h)*(1-d)*(1-p)+s.get(u+1,h)*d*(1-p)+s.get(u,h+1)*(1-d)*p+s.get(u+1,h+1)*d*p}getElevationForLngLatZoom(e,r){if(!t.cC(r,e.wrap()))return 0;const{tileID:i,mercatorX:n,mercatorY:o}=this._getOverscaledTileIDFromLngLatZoom(e,r);return this.getElevation(i,n%t.a4,o%t.a4,t.a4)}getElevation(e,r,i,n=t.a4){return this.getDEMElevation(e,r,i,n)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){const e=this.painter.context,r=new t.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new t.T(e,r,e.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new t.T(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.ar([])}const r=this.tileManager.getSourceTile(e,!0);if(r&&r.dem&&(!r.demTexture||r.needsTerrainPrepare)){const e=this.painter.context;r.demTexture=this.painter.getTileTexture(r.dem.stride),r.demTexture?r.demTexture.update(r.dem.getPixels(),{premultiply:!1}):r.demTexture=new t.T(e,r.dem.getPixels(),e.gl.RGBA,{premultiply:!1}),r.demTexture.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),r.needsTerrainPrepare=!1}const i=r&&r+r.tileID.key+e.key;if(i&&!this._demMatrixCache[i]){const i=this.tileManager.getSource().maxzoom;let n=e.canonical.z-r.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=i?n=e.canonical.z-i: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.cD(new Float64Array(16),[1/(t.a4<<n),1/(t.a4<<n),0]);t.O(s,s,[o*t.a4,a*t.a4,0]),this._demMatrixCache[e.key]={matrix:s,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:r&&r.dem&&r.dem.dim||1,u_terrain_matrix:i?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:r&&r.dem&&r.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(r&&r.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:r}}getFramebuffer(e){const r=this.painter,i=r.width/devicePixelRatio,n=r.height/devicePixelRatio;return!this._fbo||this._fbo.width===i&&this._fbo.height===n||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new t.T(r.context,{width:i,height:n,data:null},r.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(r.context.gl.NEAREST,r.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new t.T(r.context,{width:i,height:n,data:null},r.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(r.context.gl.NEAREST,r.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=r.context.createFramebuffer(i,n,!0,!1),this._fbo.depthAttachment.set(r.context.createRenderbuffer(r.context.gl.DEPTH_COMPONENT16,i,n))),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 r=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let t=0,o=0;t<this._coordsTextureSize;t++)for(let e=0;e<this._coordsTextureSize;e++,o+=4)r[o+0]=255&e,r[o+1]=255&t,r[o+2]=e>>8<<4|t>>8,r[o+3]=0;const i=new t.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(r.buffer)),n=new t.T(e,i,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 r=new Uint8Array(4),i=this.painter.context,n=i.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);i.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),n.readPixels(o,s-a-1,1,1,n.RGBA,n.UNSIGNED_BYTE,r),i.bindFramebuffer.set(null);const l=r[0]+(r[2]>>4<<8),c=r[1]+((15&r[2])<<8),u=this.coordsIndex[255-r[3]],h=u&&this.tileManager.getTileByID(u);if(!h)return null;const d=this._coordsTextureSize,p=(1<<h.tileID.canonical.z)*d;return new t.aa((h.tileID.canonical.x*d+l)/p+h.tileID.wrap,(h.tileID.canonical.y*d+c)/p,this.getElevation(h.tileID,l,c,d))}depthAtPoint(e){const t=new Uint8Array(4),r=this.painter.context,i=r.gl;return r.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),i.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,i.RGBA,i.UNSIGNED_BYTE,t),r.bindFramebuffer.set(null),(t[0]/16777216+t[1]/65536+t[2]/256+t[3])/256}getTerrainMesh(e){var r;const i=(null===(r=this.painter.style.projection)||void 0===r?void 0:r.transitionState)>0,n=i&&0===e.canonical.y,o=i&&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.cE,c=new t.aX,u=this.meshSize,h=t.a4/u,d=u*u;for(let t=0;t<=u;t++)for(let e=0;e<=u;e++)l.emplaceBack(e*h,t*h,0);for(let t=0;t<d;t+=u+1)for(let e=0;e<u;e++)c.emplaceBack(e+t,u+e+t+1,u+e+t+2),c.emplaceBack(e+t,u+e+t+2,e+t+1);const p=l.length,f=p+(u+1),m=(u+1)*u,g=n?t.bq:0,_=n?0:1,y=o?t.br:t.a4,v=o?0:1;for(let t=0;t<=u;t++)l.emplaceBack(t*h,g,_);for(let t=0;t<=u;t++)l.emplaceBack(t*h,y,v);for(let t=0;t<u;t++)c.emplaceBack(m+t,f+t,f+t+1),c.emplaceBack(m+t,f+t+1,m+t+1),c.emplaceBack(0+t,p+t+1,p+t),c.emplaceBack(0+t,0+t+1,p+t+1);const b=l.length,x=b+2*(u+1);for(const T of[0,1])for(let e=0;e<=u;e++)for(const r of[0,1])l.emplaceBack(T*t.a4,e*h,r);for(let t=0;t<2*u;t+=2)c.emplaceBack(b+t,b+t+1,b+t+3),c.emplaceBack(b+t,b+t+3,b+t+2),c.emplaceBack(x+t,x+t+3,x+t+1),c.emplaceBack(x+t,x+t+2,x+t+3);const w=new At(s.createVertexBuffer(l,Xo.members),s.createIndexBuffer(c),t.aW.simpleSegment(0,0,l.length,c.length));return this._meshCache[a]=w,w}getMeshFrameDelta(e){return 2*Math.PI*t.bD/Math.pow(2,Math.max(e,0))/5}getMinTileElevationForLngLatZoom(e,t){var r;const{tileID:i}=this._getOverscaledTileIDFromLngLatZoom(e,t);return null!==(r=this.getMinMaxElevation(i).minElevation)&&void 0!==r?r:0}getMinMaxElevation(e){const t=this.getTerrainData(e).tile,r={minElevation:null,maxElevation:null};return t&&t.dem&&(r.minElevation=t.dem.min*this.exaggeration,r.maxElevation=t.dem.max*this.exaggeration),r}_getOverscaledTileIDFromLngLatZoom(e,r){const i=t.aa.fromLngLat(e.wrap()),n=(1<<r)*t.a4,o=i.x*n,a=i.y*n,s=Math.floor(o/t.a4),l=Math.floor(a/t.a4);return{tileID:new t.a1(r,0,r,s,l),mercatorX:o,mercatorY:a}}}class Ko{constructor(e,t,r){this._context=e,this._size=t,this._tileSize=r,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const e of this._objects)e.texture.destroy(),e.fbo.destroy()}_createObject(e){const r=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),i=new t.T(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),r.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),r.colorAttachment.set(i.texture),{id:e,fbo:r,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 t of this._recentlyUsed)if(!this._objects[t].inUse)return this._objects[t];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 Qo={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};class ea{constructor(e,t){this.painter=e,this.terrain=t,this.pool=new Ko(e.context,30,t.tileManager.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.tileManager.getRenderableTiles(),this._renderableLayerIds=e._order.filter(r=>!e._layers[r].isHidden(t)),this._coordsAscending={};for(const r in e.tileManagers){this._coordsAscending[r]={};const t=e.tileManagers[r].getVisibleCoordinates(),i=e.tileManagers[r].getSource(),n=i instanceof te?i.terrainTileRanges:null;for(const e of t){const t=this.terrain.tileManager.getTerrainCoords(e,n);for(const e in t)this._coordsAscending[r][e]||(this._coordsAscending[r][e]=[]),this._coordsAscending[r][e].push(t[e])}}this._coordsAscendingStr={};for(const r of e._order){const t=e._layers[r],i=t.source;if(Qo[t.type]&&!this._coordsAscendingStr[i]){this._coordsAscendingStr[i]={};for(const e in this._coordsAscending[i])this._coordsAscendingStr[i][e]=this._coordsAscending[i][e].map(e=>e.key).sort().join()}}for(const r of this._renderableTiles)for(const e in this._coordsAscendingStr){const t=this._coordsAscendingStr[e][r.tileID.key];t&&t!==r.rttCoords[e]&&(r.rtt=[])}}renderLayer(e,r){if(e.isHidden(this.painter.transform.zoom))return!1;const i=Object.assign(Object.assign({},r),{isRenderingToTexture:!0}),n=e.type,o=this.painter,a=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(Qo[n]&&(this._prevType&&Qo[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(e.id),!a))return!0;if(Qo[this._prevType]||Qo[n]&&a){this._prevType=n;const e=this._stacks.length-1,r=this._stacks[e]||[];for(const n of this._renderableTiles){if(this.pool.isFull()&&(Bn(this.painter,this.terrain,this._rttTiles,i),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.bo.transparent,stencil:0}),o.currentStencilSource=void 0;for(let e=0;e<r.length;e++){const t=o.style._layers[r[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.tileManagers[t.source],t,s,i),t.source&&(n.rttCoords[t.source]=this._coordsAscendingStr[t.source][n.tileID.key])}}return Bn(this.painter,this.terrain,this._rttTiles,i),this._rttTiles=[],this.pool.freeAllObjects(),Qo[n]}return!1}}const ta={"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"},ra=r,ia={hash:!1,interactive:!0,bearingSnap:7,attributionControl:$o,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,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,reduceMotion:void 0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,experimentalZoomLevelsToOverscale:void 0},na={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class oa{constructor(e,r,i=!1){this.mousedown=e=>{this.startMove(e,u.mousePos(this.element,e)),u.addEventListener(window,"mousemove",this.mousemove),u.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=e=>{this.move(e,u.mousePos(this.element,e))},this.mouseup=e=>{this._rotatePitchHandler.dragEnd(e),this.offTemp()},this.touchstart=e=>{1!==e.targetTouches.length?this.reset():(this._startPos=this._lastPos=u.touchPos(this.element,e.targetTouches)[0],this.startMove(e,this._startPos),u.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),u.addEventListener(window,"touchend",this.touchend))},this.touchmove=e=>{1!==e.targetTouches.length?this.reset():(this._lastPos=u.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._rotatePitchHandler.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=r;const n=new go;this._rotatePitchHandler=new co({clickTolerance:3,move:(e,n)=>{const o=r.getBoundingClientRect(),a=new t.P((o.bottom-o.top)/2,(o.right-o.left)/2);return{bearingDelta:t.cw(new t.P(e.x,n.y),n,a),pitchDelta:i?-.5*(n.y-e.y):void 0}},moveStateManager:n,enable:!0,assignEvents:()=>{}}),this.map=e,u.addEventListener(r,"mousedown",this.mousedown),u.addEventListener(r,"touchstart",this.touchstart,{passive:!1}),u.addEventListener(r,"touchcancel",this.reset)}startMove(e,t){this._rotatePitchHandler.dragStart(e,t),u.disableDrag()}move(e,t){const r=this.map,{bearingDelta:i,pitchDelta:n}=this._rotatePitchHandler.dragMove(e,t)||{};i&&r.setBearing(r.getBearing()+i),n&&r.setPitch(r.getPitch()+n)}off(){const e=this.element;u.removeEventListener(e,"mousedown",this.mousedown),u.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),u.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),u.removeEventListener(window,"touchend",this.touchend),u.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){u.enableDrag(),u.removeEventListener(window,"mousemove",this.mousemove),u.removeEventListener(window,"mouseup",this.mouseup),u.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),u.removeEventListener(window,"touchend",this.touchend)}}let aa;function sa(e,r,i,n=!1){if(n||!i.getCoveringTilesDetailsProvider().allowWorldCopies())return null==e?void 0:e.wrap();const o=new t.V(e.lng,e.lat);if(e=new t.V(e.lng,e.lat),r){const n=new t.V(e.lng-360,e.lat),o=new t.V(e.lng+360,e.lat),a=i.locationToScreenPoint(e).distSqr(r);i.locationToScreenPoint(n).distSqr(r)<a?e=n:i.locationToScreenPoint(o).distSqr(r)<a&&(e=o)}for(;Math.abs(e.lng-i.center.lng)>180;){const t=i.locationToScreenPoint(e);if(t.x>=0&&t.y>=0&&t.x<=i.width&&t.y<=i.height)break;e.lng>i.center.lng?e.lng-=360:e.lng+=360}return e.lng!==o.lng&&i.isPointOnMapSurface(i.locationToScreenPoint(e))?e:o}const la={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 ca(e,t,r){const i=e.classList;for(const n in la)i.remove(`maplibregl-${r}-anchor-${n}`);i.add(`maplibregl-${r}-anchor-${t}`)}class ua extends t.E{constructor(e){if(super(),this._onKeyPress=e=>{const t=e.code,r=e.charCode||e.keyCode;"Space"!==t&&"Enter"!==t&&32!==r&&13!==r||this.togglePopup()},this._onMapClick=e=>{const t=e.originalEvent.target,r=this._element;this._popup&&(t===r||r.contains(t))&&this.togglePopup()},this._update=e=>{if(!this._map)return;const t=this._map.loaded()&&!this._map.isMoving();("terrain"===(null==e?void 0:e.type)||"render"===(null==e?void 0:e.type)&&!t)&&this._map.once("render",this._update),this._lngLat=sa(this._lngLat,this._flatPos,this._map.transform),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 i="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?i="rotateX(0deg)":"map"===this._pitchAlignment&&(i=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||e&&"moveend"!==e.type||(this._pos=this._pos.round()),u.setTransform(this._element,`${la[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${i} ${r}`),s.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=u.create("div");const r=u.createNS("http://www.w3.org/2000/svg","svg"),i=41,n=27;r.setAttributeNS(null,"display","block"),r.setAttributeNS(null,"height",`${i}px`),r.setAttributeNS(null,"width",`${n}px`),r.setAttributeNS(null,"viewBox",`0 0 ${n} ${i}`);const o=u.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=u.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"fill-rule","nonzero");const s=u.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"transform","translate(3.0, 29.0)"),s.setAttributeNS(null,"fill","#000000");const l=[{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 l){const t=u.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),s.appendChild(t)}const c=u.createNS("http://www.w3.org/2000/svg","g");c.setAttributeNS(null,"fill",this._color);const h=u.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"),c.appendChild(h);const d=u.createNS("http://www.w3.org/2000/svg","g");d.setAttributeNS(null,"opacity","0.25"),d.setAttributeNS(null,"fill","#000000");const p=u.createNS("http://www.w3.org/2000/svg","path");p.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),d.appendChild(p);const f=u.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"transform","translate(6.0, 7.0)"),f.setAttributeNS(null,"fill","#FFFFFF");const m=u.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"transform","translate(8.0, 8.0)");const g=u.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 _=u.createNS("http://www.w3.org/2000/svg","circle");_.setAttributeNS(null,"fill","#FFFFFF"),_.setAttributeNS(null,"cx","5.5"),_.setAttributeNS(null,"cy","5.5"),_.setAttributeNS(null,"r","5.4999962"),m.appendChild(g),m.appendChild(_),a.appendChild(s),a.appendChild(c),a.appendChild(d),a.appendChild(f),a.appendChild(m),r.appendChild(a),r.setAttributeNS(null,"height",i*this._scale+"px"),r.setAttributeNS(null,"width",n*this._scale+"px"),this._element.appendChild(r),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()}),ca(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.hasAttribute("aria-label")||this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),this._element.hasAttribute("role")||this._element.setAttribute("role","button"),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),u.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.V.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,r=13.5,i=Math.abs(r)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-t],"bottom-left":[i,-1*(t-r+i)],"bottom-right":[-i,-1*(t-r+i)],left:[r,-1*(t-r)],right:[-r,-1*(t-r)]}: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 r,i;const n=null===(r=this._map)||void 0===r?void 0:r.terrain,o=this._map.transform.isLocationOccluded(this._lngLat);if(!n||o){const e=o?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 a=this._map,s=a.terrain.depthAtPoint(this._pos),l=a.terrain.getElevationForLngLatZoom(this._lngLat,a.transform.tileZoom);if(a.transform.lngLatToCameraDepth(this._lngLat,l)-s<.006)return void(this._element.style.opacity=this._opacity);const c=-this._offset.y/a.transform.pixelsPerMeter,u=Math.sin(a.getPitch()*Math.PI/180)*c,h=a.terrain.depthAtPoint(new t.P(this._pos.x,this._pos.y-this._offset.y)),d=a.transform.lngLatToCameraDepth(this._lngLat,l+u)-h>.006;(null===(i=this._popup)||void 0===i?void 0:i.isOpen())&&d&&this._popup.remove(),this._element.style.opacity=d?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 ha={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let da=0,pa=!1;const fa={maxWidth:100,unit:"metric"};function ma(e,t,r){const i=r&&r.maxWidth||100,n=e._container.clientHeight/2,o=e._container.clientWidth/2,a=e.unproject([o-i/2,n]),s=e.unproject([o+i/2,n]),l=Math.round(e.project(s).x-e.project(a).x),c=Math.min(i,l,e._container.clientWidth),u=a.distanceTo(s);if(r&&"imperial"===r.unit){const r=3.2808*u;r>5280?ga(t,c,r/5280,e._getUIString("ScaleControl.Miles")):ga(t,c,r,e._getUIString("ScaleControl.Feet"))}else r&&"nautical"===r.unit?ga(t,c,u/1852,e._getUIString("ScaleControl.NauticalMiles")):u>=1e3?ga(t,c,u/1e3,e._getUIString("ScaleControl.Kilometers")):ga(t,c,u,e._getUIString("ScaleControl.Meters"))}function ga(e,t,r,i){const n=function(e){const t=Math.pow(10,`${Math.floor(e)}`.length-1);let r=e/t;return r=r>=10?10:r>=5?5:r>=3?3:r>=2?2:r>=1?1:function(e){const t=Math.pow(10,Math.ceil(-Math.log(e)/Math.LN10));return Math.round(e*t)/t}(r),t*r}(r);e.style.width=t*(n/r)+"px",e.innerHTML=`${n} ${i}`}const _a={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0},ya=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function va(e){if(e){if("number"==typeof e){const r=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(r,r),"top-right":new t.P(-r,r),bottom:new t.P(0,-e),"bottom-left":new t.P(r,-r),"bottom-right":new t.P(-r,-r),left:new t.P(e,0),right:new t.P(-e,0)}}if(e instanceof t.P||Array.isArray(e)){const r=t.P.convert(e);return{center:r,top:r,"top-left":r,"top-right":r,bottom:r,"bottom-left":r,"bottom-right":r,left:r,right:r}}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 va(new t.P(0,0))}const ba=r;e.AJAXError=t.cI,e.Event=t.l,e.Evented=t.E,e.LngLat=t.V,e.MercatorCoordinate=t.aa,e.Point=t.P,e.addProtocol=t.cJ,e.config=t.a,e.removeProtocol=t.cK,e.AttributionControl=Wo,e.BoxZoomHandler=no,e.CanvasSource=ie,e.CooperativeGesturesHandler=No,e.DoubleClickZoomHandler=Ro,e.DragPanHandler=Oo,e.DragRotateHandler=zo,e.EdgeInsets=Lt,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=u.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){u.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const e=this._fullscreenButton=u.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);u.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=ee,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 r=new t.V(e.coords.longitude,e.coords.latitude),i=e.coords.accuracy,n=this._map.getBearing(),o=t.e({bearing:n},this.options.fitBoundsOptions),a=Z.fromLngLat(r,i);this._map.fitBounds(a,o,{geolocateSource:!0})},this._updateMarker=e=>{if(e){const r=new t.V(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(r).addTo(this._map),this._userLocationDotMarker.setLngLat(r).addTo(this._map),this._accuracy=e.coords.accuracy,this._updateCircleRadiusIfNeeded()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onUpdate=()=>{this._updateCircleRadiusIfNeeded()},this._onError=e=>{if(this._map){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&&pa)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=u.create("button","maplibregl-ctrl-geolocate",this._container),u.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=u.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new ua({element:this._dotElement}),this._circleElement=u.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ua({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onUpdate),this._map.on("move",this._onUpdate),this._map.on("rotate",this._onUpdate),this._map.on("pitch",this._onUpdate)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",e=>{const r=(null==e?void 0:e[0])instanceof ResizeObserverEntry;e.geolocateSource||"ACTIVE_LOCK"!==this._watchState||r||this._map.isZooming()||(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({},ha,e)}onAdd(e){return this._map=e,this._container=u.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return t._(this,arguments,void 0,function*(e=!1){if(void 0!==aa&&!e)return aa;if(void 0===window.navigator.permissions)return aa=!!window.navigator.geolocation,aa;try{const e=yield window.navigator.permissions.query({name:"geolocation"});aa="denied"!==e.state}catch(e){aa=!!window.navigator.geolocation}return aa})}().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(),u.remove(this._container),this._map.off("zoom",this._onUpdate),this._map.off("move",this._onUpdate),this._map.off("rotate",this._onUpdate),this._map.off("pitch",this._onUpdate),this._map=void 0,da=0,pa=!1}_isOutOfMapMaxBounds(e){const t=this._map.getMaxBounds(),r=e.coords;return t&&(r.longitude<t.getWest()||r.longitude>t.getEast()||r.latitude<t.getSouth()||r.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":case"BACKGROUND_ERROR":case"OFF":case void 0:break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadiusIfNeeded(){const e=this._userLocationDotMarker.getLngLat();if(!(this.options.showUserLocation&&this.options.showAccuracyCircle&&this._accuracy&&e))return;const t=this._map.project(e),r=this._map.unproject([t.x+100,t.y]),i=e.distanceTo(r)/100,n=2*this._accuracy/i;this._circleElement.style.width=`${n.toFixed(2)}px`,this._circleElement.style.height=`${n.toFixed(2)}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":da--,pa=!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"),da++,da>1?(e={maximumAge:6e5,timeout:0},pa=!0):(e=this.options.positionOptions,pa=!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=u.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=u.create("button","maplibregl-ctrl-globe",this._container),u.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(){u.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},e.Hash=Un,e.ImageSource=te,e.KeyboardHandler=ko,e.LngLatBounds=Z,e.LogoControl=Zo,e.Map=class extends qo{constructor(e){var r,i;t.cF.mark(t.cG.create);const n=Object.assign(Object.assign(Object.assign({},ia),e),{canvasContextAttributes:Object.assign(Object.assign({},ia.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 Vt,a=new $t;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),null!==n.transformConstrain&&o.setConstrainOverride(n.transformConstrain),super(o,a,{bearingSnap:n.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Ho,this._controls=[],this._mapId=t.ag(),this._lostContextStyle={style:null,images:null},this._contextLost=e=>{e.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.painter.destroy();for(const t of Object.values(this.style._layers))if("custom"===t.type&&console.warn(`Custom layer with id '${t.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),t._listeners)for(const[e]of Object.entries(t._listeners))console.warn(`Custom layer with id '${t.id}' had event listeners for event '${e}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);this._lostContextStyle=this._getStyleAndImages(),this.style.destroy(),this.style=null,this.fire(new t.l("webglcontextlost",{originalEvent:e}))},this._contextRestored=e=>{this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&(this.style.imageManager.images=this._lostContextStyle.images),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({},ta),n.locale),this._clickTolerance=n.clickTolerance,this._overridePixelRatio=n.pixelRatio,this._maxCanvasSize=n.maxCanvasSize,this._zoomLevelsToOverscale=n.experimentalZoomLevelsToOverscale,this.transformCameraUpdate=n.transformCameraUpdate,this.transformConstrain=n.transformConstrain,this.cancelPendingTileRequestsWhileZooming=!0===n.cancelPendingTileRequestsWhileZooming,void 0!==n.reduceMotion&&(s.prefersReducedMotion=n.reduceMotion),this._imageQueueHandle=_.addThrottleControl(()=>this.isMoving()),this._requestManager=new y(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=Vn(e=>{this._trackResize&&!this._removed&&(this.resize(e),this.redraw())},50);this._resizeObserver=new ResizeObserver(r=>{e?t(r):e=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Go(this,n),this._hash=n.hash&&new Un("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 l="string"==typeof n.style||!("globe"===(null===(i=null===(r=n.style)||void 0===r?void 0:r.projection)||void 0===i?void 0:i.type));this.resize(null,l),this._localIdeographFontFamily=n.localIdeographFontFamily,this._validateStyle=n.validateStyle,n.style&&this.setStyle(n.style,{localIdeographFontFamily:n.localIdeographFontFamily}),n.attributionControl&&this.addControl(new Wo("boolean"==typeof n.attributionControl?void 0:n.attributionControl)),n.maplibreLogo&&this.addControl(new Zo,n.logoPosition),this.on("style.load",()=>{if(l||this._resizeTransform(),this.transform.unmodified){const e=t.U(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}setGlobalStateProperty(e,t){return this.style.setGlobalStateProperty(e,t),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(e,r){if(void 0===r&&(r=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 i=e.onAdd(this);this._controls.push(e);const n=this._controlPositions[r];return-1!==r.indexOf("bottom")?n.insertBefore(i,n.firstChild):n.appendChild(i),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 r=this._controls.indexOf(e);return r>-1&&this._controls.splice(r,1),e.onRemove(this),this}hasControl(e){return this._controls.indexOf(e)>-1}coveringTiles(e){return Ee(this.transform,e)}calculateCameraOptionsFromTo(e,t,r,i){return null==i&&this.terrain&&(i=this.terrain.getElevationForLngLatZoom(r,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(e,t,r,i)}resize(e,r=!0){const[i,n]=this._containerDimensions(),o=this._getClampedPixelRatio(i,n);if(this._resizeCanvas(i,n,o),this.painter.resize(i,n,o),this.painter.overLimit()){const e=this.painter.context.gl;this._maxCanvasSize=[e.drawingBufferWidth,e.drawingBufferHeight];const t=this._getClampedPixelRatio(i,n);this._resizeCanvas(i,n,t),this.painter.resize(i,n,t)}this._resizeTransform(r);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[r,i]=this._containerDimensions();this.transform.resize(r,i,e),null===(t=this._requestedCameraState)||void 0===t||t.resize(r,i,e)}_getClampedPixelRatio(e,t){const{0:r,1:i}=this._maxCanvasSize,n=this.getPixelRatio(),o=e*n,a=t*n;return Math.min(o>r?r/o:1,a>i?i/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(Z.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()}setTransformConstrain(e){return this.transform.setConstrainOverride(e),this._update()}project(e){return this.transform.locationToScreenPoint(t.V.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,r){if("mouseenter"===e||"mouseover"===e){let i=!1;const n=n=>{const o=t.filter(e=>this.getLayer(e)),a=0!==o.length?this.queryRenderedFeatures(n.point,{layers:o}):[];a.length?i||(i=!0,r.call(this,new Kn(e,this,n.originalEvent,{features:a}))):i=!1};return{layers:t,listener:r,delegates:{mousemove:n,mouseout:()=>{i=!1}}}}if("mouseleave"===e||"mouseout"===e){let i=!1;const n=n=>{const o=t.filter(e=>this.getLayer(e));(0!==o.length?this.queryRenderedFeatures(n.point,{layers:o}):[]).length?i=!0:i&&(i=!1,r.call(this,new Kn(e,this,n.originalEvent)))},o=t=>{i&&(i=!1,r.call(this,new Kn(e,this,t.originalEvent)))};return{layers:t,listener:r,delegates:{mousemove:n,mouseout:o}}}{const i=e=>{const i=t.filter(e=>this.getLayer(e)),n=0!==i.length?this.queryRenderedFeatures(e.point,{layers:i}):[];n.length&&(e.features=n,r.call(this,e),delete e.features)};return{layers:t,listener:r,delegates:{[e]:i}}}}_saveDelegatedListener(e,t){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(t)}_removeDelegatedListener(e,t,r){if(!this._delegatedListeners||!this._delegatedListeners[e])return;const i=this._delegatedListeners[e];for(let n=0;n<i.length;n++){const e=i[n];if(e.listener===r&&e.layers.length===t.length&&e.layers.every(e=>t.includes(e))){for(const t in e.delegates)this.off(t,e.delegates[t]);return void i.splice(n,1)}}}on(e,t,r){if(void 0===r)return super.on(e,t);const i="string"==typeof t?[t]:t,n=this._createDelegatedListener(e,i,r);this._saveDelegatedListener(e,n);for(const o in n.delegates)this.on(o,n.delegates[o]);return{unsubscribe:()=>{this._removeDelegatedListener(e,i,r)}}}once(e,t,r){if(void 0===r)return super.once(e,t);const i="string"==typeof t?[t]:t,n=this._createDelegatedListener(e,i,r);for(const o in n.delegates){const t=n.delegates[o];n.delegates[o]=(...n)=>{this._removeDelegatedListener(e,i,r),t(...n)}}this._saveDelegatedListener(e,n);for(const o in n.delegates)this.once(o,n.delegates[o]);return this}off(e,t,r){return void 0===r?super.off(e,t):(this._removeDelegatedListener(e,"string"==typeof t?[t]:t,r),this)}queryRenderedFeatures(e,r){if(!this.style)return[];let i;const n=e instanceof t.P||Array.isArray(e),o=n?e:[[0,0],[this.transform.width,this.transform.height]];if(r=r||(n?{}:e)||{},o instanceof t.P||"number"==typeof o[0])i=[t.P.convert(o)];else{const e=t.P.convert(o[0]),r=t.P.convert(o[1]);i=[e,new t.P(r.x,e.y),r,new t.P(e.x,r.y),e]}return this.style.queryRenderedFeatures(i,r,this.transform)}querySourceFeatures(e,t){return this.style.querySourceFeatures(e,t)}setStyle(e,r){return!1!==(r=t.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},r)).diff&&r.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,r),this):(this._localIdeographFontFamily=r.localIdeographFontFamily,this._updateStyle(e,r))}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 r,i;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 Ar(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===(i=null===(r=this.style)||void 0===r?void 0:r.projection)||void 0===i||i.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Ar(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(e,r){if("string"==typeof e){const i=this._requestManager.transformRequest(e,"Style");t.j(i,new AbortController).then(e=>{this._updateDiff(e.data,r)}).catch(e=>{e&&this.fire(new t.k(e))})}else"object"==typeof e&&this._updateDiff(e,r)}_updateDiff(e,r){try{this.style.setState(e,r)&&this._update(!0)}catch(i){t.w(`Unable to perform style diff: ${i.message||i.error||i}. Rebuilding the style from scratch.`),this._updateStyle(e,r)}}getStyle(){if(this.style)return this.style.serialize()}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}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 r=this.style&&this.style.tileManagers[e];if(void 0!==r)return r.loaded();this.fire(new t.k(new Error(`There is no tile manager with ID '${e}'`)))}setTerrain(e){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),e){const r=this.style.tileManagers[e.source];if(!r)throw new Error(`cannot load terrain, because there exists no source with ID: ${e.source}`);null===this.terrain&&r.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."),"color-relief"===r.type&&r.source===e.source&&t.w("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new Jo(this.painter,r,e),this.painter.renderToTexture=new ea(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 r;"style"===t.dataType?this.terrain.tileManager.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===(r=t.source)||void 0===r?void 0:r.type)?this.terrain.tileManager.freeRtt():this.terrain.tileManager.freeRtt(t.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.tileManager.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.tileManagers;for(const t in e){const r=e[t]._tiles;for(const e in r){const t=r[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)}setSourceTileLodParams(e,t,r){if(r){const i=this.getSource(r);if(!i)throw new Error(`There is no source with ID "${r}", cannot set LOD parameters`);i.calculateTileZoom=we(Math.max(1,e),Math.max(1,t))}else for(const i in this.style.tileManagers)this.style.tileManagers[i].getSource().calculateTileZoom=we(Math.max(1,e),Math.max(1,t));return this._update(!0),this}refreshTiles(e,r){const i=this.style.tileManagers[e];if(!i)throw new Error(`There is no tile manager with ID "${e}", cannot refresh tile`);void 0===r?i.reload(!0):i.refreshTiles(r.map(e=>new t.ad(e.z,e.x,e.y)))}addImage(e,r,i={}){const{pixelRatio:n=1,sdf:o=!1,stretchX:a,stretchY:l,content:c,textFitWidth:u,textFitHeight:h}=i;if(this._lazyInitEmptyStyle(),!(r instanceof HTMLImageElement||t.b(r))){if(void 0===r.width||void 0===r.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:i,height:s,data:d}=r,p=r;return this.style.addImage(e,{data:new t.R({width:i,height:s},new Uint8Array(d)),pixelRatio:n,stretchX:a,stretchY:l,content:c,textFitWidth:u,textFitHeight:h,sdf:o,version:0,userImage:p}),p.onAdd&&p.onAdd(this,e),this}}{const{width:i,height:d,data:p}=s.getImageData(r);this.style.addImage(e,{data:new t.R({width:i,height:d},p),pixelRatio:n,stretchX:a,stretchY:l,content:c,textFitWidth:u,textFitHeight:h,sdf:o,version:0})}}updateImage(e,r){const i=this.style.getImage(e);if(!i)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=r instanceof HTMLImageElement||t.b(r)?s.getImageData(r):r,{width:o,height:a,data:l}=n;if(void 0===o||void 0===a)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!==i.data.width||a!==i.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=!(r instanceof HTMLImageElement||t.b(r));return i.data.replace(l,c),this.style.updateImage(e,i),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 _.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,r){return this.style.setLayerZoomRange(e,t,r),this._update(!0)}setFilter(e,t,r={}){return this.style.setFilter(e,t,r),this._update(!0)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,t,r,i={}){return this.style.setPaintProperty(e,t,r,i),this._update(!0)}getPaintProperty(e,t){return this.style.getPaintProperty(e,t)}setLayoutProperty(e,t,r,i={}){return this.style.setLayoutProperty(e,t,r,i),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,r={}){return this._lazyInitEmptyStyle(),this.style.addSprite(e,t,r,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=u.create("div","maplibregl-canvas-container",e);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=u.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 r=this._containerDimensions(),i=this._getClampedPixelRatio(r[0],r[1]);this._resizeCanvas(r[0],r[1],i);const n=this._controlContainer=u.create("div","maplibregl-control-container",e),o=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(e=>{o[e]=u.create("div",`maplibregl-ctrl-${e} `,n)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(e,t,r){this._canvas.width=Math.floor(r*e),this._canvas.height=Math.floor(r*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",r=>{t={requestedAttributes:e},r&&(t.statusMessage=r.statusMessage,t.type=r.type)},{once:!0});let r=null;if(r=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,e):this._canvas.getContext("webgl2",e)||this._canvas.getContext("webgl",e),!r){const e="Failed to initialize WebGL";throw t?(t.message=e,new Error(JSON.stringify(t))):new Error(e)}this.painter=new jn(r,this.transform),h.testSupport(r)}migrateProjection(e,r){super.migrateProjection(e,r),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 r,i,n,o,a;const s=this._idleTriggered?this._fadeDuration:0,l=(null===(r=this.style.projection)||void 0===r?void 0:r.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,r=c();this.style.zoomHistory.update(e,r);const i=new t.H(e,{now:r,fadeDuration:s,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),n=i.crossFadingFactor();1===n&&n===this._crossFadingFactor||(u=!0,this._crossFadingFactor=n),this.style.update(i)}const h=(null===(i=this.style.projection)||void 0===i?void 0:i.transitionState)>0!==l;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===(a=this.style.projection)||void 0===a?void 0:a.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||h)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.tileManager.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,s,this._crossSourceCollisions,h),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:s,showPadding:this.showPadding}),this.fire(new t.l("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,t.cF.mark(t.cG.load),this.fire(new t.l("load"))),this.style&&(this.style.hasTransitions()||u)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const d=this._sourcesDirty||this._styleDirty||this._placementDirty;return d||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new t.l("idle")),!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,t.cF.mark(t.cG.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 t of this._controls)t.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),_.removeThrottleControl(this._imageQueueHandle),null===(e=this._resizeObserver)||void 0===e||e.disconnect();const r=this.painter.context.gl.getExtension("WEBGL_lose_context");(null==r?void 0:r.loseContext)&&r.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),u.remove(this._canvasContainer),u.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),t.cF.clearMetrics(),this._removed=!0,this.fire(new t.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,s.frame(this._frameRequest,e=>{t.cF.frame(e),this._frameRequest=null;try{this._render(e)}catch(e){if(!t.cH(e)&&!function(e){return e.message===Qi}(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 ra}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(e){return this._lazyInitEmptyStyle(),this.style.setProjection(e),this._update(!0)}},e.MapMouseEvent=Kn,e.MapTouchEvent=Qn,e.MapWheelEvent=eo,e.Marker=ua,e.NavigationControl=class{constructor(e){this._updateZoomButtons=()=>{const e=this._map.getZoom(),t=e===this._map.getMaxZoom(),r=e===this._map.getMinZoom();this._zoomInButton.disabled=t,this._zoomOutButton.disabled=r,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",r.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 r=this._map._getUIString(`NavigationControl.${t}`);e.title=r,e.setAttribute("aria-label",r)},this.options=t.e({},na,e),this._container=u.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})),u.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})),u.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=u.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 oa(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){u.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 r=u.create("button",e,this._container);return r.type="button",r.addEventListener("click",t),r}},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}`:"")},this.remove=()=>(this._content&&u.remove(this._content),this._container&&(u.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),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=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=u.create("div","maplibregl-popup",this._map.getContainer()),this._tip=u.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=sa(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),this._trackPointer&&!e)return;const t=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 i=va(this.options.offset);if(!r){const e=this._container.offsetWidth,n=this._container.offsetHeight;let o;o=t.y+i.bottom.y<n?["top"]:t.y>this._map.transform.height-n?["bottom"]:[],t.x<e/2?o.push("left"):t.x>this._map.transform.width-e/2&&o.push("right"),r=0===o.length?"bottom":o.join("-")}let n=t.add(i[r]);this.options.subpixelPositioning||(n=n.round()),u.setTransform(this._container,`${la[r]} translate(${n.x}px,${n.y}px)`),ca(this._container,r,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=t.e(Object.create(_a),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.V.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(),r=document.createElement("body");let i;for(r.innerHTML=e;i=r.firstChild,i;)t.appendChild(i);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=u.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=u.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const e=this._container.querySelector(ya);e&&e.focus()}},e.RasterDEMTileSource=J,e.RasterTileSource=Y,e.ScaleControl=class{constructor(e){this._onMove=()=>{ma(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,ma(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},fa),e)}getDefaultPosition(){return"bottom-left"}onAdd(e){return this._map=e,this._container=u.create("div","maplibregl-ctrl maplibregl-ctrl-scale",e.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){u.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},e.ScrollZoomHandler=Do,e.Style=Ar,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=u.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=u.create("button","maplibregl-ctrl-terrain",this._container),u.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(){u.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},e.TwoFingersTouchPitchHandler=Io,e.TwoFingersTouchRotateHandler=So,e.TwoFingersTouchZoomHandler=wo,e.TwoFingersTouchZoomRotateHandler=Bo,e.VectorTileSource=X,e.VideoSource=re,e.addSourceType=(e,r)=>t._(void 0,void 0,void 0,function*(){if(oe(e))throw new Error(`A source type called "${e}" already exists.`);((e,t)=>{ne[e]=t})(e,r)}),e.clearPrewarmedResources=function(){const e=z;e&&(e.isPreloaded()&&1===e.numActive()?(e.release(L),z=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=rr,e.getMaxParallelImageRequests=function(){return t.a.MAX_PARALLEL_IMAGE_REQUESTS},e.getRTLTextPluginStatus=function(){return ce().getRTLTextPluginStatus()},e.getVersion=function(){return ba},e.getWorkerCount=function(){return F.workerCount},e.getWorkerUrl=function(){return t.a.WORKER_URL},e.importScriptInWorkers=function(e){return V().broadcast("IS",e)},e.isTimeFrozen=function(){return l.isFrozen()},e.now=c,e.prewarm=function(){N().acquire(L)},e.restoreNow=function(){l.restoreNow()},e.setMaxParallelImageRequests=function(e){t.a.MAX_PARALLEL_IMAGE_REQUESTS=e},e.setNow=function(e){l.setNow(e)},e.setRTLTextPlugin=function(e,t){return ce().setRTLTextPlugin(e,t)},e.setWorkerCount=function(e){F.workerCount=e},e.setWorkerUrl=function(e){t.a.WORKER_URL=e}}),e}()),ge.exports}var ye,ve=fe?me.exports:(fe=1,self,ye=e=>(()=>{var t={357:function(e){!function(t,r){e.exports=r()}(0,()=>{return e={276:function(){!function(e){e.console||(e.console={});for(var t,r,i=e.console,n=function(){},o=["memory"],a="assert,clear,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn".split(",");t=o.pop();)i[t]||(i[t]={});for(;r=a.pop();)i[r]||(i[r]=n)}("undefined"==typeof window?this:window)},180:function(e,t,r){var i,n,o;n=[r(124)],void 0===(o="function"==typeof(i=function(e){var t=/(^|@)\S+:\d+/,r=/^\s*at .*(\S+:\d+|\(native\))/m,i=/^(eval@)?(\[native code])?$/;return{parse:function(e){if(void 0!==e.stacktrace||void 0!==e["opera#sourceloc"])return this.parseOpera(e);if(e.stack&&e.stack.match(r))return this.parseV8OrIE(e);if(e.stack)return this.parseFFOrSafari(e);throw new Error("Cannot parse given Error object")},extractLocation:function(e){if(-1===e.indexOf(":"))return[e];var t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));return[t[1],t[2]||void 0,t[3]||void 0]},parseV8OrIE:function(t){return t.stack.split("\n").filter(function(e){return!!e.match(r)},this).map(function(t){t.indexOf("(eval ")>-1&&(t=t.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));var r=t.replace(/^\s+/,"").replace(/\(eval code/g,"("),i=r.match(/ (\((.+):(\d+):(\d+)\)$)/),n=(r=i?r.replace(i[0],""):r).split(/\s+/).slice(1),o=this.extractLocation(i?i[1]:n.pop()),a=n.join(" ")||void 0,s=["eval","<anonymous>"].indexOf(o[0])>-1?void 0:o[0];return new e({functionName:a,fileName:s,lineNumber:o[1],columnNumber:o[2],source:t})},this)},parseFFOrSafari:function(t){return t.stack.split("\n").filter(function(e){return!e.match(i)},this).map(function(t){if(t.indexOf(" > eval")>-1&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===t.indexOf("@")&&-1===t.indexOf(":"))return new e({functionName:t});var r=/((.*".+"[^@]*)?[^@]*)(?:@)/,i=t.match(r),n=i&&i[1]?i[1]:void 0,o=this.extractLocation(t.replace(r,""));return new e({functionName:n,fileName:o[0],lineNumber:o[1],columnNumber:o[2],source:t})},this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(t){for(var r=/Line (\d+).*script (?:in )?(\S+)/i,i=t.message.split("\n"),n=[],o=2,a=i.length;o<a;o+=2){var s=r.exec(i[o]);s&&n.push(new e({fileName:s[2],lineNumber:s[1],source:i[o]}))}return n},parseOpera10:function(t){for(var r=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,i=t.stacktrace.split("\n"),n=[],o=0,a=i.length;o<a;o+=2){var s=r.exec(i[o]);s&&n.push(new e({functionName:s[3]||void 0,fileName:s[2],lineNumber:s[1],source:i[o]}))}return n},parseOpera11:function(r){return r.stack.split("\n").filter(function(e){return!!e.match(t)&&!e.match(/^Error created at/)},this).map(function(t){var r,i=t.split("@"),n=this.extractLocation(i.pop()),o=i.shift()||"",a=o.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;o.match(/\(([^)]*)\)/)&&(r=o.replace(/^[^(]+\(([^)]*)\)$/,"$1"));var s=void 0===r||"[arguments not available]"===r?void 0:r.split(",");return new e({functionName:a,args:s,fileName:n[0],lineNumber:n[1],columnNumber:n[2],source:t})},this)}}})?i.apply(t,n):i)||(e.exports=o)},124:function(e,t){var r,i;void 0===(i="function"==typeof(r=function(){function e(e){return!isNaN(parseFloat(e))&&isFinite(e)}function t(e){return e.charAt(0).toUpperCase()+e.substring(1)}function r(e){return function(){return this[e]}}var i=["isConstructor","isEval","isNative","isToplevel"],n=["columnNumber","lineNumber"],o=["fileName","functionName","source"],a=i.concat(n,o,["args"],["evalOrigin"]);function s(e){if(e)for(var r=0;r<a.length;r++)void 0!==e[a[r]]&&this["set"+t(a[r])](e[a[r]])}s.prototype={getArgs:function(){return this.args},setArgs:function(e){if("[object Array]"!==Object.prototype.toString.call(e))throw new TypeError("Args must be an Array");this.args=e},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(e){if(e instanceof s)this.evalOrigin=e;else{if(!(e instanceof Object))throw new TypeError("Eval Origin must be an Object or StackFrame");this.evalOrigin=new s(e)}},toString:function(){var e=this.getFileName()||"",t=this.getLineNumber()||"",r=this.getColumnNumber()||"",i=this.getFunctionName()||"";return this.getIsEval()?e?"[eval] ("+e+":"+t+":"+r+")":"[eval]:"+t+":"+r:i?i+" ("+e+":"+t+":"+r+")":e+":"+t+":"+r}},s.fromString=function(e){var t=e.indexOf("("),r=e.lastIndexOf(")"),i=e.substring(0,t),n=e.substring(t+1,r).split(","),o=e.substring(r+1);if(0===o.indexOf("@"))var a=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(o,""),l=a[1],c=a[2],u=a[3];return new s({functionName:i,args:n||void 0,fileName:l,lineNumber:c||void 0,columnNumber:u||void 0})};for(var l=0;l<i.length;l++)s.prototype["get"+t(i[l])]=r(i[l]),s.prototype["set"+t(i[l])]=function(e){return function(t){this[e]=Boolean(t)}}(i[l]);for(var c=0;c<n.length;c++)s.prototype["get"+t(n[c])]=r(n[c]),s.prototype["set"+t(n[c])]=function(t){return function(r){if(!e(r))throw new TypeError(t+" must be a Number");this[t]=Number(r)}}(n[c]);for(var u=0;u<o.length;u++)s.prototype["get"+t(o[u])]=r(o[u]),s.prototype["set"+t(o[u])]=function(e){return function(t){this[e]=String(t)}}(o[u]);return s})?r.apply(t,[]):r)||(e.exports=i)},815:(e,t,r)=>{var i=r(702),n=r(817),o={hostname:"api.rollbar.com",path:"/api/1/item/",search:null,version:"1",protocol:"https:",port:443};function a(e,t,r,i,n){this.options=e,this.transport=t,this.url=r,this.truncation=i,this.jsonBackup=n,this.accessToken=e.accessToken,this.transportOptions=s(e,r)}function s(e,t){return n.getTransportFromOptions(e,o,t)}a.prototype.postItem=function(e,t){var r=n.transportOptions(this.transportOptions,"POST"),i=n.buildPayload(this.accessToken,e,this.jsonBackup),o=this;setTimeout(function(){o.transport.post(o.accessToken,r,i,t)},0)},a.prototype.buildJsonPayload=function(e,t){var r,o=n.buildPayload(this.accessToken,e,this.jsonBackup);return(r=this.truncation?this.truncation.truncate(o):i.stringify(o)).error?(t&&t(r.error),null):r.value},a.prototype.postJsonPayload=function(e,t){var r=n.transportOptions(this.transportOptions,"POST");this.transport.postJsonPayload(this.accessToken,r,e,t)},a.prototype.configure=function(e){var t=this.oldOptions;return this.options=i.merge(t,e),this.transportOptions=s(this.options,this.url),void 0!==this.options.accessToken&&(this.accessToken=this.options.accessToken),this},e.exports=a},817:(e,t,r)=>{var i=r(702);e.exports={buildPayload:function(e,t,r){if(!i.isType(t.context,"string")){var n=i.stringify(t.context,r);n.error?t.context="Error: could not serialize 'context'":t.context=n.value||"",t.context.length>255&&(t.context=t.context.substr(0,255))}return{access_token:e,data:t}},getTransportFromOptions:function(e,t,r){var i=t.hostname,n=t.protocol,o=t.port,a=t.path,s=t.search,l=e.timeout,c=function(e){var t="undefined"!=typeof window&&window||"undefined"!=typeof self&&self,r=e.defaultTransport||"xhr";return void 0===t.fetch&&(r="xhr"),void 0===t.XMLHttpRequest&&(r="fetch"),r}(e),u=e.proxy;if(e.endpoint){var h=r.parse(e.endpoint);i=h.hostname,n=h.protocol,o=h.port,a=h.pathname,s=h.search}return{timeout:l,hostname:i,protocol:n,port:o,path:a,search:s,proxy:u,transport:c}},transportOptions:function(e,t){var r=e.protocol||"https:",i=e.port||("http:"===r?80:"https:"===r?443:void 0),n=e.hostname,o=e.path,a=e.timeout,s=e.transport;return e.search&&(o+=e.search),e.proxy&&(o=r+"//"+n+o,n=e.proxy.host||e.proxy.hostname,i=e.proxy.port,r=e.proxy.protocol||r),{timeout:a,protocol:r,hostname:n,path:o,port:i,method:t,transport:s}},appendPathToPath:function(e,t){var r=/\/$/.test(e),i=/^\//.test(t);return r&&i?t=t.substring(1):r||i||(t="/"+t),e+t}}},409:(e,t,r)=>{var i=r(343),n="undefined"!=typeof window&&window._rollbarConfig,o=n&&n.globalAlias||"Rollbar",a="undefined"!=typeof window&&window[o]&&"function"==typeof window[o].shimId&&void 0!==window[o].shimId();if("undefined"==typeof window||window._rollbarStartTime||(window._rollbarStartTime=(new Date).getTime()),!a&&n){var s=new i(n);window[o]=s}else"undefined"!=typeof window?(window.rollbar=i,window._rollbarDidLoad=!0):"undefined"!=typeof self&&(self.rollbar=i,self._rollbarDidLoad=!0);e.exports=i},403:(e,t,r)=>{var i=r(562),n=r(702),o=r(815),a=r(802),s=r(349),l=r(477),c=r(509),u=r(860),h=r(417),d=r(172),p=r(61),f=r(303);function m(e,t){this.options=n.handleOptions(w,e,null,a),this.options._configuredOptions=e;var r=this.components.telemeter,s=this.components.instrumenter,f=this.components.polyfillJSON;this.wrapGlobals=this.components.wrapGlobals,this.scrub=this.components.scrub;var m=this.components.truncation,g=new l(m),_=new o(this.options,g,c,m);r&&(this.telemeter=new r(this.options)),this.client=t||new i(this.options,_,a,this.telemeter,"browser");var y=v(),b="undefined"!=typeof document&&document;this.isChrome=y.chrome&&y.chrome.runtime,this.anonymousErrorsPending=0,function(e,t,r){e.addTransform(u.handleDomException).addTransform(u.handleItemWithError).addTransform(u.ensureItemHasSomethingToSay).addTransform(u.addBaseInfo).addTransform(u.addRequestInfo(r)).addTransform(u.addClientInfo(r)).addTransform(u.addPluginInfo(r)).addTransform(u.addBody).addTransform(h.addMessageWithError).addTransform(h.addTelemetryData).addTransform(h.addConfigToPayload).addTransform(u.addScrubber(t.scrub)).addTransform(h.addPayloadOptions).addTransform(h.userTransform(a)).addTransform(h.addConfiguredOptions).addTransform(h.addDiagnosticKeys).addTransform(h.itemToPayload)}(this.client.notifier,this,y),this.client.queue.addPredicate(p.checkLevel).addPredicate(d.checkIgnore).addPredicate(p.userCheckIgnore(a)).addPredicate(p.urlIsNotBlockListed(a)).addPredicate(p.urlIsSafeListed(a)).addPredicate(p.messageIsIgnored(a)),this.setupUnhandledCapture(),s&&(this.instrumenter=new s(this.options,this.client.telemeter,this,y,b),this.instrumenter.instrument()),n.setupJSON(f),this.rollbar=this}var g=null;function _(e){var t="Rollbar is not initialized";a.error(t),e&&e(new Error(t))}function y(e){for(var t=0,r=e.length;t<r;++t)if(n.isFunction(e[t]))return e[t]}function v(){return"undefined"!=typeof window&&window||"undefined"!=typeof self&&self}m.init=function(e,t){return g?g.global(e).configure(e):g=new m(e,t)},m.prototype.components={},m.setComponents=function(e){m.prototype.components=e},m.prototype.global=function(e){return this.client.global(e),this},m.global=function(e){if(g)return g.global(e);_()},m.prototype.configure=function(e,t){var r=this.options,i={};return t&&(i={payload:t}),this.options=n.handleOptions(r,e,i,a),this.options._configuredOptions=n.handleOptions(r._configuredOptions,e,i),this.client.configure(this.options,t),this.instrumenter&&this.instrumenter.configure(this.options),this.setupUnhandledCapture(),this},m.configure=function(e,t){if(g)return g.configure(e,t);_()},m.prototype.lastError=function(){return this.client.lastError},m.lastError=function(){if(g)return g.lastError();_()},m.prototype.log=function(){var e=this._createItem(arguments),t=e.uuid;return this.client.log(e),{uuid:t}},m.log=function(){if(g)return g.log.apply(g,arguments);_(y(arguments))},m.prototype.debug=function(){var e=this._createItem(arguments),t=e.uuid;return this.client.debug(e),{uuid:t}},m.debug=function(){if(g)return g.debug.apply(g,arguments);_(y(arguments))},m.prototype.info=function(){var e=this._createItem(arguments),t=e.uuid;return this.client.info(e),{uuid:t}},m.info=function(){if(g)return g.info.apply(g,arguments);_(y(arguments))},m.prototype.warn=function(){var e=this._createItem(arguments),t=e.uuid;return this.client.warn(e),{uuid:t}},m.warn=function(){if(g)return g.warn.apply(g,arguments);_(y(arguments))},m.prototype.warning=function(){var e=this._createItem(arguments),t=e.uuid;return this.client.warning(e),{uuid:t}},m.warning=function(){if(g)return g.warning.apply(g,arguments);_(y(arguments))},m.prototype.error=function(){var e=this._createItem(arguments),t=e.uuid;return this.client.error(e),{uuid:t}},m.error=function(){if(g)return g.error.apply(g,arguments);_(y(arguments))},m.prototype.critical=function(){var e=this._createItem(arguments),t=e.uuid;return this.client.critical(e),{uuid:t}},m.critical=function(){if(g)return g.critical.apply(g,arguments);_(y(arguments))},m.prototype.buildJsonPayload=function(e){return this.client.buildJsonPayload(e)},m.buildJsonPayload=function(){if(g)return g.buildJsonPayload.apply(g,arguments);_()},m.prototype.sendJsonPayload=function(e){return this.client.sendJsonPayload(e)},m.sendJsonPayload=function(){if(g)return g.sendJsonPayload.apply(g,arguments);_()},m.prototype.setupUnhandledCapture=function(){var e=v();this.unhandledExceptionsInitialized||(this.options.captureUncaught||this.options.handleUncaughtExceptions)&&(s.captureUncaughtExceptions(e,this),this.wrapGlobals&&this.options.wrapGlobalEventHandlers&&this.wrapGlobals(e,this),this.unhandledExceptionsInitialized=!0),this.unhandledRejectionsInitialized||(this.options.captureUnhandledRejections||this.options.handleUnhandledRejections)&&(s.captureUnhandledRejections(e,this),this.unhandledRejectionsInitialized=!0)},m.prototype.handleUncaughtException=function(e,t,r,i,o,a){if(this.options.captureUncaught||this.options.handleUncaughtExceptions){if(this.options.inspectAnonymousErrors&&this.isChrome&&null===o&&""===t)return"anonymous";var s,l=n.makeUnhandledStackInfo(e,t,r,i,o,"onerror","uncaught exception",f);n.isError(o)?(s=this._createItem([e,o,a]))._unhandledStackInfo=l:n.isError(t)?(s=this._createItem([e,t,a]))._unhandledStackInfo=l:(s=this._createItem([e,a])).stackInfo=l,s.level=this.options.uncaughtErrorLevel,s._isUncaught=!0,this.client.log(s)}},m.prototype.handleAnonymousErrors=function(){if(this.options.inspectAnonymousErrors&&this.isChrome){var e=this;try{Error.prepareStackTrace=function(t,r){if(e.options.inspectAnonymousErrors&&e.anonymousErrorsPending){if(e.anonymousErrorsPending-=1,!t)return;t._isAnonymous=!0,e.handleUncaughtException(t.message,null,null,null,t)}return t.stack}}catch(e){this.options.inspectAnonymousErrors=!1,this.error("anonymous error handler failed",e)}}},m.prototype.handleUnhandledRejection=function(e,t){if(this.options.captureUnhandledRejections||this.options.handleUnhandledRejections){var r="unhandled rejection was null or undefined!";if(e)if(e.message)r=e.message;else{var i=n.stringify(e);i.value&&(r=i.value)}var o,a=e&&e._rollbarContext||t&&t._rollbarContext;n.isError(e)?o=this._createItem([r,e,a]):(o=this._createItem([r,e,a])).stackInfo=n.makeUnhandledStackInfo(r,"",0,0,null,"unhandledrejection","",f),o.level=this.options.uncaughtErrorLevel,o._isUncaught=!0,o._originalArgs=o._originalArgs||[],o._originalArgs.push(t),this.client.log(o)}},m.prototype.wrap=function(e,t,r){try{var i;if(i=n.isFunction(t)?t:function(){return t||{}},!n.isFunction(e))return e;if(e._isWrap)return e;if(!e._rollbar_wrapped&&(e._rollbar_wrapped=function(){r&&n.isFunction(r)&&r.apply(this,arguments);try{return e.apply(this,arguments)}catch(r){var t=r;throw t&&window._rollbarWrappedError!==t&&(n.isType(t,"string")&&(t=new String(t)),t._rollbarContext=i()||{},t._rollbarContext._wrappedSource=e.toString(),window._rollbarWrappedError=t),t}},e._rollbar_wrapped._isWrap=!0,e.hasOwnProperty))for(var o in e)e.hasOwnProperty(o)&&"_rollbar_wrapped"!==o&&(e._rollbar_wrapped[o]=e[o]);return e._rollbar_wrapped}catch(t){return e}},m.wrap=function(e,t){if(g)return g.wrap(e,t);_()},m.prototype.captureEvent=function(){var e=n.createTelemetryEvent(arguments);return this.client.captureEvent(e.type,e.metadata,e.level)},m.captureEvent=function(){if(g)return g.captureEvent.apply(g,arguments);_()},m.prototype.captureDomContentLoaded=function(e,t){return t||(t=new Date),this.client.captureDomContentLoaded(t)},m.prototype.captureLoad=function(e,t){return t||(t=new Date),this.client.captureLoad(t)},m.prototype.loadFull=function(){a.info("Unexpected Rollbar.loadFull() called on a Notifier instance. This can happen when Rollbar is loaded multiple times.")},m.prototype._createItem=function(e){return n.createItem(e,a,this)};var b=r(948),x=r(677),w={version:b.version,scrubFields:x.scrubFields,logLevel:b.logLevel,reportLevel:b.reportLevel,uncaughtErrorLevel:b.uncaughtErrorLevel,endpoint:b.endpoint,verbose:!1,enabled:!0,transmit:!0,sendConfig:!1,includeItemsInTelemetry:!0,captureIp:!0,inspectAnonymousErrors:!0,ignoreDuplicateErrors:!0,wrapGlobalEventHandlers:!1};e.exports=m},677:e=>{e.exports={scrubFields:["pw","pass","passwd","password","secret","confirm_password","confirmPassword","password_confirmation","passwordConfirmation","access_token","accessToken","X-Rollbar-Access-Token","secret_key","secretKey","secretToken","cc-number","card number","cardnumber","cardnum","ccnum","ccnumber","cc num","creditcardnumber","credit card number","newcreditcardnumber","new credit card","creditcardno","credit card no","card#","card #","cc-csc","cvc","cvc2","cvv2","ccv2","security code","card verification","name on credit card","name on card","nameoncard","cardholder","card holder","name des karteninhabers","ccname","card type","cardtype","cc type","cctype","payment type","expiration date","expirationdate","expdate","cc-exp","ccmonth","ccyear"]}},616:e=>{var t={ieVersion:function(){var e;if("undefined"==typeof document)return e;for(var t=3,r=document.createElement("div"),i=r.getElementsByTagName("i");r.innerHTML="\x3c!--[if gt IE "+ ++t+"]><i></i><![endif]--\x3e",i[0];);return t>4?t:e}};e.exports=t},300:e=>{function t(e){return(e.getAttribute("type")||"").toLowerCase()}function r(e){if(!e||!e.tagName)return"";var t=[e.tagName];e.id&&t.push("#"+e.id),e.classes&&t.push("."+e.classes.join("."));for(var r=0;r<e.attributes.length;r++)t.push("["+e.attributes[r].key+'="'+e.attributes[r].value+'"]');return t.join("")}function i(e){if(!e||!e.tagName)return null;var t,r,i,n,o={};o.tagName=e.tagName.toLowerCase(),e.id&&(o.id=e.id),(t=e.className)&&"string"==typeof t&&(o.classes=t.split(/\s+/));var a=["type","name","title","alt"];for(o.attributes=[],n=0;n<a.length;n++)r=a[n],(i=e.getAttribute(r))&&o.attributes.push({key:r,value:i});return o}e.exports={describeElement:i,descriptionToString:r,elementArrayToString:function(e){for(var t,i,n=[],o=0,a=e.length-1;a>=0;a--){if(t=r(e[a]),i=o+3*n.length+t.length,a<e.length-1&&i>=83){n.unshift("...");break}n.unshift(t),o+=t.length}return n.join(" > ")},treeToArray:function(e){for(var t,r=[],n=0;e&&n<5&&"html"!==(t=i(e)).tagName;n++)r.unshift(t),e=e.parentNode;return r},getElementFromEvent:function(e,t){return e.target?e.target:t&&t.elementFromPoint?t.elementFromPoint(e.clientX,e.clientY):void 0},isDescribedElement:function(e,r,i){if(e.tagName.toLowerCase()!==r.toLowerCase())return!1;if(!i)return!0;e=t(e);for(var n=0;n<i.length;n++)if(i[n]===e)return!0;return!1},getElementType:t}},349:e=>{e.exports={captureUncaughtExceptions:function(e,t,r){if(e){var i;if("function"==typeof t._rollbarOldOnError)i=t._rollbarOldOnError;else if(e.onerror){for(i=e.onerror;i._rollbarOldOnError;)i=i._rollbarOldOnError;t._rollbarOldOnError=i}t.handleAnonymousErrors();var n=function(){var r=Array.prototype.slice.call(arguments,0);!function(e,t,r,i){e._rollbarWrappedError&&(i[4]||(i[4]=e._rollbarWrappedError),i[5]||(i[5]=e._rollbarWrappedError._rollbarContext),e._rollbarWrappedError=null);var n=t.handleUncaughtException.apply(t,i);r&&r.apply(e,i),"anonymous"===n&&(t.anonymousErrorsPending+=1)}(e,t,i,r)};r&&(n._rollbarOldOnError=i),e.onerror=n}},captureUnhandledRejections:function(e,t,r){if(e){"function"==typeof e._rollbarURH&&e._rollbarURH.belongsToShim&&e.removeEventListener("unhandledrejection",e._rollbarURH);var i=function(e){var r,i,n;try{r=e.reason}catch(e){r=void 0}try{i=e.promise}catch(e){i="[unhandledrejection] error getting `promise` from event"}try{n=e.detail,!r&&n&&(r=n.reason,i=n.promise)}catch(e){}r||(r="[unhandledrejection] error getting `reason` from event"),t&&t.handleUnhandledRejection&&t.handleUnhandledRejection(r,i)};i.belongsToShim=r,e._rollbarURH=i,e.addEventListener("unhandledrejection",i)}}}},802:(e,t,r)=>{r(276);var i=r(616),n=r(702);e.exports={error:function(){var e=Array.prototype.slice.call(arguments,0);e.unshift("Rollbar:"),i.ieVersion()<=8?console.error(n.formatArgsAsString(e)):console.error.apply(console,e)},info:function(){var e=Array.prototype.slice.call(arguments,0);e.unshift("Rollbar:"),i.ieVersion()<=8?console.info(n.formatArgsAsString(e)):console.info.apply(console,e)},log:function(){var e=Array.prototype.slice.call(arguments,0);e.unshift("Rollbar:"),i.ieVersion()<=8?console.log(n.formatArgsAsString(e)):console.log.apply(console,e)}}},172:(e,t,r)=>{var i=r(702);e.exports={checkIgnore:function(e,t){return!i.get(t,"plugins.jquery.ignoreAjaxErrors")||!i.get(e,"body.message.extra.isAjax")}}},343:(e,t,r)=>{var i=r(403),n=r(773),o=r(568),a=r(876),s=r(965),l=r(369),c=r(473);i.setComponents({telemeter:n,instrumenter:o,polyfillJSON:a,wrapGlobals:s,scrub:l,truncation:c}),e.exports=i},568:(e,t,r)=>{var i=r(702),n=r(650),o=r(297),a=r(369),s=r(509),l=r(300),c={network:!0,networkResponseHeaders:!1,networkResponseBody:!1,networkRequestHeaders:!1,networkRequestBody:!1,networkErrorOnHttp5xx:!1,networkErrorOnHttp4xx:!1,networkErrorOnHttp0:!1,log:!0,dom:!0,navigation:!0,connectivity:!0,contentSecurityPolicy:!0,errorOnContentSecurityPolicy:!1};function u(e,t){for(var r;e[t].length;)(r=e[t].shift())[0][r[1]]=r[2]}function h(e,t,r,n,o){this.options=e;var a=e.autoInstrument;!1===e.enabled||!1===a?this.autoInstrument={}:(i.isType(a,"object")||(a=c),this.autoInstrument=i.merge(c,a)),this.scrubTelemetryInputs=!!e.scrubTelemetryInputs,this.telemetryScrubber=e.telemetryScrubber,this.defaultValueScrubber=function(e){for(var t=[],r=0;r<e.length;++r)t.push(new RegExp(e[r],"i"));return function(e){var r=function(e){if(!e||!e.attributes)return null;for(var t=e.attributes,r=0;r<t.length;++r)if("name"===t[r].key)return t[r].value;return null}(e);if(!r)return!1;for(var i=0;i<t.length;++i)if(t[i].test(r))return!0;return!1}}(e.scrubFields),this.telemeter=t,this.rollbar=r,this.diagnostic=r.client.notifier.diagnostic,this._window=n||{},this._document=o||{},this.replacements={network:[],log:[],navigation:[],connectivity:[]},this.eventRemovers={dom:[],connectivity:[],contentsecuritypolicy:[]},this._location=this._window.location,this._lastHref=this._location&&this._location.href}function d(e){return"undefined"!=typeof URL&&e instanceof URL}h.prototype.configure=function(e){this.options=i.merge(this.options,e);var t=e.autoInstrument,r=i.merge(this.autoInstrument);!1===e.enabled||!1===t?this.autoInstrument={}:(i.isType(t,"object")||(t=c),this.autoInstrument=i.merge(c,t)),this.instrument(r),void 0!==e.scrubTelemetryInputs&&(this.scrubTelemetryInputs=!!e.scrubTelemetryInputs),void 0!==e.telemetryScrubber&&(this.telemetryScrubber=e.telemetryScrubber)},h.prototype.instrument=function(e){!this.autoInstrument.network||e&&e.network?!this.autoInstrument.network&&e&&e.network&&this.deinstrumentNetwork():this.instrumentNetwork(),!this.autoInstrument.log||e&&e.log?!this.autoInstrument.log&&e&&e.log&&this.deinstrumentConsole():this.instrumentConsole(),!this.autoInstrument.dom||e&&e.dom?!this.autoInstrument.dom&&e&&e.dom&&this.deinstrumentDom():this.instrumentDom(),!this.autoInstrument.navigation||e&&e.navigation?!this.autoInstrument.navigation&&e&&e.navigation&&this.deinstrumentNavigation():this.instrumentNavigation(),!this.autoInstrument.connectivity||e&&e.connectivity?!this.autoInstrument.connectivity&&e&&e.connectivity&&this.deinstrumentConnectivity():this.instrumentConnectivity(),!this.autoInstrument.contentSecurityPolicy||e&&e.contentSecurityPolicy?!this.autoInstrument.contentSecurityPolicy&&e&&e.contentSecurityPolicy&&this.deinstrumentContentSecurityPolicy():this.instrumentContentSecurityPolicy()},h.prototype.deinstrumentNetwork=function(){u(this.replacements,"network")},h.prototype.instrumentNetwork=function(){var e=this;function t(t,r){t in r&&i.isFunction(r[t])&&o(r,t,function(t){return e.rollbar.wrap(t)})}if("XMLHttpRequest"in this._window){var r=this._window.XMLHttpRequest.prototype;o(r,"open",function(e){return function(t,r){var n=d(r);return(i.isType(r,"string")||n)&&(r=n?r.toString():r,this.__rollbar_xhr?(this.__rollbar_xhr.method=t,this.__rollbar_xhr.url=r,this.__rollbar_xhr.status_code=null,this.__rollbar_xhr.start_time_ms=i.now(),this.__rollbar_xhr.end_time_ms=null):this.__rollbar_xhr={method:t,url:r,status_code:null,start_time_ms:i.now(),end_time_ms:null}),e.apply(this,arguments)}},this.replacements,"network"),o(r,"setRequestHeader",function(t){return function(r,n){return this.__rollbar_xhr||(this.__rollbar_xhr={}),i.isType(r,"string")&&i.isType(n,"string")&&(e.autoInstrument.networkRequestHeaders&&(this.__rollbar_xhr.request_headers||(this.__rollbar_xhr.request_headers={}),this.__rollbar_xhr.request_headers[r]=n),"content-type"===r.toLowerCase()&&(this.__rollbar_xhr.request_content_type=n)),t.apply(this,arguments)}},this.replacements,"network"),o(r,"send",function(r){return function(n){var a=this;function s(){if(a.__rollbar_xhr&&(null===a.__rollbar_xhr.status_code&&(a.__rollbar_xhr.status_code=0,e.autoInstrument.networkRequestBody&&(a.__rollbar_xhr.request=n),a.__rollbar_event=e.captureNetwork(a.__rollbar_xhr,"xhr",void 0)),a.readyState<2&&(a.__rollbar_xhr.start_time_ms=i.now()),a.readyState>3)){a.__rollbar_xhr.end_time_ms=i.now();var t=null;if(a.__rollbar_xhr.response_content_type=a.getResponseHeader("Content-Type"),e.autoInstrument.networkResponseHeaders){var r=e.autoInstrument.networkResponseHeaders;t={};try{var o,s;if(!0===r){var l=a.getAllResponseHeaders();if(l){var c,u,h=l.trim().split(/[\r\n]+/);for(s=0;s<h.length;s++)o=(c=h[s].split(": ")).shift(),u=c.join(": "),t[o]=u}}else for(s=0;s<r.length;s++)t[o=r[s]]=a.getResponseHeader(o)}catch(e){}}var d=null;if(e.autoInstrument.networkResponseBody)try{d=a.responseText}catch(e){}var p=null;(d||t)&&(p={},d&&(e.isJsonContentType(a.__rollbar_xhr.response_content_type)?p.body=e.scrubJson(d):p.body=d),t&&(p.headers=t)),p&&(a.__rollbar_xhr.response=p);try{var f=a.status;f=1223===f?204:f,a.__rollbar_xhr.status_code=f,a.__rollbar_event.level=e.telemeter.levelFromStatus(f),e.errorOnHttpStatus(a.__rollbar_xhr)}catch(e){}}}return t("onload",a),t("onerror",a),t("onprogress",a),"onreadystatechange"in a&&i.isFunction(a.onreadystatechange)?o(a,"onreadystatechange",function(t){return e.rollbar.wrap(t,void 0,s)}):a.onreadystatechange=s,a.__rollbar_xhr&&e.trackHttpErrors()&&(a.__rollbar_xhr.stack=(new Error).stack),r.apply(this,arguments)}},this.replacements,"network")}"fetch"in this._window&&o(this._window,"fetch",function(t){return function(r,o){for(var a=new Array(arguments.length),s=0,l=a.length;s<l;s++)a[s]=arguments[s];var c,u=a[0],h="GET",p=d(u);i.isType(u,"string")||p?c=p?u.toString():u:u&&(c=u.url,u.method&&(h=u.method)),a[1]&&a[1].method&&(h=a[1].method);var f={method:h,url:c,status_code:null,start_time_ms:i.now(),end_time_ms:null};if(a[1]&&a[1].headers){var m=n(a[1].headers);f.request_content_type=m.get("Content-Type"),e.autoInstrument.networkRequestHeaders&&(f.request_headers=e.fetchHeaders(m,e.autoInstrument.networkRequestHeaders))}return e.autoInstrument.networkRequestBody&&(a[1]&&a[1].body?f.request=a[1].body:a[0]&&!i.isType(a[0],"string")&&a[0].body&&(f.request=a[0].body)),e.captureNetwork(f,"fetch",void 0),e.trackHttpErrors()&&(f.stack=(new Error).stack),t.apply(this,a).then(function(t){f.end_time_ms=i.now(),f.status_code=t.status,f.response_content_type=t.headers.get("Content-Type");var r=null;e.autoInstrument.networkResponseHeaders&&(r=e.fetchHeaders(t.headers,e.autoInstrument.networkResponseHeaders));var n=null;return e.autoInstrument.networkResponseBody&&"function"==typeof t.text&&(n=t.clone().text()),(r||n)&&(f.response={},n&&("function"==typeof n.then?n.then(function(t){t&&e.isJsonContentType(f.response_content_type)?f.response.body=e.scrubJson(t):f.response.body=t}):f.response.body=n),r&&(f.response.headers=r)),e.errorOnHttpStatus(f),t})}},this.replacements,"network")},h.prototype.captureNetwork=function(e,t,r){return e.request&&this.isJsonContentType(e.request_content_type)&&(e.request=this.scrubJson(e.request)),this.telemeter.captureNetwork(e,t,r)},h.prototype.isJsonContentType=function(e){return!!(e&&i.isType(e,"string")&&e.toLowerCase().includes("json"))},h.prototype.scrubJson=function(e){return JSON.stringify(a(JSON.parse(e),this.options.scrubFields))},h.prototype.fetchHeaders=function(e,t){var r={};try{var i;if(!0===t){if("function"==typeof e.entries)for(var n=e.entries(),o=n.next();!o.done;)r[o.value[0]]=o.value[1],o=n.next()}else for(i=0;i<t.length;i++){var a=t[i];r[a]=e.get(a)}}catch(e){}return r},h.prototype.trackHttpErrors=function(){return this.autoInstrument.networkErrorOnHttp5xx||this.autoInstrument.networkErrorOnHttp4xx||this.autoInstrument.networkErrorOnHttp0},h.prototype.errorOnHttpStatus=function(e){var t=e.status_code;if(t>=500&&this.autoInstrument.networkErrorOnHttp5xx||t>=400&&this.autoInstrument.networkErrorOnHttp4xx||0===t&&this.autoInstrument.networkErrorOnHttp0){var r=new Error("HTTP request failed with Status "+t);r.stack=e.stack,this.rollbar.error(r,{skipFrames:1})}},h.prototype.deinstrumentConsole=function(){if("console"in this._window&&this._window.console.log)for(var e;this.replacements.log.length;)e=this.replacements.log.shift(),this._window.console[e[0]]=e[1]},h.prototype.instrumentConsole=function(){if("console"in this._window&&this._window.console.log){var e=this,t=this._window.console,r=["debug","info","warn","error","log"];try{for(var n=0,o=r.length;n<o;n++)a(r[n])}catch(e){this.diagnostic.instrumentConsole={error:e.message}}}function a(r){var n=t[r],o=t,a="warn"===r?"warning":r;t[r]=function(){var t=Array.prototype.slice.call(arguments),r=i.formatArgsAsString(t);e.telemeter.captureLog(r,a),n&&Function.prototype.apply.call(n,o,t)},e.replacements.log.push([r,n])}},h.prototype.deinstrumentDom=function(){("addEventListener"in this._window||"attachEvent"in this._window)&&this.removeListeners("dom")},h.prototype.instrumentDom=function(){if("addEventListener"in this._window||"attachEvent"in this._window){var e=this.handleClick.bind(this),t=this.handleBlur.bind(this);this.addListener("dom",this._window,"click","onclick",e,!0),this.addListener("dom",this._window,"blur","onfocusout",t,!0)}},h.prototype.handleClick=function(e){try{var t=l.getElementFromEvent(e,this._document),r=t&&t.tagName,i=l.isDescribedElement(t,"a")||l.isDescribedElement(t,"button");r&&(i||l.isDescribedElement(t,"input",["button","submit"]))?this.captureDomEvent("click",t):l.isDescribedElement(t,"input",["checkbox","radio"])&&this.captureDomEvent("input",t,t.value,t.checked)}catch(e){}},h.prototype.handleBlur=function(e){try{var t=l.getElementFromEvent(e,this._document);t&&t.tagName&&(l.isDescribedElement(t,"textarea")?this.captureDomEvent("input",t,t.value):l.isDescribedElement(t,"select")&&t.options&&t.options.length?this.handleSelectInputChanged(t):l.isDescribedElement(t,"input")&&!l.isDescribedElement(t,"input",["button","submit","hidden","checkbox","radio"])&&this.captureDomEvent("input",t,t.value))}catch(e){}},h.prototype.handleSelectInputChanged=function(e){if(e.multiple)for(var t=0;t<e.options.length;t++)e.options[t].selected&&this.captureDomEvent("input",e,e.options[t].value);else e.selectedIndex>=0&&e.options[e.selectedIndex]&&this.captureDomEvent("input",e,e.options[e.selectedIndex].value)},h.prototype.captureDomEvent=function(e,t,r,i){if(void 0!==r)if(this.scrubTelemetryInputs||"password"===l.getElementType(t))r="[scrubbed]";else{var n=l.describeElement(t);this.telemetryScrubber?this.telemetryScrubber(n)&&(r="[scrubbed]"):this.defaultValueScrubber(n)&&(r="[scrubbed]")}var o=l.elementArrayToString(l.treeToArray(t));this.telemeter.captureDom(e,o,r,i)},h.prototype.deinstrumentNavigation=function(){var e=this._window.chrome;!(e&&e.app&&e.app.runtime)&&this._window.history&&this._window.history.pushState&&u(this.replacements,"navigation")},h.prototype.instrumentNavigation=function(){var e=this._window.chrome;if(!(e&&e.app&&e.app.runtime)&&this._window.history&&this._window.history.pushState){var t=this;o(this._window,"onpopstate",function(e){return function(){var r=t._location.href;t.handleUrlChange(t._lastHref,r),e&&e.apply(this,arguments)}},this.replacements,"navigation"),o(this._window.history,"pushState",function(e){return function(){var r=arguments.length>2?arguments[2]:void 0;return r&&t.handleUrlChange(t._lastHref,r+""),e.apply(this,arguments)}},this.replacements,"navigation")}},h.prototype.handleUrlChange=function(e,t){var r=s.parse(this._location.href),i=s.parse(t),n=s.parse(e);this._lastHref=t,r.protocol===i.protocol&&r.host===i.host&&(t=i.path+(i.hash||"")),r.protocol===n.protocol&&r.host===n.host&&(e=n.path+(n.hash||"")),this.telemeter.captureNavigation(e,t)},h.prototype.deinstrumentConnectivity=function(){("addEventListener"in this._window||"body"in this._document)&&(this._window.addEventListener?this.removeListeners("connectivity"):u(this.replacements,"connectivity"))},h.prototype.instrumentConnectivity=function(){if("addEventListener"in this._window||"body"in this._document)if(this._window.addEventListener)this.addListener("connectivity",this._window,"online",void 0,function(){this.telemeter.captureConnectivityChange("online")}.bind(this),!0),this.addListener("connectivity",this._window,"offline",void 0,function(){this.telemeter.captureConnectivityChange("offline")}.bind(this),!0);else{var e=this;o(this._document.body,"ononline",function(t){return function(){e.telemeter.captureConnectivityChange("online"),t&&t.apply(this,arguments)}},this.replacements,"connectivity"),o(this._document.body,"onoffline",function(t){return function(){e.telemeter.captureConnectivityChange("offline"),t&&t.apply(this,arguments)}},this.replacements,"connectivity")}},h.prototype.handleCspEvent=function(e){var t="Security Policy Violation: blockedURI: "+e.blockedURI+", violatedDirective: "+e.violatedDirective+", effectiveDirective: "+e.effectiveDirective+", ";e.sourceFile&&(t+="location: "+e.sourceFile+", line: "+e.lineNumber+", col: "+e.columnNumber+", "),t+="originalPolicy: "+e.originalPolicy,this.telemeter.captureLog(t,"error"),this.handleCspError(t)},h.prototype.handleCspError=function(e){this.autoInstrument.errorOnContentSecurityPolicy&&this.rollbar.error(e)},h.prototype.deinstrumentContentSecurityPolicy=function(){"addEventListener"in this._document&&this.removeListeners("contentsecuritypolicy")},h.prototype.instrumentContentSecurityPolicy=function(){if("addEventListener"in this._document){var e=this.handleCspEvent.bind(this);this.addListener("contentsecuritypolicy",this._document,"securitypolicyviolation",null,e,!1)}},h.prototype.addListener=function(e,t,r,i,n,o){t.addEventListener?(t.addEventListener(r,n,o),this.eventRemovers[e].push(function(){t.removeEventListener(r,n,o)})):i&&(t.attachEvent(i,n),this.eventRemovers[e].push(function(){t.detachEvent(i,n)}))},h.prototype.removeListeners=function(e){for(;this.eventRemovers[e].length;)this.eventRemovers[e].shift()()},e.exports=h},860:(e,t,r)=>{var i=r(702),n=r(303),o=r(802);function a(e,t,r){var n=e.message,o=e.custom;n||(n="Item sent with null or missing arguments.");var a={body:n};o&&(a.extra=i.merge(o)),i.set(e,"data.body",{message:a}),r(null,e)}function s(e){var t=e.stackInfo.stack;return t&&0===t.length&&e._unhandledStackInfo&&e._unhandledStackInfo.stack&&(t=e._unhandledStackInfo.stack),t}function l(e,t,r){var o=e&&e.data.description,a=e&&e.custom,l=s(e),u=n.guessErrorClass(t.message),h={exception:{class:c(t,u[0],r),message:u[1]}};if(o&&(h.exception.description=o),l){var d,p,f,m,g,_,y,v;for(0===l.length&&(h.exception.stack=t.rawStack,h.exception.raw=String(t.rawException)),h.frames=[],y=0;y<l.length;++y)p={filename:(d=l[y]).url?i.sanitizeUrl(d.url):"(unknown)",lineno:d.line||null,method:d.func&&"?"!==d.func?d.func:"[anonymous]",colno:d.column},r.sendFrameUrl&&(p.url=d.url),p.method&&p.method.endsWith&&p.method.endsWith("_rollbar_wrapped")||(f=m=g=null,(_=d.context?d.context.length:0)&&(v=Math.floor(_/2),m=d.context.slice(0,v),f=d.context[v],g=d.context.slice(v)),f&&(p.code=f),(m||g)&&(p.context={},m&&m.length&&(p.context.pre=m),g&&g.length&&(p.context.post=g)),d.args&&(p.args=d.args),h.frames.push(p));h.frames.reverse(),a&&(h.extra=i.merge(a))}return h}function c(e,t,r){return e.name?e.name:r.guessErrorClass?t:"(unknown)"}e.exports={handleDomException:function(e,t,r){if(e.err&&"DOMException"===n.Stack(e.err).name){var i=new Error;i.name=e.err.name,i.message=e.err.message,i.stack=e.err.stack,i.nested=e.err,e.err=i}r(null,e)},handleItemWithError:function(e,t,r){if(e.data=e.data||{},e.err)try{e.stackInfo=e.err._savedStackTrace||n.parse(e.err,e.skipFrames),t.addErrorContext&&function(e){var t=[],r=e.err;for(t.push(r);r.nested||r.cause;)r=r.nested||r.cause,t.push(r);i.addErrorContext(e,t)}(e)}catch(t){o.error("Error while parsing the error object.",t);try{e.message=e.err.message||e.err.description||e.message||String(e.err)}catch(t){e.message=String(e.err)||String(t)}delete e.err}r(null,e)},ensureItemHasSomethingToSay:function(e,t,r){e.message||e.stackInfo||e.custom||r(new Error("No message, stack info, or custom data"),null),r(null,e)},addBaseInfo:function(e,t,r){var n=t.payload&&t.payload.environment||t.environment;e.data=i.merge(e.data,{environment:n,level:e.level,endpoint:t.endpoint,platform:"browser",framework:"browser-js",language:"javascript",server:{},uuid:e.uuid,notifier:{name:"rollbar-browser-js",version:t.version},custom:e.custom}),r(null,e)},addRequestInfo:function(e){return function(t,r,n){var o={};e&&e.location&&(o.url=e.location.href,o.query_string=e.location.search);var a="$remote_ip";r.captureIp?!0!==r.captureIp&&(a+="_anonymize"):a=null,a&&(o.user_ip=a),Object.keys(o).length>0&&i.set(t,"data.request",o),n(null,t)}},addClientInfo:function(e){return function(t,r,n){if(!e)return n(null,t);var o=e.navigator||{},a=e.screen||{};i.set(t,"data.client",{runtime_ms:t.timestamp-e._rollbarStartTime,timestamp:Math.round(t.timestamp/1e3),javascript:{browser:o.userAgent,language:o.language,cookie_enabled:o.cookieEnabled,screen:{width:a.width,height:a.height}}}),n(null,t)}},addPluginInfo:function(e){return function(t,r,n){if(!e||!e.navigator)return n(null,t);for(var o,a=[],s=e.navigator.plugins||[],l=0,c=s.length;l<c;++l)o=s[l],a.push({name:o.name,description:o.description});i.set(t,"data.client.javascript.plugins",a),n(null,t)}},addBody:function(e,t,r){e.stackInfo?e.stackInfo.traceChain?function(e,t,r){for(var n=e.stackInfo.traceChain,o=[],a=n.length,s=0;s<a;s++){var c=l(e,n[s],t);o.push(c)}i.set(e,"data.body",{trace_chain:o}),r(null,e)}(e,t,r):function(e,t,r){if(s(e)){var o=l(e,e.stackInfo,t);i.set(e,"data.body",{trace:o}),r(null,e)}else{var u=e.stackInfo,h=n.guessErrorClass(u.message),d=c(u,h[0],t),p=h[1];e.message=d+": "+p,a(e,0,r)}}(e,t,r):a(e,0,r)},addScrubber:function(e){return function(t,r,i){if(e){var n=r.scrubFields||[],o=r.scrubPaths||[];t.data=e(t.data,n,o)}i(null,t)}}}},477:(e,t,r)=>{var i=r(702),n=r(656),o=r(86);function a(e){this.truncation=e}a.prototype.get=function(e,t,r,n,o){n&&i.isFunction(n)||(n=function(){}),i.addParamsAndAccessTokenToPath(e,t,r);var a=i.formatUrl(t);this._makeZoneRequest(e,a,"GET",null,n,o,t.timeout,t.transport)},a.prototype.post=function(e,t,r,n,o){if(n&&i.isFunction(n)||(n=function(){}),!r)return n(new Error("Cannot send empty request"));var a;if((a=this.truncation?this.truncation.truncate(r):i.stringify(r)).error)return n(a.error);var s=a.value,l=i.formatUrl(t);this._makeZoneRequest(e,l,"POST",s,n,o,t.timeout,t.transport)},a.prototype.postJsonPayload=function(e,t,r,n,o){n&&i.isFunction(n)||(n=function(){});var a=i.formatUrl(t);this._makeZoneRequest(e,a,"POST",r,n,o,t.timeout,t.transport)},a.prototype._makeZoneRequest=function(){var e="undefined"!=typeof window&&window||void 0!==n&&n,t=e&&e.Zone&&e.Zone.current,r=Array.prototype.slice.call(arguments);if(t&&"angular"===t._name){var i=t._parent,n=this;i.run(function(){n._makeRequest.apply(void 0,r)})}else this._makeRequest.apply(void 0,r)},a.prototype._makeRequest=function(e,t,r,i,a,s,l,c){if("undefined"!=typeof RollbarProxy)return function(e,t){(new RollbarProxy).sendJsonPayload(e,function(e){},function(e){t(new Error(e))})}(i,a);"fetch"===c?n(e,t,r,i,a,l):o(e,t,r,i,a,s,l)},e.exports=a},656:(e,t,r)=>{var i=r(802),n=r(702);e.exports=function(e,t,r,o,a,s){var l,c;n.isFiniteNumber(s)&&(l=new AbortController,c=setTimeout(function(){l.abort()},s)),fetch(t,{method:r,headers:{"Content-Type":"application/json","X-Rollbar-Access-Token":e,signal:l&&l.signal},body:o}).then(function(e){return c&&clearTimeout(c),e.json()}).then(function(e){a(null,e)}).catch(function(e){i.error(e.message),a(e)})}},86:(e,t,r)=>{var i=r(702),n=r(802);function o(e,t){var r=new Error(e);return r.code=t||"ENOTFOUND",r}e.exports=function(e,t,r,a,s,l,c){var u;if(!(u=l?l():function(){var e,t,r=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}],i=r.length;for(t=0;t<i;t++)try{e=r[t]();break}catch(e){}return e}()))return s(new Error("No way to send a request"));try{try{var h=function(){try{if(h&&4===u.readyState){h=void 0;var e=i.jsonParse(u.responseText);if((a=u)&&a.status&&200===a.status)return void s(e.error,e.value);if(function(e){return e&&i.isType(e.status,"number")&&e.status>=400&&e.status<600}(u)){if(403===u.status){var t=e.value&&e.value.message;n.error(t)}s(new Error(String(u.status)))}else s(o("XHR response had no status code (likely connection failure)"))}}catch(e){var r;r=e&&e.stack?e:new Error(e),s(r)}var a};u.open(r,t,!0),u.setRequestHeader&&(u.setRequestHeader("Content-Type","application/json"),u.setRequestHeader("X-Rollbar-Access-Token",e)),i.isFiniteNumber(c)&&(u.timeout=c),u.onreadystatechange=h,u.send(a)}catch(e){if("undefined"!=typeof XDomainRequest){if(!window||!window.location)return s(new Error("No window available during request, unknown environment"));"http:"===window.location.href.substring(0,5)&&"https"===t.substring(0,5)&&(t="http"+t.substring(5));var d=new XDomainRequest;d.onprogress=function(){},d.ontimeout=function(){s(o("Request timed out","ETIMEDOUT"))},d.onerror=function(){s(new Error("Error during request"))},d.onload=function(){var e=i.jsonParse(d.responseText);s(e.error,e.value)},d.open(r,t,!0),d.send(a)}else s(new Error("Cannot find a method to transport a request"))}}catch(e){s(e)}}},509:e=>{e.exports={parse:function(e){var t,r,i={protocol:null,auth:null,host:null,path:null,hash:null,href:e,hostname:null,port:null,pathname:null,search:null,query:null};if(-1!==(t=e.indexOf("//"))?(i.protocol=e.substring(0,t),r=t+2):r=0,-1!==(t=e.indexOf("@",r))&&(i.auth=e.substring(r,t),r=t+1),-1===(t=e.indexOf("/",r))){if(-1===(t=e.indexOf("?",r)))return-1===(t=e.indexOf("#",r))?i.host=e.substring(r):(i.host=e.substring(r,t),i.hash=e.substring(t)),i.hostname=i.host.split(":")[0],i.port=i.host.split(":")[1],i.port&&(i.port=parseInt(i.port,10)),i;i.host=e.substring(r,t),i.hostname=i.host.split(":")[0],i.port=i.host.split(":")[1],i.port&&(i.port=parseInt(i.port,10)),r=t}else i.host=e.substring(r,t),i.hostname=i.host.split(":")[0],i.port=i.host.split(":")[1],i.port&&(i.port=parseInt(i.port,10)),r=t;if(-1===(t=e.indexOf("#",r))?i.path=e.substring(r):(i.path=e.substring(r,t),i.hash=e.substring(t)),i.path){var n=i.path.split("?");i.pathname=n[0],i.query=n[1],i.search=i.query?"?"+i.query:null}return i}}},965:e=>{function t(e,t,r){if(t.hasOwnProperty&&t.hasOwnProperty("addEventListener")){for(var i=t.addEventListener;i._rollbarOldAdd&&i.belongsToShim;)i=i._rollbarOldAdd;var n=function(t,r,n){i.call(this,t,e.wrap(r),n)};n._rollbarOldAdd=i,n.belongsToShim=r,t.addEventListener=n;for(var o=t.removeEventListener;o._rollbarOldRemove&&o.belongsToShim;)o=o._rollbarOldRemove;var a=function(e,t,r){o.call(this,e,t&&t._rollbar_wrapped||t,r)};a._rollbarOldRemove=o,a.belongsToShim=r,t.removeEventListener=a}}e.exports=function(e,r,i){if(e){var n,o,a="EventTarget,Window,Node,ApplicationCache,AudioTrackList,ChannelMergerNode,CryptoOperation,EventSource,FileReader,HTMLUnknownElement,IDBDatabase,IDBRequest,IDBTransaction,KeyOperation,MediaController,MessagePort,ModalWindow,Notification,SVGElementInstance,Screen,TextTrack,TextTrackCue,TextTrackList,WebSocket,WebSocketWorker,Worker,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload".split(",");for(n=0;n<a.length;++n)e[o=a[n]]&&e[o].prototype&&t(r,e[o].prototype,i)}}},948:e=>{e.exports={version:"2.26.4",endpoint:"api.rollbar.com/api/1/item/",logLevel:"debug",reportLevel:"debug",uncaughtErrorLevel:"error",maxItems:0,itemsPerMin:60}},303:(e,t,r)=>{var i=r(180),n=new RegExp("^(([a-zA-Z0-9-_$ ]*): *)?(Uncaught )?([a-zA-Z0-9-_$ ]*): ");function o(e){var t={};return t._stackFrame=e,t.url=e.fileName,t.line=e.lineNumber,t.func=e.functionName,t.column=e.columnNumber,t.args=e.args,t.context=null,t}function a(e,t){return{stack:function(){var r=[];t=t||0;try{r=i.parse(e)}catch(e){r=[]}for(var n=[],a=t;a<r.length;a++)n.push(new o(r[a]));return n}(),message:e.message,name:(r=e,n=r.name&&r.name.length&&r.name,a=r.constructor.name&&r.constructor.name.length&&r.constructor.name,n&&a?"Error"===n?a:n:n||a),rawStack:e.stack,rawException:e};var r,n,a}e.exports={guessFunctionName:function(){return"?"},guessErrorClass:function(e){if(!e||!e.match)return["Unknown error. There was no error message to display.",""];var t=e.match(n),r="(unknown)";return t&&(r=t[t.length-1],e=(e=e.replace((t[t.length-2]||"")+r+":","")).replace(/(^[\s]+|[\s]+$)/g,"")),[r,e]},gatherContext:function(){return null},parse:function(e,t){var r=e;if(r.nested||r.cause){for(var i=[];r;)i.push(new a(r,t)),r=r.nested||r.cause,t=0;return i[0].traceChain=i,i[0]}return new a(r,t)},Stack:a,Frame:o}},420:e=>{var t=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=function(e){if(!e||"[object Object]"!==r.call(e))return!1;var i,n=t.call(e,"constructor"),o=e.constructor&&e.constructor.prototype&&t.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!o)return!1;for(i in e);return void 0===i||t.call(e,i)};e.exports=function e(){var t,r,n,o,a,s={},l=null,c=arguments.length;for(t=0;t<c;t++)if(null!=(l=arguments[t]))for(a in l)r=s[a],s!==(n=l[a])&&(n&&i(n)?(o=r&&i(r)?r:{},s[a]=e(o,n)):void 0!==n&&(s[a]=n));return s}},314:(e,t,r)=>{var i=r(702);function n(e,t){this.queue=e,this.options=t,this.transforms=[],this.diagnostic={}}n.prototype.configure=function(e){this.queue&&this.queue.configure(e);var t=this.options;return this.options=i.merge(t,e),this},n.prototype.addTransform=function(e){return i.isFunction(e)&&this.transforms.push(e),this},n.prototype.log=function(e,t){if(t&&i.isFunction(t)||(t=function(){}),!this.options.enabled)return t(new Error("Rollbar is not enabled"));this.queue.addPendingItem(e);var r=e.err;this._applyTransforms(e,function(i,n){if(i)return this.queue.removePendingItem(e),t(i,null);this.queue.addItem(n,t,r,e)}.bind(this))},n.prototype._applyTransforms=function(e,t){var r=-1,i=this.transforms.length,n=this.transforms,o=this.options,a=function(e,s){e?t(e,null):++r!==i?n[r](s,o,a):t(null,s)};a(null,e)},e.exports=n},61:(e,t,r)=>{var i=r(702);function n(e,t,r){if(!e)return!r;var n,o,a=e.frames;if(!a||0===a.length)return!r;for(var s=t.length,l=a.length,c=0;c<l;c++){if(n=a[c].filename,!i.isType(n,"string"))return!r;for(var u=0;u<s;u++)if(o=t[u],new RegExp(o).test(n))return!0}return!1}function o(e,t,r,o){var a,s,l=!1;"blocklist"===r&&(l=!0);try{if(a=l?t.hostBlockList:t.hostSafeList,s=i.get(e,"body.trace_chain")||[i.get(e,"body.trace")],!a||0===a.length)return!l;if(0===s.length||!s[0])return!l;for(var c=s.length,u=0;u<c;u++)if(n(s[u],a,l))return!0}catch(e){l?t.hostBlockList=null:t.hostSafeList=null;var h=l?"hostBlockList":"hostSafeList";return o.error("Error while reading your configuration's "+h+" option. Removing custom "+h+".",e),!l}return!1}e.exports={checkLevel:function(e,t){var r=e.level,n=i.LEVELS[r]||0,o=t.reportLevel;return!(n<(i.LEVELS[o]||0))},userCheckIgnore:function(e){return function(t,r){var n=!!t._isUncaught;delete t._isUncaught;var o=t._originalArgs;delete t._originalArgs;try{i.isFunction(r.onSendCallback)&&r.onSendCallback(n,o,t)}catch(t){r.onSendCallback=null,e.error("Error while calling onSendCallback, removing",t)}try{if(i.isFunction(r.checkIgnore)&&r.checkIgnore(n,o,t))return!1}catch(t){r.checkIgnore=null,e.error("Error while calling custom checkIgnore(), removing",t)}return!0}},urlIsNotBlockListed:function(e){return function(t,r){return!o(t,r,"blocklist",e)}},urlIsSafeListed:function(e){return function(t,r){return o(t,r,"safelist",e)}},messageIsIgnored:function(e){return function(t,r){var n,o,a,s,l,c;try{if(!(a=r.ignoredMessages)||0===a.length)return!0;if(c=function(e){var t=e.body,r=[];if(t.trace_chain)for(var n=t.trace_chain,o=0;o<n.length;o++){var a=n[o];r.push(i.get(a,"exception.message"))}return t.trace&&r.push(i.get(t,"trace.exception.message")),t.message&&r.push(i.get(t,"message.body")),r}(t),0===c.length)return!0;for(s=a.length,n=0;n<s;n++)for(l=new RegExp(a[n],"gi"),o=0;o<c.length;o++)if(l.test(c[o]))return!1}catch(t){r.ignoredMessages=null,e.error("Error while reading your configuration's ignoredMessages option. Removing custom ignoredMessages.")}return!0}}}},358:(e,t,r)=>{var i=r(702);function n(e,t,r,i){this.rateLimiter=e,this.api=t,this.logger=r,this.options=i,this.predicates=[],this.pendingItems=[],this.pendingRequests=[],this.retryQueue=[],this.retryHandle=null,this.waitCallback=null,this.waitIntervalID=null}n.prototype.configure=function(e){this.api&&this.api.configure(e);var t=this.options;return this.options=i.merge(t,e),this},n.prototype.addPredicate=function(e){return i.isFunction(e)&&this.predicates.push(e),this},n.prototype.addPendingItem=function(e){this.pendingItems.push(e)},n.prototype.removePendingItem=function(e){var t=this.pendingItems.indexOf(e);-1!==t&&this.pendingItems.splice(t,1)},n.prototype.addItem=function(e,t,r,n){t&&i.isFunction(t)||(t=function(){});var o=this._applyPredicates(e);if(o.stop)return this.removePendingItem(n),void t(o.err);if(this._maybeLog(e,r),this.removePendingItem(n),this.options.transmit){this.pendingRequests.push(e);try{this._makeApiRequest(e,function(r,i){this._dequeuePendingRequest(e),t(r,i)}.bind(this))}catch(r){this._dequeuePendingRequest(e),t(r)}}else t(new Error("Transmit disabled"))},n.prototype.wait=function(e){i.isFunction(e)&&(this.waitCallback=e,this._maybeCallWait()||(this.waitIntervalID&&(this.waitIntervalID=clearInterval(this.waitIntervalID)),this.waitIntervalID=setInterval(function(){this._maybeCallWait()}.bind(this),500)))},n.prototype._applyPredicates=function(e){for(var t=null,r=0,i=this.predicates.length;r<i;r++)if(!(t=this.predicates[r](e,this.options))||void 0!==t.err)return{stop:!0,err:t.err};return{stop:!1,err:null}},n.prototype._makeApiRequest=function(e,t){var r=this.rateLimiter.shouldSend(e);r.shouldSend?this.api.postItem(e,function(r,i){r?this._maybeRetry(r,e,t):t(r,i)}.bind(this)):r.error?t(r.error):this.api.postItem(r.payload,t)};var o=["ECONNRESET","ENOTFOUND","ESOCKETTIMEDOUT","ETIMEDOUT","ECONNREFUSED","EHOSTUNREACH","EPIPE","EAI_AGAIN"];n.prototype._maybeRetry=function(e,t,r){var n=!1;if(this.options.retryInterval){for(var a=0,s=o.length;a<s;a++)if(e.code===o[a]){n=!0;break}n&&i.isFiniteNumber(this.options.maxRetries)&&(t.retries=t.retries?t.retries+1:1,t.retries>this.options.maxRetries&&(n=!1))}n?this._retryApiRequest(t,r):r(e)},n.prototype._retryApiRequest=function(e,t){this.retryQueue.push({item:e,callback:t}),this.retryHandle||(this.retryHandle=setInterval(function(){for(;this.retryQueue.length;){var e=this.retryQueue.shift();this._makeApiRequest(e.item,e.callback)}}.bind(this),this.options.retryInterval))},n.prototype._dequeuePendingRequest=function(e){var t=this.pendingRequests.indexOf(e);-1!==t&&(this.pendingRequests.splice(t,1),this._maybeCallWait())},n.prototype._maybeLog=function(e,t){if(this.logger&&this.options.verbose){var r=t;if(r=(r=r||i.get(e,"body.trace.exception.message"))||i.get(e,"body.trace_chain.0.exception.message"))return void this.logger.error(r);(r=i.get(e,"body.message.body"))&&this.logger.log(r)}},n.prototype._maybeCallWait=function(){return!(!i.isFunction(this.waitCallback)||0!==this.pendingItems.length||0!==this.pendingRequests.length||(this.waitIntervalID&&(this.waitIntervalID=clearInterval(this.waitIntervalID)),this.waitCallback(),0))},e.exports=n},790:(e,t,r)=>{var i=r(702);function n(e){this.startTime=i.now(),this.counter=0,this.perMinCounter=0,this.platform=null,this.platformOptions={},this.configureGlobal(e)}function o(e,t,r){return!e.ignoreRateLimit&&t>=1&&r>t}function a(e,t,r,i,n,o,a){var s=null;return r&&(r=new Error(r)),r||i||(s=function(e,t,r,i,n){var o={body:{message:{body:n?"item per minute limit reached, ignoring errors until timeout":"maxItems has been hit, ignoring errors until reset.",extra:{maxItems:r,itemsPerMinute:i}}},language:"javascript",environment:t.environment||t.payload&&t.payload.environment,notifier:{version:t.notifier&&t.notifier.version||t.version}};return"browser"===e?(o.platform="browser",o.framework="browser-js",o.notifier.name="rollbar-browser-js"):"server"===e?(o.framework=t.framework||"node-js",o.notifier.name=t.notifier.name):"react-native"===e&&(o.framework=t.framework||"react-native",o.notifier.name=t.notifier.name),o}(e,t,n,o,a)),{error:r,shouldSend:i,payload:s}}n.globalSettings={startTime:i.now(),maxItems:void 0,itemsPerMinute:void 0},n.prototype.configureGlobal=function(e){void 0!==e.startTime&&(n.globalSettings.startTime=e.startTime),void 0!==e.maxItems&&(n.globalSettings.maxItems=e.maxItems),void 0!==e.itemsPerMinute&&(n.globalSettings.itemsPerMinute=e.itemsPerMinute)},n.prototype.shouldSend=function(e,t){var r=(t=t||i.now())-this.startTime;(r<0||r>=6e4)&&(this.startTime=t,this.perMinCounter=0);var s=n.globalSettings.maxItems,l=n.globalSettings.itemsPerMinute;if(o(e,s,this.counter))return a(this.platform,this.platformOptions,s+" max items reached",!1);if(o(e,l,this.perMinCounter))return a(this.platform,this.platformOptions,l+" items per minute reached",!1);this.counter++,this.perMinCounter++;var c=!o(e,s,this.counter),u=c;return c=c&&!o(e,l,this.perMinCounter),a(this.platform,this.platformOptions,null,c,s,l,u)},n.prototype.setPlatformOptions=function(e,t){this.platform=e,this.platformOptions=t},e.exports=n},562:(e,t,r)=>{var i=r(790),n=r(358),o=r(314),a=r(702);function s(e,t,r,i,u){this.options=a.merge(e),this.logger=r,s.rateLimiter.configureGlobal(this.options),s.rateLimiter.setPlatformOptions(u,this.options),this.api=t,this.queue=new n(s.rateLimiter,t,r,this.options);var h=this.options.tracer||null;c(h)?(this.tracer=h,this.options.tracer="opentracing-tracer-enabled",this.options._configuredOptions.tracer="opentracing-tracer-enabled"):this.tracer=null,this.notifier=new o(this.queue,this.options),this.telemeter=i,l(e),this.lastError=null,this.lastErrorHash="none"}function l(e){e.stackTraceLimit&&(Error.stackTraceLimit=e.stackTraceLimit)}function c(e){if(!e)return!1;if(!e.scope||"function"!=typeof e.scope)return!1;var t=e.scope();return!(!t||!t.active||"function"!=typeof t.active)}s.rateLimiter=new i({maxItems:0,itemsPerMinute:60}),s.prototype.global=function(e){return s.rateLimiter.configureGlobal(e),this},s.prototype.configure=function(e,t){var r=this.options,i={};t&&(i={payload:t}),this.options=a.merge(r,e,i);var n=this.options.tracer||null;return c(n)?(this.tracer=n,this.options.tracer="opentracing-tracer-enabled",this.options._configuredOptions.tracer="opentracing-tracer-enabled"):this.tracer=null,this.notifier&&this.notifier.configure(this.options),this.telemeter&&this.telemeter.configure(this.options),l(e),this.global(this.options),c(e.tracer)&&(this.tracer=e.tracer),this},s.prototype.log=function(e){var t=this._defaultLogLevel();return this._log(t,e)},s.prototype.debug=function(e){this._log("debug",e)},s.prototype.info=function(e){this._log("info",e)},s.prototype.warn=function(e){this._log("warning",e)},s.prototype.warning=function(e){this._log("warning",e)},s.prototype.error=function(e){this._log("error",e)},s.prototype.critical=function(e){this._log("critical",e)},s.prototype.wait=function(e){this.queue.wait(e)},s.prototype.captureEvent=function(e,t,r){return this.telemeter&&this.telemeter.captureEvent(e,t,r)},s.prototype.captureDomContentLoaded=function(e){return this.telemeter&&this.telemeter.captureDomContentLoaded(e)},s.prototype.captureLoad=function(e){return this.telemeter&&this.telemeter.captureLoad(e)},s.prototype.buildJsonPayload=function(e){return this.api.buildJsonPayload(e)},s.prototype.sendJsonPayload=function(e){this.api.postJsonPayload(e)},s.prototype._log=function(e,t){var r;if(t.callback&&(r=t.callback,delete t.callback),this.options.ignoreDuplicateErrors&&this._sameAsLastError(t)){if(r){var i=new Error("ignored identical item");i.item=t,r(i)}}else try{this._addTracingInfo(t),t.level=t.level||e,this.telemeter&&this.telemeter._captureRollbarItem(t),t.telemetryEvents=this.telemeter&&this.telemeter.copyEvents()||[],this.notifier.log(t,r)}catch(e){r&&r(e),this.logger.error(e)}},s.prototype._defaultLogLevel=function(){return this.options.logLevel||"debug"},s.prototype._sameAsLastError=function(e){if(!e._isUncaught)return!1;var t=function(e){return(e.message||"")+"::"+((e.err||{}).stack||String(e.err))}(e);return this.lastErrorHash===t||(this.lastError=e.err,this.lastErrorHash=t,!1)},s.prototype._addTracingInfo=function(e){if(this.tracer){var t=this.tracer.scope().active();if(function(e){if(!e||!e.context||"function"!=typeof e.context)return!1;var t=e.context();return!!(t&&t.toSpanId&&t.toTraceId&&"function"==typeof t.toSpanId&&"function"==typeof t.toTraceId)}(t)){t.setTag("rollbar.error_uuid",e.uuid),t.setTag("rollbar.has_error",!0),t.setTag("error",!0),t.setTag("rollbar.item_url",`https://rollbar.com/item/uuid/?uuid=${e.uuid}`),t.setTag("rollbar.occurrence_url",`https://rollbar.com/occurrence/uuid/?uuid=${e.uuid}`);var r=t.context().toSpanId(),i=t.context().toTraceId();e.custom?(e.custom.opentracing_span_id=r,e.custom.opentracing_trace_id=i):e.custom={opentracing_span_id:r,opentracing_trace_id:i}}}},e.exports=s},369:(e,t,r)=>{var i=r(702),n=r(267);function o(e,t){var r=t.split("."),n=r.length-1;try{for(var o=0;o<=n;++o)o<n?e=e[r[o]]:e[r[o]]=i.redact()}catch(e){}}e.exports=function(e,t,r){if(t=t||[],r)for(var a=0;a<r.length;++a)o(e,r[a]);var s=function(e){for(var t,r=[],i=0;i<e.length;++i)t="^\\[?(%5[bB])?"+e[i]+"\\[?(%5[bB])?\\]?(%5[dD])?$",r.push(new RegExp(t,"i"));return r}(t),l=function(e){for(var t,r=[],i=0;i<e.length;++i)t="\\[?(%5[bB])?"+e[i]+"\\[?(%5[bB])?\\]?(%5[dD])?",r.push(new RegExp("("+t+"=)([^&\\n]+)","igm"));return r}(t);function c(e,t){return t+i.redact()}return n(e,function e(t,r,o){var a=function(e,t){var r;for(r=0;r<s.length;++r)if(s[r].test(e)){t=i.redact();break}return t}(t,r);return a===r?i.isType(r,"object")||i.isType(r,"array")?n(r,e,o):function(e){var t;if(i.isType(e,"string"))for(t=0;t<l.length;++t)e=e.replace(l[t],c);return e}(a):a})}},773:(e,t,r)=>{var i=r(702),n=100;function o(e){this.queue=[],this.options=i.merge(e);var t=this.options.maxTelemetryEvents||n;this.maxQueueSize=Math.max(0,Math.min(t,n))}function a(e,t){return t||{error:"error",manual:"info"}[e]||"info"}o.prototype.configure=function(e){var t=this.options;this.options=i.merge(t,e);var r=this.options.maxTelemetryEvents||n,o=Math.max(0,Math.min(r,n)),a=0;this.queue.length>o&&(a=this.queue.length-o),this.maxQueueSize=o,this.queue.splice(0,a)},o.prototype.copyEvents=function(){var e=Array.prototype.slice.call(this.queue,0);if(i.isFunction(this.options.filterTelemetry))try{for(var t=e.length;t--;)this.options.filterTelemetry(e[t])&&e.splice(t,1)}catch(e){this.options.filterTelemetry=null}return e},o.prototype.capture=function(e,t,r,n,o){var s={level:a(e,r),type:e,timestamp_ms:o||i.now(),body:t,source:"client"};n&&(s.uuid=n);try{if(i.isFunction(this.options.filterTelemetry)&&this.options.filterTelemetry(s))return!1}catch(e){this.options.filterTelemetry=null}return this.push(s),s},o.prototype.captureEvent=function(e,t,r,i){return this.capture(e,t,r,i)},o.prototype.captureError=function(e,t,r,i){var n={message:e.message||String(e)};return e.stack&&(n.stack=e.stack),this.capture("error",n,t,r,i)},o.prototype.captureLog=function(e,t,r,i){return this.capture("log",{message:e},t,r,i)},o.prototype.captureNetwork=function(e,t,r,i){t=t||"xhr",e.subtype=e.subtype||t,i&&(e.request=i);var n=this.levelFromStatus(e.status_code);return this.capture("network",e,n,r)},o.prototype.levelFromStatus=function(e){return e>=200&&e<400?"info":0===e||e>=400?"error":"info"},o.prototype.captureDom=function(e,t,r,i,n){var o={subtype:e,element:t};return void 0!==r&&(o.value=r),void 0!==i&&(o.checked=i),this.capture("dom",o,"info",n)},o.prototype.captureNavigation=function(e,t,r){return this.capture("navigation",{from:e,to:t},"info",r)},o.prototype.captureDomContentLoaded=function(e){return this.capture("navigation",{subtype:"DOMContentLoaded"},"info",void 0,e&&e.getTime())},o.prototype.captureLoad=function(e){return this.capture("navigation",{subtype:"load"},"info",void 0,e&&e.getTime())},o.prototype.captureConnectivityChange=function(e,t){return this.captureNetwork({change:e},"connectivity",t)},o.prototype._captureRollbarItem=function(e){if(this.options.includeItemsInTelemetry)return e.err?this.captureError(e.err,e.level,e.uuid,e.timestamp):e.message?this.captureLog(e.message,e.level,e.uuid,e.timestamp):e.custom?this.capture("log",e.custom,e.level,e.uuid,e.timestamp):void 0},o.prototype.push=function(e){this.queue.push(e),this.queue.length>this.maxQueueSize&&this.queue.shift()},e.exports=o},417:(e,t,r)=>{var i=r(702);function n(e,t){i.isFunction(e[t])&&(e[t]=e[t].toString())}e.exports={itemToPayload:function(e,t,r){var i=e.data;e._isUncaught&&(i._isUncaught=!0),e._originalArgs&&(i._originalArgs=e._originalArgs),r(null,i)},addPayloadOptions:function(e,t,r){var n=t.payload||{};n.body&&delete n.body,e.data=i.merge(e.data,n),r(null,e)},addTelemetryData:function(e,t,r){e.telemetryEvents&&i.set(e,"data.body.telemetry",e.telemetryEvents),r(null,e)},addMessageWithError:function(e,t,r){if(e.message){var n="data.body.trace_chain.0",o=i.get(e,n);if(o||(n="data.body.trace",o=i.get(e,n)),o){if(!o.exception||!o.exception.description)return i.set(e,n+".exception.description",e.message),void r(null,e);var a=i.get(e,n+".extra")||{},s=i.merge(a,{message:e.message});i.set(e,n+".extra",s)}r(null,e)}else r(null,e)},userTransform:function(e){return function(t,r,n){var o=i.merge(t),a=null;try{i.isFunction(r.transform)&&(a=r.transform(o.data,t))}catch(i){return r.transform=null,e.error("Error while calling custom transform() function. Removing custom transform().",i),void n(null,t)}i.isPromise(a)?a.then(function(e){e&&(o.data=e),n(null,o)},function(e){n(e,t)}):n(null,o)}},addConfigToPayload:function(e,t,r){if(!t.sendConfig)return r(null,e);var n=i.get(e,"data.custom")||{};n._rollbarConfig=t,e.data.custom=n,r(null,e)},addConfiguredOptions:function(e,t,r){var i=t._configuredOptions;n(i,"transform"),n(i,"checkIgnore"),n(i,"onSendCallback"),delete i.accessToken,e.data.notifier.configured_options=i,r(null,e)},addDiagnosticKeys:function(e,t,r){var n=i.merge(e.notifier.client.notifier.diagnostic,e.diagnostic);if(i.get(e,"err._isAnonymous")&&(n.is_anonymous=!0),e._isUncaught&&(n.is_uncaught=e._isUncaught),e.err)try{n.raw_error={message:e.err.message,name:e.err.name,constructor_name:e.err.constructor&&e.err.constructor.name,filename:e.err.fileName,line:e.err.lineNumber,column:e.err.columnNumber,stack:e.err.stack}}catch(e){n.raw_error={failed:String(e)}}e.data.notifier.diagnostic=i.merge(e.data.notifier.diagnostic,n),r(null,e)}}},473:(e,t,r)=>{var i=r(702),n=r(267);function o(e,t){return[e,i.stringify(e,t)]}function a(e,t){var r=e.length;return r>2*t?e.slice(0,t).concat(e.slice(r-t)):e}function s(e,t,r){r=void 0===r?30:r;var n,o=e.data.body;if(o.trace_chain)for(var s=o.trace_chain,l=0;l<s.length;l++)n=a(n=s[l].frames,r),s[l].frames=n;else o.trace&&(n=a(n=o.trace.frames,r),o.trace.frames=n);return[e,i.stringify(e,t)]}function l(e,t){return t&&t.length>e?t.slice(0,e-3).concat("..."):t}function c(e,t,r){return t=n(t,function t(r,o,a){switch(i.typeName(o)){case"string":return l(e,o);case"object":case"array":return n(o,t,a);default:return o}}),[t,i.stringify(t,r)]}function u(e){return e.exception&&(delete e.exception.description,e.exception.message=l(255,e.exception.message)),e.frames=a(e.frames,1),e}function h(e,t){var r=e.data.body;if(r.trace_chain)for(var n=r.trace_chain,o=0;o<n.length;o++)n[o]=u(n[o]);else r.trace&&(r.trace=u(r.trace));return[e,i.stringify(e,t)]}function d(e,t){return i.maxByteSize(e)>t}e.exports={truncate:function(e,t,r){r=void 0===r?524288:r;for(var i,n,a,l=[o,s,c.bind(null,1024),c.bind(null,512),c.bind(null,256),h];i=l.shift();)if(e=(n=i(e,t))[0],(a=n[1]).error||!d(a.value,r))return a;return a},raw:o,truncateFrames:s,truncateStrings:c,maybeTruncateValue:l}},702:(e,t,r)=>{var i=r(420),n={};function o(e,t){return t===a(e)}function a(e){var t=typeof e;return"object"!==t?t:e?e instanceof Error?"error":{}.toString.call(e).match(/\s([a-zA-Z]+)/)[1].toLowerCase():"null"}function s(e){return o(e,"function")}function l(e){var t=Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?"),r=RegExp("^"+t+"$");return c(e)&&r.test(e)}function c(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function u(){var e=y();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var r=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?r:7&r|8).toString(16)})}var h={strictMode:!1,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}};function d(e,t){var r,i;try{r=n.stringify(e)}catch(n){if(t&&s(t))try{r=t(e)}catch(e){i=e}else i=n}return{error:i,value:r}}function p(e,t){return function(r,i){try{t(r,i)}catch(t){e.error(t)}}}function f(e){return function e(t,r){var i,n,s,l={};try{for(n in t)(i=t[n])&&(o(i,"object")||o(i,"array"))?r.includes(i)?l[n]="Removed circular reference: "+a(i):((s=r.slice()).push(i),l[n]=e(i,s)):l[n]=i}catch(e){l="Failed cloning custom data: "+e.message}return l}(e,[e])}var m=["log","network","dom","navigation","error","manual"],g=["critical","error","warning","info","debug"];function _(e,t){for(var r=0;r<e.length;++r)if(e[r]===t)return!0;return!1}function y(){return Date.now?+Date.now():+new Date}e.exports={addParamsAndAccessTokenToPath:function(e,t,r){(r=r||{}).access_token=e;var i,n=[];for(i in r)Object.prototype.hasOwnProperty.call(r,i)&&n.push([i,r[i]].join("="));var o="?"+n.sort().join("&");(t=t||{}).path=t.path||"";var a,s=t.path.indexOf("?"),l=t.path.indexOf("#");-1!==s&&(-1===l||l>s)?(a=t.path,t.path=a.substring(0,s)+o+"&"+a.substring(s+1)):-1!==l?(a=t.path,t.path=a.substring(0,l)+o+a.substring(l)):t.path=t.path+o},createItem:function(e,t,r,i,n){for(var o,s,l,c,h,d,m=[],g=[],_=0,v=e.length;_<v;++_){var b=a(d=e[_]);switch(g.push(b),b){case"undefined":break;case"string":o?m.push(d):o=d;break;case"function":c=p(t,d);break;case"date":m.push(d);break;case"error":case"domexception":case"exception":s?m.push(d):s=d;break;case"object":case"array":if(d instanceof Error||"undefined"!=typeof DOMException&&d instanceof DOMException){s?m.push(d):s=d;break}if(i&&"object"===b&&!h){for(var x=0,w=i.length;x<w;++x)if(void 0!==d[i[x]]){h=d;break}if(h)break}l?m.push(d):l=d;break;default:if(d instanceof Error||"undefined"!=typeof DOMException&&d instanceof DOMException){s?m.push(d):s=d;break}m.push(d)}}l&&(l=f(l)),m.length>0&&(l||(l=f({})),l.extraArgs=f(m));var T={message:o,err:s,custom:l,timestamp:y(),callback:c,notifier:r,diagnostic:{},uuid:u()};return function(e,t){t&&void 0!==t.level&&(e.level=t.level,delete t.level),t&&void 0!==t.skipFrames&&(e.skipFrames=t.skipFrames,delete t.skipFrames)}(T,l),i&&h&&(T.request=h),n&&(T.lambdaContext=n),T._originalArgs=e,T.diagnostic.original_arg_types=g,T},addErrorContext:function(e,t){var r=e.data.custom||{},n=!1;try{for(var o=0;o<t.length;++o)t[o].hasOwnProperty("rollbarContext")&&(r=i(r,f(t[o].rollbarContext)),n=!0);n&&(e.data.custom=r)}catch(t){e.diagnostic.error_context="Failed: "+t.message}},createTelemetryEvent:function(e){for(var t,r,i,n,o=0,s=e.length;o<s;++o)switch(a(n=e[o])){case"string":!t&&_(m,n)?t=n:!i&&_(g,n)&&(i=n);break;case"object":r=n}return{type:t||"manual",metadata:r||{},level:i}},filterIp:function(e,t){if(e&&e.user_ip&&!0!==t){var r=e.user_ip;if(t)try{var i;if(-1!==r.indexOf("."))(i=r.split(".")).pop(),i.push("0"),r=i.join(".");else if(-1!==r.indexOf(":")){if((i=r.split(":")).length>2){var n=i.slice(0,3),o=n[2].indexOf("/");-1!==o&&(n[2]=n[2].substring(0,o)),r=n.concat("0000:0000:0000:0000:0000").join(":")}}else r=null}catch(e){r=null}else r=null;e.user_ip=r}},formatArgsAsString:function(e){var t,r,i,n=[];for(t=0,r=e.length;t<r;++t){switch(a(i=e[t])){case"object":(i=(i=d(i)).error||i.value).length>500&&(i=i.substr(0,497)+"...");break;case"null":i="null";break;case"undefined":i="undefined";break;case"symbol":i=i.toString()}n.push(i)}return n.join(" ")},formatUrl:function(e,t){if(!(t=t||e.protocol)&&e.port&&(80===e.port?t="http:":443===e.port&&(t="https:")),t=t||"https:",!e.hostname)return null;var r=t+"//"+e.hostname;return e.port&&(r=r+":"+e.port),e.path&&(r+=e.path),r},get:function(e,t){if(e){var r=t.split("."),i=e;try{for(var n=0,o=r.length;n<o;++n)i=i[r[n]]}catch(e){i=void 0}return i}},handleOptions:function(e,t,r,n){var o=i(e,t,r);return o=function(e,t){return e.hostWhiteList&&!e.hostSafeList&&(e.hostSafeList=e.hostWhiteList,e.hostWhiteList=void 0,t&&t.log("hostWhiteList is deprecated. Use hostSafeList.")),e.hostBlackList&&!e.hostBlockList&&(e.hostBlockList=e.hostBlackList,e.hostBlackList=void 0,t&&t.log("hostBlackList is deprecated. Use hostBlockList.")),e}(o,n),!t||t.overwriteScrubFields||t.scrubFields&&(o.scrubFields=(e.scrubFields||[]).concat(t.scrubFields)),o},isError:function(e){return o(e,"error")||o(e,"exception")},isFiniteNumber:function(e){return Number.isFinite(e)},isFunction:s,isIterable:function(e){var t=a(e);return"object"===t||"array"===t},isNativeFunction:l,isObject:c,isString:function(e){return"string"==typeof e||e instanceof String},isType:o,isPromise:function(e){return c(e)&&o(e.then,"function")},jsonParse:function(e){var t,r;try{t=n.parse(e)}catch(e){r=e}return{error:r,value:t}},LEVELS:{debug:0,info:1,warning:2,error:3,critical:4},makeUnhandledStackInfo:function(e,t,r,i,n,o,a,s){var l={url:t||"",line:r,column:i};l.func=s.guessFunctionName(l.url,l.line),l.context=s.gatherContext(l.url,l.line);var c="undefined"!=typeof document&&document&&document.location&&document.location.href,u="undefined"!=typeof window&&window&&window.navigator&&window.navigator.userAgent;return{mode:o,message:n?String(n):e||a,url:c,stack:[l],useragent:u}},merge:i,now:y,redact:function(){return"********"},RollbarJSON:n,sanitizeUrl:function(e){var t=function(e){if(o(e,"string")){for(var t=h,r=t.parser[t.strictMode?"strict":"loose"].exec(e),i={},n=0,a=t.key.length;n<a;++n)i[t.key[n]]=r[n]||"";return i[t.q.name]={},i[t.key[12]].replace(t.q.parser,function(e,r,n){r&&(i[t.q.name][r]=n)}),i}}(e);return t?(""===t.anchor&&(t.source=t.source.replace("#","")),e=t.source.replace("?"+t.query,"")):"(unknown)"},set:function(e,t,r){if(e){var i=t.split("."),n=i.length;if(!(n<1))if(1!==n)try{for(var o=e[i[0]]||{},a=o,s=1;s<n-1;++s)o[i[s]]=o[i[s]]||{},o=o[i[s]];o[i[n-1]]=r,e[i[0]]=a}catch(e){return}else e[i[0]]=r}},setupJSON:function(e){s(n.stringify)&&s(n.parse)||(o(JSON,"undefined")||(e?(l(JSON.stringify)&&(n.stringify=JSON.stringify),l(JSON.parse)&&(n.parse=JSON.parse)):(s(JSON.stringify)&&(n.stringify=JSON.stringify),s(JSON.parse)&&(n.parse=JSON.parse))),s(n.stringify)&&s(n.parse)||e&&e(n))},stringify:d,maxByteSize:function(e){for(var t=0,r=e.length,i=0;i<r;i++){var n=e.charCodeAt(i);n<128?t+=1:n<2048?t+=2:n<65536&&(t+=3)}return t},typeName:a,uuid4:u}},650:e=>{function t(e){return"string"!=typeof e&&(e=String(e)),e.toLowerCase()}function r(e){this.map={},e instanceof r?e.forEach(function(e,t){this.append(t,e)},this):Array.isArray(e)?e.forEach(function(e){this.append(e[0],e[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}r.prototype.append=function(e,r){e=t(e),r=function(e){return"string"!=typeof e&&(e=String(e)),e}(r);var i=this.map[e];this.map[e]=i?i+", "+r:r},r.prototype.get=function(e){return e=t(e),this.has(e)?this.map[e]:null},r.prototype.has=function(e){return this.map.hasOwnProperty(t(e))},r.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},r.prototype.entries=function(){var e=[];return this.forEach(function(t,r){e.push([r,t])}),function(e){return{next:function(){var t=e.shift();return{done:void 0===t,value:t}}}}(e)},e.exports=function(e){return"undefined"==typeof Headers?new r(e):new Headers(e)}},876:(e,t,r)=>{var i=r(708);e.exports=i},297:e=>{e.exports=function(e,t,r,i,n){var o=e[t];e[t]=r(o),i&&i[n].push([e,t,o])}},267:(e,t,r)=>{var i=r(702);e.exports=function(e,t,r){var n,o,a,s,l=i.isType(e,"object"),c=i.isType(e,"array"),u=[];if(r=r||{obj:[],mapped:[]},l){if(s=r.obj.indexOf(e),l&&-1!==s)return r.mapped[s]||r.obj[s];r.obj.push(e),s=r.obj.length-1}if(l)for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&u.push(n);else if(c)for(a=0;a<e.length;++a)u.push(a);var h=l?{}:[],d=!0;for(a=0;a<u.length;++a)o=e[n=u[a]],h[n]=t(n,o,r),d=d&&h[n]===e[n];return l&&!d&&(r.mapped[s]=h),d?e:h}},708:e=>{e.exports=function(e){var t,r,i,n,o,a,s,l,c,u,h,d,p,f=/[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;function m(e){return e<10?"0"+e:e}function g(){return this.valueOf()}function _(e){return f.lastIndex=0,f.test(e)?'"'+e.replace(f,function(e){var t=i[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function y(e,i){var o,a,s,l,c,u=t,h=i[e];switch(h&&"object"==typeof h&&"function"==typeof h.toJSON&&(h=h.toJSON(e)),"function"==typeof n&&(h=n.call(i,e,h)),typeof h){case"string":return _(h);case"number":return isFinite(h)?String(h):"null";case"boolean":case"null":return String(h);case"object":if(!h)return"null";if(t+=r,c=[],"[object Array]"===Object.prototype.toString.apply(h)){for(l=h.length,o=0;o<l;o+=1)c[o]=y(o,h)||"null";return s=0===c.length?"[]":t?"[\n"+t+c.join(",\n"+t)+"\n"+u+"]":"["+c.join(",")+"]",t=u,s}if(n&&"object"==typeof n)for(l=n.length,o=0;o<l;o+=1)"string"==typeof n[o]&&(s=y(a=n[o],h))&&c.push(_(a)+(t?": ":":")+s);else for(a in h)Object.prototype.hasOwnProperty.call(h,a)&&(s=y(a,h))&&c.push(_(a)+(t?": ":":")+s);return s=0===c.length?"{}":t?"{\n"+t+c.join(",\n"+t)+"\n"+u+"}":"{"+c.join(",")+"}",t=u,s}}"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+m(this.getUTCMonth()+1)+"-"+m(this.getUTCDate())+"T"+m(this.getUTCHours())+":"+m(this.getUTCMinutes())+":"+m(this.getUTCSeconds())+"Z":null},Boolean.prototype.toJSON=g,Number.prototype.toJSON=g,String.prototype.toJSON=g),"function"!=typeof e.stringify&&(i={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},e.stringify=function(e,i,o){var a;if(t="",r="","number"==typeof o)for(a=0;a<o;a+=1)r+=" ";else"string"==typeof o&&(r=o);if(n=i,i&&"function"!=typeof i&&("object"!=typeof i||"number"!=typeof i.length))throw new Error("JSON.stringify");return y("",{"":e})}),"function"!=typeof e.parse&&(e.parse=(u={"\\":"\\",'"':'"',"/":"/",t:"\t",n:"\n",r:"\r",f:"\f",b:"\b"},h={go:function(){o="ok"},firstokey:function(){l=c,o="colon"},okey:function(){l=c,o="colon"},ovalue:function(){o="ocomma"},firstavalue:function(){o="acomma"},avalue:function(){o="acomma"}},d={go:function(){o="ok"},ovalue:function(){o="ocomma"},firstavalue:function(){o="acomma"},avalue:function(){o="acomma"}},p={"{":{go:function(){a.push({state:"ok"}),s={},o="firstokey"},ovalue:function(){a.push({container:s,state:"ocomma",key:l}),s={},o="firstokey"},firstavalue:function(){a.push({container:s,state:"acomma"}),s={},o="firstokey"},avalue:function(){a.push({container:s,state:"acomma"}),s={},o="firstokey"}},"}":{firstokey:function(){var e=a.pop();c=s,s=e.container,l=e.key,o=e.state},ocomma:function(){var e=a.pop();s[l]=c,c=s,s=e.container,l=e.key,o=e.state}},"[":{go:function(){a.push({state:"ok"}),s=[],o="firstavalue"},ovalue:function(){a.push({container:s,state:"ocomma",key:l}),s=[],o="firstavalue"},firstavalue:function(){a.push({container:s,state:"acomma"}),s=[],o="firstavalue"},avalue:function(){a.push({container:s,state:"acomma"}),s=[],o="firstavalue"}},"]":{firstavalue:function(){var e=a.pop();c=s,s=e.container,l=e.key,o=e.state},acomma:function(){var e=a.pop();s.push(c),c=s,s=e.container,l=e.key,o=e.state}},":":{colon:function(){if(Object.hasOwnProperty.call(s,l))throw new SyntaxError("Duplicate key '"+l+'"');o="ovalue"}},",":{ocomma:function(){s[l]=c,o="okey"},acomma:function(){s.push(c),o="avalue"}},true:{go:function(){c=!0,o="ok"},ovalue:function(){c=!0,o="ocomma"},firstavalue:function(){c=!0,o="acomma"},avalue:function(){c=!0,o="acomma"}},false:{go:function(){c=!1,o="ok"},ovalue:function(){c=!1,o="ocomma"},firstavalue:function(){c=!1,o="acomma"},avalue:function(){c=!1,o="acomma"}},null:{go:function(){c=null,o="ok"},ovalue:function(){c=null,o="ocomma"},firstavalue:function(){c=null,o="acomma"},avalue:function(){c=null,o="acomma"}}},function(e,t){var r,i,n=/^[\u0020\t\n\r]*(?:([,:\[\]{}]|true|false|null)|(-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)|"((?:[^\r\n\t\\\"]|\\(?:["\\\/trnfb]|u[0-9a-fA-F]{4}))*)")/;o="go",a=[];try{for(;r=n.exec(e);)r[1]?p[r[1]][o]():r[2]?(c=+r[2],d[o]()):(i=r[3],c=i.replace(/\\(?:u(.{4})|([^u]))/g,function(e,t,r){return t?String.fromCharCode(parseInt(t,16)):u[r]}),h[o]()),e=e.slice(r[0].length)}catch(e){o=e}if("ok"!==o||/[^\u0020\t\n\r]/.test(e))throw o instanceof SyntaxError?o:new SyntaxError("JSON");return"function"==typeof t?function e(r,i){var n,o,a=r[i];if(a&&"object"==typeof a)for(n in c)Object.prototype.hasOwnProperty.call(a,n)&&(void 0!==(o=e(a,n))?a[n]=o:delete a[n]);return t.call(r,i,a)}({"":c},""):c}))}}},t={},function r(i){var n=t[i];if(void 0!==n)return n.exports;var o=t[i]={exports:{}};return e[i].call(o.exports,o,o.exports,r),o.exports}(409);var e,t})},565:t=>{t.exports=e},773:function(e,t){!function(e){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}var n={SESSIONS:"sessions",EVENTS:"events",VIEWS:"views",SCROLLS:"scrolls",CLICKS:"clicks",FORMS:"forms",CRASHES:"crashes",ATTRIBUTION:"attribution",USERS:"users",STAR_RATING:"star-rating",LOCATION:"location",APM:"apm",FEEDBACK:"feedback",REMOTE_CONFIG:"remote-config"},o={NPS:"[CLY]_nps",SURVEY:"[CLY]_survey",STAR_RATING:"[CLY]_star_rating",VIEW:"[CLY]_view",ORIENTATION:"[CLY]_orientation",ACTION:"[CLY]_action"},a=Object.values(o),s={ERROR:"[ERROR] ",WARNING:"[WARNING] ",INFO:"[INFO] ",DEBUG:"[DEBUG] ",VERBOSE:"[VERBOSE] "},l={DEVELOPER_SUPPLIED:0,SDK_GENERATED:1,TEMPORARY_ID:2,URL_PROVIDED:3},c={BEAT_INTERVAL:500,QUEUE_SIZE:1e3,FAIL_TIMEOUT_AMOUNT:60,INACTIVITY_TIME:20,SESSION_UPDATE:60,MAX_EVENT_BATCH:100,SESSION_COOKIE_TIMEOUT:30,MAX_KEY_LENGTH:128,MAX_VALUE_SIZE:256,MAX_SEGMENTATION_VALUES:100,MAX_BREADCRUMB_COUNT:100,MAX_STACKTRACE_LINES_PER_THREAD:30,MAX_STACKTRACE_LINE_LENGTH:200},u={BOOMERANG_SRC:"https://cdn.jsdelivr.net/npm/countly-sdk-web@latest/plugin/boomerang/boomerang.min.js",CLY_BOOMERANG_SRC:"https://cdn.jsdelivr.net/npm/countly-sdk-web@latest/plugin/boomerang/countly_boomerang.js"},h=Object.freeze({errorCount:"cly_hc_error_count",warningCount:"cly_hc_warning_count",statusCode:"cly_hc_status_code",errorMessage:"cly_hc_error_message"}),d="23.12.6",p="javascript_native_web",f=/^(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/,m="undefined"!=typeof window,g=globalThis.Countly||{};function _(e){var t=[];if(void 0!==e.options)for(var r=0;r<e.options.length;r++)e.options[r].selected&&t.push(e.options[r].value);return t.join(", ")}function y(){var e="xxxxxxxx";return(e=b(e,"[x]"))+Date.now().toString()}function v(){var e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";return e=b(e,"[xy]")}function b(e,t){var r=(new Date).getTime(),i=new RegExp(t,"g");return e.replace(i,function(e){var t=(r+16*Math.random())%16|0;return("x"===e?t:3&t|8).toString(16)})}function x(){return Math.floor((new Date).getTime()/1e3)}var w=0;function T(){var e=(new Date).getTime();return w>=e?w++:w=e,w}function S(e,t,r){if(t&&Object.keys(t).length){if(void 0!==t[e])return t[e]}else if(void 0!==g[e])return g[e];return r}function E(e,t,r){for(var i in g.i)g.i[i].tracking_crashes&&g.i[i].recordError(e,t,r)}function I(e){var t=[];for(var r in e)t.push(r+"="+encodeURIComponent(e[r]));return t.join("&")}function P(e){return"string"==typeof e&&"/"===e.substring(e.length-1)?e.substring(0,e.length-1):e}function k(e,t){for(var r,i={},n=0,o=t.length;n<o;n++)void 0!==e[r=t[n]]&&(i[r]=e[r]);return i}function A(e,t,r){if(r){for(var i,n=0,o=r.length;n<o;n++)void 0!==t[i=r[n]]&&(e[i]=t[i]);return e}}function C(e,t,r,i,n,o){var a={};if(e){if(Object.keys(e).length>i){var s={},l=0;for(var c in e)l<i&&(s[c]=e[c],l++);e=s}for(var u in e){var h=M(u,t,n,o),d=M(e[u],r,n,o);a[h]=d}}return a}function M(e,t,r,i){var n=e;return"number"==typeof e&&(e=e.toString()),"string"==typeof e&&e.length>t&&(n=e.substring(0,t),i(s.DEBUG,r+", Key: [ "+e+" ] is longer than accepted length. It will be truncated.")),n}function D(e,t){for(t=t.toUpperCase();e;){if(e.nodeName.toUpperCase()===t)return e;e=e.parentElement}}function R(e,t,r){m&&(null!=e?void 0!==e.addEventListener?e.addEventListener(t,r,!1):e.attachEvent("on"+t,r):H()&&console.warn("[WARNING] [Countly] add_event_listener, Can't bind ["+t+"] event to nonexisting element"))}function L(e){return e?void 0!==e.target?e.target:e.srcElement:window.event.srcElement}function F(e){if(e)return e;var t=navigator.userAgent;return t||(t=O()),t}function O(e){if(e)return e;var t="";return navigator.userAgentData&&(t=navigator.userAgentData.brands.map(function(e){return e.brand+":"+e.version}).join(),t+=navigator.userAgentData.mobile?" mobi ":" ",t+=navigator.userAgentData.platform),t}function z(e){var t;if(e)t=e;else{if(navigator.userAgentData&&navigator.userAgentData.mobile)return"phone";t=F()}t=t.toLowerCase();var r="desktop",i=/(mobi|ipod|phone|blackberry|opera mini|fennec|minimo|symbian|psp|nintendo ds|archos|skyfire|puffin|blazer|bolt|gobrowser|iris|maemo|semc|teashark|uzard)/;return/(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/.test(t)?r="tablet":i.test(t)&&(r="phone"),r}function B(e){var t=/(CountlySiteBot|nuhk|Googlebot|GoogleSecurityScanner|Yammybot|Openbot|Slurp|MSNBot|Ask Jeeves\/Teoma|ia_archiver|bingbot|Google Web Preview|Mediapartners-Google|AdsBot-Google|Baiduspider|Ezooms|YahooSeeker|AltaVista|AVSearch|Mercator|Scooter|InfoSeek|Ultraseek|Lycos|Wget|YandexBot|Yandex|YaDirectFetcher|SiteBot|Exabot|AhrefsBot|MJ12bot|TurnitinBot|magpie-crawler|Nutch Crawler|CMS Crawler|rogerbot|Domnutch|ssearch_bot|XoviBot|netseer|digincore|fr-crawler|wesee|AliasIO|contxbot|PingdomBot|BingPreview|HeadlessChrome|Lighthouse)/;if(e)return t.test(e);var r=t.test(F()),i=t.test(O());return r||i}function N(e){return void 0===e.pageY&&"number"==typeof e.clientX&&document.documentElement&&(e.pageX=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,e.pageY=e.clientY+document.body.scrollTop+document.documentElement.scrollTop),e}function j(){var e=document;return Math.max(Math.max(e.body.scrollHeight,e.documentElement.scrollHeight),Math.max(e.body.offsetHeight,e.documentElement.offsetHeight),Math.max(e.body.clientHeight,e.documentElement.clientHeight))}function V(){var e=document;return Math.max(Math.max(e.body.scrollWidth,e.documentElement.scrollWidth),Math.max(e.body.offsetWidth,e.documentElement.offsetWidth),Math.max(e.body.clientWidth,e.documentElement.clientWidth))}function U(){var e=document;return Math.min(Math.min(e.body.clientHeight,e.documentElement.clientHeight),Math.min(e.body.offsetHeight,e.documentElement.offsetHeight),window.innerHeight)}function G(){return window.innerWidth>window.innerHeight?"landscape":"portrait"}function q(e,t,r,i,n,o){var a,s=document.createElement(e);s.setAttribute(t,r),s.setAttribute(i,n);var l=function(){a||o(),a=!0};o&&(s.onreadystatechange=l,s.onload=l),document.getElementsByTagName("head")[0].appendChild(s)}function $(e,t){q("script","type","text/javascript","src",e,t)}function W(e,t){q("link","rel","stylesheet","href",e,t)}function Z(){if(m){var e=document.getElementById("cly-loader");if(!e){var t="#cly-loader {height: 4px; width: 100%; position: absolute; z-index: 99999; overflow: hidden; background-color: #fff; top:0px; left:0px;}#cly-loader:before{display: block; position: absolute; content: ''; left: -200px; width: 200px; height: 4px; background-color: #2EB52B; animation: cly-loading 2s linear infinite;}@keyframes cly-loading { from {left: -200px; width: 30%;} 50% {width: 30%;} 70% {width: 70%;} 80% { left: 50%;} 95% {left: 120%;} to {left: 100%;}}",r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",i.styleSheet?i.styleSheet.cssText=t:i.appendChild(document.createTextNode(t)),r.appendChild(i),(e=document.createElement("div")).setAttribute("id","cly-loader"),document.body.onload=function(){if(g.showLoaderProtection)H()&&console.warn("[WARNING] [Countly] showloader, Loader is already on");else try{document.body.appendChild(e)}catch(he){H()&&console.error("[ERROR] [Countly] showLoader, Body is not loaded for loader to append: "+he)}}}e.style.display="block"}}function H(){return!(!g||!g.debug||"undefined"==typeof console)}function X(){if(m){g.showLoaderProtection=!0;var e=document.getElementById("cly-loader");e&&(e.style.display="none")}}var Y=i(function e(i){r(this,e);var u,b=this,w=!g.i,q=!1,Y="/i",J="/o/sdk",K=S("interval",i,c.BEAT_INTERVAL),Q=S("queue_size",i,c.QUEUE_SIZE),ee=[],te=[],re={},ie=[],ne={},oe=S("ignore_referrers",i,[]),ae=null,se=!0,le=0,ce=null,ue=0,de=0,pe=0,fe=S("fail_timeout",i,c.FAIL_TIMEOUT_AMOUNT),me=S("inactivity_time",i,c.INACTIVITY_TIME),ge=0,_e=S("session_update",i,c.SESSION_UPDATE),ye=S("max_events",i,c.MAX_EVENT_BATCH),ve=S("max_logs",i,null),be=S("use_session_cookie",i,!0),xe=S("session_cookie_timeout",i,c.SESSION_COOKIE_TIMEOUT),we=!0,Te=!1,Se=S("offline_mode",i,!1),Ee={},Ie=!0,Pe=x(),ke=!0,Ae=null,Ce=l.SDK_GENERATED,Me=!1,De=0,Re=!1,Le=null,Fe=null,Oe=null,ze=S("sdk_name",i,p),Be=S("sdk_version",i,d);try{localStorage.setItem("cly_testLocal",!0),localStorage.removeItem("cly_testLocal")}catch(he){ct(s.ERROR,"Local storage test failed, Halting local storage support: "+he),ke=!1}for(var Ne,je={},Ve=0;Ve<g.features.length;Ve++)je[g.features[Ve]]={};this.initialize=function(){if(this.serialize=S("serialize",i,g.serialize),this.deserialize=S("deserialize",i,g.deserialize),this.getViewName=S("getViewName",i,g.getViewName),this.getViewUrl=S("getViewUrl",i,g.getViewUrl),this.getSearchQuery=S("getSearchQuery",i,g.getSearchQuery),this.DeviceIdType=g.DeviceIdType,this.namespace=S("namespace",i,""),this.clearStoredId=S("clear_stored_id",i,!1),this.app_key=S("app_key",i,null),this.onload=S("onload",i,[]),this.utm=S("utm",i,{source:!0,medium:!0,campaign:!0,term:!0,content:!0}),this.ignore_prefetch=S("ignore_prefetch",i,!0),this.rcAutoOptinAb=S("rc_automatic_optin_for_ab",i,!0),this.useExplicitRcApi=S("use_explicit_rc_api",i,!1),this.debug=S("debug",i,!1),this.test_mode=S("test_mode",i,!1),this.test_mode_eq=S("test_mode_eq",i,!1),this.metrics=S("metrics",i,{}),this.headers=S("headers",i,{}),this.url=P(S("url",i,"")),this.app_version=S("app_version",i,"0.0"),this.country_code=S("country_code",i,null),this.city=S("city",i,null),this.ip_address=S("ip_address",i,null),this.ignore_bots=S("ignore_bots",i,!0),this.force_post=S("force_post",i,!1),this.remote_config=S("remote_config",i,!1),this.ignore_visitor=S("ignore_visitor",i,!1),this.require_consent=S("require_consent",i,!1),this.track_domains=m?S("track_domains",i,!0):void 0,this.storage=S("storage",i,"default"),this.enableOrientationTracking=m?S("enable_orientation_tracking",i,!0):void 0,this.maxKeyLength=S("max_key_length",i,c.MAX_KEY_LENGTH),this.maxValueSize=S("max_value_size",i,c.MAX_VALUE_SIZE),this.maxSegmentationValues=S("max_segmentation_values",i,c.MAX_SEGMENTATION_VALUES),this.maxBreadcrumbCount=S("max_breadcrumb_count",i,null),this.maxStackTraceLinesPerThread=S("max_stack_trace_lines_per_thread",i,c.MAX_STACKTRACE_LINES_PER_THREAD),this.maxStackTraceLineLength=S("max_stack_trace_line_length",i,c.MAX_STACKTRACE_LINE_LENGTH),this.heatmapWhitelist=S("heatmap_whitelist",i,[]),b.hcErrorCount=St(h.errorCount)||0,b.hcWarningCount=St(h.warningCount)||0,b.hcStatusCode=St(h.statusCode)||-1,b.hcErrorMessage=St(h.errorMessage)||"",ve&&!this.maxBreadcrumbCount?(this.maxBreadcrumbCount=ve,ct(s.WARNING,"initialize, 'maxCrashLogs' is deprecated. Use 'maxBreadcrumbCount' instead!")):ve||this.maxBreadcrumbCount||(this.maxBreadcrumbCount=100),"cookie"===this.storage&&(ke=!1),this.rcAutoOptinAb||this.useExplicitRcApi||(ct(s.WARNING,"initialize, Auto opting is disabled, switching to explicit RC API"),this.useExplicitRcApi=!0),Array.isArray(oe)||(oe=[]),""===this.url&&(ct(s.ERROR,"initialize, Please provide server URL"),this.ignore_visitor=!0),St("cly_ignore")&&(this.ignore_visitor=!0),Pt(),ee=St("cly_queue")||[],te=St("cly_event")||[],re=St("cly_remote_configs")||{},this.clearStoredId&&(St("cly_id")&&!_&&(this.device_id=St("cly_id"),ct(s.DEBUG,"initialize, temporarily using the previous device ID to flush existing events"),(Ce=St("cly_id_type"))||(ct(s.DEBUG,"initialize, No device ID type info from the previous session, falling back to DEVELOPER_SUPPLIED, for event flushing"),Ce=l.DEVELOPER_SUPPLIED),He(),this.device_id=void 0,Ce=l.SDK_GENERATED),ct(s.INFO,"initialize, Clearing the device ID storage"),It("cly_id"),It("cly_id_type"),It("cly_session")),Ze(),m)if(window.name&&0===window.name.indexOf("cly:"))try{this.passed_data=JSON.parse(window.name.replace("cly:",""))}catch(x){ct(s.ERROR,"initialize, Could not parse name: "+window.name+", error: "+x)}else if(location.hash&&0===location.hash.indexOf("#cly:"))try{this.passed_data=JSON.parse(location.hash.replace("#cly:",""))}catch(x){ct(s.ERROR,"initialize, Could not parse hash: "+location.hash+", error: "+x)}if((this.passed_data&&this.passed_data.app_key&&this.passed_data.app_key===this.app_key||this.passed_data&&!this.passed_data.app_key&&w)&&this.passed_data.token&&this.passed_data.purpose){this.passed_data.token!==St("cly_old_token")&&(yt(this.passed_data.token),Et("cly_old_token",this.passed_data.token));var e=[];Array.isArray(this.heatmapWhitelist)?(this.heatmapWhitelist.push(this.url),e=this.heatmapWhitelist.map(function(e){return P(e)})):e=[this.url],e.includes(this.passed_data.url)&&"heatmap"===this.passed_data.purpose&&(this.ignore_visitor=!0,Z(),$(this.passed_data.url+"/views/heatmap.js",X))}if(this.ignore_visitor)ct(s.WARNING,"initialize, ignore_visitor:["+this.ignore_visitor+"], this user will not be tracked");else{ct(s.DEBUG,ze===p&&Be===d?"initialize, SDK name:["+ze+"], version:["+Be+"]":"initialize, SDK name:["+ze+"], version:["+Be+"], default name:["+p+"] and default version:["+d+"]"),ct(s.DEBUG,"initialize, app_key:["+this.app_key+"], url:["+this.url+"]"),ct(s.DEBUG,"initialize, device_id:["+S("device_id",i,void 0)+"]"),ct(s.DEBUG,"initialize, require_consent is enabled:["+this.require_consent+"]");try{ct(s.DEBUG,"initialize, metric override:["+JSON.stringify(this.metrics)+"]"),ct(s.DEBUG,"initialize, header override:["+JSON.stringify(this.headers)+"]"),ct(s.DEBUG,"initialize, number of onload callbacks provided:["+this.onload.length+"]"),ct(s.DEBUG,"initialize, utm tags:["+JSON.stringify(this.utm)+"]"),oe&&ct(s.DEBUG,"initialize, referrers to ignore :["+JSON.stringify(oe)+"]")}catch(he){ct(s.ERROR,"initialize, Could not stringify some config object values")}ct(s.DEBUG,"initialize, app_version:["+this.app_version+"]"),ct(s.DEBUG,"initialize, provided location info; country_code:["+this.country_code+"], city:["+this.city+"], ip_address:["+this.ip_address+"]"),""!==this.namespace&&ct(s.DEBUG,"initialize, namespace given:["+this.namespace+"]"),this.clearStoredId&&ct(s.DEBUG,"initialize, clearStoredId flag set to:["+this.clearStoredId+"]"),this.ignore_prefetch&&ct(s.DEBUG,"initialize, ignoring pre-fetching and pre-rendering from counting as real website visits :["+this.ignore_prefetch+"]"),this.test_mode&&ct(s.WARNING,"initialize, test_mode:["+this.test_mode+"], request queue won't be processed"),this.test_mode_eq&&ct(s.WARNING,"initialize, test_mode_eq:["+this.test_mode_eq+"], event queue won't be processed"),this.heatmapWhitelist&&ct(s.DEBUG,"initialize, heatmap whitelist:["+JSON.stringify(this.heatmapWhitelist)+"], these domains will be whitelisted"),"default"!==this.storage&&ct(s.DEBUG,"initialize, storage is set to:["+this.storage+"]"),this.ignore_bots&&ct(s.DEBUG,"initialize, ignore traffic from bots :["+this.ignore_bots+"]"),this.force_post&&ct(s.DEBUG,"initialize, forced post method for all requests:["+this.force_post+"]"),this.remote_config&&ct(s.DEBUG,"initialize, remote_config callback provided:["+!!this.remote_config+"]"),"boolean"==typeof this.rcAutoOptinAb&&ct(s.DEBUG,"initialize, automatic RC optin is enabled:["+this.rcAutoOptinAb+"]"),this.useExplicitRcApi||ct(s.WARNING,"initialize, will use legacy RC API. Consider enabling new API during init with use_explicit_rc_api flag"),this.track_domains&&ct(s.DEBUG,"initialize, tracking domain info:["+this.track_domains+"]"),this.enableOrientationTracking&&ct(s.DEBUG,"initialize, enableOrientationTracking:["+this.enableOrientationTracking+"]"),be||ct(s.WARNING,"initialize, use_session_cookie is enabled:["+be+"]"),Se&&ct(s.DEBUG,"initialize, offline_mode:["+Se+"], user info won't be send to the servers"),Se&&ct(s.DEBUG,"initialize, stored remote configs:["+JSON.stringify(re)+"]"),ct(s.DEBUG,"initialize, 'getViewName' callback override provided:["+(this.getViewName!==g.getViewName)+"]"),ct(s.DEBUG,"initialize, 'getSearchQuery' callback override provided:["+(this.getSearchQuery!==g.getSearchQuery)+"]"),this.maxKeyLength!==c.MAX_KEY_LENGTH&&ct(s.DEBUG,"initialize, maxKeyLength set to:["+this.maxKeyLength+"] characters"),this.maxValueSize!==c.MAX_VALUE_SIZE&&ct(s.DEBUG,"initialize, maxValueSize set to:["+this.maxValueSize+"] characters"),this.maxSegmentationValues!==c.MAX_SEGMENTATION_VALUES&&ct(s.DEBUG,"initialize, maxSegmentationValues set to:["+this.maxSegmentationValues+"] key/value pairs"),this.maxBreadcrumbCount!==c.MAX_BREADCRUMB_COUNT&&ct(s.DEBUG,"initialize, maxBreadcrumbCount for custom logs set to:["+this.maxBreadcrumbCount+"] entries"),this.maxStackTraceLinesPerThread!==c.MAX_STACKTRACE_LINES_PER_THREAD&&ct(s.DEBUG,"initialize, maxStackTraceLinesPerThread set to:["+this.maxStackTraceLinesPerThread+"] lines"),this.maxStackTraceLineLength!==c.MAX_STACKTRACE_LINE_LENGTH&&ct(s.DEBUG,"initialize, maxStackTraceLineLength set to:["+this.maxStackTraceLineLength+"] characters"),K!==c.BEAT_INTERVAL&&ct(s.DEBUG,"initialize, interval for heartbeats set to:["+K+"] milliseconds"),Q!==c.QUEUE_SIZE&&ct(s.DEBUG,"initialize, queue_size set to:["+Q+"] items max"),fe!==c.FAIL_TIMEOUT_AMOUNT&&ct(s.DEBUG,"initialize, fail_timeout set to:["+fe+"] seconds of wait time after a failed connection to server"),me!==c.INACTIVITY_TIME&&ct(s.DEBUG,"initialize, inactivity_time set to:["+me+"] minutes to consider a user as inactive after no observable action"),_e!==c.SESSION_UPDATE&&ct(s.DEBUG,"initialize, session_update set to:["+_e+"] seconds to check if extending a session is needed while the user is active"),ye!==c.MAX_EVENT_BATCH&&ct(s.DEBUG,"initialize, max_events set to:["+ye+"] events to send in one batch"),ve&&ct(s.WARNING,"initialize, max_logs set to:["+ve+"] breadcrumbs to store for crash logs max, deprecated "),xe!==c.SESSION_COOKIE_TIMEOUT&&ct(s.DEBUG,"initialize, session_cookie_timeout set to:["+xe+"] minutes to expire a cookies session");var t=null,r=b.getSearchQuery(),n=!1,o={};if(r){0===r.indexOf("?")&&(r=r.substring(1));for(var a=r.split("&"),u=0;u<a.length;u++){var f=a[u].split("=");"cly_id"===f[0]?Et("cly_cmp_id",f[1]):"cly_uid"===f[0]?Et("cly_cmp_uid",f[1]):"cly_device_id"===f[0]?t=f[1]:0===(f[0]+"").indexOf("utm_")&&this.utm[f[0].replace("utm_","")]&&(o[f[0].replace("utm_","")]=f[1],n=!0)}}var _="[CLY]_temp_id"===St("cly_id"),y=S("device_id",i,void 0);if("number"==typeof y&&(y=y.toString()),St("cly_id")&&!_?(this.device_id=St("cly_id"),ct(s.INFO,"initialize, Set the stored device ID"),(Ce=St("cly_id_type"))||(ct(s.INFO,"initialize, No device ID type info from the previous session, falling back to DEVELOPER_SUPPLIED"),Ce=l.DEVELOPER_SUPPLIED)):null!==t?(ct(s.INFO,"initialize, Device ID set by URL"),this.device_id=t,Ce=l.URL_PROVIDED):y?(ct(s.INFO,"initialize, Device ID set by developer"),this.device_id=y,i&&Object.keys(i).length?void 0!==i.device_id&&(Ce=l.DEVELOPER_SUPPLIED):void 0!==g.device_id&&(Ce=l.DEVELOPER_SUPPLIED)):Se||_?(this.device_id="[CLY]_temp_id",Ce=l.TEMPORARY_ID,Se&&_?ct(s.INFO,"initialize, Temp ID set, continuing offline mode from previous app session"):Se&&!_?ct(s.INFO,"initialize, Temp ID set, entering offline mode"):(Se=!0,ct(s.INFO,"initialize, Temp ID set, enabling offline mode"))):(ct(s.INFO,"initialize, Generating the device ID"),this.device_id=S("device_id",i,nt()),i&&Object.keys(i).length?void 0!==i.device_id&&(Ce=l.DEVELOPER_SUPPLIED):void 0!==g.device_id&&(Ce=l.DEVELOPER_SUPPLIED)),Et("cly_id",this.device_id),Et("cly_id_type",Ce),n){for(var v in Oe={},this.utm)o[v]?(this.userData.set("utm_"+v,o[v]),Oe[v]=o[v]):this.userData.unset("utm_"+v);this.userData.save()}Ye(),setTimeout(function(){g.noHeartBeat?ct(s.WARNING,"initialize, Heartbeat disabled. This is for testing purposes only!"):rt(),b.remote_config&&b.fetch_remote_config(b.remote_config)},1),m&&document.documentElement.setAttribute("data-countly-useragent",F()),kt.sendInstantHCRequest(),ct(s.INFO,"initialize, Countly initialized")}},this.halt=function(){ct(s.WARNING,"halt, Resetting Countly"),g.i=void 0,g.q=[],g.noHeartBeat=void 0,w=!g.i,q=!1,Y="/i",J="/o/sdk",K=500,Q=1e3,ee=[],te=[],re={},ie=[],ne={},oe=[],ae=null,se=!0,le=0,ce=null,ue=0,de=0,pe=0,fe=60,me=20,ge=0,_e=60,ye=100,ve=null,be=!0,xe=30,we=!0,Te=!1,Se=!1,Ee={},Ie=!0,Pe=x(),ke=!0,Ae=null,Ce=l.SDK_GENERATED,Me=!1,De=0,Re=!1,Le=null,Fe=null,Oe=null;try{localStorage.setItem("cly_testLocal",!0),localStorage.removeItem("cly_testLocal")}catch(he){ct(s.ERROR,"halt, Local storage test failed, will fallback to cookies"),ke=!1}g.features=[n.SESSIONS,n.EVENTS,n.VIEWS,n.SCROLLS,n.CLICKS,n.FORMS,n.CRASHES,n.ATTRIBUTION,n.USERS,n.STAR_RATING,n.LOCATION,n.APM,n.FEEDBACK,n.REMOTE_CONFIG],je={};for(var e=0;e<g.features.length;e++)je[g.features[e]]={};b.app_key=void 0,b.device_id=void 0,b.onload=void 0,b.utm=void 0,b.ignore_prefetch=void 0,b.debug=void 0,b.test_mode=void 0,b.test_mode_eq=void 0,b.metrics=void 0,b.headers=void 0,b.url=void 0,b.app_version=void 0,b.country_code=void 0,b.city=void 0,b.ip_address=void 0,b.ignore_bots=void 0,b.force_post=void 0,b.rcAutoOptinAb=void 0,b.useExplicitRcApi=void 0,b.remote_config=void 0,b.ignore_visitor=void 0,b.require_consent=void 0,b.track_domains=void 0,b.storage=void 0,b.enableOrientationTracking=void 0,b.maxKeyLength=void 0,b.maxValueSize=void 0,b.maxSegmentationValues=void 0,b.maxBreadcrumbCount=void 0,b.maxStackTraceLinesPerThread=void 0,b.maxStackTraceLineLength=void 0},this.group_features=function(e){if(ct(s.INFO,"group_features, Grouping features"),e)for(var t in e)je[t]?ct(s.WARNING,"group_features, Feature name ["+t+"] is already reserved"):"string"==typeof e[t]?je[t]={features:[e[t]]}:e[t]&&Array.isArray(e[t])&&e[t].length?je[t]={features:e[t]}:ct(s.ERROR,"group_features, Incorrect feature list for ["+t+"] value: ["+e[t]+"]");else ct(s.ERROR,"group_features, Incorrect features:["+e+"]")},this.check_consent=function(e){return ct(s.INFO,"check_consent, Checking if consent is given for specific feature:["+e+"]"),this.require_consent?je[e]?!(!je[e]||!je[e].optin):(ct(s.ERROR,"check_consent, No feature available for ["+e+"]"),!1):(ct(s.INFO,"check_consent, require_consent is off, no consent is necessary"),!0)},this.get_device_id_type=function(){var e;switch(ct(s.INFO,"check_device_id_type, Retrieving the current device id type.["+Ce+"]"),Ce){case l.SDK_GENERATED:e=b.DeviceIdType.SDK_GENERATED;break;case l.URL_PROVIDED:case l.DEVELOPER_SUPPLIED:e=b.DeviceIdType.DEVELOPER_SUPPLIED;break;case l.TEMPORARY_ID:e=b.DeviceIdType.TEMPORARY_ID;break;default:e=-1}return e},this.get_device_id=function(){return ct(s.INFO,"get_device_id, Retrieving the device id: ["+b.device_id+"]"),b.device_id},this.check_any_consent=function(){if(ct(s.INFO,"check_any_consent, Checking if any consent is given"),!this.require_consent)return ct(s.INFO,"check_any_consent, require_consent is off, no consent is necessary"),!0;for(var e in je)if(je[e]&&je[e].optin)return!0;return ct(s.INFO,"check_any_consent, No consents given"),!1},this.add_consent=function(e){if(ct(s.INFO,"add_consent, Adding consent for ["+e+"]"),Array.isArray(e))for(var t=0;t<e.length;t++)this.add_consent(e[t]);else je[e]?je[e].features?(je[e].optin=!0,this.add_consent(je[e].features)):!0!==je[e].optin&&(je[e].optin=!0,Ue(),setTimeout(function(){e===n.SESSIONS&&Ee.begin_session?(b.begin_session.apply(b,Ee.begin_session),Ee.begin_session=null):e===n.VIEWS&&Ee.track_pageview&&(ce=null,b.track_pageview.apply(b,Ee.track_pageview),Ee.track_pageview=null)},1)):ct(s.ERROR,"add_consent, No feature available for ["+e+"]")},this.remove_consent=function(e){ct(s.INFO,"remove_consent, Removing consent for ["+e+"]"),this.remove_consent_internal(e,!0)},this.remove_consent_internal=function(e,t){if(t=t||!1,Array.isArray(e))for(var r=0;r<e.length;r++)this.remove_consent_internal(e[r],t);else je[e]?je[e].features?this.remove_consent_internal(je[e].features,t):(je[e].optin=!1,t&&!1!==je[e].optin&&Ue()):ct(s.WARNING,"remove_consent, No feature available for ["+e+"]")};var Ue=function(){Ne&&(clearTimeout(Ne),Ne=null),Ne=setTimeout(function(){for(var e={},t=0;t<g.features.length;t++)!0===je[g.features[t]].optin?e[g.features[t]]=!0:e[g.features[t]]=!1;tt({consent:JSON.stringify(e)}),ct(s.DEBUG,"Consent update request has been sent to the queue.")},1e3)};function Ge(e,t){if(b.ignore_visitor)ct(s.ERROR,"Adding event failed. Possible bot or user opt out");else if(e.key){e.count||(e.count=1),a.includes(e.key)||(e.key=M(e.key,b.maxKeyLength,"add_cly_event",ct)),e.segmentation=C(e.segmentation,b.maxKeyLength,b.maxValueSize,b.maxSegmentationValues,"add_cly_event",ct);var r=k(e,["key","count","sum","dur","segmentation"]);r.timestamp=T();var i=new Date;r.hour=i.getHours(),r.dow=i.getDay(),r.id=t||y(),r.key===o.VIEW?r.pvid=Fe||"":r.cvid=Le||"",te.push(r),Et("cly_event",te),ct(s.INFO,"With event ID: ["+r.id+"], successfully adding the last event:",r)}else ct(s.ERROR,"Adding event failed. Event must have a key property")}this.enable_offline_mode=function(){ct(s.INFO,"enable_offline_mode, Enabling offline mode"),this.remove_consent_internal(g.features,!1),Se=!0,this.device_id="[CLY]_temp_id",b.device_id=this.device_id,Ce=l.TEMPORARY_ID},this.disable_offline_mode=function(e){if(Se){ct(s.INFO,"disable_offline_mode, Disabling offline mode"),Se=!1,e&&this.device_id!==e?(this.device_id=e,b.device_id=this.device_id,Ce=l.DEVELOPER_SUPPLIED,Et("cly_id",this.device_id),Et("cly_id_type",l.DEVELOPER_SUPPLIED),ct(s.INFO,"disable_offline_mode, Changing id to: "+this.device_id)):(this.device_id=nt(),"[CLY]_temp_id"===this.device_id&&(this.device_id=v()),b.device_id=this.device_id,this.device_id!==St("cly_id")&&(Et("cly_id",this.device_id),Et("cly_id_type",l.SDK_GENERATED)));var t=!1;if(ee.length>0)for(var r=0;r<ee.length;r++)"[CLY]_temp_id"===ee[r].device_id&&(ee[r].device_id=this.device_id,t=!0);t&&Et("cly_queue",ee,!0)}else ct(s.WARNING,"disable_offline_mode, Countly was not in offline mode.")},this.begin_session=function(e,t){if(ct(s.INFO,"begin_session, Starting the session. There was an ongoing session: ["+q+"]"),e&&ct(s.INFO,"begin_session, Heartbeats are disabled"),t&&ct(s.INFO,"begin_session, Session starts irrespective of session cookie"),this.check_consent(n.SESSIONS)){if(!q){this.enableOrientationTracking&&(this.report_orientation(),R(window,"resize",function(){b.report_orientation()})),u=x(),q=!0,se=!e;var r=St("cly_session");if(ct(s.VERBOSE,"begin_session, Session state, forced: ["+t+"], useSessionCookie: ["+be+"], seconds to expire: ["+(r-u)+"], expired: ["+(parseInt(r)<=x())+"] "),t||!be||!r||parseInt(r)<=x()){ct(s.INFO,"begin_session, Session started"),null===Ae&&(Ae=!0);var i={begin_session:1};i.metrics=JSON.stringify(st()),tt(i)}Et("cly_session",x()+60*xe)}}else Ee.begin_session=arguments},this.session_duration=function(e){ct(s.INFO,"session_duration, Reporting session duration"),this.check_consent(n.SESSIONS)&&q&&(ct(s.INFO,"session_duration, Session extended: ",e),tt({session_duration:e}),Qe())},this.end_session=function(e,t){ct(s.INFO,"end_session, Ending the current session. There was an on going session:["+q+"]"),this.check_consent(n.SESSIONS)&&q&&(e=e||x()-u,Je(),!be||t?(ct(s.INFO,"end_session, Session ended"),tt({end_session:1,session_duration:e})):this.session_duration(e),q=!1)},this.change_id=function(e,t){if(ct(s.INFO,"change_id, Changing the ID"),t&&ct(s.INFO,"change_id, Will merge the IDs"),e&&"string"==typeof e&&0!==e.length){if(Se)return ct(s.WARNING,"change_id, Offline mode was on, initiating disabling sequence instead."),void this.disable_offline_mode(e);if(this.device_id!=e){t||(it(),He(),this.end_session(null,!0),ne={},this.remove_consent_internal(g.features,!1));var r=this.device_id;this.device_id=e,b.device_id=this.device_id,Ce=l.DEVELOPER_SUPPLIED,Et("cly_id",this.device_id),Et("cly_id_type",l.DEVELOPER_SUPPLIED),ct(s.INFO,"change_id, Changing ID from:["+r+"] to ["+e+"]"),t?tt({old_device_id:r}):this.begin_session(!se,!0),this.remote_config&&(Et("cly_remote_configs",re={}),this.fetch_remote_config(this.remote_config))}}else ct(s.ERROR,"change_id, The provided ID: ["+e+"] is not a valid ID")},this.add_event=function(e){ct(s.INFO,"add_event, Adding event: ",e);var t=!1;switch(e.key){case o.NPS:case o.SURVEY:t=this.check_consent(n.FEEDBACK);break;case o.STAR_RATING:t=this.check_consent(n.STAR_RATING);break;case o.VIEW:t=this.check_consent(n.VIEWS);break;case o.ORIENTATION:t=this.check_consent(n.USERS);break;case o.ACTION:t=this.check_consent(n.CLICKS)||this.check_consent(n.SCROLLS);break;default:t=this.check_consent(n.EVENTS)}t&&Ge(e)},this.start_event=function(e){e&&"string"==typeof e?(ct(s.INFO,"start_event, Starting timed event with key: ["+e+"]"),e=M(e,b.maxKeyLength,"start_event",ct),ne[e]?ct(s.WARNING,"start_event, Timed event with key: ["+e+"] already started"):ne[e]=x()):ct(s.WARNING,"start_event, you have to provide a valid string key instead of: ["+e+"]")},this.cancel_event=function(e){return e&&"string"==typeof e?(ct(s.INFO,"cancel_event, Canceling timed event with key: ["+e+"]"),e=M(e,b.maxKeyLength,"cancel_event",ct),ne[e]?(delete ne[e],ct(s.INFO,"cancel_event, Timed event with key: ["+e+"] is canceled"),!0):(ct(s.WARNING,"cancel_event, Timed event with key: ["+e+"] was not found"),!1)):(ct(s.WARNING,"cancel_event, you have to provide a valid string key instead of: ["+e+"]"),!1)},this.end_event=function(e){e?(ct(s.INFO,"end_event, Ending timed event"),"string"==typeof e&&(e={key:e=M(e,b.maxKeyLength,"end_event",ct)}),e.key?ne[e.key]?(e.dur=x()-ne[e.key],this.add_event(e),delete ne[e.key]):ct(s.ERROR,"end_event, Timed event with key: ["+e.key+"] was not started"):ct(s.ERROR,"end_event, Timed event must have a key property")):ct(s.WARNING,"end_event, you have to provide a valid string key or event object instead of: ["+e+"]")},this.report_orientation=function(e){ct(s.INFO,"report_orientation, Reporting orientation"),this.check_consent(n.USERS)&&Ge({key:o.ORIENTATION,segmentation:{mode:e||G()}})},this.report_conversion=function(e,t){ct(s.WARNING,"report_conversion, Deprecated function call! Use 'recordDirectAttribution' in place of this call. Call will be redirected now!"),this.recordDirectAttribution(e,t)},this.recordDirectAttribution=function(e,t){ct(s.INFO,"recordDirectAttribution, Recording the attribution for campaign ID: ["+e+"] and the user ID: ["+t+"]"),this.check_consent(n.ATTRIBUTION)&&(e=e||St("cly_cmp_id")||"cly_organic",tt((t=t||St("cly_cmp_uid"))?{campaign_id:e,campaign_user:t}:{campaign_id:e}))},this.user_details=function(e){if(ct(s.INFO,"user_details, Trying to add user details: ",e),this.check_consent(n.USERS)){it(),He(),ct(s.INFO,"user_details, flushed the event queue"),e.name=M(e.name,b.maxValueSize,"user_details",ct),e.username=M(e.username,b.maxValueSize,"user_details",ct),e.email=M(e.email,b.maxValueSize,"user_details",ct),e.organization=M(e.organization,b.maxValueSize,"user_details",ct),e.phone=M(e.phone,b.maxValueSize,"user_details",ct),e.picture=M(e.picture,4096,"user_details",ct),e.gender=M(e.gender,b.maxValueSize,"user_details",ct),e.byear=M(e.byear,b.maxValueSize,"user_details",ct),e.custom=C(e.custom,b.maxKeyLength,b.maxValueSize,b.maxSegmentationValues,"user_details",ct);var t=["name","username","email","organization","phone","picture","gender","byear","custom"];tt({user_details:JSON.stringify(k(e,t))})}};var qe={},$e=function(e,t,r){b.check_consent(n.USERS)&&(qe[e]||(qe[e]={}),"$push"===r||"$pull"===r||"$addToSet"===r?(qe[e][r]||(qe[e][r]=[]),qe[e][r].push(t)):qe[e][r]=t)};function We(e,t,r,i,o){ct(s.INFO,"fetch_remote_config_explicit, Fetching sequence initiated");var a,l={method:"rc",av:b.app_version};e&&(l.keys=JSON.stringify(e)),t&&(l.omit_keys=JSON.stringify(t)),"legacy"===i&&(l.method="fetch_remote_config"),0===r&&(l.oi=0),1===r&&(l.oi=1),"function"==typeof o&&(a=o),b.check_consent(n.SESSIONS)&&(l.metrics=JSON.stringify(st())),b.check_consent(n.REMOTE_CONFIG)?(et(l),ut("fetch_remote_config_explicit",b.url+J,l,function(e,t,r){if(!e){try{var i=JSON.parse(r);if(l.keys||l.omit_keys)for(var n in i)re[n]=i[n];else re=i;Et("cly_remote_configs",re)}catch(o){ct(s.ERROR,"fetch_remote_config_explicit, Had an issue while parsing the response: "+o)}a&&(ct(s.INFO,"fetch_remote_config_explicit, Callback function is provided"),a(e,re))}},!0)):(ct(s.ERROR,"fetch_remote_config_explicit, Remote config requires explicit consent"),a&&a(new Error("Remote config requires explicit consent"),re))}function Ze(){ct(s.INFO,"checkIgnore, Checking if user or visit should be ignored"),b.ignore_prefetch&&m&&void 0!==document.visibilityState&&"prerender"===document.visibilityState&&(b.ignore_visitor=!0,ct(s.DEBUG,"checkIgnore, Ignoring visit due to prerendering")),b.ignore_bots&&B()&&(b.ignore_visitor=!0,ct(s.DEBUG,"checkIgnore, Ignoring visit due to bot"))}function He(){te.length>0&&(ct(s.DEBUG,"Flushing events"),tt({events:JSON.stringify(te)}),Et("cly_event",te=[]))}function Xe(e,t){if(m)if(document.getElementById("countly-feedback-sticker-"+e._id))ct(s.ERROR,"Widget with same ID exists");else try{var r=document.createElement("div");r.className="countly-iframe-wrapper",r.id="countly-iframe-wrapper-"+e._id;var i=document.createElement("span");i.className="countly-feedback-close-icon",i.id="countly-feedback-close-icon-"+e._id,i.innerText="x";var n=document.createElement("iframe");if(n.name="countly-feedback-iframe",n.id="countly-feedback-iframe",n.src=b.url+"/feedback?widget_id="+e._id+"&app_key="+b.app_key+"&device_id="+b.device_id+"&sdk_version="+Be,document.body.appendChild(r),r.appendChild(i),r.appendChild(n),R(document.getElementById("countly-feedback-close-icon-"+e._id),"click",function(){document.getElementById("countly-iframe-wrapper-"+e._id).style.display="none",document.getElementById("cfbg").style.display="none"}),t){var o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.id="feedback-sticker-svg",o.setAttribute("aria-hidden","true"),o.setAttribute("data-prefix","far"),o.setAttribute("data-icon","grin"),o.setAttribute("class","svg-inline--fa fa-grin fa-w-16"),o.setAttribute("role","img"),o.setAttribute("xmlns","http://www.w3.org/2000/svg"),o.setAttribute("viewBox","0 0 496 512");var a=document.createElementNS("http://www.w3.org/2000/svg","path");a.id="smileyPathInStickerSvg",a.setAttribute("fill","white"),a.setAttribute("d","M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm0 448c-110.3 0-200-89.7-200-200S137.7 56 248 56s200 89.7 200 200-89.7 200-200 200zm105.6-151.4c-25.9 8.3-64.4 13.1-105.6 13.1s-79.6-4.8-105.6-13.1c-9.9-3.1-19.4 5.4-17.7 15.3 7.9 47.1 71.3 80 123.3 80s115.3-32.9 123.3-80c1.6-9.8-7.7-18.4-17.7-15.3zM168 240c17.7 0 32-14.3 32-32s-14.3-32-32-32-32 14.3-32 32 14.3 32 32 32zm160 0c17.7 0 32-14.3 32-32s-14.3-32-32-32-32 14.3-32 32 14.3 32 32 32z");var l=document.createElement("span");l.innerText=e.trigger_button_text;var c=document.createElement("div");c.style.color=e.trigger_font_color.length<7?"#"+e.trigger_font_color:e.trigger_font_color,c.style.backgroundColor=e.trigger_bg_color.length<7?"#"+e.trigger_bg_color:e.trigger_bg_color,c.className="countly-feedback-sticker "+e.trigger_position+"-"+e.trigger_size,c.id="countly-feedback-sticker-"+e._id,o.appendChild(a),c.appendChild(o),c.appendChild(l),document.body.appendChild(c);var u=document.getElementById("smileyPathInStickerSvg");u&&(u.style.fill=e.trigger_font_color.length<7?"#"+e.trigger_font_color:e.trigger_font_color),R(document.getElementById("countly-feedback-sticker-"+e._id),"click",function(){document.getElementById("countly-iframe-wrapper-"+e._id).style.display="block",document.getElementById("cfbg").style.display="block"})}else document.getElementById("countly-iframe-wrapper-"+e._id).style.display="block",document.getElementById("cfbg").style.display="block"}catch(he){ct(s.ERROR,"Somethings went wrong while element injecting process: "+he)}else ct(s.WARNING,"processWidget, window object is not available. Not processing widget.")}function Ye(){var e;if(void 0!==b.onload&&b.onload.length>0){for(e=0;e<b.onload.length;e++)"function"==typeof b.onload[e]&&b.onload[e](b);b.onload=[]}}function Je(){if(ce){var e={name:ce};b.check_consent(n.VIEWS)&&(Ge({key:o.VIEW,dur:Ie?x()-ue:de,segmentation:e},Le),ce=null)}}function Ke(){return ce}function Qe(){if(be){var e=St("cly_session");(!e||parseInt(e)<=x())&&(q=!1,b.begin_session(!se)),Et("cly_session",x()+60*xe)}}function et(e){e.app_key=b.app_key,e.device_id=b.device_id,e.sdk_name=ze,e.sdk_version=Be,e.t=Ce,e.av=b.app_version;var t=at();if(e.metrics){var r=JSON.parse(e.metrics);r._ua||(r._ua=t,e.metrics=JSON.stringify(r))}else e.metrics=JSON.stringify({_ua:t});b.check_consent(n.LOCATION)?(b.country_code&&(e.country_code=b.country_code),b.city&&(e.city=b.city),null!==b.ip_address&&(e.ip_address=b.ip_address)):e.location="",e.timestamp=T();var i=new Date;e.hour=i.getHours(),e.dow=i.getDay()}function tt(e){b.ignore_visitor?ct(s.WARNING,"User is opt_out will ignore the request: "+e):b.app_key&&b.device_id?(et(e),ee.length>Q&&ee.shift(),ee.push(e),Et("cly_queue",ee,!0)):ct(s.ERROR,"app_key or device_id is missing ",b.app_key,b.device_id)}function rt(){if(Ye(),b.ignore_visitor)return Te=!1,void ct(s.WARNING,"User opt_out, no heartbeat");if(Te=!0,w&&void 0!==g.q&&g.q.length>0&&it(),q&&se&&Ie){var e=x();e-u>_e&&(b.session_duration(e-u),u=e,b.hcErrorCount>0&&Et(h.errorCount,b.hcErrorCount),b.hcWarningCount>0&&Et(h.warningCount,b.hcWarningCount))}if(te.length>0&&!b.test_mode_eq){if(te.length<=ye)tt({events:JSON.stringify(te)}),te=[];else{var t=te.splice(0,ye);tt({events:JSON.stringify(t)})}Et("cly_event",te)}if(!Se&&ee.length>0&&we&&x()>pe){we=!1;var r=ee[0];r.rr=ee.length,ct(s.DEBUG,"Processing request",r),Et("cly_queue",ee,!0),b.test_mode||ut("send_request_queue",b.url+Y,r,function(e,t){e?pe=x()+fe:ee.shift(),Et("cly_queue",ee,!0),we=!0},!1)}setTimeout(rt,K)}function it(){if(void 0!==g&&void 0!==g.i){var e=g.q;g.q=[];for(var t=0;t<e.length;t++){var r=e[t];if(ct(s.DEBUG,"Processing queued calls:"+r),"function"==typeof r)r();else if(Array.isArray(r)&&r.length>0){var i=b,n=0;try{g.i[r[n]]&&(i=g.i[r[n]],n++)}catch(a){ct(s.DEBUG,"No instance found for the provided key while processing async queue"),g.q.push(r);continue}if("function"==typeof i[r[n]])i[r[n]].apply(i,r.slice(n+1));else if(0===r[n].indexOf("userData.")){var o=r[n].replace("userData.","");"function"==typeof i.userData[o]&&i.userData[o].apply(i,r.slice(n+1))}else"function"==typeof g[r[n]]&&g[r[n]].apply(g,r.slice(n+1))}}}else ct(s.DEBUG,"Countly is not finished initialization yet, will process the queue after initialization is done")}function nt(){var e=St("cly_id");return e?(Ce=St("cly_id_type"),e):v()}function ot(e){return/[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-4[0-9a-fA-F]{3}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}/.test(e)}function at(){return b.metrics._ua||F()}function st(){var e=JSON.parse(JSON.stringify(b.metrics||{}));if(e._app_version=e._app_version||b.app_version,e._ua=e._ua||F(),m&&screen.width){var t=screen.width?parseInt(screen.width):0,r=screen.height?parseInt(screen.height):0;if(0!==t&&0!==r){if(navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)&&window.devicePixelRatio)t=Math.round(t*window.devicePixelRatio),r=Math.round(r*window.devicePixelRatio);else if(90===Math.abs(window.orientation)){var i=t;t=r,r=i}e._resolution=e._resolution||t+"x"+r}}m&&window.devicePixelRatio&&(e._density=e._density||window.devicePixelRatio);var n=navigator.language||navigator.browserLanguage||navigator.systemLanguage||navigator.userLanguage;return void 0!==n&&(e._locale=e._locale||n),lt()&&(e._store=e._store||document.referrer),ct(s.DEBUG,"Got metrics",e),e}function lt(e){if(!m)return!1;var t=e||document.referrer,r=!1;if(void 0===t||0===t.length)ct(s.DEBUG,"Invalid referrer:["+t+"], ignoring.");else{var i=f.exec(t);if(i)if(i[11])if(i[11]===window.location.hostname)ct(s.DEBUG,"Referrer is current host:["+t+"], ignoring.");else if(oe&&oe.length){r=!0;for(var n=0;n<oe.length;n++)if(t.indexOf(oe[n])>=0){ct(s.DEBUG,"Referrer in ignore list:["+t+"], ignoring."),r=!1;break}}else ct(s.DEBUG,"Valid referrer:["+t+"]"),r=!0;else ct(s.DEBUG,"No path found in referrer:["+t+"], ignoring.");else ct(s.DEBUG,"Referrer is corrupt:["+t+"], ignoring.")}return r}function ct(e,r){if(b.debug&&"undefined"!=typeof console){arguments[2]&&"object"===t(arguments[2])&&(arguments[2]=JSON.stringify(arguments[2])),w||(r="["+b.app_key+"] "+r),e||(e=s.DEBUG);for(var i="",n=2;n<arguments.length;n++)i+=arguments[n];var o=e+"[Countly] "+r+i;e===s.ERROR?(console.error(o),kt.incrementErrorCount()):e===s.WARNING?(console.warn(o),kt.incrementWarningCount()):e===s.INFO?console.info(o):e===s.VERBOSE?console.log(o):console.debug(o)}}function ut(e,t,r,i,n){m?ht(e,t,r,i,n):dt(e,t,r,i,n)}function ht(e,t,r,i,n){n=n||!1;try{ct(s.DEBUG,"Sending XML HTTP request");var o=new XMLHttpRequest,a=I(r=r||{}),l="GET";for(var c in(b.force_post||a.length>=2e3)&&(l="POST"),"GET"===l?o.open("GET",t+"?"+a,!0):(o.open("POST",t,!0),o.setRequestHeader("Content-type","application/x-www-form-urlencoded")),b.headers)o.setRequestHeader(c,b.headers[c]);o.onreadystatechange=function(){4===this.readyState&&(ct(s.DEBUG,e+" HTTP request completed with status code: ["+this.status+"] and response: ["+this.responseText+"]"),(n?ft(this.status,this.responseText):pt(this.status,this.responseText))?"function"==typeof i&&i(!1,r,this.responseText):(ct(s.ERROR,e+" Invalid response from server"),"send_request_queue"===e&&kt.saveRequestCounters(this.status,this.responseText),"function"==typeof i&&i(!0,r,this.status,this.responseText)))},"GET"===l?o.send():o.send(a)}catch(he){ct(s.ERROR,e+" Something went wrong while making an XML HTTP request: "+he),"function"==typeof i&&i(!0,r)}}function dt(e,t,r,i,n){var o;n=n||!1;try{ct(s.DEBUG,"Sending Fetch request");var a="GET",l={"Content-type":"application/x-www-form-urlencoded"},c=null;for(var u in r=r||{},b.force_post||I(r).length>=2e3?(a="POST",c=I(r)):t+="?"+I(r),b.headers)l[u]=b.headers[u];fetch(t,{method:a,headers:l,body:c}).then(function(e){return(o=e).text()}).then(function(t){ct(s.DEBUG,e+" Fetch request completed wit status code: ["+o.status+"] and response: ["+t+"]"),(n?ft(o.status,t):pt(o.status,t))?"function"==typeof i&&i(!1,r,t):(ct(s.ERROR,e+" Invalid response from server"),"send_request_queue"===e&&kt.saveRequestCounters(o.status,t),"function"==typeof i&&i(!0,r,o.status,t))}).catch(function(t){ct(s.ERROR,e+" Failed Fetch request: "+t),"function"==typeof i&&i(!0,r)})}catch(he){ct(s.ERROR,e+" Something went wrong with the Fetch request attempt: "+he),"function"==typeof i&&i(!0,r)}}function pt(e,t){if(!(e>=200&&e<300))return ct(s.ERROR,"Http response status code:["+e+"] is not within the expected range"),!1;try{var r=JSON.parse(t);return"[object Object]"!==Object.prototype.toString.call(r)?(ct(s.ERROR,"Http response is not JSON Object"),!1):!!r.result}catch(he){return ct(s.ERROR,"Http response is not JSON: "+he),!1}}function ft(e,t){if(!(e>=200&&e<300))return ct(s.ERROR,"Http response status code:["+e+"] is not within the expected range"),!1;try{var r=JSON.parse(t);return!("[object Object]"!==Object.prototype.toString.call(r)&&!Array.isArray(r)&&(ct(s.ERROR,"Http response is not JSON Object nor JSON Array"),1))}catch(he){return ct(s.ERROR,"Http response is not JSON: "+he),!1}}function mt(){m?De=Math.max(De,window.scrollY,document.body.scrollTop,document.documentElement.scrollTop):ct(s.WARNING,"processScroll, window object is not available. Not processing scroll.")}function gt(){if(m){if(Me){Me=!1;var e=j(),t=V(),r=U();if(b.check_consent(n.SCROLLS)){var i={type:"scroll",y:De+r,width:t,height:e,view:b.getViewUrl()};i=C(i,b.maxKeyLength,b.maxValueSize,b.maxSegmentationValues,"processScrollView",ct),b.track_domains&&(i.domain=window.location.hostname),Ge({key:o.ACTION,segmentation:i})}}}else ct(s.WARNING,"processScrollView, window object is not available. Not processing scroll view.")}function _t(){return Ce}function yt(e){Et("cly_token",e)}function vt(){var e=St("cly_token");return It("cly_token"),e}function bt(){return te}function xt(){return ee}function wt(e){for(var t=e+"=",r=document.cookie.split(";"),i=0,n=r.length;i<n;i++){for(var o=r[i];" "===o.charAt(0);)o=o.substring(1,o.length);if(0===o.indexOf(t))return o.substring(t.length,o.length)}return null}function Tt(e,t,r){var i=new Date;i.setTime(i.getTime()+24*r*60*60*1e3);var n="; expires="+i.toGMTString();document.cookie=e+"="+t+n+"; path=/"}function St(e,r,i){var n;if("none"!==b.storage&&("object"===t(b.storage)||m))return i||(e=b.app_key+"/"+e,b.namespace&&(e=P(b.namespace)+"/"+e)),"object"===t(b.storage)&&"function"==typeof b.storage.getItem?(n=b.storage.getItem(e),e.endsWith("cly_id")?n:b.deserialize(n)):(void 0===r&&(r=ke),r?n=localStorage.getItem(e):"localstorage"!==b.storage&&(n=wt(e)),e.endsWith("cly_id")?n:b.deserialize(n));ct(s.DEBUG,"Storage is disabled. Value with key: ["+e+"] won't be retrieved")}function Et(e,r,i,n){if("none"===b.storage||"object"!==t(b.storage)&&!m)ct(s.DEBUG,"Storage is disabled. Value with key: "+e+" won't be stored");else if(n||(e=b.app_key+"/"+e,b.namespace&&(e=P(b.namespace)+"/"+e)),null!=r){if("object"===t(b.storage)&&"function"==typeof b.storage.setItem)return void b.storage.setItem(e,r);void 0===i&&(i=ke),r=b.serialize(r),i?localStorage.setItem(e,r):"localstorage"!==b.storage&&Tt(e,r,30)}}function It(e,r,i){"none"===b.storage||"object"!==t(b.storage)&&!m?ct(s.DEBUG,"Storage is disabled. Value with key: "+e+" won't be removed"):(i||(e=b.app_key+"/"+e,b.namespace&&(e=P(b.namespace)+"/"+e)),"object"!==t(b.storage)||"function"!=typeof b.storage.removeItem?(void 0===r&&(r=ke),r?localStorage.removeItem(e):"localstorage"!==b.storage&&Tt(e,"",-1)):b.storage.removeItem(e))}function Pt(){if(St(b.namespace+"cly_id",!1,!0)){Et("cly_id",St(b.namespace+"cly_id",!1,!0)),Et("cly_id_type",St(b.namespace+"cly_id_type",!1,!0)),Et("cly_event",St(b.namespace+"cly_event",!1,!0)),Et("cly_session",St(b.namespace+"cly_session",!1,!0));var e=St(b.namespace+"cly_queue",!1,!0);Array.isArray(e)&&Et("cly_queue",e=e.filter(function(e){return e.app_key===b.app_key})),St(b.namespace+"cly_cmp_id",!1,!0)&&(Et("cly_cmp_id",St(b.namespace+"cly_cmp_id",!1,!0)),Et("cly_cmp_uid",St(b.namespace+"cly_cmp_uid",!1,!0))),St(b.namespace+"cly_ignore",!1,!0)&&Et("cly_ignore",St(b.namespace+"cly_ignore",!1,!0)),It("cly_id",!1,!0),It("cly_id_type",!1,!0),It("cly_event",!1,!0),It("cly_session",!1,!0),It("cly_queue",!1,!0),It("cly_cmp_id",!1,!0),It("cly_cmp_uid",!1,!0),It("cly_ignore",!1,!0)}}this.userData={set:function(e,t){ct(s.INFO,"[userData] set, Setting user's custom property value: ["+t+"] under the key: ["+e+"]"),e=M(e,b.maxKeyLength,"userData set",ct),t=M(t,b.maxValueSize,"userData set",ct),qe[e]=t},unset:function(e){ct(s.INFO,"[userData] unset, Resetting user's custom property with key: ["+e+"] "),qe[e]=""},set_once:function(e,t){ct(s.INFO,"[userData] set_once, Setting user's unique custom property value: ["+t+"] under the key: ["+e+"] "),e=M(e,b.maxKeyLength,"userData set_once",ct),t=M(t,b.maxValueSize,"userData set_once",ct),$e(e,t,"$setOnce")},increment:function(e){ct(s.INFO,"[userData] increment, Increasing user's custom property value under the key: ["+e+"] by one"),e=M(e,b.maxKeyLength,"userData increment",ct),$e(e,1,"$inc")},increment_by:function(e,t){ct(s.INFO,"[userData] increment_by, Increasing user's custom property value under the key: ["+e+"] by: ["+t+"]"),e=M(e,b.maxKeyLength,"userData increment_by",ct),t=M(t,b.maxValueSize,"userData increment_by",ct),$e(e,t,"$inc")},multiply:function(e,t){ct(s.INFO,"[userData] multiply, Multiplying user's custom property value under the key: ["+e+"] by: ["+t+"]"),e=M(e,b.maxKeyLength,"userData multiply",ct),t=M(t,b.maxValueSize,"userData multiply",ct),$e(e,t,"$mul")},max:function(e,t){ct(s.INFO,"[userData] max, Saving user's maximum custom property value compared to the value: ["+t+"] under the key: ["+e+"]"),e=M(e,b.maxKeyLength,"userData max",ct),t=M(t,b.maxValueSize,"userData max",ct),$e(e,t,"$max")},min:function(e,t){ct(s.INFO,"[userData] min, Saving user's minimum custom property value compared to the value: ["+t+"] under the key: ["+e+"]"),e=M(e,b.maxKeyLength,"userData min",ct),t=M(t,b.maxValueSize,"userData min",ct),$e(e,t,"$min")},push:function(e,t){ct(s.INFO,"[userData] push, Pushing a value: ["+t+"] under the key: ["+e+"] to user's custom property array"),e=M(e,b.maxKeyLength,"userData push",ct),t=M(t,b.maxValueSize,"userData push",ct),$e(e,t,"$push")},push_unique:function(e,t){ct(s.INFO,"[userData] push_unique, Pushing a unique value: ["+t+"] under the key: ["+e+"] to user's custom property array"),e=M(e,b.maxKeyLength,"userData push_unique",ct),t=M(t,b.maxValueSize,"userData push_unique",ct),$e(e,t,"$addToSet")},pull:function(e,t){ct(s.INFO,"[userData] pull, Removing the value: ["+t+"] under the key: ["+e+"] from user's custom property array"),$e(e,t,"$pull")},save:function(){ct(s.INFO,"[userData] save, Saving changes to user's custom property"),b.check_consent(n.USERS)&&(it(),He(),ct(s.INFO,"user_details, flushed the event queue"),tt({user_details:JSON.stringify({custom:qe})})),qe={}}},this.report_trace=function(e){if(ct(s.INFO,"report_trace, Reporting performance trace"),this.check_consent(n.APM)){for(var t=["type","name","stz","etz","apm_metrics","apm_attr"],r=0;r<t.length;r++)if("apm_attr"!==t[r]&&void 0===e[t[r]])return void ct(s.WARNING,"report_trace, APM trace don't have the property: "+t[r]);e.name=M(e.name,b.maxKeyLength,"report_trace",ct),e.app_metrics=C(e.app_metrics,b.maxKeyLength,b.maxValueSize,b.maxSegmentationValues,"report_trace",ct);var i=k(e,t);i.timestamp=e.stz;var o=new Date;i.hour=o.getHours(),i.dow=o.getDay(),tt({apm:JSON.stringify(i)}),ct(s.INFO,"report_trace, Successfully adding APM trace: ",i)}},this.track_errors=function(e){m?(ct(s.INFO,"track_errors, Started tracking errors"),g.i[this.app_key].tracking_crashes=!0,window.cly_crashes||(window.cly_crashes=!0,ae=e,window.onerror=function e(t,r,i,n,o){if(null!=o)E(o,!1);else{var a="";void 0!==t&&(a+=t+"\n"),void 0!==r&&(a+="at "+r),void 0!==i&&(a+=":"+i),void 0!==(n=n||window.event&&window.event.errorCharacter)&&(a+=":"+n),a+="\n";try{for(var l=[],c=e.caller;c;)l.push(c.name),c=c.caller;a+=l.join("\n")}catch(u){ct(s.ERROR,"track_errors, Call stack generation experienced a problem: "+u)}E(a,!1)}},window.addEventListener("unhandledrejection",function(e){E(new Error("Unhandled rejection (reason: "+(e.reason&&e.reason.stack?e.reason.stack:e.reason)+")."),!0)}))):ct(s.WARNING,"track_errors, window object is not available. Not tracking errors.")},this.log_error=function(e,t){ct(s.INFO,"log_error, Logging errors"),this.recordError(e,!0,t)},this.add_log=function(e){if(ct(s.INFO,"add_log, Adding a new log of breadcrumbs: [ "+e+" ]"),this.check_consent(n.CRASHES)){for(e=M(e,b.maxValueSize,"add_log",ct);ie.length>=b.maxBreadcrumbCount;)ie.shift(),ct(s.WARNING,"add_log, Reached maximum crashLogs size. Will erase the oldest one.");ie.push(e)}},this.fetch_remote_config=function(e,t,r){var i=null,n=null,o=null;if(e&&(r||"function"!=typeof e?Array.isArray(e)&&(i=e):o=e),t&&(r||"function"!=typeof t?Array.isArray(t)&&(n=t):o=t),o||"function"!=typeof r||(o=r),this.useExplicitRcApi)return ct(s.INFO,"fetch_remote_config, Fetching remote config"),void We(i,n,this.rcAutoOptinAb?1:0,null,o);ct(s.WARNING,"fetch_remote_config, Fetching remote config, with legacy API"),We(i,n,null,"legacy",o)},this.enrollUserToAb=function(e){if(ct(s.INFO,"enrollUserToAb, Providing AB test keys to opt in for"),e&&Array.isArray(e)&&0!==e.length){var t={method:"ab",keys:JSON.stringify(e),av:b.app_version};et(t),ut("enrollUserToAb",this.url+J,t,function(e,t,r){if(!e)try{var i=JSON.parse(r);ct(s.DEBUG,"enrollUserToAb, Parsed the response's result: ["+i.result+"]")}catch(n){ct(s.ERROR,"enrollUserToAb, Had an issue while parsing the response: "+n)}},!0)}else ct(s.ERROR,"enrollUserToAb, No keys provided")},this.get_remote_config=function(e){return ct(s.INFO,"get_remote_config, Getting remote config from storage"),void 0!==e?re[e]:re},this.stop_time=function(){ct(s.INFO,"stop_time, Stopping tracking duration"),Ie&&(Ie=!1,le=x()-u,de=x()-ue)},this.start_time=function(){ct(s.INFO,"start_time, Starting tracking duration"),Ie||(Ie=!0,u=x()-le,ue=x()-de,de=0,Qe())},this.track_sessions=function(){if(m){ct(s.INFO,"track_session, Starting tracking user session"),this.begin_session(),this.start_time(),R(window,"beforeunload",function(){it(),He(),b.end_session()});var e="hidden";R(window,"focus",t),R(window,"blur",t),R(window,"pageshow",t),R(window,"pagehide",t),"onfocusin"in document&&(R(window,"focusin",t),R(window,"focusout",t)),e in document?document.addEventListener("visibilitychange",t):"mozHidden"in document?(e="mozHidden",document.addEventListener("mozvisibilitychange",t)):"webkitHidden"in document?(e="webkitHidden",document.addEventListener("webkitvisibilitychange",t)):"msHidden"in document&&(e="msHidden",document.addEventListener("msvisibilitychange",t)),R(window,"mousemove",r),R(window,"click",r),R(window,"keydown",r),R(window,"scroll",r),setInterval(function(){++ge>=me&&b.stop_time()},6e4)}else ct(s.WARNING,"track_sessions, window object is not available. Not tracking sessions.");function t(){document[e]||!document.hasFocus()?b.stop_time():b.start_time()}function r(){ge>=me&&b.start_time(),ge=0}},this.track_pageview=function(e,t,r){if(m||e)if(ct(s.INFO,"track_pageview, Tracking page views"),ct(s.VERBOSE,"track_pageview, last view is:["+ce+"], current view ID is:["+Le+"], previous view ID is:["+Fe+"]"),ce&&Re&&(ct(s.DEBUG,"track_pageview, Scroll registry triggered"),gt(),Me=!0,De=0),Je(),Fe=Le,Le=y(),(e=M(e,b.maxKeyLength,"track_pageview",ct))&&Array.isArray(e)&&(t=e,e=null),e||(e=this.getViewName()),void 0!==e&&""!==e)if(null!==e){if(t&&t.length)for(var i=0;i<t.length;i++)try{if(new RegExp(t[i]).test(e))return void ct(s.INFO,"track_pageview, Ignoring the page: "+e)}catch(d){ct(s.ERROR,"track_pageview, Problem with finding ignore list item: "+t[i]+", error: "+d)}ce=e,ue=x(),ct(s.VERBOSE,"track_pageview, last view is assigned:["+ce+"], current view ID is:["+Le+"], previous view ID is:["+Fe+"]");var a={name:e,visit:1,view:b.getViewUrl()};if(a=C(a,b.maxKeyLength,b.maxValueSize,b.maxSegmentationValues,"track_pageview",ct),this.track_domains&&(a.domain=window.location.hostname),be)if(q)Ae&&(Ae=!1,a.start=1);else{var l=St("cly_session");(!l||parseInt(l)<=x())&&(Ae=!1,a.start=1)}else if(m&&void 0!==document.referrer&&document.referrer.length){var c=f.exec(document.referrer);c&&c[11]&&c[11]!==window.location.hostname&&(a.start=1)}if(Oe&&Object.keys(Oe).length)for(var u in ct(s.INFO,"track_pageview, Adding fresh utm tags to segmentation:["+JSON.stringify(Oe)+"]"),Oe)void 0===a["utm_"+u]&&(a["utm_"+u]=Oe[u]);if(m&<()&&(ct(s.INFO,"track_pageview, Adding referrer to segmentation:["+document.referrer+"]"),a.referrer=document.referrer),r)for(var h in r=C(r,b.maxKeyLength,b.maxValueSize,b.maxSegmentationValues,"track_pageview",ct))void 0===a[h]&&(a[h]=r[h]);this.check_consent(n.VIEWS)?Ge({key:o.VIEW,segmentation:a},Le):Ee.track_pageview=arguments}else ct(s.ERROR,"track_pageview, View name returned as null. Page view will be ignored.");else ct(s.ERROR,"track_pageview, No page name to track (it is either undefined or empty string). No page view can be tracked.");else ct(s.WARNING,"track_pageview, window object is not available. Not tracking page views is page is not provided.")},this.track_view=function(e,t,r){ct(s.INFO,"track_view, Initiating tracking page views"),this.track_pageview(e,t,r)},this.track_clicks=function(e){if(m){ct(s.INFO,"track_clicks, Starting to track clicks"),e&&ct(s.INFO,"track_clicks, Tracking the specified children:["+e+"]"),e=e||document;var t=!0;R(e,"click",r)}else ct(s.WARNING,"track_clicks, window object is not available. Not tracking clicks.");function r(e){if(t){if(t=!1,N(e),void 0!==e.pageX&&void 0!==e.pageY){var r=j(),i=V();if(b.check_consent(n.CLICKS)){var a={type:"click",x:e.pageX,y:e.pageY,width:i,height:r,view:b.getViewUrl()};a=C(a,b.maxKeyLength,b.maxValueSize,b.maxSegmentationValues,"processClick",ct),b.track_domains&&(a.domain=window.location.hostname),Ge({key:o.ACTION,segmentation:a})}}setTimeout(function(){t=!0},1e3)}}},this.track_scrolls=function(e){m?(ct(s.INFO,"track_scrolls, Starting to track scrolls"),e&&ct(s.INFO,"track_scrolls, Tracking the specified children"),e=e||window,Me=!0,Re=!0,R(e,"scroll",mt),R(e,"beforeunload",gt)):ct(s.WARNING,"track_scrolls, window object is not available. Not tracking scrolls.")},this.track_links=function(e){function t(e){var t=D(L(e),"a");t&&(N(e),b.check_consent(n.CLICKS)&&Ge({key:"linkClick",segmentation:{href:t.href,text:t.innerText,id:t.id,view:b.getViewUrl()}}))}m?(ct(s.INFO,"track_links, Starting to track clicks to links"),e&&ct(s.INFO,"track_links, Tracking the specified children"),R(e=e||document,"click",t)):ct(s.WARNING,"track_links, window object is not available. Not tracking links.")},this.track_forms=function(e,t){function r(e){return e.name||e.id||e.type||e.nodeName}function i(e){var i,o=L(e),a={id:o.attributes.id&&o.attributes.id.nodeValue,name:o.attributes.name&&o.attributes.name.nodeValue,action:o.attributes.action&&o.attributes.action.nodeValue,method:o.attributes.method&&o.attributes.method.nodeValue,view:b.getViewUrl()};if(void 0!==o.elements){for(var s=0;s<o.elements.length;s++)(i=o.elements[s])&&"password"!==i.type&&-1===i.className.indexOf("cly_user_ignore")&&(void 0===a["input:"+r(i)]&&(a["input:"+r(i)]=[]),"select"===i.nodeName.toLowerCase()?void 0!==i.multiple?a["input:"+r(i)].push(_(i)):a["input:"+r(i)].push(i.options[i.selectedIndex].value):"input"===i.nodeName.toLowerCase()?void 0!==i.type?"checkbox"===i.type.toLowerCase()||"radio"===i.type.toLowerCase()?i.checked&&a["input:"+r(i)].push(i.value):("hidden"!==i.type.toLowerCase()||t)&&a["input:"+r(i)].push(i.value):a["input:"+r(i)].push(i.value):("textarea"===i.nodeName.toLowerCase()||void 0!==i.value)&&a["input:"+r(i)].push(i.value));for(var l in a)a[l]&&"function"==typeof a[l].join&&(a[l]=a[l].join(", "))}b.check_consent(n.FORMS)&&Ge({key:"formSubmit",segmentation:a})}m?(ct(s.INFO,"track_forms, Starting to track form submissions. DOM object provided:["+!!e+"] Tracking hidden inputs :["+!!t+"]"),R(e=e||document,"submit",i)):ct(s.WARNING,"track_forms, window object is not available. Not tracking forms.")},this.collect_from_forms=function(e,t){function r(r){var i,n=L(r),o={},a=!1;if(void 0!==n.elements){var l,c,u={},h=e.getElementsByTagName("LABEL");for(l=0;l<h.length;l++)h[l].htmlFor&&""!==h[l].htmlFor&&(u[h[l].htmlFor]=h[l].innerText||h[l].textContent||h[l].innerHTML);for(l=0;l<n.elements.length;l++)if((i=n.elements[l])&&"password"!==i.type&&-1===i.className.indexOf("cly_user_ignore")){var d="";if("select"===i.nodeName.toLowerCase()?d=void 0!==i.multiple?_(i):i.options[i.selectedIndex].value:"input"===i.nodeName.toLowerCase()?(void 0===i.type||"checkbox"!==i.type.toLowerCase()&&"radio"!==i.type.toLowerCase()||i.checked)&&(d=i.value):("textarea"===i.nodeName.toLowerCase()||void 0!==i.value)&&(d=i.value),i.className&&-1!==i.className.indexOf("cly_user_")){var p=i.className.split(" ");for(c=0;c<p.length;c++)if(0===p[c].indexOf("cly_user_")){o[p[c].replace("cly_user_","")]=d,a=!0;break}}else i.type&&"email"===i.type.toLowerCase()||i.name&&-1!==i.name.toLowerCase().indexOf("email")||i.id&&-1!==i.id.toLowerCase().indexOf("email")||i.id&&u[i.id]&&-1!==u[i.id].toLowerCase().indexOf("email")||/[^@\s]+@[^@\s]+\.[^@\s]+/.test(d)?(o.email||(o.email=d),a=!0):i.name&&-1!==i.name.toLowerCase().indexOf("username")||i.id&&-1!==i.id.toLowerCase().indexOf("username")||i.id&&u[i.id]&&-1!==u[i.id].toLowerCase().indexOf("username")?(o.username||(o.username=d),a=!0):i.name&&(-1!==i.name.toLowerCase().indexOf("tel")||-1!==i.name.toLowerCase().indexOf("phone")||-1!==i.name.toLowerCase().indexOf("number"))||i.id&&(-1!==i.id.toLowerCase().indexOf("tel")||-1!==i.id.toLowerCase().indexOf("phone")||-1!==i.id.toLowerCase().indexOf("number"))||i.id&&u[i.id]&&(-1!==u[i.id].toLowerCase().indexOf("tel")||-1!==u[i.id].toLowerCase().indexOf("phone")||-1!==u[i.id].toLowerCase().indexOf("number"))?(o.phone||(o.phone=d),a=!0):i.name&&(-1!==i.name.toLowerCase().indexOf("org")||-1!==i.name.toLowerCase().indexOf("company"))||i.id&&(-1!==i.id.toLowerCase().indexOf("org")||-1!==i.id.toLowerCase().indexOf("company"))||i.id&&u[i.id]&&(-1!==u[i.id].toLowerCase().indexOf("org")||-1!==u[i.id].toLowerCase().indexOf("company"))?(o.organization||(o.organization=d),a=!0):(i.name&&-1!==i.name.toLowerCase().indexOf("name")||i.id&&-1!==i.id.toLowerCase().indexOf("name")||i.id&&u[i.id]&&-1!==u[i.id].toLowerCase().indexOf("name"))&&(o.name||(o.name=""),o.name+=d+" ",a=!0)}}a&&(ct(s.INFO,"collect_from_forms, Gathered user data",o),t?b.user_details({custom:o}):b.user_details(o))}m?(ct(s.INFO,"collect_from_forms, Starting to collect possible user data. DOM object provided:["+!!e+"] Submitting custom user property:["+!!t+"]"),R(e=e||document,"submit",r)):ct(s.WARNING,"collect_from_forms, window object is not available. Not collecting from forms.")},this.collect_from_facebook=function(e){m?"undefined"!=typeof FB&&FB&&FB.api?(ct(s.INFO,"collect_from_facebook, Starting to collect possible user data"),FB.api("/me",function(t){var r={};if(t.name&&(r.name=t.name),t.email&&(r.email=t.email),"male"===t.gender?r.gender="M":"female"===t.gender&&(r.gender="F"),t.birthday){var i=t.birthday.split("/").pop();i&&4===i.length&&(r.byear=i)}if(t.work&&t.work[0]&&t.work[0].employer&&t.work[0].employer.name&&(r.organization=t.work[0].employer.name),e)for(var n in r.custom={},e){for(var o=e[n].split("."),a=t,s=0;s<o.length&&void 0!==(a=a[o[s]]);s++);void 0!==a&&(r.custom[n]=a)}b.user_details(r)})):ct(s.ERROR,"collect_from_facebook, Facebook SDK is not available"):ct(s.WARNING,"collect_from_facebook, window object is not available. Not collecting from Facebook.")},this.opt_out=function(){ct(s.INFO,"opt_out, Opting out the user"),this.ignore_visitor=!0,Et("cly_ignore",!0)},this.opt_in=function(){ct(s.INFO,"opt_in, Opting in the user"),Et("cly_ignore",!1),this.ignore_visitor=!1,Ze(),this.ignore_visitor||Te||rt()},this.report_feedback=function(e){ct(s.WARNING,"report_feedback, Deprecated function call! Use 'recordRatingWidgetWithID' or 'reportFeedbackWidgetManually' in place of this call. Call will be redirected to 'recordRatingWidgetWithID' now!"),this.recordRatingWidgetWithID(e)},this.recordRatingWidgetWithID=function(e){if(ct(s.INFO,"recordRatingWidgetWithID, Providing information about user with ID: [ "+e.widget_id+" ]"),this.check_consent(n.STAR_RATING))if(e.widget_id)if(e.rating){var t=["widget_id","contactMe","platform","app_version","rating","email","comment"],r={key:o.STAR_RATING,count:1,segmentation:{}};r.segmentation=k(e,t),r.segmentation.app_version||(r.segmentation.app_version=this.metrics._app_version||this.app_version),r.segmentation.rating>5?(ct(s.WARNING,"recordRatingWidgetWithID, You have entered a rating higher than 5. Changing it back to 5 now."),r.segmentation.rating=5):r.segmentation.rating<1&&(ct(s.WARNING,"recordRatingWidgetWithID, You have entered a rating lower than 1. Changing it back to 1 now."),r.segmentation.rating=1),ct(s.INFO,"recordRatingWidgetWithID, Reporting Rating Widget: ",r),Ge(r)}else ct(s.ERROR,"recordRatingWidgetWithID, Rating Widget must contain rating property");else ct(s.ERROR,"recordRatingWidgetWithID, Rating Widget must contain widget_id property")},this.reportFeedbackWidgetManually=function(e,t,r){if(this.check_consent(n.FEEDBACK))if(e&&t)if(e._id)if(Se)ct(s.ERROR,"reportFeedbackWidgetManually, Feedback Widgets can not be reported in offline mode");else{ct(s.INFO,"reportFeedbackWidgetManually, Providing information about user with, provided result of the widget with ID: [ "+e._id+" ] and type: ["+e.type+"]");var i,a=[],l=e.type;if("nps"===l){if(r){if(!r.rating)return void ct(s.ERROR,"reportFeedbackWidgetManually, Widget must contain rating property");r.rating=Math.round(r.rating),r.rating>10?(ct(s.WARNING,"reportFeedbackWidgetManually, You have entered a rating higher than 10. Changing it back to 10 now."),r.rating=10):r.rating<0&&(ct(s.WARNING,"reportFeedbackWidgetManually, You have entered a rating lower than 0. Changing it back to 0 now."),r.rating=0),a=["rating","comment"]}i=o.NPS}else if("survey"===l){if(r){if(Object.keys(r).length<1)return void ct(s.ERROR,"reportFeedbackWidgetManually, Widget should have answers to be reported");a=Object.keys(r)}i=o.SURVEY}else{if("rating"!==l)return void ct(s.ERROR,"reportFeedbackWidgetManually, Widget has an unacceptable type");if(r){if(!r.rating)return void ct(s.ERROR,"reportFeedbackWidgetManually, Widget must contain rating property");r.rating=Math.round(r.rating),r.rating>5?(ct(s.WARNING,"reportFeedbackWidgetManually, You have entered a rating higher than 5. Changing it back to 5 now."),r.rating=5):r.rating<1&&(ct(s.WARNING,"reportFeedbackWidgetManually, You have entered a rating lower than 1. Changing it back to 1 now."),r.rating=1),a=["rating","comment","email","contactMe"]}i=o.STAR_RATING}var c={key:i,count:1,segmentation:{widget_id:e._id,platform:this.platform,app_version:this.metrics._app_version||this.app_version}};null===r?c.segmentation.closed=1:c.segmentation=A(c.segmentation,r,a),ct(s.INFO,"reportFeedbackWidgetManually, Reporting "+l+": ",c),Ge(c)}else ct(s.ERROR,"reportFeedbackWidgetManually, Feedback Widgets must contain _id property");else ct(s.ERROR,"reportFeedbackWidgetManually, Widget data and/or Widget object not provided. Aborting.")},this.show_feedback_popup=function(e){m?(ct(s.WARNING,"show_feedback_popup, Deprecated function call! Use 'presentRatingWidgetWithID' in place of this call. Call will be redirected now!"),this.presentRatingWidgetWithID(e)):ct(s.WARNING,"show_feedback_popup, window object is not available. Not showing feedback popup.")},this.presentRatingWidgetWithID=function(e){m?(ct(s.INFO,"presentRatingWidgetWithID, Showing rating widget popup for the widget with ID: [ "+e+" ]"),this.check_consent(n.STAR_RATING)&&(Se?ct(s.ERROR,"presentRatingWidgetWithID, Cannot show ratingWidget popup in offline mode"):ut("presentRatingWidgetWithID,",this.url+"/o/feedback/widget",{widget_id:e,av:b.app_version},function(e,t,r){if(!e)try{Xe(JSON.parse(r),!1)}catch(i){ct(s.ERROR,"presentRatingWidgetWithID, JSON parse failed: "+i)}},!0))):ct(s.WARNING,"presentRatingWidgetWithID, window object is not available. Not showing rating widget popup.")},this.initialize_feedback_popups=function(e){m?(ct(s.WARNING,"initialize_feedback_popups, Deprecated function call! Use 'initializeRatingWidgets' in place of this call. Call will be redirected now!"),this.initializeRatingWidgets(e)):ct(s.WARNING,"initialize_feedback_popups, window object is not available. Not initializing feedback popups.")},this.initializeRatingWidgets=function(e){if(m){if(ct(s.INFO,"initializeRatingWidgets, Initializing rating widget with provided widget IDs:[ "+e+"]"),this.check_consent(n.STAR_RATING)){e||(e=St("cly_fb_widgets"));for(var t=document.getElementsByClassName("countly-feedback-sticker");t.length>0;)t[0].remove();ut("initializeRatingWidgets,",this.url+"/o/feedback/multiple-widgets-by-id",{widgets:JSON.stringify(e),av:b.app_version},function(e,t,r){if(!e)try{for(var i=JSON.parse(r),n=0;n<i.length;n++)if("true"===i[n].is_active&&i[n].target_devices[z()])if("string"==typeof i[n].hide_sticker&&(i[n].hide_sticker="true"===i[n].hide_sticker),"all"!==i[n].target_page||i[n].hide_sticker)for(var o=i[n].target_pages,a=0;a<o.length;a++){var l=o[a].substr(0,o[a].length-1)===window.location.pathname.substr(0,o[a].length-1),c=o[a]===window.location.pathname;(o[a].includes("*")&&l||c)&&!i[n].hide_sticker&&Xe(i[n],!0)}else Xe(i[n],!0)}catch(u){ct(s.ERROR,"initializeRatingWidgets, JSON parse error: "+u)}},!0)}}else ct(s.WARNING,"initializeRatingWidgets, window object is not available. Not initializing rating widgets.")},this.enable_feedback=function(e){m?(ct(s.WARNING,"enable_feedback, Deprecated function call! Use 'enableRatingWidgets' in place of this call. Call will be redirected now!"),this.enableRatingWidgets(e)):ct(s.WARNING,"enable_feedback, window object is not available. Not enabling feedback.")},this.enableRatingWidgets=function(e){if(m){if(ct(s.INFO,"enableRatingWidgets, Enabling rating widget with params:",e),this.check_consent(n.STAR_RATING))if(Se)ct(s.ERROR,"enableRatingWidgets, Cannot enable rating widgets in offline mode");else{Et("cly_fb_widgets",e.popups||e.widgets),W(this.url+"/star-rating/stylesheets/countly-feedback-web.css");var t=e.popups||e.widgets;t.length>0?(document.body.insertAdjacentHTML("beforeend",'<div id="cfbg"></div>'),this.initializeRatingWidgets(t)):ct(s.ERROR,"enableRatingWidgets, You should provide at least one widget id as param. Read documentation for more detail. https://resources.count.ly/plugins/feedback")}}else ct(s.WARNING,"enableRatingWidgets, window object is not available. Not enabling rating widgets.")},this.get_available_feedback_widgets=function(e){ct(s.INFO,"get_available_feedback_widgets, Getting the feedback list, callback function is provided:["+!!e+"]"),this.check_consent(n.FEEDBACK)?Se?ct(s.ERROR,"get_available_feedback_widgets, Cannot enable feedback widgets in offline mode."):ut("get_available_feedback_widgets,",this.url+J,{method:n.FEEDBACK,device_id:this.device_id,app_key:this.app_key,av:b.app_version},function(t,r,i){if(t)e&&e(null,t);else try{var n=JSON.parse(i).result||[];e&&e(n,null)}catch(o){ct(s.ERROR,"get_available_feedback_widgets, Error while parsing feedback widgets list: "+o),e&&e(null,o)}},!1):e&&e(null,new Error("Consent for feedback not provided."))},this.getFeedbackWidgetData=function(e,t){if(e.type)if(ct(s.INFO,"getFeedbackWidgetData, Retrieving data for: ["+JSON.stringify(e)+"], callback function is provided:["+!!t+"]"),this.check_consent(n.FEEDBACK))if(Se)ct(s.ERROR,"getFeedbackWidgetData, Cannot enable feedback widgets in offline mode.");else{var r=this.url,i={widget_id:e._id,shown:1,sdk_version:Be,sdk_name:ze,platform:this.platform,app_version:this.app_version};if("nps"===e.type)r+="/o/surveys/nps/widget";else if("survey"===e.type)r+="/o/surveys/survey/widget";else{if("rating"!==e.type)return void ct(s.ERROR,"getFeedbackWidgetData, Unknown type info: ["+e.type+"]");r+="/o/surveys/rating/widget"}ut("getFeedbackWidgetData,",r,i,o,!0)}else t&&t(null,new Error("Consent for feedback not provided."));else ct(s.ERROR,"getFeedbackWidgetData, Expected the provided widget object to have a type but got: ["+JSON.stringify(e)+"], aborting.");function o(e,r,i){if(e)t&&t(null,e);else try{var n=JSON.parse(i);t&&t(n,null)}catch(o){ct(s.ERROR,"getFeedbackWidgetData, Error while parsing feedback widgets list: "+o),t&&t(null,o)}}},this.present_feedback_widget=function(e,r,i,o){if(m){if(ct(s.INFO,"present_feedback_widget, Presenting the feedback widget by appending to the element with ID: [ "+r+" ] and className: [ "+i+" ]"),this.check_consent(n.FEEDBACK))if(e&&"object"===t(e)&&!Array.isArray(e)){ct(s.INFO,"present_feedback_widget, Adding segmentation to feedback widgets:["+JSON.stringify(o)+"]"),o&&"object"===t(o)&&0!==Object.keys(o).length||(ct(s.DEBUG,"present_feedback_widget, Segmentation is not an object or empty"),o=null);try{var a=this.url;if("nps"===e.type)ct(s.DEBUG,"present_feedback_widget, Widget type: nps."),a+="/feedback/nps";else if("survey"===e.type)ct(s.DEBUG,"present_feedback_widget, Widget type: survey."),a+="/feedback/survey";else{if("rating"!==e.type)return void ct(s.ERROR,"present_feedback_widget, Feedback widget only accepts nps, rating and survey types.");ct(s.DEBUG,"present_feedback_widget, Widget type: rating."),a+="/feedback/rating"}var l,c=window.origin||window.location.origin;if("rating"===e.type?(ct(s.DEBUG,"present_feedback_widget, Loading css for rating widget."),l="ratings",W(this.url+"/star-rating/stylesheets/countly-feedback-web.css")):(ct(s.DEBUG,"present_feedback_widget, Loading css for survey or nps."),W(this.url+"/surveys/stylesheets/countly-surveys.css"),l="surveys"),a+="?widget_id="+e._id,a+="&app_key="+this.app_key,a+="&device_id="+this.device_id,a+="&sdk_name="+ze,a+="&platform="+this.platform,a+="&app_version="+this.app_version,a+="&sdk_version="+Be,o){var u={};u.sg=o,a+="&custom="+JSON.stringify(u)}a+="&origin="+c,a+="&widget_v=web";var h=document.createElement("iframe");h.src=a,h.name="countly-"+l+"-iframe",h.id="countly-"+l+"-iframe";var d=!1;h.onload=function(){d&&(document.getElementById("countly-"+l+"-wrapper-"+e._id).style.display="none",document.getElementById("csbg").style.display="none"),d=!0,ct(s.DEBUG,"present_feedback_widget, Loaded iframe.")};for(var p=document.getElementById("csbg");p;)p.remove(),p=document.getElementById("csbg"),ct(s.DEBUG,"present_feedback_widget, Removing past overlay.");for(var f=document.getElementsByClassName("countly-"+l+"-wrapper"),g=0;g<f.length;g++)f[g].remove(),ct(s.DEBUG,"present_feedback_widget, Removed a wrapper.");(f=document.createElement("div")).className="countly-"+l+"-wrapper",f.id="countly-"+l+"-wrapper-"+e._id,"survey"===e.type&&(f.className=f.className+" "+e.appearance.position);var _=document.body,y=!1;if(r&&(document.getElementById(r)?(_=document.getElementById(r),y=!0):ct(s.ERROR,"present_feedback_widget, Provided ID not found.")),y||i&&(document.getElementsByClassName(i)[0]?_=document.getElementsByClassName(i)[0]:ct(s.ERROR,"present_feedback_widget, Provided class not found.")),_.insertAdjacentHTML("beforeend",'<div id="csbg"></div>'),_.appendChild(f),"rating"===e.type){var v=document.createElement("div");v.className="countly-ratings-overlay",v.id="countly-ratings-overlay-"+e._id,f.appendChild(v),ct(s.DEBUG,"present_feedback_widget, appended the rating overlay to wrapper"),R(document.getElementById("countly-ratings-overlay-"+e._id),"click",function(){document.getElementById("countly-ratings-wrapper-"+e._id).style.display="none"})}if(f.appendChild(h),ct(s.DEBUG,"present_feedback_widget, Appended the iframe"),R(window,"message",function(t){var r={};try{r=JSON.parse(t.data),ct(s.DEBUG,"present_feedback_widget, Parsed response message "+r)}catch(i){ct(s.ERROR,"present_feedback_widget, Error while parsing message body "+i)}r.close?(document.getElementById("countly-"+l+"-wrapper-"+e._id).style.display="none",document.getElementById("csbg").style.display="none"):ct(s.DEBUG,"present_feedback_widget, Closing signal not sent yet")}),"survey"===e.type){var b=!1;switch(e.showPolicy){case"afterPageLoad":"complete"===document.readyState?b||(b=!0,w(e)):R(document,"readystatechange",function(t){"complete"===t.target.readyState&&(b||(b=!0,w(e)))});break;case"afterConstantDelay":setTimeout(function(){b||(b=!0,w(e))},1e4);break;case"onAbandon":"complete"===document.readyState?R(document,"mouseleave",function(){b||(b=!0,w(e))}):R(document,"readystatechange",function(t){"complete"===t.target.readyState&&R(document,"mouseleave",function(){b||(b=!0,w(e))})});break;case"onScrollHalfwayDown":R(window,"scroll",function(){b||Math.max(window.scrollY,document.body.scrollTop,document.documentElement.scrollTop)>=j()/2&&(b=!0,w(e))});break;default:b||(b=!0,w(e))}}else if("nps"===e.type)document.getElementById("countly-"+l+"-wrapper-"+e._id).style.display="block",document.getElementById("csbg").style.display="block";else if("rating"===e.type){var x=!1;"complete"===document.readyState?x||(x=!0,T(e)):R(document,"readystatechange",function(t){"complete"===t.target.readyState&&(x||(x=!0,T(e)))})}}catch(he){ct(s.ERROR,"present_feedback_widget, Something went wrong while presenting the widget: "+he)}}else ct(s.ERROR,"present_feedback_widget, Please provide at least one feedback widget object.")}else ct(s.WARNING,"present_feedback_widget, window object is not available. Not presenting feedback widget.");function w(e){document.getElementById("countly-surveys-wrapper-"+e._id).style.display="block",document.getElementById("csbg").style.display="block"}function T(e){if(!e.appearance.hideS){ct(s.DEBUG,"present_feedback_widget, handling the sticker as it was not set to hidden");var t=document.createElement("div");t.innerText=e.appearance.text,t.style.color=e.appearance.text_color.length<7?"#"+e.appearance.text_color:e.appearance.text_color,t.style.backgroundColor=e.appearance.bg_color.length<7?"#"+e.appearance.bg_color:e.appearance.bg_color,t.className="countly-feedback-sticker "+e.appearance.position+"-"+e.appearance.size,t.id="countly-feedback-sticker-"+e._id,document.body.appendChild(t),R(document.getElementById("countly-feedback-sticker-"+e._id),"click",function(){document.getElementById("countly-ratings-wrapper-"+e._id).style.display="flex",document.getElementById("csbg").style.display="block"})}R(document.getElementById("countly-feedback-close-icon-"+e._id),"click",function(){document.getElementById("countly-ratings-wrapper-"+e._id).style.display="none",document.getElementById("csbg").style.display="none"})}},this.recordError=function(e,r,i){if(ct(s.INFO,"recordError, Recording error"),this.check_consent(n.CRASHES)&&e){i=i||ae;var o="";if("object"===t(e)?void 0!==e.stack?o=e.stack:(void 0!==e.name&&(o+=e.name+":"),void 0!==e.message&&(o+=e.message+"\n"),void 0!==e.fileName&&(o+="in "+e.fileName+"\n"),void 0!==e.lineNumber&&(o+="on "+e.lineNumber),void 0!==e.columnNumber&&(o+=":"+e.columnNumber)):o=e+"",o.length>b.maxStackTraceLineLength*b.maxStackTraceLinesPerThread){ct(s.DEBUG,"record_error, Error stack is too long will be truncated");var a=o.split("\n");a.length>b.maxStackTraceLinesPerThread&&(a=a.splice(0,b.maxStackTraceLinesPerThread));for(var l=0,c=a.length;l<c;l++)a[l].length>b.maxStackTraceLineLength&&(a[l]=a[l].substring(0,b.maxStackTraceLineLength));o=a.join("\n")}r=!!r;var u=st(),h={_resolution:u._resolution,_error:o,_app_version:u._app_version,_run:x()-Pe,_not_os_specific:!0,_javascript:!0},d=navigator.battery||navigator.webkitBattery||navigator.mozBattery||navigator.msBattery;d&&(h._bat=Math.floor(100*d.level)),void 0!==navigator.onLine&&(h._online=!!navigator.onLine),m&&(h._background=!document.hasFocus()),ie.length>0&&(h._logs=ie.join("\n")),ie=[],h._nonfatal=r,h._view=this.getViewName(),void 0!==i&&(i=C(i,b.maxKeyLength,b.maxValueSize,b.maxSegmentationValues,"record_error",ct),h._custom=i);try{var p=document.createElement("canvas").getContext("experimental-webgl");h._opengl=p.getParameter(p.VERSION)}catch(g){ct(s.ERROR,"Could not get the experimental-webgl context: "+g)}var f={};f.crash=JSON.stringify(h),f.metrics=JSON.stringify({_ua:u._ua}),tt(f)}},this.onStorageChange=function(e,t){switch(ct(s.DEBUG,"onStorageChange, Applying storage changes for key:",e),ct(s.DEBUG,"onStorageChange, Applying storage changes for value:",t),e){case"cly_queue":ee=b.deserialize(t||"[]");break;case"cly_event":te=b.deserialize(t||"[]");break;case"cly_remote_configs":re=b.deserialize(t||"{}");break;case"cly_ignore":b.ignore_visitor=b.deserialize(t);break;case"cly_id":b.device_id=t;break;case"cly_id_type":Ce=b.deserialize(t)}},this._internals={store:Et,getDocWidth:V,getDocHeight:j,getViewportHeight:U,get_page_coord:N,get_event_target:L,add_event_listener:R,createNewObjectFromProperties:k,truncateObject:C,truncateSingleValue:M,stripTrailingSlash:P,prepareParams:I,sendXmlHttpRequest:ht,isResponseValid:pt,getInternalDeviceIdType:_t,getMsTimestamp:T,getTimestamp:x,isResponseValidBroad:ft,secureRandom:y,log:ct,checkIfLoggingIsOn:H,getMetrics:st,getUA:at,prepareRequest:et,generateUUID:v,sendEventsForced:He,isUUID:ot,isReferrerUsable:lt,getId:nt,heartBeat:rt,toRequestQueue:tt,reportViewDuration:Je,loadJS:$,loadCSS:W,getLastView:Ke,setToken:yt,getToken:vt,showLoader:Z,hideLoader:X,setValueInStorage:Et,getValueFromStorage:St,removeValueFromStorage:It,add_cly_events:Ge,processScrollView:gt,processScroll:mt,currentUserAgentString:F,currentUserAgentDataString:O,userAgentDeviceDetection:z,userAgentSearchBotDetection:B,getRequestQueue:xt,getEventQueue:bt,sendFetchRequest:dt,processAsyncQueue:it,makeNetworkRequest:ut,clearQueue:function(){ee=[],Et("cly_queue",[]),te=[],Et("cly_event",[])},getLocalQueues:function(){return{eventQ:te,requestQ:ee}}};var kt={};function At(){b.hcErrorCount++}function Ct(){b.hcWarningCount++}function Mt(){b.hcErrorCount=0,b.hcWarningCount=0,b.hcStatusCode=-1,b.hcErrorMessage=""}function Dt(e,t){b.hcStatusCode=e,b.hcErrorMessage=t,Et(h.statusCode,b.hcStatusCode),Et(h.errorMessage,b.hcErrorMessage)}function Rt(){kt.resetCounters(),Et(h.errorCount,b.hcErrorCount),Et(h.warningCount,b.hcWarningCount),Et(h.statusCode,b.hcStatusCode),Et(h.errorMessage,b.hcErrorMessage)}function Lt(){var e=M(b.hcErrorMessage,1e3,"healthCheck",ct),t={el:b.hcErrorCount,wl:b.hcWarningCount,sc:b.hcStatusCode,em:JSON.stringify(e)},r={hc:JSON.stringify(t),metrics:JSON.stringify({_app_version:b.app_version})};et(r),ut("[healthCheck]",b.url+Y,r,function(e){e||kt.resetAndSaveCounters()},!0)}kt.sendInstantHCRequest=Lt,kt.resetAndSaveCounters=Rt,kt.incrementErrorCount=At,kt.incrementWarningCount=Ct,kt.resetCounters=Mt,kt.saveRequestCounters=Dt,this.initialize()}),J=!0;function K(e){var t=document.createElement("script"),r=document.createElement("script");t.async=!0,r.async=!0,t.src=g.customSourceBoomerang||u.BOOMERANG_SRC,r.src=g.customSourceCountlyBoomerang||u.CLY_BOOMERANG_SRC,document.getElementsByTagName("head")[0].appendChild(t),document.getElementsByTagName("head")[0].appendChild(r);var i=!1,n=!1;t.onload=function(){i=!0},r.onload=function(){n=!0};var o=0,a=50,s=1500,l=setInterval(function(){if(o+=a,i&&n||o>=s){if(g.debug){var t="BoomerangJS loaded:["+i+"], countly_boomerang loaded:["+n+"].";i&&n?(t="[DEBUG] "+t,console.log(t)):(t="[WARNING] "+t+" Initializing without APM.",console.warn(t))}g.init(e),clearInterval(l)}},a)}g.features=[n.APM,n.ATTRIBUTION,n.CLICKS,n.CRASHES,n.EVENTS,n.FEEDBACK,n.FORMS,n.LOCATION,n.REMOTE_CONFIG,n.SCROLLS,n.SESSIONS,n.STAR_RATING,n.USERS,n.VIEWS],g.q=g.q||[],g.onload=g.onload||[],g.CountlyClass=Y,g.init=function(e){if(e=e||{},g.loadAPMScriptsAsync&&J)return J=!1,void K(e);var t=e.app_key||g.app_key;if(!g.i||!g.i[t]){var r=new Y(e);if(!g.i)for(var i in g.i={},r)g[i]=r[i];g.i[t]=r}return g.i[t]},g.serialize=function(e){return"object"===t(e)&&(e=JSON.stringify(e)),e},g.deserialize=function(e){if(""===e)return e;try{e=JSON.parse(e)}catch(he){H()&&console.warn("[WARNING] [Countly] deserialize, Could not parse the file:["+e+"], error: "+he)}return e},g.getViewName=function(){return m?window.location.pathname:"web_worker"},g.getViewUrl=function(){return m?window.location.pathname:"web_worker"},g.getSearchQuery=function(){if(m)return window.location.search},g.DeviceIdType={DEVELOPER_SUPPLIED:l.DEVELOPER_SUPPLIED,SDK_GENERATED:l.SDK_GENERATED,TEMPORARY_ID:l.TEMPORARY_ID},m&&window.addEventListener("storage",function(e){var t=(e.key+"").split("/"),r=t.pop(),i=t.pop();g.i&&g.i[i]&&g.i[i].onStorageChange(r,e.newValue)}),e.default=g,Object.defineProperty(e,"__esModule",{value:!0})}(t)}},r={};function i(e){var n=r[e];if(void 0!==n)return n.exports;var o=r[e]={exports:{}};return t[e].call(o.exports,o,o.exports,i),o.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(he){if("object"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;i.g.importScripts&&(e=i.g.location+"");var t=i.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var n=r.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=r[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=e})();var n={};return(()=>{i.r(n),i.d(n,{AnimationConfig:()=>o.AnimationConfig,AnimationDrawingConfig:()=>o.AnimationDrawingConfig,AnimationStatus:()=>o.AnimationStatus,Banner:()=>Je,BasicCategory:()=>c.BasicCategory,BasicWithIcon:()=>c.BasicWithIcon,BasicWithLogo:()=>c.BasicWithLogo,CameraAnimation:()=>g.CameraAnimation,Category:()=>c.Category,Configuration:()=>u.Configuration,CssComponent:()=>h.CssComponent,CssCustomization:()=>h.CssCustomization,CssDefinitions:()=>h.CssDefinitions,CssElement:()=>h.CssElement,CssScreen:()=>h.CssScreen,CssTheme:()=>h.CssTheme,DaysOfTheWeek:()=>v.DaysOfTheWeek,DrawRouteConfiguration:()=>r.DrawRouteConfiguration,FitOptions:()=>d.FitOptions,GetRouteConfiguration:()=>r.GetRouteConfiguration,GradientStyle:()=>b.GradientStyle,HealthResponse:()=>e.HealthResponse,IdLocation:()=>r.IdLocation,InnerFloor:()=>p.InnerFloor,Institution:()=>ut,InternalLinkCategory:()=>c.InternalLinkCategory,LatLng:()=>f.LatLng,LazarilloMap:()=>l.LazarilloMap,LazarilloSDK:()=>x.LazarilloSDK,LzLocation:()=>m.LzLocation,LzPlace:()=>nt,LzRoute:()=>We,LzRouteLeg:()=>Ze,LzRouteStep:()=>He,LzTransport:()=>dt,MapCamera:()=>g.MapCamera,MapConfig:()=>_.MapConfig,MarkerConfig:()=>t.MarkerConfig,MultiLanguage:()=>y.MultiLanguage,NestedCategory:()=>c.NestedCategory,OpeningHours:()=>v.OpeningHours,OpeningHoursHelper:()=>Hr,OpeningTime:()=>v.OpeningTime,PhoneCategory:()=>c.PhoneCategory,PlaceCategory:()=>c.PlaceCategory,ProductCategory:()=>c.ProductCategory,Property:()=>a.Property,RealtimeSchedule:()=>s.RealtimeSchedule,RouteLocation:()=>r.RouteLocation,RouteStyle:()=>b.RouteStyle,Schedule:()=>s.Schedule,SolidStyle:()=>b.SolidStyle,TextCategory:()=>c.TextCategory,TextPosition:()=>F,UrlCategory:()=>c.UrlCategory,initializeSDK:()=>Fr,isBasicWithIcon:()=>yr,isBasicWithLogo:()=>_r,loadCustomization:()=>Nr,loadStyles:()=>Xr});var e={};i.r(e);var t={};i.r(t),i.d(t,{D:()=>z,x:()=>F});var r={};i.r(r),i.d(r,{D_:()=>pe,lc:()=>de,sZ:()=>he});var o={};i.r(o),i.d(o,{o:()=>ye,U:()=>ve});var a={};i.r(a),i.d(a,{n:()=>lt});var s={};i.r(s),i.d(s,{Q:()=>dt});var l={};i.r(l),i.d(l,{O:()=>gr});var c={};i.r(c),i.d(c,{Y:()=>yr,c:()=>_r});var u={};i.r(u);var h={};i.r(h);var d={};i.r(d);var p={};i.r(p);var f={};i.r(f);var m={};i.r(m);var g={};i.r(g);var _={};i.r(_);var y={};i.r(y);var v={};i.r(v);var b={};i.r(b);var x={};i.r(x),i.d(x,{m:()=>Or,f:()=>Fr});var w=i(565),T=i.n(w);const S=i.p+"assets/user-dot-icon.svg";function E(e){var t={lat:-1/0,lng:-1/0},r={lat:1/0,lng:1/0};return e.forEach(function(e){e.lat>t.lat&&(t.lat=e.lat),e.lng>t.lng&&(t.lng=e.lng),e.lat<r.lat&&(r.lat=e.lat),e.lng<r.lng&&(r.lng=e.lng)}),[r,t]}function I(e,t,r){return t=k(t),function(e,t){if(t&&("object"==C(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,P()?Reflect.construct(t,r||[],k(e).constructor):t.apply(e,r))}function P(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(P=function(){return!!e})()}function k(e){return k=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},k(e)}function A(e,t){return A=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},A(e,t)}function C(e){return C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},C(e)}function M(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function D(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,L(i.key),i)}}function R(e,t,r){return t&&D(e.prototype,t),r&&D(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function L(e){var t=function(e,t){if("object"!=C(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=C(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==C(t)?t:t+""}var F=function(e){return e[e.left=0]="left",e[e.right=1]="right",e[e.top=2]="top",e[e.bottom=3]="bottom",e}({}),O=function(){return R(function e(){M(this,e)},null,[{key:"createMarkerElement",value:function(e){var t,r,i,n,o=document.createElement("div"),a=null!==(t=null===(r=e.iconProperties)||void 0===r?void 0:r.width)&&void 0!==t?t:40,s=null!==(i=null===(n=e.iconProperties)||void 0===n?void 0:n.height)&&void 0!==i?i:40;if(o.className="lazarillo-marker",e.text)switch(e.textPosition){case F.top:case F.bottom:o.classList.add("text-column"),o.style.width="".concat(Math.max(a,200),"px"),o.style.height="auto";break;case F.left:case F.right:default:o.classList.add("text-row"),o.style.width="auto",o.style.height="".concat(s,"px")}else o.classList.add("no-text"),o.style.width="".concat(a,"px"),o.style.height="".concat(s,"px");if(o.addEventListener("click",function(){var t;null===(t=e.onClick)||void 0===t||t.call(e)}),e.element)return o.appendChild(e.element),this.setAndCreateText(e,o,"".concat(s,"px"),"".concat(a,"px"));var l=this.createIconElement(e,a,s),c=e.text?this.createTextContainer("string"==typeof e.text?this.createTextElement(e.text,e.textProperties):e.text,e.textPosition):null;return e.textPosition===F.top||e.textPosition===F.left?(c&&o.appendChild(c),o.appendChild(l)):(o.appendChild(l),c&&o.appendChild(c)),o}},{key:"setAndCreateText",value:function(e,t,r,i){if(e.text){var n="string"==typeof e.text?this.createTextElement(e.text,e.textProperties):e.text,o=this.createTextContainer(n,e.textPosition);t.appendChild(o)}return t}},{key:"createIconElement",value:function(e,t,r){if("string"==typeof e.icon)return this.createIcon(e);if(e.icon instanceof HTMLImageElement)return e.icon.style.width="".concat(t,"px"),e.icon.style.height="".concat(r,"px"),e.icon;if(e.icon)return e.icon;var i=document.createElement("div");return i.className="icon-default",i.style.width="".concat(t,"px"),i.style.height="".concat(r,"px"),i}},{key:"createTextContainer",value:function(e,t){var r=document.createElement("div");switch(r.className="text-container",t){case F.top:r.classList.add("top");break;case F.bottom:r.classList.add("bottom");break;case F.left:r.classList.add("left");break;default:r.classList.add("right")}return e.style.display="block",e.style.margin="0",r.appendChild(e),r}},{key:"createIcon",value:function(e){var t,r,i,n,o=document.createElement("img");return o.src="string"==typeof e.icon?e.icon:"",o.width=null!==(t=null===(r=e.iconProperties)||void 0===r?void 0:r.width)&&void 0!==t?t:40,o.height=null!==(i=null===(n=e.iconProperties)||void 0===n?void 0:n.height)&&void 0!==i?i:40,o.style.objectFit="contain",o.style.filter="drop-shadow(0px 4px 4px rgba(0, 0, 0, 0.25))",o}},{key:"createTextElement",value:function(e,t){var r,i,n,o,a,s,l,c=document.createElement("p");return c.textContent=e,c.style.fontSize=null!==(r=null==t?void 0:t.fontSize)&&void 0!==r?r:"14px",c.style.padding=null!==(i=null==t?void 0:t.padding)&&void 0!==i?i:"0px",c.style.margin=null!==(n=null==t?void 0:t.margin)&&void 0!==n?n:"0px",c.style.fontWeight=null!==(o=null==t?void 0:t.fontWeight)&&void 0!==o?o:"600",c.style.fontFamily=null!==(a=null==t?void 0:t.fontFamily)&&void 0!==a?a:"'Open Sans', sans-serif",c.style.color=null!==(s=null==t?void 0:t.color)&&void 0!==s?s:"#000000",c.style.textShadow=null!==(l=null==t?void 0:t.textShadow)&&void 0!==l?l:"-1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff",c}}])}(),z=function(e){function t(e){var r,i,n,o,a;return M(this,t),(a=I(this,t,[{element:O.createMarkerElement(e),draggable:!1,anchor:null!==(r=e.anchor)&&void 0!==r?r:"center",offset:[0,0]}])).setLngLat([e.coordinate.lng,e.coordinate.lat]),a.setRotationAlignment(null!==(i=e.rotationAlignment)&&void 0!==i?i:"viewport"),a.setPitchAlignment("viewport"),a.id=null!==(n=e.id)&&void 0!==n?n:function(){for(var e="",t="0123456789ABCDEF",r=0;r<10;r++)e+=t.charAt(Math.floor(16*Math.random()));return e}(),a.coordinate=e.coordinate,a.floorId=null!==(o=e.floorId)&&void 0!==o?o:"",a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&A(e,t)}(t,e),R(t,[{key:"addToMap",value:function(e){e&&this.addTo(e)}},{key:"updateIcon",value:function(e){var t;if(e.element)this._element.innerHTML="",this._element.appendChild(e.element);else{var r,i=O.createMarkerElement(e),n=this._element.querySelector("div"),o=i.querySelector("div");o&&(null==n||null===(r=n.parentElement)||void 0===r||r.replaceChild(o,n))}this.setRotationAlignment(null!==(t=e.rotationAlignment)&&void 0!==t?t:"viewport"),this.setPitchAlignment("viewport")}},{key:"setFloor",value:function(e){this.floorId=e}},{key:"hide",value:function(){this.remove()}},{key:"show",value:function(e){e&&this.addTo(e)}},{key:"changeFloor",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e==this.floorId||r&&!this.floorId?this.show(t):this.hide()}}])}(w.Marker);function B(e){return B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},B(e)}function N(e,t,r){return r&&function(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,j(i.key),i)}}(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function j(e){var t=function(e,t){if("object"!=B(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=B(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==B(t)?t:t+""}var V=Math.asin,U=Math.atan2,G=Math.cos,q=Math.sin,$=Math.pow,W=Math.sqrt,Z=Math.PI;function H(e){return q(e/2)*q(e/2)}function X(e){return e*(Z/180)}function Y(e){return e*(180/Z)}function J(e,t){return e.lat===t.lat&&e.lng===t.lng}var K=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return N(e,0,[{key:"distance",value:function(t,r){var i=X(t.lat),n=X(r.lat),o=X(t.lng),a=X(r.lng)-o,s=H(n-i)+G(i)*G(n)*H(a);return 2*e.EARTH_RADIUS*V(W(s))}},{key:"intermediatePointBetween",value:function(t,r,i){var n=X(t.lat),o=X(r.lat),a=X(t.lng),s=X(r.lng),l=e.distance(t,r)/e.EARTH_RADIUS,c=q((1-i)*l)/q(l),u=q(i*l)/q(l),h=c*G(n)*G(a)+u*G(o)*G(s),d=c*G(n)*q(a)+u*G(o)*q(s),p=c*q(n)+u*q(o),f=U(p,W($(h,2)+$(d,2))),m=U(d,h);return{lat:Y(f),lng:Y(m)}}},{key:"bearingInDegBetween",value:function(t,r){return Y(e.bearingInRadBetween(t,r))}},{key:"bearingInRadBetween",value:function(e,t){var r=t.lng-e.lng,i=t.lat-e.lat;return(Z/2-U(i,r)+2*Z)%(2*Z)}},{key:"intermediateAngleBetween",value:function(e,t,r){var i=(t-e+180)%360-180;return i<-180&&(i+=360),(e+360+i*r)%360}}])}();function Q(e){return Q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Q(e)}function ee(e){return function(e){if(Array.isArray(e))return te(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return te(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?te(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function te(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function re(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,ne(i.key),i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ie(e,t,r){return(t=ne(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ne(e){var t=function(e,t){if("object"!=Q(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=Q(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==Q(t)?t:t+""}!function(e,t,r){(t=j(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(K,"EARTH_RADIUS",6378e3);var oe=function(){return re(function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ie(this,"AHEAD_ID","AHEAD_ID"),ie(this,"BEHIND_ID","BEHIND_ID"),ie(this,"CURRENT_ID","CURRENT_ID"),ie(this,"aheadSourceData",{type:"FeatureCollection",features:[]}),ie(this,"behindSourceData",{type:"FeatureCollection",features:[]}),ie(this,"currentSourceData",{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:[]}}),ie(this,"animationStatus","NO_ROUTE"),ie(this,"stepAnimationStatus","NO_ROUTE"),this.lazarilloMap=t},[{key:"map",get:function(){return this.lazarilloMap.map}},{key:"addSourcesAndLayers",value:function(){this.map.addSource(this.AHEAD_ID,{type:"geojson",data:this.aheadSourceData}),this.map.addLayer({id:this.AHEAD_ID,type:"line",source:this.AHEAD_ID,layout:{"line-join":"round","line-cap":"round"}}),this.map.addSource(this.BEHIND_ID,{type:"geojson",data:this.behindSourceData}),this.map.addLayer({id:this.BEHIND_ID,type:"line",source:this.BEHIND_ID,layout:{"line-join":"round","line-cap":"round"}}),this.map.addSource(this.CURRENT_ID,{type:"geojson",data:this.currentSourceData}),this.map.addLayer({id:this.CURRENT_ID,type:"line",source:this.CURRENT_ID,layout:{"line-join":"round","line-cap":"round"}})}},{key:"addRoute",value:function(e,t){this.setSourceData(this.AHEAD_ID,e.steps),this.setLayerPaint(this.AHEAD_ID,t),this.updateLayerFilter(this.AHEAD_ID)}},{key:"setSourceData",value:function(e,t){var r=this.createFeaturesFrom(t),i=this.map.getSource(e);switch(e){case this.AHEAD_ID:this.aheadSourceData.features=r,null==i||i.setData(this.aheadSourceData);break;case this.BEHIND_ID:this.behindSourceData.features=r,null==i||i.setData(this.behindSourceData)}}},{key:"setCurrentSourceData",value:function(e){this.currentSourceData.properties={floor_key:this.getFloorKeyForStep(e)};var t=null==e?void 0:e.coordinates[0];this.currentSourceData.geometry.coordinates=null!=t?[[t.lng,t.lat]]:[];var r=this.map.getSource(this.CURRENT_ID);null==r||r.setData(this.currentSourceData)}},{key:"setLayerPaint",value:function(e,t){var r=this.preparePaintForLayer(t);for(var i in r)this.map.setPaintProperty(e,i,r[i])}},{key:"preparePaintForLayer",value:function(e){if("color"in e.routeStyle)return{"line-color":e.routeStyle.color,"line-gradient":null,"line-width":e.polylineWidth};var t=e.routeStyle,r=t.colors,i=t.positions;if(null==i&&(i=function(e){if(0===e)return[];if(1===e)return[0];var t=1/(e-1);return Array.from({length:e},function(e,r){return r*t})}(r.length)),i.length!==r.length)throw new Error("Error: position array has different length than colors array");var n=function(e,t){return e.flatMap(function(e,r){return[e,t[r]]})}(i,r);return{"line-color":null,"line-gradient":["interpolate",["linear"],["line-progress"]].concat(ee(n)),"line-width":e.polylineWidth}}},{key:"updateLayerFilter",value:function(e,t){var r=null!=t?t:this.lazarilloMap.getCurrentFloor();void 0!==r&&this.map.getStyle().layers.some(function(t){return t.id===e})&&this.map.setFilter(e,["==",["get","floor_key"],r])}},{key:"getFloorKeyForStep",value:function(e){var t,r,i,n,o,a,s;if(!e)return this.lazarilloMap.getCurrentFloor();if((null!==(t=null===(r=e.startInsideFloor)||void 0===r?void 0:r.length)&&void 0!==t?t:0)>0)return(null!==(a=null===(s=e.endInsideFloor)||void 0===s?void 0:s.length)&&void 0!==a?a:0)>0&&e.startInsideFloor!==e.endInsideFloor?e.endInsideFloor:e.startInsideFloor;if((null!==(i=null===(n=e.endInsideFloor)||void 0===n?void 0:n.length)&&void 0!==i?i:0)>0)return e.endInsideFloor;var l=this.lazarilloMap.getInnerFloors().find(function(e){return!0===e.reachableFromGPS});return null!==(o=null==l?void 0:l.key)&&void 0!==o?o:""}},{key:"createFeaturesFrom",value:function(e){var t=this;return e.map(function(e){return{type:"Feature",properties:{floor_key:t.getFloorKeyForStep(e)},geometry:{type:"LineString",coordinates:e.geoJsonCoordinates}}})}},{key:"updateRouteLayers",value:function(e){this.updateLayerFilter(this.AHEAD_ID,e),this.updateLayerFilter(this.BEHIND_ID,e),this.updateLayerFilter(this.CURRENT_ID,e)}},{key:"updateRouteMarkerVisibility",value:function(e){var t,r,i;(null===(t=this.routeMarker)||void 0===t?void 0:t.floorId)===e?null===(r=this.routeMarker)||void 0===r||r.show(this.map):null===(i=this.routeMarker)||void 0===i||i.hide()}},{key:"updatePlaceFloorForRouting",value:function(e,t){e&&t&&(this.lazarilloMap.updatePlaceAndFloorForRouting(e,t),this.updateRouteLayers(t),this.setMarkerFloor(t),this.updateRouteMarkerVisibility(t))}},{key:"startAnimating",value:function(e,t,r){var i,n,o=this;"NO_ROUTE"===this.animationStatus&&"NO_ROUTE"===this.stepAnimationStatus||this.clearForNextAnimation(),this.animationStatus="STARTED",this.route=e;var a=e.steps[0];this.updatePlaceFloorForRouting(a.startInsidePlace,a.startInsideFloor),this.setSourceData(this.AHEAD_ID,e.steps),this.setSourceData(this.BEHIND_ID,[]),this.currentSourceData.properties={floor_key:this.getFloorKeyForStep(a)},this.currentSourceData.geometry.coordinates=[[a.coordinates[0].lng,a.coordinates[0].lat]],this.setLayerPaint(this.AHEAD_ID,t.aheadConfig),this.setLayerPaint(this.BEHIND_ID,t.behindConfig),this.setLayerPaint(this.CURRENT_ID,t.behindConfig),this.animationConfig=r,this.routeMarker=new z({coordinate:a.startLocation,floorId:a.startInsideFloor,icon:t.routeIcon,rotationAlignment:"map"}),this.routeMarker.addToMap(this.map),null===(i=(n=this.animationConfig).callBack)||void 0===i||i.call(n,{isFinished:!1,step:a}),this.conditions={index:0,coordinatesIndex:0,iconRotation:0,rotatingIcon:!0,startTime:void 0,progress:0,resetTime:!1,waitStartTime:void 0,animationId:requestAnimationFrame(function(e){return o.animateStep(e)}),onFinish:function(e){return o.prepareForNextStep(e)}}}},{key:"clearForNextAnimation",value:function(){var e;null===(e=this.routeMarker)||void 0===e||e.remove(),this.routeMarker=void 0,this.setSourceData(this.AHEAD_ID,[]),this.setSourceData(this.BEHIND_ID,[]),this.currentSourceData.geometry.coordinates=[];var t=this.map.getSource(this.CURRENT_ID);null==t||t.setData(this.currentSourceData),"STARTED"!==this.animationStatus&&"ANIMATING"!==this.stepAnimationStatus||null==this.conditions||cancelAnimationFrame(this.conditions.animationId),this.animationStatus="NO_ROUTE",this.stepAnimationStatus="NO_ROUTE",this.conditions=void 0,this.animationConfig=void 0}},{key:"removeRoute",value:function(){this.clearForNextAnimation()}},{key:"internalPause",value:function(){"STARTED"==this.animationStatus&&null!=this.conditions&&(cancelAnimationFrame(this.conditions.animationId),this.animationStatus="PAUSED")}},{key:"pauseAnimation",value:function(){this.internalPause()}},{key:"internalResume",value:function(){var e=this;"PAUSED"==this.animationStatus&&null!=this.conditions&&(this.conditions.resetTime=!0,this.conditions.animationId=requestAnimationFrame(function(t){return e.animateStep(t)}),this.animationStatus="STARTED")}},{key:"resumeAnimation",value:function(){this.internalResume()}},{key:"restartAnimation",value:function(){var e,t,r,i=this;if("NO_ROUTE"===this.animationStatus)throw new Error("Does not exist animated route to restart");if(null==this.conditions||null==this.animationConfig||null==this.route||null==this.routeMarker)throw new Error("Error: conditions and animationConfig should not be null at this point");"STARTED"===this.animationStatus&&cancelAnimationFrame(this.conditions.animationId),this.animationStatus="STARTED";var n=this.route.steps[0];this.updatePlaceFloorForRouting(n.startInsidePlace,n.startInsideFloor),this.setSourceData(this.AHEAD_ID,this.route.steps),this.setSourceData(this.BEHIND_ID,[]),this.currentSourceData.properties={floor_key:this.getFloorKeyForStep(n)},this.currentSourceData.geometry.coordinates=[[n.coordinates[0].lng,n.coordinates[0].lat]];var o=this.map.getSource(this.CURRENT_ID);null==o||o.setData(this.currentSourceData),null===(e=this.setRotation(0))||void 0===e||e.setLngLat(n.startLocation).addTo(this.map),null===(t=(r=this.animationConfig).callBack)||void 0===t||t.call(r,{isFinished:!1,step:n}),this.conditions={index:0,coordinatesIndex:0,iconRotation:0,rotatingIcon:!0,startTime:void 0,progress:0,resetTime:!1,waitStartTime:void 0,animationId:requestAnimationFrame(function(e){return i.animateStep(e)}),onFinish:function(e){return i.prepareForNextStep(e)}}}},{key:"stopAnimation",value:function(){"FINISHED"!=this.animationStatus&&(this.animationStatus="FINISHED")}},{key:"addStepAnimation",value:function(e,t,r){var i,n=this;"NO_ROUTE"===this.animationStatus&&"NO_ROUTE"===this.stepAnimationStatus||this.clearForNextAnimation(),this.stepAnimationStatus="WAITING",this.route=e;var o=e.steps[0];this.updatePlaceFloorForRouting(o.startInsidePlace,o.startInsideFloor),this.setSourceData(this.AHEAD_ID,e.steps),this.setSourceData(this.BEHIND_ID,[]),this.setCurrentSourceData(o),this.setLayerPaint(this.AHEAD_ID,t.aheadConfig),this.setLayerPaint(this.BEHIND_ID,t.behindConfig),this.setLayerPaint(this.CURRENT_ID,t.behindConfig),this.animationConfig=r,this.routeMarker=new z({coordinate:o.startLocation,floorId:o.startInsideFloor,icon:t.routeIcon,rotationAlignment:"map"}),this.routeMarker.addToMap(this.map),this.cameraFollow(o.startLocation),null===(i=r.callBack)||void 0===i||i.call(r,{isFinished:!1,step:o}),this.conditions={index:0,coordinatesIndex:0,iconRotation:0,rotatingIcon:!0,startTime:void 0,progress:0,resetTime:!1,waitStartTime:void 0,animationId:0,isStepByStep:!0,onFinish:function(){if(null==n.conditions||null==n.animationConfig||null==n.route)throw new Error("Error: conditions, animationConfig or route should not be null at this point");var t=n.conditions.index;t++;var i=n.route.steps.slice(0,t),o=n.route.steps.slice(t),a=n.route.steps[t];if(n.setSourceData(n.BEHIND_ID,i),n.setSourceData(n.AHEAD_ID,o),n.setCurrentSourceData(a),n.conditions.index=t,t<e.steps.length){var s,l=e.steps[t];null===(s=r.callBack)||void 0===s||s.call(r,{isFinished:!1,step:l})}else{var c;null===(c=r.callBack)||void 0===c||c.call(r,{isFinished:!0,step:null})}n.stepAnimationStatus="WAITING"}}}},{key:"nextStepAnimation",value:function(){var e=this;if("NO_ROUTE"===this.stepAnimationStatus)throw new Error("Error: Does not exist step animation");if(null==this.conditions||null==this.animationConfig||null==this.route)throw new Error("Error: conditions, animationConfig or route should not be null at this point");if("ANIMATING"===this.stepAnimationStatus&&cancelAnimationFrame(this.conditions.animationId),this.stepAnimationStatus="ANIMATING",!(this.conditions.index<this.route.steps.length))throw new Error("Error: Does not exist next step to animate");this.conditions.coordinatesIndex=0,this.conditions.startTime=void 0,this.conditions.progress=0,this.conditions.rotatingIcon=!0,this.conditions.waitStartTime=void 0,this.conditions.animationId=requestAnimationFrame(function(t){return e.animateStep(t)})}},{key:"previousStepAnimation",value:function(){if("NO_ROUTE"===this.stepAnimationStatus)throw new Error("Error: Does not exist step animation");if(null==this.conditions||null==this.animationConfig||null==this.route)throw new Error("Error: conditions, animationConfig or route should not be null at this point");"ANIMATING"===this.stepAnimationStatus&&cancelAnimationFrame(this.conditions.animationId),this.stepAnimationStatus="WAITING";var e,t,r=this.conditions.index;if(!(r>0))throw new Error("previous step doesn't exists to animate");r--;var i=this.route.steps.slice(0,r),n=this.route.steps.slice(r),o=this.route.steps[r];this.setSourceData(this.BEHIND_ID,i),this.setSourceData(this.AHEAD_ID,n),this.setCurrentSourceData(o),o.startInsideFloor!=o.endInsideFloor&&o.startInsideFloor&&this.updatePlaceFloorForRouting(o.startInsidePlace,o.startInsideFloor),this.conditions.index=r,this.conditions.coordinatesIndex=0,this.conditions.startTime=void 0,this.conditions.progress=0,this.conditions.rotatingIcon=!0,this.conditions.waitStartTime=void 0,this.setLngLat(o.startLocation);var a=i.at(-1);if(null!=a){var s=a.coordinates.slice(-2),l=K.bearingInDegBetween(s[0],s[1]);this.setRotation(l)}else this.setRotation(0);null===(e=(t=this.animationConfig).callBack)||void 0===e||e.call(t,{isFinished:!1,step:o})}},{key:"centerOnCurrentStep",value:function(){var e;if("NO_ROUTE"===this.stepAnimationStatus)throw new Error("Error: Does not exist step animation");if(null==this.conditions||null==this.animationConfig||null==this.route)throw new Error("Error: conditions, animationConfig or route should not be null at this point");var t=null===(e=this.routeMarker)||void 0===e?void 0:e.getLngLat();if(!t)throw new Error("Error: marker has no position set");this.map.panTo(t)}},{key:"prepareForNextStep",value:function(e){var t=this;if(null==this.conditions||null==this.animationConfig||null==this.route)throw new Error("Error: conditions, animationConfig or route should not be null at this point");var r=this.conditions.index,i=this.route.steps.slice(0,r+1),n=this.route.steps.slice(r+1);if(this.setSourceData(this.BEHIND_ID,i),this.setSourceData(this.AHEAD_ID,n),this.currentSourceData.geometry.coordinates=[],r+1<this.route.steps.length){var o,a,s=this.route.steps[r+1];this.currentSourceData.geometry.coordinates.push([s.startLocation.lng,s.startLocation.lat]),this.currentSourceData.properties={floor_key:this.getFloorKeyForStep(s)},this.conditions.startTime=e,this.conditions.index++,this.conditions.coordinatesIndex=0,this.conditions.progress=0,this.conditions.rotatingIcon=!0,J(this.route.steps[r].endLocation,s.startLocation)||(this.conditions.nextFloorFirstStepIndex=r+2),this.conditions.animationId=requestAnimationFrame(function(e){return t.animateStep(e)}),null===(o=(a=this.animationConfig).callBack)||void 0===o||o.call(a,{isFinished:!1,step:this.route.steps[r+1]})}else{var l,c;null===(l=(c=this.animationConfig).callBack)||void 0===l||l.call(c,{isFinished:!0,step:null}),this.animationStatus="FINISHED"}}},{key:"animateStep",value:function(e){var t=this;if(null==this.conditions||null==this.animationConfig||null==this.route)throw new Error("Error: conditions and animationConfig should not be null at this point");var r=this.conditions,i=r.startTime,n=r.resetTime,o=r.progress,a=this.conditions,s=a.coordinatesIndex,l=a.iconRotation,c=a.index,u=a.onFinish,h=a.rotatingIcon,d=a.waitStartTime,p=this.animationConfig,f=p.stepTime,m=p.minimumSpeed,g=p.iconRotationTime,_=p.changeFloorTime;if(null==i)return this.conditions.startTime=e,void(this.conditions.animationId=requestAnimationFrame(function(e){return t.animateStep(e)}));n?(i=e-o,this.conditions.startTime=i,n=!1,this.conditions.resetTime=n):(o=e-i,this.conditions.progress=o);var y=o/1e3,v=this.route.steps[c];if(v.coordinates.length<=0)null==u||u(e);else{var b=v.coordinates[s],x=v.coordinates[s+1];if(null!=b&&null!=x){var w;if(h){var T=K.bearingInDegBetween(b,x);if(0===g||this.conditions.nextFloorFirstStepIndex===c||Math.abs(T-this.conditions.iconRotation)<15)return this.conditions.nextFloorFirstStepIndex=void 0,this.setRotation(T),this.conditions.startTime=e,this.conditions.rotatingIcon=!1,this.conditions.iconRotation=T,void(this.conditions.animationId=requestAnimationFrame(function(e){return t.animateStep(e)}));if(y<g){var S=K.intermediateAngleBetween(l,T,y/g);return this.setRotation(S),void(this.conditions.animationId=requestAnimationFrame(function(e){return t.animateStep(e)}))}return this.setRotation(T),this.conditions.startTime=e,this.conditions.rotatingIcon=!1,this.conditions.iconRotation=T,void(this.conditions.animationId=requestAnimationFrame(function(e){return t.animateStep(e)}))}var E=K.distance(b,x),I=Math.max(v.distance/f,null!=m?m:0);if(I*y>E){this.currentSourceData.geometry.coordinates.push([x.lng,x.lat]);var P=this.map.getSource(this.CURRENT_ID);if(null==P||P.setData(this.currentSourceData),s+2<v.coordinates.length){var k=v.coordinates[s+2];if(!J(x,k))if(this.conditions.isStepByStep)this.conditions.rotatingIcon=!0;else{var A,C=K.bearingInDegBetween(x,k);this.conditions.iconRotation=C,null===(A=this.routeMarker)||void 0===A||A.setRotation(C)}return this.conditions.startTime=e,this.conditions.progress=0,this.conditions.coordinatesIndex++,void(this.conditions.animationId=requestAnimationFrame(function(e){return t.animateStep(e)}))}return v.startInsideFloor!==v.endInsideFloor?null==d?(this.conditions.waitStartTime=e,void(this.conditions.animationId=requestAnimationFrame(function(e){return t.animateStep(e)}))):e-d<1e3*_?void(this.conditions.animationId=requestAnimationFrame(function(e){return t.animateStep(e)})):(this.updatePlaceFloorForRouting(v.endInsidePlace,v.endInsideFloor),this.setLngLat(v.endLocation),this.conditions.waitStartTime=void 0,void(null==u||u(e))):void(null==u||u(e))}var M=I*y/E,D=0===E?x:K.intermediatePointBetween(b,x,Math.min(M,1));this.currentSourceData.geometry.coordinates.push([D.lng,D.lat]);var R=this.map.getSource(this.CURRENT_ID);return null==R||R.setData(this.currentSourceData),this.setLngLat(D),null===(w=this.routeMarker)||void 0===w||w.addTo(this.map),void(this.conditions.animationId=requestAnimationFrame(function(e){return t.animateStep(e)}))}null==u||u(e)}}},{key:"setLngLat",value:function(e){var t,r;null!==(t=this.conditions)&&void 0!==t&&t.isStepByStep&&this.cameraFollow(e),null===(r=this.routeMarker)||void 0===r||r.setLngLat(e)}},{key:"setRotation",value:function(e){var t,r,i,n;return null!==(t=this.conditions)&&void 0!==t&&t.isStepByStep&&this.lazarilloMap.updateCamera({duration:null===(i=this.animationConfig)||void 0===i?void 0:i.iconRotationTime,animate:!0,bearing:e,center:null===(n=this.routeMarker)||void 0===n?void 0:n.getLngLat()}),null===(r=this.routeMarker)||void 0===r?void 0:r.setRotation(e)}},{key:"setMarkerFloor",value:function(e){var t;null===(t=this.routeMarker)||void 0===t||t.setFloor(e)}},{key:"cameraFollow",value:function(e){var t,r;this.lazarilloMap.updateCamera({center:e,animate:!0,bearing:null===(t=this.routeMarker)||void 0===t?void 0:t.getRotation(),duration:null===(r=this.animationConfig)||void 0===r?void 0:r.iconRotationTime})}}])}(),ae=["ar"];function se(e,t,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}function le(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var ce=function(e){return e.cardinal="CARDINAL",e.clock="CLOCK",e.relative="RELATIVE",e}({}),ue=function(e){return e.metric="METRIC",e.imperial="IMPERIAL",e.steps="STEPS",e}({}),he=function(e){return e.walking="WALKING",e.driving="DRIVING",e.bicycling="BICYCLING",e.transit="TRANSIT",e}({}),de=se(function e(t){var r,i,n,o;le(this,e),this.initialLocation=t.initialLocation,this.finalLocation=t.finalLocation,this.preferAccessibleRoute=null!==(r=t.preferAccessibleRoute)&&void 0!==r&&r,this.language=null!==(i=t.language)&&void 0!==i?i:"en",this.unitSystem=null!==(n=t.unitSystem)&&void 0!==n?n:ue.metric,this.announceFormat=null!==(o=t.announceFormat)&&void 0!==o?o:ce.relative}),pe=se(function e(t){var r,i;le(this,e),this.polylineWidth=null!==(r=t.polylineWidth)&&void 0!==r?r:10,this.routeStyle=null!==(i=t.routeStyle)&&void 0!==i?i:{type:"Solid",color:"#1257ED"}});function fe(e){return fe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fe(e)}function me(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,ge(i.key),i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ge(e){var t=function(e,t){if("object"!=fe(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=fe(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==fe(t)?t:t+""}function _e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var ye=me(function e(t){var r,i,n,o;_e(this,e),this.stepTime=null!==(r=t.stepTime)&&void 0!==r?r:3,this.minimumSpeed=null!==(i=t.minimumSpeed)&&void 0!==i?i:40,this.changeFloorTime=null!==(n=t.changeFloorTime)&&void 0!==n?n:0,this.iconRotationTime=null!==(o=t.iconRotationTime)&&void 0!==o?o:0,this.callBack=t.callBack}),ve=function(){return me(function e(t){var r,i,n;if(_e(this,e),this.aheadPathStyle=null!==(r=t.aheadPathStyle)&&void 0!==r?r:{type:"Solid",color:"#757575"},this.behindPathStyle=null!==(i=t.behindPathStyle)&&void 0!==i?i:{type:"Solid",color:"#0076B6"},this.polylineWidth=null!==(n=t.polylineWidth)&&void 0!==n?n:10,null!=t.routeIcon)this.routeIcon=t.routeIcon;else{var o=new Image(40,40);o.src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI2LjUuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkNhcGFfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiCgkgdmlld0JveD0iMCAwIDQwIDQwIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA0MCA0MDsiIHhtbDpzcGFjZT0icHJlc2VydmUiPgo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPgoJLnN0MHtmaWxsOiMwMDc2QjY7fQoJLnN0MXtmaWxsOiNGRkZGRkY7fQo8L3N0eWxlPgo8Zz4KCTxjaXJjbGUgY2xhc3M9InN0MCIgY3g9IjIwIiBjeT0iMjAiIHI9IjIwIi8+Cgk8cGF0aCBjbGFzcz0ic3QxIiBkPSJNMTIuNCwyOS43Yy0wLjIsMC4xLTAuNCwwLjEtMC42LDAuMWMtMC4yLDAtMC40LTAuMS0wLjUtMC4zYy0wLjItMC4xLTAuMi0wLjMtMC4zLTAuNWMwLTAuMiwwLTAuNCwwLjEtMC42CgkJbDguMi0xNy44YzAuMi0wLjQsMC41LTAuNiwwLjktMC42YzAuNCwwLDAuNywwLjIsMC45LDAuNmw3LjksMTcuOWMwLjEsMC4yLDAuMSwwLjQsMC4xLDAuNmMwLDAuMi0wLjEsMC40LTAuMywwLjUKCQljLTAuMSwwLjEtMC4zLDAuMi0wLjUsMC4zYy0wLjIsMC0wLjQsMC0wLjYtMC4xTDIwLDI2LjVMMTIuNCwyOS43eiBNMTMuOSwyN2w2LjEtMi42bDYuMSwyLjdsLTYtMTMuOEwxMy45LDI3eiIvPgo8L2c+Cjwvc3ZnPgo=",this.routeIcon=o}},[{key:"aheadConfig",get:function(){return new pe({polylineWidth:this.polylineWidth,routeStyle:this.aheadPathStyle})}},{key:"behindConfig",get:function(){return new pe({polylineWidth:this.polylineWidth,routeStyle:this.behindPathStyle})}}])}(),be=i(773),xe=i.n(be),we=i(357),Te=i.n(we),Se={accessToken:"1e7e62a3edc14868b4098d653d0f33b9",captureUncaught:!0,captureUnhandledRejections:!0,payload:{environment:"testenv",client:{javascript:{code_version:"1.0"}}}};function Ee(e){return Ee="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ee(e)}function Ie(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,Pe(i.key),i)}}function Pe(e){var t=function(e,t){if("object"!=Ee(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=Ee(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==Ee(t)?t:t+""}var ke="f0c8d3b96d336e857a8628f49dd1baf7d7add0e9",Ae="https://countly.lazarillo.app",Ce=function(){function e(){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.rollbar=new(Te())(Se),xe().init({app_key:ke,url:Ae,app_version:"2.25.5",session_update:10,debug:!1,require_consent:!1,namespace:"SDK JS"}),this.countly=null!==xe()&&void 0!==xe()?xe():{},this.countly.q=null!==(t=xe().q)&&void 0!==t?t:[],this.countly.q.push(["track_sessions","track_pageview","track_clicks","track_scrolls","track_errors","track_links","track_forms","collect_from_forms"])}return function(e,t,r){return t&&Ie(e.prototype,t),r&&Ie(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}(e,[{key:"logEvent",value:function(e,t){this.countly.q.push(["add_event",{key:e,segmentation:t}])}},{key:"logDebug",value:function(){}},{key:"logWarning",value:function(){}},{key:"logError",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var i;null===(i=this.rollbar)||void 0===i||i.error.apply(i,t)}},{key:"debugLog",value:function(){}}],[{key:"getInstance",value:function(){return null==e.instance&&(e.instance=new e),e.instance}}])}();function Me(e){if(e instanceof Error)return e;var t=String(e);return new Error(t)}function De(e){return De="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},De(e)}function Re(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,Le(i.key),i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Le(e){var t=function(e,t){if("object"!=De(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=De(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==De(t)?t:t+""}var Fe=function(){return Re(function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.logger=Ce.getInstance()},[{key:"logEvent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.logger.logEvent(e,this.prepareSegmentation(t))}},{key:"logError",value:function(e){for(var t,r=Me(e),i=arguments.length,n=new Array(i>1?i-1:0),o=1;o<i;o++)n[o-1]=arguments[o];(t=this.logger).logError.apply(t,[r].concat(n))}},{key:"logWarning",value:function(e){for(var t,r=Me(e),i=arguments.length,n=new Array(i>1?i-1:0),o=1;o<i;o++)n[o-1]=arguments[o];(t=this.logger).logWarning.apply(t,[r].concat(n))}},{key:"logDebug",value:function(){var e;(e=this.logger).logDebug.apply(e,arguments)}},{key:"debugLog",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.logger.debugLog(t)}}])}();const Oe={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let ze;const Be=new Uint8Array(16);function Ne(){if(!ze&&(ze="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ze))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ze(Be)}const je=[];for(let i=0;i<256;++i)je.push((i+256).toString(16).slice(1));const Ve=function(e,t,r){if(Oe.randomUUID&&!t&&!e)return Oe.randomUUID();const i=(e=e||{}).random||(e.rng||Ne)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){r=r||0;for(let e=0;e<16;++e)t[r+e]=i[e];return t}return function(e,t=0){return je[e[t+0]]+je[e[t+1]]+je[e[t+2]]+je[e[t+3]]+"-"+je[e[t+4]]+je[e[t+5]]+"-"+je[e[t+6]]+je[e[t+7]]+"-"+je[e[t+8]]+je[e[t+9]]+"-"+je[e[t+10]]+je[e[t+11]]+je[e[t+12]]+je[e[t+13]]+je[e[t+14]]+je[e[t+15]]}(i)};function Ue(e){return Ue="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ue(e)}function Ge(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function qe(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,$e(i.key),i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function $e(e){var t=function(e,t){if("object"!=Ue(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=Ue(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==Ue(t)?t:t+""}var We=function(){return qe(function e(t){var r=this;Ge(this,e),this.id=Ve(),this.legs=[],t.legs.forEach(function(e){var t=new Ze(e);r.legs.push(t)})},[{key:"steps",get:function(){return this.legs.flatMap(function(e){return e.steps})}},{key:"duration",get:function(){return this.legs.map(function(e){return e.duration}).reduce(function(e,t){return e+t},0)}},{key:"length",get:function(){return this.legs.map(function(e){return e.distance}).reduce(function(e,t){return e+t},0)}}])}(),Ze=qe(function e(t){var r=this;Ge(this,e),this.distance=t.distance.value,this.duration=t.duration.value,this.startLocation=t.start_location,this.endLocation=t.end_location,this.steps=[],t.steps.forEach(function(e){var t=new He(e);r.steps.push(t)})}),He=function(){return qe(function e(t){Ge(this,e),this.distance=t.distance.value,this.duration=t.duration.value,this.startLocation=t.start_location,this.startInsideFloor=t.start_inside_floor,this.startInsidePlace=t.start_inside_place,this.endLocation=t.end_location,this.endInsideFloor=t.end_inside_floor,this.endInsidePlace=t.end_inside_place,this.htmlInstruction=t.html_instructions,this.plainInstruction=t.plain_instructions,this.maneuver=t.maneuver,this.elevatorStep=t.elevator_step,this.showPopup=t.show_popup,this.iconPrefix=t.icon_prefix,this.polyline=new Xe(t.polyline)},[{key:"geoJsonCoordinates",get:function(){return this.polyline.geoJsonCoordinates}},{key:"coordinates",get:function(){return this.polyline.coordinates}}])}(),Xe=function(){return qe(function e(t){Ge(this,e),this.points=t.points,this.pointsLatLng=t.points_lat_lng,this.overviewPoints=t.overview_points,this.decodedPoints=function(e,t){void 0===t&&(t=5);for(var r=Math.pow(10,t),i=e.length,n=new Array(Math.floor(e.length/2)),o=0,a=0,s=0,l=0;o<i;++l){var c=1,u=0,h=void 0;do{c+=(h=e.charCodeAt(o++)-63-1)<<u,u+=5}while(h>=31);a+=1&c?~(c>>1):c>>1,c=1,u=0;do{c+=(h=e.charCodeAt(o++)-63-1)<<u,u+=5}while(h>=31);s+=1&c?~(c>>1):c>>1,n[l]=[a/r,s/r]}return n.length=l,n}(t.points).map(function(e){return{lat:e[0],lng:e[1]}})},[{key:"geoJsonCoordinates",get:function(){return null!=this.overviewPoints?this.overviewPoints.map(function(e){return[e.lng,e.lat]}):this.decodedPoints.map(function(e){return[e.lng,e.lat]})}},{key:"coordinates",get:function(){return null!=this.overviewPoints?this.overviewPoints:this.decodedPoints}}])}();function Ye(e,t,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}var Je=Ye(function e(t){var r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.url=t.url,this.tags=null!==(r=t.tags)&&void 0!==r?r:[],this.urlAction=t.url_action,this.sameLink=t.sameLink,this.description=t.description});function Ke(e){return Ke="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ke(e)}function Qe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function et(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Qe(Object(r),!0).forEach(function(t){tt(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qe(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function tt(e,t,r){return(t=it(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function rt(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,it(i.key),i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function it(e){var t=function(e,t){if("object"!=Ke(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=Ke(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==Ke(t)?t:t+""}var nt=function(){return rt(function e(t){var r,i,n,o,a,s,l,c,u,h;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var d=(null!==(r=t.tags)&&void 0!==r?r:[]).concat(null!==(i=t.keywords)&&void 0!==i?i:[]);for(var p in this.lazarilloId=t.id,this.clientId=null!==(n=t.alias)&&void 0!==n?n:t.externalId,this.title=t.title,this.hidePlace=d.includes("hide_search"),this.description=t.description,this.shortDescription=t.shortDescription,this.position={lat:t.lat,lng:t.lng||t.lon},this.category=t.category,this.tags=null!==(o=t.tags)&&void 0!==o?o:[],this.generalCategory=t.general_category,this.localizedCategory=null!==(a=t.localizedCategory)&&void 0!==a?a:"",this.parentInstitutionId=t.parent_institution,this.inFloors=t.inFloor,this.innerFloors=[],t.innerFloors)this.innerFloors.push(et(et({},t.innerFloors[p]),{},{key:p}));this.innerFloors.sort(function(e,t){return e.index-t.index}),this.openingHours=t.opening_hours,this.address=t.address,this.transportLine=null===(s=t.properties)||void 0===s?void 0:s.filter(function(e){return"transport_line"===e.type}),t.logo&&(this.logo="string"==typeof t.logo?t.logo:t.logo.light),this.images=null!==(l=t.images)&&void 0!==l?l:[],this.banners=(null!==(c=t.banners)&&void 0!==c?c:[]).map(function(e){return new Je(e)}),this.properties=lt.parseProperties(null!==(u=t.properties)&&void 0!==u?u:[]),this.parentId=t.parent_id,this.parentType=t.parent_type,this.metadata=t.metadata,this.visibility=null!==(h=t.visibility)&&void 0!==h?h:"public"},[{key:"inFloor",value:function(e){var t=this;return this.inFloors&&0!==this.inFloors.length?e.find(function(e){var r;return e.key===(null===(r=t.inFloors)||void 0===r?void 0:r[0])}):e.find(function(e){return e.reachableFromGPS})}},{key:"toString",value:function(){return"LzPlace ".concat(this.lazarilloId)}}])}();function ot(e){return ot="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ot(e)}function at(e,t,r){return r&&function(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,st(i.key),i)}}(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function st(e){var t=function(e,t){if("object"!=ot(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=ot(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==ot(t)?t:t+""}var lt=function(){return at(function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)},0,[{key:"parseProperties",value:function(e){var t=this;try{var r=[];return e&&e.forEach(function(e){if(e.child_places){var i,n=e.child_places,o={childPlaces:[],title:e.key,subtitle:e.text,childParentPlace:e.child_parent_place,icon:e.icon,iconPrefix:null!==(i=e.iconPrefix)&&void 0!==i?i:"fas",orderChildrenBy:e.orderChildrenBy};n.forEach(function(e){if("string"==typeof e)o.childPlaces.push(e);else{var t=new nt(e);o.childPlaces.push(t)}}),r.push(o)}else if(e.child_properties){var a,s=e.child_properties,l={childProperties:[],title:e.key,subtitle:e.text,childParentPlace:e.child_parent_place,icon:e.icon,iconPrefix:null!==(a=e.iconPrefix)&&void 0!==a?a:"fas",orderChildrenBy:e.orderChildrenBy},c=t.parseProperties(s);l.childProperties=c,r.push(l)}else if(e.url){var u={title:e.key,subtitle:e.text,icon:e.icon,iconPrefix:e.iconPrefix,url:e.url,type:e.type,orderChildrenBy:e.orderChildrenBy};r.push(u)}else{var h,d={title:e.key,subtitle:e.text,childParentPlace:e.child_parent_place,icon:e.icon,type:e.type,iconPrefix:null!==(h=e.iconPrefix)&&void 0!==h?h:"fas",orderChildrenBy:e.orderChildrenBy};r.push(d)}}),r}catch(i){return console.log(i),console.log(e),[]}}}])}();function ct(e,t,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}var ut=ct(function e(t){var r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.lazarilloId=t.id,this.country=t.country,this.title=t.title,this.category=t.category,this.icon=t.icon,this.description=t.description,this.hasPlaces=t.hasPlaces,this.properties=lt.parseProperties(null!==(r=t.properties)&&void 0!==r?r:[])});function ht(e,t,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}var dt=ht(function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.schedule=t.schedules,this.routes=t.realtimeSchedules});function pt(e){return pt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pt(e)}function ft(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i,n,o,a,s=[],l=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t);else for(;!(l=(i=o.call(r)).done)&&(s.push(i.value),s.length!==t);l=!0);}catch(e){c=!0,n=e}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw n}}return s}}(e,t)||gt(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function mt(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=gt(e))||t){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function gt(e,t){if(e){if("string"==typeof e)return _t(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_t(e,t):void 0}}function _t(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function yt(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,bt(i.key),i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function vt(e,t,r){return(t=bt(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function bt(e){var t=function(e,t){if("object"!=pt(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=pt(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==pt(t)?t:t+""}var xt=function(){return yt(function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),vt(this,"cachedPlaces",new Map),vt(this,"cachedVehicles",new Map),vt(this,"cachedStops",new Map),vt(this,"cachedRoutes",new Map),vt(this,"cachedAccessibleRoutes",new Map),vt(this,"cachedConfigurations",new Map),vt(this,"cachedCategories",new Map),vt(this,"cachedSubPlaces",new Map)},[{key:"getPlace",value:function(e,t){var r="".concat(e,"_").concat(t);return this.cachedPlaces.get(r)}},{key:"hasPlace",value:function(e,t){var r="".concat(e,"_").concat(t);return this.cachedPlaces.has(r)}},{key:"setPlace",value:function(e,t,r){var i="".concat(e,"_").concat(r);this.cachedPlaces.set(i,t)}},{key:"getVehicle",value:function(e,t){var r="".concat(e,"_").concat(t);return this.cachedVehicles.get(r)}},{key:"setVehicle",value:function(e,t,r){var i="".concat(e,"_").concat(r);this.cachedVehicles.set(i,t)}},{key:"getStops",value:function(e,t){var r="".concat(e,"_").concat(t);return this.cachedStops.get(r)}},{key:"setStops",value:function(e,t,r){var i="".concat(e,"_").concat(r);this.cachedStops.set(i,t)}},{key:"getRoute",value:function(e){return this.cachedRoutes.get(e)}},{key:"setRoute",value:function(e,t){this.cachedRoutes.set(e,t)}},{key:"getAccessibleRoute",value:function(e){return this.cachedAccessibleRoutes.get(e)}},{key:"setAccessibleRoute",value:function(e,t){this.cachedAccessibleRoutes.set(e,t)}},{key:"cleanRoutesCache",value:function(){this.cachedRoutes.clear()}},{key:"cleanAccessibleRoutesCache",value:function(){this.cachedAccessibleRoutes.clear()}},{key:"getConfiguration",value:function(e,t,r){var i="".concat(e||"default","_").concat(t||"default","_").concat(r);return this.cachedConfigurations.get(i)}},{key:"setConfiguration",value:function(e,t,r,i){var n="".concat(e||"default","_").concat(t||"default","_").concat(r);this.cachedConfigurations.set(n,i)}},{key:"getCategories",value:function(e,t){var r="".concat(e||"default","_").concat(t);return this.cachedCategories.get(r)}},{key:"setCategories",value:function(e,t,r){var i="".concat(e||"default","_").concat(t);this.cachedCategories.set(i,r)}},{key:"getSubPlaces",value:function(e,t){var r="".concat(e,"_").concat(t);return this.cachedSubPlaces.get(r)}},{key:"setSubPlaces",value:function(e,t,r){var i="".concat(e,"_").concat(t);this.cachedSubPlaces.set(i,r)}},{key:"cleanAllCache",value:function(){this.cachedPlaces.clear(),this.cachedVehicles.clear(),this.cachedStops.clear(),this.cachedRoutes.clear(),this.cachedAccessibleRoutes.clear(),this.cachedConfigurations.clear(),this.cachedCategories.clear(),this.cachedSubPlaces.clear()}},{key:"cleanLanguageCache",value:function(e){var t,r=mt(this.cachedPlaces);try{for(r.s();!(t=r.n()).done;){var i=ft(t.value,1)[0];i.endsWith("_".concat(e))&&this.cachedPlaces.delete(i)}}catch(v){r.e(v)}finally{r.f()}var n,o=mt(this.cachedVehicles);try{for(o.s();!(n=o.n()).done;){var a=ft(n.value,1)[0];a.endsWith("_".concat(e))&&this.cachedVehicles.delete(a)}}catch(v){o.e(v)}finally{o.f()}var s,l=mt(this.cachedStops);try{for(l.s();!(s=l.n()).done;){var c=ft(s.value,1)[0];c.endsWith("_".concat(e))&&this.cachedStops.delete(c)}}catch(v){l.e(v)}finally{l.f()}var u,h=mt(this.cachedConfigurations);try{for(h.s();!(u=h.n()).done;){var d=ft(u.value,1)[0];d.endsWith("_".concat(e))&&this.cachedConfigurations.delete(d)}}catch(v){h.e(v)}finally{h.f()}var p,f=mt(this.cachedCategories);try{for(f.s();!(p=f.n()).done;){var m=ft(p.value,1)[0];m.endsWith("_".concat(e))&&this.cachedCategories.delete(m)}}catch(v){f.e(v)}finally{f.f()}var g,_=mt(this.cachedSubPlaces);try{for(_.s();!(g=_.n()).done;){var y=ft(g.value,1)[0];y.endsWith("_".concat(e))&&this.cachedSubPlaces.delete(y)}}catch(v){_.e(v)}finally{_.f()}}}])}();function wt(e){return wt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},wt(e)}function Tt(e){return function(e){if(Array.isArray(e))return St(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return St(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?St(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function St(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function Et(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",n=r.toStringTag||"@@toStringTag";function o(r,i,n,o){var l=i&&i.prototype instanceof s?i:s,c=Object.create(l.prototype);return It(c,"_invoke",function(r,i,n){var o,s,l,c=0,u=n||[],h=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,r){return o=t,s=0,l=e,d.n=r,a}};function p(r,i){for(s=r,l=i,t=0;!h&&c&&!n&&t<u.length;t++){var n,o=u[t],p=d.p,f=o[2];r>3?(n=f===i)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=p&&((n=r<2&&p<o[1])?(s=0,d.v=i,d.n=o[1]):p<f&&(n=r<3||o[0]>i||i>f)&&(o[4]=r,o[5]=i,d.n=f,s=0))}if(n||r>1)return a;throw h=!0,i}return function(n,u,f){if(c>1)throw TypeError("Generator is already running");for(h&&1===u&&p(u,f),s=u,l=f;(t=s<2?e:l)||!h;){o||(s?s<3?(s>1&&(d.n=-1),p(s,l)):d.n=l:d.v=l);try{if(c=2,o){if(s||(n="next"),t=o[n]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+n+"' method"),s=1);o=e}else if((t=(h=d.n<0)?l:r.call(i,d))!==a)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:h}}}(r,n,o),!0),c}var a={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][i]?t(t([][i]())):(It(t={},i,function(){return this}),t),h=c.prototype=s.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,It(e,n,"GeneratorFunction")),e.prototype=Object.create(h),e}return l.prototype=c,It(h,"constructor",c),It(c,"constructor",l),l.displayName="GeneratorFunction",It(c,n,"GeneratorFunction"),It(h),It(h,n,"Generator"),It(h,i,function(){return this}),It(h,"toString",function(){return"[object Generator]"}),(Et=function(){return{w:o,m:d}})()}function It(e,t,r,i){var n=Object.defineProperty;try{n({},"",{})}catch(e){n=0}It=function(e,t,r,i){function o(t,r){It(e,t,function(e){return this._invoke(t,r,e)})}t?n?n(e,t,{value:r,enumerable:!i,configurable:!i,writable:!i}):e[t]=r:(o("next",0),o("throw",1),o("return",2))},It(e,t,r,i)}function Pt(e,t,r,i,n,o,a){try{var s=e[o](a),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(i,n)}function kt(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var o=e.apply(t,r);function a(e){Pt(o,i,n,a,s,"next",e)}function s(e){Pt(o,i,n,a,s,"throw",e)}a(void 0)})}}function At(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,Mt(i.key),i)}}function Ct(e,t,r){return(t=Mt(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Mt(e){var t=function(e,t){if("object"!=wt(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=wt(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==wt(t)?t:t+""}vt(xt,"instance",new xt);var Dt=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Ct(this,"baseUrl","https://api.mapvx.com/sdk/"),Ct(this,"baseUrlMapVx","https://api.mapvx.com/api/"),Ct(this,"baseUrlPortal","https://api.mapvx.com/api/portal/"),this.lang=t}return function(e,t,r){return t&&At(e.prototype,t),r&&At(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}(e,[{key:"setLang",value:function(e){this.lang=e}},{key:"fetchTransport",value:(x=kt(Et().m(function t(r,i){var n,o;return Et().w(function(t){for(;;)if(0===t.n)return n={method:"GET",headers:{"content-type":"application/json"}},o={token:r,stopId:i,lang:this.lang},t.a(2,e.fetchFromUrl(this.baseUrl+"v2/vehiclesWithSchedules",o,n))},t,this)})),function(e,t){return x.apply(this,arguments)})},{key:"fetchStops",value:(b=kt(Et().m(function t(r,i,n){var o,a;return Et().w(function(t){for(;;)if(0===t.n)return o={method:"GET",headers:{"content-type":"application/json"}},a={token:r,stopId:i,vehicleId:n,lang:this.lang},t.a(2,e.fetchFromUrl(this.baseUrl+"v2/stops",a,o))},t,this)})),function(e,t,r){return b.apply(this,arguments)})},{key:"fetchMapStyle",value:(v=kt(Et().m(function t(r,i){var n,o;return Et().w(function(t){for(;;)if(0===t.n)return n={method:"GET",headers:{"content-type":"application/json"}},o={token:r,lang:this.lang},null!=i&&(o.place_id=i),t.a(2,e.fetchFromUrl(this.baseUrl+"mapStyleJson",o,n))},t,this)})),function(e,t){return v.apply(this,arguments)})},{key:"fetchAnyMapStyle",value:(y=kt(Et().m(function t(r,i){var n,o;return Et().w(function(t){for(;;)if(0===t.n)return n={method:"GET",headers:{"content-type":"application/json",Authorization:"Bearer ".concat(r)}},o={lang:this.lang,institution_id:i},t.a(2,e.fetchFromUrl(this.baseUrlPortal+"mapStyle",o,n))},t,this)})),function(e,t){return y.apply(this,arguments)})},{key:"fetchAllowedPlaces",value:(_=kt(Et().m(function t(r){var i,n;return Et().w(function(t){for(;;)if(0===t.n)return i={method:"GET",headers:{"content-type":"application/json"}},n={token:r,lang:this.lang},t.a(2,e.fetchFromUrl(this.baseUrl+"v2/availablePlaces",n,i))},t,this)})),function(e){return _.apply(this,arguments)})},{key:"fetchPlacesFromAnyInstitution",value:(g=kt(Et().m(function t(r,i){var n,o;return Et().w(function(t){for(;;)if(0===t.n)return n={method:"GET",headers:{"content-type":"application/json",Authorization:"Bearer ".concat(i)}},o={institution_id:r,lang:this.lang},t.a(2,e.fetchFromUrl(this.baseUrlPortal+"availablePlaces",o,n))},t,this)})),function(e,t){return g.apply(this,arguments)})},{key:"fetchPlaceDetail",value:(m=kt(Et().m(function t(r,i){var n,o;return Et().w(function(t){for(;;)if(0===t.n)return n={method:"GET",headers:{"content-type":"application/json"}},o={token:r,place_id:i,lang:this.lang},t.a(2,e.fetchFromUrl(this.baseUrl+"v3/place",o,n))},t,this)})),function(e,t){return m.apply(this,arguments)})},{key:"fetchAnyPlaceDetail",value:(f=kt(Et().m(function t(r,i){var n,o;return Et().w(function(t){for(;;)if(0===t.n)return n={method:"GET",headers:{"content-type":"application/json",Authorization:"Bearer ".concat(r)}},o={place_id:i,lang:this.lang},t.a(2,e.fetchFromUrl(this.baseUrlPortal+"place",o,n))},t,this)})),function(e,t){return f.apply(this,arguments)})},{key:"fetchSubPlaces",value:(p=kt(Et().m(function t(r,i){var n,o;return Et().w(function(t){for(;;)if(0===t.n)return n={method:"GET",headers:{"content-type":"application/json"}},o={token:i,targetPlace:r,lang:this.lang},t.a(2,e.fetchFromUrl(this.baseUrl+"v3/subPlaces",o,n))},t,this)})),function(e,t){return p.apply(this,arguments)})},{key:"fetchAnySubPlaces",value:(d=kt(Et().m(function t(r,i){var n,o;return Et().w(function(t){for(;;)if(0===t.n)return n={method:"GET",headers:{"content-type":"application/json",Authorization:"Bearer ".concat(i)}},o={place_id:r,lang:this.lang},t.a(2,e.fetchFromUrl(this.baseUrlPortal+"subPlaces",o,n))},t,this)})),function(e,t){return d.apply(this,arguments)})},{key:"fetchRoute",value:(h=kt(Et().m(function t(r,i){var n,o,a,s,l,c,u,h,d,p,f,m,g,_,y;return Et().w(function(t){for(;;)if(0===t.n){for(_ in n={method:"GET",headers:{"content-type":"application/json"}},o={fromLatLng:void 0,fromBuilding:void 0,fromFloor:void 0,toLatLng:void 0,toBuilding:void 0,toFloor:void 0,fromPlaceId:void 0,toPlaceId:void 0,travelMode:he.walking,reducedMobility:r.preferAccessibleRoute?1:0,announceFormat:r.announceFormat,userBearing:0,lang:this.lang,unitSystem:r.unitSystem,token:i},"id"in r.initialLocation?(o.fromPlaceId=r.initialLocation.id,void 0!==r.initialLocation.level&&(o.fromFloor=r.initialLocation.level)):(a=r.initialLocation,s=a.lat,l=a.lng,c=a.floorId,u=a.placeId,o.fromLatLng="".concat(s,",").concat(l),o.fromFloor=c,o.fromBuilding=u),"id"in r.finalLocation?(o.toPlaceId=r.finalLocation.id,void 0!==r.finalLocation.level&&(o.toFloor=r.finalLocation.level)):(h=r.finalLocation,d=h.lat,p=h.lng,f=h.floorId,m=h.placeId,o.toLatLng="".concat(d,",").concat(p),o.toFloor=f,o.toBuilding=m),g={},o)null!=(y=o[_])&&(g[_]=y);return t.a(2,e.fetchFromUrl(this.baseUrl+"route",g,n))}},t,this)})),function(e,t){return h.apply(this,arguments)})},{key:"fetchRouteV2",value:(u=kt(Et().m(function t(r,i){var n,o,a,s,l,c,u,h,d,p,f,m,g,_,y;return Et().w(function(t){for(;;)if(0===t.n){for(_ in n={method:"GET",headers:{"content-type":"application/json"}},o={fromLatLng:void 0,fromBuilding:void 0,fromFloor:void 0,toLatLng:void 0,toBuilding:void 0,toFloor:void 0,fromPlaceId:void 0,toPlaceId:void 0,travelMode:he.walking,reducedMobility:r.preferAccessibleRoute?1:0,announceFormat:r.announceFormat,userBearing:0,lang:this.lang,unitSystem:r.unitSystem,token:i},"id"in r.initialLocation?(o.fromPlaceId=r.initialLocation.id,void 0!==r.initialLocation.level&&(o.fromFloor=r.initialLocation.level)):(a=r.initialLocation,s=a.lat,l=a.lng,c=a.floorId,u=a.placeId,o.fromLatLng="".concat(s,",").concat(l),o.fromFloor=c,o.fromBuilding=u),"id"in r.finalLocation?(o.toPlaceId=r.finalLocation.id,void 0!==r.finalLocation.level&&(o.toFloor=r.finalLocation.level)):(h=r.finalLocation,d=h.lat,p=h.lng,f=h.floorId,m=h.placeId,o.toLatLng="".concat(d,",").concat(p),o.toFloor=f,o.toBuilding=m),g={},o)null!=(y=o[_])&&(g[_]=y);return t.a(2,e.fetchFromUrl(this.baseUrl+"v2/route",g,n))}},t,this)})),function(e,t){return u.apply(this,arguments)})},{key:"fetchInstitutions",value:(c=kt(Et().m(function t(r){var i,n;return Et().w(function(t){for(;;)if(0===t.n)return i={method:"GET",headers:{"content-type":"application/json"}},n={token:r,lang:this.lang},t.a(2,e.fetchFromUrl(this.baseUrl+"v2/institution",n,i))},t,this)})),function(e){return c.apply(this,arguments)})},{key:"fetchSearchResults",value:(l=kt(Et().m(function t(r,i,n,o){var a,s;return Et().w(function(t){for(;;)if(0===t.n)return a={method:"GET",headers:{"content-type":"application/json"}},s={institution_id:r,input:i,lang:this.lang,token:n},o&&(s.parentPlaces=Tt(o)),t.a(2,e.fetchFromUrl(this.baseUrl+"v2/searchPlacesWithFilters",s,a))},t,this)})),function(e,t,r,i){return l.apply(this,arguments)})},{key:"fetchConfiguration",value:(s=kt(Et().m(function t(r,i,n){var o,a;return Et().w(function(t){for(;;)if(0===t.n)return o={method:"GET",headers:{"content-type":"application/json"}},a={token:r,lang:this.lang},i&&(a.place_id=i),n&&(a.product=n),t.a(2,e.fetchFromUrl(this.baseUrlMapVx+"configuration",a,o))},t,this)})),function(e,t,r){return s.apply(this,arguments)})},{key:"fetchCategories",value:(a=kt(Et().m(function t(r,i){var n,o;return Et().w(function(t){for(;;)if(0===t.n)return n={method:"GET",headers:{"content-type":"application/json"}},o={token:r,lang:this.lang},i&&(o.id=i),t.a(2,e.fetchFromUrl(this.baseUrlMapVx+"category",o,n))},t,this)})),function(e,t){return a.apply(this,arguments)})},{key:"fetchRoutesForOrigin",value:(o=kt(Et().m(function t(r,i,n,o,a,s){var l,c;return Et().w(function(t){for(;;)if(0===t.n)return l={method:"GET",headers:{"content-type":"application/json"}},c={token:r,placeId:i,fromPlace:n,announceFormat:o,unitSystem:a,mode:s,lang:this.lang},t.a(2,e.fetchFromUrl(this.baseUrl+"routes_for_origin",c,l))},t,this)})),function(e,t,r,i,n,a){return o.apply(this,arguments)})},{key:"fetchCacheTimestamp",value:(n=kt(Et().m(function t(r,i){var n,o;return Et().w(function(t){for(;;)if(0===t.n)return n={method:"GET",headers:{"content-type":"application/json"}},o={token:r,placeId:i},t.a(2,e.fetchFromUrl(this.baseUrl+"cache_timestamp",o,n))},t,this)})),function(e,t){return n.apply(this,arguments)})},{key:"fetchCssCustomization",value:(i=kt(Et().m(function t(r,i){var n,o;return Et().w(function(t){for(;;)if(0===t.n)return n={method:"GET",headers:{"content-type":"application/json"}},o={token:r,type:i},t.a(2,e.fetchFromUrl(this.baseUrlMapVx+"styles/customStyles",o,n))},t,this)})),function(e,t){return i.apply(this,arguments)})},{key:"postHealth",value:(r=kt(Et().m(function t(r,i,n,o,a){var s,l,c;return Et().w(function(t){for(;;)if(0===t.n)return s=JSON.stringify({healthPingId:i,placeId:n,totemId:o,status:a}),l={token:r},c={method:"POST",headers:{accept:"application/json","Content-Type":"application/json"},body:s},t.a(2,e.fetchFromUrl(this.baseUrlMapVx+"health",l,c))},t,this)})),function(e,t,i,n,o){return r.apply(this,arguments)})}],[{key:"fetchFromUrl",value:(t=kt(Et().m(function e(t,r,i){var n;return Et().w(function(e){for(;;)if(0===e.n)return(n=new URL(t)).search=new URLSearchParams(r).toString(),e.a(2,fetch(n.toString(),i))},e)})),function(e,r,i){return t.apply(this,arguments)})}]);var t,r,i,n,o,a,s,l,c,u,h,d,p,f,m,g,_,y,v,b,x}();function Rt(e){return Rt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Rt(e)}function Lt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i,n,o,a,s=[],l=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t);else for(;!(l=(i=o.call(r)).done)&&(s.push(i.value),s.length!==t);l=!0);}catch(e){c=!0,n=e}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw n}}return s}}(e,t)||Ot(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ft(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Ot(e))||t){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function Ot(e,t){if(e){if("string"==typeof e)return zt(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?zt(e,t):void 0}}function zt(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function Bt(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",n=r.toStringTag||"@@toStringTag";function o(r,i,n,o){var l=i&&i.prototype instanceof s?i:s,c=Object.create(l.prototype);return Nt(c,"_invoke",function(r,i,n){var o,s,l,c=0,u=n||[],h=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,r){return o=t,s=0,l=e,d.n=r,a}};function p(r,i){for(s=r,l=i,t=0;!h&&c&&!n&&t<u.length;t++){var n,o=u[t],p=d.p,f=o[2];r>3?(n=f===i)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=p&&((n=r<2&&p<o[1])?(s=0,d.v=i,d.n=o[1]):p<f&&(n=r<3||o[0]>i||i>f)&&(o[4]=r,o[5]=i,d.n=f,s=0))}if(n||r>1)return a;throw h=!0,i}return function(n,u,f){if(c>1)throw TypeError("Generator is already running");for(h&&1===u&&p(u,f),s=u,l=f;(t=s<2?e:l)||!h;){o||(s?s<3?(s>1&&(d.n=-1),p(s,l)):d.n=l:d.v=l);try{if(c=2,o){if(s||(n="next"),t=o[n]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+n+"' method"),s=1);o=e}else if((t=(h=d.n<0)?l:r.call(i,d))!==a)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:h}}}(r,n,o),!0),c}var a={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][i]?t(t([][i]())):(Nt(t={},i,function(){return this}),t),h=c.prototype=s.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,Nt(e,n,"GeneratorFunction")),e.prototype=Object.create(h),e}return l.prototype=c,Nt(h,"constructor",c),Nt(c,"constructor",l),l.displayName="GeneratorFunction",Nt(c,n,"GeneratorFunction"),Nt(h),Nt(h,n,"Generator"),Nt(h,i,function(){return this}),Nt(h,"toString",function(){return"[object Generator]"}),(Bt=function(){return{w:o,m:d}})()}function Nt(e,t,r,i){var n=Object.defineProperty;try{n({},"",{})}catch(e){n=0}Nt=function(e,t,r,i){function o(t,r){Nt(e,t,function(e){return this._invoke(t,r,e)})}t?n?n(e,t,{value:r,enumerable:!i,configurable:!i,writable:!i}):e[t]=r:(o("next",0),o("throw",1),o("return",2))},Nt(e,t,r,i)}function jt(e,t,r,i,n,o,a){try{var s=e[o](a),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(i,n)}function Vt(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var o=e.apply(t,r);function a(e){jt(o,i,n,a,s,"next",e)}function s(e){jt(o,i,n,a,s,"throw",e)}a(void 0)})}}function Ut(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function Gt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ut(Object(r),!0).forEach(function(t){Xt(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ut(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function qt(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,Yt(i.key),i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function $t(e,t,r){return t=Zt(t),function(e,t){if(t&&("object"==Rt(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Wt()?Reflect.construct(t,[],Zt(e).constructor):t.apply(e,r))}function Wt(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Wt=function(){return!!e})()}function Zt(e){return Zt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Zt(e)}function Ht(e,t){return Ht=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ht(e,t)}function Xt(e,t,r){return(t=Yt(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Yt(e){var t=function(e,t){if("object"!=Rt(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=Rt(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==Rt(t)?t:t+""}var Jt=function(e){function t(e,r){var i;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),Xt(i=$t(this,t),"cache",xt.instance),Xt(i,"currentLang","en"),i.token=e,i.currentLang=r,i.requester=new Dt(r),i.lang=r,i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ht(e,t)}(t,e),qt(t,[{key:"setLang",value:function(e){this.currentLang=e,this.requester.setLang(e)}},{key:"prepareSegmentation",value:function(e){return Gt(Gt({},e),{},{token:this.token})}},{key:"fetchAndParseMapStyle",value:(x=Vt(Bt().m(function e(t){var r,i,n,o,a;return Bt().w(function(e){for(;;)switch(e.p=e.n){case 0:if(void 0!==t||!this.baseStyle){e.n=1;break}return e.a(2,this.baseStyle);case 1:return e.p=1,e.n=2,this.requester.fetchMapStyle(this.token,t);case 2:if((r=e.v).ok){e.n=4;break}return e.n=3,r.json();case 3:throw i=e.v,new Error("Fetch failed with status ".concat(r.status,": ").concat(i));case 4:return e.n=5,r.json();case 5:return n=e.v,o=n.style,void 0===t&&(this.baseStyle=o),this.logEvent("fetchAndParseMapStyle"),e.a(2,o);case 6:throw e.p=6,a=e.v,this.logWarning(a,{functionName:"fetchAndParseMapStyle"}),new Error("Failed to fetch and parse map style");case 7:return e.a(2)}},e,this,[[1,6]])})),function(e){return x.apply(this,arguments)})},{key:"fetchAndParseAnyMapStyle",value:(b=Vt(Bt().m(function e(t,r){var i,n,o,a,s;return Bt().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.requester.fetchAnyMapStyle(r,t);case 1:if((i=e.v).ok){e.n=3;break}return e.n=2,i.json();case 2:throw n=e.v,new Error("Fetch failed with status ".concat(i.status,": ").concat(n));case 3:return e.n=4,i.json();case 4:return o=e.v,a=o.style,this.logEvent("fetchAndParseAnyMapStyle"),e.a(2,a);case 5:throw e.p=5,s=e.v,this.logWarning(s,{functionName:"fetchAndParseAnyMapStyle"}),new Error("Failed to fetch and parse map style with bearer token");case 6:return e.a(2)}},e,this,[[0,5]])})),function(e,t){return b.apply(this,arguments)})},{key:"fetchAndParseInstitutions",value:(v=Vt(Bt().m(function e(){var t,r,i,n,o,a,s,l,c,u;return Bt().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.requester.fetchInstitutions(this.token);case 1:if((t=e.v).ok){e.n=3;break}return e.n=2,t.json();case 2:throw r=e.v,new Error("Fetch failed with status ".concat(t.status,": ").concat(r));case 3:return e.n=4,t.json();case 4:i=e.v,n=[],o=Ft(i);try{for(o.s();!(a=o.n()).done;)s=a.value,l=new ut(s),n.push(l)}catch(h){o.e(h)}finally{o.f()}if(n.sort(function(e,t){return e.title.localeCompare(t.title)}),!(c=n)){e.n=5;break}return this.logEvent("fetchAndParseInstitutionsV2"),e.a(2,c);case 5:throw new Error("No institutions associated to this apiKey");case 6:e.n=8;break;case 7:throw e.p=7,u=e.v,this.logWarning(u,{functionName:"fetchAndParseInstitutionsV2"}),new Error("Failed to fetch and parse institution");case 8:return e.a(2)}},e,this,[[0,7]])})),function(){return v.apply(this,arguments)})},{key:"fetchAndParsePlaceDetail",value:(y=Vt(Bt().m(function e(t){var r,i,n,o,a,s;return Bt().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,null==(r=this.cache.getPlace(t,this.lang))){e.n=1;break}return this.logEvent("fetchAndParsePlaceDetail",{cached:"true"}),e.a(2,r);case 1:return e.n=2,this.requester.fetchPlaceDetail(this.token,t);case 2:if((i=e.v).ok){e.n=4;break}return e.n=3,i.json();case 3:throw n=e.v,new Error("Fetch failed with status ".concat(i.status,": ").concat(n));case 4:return e.n=5,i.json();case 5:return o=e.v,a=new nt(o),this.cache.setPlace(a.lazarilloId,a,this.lang),null!=a.clientId&&this.cache.setPlace(a.clientId,a,this.lang),this.logEvent("fetchAndParsePlaceDetail",{cached:"false"}),e.a(2,a);case 6:throw e.p=6,s=e.v,this.logWarning(s,{functionName:"fetchAndParsePlaceDetail"}),new Error("Failed to fetch and parse place detail");case 7:return e.a(2)}},e,this,[[0,6]])})),function(e){return y.apply(this,arguments)})},{key:"fetchAndParseAnyPlaceDetail",value:(_=Vt(Bt().m(function e(t,r){var i,n,o,a,s,l;return Bt().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,null==(i=this.cache.getPlace(t,this.lang))){e.n=1;break}return this.logEvent("fetchAndParseAnyPlaceDetail",{cached:"true"}),e.a(2,i);case 1:return e.n=2,this.requester.fetchAnyPlaceDetail(r,t);case 2:if((n=e.v).ok){e.n=4;break}return e.n=3,n.json();case 3:throw o=e.v,new Error("Fetch failed with status ".concat(n.status,": ").concat(o));case 4:return e.n=5,n.json();case 5:return a=e.v,s=new nt(a),this.cache.setPlace(s.lazarilloId,s,this.lang),null!=s.clientId&&this.cache.setPlace(s.clientId,s,this.lang),this.logEvent("fetchAndParseAnyPlaceDetail",{cached:"false"}),e.a(2,s);case 6:throw e.p=6,l=e.v,this.logWarning(l,{functionName:"fetchAndParseAnyPlaceDetail"}),new Error("Failed to fetch and parse place detail with bearer token");case 7:return e.a(2)}},e,this,[[0,6]])})),function(e,t){return _.apply(this,arguments)})},{key:"fetchAndParseSubPlaces",value:(g=Vt(Bt().m(function e(t){var r,i,n,o,a,s,l=this;return Bt().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,null==(r=this.cache.getSubPlaces(t,this.currentLang))){e.n=1;break}return this.logEvent("fetchAndParseSubPlaces",{cached:"true"}),e.a(2,r.data);case 1:return e.n=2,this.requester.fetchSubPlaces(t,this.token);case 2:if((i=e.v).ok){e.n=4;break}return e.n=3,i.json();case 3:throw n=e.v,new Error("Fetch failed with status ".concat(i.status,": ").concat(n));case 4:return e.n=5,i.json();case 5:return o=e.v,a=o.map(function(e){return new nt(e)}),this.cache.setSubPlaces(t,this.currentLang,{timestamp:Date.now(),data:a}),this.logEvent("fetchAndParseSubPlaces",{cached:"false"}),a.forEach(function(e){l.cache.hasPlace(e.lazarilloId,l.currentLang)||l.cache.setPlace(e.lazarilloId,e,l.currentLang),null==e.clientId||l.cache.hasPlace(e.clientId,l.currentLang)||l.cache.setPlace(e.clientId,e,l.currentLang)}),e.a(2,a);case 6:throw e.p=6,s=e.v,this.logWarning(s,{functionName:"fetchAndParseSubPlaces",parentPlaceId:t}),new Error("Failed to fetch and parse subplaces");case 7:return e.a(2)}},e,this,[[0,6]])})),function(e){return g.apply(this,arguments)})},{key:"fetchAndParseAnySubPlaces",value:(m=Vt(Bt().m(function e(t,r){var i,n,o,a,s,l=this;return Bt().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.requester.fetchAnySubPlaces(t,r);case 1:if((i=e.v).ok){e.n=3;break}return e.n=2,i.json();case 2:throw n=e.v,new Error("Fetch failed with status ".concat(i.status,": ").concat(n));case 3:return e.n=4,i.json();case 4:return o=e.v,a=o.map(function(e){return new nt(e)}),this.logEvent("fetchAndParseAnySubPlaces"),a.forEach(function(e){l.cache.hasPlace(e.lazarilloId,l.lang)||l.cache.setPlace(e.lazarilloId,e,l.lang),null==e.clientId||l.cache.hasPlace(e.clientId,l.lang)||l.cache.setPlace(e.clientId,e,l.lang)}),e.a(2,a);case 5:throw e.p=5,s=e.v,this.logWarning(s,{functionName:"fetchAndParseAnySubPlaces",parentPlaceId:t}),new Error("Failed to fetch and parse any subplaces");case 6:return e.a(2)}},e,this,[[0,5]])})),function(e,t){return m.apply(this,arguments)})},{key:"fetchAndParseAvailablePlaces",value:(f=Vt(Bt().m(function e(){var t,r,i,n,o,a=this;return Bt().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.requester.fetchAllowedPlaces(this.token);case 1:if((t=e.v).ok){e.n=3;break}return e.n=2,t.json();case 2:throw r=e.v,new Error("Fetch failed with status ".concat(t.status,": ").concat(r));case 3:return e.n=4,t.json();case 4:return i=e.v,n=i.map(function(e){return new nt(e)}),this.logEvent("fetchAndParseAvailablePlaces"),n.forEach(function(e){a.cache.hasPlace(e.lazarilloId,a.lang)||a.cache.setPlace(e.lazarilloId,e,a.lang),null==e.clientId||a.cache.hasPlace(e.clientId,a.lang)||a.cache.setPlace(e.clientId,e,a.lang)}),e.a(2,n);case 5:throw e.p=5,o=e.v,this.logWarning(o,{functionName:"fetchAndParseAvailablePlaces"}),new Error("Failed to fetch and parse parent places");case 6:return e.a(2)}},e,this,[[0,5]])})),function(){return f.apply(this,arguments)})},{key:"fetchAndParsePlacesFromInstitution",value:(p=Vt(Bt().m(function e(t,r){var i,n,o,a,s,l=this;return Bt().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.requester.fetchPlacesFromAnyInstitution(t,r);case 1:if((i=e.v).ok){e.n=3;break}return e.n=2,i.json();case 2:throw n=e.v,new Error("Fetch failed with status ".concat(i.status,": ").concat(n));case 3:return e.n=4,i.json();case 4:return o=e.v,a=o.map(function(e){return new nt(e)}),this.logEvent("fetchAndParsePlacesFromInstitution"),a.forEach(function(e){l.cache.hasPlace(e.lazarilloId,l.lang)||l.cache.setPlace(e.lazarilloId,e,l.lang),null==e.clientId||l.cache.hasPlace(e.clientId,l.lang)||l.cache.setPlace(e.clientId,e,l.lang)}),e.a(2,a);case 5:throw e.p=5,s=e.v,this.logWarning(s,{functionName:"fetchAndParsePlacesFromInstitution"}),new Error("Failed to fetch and parse parent places from institution");case 6:return e.a(2)}},e,this,[[0,5]])})),function(e,t){return p.apply(this,arguments)})},{key:"getCachedPlaces",value:function(e){var t=this,r=[];return e.forEach(function(e){var i=t.cache.getPlace(e,t.lang);if(null!=i)r.push(i);else{var n=new Error("The id was not found on cache");"captureStackTrace"in Error&&Error.captureStackTrace(n),t.logWarning(n,{functionName:"getCachedPlaces",id:e})}}),r}},{key:"fetchAndParseRoute",value:(d=Vt(Bt().m(function e(t){var r,i,n,o,a,s,l;return Bt().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,r="","id"in t.finalLocation&&(r=t.finalLocation.id),null==(i=this.cache.getRoute(r))){e.n=1;break}return this.logEvent("fetchAndParseRoute",{cached:"true"}),this.debugLog("Route cache testing. Found in caché."),e.a(2,i.data);case 1:return e.n=2,this.requester.fetchRoute(t,this.token);case 2:if((n=e.v).ok){e.n=4;break}return e.n=3,n.json();case 3:throw o=e.v,new Error("Fetch failed with status ".concat(n.status,": ").concat(o));case 4:return e.n=5,n.json();case 5:return a=e.v,s=new We(a[0]),this.logEvent("fetchAndParseRoute"),this.debugLog("Route cache testing. Fetched."),e.a(2,s);case 6:throw e.p=6,l=e.v,this.logWarning(l,{functionName:"fetchAndParseRoute"}),new Error("Failed to fetch and parse route");case 7:return e.a(2)}},e,this,[[0,6]])})),function(e){return d.apply(this,arguments)})},{key:"fetchAndParseRouteV2",value:(h=Vt(Bt().m(function e(t){var r,i,n,o,a,s,l;return Bt().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,r="","id"in t.finalLocation&&(r=t.finalLocation.id),null==(i=this.cache.getRoute(r))){e.n=1;break}return this.logEvent("fetchAndParseRouteV2",{cached:"true"}),this.debugLog("Route cache testing. Found in caché."),e.a(2,i.data);case 1:return e.n=2,this.requester.fetchRouteV2(t,this.token);case 2:if((n=e.v).ok){e.n=4;break}return e.n=3,n.json();case 3:throw o=e.v,new Error("Fetch failed with status ".concat(n.status,": ").concat(o));case 4:return e.n=5,n.json();case 5:return a=e.v,s=new We(a[0]),this.logEvent("fetchAndParseRouteV2"),this.debugLog("Route cache testing. Fetched."),e.a(2,s);case 6:throw e.p=6,l=e.v,this.logWarning(l,{functionName:"fetchAndParseRouteV2"}),new Error("Failed to fetch and parse route");case 7:return e.a(2)}},e,this,[[0,6]])})),function(e){return h.apply(this,arguments)})},{key:"fetchAndParseTransport",value:(u=Vt(Bt().m(function e(t){var r,i,n,o,a,s,l,c,u,h,d=this;return Bt().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,null==(r=this.cache.getVehicle(t,this.lang))||!(Date.now()-r.timestamp<6e3||0===r.data.routes.length)){e.n=1;break}return this.logEvent("fetchAndParseTransport",{cached:"true"}),e.a(2,r.data);case 1:return e.n=2,this.requester.fetchTransport(this.token,t);case 2:if((i=e.v).ok){e.n=4;break}return e.n=3,i.json();case 3:throw n=e.v,new Error("Fetch failed with status ".concat(i.status,": ").concat(n));case 4:return e.n=5,i.json();case 5:if(!((o=e.v).realtimeSchedules.length>0)){e.n=7;break}return a=o.realtimeSchedules.map(function(e){return d.fetchAndParseStops(t,e.vehicleId)}),e.n=6,Promise.all(a);case 6:(s=e.v).length>0&&o.realtimeSchedules.forEach(function(e){var t,r;e.stops=null!==(t=null===(r=s.find(function(t){return t.id==e.vehicleId}))||void 0===r?void 0:r.places)&&void 0!==t?t:[]});case 7:return l=new dt(o),this.cache.setVehicle(t,{timestamp:Date.now(),data:l},this.lang),this.logEvent("fetchAndParseTransport",{cached:"false"}),e.a(2,l);case 8:if(e.p=8,h=e.v,this.logWarning(h,{functionName:"fetchAndParseTransport"}),null==(c=this.cache.getVehicle(t,this.lang))){e.n=9;break}return u=new dt({realtimeSchedules:[],schedules:c.data.schedule}),this.logEvent("fetchAndParseTransport",{cached:"true"}),e.a(2,u);case 9:throw new Error("Failed to fetch and parse transport");case 10:return e.a(2)}},e,this,[[0,8]])})),function(e){return u.apply(this,arguments)})},{key:"fetchAndParseStops",value:(c=Vt(Bt().m(function e(t,r){var i,n,o,a,s,l;return Bt().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,!(null!=(i=this.cache.getStops(t+r,this.lang))&&Date.now()-i.timestamp<6e4)){e.n=1;break}return this.logEvent("fetchAndParseStops",{cached:"true"}),e.a(2,{id:r,places:i.data});case 1:return e.n=2,this.requester.fetchStops(this.token,t,r);case 2:if((n=e.v).ok){e.n=4;break}return e.n=3,n.json();case 3:throw o=e.v,new Error("Fetch failed with status ".concat(n.status,": ").concat(o));case 4:return e.n=5,n.json();case 5:return a=e.v,s=a.map(function(e){return new nt(e)}),this.cache.setStops(t+r,{timestamp:Date.now(),data:s},this.lang),this.logEvent("fetchAndParseStops",{cached:"false"}),e.a(2,{id:r,places:s});case 6:throw e.p=6,l=e.v,this.logWarning(l,{functionName:"fetchAndParseStops"}),new Error("Failed to fetch and parse stops");case 7:return e.a(2)}},e,this,[[0,6]])})),function(e,t){return c.apply(this,arguments)})},{key:"fetchAndParseSearchResults",value:(l=Vt(Bt().m(function e(t,r,i){var n,o,a,s,l;return Bt().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.requester.fetchSearchResults(t,r,this.token,i);case 1:if((n=e.v).ok){e.n=3;break}return e.n=2,n.json();case 2:throw o=e.v,new Error("Fetch failed with status ".concat(n.status,": ").concat(o));case 3:return e.n=4,n.json();case 4:return a=e.v,s=a.map(function(e){return new nt(e)}),e.a(2,s);case 5:throw e.p=5,l=e.v,this.logWarning(l,{functionName:"fetchAndParseSearchResults"}),new Error("Failed to fetch and parse search results");case 6:return e.a(2)}},e,this,[[0,5]])})),function(e,t,r){return l.apply(this,arguments)})},{key:"fetchAndParseRoutesFromOrigin",value:(s=Vt(Bt().m(function e(t,r,i,n,o){var a,s,l,c,u,h,d=this;return Bt().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.requester.fetchRoutesForOrigin(this.token,t,r,i,n,o);case 1:if((a=e.v).ok){e.n=3;break}return e.n=2,a.json();case 2:throw s=e.v,new Error("Fetch failed with status ".concat(a.status,": ").concat(s));case 3:return e.n=4,a.json();case 4:l=e.v,c=l.routes,u=l.accessibleRoutes,Object.entries(c).forEach(function(e){var t=Lt(e,2),r=t[0],i=t[1],n=new We(i[0]);d.cache.setRoute(r,{timestamp:Date.now(),data:n})}),Object.entries(u).forEach(function(e){var t=Lt(e,2),r=t[0],i=t[1],n=new We(i[0]);d.cache.setAccessibleRoute(r,{timestamp:Date.now(),data:n})}),this.debugLog("Route cache testing. Cache populated!"),e.n=6;break;case 5:throw e.p=5,h=e.v,this.logWarning(h,{functionName:"fetchAndParseRoutesFromOrigin"}),new Error("Failed to fetch and parse routes from origin results");case 6:return e.a(2)}},e,this,[[0,5]])})),function(e,t,r,i,n){return s.apply(this,arguments)})},{key:"fetchAndParseCacheTimestamp",value:(a=Vt(Bt().m(function e(t){var r,i,n,o,a;return Bt().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.requester.fetchCacheTimestamp(this.token,t);case 1:if((r=e.v).ok){e.n=3;break}return e.n=2,r.json();case 2:throw i=e.v,new Error("Fetch failed with status ".concat(r.status,": ").concat(i));case 3:return e.n=4,r.json();case 4:return n=e.v,o=n.lastUpdate,e.a(2,o);case 5:throw e.p=5,a=e.v,this.logWarning(a,{functionName:"fetchAndParseCacheTimestamp"}),new Error("Failed to fetch and parse cache timestamp");case 6:return e.a(2)}},e,this,[[0,5]])})),function(e){return a.apply(this,arguments)})},{key:"cleanRoutesCache",value:function(){this.cache.cleanRoutesCache(),this.cache.cleanAccessibleRoutesCache()}},{key:"fetchAndParseConfiguration",value:(o=Vt(Bt().m(function e(t,r){var i,n,o,a,s;return Bt().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,null==(i=this.cache.getConfiguration(t||"default",r||"default",this.currentLang))){e.n=1;break}return this.logEvent("fetchAndParseConfiguration",{cached:"true"}),e.a(2,i.data);case 1:return e.n=2,this.requester.fetchConfiguration(this.token,t,r);case 2:if((n=e.v).ok){e.n=4;break}return e.n=3,n.json();case 3:throw o=e.v,new Error("Fetch failed with status ".concat(n.status,": ").concat(o));case 4:return e.n=5,n.json();case 5:return a=e.v,this.cache.setConfiguration(t||"default",r||"default",this.currentLang,{timestamp:Date.now(),data:a}),this.logEvent("fetchAndParseConfiguration",{cached:"false"}),e.a(2,a);case 6:throw e.p=6,s=e.v,this.logWarning(s,{functionName:"fetchAndParseConfiguration"}),new Error("Failed to fetch and parse configuration");case 7:return e.a(2)}},e,this,[[0,6]])})),function(e,t){return o.apply(this,arguments)})},{key:"fetchAndParseCategories",value:(n=Vt(Bt().m(function e(t){var r,i,n,o,a;return Bt().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,null==(r=this.cache.getCategories(t||"default",this.currentLang))){e.n=1;break}return this.logEvent("fetchAndParseCategories",{cached:"true"}),e.a(2,r.data);case 1:return e.n=2,this.requester.fetchCategories(this.token,t);case 2:if((i=e.v).ok){e.n=4;break}return e.n=3,i.json();case 3:throw n=e.v,new Error("Fetch failed with status ".concat(i.status,": ").concat(n));case 4:return e.n=5,i.json();case 5:return o=e.v,this.cache.setCategories(t||"default",this.currentLang,{timestamp:Date.now(),data:o}),this.logEvent("fetchAndParseCategories",{cached:"false"}),e.a(2,o);case 6:throw e.p=6,a=e.v,this.logWarning(a,{functionName:"fetchAndParseCategories"}),new Error("Failed to fetch and parse categories");case 7:return e.a(2)}},e,this,[[0,6]])})),function(e){return n.apply(this,arguments)})},{key:"fetchAndParseCssCustomization",value:(i=Vt(Bt().m(function e(t){var r,i,n,o;return Bt().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.requester.fetchCssCustomization(this.token,t);case 1:if((r=e.v).ok){e.n=3;break}return e.n=2,r.json();case 2:throw i=e.v,new Error("Fetch failed with status ".concat(r.status,": ").concat(i));case 3:return e.n=4,r.json();case 4:return n=e.v,e.a(2,n);case 5:throw e.p=5,o=e.v,this.logWarning(o,{functionName:"fetchAndParseCssCustomization"}),new Error("Failed to fetch and parse css customization");case 6:return e.a(2)}},e,this,[[0,5]])})),function(e){return i.apply(this,arguments)})},{key:"postAndParseHealthPing",value:(r=Vt(Bt().m(function e(t,r,i,n){var o,a,s;return Bt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this.requester.postHealth(this.token,t,r,i,n);case 1:if((o=e.v).ok){e.n=3;break}return e.n=2,o.json();case 2:throw a=e.v,new Error("Post failed with status ".concat(o.status,": ").concat(a));case 3:return e.n=4,o.json();case 4:return s=e.v,e.a(2,s)}},e,this)})),function(e,t,i,n){return r.apply(this,arguments)})}]);var r,i,n,o,a,s,l,c,u,h,d,p,f,m,g,_,y,v,b,x}(Fe);function Kt(e){return Kt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Kt(e)}function Qt(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",n=r.toStringTag||"@@toStringTag";function o(r,i,n,o){var l=i&&i.prototype instanceof s?i:s,c=Object.create(l.prototype);return er(c,"_invoke",function(r,i,n){var o,s,l,c=0,u=n||[],h=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,r){return o=t,s=0,l=e,d.n=r,a}};function p(r,i){for(s=r,l=i,t=0;!h&&c&&!n&&t<u.length;t++){var n,o=u[t],p=d.p,f=o[2];r>3?(n=f===i)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=p&&((n=r<2&&p<o[1])?(s=0,d.v=i,d.n=o[1]):p<f&&(n=r<3||o[0]>i||i>f)&&(o[4]=r,o[5]=i,d.n=f,s=0))}if(n||r>1)return a;throw h=!0,i}return function(n,u,f){if(c>1)throw TypeError("Generator is already running");for(h&&1===u&&p(u,f),s=u,l=f;(t=s<2?e:l)||!h;){o||(s?s<3?(s>1&&(d.n=-1),p(s,l)):d.n=l:d.v=l);try{if(c=2,o){if(s||(n="next"),t=o[n]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+n+"' method"),s=1);o=e}else if((t=(h=d.n<0)?l:r.call(i,d))!==a)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:h}}}(r,n,o),!0),c}var a={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][i]?t(t([][i]())):(er(t={},i,function(){return this}),t),h=c.prototype=s.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,er(e,n,"GeneratorFunction")),e.prototype=Object.create(h),e}return l.prototype=c,er(h,"constructor",c),er(c,"constructor",l),l.displayName="GeneratorFunction",er(c,n,"GeneratorFunction"),er(h),er(h,n,"Generator"),er(h,i,function(){return this}),er(h,"toString",function(){return"[object Generator]"}),(Qt=function(){return{w:o,m:d}})()}function er(e,t,r,i){var n=Object.defineProperty;try{n({},"",{})}catch(e){n=0}er=function(e,t,r,i){function o(t,r){er(e,t,function(e){return this._invoke(t,r,e)})}t?n?n(e,t,{value:r,enumerable:!i,configurable:!i,writable:!i}):e[t]=r:(o("next",0),o("throw",1),o("return",2))},er(e,t,r,i)}function tr(e,t,r,i,n,o,a){try{var s=e[o](a),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(i,n)}function rr(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var o=e.apply(t,r);function a(e){tr(o,i,n,a,s,"next",e)}function s(e){tr(o,i,n,a,s,"throw",e)}a(void 0)})}}function ir(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i,n,o,a,s=[],l=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t);else for(;!(l=(i=o.call(r)).done)&&(s.push(i.value),s.length!==t);l=!0);}catch(e){c=!0,n=e}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw n}}return s}}(e,t)||sr(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function nr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function or(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?nr(Object(r),!0).forEach(function(t){fr(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):nr(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function ar(e){return function(e){if(Array.isArray(e))return lr(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||sr(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function sr(e,t){if(e){if("string"==typeof e)return lr(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?lr(e,t):void 0}}function lr(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function cr(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,mr(i.key),i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ur(e,t,r){return t=dr(t),function(e,t){if(t&&("object"==Kt(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,hr()?Reflect.construct(t,[],dr(e).constructor):t.apply(e,r))}function hr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(hr=function(){return!!e})()}function dr(e){return dr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},dr(e)}function pr(e,t){return pr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},pr(e,t)}function fr(e,t,r){return(t=mr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function mr(e){var t=function(e,t){if("object"!=Kt(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=Kt(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Kt(t)?t:t+""}var gr=function(e){function t(e,r,i){var n,o,a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),fr(a=ur(this,t),"potentialParentPlaces",[]),fr(a,"innerFloors",[]),fr(a,"subPlaces",[]),fr(a,"currentFloor",""),fr(a,"baseFilters",{}),fr(a,"markers",[]),fr(a,"enableHover",!1),fr(a,"hoveredId","unselected"),fr(a,"failedTiles",new Set),fr(a,"geoLocation",navigator.geolocation),ae.includes(null!==(n=e.lang)&&void 0!==n?n:"")&&a.setRTLSupport(),a.repository=new Jt(i,null!==(o=e.lang)&&void 0!==o?o:"en"),a.token=i,a.parentPlaceId=e.parentPlaceId,a.routeController=new oe(a),a.userLocationMarker=void 0,a.watchPositionID=void 0,a.onFloorChange=e.onFloorChange,a.onParentPlaceChange=e.onParentPlaceChange,null!=e.parentPlaceId&&a.initialPlaceDetailSetUp(e.parentPlaceId,e.authToken),e.otherPotentialParentPlacesIds&&e.otherPotentialParentPlacesIds.length>0&&a.loadOtherPotentialParentPlaces(e.otherPotentialParentPlacesIds),a.enableHover=e.enableHover||!1,a.initialMapStyleSetUp(e,r),a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&pr(e,t)}(t,e),cr(t,[{key:"setRTLSupport",value:function(){var e=this;(0,w.setRTLTextPlugin)("https://unpkg.com/@mapbox/mapbox-gl-rtl-text@0.3.0/dist/mapbox-gl-rtl-text.js",!1).catch(function(t){e.logWarning(t,{functionName:"setRTLSupport"})})}},{key:"initialPlaceDetailSetUp",value:function(e,t){var r=this;t?this.repository.fetchAndParseAnyPlaceDetail(e,t).then(function(e){r.changeParentPlaceTo(e),r.potentialParentPlaces.push(e)}).catch(console.error):this.repository.fetchAndParsePlaceDetail(e).then(function(e){r.changeParentPlaceTo(e),r.potentialParentPlaces.push(e)}).catch(console.error)}},{key:"loadOtherPotentialParentPlaces",value:function(e){var t=this;Promise.all(e.map(function(e){return t.repository.fetchAndParsePlaceDetail(e)})).then(function(e){var r;(r=t.potentialParentPlaces).push.apply(r,ar(e))}).catch(console.error)}},{key:"subPlacesLoad",value:function(e){var t=this;this.repository.fetchAndParseSubPlaces(e).then(function(e){t.subPlaces=e}).catch(console.error)}},{key:"initialMapStyleSetUp",value:function(e,t){var r=this;e.institutionId&&e.authToken?this.repository.fetchAndParseAnyMapStyle(e.institutionId,e.authToken).then(function(i){return r.onMapStyleLoaded(e,t,i)}).catch(console.error):this.repository.fetchAndParseMapStyle(e.parentPlaceId).then(function(i){return r.onMapStyleLoaded(e,t,i)}).catch(console.error)}},{key:"onMapStyleLoaded",value:function(e,t,r){var i,n,o,a=this,s={container:t,style:r,center:e.center,zoom:e.zoom,pitch:null!==(i=e.pitch)&&void 0!==i?i:0,attributionControl:!1,maplibreLogo:!1,bearingSnap:null!==(n=e.bearingSnap)&&void 0!==n?n:0,cancelPendingTileRequestsWhileZooming:!1};if(e.maxZoom&&(s.maxZoom=e.maxZoom),e.minZoom&&(s.minZoom=e.minZoom),e.maxBounds&&e.maxBounds.length>1){var l=E(e.maxBounds);s.maxBounds=new w.LngLatBounds([l[0].lng,l[0].lat],[l[1].lng,l[1].lat])}return this.map=new w.Map(s),this.map.addControl(new w.NavigationControl({showCompass:void 0===e.showCompass||e.showCompass,showZoom:void 0===e.showZoom||e.showZoom}),null!==(o=e.navigationPosition)&&void 0!==o?o:"top-right"),this.map.on("load",function(){var t;a.whenStyleUpdates(r),e.lang&&a.setLayersForLanguage(e.lang),null===(t=e.onMapReady)||void 0===t||t.call(e),a.onHover(),a.subscribeToFailedTiles()}),this.map.on("zoomend",function(){var t;null===(t=e.onZoomEnd)||void 0===t||t.call(e,a.getZoomLevel())}),this.map.on("rotate",function(){var t;null===(t=e.onRotate)||void 0===t||t.call(e,a.map.getBearing())}),this.defaultClickListener(),this.map}},{key:"setBaseFilters",value:function(e){var t=this,r=["==",["get","public_place"],!0];e.layers.filter(function(e){return e.id.startsWith("indoor-")}).forEach(function(e){var i=t.baseFilters[e.id];if(null!=i){var n=["all",i,r];t.map.setFilter(e.id,n)}else t.map.setFilter(e.id,r);switch(e.type){case"line":case"symbol":case"fill-extrusion":case"fill":null!=e.filter&&(t.baseFilters[e.id]=e.filter)}})}},{key:"setLayersForLanguage",value:function(e){var t,r,i=this,n=["aerodrome_label","mountain_peak","park","place","poi","transportation_name","water_name","waterway"],o=null!==(t=null===(r=this.map.getStyle())||void 0===r?void 0:r.layers)&&void 0!==t?t:[];o.filter(function(e){var t;return"symbol"===e.type&&"openmaptiles"===e.source&&n.includes(null!==(t=e["source-layer"])&&void 0!==t?t:"")}).map(function(e){return e.id}).forEach(function(t){try{var r=i.map.getLayoutProperty(t,"symbol-placement");i.map.setLayoutProperty(t,"text-field",["case",["has","name:".concat(e)],["get","name:".concat(e)],["format",["get","name:latin"],"line"===r?" ":"\n",["get","name:nonlatin"]]])}catch(n){i.logWarning(n,{functionName:"setLayersForLanguage"})}}),o.filter(function(e){var t;return"symbol"===e.type&&"indoorequal"===e.source&&void 0!==(null===(t=e.layout)||void 0===t?void 0:t["text-field"])}).map(function(e){return e.id}).forEach(function(t){try{i.map.setLayoutProperty(t,"text-field",["case",["has","name:".concat(e)],["get","name:".concat(e)],["get","name"]])}catch(r){i.logWarning(r,{functionName:"setLayersForLanguage"})}})}},{key:"prepareSegmentation",value:function(e){var t;return or(or({},e),{},{token:this.token,parentPlaceId:null!==(t=this.parentPlaceId)&&void 0!==t?t:"None"})}},{key:"destroyMap",value:function(){this.map.remove(),this.unsubscribeFromFailedTiles()}},{key:"getCurrentFloor",value:function(){var e;return null!==(e=this.currentFloor)&&void 0!==e?e:""}},{key:"changeParentPlaceTo",value:function(e){var t,r,i,n,o,a,s=this,l=arguments.length>1&&void 0!==arguments[1]&&arguments[1],c=arguments.length>2?arguments[2]:void 0;this.parentPlace=e,this.parentPlaceId=null==e?void 0:e.lazarilloId,this.innerFloors=null!==(t=null==e||null===(r=e.innerFloors)||void 0===r?void 0:r.sort(function(e,t){return e.index-t.index}))&&void 0!==t?t:[],this.currentFloor=null!==(i=null!==(n=null===(o=this.innerFloors.find(function(e){return e.defaultFloor}))||void 0===o?void 0:o.key)&&void 0!==n?n:null===(a=this.innerFloors[0])||void 0===a?void 0:a.key)&&void 0!==i?i:"",e&&this.subPlacesLoad(e.lazarilloId),l&&this.repository.fetchAndParseMapStyle(null==e?void 0:e.lazarilloId).then(function(e){s.map.setStyle(e),s.whenStyleUpdates(e),null==c||c()}).catch(console.error)}},{key:"updatePlaceAndFloor",value:function(e,t){var r,i,n,o,a,s=this.potentialParentPlaces.find(function(t){return t.lazarilloId===e});this.parentPlace=s,this.parentPlaceId=null==s?void 0:s.lazarilloId,this.innerFloors=null!==(r=null==s?void 0:s.innerFloors.sort(function(e,t){return e.index-t.index}))&&void 0!==r?r:[],this.currentFloor=null!==(i=null!==(n=null!=t?t:null===(o=this.innerFloors.find(function(e){return e.defaultFloor}))||void 0===o?void 0:o.key)&&void 0!==n?n:null===(a=this.innerFloors[0])||void 0===a?void 0:a.key)&&void 0!==i?i:""}},{key:"updateParentPlaceAndFloor",value:function(e,t){try{var r,i,n;this.updatePlaceAndFloor(e,t),this.filterByFloorKey(this.currentFloor),null===(r=this.onParentPlaceChange)||void 0===r||r.call(this,e),null===(i=this.onFloorChange)||void 0===i||i.call(this,null!==(n=this.currentFloor)&&void 0!==n?n:""),this.logEvent("updateParentPlaceAndFloor")}catch(o){this.logWarning(o,{functionName:"updateParentPlaceAndFloor"})}}},{key:"setLang",value:function(e){this.repository.setLang(e)}},{key:"setParentPlace",value:function(e,t,r){this.changeParentPlaceTo(e,t,r)}},{key:"removeParentPlace",value:function(){this.changeParentPlaceTo(void 0,!0)}},{key:"whenStyleUpdates",value:function(e){this.setBaseFilters(e),this.routeController.addSourcesAndLayers(),this.filterByFloorKey(this.currentFloor)}},{key:"addMarker",value:function(e){var t=this;try{var r,i;if(e.id){var n=this.markers.findIndex(function(t){return t.id===e.id});-1!==n&&(this.markers[n].remove(),this.markers.splice(n,1),this.logEvent("removeMarker",{markerId:e.id,reason:"duplicate"}))}var o=new z(e),a=!this.parentPlace||null!==(r=null===(i=this.innerFloors.find(function(e){return e.key===t.currentFloor}))||void 0===i?void 0:i.reachableFromGPS)&&void 0!==r&&r;return o.changeFloor(this.currentFloor,this.map,a),this.markers.push(o),this.logEvent("addMarker"),o.id}catch(s){throw this.logWarning(s,{functionName:"addMarker"}),new Error("Failed to add marker")}}},{key:"updateMarker",value:function(e){try{var t,r=this.markers.find(function(t){return t.id===e.id});return void 0!==r&&r.updateIcon(e),this.logEvent("updateMarker"),null!==(t=null==r?void 0:r.id)&&void 0!==t?t:""}catch(i){throw this.logWarning(i,{functionName:"updateMarker"}),new Error("Failed to update marker")}}},{key:"updateMarkerPosition",value:function(e,t){try{var r=this.markers.find(function(t){return t.id===e});void 0!==r&&r.setLngLat(t),this.logEvent("updateMarkerPosition")}catch(i){throw this.logWarning(i,{functionName:"updateMarkerPosition"}),new Error("Failed to update marker position")}}},{key:"showMarker",value:function(e){try{var t=this.markers.find(function(t){return t.id===e});null!==t&&this.map&&(null==t||t.show(this.map)),this.logEvent("showMarker")}catch(r){this.logWarning(r,{functionName:"showMarker"})}}},{key:"hideMarker",value:function(e){try{var t=this.markers.find(function(t){return t.id===e});null!==t&&(null==t||t.hide()),this.logEvent("hideMarker")}catch(r){this.logWarning(r,{functionName:"hideMarker"})}}},{key:"removeMarker",value:function(e){try{var t=this.markers.find(function(t){return t.id===e});null!==t&&(null==t||t.remove(),this.markers=this.markers.filter(function(t){return t.id!==e})),this.logEvent("removeMarker")}catch(r){throw this.logWarning(r,{functionName:"removeMarker"}),new Error("Failed to remove marker")}}},{key:"removeAllMarkers",value:function(){try{this.markers.forEach(function(e){e.remove()}),this.markers=[],this.logEvent("removeAllMarkers")}catch(e){throw this.logWarning(e,{functionName:"removeAllMarkers"}),new Error("Failed to remove all markers")}}},{key:"filterByFloorKey",value:function(e){this.currentFloor=e;var t=null!=e?e:"";this.innerFloors.every(function(t){return t.key!==e})&&""!==e&&this.logEvent("invalidFloorKey",{floorKey:t}),this.updateFiltersTo(t),this.updateMarkersTo(t),this.routeController.updateRouteLayers(t),this.routeController.updateRouteMarkerVisibility(t)}},{key:"getContainer",value:function(){return this.map.getContainer()}},{key:"updateMarkersTo",value:function(e){var t,r,i=this,n=!this.parentPlace||null!==(t=null===(r=this.innerFloors.find(function(t){return t.key===e}))||void 0===r?void 0:r.reachableFromGPS)&&void 0!==t&&t;this.markers.forEach(function(t){t.changeFloor(e,i.map,n)})}},{key:"updateFiltersTo",value:function(e){var t,r,i,n=this;if(this.map){var o=null!==(t=null===(r=this.map.getStyle())||void 0===r?void 0:r.layers)&&void 0!==t?t:[];o.filter(function(e){return e.id.startsWith("base-indoor-")}).forEach(function(e){n.map.removeLayer(e.id)});var a=null===(i=this.innerFloors.find(function(t){return t.key===e}))||void 0===i?void 0:i.baseFloor,s=o.filter(function(e){return e.id.startsWith("indoor-")});if(null!=a){var l,c=null===(l=s[0])||void 0===l?void 0:l.id;s.filter(function(e){return"fill-extrusion"!==e.type}).forEach(function(e){var t=structuredClone(e);t.id="base-"+e.id,n.baseFilters[t.id]=n.baseFilters[e.id],n.map.addLayer(t,c),n.applyLayerFilters(t,a)})}s.forEach(function(t){n.applyLayerFilters(t,e)})}}},{key:"applyLayerFilters",value:function(e,t){var r,i=this.baseFilters[e.id],n=null!=t?t:"",o=["any",["==",["get","floor_key"],n]],a=["==",["get","public_place"],!0],s=["!=",["get","is_subplace"],null!==(r=this.parentPlaceId)&&void 0!==r?r:""],l=["==",["get","show_in_floor"],n],c=a;null!=this.parentPlaceId&&(c=["any",o,a]);var u=["all",c,["any",s,l]];if(e.id.includes("hover")?i=["==",["get","ref"],this.hoveredId]:e.id.includes("colored")||"fill"!=e.type&&"fill-extrusion"!==e.type||u.push(["!=",["get","ref"],this.hoveredId]),null!=i){var h=["all",i,u];this.map.setFilter(e.id,h)}else this.map.setFilter(e.id,u)}},{key:"getInnerFloors",value:function(){return this.innerFloors}},{key:"updateCamera",value:function(e,t){this.map.once("moveend",t),this.map.easeTo(or({},e))}},{key:"setMaxZoom",value:function(e){this.map.setMaxZoom(e)}},{key:"setMinZoom",value:function(e){this.map.setMinZoom(e)}},{key:"isInsideBounds",value:function(e){var t=this.map.getMaxBounds();return null==t||t.contains(e)}},{key:"setMaxBounds",value:function(e){if(e.length>1){var t=E(e);this.map.setMaxBounds(new w.LngLatBounds([t[0].lng,t[0].lat],[t[1].lng,t[1].lat]))}}},{key:"fitCoordinates",value:function(e,t){if(1===e.length){var r=ir(e,1)[0];this.map.setCenter({lat:r.lat,lng:r.lng})}else if(e.length>1){var i,n,o,a,s,l=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=sr(e))||t){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}(e);try{for(l.s();!(s=l.n()).done;){var c=s.value,u=c.lat,h=c.lng;i=void 0===i?u:Math.min(i,u),n=void 0===n?h:Math.min(n,h),o=void 0===o?u:Math.max(o,u),a=void 0===a?h:Math.max(a,h)}}catch(m){l.e(m)}finally{l.f()}var d=[null!=n?n:0,null!=i?i:0,null!=a?a:0,null!=o?o:0];if(t){var p=this.map.getBearing(),f=this.map.getPitch();t.bearing=void 0!==t.bearing?t.bearing:p,t.pitch=void 0!==t.pitch?t.pitch:f}this.map.fitBounds(d,t)}}},{key:"getZoomLevel",value:function(){return this.map.getZoom()}},{key:"updateFloor",value:function(e){try{var t;this.filterByFloorKey(e),null===(t=this.onFloorChange)||void 0===t||t.call(this,e),this.logEvent("updateFloor",{floorId:e})}catch(r){this.logWarning(r,{functionName:"updateFloor",floorId:e})}}},{key:"updatePlaceAndFloorForRouting",value:function(e,t){try{var r;this.updatePlaceAndFloor(e,t),this.updateFiltersTo(t),this.updateMarkersTo(t),null===(r=this.onFloorChange)||void 0===r||r.call(this,t),this.logEvent("updatePlaceAndFloorForRouting",{floorId:t})}catch(i){this.logWarning(i,{functionName:"updatePlaceAndFloorForRouting",floorId:t})}}},{key:"addRoute",value:(a=rr(Qt().m(function e(t){var r,i,n,o,a,s=arguments;return Qt().w(function(e){for(;;)switch(e.p=e.n){case 0:return r=s.length>1&&void 0!==s[1]?s[1]:{},e.p=1,this.logEvent("addRoute"),i=new de(t),n=new pe(r),e.n=2,this.repository.fetchAndParseRoute(i);case 2:return o=e.v,this.routeController.addRoute(o,n),e.a(2,o);case 3:throw e.p=3,a=e.v,this.logWarning(a,{functionName:"addRoute"}),new Error("Error: Failed to add route");case 4:return e.a(2)}},e,this,[[1,3]])})),function(e){return a.apply(this,arguments)})},{key:"removeRoute",value:function(){try{this.logEvent("removeRoute"),this.routeController.removeRoute()}catch(e){this.logWarning(e,{functionName:"removeRoute"})}}},{key:"addPopOver",value:function(e){var t=e.placeId;if(void 0!==t){var r=this.subPlaces.find(function(e){return e.clientId===t||e.lazarilloId===t});void 0!==r&&(new(T().Popup)).setLngLat(r.position).setHTML(r.title).addTo(this.map)}return""}},{key:"removePopOver",value:function(e){throw Error("Not implemented")}},{key:"startClickListener",value:function(e){this.clickCallback=e}},{key:"stopClickListener",value:function(){this.clickCallback=void 0}},{key:"defaultClickListener",value:function(){var e=this;this.map.on("click",function(t){var r,i,n=e.map.queryRenderedFeatures(t.point).find(function(e){return"room"===e.properties.class}),o=e.subPlaces.find(function(e){return e.lazarilloId===(null==n?void 0:n.properties.ref)}),a=null!==(r=null!==(i=null==o?void 0:o.lazarilloId)&&void 0!==i?i:null==o?void 0:o.clientId)&&void 0!==r?r:"";void 0!==o&&e.clickCallback&&e.clickCallback(a)})}},{key:"onHover",value:function(){var e=this;this.enableHover&&(this.map.on("mousemove","hoverable",function(t){var r,i=null===(r=t.features)||void 0===r?void 0:r.find(function(t){var r,i;return(null===(r=t.properties.ref)||void 0===r?void 0:r.length)>0&&(null===(i=t.properties)||void 0===i?void 0:i.floor_key)===e.currentFloor}),n=null==i?void 0:i.properties.ref;void 0!==n&&n.length>0?(e.hoveredId=n,e.updateFiltersTo(e.currentFloor)):void 0===n&&"unselected"!==e.hoveredId&&(e.hoveredId="unselected",e.updateFiltersTo(e.currentFloor))}),this.map.on("mouseleave","hoverable",function(){e.hoveredId="unselected",e.updateFiltersTo(e.currentFloor)}))}},{key:"setPlacesAsSelected",value:function(e,t){try{this.hasLayer("indoor-colored-places")||(this.logWarning(new Error("Layer indoor-colored-places does not exist on current style")),this.createColoredPlacesLayer());var r=this.createBasicFilters(),i=e.map(function(e){return["==",["get","ref"],e]}),n=["any"].concat(ar(i)),o=["all",n,r];if(this.map.setFilter("indoor-colored-places",o),this.baseFilters["indoor-colored-places"]=n,void 0!==t){var a=this.map.getLayer("indoor-colored-places");switch(null==a?void 0:a.type){case"fill":this.map.setPaintProperty("indoor-colored-places","fill-color",t);break;case"fill-extrusion":this.map.setPaintProperty("indoor-colored-places","fill-extrusion-color",t)}}}catch(s){this.logWarning(s,{functionName:"setPlacesAsSelected"})}}},{key:"is3DStyle",value:function(){return this.map.getStyle().layers.some(function(e){return"fill-extrusion"===e.type})}},{key:"createColoredPlacesLayer",value:function(){this.is3DStyle()?this.map.addLayer({id:"indoor-colored-places",type:"fill-extrusion",source:"indoorequal","source-layer":"area",filter:["all",["has","ref"],["==",["get","ref"],"unselected"]],paint:{"fill-extrusion-height":2.5,"fill-extrusion-color":"#276EF1","fill-extrusion-opacity":.8}}):this.map.addLayer({id:"indoor-colored-places",type:"fill",source:"indoorequal","source-layer":"area",filter:["all",["has","ref"],["==",["get","ref"],"unselected"]],paint:{"fill-color":"#276EF1"}})}},{key:"createBasicFilters",value:function(){var e,t,r=["==",["get","public_place"],!0],i=["!=",["get","is_subplace"],null!==(e=this.parentPlaceId)&&void 0!==e?e:""],n=null!==(t=this.currentFloor)&&void 0!==t?t:"+",o=["==",["get","floor_key"],n],a=["==",["get","show_in_floor"],n],s=r;return null!=this.parentPlaceId&&(s=["any",o,r]),["all",s,["any",i,a]]}},{key:"hasLayer",value:function(e){return void 0!==this.map.getLayer(e)}},{key:"clearColoredPlaces",value:function(){if(this.hasLayer("indoor-colored-places")){var e=["==",["get","ref"],"unselected"];this.baseFilters["indoor-colored-places"]=e,this.map.setFilter("indoor-colored-places",e)}}},{key:"startAnimateRoute",value:(o=rr(Qt().m(function e(t){var r,i,n,o,a,s,l,c=arguments;return Qt().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r=c.length>1&&void 0!==c[1]?c[1]:{},i=c.length>2&&void 0!==c[2]?c[2]:{},e.p=1,!(t instanceof We)){e.n=2;break}n=t,e.n=4;break;case 2:return o=new de(t),e.n=3,this.repository.fetchAndParseRoute(o);case 3:n=e.v;case 4:return a=new ve(r),s=new ye(i),this.routeController.startAnimating(n,a,s),e.a(2,n);case 5:throw e.p=5,l=e.v,this.logWarning(l,{functionName:"startAnimateRoute"}),new Error("Error: Failed to start animating route");case 6:return e.a(2)}},e,this,[[1,5]])})),function(e){return o.apply(this,arguments)})},{key:"startAnimateRouteV2",value:(n=rr(Qt().m(function e(t){var r,i,n,o,a,s,l,c=arguments;return Qt().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r=c.length>1&&void 0!==c[1]?c[1]:{},i=c.length>2&&void 0!==c[2]?c[2]:{},e.p=1,!(t instanceof We)){e.n=2;break}n=t,e.n=4;break;case 2:return o=new de(t),e.n=3,this.repository.fetchAndParseRouteV2(o);case 3:n=e.v;case 4:return a=new ve(r),s=new ye(i),this.routeController.startAnimating(n,a,s),e.a(2,n);case 5:throw e.p=5,l=e.v,this.logWarning(l,{functionName:"startAnimateRouteV2"}),new Error("Error: Failed to start animating route");case 6:return e.a(2)}},e,this,[[1,5]])})),function(e){return n.apply(this,arguments)})},{key:"pauseAnimateRoute",value:function(){try{this.routeController.pauseAnimation(),this.logEvent("pauseAnimateRoute")}catch(e){this.logWarning(e,{functionName:"pauseAnimateRoute"})}}},{key:"resumeAnimateRoute",value:function(){try{this.routeController.resumeAnimation(),this.logEvent("resumeAnimateRoute")}catch(e){this.logWarning(e,{functionName:"resumeAnimateRoute"})}}},{key:"restartAnimateRoute",value:function(){try{this.routeController.restartAnimation(),this.logEvent("restartAnimateRoute")}catch(e){this.logWarning(e,{functionName:"restartAnimateRoute"})}}},{key:"stopAnimateRoute",value:function(){this.logWarning(new Error("Not implemented"),{functionName:"stopAnimateRoute"})}},{key:"addStepAnimation",value:(i=rr(Qt().m(function e(t){var r,i,n,o,a,s,l,c=arguments;return Qt().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r=c.length>1&&void 0!==c[1]?c[1]:{},i=c.length>2&&void 0!==c[2]?c[2]:{},e.p=1,!(t instanceof We)){e.n=2;break}n=t,e.n=4;break;case 2:return o=new de(t),e.n=3,this.repository.fetchAndParseRoute(o);case 3:n=e.v;case 4:return a=new ve(r),s=new ye(i),this.routeController.addStepAnimation(n,a,s),this.logEvent("addStepAnimation"),e.a(2,n);case 5:throw e.p=5,l=e.v,this.logWarning(l,{functionName:"addStepAnimation"}),new Error("Error: Failed to add step animation");case 6:return e.a(2)}},e,this,[[1,5]])})),function(e){return i.apply(this,arguments)})},{key:"addStepAnimationV2",value:(r=rr(Qt().m(function e(t){var r,i,n,o,a,s,l,c=arguments;return Qt().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r=c.length>1&&void 0!==c[1]?c[1]:{},i=c.length>2&&void 0!==c[2]?c[2]:{},e.p=1,!(t instanceof We)){e.n=2;break}n=t,e.n=4;break;case 2:return o=new de(t),e.n=3,this.repository.fetchAndParseRouteV2(o);case 3:n=e.v;case 4:return a=new ve(r),s=new ye(i),this.routeController.addStepAnimation(n,a,s),this.logEvent("addStepAnimationV2"),e.a(2,n);case 5:throw e.p=5,l=e.v,this.logWarning(l,{functionName:"addStepAnimationV2"}),new Error("Error: Failed to add step animation");case 6:return e.a(2)}},e,this,[[1,5]])})),function(e){return r.apply(this,arguments)})},{key:"nextStepAnimation",value:function(){try{this.routeController.nextStepAnimation(),this.logEvent("nextStepAnimation")}catch(e){throw this.logWarning(e,{functionName:"nextStepAnimation"}),new Error("Error: Failed to animate step")}}},{key:"previousStepAnimation",value:function(){try{this.routeController.previousStepAnimation(),this.logEvent("previousStepAnimation")}catch(t){this.logWarning(t,{functionName:"previousStepAnimation"});var e=t instanceof Error?t.message:String(t);throw new Error("Error: Failed to prepare to animate previous step, "+e)}}},{key:"centerOnCurrentStepAnimation",value:function(){try{this.routeController.centerOnCurrentStep(),this.logEvent("centerOnCurrentStepAnimation")}catch(t){this.logWarning(t,{functionName:"centerOnCurrentStepAnimation"});var e=t instanceof Error?t.message:String(t);throw new Error("Error: Failed to center on current step animation, "+e)}}},{key:"addUserLocationTracking",value:function(e,t){var r=new Image(40,40);r.src=S;var i=new z({coordinate:{lat:0,lng:0},icon:r,text:""});i.addToMap(this.map),this.userLocationMarker=i,this.geoLocation=null!=t?t:navigator.geolocation,this.watchPositionID=this.geoLocation.watchPosition(function(e){i.setLngLat([e.coords.longitude,e.coords.latitude])},function(e){console.error("Error getting user location:",e)},{enableHighAccuracy:e})}},{key:"removeUserLocationTracking",value:function(){void 0!==this.userLocationMarker?(this.userLocationMarker.remove(),this.userLocationMarker=void 0,this.watchPositionID&&(this.geoLocation.clearWatch(this.watchPositionID),this.watchPositionID=void 0)):console.error("Error trying to remove location tracking, is already gone")}},{key:"getBearing",value:function(){return this.map.getBearing()}},{key:"addBorderToPlaces",value:function(e,t,r){try{this.hasLayer("indoor-bordered-places")||(this.logWarning(new Error("Layer indoor-bordered-places does not exist on current style")),this.createBorderedPlacesLayer());var i=this.createBasicFilters(),n=e.map(function(e){return["==",["get","ref"],e]}),o=["any"].concat(ar(n)),a=["all",o,i];this.map.setFilter("indoor-bordered-places",a),this.baseFilters["indoor-bordered-places"]=o,void 0!==t&&void 0!==r&&(this.map.setPaintProperty("indoor-bordered-places","line-color",t),this.map.setPaintProperty("indoor-bordered-places","line-width",r))}catch(s){throw this.logWarning(s,{functionName:"addBorderToPlaces"}),new Error("Failed to add border to places")}}},{key:"createBorderedPlacesLayer",value:function(){this.map.addLayer({id:"indoor-bordered-places",type:"line",source:"indoorequal","source-layer":"area",filter:["all",["has","ref"],["==",["get","ref"],"unselected"]],paint:{"line-color":"#276EF1","line-width":4}})}},{key:"clearBorderedPlaces",value:function(){if(this.hasLayer("indoor-bordered-places")){var e=["==",["get","ref"],"unselected"];this.baseFilters["indoor-bordered-places"]=e,this.map.setFilter("indoor-bordered-places",e)}}},{key:"onWebGLContextLost",value:function(e){var t=this;e.originalEvent.preventDefault(),console.warn("Contexto WebGL perdido 😢");var r=this.map.getCanvas(),i=r.getContext("webgl")||r.getContext("webgl2");if(i&&i.isContextLost()){var n;r.addEventListener("webglcontextrestored",function(){console.debug("Contexto WebGL restaurado, forzando re-render"),t.map.triggerRepaint(),t.failedTiles.clear()},{once:!0});var o=i.getExtension("WEBGL_lose_context");null==o||null===(n=o.restoreContext)||void 0===n||n.call(o)}}},{key:"onWebGLContextRestored",value:function(){console.debug("Evento webglcontextrestored recibido, haciendo map.redraw()"),this.map.redraw(),this.failedTiles.clear()}},{key:"onSourceData",value:function(e){if("vector"===e.source.type&&"indoorequal"===e.sourceId&&e.tile&&!e.isSourceLoaded){var t,r=null===(t=e.tile)||void 0===t?void 0:t.state;"errored"!==r&&"expired"!==r||this.failedTiles.add(e.tile)}}},{key:"onSourceDataAbort",value:function(e){"vector"===e.source.type&&"indoorequal"===e.sourceId&&e.tile&&this.failedTiles.delete(e.tile)}},{key:"subscribeToFailedTiles",value:function(){var e=this;this.retryTimer||(this.boundOnSourceData=this.onSourceData.bind(this),this.boundOnSourceDataAbort=this.onSourceDataAbort.bind(this),this.boundOnWebGLContextLost=this.onWebGLContextLost.bind(this),this.boundOnWebGLContextRestored=this.onWebGLContextRestored.bind(this),this.retryTimer=setInterval(function(){if(e.map.getSource("indoorequal")){var t=e.map.getSource("indoorequal");if(t&&"vector"===t.type){var r=[],i=[];e.failedTiles.forEach(function(e){!e||"unloaded"===e.state||"loading"===e.state||"errored"!==e.state&&"expired"!==e.state?i.push(e):r.push(e)}),i.forEach(function(t){return e.failedTiles.delete(t)}),r.forEach(function(r){try{!r||"errored"!==r.state&&"expired"!==r.state||t.loadTile(r)}catch(i){e.failedTiles.delete(r),e.logWarning(i,{functionName:"subscribeToFailedTiles",tileState:null==r?void 0:r.state})}})}else e.failedTiles.clear()}else e.failedTiles.clear()},1e3),this.map.on("sourcedata",this.boundOnSourceData),this.map.on("sourcedataabort",this.boundOnSourceDataAbort),this.map.on("webglcontextlost",this.boundOnWebGLContextLost),this.map.on("webglcontextrestored",this.boundOnWebGLContextRestored))}},{key:"unsubscribeFromFailedTiles",value:function(){this.retryTimer&&(clearInterval(this.retryTimer),this.retryTimer=void 0),this.boundOnSourceData&&(this.map.off("sourcedata",this.boundOnSourceData),this.boundOnSourceData=void 0),this.boundOnSourceDataAbort&&(this.map.off("sourcedataabort",this.boundOnSourceDataAbort),this.boundOnSourceDataAbort=void 0),this.boundOnWebGLContextLost&&(this.map.off("webglcontextlost",this.boundOnWebGLContextLost),this.boundOnWebGLContextLost=void 0),this.boundOnWebGLContextRestored&&(this.map.off("webglcontextrestored",this.boundOnWebGLContextRestored),this.boundOnWebGLContextRestored=void 0),this.failedTiles.clear()}}]);var r,i,n,o,a}(Fe);function _r(e){return void 0!==e.logo}function yr(e){return void 0!==e.icon}function vr(e){return vr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vr(e)}function br(e){return function(e){if(Array.isArray(e))return xr(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return xr(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?xr(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function xr(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function wr(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",n=r.toStringTag||"@@toStringTag";function o(r,i,n,o){var l=i&&i.prototype instanceof s?i:s,c=Object.create(l.prototype);return Tr(c,"_invoke",function(r,i,n){var o,s,l,c=0,u=n||[],h=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,r){return o=t,s=0,l=e,d.n=r,a}};function p(r,i){for(s=r,l=i,t=0;!h&&c&&!n&&t<u.length;t++){var n,o=u[t],p=d.p,f=o[2];r>3?(n=f===i)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=p&&((n=r<2&&p<o[1])?(s=0,d.v=i,d.n=o[1]):p<f&&(n=r<3||o[0]>i||i>f)&&(o[4]=r,o[5]=i,d.n=f,s=0))}if(n||r>1)return a;throw h=!0,i}return function(n,u,f){if(c>1)throw TypeError("Generator is already running");for(h&&1===u&&p(u,f),s=u,l=f;(t=s<2?e:l)||!h;){o||(s?s<3?(s>1&&(d.n=-1),p(s,l)):d.n=l:d.v=l);try{if(c=2,o){if(s||(n="next"),t=o[n]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+n+"' method"),s=1);o=e}else if((t=(h=d.n<0)?l:r.call(i,d))!==a)break}catch(t){o=e,s=1,l=t}finally{c=1}}return{value:t,done:h}}}(r,n,o),!0),c}var a={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][i]?t(t([][i]())):(Tr(t={},i,function(){return this}),t),h=c.prototype=s.prototype=Object.create(u);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,Tr(e,n,"GeneratorFunction")),e.prototype=Object.create(h),e}return l.prototype=c,Tr(h,"constructor",c),Tr(c,"constructor",l),l.displayName="GeneratorFunction",Tr(c,n,"GeneratorFunction"),Tr(h),Tr(h,n,"Generator"),Tr(h,i,function(){return this}),Tr(h,"toString",function(){return"[object Generator]"}),(wr=function(){return{w:o,m:d}})()}function Tr(e,t,r,i){var n=Object.defineProperty;try{n({},"",{})}catch(e){n=0}Tr=function(e,t,r,i){function o(t,r){Tr(e,t,function(e){return this._invoke(t,r,e)})}t?n?n(e,t,{value:r,enumerable:!i,configurable:!i,writable:!i}):e[t]=r:(o("next",0),o("throw",1),o("return",2))},Tr(e,t,r,i)}function Sr(e,t,r,i,n,o,a){try{var s=e[o](a),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(i,n)}function Er(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var o=e.apply(t,r);function a(e){Sr(o,i,n,a,s,"next",e)}function s(e){Sr(o,i,n,a,s,"throw",e)}a(void 0)})}}function Ir(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,Lr(i.key),i)}}function Pr(e,t,r){return t=Ar(t),function(e,t){if(t&&("object"==vr(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,kr()?Reflect.construct(t,[],Ar(e).constructor):t.apply(e,r))}function kr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(kr=function(){return!!e})()}function Ar(e){return Ar=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ar(e)}function Cr(e,t){return Cr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Cr(e,t)}function Mr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function Dr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Mr(Object(r),!0).forEach(function(t){Rr(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Mr(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Rr(e,t,r){return(t=Lr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Lr(e){var t=function(e,t){if("object"!=vr(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=vr(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==vr(t)?t:t+""}function Fr(e,t){var r=Dr(Dr({},{lang:"en"}),t);return new Or(e,r)}var Or=function(e){function t(e,r){var i;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),Rr(i=Pr(this,t),"geoLocation",navigator.geolocation),Rr(i,"headingListeners",[]),i.token=e,i.config=r,i.repository=new Jt(e,i.config.lang),i.cachePlaces(),i.logEvent("initSDK"),i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Cr(e,t)}(t,e),function(e,t,r){return t&&Ir(e.prototype,t),r&&Ir(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"cachePlaces",value:function(){var e=this;this.repository.fetchAndParseAvailablePlaces().catch(function(t){e.logWarning(t)})}},{key:"setSdkLang",value:function(e){this.config.lang=e,this.repository.setLang(e)}},{key:"getPlaceDetail",value:(v=Er(wr().m(function e(t){var r,i;return wr().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.repository.fetchAndParsePlaceDetail(t);case 1:return r=e.v,this.logEvent("getPlaceDetail",{id:t}),e.a(2,r);case 2:throw e.p=2,i=e.v,this.logWarning(i,{functionName:"getPlaceDetail",id:t}),Error("Error getPlaceDetail");case 3:return e.a(2)}},e,this,[[0,2]])})),function(e){return v.apply(this,arguments)})},{key:"getAnyPlaceDetail",value:(y=Er(wr().m(function e(t,r){var i,n;return wr().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.repository.fetchAndParseAnyPlaceDetail(t,r);case 1:return i=e.v,this.logEvent("getAnyPlaceDetail",{id:t}),e.a(2,i);case 2:throw e.p=2,n=e.v,this.logWarning(n,{functionName:"getAnyPlaceDetail",id:t}),Error("Error getAnyPlaceDetail");case 3:return e.a(2)}},e,this,[[0,2]])})),function(e,t){return y.apply(this,arguments)})},{key:"prepareSegmentation",value:function(e){return Dr(Dr({},e),{},{token:this.token})}},{key:"createMap",value:function(e,t){try{t.lang=this.config.lang;var r=new gr(t,e,this.token);return this.logEvent("createMap"),r}catch(i){throw this.logWarning(i,{functionName:"createMap"}),new Error("Failed to create map")}}},{key:"getConfiguration",value:(_=Er(wr().m(function e(t,r){var i,n;return wr().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.repository.fetchAndParseConfiguration(t,r);case 1:return i=e.v,this.logEvent("configuration"),e.a(2,i);case 2:throw e.p=2,n=e.v,this.logWarning(n,{functionName:"getConfiguration"}),new Error("Failed to get configuration");case 3:return e.a(2)}},e,this,[[0,2]])})),function(e,t){return _.apply(this,arguments)})},{key:"getCategories",value:(g=Er(wr().m(function e(t){var r,i;return wr().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.repository.fetchAndParseCategories(t);case 1:return r=e.v,this.logEvent("categories"),e.a(2,r);case 2:throw e.p=2,i=e.v,this.logWarning(i,{functionName:"getCategories"}),new Error("Failed to get categories");case 3:return e.a(2)}},e,this,[[0,2]])})),function(e){return g.apply(this,arguments)})},{key:"getTransport",value:(m=Er(wr().m(function e(t){var r;return wr().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.repository.fetchAndParseTransport(t);case 1:return r=e.v,e.a(2,r);case 2:throw e.p=2,e.v,Error("Failed to get transport");case 3:return e.a(2)}},e,this,[[0,2]])})),function(e){return m.apply(this,arguments)})},{key:"getCachedPlaces",value:function(e){try{var t=this.repository.getCachedPlaces(e);return this.logEvent("getCachedPlaces"),t}catch(r){throw this.logWarning(r,{functionName:"getCachedPlaces"}),Error("Failed to get cached places")}}},{key:"getAvailablePlaces",value:(f=Er(wr().m(function e(){var t,r;return wr().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.repository.fetchAndParseAvailablePlaces();case 1:return t=e.v,this.logEvent("getAvailablePlaces"),e.a(2,t);case 2:throw e.p=2,r=e.v,this.logWarning(r,{functionName:"getAvailablePlaces"}),Error("Failed to get available places");case 3:return e.a(2)}},e,this,[[0,2]])})),function(){return f.apply(this,arguments)})},{key:"getSubPlaces",value:(p=Er(wr().m(function e(t){var r,i;return wr().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.repository.fetchAndParseSubPlaces(t);case 1:return r=e.v,this.logEvent("getSubPlaces"),e.a(2,r);case 2:throw e.p=2,i=e.v,this.logWarning(i,{functionName:"getSubPlaces"}),Error("Failed to get subplaces");case 3:return e.a(2)}},e,this,[[0,2]])})),function(e){return p.apply(this,arguments)})},{key:"getPlacesFromInstitution",value:(d=Er(wr().m(function e(t,r){var i,n;return wr().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.repository.fetchAndParsePlacesFromInstitution(t,r);case 1:return i=e.v,this.logEvent("getPlacesFromInstitution"),e.a(2,i);case 2:throw e.p=2,n=e.v,this.logWarning(n,{functionName:"getPlacesFromInstitution"}),Error("Failed to get places from institution");case 3:return e.a(2)}},e,this,[[0,2]])})),function(e,t){return d.apply(this,arguments)})},{key:"getAnySubPlaces",value:(h=Er(wr().m(function e(t,r){var i,n;return wr().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.repository.fetchAndParseAnySubPlaces(t,r);case 1:return i=e.v,this.logEvent("getAnySubPlaces"),e.a(2,i);case 2:throw e.p=2,n=e.v,this.logWarning(n,{functionName:"getAnySubPlaces"}),Error("Failed to get any sub-places");case 3:return e.a(2)}},e,this,[[0,2]])})),function(e,t){return h.apply(this,arguments)})},{key:"getInstitutions",value:(u=Er(wr().m(function e(){var t,r;return wr().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.repository.fetchAndParseInstitutions();case 1:return t=e.v,this.logEvent("getInstitutions"),e.a(2,t);case 2:throw e.p=2,r=e.v,this.logWarning(r,{functionName:"getInstitution"}),Error("Error getInstitution");case 3:return e.a(2)}},e,this,[[0,2]])})),function(){return u.apply(this,arguments)})},{key:"getRoute",value:(c=Er(wr().m(function e(t){var r,i,n;return wr().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,r=new de(t),e.n=1,this.repository.fetchAndParseRoute(r);case 1:return i=e.v,this.logEvent("getRoute"),e.a(2,i);case 2:throw e.p=2,n=e.v,this.logWarning(n,{functionName:"getRoute"}),new Error("Failed to get route");case 3:return e.a(2)}},e,this,[[0,2]])})),function(e){return c.apply(this,arguments)})},{key:"getRouteV2",value:(l=Er(wr().m(function e(t){var r,i,n;return wr().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,r=new de(t),e.n=1,this.repository.fetchAndParseRouteV2(r);case 1:return i=e.v,this.logEvent("getRouteV2"),e.a(2,i);case 2:throw e.p=2,n=e.v,this.logWarning(n,{functionName:"getRouteV2"}),new Error("Failed to get route");case 3:return e.a(2)}},e,this,[[0,2]])})),function(e){return l.apply(this,arguments)})},{key:"getPlacesByInput",value:(s=Er(wr().m(function e(t,r,i,n){var o,a,s;return wr().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,o=i?n?[i].concat(br(n)):[i]:n,e.n=1,this.repository.fetchAndParseSearchResults(r,t,o);case 1:return a=e.v,this.logEvent("getPlacesByInput"),e.a(2,a);case 2:throw e.p=2,s=e.v,this.logWarning(s,{functionName:"getPlacesByInput"}),new Error("Failed to get places by input");case 3:return e.a(2)}},e,this,[[0,2]])})),function(e,t,r,i){return s.apply(this,arguments)})},{key:"getPlacesByCategory",value:(a=Er(wr().m(function e(t){var r;return wr().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,this.logEvent("getPlacesByCategory"),e.a(2,[]);case 1:throw e.p=1,r=e.v,this.logWarning(r,{functionName:"getPlacesByCategory"}),new Error("Failed to get places by category");case 2:return e.a(2)}},e,this,[[0,1]])})),function(e){return a.apply(this,arguments)})},{key:"setGeoLocation",value:function(e){this.geoLocation=e}},{key:"getUserLocation",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{enableHighAccuracy:!0,timeout:6e4,maximumAge:1e4};return new Promise(function(r,i){e.geoLocation.getCurrentPosition(function(e){r(e)},function(e){i(e)},t)})}},{key:"watchUserPosition",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{enableHighAccuracy:!0,timeout:6e4,maximumAge:1e3};return this.geoLocation.watchPosition(function(t){e(t)},function(e){t(e)},r)}},{key:"unWatchUserPosition",value:function(e){this.geoLocation.clearWatch(e)}},{key:"watchUserHeading",value:function(e,t){var r=function(r){if(function(e){return e instanceof DeviceOrientationEvent}(r)){var i=null;void 0!==r.webkitCompassHeading?i=r.webkitCompassHeading||null:r.absolute&&null!==r.alpha&&(i=360-r.alpha),null!==i?e(i):t("Could not retrieve heading information.")}};this.headingListeners.push(r),"ondeviceorientationabsolute"in window?window.addEventListener("deviceorientationabsolute",r):"ondeviceorientation"in window&&window.addEventListener("deviceorientation",r)}},{key:"unwatchUserHeading",value:function(){this.headingListeners.forEach(function(e){window.removeEventListener("deviceorientationabsolute",e),window.removeEventListener("deviceorientation",e)}),this.headingListeners=[]}},{key:"loadRoutesForOriginCache",value:(o=Er(wr().m(function e(t,r,i,n,o){return wr().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this.repository.fetchAndParseRoutesFromOrigin(t,r,i,n,o);case 1:return e.a(2)}},e,this)})),function(e,t,r,i,n){return o.apply(this,arguments)})},{key:"getCacheTimestamp",value:(n=Er(wr().m(function e(t){var r,i;return wr().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.repository.fetchAndParseCacheTimestamp(t);case 1:return r=e.v,this.logEvent("getCacheTimestamp"),e.a(2,r);case 2:throw e.p=2,i=e.v,this.logWarning(i,{functionName:"getCacheTimestamp"}),new Error("Failed to get cache timestamp");case 3:return e.a(2)}},e,this,[[0,2]])})),function(e){return n.apply(this,arguments)})},{key:"cleanRoutesCache",value:function(){this.repository.cleanRoutesCache()}},{key:"getCssCustomization",value:(i=Er(wr().m(function e(t){var r,i;return wr().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.repository.fetchAndParseCssCustomization(t);case 1:return r=e.v,this.logEvent("cssCustomization"),e.a(2,r);case 2:throw e.p=2,i=e.v,this.logWarning(i,{functionName:"getCssCustomization"}),new Error("Failed to get css customization");case 3:return e.a(2)}},e,this,[[0,2]])})),function(e){return i.apply(this,arguments)})},{key:"notifyHealth",value:(r=Er(wr().m(function e(t,r,i,n){var o,a;return wr().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.repository.postAndParseHealthPing(t,r,i,n);case 1:return o=e.v,e.a(2,o);case 2:throw e.p=2,a=e.v,this.logWarning(a,{functionName:"notifyHealth"}),new Error("Failed to notify health");case 3:return e.a(2)}},e,this,[[0,2]])})),function(e,t,i,n){return r.apply(this,arguments)})}],[{key:"getLang",value:function(){return this.config.lang}}]);var r,i,n,o,a,s,l,c,u,h,d,p,f,m,g,_,y,v}(Fe);function zr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i,n,o,a,s=[],l=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t);else for(;!(l=(i=o.call(r)).done)&&(s.push(i.value),s.length!==t);l=!0);}catch(e){c=!0,n=e}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw n}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Br(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Br(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Br(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function Nr(e){var t=document.createElement("style");t.textContent="";for(var r=0,i=Object.entries(e);r<i.length;r++){var n=zr(i[r],2),o=jr(n[0],n[1]);t.textContent+=o}document.head.appendChild(t);var a=Object.keys(e).at(0);null!=a&&document.body.classList.add(a)}function jr(e,t){var r=".".concat(e," {\n"),i=t.definitions;null!=i&&(r=function(e,t){for(var r=0,i=Object.entries(null!==(n=e.colors)&&void 0!==n?n:{});r<i.length;r++)for(var n,o=zr(i[r],2),a=o[0],s=o[1],l=0,c=Object.entries(s);l<c.length;l++){var u=zr(c[l],2),h=u[0],d=u[1];t+=" --definitions-colors-".concat(a,"-").concat(h,": ").concat(d,";\n")}for(var p=0,f=Object.entries(null!==(m=e.shadows)&&void 0!==m?m:{});p<f.length;p++){var m,g=zr(f[p],2),_=g[0],y=g[1];t+=" --definitions-shadows-".concat(_,": ").concat(y,";\n")}for(var v=0,b=Object.entries(null!==(x=e.textFonts)&&void 0!==x?x:{});v<b.length;v++){var x,w=zr(b[v],2),T=w[0],S=w[1];t+=" --definitions-textFonts-".concat(T,": ").concat(S,";\n")}return t}(i,r));for(var n=0,o=Object.entries(null!==(a=t.screens)&&void 0!==a?a:{});n<o.length;n++)for(var a,s=zr(o[n],2),l=s[0],c=s[1],u=0,h=Object.entries(c);u<h.length;u++)for(var d=zr(h[u],2),p=d[0],f=d[1],m=0,g=Object.entries(f);m<g.length;m++)for(var _=zr(g[m],2),y=_[0],v=_[1],b=0,x=Object.entries(v);b<x.length;b++){var w=zr(x[b],2),T=w[0],S=w[1];r+=" --".concat(l,"-").concat(p,"-").concat(y,"-").concat(T,": ").concat(S,";\n")}return r+="}\n"}function Vr(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=qr(e))||t){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function Ur(e){return Ur="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ur(e)}function Gr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i,n,o,a,s=[],l=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(i=o.call(r)).done)&&(s.push(i.value),s.length!==t);l=!0);}catch(e){c=!0,n=e}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw n}}return s}}(e,t)||qr(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function qr(e,t){if(e){if("string"==typeof e)return $r(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?$r(e,t):void 0}}function $r(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function Wr(e,t,r){return r&&function(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,Zr(i.key),i)}}(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Zr(e){var t=function(e,t){if("object"!=Ur(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=Ur(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==Ur(t)?t:t+""}var Hr=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return Wr(e,0,[{key:"getDay",value:function(e){try{switch(e.getDay()){case 0:return"su";case 1:return"mo";case 2:return"tu";case 3:return"we";case 4:return"th";case 5:return"fr";case 6:return"sa";default:return null}}catch(t){return console.error("Error getting day from date:",t),null}}},{key:"convertSingleTimeTo12Hour",value:function(e){try{if(!e||"string"!=typeof e)return console.error("Invalid time input:",e),"";var t=Gr(e.split(":"),2),r=t[0],i=t[1];if(!r||!i)return console.error("Invalid time format:",e),"";var n=parseInt(r,10),o=parseInt(i,10);if(isNaN(n)||isNaN(o)||n<0||n>23||o<0||o>59)return console.error("Invalid time values:",e),"";var a,s=n%24;return s<12?(a="a.m.",0===s&&(s=12)):(a="p.m.",12!==s&&(s-=12)),"".concat(s,":").concat(o<10?"0":"").concat(o," ").concat(a)}catch(l){return console.error("Error converting time to 12 hour format:",l),""}}},{key:"formatTimeSchedule",value:function(t){try{if(!t||!t.open||!t.close)return console.error("Invalid opening time object:",t),"";var r=e.convertSingleTimeTo12Hour(t.open),i=e.convertSingleTimeTo12Hour(t.close);return""===r||""===i?(console.error("Invalid time format in opening time:",t),""):"".concat(r," - ").concat(i)}catch(n){return console.error("Error formatting time schedule:",n),""}}},{key:"getDayNumber",value:function(e){try{switch(e){case"mo":return 1;case"tu":return 2;case"we":return 3;case"th":return 4;case"fr":return 5;case"sa":return 6;case"su":return 7;default:return-1}}catch(t){return console.error("Error getting day number:",t),-1}}},{key:"getDayName",value:function(t){try{var r=e.getDayNumber(t);if(-1===r)return"";var i=new Date(2024,0,r);try{var n=Or.getLang();return i.toLocaleDateString(n,{weekday:"long"})}catch(o){return i.toLocaleDateString("en",{weekday:"long"})}}catch(o){return console.error("Error getting day name:",o),""}}},{key:"sortDays",value:function(t){try{return Object.fromEntries(Object.entries(t).sort(function(t,r){var i=Gr(t,1)[0],n=Gr(r,1)[0];return e.getDayNumber(i)-e.getDayNumber(n)}))}catch(r){return console.error("Error sorting days:",r),t}}},{key:"isOpenFromPreviousDay",value:function(t,r){try{if(!t||"object"!==Ur(t))return console.error("Invalid opening hours object:",t),!1;var i=r||new Date,n=new Date(i);e.previousDate(n);var o=e.getDay(n);if(null==o)return!1;var a=t[o];if(!a||!Array.isArray(a)||0===a.length)return!1;var s,l=Vr(a);try{for(l.s();!(s=l.n()).done;){var c=s.value;if(c&&c.open&&c.close&&e.isValidTime(c.open)&&e.isValidTime(c.close)){var u=e.parseTimeAsDate(c.open,n),h=e.parseTimeAsDate(c.close,n);if(u>h&&e.nextDate(h),i>=u&&i<=h)return!0}}}catch(d){l.e(d)}finally{l.f()}return!1}catch(p){return console.error("Error checking if open from previous day:",p),!1}}},{key:"previousDate",value:function(e){try{var t=e.getDate();e.setDate(t-1)}catch(r){console.error("Error setting previous date:",r)}}},{key:"nextDate",value:function(e){try{var t=e.getDate();e.setDate(t+1)}catch(r){console.error("Error setting next date:",r)}}},{key:"isWithinOpeningHours",value:function(t,r){try{if(!t||"object"!==Ur(t))return console.error("Invalid opening hours object:",t),!1;var i=r||new Date,n=e.getDay(i);if(null==n)return!1;if(e.isOpenFromPreviousDay(t,i))return!0;var o=t[n];if(!o||!Array.isArray(o)||0===o.length)return!1;var a,s=Vr(o);try{for(s.s();!(a=s.n()).done;){var l=a.value;if(l&&l.open&&l.close&&e.isValidTime(l.open)&&e.isValidTime(l.close)){var c=e.parseTimeAsDate(l.open,i),u=e.parseTimeAsDate(l.close,i);if(c>=u&&e.nextDate(u),i>=c&&i<=u)return!0}}}catch(h){s.e(h)}finally{s.f()}return!1}catch(d){return console.error("Error checking if within opening hours:",d),!1}}},{key:"hasOpeningHoursToday",value:function(t){try{if(!t||"object"!==Ur(t))return console.error("Invalid opening hours object:",t),!1;var r=new Date,i=e.getDay(r);if(null==i)return!1;var n=t[i];return!!(n&&n.length>0)}catch(o){return console.error("Error checking if has opening hours today:",o),!1}}},{key:"isValidTime",value:function(e){try{return e&&"string"==typeof e?/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(e):(console.error("Invalid time input:",e),!1)}catch(t){return console.error("Error validating time:",t),!1}}},{key:"parseTimeAsDate",value:function(e,t){try{var r=Gr(e.split(":").map(Number),2),i=r[0],n=r[1],o=t?new Date(t):new Date;return new Date(o.getFullYear(),o.getMonth(),o.getDate(),i,n,0,0)}catch(a){return console.error("Error parsing time as date:",a),new Date}}},{key:"flattenOpeningTimes",value:function(t){try{if(!t||!Array.isArray(t)||0===t.length)return console.error("Invalid opening times array:",t),{open:"00:00",close:"00:00"};e.sortOpeningTimesByOpen(t);var r=t[0],i=t[t.length-1];return r&&i&&r.open&&i.close?{open:r.open,close:i.close}:(console.error("Invalid opening time objects:",{first:r,last:i}),{open:"00:00",close:"00:00"})}catch(n){return console.error("Error flattening opening times:",n),{open:"00:00",close:"00:00"}}}},{key:"sortOpeningTimesByOpen",value:function(e){try{return e.sort(function(e,t){return e.open.localeCompare(t.open)})}catch(t){return console.error("Error sorting opening times by open:",t),e}}},{key:"formatCurrentDaySchedule",value:function(t){try{var r=new Date,i=e.getDay(r);if(null==i)return"";var n=t[i];if(n&&n.length>0){var o=e.flattenOpeningTimes(n);return e.formatTimeSchedule(o)}return""}catch(a){return console.error("Error formatting current day schedule:",a),""}}},{key:"formatPreviousDaySchedule",value:function(t){try{var r=new Date;e.previousDate(r);var i=e.getDay(r);if(null==i)return"";var n=t[i];if(n&&n.length>0){var o=e.flattenOpeningTimes(n);return e.formatTimeSchedule(o)}return""}catch(a){return console.error("Error formatting previous day schedule:",a),""}}},{key:"isValidSchedule",value:function(t,r,i){try{if(!e.isValidTime(t)||!e.isValidTime(r)||!e.isValidTime(i))return console.error("Invalid time format in schedule:",{openHour:t,closeHour:r,currentHour:i}),!1;var n=e.toMinutes(t),o=e.toMinutes(r),a=e.toMinutes(i);return a>=n&&a<=o}catch(s){return console.error("Error validating schedule:",s),!1}}},{key:"parseTimeToDate",value:function(e,t){try{if(!e||"string"!=typeof e)return console.error("Invalid time input:",e),new Date;var r=Gr(e.split(":"),2),i=r[0],n=r[1];if(!i||!n)return console.error("Invalid time format:",e),new Date;var o=parseInt(i,10),a=parseInt(n,10);if(isNaN(o)||isNaN(a))return console.error("Invalid time values:",e),new Date;var s=t?new Date(t):new Date;return s.setHours(o,a,0,0),s}catch(l){return console.error("Error parsing time to date:",l),new Date}}},{key:"getDaysRange",value:function(e){try{var t={Mo:"Monday",Tu:"Tuesday",We:"Wednesday",Th:"Thursday",Fr:"Friday",Sa:"Saturday",Su:"Sunday"};if(0===e.length)return"";var r=t[e[0]]||"Invalid day",i=t[e[e.length-1]]||"Invalid day";return 1===e.length?r:"".concat(r," - ").concat(i)}catch(n){return console.error("Error getting days range:",n),""}}},{key:"getNextClosestTime",value:function(t,r){try{var i=60*r.getHours()+r.getMinutes(),n=t.map(function(t){var r=e.toMinutes(t);return{time:t,diff:r-i+(r<i?1440:0)}});return n.sort(function(e,t){return e.diff-t.diff}),n.length>0?n[0].time:""}catch(o){return console.error("Error getting next closest time:",o),""}}},{key:"isPlaceOpen",value:function(t,r){try{if(!t||"object"!==Ur(t))return console.error("Invalid opening hours object:",t),!1;var i=r||new Date,n=e.getDay(i);if(null==n||!t[n]||!Array.isArray(t[n])||0===t[n].length)return!1;var o=t[n][0];if(!o||!o.open||!o.close)return!1;var a=o.open,s=o.close;if(!e.isValidTime(a)||!e.isValidTime(s))return!1;var l=e.parseTimeToDate(a,i),c=e.parseTimeToDate(s,i);c<l&&c.setDate(c.getDate()+1);var u=new Date(i);return u.setSeconds(0,0),u>=l&&u<=c}catch(h){return console.error("Error checking if place is open:",h),!1}}},{key:"getNextSchedule",value:function(t,r){try{if(!t||"object"!==Ur(t))return console.error("Invalid opening hours object:",t),"";var i=r||new Date,n=e.getDay(i);if(null==n||!t[n]||!Array.isArray(t[n])||0===t[n].length)return"";var o=t[n][0];if(!o||!o.open||!o.close)return"";var a=e.isPlaceOpen(t,i)?o.close:o.open;return a?e.convertSingleTimeTo12Hour(a):""}catch(s){return console.error("Error getting next schedule:",s),""}}},{key:"checkDayHasSchedule",value:function(t,r){try{var i=r||new Date,n=e.getDay(i);return null!=n&&!(!t||!t[n])}catch(o){return console.error("Error checking if day has schedule:",o),!1}}},{key:"toMinutes",value:function(e){try{if(!e||"string"!=typeof e)return console.error("Invalid time input:",e),0;var t=Gr(e.split(":"),2),r=t[0],i=t[1];if(!r||!i)return console.error("Invalid time format:",e),0;var n=parseInt(r,10),o=parseInt(i,10);return isNaN(n)||isNaN(o)?(console.error("Invalid time values:",e),0):60*n+o}catch(a){return console.error("Error converting time to minutes:",a),0}}}])}(),Xr=function(){if(!document.querySelector("link[data-lazarillo-styles]")){var e=document.createElement("link");e.rel="stylesheet",e.href="./styles.css",e.setAttribute("data-lazarillo-styles","true"),document.head.appendChild(e)}}})(),n})(),me.exports=ye(_e())),be=(e=>(e.youAreHere="youAreHere",e.placePopup="placePopup",e.pin="pin",e.default="default",e))(be||{});const xe="lazarillo-sdk";var we,Te={exports:{}};var Se,Ee=(we||(we=1,Se=Te,function(e,t){Se.exports=t()}(0,()=>{return e={12:(e,t,r)=>{var i=r(539);e.exports=function(e,t,r){var n,o,a,s,l=i.isType(e,"object"),c=i.isType(e,"array"),u=[];if(r=r||{obj:[],mapped:[]},l){if(s=r.obj.indexOf(e),l&&-1!==s)return r.mapped[s]||r.obj[s];r.obj.push(e),s=r.obj.length-1}if(l)for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&u.push(n);else if(c)for(a=0;a<e.length;++a)u.push(a);var h=l?{}:[],d=!0;for(a=0;a<u.length;++a)o=e[n=u[a]],h[n]=t(n,o,r),d=d&&h[n]===e[n];return l&&!d&&(r.mapped[s]=h),d?e:h}},61:e=>{e.exports={parse:function(e){var t,r,i={protocol:null,auth:null,host:null,path:null,hash:null,href:e,hostname:null,port:null,pathname:null,search:null,query:null};if(-1!==(t=e.indexOf("//"))?(i.protocol=e.substring(0,t),r=t+2):r=0,-1!==(t=e.indexOf("@",r))&&(i.auth=e.substring(r,t),r=t+1),-1===(t=e.indexOf("/",r))){if(-1===(t=e.indexOf("?",r)))return-1===(t=e.indexOf("#",r))?i.host=e.substring(r):(i.host=e.substring(r,t),i.hash=e.substring(t)),i.hostname=i.host.split(":")[0],i.port=i.host.split(":")[1],i.port&&(i.port=parseInt(i.port,10)),i;i.host=e.substring(r,t),i.hostname=i.host.split(":")[0],i.port=i.host.split(":")[1],i.port&&(i.port=parseInt(i.port,10)),r=t}else i.host=e.substring(r,t),i.hostname=i.host.split(":")[0],i.port=i.host.split(":")[1],i.port&&(i.port=parseInt(i.port,10)),r=t;if(-1===(t=e.indexOf("#",r))?i.path=e.substring(r):(i.path=e.substring(r,t),i.hash=e.substring(t)),i.path){var n=i.path.split("?");i.pathname=n[0],i.query=n[1],i.search=i.query?"?"+i.query:null}return i}}},67:(e,t,r)=>{var i=r(539),n=r(91),o={hostname:"api.rollbar.com",path:"/api/1/item/",search:null,version:"1",protocol:"https:",port:443};function a(e,t,r,i,n){this.options=e,this.transport=t,this.url=r,this.truncation=i,this.jsonBackup=n,this.accessToken=e.accessToken,this.transportOptions=s(e,r)}function s(e,t){return n.getTransportFromOptions(e,o,t)}a.prototype.postItem=function(e,t){var r=n.transportOptions(this.transportOptions,"POST"),i=n.buildPayload(this.accessToken,e,this.jsonBackup),o=this;setTimeout(function(){o.transport.post(o.accessToken,r,i,t)},0)},a.prototype.buildJsonPayload=function(e,t){var r,o=n.buildPayload(this.accessToken,e,this.jsonBackup);return(r=this.truncation?this.truncation.truncate(o):i.stringify(o)).error?(t&&t(r.error),null):r.value},a.prototype.postJsonPayload=function(e,t){var r=n.transportOptions(this.transportOptions,"POST");this.transport.postJsonPayload(this.accessToken,r,e,t)},a.prototype.configure=function(e){var t=this.oldOptions;return this.options=i.merge(t,e),this.transportOptions=s(this.options,this.url),void 0!==this.options.accessToken&&(this.accessToken=this.options.accessToken),this},e.exports=a},91:(e,t,r)=>{var i=r(539);e.exports={buildPayload:function(e,t,r){if(!i.isType(t.context,"string")){var n=i.stringify(t.context,r);n.error?t.context="Error: could not serialize 'context'":t.context=n.value||"",t.context.length>255&&(t.context=t.context.substr(0,255))}return{access_token:e,data:t}},getTransportFromOptions:function(e,t,r){var i=t.hostname,n=t.protocol,o=t.port,a=t.path,s=t.search,l=e.timeout,c=function(e){var t="undefined"!=typeof window&&window||"undefined"!=typeof self&&self,r=e.defaultTransport||"xhr";return void 0===t.fetch&&(r="xhr"),void 0===t.XMLHttpRequest&&(r="fetch"),r}(e),u=e.proxy;if(e.endpoint){var h=r.parse(e.endpoint);i=h.hostname,n=h.protocol,o=h.port,a=h.pathname,s=h.search}return{timeout:l,hostname:i,protocol:n,port:o,path:a,search:s,proxy:u,transport:c}},transportOptions:function(e,t){var r=e.protocol||"https:",i=e.port||("http:"===r?80:"https:"===r?443:void 0),n=e.hostname,o=e.path,a=e.timeout,s=e.transport;return e.search&&(o+=e.search),e.proxy&&(o=r+"//"+n+o,n=e.proxy.host||e.proxy.hostname,i=e.proxy.port,r=e.proxy.protocol||r),{timeout:a,protocol:r,hostname:n,path:o,port:i,method:t,transport:s}},appendPathToPath:function(e,t){var r=/\/$/.test(e),i=/^\//.test(t);return r&&i?t=t.substring(1):r||i||(t="/"+t),e+t}}},108:function(e,t){var r,i;void 0===(i="function"==typeof(r=function(){function e(e){return!isNaN(parseFloat(e))&&isFinite(e)}function t(e){return e.charAt(0).toUpperCase()+e.substring(1)}function r(e){return function(){return this[e]}}var i=["isConstructor","isEval","isNative","isToplevel"],n=["columnNumber","lineNumber"],o=["fileName","functionName","source"],a=i.concat(n,o,["args"],["evalOrigin"]);function s(e){if(e)for(var r=0;r<a.length;r++)void 0!==e[a[r]]&&this["set"+t(a[r])](e[a[r]])}s.prototype={getArgs:function(){return this.args},setArgs:function(e){if("[object Array]"!==Object.prototype.toString.call(e))throw new TypeError("Args must be an Array");this.args=e},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(e){if(e instanceof s)this.evalOrigin=e;else{if(!(e instanceof Object))throw new TypeError("Eval Origin must be an Object or StackFrame");this.evalOrigin=new s(e)}},toString:function(){var e=this.getFileName()||"",t=this.getLineNumber()||"",r=this.getColumnNumber()||"",i=this.getFunctionName()||"";return this.getIsEval()?e?"[eval] ("+e+":"+t+":"+r+")":"[eval]:"+t+":"+r:i?i+" ("+e+":"+t+":"+r+")":e+":"+t+":"+r}},s.fromString=function(e){var t=e.indexOf("("),r=e.lastIndexOf(")"),i=e.substring(0,t),n=e.substring(t+1,r).split(","),o=e.substring(r+1);if(0===o.indexOf("@"))var a=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(o,""),l=a[1],c=a[2],u=a[3];return new s({functionName:i,args:n||void 0,fileName:l,lineNumber:c||void 0,columnNumber:u||void 0})};for(var l=0;l<i.length;l++)s.prototype["get"+t(i[l])]=r(i[l]),s.prototype["set"+t(i[l])]=function(e){return function(t){this[e]=Boolean(t)}}(i[l]);for(var c=0;c<n.length;c++)s.prototype["get"+t(n[c])]=r(n[c]),s.prototype["set"+t(n[c])]=function(t){return function(r){if(!e(r))throw new TypeError(t+" must be a Number");this[t]=Number(r)}}(n[c]);for(var u=0;u<o.length;u++)s.prototype["get"+t(o[u])]=r(o[u]),s.prototype["set"+t(o[u])]=function(e){return function(t){this[e]=String(t)}}(o[u]);return s})?r.apply(t,[]):r)||(e.exports=i)},175:e=>{var t={ieVersion:function(){var e;if("undefined"==typeof document)return e;for(var t=3,r=document.createElement("div"),i=r.getElementsByTagName("i");r.innerHTML="\x3c!--[if gt IE "+ ++t+"]><i></i><![endif]--\x3e",i[0];);return t>4?t:e}};e.exports=t},183:(e,t,r)=>{var i=r(944);"undefined"==typeof window||window._rollbarStartTime||(window._rollbarStartTime=(new Date).getTime()),e.exports=i},197:(e,t,r)=>{var i=r(335),n=r(539),o=r(67),a=r(306),s=r(796),l=r(497),c=r(61),u=r(203),h=r(962),d=r(584),p=r(581),f=r(342);function m(e,t){this.options=n.handleOptions(w,e,null,a),this.options._configuredOptions=e;var r=this.components.telemeter,s=this.components.instrumenter,f=this.components.polyfillJSON;this.wrapGlobals=this.components.wrapGlobals,this.scrub=this.components.scrub;var m=this.components.truncation,g=new l(m),_=new o(this.options,g,c,m);r&&(this.telemeter=new r(this.options)),this.client=t||new i(this.options,_,a,this.telemeter,"browser");var y=v(),b="undefined"!=typeof document&&document;this.isChrome=y.chrome&&y.chrome.runtime,this.anonymousErrorsPending=0,function(e,t,r){e.addTransform(u.handleDomException).addTransform(u.handleItemWithError).addTransform(u.ensureItemHasSomethingToSay).addTransform(u.addBaseInfo).addTransform(u.addRequestInfo(r)).addTransform(u.addClientInfo(r)).addTransform(u.addPluginInfo(r)).addTransform(u.addBody).addTransform(h.addMessageWithError).addTransform(h.addTelemetryData).addTransform(h.addConfigToPayload).addTransform(u.addScrubber(t.scrub)).addTransform(h.addPayloadOptions).addTransform(h.userTransform(a)).addTransform(h.addConfiguredOptions).addTransform(h.addDiagnosticKeys).addTransform(h.itemToPayload)}(this.client.notifier,this,y),this.client.queue.addPredicate(p.checkLevel).addPredicate(d.checkIgnore).addPredicate(p.userCheckIgnore(a)).addPredicate(p.urlIsNotBlockListed(a)).addPredicate(p.urlIsSafeListed(a)).addPredicate(p.messageIsIgnored(a)),this.setupUnhandledCapture(),s&&(this.instrumenter=new s(this.options,this.client.telemeter,this,y,b),this.instrumenter.instrument()),n.setupJSON(f),this.rollbar=this}var g=null;function _(e){var t="Rollbar is not initialized";a.error(t),e&&e(new Error(t))}function y(e){for(var t=0,r=e.length;t<r;++t)if(n.isFunction(e[t]))return e[t]}function v(){return"undefined"!=typeof window&&window||"undefined"!=typeof self&&self}m.init=function(e,t){return g?g.global(e).configure(e):g=new m(e,t)},m.prototype.components={},m.setComponents=function(e){m.prototype.components=e},m.prototype.global=function(e){return this.client.global(e),this},m.global=function(e){if(g)return g.global(e);_()},m.prototype.configure=function(e,t){var r=this.options,i={};return t&&(i={payload:t}),this.options=n.handleOptions(r,e,i,a),this.options._configuredOptions=n.handleOptions(r._configuredOptions,e,i),this.client.configure(this.options,t),this.instrumenter&&this.instrumenter.configure(this.options),this.setupUnhandledCapture(),this},m.configure=function(e,t){if(g)return g.configure(e,t);_()},m.prototype.lastError=function(){return this.client.lastError},m.lastError=function(){if(g)return g.lastError();_()},m.prototype.log=function(){var e=this._createItem(arguments),t=e.uuid;return this.client.log(e),{uuid:t}},m.log=function(){if(g)return g.log.apply(g,arguments);_(y(arguments))},m.prototype.debug=function(){var e=this._createItem(arguments),t=e.uuid;return this.client.debug(e),{uuid:t}},m.debug=function(){if(g)return g.debug.apply(g,arguments);_(y(arguments))},m.prototype.info=function(){var e=this._createItem(arguments),t=e.uuid;return this.client.info(e),{uuid:t}},m.info=function(){if(g)return g.info.apply(g,arguments);_(y(arguments))},m.prototype.warn=function(){var e=this._createItem(arguments),t=e.uuid;return this.client.warn(e),{uuid:t}},m.warn=function(){if(g)return g.warn.apply(g,arguments);_(y(arguments))},m.prototype.warning=function(){var e=this._createItem(arguments),t=e.uuid;return this.client.warning(e),{uuid:t}},m.warning=function(){if(g)return g.warning.apply(g,arguments);_(y(arguments))},m.prototype.error=function(){var e=this._createItem(arguments),t=e.uuid;return this.client.error(e),{uuid:t}},m.error=function(){if(g)return g.error.apply(g,arguments);_(y(arguments))},m.prototype.critical=function(){var e=this._createItem(arguments),t=e.uuid;return this.client.critical(e),{uuid:t}},m.critical=function(){if(g)return g.critical.apply(g,arguments);_(y(arguments))},m.prototype.buildJsonPayload=function(e){return this.client.buildJsonPayload(e)},m.buildJsonPayload=function(){if(g)return g.buildJsonPayload.apply(g,arguments);_()},m.prototype.sendJsonPayload=function(e){return this.client.sendJsonPayload(e)},m.sendJsonPayload=function(){if(g)return g.sendJsonPayload.apply(g,arguments);_()},m.prototype.setupUnhandledCapture=function(){var e=v();this.unhandledExceptionsInitialized||(this.options.captureUncaught||this.options.handleUncaughtExceptions)&&(s.captureUncaughtExceptions(e,this),this.wrapGlobals&&this.options.wrapGlobalEventHandlers&&this.wrapGlobals(e,this),this.unhandledExceptionsInitialized=!0),this.unhandledRejectionsInitialized||(this.options.captureUnhandledRejections||this.options.handleUnhandledRejections)&&(s.captureUnhandledRejections(e,this),this.unhandledRejectionsInitialized=!0)},m.prototype.handleUncaughtException=function(e,t,r,i,o,a){if(this.options.captureUncaught||this.options.handleUncaughtExceptions){if(this.options.inspectAnonymousErrors&&this.isChrome&&null===o&&""===t)return"anonymous";var s,l=n.makeUnhandledStackInfo(e,t,r,i,o,"onerror","uncaught exception",f);n.isError(o)?(s=this._createItem([e,o,a]))._unhandledStackInfo=l:n.isError(t)?(s=this._createItem([e,t,a]))._unhandledStackInfo=l:(s=this._createItem([e,a])).stackInfo=l,s.level=this.options.uncaughtErrorLevel,s._isUncaught=!0,this.client.log(s)}},m.prototype.handleAnonymousErrors=function(){if(this.options.inspectAnonymousErrors&&this.isChrome){var e=this;try{Error.prepareStackTrace=function(t,r){if(e.options.inspectAnonymousErrors&&e.anonymousErrorsPending){if(e.anonymousErrorsPending-=1,!t)return;t._isAnonymous=!0,e.handleUncaughtException(t.message,null,null,null,t)}return t.stack}}catch(e){this.options.inspectAnonymousErrors=!1,this.error("anonymous error handler failed",e)}}},m.prototype.handleUnhandledRejection=function(e,t){if(this.options.captureUnhandledRejections||this.options.handleUnhandledRejections){var r="unhandled rejection was null or undefined!";if(e)if(e.message)r=e.message;else{var i=n.stringify(e);i.value&&(r=i.value)}var o,a=e&&e._rollbarContext||t&&t._rollbarContext;n.isError(e)?o=this._createItem([r,e,a]):(o=this._createItem([r,e,a])).stackInfo=n.makeUnhandledStackInfo(r,"",0,0,null,"unhandledrejection","",f),o.level=this.options.uncaughtErrorLevel,o._isUncaught=!0,o._originalArgs=o._originalArgs||[],o._originalArgs.push(t),this.client.log(o)}},m.prototype.wrap=function(e,t,r){try{var i;if(i=n.isFunction(t)?t:function(){return t||{}},!n.isFunction(e))return e;if(e._isWrap)return e;if(!e._rollbar_wrapped&&(e._rollbar_wrapped=function(){r&&n.isFunction(r)&&r.apply(this,arguments);try{return e.apply(this,arguments)}catch(r){var t=r;throw t&&window._rollbarWrappedError!==t&&(n.isType(t,"string")&&(t=new String(t)),t._rollbarContext=i()||{},t._rollbarContext._wrappedSource=e.toString(),window._rollbarWrappedError=t),t}},e._rollbar_wrapped._isWrap=!0,e.hasOwnProperty))for(var o in e)e.hasOwnProperty(o)&&"_rollbar_wrapped"!==o&&(e._rollbar_wrapped[o]=e[o]);return e._rollbar_wrapped}catch(t){return e}},m.wrap=function(e,t){if(g)return g.wrap(e,t);_()},m.prototype.captureEvent=function(){var e=n.createTelemetryEvent(arguments);return this.client.captureEvent(e.type,e.metadata,e.level)},m.captureEvent=function(){if(g)return g.captureEvent.apply(g,arguments);_()},m.prototype.captureDomContentLoaded=function(e,t){return t||(t=new Date),this.client.captureDomContentLoaded(t)},m.prototype.captureLoad=function(e,t){return t||(t=new Date),this.client.captureLoad(t)},m.prototype.loadFull=function(){a.info("Unexpected Rollbar.loadFull() called on a Notifier instance. This can happen when Rollbar is loaded multiple times.")},m.prototype._createItem=function(e){return n.createItem(e,a,this)};var b=r(441),x=r(537),w={version:b.version,scrubFields:x.scrubFields,logLevel:b.logLevel,reportLevel:b.reportLevel,uncaughtErrorLevel:b.uncaughtErrorLevel,endpoint:b.endpoint,verbose:!1,enabled:!0,transmit:!0,sendConfig:!1,includeItemsInTelemetry:!0,captureIp:!0,inspectAnonymousErrors:!0,ignoreDuplicateErrors:!0,wrapGlobalEventHandlers:!1};e.exports=m},203:(e,t,r)=>{var i=r(539),n=r(342),o=r(306);function a(e,t,r){var n=e.message,o=e.custom;n||(n="Item sent with null or missing arguments.");var a={body:n};o&&(a.extra=i.merge(o)),i.set(e,"data.body",{message:a}),r(null,e)}function s(e){var t=e.stackInfo.stack;return t&&0===t.length&&e._unhandledStackInfo&&e._unhandledStackInfo.stack&&(t=e._unhandledStackInfo.stack),t}function l(e,t,r){var o=e&&e.data.description,a=e&&e.custom,l=s(e),u=n.guessErrorClass(t.message),h={exception:{class:c(t,u[0],r),message:u[1]}};if(o&&(h.exception.description=o),l){var d,p,f,m,g,_,y,v;for(0===l.length&&(h.exception.stack=t.rawStack,h.exception.raw=String(t.rawException)),h.frames=[],y=0;y<l.length;++y)p={filename:(d=l[y]).url?i.sanitizeUrl(d.url):"(unknown)",lineno:d.line||null,method:d.func&&"?"!==d.func?d.func:"[anonymous]",colno:d.column},r.sendFrameUrl&&(p.url=d.url),p.method&&p.method.endsWith&&p.method.endsWith("_rollbar_wrapped")||(f=m=g=null,(_=d.context?d.context.length:0)&&(v=Math.floor(_/2),m=d.context.slice(0,v),f=d.context[v],g=d.context.slice(v)),f&&(p.code=f),(m||g)&&(p.context={},m&&m.length&&(p.context.pre=m),g&&g.length&&(p.context.post=g)),d.args&&(p.args=d.args),h.frames.push(p));h.frames.reverse(),a&&(h.extra=i.merge(a))}return h}function c(e,t,r){return e.name?e.name:r.guessErrorClass?t:"(unknown)"}e.exports={handleDomException:function(e,t,r){if(e.err&&"DOMException"===n.Stack(e.err).name){var i=new Error;i.name=e.err.name,i.message=e.err.message,i.stack=e.err.stack,i.nested=e.err,e.err=i}r(null,e)},handleItemWithError:function(e,t,r){if(e.data=e.data||{},e.err)try{e.stackInfo=e.err._savedStackTrace||n.parse(e.err,e.skipFrames),t.addErrorContext&&function(e){var t=[],r=e.err;for(t.push(r);r.nested||r.cause;)r=r.nested||r.cause,t.push(r);i.addErrorContext(e,t)}(e)}catch(t){o.error("Error while parsing the error object.",t);try{e.message=e.err.message||e.err.description||e.message||String(e.err)}catch(t){e.message=String(e.err)||String(t)}delete e.err}r(null,e)},ensureItemHasSomethingToSay:function(e,t,r){e.message||e.stackInfo||e.custom||r(new Error("No message, stack info, or custom data"),null),r(null,e)},addBaseInfo:function(e,t,r){var n=t.payload&&t.payload.environment||t.environment;e.data=i.merge(e.data,{environment:n,level:e.level,endpoint:t.endpoint,platform:"browser",framework:"browser-js",language:"javascript",server:{},uuid:e.uuid,notifier:{name:"rollbar-browser-js",version:t.version},custom:e.custom}),r(null,e)},addRequestInfo:function(e){return function(t,r,n){var o={};e&&e.location&&(o.url=e.location.href,o.query_string=e.location.search);var a="$remote_ip";r.captureIp?!0!==r.captureIp&&(a+="_anonymize"):a=null,a&&(o.user_ip=a),Object.keys(o).length>0&&i.set(t,"data.request",o),n(null,t)}},addClientInfo:function(e){return function(t,r,n){if(!e)return n(null,t);var o=e.navigator||{},a=e.screen||{};i.set(t,"data.client",{runtime_ms:t.timestamp-e._rollbarStartTime,timestamp:Math.round(t.timestamp/1e3),javascript:{browser:o.userAgent,language:o.language,cookie_enabled:o.cookieEnabled,screen:{width:a.width,height:a.height}}}),n(null,t)}},addPluginInfo:function(e){return function(t,r,n){if(!e||!e.navigator)return n(null,t);for(var o,a=[],s=e.navigator.plugins||[],l=0,c=s.length;l<c;++l)o=s[l],a.push({name:o.name,description:o.description});i.set(t,"data.client.javascript.plugins",a),n(null,t)}},addBody:function(e,t,r){e.stackInfo?e.stackInfo.traceChain?function(e,t,r){for(var n=e.stackInfo.traceChain,o=[],a=n.length,s=0;s<a;s++){var c=l(e,n[s],t);o.push(c)}i.set(e,"data.body",{trace_chain:o}),r(null,e)}(e,t,r):function(e,t,r){if(s(e)){var o=l(e,e.stackInfo,t);i.set(e,"data.body",{trace:o}),r(null,e)}else{var u=e.stackInfo,h=n.guessErrorClass(u.message),d=c(u,h[0],t),p=h[1];e.message=d+": "+p,a(e,0,r)}}(e,t,r):a(e,0,r)},addScrubber:function(e){return function(t,r,i){if(e){var n=r.scrubFields||[],o=r.scrubPaths||[];t.data=e(t.data,n,o)}i(null,t)}}}},215:e=>{var t=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=function(e){if(!e||"[object Object]"!==r.call(e))return!1;var i,n=t.call(e,"constructor"),o=e.constructor&&e.constructor.prototype&&t.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!o)return!1;for(i in e);return void 0===i||t.call(e,i)};e.exports=function e(){var t,r,n,o,a,s=Object.create(null),l=null,c=arguments.length;for(t=0;t<c;t++)if(null!=(l=arguments[t]))for(a in l)r=s[a],s!==(n=l[a])&&(n&&i(n)?(o=r&&i(r)?r:{},s[a]=e(o,n)):void 0!==n&&(s[a]=n));return s}},263:function(e,t,r){var i,n,o;n=[r(108)],void 0===(o="function"==typeof(i=function(e){var t=/(^|@)\S+:\d+/,r=/^\s*at .*(\S+:\d+|\(native\))/m,i=/^(eval@)?(\[native code])?$/;return{parse:function(e){if(void 0!==e.stacktrace||void 0!==e["opera#sourceloc"])return this.parseOpera(e);if(e.stack&&e.stack.match(r))return this.parseV8OrIE(e);if(e.stack)return this.parseFFOrSafari(e);throw new Error("Cannot parse given Error object")},extractLocation:function(e){if(-1===e.indexOf(":"))return[e];var t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));return[t[1],t[2]||void 0,t[3]||void 0]},parseV8OrIE:function(t){return t.stack.split("\n").filter(function(e){return!!e.match(r)},this).map(function(t){t.indexOf("(eval ")>-1&&(t=t.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));var r=t.replace(/^\s+/,"").replace(/\(eval code/g,"("),i=r.match(/ (\((.+):(\d+):(\d+)\)$)/),n=(r=i?r.replace(i[0],""):r).split(/\s+/).slice(1),o=this.extractLocation(i?i[1]:n.pop()),a=n.join(" ")||void 0,s=["eval","<anonymous>"].indexOf(o[0])>-1?void 0:o[0];return new e({functionName:a,fileName:s,lineNumber:o[1],columnNumber:o[2],source:t})},this)},parseFFOrSafari:function(t){return t.stack.split("\n").filter(function(e){return!e.match(i)},this).map(function(t){if(t.indexOf(" > eval")>-1&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===t.indexOf("@")&&-1===t.indexOf(":"))return new e({functionName:t});var r=/((.*".+"[^@]*)?[^@]*)(?:@)/,i=t.match(r),n=i&&i[1]?i[1]:void 0,o=this.extractLocation(t.replace(r,""));return new e({functionName:n,fileName:o[0],lineNumber:o[1],columnNumber:o[2],source:t})},this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(t){for(var r=/Line (\d+).*script (?:in )?(\S+)/i,i=t.message.split("\n"),n=[],o=2,a=i.length;o<a;o+=2){var s=r.exec(i[o]);s&&n.push(new e({fileName:s[2],lineNumber:s[1],source:i[o]}))}return n},parseOpera10:function(t){for(var r=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,i=t.stacktrace.split("\n"),n=[],o=0,a=i.length;o<a;o+=2){var s=r.exec(i[o]);s&&n.push(new e({functionName:s[3]||void 0,fileName:s[2],lineNumber:s[1],source:i[o]}))}return n},parseOpera11:function(r){return r.stack.split("\n").filter(function(e){return!!e.match(t)&&!e.match(/^Error created at/)},this).map(function(t){var r,i=t.split("@"),n=this.extractLocation(i.pop()),o=i.shift()||"",a=o.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;o.match(/\(([^)]*)\)/)&&(r=o.replace(/^[^(]+\(([^)]*)\)$/,"$1"));var s=void 0===r||"[arguments not available]"===r?void 0:r.split(",");return new e({functionName:a,args:s,fileName:n[0],lineNumber:n[1],columnNumber:n[2],source:t})},this)}}})?i.apply(t,n):i)||(e.exports=o)},306:(e,t,r)=>{r(738);var i=r(175),n=r(539);e.exports={error:function(){var e=Array.prototype.slice.call(arguments,0);e.unshift("Rollbar:"),i.ieVersion()<=8?console.error(n.formatArgsAsString(e)):console.error.apply(console,e)},info:function(){var e=Array.prototype.slice.call(arguments,0);e.unshift("Rollbar:"),i.ieVersion()<=8?console.info(n.formatArgsAsString(e)):console.info.apply(console,e)},log:function(){var e=Array.prototype.slice.call(arguments,0);e.unshift("Rollbar:"),i.ieVersion()<=8?console.log(n.formatArgsAsString(e)):console.log.apply(console,e)}}},335:(e,t,r)=>{var i=r(513),n=r(744),o=r(777),a=r(539);function s(e,t,r,i,u){this.options=a.merge(e),this.logger=r,s.rateLimiter.configureGlobal(this.options),s.rateLimiter.setPlatformOptions(u,this.options),this.api=t,this.queue=new n(s.rateLimiter,t,r,this.options);var h=this.options.tracer||null;c(h)?(this.tracer=h,this.options.tracer="opentracing-tracer-enabled",this.options._configuredOptions.tracer="opentracing-tracer-enabled"):this.tracer=null,this.notifier=new o(this.queue,this.options),this.telemeter=i,l(e),this.lastError=null,this.lastErrorHash="none"}function l(e){e.stackTraceLimit&&(Error.stackTraceLimit=e.stackTraceLimit)}function c(e){if(!e)return!1;if(!e.scope||"function"!=typeof e.scope)return!1;var t=e.scope();return!(!t||!t.active||"function"!=typeof t.active)}s.rateLimiter=new i({maxItems:0,itemsPerMinute:60}),s.prototype.global=function(e){return s.rateLimiter.configureGlobal(e),this},s.prototype.configure=function(e,t){var r=this.options,i={};t&&(i={payload:t}),this.options=a.merge(r,e,i);var n=this.options.tracer||null;return c(n)?(this.tracer=n,this.options.tracer="opentracing-tracer-enabled",this.options._configuredOptions.tracer="opentracing-tracer-enabled"):this.tracer=null,this.notifier&&this.notifier.configure(this.options),this.telemeter&&this.telemeter.configure(this.options),l(e),this.global(this.options),c(e.tracer)&&(this.tracer=e.tracer),this},s.prototype.log=function(e){var t=this._defaultLogLevel();return this._log(t,e)},s.prototype.debug=function(e){this._log("debug",e)},s.prototype.info=function(e){this._log("info",e)},s.prototype.warn=function(e){this._log("warning",e)},s.prototype.warning=function(e){this._log("warning",e)},s.prototype.error=function(e){this._log("error",e)},s.prototype.critical=function(e){this._log("critical",e)},s.prototype.wait=function(e){this.queue.wait(e)},s.prototype.captureEvent=function(e,t,r){return this.telemeter&&this.telemeter.captureEvent(e,t,r)},s.prototype.captureDomContentLoaded=function(e){return this.telemeter&&this.telemeter.captureDomContentLoaded(e)},s.prototype.captureLoad=function(e){return this.telemeter&&this.telemeter.captureLoad(e)},s.prototype.buildJsonPayload=function(e){return this.api.buildJsonPayload(e)},s.prototype.sendJsonPayload=function(e){this.api.postJsonPayload(e)},s.prototype._log=function(e,t){var r;if(t.callback&&(r=t.callback,delete t.callback),this.options.ignoreDuplicateErrors&&this._sameAsLastError(t)){if(r){var i=new Error("ignored identical item");i.item=t,r(i)}}else try{this._addTracingInfo(t),t.level=t.level||e,this.telemeter&&this.telemeter._captureRollbarItem(t),t.telemetryEvents=this.telemeter&&this.telemeter.copyEvents()||[],this.notifier.log(t,r)}catch(e){r&&r(e),this.logger.error(e)}},s.prototype._defaultLogLevel=function(){return this.options.logLevel||"debug"},s.prototype._sameAsLastError=function(e){if(!e._isUncaught)return!1;var t=function(e){return(e.message||"")+"::"+((e.err||{}).stack||String(e.err))}(e);return this.lastErrorHash===t||(this.lastError=e.err,this.lastErrorHash=t,!1)},s.prototype._addTracingInfo=function(e){if(this.tracer){var t=this.tracer.scope().active();if(function(e){if(!e||!e.context||"function"!=typeof e.context)return!1;var t=e.context();return!!(t&&t.toSpanId&&t.toTraceId&&"function"==typeof t.toSpanId&&"function"==typeof t.toTraceId)}(t)){t.setTag("rollbar.error_uuid",e.uuid),t.setTag("rollbar.has_error",!0),t.setTag("error",!0),t.setTag("rollbar.item_url",`https://rollbar.com/item/uuid/?uuid=${e.uuid}`),t.setTag("rollbar.occurrence_url",`https://rollbar.com/occurrence/uuid/?uuid=${e.uuid}`);var r=t.context().toSpanId(),i=t.context().toTraceId();e.custom?(e.custom.opentracing_span_id=r,e.custom.opentracing_trace_id=i):e.custom={opentracing_span_id:r,opentracing_trace_id:i}}}},e.exports=s},342:(e,t,r)=>{var i=r(263),n=new RegExp("^(([a-zA-Z0-9-_$ ]*): *)?(Uncaught )?([a-zA-Z0-9-_$ ]*): ");function o(e){var t={};return t._stackFrame=e,t.url=e.fileName,t.line=e.lineNumber,t.func=e.functionName,t.column=e.columnNumber,t.args=e.args,t.context=null,t}function a(e,t){return{stack:function(){var r=[];t=t||0;try{r=i.parse(e)}catch(e){r=[]}for(var n=[],a=t;a<r.length;a++)n.push(new o(r[a]));return n}(),message:e.message,name:(r=e,n=r.name&&r.name.length&&r.name,a=r.constructor.name&&r.constructor.name.length&&r.constructor.name,n&&a?"Error"===n?a:n:n||a),rawStack:e.stack,rawException:e};var r,n,a}e.exports={guessFunctionName:function(){return"?"},guessErrorClass:function(e){if(!e||!e.match)return["Unknown error. There was no error message to display.",""];var t=e.match(n),r="(unknown)";return t&&(r=t[t.length-1],e=(e=e.replace((t[t.length-2]||"")+r+":","")).replace(/(^[\s]+|[\s]+$)/g,"")),[r,e]},gatherContext:function(){return null},parse:function(e,t){var r=e;if(r.nested||r.cause){for(var i=[];r;)i.push(new a(r,t)),r=r.nested||r.cause,t=0;return i[0].traceChain=i,i[0]}return new a(r,t)},Stack:a,Frame:o}},352:(e,t,r)=>{var i=r(539),n=100;function o(e){this.queue=[],this.options=i.merge(e);var t=this.options.maxTelemetryEvents||n;this.maxQueueSize=Math.max(0,Math.min(t,n))}function a(e,t){return t||{error:"error",manual:"info"}[e]||"info"}o.prototype.configure=function(e){var t=this.options;this.options=i.merge(t,e);var r=this.options.maxTelemetryEvents||n,o=Math.max(0,Math.min(r,n)),a=0;this.queue.length>o&&(a=this.queue.length-o),this.maxQueueSize=o,this.queue.splice(0,a)},o.prototype.copyEvents=function(){var e=Array.prototype.slice.call(this.queue,0);if(i.isFunction(this.options.filterTelemetry))try{for(var t=e.length;t--;)this.options.filterTelemetry(e[t])&&e.splice(t,1)}catch(e){this.options.filterTelemetry=null}return e},o.prototype.capture=function(e,t,r,n,o){var s={level:a(e,r),type:e,timestamp_ms:o||i.now(),body:t,source:"client"};n&&(s.uuid=n);try{if(i.isFunction(this.options.filterTelemetry)&&this.options.filterTelemetry(s))return!1}catch(e){this.options.filterTelemetry=null}return this.push(s),s},o.prototype.captureEvent=function(e,t,r,i){return this.capture(e,t,r,i)},o.prototype.captureError=function(e,t,r,i){var n={message:e.message||String(e)};return e.stack&&(n.stack=e.stack),this.capture("error",n,t,r,i)},o.prototype.captureLog=function(e,t,r,i){return this.capture("log",{message:e},t,r,i)},o.prototype.captureNetwork=function(e,t,r,i){t=t||"xhr",e.subtype=e.subtype||t,i&&(e.request=i);var n=this.levelFromStatus(e.status_code);return this.capture("network",e,n,r)},o.prototype.levelFromStatus=function(e){return e>=200&&e<400?"info":0===e||e>=400?"error":"info"},o.prototype.captureDom=function(e,t,r,i,n){var o={subtype:e,element:t};return void 0!==r&&(o.value=r),void 0!==i&&(o.checked=i),this.capture("dom",o,"info",n)},o.prototype.captureNavigation=function(e,t,r){return this.capture("navigation",{from:e,to:t},"info",r)},o.prototype.captureDomContentLoaded=function(e){return this.capture("navigation",{subtype:"DOMContentLoaded"},"info",void 0,e&&e.getTime())},o.prototype.captureLoad=function(e){return this.capture("navigation",{subtype:"load"},"info",void 0,e&&e.getTime())},o.prototype.captureConnectivityChange=function(e,t){return this.captureNetwork({change:e},"connectivity",t)},o.prototype._captureRollbarItem=function(e){if(this.options.includeItemsInTelemetry)return e.err?this.captureError(e.err,e.level,e.uuid,e.timestamp):e.message?this.captureLog(e.message,e.level,e.uuid,e.timestamp):e.custom?this.capture("log",e.custom,e.level,e.uuid,e.timestamp):void 0},o.prototype.push=function(e){this.queue.push(e),this.queue.length>this.maxQueueSize&&this.queue.shift()},e.exports=o},356:(e,t,r)=>{var i=r(539),n=r(12);function o(e,t){var r=t.split("."),n=r.length-1;try{for(var o=0;o<=n;++o)o<n?e=e[r[o]]:e[r[o]]=i.redact()}catch(e){}}e.exports=function(e,t,r){if(t=t||[],r)for(var a=0;a<r.length;++a)o(e,r[a]);var s=function(e){for(var t,r=[],i=0;i<e.length;++i)t="^\\[?(%5[bB])?"+e[i]+"\\[?(%5[bB])?\\]?(%5[dD])?$",r.push(new RegExp(t,"i"));return r}(t),l=function(e){for(var t,r=[],i=0;i<e.length;++i)t="\\[?(%5[bB])?"+e[i]+"\\[?(%5[bB])?\\]?(%5[dD])?",r.push(new RegExp("("+t+"=)([^&\\n]+)","igm"));return r}(t);function c(e,t){return t+i.redact()}return n(e,function e(t,r,o){var a=function(e,t){var r;for(r=0;r<s.length;++r)if(s[r].test(e)){t=i.redact();break}return t}(t,r);return a===r?i.isType(r,"object")||i.isType(r,"array")?n(r,e,o):function(e){var t;if(i.isType(e,"string"))for(t=0;t<l.length;++t)e=e.replace(l[t],c);return e}(a):a})}},364:e=>{e.exports=function(e,t,r,i,n){var o=e[t];e[t]=r(o),i&&i[n].push([e,t,o])}},424:e=>{function t(e,t,r){if(t.hasOwnProperty&&t.hasOwnProperty("addEventListener")){for(var i=t.addEventListener;i._rollbarOldAdd&&i.belongsToShim;)i=i._rollbarOldAdd;var n=function(t,r,n){i.call(this,t,e.wrap(r),n)};n._rollbarOldAdd=i,n.belongsToShim=r,t.addEventListener=n;for(var o=t.removeEventListener;o._rollbarOldRemove&&o.belongsToShim;)o=o._rollbarOldRemove;var a=function(e,t,r){o.call(this,e,t&&t._rollbar_wrapped||t,r)};a._rollbarOldRemove=o,a.belongsToShim=r,t.removeEventListener=a}}e.exports=function(e,r,i){if(e){var n,o,a="EventTarget,Window,Node,ApplicationCache,AudioTrackList,ChannelMergerNode,CryptoOperation,EventSource,FileReader,HTMLUnknownElement,IDBDatabase,IDBRequest,IDBTransaction,KeyOperation,MediaController,MessagePort,ModalWindow,Notification,SVGElementInstance,Screen,TextTrack,TextTrackCue,TextTrackList,WebSocket,WebSocketWorker,Worker,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload".split(",");for(n=0;n<a.length;++n)e[o=a[n]]&&e[o].prototype&&t(r,e[o].prototype,i)}}},435:(e,t,r)=>{var i=r(538);e.exports=i},440:(e,t,r)=>{var i=r(539),n=r(306);function o(e,t){var r=new Error(e);return r.code=t||"ENOTFOUND",r}e.exports=function(e,t,r,a,s,l,c){var u;if(!(u=l?l():function(){var e,t,r=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}],i=r.length;for(t=0;t<i;t++)try{e=r[t]();break}catch(e){}return e}()))return s(new Error("No way to send a request"));try{try{var h=function(){try{if(h&&4===u.readyState){h=void 0;var e=i.jsonParse(u.responseText);if((a=u)&&a.status&&200===a.status)return void s(e.error,e.value);if(function(e){return e&&i.isType(e.status,"number")&&e.status>=400&&e.status<600}(u)){if(403===u.status){var t=e.value&&e.value.message;n.error(t)}s(new Error(String(u.status)))}else s(o("XHR response had no status code (likely connection failure)"))}}catch(e){var r;r=e&&e.stack?e:new Error(e),s(r)}var a};u.open(r,t,!0),u.setRequestHeader&&(u.setRequestHeader("Content-Type","application/json"),u.setRequestHeader("X-Rollbar-Access-Token",e)),i.isFiniteNumber(c)&&(u.timeout=c),u.onreadystatechange=h,u.send(a)}catch(e){if("undefined"!=typeof XDomainRequest){if(!window||!window.location)return s(new Error("No window available during request, unknown environment"));"http:"===window.location.href.substring(0,5)&&"https"===t.substring(0,5)&&(t="http"+t.substring(5));var d=new XDomainRequest;d.onprogress=function(){},d.ontimeout=function(){s(o("Request timed out","ETIMEDOUT"))},d.onerror=function(){s(new Error("Error during request"))},d.onload=function(){var e=i.jsonParse(d.responseText);s(e.error,e.value)},d.open(r,t,!0),d.send(a)}else s(new Error("Cannot find a method to transport a request"))}}catch(e){s(e)}}},441:e=>{e.exports={version:"2.26.5",endpoint:"api.rollbar.com/api/1/item/",logLevel:"debug",reportLevel:"debug",uncaughtErrorLevel:"error",maxItems:0,itemsPerMin:60}},497:(e,t,r)=>{var i=r(539),n=r(534),o=r(440);function a(e){this.truncation=e}a.prototype.get=function(e,t,r,n,o){n&&i.isFunction(n)||(n=function(){}),i.addParamsAndAccessTokenToPath(e,t,r);var a=i.formatUrl(t);this._makeZoneRequest(e,a,"GET",null,n,o,t.timeout,t.transport)},a.prototype.post=function(e,t,r,n,o){if(n&&i.isFunction(n)||(n=function(){}),!r)return n(new Error("Cannot send empty request"));var a;if((a=this.truncation?this.truncation.truncate(r):i.stringify(r)).error)return n(a.error);var s=a.value,l=i.formatUrl(t);this._makeZoneRequest(e,l,"POST",s,n,o,t.timeout,t.transport)},a.prototype.postJsonPayload=function(e,t,r,n,o){n&&i.isFunction(n)||(n=function(){});var a=i.formatUrl(t);this._makeZoneRequest(e,a,"POST",r,n,o,t.timeout,t.transport)},a.prototype._makeZoneRequest=function(){var e="undefined"!=typeof window&&window||void 0!==i&&i,t=e&&e.Zone&&e.Zone.root,r=Array.prototype.slice.call(arguments);if(t){var i=this;t.run(function(){i._makeRequest.apply(void 0,r)})}else this._makeRequest.apply(void 0,r)},a.prototype._makeRequest=function(e,t,r,i,a,s,l,c){if("undefined"!=typeof RollbarProxy)return function(e,t){(new RollbarProxy).sendJsonPayload(e,function(e){},function(e){t(new Error(e))})}(i,a);"fetch"===c?n(e,t,r,i,a,l):o(e,t,r,i,a,s,l)},e.exports=a},513:(e,t,r)=>{var i=r(539);function n(e){this.startTime=i.now(),this.counter=0,this.perMinCounter=0,this.platform=null,this.platformOptions={},this.configureGlobal(e)}function o(e,t,r){return!e.ignoreRateLimit&&t>=1&&r>t}function a(e,t,r,i,n,o,a){var s=null;return r&&(r=new Error(r)),r||i||(s=function(e,t,r,i,n){var o={body:{message:{body:n?"item per minute limit reached, ignoring errors until timeout":"maxItems has been hit, ignoring errors until reset.",extra:{maxItems:r,itemsPerMinute:i}}},language:"javascript",environment:t.environment||t.payload&&t.payload.environment,notifier:{version:t.notifier&&t.notifier.version||t.version}};return"browser"===e?(o.platform="browser",o.framework="browser-js",o.notifier.name="rollbar-browser-js"):"server"===e?(o.framework=t.framework||"node-js",o.notifier.name=t.notifier.name):"react-native"===e&&(o.framework=t.framework||"react-native",o.notifier.name=t.notifier.name),o}(e,t,n,o,a)),{error:r,shouldSend:i,payload:s}}n.globalSettings={startTime:i.now(),maxItems:void 0,itemsPerMinute:void 0},n.prototype.configureGlobal=function(e){void 0!==e.startTime&&(n.globalSettings.startTime=e.startTime),void 0!==e.maxItems&&(n.globalSettings.maxItems=e.maxItems),void 0!==e.itemsPerMinute&&(n.globalSettings.itemsPerMinute=e.itemsPerMinute)},n.prototype.shouldSend=function(e,t){var r=(t=t||i.now())-this.startTime;(r<0||r>=6e4)&&(this.startTime=t,this.perMinCounter=0);var s=n.globalSettings.maxItems,l=n.globalSettings.itemsPerMinute;if(o(e,s,this.counter))return a(this.platform,this.platformOptions,s+" max items reached",!1);if(o(e,l,this.perMinCounter))return a(this.platform,this.platformOptions,l+" items per minute reached",!1);this.counter++,this.perMinCounter++;var c=!o(e,s,this.counter),u=c;return c=c&&!o(e,l,this.perMinCounter),a(this.platform,this.platformOptions,null,c,s,l,u)},n.prototype.setPlatformOptions=function(e,t){this.platform=e,this.platformOptions=t},e.exports=n},534:(e,t,r)=>{var i=r(306),n=r(539);e.exports=function(e,t,r,o,a,s){var l,c;n.isFiniteNumber(s)&&(l=new AbortController,c=setTimeout(function(){l.abort()},s)),fetch(t,{method:r,headers:{"Content-Type":"application/json","X-Rollbar-Access-Token":e,signal:l&&l.signal},body:o}).then(function(e){return c&&clearTimeout(c),e.json()}).then(function(e){a(null,e)}).catch(function(e){i.error(e.message),a(e)})}},537:e=>{e.exports={scrubFields:["pw","pass","passwd","password","secret","confirm_password","confirmPassword","password_confirmation","passwordConfirmation","access_token","accessToken","X-Rollbar-Access-Token","secret_key","secretKey","secretToken","cc-number","card number","cardnumber","cardnum","ccnum","ccnumber","cc num","creditcardnumber","credit card number","newcreditcardnumber","new credit card","creditcardno","credit card no","card#","card #","cc-csc","cvc","cvc2","cvv2","ccv2","security code","card verification","name on credit card","name on card","nameoncard","cardholder","card holder","name des karteninhabers","ccname","card type","cardtype","cc type","cctype","payment type","expiration date","expirationdate","expdate","cc-exp","ccmonth","ccyear"]}},538:e=>{e.exports=function(e){var t,r,i,n,o,a,s,l,c,u,h,d,p,f=/[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;function m(e){return e<10?"0"+e:e}function g(){return this.valueOf()}function _(e){return f.lastIndex=0,f.test(e)?'"'+e.replace(f,function(e){var t=i[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function y(e,i){var o,a,s,l,c,u=t,h=i[e];switch(h&&"object"==typeof h&&"function"==typeof h.toJSON&&(h=h.toJSON(e)),"function"==typeof n&&(h=n.call(i,e,h)),typeof h){case"string":return _(h);case"number":return isFinite(h)?String(h):"null";case"boolean":case"null":return String(h);case"object":if(!h)return"null";if(t+=r,c=[],"[object Array]"===Object.prototype.toString.apply(h)){for(l=h.length,o=0;o<l;o+=1)c[o]=y(o,h)||"null";return s=0===c.length?"[]":t?"[\n"+t+c.join(",\n"+t)+"\n"+u+"]":"["+c.join(",")+"]",t=u,s}if(n&&"object"==typeof n)for(l=n.length,o=0;o<l;o+=1)"string"==typeof n[o]&&(s=y(a=n[o],h))&&c.push(_(a)+(t?": ":":")+s);else for(a in h)Object.prototype.hasOwnProperty.call(h,a)&&(s=y(a,h))&&c.push(_(a)+(t?": ":":")+s);return s=0===c.length?"{}":t?"{\n"+t+c.join(",\n"+t)+"\n"+u+"}":"{"+c.join(",")+"}",t=u,s}}"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+m(this.getUTCMonth()+1)+"-"+m(this.getUTCDate())+"T"+m(this.getUTCHours())+":"+m(this.getUTCMinutes())+":"+m(this.getUTCSeconds())+"Z":null},Boolean.prototype.toJSON=g,Number.prototype.toJSON=g,String.prototype.toJSON=g),"function"!=typeof e.stringify&&(i={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},e.stringify=function(e,i,o){var a;if(t="",r="","number"==typeof o)for(a=0;a<o;a+=1)r+=" ";else"string"==typeof o&&(r=o);if(n=i,i&&"function"!=typeof i&&("object"!=typeof i||"number"!=typeof i.length))throw new Error("JSON.stringify");return y("",{"":e})}),"function"!=typeof e.parse&&(e.parse=(u={"\\":"\\",'"':'"',"/":"/",t:"\t",n:"\n",r:"\r",f:"\f",b:"\b"},h={go:function(){o="ok"},firstokey:function(){l=c,o="colon"},okey:function(){l=c,o="colon"},ovalue:function(){o="ocomma"},firstavalue:function(){o="acomma"},avalue:function(){o="acomma"}},d={go:function(){o="ok"},ovalue:function(){o="ocomma"},firstavalue:function(){o="acomma"},avalue:function(){o="acomma"}},p={"{":{go:function(){a.push({state:"ok"}),s={},o="firstokey"},ovalue:function(){a.push({container:s,state:"ocomma",key:l}),s={},o="firstokey"},firstavalue:function(){a.push({container:s,state:"acomma"}),s={},o="firstokey"},avalue:function(){a.push({container:s,state:"acomma"}),s={},o="firstokey"}},"}":{firstokey:function(){var e=a.pop();c=s,s=e.container,l=e.key,o=e.state},ocomma:function(){var e=a.pop();s[l]=c,c=s,s=e.container,l=e.key,o=e.state}},"[":{go:function(){a.push({state:"ok"}),s=[],o="firstavalue"},ovalue:function(){a.push({container:s,state:"ocomma",key:l}),s=[],o="firstavalue"},firstavalue:function(){a.push({container:s,state:"acomma"}),s=[],o="firstavalue"},avalue:function(){a.push({container:s,state:"acomma"}),s=[],o="firstavalue"}},"]":{firstavalue:function(){var e=a.pop();c=s,s=e.container,l=e.key,o=e.state},acomma:function(){var e=a.pop();s.push(c),c=s,s=e.container,l=e.key,o=e.state}},":":{colon:function(){if(Object.hasOwnProperty.call(s,l))throw new SyntaxError("Duplicate key '"+l+'"');o="ovalue"}},",":{ocomma:function(){s[l]=c,o="okey"},acomma:function(){s.push(c),o="avalue"}},true:{go:function(){c=!0,o="ok"},ovalue:function(){c=!0,o="ocomma"},firstavalue:function(){c=!0,o="acomma"},avalue:function(){c=!0,o="acomma"}},false:{go:function(){c=!1,o="ok"},ovalue:function(){c=!1,o="ocomma"},firstavalue:function(){c=!1,o="acomma"},avalue:function(){c=!1,o="acomma"}},null:{go:function(){c=null,o="ok"},ovalue:function(){c=null,o="ocomma"},firstavalue:function(){c=null,o="acomma"},avalue:function(){c=null,o="acomma"}}},function(e,t){var r,i,n=/^[\u0020\t\n\r]*(?:([,:\[\]{}]|true|false|null)|(-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)|"((?:[^\r\n\t\\\"]|\\(?:["\\\/trnfb]|u[0-9a-fA-F]{4}))*)")/;o="go",a=[];try{for(;r=n.exec(e);)r[1]?p[r[1]][o]():r[2]?(c=+r[2],d[o]()):(i=r[3],c=i.replace(/\\(?:u(.{4})|([^u]))/g,function(e,t,r){return t?String.fromCharCode(parseInt(t,16)):u[r]}),h[o]()),e=e.slice(r[0].length)}catch(e){o=e}if("ok"!==o||/[^\u0020\t\n\r]/.test(e))throw o instanceof SyntaxError?o:new SyntaxError("JSON");return"function"==typeof t?function e(r,i){var n,o,a=r[i];if(a&&"object"==typeof a)for(n in c)Object.prototype.hasOwnProperty.call(a,n)&&(void 0!==(o=e(a,n))?a[n]=o:delete a[n]);return t.call(r,i,a)}({"":c},""):c}))}},539:(e,t,r)=>{var i=r(215),n={};function o(e,t){return t===a(e)}function a(e){var t=typeof e;return"object"!==t?t:e?e instanceof Error?"error":{}.toString.call(e).match(/\s([a-zA-Z]+)/)[1].toLowerCase():"null"}function s(e){return o(e,"function")}function l(e){var t=Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?"),r=RegExp("^"+t+"$");return c(e)&&r.test(e)}function c(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function u(){var e=y();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var r=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?r:7&r|8).toString(16)})}var h={strictMode:!1,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}};function d(e,t){var r,i;try{r=n.stringify(e)}catch(n){if(t&&s(t))try{r=t(e)}catch(e){i=e}else i=n}return{error:i,value:r}}function p(e,t){return function(r,i){try{t(r,i)}catch(t){e.error(t)}}}function f(e){return function e(t,r){var i,n,s,l={};try{for(n in t)(i=t[n])&&(o(i,"object")||o(i,"array"))?r.includes(i)?l[n]="Removed circular reference: "+a(i):((s=r.slice()).push(i),l[n]=e(i,s)):l[n]=i}catch(e){l="Failed cloning custom data: "+e.message}return l}(e,[e])}var m=["log","network","dom","navigation","error","manual"],g=["critical","error","warning","info","debug"];function _(e,t){for(var r=0;r<e.length;++r)if(e[r]===t)return!0;return!1}function y(){return Date.now?+Date.now():+new Date}e.exports={addParamsAndAccessTokenToPath:function(e,t,r){(r=r||{}).access_token=e;var i,n=[];for(i in r)Object.prototype.hasOwnProperty.call(r,i)&&n.push([i,r[i]].join("="));var o="?"+n.sort().join("&");(t=t||{}).path=t.path||"";var a,s=t.path.indexOf("?"),l=t.path.indexOf("#");-1!==s&&(-1===l||l>s)?(a=t.path,t.path=a.substring(0,s)+o+"&"+a.substring(s+1)):-1!==l?(a=t.path,t.path=a.substring(0,l)+o+a.substring(l)):t.path=t.path+o},createItem:function(e,t,r,i,n){for(var o,s,l,c,h,d,m=[],g=[],_=0,v=e.length;_<v;++_){var b=a(d=e[_]);switch(g.push(b),b){case"undefined":break;case"string":o?m.push(d):o=d;break;case"function":c=p(t,d);break;case"date":m.push(d);break;case"error":case"domexception":case"exception":s?m.push(d):s=d;break;case"object":case"array":if(d instanceof Error||"undefined"!=typeof DOMException&&d instanceof DOMException){s?m.push(d):s=d;break}if(i&&"object"===b&&!h){for(var x=0,w=i.length;x<w;++x)if(void 0!==d[i[x]]){h=d;break}if(h)break}l?m.push(d):l=d;break;default:if(d instanceof Error||"undefined"!=typeof DOMException&&d instanceof DOMException){s?m.push(d):s=d;break}m.push(d)}}l&&(l=f(l)),m.length>0&&(l||(l=f({})),l.extraArgs=f(m));var T={message:o,err:s,custom:l,timestamp:y(),callback:c,notifier:r,diagnostic:{},uuid:u()};return function(e,t){t&&void 0!==t.level&&(e.level=t.level,delete t.level),t&&void 0!==t.skipFrames&&(e.skipFrames=t.skipFrames,delete t.skipFrames)}(T,l),i&&h&&(T.request=h),n&&(T.lambdaContext=n),T._originalArgs=e,T.diagnostic.original_arg_types=g,T},addErrorContext:function(e,t){var r=e.data.custom||{},n=!1;try{for(var o=0;o<t.length;++o)t[o].hasOwnProperty("rollbarContext")&&(r=i(r,f(t[o].rollbarContext)),n=!0);n&&(e.data.custom=r)}catch(t){e.diagnostic.error_context="Failed: "+t.message}},createTelemetryEvent:function(e){for(var t,r,i,n,o=0,s=e.length;o<s;++o)switch(a(n=e[o])){case"string":!t&&_(m,n)?t=n:!i&&_(g,n)&&(i=n);break;case"object":r=n}return{type:t||"manual",metadata:r||{},level:i}},filterIp:function(e,t){if(e&&e.user_ip&&!0!==t){var r=e.user_ip;if(t)try{var i;if(-1!==r.indexOf("."))(i=r.split(".")).pop(),i.push("0"),r=i.join(".");else if(-1!==r.indexOf(":")){if((i=r.split(":")).length>2){var n=i.slice(0,3),o=n[2].indexOf("/");-1!==o&&(n[2]=n[2].substring(0,o)),r=n.concat("0000:0000:0000:0000:0000").join(":")}}else r=null}catch(e){r=null}else r=null;e.user_ip=r}},formatArgsAsString:function(e){var t,r,i,n=[];for(t=0,r=e.length;t<r;++t){switch(a(i=e[t])){case"object":(i=(i=d(i)).error||i.value).length>500&&(i=i.substr(0,497)+"...");break;case"null":i="null";break;case"undefined":i="undefined";break;case"symbol":i=i.toString()}n.push(i)}return n.join(" ")},formatUrl:function(e,t){if(!(t=t||e.protocol)&&e.port&&(80===e.port?t="http:":443===e.port&&(t="https:")),t=t||"https:",!e.hostname)return null;var r=t+"//"+e.hostname;return e.port&&(r=r+":"+e.port),e.path&&(r+=e.path),r},get:function(e,t){if(e){var r=t.split("."),i=e;try{for(var n=0,o=r.length;n<o;++n)i=i[r[n]]}catch(e){i=void 0}return i}},handleOptions:function(e,t,r,n){var o=i(e,t,r);return o=function(e,t){return e.hostWhiteList&&!e.hostSafeList&&(e.hostSafeList=e.hostWhiteList,e.hostWhiteList=void 0,t&&t.log("hostWhiteList is deprecated. Use hostSafeList.")),e.hostBlackList&&!e.hostBlockList&&(e.hostBlockList=e.hostBlackList,e.hostBlackList=void 0,t&&t.log("hostBlackList is deprecated. Use hostBlockList.")),e}(o,n),!t||t.overwriteScrubFields||t.scrubFields&&(o.scrubFields=(e.scrubFields||[]).concat(t.scrubFields)),o},isError:function(e){return o(e,"error")||o(e,"exception")},isFiniteNumber:function(e){return Number.isFinite(e)},isFunction:s,isIterable:function(e){var t=a(e);return"object"===t||"array"===t},isNativeFunction:l,isObject:c,isString:function(e){return"string"==typeof e||e instanceof String},isType:o,isPromise:function(e){return c(e)&&o(e.then,"function")},jsonParse:function(e){var t,r;try{t=n.parse(e)}catch(e){r=e}return{error:r,value:t}},LEVELS:{debug:0,info:1,warning:2,error:3,critical:4},makeUnhandledStackInfo:function(e,t,r,i,n,o,a,s){var l={url:t||"",line:r,column:i};l.func=s.guessFunctionName(l.url,l.line),l.context=s.gatherContext(l.url,l.line);var c="undefined"!=typeof document&&document&&document.location&&document.location.href,u="undefined"!=typeof window&&window&&window.navigator&&window.navigator.userAgent;return{mode:o,message:n?String(n):e||a,url:c,stack:[l],useragent:u}},merge:i,now:y,redact:function(){return"********"},RollbarJSON:n,sanitizeUrl:function(e){var t=function(e){if(o(e,"string")){for(var t=h,r=t.parser[t.strictMode?"strict":"loose"].exec(e),i={},n=0,a=t.key.length;n<a;++n)i[t.key[n]]=r[n]||"";return i[t.q.name]={},i[t.key[12]].replace(t.q.parser,function(e,r,n){r&&(i[t.q.name][r]=n)}),i}}(e);return t?(""===t.anchor&&(t.source=t.source.replace("#","")),e=t.source.replace("?"+t.query,"")):"(unknown)"},set:function(e,t,r){if(e){Object.setPrototypeOf(e,null);var i=t.split("."),n=i.length;if(!(n<1))if(1!==n)try{for(var o=e[i[0]]||{},a=o,s=1;s<n-1;++s)o[i[s]]=o[i[s]]||{},o=o[i[s]];o[i[n-1]]=r,e[i[0]]=a}catch(e){return}else e[i[0]]=r}},setupJSON:function(e){s(n.stringify)&&s(n.parse)||(o(JSON,"undefined")||(e?(l(JSON.stringify)&&(n.stringify=JSON.stringify),l(JSON.parse)&&(n.parse=JSON.parse)):(s(JSON.stringify)&&(n.stringify=JSON.stringify),s(JSON.parse)&&(n.parse=JSON.parse))),s(n.stringify)&&s(n.parse)||e&&e(n))},stringify:d,maxByteSize:function(e){for(var t=0,r=e.length,i=0;i<r;i++){var n=e.charCodeAt(i);n<128?t+=1:n<2048?t+=2:n<65536&&(t+=3)}return t},typeName:a,uuid4:u}},581:(e,t,r)=>{var i=r(539);function n(e,t,r){if(!e)return!r;var n,o,a=e.frames;if(!a||0===a.length)return!r;for(var s=t.length,l=a.length,c=0;c<l;c++){if(n=a[c].filename,!i.isType(n,"string"))return!r;for(var u=0;u<s;u++)if(o=t[u],new RegExp(o).test(n))return!0}return!1}function o(e,t,r,o){var a,s,l=!1;"blocklist"===r&&(l=!0);try{if(a=l?t.hostBlockList:t.hostSafeList,s=i.get(e,"body.trace_chain")||[i.get(e,"body.trace")],!a||0===a.length)return!l;if(0===s.length||!s[0])return!l;for(var c=s.length,u=0;u<c;u++)if(n(s[u],a,l))return!0}catch(e){l?t.hostBlockList=null:t.hostSafeList=null;var h=l?"hostBlockList":"hostSafeList";return o.error("Error while reading your configuration's "+h+" option. Removing custom "+h+".",e),!l}return!1}e.exports={checkLevel:function(e,t){var r=e.level,n=i.LEVELS[r]||0,o=t.reportLevel;return!(n<(i.LEVELS[o]||0))},userCheckIgnore:function(e){return function(t,r){var n=!!t._isUncaught;delete t._isUncaught;var o=t._originalArgs;delete t._originalArgs;try{i.isFunction(r.onSendCallback)&&r.onSendCallback(n,o,t)}catch(t){r.onSendCallback=null,e.error("Error while calling onSendCallback, removing",t)}try{if(i.isFunction(r.checkIgnore)&&r.checkIgnore(n,o,t))return!1}catch(t){r.checkIgnore=null,e.error("Error while calling custom checkIgnore(), removing",t)}return!0}},urlIsNotBlockListed:function(e){return function(t,r){return!o(t,r,"blocklist",e)}},urlIsSafeListed:function(e){return function(t,r){return o(t,r,"safelist",e)}},messageIsIgnored:function(e){return function(t,r){var n,o,a,s,l,c;try{if(!(a=r.ignoredMessages)||0===a.length)return!0;if(c=function(e){var t=e.body,r=[];if(t.trace_chain)for(var n=t.trace_chain,o=0;o<n.length;o++){var a=n[o];r.push(i.get(a,"exception.message"))}return t.trace&&r.push(i.get(t,"trace.exception.message")),t.message&&r.push(i.get(t,"message.body")),r}(t),0===c.length)return!0;for(s=a.length,n=0;n<s;n++)for(l=new RegExp(a[n],"gi"),o=0;o<c.length;o++)if(l.test(c[o]))return!1}catch(t){r.ignoredMessages=null,e.error("Error while reading your configuration's ignoredMessages option. Removing custom ignoredMessages.")}return!0}}}},584:(e,t,r)=>{var i=r(539);e.exports={checkIgnore:function(e,t){return!i.get(t,"plugins.jquery.ignoreAjaxErrors")||!i.get(e,"body.message.extra.isAjax")}}},683:(e,t,r)=>{var i=r(539),n=r(974),o=r(364),a=r(356),s=r(61),l=r(790),c={network:!0,networkResponseHeaders:!1,networkResponseBody:!1,networkRequestHeaders:!1,networkRequestBody:!1,networkErrorOnHttp5xx:!1,networkErrorOnHttp4xx:!1,networkErrorOnHttp0:!1,log:!0,dom:!0,navigation:!0,connectivity:!0,contentSecurityPolicy:!0,errorOnContentSecurityPolicy:!1};function u(e,t){for(var r;e[t].length;)(r=e[t].shift())[0][r[1]]=r[2]}function h(e,t,r,n,o){this.options=e;var a=e.autoInstrument;!1===e.enabled||!1===a?this.autoInstrument={}:(i.isType(a,"object")||(a=c),this.autoInstrument=i.merge(c,a)),this.scrubTelemetryInputs=!!e.scrubTelemetryInputs,this.telemetryScrubber=e.telemetryScrubber,this.defaultValueScrubber=function(e){for(var t=[],r=0;r<e.length;++r)t.push(new RegExp(e[r],"i"));return function(e){var r=function(e){if(!e||!e.attributes)return null;for(var t=e.attributes,r=0;r<t.length;++r)if("name"===t[r].key)return t[r].value;return null}(e);if(!r)return!1;for(var i=0;i<t.length;++i)if(t[i].test(r))return!0;return!1}}(e.scrubFields),this.telemeter=t,this.rollbar=r,this.diagnostic=r.client.notifier.diagnostic,this._window=n||{},this._document=o||{},this.replacements={network:[],log:[],navigation:[],connectivity:[]},this.eventRemovers={dom:[],connectivity:[],contentsecuritypolicy:[]},this._location=this._window.location,this._lastHref=this._location&&this._location.href}function d(e){return"undefined"!=typeof URL&&e instanceof URL}h.prototype.configure=function(e){this.options=i.merge(this.options,e);var t=e.autoInstrument,r=i.merge(this.autoInstrument);!1===e.enabled||!1===t?this.autoInstrument={}:(i.isType(t,"object")||(t=c),this.autoInstrument=i.merge(c,t)),this.instrument(r),void 0!==e.scrubTelemetryInputs&&(this.scrubTelemetryInputs=!!e.scrubTelemetryInputs),void 0!==e.telemetryScrubber&&(this.telemetryScrubber=e.telemetryScrubber)},h.prototype.instrument=function(e){!this.autoInstrument.network||e&&e.network?!this.autoInstrument.network&&e&&e.network&&this.deinstrumentNetwork():this.instrumentNetwork(),!this.autoInstrument.log||e&&e.log?!this.autoInstrument.log&&e&&e.log&&this.deinstrumentConsole():this.instrumentConsole(),!this.autoInstrument.dom||e&&e.dom?!this.autoInstrument.dom&&e&&e.dom&&this.deinstrumentDom():this.instrumentDom(),!this.autoInstrument.navigation||e&&e.navigation?!this.autoInstrument.navigation&&e&&e.navigation&&this.deinstrumentNavigation():this.instrumentNavigation(),!this.autoInstrument.connectivity||e&&e.connectivity?!this.autoInstrument.connectivity&&e&&e.connectivity&&this.deinstrumentConnectivity():this.instrumentConnectivity(),!this.autoInstrument.contentSecurityPolicy||e&&e.contentSecurityPolicy?!this.autoInstrument.contentSecurityPolicy&&e&&e.contentSecurityPolicy&&this.deinstrumentContentSecurityPolicy():this.instrumentContentSecurityPolicy()},h.prototype.deinstrumentNetwork=function(){u(this.replacements,"network")},h.prototype.instrumentNetwork=function(){var e=this;function t(t,r){t in r&&i.isFunction(r[t])&&o(r,t,function(t){return e.rollbar.wrap(t)})}if("XMLHttpRequest"in this._window){var r=this._window.XMLHttpRequest.prototype;o(r,"open",function(e){return function(t,r){var n=d(r);return(i.isType(r,"string")||n)&&(r=n?r.toString():r,this.__rollbar_xhr?(this.__rollbar_xhr.method=t,this.__rollbar_xhr.url=r,this.__rollbar_xhr.status_code=null,this.__rollbar_xhr.start_time_ms=i.now(),this.__rollbar_xhr.end_time_ms=null):this.__rollbar_xhr={method:t,url:r,status_code:null,start_time_ms:i.now(),end_time_ms:null}),e.apply(this,arguments)}},this.replacements,"network"),o(r,"setRequestHeader",function(t){return function(r,n){return this.__rollbar_xhr||(this.__rollbar_xhr={}),i.isType(r,"string")&&i.isType(n,"string")&&(e.autoInstrument.networkRequestHeaders&&(this.__rollbar_xhr.request_headers||(this.__rollbar_xhr.request_headers={}),this.__rollbar_xhr.request_headers[r]=n),"content-type"===r.toLowerCase()&&(this.__rollbar_xhr.request_content_type=n)),t.apply(this,arguments)}},this.replacements,"network"),o(r,"send",function(r){return function(n){var a=this;function s(){if(a.__rollbar_xhr&&(null===a.__rollbar_xhr.status_code&&(a.__rollbar_xhr.status_code=0,e.autoInstrument.networkRequestBody&&(a.__rollbar_xhr.request=n),a.__rollbar_event=e.captureNetwork(a.__rollbar_xhr,"xhr",void 0)),a.readyState<2&&(a.__rollbar_xhr.start_time_ms=i.now()),a.readyState>3)){a.__rollbar_xhr.end_time_ms=i.now();var t=null;if(a.__rollbar_xhr.response_content_type=a.getResponseHeader("Content-Type"),e.autoInstrument.networkResponseHeaders){var r=e.autoInstrument.networkResponseHeaders;t={};try{var o,s;if(!0===r){var l=a.getAllResponseHeaders();if(l){var c,u,h=l.trim().split(/[\r\n]+/);for(s=0;s<h.length;s++)o=(c=h[s].split(": ")).shift(),u=c.join(": "),t[o]=u}}else for(s=0;s<r.length;s++)t[o=r[s]]=a.getResponseHeader(o)}catch(e){}}var d=null;if(e.autoInstrument.networkResponseBody)try{d=a.responseText}catch(e){}var p=null;(d||t)&&(p={},d&&(e.isJsonContentType(a.__rollbar_xhr.response_content_type)?p.body=e.scrubJson(d):p.body=d),t&&(p.headers=t)),p&&(a.__rollbar_xhr.response=p);try{var f=a.status;f=1223===f?204:f,a.__rollbar_xhr.status_code=f,a.__rollbar_event.level=e.telemeter.levelFromStatus(f),e.errorOnHttpStatus(a.__rollbar_xhr)}catch(e){}}}return t("onload",a),t("onerror",a),t("onprogress",a),"onreadystatechange"in a&&i.isFunction(a.onreadystatechange)?o(a,"onreadystatechange",function(t){return e.rollbar.wrap(t,void 0,s)}):a.onreadystatechange=s,a.__rollbar_xhr&&e.trackHttpErrors()&&(a.__rollbar_xhr.stack=(new Error).stack),r.apply(this,arguments)}},this.replacements,"network")}"fetch"in this._window&&o(this._window,"fetch",function(t){return function(r,o){for(var a=new Array(arguments.length),s=0,l=a.length;s<l;s++)a[s]=arguments[s];var c,u=a[0],h="GET",p=d(u);i.isType(u,"string")||p?c=p?u.toString():u:u&&(c=u.url,u.method&&(h=u.method)),a[1]&&a[1].method&&(h=a[1].method);var f={method:h,url:c,status_code:null,start_time_ms:i.now(),end_time_ms:null};if(a[1]&&a[1].headers){var m=n(a[1].headers);f.request_content_type=m.get("Content-Type"),e.autoInstrument.networkRequestHeaders&&(f.request_headers=e.fetchHeaders(m,e.autoInstrument.networkRequestHeaders))}return e.autoInstrument.networkRequestBody&&(a[1]&&a[1].body?f.request=a[1].body:a[0]&&!i.isType(a[0],"string")&&a[0].body&&(f.request=a[0].body)),e.captureNetwork(f,"fetch",void 0),e.trackHttpErrors()&&(f.stack=(new Error).stack),t.apply(this,a).then(function(t){f.end_time_ms=i.now(),f.status_code=t.status,f.response_content_type=t.headers.get("Content-Type");var r=null;e.autoInstrument.networkResponseHeaders&&(r=e.fetchHeaders(t.headers,e.autoInstrument.networkResponseHeaders));var n=null;return e.autoInstrument.networkResponseBody&&"function"==typeof t.text&&(n=t.clone().text()),(r||n)&&(f.response={},n&&("function"==typeof n.then?n.then(function(t){t&&e.isJsonContentType(f.response_content_type)?f.response.body=e.scrubJson(t):f.response.body=t}):f.response.body=n),r&&(f.response.headers=r)),e.errorOnHttpStatus(f),t})}},this.replacements,"network")},h.prototype.captureNetwork=function(e,t,r){return e.request&&this.isJsonContentType(e.request_content_type)&&(e.request=this.scrubJson(e.request)),this.telemeter.captureNetwork(e,t,r)},h.prototype.isJsonContentType=function(e){return!!(e&&i.isType(e,"string")&&e.toLowerCase().includes("json"))},h.prototype.scrubJson=function(e){return JSON.stringify(a(JSON.parse(e),this.options.scrubFields))},h.prototype.fetchHeaders=function(e,t){var r={};try{var i;if(!0===t){if("function"==typeof e.entries)for(var n=e.entries(),o=n.next();!o.done;)r[o.value[0]]=o.value[1],o=n.next()}else for(i=0;i<t.length;i++){var a=t[i];r[a]=e.get(a)}}catch(e){}return r},h.prototype.trackHttpErrors=function(){return this.autoInstrument.networkErrorOnHttp5xx||this.autoInstrument.networkErrorOnHttp4xx||this.autoInstrument.networkErrorOnHttp0},h.prototype.errorOnHttpStatus=function(e){var t=e.status_code;if(t>=500&&this.autoInstrument.networkErrorOnHttp5xx||t>=400&&this.autoInstrument.networkErrorOnHttp4xx||0===t&&this.autoInstrument.networkErrorOnHttp0){var r=new Error("HTTP request failed with Status "+t);r.stack=e.stack,this.rollbar.error(r,{skipFrames:1})}},h.prototype.deinstrumentConsole=function(){if("console"in this._window&&this._window.console.log)for(var e;this.replacements.log.length;)e=this.replacements.log.shift(),this._window.console[e[0]]=e[1]},h.prototype.instrumentConsole=function(){if("console"in this._window&&this._window.console.log){var e=this,t=this._window.console,r=["debug","info","warn","error","log"];try{for(var n=0,o=r.length;n<o;n++)a(r[n])}catch(e){this.diagnostic.instrumentConsole={error:e.message}}}function a(r){var n=t[r],o=t,a="warn"===r?"warning":r;t[r]=function(){var t=Array.prototype.slice.call(arguments),r=i.formatArgsAsString(t);e.telemeter.captureLog(r,a),n&&Function.prototype.apply.call(n,o,t)},e.replacements.log.push([r,n])}},h.prototype.deinstrumentDom=function(){("addEventListener"in this._window||"attachEvent"in this._window)&&this.removeListeners("dom")},h.prototype.instrumentDom=function(){if("addEventListener"in this._window||"attachEvent"in this._window){var e=this.handleClick.bind(this),t=this.handleBlur.bind(this);this.addListener("dom",this._window,"click","onclick",e,!0),this.addListener("dom",this._window,"blur","onfocusout",t,!0)}},h.prototype.handleClick=function(e){try{var t=l.getElementFromEvent(e,this._document),r=t&&t.tagName,i=l.isDescribedElement(t,"a")||l.isDescribedElement(t,"button");r&&(i||l.isDescribedElement(t,"input",["button","submit"]))?this.captureDomEvent("click",t):l.isDescribedElement(t,"input",["checkbox","radio"])&&this.captureDomEvent("input",t,t.value,t.checked)}catch(e){}},h.prototype.handleBlur=function(e){try{var t=l.getElementFromEvent(e,this._document);t&&t.tagName&&(l.isDescribedElement(t,"textarea")?this.captureDomEvent("input",t,t.value):l.isDescribedElement(t,"select")&&t.options&&t.options.length?this.handleSelectInputChanged(t):l.isDescribedElement(t,"input")&&!l.isDescribedElement(t,"input",["button","submit","hidden","checkbox","radio"])&&this.captureDomEvent("input",t,t.value))}catch(e){}},h.prototype.handleSelectInputChanged=function(e){if(e.multiple)for(var t=0;t<e.options.length;t++)e.options[t].selected&&this.captureDomEvent("input",e,e.options[t].value);else e.selectedIndex>=0&&e.options[e.selectedIndex]&&this.captureDomEvent("input",e,e.options[e.selectedIndex].value)},h.prototype.captureDomEvent=function(e,t,r,i){if(void 0!==r)if(this.scrubTelemetryInputs||"password"===l.getElementType(t))r="[scrubbed]";else{var n=l.describeElement(t);this.telemetryScrubber?this.telemetryScrubber(n)&&(r="[scrubbed]"):this.defaultValueScrubber(n)&&(r="[scrubbed]")}var o=l.elementArrayToString(l.treeToArray(t));this.telemeter.captureDom(e,o,r,i)},h.prototype.deinstrumentNavigation=function(){var e=this._window.chrome;!(e&&e.app&&e.app.runtime)&&this._window.history&&this._window.history.pushState&&u(this.replacements,"navigation")},h.prototype.instrumentNavigation=function(){var e=this._window.chrome;if(!(e&&e.app&&e.app.runtime)&&this._window.history&&this._window.history.pushState){var t=this;o(this._window,"onpopstate",function(e){return function(){var r=t._location.href;t.handleUrlChange(t._lastHref,r),e&&e.apply(this,arguments)}},this.replacements,"navigation"),o(this._window.history,"pushState",function(e){return function(){var r=arguments.length>2?arguments[2]:void 0;return r&&t.handleUrlChange(t._lastHref,r+""),e.apply(this,arguments)}},this.replacements,"navigation")}},h.prototype.handleUrlChange=function(e,t){var r=s.parse(this._location.href),i=s.parse(t),n=s.parse(e);this._lastHref=t,r.protocol===i.protocol&&r.host===i.host&&(t=i.path+(i.hash||"")),r.protocol===n.protocol&&r.host===n.host&&(e=n.path+(n.hash||"")),this.telemeter.captureNavigation(e,t)},h.prototype.deinstrumentConnectivity=function(){("addEventListener"in this._window||"body"in this._document)&&(this._window.addEventListener?this.removeListeners("connectivity"):u(this.replacements,"connectivity"))},h.prototype.instrumentConnectivity=function(){if("addEventListener"in this._window||"body"in this._document)if(this._window.addEventListener)this.addListener("connectivity",this._window,"online",void 0,function(){this.telemeter.captureConnectivityChange("online")}.bind(this),!0),this.addListener("connectivity",this._window,"offline",void 0,function(){this.telemeter.captureConnectivityChange("offline")}.bind(this),!0);else{var e=this;o(this._document.body,"ononline",function(t){return function(){e.telemeter.captureConnectivityChange("online"),t&&t.apply(this,arguments)}},this.replacements,"connectivity"),o(this._document.body,"onoffline",function(t){return function(){e.telemeter.captureConnectivityChange("offline"),t&&t.apply(this,arguments)}},this.replacements,"connectivity")}},h.prototype.handleCspEvent=function(e){var t="Security Policy Violation: blockedURI: "+e.blockedURI+", violatedDirective: "+e.violatedDirective+", effectiveDirective: "+e.effectiveDirective+", ";e.sourceFile&&(t+="location: "+e.sourceFile+", line: "+e.lineNumber+", col: "+e.columnNumber+", "),t+="originalPolicy: "+e.originalPolicy,this.telemeter.captureLog(t,"error"),this.handleCspError(t)},h.prototype.handleCspError=function(e){this.autoInstrument.errorOnContentSecurityPolicy&&this.rollbar.error(e)},h.prototype.deinstrumentContentSecurityPolicy=function(){"addEventListener"in this._document&&this.removeListeners("contentsecuritypolicy")},h.prototype.instrumentContentSecurityPolicy=function(){if("addEventListener"in this._document){var e=this.handleCspEvent.bind(this);this.addListener("contentsecuritypolicy",this._document,"securitypolicyviolation",null,e,!1)}},h.prototype.addListener=function(e,t,r,i,n,o){t.addEventListener?(t.addEventListener(r,n,o),this.eventRemovers[e].push(function(){t.removeEventListener(r,n,o)})):i&&(t.attachEvent(i,n),this.eventRemovers[e].push(function(){t.detachEvent(i,n)}))},h.prototype.removeListeners=function(e){for(;this.eventRemovers[e].length;)this.eventRemovers[e].shift()()},e.exports=h},738:function(){!function(e){e.console||(e.console={});for(var t,r,i=e.console,n=function(){},o=["memory"],a="assert,clear,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn".split(",");t=o.pop();)i[t]||(i[t]={});for(;r=a.pop();)i[r]||(i[r]=n)}("undefined"==typeof window?this:window)},744:(e,t,r)=>{var i=r(539);function n(e,t,r,i){this.rateLimiter=e,this.api=t,this.logger=r,this.options=i,this.predicates=[],this.pendingItems=[],this.pendingRequests=[],this.retryQueue=[],this.retryHandle=null,this.waitCallback=null,this.waitIntervalID=null}n.prototype.configure=function(e){this.api&&this.api.configure(e);var t=this.options;return this.options=i.merge(t,e),this},n.prototype.addPredicate=function(e){return i.isFunction(e)&&this.predicates.push(e),this},n.prototype.addPendingItem=function(e){this.pendingItems.push(e)},n.prototype.removePendingItem=function(e){var t=this.pendingItems.indexOf(e);-1!==t&&this.pendingItems.splice(t,1)},n.prototype.addItem=function(e,t,r,n){t&&i.isFunction(t)||(t=function(){});var o=this._applyPredicates(e);if(o.stop)return this.removePendingItem(n),void t(o.err);if(this._maybeLog(e,r),this.removePendingItem(n),this.options.transmit){this.pendingRequests.push(e);try{this._makeApiRequest(e,function(r,i){this._dequeuePendingRequest(e),t(r,i)}.bind(this))}catch(r){this._dequeuePendingRequest(e),t(r)}}else t(new Error("Transmit disabled"))},n.prototype.wait=function(e){i.isFunction(e)&&(this.waitCallback=e,this._maybeCallWait()||(this.waitIntervalID&&(this.waitIntervalID=clearInterval(this.waitIntervalID)),this.waitIntervalID=setInterval(function(){this._maybeCallWait()}.bind(this),500)))},n.prototype._applyPredicates=function(e){for(var t=null,r=0,i=this.predicates.length;r<i;r++)if(!(t=this.predicates[r](e,this.options))||void 0!==t.err)return{stop:!0,err:t.err};return{stop:!1,err:null}},n.prototype._makeApiRequest=function(e,t){var r=this.rateLimiter.shouldSend(e);r.shouldSend?this.api.postItem(e,function(r,i){r?this._maybeRetry(r,e,t):t(r,i)}.bind(this)):r.error?t(r.error):this.api.postItem(r.payload,t)};var o=["ECONNRESET","ENOTFOUND","ESOCKETTIMEDOUT","ETIMEDOUT","ECONNREFUSED","EHOSTUNREACH","EPIPE","EAI_AGAIN"];n.prototype._maybeRetry=function(e,t,r){var n=!1;if(this.options.retryInterval){for(var a=0,s=o.length;a<s;a++)if(e.code===o[a]){n=!0;break}n&&i.isFiniteNumber(this.options.maxRetries)&&(t.retries=t.retries?t.retries+1:1,t.retries>this.options.maxRetries&&(n=!1))}n?this._retryApiRequest(t,r):r(e)},n.prototype._retryApiRequest=function(e,t){this.retryQueue.push({item:e,callback:t}),this.retryHandle||(this.retryHandle=setInterval(function(){for(;this.retryQueue.length;){var e=this.retryQueue.shift();this._makeApiRequest(e.item,e.callback)}}.bind(this),this.options.retryInterval))},n.prototype._dequeuePendingRequest=function(e){var t=this.pendingRequests.indexOf(e);-1!==t&&(this.pendingRequests.splice(t,1),this._maybeCallWait())},n.prototype._maybeLog=function(e,t){if(this.logger&&this.options.verbose){var r=t;if(r=(r=r||i.get(e,"body.trace.exception.message"))||i.get(e,"body.trace_chain.0.exception.message"))return void this.logger.error(r);(r=i.get(e,"body.message.body"))&&this.logger.log(r)}},n.prototype._maybeCallWait=function(){return!(!i.isFunction(this.waitCallback)||0!==this.pendingItems.length||0!==this.pendingRequests.length||(this.waitIntervalID&&(this.waitIntervalID=clearInterval(this.waitIntervalID)),this.waitCallback(),0))},e.exports=n},777:(e,t,r)=>{var i=r(539);function n(e,t){this.queue=e,this.options=t,this.transforms=[],this.diagnostic={}}n.prototype.configure=function(e){this.queue&&this.queue.configure(e);var t=this.options;return this.options=i.merge(t,e),this},n.prototype.addTransform=function(e){return i.isFunction(e)&&this.transforms.push(e),this},n.prototype.log=function(e,t){if(t&&i.isFunction(t)||(t=function(){}),!this.options.enabled)return t(new Error("Rollbar is not enabled"));this.queue.addPendingItem(e);var r=e.err;this._applyTransforms(e,function(i,n){if(i)return this.queue.removePendingItem(e),t(i,null);this.queue.addItem(n,t,r,e)}.bind(this))},n.prototype._applyTransforms=function(e,t){var r=-1,i=this.transforms.length,n=this.transforms,o=this.options,a=function(e,s){e?t(e,null):++r!==i?n[r](s,o,a):t(null,s)};a(null,e)},e.exports=n},790:e=>{function t(e){return(e.getAttribute("type")||"").toLowerCase()}function r(e){if(!e||!e.tagName)return"";var t=[e.tagName];e.id&&t.push("#"+e.id),e.classes&&t.push("."+e.classes.join("."));for(var r=0;r<e.attributes.length;r++)t.push("["+e.attributes[r].key+'="'+e.attributes[r].value+'"]');return t.join("")}function i(e){if(!e||!e.tagName)return null;var t,r,i,n,o={};o.tagName=e.tagName.toLowerCase(),e.id&&(o.id=e.id),(t=e.className)&&"string"==typeof t&&(o.classes=t.split(/\s+/));var a=["type","name","title","alt"];for(o.attributes=[],n=0;n<a.length;n++)r=a[n],(i=e.getAttribute(r))&&o.attributes.push({key:r,value:i});return o}e.exports={describeElement:i,descriptionToString:r,elementArrayToString:function(e){for(var t,i,n=[],o=0,a=e.length-1;a>=0;a--){if(t=r(e[a]),i=o+3*n.length+t.length,a<e.length-1&&i>=83){n.unshift("...");break}n.unshift(t),o+=t.length}return n.join(" > ")},treeToArray:function(e){for(var t,r=[],n=0;e&&n<5&&"html"!==(t=i(e)).tagName;n++)r.unshift(t),e=e.parentNode;return r},getElementFromEvent:function(e,t){return e.target?e.target:t&&t.elementFromPoint?t.elementFromPoint(e.clientX,e.clientY):void 0},isDescribedElement:function(e,r,i){if(e.tagName.toLowerCase()!==r.toLowerCase())return!1;if(!i)return!0;e=t(e);for(var n=0;n<i.length;n++)if(i[n]===e)return!0;return!1},getElementType:t}},796:e=>{e.exports={captureUncaughtExceptions:function(e,t,r){if(e){var i;if("function"==typeof t._rollbarOldOnError)i=t._rollbarOldOnError;else if(e.onerror){for(i=e.onerror;i._rollbarOldOnError;)i=i._rollbarOldOnError;t._rollbarOldOnError=i}t.handleAnonymousErrors();var n=function(){var r=Array.prototype.slice.call(arguments,0);!function(e,t,r,i){e._rollbarWrappedError&&(i[4]||(i[4]=e._rollbarWrappedError),i[5]||(i[5]=e._rollbarWrappedError._rollbarContext),e._rollbarWrappedError=null);var n=t.handleUncaughtException.apply(t,i);r&&r.apply(e,i),"anonymous"===n&&(t.anonymousErrorsPending+=1)}(e,t,i,r)};r&&(n._rollbarOldOnError=i),e.onerror=n}},captureUnhandledRejections:function(e,t,r){if(e){"function"==typeof e._rollbarURH&&e._rollbarURH.belongsToShim&&e.removeEventListener("unhandledrejection",e._rollbarURH);var i=function(e){var r,i,n;try{r=e.reason}catch(e){r=void 0}try{i=e.promise}catch(e){i="[unhandledrejection] error getting `promise` from event"}try{n=e.detail,!r&&n&&(r=n.reason,i=n.promise)}catch(e){}r||(r="[unhandledrejection] error getting `reason` from event"),t&&t.handleUnhandledRejection&&t.handleUnhandledRejection(r,i)};i.belongsToShim=r,e._rollbarURH=i,e.addEventListener("unhandledrejection",i)}}}},888:(e,t,r)=>{var i=r(539),n=r(12);function o(e,t){return[e,i.stringify(e,t)]}function a(e,t){var r=e.length;return r>2*t?e.slice(0,t).concat(e.slice(r-t)):e}function s(e,t,r){r=void 0===r?30:r;var n,o=e.data.body;if(o.trace_chain)for(var s=o.trace_chain,l=0;l<s.length;l++)n=a(n=s[l].frames,r),s[l].frames=n;else o.trace&&(n=a(n=o.trace.frames,r),o.trace.frames=n);return[e,i.stringify(e,t)]}function l(e,t){return t&&t.length>e?t.slice(0,e-3).concat("..."):t}function c(e,t,r){return t=n(t,function t(r,o,a){switch(i.typeName(o)){case"string":return l(e,o);case"object":case"array":return n(o,t,a);default:return o}}),[t,i.stringify(t,r)]}function u(e){return e.exception&&(delete e.exception.description,e.exception.message=l(255,e.exception.message)),e.frames=a(e.frames,1),e}function h(e,t){var r=e.data.body;if(r.trace_chain)for(var n=r.trace_chain,o=0;o<n.length;o++)n[o]=u(n[o]);else r.trace&&(r.trace=u(r.trace));return[e,i.stringify(e,t)]}function d(e,t){return i.maxByteSize(e)>t}e.exports={truncate:function(e,t,r){r=void 0===r?524288:r;for(var i,n,a,l=[o,s,c.bind(null,1024),c.bind(null,512),c.bind(null,256),h];i=l.shift();)if(e=(n=i(e,t))[0],(a=n[1]).error||!d(a.value,r))return a;return a},raw:o,truncateFrames:s,truncateStrings:c,maybeTruncateValue:l}},944:(e,t,r)=>{var i=r(197),n=r(352),o=r(683),a=r(435),s=r(424),l=r(356),c=r(888);i.setComponents({telemeter:n,instrumenter:o,polyfillJSON:a,wrapGlobals:s,scrub:l,truncation:c}),e.exports=i},962:(e,t,r)=>{var i=r(539);function n(e,t){i.isFunction(e[t])&&(e[t]=e[t].toString())}e.exports={itemToPayload:function(e,t,r){var i=e.data;e._isUncaught&&(i._isUncaught=!0),e._originalArgs&&(i._originalArgs=e._originalArgs),r(null,i)},addPayloadOptions:function(e,t,r){var n=t.payload||{};n.body&&delete n.body,e.data=i.merge(e.data,n),r(null,e)},addTelemetryData:function(e,t,r){e.telemetryEvents&&i.set(e,"data.body.telemetry",e.telemetryEvents),r(null,e)},addMessageWithError:function(e,t,r){if(e.message){var n="data.body.trace_chain.0",o=i.get(e,n);if(o||(n="data.body.trace",o=i.get(e,n)),o){if(!o.exception||!o.exception.description)return i.set(e,n+".exception.description",e.message),void r(null,e);var a=i.get(e,n+".extra")||{},s=i.merge(a,{message:e.message});i.set(e,n+".extra",s)}r(null,e)}else r(null,e)},userTransform:function(e){return function(t,r,n){var o=i.merge(t),a=null;try{i.isFunction(r.transform)&&(a=r.transform(o.data,t))}catch(i){return r.transform=null,e.error("Error while calling custom transform() function. Removing custom transform().",i),void n(null,t)}i.isPromise(a)?a.then(function(e){e&&(o.data=e),n(null,o)},function(e){n(e,t)}):n(null,o)}},addConfigToPayload:function(e,t,r){if(!t.sendConfig)return r(null,e);var n=i.get(e,"data.custom")||{};n._rollbarConfig=t,e.data.custom=n,r(null,e)},addConfiguredOptions:function(e,t,r){var i=t._configuredOptions;n(i,"transform"),n(i,"checkIgnore"),n(i,"onSendCallback"),delete i.accessToken,e.data.notifier.configured_options=i,r(null,e)},addDiagnosticKeys:function(e,t,r){var n=i.merge(e.notifier.client.notifier.diagnostic,e.diagnostic);if(i.get(e,"err._isAnonymous")&&(n.is_anonymous=!0),e._isUncaught&&(n.is_uncaught=e._isUncaught),e.err)try{n.raw_error={message:e.err.message,name:e.err.name,constructor_name:e.err.constructor&&e.err.constructor.name,filename:e.err.fileName,line:e.err.lineNumber,column:e.err.columnNumber,stack:e.err.stack}}catch(e){n.raw_error={failed:String(e)}}e.data.notifier.diagnostic=i.merge(e.data.notifier.diagnostic,n),r(null,e)}}},974:e=>{function t(e){return"string"!=typeof e&&(e=String(e)),e.toLowerCase()}function r(e){this.map={},e instanceof r?e.forEach(function(e,t){this.append(t,e)},this):Array.isArray(e)?e.forEach(function(e){this.append(e[0],e[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}r.prototype.append=function(e,r){e=t(e),r=function(e){return"string"!=typeof e&&(e=String(e)),e}(r);var i=this.map[e];this.map[e]=i?i+", "+r:r},r.prototype.get=function(e){return e=t(e),this.has(e)?this.map[e]:null},r.prototype.has=function(e){return this.map.hasOwnProperty(t(e))},r.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},r.prototype.entries=function(){var e=[];return this.forEach(function(t,r){e.push([r,t])}),function(e){return{next:function(){var t=e.shift();return{done:void 0===t,value:t}}}}(e)},e.exports=function(e){return"undefined"==typeof Headers?new r(e):new Headers(e)}}},t={},function r(i){var n=t[i];if(void 0!==n)return n.exports;var o=t[i]={exports:{}};return e[i].call(o.exports,o,o.exports,r),o.exports}(183);var e,t})),Te.exports);class Ie{static initialize(e){Ie.getInstance().rollbar=Ee.init({accessToken:"208cf50b805f409bb0b08d5c9f68ce61",captureUncaught:!0,captureUnhandledRejections:!0,payload:{environment:"production",component:e,client:{javascript:{code_version:void 0}}}})}static getInstance(){return Ie.instance||(Ie.instance=new Ie),Ie.instance}error(e,t){this.rollbar?.error(e,t)}info(e,t){this.rollbar?.info(e,t)}warning(e,t){this.rollbar?.warning(e,t)}critical(e,t){this.rollbar?.critical(e,t)}}class Pe{constructor(){this.MEASUREMENT_ID="G-6XL8YD35QR",this.isInitialized=!1,this.sessionId=""}static getInstance(){return Pe.instance||(Pe.instance=new Pe),Pe.instance}generateSessionId(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}initialize(e){if(this.isInitialized)return;Pe.component=e,this.sessionId=this.generateSessionId();const t=document.createElement("script");t.async=!0,t.src=`https://www.googletagmanager.com/gtag/js?id=${this.MEASUREMENT_ID}`,document.head.appendChild(t),window.dataLayer=window.dataLayer||[];window.gtag=window.gtag||((...e)=>{window.dataLayer.push(e)}),window.gtag("js",new Date),window.gtag("config",this.MEASUREMENT_ID,{send_page_view:!0,groups:"mapvx"}),this.isInitialized=!0}resetSessionId(){this.sessionId=this.generateSessionId()}trackPageView(e){this.isInitialized&&window.gtag("event","page_view",{page_title:e,page_location:window.location.href,page_path:e,component:Pe.component,session_id:this.sessionId,send_to:"mapvx"})}trackEvent(e,t){this.isInitialized&&window.gtag("event",e,{...t,component:Pe.component,session_id:this.sessionId,send_to:"mapvx"})}trackUserTiming(e,t,r){this.isInitialized&&window.gtag("event","timing_complete",{name:t,value:r,event_category:e,component:Pe.component,session_id:this.sessionId,send_to:"mapvx"})}trackException(e,t=!1){this.isInitialized&&window.gtag("event","exception",{description:e,fatal:t,component:Pe.component,session_id:this.sessionId,send_to:"mapvx"})}}exports.AnalyticsController=Pe,exports.MarkerStyle=be,exports.RollbarController=Ie,exports.SDKController=class{constructor(e){this.connected=!1,this.enabledFloors=[],this.host=e,this.host.addController(this),this.contextProvider=new de(this.host,{context:xe,initialValue:{enabledFloors:[],markers:[],cameraInitialized:!1}})}async prewarm(e,t,r,i){if(!this.connected)return;const n=ve.initializeSDK(e,{lang:t});this.contextProvider.setValue({...this.contextProvider.value,sdk:n,locale:t,parentPlaceId:r,originId:i?.originId??this.contextProvider.value.originId,destinationId:i?.destinationId??this.contextProvider.value.destinationId});try{const[e,t,o,a]=await Promise.all([n.getConfiguration(r).catch(()=>{}),n.getPlaceDetail(r).catch(()=>{}),i?.originId?n.getPlaceDetail(i.originId).catch(()=>{}):Promise.resolve(void 0),i?.destinationId?n.getPlaceDetail(i.destinationId).catch(()=>{}):Promise.resolve(void 0)]),s=t?.innerFloors||[];let l,c=s;if(o||a){const e=[o,a].map(e=>e?.inFloor(s)).filter(e=>void 0!==e);e.length>0&&(c=e),l=a?.inFloors?.[0]?s.find(e=>e.key===a.inFloors[0]):o?.inFloors?.[0]?s.find(e=>e.key===o.inFloors[0]):void 0}this.enabledFloors=c,this.contextProvider.setValue({...this.contextProvider.value,generalConfig:e??this.contextProvider.value.generalConfig,parentPlace:t??this.contextProvider.value.parentPlace,origin:o??this.contextProvider.value.origin,destination:a??this.contextProvider.value.destination,enabledFloors:c,currentFloor:l??this.contextProvider.value.currentFloor,markers:[...o?[{id:o.lazarilloId,data:o,style:be.youAreHere}]:[],...a?[{id:a.lazarilloId,data:a,style:be.placePopup}]:[]]})}catch(o){Ie.getInstance().warning("Error prewarming SDK",{error:o,parentPlaceId:r})}}async initialize(e,t,r){if(!this.connected)return;const i=this.contextProvider.value;if(i.sdk&&i.locale===t&&i.parentPlaceId===r)return;await this.initializeSDK(e,t,r);const{originId:n,destinationId:o}=this.contextProvider.value;n&&o&&this.setOriginAndDestination(n,o)}async setOriginAndDestination(e,t){if(!this.connected)return;const r=this.contextProvider.value.sdk;if(this.contextProvider.setValue({...this.contextProvider.value,originId:e,destinationId:t}),r)try{const[i,n]=await Promise.all([e,t].map(e=>{if(e?.length>0)return r.getPlaceDetail(e).catch(()=>{})}));this.contextProvider.setValue({...this.contextProvider.value,origin:i,destination:n}),this.createOriginDestinationMarkers(i,n);const o=n?.inFloors?.[0]||i?.inFloors?.[0];o&&this.setFloor(o);const a=this.contextProvider.value.parentPlace?.innerFloors||[],s=[i,n].filter(e=>!!e).map(e=>e.inFloor(a)).filter(e=>void 0!==e);this.enabledFloors=s,this.contextProvider.setValue({...this.contextProvider.value,enabledFloors:s})}catch(i){Ie.getInstance().warning("Error setting origin and destination",{error:i,originId:e,destinationId:t})}}getDestination(){return this.contextProvider.value.destination}async loadRoute(e,t,r=!1){if(!this.connected)return;const i=this.contextProvider.value.sdk;if(i)try{const n=await i.getRoute({initialLocation:{id:e},finalLocation:{id:t},preferAccessibleRoute:r});if(!n)return;const o=this.contextProvider.value.parentPlace?.innerFloors||[],a=n.legs.flatMap(e=>e.steps.flatMap(e=>[e.startInsideFloor,e.endInsideFloor])).map(e=>e?o.find(t=>t.key===e):void 0).filter(e=>void 0!==e);this.contextProvider.setValue({...this.contextProvider.value,route:n,enabledFloors:a,isRouteAnimating:!1})}catch(n){Ie.getInstance().warning("Error loading route",{error:n,originId:e,destinationId:t})}}async loadConfig(e){const t=this.contextProvider.value.sdk;if(t)try{const r=await t.getConfiguration(e);this.contextProvider.setValue({...this.contextProvider.value,generalConfig:r})}catch(r){Ie.getInstance().warning("Error loading config",{error:r,parentPlaceId:e})}}async initializeSDK(e,t,r){const i=ve.initializeSDK(e,{lang:t});this.contextProvider.setValue({...this.contextProvider.value,sdk:i,locale:t,parentPlaceId:r});try{const[e,t]=await Promise.all([i.getConfiguration(r).catch(()=>{}),i.getPlaceDetail(r).catch(()=>{})]),{origin:n,destination:o}=this.contextProvider.value;let a=t?.innerFloors||[];const s=n?.inFloor(a)||o?.inFloor(a);(n||o)&&(a=[n,o].map(e=>e?.inFloor(a)).filter(e=>void 0!==e),this.enabledFloors=a),this.contextProvider.setValue({...this.contextProvider.value,generalConfig:e??this.contextProvider.value.generalConfig,parentPlace:t??this.contextProvider.value.parentPlace,enabledFloors:a,currentFloor:s})}catch(n){Ie.getInstance().warning("Error initializing SDK",{error:n,parentPlaceId:r})}}createOriginDestinationMarkers(e,t){const r=[];e&&r.push({id:e.lazarilloId,data:e,style:be.youAreHere}),t&&r.push({id:t.lazarilloId,data:t,style:be.placePopup}),this.contextProvider.setValue({...this.contextProvider.value,markers:r})}setAccessibleRoute(e){this.contextProvider.setValue({...this.contextProvider.value,accessibleRoute:e});const{originId:t,destinationId:r,route:i}=this.contextProvider.value;t&&r&&i&&this.loadRoute(t,r,e)}repeatRoute(){this.contextProvider.setValue({...this.contextProvider.value,isRouteAnimating:!0})}removeRoute(){this.contextProvider.setValue({...this.contextProvider.value,route:void 0,enabledFloors:this.enabledFloors})}routeAnimationFinished(){this.contextProvider.setValue({...this.contextProvider.value,isRouteAnimating:!1})}startRouteAnimation(){this.contextProvider.setValue({...this.contextProvider.value,isRouteAnimating:!0})}generateRoute(){const{originId:e,destinationId:t,accessibleRoute:r}=this.contextProvider.value;e&&t&&this.loadRoute(e,t,!!r)}setFloor(e){const{parentPlace:t,currentFloor:r}=this.contextProvider.value;if(!t)return;if(r?.key===e)return;const i=t.innerFloors.find(t=>t.key===e);i&&this.contextProvider.setValue({...this.contextProvider.value,currentFloor:i})}hostConnected(){this.connected=!0}hostDisconnected(){this.connected=!1}setMapReady(e){this.contextProvider.setValue({...this.contextProvider.value,mapReady:e})}setCameraInitialized(e){this.contextProvider.setValue({...this.contextProvider.value,cameraInitialized:e})}resetData(){this.contextProvider.setValue({...this.contextProvider.value,originId:void 0,destinationId:void 0,origin:void 0,destination:void 0,route:void 0,enabledFloors:this.enabledFloors,currentFloor:this.contextProvider.value.parentPlace?.innerFloors?.[0],markers:[],accessibleRoute:!1,isRouteAnimating:!1,cameraInitialized:!1}),this.host.requestUpdate()}},exports.T=U,exports.distExports=ve,exports.i=oe,exports.i$1=(e,...t)=>{const i=1===e.length?e[0]:t.reduce((t,r,i)=>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.")})(r)+e[i+1],e[0]);return new n(i,e,r)},exports.loadCompactFloorSelector=()=>Promise.resolve().then(()=>require("./compact-floor-selector-Co8Y3T2c.cjs")),exports.loadCustomMap=()=>Promise.resolve().then(()=>require("./custom-map--UZ5N3Lg.cjs")),exports.loadFloorSelector=()=>Promise.resolve().then(()=>require("./floor-selector-CNuGDuNc.cjs")),exports.loadQrModal=()=>Promise.resolve().then(()=>require("./qr-modal-Dq7dOqh6.cjs")),exports.loadRouteOptions=()=>Promise.resolve().then(()=>require("./route-options-B45xnSu4.cjs")),exports.n=function(e){return(t,r)=>"object"==typeof r?le(e,t,r):((e,t,r)=>{const i=t.hasOwnProperty(r);return t.constructor.createProperty(r,e),i?Object.getOwnPropertyDescriptor(t,r):void 0})(e,t,r)},exports.preloadMaplibreCss=async()=>{try{await Promise.resolve().then(()=>require("./styles-Bt354u5n.cjs"))}catch{}},exports.r=o,exports.s=ce,exports.sdkContext=xe,exports.t=e=>(t,r)=>{void 0!==r?r.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)},exports.x=V;
|
|
56
|
-
//# sourceMappingURL=lazy-load-Dy0Wc6yS.cjs.map
|