1(self.webpackChunkapplifaction_dpd_shipping=self.webpackChunkapplifaction_dpd_shipping||[]).push([[33886],{68(e,i,r){"use strict";r.d(i,{A:()=>a});class a{constructor(){this._request=null,this._errorHandlingInternal=!1}get(e,i){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"application/json",a=this._createPreparedRequest("GET",e,r);return this._sendRequest(a,null,i)}post(e,i,r){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";a=this._getContentType(i,a);let n=this._createPreparedRequest("POST",e,a);return this._sendRequest(n,i,r)}delete(e,i,r){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";a=this._getContentType(i,a);let n=this._createPreparedRequest("DELETE",e,a);return this._sendRequest(n,i,r)}patch(e,i,r){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";a=this._getContentType(i,a);let n=this._createPreparedRequest("PATCH",e,a);return this._sendRequest(n,i,r)}abort(){if(this._request)return this._request.abort()}setErrorHandlingInternal(e){this._errorHandlingInternal=e}_registerOnLoaded(e,i){i&&(!0===this._errorHandlingInternal?(e.addEventListener("load",()=>{i(e.responseText,e)}),e.addEventListener("abort",()=>{console.warn(`the request to ${e.responseURL} was aborted`)}),e.addEventListener("error",()=>{console.warn(`the request to ${e.responseURL} failed with status ${e.status}`)}),e.addEventListener("timeout",()=>{console.warn(`the request to ${e.responseURL} timed out`)})):e.addEventListener("loadend",()=>{i(e.responseText,e)}))}_sendRequest(e,i,r){return this._registerOnLoaded(e,r),e.send(i),e}_getContentType(e,i){return e instanceof FormData&&(i=!1),i}_createPreparedRequest(e,i,r){return this._request=new XMLHttpRequest,this._request.open(e,i),this._request.setRequestHeader("X-Requested-With","XMLHttpRequest"),r&&this._request.setRequestHeader("Content-type",r),this._request}}},156(e){"use strict";var i=function(e){var i;return!!e&&"object"==typeof e&&"[object RegExp]"!==(i=Object.prototype.toString.call(e))&&"[object Date]"!==i&&e.$$typeof!==r},r="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function a(e,i){return!1!==i.clone&&i.isMergeableObject(e)?h(Array.isArray(e)?[]:{},e,i):e}function n(e,i,r){return e.concat(i).map(function(e){return a(e,r)})}function s(e){return Object.keys(e).concat(Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(i){return Object.propertyIsEnumerable.call(e,i)}):[])}function l(e,i){try{return i in e}catch(e){return!1}}function h(e,r,u){(u=u||{}).arrayMerge=u.arrayMerge||n,u.isMergeableObject=u.isMergeableObject||i,u.cloneUnlessOtherwiseSpecified=a;var c,d,p=Array.isArray(r);return p!==Array.isArray(e)?a(r,u):p?u.arrayMerge(e,r,u):(d={},(c=u).isMergeableObject(e)&&s(e).forEach(function(i){d[i]=a(e[i],c)}),s(r).forEach(function(i){(!l(e,i)||Object.hasOwnProperty.call(e,i)&&Object.propertyIsEnumerable.call(e,i))&&
1(l(e,i)&&c.isMergeableObject(r[i])?d[i]=(function(e,i){if(!i.customMerge)return h;var r=i.customMerge(e);return"function"==typeof r?r:h})(i,c)(e[i],r[i],c):d[i]=a(r[i],c))}),d)}h.all=function(e,i){if(!Array.isArray(e))throw Error("first argument should be an array");return e.reduce(function(e,r){return h(e,r,i)},{})},e.exports=h},173(e,i,r){!function(e,i){"use strict";function r(e){return e&&e.document&&e.location&&e.alert&&e.setInterval}function a(e){if(null==e)return window;if(!r(e)){let i=e.ownerDocument;return i&&i.defaultView||window}return e}function n(e){return a(e).getComputedStyle(e)}function s(e){return r(e)?"":e?(e.nodeName||"").toLowerCase():""}function l(){let e=navigator.userAgentData;return null!=e&&e.brands?e.brands.map(e=>e.brand+"/"+e.version).join(" "):navigator.userAgent}function h(e){return e instanceof a(e).HTMLElement}function u(e){return e instanceof a(e).Element}function c(e){if("undefined"==typeof ShadowRoot)return!1;let i=a(e).ShadowRoot;return e instanceof i||e instanceof ShadowRoot}function d(e){let{overflow:i,overflowX:r,overflowY:a}=n(e);return/auto|scroll|overlay|hidden/.test(i+a+r)}function p(e){let i=/firefox/i.test(l()),r=n(e);return"none"!==r.transform||"none"!==r.perspective||"paint"===r.contain||["transform","perspective"].includes(r.willChange)||i&&"filter"===r.willChange||i&&!!r.filter&&"none"!==r.filter}function f(){return!/^((?!chrome|android).)*safari/i.test(l())}let m=Math.min,_=Math.max,g=Math.round;function y(e,i,r){var n,s,l,c;void 0===i&&(i=!1),void 0===r&&(r=!1);let d=e.getBoundingClientRect(),p=1,m=1;i&&h(e)&&(p=e.offsetWidth>0&&g(d.width)/e.offsetWidth||1,m=e.offsetHeight>0&&g(d.height)/e.offsetHeight||1);let _=u(e)?a(e):window,y=!f()&&r,x=(d.left+(y&&null!=(n=null==(s=_.visualVie
1wport)?void 0:s.offsetLeft)?n:0))/p,v=(d.top+(y&&null!=(l=null==(c=_.visualViewport)?void 0:c.offsetTop)?l:0))/m,b=d.width/p,w=d.height/m;return{width:b,height:w,top:v,right:x+b,bottom:v+w,left:x,x,y:v}}function x(e){return((e instanceof a(e).Node?e.ownerDocument:e.document)||window.document).documentElement}function v(e){return u(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function b(e){return y(x(e)).left+v(e).scrollLeft}function w(e){return"html"===s(e)?e:e.assignedSlot||e.parentNode||(c(e)?e.host:null)||x(e)}function T(e){return h(e)&&"fixed"!==getComputedStyle(e).position?e.offsetParent:null}function S(e){let i=a(e),r=T(e);for(;r&&["table","td","th"].includes(s(r))&&"static"===getComputedStyle(r).position;)r=T(r);return r&&("html"===s(r)||"body"===s(r)&&"static"===getComputedStyle(r).position&&!p(r))?i:r||function(e){let i=w(e);for(c(i)&&(i=i.host);h(i)&&!["html","body"].includes(s(i));){if(p(i))return i;i=i.parentNode}return null}(e)||i}function M(e){if(h(e))return{width:e.offsetWidth,height:e.offsetHeight};let i=y(e);return{width:i.width,height:i.height}}function E(e,i){var r;void 0===i&&(i=[]);let n=function e(i){let r=w(i);return["html","body","#document"].includes(s(r))?i.ownerDocument.body:h(r)&&d(r)?r:e(r)}(e),l=n===(null==(r=e.ownerDocument)?void 0:r.body),u=a(n),c=l?[u].concat(u.visualViewport||[],d(n)?n:[]):n,p=i.concat(c);return l?p:p.concat(E(c))}function A(e,r,s){return"viewport"===r?i.rectToClientRect(function(e,i){let r=a(e),n=x(e),s=r.visualViewport,l=n.clientWidth,h=n.clientHeight,u=0,c=0;if(s){l=s.width,h=s.height;let e=f();(e||!e&&"fixed"===i)&&(u=s.offsetLeft,c=s.offsetTop)}return{width:l,height:h,x:u,y:c}}(e,s)):u(r)?function(e,i){let r=y(e,!1,"fixed"===i),a=r.top+e.clientTop,n=r.left+e.clientLeft;return{top:a,left:n,x:n,y:a,right:n+e.clientWidth,bottom:a+e.clientHeight,width:e.clientWidth,height:e.clientHeight}}(r,s):i.rectToClientRect(function(e){var i;let r=x(e),a=v(e),s=null==(i=e.ownerDocument)?void 0:i.body,l=_(r.scrollWidth,r.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),h=_(r.scrollHeight,r.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),u=-a.scrollLeft+b(e),c=-a.scrollTop;return"rtl"===n(s||r).direction&&(u+=_(r.clientWidth,s?s.clientWidth:0)-l),{width:l,height:h,x:u,y:c}}(x(e)))}let I={getClippingRect:function(e){let{element:i,boundary:r,rootBoundary:a,strategy:l}=e,d=[..."clippingAncestors"===r?function(e){let i=E(e),r=["absolute","fixed"].includes(n(e).position)&&h(e)?S(e):e;return u(r)?i.filter(e=>u(e)&&function(e,i){let r=null==i.getRootNode?void 0:i.getRootNode();if(e.contains(i))return!0;if(r&&c(r)){let r=i;do{if(r&&e===r)return!0;r=r.parentNode||r.host}while(r)}return!1}(e,r)&&"body"!==s(e)):[]}(i):[].concat(r),a],p=d[0],f=d.reduce((e,r)=>{let a=A(i,r,l);return e.top=_(a.top,e.top),e.right=m(a.right,e.right),e.bottom=m(a.bottom,e.bottom),e.left=_(a.left,e.left),e},A(i,p,l));return{width:f.right-f.left,height:f.bottom-f.top,x:f.left,y:f.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{rect:i,offsetParent:r,strategy:a}=e,n=h(r),l=x(r);if(r===l)return i;let u={scrollLeft:0,scrollTop:0},c={x:0,y:0};if((n||!n&&"fixed"!==a)&&(("body"!==s(r)||d(l))&&(u=v(r)),h(r))){let e=y(r,!0);c.x=e.x+r.clientLeft,c.y=e.y+r.clientTop}return{...i,x:i.x-u.scrollLeft+c.x,y:i.y-u.scrollTop+c.y}},isElement:u,getDimensions:M,getOffsetParent:S,getDocumentElement:x,getElementRects:e=>{let{reference:i,floating:r,strategy:a}=e;return{reference:function(e,i,r){let a=h(i),n=x(i),l=y(e,a&&function(e){let i=y(e);return g(i.width)!==e.offsetWidth||g(i.height)!==e.offsetHeight}(i),"fixed"===r),u={scrollLeft:0,scrollTop:0},c={x:0,y:0};if(a||!a&&"fixed"!==r){if(("body"!==s(i)||d(n))&&(u=v(i)),h(i)){let e=y(i,!0);c.x=e.x+i.clientLeft,c.y=e.y+i.clientTop}else n&&(c.x=b(n))}return{x:l.left+u.scrollLeft-c.x,y:l.top+u.scrollTop-c.y,width:l.width,height:l.height}}(i,S(r),a),floating:{...M(r),x:0,y:0}}},getClientRects:e=>Array.from(e.getClientRects()),isRTL:e=>"rtl"===n(e).direction};Object.defineProperty(e,"arrow",{enumerable:!0,get:function(){return i.arrow}}),Object.defineProperty(e,"autoPlacement",{enumerable:!0,get:function(){return i.autoPlacement}}),Object.defineProperty(e,"detectOverflow",{enumerable:!0,get:function(){return i.detectOverflow}}),Object.defineProperty(e,"flip",{enumerable:!0,get:function(){return i.flip}}),Object.defineProperty(e,"hide",{enumerable:!0,get:function(){return i.hide}}),Object.defineProperty(e,"inline",{enumerable:!0,get:function(){return i.inline}}),Object.defineProperty(e,"limitShift",{enumerable:!0,get:function(){return i.limitShift}}
1),Object.defineProperty(e,"offset",{enumerable:!0,get:function(){return i.offset}}),Object.defineProperty(e,"shift",{enumerable:!0,get:function(){return i.shift}}),Object.defineProperty(e,"size",{enumerable:!0,get:function(){return i.size}}),e.autoUpdate=function(e,i,r,a){let n;void 0===a&&(a={});let{ancestorScroll:s=!0,ancestorResize:l=!0,elementResize:h=!0,animationFrame:c=!1}=a,d=s&&!c,p=l&&!c,f=d||p?[...u(e)?E(e):[],...E(i)]:[];f.forEach(e=>{d&&e.addEventListener("scroll",r,{passive:!0}),p&&e.addEventListener("resize",r)});let m=null;if(h){let a=!0;m=new ResizeObserver(()=>{a||r(),a=!1}),u(e)&&!c&&m.observe(e),m.observe(i)}let _=c?y(e):null;return c&&function i(){let a=y(e);_&&(a.x!==_.x||a.y!==_.y||a.width!==_.width||a.height!==_.height)&&r(),_=a,n=requestAnimationFrame(i)}(),r(),()=>{var e;f.forEach(e=>{d&&e.removeEventListener("scroll",r),p&&e.removeEventListener("resize",r)}),null==(e=m)||e.disconnect(),m=null,c&&cancelAnimationFrame(n)}},e.computePosition=(e,r,a)=>i.computePosition(e,r,{platform:I,...a}),e.getOverflowAncestors=E,Object.defineProperty(e,"__esModule",{value:!0})}(i,r(875))},373(e,i,r){"use strict";r.d(i,{A:()=>h});var a=r(156),n=r.n(a);class s{static ucFirst(e){return e.charAt(0).toUpperCase()+e.slice(1)}static lcFirst(e){return e.charAt(0).toLowerCase()+e.slice(1)}static toDashCase(e){return e.replace(/([A-Z])/g,"-$1").replace(/^-/,"").toLowerCase()}static toLowerCamelCase(e,i){let r=s.toUpperCamelCase(e,i);return s.lcFirst(r)}static toUpperCamelCase(e,i){return i?e.split(i).map(e=>s.ucFirst(e.toLowerCase())).join(""):s.ucFirst(e.toLowerCase())}static parsePrimitive(e){try{return/^\d+(.|,)\d+$/.test(e)&&(e=e.replace(",",".")),JSON.parse(e)}catch(i){return e.toString()}}}class l{constructor(e=document){this._el=e,e.$emitter=this,this._listeners=[]}publish(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=new CustomEvent(e,{detail:i,cancelable:r});return this.el.dispatchEvent(a),a}subscribe(e,i){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=this,n=e.split("."),s=r.scope?i.bind(r.scope):i;if(r.once&&!0===r.once){let i=s;s=function(r){a.unsubscribe(e),i(r)}}return this.el.addEventListener(n[0],s),this.listeners.push({splitEventName:n,opts:r,cb:s}),!0}unsubscribe(e){arguments.length>1&&"function"==typeof arguments[1]&&console.warn(`[NativeEventEmitter] Unsubscribing by passing the subscriber function as a second argument is not supported. By default, all listeners for the event will be removed. Use a suffix (separated by a dot) on the event name when subscribing/unsubscribing to identify/target your specific listener only, e.g. "${e}.MyCustomPlugin"`);let i=e.split(".");return this.listeners=this.listeners.reduce((e,r)=>([...r.splitEventName].sort().toString()===i.sort().toString()?this.el.removeEventListener(r.splitEventName[0],r.cb):e.push(r),e),[]),!0}reset(){return this.listeners.forEach(e=>{this.el.removeEventListener(e.splitEventName[0],e.cb)}),this.listeners=[],!0}get el(){return this._el}set el(e){this._el=e}get listeners(){return this._listeners}set listeners(e){this._listeners=e}}class h{constructor(e,i={},r=!1){if(!(e instanceof Node)){console.warn(`There is no valid element given while trying to create a plugin instance for "${r}".`);return}this.el=e,this.$emitter=new l(this.el),this._pluginName=this._getPluginName(r),this.options=this._mergeOptions(i),this._initialized=!1,this._registerInstance(),this._init()}init(){console.warn(`The "init" method for the plugin "${this._pluginName}" is not defined. The plugin will not be initialized.`)}update(){}destroy(){}_init(){this._initialized||(this.init(),this._initialized=!0)}_update(){this._initialized&&this.update()}_mergeOptions(e){let i=[this.constructor.options,this.options,e];return i.push(this._getConfigFromDataAttribute()),i.push(this._getOptionsFromDataAttribute()),n().all(i.filter(e=>e instanceof Object&&!(e instanceof Array)).map(e=>e||{}))}_getConfigFromDataAttribute(){let e={};if("function"!=typeof this.el.getAttribute)return e;let i=s.toDashCase(this._pluginName),r=this.el.getAttribute(`data-${i}-config`);return r?window.PluginConfigManager.get(this._pluginName,r):e}_getOptionsFromDataAttribute(){let e={};if("function"!=typeof this.el.getAttribute)return e;let i=s.toDashCase(this._pluginName),r=this.el.getAttribute(`data-${i}-options`);if(r)try{return JSON.parse(r)}catch(e){console.error(`The data attribute "data-${i}-options" could not be parsed to json: ${e.message}`)}return e}_registerInstance(){window.PluginManager.getPluginInstancesFromElement(this.el).set(this._pluginName,this),window.PluginManager.getPlugin(this._pluginName,!1).get("instances").push(this)}_getPluginName(e){return e||(e=this.constructor.name),e}}},379(e,i,r){let a;var n=Object.create,s=Object.defineProperty,l=Object.defineProperties,h=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyDescriptors,c=Object.getOwnPropertyNames,d=Object.getOwnPropertySymbols,p=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty,m=Object.prototype.propertyIsEnumerable,_=(e,i,r)=>i in e?s(e,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[i]=r,g=(e,i)=>{for(var r in i||(i={}))f.call(i,r)&&_(e,r,i[r]);if(d)for(var r of d(i))m.call(i,r)&&_(e,r,i[r]);return e},y=(e,i)=>l(e,u(i)),x=e=>
1s(e,"__esModule",{value:!0}),v=(e,i,r,a)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let n of c(i))!f.call(e,n)&&(r||"default"!==n)&&s(e,n,{get:()=>i[n],enumerable:!(a=h(i,n))||a.enumerable});return e},b=(e,i)=>v(x(s(null!=e?n(p(e)):{},"default",!i&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),w=(a="undefined"!=typeof WeakMap?new WeakMap:0,(e,i)=>a&&a.get(e)||(i=v(x({}),e,1),a&&a.set(e,i),i)),T=(e,i,r)=>{if(!i.has(e))throw TypeError("Cannot "+r)},S=(e,i,r)=>(T(e,i,"read from private field"),r?r.call(e):i.get(e)),M=(e,i,r)=>{if(i.has(e))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(e):i.set(e,r)},E=(e,i,r,a)=>(T(e,i,"write to private field"),a?a.call(e,r):i.set(e,r),r),A=(e,i,r)=>(T(e,i,"access private method"),r),I=(e,i,r)=>new Promise((a,n)=>{var s=e=>{try{h(r.next(e))}catch(e){n(e)}},l=e=>{try{h(r.throw(e))}catch(e){n(e)}},h=e=>e.done?a(e.value):Promise.resolve(e.value).then(s,l);h((r=r.apply(e,i)).next())}),C={};((e,i)=>{for(var r in i)s(e,r,{get:i[r],enumerable:!0})})(C,{MapboxAddressAutofill:()=>iO,MapboxAddressConfirmation:()=>tl,MapboxAddressMinimap:()=>ax,MapboxGeocoder:()=>rT,MapboxHTMLEvent:()=>e_,MapboxSearchBox:()=>i9,autofill:()=>aW,config:()=>ti,confirmAddress:()=>tu,getAutofillSearchText:()=>e2,getFormAutofillValues:()=>e1});var P=document.implementation.createHTMLDocument();function L(e,i){let r={};for(let[a,n]of Object.entries(i))r[a]=e.querySelector(n);return r}function k(e){let i=document.createElement("template");return i.innerHTML=e,i.content.firstElementChild}function R(e,i){if(!e)return;Object.getOwnPropertyDescriptor(e.constructor.prototype,"value").set.call(e,i),e._valueTracker&&e._valueTracker.setValue("");let r=new Event("input",{bubbles:!0});r.simulated=!0,e.dispatchEvent(r);let a=new Event("change",{bubbles:!0});a.simulated=!0,e.dispatchEvent(a)}function z(e,i=!1){let r,a,n=e.getBoundingClientRect();if("none"===e.style.display||0===n.height&&0===n.width){let n=e.cloneNode(i);e.parentElement.appendChild(n),n.style.setProperty("display","block","important");let s=n.getBoundingClientRect();r=s.width,a=s.height,n.style.setProperty("display","none"),n.remove()}else r=n.width,a=n.height;return{height:Math.floor(a),width:Math.floor(r)}}var D=RegExp("[_a-zA-Z]+[_a-zA-Z0-9-]*","g"),O=RegExp(`\\.${D.source}`,"g"),B=RegExp("^\\s*(@(?:media|supports)[^{]*){(.*)}\\s*$");function F(e,i){return e.replace(O,e=>"."+i(e.slice(1)))}function N(e,i){let r=Array.from(e.querySelectorAll("[class]"));for(let a of(r.push(e),r)){let{classList:e}=a;for(let r of Array.from(e))e.remove(r),e.add(i(r))}return e}var V=r(596);function U(e,i,r=.5){let{center:a,zoom:n}=e.cameraForBounds(i);return{center:a,zoom:Math.max(n-r,0),speed:1.4}}function j(e){switch(e){case"street":return 15;case"neighborhood":case"postcode":case"locality":case"oaza":return 14;case"place":case"city":return 13;case"district":return 9;case"region":case"prefecture":return 6;case"country":return 4;default:return 16}}function G(e,i){return`https://api.mapbox.com/styles/v1/${e}/${i}/static/`}var q='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M3.8 3.8a1 1 0 0 1 1.4 0L9 7.58l3.8-3.8a1 1 0 1 1 1.4 1.42L10.42 9l3.8 3.8a1 1 0 0 1-1.42 1.4L9 10.42l-3.8 3.8a1 1 0 0 1-1.4-1.42L7.58 9l-3.8-3.8a1 1 0 0 1 0-1.4Z" fill="currentColor"/></svg>',W='<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg"><path fill="#333" d="M4.4 4.4l.8.8c2.1-2.1 5.5-2.1 7.6 0l.8-.8c-2.5-2.5-6.7-2.5-9.2 0z"/><path opacity=".1" d="M12.8 12.9c-2.1 2.1-5.5 2.1-7.6 0-2.1-2.1-2.1-5.5 0-7.7l-.8-.8c-2.5 2.5-2.5 6.7 0 9.2s6.6 2.5 9.2 0 2.5-6.6 0-9.2l-.8.8c2.2 2.1 2.2 5.6 0 7.7z"/></svg>',$=G("mapbox","satellite-streets-v11"),H=["mapbox.com","mapbox.cn","tilestream.net"],Z=k(` 2<template> 3 <div class="MapboxSearch"> 4 <div class="Label" role="label" aria-live="polite" aria-atomic="true"> 5 </div> 6 <div class="Results" aria-hidden="true"> 7 <div class="ResultsList" role="listbox"> 8 </div> 9 <div class="ResultsAttribution" aria-hidden="true"> 10 <a href="https://www.mapbox.com/search-service" target="_blank" tabindex="-1"> 11 Powered by Mapbox 12 </a> 13 </div> 14 </div> 15 </div> 16</template> 17`),X=k(` 18<template> 19 <div class="Suggestion" role="option" tabindex="-1"> 20 <div class="SuggestionIcon" aria-hidden="true"></div> 21 <div class="SuggestionText"> 22 <div class="SuggestionName"></div> 23 <div class="SuggestionDesc"></div> 24 </div> 25 </div> 26</template> 27`),Y=k(` 28<template> 29 <div class="SearchBox"> 30 <div class="SearchIcon"></div> 31 <input class="Input" type="text" /> 32 <div class="ActionIcon"> 33 <button aria-label="Clear" class="ClearBtn" type="button">${q}</button> 34 <div class="LoadingIcon">${W}</div> 35 </div> 36 </div> 37</template> 38`),J=k(` 39<template> 40 <div class="Geocoder"> 41 <div class="SearchIcon"></div> 42 <input class="Input" type="text" /> 43 <div class="ActionIcon"> 44 <button aria-label="Clear" class="ClearBtn" type="button">${q}</button> 45 <div class="LoadingIcon">${W}</div> 46 </div> 47 </div> 48</template> 49`);function K(){return"mbx"+new V.SessionToken().id.slice(0,8)}function Q(e){try{return JSON.parse(e)}catch(e){return null}}function ee(e,i){if(null==e||null==i||"object"!=typeof e||"object"!=typeof i)return e===i;let r=Object.keys(e),a=Object.keys(i);if(r.length!==a.length)return!1;
49for(let a of r)if(!ee(e[a],i[a]))return!1;return!0}function et(e,i){let r=Math.pow(10,i);return Math.round(e*r)/r}var ei,er,ea,en=class extends HTMLElement{constructor(){super(...arguments),M(this,ei,K()),M(this,er,void 0),M(this,ea,e=>`${S(this,ei)}--${e}`)}get template(){return null}get templateStyle(){return null}get templateUserStyle(){return null}clonedCallback(e,i){let r=r=>r.replace(e,i);N(this,r);let a=Array.from(this.querySelectorAll("style"));for(let e of a)e.textContent=F(e.textContent,r);for(let r of(a.length&&E(this,er,a[a.length-1]),Array.from(this.querySelectorAll(`[id^="${e}"]`))))r.id=r.id.replace(e,i)}connectedCallback(){if(this.childElementCount>0){let e=this.dataset.seed,i=S(this,ei);e&&e!==i&&(this.clonedCallback(e,i),this.dataset.seed=i);return}this.dataset.seed=S(this,ei);let e=this.template;if(e){let i=this.prepareTemplate(e);this.appendChild(i)}let i=this.templateStyle;if(i){let e=document.createElement("style");e.textContent=this.prepareCSS(i),this.appendChild(e)}let r=document.createElement("style");this.templateUserStyle&&(r.textContent=this.prepareCSS(this.templateUserStyle)),this.appendChild(r),E(this,er,r)}prepareTemplate(e){return N(e.content.firstElementChild.cloneNode(!0),S(this,ea))}prepareCSS(e){return function e(i,r){let a;let n=((a=P.createElement("style")).textContent=i,P.head.appendChild(a),a.sheet).cssRules,s="";for(let i of Array.from(n))s+=function(i){if(i instanceof CSSStyleRule)return`${F(i.selectorText,r)} { ${i.style.cssText} }`;let a=B.exec(i.cssText.split(` 50`).join(""));if(a&&a.length>2){let i=a[1],n=a[2];return`${i} { ${e(n,r)} }`}return i.cssText}(i)+` 51 52`;return s.trim()}(e,S(this,ea))}updateTemplateUserStyle(e){S(this,er)&&(S(this,er).textContent=this.prepareCSS(e))}querySelector(e){return super.querySelector(F(e,S(this,ea)))}querySelectorAll(e){return super.querySelectorAll(F(e,S(this,ea)))}addEventListener(e,i,r){super.addEventListener(e,i,r)}removeEventListener(e,i,r){super.removeEventListener(e,i,r)}dispatchEvent(e){return super.dispatchEvent(e)}};ei=new WeakMap,er=new WeakMap,ea=new WeakMap;var eo="1.0.0-beta.24",es=`https://api.mapbox.com/search-js/v${eo}/img/style-toggle-satellite.jpg`,el={variables:{unit:["mobile","16px","14px"],unitHeader:["mobile","24px","18px"],minWidth:"min(300px, 100vw)",spacing:"0.75em",padding:"0.5em 0.75em",paddingFooterLabel:"0.5em 0.75em",paddingModal:"1.25em",colorText:"rgba(0, 0, 0, 0.75)",colorPrimary:"#4264FB",colorSecondary:"#667F91",colorBackground:"#fff",colorBackgroundHover:"#f5f5f5",colorBackgroundActive:"#f0f0f0",colorBackdrop:"rgba(102, 127, 145, 0.3)",border:"none",borderRadius:"4px",boxShadow:` 53 0 0 10px 2px rgba(0, 0, 0, 0.05), 54 0 0 6px 1px rgba(0, 0, 0, 0.1), 55 0 0 0 1px rgba(0, 0, 0, 0.1) 56 `,lineHeight:"1.2em",fontFamily:` 57 -apple-system, BlinkMacSystemFont, 58 avenir next, avenir, 59 segoe ui, 60 helvetica neue, helvetica, 61 Ubuntu, roboto, noto, arial, sans-serif 62 `,fontWeight:"normal",fontWeightSemibold:"600",fontWeightBold:"bold",duration:"150ms",curve:"ease-out"},icons:{close:q,question:'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M9 16A7 7 0 1 0 9 2a7 7 0 0 0 0 14ZM6.88 4.88a2.58 2.58 0 0 1 1.83-.75h1.08a2.58 2.58 0 0 1 2.59 2.58v.16c0 1-.53 1.94-1.4 2.46l-.56.34c-.27.16-.45.42-.52.71-.03.14-.14.25-.28.25H8.38a.23.23 0 0 1-.24-.25c.08-.91.59-1.74 1.38-2.21l.56-.34c.34-.2.54-.57.54-.96V6.7a.83.83 0 0 0-.83-.83H8.71a.83.83 0 0 0-.84.83v.18a.87.87 0 1 1-1.75 0V6.7c0-.69.28-1.34.76-1.83ZM10 13a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z" fill="currentColor"/></svg>',marker:'<svg width="48" height="56" fill="none" xmlns="http://www.w3.org/2000/svg"><g filter="url(#a)"><path d="m24 50.4 13.79-14.12a18.82 18.82 0 0 0 4.23-20.86 19.23 19.23 0 0 0-7.19-8.6 19.76 19.76 0 0 0-21.66 0c-3.21 2.11-5.71 5.1-7.19 8.6a18.82 18.82 0 0 0 4.23 20.86L24 50.4Z" fill="currentColor"/><path d="M37.26 35.75 24 49.34 10.75 35.76l-.01-.01A18.07 18.07 0 0 1 6.68 15.7a18.48 18.48 0 0 1 6.9-8.26 19 19 0 0 1 20.84 0 18.48 18.48 0 0 1 6.9 8.26 18.07 18.07 0 0 1-4.06 20.04Z" stroke="#fff" stroke-width="1.5"/></g><circle cx="24" cy="22.45" fill="#fff" r="5.85"/><defs><filter id="a" x=".5" y=".6" width="47" height="54.8" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
62<feFlood flood-opacity="0" result="BackgroundImageFix"/><feColorMatrix in="SourceAlpha" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/><feOffset dy="1"/><feGaussianBlur stdDeviation="2"/><feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2 0"/><feBlend in2="BackgroundImageFix" result="effect1_dropShadow_17_871"/><feBlend in="SourceGraphic" in2="effect1_dropShadow_17_871" result="shape"/></filter></defs></svg>',street:`<svg width="24" height="24" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"> 63 <path fill-rule="evenodd" clip-rule="evenodd" d="M1.08 14.94 5.625 3.06h1.17l-3.42 11.88H1.08Zm15.885 0L12.42 3.06h-1.17l3.42 11.88h2.295Zm-6.86-1.44H7.946l.128-2.61h1.912l.119 2.61Zm-.217-4.77H8.181l.088-1.8h1.537l.082 1.8ZM9.74 5.49h-1.4l.049-.99h1.306l.045.99Z" fill="currentColor" /> 64</svg>`,addressMarker:`<!-- TODO: I'm not sure if the way I added the circle will "scale" properly, need to check that --> 65<svg width="24" height="24" viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg"> 66 <path fill="none" stroke="currentColor" stroke-width="1.5" d="M4 7a5 5 0 1 1 10 0c0 3.025-3.28 6.713-5 9-1.72-2.287-5-5.975-5-9z"></path> 67 <circle cx="9" cy="7" r="2" fill="currentColor"></circle> 68</svg>`,search:`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg"> 69 <path d="M7.4 2.5c-2.7 0-4.9 2.2-4.9 4.9s2.2 4.9 4.9 4.9c1 0 1.8-.2 2.5-.8l3.7 3.7c.2.2.4.3.8.3.7 0 1.1-.4 1.1-1.1 0-.3-.1-.5-.3-.8L11.4 10c.4-.8.8-1.6.8-2.5.1-2.8-2.1-5-4.8-5zm0 1.6c1.8 0 3.2 1.4 3.2 3.2s-1.4 3.2-3.2 3.2-3.3-1.3-3.3-3.1 1.4-3.3 3.3-3.3z"/> 70</svg>`},images:{styleToggleDefault:`https://api.mapbox.com/search-js/v${eo}/img/style-toggle-default.jpg`,styleToggleSatellite:es}};function eh(e,i={}
70){let r=g(g({},el.variables),i.variables||{}),a=i.cssText||"",n="";for(let[i,s]of Object.entries(r)){if(!Array.isArray(s)){n+=`--${i}: ${s};`;continue}if("mobile"!==s[0]){let e=JSON.stringify(s);throw Error(`Unsupported expression in theme variables: ${i} ${e}`)}let[,r,l]=s;a+=`@media only screen and (max-width: 767px) { ${e} { --${i}: ${r} !important; } }`,n+=`--${i}: ${l};`}return a+`${e} { ${n} }`}function eu(e,i={}){return g(g({},el.icons),i.icons||{})[e]}var ec,ed,ep=r(173),ef=class{constructor(e,i,r){M(this,ec,void 0),M(this,ed,{placement:"bottom-start",flip:!1,offset:10}),this.update=()=>I(this,null,function*(){let e={placement:this.options.placement,middleware:[(0,ep.offset)(this.options.offset),this.options.flip&&(0,ep.flip)()].filter(Boolean)},{x:i,y:r}=yield(0,ep.computePosition)(this.referenceEl,this.floatingEl,e);Object.assign(this.floatingEl.style,{left:`${i}px`,top:`${r}px`})}),this.referenceEl=e,this.floatingEl=i,E(this,ec,g(g({},S(this,ed)),r)),this.destroy=(0,ep.autoUpdate)(this.referenceEl,this.floatingEl,this.update)}get options(){return S(this,ec)}set options(e){E(this,ec,g(g({},S(this,ec)),e))}};ec=new WeakMap,ed=new WeakMap;var em="*{box-sizing:border-box!important}[role=button]{cursor:pointer}.MapboxSearch{--width:0;display:none}.Results{background-color:var(--colorBackground);border:var(--border);border-radius:var(--borderRadius);box-shadow:var(--boxShadow);color:var(--colorText);font-family:var(--fontFamily);font-size:var(--unit);font-weight:var(--fontWeight);line-height:var(--lineHeight);min-width:var(--minWidth);overflow-y:auto;position:absolute;transform:translateZ(0);transition:visibility var(--duration);width:var(--width);z-index:1000}.Results:not([aria-hidden=true]){visibility:visible}.Results[aria-hidden=true]{animation:fadein var(--duration) var(--curve) reverse forwards;visibility:hidden}.Suggestion{align-items:center;display:flex;padding:var(--padding)}.Suggestion:hover{cursor:pointer}.Suggestion[aria-selected=true]{background-color:var(--colorBackgroundHover)}.Suggestion:active{background-color:var(--colorBackgroundActive)}.SuggestionName{font-weight:var(--fontWeightBold)}.SuggestionIcon{margin-right:6px}.SuggestionIcon[aria-hidden=true]{display:none}.ResultsAttribution{padding:var(--paddingFooterLabel)}.ResultsAttribution a{color:var(--colorSecondary)}.ResultsAttribution a:not(:hover){text-decoration:none}.ResultsList{list-style:none;margin:0;padding:0}.Label{display:none}.Geocoder,.SearchBox{background-color:var(--colorBackground);border:var(--border);border-radius:var(--borderRadius);box-shadow:var(--boxShadow);color:var(--colorText);font-family:var(--fontFamily);font-size:var(--unit);font-weight:var(--fontWeight);line-height:var(--lineHeight);padding:var(--padding);padding-bottom:0;padding-top:0;position:relative;width:100%}.SearchIcon{fill:#757575;left:.5em}.ActionIcon,.SearchIcon{bottom:0;height:20px;margin:auto 0;position:absolute;top:0;width:20px}.ActionIcon{right:.5em}.ActionIcon>button{background:none;border:none;color:inherit;cursor:pointer;font:inherit;height:100%;outline:inherit;padding:0;width:100%}.ActionIcon>button:hover{background:none!important}.ClearBtn{display:none}.ClearBtn:hover{color:#909090}.LoadingIcon{-moz-animation:rotate .8s cubic-bezier(.45,.05,.55,.95) infinite;-webkit-animation:rotate .8s cubic-bezier(.45,.05,.55,.95) infinite;animation:rotate .8s cubic-bezier(.45,.05,.55,.95) infinite;display:none;height:100%}@-webkit-keyframes rotate{0%{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes rotate{0%{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}.Input{background-color:transparent;border:0;color:#404040;color:rgba(0,0,0,.75);font:inherit;height:36px;margin:0;overflow:hidden;padding:0 40px;text-overflow:ellipsis;white-space:nowrap;width:100%}.Input::-ms-clear{display:none}.Input:focus{border:thin dotted;border-radius:var(--borderRadius);box-shadow:none;color:#404040;color:rgba(0,0,0,.75);outline:0}mapbox-address-confirmation-feature[aria-hidden=true],mapbox-address-confirmation-no-feature[aria-hidden=true]{display:none}.MapboxAddressConfirmation{align-items:center;background-color:var(--colorBackdrop);bottom:0;display:flex;justify-content:center;left:0;position:fixed;right:0;top:0;transform:translateZ(0);z-index:1000}.MapboxAddressConfirmation:not([aria-hidden=true]){animation:fadein var(--duration) var(--curve) forwards;visibility:visible}.MapboxAddressConfirmation[aria-hidden=true]{visibility:hidden}.ContentFeature,.ContentNoFeature{width:var(--minWidth)}
70.Modal{background-color:var(--colorBackground);border:var(--border);border-radius:var(--borderRadius);box-shadow:var(--boxShadow);color:var(--colorText);font-family:var(--fontFamily);font-size:var(--unit);font-weight:var(--fontWeight);line-height:var(--lineHeight);padding:var(--paddingModal);width:100%}@media screen and (max-width:480px){.MapboxAddressConfirmation{align-items:flex-end}.ContentFeature,.ContentNoFeature{width:100%}.Modal{border-bottom-left-radius:0;border-bottom-right-radius:0}}.ModalHeader{align-items:center;color:var(--colorPrimary);display:flex;font-size:var(--unitHeader);font-weight:var(--fontWeightBold);margin-bottom:var(--spacing);user-select:none;width:100%}.ModalMap{height:calc(var(--minWidth)*9/16);margin-left:calc(var(--paddingModal)*-1);width:calc(100% + var(--paddingModal)*2)}.ModalMap[aria-hidden=true]{display:none}.Icon{height:var(--unitHeader);width:var(--unitHeader)}.Icon.IconClose{color:var(--colorSecondary)}.ModalHeaderTitle{flex:1;margin-left:.25em}.ModalFooter{color:var(--colorSecondary);margin-top:var(--spacing);text-align:center}.ModalFooter[aria-hidden=true]{display:none}.ModalSubheader{font-weight:var(--fontWeightBold);user-select:none}.ModalDescription{color:var(--colorPrimary)}.ModalAddress,.ModalSubheader{margin-bottom:var(--spacing)}.ModalAddress.ModalAddressApprove{color:var(--colorPrimary)}.Button{border-radius:var(--borderRadius);cursor:pointer;font-weight:var(--fontWeightSemibold);margin-top:var(--spacing);padding:var(--padding);text-align:center;user-select:none;width:100%}.Button[aria-hidden=true]{display:none}.Button.ButtonPrimary{background-color:var(--colorPrimary);color:var(--colorBackground)}.Button.ButtonSecondary{border:1px solid var(--colorSecondary);color:var(--colorSecondary)}@keyframes fadein{0%{opacity:0}to{opacity:1}}.MapboxAddressMinimap{font-family:var(--fontFamily);font-size:var(--unit);font-weight:var(--fontWeight);line-height:var(--lineHeight)}.MapboxAddressMinimap[aria-hidden=true]{display:none}.MinimapImageContainer{border-radius:var(--borderRadius);overflow:hidden}.MinimapImage{height:unset;max-height:unset;max-width:unset;position:relative;width:unset}.MinimapInnerFrame{border:var(--border);border-radius:inherit;height:inherit;left:0;overflow:hidden;position:absolute;top:0;width:inherit}.MinimapMarker{left:50%;position:absolute;top:50%}.MinimapMarker>svg{color:var(--colorPrimary);display:block!important}.MinimapAttributionLogo{bottom:0;left:0;margin:0 0 6px 6px;position:absolute}.MinimapAttributionLogo a{cursor:pointer;display:block;height:23px;width:88px}.MinimapAttributionText{background-color:hsla(0,0%,100%,.65);bottom:0;font:11px/16px Helvetica Neue,Arial,Helvetica,sans-serif;padding:0 5px;position:absolute;right:0}.MinimapAttributionText a{color:rgba(0,0,0,.75);text-decoration:none}.MinimapAttributionText a:hover{color:inherit;text-decoration:underline}.MinimapAttributionText a:not(:first-child){margin-left:3px}.MinimapStyleToggle{background-position:0;background-repeat:no-repeat;background-size:contain;border:2px solid #fff;border-radius:3px;box-shadow:var(--boxShadow);cursor:pointer;height:2em;position:absolute;right:var(--spacing);top:var(--spacing);width:2em}.MinimapFooter{color:var(--colorSecondary);font-family:var(--fontFamily);font-size:var(--unit);margin-top:var(--spacing)}.MinimapFooter[aria-hidden=true]{display:none}.MinimapEditButtons{bottom:26px;display:flex;font-family:var(--fontFamily);position:absolute;right:var(--spacing)}.MinimapEditButtons .Button{box-shadow:var(--boxShadow)}.MinimapButtonCancel{background-color:var(--colorBackground);margin-left:var(--spacing)}.draggable{cursor:move;cursor:grab}.draggable:active{cursor:grabbing}",e_=class extends CustomEvent{constructor(e,i){super(e,{composed:!0,detail:i})}clone(e){let i=new e_(this.type,this.detail);return e&&Object.defineProperty(i,"target",{value:e}),i}},eg=(e,i,r)=>`${i} ${1===i?"result is":"results are"} available. ${e}. ${r} of ${i} is selected.`,ey=e=>`${e} ${1===e?"result is":"results are"} available. Use up and down arrows to review and enter to select. Touch device users, explore by touch or with swipe gestures.`;function ex(e){let i=e.currentTarget;
70(" "===e.key||"Enter"===e.key)&&(e.preventDefault(),e.stopPropagation(),i.dispatchEvent(new MouseEvent("click",{bubbles:!0,composed:!0})))}var ev="search-listbox__description",eb=e=>{let i=document.createElement("div");i.setAttribute("aria-live","polite"),i.setAttribute("aria-atomic","true"),i.setAttribute("role","status"),i.setAttribute("style","border: 0px;clip: rect(0px, 0px, 0px, 0px);height: 1px;margin-bottom: -1px;margin-right: -1px;overflow: hidden;padding: 0px;position: absolute;white-space: nowrap;width: 1px;");let r=document.createElement("div");return r.setAttribute("id",`${e}--${ev}`),i.appendChild(r),i},ew=(e,i)=>{var r;let a=null!=(r=document.body.querySelector(`[id="${i}--${ev}"]`))?r:null;a&&(a.textContent=e)},eT=e=>{e.name=e.name+" address-search",e.setAttribute("data-lpignore","true")},eS=(e,i,r)=>{let a=null,n=!i||0===i.length;if((null==e?void 0:e.length)<2)a="Type in 2 or more characters for results. When autocomplete results are available use up and down arrows to review and enter to select. Touch device users, explore by touch or with swipe gestures.";else if(n)a="No search results.";else if(void 0!==r){let e=i[r];a=eg(e.name||e.feature_name||e.properties.name,i.length,r+1)}else a=ey(i.length);return a},eM=(e,i)=>{switch(i){case 0:return e.matching_name||e.feature_name||e.address_line1;case 2:return e.name;case 1:return e.properties.name;default:return""}},eE=(e,i)=>{switch(i){case 0:return e.description;case 2:return"poi"===e.feature_type?e.full_address:e.place_formatted;case 1:return e.properties.place_formatted;default:return""}};function eA(e,i){return`${e}-${i}`}var eI,eC,eP,eL,ek,eR,ez,eD,eO,eB,eF,eN,eV,eU,ej,eG,eq,eW,e$=class extends en{constructor(){super(...arguments),M(this,eD),M(this,eB),this.suggestions=null,M(this,eI,null),M(this,eC,void 0),M(this,eP,void 0),M(this,eL,void 0),M(this,ek,void 0),M(this,eR,null),M(this,ez,void 0),M(this,eN,{}),M(this,eV,{}),M(this,eU,e=>{let{Results:i}=S(this,eC),r=e.target;if(r.dataset.mapboxSuccess){delete r.dataset.mapboxSuccess;return}let a=r.value;this.renderAriaMessage(),i.setAttribute("aria-busy","true"),this.dispatchEvent(new e_("input",{lastInput:e.data,inputText:a}))}),this.renderAriaMessage=()=>{var e;ew(eS(null==(e=this.input)?void 0:e.value,this.suggestions,this.selectedIndex),this.dataset.seed)},this.clearAriaMessage=()=>{ew("",this.dataset.seed)},this.handleSuggest=e=>{if(this.suggestions=e,e&&0!==e.length||this.renderAriaMessage(),!e){this.hideResults();return}A(this,eB,eF).call(this),e.length&&A(this,eD,eO).call(this);let{Results:i}=S(this,eC);i.setAttribute("aria-busy","false")},this.handleError=()=>{let{Results:e}=S(this,eC);e.setAttribute("aria-busy","false"),this.hideResults()},M(this,ej,(e,i)=>I(this,null,function*(){let r=this.input;r&&(r.dataset.mapboxSuccess="true"),this.dispatchEvent(new e_("select",{suggestion:e,selectedIndex:i})),this.hideResults()})),M(this,eG,()=>{let e=this.input;delete e.dataset.mapboxSuccess,this.dispatchEvent(new e_("focus")),this.renderAriaMessage(),A(this,eD,eO).call(this)}),M(this,eq,()=>{document.activeElement!==this.input&&(this.dispatchEvent(new e_("blur")),this.clearAriaMessage(),this.hideResults())}),this.handleArrowUp=()=>{void 0===this.selectedIndex?this.selectedIndex=this.suggestions.length-1:0===this.selectedIndex?this.selectedIndex=void 0:this.selectedIndex=Math.max(0,this.selectedIndex-1)},this.handleArrowDown=()=>{void 0===this.selectedIndex?this.selectedIndex=0:this.selectedIndex===this.suggestions.length-1?this.selectedIndex=void 0:this.selectedIndex=Math.min(this.selectedIndex+1,this.suggestions.length-1)},M(this,eW,e=>{var i;if(null==(i=this.suggestions)?void 0:i.length){if("ArrowDown"===e.key){e.preventDefault(),this.handleArrowDown();return}if("ArrowUp"===e.key){e.preventDefault(),this.handleArrowUp();return}if("Escape"===e.key){this.hideResults();return}if(void 0!==this.selectedIndex){if("Tab"===e.key){S(this,ej).call(this,this.suggestions[this.selectedIndex],this.selectedIndex);return}if("Enter"===e.key){e.preventDefault(),S(this,ej).call(this,this.suggestions[this.selectedIndex],this.selectedIndex);return}}}})}get template(){return Z}get templateStyle(){return em}get templateUserStyle(){return eh(".MapboxSearch",this.theme)}get input(){return S(this,ek)}set input(e){let i=S(this,ek);i&&(i.removeEventListener("input",S(this,eU)),i.removeEventListener("focus",S(this,eG)),i.removeEventListener("blur",S(this,eq)),i.removeEventListener("keydown",S(this,eW)),S(this,eI)&&S(this,eI).destroy()),e&&(e.addEventListener("input",S(this,eU)),e.addEventListener("focus",S(this,eG)),e.addEventListener("blur",S(this,eq)),e.addEventListener("keydown",S(this,eW)),e.setAttribute("role","combobox"),e.setAttribute("aria-autocomplete","list"),e.setAttribute("aria-controls",S(this,eL)),this.isConnected&&E(this,eI,new ef(e,S(this,eC).Results,this.popoverOptions))),E(this,ek,e)}get searchService(){return S(this,eR)}set searchService(e){E(this,eR,e)}get selectedIndex(){return S(this,ez)}set selectedIndex(e){let i=S(this,ez);E(this,ez,e);let{ResultsList:r}=S(this,eC),a=eA(S(this,eL),e);if(void 0!==e?(this.input.setAttribute("aria-activedescendant",a),r.setAttribute("aria-activedescendant",a)):(this.input.removeAttribute("aria-activedescendant"),r.removeAttribute("aria-activedescendant")),i!==e){let n=eA(S(this,eL),i),s=r.querySelector(`#${n}`);if(null==s||s.removeAttribute("aria-selected"),null==s||s.setAttribute("tabindex","-1"),void 0!==e){let e=r.querySelector(`#${a}`);null==e||e.setAttribute("aria-selected","true"),null==e||e.setAttribute("tabindex","0")}}this.renderAriaMessage()}hideResults(){let{Results:e,ResultsList:i}=S(this,eC);e.setAttribute("aria-hidden","true"),this.input.setAttribute("aria-expanded","fal
70se"),i.removeAttribute("aria-activedescendant"),this.input.removeAttribute("aria-activedescendant")}renderItem(e){let i=this.prepareTemplate(X);return i.id=eA(S(this,eL),e),i}fillItem(e,i,r,a){let n=e.querySelector('[class$="SuggestionIcon"]'),s=e.querySelector('[class$="SuggestionName"]'),l=e.querySelector('[class$="SuggestionDesc"]');0===this.searchService?(n.innerHTML=eu("street"===i.accuracy?"street":"addressMarker",this.theme),n.removeAttribute("aria-hidden")):n.setAttribute("aria-hidden","true"),s.textContent=l.textContent="",s.textContent=eM(i,this.searchService),l.textContent=eE(i,this.searchService),r===this.selectedIndex?e.setAttribute("aria-selected","true"):e.removeAttribute("aria-selected"),e.setAttribute("aria-posinset",(r+1).toString()),e.setAttribute("aria-setsize",a.toString())}get theme(){return S(this,eN)}set theme(e){E(this,eN,e),S(this,eC)&&e&&this.updateTemplateUserStyle(eh(".MapboxSearch",e))}get popoverOptions(){return S(this,eV)}set popoverOptions(e){E(this,eV,e),S(this,eI)&&(S(this,eI).options=e,S(this,eI).update())}connectedCallback(){super.connectedCallback(),this.dataSeed=this.dataset.seed,E(this,eP,this.dataset.seed+"-Label"),E(this,eL,this.dataset.seed+"-ResultsList"),this.input&&this.input.setAttribute("aria-controls",S(this,eL)),E(this,eC,L(this,{MapboxSearch:".MapboxSearch",Results:".Results",ResultsList:".ResultsList",Label:".Label"}));let{Results:e,ResultsList:i,Label:r}=S(this,eC);r.id=S(this,eP),i.id=S(this,eL),i.setAttribute("aria-labelledby",S(this,eP)),e.addEventListener("blur",S(this,eq)),!S(this,eI)&&this.input&&E(this,eI,new ef(this.input,S(this,eC).Results,this.popoverOptions)),requestAnimationFrame(()=>{S(this,eI)&&S(this,eI).update()})}disconnectedCallback(){this.input=null;let{Results:e}=S(this,eC);e.removeEventListener("blur",S(this,eq)),S(this,eI)&&S(this,eI).destroy()}focus(){document.activeElement===this.input?S(this,eG).call(this):this.input.focus()}blur(){this.input.blur()}updatePopover(){S(this,eI)&&S(this,eI).update()}};eI=new WeakMap,eC=new WeakMap,eP=new WeakMap,eL=new WeakMap,ek=new WeakMap,eR=new WeakMap,ez=new WeakMap,eD=new WeakSet,eO=function(){if(!this.suggestions||!this.suggestions.length)return;let{Results:e,MapboxSearch:i}=S(this,eC),r=this.input.getBoundingClientRect();i.style.setProperty("--width",`${r.width}px`),i.style.setProperty("display","block"),this.input.setAttribute("aria-expanded","true"),e.removeAttribute("aria-hidden"),this.selectedIndex=void 0},eB=new WeakSet,eF=function(){let{ResultsList:e}=S(this,eC);if(!this.suggestions||!this.suggestions.length){e.innerHTML="",this.hideResults();return}let i=Array.from(e.childNodes||[]).filter(e=>e.nodeType===Node.ELEMENT_NODE);if(this.suggestions.length>i.length)for(let r=i.length;r<this.suggestions.length;r++){let a=this.renderItem(r);i.push(a),a.onmouseenter=()=>{this.selectedIndex=r},a.onmouseleave=()=>{this.selectedIndex=void 0},e.appendChild(a)}if(this.suggestions.length<i.length)for(let e=this.suggestions.length;e<i.length;e++)i[e].remove();for(let e=0;e<this.suggestions.length;e++){let r=this.suggestions[e],a=i[e];this.fillItem(a,r,e,this.suggestions.length),a.onclick=()=>{S(this,ej).call(this,r,e)}}},eN=new WeakMap,eV=new WeakMap,eU=new WeakMap,ej=new WeakMap,eG=new WeakMap,eq=new WeakMap,eW=new WeakMap,window.MapboxSearchListbox=e$,window.customElements.get("mapbox-search-listbox")||customElements.define("mapbox-search-listbox",e$);var eH=r(596),eZ=new Set(["street-address","address-line1","address-line2","address-line3","address-level4","address-level3","address-level2","address-level1","country","country-name","postal-code"]),eX=new Set(["off","on","true","false"]);function eY(e){let i=e.parentNode;for(;i;){if(i instanceof HTMLFormElement)return i;i=i.parentNode}return null}function eJ(e){return Array.from((e||document).querySelectorAll('input[autocomplete~="address-line1"], input[autocomplete~="street-address"]'))}function eK(e){let i=Array.from(e.querySelectorAll("[autocomplete]")).filter(e=>{let i=e.tagName.toLowerCase();return"input"===i||"select"===i||"textarea"===i}),r=[];for(let e of i){if("none"===window.getComputedStyle(e).display)continue;let i=e.getAttribute("autocomplete")||"";if(!i||eX.has(i))continue;let a=i.toLowerCase().split(" ");if(a.length>3)continue;let n=a[a.length-1];if(!eZ.has(n))continue;a.pop();let s="section-default";if(a.length){let e=a[a.length-1];"shipping"===e&&(s="section-shipping",a.pop()),"billing"===e&&(s="section-billing",a.pop())}if(a.length){let e=a[a.length-1];e.startsWith("section-")&&(s=e)}r.push({input:e,section:s,field:n})}return r}function eQ(e,i){let r=[],a=[],n=eK(e),s=null;
70for(let{input:e,section:l,field:h}of n){let n=r.length-1,u=!1;if(r.length?(a[n]!==l||r[n][h])&&(u=!0):u=!0,u){if(s)break;r.push({[h]:e}),a.push(l),n++}else r[n][h]=e;e===i&&(s=r[n])}return null!=s?s:{}}function e0(e,i,r){var a;let n=eQ(e,i),s=[r.address_line1,r.address_line2,r.address_line3].filter(e=>!!e).join(", ");R(n["street-address"],n["address-line2"]?r.address_line1||"":s),R(n["address-line1"],r.address_line1||""),R(n["address-line2"],r.address_line2||""),R(n["address-level1"],r.address_level1||""),R(n["address-level2"],r.address_level2||""),R(n["address-level3"],r.address_level3||"");let l=r.country_code||(null==(a=r.metadata)?void 0:a.iso_3166_1)||"";if(n.country&&n.country instanceof HTMLSelectElement){let e=n.country.querySelector("option").value;""===e&&(e=n.country.querySelectorAll("option")[1].value);let i=e===e.toUpperCase();R(n.country,i?l.toUpperCase():l)}else R(n.country,l);R(n["country-name"],r.country||""),R(n["postal-code"],r.postcode||"")}function e1(e,i){let r=eQ(e,i),a={};for(let[e,i]of Object.entries(r))(null==i?void 0:i.value)&&(a[e]=i.value);return a}function e2(e){let i=[];return e["street-address"]?i.push(e["street-address"]):i.push(e["address-line1"]||""),i.push(e["address-line2"]||""),i.push(e["address-line3"]||""),i.push(e["address-level3"]||""),i.push(e["address-level2"]||""),i.push(e["address-level1"]||""),i.push(e["postal-code"]||""),e["country-name"]?i.push(e["country-name"]):i.push(e.country||""),i.filter(e=>!!e).map(e=>e.trim()).join(", ")}function e3(e,i){let r=eY(i);if(!r)return;let a=(0,eH.featureToSuggestion)(e);e0(r,i,a);let n=eQ(r,i);n["address-line2"]&&!a.address_line2&&n["address-line2"].focus()}var e4=e=>e.filter((e,i,r)=>{let a=eM(e,0);return"street"!==e.accuracy||r.findIndex(e=>a===eM(e,0))===i}),e5=(e,i,r)=>{e&&(e.autocomplete=r?i||"address-line1":"new-password")},e6=(e,i,r)=>{e&&r&&(e5(e,i,!0),e3({properties:y(g({},r),{address_line1:r.address_line1+" ",postcode:null})},e),e5(e,i,!1),null==e||e.focus())},e8=r(596),e9=r(596),e7=b(r(654)),te=r(907),tt=r(596),ti=new class{constructor(){this.feedbackEnabled=!0,this.autofillSessionToken=new tt.SessionToken,this.autofillSessionEnabled=!1,this.detectBrowserAutofillEnabled=!1}};Object.defineProperty(ti,"autofillSessionToken",{configurable:!1,writable:!1});var tr,ta,tn,to,ts=k(` 71<template> 72 <div class="MapboxAddressConfirmation" aria-hidden="true"> 73 <mapbox-address-confirmation-feature class="ContentFeature"></mapbox-address-confirmation-feature> 74 <mapbox-address-confirmation-no-feature class="ContentNoFeature"></mapbox-address-confirmation-no-feature> 75 </div> 76</template> 77`),tl=class extends en{constructor(){super(...arguments),M(this,tr,!1),M(this,ta,void 0),M(this,tn,void 0),M(this,to,{})}get template(){return ts}get templateStyle(){return em}get templateUserStyle(){return eh(".MapboxAddressConfirmation",this.theme)}get theme(){return S(this,to)}set theme(e){if(E(this,to,e),!S(this,ta)||!e)return;this.updateTemplateUserStyle(eh(".MapboxAddressConfirmation",e));let{ContentFeature:i,ContentNoFeature:r}=S(this,ta);i.theme=e,r.theme=e}connectedCallback(){super.connectedCallback(),E(this,ta,L(this,{MapboxAddressConfirmation:".MapboxAddressConfirmation",ContentFeature:".ContentFeature",ContentNoFeature:".ContentNoFeature"}));let{MapboxAddressConfirmation:e}=S(this,ta);e.setAttribute("aria-hidden","true");let i=this.theme;if(i){let{ContentFeature:e,ContentNoFeature:r}=S(this,ta);e.theme=i,r.theme=i}}disconnectedCallback(){E(this,tn,null)}hide(){var e;if(E(this,tr,!1),!S(this,ta))return;let{MapboxAddressConfirmation:i}=S(this,ta);i.setAttribute("aria-hidden","true"),null==(e=S(this,tn))||e.deactivate(),e7.default.off()}show(e,i,r){return I(this,null,function*(){var a;if(!S(this,ta))return{type:"cancel"};let{MapboxAddressConfirmation:n,ContentFeature:s,ContentNoFeature:l}=S(this,ta),{accessToken:h,minimap:u=!1,theme:c,footer:d}=i;this.theme=c,r?(s.removeAttribute("aria-hidden"),l.setAttribute("aria-hidden","true"),s.minimap=u,s.accessToken=h,s.footer=d,s.update(r,e)):(s.setAttribute("aria-hidden","true"),l.removeAttribute("aria-hidden"),l.update(e)),E(this,tr,!0),n.removeAttribute("aria-hidden"),e7.default.on();let p=r?s:l;return E(this,tn,(0,te.createFocusTrap)(n,{fallbackFocus:p,escapeDeactivates:()=>(this.hide(),!0)})),null==(a=S(this,tn))||a.activate(),new Promise(e=>{let i=a=>{p.removeEventListener("result",i);let n=a.detail;this.hide(),e("change"===n?{type:"change",feature:r}:{type:n})};p.addEventListener("result",i)})})}tryShow(e,i){return I(this,null,function*(){if(!S(this,ta))return{type:"cancel"};let{accessToken:r,options:a={}}=i,n=new e9.ValidationCore(g({accessToken:r},a)),s=e2(e),l=(yield n.validate(s,{sessionToken:ti.autofillSessionToken})).features[0];if(l){let{skipConfirmModal:e=e=>e.properties.match_code.confidence===e9.MatchCodeConfidence.exact}=i;if(e(l))return{type:"nochange"}}return yield this.show(e,i,l)})}};tr=new WeakMap,ta=new WeakMap,tn=new WeakMap,to=new WeakMap,window.MapboxAddressConfirmation=tl,window.customElements.get("mapbox-address-confirmation")||customElements.define("mapbox-address-confirmation",tl);var th=new tl;function tu(e){return I(this,arguments,function*(e,i={}){var r;let{sections:a=[]}=i;th.parentNode||document.body.appendChild(th);let n={type:"nochange"},s=eJ(e),l=eK(e),h=Array.from(document.querySelectorAll("mapbox-search-listbox"));for(let u of s){if(a.length){let e=l.find(e=>e.input===u);if(!e||!a.includes(e.section))continue}let s=e1(e,u),c=h.find(e=>e.input===u),d=null==c?void 0:c.autofillHost;if(d){let e=d.retrieveFeature;if(e&&!function(e,i){for(let[r,a]of Object.entries(e))if(i[r]!==a)return!0;return!1}(s,function(e){var i;let r={},a=[e.properties.address_line1,e.properties.address_line2,e.properties.address_line3].filter(e=>!!e).join(", ");return r["street-address"]=a,r["address-line1"]=e.properties.address_line1,r["address-line2"]=e.properties.address_line2,r["address-line3"]=e.properties.address_line3,r["address-level1"]=e.properties.address_level1,r["address-level2"]=e.properties.address_level2,r["address-level3"]=e.properties.address_level3,r.country=null==(i=e.properties.metadata)?void 0:i.iso_3166_1,r["country-name"]=e.properties.country,r["postal-code"]=e.properties.postcode,r}(e)))continue}let p=i.accessToken||ti.accessToken,f=yield th.tryShow(s,y(g({},i),{accessToken:p}));if("change"===f.type){let i=eQ(e,u);((null==(r=i["address-line2"])?void 0:r.value)&&(f.feature.properties.address_line2=i["address-line2"].value),
77c)?d.simulateRetrieve(f.feature):(u.dataset.mapboxSuccess="true",e0(e,u,(0,e8.featureToSuggestion)(f.feature)))}"change"===f.type&&"cancel"!==n.type&&(n=f),"cancel"===f.type&&(n=f)}return n})}function tc(e,i,r,a,n){if(i){let s=k(` 78 <span> 79 <span></span> 80 <br /> 81 <span></span> 82 </span> 83 `),[l,h]=Array.from(s.querySelectorAll("span > span"));if(r&&a)l.textContent=r,h.textContent=a;else{let e=i.split(",");l.textContent=e[0].trim(),h.textContent=e.slice(1).join(",").trim()}if(!n){if(e["address-line2"]){let i=document.createElement("span");i.textContent=e["address-line2"],s.insertBefore(i,h),s.insertBefore(document.createElement("br"),h)}if(e["address-line3"]){let i=document.createElement("span");i.textContent=e["address-line3"],s.insertBefore(i,h),s.insertBefore(document.createElement("br"),h)}}return s}{let i=[e["street-address"]||e["address-line1"]||"",e["address-line2"],e["address-line3"],[e["address-level4"]||"",e["address-level3"]||"",e["address-level2"]||"",`${e["address-level1"]||""} ${e["postal-code"]||""}`,e.country||e["country-name"]||""].filter(Boolean).join(", ")].filter(Boolean).map(e=>`<span>${e}</span>`).join("<br />");return k(` 84 <span>${i}</span> 85 `)}}function td(e,i,r,a){return I(this,null,function*(){if(!r)return;let n=eY(e),s=Object.values(eQ(n,e));if(!i.detail.elements.some(e=>s.includes(e)))return;let l=eK(n),h=l.find(i=>i.input===e).section,u=Array.from(new Set(l.filter(e=>i.detail.elements.includes(e.input)).map(e=>e.section)));if(!u.includes(h))return;let c="object"==typeof r&&r.sections||[];if(c.length&&!c.some(e=>u.includes(e)))return;let d="object"==typeof r?r:{};d=y(g({},d),{accessToken:a,sections:[h]}),yield tu(n,d)})}function tp(e,i){if(!ti.feedbackEnabled)return;let r=window.location.hostname,a=`${r.match(/localhost|[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}|::1|\.local|^$/gi)||H.some(e=>r.includes(e))?"https://contribute-api-staging.tilestream.net/v1":"https://contribute-api.mapbox.com/v1"}/edit-suggestion/address?access_token=${e}`,{originalCoordinate:n,originalAddress:s,changes:l}=i,h={action:"update",reason:"incorrect_address",location:{longitude:n[0],latitude:n[1]},userEmail:"[email protected]",changes:l,placeName:s};fetch(a,{method:"POST",headers:new Headers({"User-Agent":`mapbox-search-js.${eo}.${navigator.userAgent}`,"Content-Type":"application/json"}),body:JSON.stringify(h)})}var tf,tm,t_,tg,ty,tx,tv,tb,tw=k(` 86<template> 87 <div class="MapboxAddressConfirmationFeature"> 88 <div class="Modal" aria-modal="true" role="dialog"> 89 <div class="ModalHeader"> 90 <svg viewBox="0 0 18 18" class="Icon IconQuestion"></svg> 91 <div class="ModalHeaderTitle">Did you mean?</div> 92 <svg
93 viewBox="0 0 18 18" 94 class="Icon IconClose" 95 tabindex="0" 96 role="button" 97 title="Close" 98 aria-label="Close" 99 aria-expanded="true" 100 ></svg> 101 </div> 102 103 <div class="ModalAddress ModalAddressApprove"></div> 104 105 <div class="ModalMap"> 106 <mapbox-address-minimap class="Minimap"></mapbox-address-minimap> 107 </div> 108 109 <div 110 class="Button ButtonPrimary ButtonApprove" 111 tabindex="0" 112 role="button" 113 aria-label="Yes" 114 > 115 Yes 116 </div> 117 118 <div 119 class="Button ButtonSecondary ButtonReject" 120 tabindex="0" 121 role="button" 122 aria-label="No, use the address I provided" 123 > 124 No, use the address I provided 125 </div> 126 127 <div class="ModalFooter"> 128 Your confirmation helps improve address data accuracy. 129 </div> 130 </div> 131 </div> 132</template> 133`),tT=class extends en{constructor(){super(...arguments),M(this,tf,void 0),M(this,tm,{}),this.minimap=!1,M(this,t_,void 0),M(this,tg,void 0),this.update=(e,i)=>{var r;E(this,t_,e),E(this,tg,i);let{ModalMap:a,Minimap:n,ModalAddressApprove:s}=S(this,tf);if(this.minimap){if(a.removeAttribute("aria-hidden"),n.accessToken=this.accessToken,"object"==typeof this.minimap){let{defaultMapStyle:e,theme:i,mapStyleMode:r,satelliteToggle:a}=this.minimap;e&&(n.defaultMapStyle=this.minimap.defaultMapStyle),i&&(n.theme=this.minimap.theme),r&&(n.mapStyleMode=r),void 0!==a&&(n.satelliteToggle=a)}n.feature=e}else a.setAttribute("aria-hidden","true");let l=e.properties.place_name||e.properties.full_address||e.properties.address;s.innerHTML="",s.appendChild(tc(i,l,e.properties.feature_name,e.properties.description,(null==(r=e.properties.place_type)?void 0:r[0])==="secondary_address"))},M(this,ty,()=>{this.dispatchEvent(new e_("result","cancel"))}),this.approve=()=>{this.dispatchEvent(new e_("result","change"))},this.reject=()=>{this.dispatchEvent(new e_("result","nochange")),tp(this.accessToken,{originalCoordinate:S(this,t_).geometry.coordinates,originalAddress:S(this,t_).properties.full_address,changes:{address:e2(S(this,tg))}})},M(this,tx,K()),M(this,tv,K()),M(this,tb,K())}get template(){return tw}get templateStyle(){return em}get templateUserStyle(){return eh(".MapboxAddressConfirmationFeature",this.theme)}get theme(){return S(this,tm)}set theme(e){if(E(this,tm,e),!S(this,tf)||!e)return;this.updateTemplateUserStyle(eh(".MapboxAddressConfirmationFeature",e));let{IconQuestion:i,IconClose:r}=S(this,tf);i.innerHTML=eu("question",e),r.innerHTML=eu("close",e)}set footer(e){if(void 0===e)return;let i=this.querySelector(".ModalFooter");"string"==typeof e?(i.textContent=e,i.removeAttribute("aria-hidden")):e?i.removeAttribute("aria-hidden"):i.setAttribute("aria-hidden","true")}connectedCallback(){super.connectedCallback(),E(this,tf,L(this,{MapboxAddressConfirmationFeature:".MapboxAddressConfirmationFeature",Modal:".Modal",ModalHeaderTitle:".ModalHeaderTitle",ModalMap:".ModalMap",Minimap:".Minimap",IconQuestion:".IconQuestion",IconClose:".IconClose",ButtonApprove:".ButtonApprove",ButtonReject:".ButtonReject",ModalAddressApprove:".ModalAddressApprove"}));let{Modal:e,ModalHeaderTitle:i,IconClose:r,ButtonApprove:a,ButtonReject:n,ModalAddressApprove:s}=S(this,tf);for(let a of(e.setAttribute("aria-labelledby",S(this,tv)),e.setAttribute("aria-describedby",S(this,tb)),r.setAttribute("aria-controls",S(this,tx)),e.id=S(this,tx),i.id=S(this,tv),s.id=S(this,tb),Array.from(this.querySelectorAll('[role="button"]'))))a.addEventListener("keydown",ex);r.addEventListener("click",S(this,ty)),a.addEventListener("click",this.approve),n.addEventListener("click",this.reject);let l=this.theme;if(l){let{IconQuestion:e,IconClose:i}=S(this,tf);e.innerHTML=eu("question",l),i.innerHTML=eu("close",l)}}disconnectedCallback(){let{IconClose:e,ButtonApprove:i}=S(this,tf);e.removeEventListener("click",S(this,ty)),i.removeEventListener("click",this.approve)}};tf=new WeakMap,tm=new WeakMap,t_=new WeakMap,tg=new WeakMap,ty=new WeakMap,tx=new WeakMap,tv=new WeakMap,tb=new WeakMap,window.MapboxAddressConfirmationFeature=tT,window.customElements.get("mapbox-address-confirmation-feature")||customElements.define("mapbox-address-confirmation-feature",tT);var tS,tM,tE,tA,tI,tC,tP=k(` 134<template> 135 <div class="MapboxAddressConfirmationNoFeature"> 136 <div class="Modal" aria-modal="true" role="dialog"> 137 <div class="ModalHeader"> 138 <svg viewBox="0 0 18 18" class="Icon IconQuestion"></svg> 139 <div class="ModalHeaderTitle">Confirm address</div> 140 <svg
141 viewBox="0 0 18 18" 142 class="Icon IconClose" 143 tabindex="0" 144 role="button" 145 title="Close" 146 aria-label="Close" 147 aria-expanded="true" 148 ></svg> 149 </div> 150 <div class="ModalDescription"> 151 We couldn't verify this address. Please check that your information is correct before continuing. 152 </div> 153 <br /> 154 <div class="ModalSubheader"> 155 You entered 156 </div> 157 <div class="ModalAddress"></div> 158 <div 159 class="Button ButtonPrimary" 160 tabindex="0" 161 role="button" 162 aria-label="Use the address I provided" 163 > 164 Use the address I provided 165 </div> 166 </div> 167 </div> 168</template> 169`),tL=class extends en{constructor(){super(...arguments),M(this,tS,void 0),M(this,tM,{}),this.update=e=>{let{ModalAddress:i}=S(this,tS);i.innerHTML="",i.appendChild(tc(e))},M(this,tE,()=>{this.dispatchEvent(new e_("result","cancel"))}),this.reject=()=>{this.dispatchEvent(new e_("result","nochange"))},M(this,tA,K()),M(this,tI,K()),M(this,tC,K())}get template(){return tP}get templateStyle(){return em}get templateUserStyle(){return eh(".MapboxAddressConfirmationNoFeature",this.theme)}get theme(){return S(this,tM)}set theme(e){if(E(this,tM,e),!S(this,tS)||!e)return;this.updateTemplateUserStyle(eh(".MapboxAddressConfirmationNoFeature",e));let{IconQuestion:i,IconClose:r}=S(this,tS);i.innerHTML=eu("question",e),r.innerHTML=eu("close",e)}connectedCallback(){super.connectedCallback(),E(this,tS,L(this,{Modal:".Modal",ModalHeaderTitle:".ModalHeaderTitle",IconQuestion:".IconQuestion",IconClose:".IconClose",ModalAddress:".ModalAddress",ButtonReject:".Button"}));let{Modal:e,ModalHeaderTitle:i,IconClose:r,ModalAddress:a,ButtonReject:n}=S(this,tS);for(let n of(e.setAttribute("aria-labelledby",S(this,tI)),e.setAttribute("aria-describedby",S(this,tC)),r.setAttribute("aria-controls",S(this,tA)),e.id=S(this,tA),i.id=S(this,tI),a.id=S(this,tC),Array.from(this.querySelectorAll('[role="button"]'))))n.addEventListener("keydown",ex);r.addEventListener("click",S(this,tE)),n.addEventListener("click",this.reject);let s=this.theme;if(s){let{IconQuestion:e,IconClose:i}=S(this,tS);e.innerHTML=eu("question",s),i.innerHTML=eu("close",s)}}disconnectedCallback(){let{IconClose:e,ButtonReject:i}=S(this,tS);e.removeEventListener("click",S(this,tE)),i.removeEventListener("click",this.reject)}};tS=new WeakMap,tM=new WeakMap,tE=new WeakMap,tA=new WeakMap,tI=new WeakMap,tC=new WeakMap,window.MapboxAddressConfirmationNoFeature=tL,window.customElements.get("mapbox-address-confirmation-no-feature")||customElements.define("mapbox-address-confirmation-no-feature",tL);var tk=r(596),tR=r(596),tz="browser-autofilled",tD=[],tO=(0,tR.debounce)(function(){window.dispatchEvent(new window.CustomEvent("browserautofill",{bubbles:!0,cancelable:!0,detail:{elements:tD}})),tD=[]},5);function tB(e){e.hasAttribute(tz)||(e.setAttribute(tz,""),tD.push(e),tO())}function tF(e){e.hasAttribute(tz)&&e.removeAttribute(tz)}function tN(e){"onbrowserautofillstart"===e.animationName?tB(e.target):tF(e.target)}function tV(e){let i=e.target;"select"===i.nodeName.toLowerCase()||e.simulated||e instanceof e_||"insertReplacementText"!==e.inputType&&"data"in e?tF(i):tB(i)}function tU(){var e;let i;ti.detectBrowserAutofillEnabled||(ti.detectBrowserAutofillEnabled=!0,e='input:-webkit-autofill,select:-webkit-autofill,textarea:-webkit-autofill{animation-name:onbrowserautofillstart}input:not(:-webkit-autofill),select:not(:-webkit-autofill),textarea:not(:-webkit-autofill){animation-name:onbrowserautofillcancel}@keyframes onbrowserautofillstart{0%{animation-name:"onbrowserautofillstart"}to{animation-name:"onbrowserautofillstart"}}@keyframes onbrowserautofillcancel{0%{animation-name:"onbrowserautofillcancel"}to{animation-name:"onbrowserautofillcancel"}}',(i=document.createElement("style")).innerHTML=e,document.head.appendChild(i),document.addEventListener("animationstart",tN,!0),document.addEventListener("input",tV,!0))}var tj,tG,tq,tW,t$,tH,tZ,tX,tY,tJ,tK,tQ,t0,t1,t2,t3,t4,t5,t6,t8,t9,t7,ie,it,ii,ir,ia=r(596),io=(e,i)=>{if("string"!=typeof e)return ia.LngLat.convert(e).toArray();if("ip"!==e)return e.split(",").map(Number);{let e=null==i?void 0:i.get("ip-proximity");return e&&"string"==typeof e?e.split(",").map(parseFloat):[999,999]}},is=e=>{let i={};return e.bbox&&("string"==typeof e.bbox?i.bbox=e.bbox.split(",").map(Number):i.bbox=ia.LngLatBounds.convert(e.bbox).toFlatArray()),e.proximity&&(i.proximity=io(e.proximity)),e.country&&(i.country=e.country.split(",")),e.language&&(i.language=e.language.split(",")),e.types&&("string"==typeof e.types?i.types=e.types.split(","):i.types=Array.from(e.types)),e.limit&&("string"==typeof e.limit?i.limit=parseInt(e.limit):i.limit=e.limit),i},il=(e,i)=>{let r={};return e.bbox&&("string"==typeof e.bbox?r.bbox=e.bbox.split(",").map(Number):r.bbox=ia.LngLatBounds.convert(e.bbox).toFlatArray()),e.proximity&&(r.proximity=io(e.proximity,i)),e.country&&(r.country=e.country.split(",")),e.language&&(r.language=e.language.split(",")),e.types&&("string"==typeof e.types?r.types=e.types.split(","):r.types=Array.from(e.types)),e.limit&&("string"==typeof e.limit?r.limit=parseInt(e.limit):r.limit=e.limit),"boolean"==typeof e.autocomplete&&(r.autocomplete=e.autocomplete),e.worldview&&(r.worldview=e.worldview),e.permanent&&(r.permanent=e.permanent),r},ih=(e,i)=>{let r={};return e.bbox&&("string"==typeof e.bbox?r.bbox=e.bbox.split(",").map(Number):r.bbox=ia.LngLatBounds.convert(e.bbox).toFlatArray()),e.proximity&&(r.proximity=io(e.proximity,i)),e.country&&(r.country=e.country.split(",")),e.language&&(r.language=e.language.split(",")),e.limit&&("string"==typeof e.limit?r.limit=parseInt(e.limit):r.limit=e.limit),void 0!==e.streets&&null!==e.streets&&("string"==typeof e.streets?r.streets="true"===e.streets:r.streets=e.streets),r},iu=(e,i,r)=>{switch(i){case 2:return is(e);case 1:return il(e,r);case 0:return ih(e,r)}},ic=e=>({suggestionIds:e.map(e=>e.mapbox_id||""),suggestionNames:e.map(e=>
169"poi"===e.feature_type?[e.name,e.full_address].filter(Boolean).join(", "):e.full_address?e.full_address:e.name),suggestionTypes:e.map(e=>e.feature_type||""),suggestionSources:e.map(()=>"mapbox")}),id=e=>({suggestionIds:e.map(e=>e.properties.mapbox_id||e.id||""),suggestionNames:e.map(e=>e.properties.full_address||""),suggestionTypes:e.map(e=>e.properties.feature_type||""),suggestionSources:e.map(()=>"mapbox")}),ip=e=>({suggestionIds:e.map(e=>e.mapbox_id||""),suggestionNames:e.map(e=>e.full_address||""),suggestionTypes:e.map(e=>{var i;return(null==(i=e.place_type)?void 0:i[0])||""}),suggestionSources:e.map(()=>"mapbox")}),im=(e,i)=>{switch(i){case 2:return ic(e);case 1:return id(e);case 0:return ip(e)}},i_=(e,i)=>{switch(e){case 2:return"search/searchbox/v1/suggest";case 1:return`search/geocode/v6/${/^[ ]*(-?\d{1,3}(\.\d{0,256})?)[, ]+(-?\d{1,3}(\.\d{0,256})?)[ ]*$/.test(i)?"reverse":"forward"}`;case 0:return"autofill/v1/suggest"}},ig=class{constructor(e){M(this,tj,"https://api.mapbox.com"),M(this,tG,"events/v2"),M(this,tq,void 0),M(this,tW,void 0),M(this,t$,navigator.language||null),M(this,tH,[]),M(this,tZ,""),M(this,tX,0),M(this,tY,!0),M(this,tJ,1e3),M(this,tK,100),M(this,tQ,void 0),M(this,t0,void 0),this.start=(e,i,r,a)=>{E(this,tq,i.accessToken);let n=S(this,t4).call(this,"search.start",{queryString:e,options:i,map:r,responseHeaders:a});n&&S(this,ir).call(this,n)},this.input=(e,i,r,a,n)=>{if(E(this,tq,r.accessToken),S(this,tY)&&(this.start(e,r,a,n),E(this,tY,!1)),!i)return;let s=S(this,t4).call(this,"search.keystroke",{lastInput:i,queryString:e,options:r,map:a,responseHeaders:n});s&&S(this,ir).call(this,s)},this.select=(e,i,r,a,n,s)=>{E(this,tq,a.accessToken);let l=S(this,t4).call(this,"search.select",{queryString:e,selectedIndex:i,suggestions:r,options:a,map:n,responseHeaders:s});l&&(l.resultIndex!==S(this,tX)||l.queryString!==S(this,tZ))&&-1!==l.resultIndex&&(E(this,tX,l.resultIndex),E(this,tZ,l.queryString),S(this,ir).call(this,l))},this.clear=()=>{E(this,tY,!0),E(this,tZ,""),E(this,tX,0),S(this,ii).call(this)},M(this,t1,e=>{let i=`${S(this,tj)}/${S(this,tG)}?access_token=${S(this,tq)}`,r=S(this,t2).call(this,e);try{fetch(i,r)}catch(e){S(this,t3).call(this,e)}}),M(this,t2,e=>(Array.isArray(e)||(e=[e]),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})),M(this,t3,e=>{console.log(e)}),M(this,t4,(e,i)=>{if("search.select"===e&&!("number"==typeof i.selectedIndex||i.suggestions)||"search.keystroke"===e&&!i.lastInput)return null;let r=iu(i.options,S(this,t0),i.responseHeaders),a=S(this,t5).call(this,e,i,r);return"search.keystroke"===e?S(this,t6).call(this,a,i,r):"search.select"===e&&S(this,t8).call(this,a,i,r),S(this,ie).call(this,a)?a:null}),M(this,t5,(e,i,r)=>{let a={event:e,version:S(this,t7).call(this,e),created:+new Date,sessionIdentifier:i.options.sessionToken,userAgent:S(this,tW),keyboardLocale:S(this,t$),queryString:i.queryString};
169if(r&&(a=g(g({},a),r)),"search.start"===e)for(let e of["streets","permanent"])delete a[e];if(i.map){let e=i.map.getZoom()||void 0,r=i.map.getCenter();a=y(g({},a),{mapZoom:e,mapCenterLat:r.lat,mapCenterLng:r.lng})}return a}),M(this,t6,(e,i,r)=>{switch(S(this,t0)){case 0:r.streets&&(e.streets=r.streets);break;case 1:r.permanent&&(e.permanent=r.permanent)}e.path=i_(S(this,t0),i.queryString),e.lastAction=i.lastInput}),M(this,t8,(e,i,r)=>{switch(S(this,t0)){case 0:r.streets&&(e.streets=r.streets);break;case 1:r.permanent&&(e.permanent=r.permanent)}e.path=i_(S(this,t0),i.queryString);let{selectedIndex:a,suggestions:n}=i;if(n&&n.length>0){let i=im(n,S(this,t0));e.resultIndex=a,e.resultPlaceName=i.suggestionNames[a],e.resultId=i.suggestionIds[a],e.resultId.startsWith("dXJuOm1ie")&&(e.resultMapboxId=e.resultId),e.suggestionIds=i.suggestionIds,e.suggestionNames=i.suggestionNames,e.suggestionTypes=i.suggestionTypes,e.suggestionSources=i.suggestionSources}}),M(this,t9,()=>`mapbox.${"@mapbox/search-js-web".split("/")[1]}.${eo}.${navigator.userAgent}`),M(this,t7,e=>["search.keystroke","search.select"].includes(e)?"2.2":"2.0"),M(this,ie,e=>{if(!e||!e.event)return!1;let i=e.event;return"search.start"===i?S(this,it).call(this,e,["event","created","sessionIdentifier","queryString"]):"search.keystroke"===i?S(this,it).call(this,e,["event","created","sessionIdentifier","queryString","lastAction"]):"search.select"!==i||S(this,it).call(this,e,["event","created","sessionIdentifier","queryString","resultIndex","path","suggestionIds"])}),M(this,it,(e,i)=>i.every(i=>"queryString"===i?"string"==typeof e[i]&&e[i].length>0:void 0!==e[i])),M(this,ii,()=>{S(this,tH).length>0&&S(this,tq)&&(S(this,t1).call(this,S(this,tH)),E(this,tH,[])),S(this,tQ)&&clearTimeout(S(this,tQ)),S(this,tJ)&&E(this,tQ,setTimeout(S(this,ii),S(this,tJ)))}),M(this,ir,(e,i)=>{S(this,tH).push(e),(S(this,tH).length>=S(this,tK)||i)&&S(this,ii).call(this)}),this.remove=()=>{S(this,ii).call(this)},E(this,t0,e),E(this,tW,S(this,t9).call(this)),E(this,tQ,setTimeout(S(this,ii),S(this,tJ)))}};tj=new WeakMap,tG=new WeakMap,tq=new WeakMap,tW=new WeakMap,t$=new WeakMap,tH=new WeakMap,tZ=new WeakMap,tX=new WeakMap,tY=new WeakMap,tJ=new WeakMap,tK=new WeakMap,tQ=new WeakMap,t0=new WeakMap,t1=new WeakMap,t2=new WeakMap,t3=new WeakMap,t4=new WeakMap,t5=new WeakMap,t6=new WeakMap,t8=new WeakMap,t9=new WeakMap,t7=new WeakMap,ie=new WeakMap,it=new WeakMap,ii=new WeakMap,ir=new WeakMap;var iy,ix,iv,ib,iw,iT,iS,iM,iE,iA,iI,iC,iP,iL,ik,iR,iz,iD,iO=class extends en{constructor(){super(...arguments),M(this,iy,new tk.AddressAutofillCore),M(this,ix,new tk.SearchSession(S(this,iy))),M(this,iv,void 0),M(this,ib,new e$),M(this,iw,new ig(0)),M(this,iT,void 0),this.options={},this.confirmOnBrowserAutofill=!1,M(this,iS,!1),M(this,iM,e=>{let i=(null==e?void 0:e.suggestions)?e4(e.suggestions):null;S(this,ib).handleSuggest(i),this.dispatchEvent(new e_("suggest",e))}),M(this,iE,e=>{S(this,ib).handleError(),this.dispatchEvent(new e_("suggesterror",e))}),M(this,iA,e=>{var i;this.dispatchEvent(new e_("retrieve",e)),this.retrieveFeature=null==(i=e.features)?void 0:i[0],S(this,iv)&&e&&e.features&&e.features.length&&e3(e.features[0],S(this,iv))}),M(this,iI,()=>{var e;try{let i=null!=(e=this.querySelector("input"))?e:null;E(this,iv,i),S(this,ib).input=i}catch(e){E(this,iv,null),S(this,ib).input=null,console.error(e.message||e)}}),M(this,iC,new MutationObserver(S(this,iI))),M(this,iP,e=>{S(this,ib).blur(),td(S(this,iv),e,this.confirmOnBrowserAutofill,this.accessToken)}),this.retrieveFeature=null,this.interceptSearch=null,M(this,iL,e=>{this.dispatchEvent(new e_("input",e.detail.inputText));let{lastInput:i,inputText:r}=e.detail,a=!0===this.browserAutofillEnabled&&(null==r?void 0:r.length)<=2;if(e5(S(this,iv),S(this,iT),a),!r){S(this,iD).call(this);return}let n=this.interceptSearch&&this.interceptSearch(r),s=this.interceptSearch?n:r;if(this.interceptSearch&&!n||(null==s?void 0:s.length)<=2){S(this,ib).handleSuggest(null);return}S(this,ix).suggest(s,this.options),S(this,iw).input(s,i,y(g({},this.options),{sessionToken:S(this,ix).sessionToken,accessToken:this.accessToken}),null,S(this,iy).responseHeaders)}),M(this,ik,e=>{let{suggestion:i,selectedIndex:r}=e.detail;"street"!==i.accuracy?(e5(S(this,iv),S(this,iT),!0),S(this,ix).retrieve(i,this.options),S(this,iw).select(this.input.value,r,S(this,ib).suggestions,y(g({},this.options),{sessionToken:S(this,ix).sessionToken,accessToken:this.accessToken}),null,S(this,iy).responseHeaders)):e6(S(this,iv),S(this,iT),i)}),M(this,iR,()=>{e5(S(this,iv),S(this,iT),!0),S(this,ix).abort()}),M(this,iz,()=>{var e;let i=!0===this.browserAutofillEnabled&&(null==(e=S(this,iv).value)?void 0:e.length)<=2;e5(S(this,iv),S(this,iT),i)}),M(this,iD,()=>{S(this,ib).handleSuggest(null),S(this,iw).clear()})}get accessToken(){return S(this,iy).accessToken}set accessToken(e){S(this,iy).accessToken=e}get input(){return S(this,iv)}get theme(){return S(this,ib).theme}set theme(e){S(this,ib).theme=e}get popoverOptions(){return S(this,ib).popoverOptions}set popoverOptions(e){S(this,ib).popoverOptions=e}get browserAutofillEnabled(){return S(this,iS)}set browserAutofillEnabled(e){E(this,iS,e)}connectedCallback(){var e;super.connectedCallback(),ti.autofillSessionEnabled=!0,S(this,ix).sessionToken=ti.autofillSessionToken.id,S(this,ib).autofillHost=this,S(this,ib).searchService=0;let i=null!=(e=this.querySelector("input"))?e:null;S(this,iC).observe(this,{subtree:!0,childList:!0}),S(this,iI).call(this),S(this,ib).addEventListener("input",S(this,iL)),S(this,ib).addEventListener("select",S(this,ik)),S(this,ib).addEventListener("blur",S(this,iR)),S(this,ib).addEventListener("focus",S(this,iz)),S(this,ix).addEventListener("suggest",S(this,iM)),S(this,ix).addEventListener("suggesterror",S(this,iE)),S(this,ix).addEventListener("retrieve",S(this,iA)),document.body.appendChild(S(this,ib)),i&&(i.insertAdjacentElement("beforebegin",eb(S(this,ib).dataSeed)),eT(i),E(this,iT,i.autocomplete)),tU(),window.addEventListener("browserautofill",S(this,iP))}disconnectedCallback(){S(this,ib).remove(),S(this,ib).removeEventListener("input",S(this,iL)),S(this,ib).removeEventListener("select",S(this,ik)),S(this,ib).removeEventListener("blur",S(this,iR)),S(this,ib).removeEventListener("focus",S(this,iz)),S(this,ix).removeEventListener("suggest",S(this,iM)),S(this,ix).removeEventListener("suggesterror",S(this,iE)),S(this,ix).removeEventListener("retrieve",S(this,iA)),S(this,iw).remove(),S(this,iC).disconnect(),window.removeEventListener("browserautofill",S(this,iP))}attributeChangedCallback(e,i,r){if("access-token"===e){S(this,iy).accessToken=r;return}if("browser-autofill-enabled"===e){E(this,iS,!!r);return}if("theme"===e){this.theme=Q(r);return}if("popover-options"===e){this.popoverOptions=Q(r);return}let a=e.split("-").join("_");r||delete this.options[a],this.options[a]=r}focus(){S(this,ib).focus()}simulateRetrieve(e){let i=this.input;i&&(i.dataset.mapboxSuccess="true"),S(this,ib).hideResults(),S(this,iA).call(this,{type:"FeatureCollection",features:[e],url:""})}};iy=new WeakMap,ix=new WeakMap,iv=new WeakMap,ib=new WeakMap,iw=new WeakMap,iT=new WeakMap,iS=new WeakMap,iM=new WeakMap,iE=new WeakMap,iA=new WeakMap,iI=new WeakMap,iC=new WeakMap,iP=ne
169w WeakMap,iL=new WeakMap,ik=new WeakMap,iR=new WeakMap,iz=new WeakMap,iD=new WeakMap,iO.observedAttributes=["access-token","browser-autofill-enabled","theme","popover-options","css-text","language","country","bbox","limit","proximity","streets"],window.MapboxAddressAutofill=iO,window.customElements.get("mapbox-address-autofill")||customElements.define("mapbox-address-autofill",iO);var iB,iF,iN,iV,iU,ij,iG,iq,iW,i$,iH,iZ,iX,iY,iJ,iK,iQ,i0,i1,i2,i3,i4,i5=r(596),i6=b(r(447)),i8={placeholder:{de:"Suche",it:"Ricerca",en:"Search",nl:"Zoeken",fr:"Chercher",ca:"Cerca",he:"××פש",ja:"ãµã¼ã",lv:"MeklÄt",pt:"Procurar",sr:"ÐÑеÑÑага",zh:"æç´¢",cs:"VyhledávánÃ",hu:"Keresés",ka:"á«áááá",nb:"Søke",sk:"Vyhľadávanie",th:"à¸à¹à¸à¸«à¸²",fi:"Hae",is:"Leita",ko:"ìì",pl:"Szukaj",sl:"Iskanje",fa:"جستجÙ",ru:"ÐоиÑк"}},i9=class extends en{constructor(){super(...arguments),M(this,iq),M(this,iB,void 0),M(this,iF,new i5.SearchBoxCore({})),M(this,iN,new i5.SearchSession(S(this,iF))),M(this,iV,null),M(this,iU,void 0),M(this,ij,new e$),M(this,iG,new ig(2)),this.options={},M(this,i$,void 0),M(this,iH,e=>{S(this,i2).call(this),S(this,ij).handleSuggest((null==e?void 0:e.suggestions)||null),this.dispatchEvent(new e_("suggest",e))}),M(this,iZ,e=>{S(this,i2).call(this),S(this,ij).handleError(),this.dispatchEvent(new e_("suggesterror",e))}),M(this,iX,e=>{if(S(this,i2).call(this),this.dispatchEvent(new e_("retrieve",e)),!e||!e.features.length)return;let i=(0,i5.featureToSuggestion)(e.features[0]);S(this,iU).value=i.name;let r=S(this,iV);if(!r)return;let a=e.features[0];if(!a)return;let n=a.properties.feature_type,s=a.properties.bbox;if(s)r.flyTo(U(r,i5.LngLatBounds.convert(s).toFlatArray()));else{let e=a.geometry.coordinates,i=j(n);r.flyTo({center:e,zoom:i,speed:1.4})}this.marker&&this.mapboxgl&&S(this,iK).call(this,a)}),M(this,iY,void 0),M(this,iJ,()=>{S(this,iY)&&(S(this,iY).remove(),E(this,iY,null))}),M(this,iK,e=>{if(!S(this,iV)||(S(this,iJ).call(this),!e))return;let i=g(g({},{color:"#4668F2"}),"object"==typeof this.marker&&this.marker);E(this,iY,new this.mapboxgl.Marker(i)),e.geometry&&e.geometry.type&&"Point"===e.geometry.type&&e.geometry.coordinates&&S(this,iY).setLngLat(e.geometry.coordinates).addTo(S(this,iV))}),this.interceptSearch=null,M(this,iQ,e=>{this.dispatchEvent(new e_("input",e.detail.inputText));let{lastInput:i,inputText:r}=e.detail;if(!r){S(this,i3).call(this);return}let a=this.interceptSearch&&this.interceptSearch(r),n=this.interceptSearch?a:r;if(this.interceptSearch&&!a){S(this,ij).hideResults();return}S(this,iN).suggest(n,this.options),S(this,iG).input(n,i,y(g({},this.options),{sessionToken:S(this,iN).sessionToken,accessToken:this.accessToken}),S(this,iV)),S(this,i2).call(this,!0)}),M(this,i0,e=>{let{suggestion:i,selectedIndex:r}=e.detail;S(this,iN).retrieve(i,this.options),S(this,iG).select(this.value,r,S(this,ij).suggestions,y(g({},this.options),{sessionToken:S(this,iN).sessionToken,accessToken:this.accessToken}),S(this,iV)),S(this,i2).call(this,!0)}),M(this,i1,()=>{S(this,iN).abort()}),M(this,i2,(e=!1)=>{e?(S(this,iB).ClearBtn.style.display="none",S(this,iB).LoadingIcon.style.display="block"):(S(this,iB).LoadingIcon.style.display="none",S(this,iB).ClearBtn.style.display=this.value?"block":"none")}),M(this,i3,()=>{this.value="",S(this,i2).call(this),S(this,iK).call(this,null),S(this,ij).handleSuggest(null),S(this,iG).clear(),S(this,iN).incrementSession(),this.dispatchEvent(new e_("clear"))}),this.marker=!0,M(this,i4,()=>{let e=S(this,iV),i=g({},this.options);if(9>=e.getZoom()){delete i.proximity,this.options=i;return}let r=e.getCenter();this.options=y(g({},i),{proximity:r})})}get accessToken(){return S(this,iF).accessToken}set accessToken(e){S(this,iF).accessToken=e}get value(){return S(this,iU).value}set value(e){S(this,iU).value=e||""}get input(){return S(this,iU)}get template(){return Y}get templateStyle(){return em}get templateUserStyle(){return eh(".SearchBox",S(this,ij).theme)}get theme(){return S(this,ij).theme}set theme(e){if(S(this,ij).theme=e,!S(this,iB)||!e)return;this.updateTemplateUserStyle(eh(".SearchBox",e)),S(this,ij).updatePopover();let{SearchIcon:i}=S(this,iB);i.innerHTML=eu("search",e)}get popoverOptions(){return S(this,ij).popoverOptions}set popoverOptions(e){S(this,ij).popoverOptions=e}get placeholder(){return S(this,i$)||A(this,iq,iW).call(this)}set placeholder(e){E(this,i$,e),S(this,iU)&&(S(this,iU).placeholder=this.placeholder,S(this,iU).setAttribute("aria-label",this.placeholder))}connectedCallback(){super.connectedCallback(),E(this,iB,L(this,{SearchBox:".SearchBox",SearchIcon:".SearchIcon",Input:".Input",ClearBtn:".ClearBtn",LoadingIcon:".LoadingIcon"})),this.theme=g({},this.theme);let{Input:e,ClearBtn:i}=S(this,iB);E(this,iU,e),S(this,ij).input=e,S(this,ij).searchService=2,S(this,ij).addEventListener("input",S(this,iQ)),S(this,ij).addEventListener("select",S(this,i0)),S(this,ij).addEventListener("blur",S(this,i1)),S(this,iN).addEventListener("suggest",S(this,iH)),S(this,iN).addEventListener("suggesterror",S(this,iZ)),S(this,iN).addEventListener("retrieve",S(this,iX)),i.addEventListener("click",S(this,i3)),this.placeholder=S(this,i$),this.parentElement.appendChild(S(this,ij)),e&&(e.previousElementSibling.hasAttribute("aria-live")&&e.previousElementSibling.remove(),e.insertAdjacentElement("beforebegin",eb(S(this,ij).dataSeed)))}disconnectedCallback(){S(this,ij).remove(),S(this,ij).input=null,S(this,ij).removeEventListener("input",S(this,iQ)),S(this,ij).removeEventListener("select",S(this,i0)),S(this,ij).removeEventListener("blur",S(this,i1)),S(this,iN).removeEventListener("suggest",S(this,iH)),S(this,iN).removeEventListener("suggesterror",S(this,iZ)),S(this,iN).removeEventListener("retrieve",S(this,iX)),S(this,iG).remove()}attributeChangedCallback(e,i,r){if("access-token"===e){S(this,iF).accessToken=r;return}if("theme"===e){this.theme=Q(r);return}if("popover-options"===e){this.popoverOptions=Q(r);return}if("placeholder"===e){this.placeholder=r;return}let a=e.split("-").join("_");r||delete this.options[a],this.options[a]=r,"language"===a&&(this.placeholder=S(this,i$))}focus(){S(this,ij).focus()}search(e){this.value=e,S(this,iQ).call(this,new e_("input",{lastInput:e,inputText:e}))}bindMap(e){S(this,iV)&&S(this,iV).off("moveend",S(this,i4)),e&&e.on("moveend",S(this,i4)),E(this,iV,e)}unbindMap(){this.bindMap(null)}onAdd(e){this.bindMap(e),this.remove();let i=document.createElement("div");return i.className="mapboxgl-ctrl",i.style.width="300px",i.appendChild(this),i}onRemove(){this.remove(),this.unbindMap(),S(this,iJ).call(this)}getDefaultPosition(){return"top-right"}};iB=new WeakMap,iF=new WeakMap,iN=new WeakMap,iV=new WeakMap,iU=new WeakMap,ij=new WeakMap,iG=new WeakMap,iq=new WeakSet,iW=function(){if(this.options.language){let e=this.options.language.split(",")[0],i=i6.default.language(e),r=i8.placeholder[i];if(r)return r}return"Search"}
169,i$=new WeakMap,iH=new WeakMap,iZ=new WeakMap,iX=new WeakMap,iY=new WeakMap,iJ=new WeakMap,iK=new WeakMap,iQ=new WeakMap,i0=new WeakMap,i1=new WeakMap,i2=new WeakMap,i3=new WeakMap,i4=new WeakMap,i9.observedAttributes=["access-token","theme","popover-options","placeholder","language","country","bbox","limit","navigation-profile","origin","proximity","eta-type","types"],window.MapboxSearchBox=i9,window.customElements.get("mapbox-search-box")||customElements.define("mapbox-search-box",i9);var i7,re,rt,ri,rr,ra,rn,ro,rs,rl,rh,ru,rc,rd,rp,rf,rm,r_,rg,ry,rx,rv,rb=r(596),rw=b(r(447)),rT=class extends en{constructor(){super(...arguments),M(this,ro),M(this,i7,void 0),M(this,re,new rb.GeocodingCore({})),M(this,rt,new rb.SearchSession(S(this,re))),M(this,ri,null),M(this,rr,void 0),M(this,ra,new e$),M(this,rn,new ig(1)),this.options={},M(this,rl,void 0),M(this,rh,e=>{S(this,ry).call(this),S(this,ra).handleSuggest((null==e?void 0:e.features)||null),this.dispatchEvent(new e_("suggest",e))}),M(this,ru,e=>{S(this,ry).call(this),S(this,ra).handleError(),this.dispatchEvent(new e_("suggesterror",e))}),M(this,rc,e=>{if(S(this,ry).call(this),this.dispatchEvent(new e_("retrieve",e)),!e)return;S(this,rr).value=e.properties.full_address;let i=S(this,ri);if(!i)return;let r=e.properties.feature_type,a=e.properties.bbox;if(a)i.flyTo(U(i,rb.LngLatBounds.convert(a).toFlatArray()));else{let a=e.geometry.coordinates,n=j(r);i.flyTo({center:a,zoom:n,speed:1.4})}this.marker&&this.mapboxgl&&S(this,rf).call(this,e)}),M(this,rd,void 0),M(this,rp,()=>{S(this,rd)&&(S(this,rd).remove(),E(this,rd,null))}),M(this,rf,e=>{if(!S(this,ri)||(S(this,rp).call(this),!e))return;let i=g(g({},{color:"#4668F2"}),"object"==typeof this.marker&&this.marker);E(this,rd,new this.mapboxgl.Marker(i)),e.geometry&&e.geometry.type&&"Point"===e.geometry.type&&e.geometry.coordinates&&S(this,rd).setLngLat(e.geometry.coordinates).addTo(S(this,ri))}),this.interceptSearch=null,M(this,rm,e=>{this.dispatchEvent(new e_("input",e.detail.inputText));let{lastInput:i,inputText:r}=e.detail;if(!r){S(this,rx).call(this);return}let a=this.interceptSearch&&this.interceptSearch(r),n=this.interceptSearch?a:r;if(this.interceptSearch&&!a){S(this,ra).hideResults();return}S(this,rt).suggest(n,this.options),S(this,rn).input(n,i,y(g({},this.options),{sessionToken:S(this,rt).sessionToken,accessToken:this.accessToken}),S(this,ri),S(this,re).responseHeaders),S(this,ry).call(this,!0)}),M(this,r_,e=>{let{suggestion:i,selectedIndex:r}=e.detail;S(this,rt).retrieve(i,this.options),S(this,rn).select(this.value,r,S(this,ra).suggestions,y(g({},this.options),{sessionToken:S(this,rt).sessionToken,accessToken:this.accessToken}),S(this,ri),S(this,re).responseHeaders),S(this,ry).call(this,!0)}),M(this,rg,()=>{S(this,rt).abort()}),M(this,ry,(e=!1)=>{e?(S(this,i7).ClearBtn.style.display="none",S(this,i7).LoadingIcon.style.display="block"):(S(this,i7).LoadingIcon.style.display="none",S(this,i7).ClearBtn.style.display=this.value?"block":"none")}),M(this,rx,()=>{this.value="",S(this,ry).call(this),S(this,rf).call(this,null),S(this,ra).handleSuggest(null),S(this,rn).clear(),S(this,rt).incrementSession(),this.dispatchEvent(new e_("clear"))}),this.marker=!0,M(this,rv,()=>{let e=S(this,ri),i=g({},this.options);if(9>=e.getZoom()){delete i.proximity,this.options=i;return}let r=e.getCenter();this.options=y(g({},i),{proximity:r})})}get accessToken(){return S(this,re).accessToken}set accessToken(e){S(this,re).accessToken=e}get value(){return S(this,rr).value}set value(e){S(this,rr).value=e||""}get input(){return S(this,rr)}get template(){return J}get templateStyle(){return em}get templateUserStyle(){return eh(".Geocoder",S(this,ra).theme)}get theme(){return S(this,ra).theme}set theme(e){if(S(this,ra).theme=e,!S(this,i7)||!e)return;this.updateTemplateUserStyle(eh(".Geocoder",e)),S(this,ra).updatePopover();let{SearchIcon:i}=S(this,i7);i.innerHTML=eu("search",e)}get popoverOptions(){return S(this,ra).popoverOptions}set popoverOptions(e){S(this,ra).popoverOptions=e}get placeholder(){return S(this,rl)||A(this,ro,rs).call(this)}set placeholder(e){E(this,rl,e),S(this,rr)&&(S(this,rr).placeholder=this.placeholder,S(this,rr).setAttribute("aria-label",this.placeholder))}connectedCallback(){super.connectedCallback(),E(this,i7,L(this,{Geocoder:".Geocoder",SearchIcon:".SearchIcon",Input:".Input",ClearBtn:".ClearBtn",LoadingIcon:".LoadingIcon"})),this.theme=g({},this.theme);let{Input:e,ClearBtn:i}=S(this,i7);E(this,rr,e),S(this,ra).input=e,S(this,ra).searchService=1,S(this,ra).addEventListener("input",S(this,rm)),S(this,ra).addEventListener("select",S(this,r_)),S(this,ra).addEventListener("blur",S(this,rg)),S(this,rt).addEventListener("suggest",S(this,rh)),S(this,rt).addEventListener("suggesterror",S(this,ru)),S(this,rt).addEventListener("retrieve",S(this,rc)
169),i.addEventListener("click",S(this,rx)),this.placeholder=S(this,rl),this.parentElement.appendChild(S(this,ra)),e&&(e.previousElementSibling.hasAttribute("aria-live")&&e.previousElementSibling.remove(),e.insertAdjacentElement("beforebegin",eb(S(this,ra).dataSeed)))}disconnectedCallback(){S(this,ra).remove(),S(this,ra).input=null,S(this,ra).removeEventListener("input",S(this,rm)),S(this,ra).removeEventListener("select",S(this,r_)),S(this,ra).removeEventListener("blur",S(this,rg)),S(this,rt).removeEventListener("suggest",S(this,rh)),S(this,rt).removeEventListener("suggesterror",S(this,ru)),S(this,rt).removeEventListener("retrieve",S(this,rc)),S(this,rn).remove()}attributeChangedCallback(e,i,r){if("access-token"===e){S(this,re).accessToken=r;return}if("theme"===e){this.theme=Q(r);return}if("popover-options"===e){this.popoverOptions=Q(r);return}if("placeholder"===e){this.placeholder=r;return}let a=e.split("-").join("_");r||delete this.options[a],this.options[a]=r,"language"===a&&(this.placeholder=S(this,rl))}focus(){S(this,ra).focus()}search(e){this.value=e,S(this,rm).call(this,new e_("input",{lastInput:e,inputText:e}))}bindMap(e){S(this,ri)&&S(this,ri).off("moveend",S(this,rv)),e&&e.on("moveend",S(this,rv)),E(this,ri,e)}unbindMap(){this.bindMap(null)}onAdd(e){this.bindMap(e),this.remove();let i=document.createElement("div");return i.className="mapboxgl-ctrl",i.style.width="300px",i.appendChild(this),i}onRemove(){this.remove(),this.unbindMap(),S(this,rp).call(this)}getDefaultPosition(){return"top-right"}};i7=new WeakMap,re=new WeakMap,rt=new WeakMap,ri=new WeakMap,rr=new WeakMap,ra=new WeakMap,rn=new WeakMap,ro=new WeakSet,rs=function(){if(this.options.language){let e=this.options.language.split(",")[0],i=rw.default.language(e),r=i8.placeholder[i];if(r)return r}return"Search"},rl=new WeakMap,rh=new WeakMap,ru=new WeakMap,rc=new WeakMap,rd=new WeakMap,rp=new WeakMap,rf=new WeakMap,rm=new WeakMap,r_=new WeakMap,rg=new WeakMap,ry=new WeakMap,rx=new WeakMap,rv=new WeakMap,rT.observedAttributes=["access-token","theme","popover-options","placeholder","autocomplete","language","country","bbox","limit","proximity","types","worldview","permanent"],window.MapboxGeocoder=rT,window.customElements.get("mapbox-geocoder")||customElements.define("mapbox-geocoder",rT);var rS=r(596),rM=new(b(r(669))).default({size:512,antimeridian:!0});function rE(e,i){let{width:r,height:a}=z(e,!0);switch(i){case"center":return[0,0];case"top":return[0,a/2];case"bottom":return[0,-1*a/2];case"left":return[r/2,0];case"right":return[-1*r/2,0];case"top-left":return[r/2,a/2];case"top-right":return[-1*r/2,a/2];case"bottom-left":return[r/2,-1*a/2];case"bottom-right":return[-1*r/2,-1*a/2]}}var rA,rI,rC,rP,rL,rk,rR,rz,rD,rO,rB,rF,rN,rV,rU=class{constructor(e,i,r,a,n,s){M(this,rA,void 0),M(this,rI,()=>{[this.anchorOffsetX,this.anchorOffsetY]=rE(this.markerElement,this.anchor),this.markerTransform={anchorX:this.anchorOffsetX,anchorY:this.anchorOffsetY}}),M(this,rC,{anchorX:0,anchorY:0,globalX:0,globalY:0,correctionX:0,correctionY:0}),M(this,rP,!1),M(this,rL,void 0),M(this,rk,e=>{this.isActive&&(e.preventDefault(),e.stopPropagation(),S(this,rF).call(this,e),window.addEventListener("pointermove",S(this,rz)),window.addEventListener("pointerup",S(this,rR)))}),M(this,rR,()=>{window.removeEventListener("pointermove",S(this,rz)),window.removeEventListener("pointerup",S(this,rR))}),M(this,rz,e=>{e.preventDefault(),e.stopPropagation();let i=this.curPointerXPos-e.pageX,r=this.curPointerYPos-e.pageY;this.markerDeltaX+=i,this.markerDeltaY-=r,this.markerDeltaX=Math.max(Math.min(this.imgElement.width/2,this.markerDeltaX),-(this.imgElement.width/2*1)),this.markerDeltaY=Math.max(Math.min(this.imgElement.height/2,this.markerDeltaY),-(this.imgElement.height/2*1));let a=this.imgCenterPx[0]-this.imgCenterAdjustedPx[0],n=this.imgCenterPx[1]-this.imgCenterAdjustedPx[1],s=this.markerDeltaX-a,l=this.markerDeltaY+n;this.markerTransform={globalX:s,globalY:l},S(this,rF).call(this,e)}),M(this,rD,e=>{this.isActive&&(e.preventDefault(),e.stopPropagation(),S(this,rF).call(this,e),window.addEventListener("pointermove",S(this,rB)),window.addEventListener("pointerup",S(this,rO)))}),M(this,rO,()=>{window.removeEventListener("pointermove",S(this,rB)),window.removeEventListener("pointerup",S(this,rO))}),M(this,rB,e=>{e.preventDefault();let i=Math.round(this.imgContainerElement.scrollTop+(this.curPointerYPos-e.pageY));i=Math.max(Math.min(this.imgElement.height-this.imgContainerElement.clientHeight,i),0);let r=Math.round(this.imgContainerElement.scrollLeft+(this.curPointerXPos-e.pageX));r=Math.max(Math.min(this.imgElement.width-this.imgContainerElement.clientWidth,r),0),this.imgContainerElement.scrollTop=i,this.imgContainerElement.scrollLeft=r;let a=Math.round(r-(this.imgElement.width-this.imgContainerElement.clientWidth)/2),n=Math.round((this.imgElement.height-this.imgContainerElement.clientHeight)/2-i);if(this.imgCenterAdjustedPx=[this.imgCenterPx[0]+a,this.imgCenterPx[1]-n],!this.keepMarkerCentered){let e=this.markerDeltaX+a,i=this.markerDeltaY+n;this.markerTransform={globalX:e,globalY:i}}S(this,rV).call(this,r,i),S(this,rF).call(this,e)}),M(this,rF,e=>{this.curPointerXPos=e.pageX,this.curPointerYPos=e.pageY}),M(this,rN,()=>{let{anchorX:e,anchorY:i,globalX:r,globalY:a,correctionX:n,correctionY:s}=S(this,rC);this.markerElement.style.transform=`translate(calc(-50% + ${e-r+n}px), calc(-50% + ${i+a+s}px))`}),this.reCenter=()=>{let e=(this.imgElement.height-this.imgContainerElement.clientHeight)/2,i=(this.imgElement.width-this.imgContainerElement.clientWidth)/2;this.imgContainerElement.scrollTop=e,this.imgContainerElement.scrollLeft=i,this.imgCenterAdjustedPx=this.imgCenterPx,this.markerDeltaX=this.markerDeltaY=0,this.markerTransform={globalX:0,globalY:0,correctionX:0,correctionY:0}},this.handleMinimapResize=()=>{if(!this.imgElement.height||!this.imgElement.width)return;let e=this.imgCenterOffset.x,i=this.imgCenterOffset.y,r=this.imgElement.width/2-e-this.imgContainerElement.clientWidth/2,a=this.imgElement.height/2-i-this.imgContainerElement.clientHeight/2;this.imgContainerElement.scrollLeft=r,this.imgContainerElement.scrollTop=a,S(this,rV).call(this,r,a)},M(this,rV,(e,i)=>{let r=this.imgCenterOffset.x,a=this.imgCenterOffset.y,{correctionX:n,correctionY:s}=this.markerTransform,l={};if(e/2<-1*r){let i=-1*r-e/2;l.correctionX=2*i}else e<0?l.correctionX=e:0!==n&&(l.correctionX=0);if(i/2<-1*a){let e=-1*a-i/2;l.correctionY=2*e}else i<0?l.correctionY=i:0!==s&&(l.correctionY=0);this.markerTransform=l}
169),this.markerElement=r,this.imgContainerElement=e,this.imgElement=i,this.keepMarkerCentered=a,this.zoom=n,this.anchor=s,this.curPointerXPos=0,this.curPointerYPos=0,this.markerDeltaX=0,this.markerDeltaY=0,this.imgContainerElement.addEventListener("pointerdown",S(this,rD)),this.keepMarkerCentered||this.markerElement.addEventListener("pointerdown",S(this,rk)),new ResizeObserver(S(this,rI)).observe(this.markerElement)}get anchor(){return S(this,rA)}set anchor(e){E(this,rA,e),[this.anchorOffsetX,this.anchorOffsetY]=rE(this.markerElement,e),this.markerTransform={anchorX:this.anchorOffsetX,anchorY:this.anchorOffsetY}}get markerTransform(){return S(this,rC)}set markerTransform(e){E(this,rC,g(g({},S(this,rC)),e)),S(this,rN).call(this)}get isActive(){return S(this,rP)}set isActive(e){this.imgContainerElement.style.touchAction=e?"none":"",E(this,rP,e)}get coordinate(){let e=this.keepMarkerCentered?this.imgCenterAdjustedPx:[this.imgCenterPx[0]-this.markerDeltaX,this.imgCenterPx[1]+this.markerDeltaY];if(ee(e,this.imgCenterPx))return S(this,rL);{let i=rM.ll(e,this.zoom);return[et(i[0],6),et(i[1],6)]}}set coordinate(e){E(this,rL,e),this.imgCenterPx=this.imgCenterAdjustedPx=rM.px(e,this.zoom)}get imgCenterOffset(){return{x:this.imgCenterPx[0]-this.imgCenterAdjustedPx[0],y:this.imgCenterPx[1]-this.imgCenterAdjustedPx[1]}}};rA=new WeakMap,rI=new WeakMap,rC=new WeakMap,rP=new WeakMap,rL=new WeakMap,rk=new WeakMap,rR=new WeakMap,rz=new WeakMap,rD=new WeakMap,rO=new WeakMap,rB=new WeakMap,rF=new WeakMap,rN=new WeakMap,rV=new WeakMap;var rj,rG,rq,rW,r$,rH,rZ,rX,rY,rJ,rK,rQ,r0,r1,r2,r3,r4,r5,r6,r8,r9,r7,ae,at,ai,ar,aa,an,ao,as,al,ah,au,ac,ad=k(` 170<template> 171 <div class="MapboxAddressMinimap" aria-hidden="true"> 172 <div class="MinimapImageContainer"> 173 <img class="MinimapImage" draggable="false"></img> 174 <div class="MinimapInnerFrame"> 175 <div class="MinimapMarker"></div> 176 <div class="MinimapAttribution"> 177 <div class="MinimapAttributionLogo"> 178 <a target="_blank" rel="noopener nofollow" href="https://www.mapbox.com/" aria-label="Mapbox logo"> 179 <svg width="88" height="23" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill-rule="evenodd"><defs><path id="g" d="M11.5 2.25a9.25 9.25 0 1 1 0 18.5 9.25 9.25 0 0 1 0-18.5zM7 15.98c-.05-.33-.83-5.8 2.23-8.87a4.4 4.4 0 0 1 3.13-1.28c1.27 0 2.49.51 3.39 1.42.91.9 1.42 2.12 1.42 3.39a4.4 4.4 0 0 1-1.28 3.13C12.72 16.93 7 16 7 16v-.02zm8.3-5.48-2 .8-.8 2-.8-2-2-.8 2-.8.8-2 .8 2 2 .8z"/><path id="b" d="M50.63 8c.13 0 .23.1.23.23V9c.7-.76 1.7-1.18 2.73-1.18 2.17 0 3.95 1.85 3.95 4.17s-1.77 4.19-3.94 4.19A3.77 3.77 0 0 1 50.86 15v3.77c0 .13-.1.23-.23.23h-1.4a.23.23 0 0 1-.23-.23V8.23c0-.12.1-.23.23-.23h1.4zm-3.86.01.01-.01c.13 0 .22.1.22.22v7.55c0 .12-.1.23-.23.23h-1.4a.23.23 0 0 1-.23-.23V15a3.7 3.7 0 0 1-2.73 1.19c-2.17 0-3.94-1.87-3.94-4.19 0-2.32 1.77-4.19 3.94-4.19 1.03 0 2.02.43 2.73 1.18v-.75c0-.12.1-.23.23-.23h1.4zm26.38-.19a4.24 4.24 0 0 0-4.16 3.29 4.07 4.07 0 0 0 0 1.77 4.23 4.23 0 0 0 4.17 3.3 4.22 4.22 0 0 0 4.26-4.19 4.2 4.2 0 0 0-4.27-4.17zM60.63 5c.13 0 .23.1.23.23v3.76c.7-.76 1.7-1.18 2.73-1.18a4 4 0 0 1 3.84 3.28c.13.59.13 1.2 0 1.8a4 4 0 0 1-3.84 3.29A3.77 3.77 0 0 1 60.86 15v.77c0 .12-.1.23-.23.23h-1.4a.23.23 0 0 1-.23-.23V5.23c0-.12.1-.23.23-.23h1.4zm-34 11h-1.4a.23.23 0 0 1-.23-.23V8.22c.01-.13.1-.22.23-.22h1.4c.13 0 .22.11.23.22v.68c.5-.68 1.3-1.09 2.16-1.1h.03c1.09 0 2.09.6 2.6 1.55a2.73 2.73 0 0 1 2.44-1.56c1.62 0 2.93 1.25 2.9 2.78l.03 5.2c0 .13-.1.23-.23.23h-1.41a.23.23 0 0 1-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.8 0-1.46.7-1.59 1.62l.01 4.68c0 .13-.11.23-.23.23h-1.41a.23.23 0 0 1-.23-.23v-4.59c0-.98-.74-1.71-1.62-1.71-.85 0-1.54.79-1.6 1.8v4.5c0 .13-.1.23-.23.23zm53.62 0h-1.61a.27.27 0 0 1-.12-.03c-.1-.06-.13-.19-.06-.28l2.43-3.71-2.4-3.65a.21.21 0 0 1-.02-.12.2.2 0 0 1 .2-.21h1.61c.13 0 .24.06.3.17L82 10.54l1.4-2.37a.34.34 0 0 1 .3-.17h1.6l.12.03c.1.06.13.19.06.28l-2.37 3.65 2.43 3.7.01.13a.2.2 0 0 1-.2.21h-1.61a.33.33 0 0 1-.3-.17l-1.44-2.42-1.44 2.42a.34.34 0 0 1-.3.17zm-7.12-1.49A2.47 2.47 0 0 1 70.7 12a2.47 2.47 0 0 1 2.42-2.52 2.47 2.47 0 0 1 2.42 2.51 2.48 2.48 0 0 1-2.42 2.52zm-19.87 0a2.48 2.48 0 0 1-2.42-2.48v-.07a2.47 2.47 0 0 1 2.4-2.49 2.47 2.47 0 0 1 2.41 2.51 2.47 2.47 0 0 1-2.39 2.53zm-8.11-2.48c-.01 1.37-1.09 2.47-2.41 2.47s-2.42-1.12-2.42-2.51a2.47 2.47 0 0 1 2.4-2.52 2.46 2.46 0 0 1 2.41 2.48l.02.08zm18.12 2.47a2.47 2.47 0 0 1-2.41-2.48v-.06c.02-1.38 1.09-2.48 2.41-2.48s2.42 1.12 2.42 2.51a2.47 2.47 0 0 1-2.42 2.51z"/></defs><mask id="c"><rect width="100%" height="100%" fill="#fff"/><use xlink:href="#g"/><use xlink:href="#b"/></mask><g opacity=".3" stroke="#000" stroke-width="3"><circle mask="url(#c)" cx="11.5" cy="11.5" r="9.25"/><use xlink:href="#b" mask="url(#c)"/></g><g opacity=".9" fill="#fff"><use xlink:href="#g"/><use xlink:href="#b"/></g></svg> 180 </a> 181 </div> 182 <div class="MinimapAttributionText"> 183 <a target="_blank" href='https://www.mapbox.com/about/maps/'>\xa9 Mapbox</a><a target="_blank" href='http://www.openstreetmap.org/copyright'>\xa9 OpenStreetMap</a> 184 </div> 185 </div> 186 </div> 187 </div> 188 </div> 189</template> 190`),ap=k(` 191<template> 192 <button type="button" class="MinimapStyleToggle"></button> 193</template> 194`),af=k(` 195<template> 196 <div class="MinimapFooter">Adjust the marker on the map if it doesn't precisely match your location. This helps improve address data quality.</div> 197</template> 198`),am="Adjust pin",a_="Save",ag="Cancel",ay=k(` 199<template> 200 <div class="MinimapEditButtons"> 201 <div class="Button ButtonPrimary MinimapButtonAdjust">${am}</div> 202 <div class="Button ButtonPrimary MinimapButtonSave" aria-hidden="true">${a_}</div> 203 <div class="Button MinimapButtonCancel" aria-hidden="true">${ag}</div> 204 </div> 205</template> 206`),ax=class extends en{constructor(){super(...arguments),M(this,rj,!1),this.keepMarkerCentered=!1,this.markerAnchor="bottom",M(this,rG,!1),M(this,rq,!1),M(this,rW,void 0),M(this,r$,""),M(this,rH,void 0),M(this,rZ,void 0),M(this,rX,void 0),M(this,rY,void 0),M(this,rJ,void 0),M(this,rK,{}),M(this,rQ,!1),M(this,r0,"default"),M(this,r1,void 0),M(this,r2,void 0),M(this,r3,void 0),M(this,r4,["mapbox","streets-v11"]),M(this,r5,void 0),M(this,r6,void 0),M(this,r8,()=>{let{ImageContainer:e,ButtonAdjust:i,ButtonSave:r,ButtonCancel:a}=S(this,rX);S(this,rG)?(e.classList.add(`${this.dataset.seed}--draggable`),S(this,rY).isActive=!0,i.setAttribute("aria-hidden","true"),r.removeAttribute("aria-hidden"),a.removeAttribute("aria-hidden")):(e.classList.remove(`${this.dataset.seed}--draggable`),S(this,rY).isActive=!1,i.removeAttribute("aria-hidden"),r.setAttribute("aria-hidden","true"),a.setAttribute("aria-hidden","true"))}),M(this,r9,()=>{E(this,rG,!0),S(this,r8).call(this)}),M(this,r7,()=>{if(this.feature.properties.full_address&&!ee(this.feature.geometry.coordinates,S(this,rY).coordinate)){let[e,i]=S(this,rY).coordinate;tp(this.accessToken,{originalCoordinate:this.feature.geometry.coordinates,originalAddress:this.feature.properties.full_address,changes:{location:{longitude:e,latitude:i}}})}this.onSaveMarkerLocation&&this.onSaveMarkerLocation(S(this,rY).coordinate),E(this,rG,!1),S(this,r8).call(this)}),M(this,ae,()=>{S(this,rY).reCenter(),E(this,rG,!1),S(this,r8).call(this)}),M(this,at,()=>{this.mapStyleMode="default"===this.mapStyleMode?"satellite":"default"}),M(this,ai,()=>{S(this,rq)||S(this,rY).reCenter(),E(this,rq,!0),S(this,rY)&&S(this,rY).handleMinimapResize()}),M(this,ar,()=>{E(this,rq,!1)}),M(this,aa,e=>{if(0===S(this,rH)||0===S(this,rZ))return"";let[i,r]=this.defaultMapStyle,a=G(i,r),n="default"===this.mapStyleMode?a:$,s="20d01"+ti.autofillSessionToken.toString(),l=n+rS.LngLat.convert(e).toArray().join(",")+",16,0/"+Math.min(2*S(this,rH),1280)+"x"+Math.min(2*S(this,rZ),1280)+"?access_token="+this.accessToken+"&attribution=false&logo=false";return ti.autofillSessionEnabled&&(l+=`&sku=${s}`),l}),M(this,an,()=>{if(S(this,rW)){let e=S(this,rW).geometry.coordinates;E(this,r$,S(this,aa).call(this,e));let{Image:i}=S(this,rX);i.src=S(this,r$)}}),M(this,ao,e=>`url("${function(e,i={}){return g(g({},el.images),i.images||{})[e]}("default"===e?"styleToggleDefault":"styleToggleSatellite",this.theme)}")`),M(this,as,()=>{let{MapboxAddressMinimap:e,ImageContainer:i,Image:r}=S(this,rX),{width:a,height:n}=z(this.container),[s,l]=[S(this,rH),S(this,rZ)];E(this,rH,Math.min(a,1280)),E(this,rZ,Math.min(n,1280)),e.style.setProperty("width",`${S(this,rH)}px`),e.style.setProperty("height",`${S(this,rZ)}px`),i.style.setProperty("height",`${S(this,rZ)}px`),i.style.setProperty("width",`${S(this,rH)}px`);let[h,u]=[r.width,r.height];S(this,rH)>s&&S(this,rH)>h/2&&h<1280||S(this,rZ)>l&&S(this,rZ)>u/2&&u<1280?S(this,an).call(this):S(this,rY)&&S(this,rY).handleMinimapResize()}),M(this,al,()=>{if(this.querySelector(".MinimapFooter"))return;let e=this.prepareTemplate(af),i=this.querySelector(".MapboxAddressMinimap");if(!i||(i.appendChild(e),this.querySelector(".MinimapEditButtons")))return;let r=this.prepareTemplate(ay);this.querySelector(".MinimapInnerFrame").appendChild(r),E(this,rX,y(g({},S(this,rX)),{EditButtons:this.querySelector(".MinimapEditButtons"),ButtonAdjust:this.querySelector(".MinimapButtonAdjust"),ButtonSave:this.querySelector(".MinimapButtonSave"),ButtonCancel:this.querySelector(".MinimapButtonCancel")}));let{ButtonAdjust:a,ButtonSave:n,ButtonCancel:s}=S(this,rX);a.addEventListener("click",S(this,r9)),n.addEventListener("click",S(this,r7)),s.addEventListener("click",S(this,ae))}),M(this,ah,()=>{if(!S(this,rX))return;let{EditButtons:e,ButtonAdjust:i,ButtonSave:r,ButtonCancel:a}=S(this,rX),n=this.querySelector(".MinimapFooter");null==n||n.remove(),null==e||e.remove(),i&&(i.remove(),i.removeEventListener("click",S(this,r9))),r&&(r.remove(),r.removeEventListener("click",S(this,r7))),a&&(a.remove(),a.removeEventListener("click",S(this,ae))),delete S(this,rX).EditButtons,delete S(this,rX).ButtonAdjust,delete S(this,rX).ButtonSave,delete S(this,rX).ButtonCancel}),M(this,au,()=>{if(this.querySelector(".MinimapStyleToggle"))return;let e=this.prepareTemplate(ap),i=this.querySelector(".MinimapInnerFrame");
206i&&(i.appendChild(e),S(this,rX).MapStyleToggle=e,e.addEventListener("click",S(this,at)),e.style.backgroundImage=S(this,ao).call(this,"default"===this.mapStyleMode?"satellite":"default"),e.setAttribute("title",`Switch to ${"default"===this.mapStyleMode?"Satellite":"Default"}`))}),M(this,ac,()=>{if(!S(this,rX))return;let{MapStyleToggle:e}=S(this,rX);e&&(e.remove(),e.removeEventListener("click",S(this,at)),delete S(this,rX).MapStyleToggle)})}get canAdjustMarker(){return S(this,rj)}set canAdjustMarker(e){E(this,rj,e),e?S(this,al).call(this):S(this,ah).call(this)}get accessToken(){return S(this,rJ)||ti.accessToken}set accessToken(e){E(this,rJ,e)}get feature(){return S(this,rW)}set feature(e){E(this,rW,e),e?this.show():this.hide()}get template(){return ad}get templateStyle(){return em}get templateUserStyle(){return eh(".MapboxAddressMinimap",this.theme)}get satelliteToggle(){return S(this,rQ)}set satelliteToggle(e){E(this,rQ,e),e?S(this,au).call(this):S(this,ac).call(this)}get theme(){return S(this,rK)}set theme(e){if(E(this,rK,e),!S(this,rX)||!e)return;this.updateTemplateUserStyle(eh(".MapboxAddressMinimap",e));let{Marker:i,MapStyleToggle:r}=S(this,rX);i.innerHTML=eu("marker",e),r&&(r.style.backgroundImage=S(this,ao).call(this,"default"===this.mapStyleMode?"satellite":"default"))}get adjustBtnText(){return S(this,r1)||am}set adjustBtnText(e){E(this,r1,e),this.querySelector(".MinimapButtonAdjust").textContent=e||am}get saveBtnText(){return S(this,r2)||a_}set saveBtnText(e){E(this,r2,e),this.querySelector(".MinimapButtonSave").textContent=e||a_}get cancelBtnText(){return S(this,r3)||ag}set cancelBtnText(e){E(this,r3,e),this.querySelector(".MinimapButtonCancel").textContent=e||ag}get mapStyleMode(){return S(this,r0)}set mapStyleMode(e){let i=S(this,r0);if(i===e||(E(this,r0,e),!S(this,rX)))return;let{MapStyleToggle:r}=S(this,rX);r&&(r.style.backgroundImage=S(this,ao).call(this,i),r.setAttribute("title",`Switch to ${"satellite"===i?"Satellite":"Default"}`),S(this,an).call(this))}get defaultMapStyle(){return S(this,r4)}set defaultMapStyle(e){E(this,r4,e),S(this,an).call(this)}get footer(){return S(this,r5)}set footer(e){E(this,r5,e);let i=this.querySelector(".MinimapFooter");i&&("string"==typeof e?(i.textContent=e,i.removeAttribute("aria-hidden")):e?i.removeAttribute("aria-hidden"):i.setAttribute("aria-hidden","true"))}get container(){return S(this,r6)}set container(e){e&&(e.style.position="relative",E(this,r6,e))}show(){if(!S(this,rW))return;let e=S(this,rW).geometry.coordinates;S(this,rY).coordinate=e,E(this,r$,S(this,aa).call(this,e));let{MapboxAddressMinimap:i,Image:r}=S(this,rX);r.src=S(this,r$),i.removeAttribute("aria-hidden")}hide(){let{MapboxAddressMinimap:e}=S(this,rX);e.setAttribute("aria-hidden","true")}connectedCallback(){super.connectedCallback(),E(this,rX,L(this,{MapboxAddressMinimap:".MapboxAddressMinimap",ImageContainer:".MinimapImageContainer",Image:".MinimapImage",Marker:".MinimapMarker",MapStyleToggle:".MinimapStyleToggle",EditButtons:".MinimapEditButtons",ButtonAdjust:".MinimapButtonAdjust",ButtonSave:".MinimapButtonSave",ButtonCancel:".MinimapButtonCancel"})),this.mapStyleMode=S(this,r0),this.theme=g({},this.theme),this.canAdjustMarker&&S(this,al).call(this),this.satelliteToggle&&S(this,au).call(this),this.container=this.parentElement,new ResizeObserver(S(this,as)).observe(this.container),S(this,as).call(this);let{MapboxAddressMinimap:e,ImageContainer:i,Image:r,Marker:a}=S(this,rX);E(this,rY,new rU(i,r,a,this.keepMarkerCentered,16,this.markerAnchor)),S(this,rY).reCenter(),r.onload=S(this,ai),r.onerror=S(this,ar),r.src=S(this,r$),S(this,rW)?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden","true")}attributeChangedCallback(e,i,r){"access-token"===e?this.accessToken=r:"can-adjust-marker"===e?this.canAdjustMarker="true"===r:"keep-marker-centered"===e?this.keepMarkerCentered="true"===r:"marker-anchor"===e?(this.markerAnchor=r,S(this,rY)&&(S(this,rY).anchor=r)):"satellite-toggle"===e&&(this.satelliteToggle="true"===r)}};rj=new WeakMap,rG=new WeakMap,rq=new WeakMap,rW=new WeakMap,r$=new WeakMap,rH=new WeakMap,rZ=new WeakMap,rX=new WeakMap,rY=new WeakMap,rJ=new WeakMap,rK=new WeakMap,rQ=new WeakMap,r0=new WeakMap,r1=new WeakMap,r2=new WeakMap,r3=new WeakMap,r4=new WeakMap,r5=new WeakMap,r6=new WeakMap,r8=new WeakMap,r9=new WeakMap,r7=new WeakMap,ae=new WeakMap,at=new WeakMap,ai=new WeakMap,ar=new WeakMap,aa=new WeakMap,an=new WeakMap,ao=new WeakMap,as=new WeakMap,al=new WeakMap,ah=new WeakMap,au=new WeakMap,ac=new WeakMap,ax.observedAttributes=["access-token","can-adjust-marker","keep-marker-centered","marker-anchor","satellite-toggle"],window.MapboxAddressMinimap=ax,window.customElements.get("mapbox-address-minimap")||customElements.define("mapbox-address-minimap",ax);var av,ab,aw,aT,aS,aM,aE,aA,aI,aC,aP,aL,ak,aR,az=r(596),aD=class{constructor(e,i,r){M(this,av,void 0),M(this,ab,void 0),M(this,aw,void 0),M(this,aT,void 0),this.options={},this.retrieveFeature=null,this.listbox=new e$,M(this,aS,new ig(0)),M(this,aM,void 0),M(this,aE,e=>{let{lastInput:i,inputText:r}=e.detail,a=!0===S(this,ab).browserAutofillEnabled&&(null==r?void 0:r.length)<=2;if(e5(S(this,av),S(this,aM),a),!r){S(this,aP).call(this);return}if((null==r?void 0:r.length)<=2){this.listbox.handleSuggest(null);return}S(this,aw).suggest(r,this.options),S(this,aS).input(r,i,y(g({},this.options),{sessionToken:S(this,aw).sessionToken,accessToken:S(this,ab).accessToken}),null,S(this,aT).responseHeaders)}),M(this,aA,e=>{let{suggestion:i,selectedIndex:r}=e.detail;"street"!==i.accuracy?(e5(S(this,av),S(this,aM),!0),S(this,aw).retrieve(i,this.options),S(this,aS).select(this.input.value,r,this.listbox.suggestions,y(g({},this.options),{sessionToken:S(this,aw).sessionToken,accessToken:S(this,ab).accessToken}),null,S(this,aT).responseHeaders)):e6(S(this,av),S(this,aM),i)}),M(this,aI,()=>{e5(S(this,av),S(this,aM),!0),S(this,aw).abort()}),M(this,aC,()=>{var e;let i=!0===S(this,ab).browserAutofillEnabled&&(null==(e=S(this,av).value)?void 0:e.length)<=2;e5(S(this,av),S(this,aM),i)}),M(this,aP,()=>{this.listbox.handleSuggest(null),S(this,aS).clear()}),M(this,aL,e=>{let i=(null==e?void 0:e.suggestions)?e4(e.suggestions):null;this.listbox.handleSuggest(i);let r=new e_("suggest",e);Object.defineProperty(r,"target",{value:S(this,av)}),S(this,ab).fire("suggest",r)}),M(this,ak,e=>{this.listbox.handleError();let i=new e_("suggesterror",e);Object.defineProperty(i,"target",{value:S(this,av)}),S(this,ab).fire("suggesterror",i)}),M(this,aR,e=>{var i;let r=new e_("retrieve",e);Object.defineProperty(r,"target",{value:S(this,av)}),S(this,ab).fire("retrieve",r),this.retrieveFeature=null==(i=e.features)?void 0:i[0],S(this,av)&&e&&e.features&&e.features.length&&e3(e.features[0],S(this,av))}),E(this,av,i),E(this,ab,e),E(this,aw,new az.SearchSession(r)),S(this,aw).sessionToken=ti.autofillSessionToken.id,E(this,aT,r),this.listbox.input=S(this,av),this.listbox.autofillHost=this,this.listbox.searchService=0,this.listbox.addEventListener("input",S(this,aE)),this.listbox.addEventListener("select",S(this,aA)),this.listbox.addEventListener("blur",S(this,aI)),this.listbox.addEventListener("focus",S(this,aC)),S(this,aw).addEventListener("suggest",S(this,aL)),S(this,aw).addEventListener("suggesterror",S(this,ak)),S(this,aw).addEventListener("retrieve",S(this,aR)),document.body.appendChild(this.listbox),i&&(i.insertAdjacentElement("beforebegin",eb(this.listbox.dataSeed)),eT(i),E(this,aM,i.autocomplete))}get input(){return S(this,av)}remove(){this.listbox.remove(),this.listbox.removeEventListener("input",S(this,aE)),this.listbox.removeEventListener("select",S(this,aA)),this.listbox.removeEventListener("blur",S(this,aI)),this.listbox.removeEventListener("focus",S(this,aC)),S(this,aw).removeEventListener("suggest",S(this,aL)),S(this,aw).removeEventListener("suggesterror",S(this,ak)),S(this,aw).removeEventListener("retrieve",S(this,aR))}simulateRetrieve(e){let i=S(this,av);i&&(i.dataset.mapboxSuccess="true"),this.listbox.hideResults(),S(this,aR).call(this,{type:"FeatureCollection",features:[e],url:""})}};av=new WeakMap,ab=new WeakMap,aw=new WeakMap,aT=new WeakMap,aS=new WeakMap,aM=new WeakMap,aE=new WeakMap,aA=new WeakMap,aI=new WeakMap,aC=new WeakMap,aP=new WeakMap,aL=new WeakMap,ak=new WeakMap,aR=new WeakMap;var aO,aB,aF,aN,aV,aU,aj,aG,aq=class extends az.Evented{constructor({accessToken:e,options:i,theme:r,popoverOptions:a,confirmOnBrowserAutofill:n,browserAutofillEnabled:s}){super(),this.instances=[],M(this,aO,void 0),M(this,aB,new az.AddressAutofillCore),M(this,aF,void 0),M(this,aN,void 0),M(this,aV,void 0),this.confirmOnBrowserAutofill=!1,this.browserAutofillEnabled=!1,M(this,aU,()=>{ee(eJ(),S(this,aO))||this.update()}),M(this,aj,new MutationObserver(S(this,aU))),M(this,aG,e=>
206I(this,null,function*(){for(let i of(this.instances.forEach(e=>e.listbox.blur()),this.instances)){let r=i.listbox.input;yield td(r,e,this.confirmOnBrowserAutofill,this.accessToken)}})),tU(),window.addEventListener("browserautofill",S(this,aG)),ti.autofillSessionEnabled=!0,this.accessToken=e||ti.accessToken,i&&(this.options=i),r&&(this.theme=r),a&&(this.popoverOptions=a),n&&(this.confirmOnBrowserAutofill=n),s&&(this.browserAutofillEnabled=s),this.update()}get accessToken(){return S(this,aB).accessToken}set accessToken(e){S(this,aB).accessToken=e}get options(){return S(this,aF)}set options(e){E(this,aF,g(g({},S(this,aF)),e)),this.instances.forEach(i=>{i.options=g(g({},i.options),e)})}get theme(){return S(this,aN)}set theme(e){E(this,aN,e),this.instances.forEach(i=>{i.listbox.theme=e})}get popoverOptions(){return S(this,aV)}set popoverOptions(e){E(this,aV,e),this.instances.forEach(i=>{i.listbox.popoverOptions=e})}update(){this.instances.forEach(e=>{e.remove()}),E(this,aO,eJ()),this.instances=[],S(this,aO).forEach(e=>{let i=new aD(this,e,S(this,aB));i.options=this.options,i.listbox.theme=this.theme,i.listbox.popoverOptions=this.popoverOptions,this.instances.push(i)})}observe(){S(this,aj).observe(document,{subtree:!0,childList:!0}),S(this,aU).call(this)}unobserve(){S(this,aj).disconnect()}remove(){this.instances.forEach(e=>{e.remove()}),this.unobserve(),window.removeEventListener("browserautofill",S(this,aG))}};function aW(e){return new aq(e)}aO=new WeakMap,aB=new WeakMap,aF=new WeakMap,aN=new WeakMap,aV=new WeakMap,aU=new WeakMap,aj=new WeakMap,aG=new WeakMap,e.exports=w(C)},447(e){var i;i=function(){var e=/^([a-zA-Z]{2,3})(?:[_-]+([a-zA-Z]{3})(?=$|[_-]+))?(?:[_-]+([a-zA-Z]{4})(?=$|[_-]+))?(?:[_-]+([a-zA-Z]{2}|[0-9]{3})(?=$|[_-]+))?/;function i(i){return i.match(e)||[]}function r(e){return{language:(e=i(e))[1]||"",extlang:e[2]||"",script:e[3]||"",region:e[4]||""}}function a(e,i,r){Object.defineProperty(e,i,{value:r,enumerable:!0})}function n(e,n,s){function l(r){return i(r)[e]||""}a(l,"pattern",n),a(r,s,l)}return n(1,/^[a-zA-Z]{2,3}$/,"language"),n(2,/^[a-zA-Z]{3}$/,"extlang"),n(3,/^[a-zA-Z]{4}$/,"script"),n(4,/^[a-zA-Z]{2}$|^[0-9]{3}$/,"region"),a(r,"split",function(e){return i(e).filter(function(e,i){return e&&i})}),r},e.exports?e.exports=i():this.subtag=i()},557(e,i){"use strict";var r=["input","select","textarea","a[href]","button","[tabindex]:not(slot)","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])',"details>summary:first-of-type","details"],a=r.join(","),n="undefined"==typeof Element,s=n?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,l=!n&&Element.prototype.getRootNode?function(e){return e.getRootNode()}:function(e){return e.ownerDocument},h=function(e,i,r){var n=Array.prototype.slice.apply(e.querySelectorAll(a));return i&&s.call(e,a)&&n.unshift(e),n=n.filter(r)},u=function e(i,r,n){for(var l=[],h=Array.from(i);h.length;){var u=h.shift();if("SLOT"===u.tagName){var c=u.assignedElements(),d=e(c.length?c:u.children,!0,n);n.flatten?l.push.apply(l,d):l.push({scope:u,candidates:d})}else{s.call(u,a)&&n.filter(u)&&(r||!i.includes(u))&&l.push(u);var p=u.shadowRoot||"function"==typeof n.getShadowRoot&&n.getShadowRoot(u),f=!n.shadowRootFilter||n.shadowRootFilter(u);if(p&&f){var m=e(!0===p?u.children:p.children,!0,n);n.flatten?l.push.apply(l,m):l.push({scope:u,candidates:m})}else h.unshift.apply(h,u.children)}}return l},c=function(e,i){return e.tabIndex<0&&(i||/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||e.isContentEditable)&&isNaN(parseInt(e.getAttribute("tabindex"),10))?0:e.tabIndex},d=function(e,i){return e.tabIndex===i.tabIndex?e.documentOrder-i.documentOrder:e.tabIndex-i.tabIndex},p=function(e){return"INPUT"===e.tagName},f=function(e,i){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===i)return e[r]},m=function(e){if(!e.name)return!0;var i,r=e.form||l(e),a=function(e){return r.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)i=a(window.CSS.escape(e.name));else try{i=a(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var n=f(i,e.form);return!n||n===e},_=function(e){var i=e.getBoundingClientRect(),r=i.width,a=i.height;return 0===r&&0===a},g=function(e,i){var r=i.displayCheck,a=i.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var n=s.call(e,"details>summary:first-of-type")?e.parentElement:e;if(s.call(n,"details:not([open]) *"))return!0;var h=l(e).host,u=(null==h?void 0:h.ownerDocument.contains(h))||e.ownerDocument.contains(e);if(r&&"full"!==r){if("non-zero-area"===r)return _(e)}else{if("function"==typeof a){for(var c=e;e;){var d=e.parentElement,p=l(e);if(d&&!d.shadowRoot&&!0===a(d))return _(e);e=e.assignedSlot?e.assignedSlot:d||p===e.ownerDocument?d:p.host}e=c}if(u)return!e.getClientRects().length}return!1}
206,y=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var i=e.parentElement;i;){if("FIELDSET"===i.tagName&&i.disabled){for(var r=0;r<i.children.length;r++){var a=i.children.item(r);if("LEGEND"===a.tagName)return!!s.call(i,"fieldset[disabled] *")||!a.contains(e)}return!0}i=i.parentElement}return!1},x=function(e,i){return!(i.disabled||p(i)&&"hidden"===i.type||g(i,e)||"DETAILS"===i.tagName&&Array.prototype.slice.apply(i.children).some(function(e){return"SUMMARY"===e.tagName})||y(i))},v=function(e,i){var r;return!(p(r=i)&&"radio"===r.type&&!m(r)||0>c(i))&&!!x(e,i)},b=function(e){var i=parseInt(e.getAttribute("tabindex"),10);return!!isNaN(i)||i>=0},w=function e(i){var r=[],a=[];return i.forEach(function(i,n){var s=!!i.scope,l=s?i.scope:i,h=c(l,s),u=s?e(i.candidates):l;0===h?s?r.push.apply(r,u):r.push(l):a.push({documentOrder:n,tabIndex:h,item:i,isScope:s,content:u})}),a.sort(d).reduce(function(e,i){return i.isScope?e.push.apply(e,i.content):e.push(i.content),e},[]).concat(r)},T=r.concat("iframe").join(",");i.nq=function(e,i){return(i=i||{}).getShadowRoot?u([e],i.includeContainer,{filter:x.bind(null,i),flatten:!0,getShadowRoot:i.getShadowRoot}):h(e,i.includeContainer,x.bind(null,i))},i.tp=function(e,i){if(i=i||{},!e)throw Error("No node provided");return!1!==s.call(e,T)&&x(i,e)},i.AO=function(e,i){if(i=i||{},!e)throw Error("No node provided");return!1!==s.call(e,a)&&v(i,e)},i.Kr=function(e,i){return w((i=i||{}).getShadowRoot?u([e],i.includeContainer,{filter:v.bind(null,i),flatten:!1,getShadowRoot:i.getShadowRoot,shadowRootFilter:b}):h(e,i.includeContainer,v.bind(null,i)))}},588(e){var i;i=function(){"use strict";var e,i,r;function a(a,n){if(e){if(i){var s="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+e+")(sharedChunk); ("+i+")(sharedChunk); self.onerror = null;",l={};e(l),r=n(l),"undefined"!=typeof window&&window&&window.URL&&window.URL.createObjectURL&&(r.workerUrl=window.URL.createObjectURL(new Blob([s],{type:"text/javascript"})))}else i=n}else e=n}return a(["exports"],function(e){let i,r,a,n,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,M,E,A,I,C,P,L,k,R,z,D,O,B,F,N,V,U,j,G,q;function W(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var $,H={},Z={};function X(){if($)return Z;$=1,Object.defineProperty(Z,"__esModule",{value:!0}),Z.setMatrixArrayType=function(e){Z.ARRAY_TYPE=i=e},Z.toRadian=function(e){return e*a},Z.equals=function(i,r){return Math.abs(i-r)<=e*Math.max(1,Math.abs(i),Math.abs(r))},Z.RANDOM=Z.ARRAY_TYPE=Z.EPSILON=void 0;var e=1e-6;Z.EPSILON=e;var i="undefined"!=typeof Float32Array?Float32Array:Array;Z.ARRAY_TYPE=i;var r=Math.random;Z.RANDOM=r;var a=Math.PI/180;return Math.hypot||(Math.hypot=function(){for(var e=0,i=arguments.length;i--;)e+=arguments[i]*arguments[i];return Math.sqrt(e)}),Z}var Y,J,K,Q={},ee={},et={};function ei(){if(K)return et;function e(i){return(e="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})(i)}K=1,Object.defineProperty(et,"__esModule",{value:!0}),et.create=function(){var e=new i.ARRAY_TYPE(9);return i.ARRAY_TYPE!=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},et.fromMat4=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[4],e[4]=i[5],e[5]=i[6],e[6]=i[8],e[7]=i[9],e[8]=i[10],e},et.clone=function(e){var r=new i.ARRAY_TYPE(9);return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r},et.copy=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e},et.fromValues=function(e,r,a,n,s,l,h,u,c){var d=new i.ARRAY_TYPE(9);return d[0]=e,d[1]=r,d[2]=a,d[3]=n,d[4]=s,d[5]=l,d[6]=h,d[7]=u,d[8]=c,d},et.set=function(e,i,r,a,n,s,l,h,u,c){return e[0]=i,e[1]=r,e[2]=a,e[3]=n,e[4]=s,e[5]=l,e[6]=h,e[7]=u,e[8]=c,e},et.identity=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},et.transpose=function(e,i){if(e===i){var r=i[1],a=i[2],n=i[5];e[1]=i[3],e[2]=i[6],e[3]=r,e[5]=i[7],e[6]=a,e[7]=n}else e[0]=i[0],e[1]=i[3],e[2]=i[6],e[3]=i[1],e[4]=i[4],e[5]=i[7],e[6]=i[2],e[7]=i[5],e[8]=i[8];return e},et.invert=function(e,i){var r=i[0],a=i[1],n=i[2],s=i[3],l=i[4],h=i[5],u=i[6],c=i[7],d=i[8],p=d*l-h*c,f=-d*s+h*u,m=c*s-l*u,_=r*p+a*f+n*m;return _?(e[0]=p*(_=1/_),e[1]=(-d*a+n*c)*_,e[2]=(h*a-n*l)*_,e[3]=f*_,e[4]=(d*r-n*u)*_,e[5]=(-h*r+n*s)*_,e[6]=m*_,e[7]=(-c*r+a*u)*_,e[8]=(l*r-a*s)*_,e):null},et.adjoint=function(e,i){var r=i[0],a=i[1],n=i[2],s=i[3],l=i[4],h=i[5],u=i[6],c=i[7],d=i[8];return e[0]=l*d-h*c,e[1]=n*c-a*d,e[2]=a*h-n*l,e[3]=h*u-s*d,e[4]=r*d-n*u,e[5]=n*s-r*h,e[6]=s*c-l*u,e[7]=a*u-r*c,e[8]=r*l-a*s,e},et.determinant=function(e){var i=e[3],r=e[4],a=e[5],n=e[6],s=e[7],l=e[8];return e[0]*(l*r-a*s)+e[1]*(-l*i+a*n)+e[2]*(s*i-r*n)},et.multiply=a,et.translate=function(e,i,r){var a=i[0],n=i[1],s=i[2],l=i[3],h=i[4],u=i[5],c=i[6],d=i[7],p=i[8],f=r[0],m=r[1];return e[0]=a,e[1]=n,e[2]=s,e[3]=l,e[4]=h,e[5]=u,e[6]=f*a+m*l+c,e[7]=f*n+m*h+d,e[8]=f*s+m*u+p,e},et.rotate=function(e,i,r){var a=i[0],n=i[1],s=i[2],l=i[3],h=i[4],u=i[5],c=i[6],d=i[7],p=i[8],f=Math.sin(r),m=Math.cos(r);return e[0]=m*a+f*l,e[1]=m*n+f*h,e[2]=m*s+f*u,e[3]=m*l-f*a,e[4]=m*h-f*n,e[5]=m*u-f*s,e[6]=c,e[7]=d,e[8]=p,e},et.scale=function(e,i,r){var a=r[0],n=r[1];return e[0]=a*i[0],e[1]=a*i[1],e[2]=a*i[2],e[3]=n*i[3],e[4]=n*i[4],e[5]=n*i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e},et.fromTranslation=function(e,i){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=i[0],e[7]=i[1],e[8]=1,e},et.fromRotation=function(e,i){var r=Math.sin(i),a=Math.cos(i);return e[0]=a,e[1]=r,e[2]=0,e[3]=-r,e[4]=a,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},et.fromScaling=function(e,i){return e[0]=i[0],e[1]=0,e[2]=0,e[3]=0,e[4]=i[1],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},et.fromMat2d=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=0,e[3]=i[2],e[4]=i[3],e[5]=0,e[6]=i[4],e[7]=i[5],e[8]=1,e},et.fromQuat=function(e,i){var r=i[0],a=i[1],n=i[2],s=i[3],l=r+r,h=a+a,u=n+n,c=r*l,d=a*l,p=a*h,f=n*l,m=n*h,_=n*u,g=s*l,y=s*h,x=s*u;return e[0]=1-p-_,e[3]=d-x,e[6]=f+y,e[1]=d+x,e[4]=1-c-_,e[7]=m-g,e[2]=f-y,e[5]=m+g,e[8]=1-c-p,e},et.normalFromMat4=function(e,i){var r=i[0],a=i[1],n=i[2],s=i[3],l=i[4],h=i[5],u=i[6],c=i[7],d=i[8],p=i[9],f=i[10],m=i[11],_=i[12],g=i[13],y=i[14],x=i[15],v=r*h-a*l,b=r*u-n*l,w=r*c-s*l,T=a*u-n*h,S=a*c-s*h,M=n*c-s*u,E=d*g-p*_,A=d*y-f*_,I=d*x-m*_,C=p*y-f*g,P=p*x-m*g,L=f*x-m*y,k=v*L-b*P+w*C+T*I-S*A+M*E;return k?(e[0]=(h*L-u*P+c*C)*(k=1/k),e[1]=(u*I-l*L-c*A)*k,e[2]=(l*P-h*I+c*E)*k,e[3]=(n*P-a*L-s*C)*k,e[4]=(r*L-n*I+s*A)*k,e[5]=(a*I-r*P-s*E)*k,e[6]=(g*M-y*S+x*T)*k,e[7]=(y*w-_*M-x*b)*k,e[8]=(_*S-g*w+x*v)*k,e):null},et.projection=function(e,i,r){return e[0]=2/i,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/r,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e},et.str=function(e){return"mat3("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+")"},et.frob=function(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},et.add=function(e,i,r){return e[0]=i[0]+r[0],e[1]=i[1]+r[1],e[2]=i[2]+r[2],e[3]=i[3]+r[3],e[4]=i[4]+r[4],e[5]=i[5]+r[5],e[6]=i[6]+r[6],e[7]=i[7]+r[7],e[8]=i[8]+r[8],e},et.subtract=n,et.multiplyScalar=function(e,i,r){return e[0]=i[0]*r,e[1]=i[1]*r,e[2]=i[2]*r,e[3]=i[3]*r,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=i[7]*r,e[8]=i[8]*r,e},et.multiplyScalarAndAdd=function(e,i,r,a){return e[0]=i[0]+r[0]*a,e[1]=i[1]+r[1]*a,e[2]=i[2]+r[2]*a,e[3]=i[3]+r[3]*a,e[4]=i[4]+r[4]*a,e[5]=i[5]+r[5]*a,e[6]=i[6]+r[6]*a,e[7]=i[7]+r[7]*a,e[8]=i[8]+r[8]*a,e},et.exactEquals=function(e,i){return e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]&&e[3]===i[3]&&e[4]===i[4]&&e[5]===i[5]&&e[6]===i[6]&&e[7]===i[7]&&e[8]===i[8]},et.equals=function(e,r){var a=e[0],n=e[1],s=e[2],l=e[3],h=e[4],u=e[5],c=e[6],d=e[7],p=e[8],f=r[0],m=r[1],_=r[2],g=r[3],y=r[4],x=r[5],v=r[6],b=r[7],w=r[8];return Math.abs(a-f)<=i.EPSILON*Math.max(1,Math.abs(a),Math.abs(f))&&Math.abs(n-m)<=i.EPSILON*Math.max(1,Math.abs(n),Math.abs(m))&&Math.abs(s-_)<=i.EPSILON*Math.max(1,Math.abs(s),Math.abs(_))&&Math.abs(l-g)<=i.EPSILON*Math.max(1,Math.abs(l),Math.abs(g))&&Math.abs(h-y)<=i.EPSILON*Math.max(1,Math.abs(h),Math.abs(y))&&Math.abs(u-x)<=i.EPSILON*Math.max(1,Math.abs(u),Math.abs(x))&&Math.abs(c-v)<=i.EPSILON*Math.max(1,Math.abs(c),Math.abs(v))&&Math.abs(d-b)<=i.EPSILON*Math.max(1,Math.abs(d),Math.abs(b))&&Math.abs(p-w)<=i.EPSILON*Math.max(1,Math.abs(p),Math.abs(w))},et.sub=et.mul=void 0;var i=function(i,a){if(i&&i.__esModule)return i;if(null===i||"object"!==e(i)&&"function"!=typeof i)return{default:i};var n=r(void 0);if(n&&n.has(i))return n.get(i);var s={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var h in i)if("default"!==h&&Object.prototype.hasOwnProperty.call(i,h)){var u=l?Object.getOwnPropertyDescriptor(i,h):null;u&&(u.get||u.set)?Object.defineProperty(s,h,u):s[h]=i[h]}return s.default=i,n&&n.set(i,s),s}(X());function r(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,a=new WeakMap;return(r=function(e){return e?a:i})(e)}function a(e,i,r){var a=i[0],n=i[1],s=i[2],l=i[3],h=i[4],u=i[5],c=i[6],d=i[7],p=i[8],f=r[0],m=r[1],_=r[2],g=r[3],y=r[4],x=r[5],v=r[6],b=r[7],w=r[8];return e[0]=f*a+m*l+_*c,e[1]=f*n+m*h+_*d,e[2]=f*s+m*u+_*p,e[3]=g*a+y*l+x*c,e[4]=g*n+y*h+x*d,e[5]=g*s+y*u+x*p,e[6]=v*a+b*l+w*c,e[7]=v*n+b*h+w*d,e[8]=v*s+b*u+w*p,e}function n(e,i,r){return e[0]=i[0]-r[0],e[1]=i[1]-r[1],e[2]=i[2]-r[2],e[3]=i[3]-r[3],e[4]=i[4]-r[4],e[5]=i[5]-r[5],e[6]=i[6]-r[6],e[7]=i[7]-r[7],e[8]=i[8]-r[8],e}return et.mul=a,et.sub=n,et}var er,ea={};function en(){if(er)return ea;function e(i){return(e="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})(i)}er=1,Object.defineProperty(ea,"__esModule",{value:!0}),ea.create=function(){var e=new i.ARRAY_TYPE(16);return i.ARRAY_TYPE!=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},ea.clone=function(e){var r=new i.ARRAY_TYPE(16);return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r},ea.copy=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},ea.fromValues=function(e,r,a,n,s,l,h,u,c,d,p,f,m,_,g,y){var x=new i.ARRAY_TYPE(16);return x[0]=e,x[1]=r,x[2]=a,x[3]=n,x[4]=s,x[5]=l,x[6]=h,x[7]=u,x[8]=c,x[9]=d,x[10]=p,x[11]=f,x[12]=m,x[13]=_,x[14]=g,x[15]=y,x},ea.set=function(e,i,r,a,n,s,l,h,u,c,d,p,f,m,_,g,y){return e[0]=i,e[1]=r,e[2]=a,e[3]=n,e[4]=s,e[5]=l,e[6]=h,e[7]=u,e[8]=c,e[9]=d,e[10]=p,e[11]=f,e[12]=m,e[13]=_,e[14]=g,e[15]=y,e},ea.identity=a,ea.transpose=function(e,i){if(e===i){var r=i[1],a=i[2],n=i[3],s=i[6],l=i[7],h=i[11];e[1]=i[4],e[2]=i[8],e[3]=i[12],e[4]=r,e[6]=i[9],e[7]=i[13],e[8]=a,e[9]=s,e[11]=i[14],e[12]=n,e[13]=l,e[14]=h}else e[0]=i[0],e[1]=i[4],e[2]=i[8],e[3]=i[12],e[4]=i[1],e[5]=i[5],e[6]=i[9],e[7]=i[13],e[8]=i[2],e[9]=i[6],e[10]=i[10],e[11]=i[14],e[12]=i[3],e[13]=i[7],e[14]=i[11],e[15]=i[15];return e},ea.invert=function(e,i){var r=i[0],a=i[1],n=i[2],s=i[3],l=i[4],h=i[5],u=i[6],c=i[7],d=i[8],p=i[9],f=i[10],m=i[11],_=i[12],g=i[13],y=i[14],x=i[15],v=r*h-a*l,b=r*u-n*l,w=r*c-s*l,T=a*u-n*h,S=a*c-s*h,M=n*c-s*u,E=d*g-p*_,A=d*y-f*_,I=d*x-m*_,C=p*y-f*g,P=p*x-m*g,L=f*x-m*y,k=v*L-b*P+w*C+T*I-S*A+M*E;return k?(e[0]=(h*L-u*P+c*C)*(k=1/k),e[1]=(n*P-a*L-s*C)*k,e[2]=(g*M-y*S+x*T)*k,e[3]=(f*S-p*M-m*T)*k,e[4]=(u*I-l*L-c*A)*k,e[5]=(r*L-n*I+s*A)*k,e[6]=(y*w-_*M-x*b)*k,e[7]=(d*M-f*w+m*b)*k,e[8]=(l*P-h*I+c*E)*k,e[9]=(a*I-r*P-s*E)*k,e[10]=(_*S-g*w+x*v)*k,e[11]=(p*w-d*S-m*v)*k,e[12]=(h*A-l*C-u*E)*k,e[13]=(r*C-a*A+n*E)*k,e[14]=(g*b-_*T-y*v)*k,e[15]=(d*T-p*b+f*v)*k,e):null},ea.adjoint=function(e,i){var r=i[0],a=i[1],n=i[2],s=i[3],l=i[4],h=i[5],u=i[6],c=i[7],d=i[8],p=i[9],f=i[10],m=i[11],_=i[12],g=i[13],y=i[14],x=i[15];return e[0]=h*(f*x-m*y)-p*(u*x-c*y)+g*(u*m-c*f),e[1]=-(a*(f*x-m*y)-p*(n*x-s*y)+g*(n*m-s*f)),e[2]=a*(u*x-c*y)-h*(n*x-s*y)+g*(n*c-s*u),e[3]=-(a*(u*m-c*f)-h*(n*m-s*f)+p*(n*c-s*u)),e[4]=-(l*(f*x-m*y)-d*(u*x-c*y)+_*(u*m-c*f)),e[5]=r*(f*x-m*y)-d*(n*x-s*y)+_*(n*m-s*f),e[6]=-(r*(u*x-c*y)-l*(n*x-s*y)+_*(n*c-s*u)),e[7]=r*(u*m-c*f)-l*(n*m-s*f)+d*(n*c-s*u),e[8]=l*(p*x-m*g)-d*(h*x-c*g)+_*(h*m-c*p),e[9]=-(r*(p*x-m*g)-d*(a*x-s*g)+_*(a*m-s*p)),e[10]=r*(h*x-c*g)-l*(a*x-s*g)+_*(a*c-s*h),e[11]=-(r*(h*m-c*p)-l*(a*m-s*p)+d*(a*c-s*h)),e[12]=-(l*(p*y-f*g)-d*(h*y-u*g)+_*(h*f-u*p)),e[13]=r*(p*y-f*g)-d*(a*y-n*g)+_*(a*f-n*p),e[14]=-(r*(h*y-u*g)-l*(a*y-n*g)+_*(a*u-n*h)),e[15]=r*(h*f-u*p)-l*(a*f-n*p)+d*(a*u-n*h),e},ea.determinant=function(e){var i=e[0],r=e[1],a=e[2],n=e[3],s=e[4],l=e[5],h=e[6],u=e[7],c=e[8],d=e[9],p=e[10],f=e[11],m=e[12],_=e[13],g=e[14],y=e[15];return(i*l-r*s)*(p*y-f*g)-(i*h-a*s)*(d*y-f*_)+(i*u-n*s)*(d*g-p*_)+(r*h-a*l)*(c*y-f*m)-(r*u-n*l)*(c*g-p*m)+(a*u-n*h)*(c*_-d*m)},ea.multiply=n,ea.translate=function(e,i,r){var a,n,s,l,h,u,c,d,p,f,m,_,g=r[0],y=r[1],x=r[2];return i===e?(e[12]=i[0]*g+i[4]*y+i[8]*x+i[12],e[13]=i[1]*g+i[5]*y+i[9]*x+i[13],e[14]=i[2]*g+i[6]*y+i[10]*x+i[14],e[15]=i[3]*g+i[7]*y+i[11]*x+i[15]):(n=i[1],s=i[2],l=i[3],h=i[4],u=i[5],c=i[6],d=i[7],p=i[8],f=i[9],m=i[10],_=i[11],e[0]=a=i[0],e[1]=n,e[2]=s,e[3]=l,e[4]=h,e[5]=u,e[6]=c,e[7]=d,e[8]=p,e[9]=f,e[10]=m,e[11]=_,e[12]=a*g+h*y+p*x+i[12],e[13]=n*g+u*y+f*x+i[13],e[14]=s*g+c*y+m*x+i[14],e[15]=l*g+d*y+_*x+i[15]),e},ea.scale=function(e,i,r){var a=r[0],n=r[1],s=r[2];return e[0]=i[0]*a,e[1]=i[1]*a,e[2]=i[2]*a,e[3]=i[3]*a,e[4]=i[4]*n,e[5]=i[5]*n,e[6]=i[6]*n,e[7]=i[7]*n,e[8]=i[8]*s,e[9]=i[9]*s,e[10
206]=i[10]*s,e[11]=i[11]*s,e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},ea.rotate=function(e,r,a,n){var s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,M,E,A,I,C,P,L=n[0],k=n[1],R=n[2],z=Math.hypot(L,k,R);return z<i.EPSILON?null:(L*=z=1/z,k*=z,R*=z,s=Math.sin(a),l=Math.cos(a),c=r[1],d=r[2],p=r[3],m=r[5],_=r[6],g=r[7],x=r[9],v=r[10],b=r[11],w=L*L*(h=1-l)+l,M=L*k*h-R*s,E=k*k*h+l,A=R*k*h+L*s,I=L*R*h+k*s,C=k*R*h-L*s,P=R*R*h+l,e[0]=(u=r[0])*w+(f=r[4])*(T=k*L*h+R*s)+(y=r[8])*(S=R*L*h-k*s),e[1]=c*w+m*T+x*S,e[2]=d*w+_*T+v*S,e[3]=p*w+g*T+b*S,e[4]=u*M+f*E+y*A,e[5]=c*M+m*E+x*A,e[6]=d*M+_*E+v*A,e[7]=p*M+g*E+b*A,e[8]=u*I+f*C+y*P,e[9]=c*I+m*C+x*P,e[10]=d*I+_*C+v*P,e[11]=p*I+g*C+b*P,r!==e&&(e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15]),e)},ea.rotateX=function(e,i,r){var a=Math.sin(r),n=Math.cos(r),s=i[4],l=i[5],h=i[6],u=i[7],c=i[8],d=i[9],p=i[10],f=i[11];return i!==e&&(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15]),e[4]=s*n+c*a,e[5]=l*n+d*a,e[6]=h*n+p*a,e[7]=u*n+f*a,e[8]=c*n-s*a,e[9]=d*n-l*a,e[10]=p*n-h*a,e[11]=f*n-u*a,e},ea.rotateY=function(e,i,r){var a=Math.sin(r),n=Math.cos(r),s=i[0],l=i[1],h=i[2],u=i[3],c=i[8],d=i[9],p=i[10],f=i[11];return i!==e&&(e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15]),e[0]=s*n-c*a,e[1]=l*n-d*a,e[2]=h*n-p*a,e[3]=u*n-f*a,e[8]=s*a+c*n,e[9]=l*a+d*n,e[10]=h*a+p*n,e[11]=u*a+f*n,e},ea.rotateZ=function(e,i,r){var a=Math.sin(r),n=Math.cos(r),s=i[0],l=i[1],h=i[2],u=i[3],c=i[4],d=i[5],p=i[6],f=i[7];return i!==e&&(e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15]),e[0]=s*n+c*a,e[1]=l*n+d*a,e[2]=h*n+p*a,e[3]=u*n+f*a,e[4]=c*n-s*a,e[5]=d*n-l*a,e[6]=p*n-h*a,e[7]=f*n-u*a,e},ea.fromTranslation=function(e,i){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]=i[0],e[13]=i[1],e[14]=i[2],e[15]=1,e},ea.fromScaling=function(e,i){return e[0]=i[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=i[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},ea.fromRotation=function(e,r,a){var n,s,l,h=a[0],u=a[1],c=a[2],d=Math.hypot(h,u,c);return d<i.EPSILON?null:(h*=d=1/d,u*=d,c*=d,n=Math.sin(r),s=Math.cos(r),e[0]=h*h*(l=1-s)+s,e[1]=u*h*l+c*n,e[2]=c*h*l-u*n,e[3]=0,e[4]=h*u*l-c*n,e[5]=u*u*l+s,e[6]=c*u*l+h*n,e[7]=0,e[8]=h*c*l+u*n,e[9]=u*c*l-h*n,e[10]=c*c*l+s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)},ea.fromXRotation=function(e,i){var r=Math.sin(i),a=Math.cos(i);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=r,e[7]=0,e[8]=0,e[9]=-r,e[10]=a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},ea.fromYRotation=function(e,i){var r=Math.sin(i),a=Math.cos(i);return e[0]=a,e[1]=0,e[2]=-r,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=r,e[9]=0,e[10]=a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},ea.fromZRotation=function(e,i){var r=Math.sin(i),a=Math.cos(i);return e[0]=a,e[1]=r,e[2]=0,e[3]=0,e[4]=-r,e[5]=a,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},ea.fromRotationTranslation=s,ea.fromQuat2=function(e,r){var a=new i.ARRAY_TYPE(3),n=-r[0],l=-r[1],h=-r[2],u=r[3],c=r[4],d=r[5],p=r[6],f=r[7],m=n*n+l*l+h*h+u*u;return m>0?(a[0]=2*(c*u+f*n+d*h-p*l)/m,a[1]=2*(d*u+f*l+p*n-c*h)/m,a[2]=2*(p*u+f*h+c*l-d*n)/m):(a[0]=2*(c*u+f*n+d*h-p*l),a[1]=2*(d*u+f*l+p*n-c*h),a[2]=2*(p*u+f*h+c*l-d*n)),s(e,r,a),e},ea.getTranslation=function(e,i){return e[0]=i[12],e[1]=i[13],e[2]=i[14],e},ea.getScaling=l,ea.getRotation=function(e,r){var a=new i.ARRAY_TYPE(3);l(a,r);var n=1/a[0],s=1/a[1],h=1/a[2],u=r[0]*n,c=r[1]*s,d=r[2]*h,p=r[4]*n,f=r[5]*s,m=r[6]*h,_=r[8]*n,g=r[9]*s,y=r[10]*h,x=u+f+y,v=0;return x>0?(v=2*Math.sqrt(x+1),e[3]=.25*v,e[0]=(m-g)/v,e[1]=(_-d)/v,e[2]=(c-p)/v):u>f&&u>y?(v=2*Math.sqrt(1+u-f-y),e[3]=(m-g)/v,e[0]=.25*v,e[1]=(c+p)/v,e[2]=(_+d)/v):f>y?(v=2*Math.sqrt(1+f-u-y),e[3]=(_-d)/v,e[0]=(c+p)/v,e[1]=.25*v,e[2]=(m+g)/v):(v=2*Math.sqrt(1+y-u-f),e[3]=(c-p)/v,e[0]=(_+d)/v,e[1]=(m+g)/v,e[2]=.25*v),e},ea.fromRotationTranslationScale=function(e,i,r,a){var n=i[0],s=i[1],l=i[2],h=i[3],u=n+n,c=s+s,d=l+l,p=n*u,f=n*c,m=n*d,_=s*c,g=s*d,y=l*d,x=h*u,v=h*c,b=h*d,w=a[0],T=a[1],S=a[2];return e[0]=(1-(_+y))*w,e[1]=(f+b)*w,e[2]=(m-v)*w,e[3]=0,e[4]=(f-b)*T,e[5]=(1-(p+y))*T,e[6]=(g+x)*T,e[7]=0,e[8]=(m+v)*S,e[9]=(g-x)*S,e[10
206]=(1-(p+_))*S,e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e},ea.fromRotationTranslationScaleOrigin=function(e,i,r,a,n){var s=i[0],l=i[1],h=i[2],u=i[3],c=s+s,d=l+l,p=h+h,f=s*c,m=s*d,_=s*p,g=l*d,y=l*p,x=h*p,v=u*c,b=u*d,w=u*p,T=a[0],S=a[1],M=a[2],E=n[0],A=n[1],I=n[2],C=(1-(g+x))*T,P=(m+w)*T,L=(_-b)*T,k=(m-w)*S,R=(1-(f+x))*S,z=(y+v)*S,D=(_+b)*M,O=(y-v)*M,B=(1-(f+g))*M;return e[0]=C,e[1]=P,e[2]=L,e[3]=0,e[4]=k,e[5]=R,e[6]=z,e[7]=0,e[8]=D,e[9]=O,e[10]=B,e[11]=0,e[12]=r[0]+E-(C*E+k*A+D*I),e[13]=r[1]+A-(P*E+R*A+O*I),e[14]=r[2]+I-(L*E+z*A+B*I),e[15]=1,e},ea.fromQuat=function(e,i){var r=i[0],a=i[1],n=i[2],s=i[3],l=r+r,h=a+a,u=n+n,c=r*l,d=a*l,p=a*h,f=n*l,m=n*h,_=n*u,g=s*l,y=s*h,x=s*u;return e[0]=1-p-_,e[1]=d+x,e[2]=f-y,e[3]=0,e[4]=d-x,e[5]=1-c-_,e[6]=m+g,e[7]=0,e[8]=f+y,e[9]=m-g,e[10]=1-c-p,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},ea.frustum=function(e,i,r,a,n,s,l){var h=1/(r-i),u=1/(n-a),c=1/(s-l);return e[0]=2*s*h,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*s*u,e[6]=0,e[7]=0,e[8]=(r+i)*h,e[9]=(n+a)*u,e[10]=(l+s)*c,e[11]=-1,e[12]=0,e[13]=0,e[14]=l*s*2*c,e[15]=0,e},ea.perspectiveNO=h,ea.perspectiveZO=function(e,i,r,a,n){var s,l=1/Math.tan(i/2);return e[0]=l/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=n&&n!==1/0?(e[10]=n*(s=1/(a-n)),e[14]=n*a*s):(e[10]=-1,e[14]=-a),e},ea.perspectiveFromFieldOfView=function(e,i,r,a){var n=Math.tan(i.upDegrees*Math.PI/180),s=Math.tan(i.downDegrees*Math.PI/180),l=Math.tan(i.leftDegrees*Math.PI/180),h=Math.tan(i.rightDegrees*Math.PI/180),u=2/(l+h),c=2/(n+s);return e[0]=u,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=-(l-h)*u*.5,e[9]=(n-s)*c*.5,e[10]=a/(r-a),e[11]=-1,e[12]=0,e[13]=0,e[14]=a*r/(r-a),e[15]=0,e},ea.orthoNO=u,ea.orthoZO=function(e,i,r,a,n,s,l){var h=1/(i-r),u=1/(a-n),c=1/(s-l);return e[0]=-2*h,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*u,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=c,e[11]=0,e[12]=(i+r)*h,e[13]=(n+a)*u,e[14]=s*c,e[15]=1,e},ea.lookAt=function(e,r,n,s){var l,h,u,c,d,p,f,m,_,g,y=r[0],x=r[1],v=r[2],b=s[0],w=s[1],T=s[2],S=n[0],M=n[1],E=n[2];return Math.abs(y-S)<i.EPSILON&&Math.abs(x-M)<i.EPSILON&&Math.abs(v-E)<i.EPSILON?a(e):(f=y-S,m=x-M,_=v-E,(g=Math.hypot(l=w*(_*=g=1/
206Math.hypot(f,m,_))-T*(m*=g),h=T*(f*=g)-b*_,u=b*m-w*f))?(l*=g=1/g,h*=g,u*=g):(l=0,h=0,u=0),(g=Math.hypot(c=m*u-_*h,d=_*l-f*u,p=f*h-m*l))?(c*=g=1/g,d*=g,p*=g):(c=0,d=0,p=0),e[0]=l,e[1]=c,e[2]=f,e[3]=0,e[4]=h,e[5]=d,e[6]=m,e[7]=0,e[8]=u,e[9]=p,e[10]=_,e[11]=0,e[12]=-(l*y+h*x+u*v),e[13]=-(c*y+d*x+p*v),e[14]=-(f*y+m*x+_*v),e[15]=1,e)},ea.targetTo=function(e,i,r,a){var n=i[0],s=i[1],l=i[2],h=a[0],u=a[1],c=a[2],d=n-r[0],p=s-r[1],f=l-r[2],m=d*d+p*p+f*f;m>0&&(d*=m=1/Math.sqrt(m),p*=m,f*=m);var _=u*f-c*p,g=c*d-h*f,y=h*p-u*d;return(m=_*_+g*g+y*y)>0&&(_*=m=1/Math.sqrt(m),g*=m,y*=m),e[0]=_,e[1]=g,e[2]=y,e[3]=0,e[4]=p*y-f*g,e[5]=f*_-d*y,e[6]=d*g-p*_,e[7]=0,e[8]=d,e[9]=p,e[10]=f,e[11]=0,e[12]=n,e[13]=s,e[14]=l,e[15]=1,e},ea.str=function(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"},ea.frob=function(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},ea.add=function(e,i,r){return e[0]=i[0]+r[0],e[1]=i[1]+r[1],e[2]=i[2]+r[2],e[3]=i[3]+r[3],e[4]=i[4]+r[4],e[5]=i[5]+r[5],e[6]=i[6]+r[6],e[7]=i[7]+r[7],e[8]=i[8]+r[8],e[9]=i[9]+r[9],e[10]=i[10]+r[10],e[11]=i[11]+r[11],e[12]=i[12]+r[12],e[13]=i[13]+r[13],e[14]=i[14]+r[14],e[15]=i[15]+r[15],e},ea.subtract=c,ea.multiplyScalar=function(e,i,r){return e[0]=i[0]*r,e[1]=i[1]*r,e[2]=i[2]*r,e[3]=i[3]*r,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=i[7]*r,e[8]=i[8]*r,e[9]=i[9]*r,e[10]=i[10]*r,e[11]=i[11]*r,e[12]=i[12]*r,e[13]=i[13]*r,e[14]=i[14]*r,e[15]=i[15]*r,e},ea.multiplyScalarAndAdd=function(e,i,r,a){return e[0]=i[0]+r[0]*a,e[1]=i[1]+r[1]*a,e[2]=i[2]+r[2]*a,e[3]=i[3]+r[3]*a,e[4]=i[4]+r[4]*a,e[5]=i[5]+r[5]*a,e[6]=i[6]+r[6]*a,e[7]=i[7]+r[7]*a,e[8]=i[8]+r[8]*a,e[9]=i[9]+r[9]*a,e[10]=i[10]+r[10]*a,e[11]=i[11]+r[11]*a,e[12]=i[12]+r[12]*a,e[13]=i[13]+r[13]*a,e[14]=i[14]+r[14]*a,e[15]=i[15]+r[15]*a,e},ea.exactEquals=function(e,i){return e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]&&e[3]===i[3]&&e[4]===i[4]&&e[5]===i[5]&&e[6]===i[6]&&e[7]===i[7]&&e[8]===i[8]&&e[9]===i[9]&&e[10]===i[10]&&e[11]===i[11]&&e[12]===i[12]&&e[13]===i[13]&&e[14]===i[14]&&e[15]===i[15]},ea.equals=function(e,r){var a=e[0],n=e[1],s=e[2],l=e[3],h=e[4],u=e[5],c=e[6],d=e[7],p=e[8],f=e[9],m=e[10],_=e[11],g=e[12],y=e[13],x=e[14],v=e[15],b=r[0],w=r[1],T=r[2],S=r[3],M=r[4],E=r[5],A=r[6],I=r[7],C=r[8],P=r[9],L=r[10],k=r[11],R=r[12],z=r[13],D=r[14],O=r[15];return Math.abs(a-b)<=i.EPSILON*Math.max(1,Math.abs(a),Math.abs(b))&&Math.abs(n-w)<=i.EPSILON*Math.max(1,Math.abs(n),Math.abs(w))&&Math.abs(s-T)<=i.EPSILON*Math.max(1,Math.abs(s),Math.abs(T))&&Math.abs(l-S)<=i.EPSILON*Math.max(1,Math.abs(l),Math.abs(S))&&Math.abs(h-M)<=i.EPSILON*Math.max(1,Math.abs(h),Math.abs(M))&&Math.abs(u-E)<=i.EPSILON*Math.max(1,Math.abs(u),Math.abs(E))&&Math.abs(c-A)<=i.EPSILON*Math.max(1,Math.abs(c),Math.abs(A))&&Math.abs(d-I)<=i.EPSILON*Math.max(1,Math.abs(d),Math.abs(I))&&Math.abs(p-C)<=i.EPSILON*Math.max(1,Math.abs(p),Math.abs(C))&&Math.abs(f-P)<=i.EPSILON*Math.max(1,Math.abs(f),Math.abs(P))&&Math.abs(m-L)<=i.EPSILON*Math.max(1,Math.abs(m),Math.abs(L))&&Math.abs(_-k)<=i.EPSILON*Math.max(1,Math.abs(_),Math.abs(k))&&Math.abs(g-R)<=i.EPSILON*Math.max(1,Math.abs(g),Math.abs(R))&&Math.abs(y-z)<=i.EPSILON*Math.max(1,Math.abs(y),Math.abs(z))&&Math.abs(x-D)<=i.EPSILON*Math.max(1,Math.abs(x),Math.abs(D))&&Math.abs(v-O)<=i.EPSILON*Math.max(1,Math.abs(v),Math.abs(O))},ea.sub=ea.mul=ea.ortho=ea.perspective=void 0;var i=function(i,a){if(i&&i.__esModule)return i;if(null===i||"object"!==e(i)&&"function"!=typeof i)return{default:i};var n=r(void 0);if(n&&n.has(i))return n.get(i);var s={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var h in i)if("default"!==h&&Object.prototype.hasOwnProperty.call(i,h)){var u=l?Object.getOwnPropertyDescriptor(i,h):null;u&&(u.get||u.set)?Object.defineProperty(s,h,u):s[h]=i[h]}return s.default=i,n&&n.set(i,s),s}(X());function r(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,a=new WeakMap;return(r=function(e){return e?a:i})(e)}function a(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
206]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function n(e,i,r){var a=i[0],n=i[1],s=i[2],l=i[3],h=i[4],u=i[5],c=i[6],d=i[7],p=i[8],f=i[9],m=i[10],_=i[11],g=i[12],y=i[13],x=i[14],v=i[15],b=r[0],w=r[1],T=r[2],S=r[3];return e[0]=b*a+w*h+T*p+S*g,e[1]=b*n+w*u+T*f+S*y,e[2]=b*s+w*c+T*m+S*x,e[3]=b*l+w*d+T*_+S*v,e[4]=(b=r[4])*a+(w=r[5])*h+(T=r[6])*p+(S=r[7])*g,e[5]=b*n+w*u+T*f+S*y,e[6]=b*s+w*c+T*m+S*x,e[7]=b*l+w*d+T*_+S*v,e[8]=(b=r[8])*a+(w=r[9])*h+(T=r[10])*p+(S=r[11])*g,e[9]=b*n+w*u+T*f+S*y,e[10]=b*s+w*c+T*m+S*x,e[11]=b*l+w*d+T*_+S*v,e[12]=(b=r[12])*a+(w=r[13])*h+(T=r[14])*p+(S=r[15])*g,e[13]=b*n+w*u+T*f+S*y,e[14]=b*s+w*c+T*m+S*x,e[15]=b*l+w*d+T*_+S*v,e}function s(e,i,r){var a=i[0],n=i[1],s=i[2],l=i[3],h=a+a,u=n+n,c=s+s,d=a*h,p=a*u,f=a*c,m=n*u,_=n*c,g=s*c,y=l*h,x=l*u,v=l*c;return e[0]=1-(m+g),e[1]=p+v,e[2]=f-x,e[3]=0,e[4]=p-v,e[5]=1-(d+g),e[6]=_+y,e[7]=0,e[8]=f+x,e[9]=_-y,e[10]=1-(d+m),e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function l(e,i){var r=i[4],a=i[5],n=i[6],s=i[8],l=i[9],h=i[10];return e[0]=Math.hypot(i[0],i[1],i[2]),e[1]=Math.hypot(r,a,n),e[2]=Math.hypot(s,l,h),e}function h(e,i,r,a,n){var s,l=1/Math.tan(i/2);return e[0]=l/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=n&&n!==1/0?(e[10]=(n+a)*(s=1/(a-n)),e[14]=2*n*a*s):(e[10]=-1,e[14]=-2*a),e}function u(e,i,r,a,n,s,l){var h=1/(i-r),u=1/(a-n),c=1/(s-l);return e[0]=-2*h,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*u,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(i+r)*h,e[13]=(n+a)*u,e[14]=(l+s)*c,e[15]=1,e}function c(e,i,r){return e[0]=i[0]-r[0],e[1]=i[1]-r[1],e[2]=i[2]-r[2],e[3]=i[3]-r[3],e[4]=i[4]-r[4],e[5]=i[5]-r[5],e[6]=i[6]-r[6],e[7]=i[7]-r[7],e[8]=i[8]-r[8],e[9]=i[9]-r[9],e[10]=i[10]-r[10],e[11]=i[11]-r[11],e[12]=i[12]-r[12],e[13]=i[13]-r[13],e[14]=i[14]-r[14],e[15]=i[15]-r[15],e}return ea.perspective=h,ea.ortho=u,ea.mul=n,ea.sub=c,ea}var eo,es={},el={};function eh(){if(eo)return el;function e(i){return(e="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})(i)}
206eo=1,Object.defineProperty(el,"__esModule",{value:!0}),el.create=a,el.clone=function(e){var r=new i.ARRAY_TYPE(3);return r[0]=e[0],r[1]=e[1],r[2]=e[2],r},el.length=n,el.fromValues=function(e,r,a){var n=new i.ARRAY_TYPE(3);return n[0]=e,n[1]=r,n[2]=a,n},el.copy=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e},el.set=function(e,i,r,a){return e[0]=i,e[1]=r,e[2]=a,e},el.add=function(e,i,r){return e[0]=i[0]+r[0],e[1]=i[1]+r[1],e[2]=i[2]+r[2],e},el.subtract=s,el.multiply=l,el.divide=h,el.ceil=function(e,i){return e[0]=Math.ceil(i[0]),e[1]=Math.ceil(i[1]),e[2]=Math.ceil(i[2]),e},el.floor=function(e,i){return e[0]=Math.floor(i[0]),e[1]=Math.floor(i[1]),e[2]=Math.floor(i[2]),e},el.min=function(e,i,r){return e[0]=Math.min(i[0],r[0]),e[1]=Math.min(i[1],r[1]),e[2]=Math.min(i[2],r[2]),e},el.max=function(e,i,r){return e[0]=Math.max(i[0],r[0]),e[1]=Math.max(i[1],r[1]),e[2]=Math.max(i[2],r[2]),e},el.round=function(e,i){return e[0]=Math.round(i[0]),e[1]=Math.round(i[1]),e[2]=Math.round(i[2]),e},el.scale=function(e,i,r){return e[0]=i[0]*r,e[1]=i[1]*r,e[2]=i[2]*r,e},el.scaleAndAdd=function(e,i,r,a){return e[0]=i[0]+r[0]*a,e[1]=i[1]+r[1]*a,e[2]=i[2]+r[2]*a,e},el.distance=u,el.squaredDistance=c,el.squaredLength=d,el.negate=function(e,i){return e[0]=-i[0],e[1]=-i[1],e[2]=-i[2],e},el.inverse=function(e,i){return e[0]=1/i[0],e[1]=1/i[1],e[2]=1/i[2],e},el.normalize=function(e,i){var r=i[0],a=i[1],n=i[2],s=r*r+a*a+n*n;return s>0&&(s=1/Math.sqrt(s)),e[0]=i[0]*s,e[1]=i[1]*s,e[2]=i[2]*s,e},el.dot=p,el.cross=function(e,i,r){var a=i[0],n=i[1],s=i[2],l=r[0],h=r[1],u=r[2];return e[0]=n*u-s*h,e[1]=s*l-a*u,e[2]=a*h-n*l,e},el.lerp=function(e,i,r,a){var n=i[0],s=i[1],l=i[2];return e[0]=n+a*(r[0]-n),e[1]=s+a*(r[1]-s),e[2]=l+a*(r[2]-l),e},el.hermite=function(e,i,r,a,n,s){var l=s*s,h=l*(2*s-3)+1,u=l*(s-2)+s,c=l*(s-1),d=l*(3-2*s);return e[0]=i[0]*h+r[0]*u+a[0]*c+n[0]*d,e[1]=i[1]*h+r[1]*u+a[1]*c+n[1]*d,e[2]=i[2]*h+r[2]*u+a[2]*c+n[2]*d,e},el.bezier=function(e,i,r,a,n,s){var l=1-s,h=l*l,u=s*s,c=h*l,d=3*s*h,p=3*u*l,f=u*s;return e[0]=i[0]*c+r[0]*d+a[0]*p+n[0]*f,e[1]=i[1]*c+r[1]*d+a[1]*p+n[1]*f,e[2]=i[2]*c+r[2]*d+a[2]*p+n[2]*f,e},el.random=function(e,r){r=r||1;var a=2*i.RANDOM()*Math.PI,n=2*i.RANDOM()-1,s=Math.sqrt(1-n*n)*r;return e[0]=Math.cos(a)*s,e[1]=Math.sin(a)*s,e[2]=n*r,e},el.transformMat4=function(e,i,r){var a=i[0],n=i[1],s=i[2],l=r[3]*a+r[7]*n+r[11]*s+r[15];return e[0]=(r[0]*a+r[4]*n+r[8]*s+r[12])/(l=l||1),e[1]=(r[1]*a+r[5]*n+r[9]*s+r[13])/l,e[2]=(r[2]*a+r[6]*n+r[10]*s+r[14])/l,e},el.transformMat3=function(e,i,r){var a=i[0],n=i[1],s=i[2];return e[0]=a*r[0]+n*r[3]+s*r[6],e[1]=a*r[1]+n*r[4]+s*r[7],e[2]=a*r[2]+n*r[5]+s*r[8],e},el.transformQuat=function(e,i,r){var a=r[0],n=r[1],s=r[2],l=i[0],h=i[1],u=i[2],c=n*u-s*h,d=s*l-a*u,p=a*h-n*l,f=n*p-s*d,m=s*c-a*p,_=a*d-n*c,g=2*r[3];return d*=g,p*=g,m*=2,_*=2,e[0]=l+(c*=g)+(f*=2),e[1]=h+d+m,e[2]=u+p+_,e},el.rotateX=function(e,i,r,a){var n=[],s=[];return n[0]=i[0]-r[0],n[1]=i[1]-r[1],n[2]=i[2]-r[2],s[0]=n[0],s[1]=n[1]*Math.cos(a)-n[2]*Math.sin(a),s[2]=n[1]*Math.sin(a)+n[2]*Math.cos(a),e[0]=s[0]+r[0],e[1]=s[1]+r[1],e[2]=s[2]+r[2],e},el.rotateY=function(e,i,r,a){var n=[],s=[];return n[0]=i[0]-r[0],n[1]=i[1]-r[1],n[2]=i[2]-r[2],s[0]=n[2]*Math.sin(a)+n[0]*Math.cos(a),s[1]=n[1],s[2]=n[2]*Math.cos(a)-n[0]*Math.sin(a),e[0]=s[0]+r[0],e[1]=s[1]+r[1],e[2]=s[2]+r[2],e},el.rotateZ=function(e,i,r,a){var n=[],s=[];return n[0]=i[0]-r[0],n[1]=i[1]-r[1],n[2]=i[2]-r[2],s[0]=n[0]*Math.cos(a)-n[1]*Math.sin(a),s[1]=n[0]*Math.sin(a)+n[1]*Math.cos(a),s[2]=n[2],e[0]=s[0]+r[0],e[1]=s[1]+r[1],e[2]=s[2]+r[2],e},el.angle=function(e,i){var r=e[0],a=e[1],n=e[2],s=i[0],l=i[1],h=i[2],u=Math.sqrt(r*r+a*a+n*n)*Math.sqrt(s*s+l*l+h*h);return Math.acos(Math.min(Math.max(u&&p(e,i)/u,-1),1))},el.zero=function(e){return e[0]=0,e[1]=0,e[2]=0,e},el.str=function(e){return"vec3("+e[0]+", "+e[1]+", "+e[2]+")"},el.exactEquals=function(e,i){return e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]},el.equals=function(e,r){var a=e[0],n=e[1],s=e[2],l=r[0],h=r[1],u=r[2];return Math.abs(a-l)<=i.EPSILON*Math.max(1,Math.abs(a),Math.abs(l))&&Math.abs(n-h)<=i.EPSILON*Math.max(1,Math.abs(n),Math.abs(h))&&Math.abs(s-u)<=i.EPSILON*Math.max(1,Math.abs(s),Math.abs(u))},el.forEach=el.sqrLen=el.len=el.sqrDist=el.dist=el.div=el.mul=el.sub=void 0;var i=function(i,a){if(i&&i.__esModule)return i;if(null===i||"object"!==e(i)&&"function"!=typeof i)return{default:i};var n=r(void 0);if(n&&n.has(i))return n.get(i);var s={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var h in i)if("default"!==h&&Object.prototype.hasOwnProperty.call(i,h)){var u=l?Object.getOwnPropertyDescriptor(i,h):null;u&&(u.get||u.set)?Object.defineProperty(s,h,u):s[h]=i[h]}return s.default=i,n&&n.set(i,s),s}(X());function r(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,a=new WeakMap;return(r=function(e){return e?a:i})(e)}function a(){var e=new i.ARRAY_TYPE(3);return i.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function n(e){return Math.hypot(e[0],e[1],e[2])}function s(e,i,r){return e[0]=i[0]-r[0],e[1]=i[1]-r[1],e[2]=i[2]-r[2],e}function l(e,i,r){return e[0]=i[0]*r[0],e[1]=i[1]*r[1],e[2]=i[2]*r[2],e}function h(e,i,r){return e[0]=i[0]/r[0],e[1]=i[1]/r[1],e[2]=i[2]/r[2],e}function u(e,i){return Math.hypot(i[0]-e[0],i[1]-e[1],i[2]-e[2])}function c(e,i){var r=i[0]-e[0],a=i[1]-e[1],n=i[2]-e[2];return r*r+a*a+n*n}function d(e){var i=e[0],r=e[1],a=e[2];return i*i+r*r+a*a}function p(e,i){return e[0]*i[0]+e[1]*i[1]+e[2]*i[2]}el.sub=s,el.mul=l,el.div=h,el.dist=u,el.sqrDist=c,el.len=n,el.sqrLen=d;var f,m=(f=a(),function(e,i,r,a,n,s){var l,h;for(i||(i=3),r||(r=0),h=a?Math.min(a*i+r,e.length):e.length,l=r;l<h;l+=i)f[0]=e[l],f[1]=e[l+1],f[2]=e[l+2],n(f,f,s),e[l]=f[0],e[l+1]=f[1],e[l+2]=f[2];return e});return el.forEach=m,el}var eu,ec,ed={};function ep(){if(eu)return ed;function e(i){return(e="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})(i)}eu=1,Object.defineProperty(ed,"__esModule",{value:!0}),ed.create=a,ed.clone=function(e){var r=new i.ARRAY_TYPE(4);return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r},ed.fromValues=function(e,r,a,n){var s=new i.ARRAY_TYPE(4);return s[0]=e,s[1]=r,s[2]=a,s[3]=n,s},ed.copy=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e},ed.set=function(e,i,r,a,n){return e[0]=i,e[1]=r,e[2]=a,e[3]=n,e},ed.add=function(e,i,r){return e[0]=i[0]+r[0],e[1]=i[1]+r[1],e[2]=i[2]+r[2],e[3]=i[3]+r[3],e},ed.subtract=n,ed.multiply=s,ed.divide=l,ed.ceil=function(e,i){return e[0]=Math.ceil(i[0]),e[1]=Math.ceil(i[1]),e[2]=Math.ceil(i[2]),e[3]=Math.ceil(i[3]),e},ed.floor=function(e,i){return e[0]=Math.floor(i[0]),e[1]=Math.floor(i[1]),e[2]=Math.floor(i[2]),e[3]=Math.floor(i[3]),e},ed.min=function(e,i,r){return e[0]=Math.min(i[0],r[0]),e[1]=Math.min(i[1],r[1]),e[2]=Math.min(i[2],r[2]),e[3]=Math.min(i[3],r[3]),e},ed.max=function(e,i,r){return e[0]=Math.max(i[0],r[0]),e[1]=Math.max(i[1],r[1]),e[2]=Math.max(i[2],r[2]),e[3]=Math.max(i[3],r[3]),e},ed.round=function(e,i){return e[0]=Math.round(i[0]),e[1]=Math.round(i[1]),e[2]=Math.round(i[2]),e[3]=Math.round(i[3]),e},ed.scale=function(e,i,r){return e[0]=i[0]*r,e[1]=i[1]*r,e[2]=i[2]*r,e[3]=i[3]*r,e},ed.scaleAndAdd=function(e,i,r,a){return e[0]=i[0]+r[0]*a,e[1]=i[1]+r[1]*a,e[2]=i[2]+r[2]*a,e[3]=i[3]+r[3]*a,e},ed.distance=h,ed.squaredDistance=u,ed.length=c,ed.squaredLength=d,ed.negate=function(e,i){return e[0]=-i[0],e[1]=-i[1],e[2]=-i[2],e[3]=-i[3],e},ed.inverse=function(e,i){return e[0]=1/i[0],e[1]=1/i[1],e[2]=1/i[2],e[3]=1/i[3],e},ed.normalize=function(e,i){var r=i[0],a=i[1],n=i[2],s=i[3],l=r*r+a*a+n*n+s*s;return l>0&&(l=1/Math.sqrt(l)),e[0]=r*l,e[1]=a*l,e[2]=n*l,e[3]=s*l,e},ed.dot=function(e,i){return e[0]*i[0]+e[1]*i[1]+e[2]*i[2]+e[3]*i[3]},ed.cross=function(e,i,r,a){var n=r[0]*a[1]-r[1]*a[0],s=r[0]*a[2]-r[2]*a[0],l=r[0]*a[3]-r[3]*a[0],h=r[1]*a[2]-r[2]*a[1],u=r[1]*a[3]-r[3]*a[1],c=r[2]*a[3]-r[3]*a[2],d=i[0],p=i[1],f=i[2],m=i[3];return e[0]=p*c-f*u+m*h,e[1]=-d*c+f*l-m*s,e[2]=d*u-p*l+m*n,e[3]=-d*h+p*s-f*n,e},ed.lerp=function(e,i,r,a){var n=i[0],s=i[1],l=i[2],h=i[3];return e[0]=n+a*(r[0]-n),e[1]=s+a*(r[1]-s),e[2]=l+a*(r[2]-l),e[3]=h+a*(r[3]-h),e},ed.random=function(e,r){r=r||1;do h=(a=2*i.RANDOM()-1)*a+(n=2*i.RANDOM()-1)*n;while(h>=1)do u=(s=2*i.RANDOM()-1)*s+(l=2*i.RANDOM()-1)*l;while(u>=1)var a,n,s,l,h,u,c=Math.sqrt((1-h)/u);return e[0]=r*a,e[1]=r*n,e[2]=r*s*c,e[3]=r*l*c,e},ed.transformMat4=function(e,i,r){var a=i[0],n=i[1],s=i[2],l=i[3];return e[0]=r[0]*a+r[4]*n+r[8]*s+r[12]*l,e[1]=r[1]*a+r[5]*n+r[9]*s+r[13]*l,e[2]=r[2]*a+r[6]*n+r[10]*s+r[14]*l,e[3]=r[3]*a+r[7]*n+r[11]*s+r[15]*l,e},ed.transformQuat=function(e,i,r){var a=i[0],n=i[1],s=i[2],l=r[0],h=r[1],u=r[2],c=r[3],d=c*a+h*s-u*n,p=c*n+u*a-l*s,f=c*s+l*n-h*a,m=-l*a-h*n-u*s;return e[0]=d*c+-(m*l)+-(p*u)- -(f*h),e[1]=p*c+-(m*h)+-(f*l)- -(d*u),e[2]=f*c+-(m*u)+-(d*h)- -(p*l),e[3]=i[3],e},ed.zero=function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e},ed.str=function(e){return"vec4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"},ed.exactEquals=function(e,i){return e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]&&e[3]===i[3]},ed.equals=function(e,r){var a=e[0],n=e[1],s=e[2],l=e[3],h=r[0],u=r[1],c=r[2],d=r[3];return Math.abs(a-h)<=i.EPSILON*Math.max(1,Math.abs(a),Math.abs(h))&&Math.abs(n-u)<=i.EPSILON*Math.max(1,Math.abs(n),Math.abs(u))&&Math.abs(s-c)<=i.EPSILON*Math.max(1,Math.abs(s),Math.abs(c))&&Math.abs(l-d)<=i.EPSILON*Math.max(1,Math.abs(l),Math.abs(d))},ed.forEach=ed.sqrLen=ed.len=ed.sqrDist=ed.dist=ed.div=ed.mul=ed.sub=void 0;var i=function(i,a){if(i&&i.__esModule)return i;if(null===i||"object"!==e(i)&&"function"!=typeof i)return{default:i};var n=r(void 0);if(n&&n.has(i))return n.get(i);var s={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var h in i)if("default"!==h&&Object.prototype.hasOwnProperty.call(i,h)){var u=l?Object.getOwnPropertyDescriptor(i,h):null;u&&(u.get||u.set)?Object.defineProperty(s,h,u):s[h]=i[h]}return s.default=i,n&&n.set(i,s),s}(X());function r(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,a=new WeakMap;return(r=function(e){return e?a:i})(e)}function a(){var e=new i.ARRAY_TYPE(4);return i.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function n(e,i,r){return e[0]=i[0]-r[0],e[1]=i[1]-r[1],e[2]=i[2]-r[2],e[3]=i[3]-r[3],e}function s(e,i,r){return e[0]=i[0]*r[0],e[1]=i[1]*r[1],e[2]=i[2]*r[2],e[3]=i[3]*r[3],e}function l(e,i,r){return e[0]=i[0]/r[0],e[1]=i[1]/r[1],e[2]=i[2]/r[2],e[3]=i[3]/r[3],e}function h(e,i){return Math.hypot(i[0]-e[0],i[1]-e[1],i[2]-e[2],i[3]-e[3])}function u(e,i){var r=i[0]-e[0],a=i[1]-e[1],n=i[2]-e[2],s=i[3]-e[3];return r*r+a*a+n*n+s*s}function c(e){return Math.hypot(e[0],e[1],e[2],e[3])}function d(e){var i=e[0],r=e[1],a=e[2],n=e[3];return i*i+r*r+a*a+n*n}ed.sub=n,ed.mul=s,ed.div=l,ed.dist=h,ed.sqrDist=u,ed.len=c,ed.sqrLen=d;var p,f=(p=a(),function(e,i,r,a,n,s){var l,h;for(i||(i=4),r||(r=0),h=a?Math.min(a*i+r,e.length):e.length,l=r;l<h;l+=i)p[0]=e[l],p[1]=e[l+1],p[2]=e[l+2],p[3]=e[l+3],n(p,p,s),e[l]=p[0],e[l+1]=p[1],e[l+2]=p[2],e[l+3]=p[3];return e});return ed.forEach=f,ed}function ef(){if(ec)return es;function e(i){return(e="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})(i)}ec=1,Object.defineProperty(es,"__esModule",{value:!0}),es.create=h,es.identity=function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e},es.setAxisAngle=u,es.getAxisAngle=function(e,r){var a=2*Math.acos(r[3]),n=Math.sin(a/2);return n>i.EPSILON?(e[0]=r[0]/n,e[1]=r[1]/n,e[2]=r[2]/n):(e[0]=1,e[1]=0,e[2]=0),a},es.getAngle=function(e,i){var r=g(e,i);return Math.acos(2*r*r-1)},es.multiply=c,es.rotateX=function(e,i,r){r*=.5;var a=i[0],n=i[1],s=i[2],l=i[3],h=Math.sin(r),u=Math.cos(r);return e[0]=a*u+l*h,e[1]=n*u+s*h,e[2]=s*u-n*h,e[3]=l*u-a*h,e},es.rotateY=function(e,i,r){r*=.5;var a=i[0],n=i[1],s=i[2],l=i[3],h=Math.sin(r),u=Math.cos(r);return e[0]=a*u-s*h,e[1]=n*u+l*h,e[2]=s*u+a*h,e[3]=l*u-n*h,e},es.rotateZ=function(e,i,r){r*=.5;var a=i[0],n=i[1],s=i[2],l=i[3],h=Math.sin(r),u=Math.cos(r);return e[0]=a*u+n*h,e[1]=n*u-a*h,e[2]=s*u+l*h,e[3]=l*u-s*h,e},es.calculateW=function(e,i){var r=i[0],a=i[1],n=i[2];
206return e[0]=r,e[1]=a,e[2]=n,e[3]=Math.sqrt(Math.abs(1-r*r-a*a-n*n)),e},es.exp=d,es.ln=p,es.pow=function(e,i,r){return p(e,i),_(e,e,r),d(e,e),e},es.slerp=f,es.random=function(e){var r=i.RANDOM(),a=i.RANDOM(),n=i.RANDOM(),s=Math.sqrt(1-r),l=Math.sqrt(r);return e[0]=s*Math.sin(2*Math.PI*a),e[1]=s*Math.cos(2*Math.PI*a),e[2]=l*Math.sin(2*Math.PI*n),e[3]=l*Math.cos(2*Math.PI*n),e},es.invert=function(e,i){var r=i[0],a=i[1],n=i[2],s=i[3],l=r*r+a*a+n*n+s*s,h=l?1/l:0;return e[0]=-r*h,e[1]=-a*h,e[2]=-n*h,e[3]=s*h,e},es.conjugate=function(e,i){return e[0]=-i[0],e[1]=-i[1],e[2]=-i[2],e[3]=i[3],e},es.fromMat3=m,es.fromEuler=function(e,i,r,a){var n=.5*Math.PI/180;i*=n,r*=n,a*=n;var s=Math.sin(i),l=Math.cos(i),h=Math.sin(r),u=Math.cos(r),c=Math.sin(a),d=Math.cos(a);return e[0]=s*u*d-l*h*c,e[1]=l*h*d+s*u*c,e[2]=l*u*c-s*h*d,e[3]=l*u*d+s*h*c,e},es.str=function(e){return"quat("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"},es.setAxes=es.sqlerp=es.rotationTo=es.equals=es.exactEquals=es.normalize=es.sqrLen=es.squaredLength=es.len=es.length=es.lerp=es.dot=es.scale=es.mul=es.add=es.set=es.copy=es.fromValues=es.clone=void 0;var i=l(X()),r=l(ei()),a=l(eh()),n=l(ep());function s(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,r=new WeakMap;return(s=function(e){return e?r:i})(e)}function l(i,r){if(i&&i.__esModule)return i;if(null===i||"object"!==e(i)&&"function"!=typeof i)return{default:i};var a=s(r);if(a&&a.has(i))return a.get(i);var n={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var h in i)if("default"!==h&&Object.prototype.hasOwnProperty.call(i,h)){var u=l?Object.getOwnPropertyDescriptor(i,h):null;u&&(u.get||u.set)?Object.defineProperty(n,h,u):n[h]=i[h]}return n.default=i,a&&a.set(i,n),n}function h(){var e=new i.ARRAY_TYPE(4);return i.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function u(e,i,r){var a=Math.sin(r*=.5);return e[0]=a*i[0],e[1]=a*i[1],e[2]=a*i[2],e[3]=Math.cos(r),e}function c(e,i,r){var a=i[0],n=i[1],s=i[2],l=i[3],h=r[0],u=r[1],c=r[2],d=r[3];return e[0]=a*d+l*h+n*c-s*u,e[1]=n*d+l*u+s*h-a*c,e[2]=s*d+l*c+a*u-n*h,e[3]=l*d-a*h-n*u-s*c,e}function d(e,i){var r=i[0],a=i[1],n=i[2],s=i[3],l=Math.sqrt(r*r+a*a+n*n),h=Math.exp(s),u=l>0?h*Math.sin(l)/l:0;return e[0]=r*u,e[1]=a*u,e[2]=n*u,e[3]=h*Math.cos(l),e}function p(e,i){var r=i[0],a=i[1],n=i[2],s=i[3],l=Math.sqrt(r*r+a*a+n*n),h=l>0?Math.atan2(l,s)/l:0;return e[0]=r*h,e[1]=a*h,e[2]=n*h,e[3]=.5*Math.log(r*r+a*a+n*n+s*s),e}function f(e,r,a,n){var s,l,h,u,c,d=r[0],p=r[1],f=r[2],m=r[3],_=a[0],g=a[1],y=a[2],x=a[3];return(l=d*_+p*g+f*y+m*x)<0&&(l=-l,_=-_,g=-g,y=-y,x=-x),1-l>i.EPSILON?(h=Math.sin(s=Math.acos(l)),u=Math.sin((1-n)*s)/h,c=Math.sin(n*s)/h):(u=1-n,c=n),e[0]=u*d+c*_,e[1]=u*p+c*g,e[2]=u*f+c*y,e[3]=u*m+c*x,e}function m(e,i){var r,a=i[0]+i[4]+i[8];if(a>0)r=Math.sqrt(a+1),e[3]=.5*r,e[0]=(i[5]-i[7])*(r=.5/r),e[1]=(i[6]-i[2])*r,e[2]=(i[1]-i[3])*r;else{var n=0;i[4]>i[0]&&(n=1),i[8]>i[3*n+n]&&(n=2);var s=(n+1)%3,l=(n+2)%3;r=Math.sqrt(i[3*n+n]-i[3*s+s]-i[3*l+l]+1),e[n]=.5*r,e[3]=(i[3*s+l]-i[3*l+s])*(r=.5/r),e[s]=(i[3*s+n]+i[3*n+s])*r,e[l]=(i[3*l+n]+i[3*n+l])*r}return e}es.clone=n.clone,es.fromValues=n.fromValues,es.copy=n.copy,es.set=n.set,es.add=n.add,es.mul=c;var _=n.scale;es.scale=_;var g=n.dot;es.dot=g,es.lerp=n.lerp;var y=n.length;es.length=y,es.len=y;var x=n.squaredLength;es.squaredLength=x,es.sqrLen=x;var v=n.normalize;es.normalize=v,es.exactEquals=n.exactEquals,es.equals=n.equals;var b,w,T,S=(b=a.create(),w=a.fromValues(1,0,0),T=a.fromValues(0,1,0),function(e,i,r){var n=a.dot(i,r);return n<-.999999?(a.cross(b,w,i),1e-6>a.len(b)&&a.cross(b,T,i),a.normalize(b,b),u(e,b,Math.PI),e):n>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(a.cross(b,i,r),e[0]=b[0],e[1]=b[1],e[2]=b[2],e[3]=1+n,v(e,e))});es.rotationTo=S;var M,E,A=(M=h(),E=h(),function(e,i,r,a,n,s){return f(M,i,n,s),f(E,r,a,s),f(e,M,E,2*s*(1-s)),e});es.sqlerp=A;var I,C=(I=r.create(),function(e,i,r,a){return I[0]=r[0],I[3]=r[1],I[6]=r[2],I[1]=a[0],I[4]=a[1],I[7]=a[2],I[2]=-i[0],I[5]=-i[1],I[8]=-i[2],v(e,m(e,I))});return es.setAxes=C,es}var em,e_,eg,ey,ex,ev,eb,ew={},eT={},eS=function(){if(eg)return H;function e(i){return(e="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})(i)}eg=1,Object.defineProperty(H,"__esModule",{value:!0}),H.vec4=H.vec3=H.vec2=H.quat2=H.quat=H.mat4=H.mat3=H.mat2d=H.mat2=H.glMatrix=void 0;var i=f(X());H.glMatrix=i;var r=f(function(){if(Y)return Q;function e(i){return(e="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})(i)}Y=1,Object.defineProperty(Q,"__esModule",{value:!0}),Q.create=function(){var e=new i.ARRAY_TYPE(4);return i.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e},Q.clone=function(e){var r=new i.ARRAY_TYPE(4);return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r},Q.copy=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e},Q.identity=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e},Q.fromValues=function(e,r,a,n){var s=new i.ARRAY_TYPE(4);return s[0]=e,s[1]=r,s[2]=a,s[3]=n,s},Q.set=function(e,i,r,a,n){return e[0]=i,e[1]=r,e[2]=a,e[3]=n,e},Q.transpose=function(e,i){if(e===i){var r=i[1];e[1]=i[2],e[2]=r}else e[0]=i[0],e[1]=i[2],e[2]=i[1],e[3]=i[3];return e},Q.invert=function(e,i){var r=i[0],a=i[1],n=i[2],s=i[3],l=r*s-n*a;return l?(e[0]=s*(l=1/l),e[1]=-a*l,e[2]=-n*l,e[3]=r*l,e):null},Q.adjoint=function(e,i){var r=i[0];return e[0]=i[3],e[1]=-i[1],e[2]=-i[2],e[3]=r,e},Q.determinant=function(e){return e[0]*e[3]-e[2]*e[1]},Q.multiply=a,Q.rotate=function(e,i,r){var a=i[0],n=i[1],s=i[2],l=i[3],h=Math.sin(r),u=Math.cos(r);return e[0]=a*u+s*h,e[1]=n*u+l*h,e[2]=-(a*h)+s*u,e[3]=-(n*h)+l*u,e},Q.scale=function(e,i,r){var a=i[1],n=i[2],s=i[3],l=r[0],h=r[1];return e[0]=i[0]*l,e[1]=a*l,e[2]=n*h,e[3]=s*h,e},Q.fromRotation=function(e,i){var r=Math.sin(i),a=Math.cos(i);return e[0]=a,e[1]=r,e[2]=-r,e[3]=a,e},Q.fromScaling=function(e,i){return e[0]=i[0],e[1]=0,e[2]=0,e[3]=i[1],e},Q.str=function(e){return"mat2("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"},Q.frob=function(e){return Math.hypot(e[0],e[1],e[2],e[3])},Q.LDU=function(e,i,r,a){return e[2]=a[2]/a[0],r[0]=a[0],r[1]=a[1],r[3]=a[3]-e[2]*r[1],[e,i,r]},Q.add=function(e,i,r){return e[0]=i[0]+r[0],e[1]=i[1]+r[1],e[2]=i[2]+r[2],e[3]=i[3]+r[3],e},Q.subtract=n,Q.exactEquals=function(e,i){return e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]&&e[3]===i[3]},Q.equals=function(e,r){var a=e[0],n=e[1],s=e[2],l=e[3],h=r[0],u=r[1],c=r[2],d=r[3];return Math.abs(a-h)<=i.EPSILON*Math.max(1,Math.abs(a),Math.abs(h))&&Math.abs(n-u)<=i.EPSILON*Math.max(1,Math.abs(n),Math.abs(u))&&Math.abs(s-c)<=i.EPSILON*Math.max(1,Math.abs(s),Math.abs(c))&&Math.abs(l-d)<=i.EPSILON*Math.max(1,Math.abs(l),Math.abs(d))},Q.multiplyScalar=function(e,i,r){return e[0]=i[0]*r,e[1]=i[1]*r,e[2]=i[2]*r,e[3]=i[3]*r,e},Q.multiplyScalarAndAdd=function(e,i,r,a){return e[0]=i[0]+r[0]*a,e[1]=i[1]+r[1]*a,e[2]=i[2]+r[2]*a,e[3]=i[3]+r[3]*a,e},Q.sub=Q.mul=void 0;var i=function(i,a){if(i&&i.__esModule)return i;if(null===i||"object"!==e(i)&&"function"!=typeof i)return{default:i};var n=r(void 0);if(n&&n.has(i))return n.get(i);var s={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var h in i)if("default"!==h&&Object.prototype.hasOwnProperty.call(i,h)){var u=l?Object.getOwnPropertyDescriptor(i,h):null;u&&(u.get||u.set)?Object.defineProperty(s,h,u):s[h]=i[h]}return s.default=i,n&&n.set(i,s),s}(X());function r(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,a=new WeakMap;return(r=function(e){return e?a:i})(e)}function a(e,i,r){var a=i[0],n=i[1],s=i[2],l=i[3],h=r[0],u=r[1],c=r[2],d=r[3];return e[0]=a*h+s*u,e[1]=n*h+l*u,e[2]=a*c+s*d,e[3]=n*c+l*d,e}function n(e,i,r){return e[0]=i[0]-r[0],e[1]=i[1]-r[1],e[2]=i[2]-r[2],e[3]=i[3]-r[3],e}return Q.mul=a,Q.sub=n,Q}());H.mat2=r;var a=f(function(){if(J)return ee;function e(i){return(e="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})(i)}
206J=1,Object.defineProperty(ee,"__esModule",{value:!0}),ee.create=function(){var e=new i.ARRAY_TYPE(6);return i.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0,e[4]=0,e[5]=0),e[0]=1,e[3]=1,e},ee.clone=function(e){var r=new i.ARRAY_TYPE(6);return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r},ee.copy=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e},ee.identity=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e},ee.fromValues=function(e,r,a,n,s,l){var h=new i.ARRAY_TYPE(6);return h[0]=e,h[1]=r,h[2]=a,h[3]=n,h[4]=s,h[5]=l,h},ee.set=function(e,i,r,a,n,s,l){return e[0]=i,e[1]=r,e[2]=a,e[3]=n,e[4]=s,e[5]=l,e},ee.invert=function(e,i){var r=i[0],a=i[1],n=i[2],s=i[3],l=i[4],h=i[5],u=r*s-a*n;return u?(e[0]=s*(u=1/u),e[1]=-a*u,e[2]=-n*u,e[3]=r*u,e[4]=(n*h-s*l)*u,e[5]=(a*l-r*h)*u,e):null},ee.determinant=function(e){return e[0]*e[3]-e[1]*e[2]},ee.multiply=a,ee.rotate=function(e,i,r){var a=i[0],n=i[1],s=i[2],l=i[3],h=i[4],u=i[5],c=Math.sin(r),d=Math.cos(r);return e[0]=a*d+s*c,e[1]=n*d+l*c,e[2]=-(a*c)+s*d,e[3]=-(n*c)+l*d,e[4]=h,e[5]=u,e},ee.scale=function(e,i,r){var a=i[1],n=i[2],s=i[3],l=i[4],h=i[5],u=r[0],c=r[1];return e[0]=i[0]*u,e[1]=a*u,e[2]=n*c,e[3]=s*c,e[4]=l,e[5]=h,e},ee.translate=function(e,i,r){var a=i[0],n=i[1],s=i[2],l=i[3],h=i[4],u=i[5],c=r[0],d=r[1];return e[0]=a,e[1]=n,e[2]=s,e[3]=l,e[4]=a*c+s*d+h,e[5]=n*c+l*d+u,e},ee.fromRotation=function(e,i){var r=Math.sin(i),a=Math.cos(i);return e[0]=a,e[1]=r,e[2]=-r,e[3]=a,e[4]=0,e[5]=0,e},ee.fromScaling=function(e,i){return e[0]=i[0],e[1]=0,e[2]=0,e[3]=i[1],e[4]=0,e[5]=0,e},ee.fromTranslation=function(e,i){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=i[0],e[5]=i[1],e},ee.str=function(e){return"mat2d("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+")"},ee.frob=function(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],1)},ee.add=function(e,i,r){return e[0]=i[0]+r[0],e[1]=i[1]+r[1],e[2]=i[2]+r[2],e[3]=i[3]+r[3],e[4]=i[4]+r[4],e[5]=i[5]+r[5],e},ee.subtract=n,ee.multiplyScalar=function(e,i,r){return e[0]=i[0]*r,e[1]=i[1]*r,e[2]=i[2]*r,e[3]=i[3]*r,e[4]=i[4]*r,e[5]=i[5]*r,e},ee.multiplyScalarAndAdd=function(e,i,r,a){return e[0]=i[0]+r[0]*a,e[1]=i[1]+r[1]*a,e[2]=i[2]+r[2]*a,e[3]=i[3]+r[3]*a,e[4]=i[4]+r[4]*a,e[5]=i[5]+r[5]*a,e},ee.exactEquals=function(e,i){return e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]&&e[3]===i[3]&&e[4]===i[4]&&e[5]===i[5]},ee.equals=function(e,r){var a=e[0],n=e[1],s=e[2],l=e[3],h=e[4],u=e[5],c=r[0],d=r[1],p=r[2],f=r[3],m=r[4],_=r[5];return Math.abs(a-c)<=i.EPSILON*Math.max(1,Math.abs(a),Math.abs(c))&&Math.abs(n-d)<=i.EPSILON*Math.max(1,Math.abs(n),Math.abs(d))&&Math.abs(s-p)<=i.EPSILON*Math.max(1,Math.abs(s),Math.abs(p))&&Math.abs(l-f)<=i.EPSILON*Math.max(1,Math.abs(l),Math.abs(f))&&Math.abs(h-m)<=i.EPSILON*Math.max(1,Math.abs(h),Math.abs(m))&&Math.abs(u-_)<=i.EPSILON*Math.max(1,Math.abs(u),Math.abs(_))},ee.sub=ee.mul=void 0;var i=function(i,a){if(i&&i.__esModule)return i;if(null===i||"object"!==e(i)&&"function"!=typeof i)return{default:i};var n=r(void 0);if(n&&n.has(i))return n.get(i);var s={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var h in i)if("default"!==h&&Object.prototype.hasOwnProperty.call(i,h)){var u=l?Object.getOwnPropertyDescriptor(i,h):null;u&&(u.get||u.set)?Object.defineProperty(s,h,u):s[h]=i[h]}return s.default=i,n&&n.set(i,s),s}(X());function r(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,a=new WeakMap;return(r=function(e){return e?a:i})(e)}function a(e,i,r){var a=i[0],n=i[1],s=i[2],l=i[3],h=i[4],u=i[5],c=r[0],d=r[1],p=r[2],f=r[3],m=r[4],_=r[5];return e[0]=a*c+s*d,e[1]=n*c+l*d,e[2]=a*p+s*f,e[3]=n*p+l*f,e[4]=a*m+s*_+h,e[5]=n*m+l*_+u,e}function n(e,i,r){return e[0]=i[0]-r[0],e[1]=i[1]-r[1],e[2]=i[2]-r[2],e[3]=i[3]-r[3],e[4]=i[4]-r[4],e[5]=i[5]-r[5],e}return ee.mul=a,ee.sub=n,ee}());H.mat2d=a;var n=f(ei());H.mat3=n;var s=f(en());H.mat4=s;var l=f(ef());H.quat=l;var h=f(function(){if(em)return ew;function e(i){return(e="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})(i)}em=1,Object.defineProperty(ew,"__esModule",{value:!0}),ew.create=function(){var e=new i.ARRAY_TYPE(8);return i.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[4]=0,e[5]=0,e[6]=0,e[7]=0),e[3]=1,e},ew.clone=function(e){var r=new i.ARRAY_TYPE(8);return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r},ew.fromValues=function(e,r,a,n,s,l,h,u){var c=new i.ARRAY_TYPE(8);return c[0]=e,c[1]=r,c[2]=a,c[3]=n,c[4]=s,c[5]=l,c[6]=h,c[7]=u,c},ew.fromRotationTranslationValues=function(e,r,a,n,s,l,h){var u=new i.ARRAY_TYPE(8);u[0]=e,u[1]=r,u[2]=a,u[3]=n;var c=.5*s,d=.5*l,p=.5*h;return u[4]=c*n+d*a-p*r,u[5]=d*n+p*e-c*a,u[6]=p*n+c*r-d*e,u[7]=-c*e-d*r-p*a,u},ew.fromRotationTranslation=l,ew.fromTranslation=function(e,i){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=.5*i[0],e[5]=.5*i[1],e[6]=.5*i[2],e[7]=0,e},ew.fromRotation=function(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=0,e[5]=0,e[6]=0,e[7]=0,e},ew.fromMat4=function(e,n){var s=r.create();a.getRotation(s,n);var h=new i.ARRAY_TYPE(3);return a.getTranslation(h,n),l(e,s,h),e},ew.copy=h,ew.identity=function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e[6]=0,e[7]=0,e},ew.set=function(e,i,r,a,n,s,l,h,u){return e[0]=i,e[1]=r,e[2]=a,e[3]=n,e[4]=s,e[5]=l,e[6]=h,e[7]=u,e},ew.getDual=function(e,i){return e[0]=i[4],e[1]=i[5],e[2]=i[6],e[3]=i[7],e},ew.setDual=function(e,i){return e[4]=i[0],e[5]=i[1],e[6]=i[2],e[7]=i[3],e},ew.getTranslation=function(e,i){var r=i[4],a=i[5],n=i[6],s=i[7],l=-i[0],h=-i[1],u=-i[2],c=i[3];return e[0]=2*(r*c+s*l+a*u-n*h),e[1]=2*(a*c+s*h+n*l-r*u),e[2]=2*(n*c+s*u+r*h-a*l),e},ew.translate=function(e,i,r){var a=i[0],n=i[1],s=i[2],l=i[3],h=.5*r[0],u=.5*r[1],c=.5*r[2],d=i[4],p=i[5],f=i[6],m=i[7];return e[0]=a,e[1]=n,e[2]=s,e[3]=l,e[4]=l*h+n*c-s*u+d,e[5]=l*u+s*h-a*c+p,e[6]=l*c+a*u-n*h+f,e[7]=-a*h-n*u-s*c+m,e},ew.rotateX=function(e,i,a){var n=-i[0],s=-i[1],l=-i[2],h=i[3],u=i[4],c=i[5],d=i[6],p=i[7],f=u*h+p*n+c*l-d*s,m=c*h+p*s+d*n-u*l,_=d*h+p*l+u*s-c*n,g=p*h-u*n-c*s-d*l;return r.rotateX(e,i,a),e[4]=f*(h=e[3])+g*(n=e[0])+m*(l=e[2])-_*(s=e[1]),e[5]=m*h+g*s+_*n-f*l,e[6]=_*h+g*l+f*s-m*n,e[7]=g*h-f*n-m*s-_*l,e},ew.rotateY=function(e,i,a){var n=-i[0],s=-i[1],l=-i[2],h=i[3],u=i[4],c=i[5],d=i[6],p=i[7],f=u*h+p*n+c*l-d*s,m=c*h+p*s+d*n-u*l,_=d*h+p*l+u*s-c*n,g=p*h-u*n-c*s-d*l;return r.rotateY(e,i,a),e[4]=f*(h=e[3])+g*(n=e[0])+m*(l=e[2])-_*(s=e[1]),e[5]=m*h+g*s+_*n-f*l,e[6]=_*h+g*l+f*s-m*n,e[7]=g*h-f*n-m*s-_*l,e},ew.rotateZ=function(e,i,a){var n=-i[0],s=-i[1],l=-i[2],h=i[3],u=i[4],c=i[5],d=i[6],p=i[7],f=u*h+p*n+c*l-d*s,m=c*h+p*s+d*n-u*l,_=d*h+p*l+u*s-c*n,g=p*h-u*n-c*s-d*l;return r.rotateZ(e,i,a),e[4]=f*(h=e[3])+g*(n=e[0])+m*(l=e[2])-_*(s=e[1]),e[5]=m*h+g*s+_*n-f*l,e[6]=_*h+g*l+f*s-m*n,e[7]=g*h-f*n-m*s-_*l,e},ew.rotateByQuatAppend=function(e,i,r){var a=r[0],n=r[1],s=r[2],l=r[3],h=i[0],u=i[1],c=i[2],d=i[3];return e[0]=h*l+d*a+u*s-c*n,e[1]=u*l+d*n+c*a-h*s,e[2]=c*l+d*s+h*n-u*a,e[3]=d*l-h*a-u*n-c*s,e[4]=(h=i[4])*l+(d=i[7])*a+(u=i[5])*s-(c=i[6])*n,e[5]=u*l+d*n+c*a-h*s,e[6]=c*l+d*s+h*n-u*a,e[7]=d*l-h*a-u*n-c*s,e},ew.rotateByQuatPrepend=function(e,i,r){var a=i[0],n=i[1],s=i[2],l=i[3],h=r[0],u=r[1],c=r[2],d=r[3];return e[0]=a*d+l*h+n*c-s*u,e[1]=n*d+l*u+s*h-a*c,e[2]=s*d+l*c+a*u-n*h,e[3]=l*d-a*h-n*u-s*c,e[4]=a*(d=r[7])+l*(h=r[4])+n*(c=r[6])-s*(u=r[5]),e[5]=n*d+l*u+s*h-a*c,e[6]=s*d+l*c+a*u-n*h,e[7]=l*d-a*h-n*u-s*c,e}
206,ew.rotateAroundAxis=function(e,r,a,n){if(Math.abs(n)<i.EPSILON)return h(e,r);var s=Math.hypot(a[0],a[1],a[2]),l=Math.sin(n*=.5),u=l*a[0]/s,c=l*a[1]/s,d=l*a[2]/s,p=Math.cos(n),f=r[0],m=r[1],_=r[2],g=r[3];e[0]=f*p+g*u+m*d-_*c,e[1]=m*p+g*c+_*u-f*d,e[2]=_*p+g*d+f*c-m*u,e[3]=g*p-f*u-m*c-_*d;var y=r[4],x=r[5],v=r[6],b=r[7];return e[4]=y*p+b*u+x*d-v*c,e[5]=x*p+b*c+v*u-y*d,e[6]=v*p+b*d+y*c-x*u,e[7]=b*p-y*u-x*c-v*d,e},ew.add=function(e,i,r){return e[0]=i[0]+r[0],e[1]=i[1]+r[1],e[2]=i[2]+r[2],e[3]=i[3]+r[3],e[4]=i[4]+r[4],e[5]=i[5]+r[5],e[6]=i[6]+r[6],e[7]=i[7]+r[7],e},ew.multiply=u,ew.scale=function(e,i,r){return e[0]=i[0]*r,e[1]=i[1]*r,e[2]=i[2]*r,e[3]=i[3]*r,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=i[7]*r,e},ew.lerp=function(e,i,r,a){var n=1-a;return 0>c(i,r)&&(a=-a),e[0]=i[0]*n+r[0]*a,e[1]=i[1]*n+r[1]*a,e[2]=i[2]*n+r[2]*a,e[3]=i[3]*n+r[3]*a,e[4]=i[4]*n+r[4]*a,e[5]=i[5]*n+r[5]*a,e[6]=i[6]*n+r[6]*a,e[7]=i[7]*n+r[7]*a,e},ew.invert=function(e,i){var r=p(i);return e[0]=-i[0]/r,e[1]=-i[1]/r,e[2]=-i[2]/r,e[3]=i[3]/r,e[4]=-i[4]/r,e[5]=-i[5]/r,e[6]=-i[6]/r,e[7]=i[7]/r,e},ew.conjugate=function(e,i){return e[0]=-i[0],e[1]=-i[1],e[2]=-i[2],e[3]=i[3],e[4]=-i[4],e[5]=-i[5],e[6]=-i[6],e[7]=i[7],e},ew.normalize=function(e,i){var r=p(i);if(r>0){r=Math.sqrt(r);var a=i[0]/r,n=i[1]/r,s=i[2]/r,l=i[3]/r,h=i[4],u=i[5],c=i[6],d=i[7],f=a*h+n*u+s*c+l*d;e[0]=a,e[1]=n,e[2]=s,e[3]=l,e[4]=(h-a*f)/r,e[5]=(u-n*f)/r,e[6]=(c-s*f)/r,e[7]=(d-l*f)/r}return e},ew.str=function(e){return"quat2("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+")"},ew.exactEquals=function(e,i){return e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]&&e[3]===i[3]&&e[4]===i[4]&&e[5]===i[5]&&e[6]===i[6]&&e[7]===i[7]},ew.equals=function(e,r){var a=e[0],n=e[1],s=e[2],l=e[3],h=e[4],u=e[5],c=e[6],d=e[7],p=r[0],f=r[1],m=r[2],_=r[3],g=r[4],y=r[5],x=r[6],v=r[7];return Math.abs(a-p)<=i.EPSILON*Math.max(1,Math.abs(a),Math.abs(p))&&Math.abs(n-f)<=i.EPSILON*Math.max(1,Math.abs(n),Math.abs(f))&&Math.abs(s-m)<=i.EPSILON*Math.max(1,Math.abs(s),Math.abs(m))&&Math.abs(l-_)<=i.EPSILON*Math.max(1,Math.abs(l),Math.abs(_))&&Math.abs(h-g)<=i.EPSILON*Math.max(1,Math.abs(h),Math.abs(g))&&Math.abs(u-y)<=i.EPSILON*Math.max(1,Math.abs(u),Math.abs(y))&&Math.abs(c-x)<=i.EPSILON*Math.max(1,Math.abs(c),Math.abs(x))&&Math.abs(d-v)<=i.EPSILON*Math.max(1,Math.abs(d),Math.abs(v))},ew.sqrLen=ew.squaredLength=ew.len=ew.length=ew.dot=ew.mul=ew.setReal=ew.getReal=void 0;var i=s(X()),r=s(ef()),a=s(en());function n(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,r=new WeakMap;return(n=function(e){return e?r:i})(e)}function s(i,r){if(i&&i.__esModule)return i;if(null===i||"object"!==e(i)&&"function"!=typeof i)return{default:i};var a=n(r);if(a&&a.has(i))return a.get(i);var s={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var h in i)if("default"!==h&&Object.prototype.hasOwnProperty.call(i,h)){var u=l?Object.getOwnPropertyDescriptor(i,h):null;u&&(u.get||u.set)?Object.defineProperty(s,h,u):s[h]=i[h]}return s.default=i,a&&a.set(i,s),s}function l(e,i,r){var a=.5*r[0],n=.5*r[1],s=.5*r[2],l=i[0],h=i[1],u=i[2],c=i[3];return e[0]=l,e[1]=h,e[2]=u,e[3]=c,e[4]=a*c+n*u-s*h,e[5]=n*c+s*l-a*u,e[6]=s*c+a*h-n*l,e[7]=-a*l-n*h-s*u,e}function h(e,i){return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e}function u(e,i,r){var a=i[0],n=i[1],s=i[2],l=i[3],h=r[4],u=r[5],c=r[6],d=r[7],p=i[4],f=i[5],m=i[6],_=i[7],g=r[0],y=r[1],x=r[2],v=r[3];return e[0]=a*v+l*g+n*x-s*y,e[1]=n*v+l*y+s*g-a*x,e[2]=s*v+l*x+a*y-n*g,e[3]=l*v-a*g-n*y-s*x,e[4]=a*d+l*h+n*c-s*u+p*v+_*g+f*x-m*y,e[5]=n*d+l*u+s*h-a*c+f*v+_*y+m*g-p*x,e[6]=s*d+l*c+a*u-n*h+m*v+_*x+p*y-f*g,e[7]=l*d-a*h-n*u-s*c+_*v-p*g-f*y-m*x,e}ew.getReal=r.copy,ew.setReal=r.copy,ew.mul=u;var c=r.dot;ew.dot=c;var d=r.length;ew.length=d,ew.len=d;var p=r.squaredLength;return ew.squaredLength=p,ew.sqrLen=p,ew}());H.quat2=h;var u=f(function(){if(e_)return eT;function e(i){return(e="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})(i)}
206e_=1,Object.defineProperty(eT,"__esModule",{value:!0}),eT.create=a,eT.clone=function(e){var r=new i.ARRAY_TYPE(2);return r[0]=e[0],r[1]=e[1],r},eT.fromValues=function(e,r){var a=new i.ARRAY_TYPE(2);return a[0]=e,a[1]=r,a},eT.copy=function(e,i){return e[0]=i[0],e[1]=i[1],e},eT.set=function(e,i,r){return e[0]=i,e[1]=r,e},eT.add=function(e,i,r){return e[0]=i[0]+r[0],e[1]=i[1]+r[1],e},eT.subtract=n,eT.multiply=s,eT.divide=l,eT.ceil=function(e,i){return e[0]=Math.ceil(i[0]),e[1]=Math.ceil(i[1]),e},eT.floor=function(e,i){return e[0]=Math.floor(i[0]),e[1]=Math.floor(i[1]),e},eT.min=function(e,i,r){return e[0]=Math.min(i[0],r[0]),e[1]=Math.min(i[1],r[1]),e},eT.max=function(e,i,r){return e[0]=Math.max(i[0],r[0]),e[1]=Math.max(i[1],r[1]),e},eT.round=function(e,i){return e[0]=Math.round(i[0]),e[1]=Math.round(i[1]),e},eT.scale=function(e,i,r){return e[0]=i[0]*r,e[1]=i[1]*r,e},eT.scaleAndAdd=function(e,i,r,a){return e[0]=i[0]+r[0]*a,e[1]=i[1]+r[1]*a,e},eT.distance=h,eT.squaredDistance=u,eT.length=c,eT.squaredLength=d,eT.negate=function(e,i){return e[0]=-i[0],e[1]=-i[1],e},eT.inverse=function(e,i){return e[0]=1/i[0],e[1]=1/i[1],e},eT.normalize=function(e,i){var r=i[0],a=i[1],n=r*r+a*a;return n>0&&(n=1/Math.sqrt(n)),e[0]=i[0]*n,e[1]=i[1]*n,e},eT.dot=function(e,i){return e[0]*i[0]+e[1]*i[1]},eT.cross=function(e,i,r){var a=i[0]*r[1]-i[1]*r[0];return e[0]=e[1]=0,e[2]=a,e},eT.lerp=function(e,i,r,a){var n=i[0],s=i[1];return e[0]=n+a*(r[0]-n),e[1]=s+a*(r[1]-s),e},eT.random=function(e,r){r=r||1;var a=2*i.RANDOM()*Math.PI;return e[0]=Math.cos(a)*r,e[1]=Math.sin(a)*r,e},eT.transformMat2=function(e,i,r){var a=i[0],n=i[1];return e[0]=r[0]*a+r[2]*n,e[1]=r[1]*a+r[3]*n,e},eT.transformMat2d=function(e,i,r){var a=i[0],n=i[1];return e[0]=r[0]*a+r[2]*n+r[4],e[1]=r[1]*a+r[3]*n+r[5],e},eT.transformMat3=function(e,i,r){var a=i[0],n=i[1];return e[0]=r[0]*a+r[3]*n+r[6],e[1]=r[1]*a+r[4]*n+r[7],e},eT.transformMat4=function(e,i,r){var a=i[0],n=i[1];return e[0]=r[0]*a+r[4]*n+r[12],e[1]=r[1]*a+r[5]*n+r[13],e},eT.rotate=function(e,i,r,a){var n=i[0]-r[0],s=i[1]-r[1],l=Math.sin(a),h=Math.cos(a);return e[0]=n*h-s*l+r[0],e[1]=n*l+s*h+r[1],e},eT.angle=function(e,i){var r=e[0],a=e[1],n=i[0],s=i[1],l=Math.sqrt(r*r+a*a)*Math.sqrt(n*n+s*s);return Math.acos(Math.min(Math.max(l&&(r*n+a*s)/l,-1),1))},eT.zero=function(e){return e[0]=0,e[1]=0,e},eT.str=function(e){return"vec2("+e[0]+", "+e[1]+")"},eT.exactEquals=function(e,i){return e[0]===i[0]&&e[1]===i[1]},eT.equals=function(e,r){var a=e[0],n=e[1],s=r[0],l=r[1];return Math.abs(a-s)<=i.EPSILON*Math.max(1,Math.abs(a),Math.abs(s))&&Math.abs(n-l)<=i.EPSILON*Math.max(1,Math.abs(n),Math.abs(l))},eT.forEach=eT.sqrLen=eT.sqrDist=eT.dist=eT.div=eT.mul=eT.sub=eT.len=void 0;var i=function(i,a){if(i&&i.__esModule)return i;if(null===i||"object"!==e(i)&&"function"!=typeof i)return{default:i};var n=r(void 0);if(n&&n.has(i))return n.get(i);var s={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var h in i)if("default"!==h&&Object.prototype.hasOwnProperty.call(i,h)){var u=l?Object.getOwnPropertyDescriptor(i,h):null;u&&(u.get||u.set)?Object.defineProperty(s,h,u):s[h]=i[h]}return s.default=i,n&&n.set(i,s),s}(X());function r(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,a=new WeakMap;return(r=function(e){return e?a:i})(e)}function a(){var e=new i.ARRAY_TYPE(2);return i.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0),e}function n(e,i,r){return e[0]=i[0]-r[0],e[1]=i[1]-r[1],e}function s(e,i,r){return e[0]=i[0]*r[0],e[1]=i[1]*r[1],e}function l(e,i,r){return e[0]=i[0]/r[0],e[1]=i[1]/r[1],e}function h(e,i){return Math.hypot(i[0]-e[0],i[1]-e[1])}function u(e,i){var r=i[0]-e[0],a=i[1]-e[1];return r*r+a*a}function c(e){return Math.hypot(e[0],e[1])}function d(e){var i=e[0],r=e[1];return i*i+r*r}eT.len=c,eT.sub=n,eT.mul=s,eT.div=l,eT.dist=h,eT.sqrDist=u,eT.sqrLen=d;var p,f=(p=a(),function(e,i,r,a,n,s){var l,h;for(i||(i=2),r||(r=0),h=a?Math.min(a*i+r,e.length):e.length,l=r;l<h;l+=i)p[0]=e[l],p[1]=e[l+1],n(p,p,s),e[l]=p[0],e[l+1]=p[1];return e});return eT.forEach=f,eT}());H.vec2=u;var c=f(eh());H.vec3=c;var d=f(ep());function p(e){if("function"!=typeof WeakMap)return null;var i=new WeakMap,r=new WeakMap;return(p=function(e){return e?r:i})(e)}function f(i,r){if(i&&i.__esModule)return i;if(null===i||"object"!==e(i)&&"function"!=typeof i)return{default:i};var a=p(r);if(a&&a.has(i))return a.get(i);var n={},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in i)if("default"!==l&&Object.prototype.hasOwnProperty.call(i,l)){var h=s?Object.getOwnPropertyDescriptor(i,l):null;h&&(h.get||h.set)?Object.defineProperty(n,l,h):n[l]=i[l]}return n.default=i,a&&a.set(i,n),n}return H.vec4=d,H}(),eM=W(function(){if(ex)return ey;function e(e,i,r,a){this.cx=3*e,this.bx=3*(r-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(a-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=r,this.p2y=a}return ex=1,ey=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,i){if(void 0===i&&(i=1e-6),e<0)return 0;if(e>1)return 1;for(var r=e,a=0;a<8;a++){var n=this.sampleCurveX(r)-e;if(Math.abs(n)<i)return r;var s=this.sampleCurveDerivativeX(r);if(1e-6>Math.abs(s))break;r-=n/s}var l=0,h=1;for(r=e,a=0;a<20&&!(Math.abs((n=this.sampleCurveX(r))-e)<i);a++)e>n?l=r:h=r,r=.5*(h-l)+l;return r}
206,solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},ey}());function eE(){if(eb)return ev;function e(e,i){this.x=e,this.y=i}return eb=1,ev=e,e.prototype={clone:function(){return new e(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,i){return this.clone()._rotateAround(e,i)},matMult:function(e){return this.clone()._matMult(e)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var i=e.x-this.x,r=e.y-this.y;return i*i+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,i){return Math.atan2(this.x*i-this.y*e,this.x*e+this.y*i)},_matMult:function(e){var i=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=i,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var i=Math.cos(e),r=Math.sin(e),a=r*this.x+i*this.y;return this.x=i*this.x-r*this.y,this.y=a,this},_rotateAround:function(e,i){var r=Math.cos(e),a=Math.sin(e),n=i.y+a*(this.x-i.x)+r*(this.y-i.y);return this.x=i.x+r*(this.x-i.x)-a*(this.y-i.y),this.y=n,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},e.convert=function(i){return i instanceof e?i:Array.isArray(i)?new e(i[0],i[1]):i},ev}var eA=W(eE());function eI(e,i){if(Array.isArray(e)){if(!Array.isArray(i)||e.length!==i.length)return!1;for(let r=0;r<e.length;r++)if(!eI(e[r],i[r]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==i){if("object"!=typeof i||Object.keys(e).length!==Object.keys(i).length)return!1;for(let r in e)if(!eI(e[r],i[r]))return!1;return!0}return e===i}let eC=Math.PI/180,eP=180/Math.PI,eL=[[0,0],[1,0],[1,1],[0,1]];function ek(e){if(e<=0)return 0;if(e>=1)return 1;let i=e*e,r=i*e;return 4*(e<.5?r:3*(e-i)+r-.75)}function eR(e,i,r,a){let n=new eM(e,i,r,a);return function(e){return n.solve(e)}}let ez=eR(.25,.1,.25,1);function eD(e,i,r){return Math.min(r,Math.max(i,e))}function eO(e,i,r){return(r=eD((r-e)/(i-e),0,1))*r*(3-2*r)}function eB(e,i,r){let a=r-i,n=((e-i)%a+a)%a+i;return n===i?r:n}function eF(e,i,r){if(!e.length)return r(null,[]);let a=e.length,n=Array(e.length),s=null;e.forEach((e,l)=>{i(e,(e,i)=>{e&&(s=e),n[l]=i,0==--a&&r(s,n)})})}function eN(e,...i){for(let r of i)for(let i in r)e[i]=r[i];return e}let eV=1;function eU(){return eV++}function ej(e){return e<=1?1:Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function eG(e,i){e.forEach(e=>{i[e]&&(i[e]=i[e].bind(i))})}function eq(e,i){return -1!==e.indexOf(i,e.length-i.length)}function eW(e,i,r){let a={};for(let r in e)a[r]=i.call(this,e[r],r,e);return a}function e$(e,i,r){let a={};for(let r in e)i.call(this,e[r],r,e)&&(a[r]=e[r]);return a}function eH(e){return Array.isArray(e)?e.map(eH):"object"==typeof e&&e?eW(e,eH):e}let eZ={};function eX(e){eZ[e]||("undefined"!=typeof console&&console.warn(e),eZ[e]=!0)}function eY(e,i,r){return(r.y-e.y)*(i.x-e.x)>(i.y-e.y)*(r.x-e.x)}function eJ([e,i,r]){let a=(i+90)*eC,n=r*eC;return{x:e*Math.cos(a)*Math.sin(n),y:e*Math.sin(a)*Math.sin(n),z:e*Math.cos(n),azimuthal:i,polar:r}}function eK(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}function eQ(e){let i={};if(e.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(e,r,a,n)=>{let s=a||n;return i[r]=!s||s.toLowerCase(),""}),i["max-age"]){let e=parseInt(i["max-age"],10);isNaN(e)?delete i["max-age"]:i["max-age"]=e}return i}let e0=null;function e1(e,i){return[e[4*i],e[4*i+1],e[4*i+2],e[4*i+3]]}function e2(e,i,r,a){for(;i<r;){let n=i+r>>1;e[n]<a?i=n+1:r=n}return i}function e3(e,i,r,a){for(;i<r;){let n=i+r>>1;e[n]<=a?i=n+1:r=n}return i}function e4(e){return e>0?1/(1.001-e):1+e}function e5(e){return e>0?1-1/(1.001-e):-e}let e6={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i},get API_TILEJSON_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},get API_CDN_URL_REGEX(){return/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i},get EVENTS_URL(){if(!e6.API_URL)return null;try{let e=new URL(e6.API_URL);return"api.mapbox.cn"===e.hostname?"https://events.mapbox.cn/events/v2":"api.mapbox.com"===e.hostname?"https://events.mapbox.com/events/v2":null}catch(e){return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",RASTERARRAYS_URL_PREFIX:"rasterarrays/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,DEFAULT_STYLE:"mapbox://styles/mapbox/standard",MAX_PARALLEL_IMAGE_REQUESTS:16,DRACO_URL:"https://api.mapbox.com/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",MES
206HOPT_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_base_v0.20.wasm",MESHOPT_SIMD_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_simd_v0.20.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1"};function e8(e){return e6.API_URL_REGEX.test(e)}function e9(e){return e6.API_SPRITE_REGEX.test(e)}function e7(){return null==i&&(i=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof self.createImageBitmap),i}let te={now:()=>void 0!==n?n:performance.now(),setNow(e){n=e},restoreNow(){n=void 0},frame(e){let i=requestAnimationFrame(e);return{cancel:()=>cancelAnimationFrame(i)}},getImageData(e,i=0){let{width:r,height:a}=e;s||(s=document.createElement("canvas"));let n=s.getContext("2d",{willReadFrequently:!0});if(!n)throw Error("failed to create canvas 2d context");return(r>s.width||a>s.height)&&(s.width=r,s.height=a),n.clearRect(-i,-i,r+2*i,a+2*i),n.drawImage(e,0,0,r,a),n.getImageData(-i,-i,r+2*i,a+2*i)},resolveURL:e=>(r||(r=document.createElement("a")),r.href=e,r.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(null==a&&(a=window.matchMedia("(prefers-reduced-motion: reduce)")),a.matches)},hasCanvasFingerprintNoise(){if(void 0!==l)return l;if(!e7())return l=!1,!1;let e=new OffscreenCanvas(85,1),i=e.getContext("2d",{willReadFrequently:!0}),r=0;for(let a=0;a<e.width;++a)i.fillStyle=`rgba(${r++},${r++},${r++}, 255)`,i.fillRect(a,0,1,1);let a=i.getImageData(0,0,e.width,e.height);r=0;for(let e=0;e<a.data.length;++e)if(e%4!=3&&r++!==a.data[e])return l=!0,!0;return l=!1,!1}};function tt(e,i){let r=e.indexOf("?");if(r<0)return`${e}?${new URLSearchParams(i).toString()}`;let a=new URLSearchParams(e.slice(r));for(let e in i)a.set(e,i[e]);return`${e.slice(0,r)}?${a.toString()}`}
206function ti(e,i={persistentParams:[]}){let r=e.indexOf("?");if(r<0)return e;let a=new URLSearchParams,n=new URLSearchParams(e.slice(r));for(let e of i.persistentParams){let i=n.get(e);i&&a.set(e,i)}let s=a.toString();return`${e.slice(0,r)}${s.length>0?`?${s}`:""}`}let tr="mapbox-tiles",ta=500,tn=50,to=["language","worldview","jobid"];function ts(){try{return caches}catch(e){}}function tl(){let e=ts();e&&null==h&&(h=e.open(tr))}let th=1/0,tu={supported:!1,testSupport:function(e){!tp&&td&&(tf?t_(e):tc=e)}},tc,td,tp=!1,tf=!1,tm="undefined"!=typeof self?self:{};function t_(e){let i=e.createTexture();e.bindTexture(e.TEXTURE_2D,i);try{if(e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,td),e.isContextLost())return;tu.supported=!0}catch(e){}e.deleteTexture(i),tp=!0}tm.document&&((td=tm.document.createElement("img")).onload=function(){tc&&t_(tc),tc=null,tf=!0},td.onerror=function(){tp=!0,tc=null},td.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");let tg={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image",Model:"Model"};"function"==typeof Object.freeze&&Object.freeze(tg);class ty extends Error{constructor(e,i,r){401===i&&e8(r)&&(e+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(e),this.status=i,this.url=r}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}let tx=eK()?()=>self.worker&&self.worker.referrer:()=>("blob:"===location.protocol?parent:self).location.href,tv=function(e,i){var r;if(!(/^file:/.test(r=e.url)||/^file:/.test(tx())&&!/^\w+:/.test(r))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return function(e,i){var r;let a=new AbortController,n=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,referrer:tx(),referrerPolicy:e.referrerPolicy,signal:a.signal}),s=!1,l=!1,c=(r=n.url).indexOf("sku=")>0&&e8(r);"json"===e.type&&n.headers.set("Accept","application/json");let d=(r,a,s)=>{if(l)return;if(r&&"SecurityError"!==r.message&&eX(r.toString()),a&&s)return p(a);let h=Date.now();fetch(n).then(r=>{if(r.ok){let e=c?r.clone():null;return p(r,e,h)}return i(new ty(r.statusText,r.status,e.url))}).catch(r=>{"AbortError"!==r.name&&i(Error(`${r.message} ${e.url}`))})},p=(r,a,c)=>{("arrayBuffer"===e.type?r.arrayBuffer():"json"===e.type?r.json():r.text()).then(e=>{l||(a&&c&&function(e,i,r){if(tl(),null==h)return;let a=eQ(i.headers.get("Cache-Control")||"");if(a["no-store"])return;let n={status:i.status,statusText:i.statusText,headers:new Headers};i.headers.forEach((e,i)=>n.headers.set(i,e)),a["max-age"]&&n.headers.set("Expires",new Date(r+1e3*a["max-age"]).toUTCString());let s=n.headers.get("Expires");if(!s||new Date(s).getTime()-r<42e4)return;
206let l=ti(e.url,{persistentParams:to});if(206===i.status){let i=e.headers.get("Range");if(!i)return;n.status=200,l=tt(l,{range:i})}!function(e,i){if(void 0===u)try{new Response(new ReadableStream),u=!0}catch(e){u=!1}u?i(e.body):e.blob().then(i)}(i,e=>{var r;let a=new Response(200!==(r=i.status)&&404!==r&&[101,103,204,205,304].includes(r)?null:e,n);tl(),null!=h&&h.then(e=>e.put(l,a)).catch(e=>eX(e.message))})}(n,a,c),s=!0,i(null,e,r.headers.get("Cache-Control"),r.headers.get("Expires")))}).catch(e=>{l||i(Error(e.message))})};return c?function(e,i){if(tl(),null==h)return i(null);h.then(r=>{let a=ti(e.url,{persistentParams:to}),n=e.headers.get("Range");n&&(a=tt(a,{range:n})),r.match(a).then(e=>{let n=function(e){if(!e)return!1;let i=new Date(e.headers.get("Expires")||0),r=eQ(e.headers.get("Cache-Control")||"");return i>Date.now()&&!r["no-cache"]}(e);r.delete(a),n&&r.put(a,e.clone()),i(null,e,n)}).catch(i)}).catch(i)}(n,d):d(null,null),{cancel:()=>{l=!0,s||a.abort()}}}(e,i);if(eK()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",e,i,void 0,!0)}return function(e,i){let r=new XMLHttpRequest;for(let i in r.open(e.method||"GET",e.url,!0),"arrayBuffer"===e.type&&(r.responseType="arraybuffer"),e.headers)r.setRequestHeader(i,e.headers[i]);return"json"===e.type&&(r.responseType="text",r.setRequestHeader("Accept","application/json")),r.withCredentials="include"===e.credentials,r.onerror=()=>{i(Error(r.statusText))},r.onload=()=>{if((r.status>=200&&r.status<300||0===r.status)&&null!==r.response){let a=r.response;if("json"===e.type)try{a=JSON.parse(r.response)}catch(e){return i(e)}i(null,a,r.getResponseHeader("Cache-Control"),r.getResponseHeader("Expires"))}else i(new ty(r.statusText,r.status,e.url))},r.send(e.body),{cancel:()=>r.abort()}}(e,i)},tb=function(e,i){return tv(eN(e,{type:"arrayBuffer"}),i)},tw="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";c=[],d=0;let tT=function(e,i){if(tu.supported&&(e.headers||(e.headers={}),e.headers.accept="image/webp,*/*"),d>=e6.MAX_PARALLEL_IMAGE_REQUESTS){let r={requestParameters:e,callback:i,cancelled:!1,cancel(){this.cancelled=!0}};return c.push(r),r}d++;let r=!1,a=()=>{if(!r)for(r=!0,d--;c.length&&d<e6.MAX_PARALLEL_IMAGE_REQUESTS;){let e=c.shift(),{requestParameters:i,callback:r,cancelled:a}=e;a||(e.cancel=tT(i,r).cancel)}},n=tb(e,(e,r,n,s)=>{a(),e?i(e):r&&(self.createImageBitmap?function(e,i){createImageBitmap(new Blob([new Uint8Array(e)],{type:"image/png"})).then(e=>{i(null,e)}).catch(e=>{i(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.`))})}(r,(e,r)=>i(e,r,n,s)):function(e,i){let r=new Image;r.onload=()=>{i(null,r),URL.revokeObjectURL(r.src),r.onload=null,requestAnimationFrame(()=>{r.src=tw})},r.onerror=()=>i(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."));let a=new Blob([new Uint8Array(e)],{type:"image/png"});r.src=e.byteLength?URL.createObjectURL(a):tw}(r,(e,r)=>i(e,r,n,s)))});return{cancel:()=>{n.cancel(),a()}}};var tS,tM,tE,tA={exports:{}},tI={exports:{}},tC={exports:{}},tP=W(function(){if(tE)return tA.exports;tE=1;var e=(tS||(tS=1,tI.exports=function(e,i){var r,a,n,s,l,h;for(a=e.length-(r=3&e.length),n=i,h=0;h<a;)l=255&e.charCodeAt(h)|(255&e.charCodeAt(++h))<<8|(255&e.charCodeAt(++h))<<16|(255&e.charCodeAt(++h))<<24,++h,n=27492+(65535&(s=5*(65535&(n=(n^=l=(6
2065535&(l=(l=(65535&l)*0xcc9e2d51+(((l>>>16)*0xcc9e2d51&65535)<<16)&0xffffffff)<<15|l>>>17))*0x1b873593+(((l>>>16)*0x1b873593&65535)<<16)&0xffffffff)<<13|n>>>19))+((5*(n>>>16)&65535)<<16)&0xffffffff))+((58964+(s>>>16)&65535)<<16);switch(l=0,r){case 3:l^=(255&e.charCodeAt(h+2))<<16;case 2:l^=(255&e.charCodeAt(h+1))<<8;case 1:n^=l=(65535&(l=(l=(65535&(l^=255&e.charCodeAt(h)))*0xcc9e2d51+(((l>>>16)*0xcc9e2d51&65535)<<16)&0xffffffff)<<15|l>>>17))*0x1b873593+(((l>>>16)*0x1b873593&65535)<<16)&0xffffffff}return n^=e.length,n=0x85ebca6b*(65535&(n^=n>>>16))+((0x85ebca6b*(n>>>16)&65535)<<16)&0xffffffff,n=0xc2b2ae35*(65535&(n^=n>>>13))+((0xc2b2ae35*(n>>>16)&65535)<<16)&0xffffffff,(n^=n>>>16)>>>0}),tI.exports),i=(tM||(tM=1,tC.exports=function(e,i){for(var r,a=e.length,n=i^a,s=0;a>=4;)r=0x5bd1e995*(65535&(r=255&e.charCodeAt(s)|(255&e.charCodeAt(++s))<<8|(255&e.charCodeAt(++s))<<16|(255&e.charCodeAt(++s))<<24))+((0x5bd1e995*(r>>>16)&65535)<<16),n=0x5bd1e995*(65535&n)+((0x5bd1e995*(n>>>16)&65535)<<16)^(r=0x5bd1e995*(65535&(r^=r>>>24))+((0x5bd1e995*(r>>>16)&65535)<<16)),a-=4,++s;switch(a){case 3:n^=(255&e.charCodeAt(s+2))<<16;case 2:n^=(255&e.charCodeAt(s+1))<<8;case 1:n=0x5bd1e995*(65535&(n^=255&e.charCodeAt(s)))+((0x5bd1e995*(n>>>16)&65535)<<16)}return n=0x5bd1e995*(65535&(n^=n>>>13))+((0x5bd1e995*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0}),tC.exports);return tA.exports=e,tA.exports.murmur3=e,tA.exports.murmur2=i,tA.exports}());class tL{constructor(e,...i){eN(this,i[0]||{}),this.type=e}}class tk extends tL{constructor(e,i={}){super("error",eN({error:e},i))}}function tR(e,i,r){r[e]&&-1!==r[e].indexOf(i)||(r[e]=r[e]||[],r[e].push(i))}function tz(e,i,r){if(r&&r[e]){let a=r[e].indexOf(i);-1!==a&&r[e].splice(a,1)}}class tD{on(e,i){return this._listeners=this._listeners||{},tR(e,i,this._listeners),this}off(e,i){return tz(e,i,this._listeners),tz(e,i,this._oneTimeListeners),this}once(e,i){return i?(this._oneTimeListeners=this._oneTimeListeners||{},tR(e,i,this._oneTimeListeners),this):new Promise(i=>this.once(e,i))}fire(e,i){let r="string"==typeof e?new tL(e,i):e,a=r.type;if(this.listens(a)){for(let e of(r.target=this,this._listeners&&this._listeners[a]?this._listeners[a].slice():[]))e.call(this,r);for(let e of this._oneTimeListeners&&this._oneTimeListeners[a]?this._oneTimeListeners[a].slice():[])tz(a,e,this._oneTimeListeners),e.call(this,r);let e=this._eventedParent;e&&(eN(r,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),e.fire(r))}else r instanceof tk&&console.error(r.error);return this}listens(e){return!!(this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e))}setEventedParent(e,i){return this._eventedParent=e,this._eventedParentData=i,this}}var tO,tB={},tF=function(){if(tO)return tB;tO=1;var e={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function i(e){return(e=Math.round(e))<0?0:e>255?255:e}function r(e){return i("%"===e[e.length-1]?parseFloat(e)/100*255:parseInt(e))}function a(e){var i;return(i="%"===e[e.length-1]?parseFloat(e)/100:parseFloat(e))<0?0:i>1?1:i}function n(e,i,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?e+(i-e)*r*6:2*r<1?i:3*r<2?e+(i-e)*(2/3-r)*6:e}try{tB.parseCSSColor=function(s){var l,h=s.replace(/ /g,"").toLowerCase();if(h in e)return e[h].slice();if("#"===h[0])return 4===h.length?(l=parseInt(h.substr(1),16))>=0&&l<=4095?[(3840&l)>>4|(3840&l)>>8,240&l|(240&l)>>4,15&l|(15&l)<<4,1]:null:7===h.length&&(l=parseInt(h.substr(1),16))>=0&&l<=0xffffff?[(0xff0000&l)>>16,(65280&l)>>8,255&l,1]:null;var u=h.indexOf("("),c=h.indexOf(")");if(-1!==u&&c+1===h.length){var d=h.substr(0,u),p=h.substr(u+1,c-(u+1)).split(","),f=1;switch(d){case"rgba":if(4!==p.length)break;f=a(p.pop());case"rgb":return 3!==p.length?null:[r(p[0]),r(p[1]),r(p[2]),f];case"hsla":if(4!==p.length)break;f=a(p.pop());case"hsl":if(3!==p.length)break;var m=(parseFloat(p[0])%360+360)%360/360,_=a(p[1]),g=a(p[2]),y=g<=.5?g*(_+1):g+_-g*_,x=2*g-y;return[i(255*n(x,y,m+1/3)),i(255*n(x,y,m)),i(255*n(x,y,m-1/3)),f]}}return null}}catch(e){}return tB}();class tN{constructor(e,i,r,a=1){this.r=e,this.g=i,this.b=r,this.a=a}static parse(e){if(!e)return;if(e instanceof tN)return e;if("string"!=typeof e)return;let i=tF.parseCSSColor(e);return i?new tN(i[0]/255*i[3],i[1]/255*i[3],i[2]/255*i[3],i[3]):void 0}toString(){let[e,i,r,a]=0===this.a?[0,0,0,0]:[255*this.r/this.a,255*this.g/this.a,255*this.b/this.a,this.a];return`rgba(${Math.round(e)},${Math.round(i)},${Math.round(r)},${a})`}toRenderColor(e){let{r:i,g:r,b:a,a:n}=this;return new tV(e,i,r,a,n)}}class tV{constructor(e,i,r,a,n){if(e){let s=e.image.height,l=s*s;i=0===n?0:i/n*(s-1),r=0===n?0:r/n*(s-1),a=0===n?0:a/n*(s-1);let h=Math.floor(i),u=Math.floor(r),c=Math.floor(a),d=Math.ceil(i),p=Math.ceil(r),f=Math.ceil(a),m=i-h,_=r-u,g=a-c,y=e.image.data,x=4*(h+u*l+c*s),v=4*(h+u*l+f*s),b=4*(h+p*l+c*s),w=4*(h+p*l+f*s),T=4*(d+u*l+c*s),S=4*(d+u*l+f*s),M=4*(d+p*l+c*s),E=4*(d+p*l+f*s);if(x<0||E>=y.length)throw Error("out of range");this.r=tU(tU(tU(y[x],y[v],g),tU(y[b],y[w],g),_),tU(tU(y[T],y[S],g),tU(y[M],y[E],g),_),m)/255*n,this.g=tU(tU(tU(y[x+1],y[v+1],g),tU(y[b+1],y[w+1],g),_),tU(tU(y[T+1],y[S+1],g),tU(y[M+1],y[E+1],g),_),m)/255*n,this.b=tU(tU(tU(y[x+2],y[v+2],g),tU(y[b+2],y[w+2],g),_),tU(tU(y[T+2],y[S+2],g),tU(y[M+2],y[E+2],g),_),m)/255*n,this.a=n}
206else this.r=i,this.g=r,this.b=a,this.a=n}toArray(){let{r:e,g:i,b:r,a:a}=this;return 0===a?[0,0,0,0]:[255*e/a,255*i/a,255*r/a,a]}toArray01(){let{r:e,g:i,b:r,a:a}=this;return 0===a?[0,0,0,0]:[e/a,i/a,r/a,a]}toArray01Scaled(e){let{r:i,g:r,b:a,a:n}=this;return 0===n?[0,0,0]:[i/n*e,r/n*e,a/n*e]}toArray01PremultipliedAlpha(){let{r:e,g:i,b:r,a:a}=this;return[e,i,r,a]}toArray01Linear(){let{r:e,g:i,b:r,a:a}=this;return 0===a?[0,0,0,0]:[Math.pow(e/a,2.2),Math.pow(i/a,2.2),Math.pow(r/a,2.2),a]}}function tU(e,i,r){return e*(1-r)+i*r}function tj(e,i,r){return e.map((e,a)=>tU(e,i[a],r))}tN.black=new tN(0,0,0,1),tN.white=new tN(1,1,1,1),tN.transparent=new tN(0,0,0,0),tN.red=new tN(1,0,0,1),tN.blue=new tN(0,0,1,1);var tG=Object.freeze({__proto__:null,array:tj,color:function(e,i,r){return new tN(tU(e.r,i.r,r),tU(e.g,i.g,r),tU(e.b,i.b,r),tU(e.a,i.a,r))},number:tU});function tq(e,...i){for(let r of i)for(let i in r)e[i]=r[i];return e}class tW extends Error{constructor(e,i){super(i),this.message=i,this.key=e}}class t${constructor(e,i=[]){for(let[r,a]of(this.parent=e,this.bindings={},i))this.bindings[r]=a}concat(e){return new t$(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}let tH={kind:"null"},tZ={kind:"number"},tX={kind:"string"},tY={kind:"boolean"},tJ={kind:"color"},tK={kind:"object"},tQ={kind:"value"},t0={kind:"collator"},t1={kind:"formatted"},t2={kind:"resolvedImage"};function t3(e,i){return{kind:"array",itemType:e,N:i}}function t4(e){if("array"===e.kind){let i=t4(e.itemType);return"number"==typeof e.N?`array<${i}, ${e.N}>`:"value"===e.itemType.kind?"array":`array<${i}>`}return e.kind}let t5=[tH,tZ,tX,tY,tJ,t1,tK,t3(tQ),t2];function t6(e,i){if("error"===i.kind)return null;if("array"===e.kind){if("array"===i.kind&&(0===i.N&&"value"===i.itemType.kind||!t6(e.itemType,i.itemType))&&("number"!=typeof e.N||e.N===i.N))return null}else{if(e.kind===i.kind)return null;if("value"===e.kind){for(let e of t5)if(!t6(e,i))return null}}return`Expected ${t4(e)} but found ${t4(i)} instead.`}function t8(e,i){return i.some(i=>i.kind===e.kind)}function t9(e,i){return i.some(i=>"null"===i?null===e:"array"===i?Array.isArray(e):"object"===i?e&&!Array.isArray(e)&&"object"==typeof e:i===typeof e)}class t7{constructor(e,i,r){this.sensitivity=e?i?"variant":"case":i?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,i){return this.collator.compare(e,i)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class ie{constructor(e,i,r,a,n){this.text=e.normalize?e.normalize():e,this.image=i,this.scale=r,this.fontStack=a,this.textColor=n}}class it{constructor(e){this.sections=e}static fromString(e){return new it([new ie(e,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(e=>0!==e.text.length||e.image&&0!==e.image.namePrimary.length)}static factory(e){return e instanceof it?e:it.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map(e=>e.text).join("")}serialize(){let e=["format"];for(let i of this.sections){if(i.image){e.push(["image",i.image.namePrimary]);continue}e.push(i.text);let r={};i.fontStack&&(r["text-font"]=["literal",i.fontStack.split(",")]),i.scale&&(r["font-scale"]=i.scale),i.textColor&&(r["text-color"]=["rgba"].concat(i.textColor.toRenderColor(null).toArray())),e.push(r)}return e}}class ii{constructor(e){this.namePrimary=e.namePrimary,e.nameSecondary&&(this.nameSecondary=e.nameSecondary),this.available=e.available}toString(){return this.nameSecondary?`[${this.namePrimary},${this.nameSecondary}]`:this.namePrimary}static fromString(e,i){return e?new ii({namePrimary:e,nameSecondary:i,available:!1}):null}serialize(){return this.nameSecondary?["image",this.namePrimary,this.nameSecondary]:["image",this.namePrimary]}}function ir(e,i,r,a){return"number"==typeof e&&e>=0&&e<=255&&"number"==typeof i&&i>=0&&i<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===a||"number"==typeof a&&a>=0&&a<=1?null:`Invalid rgba value [${[e,i,r,a].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof a?[e,i,r,a]:[e,i,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function ia(e){if(null===e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||e instanceof tN||e instanceof t7||e instanceof it||e instanceof ii)return!0;
206if(Array.isArray(e)){for(let i of e)if(!ia(i))return!1;return!0}if("object"==typeof e){for(let i in e)if(!ia(e[i]))return!1;return!0}return!1}function io(e){if(null===e)return tH;if("string"==typeof e)return tX;if("boolean"==typeof e)return tY;if("number"==typeof e)return tZ;if(e instanceof tN)return tJ;if(e instanceof t7)return t0;if(e instanceof it)return t1;if(e instanceof ii)return t2;if(Array.isArray(e)){let i;let r=e.length;for(let r of e){let e=io(r);if(i){if(i===e)continue;i=tQ;break}i=e}return t3(i||tQ,r)}return tK}function is(e){let i=typeof e;return null===e?"":"string"===i||"number"===i||"boolean"===i?String(e):e instanceof tN||e instanceof it||e instanceof ii?e.toString():JSON.stringify(e)}class il{constructor(e,i){this.type=e,this.value=i}static parse(e,i){if(2!==e.length)return i.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!ia(e[1]))return i.error("invalid value");let r=e[1],a=io(r),n=i.expectedType;return"array"===a.kind&&0===a.N&&n&&"array"===n.kind&&("number"!=typeof n.N||0===n.N)&&(a=n),new il(a,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof tN?["rgba"].concat(this.value.toRenderColor(null).toArray()):this.value instanceof it?this.value.serialize():this.value}}class ih{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}let iu={string:tX,number:tZ,boolean:tY,object:tK};class ic{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let r,a=1,n=e[0];if("array"===n){let n,s;if(e.length>2){let r=e[1];if("string"!=typeof r||!(r in iu)||"object"===r)return i.error('The item type argument of "array" must be one of string, number, boolean',1);n=iu[r],a++}else n=tQ;if(e.length>3){if(null!==e[2]&&("number"!=typeof e[2]||e[2]<0||e[2]!==Math.floor(e[2])))return i.error('The length argument to "array" must be a positive integer literal',2);s=e[2],a++}r=t3(n,s)}else r=iu[n];let s=[];for(;a<e.length;a++){let r=i.parse(e[a],a,tQ);if(!r)return null;s.push(r)}return new ic(r,s)}evaluate(e){for(let i=0;i<this.args.length;i++){let r=this.args[i].evaluate(e);if(!t6(this.type,io(r)))return r;if(i===this.args.length-1)throw new ih(`The expression ${JSON.stringify(this.args[i].serialize())} evaluated to ${t4(io(r))} but was expected to be of type ${t4(this.type)}.`)}return null}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){let e=this.type,i=[e.kind];if("array"===e.kind){let r=e.itemType;if("string"===r.kind||"number"===r.kind||"boolean"===r.kind){i.push(r.kind);let a=e.N;("number"==typeof a||this.args.length>1)&&i.push(a)}}return i.concat(this.args.map(e=>e.serialize()))}}class id{constructor(e){this.type=t1,this.sections=e}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let r=e[1];if(!Array.isArray(r)&&"object"==typeof r)return i.error("First argument must be an image or text section.");let a=[],n=!1;for(let r=1;r<=e.length-1;++r){let s=e[r];if(n&&"object"==typeof s&&!Array.isArray(s)){n=!1;let e=null;if(s["font-scale"]&&!(e=i.parseObjectValue(s["font-scale"],r,"font-scale",tZ)))return null;let l=null;if(s["text-font"]&&!(l=i.parseObjectValue(s["text-font"],r,"text-font",t3(tX))))return null;let h=null;if(s["text-color"]&&!(h=i.parseObjectValue(s["text-color"],r,"text-color",tJ)))return null;let u=a[a.length-1];u.scale=e,u.font=l,u.textColor=h}else{let s=i.parse(e[r],r,tQ);if(!s)return null;let l=s.type.kind;if("string"!==l&&"value"!==l&&"null"!==l&&"resolvedImage"!==l)return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");n=!0,a.push({content:s,scale:null,font:null,textColor:null})}}return new id(a)}evaluate(e){return new it(this.sections.map(i=>{let r=i.content.evaluate(e);return io(r)===t2?new ie("",r,null,null,null):new ie(is(r),null,i.scale?i.scale.evaluate(e):null,i.font?i.font.evaluate(e).join(","):null,i.textColor?i.textColor.evaluate(e):null)}))}eachChild(e){for(let i of this.sections)e(i.content),i.scale&&e(i.scale),i.font&&e(i.font),i.textColor&&e(i.textColor)}outputDefined(){return!1}serialize(){let e=["format"];for(let i of this.sections){e.push(i.content.serialize());let r={};i.scale&&(r["font-scale"]=i.scale.serialize()),i.font&&(r["text-font"]=i.font.serialize()),i.textColor&&(r["text-color"]=i.textColor.serialize()),e.push(r)}return e}}class ip{constructor(e,i){this.type=t2,this.inputPrimary=e,this.inputSecondary=i}static parse(e,i){if(e.length<2)return i.error("Expected two or more arguments.");let r=i.parse(e[1],1,tX);if(!r)return i.error("No image name provided.");if(2===e.length)return new ip(r);let a=i.parse(e[2],1,tX);return a?new ip(r,a):i.error("Secondary image variant is not a string.")}evaluate(e){let i=ii.fromString(this.inputPrimary.evaluate(e),this.inputSecondary?this.inputSecondary.evaluate(e):void 0);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(i.namePrimary)>-1,i.nameSecondary&&i.available&&e.availableImages&&(i.available=e.availableImages.indexOf(i.nameSecondary)>-1)),i}eachChild(e){e(this.inputPrimary),this.inputSecondary&&e(this.inputSecondary)}outputDefined(){return!1}serialize(){return this.inputSecondary?["image",this.inputPrimary.serialize(),this.inputSecondary.serialize()]:["image",this.inputPrimary.serialize()]}}function im(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}let i_={"to-boolean":tY,"to-color":tJ,"to-number":tZ,"to-string":tX};class ig{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let r=e[0],a=[],n=tH;if("to-array"===r){if(!Array.isArray(e[1]))return null;let r=e[1].length;if(i.expectedType){if("array"!==i.expectedType.kind)return i.error(`Expected ${i.expectedType.kind} but found array.`);n=t3(i.expectedType.itemType,r)}else{if(!(r>0&&ia(e[1][0])))return null;n=t3(io(e[1][0]),r)}for(let s=0;s<r;s++){let r;let l=e[1][s];if("array"===im(l))r=i.parse(l,void 0,n.itemType);else{let e=im(l);if(e!==n.itemType.kind)return i.error(`Expected ${n.itemType.kind} but found ${e}.`);r=i.registry.literal.parse(["literal",void 0===l?null:l],i)}if(!r)return null;a.push(r)}}else{if(("to-boolean"===r||"to-string"===r)&&2!==e.length)return i.error("Expected one argument.");n=i_[r];for(let r=1;r<e.length;r++){let n=i.parse(e[r],r,tQ);if(!n)return null;a.push(n)}}return new ig(n,a)}evaluate(e){if("boolean"===this.type.kind)return!!this.args[0].evaluate(e);if("color"===this.type.kind){let i,r;for(let a of this.args){if(i=a.evaluate(e),r=null,i instanceof tN)return i;if("string"==typeof i){let r=e.parseColor(i);if(r)return r}else if(Array.isArray(i)&&!(r=i.length<3||i.length>4?`Invalid rbga value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:ir(i[0],i[1],i[2],i[3])))return new tN(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new ih(r||`Could not parse color from value '${"string"==typeof i?i:String(JSON.stringify(i))}'`)}if("number"===this.type.kind){let i=null;for(let r of this.args){if(null===(i=r.evaluate(e)))return 0;let a=Number(i);if(!isNaN(a))return a}throw new ih(`Could not convert ${JSON.stringify(i)} to number.`)}return"formatted"===this.type.kind?it.fromString(is(this.args[0].evaluate(e))):"resolvedImage"===this.type.kind?ii.fromString(is(this.args[0].evaluate(e))):"array"===this.type.kind?this.args.map(i=>i.evaluate(e)):is(this.args[0].evaluate(e))}
206eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){if("formatted"===this.type.kind)return new id([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new ip(this.args[0]).serialize();let e="array"===this.type.kind?[]:[`to-${this.type.kind}`];return this.eachChild(i=>{e.push(i.serialize())}),e}}let iy=["Unknown","Point","LineString","Polygon"];class ix{constructor(e,i){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=e,this.options=i}id(){return this.feature&&void 0!==this.feature.id?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?iy[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}measureLight(e){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){let e=this.featureDistanceData.center,i=this.featureDistanceData.scale,{x:r,y:a}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(r*i-e[0])+this.featureDistanceData.bearing[1]*(a*i-e[1])}return 0}parseColor(e){let i=this._parseColorCache[e];return i||(i=this._parseColorCache[e]=tN.parse(e)),i}getConfig(e){return this.options?this.options.get(e):null}}class iv{constructor(e,i,r,a,n){this.name=e,this.type=i,this._evaluate=r,this.args=a,this._overloadIndex=n}evaluate(e){if(!this._evaluate){let e=iv.definitions[this.name];this._evaluate=Array.isArray(e)?e[2]:e.overloads[this._overloadIndex][1]}return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(e=>e.serialize()))}static parse(e,i){let r=e[0],a=iv.definitions[r];if(!a)return i.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0);let n=Array.isArray(a)?a[0]:a.type,s=Array.isArray(a)?[[a[1],a[2]]]:a.overloads,l=[],h=null,u=-1;for(let[a,c]of s){if(Array.isArray(a)&&a.length!==e.length-1)continue;l.push(a),u++,h=new rl(i.registry,i.path,null,i.scope,void 0,i._scope,i.options);let s=[],d=!1;for(let i=1;i<e.length;i++){let r=e[i],n=Array.isArray(a)?a[i-1]:a.type,l=h.parse(r,1+s.length,n);if(!l){d=!0;break}s.push(l)}if(!d){if(Array.isArray(a)&&a.length!==s.length)h.error(`Expected ${a.length} arguments, but found ${s.length} instead.`);else{for(let e=0;e<s.length;e++){let i=Array.isArray(a)?a[e]:a.type,r=s[e];h.concat(e+1).checkSubtype(i,r.type)}if(0===h.errors.length)return new iv(r,n,c,s,u)}}}if(1===l.length)i.errors.push(...h.errors);else{let r=(l.length?l:s.map(([e])=>e)).map(ib).join(" | "),a=[];for(let r=1;r<e.length;r++){let n=i.parse(e[r],1+a.length);if(!n)return null;a.push(t4(n.type))}i.error(`Expected arguments of type ${r}, but found (${a.join(", ")}) instead.`)}return null}static register(e,i){for(let r in iv.definitions=i,i)e[r]=iv}}function ib(e){return Array.isArray(e)?`(${e.map(t4).join(", ")})`:`(${t4(e.type)}...)`}class iw{constructor(e,i,r){this.type=t0,this.locale=r,this.caseSensitive=e,this.diacriticSensitive=i}static parse(e,i){if(2!==e.length)return i.error("Expected one argument.");let r=e[1];if("object"!=typeof r||Array.isArray(r))return i.error("Collator options argument must be an object.");let a=void 0===r["case-sensitive"]?i.parse(!1,1,tY):i.parseObjectValue(r["case-sensitive"],1,"case-sensitive",tY);if(!a)return null;let n=void 0===r["diacritic-sensitive"]?i.parse(!1,1,tY):i.parseObjectValue(r["diacritic-sensitive"],1,"diacritic-sensitive",tY);if(!n)return null;let s=null;return!r.locale||(s=i.parseObjectValue(r.locale,1,"locale",tX))?new iw(a,n,s):null}evaluate(e){return new t7(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}serialize(){let e={};return e["case-sensitive"]=this.caseSensitive.serialize(),e["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(e.locale=this.locale.serialize()),["collator",e]}}function iT(e,i,r){let a=e[i];e[i]=e[r],e[r]=a}function iS(e,i){e[0]=Math.min(e[0],i[0]),e[1]=Math.min(e[1],i[1]),e[2]=Math.max(e[2],i[0]),e[3]=Math.max(e[3],i[1])}function iM(e,i){return!(e[0]<=i[0]||e[2]>=i[2]||e[1]<=i[1]||e[3]>=i[3])}function iE(e,i,r=!1){let a=!1;for(let n=0,s=i.length;n<s;n++){let s=i[n];for(let i=0,n=s.length,l=n-1;i<n;l=i++){let n=s[l],h=s[i];if(function(e,i,r){let a=e[0]-i[0],n=e[1]-i[1],s=e[0]-r[0],l=e[1]-r[1];return a*l-s*n==0&&a*s<=0&&n*l<=0}(e,n,h))return r;n[1]>e[1]!=h[1]>e[1]&&e[0]<(h[0]-n[0])*(e[1]-n[1])/(h[1]-n[1])+n[0]&&(a=!a)}}return a}function iA(e,i,r,a){let n=a[0]-r[0],s=a[1]-r[1],l=(e[0]-r[0])*s-n*(e[1]-r[1]),h=(i[0]-r[0])*s-n*(i[1]-r[1]);return l>0&&h<0||l<0&&h>0}function iI(e,i,r,a){var n,s;return 0!=(n=[a[0]-r[0],a[1]-r[1]])[0]*(s=[i[0]-e[0],i[1]-e[1]])[1]-n[1]*s[0]&&!(!iA(e,i,r,a)||
206!iA(r,a,e,i))}function iC(e,i){for(let r=0;r<e.length;++r)if(!iE(e[r],i))return!1;for(let r=0;r<e.length-1;++r)if(function(e,i,r){for(let a of r)for(let r=0,n=a.length,s=n-1;r<n;s=r++)if(iI(e,i,a[s],a[r]))return!0;return!1}(e[r],e[r+1],i))return!1;return!0}function iP(e,i,r){let a=[];for(let n=0;n<e.length;n++){let s=[];for(let a=0;a<e[n].length;a++){let l=function(e,i){let r=(180+e[0])/360,a=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e[1]*Math.PI/360)))/360,n=Math.pow(2,i.z);return[Math.round(r*n*8192),Math.round(a*n*8192)]}(e[n][a],r);iS(i,l),s.push(l)}a.push(s)}return a}function iL(e,i,r){let a=[];for(let n=0;n<e.length;n++){let s=iP(e[n],i,r);a.push(s)}return a}function ik(e,i,r,a){if(e[0]<r[0]||e[0]>r[2]){let i=.5*a,n=e[0]-r[0]>i?-a:r[0]-e[0]>i?a:0;0===n&&(n=e[0]-r[2]>i?-a:r[2]-e[0]>i?a:0),e[0]+=n}iS(i,e)}function iR(e,i,r,a){let n=8192*Math.pow(2,a.z),s=[8192*a.x,8192*a.y],l=[];if(!e)return l;for(let a of e)for(let e of a){let a=[e.x+s[0],e.y+s[1]];ik(a,i,r,n),l.push(a)}return l}function iz(e,i,r,a){let n=8192*Math.pow(2,a.z),s=[8192*a.x,8192*a.y],l=[];if(!e)return l;for(let r of e){let e=[];for(let a of r){let r=[a.x+s[0],a.y+s[1]];iS(i,r),e.push(r)}l.push(e)}if(i[2]-i[0]<=n/2)for(let e of(i[0]=i[1]=1/0,i[2]=i[3]=-1/0,l))for(let a of e)ik(a,i,r,n);return l}class iD{constructor(e,i){this.type=tY,this.geojson=e,this.geometries=i}static parse(e,i){if(2!==e.length)return i.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(ia(e[1])){let i=e[1];if("FeatureCollection"===i.type)for(let e=0;e<i.features.length;++e){let r=i.features[e].geometry.type;if("Polygon"===r||"MultiPolygon"===r)return new iD(i,i.features[e].geometry)}else if("Feature"===i.type){let e=i.geometry.type;if("Polygon"===e||"MultiPolygon"===e)return new iD(i,i.geometry)}else if("Polygon"===i.type||"MultiPolygon"===i.type)return new iD(i,i)}return i.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,i){let r=[1/0,1/0,-1/0,-1/0],a=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if(!n)return!1;if("Polygon"===i.type){let s=iP(i.coordinates,a,n),l=iR(e.geometry(),r,a,n);if(!iM(r,a))return!1;for(let e of l)if(!iE(e,s))return!1}if("MultiPolygon"===i.type){let s=iL(i.coordinates,a,n),l=iR(e.geometry(),r,a,n);if(!iM(r,a))return!1;for(let e of l)if(!function(e,i){for(let r=0;r<i.length;r++)if(iE(e,i[r]))return!0;return!1}(e,s))return!1}return!0}(e,this.geometries);if("LineString"===e.geometryType())return function(e,i){let r=[1/0,1/0,-1/0,-1/0],a=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if(!n)return!1;if("Polygon"===i.type){let s=iP(i.coordinates,a,n),l=iz(e.geometry(),r,a,n);if(!iM(r,a))return!1;for(let e of l)if(!iC(e,s))return!1}if("MultiPolygon"===i.type){let s=iL(i.coordinates,a,n),l=iz(e.geometry(),r,a,n);if(!iM(r,a))return!1;for(let e of l)if(!function(e,i){for(let r=0;r<i.length;r++)if(iC(e,i[r]))return!0;return!1}(e,s))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}let iO={kilometers:1,miles:1e3/1609.344,nauticalmiles:1e3/1852,meters:1e3,metres:1e3,yards:1e3/.9144,feet:1e3/.3048,inches:1e3/.0254},iB=1/298.257223563*(2-1/298.257223563),iF=Math.PI/180;class iN{static fromTile(e,i,r){let a=Math.PI*(1-2*(e+.5)/Math.pow(2,i));return new iN(Math.atan(.5*(Math.exp(a)-Math.exp(-a)))/iF,r)}static get units(){return iO}constructor(e,i){if(void 0===e)throw Error("No latitude given.");if(i&&!iO[i])throw Error(`Unknown unit ${i}. Use one of: ${Object.keys(iO).join(", ")}`);let r=6378.137*iF*(i?iO[i]:1),a=Math.cos(e*iF),n=1/(1-iB*(1-a*a)),s=Math.sqrt(n);this.kx=r*s*a,this.ky=r*s*n*(1-iB)}distance(e,i){let r=ij(e[0]-i[0])*this.kx,a=(e[1]-i[1])*this.ky;return Math.sqrt(r*r+a*a)}bearing(e,i){return Math.atan2(ij(i[0]-e[0])*this.kx,(i[1]-e[1])*this.ky)/iF}destination(e,i,r){let a=r*iF;return this.offset(e,Math.sin(a)*i,Math.cos(a)*i)}offset(e,i,r){return[e[0]+i/this.kx,e[1]+r/this.ky]}lineDistance(e){let i=0;for(let r=0;r<e.length-1;r++)i+=this.distance(e[r],e[r+1]);return i}area(e){let i=0;for(let r=0;r<e.length;r++){let a=e[r];for(let e=0,n=a.length,s=n-1;e<n;s=e++)i+=ij(a[e][0]-a[s][0])*(a[e][1]+a[s][1])*(r?-1:1)}return Math.abs(i)/2*this.kx*this.ky}along(e,i){let r=0;if(i<=0)return e[0];for(let a=0;a<e.length-1;a++){let n=e[a],s=e[a+1],l=this.distance(n,s);if((r+=l)>i)return iU(n,s,(i-(r-l))/l)}return e[e.length-1]}pointToSegmentDistance(e,i,r){let[a,n]=i,s=ij(r[0]-a)*this.kx,l=(r[1]-n)*this.ky;if(0!==s||0!==l){let i=(ij(e[0]-a)*this.kx*s+(e[1]-n)*this.ky*l)/(s*s+l*l);i>1?(a=r[0],n=r[1]):i>0&&(a+=s/this.kx*i,n+=l/this.ky*i)}return Math.sqrt((s=ij(e[0]-a)*this.kx)*s+(l=(e[1]-n)*this.ky)*l)}pointOnLine(e,i){let r=1/0,a=e[0][0],n=e[0][1],s=0,l=0;for(let h=0;h<e.length-1;h++){let u=e[h][0],c=e[h][1],d=ij(e[h+1][0]-u)*this.kx,p=(e[h+1][1]-c)*this.ky,f=0;0===d&&0===p||((f=(ij(i[0]-u)*this.kx*d+(i[1]-c)*this.ky*p)/(d*d+p*p))>1?(u=e[h+1][0],c=e[h+1][1]):f>0&&(u+=d/this.kx*f,c+=p/this.ky*f));let m=(d=ij(i[0]-u)*this.kx)*d+(p=(i[1]-c)*this.ky)*p;m<r&&(r=m,a=u,n=c,s=h,l=f)}return{point:[a,n],index:s,t:Math.max(0,Math.min(1,l))}}lineSlice(e,i,r){let a=this.pointOnLine(r,e),n=this.pointOnLine(r,i);if(a.index>n.index||a.index===n.index&&a.t>n.t){let e=a;a=n,n=e}let s=[a.point],l=a.index+1,h=n.index;!iV(r[l],s[0])&&l<=h&&s.push(r[l]);for(let e=l+1;e<=h;e++)s.push(r[e]);return iV(r[h],n.point)||s.push(n.point),s}lineSliceAlong(e,i,r){let a=0,n=[];for(let s=0;s<r.length-1;s++){let l=r[s],h=r[s+1],u=this.distance(l,h);if((a+=u)>e&&0===n.length&&n.push(iU(l,h,(e-(a-u))/u)),a>=i)return n.push(iU(l,h,(i-(a-u))/u)),n;a>e&&n.push(h)}return n}bufferPoint(e,i){let r=i/this.ky,a=i/this.kx;return[e[0]-a,e[1]-r,e[0]+a,e[1]+r]}bufferBBox(e,i){let r=i/this.ky,a=i/this.kx;return[e[0]-a,e[1]-r,e[2]+a,e[3]+r]}insideBBox(e,i){return ij(e[0]-i[0])>=0&&0>=ij(e[0]-i[2])&&e[1]>=i[1]&&e[1]<=i[3]}}function iV(e,i){return e[0]===i[0]&&e[1]===i[1]}function iU(e,i,r){let a=ij(i[0]-e[0]);return[e[0]+a*r,e[1]+(i[1]-e[1])*r]}function ij(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}class iG{constructor(e=[],i=(e,i)=>e<i?-1:+(e>i)){if(this.data=e,this.length=this.data.length,this.compare=i,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;let e=this.data[0],i=this.data.pop();return--this.length>0&&(this.data[0]=i,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:i,compare:r}=this,a=i[e];for(;e>0;){let n=e-1>>1,s=i[n];if(r(a,s)>=0)break;i[e]=s,e=n}i[e]=a}_down(e){let{data:i,compare:r}=this,a=this.length>>1,n=i[e];for(;e<a;){let a=1+(e<<1),s=a+1;if(s<this.length&&0>r(i[s],i[a])&&(a=s),r(i[a],n)>=0)break;i[e]=i[a],e=a}i[e]=n}}function iq(e,i){return i.dist-e.dist}function iW(e){let i=[1/0,1/0,-1/0,-1/0];if(i.length!==e.length)return!1;for(let r=0;r<i.length;r++)if(i[r]!==e[r])return!1;return!0}function i$(e){return e[1]-e[0]+1}function iH(e,i){let r=e[1]>=e[0]&&e[1]<i;return r||console.warn("Distance Expression: Index is out of range"),r}function iZ(e,i){if(e[0]>
206e[1])return[null,null];let r=i$(e);if(i){if(2===r)return[e,null];let i=Math.floor(r/2);return[[e[0],e[0]+i],[e[0]+i,e[1]]]}{if(1===r)return[e,null];let i=Math.floor(r/2)-1;return[[e[0],e[0]+i],[e[0]+i+1,e[1]]]}}function iX(e,i){let r=[1/0,1/0,-1/0,-1/0];if(!iH(i,e.length))return r;for(let a=i[0];a<=i[1];++a)iS(r,e[a]);return r}function iY(e){let i=[1/0,1/0,-1/0,-1/0];for(let r=0;r<e.length;++r)for(let a=0;a<e[r].length;++a)iS(i,e[r][a]);return i}function iJ(e,i,r){if(iW(e)||iW(i))return NaN;let a=0,n=0;return e[2]<i[0]&&(a=i[0]-e[2]),e[0]>i[2]&&(a=e[0]-i[2]),e[1]>i[3]&&(n=e[1]-i[3]),e[3]<i[1]&&(n=i[1]-e[3]),r.distance([0,0],[a,n])}function iK(e,i){let r=Math.pow(2,i.z),a=(e.y/8192+i.y)/r;return[360*((e.x/8192+i.x)/r)-180,360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90]}function iQ(e,i,r){let a=r.pointOnLine(i,e).point;return r.distance(e,a)}function i0(e,i,r,a,n){let s=r.slice(a[0],a[1]+1),l=1/0;for(let r=i[0];r<=i[1];++r)if(0===(l=Math.min(l,iQ(e[r],s,n))))return 0;return l}function i1(e,i,r,a,n){return Math.min(Math.min(n.pointToSegmentDistance(e,r,a),n.pointToSegmentDistance(i,r,a)),Math.min(n.pointToSegmentDistance(r,e,i),n.pointToSegmentDistance(a,e,i)))}function i2(e,i){for(let r of e)for(let e=0;e<=r.length-1;++e)if(iE(r[e],i,!0))return!0;return!1}function i3(e,i,r,a,n,s,l){if(null===s||null===l)return;let h=iJ(iX(a,s),iX(n,l),r);h<i&&e.push({dist:h,range1:s,range2:l})}function i4(e,i,r,a,n,s=1/0){let l=Math.min(s,n.distance(e[0],r[0]));if(0===l)return l;let h=new iG([{dist:0,range1:[0,e.length-1],range2:[0,r.length-1]}],iq),u=i?50:100,c=a?50:100;for(;h.length;){let s=h.pop();if(s.dist>=l)continue;let d=s.range1,p=s.range2;if(i$(d)<=u&&i$(p)<=c){if(!iH(d,e.length)||!iH(p,r.length))return NaN;if(i&&a?l=Math.min(l,function(e,i,r,a,n){if(!iH(i,e.length)||!iH(a,r.length))return NaN;let s=1/0;for(let l=i[0];l<i[1];++l)for(let i=a[0];i<a[1];++i){if(iI(e[l],e[l+1],r[i],r[i+1]))return 0;s=Math.min(s,i1(e[l],e[l+1],r[i],r[i+1],n))}return s}(e,d,r,p,n)):i||a?i&&!a?l=Math.min(l,i0(r,p,e,d,n)):!i&&a&&(l=Math.min(l,i0(e,d,r,p,n))):l=Math.min(l,function(e,i,r,a,n){if(!iH(i,e.length)||!iH(a,r.length))return NaN;let s=1/0;for(let l=i[0];l<=i[1];++l)for(let i=a[0];i<=a[1];++i)if(0===(s=Math.min(s,n.distance(e[l],r[i]))))return s;return s}(e,d,r,p,n)),0===l)break}else{let s=iZ(d,i),u=iZ(p,a);i3(h,l,n,e,r,s[0],u[0]),i3(h,l,n,e,r,s[0],u[1]),i3(h,l,n,e,r,s[1],u[0]),i3(h,l,n,e,r,s[1],u[1])}}return l}function i5(e,i,r,a,n=1/0){let s=n,l=iX(e,[0,e.length-1]);for(let n of r)if(!(s!==1/0&&iJ(l,iX(n,[0,n.length-1]),a)>=s)&&0===(s=Math.min(s,i4(e,i,n,!0,a,s))))break;return s}function i6(e,i,r,a,n=1/0){let s=n,l=iX(e,[0,e.length-1]);for(let n of r){if(s!==1/0&&iJ(l,iY(n),a)>=s)continue;let r=function(e,i,r,a,n=1/0){let s=Math.min(a.distance(e[0],r[0][0]),n);if(0===s)return s;let l=new iG([{dist:0,range1:[0,e.length-1],range2:[0,0]}],iq),h=i?50:100,u=iY(r);for(;l.length;){let n=l.pop();if(n.dist>=s)continue;let c=n.range1;if(i$(c)<=h){if(!iH(c,e.length))return NaN;if(i){if(0===(s=Math.min(s,function(e,i,r,a){if(!iH(i,e.length))return NaN;for(let a=i[0];a<=i[1];++a)if(iE(e[a],r,!0))return 0;let n=1/0;for(let s=i[0];s<i[1];++s)for(let i of r)for(let r=0,l=i.length,h=l-1;r<l;h=r++){if(iI(e[s],e[s+1],i[h],i[r]))return 0;n=Math.min(n,i1(e[s],e[s+1],i[h],i[r],a))}return n}(e,c,r,a))))break}else for(let i=c[0];i<=c[1];++i)if(0===(s=Math.min(s,function(e,i,r){if(iE(e,i,!0))return 0;let a=1/0;for(let n of i){let i=n.length;if(i<2)return console.warn("Distance Expression: Invalid polygon!"),NaN;if(n[0]!==n[i-1]&&0===(a=Math.min(a,r.pointToSegmentDistance(e,n[i-1],n[0])))||0===(a=Math.min(a,iQ(e,n,r))))break}return a}(e[i],r,a))))return s}else{let r=iZ(c,i);if(null!==r[0]){let i=iJ(iX(e,r[0]),u,a);i<s&&l.push({dist:i,range1:r[0],range2:[0,0]})}if(null!==r[1]){let i=iJ(iX(e,r[1]),u,a);i<s&&l.push({dist:i,range1:r[1],range2:[0,0]})}}}return s}(e,i,n,a,s);if(isNaN(r))return r;if(0===(s=Math.min(s,r)))break}return s}function i8(e){return"Point"===e||"MultiPoint"===e||"LineString"===e||"MultiLineString"===e||"Polygon"===e||"MultiPolygon"===e}class i9{constructor(e,i){this.type=tZ,this.geojson=e,this.geometries=i}static parse(e,i){if(2!==e.length)return i.error(`'distance' expression requires either one argument, but found ' ${e.length-1} instead.`);if(ia(e[1])){let i=e[1];
206if("FeatureCollection"===i.type){for(let e=0;e<i.features.length;++e)if(i8(i.features[e].geometry.type))return new i9(i,i.features[e].geometry)}else if("Feature"===i.type){if(i8(i.geometry.type))return new i9(i,i.geometry)}else if(i8(i.type))return new i9(i,i)}return i.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].")}evaluate(e){let i=e.geometry(),r=e.canonicalID();if(null!=i&&null!=r){if("Point"===e.geometryType())return function(e,i,r){let a=[];for(let r of e)for(let e of r)a.push(iK(e,i));let n=new iN(a[0][1],"meters");return"Point"===r.type||"MultiPoint"===r.type||"LineString"===r.type?i4(a,!1,"Point"===r.type?[r.coordinates]:r.coordinates,"LineString"===r.type,n):"MultiLineString"===r.type?i5(a,!1,r.coordinates,n):"Polygon"===r.type||"MultiPolygon"===r.type?i6(a,!1,"Polygon"===r.type?[r.coordinates]:r.coordinates,n):null}(i,r,this.geometries);if("LineString"===e.geometryType())return function(e,i,r){let a=[];for(let r of e){let e=[];for(let a of r)e.push(iK(a,i));a.push(e)}let n=new iN(a[0][0][1],"meters");if("Point"===r.type||"MultiPoint"===r.type||"LineString"===r.type)return i5("Point"===r.type?[r.coordinates]:r.coordinates,"LineString"===r.type,a,n);if("MultiLineString"===r.type){let e=1/0;for(let i=0;i<r.coordinates.length;i++){let s=i5(r.coordinates[i],!0,a,n,e);if(isNaN(s))return s;if(0===(e=Math.min(e,s)))break}return e}if("Polygon"===r.type||"MultiPolygon"===r.type){let e=1/0;for(let i=0;i<a.length;i++){let s=i6(a[i],!0,"Polygon"===r.type?[r.coordinates]:r.coordinates,n,e);if(isNaN(s))return s;if(0===(e=Math.min(e,s)))break}return e}return null}(i,r,this.geometries);if("Polygon"===e.geometryType())return function(e,i,r){let a=[];for(let r of function(e,i){let r,a;let n=e.length;if(n<=1)return[e];let s=[];for(let i=0;i<n;i++){let n=function(e){let i=0;for(let r,a,n=0,s=e.length,l=s-1;n<s;l=n++)r=e[n],i+=((a=e[l]).x-r.x)*(r.y+a.y);return i}(e[i]);0!==n&&(e[i].area=Math.abs(n),void 0===a&&(a=n<0),a===n<0?(r&&s.push(r),r=[e[i]]):r.push(e[i]))}return r&&s.push(r),s}(e)){let e=[];for(let a=0;a<r.length;++a)e.push(function(e,i){let r=[];for(let a=0;a<e.length;++a)r.push(iK(e[a],i));return r}(r[a],i));a.push(e)}let n=new iN(a[0][0][0][1],"meters");if("Point"===r.type||"MultiPoint"===r.type||"LineString"===r.type)return i6("Point"===r.type?[r.coordinates]:r.coordinates,"LineString"===r.type,a,n);if("MultiLineString"===r.type){let e=1/0;for(let i=0;i<r.coordinates.length;i++){let s=i6(r.coordinates[i],!0,a,n,e);if(isNaN(s))return s;if(0===(e=Math.min(e,s)))break}return e}return"Polygon"===r.type||"MultiPolygon"===r.type?function(e,i,r){let a=1/0;for(let n of e)for(let e of i){let i=function(e,i,r,a=1/0){let n=iY(e),s=iY(i);if(a!==1/0&&iJ(n,s,r)>=a)return a;if(iM(n,s)){if(i2(e,i))return 0}else if(i2(i,e))return 0;let l=a;for(let a of e)for(let e=0,n=a.length,s=n-1;e<n;s=e++)for(let n of i)for(let i=0,h=n.length,u=h-1;i<h;u=i++){if(iI(a[s],a[e],n[u],n[i]))return 0;l=Math.min(l,i1(a[s],a[e],n[u],n[i],r))}return l}(n,e,r,a);if(isNaN(i))return i;if(0===(a=Math.min(a,i)))return a}return a}("Polygon"===r.type?[r.coordinates]:r.coordinates,a,n):null}(i,r,this.geometries);console.warn("Distance Expression: currently only evaluates valid Point/LineString/Polygon geometries.")}else console.warn("Distance Expression: requirs valid feature and canonical information.");return null}eachChild(){}outputDefined(){return!0}serialize(){return["distance",this.geojson]}}function i7(e,i){switch(e){case"string":return is(i);case"number":return+i;case"boolean":return!!i;case"color":return tN.parse(i);case"formatted":return it.fromString(is(i));case"resolvedImage":return ii.fromString(is(i))}return i}function re(e,i,r,a){return void 0!==a&&(e=a*Math.round(e/a)),void 0!==i&&e<i&&(e=i),void 0!==r&&e>r&&(e=r),e}class rt{constructor(e,i,r){this.type=e,this.key=i,this.scope=r}static parse(e,i){let r=i.expectedType;if(null==r&&(r=tQ),e.length<2||e.length>3)return i.error("Invalid number of arguments for 'config' expression.");let a=i.parse(e[1],1);if(!(a instanceof il))return i.error("Key name of 'config' expression must be a string literal.");if(e.length>=3){let n=i.parse(e[2],2);return n instanceof il?new rt(r,is(a.value),is(n.value)):i.error("Scope of 'config' expression must be a string literal.")}return new rt(r,is(a.value))}
206evaluate(e){let i=[this.key,this.scope,e.scope].filter(Boolean).join("\x1f"),r=e.getConfig(i);if(!r)return null;let{type:a,value:n,values:s,minValue:l,maxValue:h,stepValue:u}=r,c=r.default.evaluate(e),d=c;if(n){let i=e.scope;e.scope=(i||"").split("\x1f").slice(1).join("\x1f"),d=n.evaluate(e),e.scope=i}return a&&(d=i7(a,d)),void 0===d||void 0===l&&void 0===h&&void 0===u||("number"==typeof d?d=re(d,l,h,u):Array.isArray(d)&&(d=d.map(e=>"number"==typeof e?re(e,l,h,u):e))),void 0!==n&&void 0!==d&&s&&!s.includes(d)&&(d=c,a&&(d=i7(a,d))),(a&&a!==this.type||void 0!==d&&io(d)!==this.type)&&(d=i7(this.type.kind,d)),d}eachChild(){}outputDefined(){return!1}serialize(){let e=["config",this.key];return this.scope&&e.concat(this.key),e}}function ri(e){if(e instanceof iv&&("get"===e.name&&1===e.args.length||"feature-state"===e.name||"has"===e.name&&1===e.args.length||"properties"===e.name||"geometry-type"===e.name||"id"===e.name||/^filter-/.test(e.name))||e instanceof iD||e instanceof i9)return!1;let i=!0;return e.eachChild(e=>{i&&!ri(e)&&(i=!1)}),i}function rr(e){if(e instanceof iv&&"feature-state"===e.name)return!1;let i=!0;return e.eachChild(e=>{i&&!rr(e)&&(i=!1)}),i}function ra(e){if(e instanceof rt)return new Set([e.key]);let i=new Set;return e.eachChild(e=>{i=new Set([...i,...ra(e)])}),i}function rn(e,i){if(e instanceof iv&&i.indexOf(e.name)>=0)return!1;let r=!0;return e.eachChild(e=>{r&&!rn(e,i)&&(r=!1)}),r}class ro{constructor(e,i){this.type=i.type,this.name=e,this.boundExpression=i}static parse(e,i){if(2!==e.length||"string"!=typeof e[1])return i.error("'var' expression requires exactly one string literal argument.");let r=e[1];return i.scope.has(r)?new ro(r,i.scope.get(r)):i.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}serialize(){return["var",this.name]}}class rs{constructor(e,i=[],r,a=new t$,n=[],s,l){this.registry=e,this.path=i,this.key=i.map(e=>"string"==typeof e?`['${e}']`:`[${e}]`).join(""),this.scope=a,this.errors=n,this.expectedType=r,this._scope=s,this.options=l}parse(e,i,r,a,n={}){return i||r?this.concat(i,null,r,a)._parse(e,n):this._parse(e,n)}parseObjectValue(e,i,r,a,n,s={}){return this.concat(i,r,a,n)._parse(e,s)}_parse(e,i){function r(e,i,r){return"assert"===r?new ic(i,[e]):"coerce"===r?new ig(i,[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", []].');let a="string"==typeof e[0]?this.registry[e[0]]:void 0;if(a){let n=a.parse(e,this);if(!n)return null;if(this.expectedType){let e=this.expectedType,a=n.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==a.kind){if("color"!==e.kind&&"formatted"!==e.kind&&"resolvedImage"!==e.kind||"value"!==a.kind&&"string"!==a.kind){if(this.checkSubtype(e,a))return null}else n=r(n,e,i.typeAnnotation||"coerce")}else n=r(n,e,i.typeAnnotation||"assert")}if(!(n instanceof il)&&"resolvedImage"!==n.type.kind&&function e(i){if(i instanceof ro)return e(i.boundExpression);if(i instanceof iv&&"error"===i.name||i instanceof iw||i instanceof iD||i instanceof i9||i instanceof rt)return!1;let r=i instanceof ig||i instanceof ic,a=!0;return i.eachChild(i=>{a=r?a&&e(i):a&&i instanceof il}),!!a&&ri(i)&&rn(i,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])}(n)){let e=new ix(this._scope,this.options);try{n=new il(n.type,n.evaluate(e))}catch(e){return this.error(e.message),null}}return n}return ig.parse(["to-array",e],this)}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,i,r,a){let n="number"==typeof e?this.path.concat(e):this.path;n="string"==typeof i?n.concat(i):n;let s=a?this.scope.concat(a):this.scope;return new rs(this.registry,n,r||null,s,this.errors,this._scope,this.options)}error(e,...i){let r=`${this.key}${i.map(e=>`[${e}]`).join("")}`;this.errors.push(new tW(r,e))}checkSubtype(e,i){let r=t6(e,i);return r&&this.error(r),r}}var rl=rs;function rh(e,i){let r=e.length-1,a,n,s=0,l=r,h=0;for(;s<=l;)if(a=e[h=Math.floor((s+l)/2)],n=e[h+1],a<=i){if(h===r||i<n)return h;s=h+1}else{if(!(a>i))throw new ih("Input is not a number.");l=h-1}return 0}
206class ru{constructor(e,i,r){for(let[a,n]of(this.type=e,this.input=i,this.labels=[],this.outputs=[],r))this.labels.push(a),this.outputs.push(n)}static parse(e,i){if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");let r=i.parse(e[1],1,tZ);if(!r)return null;let a=[],n=null;i.expectedType&&"value"!==i.expectedType.kind&&(n=i.expectedType);for(let r=1;r<e.length;r+=2){let s=1===r?-1/0:e[r],l=e[r+1],h=r,u=r+1;if("number"!=typeof s)return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',h);if(a.length&&a[a.length-1][0]>=s)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',h);let c=i.parse(l,u,n);if(!c)return null;n=n||c.type,a.push([s,c])}return new ru(n,r,a)}evaluate(e){let i=this.labels,r=this.outputs;if(1===i.length)return r[0].evaluate(e);let a=this.input.evaluate(e);if(a<=i[0])return r[0].evaluate(e);let n=i.length;return a>=i[n-1]?r[n-1].evaluate(e):r[rh(i,a)].evaluate(e)}eachChild(e){for(let i of(e(this.input),this.outputs))e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){let e=["step",this.input.serialize()];for(let i=0;i<this.labels.length;i++)i>0&&e.push(this.labels[i]),e.push(this.outputs[i].serialize());return e}}let rc=4/29,rd=6/29,rp=6/29*3*(6/29),rf=6/29*(6/29)*(6/29),rm=Math.PI/180,r_=180/Math.PI;function rg(e){return e>rf?Math.pow(e,1/3):e/rp+rc}function ry(e){return e>rd?e*e*e:rp*(e-rc)}function rx(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function rv(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function rb(e){let i=rv(e.r),r=rv(e.g),a=rv(e.b),n=rg((.4124564*i+.3575761*r+.1804375*a)/.95047),s=rg((.2126729*i+.7151522*r+.072175*a)/1);return{l:116*s-16,a:500*(n-s),b:200*(s-rg((.0193339*i+.119192*r+.9503041*a)/1.08883)),alpha:e.a}}function rw(e){let i=(e.l+16)/116,r=isNaN(e.a)?i:i+e.a/500,a=isNaN(e.b)?i:i-e.b/200;return i=+ry(i),new tN(rx(3.2404542*(r=.95047*ry(r))-1.5371385*i-.4985314*(a=1.08883*ry(a))),rx(-.969266*r+1.8760108*i+.041556*a),rx(.0556434*r-.2040259*i+1.0572252*a),e.alpha)}let rT={forward:rb,reverse:rw,interpolate:function(e,i,r){return{l:tU(e.l,i.l,r),a:tU(e.a,i.a,r),b:tU(e.b,i.b,r),alpha:tU(e.alpha,i.alpha,r)}}},rS={forward:function(e){let{l:i,a:r,b:a}=rb(e),n=Math.atan2(a,r)*r_;return{h:n<0?n+360:n,c:Math.sqrt(r*r+a*a),l:i,alpha:e.a}},reverse:function(e){let i=e.h*rm,r=e.c;return rw({l:e.l,a:Math.cos(i)*r,b:Math.sin(i)*r,alpha:e.alpha})},interpolate:function(e,i,r){return{h:function(e,i,r){let a=i-e;return e+r*(a>180||a<-180?a-360*Math.round(a/360):a)}(e.h,i.h,r),c:tU(e.c,i.c,r),l:tU(e.l,i.l,r),alpha:tU(e.alpha,i.alpha,r)}}};var rM=Object.freeze({__proto__:null,hcl:rS,lab:rT});class rE{constructor(e,i,r,a,n){for(let[s,l]of(this.type=e,this.operator=i,this.interpolation=r,this.input=a,this.labels=[],this.outputs=[],n))this.labels.push(s),this.outputs.push(l)}static interpolationFactor(e,i,r,a){let n=0;if("exponential"===e.name)n=rA(i,e.base,r,a);else if("linear"===e.name)n=rA(i,1,r,a);else if("cubic-bezier"===e.name){let s=e.controlPoints;n=new eM(s[0],s[1],s[2],s[3]).solve(rA(i,1,r,a))}return n}static parse(e,i){let[r,a,n,...s]=e;if(!Array.isArray(a)||0===a.length)return i.error("Expected an interpolation type expression.",1);if("linear"===a[0])a={name:"linear"};else if("exponential"===a[0]){let e=a[1];if("number"!=typeof e)return i.error("Exponential interpolation requires a numeric base.",1,1);a={name:"exponential",base:e}}else{if("cubic-bezier"!==a[0])return i.error(`Unknown interpolation type ${String(a[0])}`,1,0);{let e=a.slice(1);if(4!==e.length||e.some(e=>"number"!=typeof e||e<0||e>1))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);a={name:"cubic-bezier",controlPoints:e}}}if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(!(n=i.parse(n,2,tZ)))return null;let l=[],h=null;"interpolate-hcl"===r||"interpolate-lab"===r?h=tJ:i.expectedType&&"value"!==i.expectedType.kind&&(h=i.expectedType);for(let e=0;e<s.length;e+=2){let r=s[e],a=s[e+1],n=e+3,u=e+4;if("number"!=typeof r)return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not c
206omputed expressions) for the input values.',n);if(l.length&&l[l.length-1][0]>=r)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',n);let c=i.parse(a,u,h);if(!c)return null;h=h||c.type,l.push([r,c])}return"number"===h.kind||"color"===h.kind||"array"===h.kind&&"number"===h.itemType.kind&&"number"==typeof h.N?new rE(h,r,a,n,l):i.error(`Type ${t4(h)} is not interpolatable.`)}evaluate(e){let i=this.labels,r=this.outputs;if(1===i.length)return r[0].evaluate(e);let a=this.input.evaluate(e);if(a<=i[0])return r[0].evaluate(e);let n=i.length;if(a>=i[n-1])return r[n-1].evaluate(e);let s=rh(i,a),l=rE.interpolationFactor(this.interpolation,a,i[s],i[s+1]),h=r[s].evaluate(e),u=r[s+1].evaluate(e);return"interpolate"===this.operator?tG[this.type.kind.toLowerCase()](h,u,l):"interpolate-hcl"===this.operator?rS.reverse(rS.interpolate(rS.forward(h),rS.forward(u),l)):rT.reverse(rT.interpolate(rT.forward(h),rT.forward(u),l))}eachChild(e){for(let i of(e(this.input),this.outputs))e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){let e;e="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);let i=[this.operator,e,this.input.serialize()];for(let e=0;e<this.labels.length;e++)i.push(this.labels[e],this.outputs[e].serialize());return i}}function rA(e,i,r,a){let n=a-r,s=e-r;return 0===n?0:1===i?s/n:(Math.pow(i,s)-1)/(Math.pow(i,n)-1)}class rI{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expectected at least one argument.");let r=null,a=i.expectedType;a&&"value"!==a.kind&&(r=a);let n=[];for(let a of e.slice(1)){let e=i.parse(a,1+n.length,r,void 0,{typeAnnotation:"omit"});if(!e)return null;r=r||e.type,n.push(e)}return new rI(a&&n.some(e=>t6(a,e.type))?tQ:r,n)}evaluate(e){let i,r=null,a=0;for(let n of this.args){if(a++,(r=n.evaluate(e))&&r instanceof ii&&!r.available&&(i||(i=r),r=null,a===this.args.length))return i;if(null!==r)break}return r}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){let e=["coalesce"];return this.eachChild(i=>{e.push(i.serialize())}),e}}class rC{constructor(e,i){this.type=i.type,this.bindings=[].concat(e),this.result=i}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let i of this.bindings)e(i[1]);e(this.result)}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);let r=[];for(let a=1;a<e.length-1;a+=2){let n=e[a];if("string"!=typeof n)return i.error(`Expected string, but found ${typeof n} instead.`,a);if(/[^a-zA-Z0-9_]/.test(n))return i.error("Variable names must contain only alphanumeric characters or '_'.",a);let s=i.parse(e[a+1],a+1);if(!s)return null;r.push([n,s])}let a=i.parse(e[e.length-1],e.length-1,i.expectedType,r);return a?new rC(r,a):null}outputDefined(){return this.result.outputDefined()}serialize(){let e=["let"];for(let[i,r]of this.bindings)e.push(i,r.serialize());return e.push(this.result.serialize()),e}}class rP{constructor(e,i,r){this.type=e,this.index=i,this.input=r}static parse(e,i){if(3!==e.length)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let r=i.parse(e[1],1,tZ),a=i.parse(e[2],2,t3(i.expectedType||tQ));return r&&a?new rP(a.type.itemType,r,a):null}evaluate(e){let i=this.index.evaluate(e),r=this.input.evaluate(e);if(i<0)throw new ih(`Array index out of bounds: ${i} < 0.`);if(i>r.length-1)throw new ih(`Array index out of bounds: ${i} > ${r.length-1}.`);if(i===Math.floor(i))return r[i];let a=Math.floor(i),n=Math.ceil(i),s=r[a],l=r[n];if("number"!=typeof s||"number"!=typeof l)throw new ih(`Cannot interpolate between non-number values at index ${i}.`);let h=i-a;return s*(1-h)+l*h}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class rL{constructor(e,i){this.type=tY,this.needle=e,this.haystack=i}static parse(e,i){if(3!==e.length)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let r=i.parse(e[1],1,tQ),a=i.parse(e[2],2,tQ);return r&&a?t8(r.type,[tY,tX,tZ,tH,tQ])?new rL(r,a):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${t4(r.type)} instead`):null}evaluate(e){let i=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(null==r)return!1;if(!t9(i,["boolean","string","number","null"]))throw new ih(`Expected first argument to be of type boolean, string, number or null, but found ${t4(io(i))} instead.`);if(!t9(r,["string","array"]))throw new ih(`Expected second argument to be of type array or string, but found ${t4(io(r))} instead.`);return r.indexOf(i)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class rk{constructor(e,i,r){this.type=tZ,this.needle=e,this.haystack=i,this.fromIndex=r}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);let r=i.parse(e[1],1,tQ),a=i.parse(e[2],2,tQ);if(!r||!a)return null;if(!t8(r.type,[tY,tX,tZ,tH,tQ]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${t4(r.type)} instead`);if(4===e.length){let n=i.parse(e[3],3,tZ);return n?new rk(r,a,n):null}return new rk(r,a)}evaluate(e){let i=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(!t9(i,["boolean","string","number","null"]))throw new ih(`Expected first argument to be of type boolean, string, number or null, but found ${t4(io(i))} instead.`);if(!t9(r,["string","array"]))throw new ih(`Expected second argument to be of type array or string, but found ${t4(io(r))} instead.`);if(this.fromIndex){let a=this.fromIndex.evaluate(e);return r.indexOf(i,a)}return r.indexOf(i)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){let e=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),e]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class rR{constructor(e,i,r,a,n,s){this.inputType=e,this.type=i,this.input=r,this.cases=a,this.outputs=n,this.otherwise=s}static parse(e,i){let r,a;
206if(e.length<5)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return i.error("Expected an even number of arguments.");i.expectedType&&"value"!==i.expectedType.kind&&(a=i.expectedType);let n={},s=[];for(let l=2;l<e.length-1;l+=2){let h=e[l],u=e[l+1];Array.isArray(h)||(h=[h]);let c=i.concat(l);if(0===h.length)return c.error("Expected at least one branch label.");for(let e of h){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,io(e)))return null}else r=io(e);if(void 0!==n[String(e)])return c.error("Branch labels must be unique.");n[String(e)]=s.length}let d=i.parse(u,l,a);if(!d)return null;a=a||d.type,s.push(d)}let l=i.parse(e[1],1,tQ);if(!l)return null;let h=i.parse(e[e.length-1],e.length-1,a);return h?"value"!==l.type.kind&&i.concat(1).checkSubtype(r,l.type)?null:new rR(r,a,l,n,s,h):null}evaluate(e){let i=this.input.evaluate(e);return(io(i)===this.inputType&&this.outputs[this.cases[i]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}serialize(){let e=["match",this.input.serialize()],i=Object.keys(this.cases).sort(),r=[],a={};for(let e of i){let i=a[this.cases[e]];void 0===i?(a[this.cases[e]]=r.length,r.push([this.cases[e],[e]])):r[i][1].push(e)}let n=e=>"number"===this.inputType.kind?Number(e):e;for(let[i,a]of r)e.push(1===a.length?n(a[0]):a.map(n)),e.push(this.outputs[i].serialize());return e.push(this.otherwise.serialize()),e}}class rz{constructor(e,i,r){this.type=e,this.branches=i,this.otherwise=r}static parse(e,i){let r;if(e.length<4)return i.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return i.error("Expected an odd number of arguments.");i.expectedType&&"value"!==i.expectedType.kind&&(r=i.expectedType);let a=[];for(let n=1;n<e.length-1;n+=2){let s=i.parse(e[n],n,tY);if(!s)return null;let l=i.parse(e[n+1],n+1,r);if(!l)return null;a.push([s,l]),r=r||l.type}let n=i.parse(e[e.length-1],e.length-1,r);return n?new rz(r,a,n):null}evaluate(e){for(let[i,r]of this.branches)if(i.evaluate(e))return r.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(let[i,r]of this.branches)e(i),e(r);e(this.otherwise)}outputDefined(){return this.branches.every(([e,i])=>i.outputDefined())&&this.otherwise.outputDefined()}serialize(){let e=["case"];return this.eachChild(i=>{e.push(i.serialize())}),e}}class rD{constructor(e,i,r,a){this.type=e,this.input=i,this.beginIndex=r,this.endIndex=a}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);let r=i.parse(e[1],1,tQ),a=i.parse(e[2],2,tZ);if(!r||!a)return null;if(!t8(r.type,[t3(tQ),tX,tQ]))return i.error(`Expected first argument to be of type array or string, but found ${t4(r.type)} instead`);if(4===e.length){let n=i.parse(e[3],3,tZ);return n?new rD(r.type,r,a,n):null}return new rD(r.type,r,a)}evaluate(e){let i=this.input.evaluate(e),r=this.beginIndex.evaluate(e);if(!t9(i,["string","array"]))throw new ih(`Expected first argument to be of type array or string, but found ${t4(io(i))} instead.`);if(this.endIndex){let a=this.endIndex.evaluate(e);return i.slice(r,a)}return i.slice(r)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){let e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}function rO(e,i){return"=="===e||"!="===e?"boolean"===i.kind||"string"===i.kind||"number"===i.kind||"null"===i.kind||"value"===i.kind:"string"===i.kind||"number"===i.kind||"value"===i.kind}function rB(e,i,r,a){return 0===a.compare(i,r)}function rF(e,i,r){let a="=="!==e&&"!="!==e;
206return class n{constructor(e,i,r){this.type=tY,this.lhs=e,this.rhs=i,this.collator=r,this.hasUntypedArgument="value"===e.type.kind||"value"===i.type.kind}static parse(e,i){if(3!==e.length&&4!==e.length)return i.error("Expected two or three arguments.");let r=e[0],s=i.parse(e[1],1,tQ);if(!s)return null;if(!rO(r,s.type))return i.concat(1).error(`"${r}" comparisons are not supported for type '${t4(s.type)}'.`);let l=i.parse(e[2],2,tQ);if(!l)return null;if(!rO(r,l.type))return i.concat(2).error(`"${r}" comparisons are not supported for type '${t4(l.type)}'.`);if(s.type.kind!==l.type.kind&&"value"!==s.type.kind&&"value"!==l.type.kind)return i.error(`Cannot compare types '${t4(s.type)}' and '${t4(l.type)}'.`);a&&("value"===s.type.kind&&"value"!==l.type.kind?s=new ic(l.type,[s]):"value"!==s.type.kind&&"value"===l.type.kind&&(l=new ic(s.type,[l])));let h=null;if(4===e.length){if("string"!==s.type.kind&&"string"!==l.type.kind&&"value"!==s.type.kind&&"value"!==l.type.kind)return i.error("Cannot use collator to compare non-string types.");if(!(h=i.parse(e[3],3,t0)))return null}return new n(s,l,h)}evaluate(n){let s=this.lhs.evaluate(n),l=this.rhs.evaluate(n);if(a&&this.hasUntypedArgument){let i=io(s),r=io(l);if(i.kind!==r.kind||"string"!==i.kind&&"number"!==i.kind)throw new ih(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${i.kind}, ${r.kind}) instead.`)}if(this.collator&&!a&&this.hasUntypedArgument){let e=io(s),r=io(l);if("string"!==e.kind||"string"!==r.kind)return i(n,s,l)}return this.collator?r(n,s,l,this.collator.evaluate(n)):i(n,s,l)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}serialize(){let i=[e];return this.eachChild(e=>{i.push(e.serialize())}),i}}}let rN=rF("==",function(e,i,r){return i===r},rB),rV=rF("!=",function(e,i,r){return i!==r},function(e,i,r,a){return!rB(0,i,r,a)}),rU=rF("<",function(e,i,r){return i<r},function(e,i,r,a){return 0>a.compare(i,r)}),rj=rF(">",function(e,i,r){return i>r},function(e,i,r,a){return a.compare(i,r)>0}),rG=rF("<=",function(e,i,r){return i<=r},function(e,i,r,a){return 0>=a.compare(i,r)}),rq=rF(">=",function(e,i,r){return i>=r},function(e,i,r,a){return a.compare(i,r)>=0});class rW{constructor(e,i,r,a,n,s){this.type=tX,this.number=e,this.locale=i,this.currency=r,this.unit=a,this.minFractionDigits=n,this.maxFractionDigits=s}static parse(e,i){if(3!==e.length)return i.error("Expected two arguments.");let r=i.parse(e[1],1,tZ);if(!r)return null;let a=e[2];if("object"!=typeof a||Array.isArray(a))return i.error("NumberFormat options argument must be an object.");let n=null;if(a.locale&&!(n=i.parseObjectValue(a.locale,2,"locale",tX)))return null;let s=null;if(a.currency&&!(s=i.parseObjectValue(a.currency,2,"currency",tX)))return null;let l=null;if(a.unit&&!(l=i.parseObjectValue(a.unit,2,"unit",tX)))return null;let h=null;if(a["min-fraction-digits"]&&!(h=i.parseObjectValue(a["min-fraction-digits"],2,"min-fraction-digits",tZ)))return null;let u=null;return!a["max-fraction-digits"]||(u=i.parseObjectValue(a["max-fraction-digits"],2,"max-fraction-digits",tZ))?new rW(r,n,s,l,h,u):null}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}serialize(){let e={};return this.locale&&(e.locale=this.locale.serialize()),this.currency&&(e.currency=this.currency.serialize()),this.unit&&(e.unit=this.unit.serialize()),this.minFractionDigits&&(e["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(e["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),e]}}class r${constructor(e){this.type=tZ,this.input=e}static parse(e,i){if(2!==e.length)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);let r=i.parse(e[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?i.error(`Expected argument of type string or array, but found ${t4(r.type)} instead.`):new r$(r):null}evaluate(e){let i=this.input.evaluate(e);if("string"==typeof i||Array.isArray(i))return i.length;throw new ih(`Expected value to be of type string or array, but found ${t4(io(i))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){let e=["length"];return this.eachChild(i=>{e.push(i.serialize())}),e}}function rH(e){return function(){let i=Math.imul((e=0x6d2b79f5+(e|=0)|0)^e>>>15,1|e);return(((i=i+Math.imul(i^i>>>7,61|i)^i)^i>>>14)>>>0)/0x100000000}}let rZ={"==":rN,"!=":rV,">":rj,"<":rU,">=":rq,"<=":rG,array:ic,at:rP,boolean:ic,case:rz,coalesce:rI,collator:iw,format:id,image:ip,in:rL,"index-of":rk,interpolate:rE,"interpolate-hcl":rE,"interpolate-lab":rE,length:r$,let:rC,literal:il,match:rR,number:ic,"number-format":rW,object:ic,slice:rD,step:ru,string:ic,"to-boolean":ig,"to-color":ig,"to-number":ig,"to-string":ig,var:ro,within:iD,distance:i9,config:rt};function rX(e,[i,r,a,n]){i=i.evaluate(e),r=r.evaluate(e),a=a.evaluate(e);let s=n?n.evaluate(e):1,l=ir(i,r,a,s);if(l)throw new ih(l);return new tN(i/255*s,r/255*s,a/255*s,s)}function rY(e,[i,r,a,n]){var s,l,h;i=i.evaluate(e),r=r.evaluate(e),a=a.evaluate(e);let u=n?n.evaluate(e):1,c=(s=i,l=r,h=a,"number"==typeof s&&s>=0&&s<=360?"number"==typeof l&&l>=0&&l<=100&&"number"==typeof h&&h>=0&&h<=100?void 0===u||"number"==typeof u&&u>=0&&u<=1?null:`Invalid hsla value [${[s,l,h,u].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${("number"==typeof u?[s,l,h,u]:[s,l,h]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${("number"==typeof u?[s,l,h,u]:[s,l,h]).join(", ")}]: 'h' must be between 0 and 360.`);if(c)throw new ih(c);let d=`hsla(${i}, ${r}%, ${a}%, ${u})`,p=tN.parse(d);if(!p)throw new ih(`Failed to parse HSLA color: ${d}`);return p}function rJ(e,i){let r=i[e];return void 0===r?null:r}function rK(e){return{type:e}}function rQ(e){return{result:"success",value:e}}function r0(e){return{result:"error",value:e}}function r1(e,i){return!!e&&!!e.parameters&&e.parameters.indexOf(i)>-1}function r2(e){return"data-driven"===e["property-type"]}function r3(e){return r1(e.expression,"measure-light")}function r4(e){return r1(e.expression,"zoom")}function r5(e){return!!e.expression&&e.expression.interpolated}function r6(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function r8(e){return e}function r9(e,i,r){return void 0!==e?e:void 0!==i?i:void 0!==r?r:void 0}function r7(e,i,r,a,n){return r9(typeof r===n?a[r]:void 0,e.default,i.default)}function ae(e,i,r){if("number"!==im(r))return r9(e.default,i.default);let a=e.stops.length;if(1===a||r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[a-1][0])return e.stops[a-1][1];let n=rh(e.stops.map(e=>e[0]),r);return e.stops[n][1]}
206function at(e,i,r){let a=void 0!==e.base?e.base:1;if("number"!==im(r))return r9(e.default,i.default);let n=e.stops.length;if(1===n||r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[n-1][0])return e.stops[n-1][1];let s=rh(e.stops.map(e=>e[0]),r),l=function(e,i,r,a){let n=a-r,s=e-r;return 0===n?0:1===i?s/n:(Math.pow(i,s)-1)/(Math.pow(i,n)-1)}(r,a,e.stops[s][0],e.stops[s+1][0]),h=e.stops[s][1],u=e.stops[s+1][1],c=tG[i.type]||r8;if(e.colorSpace&&"rgb"!==e.colorSpace){let i=rM[e.colorSpace];c=(e,r)=>i.reverse(i.interpolate(i.forward(e),i.forward(r),l))}return"function"==typeof h.evaluate?{evaluate(...e){let i=h.evaluate.apply(void 0,e),r=u.evaluate.apply(void 0,e);if(void 0!==i&&void 0!==r)return c(i,r,l)}}:c(h,u,l)}function ai(e,i,r){return"color"===i.type?r=tN.parse(r):"formatted"===i.type?r=it.fromString(r.toString()):"resolvedImage"===i.type?r=ii.fromString(r.toString()):im(r)===i.type||"enum"===i.type&&i.values[r]||(r=void 0),r9(r,e.default,i.default)}iv.register(rZ,{error:[{kind:"error"},[tX],(e,[i])=>{throw new ih(i.evaluate(e))}],typeof:[tX,[tQ],(e,[i])=>t4(io(i.evaluate(e)))],"to-rgba":[t3(tZ,4),[tJ],(e,[i])=>i.evaluate(e).toRenderColor(null).toArray()],rgb:[tJ,[tZ,tZ,tZ],rX],rgba:[tJ,[tZ,tZ,tZ,tZ],rX],hsl:[tJ,[tZ,tZ,tZ],rY],hsla:[tJ,[tZ,tZ,tZ,tZ],rY],has:{type:tY,overloads:[[[tX],(e,[i])=>i.evaluate(e)in e.properties()],[[tX,tK],(e,[i,r])=>i.evaluate(e)in r.evaluate(e)]]},get:{type:tQ,overloads:[[[tX],(e,[i])=>rJ(i.evaluate(e),e.properties())],[[tX,tK],(e,[i,r])=>rJ(i.evaluate(e),r.evaluate(e))]]},"feature-state":[tQ,[tX],(e,[i])=>rJ(i.evaluate(e),e.featureState||{})],properties:[tK,[],e=>e.properties()],"geometry-type":[tX,[],e=>e.geometryType()],id:[tQ,[],e=>e.id()],zoom:[tZ,[],e=>e.globals.zoom],pitch:[tZ,[],e=>e.globals.pitch||0],"distance-from-center":[tZ,[],e=>e.distanceFromCenter()],"measure-light":[tZ,[tX],(e,[i])=>e.measureLight(i.evaluate(e))],"heatmap-density":[tZ,[],e=>e.globals.heatmapDensity||0],"line-progress":[tZ,[],e=>e.globals.lineProgress||0],"raster-value":[tZ,[],e=>e.globals.rasterValue||0],"raster-particle-speed":[tZ,[],e=>e.globals.rasterParticleSpeed||0],"sky-radial-progress":[tZ,[],e=>e.globals.skyRadialProgress||0],accumulated:[tQ,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[tZ,rK(tZ),(e,i)=>{let r=0;for(let a of i)r+=a.evaluate(e);return r}],"*":[tZ,rK(tZ),(e,i)=>{let r=1;for(let a of i)r*=a.evaluate(e);return r}],"-":{type:tZ,overloads:[[[tZ,tZ],(e,[i,r])=>i.evaluate(e)-r.evaluate(e)],[[tZ],(e,[i])=>-i.evaluate(e)]]},"/":[tZ,[tZ,tZ],(e,[i,r])=>i.evaluate(e)/r.evaluate(e)],"%":[tZ,[tZ,tZ],(e,[i,r])=>i.evaluate(e)%r.evaluate(e)],ln2:[tZ,[],()=>Math.LN2],pi:[tZ,[],()=>Math.PI],e:[tZ,[],()=>Math.E],"^":[tZ,[tZ,tZ],(e,[i,r])=>Math.pow(i.evaluate(e),r.evaluate(e))],sqrt:[tZ,[tZ],(e,[i])=>Math.sqrt(i.evaluate(e))],log10:[tZ,[tZ],(e,[i])=>Math.log(i.evaluate(e))/Math.LN10],ln:[tZ,[tZ],(e,[i])=>Math.log(i.evaluate(e))],log2:[tZ,[tZ],(e,[i])=>Math.log(i.evaluate(e))/Math.LN2],sin:[tZ,[tZ],(e,[i])=>Math.sin(i.evaluate(e))],cos:[tZ,[tZ],(e,[i])=>Math.cos(i.evaluate(e))],tan:[tZ,[tZ],(e,[i])=>Math.tan(i.evaluate(e))],asin:[tZ,[tZ],(e,[i])=>Math.asin(i.evaluate(e))],acos:[tZ,[tZ],(e,[i])=>Math.acos(i.evaluate(e))],atan:[tZ,[tZ],(e,[i])=>Math.atan(i.evaluate(e))],min:[tZ,rK(tZ),(e,i)=>Math.min(...i.map(i=>i.evaluate(e)))],max:[tZ,rK(tZ),(e,i)=>Math.max(...i.map(i=>i.evaluate(e)))],abs:[tZ,[tZ],(e,[i])=>Math.abs(i.evaluate(e))],round:[tZ,[tZ],(e,[i])=>{let r=i.evaluate(e);return r<0?-Math.round(-r):Math.round(r)}],floor:[tZ,[tZ],(e,[i])=>Math.floor(i.evaluate(e))],ceil:[tZ,[tZ],(e,[i])=>Math.ceil(i.evaluate(e))],"filter-==":[tY,[tX,tQ],(e,[i,r])=>e.properties()[i.value]===r.value],"filter-id-==":[tY,[tQ],(e,[i])=>e.id()===i.value],"filter-type-==":[tY,[tX],(e,[i])=>e.geometryType()===i.value],"filter-<":[tY,[tX,tQ],(e,[i,r])=>{let a=e.properties()[i.value],n=r.value;return typeof a==typeof n&&a<n}],"filter-id-<":[tY,[tQ],(e,[i])=>{let r=e.id(),a=i.value;return typeof r==typeof a&&r<a}],"filter->":[tY,[tX,tQ],(e,[i,r])=>{let a=e.properties()[i.value],n=r.value;return typeof a==typeof n&&a>n}],"filter-id->":[tY,[tQ],(e,[i])=>{let r=e.id(),a=i.value;return typeof r==typeof a&&r>a}],"filter-<=":[tY,[tX,tQ],(e,[i,r])=>{let a=e.properties()[i.value],n=r.value;return typeof a==typeof n&&a<=n}],"filter-id-<=":[tY,[tQ],(e,[i])=>{let r=e.id(),a=i.value;return typeof r==typeof a&&r<=a}],"filter->=":[tY,[tX,tQ],(e,[i,r])=>{let a=e.properties()[i.value],n=r.value;return typeof a==typeof n&&a>=n}],"filter-id->=":[tY,[tQ],(e,[i])=>{let r=e.id(),a=i.value;return typeof r==typeof a&&r>=a}],"filter-has":[tY,[tQ],(e,[i])=>i.value in e.properties()],"filter-has-id":[tY,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[tY,[t3(tX)],(e,[i])=>i.value.indexOf(e.geometryType())>=0],"filter-id-in":[tY,[t3(tQ)],(e,[i])=>i.value.indexOf(e.id())>=0],"filter-in-small":[tY,[tX,t3(tQ)],(e,[i,r])=>r.value.indexOf(e.properties()[i.value])>=0],"filter-in-large":[tY,[tX,t3(tQ)],(e,[i,r])=>(function(e,i,r,a){for(;r<=a;){let n=r+a>>1;if(i[n]===e)return!0;
206i[n]>e?a=n-1:r=n+1}return!1})(e.properties()[i.value],r.value,0,r.value.length-1)],all:{type:tY,overloads:[[[tY,tY],(e,[i,r])=>i.evaluate(e)&&r.evaluate(e)],[rK(tY),(e,i)=>{for(let r of i)if(!r.evaluate(e))return!1;return!0}]]},any:{type:tY,overloads:[[[tY,tY],(e,[i,r])=>i.evaluate(e)||r.evaluate(e)],[rK(tY),(e,i)=>{for(let r of i)if(r.evaluate(e))return!0;return!1}]]},"!":[tY,[tY],(e,[i])=>!i.evaluate(e)],"is-supported-script":[tY,[tX],(e,[i])=>{let r=e.globals&&e.globals.isSupportedScript;return!r||r(i.evaluate(e))}],upcase:[tX,[tX],(e,[i])=>i.evaluate(e).toUpperCase()],downcase:[tX,[tX],(e,[i])=>i.evaluate(e).toLowerCase()],concat:[tX,rK(tQ),(e,i)=>i.map(i=>is(i.evaluate(e))).join("")],"resolved-locale":[tX,[t0],(e,[i])=>i.evaluate(e).resolvedLocale()],random:[tZ,[tZ,tZ,tQ],(e,i)=>{let r;let[a,n,s]=i.map(i=>i.evaluate(e));if(a>n||a===n)return a;if("string"==typeof s)r=function(e){let i=0;if(0===e.length)return i;for(let r=0;r<e.length;r++)i=(i<<5)-i+e.charCodeAt(r)|0;return i}(s);else{if("number"!=typeof s)throw new ih(`Invalid seed input: ${s}`);r=s}return a+rH(r)()*(n-a)}]});class ar{constructor(e,i,r,a){this.expression=e,this._warningHistory={},this._evaluator=new ix(r,a),this._defaultValue=i?"color"===i.type&&(r6(i.default)||Array.isArray(i.default))?new tN(0,0,0,0):"color"===i.type?tN.parse(i.default)||null:void 0===i.default?null:i.default:null,this._enumValues=i&&"enum"===i.type?i.values:null,this.configDependencies=ra(e)}evaluateWithoutErrorHandling(e,i,r,a,n,s,l,h){return this._evaluator.globals=e,this._evaluator.feature=i,this._evaluator.featureState=r,this._evaluator.canonical=a||null,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=s,this._evaluator.featureTileCoord=l||null,this._evaluator.featureDistanceData=h||null,this.expression.evaluate(this._evaluator)}evaluate(e,i,r,a,n,s,l,h){this._evaluator.globals=e,this._evaluator.feature=i||null,this._evaluator.featureState=r||null,this._evaluator.canonical=a||null,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=s||null,this._evaluator.featureTileCoord=l||null,this._evaluator.featureDistanceData=h||null;try{let 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 ih(`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(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${e.message}`)),this._defaultValue}}}function aa(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in rZ}function an(e,i,r,a){let n=new rl(rZ,[],i?function(e){let i={color:tJ,string:tX,number:tZ,enum:tX,boolean:tY,formatted:t1,resolvedImage:t2};return"array"===e.type?t3(i[e.value]||tQ,e.length):i[e.type]}(i):void 0,void 0,void 0,r,a),s=n.parse(e,void 0,void 0,void 0,i&&"string"===i.type?{typeAnnotation:"coerce"}:void 0);return s?rQ(new ar(s,i,r,a)):r0(n.errors)}class ao{constructor(e,i,r){this.kind=e,this._styleExpression=i,this.isLightConstant=r,this.isStateDependent="constant"!==e&&!rr(i.expression),this.configDependencies=ra(i.expression)}evaluateWithoutErrorHandling(e,i,r,a,n,s){return this._styleExpression.evaluateWithoutErrorHandling(e,i,r,a,n,s)}evaluate(e,i,r,a,n,s){return this._styleExpression.evaluate(e,i,r,a,n,s)}}class as{constructor(e,i,r,a,n){this.kind=e,this.zoomStops=r,this._styleExpression=i,this.isStateDependent="camera"!==e&&!rr(i.expression),this.isLightConstant=n,this.configDependencies=ra(i.expression),this.interpolationType=a}evaluateWithoutErrorHandling(e,i,r,a,n,s){return this._styleExpression.evaluateWithoutErrorHandling(e,i,r,a,n,s)}evaluate(e,i,r,a,n,s){return this._styleExpression.evaluate(e,i,r,a,n,s)}interpolationFactor(e,i,r){return this.interpolationType?rE.interpolationFactor(this.interpolationType,e,i,r):0}}function al(e,i,r,a){if("error"===(e=an(e,i,r,a)).result)return e;let n=e.value.expression,s=ri(n);if(!s&&!r2(i))return r0([new tW("","data expressions not supported")]);let l=rn(n,["zoom","pitch","distance-from-center"]);if(!l&&!r4(i))return r0([new tW("","zoom expressions not supported")]);let h=rn(n,["measure-light"]);if(!h&&!r3(i))return r0([new tW("","measure-light expression not supported")]);let u=rn(n,["line-progress"]);if(!u&&!r1(i.expression,"line-progress"))return r0([new tW("","line-progress expression not supported")]);let c=i.expression&&i.expression.relaxZoomRestriction,d=function e(i){let r=null;if(i instanceof rC)r=e(i.result);else if(i instanceof rI){for(let a of i.args)if(r=e(a))break}else(i instanceof ru||i instanceof rE)&&i.input instanceof iv&&"zoom"===i.input.name&&(r=i);return r instanceof tW||i.eachChild(i=>{let a=e(i);a instanceof tW?r=a:r&&a&&r!==a&&(r=new tW("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),r}(n);
206return d||l||c?d instanceof tW?r0([d]):d instanceof rE&&!r5(i)?r0([new tW("",'"interpolate" expressions cannot be used with this property')]):rQ(d?new as(s&&u?"camera":"composite",e.value,d.labels,d instanceof rE?d.interpolation:void 0,h):new ao(s&&u?"constant":"source",e.value,h)):r0([new tW("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class ah{constructor(e,i){this._parameters=e,this._specification=i,tq(this,function e(i,r){let a,n,s;let l="color"===r.type,h=i.stops&&"object"==typeof i.stops[0][0],u=h||!(h||void 0!==i.property),c=i.type||(r5(r)?"exponential":"interval");if(l&&((i=tq({},i)).stops&&(i.stops=i.stops.map(e=>[e[0],tN.parse(e[1])])),i.default=tN.parse(i.default?i.default:r.default)),i.colorSpace&&"rgb"!==i.colorSpace&&!rM[i.colorSpace])throw Error(`Unknown color space: ${i.colorSpace}`);if("exponential"===c)a=at;else if("interval"===c)a=ae;else if("categorical"===c){for(let e of(a=r7,n=Object.create(null),i.stops))n[e[0]]=e[1];s=typeof i.stops[0][0]}else{if("identity"!==c)throw Error(`Unknown function type "${c}"`);a=ai}if(h){let a={},n=[];for(let e=0;e<i.stops.length;e++){let r=i.stops[e],s=r[0].zoom;void 0===a[s]&&(a[s]={zoom:s,type:i.type,property:i.property,default:i.default,stops:[]},n.push(s)),a[s].stops.push([r[0].value,r[1]])}let s=[];for(let i of n)s.push([a[i].zoom,e(a[i],r)]);let l={name:"linear"};return{kind:"composite",interpolationType:l,interpolationFactor:rE.interpolationFactor.bind(void 0,l),zoomStops:s.map(e=>e[0]),evaluate:({zoom:e},a)=>at({stops:s,base:i.base},r,e).evaluate(e,a)}}if(u){let e="exponential"===c?{name:"exponential",base:void 0!==i.base?i.base:1}:null;return{kind:"camera",interpolationType:e,interpolationFactor:rE.interpolationFactor.bind(void 0,e),zoomStops:i.stops.map(e=>e[0]),evaluate:({zoom:e})=>a(i,r,e,n,s)}}return{kind:"source",evaluate(e,l){let h=l&&l.properties?l.properties[i.property]:void 0;return void 0===h?r9(i.default,r.default):a(i,r,h,n,s)}}}(this._parameters,this._specification))}static deserialize(e){return new ah(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}var au,ac,ad=W(function(){if(ac)return au;function e(e,i,r){var a=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;var n=new Int32Array(this.arrayBuffer);e=n[0],this.d=(i=n[1])+2*(r=n[2]);for(var s=0;s<this.d*this.d;s++){var l=n[3+s],h=n[3+s+1];a.push(l===h?null:n.subarray(l,h))}var u=n[3+a.length+1];this.keys=n.subarray(n[3+a.length],u),this.bboxes=n.subarray(u),this.insert=this._insertReadonly}else{this.d=i+2*r;for(var c=0;c<this.d*this.d;c++)a.push([]);this.keys=[],this.bboxes=[]}this.n=i,this.extent=e,this.padding=r,this.scale=i/e,this.uid=0;var d=r/i*e;this.min=-d,this.max=e+d}return ac=1,au=e,e.prototype.insert=function(e,i,r,a,n){this._forEachCell(i,r,a,n,this._insertCell,this.uid++),this.keys.push(e),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(a),this.bboxes.push(n)},e.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},e.prototype._insertCell=function(e,i,r,a,n,s){this.cells[n].push(s)},e.prototype.query=function(e,i,r,a,n){var s=this.min,l=this.max;if(e<=s&&i<=s&&l<=r&&l<=a&&!n)return Array.prototype.slice.call(this.keys);var h=[];return this._forEachCell(e,i,r,a,this._queryCell,h,{},n),h},e.prototype._queryCell=function(e,i,r,a,n,s,l,h){var u=this.cells[n];if(null!==u)for(var c=this.keys,d=this.bboxes,p=0;p<u.length;p++){var f=u[p];if(void 0===l[f]){var m=4*f;(h?h(d[m+0],d[m+1],d[m+2],d[m+3]):e<=d[m+2]&&i<=d[m+3]&&r>=d[m+0]&&a>=d[m+1])?(l[f]=!0,s.push(c[f])):l[f]=!1}}},e.prototype._forEachCell=function(e,i,r,a,n,s,l,h){for(var u=this._convertToCellCoord(e),c=this._convertToCellCoord(i),d=this._convertToCellCoord(r),p=this._convertToCellCoord(a),f=u;f<=d;f++)for(var m=c;m<=p;m++){var _=this.d*m+f;if((!h||h(this._convertFromCellCoord(f),this._convertFromCellCoord(m),this._convertFromCellCoord(f+1),this._convertFromCellCoord(m+1)))&&n.call(this,e,i,r,a,_,s,l,h))return}},e.prototype._convertFromCellCoord=function(e){return(e-this.padding)/this.scale},e.prototype._convertToCellCoord=function(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))},e.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var e=this.cells,i=3+this.cells.length+1+1,r=0,a=0;a<this.cells.length;a++)r+=this.cells[a].length;var n=new Int32Array(i+r+this.keys.length+this.bboxes.length);n[0]=this.extent,n[1]=this.n,n[2]=this.padding;
206for(var s=i,l=0;l<e.length;l++){var h=e[l];n[3+l]=s,n.set(h,s),s+=h.length}return n[3+e.length]=s,n.set(this.keys,s),n[3+e.length+1]=s+=this.keys.length,n.set(this.bboxes,s),s+=this.bboxes.length,n.buffer},au}());let ap={};function af(e,i,r={}){Object.defineProperty(e,"_classRegistryKey",{value:i,writable:!1}),ap[i]={klass:e,omit:r.omit||[]}}for(let e in af(Object,"Object"),ad.serialize=function(e,i){let r=e.toArrayBuffer();return i&&i.add(r),{buffer:r}},ad.deserialize=function(e){return new ad(e.buffer)},Object.defineProperty(ad,"name",{value:"Grid"}),af(ad,"Grid"),af(tN,"Color"),af(Error,"Error"),af(it,"Formatted"),af(ie,"FormattedSection"),af(ty,"AJAXError"),af(ii,"ResolvedImage"),af(ah,"StylePropertyFunction"),af(ar,"StyleExpression",{omit:["_evaluator"]}),af(as,"ZoomDependentExpression"),af(ao,"ZoomConstantExpression"),af(iv,"CompoundExpression",{omit:["_evaluate"]}),rZ)ap[rZ[e]._classRegistryKey]||af(rZ[e],`Expression${e}`);function am(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}function a_(e){return self.ImageBitmap&&e instanceof ImageBitmap}function ag(e,i){if(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp)return e;if(am(e)||a_(e))return i&&i.add(e),e;if(ArrayBuffer.isView(e))return i&&i.add(e.buffer),e;if(e instanceof ImageData)return i&&i.add(e.data.buffer),e;if(Array.isArray(e)){let r=[];for(let a of e)r.push(ag(a,i));return r}if(e instanceof Map){let i={$name:"Map"};for(let[r,a]of e.entries())i[r]=ag(a);return i}if(e instanceof Set){let i={$name:"Set"},r=0;for(let a of e.values())i[++r]=ag(a);return i}if("object"==typeof e){let r=e.constructor,a=r._classRegistryKey;if(!a)throw Error(`can't serialize object of unregistered class ${a}`);let n=r.serialize?r.serialize(e,i):{};if(!r.serialize){for(let r in e)e.hasOwnProperty(r)&&(ap[a].omit.indexOf(r)>=0||(n[r]=ag(e[r],i)));e instanceof Error&&(n.message=e.message)}if(n.$name)throw Error("$name property is reserved for worker serialization logic.");return"Object"!==a&&(n.$name=a),n}throw Error("can't serialize object of type "+typeof e)}function ay(e){if(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||am(e)||a_(e)||ArrayBuffer.isView(e)||e instanceof ImageData)return e;if(Array.isArray(e))return e.map(ay);if("object"==typeof e){let i=e.$name||"Object";if("Map"===i){let i=new Map;for(let r of Object.keys(e))"$name"!==r&&i.set(r,ay(e[r]));return i}if("Set"===i){let i=new Set;for(let r of Object.keys(e))"$name"!==r&&i.add(ay(e[r]));return i}let{klass:r}=ap[i];if(!r)throw Error(`can't deserialize unregistered class ${i}`);if(r.deserialize)return r.deserialize(e);let a=Object.create(r.prototype);for(let i of Object.keys(e))"$name"!==i&&(a[i]=ay(e[i]));return a}throw Error("can't deserialize object of type "+typeof e)}let ax={"Latin-1 Supplement":e=>e>=128&&e<=255,Arabic:e=>e>=1536&&e<=1791,"Arabic Supplement":e=>e>=1872&&e<=1919,"Arabic Extended-A":e=>e>=2208&&e<=2303,"Hangul Jamo":e=>e>=4352&&e<=4607,"Unified Canadian Aboriginal Syllabics":e=>e>=5120&&e<=5759,Khmer:e=>e>=6016&&e<=6143,"Unified Canadian Aboriginal Syllabics Extended":e=>e>=6320&&e<=6399,"General Punctuation":e=>e>=8192&&e<=8303,"Letterlike Symbols":e=>e>=8448&&e<=8527,"Number Forms":e=>e>=8528&&e<=8591,"Miscellaneous Technical":e=>e>=8960&&e<=9215,"Control Pictures":e=>e>=9216&&e<=9279,"Optical Character Recognition":e=>e>=9280&&e<=9311,"Enclosed Alphanumerics":e=>e>=9312&&e<=9471,"Geometric Shapes":e=>e>=9632&&e<=9727,"Miscellaneous Symbols":e=>e>=9728&&e<=9983,"Miscellaneous Symbols and Arrows":e=>e>=11008&&e<=11263,"CJK Radicals Supplement":e=>e>=11904&&e<=12031,"Kangxi Radicals":e=>e>=12032&&e<=12255,"Ideographic Description Characters":e=>e>=12272&&e<=12287,"CJK Symbols and Punctuation":e=>e>=12288&&e<=12351,Hiragana:e=>e>=12352&&e<=12447,Katakana:e=>e>=12448&&e<=12543,Bopomofo:e=>e>=12544&&e<=12591,"Hangul Compatibility Jamo":e=>e>=12592&&e<=12687,Kanbun:e=>e>=12688&&e<=12703,"Bopomofo Extended":e=>e>=12704&&e<=12735,"CJK Strokes":e=>e>
206=12736&&e<=12783,"Katakana Phonetic Extensions":e=>e>=12784&&e<=12799,"Enclosed CJK Letters and Months":e=>e>=12800&&e<=13055,"CJK Compatibility":e=>e>=13056&&e<=13311,"CJK Unified Ideographs Extension A":e=>e>=13312&&e<=19903,"Yijing Hexagram Symbols":e=>e>=19904&&e<=19967,"CJK Unified Ideographs":e=>e>=19968&&e<=40959,"Yi Syllables":e=>e>=40960&&e<=42127,"Yi Radicals":e=>e>=42128&&e<=42191,"Hangul Jamo Extended-A":e=>e>=43360&&e<=43391,"Hangul Syllables":e=>e>=44032&&e<=55215,"Hangul Jamo Extended-B":e=>e>=55216&&e<=55295,"Private Use Area":e=>e>=57344&&e<=63743,"CJK Compatibility Ideographs":e=>e>=63744&&e<=64255,"Arabic Presentation Forms-A":e=>e>=64336&&e<=65023,"Vertical Forms":e=>e>=65040&&e<=65055,"CJK Compatibility Forms":e=>e>=65072&&e<=65103,"Small Form Variants":e=>e>=65104&&e<=65135,"Arabic Presentation Forms-B":e=>e>=65136&&e<=65279,"Halfwidth and Fullwidth Forms":e=>e>=65280&&e<=65519,Osage:e=>e>=66736&&e<=66815,"CJK Unified Ideographs Extension B":e=>e>=131072&&e<=173791};function av(e){for(let i of e)if(ab(i.charCodeAt(0)))return!0;return!1}function ab(e){return!(746!==e&&747!==e&&(e<4352||!(ax["Bopomofo Extended"](e)||ax.Bopomofo(e)||ax["CJK Compatibility Forms"](e)&&!(e>=65097&&e<=65103)||ax["CJK Compatibility Ideographs"](e)||ax["CJK Compatibility"](e)||ax["CJK Radicals Supplement"](e)||ax["CJK Strokes"](e)||!(!ax["CJK Symbols and Punctuation"](e)||e>=12296&&e<=12305||e>=12308&&e<=12319||12336===e)||ax["CJK Unified Ideographs Extension A"](e)||ax["CJK Unified Ideographs"](e)||ax["Enclosed CJK Letters and Months"](e)||ax["Hangul Compatibility Jamo"](e)||ax["Hangul Jamo Extended-A"](e)||ax["Hangul Jamo Extended-B"](e)||ax["Hangul Jamo"](e)||ax["Hangul Syllables"](e)||ax.Hiragana(e)||ax["Ideographic Description Characters"](e)||ax.Kanbun(e)||ax["Kangxi Radicals"](e)||ax["Katakana Phonetic Extensions"](e)||ax.Katakana(e)&&12540!==e||!(!ax["Halfwidth and Fullwidth Forms"](e)||65288===e||65289===e||65293===e||e>=65306&&e<=65310||65339===e||65341===e||65343===e||e>=65371&&e<=65503||65507===e||e>=65512&&e<=65519)||!(!ax["Small Form Variants"](e)||e>=65112&&e<=65118||e>=65123&&e<=65126)||ax["Unified Canadian Aboriginal Syllabics"](e)||ax["Unified Canadian Aboriginal Syllabics Extended"](e)||ax["Vertical Forms"](e)||ax["Yijing Hexagram Symbols"](e)||ax["Yi Syllables"](e)||ax["Yi Radicals"](e))))}function aw(e){return!(ab(e)||ax["Latin-1 Supplement"](e)&&(167===e||169===e||174===e||177===e||188===e||189===e||190===e||215===e||247===e)||ax["General Punctuation"](e)&&(8214===e||8224===e||8225===e||8240===e||8241===e||8251===e||8252===e||8258===e||8263===e||8264===e||8265===e||8273===e)||ax["Letterlike Symbols"](e)||ax["Number Forms"](e)||ax["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||9003===e||e>=9085&&e<=9114||e>=9150&&e<=9165||9167===e||e>=9169&&e<=9179||e>=9186&&e<=9215)||ax["Control Pictures"](e)&&9251!==e||ax["Optical Character Recognition"](e)||ax["Enclosed Alphanumerics"](e)||ax["Geometric Shapes"](e)||ax["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||ax["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||ax["CJK Symbols and Punctuation"](e)||ax.Katakana(e)||ax["Private Use Area"](e)||ax["CJK Compatibility Forms"](e)||ax["Small Form Variants"](e)||ax["Halfwidth and Fullwidth Forms"](e)||8734===e||8756===e||8757===e||e>=9984&&e<=10087||e>=10102&&e<=10131||65532===e||65533===e)}function aT(e){return e>=1424&&e<=2303||ax["Arabic Presentation Forms-A"](e)||ax["Arabic Presentation Forms-B"](e)}let aS="deferred",aM="loading",aE="loaded",aA=null,aI="unavailable",aC=null,aP=function(e){e&&"string"==typeof e&&e.indexOf("NetworkError")>-1&&(aI="error"),aA&&aA(e)};function aL(){ak.fire(new tL("pluginStateChange",{pluginStatus:aI,pluginURL:aC}))}let ak=new tD,aR=function(){return aI},az=function(){if(aI!==aS||!aC)throw Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");aI=aM,aL(),aC&&tb({url:aC},e=>{e?aP(e):(aI=aE,aL())})},aD={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>aI===aE||null!=aD.applyArabicShaping,isLoading:()=>aI===aM,setState(e){aI=e.pluginStatus,aC=e.pluginURL},isParsed:()=>null!=aD.applyArabicShaping&&null!=aD.processBidirectionalText&&null!=aD.processStyledBidirectionalText,getPluginURL:()=>aC};class aO{constructor(e,i){this.zoom=e,i?(this.now=i.now,this.fadeDuration=i.fadeDuration,this.transition=i.transition,this.pitch=i.pitch,this.brightness=i.brightness):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(e){return function(e,i){for(let a of e){var r;
206if(r=a.charCodeAt(0),!i&&aT(r)||r>=2304&&r<=3583||r>=3840&&r<=4255||ax.Khmer(r))return!1}return!0}(e,aD.isLoaded())}}class aB{constructor(e,i,r,a){this.property=e,this.value=i,this.expression=function(e,i,r,a){if(r6(e))return new ah(e,i);if(aa(e)||Array.isArray(e)&&e.length>0){let n=al(e,i,r,a);if("error"===n.result)throw Error(n.value.map(e=>`${e.key}: ${e.message}`).join(", "));return n.value}{let r=e;return"string"==typeof e&&"color"===i.type&&(r=tN.parse(e)),{kind:"constant",configDependencies:new Set,evaluate:()=>r}}}(void 0===i?e.specification.default:i,e.specification,r,a)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(e,i,r){return this.property.possiblyEvaluate(this,e,i,r)}}class aF{constructor(e,i,r){this.property=e,this.value=new aB(e,void 0,i,r)}transitioned(e,i){return new aV(this.property,this.value,i,eN({},e.transition,this.transition),e.now)}untransitioned(){return new aV(this.property,this.value,null,{},0)}}class aN{constructor(e,i,r){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._scope=i,this._options=r,this.configDependencies=new Set}getValue(e){return eH(this._values[e].value.value)}setValue(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new aF(this._values[e].property,this._scope,this._options)),this._values[e].value=new aB(this._values[e].property,null===i?void 0:eH(i),this._scope,this._options),this._values[e].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].value.expression.configDependencies]))}setTransitionOrValue(e,i){i&&(this._options=i);let r=this._properties.properties;if(e)for(let i in e){let a=e[i];if(eq(i,"-transition")){let e=i.slice(0,-11);r[e]&&this.setTransition(e,a)}else r.hasOwnProperty(i)&&this.setValue(i,a)}}getTransition(e){return eH(this._values[e].transition)}setTransition(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new aF(this._values[e].property)),this._values[e].transition=eH(i)||void 0}serialize(){let e={};for(let i of Object.keys(this._values)){let r=this.getValue(i);void 0!==r&&(e[i]=r);let a=this.getTransition(i);void 0!==a&&(e[`${i}-transition`]=a)}return e}transitioned(e,i){let r=new aU(this._properties);for(let a of Object.keys(this._values))r._values[a]=this._values[a].transitioned(e,i._values[a]);return r}untransitioned(){let e=new aU(this._properties);for(let i of Object.keys(this._values))e._values[i]=this._values[i].untransitioned();return e}}class aV{constructor(e,i,r,a,n){let s=a.delay||0,l=a.duration||0;n=n||0,this.property=e,this.value=i,this.begin=n+s,this.end=this.begin+l,e.specification.transition&&(a.delay||a.duration)&&(this.prior=r)}possiblyEvaluate(e,i,r){let a=e.now||0,n=this.value.possiblyEvaluate(e,i,r),s=this.prior;if(s){if(a>this.end||this.value.isDataDriven())return this.prior=null,n;if(a<this.begin)return s.possiblyEvaluate(e,i,r);{let l=(a-this.begin)/(this.end-this.begin);return this.property.interpolate(s.possiblyEvaluate(e,i,r),n,ek(l))}}return n}}class aU{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,i,r){let a=new aq(this._properties);for(let n of Object.keys(this._values))a._values[n]=this._values[n].possiblyEvaluate(e,i,r);return a}hasTransition(){for(let e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class aj{constructor(e,i,r){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._scope=i,this._options=r,this.configDependencies=new Set}getValue(e){return eH(this._values[e].value)}setValue(e,i){this._values[e]=new aB(this._values[e].property,null===i?void 0:eH(i),this._scope,this._options),this._values[e].expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].expression.configDependencies]))}serialize(){let e={};for(let i of Object.keys(this._values)){let r=this.getValue(i);void 0!==r&&(e[i]=r)}return e}possiblyEvaluate(e,i,r){let a=new aq(this._properties);for(let n of Object.keys(this._values))a._values[n]=this._values[n].possiblyEvaluate(e,i,r);return a}}class aG{constructor(e,i,r){this.property=e,this.value=i,this.parameters=r}isConstant(){return"constant"===this.value.kind}constantOr(e){return"constant"===this.value.kind?this.value.value:e}evaluate(e,i,r,a){return this.property.evaluate(this.value,this.parameters,e,i,r,a)}}class aq{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class aW{constructor(e){this.specification=e}
206possiblyEvaluate(e,i){return e.expression.evaluate(i)}interpolate(e,i,r){let a=tG[this.specification.type];return a?a(e,i,r):e}}class a${constructor(e,i){this.specification=e,this.overrides=i}possiblyEvaluate(e,i,r,a){return new aG(this,"constant"===e.expression.kind||"camera"===e.expression.kind?{kind:"constant",value:e.expression.evaluate(i,null,{},r,a)}:e.expression,i)}interpolate(e,i,r){if("constant"!==e.value.kind||"constant"!==i.value.kind)return e;if(void 0===e.value.value||void 0===i.value.value)return new aG(this,{kind:"constant",value:void 0},e.parameters);let a=tG[this.specification.type];return a?new aG(this,{kind:"constant",value:a(e.value.value,i.value.value,r)},e.parameters):e}evaluate(e,i,r,a,n,s){return"constant"===e.kind?e.value:e.evaluate(i,r,a,n,s)}}class aH{constructor(e){this.specification=e}possiblyEvaluate(e,i,r,a){return!!e.expression.evaluate(i,null,{},r,a)}interpolate(){return!1}}class aZ{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];let i=new aO(0,{});for(let r in e){let a=e[r];a.specification.overridable&&this.overridableProperties.push(r);let n=this.defaultPropertyValues[r]=new aB(a,void 0),s=this.defaultTransitionablePropertyValues[r]=new aF(a);this.defaultTransitioningPropertyValues[r]=s.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=n.possiblyEvaluate(i)}}}af(a$,"DataDrivenProperty"),af(aW,"DataConstantProperty"),af(aH,"ColorRampProperty");var aX=JSON.parse('{"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"fragment":{"type":"boolean"},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360},"pitch":{"type":"number","default":0},"light":{"type":"light"},"lights":{"required":false,"type":"array","value":"light-3d"},"terrain":{"type":"terrain","optional":true},"fog":{"type":"fog"},"camera":{"type":"camera"},"color-theme":{"type":"colorTheme"},"imports":{"type":"array","value":"import"},"schema":{"type":"schema"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string","default":"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"required":true,"type":"array","value":"layer"},"models":{"type":"models"},"featuresets":{"experimental":true,"type":"featuresets"}},"featuresets":{"experimental":true,"*":{"type":"featureset"}},"featureset":{"experimental":true,"metadata":{"type":"*"},"selectors":{"type":"array","value":"selector"}},"selector":{"experimental":true,"layer":{"type":"string","required":true},"properties":{"type":"selectorProperty","required":false},"featureNamespace":{"type":"string","required":false}},"selectorProperty":{"experimental":true,"*":{"type":"*"}},"model":{"type":"string","required":true},"import":{"id":{"type":"string","required":true},"url":{"type":"string","required":true},"config":{"type":"config"},"data":{"type":"$root"}},"config":{"*":{"type":"*"}},"schema":{"*":{"type":"option"}},"option":{"default":{"type":"*","property-type":"data-constant","expression":{},"required":true},"type":{"type":"enum","values":{"string":1,"number":1,"boolean":1,"color":1}},"array":{"type":"boolean"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"stepValue":{"type":"number"},"values":{"type":"array","value":"*"},"metadata":{"type":"*"}},"models":{"*":{"type":"model"}},"light-3d":{"id":{"type":"string","required":true},"properties":{"type":"properties"},"type":{"type":"enum","values":{"ambient":{},"directional":{},"flat":{}}}},"properties":["properties_light_directional","properties_light_ambient","properties_light_flat"],"properties_light_directional":{"direction":{"type":"array","default":[210,30],"minimum":[0,0],"maximum":[360,90],"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"cast-shadows":{"type":"boolean","default":false,"property-type":"data-constant"},"shadow-intensity":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_ambient":{"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_flat":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"property-type":"data-constant","expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_raster_array","source_geojson","source_video","source_image","source_model"],"source_vector":{"type":{"required":true,"type":"enum","values":{"vector":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"required":true,"type":"enum","values":{"raster":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"required":true,"type":"enum","values":{"raster-dem":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":1,"mapbox":1},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_array":{"experimental":true,"type":{"required":true,"type":"enum","values":{"raster-array":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"rasterLayers":{"type":"*"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":{"geojson":1}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0}
206,"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"},"dynamic":{"type":"boolean","default":false}},"source_video":{"type":{"required":true,"type":"enum","values":{"video":1}},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":{"image":1}},"url":{"required":false,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_model":{"type":{"required":true,"type":"enum","values":{"model":1,"batched-model":1}},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"tiles":{"type":"array","value":"string"}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"raster":{},"raster-particle":{"experimental":true},"hillshade":{},"model":{"experimental":true},"background":{},"sky":{},"slot":{},"clip":{}},"required":true},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"slot":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"}},"layout":["layout_clip","layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_raster-particle","layout_hillshade","layout_background","layout_sky","layout_model"],"layout_background":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_model":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"},"model-id":{"type":"string","default":"","property-type":"data-driven","expression":{"parameters":["zoom","feature"]}}},"layout_clip":{"clip-layer-types":{"type":"array","value":"enum","values":{"model":1,"symbol":1},"default":[],"expression":{},"property-type":"data-constant","experimental":true},"clip-layer-scope":{"type":"array","value":"string","default":[],"expression":{},"property-type":"data-constant","experimental":true}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"},"fill-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-base":1,"hd-road-markup":1},"default":"none","experimental":true,"private":true,"expression":{},"property-type":"data-constant"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"},"fill-extrusion-edge-radius":{"type":"number","experimental":true,"default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"constant"}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":1,"round":1,"square":1},"default":"butt","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":1,"round":1,"miter":1,"none":1},"default":"miter","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-z-offset":{"type":"number","experimental":true,"default":0,"expression":{"parameters":["zoom","feature","line-progress"]},"property-type":"data-driven"},"line-elevation-reference":{"type":"enum","values":{"none":1,"sea":1,"ground":1,"hd-road-markup":1},"default":"none","experimental":true,"expression":{},"property-type":"data-constant"},"line-cross-slope":{"type":"number","experimental":true,"expression":{},"property-type":"constant"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":1,"line":1,"line-center":1},"default":"point","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":1,"viewport-y":1,"source":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","experimental":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-size":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":0.1,"maximum":10,"experimental":true,"private":true,"expression":{},"property-type":"data-constant"},"icon-text-fit":{"type":"enum","values":{"none":1,"width":1,"height":1,"both":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}
206,"icon-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":0.1,"maximum":10,"experimental":true,"private":true,"expression":{},"property-type":"data-constant"},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":1,"left":1,"center":1,"right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-rotate":{"type":"number","default":0,"period":360,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-transform":{"type":"enum","values":{"none":1,"uppercase":1,"lowercase":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","length":2,"default":[0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_raster-particle":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_hillshade":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster-particle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_clip":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_model":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":1,"!=":1,">":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*","required":false}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"high-color":{"type":"color","property-type":"data-constant","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"space-color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"horizon-blend":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"snow":{"density":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"opacity":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","property-type":"data-constant","default":0,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"centerThinning":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,90],"minimum":0,"maximum":360,"length":2,"value":"number","property-type":"data-constant","transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"rain":{"density":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"opacity":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","property-type":"data-constant","default":0,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"centerThinning":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","property-type":"data-constant","transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective","property-type":"data-constant"}},"colorTheme":{"data":{"type":"string","property-type":"data-constant","expression":{}}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"property-type":"data-constant","expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string","required":true},"exaggeration":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_raster-particle","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"fill-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"da
206ta-driven"},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","experimental":true,"values":{"terrain":1,"flat":1},"default":"flat","property-type":"data-constant"},"fill-extrusion-base-alignment":{"type":"enum","experimental":true,"values":{"terrain":1,"flat":1},"default":"terrain","property-type":"data-constant"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-ambient-occlusion-intensity":{"property-type":"data-constant","type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"property-type":"data-constant","type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"property-type":"data-constant","type":"number","experimental":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"property-type":"data-constant","type":"number","experimental":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"property-type":"data-constant","type":"number","experimental":true,"default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"property-type":"data-constant","type":"color","experimental":true,"default":"#ffffff","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"property-type":"data-constant","type":"number","experimental":true,"default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","experimental":true,"default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","experimental":true,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"property-type":"data-constant","type":"number","experimental":true,"default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"property-type":"data-constant","type":"number","experimental":true,"default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"property-type":"data-constant","type":"boolean","default":true,"experimental":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true,"property-type":"data-constant"}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"}
206,"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-gradient":{"type":"color","expression":{"interpolated":true,"parameters":["line-progress"]},"property-type":"color-ramp"},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"property-type":"constant"},"line-trim-fade-range":{"type":"array","value":"number","experimental":true,"length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"line-trim-color":{"type":"color","experimental":true,"default":"transparent","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"line-border-width":{"type":"number","private":true,"default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","private":true,"default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true,"property-type":"data-constant"}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"expression":{"interpolated":true,"parameters":["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-image-cross-fade":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"transition":true},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{},"property-type":"data-constant"},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{},"property-type":"data-constant"},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-color":{"type":"color","expression":{"interpolated":true,"parameters":["raster-value"]},"property-type":"color-ramp"},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"raster-array-band":{"type":"string","required":false,"experimental":true,"property-type":"data-constant"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string","required":false,"property-type":"data-constant"},"raster-particle-count":{"type":"number","default":512,"minimum":1,"property-type":"data-constant"},"raster-particle-color":{"type":"color","expression":{"interpolated":true,"parameters":["raster-particle-speed"]},"property-type":"color-ramp"},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1,"property-type":"data-constant"},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1,"property-type":"data-constant"},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-accent-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_background":{"background-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":[]},"property-type":"data-constant"},"background-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100,"property-type":"data-constant"},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom
206"]},"property-type":"data-constant"},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"expression":{"interpolated":true,"parameters":["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{"type":"color","default":"white","property-type":"data-constant"},"sky-atmosphere-color":{"type":"color","default":"white","property-type":"data-constant"},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d","property-type":"data-constant"},"model-cast-shadows":{"type":"boolean","default":true,"property-type":"data-constant"},"model-receive-shadows":{"type":"boolean","default":true,"property-type":"data-constant"},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant","transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"model-front-cutoff":{"type":"array","private":true,"value":"number","property-type":"data-constant","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"property-type":{"data-driven":{"type":"property-type"},"color-ramp":{"type":"property-type"},"data-constant":{"type":"property-type"},"constant":{"type":"property-type"}},"promoteId":{"*":{"type":"string"}}}');function aY(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function aJ(e){if(Array.isArray(e))return e.map(aJ);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){let i={};for(let r in e)i[r]=aJ(e[r]);return i}return aY(e)}function aK(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(let i of e.slice(1))if(!aK(i)&&"boolean"!=typeof i)return!1;return!0;default:return!0}}function aQ(e,i="",r=null,a="fill"){if(null==e)return{filter:()=>!0,needGeometry:!1,needFeature:!1};aK(e)||(e=function e(i){if(!i)return!0;let r=i[0];return i.length<=1?"any"!==r:"=="===r?a3(i[1],i[2],"=="):"!="===r?a6(a3(i[1],i[2],"==")):"<"===r||">"===r||"<="===r||">="===r?a3(i[1],i[2],r):"any"===r?["any"].concat(i.slice(1).map(e)):"all"===r?["all"].concat(i.slice(1).map(e)):"none"===r?["all"].concat(i.slice(1).map(e).map(a6)):"in"===r?a4(i[1],i.slice(2)):"!in"===r?a6(a4(i[1],i.slice(2))):"has"===r?a5(i[1]):"!has"!==r||a6(a5(i[1]))}(e));let n=e,s=!0;
206try{s=function(e){if(!a0(e))return e;let i=aJ(e);return function e(i){let r=!1,a=[];if("case"===i[0]){for(let e=1;e<i.length-1;e+=2)r=r||a0(i[e]),a.push(i[e+1]);a.push(i[i.length-1])}else if("match"===i[0]){r=r||a0(i[1]);for(let e=2;e<i.length-1;e+=2)a.push(i[e+1]);a.push(i[i.length-1])}else if("step"===i[0]){r=r||a0(i[1]);for(let e=1;e<i.length-1;e+=2)a.push(i[e+1])}r&&(i.length=0,i.push("any",...a));for(let r=1;r<i.length;r++)e(i[r])}(i),i=function e(i){if(!Array.isArray(i))return i;let r=function(e){if(a1.has(e[0])){for(let i=1;i<e.length;i++)if(a0(e[i]))return!0}return e}(i);return!0===r?r:r.map(i=>e(i))}(i)}(n)}catch(e){console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate. 207This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md 208and paste the contents of this message in the report. 209Thank you! 210Filter Expression: 211${JSON.stringify(n,null,2)} 212 `)}let l=null,h=null;if("background"!==a&&"sky"!==a&&"slot"!==a){let e=an(s,h=aX[`filter_${a}`],i,r);if("error"===e.result)throw Error(e.value.map(e=>`${e.key}: ${e.message}`).join(", "));l=(i,r,a)=>e.value.evaluate(i,r,{},a)}let u=null,c=null;if(s!==n){let e=an(n,h,i,r);if("error"===e.result)throw Error(e.value.map(e=>`${e.key}: ${e.message}`).join(", "));u=(i,r,a,n,s)=>e.value.evaluate(i,r,{},a,void 0,void 0,n,s),c=!ri(e.value.expression)}return{filter:l,dynamicFilter:u||void 0,needGeometry:function e(i){if(!Array.isArray(i))return!1;if("within"===i[0]||"distance"===i[0])return!0;for(let r=1;r<i.length;r++)if(e(i[r]))return!0;return!1}(s),needFeature:!!c}}function a0(e){var i;if(!Array.isArray(e))return!1;if("pitch"===(i=e[0])||"distance-from-center"===i)return!0;for(let i=1;i<e.length;i++)if(a0(e[i]))return!0;return!1}let a1=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function a2(e,i){return e<i?-1:+(e>i)}function a3(e,i,r){switch(e){case"$type":return[`filter-type-${r}`,i];case"$id":return[`filter-id-${r}`,i];default:return[`filter-${r}`,e,i]}}function a4(e,i){if(0===i.length)return!1;switch(e){case"$type":return["filter-type-in",["literal",i]];case"$id":return["filter-id-in",["literal",i]];default:return i.length>200&&!i.some(e=>typeof e!=typeof i[0])?["filter-in-large",e,["literal",i.sort(a2)]]:["filter-in-small",e,["literal",i]]}}function a5(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function a6(e){return["!",e]}function a8(e,i){return i?`${e}�${i}`:e}let a9="-transition",a7=new Set(["fill","line","background","hillshade","raster"]);class ne extends tD{constructor(e,i,r,a,n){if(super(),this.id=e.id,this.fqid=a8(this.id,r),this.type=e.type,this.scope=r,this.lut=a,this.options=n,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.configDependencies=new Set,"custom"!==e.type){if(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type&&"background"!==e.type&&"sky"!==e.type&&"slot"!==e.type){this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter;let i=an(this.filter,aX[`filter_${e.type}`]);"error"!==i.result&&(this.configDependencies=new Set([...this.configDependencies,...i.value.configDependencies]))}if(e.slot&&(this.slot=e.slot),i.layout&&(this._unevaluatedLayout=new aj(i.layout,this.scope,n),this.configDependencies=new Set([...this.configDependencies,...this._unevaluatedLayout.configDependencies])),i.paint){for(let r in this._transitionablePaint=new aN(i.paint,this.scope,n),e.paint)this.setPaintProperty(r,e.paint[r]);for(let i in e.layout)this.setLayoutProperty(i,e.layout[i]);this.configDependencies=new Set([...this.configDependencies,...this._transitionablePaint.configDependencies]),this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new aq(i.paint)}}}onAdd(e){}onRemove(e){}isDraped(e){return!this.is3D()&&a7.has(this.type)}getLayoutProperty(e){return"visibility"===e?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,i){if("custom"===this.type&&"visibility"===e)return void(this.visibility=i);let r=this._unevaluatedLayout;r._properties.properties[e]&&(r.setValue(e,i),this.configDependencies=new Set([...this.configDependencies,...r.configDependencies]),"visibility"===e&&this.possiblyEvaluateVisibility())}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(e){return eq(e,a9)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,i){let r=this._transitionablePaint,a=r._properties.properties;if(eq(e,a9)){let n=e.slice(0,-11);return a[n]&&r.setTransition(n,i||void 0),!1}if(!a[e])return!1;let n=r._values[e],s=n.value.isDataDriven(),l=n.value;r.setValue(e,i),this.configDependencies=new Set([...this.configDependencies,...r.configDependencies]),this._handleSpecialPaintPropertyUpdate(e);let h=r._values[e].value,u=h.isDataDriven(),c=eq(e,"pattern")||"line-dasharray"===e;return u||s||c||this._handleOverridablePaintPropertyUpdate(e,l,h)}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getDefaultProgramParams(e,i,r){return null}_handleOverridablePaintPropertyUpdate(e,i,r){return!1}
212isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||"none"===this.visibility}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,i){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,i)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,i)}serialize(){return e$({id:this.id,type:this.type,slot:this.slot,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()},(e,i)=>!(void 0===e||"layout"===i&&!Object.keys(e).length||"paint"===i&&!Object.keys(e).length))}is3D(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}isStateDependent(){for(let e in this.paint._values){let i=this.paint.get(e);if(i instanceof aG&&r2(i.property.specification)&&("source"===i.value.kind||"composite"===i.value.kind)&&i.value.isStateDependent)return!0}return!1}compileFilter(e){this._filterCompiled||(this._featureFilter=aQ(this.filter,this.scope,e),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(e){this._stats&&("shadow"===e.renderPass?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}queryRadius(e){}queryIntersectsFeature(e,i,r,a,n,s,l,h,u){}queryIntersectsMatchingFeature(e,i,r,a){}}let nt={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};
212class ni{constructor(e,i){this._structArray=e,this._pos1=i*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class nr{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,i){return e._trim(),i&&(e.isTransferred=!0,i.add(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){let i=Object.create(this.prototype);return i.arrayBuffer=e.arrayBuffer,i.length=e.length,i.capacity=e.arrayBuffer.byteLength/i.bytesPerElement,i._refreshViews(),i}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let i=this.uint8;this._refreshViews(),i&&this.uint8.set(i)}}_refreshViews(){throw Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...e){throw Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...e){throw Error("StructArray#emplaceBack() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function na(e,i=1){let r=0,a=0;return{members:e.map(e=>{let n=nt[e.type].BYTES_PER_ELEMENT,s=r=nn(r,Math.max(i,n)),l=e.components||1;return a=Math.max(a,n),r+=n*l,{name:e.name,type:e.type,components:l,offset:s}}),size:nn(r,Math.max(a,i)),alignment:i}}function nn(e,i){return Math.ceil(e/i)*i}class no extends nr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i){let r=this.length;return this.resize(r+1),this.emplace(r,e,i)}emplace(e,i,r){let a=2*e;return this.int16[a+0]=i,this.int16[a+1]=r,e}}no.prototype.bytesPerElement=4,af(no,"StructArrayLayout2i4");class ns extends nr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,e,i,r)}emplace(e,i,r,a){let n=3*e;return this.int16[n+0]=i,this.int16[n+1]=r,this.int16[n+2]=a,e}}ns.prototype.bytesPerElement=6,af(ns,"StructArrayLayout3i6");class nl extends nr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,e,i,r,a)}emplace(e,i,r,a,n){let s=4*e;return this.int16[s+0]=i,this.int16[s+1]=r,this.int16[s+2]=a,this.int16[s+3]=n,e}}nl.prototype.bytesPerElement=8,af(nl,"StructArrayLayout4i8");class nh extends nr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n){let s=this.length;return this.resize(s+1),this.emplace(s,e,i,r,a,n)}emplace(e,i,r,a,n,s){let l=5*e;return this.int16[l+0]=i,this.int16[l+1]=r,this.int16[l+2]=a,this.int16[l+3]=n,this.int16[l+4]=s,e}}nh.prototype.bytesPerElement=10,af(nh,"StructArrayLayout5i10");class nu extends nr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,s,l){let h=this.length;return this.resize(h+1),this.emplace(h,e,i,r,a,n,s,l)}emplace(e,i,r,a,n,s,l,h){let u=6*e,c=12*e;return this.int16[u+0]=i,this.int16[u+1]=r,this.uint8[c+4]=a,this.uint8[c+5]=n,this.uint8[c+6]=s,this.uint8[c+7]=l,this.float32[3*e+2]=h,e}}nu.prototype.bytesPerElement=12,af(nu,"StructArrayLayout2i4ub1f12");class nc extends nr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,e,i,r,a)}emplace(e,i,r,a,n){let s=4*e;return this.float32[s+0]=i,this.float32[s+1]=r,this.float32[s+2]=a,this.float32[s+3]=n,e}}nc.prototype.bytesPerElement=16,af(nc,"StructArrayLayout4f16");class nd extends nr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,e,i,r)}emplace(e,i,r,a){let n=3*e;return this.float32[n+0]=i,this.float32[n+1]=r,this.float32[n+2]=a,e}}nd.prototype.bytesPerElement=12,af(nd,"StructArrayLayout3f12");class np extends nr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n){let s=this.length;return this.resize(s+1),this.emplace(s,e,i,r,a,n)}emplace(e,i,r,a,n,s){let l=6*e;return this.uint16[l+0]=i,this.uint16[l+1]=r,this.uint16[l+2]=a,this.uint16[l+3]=n,this.float32[3*e+2]=s,e}}np.prototype.bytesPerElement=12,af(np,"StructArrayLayout4ui1f12");class nf extends nr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,e,i,r,a)}emplace(e,i,r,a,n){let s=4*e;return this.uint16[s+0]=i,this.uint16[s+1]=r,this.uint16[s+2]=a,this.uint16[s+3]=n,e}}nf.prototype.bytesPerElement=8,af(nf,"StructArrayLayout4ui8");class nm extends nr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,s){let l=this.length;return this.resize(l+1),this.emplace(l,e,i,r,a,n,s)}emplace(e,i,r,a,n,s,l){let h=6*e;return this.int16[h+0]=i,this.int16[h+1]=r,this.int16[h+2]=a,this.int16[h+3]=n,this.int16[h+4]=s,this.int16[h+5]=l,e}}nm.prototype.bytesPerElement=12,af(nm,"StructArrayLayout6i12");class n_ extends nr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,s,l,h,u,c,d,p){let f=this.length;return this.resize(f+1),this.emplace(f,e,i,r,a,n,s,l,h,u,c,d,p)}emplace(e,i,r,a,n,s,l,h,u,c,d,p,f){let m=12*e;return this.int16[m+0]=i,this.int16[m+1]=r,this.int16[m+2]=a,this.int16[m+3]=n,this.uint16[m+4]=s,this.uint16[m+5]=l,this.uint16[m+6]=h,this.uint16[m+7]=u,this.int16[m+8]=c,this.int16[m+9]=d,this.int16[m+10]=p,this.int16[m+11]=f,e}}n_.prototype.bytesPerElement=24,af(n_,"StructArrayLayout4i4ui4i24");class ng extends nr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,s){let l=this.length;return this.resize(l+1),this.emplace(l,e,i,r,a,n,s)}emplace(e,i,r,a,n,s,l){let h=10*e,u=5*e;return this.int16[h+0]=i,this.int16[h+1]=r,this.int16[h+2]=a,this.float32[u+2]=n,this.float32[u+3]=s,this.float32[u+4]=l,e}}ng.prototype.bytesPerElement=20,af(ng,"StructArrayLayout3i3f20");class ny extends nr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){let i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint32[+e+0]=i,e}}ny.prototype.bytesPerElement=4,af(ny,"StructArrayLayout1ul4");class nx extends nr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i){let r=this.length;
212return this.resize(r+1),this.emplace(r,e,i)}emplace(e,i,r){let a=2*e;return this.uint16[a+0]=i,this.uint16[a+1]=r,e}}nx.prototype.bytesPerElement=4,af(nx,"StructArrayLayout2ui4");class nv extends nr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,s,l,h,u,c,d,p,f){let m=this.length;return this.resize(m+1),this.emplace(m,e,i,r,a,n,s,l,h,u,c,d,p,f)}emplace(e,i,r,a,n,s,l,h,u,c,d,p,f,m){let _=20*e,g=10*e;return this.int16[_+0]=i,this.int16[_+1]=r,this.int16[_+2]=a,this.int16[_+3]=n,this.int16[_+4]=s,this.float32[g+3]=l,this.float32[g+4]=h,this.float32[g+5]=u,this.float32[g+6]=c,this.int16[_+14]=d,this.uint32[g+8]=p,this.uint16[_+18]=f,this.uint16[_+19]=m,e}}nv.prototype.bytesPerElement=40,af(nv,"StructArrayLayout5i4f1i1ul2ui40");class nb extends nr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,s,l){let h=this.length;return this.resize(h+1),this.emplace(h,e,i,r,a,n,s,l)}emplace(e,i,r,a,n,s,l,h){let u=8*e;return this.int16[u+0]=i,this.int16[u+1]=r,this.int16[u+2]=a,this.int16[u+4]=n,this.int16[u+5]=s,this.int16[u+6]=l,this.int16[u+7]=h,e}}nb.prototype.bytesPerElement=16,af(nb,"StructArrayLayout3i2i2i16");class nw extends nr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n){let s=this.length;return this.resize(s+1),this.emplace(s,e,i,r,a,n)}emplace(e,i,r,a,n,s){let l=4*e,h=8*e;return this.float32[l+0]=i,this.float32[l+1]=r,this.float32[l+2]=a,this.int16[h+6]=n,this.int16[h+7]=s,e}}nw.prototype.bytesPerElement=16,af(nw,"StructArrayLayout2f1f2i16");class nT extends nr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,s){let l=this.length;return this.resize(l+1),this.emplace(l,e,i,r,a,n,s)}emplace(e,i,r,a,n,s,l){let h=20*e,u=5*e;return this.uint8[h+0]=i,this.uint8[h+1]=r,this.float32[u+1]=a,this.float32[u+2]=n,this.float32[u+3]=s,this.float32[u+4]=l,e}}nT.prototype.bytesPerElement=20,af(nT,"StructArrayLayout2ub4f20");class nS extends nr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,e,i,r)}emplace(e,i,r,a){let n=3*e;return this.uint16[n+0]=i,this.uint16[n+1]=r,this.uint16[n+2]=a,e}}nS.prototype.bytesPerElement=6,af(nS,"StructArrayLayout3ui6");class nM extends nr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w){let T=this.length;return this.resize(T+1),this.emplace(T,e,i,r,a,n,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w)}emplace(e,i,r,a,n,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T){let S=30*e,M=15*e,E=60*e;return this.int16[S+0]=i,this.int16[S+1]=r,this.int16[S+2]=a,this.float32[M+2]=n,this.float32[M+3]=s,this.uint16[S+8]=l,this.uint16[S+9]=h,this.uint32[M+5]=u,this.uint32[M+6]=c,this.uint32[M+7]=d,this.uint16[S+16]=p,this.uint16[S+17]=f,this.uint16[S+18]=m,this.float32[M+10]=_,this.float32[M+11]=g,this.uint8[E+48]=y,this.uint8[E+49]=x,this.uint8[E+50]=v,this.uint32[M+13]=b,this.int16[S+28]=w,this.uint8[E+58]=T,e}}nM.prototype.bytesPerElement=60,af(nM,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class nE extends nr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,M,E,A,I,C,P,L,k,R){let z=this.length;return this.resize(z+1),this.emplace(z,e,i,r,a,n,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,M,E,A,I,C,P,L,k,R)}emplace(e,i,r,a,n,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,M,E,A,I,C,P,L,k,R,z){let D=20*e,O=40*e;return this.float32[D+0]=i,this.float32[D+1]=r,this.int16[O+4]=a,this.int16[O+5]=n,this.int16[O+6]=s,this.int16[O+7]=l,this.int16[O+8]=h,this.int16[O+9]=u,this.int16[O+10]=c,this.int16[O+11]=d,this.int16[O+12]=p,this.uint16[O+13]=f,this.uint16[O+14]=m,this.uint16[O+15]=_,this.uint16[O+16]=g,this.uint16[O+17]=y,this.uint16[O+18]=x,this.uint16[O+19]=v,this.uint16[O+20]=b,this.uint16[O+21]=w,this.uint16[O+22]=T,this.uint16[O+23]=S,this.uint16[O+24]=M,this.uint16[O+25]=E,this.uint16[O+26]=A,this.uint16[O+27]=I,this.uint32[D+14]=C,this.float32[D+15]=P,this.float32[D+16]=L,this.float32[D+17]=k,this.float32[D+18]=R,this.uint8[80*e+76]=z,e}}nE.prototype.bytesPerElement=80,af(nE,"StructArrayLayout2f9i15ui1ul4f1ub80");class nA extends nr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){let i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.float32[+e+0]=i,e}}nA.prototype.bytesPerElement=4,af(nA,"StructArrayLayout1f4");class nI extends nr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n){let s=this.length;return this.resize(s+1),this.emplace(s,e,i,r,a,n)}emplace(e,i,r,a,n,s){let l=5*e;return this.float32[l+0]=i,this.float32[l+1]=r,this.float32[l+2]=a,this.float32[l+3]=n,this.float32[l+4]=s,e}}nI.prototype.bytesPerElement=20,af(nI,"StructArrayLayout5f20");class nC extends nr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,s,l){let h=this.length;return this.resize(h+1),this.emplace(h,e,i,r,a,n,s,l)}emplace(e,i,r,a,n,s,l,h){let u=7*e;return this.float32[u+0]=i,this.float32[u+1]=r,this.float32[u+2]=a,this.float32[u+3]=n,this.float32[u+4]=s,this.float32[u+5]=l,this.float32[u+6]=h,e}}nC.prototype.bytesPerElement=28,af(nC,"StructArrayLayout7f28");class nP extends nr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,s,l,h,u,c,d){let p=this.length;return this.resize(p+1),this.emplace(p,e,i,r,a,n,s,l,h,u,c,d)}emplace(e,i,r,a,n,s,l,h,u,c,d,p){let f=11*e;return this.float32[f+0]=i,this.float32[f+1]=r,this.float32[f+2]=a,this.float32[f+3]=n,this.float32[f+4]=s,this.float32[f+5]=l,this.float32[f+6]=h,this.float32[f+7]=u,this.float32[f+8]=c,this.float32[f+9]=d,this.float32[f+10]=p,e}}nP.prototype.bytesPerElement=44,af(nP,"StructArrayLayout11f44");class nL extends nr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,s,l,h,u){let c=this.length;return this.resize(c+1),this.emplace(c,e,i,r,a,n,s,l,h,u)}emplace(e,i,r,a,n,s,l,h,u,c){let d=9*e;return this.float32[d+0]=i,this.float32[d+1]=r,this.float32[d+2]=a,this.float32[d+3]=n,this.float32[d+4]=s,this.float32[d+5]=l,this.float32[d+6]=h,this.float32[d+7]=u,this.float32[d+8]=c,e}}nL.prototype.bytesPerElement=36,af(nL,"StructArrayLayout9f36");class nk extends nr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,e,i,r,a)}emplace(e,i,r,a,n){let s=6*e;
212return this.uint32[3*e+0]=i,this.uint16[s+2]=r,this.uint16[s+3]=a,this.uint16[s+4]=n,e}}nk.prototype.bytesPerElement=12,af(nk,"StructArrayLayout1ul3ui12");class nR extends nr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){let i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint16[+e+0]=i,e}}nR.prototype.bytesPerElement=2,af(nR,"StructArrayLayout1ui2");class nz extends nr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i){let r=this.length;return this.resize(r+1),this.emplace(r,e,i)}emplace(e,i,r){let a=2*e;return this.float32[a+0]=i,this.float32[a+1]=r,e}}nz.prototype.bytesPerElement=8,af(nz,"StructArrayLayout2f8");class nD extends nr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,s,l,h,u,c,d,p,f,m,_,g){let y=this.length;return this.resize(y+1),this.emplace(y,e,i,r,a,n,s,l,h,u,c,d,p,f,m,_,g)}emplace(e,i,r,a,n,s,l,h,u,c,d,p,f,m,_,g,y){let x=16*e;return this.float32[x+0]=i,this.float32[x+1]=r,this.float32[x+2]=a,this.float32[x+3]=n,this.float32[x+4]=s,this.float32[x+5]=l,this.float32[x+6]=h,this.float32[x+7]=u,this.float32[x+8]=c,this.float32[x+9]=d,this.float32[x+10]=p,this.float32[x+11]=f,this.float32[x+12]=m,this.float32[x+13]=_,this.float32[x+14]=g,this.float32[x+15]=y,e}}nD.prototype.bytesPerElement=64,af(nD,"StructArrayLayout16f64");class nO extends nr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,r,a,n,s,l){let h=this.length;return this.resize(h+1),this.emplace(h,e,i,r,a,n,s,l)}emplace(e,i,r,a,n,s,l,h){let u=10*e,c=5*e;return this.uint16[u+0]=i,this.uint16[u+1]=r,this.uint16[u+2]=a,this.uint16[u+3]=n,this.float32[c+2]=s,this.float32[c+3]=l,this.float32[c+4]=h,e}}nO.prototype.bytesPerElement=20,af(nO,"StructArrayLayout4ui3f20");class nB extends nr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e){let i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.int16[+e+0]=i,e}}nB.prototype.bytesPerElement=2,af(nB,"StructArrayLayout1i2");class nF extends nr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(e){let i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint8[+e+0]=i,e}}nF.prototype.bytesPerElement=1,af(nF,"StructArrayLayout1ub1");class nN extends ni{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}nN.prototype.size=40;class nV extends nv{get(e){return new nN(this,e)}}af(nV,"CollisionBoxArray");class nU extends ni{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(e){this._structArray.uint8[this._pos1+49]=e}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(e){this._structArray.uint8[this._pos1+50]=e}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(e){this._structArray.uint32[this._pos4+13]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(e){this._structArray.uint8[this._pos1+58]=e}}nU.prototype.size=60;class nj extends nM{get(e){return new nU(this,e)}}af(nj,"PlacedSymbolArray");class nG extends ni{get tileAnchorX(){return this._structArray.float32[this._pos4+0]}get tileAnchorY(){return this._structArray.float32[this._pos4+1]}get projectedAnchorX(){return this._structArray.int16[this._pos2+4]}get projectedAnchorY(){return this._structArray.int16[this._pos2+5]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+6]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+7]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}
212get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+11]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get key(){return this._structArray.uint16[this._pos2+13]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+14]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+15]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+17]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+19]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+21]}get featureIndex(){return this._structArray.uint16[this._pos2+22]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+23]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numIconVertices(){return this._structArray.uint16[this._pos2+25]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+26]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+27]}get crossTileID(){return this._structArray.uint32[this._pos4+14]}set crossTileID(e){this._structArray.uint32[this._pos4+14]=e}get textOffset0(){return this._structArray.float32[this._pos4+15]}get textOffset1(){return this._structArray.float32[this._pos4+16]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+17]}get zOffset(){return this._structArray.float32[this._pos4+18]}set zOffset(e){this._structArray.float32[this._pos4+18]=e}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}}nG.prototype.size=80;class nq extends nE{get(e){return new nG(this,e)}}af(nq,"SymbolInstanceArray");class nW extends nA{getoffsetX(e){return this.float32[+e+0]}}af(nW,"GlyphOffsetArray");class n$ extends no{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}af(n$,"SymbolLineVertexArray");class nH extends ni{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}nH.prototype.size=12;class nZ extends nk{get(e){return new nH(this,e)}}af(nZ,"FeatureIndexArray");class nX extends nx{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}af(nX,"FillExtrusionCentroidArray");class nY extends ni{get a_join_normal_inside0(){return this._structArray.int16[this._pos2+0]}get a_join_normal_inside1(){return this._structArray.int16[this._pos2+1]}get a_join_normal_inside2(){return this._structArray.int16[this._pos2+2]}}nY.prototype.size=6;class nJ extends ns{get(e){return new nY(this,e)}}af(nJ,"FillExtrusionWallArray");let nK=na([{name:"a_pos",components:2,type:"Int16"}],4),nQ=na([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class n0{constructor(e=[]){this.segments=e}_prepareSegment(e,i,r,a){let n=this.segments[this.segments.length-1];return e>n0.MAX_VERTEX_ARRAY_LENGTH&&eX(`Max vertices per segment is ${n0.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!n||n.vertexLength+e>n0.MAX_VERTEX_ARRAY_LENGTH||n.sortKey!==a)&&(n={vertexOffset:i,primitiveOffset:r,vertexLength:0,primitiveLength:0},void 0!==a&&(n.sortKey=a),this.segments.push(n)),n}prepareSegment(e,i,r,a){return this._prepareSegment(e,i.length,r.length,a)}get(){return this.segments}destroy(){for(let e of this.segments)for(let i in e.vaos)e.vaos[i].destroy()}static simpleSegment(e,i,r,a){return new n0([{vertexOffset:e,primitiveOffset:i,vertexLength:r,primitiveLength:a,vaos:{},sortKey:0}])}}function n1(e,i){return 256*(e=eD(Math.floor(e),0,255))+eD(Math.floor(i),0,255)}n0.MAX_VERTEX_ARRAY_LENGTH=65535,af(n0,"SegmentVector");let n2=na([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),n3=na([{name:"a_dash",components:4,type:"Uint16"}]);
212class n4{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(e,i,r,a){this.ids.push(n5(e)),this.positions.push(i,r,a)}eachPosition(e,i){let r=n5(e),a=0,n=this.ids.length-1;for(;a<n;){let e=a+n>>1;this.ids[e]>=r?n=e:a=e+1}for(;this.ids[a]===r;)i(this.positions[3*a],this.positions[3*a+1],this.positions[3*a+2]),a++}static serialize(e,i){let r=new Float64Array(e.ids),a=new Uint32Array(e.positions);return function e(i,r,a,n){for(;a<n;){let s=i[a+n>>1],l=a-1,h=n+1;for(;;){do l++;while(i[l]<s)do h--;while(i[h]>s)if(l>=h)break;n6(i,l,h),n6(r,3*l,3*h),n6(r,3*l+1,3*h+1),n6(r,3*l+2,3*h+2)}h-a<n-h?(e(i,r,a,h),a=h+1):(e(i,r,h+1,n),n=h)}}(r,a,0,r.length-1),i&&(i.add(r.buffer),i.add(a.buffer)),{ids:r,positions:a}}static deserialize(e){let i;let r=new n4;for(let a of(r.ids=e.ids,r.positions=e.positions,r.ids))a!==i&&r.uniqueIds.push(a),i=a;return r.indexed=!0,r}}function n5(e){let i=+e;return!isNaN(i)&&Number.MIN_SAFE_INTEGER<=i&&i<=Number.MAX_SAFE_INTEGER?i:tP(String(e))}function n6(e,i,r){let a=e[i];e[i]=e[r],e[r]=a}af(n4,"FeaturePositionMap");class n8{constructor(e){this.gl=e.gl,this.initialized=!1}fetchUniformLocation(e,i){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(e,i),this.initialized=!0),!!this.location}set(e,i,r){throw Error("Uniform#set() must be implemented by each concrete Uniform")}}class n9 extends n8{constructor(e){super(e),this.current=0}set(e,i,r){this.fetchUniformLocation(e,i)&&this.current!==r&&(this.current=r,this.gl.uniform1i(this.location,r))}}class n7 extends n8{constructor(e){super(e),this.current=0}set(e,i,r){this.fetchUniformLocation(e,i)&&this.current!==r&&(this.current=r,this.gl.uniform1f(this.location,r))}}class oe extends n8{constructor(e){super(e),this.current=[0,0]}set(e,i,r){this.fetchUniformLocation(e,i)&&(r[0]===this.current[0]&&r[1]===this.current[1]||(this.current=r,this.gl.uniform2f(this.location,r[0],r[1])))}}class ot extends n8{constructor(e){super(e),this.current=[0,0,0]}set(e,i,r){this.fetchUniformLocation(e,i)&&(r[0]===this.current[0]&&r[1]===this.current[1]&&r[2]===this.current[2]||(this.current=r,this.gl.uniform3f(this.location,r[0],r[1],r[2])))}}class oi extends n8{constructor(e){super(e),this.current=[0,0,0,0]}set(e,i,r){this.fetchUniformLocation(e,i)&&(r[0]===this.current[0]&&r[1]===this.current[1]&&r[2]===this.current[2]&&r[3]===this.current[3]||(this.current=r,this.gl.uniform4f(this.location,r[0],r[1],r[2],r[3])))}}class or extends n8{constructor(e){super(e),this.current=tN.transparent.toRenderColor(null)}set(e,i,r){this.fetchUniformLocation(e,i)&&(r.r===this.current.r&&r.g===this.current.g&&r.b===this.current.b&&r.a===this.current.a||(this.current=r,this.gl.uniform4f(this.location,r.r,r.g,r.b,r.a)))}}let oa=new Float32Array(16);class on extends n8{constructor(e){super(e),this.current=oa}set(e,i,r){if(this.fetchUniformLocation(e,i)){if(r[12]!==this.current[12]||r[0]!==this.current[0])return this.current=r,void this.gl.uniformMatrix4fv(this.location,!1,r);for(let e=1;e<16;e++)if(r[e]!==this.current[e]){this.current=r,this.gl.uniformMatrix4fv(this.location,!1,r);break}}}}let oo=new Float32Array(9),os=new Float32Array(4);class ol extends n8{constructor(e){super(e),this.current=os}set(e,i,r){if(this.fetchUniformLocation(e,i)){for(let e=0;e<4;e++)if(r[e]!==this.current[e]){this.current=r,this.gl.uniformMatrix2fv(this.location,!1,r);break}}}}function oh(e){return[n1(255*e.r,255*e.g),n1(255*e.b,255*e.a)]}class ou{constructor(e,i,r,a){this.value=e,this.uniformNames=i.map(e=>`u_${e}`),this.type=r,this.context=a}setUniform(e,i,r,a,n){let s=a.constantOr(this.value);i.set(e,n,s instanceof tN?s.toRenderColor(this.context.lut):s)}getBinding(e,i){return"color"===this.type?new or(e):new n7(e)}}class oc{constructor(e,i){this.uniformNames=i.map(e=>`u_${e}`),this.pattern=null,this.pixelRatio=1}setConstantPatternPositions(e){this.pixelRatio=e.pixelRatio||1,this.pattern=e.tl.concat(e.br)}setUniform(e,i,r,a,n){let s="u_pattern"===n||"u_dash"===n?this.pattern:"u_pixel_ratio"===n?this.pixelRatio:null;s&&i.set(e,n,s)}getBinding(e,i){return"u_pattern"===i||"u_dash"===i?new oi(e):new n7(e)}}class od{constructor(e,i,r,a){this.expression=e,this.type=r,this.maxValue=0,this.paintVertexAttributes=i.map(e=>({name:`a_${e}`,type:"Float32",components:"color"===r?2:1,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,i,r,a,n,s,l){let h=this.paintVertexArray.length,u=this.expression.evaluate(new aO(0,{brightness:s}),i,{},n,a,l);this.paintVertexArray.resize(e),this._setPaintValue(h,e,u,this.context)}updatePaintArray(e,i,r,a,n,s,l){let h=this.expression.evaluate({zoom:0,brightness:l},r,a,void 0,n);this._setPaintValue(e,i,h,this.context)}_setPaintValue(e,i,r,a){if("color"===this.type){let n=oh(r.toRenderColor(a.lut));for(let r=e;r<i;r++)this.paintVertexArray.emplace(r,n[0],n[1])}else{for(let a=e;a<i;a++)this.paintVertexArray.emplace(a,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||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class op{constructor(e,i,r,a,n,s){this.expression=e,this.uniformNames=i.map(e=>`u_${e}_t`),this.type=r,this.useIntegerZoom=a,this.context=n,this.maxValue=0,this.paintVertexAttributes=i.map(e=>({name:`a_${e}`,type:"Float32",components:"color"===r?4:2,offset:0})),this.paintVertexArray=new s}populatePaintArray(e,i,r,a,n,s,l){let h=this.expression.evaluate(new aO(this.context.zoom,{brightness:s}),i,{},n,a,l),u=this.expression.evaluate(new aO(this.context.zoom+1,{brightness:s}),i,{}
212,n,a,l),c=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(c,e,h,u,this.context)}updatePaintArray(e,i,r,a,n,s,l){let h=this.expression.evaluate({zoom:this.context.zoom,brightness:l},r,a,void 0,n),u=this.expression.evaluate({zoom:this.context.zoom+1,brightness:l},r,a,void 0,n);this._setPaintValue(e,i,h,u,this.context)}_setPaintValue(e,i,r,a,n){if("color"===this.type){let a=oh(r.toRenderColor(n.lut)),s=oh(r.toRenderColor(n.lut));for(let r=e;r<i;r++)this.paintVertexArray.emplace(r,a[0],a[1],s[0],s[1])}else{for(let n=e;n<i;n++)this.paintVertexArray.emplace(n,r,a);this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(a))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,i,r,a,n){let s=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,l=eD(this.expression.interpolationFactor(s,this.context.zoom,this.context.zoom+1),0,1);i.set(e,n,l)}getBinding(e,i){return new n7(e)}}class of{constructor(e,i,r,a,n){this.expression=e,this.layerId=n,this.paintVertexAttributes=("array"===r?n3:n2).members;for(let e=0;e<i.length;++e);this.paintVertexArray=new a}populatePaintArray(e,i,r,a){let n=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValues(n,e,i.patterns&&i.patterns[this.layerId],r)}updatePaintArray(e,i,r,a,n,s,l){this._setPaintValues(e,i,r.patterns&&r.patterns[this.layerId],s)}_setPaintValues(e,i,r,a){if(!a||!r)return;let n=a[r];if(!n)return;let{tl:s,br:l,pixelRatio:h}=n;for(let r=e;r<i;r++)this.paintVertexArray.emplace(r,s[0],s[1],l[0],l[1],h)}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class om{constructor(e,i,r=()=>!0){this.binders={},this._buffers=[],this.context=i;let a=[];for(let s in e.paint._values){var n;let l=e.paint.get(s);if(!r(s)||!(l instanceof aG&&r2(l.property.specification)))continue;let h=(n=e.type,og[s]||[s.replace(`${n}-`,"").replace(/-/g,"_")]),u=l.value,c=l.property.specification.type,d=!!l.property.useIntegerZoom,p="line-dasharray"===s||s.endsWith("pattern"),f="line-dasharray"===s&&"constant"!==e.layout.get("line-cap").value.kind;if("constant"!==u.kind||f){if("source"===u.kind||f||p){let i=ov(s,c,"source");this.binders[s]=p?new of(u,h,c,i,e.id):new od(u,h,c,i),a.push(`/a_${s}`)}else{let e=ov(s,c,"composite");this.binders[s]=new op(u,h,c,d,i,e),a.push(`/z_${s}`)}}else this.binders[s]=p?new oc(u.value,h):new ou(u.value,h,c,i),a.push(`/u_${s}`)}this.cacheKey=a.sort().join("")}getMaxValue(e){let i=this.binders[e];return i instanceof od||i instanceof op?i.maxValue:0}populatePaintArrays(e,i,r,a,n,s,l){for(let h in this.binders){let u=this.binders[h];u.context=this.context,(u instanceof od||u instanceof op||u instanceof of)&&u.populatePaintArray(e,i,r,a,n,s,l)}}setConstantPatternPositions(e){for(let i in this.binders){let r=this.binders[i];r instanceof oc&&r.setConstantPatternPositions(e)}}updatePaintArrays(e,i,r,a,n,s,l,h){let u=!1,c=Object.keys(e),d=0!==c.length,p=d?c:i.uniqueIds;for(let c in this.context.lut=n.lut,this.binders){let f=this.binders[c];if(f.context=this.context,(f instanceof od||f instanceof op||f instanceof of)&&(!0===f.expression.isStateDependent||!1===f.expression.isLightConstant)){let m=n.paint.get(c);for(let r of(f.expression=m.value,p)){let n=e[r.toString()];i.eachPosition(r,(e,i,r)=>{let u=a.feature(e);f.updatePaintArray(i,r,u,n,s,l,h)})}if(!d)for(let i of r.uniqueIds){let n=e[i.toString()];r.eachPosition(i,(e,i,r)=>{let u=a.feature(e);f.updatePaintArray(i,r,u,n,s,l,h)})}u=!0}}return u}defines(){let e=[];for(let i in this.binders){let r=this.binders[i];(r instanceof ou||r instanceof oc)&&e.push(...r.uniformNames.map(e=>`#define HAS_UNIFORM_${e}`))}return e}getBinderAttributes(){let e=[];for(let i in this.binders){let r=this.binders[i];if(r instanceof od||r instanceof op||r instanceof of)for(let i=0;i<r.paintVertexAttributes.length;i++)e.push(r.paintVertexAttributes[i].name)}return e}getBinderUniforms(){let e=[];for(let i in this.binders){let r=this.binders[i];if(r instanceof ou||r instanceof oc||r instanceof op)for(let i of r.uniformNames)e.push(i)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e){let i=[];for(let r in this.binders){let a=this.binders[r];if(a instanceof ou||a instanceof oc||a instanceof op)for(let n of a.uniformNames)i.push({name:n,property:r,binding:a.getBinding(e,n)})}return i}setUniforms(e,i,r,a,n){for(let{name:i,property:s,binding:l}of r)this.binders[s].setUniform(e,l,n,a.get(s),i)}updatePaintBuffers(){for(let e in this._buffers=[],this.binders){let i=this.binders[e];(i instanceof od||i instanceof op||i instanceof of)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(e){for(let i in this.binders){let r=this.binders[i];(r instanceof od||r instanceof op||r instanceof of)&&r.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let i=this.binders[e];(i instanceof od||i instanceof op||i instanceof of)&&i.destroy()}}}class o_{constructor(e,i,r=()=>!0){for(let a of(this.programConfigurations={},e))this.programConfigurations[a.id]=new om(a,i,r);this.needsUpload=!1,this._featureMap=new n4,this._featureMapWithoutIds=new n4,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(e,i,r,a,n,s,l,h){for(let r in this.programConfigurations)this.programConfigurations[r].populatePaintArrays(e,i,a,n,s,l,h);void 0!==i.id?this._featureMap.add(i.id,r,this._bufferOffset,e):(this._featureMapWithoutIds.add(this._idlessCounter,r,this._bufferOffset,e),this._idlessCounter+=1),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,i,r,a,n,s){for(let l of r)this.needsUpload=this.programConfigurations[l.id].updatePaintArrays(e,this._featureMap,this._featureMapWithoutIds,i,l,a,n,s||0)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(let i in this.programConfigurations)this.programConfigurations[i].upload(e);this.needsUpload=!1}}destroy(){for(let e in this.programConfigurations)this.programConfigurations[e].destroy()}}let og={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-occlusion-opacity":["occlusion_opacity"],"icon-occlusion-opacity":["occlusion_opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-emissive-strength":["emissive_strength"],"icon-emissive-strength":["emissive_strength"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"symbol-z-offset":["z_offset"],"line-gap-width":["ga
212pwidth"],"line-pattern":["pattern","pixel_ratio"],"fill-pattern":["pattern","pixel_ratio"],"fill-extrusion-pattern":["pattern","pixel_ratio"],"line-dasharray":["dash"]},oy={"line-pattern":{source:np,composite:np},"fill-pattern":{source:np,composite:np},"fill-extrusion-pattern":{source:np,composite:np},"line-dasharray":{source:nf,composite:nf}},ox={color:{source:nz,composite:nc},number:{source:nA,composite:nz}};function ov(e,i,r){let a=oy[e];return a&&a[r]||ox[i][r]}af(ou,"ConstantBinder"),af(oc,"PatternConstantBinder"),af(od,"SourceExpressionBinder"),af(of,"PatternCompositeBinder"),af(op,"CompositeExpressionBinder"),af(om,"ProgramConfiguration",{omit:["_buffers"]}),af(o_,"ProgramConfigurationSet");let ob=8192/Math.PI/2,ow=[64,32,16],oT=-ob;function oS(e,i,r,a=ob){return[e*Math.sin(r*=eC)*a,-i*a,e*Math.cos(r)*a]}function oM(e,i,r){return oS(Math.cos(e*eC),Math.sin(e*eC),i,r)}let oE=2*Math.PI*6371008.8;class oA{constructor(e,i){if(isNaN(e)||isNaN(i))throw Error(`Invalid LngLat object: (${e}, ${i})`);if(this.lng=+e,this.lat=+i,this.lat>90||this.lat<-90)throw Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new oA(eB(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){let i=Math.PI/180,r=this.lat*i,a=e.lat*i;return 6371008.8*Math.acos(Math.min(Math.sin(r)*Math.sin(a)+Math.cos(r)*Math.cos(a)*Math.cos((e.lng-this.lng)*i),1))}toBounds(e=0){let i=360*e/0x2637f09,r=i/Math.cos(Math.PI/180*this.lat);return new oI({lng:this.lng-r,lat:this.lat-i},{lng:this.lng+r,lat:this.lat+i})}toEcef(e){return oM(this.lat,this.lng,ob+e*ob/6371008.8)}static convert(e){if(e instanceof oA)return e;if(Array.isArray(e)&&(2===e.length||3===e.length))return new oA(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return new oA(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}class oI{constructor(e,i){e&&(i?this.setSouthWest(e).setNorthEast(i):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 oA?new oA(e.lng,e.lat):oA.convert(e),this}setSouthWest(e){return this._sw=e instanceof oA?new oA(e.lng,e.lat):oA.convert(e),this}extend(e){let i,r;let a=this._sw,n=this._ne;if(e instanceof oA)i=e,r=e;else{if(!(e instanceof oI))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(oI.convert(e)):this.extend(oA.convert(e)):"object"==typeof e&&null!==e&&e.hasOwnProperty("lat")&&(e.hasOwnProperty("lon")||e.hasOwnProperty("lng"))?this.extend(oA.convert(e)):this;if(i=e._sw,r=e._ne,!i||!r)return this}return a||n?(a.lng=Math.min(i.lng,a.lng),a.lat=Math.min(i.lat,a.lat),n.lng=Math.max(r.lng,n.lng),n.lat=Math.max(r.lat,n.lat)):(this._sw=new oA(i.lng,i.lat),this._ne=new oA(r.lng,r.lat)),this}getCenter(){return new oA((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 oA(this.getWest(),this.getNorth())}getSouthEast(){return new oA(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){let{lng:i,lat:r}=oA.convert(e),a=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(a=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&a}static convert(e){if(e)return e instanceof oI?e:new oI(e)}}function oC(e){return oE*Math.cos(e*Math.PI/180)}function oP(e){return(180+e)/360}function oL(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function ok(e){return 360*e-180}function oR(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180)
212)-90}function oz(e){return Math.cos(eD(e,-85.051129,85.051129)*eC)}function oD(e,i){let r=Math.pow(2,eD(i,0,25.5));return oz(e)*oE/(512*r)}function oO(e){return 1/Math.cos(e*Math.PI/180)}function oB(e,i=0){let r=Math.exp(Math.PI*(1-(e.y+i/8192)/(1<<e.z)*2));return 0x4c6fe12*r/(r*r+1)/8192/(1<<e.z)}class oF{constructor(e,i,r=0){this.x=+e,this.y=+i,this.z=+r}static fromLngLat(e,i=0){let r=oA.convert(e);return new oF(oP(r.lng),oL(r.lat),i/oC(r.lat))}toLngLat(){return new oA(ok(this.x),oR(this.y))}toAltitude(){return this.z*oC(oR(this.y))}meterInMercatorCoordinateUnits(){return 1/oE*oO(oR(this.y))}}function oN(e,i,r){let a=e[0],n=a.x,s=a.y;i(a);let l=[a];for(let h=1;h<e.length;h++){let u=e[h],{x:c,y:d}=u;i(u),function e(i,r,a,n,s,l,h,u,c){let d=(r+n)/2,p=(a+s)/2,f=new eA(d,p);u(f),function(e,i,r,a,n,s){let l=r-n,h=a-s;return Math.abs((a-i)*l-(r-e)*h)/Math.hypot(l,h)}(f.x,f.y,l.x,l.y,h.x,h.y)>=c?(e(i,r,a,d,p,l,f,u,c),e(i,d,p,n,s,f,h,u,c)):i.push(h)}(l,n,s,c,d,a,u,i,r),n=c,s=d,a=u}return l}let oV=-16383-1;function oU(e,i,r){let a=e.loadGeometry(),n=e.extent,s=8192/n;if(i&&r&&r.projection.isReprojectedInTileSpace){let s=1<<i.z,{scale:l,x:h,y:u,projection:c}=r,d=e=>{let r=ok((i.x+e.x/n)/s),a=oR((i.y+e.y/n)/s),d=c.project(r,a);e.x=(d.x*l-h)*n,e.y=(d.y*l-u)*n};for(let i=0;i<a.length;i++)if(1!==e.type)a[i]=oN(a[i],d,1);else{let e=[];for(let r of a[i])r.x<0||r.x>=n||r.y<0||r.y>=n||(d(r),e.push(r));a[i]=e}}for(let e of a)for(let i of e)!function(e,i){let r=Math.round(e.x*i),a=Math.round(e.y*i);e.x=eD(r,oV,16383),e.y=eD(a,oV,16383),(r<e.x||r>e.x+1||a<e.y||a>e.y+1)&&eX("Geometry exceeds allowed extent, reduce your vector tile buffer size")}(i,s);return a}function oj(e,i){return{type:e.type,id:e.id,properties:e.properties,geometry:i?oU(e):[]}}function oG(e,i,r,a,n){e.emplaceBack(2*i+(a+1)/2,2*r+(n+1)/2)}function oq(e,i,r){e.emplaceBack(i.x,i.y,i.z,16384*r[0],16384*r[1],16384*r[2])}class oW{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.hasPattern=!1,this.projection=e.projection,this.layoutVertexArray=new no,this.indexArray=new nS,this.segments=new n0,this.programConfigurations=new o_(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}updateFootprints(e,i){}populate(e,i,r,a){let n=this.layers[0],s=[],l=null;for(let{feature:i,id:h,index:u,sourceLayerIndex:c}of("circle"===n.type&&(l=n.layout.get("circle-sort-key")),e)){let e=this.layers[0]._featureFilter.needGeometry,n=oj(i,e);if(!this.layers[0]._featureFilter.filter(new aO(this.zoom),n,r))continue;let d=l?l.evaluate(n,{},r):void 0,p={id:h,properties:i.properties,type:i.type,sourceLayerIndex:c,index:u,geometry:e?n.geometry:oU(i,r,a),patterns:{},sortKey:d};s.push(p)}l&&s.sort((e,i)=>e.sortKey-i.sortKey);let h=null;for(let n of("globe"===a.projection.name&&(this.globeExtVertexArray=new nm,h=a.projection),s)){let{geometry:a,index:s,sourceLayerIndex:l}=n,u=e[s].feature;this.addFeature(n,a,s,i.availableImages,r,h,i.brightness),i.featureIndex.insert(u,a,s,l,this.index)}}update(e,i,r,a,n){let s=0!==Object.keys(e).length;s&&!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(e,i,s?this.stateDependentLayers:this.layers,r,a,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,nK.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,nQ.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}addFeature(e,i,r,a,n,s,l){for(let r of i)for(let i of r){let r=i.x,a=i.y;if(r<0||r>=8192||a<0||a>=8192)continue;if(s){let e=s.projectTilePoint(r,a,n),i=s.upVector(n,r,a),l=this.globeExtVertexArray;oq(l,e,i),oq(l,e,i),oq(l,e,i),oq(l,e,i)}let l=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),h=l.vertexLength;oG(this.layoutVertexArray,r,a,-1,-1),oG(this.layoutVertexArray,r,a,1,-1),oG(this.layoutVertexArray,r,a,1,1),oG(this.layoutVertexArray,r,a,-1,1),this.indexArray.emplaceBack(h,h+1,h+2),this.indexArray.emplaceBack(h,h+2,h+3),l.vertexLength+=4,l.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,{},a,n,l)}}function o$(e,i){for(let r=0;r<e.length;r++)if(oK(i,e[r]))return!0;for(let r=0;r<i.length;r++)if(oK(e,i[r]))return!0;return!!oZ(e,i)}function oH(e,i){if(1===e.length)return oJ(i,e[0]);for(let r=0;r<i.length;r++){let a=i[r];for(let i=0;i<a.length;i++)if(oK(e,a[i]))return!0}for(let r=0;r<e.length;r++)if(oJ(i,e[r]))return!0;for(let r=0;r<i.length;r++)if(oZ(e,i[r]))return!0;return!1}function oZ(e,i){if(0===e.length||0===i.length)return!1;for(let n=0;n<e.length-1;n++){let s=e[n],l=e[n+1];for(let e=0;e<i.length-1;e++){var r,a;if(eY(s,r=i[e],a=i[e+1])!==eY(l,r,a)&&eY(s,l,r)!==eY(s,l,a))return!0}}return!1}function oX(e,i,r){let a=r*r;if(1===i.length)return e.distSqr(i[0])<a;for(let r=1;r<i.length;r++)if(oY(e,i[r-1],i[r])<a)return!0;return!1}function oY(e,i,r){let a=i.distSqr(r);if(0===a)return e.distSqr(i);let n=((e.x-i.x)*(r.x-i.x)+(e.y-i.y)*(r.y-i.y))/a;return e.distSqr(n<0?i:n>1?r:r.sub(i)._mult(n)._add(i))}function oJ(e,i){let r,a,n,s=!1;for(let l=0;l<e.length;l++){r=e[l];for(let e=0,l=r.length-1;e<r.length;l=e++)a=r[e],n=r[l],a.y>i.y!=n.y>i.y&&i.x<(n.x-a.x)*(i.y-a.y)/(n.y-a.y)+a.x&&(s=!s)}return s}function oK(e,i){let r=!1;for(let a=0,n=e.length-1;a<e.length;n=a++){let s=e[a],l=e[n];s.y>i.y!=l.y>i.y&&i.x<(l.x-s.x)*(i.y-s.y)/(l.y-s.y)+s.x&&(r=!r)}return r}function oQ(e,i,r,a,n){for(let s of e)if(i<=s.x&&r<=s.y&&a>=s.x&&n>=s.y)return!0;let s=[new eA(i,r),new eA(i,n),new eA(a,n),new eA(a,r)];if(e.length>2){for(let i of s)if(oK(e,i))return!0}for(let i=0;i<e.length-1;i++)if(o0(e[i],e[i+1],s))return!0;return!1}function o0(e,i,r){let a=r[0],n=r[2];if(e.x<a.x&&i.x<a.x||e.x>n.x&&i.x>n.x||e.y<a.y&&i.y<a.y||e.y>n.y&&i.y>n.y)return!1;let s=eY(e,i,r[0]);return s!==eY(e,i,r[1])||s!==eY(e,i,r[2])||s!==eY(e,i,r[3])}function o1(e,i,r,a,n,s){let l=i.y-e.y,h=e.x-i.x;if(s=s||0){let e=l*l+h*h;if(0===e)return!0;let i=Math.sqrt(e);l/=i,h/=i}return!((r.x-e.x)*l+(r.y-e.y)*h-s<0||(a.x-e.x)*l+(a.y-e.y)*h-s<0||(n.x-e.x)*l+(n.y-e.y)*h-s<0)}function o2(e,i,r,a,n,s,l){return!(o1(e,i,a,n,s,l)||o1(i,r,a,n,s,l)||o1(r,e,a,n,s,l)||o1(a,n,e,i,r,l)||o1(n,s,e,i,r,l)||o1(s,a,e,i,r,l))}function o3(e,i,r){let a=i.paint.get(e).value;return"constant"===a.kind?a.value:r.programConfigurations.get(i.id).getMaxValue(e)}function o4(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function o5(e,i,r,a,n){if(!i[0]&&!i[1])return e;let s=eA.convert(i)._mult(n);"viewport"===r&&s._rotate(-a);let l=[];for(let i=0;i<e.length;
212i++)l.push(e[i].sub(s));return l}function o6(e,i,r,a){let n=eA.convert(e)._mult(a);return"viewport"===i&&n._rotate(-r),n}af(oW,"CircleBucket",{omit:["layers"]});var o8,o9={exports:{}},o7=(o8||(o8=1,function(e){function i(e,i,a){var n=r(256*e,256*(i=Math.pow(2,a)-i-1),a),s=r(256*(e+1),256*(i+1),a);return n[0]+","+n[1]+","+s[0]+","+s[1]}function r(e,i,r){var a=2*Math.PI*6378137/256/Math.pow(2,r);return[e*a-2*Math.PI*6378137/2,i*a-2*Math.PI*6378137/2]}e.getURL=function(e,r,a,n,s,l){return l=l||{},e+"?"+["bbox="+i(a,n,s),"format="+(l.format||"image/png"),"service="+(l.service||"WMS"),"version="+(l.version||"1.1.1"),"request="+(l.request||"GetMap"),"srs="+(l.srs||"EPSG:3857"),"width="+(l.width||256),"height="+(l.height||256),"layers="+r].join("&")},e.getTileBBox=i,e.getMercCoords=r,Object.defineProperty(e,"__esModule",{value:!0})}(o9.exports)),o9.exports);class se{constructor(e,i,r){this.z=e,this.x=i,this.y=r,this.key=sr(0,e,e,i,r)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,i){let r=o7.getTileBBox(this.x,this.y,this.z),a=function(e,i,r){let a,n="";for(let s=e;s>0;s--)n+=(i&(a=1<<s-1)?1:0)+(r&a?2:0);return n}(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String("tms"===i?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",a).replace("{bbox-epsg-3857}",r)}toString(){return`${this.z}/${this.x}/${this.y}`}}class st{constructor(e,i){this.wrap=e,this.canonical=i,this.key=sr(e,i.z,i.z,i.x,i.y)}}class si{constructor(e,i,r,a,n){this.overscaledZ=e,this.wrap=i,this.canonical=new se(r,+a,+n),this.key=0===i&&e===r?this.canonical.key:sr(i,e,r,a,n)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){let i=this.canonical.z-e;return e>this.canonical.z?new si(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new si(e,this.wrap,e,this.canonical.x>>i,this.canonical.y>>i)}calculateScaledKey(e,i=!0){if(this.overscaledZ===e&&i)return this.key;if(e>this.canonical.z)return sr(this.wrap*+i,e,this.canonical.z,this.canonical.x,this.canonical.y);{let r=this.canonical.z-e;return sr(this.wrap*+i,e,e,this.canonical.x>>r,this.canonical.y>>r)}}isChildOf(e){if(e.wrap!==this.wrap)return!1;let i=this.canonical.z-e.canonical.z;return 0===e.overscaledZ||e.overscaledZ<this.overscaledZ&&e.canonical.z<this.canonical.z&&e.canonical.x===this.canonical.x>>i&&e.canonical.y===this.canonical.y>>i}children(e){if(this.overscaledZ>=e)return[new si(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let i=this.canonical.z+1,r=2*this.canonical.x,a=2*this.canonical.y;return[new si(i,this.wrap,i,r,a),new si(i,this.wrap,i,r+1,a),new si(i,this.wrap,i,r,a+1),new si(i,this.wrap,i,r+1,a+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new si(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new si(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 st(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function sr(e,i,r,a,n){let s=1<<Math.min(r,22),l=n%s*s+a%s;return e&&r<22&&(l+=s*s*((e<0?-2*e-1:2*e)%(1<<2*(22-r)))),16*(32*l+r)+(i-r)}let sa=[e=>{let i=e.canonical.x-1,r=e.wrap;return i<0&&(i=(1<<e.canonical.z)-1,r--),new si(e.overscaledZ,r,e.canonical.z,i,e.canonical.y)},e=>{let i=e.canonical.x+1,r=e.wrap;return i===1<<e.canonical.z&&(i=0,r++),new si(e.overscaledZ,r,e.canonical.z,i,e.canonical.y)},e=>new si(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,(0===e.canonical.y?1<<e.canonical.z:e.canonical.y)-1),e=>new si(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y===(1<<e.canonical.z)-1?0:e.canonical.y+1)];af(se,"CanonicalTileID"),af(si,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});let{members:sn}=na([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),so=na([{name:"a_pos_3",components:3,type:"Int16"}]);var ss=na([{name:"a_pos",type:"Int16",components:2}]);class sl{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,r){let a=eS.vec3.dot(i,this.dir);if(1e-6>
212Math.abs(a))return!1;let n=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1]+(e[2]-this.pos[2])*i[2])/a;return r[0]=this.pos[0]+this.dir[0]*n,r[1]=this.pos[1]+this.dir[1]*n,r[2]=this.pos[2]+this.dir[2]*n,!0}closestPointOnSphere(e,i,r){if(eS.vec3.equals(this.pos,e)||0===i)return r[0]=r[1]=r[2]=0,!1;let[a,n,s]=this.dir,l=this.pos[0]-e[0],h=this.pos[1]-e[1],u=this.pos[2]-e[2],c=a*a+n*n+s*s,d=2*(l*a+h*n+u*s),p=d*d-4*c*(l*l+h*h+u*u-i*i);if(p<0){let e=Math.max(-d/2,0),c=l+a*e,p=h+n*e,f=u+s*e,m=Math.hypot(c,p,f);return r[0]=c*i/m,r[1]=p*i/m,r[2]=f*i/m,!1}{let e=(-d-Math.sqrt(p))/(2*c);if(e<0){let e=Math.hypot(l,h,u);return r[0]=l*i/e,r[1]=h*i/e,r[2]=u*i/e,!1}return r[0]=l+a*e,r[1]=h+n*e,r[2]=u+s*e,!0}}}class sh{constructor(e,i,r,a,n){this.TL=e,this.TR=i,this.BR=r,this.BL=a,this.horizon=n}static fromInvProjectionMatrix(e,i,r){let a=[-1,1,1],n=[1,1,1],s=[1,-1,1],l=[-1,-1,1],h=eS.vec3.transformMat4(a,a,e);return new sh(h,eS.vec3.transformMat4(n,n,e),eS.vec3.transformMat4(s,s,e),eS.vec3.transformMat4(l,l,e),i/r)}}function su(e,i,r){let a=1/0,n=-1/0,s=[];for(let l of e){eS.vec3.sub(s,l,i);let e=eS.vec3.dot(s,r);a=Math.min(a,e),n=Math.max(n,e)}return[a,n]}function sc(e,i){let r=!0;for(let a=0;a<e.planes.length;a++){let n=e.planes[a],s=0;for(let e=0;e<i.length;e++)s+=eS.vec3.dot(n,i[e])+n[3]>=0;if(0===s)return 0;s!==i.length&&(r=!1)}return r?2:1}function sd(e,i){for(let r of e.projections){let a=su(i,e.points[0],r.axis);if(r.projection[1]<a[0]||r.projection[0]>a[1])return 0}return 1}function sp(e,i){let r=0,a=[0,0,0,0];for(let n=0;n<e.length;n++)a[0]=e[n][0],a[1]=e[n][1],a[2]=e[n][2],a[3]=1,eS.vec4.dot(a,i)>=0&&r++;return r}class sf{constructor(e,i){for(let r of(this.points=e||Array(8).fill([0,0,0]),this.planes=i||Array(6).fill([0,0,0,0]),this.bounds=sm.fromPoints(this.points),this.projections=[],this.frustumEdges=[eS.vec3.sub([],this.points[2],this.points[3]),eS.vec3.sub([],this.points[0],this.points[3]),eS.vec3.sub([],this.points[4],this.points[0]),eS.vec3.sub([],this.points[5],this.points[1]),eS.vec3.sub([],this.points[6],this.points[2]),eS.vec3.sub([],this.points[7],this.points[3])],this.frustumEdges)){let e=[0,-r[2],r[1]],i=[r[2],0,-r[0]];this.projections.push({axis:e,projection:su(this.points,this.points[0],e)}),this.projections.push({axis:i,projection:su(this.points,this.points[0],i)})}}static fromInvProjectionMatrix(e,i,r,a){let n=Math.pow(2,r),s=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(r=>{let s=eS.vec4.transformMat4([],r,e),l=1/s[3]/i*n;return eS.vec4.mul(s,s,[l,l,a?1/s[3]:l,l])}),l=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(e=>{let i=eS.vec3.sub([],s[e[0]],s[e[1]]),r=eS.vec3.sub([],s[e[2]],s[e[1]]),a=eS.vec3.normalize([],eS.vec3.cross([],i,r)),n=-eS.vec3.dot(a,s[e[1]]);return a.concat(n)}),h=[];for(let e=0;e<s.length;e++)h.push([s[e][0],s[e][1],s[e][2]]);return new sf(h,l)}intersectsPrecise(e,i,r){for(let r=0;r<i.length;r++)if(!sp(e,i[r]))return 0;for(let i=0;i<this.planes.length;i++)if(!sp(e,this.planes[i]))return 0;for(let i of r)for(let r of this.frustumEdges){let a=eS.vec3.cross([],i,r),n=eS.vec3.length(a);if(0===n)continue;eS.vec3.scale(a,a,1/n);let s=su(this.points,this.points[0],a),l=su(e,this.points[0],a);if(s[0]>l[1]||l[0]>s[1])return 0}return 1}containsPoint(e){for(let i of this.planes){let r=i[3];if(eS.vec3.dot([i[0],i[1],i[2]],e)+r<0)return!1}return!0}}class sm{static fromPoints(e){let i=[1/0,1/0,1/0],r=[-1/0,-1/0,-1/0];for(let a of e)eS.vec3.min(i,i,a),eS.vec3.max(r,r,a);return new sm(i,r)}static fromTileIdAndHeight(e,i,r){let a=1<<e.canonical.z,n=e.canonical.x,s=e.canonical.y;return new sm([n/a,s/a,i],[(n+1)/a,(s+1)/a,r])}static applyTransform(e,i){let r=e.getCorners();for(let e=0;e<r.length;++e)eS.vec3.transformMat4(r[e],r[e],i);return sm.fromPoints(r)}static applyTransformFast(e,i){let r=[i[12],i[13],i[14]],a=[...r];for(let n=0;n<3;n++)for(let s=0;s<3;s++){let l=i[4*s+n],h=l*e.min[s],u=l*e.max[s];r[n]+=Math.min(h,u),a[n]+=Math.max(h,u)}return new sm(r,a)}static projectAabbCorners(e,i){let r=e.getCorners();for(let e=0;e<r.length;++e)eS.vec3.transformMat4(r[e],r[e],i);return r}constructor(e,i){this.min=e,this.max=i,this.center=eS.vec3.scale([],eS.vec3.add([],this.min,this.max),.5)}quadrant(e){let i=[e%2==0,e<2],r=eS.vec3.clone(this.min),a=eS.vec3.clone(this.max);for(let e=0;e<i.length;e++)r[e]=i[e]?this.min[e]:this.center[e],a[e]=i[e]?this.center[e]:this.max[e];return a[2]=this.max[2],new sm(r,a)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}distanceZ(e){return Math.max(Math.min(this.max[2],e[2]),this.min[2])-e[2]}getCorners(){let e=this.min,i=this.max;return[[e[0],e[1],e[2]],[i[0],e[1],e[2]],[i[0],i[1],e[2]],[e[0],i[1],e[2]],[e[0],e[1],i[2]],[i[0],e[1],i[2]],[i[0],i[1],i[2]],[e[0],i[1],i[2]]]}intersects(e){return this.intersectsAabb(e.bounds)?sc(e,this.getCorners()):0}intersectsFlat(e){return this.intersectsAabb(e.bounds)?sc(e,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsPrecise(e,i){return i||this.intersects(e)?sd(e,this.getCorners()):0}intersectsPreciseFlat(e,i){return i||this.intersectsFlat(e)?sd(e,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsAabb(e){for(let i=0;i<3;++i)if(this.min[i]>e.max[i]||e.min[i]>this.max[i])return!1;return!0}intersectsAabbXY(e){return!(this.min[0]>e.max[0]||e.min[0]>this.max[0]||this.min[1]>e.max[1]||e.min[1]>this.max[1])}encapsulate(e){for(let i=0;i<3;i++)this.min[i]=Math.min(this.min[i],e.min[i]),this.max[i]=Math.max(this.max[i],e.max[i])}encapsulatePoint(e){for(let i=0;i<3;i++)this.min[i]=Math.min(this.min[i],e[i]),this.max[i]=Math.max(this.max[i],e[i])}closestPoint(e){return[Math.max(Math.min(this.max[0],e[0]),this.min[0]),Math.max(Math.min(this.max[1],e[1]),this.min[1]),Math.max(Math.min(this.max[2],e[2]),this.min[2])]}}function s_(e){return e*ob/6371008.8}af(sm,"Aabb");let sg=[new sm([oT,oT,oT],[ob,ob,ob]),new sm([oT,oT,oT],[0,0,ob]),new sm([0,oT,oT],[ob,0,ob]),new sm([oT,0,oT],[0,ob,ob]),new sm([0,0,oT],[ob,ob,ob])];function sy(e,i,r,a=!0){let n=eS.vec3.scale([],e._camera.position,e.worldSize),s=[i,r,1,1];eS.vec4.transformMat4(s,s,e.pixelMatrixInverse),eS.vec4.scale(s,s,1/s[3]);
212let l=eS.vec3.sub([],s,n),h=eS.vec3.normalize([],l),u=e.globeMatrix,c=[u[12],u[13],u[14]],d=eS.vec3.sub([],c,n),p=eS.vec3.length(d),f=eS.vec3.normalize([],d),m=e.worldSize/(2*Math.PI),_=eS.vec3.dot(f,h),g=Math.asin(m/p);if(g<Math.acos(_)){if(!a)return null;let e=[],i=[];eS.vec3.scale(e,h,p/_),eS.vec3.normalize(i,eS.vec3.sub(i,e,d)),eS.vec3.normalize(h,eS.vec3.add(h,d,eS.vec3.scale(h,i,Math.tan(g)*p)))}let y=[];new sl(n,h).closestPointOnSphere(c,m,y);let x=eS.vec3.normalize([],e1(u,0)),v=eS.vec3.normalize([],e1(u,1)),b=eS.vec3.normalize([],e1(u,2)),w=eS.vec3.dot(x,y),T=eS.vec3.dot(v,y),S=eS.vec3.dot(b,y),M=Math.asin(-T/m)*eP,E=Math.atan2(w,S)*eP;return new oF(oP(E=e.center.lng+function(e,i){let r=(i-e+180)%360-180;return r<-180?r+360:r}(e.center.lng,E)),eD(oL(M),0,1))}class sx{constructor(e,i,r){this.a=eS.vec3.sub([],e,r),this.b=eS.vec3.sub([],i,r),this.center=r;let a=eS.vec3.normalize([],this.a),n=eS.vec3.normalize([],this.b);this.angle=Math.acos(eS.vec3.dot(a,n))}}function sv(e,i){let r;return 0===e.angle?null:(r=0===e.a[i]?1/e.angle*.5*Math.PI:1/e.angle*Math.atan(e.b[i]/e.a[i]/Math.sin(e.angle)-1/Math.tan(e.angle)))<0||r>1?null:function(e,i,r,a){let n=Math.sin(r);return Math.sin((1-a)*r)/n*e+Math.sin(a*r)/n*i}(e.a[i],e.b[i],e.angle,eD(r,0,1))+e.center[i]}function sb(e){if(e.z<=1)return sg[e.z+2*e.y+e.x];let i=sE(sM(e));return sm.fromPoints(i)}function sw(e,i,r){return eS.vec3.scale(e,e,1-r),eS.vec3.scaleAndAdd(e,e,i,r)}function sT(e,i,r){for(let a of e)eS.vec3.transformMat4(a,a,i),eS.vec3.scale(a,a,r)}function sS(e,i,r,a){let n=i/e.worldSize,s=e.globeMatrix;if(r.z<=1){let e=sb(r).getCorners();return sT(e,s,n),sm.fromPoints(e)}let l=sM(r,a),h=sE(l,ob+s_(e._tileCoverLift));sT(h,s,n);let u=Number.MAX_VALUE,c=[-u,-u,-u],d=[u,u,u];if(l.contains(e.center)){for(let e of h)eS.vec3.min(d,d,e),eS.vec3.max(c,c,e);c[2]=0;let i=e.point,r=[i.x*n,i.y*n,0];return eS.vec3.min(d,d,r),eS.vec3.max(c,c,r),new sm(d,c)}if(e._tileCoverLift>0){for(let e of h)eS.vec3.min(d,d,e),eS.vec3.max(c,c,e);return new sm(d,c)}let p=[s[12]*n,s[13]*n,s[14]*n],f=l.getCenter(),m=eD(e.center.lat,-85.051129,85.051129),_=eD(f.lat,-85.051129,85.051129),g=oP(e.center.lng),y=oL(m),x=g-oP(f.lng),v=y-oL(_);x>.5?x-=1:x<-.5&&(x+=1);let b=0;if(Math.abs(x)>Math.abs(v))b=x>=0?1:3;else{b=v>=0?0:2;let e=[s[4]*n,s[5]*n,s[6]*n],i=-Math.sin((v>=0?l.getSouth():l.getNorth())*eC)*ob;eS.vec3.scaleAndAdd(p,p,e,i)}let w=h[b],T=h[(b+1)%4],S=new sx(w,T,p),M=[sv(S,0)||w[0],sv(S,1)||w[1],sv(S,2)||w[2]],E=sD(e.zoom);if(E>0){let a=function({x:e,y:i,z:r},a,n,s,l){let h=1/(1<<r),u=e*h,c=u+h,d=i*h,p=d+h,f=0,m=(u+c)/2-s;return m>.5?f=-1:m<-.5&&(f=1),u=((u+f)*a-(s*=a))*n+s,c=((c+f)*a-s)*n+s,d=(d*a-(l*=a))*n+l,[[u,p=(p*a-l)*n+l,0],[c,p,0],[c,d,0],[u,d,0]]}(r,i,e._pixelsPerMercatorPixel,g,y);for(let e=0;e<h.length;e++)sw(h[e],a[e],E);let n=eS.vec3.add([],a[b],a[(b+1)%4]);eS.vec3.scale(n,n,.5),sw(M,n,E)}for(let e of h)eS.vec3.min(d,d,e),eS.vec3.max(c,c,e);return d[2]=Math.min(w[2],T[2]),eS.vec3.min(d,d,M),eS.vec3.max(c,c,M),new sm(d,c)}function sM({x:e,y:i,z:r},a=!1){let n=1/(1<<r);return new oI(new oA(ok(e*n),i===(1<<r)-1&&a?-90:oR((i+1)*n)),new oA(ok((e+1)*n),0===i&&a?90:oR(i*n)))}function sE(e,i=ob){let r=e.getNorth()*eC,a=e.getSouth()*eC,n=Math.cos(r),s=Math.cos(a),l=Math.sin(r),h=Math.sin(a),u=e.getWest(),c=e.getEast();return[oS(s,h,u,i),oS(s,h,c,i),oS(n,l,c,i),oS(n,l,u,i)]}function sA(e,i,r,a){let n=1<<r.z,s=(e/8192+r.x)/n;return oM(oR((i/8192+r.y)/n),ok(s),a)}function sI({min:e,max:i}){return 16383/Math.max(i[0]-e[0],i[1]-e[1],i[2]-e[2])}let sC=new Float64Array(16);function sP(e){let i=sI(e),r=eS.mat4.fromScaling(sC,[i,i,i]);return eS.mat4.translate(r,r,eS.vec3.negate([],e.min))}function sL(e){let i=eS.mat4.fromTranslation(sC,e.min),r=1/sI(e);return eS.mat4.scale(i,i,[r,r,r])}function sk(e){return e/(2*Math.PI)/(8192/(2*Math.PI))}function sR(e,i){return 8192/(512*Math.pow(2,e))*sI(sb(i))}function sz(e,i,r,a,n){let s=sk(r),l=[e,i,-r/(2*Math.PI)],h=eS.mat4.identity(new Float64Array(16));return eS.mat4.translate(h,h,l),eS.mat4.scale(h,h,[s,s,s]),eS.mat4.rotateX(h,h,-n*eC),eS.mat4.rotateY(h,h,-a*eC),h}function sD(e){return eO(5,6,e)}function sO(e,i){let r=oM(i.lat,i.lng),a=function(e){let i=oM(e._center.lat,e._center.lng),r=eS.vec3.fromValues(0,1,0),a=eS.vec3.cross([],r,i),n=eS.mat4.fromRotation([],-e.angle,i);a=eS.vec3.transformMat4(a,a,n),eS.mat4.fromRotation(n,-e._pitch,a);let s=eS.vec3.normalize([],i);return eS.vec3.scale(s,s,s_(e.cameraToCenterDistance/e.pixelsPerMeter)),eS.vec3.transformMat4(s,s,n),eS.vec3.add([],i,s)}(e),n=eS.vec3.subtract([],a,r);return eS.vec3.angle(n,r)}function sB(e,i){return sO(e,i)>Math.PI/2*1.01}let sF=85*eC,sN=Math.cos(sF),sV=Math.sin(sF),sU=eS.mat4.create(),sj=e=>{let i=[];return"map"===e.paint.get("circle-pitch-alignment")&&i.push("PITCH_WITH_MAP"),"map"===e.paint.get("circle-pitch-scale")&&i.push("SCALE_WITH_MAP"),i};function sG(e,i,r,a,n,s,l,h,u){if(s&&e.queryGeometry.isAboveHorizon)return!1;s&&(u*=e.pixelToTileUnitsFactor);let c=e.tileID.canonical,d=r.projection.upVectorScale(c,r.center.lat,r.worldSize).metersToTile;for(let f of i)for(let i of f){var p;let f=i.add(h),m=n&&r.elevation?r.elevation.exaggeration()*n.getElevationAt(f.x,f.y,!0):0,_=r.projection.projectTilePoint(f.x,f.y,c);if(m>0){let e=r.projection.upVector(c,f.x,f.y);_.x+=e[0]*d*m,_.y+=e[1]*d*m,_.z+=e[2]*d*m}let g=s?f:function(e,i,r,a){let n=eS.vec4.transformMat4([],[e,i,r,1],a);return new eA(n[0]/n[3],n[1]/n[3])}(_.x,_.y,_.z,a),y=s?e.tilespaceRays.map(e=>(function(e,i){let r=eS.vec3.create();return sq[2]=i,e.intersectsPlane(sq,sW,r),new eA(r[0],r[1])})(e,m)):e.queryGeometry.screenGeometry,x=eS.vec4.transformMat4([],[_.x,_.y,_.z,1],a);if(!l&&s?u*=x[3]/r.cameraToCenterDistance:l&&!s&&(u*=r.cameraToCenterDistance/x[3]),s){let e=oR((i.y/8192+c.y)/(1<<c.z));u/=r.projection.pixelsPerMeter(e,1)/(1/oC(e))}if(p=u,oK(y,g)||oX(g,y,p))return!0}return!1}let sq=eS.vec3.fromValues(0,0,0),sW=eS.vec3.fromValues(0,0,1);class s$ extends oW{}function sH(e,{width:i,height:r}
212,a,n){if(n){if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==i*r*a)throw RangeError("mismatched image size")}else n=new Uint8Array(i*r*a);return e.width=i,e.height=r,e.data=n,e}function sZ(e,i,r){let{width:a,height:n}=i;a===e.width&&n===e.height||(sX(e,i,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,a),height:Math.min(e.height,n)},r,null),e.width=a,e.height=n,e.data=i.data)}function sX(e,i,r,a,n,s,l,h){if(0===n.width||0===n.height)return i;if(n.width>e.width||n.height>e.height||r.x>e.width-n.width||r.y>e.height-n.height)throw RangeError("out of range source coordinates for image copy");if(n.width>i.width||n.height>i.height||a.x>i.width-n.width||a.y>i.height-n.height)throw RangeError("out of range destination coordinates for image copy");let u=e.data,c=i.data,d=4===s&&h;for(let h=0;h<n.height;h++){let p=((r.y+h)*e.width+r.x)*s,f=((a.y+h)*i.width+a.x)*s;if(d)for(let e=0;e<n.width;e++){let i=p+e*s+3,r=f+e*s;c[r+0]=255,c[r+1]=255,c[r+2]=255,c[r+3]=u[i]}else if(l)for(let e=0;e<n.width;e++){let i=p+e*s,r=f+e*s,a=u[i+3],n=new tN(u[i+0]/255*
212a,u[i+1]/255*a,u[i+2]/255*a,a).toRenderColor(l).toArray();c[r+0]=n[0],c[r+1]=n[1],c[r+2]=n[2],c[r+3]=n[3]}else for(let e=0;e<n.width*s;e++)c[f+e]=u[p+e]}return i}af(s$,"HeatmapBucket",{omit:["layers"]});class sY{constructor(e,i){sH(this,e,1,i)}resize(e){sZ(this,new sY(e),1)}clone(){return new sY({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,r,a,n){sX(e,i,r,a,n,1,null)}}class sJ{constructor(e,i){sH(this,e,4,i)}resize(e){sZ(this,new sJ(e),4)}replace(e,i){i?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new sJ({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,r,a,n,s,l){sX(e,i,r,a,n,4,s,l)}}class sK{constructor(e,i){this.width=e.width,this.height=e.height,this.data=i instanceof Uint8Array?new Float32Array(i.buffer):i}}function sQ(e){let i={},r=e.resolution||256,a=e.clips?e.clips.length:1,n=e.image||new sJ({width:r,height:a}),s=(r,a,s)=>{i[e.evaluationKey]=s;let l=e.expression.evaluate(i);l&&(n.data[r+a+0]=Math.floor(255*l.r/l.a),n.data[r+a+1]=Math.floor(255*l.g/l.a),n.data[r+a+2]=Math.floor(255*l.b/l.a),n.data[r+a+3]=Math.floor(255*l.a))};if(e.clips)for(let i=0,n=0;i<a;++i,n+=4*r)for(let a=0,l=0;a<r;a++,l+=4){let h=a/(r-1),{start:u,end:c}=e.clips[i];s(n,l,u*(1-h)+c*h)}else for(let e=0,i=0;e<r;e++,i+=4)s(0,i,e/(r-1));return n}af(sY,"AlphaImage"),af(sJ,"RGBAImage");let{members:s0}=na([{name:"a_pos",components:2,type:"Int16"}],4);function s1(e,i,r=2){let a,n,s;let l=i&&i.length,h=l?i[0]*r:e.length,u=s2(e,0,h,r,!0),c=[];if(!u||u.next===u.prev)return c;if(l&&(u=function(e,i,r,a){let n=[];for(let r=0,s=i.length;r<s;r++){let l=s2(e,i[r]*a,r<s-1?i[r+1]*a:e.length,a,!1);l===l.next&&(l.steiner=!0),n.push(function(e){let i=e,r=e;do(i.x<r.x||i.x===r.x&&i.y<r.y)&&(r=i),i=i.next;while(i!==e)return r}(l))}n.sort(s4);for(let e=0;e<n.length;e++)r=function(e,i){let r=function(e,i){let r=i,a=e.x,n=e.y,s,l=-1/0;do{if(n<=r.y&&n>=r.next.y&&r.next.y!==r.y){let e=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y
212);if(e<=a&&e>l&&(l=e,s=r.x<r.next.x?r:r.next,e===a))return s}r=r.next}while(r!==i)if(!s)return null;let h=s,u=s.x,c=s.y,d=1/0;r=s;do{if(a>=r.x&&r.x>=u&&a!==r.x&&s6(n<c?a:l,n,u,c,n<c?l:a,n,r.x,r.y)){var p,f;let i=Math.abs(n-r.y)/(a-r.x);li(r,e)&&(i<d||i===d&&(r.x>s.x||r.x===s.x&&(p=s,f=r,0>s8(p.prev,p,f.prev)&&0>s8(f.next,p,p.next))))&&(s=r,d=i)}r=r.next}while(r!==h)return s}(e,i);if(!r)return i;let a=lr(r,e);return s3(a,a.next),s3(r,r.next)}(n[e],r);return r}(e,i,u,r)),e.length>80*r){a=1/0,n=1/0;let i=-1/0,l=-1/0;for(let s=r;s<h;s+=r){let r=e[s],h=e[s+1];r<a&&(a=r),h<n&&(n=h),r>i&&(i=r),h>l&&(l=h)}s=0!==(s=Math.max(i-a,l-n))?32767/s:0}return function e(i,r,a,n,s,l,h){if(!i)return;!h&&l&&function(e,i,r,a){let n=e;do 0===n.z&&(n.z=s5(n.x,n.y,i,r,a)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==e)n.prevZ.nextZ=null,n.prevZ=null,function(e){let i,r=1;do{let a,n=e;e=null;let s=null;for(i=0;n;){i++;let l=n,h=0;for(let e=0;e<r&&(h++,l=l.nextZ);e++);let u=r;for(;h>0||u>0&&l;)0!==h&&(0===u||!l||n.z<=l.z)?(a=n,n=n.nextZ,h--):(a=l,l=l.nextZ,u--),s?s.nextZ=a:e=a,a.prevZ=s,s=a;n=l}s.nextZ=null,r*=2}while(i>1)}(n)}(i,n,s,l);let u=i;for(;i.prev!==i.next;){let c=i.prev,d=i.next;if(l?function(e,i,r,a){let n=e.prev,s=e.next;if(s8(n,e,s)>=0)return!1;let l=n.x,h=e.x,u=s.x,c=n.y,d=e.y,p=s.y,f=l<h?l<u?l:u:h<u?h:u,m=c<d?c<p?c:p:d<p?d:p,_=l>h?l>u?l:u:h>u?h:u,g=c>d?c>p?c:p:d>p?d:p,y=s5(f,m,i,r,a),x=s5(_,g,i,r,a),v=e.prevZ,b=e.nextZ;for(;v&&v.z>=y&&b&&b.z<=x;){if(v.x>=f&&v.x<=_&&v.y>=m&&v.y<=g&&v!==n&&v!==s&&s6(l,c,h,d,u,p,v.x,v.y)&&s8(v.prev,v,v.next)>=0||(v=v.prevZ,b.x>=f&&b.x<=_&&b.y>=m&&b.y<=g&&b!==n&&b!==s&&s6(l,c,h,d,u,p,b.x,b.y)&&s8(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;v&&v.z>=y;){if(v.x>=f&&v.x<=_&&v.y>=m&&v.y<=g&&v!==n&&v!==s&&s6(l,c,h,d,u,p,v.x,v.y)&&s8(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;b&&b.z<=x;){if(b.x>=f&&b.x<=_&&b.y>=m&&b.y<=g&&b!==n&&b!==s&&s6(l,c,h,d,u,p,b.x,b.y)&&s8(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}(i,n,s,l):function(e){let i=e.prev,r=e.next;if(s8(i,e,r)>=0)return!1;let a=i.x,n=e.x,s=r.x,l=i.y,h=e.y,u=r.y,c=a<n?a<s?a:s:n<s?n:s,d=l<h?l<u?l:u:h<u?h:u,p=a>n?a>s?a:s:n>s?n:s,f=l>h?l>u?l:u:h>u?h:u,m=r.next;for(;m!==i;){if(m.x>=c&&m.x<=p&&m.y>=d&&m.y<=f&&s6(a,l,n,h,s,u,m.x,m.y)&&s8(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}(i))r.push(c.i,i.i,d.i),ln(i),i=d.next,u=d.next;else if((i=d)===u){h?1===h?e(i=function(e,i){let r=e;do{let a=r.prev,n=r.next.next;!s9(a,n)&&s7(a,r,r.next,n)&&li(a,n)&&li(n,a)&&(i.push(a.i,r.i,n.i),ln(r),ln(r.next),r=e=n),r=r.next}while(r!==e)return s3(r)}(s3(i),r),r,a,n,s,l,2):2===h&&function(i,r,a,n,s,l){let h=i;do{let i=h.next.next;for(;i!==h.prev;){var u,c;if(h.i!==i.i&&(u=h,c=i,u.next.i!==c.i&&u.prev.i!==c.i&&!function(e,i){let r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==i.i&&r.next.i!==i.i&&s7(r,r.next,e,i))return!0;r=r.next}while(r!==e)return!1}(u,c)&&(li(u,c)&&li(c,u)&&function(e,i){let r=e,a=!1,n=(e.x+i.x)/2,s=(e.y+i.y)/2;do r.y>s!=r.next.y>
212s&&r.next.y!==r.y&&n<(r.next.x-r.x)*(s-r.y)/(r.next.y-r.y)+r.x&&(a=!a),r=r.next;while(r!==e)return a}(u,c)&&(s8(u.prev,u,c.prev)||s8(u,c.prev,c))||s9(u,c)&&s8(u.prev,u,u.next)>0&&s8(c.prev,c,c.next)>0))){let u=lr(h,i);return h=s3(h,h.next),u=s3(u,u.next),e(h,r,a,n,s,l,0),void e(u,r,a,n,s,l,0)}i=i.next}h=h.next}while(h!==i)}(i,r,a,n,s,l):e(s3(i),r,a,n,s,l,1);break}}}(u,c,r,a,n,s,0),c}function s2(e,i,r,a,n){let s;if(n===function(e,i,r,a){let n=0;for(let s=i,l=r-a;s<r;s+=a)n+=(e[l]-e[s])*(e[s+1]+e[l+1]),l=s;return n}(e,i,r,a)>0)for(let n=i;n<r;n+=a)s=la(n/a|0,e[n],e[n+1],s);else for(let n=r-a;n>=i;n-=a)s=la(n/a|0,e[n],e[n+1],s);return s&&s9(s,s.next)&&(ln(s),s=s.next),s}function s3(e,i){if(!e)return e;i||(i=e);let r,a=e;do if(r=!1,a.steiner||!s9(a,a.next)&&0!==s8(a.prev,a,a.next))a=a.next;else{if(ln(a),(a=i=a.prev)===a.next)break;r=!0}while(r||a!==i)return i}function s4(e,i){return e.x-i.x}function s5(e,i,r,a,n){return(e=0x55555555&((e=0x33333333&((e=0xf0f0f0f&((e=0xff00ff&((e=(e-r)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))|(i=0x55555555&((i=0x33333333&((i=0xf0f0f0f&((i=0xff00ff&((i=(i-a)*n|0)|i<<8))|i<<4))|i<<2))|i<<1))<<1}function s6(e,i,r,a,n,s,l,h){return(n-l)*(i-h)>=(e-l)*(s-h)&&(e-l)*(a-h)>=(r-l)*(i-h)&&(r-l)*(s-h)>=(n-l)*(a-h)}function s8(e,i,r){return(i.y-e.y)*(r.x-i.x)-(i.x-e.x)*(r.y-i.y)}function s9(e,i){return e.x===i.x&&e.y===i.y}function s7(e,i,r,a){let n=lt(s8(e,i,r)),s=lt(s8(e,i,a)),l=lt(s8(r,a,e)),h=lt(s8(r,a,i));return n!==s&&l!==h||!(0!==n||!le(e,r,i))||!(0!==s||!le(e,a,i))||!(0!==l||!le(r,e,a))||!(0!==h||!le(r,i,a))}function le(e,i,r){return i.x<=Math.max(e.x,r.x)&&i.x>=Math.min(e.x,r.x)&&i.y<=Math.max(e.y,r.y)&&i.y>=Math.min(e.y,r.y)}function lt(e){return e>0?1:e<0?-1:0}function li(e,i){return 0>s8(e.prev,e,e.next)?s8(e,i,e.next)>=0&&s8(e,e.prev,i)>=0:0>s8(e,i,e.prev)||0>s8(e,e.next,i)}function lr(e,i){let r=lo(e.i,e.x,e.y),a=lo(i.i,i.x,i.y),n=e.next,s=i.prev;return e.next=i,i.prev=e,r.next=n,n.prev=r,a.next=r,r.prev=a,s.next=a,a.prev=s,a}function la(e,i,r,a){let n=lo(e,i,r);return a?(n.next=a.next,n.prev=a,a.next.prev=n,a.next=n):(n.prev=n,n.next=n),n}function ln(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 lo(e,i,r){return{i:e,x:i,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function ls(e,i){let r,a;let n=e.length;if(n<=1)return[e];let s=[];for(let i=0;i<n;i++){let n=function(e){let i=0;for(let r,a,n=0,s=e.length,l=s-1;n<s;l=n++)r=e[n],i+=((a=e[l]).x-r.x)*(r.y+a.y);return i}(e[i]);0!==n&&(e[i].area=Math.abs(n),void 0===a&&(a=n<0),a===n<0?(r&&s.push(r),r=[e[i]]):r.push(e[i]))}if(r&&s.push(r),i>1)for(let e=0;e<s.length;e++)s[e].length<=i||(function e(i,r,a=0,n=i.length-1,s=function(e,i){return e<i?-1:+(e>i)}){for(;n>a;){if(n-a>600){let l=n-a+1,h=r-a+1,u=Math.log(l),c=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*c*(l-c)/l)*(h-l/2<0?-1:1);e(i,r,Math.max(a,Math.floor(r-h*c/l+d)),Math.min(n,Math.floor(r+(l-h)*c/l+d)),s)}let l=i[r],h=a,u=n;for(iT(i,a,r),s(i[n],l)>0&&iT(i,a,n);h<u;){for(iT(i,h,u),h++,u--;0>s(i[h],l);)h++;for(;s(i[u],l)>0;)u--}0===s(i[a],l)?iT(i,a,u):iT(i,++u,n),u<=r&&(a=u+1),r<=u&&(n=u-1)}}(s[e],i,1,s[e].length-1,ll),s[e]=s[e].slice(0,i));return s}function ll(e,i){return i.area-e.area}function lh(e,i,r){let a=r.patternDependencies,n=!1;for(let r of i){let i=r.paint.get(`${e}-pattern`);i.isConstant()||(n=!0);let s=i.constantOr(null);s&&(n=!0,a[s]=!0)}return n}function lu(e,i,r,a,n){let s=n.patternDependencies;for(let l of i){let i=l.paint.get(`${e}-pattern`).value;if("constant"!==i.kind){let e=i.evaluate({zoom:a},r,{},n.availableImages);s[e=e&&e.name?e.name:e]=!0,r.patterns[l.id]=e}}return r}class lc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new no,this.indexArray=new nS,this.indexArray2=new nx,this.programConfigurations=new o_(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new n0,this.segments2=new n0,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.projection=e.projection}updateFootprints(e,i){}populate(e,i,r,a){this.hasPattern=lh("fill",this.layers,i);let n=this.layers[0].layout.get("fill-sort-key"),s=[];for(let{feature:l,id:h,index:u,sourceLayerIndex:c}of e){let e=this.layers[0]._featureFilter.needGeometry,d=oj(l,e);if(!this.layers[0]._featureFilter.filter(new aO(this.zoom),d,r))continue;let p=n?n.evaluate(d,{},r,i.availableImages):void 0,f={id:h,properties:l.properties,type:l.type,sourceLayerIndex:c,index:u,geometry:e?d.geometry:oU(l,r,a),patterns:{},sortKey:p};s.push(f)}for(let a of(n&&s.sort((e,i)=>
212e.sortKey-i.sortKey),s)){let{geometry:n,index:s,sourceLayerIndex:l}=a;if(this.hasPattern){let e=lu("fill",this.layers,a,this.zoom,i);this.patternFeatures.push(e)}else this.addFeature(a,n,s,r,{},i.availableImages,i.brightness);i.featureIndex.insert(e[s].feature,n,s,l,this.index)}}update(e,i,r,a,n){let s=0!==Object.keys(e).length;s&&!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(e,i,s?this.stateDependentLayers:this.layers,r,a,n)}addFeatures(e,i,r,a,n,s){for(let e of this.patternFeatures)this.addFeature(e,e.geometry,e.index,i,r,a,s)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,s0),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,i,r,a,n,s=[],l){for(let e of ls(i,500)){let i=0;for(let r of e)i+=r.length;let r=this.segments.prepareSegment(i,this.layoutVertexArray,this.indexArray),a=r.vertexLength,n=[],s=[];for(let i of e){if(0===i.length)continue;i!==e[0]&&s.push(n.length/2);let r=this.segments2.prepareSegment(i.length,this.layoutVertexArray,this.indexArray2),a=r.vertexLength;this.layoutVertexArray.emplaceBack(i[0].x,i[0].y),this.indexArray2.emplaceBack(a+i.length-1,a),n.push(i[0].x),n.push(i[0].y);for(let e=1;e<i.length;e++)this.layoutVertexArray.emplaceBack(i[e].x,i[e].y),this.indexArray2.emplaceBack(a+e-1,a+e),n.push(i[e].x),n.push(i[e].y);r.vertexLength+=i.length,r.primitiveLength+=i.length}let l=s1(n,s);for(let e=0;e<l.length;e+=3)this.indexArray.emplaceBack(a+l[e],a+l[e+1],a+l[e+2]);r.vertexLength+=i,r.primitiveLength+=l.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,n,s,a,l)}}af(lc,"FillBucket",{omit:["layers","patternFeatures"]});class ld{constructor(e,i,r,a){if(this.triangleCount=i.length/3,this.min=new eA(0,0),this.max=new eA(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],0===this.triangleCount||0===e.length)return;let[n,s]=[e[0].clone(),e[0].clone()];for(let i=1;i<e.length;++i){let r=e[i];n.x=Math.min(n.x,r.x),n.y=Math.min(n.y,r.y),s.x=Math.max(s.x,r.x),s.y=Math.max(s.y,r.y)}if(a&&(r=Math.max(r,Math.ceil(Math.max(s.x-n.x,s.y-n.y)/a))),0===r)return;this.min=n,this.max=s;let l=this.max.sub(this.min);l.x=Math.max(l.x,1),l.y=Math.max(l.y,1);let h=Math.max(l.x,l.y)/r;this.cellsX=Math.max(1,Math.ceil(l.x/h)),this.cellsY=Math.max(1,Math.ceil(l.y/h)),this.xScale=1/h,this.yScale=1/h;let u=[];for(let r=0;r<this.triangleCount;r++){let a=e[i[3*r+0]].sub(this.min),n=e[i[3*r+1]].sub(this.min),s=e[i[3*r+2]].sub(this.min),l=lp(Math.floor(Math.min(a.x,n.x,s.x)),this.xScale,this.cellsX),c=lp(Math.floor(Math.max(a.x,n.x,s.x)),this.xScale,this.cellsX),d=lp(Math.floor(Math.min(a.y,n.y,s.y)),this.yScale,this.cellsY),p=lp(Math.floor(Math.max(a.y,n.y,s.y)),this.yScale,this.cellsY),f=new eA(0,0),m=new eA(0,0),_=new eA(0,0),g=new eA(0,0);for(let e=d;e<=p;++e){f.y=m.y=e*h,_.y=g.y=(e+1)*h;for(let i=l;i<=c;++i)f.x=_.x=i*h,m.x=g.x=(i+1)*h,(o2(a,n,s,f,m,g)||o2(a,n,s,f,g,_))&&u.push({cellIdx:e*this.cellsX+i,triIdx:r})}}if(0===u.length)return;u.sort((e,i)=>e.cellIdx-i.cellIdx||e.triIdx-i.triIdx);let c=0;for(;c<u.length;){let e=u[c].cellIdx,i={start:this.payload.length,len:0};for(;c<u.length&&u[c].cellIdx===e;)++i.len,this.payload.push(u[c++].triIdx);this.cells[e]=i}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(e,i){if(0===this.triangleCount||0===this.cells.length||e.x>this.max.x||this.min.x>e.x||e.y>this.max.y||this.min.y>e.y)return;let r=lp(e.x-this.min.x,this.xScale,this.cellsX),a=lp(e.y-this.min.y,this.yScale,this.cellsY),n=this.cells[a*this.cellsX+r];if(n){this._lazyInitLookup();for(let e=0;e<n.len;e++){let r=this.payload[n.start+e],a=Math.floor(r/8),s=1<<r%8;if(!(this.lookup[a]&s)&&(this.lookup[a]|=s,i.push(r),i.length===this.triangleCount))return}}}query(e,i,r){if(0===this.triangleCount||0===this.cells.length||e.x>this.max.x||this.min.x>i.x||e.y>this.max.y||this.min.y>i.y)return;this._lazyInitLookup();let a=lp(e.x-this.min.x,this.xScale,this.cellsX),n=lp(i.x-this.min.x,this.xScale,this.cellsX),s=lp(e.y-this.min.y,this.yScale,this.cellsY),l=lp(i.y-this.min.y,this.yScale,this.cellsY);for(let e=s;e<=l;e++)for(let i=a;i<=n;
212i++){let a=this.cells[e*this.cellsX+i];if(a)for(let e=0;e<a.len;e++){let i=this.payload[a.start+e],n=Math.floor(i/8),s=1<<i%8;if(!(this.lookup[n]&s)&&(this.lookup[n]|=s,r.push(i),r.length===this.triangleCount))return}}}}function lp(e,i,r){return Math.max(0,Math.min(r-1,Math.floor(e*i)))}af(ld,"TriangleGridIndex");class lf{constructor(e){this.zoom=e.zoom,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.footprints=[]}updateFootprints(e,i){for(let r of this.footprints)i.push({footprint:r,id:e})}populate(e,i,r,a){let n=[];for(let{feature:i,id:s,index:l,sourceLayerIndex:h}of e){let e=this.layers[0]._featureFilter.needGeometry,u=oj(i,e);if(!this.layers[0]._featureFilter.filter(new aO(this.zoom),u,r))continue;let c={id:s,properties:i.properties,type:i.type,sourceLayerIndex:h,index:l,geometry:e?u.geometry:oU(i,r,a),patterns:{}};n.push(c)}for(let a of n){let{geometry:n,index:s,sourceLayerIndex:l}=a;this.addFeature(a,n,s,r,{},i.availableImages,i.brightness),i.featureIndex.insert(e[s].feature,n,s,l,this.index)}}isEmpty(){return 0===this.footprints.length}uploadPending(){return!1}upload(e){}update(e,i,r,a,n){}destroy(){}addFeature(e,i,r,a,n,s=[],l){for(let e of ls(i,2)){let i=[],r=[],a=[],n=new eA(1/0,1/0),s=new eA(-1/0,-1/0);for(let l of e)if(0!==l.length){l!==e[0]&&a.push(r.length/2);for(let e=0;e<l.length;e++)r.push(l[e].x),r.push(l[e].y),i.push(l[e]),n.x=Math.min(n.x,l[e].x),n.y=Math.min(n.y,l[e].y),s.x=Math.max(s.x,l[e].x),s.y=Math.max(s.y,l[e].y)}let l=s1(r,a),h=new ld(i,l,8,256);this.footprints.push({vertices:i,indices:l,grid:h,min:n,max:s})}}}af(lf,"ClipBucket",{omit:["layers"]});let lm=na([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),l_=na([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),lg=na([{name:"a_centroid_pos",components:2,type:"Uint16"}]),ly=na([{name:"a_join_normal_inside",components:3,type:"Int16"}]),lx=na([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),lv=na([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:lb}=lm;var lw,lT,lS,lM,lE,lA,lI,lC={};function lP(){if(lT)return lw;lT=1;var e=eE();function i(e,i,a,n,s){this.properties={},this.extent=a,this.type=0,this._pbf=e,this._geometry=-1,this._keys=n,this._values=s,e.readFields(r,this,i)}function r(e,i,r){1==e?i.id=r.readVarint():2==e?function(e,i){for(var r=e.readVarint()+e.pos;e.pos<r;){var a=i._keys[e.readVarint()],n=i._values[e.readVarint()];i.properties[a]=n}}(r,i):3==e?i.type=r.readVarint():4==e&&(i._geometry=r.pos)}return lw=i,i.types=["Unknown","Point","LineString","Polygon"],i.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var r,a=i.readVarint()+i.pos,n=1,s=0,l=0,h=0,u=[];i.pos<a;){if(s<=0){var c=i.readVarint();n=7&c,s=c>>3}if(s--,1===n||2===n)l+=i.readSVarint(),h+=i.readSVarint(),1===n&&(r&&u.push(r),r=[]),r.push(new e(l,h));else{if(7!==n)throw Error("unknown command "+n);r&&r.push(r[0].clone())}}return r&&u.push(r),u},i.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var i=e.readVarint()+e.pos,r=1,a=0,n=0,s=0,l=1/0,h=-1/0,u=1/0,c=-1/0;e.pos<i;){if(a<=0){var d=e.readVarint();r=7&d,a=d>>3}if(a--,1===r||2===r)(n+=e.readSVarint())<l&&(l=n),n>h&&(h=n),(s+=e.readSVarint())<u&&(u=s),s>c&&(c=s);else if(7!==r)throw Error("unknown command "+r)}return[l,u,h,c]},i.prototype.toGeoJSON=function(e,r,a){var n,s,l=this.extent*Math.pow(2,a),h=this.extent*e,u=this.extent*r,c=this.loadGeometry(),d=i.types[this.type];function p(e){for(var i=0;i<e.length;i++){var r=e[i];e[i]=[360*(r.x+h)/l-180,360/Math.PI*Math.atan(Math.exp((180-360*(r.y+u)/l)*Math.PI/180))-90]}}switch(this.type){case 1:var f=[];for(n=0;n<c.length;n++)f[n]=c[n][0];p(c=f);break;case 2:for(n=0;n<c.length;n++)p(c[n]);break;case 3:for(c=function(e){var i=e.length;if(i<=1)return[e];for(var r,a,n=[],s=0;s<i;s++){var l=function(e){for(var i,r,a=0,n=0,s=e.length,l=s-1;n<s;l=n++)a+=((r=e[l]).x-(i=e[n]).x)*(i.y+r.y);return a}(e[s]);0!==l&&(void 0===a&&(a=l<0),a===l<0?(r&&n.push(r),r=[e[s]]):r.push(e[s]))}return r&&n.push(r),n}(c),n=0;n<c.length;n++)for(s=0;s<c[n].length;s++)p(c[n][s])}1===c.length?c=c[0]:d="Multi"+d;var m={type:"Feature",geometry:{type:d,coordinates:c},properties:this.properties};return"id"in this&&(m.id=this.id),m},lw}function lL(){if(lM)return lS;lM=1;var e=lP();function i(e,i){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(r,this,i),this.length=this._features.length}function r(e,i,r){15===e?i.version=r.readVarint():1===e?i.name=r.readString():5===e?i.extent=r.readVarint():2===e?i._features.push(r.pos):3===e?i._keys.push(r.readString()):4===e&&i._values.push(function(e){for(var i=null,r=e.readVarint()+e.pos;e.pos<r;){var a=e.readVarint()>>3;i=1===a?e.readString():2===a?e.readFloat():3===a?e.readDouble():4===a?e.readVarint64():5===a?e.readVarint():6===a?e.readSVarint():7===a?e.readBoolean():null}return i}(r))}return lS=i,i.prototype.feature=function(i){if(i<0||i>=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[i];var r=this._pbf.readVarint()+this._pbf.pos;return new e(this._pbf,r,this.extent,this._keys,this._values)},lS}function lk(){return lI||(lI=1,lC.VectorTile=function(){if(lA)return lE;lA=1;var e=lL();function i(i,r,a){if(3===i){var n=new e(a,a.readVarint()+a.pos);n.length&&(r[n.name]=n)}}return lE=function(e,r){this.layers=e.readFields(i,{},r)}}(),lC.VectorTileFeature=lP(),lC.VectorTileLayer=lL()),lC}var lR=lk();class lz extends eA{constructor(e,i,r){super(e,i),this.z=r}}class lD extends lz{constructor(e,i,r,a){super(e,i,r),this.w=a}}function lO(e,i,r,a){let n=[],s=0===a?(e,i,r,a,n,s)=>{e.push(new eA(s,r+(s-i)/(a-i)*(n-r)))}:(e,i,r,a,n,s)=>{e.push(new eA(i+(s-r)/(n-r)*(a-i),s))};for(let l of e){let e=[];for(let n of l){if(n.length<=2)continue;let l=[];for(let e=0;e<n.length-1;e++){let h=n[e].x,u=n[e].y,c=n[e+1].x,d=n[e+1].y,p=0===a?h:u,f=0===a?c:d;p<i?f>i&&s(l,h,u,c,d,i):p>r?f<r&&s(l,h,u,c,d,r):l.push(n[e]),f<i&&p>=i&&s(l,h,u,c,d,i),f>r&&p<=r&&s(l,h,u,c,d,r)}let h=n[n.length-1],u=0===a?h.x:h.y;u>=i&&u<=r&&l.push(h),l.length&&(h=l[l.length-1],l[0].x===h.x&&l[0].y===h.y||l.push(l[0]),e.push(l))}e.length&&n.push(e)}return n}function lB(e,i,r,a){let n="x"===r?"y":"x",s=(a-e[r])/(i[r]-e[r]);e[n]=e[n]+(i[n]-e[n])*s,e[r]=a,e.hasOwnProperty("z")&&(e.z=tU(e.z,i.z,s)),e.hasOwnProperty("w")&&(e.w=tU(e.w,i.w,s)
212)}function lF(e,i,r,a){for(let n of["x","y"]){let s=e,l=i;s[n]>=l[n]&&(s=i,l=e),s[n]<r&&l[n]>r&&lB(s,l,n,r),s[n]<a&&l[n]>a&&lB(l,s,n,a)}}let lN=Number.MAX_SAFE_INTEGER;function lV(e,i,r,a){var n;return e.order<i||e.order===lN||!(e.clipMask&r)||0!==(n=e.clipScope).length&&void 0===n.find(e=>e===a)}function lU(e,i){return e.x-i.x||e.y-i.y}function lj(e,i){return 0===lU(e.min,i.min)&&0===lU(e.max,i.max)}function lG(e,i){return!(e.min.x>i.max.x||e.max.x<i.min.x||e.min.y>i.max.y||e.max.y<i.min.y)}function lq(e,i){if(e.length!==i.length)return!1;for(let r=0;r<e.length;r++)if(e[r].sourceId!==i[r].sourceId||!lj(e[r],i[r])||e[r].order!==i[r].order||e[r].clipMask!==i[r].clipMask||!eI(e[r].clipScope,i[r].clipScope))return!1;return!0}function lW(e,i,r){let a=1/(1<<r.canonical.z),n=(1220703125e-13*i.x+r.canonical.x)*a+r.wrap,s=(1220703125e-13*i.y+r.canonical.y)*a;return{min:new eA((1220703125e-13*e.x+r.canonical.x)*a+r.wrap,(1220703125e-13*e.y+r.canonical.y)*a),max:new eA(n,s)}}function l$(e,i,r,a,n,s,l){let h=e.indices,u=e.vertices,c=[];for(let d=a;d<a+n;d+=3){let a=i[r[d+0]+s],n=i[r[d+1]+s],p=i[r[d+2]+s],f=Math.min(a.x,n.x,p.x),m=Math.max(a.x,n.x,p.x),_=Math.min(a.y,n.y,p.y),g=Math.max(a.y,n.y,p.y);c.length=0,e.grid.query(new eA(f,_),new eA(m,g),c);for(let e=0;e<c.length;e++){let i=c[e];if(o2(u[h[3*i+0]],u[h[3*i+1]],u[h[3*i+2]],a,n,p,l))return!0}}return!1}function lH(e,i,r,a){let n=Math.pow(2,a.z-r.z);return new eA((e+8192*r.x)*n-8192*a.x,(i+8192*r.y)*n-8192*a.y)}function lZ(e,i){let r=[];i.grid.queryPoint(e,r);let a=i.indices,n=i.vertices;for(let i=0;i<r.length;i++){let s=r[i];if(oK([n[a[3*s+0]],n[a[3*s+1]],n[a[3*s+2]]],e))return!0}return!1}let lX=[new eA(0,0),new eA(8192,0),new eA(8192,8192),new eA(0,8192)];function lY(e,i){let r=[],a=[];if(!i||e.length<2)return[e];if(2===e.length)return o0(e[0],e[1],lX)?[e]:[];for(let i=0;i<e.length+2;i++){let n=e[i%e.length],s=e[(i+1)%e.length],l=o0(0===i?e[e.length-1]:e[(i-1)%e.length],n,lX),h=o0(n,s,lX),u=l||h;u&&a.push(n),u&&h||a.length>0&&(a.length>1&&r.push(a),a=[])}return a.length>1&&r.push(a),r}let lJ=lR.VectorTileFeature.types,lK=["fill-extrusion-base","fill-extrusion-height","fill-extrusion-color","fill-extrusion-pattern","fill-extrusion-flood-light-wall-radius","fill-extrusion-line-width","fill-extrusion-emissive-strength"],lQ=["fill-extrusion-flood-light-ground-radius"],l0=new eA(0,1);function l1(e,i,r,a,n,s,l,h){e.emplaceBack((i<<1)+l,(r<<1)+s,(Math.floor(8192*a)<<1)+n,Math.round(h))}function l2(e,i,r){e.emplaceBack(8192*i.x,8192*i.y,+!!r)}function l3(e,i,r,a,n,s){e.emplaceBack(i.x,i.y,(r.x<<1)+a,(r.y<<1)+n,s)}function l4(e,i,r){e.emplaceBack(i.x,i.y,i.z,16384*r[0],16384*r[1],16384*r[2])}class l5{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class l6{constructor(){this.centroidXY=new eA(0,0),this.vertexArrayOffset=0,this.vertexCount=0,this.groundVertexArrayOffset=0,this.groundVertexCount=0,this.flags=0,this.footprintSegIdx=-1,this.footprintSegLen=0,this.polygonSegIdx=-1,this.polygonSegLen=0,this.min=new eA(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new eA(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0}span(){return new eA(this.max.x-this.min.x,this.max.y-this.min.y)}}class l8{constructor(){this.acc=new eA(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(e,i){e.min.x===Number.MAX_VALUE&&(e.min.x=e.max.x=i.x,e.min.y=e.max.y=i.y)}appendEdge(e,i,r){this.accCount++,this.acc._add(i);let a=!!this.borders;i.x<e.min.x?(e.min.x=i.x,a=!0):i.x>e.max.x&&(e.max.x=i.x,a=!0),i.y<e.min.y?(e.min.y=i.y,a=!0):i.y>e.max.y&&(e.max.y=i.y,a=!0),((0===i.x||8192===i.x)&&i.x===r.x)!=((0===i.y||8192===i.y)&&i.y===r.y)&&this.processBorderOverlap(i,r),a&&this.checkBorderIntersection(i,r)}checkBorderIntersection(e,i){i.x<0!=e.x<0&&this.addBorderIntersection(0,tU(i.y,e.y,(0-i.x)/(e.x-i.x))),i.x>8192!=e.x>8192&&this.addBorderIntersection(1,tU(i.y,e.y,(8192-i.x)/(e.x-i.x))),i.y<0!=e.y<0&&this.addBorderIntersection(2,tU(i.x,e.x,(0-i.y)/(e.y-i.y))),i.y>8192!=e.y>8192&&this.addBorderIntersection(3,tU(i.x,e.x,(8192-i.y)/(e.y-i.y)))}addBorderIntersection(e,i){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);let r=this.borders[e];i<r[0]&&(r[0]=i),i>r[1]&&(r[1]=i)}processBorderOverlap(e,i){if(e.x===i.x){if(e.y===i.y)return;let r=+(0!==e.x);this.addBorderIntersection(r,i.y),this.addBorderIntersection(r,e.y)}else{let r=0===e.y?2:3;this.addBorderIntersection(r,i.x),this.addBorderIntersection(r,e.x)}}centroid(){return 0===this.accCount?new eA(0,0):new eA(Math.floor(Math.max(0,this.acc.x)/this.accCount),Math.floor(Math.max(0,this.acc.y)/this.accCount))}intersectsCount(){return this.borders?this.borders.reduce((e,i)=>e+ +(i[0]!==Number.MAX_VALUE),0):0}}function l9(e,i){let r=e.add(i)._unit();return Math.min(4,Math.max(-4,Math.tan(Math.acos(eD(e.x*r.x+e.y*r.y,-1,1)))))/4*32767*(e.x*i.y-e.y*i.x<0?-1:1)}let l7=[e=>e.x<0,e=>e.x>8192,e=>e.y<0,e=>e.y>8192];class he{constructor(e){this.vertexArray=new nh,this.indexArray=new nS,this.programConfigurations=new o_(e.layers,{zoom:e.zoom,lut:e.lut},e=>lQ.includes(e)),this._segments=new n0,this.hiddenByLandmarkVertexArray=new nF,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new n0}getDefaultSegment(){return this.regionSegments[4]}hasData(){return 0!==this.vertexArray.length}addData(e,i,r,a=!1){let n=e.length;if(n>2){let s,l=Math.max(0,this._segments.get().length-1),h=this._segments._prepareSegment(4*n,this.vertexArray.length,2*this._segmentToGroundQuads[l].length);l!==this._segments.get().length-1&&(l++,this._segmentToGroundQuads[l]=[],this._segmentToRegionTriCounts[l]=[0,0,0,0,0]);{let i=e[0],r=e[1];s=l9(i.sub(e[n-1])._perp()._unit(),r.sub(i)._perp()._unit())}for(let u=0;u<n;u++){let c=u===n-1?0:u+1,d=e[u],p=e[c],f=e[c===n-1?0:c+1],m=p.sub(d)._perp()._unit(),_=l9(m,f.sub(p)._perp()._unit()),g=s;if(ha(d,p,i)||a&&hn(d,i)&&hn(p,i)){s=_;continue}let y=h.vertexLength;for(let e of(l3(this.vertexArray,d,p,1,1,g),l3(this.vertexArray,d,p,1,0,g),l3(this.vertexArray,d,p,0,1,_),l3(this.vertexArray,d,p,0,0,_),h.vertexLength+=4,function(e,i,r,a){let n=[4];if(0===a)return n;r._mult(a);let s=e.sub(r),l=i.sub(r),h=[e,i,s,l];for(let e=0;e<4;e++)for(let i of h)if(l7[e](i)){n.push(e);break}return n}(d,p,m,r)))this._segmentToGroundQuads[l].push({id:y,region:e}),this._segmentToRegionTriCounts[l][e]+=2,h.primitiveLength+=2;s=_}}}prepareBorderSegments(){if(!this.hasData())return;let e=this._segments.get(),i=e.length;for(let e=0;e<i;e++)this._segmentToGroundQuads[e].sort((e,i)=>e.region-i.region);for(let r=0;r<i;r++){let i=this._segmentToGroundQuads[r],a=e[r],n=this._segmentToRegionTriCounts[r];n.reduce((e,i)=>e+i,0);let s=0;for(let e=0;e<=4;e++){let i=n[e];if(0!==i){let r=this.regionSegments[e];r||(r=this.regionSegments[e]=new n0);let n={vertexOffset:a.vertexOffset,primitiveOffset:a.primitiveOffset+s,vertexLength:a.vertexLength,primitiveLength:i};r.get().push(n)}s+=i}for(let e=0;e<i.length;e++){let r=i[e].id;this.indexArray.emplaceBack(r,r+1,r+3),this.indexArray.emplaceBack(r,r+3,r+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(e,i,r,a,n,s){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,e,i,r,a,n,s)}upload(e){this.hasData()&&(this.vertexBuffer=e.createVertexBuffer(this.vertexArray,l_.members),this.indexBuffer=e.createIndexBuffer(this.indexArray))}uploadPaintProperties(e){this.hasData()&&this.programConfigurations.upload(e)}update(e,i,r,a,n,s){this.hasData()&&this.programConfigurations.updatePaintArrays(e,i,r,a,n,s)}updateHiddenByLandmark(e){if(!this.hasData())return;let i=e.groundVertexCount+e.groundVertexArrayOffset;if(0===e.groundVertexCount)return;let r=0x80000000&e.flags?1:0;for(let a=e.groundVertexArrayOffset;a<i;++a)this.hiddenByLandmarkVertexArray.emplace(a,r);this._needsHiddenByLandmarkUpdate=!0}uploadHiddenByLandmark(e){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=e.createVertexBuffer(this.hiddenByLandmarkVertexArray,lx.members,!0):this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray),this._needsHiddenByLandmarkUpdate=!1)}destroy(){if(this.vertexBuffer){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.destroy(),this._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let e=0;e<=4;e++){let i=this.regionSegments[e];i&&i.destroy()}}}}class ht{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=e.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new nS,this.footprintVertices=new no,this.footprintSegments=[],this.layoutVertexArray=new nl,this.centroidVertexArray=new nX,this.wallVertexArray=new nJ,this.indexArray=new nS,this.programConfigurations=new o_(e.layers,{zoom:e.zoom,lut:e.lut},e=>lK.includes(e)),this.segments=new n0,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.groundEffect=new he(e),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[]}updateFootprints(e,i){}populate(e,i,r,a){for(let{feature:n,id:s,index:l,sourceLayerIndex:h}of(this.features=[],this.hasPattern=lh("fill-extrusion",this.layers,i),this.featuresOnBorder=[],this.borderFeatureIndices=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.tileToMeter=oB(r),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,this.wallMode=0!==this.layers[0].paint.get("fill-extrusion-line-width").constantOr(1),e)){let e=this.layers[0]._featureFilter.needGeometry,u=oj(n,e);if(!this.layers[0]._featureFilter.filter(new aO(this.zoom),u,r))continue;let c={id:s,sourceLayerIndex:h,index:l,geometry:e?u.geometry:oU(n,r,a),properties:n.properties,type:n.type,patterns:{}},d=this.layoutVertexArray.length,p="Polygon"===lJ[c.type];if(this.hasPattern)this.features.push(lu("fill-extrusion",this.layers,c,this.zoom,i));else if(this.wallMode)for(let e of c.geometry)for(let n of lY(e,p))this.addFeature(c,[n],l,r,{},i.availableImages,a,i.brightness);else this.addFeature(c,c.geometry,l,r,{},i.availableImages,a,i.brightness);i.featureIndex.insert(n,c.geometry,l,h,this.index,d)}this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(e,i,r,a,n,s){for(let e of this.features){let l="Polygon"===lJ[e.type],{geometry:h}=e;if(this.wallMode)for(let u of h)for(let h of lY(u,l))this.addFeature(e,[h],e.index,i,r,a,n,s);else this.addFeature(e,h,e.index,i,r,a,n,s)}this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles()}update(e,i,r,a,n){let s=0!==Object.keys(e).length;if(s&&!this.stateDependentLayers.length)return;let l=s?this.stateDependentLayers:this.layers;this.programConfigurations.updatePaintArrays(e,i,l,r,a,n),this.groundEffect.update(e,i,l,r,a,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,lb),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.wallVertexBuffer=e.createVertexBuffer(this.wallVertexArray,ly.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,lv.members,!0)),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}uploadCentroid(e){this.groundEffect.uploadHiddenByLandmark(e),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,lg.members,!0):this.centroidVertexBuffer&&this.centroidVertexBuffer.updateData(this.centroidVertexArray),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,i,r,a,n,s,l,h){var u;
212let c,d;let p=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(e,{})/this.tileToMeter,f=[new eA(0,0),new eA(8192,8192)],m=l.projection,_="globe"===m.name,g=this.wallMode||"Polygon"===lJ[e.type],y=new l8;y.centroidDataIndex=this.centroidData.length;let x=new l6,v=0>=this.layers[0].paint.get("fill-extrusion-base").evaluate(e,{},a),b=this.layers[0].paint.get("fill-extrusion-height").evaluate(e,{},a);if(x.height=b,x.vertexArrayOffset=this.layoutVertexArray.length,x.groundVertexArrayOffset=this.groundEffect.vertexArray.length,_&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new nm),this.wallMode){if(_)return void eX("Non zero fill-extrusion-line-width is not yet supported on globe.");if(1!==i.length)return;i=[(c=function(e){let i=e[0].x===e[e.length-1].x&&e[0].y===e[e.length-1].y;(function(e){let i=0,r=e.length;for(let a=0;a<r;a++)i+=(e[(a+1)%r].x-e[a].x)*(e[(a+1)%r].y+e[a].y);return i>=0})(e)||(e=e.reverse());let r={geometry:[],joinNormals:[],indices:[]},a=[],n=[],s=[],l=e.length;if(l<(i?3:2))return r;for(;l>=2&&e[l-1].equals(e[l-2]);)l--;let h,u,c,d,p,f=0;for(;f<l-1&&e[f].equals(e[f+1]);)f++;i&&(h=e[l-2],p=e[f].sub(h)._unit()._perp());for(let r=f;r<l;r++){if((c=r===l-1?i?e[f+1]:void 0:e[r+1])&&e[r].equals(c))continue;p&&(d=p),h&&(u=h),h=e[r],p=c?c.sub(h)._unit()._perp():d;let m=(d=d||p).add(p);0===m.x&&0===m.y||m._unit();let _=m.x*p.x+m.y*p.y,g=0!==_?1/_:1/0,y=d.x*p.y-d.y*p.x>0,x="miter";"miter"===x&&g>2&&(x="bevel"),"bevel"===x&&(g>100&&(x="flipbevel"),g<2&&(x="miter"));let v=(e,i,r,l)=>{let h=new eA(e.x,e.y),u=new eA(e.x,e.y);h.x+=i.x*l,h.y+=i.y*l,u.x-=i.x*Math.max(r,1),u.y-=i.y*Math.max(r,1),s.push(i),a.push(h),n.push(u)};if("miter"===x)m._mult(g),v(h,m,0,0);else if("flipbevel"===x)v(h,m=p.mult(-1),0,0),v(h,m.mult(-1),0,0);else{let e=-Math.sqrt(g*g-1),i=y?e:0,r=y?0:e;u&&v(h,d,i,r),c&&v(h,p,i,r)}}r.geometry=[...a,...n.reverse(),a[0]],r.joinNormals=[...s,...s.reverse(),s[s.length-1]];let m=r.geometry.length-1;for(let e=0;e<m/2;e++)if(e+1<m/2){let i=e,a=e+1,n=m-1-e,s=m-2-e;i=0===i?m-1:i-1,a=0===a?m-1:a-1,n=0===n?m-1:n-1,s=0===s?m-1:s-1,r.indices.push(n),r.indices.push(a),r.indices.push(i),r.indices.push(n),r.indices.push(s),r.indices.push(a)}return r}(i[0])).geometry]}let w=(e,i)=>e<(i.length-1)/2||e===i.length-1,T=this.wallMode?[i]:ls(i,500);for(let e=T.length-1;e>=0;e--){let i=T[e];(0===i.length||(u=i[0]).every(e=>e.x<=0)||u.every(e=>e.x>=8192)||u.every(e=>e.y<=0)||u.every(e=>e.y>=8192))&&T.splice(e,1)}if(_)d=hh(T,f,a);else for(let e of(d=[],T))d.push({polygon:e,bounds:f});let S=g?this.edgeRadius:0,M=S>0&&this.zoom<17,E=(e,i)=>{if(0===e.length)return!1;let r=e[e.length-1];return i.x===r.x&&i.y===r.y};for(let{polygon:e,bounds:i}of d){let r=0,n=0;for(let i of e)g&&!i[0].equals(i[i.length-1])&&i.push(i[0]),n+=g?i.length-1:i.length;let s=this.segments.prepareSegment((g?5:4)*n,this.layoutVertexArray,this.indexArray);x.footprintSegIdx<0&&(x.footprintSegIdx=this.footprintSegments.length),x.polygonSegIdx<0&&(x.polygonSegIdx=this.polygonSegments.length);let l={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},h=new l5;if(h.vertexOffset=this.footprintVertices.length,h.indexOffset=3*this.footprintIndices.length,h.ringIndices=[],g){let n=[],l=[];r=s.vertexLength;for(let r=0;r<e.length;r++){let u,d;let f=e[r];f.length&&0!==r&&l.push(n.length/2);let g=[];u=f[1].sub(f[0])._perp()._unit(),h.ringIndices.push(f.length-1);for(let e=1;e<f.length;e++){let i=f[e],r=f[e===f.length-1?1:e+1],l=i.clone();if(S){d=r.sub(i)._perp()._unit();let e=u.add(d)._unit(),a=S*Math.min(4,1/(u.x*e.x+u.y*e.y));l.x+=a*e.x,l.y+=a*e.y,l.x=Math.round(l.x),l.y=Math.round(l.y),u=d}if(!v||0!==S&&!M||E(g,l)||g.push(l),l1(this.layoutVertexArray,l.x,l.y,0,0,1,1,0),this.wallMode){let i=w(e,f);l2(this.wallVertexArray,c.joinNormals[e],!i)}s.vertexLength++,this.footprintVertices.emplaceBack(i.x,i.y),n.push(i.x,i.y),_&&l4(this.layoutVertexExtArray,m.projectTilePoint(l.x,l.y,a),m.upVector(a,l.x,l.y))}v&&(0===S||M)&&(0!==g.length&&E(g,g[0])&&g.pop(),this.groundEffect.addData(g,i,p))}let u=this.wallMode?c.indices:s1(n,l);for(let e=0;e<u.length;e+=3)this.footprintIndices.emplaceBack(h.vertexOffset+u[e+0],h.vertexOffset+u[e+1],h.vertexOffset+u[e+2]),this.indexArray.emplaceBack(r+u[e],r+u[e+2],r+u[e+1]),s.primitiveLength++;h.indexCount+=u.length,h.vertexCount+=this.footprintVertices.length-h.vertexOffset}for(let n=0;n<e.length;n++){let l,h,u;let d=e[n];y.startRing(x,d[0]);let f=d.length>4&&ho(d[d.length-2],d[0],d[1]),b=S?function(e,i,r,a){let n=i.sub(e)._perp()._unit(),s=r.sub(i)._perp()._unit();return hr(e,i,r,hi(n,s),a)}(d[d.length-2],d[0],d[1],S):0,T=[];h=d[1].sub(d[0])._perp()._unit();let M=!0;for(let e=1,n=0;
212e<d.length;e++){let p=d[e-1],g=d[e],A=d[e===d.length-1?1:e+1];if(y.appendEdge(x,g,p),ha(g,p,i)){S&&(h=A.sub(g)._perp()._unit(),M=!M);continue}let I=g.sub(p)._perp(),C=I.x/(Math.abs(I.x)+Math.abs(I.y)),P=+(I.y>0),L=p.dist(g);if(n+L>32768&&(n=0),S){u=A.sub(g)._perp()._unit();let e=hr(p,g,A,hi(h,u),S);isNaN(e)&&(e=0);let i=g.sub(p)._unit();p=p.add(i.mult(b))._round(),g=g.add(i.mult(-e))._round(),b=e,h=u,v&&this.zoom>=17&&(E(T,p)||T.push(p),E(T,g)||T.push(g))}let k=s.vertexLength,R=d.length>4&&ho(p,g,A),z=hs(n,f,M);if(l1(this.layoutVertexArray,p.x,p.y,C,P,0,0,z),l1(this.layoutVertexArray,p.x,p.y,C,P,0,1,z),this.wallMode){let i=w(e-1,d),r=c.joinNormals[e-1];l2(this.wallVertexArray,r,i),l2(this.wallVertexArray,r,i)}if(n+=L,z=hs(n,R,!M),f=R,l1(this.layoutVertexArray,g.x,g.y,C,P,0,0,z),l1(this.layoutVertexArray,g.x,g.y,C,P,0,1,z),this.wallMode){let i=w(e,d),r=c.joinNormals[e];l2(this.wallVertexArray,r,i),l2(this.wallVertexArray,r,i)}if(s.vertexLength+=4,this.indexArray.emplaceBack(k+0,k+1,k+2),this.indexArray.emplaceBack(k+1,k+3,k+2),s.primitiveLength+=2,S){let a=r+(1===e?d.length-2:e-2),n=1===e?r:a+1;if(this.indexArray.emplaceBack(k+1,a,k+3),this.indexArray.emplaceBack(a,n,k+3),s.primitiveLength+=2,void 0===l&&(l=k),!ha(A,d[e],i)){let i=e===d.length-1?l:s.vertexLength;this.indexArray.emplaceBack(k+2,k+3,i),this.indexArray.emplaceBack(k+3,i+1,i),this.indexArray.emplaceBack(k+3,n,i+1),s.primitiveLength+=3}M=!M}if(_){let e=this.layoutVertexExtArray,i=m.projectTilePoint(p.x,p.y,a),r=m.projectTilePoint(g.x,g.y,a),n=m.upVector(a,p.x,p.y),s=m.upVector(a,g.x,g.y);l4(e,i,n),l4(e,i,n),l4(e,r,s),l4(e,r,s)}}g&&(r+=d.length-1),v&&S&&this.zoom>=17&&(0!==T.length&&E(T,T[0])&&T.pop(),this.groundEffect.addData(T,i,p,S>0))}this.footprintSegments.push(h),l.triangleCount=this.indexArray.length-l.triangleArrayOffset,this.polygonSegments.push(l),++x.footprintSegLen,++x.polygonSegLen}if(x.vertexCount=this.layoutVertexArray.length-x.vertexArrayOffset,x.groundVertexCount=this.groundEffect.vertexArray.length-x.groundVertexArrayOffset,0!==x.vertexCount){if(x.centroidXY=y.borders?l0:this.encodeCentroid(y,x),this.centroidData.push(x),y.borders){this.featuresOnBorder.push(y);let e=this.featuresOnBorder.length-1;for(let i=0;i<y.borders.length;i++)y.borders[i][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[i].push(e)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,n,s,a,h),this.groundEffect.addPaintPropertiesData(e,r,n,s,a,h),this.maxHeight=Math.max(this.maxHeight,b)}}sortBorders(){for(let e=0;e<this.borderFeatureIndices.length;e++)this.borderFeatureIndices[e].sort((i,r)=>this.featuresOnBorder[i].borders[e][0]-this.featuresOnBorder[r].borders[e][0])}splitToSubtiles(){let e=[];for(let i=0;i<this.centroidData.length;i++){let r=this.centroidData[i],a=+(r.min.y+r.max.y>8192),n=2*a+(+(r.min.x+r.max.x>8192)^a);for(let a=0;a<r.polygonSegLen;a++){let s=r.polygonSegIdx+a;e.push({centroidIdx:i,subtile:n,polygonSegmentIdx:s,triangleSegmentIdx:this.polygonSegments[s].triangleSegIdx})}}let i=new nS;e.sort((e,i)=>e.triangleSegmentIdx===i.triangleSegmentIdx?e.subtile-i.subtile:e.triangleSegmentIdx-i.triangleSegmentIdx);let r=0,a=0,n=0;for(let i of e){if(i.triangleSegmentIdx!==r)break;n++}let s=e.length;for(;a!==e.length;){r=e[a].triangleSegmentIdx;let l=0,h=a,u=a;for(let i=h;i<n&&e[i].subtile===l;i++)u++;for(;h!==n;){let a=e[h];l=a.subtile;let s=this.centroidData[a.centroidIdx].min.clone(),c=this.centroidData[a.centroidIdx].max.clone(),d={vertexOffset:this.segments.segments[r].vertexOffset,primitiveOffset:i.length,vertexLength:this.segments.segments[r].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let r=h;r<u;r++){let a=e[r],n=this.polygonSegments[a.polygonSegmentIdx],l=this.centroidData[a.centroidIdx].min,h=this.centroidData[a.centroidIdx].max,u=this.indexArray.uint16;for(let e=n.triangleArrayOffset;e<n.triangleArrayOffset+n.triangleCount;e++)i.emplaceBack(u[3*e],u[3*e+1],u[3*e+2]);d.primitiveLength+=n.triangleCount,s.x=Math.min(s.x,l.x),s.y=Math.min(s.y,l.y),c.x=Math.max(c.x,h.x),c.y=Math.max(c.y,h.y)}d.primitiveLength>0&&this.triangleSubSegments.push({segment:d,min:s,max:c}),h=u;for(let i=h;i<n&&e[i].subtile===e[h].subtile;i++)u++}a=n;for(let i=a;i<s&&e[i].triangleSegmentIdx===e[a].triangleSegmentIdx;i++)n++}i._trim(),this.indexArray=i}getVisibleSegments(e,i,r){let a;let n=new n0;if(this.wallMode){for(let e of this.triangleSubSegments)n.segments.push(e.segment);return n}let s=0,l=0,h=1<<e.canonical.z;if(i){let r=i.getMinMaxForTile(e);r&&(s=r.min,l=r.max)}l+=this.maxHeight;let u=e.toUnwrapped(),c=[u.canonical.x/h+u.wrap,u.canonical.y/h],d=[(u.canonical.x+1)/h+u.wrap,(u.canonical.y+1)/h],p=(e,i,r)=>[e[0]*(1-r[0])+i[0]*r[0],e[1]*(1-r[1])+i[1]*r[1]],f=[],m=[];for(let e of this.triangleSubSegments){f[0]=e.min.x/8192,f[1]=e.min.y/8192,m[0]=e.max.x/8192,m[1]=e.max.y/8192;let i=p(c,d,f),h=p(c,d,m);
212if(0===new sm([i[0],i[1],s],[h[0],h[1],l]).intersectsPrecise(r)){a&&(n.segments.push(a),a=void 0);continue}let u=e.segment;a&&a.vertexOffset!==u.vertexOffset&&(n.segments.push(a),a=void 0),a?(a.vertexLength+=u.vertexLength,a.primitiveLength+=u.primitiveLength):a={vertexOffset:u.vertexOffset,primitiveLength:u.primitiveLength,vertexLength:u.vertexLength,primitiveOffset:u.primitiveOffset,sortKey:void 0,vaos:{}}}return a&&n.segments.push(a),n}encodeCentroid(e,i){let r=e.centroid(),a=i.span(),n=Math.min(7,Math.round(a.x*this.tileToMeter/10)),s=Math.min(7,Math.round(a.y*this.tileToMeter/10));return new eA(eD(r.x,1,8191)<<3|n,eD(r.y,1,8191)<<3|s)}encodeBorderCentroid(e){if(!e.borders)return new eA(0,0);let i=e.borders,r=Number.MAX_VALUE;if(i[0][0]!==r||i[1][0]!==r){let e=+(i[0][0]===r);return new eA(6|65528*(i[0][0]===r),(i[e][0]+i[e][1])/2<<3|6)}{let e=i[2][0]!==r?2:3;return new eA((i[e][0]+i[e][1])/2<<3|6,6|65528*(i[2][0]===r))}}showCentroid(e){let i=this.centroidData[e.centroidDataIndex];i.flags&=0x80000000,i.centroidXY.x=0,i.centroidXY.y=0,this.writeCentroidToBuffer(i)}writeCentroidToBuffer(e){this.groundEffect.updateHiddenByLandmark(e);let i=e.vertexArrayOffset,r=e.vertexCount+e.vertexArrayOffset,a=0x80000000&e.flags?l0:e.centroidXY,n=this.centroidVertexArray.geta_centroid_pos0(i);if(this.centroidVertexArray.geta_centroid_pos1(i)!==a.y||n!==a.x){for(let e=i;e<r;++e)this.centroidVertexArray.emplace(e,a.x,a.y);this.needsCentroidUpdate=!0}}createCentroidsBuffer(){for(let e of(this.centroidVertexArray.resize(this.layoutVertexArray.length),this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length),this.centroidData))this.writeCentroidToBuffer(e)}updateReplacement(e,i,r){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;let a=i.getReplacementRegionsForTile(e.toUnwrapped());if(lq(this.activeReplacements,a))return;if(this.activeReplacements=a,0===this.centroidVertexArray.length)this.createCentroidsBuffer();else for(let e of this.centroidData)e.flags&=0x7fffffff;let n=[];for(let i of this.activeReplacements){if(i.order<r)continue;let a=Math.max(1,Math.pow(2,i.footprintTileId.canonical.z-e.canonical.z));for(let r of this.centroidData)if(!(0x80000000&r.flags||i.min.x>r.max.x||r.min.x>i.max.x||i.min.y>r.max.y||r.min.y>i.max.y))for(let s=0;s<r.footprintSegLen;s++){let l=this.footprintSegments[r.footprintSegIdx+s];if(n.length=0,function(e,i,r,a,n,s){let l=Math.pow(2,a.z-n.z);for(let h=0;h<r;h++){let r=e.int16[2*(h+i)+0],u=e.int16[2*(h+i)+1];r=(r+8192*n.x)*l-8192*a.x,u=(u+8192*n.y)*l-8192*a.y,s.push(new eA(r,u))}}(this.footprintVertices,l.vertexOffset,l.vertexCount,i.footprintTileId.canonical,e.canonical,n),l$(i.footprint,n,this.footprintIndices.uint16,l.indexOffset,l.indexCount,-l.vertexOffset,-a)){r.flags|=0x80000000;break}}}for(let e of this.centroidData)this.writeCentroidToBuffer(e);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(e,i,r){let a=!1;for(let n=0;n<r.footprintSegLen;n++){let s=this.footprintSegments[r.footprintSegIdx+n],l=0;for(let r of s.ringIndices){for(let n=l,h=r+l-1;n<r+l;h=n++){let r=this.footprintVertices.int16[2*(n+s.vertexOffset)+0],l=this.footprintVertices.int16[2*(n+s.vertexOffset)+1],u=this.footprintVertices.int16[2*(h+s.vertexOffset)+1];l>i!=u>i&&e<(this.footprintVertices.int16[2*(h+s.vertexOffset)+0]-r)*(i-l)/(u-l)+r&&(a=!a)}l=r}}return a}getHeightAtTileCoord(e,i){let r=Number.NEGATIVE_INFINITY,a=!0,n=4*(e+8192)*8192+(i+8192);if(this.partLookup.hasOwnProperty(n)){let e=this.partLookup[n];return e?{height:e.height,hidden:!!(0x80000000&e.flags)}:void 0}for(let s of this.centroidData)e>s.max.x||s.min.x>e||i>s.max.y||s.min.y>i||this.footprintContainsPoint(e,i,s)&&s&&s.height>r&&(r=s.height,this.partLookup[n]=s,a=!!(0x80000000&s.flags));if(r!==Number.NEGATIVE_INFINITY)return{height:r,hidden:a};this.partLookup[n]=void 0}}function hi(e,i){let r=e.add(i)._unit();return e.x*r.x+e.y*r.y}function hr(e,i,r,a,n){let s=Math.sqrt(1-a*a);return Math.min(e.dist(i)/3,i.dist(r)/3,n*s/a)}function ha(e,i,r){return e.x<r[0].x&&i.x<r[0].x||e.x>r[1].x&&i.x>r[1].x||e.y<r[0].y&&i.y<r[0].y||e.y>r[1].y&&i.y>r[1].y}function hn(e,i){return e.x<i[0].x||e.x>i[1].x||e.y<i[0].y||e.y>i[1].y}function ho(e,i,r){if(e.x<0||e.x>=8192||i.x<0||i.x>=8192||r.x<0||r.x>=8192)return!1;let a=r.sub(i),n=a.perp(),s=e.sub(i);return(a.x*s.x+a.y*s.y)/Math.sqrt((a.x*a.x+a.y*a.y)*(s.x*s.x+s.y*s.y))>-.866&&n.x*s.x+n.y*s.y<0}function hs(e,i,r){let a=i?2|e:-3&e;return r?1|a:-2&a}function hl(){let e=Math.tan(Math.PI/32);return 6371008.8*Math.sqrt(1+2*e*e)-6371008.8}function hh(e,i,r){let a=1<<r.z,n=ok(r.x/a);return function(e,i,r,a,n=0,s){let l=[];
212if(!e.length||!r||!a)return l;let h=(e,i)=>{for(let r of e)l.push({polygon:r,bounds:i})},u=Math.ceil(Math.log2(r)),c=Math.ceil(Math.log2(a)),d=u-c,p=[];for(let e=0;e<Math.abs(d);e++)p.push(d>0?0:1);for(let e=0;e<Math.min(u,c);e++)p.push(0),p.push(1);let f=e;if(f=lO(f,i[0].y-n,i[1].y+n,1),!(f=lO(f,i[0].x-n,i[1].x+n,0)).length)return l;let m=[];for(p.length?m.push({polygons:f,bounds:i,depth:0}):h(f,i);m.length;){let e=m.pop(),i=e.depth,r=p[i],a=e.bounds[0],l=e.bounds[1],u=0===r?a.x:a.y,c=0===r?l.x:l.y,d=s?s(r,u,c):.5*(u+c),f=lO(e.polygons,u-n,d+n,r),_=lO(e.polygons,d-n,c+n,r);if(f.length){let e=[a,new eA(0===r?d:l.x,1===r?d:l.y)];p.length>i+1?m.push({polygons:f,bounds:e,depth:i+1}):h(f,e)}if(_.length){let e=[new eA(0===r?d:a.x,1===r?d:a.y),l];p.length>i+1?m.push({polygons:_,bounds:e,depth:i+1}):h(_,e)}}return l}(e,i,Math.ceil((ok((r.x+1)/a)-n)/11.25),Math.ceil((oR(r.y/a)-oR((r.y+1)/a))/11.25),1,(e,i,n)=>{if(0===e)return .5*(i+n);{let e=oR((r.y+i/8192)/a);return(oL(.5*(oR((r.y+n/8192)/a)+e))*a-r.y)*8192}})}function hu(e,i){return e.x*i.x+e.y*i.y}function hc(e,i){if(1===e.length){let r,a=0,n=i[a++];for(;!r||n.equals(r);)if(!(r=i[a++]))return 1/0;for(;a<i.length;a++){let s=i[a],l=e[0],h=r.sub(n),u=s.sub(n),c=l.sub(n),d=hu(h,h),p=hu(h,u),f=hu(u,u),m=hu(c,h),_=hu(c,u),g=d*f-p*p,y=(f*m-p*_)/g,x=(d*_-p*m)/g,v=n.z*(1-y-x)+r.z*y+s.z*x;if(isFinite(v))return v}return 1/0}{let e=1/0;for(let r of i)e=Math.min(e,r.z);return e}}function hd(e,i,r,a,n,s,l,h){let u=l*n.getElevationAt(e,i,!0,!0),c=0!==s[0],d=c?0===s[1]?l*(s[0]/7-450):l*function(e,i,r){var a,n;let s=Math.floor(i[0]/8),l=Math.floor(i[1]/8),h=10*(i[0]-8*s),u=10*(i[1]-8*l),c=e.getElevationAt(s,l,!0,!0),d=e.getMeterToDEM(r),p=Math.floor(.5*(h*d-1)),f=Math.floor(.5*(u*d-1)),m=e.tileCoordToPixel(s,l),_=2*p+1,g=2*f+1,y=(a=m.x-p,n=m.y-f,[e.getElevationAtPixel(a,n,!0),e.getElevationAtPixel(a+g,n,!0),e.getElevationAtPixel(a,n+g,!0),e.getElevationAtPixel(a+_,n+g,!0)]),x=Math.abs(y[0]-y[1]);return c+Math.max(Math.min(.25,.5*d*(x+Math.abs(y[2]-y[3]))/_)*h,Math.min(.25,.5*d*(Math.abs(y[0]-y[2])+Math.abs(y[1]-y[3]))/g)*u)}(n,s,h):u;return{base:u+(0===r?-1:r),top:c?Math.max(d+a,u+r+2):u+a}}af(ht,"FillExtrusionBucket",{omit:["layers","features"]}),af(l6,"PartData"),af(l5,"FootprintSegment"),af(l8,"BorderCentroidData"),af(he,"GroundEffect");let hp=na([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),hf=na([{name:"a_z_offset",components:1,type:"Float32"}],4),{members:hm}=hp,{members:h_}=na([{name:"a_packed",components:4,type:"Float32"}]),{members:hg}=na([{name:"a_pattern_data",components:3,type:"Float32"}]);class hy{constructor(e,i){this.width=e,this.height=i,this.nextRow=0,this.image=new sY({width:e,height:i}),this.positions={},this.uploaded=!1}getDash(e,i){let r=this.getKey(e,i);return this.positions[r]}trim(){let e=this.width,i=this.height=ej(this.nextRow);this.image.resize({width:e,height:i})}getKey(e,i){return e.join(",")+i}getDashRanges(e,i,r){let a=[],n=e.length%2==1?-e[e.length-1]*r:0,s=e[0]*r,l=!0;a.push({left:n,right:s,isDash:l,zeroLength:0===e[0]});let h=e[0];for(let i=1;i<e.length;i++){l=!l;let u=e[i];n=h*r,h+=u,s=h*r,a.push({left:n,right:s,isDash:l,zeroLength:0===u})}return a}addRoundDash(e,i,r){let a=i/2;for(let i=-r;i<=r;i++){let n=this.width*(this.nextRow+r+i),s=0,l=e[0];for(let h=0;h<this.width;h++){let u;h/l.right>1&&(l=e[++s]);let c=Math.min(Math.abs(h-l.left),Math.abs(h-l.right)),d=i/r*(a+1);if(l.isDash){let e=a-Math.abs(d);u=Math.sqrt(c*c+e*e)}else u=a-Math.sqrt(c*c+d*d);this.image.data[n+h]=Math.max(0,Math.min(255,u+128))}}}addRegularDash(e,i){for(let i=e.length-1;i>=0;--i){let r=e[i],a=e[i+1];r.zeroLength?e.splice(i,1):a&&a.isDash===r.isDash&&(a.left=r.left,e.splice(i,1))}let r=e[0],a=e[e.length-1];r.isDash===a.isDash&&(r.left=a.left-this.width,a.right=r.right+this.width);let n=this.width*this.nextRow,s=0,l=e[0];for(let r=0;r<this.width;r++){r/l.right>1&&(l=e[++s]);let a=Math.min(Math.abs(r-l.left),Math.abs(r-l.right));this.image.data[n+r]=Math.max(0,Math.min(255,(l.isDash?a:-a)+i+128))}}
212addDash(e,i){let r=this.getKey(e,i);if(this.positions[r])return this.positions[r];let a="round"===i,n=7*!!a,s=2*n+1;if(this.nextRow+s>this.height)return eX("LineAtlas out of space"),null;0===e.length&&e.push(1);let l=0;for(let i=0;i<e.length;i++)e[i]<0&&(eX("Negative value is found in line dasharray, replacing values with 0"),e[i]=0),l+=e[i];if(0!==l){let r=this.width/l,s=this.getDashRanges(e,this.width,r);a?this.addRoundDash(s,r,n):this.addRegularDash(s,"square"===i?.5*r:0)}let h=this.nextRow+n;this.nextRow+=s;let u={tl:[h,n],br:[l,0]};return this.positions[r]=u,u}}af(hy,"LineAtlas");let hx=lR.VectorTileFeature.types,hv=Math.cos(Math.PI/180*37.5),hb=Math.cos(Math.PI/180*5);class hw{constructor(e){this.evaluationGlobals={zoom:0,lineProgress:void 0},this.zoom=e.zoom,this.evaluationGlobals.zoom=this.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.projection=e.projection,this.hasPattern=!1,this.hasZOffset=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(e=>{this.gradients[e.id]={}}),this.layoutVertexArray=new nu,this.layoutVertexArray2=new nc,this.patternVertexArray=new nd,this.indexArray=new nS,this.programConfigurations=new o_(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new n0,this.maxLineLength=0,this.zOffsetVertexArray=new nA,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.tessellationStep=e.tessellationStep?e.tessellationStep:128}updateFootprints(e,i){}populate(e,i,r,a){this.hasPattern=lh("line",this.layers,i);let n=this.layers[0].layout.get("line-sort-key");this.hasZOffset=!this.layers[0].isDraped();let s=this.layers[0].layout.get("line-elevation-reference");this.hasZOffset&&"none"===s&&eX(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`);let l=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope=this.hasZOffset&&void 0!==l;let h=[];for(let{feature:i,id:s,index:l,sourceLayerIndex:u}of e){let e=this.layers[0]._featureFilter.needGeometry,c=oj(i,e);if(!this.layers[0]._featureFilter.filter(new aO(this.zoom),c,r))continue;let d=n?n.evaluate(c,{},r):void 0,p={id:s,properties:i.properties,type:i.type,sourceLayerIndex:u,index:l,geometry:e?c.geometry:oU(i,r,a),patterns:{},sortKey:d};h.push(p)}n&&h.sort((e,i)=>e.sortKey-i.sortKey);let{lineAtlas:u,featureIndex:c}=i,d=this.addConstantDashes(u);for(let a of h){let{geometry:n,index:s,sourceLayerIndex:l}=a;if(d&&this.addFeatureDashes(a,u),this.hasPattern){let e=lu("line",this.layers,a,this.zoom,i);this.patternFeatures.push(e)}else this.addFeature(a,n,s,r,u.positions,i.availableImages,i.brightness);c.insert(e[s].feature,n,s,l,this.index)}}addConstantDashes(e){let i=!1;for(let r of this.layers){let a=r.paint.get("line-dasharray").value,n=r.layout.get("line-cap").value;if("constant"!==a.kind||"constant"!==n.kind)i=!0;else{let i=n.value,r=a.value;if(!r)continue;e.addDash(r,i)}}return i}addFeatureDashes(e,i){let r=this.zoom;for(let a of this.layers){let n,s;let l=a.paint.get("line-dasharray").value,h=a.layout.get("line-cap").value;if("constant"!==l.kind||"constant"!==h.kind){if("constant"===l.kind){if(!(n=l.value))continue}else n=l.evaluate({zoom:r},e);s="constant"===h.kind?h.value:h.evaluate({zoom:r},e),i.addDash(n,s),e.patterns[a.id]=i.getKey(n,s)}}}update(e,i,r,a,n){let s=0!==Object.keys(e).length;s&&!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(e,i,s?this.stateDependentLayers:this.layers,r,a,n)}addFeatures(e,i,r,a,n,s){for(let e of this.patternFeatures)this.addFeature(e,e.geometry,e.index,i,r,a,s)}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,h_)),0!==this.patternVertexArray.length&&(this.patternVertexBuffer=e.createVertexBuffer(this.patternVertexArray,hg)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,hf.members,!0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,hm),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&e.properties.hasOwnProperty("mapbox_clip_start")&&e.properties.hasOwnProperty("mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,i,r,a,n,s,l){let h=this.layers[0].layout,u=h.get("line-join").evaluate(e,{}),c=h.get("line-cap").evaluate(e,{}),d=h.get("line-miter-limit"),p=h.get("line-round-limit");for(let r of(this.lineClips=this.lineFeatureClips(e),this.lineFeature=e,this.zOffsetValue=h.get("line-z-offset").value,i))this.addLine(r,e,a,u,c,d,p);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,n,s,a,l)}addLine(e,i,r,a,n,s,l){let h,u,c,d,p,f;this.distance=0,this.prevDistance=0,this.scaledDistance=0,this.totalDistance=0,this.totalFeatureLength=0,this.lineS
212oFar=0,this.currentVertex=void 0;let m="none"===a;if(this.patternJoinNone=this.hasPattern&&m,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[],this.lineClips){this.lineClipsArray.push(this.lineClips);for(let i=0;i<e.length-1;i++)this.totalDistance+=e[i].dist(e[i+1]);this.totalFeatureLength=this.totalDistance/(this.lineClips.end-this.lineClips.start),this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let _="Polygon"===hx[i.type],g=e.length;for(;g>=2&&e[g-1].equals(e[g-2]);)g--;let y=0;for(;y<g-1&&e[y].equals(e[y+1]);)y++;if(g<(_?3:2))return;"bevel"===a&&(s=1.05);let x=this.segments.prepareSegment(10*g,this.layoutVertexArray,this.indexArray);this.e1=this.e2=-1,_&&(h=e[g-2],p=e[y].sub(h)._unit()._perp());for(let i=y;i<g;i++){if((c=i===g-1?_?e[y+1]:void 0:e[i+1])&&e[i].equals(c))continue;p&&(d=p),h&&(u=h),h=e[i],f=this.hasZOffset?this.evaluateElevationValue(u?u.dist(h):0):null,p=c?c.sub(h)._unit()._perp():d,d=d||p;let r=u&&c,v=r?a:_||m?"butt":n,b=d.x*p.x+d.y*p.y;if(m){let e=function(e){if(e.patternJoinNone){let i=e.segmentPoints.length/2,r=e.lineSoFar-e.segmentStart;for(let a=0;a<i;++a){let i=e.segmentPoints[2*a+1],n=Math.round(e.segmentPoints[2*a])+.5+.25*i;e.patternVertexArray.emplaceBack(n,r,e.segmentStart),e.patternVertexArray.emplaceBack(n,r,e.segmentStart)}e.segmentPoints.length=0}e.e1=e.e2=-1};if(r&&b<hb){this.updateDistance(u,h),this.addCurrentVertex(h,d,1,1,x,f),e(this),this.addCurrentVertex(h,p,-1,-1,x,f);continue}if(u){if(!c){this.updateDistance(u,h),this.addCurrentVertex(h,d,1,1,x,f),e(this);continue}v="miter"}}let w=d.add(p);0===w.x&&0===w.y||w._unit();let T=w.x*p.x+w.y*p.y,S=0!==T?1/T:1/0,M=2*Math.sqrt(2-2*T),E=T<hv&&u&&c,A=d.x*p.y-d.y*p.x>0,I=this.overscaling<=16?122880/(512*this.overscaling):0;if(r&&"round"===v){if(S<l)v="miter";else if(S<=2){let e=hT(h,-10,8202);v=this.hasZOffset&&(e||this.hasCrossSlope)?"miter":"fakeround"}}if("miter"===v&&S>s&&(v="bevel"),"bevel"===v&&(S>2&&(v="flipbevel"),S<s&&(v="miter")),u&&!("miter"===v&&E)&&this.updateDistance(u,h),"miter"===v){if(E){let e=h.dist(u);if(e>2*I){let i=h.sub(h.sub(u)._mult(I/e)._round());this.updateDistance(u,i),this.addCurrentVertex(i,d,0,0,x,f),u=i}this.updateDistance(u,h),w._mult(S),this.addCurrentVertex(h,w,0,0,x,f);let i=h.dist(c);if(i>2*I){let e=h.add(c.sub(h)._mult(I/i)._round());this.updateDistance(h,e),this.addCurrentVertex(e,p,0,0,x,f),h=e}}else w._mult(S),this.addCurrentVertex(h,w,0,0,x,f)}else if("flipbevel"===v){if(S>100)w=p.mult(-1);else{let e=S*d.add(p).mag()/d.sub(p).mag();w._perp()._mult(e*(A?-1:1))}this.addCurrentVertex(h,w,0,0,x,f),this.addCurrentVertex(h,w.mult(-1),0,0,x,f)}else if("bevel"===v||"fakeround"===v){null!=f&&u&&this.addCurrentVertex(h,d,-1,-1,x,f);let e=h.dist(u)<=2*I&&"bevel"!==v,i=w.mult(A?1:-1);i._mult(S);let r=p.mult(A?-1:1),a=d.mult(A?-1:1),n=this.evaluateElevationValue(this.distance);if(null==f&&(this.addHalfVertex(h,i.x,i.y,!1,!A,0,x,n),e||this.addHalfVertex(h,i.x+2*a.x,i.y+2*a.y,!1,A,0,x,n)),"fakeround"===v){let e=Math.round(180*M/Math.PI/20);this.addHalfVertex(h,a.x,a.y,!1,A,0,x,n);for(let i=0;i<e;i++){let s=i/e;if(.5!==s){let e=s-.5;s+=s*e*(s-1)*((1.0904+b*(b*(3.55645-1.43519*b)-3.2452))*e*e+(.848013+b*(.215638*b-1.06021)))}let l=r.sub(a)._mult(s)._add(a)._unit();this.addHalfVertex(h,l.x,l.y,!1,A,0,x,n)}this.addHalfVertex(h,r.x,r.y,!1,A,0,x,n)}e||null!=f||this.addHalfVertex(h,i.x+2*r.x,i.y+2*r.y,!1,A,0,x,n),null!=f&&c&&this.addCurrentVertex(h,p,1,1,x,f)}else"butt"===v?this.addCurrentVertex(h,w,0,0,x,f):"square"===v?(u||this.addCurrentVertex(h,w,-1,-1,x,f),this.addCurrentVertex(h,w,0,0,x,f),u&&this.addCurrentVertex(h,w,1,1,x,f)):"round"===v&&(u&&(this.addCurrentVertex(h,d,0,0,x,f),this.addCurrentVertex(h,d,1,1,x,f,!0)),c&&(this.addCurrentVertex(h,p,-1,-1,x,f,!0),this.addCurrentVertex(h,p,0,0,x,f)))}}addVerticesTo(e,i,r,a,n,s,l,h,u,c){let d=(i.w-e.w)/this.tessellationStep|0,p=0,f=this.scaledDistance;if(d>1){this.lineSoFar=e.w;let f=(i.x-e.x)/d,m=(i.y-e.y)/d,_=(i.z-e.z)/d,g=(i.w-e.w)/d;for(let i=1;i<d;++i){e.x+=f,e.y+=m,e.z+=_,this.lineSoFar+=g,p+=g;let i=this.evaluateElevationValue(this.prevDistance+p);this.scaledDistance=(this.prevDistance+p)/this.totalDistance,this.addHalfVertex(e,r,a,c,!1,l,u,i),this.addHalfVertex(e,n,s,c,!0,-h,u,i)}}
212this.lineSoFar=i.w,this.scaledDistance=f;let m=this.evaluateElevationValue(this.distance);this.addHalfVertex(i,r,a,c,!1,l,u,m),this.addHalfVertex(i,n,s,c,!0,-h,u,m)}evaluateElevationValue(e){return this.hasZOffset?"constant"===this.zOffsetValue.kind?this.zOffsetValue.value:(this.evaluationGlobals.lineProgress=0,this.lineClips?this.evaluationGlobals.lineProgress=Math.min(1,(this.totalFeatureLength*this.lineClips.start+e)/this.totalFeatureLength):eX(`line-z-offset evaluation for ${this.layerIds[0]} requires enabling 'lineMetrics' for the source.`),this.zOffsetValue.evaluate(this.evaluationGlobals,this.lineFeature)||0):void 0}addCurrentVertex(e,i,r,a,n,s,l=!1){let h=i.x+i.y*r,u=i.y-i.x*r,c=i.y*a-i.x,d=-i.y-i.x*a;if(null!=s){let i=new lD(e.x,e.y,s,this.lineSoFar),p=hT(e,-10,8202),f=this.lineSoFar,m=this.distance;if(this.currentVertex){if(p){let p=this.currentVertexIsOutside,f=this.currentVertex,_=new lD(e.x,e.y,s,this.lineSoFar);if(lF(f,_,-10,8202),!hT(_,-10,8202)){if(p){this.e1=this.e2=-1,this.distance-=f.dist(i),this.lineSoFar=f.w;let e=this.evaluateElevationValue(f.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(f,h,u,l,!1,r,n,e),this.addHalfVertex(f,c,d,l,!0,-a,n,e),this.prevDistance=this.distance}this.distance=this.prevDistance+f.dist(_),this.scaledDistance=this.distance/this.totalDistance,this.addVerticesTo(f,_,h,u,c,d,r,a,n,l),this.distance=m,this.scaledDistance=this.distance/this.totalDistance}}else{let e=this.currentVertex;if(this.currentVertexIsOutside){lF(e,i,-10,8202),this.e1=this.e2=-1,this.distance-=e.dist(i),this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=e.w;let s=this.evaluateElevationValue(e.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(e,h,u,l,!1,r,n,s),this.addHalfVertex(e,c,d,l,!0,-a,n,s),this.prevDistance=this.distance,this.distance=m,this.scaledDistance=this.distance/this.totalDistance}this.addVerticesTo(e,i,h,u,c,d,r,a,n,l)}}else p||(this.addHalfVertex(e,h,u,l,!1,r,n,s),this.addHalfVertex(e,c,d,l,!0,-a,n,s));this.currentVertex=i,this.currentVertexIsOutside=p,this.lineSoFar=f}else this.addHalfVertex(e,h,u,l,!1,r,n,s),this.addHalfVertex(e,c,d,l,!0,-a,n,s)}addHalfVertex({x:e,y:i},r,a,n,s,l,h,u){this.patternJoinNone&&(0===this.segmentPoints.length&&(this.segmentStart=this.lineSoFar,this.segmentStartf32=Math.fround(this.lineSoFar)),s||this.segmentPoints.push(this.lineSoFar-this.segmentStart,l)),this.layoutVertexArray.emplaceBack((e<<1)+ +!!n,(i<<1)+ +!!s,Math.round(63*r)+128,Math.round(63*a)+128,1+(0===l?0:l<0?-1:1),0,this.lineSoFar-this.segmentStartf32),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineClips.start,this.lineClips.end);let c=h.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,c),h.primitiveLength++),s?this.e2=c:this.e1=c,null!=u&&this.zOffsetVertexArray.emplaceBack(u)}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(e,i){this.prevDistance=this.distance,this.distance+=e.dist(i),this.updateScaledDistance()}}function hT(e,i,r){return e.x<i||e.x>r||e.y<i||e.y>r}function hS(e,i,r){return i*(8192/(e.tileSize*Math.pow(2,r-e.tileID.overscaledZ)))}af(hw,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});let hM=(e,i,r)=>(1-r)*e+r*i;function hE(e,i){return 1/hS(e,1,i.tileZoom)}function hA(e,i,r,a){return e.translatePosMatrix(a||i.tileID.projMatrix,i,r.paint.get("line-translate"),r.paint.get("line-translate-anchor"))}let hI=e=>{let i=[];hC(e)&&i.push("RENDER_LINE_DASH"),e.paint.get("line-gradient")&&i.push("RENDER_LINE_GRADIENT");let r=e.paint.get("line-trim-offset");0===r[0]&&0===r[1]||i.push("RENDER_LINE_TRIM_OFFSET"),0!==e.paint.get("line-border-width").constantOr(1)&&i.push("RENDER_LINE_BORDER");let a="none"===e.layout.get("line-join").constantOr("miter"),n=!!e.paint.get("line-pattern").constantOr(1);return a&&n&&i.push("LINE_JOIN_NONE"),i};function hC(e){let i=e.paint.get("line-dasharray").value;return i.value||"constant"!==i.kind}let hP=()=>A||(A={layout:M||(M=new aZ({"line-cap":new a$(aX.layout_line["line-cap"]),"line-join":new a$(aX.layout_line["line-join"]),"line-miter-limit":new aW(aX.layout_line["line-miter-limit"]),"line-round-limit":new aW(aX.layout_line["line-round-limit"]),"line-sort-key":new a$(aX.layout_line["line-sort-key"]),"line-z-offset":new a$(aX.layout_line["line-z-offset"]),"line-elevation-reference":new aW(aX.layout_line["line-elevation-reference"]),"line-cross-slope":new aW(aX.layout_line["line-cross-slope"]),visibility:new aW(aX.layout_line.visibility)})),paint:E||(E=new aZ({"line-opacity":new a$(aX.paint_line["line-opacity"]),"line-color":new a$(aX.paint_line["line-color"]),"line-translate":new aW(aX.paint_line["line-translate"]),"line-translate-anchor":new aW(aX.paint_line["line-translate-anchor"]),"line-width":new a$(aX.paint_line["line-width"]),"line-gap-width":new a$(aX.paint_line["line-gap-width"]),"line-offset":new a$(aX.paint_line["line-offset"]),"line-blur"
212:new a$(aX.paint_line["line-blur"]),"line-dasharray":new a$(aX.paint_line["line-dasharray"]),"line-pattern":new a$(aX.paint_line["line-pattern"]),"line-gradient":new aH(aX.paint_line["line-gradient"]),"line-trim-offset":new aW(aX.paint_line["line-trim-offset"]),"line-trim-fade-range":new aW(aX.paint_line["line-trim-fade-range"]),"line-trim-color":new aW(aX.paint_line["line-trim-color"]),"line-emissive-strength":new aW(aX.paint_line["line-emissive-strength"]),"line-border-width":new a$(aX.paint_line["line-border-width"]),"line-border-color":new a$(aX.paint_line["line-border-color"]),"line-occlusion-opacity":new aW(aX.paint_line["line-occlusion-opacity"])}))});class hL extends a${possiblyEvaluate(e,i){return i=new aO(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,transition:i.transition}),super.possiblyEvaluate(e,i)}evaluate(e,i,r,a){return i=eN({},i,{zoom:Math.floor(i.zoom)}),super.evaluate(e,i,r,a)}}let hk=na([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),hR=na([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),hz=na([{name:"a_projected_pos",components:4,type:"Float32"}],4);na([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let hD=na([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),hO=na([{name:"a_texb",components:2,type:"Uint16"}]),hB=na([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),hF=na([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);na([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);let hN=na([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),hV=na([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function hU(e,i){let{expression:r}=i;if("constant"===r.kind)return{kind:"constant",layoutSize:r.evaluate(new aO(e+1))};if("source"===r.kind)return{kind:"source"};{let{zoomStops:i,interpolationType:a}=r,n=0;for(;n<i.length&&i[n]<=e;)n++;let s=n=Math.max(0,n-1);for(;s<i.length&&i[s]<e+1;)s++;s=Math.min(i.length-1,s);let l=i[n],h=i[s];return"composite"===r.kind?{kind:"composite",minZoom:l,maxZoom:h,interpolationType:a}:{kind:"camera",minZoom:l,maxZoom:h,minSize:r.evaluate(new aO(l)),maxSize:r.evaluate(new aO(h)),interpolationType:a}}}function hj(e,{uSize:i,uSizeT:r},{lowerSize:a,upperSize:n}){return"source"===e.kind?a/128:"composite"===e.kind?tU(a/128,n/128,r):i}function hG(e,i,r=1){let a=0,n=0;if("constant"===e.kind)n=e.layoutSize*r;else if("source"!==e.kind){let{interpolationType:s,minZoom:l,maxZoom:h}=e,u=s?eD(rE.interpolationFactor(s,i,l,h),0,1):0;"camera"===e.kind?n=tU(e.minSize,e.maxSize,u)*r:a=u*r}return{uSizeT:a,uSize:n}}na([{name:"triangle",components:3,type:"Uint16"}]),na([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"},{type:"Uint8",name:"flipState"}]),na([{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Float32",name:"zOffset"},{type:"Uint8",name:"hasIconTextFit"}]),na([{type:"Float32",name:"offsetX"}]),na([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var hq=Object.freeze({__proto__:null,SIZE_PACK_FACTOR:128,evaluateSizeForFeature:hj,evaluateSizeForZoom:hG,getSizeData:hU});let hW={"!":"ï¸","#":"ï¼",$:"ï¼","%":"ï¼
","&":"ï¼","(":"︵",")":"︶","*":"ï¼","+":"ï¼",",":"ï¸","-":"︲",".":"ã»","/":"ï¼",":":"ï¸",";":"ï¸","<":"︿","=":"ï¼",">":"ï¹","?":"ï¸","@":"ï¼ ","[":"ï¹","\\":"ï¼¼","]":"ï¹","^":"ï¼¾",_:"︳","`":"ï½","{":"︷","|":"â","}":"︸","~":"ï½","¢":"ï¿ ","£":"ï¿¡","Â¥":"ï¿¥","¦":"¦","¬":"ï¿¢","¯":"ï¿£","â":"︲","â":"︱","â":"ï¹","â":"ï¹","â":"ï¹","â":"ï¹","â¦":"ï¸","â§":"ã»","â©":"₩","ã":"ï¸","ã":"ï¸","ã":"︿","ã":"ï¹","ã":"︽","ã":"︾","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"︻","ã":"︼","ã":"︹","ã":"︺","ã":"ï¸","ã":"ï¸","ï¼":"ï¸","ï¼":"︵","ï¼":"︶","ï¼":"ï¸","ï¼":"︲","ï¼":"ã»","ï¼":"ï¸","ï¼":"ï¸","ï¼":"︿","ï¼":"ï¹","ï¼":"ï¸","ï¼»":"ï¹","ï¼½":"ï¹","_":"︳","ï½":"︷","ï½":"â","ï½":"︸","ï½":"︵","ï½ ":"︶","。":"ï¸","ï½¢":"ï¹","ï½£":"ï¹","â":"â","â":"â"};var h$,hH,hZ,hX={};
212function hY(){if(hZ)return hH;hZ=1,hH=i;var e=(h$||(h$=1,hX.read=function(e,i,r,a,n){var s,l,h=8*n-a-1,u=(1<<h)-1,c=u>>1,d=-7,p=r?n-1:0,f=r?-1:1,m=e[i+p];for(p+=f,s=m&(1<<-d)-1,m>>=-d,d+=h;d>0;s=256*s+e[i+p],p+=f,d-=8);for(l=s&(1<<-d)-1,s>>=-d,d+=a;d>0;l=256*l+e[i+p],p+=f,d-=8);if(0===s)s=1-c;else{if(s===u)return l?NaN:1/0*(m?-1:1);l+=Math.pow(2,a),s-=c}return(m?-1:1)*l*Math.pow(2,s-a)},hX.write=function(e,i,r,a,n,s){var l,h,u,c=8*s-n-1,d=(1<<c)-1,p=d>>1,f=5960464477539062e-23*(23===n),m=a?0:s-1,_=a?1:-1,g=+(i<0||0===i&&1/i<0);for(isNaN(i=Math.abs(i))||i===1/0?(h=+!!isNaN(i),l=d):(l=Math.floor(Math.log(i)/Math.LN2),i*(u=Math.pow(2,-l))<1&&(l--,u*=2),(i+=l+p>=1?f/u:f*Math.pow(2,1-p))*u>=2&&(l++,u/=2),l+p>=d?(h=0,l=d):l+p>=1?(h=(i*u-1)*Math.pow(2,n),l+=p):(h=i*Math.pow(2,p-1)*Math.pow(2,n),l=0));n>=8;e[r+m]=255&h,m+=_,h/=256,n-=8);for(l=l<<n|h,c+=n;c>0;e[r+m]=255&l,m+=_,l/=256,c-=8);e[r+m-_]|=128*g}),hX);function i(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}i.Varint=0,i.Fixed64=1,i.Bytes=2,i.Fixed32=5;var r="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function a(e){return e.type===i.Bytes?e.readVarint()+e.pos:e.pos+1}function n(e,i,r){var a=i<=16383?1:i<=2097151?2:i<=0xfffffff?3:Math.floor(Math.log(i)/(7*Math.LN2));r.realloc(a);for(var n=r.pos-1;n>=e;n--)r.buf[n+a]=r.buf[n]}function s(e,i){for(var r=0;r<e.length;r++)i.writeVarint(e[r])}function l(e,i){for(var r=0;r<e.length;r++)i.writeSVarint(e[r])}function h(e,i){for(var r=0;r<e.length;r++)i.writeFloat(e[r])}function u(e,i){for(var r=0;r<e.length;r++)i.writeDouble(e[r])}function c(e,i){for(var r=0;r<e.length;r++)i.writeBoolean(e[r])}function d(e,i){for(var r=0;r<e.length;r++)i.writeFixed32(e[r])}function p(e,i){for(var r=0;r<e.length;r++)i.writeSFixed32(e[r])}function f(e,i){for(var r=0;r<e.length;r++)i.writeFixed64(e[r])}function m(e,i){for(var r=0;r<e.length;r++)i.writeSFixed64(e[r])}function _(e,i){return(e[i]|e[i+1]<<8|e[i+2]<<16)+0x1000000*e[i+3]}function g(e,i,r){e[r]=i,e[r+1]=i>>>8,e[r+2]=i>>>16,e[r+3]=i>>>24}function y(e,i){return(e[i]|e[i+1]<<8|e[i+2]<<16)+(e[i+3]<<24)}return i.prototype={destroy:function(){this.buf=null},readFields:function(e,i,r){for(r=r||this.length;this.pos<r;){var a=this.readVarint(),n=a>>3,s=this.pos;this.type=7&a,e(n,i,this),this.pos===s&&this.skip(a)}return i},readMessage:function(e,i){return this.readFields(e,i,this.readVarint()+this.pos)},readFixed32:function(){var e=_(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=y(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=_(this.buf,this.pos)+0x100000000*_(this.buf,this.pos+4);return this.pos+=8,e},readSFixed64:function(){var e=_(this.buf,this.pos)+0x100000000*y(this.buf,this.pos+4);return this.pos+=8,e},readFloat:function(){var i=e.read(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=e.read(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(e){var i,r,a=this.buf;return i=127&(r=a[this.pos++]),r<128?i:(i|=(127&(r=a[this.pos++]))<<7,r<128?i:(i|=(127&(r=a[this.pos++]))<<14,r<128?i:(i|=(127&(r=a[this.pos++]))<<21,r<128?i:function(e,i,r){var a,n,s,l=r.buf;if(n=(112&(s=l[r.pos++]))>>4,s<128||(n|=(127&(s=l[r.pos++]))<<3,s<128)||(n|=(127&(s=l[r.pos++]))<<10,s<128)||(n|=(127&(s=l[r.pos++]))<<17,s<128)||(n|=(127&(s=l[r.pos++]))<<24,s<128)||(n|=(1&(s=l[r.pos++]))<<31,s<128))return a=n,i?0x100000000*a+(e>>>0):0x100000000*(a>>>0)+(e>>>0);throw Error("Expected varint not more than 10 bytes")}(i|=(15&(r=a[this.pos]))<<28,e,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2==1?-((e+1)/2):e/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var e,i=this.readVarint()+this.pos,a=this.pos;return this.pos=i,i-a>=12&&r?(e=this.buf,r.decode(e.subarray(a,i))):function(e,i,r){for(var a="",n=i;n<r;){var s,l,h,u=e[n],c=null,d=u>239?4:u>223?3:u>191?2:1;if(n+d>r)break;1===d?u<128&&(c=u):2===d?128==(192&(s=e[n+1]))&&(c=(31&u)<<6|63&s)<=127&&(c=null):3===d?(l=e[n+2],128==(192&(s=e[n+1]))&&128==(192&l)&&((c=(15&u)<<12|(63&s)<<6|63&l)<=2047||c>
212=55296&&c<=57343)&&(c=null)):4===d&&(l=e[n+2],h=e[n+3],128==(192&(s=e[n+1]))&&128==(192&l)&&128==(192&h)&&((c=(15&u)<<18|(63&s)<<12|(63&l)<<6|63&h)<=65535||c>=1114112)&&(c=null)),null===c?(c=65533,d=1):c>65535&&(c-=65536,a+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),a+=String.fromCharCode(c),n+=d}return a}(this.buf,a,i)},readBytes:function(){var e=this.readVarint()+this.pos,i=this.buf.subarray(this.pos,e);return this.pos=e,i},readPackedVarint:function(e,r){if(this.type!==i.Bytes)return e.push(this.readVarint(r));var n=a(this);for(e=e||[];this.pos<n;)e.push(this.readVarint(r));return e},readPackedSVarint:function(e){if(this.type!==i.Bytes)return e.push(this.readSVarint());var r=a(this);for(e=e||[];this.pos<r;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==i.Bytes)return e.push(this.readBoolean());var r=a(this);for(e=e||[];this.pos<r;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==i.Bytes)return e.push(this.readFloat());var r=a(this);for(e=e||[];this.pos<r;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==i.Bytes)return e.push(this.readDouble());var r=a(this);for(e=e||[];this.pos<r;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==i.Bytes)return e.push(this.readFixed32());var r=a(this);for(e=e||[];this.pos<r;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==i.Bytes)return e.push(this.readSFixed32());var r=a(this);for(e=e||[];this.pos<r;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==i.Bytes)return e.push(this.readFixed64());var r=a(this);for(e=e||[];this.pos<r;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==i.Bytes)return e.push(this.readSFixed64());var r=a(this);for(e=e||[];this.pos<r;)e.push(this.readSFixed64());return e},skip:function(e){var r=7&e;if(r===i.Varint)for(;this.buf[this.pos++]>127;);else if(r===i.Bytes)this.pos=this.readVarint()+this.pos;else if(r===i.Fixed32)this.pos+=4;else{if(r!==i.Fixed64)throw Error("Unimplemented type: "+r);this.pos+=8}},writeTag:function(e,i){this.writeVarint(e<<3|i)},realloc:function(e){for(var i=this.length||16;i<this.pos+e;)i*=2;if(i!==this.length){var r=new Uint8Array(i);r.set(this.buf),this.buf=r,this.length=i}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),g(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),g(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),g(this.buf,-1&e,this.pos),g(this.buf,Math.floor(23283064365386963e-26*e),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),g(this.buf,-1&e,this.pos),g(this.buf,Math.floor(23283064365386963e-26*e),this.pos+4),this.pos+=8},writeVarint:function(e){(e=+e||0)>0xfffffff||e<0?function(e,i){var r,a,n,s,l;if(e>=0?(r=e%0x100000000|0,a=e/0x100000000|0):(a=~(-e/0x100000000),0xffffffff^(r=~(-e%0x100000000))?r=r+1|0:(r=0,a=a+1|0)),e>=0xffffffffffffffff||e<-0xffffffffffffffff)throw Error("Given varint doesn't fit into 10 bytes");i.realloc(10),n=r,i.buf[i.pos++]=127&n|128,n>>>=7,i.buf[i.pos++]=127&n|128,n>>>=7,i.buf[i.pos++]=127&n|128,n>>>=7,i.buf[i.pos++]=127&n|128,i.buf[i.pos]=127&(n>>>=7),l=(7&(s=a))<<4,i.buf[i.pos++]|=l|128*!!(s>>>=3),s&&(i.buf[i.pos++]=127&s|128*!!(s>>>=7),s&&(i.buf[i.pos++]=127&s|128*!!(s>>>=7),s&&(i.buf[i.pos++]=127&s|128*!!(s>>>=7),s&&(i.buf[i.pos++]=127&s|128*!!(s>>>=7),s&&(i.buf[i.pos++]=127&s)))))}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|128*(e>127),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|128*(e>127),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|128*(e>127),e<=127||(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<0?-(2*e)-1:2*e)},writeBoolean:function(e){this.writeVarint(!!e)},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var i=this.pos;this.pos=function(e,i,r){for(var a,n,s=0;s<i.length;s++){if((a=i.charCodeAt(s))>55295&&a<57344){if(!n){a>56319||s+1===i.length?(e[r++]=239,e[r++]=191,e[r++]=189):n=a;continue}if(a<56320){e[r++]=239,e[r++]=191,e[r++]=189,n=a;continue}a=n-55296<<10|a-56320|65536,n=null}else n&&(e[r++]=239,e[r++]=191,e[r++]=189,n=null);a<128?e[r++]=a:(a<2048?e[r++]=a>>6|192:(a<65536?e[r++]=a>>12|224:(e[r++]=a>>18|240,e[r++]=a>>12&63|128),e[r++]=a>>6&63|128),e[r++]=63&a|128)}return r}(this.buf,e,this.pos);var r=this.pos-i;r>=128&&n(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),e.write(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),e.write(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var i=e.length;this.writeVarint(i),this.realloc(i);for(var r=0;r<i;r++)this.buf[this.pos++]=e[r]},writeRawMessage:function(e,i){this.pos++;var r=this.pos;e(i,this);var a=this.pos-r;a>=128&&n(r,a,this),this.pos=r-1,this.writeVarint(a),this.pos+=a},writeMessage:function(e,r,a){this.writeTag(e,i.Bytes),this.writeRawMessage(r,a)},writePackedVarint:function(e,i){i.length&&this.writeMessage(e,s,i)},writePackedSVarint:function(e,i){i.length&&this.writeMessage(e,l,i)},writePackedBoolean:function(e,i){i.length&&this.writeMessage(e,c,i)},writePackedFloat:function(e,i){i.length&&this.writeMessage(e,h,i)},writePackedDouble:function(e,i){i.length&&this.writeMessage(e,u,i)},writePackedFixed32:function(e,i){i.length&&this.writeMessage(e,d,i)},writePackedSFixed32:function(e,i){i.length&&this.writeMessage(e,p,i)},writePackedFixed64:function(e,i){i.length&&this.writeMessage(e,f,i)},writePackedSFixed64:function(e,i){i.length&&this.writeMessage(e,m,i)},writeBytesField:function(e,r){this.writeTag(e,i.Bytes),this.writeBytes(r)},writeFixed32Field:function(e,r){this.writeTag(e,i.Fixed32),this.writeFixed32(r)},writeSFixed32Field:function(e,r){this.writeTag(e,i.Fixed32),this.writeSFixed32(r)},writeFixed64Field:function(e,r){this.writeTag(e,i.Fixed64),this.writeFixed64
212(r)},writeSFixed64Field:function(e,r){this.writeTag(e,i.Fixed64),this.writeSFixed64(r)},writeVarintField:function(e,r){this.writeTag(e,i.Varint),this.writeVarint(r)},writeSVarintField:function(e,r){this.writeTag(e,i.Varint),this.writeSVarint(r)},writeStringField:function(e,r){this.writeTag(e,i.Bytes),this.writeString(r)},writeFloatField:function(e,r){this.writeTag(e,i.Fixed32),this.writeFloat(r)},writeDoubleField:function(e,r){this.writeTag(e,i.Fixed64),this.writeDouble(r)},writeBooleanField:function(e,i){this.writeVarintField(e,!!i)}},hH}var hJ=W(hY());function hK(e,i,r){i.glyphs=[],1===e&&r.readMessage(hQ,i)}function hQ(e,i,r){if(3===e){let{id:e,bitmap:a,width:n,height:s,left:l,top:h,advance:u}=r.readMessage(h0,{});i.glyphs.push({id:e,bitmap:new sY({width:n+6,height:s+6},a),metrics:{width:n,height:s,left:l,top:h,advance:u}})}else 4===e?i.ascender=r.readSVarint():5===e&&(i.descender=r.readSVarint())}function h0(e,i,r){1===e?i.id=r.readVarint():2===e?i.bitmap=r.readBytes():3===e?i.width=r.readVarint():4===e?i.height=r.readVarint():5===e?i.left=r.readSVarint():6===e?i.top=r.readSVarint():7===e&&(i.advance=r.readVarint())}let h1={horizontal:1,vertical:2,horizontalOnly:3};class h2{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,i){let r=new h2;return r.scale=e||1,r.fontStack=i,r}static forImage(e){let i=new h2;return i.imageName=e,i}}class h3{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,i){let r=new h3;for(let a=0;a<e.sections.length;a++){let n=e.sections[a];n.image?r.addImageSection(n):r.addTextSection(n,i)}return r}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSections(){return this.sections}getSectionIndex(e){return this.sectionIndex[e]}getCodePoint(e){return this.text.codePointAt(e)}verticalizePunctuation(e){this.text=function(e,i){let r="";for(let a=0;a<e.length;a++){let n=e.charCodeAt(a+1)||null,s=e.charCodeAt(a-1)||null;r+=!i&&(n&&aw(n)&&!hW[e[a+1]]||s&&aw(s)&&!hW[e[a-1]])||!hW[e[a]]?e[a]:hW[e[a]]}return r}(this.text,e)}trim(){let e=0;for(let i=0;i<this.text.length&&h5[this.text.charCodeAt(i)];i++)e++;let i=this.text.length;for(let r=this.text.length-1;r>=0&&r>=e&&h5[this.text.charCodeAt(r)];r--)i--;this.text=this.text.substring(e,i),this.sectionIndex=this.sectionIndex.slice(e,i)}substring(e,i){let r=new h3;return r.text=this.text.substring(e,i),r.sectionIndex=this.sectionIndex.slice(e,i),r.sections=this.sections,r}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,i)=>Math.max(e,this.sections[i].scale),0)}addTextSection(e,i){this.text+=e.text,this.sections.push(h2.forText(e.scale,e.fontStack||i));let r=this.sections.length-1;for(let i=0;i<e.text.length;++i)this.sectionIndex.push(r)}addImageSection(e){let i=e.image?e.image.namePrimary:"";if(0===i.length)return void eX("Can't add FormattedSection with an empty image.");let r=this.getNextImageSectionCharCode();r?(this.text+=String.fromCodePoint(r),this.sections.push(h2.forImage(i)),this.sectionIndex.push(this.sections.length-1)):eX("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function h4(e,i,r,a,n,s,l,h,u,c,d,p,f,m,_){let g=h3.fromFeature(e,n);p===h1.vertical&&g.verticalizePunctuation(f);let y=[],x=function(e,i,r,a,n,s){if(!e)return[];let l=[],h=function(e,i,r,a,n,s){let l=0;for(let r=0;r<e.length();r++){let h=e.getSection(r);l+=h8(e.getCodePoint(r),h,a,n,i,s)}return l/Math.max(1,Math.ceil(l/r))}(e,i,r,a,n,s),u=e.text.indexOf("â")>=0,c=0;for(let r=0;r<e.length();r++){let d=e.getSection(r),p=e.getCodePoint(r);if(h5[p]||(c+=h8(p,d,a,n,i,s)),r<e.length()-1){let i=!(p<11904||!(ax["Bopomofo Extended"](p)||ax.Bopomofo(p)||ax["CJK Compatibility Forms"](p)||ax["CJK Compatibility Ideographs"](p)||ax["CJK Compatibility"](p)||ax["CJK Radicals Supplement"](p)||ax["CJK Strokes"](p)||ax["CJK Symbols and Punctuation"](p)||ax["CJK Unified Ideographs Extension A"](p)||ax["CJK Unified Ideographs"](p)||ax["Enclosed CJK Letters and Months"](p)||ax["Halfwidth and Fullwidth Forms"](p)||ax.Hiragana(p)||ax["Ideographic Description Characters"](p)||ax["Kangxi Radicals"](p)||ax["Katakana Phonet
212ic Extensions"](p)||ax.Katakana(p)||ax["Vertical Forms"](p)||ax["Yi Radicals"](p)||ax["Yi Syllables"](p)));(h6[p]||i||d.imageName)&&l.push(h7(r+1,c,h,l,function(e,i,r){let a=0;return 10===e&&(a-=1e4),r&&(a+=150),40!==e&&65288!==e||(a+=50),41!==i&&65289!==i||(a+=50),a}(p,e.getCodePoint(r+1),i&&u),!1))}}return function e(i){return i?e(i.priorBreak).concat(i.index):[]}(h7(e.length(),c,h,l,0,!0))}(g,c,s,i,a,m),{processBidirectionalText:v,processStyledBidirectionalText:b}=aD;if(v&&1===g.sections.length)for(let e of v(g.toString(),x)){let i=new h3;i.text=e,i.sections=g.sections;for(let r=0;r<e.length;r++)i.sectionIndex.push(0);y.push(i)}else if(b)for(let e of b(g.text,g.sectionIndex,x)){let i=new h3;i.text=e[0],i.sectionIndex=e[1],i.sections=g.sections,y.push(i)}else y=function(e,i){let r=[],a=e.text,n=0;for(let a of i)r.push(e.substring(n,a)),n=a;return n<a.length&&r.push(e.substring(n,a.length)),r}(g,x);let w=[],T={positionedLines:w,text:g.toString(),top:d[1],bottom:d[1],left:d[0],right:d[0],writingMode:p,iconsInText:!1,verticalizable:!1,hasBaseline:!1};return function(e,i,r,a,n,s,l,h,u,c,d,p){let f=0,m=0,_=0,g="right"===h?1:.5*("left"!==h),y=!1;for(let e of n){for(let r of e.getSections()){if(r.imageName)continue;let e=i[r.fontStack];if(e&&!(y=void 0!==e.ascender&&void 0!==e.descender))break}if(!y)break}let x=0;for(let l of n){l.trim();let n=l.getMaxScale(),h=(n-1)*24,v={positionedGlyphs:[],lineOffset:0};e.positionedLines[x]=v;let b=v.positionedGlyphs,w=0;if(!l.length()){m+=s,++x;continue}let T=0,S=0;for(let s=0;s<l.length();s++){let h=l.getSection(s),_=l.getSectionIndex(s),g=l.getCodePoint(s),x=h.scale,v=null,M=null,E=null,A=24,I=0,C=!(u===h1.horizontal||!d&&!ab(g)||d&&(h5[g]||ax.Arabic(g)||ax["Arabic Supplement"](g)||ax["Arabic Extended-A"](g)||ax["Arabic Presentation Forms-A"](g)||ax["Arabic Presentation Forms-B"](g)));if(h.imageName){let i=a[h.imageName];if(!i)continue;E=h.imageName,e.iconsInText=e.iconsInText||!0,M=i.paddedRect;let r=i.displaySize;x=24*x/p,v={width:r[0],height:r[1],left:0,top:-3,advance:C?r[1]:r[0],localGlyph:!1},I=y?-v.height*x:24*n-17-r[1]*x,A=v.advance;let s=(C?r[0]:r[1])*x-24*n;s>0&&s>w&&(w=s)}else{let e=r[h.fontStack];if(!e)continue;e[g]&&(M=e[g]);let a=i[h.fontStack];if(!a)continue;let s=a.glyphs[g];if(!s)continue;if(v=s.metrics,A=24*(8203!==g),y){let e=void 0!==a.ascender?Math.abs(a.ascender):0,i=void 0!==a.descender?Math.abs(a.descender):0,r=(e+i)*x;T<r&&(T=r,S=(e-i)/2*x),I=-e*x}else I=(n-x)*24-17}C?(e.verticalizable=!0,b.push({glyph:g,imageName:E,x:f,y:m+I,vertical:C,scale:x,localGlyph:v.localGlyph,fontStack:h.fontStack,sectionIndex:_,metrics:v,rect:M}),f+=A*x+c):(b.push({glyph:g,imageName:E,x:f,y:m+I,vertical:C,scale:x,localGlyph:v.localGlyph,fontStack:h.fontStack,sectionIndex:_,metrics:v,rect:M}),f+=v.advance*x+c)}0!==b.length&&(_=Math.max(f-c,_),y?ut(b,g,w,S,s*n/2):ut(b,g,w,0,s/2)),f=0;let M=s*n+w;v.lineOffset=Math.max(w,h),m+=M,++x}let v=m,{horizontalAlign:b,verticalAlign:w}=ue(l);(function(e,i,r,a,n,s){let l=(i-r)*n,h=-s*a;for(let i of e)for(let e of i.positionedGlyphs)e.x+=l,e.y+=h})(e.positionedLines,g,b,w,_,v),e.top+=-w*v,e.bottom=e.top+v,e.left+=-b*_,e.right=e.left+_,e.hasBaseline=y}(T,i,r,a,y,l,h,u,p,c,f,_),!function(e){for(let i of e)if(0!==i.positionedGlyphs.length)return!1;return!0}(w)&&T}let h5={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},h6={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function h8(e,i,r,a,n,s){if(i.imageName){let e=a[i.imageName];return e?e.displaySize[0]*i.scale*24/s+n:0}{let a=r[i.fontStack],s=a&&a.glyphs[e];return s?s.metrics.advance*i.scale+n:0}}function h9(e,i,r,a){let n=Math.pow(e-i,2);return a?e<i?n/2:2*n:n+Math.abs(r)*r}function h7(e,i,r,a,n,s){let l=null,h=h9(i,r,n,s);for(let e of a){let a=h9(i-e.x,r,n,s)+e.badness;a<=h&&(l=e,h=a)}return{index:e,x:i,priorBreak:l,badness:h}}function ue(e){let i=.5,r=.5;switch(e){case"right":case"top-right":case"bottom-right":i=1;break;case"left":case"top-left":case"bottom-left":i=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:i,verticalAlign:r}}function ut(e,i,r,a,n){if(!(i||r||a||n))return;let s=e.length-1,l=e[s],h=(l.x+l.metrics.advance*l.scale)*i;for(let i=0;i<=s;i++)e[i].x-=h,e[i].y+=r+a+n}function ui(e,i,r,a,n,s){let l,h,u,c,d;let p=e.imagePrimary;if(p.content){let e=p.content,i=p.pixelRatio||1;l=[e[0]/i,e[1]/i,p.displaySize[0]-e[2]/i,p.displaySize[1]-e[3]/i]}let f=i.left*s,m=i.right*s;"width"===r||"both"===r?(d=n[0]+f-a[3],u=n[0]+m+a[1]):u=(d=n[0]+(f+m-p.displaySize[0])/2)+p.displaySize[0];let _=i.top*s,g=i.bottom*s;return"height"===r||"both"===r?(h=n[1]+_-a[0],c=n[1]+g+a[2]):c=(h=n[1]+(_+g-p.displaySize[1])/2)+p.displaySize[1],{imagePrimary:p,imageSecondary:void 0,top:h,right:u,bottom:c,left:d,collisionPadding:l}}class ur extends eA{constructor(e,i,r,a,n){super(e,i),this.angle=a,this.z=r,void 0!==n&&(this.segment=n)}clone(){return new ur(this.x,this.y,this.z,this.angle,this.segment)}}function ua(e,i,r,a,n){if(void 0===i.segment)return!0;let s=i,l=i.segment+1,h=0;for(;h>-r/2;){if(--l<0)return!1;h-=e[l].dist(s),s=e[l]}h+=e[l].dist(e[l+1]),l++;let u=[],c=0;for(;h<r/2;){let i=e[l],r=e[l+1];if(!r)return!1;let s=e[l-1].angleTo(i)-i.angleTo(r);for(s=Math.abs((s+3*Math.PI)%(2*Math.PI)-Math.PI),u.push({distance:h,angleDelta:s}),c+=s;h-u[0].distance>a;)c-=u.shift().angleDelta;if(c>n)return!1;l++,h+=i.dist(r)}return!0}function un(e){let i=0;for(let r=0;r<e.length-1;r++)i+=e[r].dist(e[r+1]);return i}function uo(e,i){return Math.max(e?e.right-e.left:0,i?i.right-i.left:0)}function us(e,i,r,a,n){let s=[];for(let l=0;l<e.length;l++){let h;let u=e[l];for(let e=0;e<u.length-1;e++){let l=u[e],c=u[e+1];l.x<i&&c.x<i||(l.x<i?l=new eA(i,l.y+(i-l.x)/(c.x-l.x)*(c.y-l.y))._round():c.x<i&&(c=new eA(i,l.y+(i-l.x)/(c.x-l.x)*(c.y-l.y))._round()),l.y<r&&c.y<r||(l.y<r?l=new eA(l.x+(r-l.y)/(c.y-l.y)*(c.x-l.x),r)._round():c.y<r&&(c=new eA(l.x+(r-l.y)/(c.y-l.y)*(c.x-l.x),r)._round()),l.x>=a&&c.x>=a||(l.x>=a?l=new eA(a,l.y+(a-l.x)/(c.x-l.x)*(c.y-l.y))._round():c.x>=a&&(c=new eA(a,l.y+(a-l.x)/(c.x-l.x)*(c.y-l.y))._round()),l.y>=n&&c.y>=n||(l.y>=n?l=new eA(l.x+(n-l.y)/(c.y-l.y)*(c.x-l.x),n)._round():c.y>=n&&(c=new eA(l.x+(n-l.y)/(c.y-l.y)*(c.x-l.x),n)._round()),h&&l.equals(h[h.length-1])||(h=[l],s.push(h)),h.push(c)))))}}return s}function ul(e){let i=0,r=0;for(let a of e)i+=a.w*a.h,r=Math.max(r,a.w);e.sort((e,i)=>i.h-e.h);let a=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(i/.95)),r),h:1/0}],n=0,s=0;for(let i of e)for(let e=a.length-1;e>=0;e--){let r=a[e];if(!(i.w>r.w||i.h>
212r.h)){if(i.x=r.x,i.y=r.y,s=Math.max(s,i.y+i.h),n=Math.max(n,i.x+i.w),i.w===r.w&&i.h===r.h){let i=a.pop();e<a.length&&(a[e]=i)}else i.h===r.h?(r.x+=i.w,r.w-=i.w):(i.w===r.w||a.push({x:r.x+i.w,y:r.y,w:r.w-i.w,h:i.h}),r.y+=i.h,r.h-=i.h);break}}return{w:n,h:s,fill:i/(n*s)||0}}af(ur,"Anchor");class uh{constructor(e,{pixelRatio:i,version:r,stretchX:a,stretchY:n,content:s},l){this.paddedRect=e,this.pixelRatio=i,this.stretchX=a,this.stretchY=n,this.content=s,this.version=r,this.padding=l}get tl(){return[this.paddedRect.x+this.padding,this.paddedRect.y+this.padding]}get br(){return[this.paddedRect.x+this.paddedRect.w-this.padding,this.paddedRect.y+this.paddedRect.h-this.padding]}get displaySize(){return[(this.paddedRect.w-2*this.padding)/this.pixelRatio,(this.paddedRect.h-2*this.padding)/this.pixelRatio]}}class uu{constructor(e,i,r){let a={},n={};this.haveRenderCallbacks=[];let s=[];this.addImages(e,a,1,s),this.addImages(i,n,2,s);let{w:l,h:h}=ul(s),u=new sJ({width:l||1,height:h||1});for(let i in e){let n=e[i],s=a[i].paddedRect;sJ.copy(n.data,u,{x:0,y:0},{x:s.x+1,y:s.y+1},n.data,r,n.sdf)}for(let e in i){let a=i[e],s=n[e].paddedRect,l=n[e].padding,h=s.x+l,c=s.y+l,d=a.data.width,p=a.data.height;l=l>1?l-1:l,sJ.copy(a.data,u,{x:0,y:0},{x:h,y:c},a.data,r),sJ.copy(a.data,u,{x:0,y:p-l},{x:h,y:c-l},{width:d,height:l},r),sJ.copy(a.data,u,{x:0,y:0},{x:h,y:c+p},{width:d,height:l},r),sJ.copy(a.data,u,{x:d-l,y:0},{x:h-l,y:c},{width:l,height:p},r),sJ.copy(a.data,u,{x:0,y:0},{x:h+d,y:c},{width:l,height:p},r),sJ.copy(a.data,u,{x:d-l,y:p-l},{x:h-l,y:c-l},{width:l,height:l},r),sJ.copy(a.data,u,{x:0,y:p-l},{x:h+d,y:c-l},{width:l,height:l},r),sJ.copy(a.data,u,{x:0,y:0},{x:h+d,y:c+p},{width:l,height:l},r),sJ.copy(a.data,u,{x:d-l,y:0},{x:h-l,y:c+p},{width:l,height:l},r)}this.image=u,this.iconPositions=a,this.patternPositions=n}addImages(e,i,r,a){for(let n in e){let s=e[n],l={x:0,y:0,w:s.data.width+2*r,h:s.data.height+2*r};a.push(l),i[n]=new uh(l,s,r),s.hasRenderCallback&&this.haveRenderCallbacks.push(n)}}patchUpdatedImages(e,i,r){for(let a in this.haveRenderCallbacks=this.haveRenderCallbacks.filter(i=>e.hasImage(i,r)),e.dispatchRenderCallbacks(this.haveRenderCallbacks,r),e.getUpdatedImages(r))this.patchUpdatedImage(this.iconPositions[a],e.getImage(a,r),i),this.patchUpdatedImage(this.patternPositions[a],e.getImage(a,r),i)}patchUpdatedImage(e,i,r){if(!e||!i||e.version===i.version)return;e.version=i.version;let[a,n]=e.tl;r.update(i.data,{position:{x:a,y:n}})}}function uc(e,i,r,a,n,s,l,h,u){for(let c=i;c<i+a;c++)ud(e,r*s+c,s,n,l,h,u);for(let c=r;c<r+n;c++)ud(e,c*s+i,1,a,l,h,u)}function ud(e,i,r,a,n,s,l){s[0]=0,l[0]=-1e20,l[1]=1e20,n[0]=e[i];for(let h=1,u=0,c=0;h<a;h++){n[h]=e[i+h*r];let a=h*h;do{let e=s[u];c=(n[h]-n[e]+a-e*e)/(h-e)/2}while(c<=l[u]&&--u>-1)s[++u]=h,l[u]=c,l[u+1]=1e20}for(let h=0,u=0;h<a;h++){for(;l[u+1]<h;)u++;let a=s[u],c=h-a;e[i+h*r]=n[a]+c*c}}af(uh,"ImagePosition"),af(uu,"ImageAtlas");let up={none:0,ideographs:1,all:2};class uf{constructor(e,i,r){this.requestManager=e,this.localGlyphMode=i,this.localFontFamily=r,this.urls={},this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}setURL(e,i){this.urls[i]=e}getGlyphs(e,i,r){let a=[],n=this.urls[i]||e6.GLYPHS_URL;for(let i in e)for(let r of e[i])a.push({stack:i,id:r});eF(a,({stack:e,id:i},r)=>{let a=this.entries[e];a||(a=this.entries[e]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let s=a.glyphs[i];if(void 0!==s)return void r(null,{stack:e,id:i,glyph:s});if(s=this._tinySDF(a,e,i))return a.glyphs[i]=s,void r(null,{stack:e,id:i,glyph:s});let l=Math.floor(i/256);if(256*l>65535)return eX("glyphs > 65535 not supported"),void r(null,{stack:e,id:i,glyph:s});if(a.ranges[l])return void r(null,{stack:e,id:i,glyph:s});let h=a.requests[l];h||(h=a.requests[l]=[],uf.loadGlyphRange(e,l,n,this.requestManager,(e,i)=>{if(i){for(let e in a.ascender=i.ascender,a.descender=i.descender,i.glyphs)this._doesCharSupportLocalGlyph(+e)||(a.glyphs[+e]=i.glyphs[+e]);a.ranges[l]=!0}for(let r of h)r(e,i);delete a.requests[l]})),h.push((a,n)=>{a?r(a):n&&r(null,{stack:e,id:i,glyph:n.glyphs[i]||null})})},(e,i)=>{if(e)r(e);else if(i){let e={};for(let{stack:r,id:a,glyph:n}of i)void 0===e[r]&&(e[r]={}),void 0===e[r].glyphs&&(e[r].glyphs={}),e[r].glyphs[a]=n&&{id:n.id,bitmap:n.bitmap.clone(),metrics:n.metrics},e[r].ascender=this.entries[r].ascender,e[r].descender=this.entries[r].descender;r(null,e)}})}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==up.none&&(this.localGlyphMode===up.all?!!this.localFontFamily:!!this.localFontFamily&&
212(ax["CJK Unified Ideographs"](e)||ax["Hangul Syllables"](e)||ax.Hiragana(e)||ax.Katakana(e)||ax["CJK Symbols and Punctuation"](e)||ax["CJK Unified Ideographs Extension A"](e)||ax["CJK Unified Ideographs Extension B"](e)||ax.Osage(e)))}_tinySDF(e,i,r){let a=this.localFontFamily;if(!a||!this._doesCharSupportLocalGlyph(r))return;let n=e.tinySDF;if(!n){let r="400";/bold/i.test(i)?r="900":/medium/i.test(i)?r="500":/light/i.test(i)&&(r="200"),(n=e.tinySDF=new uf.TinySDF({fontFamily:a,fontWeight:r,fontSize:48,buffer:6,radius:16})).fontWeight=r}if(this.localGlyphs[n.fontWeight][r])return this.localGlyphs[n.fontWeight][r];let s=String.fromCodePoint(r),{data:l,width:h,height:u,glyphWidth:c,glyphHeight:d,glyphLeft:p,glyphTop:f,glyphAdvance:m}=n.draw(s);return this.localGlyphs[n.fontWeight][r]={id:r,bitmap:new sY({width:h,height:u},l),metrics:{width:c/2,height:d/2,left:p/2,top:f/2-27,advance:m/2,localGlyph:!0}}}}function um(e,i,r,a,n=1){let s=[],l=e.imagePrimary,h=l.pixelRatio,u=l.paddedRect.w-2,c=l.paddedRect.h-2,d=(e.right-e.left)*n,p=(e.bottom-e.top)*n,f=l.stretchX||[[0,u]],m=l.stretchY||[[0,c]],_=(e,i)=>e+i[1]-i[0],g=f.reduce(_,0),y=m.reduce(_,0),x=u-g,v=c-y,b=0,w=g,T=0,S=y,M=0,E=x,A=0,I=v;if(l.content&&a){let e=l.content;b=u_(f,0,e[0]),T=u_(m,0,e[1]),w=u_(f,e[0],e[2]),S=u_(m,e[1],e[3]),M=e[0]-b,A=e[1]-T,E=e[2]-e[0]-w,I=e[3]-e[1]-S}let C=(a,s,u,c)=>{var f,m,_,x;let v=(a.stretch-b)/w*d+e.left*n,C=(f=a.fixed-M,f-E*a.stretch/g),P=(s.stretch-T)/S*p+e.top*n,L=(m=s.fixed-A,m-I*s.stretch/y),k=(u.stretch-b)/w*d+e.left*n,R=(_=u.fixed-M,_-E*u.stretch/g),z=(c.stretch-T)/S*p+e.top*n,D=(x=c.fixed-A,x-I*c.stretch/y),O=new eA(v,P),B=new eA(k,P),F=new eA(k,z),N=new eA(v,z),V=new eA(C/h,L/h),U=new eA(R/h,D/h),j=i*Math.PI/180;if(j){let e=Math.sin(j),i=Math.cos(j),r=[i,-e,e,i];O._matMult(r),B._matMult(r),N._matMult(r),F._matMult(r)}let G=a.stretch+a.fixed,q=u.stretch+u.fixed,W=s.stretch+s.fixed,$=c.stretch+c.fixed,H=e.imageSecondary;return{tl:O,tr:B,bl:N,br:F,texPrimary:{x:l.paddedRect.x+1+G,y:l.paddedRect.y+1+W,w:q-G,h:$-W},texSecondary:H?{x:H.paddedRect.x+1+G,y:H.paddedRect.y+1+W,w:q-G,h:$-W}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:V,pixelOffsetBR:U,minFontScaleX:E/h/d,minFontScaleY:I/h/p,isSDF:r}};if(a&&(l.stretchX||l.stretchY)){let e=ug(f,x,g),i=ug(m,v,y);for(let r=0;r<e.length-1;r++){let a=e[r],n=e[r+1];for(let e=0;e<i.length-1;e++)s.push(C(a,i[e],n,i[e+1]))}}else s.push(C({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:u+1},{fixed:0,stretch:c+1}));return s}function u_(e,i,r){let a=0;for(let n of e)a+=Math.max(i,Math.min(r,n[1]))-Math.max(i,Math.min(r,n[0]));return a}function ug(e,i,r){let a=[{fixed:-1,stretch:0}];for(let[i,r]of e){let e=a[a.length-1];a.push({fixed:i-e.stretch,stretch:e.stretch}),a.push({fixed:i-e.stretch,stretch:e.stretch+(r-i)})}return a.push({fixed:i+1,stretch:r}),a}function uy(e,i){return i.max-e.max}uf.loadGlyphRange=function(e,i,r,a,n){let s=256*i;tb(a.transformRequest(a.normalizeGlyphsURL(r).replace("{fontstack}",e).replace("{range}",`${s}-${s+255}`),tg.Glyphs),(e,i)=>{if(e)n(e);else if(i){let e={},r=new hJ(i).readFields(hK,{});for(let i of r.glyphs)e[i.id]=i;n(null,{glyphs:e,ascender:r.ascender,descender:r.descender})}})},uf.TinySDF=class{constructor({fontSize:e=24,buffer:i=3,radius:r=8,cutoff:a=.25,fontFamily:n="sans-serif",fontWeight:s="normal",fontStyle:l="normal"}={}){this.buffer=i,this.cutoff=a,this.radius=r;let h=this.size=e+4*i,u=this._createCanvas(h),c=this.ctx=u.getContext("2d",{willReadFrequently:!0});c.font=`${l} ${s} ${e}px ${n}`,c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(h*h),this.gridInner=new Float64Array(h*h),this.f=new Float64Array(h),this.z=new Float64Array(h+1),this.v=new Uint16Array(h)}_createCanvas(e){let i=document.createElement("canvas");return i.width=i.height=e,i}draw(e){let{width:i,actualBoundingBoxAscent:r,actualBoundingBoxDescent:a,actualBoundingBoxLeft:n,actualBoundingBoxRight:s}=this.ctx.measureText(e),l=Math.ceil(r),h=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(s-n))),u=Math.min(this.size-this.buffer,l+Math.ceil(a)),c=h+2*this.buffer,d=u+2*this.buffer,p=Math.max(c*d,0),f=new Uint8ClampedArray(p),m={data:f,width:c,height:d,glyphWidth:h,glyphHeight:u,glyphTop:l,glyphLeft:0,glyphAdvance:i};if(0===h||0===u)return m;let{ctx:_,buffer:g,gridInner:y,gridOuter:x}=this;_.clearRect(g,g,h,u),_.fillText(e,g,g+l);let v=_.getImageData(g,g,h,u);x.fill(1e20,0,p),y.fill(0,0,p);for(let e=0;e<u;e++)for(let i=0;i<h;i++){let r=v.data[4*(e*h+i)+3]/255;if(0===r)continue;let a=(e+g)*c+i+g;if(1===r)x[a]=0,y[a]=1e20;else{let e=.5-r;x[a]=e>0?e*e:0,y[a]=e<0?e*e:0}}uc(x,0,0,c,d,c,this.f,this.v,this.z),uc(y,g,g,h,u,c,this.f,this.v,this.z);for(let e=0;e<p;e++){let i=Math.sqrt(x[e])-Math.sqrt(y[e]);f[e]=Math.round(255-255*(i/this.radius+this.cutoff))}return m}};class ux{constructor(e,i,r,a){this.p=new eA(e,i),this.h=r,this.d=function(e,i){let r=!1,a=1/0;for(let n=0;n<i.length;n++){let s=i[n];for(let i=0,n=s.length,l=n-1;i<n;l=i++){let n=s[i],h=s[l];n.y>e.y!=h.y>e.y&&e.x<(h.x-n.x)*(e.y-n.y)/(h.y-n.y)+n.x&&(r=!r),a=Math.min(a,oY(e,n,h))}}return(r?1:-1)*Math.sqrt(a)}(this.p,a),this.max=this.d+this.h*Math.SQRT2}}let uv=Number.POSITIVE_INFINITY,ub=Math.sqrt(2);function uw(e,[i,r]){let a=0,n=0;if(r===uv){i<0&&(i=0);let r=i/ub;switch(e){case"top-right":case"top-left":n=r-7;break;case"bottom-right":case"bottom-left":n=7-r;break;case"bottom":n=7-i;break;case"top":n=i-7}switch(e){case"top-right":case"bottom-right":a=-r;break;case"top-left":case"bottom-left":a=r;break;case"left":a=i;break;case"right":a=-i}}else{switch(i=Math.abs(i),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":a=-i;break;case"top-left":case"bottom-left":case"left":a=i}}return[a,n]}function uT(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 uS(e,i,r,a,n,s,l,h,u,c,d,p,f,m,_,g,y,x){let v=function(e,i,r,a,n,s,l,h){let u=[];
212if(0===i.positionedLines.length)return u;let c=a.layout.get("text-rotate").evaluate(s,{})*Math.PI/180,d=function(e){let i=e[0],r=e[1],a=i*r;return a>0?[i,-r]:a<0?[-i,r]:0===i?[r,i]:[r,-i]}(r),p=Math.abs(i.top-i.bottom);for(let e of i.positionedLines)p-=e.lineOffset;let f=i.positionedLines.length,m=p/f,_=i.top-r[1];for(let e=0;e<f;++e){let a=i.positionedLines[e];for(let s of(_=function(e,i,r,a){let n=i+e.positionedLines[a].lineOffset;return 0===a?r+n/2:r+(n+(i+e.positionedLines[a-1].lineOffset))/2}(i,m,_,e),a.positionedGlyphs)){let e,a,p,f;if(!s.rect)continue;let m=s.rect||{},g=4,y=!0,x=1,v=0;if(s.imageName){let e=l[s.imageName];if(!e)continue;if(e.sdf){eX("SDF images are not supported in formatted text and will be ignored.");continue}y=!1,g=1/(x=e.pixelRatio)}let b=(n||h)&&s.vertical,w=s.metrics.advance*s.scale/2,T=s.metrics,S=s.rect;if(null===S)continue;h&&i.verticalizable&&(v=s.imageName?w-s.metrics.width*s.scale/2:0);let M=n?[s.x+w,s.y]:[0,0],E=[0,0],A=[0,0],I=!1;n||(b?(A=[s.x+w+d[0],s.y+d[1]-v],I=!0):E=[s.x+w+r[0],s.y+r[1]-v]);let C=S.w*s.scale/(x*(s.localGlyph?2:1)),P=S.h*s.scale/(x*(s.localGlyph?2:1));if(b){let i=s.y-_,r=new eA(-w,w-i),n=-Math.PI/2,l=new eA(...A);(e=new eA(-w+E[0],E[1]))._rotateAround(n,r)._add(l),e.x+=-i+w,e.y-=(T.left-g)*s.scale;let h=s.imageName?T.advance*s.scale:24*s.scale,u=String.fromCodePoint(s.glyph);"︶"===u||"ï¹"===u||"︸"===u||"ï¹"===u||"ï¹"===u||"︾"===u||"︼"===u||"︺"===u||"ï¸"===u||"ï¹"===u||"ï¸"===u||"ï¸"===u||"ï¸"===u||"ï½"===u||"ï¿£"===u||"ï¸"===u||"ï¸"===u?e.x+=(1-g)*s.scale:"︵"===u||"ï¹"===u||"︷"===u||"ï¹"===u||"ï¹"===u||"︽"===u||"︻"===u||"︹"===u||"ï¸"===u||"︿"===u?e.x+=h-T.height*s.scale+(-g-1)*s.scale:e.x+=s.imageName||T.width+2*g===S.w&&T.height+2*g===S.h?(h-P)/2:(h-(T.height+2*g)*s.scale)/2,a=new eA(e.x,e.y-C),p=new eA(e.x+P,e.y),f=new eA(e.x+P,e.y-C)}else{let i=(T.left-g)*s.scale-w+E[0],r=(-T.top-g)*s.scale+E[1],n=i+C,l=r+P;e=new eA(i,r),a=new eA(n,r),p=new eA(i,l),f=new eA(n,l)}if(c){let i;i=n?new eA(0,0):I?new eA(d[0],d[1]):new eA(r[0],r[1]),e._rotateAround(c,i),a._rotateAround(c,i),p._rotateAround(c,i),f._rotateAround(c,i)}let L=new eA(0,0),k=new eA(0,0);u.push({tl:e,tr:a,bl:p,br:f,texPrimary:m,texSecondary:void 0,writingMode:i.writingMode,glyphOffset:M,sectionIndex:s.sectionIndex,isSDF:y,pixelOffsetTL:L,pixelOffsetBR:k,minFontScaleX:0,minFontScaleY:0})}}return u}(0,a,u,s,l,h,n,e.allowVerticalPlacement),b=e.textSizeData,w=null;for(let a of("source"===b.kind?(w=[128*s.layout.get("text-size").evaluate(h,{},y)*_.textScaleFactor])[0]>32640&&eX(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`):"composite"===b.kind&&((w=[128*_.compositeTextSizes[0].evaluate(h,{},y)*_.textScaleFactor,128*_.compositeTextSizes[1].evaluate(h,{},y)*_.textScaleFactor])[0]>32640||w[1]>32640)&&eX(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`),e.addSymbols(e.text,v,w,u,l,h,d,i,r,c.lineStartIndex,c.lineLength,m,g,y,x,!1),p))f[a]=e.text.placedSymbolArray.length-1;return 4*v.length}function uM(e){for(let i in e)return e[i];return null}function uE(e,i,r,a,n,s,l,h,u,c){let d=l.top,p=l.bottom,f=l.left,m=l.right,_=l.collisionPadding;if(_&&(f-=_[0],d-=_[1],m+=_[2],p+=_[3]),u){let e=new eA(f,d),i=new eA(m,d),r=new eA(f,p),a=new eA(m,p),n=u*eC,s=new eA(0,0);c&&(s=new eA(c[0],c[1])),e._rotateAround(n,s),i._rotateAround(n,s),r._rotateAround(n,s),a._rotateAround(n,s),f=Math.min(e.x,i.x,r.x,a.x),m=Math.max(e.x,i.x,r.x,a.x),d=Math.min(e.y,i.y,r.y,a.y),p=Math.max(e.y,i.y,r.y,a.y)}return e.emplaceBack(i.x,i.y,i.z,r.x,r.y,f,d,m,p,h,a,n,s),e.length-1}function uA(e){e.collisionPadding&&(e.top-=e.collisionPadding[1],e.bottom+=e.collisionPadding[3]);let i=e.bottom-e.top;return i>0?Math.max(10,i):null}function uI(e,i){let r=e.fovAboveCenter,a=e.elevation?e.elevation.getMinElevationBelowMSL()*i:0,n=(e._camera.position[2]*e.worldSize-a)/Math.cos(e._pitch),s=Math.sin(r)*n/Math.sin(Math.max(Math.PI/2-e._pitch-r,.01)),l=Math.sin(e._pitch)*s+n,h=n*(1/e._horizonShift);return e.elevation&&0!==e.elevation.exaggeration()||(l*=1+Math.max(e.zoom-17,0)),Math.min(1.01*l,h)}function uC(e,i){if(!i.isReprojectedInTileSpace)return{scale:1<<e.z,x:e.x,y:e.y,x2:e.x+1,y2:e.y+1,projection:i};let r=Math.pow(2,-e.z),a=e.x*r,n=(e.x+1)*r,s=e.y*r,l=(e.y+1)*r,h=ok(a),u=ok(n),c=oR(s),d=oR(l),p=i.project(h,c),f=i.project(u,c),m=i.project(u,d),_=i.project(h,d),g=Math.min(p.x,f.x,m.x,_.x),y=Math.min(p.y,f.y,m.y,_.y),x=Math.max(p.x,f.x,m.x,_.x),v=Math.max(p.y,f.y,m.y,_.y),b=r/16;function w(e,r,a,n,s,l){let h=(a+s)/2,u=(n+l)/2,c=i.project(ok(h),oR(u)),d=Math.max(0,g-c.x,y-c.y,c.x-x,c.y-v);
212g=Math.min(g,c.x),x=Math.max(x,c.x),y=Math.min(y,c.y),v=Math.max(v,c.y),d>b&&(w(e,c,a,n,h,u),w(c,r,h,u,s,l))}w(p,f,a,s,n,s),w(f,m,n,s,n,l),w(m,_,n,l,a,l),w(_,p,a,l,a,s),g-=b,y-=b,x+=b,v+=b;let T=1/Math.max(x-g,v-y);return{scale:T,x:g*T,y:y*T,x2:x*T,y2:v*T,projection:i}}function uP(e,{x:i,y:r},a=0){return new eA(((i-a)*e.scale-e.x)*8192,(r*e.scale-e.y)*8192)}let uL=eS.mat4.identity(new Float32Array(16));class uk{constructor(e){this.spec=e,this.name=e.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(e,i){return{x:0,y:0,z:0}}unproject(e,i){return new oA(0,0)}projectTilePoint(e,i,r){return{x:e,y:i,z:0}}locationPoint(e,i,r=!0){return e._coordinatePoint(e.locationCoordinate(i),r)}pixelsPerMeter(e,i){return 1/oC(e)*i}pixelSpaceConversion(e,i,r){return 1}farthestPixelDistance(e){return uI(e,e.pixelsPerMeter)}pointCoordinate(e,i,r,a){let n=new eA(i,Math.max(e.horizonLineFromTop(!1),r));return e.rayIntersectionCoordinate(e.pointRayIntersection(n,a))}pointCoordinate3D(e,i,r){let a=new eA(i,r);if(e.elevation)return e.elevation.pointCoordinate(a);{let i=this.pointCoordinate(e,a.x,a.y,0);return[i.x,i.y,i.z]}}isPointAboveHorizon(e,i){if(e.elevation&&e.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(e,i.x,i.y);let r=e.horizonLineFromTop();return i.y<r}createInversionMatrix(e,i){return uL}createTileMatrix(e,i,r){let a,n,s;let l=r.canonical,h=eS.mat4.identity(new Float64Array(16));if(this.isReprojectedInTileSpace){let u=uC(l,this);a=1,n=u.x+r.wrap*u.scale,s=u.y,eS.mat4.scale(h,h,[a/u.scale,a/u.scale,e.pixelsPerMeter/i])}else a=i/e.zoomScale(l.z),n=(l.x+Math.pow(2,l.z)*r.wrap)*a,s=l.y*a;return eS.mat4.translate(h,h,[n,s,0]),eS.mat4.scale(h,h,[a/8192,a/8192,1]),h}upVector(e,i,r){return[0,0,1]}upVectorScale(e,i,r){return{metersToTile:1}}}class uR extends uk{constructor(e){super(e),this.range=[4,7],this.center=e.center||[-96,37.5];let[i,r]=this.parallels=e.parallels||[29.5,45.5],a=Math.sin(i*eC);this.n=(a+Math.sin(r*eC))/2,this.c=1+a*(2*this.n-a),this.r0=Math.sqrt(this.c)/this.n}project(e,i){let{n:r,c:a,r0:n}=this,s=(e-this.center[0])*eC,l=Math.sqrt(a-2*r*Math.sin(i*eC))/r;return{x:l*Math.sin(s*r),y:l*Math.cos(s*r)-n,z:0}}unproject(e,i){let{n:r,c:a,r0:n}=this,s=n+i,l=Math.atan2(e,Math.abs(s))*Math.sign(s);s*r<0&&(l-=Math.PI*Math.sign(e)*Math.sign(s));let h=this.center[0]*eC*r,u=eD((l=eB(l,-Math.PI-h,Math.PI-h))/r*eP+this.center[0],-180,180),c=Math.asin(eD((a-(e*e+s*s)*r*r)/(2*r),-1,1));return new oA(u,eD(c*eP,-85.051129,85.051129))}}let uz=Math.sqrt(3)/2;class uD extends uk{project(e,i){i=i/180*Math.PI,e=e/180*Math.PI;let r=Math.asin(uz*Math.sin(i)),a=r*r,n=a*a*a;return{x:.5*(e*Math.cos(r)/(uz*(1.340264+-.24331799999999998*a+n*(.0062510000000000005+.034164*a)))/M
212ath.PI+.5),y:1-.5*(r*(1.340264+-.081106*a+n*(893e-6+.003796*a))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let r=i=(2*(1-i)-1)*Math.PI,a=r*r,n=a*a*a;for(let e,s,l=0;l<12&&(s=r*(1.340264+-.081106*a+n*(893e-6+.003796*a))-i,n=(a=(r=eD(r-(e=s/(1.340264+-.24331799999999998*a+n*(.0062510000000000005+.034164*a))),-Math.PI/3,Math.PI/3))*r)*a*a,!(1e-12>Math.abs(e)));++l);let s=uz*e*(1.340264+-.24331799999999998*a+n*(.0062510000000000005+.034164*a))/Math.cos(r),l=Math.asin(Math.sin(r)/uz);return new oA(eD(180*s/Math.PI,-180,180),eD(180*l/Math.PI,-85.051129,85.051129))}}class uO extends uk{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0}project(e,i){return{x:.5+e/360,y:.5-i/360,z:0}}unproject(e,i){return new oA(360*(e-.5),eD(360*(.5-i),-85.051129,85.051129))}}let uB=Math.PI/2;function uF(e){return Math.tan((uB+e)/2)}class uN extends uk{constructor(e){super(e),this.center=e.center||[0,30];let[i,r]=this.parallels=e.parallels||[30,30],a=i*eC,n=r*eC;this.southernCenter=a+n<0,this.southernCenter&&(a=-a,n=-n);let s=Math.cos(a),l=uF(a);this.n=a===n?Math.sin(a):Math.log(s/Math.cos(n))/Math.log(uF(n)/l),this.f=s*Math.pow(uF(a),this.n)/this.n}project(e,i){i*=eC,this.southernCenter&&(i=-i),e=(e-this.center[0])*eC;let{n:r,f:a}=this;a>0?i<-uB+1e-6&&(i=-uB+1e-6):i>uB-1e-6&&(i=uB-1e-6);let n=a/Math.pow(uF(i),r),s=n*Math.sin(r*e),l=a-n*Math.cos(r*e);return s=.5*(s/Math.PI+.5),l=.5*(l/Math.PI+.5),{x:s,y:this.southernCenter?l:1-l,z:0}}unproject(e,i){e=(2*e-.5)*Math.PI,this.southernCenter&&(i=1-i);let{n:r,f:a}=this,n=a-(i=(2*(1-i)-.5)*Math.PI),s=Math.sign(n),l=Math.sign(r)*Math.sqrt(e*e+n*n),h=Math.atan2(e,Math.abs(n))*s;n*r<0&&(h-=Math.PI*Math.sign(e)*s);let u=eD(h/r*eP+this.center[0],-180,180),c=eD((2*Math.atan(Math.pow(a/l,1/r))-uB)*eP,-85.051129,85.051129);return new oA(u,this.southernCenter?-c:c)}}class uV extends uk{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(e,i){return{x:oP(e),y:oL(i),z:0}}unproject(e,i){return new oA(ok(e),oR(i))}}let uU=85.051129*eC;class uj extends uk{project(e,i){let r=(i*=eC)*i,a=r*r;return{x:.5*((e*=eC)*(.8707-.131979*r+a*(a*(.003971*r-.001529*a)-.013791))/Math.PI+.5),y:1-.5*(i*(1.007226+r*(.015085+a*(.028874*r-.044475-.005916*a)))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let r=i=(2*(1-i)-1)*Math.PI,a=25,n=0,s=r*r;do{let e=(s=r*r)*s;n=(r*(1.007226+s*(.015085+e*(.028874*s-.044475-.005916*e)))-i)/(1.007226+s*(.045255+e*(.259866*s-.311325-.005916*11*e))),r=eD(r-n,-uU,uU)}while(Math.abs(n)>1e-6&&--a>0)return new oA(eD(e/(.8707+(s=r*r)*(s*(s*s*s*(.003971-.001529*s)-.013791)-.131979))*eP,-180,180),r*eP)}}let uG=85.051129*eC;class uq extends uk{project(e,i){i*=eC,e*=eC;let r=Math.cos(i),a=Math.acos(r*Math.cos(e/2)),n=Math.sin(a)/a;return{x:.5*((.5*(2/Math.PI*e+2*r*Math.sin(e/2)/n)||0)/Math.PI+.5),y:1-.5*((.5*(i+Math.sin(i)/n)||0)/Math.PI+1),z:0}}unproject(e,i){let r=e=(2*e-.5)*Math.PI,a=i=(2*(1-i)-1)*Math.PI,n=25,s=0,l=0;do{let n=Math.cos(a),h=Math.sin(a),u=2*h*n,c=h*h,d=n*n,p=Math.cos(r/2),f=Math.sin(r/2),m=2*p*f,_=f*f,g=1-d*p*p,y=g?1/g:0,x=g?Math.acos(n*p)*Math.sqrt(1/g):0,v=.5*(2*x*n*f+2*r/Math.PI)-e,b=.5*(x*h+a)-i,w=.5*y*(d*_+x*n*p*c)+1/Math.PI,T=y*(m*u/4-x*h*f),S=.125*y*(u*f-x*h*d*m),M=.5*y*(c*p+x*_*n)+.5,E=T*S-M*w;s=(b*T-v*M)/E,l=(v*S-b*w)/E,r=eD(r-s,-Math.PI,Math.PI),a=eD(a-l,-uG,uG)}while((Math.abs(s)>1e-6||Math.abs(l)>1e-6)&&--n>0)return new oA(r*eP,a*eP)}}class uW extends uk{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(this.parallels[0]*eC)),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(e,i){let{scale:r,cosPhi:a}=this;return{x:e*eC*a*r+.5,y:-Math.sin(i*eC)/a*r+.5,z:0}}unproject(e,i){let{scale:r,cosPhi:a}=this,n=eD((e-.5)/r*eP/a,-180,180),s=Math.asin(eD(-(i-.5)/r*a,-1,1));return new oA(n,eD(s*eP,-85.051129,85.051129))}}class u$ extends uV{constructor(e){super(e),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(e,i,r){let a=sA(e,i,r),n=sP(sb(r));return eS.vec3.transformMat4(a,a,n),{x:a[0],y:a[1],z:a[2]}}locationPoint(e,i){let r=oM(i.lat,i.lng),a=eS.vec3.normalize([],r),n=e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(i),e._centerAltitude):e._centerAltitude,s=1/oC(0)*8192*n;eS.vec3.scaleAndAdd(r,r,a,s);
212let l=eS.mat4.identity(new Float64Array(16));return eS.mat4.multiply(l,e.pixelMatrix,e.globeMatrix),eS.vec3.transformMat4(r,r,l),new eA(r[0],r[1])}pixelsPerMeter(e,i){return 1/oC(0)*i}pixelSpaceConversion(e,i,r){let a=1/oC(e)*i,n=tU(1/oC(45)*i,a,r);return this.pixelsPerMeter(e,i)/n}createTileMatrix(e,i,r){let a=sL(sb(r.canonical));return eS.mat4.multiply(new Float64Array(16),e.globeMatrix,a)}createInversionMatrix(e,i){let{center:r}=e,a=sP(sb(i));return eS.mat4.rotateY(a,a,r.lng*eC),eS.mat4.rotateX(a,a,r.lat*eC),eS.mat4.scale(a,a,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(a)}pointCoordinate(e,i,r,a){return sy(e,i,r,!0)||new oF(0,0)}pointCoordinate3D(e,i,r){let a=this.pointCoordinate(e,i,r,0);return[a.x,a.y,a.z]}isPointAboveHorizon(e,i){return!sy(e,i.x,i.y,!1)}farthestPixelDistance(e){let i=function(e,i){let r;let a=e.cameraToCenterDistance,n=e._centerAltitude*i,s=e._camera,l=e._camera.forward(),h=eS.vec3.add([],eS.vec3.scale([],l,-a),[0,0,n]),u=e.worldSize/(2*Math.PI),c=[0,0,-u],d=e.width/e.height,p=Math.tan(e.fovAboveCenter),f=eS.vec3.scale([],s.up(),p),m=eS.vec3.scale([],s.right(),p*d),_=eS.vec3.normalize([],eS.vec3.add([],eS.vec3.add([],l,f),m)),g=[];if(new sl(h,_).closestPointOnSphere(c,u,g)){let i=eS.vec3.add([],g,c),a=eS.vec3.sub([],i,h);r=Math.cos(e.fovAboveCenter)*eS.vec3.length(a)}else{let e=eS.vec3.sub([],h,c),i=eS.vec3.sub([],c,h);eS.vec3.normalize(i,i);let a=eS.vec3.length(e)-u,n=Math.acos((r=Math.sqrt(a*(a+2*u)))/(u+a))-Math.acos(eS.vec3.dot(l,i));r*=Math.cos(n)}return 1.01*r}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),r=sD(e.zoom);return r>0?tU(i,uI(e,1/oC(e.center.lat)*e.worldSize)+e.worldSize/(2*Math.PI)*(1-Math.cos(Math.max(e.width,e.height)/e.worldSize*Math.PI)),Math.pow(r,10)):i}upVector(e,i,r){return sA(i,r,e,1)}upVectorScale(e){return{metersToTile:s_(sI(sb(e)))}}}function uH(e){let i=e.parallels,r=!!i&&.01>Math.abs(i[0]+i[1]);switch(e.name){case"mercator":return new uV(e);case"equirectangular":return new uO(e);case"naturalEarth":return new uj(e);case"equalEarth":return new uD(e);case"winkelTripel":return new uq(e);case"albers":return r?new uW(e):new uR(e);case"lambertConformalConic":return r?new uW(e):new uN(e);case"globe":return new u$(e)}throw Error(`Invalid projection name: ${e.name}`)}let uZ=lR.VectorTileFeature.types,uX=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function uY(e,i,r,a,n,s,l,h,u,c,d,p,f){let m=h?Math.min(32640,Math.round(h[0])):0,_=h?Math.min(32640,Math.round(h[1])):0;e.emplaceBack(i,r,Math.round(32*a),Math.round(32*n),s,l,(m<<1)+ +!!u,_,16*c,16*d,256*p,256*f)}function uJ(e,i,r){e.emplaceBack(i,r)}function uK(e,i,r,a,n,s,l){e.emplaceBack(i,r,a,n,s,l)}function uQ(e,i,r,a,n){e.emplaceBack(i,r,a,n),e.emplaceBack(i,r,a,n),e.emplaceBack(i,r,a,n),e.emplaceBack(i,r,a,n)}class u0{constructor(e){this.layoutVertexArray=new n_,this.indexArray=new nS,this.programConfigurations=e,this.segments=new n0,this.dynamicLayoutVertexArray=new nc,this.opacityVertexArray=new ny,this.placedSymbolArray=new nj,this.iconTransitioningVertexArray=new nx,this.globeExtVertexArray=new ng,this.zOffsetVertexArray=new nA}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length&&0===this.iconTransitioningVertexArray.length}upload(e,i,r,a,n){this.isEmpty()||(r&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,hk.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,hz.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,uX,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=e.createVertexBuffer(this.iconTransitioningVertexArray,hO.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,hR.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||n)&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,hD.members,!0)),this.opacityVertexBuffer.itemSize=1),(r||a)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.iconTransitioningVertexBuffer&&this.iconTransitioningVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy())}}af(u0,"SymbolBuffers");class u1{constructor(e,i,r){this.layoutVertexArray=new e,this.layoutAttributes=i,this.indexArray=new r,this.segments=new n0,this.collisionVertexArray=new nT,this.collisionVertexArrayExt=new nc}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,hB.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,hF.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.de
212stroy())}}af(u1,"CollisionBuffers");class u2{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.lut=e.lut,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=eS.mat4.identity([]),this.placementViewportMatrix=eS.mat4.identity([]);let i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=hU(this.zoom,i["text-size"]),this.iconSizeData=hU(this.zoom,i["icon-size"]);let r=this.layers[0].layout,a=r.get("symbol-sort-key"),n=r.get("symbol-z-order");this.canOverlap=r.get("text-allow-overlap")||r.get("icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==n&&void 0!==a.constantOr(1),this.sortFeaturesByY=("viewport-y"===n||"auto"===n&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=r.get("text-writing-mode").map(e=>h1[e]),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.sourceID=e.sourceID,this.projection=e.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=r.get("symbol-z-elevate"),this.activeReplacements=[],this.replacementUpdateTime=0}createArrays(){this.text=new u0(new o_(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("text")||e.startsWith("symbol"))),this.icon=new u0(new o_(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("icon")||e.startsWith("symbol"))),this.glyphOffsetArray=new nW,this.lineVertexArray=new n$,this.symbolInstances=new nq}calculateGlyphDependencies(e,i,r,a,n){for(let r of e){let e=r.codePointAt(0);if(void 0===e)break;if(i[e]=!0,a&&n&&e<=65535){let e=hW[r];e&&(i[e.charCodeAt(0)]=!0)}}}updateFootprints(e,i){}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;let r=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);return!lq(this.activeReplacements,r)&&(this.activeReplacements=r,!0)}populate(e,i,r,a){let n=this.layers[0],s=n.layout,l="globe"===this.projection.name,h=s.get("text-font"),u=s.get("text-field"),c=s.get("icon-image"),d=("constant"!==u.value.kind||u.value.value instanceof it&&!u.value.value.isEmpty()||u.value.value.toString().length>0)&&("constant"!==h.value.kind||h.value.value.length>0),p="constant"!==c.value.kind||!!c.value.value||Object.keys(c.parameters).length>0,f=s.get("symbol-sort-key");if(this.features=[],!d&&!p)return;let m=i.iconDependencies,_=i.glyphDependencies,g=i.availableImages,y=new aO(this.zoom);for(let{feature:i,id:u,index:c,sourceLayerIndex:x}of e){let e,v;let b=n._featureFilter.needGeometry,w=oj(i,b);if(!n._featureFilter.filter(y,w,r))continue;if(b||(w.geometry=oU(i,r,a)),l&&1!==i.type&&r.z<=5){let e=w.geometry,i=(e,i)=>{let a=sA(e.x,e.y,r,1),n=sA(i.x,i.y,r,1);return .98078528056>eS.vec3.dot(a,n)};for(let r=0;r<e.length;r++)e[r]=function(e,i){let r=e[0],a=[r];for(let n=1;n<e.length;n++){let s=e[n];(function e(i,r,a,n){if(n(r,a)){let s=r.add(a)._mult(.5);e(i,r,s,n),e(i,s,a,n)}else i.push(a)})(a,r,s,i),r=s}return a}(e[r],i)}if(d){let i=n.getValueAndResolveTokens("text-field",w,r,g),a=it.factory(i);(function(e){for(let i of e.sections)if(function(e){for(let i of e)if(aT(i.charCodeAt(0)))return!0;return!1}(i.text))return!0;return!1})(a)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===aR()||this.hasRTLText&&aD.isParsed())&&(e=function(e,i,r){return e.sections.forEach(e=>{e.text=function(e,i,r){let a=i.layout.get("text-transform").evaluate(r,{});return"uppercase"===a?e=e.toLocaleUpperCase():"lowercase"===a&&(e=e.toLocaleLowerCase()),aD.applyArabicShaping&&(e=aD.applyArabicShaping(e)),e}(e.text,i,r)}),e}(a,n,w))}if(p){let e=n.getValueAndResolveTokens("icon-image",w,r,g);v=e instanceof ii?e:ii.fromString(e)}if(!e&&!v)continue;let T=this.sortFeaturesByKey?f.evaluate(w,{},r):void 0;if(this.features.push({id:u,text:e,icon:v,index:c,sourceLayerIndex:x,geometry:w.geometry,properties:i.properties,type:uZ[i.type],sortKey:T}),v&&(m[v.namePrimary]=!0,v.nameSecondary&&(m[v.nameSecondary]=!0)),e){let i=h.evaluate(w,{},r).join(","),a="map"===s.get("text-rotation-alignment")&&"point"!==s.get("symbol-placement");for(let r of(this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(h1.vertical)>=0,e.sections))if(r.image)m[r.image.namePrimary]=!0;else{let n=av(e.toString()),s=r.fontStack||i,l=_[s]=_[s]||{};this.calculateGlyphDependencies(r.text,l,a,this.allowVerticalPlacement,n)}}}"line"===s.get("symbol-placement")&&(this.features=function(e){let i={},r={},a=[],n=0;function s(i){a.push(e[i]),n++}function l(e,i,n){let s=r[e];return delete r[e],r[i]=s,a[s].geometry[0].pop(),a[s].geometry[0]=a[s].geometry[0].concat(n[0]),s}function h(e,r,n){let s=i[r];return delete i[r],i[e]=s,a[s].geometry[0].shift(),a[s].geometry[0]=n[0].concat(a[s].geometry[0]),s}function u(e,i,r){let a=r?i[0][i[0].length-1]:i[0][0];return`${e}:${a.x}:${a.y}`}for(let c=0;c<e.length;c++){let d=e[c],p=d.geometry,f=d.text?d.text.toString():null;if(!f){s(c);continue}let m=u(f,p),_=u(f,p,!0);if(m in r&&_ in i&&r[m]!==i[_]){let e=h(m,_,p),n=l(m,_,a[e].geometry);delete i[m],delete r[_],r[u(f,a[n].geometry,!0)]=n,a[e].geometry=null}else m in r?l(m,_,p):_ in i?h(m,_,p):(s(c),i[m]=n-1,r[_]=n-1)}return a.filter(e=>e.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((e,i)=>
212e.sortKey-i.sortKey)}update(e,i,r,a,n){let s=0!==Object.keys(e).length;if(s&&!this.stateDependentLayers.length)return;let l=s?this.stateDependentLayers:this.layers;this.text.programConfigurations.updatePaintArrays(e,i,l,r,a,n),this.icon.programConfigurations.updatePaintArrays(e,i,l,r,a,n)}updateZOffset(){let e=(e,i,a)=>{(r+=i)>e.length&&e.resize(r);for(let n=-i;n<0;n++)e.emplace(n+r,a)},i=(e,i,r)=>{(a+=i)>e.length&&e.resize(a);for(let n=-i;n<0;n++)e.emplace(n+a,r)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let r=0,a=0;for(let r=0;r<this.symbolInstances.length;r++){let a=this.symbolInstances.get(r),{numHorizontalGlyphVertices:n,numVerticalGlyphVertices:s,numIconVertices:l}=a,h=a.zOffset,u=l>0;if((n>0||s>0)&&(e(this.text.zOffsetVertexArray,n,h),e(this.text.zOffsetVertexArray,s,h)),u){let{placedIconSymbolIndex:e,verticalPlacedIconSymbolIndex:r}=a;e>=0&&i(this.icon.zOffsetVertexArray,l,h),r>=0&&i(this.icon.zOffsetVertexArray,a.numVerticalIconVertices,h)}}this.text.zOffsetVertexBuffer&&this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&&this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray)}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.zOffsetBuffersNeedUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=uH(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,i){let r=this.lineVertexArray.length;if(void 0!==e.segment)for(let{x:e,y:r}of i)this.lineVertexArray.emplaceBack(e,r);return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(e,i,r,a,n,s,l,h,u,c,d,p,f,m,_,g){let y=e.indexArray,x=e.layoutVertexArray,v=e.globeExtVertexArray,b=e.segments.prepareSegment(4*i.length,x,y,this.canOverlap?s.sortKey:void 0),w=this.glyphOffsetArray.length,T=b.vertexLength,S=this.allowVerticalPlacement&&l===h1.vertical?Math.PI/2:0,M=s.text&&s.text.sections;for(let a=0;a<i.length;a++){let{tl:n,tr:l,bl:c,br:d,texPrimary:p,texSecondary:w,pixelOffsetTL:T,pixelOffsetBR:E,minFontScaleX:A,minFontScaleY:I,glyphOffset:C,isSDF:P,sectionIndex:L}=i[a],k=b.vertexLength,R=C[1];if(uY(x,u.x,u.y,n.x,R+n.y,p.x,p.y,r,P,T.x,T.y,A,I),uY(x,u.x,u.y,l.x,R+l.y,p.x+p.w,p.y,r,P,E.x,T.y,A,I),uY(x,u.x,u.y,c.x,R+c.y,p.x,p.y+p.h,r,P,T.x,E.y,A,I),uY(x,u.x,u.y,d.x,R+d.y,p.x+p.w,p.y+p.h,r,P,E.x,E.y,A,I),h){let{x:i,y:r,z:a}=h.anchor,[n,s,l]=h.up;uK(v,i,r,a,n,s,l),uK(v,i,r,a,n,s,l),uK(v,i,r,a,n,s,l),uK(v,i,r,a,n,s,l),uQ(e.dynamicLayoutVertexArray,i,r,a,S)}else uQ(e.dynamicLayoutVertexArray,u.x,u.y,u.z,S);if(g){let i=w||p;uJ(e.iconTransitioningVertexArray,i.x,i.y),uJ(e.iconTransitioningVertexArray,i.x+i.w,i.y),uJ(e.iconTransitioningVertexArray,i.x,i.y+i.h),uJ(e.iconTransitioningVertexArray,i.x+i.w,i.y+i.h)}y.emplaceBack(k,k+1,k+2),y.emplaceBack(k+1,k+2,k+3),b.vertexLength+=4,b.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(C[0]),a!==i.length-1&&L===i[a+1].sectionIndex||e.programConfigurations.populatePaintArrays(x.length,s,s.index,{},f,m,_,M&&M[L])}let E=h?h.anchor:u;e.placedSymbolArray.emplaceBack(E.x,E.y,E.z,u.x,u.y,w,this.glyphOffsetArray.length-w,T,c,d,u.segment,r?r[0]:0,r?r[1]:0,a[0],a[1],l,0,!1,0,p,0)}_commitLayoutVertex(e,i,r,a,n,s,l){e.emplaceBack(i,r,a,n,s,Math.round(l.x),Math.round(l.y))}_addCollisionDebugVertices(e,i,r,a,n,s,l){let h=r.segments.prepareSegment(4,r.layoutVertexArray,r.indexArray),u=h.vertexLength,c=l.tileAnchorX,d=l.tileAnchorY;for(let e=0;e<4;e++)r.collisionVertexArray.emplaceBack(0,0,0,0,0,0);this._commitDebugCollisionVertexUpdate(r.collisionVertexArrayExt,i,e.padding,l.zOffset),this._commitLayoutVertex(r.layoutVertexArray,a,n,s,c,d,new eA(e.x1,e.y1)),this._commitLayoutVertex(r.layoutVertexArray,a,n,s,c,d,new eA(e.x2,e.y1)),this._commitLayoutVertex(r.layoutVertexArray,a,n,s,c,d,new eA(e.x2,e.y2)),this._commitLayoutVertex(r.layoutVertexArray,a,n,s,c,d,new eA(e.x1,e.y2)),h.vertexLength+=4;let p=r.indexArray;p.emplaceBack(u,u+1),p.emplaceBack(u+1,u+2),p.emplaceBack(u+2,u+3),p.emplaceBack(u+3,u),h.primitiveLength+=4}_addTextDebugCollisionBoxes(e,i,r,a,n,s){for(let l=a;l<n;l++){let a=r.get(l),n=this.getSymbolInstanceTextSize(e,s,i,l);this._addCollisionDebugVertices(a,n,this.textCollisionBox,a.projectedAnchorX,a.projectedAnchorY,a.projectedAnchorZ,s)}}_addIconDebugCollisionBoxes(e,i,r,a,n,s){for(let l=a;l<n;l++){let a=r.get(l),n=this.getSymbolInstanceIconSize(e,i,s.placedIconSymbolIndex);this._addCollisionDebugVertices(a,n,this.iconCollisionBox,a.projectedAnchorX,a.projectedAnchorY,a.projectedAnchorZ,s)}}generateCollisionDebugBuffers(e,i,r){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new u1(nb,hN.members,nx),this.iconCollisionBox=new u1(nb,hN.members,nx);let a=hG(this.iconSizeData,e),n=hG(this.textSizeData,e,r);for(let r=0;r<this.symbolInstances.length;r++){let s=this.symbolInstances.get(r);this._addTextDebugCollisionBoxes(n,e,i,s.textBoxStartIndex,s.textBoxEndIndex,s),this._addTextDebugCollisionBoxes(n,e,i,s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s),this._addIconDebugCollisionBoxes(a,e,i,s.iconBoxStartIndex,s.iconBoxEndIndex,s),this._addIconDebugCollisionBoxes(a,e,i,s.verticalIconBoxStartIndex,s.verticalIconBoxEndIndex,s)}}getSymbolInstanceTextSize(e,i,r,a){let n=this.text.placedSymbolArray.get(i.rightJustifiedTextSymbolIndex>=0?i.rightJustifiedTextSymbolIndex:i.centerJustifiedTextSymbolIndex>=0?i.centerJustifiedTextSymbolIndex:i.leftJustifiedTextSymbolIndex>=0?i.leftJustifiedTextSymbolIndex:i.verticalPlacedTextSymbolIndex>=0?i.verticalPlacedTextSymbolIndex:a),s=hj(this.textSizeData,e,n)/24;return this.tilePixelRatio*s}getSymbolInstanceIconSize(e,i,r){let a=this.icon.placedSymbolArray.get(r),n=hj(this.iconSizeData,e,a);return this.tilePixelRatio*n}_commitDebugCollisionVertexUpdate(e,i,r,a){e.emplaceBack(i,-r,-r,a),e.emplaceBack(i,r,-r,a),e.emplaceBack(i,r,r,a),e.emplaceBack(i,-r,r,a)}_updateTextDebugCollisionBoxes(e,i,r,a,n,s,l){for(let l=a;l<n;l++){let a=r.get(l),n=this.getSymbolInstanceTextSize(e,s,i,l);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,n,a.padding,s.zOffset)}}_updateIconDebugCollisionBoxes(e,i,r,a,n,s,l){for(let l=a;l<n;l++){let a=r.get(l),n=this.getSymbolInstanceIconSize(e,i,s.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,n,a.padding,s.zOffset)}}updateCollisionDebugBuffers(e,i,r,a){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();let n=hG(this.iconSizeData,e,a),s=hG(this.textSizeData,e,r);for(let l=0;l<this.symbolInstances.length;l++){let h=this.symbolInstances.get(l);this._updateTextDebugCollisionBoxes(s,e,i,h.textBoxStartIndex,h.textBoxEndIndex,h,r),this._updateTextDebugCollisionBoxes(s,e,i,h.verticalTextBoxStartIndex,h.verticalTextBoxEndIndex,h,r),this._updateIconDebugCollisionBoxes(n,e,i,h.iconBoxStartIndex,h.iconBoxEndIndex,h,a),this._updateIconDebugCollisionBoxes(n,e,i,h.verticalIconBoxStartIndex,h.verticalIconBoxEndIndex,h,a)}this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexBufferExt&&this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexBufferExt&&this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt)}_deserializeCollisionBoxesForSymbol(e,i,r,a,n,s,l,h,u){let c={};if(i<r){let{x1:r,y1:a,x2:n,y2:s,padding:l,projectedAnchorX:h,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:p,tileAnchorY:f,featureIndex:m}=e.get(i);c.textBox={x1:r,y1:a,x2:n,y2:s,padding:l,projectedAnchorX:h,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:p,tileAnchorY:f},c.textFeatureIndex=m}if(a<n){let{x1:i,y1:r,x2:n,y2:s,padding:l,projectedAnchorX:h,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:p,tileAnchorY:f,featureIndex:m}=e.get(a);c.verticalTextBox={x1:i,y1:r,x2:n,y2:s,padding:l,projectedAnchorX:h,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:p,tileAnchorY:f},c.verticalTextFeatureIndex=m}if(s<l){let{x1:i,y1:r,x2:a,y2:n,padding:l,projectedAnchorX:h,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:p,tileAnchorY:f,featureIndex:m}=e.get(s);c.iconBox={x1:i,y1:r,x2:a,y2:n,padding:l,projectedAnchorX:h,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:p,tileAnchorY:f},c.iconFeatureIndex=m}if(h<u){let{x1:i,y1:r,x2:a,y2:n,padding:s,projectedAnchorX:l,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:p,tileAnchorY:f,featureIndex:m}=e.get(h);c.verticalIconBox={x1:i,y1:r,x2:a,y2:n,padding:s,projectedAnchorX:l,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:p,tileAnchorY:f},c.verticalIconFeatureIndex=m}return c}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let i=0;i<this.symbolInstances.length;i++){let r=this.symbolInstances.get(i);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}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(e,i){let r=e.placedSymbolArray.get(i),a=r.vertexStartIndex+4*r.numGlyphs;for(let i=r.vertexStartIndex;i<a;i+=4)e.indexArray.emplaceBack(i,i+1,i+2),e.indexArray.emplaceBack(i+1,i+2,i+3)}
212getSortedSymbolIndexes(e){if(this.sortedAngle===e&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;let i=Math.sin(e),r=Math.cos(e),a=[],n=[],s=[];for(let e=0;e<this.symbolInstances.length;++e){s.push(e);let l=this.symbolInstances.get(e);a.push(0|Math.round(i*l.tileAnchorX+r*l.tileAnchorY)),n.push(l.featureIndex)}return s.sort((e,i)=>a[e]-a[i]||n[i]-n[e]),s}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let e=0;e<this.symbolInstances.length;++e)this.symbolInstanceIndexesSortedZOffset.push(e)}return this.zOffsetSortDirty=!1,this.symbolInstanceIndexesSortedZOffset.sort((e,i)=>this.symbolInstances.get(i).zOffset-this.symbolInstances.get(e).zOffset)}addToSortKeyRanges(e,i){let r=this.sortKeyRanges[this.sortKeyRanges.length-1];r&&r.sortKey===i?r.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:i,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){for(let i of(this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[],this.symbolInstanceIndexes)){let e=this.symbolInstances.get(i);this.featureSortOrder.push(e.featureIndex);let{rightJustifiedTextSymbolIndex:r,centerJustifiedTextSymbolIndex:a,leftJustifiedTextSymbolIndex:n,verticalPlacedTextSymbolIndex:s,placedIconSymbolIndex:l,verticalPlacedIconSymbolIndex:h}=e;r>=0&&this.addIndicesForPlacedSymbol(this.text,r),a>=0&&a!==r&&this.addIndicesForPlacedSymbol(this.text,a),n>=0&&n!==a&&n!==r&&this.addIndicesForPlacedSymbol(this.text,n),s>=0&&this.addIndicesForPlacedSymbol(this.text,s),l>=0&&this.addIndicesForPlacedSymbol(this.icon,l),h>=0&&this.addIndicesForPlacedSymbol(this.icon,h)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}af(u2,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),u2.addDynamicAttributes=uQ;class u3{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:tH,this.defaultValue=e}evaluate(e){if(e.formattedSection){let i=this.defaultValue.property.overrides;if(i&&i.hasOverride(e.formattedSection))return i.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}af(u3,"FormatSectionOverride",{omit:["defaultValue"]});let u4=()=>L||(L={layout:C||(C=new aZ({"symbol-placement":new aW(aX.layout_symbol["symbol-placement"]),"symbol-spacing":new aW(aX.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new aW(aX.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new a$(aX.layout_symbol["symbol-sort-key"]),"symbol-z-order":new aW(aX.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new aW(aX.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new aW(aX.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new aW(aX.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new aW(aX.layout_symbol["icon-ignore-placement"]),"icon-optional":new aW(aX.layout_symbol["icon-optional"]),"icon-rotation-alignment":new aW(aX.layout_symbol["icon-rotation-alignment"]),"icon-size":new a$(aX.layout_symbol["icon-size"]),"icon-size-scale-range":new aW(aX.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new a$(aX.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new a$(aX.layout_symbol["icon-text-fit-padding"]),"icon-image":new a$(aX.layout_symbol["icon-image"]),"icon-rotate":new a$(aX.layout_symbol["icon-rotate"]),"icon-padding":new aW(aX.layout_symbol["icon-padding"]),"icon-keep-upright":new aW(aX.layout_symbol["icon-keep-upright"]),"icon-offset":new a$(aX.layout_symbol["icon-offset"]),"icon-anchor":new a$(aX.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new aW(aX.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new aW(aX.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new aW(aX.layout_symbol["text-rotation-alignment"]),"text-field":new a$(aX.layout_symbol["text-field"]),"text-font":new a$(aX.layout_symbol["text-font"]),"text-size":new a$(aX.layout_symbol["text-size"]),"text-size-scale-range":new aW(aX.layout_symbol["text-size-scale-range"]),"text-max-width":new a$(aX.layout_symbol["text-max-width"]),"text-line-height":new a$(aX.layout_symbol["text-line-height"]),"text-letter-spacing":new a$(aX.layout_symbol["text-letter-spacing"]),"text-justify":new a$(aX.layout_symbol["text-justify"]),"text-radial-offset":new a$(aX.layout_symbol["text-radial-offset"]),"text-variable-anchor":new aW(aX.layout_symbol["text-variable-anchor"]),"text-anchor":new a$(aX.layout_symbol["text-anchor"]),"text-max-angle":new aW(aX.layout_symbol["text-max-angle"]),"text-writing-mode":new aW(aX.layout_symbol["text-writing-mode"]),"text-rotate":new a$(aX.layout_symbol["text-rotate"]),"text-padding":new aW(aX.layout_symbol["text-padding"]),"text-keep-upright":new aW(aX.layout_symbol["text-keep-upright"]),"text-transform":new a$(aX.layout_symbol["text-transform"]),"text-offset":new a$(aX.layout_symbol["text-offset"]),"text-allow-overlap":new aW(aX.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new aW(aX.layout_symbol["text-ignore-placement"]),"text-optional":new aW(aX.layout_symbol["text-optional"]),visibility:new aW(aX.layout_symbol.visibility)})),paint:P||(P=new aZ({"icon-opacity":new a$(aX.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new a$(aX.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new a$(aX.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new a$(aX.paint_symbol["text-emissive-strength"]),"icon-color":new a$(aX.paint_symbol["icon-color"]),"icon-halo-color":new a$(aX.paint_symbol["icon-halo-color"]),"icon-halo-width":new a$(aX.paint_symbol["icon-halo-width"]),"icon-halo-blur":new a$(aX.paint_symbol["icon-halo-blur"]),"icon-translate":new aW(aX.paint_symbol["icon-translate"]),"icon-translate-anchor":new aW(aX.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new a$(aX.paint_symbol["icon-image-cross-fade"]),"text-opacity":new a$(aX.paint_symbol["text-opacity"]),"text-occlusion-opacity":new a$(aX.paint_symbol["text-occlusion-opacity"]),"text-color":new a$(aX.paint_symbol["text-color"],{runtimeType:tJ,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new a$(aX.paint_symbol["text-halo-color"]),"text-halo-width":new a$(aX.paint_symbol["text-halo-width"]),"text-halo-blur":new a$(aX.paint_symbol["text-halo-blur"]),"text-translate":new aW(aX.paint_symbol["text-translate"]),"text-translate-anchor":new aW(aX.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new aW(aX.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new aW(aX.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new aW(aX.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new aW(aX.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new a$(aX.paint_symbol["symbol-z-offset"])}))});class u5 extends ne{constructor(e,i,r,a){super(e,u4(),i,r,a),this._colorAdjustmentMatrix=eS.mat4.identity([]),this.hasInitialOcclusionOpacityProperties=void 0!==e.paint&&("icon-occlusion-opacity"in e.paint||"text-occlusion-opacity"in e.paint)}recalculate(e,i){super.recalculate(e,i),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));let r=this.layout.get("text-writing-mode");if(r){let e=[];for(let i of r)0>e.indexOf(i)&&e.push(i);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(e,i,r,a){return this._saturation===e&&this._contrast===i&&this._brightnessMin===r&&this._brightnessMax===a||(this._colorAdjustmentMatrix=function(e,i,r,a){e=e5(e),i=e4(i);let n=eS.mat4.create(),s=e/3,l=1-2*s,h=.5-.5*i,u=a-r;return eS.mat4.multiply(n,[u,0,0,0,0,u,0,0,0,0,u,0,r,r,r,1],[i,0,0,0,0,i,0,0,0,0,i,0,h,h,h,1]),eS.mat4.multiply(n,n,[l,s,s,0,s,l,s,0,s,s,l,0,0,0,0,1]),n}(e,i,r,a),this._saturation=e,this._contrast=i,this._brightnessMin=r,this._brightnessMax=a),this._colorAdjustmentMatrix}getValueAndResolveTokens(e,i,r,a){var n;let s=this.layout.get(e).evaluate(i,{},r,a),l=this._unevaluatedLayout._values[e];return l.isDataDriven()||aa(l.value)||!s?s:(n=i.properties,s.replace(/{([^{}]+)}/g,(e,i)=>i in n?String(n[i]):""))}createBucket(e){return new u2(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(let e of u4().paint.overridableProperties){if(!u5.hasPaintOverride(this.layout,e))continue;let i=this.paint.get(e),r=new ar(new u3(i),i.property.specification,this.scope,this.options),a=null;a="constant"===i.value.kind||"source"===i.value.kind?new ao("source",r):new as("composite",r,i.value.zoomStops,i.value._interpolationType),this.paint._values[e]=new aG(i.property,a,i.parameters)}}_handleOverridablePaintPropertyUpdate(e,i,r){return!(!this.layout||i.isDataDriven()||r.isDataDriven())&&u5.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,i){let r=e.get("text-field"),a=u4().paint.properties[i],n=!1,s=e=>{for(let i of e)if(a.overrides&&a.overrides.hasOverride(i))return void(n=!0)};if("constant"===r.value.kind&&r.value.value instanceof it)s(r.value.value.sections);else if("source"===r.value.kind){let e=i=>{n||(i instanceof il&&io(i.value)===t1?s(i.value.sections):i instanceof id?s(i.sections):i.eachChild(e))},i=r.value;i._styleExpression&&e(i._styleExpression.expression)}return n}getProgramIds(){return["symbol"]}getDefaultProgramParams(e,i,r){return{config:new om(this,{zoom:i,lut:r}),overrideFog:!1}}}var u6=na([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function u8(e){switch(e){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.RGBA;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.DEPTH_COMPONENT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.DEPTH_STENCIL;case WebGL2RenderingContext.R8:case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.RED}}function u9(e){switch(e){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.UNSIGNED_SHORT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.UNSIGNED_INT_24_8;case WebGL2RenderingContext.R8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.FLOAT}}class u7{constructor(e,i,r,a){this.context=e,this.format=r,this.useMipmap=a&&a.useMipmap,this.texture=e.gl.createTexture(),this.update(i,{premultiply:a&&a.premultiply})}update(e,i){let r=e&&e instanceof HTMLVideoElement&&0===e.width?e.videoWidth:e.width,a=e&&e instanceof HTMLVideoElement&&0===e.height?e.videoHeight:e.height,{context:n}=this,{gl:s}=n,{x:l,y:h}=i&&i.position?i.position:{x:0,y:0},u=Math.max(l+r,this.size?this.size[0]:0),c=Math.max(h+a,this.size?this.size[1]:0);this.size&&(this.size[0]!==u||this.size[1]!==c)&&(s.bindTexture(s.TEXTURE_2D,null),s.deleteTexture(this.texture),this.texture=s.createTexture(),this.size=null),s.bindTexture(s.TEXTURE_2D,this.texture),n.pixelStoreUnpackFlipY.set(!1),n.pixelStoreUnpack.set(1),n.pixelStoreUnpackPremultiplyAlpha.set(this.format===s.RGBA8&&(!i||!1!==i.premultiply));let d=e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap;if(!this.size&&u>0&&c>0){let e=this.useMipmap?Math.floor(Math.log2(Math.max(u,c)))+1:1;s.texStorage2D(s.TEXTURE_2D,e,this.format,u,c),this.size=[u,c]}if(this.size){if(d)s.texSubImage2D(s.TEXTURE_2D,0,l,h,u8(this.format),u9(this.format),e);else{let i=e.data;i&&s.texSubImage2D(s.TEXTURE_2D,0,l,h,r,a,u8(this.format),u9(this.format),i)}}this.useMipmap&&s.generateMipmap(s.TEXTURE_2D)}bind(e,i,r=!1){let{context:a}=this,{gl:n}=a;n.bindTexture(n.TEXTURE_2D,this.texture),e!==this.minFilter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,this.useMipmap&&!r?e===n.NEAREST?n.NEAREST_MIPMAP_NEAREST:n.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),i!==this.wrapS&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,i),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,i),this.wrapS=i)}bindExtraParam(e,i,r,a){let{context:n}=this,{gl:s}=n;s.bindTexture(s.TEXTURE_2D,this.texture),i!==this.magFilter&&(s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,i),this.magFilter=i),e!==this.minFilter&&(s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,this.useMipmap?e===s.NEAREST?s.NEAREST_MIPMAP_NEAREST:s.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),r!==this.wrapS&&(s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,r),this.wrapS=r),a!==this.wrapT&&(s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,a),this.wrapT=a)}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class ce{constructor(e,i){this.context=e,this.texture=i}bind(e,i){let{context:r}=this,{gl:a}=r;a.bindTexture(a.TEXTURE_2D,this.texture),e!==this.minFilter&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,e),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,e),this.minFilter=e),i!==this.wrapS&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,i),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,i),this.wrapS=i)}}function ct(e,i,r,a,n,s,l,h){let u=[e,i,1,r,a,1,n,s,1],c=[l,h,1],d=eS.mat3.adjoint([],u),[p,f,m]=eS.vec3.transformMat3(c,c,d);return eS.mat3.multiply(u,u,[p,0,0,0,f,0,0,0,m])}function ci(e,i,r,a,n,s,l,h){let u=function(e,i,r,a,n,s,l,h){let u=ct(0,0,1,0,1,1,0,1),c=ct(e,i,r,a,n,s,l,h),d=eS.mat3.adjoint([],u);return eS.mat3.multiply(c,c,d)}(e,i,r,a,n,s,l,h);return[u[2]/u[8]/8192,u[5]/u[8]/8192]}function cr(e){return[e[0],Math.min(Math.max(e[1],-85.051129),85.051129)]}class ca extends tD{constructor(e,i,r,a){super(),this.id=e,this.dispatcher=r,this.coordinates=i.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.onNorthPole=!1,this.onSouthPole=!1,this.setEventedParent(a),this.options=i,this._dirty=!1}load(e,i){if(this._loaded=i||!1,this.fire(new tL("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return e&&(this.coordinates=e),this._loaded=!0,void this._finishLoading();this._imageRequest=tT(this.map._requestManager.transformRequest(this.url,tg.Image),(i,r)=>{this._imageRequest=null,this._loaded=!0,i?this.fire(new tk(i)):r&&(this.image=r instanceof HTMLImageElement?te.getImageData(r):r,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,e&&(this.coordinates=e),this._finishLoading())})}loaded(){return this._loaded}updateImage(e){return e.url&&(this._imageRequest&&e.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=e.url,this.load(e.coordinates,this._loaded)),this}setTexture(e){if(!(e.handle instanceof WebGLTexture))throw Error("The provided handle is not a WebGLTexture instance");return this.texture=new ce(this.map.painter.context,e.handle),this.width=e.dimensions[0],this.height=e.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new tL("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(e){this._imageRequest&&(this._ima
212geRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof ce||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(e){if(this.coordinates=e,this._boundsArray=void 0,this._unsupportedCoords=!1,!e.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let i=e[0][1],r=e[0][1];for(let a of e)a[1]>r&&(r=a[1]),a[1]<i&&(i=a[1]);let a=(r+i)/2;if(a>85.051129?this.onNorthPole=!0:a<-85.051129&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){let i=e.map(oF.fromLngLat);this.tileID=function(e){let i=1/0,r=1/0,a=-1/0,n=-1/0;for(let s of e)i=Math.min(i,s.x),r=Math.min(r,s.y),a=Math.max(a,s.x),n=Math.max(n,s.y);let s=Math.max(0,Math.floor(-Math.log(Math.max(a-i,n-r))/Math.LN2)),l=Math.pow(2,s),h=Math.floor((i+a)/2*l);return h>1&&(h-=1),new se(s,h,Math.floor((r+n)/2*l))}(i),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new tL("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(e){var i;for(let e in this.tiles){let i=this.tiles[e];"loaded"!==i.state&&(i.state="loaded",i.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;let r=uC(new se(0,0,0),this.map.transform.projection),a=[r.projection.project(this.coordinates[0][0],this.coordinates[0][1]),r.projection.project(this.coordinates[1][0],this.coordinates[1][1]),r.projection.project(this.coordinates[2][0],this.coordinates[2][1]),r.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(e){let i=e[1].x-e[0].x,r=e[1].y-e[0].y,a=e[2].x-e[1].x,n=e[2].y-e[1].y,s=e[3].x-e[2].x,l=e[3].y-e[2].y,h=e[0].x-e[3].x,u=e[0].y-e[3].y,c=i*n-a*r,d=a*l-s*n,p=s*u-h*l,f=h*r-i*u;return c>0&&d>0&&p>0&&f>0||c<0&&d<0&&p<0&&f<0}(a))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);let n=uC(this.tileID,this.map.transform.projection),[s,l,h,u]=this.coordinates.map(e=>{let i=n.projection.project(e[0],e[1]);return uP(n,i)._round()});this.perspectiveTransform=ci(s.x,s.y,l.x,l.y,h.x,h.y,u.x,u.y);let c=this._boundsArray=new nl;c.emplaceBack(s.x,s.y,0,0),c.emplaceBack(l.x,l.y,8192,0),c.emplaceBack(u.x,u.y,0,8192),c.emplaceBack(h.x,h.y,8192,8192),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=e.createVertexBuffer(c,u6.members),this.boundsSegments=n0.simpleSegment(0,0,4,2);let d=[],[p,f,m,_]=function(e){let i=e[0][0],r=i,a=e[0][1],n=a;for(let s=1;s<e.length;s++)e[s][0]<i?i=e[s][0]:e[s][0]>r&&(r=e[s][0]),e[s][1]<a?a=e[s][1]:e[s][1]>n&&(n=e[s][1]);return[i,a,r-i,n-a]}([cr((i=this.coordinates)[0]),cr(i[1]),cr(i[2]),cr(i[3])]);{let i=new nl,[n,s,l,h]=function(e){let i=e[0].x,r=i,a=e[0].y,n=a;for(let s=1;s<e.length;s++)e[s].x<i?i=e[s].x:e[s].x>r&&(r=e[s].x),e[s].y<a?a=e[s].y:e[s].y>n&&(n=e[s].y);return[i,a,r-i,n-a]}(a),u=e=>[(e.x-n)/l,(e.y-s)/h],[c,g,y,x]=a.map(u),v=function(e,i,r,a,n,s,l,h){let u=ct(0,0,1,0,1,1,0,1),c=ct(e,i,r,a,n,s,l,h),d=eS.mat3.adjoint([],c);return eS.mat3.multiply(u,u,d)}(c[0],c[1],g[0],g[1],y[0],y[1],x[0],x[1]);this.elevatedGlobePerspectiveTransform=ci(c[0],c[1],g[0],g[1],y[0],y[1],x[0],x[1]);let b=(e,r)=>{d.push(e.lng);let a=Math.round((e.lng-p)/m*8192),n=Math.round((e.lat-f)/_*8192),s=u(r),l=eS.vec3.transformMat3([],[s[0],s[1],1],v),h=Math.round(l[0]/l[2]*8192),c=Math.round(l[1]/l[2]*8192);i.emplaceBack(a,n,h,c)},w=a[3].x-a[0].x,T=a[3].y-a[0].y,S=a[2].x-a[1].x,M=a[2].y-a[1].y;for(let e=0;e<65;e++){let i=e/64,n=[a[0].x+i*w,a[0].y+i*T],s=[a[1].x+i*S,a[1].y+i*M],l=s[0]-n[0],h=s[1]-n[1];for(let e=0;e<65;e++){let i=e/64,a={x:n[0]+l*i,y:n[1]+h*i,z:0};b(r.projection.unproject(a.x,a.y),a)}}this.elevatedGlobeVertexBuffer=e.createVertexBuffer(i,u6.members)}{this.maxLongitudeTriangleSize=0;let i=[],r=new nS,a=(e,a,n)=>{r.emplaceBack(e,a,n);let s=d[e],l=d[a],h=d[n],u=Math.min(Math.min(s,l),h),c=Math.max(Math.max(s,l),h)-u;c>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=c),i.push(u+c/2)};for(let e=0;e<64;e++)for(let i=0;i<64;i++){let r=65*e+i,n=r+1,s=r+65,l=s+1;a(r,s,n),a(n,s,l)}[i,r]=function(e,i){let r=Array.from({length:e.length},(e,i)=>i);r.sort((i,r)=>e[i]-e[r]);let a=[],n=new nS;for(let s=0;s<r.length;s++){let l=r[s];a.push(e[l]);let h=3*l,u=h+1;n.emplaceBack(i.uint16[h],i.uint16[u],i.uint16[u+1])}return[a,n]}(i,r),this.elevatedGlobeTrianglesCenterLongitudes=i,this.elevatedGlobeIndexBuffer=e.createIndexBuffer(r)}this.elevatedGlobeSegments=n0.simpleSegment(0,0,4225,8192),this.elevatedGlobeGridMatrix=new Float32Array([0,m/8192,0,_/8192,0,0,f,p,0])}prepare(){let e=0!==Object.keys(this.tiles).length;if(this.tileID&&!e)return;let i=this.map.painter.context,r=i.gl;!this._dirty||this.texture instanceof ce||(this.texture?this.texture.update(this.image):(this.texture=new u7(i,this.image,r.RGBA8),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE)),this._dirty=!1),e&&this._prepareData(i)}loadTile(e,i){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored",i(null)}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}getSegmentsForLongitude(e){var i;let r=this.elevatedGlobeSegments;if(!this.elevatedGlobeTrianglesCenterLongitudes||!r)return null;let a=this.elevatedGlobeTrianglesCenterLongitudes,n=(i=e+180)+360*Math.round((a[0]-i)/360),s=new n0,l=(e,i)=>{s.segments.push({vertexOffset:0,primitiveOffset:e,vertexLength:r.segments[0].vertexLength,primitiveLength:i,sortKey:void 0,vaos:{}})},h=.51*this.maxLongitudeTriangleSize;if(Math.abs(a[0]-n)<=h){let e=e3(a,0,a.length,n+h);return e===a.length||l(e,e2(a,e+1,a.length,n+360-h)-e),s}n<a[0]&&(n+=360);let u=e2(a,0,a.length,n-h);if(u===a.length)return l(0,a.length),s;l(0,u-0);let c=e3(a,u+1,a.length,n+h);return c!==a.length&&l(c,a.length-c),s}}class cn extends ne{constructor(e,i,r,a){super(e,{layout:z||(z=ne
212w aZ({visibility:new aW(aX.layout_raster.visibility)})),paint:D||(D=new aZ({"raster-opacity":new aW(aX.paint_raster["raster-opacity"]),"raster-color":new aH(aX.paint_raster["raster-color"]),"raster-color-mix":new aW(aX.paint_raster["raster-color-mix"]),"raster-color-range":new aW(aX.paint_raster["raster-color-range"]),"raster-hue-rotate":new aW(aX.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new aW(aX.paint_raster["raster-brightness-min"]),"raster-brightness-max":new aW(aX.paint_raster["raster-brightness-max"]),"raster-saturation":new aW(aX.paint_raster["raster-saturation"]),"raster-contrast":new aW(aX.paint_raster["raster-contrast"]),"raster-resampling":new aW(aX.paint_raster["raster-resampling"]),"raster-fade-duration":new aW(aX.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new aW(aX.paint_raster["raster-emissive-strength"]),"raster-array-band":new aW(aX.paint_raster["raster-array-band"]),"raster-elevation":new aW(aX.paint_raster["raster-elevation"])}))},i,r,a),this.updateColorRamp(),this._curRampRange=[NaN,NaN]}getProgramIds(){return["raster"]}hasColorMap(){return!!this._transitionablePaint._values["raster-color"].value.value}tileCoverLift(){return this.paint.get("raster-elevation")}isDraped(e){return!(e&&e._source instanceof ca&&(e._source.onNorthPole||e._source.onSouthPole))&&0===this.paint.get("raster-elevation")}_handleSpecialPaintPropertyUpdate(e){"raster-color"!==e&&"raster-color-range"!==e||(this._curRampRange=[NaN,NaN],this.updateColorRamp())}updateColorRamp(e){if(!this.hasColorMap()||!this._curRampRange)return;let i=this._transitionablePaint._values["raster-color"].value.expression,[r,a]=e||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];isNaN(r)&&isNaN(a)||r===this._curRampRange[0]&&a===this._curRampRange[1]||(this.colorRamp=sQ({expression:i,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:r,end:a}],resolution:256}),this.colorRampTexture=null,this._curRampRange=[r,a])}}class co extends ne{constructor(e,i,r,a){super(e,{layout:O||(O=new aZ({visibility:new aW(aX["layout_raster-particle"].visibility)})),paint:B||(B=new aZ({"raster-particle-array-band":new aW(aX["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new aW(aX["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new aH(aX["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new aW(aX["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new aW(aX["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new aW(aX["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new aW(aX["paint_raster-particle"]["raster-particle-reset-rate-factor"]),"raster-particle-elevation":new aW(aX["paint_raster-particle"]["raster-particle-elevation"])}))},i,r,a),this._updateColorRamp(),this.lastInvalidatedAt=te.now()}onRemove(e){this.colorRampTexture&&this.colorRampTexture.destroy(),this.tileFramebuffer&&this.tileFramebuffer.destroy(),this.particleFramebuffer&&this.particleFramebuffer.destroy()}hasColorMap(){return!!this._transitionablePaint._values["raster-particle-color"].value.value}getProgramIds(){return["rasterParticle"]}hasOffscreenPass(){return"none"!==this.visibility}isDraped(e){return!1}_handleSpecialPaintPropertyUpdate(e){"raster-particle-color"!==e&&"raster-particle-max-speed"!==e||(this._updateColorRamp(),this._invalidateAnimationState()),"raster-particle-count"===e&&this._invalidateAnimationState()}_updateColorRamp(){if(!this.hasColorMap())return;let e=this._transitionablePaint._values["raster-particle-color"].value.expression,i=this._transitionablePaint._values["raster-particle-max-speed"].value.expression.evaluate({zoom:0});this.colorRamp=sQ({expression:e,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:i}],resolution:256}),this.colorRampTexture=null}_invalidateAnimationState(){this.lastInvalidatedAt=te.now()}tileCoverLift(){return this.paint.get("raster-particle-elevation")}}class cs extends ne{constructor(e,i){super(e,{},i,null),this.implementation=e,e.slot&&(this.slot=e.slot)}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}isDraped(e){return void 0!==this.implementation.renderToTile}shouldRedrape(){return!!this.implementation.shouldRerenderTiles&&this.implementation.shouldRerenderTiles()}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(e){this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)}onRemove(e){this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)}}function cl(e,i,r){let a=[0,0,1],n=eS.quat.identity([]);return eS.quat.rotateY(n,n,r?-(e*eC)+Math.PI:e*eC),eS.quat.rotateX(n,n,-(i*eC)),eS.vec3.transformQuat(a,a,n),eS.vec3.normalize(a,a)}function ch(e,i){let r=cc(e.projection,e.zoom,e.width,e.height),a=function(e,i,r,a,n){let s=new oA(r.lng-180*cd,r.lat),l=new oA(r.lng+180*cd,r.lat),h=e.project(s.lng,s.lat),u=e.project(l.lng,l.lat),c=-Math.atan2(u.y-h.y,u.x-h.x),d=oF.fromLngLat(r);d.y=eD(d.y,-1+cd,1-cd);let p=d.toLngLat(),f=e.project(p.lng,p.lat),m=oF.fromLngLat(p);m.x+=cd;let _=m.toLngLat(),g=e.project(_.lng,_.lat),y=cf(g.x-f.x,g.y-f.y,c),x=oF.fromLngLat(p);x.y+=cd;let v=x.toLngLat(),b=e.project(v.lng,v.lat),w=cf(b.x-f.x,b.y-f.y,c),T=Math.abs(y.x)/Math.abs(w.y),S=eS.mat4.identity([]);eS.mat4.rotateZ(S,S,-c*(1-(n?0:a)));let M=eS.mat4.identity([]);return eS.mat4.scale(M,M,[1,1-(1-T)*a,1]),M[4]=-w.x/w.y*a,eS.mat4.rotateZ(M,M,c),eS.mat4.multiply(M,S,M),M}
212(e.projection,0,e.center,r,i),n=cu(e);return eS.mat4.scale(a,a,[n,n,1]),a}function cu(e){let i=e.projection,r=cc(e.projection,e.zoom,e.width,e.height);return Math.pow(2,cp(i,e.center)*r+(1-r)*cp(i,oA.convert(i.center)))}function cc(e,i,r,a,n=1/0){let s=e.range;if(!s)return 0;let l=Math.log(Math.min(n,Math.max(r,a))/1024)/Math.LN2;return eO(s[0]+l,s[1]+l,i)}let cd=1/4e4;function cp(e,i){let r=eD(i.lat,-85.051129,85.051129),a=new oA(i.lng-180*cd,r),n=new oA(i.lng+180*cd,r),s=e.project(a.lng,r),l=e.project(n.lng,r),h=oF.fromLngLat(a),u=oF.fromLngLat(n),c=l.x-s.x,d=l.y-s.y,p=u.x-h.x,f=u.y-h.y;return Math.log(Math.sqrt((p*p+f*f)/(c*c+d*d)))/Math.LN2}function cf(e,i,r){let a=Math.cos(r),n=Math.sin(r);return{x:e*a-i*n,y:e*n+i*a}}function cm(e,i,r){eS.mat4.identity(e),eS.mat4.rotateZ(e,e,i[2]*eC),eS.mat4.rotateX(e,e,i[0]*eC),eS.mat4.rotateY(e,e,i[1]*eC),eS.mat4.scale(e,e,r),eS.mat4.multiply(e,e,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function c_(e,i,r,a,n,s,l,h){let u=[r[0]-i[0],r[1]-i[1],0],c=[a[0]-i[0],a[1]-i[1],0];if(1e-12>eS.vec3.length(u)||1e-12>eS.vec3.length(c))return eS.quat.identity(e);let d=eS.vec3.cross([],u,c);return eS.vec3.normalize(d,d),eS.vec3.subtract(c,a,i),u[2]=(s-n)*h,c[2]=(l-n)*h,eS.vec3.cross(u,u,c),eS.vec3.normalize(u,u),eS.quat.rotationTo(e,d,u)}function cg(e,i,r=!1){let a=sD(i.zoom),n=function(e,i,r){let a=i.worldSize,n=[e[12],e[13],e[14]],s=oR(n[1]/a),l=ok(n[0]/a),h=eS.mat4.identity([]),u=1/oC(s)*a,c=1/oC(0)*a*oD(s,i.zoom),d=1/sk(a),p=c*d;if(r){let e=cc(i.projection,i.zoom,i.width,i.height,1024);p=d*i.projection.pixelSpaceConversion(i.center.lat,a,e)}let f=oM(s,l);eS.vec3.add(f,f,eS.vec3.scale([],eS.vec3.normalize([],f),u*p*n[2]));let m=function(e){let i=[e[0],e[1],e[2]],r=[0,1,0],a=eS.vec3.cross([],r,i);return eS.vec3.cross(r,i,a),0===eS.vec3.squaredLength(r)&&(r=[0,1,0],eS.vec3.cross(a,i,r)),eS.vec3.normalize(a,a),eS.vec3.normalize(r,r),eS.vec3.normalize(i,i),[a[0],a[1],a[2],0,r[0],r[1],r[2],0,i[0],i[1],i[2],0,e[0],e[1],e[2],1]}(f);eS.mat4.scale(h,h,[p,p,p*u]),eS.mat4.translate(h,h,[-n[0],-n[1],-n[2]]);let _=eS.mat4.multiply([],i.globeMatrix,m);return eS.mat4.multiply(_,_,h),eS.mat4.multiply(_,_,e),_}(e,i,r);return a>0?function(e,i,r){let a=(e,i,r)=>{let a=eS.vec3.length(e),n=eS.vec3.length(i),s=sw(e,i,r);return eS.vec3.scale(s,s,1/eS.vec3.length(s)*tU(a,n,r))},n=a([e[0],e[1],e[2]],[i[0],i[1],i[2]],r),s=a([e[4],e[5],e[6]],[i[4],i[5],i[6]],r),l=a([e[8],e[9],e[10]],[i[8],i[9],i[10]],r),h=sw([e[12],e[13],e[14]],[i[12],i[13],i[14]],r);return[n[0],n[1],n[2],0,s[0],s[1],s[2],0,l[0],l[1],l[2],0,h[0],h[1],h[2],1]}(n,function(e,i){let r=i.worldSize,a=1/oC(0)*r*oD(i.center.lat,i.zoom)/sk(r),n=1/oC(i.center.lat)*r,s=eS.mat4.identity([]);return eS.mat4.rotateY(s,s,i.center.lng*eC),eS.mat4.rotateX(s,s,i.center.lat*eC),eS.mat4.translate(s,s,[0,0,ob]),eS.mat4.scale(s,s,[a,a,a*n]),eS.mat4.translate(s,s,[i.point.x-.5*r,i.point.y-.5*r,0]),eS.mat4.multiply(s,s,e),eS.mat4.multiply(s,i.globeMatrix,s)}(e,i),a):n}function cy(e,i,r,a){let n;let s=sm.projectAabbCorners(a,r),l=Number.MAX_VALUE,h=-1;for(let e=0;e<s.length;++e){let r=s[e];r[0]=(.5*r[0]+.5)*i.width,r[1]=(.5-.5*r[1])*i.height,r[2]<l&&(h=e,l=r[2])}let u=e=>new eA(s[e][0],s[e][1]);switch(h){case 0:case 6:n=[u(1),u(5),u(4),u(7),u(3),u(2),u(1)];break;case 1:case 7:n=[u(0),u(4),u(5),u(6),u(2),u(3),u(0)];break;case 3:case 5:n=[u(1),u(0),u(4),u(7),u(6),u(2),u(1)];break;default:n=[u(1),u(5),u(6),u(7),u(3),u(0),u(1)]}if(o$(e,n))return l}let cx=na([{name:"a_pos_3f",components:3,type:"Float32"}]),cv=na([{name:"a_color_3f",components:3,type:"Float32"}]),cb=na([{name:"a_color_4f",components:4,type:"Float32"}]),cw=na([{name:"a_uv_2f",components:2,type:"Float32"}]),cT=na([{name:"a_normal_3f",components:3,type:"Float32"}]),cS=na([{name:"a_normal_matrix0",components:4,type:"Float32"},{name:"a_normal_matrix1",components:4,type:"Float32"},{name:"a_normal_matrix2",components:4,type:"Float32"},{name:"a_normal_matrix3",components:4,type:"Float32"}]),cM=na([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]),cE={None:0,Model:1,Symbol:2,FillExtrusion:4,All:7};class cA{constructor(e,i,r,a){this.message=(e?`${e}: `:"")+r,a&&(this.identifier=a),null!=i&&i.__line__&&(this.line=i.__line__)}}function cI(e,i){let r=-1===e.indexOf("://");try{return new URL(e,r&&i?"http://example.com":void 0),!0}catch(e){return!1}}class cC{constructor(e,i){this.feature=e,this.instancedDataOffset=i,this.instancedDataCount=0,this.rotation=[0,0,0],this.scale=[1,1,1],this.translation=[0,0,0]}}class cP{constructor(){this.instancedDataArray=new nD,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}}class cL{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.projection=e.projection,this.index=e.index,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom>this.canonical.z?256:this.zoom>15?75:100,this.instanceCount=0,this.terrainElevationMin=0,this.terrainElevationMax=0,this.validForDEMTile={id:null,timestamp:0},this.modelUris=[],this.modelsRequested=!1,this.activeReplacements=[],this.replacementUpdateTime=0}updateFootprints(e,i){}populate(e,i,r,a){this.tileToMeter=oB(r);let n=this.layers[0]._featureFilter.needGeometry;for(let{feature:s,id:l,index:h,sourceLayerIndex:u}of(this.lookup=new Uint8Array(this.lookupDim*this.lookupDim),e)){let e=null!=l?l:s.properties&&s.properties.hasOwnProperty("id")?s.properties.id:void 0,c=oj(s,n);if(!this.layers[0]._featureFilter.filter(new aO(this.zoom),c,r))continue;let d={id:e,sourceLayerIndex:u,index:h,geometry:n?c.geometry:oU(s,r,a),properties:s.properties,type:s.type,patterns:{}},p=this.addFeature(d,d.geometry,c);p&&i.featureIndex.insert(s,d.geometry,h,u,this.index,this.instancesPerModel[p].instancedDataArray.length,256)}this.lookup=null}update(e,i,r,a){for(let i in this.instancesPerModel){let r=this.instancesPerModel[i];for(let i in e)r.idToFeaturesIndex.hasOwnProperty(i)&&(this.evaluate(r.features[r.idToFeaturesIndex[i]],e[i],r,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let e=!1;for(let i in this.instancesPerModel){let r=this.instancesPerModel[i];for(let i of r.features){let a=this.layers[0],n=i.feature,s=this.canonical,l=a.paint.get("model-rotation").evaluate(n,{},s),h=a.paint.get("model-scale").evaluate(n,{},s),u=a.paint.get("model-translation").evaluate(n,{},s);eS.vec3.exactEquals(i.rotation,l)&&eS.vec3.exactEquals(i.scale,h)&&eS.vec3.exactEquals(i.translation,u)||(this.evaluate(i,i.featureStates,r,!0),e=!0)}}return e}updateReplacement(e,i,r,a){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;let n=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);if(lq(this.activeReplacements,n))return!1;this.activeReplacements=n;let s=!1;for(let i in this.instancesPerModel){let n=this.instancesPerModel[i],l=n.instancedDataArray;for(let i of n.features){let n=i.instancedDataOffset,h=i.instancedDataCount;for(let i=0;i<h;i++){let h=16*(i+n),u=l.float32[h+0],c=u>8192,d=Math.floor(u=c?u-8192:u),p=l.float32[h+1],f=!1;for(let i of this.activeReplacements)if(!lV(i,r,cE.Model,a)&&!(i.min.x>d||d>i.max.x||i.min.y>p||p>i.max.y)&&(f=lZ(lH(d,p,e.canonical,i.footprintTileId.canonical),i.footprint)))break;l.float32[h]=f?u+8192:u,s=s||f!==c}}}return s}isEmpty(){for(let e in this.instancesPerModel)if(0!==this.instancesPerModel[e].instancedDataArray.length)return!1;return!0}uploadPending(){return!this.uploaded}upload(e){if(!this.uploaded)for(let i in this.instancesPerModel){let r=this.instancesPerModel[i];r.instancedDataArray.length<0||0===r.instancedDataArray.length||(r.instancedDataBuffer?r.instancedDataBuffer.updateData(r.instancedDataArray):r.instancedDataBuffer=e.createVertexBuffer(r.
212instancedDataArray,cS.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(){for(let e in this.instancesPerModel){let i=this.instancesPerModel[e];0!==i.instancedDataArray.length&&i.instancedDataBuffer&&i.instancedDataBuffer.destroy()}let e=this.layers[0].modelManager;if(e&&this.modelUris)for(let i of this.modelUris)e.removeModel(i,"")}addFeature(e,i,r){let a=this.layers[0],n=a.layout.get("model-id").evaluate(r,{},this.canonical);if(!n)return eX(`modelId is not evaluated for layer ${a.id} and it is not going to get rendered.`),n;cI(n,!1)&&(this.modelUris.includes(n)||this.modelUris.push(n)),this.instancesPerModel[n]||(this.instancesPerModel[n]=new cP);let s=this.instancesPerModel[n],l=s.instancedDataArray,h=new cC(r,l.length);for(let e of i)for(let i of e){if(i.x<0||i.x>=8192||i.y<0||i.y>=8192)continue;let e=(this.lookupDim-1)/8192,r=this.lookupDim*(i.y*e|0)+i.x*e|0;if(this.lookup){if(0!==this.lookup[r])continue;this.lookup[r]=1}this.instanceCount++;let a=l.length;l.resize(a+1),s.instancesEvaluatedElevation.push(0),l.float32[16*a]=i.x,l.float32[16*a+1]=i.y}return h.instancedDataCount=s.instancedDataArray.length-h.instancedDataOffset,h.instancedDataCount>0&&(e.id&&(s.idToFeaturesIndex[e.id]=s.features.length),s.features.push(h),this.evaluate(h,{},s,!1)),n}getModelUris(){return this.modelUris}evaluate(e,i,r,a){let n=this.layers[0],s=e.feature,l=this.canonical,h=e.rotation=n.paint.get("model-rotation").evaluate(s,i,l),u=e.scale=n.paint.get("model-scale").evaluate(s,i,l),c=e.translation=n.paint.get("model-translation").evaluate(s,i,l),d=n.paint.get("model-color").evaluate(s,i,l);d.a=n.paint.get("model-color-mix-intensity").evaluate(s,i,l);let p=[];this.maxVerticalOffset<c[2]&&(this.maxVerticalOffset=c[2]),this.maxScale=Math.max(Math.max(this.maxScale,u[0]),Math.max(u[1],u[2])),cm(p,h,u);let f=Math.round(100*d.a)+d.b/1.05;for(let i=0;i<e.instancedDataCount;++i){let n=e.instancedDataOffset+i,s=16*n,h=r.instancedDataArray.float32,u=0;a&&(u=h[s+6]-r.instancesEvaluatedElevation[n]);let m=0|h[s+1];h[s]=(0|h[s])+d.r/1.05,h[s+1]=m+d.g/1.05,h[s+2]=f,h[s+3]=1/(l.z>10?this.tileToMeter:oB(l,m)),h[s+4]=c[0],h[s+5]=c[1],h[s+6]=c[2]+u,h[s+7]=p[0],h[s+8]=p[1],h[s+9]=p[2],h[s+10]=p[4],h[s+11]=p[5],h[s+12]=p[6],h[s+13]=p[8],h[s+14]=p[9],h[s+15]=p[10],r.instancesEvaluatedElevation[n]=c[2]}}}af(cL,"ModelBucket",{omit:["layers"]}),af(cP,"PerModelAttributes"),af(cC,"ModelFeature");
212let ck={CoordinateSpaceTile:1,CoordinateSpaceYUp:2,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function cR(e,i,r,a,n,s,l,h,u,c=!1){let d=r.zoom,p=r.project(a),f=oD(a.lat,d),m=1/f;eS.mat4.identity(e),eS.mat4.translate(e,e,[p.x+l[0]*m,p.y+l[1]*m,l[2]]);let _=1,g=1,y=r.worldSize;if(c){if("mercator"===r.projection.name){let e=0;r.elevation&&(e=r.elevation.getAtPointOrZero(new oF(p.x/y,p.y/y),0));let i=eS.vec4.transformMat4([],[p.x,p.y,e,1],r.projMatrix)[3]/r.cameraToCenterDistance;_=i,g=i*oD(r.center.lat,d)}else if("globe"===r.projection.name){let i=cg(e,r),n=eS.mat4.multiply([],r.projMatrix,i),s=[0,0,0,1];eS.vec4.transformMat4(s,s,n);let l=s[3]/r.cameraToCenterDistance,h=sD(d),u=r.projection.pixelsPerMeter(a.lat,y)*oD(a.lat,d),c=r.projection.pixelsPerMeter(r.center.lat,y)*oD(r.center.lat,d);_=l/tU(u,oz(r.center.lat),h),g=l*f/u,_*=c,g*=c}}else _=m;eS.mat4.scale(e,e,[_,_,g]);let x=[...e],v=i.orientation,b=[];if(cm(b,[v[0]+n[0],v[1]+n[1],v[2]+n[2]],s),eS.mat4.multiply(e,x,b),h&&r.elevation){let n=0,s=[];if(u&&r.elevation){n=function(e,i,r,a,n){let s=i.elevation;if(!s)return 0;let l=sm.projectAabbCorners(r,a),h=1/oC(n.lat)*i.worldSize,u=function(e,i){let r=[0,0,1],a=[{corners:[0,1,3,2],dotProductWithUp:0},{corners:[1,5,2,6],dotProductWithUp:0},{corners:[0,4,1,5],dotProductWithUp:0},{corners:[2,6,3,7],dotProductWithUp:0},{corners:[4,7,5,6],dotProductWithUp:0},{corners:[0,3,4,7],dotProductWithUp:0}];for(let n of a){let a=e[n.corners[0]],s=e[n.corners[1]],l=e[n.corners[2]],h=[s[0]-a[0],s[1]-a[1],i*(s[2]-a[2])],u=eS.vec3.cross(h,h,[l[0]-a[0],l[1]-a[1],i*(l[2]-a[2])]);eS.vec3.normalize(u,u),n.dotProductWithUp=eS.vec3.dot(u,r)}return a.sort((e,i)=>e.dotProductWithUp-i.dotProductWithUp),a[0].corners}(l,h),c=l[u[0]],d=l[u[1]],p=l[u[2]],f=l[u[3]],m=s.getAtPointOrZero(new oF(c[0]/i.worldSize,c[1]/i.worldSize),0),_=s.getAtPointOrZero(new oF(d[0]/i.worldSize,d[1]/i.worldSize),0),g=s.getAtPointOrZero(new oF(p[0]/i.worldSize,p[1]/i.worldSize),0),y=s.getAtPointOrZero(new oF(f[0]/i.worldSize,f[1]/i.worldSize),0),x=(m+y)/2,v=(_+g)/2;return x>v?_<g?c_(e,d,f,c,_,y,m,h):c_(e,p,c,f,g,m,y,h):m<y?c_(e,c,d,p,m,_,g,h):c_(e,f,p,d,y,g,_,h),Math.max(x,v)}(s,r,i.aabb,e,a);let l=eS.mat4.fromQuat([],s),h=eS.mat4.multiply([],l,b);eS.mat4.multiply(e,x,h)}else n=r.elevation.getAtPointOrZero(new oF(p.x/y,p.y/y),0);0!==n&&(e[14]+=n)}}function cz(e,i,r=!1){e.uploaded||(e.gfxTexture=new u7(i,e.image,r?i.gl.R8:i.gl.RGBA8,{useMipmap:e.sampler.minFilter>=i.gl.NEAREST_MIPMAP_NEAREST}),e.uploaded=!0,e.image=null)}function cD(e,i,r){if(e.meshes)for(let a of e.meshes)!function(e,i,r){e.indexBuffer=i.createIndexBuffer(e.indexArray,!1,!0),e.vertexBuffer=i.createVertexBuffer(e.vertexArray,cx.members,!1,!0),e.normalArray&&(e.normalBuffer=i.createVertexBuffer(e.normalArray,cT.members,!1,!0)),e.texcoordArray&&(e.texcoordBuffer=i.createVertexBuffer(e.texcoordArray,cw.members,!1,!0)),e.colorArray&&(e.colorBuffer=i.createVertexBuffer(e.colorArray,(12===e.colorArray.bytesPerElement?cv:cb).members,!1,!0)),e.featureArray&&(e.pbrBuffer=i.createVertexBuffer(e.featureArray,cM.members,!0)),e.segments=n0.simpleSegment(0,0,e.vertexArray.length,e.indexArray.length);let a=e.material;a.pbrMetallicRoughness.baseColorTexture&&cz(a.pbrMetallicRoughness.baseColorTexture,i),a.pbrMetallicRoughness.metallicRoughnessTexture&&cz(a.pbrMetallicRoughness.metallicRoughnessTexture,i),a.normalTexture&&cz(a.normalTexture,i),a.occlusionTexture&&cz(a.occlusionTexture,i,r),a.emissionTexture&&cz(a.emissionTexture,i)}(a,i,r);if(e.children)for(let a of e.children)cD(a,i,r)}function cO(e){if(e.meshes)for(let i of e.meshes)i.indexArray.destroy(),i.vertexArray.destroy(),i.colorArray&&i.colorArray.destroy(),i.normalArray&&i.normalArray.destroy(),i.texcoordArray&&i.texcoordArray.destroy(),i.featureArray&&i.featureArray.destroy();if(e.children)for(let i of e.children)cO(i)}function cB(e){var i;if(e.meshes)for(let r of e.meshes)r.vertexBuffer&&(r.vertexBuffer.destroy(),r.indexBuffer.destroy(),r.normalBuffer&&r.n
212ormalBuffer.destroy(),r.texcoordBuffer&&r.texcoordBuffer.destroy(),r.colorBuffer&&r.colorBuffer.destroy(),r.pbrBuffer&&r.pbrBuffer.destroy(),r.segments.destroy(),r.material&&((i=r.material).pbrMetallicRoughness.baseColorTexture&&i.pbrMetallicRoughness.baseColorTexture.gfxTexture&&i.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),i.pbrMetallicRoughness.metallicRoughnessTexture&&i.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&i.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),i.normalTexture&&i.normalTexture.gfxTexture&&i.normalTexture.gfxTexture.destroy(),i.emissionTexture&&i.emissionTexture.gfxTexture&&i.emissionTexture.gfxTexture.destroy(),i.occlusionTexture&&i.occlusionTexture.gfxTexture&&i.occlusionTexture.gfxTexture.destroy()));if(e.children)for(let i of e.children)cB(i)}class cF{constructor(e,i,r){this._demTile=e,this._dem=this._demTile.dem,this._scale=i,this._offset=r}static create(e,i,r){let a=r||e.findDEMTileFor(i);if(!a||!a.dem)return;let n=a.dem,s=a.tileID,l=1<<i.canonical.z-s.canonical.z;return new cF(a,n.dim/8192/l,[(i.canonical.x/l-s.canonical.x)*n.dim,(i.canonical.y/l-s.canonical.y)*n.dim])}tileCoordToPixel(e,i){let r=i*this._scale+this._offset[1];return new eA(Math.floor(e*this._scale+this._offset[0]),Math.floor(r))}getElevationAt(e,i,r,a){let n=e*this._scale+this._offset[0],s=i*this._scale+this._offset[1],l=Math.floor(n),h=Math.floor(s),u=this._dem;return a=!!a,r?tU(tU(u.get(l,h,a),u.get(l,h+1,a),s-h),tU(u.get(l+1,h,a),u.get(l+1,h+1,a),s-h),n-l):u.get(l,h,a)}getElevationAtPixel(e,i,r){return this._dem.get(e,i,!!r)}getMeterToDEM(e){return(1<<this._demTile.tileID.canonical.z)*(1/oC(e))*this._dem.stride}}let cN=new Float32Array(262144),cV=new Uint8Array(262144),cU=["","wall","door","roof","window","lamp","logo"];class cj{constructor(e){this.node=e,this.evaluatedRMEA=[[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[.4,1,0,1],[1,0,0,1],[1,0,0,1]],this.hiddenByReplacement=!1,this.evaluatedScale=[1,1,1],this.evaluatedColor=[],this.emissionHeightBasedParams=[],this.cameraCollisionOpacity=1,this.feature={type:"Point",id:e.id,geometry:[],properties:{height:function e(i){let r=0;if(i.meshes)for(let e of i.meshes)r=Math.max(r,e.aabb.max[2]);if(i.children)for(let a of i.children)r=Math.max(r,e(a));return r}(e)}},this.aabb=this._getLocalBounds()}_getLocalBounds(){if(!this.node.meshes)return new sm([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let e=0,i=new sm([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(let r of this.node.meshes)this.node.lightMeshIndex!==e&&(r.transformedAabb=sm.applyTransformFast(r.aabb,this.node.matrix),i.encapsulate(r.transformedAabb)),e++;this.aabb=i}return this.aabb}}class cG{constructor(e,i,r,a,n,s,l){for(let h of(this.id=r,this.layers=e,this.layerIds=this.layers.map(e=>e.fqid),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.modelTraits|=ck.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,a&&(this.modelTraits|=ck.HasMapboxMeshFeatures),n&&(this.modelTraits|=ck.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=s,this.dirty=!0,this.needsUpload=!1,this.nodesInfo=[],i))this.nodesInfo.push(new cj(h)),function e(i,r,a){if(i.meshes)for(let e of i.meshes){if(e.aabb.min[0]===1/0)continue;let n=sm.applyTransform(e.aabb,i.matrix);a.insert(r,n.min[0],n.min[1],n.max[0],n.max[1])}if(i.children)for(let n of i.children)e(n,r,a)}(h,l.featureIndexArray.length,l.grid),l.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,l.bucketLayerIDs.length-1,0)}updateFootprints(e,i){for(let r of this.getNodesInfo()){let a=r.node;a.footprint&&i.push({footprint:a.footprint,id:e})}}update(e){let i=0!==Object.keys(e).length;if(!i||this.stateDependentLayers.length)for(let r of i?this.stateDependentLayers:this.layers)this.evaluate(r,e)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(e){if(!this.needsUpload)return;let i=this.getNodesInfo();for(let r of i){let i=r.node;this.uploaded?this.updatePbrBuffer(i):cD(i,e,!0)}
212for(let e of i)cO(e.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(e){let i=!1;if(!e.meshes)return i;for(let r of e.meshes)r.pbrBuffer&&(r.pbrBuffer.updateData(r.featureArray),i=!0);return i}needsReEvaluation(e,i,r){let a=e.transform.projectionOptions,n=e.style.getBrightness(),s=this.brightness!==n;return!!(!this.uploaded||this.dirty||a.name!==this.projection.name||cq(r.paint.get("model-color").value,s)||cq(r.paint.get("model-color-mix-intensity").value,s)||cq(r.paint.get("model-roughness").value,s)||cq(r.paint.get("model-emissive-strength").value,s)||cq(r.paint.get("model-height-based-emissive-strength-multiplier").value,s))&&(this.projection=a,this.brightness=n,!0)}evaluateScale(e,i){if(e.transform.zoom===this.zoom)return;this.zoom=e.transform.zoom;let r=this.getNodesInfo(),a=this.id.canonical;for(let e of r){let r=e.feature;e.evaluatedScale=i.paint.get("model-scale").evaluate(r,{},a)}}evaluate(e,i){for(let r of this.getNodesInfo()){if(!r.node.meshes)continue;let a=r.feature,n=i&&i[a.id],s=r.node.meshes&&r.node.meshes[0].featureData,l=r.evaluatedColor[2],h=r.evaluatedRMEA[2],u=this.id.canonical;if(r.hasTranslucentParts=!1,s){for(let i=0;i<cU.length;i++){let s=cU[i];s.length&&(a.properties.part=s);let l=e.paint.get("model-color").evaluate(a,n,u).toRenderColor(null),h=e.paint.get("model-color-mix-intensity").evaluate(a,n,u);r.evaluatedColor[i]=[l.r,l.g,l.b,h],r.evaluatedRMEA[i][0]=e.paint.get("model-roughness").evaluate(a,n,u),r.evaluatedRMEA[i][2]=e.paint.get("model-emissive-strength").evaluate(a,n,u),r.evaluatedRMEA[i][3]=l.a,r.emissionHeightBasedParams[i]=e.paint.get("model-height-based-emissive-strength-multiplier").evaluate(a,n,u),!r.hasTranslucentParts&&l.a<1&&(r.hasTranslucentParts=!0)}delete a.properties.part,function(e,i,r){let a=e.node,n=0,s=r&ck.HasMeshoptCompression;for(let r of a.meshes){if(a.lights&&a.lightMeshIndex===n||!r.featureData)continue;r.featureArray=new nO,r.featureArray.reserve(r.featureData.length);let l=i;for(let i of r.featureData){let n;let h=s?65535&i:i>>16&65535,u=s?i>>16&65535:65535&i,c=(15&u)<8?15&u:0,d=e.evaluatedRMEA[c],p=e.evaluatedColor[c],f=e.emissionHeightBasedParams[c];if(l&&2===c&&a.lights&&(n=new nO).resize(10*a.lights.length),function(e,i,r,a,n,s,l,h){let u,c,d,p,f=(61440&i|(61440&i)>>4)>>8,m=(3840&i|(3840&i)>>4)>>4,_=240&i|(240&i)>>4;r[3]>0&&(f=tU(f,255*r[0],r[3]),m=tU(m,255*r[1],r[3]),_=tU(_,255*r[2],r[3]));let g=f<<8|m,y=_<<8|Math.floor(255*a[3]),x=Math.min(Math.round(.5*eD(a[2],0,2)*255),255)<<8|15*a[0]<<4|15*a[1],v=eD(n[0],0,1),b=eD(n[1],0,1),w=eD(n[2],0,1),T=eD(n[3],0,1);if(v!==b&&l!==s&&b!==v){let e=l-s;c=1/(e*(b-v)),d=-(s+e*v)/(e*(b-v)),p=Math.pow(10,eD(n[4],-1,1)),u=255*w<<8|255*T}else u=65535,c=0,d=1,p=1;if(e.emplaceBack(g,y,x,u,c,d,p),h){let e=h.length;h.clear();for(let i=0;i<e;i++)h.emplaceBack(g,y,x,u,c,d,p)}}(r.featureArray,h,p,d,f,r.aabb.min[2],r.aabb.max[2],n),n&&l){l=!1;let e=a.meshes[a.lightMeshIndex];e.featureArray=n,e.featureArray._trim()}}r.featureArray._trim(),n++}}(r,l!==r.evaluatedColor[2]||h!==r.evaluatedRMEA[2],this.modelTraits)}else r.evaluatedRMEA[0][2]=e.paint.get("model-emissive-strength").evaluate(a,n,u);r.evaluatedScale=e.paint.get("model-scale").evaluate(a,n,u),this.updatePbrBuffer(r.node)||(this.needsUpload=!0)}this.dirty=!1}elevationUpdate(e,i,r,a){let n=e.findDEMTileFor(r);if(n&&(n.tileID.canonical!==this.terrainTile||i!==this.terrainExaggeration)){if(n.dem&&n.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=n.tileID.overscaledZ;let i=cF.create(e,r,n);if(!i)return;for(let n of(this.modelTraits&ck.HasMapboxMeshFeatures&&this.updateDEM(e,i,r,a),this.getNodesInfo())){let e=n.node;if(!e.footprint||!e.footprint.vertices||!e.footprint.vertices.length)continue;let r=e.footprint.vertices,a=i.getElevationAt(r[0].x,r[0].y,!0,!0);for(let e=1;e<r.length;e++)a=Math.min(a,i.getElevationAt(r[e].x,r[e].y,!0,!0));e.elevation=a}}this.terrainTile=n.tileID.canonical,this.terrainExaggeration=i}}updateDEM(e,i,r,a){let n=i._dem._modifiedForSources[a];if(void 0===n&&(i._dem._modifiedForSources[a]=[],n=i._dem._modifiedForSources[a]),n.includes(r.canonical))return;let s=i._dem.dim;n.push(r.canonical);let l=!1;for(let e of this.getNodesInfo()){let r=e.node;if(!r.footprint||!r.footprint.grid)continue;let a=r.footprint.grid,n=i.tileCoordToPixel(a.min.x,a.min.y),h=i.tileCoordToPixel(a.max.x,a.max.y),u=Math.min(Math.min(s-h.y,n.x),Math.min(n.y,s-h.x));if(u<0)continue;let c=eD(u,2,5),d=Math.max(0,n.x-c),p=Math.max(0,n.y-c),f=Math.min(h.x+c,s-1),m=Math.min(h.y+c,s-1);for(let e=p;e<=m;++e)for(let i=d;i<=f;
212++i)cV[e*s+i]=255;let _=0,g=0;for(let e=0;e<a.cellsY;++e)for(let r=0;r<a.cellsX;++r){if(!a.cells[e*a.cellsX+r])continue;let n=i.tileCoordToPixel(a.min.x+r/a.xScale,a.min.y+e/a.yScale),l=i.tileCoordToPixel(a.min.x+(r+1)/a.xScale,a.min.y+(e+1)/a.yScale);for(let e=n.y;e<=Math.min(l.y+1,s-1);++e)for(let r=n.x;r<=Math.min(l.x+1,s-1);++r)255===cV[e*s+r]&&(cV[e*s+r]=0,_+=i.getElevationAtPixel(r,e),g++)}let y=_/g;d=Math.max(1,n.x-c),p=Math.max(1,n.y-c),f=Math.min(h.x+c,s-2),m=Math.min(h.y+c,s-2),l=!0;for(let e=p;e<=m;++e)for(let r=d;r<=f;++r)0===cV[e*s+r]&&(cN[e*s+r]=i._dem.set(r,e,y));for(let e=1;e<c;++e){d=Math.max(1,n.x-e),p=Math.max(1,n.y-e),f=Math.min(h.x+e,s-2),m=Math.min(h.y+e,s-2);for(let r=p;r<=m;++r)for(let a=d;a<=f;++a){let n=r*s+a;if(255===cV[n]){let l=0,h=0,u=-1,d=-1;for(let i=-1;i<=1;++i)for(let n=-1;n<=1;++n){let c=(r+i)*s+a+n;if(cV[c]>=e)continue;let p=cN[c],f=Math.abs(p);f>h&&(l=p,h=f,u=n,d=i)}if(h>.1){let s=1-(e+.5*Math.abs(u*d))/c,h=i._dem.get(a,r)+l*s,p=i._dem.get(a+u,r+d),f=i._dem.get(a-u,r-d,!0);(h-p)*(h-f)>0&&(h=(p+f)/2),cN[n]=i._dem.set(a,r,h),cV[n]=e}}}}}l&&(i._demTile.needsDEMTextureUpload=!0,i._dem._timestamp=te.now())}getNodesInfo(){return this.nodesInfo}destroy(){for(let e of this.getNodesInfo())cO(e.node),cB(e.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;let r=i.getReplacementRegionsForTile(e.toUnwrapped()),a=this.getNodesInfo();for(let e=0;e<this.nodesInfo.length;e++){let i=a[e].node;a[e].hiddenByReplacement=!!i.footprint&&!r.find(e=>e.footprint===i.footprint)}}getHeightAtTileCoord(e,i){let r=this.getNodesInfo(),a=[],n=[0,0,0],s=eS.mat4.identity([]);for(let l=0;l<this.nodesInfo.length;l++){let h=r[l],u=h.node.meshes[0],c=u.transformedAabb;if(e<c.min[0]||i<c.min[1]||e>c.max[0]||i>c.max[1])continue;if(!0===h.node.hidden)return{height:1/0,maxHeight:h.feature.properties.height,hidden:!1,verticalScale:h.evaluatedScale[2]};eS.mat4.invert(s,h.node.matrix),n[0]=e,n[1]=i,eS.vec3.transformMat4(n,n,s);let d=(n[0]-u.aabb.min[0])/(u.aabb.max[0]-u.aabb.min[0])*64|0,p=64*Math.min(63,(n[1]-u.aabb.min[1])/(u.aabb.max[1]-u.aabb.min[1])*64|0)+Math.min(63,d),f=u.heightmap[p];if(!(f<0&&h.node.footprint)){if(h.hiddenByReplacement)return;return{height:f,maxHeight:h.feature.properties.height,hidden:!1,verticalScale:h.evaluatedScale[2]}}if(h.node.footprint.grid.query(new eA(e,i),new eA(e,i),a),a.length>0)return{height:void 0,maxHeight:h.feature.properties.height,hidden:h.hiddenByReplacement,verticalScale:h.evaluatedScale[2]}}}}function cq(e,i){return!e.isLightConstant&&i}af(cG,"Tiled3dModelBucket",{omit:["layers"]}),af(cj,"Tiled3dModelFeature");let cW=["id","tile","layer","source","sourceLayer","state"];class c${constructor(e,i,r,a,n){this.type="Feature",this._vectorTileFeature=e,this._z=i,this._x=r,this._y=a,this.properties=e.properties,this.id=n}clone(){let e=new c$(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(e.state={...this.state}),this.layer&&(e.layer={...this.layer}),this.namespace&&(e.namespace=this.namespace),e}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){let e={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(let i of cW)void 0!==this[i]&&(e[i]=this[i]);return e}}function cH(e,i,r,a){let n=1<<e.z;i.lat=oR((a/8192+e.y)/n),i.lng=ok((r/8192+e.x)/n)}let cZ={circle:class extends ne{constructor(e,i,r,a){super(e,{layout:p||(p=new aZ({"circle-sort-key":new a$(aX.layout_circle["circle-sort-key"]),visibility:new aW(aX.layout_circle.visibility)})),paint:f||(f=new aZ({"circle-radius":new a$(aX.paint_circle["circle-radius"]),"circle-color":new a$(aX.paint_circle["circle-color"]),"circle-blur":new a$(aX.paint_circle["circle-blur"]),"circle-opacity":new a$(aX.paint_circle["circle-opacity"]),"circle-translate":new aW(aX.paint_circle["circle-translate"]),"circle-translate-anchor":new aW(aX.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new aW(aX.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new aW(aX.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new a$(aX.paint_circle["circle-stroke-width"]),"circle-stroke-color":new a$(aX.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new a$(aX.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new aW(aX.paint_circle["circle-emissive-strength"])}))},i,r,a)}createBucket(e){return new oW(e)}queryRadius(e){return o3("circle-radius",this,e)+o3("circle-stroke-width",this,e)+o4(this.paint.get("circle-translate"))}queryIntersectsFeature(e,i,r,a,n,s,l,h){let u=o6(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),s.angle,e.pixelToTileUnitsFactor),c=this.paint.get("circle-radius").evaluate(i,r)+this.paint.get("circle-stroke-width").evaluate(i,r);return sG(e,a,s,l,h,"map"===this.paint.get("circle-pitch-alignment"),"map"===this.paint.get("circle-pitch-scale"),u,c)}getProgramIds(){return["circle"]}getDefaultProgramParams(e,i,r){let a=sj(this);return{config:new om(this,{zoom:i,lut:r}),defines:a,overrideFog:!1}}},heatmap:class extends ne{createBucket(e){return new s$(e)}constructor(e,i,r,a){super(e,{layout:m||(m=new aZ({visibility:new aW(aX.layout_heatmap.visibility)})),paint:_||(_=new aZ({"heatmap-radius":new a$(aX.paint_heatmap["heatmap-radius"]),"heatmap-weight":new a$(aX.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new aW(aX.paint_heatmap["heatmap-intensity"]),"heatmap-color":new aH(aX.paint_heatmap["heatmap-color"]),"heatmap-opacity":new aW(aX.paint_heatmap["heatmap-opacity"])}))},i,r,a),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){"heatmap-color"===e&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=sQ({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(e){return o3("heatmap-radius",this,e)}queryIntersectsFeature(e,i,r,a,n,s,l,h){let u=this.paint.get("heatmap-radius").evaluate(i,r);return sG(e,a,s,l,h,!0,!0,new eA(0,0),u)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}getProgramIds(){return["heatmap","heatmapTexture"]}getDefaultProgramParams(e,i,r){return"heatmap"===e?{config:new om(this,{zoom:i,lut:r}),overrideFog:!1}:{}}},hillshade:class extends ne{constructor(e,i,r,a){super(e,{layout:g||(g=new aZ({visibility:new aW(aX.layout_hillshade.visibility)})),paint:y||(y=new aZ({"hillshade-illumination-direction":new aW(aX.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new aW(aX.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new aW(aX.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new aW(aX.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new aW(aX.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new aW(aX.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new aW(aX.paint_hillshade["hillshade-emissive-strength"])}))},i,r,a)}shouldRedrape(){return this.hasOffscreenPass()&&"viewport"===this.paint.get("hillshade-illumination-anchor")}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}getProgramIds(){return["hillshade","hillshadePrepare"]}getDefaultProgramParams(e,i,r){return{overrideFog:!1}}},fill:class extends ne{constructor(e,i,r,a){super(e,{layout:x||(x=new aZ({"fill-sort-key":new a$(aX.layout_fill["fill-sort-key"]),visibility:new aW(aX.layout_fill.visibility),"fill-elevation-reference":new aW(aX.layout_fill["fill-elevation-reference"])})),paint:v||(v=new aZ({"fill-antialias":new aW(aX.paint_fill["fill-antialias"]),"fill-opacity":new a$(aX.paint_fill["fill-opacity"]),"fill-color":new a$(aX.paint_fill["fill-color"]),"fill-outline-color":new a$(aX.paint_fill["fill-outline-color"]),"fill-translate":new aW(aX.paint_fill["fill-translate"]),"fill-translate-anchor":new aW(aX.paint_fill["fill-translate-anchor"]),"fill-pattern":new a$(aX.paint_fill["fill-pattern"]),"fill-emissive-strength":new aW(aX.paint_fill["fill-emissive-strength"]),"fill-z-offset":new a$(aX.paint_fill["fill-z-offset"])}))},i,r,a)}getProgramIds(){let e=this.paint.get("fill-pattern"),i=e&&e.constantOr(1),r=[i?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&r.push(i&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),r}getDefaultProgramParams(e,i,r){return{config:new om(this,{zoom:i,lut:r}),overrideFog:!1}}recalculate(e,i){super.recalculate(e,i);let 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 lc(e)}queryRadius(){return o4(this.paint.get("fill-translate"))}queryIntersectsFeature(e,i,r,a,n,s){return!e.queryGeometry.isAboveHorizon&&oH(o5(e.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),s.angle,e.pixelToTileUnitsFactor),a)}isTileClipped(){return!0}is3D(){return 0!==this.paint.get("fill-z-offset").constantOr(1)}},"fill-extrusion":class extends ne{constructor(e,i,r,a){super(e,{layout:T||(T=new aZ({visibility:new aW(aX["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new aW(aX["layout_fill-extrusion"]["fill-extrusion-edge-radius"])})),paint:S||(S=new aZ({"fill-extrusion-opacity":new aW(aX["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new a$(aX["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new aW(aX["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new aW(aX["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new a$(aX["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new a$(aX["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new a$(aX["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-height-alignment":new aW(aX["paint_fill-extrusion"]["fill-extrusion-height-alignment"]),"fill-extrusion-base-alignment":new aW(aX["paint_fill-extrusion"]["fill-extrusion-base-alignment"]),"fill-extrusion-vertical-gradient":new aW(aX["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new aW(aX["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new aW(aX["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new aW(aX["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new aW(aX["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new aW(aX["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new aW(aX["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new aW(aX["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new a$(aX["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new a$(aX["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new aW(aX["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new aW(aX["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new aW(aX["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new aW(aX["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-emissive-strength":new a$(aX["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]),"fill-extrusion-line-width":new a$(aX["paint_fill-extrusion"]["fill-extrusion-line-width"]),"fill-extrusion-cast-shadows":new aW(aX["paint_fill-extrusion"]["fill-extrusion-cast-shadows"])}))},i,r,a),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(e){return new ht(e)}queryRadius(){return o4(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}hasShadowPass(){return this.paint.get("fill-extrusion-cast-shadows")}cutoffRange(){return this.paint.get("fill-extrusion-cutoff-fade-range")}canCastShadows(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}queryIntersectsFeature(e,i,r,a,n,s,l,h,u){var c,d,p,f;let m=o6(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),s.angle,e.pixelToTileUnitsFactor),_=this.paint.get("fill-extrusion-height").evaluate(i,r),g=this.paint.get("fill-extrusion-base").evaluate(i,r),y=[0,0],x=h&&s.elevation,v=s.elevation?s.elevation.exaggeration():1,b=e.tile.getBucket(this);if(x&&b instanceof ht){let e=b.centroidVertexArray,i=u+1;i<e.length&&(y[0]=e.geta_centroid_pos0(i),y[1]=e.geta_centroid_pos1(i))}if(0===y[0]&&1===y[1])return!1;"globe"===s.projection.name&&(a=hh([a],[new eA(0,0),new eA(8192,8192)],e.tileID.canonical).map(e=>e.polygon).flat());let[w,T]=(c=a,d=x?h:null,p=s.center.lat,f=e.tileID.canonical,"globe"===s.projection.name?function(e,i,r,a,n,s,l,h,u,c,d){let p=[],f=[],m=e.projection.upVectorScale(d,e.center.lat,e.worldSize).metersToTile,_=[0,0,0,1],g=[0,0,0,1],y=(e,i,r,a)=>{e[0]=i,e[1]=r,e[2]=a,e[3]=1},x=hl();for(let v of(r>0&&(r+=x),a+=x,i)){let i=[],x=[];for(let p of v){let f=p.x+n.x,v=p.y+n.y,b=e.projection.projectTilePoint(f,v,d),w=e.projection.upVector(d,p.x,p.y),T=r,S=a;if(l){let e=hd(f,v,r,a,l,h,u,c);T+=e.base,S+=e.top}0!==r?y(_,b.x+w[0]*m*T,b.y+w[1]*m*T,b.z+w[2]*m*T):y(_,b.x,b.y,b.z),y(g,b.x+w[0]*m*S,b.y+w[1]*m*S,b.z+w[2]*m*S),eS.vec3.transformMat4(_,_,s),eS.vec3.transformMat4(g,g,s),i.push(new lz(_[0],_[1],_[2])),x.push(new lz(g[0],g[1],g[2]))}p.push(i),f.push(x)}return[p,f]}(s,c,g,_,m,l,d,y,v,p,f):d?function(e,i,r,a,n,s,l,h,u){let c=[],d=[],p=[0,0,0,1];for(let f of e){let e=[],m=[];for(let c of f){let d=c.x+a.x,f=c.y+a.y,_=hd(d,f,i,r,s,l,h,u);p[0]=d,p[1]=f,p[2]=_.base,p[3]=1,eS.vec4.transformMat4(p,p,n),p[3]=Math.max(p[3],1e-5);let g=new lz(p[0]/p[3],p[1]/p[3],p[2]/p[3]);p[0]=d,p[1]=f,p[2]=_.top,p[3]=1,eS.vec4.transformMat4(p,p,n),p[3]=Math.max(p[3],1e-5);let y=new lz(p[0]/p[3],p[1]/p[3],p[2]/p[3]);e.push(g),m.push(y)}c.push(e),d.push(m)}return[c,d]}(c,g,_,m,l,d,y,v,p):function(e,i,r,a,n){let s=[],l=[],h=n[8]*i,u=n[9]*i,c=n[10]*i,d=n[11]*i,p=n[8]*r,f=n[9]*r,m=n[10]*r,_=n[11]*r;for(let i of e){let e=[],r=[];for(let s of i){let i=s.x+a.x,l=s.y+a.y,g=n[0]*i+n[4]*l+n[12],y=n[1]*i+n[5]*l+n[13],x=n[2]*i+n[6]*l+n[14],v=n[3]*i+n[7]*l+n[15],b=g+h,w=y+u,T=x+c,S=Math.max(v+d,1e-5),M=g+p,E=y+f,A=x+m,I=Math.max(v+_,1e-5);e.push(new lz(b/S,w/S,T/S)),r.push(new lz(M/I,E/I,A/I))}s.push(e),l.push(r)}return[s,l]}(c,g,_,m,l)),S=e.queryGeometry;return function(e,i,r){let a=1/0;
212oH(r,i)&&(a=hc(r,i[0]));for(let n=0;n<i.length;n++){let s=i[n],l=e[n];for(let e=0;e<s.length-1;e++){let i=s[e],n=[i,s[e+1],l[e+1],l[e],i];o$(r,n)&&(a=Math.min(a,hc(r,n)))}}return a!==1/0&&a}(w,T,S.isPointQuery()?S.screenBounds:S.screenGeometry)}},line:class extends ne{constructor(e,i,r,a){let n=hP();super(e,n,i,r,a),n.layout&&(this.layout=new aq(n.layout)),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(e){if("line-gradient"===e){let e=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=e._styleExpression&&e._styleExpression.expression instanceof ru,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}widthExpression(){return this._transitionablePaint._values["line-width"].value.expression}recalculate(e,i){super.recalculate(e,i),this.paint._values["line-floorwidth"]=(I||((I=new hL(hP().paint.properties["line-width"].specification)).useIntegerZoom=!0),I).possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new hw(e)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(e,i,r){let a=hI(this);return{config:new om(this,{zoom:i,lut:r}),defines:a,overrideFog:!1}}queryRadius(e){var i,r;return i=o3("line-width",this,e),((r=o3("line-gap-width",this,e))>0?r+2*i:i)/2+Math.abs(o3("line-offset",this,e))+o4(this.paint.get("line-translate"))}queryIntersectsFeature(e,i,r,a,n,s){var l,h;if(e.queryGeometry.isAboveHorizon)return!1;let u=o5(e.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),s.angle,e.pixelToTileUnitsFactor),c=e.pixelToTileUnitsFactor/2*(l=this.paint.get("line-width").evaluate(i,r),(h=this.paint.get("line-gap-width").evaluate(i,r))>0?h+2*l:l),d=this.paint.get("line-offset").evaluate(i,r);return d&&(a=function(e,i){let r=[],a=new eA(0,0);for(let n=0;n<e.length;n++){let s=e[n],l=[];for(let e=0;e<s.length;e++){let r=s[e],n=s[e+1],h=0===e?a:r.sub(s[e-1])._unit()._perp(),u=e===s.length-1?a:n.sub(r)._unit()._perp(),c=h._add(u)._unit();c._mult(1/(c.x*u.x+c.y*u.y)),l.push(c._mult(i)._add(r))}r.push(l)}return r}(a,d*e.pixelToTileUnitsFactor)),function(e,i,r){for(let a=0;a<i.length;a++){let n=i[a];if(e.length>=3){for(let i=0;i<n.length;
212i++)if(oK(e,n[i]))return!0}if(function(e,i,r){if(e.length>1){if(oZ(e,i))return!0;for(let a=0;a<i.length;a++)if(oX(i[a],e,r))return!0}for(let a=0;a<e.length;a++)if(oX(e[a],i,r))return!0;return!1}(e,n,r))return!0}return!1}(u,a,c)}isTileClipped(){return!0}isDraped(e){let i=this.layout.get("line-z-offset"),r=i.isConstant()&&!i.constantOr(0),a=this.layout.get("line-elevation-reference");return"sea"!==a&&"ground"!==a&&(r||"none"!==a)}},symbol:u5,background:class extends ne{constructor(e,i,r,a){super(e,{layout:k||(k=new aZ({visibility:new aW(aX.layout_background.visibility)})),paint:R||(R=new aZ({"background-pitch-alignment":new aW(aX.paint_background["background-pitch-alignment"]),"background-color":new aW(aX.paint_background["background-color"]),"background-pattern":new aW(aX.paint_background["background-pattern"]),"background-opacity":new aW(aX.paint_background["background-opacity"]),"background-emissive-strength":new aW(aX.paint_background["background-emissive-strength"])}))},i,r,a)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(e,i,r){return{overrideFog:!1}}is3D(){return"viewport"===this.paint.get("background-pitch-alignment")}},raster:cn,"raster-particle":co,sky:class extends ne{constructor(e,i,r,a){super(e,{layout:F||(F=new aZ({visibility:new aW(aX.layout_sky.visibility)})),paint:N||(N=new aZ({"sky-type":new aW(aX.paint_sky["sky-type"]),"sky-atmosphere-sun":new aW(aX.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new aW(aX.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new aW(aX.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new aW(aX.paint_sky["sky-gradient-radius"]),"sky-gradient":new aH(aX.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new aW(aX.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new aW(aX.paint_sky["sky-atmosphere-color"]),"sky-opacity":new aW(aX.paint_sky["sky-opacity"])}))},i,r,a),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){"sky-gradient"===e?this._updateColorRamp():"sky-atmosphere-sun"!==e&&"sky-atmosphere-halo-color"!==e&&"sky-atmosphere-color"!==e&&"sky-atmosphere-sun-intensity"!==e||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=sQ({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(e){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){let i=e.style.light.properties.get("position");return this._lightPosition.azimuthal!==i.azimuthal||this._lightPosition.polar!==i.polar}return!1}getCenter(e,i){if("atmosphere"===this.paint.get("sky-type")){let r=this.paint.get("sky-atmosphere-sun"),a=!r,n=e.style.light,s=n.properties.get("position");return a&&"viewport"===n.properties.get("anchor")&&eX("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),a?cl(s.azimuthal,90-s.polar,i):cl(r[0],90-r[1],i)}let r=this.paint.get("sky-gradient-center");return cl(r[0],90-r[1],i)}isSky(){return!0}markSkyboxValid(e){this._skyboxInvalidated=!1,this._lightPosition=e.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){let e=this.paint.get("sky-type");return"atmosphere"===e?["skyboxCapture","skybox"]:"gradient"===e?["skyboxGradient"]:null}},slot:class extends ne{constructor(e,i,r,a){super(e,{paint:V||(V=new aZ({}))},i,null)}},model:class extends ne{constructor(e,i,r,a){super(e,{layout:U||(U=new aZ({visibility:new aW(aX.layout_model.visibility),"model-id":new a$(aX.layout_model["model-id"])})),paint:j||(j=new aZ({"model-opacity":new aW(aX.paint_model["model-opacity"]),"model-rotation":new a$(aX.paint_model["model-rotation"]),"model-scale":new a$(aX.paint_model["model-scale"]),"model-translation":new a$(aX.paint_model["model-translation"]),"model-color":new a$(aX.paint_model["model-color"]),"model-color-mix-intensity":new a$(aX.paint_model["model-color-mix-intensity"]),"model-type":new aW(aX.paint_model["model-type"]),"model-cast-shadows":new aW(aX.paint_model["model-cast-shadows"]),"model-receive-shadows":new aW(aX.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new aW(aX.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new a$(aX.paint_model["model-emissive-strength"]),"model-roughness":new a$(aX.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new a$(aX.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new aW(aX.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new aW(aX.paint_model["model-front-cutoff"])}))},i,r,a),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(e){return new cL(e)}getProgramIds(){return["model"]}is3D(){return!0}hasShadowPass(){return!0}canCastShadows(){return!0}hasLightBeamPass(){return!0}cutoffRange(){return this.paint.get("model-cutoff-fade-range")}queryRadius(e){return 8191*(e instanceof cG)}queryIntersectsFeature(e,i,r,a,n,s){if(!this.modelManager)return!1;let l=this.modelManager,h=e.tile.getBucket(this);if(!(h&&h instanceof cL))return!1;for(let r in h.instancesPerModel){let a=h.instancesPerModel[r],n=void 0!==i.id?i.id:i.properties&&i.properties.hasOwnProperty("id")?i.properties.id:void 0;if(a.idToFeaturesIndex.hasOwnProperty(n)){let i=a.features[a.idToFeaturesIndex[n]],u=l.getModel(r,this.scope);if(!u)return!1;let c=eS.mat4.create(),d=new oA(0,0),p=h.canonical,f=Number.MAX_VALUE;for(let r=0;r<i.instancedDataCount;++r){let n=16*(i.instancedDataOffset+r),l=a.instancedDataArray.float32,h=[l[n+4],l[n+5],l[n+6]];cH(p,d,l[n],0|l[n+1]),cR(c,u,s,d,i.rotation,i.scale,h,!1,!1,!1),"globe"===s.projection.name&&(c=cg(c,s));let m=eS.mat4.multiply([],s.projMatrix,c),_=e.queryGeometry,g=cy(_.isPointQuery()?_.screenBounds:_.screenGeometry,s,m,u.aabb);null!=g&&(f=Math.min(g,f))}return f!==Number.MAX_VALUE&&f}}return!1}_handleOverridablePaintPropertyUpdate(e,i,r){return!(!this.layout||i.isDataDriven()||r.isDataDriven()||"model-color"!==e&&"model-color-mix-intensity"!==e&&"model-rotation"!==e&&"model-scale"!==e&&"model-translation"!==e&&"model-emissive-strength"!==e)}_isPropertyZoomDependent(e){let i=this._transitionablePaint._values[e];return null!=i&&null!=i.value&&null!=i.value.expression&&i.value.expression instanceof as}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}
212queryIntersectsMatchingFeature(e,i,r,a){let n=e.tile,s=n.getBucket(this),l=null,h=Number.MAX_VALUE;if(!(s&&s instanceof cG))return{queryFeature:l,intersectionZ:h};let u=s.getNodesInfo()[i];if(u.hiddenByReplacement||!u.node.meshes||!r.filter(new aO(n.tileID.overscaledZ),u.feature,n.tileID.canonical))return{queryFeature:l,intersectionZ:h};let c=u.node,d=a.calculatePosMatrix(n.tileID.toUnwrapped(),a.worldSize),p=u.evaluatedScale,f=0;a.elevation&&c.elevation&&(f=c.elevation*a.elevation.exaggeration()),eS.mat4.translate(d,d,[(c.anchor?c.anchor[0]:0)*(p[0]-1),(c.anchor?c.anchor[1]:0)*(p[1]-1),f]),eS.mat4.scale(d,d,p);let m=e.queryGeometry,_=m.isPointQuery()?m.screenBounds:m.screenGeometry,g=function(e){let i=eS.mat4.multiply([],d,e.matrix);eS.mat4.multiply(i,a.expandedFarZProjMatrix,i);for(let r=0;r<e.meshes.length;++r){let n=e.meshes[r];if(r===e.lightMeshIndex)continue;let s=cy(_,a,i,n.aabb);null!=s&&(h=Math.min(s,h))}if(e.children)for(let i of e.children)g(i)};if(g(c),h===Number.MAX_VALUE)return{queryFeature:l,intersectionZ:h};let y=new oA(0,0);cH(n.tileID.canonical,y,u.node.anchor[0],u.node.anchor[1]);let{z:x,x:v,y:b}=n.tileID.canonical;return(l=new c$({},x,v,b,u.feature.id)).properties=u.feature.properties,l.geometry={type:"Point",coordinates:[y.lng,y.lat]},l.layer={...this.serialize(),id:this.fqid},l.state={},l.tile=n.tileID.canonical,{queryFeature:l,intersectionZ:h}}},clip:class extends ne{constructor(e,i,r,a){super(e,{layout:b||(b=new aZ({"clip-layer-types":new aW(aX.layout_clip["clip-layer-types"]),"clip-layer-scope":new aW(aX.layout_clip["clip-layer-scope"])})),paint:w||(w=new aZ({}))},i,r,a)}recalculate(e,i){super.recalculate(e,i)}createBucket(e){return new lf(e)}isTileClipped(){return!0}is3D(){return!0}}};class cX{constructor(e){this._callback=e,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){this._channel=void 0,this._callback=()=>{}}}class cY{constructor(){this.tasks={},this.taskQueue=[],eG(["process"],this),this.invoker=new cX(this.process),this.nextId=0}add(e,i){let r=this.nextId++,a=function({type:e,isSymbolTile:i,zoom:r}){return r=r||0,"message"===e?0:"maybePrepare"!==e||i?"parseTile"!==e||i?"parseTile"===e&&i?300-r:"maybePrepare"===e&&i?400-r:500:200-r:100-r}(i);return 0===a?(e(),null):(this.tasks[r]={fn:e,metadata:i,priority:a,id:r},this.taskQueue.push(r),this.invoker.trigger(),{cancel:()=>{delete this.tasks[r]}})}process(){{if(this.taskQueue=this.taskQueue.filter(e=>!!this.tasks[e]),!this.taskQueue.length)return;let e=this.pick();if(null===e)return;let i=this.tasks[e];if(delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),!i)return;i.fn()}}pick(){let e=null,i=1/0;for(let r=0;r<this.taskQueue.length;r++){let a=this.tasks[this.taskQueue[r]];a.priority<i&&(i=a.priority,e=r)}if(null===e)return null;let r=this.taskQueue[e];return this.taskQueue.splice(e,1),r}remove(){this.invoker.remove()}}class cJ{constructor(e,i,r){this.target=e,this.parent=i,this.mapId=r,this.callbacks={},this.cancelCallbacks={},eG(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler=new cY}send(e,i,r,a,n=!1,s){let l=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(r.metadata=s,this.callbacks[l]=r);let h=new Set;return this.target.postMessage({id:l,type:e,hasCallback:!!r,targetMapId:a,mustQueue:n,sourceMapId:this.mapId,data:ag(i,h)},h),{cancel:()=>{r&&delete this.callbacks[l],this.target.postMessage({id:l,type:"<cancel>",targetMapId:a,sourceMapId:this.mapId})}}}receive(e){let i=e.data,r=i.id;if(r&&(!i.targetMapId||this.mapId===i.targetMapId)){if("<cancel>"===i.type){let e=this.cancelCallbacks[r];delete this.cancelCallbacks[r],e&&e.cancel()}else if(i.mustQueue||eK()){let e=this.callbacks[r],a=this.scheduler.add(()=>this.processTask(r,i),e&&e.metadata||{type:"message"});a&&(this.cancelCallbacks[r]=a)}else this.processTask(r,i)}}processTask(e,i){if(delete this.cancelCallbacks[e],"<response>
212"===i.type){let r=this.callbacks[e];delete this.callbacks[e],r&&(i.error?r(ay(i.error)):r(null,ay(i.data)))}else{let r=new Set,a=i.hasCallback?(i,a)=>{this.target.postMessage({id:e,type:"<response>",sourceMapId:this.mapId,error:i?ag(i):null,data:ag(a,r)},r)}:()=>{},n=ay(i.data);if(this.parent[i.type])this.parent[i.type](i.sourceMapId,n,a);else if(this.parent.getWorkerSource){let e=i.type.split(".");this.parent.getWorkerSource(i.sourceMapId,e[0],n.source,n.scope)[e[1]](n,a)}else a(Error(`Could not find function ${i.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}class cK{constructor(e,i){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=eU();let r=this.workerPool.acquire(this.id);for(let e=0;e<r.length;e++){let a=new cK.Actor(r[e],i,this.id);a.name=`Worker ${e}`,this.actors.push(a)}this.ready=!1,this.broadcast("checkIfReady",null,()=>{this.ready=!0})}broadcast(e,i,r){eF(this.actors,(r,a)=>{r.send(e,i,a)},r=r||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(e=>{e.remove()}),this.actors=[],this.workerPool.release(this.id)}}cK.Actor=cJ;class cQ{constructor(e){this.size=e,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(e,i){let r=this.toIdx(e,i);return{min:this.minimums[r],max:this.maximums[r]}}isLeaf(e,i){return this.leaves[this.toIdx(e,i)]}toIdx(e,i){return i*this.size+e}}function c0(e,i,r,a){let n=0,s=Number.MAX_VALUE;for(let l=0;l<3;l++)if(1e-15>Math.abs(a[l])){if(r[l]<e[l]||r[l]>i[l])return null}else{let h=1/a[l],u=(e[l]-r[l])*h,c=(i[l]-r[l])*h;if(u>c){let e=u;u=c,c=e}if(u>n&&(n=u),c<s&&(s=c),n>s)return null}return n}function c1(e,i,r,a,n,s,l,h,u,c,d){let p=a-e,f=n-i,m=s-r,_=l-e,g=h-i,y=u-r,x=d[1]*y-d[2]*g,v=d[2]*_-d[0]*y,b=d[0]*g-d[1]*_,w=p*x+f*v+m*b;if(1e-15>Math.abs(w))return null;let T=1/w,S=c[0]-e,M=c[1]-i,E=c[2]-r,A=(S*x+M*v+E*b)*T;if(A<0||A>1)return null;let I=M*m-E*f,C=E*p-S*m,P=S*f-M*p,L=(d[0]*I+d[1]*C+d[2]*P)*T;return L<0||A+L>1?null:(_*I+g*C+y*P)*T}function c2(e,i,r,a,n,s,l,h,u){let c=1<<r,d=s-a,p=l-n;h[0]=(e+0)/c*d+a,h[1]=(i+0)/c*p+n,u[0]=(e+1)/c*d+a,u[1]=(i+1)/c*p+n}class c3{constructor(e){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=e,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;let i=function(e){let i=Math.ceil(Math.log2(e.dim/8)),r=[],a=Math.ceil(Math.pow(2,i)),n=1/a,s=(e,i,r,a,n)=>{let s=+!!a;n[0]=e*r,n[1]=i*r,n[2]=(e+1)*r-s,n[3]=(i+1)*r-s},l=new cQ(a),h=[];for(let i=0;i<a*a;i++){s(i%a,Math.floor(i/a),n,!1,h);let r=c5(h[0],h[1],e),u=c5(h[2],h[1],e),c=c5(h[2],h[3],e),d=c5(h[0],h[3],e);l.minimums.push(Math.min(r,u,c,d)),l.maximums.push(Math.max(r,u,c,d)),l.leaves.push(1)}for(r.push(l),a/=2;a>=1;a/=2){let e=r[r.length-1];l=new cQ(a);for(let i=0;i<a*a;i++){s(i%a,Math.floor(i/a),2,!0,h);let r=e.getElevation(h[0],h[1]),n=e.getElevation(h[2],h[1]),u=e.getElevation(h[2],h[3]),c=e.getElevation(h[0],h[3]),d=e.isLeaf(h[0],h[1]),p=e.isLeaf(h[2],h[1]),f=e.isLeaf(h[2],h[3]),m=e.isLeaf(h[0],h[3]),_=Math.min(r.min,n.min,u.min,c.min),g=Math.max(r.max,n.max,u.max,c.max),y=d&&p&&f&&m;l.maximums.push(g),l.minimums.push(_),l.leaves.push(g-_<=5&&y?1:0)}r.push(l)}return r}(this.dem),r=i.length-1,a=i[r];this._addNode(a.minimums[0],a.maximums[0],a.leaves[0]),this._construct(i,0,0,r,0)}raycastRoot(e,i,r,a,n,s,l=1){return c0([e,i,-100],[r,a,this.maximums[0]*l],n,s)}raycast(e,i,r,a,n,s,l=1){if(!this.nodeCount)return null;let h=this.raycastRoot(e,i,r,a,n,s,l);if(null==h)return null;let u=[],c=[],d=[],p=[],f=[{idx:0,t:h,nodex:0,nodey:0,depth:0}];for(;f.length>0;){let{idx:h,t:g,nodex:y,nodey:x,depth:v}=f.pop();if(this.leaves[h]){c2(y,x,v,e,i,r,a,d,p);let h=1<<v,u=(y+0)/h,c=(y+1)/h,f=(x+0)/h,b=(x+1)/h,w=c5(u,f,this.dem)*l,T=c5(c,f,this.dem)*l,S=c5(c,b,this.dem)*l,M=c5(u,b,this.dem)*l,E=c1(d[0],d[1],w,p[0],d[1],T,p[0],p[1],S,n,s),A=c1(p[0],p[1],S,d[0],p[1],M,d[0],d[1],w,n,s),I=Math.min(null!==E?E:Number.MAX_VALUE,null!==A?A:Number.MAX_VALUE);if(I!==Number.MAX_VALUE)return I;{var m,_;let e=eS.vec3.scaleAndAdd([],n,s,g);if(c4(w,T,M,S,(e[0]-(m=d[0]))/(p[0]-m),(e[1]-(_=d[1]))/(p[1]-_))>=e[2])return g}continue}let b=0;for(let f=0;f<this._siblingOffset.length;f++){c2((y<<1)+this._siblingOffset[f][0],(x<<1)+this._siblingOffset[f][1],v+1,e,i,r,a,d,p),d[2]=-100,p[2]=this.maximums[this.childOffsets[h]+f]*l;let m=c0(d,p,n,s);if(null!=m){u[f]=m;let e=!1;for(let i=0;i<b&&!e;i++)m>=u[c[i]]&&(c.splice(i,0,f),e=!0);e||(c[b]=f),b++}}for(let e=0;e<b;e++){let i=c[e];f.push({idx:this.childOffsets[h]+i,t:u[i],nodex:(y<<1)+this._siblingOffset[i][0],nodey:(x<<1)+this._siblingOffset[i][1],depth:v+1})}}return null}_addNode(e,i,r){return this.minimums.push(e),this.maximums.push(i),this.leaves.push(r),this.childOffsets.push(0),this.nodeCount++}_construct(e,i,r,a,n){if(1===e[a].isLeaf(i,r))return;this.childOffsets[n]||(this.childOffsets[n]=this.nodeCount);let s=a-1,l=e[s],h=0,u=0;for(let e=0;e<this._siblingOffset.length;e++){let a=2*i+this._siblingOffset[e][0],n=2*r+this._siblingOffset[e][1],s=l.getElevation(a,n),c=l.isLeaf(a,n),d=this._addNode(s.min,s.max,c);c&&(h|=1<<e),u||(u=d)}for(let a=0;a<this._siblingOffset.length;a++)h&1<<a||this._construct(e,2*i+this._siblingOffset[a][0],2*r+this._siblingOffset[a][1],s,u+a)}}function c4(e,i,r,a,n,s){return tU(tU(e,r,s),tU(i,a,s),n)}function c5(e,i,r){let a=r.dim,n=eD(e*a-.5,0,a-1),s=eD(i*a-.5,0,a-1),l=Math.floor(n),h=Math.floor(s),u=Math.min(l+1,a-1),c=Math.min(h+1,a-1);return c4(r.get(l,h),r.get(u,h),r.get(l,c),r.get(u,c),n-l,s-h)}let c6={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function c8(e,i,r){return(256*e*256+256*i+r)/10-1e4}function c9(e,i,r){return 256*e+i+r/256-32768}class c7{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(e,i,r,a=!1){if(this.uid=e,i.height!==i.width)throw RangeError("DEM tiles must be square");if(r&&"mapbox"!==r&&"terrarium"!==r)return void eX(`"${r}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=i.height;let n=this.dim=i.height-2,s=new Uint32Array(i.data.buffer);if(this.pixels=new Uint8Array(i.data.buffer),this.floatView=new Float32Array(i.data.buffer),this.borderReady=a,this._modifiedForSources={},!a){for(let e=0;e<n;e++)s[this._idx(-1,e)]=s[this._idx(0,e)],s[this._idx(n,e)]=s[this._idx(n-1,e)],s[this._idx(e,-1)]=s[this._idx(e,0)],s[this._idx(e,n)]=s[this._idx(e,n-1)];s[this._idx(-1,-1)]=s[this._idx(0,0)],s[this._idx(n,-1)]=s[this._idx(n-1,0)],s[this._idx(-1,n)]=s[this._idx(0,n-1)],s[this._idx(n,n)]=s[this._idx(n-1,n-1)]}let l="terrarium"===r?c9:c8;for(let e=0;e<s.length;++e){let i=4*e;this.floatView[e]=l(this.pixels[i],this.pixels[i+1],this.pixels[i+2])}this._timestamp=te.now()}_buildQuadTree(){this._tree=new c3(this)}get(e,i,r=!1){r&&(e=eD(e,-1,this.dim),i=eD(i,-1,this.dim));let a=this._idx(e,i);return this.floatView[a]}set(e,i,r){let a=this._idx(e,i),n=this.floatView[a];return this.floatView[a]=r,r-n}static getUnpackVector(e){return c6[e]}_idx(e,i){if(e<-1||e>=this.dim+1||i<-1||i>=this.dim+1)throw RangeError("out of range source coordinates for DEM data");return(i+1)*this.stride+(e+1)}
212static pack(e,i){let r=[0,0,0,0],a=c7.getUnpackVector(i),n=Math.floor((e+a[3])/a[2]);return r[2]=n%256,n=Math.floor(n/256),r[1]=n%256,n=Math.floor(n/256),r[0]=n,r}getPixels(){return new sK({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,i,r){if(this.dim!==e.dim)throw Error("dem dimension mismatch");let a=i*this.dim,n=i*this.dim+this.dim,s=r*this.dim,l=r*this.dim+this.dim;switch(i){case -1:a=n-1;break;case 1:n=a+1}switch(r){case -1:s=l-1;break;case 1:l=s+1}let h=-i*this.dim,u=-r*this.dim;for(let i=s;i<l;i++)for(let r=a;r<n;r++){let a=4*this._idx(r,i),n=4*this._idx(r+h,i+u);this.pixels[a+0]=e.pixels[n+0],this.pixels[a+1]=e.pixels[n+1],this.pixels[a+2]=e.pixels[n+2],this.pixels[a+3]=e.pixels[n+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}function de(e,i,r){var a;1===e?i.headerLength=r.readFixed32():2===e?i.x=r.readVarint():3===e?i.y=r.readVarint():4===e?i.z=r.readVarint():5===e&&i.layers.push((a=r.readVarint()+r.pos,r.readFields(dn,{version:0,name:"",units:"",tileSize:0,buffer:0,pixelFormat:0,dataIndex:[]},a)))}function dt(e,i,r){var a;1===e?(i.delta_filter=(a=r.readVarint()+r.pos,r.readFields(di,{blockSize:0},a)),i.filter="delta_filter"):2===e?(r.readVarint(),i.filter="zigzag_filter"):3===e?(r.readVarint(),i.filter="bitshuffle_filter"):4===e&&(r.readVarint(),i.filter="byteshuffle_filter")}function di(e,i,r){1===e&&(i.blockSize=r.readVarint())}function dr(e,i,r){1===e?(r.readVarint(),i.codec="gzip_data"):2===e?(r.readVarint(),i.codec="jpeg_image"):3===e?(r.readVarint(),i.codec="webp_image"):4===e&&(r.readVarint(),i.codec="png_image")}function da(e,i,r){var a,n;let s=0,l=0;1===e?i.firstByte=r.readFixed64():2===e?i.lastByte=r.readFixed64():3===e?i.filters.push((a=r.readVarint()+r.pos,r.readFields(dt,{},a))):4===e?i.codec=(n=r.readVarint()+r.pos,r.readFields(dr,{},n)):5===e?l=r.readFloat():6===e?s=r.readFloat():7===e?i.bands.push(r.readString()):8===e?i.offset=r.readDouble():9===e&&(i.scale=r.readDouble()),0===i.offset&&(i.offset=l),0===i.scale&&(i.scale=s)}function dn(e,i,r){var a;1===e?i.version=r.readVarint():2===e?i.name=r.readString():3===e?i.units=r.readString():4===e?i.tileSize=r.readVarint():5===e?i.buffer=r.readVarint():6===e?i.pixelFormat=r.readVarint():7===e&&i.dataIndex.push((a=r.readVarint()+r.pos,r.readFields(da,{firstByte:0,lastByte:0,filters:[],codec:null,offset:0,scale:0,bands:[]},a)))}function ds(e,i,r){if(2===e)!function(e,i,r){e.readFields(dl,r,i)}(r,r.readVarint()+r.pos,i);else if(3===e)throw Error("Not implemented")}function dl(e,i,r){if(1===e){let e=0,a=r.readVarint()+r.pos;for(;r.pos<a;)i[e++]=r.readVarint()}}af(c7,"DEMData"),af(c3,"DemMinMaxQuadTree",{omit:["dem"]});class dh{constructor(e){this.capacity=e,this.cache=new Map}get(e){if(!this.cache.has(e))return;let i=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,i),i}put(e,i){this.cache.has(e)?this.cache.delete(e):this.cache.size===this.capacity&&this.cache.delete(this.cache.keys().next().value),this.cache.set(e,i)}}var du=Uint8Array,dc=Uint16Array,dd=Int32Array,dp=new du([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),df=new du([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),dm=new du([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),d_=function(e,i){for(var r=new dc(31),a=0;a<31;++a)r[a]=i+=1<<e[a-1];var n=new dd(r[30]);for(a=1;a<30;++a)for(var s=r[a];s<r[a+1];++s)n[s]=s-r[a]<<5|a;return{b:r,r:n}},dg=d_(dp,2),dy=dg.b,dx=dg.r;dy[28]=258,dx[258]=28;for(var dv=d_(df,0).b,db=new dc(32768),dw=0;dw<32768;++dw){var dT=(43690&dw)>>1|(21845&dw)<<1;db[dw]=((65280&(dT=(61680&(dT=(52428&dT)>>2|(13107&dT)<<2))>>4|(3855&dT)<<4))>>8|(255&dT)<<8)>>1}var dS=function(e,i,r){for(var a=e.length,n=0,s=new dc(i);n<a;++n)e[n]&&++s[e[n]-1];var l,h=new dc(i);for(n=1;n<i;++n)h[n]=h[n-1]+s[n-1]<<1;l=new dc(1<<i);var u=15-i;for(n=0;n<a;++n)if(e[n])for(var c=n<<4|e[n],d=i-e[n],p=h[e[n]-1]++<<d,f=p|(1<<d)-1;p<=f;++p)l[db[p]>>u]=c;return l},dM=new du(288);for(dw=0;dw<144;++dw)dM[dw]=8;for(dw=144;dw<256;++dw)dM[dw]=9;for(dw=256;dw<280;++dw)dM[dw]=7;for(dw=280;dw<288;++dw)dM[dw]=8;var dE=new du(32);for(dw=0;dw<32;++dw)dE[dw]=5;var dA=dS(dM,9),dI=dS(dE,5),dC=function(e){for(var i=e[0],r=1;r<e.length;++r)e[r]>i&&(i=e[r]);return i},dP=function(e,i,r){var a=i/8|0;return(e[a]|e[a+1]<<8)>>(7&i)&r},dL=function(e,i){var r=i/8|0;return(e[r]|e[r+1]<<8|e[r+2]<<16)>>(7&i)}
212,dk=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],dR=function(e,i,r){var a=Error(i||dk[e]);if(a.code=e,Error.captureStackTrace&&Error.captureStackTrace(a,dR),!r)throw a;return a},dz=new du(0),dD="undefined"!=typeof TextDecoder&&new TextDecoder;try{dD.decode(dz,{stream:!0})}catch(e){}let dO={gzip_data:"gzip"};class dB extends Error{constructor(e){super(e),this.name="MRTError"}}let dF={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},dN={uint32:1,uint16:2,uint8:4},dV={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};class dU{constructor(e=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=e}getLayer(e){let i=this.layers[e];if(!i)throw new dB(`Layer '${e}' not found`);return i}getHeaderLength(e){let i=new Uint8Array(e),r=new DataView(e);if(13!==i[0])throw new dB("File is not a valid MRT.");return r.getUint32(1,!0)}parseHeader(e){let i=new Uint8Array(e),r=this.getHeaderLength(e);if(i.length<r)throw new dB(`Expected header with length >= ${r} but got buffer of length ${i.length}`);let a=new G(i.subarray(0,r)).readFields(de,{headerLength:0,x:0,y:0,z:0,layers:[]},void 0);if(!isNaN(this.x)&&(this.x!==a.x||this.y!==a.y||this.z!==a.z))throw new dB(`Invalid attempt to parse header ${a.z}/${a.x}/${a.y} for tile ${this.z}/${this.x}/${this.y}`);for(let e of(this.x=a.x,this.y=a.y,this.z=a.z,a.layers))this.layers[e.name]=new dj(e,{cacheSize:this._cacheSize});return this}createDecodingTask(e){let i=[],r=this.getLayer(e.layerName);for(let a of e.blockIndices){let n=r.dataIndex[a],s=n.firstByte-e.firstByte,l=n.lastByte-e.firstByte;if(r._blocksInProgress.has(a))continue;let h={layerName:r.name,firstByte:s,lastByte:l,pixelFormat:r.pixelFormat,blockIndex:a,blockShape:[n.bands.length].concat(r.bandShape),buffer:r.buffer,codec:n.codec.codec,filters:n.filters.map(e=>e.filter)};r._blocksInProgress.add(a),i.push(h)}return new dG(i,()=>{i.forEach(e=>r._blocksInProgress.delete(e.blockIndex))},(e,a)=>{if(i.forEach(e=>r._blocksInProgress.delete(e.blockIndex)),e)throw e;a.forEach(e=>{this.getLayer(e.layerName).processDecodedData(e)})})}}class dj{constructor({version:e,name:i,units:r,tileSize:a,pixelFormat:n,buffer:s,dataIndex:l},h){if(this.version=e,1!==this.version)throw new dB(`Cannot parse raster layer encoded with MRT version ${e}`);this.name=i,this.units=r,this.tileSize=a,this.buffer=s,this.pixelFormat=dF[n],this.dataIndex=l,this.bandShape=[a+2*s,a+2*s,dN[this.pixelFormat]],this._decodedBlocks=new dh(h?h.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return dN[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:e})=>e).flat()}processDecodedData(e){let i=e.blockIndex.toString();this._decodedBlocks.get(i)||this._decodedBlocks.put(i,e.data)}getBlockForBand(e){let i=0;switch(typeof e){case"string":for(let[r,a]of this.dataIndex.entries()){for(let[n,s]of a.bands.entries())if(s===e)return{bandIndex:i+n,blockIndex:r,blockBandIndex:n};i+=a.bands.length}break;case"number":for(let[r,a]of this.dataIndex.entries()){if(e>=i&&e<i+a.bands.length)return{bandIndex:e,blockIndex:r,blockBandIndex:e-i};i+=a.bands.length}break;default:throw new dB(`Invalid band \`${JSON.stringify(e)}\`. Expected string or integer.`)}throw new dB(`Band not found: ${JSON.stringify(e)}`)}getDataRange(e){let i=1/0,r=-1/0,a=[],n=new Set;for(let s of e){let{blockIndex:e}=this.getBlockForBand(s);if(e<0)throw new dB(`Invalid band: ${JSON.stringify(s)}`);let l=this.dataIndex[e];a.includes(e)||a.push(e),n.add(e),i=Math.min(i,l.firstByte),r=Math.max(r,l.lastByte)}if(n.size>this.cacheSize)throw new dB(`Number of blocks to decode (${n.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:i,lastByte:r,blockIndices:a}}hasBand(e){let{blockIndex:i}=this.getBlockForBand(e);return i>=0}hasDataForBand(e){let{blockIndex:i}=this.getBlockForBand(e);return i>=0&&!!this._decodedBlocks.get(i.toString())}getBandView(e){let{blockIndex:i,blockBandIndex:r}=this.getBlockForBand(e),a=this._decodedBlocks.get(i.toString());if(!a)throw new dB(`Data for band ${JSON.stringify(e)} of layer "${this.name}" not decoded.`);let n=this.dataIndex[i],s=this.bandShape.reduce((e,i)=>e*i,1),l=r*s,h=a.subarray(l,l+s);return{data:h,bytes:new Uint8Array(h.buffer).subarray(h.byteOffset,h.byteOffset+h.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:n.offset,scale:n.scale}}}dU.setPbf=function(e){G=e};class dG{constructor(e,i,r){this.tasks=e,this._onCancel=i,this._onComplete=r,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(e,i){this._finalized||(this._onComplete(e,i),this._finalized=!0)}}dU.performDecoding=function(e,i){let r=new Uint8Array(e);return Promise.all(i.tasks.map(e=>{let{layerName:i,firstByte:a,lastByte:n,pixelFormat:s,blockShape:l,blockIndex:h,filters:u,codec:c}=e,d=r.subarray(a,n+1),p=new Uint32Array(l[0]*l[1]*l[2]);if("gzip_data"!==c)throw new dB(`Unhandled codec: ${c}`);return(function(e,i){var r,a;if(!globalThis.DecompressionStream&&"gzip_data"===i)return Promise.resolve(((a=function(e){31==e[0]&&139==e[1]&&8==e[2]||dR(6,"invalid gzip data");var i=e[3],r=10;4&i&&(r+=2+(e[10]|e[11]<<8));for(var a=(i>>3&1)+(i>>4&1);a>0;a-=!e[r++]);return r+(2&i)}(e))+8>e.length&&dR(6,"invalid gzip data"),function(e,i,r,a){var n=e.length;if(!n||i.f&&!i.l)return r||new du(0);var s=!r,l=s||2!=i.i,h=i.i;s&&(r=new du(3*n));var u,c,d=function(e){var i=r.length;if(e>i){var a=new du(Math.max(2*i,e));a.set(r),r=a}},p=i.f||0,f=i.p||0,m=i.b||0,_=i.l,g=i.d,y=i.m,x=i.n,v=8*n;do{if(!_){p=dP(e,f,1);var b=dP(e,f+1,3);if(f+=3,!b){var w=e[(R=4+((f+7)/8|0))-4]|e[R-3]<<8,T=R+w;if(T>n){h&&dR(0);break}l&&d(m+w),r.set(e.subarray(R,T),m),i.b=m+=w,i.p=f=8*T,i.f=p;continue}if(1==b)_=dA,g=dI,y=9,x=5;else if(2==b){var S=dP(e,f,31)+257,M=dP(e,f+10,15)+4,E=S+dP(e,f+5,31)+1;f+=14;for(var A=new du(E),I=new du(19),C=0;C<M;
212++C)I[dm[C]]=dP(e,f+3*C,7);f+=3*M;var P=dC(I),L=(1<<P)-1,k=dS(I,P);for(C=0;C<E;){var R,z=k[dP(e,f,L)];if(f+=15&z,(R=z>>4)<16)A[C++]=R;else{var D=0,O=0;for(16==R?(O=3+dP(e,f,3),f+=2,D=A[C-1]):17==R?(O=3+dP(e,f,7),f+=3):18==R&&(O=11+dP(e,f,127),f+=7);O--;)A[C++]=D}}var B=A.subarray(0,S),F=A.subarray(S);y=dC(B),x=dC(F),_=dS(B,y),g=dS(F,x)}else dR(1);if(f>v){h&&dR(0);break}}l&&d(m+131072);for(var N=(1<<y)-1,V=(1<<x)-1,U=f;;U=f){var j=(D=_[dL(e,f)&N])>>4;if((f+=15&D)>v){h&&dR(0);break}if(D||dR(2),j<256)r[m++]=j;else{if(256==j){U=f,_=null;break}var G=j-254;j>264&&(G=dP(e,f,(1<<($=dp[C=j-257]))-1)+dy[C],f+=$);var q=g[dL(e,f)&V],W=q>>4;if(q||dR(3),f+=15&q,F=dv[W],W>3){var $=df[W];F+=dL(e,f)&(1<<$)-1,f+=$}if(f>v){h&&dR(0);break}l&&d(m+131072);var H=m+G;if(m<F){var Z=0-F,X=Math.min(F,H);for(Z+m<0&&dR(3);m<X;++m)r[m]=(void 0)[Z+m]}for(;m<H;++m)r[m]=r[m-F]}}i.l=_,i.p=U,i.b=m,i.f=p,_&&(p=1,i.m=y,i.d=g,i.n=x)}while(!p)return m!=r.length&&s?(u=r,(null==(c=m)||c>u.length)&&(c=u.length),new du(u.subarray(0,c))):r.subarray(0,m)}(e.subarray(a,-8),{i:2},new du((e[(r=e.length)-4]|e[r-3]<<8|e[r-2]<<16|e[r-1]<<24)>>>0))));let n=dO[i];if(!n)throw Error(`Unhandled codec: ${i}`);let s=new globalThis.DecompressionStream(n);return new Response(new Blob([e]).stream().pipeThrough(s)).arrayBuffer().then(e=>new Uint8Array(e))})(d,c).then(e=>((function(e,i){e.readFields(ds,i)})(new G(e),p),new dV[s](p.buffer))).then(e=>{for(let i=u.length-1;i>=0;i--)switch(u[i]){case"delta_filter":(function(e,i){if(4!==i.length)throw Error(`Expected data of dimension 4 but got ${i.length}.`);let r=i[3];for(let a=2;a>=1;a--){let n=+(1===a),s=+(2===a);for(let a=0;a<i[0];a++){let l=i[1]*a;for(let a=n;a<i[1];a++){let n=i[2]*(a+l);for(let a=s;a<i[2];a++){let s=i[3]*(a+n);for(let a=0;a<i[3];a++){let i=s+a;e[i]+=e[i-r]}}}}r*=i[a]}})(e,l);break;case"zigzag_filter":(function(e){for(let i=0,r=e.length;i<r;i++)e[i]=e[i]>>>1^-(1&e[i])})(e);break;case"bitshuffle_filter":(function(e,i){switch(i){case"uint32":return;case"uint16":for(let i=0;i<e.length;i+=2){let r=e[i],a=e[i+1];e[i]=(240&r)>>4|(61440&r)>>8|(240&a)<<4|61440&a,e[i+1]=15&r|(3840&r)>>4|(15&a)<<8|(3840&a)<<4}return;case"uint8":for(let i=0;i<e.length;i+=4){let r=e[i],a=e[i+1],n=e[i+2],s=e[i+3];e[i+0]=(192&r)>>6|(192&a)>>4|(192&n)>>2|192&s,e[i+1]=(48&r)>>4|(48&a)>>2|48&n|(48&s)<<2,e[i+2]=(12&r)>>2|12&a|(12&n)<<2|(12&s)<<4,e[i+3]=3&r|(3&a)<<2|(3&n)<<4|(3&s)<<6}return;default:throw Error(`Invalid pixel format, "${i}"`)}})(e,s);break;default:throw new dB(`Unhandled filter "${u[i]}"`)}return{layerName:i,blockIndex:h,data:e}}).catch(e=>{throw e})}))},af(dG,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]});var dq={workerUrl:"",workerClass:null,workerParams:void 0};let dW="mapboxgl_preloaded_worker_pool";class d${constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<d$.workerCount;)this.workers.push(null!=dq.workerClass?new dq.workerClass:new self.Worker(dq.workerUrl,dq.workerParams));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.workers&&0===this.numActive()&&(this.workers.forEach(e=>{e.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[dW]}numActive(){return Object.keys(this.active).length}}function dH(){return q||(q=new d$),q}d$.workerCount=2;let dZ,dX,dY,dJ,dK,dQ=null;function d0(){return eK()&&self.worker&&self.worker.dracoUrl?self.worker.dracoUrl:dX||e6.DRACO_URL}function d1(){if(eK()&&self.worker&&self.worker.meshoptUrl)return self.worker.meshoptUrl;if(dJ)return dJ;let e=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]);if("object"!=typeof WebAssembly)throw Error("WebAssembly not supported, cannot instantiate meshoptimizer");return dJ=WebAssembly.validate(e)?e6.MESHOPT_SIMD_URL:e6.MESHOPT_URL}let d2={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},d3={5120:"DT_INT8",5121:"DT_UINT8",5122:"DT_INT16",5123:"DT_UINT16",5125:"DT_UINT32",5126:"DT_FLOAT32"},d4={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function d5(e,i,r){let a=r.json.bufferViews.length,n=r.buffers.length;i.bufferView=a,r.json.bufferViews[a]={buffer:n,byteLength:e.byteLength},r.buffers[n]=e}let d6="KHR_draco_mesh_compression",d8="EXT_meshopt_compression",d9=new TextDecoder("utf8");function d7(e,i){return new URL(e,i).href}
212function pe(e,i){let r=e.json.bufferViews[i];return new Uint8Array(e.buffers[r.buffer],r.byteOffset||0,r.byteLength)}function pt(e,i=0,r){let a={json:null,images:[],buffers:[]};if(0x46546c67===new Uint32Array(e,i,1)[0]){let r=new Uint32Array(e,i),n=2,s=(r[n++]>>2)-3,l=r[n++]>>2;if(n++,a.json=JSON.parse(d9.decode(r.subarray(n,n+l))),(n+=l)<s){let s=r[n++],l=i+(++n<<2);a.buffers[0]=e.slice(l,l+s)}}else a.json=JSON.parse(d9.decode(new Uint8Array(e,i)));let{buffers:n,images:s,meshes:l,extensionsUsed:h,bufferViews:u}=a.json,c=Promise.resolve();if(n){let e=[];for(let i=0;i<n.length;i++){let s=n[i];s.uri?e.push(function(e,i,r,a){return fetch(d7(e.uri,a)).then(e=>e.arrayBuffer()).then(e=>{i.buffers[r]=e})}(s,a,i,r)):a.buffers[i]||(a.buffers[i]=null)}c=Promise.all(e)}return c.then(()=>{let e=[],i=h&&h.includes(d6),n=h&&h.includes(d8);if(i&&e.push(function(){if(!dY)return null!=dZ?dZ:(dZ=function(e){let i,r=null;function a(){i=new Uint8Array(r.buffer)}function n(){throw Error("Unexpected Draco error.")}let s={a:{a:n,d:function(e,r,a){return i.copyWithin(e,r,r+a)},c:function(e){let n=i.length,s=Math.ceil((Math.max(e>>>0,Math.ceil(1.2*n))-n)/65536);try{return r.grow(s),a(),!0}catch(e){return!1}},b:n}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(e,s):e.then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,s))).then(e=>{let n,s,l,h;let{Rb:u,Qb:c,P:d,T:p,X:f,Ja:m,La:_,Qa:g,Va:y,Wa:x,eb:v,jb:b,f:w,e:T,yb:S,zb:M,Ab:E,Bb:A,Db:I,Gb:C}=e.instance.exports;r=T;let P=(n=0,s=0,l=0,h=0,e=>{l&&(u(h),u(n),s+=l,l=n=0),n||(s+=128,n=c(s));let r=e.length+7&-8,a=n;r>=s&&(l=r,a=h=c(r));for(let r=0;r<e.length;r++)i[a+r]=e[r];return a});return a(),w(),{memory:T,_free:u,_malloc:c,Mesh:class{constructor(){this.ptr=d()}destroy(){p(this.ptr)}},Decoder:class{constructor(){this.ptr=m()}destroy(){b(this.ptr)}DecodeArrayToMesh(e,i,r){let a=P(e);return!!f(_(this.ptr,a,i,r.ptr))}GetAttributeByUniqueId(e,i){return{ptr:g(this.ptr,e.ptr,i)}}GetTrianglesUInt16Array(e,i,r){y(this.ptr,e.ptr,i,r)}GetTrianglesUInt32Array(e,i,r){x(this.ptr,e.ptr,i,r)}GetAttributeDataArrayForAllPoints(e,i,r,a,n){v(this.ptr,e.ptr,i.ptr,r,a,n)}},DT_INT8:S(),DT_UINT8:M(),DT_INT16:E(),DT_UINT16:A(),DT_UINT32:I(),DT_FLOAT32:C()}})}(fetch(d0()))).then(e=>{dY=e,dZ=void 0})}()),n&&e.push(function(){if(dK)return;let e=function(e){let i;let r=WebAssembly.instantiateStreaming(e,{}).then(e=>{(i=e.instance).exports.__wasm_call_ctors()}),a={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},n={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:r,supported:!0,decodeGltfBuffer(e,r,s,l,h,u){!function(e,i,r,a,n,s,l){let h=e.exports.sbrk,u=a+3&-4,c=h(u*n),d=h(s.length),p=new Uint8Array(e.exports.memory.buffer);p.set(s,d);let f=i(c,a,n,d,s.length);if(0===f&&l&&l(c,u,n),r.set(p.subarray(c,c+a*n)),h(c-h(0)),0!==f)throw Error(`Malformed buffer data: ${f}`)}(i,i.exports[n[h]],e,r,s,l,i.exports[a[u]])}}}(fetch(d1()));return e.ready.then(()=>{dK=e})}()),s)for(let i=0;i<s.length;i++)e.push(function(e,i,r,a){return e.uri?fetch(d7(e.uri,a)).then(e=>e.blob()).then(e=>createImageBitmap(e)).then(e=>{i.images[r]=e}):void 0!==e.bufferView?createImageBitmap(new Blob([pe(i,e.bufferView)],{type:e.mimeType})).then(e=>{i.images[r]=e}):void 0}(s[i],a,i,r));return(e.length?Promise.all(e):Promise.resolve()).then(()=>{if(i&&l)for(let{primitives:e}of l)for(let i of e)!function(e,i){let r=e.extensions&&e.extensions[d6];if(!r)return;let a=new dY.Decoder,n=pe(i,r.bufferView),s=new dY.Mesh;if(!a.DecodeArrayToMesh(n,n.byteLength,s))throw Error("Failed to decode Draco mesh");let l=i.json.accessors[e.indices],h=d2[l.componentType],u=l.count*h.BYTES_PER_ELEMENT,c=dY._malloc(u);for(let n of(h===Uint16Array?a.GetTrianglesUInt16Array(s,u,c):a.GetTrianglesUInt32Array(s,u,c),d5(dY.memory.buffer.slice(c,c+u),l,i),dY._free(c),Object.keys(r.attributes))){let l=a.GetAttributeByUniqueId(s,r.attributes[n]),h=i.json.accessors[e.attributes[n]],u=d3[h.componentType],c=h.count*d4[h.type]*d2[h.componentType].BYTES_PER_ELEMENT,d=dY._malloc(c);a.GetAttributeDataArrayForAllPoints(s,l,dY[u],c,d),d5(dY.memory.buffer.slice(d,d+c),h,i),dY._free(d)}a.destroy(),s.destroy(),delete e.extensions[d6]}(i,a);if(n&&l&&u)for(let e of u)!function(e,i){if(!e.extensions||!e.extensions[d8])return;let r=e.extensions[d8],a=new Uint8Array(i.buffers[r.buffer],r.byteOffset||0,r.byteLength||0),n=new Uint8Array(r.count*r.byteStride);dK.decodeGltfBuffer(n,r.count,r.byteStride,a,r.mode,r.filter),e.buffer=i.buffers.length,e.byteOffset=0,i.buffers[e.buffer]=n.buffer,delete e.extensions[d8]}(e,a);return a})})}function pi(e,i){let r=e.json.bufferViews[i.bufferView],a=d2[i.componentType];return new a(e.buffers[r.buffer],(i.byteOffset||0)+(r.byteOffset||0),i.count*(r.byteStride&&r.byteStride!==d4[i.type]*a.BYTES_PER_ELEMENT?r.byteStride/a.BYTES_PER_ELEMENT:d4[i.type]))}function pr(e,i,r,a){let n=d2[i.componentType],s=function(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(n),l=e.json.bufferViews[i.bufferView],h=l.byteStride?l.byteStride/n.BYTES_PER_ELEMENT:d4[i.type],u=r.float32,c=u.length/r.capacity;for(let e=0,r=0;e<i.count*h;e+=h,r+=c)for(let i=0;i<c;i++)u[r+i]=a[e+i]*s;r._trim()}function pa(e){let i=function(e,i){let r=[],a=WebGL2RenderingContext;if(e.json.textures)for(let n of e.json.textures){let s={magFilter:a.LINEAR,minFilter:a.NEAREST,wrapS:a.REPEAT,wrapT:a.REPEAT};void 0!==n.sampler&&Object.assign(s,e.json.samplers[n.sampler]),r.push({image:i[n.source],sampler:s,uploaded:!1})}return r}(e,e.images),r=function(e,i){let r=[];for(let a of e.json.meshes){let n=[];for(let r of a.primitives)n.push(function(e,i,r){let a=e.indices,n=e.attributes,s={};s.indexArray=new nS;let l=i.json.accessors[a],h=l.count/3;s.indexArray.reserve(h);let u=pi(i,l);for(let e=0;e<h;e++)s.indexArray.emplaceBack(u[3*e],u[3*e+1],u[3*e+2]);s.indexArray._trim(),s.vertexArray=new nd;let c=i.json.accessors[n.POSITION];s.vertexArray.reserve(c.count);let d=pi(i,c);for(let e=0;e<c.count;e++)s.vertexArray.emplaceBack(d[3*e],d[3*e+1],d[3*e+2]);if(s.vertexArray._trim(),s.aabb=new sm(c.min,c.max),s.centroid=function(e,i){let r=[
2120,0,0],a=e.length;if(a>0){for(let n=0;n<a;n++){let a=3*e[n];r[0]+=i[a],r[1]+=i[a+1],r[2]+=i[a+2]}r[0]/=a,r[1]/=a,r[2]/=a}return r}(u,d),void 0!==n.COLOR_0){let e=i.json.accessors[n.COLOR_0],r=d4[e.type],a=pi(i,e);s.colorArray=3===r?new nd:new nc,s.colorArray.resize(e.count),pr(i,e,s.colorArray,a)}if(void 0!==n.NORMAL){s.normalArray=new nd;let e=i.json.accessors[n.NORMAL];s.normalArray.resize(e.count);let r=pi(i,e);pr(i,e,s.normalArray,r)}if(void 0!==n.TEXCOORD_0&&r.length>0){s.texcoordArray=new nz;let e=i.json.accessors[n.TEXCOORD_0];s.texcoordArray.resize(e.count);let r=pi(i,e);pr(i,e,s.texcoordArray,r)}if(void 0!==n._FEATURE_ID_RGBA4444){let e=i.json.accessors[n._FEATURE_ID_RGBA4444];i.json.extensionsUsed&&i.json.extensionsUsed.includes("EXT_meshopt_compression")&&(s.featureData=pi(i,e))}void 0!==n._FEATURE_RGBA4444&&(s.featureData=new Uint32Array(pi(i,i.json.accessors[n._FEATURE_RGBA4444]).buffer));let p=e.material;return s.material=function(e,i){let{emissiveFactor:r=[0,0,0],alphaMode:a="OPAQUE",alphaCutoff:n=.5,normalTexture:s,occlusionTexture:l,emissiveTexture:h,doubleSided:u}=e,{baseColorFactor:c=[1,1,1,1],metallicFactor:d=1,roughnessFactor:p=1,baseColorTexture:f,metallicRoughnessTexture:m}=e.pbrMetallicRoughness||{},_=l?i[l.index]:void 0;if(l&&l.extensions&&l.extensions.KHR_texture_transform&&_){let e=l.extensions.KHR_texture_transform;_.offsetScale=[e.offset[0],e.offset[1],e.scale[0],e.scale[1]]}return{pbrMetallicRoughness:{baseColorFactor:new tN(...c),metallicFactor:d,roughnessFactor:p,baseColorTexture:f?i[f.index]:void 0,metallicRoughnessTexture:m?i[m.index]:void 0},doubleSided:u,emissiveFactor:r,alphaMode:a,alphaCutoff:n,normalTexture:s?i[s.index]:void 0,occlusionTexture:_,emissionTexture:h?i[h.index]:void 0,defined:void 0===e.defined}}(void 0!==p?i.json.materials[p]:{defined:!1},r),s}(r,e,i));r.push(n)}return r}(e,i),{scenes:a,scene:n,nodes:s}=e.json,l=a?a[n||0].nodes:s,h=[];for(let i of l)h.push(function e(i,r,a){let{matrix:n,rotation:s,translation:l,scale:h,mesh:u,extras:c,children:d}=i,p={};if(p.matrix=n||eS.mat4.fromRotationTranslationScale([],s||[0,0,0,1],l||[0,0,0],h||[1,1,1]),void 0!==u){p.meshes=a[u];let e=p.anchor=[0,0];for(let i of p.meshes){let{min:r,max:a}=i.aabb;e[0]+=r[0]+a[0],e[1]+=r[1]+a[1]}e[0]=Math.floor(e[0]/p.meshes.length/2),e[1]=Math.floor(e[1]/p.meshes.length/2)}if(c&&(c.id&&(p.id=c.id),c.lights&&(p.lights=function(e){if(!e.length)return[];let i=function(e){let i=atob(e),r=new Uint8Array(i.length);for(let e=0;e<i.length;e++)r[e]=i.codePointAt(e);return r}(e),r=[],a=i.length/24,n=new Uint16Array(i.buffer),s=new Float32Array(i.buffer);for(let e=0;e<a;e++){let i=n[2*e*6]/30,a=n[2*e*6+1]/30,l=n[2*e*6+10]/100,h=s[6*e+1],u=s[6*e+2],c=s[6*e+3],d=s[6*e+4],p=c-h,f=d-u,m=Math.hypot(p,f);r.push({pos:[h+.5*p,u+.5*f,a],normal:[f/m,-p/m,0],width:m,height:i,depth:l,points:[h,u,c,d]})}return r}(c.lights))),d){let i=[];for(let n of d)i.push(e(r.json.nodes[n],r,a));p.children=i}return p}(s[i],e,r));return function(e,i,r){let a={},n=new Set;for(let s=0;s<e.length;s++){let e=r[i[s]];if(!e.extras)continue;let l=e.extras["mapbox:footprint:version"],h=e.extras["mapbox:footprint:id"];(l||h)&&n.add(s),"1.0.0"===l&&h&&(a[h]=s)}for(let s=0;s<e.length;s++){if(n.has(s))continue;let l=e[s],h=r[i[s]];if(!h.extras)continue;let u=null;l.id in a&&(u=function(e,i){let r=[],a=[],n=0,s=[];for(let l of e){n=r.length;let e=l.vertexArray.float32,h=l.indexArray.uint16;for(let a=0;a<l.vertexArray.length;a++)s[0]=e[3*a+0],s[1]=e[3*a+1],s[2]=e[3*a+2],eS.vec3.transformMat4(s,s,i),r.push(new eA(s[0],s[1]));for(let e=0;e<3*l.indexArray.length;e++)a.push(h[e]+n)}if(a.length%3!=0)return null;for(let e=0;e<a.length;e+=3){let i=r[a[e+0]],n=r[a[e+1]],s=r[a[e+2]];(i.x-n.x)*(s.y-n.y)-(s.x-n.x)*(i.y-n.y)>0&&([a[e+1],a[e+2]]=[a[e+2],a[e+1]])}return{vertices:r,indices:a}}(e[a[l.id]].meshes,l.matrix)),u||(u=function(e){if(!e.extras||!e.extras.ground)return null;let i=e.extras.ground;if(!i||!Array.isArray(i)||0===i.length)return null;let r=i[0];if(!r||!Array.isArray(r)||0===r.length)return null;let a=[];for(let e of r){if(!Array.isArray(e)||2!==e.length)continue;let i=e[0],r=e[1];"number"==typeof i&&"number"==typeof r&&a.push(new eA(i,r))}
212if(a.length<3)return null;a.length>1&&a[a.length-1].equals(a[0])&&a.pop();let n=0;for(let e=0;e<a.length;e++){let i=a[e],r=a[(e+1)%a.length],s=a[(e+2)%a.length];n+=(i.x-r.x)*(s.y-r.y)-(s.x-r.x)*(i.y-r.y)}n>0&&a.reverse();let s=s1(a.flatMap(e=>[e.x,e.y]),[]);return 0===s.length?null:{vertices:a,indices:s}}(h)),u&&(l.footprint=function(e){if(0===e.vertices.length||0===e.indices.length)return null;let i=new ld(e.vertices,e.indices,8,256),[r,a]=[i.min.clone(),i.max.clone()];return{vertices:e.vertices,indices:e.indices,grid:i,min:r,max:a}}(u))}if(n.size>0){let i=Array.from(n.values()).sort((e,i)=>e-i);for(let r=i.length-1;r>=0;r--)e.splice(i[r],1)}}(h,l,e.json.nodes),h}class pn{constructor(e){this._stringToNumber={},this._numberToString=[];for(let i=0;i<e.length;i++){let r=e[i];this._stringToNumber[r]=i,this._numberToString[i]=r}}encode(e){return this._stringToNumber[e]}decode(e){return this._numberToString[e]}}class po{constructor(e,i){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new ad(8192,16,0),this.featureIndexArray=new nZ,this.promoteId=i,this.is3DTile=!1,this.serializedLayersCache=new Map}insert(e,i,r,a,n,s=0,l=0){let h=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,a,n,s);let u=this.grid;for(let e=0;e<i.length;e++){let r=i[e],a=[1/0,1/0,-1/0,-1/0];for(let e=0;e<r.length;e++){let i=r[e];a[0]=Math.min(a[0],i.x),a[1]=Math.min(a[1],i.y),a[2]=Math.max(a[2],i.x),a[3]=Math.max(a[3],i.y)}0!==l&&(a[0]-=l,a[1]-=l,a[2]+=l,a[3]+=l),a[0]<8192&&a[1]<8192&&a[2]>=0&&a[3]>=0&&u.insert(h,a[0],a[1],a[2],a[3])}}loadVTLayers(){if(!this.vtLayers)for(let e in this.vtLayers=new lR.VectorTile(new hJ(this.rawTileData)).layers,this.sourceLayerCoder=new pn(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={},this.vtLayers)this.vtFeatures[e]=[];return this.vtLayers}query(e,i,r){let a;this.loadVTLayers(),this.serializedLayersCache.clear();let n=aQ(e.filter),s=e.tileResult,l=e.transform,h=s.bufferedTilespaceBounds,u=this.grid.query(h.min.x,h.min.y,h.max.x,h.max.y,(e,i,r,a)=>oQ(s.bufferedTilespaceGeometry,e,i,r,a));u.sort(pl);let c=null;l.elevation&&u.length>0&&(c=cF.create(l.elevation,this.tileID));let d={};for(let h=0;h<u.length;h++){let p=u[h];if(p===a)continue;a=p;let f=this.featureIndexArray.get(p),m=null;if(this.is3DTile){let e=this.bucketLayerIDs[0][0],r=i[e];if("model"!==r.type)continue;let{queryFeature:a,intersectionZ:h}=r.queryIntersectsMatchingFeature(s,f.featureIndex,n,l);a&&this.appendToResult(d,e,f.featureIndex,a,h)}else this.loadMatchingFeature(d,f,n,e.layers,e.availableImages,i,r,(i,r,a,n=0)=>(m||(m=oU(i,this.tileID.canonical,e.tileTransform)),r.queryIntersectsFeature(s,i,a,m,this.z,e.transform,e.pixelPosMatrix,c,n)))}return d}loadMatchingFeature(e,i,r,a,n,s,l,h){let{featureIndex:u,bucketIndex:c,sourceLayerIndex:d,layoutVertexArrayOffset:p}=i,f=this.bucketLayerIDs[c];if(a.length&&!function(e,i){for(let r=0;r<e.length;r++)if(i.indexOf(e[r])>=0)return!0;return!1}(a,f))return;let m=this.sourceLayerCoder.decode(d),_=this.vtLayers[m].feature(u);if(r.needGeometry){let e=oj(_,!0);if(!r.filter(new aO(this.tileID.overscaledZ),e,this.tileID.canonical))return}else if(!r.filter(new aO(this.tileID.overscaledZ),_))return;let g=this.getId(_,m);for(let i=0;i<f.length;i++){let r=f[i];if(a.length&&0>a.indexOf(r))continue;let c=s[r];if(!c)continue;let d={};void 0!==g&&l&&(d=l.getState(c.sourceLayer||"_geojsonTileLayer",g));let m=!h||h(_,c,d,p);if(!m)continue;let y=new c$(_,this.z,this.x,this.y,g),x=this.serializedLayersCache.get(r);x||((x=c.serialize()).id=r,this.serializedLayersCache.set(r,x)),y.layer=eN({},x),y.tile=this.tileID.canonical,y.layer.paint=ps(x.paint,c.paint,_,d,n),y.layer.layout=ps(x.layout,c.layout,_,d,n),this.appendToResult(e,r,u,y,m)}}appendToResult(e,i,r,a,n){let s=e[i];void 0===s&&(s=e[i]=[]),s.push({featureIndex:r,feature:a,intersectionZ:n})}lookupSymbolFeatures(e,i,r,a,n,s,l){let h={};this.loadVTLayers();let u=aQ(a);for(let a of e)this.loadMatchingFeature(h,{bucketIndex:i,sourceLayerIndex:r,featureIndex:a,layoutVertexArrayOffset:0},u,n,s,l);return h}loadFeature(e){let{featureIndex:i,sourceLayerIndex:r}=e;this.loadVTLayers();let a=this.sourceLayerCoder.decode(r),n=this.vtFeatures[a];if(n[i])return n[i];let s=this.vtLayers[a].feature(i);return n[i]=s,s}hasLayer(e){for(let i of this.bucketLayerIDs)for(let r of i)if(e===r)return!0;return!1}getId(e,i){let r=e.id;if(this.promoteId){let a="string"==typeof this.promoteId?this.promoteId:this.promoteId[i];null!=a&&(r=e.properties[a]),"boolean"==typeof r&&(r=Number(r))}return r}}function ps(e,i,r,a,n){return eW(e,(e,s)=>{let l=i instanceof aq?i.get(s):null;return l&&l.evaluate?l.evaluate(r,a,n):l})}
212function pl(e,i){return i-e}af(po,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});let ph=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class pu{static from(e){if(!(e instanceof ArrayBuffer))throw Error("Data must be an instance of ArrayBuffer.");let[i,r]=new Uint8Array(e,0,2);if(219!==i)throw Error("Data does not appear to be in a KDBush format.");let a=r>>4;if(1!==a)throw Error(`Got v${a} data when expected v1.`);let n=ph[15&r];if(!n)throw Error("Unrecognized array type.");let[s]=new Uint16Array(e,2,1),[l]=new Uint32Array(e,4,1);return new pu(l,s,n,e)}constructor(e,i=64,r=Float64Array,a){if(isNaN(e)||e<0)throw Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=r,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let n=ph.indexOf(this.ArrayType),s=2*e*this.ArrayType.BYTES_PER_ELEMENT,l=e*this.IndexArrayType.BYTES_PER_ELEMENT,h=(8-l%8)%8;if(n<0)throw Error(`Unexpected typed array class: ${r}.`);a&&a instanceof ArrayBuffer?(this.data=a,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+l+h,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+s+l+h),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+l+h,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]=i,new Uint32Array(this.data,4,1)[0]=e)}add(e,i){let r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=e,this.coords[this._pos++]=i,r}finish(){let e=this._pos>>1;if(e!==this.numItems)throw Error(`Added ${e} items when expected ${this.numItems}.`);return function e(i,r,a,n,s,l){if(s-n<=a)return;let h=n+s>>1;(function e(i,r,a,n,s,l){for(;s>n;){if(s-n>600){let h=s-n+1,u=a-n+1,c=Math.log(h),d=.5*Math.exp(2*c/3),p=.5*Math.sqrt(c*d*(h-d)/h)*(u-h/2<0?-1:1);e(i,r,a,Math.max(n,Math.floor(a-u*d/h+p)),Math.min(s,Math.floor(a+(h-u)*d/h+p)),l)}let h=r[2*a+l],u=n,c=s;for(pc(i,r,n,a),r[2*s+l]>h&&pc(i,r,n,s);u<c;){for(pc(i,r,u,c),u++,c--;r[2*u+l]<h;)u++;for(;r[2*c+l]>h;)c--}r[2*n+l]===h?pc(i,r,n,c):pc(i,r,++c,s),c<=a&&(n=c+1),a<=c&&(s=c-1)}})(i,r,h,n,s,l),e(i,r,a,n,h-1,1-l),e(i,r,a,h+1,s,1-l)}(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,i,r,a){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:n,coords:s,nodeSize:l}=this,h=[0,n.length-1,0],u=[];for(;h.length;){let c=h.pop()||0,d=h.pop()||0,p=h.pop()||0;if(d-p<=l){for(let l=p;l<=d;l++){let h=s[2*l],c=s[2*l+1];h>=e&&h<=r&&c>=i&&c<=a&&u.push(n[l])}continue}let f=p+d>>1,m=s[2*f],_=s[2*f+1];m>=e&&m<=r&&_>=i&&_<=a&&u.push(n[f]),(0===c?e<=m:i<=_)&&(h.push(p),h.push(f-1),h.push(1-c)),(0===c?r>=m:a>=_)&&(h.push(f+1),h.push(d),h.push(1-c))}return u}within(e,i,r){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:a,coords:n,nodeSize:s}=this,l=[0,a.length-1,0],h=[],u=r*r;for(;l.length;){let c=l.pop()||0,d=l.pop()||0,p=l.pop()||0;if(d-p<=s){for(let r=p;r<=d;r++)pp(n[2*r],n[2*r+1],e,i)<=u&&h.push(a[r]);continue}let f=p+d>>1,m=n[2*f],_=n[2*f+1];pp(m,_,e,i)<=u&&h.push(a[f]),(0===c?e-r<=m:i-r<=_)&&(l.push(p),l.push(f-1),l.push(1-c)),(0===c?e+r>=m:i+r>=_)&&(l.push(f+1),l.push(d),l.push(1-c))}return h}}function pc(e,i,r,a){pd(e,r,a),pd(i,2*r,2*a),pd(i,2*r+1,2*a+1)}function pd(e,i,r){let a=e[i];e[i]=e[r],e[r]=a}function pp(e,i,r,a){let n=e-r,s=i-a;return n*n+s*s}e.$=aN,e.A=class extends cA{},e.B=im,e.C=tq,e.D=aY,e.E=tD,e.F=r5,e.G=r2,e.H=r4,e.I=uh,e.J=aa,e.K=aJ,e.L=al,e.M=an,e.N=rr,e.O=rn,e.P=eA,e.Q=ri,e.R=tg,e.S=iv,e.T=u7,e.U=tF,e.V=cA,e.W=aK,e.X=r6,e.Y=r3,e.Z=function(e){let i=e.value,r=[];if(!i)return r;let a=im(i);return"string"!==a?r=r.concat([new cA(e.key,i,`string expected, "${a}" found`)]):(cI(i,!0)||(r=r.concat([new cA(e.key,i,`invalid url "${i}"`)])),r)},e._=aX,e.a=function(e){return e6.API_CDN_URL_REGEX.test(e)},e.a$=no,e.a0=aZ,e.a1=aW,e.a2=class{constructor(e){this.specification=e}possiblyEvaluate(e,i){return eJ(e.expression.evaluate(i))}interpolate(e,i,r){return{x:tU(e.x,i.x,r),y:tU(e.y,i.y,r),z:tU(e.z,i.z,r),azimuthal:tU(e.azimuthal,i.azimuthal,r),polar:tU(e.polar,i.polar,r)}}},e.a3=aO,e.a4=as,e.a5=oF,e.a6=eS,e.a7=eO,e.a8=aq,e.a9=sD,e.aA=si,e.aB=cn,e.aC=co,e.aD=ca,e.aE=function(e,i){let r=document.createElement("video");r.muted=!0,r.onloadstart=function(){i(null,r)};for(let i=0;i<e.length;i++){let a=document.createElement("source");(function(e){let i=document.createElement("a");return i.href=e,i.protocol===location.protocol&&i.host===location.host})(e[i])||(r.crossOrigin="Anonymous"),a.src=e[i],r.appendChild(a)}return{cancel:()=>{}}},e.aF=ce,e.aG=function(e){return fetch(e).then(e=>e.arrayBuffer()).then(i=>pt(i,0,e))},e.aH=pa,e.aI=class{constructor(e,i,r,a){this.id=e,this.position=null!=i?new oA(i[0],i[1]):new oA(0,0),this.orientation=null!=r?r:[0,0,0],this.nodes=a,this.uploaded=!1,this.aabb=new sm([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(e,i){if(eS.mat4.multiply(e.matrix,i,e.matrix),e.meshes)for(let i of e.meshes){let r=sm.applyTransformFast(i.aabb,e.matrix);this.aabb.encapsulate(r)}if(e.children)for(let i of e.children)this._applyTransformations(i,e.matrix)}computeBoundsAndApplyParent(){let e=eS.mat4.identity([]);for(let i of this.nodes)this._applyTransformations(i,e)}computeModelMatrix(e,i,r,a,n,s,l=!1){cR(this.matrix,this,e.transform,this.position,i,r,a,n,s,l)}upload(e){if(!this.uploaded){for(let i of this.nodes)cD(i,e);for(let e of this.nodes)cO(e);this.uploaded=!0}}destroy(){for(let e of this.nodes)cB(e)}},e.aJ=eG,e.aK=function(e){return e.indexOf("\x1f")>=0},e.aL=uC,e.aM=ok,e.aN=oR,e.aO=nl,e.aP=nS,e.aQ=eU,e.aR=nV,e.aS=u2,e.aT=function(){aD.isLoading()||aD.isLoaded()||"deferred"!==aR()||az()},e.aU=aQ,e.aV=oj,e.aW=c$,e.aX=eQ,e.aY=hw,e.aZ=lc,e.a_=oU,e.aa=tU,e.ab=8192,e.ac=tj,e.ad=class{constructor(e){this.specification=e}
212possiblyEvaluate(e,i){return function([e,i]){let r=eJ([1,e,i]);return{x:r.x,y:r.y,z:r.z}}(e.expression.evaluate(i))}interpolate(e,i,r){return{x:tU(e.x,i.x,r),y:tU(e.y,i.y,r),z:tU(e.z,i.z,r)}}},e.ae=function(e,i,r=0,a=!0){let n=new eA(r,r),s=e.sub(n),l=i.add(n),h=[s,new eA(l.x,s.y),l,new eA(s.x,l.y)];return a&&h.push(s.clone()),h},e.af=function(e,i){let r=[];for(let a=0;a<e.length;a++){let n=eB(a-1,-1,e.length-1),s=eB(a+1,-1,e.length-1),l=e[a],h=e[s],u=e[n].sub(l).unit(),c=h.sub(l).unit(),d=c.angleWithSep(u.x,u.y),p=u.add(c).unit().mult(-1*i/Math.sin(d/2));r.push(l.add(p))}return r},e.ag=uP,e.ah=oQ,e.ai=function(e,i,r=0){return eS.vec3.fromValues(((i.x-r)*e.scale-e.x)*8192,(i.y*e.scale-e.y)*8192,i.z*oC(oR(i.y)))},e.aj=sl,e.ak=hS,e.al=function(e){let i=1/0,r=1/0,a=-1/0,n=-1/0;for(let s of e)i=Math.min(i,s.x),r=Math.min(r,s.y),a=Math.max(a,s.x),n=Math.max(n,s.y);return{min:new eA(i,r),max:new eA(a,n)}},e.am=oP,e.an=oK,e.ao=oN,e.ap=eD,e.aq=ob,e.ar=function(e,i){let r={};for(let a=0;a<i.length;a++){let n=i[a];n in e&&(r[n]=e[n])}return r},e.as=oI,e.at=oL,e.au=class{constructor(e){this.entries={},this.scheduler=e}request(e,i,r,a){let n=this.entries[e]=this.entries[e]||{callbacks:[]};if(n.result){let[e,r]=n.result;return this.scheduler?this.scheduler.add(()=>{a(e,r)},i):a(e,r),()=>{}}return n.callbacks.push(a),n.cancel||(n.cancel=r((r,a)=>{for(let e of(n.result=[r,a],n.callbacks))this.scheduler?this.scheduler.add(()=>{e(r,a)},i):e(r,a);setTimeout(()=>delete this.entries[e],3e3)})),()=>{n.result||(n.callbacks=n.callbacks.filter(e=>e!==a),n.callbacks.length||(n.cancel(),delete this.entries[e]))}}},e.av=a8,e.aw=function(e,i,r){let a=JSON.stringify(e.request);return e.data&&(this.deduped.entries[a]={result:[null,e.data]}),this.deduped.request(a,{type:"parseTile",isSymbolTile:e.isSymbolTile,zoom:e.tileZoom},i=>{let a=tb(e.request,(e,a,n,s)=>{e?i(e):a&&i(null,{vectorTile:r?void 0:new lR.VectorTile(new hJ(a)),rawData:a,cacheControl:n,expires:s})});return()=>{a.cancel(),i()}},i)},e.ax=function(e){++th>tn&&(e.getActor().send("enforceCacheSizeLimit",ta),th=0)},e.ay=e7,e.az=function(e){return e<=1?1:Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},e.b=function(e){return e6.API_FONTS_REGEX.test(e)},e.b$=sh,e.b0=nR,e.b1=ss,e.b2=n0,e.b3=s1,e.b4=u6,e.b5=function(e,i){let r=sD(i.zoom);if(0===r)return sb(e);let a=sM(e),n=sE(a),s=oP(a.getWest())*i.worldSize,l=oP(a.getEast())*i.worldSize,h=oL(a.getNorth())*i.worldSize,u=oL(a.getSouth())*i.worldSize,c=[s,h,0],d=[l,h,0],p=[s,u,0],f=[l,u,0],m=eS.mat4.invert([],i.globeMatrix);return eS.vec3.transformMat4(c,c,m),eS.vec3.transformMat4(d,d,m),eS.vec3.transformMat4(p,p,m),eS.vec3.transformMat4(f,f,m),n[0]=sw(n[0],p,r),n[1]=sw(n[1],f,r),n[2]=sw(n[2],d,r),n[3]=sw(n[3],c,r),sm.fromPoints(n)},e.b6=sP,e.b7=sA,e.b8=sw,e.b9=ns,e.bA=tN,e.bB=eB,e.bC=function(e){return e*eC},e.bD=e1,e.bE=function(e,i){return e/oC(i)},e.bF=function(e,i,r){e[4*i+0]=r[0],e[4*i+1]=r[1],e[4*i+2]=r[2],e[4*i+3]=r[3]},e.bG=on,e.bH=oe,e.bI=ot,e.bJ=n7,e.bK=n9,e.bL=oA,e.bM=uH,e.bN=st,e.bO=sf,e.bP=cu,e.bQ=se,e.bR=sS,e.bS=function(e,i,r,a,n,s,l,h,u){if("globe"===u.name)return sS(e,i,new se(r,a,n),!1);let c=uC({z:r,x:a,y:n},u);return new sm([(s+c.x/c.scale)*i,i*(c.y/c.scale),l],[(s+c.x2/c.scale)*i,i*(c.y2/c.scale),h])},e.bT=function(e,i,r){let a=0;for(let r=0;r<2;++r)e[r]>0&&(a+=(e[r]-0)*(e[r]-0)),i[r]<0&&(a+=(0-i[r])*(0-i[r]));return a},e.bU=85.051129,e.bV=6,e.bW=function(e){let i=eS.mat4.identity(new Float64Array(16));eS.mat4.multiply(i,e.pixelMatrix,e.globeMatrix);let r=[0,oT,0],a=[0,ob,0];return eS.vec3.transformMat4(r,r,i),eS.vec3.transformMat4(a,a,i),[r[0]>0&&r[0]<=e.width&&r[1]>0&&r[1]<=e.height&&!sB(e,new oA(e.center.lat,90)),a[0]>0&&a[0]<=e.width&&a[1]>0&&a[1]<=e.height&&!sB(e,new oA(e.center.lat,-90))]},e.bX=function(e,i){let{scale:r}=e.tileTransform,a=8192*r/(e.tileSize*Math.pow(2,i.zoom-e.tileID.overscaledZ+e.tileID.canonical.z));return eS.mat2.scale(new Float32Array(4),i.inverseAdjustmentMatrix,[a,a])},e.bY=cc,e.bZ=ch,e.b_=function(e){let i=ch(e,!0);return eS.mat2.invert([],[i[0],i[1],i[4],i[5]])},e.ba=so,e.bb=dU,e.bc=hJ,e.bd=tb,e.be=function(e){let i=[];for(let r in e)i.push(e[r]);return i},e.bf=function(e,i){let r=[];for(let a in e)a in i||r.push(a);return r},e.bg=eF,e.bh=["type","source","source-layer","minzoom","maxzoom","filter","layout"],e.bi=eI,e.bj=function(e,i){let{x:r,y:a}=e.point,n=sz(r,a,e.worldSize/e._pixelsPerMercatorPixel,0,0);return eS.mat4.multiply(n,n,sL(sb(i)))},e.bk=hG,e.bl=h1,e.bm=hj,e.bn=function(e,i,r,a,n){let s=5*i+2;e.float32[s+0]=r,e.float32[s+1]=a,e.float32[s+2]=n},e.bo=uQ,e.bp=us,e.bq=o$,e.br=24,e.bs=lV,e.bt=cE,e.bu=lH,e.bv=lZ,e.bw=uT,e.bx=uw,e.by=ue,e.bz=pu,e.c=e9,e.c$=sa,e.c0=function(e){let{x:i,y:r}=e.point,{lng:a,lat:n}=e._center;return sz(i,r,e.worldSize,a,n)},e.c1=function(e){return e*eP},e.c2=sr,e.c3=5,e.c4=function(e){return eL[Math.round((e+45+360)%360/90)%4]},e.c5=45,e.c6=oC,e.c7=oi,e.c8=function(e,i,r){let a=Math.sqrt(e*e+i*i+r*r),n=a>0?Math.acos(r/a)*eP:0,s=0!==e||0!==i?Math.atan2(-i,-e)*eP+90:0;return s<0&&(s+=360),[a,s,n]}
212,e.c9=oB,e.cA=function(e){return Math.round(Math.pow(Math.abs(Math.sin((e=eD(e,-80.051129,80.051129)/80.051129*90)*eC)),3)*(ow.length-1))},e.cB=function(e,i,r,a){let n=i.getNorth(),s=i.getSouth(),l=i.getWest(),h=i.getEast(),u=1<<e.z,c=h-l,d=n-s,p=c/64,f=-d/ow[r],m=[0,p,0,f,0,0,n,l,0];if(e.z>0){let e=180/a;eS.mat3.multiply(m,m,[e/c+1,0,0,0,e/d+1,0,-.5*e/p,.5*e/f,1])}return m[2]=u,m[5]=e.x,m[8]=e.y,m},e.cC=sb,e.cD=function(e,i,r){let a=eS.mat4.identity(new Float64Array(16)),n=(i/(1<<e)-.5)*Math.PI*2;return eS.mat4.rotateY(a,r.globeMatrix,n),Float32Array.from(a)},e.cE=class{isDataAvailableAtPoint(e){let i=this._source();if(this.isUsingMockSource()||!i||e.y<0||e.y>1)return!1;let r=i.getSource().maxzoom,a=1<<r,n=Math.floor(e.x),s=Math.floor((e.x-n)*a),l=Math.floor(e.y*a),h=this.findDEMTileFor(new si(r,n,r,s,l));return!(!h||!h.dem)}getAtPointOrZero(e,i=0){return this.getAtPoint(e,i)||0}getAtPoint(e,i,r=!0){if(this.isUsingMockSource())return null;null==i&&(i=null);let a=this._source();if(!a||e.y<0||e.y>1)return i;let n=a.getSource().maxzoom,s=1<<n,l=Math.floor(e.x),h=e.x-l,u=new si(n,l,n,Math.floor(h*s),Math.floor(e.y*s)),c=this.findDEMTileFor(u);if(!c||!c.dem)return i;let d=c.dem,p=1<<c.tileID.canonical.z,f=(h*p-c.tileID.canonical.x)*d.dim,m=(e.y*p-c.tileID.canonical.y)*d.dim,_=Math.floor(f),g=Math.floor(m);return(r?this.exaggeration():1)*tU(tU(d.get(_,g),d.get(_,g+1),m-g),tU(d.get(_+1,g),d.get(_+1,g+1),m-g),f-_)}getAtTileOffset(e,i,r){let a=1<<e.canonical.z;return this.getAtPointOrZero(new oF(e.wrap+(e.canonical.x+i/8192)/a,(e.canonical.y+r/8192)/a))}getAtTileOffsetFunc(e,i,r,a){return n=>{let s=this.getAtTileOffset(e,n.x,n.y),l=a.upVector(e.canonical,n.x,n.y),h=a.upVectorScale(e.canonical,i,r).metersToTile;return eS.vec3.scale(l,l,s*h),l}}getForTilePoints(e,i,r,a){if(this.isUsingMockSource())return!1;let n=cF.create(this,e,a);return!!n&&(i.forEach(e=>{e[2]=this.exaggeration()*n.getElevationAt(e[0],e[1],r)}),!0)}getMinMaxForTile(e){if(this.isUsingMockSource())return null;let i=this.findDEMTileFor(e);if(!i||!i.dem)return null;let r=i.dem.tree,a=i.tileID,n=1<<e.canonical.z-a.canonical.z,s=e.canonical.x/n-a.canonical.x,l=e.canonical.y/n-a.canonical.y,h=0;for(let i=0;i<e.canonical.z-a.canonical.z&&!r.leaves[h];i++){let e=2*Math.floor(l*=2)+Math.floor(s*=2);h=r.childOffsets[h]+e,s%=1,l%=1}return{min:this.exaggeration()*r.minimums[h],max:this.exaggeration()*r.maximums[h]}}getMinElevationBelowMSL(){throw Error("Pure virtual method called.")}raycast(e,i,r){throw Error("Pure virtual method called.")}pointCoordinate(e){throw Error("Pure virtual method called.")}_source(){throw Error("Pure virtual method called.")}isUsingMockSource(){throw Error("Pure virtual method called.")}exaggeration(){throw Error("Pure virtual method called.")}findDEMTileFor(e){throw Error("Pure virtual method called.")}get visibleDemTiles(){throw Error("Getter must be implemented in subclass.")}getMinMaxForVisibleTiles(){let e=this.visibleDemTiles;if(0===e.length)return null;let i=!1,r=Number.MAX_VALUE,a=Number.MIN_VALUE;for(let n of e){let e=this.getMinMaxForTile(n.tileID);e&&(r=Math.min(r,e.min),a=Math.max(a,e.max),i=!0)}return i?{min:r,max:a}:null}},e.cF=sK,e.cG=s_,e.cH=function(e,i){return[Math.pow(e[0],2.2)*i,Math.pow(e[1],2.2)*i,Math.pow(e[2],2.2)*i]},e.cI=sR,e.cJ=e5,e.cK=e4,e.cL=256,e.cM=function(e,i){let r=[0,0,0],a=sP(sb(i.canonical));return eS.vec3.transformMat4(r,r,a),eS.vec3.transformMat4(r,r,e),r},e.cN=e=>({u_camera_to_center_distance:new n7(e),u_extrude_scale:new ol(e),u_device_pixel_ratio:new n7(e),u_matrix:new on(e),u_inv_rot_matrix:new on(e),u_merc_center:new oe(e),u_tile_id:new ot(e),u_zoom_transition:new n7(e),u_up_dir:new ot(e),u_emissive_strength:new n7(e)}),e.cO=e=>({u_matrix:new on(e),u_pixels_to_tile_units:new ol(e),u_device_pixel_ratio:new n7(e),u_units_to_pixels:new oe(e),u_dash_image:new n9(e),u_gradient_image:new n9(e),u_image_height:new n7(e),u_texsize:new oe(e),u_tile_units_to_pixels:new n7(e),u_alpha_discard_threshold:new n7(e),u_trim_offset:new oe(e),u_trim_fade_range:new oe(e),u_trim_color:new oi(e),u_emissive_strength:new n7(e),u_zbias_factor:new n7(e),u_tile_to_meter:new n7(e)}),e.cP=e=>({u_matrix:new on(e),u_texsize:new oe(e),u_pixels_to_tile_units:new ol(e),u_device_pixel_ratio:new n7(e),u_image:new n9(e),u_units_to_pixels:new oe(e),u_tile_units_to_pixels:new n7(e),u_alpha_discard_threshold:new n7(e),u_trim_offset:new oe(e),u_emissive_strength:new n7(e),u_zbias_factor:new n7(e),u_tile_to_meter:new n7(e)}),e.cQ=nw,e.cR=hV,e.cS=hq,e.cT=sj,e.cU=(e,i,r,a,n,s)=>{let l;let h=e.transform,u="globe"===h.projection.name;if("map"===s.paint.get("circle-pitch-alignment")){if(u){let e=sR(h.zoom,i.canonical)*h._pixelsPerMercatorPixel;l=Float32Array.from([e,0,0,e])}else l=h.calculatePixelsToTileUnitsMatrix(r)}else l=new Float32Array([h.pixelsToGLUnits[0],0,0,h.pixelsToGLUnits[1]]);let c={u_camera_to_center_distance:e.transform.getCameraToCenterDistance(h.projection),u_matrix:e.translatePosMatrix(i.projMatrix,r,s.paint.get("circle-translate"),s.paint.get("circle-translate-anchor")),u_device_pixel_ratio:te.devicePixelRatio,u_extrude_scale:l,u_inv_rot_matrix:sU,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:s.paint.get("circle-emissive-strength")};if(u){c.u_inv_rot_matrix=a,c.u_merc_center=n,c.u_tile_id=[i.canonical.x,i.canonical.y,1<<i.canonical.z],c.u_zoom_transition=sD(h.zoom);let e=8192*n[0],r=8192*n[1];c.u_up_dir=h.projection.upVector(new se(0,0,0),e,r)}return c},e.cV=hI,e.cW=(e,i,r,a,n,s)=>{let l=e.transform,h=l.pitch<15?hM(.07,.7,eD((14-l.zoom)/5,0,1)):.07;return{u_matrix:hA(e,i,r,a),u_texsize:i.imageAtlasTexture?i.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:l.calculatePixelsToTileUnitsMatrix(i),u_device_pixel_ratio:n,u_image:0,u_tile_units_to_pixels:hE(i,l),u_units_to_pixels:[1/l.pixelsToGLUnits[0],1/l.pixelsToGLUnits[1]],u_alph
212a_discard_threshold:0,u_trim_offset:s,u_emissive_strength:r.paint.get("line-emissive-strength"),u_zbias_factor:h,u_tile_to_meter:oB(i.tileID.canonical,0)}},e.cX=(e,i,r,a,n,s,l)=>{let h=e.transform,u=h.calculatePixelsToTileUnitsMatrix(i),c=h.pitch<15?hM(.07,.7,eD((14-h.zoom)/5,0,1)):.07;return{u_matrix:hA(e,i,r,a),u_pixels_to_tile_units:u,u_device_pixel_ratio:s,u_units_to_pixels:[1/h.pixelsToGLUnits[0],1/h.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:n,u_texsize:hC(r)&&i.lineAtlasTexture?i.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:hE(i,e.transform),u_alpha_discard_threshold:0,u_trim_offset:l,u_trim_fade_range:r.paint.get("line-trim-fade-range"),u_trim_color:r.paint.get("line-trim-color").toRenderColor(r.lut).toArray01(),u_emissive_strength:r.paint.get("line-emissive-strength"),u_zbias_factor:c,u_tile_to_meter:oB(i.tileID.canonical,0)}},e.cY=ej,e.cZ=sQ,e.c_=hl,e.ca=sm,e.cb=eJ,e.cc=function(e){return[Math.pow(e[0],1/2.2),Math.pow(e[1],1/2.2),Math.pow(e[2],1/2.2)]},e.cd=function(e){return e({pluginStatus:aI,pluginURL:aC}),ak.on("pluginStateChange",e),e},e.ce=cK,e.cf=dH,e.cg=uf,e.ch=up,e.ci=tx,e.cj=aP,e.ck=ti,e.cl=tP,e.cm=eH,e.cn=function(e){let i=e.indexOf("\x1f");return i>=0?e.slice(0,i):e},e.co=function(e){let i=e.indexOf("\x1f");return i>=0?e.slice(i+1):""},e.cp=function(e){let i=[],r=e.id;return void 0===r&&i.push({message:`layers.${r}: missing required property "id"`}),void 0===e.render&&i.push({message:`layers.${r}: missing required method "render"`}),e.renderingMode&&"2d"!==e.renderingMode&&"3d"!==e.renderingMode&&i.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),i},e.cq=function(e,i,r,a){return"custom"===e.type?new cs(e,i):new cZ[e.type](e,i,r,a)},e.cr=e$,e.cs=ak,e.ct=tv,e.cu=or,e.cv=class extends n8{constructor(e){super(e),this.current=oo}set(e,i,r){if(this.fetchUniformLocation(e,i)){for(let e=0;e<9;e++)if(r[e]!==this.current[e]){this.current=r,this.gl.uniformMatrix3fv(this.location,!1,r);break}}}},e.cw=ek,e.cx=function(e,i,r){let a=sD(r.zoom),n=e.style.map._antialias,s=i.options.extStandardDerivativesForceOff||e.terrain&&e.terrain.exaggeration()>0;return 0===a&&!n&&!s},e.cy=function(e){let i=e.pixelsPerMeter,r=i/(1/oC(e.center.lat)),a=eS.mat4.identity(new Float64Array(16));return eS.mat4.translate(a,a,[e.point.x,e.point.y,0]),eS.mat4.scale(a,a,[r,r,i]),Float32Array.from(a)},e.cz=sM,e.d=function(e){return e6.API_TILEJSON_REGEX.test(e)},e.d$=W,e.d0=ht,e.d1=0x80000000,e.d2=450,e.d3=7,e.d4=.0038760859073359074,e.d5=na,e.d6=nB,e.d7=256,e.d8=sL,e.d9=nd,e.dA=sO,e.dB=function(e){let i=[0,0,0],r=eS.mat4.identity(new Float64Array(16));return eS.mat4.multiply(r,e.pixelMatrix,e.globeMatrix),eS.vec3.transformMat4(i,i,r),new eA(i[0],i[1])},e.dC=function(e,i,r=!1){if(aI===aS||aI===aM||aI===aE)throw Error("setRTLTextPlugin cannot be called multiple times.");aC=te.resolveURL(e),aI=aS,aA=i,aL(),r||az()},e.dD=aR,e.dE=function(){dH().acquire(dW)},e.dF=function(){let e=q;e&&(e.isPreloaded()&&1===e.numActive()?(e.release(dW),q=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.dG=d$,e.dH=function(e){let i=ts();if(!i)return;let r=i.delete(tr);e&&r.catch(e).then(()=>e())},e.dI=dq,e.dJ=d0,e.dK=function(e){dX=te.resolveURL(e),dQ||(dQ=new cK(dH(),new tD)),dQ.broadcast("setDracoUrl",dX)},e.dL=d1,e.dM=function(e){dJ=te.resolveURL(e),dQ||(dQ=new cK(dH(),new tD)),dQ.broadcast("setMeshoptUrl",dJ)},e.dN=af,e.dO=sY,e.dP=2,e.dQ=pn,e.dR=po,e.dS=hy,e.dT=eW,e.dU=uu,e.dV=function(e,i,r,a,n,s,l,h,u,c,d=1,p){e.createArrays(),e.tilePixelRatio=8192/(512*e.overscaling),e.compareText={},e.iconsNeedLinear=!1;let f=e.layers[0].layout,m=e.layers[0]._unevaluatedLayout._values,_={};if(_.scaleFactor=d,_.textSizeScaleRange=f.get("text-size-scale-range"),_.iconSizeScaleRange=f.get("icon-size-scale-range"),_.textScaleFactor=eD(_.scaleFactor,_.textSizeScaleRange[0],_.textSizeScaleRange[1]),_.iconScaleFactor=eD(_.scaleFactor,_.iconSizeScaleRange[0],_.iconSizeScaleRange[1]),"composite"===e.textSizeData.kind){let{minZ
212oom:i,maxZoom:r}=e.textSizeData;_.compositeTextSizes=[m["text-size"].possiblyEvaluate(new aO(i),h),m["text-size"].possiblyEvaluate(new aO(r),h)]}if("composite"===e.iconSizeData.kind){let{minZoom:i,maxZoom:r}=e.iconSizeData;_.compositeIconSizes=[m["icon-size"].possiblyEvaluate(new aO(i),h),m["icon-size"].possiblyEvaluate(new aO(r),h)]}_.layoutTextSize=m["text-size"].possiblyEvaluate(new aO(u+1),h),_.layoutIconSize=m["icon-size"].possiblyEvaluate(new aO(u+1),h),_.textMaxSize=m["text-size"].possiblyEvaluate(new aO(18),h);let g="map"===f.get("text-rotation-alignment")&&"point"!==f.get("symbol-placement"),y=f.get("text-size"),x=!1;for(let i of e.features)if(i.icon&&i.icon.nameSecondary){x=!0;break}for(let s of e.features){let u=f.get("text-font").evaluate(s,{},h).join(","),d=y.evaluate(s,{},h)*_.textScaleFactor,m=_.layoutTextSize.evaluate(s,{},h)*_.textScaleFactor,v=(_.layoutIconSize.evaluate(s,{},h),{horizontal:{},vertical:void 0}),b=s.text,w,T=[0,0];if(b){let a=b.toString(),l=24*f.get("text-letter-spacing").evaluate(s,{},h),c=24*f.get("text-line-height").evaluate(s,{},h),p=!function(e){for(let r of e){var i;if(i=r.charCodeAt(0),ax.Arabic(i)||ax["Arabic Supplement"](i)||ax["Arabic Extended-A"](i)||ax["Arabic Presentation Forms-A"](i)||ax["Arabic Presentation Forms-B"](i))return!1}return!0}(a)?0:l,_=f.get("text-anchor").evaluate(s,{},h),y=f.get("text-variable-anchor");if(!y){let e=f.get("text-radial-offset").evaluate(s,{},h);T=e?uw(_,[24*e,uv]):f.get("text-offset").evaluate(s,{},h).map(e=>24*e)}let x=g?"center":f.get("text-justify").evaluate(s,{},h),w="point"===f.get("symbol-placement"),S=w?24*f.get("text-max-width").evaluate(s,{},h):1/0,M=s=>{e.allowVerticalPlacement&&av(a)&&(v.vertical=h4(b,i,r,n,u,S,c,_,s,p,T,h1.vertical,!0,m,d))};if(!g&&y){let e="auto"===x?y.map(e=>uT(e)):[x],a=!1;for(let s=0;s<e.length;s++){let l=e[s];if(!v.horizontal[l]){if(a)v.horizontal[l]=v.horizontal[0];else{let e=h4(b,i,r,n,u,S,c,"center",l,p,T,h1.horizontal,!1,m,d);e&&(v.horizontal[l]=e,a=1===e.positionedLines.length)}}}M("left")}else{if("auto"===x&&(x=uT(_)),w||f.get("text-writing-mode").indexOf("horizontal")>=0||!av(a)){let e=h4(b,i,r,n,u,S,c,_,x,p,T,h1.horizontal,!1,m,d);e&&(v.horizontal[x]=e)}M(w?"left":x)}}let S=!1;if(s.icon&&s.icon.namePrimary){let i=a[s.icon.namePrimary];i&&(w=function(e,i,r,a){let{horizontalAlign:n,verticalAlign:s}=ue(a),l=r[0]-e.displaySize[0]*n,h=r[1]-e.displaySize[1]*s;return{imagePrimary:e,imageSecondary:i,top:h,bottom:h+e.displaySize[1],left:l,right:l+e.displaySize[0]}}(n[s.icon.namePrimary],s.icon.nameSecondary?n[s.icon.nameSecondary]:void 0,f.get("icon-offset").evaluate(s,{},h),f.get("icon-anchor").evaluate(s,{},h)),S=i.sdf,void 0===e.sdfIcons?e.sdfIcons=i.sdf:e.sdfIcons!==i.sdf&&eX("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(i.pixelRatio!==e.pixelRatio||0!==f.get("icon-rotate").constantOr(1))&&(e.iconsNeedLinear=!0))}let M=uM(v.horizontal)||v.vertical;e.iconsInText||(e.iconsInText=!!M&&M.iconsInText),(M||w)&&function(e,i,r,a,n,s,l,h,u,c,d,p,f,m,_){var g;let y,x=s.textMaxSize.evaluate(i,{},p);void 0===x?x=l*s.textScaleFactor:x*=s.textScaleFactor;let v=e.layers[0].layout,b=v.get("icon-offset").evaluate(i,{},p),w=uM(r.horizontal)||r.vertical,T="globe"===f.name,S=l*s.textScaleFactor/24,M=e.tilePixelRatio*x/24,E=(g=e.overscaling,e.zoom>18&&g>2&&(g>>=1),Math.max(8192/(512*g),1)*v.get("symbol-spacing")),A=v.get("text-padding")*e.tilePixelRatio,I=v.get("icon-padding")*e.tilePixelRatio,C=v.get("text-max-angle")*eC,P="map"===v.get("text-rotation-alignment")&&"point"!==v.get("symbol-placement"),L="map"===v.get("icon-rotation-alignment")&&"point"!==v.get("symbol-placement"),k=v.get("symbol-placement"),R=E/2,z=v.get("icon-text-fit").evaluate(i,{},p),D=v.get("icon-text-fit-padding").evaluate(i,{},p),O="none"!==z;!1===e.hasAnyIconTextFit&&O&&(e.hasAnyIconTextFit=!0),a&&O&&(e.allowVerticalPlacement&&r.vertical&&(y=ui(a,r.vertical,z,D,b,S)),w&&(a=ui(a,w,z,D,b,S)));let B=(l,h,g)=>{if(h.x<0||h.x>=8192||h.y<0||h.y>=8192)return;let x=null;if(T){let{x:e,y:i,z:r}=f.projectTilePoint(h.x,h.y,g);x={anchor:new ur(e,i,r,0,void 0),up:f.upVector(g,h.x,h.y)}}!function(e,i,r,a,n,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,M,E,A,I){let C=e.addToLineVertexArray(i,a),P,L,k,R,z,D,O,B=0,F=0,N=0,V=0,U=-1,j=-1,G={},q=tP(""),W=r?r.anchor:i,$="none"!==u.layout.get("icon-text-fit").evaluate(w,{},E),H=0,Z=0;if(void 0===u._unevaluatedLayout.getValue("text-radial-offset")?[H,Z]=u.layout.get("text-offset").evaluate(w,{},E).map(e=>24*e):(H=24*u.layout.get("text-radial-offset").evaluate(w,{},E),Z=uv),e.allowVerticalPlacement&&n.vertical){let e=n.vertical;if(_)D=uA(e),h&&(O=uA(h));else{let r=u.layout.get("text-rotate").evaluate(w,{},E)+90;k=uE(c,W,i,d,p,f,e,m,r,g),h&&(R=uE(c,W,i,d,p,f,h,x,r))}}if(s){let a=u.layout.get("icon-rotate").evaluate(w,{},E),n=um(s,a,S,$,T.iconScaleFactor),l=h?um(h,a,S,$,T.iconScaleFactor):void 0;L=uE(c,W,i,d,p,f,s,x,a),B=4*n.length;let m=e.iconSizeData,_=null;"source"===m.kind?(_=[128*u.layout.get("icon-size").evaluate(w,{},E)*T.iconScaleFactor])[0]>32640&&eX(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`):"composite"===m.kind&&((_=[128*T.compositeIconSizes[0].evaluate(w,{},E)*T.iconScaleFactor,128*T.compositeIconSizes[1].evaluate(w,{},E)*T.iconScaleFactor])[0]>32640||_[1]>32640)&&eX(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`),e.addSymbols(e.icon,n,_,b,v,w,!1,r,i,C.lineStartIndex,C.lineLength,-1,M,E,A,I),U=e.icon.placedSymbolArray.length-1,l&&(F=4*l.length,e.addSymbols(e.icon,l,_,b,v,w,h1.vertical,r,i,C.lineStartIndex,C.lineLength,-1,M,E,A,I),j=e.icon.placedSymbolArray.length-1)}for(let a in n.horizontal){let s=n.horizontal[a];P||(q=tP(s.text),_?z=uA(s):P=uE(c,W,i,d,p,f,s,m,u.layout.get("text-rotate").evaluate(w,{},E),g));let h=1===s.positionedLines.length;if(N+=uS(e,r,i,s,l,u,_,w,g,C,n.vertical?h1.horizontal:h1.horizontalOnly,h?Object.keys(n.horizontal):[a],G,U,T,M,E,A),h)break}n.vertical&&(V+=uS(e,r,i,n.vertical,l,u,_,w,g,C,h1.vertical,["vertical"],G,j,T,M,E,A));let X=-1,Y=(e,i)=>e?Math.max(e,i):i;X=Y(z,-1),X=Y(D,X);let J=+((X=Y(O,X))>-1);e.glyphOffsetArray.length>=65535&&eX("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==w.sortKey&&e.addToSortKey
212Ranges(e.symbolInstances.length,w.sortKey),e.symbolInstances.emplaceBack(i.x,i.y,W.x,W.y,W.z,G.right>=0?G.right:-1,G.center>=0?G.center:-1,G.left>=0?G.left:-1,G.vertical>=0?G.vertical:-1,U,j,q,void 0!==P?P:e.collisionBoxArray.length,void 0!==P?P+1:e.collisionBoxArray.length,void 0!==k?k:e.collisionBoxArray.length,void 0!==k?k+1:e.collisionBoxArray.length,void 0!==L?L:e.collisionBoxArray.length,void 0!==L?L+1:e.collisionBoxArray.length,R||e.collisionBoxArray.length,R?R+1:e.collisionBoxArray.length,d,N,V,B,F,J,0,H,Z,X,0,+!!$)}(e,h,x,l,r,a,n,y,e.layers[0],e.collisionBoxArray,i.index,i.sourceLayerIndex,e.index,A,P,u,0,I,L,b,i,s,c,d,p,m,_)};if("line"===k)for(let n of us(i.geometry,0,0,8192,8192))for(let i of function(e,i,r,a,n,s,l,h,u){let c=a?14.399999999999999*l:0,d=uo(a,n),p=d*l,f=0===e[0].x||8192===e[0].x||0===e[0].y||8192===e[0].y;return i-p<i/4&&(i=p+i/4),function e(i,r,a,n,s,l,h,u,c){let d=l/2,p=un(i),f=0,m=r-a,_=[];for(let e=0;e<i.length-1;e++){let r=i[e],h=i[e+1],u=r.dist(h),g=h.angleTo(r);for(;m+a<f+u;){let y=((m+=a)-f)/u,x=tU(r.x,h.x,y),v=tU(r.y,h.y,y);if(x>=0&&x<c&&v>=0&&v<c&&m-d>=0&&m+d<=p){let r=new ur(x,v,0,g,e);n&&!ua(i,r,l,n,s)||_.push(r)}}f+=u}return u||_.length||h||(_=e(i,f/2,a,n,s,l,h,!0,c)),_}(e,f?i/2*h%i:(d/2+48)*l*h%i,i,c,r,p,f,!1,8192)}(n,E,C,r.vertical||w,a,0,M,e.overscaling,8192))w&&function(e,i,r,a){let n=e.compareText;if(i in n){let e=n[i];for(let i=e.length-1;i>=0;i--)if(a.dist(e[i])<r)return!0}else n[i]=[];return n[i].push(a),!1}(e,w.text,R,i)||B(n,i,p);else if("line-center"===k){for(let e of i.geometry)if(e.length>1){let i=function(e,i,r,a,n,s){let l=r?14.399999999999999*s:0,h=uo(r,a)*s,u=0,c=un(e)/2;for(let r=0;r<e.length-1;r++){let a=e[r],n=e[r+1],s=a.dist(n);if(u+s>c){let d=(c-u)/s,p=new ur(tU(a.x,n.x,d),tU(a.y,n.y,d),0,n.angleTo(a),r);return!l||ua(e,p,h,l,i)?p:void 0}u+=s}}(e,C,r.vertical||w,a,0,M);i&&B(e,i,p)}}else if("Polygon"===i.type)for(let e of ls(i.geometry,0)){let i=function(e,i=1,r=!1){let a=1/0,n=1/0,s=-1/0,l=-1/0,h=e[0];for(let e=0;e<h.length;e++){let i=h[e];(!e||i.x<a)&&(a=i.x),(!e||i.y<n)&&(n=i.y),(!e||i.x>s)&&(s=i.x),(!e||i.y>l)&&(l=i.y)}let u=Math.min(s-a,l-n),c=u/2,d=new iG([],uy);if(0===u)return new eA(a,n);for(let i=a;i<s;i+=u)for(let r=n;r<l;r+=u)d.push(new ux(i+c,r+c,c,e));let p=function(e){let i=0,r=0,a=0,n=e[0];for(let e=0,s=n.length,l=s-1;e<s;l=e++){let s=n[e],h=n[l],u=s.x*h.y-h.x*s.y;r+=(s.x+h.x)*u,a+=(s.y+h.y)*u,i+=3*u}return new ux(r/i,a/i,0,e)}(e),f=d.length;for(;d.length;){let a=d.pop();(a.d>p.d||!p.d)&&(p=a,r&&console.log("found best %d after %d probes",Math.round(1e4*a.d)/1e4,f)),a.max-p.d<=i||(c=a.h/2,d.push(new ux(a.p.x-c,a.p.y-c,c,e)),d.push(new ux(a.p.x+c,a.p.y-c,c,e)),d.push(new ux(a.p.x-c,a.p.y+c,c,e)),d.push(new ux(a.p.x+c,a.p.y+c,c,e)),f+=4)}return r&&(console.log(`num probes: ${f}`),console.log(`best distance: ${p.d}`)),p.p}(e,16);B(e[0],new ur(i.x,i.y,0,0,void 0),p)}else if("LineString"===i.type)for(let e of i.geometry)B(e,new ur(e[0].x,e[0].y,0,0,void 0),p);else if("Point"===i.type)for(let e of i.geometry)for(let i of e)B([i],new ur(i.x,i.y,0,0,void 0),p)}(e,s,v,w,a,_,m,0,T,S,l,h,c,p,x)}s&&e.generateCollisionDebugBuffers(u,e.collisionBoxArray,_.textScaleFactor)},e.dW=lR,e.dX=c7,e.dY=eE,e.dZ=lk,e.d_=hY,e.da=nI,e.db=nC,e.dc=function(e,i,r,a,n){return eD((e-i)/(r-i)*(n-a)+a,a,n)},e.dd=rH,e.de=oD,e.df=class{constructor(e,i,r,a){this.context=e,this.format=a,this.size=r,this.texture=e.gl.createTexture();let[n,s,l]=this.size,{gl:h}=e;h.bindTexture(h.TEXTURE_3D,this.texture),e.pixelStoreUnpackFlipY.set(!1),e.pixelStoreUnpack.set(1),e.pixelStoreUnpackPremultiplyAlpha.set(!1),h.texImage3D(h.TEXTURE_3D,0,this.format,n,s,l,0,u8(this.format),u9(this.format),i.data)}bind(e,i){let{context:r}=this,{gl:a}=r;a.bindTexture(a.TEXTURE_3D,this.texture),e!==this.minFilter&&(a.texParameteri(a.TEXTURE_3D,a.TEXTURE_MAG_FILTER,e),a.texParameteri(a.TEXTURE_3D,a.TEXTURE_MIN_FILTER,e),this.minFilter=e),i!==this.wrapS&&(a.texParameteri(a.TEXTURE_3D,a.TEXTURE_WRAP_S,i),a.texParameteri(a.TEXTURE_3D,a.TEXTURE_WRAP_T,i),this.wrapS=i)}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}},e.dg=cg,e.dh=[1,1,1],e.di=cF,e.dj=ck,e.dk=nx,e.dl=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new eA(1/0,1/0),max:new eA(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(e,i=!1){let r=lW(new eA(0,0),new eA(8192,8192),e),a=[];if(i&&!lG(r,this._globalClipBounds))return a;for(let i of this._activeRegions){if(i.hiddenByOverlap||!lG(r,i))continue;let n=function(e,i,r){let a=1<<r.canonical.z,n=((i.x-r.wrap)*a-r.canonical.x)*8192,s=(i.y*a-r.canonical.y)*8192;return{min:new eA(((e.x-r.wrap)*a-r.canonical.x)*8192,(e.y*a-r.canonical.y)*8192),max:new eA(n,s)}}(i.min,i.max,e);a.push({min:n.min,max:n.max,sourceId:this._sourceIds[i.priority],footprint:i.footprint,footprintTileId:i.tileId,order:i.order,clipMask:i.clipMask,clipScope:i.clipScope})}return a}setSources(e){this._setSources(e.map(e=>({getSourceId:()=>e.cache.id,getFootprints:()=>{let i=[];for(let r of e.cache.getVisibleCoordinates()){let a=e.cache.getTile(r).buckets[e.layer];a&&a.updateFootprints(r.toUnwrapped(),i)}return i},getOrder:()=>e.order,getClipMask:()=>e.clipMask,getClipScope:()=>e.clipScope})))}_addSource(e){let i=e.getFootprints();if(0===i.length)return;let r=e.getOrder(),a=e.getClipMask(),n=e.getClipScope();for(let e of i){if(!e.footprint)continue;let i=lW(e.footprint.min,e.footprint.max,e.id);this._activeRegions.push({min:i.min,max:i.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:e.id,footprint:e.footprint,order:r,clipMask:a,clipScope:n})}this._sourceIds.push(e.getSourceId())}_computeReplacement(){this._activeRegions.sort((e,i)=>e.priority-i.priority||lU(e.min,i.min)||lU(e.max,i.max)||e.order-i.order||e.clipMask-i.clipMask||function(e,i){let r=(e,i)=>e+i;return e.length-i.length||e.reduce(r,"").localeCompare(i.reduce(r,""))}(e.clipScope,i.clipScope));let e=this._activeRegions.length!==this._prevRegions.length;if(!e){let i=0;for(;!e&&i!==this._activeRegions.length;){let r=this._activeRegions[i],a=this._prevRegions[i];e=r.priority!==a.priority||!lj(r,a)||r.order!==a.order||r.clipMask!==a.clipMask||!eI(r.clipScope,a.
212clipScope),++i}}if(e){for(let e of(++this._updateTime,this._activeRegions))e.order!==lN&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,e.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,e.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,e.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,e.max.y));let e=e=>{let i=this._activeRegions;if(e>=i.length)return e;let r=i[e].priority;for(;e<i.length&&i[e].priority===r;)++e;return e};if(this._sourceIds.length>1){let i=0,r=e(0);for(;i!==r;){let a=i,n=i;for(;a!==r;){let e=this._activeRegions[a];e.hiddenByOverlap=!1;for(let i=0;i<n;i++){let r=this._activeRegions[i];if(!r.hiddenByOverlap&&e.order===lN&&lG(e,r)&&(e.hiddenByOverlap=function e(i,r,a,n){if(!i||!a)return!1;let s=i.vertices;if(!r.canonical.equals(n.canonical)||r.wrap!==n.wrap){if(a.vertices.length<i.vertices.length)return e(a,n,i,r);let l=r.canonical,h=n.canonical,u=Math.pow(2,h.z-l.z);s=i.vertices.map(e=>new eA((e.x+8192*l.x)*u-8192*h.x,(e.y+8192*l.y)*u-8192*h.y))}return l$(a,s,i.indices,0,i.indices.length,0,0)}(e.footprint,e.tileId,r.footprint,r.tileId),e.hiddenByOverlap))break}++a}r=e(i=r)}}}}_setSources(e){[this._prevRegions,this._activeRegions]=[this._activeRegions,[]],this._sourceIds=[];for(let i=e.length-1;i>=0;i--)this._addSource(e[i]);this._computeReplacement()}},e.dm=class{constructor(e){this._createGrid(e),this._createPoles(e)}destroy(){for(let e of(this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy(),this._poleSegments))e.destroy();for(let e of this._gridSegments)e.withSkirts.destroy(),e.withoutSkirts.destroy()}_fillGridMeshWithLods(e,i){let r=new no,a=new nS,n=[],s=e+1+2,l=i[0]+1,h=i[0]+1+(1+i.length),u=(e,i,r)=>{let a=e===s-1?e-2:0===e?e:e-1;return[a+=24575*!!r,i]};for(let e=0;e<s;++e)r.emplaceBack(...u(e,0,!0));for(let e=0;e<l;++e)for(let i=0;i<s;++i)r.emplaceBack(...u(i,e,0===i||i===s-1));for(let e=0;e<i.length;++e){let a=i[e];for(let e=0;e<s;++e)r.emplaceBack(...u(e,a,!0))}for(let e=0;e<i.length;++e){let l=a.length,u=i[e]+1+2,c=new nS;for(let r=0;r<u-1;r++){let n=r===u-2,l=n?s*(h-i.length+e-r):s;for(let e=0;e<s-1;e++){let i=r*s+e;0===r||n||0===e||e===s-2?(c.emplaceBack(i+1,i,i+l),c.emplaceBack(i+l,i+l+1,i+1)):(a.emplaceBack(i+1,i,i+l),a.emplaceBack(i+l,i+l+1,i+1))}}let d=n0.simpleSegment(0,l,r.length,a.length-l);for(let e=0;e<c.uint16.length;e+=3)a.emplaceBack(c.uint16[e],c.uint16[e+1],c.uint16[e+2]);let p=n0.simpleSegment(0,l,r.length,a.length-l);n.push({withoutSkirts:d,withSkirts:p})}return{vertices:r,indices:a,segments:n}}_createGrid(e){let i=this._fillGridMeshWithLods(64,ow);this._gridSegments=i.segments,this._gridBuffer=e.createVertexBuffer(i.vertices,ss.members),this._gridIndexBuffer=e.createIndexBuffer(i.indices,!0)}_createPoles(e){let i=new nS;for(let e=0;e<=64;e++)i.emplaceBack(0,e+1,e+2);this._poleIndexBuffer=e.createIndexBuffer(i,!0);let r=new nI,a=new nI,n=new nI,s=new nI;this._poleSegments=[];for(let e=0,i=0;e<5;e++){let l=360/(1<<e);r.emplaceBack(0,-ob,0,.5,0),a.emplaceBack(0,-ob,0,.5,1),n.emplaceBack(0,-ob,0,.5,.5),s.emplaceBack(0,-ob,0,.5,.5);for(let e=0;e<=64;e++){let i=e/64,h=0,u=tU(0,l,i),[c,d,p]=oS(sN,sV,u,ob);r.emplaceBack(c,d,p,i,h),a.emplaceBack(c,d,p,i,1-h);let f=u*eC;i=.5+.5*Math.sin(f),h=.5+.5*Math.cos(f),n.emplaceBack(c,d,p,i,h),s.emplaceBack(c,d,p,i,1-h)}this._poleSegments.push(n0.simpleSegment(i,0,66,64)),i+=66}this._poleNorthVertexBuffer=e.createVertexBuffer(r,sn,!1),this._poleSouthVertexBuffer=e.createVertexBuffer(a,sn,!1),this._texturedPoleNorthVertexBuffer=e.createVertexBuffer(n,sn,!1),this._texturedPoleSouthVertexBuffer=e.createVertexBuffer(s,sn,!1)}getGridBuffers(e,i){return[this._gridBuffer,this._gridIndexBuffer,i?this._gridSegments[e].withSkirts:this._gridSegments[e].withoutSkirts]}getPoleBuffers(e,i){return[i?this._texturedPoleNorthVertexBuffer:this._poleNorthVertexBuffer,i?this._texturedPoleSouthVertexBuffer:this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[e]]}},e.dn=lN,e.dp=eR,e.dq=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},e.dr=ez,e.ds=oO,e.dt=oM,e.du=function([e,i,r]){let a=Math.hypot(e,i,r);return new oA(Math.atan2(e,r)*eP,(.5*Math.PI-Math.acos(-i/a))*eP)},e.dv=cp,e.dw=6371008.8,e.dx=function(e){let i=e.navigator?e.navigator.userAgent:null;return!!function(e){if(null==e0){let i=e.navigator?e.navigator.userAgent:null;e0=!!e.safari||!(!i||!(/\b(iPad|iPhone|iPod)\b/.test(i)||i.match("Safari")&&!i.match("Chrome")))}return e0}(e)&&i&&(i.match("Version/15.4")||i.match("Version/15.5")||i.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/))},e.dy=function(e,i){ta=e,tn=i},e.dz=sB,e.e=e6,e.e0=function(e){let i=0;if(0x46546c67!==new Uint32Array(e,0,1)[0]){let r=new Uint32Array(e,0,7),[,,a,n,s,l]=r;i=r.byteLength+n+s+l+s,(a!==e.byteLength||i>=e.byteLength)&&eX("Invalid b3dm header information.")}return pt(e,i)},e.e1=function(e,i){let r=pa(e);for(let e of r){for(let i of e.meshes)(function(e){e.heightmap=new Float32Array(4096),e.heightmap.fill(-1);let i=e.vertexArray.float32,r=e.aabb.min[0]-1,a=e.aabb.min[1]-1,n=64/(e.aabb.max[0]-r+2),s=64/(e.aabb.max[1]-a+2);for(let l=0;l<i.length;l+=3){let h=i[l+2],u=(i[l+0]-r)*n|0,c=(i[l+1]-a)*s|0;h>e.heightmap[64*c+u]&&(e.heightmap[64*c+u]=h)}})(i);e.lights&&(e.lightMeshIndex=e.meshes.length,e.meshes.push(function(e,i){let r={};r.indexArray=new nS,r.indexArray.reserve(4*e.length),r.vertexArray=new nd,r.vertexArray.reserve(10*e.length),r.colorArray=new nc,r.vertexArray.reserve(10*e.length);let a=0;for(let n of e){let e=Math.min(10,Math.max(4,1.3*n.height))*i,s=[-n.normal[1],n.normal[0],0],l=Math.min(.29,.1*n.width/n.depth),h=n.width-2*n.depth*i*(l+.01),u=eS.vec3.scaleAndAdd([],n.pos,s,h/2),c=eS.vec3.scaleAndAdd([],n.pos,s,-h/2),d=[u[0],u[1],u[2]+n.height],p=[c[0],c[
2121],c[2]+n.height],f=eS.vec3.scaleAndAdd([],n.normal,s,l);eS.vec3.scale(f,f,e);let m=eS.vec3.scaleAndAdd([],n.normal,s,-l);eS.vec3.scale(m,m,e),eS.vec3.add(f,u,f),eS.vec3.add(m,c,m),u[2]+=.1,c[2]+=.1,r.vertexArray.emplaceBack(f[0],f[1],f[2]),r.vertexArray.emplaceBack(m[0],m[1],m[2]),r.vertexArray.emplaceBack(u[0],u[1],u[2]),r.vertexArray.emplaceBack(c[0],c[1],c[2]),r.vertexArray.emplaceBack(d[0],d[1],d[2]),r.vertexArray.emplaceBack(p[0],p[1],p[2]),r.vertexArray.emplaceBack(u[0],u[1],u[2]),r.vertexArray.emplaceBack(c[0],c[1],c[2]),r.vertexArray.emplaceBack(f[0],f[1],f[2]),r.vertexArray.emplaceBack(m[0],m[1],m[2]);let _=h/e/2;r.colorArray.emplaceBack(-_-l,-1,_,.8),r.colorArray.emplaceBack(_+l,-1,_,.8),r.colorArray.emplaceBack(-_,0,_,1.3),r.colorArray.emplaceBack(_,0,_,1.3),r.colorArray.emplaceBack(_+l,-.8,_,.7),r.colorArray.emplaceBack(_+l,-.8,_,.7),r.colorArray.emplaceBack(0,0,_,1.3),r.colorArray.emplaceBack(0,0,_,1.3),r.colorArray.emplaceBack(_+l,-1.2,_,.8),r.colorArray.emplaceBack(_+l,-1.2,_,.8),r.indexArray.emplaceBack(6+a,4+a,8+a),r.indexArray.emplaceBack(7+a,9+a,5+a),r.indexArray.emplaceBack(0+a,1+a,2+a),r.indexArray.emplaceBack(1+a,3+a,2+a),a+=10}let n={defined:!0,emissiveFactor:[0,0,0]},s={};return s.baseColorFactor=tN.white,n.pbrMetallicRoughness=s,r.material=n,r.aabb=new sm([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),r}(e.lights,i)))}return r},e.e2=cG,e.e3=cJ,e.e4=aD,e.e5=function(e){tl(),null!=h&&h.then(i=>{i.keys().then(r=>{for(let a=0;a<r.length-e;a++)i.delete(r[a])})})},e.f=function(e){return 0===e.indexOf("mapbox:")},e.g=function(e,i){return tv(eN(e,{method:"GET"}),i)},e.h=e8,e.i=function(e){return e6.API_STYLE_REGEX.test(e)&&!e9(e)},e.j=function(e){return decodeURIComponent(atob(e).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""))},e.k=function(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,i)=>String.fromCharCode(Number("0x"+i))))},e.l=eN,e.m=tu,e.n=function(e,i){return tv(eN(e,{type:"json"}),i)},e.o=tT,e.p=function(e,i){return tv(eN(e,{method:"POST"}),i)},e.q=te,e.r=sJ,e.s=function(e){try{let i=self[e];return i.setItem("_mapbox_test_",1),i.removeItem("_mapbox_test_"),!0}catch(e){return!1}},e.t=tk,e.u=function(){return function e(i){return i?(i^Math.random()*(16>>i/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,e)}()},e.v=function(e){return!!e&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)},e.w=eX,e.x=tL,e.y=2,e.z=ul}),a(["./shared"],function(e){function i(e){let i=e?e.url.toString():void 0;return i?performance.getEntriesByName(i):[]}class r{constructor(e){this.keyCache={},this._layers={},this._layerConfigs={},e&&this.replace(e)}replace(e,i){this._layerConfigs={},this._layers={},this.update(e,[],i)}update(i,r,a){for(let r of(this._options=a,i))this._layerConfigs[r.id]=r,(this._layers[r.id]=e.cq(r,this.scope,null,this._options)).compileFilter(a),this.keyCache[r.id]&&delete this.keyCache[r.id];for(let e of r)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];for(let i of(this.familiesBySource={},function(i,r){let a={};for(let n=0;n<i.length;n++){let s=r&&r[i[n].id]||function(i){let r="";for(let a of e.bh)r+=`/${function e(i){if("number"==typeof i||"boolean"==typeof i||"string"==typeof i||null==i)return JSON.stringify(i);if(Array.isArray(i)){let r="[";for(let a of i)r+=`${e(a)},`;return`${r}]`}let r="{";for(let a of Object.keys(i).sort())r+=`${a}:${e(i[a])},`;return`${r}}`}(i[a])}`;return r}(i[n]);r&&(r[i[n].id]=s);let l=a[s];l||(l=a[s]=[]),l.push(i[n])}let n=[];for(let e in a)n.push(a[e]);return n}(e.be(this._layerConfigs),this.keyCache))){let e=i.map(e=>this._layers[e.id]),r=e[0];if("none"===r.visibility)continue;let a=r.source||"",n=this.familiesBySource[a];n||(n=this.familiesBySource[a]={});let s=r.sourceLayer||"_geojsonTileLayer",l=n[s];l||(l=n[s]=[]),l.push(e)}}}let a=+e.dP;class n{constructor(i){let r={},n=[];for(let e in i){let s=i[e],l=r[e]={};for(let e in s.glyphs){let i=s.glyphs[+e];if(!i||0===i.bitmap.width||0===i.bitmap.height)continue;let r=i.metrics.localGlyph?a:1,h={x:0,y:0,w:i.bitmap.width+2*r,h:i.bitmap.height+2*r};n.push(h),l[e]=h}}let{w:s,h:l}
212=e.z(n),h=new e.dO({width:s||1,height:l||1});for(let n in i){let s=i[n];for(let i in s.glyphs){let l=s.glyphs[+i];if(!l||0===l.bitmap.width||0===l.bitmap.height)continue;let u=r[n][i],c=l.metrics.localGlyph?a:1;e.dO.copy(l.bitmap,h,{x:0,y:0},{x:u.x+c,y:u.y+c},l.bitmap)}}this.image=h,this.positions=r}}e.dN(n,"GlyphAtlas");class s{constructor(i){this.tileID=new e.aA(i.tileID.overscaledZ,i.tileID.wrap,i.tileID.canonical.z,i.tileID.canonical.x,i.tileID.canonical.y),this.tileZoom=i.tileZoom,this.uid=i.uid,this.zoom=i.zoom,this.lut=i.lut,this.canonical=i.tileID.canonical,this.pixelRatio=i.pixelRatio,this.tileSize=i.tileSize,this.source=i.source,this.scope=i.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=i.showCollisionBoxes,this.collectResourceTiming=!!i.request&&i.request.collectResourceTiming,this.promoteId=i.promoteId,this.isSymbolTile=i.isSymbolTile,this.tileTransform=e.aL(i.tileID.canonical,i.projection),this.projection=i.projection,this.worldview=i.worldview,this.localizableLayerIds=i.localizableLayerIds,this.brightness=i.brightness,this.extraShadowCaster=!!i.extraShadowCaster,this.tessellationStep=i.tessellationStep,this.scaleFactor=i.scaleFactor}parse(i,r,a,s,h){let u,c,d,p;this.status="parsing",this.data=i,this.collisionBoxArray=new e.aR;let f=new e.dQ(Object.keys(i.layers).sort()),m=new e.dR(this.tileID,this.promoteId);m.bucketLayerIDs=[];let _={},g=new e.dS(256,256),y={featureIndex:m,iconDependencies:{},patternDependencies:{},glyphDependencies:{},lineAtlas:g,availableImages:a,brightness:this.brightness},x=r.familiesBySource[this.source];for(let r in x){let n=i.layers[r];if(!n)continue;let s=!1,h=!1,u=!1;for(let e of x[r])"symbol"===e[0].type?s=!0:h=!0,e[0].is3D()&&"model"!==e[0].type&&(u=!0);if(this.extraShadowCaster&&!u||!0===this.isSymbolTile&&!s||!1===this.isSymbolTile&&!h)continue;1===n.version&&e.w(`Vector tile source "${this.source}" layer "${r}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let c=f.encode(r),d=[];for(let e=0,i=0;e<n.length;e++){let a=n.feature(e),s=m.getId(a,r);if(this.localizableLayerIds&&this.localizableLayerIds.has(r)){let e=a.properties?a.properties.worldview:null;if(this.worldview&&"string"==typeof e){if("all"===e)a.properties.$localized=!0;else{if(!e.split(",").includes(this.worldview))continue;a.properties.$localized=!0,a.properties.worldview=this.worldview}}}d.push({feature:a,id:s,index:i,sourceLayerIndex:c}),i++}for(let i of x[r]){let r=i[0];(!this.extraShadowCaster||r.is3D()&&"model"!==r.type)&&(void 0!==this.isSymbolTile&&"symbol"===r.type!==this.isSymbolTile||r.minzoom&&this.zoom<Math.floor(r.minzoom)||r.maxzoom&&this.zoom>=r.maxzoom||"none"!==r.visibility&&(l(i,this.zoom,y.brightness,a),(_[r.id]=r.createBucket({index:m.bucketLayerIDs.length,layers:i,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:c,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep})).populate(d,y,this.tileID.canonical,this.tileTransform),m.bucketLayerIDs.push(i.map(i=>e.av(i.id,i.scope)))))}}g.trim();let v={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},b=()=>{if(u)return this.status="done",h(u);if(this.extraShadowCaster)this.status="done",h(null,{buckets:e.be(_).filter(e=>!e.isEmpty()),featureIndex:m,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:y.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(c&&d&&p){let i=new n(c),r=new e.dU(d,p,this.lut);for(let n in _){let s=_[n];s instanceof e.aS?(l(s.layers,this.zoom,y.brightness,a),e.dV(s,c,i.positions,d,r.iconPositions,this.showCollisionBoxes,a,this.tileID.canonical,this.tileZoom,this.projection,this.scaleFactor,this.brightness)):s.hasPattern&&(s instanceof e.aY||s instanceof e.aZ||s instanceof e.d0)&&(l(s.layers,this.zoom,y.brightness,a),s.addFeatures(y,this.tileID.canonical,r.patternPositions,a,this.tileTransform,this.brightness))}this.status="done",h(null,{buckets:e.be(_).filter(e=>!e.isEmpty()),featureIndex:m,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:i.image,lineAtlas:g,imageAtlas:r,brightness:y.brightness})}};if(!this.extraShadowCaster){let i=e.dT(y.glyphDependencies,e=>Object.keys(e).map(Number));Object.keys(i).length?s.send("getGlyphs",{uid:this.uid,stacks:i,scope:this.scope},(e,i)=>{u||(u=e,c=i,b())},void 0,!1,v):c={};let r=Object.keys(y.iconDependencies);r.length?s.send("getImages",{icons:r,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(e,i)=>{u||(u=e,d=i,b())},void 0,!1,v):d={};let a=Object.keys(y.patternDependencies);a.length?s.send("getImages",{icons:a,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(e,i)=>{u||(u=e,p=i,b())},void 0,!1,v):p={}}b()}}function l(i,r,a,n){let s=new e.a3(r,{brightness:a});for(let e of i)e.recalculate(s,n)}class h extends e.E{constructor(i,r,a,n,s,l){super(),this.actor=i,this.layerIndex=r,this.availableImages=a,this.loadVectorData=s||e.aw,this.loading={},this.loaded={},this.deduped=new e.au(i.scheduler),this.isSpriteLoaded=n,this.scheduler
212=i.scheduler,this.brightness=l}loadTile(r,a){let n=r.uid,l=r&&r.request,h=l&&l.collectResourceTiming,u=this.loading[n]=new s(r);u.abort=this.loadVectorData(r,(s,c)=>{let d=!this.loading[n];if(delete this.loading[n],d||s||!c)return u.status="done",d||(this.loaded[n]=u),a(s);let p=c.rawData,f={};c.expires&&(f.expires=c.expires),c.cacheControl&&(f.cacheControl=c.cacheControl),u.vectorTile=c.vectorTile||new e.dW.VectorTile(new e.bc(p));let m=()=>{u.parse(u.vectorTile,this.layerIndex,this.availableImages,this.actor,(r,n)=>{if(r||!n)return a(r);let s={};if(h){let e=i(l);e.length>0&&(s.resourceTiming=JSON.parse(JSON.stringify(e)))}a(null,e.l({rawTileData:p.slice(0)},n,f,s))})};this.isSpriteLoaded?m():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(m,{type:"parseTile",isSymbolTile:r.isSymbolTile,zoom:r.tileZoom}):m()}),this.loaded=this.loaded||{},this.loaded[n]=u})}reloadTile(i,r){let a=this.loaded,n=i.uid;if(a&&a[n]){let s=a[n];s.scaleFactor=i.scaleFactor,s.showCollisionBoxes=i.showCollisionBoxes,s.projection=i.projection,s.brightness=i.brightness,s.tileTransform=e.aL(i.tileID.canonical,i.projection),s.extraShadowCaster=i.extraShadowCaster,s.lut=i.lut;let l=(e,i)=>{let a=s.reloadCallback;a&&(delete s.reloadCallback,s.parse(s.vectorTile,this.layerIndex,this.availableImages,this.actor,a)),r(e,i)};"parsing"===s.status?s.reloadCallback=l:"done"===s.status&&(s.vectorTile?s.parse(s.vectorTile,this.layerIndex,this.availableImages,this.actor,l):l())}else r(null,void 0)}abortTile(e,i){let r=e.uid,a=this.loading[r];a&&(a.abort&&a.abort(),delete this.loading[r]),i()}removeTile(e,i){let r=this.loaded,a=e.uid;r&&r[a]&&delete r[a],i()}}class u{loadTile(i,r){let{uid:a,encoding:n,rawImageData:s,padding:l}=i,h=ImageBitmap&&s instanceof ImageBitmap?this.getImageData(s,l):s;r(null,new e.dX(a,h,n,l<1))}getImageData(e,i){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(e.width,e.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=e.width,this.offscreenCanvas.height=e.height,this.offscreenCanvasContext.drawImage(e,0,0,e.width,e.height);let r=this.offscreenCanvasContext.getImageData(-i,-i,e.width+2*i,e.height+2*i);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),r}}e.bb.setPbf(e.bc);class c{decodeRasterArray({task:i,buffer:r},a){e.bb.performDecoding(r,i).then(e=>{a(null,e)},e=>{a(e)})}}let d=e.dW.VectorTileFeature.prototype.toGeoJSON;class p{constructor(i){this._feature=i,this.extent=e.ab,this.type=i.type,this.properties=i.tags,"id"in i&&!isNaN(i.id)&&(this.id=parseInt(i.id,10))}loadGeometry(){if(1===this._feature.type){let i=[];for(let r of this._feature.geometry)i.push([new e.P(r[0],r[1])]);return i}{let i=[];for(let r of this._feature.geometry){let a=[];for(let i of r)a.push(new e.P(i[0],i[1]));i.push(a)}return i}}toGeoJSON(e,i,r){return d.call(this,e,i,r)}}class f{constructor(i){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=e.ab,this.length=i.length,this._features=i}feature(e){return new p(this._features[e])}}let m=64/4096;class _{constructor(){this.features=new Map}clear(){this.features.clear()}load(e=[],i){for(let r of e){let e=r.id;if(null==e)continue;let a=this.features.get(e);a&&this.updateCache(a,i),r.geometry?(a=function(e){let{id:i,geometry:r,properties:a}=e;if(!r)return;if("GeometryCollection"===r.type)throw Error("GeometryCollection not supported in dynamic mode.");let{type:n,coordinates:s}=r,l={id:i,type:1,geometry:[],tags:a,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},h=l.geometry;if("Point"===n)y(s,h,l);else if("MultiPoint"===n)for(let e of s)y(e,h,l);else if("LineString"===n)l.type=2,x(s,h,l);else if("MultiLineString"===n)l.type=2,v(s,h,l);else if("Polygon"===n)l.type=3,v(s,h,l,!0);else{if("MultiPolygon"!==n)throw Error("Input data is not a valid GeoJSON object.");for(let e of(l.type=3,s))v(e,h,l,!0)}return l}(r),this.updateCache(a,i),this.features.set(e,a)):this.features.delete(e),this.updateCache(a,i)}}updateCache(e,i){for(let{canonical:r,uid:a}of Object.values(i)){let{z:n,x:s,y:l}=r;g(e,Math.pow(2,n),s,l)&&delete i[a]}}getTile(i,r,a){let n=Math.pow(2,i),s=[];for(let i of this.features.values())g(i,n,r,a)&&s.push(function(i,r,a,n){let{id:s,type:l,geometry:h,tags:u}=i,c=[];if(1===l)!function(i,r,a,n,s){for(let l=0;l<i.length;l+=2){let h=Math.round(e.ab*(i[l+0]*r-a)),u=Math.round(e.ab*(i[l+1]*r-n));s.push([h,u])}}(h,r,a,n,c);else for(let i of h)(function(i,r,a,n,s){let l;let h=e.ab+128;for(let u=0;u<i.length-2;u+=2){let c=Math.round(e.ab*(i[u+0]*r-a)),d=Math.round(e.ab*(i[u+1]*r-n)),p=Math.round(e.ab*(i[u+2]*r-a)),f=Math.round(e.ab*(i[u+3]*r-n)),m=p-c,_=f-d;c<-128&&p<-128||(c<-128?(d+=Math.round((-128-c)/m*_),c=-128):p<-128&&(f=d+Math.round((-128-c)/m*_),p=-128),d<-128&&f<-128||(d<-128?(c+=Math.round((-128-d)/_*m),d=-128):f<-128&&(p=c+Math.round((-128-d)/_*m),f=-128),
212c>=h&&p>=h||(c>=h?(d+=Math.round((h-c)/m*_),c=h):p>=h&&(f=d+Math.round((h-c)/m*_),p=h),d>=h&&f>=h||(d>=h?(c+=Math.round((h-d)/_*m),d=h):f>=h&&(p=c+Math.round((h-d)/_*m),f=h),l&&c===l[l.length-1][0]&&d===l[l.length-1][1]||(l=[[c,d]],s.push(l)),l.push([p,f])))))}})(i,r,a,n,c);return{id:s,type:l,geometry:c,tags:u}}(i,n,r,a));return{features:s}}getFeatures(){return[...this.features.values()]}}function g({minX:e,minY:i,maxX:r,maxY:a},n,s,l){return e<(s+1+m)/n&&i<(l+1+m)/n&&r>(s-m)/n&&a>(l-m)/n}function y([i,r],a,n){let s=e.am(i),l=e.at(r);l=l<0?0:l>1?1:l,a.push(s,l),n.minX=Math.min(n.minX,s),n.minY=Math.min(n.minY,l),n.maxX=Math.max(n.maxX,s),n.maxY=Math.max(n.maxY,l)}function x(e,i,r,a=!1,n=!1){let s=[];for(let i of e)y(i,s,r);i.push(s),a&&function(e,i){let r=0;for(let i=0,a=e.length,n=a-2;i<a;n=i,i+=2)r+=(e[i]-e[n])*(e[i+1]+e[n+1]);if(r>0===i)for(let i=0,r=e.length;i<r/2;i+=2){let a=e[i],n=e[i+1];e[i]=e[r-2-i],e[i+1]=e[r-1-i],e[r-2-i]=a,e[r-1-i]=n}}(s,n)}function v(e,i,r,a=!1){for(let n=0;n<e.length;n++)x(e[n],i,r,a,0===n)}var b,w,T,S,M={exports:{}},E=function(){if(S)return M.exports;S=1;var i=e.d_(),r=function(){if(T)return w;T=1;var i=e.dY(),r=e.dZ().VectorTileFeature;function a(e,i){this.options=i||{},this.features=e,this.length=e.length}function n(e,i){this.id="number"==typeof e.id?e.id:void 0,this.type=e.type,this.rawGeometry=1===e.type?[e.geometry]:e.geometry,this.properties=e.tags,this.extent=i||4096}return w=a,a.prototype.feature=function(e){return new n(this.features[e],this.options.extent)},n.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var r=0;r<e.length;r++){for(var a=e[r],n=[],s=0;s<a.length;s++)n.push(new i(a[s][0],a[s][1]));this.geometry.push(n)}return this.geometry},n.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var e=this.geometry,i=1/0,r=-1/0,a=1/0,n=-1/0,s=0;s<e.length;s++)for(var l=e[s],h=0;h<l.length;h++){var u=l[h];i=Math.min(i,u.x),r=Math.max(r,u.x),a=Math.min(a,u.y),n=Math.max(n,u.y)}return[i,a,r,n]},n.prototype.toGeoJSON=r.prototype.toGeoJSON,w}();function a(e){var r=new i;return function(e,i){for(var r in e.layers)i.writeMessage(3,n,e.layers[r])}(e,r),r.finish()}function n(e,i){i.writeVarintField(15,e.version||1),i.writeStringField(1,e.name||""),i.writeVarintField(5,e.extent||4096);var r,a={keys:[],values:[],keycache:{},valuecache:{}};for(r=0;r<e.length;r++)a.feature=e.feature(r),i.writeMessage(2,s,a);var n=a.keys;for(r=0;r<n.length;r++)i.writeStringField(3,n[r]);var l=a.values;for(r=0;r<l.length;r++)i.writeMessage(4,u,l[r])}function s(e,i){var r=e.feature;void 0!==r.id&&i.writeVarintField(1,r.id),i.writeMessage(2,l,e),i.writeVarintField(3,r.type),i.writeMessage(4,h,r)}function l(e,i){var r=e.feature,a=e.keys,n=e.values,s=e.keycache,l=e.valuecache;for(var h in r.properties){var u=r.properties[h],c=s[h];if(null!==u){void 0===c&&(a.push(h),s[h]=c=a.length-1),i.writeVarint(c);var d=typeof u;"string"!==d&&"boolean"!==d&&"number"!==d&&(u=JSON.stringify(u));var p=d+":"+u,f=l[p];void 0===f&&(n.push(u),l[p]=f=n.length-1),i.writeVarint(f)}}}function h(e,i){for(var r=e.loadGeometry(),a=e.type,n=0,s=0,l=r.length,h=0;h<l;h++){var u=r[h],c=1;1===a&&(c=u.length),i.writeVarint((c<<3)+1);for(var d=3===a?u.length-1:u.length,p=0;p<d;p++){1===p&&1!==a&&i.writeVarint((d-1<<3)+2);var f=u[p].x-n,m=u[p].y-s;i.writeVarint(f<<1^f>>31),i.writeVarint(m<<1^m>>31),n+=f,s+=m}3===a&&i.writeVarint(15)}}function u(e,i){var r=typeof e;"string"===r?i.writeStringField(1,e):"boolean"===r?i.writeBooleanField(7,e):"number"===r&&(e%1!=0?i.writeDoubleField(3,e):e<0?i.writeSVarintField(6,e):i.writeVarintField(5,e))}return M.exports=a,M.exports.fromVectorTileJs=a,M.exports.fromGeojsonVt=function(e,i){i=i||{};var n={};for(var s in e)n[s]=new r(e[s].features,i),n[s].name=s,n[s].version=i.version,n[s].extent=i.extent;return a({layers:n})},M.exports.GeoJSONWrapper=r,M.exports}(),A=e.d$(E);let I={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},C=Math.fround||(b=new Float32Array(1),e=>(b[0]=+e,b[0]));class P{constructor(e){this.options=Object.assign(Object.create(I),e),this.trees=Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){let{log:i,minZoom:r,maxZoom:a}=this.options;i&&console.time("total time");let n=`prepare ${e.length} points`;i&&console.time(n),this.points=e;let s=[];for(let i=0;i<e.length;i++){let r=e[i];if(!r.geometry)continue;let[a,n]=r.geometry.coordinates,l=C(R(a)),h=C(z(n));s.push(l,h,1/0,i,-1,1),this.options.reduce&&s.push(0)}let l=this.trees[a+1]=this._createTree(s);i&&console.timeEnd(n);for(let e=a;e>=r;e--){let r=+Date.now();l=this.trees[e]=this._createTree(this._cluster(l,e)),i&&console.log("z%d: %d clusters in %dms",e,l.numItems,+Date.now()-r)}
212return i&&console.timeEnd("total time"),this}getClusters(e,i){let r=((e[0]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,e[1])),n=180===e[2]?180:((e[2]+180)%360+360)%360-180,s=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)r=-180,n=180;else if(r>n){let e=this.getClusters([r,a,180,s],i),l=this.getClusters([-180,a,n,s],i);return e.concat(l)}let l=this.trees[this._limitZoom(i)],h=l.range(R(r),z(s),R(n),z(a)),u=l.data,c=[];for(let e of h){let i=this.stride*e;c.push(u[i+5]>1?L(u,i,this.clusterProps):this.points[u[i+3]])}return c}getChildren(e){let i=this._getOriginId(e),r=this._getOriginZoom(e),a="No cluster with the specified id.",n=this.trees[r];if(!n)throw Error(a);let s=n.data;if(i*this.stride>=s.length)throw Error(a);let l=this.options.radius/(this.options.extent*Math.pow(2,r-1)),h=n.within(s[i*this.stride],s[i*this.stride+1],l),u=[];for(let i of h){let r=i*this.stride;s[r+4]===e&&u.push(s[r+5]>1?L(s,r,this.clusterProps):this.points[s[r+3]])}if(0===u.length)throw Error(a);return u}getLeaves(e,i,r){let a=[];return this._appendLeaves(a,e,i=i||10,r=r||0,0),a}getTile(e,i,r){let a=this.trees[this._limitZoom(e)],n=Math.pow(2,e),{extent:s,radius:l}
212=this.options,h=l/s,u=(r-h)/n,c=(r+1+h)/n,d={features:[]};return this._addTileFeatures(a.range((i-h)/n,u,(i+1+h)/n,c),a.data,i,r,n,d),0===i&&this._addTileFeatures(a.range(1-h/n,u,1,c),a.data,n,r,n,d),i===n-1&&this._addTileFeatures(a.range(0,u,h/n,c),a.data,-1,r,n,d),d.features.length?d:null}getClusterExpansionZoom(e){let i=this._getOriginZoom(e)-1;for(;i<=this.options.maxZoom;){let r=this.getChildren(e);if(i++,1!==r.length)break;e=r[0].properties.cluster_id}return i}_appendLeaves(e,i,r,a,n){for(let s of this.getChildren(i)){let i=s.properties;if(i&&i.cluster?n+i.point_count<=a?n+=i.point_count:n=this._appendLeaves(e,i.cluster_id,r,a,n):n<a?n++:e.push(s),e.length===r)break}return n}_createTree(i){let r=new e.bz(i.length/this.stride|0,this.options.nodeSize,Float32Array);for(let e=0;e<i.length;e+=this.stride)r.add(i[e],i[e+1]);return r.finish(),r.data=i,r}_addTileFeatures(e,i,r,a,n,s){for(let l of e){let e,h,u,c;let d=l*this.stride,p=i[d+5]>1;if(p)e=k(i,d,this.clusterProps),h=i[d],u=i[d+1];else{let r=this.points[i[d+3]];e=r.properties;let[a,n]=r.geometry.coordinates;h=R(a),u=z(n)}let f={type:1,geometry:[[Math.round(this.options.extent*(h*n-r)),Math.round(this.options.extent*(u*n-a))]],tags:e};void 0!==(c=p||this.options.generateId?i[d+3]:this.points[i[d+3]].id)&&(f.id=c),s.features.push(f)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,i){let{radius:r,extent:a,reduce:n,minPoints:s}=this.options,l=r/(a*Math.pow(2,i)),h=e.data,u=[],c=this.stride;for(let r=0;r<h.length;r+=c){if(h[r+2]<=i)continue;h[r+2]=i;let a=h[r],d=h[r+1],p=e.within(h[r],h[r+1],l),f=h[r+5],m=f;for(let e of p){let r=e*c;h[r+2]>i&&(m+=h[r+5])}if(m>f&&m>=s){let e,s=a*f,l=d*f,_=-1,g=(r/c<<5)+(i+1)+this.points.length;for(let a of p){let u=a*c;if(h[u+2]<=i)continue;h[u+2]=i;let d=h[u+5];s+=h[u]*d,l+=h[u+1]*d,h[u+4]=g,n&&(e||(e=this._map(h,r,!0),_=this.clusterProps.length,this.clusterProps.push(e)),n(e,this._map(h,u)))}h[r+4]=g,u.push(s/m,l/m,1/0,g,-1,m),n&&u.push(_)}else{for(let e=0;e<c;e++)u.push(h[r+e]);if(m>1)for(let e of p){let r=e*c;if(!(h[r+2]<=i)){h[r+2]=i;for(let e=0;e<c;e++)u.push(h[r+e])}}}}return u}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,i,r){if(e[i+5]>1){let a=this.clusterProps[e[i+6]];return r?Object.assign({},a):a}let a=this.points[e[i+3]].properties,n=this.options.map(a);return r&&n===a?Object.assign({},n):n}}function L(e,i,r){return{type:"Feature",id:e[i+3],properties:k(e,i,r),geometry:{type:"Point",coordinates:[360*(e[i]-.5),360*Math.atan(Math.exp((180-360*e[i+1])*Math.PI/180))/Math.PI-90]}}}function k(e,i,r){let a=e[i+5],n=a>=1e4?`${Math.round(a/1e3)}k`:a>=1e3?Math.round(a/100)/10+"k":a,s=e[i+6];return Object.assign(-1===s?{}:Object.assign({},r[s]),{cluster:!0,cluster_id:e[i+3],point_count:a,point_count_abbreviated:n})}function R(e){return e/360+.5}function z(e){let i=Math.sin(e*Math.PI/180),r=.5-.25*Math.log((1+i)/(1-i))/Math.PI;return r<0?0:r>1?1:r}function D(e,i,r,a){let n={id:e??null,type:i,geometry:r,tags:a,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if("Point"===i||"MultiPoint"===i||"LineString"===i)O(n,r);else if("Polygon"===i)O(n,r[0]);else if("MultiLineString"===i)for(let e of r)O(n,e);else if("MultiPolygon"===i)for(let e of r)O(n,e[0]);return n}function O(e,i){for(let r=0;r<i.length;r+=3)e.minX=Math.min(e.minX,i[r]),e.minY=Math.min(e.minY,i[r+1]),e.maxX=Math.max(e.maxX,i[r]),e.maxY=Math.max(e.maxY,i[r+1])}function B(e,i,r,a){if(!i.geometry)return;let n=i.geometry.coordinates;if(n&&0===n.length)return;let s=i.geometry.type,l=Math.pow(r.tolerance/((1<<r.maxZoom)*r.extent),2),h=[],u=i.id;if(r.promoteId?u=i.properties[r.promoteId]:r.generateId&&(u=a||0),"Point"===s)F(n,h);else if("MultiPoint"===s)for(let e of n)F(e,h);else if("LineString"===s)N(n,h,l,!1);else if("MultiLineString"===s){if(r.lineMetrics){for(let r of n)N(r,h=[],l,!1),e.push(D(u,"LineString",h,i.properties));return}V(n,h,l,!1)}else if("Polygon"===s)V(n,h,l,!0);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(let n of i.geometry.geometries)B(e,{id:u,geometry:n,properties:i.properties},r,a);return}throw Error("Input data is not a valid GeoJSON object.")}for(let e of n){let i=[];V(e,i,l,!0),h.push(i)}}
212e.push(D(u,s,h,i.properties))}function F(e,i){i.push(e[0]/360+.5,U(e[1]),0)}function N(e,i,r,a){let n,s,l=0;for(let r=0;r<e.length;r++){let h=e[r][0]/360+.5,u=U(e[r][1]);i.push(h,u,0),r>0&&(l+=a?(n*u-h*s)/2:Math.sqrt(Math.pow(h-n,2)+Math.pow(u-s,2))),n=h,s=u}let h=i.length-3;i[2]=1,function e(i,r,a,n){let s=n,l=r+(a-r>>1),h,u=a-r,c=i[r],d=i[r+1],p=i[a],f=i[a+1];for(let e=r+3;e<a;e+=3){let r=function(e,i,r,a,n,s){let l=n-r,h=s-a;if(0!==l||0!==h){let u=((e-r)*l+(i-a)*h)/(l*l+h*h);u>1?(r=n,a=s):u>0&&(r+=l*u,a+=h*u)}return(l=e-r)*l+(h=i-a)*h}(i[e],i[e+1],c,d,p,f);if(r>s)h=e,s=r;else if(r===s){let i=Math.abs(e-l);i<u&&(h=e,u=i)}}s>n&&(h-r>3&&e(i,r,h,n),i[h+2]=s,a-h>3&&e(i,h,a,n))}(i,0,h,r),i[h+2]=1,i.size=Math.abs(l),i.start=0,i.end=i.size}function V(e,i,r,a){for(let n=0;n<e.length;n++){let s=[];N(e[n],s,r,a),i.push(s)}}function U(e){let i=Math.sin(e*Math.PI/180),r=.5-.25*Math.log((1+i)/(1-i))/Math.PI;return r<0?0:r>1?1:r}function j(e,i,r,a,n,s,l,h){if(a/=i,s>=(r/=i)&&l<a)return e;if(l<r||s>=a)return null;let u=[];for(let i of e){let e=i.geometry,s=i.type,l=0===n?i.minX:i.minY,c=0===n?i.maxX:i.maxY;if(l>=r&&c<a){u.push(i);continue}if(c<r||l>=a)continue;let d=[];if("Point"===s||"MultiPoint"===s)(function(e,i,r,a,n){for(let s=0;s<e.length;s+=3){let l=e[s+n];l>=r&&l<=a&&$(i,e[s],e[s+1],e[s+2])}})(e,d,r,a,n);else if("LineString"===s)G(e,d,r,a,n,!1,h.lineMetrics);else if("MultiLineString"===s)W(e,d,r,a,n,!1);else if("Polygon"===s)W(e,d,r,a,n,!0);else if("MultiPolygon"===s)for(let i of e){let e=[];W(i,e,r,a,n,!0),e.length&&d.push(e)}if(d.length){if(h.lineMetrics&&"LineString"===s){for(let e of d)u.push(D(i.id,s,e,i.tags));continue}"LineString"!==s&&"MultiLineString"!==s||(1===d.length?(s="LineString",d=d[0]):s="MultiLineString"),"Point"!==s&&"MultiPoint"!==s||(s=3===d.length?"Point":"MultiPoint"),u.push(D(i.id,s,d,i.tags))}}return u.length?u:null}function G(e,i,r,a,n,s,l){let h=q(e),u=0===n?H:Z,c,d,p=e.start;for(let f=0;f<e.length-3;f+=3){let m=e[f],_=e[f+1],g=e[f+2],y=e[f+3],x=e[f+4],v=0===n?m:_,b=0===n?y:x,w=!1;l&&(c=Math.sqrt(Math.pow(m-y,2)+Math.pow(_-x,2))),v<r?b>r&&(d=u(h,m,_,y,x,r),l&&(h.start=p+c*d)):v>a?b<a&&(d=u(h,m,_,y,x,a),l&&(h.start=p+c*d)):$(h,m,_,g),b<r&&v>=r&&(d=u(h,m,_,y,x,r),w=!0),b>a&&v<=a&&(d=u(h,m,_,y,x,a),w=!0),!s&&w&&(l&&(h.end=p+c*d),i.push(h),h=q(e)),l&&(p+=c)}let f=e.length-3,m=e[f],_=e[f+1],g=0===n?m:_;g>=r&&g<=a&&$(h,m,_,e[f+2]),f=h.length-3,s&&f>=3&&(h[f]!==h[0]||h[f+1]!==h[1])&&$(h,h[0],h[1],h[2]),h.length&&i.push(h)}function q(e){let i=[];return i.size=e.size,i.start=e.start,i.end=e.end,i}function W(e,i,r,a,n,s){for(let l of e)G(l,i,r,a,n,s,!1)}function $(e,i,r,a){e.push(i,r,a)}function H(e,i,r,a,n,s){let l=(s-i)/(a-i);return $(e,s,r+(n-r)*l,1),l}function Z(e,i,r,a,n,s){let l=(s-r)/(n-r);return $(e,i+(a-i)*l,s,1),l}function X(e,i){let r=[];for(let a=0;a<e.length;a++){let n;let s=e[a],l=s.type;if("Point"===l||"MultiPoint"===l||"LineString"===l)n=Y(s.geometry,i);else if("MultiLineString"===l||"Polygon"===l)for(let e of(n=[],s.geometry))n.push(Y(e,i));else if("MultiPolygon"===l)for(let e of(n=[],s.geometry)){let r=[];for(let a of e)r.push(Y(a,i));n.push(r)}r.push(D(s.id,l,n,s.tags))}return r}function Y(e,i){let r=[];r.size=e.size,void 0!==e.start&&(r.start=e.start,r.end=e.end);for(let a=0;a<e.length;a+=3)r.push(e[a]+i,e[a+1],e[a+2]);return r}function J(e,i){if(e.transformed)return e;let r=1<<e.z,a=e.x,n=e.y;for(let s of e.features){let e=s.geometry,l=s.type;if(s.geometry=[],1===l)for(let l=0;l<e.length;l+=2)s.geometry.push(K(e[l],e[l+1],i,r,a,n));else for(let l=0;l<e.length;l++){let h=[];for(let s=0;s<e[l].length;s+=2)h.push(K(e[l][s],e[l][s+1],i,r,a,n));s.geometry.push(h)}}return e.transformed=!0,e}function K(e,i,r,a,n,s){return[Math.round(r*(e*a-n)),Math.round(r*(i*a-s))]}function Q(e,i,r,a,n,s){let l=a*a;if(a>0&&i.size<(n?l:a))return void(r.numPoints+=i.length/3);let h=[];for(let e=0;e<i.length;e+=3)(0===a||i[e+2]>l)&&(r.numSimplified++,h.push(i[e],i[e+1])),r.numPoints++;n&&function(e,i){let r=0;for(let i=0,a=e.length,n=a-2;i<a;n=i,i+=2)r+=(e[i]-e[n])*(e[i+1]+e[n+1]);if(r>0===i)for(let i=0,r=e.length;i<r/2;i+=2){let a=e[i],n=e[i+1];e[i]=e[r-2-i],e[i+1]=e[r-1-i],e[r-2-i]=a,e[r-1-i]=n}}(h,s),e.push(h)}let ee={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class et{constructor(e,i){let r=(i=this.options=function(e,i){for(let r in i)e[r]=i[r];return e}(Object.create(ee),i)).debug;if(r&&console.time("preprocess data"),i.maxZoom<0||i.maxZoom>24)throw Error("maxZoom should be in the 0-24 range");if(i.promoteId&&i.generateId)throw Error("promoteId and generateId cannot be used together.");let a=function(e,i){let r=[];if("FeatureCollection"===e.type)for(let a=0;a<e.features.length;a++)B(r,e.features[a],i,a);else B(r,"Feature"===e.type?e:{geometry:e},i);return r}(e,i);this.tiles={},this.tileCoords=[],r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",i.indexMaxZoom,i.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(a=function(e,i){let r=i.buffer/i.extent,a=e,n=j(e,1,-1-r,r,0,-1,2,i
212),s=j(e,1,1-r,2+r,0,-1,2,i);return(n||s)&&(a=j(e,1,-r,1+r,0,-1,2,i)||[],n&&(a=X(n,1).concat(a)),s&&(a=a.concat(X(s,-1)))),a}(a,i)).length&&this.splitTile(a,0,0,0),r&&(a.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,i,r,a,n,s,l){let h=[e,i,r,a],u=this.options,c=u.debug;for(;h.length;){a=h.pop(),r=h.pop(),i=h.pop(),e=h.pop();let d=1<<i,p=ei(i,r,a),f=this.tiles[p];if(!f&&(c>1&&console.time("creation"),f=this.tiles[p]=function(e,i,r,a,n){let s=i===n.maxZoom?0:n.tolerance/((1<<i)*n.extent),l={features:[],numPoints:0,numSimplified:0,numFeatures:e.length,source:null,x:r,y:a,z:i,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(let i of e)(function(e,i,r,a){let n=i.geometry,s=i.type,l=[];if(e.minX=Math.min(e.minX,i.minX),e.minY=Math.min(e.minY,i.minY),e.maxX=Math.max(e.maxX,i.maxX),e.maxY=Math.max(e.maxY,i.maxY),"Point"===s||"MultiPoint"===s)for(let i=0;i<n.length;i+=3)l.push(n[i],n[i+1]),e.numPoints++,e.numSimplified++;else if("LineString"===s)Q(l,n,e,r,!1,!1);else if("MultiLineString"===s||"Polygon"===s)for(let i=0;i<n.length;i++)Q(l,n[i],e,r,"Polygon"===s,0===i);else if("MultiPolygon"===s)for(let i=0;i<n.length;i++){let a=n[i];for(let i=0;i<a.length;i++)Q(l,a[i],e,r,!0,0===i)}if(l.length){let r=i.tags||null;if("LineString"===s&&a.lineMetrics){for(let e in r={},i.tags)r[e]=i.tags[e];r.mapbox_clip_start=n.start/n.size,r.mapbox_clip_end=n.end/n.size}let h={geometry:l,type:"Polygon"===s||"MultiPolygon"===s?3:"LineString"===s||"MultiLineString"===s?2:1,tags:r};null!==i.id&&(h.id=i.id),e.features.push(h)}})(l,i,s,n);return l}(e,i,r,a,u),this.tileCoords.push({z:i,x:r,y:a}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",i,r,a,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));let e=`z${i}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}if(f.source=e,null==n){if(i===u.indexMaxZoom||f.numPoints<=u.indexMaxPoints)continue}else{if(i===u.maxZoom||i===n)continue;if(null!=n){let e=n-i;if(r!==s>>e||a!==l>>e)continue}}if(f.source=null,0===e.length)continue;c>1&&console.time("clipping");let m=.5*u.buffer/u.extent,_=.5-m,g=.5+m,y=1+m,x=null,v=null,b=null,w=null,T=j(e,d,r-m,r+g,0,f.minX,f.maxX,u),S=j(e,d,r+_,r+y,0,f.minX,f.maxX,u);e=null,T&&(x=j(T,d,a-m,a+g,1,f.minY,f.maxY,u),v=j(T,d,a+_,a+y,1,f.minY,f.maxY,u),T=null),S&&(b=j(S,d,a-m,a+g,1,f.minY,f.maxY,u),w=j(S,d,a+_,a+y,1,f.minY,f.maxY,u),S=null),c>1&&console.timeEnd("clipping"),h.push(x||[],i+1,2*r,2*a),h.push(v||[],i+1,2*r,2*a+1),h.push(b||[],i+1,2*r+1,2*a),h.push(w||[],i+1,2*r+1,2*a+1)}}getTile(e,i,r){e*=1,i*=1,r*=1;let{extent:a,debug:n}=this.options;if(e<0||e>24)return null;let s=1<<e,l=ei(e,i=i+s&s-1,r);if(this.tiles[l])return J(this.tiles[l],a);n>1&&console.log("drilling down to z%d-%d-%d",e,i,r);let h,u=e,c=i,d=r;for(;!h&&u>0;)u--,c>>=1,d>>=1,h=this.tiles[ei(u,c,d)];return h&&h.source?(n>1&&(console.log("found parent tile z%d-%d-%d",u,c,d),console.time("drilling down")),this.splitTile(h.source,u,c,d,e,i,r),n>1&&console.timeEnd("drilling down"),this.tiles[l]?J(this.tiles[l],a):null):null}}function ei(e,i,r){return 32*((1<<e)*r+i)+e}function er(e,i){let r=e.tileID.canonical;if(!this._geoJSONIndex)return void i(null,null);let a=this._geoJSONIndex.getTile(r.z,r.x,r.y);if(!a)return void i(null,null);let n=new f(a.features),s=A(n);0===s.byteOffset&&s.byteLength===s.buffer.byteLength||(s=new Uint8Array(s)),i(null,{vectorTile:n,rawData:s.buffer})}class ea extends h{constructor(e,i,r,a,n,s){super(e,i,r,a,er,s),n&&(this.loadGeoJSON=n),this._dynamicIndex=new _}loadData(r,a){let n=r&&r.request,s=n&&n.collectResourceTiming;this.loadGeoJSON(r,(l,h)=>{if(l||!h)return a(l);if("object"!=typeof h)return a(Error(`Input data given to '${r.source}' is not a valid GeoJSON object.`));{try{var u,c;if(r.filter){let i=e.M(r.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===i.result)throw Error(i.value.map(e=>`${e.key}: ${e.message}`).join(", "));h.features=h.features.filter(e=>i.value.evaluate({zoom:0},e))}r.dynamic?("Feature"===h.type&&(h={type:"FeatureCollection",features:[h]}),r.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(h.features,this.loaded),r.cluster&&(h.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=r.cluster?new P(function({superclusterOptions:i,clusterProperties:r}){if(!r||!i)return i;let a={},n={},s={accumulated:null,zoom:0},l={properties:null},h=Object.keys(r);for(let i of h){let[s,l]=r[i],h=e.M(l),u=e.M("string"==typeof s?[s,["accumulated"],["get",i]]:s);a[i]=h.value,n[i]=u.value}return i.map=e=>{l.properties=e;let i={};for(let e of h)i[e]=a[e].evaluate(s,l);return i},i.reduce=(e,i)=>{for(let r of(l.properties=i,h))s.accumulated=e[r],e[r]=n[r].evaluate(s,l)},i}(r)).load(h.features):r.dynamic?this._dynamicIndex:(u=h,c=r.geojsonVtOptions,new et(u,c))}catch(e){return a(e)}let l={};if(s){let e=i(n);e&&(l.resourceTiming={},l.resourceTiming[r.source]=JSON.parse(JSON.stringify(e)))}a(null,l)}})}reloadTile(e,i){let r=this.loaded;return r&&r[e.uid]?e.partial?i(null,void 0):super.reloadTile(e,i):this.loadTile(e,i)}loadGeoJSON(i,r){if(i.request)e.n(i.request,r);else{if("string"!=typeof i.data)return r(Error(`Input data given to '${i.source}' is not a valid GeoJSON object.`));try{return r(null,JSON.parse(i.data))}catch(e){return r(Error(`Input data given to '${i.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(e,i){try{i(null,this._geoJSONIndex.getClusterExpansionZoom(e.clusterId))}catch(e){i(e)}}getClusterChildren(e,i){try{i(null,this._geoJSONIndex.getChildren(e.clusterId))}catch(e){i(e)}}getClusterLeaves(e,i){try{i(null,this._geoJSONIndex.getLeaves(e.clusterId,e.limit,e.offset))}catch(e){i(e)}}}class en{constructor(i,r){this.tileID=new e.aA(i.tileID.overscaledZ,i.tileID.wrap,i.tileID.canonical.z,i.tileID.canonical.x,i.tileID.canonical.y),this.tileZoom=i.tileZoom,this.uid=i.uid,this.zoom=i.zoom,this.canonical=i.tileID.canonical,this.pixelRatio=i.pixelRatio,this.tileSize=i.tileSize,this.source=i.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=i.projection,this.brightness=r}parse(i,r,a,n){this.status="parsing";let s=new e.aA(a.tileID.overscaledZ,a.tileID.wrap,a.tileID.canonical.z,a.tileID.canonical.x,a.tileID.canonical.y),l=[],h=r.familiesBySource[a.source],u=new e.dR(s,a.promoteId);
212return u.bucketLayerIDs=[],u.is3DTile=!0,e.e0(i).then(i=>{if(!i)return n(Error("Could not parse tile"));let r=e.e1(i,1/e.c9(a.tileID.canonical)),c=i.json.extensionsUsed&&i.json.extensionsUsed.includes("MAPBOX_mesh_features")||i.json.asset.extras&&i.json.asset.extras.MAPBOX_mesh_features,d=i.json.extensionsUsed&&i.json.extensionsUsed.includes("EXT_meshopt_compression"),p=new e.a3(this.zoom,{brightness:this.brightness});for(let i in h)for(let a of h[i]){let i=a[0];u.bucketLayerIDs.push(a.map(i=>e.av(i.id,i.scope))),i.recalculate(p,[]);let n=new e.e2(a,r,s,c,d,this.brightness,u);c||(n.needsUpload=!0),l.push(n),n.evaluate(i)}this.status="done",n(null,{buckets:l,featureIndex:u,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})}).catch(e=>n(Error(e.message)))}}class eo{constructor(e,i,r,a,n,s){this.actor=e,this.layerIndex=i,this.availableImages=r,this.brightness=s,this.loading={},this.loaded={}}loadTile(i,r){let a=i.uid,n=this.loading[a]=new en(i,this.brightness);e.bd(i.request,(e,s)=>{let l=!this.loading[a];return delete this.loading[a],l||e?(n.status="done",l||(this.loaded[a]=n),r(e)):s&&0!==s.byteLength?void n.parse(s,this.layerIndex,i,(e,i)=>{n.status="done",this.loaded=this.loaded||{},this.loaded[a]=n,e||!i?r(e):r(null,i)}):(n.status="done",this.loaded[a]=n,r())})}reloadTile(e,i){let r=this.loaded,a=e.uid;if(r&&r[a]){let n=r[a];n.projection=e.projection,n.brightness=e.brightness,"parsing"===n.status?n.reloadCallback=(r,a)=>{n.reloadCallback&&(delete n.reloadCallback,this.loadTile(e,i)),i(r,a)}:"done"===n.status&&this.loadTile(e,i)}}abortTile(e,i){let r=e.uid;this.loading[r]&&delete this.loading[r],i()}removeTile(e,i){let r=this.loaded,a=e.uid;r&&r[a]&&delete r[a],i()}}class es{constructor(i){this.self=i,this.actor=new e.e3(i,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=e.bM({name:"mercator"}),this.workerSourceTypes={vector:h,geojson:ea,"batched-model":eo},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(e,i)=>{if(this.workerSourceTypes[e])throw Error(`Worker source with name "${e}" already registered.`);this.workerSourceTypes[e]=i},this.self.registerRTLTextPlugin=i=>{if(e.e4.isParsed())throw Error("RTL text plugin already registered.");e.e4.applyArabicShaping=i.applyArabicShaping,e.e4.processBidirectionalText=i.processBidirectionalText,e.e4.processStyledBidirectionalText=i.processStyledBidirectionalText}}clearCaches(e,i,r){delete this.layerIndexes[e],delete this.availableImages[e],delete this.workerSources[e],delete this.demWorkerSources[e],delete this.rasterArrayWorkerSource,r()}checkIfReady(e,i,r){r()}setReferrer(e,i){this.referrer=i}spriteLoaded(i,{scope:r,isLoaded:a}){if(this.isSpriteLoaded[i]||(this.isSpriteLoaded[i]={}),this.isSpriteLoaded[i][r]=a,this.workerSources[i]&&this.workerSources[i][r])for(let n in this.workerSources[i][r]){let s=this.workerSources[i][r][n];for(let i in s){let r=s[i];r instanceof h&&(r.isSpriteLoaded=a,r.fire(new e.x("isSpriteLoaded")))}}}setImages(e,{scope:i,images:r},a){if(this.availableImages[e]||(this.availableImages[e]={}),this.availableImages[e][i]=r,this.workerSources[e]&&this.workerSources[e][i]){for(let a in this.workerSources[e][i]){let n=this.workerSources[e][i][a];for(let e in n)n[e].availableImages=r}a()}else a()}setProjection(i,r){this.projections[i]=e.bM(r)}setBrightness(e,i,r){this.brightness=i,r()}setLayers(e,i,r){this.getLayerIndex(e,i.scope).replace(i.layers,i.options),r()}updateLayers(e,i,r){this.getLayerIndex(e,i.scope).update(i.layers,i.removedIds,i.options),r()}loadTile(e,i,r){i.projection=this.projections[e]||this.defaultProjection,this.getWorkerSource(e,i.type,i.source,i.scope).loadTile(i,r)}loadDEMTile(e,i,r){this.getDEMWorkerSource(e,i.source,i.scope).loadTile(i,r)}decodeRasterArray(e,i,r){this.getRasterArrayWorkerSource().decodeRasterArray(i,r)}reloadTile(e,i,r){i.projection=this.projections[e]||this.defaultProjection,this.getWorkerSource(e,i.type,i.source,i.scope).reloadTile(i,r)}abortTile(e,i,r){this.getWorkerSource(e,i.type,i.source,i.scope).abortTile(i,r)}removeTile(e,i,r){this.getWorkerSource(e,i.type,i.source,i.scope).removeTile(i,r)}removeSource(e,i,r){if(!(this.workerSources[e]&&this.workerSources[e][i.scope]&&this.workerSources[e][i.scope][i.type]&&this.workerSources[e][i.scope][i.type][i.source]))return;let a=this.workerSources[e][i.scope][i.type][i.source];delete this.workerSources[e][i.scope][i.type][i.source],void 0!==a.removeSource?a.removeSource(i,r):r()}loadWorkerSource(e,i,r){try{this.self.importScripts(i.url),r()}catch(e){r(e.toString())}}syncRTLPluginState(i,r,a){try{e.e4.setState(r);let i=e.e4.getPluginURL();if(e.e4.isLoaded()&&!e.e4.isParsed()&&null!=i){this.self.importScripts(i);let r=e.e4.isParsed();a(r?void 0:Error(`RTL Text Plugin failed to import scripts from ${i}`),r)}}catch(e){a(e.toString())}}setDracoUrl(e,i){this.dracoUrl=i}getAvailableImages(e,i){this.availableImages[e]||(this.availableImages[e]={});let r=this.availableImages[e][i];return r||(r=[]),r}getLayerIndex(e,i){this.layerIndexes[e]||(this.layerIndexes[e]={});let a=this.layerIndexes[e][i];return a||((a=this.layerIndexes[e][i]=new r).scope=i),a}getWorkerSource(e,i,r,a){return this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][a]||(this.workerSources[e][a]={}),this.workerSources[e][a][i]||(this.workerSources[e][a][i]={}),this.isSpriteLoaded[e]||(this.isSpriteLoaded[e]={}),this.workerSources[e][a][i][r]||(this.workerSources[e][a][i][r]=new this.workerSourceTypes[i]({send:(i,r,a,n,s,l)=>{this.actor.send(i,r,a,e,s,l)},scheduler:this.actor.scheduler},this.getLayerIndex(e,a),this.getAvailableImages(e,a),this.isSpriteLoaded[e][a],void 0,this.brightness)),this.workerSources[e][a][i][r]}getDEMWorkerSource(e,i,r){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][r]||(this.demWorkerSources[e][r]={}),this.demWorkerSources[e][r][i]||(this.demWorkerSources[e][r][i]=new u),this.demWorkerSources[e][r][i]}getRasterArrayWorkerSource(){return this.rasterArrayWorkerSource||(this.rasterArrayWorkerSource=new c),this.rasterArrayWorkerSource}enforceCacheSizeLimit(i,r){e.e5(r)}getWorkerPerformanceMetrics(e,i,r){r(void 0,void 0)}}return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new es(self)),es}),a(["./shared"],function(e){let i,r,a,n,s;var l="3.8.0";let h={create:"create",load:"load",fullLoad:"fullLoad"},u={mark(e){performance.mark(e)},measure(e,i,r){performance.measure(e,i,r)}};function c(i){let r=i.name.split("?")[0];return e.a(r)&&r.includes("mapbox-gl.js")?"javascript":e.a(r)&&r.includes("mapbox-gl.css")?"css":e.b(r)?"fontRange":e.c(r)?"sprite":e.i(r)?"style":e.d(r)?"tilejson":"other"}var d,p={},f=function(){if(d)return p;function e(e){return!i(e)}function i(i){var a;return"undefined"==typeof window||"undefined"==typeof document?"not a browser":!function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var e,i,r=new Blob([""],{type:"text/javascript"}),a=URL.createObjectURL(r);try{i=new Worker(a),e=!0}catch(i){e=!1}return i&&i.terminate(),URL.revokeObjectURL(a),e}()?"insufficient worker support":!function(){var e=document.createElement("canvas");e.width=e.height=1;var i=e.getContext("2d");if(!i)return!1;var r=i.getImageData(0,0,1,1);return r&&r.width===e.width}
212()?"insufficient Canvas/getImageData support":(void 0===r[a=i&&i.failIfMajorPerformanceCaveat]&&(r[a]=function(i){var r,a,n,s=(r=document.createElement("canvas"),(a=Object.create(e.webGLContextAttributes)).failIfMajorPerformanceCaveat=i,r.getContext("webgl2",a));if(!s)return!1;try{n=s.createShader(s.VERTEX_SHADER)}catch(e){return!1}return!(!n||s.isContextLost())&&(s.shaderSource(n,"void main() {}"),s.compileShader(n),!0===s.getShaderParameter(n,s.COMPILE_STATUS))}(a)),r[a]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support")}d=1,p.supported=e,p.notSupportedReason=i;var r={};return e.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},p}();function m(e,i,r){let a=document.createElement(e);return null!=i&&(a.className=i),r&&r.appendChild(a),a}function _(e,i,r){let a=document.createElementNS("http://www.w3.org/2000/svg",e);for(let e of Object.keys(i))a.setAttributeNS(null,e,String(i[e]));return r&&r.appendChild(a),a}let g="undefined"!=typeof document?document.documentElement&&document.documentElement.style:null,y=g&&void 0!==g.userSelect?"userSelect":"WebkitUserSelect";function x(){g&&y&&(i=g[y],g[y]="none")}function v(){g&&y&&(g[y]=i)}function b(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",b,!0)}function w(){window.addEventListener("click",b,!0),window.setTimeout(()=>{window.removeEventListener("click",b,!0)},0)}function T(e,i){let r=e.getBoundingClientRect();return E(e,r,i)}function S(e,i){let r=e.getBoundingClientRect(),a=[];for(let n=0;n<i.length;n++)a.push(E(e,r,i[n]));return a}function M(e){return void 0!==window.InstallTrigger&&2===e.button&&e.ctrlKey&&window.navigator.platform.toUpperCase().indexOf("MAC")>=0?0:e.button}function E(i,r,a){let n=i.offsetWidth===r.width?1:i.offsetWidth/r.width;return new e.P((a.clientX-r.left)*n,(a.clientY-r.top)*n)}let A="NO_ACCESS_TOKEN";class I{constructor(e,i,r){this._transformRequestFn=e,this._customAccessToken=i,this._silenceAuthErrors=!!r,this._createSkuToken()}_createSkuToken(){let e=function(){let e="";for(let i=0;i<10;i++)e+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1","01",e].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=e.token,this._skuTokenExpiresAt=e.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(e,i){return this._transformRequestFn&&this._transformRequestFn(e,i)||{url:e}}normalizeStyleURL(i,r){if(!e.f(i))return i;let a=P(i);return a.params.push(`sdk=js-${l}`),a.path=`/styles/v1${a.path}`,this._makeAPIURL(a,this._customAccessToken||r)}normalizeGlyphsURL(i,r){if(!e.f(i))return i;let a=P(i);return a.path=`/fonts/v1${a.path}`,this._makeAPIURL(a,this._customAccessToken||r)}normalizeModelURL(i,r){if(!e.f(i))return i;let a=P(i);return a.path=`/models/v1${a.path}`,this._makeAPIURL(a,this._customAccessToken||r)}normalizeSourceURL(i,r,a,n){if(!e.f(i))return i;let s=P(i);return s.path=`/v4/${s.authority}.json`,s.params.push("secure"),a&&s.params.push(`language=${a}`),n&&s.params.push(`worldview=${n}`),this._makeAPIURL(s,this._customAccessToken||r)}normalizeSpriteURL(i,r,a,n){let s=P(i);return e.f(i)?(s.path=`/styles/v1${s.path}/sprite${r}${a}`,this._makeAPIURL(s,this._customAccessToken||n)):(s.path+=`${r}${a}`,L(s))}normalizeTileURL(i,r,a){if(this._isSkuTokenExpired()&&this._createSkuToken(),i&&!e.f(i))return i;let n=P(i);n.path=n.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${r||a&&"raster"!==n.authority&&512===a?"@2x":""}${e.m.supported?".webp":"$1"}`),"raster"===n.authority?n.path=`/${e.e.RASTER_URL_PREFIX}${n.path}`:"rasterarrays"===n.authority?n.path=`/${e.e.RASTERARRAYS_URL_PREFIX}${n.path}`:"3dtiles"===n.authority?n.path=`/${e.e.TILES3D_URL_PREFIX}${n.path}`:(n.path=n.path.replace(/^.+\/v4\//,"/"),n.path=`/${e.e.TILE_URL_VERSION}${n.path}`);let s=this._customAccessToken||function(e){for(let i of e){let e=i.match(/^access_token=(.*)$/);if(e)return e[1]}return null}(n.params)||e.e.ACCESS_TOKEN;return e.e.REQUIRE_ACCESS_TOKEN&&s&&this._skuToken&&n.params.push(`sku=${this._skuToken}`),this._makeAPIURL(n,s)}canonicalizeTileURL(i,r){let a=P(i);if(!a.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!a.path.match(/\.[\w]+$/))return i;let n="mapbox://";a.path.match(/^\/raster\/v1\//)?n+=`raster/${a.path.replace(`/${e.e.RASTER_URL_PREFIX}/`,"")}`:a.path.match(/^\/rasterarrays\/v1\//)?n+=`rasterarrays/${a.path.replace(`/${e.e.RASTERARRAYS_URL_PREFIX}/`,"")}`:n+=`tiles/${a.path.replace(`/${e.e.TILE_URL_VERSION}/`,"")}`;let s=a.params;return r&&(s=s.filter(e=>!e.match(/^access_token=/))),s.length&&(n+=`?${s.join("&")}`),n}canonicalizeTileset(i,r){let a=!!r&&e.f(r),n=[];for(let r of i.tiles||[])e.h(r)?n.push(this.canonicalizeTileURL(r,a)):n.push(r);return n}_makeAPIURL(i,r){let a="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",n=P(e.e.API_URL);if(i.protocol=n.protocol,i.authority=n.authority,"http"===i.protocol){let e=i.params.indexOf("secure");e>=0&&i.params.splice(e,1)}if("/"!==n.path&&(i.path=`${n.path}${i.path}`),!e.e.REQUIRE_ACCESS_TOKEN)return L(i);if(r=r||e.e.ACCESS_TOKEN,!this._silenceAuthErrors){if(!r)throw Error(`An API access token is required to use Mapbox GL. ${a}`);if("s"===r[0])throw Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${a}`)}return i.params=i.params.filter(e=>-1===e.indexOf("access_token")),i.params.push(`access_token=${r||""}`),L(i)}}let C=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function P(e){let i=e.match(C);if(!i)throw Error("Unable to parse URL object");return{protocol:i[1],authority:i[2],path:i[3]||"/",params:i[4]?i[4].split("&"):[]}}function L(e){let i=e.params.length?`?${e.params.join("&")}`:"";return`${e.protocol}://${e.authority}${e.path}${i}`}let k="mapbox.eventData";function R(i){if(!i)return null;let r=i.split(".");if(!r||3!==r.length)return null;
212try{return JSON.parse(e.j(r[1]))}catch(e){return null}}class z{constructor(e){this.type=e,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(i){let r=R(e.e.ACCESS_TOKEN),a="";return a=r&&r.u?e.k(r.u):e.e.ACCESS_TOKEN||"",i?`${k}.${i}:${a}`:`${k}:${a}`}fetchEventData(){let i=e.s("localStorage"),r=this.getStorageKey(),a=this.getStorageKey("uuid");if(i)try{let e=localStorage.getItem(r);e&&(this.eventData=JSON.parse(e));let i=localStorage.getItem(a);i&&(this.anonId=i)}catch(i){e.w("Unable to read from LocalStorage")}}saveEventData(){let i=e.s("localStorage"),r=this.getStorageKey(),a=this.getStorageKey("uuid"),n=this.anonId;if(i&&n)try{localStorage.setItem(a,n),Object.keys(this.eventData).length>=1&&localStorage.setItem(r,JSON.stringify(this.eventData))}catch(i){e.w("Unable to write to LocalStorage")}}processRequests(e){}postEvent(i,r,a,n){if(!e.e.EVENTS_URL)return;let s=P(e.e.EVENTS_URL);s.params.push(`access_token=${n||e.e.ACCESS_TOKEN||""}`);let l={event:this.type,created:new Date(i).toISOString()},h=r?e.l(l,r):l,u={url:L(s),headers:{"Content-Type":"text/plain"},body:JSON.stringify([h])};this.pendingRequest=e.p(u,e=>{this.pendingRequest=null,a(e),this.saveEventData(),this.processRequests(n)})}queueRequest(e,i){this.queue.push(e),this.processRequests(i)}}let D=new class extends z{constructor(e){super("appUserTurnstile"),this._customAccessToken=e}postTurnstileEvent(i,r){e.e.EVENTS_URL&&e.e.ACCESS_TOKEN&&Array.isArray(i)&&i.some(i=>e.f(i)||e.h(i))&&this.queueRequest(Date.now(),r)}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();let r=R(e.e.ACCESS_TOKEN),a=r?r.u:e.e.ACCESS_TOKEN,n=a!==this.eventData.tokenU;e.v(this.anonId)||(this.anonId=e.u(),n=!0);let s=this.queue.shift();if(this.eventData.lastSuccess){let e=new Date(this.eventData.lastSuccess),i=new Date(s),r=(s-this.eventData.lastSuccess)/864e5;n=n||r>=1||r<-1||e.getDate()!==i.getDate()}else n=!0;n?this.postEvent(s,{sdkIdentifier:"mapbox-gl-js",sdkVersion:l,skuId:"01","enabled.telemetry":!1,userId:this.anonId},e=>{e||(this.eventData.lastSuccess=s,this.eventData.tokenU=a)},i):this.processRequests()}},O=D.postTurnstileEvent.bind(D),B=new class extends z{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(i,r,a,n){this.skuToken=r,this.errorCb=n,e.e.EVENTS_URL&&(a||e.e.ACCESS_TOKEN?this.queueRequest({id:i,timestamp:Date.now()},a):this.errorCb(Error(A)))}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;let{id:r,timestamp:a}=this.queue.shift();r&&this.success[r]||(this.anonId||this.fetchEventData(),e.v(this.anonId)||(this.anonId=e.u()),this.postEvent(a,{sdkIdentifier:"mapbox-gl-js",sdkVersion:l,skuId:"01",skuToken:this.skuToken,userId:this.anonId},e=>{e?this.errorCb(e):r&&(this.success[r]=!0)},i))}remove(){this.errorCb=null}},F=B.postMapLoadEvent.bind(B),N=new class extends z{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(i){let r=this.mapInstanceIdMap.get(i);return r||(r=e.u(),this.mapInstanceIdMap.set(i,r)),r}getEventId(e){let i=this.eventIdPerMapInstanceMap.get(e)||0;return this.eventIdPerMapInstanceMap.set(e,i+1),i}postStyleLoadEvent(i,r){let{map:a,style:n,importedStyles:s}=r;if(!e.e.EVENTS_URL||!i&&!e.e.ACCESS_TOKEN)return;let l=this.getMapInstanceId(a),h={mapInstanceId:l,eventId:this.getEventId(l),style:n};s.length&&(h.importedStyles=s),this.queueRequest({timestamp:Date.now(),payload:h},i)}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;let{timestamp:i,payload:r}=this.queue.shift();this.postEvent(i,r,()=>{},e)}},V=N.postStyleLoadEvent.bind(N),U=new class extends z{constructor(){super("gljs.performance")}postPerformanceEvent(i,r){e.e.EVENTS_URL&&(i||e.e.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:r},i)}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;let{timestamp:r,performanceData:a}=this.queue.shift(),n=function(i){let r=performance.getEntriesByType("resource"),a=performance.getEntriesByType("mark"),n=function(e){let i={};if(e){for(let r in e)if("other"!==r)for(let a of e[r]){let e=`${r}ResolveRangeMin`,n=`${r}ResolveRangeMax`,s=`${r}RequestCount`,l=`${r}RequestCachedCount`;i[e]=Math.min(i[e]||1/0,a.startTime),i[n]=Math.max(i[n]||-1/0,a.responseEnd);let h=e=>{void 0===i[e]&&(i[e]=0),++i[e]};void 0!==a.transferSize&&0===a.transferSize&&h(l),h(s)}}return i}(function(e,i){let r={};if(e)for(let a of e){let e=i(a);void 0===r[e]&&(r[e]=[]),r[e].push(a)}return r}(r,c)),s=window.devicePixelRatio,u=navigator.connection||navigator.mozConnection||navigator.webkitConnection,d=u?u.effectiveType:void 0,p={counters:[],metadata:[],attributes:[]},f=(e,i,r)=>{null!=r&&e.push({name:i,value:r.toString()})};for(let e in n)f(p.counters,e,n[e]);if(i.interactionRange[0]!==1/0&&i.interactionRange[1]!==-1/0&&(f(p.counters,"interactionRangeMin",i.interactionRange[0]),f(p.counters,"interactionRangeMax",i.interactionRange[1])),a)for(let e of Object.keys(h)){let i=h[e],r=a.find(e=>e.name===i);r&&f(p.counters,i,r.startTime)}return f(p.counters,"visibilityHidden",i.visibilityHidden),f(p.attributes,"style",function(i){if(i)for(let r of i){let i=r.name.split("?")[0];if(e.i(i)){let e=i.split("/").slice(-2);if(2===e.length)return`mapbox://styles/${e[0]}/${e[1]}`}}}(r)),f(p.attributes,"terrainEnabled",i.terrainEnabled?"true":"false"),f(p.attributes,"fogEnabled",i.fogEnabled?"true":"false"),f(p.attributes,"projection",i.projection),f(p.attributes,"zoom",i.zoom),f(p.metadata,"devicePixelRatio",s),f(p.metadata,"connectionEffectiveType",d),f(p.metadata,"navigatorUserAgent",navigator.userAgent),f(p.metadata,"screenWidth",window.screen.width),f(p.metadata,"screenHeight",window.screen.height),f(p.metadata,"windowWidth",window.innerWidth),f(p.metadata,"windowHeight",window.innerHeight),f(p.metadata,"mapWidth",i.width/s),f(p.metadata,"mapHeight",i.height/s),f(p.metadata,"webglRenderer",i.renderer),f(p.metadata,"webglVendor",i.vendor),f(p.metadata,"sdkVersion",l),f(p.metadata,"sdkIdentifier","mapbox-gl-js"),p}(a);for(let e of n.metadata);for(let e of n.counters);for(let e of n.attributes);this.postEvent(r,n,()=>{},i)}},j=U.postPerformanceEvent.bind(U),G=new class extends z{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(i,r,a,n){if(!e.e.API_URL||!e.e.SESSION_PATH)return;let s=P(e.e.API_URL+e.e.SESSION_PATH);s.params.push(`sku=${r||""}`),s.params.push(`access_token=${n||e.e.ACCESS_TOKEN||""}`);let l={url:L(s),headers:{"Content-Type":"text/plain"}};this.pendingRequest=e.g(l,e=>{this.pendingRequest=null,a(e),this.saveEventData(),this.processRequests(n)})}getSessionAPI(i,r,a,n){this.skuToken=r,this.errorCb=n,e.e.SESSION_PATH&&e.e.API_URL&&(a||e.e.ACCESS_TOKEN?this.queueRequest({id:i,timestamp:Date.now()},a):this.errorCb(Error(A)))}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;let{id:i,timestamp:r}=this.queue.shift();
212i&&this.success[i]||this.getSession(r,this.skuToken,e=>{e?this.errorCb(e):i&&(this.success[i]=!0)},e)}remove(){this.errorCb=null}},q=G.getSessionAPI.bind(G),W=new Set;function $(e,i){i?W.add(e):W.delete(e)}class H{constructor(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps=new Set,this._updatedImages=new Set}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(e,i){this._updatedSourceCaches[e]=i,this.setDirty()}discardSourceCacheUpdate(e){delete this._updatedSourceCaches[e]}updateLayer(e){let i=e.scope;this._updatedLayers[i]=this._updatedLayers[i]||new Set,this._updatedLayers[i].add(e.id),this.setDirty()}removeLayer(e){let i=e.scope;this._removedLayers[i]=this._removedLayers[i]||{},this._updatedLayers[i]=this._updatedLayers[i]||new Set,this._removedLayers[i][e.id]=e,this._updatedLayers[i].delete(e.id),this._updatedPaintProps.delete(e.fqid),this.setDirty()}getRemovedLayer(e){return this._removedLayers[e.scope]?this._removedLayers[e.scope][e.id]:null}discardLayerRemoval(e){this._removedLayers[e.scope]&&delete this._removedLayers[e.scope][e.id]}getLayerUpdatesByScope(){let e={};for(let i in this._updatedLayers)e[i]=e[i]||{},e[i].updatedIds=Array.from(this._updatedLayers[i].values());for(let i in this._removedLayers)e[i]=e[i]||{},e[i].removedIds=Object.keys(this._removedLayers[i]);return e}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(e){this._updatedPaintProps.add(e.fqid),this.setDirty()}getUpdatedImages(){return Array.from(this._updatedImages.values())}updateImage(e){this._updatedImages.add(e),this.setDirty()}resetUpdatedImages(){this._updatedImages.clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages.clear()}}class Z extends e.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded={},this.requestors=[],this.patterns={},this.atlasImage={},this.atlasTexture={},this.dirty=!0}createScope(i){this.images[i]={},this.loaded[i]=!1,this.updatedImages[i]={},this.patterns[i]={},this.callbackDispatchedThisFrame[i]={},this.atlasImage[i]=new e.r({width:1,height:1})}isLoaded(){for(let e in this.loaded)if(!this.loaded[e])return!1;return!0}setLoaded(e,i){if(this.loaded[i]!==e&&(this.loaded[i]=e,e)){for(let{ids:e,callback:r}of this.requestors)this._notify(e,i,r);this.requestors=[]}}hasImage(e,i){return!!this.getImage(e,i)}getImage(e,i){return this.images[i][e]}addImage(e,i,r){this._validate(e,r)&&(this.images[i][e]=r)}_validate(i,r){let a=!0;return this._validateStretch(r.stretchX,r.data&&r.data.width)||(this.fire(new e.t(Error(`Image "${i}" has invalid "stretchX" value`))),a=!1),this._validateStretch(r.stretchY,r.data&&r.data.height)||(this.fire(new e.t(Error(`Image "${i}" has invalid "stretchY" value`))),a=!1),this._validateContent(r.content,r)||(this.fire(new e.t(Error(`Image "${i}" has invalid "content" value`))),a=!1),a}_validateStretch(e,i){if(!e)return!0;let r=0;for(let a of e){if(a[0]<r||a[1]<a[0]||i<a[1])return!1;r=a[1]}return!0}_validateContent(e,i){return!(e&&(4!==e.length||e[0]<0||i.data.width<e[0]||e[1]<0||i.data.height<e[1]||e[2]<0||i.data.width<e[2]||e[3]<0||i.data.height<e[3]||e[2]<e[0]||e[3]<e[1]))}updateImage(e,i,r){r.version=this.images[i][e].version+1,this.images[i][e]=r,this.updatedImages[i][e]=!0}removeImage(e,i){let r=this.images[i][e];delete this.images[i][e],delete this.patterns[i][e],r.userImage&&r.userImage.onRemove&&r.userImage.onRemove()}listImages(e){return Object.keys(this.images[e])}getImages(e,i,r){let a=!0,n=!!this.loaded[i];if(!n)for(let r of e)this.images[i][r]||(a=!1);n||a?this._notify(e,i,r):this.requestors.push({ids:e,scope:i,callback:r})}getUpdatedImages(e){return this.updatedImages[e]}_notify(i,r,a){let n={};for(let a of i){this.images[r][a]||this.fire(new e.x("styleimagemissing",{id:a}));let i=this.images[r][a];i?n[a]={data:i.data.clone(),pixelRatio:i.pixelRatio,sdf:i.sdf,ver
212sion:i.version,stretchX:i.stretchX,stretchY:i.stretchY,content:i.content,hasRenderCallback:!!(i.userImage&&i.userImage.render)}:e.w(`Image "${a}" 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.`)}a(null,n)}getPixelSize(e){let{width:i,height:r}=this.atlasImage[e];return{width:i,height:r}}getPattern(i,r,a){let n=this.patterns[r][i],s=this.getImage(i,r);if(!s)return null;if(n&&n.position.version===s.version)return n.position;if(n)n.position.version=s.version;else{let a={w:s.data.width+2*e.y,h:s.data.height+2*e.y,x:0,y:0},n=new e.I(a,s,e.y);this.patterns[r][i]={bin:a,position:n}}return this._updatePatternAtlas(r,a),this.patterns[r][i].position}bind(i,r){let a=i.gl,n=this.atlasTexture[r];n?this.dirty&&(n.update(this.atlasImage[r]),this.dirty=!1):(n=new e.T(i,this.atlasImage[r],a.RGBA8),this.atlasTexture[r]=n),n.bind(a.LINEAR,a.CLAMP_TO_EDGE)}_updatePatternAtlas(i,r){let a=[];for(let e in this.patterns[i])a.push(this.patterns[i][e].bin);let{w:n,h:s}=e.z(a),l=this.atlasImage[i];for(let a in l.resize({width:n||1,height:s||1}),this.patterns[i]){let{bin:n,position:s}=this.patterns[i][a],h=s.padding,u=n.x+h,c=n.y+h,d=this.images[i][a].data,p=d.width,f=d.height;h=h>1?h-1:h,e.r.copy(d,l,{x:0,y:0},{x:u,y:c},{width:p,height:f},r),e.r.copy(d,l,{x:0,y:f-h},{x:u,y:c-h},{width:p,height:h},r),e.r.copy(d,l,{x:0,y:0},{x:u,y:c+f},{width:p,height:h},r),e.r.copy(d,l,{x:p-h,y:0},{x:u-h,y:c},{width:h,height:f},r),e.r.copy(d,l,{x:0,y:0},{x:u+p,y:c},{width:h,height:f},r),e.r.copy(d,l,{x:p-h,y:f-h},{x:u-h,y:c-h},{width:h,height:h},r),e.r.copy(d,l,{x:0,y:f-h},{x:u+p,y:c-h},{width:h,height:h},r),e.r.copy(d,l,{x:0,y:0},{x:u+p,y:c+f},{width:h,height:h},r),e.r.copy(d,l,{x:p-h,y:0},{x:u-h,y:c+f},{width:h,height:h},r)}this.dirty=!0}beginFrame(){for(let e in this.images)this.callbackDispatchedThisFrame[e]={}}dispatchRenderCallbacks(e,i){for(let r of e){if(this.callbackDispatchedThisFrame[i][r])continue;this.callbackDispatchedThisFrame[i][r]=!0;let e=this.images[i][r];(function(e){let{userImage:i}=e;return!!(i&&i.render&&i.render())&&(e.data.replace(new Uint8Array(i.data.buffer)),!0)})(e)&&this.updateImage(r,i,e)}}}function X(i){let r=i.key,a=i.value,n=i.valueSpec||{},s=i.objectElementValidators||{},l=i.style,h=i.styleSpec,u=[],c=e.B(a);if("object"!==c)return[new e.V(r,a,`object expected, ${c} found`)];for(let i in a){let c;let d=i.split(".")[0];s[d]?c=s[d]:n[d]?c=ef:s["*"]?c=s["*"]:n["*"]&&(c=ef),c?u=u.concat(c({key:(r?`${r}.`:r)+i,value:a[i],valueSpec:n[d]||n["*"],style:l,styleSpec:h,object:a,objectKey:i},a)):u.push(new e.A(r,a[i],`unknown property "${i}"`))}for(let i in n)s[i]||n[i].required&&void 0===n[i].default&&void 0===a[i]&&u.push(new e.V(r,a,`missing required property "${i}"`));return u}function Y(i){let r=i.value,a=i.valueSpec,n=i.style,s=i.styleSpec,l=i.key,h=i.arrayElementValidator||ef;if("array"!==e.B(r))return[new e.V(l,r,`array expected, ${e.B(r)} found`)];if(a.length&&r.length!==a.length)return[new e.V(l,r,`array length ${a.length} expected, length ${r.length} found`)];if(a["min-length"]&&r.length<a["min-length"])return[new e.V(l,r,`array length at least ${a["min-length"]} expected, length ${r.length} found`)];let u={type:a.value,values:a.values,minimum:a.minimum,maximum:a.maximum,function:void 0};s.$version<7&&(u.function=a.function),"object"===e.B(a.value)&&(u=a.value);let c=[];for(let e=0;e<r.length;e++)c=c.concat(h({array:r,arrayIndex:e,value:r[e],valueSpec:u,style:n,styleSpec:s,key:`${l}[${e}]`},!0));return c}function J(i){let r=i.key,a=i.value,n=i.valueSpec,s=e.B(a);if("number"===s&&a!=a&&(s="NaN"),"number"!==s)return[new e.V(r,a,`number expected, ${s} found`)];if("minimum"in n){let s=n.minimum;if("array"===e.B(n.minimum)&&(s=n.minimum[i.arrayIndex]),a<s)return[new e.V(r,a,`${a} is less than the minimum value ${s}`)]}if("maximum"in n){let s=n.maximum;if("array"===e.B(n.maximum)&&(s=n.maximum[i.arrayIndex]),a>s)return[new e.V(r,a,`${a} is greater than the maximum value ${s}`)]}return[]}function K(i){let r=i.valueSpec,a=e.D(i.value.type),n,s,l,h={},u="categorical"!==a&&void 0===i.value.property,c="array"===e.B(i.value.stops)&&"array"===e.B(i.value.stops[0])&&"object"===e.B(i.value.stops[0][0]),d=X({key:i.key,value:i.value,valueSpec:i.styleSpec.function,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(i){if("identity"===a)return[new e.V(i.key,i.value,'identity function may not have a "stops" property')];let r=[],n=i.value;return r=r.concat(Y({key:i.key,value:n,valueSpec:i.valueSpec,style:i.style,styleSpec:i.styleSpec,arrayElementValidator:p})),"array"===e.B(n)&&0===n.length&&r.push(new e.V(i.key,n,"array must have at least one stop")),r},default:function(e){return ef({key:e.key,value:e.value,valueSpec:r,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===a&&u&&d.push(new e.V(i.key,i.value,'missing required property "property"')),"identity"===a||i.value.stops||d.push(new e.V(i.key,i.value,'missing required property "stops"')),"exponential"===a&&i.valueSpec.expression&&!e.F(i.valueSpec)&&d.push(new e.V(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(u||e.G(i.valueSpec)?u&&!e.H(i.valueSpec)&&d.push(new e.V(i.key,i.value,"zoom functions not supported")):d.push(new e.V(i.key,i.value,"property functions not supported"))),("categorical"===a||c)&&void 0===i.value.property&&d.push(new e.V(i.key,i.value,'"property" property is required')),d;function p(i){let a=[],n=i.value,u=i.key;if("array"!==e.B(n))return[new e.V(u,n,`array expected, ${e.B(n)} found`)];if(2!==n.length)return[new e.V(u,n,`array length 2 expected, length ${n.length} found`)];if(c){if("object"!==e.B(n[0]))return[new e.V(u,n,`object expected, ${e.B(n[0])} found`)];if(void 0===n[0].zoom)return[new e.V(u,n,"object stop key must have zoom")];if(void 0===n[0].value)return[new e.V(u,n,"object stop key must have value")];let r=e.D(n[0].zoom);if("number"!=typeof r)return[new e.V(u,n[0].zoom,"stop zoom values must be numbers")];if(l&&l>r)return[new e.V(u,n[0].zoom,"stop zoom values must appear in ascending order")];r!==l&&(l=r,s=void 0,h={}),a=a.concat(X({key:`${u}[0]`,value:n[0],valueSpec:{zoom:{}},style:i.style,styleSpec:i.styleSpec,objectElementValidators:{zoom:J,value:f}}))}else a=a.concat(f({key:`${u}[0]`,value:n[0],valueSpec:{},style:i.style,styleSpec:i.styleSpec},n));return e.J(e.K(n[1]))?a.concat([new e.V(`${u}[1]`,n[1],"expressions are not allowed in function stops.")]):a.concat(ef({key:`${u}[1]`,value:n[1],valueSpec:r,style:i.style,styleSpec:i.styleSpec}))}
212function f(i,l){let u=e.B(i.value),c=e.D(i.value),d=null!==i.value?i.value:l;if(n){if(u!==n)return[new e.V(i.key,d,`${u} stop domain type must match previous stop domain type ${n}`)]}else n=u;if("number"!==u&&"string"!==u&&"boolean"!==u&&"number"!=typeof c&&"string"!=typeof c&&"boolean"!=typeof c)return[new e.V(i.key,d,"stop domain value must be a number, string, or boolean")];if("number"!==u&&"categorical"!==a){let n=`number expected, ${u} found`;return e.G(r)&&void 0===a&&(n+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new e.V(i.key,d,n)]}return"categorical"!==a||"number"!==u||"number"==typeof c&&isFinite(c)&&Math.floor(c)===c?"categorical"!==a&&"number"===u&&"number"==typeof c&&"number"==typeof s&&void 0!==s&&c<s?[new e.V(i.key,d,"stop domain values must appear in ascending order")]:(s=c,"categorical"===a&&c in h?[new e.V(i.key,d,"stop domain values must be unique")]:(h[c]=!0,[])):[new e.V(i.key,d,`integer expected, found ${String(c)}`)]}}function Q(i){let r=("property"===i.expressionContext?e.L:e.M)(e.K(i.value),i.valueSpec);if("error"===r.result)return r.value.map(r=>new e.V(`${i.key}${r.key}`,i.value,r.message));let a=r.value.expression||r.value._styleExpression.expression;if("property"===i.expressionContext&&"text-font"===i.propertyKey&&!a.outputDefined())return[new e.V(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===i.expressionContext&&"layout"===i.propertyType&&!e.N(a))return[new e.V(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===i.expressionContext)return function i(r,a){let n=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(a.valueSpec&&a.valueSpec.expression)for(let e of a.valueSpec.expression.parameters)n.delete(e);if(0===n.size)return[];let s=[];return r instanceof e.S&&n.has(r.name)?[new e.V(a.key,a.value,`["${r.name}"] expression is not supported in a filter for a ${a.object.type} layer with id: ${a.object.id}`)]:(r.eachChild(e=>{s.push(...i(e,a))}),s)}(a,i);if(i.expressionContext&&0===i.expressionContext.indexOf("cluster")){if(!e.O(a,["zoom","feature-state"]))return[new e.V(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===i.expressionContext&&!e.Q(a))return[new e.V(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function ee(i){let r=i.key,a=i.value,n=i.valueSpec,s=[];return Array.isArray(n.values)?-1===n.values.indexOf(e.D(a))&&s.push(new e.V(r,a,`expected one of [${n.values.join(", ")}], ${JSON.stringify(a)} found`)):-1===Object.keys(n.values).indexOf(e.D(a))&&s.push(new e.V(r,a,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(a)} found`)),s}function et(i){return e.W(e.K(i.value))?Q(e.C({},i,{expressionContext:"filter",valueSpec:i.styleSpec[`filter_${i.layerType||"fill"}`]})):function i(r){let a=r.value,n=r.key;if("array"!==e.B(a))return[new e.V(n,a,`array expected, ${e.B(a)} found`)];let s=r.styleSpec,l,h=[];if(a.length<1)return[new e.V(n,a,"filter array must have at least 1 element")];switch(h=h.concat(ee({key:`${n}[0]`,value:a[0],valueSpec:s.filter_operator,style:r.style,styleSpec:r.styleSpec})),e.D(a[0])){case"<":case"<=":case">":case">=":a.length>=2&&"$type"===e.D(a[1])&&h.push(new e.V(n,a,`"$type" cannot be use with operator "${a[0]}"`));case"==":case"!=":3!==a.length&&h.push(new e.V(n,a,`filter array for operator "${a[0]}" must have 3 elements`));case"in":case"!in":a.length>=2&&"string"!==(l=e.B(a[1]))&&h.push(new e.V(`${n}[1]`,a[1],`string expected, ${l} found`));for(let i=2;i<a.length;i++)l=e.B(a[i]),"$type"===e.D(a[1])?h=h.concat(ee({key:`${n}[${i}]`,value:a[i],valueSpec:s.geometry_type,style:r.style,styleSpec:r.styleSpec})):"string"!==l&&"number"!==l&&"boolean"!==l&&h.push(new e.V(`${n}[${i}]`,a[i],`string, number, or boolean expected, ${l} found`));break;case"any":case"all":case"none":for(let e=1;e<a.length;e++)h=h.concat(i({key:`${n}[${e}]`,value:a[e],style:r.style,styleSpec:r.styleSpec}));break;case"has":case"!has":l=e.B(a[1]),2!==a.length?h.push(new e.V(n,a,`filter array for "${a[0]}" operator must have 2 elements`)):"string"!==l&&h.push(new e.V(`${n}[1]`,a[1],`string expected, ${l}
212 found`))}return h}(i)}function ei(i,r){let a;let n=i.key,s=i.style,l=i.layer,h=i.styleSpec,u=i.value,c=i.objectKey,d=h[`${r}_${i.layerType}`];if(!d)return[];let p=c.match(/^(.*)-transition$/);if("paint"===r&&p&&d[p[1]]&&d[p[1]].transition)return ef({key:n,value:u,valueSpec:h.transition,style:s,styleSpec:h});let f=i.valueSpec||d[c];if(!f)return[new e.A(n,u,`unknown property "${c}"`)];if("string"===e.B(u)&&e.G(f)&&!f.tokens&&(a=/^{([^}]+)}$/.exec(u))){let i=`\`{ "type": "identity", "property": ${a?JSON.stringify(a[1]):'"_"'} }\``;return[new e.V(n,u,`"${c}" does not support interpolation syntax 213Use an identity property function instead: ${i}.`)]}let m=[];if("symbol"===i.layerType)"text-field"!==c||!s||s.glyphs||s.imports||m.push(new e.V(n,u,'use of "text-field" requires a style "glyphs" property')),"text-font"===c&&e.X(e.K(u))&&"identity"===e.D(u.type)&&m.push(new e.V(n,u,'"text-font" does not support identity functions'));else if("model"===i.layerType&&"paint"===r&&l&&l.layout&&l.layout.hasOwnProperty("model-id")&&e.G(f)&&(e.Y(f)||e.H(f))){let i=e.L(e.K(u),f),r=i.value.expression||i.value._styleExpression.expression;r&&!e.O(r,["measure-light"])&&("model-emissive-strength"===c&&e.Q(r)&&e.N(r)||m.push(new e.V(n,u,`${c} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return m.concat(ef({key:i.key,value:u,valueSpec:f,style:s,styleSpec:h,expressionContext:"property",propertyType:r,propertyKey:c}))}function er(e){return ei(e,"paint")}function ea(e){return ei(e,"layout")}function en(i){let r=[],a=i.value,n=i.key,s=i.style,l=i.styleSpec;a.type||a.ref||r.push(new e.V(n,a,'either "type" or "ref" is required'));let h=e.D(a.type),u=e.D(a.ref);if(a.id){let l=e.D(a.id);for(let h=0;h<i.arrayIndex;h++){let i=s.layers[h];e.D(i.id)===l&&r.push(new e.V(n,a.id,`duplicate layer id "${a.id}", previously used at line ${i.id.__line__}`))}}if("ref"in a){let i;["type","source","source-layer","filter","layout"].forEach(i=>{i in a&&r.push(new e.V(n,a[i],`"${i}" is prohibited for ref layers`))}),s.layers.forEach(r=>{e.D(r.id)===u&&(i=r)}),i?i.ref?r.push(new e.V(n,a.ref,"ref cannot reference another ref layer")):h=e.D(i.type):"string"==typeof u&&r.push(new e.V(n,a.ref,`ref layer "${u}" not found`))}else if("background"!==h&&"sky"!==h&&"slot"!==h){if(a.source){let i=s.sources&&s.sources[a.source],l=i&&e.D(i.type);i?"vector"===l&&"raster"===h?r.push(new e.V(n,a.source,`layer "${a.id}" requires a raster source`)):"raster"===l&&"raster"!==h?r.push(new e.V(n,a.source,`layer "${a.id}" requires a vector source`)):"vector"!==l||a["source-layer"]?"raster-dem"===l&&"hillshade"!==h?r.push(new e.V(n,a.source,"raster-dem source can only be used with layer type 'hillshade'.")):"raster-array"!==l||["raster","raster-particle"].includes(h)?"line"===h&&a.paint&&(a.paint["line-gradient"]||a.paint["line-trim-offset"])&&("geojson"!==l||!i.lineMetrics)?r.push(new e.V(n,a,`layer "${a.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):"raster-particle"===h&&"raster-array"!==l&&r.push(new e.V(n,a.source,`layer "${a.id}" requires a 'raster-array' source.`)):r.push(new e.V(n,a.source,"raster-array source can only be used with layer type 'raster'.")):r.push(new e.V(n,a,`layer "${a.id}" must specify a "source-layer"`)):r.push(new e.V(n,a.source,`source "${a.source}" not found`))}else r.push(new e.V(n,a,'missing required property "source"'))}return r=r.concat(X({key:n,value:a,valueSpec:l.layer,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":()=>[],type:()=>ef({key:`${n}.type`,value:a.type,valueSpec:l.layer.type,style:i.style,styleSpec:i.styleSpec,object:a,objectKey:"type"}),filter:i=>et(e.C({layerType:h},i)),layout:i=>X({layer:a,key:i.key,value:i.value,valueSpec:{},style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":i=>ea(e.C({layerType:h},i))}}),paint:i=>X({layer:a,key:i.key,value:i.value,valueSpec:{},style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":i=>er(e.C({layerType:h,layer:a},i))}})}}))}function eo(i){let r=i.value,a=i.key,n=e.B(r);return"string"!==n?[new e.V(a,r,`string expected, ${n} found`)]:[]}let es={promoteId:function({key:i,value:r}){if("string"===e.B(r))return eo({key:i,value:r});{let e=[];for(let a in r)e.push(...eo({key:`${i}.${a}`,value:r[a]}));return e}}};function el(i){let r=i.value,a=i.key,n=i.styleSpec,s=i.style;if(!r.type)return[new e.V(a,r,'"type" is required')];let l=e.D(r.type),h=[];switch(["vector","raster","raster-dem","raster-array"].includes(l)&&(r.url||r.tiles||h.push(new e.A(a,r,'Either "url" or "tiles" is required.'))),l){case"vector":case"raster":case"raster-dem":case"raster-array":return h.concat(X({key:a,value:r,valueSpec:n[`source_${l.replace("-","_")}`],style:i.style,styleSpec:n,objectElementValidators:es}));case"geojson":if(h=X({key:a,value:r,valueSpec:n.source_geojson,style:s,styleSpec:n,objectElementValidators:es}),r.cluster)for(let e in r.clusterProperties){let[i,n]=r.clusterProperties[e],s="string"==typeof i?[i,["accumulated"],["get",e]]:i;h.push(...Q({key:`${a}.${e}.map`,value:n,expressionContext:"cluster-map"})),h.push(...Q({key:`${a}.${e}.reduce`,value:s,expressionContext:"cluster-reduce"}))}return h;case"video":return X({key:a,value:r,valueSpec:n.source_video,style:s,styleSpec:n});case"image":return X({key:a,value:r,valueSpec:n.source_image,style:s,styleSpec:n});case"canvas":return[new e.V(a,null,"Please use runtime APIs to add canvas sources, rather than
213including them in stylesheets.","source.canvas")];default:return ee({key:`${a}.type`,value:r.type,valueSpec:{values:n.source.reduce((e,i)=>{let r=n[i];return"enum"===r.type.type&&(e=e.concat(Object.keys(r.type.values))),e},[])},style:s,styleSpec:n})}}function eh(i){let r=i.value,a=i.styleSpec,n=a.light,s=i.style,l=[],h=e.B(r);if(void 0===r)return l;if("object"!==h)return l.concat([new e.V("light",r,`object expected, ${h} found`)]);for(let i in r){let h=i.match(/^(.*)-transition$/);l=l.concat(h&&n[h[1]]&&n[h[1]].transition?ef({key:i,value:r[i],valueSpec:a.transition,style:s,styleSpec:a}):n[i]?ef({key:i,value:r[i],valueSpec:n[i],style:s,styleSpec:a}):[new e.V(i,r[i],`unknown property "${i}"`)])}return l}function eu(i){let r=i.value,a=[];if(!r)return a;let n=e.B(r);if("object"!==n)return a.concat([new e.V("light-3d",r,`object expected, ${n} found`)]);let s=i.styleSpec,l=s["light-3d"],h=i.key,u=i.style,c=i.style.lights;for(let i of["type","id"])if(!(i in r))return a.concat([new e.V("light-3d",r,`missing property ${i} on light`)]);if(r.type&&c)for(let n=0;n<i.arrayIndex;n++){let i=e.D(r.type),s=c[n];e.D(s.type)===i&&a.push(new e.V(h,r.id,`duplicate light type "${r.type}", previously defined at line ${s.id.__line__}`))}let d=`properties_light_${r.type}`;if(!(d in s))return a.concat([new e.V("light-3d",r,`Invalid light type ${r.type}`)]);let p=s[d];for(let n in r)if("properties"===n){let l=r[n],h=e.B(l);if("object"!==h)return a.concat([new e.V("properties",l,`object expected, ${h} found`)]);for(let r in l)a=a.concat(p[r]?ef({key:r,value:l[r],valueSpec:p[r],style:u,styleSpec:s}):[new e.A(i.key,l[r],`unknown property "${r}"`)])}else{let i=n.match(/^(.*)-transition$/);a=a.concat(i&&l[i[1]]&&l[i[1]].transition?ef({key:n,value:r[n],valueSpec:s.transition,style:u,styleSpec:s}):l[n]?ef({key:n,value:r[n],valueSpec:l[n],style:u,styleSpec:s}):[new e.A(n,r[n],`unknown property "${n}"`)])}return a}function ec(i){let r=i.value,a=i.key,n=i.style,s=i.styleSpec,l=s.terrain,h=[],u=e.B(r);if(void 0===r||"null"===u)return h;if("object"!==u)return h.concat([new e.V("terrain",r,`object expected, ${u} found`)]);for(let i in r){let a=i.match(/^(.*)-transition$/);h=h.concat(a&&l[a[1]]&&l[a[1]].transition?ef({key:i,value:r[i],valueSpec:s.transition,style:n,styleSpec:s}):l[i]?ef({key:i,value:r[i],valueSpec:l[i],style:n,styleSpec:s}):[new e.A(i,r[i],`unknown property "${i}"`)])}if(r.source){let i=n.sources&&n.sources[r.source],s=i&&e.D(i.type);i?"raster-dem"!==s&&h.push(new e.V(a,r.source,`terrain cannot be used with a source of type ${String(s)}, it only be used with a "raster-dem" source type`)):h.push(new e.V(a,r.source,`source "${r.source}" not found`))}else h.push(new e.V(a,r,'terrain is missing required property "source"'));return h}function ed(i){let r=i.value,a=i.style,n=i.styleSpec,s=n.fog,l=[],h=e.B(r);if(void 0===r)return l;if("object"!==h)return l.concat([new e.V("fog",r,`object expected, ${h} found`)]);for(let i in r){let h=i.match(/^(.*)-transition$/);l=l.concat(h&&s[h[1]]&&s[h[1]].transition?ef({key:i,value:r[i],valueSpec:n.transition,style:a,styleSpec:n}):s[i]?ef({key:i,value:r[i],valueSpec:s[i],style:a,styleSpec:n}):[new e.A(i,r[i],`unknown property "${i}"`)])}return l}let ep={"*":()=>[],array:Y,boolean:function(i){let r=i.value,a=i.key,n=e.B(r);return"boolean"!==n?[new e.V(a,r,`boolean expected, ${n} found`)]:[]},number:J,color:function(i){let r=i.key,a=i.value,n=e.B(a);return"string"!==n?[new e.V(r,a,`color expected, ${n} found`)]:null===e.U.parseCSSColor(a)?[new e.V(r,a,`color expected, "${a}" found`)]:[]},enum:ee,filter:et,function:K,layer:en,object:X,source:el,model:e.Z,light:eh,"light-3d":eu,terrain:ec,fog:ed,string:eo,formatted:function(e){return 0===eo(e).length?[]:Q(e)},resolvedImage:function(e){return 0===eo(e).length?[]:Q(e)},projection:function(i){let r=i.value,a=i.styleSpec,n=a.projection,s=i.style,l=[],h=e.B(r);if("object"===h)for(let e in r)l=l.concat(ef({key:e,value:r[e],valueSpec:n[e],style:s,styleSpec:a}));else"string"!==h&&(l=l.concat([new e.V("projection",r,`object or string expected, ${h} found`)]));return l},import:function(i){let{value:r,styleSpec:a}=i,{data:n,...s}=r;Object.defineProperty(s,"__line__",{value:r.__line__,enumerable:!1});let l=X(e.C({},i,{value:s,valueSpec:a.import}));return""===e.D(s.id)&&l.push(new e.V(`${i.key}.id`,s,"import id can't be an empty string")),n&&(l=l.concat(e_(n,a,{key:`${i.key}.data`}))),l}};
213function ef(i,r=!1){let a=i.value,n=i.valueSpec,s=i.styleSpec;if(n.expression&&e.X(e.D(a)))return K(i);if(n.expression&&e.J(e.K(a)))return Q(i);if(n.type&&ep[n.type]){let a=ep[n.type](i);return!0===r&&a.length>0&&"array"===e.B(i.value)?Q(i):a}return X(e.C({},i,{valueSpec:n.type?s[n.type]:n}))}function em(i){let r=i.value,a=i.key,n=eo(i);return n.length||(-1===r.indexOf("{fontstack}")&&n.push(new e.V(a,r,'"glyphs" url must include a "{fontstack}" token')),-1===r.indexOf("{range}")&&n.push(new e.V(a,r,'"glyphs" url must include a "{range}" token'))),n}function e_(i,r=e._,a={}){return ef({key:a.key||"",value:i,valueSpec:r.$root,styleSpec:r,style:i,objectElementValidators:{glyphs:em,"*":()=>[]}})}function eg(i,r=e._){return eI(e_(i,r))}let ey=e=>eI(el(e)),ex=e=>eI(eh(e)),ev=e=>eI(eu(e)),eb=e=>eI(ec(e)),ew=e=>eI(ed(e)),eT=e=>eI(en(e)),eS=e=>eI(et(e)),eM=e=>eI(er(e)),eE=e=>eI(ea(e)),eA=i=>eI(e.Z(i));function eI(e){return e.slice().sort((e,i)=>e.line&&i.line?e.line-i.line:0)}function eC(i,r){let a=!1;if(r&&r.length)for(let n of r)n instanceof e.A?e.w(n.message):(i.fire(new e.t(Error(n.message))),a=!0);return a}class eP extends e.E{constructor(i,a="flat"){super(),this._transitionable=new e.$(r||(r=new e.a0({anchor:new e.a1(e._.light.anchor),position:new e.a2(e._.light.position),color:new e.a1(e._.light.color),intensity:new e.a1(e._.light.intensity)}))),this.setLight(i,a),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,i,r={}){this._validate(ex,e,r)||(this._transitionable.setTransitionOrValue(e),this.id=i)}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(i,r,a){return(!a||!1!==a.validate)&&eC(this,i.call(eg,e.l({value:r,style:{glyphs:!0,sprite:!0},styleSpec:e._})))}}let eL=class extends e.E{constructor(i,r,a,n){super(),this.scope=a,this._transitionable=new e.$(new e.a0({source:new e.a1(e._.terrain.source),exaggeration:new e.a1(e._.terrain.exaggeration)}),a,n),this._transitionable.setTransitionOrValue(i,n),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=r}get(){return this._transitionable.serialize()}set(e,i){this._transitionable.setTransitionOrValue(e,i)}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}getExaggeration(i){return this._transitioning.possiblyEvaluate(new e.a3(i)).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;let i=this._transitionable._values.exaggeration;if(!i)return null;let r=i.value.expression;if(!r)return null;let a=-1,n=-1,s=1;for(let i of r.zoomStops)(s=r.evaluate(new e.a3(i)))>.01?(a=i,n=-1):n=i;return s<.01&&a>0&&n>a?[a,n]:null}isZoomDependent(){let i=this._transitionable._values.exaggeration;return null!=i&&null!=i.value&&null!=i.value.expression&&i.value.expression instanceof e.a4}};function ek(i,r,a,n){let s=e.a7(45,65,a),[l,h]=eR(i,n),u=1-Math.min(1,Math.exp(-((r-l)/(h-l)*6)));return u*=u*u,(u=Math.min(1,1.00747*u))*s*i.alpha}function eR(e,i){let r=.5/Math.tan(.5*i);return[e.range[0]+r,e.range[1]+r]}function ez(i,r,a,n,s){let l=e.a6.vec3.transformMat4([],[r,a,n],s.mercatorFogMatrix);return ek(i,e.a6.vec3.length(l),s.pitch,s._fov)}function eD(i,r,a,n,s,l,h){let u=Number.MAX_VALUE,c=-Number.MAX_VALUE;for(let i of[[a,n,0],[s,n,0],[s,l,0],[a,l,0]]){let a=e.a6.vec3.transformMat4([],i,r),n=e.a6.vec3.length(a);u=Math.min(u,n),c=Math.max(c,n)}return[ek(i,u,h.pitch,h._fov),ek(i,c,h.pitch,h._fov)]}class eO extends e.E{constructor(i,r,a,n){super();let s=new e.a0({range:new e.a1(e._.fog.range),color:new e.a1(e._.fog.color),"high-color":new e.a1(e._.fog["high-color"]),"space-color":new e.a1(e._.fog["space-color"]),"horizon-blend":new e.a1(e._.fog["horizon-blend"]),"star-intensity":new e.a1(e._.fog["star-intensity"]),"vertical-range":new e.a1(e._.fog["vertical-range"])});this._transitionable=new e.$(s,a,new Map(n)),this.set(i,n),this._transitioning=this._transitionable.untransitioned(),this._transform=r,this.properties=new e.a8(s),this.scope=a}get state(){let i=this._transform,r="globe"===i.projection.name,a=e.a9(i.zoom),n=this.properties.get("range");
213return{range:r?[e.aa(.5,n[0],a),e.aa(3,n[1],a)]:n,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(i,r,a={}){if(this._validate(ew,i,a))return;let n=e.l({},i);for(let i of Object.keys(e._.fog))void 0===n[i]&&(n[i]=e._.fog[i].default);this._options=n,this._transitionable.setTransitionOrValue(this._options,r)}getOpacity(i){if(!this._transform.projection.supportsFog)return 0;let r=this.properties&&this.properties.get("color")||1;return("globe"===this._transform.projection.name?1:e.a7(45,65,i))*r.a}getOpacityAtLatLng(i,r){return this._transform.projection.supportsFog?function(i,r,a){let n=e.a5.fromLngLat(r),s=a.elevation?a.elevation.getAtPointOrZero(n):0;return ez(i,n.x,n.y,s,a)}(this.state,i,r):0}getOpacityForTile(i){if(!this._transform.projection.supportsFog)return[1,1];let r=this._transform.calculateFogTileMatrix(i.toUnwrapped());return eD(this.state,r,0,0,e.ab,e.ab,this._transform)}getOpacityForBounds(e,i,r,a,n){return this._transform.projection.supportsFog?eD(this.state,e,i,r,a,n,this._transform):[1,1]}getFovAdjustedRange(e){return this._transform.projection.supportsFog?eR(this.state,e):[0,1]}isVisibleOnFrustum(i){if(!this._transform.projection.supportsFog)return!1;for(let r of[4,5,6,7]){let a;let n=i.points[r];if(n[2]>=0)a=n;else{let s=i.points[r-4];a=e.ac(s,n,s[2]/(s[2]-n[2]))}if(ez(this.state,a[0],a[1],0,this._transform)>=.05)return!0}return!1}updateConfig(e){this._transitionable.setTransitionOrValue(this._options,new Map(e))}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(i,r,a){return(!a||!1!==a.validate)&&eC(this,i.call(eg,e.l({value:r,style:{glyphs:!0,sprite:!0},styleSpec:e._})))}}class eB extends e.E{constructor(i,r,a,n){super(),this.scope=a,this._options=i,this.properties=new e.a8(r),this._transitionable=new e.$(r,a,new Map(n)),this._transitionable.setTransitionOrValue(i.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(e){this._transitionable.setTransitionOrValue(this._options.properties,new Map(e))}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(e,i){this._options=e,this._transitionable.setTransitionOrValue(e.properties,i)}shadowsEnabled(){return!!this.properties&&!0===this.properties.get("cast-shadows")}}class eF{constructor(e,i,r,a){this.screenBounds=e,this.cameraPoint=i,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=r,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,a)}static createFromScreenPoints(i,r){let a,n;if(i instanceof e.P||"number"==typeof i[0]){let s=e.P.convert(i);a=[s],n=r.isPointAboveHorizon(s)}else{let s=e.P.convert(i[0]),l=e.P.convert(i[1]);a=[s,l],n=e.ae(s,l).every(e=>r.isPointAboveHorizon(e))}return new eF(a,r.getCameraPoint(),n,r)}isPointQuery(){return 1===this.screenBounds.length}bufferedScreenGeometry(i){return e.ae(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],i)}bufferedCameraGeometry(i){let r=this.screenBounds[0],a=1===this.screenBounds.length?this.screenBounds[0].add(new e.P(1,1)):this.screenBounds[1],n=e.ae(r,a,0,!1);return this.cameraPoint.y>a.y&&(this.cameraPoint.x>r.x&&this.cameraPoint.x<a.x?n.splice(3,0,this.cameraPoint):this.cameraPoint.x>=a.x?n[2]=this.cameraPoint:this.cameraPoint.x<=r.x&&(n[3]=this.cameraPoint)),e.af(n,i)}bufferedCameraGeometryGlobe(i){let r=this.screenBounds[0],a=1===this.screenBounds.length?this.screenBounds[0].add(new e.P(1,1)):this.screenBounds[1],n=e.ae(r,a,i),s=this.cameraPoint.clone();switch(3*((s.y>r.y)+(s.y>a.y))+((s.x>r.x)+(s.x>a.x))){case 0:n[0]=s,n[4]=s.clone();break;case 1:n.splice(1,0,s);break;case 2:n[1]=s;break;case 3:n.splice(4,0,s);break;case 5:n.splice(2,0,s);break;case 6:n[3]=s;break;case 7:n.splice(3,0,s);break;case 8:n[2]=s}return n}containsTile(i,r,a,n=0){var s;let l=i.queryPadding/r._pixelsPerMercatorPixel+1,h=a?this._bufferedCameraMercator(l,r):this._bufferedScreenMercator(l,r),u=i.tileID.wrap+(h.unwrapped?n:0),c=h.polygon.map(r=>e.ag(i.tileTransform,r,u));if(!e.ah(c,0,0,e.ab,e.ab))return;u=i.tileID.wrap+(this.screenGeometryMercator.unwrapped?n:0);let d=this.screenGeometryMercator.polygon.map(r=>e.ai(i.tileTransform,r,u)),p=d.map(i=>new e.P(i[0],i[1])),f=r.getFreeCameraOptions().position||new e.a5(0,0,0),m=e.ai(i.tileTransform,f,u),_=d.map(i=>{let r=e.a6.vec3.sub(i,i,m);return e.a6.vec3.normalize(r,r),new e.aj(m,r)}),g=e.ak(i,1,r.zoom)*r._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:p,tilespaceRays:_,bufferedTilespaceGeometry:c,bufferedTilespaceBounds:((s=e.al(c)).min.x=e.ap(s.min.x,0,e.ab),s.min.y=e.ap(s.min.y,0,e.ab),s.max.x=e.ap(s.max.x,
2130,e.ab),s.max.y=e.ap(s.max.y,0,e.ab),s),tile:i,tileID:i.tileID,pixelToTileUnitsFactor:g}}_bufferedScreenMercator(e,i){let r=100*e|0;if(this._screenRaycastCache[r])return this._screenRaycastCache[r];{let a;return a="globe"===i.projection.name?this._projectAndResample(this.bufferedScreenGeometry(e),i):{polygon:this.bufferedScreenGeometry(e).map(e=>i.pointCoordinate3D(e)),unwrapped:!0},this._screenRaycastCache[r]=a,a}}_bufferedCameraMercator(e,i){let r=100*e|0;if(this._cameraRaycastCache[r])return this._cameraRaycastCache[r];{let a;return a="globe"===i.projection.name?this._projectAndResample(this.bufferedCameraGeometryGlobe(e),i):{polygon:this.bufferedCameraGeometry(e).map(e=>i.pointCoordinate3D(e)),unwrapped:!0},this._cameraRaycastCache[r]=a,a}}_projectAndResample(i,r){let a=function(i,r){let a=e.a6.mat4.multiply([],r.pixelMatrix,r.globeMatrix),n=[0,-e.aq,0,1],s=[0,e.aq,0,1],l=[0,0,0,1];e.a6.vec4.transformMat4(n,n,a),e.a6.vec4.transformMat4(s,s,a),e.a6.vec4.transformMat4(l,l,a);let h=new e.P(n[0]/n[3],n[1]/n[3]),u=new e.P(s[0]/s[3],s[1]/s[3]),c=e.an(i,h)&&n[3]<l[3],d=e.an(i,u)&&s[3]<l[3];if(!c&&!d)return null;let p=function(e,i,r){for(let a=1;a<e.length;a++){let n=eV(i.pointCoordinate3D(e[a-1]).x),s=eV(i.pointCoordinate3D(e[a]).x);if(r<0){if(n<s)return{idx:a,t:-n/(s-1-n)}}else if(s<n)return{idx:a,t:(1-n)/(s+1-n)}}return null}(i,r,c?-1:1);if(!p)return null;let{idx:f,t:m}=p,_=f>1?eN(i.slice(0,f),r):[],g=f<i.length?eN(i.slice(f),r):[];_=_.map(i=>new e.P(eV(i.x),i.y)),g=g.map(i=>new e.P(eV(i.x),i.y));let y=[..._];0===y.length&&y.push(g[g.length-1]);let x=e.aa(y[y.length-1].y,(0===g.length?_[0]:g[0]).y,m);return y.push(...c?[new e.P(0,x),new e.P(0,0),new e.P(1,0),new e.P(1,x)]:[new e.P(1,x),new e.P(1,1),new e.P(0,1),new e.P(0,x)]),0===g.length?y.push(_[0]):y.push(...g),{polygon:y.map(i=>new e.a5(i.x,i.y)),unwrapped:!1}}(i,r);if(a)return a;let n=function(i,r){let a=!1,n=-1/0,s=0;for(let e=0;e<i.length-1;e++)i[e].x>n&&(n=i[e].x,s=e);for(let e=0;e<i.length-1;e++){let r=(s+e)%(i.length-1),n=i[r],l=i[r+1];Math.abs(n.x-l.x)>.5&&(n.x<l.x?(n.x+=1,0===r&&(i[i.length-1].x+=1)):(l.x+=1,r+1===i.length-1&&(i[0].x+=1)),a=!0)}let l=e.am(r.center.lng);return a&&l<Math.abs(l-1)&&i.forEach(e=>{e.x-=1}),{polygon:i,unwrapped:a}}(eN(i,r).map(i=>new e.P(eV(i.x),i.y)),r);return{polygon:n.polygon.map(i=>new e.a5(i.x,i.y)),unwrapped:n.unwrapped}}}function eN(i,r){return e.ao(i,e=>{let i=r.pointCoordinate3D(e);e.x=i.x,e.y=i.y},1/256)}function eV(e){return e<0?1+e%1:e%1}function eU(i,r,a,n,s){let l=function(a,n){if(a)return s(a);if(n){if(i.url&&n.tiles&&i.tiles&&delete i.tiles,n.variants){if(!Array.isArray(n.variants))return s(Error("variants must be an array"));for(let i of n.variants){if(null==i||"object"!=typeof i||i.constructor!==Object)return s(Error("variant must be an object"));if(!Array.isArray(i.capabilities))return s(Error("capabilities must be an array"));if(1===i.capabilities.length&&"meshopt"===i.capabilities[0]){n=e.l(n,i);break}}}let a=e.ar(e.l({},n,i),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding","vector_layers","raster_layers","worldview_options","worldview_default","worldview"]);a.tiles=r.canonicalizeTileset(a,i.url),s(null,a)}},h=function(e,i,r){if(!e)return null;if(!i&&!r)return e;r=r||e.worldview_default;let a=Object.values(e.language||{});if(0===a.length)return null;let n=Object.values(e.worldview||{});if(0===n.length)return null;let s=a.every(e=>e===i),l=n.every(e=>e===r);return s&&l?e:i in(e.language_options||{})||r in(e.worldview_options||{})?null:e.language_options&&e.worldview_options?e:null}(i.data,a,n);return h?e.q.frame(()=>l(null,h)):i.url?e.n(r.transformRequest(r.normalizeSourceURL(i.url,null,a,n),e.R.Source),l):e.q.frame(()=>{let{data:e,...r}=i;l(null,r)})}class ej{constructor(i,r,a){this.bounds=e.as.convert(this.validateBounds(i)),this.minzoom=r||0,this.maxzoom=a||24}
213validateBounds(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(i){let r=Math.pow(2,i.z),a=Math.floor(e.am(this.bounds.getWest())*r),n=Math.floor(e.at(this.bounds.getNorth())*r),s=Math.ceil(e.am(this.bounds.getEast())*r),l=Math.ceil(e.at(this.bounds.getSouth())*r);return i.x>=a&&i.x<s&&i.y>=n&&i.y<l}}class eG extends e.E{constructor(i,r,a,n){if(super(),this.id=i,this.dispatcher=a,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,e.l(this,e.ar(r,["url","scheme","tileSize","promoteId"])),this._options=e.l({type:"vector"},r),this._collectResourceTiming=!!r.collectResourceTiming,512!==this.tileSize)throw Error("vector tile sources must have a tileSize of 512");this.setEventedParent(n),this._tileWorkers={},this._deduped=new e.au}load(i){this._loaded=!1,this.fire(new e.x("dataloading",{dataType:"source"}));let r=Array.isArray(this.map._language)?this.map._language.join():this.map._language,a=this.map.getWorldview();this._tileJSONRequest=eU(this._options,this.map._requestManager,r,a,(n,s)=>{if(this._tileJSONRequest=null,this._loaded=!0,n)r&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${r}`),a&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${a}`),this.fire(new e.t(n));else if(s){if(e.l(this,s),this.hasWorldviews=!!s.worldview_options,s.worldview_default&&(this.worldviewDefault=s.worldview_default),s.vector_layers)for(let e of(this.vectorLayers=s.vector_layers,this.vectorLayerIds=[],this.localizableLayerIds=new Set,s.vector_layers))this.vectorLayerIds.push(e.id),s.worldview&&s.worldview[e.source]&&this.localizableLayerIds.add(e.id);s.bounds&&(this.tileBounds=new ej(s.bounds,this.minzoom,this.maxzoom)),O(s.tiles,this.map._requestManager._customAccessToken),this.fire(new e.x("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.x("data",{dataType:"source",sourceDataType:"content"}))}i&&i(n)})}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}reload(){this.cancelTileJSONRequest();let i=e.av(this.id,this.scope);this.load(()=>this.map.style.clearSource(i))}setTiles(e){return this._options.tiles=e,this.reload(),this}setUrl(e){return this.url=e,this._options.url=e,this.reload(),this}onRemove(e){this.cancelTileJSONRequest()}serialize(){return e.l({},this._options)}loadTile(i,r){let a=i.tileID.canonical.url(this.tiles,this.scheme),n=this.map._requestManager.normalizeTileURL(a),s=this.map._requestManager.transformRequest(n,e.R.Tile),l=this.map.style?this.map.style.getLut(this.scope):null,h=l?{image:l.image.clone()}:null,u={request:s,data:void 0,uid:i.uid,tileID:i.tileID,tileZoom:i.tileZoom,zoom:i.tileID.overscaledZ,maxZoom:this.maxzoom,lut:h,tileSize:this.tileSize*i.tileID.overscaleFactor(),type:this.t
213ype,source:this.id,scope:this.scope,pixelRatio:e.q.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:i.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:i.isExtraShadowCaster,tessellationStep:this.map._tessellationStep,scaleFactor:this.map.getScaleFactor()};if(this.hasWorldviews&&e.f(a)&&(u.worldview=this.map.getWorldview()||this.worldviewDefault,u.localizableLayerIds=this.localizableLayerIds),u.request.collectResourceTiming=this._collectResourceTiming,i.actor&&"expired"!==i.state)"loading"===i.state?i.reloadCallback=r:i.request=i.actor.send("reloadTile",u,c.bind(this));else if(i.actor=this._tileWorkers[n]=this._tileWorkers[n]||this.dispatcher.getActor(),this.dispatcher.ready)i.request=i.actor.send("loadTile",u,c.bind(this),void 0,!0);else{let r=e.aw.call({deduped:this._deduped},u,(e,r)=>{e||!r?c.call(this,e):(u.data={cacheControl:r.cacheControl,expires:r.expires,rawData:r.rawData.slice(0)},i.actor&&i.actor.send("loadTile",u,c.bind(this),void 0,!0))},!0);i.request={cancel:r}}function c(a,n){return delete i.request,i.aborted?r(null):a&&404!==a.status?r(a):(n&&n.resourceTiming&&(i.resourceTiming=n.resourceTiming),this.map._refreshExpiredTiles&&n&&i.setExpiryData(n),i.loadVectorData(n,this.map.painter),e.ax(this.dispatcher),r(null),void(i.reloadCallback&&(this.loadTile(i,i.reloadCallback),i.reloadCallback=null)))}}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.actor&&e.actor.send("abortTile",{uid:e.uid,type:this.t
213ype,source:this.id,scope:this.scope})}unloadTile(e,i){e.actor&&e.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id,scope:this.scope}),e.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class eq extends e.E{constructor(i,r,a,n){super(),this.id=i,this.dispatcher=a,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=e.l({type:"raster"},r),e.l(this,e.ar(r,["url","scheme","tileSize"]))}load(i){this._loaded=!1,this.fire(new e.x("dataloading",{dataType:"source"})),this._tileJSONRequest=eU(this._options,this.map._requestManager,null,null,(r,a)=>{this._tileJSONRequest=null,this._loaded=!0,r?this.fire(new e.t(r)):a&&(e.l(this,a),a.raster_layers&&(this.rasterLayers=a.raster_layers,this.rasterLayerIds=this.rasterLayers.map(e=>e.id)),a.bounds&&(this.tileBounds=new ej(a.bounds,this.minzoom,this.maxzoom)),O(a.tiles),this.fire(new e.x("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.x("data",{dataType:"source",sourceDataType:"content"}))),i&&i(r)})}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}reload(){this.cancelTileJSONRequest();let i=e.av(this.id,this.scope);this.load(()=>this.map.style.clearSource(i))}setTiles(e){return this._options.tiles=e,this.reload(),this}setUrl(e){return this.url=e,this._options.url=e,this.reload(),this}onRemove(e){this.cancelTileJSONRequest()}serialize(){return e.l({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(i,r){let a=e.q.devicePixelRatio>=2,n=this.map._requestManager.normalizeTileURL(i.tileID.canonical.url(this.tiles,this.scheme),a,this.tileSize);i.request=e.o(this.map._requestManager.transformRequest(n,e.R.Tile),(a,n,s,l)=>(delete i.request,i.aborted?(i.state="unloaded",r(null)):a?(i.state="errored",r(a)):n?(this.map._refreshExpiredTiles&&i.setExpiryData({cacheControl:s,expires:l}),i.setTexture(n,this.map.painter),i.state="loaded",e.ax(this.dispatcher),void r(null)):r(null)))}abortTile(e,i){e.request&&(e.request.cancel(),delete e.request),i&&i()}unloadTile(i,r){i.texture&&i.texture instanceof e.T?(i.destroy(!0),i.texture&&i.texture instanceof e.T&&this.map.painter.saveTileTexture(i.texture)):i.destroy(),r&&r()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class eW extends eq{constructor(i,r,a,n){super(i,r,a,n),this.type="raster-array",this.maxzoom=22,this._options=e.l({type:"raster-array"},r)}triggerRepaint(e){let i=this.map.painter._terrain,r=this.map.style.getSourceCache(this.id);i&&i.enabled&&r&&i._clearRenderCacheForTile(r.id,e.tileID),this.map.triggerRepaint()}loadTile(i,r){let a=this.map._requestManager.normalizeTileURL(i.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),n=this.map._requestManager.transformRequest(a,e.R.Tile);i.requestParams=n,i.actor||(i.actor=this.dispatcher.getActor()),i.request=i.fetchHeader(void 0,(e,a,n,s)=>{if(delete i.request,i.aborted)return i.state="unloaded",r(null);if(e){if(20===e.code)return;return i.state="errored",r(e)}this.map._refreshExpiredTiles&&i.setExpiryData({cacheControl:n,expires:s}),i.state="empty",r(null)})}unloadTile(i,r){let a=i.texture;a&&a instanceof e.T?(i.destroy(!0),this.map.painter.saveTileTexture(a)):(i.destroy(),i.flushQueues(),i._isHeaderLoaded=!1,delete i._mrt,delete i.textureDescriptor),i.fbo&&(i.fbo.destroy(),delete i.fbo),delete i.request,delete i.requestParams,delete i.neighboringTiles,i.state="unloaded"}prepareTile(i,r,a){i._isHeaderLoaded&&("empty"!==i.state&&(i.state="reloading"),i.fetchBand(r,a,(r,a)=>{if(r)return i.state="errored",this.fire(new e.t(r)),void this.triggerRepaint(i);a&&(i.setTexture(a,this.map.painter),i.state="loaded",this.triggerRepaint(i))}))}getInitialBand(e){if(!this.rasterLayers)return 0;let i=this.rasterLayers.find(({id:i})=>i===e),r=i&&i.fields,a=r&&r.bands&&r.bands;return a?a[0]:0}getTextureDescriptor(i,r,a){if(!i)return;let n=r.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!n)return;let s=null;r instanceof e.aB?s=r.paint.get("raster-array-band"):r instanceof e.aC&&(s=r.paint.get("raster-particle-array-band"));let l=s||this.getInitialBand(n);if(null!=l){if(i.textureDescriptor){if(!i.updateNeeded(n,l)||a)return Object.assign({},i.textureDescriptor,{texture:i.texture})}else this.prepareTile(i,n,l)}}}let e$={vector:eG,raster:eq,"raster-dem":class extends eq{constructor(i,r,a,n){super(i,r,a,n),this.type="raster-dem",this.maxzoom=22,this._options=e.l({type:"raster-dem"},r),this.encoding=r.encoding||"mapbox"}loadTile(i,r){let a=this.map._requestManager.normalizeTileURL(i.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function n(e,a){e&&(i.state="errored",r(e)),a&&(i.dem=a,i.dem.onDeserialize(),i.needsHillshadePrepare=!0,i.needsDEMTextureUpload=!0,i.state="loaded",r(null))}i.request=e.o(this.map._requestManager.transformRequest(a,e.R.Tile),(function(a,s,l,h){if(delete i.request,i.aborted)i.state="unloaded",r(null);else if(a)i.state="errored",r(a);
213else if(s){this.map._refreshExpiredTiles&&i.setExpiryData({cacheControl:l,expires:h});let r=ImageBitmap&&s instanceof ImageBitmap&&e.ay(),a=1-(s.width-e.az(s.width))/2;a<1||i.neighboringTiles||(i.neighboringTiles=this._getNeighboringTiles(i.tileID));let u=r?s:e.q.getImageData(s,a),c={uid:i.uid,coord:i.tileID,source:this.id,scope:this.scope,rawImageData:u,encoding:this.encoding,padding:a};i.actor&&"expired"!==i.state||(i.actor=this.dispatcher.getActor(),i.actor.send("loadDEMTile",c,n.bind(this),void 0,!0))}}).bind(this))}_getNeighboringTiles(i){let r=i.canonical,a=Math.pow(2,r.z),n=(r.x-1+a)%a,s=0===r.x?i.wrap-1:i.wrap,l=(r.x+1+a)%a,h=r.x+1===a?i.wrap+1:i.wrap,u={};return u[new e.aA(i.overscaledZ,s,r.z,n,r.y).key]={backfilled:!1},u[new e.aA(i.overscaledZ,h,r.z,l,r.y).key]={backfilled:!1},r.y>0&&(u[new e.aA(i.overscaledZ,s,r.z,n,r.y-1).key]={backfilled:!1},u[new e.aA(i.overscaledZ,i.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},u[new e.aA(i.overscaledZ,h,r.z,l,r.y-1).key]={backfilled:!1}),r.y+1<a&&(u[new e.aA(i.overscaledZ,s,r.z,n,r.y+1).key]={backfilled:!1},u[new e.aA(i.overscaledZ,i.wrap,r.z,r.x,r.y+1).key]={backfilled:!1},u[new e.aA(i.overscaledZ,h,r.z,l,r.y+1).key]={backfilled:!1}),u}},"raster-array":eW,geojson:class extends e.E{constructor(i,r,a,n){super(),this.id=i,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=a.getActor(),this.setEventedParent(n),this._data=r.data,this._options=e.l({},r),this._collectResourceTiming=r.collectResourceTiming,void 0!==r.maxzoom&&(this.maxzoom=r.maxzoom),void 0!==r.minzoom&&(this.minzoom=r.minzoom),r.type&&(this.type=r.type),r.attribution&&(this.attribution=r.attribution),this.promoteId=r.promoteId;let s=e.ab/this.tileSize;this.workerOptions=e.l({source:this.id,scope:this.scope,cluster:r.cluster||!1,geojsonVtOptions:{buffer:(void 0!==r.buffer?r.buffer:128)*s,tolerance:(void 0!==r.tolerance?r.tolerance:.375)*s,extent:e.ab,maxZoom:this.maxzoom,lineMetrics:r.lineMetrics||!1,generateId:r.generateId||!1},superclusterOptions:{maxZoom:void 0!==r.clusterMaxZoom?r.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,r.clusterMinPoints||2),extent:e.ab,radius:(void 0!==r.clusterRadius?r.clusterRadius:50)*s,log:!1,generateId:r.generateId||!1},clusterProperties:r.clusterProperties,filter:r.filter,dynamic:r.dynamic},r.workerOptions)}onAdd(e){this.map=e,this.setData(this._data)}setData(e){return this._data=e,this._updateWorkerData(),this}updateData(i){if(!this._options.dynamic)return this.fire(new e.t(Error("Can't call updateData on a GeoJSON source with dynamic set to false.")));if("string"!=typeof i&&("Feature"===i.type&&(i={type:"FeatureCollection",features:[i]}),"FeatureCollection"!==i.type))return this.fire(new e.t(Error("Data to update should be a feature or a feature collection.")));if(this._coalesce&&"string"!=typeof i&&"string"!=typeof this._data&&"FeatureCollection"===this._data.type){let e=new Map;for(let i of this._data.features)e.set(i.id,i);for(let r of i.features)e.set(r.id,r);this._data.features=[...e.values()]}else this._data=i;return this._updateWorkerData(!0),this}getClusterExpansionZoom(e,i){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:e,source:this.id,scope:this.scope},i),this}getClusterChildren(e,i){return this.actor.send("geojson.getClusterChildren",{clusterId:e,source:this.id,scope:this.scope},i),this}getClusterLeaves(e,i,r,a){return this.actor.send("geojson.getClusterLeaves",{source:this.id,scope:this.scope,clusterId:e,limit:i,offset:r},a),this}_updateWorkerData(i=!1){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new e.x("dataloading",{dataType:"source"})),this._loaded=!1;let r=e.l({append:i},this.workerOptions);r.scope=this.scope;let a=this._data;"string"==typeof a?(r.request=this.map._requestManager.transformRequest(e.q.resolveURL(a),e.R.Source),r.request.collectResourceTiming=this._collectResourceTiming):r.data=JSON.stringify(a),this._pendingLoad=this.actor.send(`${this.type}.loadData`,r,(r,a)=>{if(this._loaded=!0,this._pendingLoad=null,r)this.fire(new e.t(r));else{let r={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&a&&a.resourceTiming&&a.resourceTiming[this.id]&&(r.resourceTiming=a.resourceTiming[this.id]),i&&(this._partialReload=!0),this.fire(new e.x("data",r)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(i),this._coalesce=!1)})}loaded(){return this._loaded}loadTile(i,r){let a=i.actor?"reloadTile":"loadTile";i.actor=this.actor;let n=this.map.style?this.map.style.getLut(this.scope):null,s=n?{image:n.image.clone()}
213:null,l=this._partialReload,h={type:this.type,uid:i.uid,tileID:i.tileID,tileZoom:i.tileZoom,zoom:i.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:s,scope:this.scope,pixelRatio:e.q.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,scaleFactor:this.map.getScaleFactor(),partial:l};i.request=this.actor.send(a,h,(e,n)=>l&&!n?(i.state="loaded",r(null)):(delete i.request,i.destroy(),i.aborted?r(null):e?r(e):(i.loadVectorData(n,this.map.painter,"reloadTile"===a),r(null))),void 0,"loadTile"===a)}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.aborted=!0}unloadTile(e,i){this.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id,scope:this.scope}),e.destroy()}onRemove(e){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return e.l({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends e.aD{constructor(e,i,r,a){super(e,i,r,a),this.roundZoom=!0,this.type="video",this.options=i}load(){this._loaded=!1;let i=this.options;for(let r of(this.urls=[],i.urls))this.urls.push(this.map._requestManager.transformRequest(r,e.R.Source).url);e.aE(this.urls,(i,r)=>{this._loaded=!0,i?this.fire(new e.t(i)):r&&(this.video=r,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(i){if(this.video){let r=this.video.seekable;i<r.start(0)||i>r.end(0)?this.fire(new e.t(new e.V(`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=i}}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;let i=this.map.painter.context,r=i.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 e.T(i,this.video,r.RGBA8),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(i)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:e.aD,model:class extends e.E{constructor(e,i,r,a){super(),this.id=e,this.type="model",this.models=[],this._loaded=!1,this._options=i}load(){let i=[];for(let r in this._options.models){let a=this._options.models[r],n=e.aG(this.map._requestManager.transformRequest(a.uri,e.R.Model).url).then(i=>{if(!i)return;let n=e.aH(i),s=new e.aI(r,a.position,a.orientation,n);s.computeBoundsAndApplyParent(),this.models.push(s)}).catch(i=>{this.fire(new e.t(Error(`Could not load model ${r} from ${a.uri}: ${i.message}`)))});i.push(n)}return Promise.allSettled(i).then(()=>{this._loaded=!0,this.fire(new e.x("data",{dataType:"source",sourceDataType:"metadata"}))}).catch(i=>{this.fire(new e.t(Error(`Could not load models: ${i.message}`)))})}onAdd(e){this.map=e,this.load()}hasTransition(){return!1}loaded(){return this._loaded}getModels(){return this.models}loadTile(e,i){}serialize(){return{type:"model"}}},"batched-model":class extends e.E{constructor(e,i,r,a){super(),this.type="batched-model",this.id=e,this.tileSize=512,this._options=i,this.tiles=this._options.tiles,this.maxzoom=i.maxzoom||19,this.minzoom=i.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=r,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(a)}onAdd(e){this.map=e,this.load()}load(i){this._loaded=!1,this.fire(new e.x("dataloading",{dataType:"source"}));let r=Array.isArray(this.map._language)?this.map._language.join():this.map._language,a=this.map.getWorldview();this._tileJSONRequest=eU(this._options,this.map._requestManager,r,a,(n,s)=>{this._tileJSONRequest=null,this._loaded=!0,n?(r&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${r}`),a&&2!==a.length&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${a}`),this.fire(new e.t(n))):s&&(e.l(this,s),s.bounds&&(this.tileBounds=new ej(s.bounds,this.minzoom,this.maxzoom)),O(s.tiles,this.map._requestManager._customAccessToken),this.fire(new e.x("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.x("data",{dataType:"source",sourceDataType:"content"}))),i&&i(n)})}hasTransition(){return!1}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loaded(){return this._loaded}loadTile(i,r){let a=this.map._requestManager.normalizeTileURL(i.tileID.canonical.url(this.tiles,this.scheme)),n={request:this.map._requestManager.transformRequest(a,e.R.Tile),data:void 0,uid:i.uid,tileID:i.tileID,tileZoom:i.tileZoom,zoom:i.tileID.overscaledZ,tileSize:this.tileSize*i.tileID.overscaleFactor(),type:this.t
213ype,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:i.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,lut:null,maxZoom:null,promoteId:null,pixelRatio:null,scaleFactor:null};if(i.actor&&"expired"!==i.state){if("loading"===i.state)i.reloadCallback=r;else{if(i.buckets){for(let e of Object.values(i.buckets))e.dirty=!0;return void(i.state="loaded")}i.request=i.actor.send("reloadTile",n,s.bind(this))}}else i.actor=this.dispatcher.getActor(),i.request=i.actor.send("loadTile",n,s.bind(this),void 0,!0);function s(e,a){return i.aborted?r(null):e&&404!==e.status?r(e):(this.map._refreshExpiredTiles&&a&&i.setExpiryData(a),i.loadModelData(a,this.map.painter),i.state="loaded",void r(null))}}serialize(){return e.l({},this._options)}},canvas:class extends e.aD{constructor(i,r,a,n){super(i,r,a,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 e.t(new e.V(`sources.${i}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new e.t(new e.V(`sources.${i}`,null,'missing required property "coordinates"'))),r.animate&&"boolean"!=typeof r.animate&&this.fire(new e.t(new e.V(`sources.${i}`,null,'optional "animate" property must be a boolean value'))),r.canvas?"string"==typeof r.canvas||r.canvas instanceof HTMLCanvasElement||this.fire(new e.t(new e.V(`sources.${i}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new e.t(new e.V(`sources.${i}`,null,'missing required property "canvas"'))),this.options=r,this.animate=void 0===r.animate||r.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new e.t(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(e){this.pause()}prepare(){let i=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,i=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,i=!0),this._hasInvalidDimensions()||0===Object.keys(this.tiles).length)return;let r=this.map.painter.context;this.texture?!i&&!this._playing||this.texture instanceof e.aF||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new e.T(r,this.canvas,r.gl.RGBA8,{premultiply:!0}),this._prepareData(r)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}},custom:class extends e.E{constructor(i,r,a,n){super(),this.id=i,this.type="custom",this._dataType="raster",this._dispatcher=a,this._implementation=r,this.setEventedParent(n),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new e.t(Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new e.t(Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new ej(this._implementation.bounds,this.minzoom,this.maxzoom)),r.update=this._update.bind(this),r.clearTiles=this._clearTiles.bind(this),r.coveringTiles=this._coveringTiles.bind(this),e.l(this,e.ar(r,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return e.ar(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new e.x("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.x("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(i){this.map=i,this._loaded=!1,this.fire(new e.x("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(i),this.load()}onRemove(e){this._implementation.onRemove&&this._implementation.onRemove(e)}hasTile(e){if(this._implementation.hasTile){let{x:i,y:r,z:a}=e.canonical;return this._implementation.hasTile({x:i,y:r,z:a})}return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e,i){let{x:r,y:a,z:n}=e.tileID.canonical,s=new AbortController;e.request=Promise.resolve(this._implementation.loadTile({x:r,y:a,z:n},{signal:s.signal})).then((function(r){return delete e.request,e.aborted?(e.state="unloaded",i(null)):void 0===r?(e.state="errored",i(null)):null===r?(this.loadTileData(e,{width:this.tileSize,height:this.tileSize,data:null}),e.state="loaded",i(null)):r instanceof ImageData||r instanceof HTMLCanvasElement||r instanceof ImageBitmap||r instanceof HTMLImageElement?(this.loadTileData(e,r),e.state="loaded",void i(null)):(e.state="errored",i(Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}).bind(this)).catch(r=>{20!==r.code&&(e.state="errored",i(r))}),e.request.cancel=()=>s.abort()}loadTileData(e,i){e.setTexture(i,this.map.painter)}unloadTile(i,r){if(i.texture&&i.texture instanceof e.T?(i.destroy(!0),i.texture&&i.texture instanceof e.T&&this.map.painter.saveTileTexture(i.texture)):i.destroy(),this._implementation.unloadTile){let{x:e,y:r,z:a}=i.tileID.canonical;this._implementation.unloadTile({x:e,y:r,z:a})}r&&r()}abortTile(e,i){e.request&&e.request.cancel&&(e.request.cancel(),delete e.request),i&&i()}hasTransition(){return!1}_coveringTiles(){return this.map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map(e=>({x:e.canonical.x,y:e.canonical.y,z:e.canonical.z}))}_clearTiles(){let i=e.av(this.id,this.scope);this.map.style.clearSource(i)}
213_update(){this.fire(new e.x("data",{dataType:"source",sourceDataType:"content"}))}}},eH=function(i,r,a,n){let s=new e$[r.type](i,r,a,n);if(s.id!==i)throw Error(`Expected Source id to be ${i} instead of ${s.id}`);return e.aJ(["load","abort","unload","serialize","prepare"],s),s};function eZ(e,i){let r=e.tileID,a=i.tileID;return r.overscaledZ-a.overscaledZ||r.canonical.y-a.canonical.y||r.wrap-a.wrap||r.canonical.x-a.canonical.x}function eX(e,i){let r={};if(!i)return r;for(let a of e){let e=a.layerIds.map(e=>i.getLayer(e)).filter(Boolean);if(0!==e.length)for(let i of(a.layers=e,a.stateDependentLayerIds&&(a.stateDependentLayers=a.stateDependentLayerIds.map(i=>e.filter(e=>e.id===i)[0])),e))r[i.fqid]=a}return r}let eY=new Uint16Array(8184);for(let e=0;e<2046;e++){let i=e+2,r=0,a=0,n=0,s=0,l=0,h=0;for(1&i?n=s=l=32:r=a=h=32;(i>>=1)>1;){let e=r+n>>1,u=a+s>>1;1&i?(n=r,s=a,r=l,a=h):(r=n,a=s,n=l,s=h),l=e,h=u}let u=4*e;eY[u+0]=r,eY[u+1]=a,eY[u+2]=n,eY[u+3]=s}let eJ=new Uint16Array(2178),eK=new Uint8Array(1089),eQ=new Uint16Array(1089);function e0(e){return 0===e?-.03125:.03125*(32===e)}let e1={type:2,extent:e.ab,loadGeometry:()=>[[new e.P(0,0),new e.P(e.ab+1,0),new e.P(e.ab+1,e.ab+1),new e.P(0,e.ab+1),new e.P(0,0)]]};class e2{constructor(i,r,a,n,s){this.tileID=i,this.uid=e.aQ(),this.uses=0,this.tileSize=r,this.tileZoom=a,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=s,n&&n.style&&(this._lastUpdatedBrightness=n.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",n&&n.transform&&(this.projection=n.transform.projection)}registerFadeDuration(i){let r=i+this.timeAdded;r<e.q.now()||this.fadeEndTime&&r<this.fadeEndTime||(this.fadeEndTime=r)}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}get tileTransform(){return this._tileTransform||(this._tileTransform=e.aL(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(i,r,a){if(this.unloadVectorData(),this.state="loaded",i){for(let n in i.featureIndex&&(this.latestFeatureIndex=i.featureIndex,i.rawTileData?(this.latestRawTileData=i.rawTileData,this.latestFeatureIndex.rawTileData=i.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=i.collisionBoxArray,this.buckets=eX(i.buckets,r.style),this.hasSymbolBuckets=!1,this.buckets){let i=this.buckets[n];if(i instanceof e.aS){if(this.hasSymbolBuckets=!0,!a)break;i.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let i in this.buckets){let r=this.buckets[i];if(r instanceof e.aS&&r.hasRTLText){this.hasRTLText=!0,e.aT();break}}for(let e in this.queryPadding=0,this.buckets){let i=this.buckets[e],a=r.style.getOwnLayer(e);if(!a)continue;let n=a.queryRadius(i);this.queryPadding=Math.max(this.queryPadding,n)}i.imageAtlas&&(this.imageAtlas=i.imageAtlas),i.glyphAtlasImage&&(this.glyphAtlasImage=i.glyphAtlasImage),i.lineAtlas&&(this.lineAtlas=i.lineAtlas),this._lastUpdatedBrightness=i.brightness}else this.collisionBoxArray=new e.aR}unloadVectorData(){if(this.hasData()){for(let e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}loadModelData(e,i,r){e&&(e.resourceTiming&&(this.resourceTiming=e.resourceTiming),this.buckets={...this.buckets,...eX(e.buckets,i.style)},e.featureIndex&&(this.latestFeatureIndex=e.featureIndex))}getBucket(e){return this.buckets[e.fqid]}upload(i){for(let e in this.buckets){let r=this.buckets[e];r.uploadPending()&&r.upload(i)}let r=i.gl,a=this.imageAtlas;if(a&&!a.uploaded){let n=!!Object.keys(a.patternPositions).length;this.imageAtlasTexture=new e.T(i,a.image,r.RGBA8,{useMipmap:n}),this.imageAtlas.uploaded=!0}this.glyphAtlasImage&&(this.glyphAtlasTexture=new e.T(i,this.glyphAtlasImage,r.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new e.T(i,this.lineAtlas.image,r.R8),this.lineAtlas.uploaded=!0)}prepare(e,i,r){if(this.imageAtlas&&this.imageAtlasTexture&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture,r),!i||!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData)return;let a=i.style.getBrightness();(this._lastUpdatedBrightness||a)&&(this._lastUpdatedBrightness&&a&&.001>Math.abs(this._lastUpdatedBrightness-a)||(this._lastUpdatedBrightness=a,this.updateBuckets(i)))}queryRenderedFeatures(e,i,r,a,n,s,l,h,u){return this.latestFeatureIndex&&(this.latestFeatureIndex.rawTileData||this.latestFeatureIndex.is3DTile)?this.latestFeatureIndex.query({tileResult:r,pixelPosMatrix:h,transform:l,filter:a,layers:n,availableImages:s,tileTransform:this.tileTransform},e,i):{}}querySourceFeatures(i,r){let a=this.latestFeatureIndex;if(!a||!a.rawTileData)return;let n=a.loadVTLayers(),s=r?r.sourceLayer:"",l=n._geojsonTileLayer||n[s];if(!l)return;let h=e.aU(r&&r.filter),{z:u,x:c,y:d}=this.tileID.canonical,p={z:u,x:c,y:d};for(let r=0;r<l.length;r++){let n=l.feature(r);if(h.needGeometry){let i=e.aV(n,!0);
213if(!h.filter(new e.a3(this.tileID.overscaledZ),i,this.tileID.canonical))continue}else if(!h.filter(new e.a3(this.tileID.overscaledZ),n))continue;let f=a.getId(n,s),m=new e.aW(n,u,c,d,f);m.tile=p,i.push(m)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return!!this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(i){let r=this.expirationTime;if(i.cacheControl){let r=e.aX(i.cacheControl);r["max-age"]&&(this.expirationTime=Date.now()+1e3*r["max-age"])}else i.expires&&(this.expirationTime=new Date(i.expires).getTime());if(this.expirationTime){let e=Date.now(),i=!1;if(this.expirationTime>e)i=!1;else if(r){if(this.expirationTime<r)i=!0;else{let a=this.expirationTime-r;a?this.expirationTime=e+Math.max(a,3e4):i=!0}}else i=!0;i?(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(),0x7fffffff)}refreshFeatureState(e){this.latestFeatureIndex&&(this.latestFeatureIndex.rawTileData||this.latestFeatureIndex.is3DTile)&&e&&this.updateBuckets(e)}updateBuckets(i){if(!this.latestFeatureIndex)return;let r=this.latestFeatureIndex.loadVTLayers(),a=i.style.listImages(),n=i.style.getBrightness();for(let s in this.buckets){if(!i.style.hasLayer(s))continue;let l=this.buckets[s],h=l.layers[0],u=h.sourceLayer||"_geojsonTileLayer",c=r[u],d=i.style.getSourceCache(h.source,h.scope),p={};d&&(p=d._state.getState(u,void 0)),l.update(p,c,a,this.imageAtlas&&this.imageAtlas.patternPositions||{},n),(l instanceof e.aY||l instanceof e.aZ)&&i._terrain&&i._terrain.enabled&&d&&l.programConfigurations.needsUpload&&i._terrain._clearRenderCacheForTile(d.id,this.tileID);let f=i&&i.style&&i.style.getOwnLayer(s);f&&(this.queryPadding=Math.max(this.queryPadding,f.queryRadius(l)))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<e.q.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(i){this.symbolFadeHoldUntil=e.q.now()+i}setTexture(i,r){let a=r.context,n=a.gl;this.texture=this.texture||r.getTileTexture(i.width),this.texture&&this.texture instanceof e.T?this.texture.update(i):(this.texture=new e.T(a,i,n.RGBA8,{useMipmap:!0}),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE))}setDependencies(e,i){let r={};for(let e of i)r[e]=!0;this.dependencies[e]=r}hasDependency(e,i){for(let r of e){let e=this.dependencies[r];if(e){for(let r of i)if(e[r])return!0}}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(i,r){if(!r||"mercator"===r.name||this._tileDebugBuffer)return;let a=e.a_(e1,this.tileID.canonical,this.tileTransform)[0],n=new e.a$,s=new e.b0;for(let e=0;e<a.length;e++){let{x:i,y:r}=a[e];n.emplaceBack(i,r),s.emplaceBack(e)}s.emplaceBack(0),this._tileDebugIndexBuffer=i.createIndexBuffer(s),this._tileDebugBuffer=i.createVertexBuffer(n,e.b1.members),this._tileDebugSegments=e.b2.simpleSegment(0,0,n.length,s.length)}_makeTileBoundsBuffers(i,r){let a,n;if(this._tileBoundsBuffer||!r||"mercator"===r.name)return;let s=e.a_(e1,this.tileID.canonical,this.tileTransform)[0];if(this.isRaster){let i=function(i,r){let a=e.aL(i,r),n=Math.pow(2,i.z);for(let s=0;s<33;s++)for(let l=0;l<33;l++){let h=e.aM((i.x+(l+e0(l))/32)/n),u=e.aN((i.y+(s+e0(s))/32)/n),c=r.project(h,u),d=33*s+l;eJ[2*d+0]=Math.round((c.x*a.scale-a.x)*e.ab),eJ[2*d+1]=Math.round((c.y*a.scale-a.y)*e.ab)}eK.fill(0),eQ.fill(0);for(let e=2045;e>=0;e--){let i=4*e,r=eY[i+0],a=eY[i+1],n=eY[i+2],s=eY[i+3],l=r+n>>1,h=a+s>>1,u=l+h-a,c=h+r-l,d=33*a+r,p=33*s+n,f=33*h+l,m=Math.hypot((eJ[2*d+0]+eJ[2*p+0])/2-eJ[2*f+0],(eJ[2*d+1]+eJ[2*p+1])/2-eJ[2*f+1])>=16;eK[f]=eK[f]||+!!m,e<1022&&(eK[f]=eK[f]||eK[(a+c>>1)*33+(r+u>>1)]||eK[(s+c>>1)*33+(n+u>>1)])}let s=new e.aO,l=new e.aP,h=0;function u(i,r){let a=33*r+i;return 0===eQ[a]&&(s.emplaceBack(eJ[2*a+0],eJ[2*a+1],i*e.ab/32,r*e.ab/32),eQ[a]=++h),eQ[a]-1}function c(e,i,r,a,n,s){let h=e+r>>1,d=i+a>>1;if(Math.abs(e-n)+Math.abs(i-s)>1&&eK[33*d+h])c(n,s,e,i,h,d),c(r,a,n,s,h,d);
213else{let h=u(e,i),c=u(r,a),d=u(n,s);l.emplaceBack(h,c,d)}}return c(0,0,32,32,32,0),c(32,32,0,0,0,32),{vertices:s,indices:l}}(this.tileID.canonical,r);a=i.vertices,n=i.indices}else{for(let{x:i,y:r}of(a=new e.aO,n=new e.aP,s))a.emplaceBack(i,r,0,0);let i=e.b3(a.int16,void 0,4);for(let e=0;e<i.length;e+=3)n.emplaceBack(i[e],i[e+1],i[e+2])}this._tileBoundsBuffer=i.createVertexBuffer(a,e.b4.members),this._tileBoundsIndexBuffer=i.createIndexBuffer(n),this._tileBoundsSegments=e.b2.simpleSegment(0,0,a.length,n.length)}_makeGlobeTileDebugBuffers(i,r){let a;let n=r.projection;if(!n||"globe"!==n.name||r.freezeTileCoverage)return;let s=this.tileID.canonical,l=e.b5(s,r),h=e.b6(l),u=e.a9(r.zoom);u>0&&(a=e.a6.mat4.invert(new Float64Array(16),r.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(i,s,r,h,a,u),this._makeGlobeTileDebugTextBuffer(i,s,r,h,a,u)}_globePoint(i,r,a,n,s,l,h){let u=e.b7(i,r,a);if(l){let s=1<<a.z,c=e.am(n.center.lng),d=e.at(n.center.lat),p=(a.x+.5)/s-c,f=0;p>.5?f=-1:p<-.5&&(f=1);let m=(i/e.ab+a.x)/s+f,_=(r/e.ab+a.y)/s;m=(m-c)*n._pixelsPerMercatorPixel+c,_=(_-d)*n._pixelsPerMercatorPixel+d;let g=[m*n.worldSize,_*n.worldSize,0];e.a6.vec3.transformMat4(g,g,l),u=e.b8(u,g,h)}return e.a6.vec3.transformMat4(u,u,s)}_makeGlobeTileDebugBorderBuffer(i,r,a,n,s,l){let h=new e.a$,u=new e.b0,c=new e.b9,d=(e,i,d,p,f)=>{let m=(d-e)/(f-1),_=(p-i)/(f-1),g=h.length;for(let d=0;d<f;d++){let p=e+d*m,f=i+d*_;h.emplaceBack(p,f);let y=this._globePoint(p,f,r,a,n,s,l);c.emplaceBack(y[0],y[1],y[2]),u.emplaceBack(g+d)}},p=e.ab;d(0,0,p,0,16),d(p,0,p,p,16),d(p,p,0,p,16),d(0,p,0,0,16),this._tileDebugIndexBuffer=i.createIndexBuffer(u),this._tileDebugBuffer=i.createVertexBuffer(h,e.b1.members),this._globeTileDebugBorderBuffer=i.createVertexBuffer(c,e.ba.members),this._tileDebugSegments=e.b2.simpleSegment(0,0,h.length,u.length)}_makeGlobeTileDebugTextBuffer(i,r,a,n,s,l){let h=e.ab/4,u=new e.a$,c=new e.aP,d=new e.b9;c.reserve(32),u.reserve(25),d.reserve(25);let p=(e,i)=>25*e+i;for(let e=0;e<25;e++){let i=e*h;for(let e=0;e<25;e++){let c=e*h;u.emplaceBack(c,i);let p=this._globePoint(c,i,r,a,n,s,l);d.emplaceBack(p[0],p[1],p[2])}}for(let e=0;e<4;e++)for(let i=0;i<4;i++){let r=p(e,i),a=p(e,i+1),n=p(e+1,i),s=p(e+1,i+1);c.emplaceBack(r,a,n),c.emplaceBack(n,a,s)}this._tileDebugTextIndexBuffer=i.createIndexBuffer(c),this._tileDebugTextBuffer=i.createVertexBuffer(u,e.b1.members),this._globeTileDebugTextBuffer=i.createVertexBuffer(d,e.ba.members),this._tileDebugTextSegments=e.b2.simpleSegment(0,0,25,32)}destroy(i=!1){for(let e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&(this.imageAtlasTexture.destroy(),delete this.imageAtlasTexture),this.glyphAtlasTexture&&(this.glyphAtlasTexture.destroy(),delete this.glyphAtlasTexture),this.lineAtlasTexture&&(this.lineAtlasTexture.destroy(),delete this.lineAtlasTexture),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),!i&&this.texture&&this.texture instanceof e.T&&(this.texture.destroy(),delete this.texture),this.hillshadeFBO&&(this.hillshadeFBO.destroy(),delete this.hillshadeFBO),this.dem&&delete this.dem,this.neighboringTiles&&delete this.neighboringTiles,this.demTexture&&(this.demTexture.destroy(),delete this.demTexture),this.rasterParticleState&&(this.rasterParticleState.destroy(),delete this.rasterParticleState),this.latestFeatureIndex=null,this.state="unloaded"}}e.bb.setPbf(e.bc);class e3 extends e2{constructor(e,i,r,a,n){super(e,i,r,a,n),this._workQueue=[],this._fetchQueue=[],this._isHeaderLoaded=!1}setTexture(i,r){let a=r.context,n=a.gl;this.texture=this.texture||r.getTileTexture(i.width),this.texture&&this.texture instanceof e.T?this.texture.update(i,{premultiply:!1}):this.texture=new e.T(a,i,n.RGBA8,{premultiply:!1})}flushQueues(){for(;this._workQueue.length;)this._workQueue.pop()();for(;this._fetchQueue.length;)this._fetchQueue.pop()()}fetchHeader(i=16384,r){let a=this._mrt=new e.bb(30),n=Object.assign({}
213,this.requestParams,{headers:{Range:"bytes=0-"+(i-1)}});return this.entireBuffer=null,this.request=e.bd(n,(e,n,s,l)=>{if(e)r(e);else try{let e=a.getHeaderLength(n);if(e>i)return void(this.request=this.fetchHeader(e,r));a.parseHeader(n),this._isHeaderLoaded=!0;let h=0;for(let e of Object.values(a.layers))h=Math.max(h,e.dataIndex[e.dataIndex.length-1].last_byte);n.byteLength>=h&&(this.entireBuffer=n),r(null,this.entireBuffer||n,s,l)}catch(e){r(e)}}),this.request}fetchBand(i,r,a){let n;let s=this._mrt;if(!this._isHeaderLoaded||!s)return void a(Error("Tile header is not ready"));let l=this.actor;if(!l)return void a(Error("Can't fetch tile band without an actor"));let h=(e,s)=>{n.complete(e,s),e?a(e):(this.updateTextureDescriptor(i,r),a(null,this.textureDescriptor&&this.textureDescriptor.img))},u=(e,i)=>{if(e)return a(e);let r=l.send("decodeRasterArray",{buffer:i,task:n},h,void 0,!0);this._workQueue.push(()=>{r&&r.cancel(),n.cancel()})},c=s.getLayer(i);if(!c)return void a(Error(`Unknown sourceLayer "${i}"`));if(c.hasDataForBand(r))return this.updateTextureDescriptor(i,r),void a(null,this.textureDescriptor?this.textureDescriptor.img:null);let d=c.getDataRange([r]);if((n=s.createDecodingTask(d))&&!n.tasks.length)a(null);else if(this.flushQueues(),this.entireBuffer)u(null,this.entireBuffer.slice(d.firstByte,d.lastByte+1));else{let i=Object.assign({},this.requestParams,{headers:{Range:`bytes=${d.firstByte}-${d.lastByte}`}}),r=e.bd(i,u);this._fetchQueue.push(()=>{r.cancel(),n.cancel()})}}updateNeeded(e,i){return(!this.textureDescriptor||this.textureDescriptor.band!==i||this.textureDescriptor.layer!==e)&&"errored"!==this.state}updateTextureDescriptor(i,r){if(!this._mrt)return;let a=this._mrt.getLayer(i);if(!a||!a.hasBand(r)||!a.hasDataForBand(r))return;let{bytes:n,tileSize:s,buffer:l,offset:h,scale:u}=a.getBandView(r),c=s+2*l,d={data:n,width:c,height:c},p=this.texture;p&&p instanceof e.T&&p.update(d,{premultiply:!1}),this.textureDescriptor={layer:i,band:r,img:d,buffer:l,offset:h,tileSize:s,format:a.pixelFormat,mix:[u,256*u,65536*u,0x1000000*u]}}}class e4{constructor(e,i){this.max=e,this.onRemove=i,this.reset()}reset(){for(let e in this.data)for(let i of this.data[e])i.timeout&&clearTimeout(i.timeout),this.onRemove(i.value);return this.data={},this.order=[],this}add(e,i,r){let a=e.wrapped().key;void 0===this.data[a]&&(this.data[a]=[]);let n={value:i,timeout:void 0};if(void 0!==r&&(n.timeout=setTimeout(()=>{this.remove(e,n)},r)),this.data[a].push(n),this.order.push(a),this.order.length>this.max){let 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){let i=this.data[e].shift();return i.timeout&&clearTimeout(i.timeout),0===this.data[e].length&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),i.value}getByKey(e){let i=this.data[e];return i?i[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,i){if(!this.has(e))return this;let r=e.wrapped().key,a=void 0===i?0:this.data[r].indexOf(i),n=this.data[r][a];return this.data[r].splice(a,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;){let e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(e){let i=[];for(let r in this.data)for(let a of this.data[r])e(a.value)||i.push(a);for(let e of i)this.remove(e.value.tileID,e)}}class e5{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(i,r,a){let n=String(r);if(this.stateChanges[i]=this.stateChanges[i]||{},this.stateChanges[i][n]=this.stateChanges[i][n]||{},e.l(this.stateChanges[i][n],a),null===this.deletedStates[i])for(let e in this.deletedStates[i]={},this.state[i])e!==n&&(this.deletedStates[i][e]=null);else if(this.deletedStates[i]&&null===this.deletedStates[i][n])for(let e in this.deletedStates[i][n]={},this.state[i][n])a[e]||(this.deletedStates[i][n][e]=null);else for(let e in a)this.deletedStates[i]&&this.deletedStates[i][n]&&null===this.deletedStates[i][n][e]&&delete this.deletedStates[i][n][e]}removeFeatureState(e,i,r){if(null===this.deletedStates[e])return;let a=String(i);if(this.deletedStates[e]=this.deletedStates[e]||{},r&&void 0!==i)null!==this.deletedStates[e][a]&&(this.deletedStates[e][a]=this.deletedStates[e][a]||{},this.deletedStates[e][a][r]=null);else if(void 0!==i){if(this.stateChanges[e]&&this.stateChanges[e][a])for(r in this.deletedStates[e][a]={},this.stateChanges[e][a])this.deletedStates[e][a][r]=null;else this.deletedStates[e][a]=null}else this.deletedStates[e]=null}getState(i,r){let a=this.state[i]||{},n=this.stateChanges[i]||{},s=this.deletedStates[i];if(null===s)return{};if(void 0!==r){let i=String(r),l=e.l({},a[i],n[i]);if(s){let e=s[r];if(null===e)return{};for(let i in e)delete l[i]}return l}let l=e.l({},a,n);if(s)for(let e in s)delete l[e];return l}initializeTileState(e,i){e.refreshFeatureState(i)}coalesceChanges(i,r){let a={};for(let i in this.stateChanges){this.state[i]=this.state[i]||{};let r={};for(let a in this.stateChanges[i])this.state[i][a]||(this.state[i][a]={}),e.l(this.state[i][a],this.stateChanges[i][a]),r[a]=this.state[i][a];a[i]=r}for(let i in this.deletedStates){this.state[i]=this.state[i]||{};let r={};if(null===this.deletedStates[i])for(let e in this.state[i])r[e]={},this.state[i][e]={};else for(let e in this.deletedStates[i]){if(null===this.deletedStates[i][e])this.state[i][e]={};else if(this.state[i][e])for(let r of Object.keys(this.deletedStates[i][e]))delete this.state[i][e][r];r[e]=this.state[i][e]}a[i]=a[i]||{},e.l(a[i],r)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(a).length)for(let e in i)i[e].refreshFeatureState(r)}}class e6 extends e.E{constructor(e,i,r){super(),this.id=e,this._onlySymbols=r,i.on("data",e=>{"source"===e.dataType&&"metadata"===e.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===e.dataType&&"content"===e.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform))}),i.on("error",()=>{this._sourceErrored=!0}),this._source=i,this._tiles={},this._cache=new e4(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={}
213,this._minTileCacheSize=i.minTileCacheSize,this._maxTileCacheSize=i.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new e5,this._isRaster="raster"===this._source.type||"raster-dem"===this._source.type||"raster-array"===this._source.type||"custom"===this._source.type&&"raster"===this._source._dataType}onAdd(e){this.map=e,this._minTileCacheSize=void 0===this._minTileCacheSize&&e?e._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=void 0===this._maxTileCacheSize&&e?e._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(let e in this._tiles){let i=this._tiles[e];if("loaded"!==i.state&&"errored"!==i.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(e,i){return e.isSymbolTile=this._onlySymbols,e.isExtraShadowCaster=this._shadowCasterTiles[e.tileID.key],this._source.loadTile(e,i)}_unloadTile(e){if(this._source.unloadTile)return this._source.unloadTile(e)}_abortTile(e){if(this._source.abortTile)return this._source.abortTile(e)}serialize(){return this._source.serialize()}prepare(e){for(let i in this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null),this._tiles){let r=this._tiles[i];r.upload(e),r.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return e.be(this._tiles).map(e=>e.tileID).sort(e8).map(e=>e.key)}getRenderableIds(i,r){let a=[];for(let e in this._tiles)this._isIdRenderable(+e,i,r)&&a.push(this._tiles[e]);return i?a.sort((i,r)=>{let a=i.tileID,n=r.tileID,s=new e.P(a.canonical.x,a.canonical.y)._rotate(this.transform.angle),l=new e.P(n.canonical.x,n.canonical.y)._rotate(this.transform.angle);return a.overscaledZ-n.overscaledZ||l.y-s.y||l.x-s.x}).map(e=>e.tileID.key):a.map(e=>e.tileID).sort(e8).map(e=>e.key)}hasRenderableParent(e){let i=this.findLoadedParent(e,0);return!!i&&this._isIdRenderable(i.tileID.key)}_isIdRenderable(e,i,r){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(i||!this._tiles[e].holdingForFade())&&(r||!this._shadowCasterTiles[e])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else for(let e in this._cache.reset(),this._tiles)"errored"!==this._tiles[e].state&&this._reloadTile(+e,"reloading")}_reloadTile(e,i){let r=this._tiles[e];r&&("loading"!==r.state&&(r.state=i),this._loadTile(r,this._tileLoaded.bind(this,r,e,i)))}_tileLoaded(i,r,a,n){if(n){if(i.state="errored",404!==n.status)this._source.fire(new e.t(n,{tile:i}));else{if(this._source.fire(new e.x("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:i})),!(i.tileID.key in this._loadedParentTiles))return;if("raster-dem"===this._source.type&&this.usedForTerrain&&this.map.painter.terrain){let e=this.map.painter.terrain;this.update(this.transform,e.getScaledDemTileSize(),!0),e.resetTileLookupCache(this.id)}else this.update(this.transform)}}else i.timeAdded=e.q.now(),"expired"===a&&(i.refreshedUponExpiration=!0),this._setTileReloadTimer(r,i),"raster-dem"===this._source.type&&i.dem&&this._backfillDEM(i),this._state.initializeTileState(i,this.map?this.map.painter:null),this._source.fire(new e.x("data",{dataType:"source",tile:i,coord:i.tileID,sourceCacheId:this.id}))}_backfillDEM(e){let i=this.getRenderableIds();for(let a=0;a<i.length;a++){let n=i[a];if(e.neighboringTiles&&e.neighboringTiles[n]){let i=this.getTileByID(n);r(e,i),r(i,e)}}function r(e,i){if(!e.dem||e.dem.borderReady)return;e.needsHillshadePrepare=!0,e.needsDEMTextureUpload=!0;let r=i.tileID.canonical.x-e.tileID.canonical.x,a=i.tileID.canonical.y-e.tileID.canonical.y,n=Math.pow(2,e.tileID.canonical.z),s=i.tileID.key;0===r&&0===a||Math.abs(a)>1||(Math.abs(r)>1&&(1===Math.abs(r+n)?r+=n:1===Math.abs(r-n)&&(r-=n)),i.dem&&e.dem&&(e.dem.backfillBorder(i.dem,r,a),e.neighboringTiles&&e.neighboringTiles[s]&&(e.neighboringTiles[s].backfilled=!0)))}}
213getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,i,r,a){for(let n in this._tiles){let s=this._tiles[n];if(a[n]||!s.hasData()||s.tileID.overscaledZ<=i||s.tileID.overscaledZ>r)continue;let l=s.tileID;for(;s&&s.tileID.overscaledZ>i+1;){let e=s.tileID.scaledTo(s.tileID.overscaledZ-1);(s=this._tiles[e.key])&&s.hasData()&&(l=e)}let h=l;for(;h.overscaledZ>i;)if(e[(h=h.scaledTo(h.overscaledZ-1)).key]){a[l.key]=l;break}}}findLoadedParent(e,i){if(e.key in this._loadedParentTiles){let r=this._loadedParentTiles[e.key];return r&&r.tileID.overscaledZ>=i?r:null}for(let r=e.overscaledZ-1;r>=i;r--){let i=e.scaledTo(r),a=this._getLoadedTile(i);if(a)return a}}_getLoadedTile(e){let i=this._tiles[e.key];return i&&i.hasData()?i:this._cache.getByKey(this._source.reparseOverscaled?e.wrapped().key:e.canonical.key)}updateCacheSize(e,i){i=i||this._source.tileSize;let r=Math.floor((Math.ceil(e.width/i)+1)*(Math.ceil(e.height/i)+1)*5),a="number"==typeof this._minTileCacheSize?Math.max(this._minTileCacheSize,r):r,n="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,a):a;this._cache.setMaxSize(n)}handleWrapJump(e){let i=Math.round((e-(void 0===this._prevLng?e:this._prevLng))/360);if(this._prevLng=e,i){let e={};for(let r in this._tiles){let a=this._tiles[r];a.tileID=a.tileID.unwrapTo(a.tileID.wrap+i),e[a.tileID.key]=a}for(let i in this._tiles=e,this._timers)clearTimeout(this._timers[i]),delete this._timers[i];for(let e in this._tiles)this._setTileReloadTimer(+e,this._tiles[e])}}update(i,r,a,n){if(this.transform=i,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!a)return;this.updateCacheSize(i,r),"globe"!==this.transform.projection.name&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};let s="batched-model"===this._source.type,l,h=this._source.maxzoom,u=this.map&&this.map.painter?this.map.painter._terrain:null;if(u&&u.sourceCache===this&&u.attenuationRange()){let e=Math.floor(u.attenuationRange()[0])-Math.log2(u.getDemUpscale());h>e&&(h=e)}if(this.used||this.usedForTerrain){if(this._source.tileID)l=i.getVisibleUnwrappedCoordinates(this._source.tileID).map(i=>new e.aA(i.canonical.z,i.wrap,i.canonical.z,i.canonical.x,i.canonical.y));else if(0!==this.tileCoverLift){let n=i.clone();n.tileCoverLift=this.tileCoverLift,l=n.coveringTiles({tileSize:r||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:h,roundZoom:this._source.roundZoom&&!a,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:s}),this._source.minzoom<=1&&"globe"===i.projection.name&&(l.push(new e.aA(1,0,1,0,0)),l.push(new e.aA(1,0,1,1,0)),l.push(new e.aA(1,0,1,0,1)),l.push(new e.aA(1,0,1,1,1)))}else if(l=i.coveringTiles({tileSize:r||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:h,roundZoom:this._source.roundZoom&&!a,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:s}),this._source.hasTile){let e=this._source.hasTile.bind(this._source);l=l.filter(i=>e(i))}}else l=[];
213if(l.length>0&&this.castsShadows&&n&&"globe"!==this.transform.projection.name&&!this.usedForTerrain&&!e9(this._source.type)){let e=Math.min(i.coveringZoomLevel({tileSize:r||this._source.tileSize,roundZoom:this._source.roundZoom&&!a}),this._source.maxzoom);if(s)for(let r of i.extendTileCover(l,e))l.push(r);else for(let r of i.extendTileCover(l,e,n))this._shadowCasterTiles[r.key]=!0,l.push(r)}let c=this._updateRetainedTiles(l);if(e9(this._source.type)&&0!==l.length){let i={},r={};for(let a of Object.keys(c)){let n=c[a],s=this._tiles[a];if(!s||s.fadeEndTime&&s.fadeEndTime<=e.q.now())continue;let l=this.findLoadedParent(n,Math.max(n.overscaledZ-e6.maxOverzooming,this._source.minzoom));l&&(this._addTile(l.tileID),i[l.tileID.key]=l.tileID),r[a]=n}let a=l[l.length-1].overscaledZ;for(let e in this._tiles){let i=this._tiles[e];if(c[e]||!i.hasData())continue;let n=i.tileID;for(;n.overscaledZ>a;){n=n.scaledTo(n.overscaledZ-1);let a=this._tiles[n.key];if(a&&a.hasData()&&r[n.key]){c[e]=i.tileID;break}}}for(let e in i)c[e]||(this._coveredTiles[e]=!0,c[e]=i[e])}for(let e in c)this._tiles[e].clearFadeHold();for(let i of e.bf(this._tiles,c)){let e=this._tiles[i];e.hasSymbolBuckets&&!e.holdingForFade()?e.setHoldDuration(this.map._fadeDuration):e.hasSymbolBuckets&&!e.symbolFadeFinished()||this._removeTile(+i)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(let e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(+e)}_updateRetainedTiles(e){let i={};if(0===e.length)return i;let r={},a=e.reduce((e,i)=>Math.min(e,i.overscaledZ),1/0),n=e[0].overscaledZ,s=Math.max(n-e6.maxOverzooming,this._source.minzoom),l=Math.max(n+e6.maxUnderzooming,this._source.minzoom),h={};for(let r of e){let e=this._addTile(r);i[r.key]=r,e.hasData()||a<this._source.maxzoom&&(h[r.key]=r)}for(let n of(this._retainLoadedChildren(h,a,l,i),e)){let e=this._tiles[n.key];if(e.hasData())continue;if(n.canonical.z>=this._source.maxzoom){let e=n.children(this._source.maxzoom)[0],r=this.getTile(e);if(r&&r.hasData()){i[e.key]=e;continue}}else{let e=n.children(this._source.maxzoom);if(i[e[0].key]&&i[e[1].key]&&i[e[2].key]&&i[e[3].key])continue}let a=e.wasRequested();for(let l=n.overscaledZ-1;l>=s;--l){let s=n.scaledTo(l);if(r[s.key]||(r[s.key]=!0,(e=this.getTile(s))||!a||(e=this._addTile(s)),e&&(i[s.key]=s,a=e.wasRequested(),e.hasData())))break}}return i}_updateLoadedParentTileCache(){for(let e in this._loadedParentTiles={},this._tiles){let i=[],r,a=this._tiles[e].tileID;for(;a.overscaledZ>0;){if(a.key in this._loadedParentTiles){r=this._loadedParentTiles[a.key];break}i.push(a.key);let e=a.scaledTo(a.overscaledZ-1);if(r=this._getLoadedTile(e))break;a=e}for(let e of i)this._loadedParentTiles[e]=r}}_addTile(i){let r=this._tiles[i.key];if(r)return!0!==r.isExtraShadowCaster||this._shadowCasterTiles[i.key]||this._reloadTile(i.key,"reloading"),r;(r=this._cache.getAndRemove(i))&&(this._setTileReloadTimer(i.key,r),r.tileID=i,this._state.initializeTileState(r,this.map?this.map.painter:null),this._cacheTimers[i.key]&&(clearTimeout(this._cacheTimers[i.key]),delete this._cacheTimers[i.key],this._setTileReloadTimer(i.key,r)));let a=!!r;if(!a){let e=this.map?this.map.painter:null,a=this._source.tileSize*i.overscaleFactor();r="raster-array"===this._source.type?new e3(i,a,this.transform.tileZoom,e,this._isRaster):new e2(i,a,this.transform.tileZoom,e,this._isRaster),this._loadTile(r,this._tileLoaded.bind(this,r,i.key,r.state))}return r?(r.uses++,this._tiles[i.key]=r,a||this._source.fire(new e.x("dataloading",{tile:r,coord:r.tileID,dataType:"source"})),r):null}_setTileReloadTimer(e,i){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);let r=i.getExpiryTimeout();r&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},r))}_removeTile(e){let i=this._tiles[e];i&&(i.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),i.uses>0||(i.hasData()&&"reloading"!==i.state||"empty"===i.state?this._cache.add(i.tileID,i,i.getExpiryTimeout()):(i.aborted=!0,this._abortTile(i),this._unloadTile(i))))}clearTiles(){for(let e in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(+e);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id
213)}tilesIn(i,r,a){let n=[],s=this.transform;if(!s)return n;let l="globe"===s.projection.name,h=e.am(s.center.lng);for(let u in this._tiles){let c;let d=this._tiles[u];if(a&&d.clearQueryDebugViz(),!d.holdingForFade()){if(l){let i=d.tileID.canonical;if(0===i.z){let r=[Math.abs(e.ap(h,...e7(i,-1))-h),Math.abs(e.ap(h,...e7(i,1))-h)];c=[0,2*r.indexOf(Math.min(...r))-1]}else{let r=[Math.abs(e.ap(h,...e7(i,-1))-h),Math.abs(e.ap(h,...e7(i,0))-h),Math.abs(e.ap(h,...e7(i,1))-h)];c=[r.indexOf(Math.min(...r))-1]}}else c=[0];for(let e of c){let a=i.containsTile(d,s,r,e);a&&n.push(a)}}}return n}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(e){return this._getRenderableCoordinates(e)}_getRenderableCoordinates(e,i){let r=this.getRenderableIds(e,i).map(e=>this._tiles[e].tileID),a="globe"===this.transform.projection.name;for(let e of r)e.projMatrix=this.transform.calculateProjMatrix(e.toUnwrapped()),e.expandedProjMatrix=a?this.transform.calculateProjMatrix(e.toUnwrapped(),!1,!0):e.projMatrix;return r}sortCoordinatesByDistance(e){let i=e.slice(),r=this.transform._camera.position,a=this.transform._camera.forward(),n={};for(let e of i){let i=1/(1<<e.canonical.z);n[e.key]=((e.canonical.x+.5)*i+e.wrap-r[0])*a[0]+((e.canonical.y+.5)*i-r[1])*a[1]-r[2]*a[2]}return i.sort((e,i)=>n[e.key]-n[i.key]),i}hasTransition(){if(this._source.hasTransition())return!0;if(e9(this._source.type))for(let i in this._tiles){let r=this._tiles[i];if(void 0!==r.fadeEndTime&&r.fadeEndTime>=e.q.now())return!0}return!1}setFeatureState(e,i,r){this._state.updateState(e=e||"_geojsonTileLayer",i,r)}removeFeatureState(e,i,r){this._state.removeFeatureState(e=e||"_geojsonTileLayer",i,r)}getFeatureState(e,i){return this._state.getState(e=e||"_geojsonTileLayer",i)}setDependencies(e,i,r){let a=this._tiles[e];a&&a.setDependencies(i,r)}reloadTilesForDependencies(e,i){for(let r in this._tiles)this._tiles[r].hasDependency(e,i)&&this._reloadTile(+r,"reloading");this._cache.filter(r=>!r.hasDependency(e,i))}_preloadTiles(i,r){if(!this._sourceLoaded){let e=()=>{this._sourceLoaded&&(this._source.off("data",e),this._preloadTiles(i,r))};return void this._source.on("data",e)}let a=new Map,n=Array.isArray(i)?i:[i],s=this.map.painter.terrain,l=this.usedForTerrain&&s?s.getScaledDemTileSize():this._source.tileSize;for(let e of n){for(let i of e.coveringTiles({tileSize:l,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}))a.set(i.key,i);this.usedForTerrain&&e.updateElevation(!1)}let h=Array.from(a.values());e.bg(h,(e,i)=>{let r=new e2(e,this._source.tileSize*e.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster);this._loadTile(r,e=>{"raster-dem"===this._source.type&&r.dem&&this._backfillDEM(r),i(e,r)})},r)}}function e8(e,i){let r=Math.abs(2*e.wrap)-+(e.wrap<0),a=Math.abs(2*i.wrap)-+(i.wrap<0);return e.overscaledZ-i.overscaledZ||a-r||i.canonical.y-e.canonical.y||i.canonical.x-e.canonical.x}function e9(e){return"raster"===e||"image"===e||"video"===e||"custom"===e}function e7(e,i){let r=1<<e.z;return[e.x/r+i,(e.x+1)/r+i]}e6.maxOverzooming=10,e6.maxUnderzooming=3;class te{constructor(e){this.style=e,this.layersGotHidden=!1,this.layers=[]}processLayersChanged(){for(let e in this.layers=[],this.style._mergedLayers){let i=this.style._mergedLayers[e];if("fill-extrusion"===i.type)this.layers.push({layer:i,visible:!1,visibilityChanged:!1});else if("model"===i.type){let e=this.style.getLayerSource(i);e&&"batched-model"===e.type&&this.layers.push({layer:i,visible:!1,visibilityChanged:!1})}}}onNewFrame(e){for(let i of(this.layersGotHidden=!1,this.layers)){let r=i.layer,a=!1;"fill-extrusion"===r.type?a=!r.isHidden(e)&&r.paint.get("fill-extrusion-opacity")>0:"model"===r.type&&(a=!r.isHidden(e)&&r.paint.get("model-opacity")>0),this.layersGotHidden=this.layersGotHidden||!a&&i.visible,i.visible=a}}updateZOffset(e,i){for(let e of(this.currentBuildingBuckets=[],this.layers)){let r=e.layer,a=this.style.getLayerSourceCache(r),n=1;"fill-extrusion"===r.type&&(n=e.visible?r.paint.get("fill-extrusion-vertical-scale"):0);let s=a?a.getTile(i):null;if(!s&&a&&i.canonical.z>a.getSource().minzoom){let e=i.scaledTo(Math.min(a.getSource().maxzoom,i.overscaledZ-1));for(;e.overscaledZ>=a.getSource().minzoom&&!(s=a.getTile(e))&&0!==e.overscaledZ;)e=e.scaledTo(e.overscaledZ-1)}this.currentBuildingBuckets.push({bucket:s?s.getBucket(r):null,tileID:s?s.tileID:i,verticalScale:n})}e.hasAnyZOffset=!1;let r=!1;for(let a=0;a<e.symbolInstances.length;a++){let n=e.symbolInstances.get(a),s=n.zOffset,l=this._getHeightAtTileOffset(i,n.tileAnchorX,n.tileAnchorY);n.zOffset=l!==Number.NEGATIVE_INFINITY?l:s,r||s===n.zOffset||(r=!0),e.hasAnyZOffset||0===n.zOffset||(e.hasAnyZOffset=!0)}r&&(e.zOffsetBuffersNeedUpload=!0,e.zOffsetSortDirty=!0)}_mapCoordToOverlappingTile(i,r,a,n){let s=r,l=a;if(i.canonical.z!==n.canonical.z){let h=n.canonical,u=1/(1<<i.canonical.z-h.z);s=(r+i.canonical.x*e.ab)*u-h.x*e.ab|0,l=(a+i.canonical.y*e.ab)*u-h.y*e.ab|0}return{tileX:s,tileY:l}}_getHeightAtTileOffset(e,i,r){let a,n;for(let s=0;s<this.layers.length;++s){if("fill-extrusion"!==this.layers[s].layer.type)continue;let{bucket:l,tileID:h,verticalScale:u}=this.currentBuildingBuckets[s];if(!l)continue;let{tileX:c,tileY:d}=this._mapCoordToOverlappingTile(e,i,r,h),p=l.getHeightAtTileCoord(c,d);p&&void 0!==p.height&&(p.hidden?a=p.height:n=Math.max(p.height*u,n||0))}if(void 0!==n)return n;for(let n=0;n<this.layers.length;++n){let s=this.layers[n];if("model"!==s.layer.type||!s.visible)continue;let{bucket:l,tileID:h}=this.currentBuildingBuckets[n];if(!l)continue;let{tileX:u,tileY:c}=this._mapCoordToOverlappingTile(e,i,r,h),d=l.getHeightAtTileCoord(u,c);if(d&&!d.hidden)return void 0===d.height&&void 0!==a?Math.min(d.maxHeight,a)*d.verticalScale:d.height?d.height*d.verticalScale:Number.NEGATIVE_INFINITY}return this.layersGotHidden?0:Number.NEGATIVE_INFINITY}}function tt(i){i=i.slice();let r=Object.create(null);for(let e=0;e<i.length;e++)r[i[e].id]=i[e];for(let a=0;a<i.length;a++)"ref"in i[a]&&(i[a]=function(i,r){let a={};for(let e in i)"ref"!==e&&(a[e]=i[e]);
213return e.bh.forEach(e=>{e in r&&(a[e]=r[e])}),a}(i[a],r[i[a].ref]));return i}let ti={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setSlot:"setSlot",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight",setTerrain:"setTerrain",setFog:"setFog",setCamera:"setCamera",setLights:"setLights",setProjection:"setProjection",addImport:"addImport",removeImport:"removeImport",updateImport:"updateImport"};function tr(e,i,r){r.push({command:ti.addSource,args:[e,i[e]]})}function ta(e,i,r){i.push({command:ti.removeSource,args:[e]}),r[e]=!0}function tn(i,r,a,n,s,l){let h;for(h in r=r||{},i=i||{})i.hasOwnProperty(h)&&(e.bi(i[h],r[h])||a.push({command:l,args:[n,h,r[h],s]}));for(h in r)r.hasOwnProperty(h)&&!i.hasOwnProperty(h)&&(e.bi(i[h],r[h])||a.push({command:l,args:[n,h,r[h],s]}))}function to(e){return e.id}function ts(e,i){return e[i.id]=i,e}class tl{constructor(e,i){this.reset(e,i)}reset(e,i){this.points=e||[],this._distances=[0];for(let e=1;e<this.points.length;e++)this._distances[e]=this._distances[e-1]+this.points[e].dist(this.points[e-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(i||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(i){if(1===this.points.length)return this.points[0];i=e.ap(i,0,1);let r=1,a=this._distances[r],n=i*this.paddedLength+this.padding;for(;a<n&&r<this._distances.length;)a=this._distances[++r];let s=r-1,l=this._distances[s],h=a-l,u=h>0?(n-l)/h:0;return this.points[s].mult(1-u).add(this.points[r].mult(u))}}class th{constructor(e,i,r){let a=this.boxCells=[],n=this.circleCells=[];this.xCellCount=Math.ceil(e/r),this.yCellCount=Math.ceil(i/r);for(let e=0;e<this.xCellCount*this.yCellCount;e++)a.push([]),n.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=i,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/i,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,i,r,a,n){this._forEachCell(i,r,a,n,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(a),this.bboxes.push(n)}insertCircle(e,i,r,a){this._forEachCell(i-a,r-a,i+a,r+a,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(i),this.circles.push(r),this.circles.push(a)}_insertBoxCell(e,i,r,a,n,s){this.boxCells[n].push(s)}_insertCircleCell(e,i,r,a,n,s){this.circleCells[n].push(s)}_query(e,i,r,a,n,s){if(r<0||e>this.width||a<0||i>this.height)return!n&&[];let l=[];if(e<=0&&i<=0&&this.width<=r&&this.height<=a){if(n)return!0;for(let e=0;e<this.boxKeys.length;e++)l.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++){let i=this.circles[3*e],r=this.circles[3*e+1],a=this.circles[3*e+2];l.push({key:this.circleKeys[e],x1:i-a,y1:r-a,x2:i+a,y2:r+a})}return s?l.filter(s):l}return this._forEachCell(e,i,r,a,this._queryCell,l,{hitTest:n,seenUids:{box:{},circle:{}}},s),n?l.length>0:l}_queryCircle(e,i,r,a,n){let s=e-r,l=e+r,h=i-r,u=i+r;if(l<0||s>this.width||u<0||h>this.height)return!a&&[];let c=[];return this._forEachCell(s,h,l,u,this._queryCellCircle,c,{hitTest:a,circle:{x:e,y:i,radius:r},seenUids:{box:{},circle:{}}},n),a?c.length>0:c}query(e,i,r,a,n){return this._query(e,i,r,a,!1,n)}hitTest(e,i,r,a,n){return this._query(e,i,r,a,!0,n)}hitTestCircle(e,i,r,a){return this._queryCircle(e,i,r,!0,a)}_queryCell(e,i,r,a,n,s,l,h){let u=l.seenUids,c=this.boxCells[n];if(null!==c){let n=this.bboxes;for(let d of c)if(!u.box[d]){u.box[d]=!0;let c=4*d;if(e<=n[c+2]&&i<=n[c+3]&&r>=n[c+0]&&a>=n[c+1]&&(!h||h(this.boxKeys[d]))){if(l.hitTest)return s.push(!0),!0;s.push({key:this.boxKeys[d],x1:n[c],y1:n[c+1],x2:n[c+2],y2:n[c+3]})}}}let d=this.circleCells[n];if(null!==d){let n=this.circles;for(let c of d)if(!u.circle[c]){u.circle[c]=!0;let d=3*c;if(this._circleAndRectCollide(n[d],n[d+1],n[d+2],e,i,r,a)&&(!h||h(this.circleKeys[c]))){if(l.hitTest)return s.push(!0),!0;
213{let e=n[d],i=n[d+1],r=n[d+2];s.push({key:this.circleKeys[c],x1:e-r,y1:i-r,x2:e+r,y2:i+r})}}}}}_queryCellCircle(e,i,r,a,n,s,l,h){let u=l.circle,c=l.seenUids,d=this.boxCells[n];if(null!==d){let e=this.bboxes;for(let i of d)if(!c.box[i]){c.box[i]=!0;let r=4*i;if(this._circleAndRectCollide(u.x,u.y,u.radius,e[r+0],e[r+1],e[r+2],e[r+3])&&(!h||h(this.boxKeys[i])))return s.push(!0),!0}}let p=this.circleCells[n];if(null!==p){let e=this.circles;for(let i of p)if(!c.circle[i]){c.circle[i]=!0;let r=3*i;if(this._circlesCollide(e[r],e[r+1],e[r+2],u.x,u.y,u.radius)&&(!h||h(this.circleKeys[i])))return s.push(!0),!0}}}_forEachCell(e,i,r,a,n,s,l,h){let u=this._convertToXCellCoord(e),c=this._convertToYCellCoord(i),d=this._convertToXCellCoord(r),p=this._convertToYCellCoord(a);for(let f=u;f<=d;f++)for(let u=c;u<=p;u++)if(n.call(this,e,i,r,a,this.xCellCount*u+f,s,l,h))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,i,r,a,n,s){let l=a-e,h=n-i,u=r+s;return u*u>l*l+h*h}_circleAndRectCollide(e,i,r,a,n,s,l){let h=(s-a)/2,u=Math.abs(e-(a+h));if(u>h+r)return!1;let c=(l-n)/2,d=Math.abs(i-(n+c));if(d>c+r)return!1;if(u<=h||d<=c)return!0;let p=u-h,f=d-c;return p*p+f*f<=r*r}}let tu={unknown:0,flipRequired:1,flipNotRequired:2},tc=Math.tan(85*Math.PI/180);function td(i,r,a,n,s,l,h){let u=e.a6.mat4.create();if(a){if("globe"===l.name){let i=e.bj(s,r);e.a6.mat4.multiply(u,u,i)}else{let i=e.a6.mat2.invert([],h);u[0]=i[0],u[1]=i[1],u[4]=i[2],u[5]=i[3],n||e.a6.mat4.rotateZ(u,u,s.angle)}}else e.a6.mat4.multiply(u,s.labelPlaneMatrix,i);return u}function tp(e,i,r,a,n,s,l){let h=td(e,i,r,a,n,s,l);return"globe"===s.name&&r||(h[2]=h[6]=h[10]=h[14]=0),h}function tf(i,r,a,n,s,l,h){if(a){if("globe"===l.name){let u=td(i,r,a,n,s,l,h);return e.a6.mat4.invert(u,u),e.a6.mat4.multiply(u,i,u),u}{let r=e.a6.mat4.clone(i),a=e.a6.mat4.identity([]);return a[0]=h[0],a[1]=h[1],a[4]=h[2],a[5]=h[3],e.a6.mat4.multiply(r,r,a),n||e.a6.mat4.rotateZ(r,r,-s.angle),r}}return s.glCoordMatrix}function tm(i,r,a,n){let s=[i,r,a,1];a?e.a6.vec4.transformMat4(s,s,n):tM(s,s,n);let l=s[3];return s[0]/=l,s[1]/=l,s[2]/=l,s}function t_(e,i){return Math.min(.5+e/i*.5,1.5)}function tg(i,r,a,n,s,l,h,u,c,d){let p=a.transform,f=n?i.textSizeData:i.iconSizeData,m=e.bk(f,a.transform.zoom),_="globe"===p.projection.name,g=[256/a.width*2+1,256/a.height*2+1],y=n?i.text.dynamicLayoutVertexArray:i.icon.dynamicLayoutVertexArray;y.clear();let x=null;_&&(x=n?i.text.globeExtVertexArray:i.icon.globeExtVertexArray);let v=i.lineVertexArray,b=n?i.text.placedSymbolArray:i.icon.placedSymbolArray,w=a.transform.width/a.transform.height,T,S=!1;for(let n=0;n<b.length;n++){let _=b.get(n),{numGlyphs:M,writingMode:E}=_;if(E!==e.bl.vertical||S||T===e.bl.horizontal||(S=!0),T=E,(_.hidden||E===e.bl.vertical)&&!S){tS(M,y);continue}S=!1;let A=new e.P(_.tileAnchorX,_.tileAnchorY),{x:I,y:C,z:P}=p.projection.projectTilePoint(A.x,A.y,d.canonical);if(c){let[e,i,r]=c(A);I+=e,C+=i,P+=r}let L=[I,C,P,1];if(e.a6.vec4.transformMat4(L,L,r),!function(e,i){let r=e[0]/e[3],a=e[1]/e[3];return r>=-i[0]&&r<=i[0]&&a>=-i[1]&&a<=i[1]}(L,g)){tS(M,y);continue}let k=L[3],R=t_(a.transform.getCameraToCenterDistance(p.projection),k),z=e.bm(f,m,_),D=h?z/R:z*R,O=tm(I,C,P,s);if(O[3]<=0){tS(M,y);continue}let B={},F=h?null:c,N=tv(_,D,!1,u,r,s,l,i.glyphOffsetArray,v,y,x,O,A,B,w,F,p.projection,d,h);S=N.useVertical,F&&N.needsFlipping&&(B={}),(N.notEnoughRoom||S||N.needsFlipping&&tv(_,D,!0,u,r,s,l,i.glyphOffsetArray,v,y,x,O,A,B,w,F,p.projection,d,h).notEnoughRoom)&&tS(M,y)}n?(i.text.dynamicLayoutVertexBuffer.updateData(y),x&&i.text.globeExtVertexBuffer&&i.text.globeExtVertexBuffer.updateData(x)):(i.icon.dynamicLayoutVertexBuffer.updateData(y),x&&i.icon.globeExtVertexBuffer&&i.icon.globeExtVertexBuffer.updateData(x))}function ty(e,i,r,a,n,s,l,h,u,c,d,p,f,m,_,g){let{lineStartIndex:y,glyphStartIndex:x,segment:v}=h,b=x+h.numGlyphs,w=y+h.lineLength,T=i.getoffsetX(x),S=i.getoffsetX(b-1),M=tT(e*T,r,a,n,s,l,v,y,w,u,c,d,p,f,!0,m,_,g);if(!M)return null;let E=tT(e*S,r,a,n,s,l,v,y,w,u,c,d,p,f,!0,m,_,g);return E?{first:M,last:E}:null}function tx(i,r,a,n){return i===e.bl.horizontal&&Math.abs(n)>Math.abs(a)?{useVertical:!0}:i===e.bl.vertical?n>0?{needsFlipping:!0}:null:r!==tu.unknown&&(0===a||Math.abs(n/a)>tc)?r===tu.flipRequired?{needsFlipping:!0}:null:a<0?{needsFlipping:!0}:null}function tv(i,r,a,n,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b){let w=r/24,T=i.lineOffsetX*w,S=i.lineOffsetY*w,{lineStartIndex:M,glyphStartIndex:E,numGlyphs:A,segment:I,writingMode:C,flipState:P}=i,L=M+i.lineLength,k=i=>{if(p){let[r,a,n]=i.up,s=d.length;e.bn(p,s+0,r,a,n),e.bn(p,s+1,r,a,n),e.bn(p,s+2,r,a,n),e.bn(p,s+3,r,a,n)}let[r,a,n]=i.point;e.bo(d,r,a,n,i.angle)};if(A>1){let e=ty(w,u,T,S,a,f,m,i,c,l,_,y,!1,x,v,b);if(!e)return{notEnoughRoom:!0};if(n&&!a){let[r,a,n]=e.first.point,[s,l,u]=e.last.point;[r,a]=tm(r,a,n,h),[s,l]=tm(s,l,u,h);let c=tx(C,P,(s-r)*g,l-a);if(i.flipState=c&&c.needsFlipping?tu.flipRequired:tu.flipNotRequired,c)return c}k(e.first);for(let e=E+1;e<E+A-1;e++){let i=tT(w*u.getoffsetX(e),T,S,a,f,m,I,M,L,c,l,_,y,!1,!1,x,v,b);if(!i)return d.length-=4*(e-E),{notEnoughRoom:!0};k(i)}k(e.last)}else{if(n&&!a){let r=tm(m.x,m.y,0,s),a=M+I+1,n=new e.P(c.getx(a),c.gety(a)),l=tm(n.x,n.y,0,s),h=l[3]>0?l:tw(m,n,r,1,s,void 0,x,v.canonical),u=tx(C,P,(h[0]-r[0])*g,h[1]-r[1]);if(i.flipState=u&&u.needsFlipping?tu.flipRequired:tu.flipNotRequired,u)return u}let r=tT(w*u.getoffsetX(E),T,S,a,f,m,I,M,L,c,l,_,y,!1,!1,x,v,b);if(!r)return{notEnoughRoom:!0};k(r)}return{}}function tb(e,i,r,a,n){let{x:s,y:l,z:h}=a.projectTilePoint(e.x,e.y,i);if(!n)return tm(s,l,h,r);let[u,c,d]=n(e);return tm(s+u,l+c,h+d,r)}function tw(i,r,a,n,s,l,h,u){let c=tb(i.sub(r)._unit()._add(i),u,
213s,h,l);return e.a6.vec3.sub(c,a,c),e.a6.vec3.normalize(c,c),e.a6.vec3.scaleAndAdd(c,a,c,n)}function tT(i,r,a,n,s,l,h,u,c,d,p,f,m,_,g,y,x,v){let b=n?i-r:i+r,w=b>0?1:-1,T=0;n&&(w*=-1,T=Math.PI),w<0&&(T+=Math.PI);let S=u+h+(w>0?0:1)|0,M=s,E=s,A=0,I=0,C=Math.abs(b),P=[],L=[],k=l,R=k,z=()=>tw(R,k,E,C-A+1,p,m,y,x.canonical);for(;A+I<=C;){if((S+=w)<u||S>=c)return null;if(E=M,R=k,P.push(E),_&&L.push(R),k=new e.P(d.getx(S),d.gety(S)),!(M=f[S])){let e=tb(k,x.canonical,p,y,m);M=e[3]>0?f[S]=e:z()}A+=I,I=e.a6.vec3.distance(E,M)}g&&m&&(f[S]&&(M=z(),I=e.a6.vec3.distance(E,M)),f[S]=M);let D=(C-A)/I,O=k.sub(R)._mult(D)._add(R),B=e.a6.vec3.sub([],M,E),F=e.a6.vec3.scaleAndAdd([],E,B,D),N=[0,0,1],V=B[0],U=B[1];if(v&&(0!==(N=y.upVector(x.canonical,O.x,O.y))[0]||0!==N[1]||1!==N[2])){let i=[N[2],0,-N[0]],r=e.a6.vec3.cross([],N,i);e.a6.vec3.normalize(i,i),e.a6.vec3.normalize(r,r),V=e.a6.vec3.dot(B,i),U=e.a6.vec3.dot(B,r)}if(a){let i=e.a6.vec3.cross([],N,B);e.a6.vec3.normalize(i,i),e.a6.vec3.scaleAndAdd(F,F,i,a*w)}let j=T+Math.atan2(U,V);return P.push(F),_&&L.push(O),{point:F,angle:j,path:P,tilePath:L,up:N}}function tS(e,i){let r=i.length,a=r+4*e;i.resize(a),i.float32.fill(-1/0,4*r,4*a)}function tM(e,i,r){let a=i[0],n=i[1];return e[0]=r[0]*a+r[4]*n+r[12],e[1]=r[1]*a+r[5]*n+r[13],e[3]=r[3]*a+r[7]*n+r[15],e}class tE{constructor(e,i,r=new th(e.width+200,e.height+200,25),a=new th(e.width+200,e.height+200,25)){this.transform=e,this.grid=r,this.ignoredGrid=a,this.pitchfactor=Math.cos(e._pitch)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+100,this.screenBottomBoundary=e.height+100,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.fogState=i}placeCollisionBox(e,i,r,a,n,s,l,h){let u=r.projectedAnchorX,c=r.projectedAnchorY,d=r.projectedAnchorZ,p=r.elevation,f=r.tileID,m=e.getProjection();if(p&&f){let[e,i,a]=m.upVector(f.canonical,r.tileAnchorX,r.tileAnchorY),n=m.upVectorScale(f.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;u+=e*p*n,c+=i*p*n,d+=a*p*n}let _=this.projectAndGetPerspectiveRatio(l,u,c,d,r.tileID,"globe"===m.name||!!p||this.transform.pitch>0,m),g=s*_.perspectiveRatio,y=(r.x1*i+a.x-r.padding)*g+_.point.x,x=(r.y1*i+a.y-r.padding)*g+_.point.y,v=(r.x2*i+a.x+r.padding)*g+_.point.x,b=(r.y2*i+a.y+r.padding)*g+_.point.y,w=_.perspectiveRatio<=.55||_.occluded;return!this.isInsideGrid(y,x,v,b)||!n&&this.grid.hitTest(y,x,v,b,h)||w?{box:[],offscreen:!1,occluded:_.occluded}:{box:[y,x,v,b],offscreen:this.isOffscreen(y,x,v,b),occluded:!1}}placeCollisionCircles(i,r,a,n,s,l,h,u,c,d,p,f,m,_,g){let y=[],x=this.transform.elevation,v=i.getProjection(),b=x?x.getAtTileOffsetFunc(g,this.transform.center.lat,this.transform.worldSize,v):null,w=new e.P(a.tileAnchorX,a.tileAnchorY),{x:T,y:S,z:M}=v.projectTilePoint(w.x,w.y,g.canonical);if(b){let[e,i,r]=b(w);T+=e,S+=i,M+=r}let E="globe"===v.name,A=this.projectAndGetPerspectiveRatio(h,T,S,M,g,E||!!x||this.transform.pitch>0,v),{perspectiveRatio:I}=A,C=(p?l/I:l*I)/e.br,P=tm(T,S,M,u),L=A.signedDistanceFromCamera>0?ty(C,s,a.lineOffsetX*C,a.lineOffsetY*C,!1,P,w,a,n,u,{},x&&!p?b:null,p&&!!x,v,g,p):null,k=!1,R=!1,z=!0;if(L&&!A.occluded){let i=.5*m*I+_,a=new e.P(-100,-100),n=new e.P(this.screenRightBoundary,this.screenBottomBoundary),s=new tl,{first:l,last:h}=L,u=l.path.length,p=[];for(let e=u-1;e>=1;e--)p.push(l.path[e]);for(let e=1;e<h.path.length;e++)p.push(h.path[e]);let g=2.5*i;c&&(p=p.map(([e,i,r],a)=>(b&&!E&&(r=b(a<u-1?l.tilePath[u-1-a]:h.tilePath[a-u+2])[2]),tm(e,i,r,c)))).some(e=>e[3]<=0)&&(p=[]);let x=[];if(p.length>0){let i=1/0,r=-1/0,s=1/0,l=-1/0;for(let e of p)i=Math.min(i,e[0]),s=Math.min(s,e[1]),r=Math.max(r,e[0]),l=Math.max(l,e[1]);r>=a.x&&i<=n.x&&l>=a.y&&s<=n.y&&(x=[p.map(i=>new e.P(i[0],i[1]))],(i<a.x||r>n.x||s<a.y||l>n.y)&&(x=e.bp(x,a.x,a.y,n.x,n.y)))}for(let e of x){s.reset(e,.25*i);let a=0;a=s.length<=.5*i?1:Math.ceil(s.paddedLength/g)+1;for(let e=0;e<a;e++){let n=e/Math.max(a-1,1),l=s.lerp(n),h=l.x+100,u=l.y+100;y.push(h,u,i,0);let c=h-i,p=u-i,m=h+i,_=u+i;if(z=z&&this.isOffscreen(c,p,m,_),R=R||this.isInsideGrid(c,p,m,_),!r&&this.grid.hitTestCircle(h,u,i,f)&&(k=!0,!d))return{circles:[],offscreen:!1,collisionDetected:k,occluded:!1}}}}return{circles:(d||!k)&&R?y:[],offscreen:z,collisionDetected:k,occluded:A.occluded}}queryRenderedSymbols(i){if(0===i.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};let r=[],a=1/0,n=1/0,s=-1/0,l=-1/0;for(let h of i){let i=new e.P(h.x+100,h.y+100);a=Math.min(a,i.x),n=Math.min(n,i.y),s=Math.max(s,i.x),l=Math.max(l,i.y),r.push(i)}let h=this.grid.query(a,n,s,l).concat(this.ignoredGrid.query(a,n,s,l)),u={},c={};for(let i of h){let a=i.key;if(void 0===u[a.bucketInstanceId]&&(u[a.bucketInstanceId]={}),u[a.bucketInstanceId][a.featureIndex])continue;let n=[new e.P(i.x1,i.y1),new e.P(i.x2,i.y1),new e.P(i.x2,i.y2),new e.P(i.x1,i.y2)];
213e.bq(r,n)&&(u[a.bucketInstanceId][a.featureIndex]=!0,void 0===c[a.bucketInstanceId]&&(c[a.bucketInstanceId]=[]),c[a.bucketInstanceId].push(a.featureIndex))}return c}insertCollisionBox(e,i,r,a,n){(i?this.ignoredGrid:this.grid).insert({bucketInstanceId:r,featureIndex:a,collisionGroupID:n},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,i,r,a,n){let s=i?this.ignoredGrid:this.grid,l={bucketInstanceId:r,featureIndex:a,collisionGroupID:n};for(let i=0;i<e.length;i+=4)s.insertCircle(l,e[i],e[i+1],e[i+2])}projectAndGetPerspectiveRatio(i,r,a,n,s,l,h){let u=[r,a,n,1],c=!1;n||this.transform.pitch>0?(e.a6.vec4.transformMat4(u,u,i),this.fogState&&s&&"globe"!==h.name&&(c=function(i,r,a,n,s,l){let h=l.calculateFogTileMatrix(s),u=[r,a,n];return e.a6.vec3.transformMat4(u,u,h),ek(i,e.a6.vec3.length(u),l.pitch,l._fov)}(this.fogState,r,a,n,s.toUnwrapped(),this.transform)>.9)):tM(u,u,i);let d=u[3];return{point:new e.P((u[0]/d+1)/2*this.transform.width+100,(-u[1]/d+1)/2*this.transform.height+100),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(h)/d*.5,1.5),signedDistanceFromCamera:d,occluded:l&&u[2]>d||c}}isOffscreen(e,i,r,a){return r<100||e>=this.screenRightBoundary||a<100||i>this.screenBottomBoundary}isInsideGrid(e,i,r,a){return r>=0&&e<this.gridRightBoundary&&a>=0&&i<this.gridBottomBoundary}getViewportMatrix(){let i=e.a6.mat4.identity([]);return e.a6.mat4.translate(i,i,[-100,-100,0]),i}}function tA(i,r,a){let n=r.createTileMatrix(i,i.worldSize,a.toUnwrapped());return e.a6.mat4.multiply(new Float32Array(16),i.projMatrix,n)}function tI(e,i,r){return i.name===r.projection.name?e.projMatrix:tA(r,i,e)}class tC{constructor(e,i,r,a){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?i:-i))):a&&r?1:0,this.placed=r}isHidden(){return 0===this.opacity&&!this.placed}}class tP{constructor(e,i,r,a,n,s=!1){this.text=new tC(e?e.text:null,i,r,n),this.icon=new tC(e?e.icon:null,i,a,n),this.clipped=s}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class tL{constructor(e,i,r,a=!1){this.text=e,this.icon=i,this.skipFade=r,this.clipped=a}}class tk{constructor(){this.invProjMatrix=e.a6.mat4.create(),this.viewportMatrix=e.a6.mat4.create(),this.circles=[]}}class tR{constructor(e,i,r,a,n){this.bucketInstanceId=e,this.featureIndex=i,this.sourceLayerIndex=r,this.bucketIndex=a,this.tileID=n}}class tz{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){let i=++this.maxGroupID;this.collisionGroups[e]={ID:i,predicate:e=>e.collisionGroupID===i}}return this.collisionGroups[e]}}function tD(i,r,a,n,s){let{horizontalAlign:l,verticalAlign:h}=e.by(i),u=e.bx(i,n);return new e.P(-(l-.5)*r+u[0]*s,-(h-.5)*a+u[1]*s)}function tO(i,r,a,n,s){let l=new e.P(i,r);return a&&l._rotate(n?s:-s),l}class tB{constructor(e,i,r,a,n,s){this.transform=e.clone(),this.projection=e.projection.name,this.collisionIndex=new tE(this.transform,n),this.buildingIndex=s,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new tz(r),this.collisionCircleArrays={},this.prevPlacement=a,a&&(a.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(i,r,a,n,s=1){var l,h,u;let c=a.getBucket(r),d=a.latestFeatureIndex;if(!c||!d||r.fqid!==c.layerIds[0])return;let p=c.layers[0].layout,f=c.layers[0].paint,m=a.collisionBoxArray,_=Math.pow(2,this.transform.zoom-a.tileID.overscaledZ),g=a.tileSize/e.ab,y=a.tileID.toUnwrapped();this.transform.setProjection(c.projection);let x=(l=a.tileID,h=c.getProjection(),u=this.transform,h.name===this.projection?u.calculateProjMatrix(l.toUnwrapped()):tA(u,h,l)),v="map"===p.get("text-pitch-alignment"),b="map"===p.get("text-rotation-alignment");r.compileFilter(r.options);let w=r.dynamicFilter(),T=r.dynamicFilterNeedsFeature(),S=this.transform.calculatePixelsToTileUnitsMatrix(a),M=tp(x,a.tileID.canonical,v,b,this.transform,c.getProjection(),S),E=null;if(v){let i=tf(x,a.tileID.canonical,v,b,this.transform,c.getProjection(),S);
213E=e.a6.mat4.multiply([],this.transform.labelPlaneMatrix,i)}let A=null;w&&a.latestFeatureIndex&&(A={unwrappedTileID:y,dynamicFilter:w,dynamicFilterNeedsFeature:T}),this.retainedQueryData[c.bucketInstanceId]=new tR(c.bucketInstanceId,d,c.sourceLayerIndex,c.index,a.tileID);let I=c.layers[0].layout.get("text-size-scale-range"),C=e.ap(s,I[0],I[1]),P=c.layers[0].layout.get("icon-size-scale-range"),L=e.ap(s,P[0],P[1]),k={bucket:c,layout:p,paint:f,posMatrix:x,textLabelPlaneMatrix:M,labelToScreenMatrix:E,clippingData:A,scale:_,textPixelRatio:g,holdingForFade:a.holdingForFade(),collisionBoxArray:m,partiallyEvaluatedTextSize:e.bk(c.textSizeData,this.transform.zoom,C),partiallyEvaluatedIconSize:e.bk(c.iconSizeData,this.transform.zoom,L),collisionGroup:this.collisionGroups.get(c.sourceID),latestFeatureIndex:a.latestFeatureIndex};if(n)for(let e of c.sortKeyRanges){let{sortKey:r,symbolInstanceStart:a,symbolInstanceEnd:n}=e;i.push({sortKey:r,symbolInstanceStart:a,symbolInstanceEnd:n,parameters:k})}else i.push({symbolInstanceStart:0,symbolInstanceEnd:c.symbolInstances.length,parameters:k})}attemptAnchorPlacement(e,i,r,a,n,s,l,h,u,c,d,p,f,m,_,g,y,x){let{textOffset0:v,textOffset1:b,crossTileID:w}=p,T=[v,b],S=tD(e,r,a,T,n),M=this.collisionIndex.placeCollisionBox(m,n,i,tO(S.x,S.y,s,l,this.transform.angle),d,h,u,c.predicate);if(g){let e=m.getSymbolInstanceIconSize(x,this.transform.zoom,p.placedIconSymbolIndex);if(0===this.collisionIndex.placeCollisionBox(m,e,g,tO(S.x,S.y,s,l,this.transform.angle),d,h,u,c.predicate).box.length)return}if(M.box.length>0){let i;return this.prevPlacement&&this.prevPlacement.variableOffsets[w]&&this.prevPlacement.placements[w]&&this.prevPlacement.placements[w].text&&(i=this.prevPlacement.variableOffsets[w].anchor),this.variableOffsets[w]={textOffset:T,width:r,height:a,anchor:e,textScale:n,prevAnchor:i},this.markUsedJustification(m,e,p,_),m.allowVerticalPlacement&&(this.markUsedOrientation(m,_,p),this.placedOrientations[w]=_),{shift:S,placedGlyphBoxes:M}}}placeLayerBucketPart(i,r,a,n,s=1){let{bucket:l,layout:h,paint:u,posMatrix:c,textLabelPlaneMatrix:d,labelToScreenMatrix:p,clippingData:f,textPixelRatio:m,holdingForFade:_,collisionBoxArray:g,partiallyEvaluatedTextSize:y,partiallyEvaluatedIconSize:x,collisionGroup:v,latestFeatureIndex:b}=i.parameters,w=h.get("text-optional"),T=h.get("icon-optional"),S=h.get("text-allow-overlap"),M=h.get("icon-allow-overlap"),E="map"===h.get("text-rotation-alignment"),A="map"===h.get("text-pitch-alignment"),I=h.get("symbol-z-elevate"),C=u.get("symbol-z-offset"),P="sea"===h.get("symbol-elevation-reference"),L=h.get("text-size-scale-range"),k=h.get("icon-size-scale-range"),R=e.ap(s,L[0],L[1]),z=e.ap(s,k[0],k[1]);this.transform.setProjection(l.projection);let D=S&&(M||!l.hasIconData()||T),O=M&&(S||!l.hasTextData()||w),B=!C.isConstant();!l.collisionArrays&&g&&l.deserializeCollisionBoxes(g),a&&n&&l.updateCollisionDebugBuffers(this.transform.zoom,g,R,z);let F=(i,n,u)=>{let{crossTileID:g,numVerticalGlyphVertices:I}=i,L=null;if(f&&f.dynamicFilterNeedsFeature||B){let e=this.retainedQueryData[l.bucketInstanceId];L=b.loadFeature({featureIndex:i.featureIndex,bucketIndex:e.bucketIndex,sourceLayerIndex:e.s
213ourceLayerIndex,layoutVertexArrayOffset:0})}if(f&&!(0,f.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch},L,this.retainedQueryData[l.bucketInstanceId].tileID.canonical,new e.P(i.tileAnchorX,i.tileAnchorY),this.transform.calculateDistanceTileData(f.unwrappedTileID)))return this.placements[g]=new tL(!1,!1,!1,!0),void r.add(g);let k=C.evaluate(L,{});if(r.has(g))return;if(_)return void(this.placements[g]=new tL(!1,!1,!1));let R=!1,z=!1,F=!0,N=!1,V=!1,U=null,j={box:null,offscreen:null,occluded:null},G={box:null,offscreen:null,occluded:null},q=null,W=null,$=null,H=0,Z=0,X=0;u.textFeatureIndex?H=u.textFeatureIndex:i.useRuntimeCollisionCircles&&(H=i.featureIndex),u.verticalTextFeatureIndex&&(Z=u.verticalTextFeatureIndex);let Y=e=>{e.tileID=this.retainedQueryData[l.bucketInstanceId].tileID;let r=this.transform.elevation;e.elevation=P?k:k+(r?r.getAtTileOffset(e.tileID,e.tileAnchorX,e.tileAnchorY):0),e.elevation+=i.zOffset},J=u.textBox;if(J){Y(J);let r=r=>{let a=e.bl.horizontal;if(l.allowVerticalPlacement&&!r&&this.prevPlacement){let e=this.prevPlacement.placedOrientations[g];e&&(this.placedOrientations[g]=e,a=e,this.markUsedOrientation(l,a,i))}return a},a=(i,r)=>{if(l.allowVerticalPlacement&&I>0&&u.verticalTextBox){for(let a of l.writingModes)if(a===e.bl.vertical?G=j=r():j=i(),j&&j.box&&j.box.length)break}else j=i()};if(h.get("text-variable-anchor")){let s=h.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[g]){let e=this.prevPlacement.variableOffsets[g];s.indexOf(e.anchor)>0&&(s=s.filter(i=>i!==e.anchor)).unshift(e.anchor)}let d=(e,r,a)=>{let h=l.getSymbolInstanceTextSize(y,i,this.transform.zoom,n),u=(e.x2-e.x1)*h+2*e.padding,d=(e.y2-e.y1)*h+2*e.padding,p=i.hasIconTextFit&&!M?r:null;p&&Y(p);let f={box:[],offscreen:!1,occluded:!1},_=S?2*s.length:s.length;for(let r=0;r<_;++r){let _=this.attemptAnchorPlacement(s[r%s.length],e,u,d,h,E,A,m,c,v,r>=s.length,i,n,l,a,p,y,x);if(_&&(f=_.placedGlyphBoxes)&&f.box&&f.box.length){R=!0,U=_.shift;break}}return f};a(()=>d(J,u.iconBox,e.bl.horizontal),()=>{let i=u.verticalTextBox;return i&&Y(i),l.allowVerticalPlacement&&!(j&&j.box&&j.box.length)&&I>0&&i?d(i,u.verticalIconBox,e.bl.vertical):{box:null,offscreen:null,occluded:null}}),j&&(R=j.box,F=j.offscreen,N=j.occluded);let p=r(!(!j||!j.box));if(!R&&this.prevPlacement){let e=this.prevPlacement.variableOffsets[g];e&&(this.variableOffsets[g]=e,this.markUsedJustification(l,e.anchor,i,p))}}else{let h=(r,a)=>{let h=l.getSymbolInstanceTextSize(y,i,this.transform.zoom,n,s),u=this.collisionIndex.placeCollisionBox(l,h,r,new e.P(0,0),S,m,c,v.predicate);return u&&u.box&&u.box.length&&(this.markUsedOrientation(l,a,i),this.placedOrientations[g]=a),u};a(()=>h(J,e.bl.horizontal),()=>{let i=u.verticalTextBox;return l.allowVerticalPlacement&&I>0&&i?(Y(i),h(i,e.bl.vertical)):{box:null,offscreen:null,occluded:null}}),r(!!(j&&j.box&&j.box.length))}}if(R=(q=j)&&q.box&&q.box.length>0,F=q&&q.offscreen,N=q&&q.occluded,i.useRuntimeCollisionCircles){let r=l.text.placedSymbolArray.get(i.centerJustifiedTextSymbolIndex>=0?i.centerJustifiedTextSymbolIndex:i.verticalPlacedTextSymbolIndex),n=e.bm(l.textSizeData,y,r),s=h.get("text-padding");W=this.collisionIndex.placeCollisionCircles(l,S,r,l.lineVertexArray,l.glyphOffsetArray,n,c,d,p,a,A,v.predicate,i.collisionCircleDiameter*n/e.br,s,this.retainedQueryData[l.bucketInstanceId].tileID),R=S||W.circles.length>0&&!W.collisionDetected,F=F&&W.offscreen,N=W.occluded}if(u.iconFeatureIndex&&(X=u.iconFeatureIndex),u.iconBox){let r=r=>{Y(r);let a=i.hasIconTextFit&&U?tO(U.x,U.y,E,A,this.transform.angle):new e.P(0,0),n=l.getSymbolInstanceIconSize(x,this.transform.zoom,i.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(l,n,r,a,M,m,c,v.predicate)};z=G&&G.box&&G.box.length&&u.verticalIconBox?($=r(u.verticalIconBox)).box.length>0:($=r(u.iconBox)).box.length>0,F=F&&$.offscreen,V=$.occluded}let K=w||0===i.numHorizontalGlyphVertices&&0===I,Q=T||0===i.numIconVertices;if(K||Q?Q?K||(z=z&&R):R=z&&R:z=R=z&&R,R&&q&&q.box&&this.collisionIndex.insertCollisionBox(q.box,h.get("text-ignore-placement"),l.bucketInstanceId,G&&G.box&&Z?Z:H,v.ID),z&&$&&this.collisionIndex.insertCollisionBox($.box,h.get("icon-ignore-placement"),l.bucketInstanceId,X,v.ID),W&&(R&&this.collisionIndex.insertCollisionCircles(W.circles,h.get("text-ignore-placement"),l.bucketInstanceId,H,v.ID),a)){let e=l.bucketInstanceId,i=this.collisionCircleArrays[e];void 0===i&&(i=this.collisionCircleArrays[e]=new tk);for(let e=0;e<W.circles.length;e+=4)i.circles.push(W.circles[e+0]),i.circles.push(W.circles[e+1]),i.circles.push(W.circles[e+2]),i.circles.push(+!!W.collisionDetected)}let ee="globe"!==l.projection.name;D=D&&(ee||!N),O=O&&(ee||!V),this.placements[g]=new tL(R||D,z||O,F||l.justReloaded),r.add(g)};if(I&&this.buildingIndex&&(this.buildingIndex.updateZOffset(l,this.retainedQueryData[l.bucketInstanceId].tileID),l.updateZOffset()),l.sortFeaturesByY){let i=l.getSortedSymbolIndexe
213s(this.transform.angle);for(let e=i.length-1;e>=0;--e){let r=i[e];F(l.symbolInstances.get(r),r,l.collisionArrays[r])}l.hasAnyZOffset&&e.w(`${l.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(l.hasAnyZOffset){let e=l.getSortedIndexesByZOffset();for(let i=0;i<e.length;++i){let r=e[i];F(l.symbolInstances.get(r),r,l.collisionArrays[r])}}else for(let e=i.symbolInstanceStart;e<i.symbolInstanceEnd;e++)F(l.symbolInstances.get(e),e,l.collisionArrays[e]);if(a&&l.bucketInstanceId in this.collisionCircleArrays){let i=this.collisionCircleArrays[l.bucketInstanceId];e.a6.mat4.invert(i.invProjMatrix,c),i.viewportMatrix=this.collisionIndex.getViewportMatrix()}l.justReloaded=!1}markUsedJustification(i,r,a,n){let{leftJustifiedTextSymbolIndex:s,centerJustifiedTextSymbolIndex:l,rightJustifiedTextSymbolIndex:h,verticalPlacedTextSymbolIndex:u,crossTileID:c}=a,d=e.bw(r),p=n===e.bl.vertical?u:"left"===d?s:"center"===d?l:"right"===d?h:-1;s>=0&&(i.text.placedSymbolArray.get(s).crossTileID=p>=0&&s!==p?0:c),l>=0&&(i.text.placedSymbolArray.get(l).crossTileID=p>=0&&l!==p?0:c),h>=0&&(i.text.placedSymbolArray.get(h).crossTileID=p>=0&&h!==p?0:c),u>=0&&(i.text.placedSymbolArray.get(u).crossTileID=p>=0&&u!==p?0:c)}markUsedOrientation(i,r,a){let n=r===e.bl.horizontal||r===e.bl.horizontalOnly?r:0,s=r===e.bl.vertical?r:0,{leftJustifiedTextSymbolIndex:l,centerJustifiedTextSymbolIndex:h,rightJustifiedTextSymbolIndex:u,verticalPlacedTextSymbolIndex:c}=a,d=i.text.placedSymbolArray;l>=0&&(d.get(l).placedOrientation=n),h>=0&&(d.get(h).placedOrientation=n),u>=0&&(d.get(u).placedOrientation=n),c>=0&&(d.get(c).placedOrientation=s)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let i=this.prevPlacement,r=!1;this.prevZoomAdjustment=i?i.zoomAdjustment(this.transform.zoom):0;let a=i?i.symbolFadeChange(e):1,n=i?i.opacities:{},s=i?i.variableOffsets:{},l=i?i.placedOrientations:{};for(let e in this.placements){let i=this.placements[e],s=n[e];s?(this.opacities[e]=new tP(s,a,i.text,i.icon,null,i.clipped),r=r||i.text!==s.text.placed||i.icon!==s.icon.placed):(this.opacities[e]=new tP(null,a,i.text,i.icon,i.skipFade,i.clipped),r=r||i.text||i.icon)}for(let e in n){let i=n[e];if(!this.opacities[e]){let n=new tP(i,a,!1,!1);n.isHidden()||(this.opacities[e]=n,r=r||i.text.placed||i.icon.placed)}}for(let e in s)this.variableOffsets[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.variableOffsets[e]=s[e]);for(let e in l)this.placedOrientations[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.placedOrientations[e]=l[e]);r?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=i?i.lastPlacementChangeTime:e)}updateLayerOpacities(e,i,r,a){let n=new Set;for(let s of i){let i=s.getBucket(e);i&&s.latestFeatureIndex&&e.fqid===i.layerIds[0]&&(this.updateBucketOpacities(i,n,s,s.collisionBoxArray,r,a,s.tileID,e.scope),i.layers[0].layout.get("symbol-z-elevate")&&this.buildingIndex&&(this.buildingIndex.updateZOffset(i,s.tileID),i.updateZOffset()))}}updateBucketOpacities(i,r,a,n,s,l,h,u){i.hasTextData()&&i.text.opacityVertexArray.clear(),i.hasIconData()&&i.icon.opacityVertexArray.clear(),i.hasIconCollisionBoxData()&&i.iconCollisionBox.collisionVertexArray.clear(),i.hasTextCollisionBoxData()&&i.textCollisionBox.collisionVertexArray.clear();let c=i.layers[0].layout,d=i.layers[0].paint,p=!!i.layers[0].dynamicFilter(),f=new tP(null,0,!1,!1,!0),m=c.get("text-allow-overlap"),_=c.get("icon-allow-overlap"),g=c.get("text-variable-anchor"),y="map"===c.get("text-rotation-alignment"),x="map"===c.get("text-pitch-alignment"),v=d.get("symbol-z-offset"),b="sea"===c.get("symbol-elevation-reference"),w=!v.isConstant(),T=new tP(null,0,m&&(_||!i.hasIconData()||c.get("icon-optional")),_&&(m||!i.hasTextData()||c.get("text-optional")),!0);!i.collisionArrays&&n&&(i.hasIconCollisionBoxData()||i.hasTextCollisionBoxData())&&i.deserializeCollisionBoxes(n);let S=(e,i,r)=>{for(let a=0;a<i/4;a++)e.opacityVertexArray.emplaceBack(r)},M=0;l&&i.updateReplacement(h,l);for(let n=0;n<i.symbolInstances.length;n++){let c=i.symbolInstances.get(n),{numHorizontalGlyphVertices:d,numVerticalGlyphVertices:m,crossTileID:_,numIconVertices:E,tileAnchorX:A,tileAnchorY:I}=c,C=null,P=this.retainedQueryData[i.bucketInstanceId];w&&c&&P&&(C=a.latestFeatureIndex.loadFeature({featureIndex:c.featureIndex,bucketIndex:P.bucketIndex,sourceLayerIndex:P.sourceLayerIndex,layoutVertexArrayOffset:0}));let L=v.evaluate(C,{}),k=r.has(_),R=this.opacities[_];k?R=f:R||(R=T,this.opacities[_]=R),r.add(_);let z=d>0||m>0,D=E>0,O=this.placedOrientations[_],B=O===e.bl.vertical,F=O===e.bl.horizontal||O===e.bl.horizontalOnly;!z&&!D||R.isHidden()||M++;let N=!1;if((z||D)&&l)for(let r of i.activeReplacements){if(e.bs(r,s,e.bt.Symbol,u)||r.min.x>A||A>r.max.x||r.min.y>I||I>r.max.y)continue;let i=e.bu(A,I,h.canonical,r.footprintTileId.canonical);if(N=e.bv(i,r.footprint))break}if(z){let e=N?tV:tN(R.text);S(i.text,d,B?tV:e),S(i.text,m,F?tV:e);let r=R.text.isHidden(),{leftJustifiedTextSymbolIndex:a,centerJustifiedTextSymbolIndex:n,rightJustifiedTextSymbolIndex:s,verticalPlacedTextSymbolIndex:l}=c,h=i.text.placedSymbolArray,u=r||B?1:0;a>=0&&(h.get(a).hidden=u),n>=0&&(h.get(n).hidden=u),s>=0&&(h.get(s).hidden=u),l>=0&&(h.get(l).hidden=r||F?1:0);let p=this.variableOffsets[_];p&&this.markUsedJustification(i,p.anchor,c,O);let f=this.placedOrientations[_];f&&(this.markUsedJustification(i,"left",c,f),this.markUsedOrientation(i,f,c))}if(D){let e=N?tV:tN(R.icon),{placedIconSymbolIndex:r,verticalPlacedIconSymbolIndex:a}=c,n=i.icon.placedSymbolArray,s=+!!R.icon.isHidden();r>=0&&(S(i.icon,E,B?tV:e),n.get(r).hidden=s),a>=0&&(S(i.icon,c.numVerticalIconVertices,F?tV:e),n.get(a).hidden=s)}if(i.hasIconCollisionBoxData()||i.hasTextCollisionBoxData()){let r=i.collisionArrays[n];if(r){let a=new e.P(0,0),n=!0;if(r.textBox||r.verticalTextBox){if(g){let e=this.variableOffsets[_];e?(a=tD(e.anchor,e.width,e.height,e.textOffset,e.textScale),y&&a._rotate(x?this.transform.angle:-this.transform.angle)):n=!1}p&&(n=!R.clipped),r.textBox&&tF(i.textCollisionBox.collisionVertexArray,R.text.placed,!n||B,L,b,a.x,a.y),r.verticalTextBox&&tF(i.textCollisionBox.collisionVertexArray,R.text.placed,!n||F,L,b,a.x,a.y)}let s=n&&!!(!F&&r.verticalIconBox);r.iconBox&&tF(i.iconCollisionBox.collisionVertexArray,R.icon.placed,s,L,b,c.hasIconTextFit?a.x:0,c.hasIconTextFit?a.y:0),r.verticalIconBox&&tF(i.iconCollisionBox.collisionVertexArray,R.icon.placed,!s,L,b,c.hasIconTextFit?a.x:0,c.hasIconTextFit?a.y:0)}}}if(i.fullyClipped=0===M,i.sortFeatures(this.transform.angle),this.retainedQueryData[i.bucketInstanceId]&&(this.retainedQueryData[i.bucketInstanceId].featureSortOrder=i.featureSortOrder),i.hasTextData()&&i.text.opacityVertexBuffer&&i.text.opacityVertexBuffer.updateData(i.text.o
213pacityVertexArray),i.hasIconData()&&i.icon.opacityVertexBuffer&&i.icon.opacityVertexBuffer.updateData(i.icon.opacityVertexArray),i.hasIconCollisionBoxData()&&i.iconCollisionBox.collisionVertexBuffer&&i.iconCollisionBox.collisionVertexBuffer.updateData(i.iconCollisionBox.collisionVertexArray),i.hasTextCollisionBoxData()&&i.textCollisionBox.collisionVertexBuffer&&i.textCollisionBox.collisionVertexBuffer.updateData(i.textCollisionBox.collisionVertexArray),i.bucketInstanceId in this.collisionCircleArrays){let e=this.collisionCircleArrays[i.bucketInstanceId];i.placementInvProjMatrix=e.invProjMatrix,i.placementViewportMatrix=e.viewportMatrix,i.collisionCircleArray=e.circles,delete this.collisionCircleArrays[i.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,i){let r=this.zoomAtLastRecencyCheck===i?1-this.zoomAdjustment(i):1;return this.zoomAtLastRecencyCheck=i,this.commitTime+this.fadeDuration*r>e}setStale(){this.stale=!0}}function tF(e,i,r,a,n,s,l){e.emplaceBack(+!!i,+!!r,s||0,l||0,a,+!!n),e.emplaceBack(+!!i,+!!r,s||0,l||0,a,+!!n),e.emplaceBack(+!!i,+!!r,s||0,l||0,a,+!!n),e.emplaceBack(+!!i,+!!r,s||0,l||0,a,+!!n)}function tN(e){if(0===e.opacity&&!e.placed)return 0;if(1===e.opacity&&e.placed)return 0xffffffff;let i=+!!e.placed,r=Math.floor(127*e.opacity);return 0x2000000*r+0x1000000*i+131072*r+65536*i+512*r+256*i+2*r+i}let tV=0;class tU{constructor(e){this._sortAcrossTiles="viewport-y"!==e.layout.get("symbol-z-order")&&void 0!==e.layout.get("symbol-sort-key").constantOr(1),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(e,i,r,a,n,s){let l=this._bucketParts;for(;this._currentTileIndex<e.length;)if(i.getBucketParts(l,a,e[this._currentTileIndex],this._sortAcrossTiles,s),this._currentTileIndex++,n())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,l.sort((e,i)=>e.sortKey-i.sortKey));this._currentPartIndex<l.length;){let e=l[this._currentPartIndex];if(i.placeLayerBucketPart(e,this._seenCrossTileIDs,r,0===e.symbolInstanceStart,s),this._currentPartIndex++,n())return!0}return!1}}class tj{constructor(e,i,r,a,n,s,l,h,u){this.placement=new tB(e,n,s,l,h,u),this._currentPlacementIndex=i.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=a,this._done=!1}isDone(){return this._done}continuePlacement(i,r,a,n,s){let l=e.q.now(),h=()=>{let i=e.q.now()-l;return!this._forceFullPlacement&&i>2};for(;this._currentPlacementIndex>=0;){let l=r[i[this._currentPlacementIndex]],u=this.placement.collisionIndex.transform.zoom;if("symbol"===l.type&&(!l.minzoom||l.minzoom<=u)&&(!l.maxzoom||l.maxzoom>u)){let i=l.layout.get("symbol-z-elevate"),r=void 0!==l.layout.get("symbol-sort-key").constantOr(1),u=l.layout.get("symbol-z-order"),c="viewport-y"===u||"auto"===u&&!("viewport-y"!==u&&r),d=l.layout.get("text-allow-overlap")||l.layout.get("icon-allow-overlap")||l.layout.get("text-ignore-placement")||l.layout.get("icon-ignore-placement"),p=c&&d,f=this._inProgressLayer=this._inProgressLayer||new tU(l),m=e.av(l.source,l.scope);if(f.continuePlacement(i||p?n[m]:a[m],this.placement,this._showCollisionBoxes,l,h,s))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}let tG=512/e.ab/2;class tq{constructor(i,r,a){this.tileID=i,this.bucketInstanceId=a,this.index=new e.bz(r.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];let n=i.canonical.x*e.ab,s=i.canonical.y*e.ab;
213for(let e=0;e<r.length;e++){let{key:i,crossTileID:a,tileAnchorX:l,tileAnchorY:h}=r.get(e),u=Math.floor((n+l)*tG),c=Math.floor((s+h)*tG);this.index.add(u,c),this.keys.push(i),this.crossTileIDs.push(a)}this.index.finish()}findMatches(i,r,a){let n=this.tileID.canonical.z<r.canonical.z?1:Math.pow(2,this.tileID.canonical.z-r.canonical.z),s=tG/Math.pow(2,r.canonical.z-this.tileID.canonical.z),l=r.canonical.x*e.ab,h=r.canonical.y*e.ab;for(let e=0;e<i.length;e++){let r=i.get(e);if(r.crossTileID)continue;let{key:u,tileAnchorX:c,tileAnchorY:d}=r,p=Math.floor((l+c)*s),f=Math.floor((h+d)*s);for(let e of this.index.range(p-n,f-n,p+n,f+n)){let i=this.crossTileIDs[e];if(this.keys[e]===u&&!a.has(i)){a.add(i),r.crossTileID=i;break}}}}}class tW{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class t${constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let i=Math.round((e-this.lng)/360);if(0!==i)for(let e in this.indexes){let r=this.indexes[e],a={};for(let e in r){let n=r[e];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+i),a[n.tileID.key]=n}this.indexes[e]=a}this.lng=e}addBucket(e,i,r){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===i.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let e=0;e<i.symbolInstances.length;e++)i.symbolInstances.get(e).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]=new Set);let a=this.usedCrossTileIDs[e.overscaledZ];for(let r in this.indexes){let n=this.indexes[r];if(Number(r)>e.overscaledZ)for(let r in n){let s=n[r];s.tileID.isChildOf(e)&&s.findMatches(i.symbolInstances,e,a)}else{let s=n[e.scaledTo(Number(r)).key];s&&s.findMatches(i.symbolInstances,e,a)}}for(let e=0;e<i.symbolInstances.length;e++){let n=i.symbolInstances.get(e);n.crossTileID||(n.crossTileID=r.generate(),a.add(n.crossTileID))}return void 0===this.indexes[e.overscaledZ]&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new tq(e,i.symbolInstances,i.bucketInstanceId),!0}removeBucketCrossTileIDs(e,i){for(let r of i.crossTileIDs)this.usedCrossTileIDs[e].delete(r)}removeStaleBuckets(e){let i=!1;for(let r in this.indexes){let a=this.indexes[r];for(let n in a)e[a[n].bucketInstanceId]||(this.removeBucketCrossTileIDs(r,a[n]),delete a[n],i=!0)}return i}}class tH{constructor(){this.layerIndexes={},this.crossTileIDs=new tW,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,i,r,a){let n=this.layerIndexes[e.fqid];void 0===n&&(n=this.layerIndexes[e.fqid]=new t$);let s=!1,l={};for(let h of("globe"!==a.name&&n.handleWrapJump(r),i)){let i=h.getBucket(e);i&&e.fqid===i.layerIds[0]&&(i.bucketInstanceId||(i.bucketInstanceId=++this.maxBucketInstanceId),n.addBucket(h.tileID,i,this.crossTileIDs)&&(s=!0),l[i.bucketInstanceId]=!0)}return n.removeStaleBuckets(l)&&(s=!0),s}pruneUnusedLayers(e){let i={};for(let r in e.forEach(e=>{i[e]=!0}),this.layerIndexes)i[r]||delete this.layerIndexes[r]}}class tZ{constructor(e,i,r,a){this.blendFunction=e,this.blendColor=i,this.mask=r,this.blendEquation=a}}tZ.Replace=[1,0,1,0],tZ.disabled=new tZ(tZ.Replace,e.bA.transparent,[!1,!1,!1,!1]),tZ.unblended=new tZ(tZ.Replace,e.bA.transparent,[!0,!0,!0,!0]),tZ.alphaBlended=new tZ([1,771,1,771],e.bA.transparent,[!0,!0,!0,!0]),tZ.alphaBlendedNonPremultiplied=new tZ([770,771,770,771],e.bA.transparent,[!0,!0,!0,!0]),tZ.multiply=new tZ([774,0,774,0],e.bA.transparent,[!0,!0,!0,!0]);class tX{constructor(e,i,r){this.func=e,this.mask=i,this.range=r}}tX.ReadOnly=!1,tX.ReadWrite=!0,tX.disabled=new tX(519,tX.ReadOnly,[0,1]);class tY{constructor(e,i,r,a,n,s){this.test=e,this.ref=i,this.mask=r,this.fail=a,this.depthFail=n,this.pass=s}}tY.disabled=new tY({func:519,mask:0},0,0,7680,7680,7680);class tJ{constructor(e,i,r){this.enable=e,this.mode=i,this.frontFace=r}}function tK(i,r){let a=e.bD(i,3);e.a6.mat4.fromQuat(i,r),e.bF(i,3,a)}function tQ(i,r){let a=e.a6.quat.identity([]);return e.a6.quat.rotateZ(a,a,-r),e.a6.quat.rotateX(a,a,-i),a}function t0(i,r){let a=[i[0],i[1],0],n=[r[0],r[1],0];if(e.a6.vec3.length(a)>=1e-15){let i=e.a6.vec3.normalize([],a);e.a6.vec3.scale(n,i,e.a6.vec3.dot(n,i)),r[0]=n[0],r[1]=n[1]}let s=e.a6.vec3.cross([],r,i);if(1e-15>e.a6.vec3.len(s))return null;let l=Math.atan2(-s[1],s[0]);return tQ(Math.atan2(Math.sqrt(i[0]*i[0]+i[1]*i[1]),-i[2]),l)}tJ.disabled=new tJ(!1,1029,2305),tJ.backCCW=new tJ(!0,1029,2305),tJ.backCW=new tJ(!0,1029,2304),tJ.frontCW=new tJ(!0,1028,2304),tJ.frontCCW=new tJ(!0,1028,2305);class t1{constructor(e,i){this.position=e,this.orientation=i}get position(){return this._position}set position(i){if(i){let r=i instanceof e.a5?i:new e.a5(i[0],i[1],i[2]);
213this._renderWorldCopies&&(r.x=e.bB(r.x,0,1)),this._position=r}else this._position=null}lookAtPoint(i,r){if(this.orientation=null,!this.position)return;let a=this.position,n=this._elevation?this._elevation.getAtPointOrZero(e.a5.fromLngLat(i)):0,s=e.a5.fromLngLat(i,n),l=[s.x-a.x,s.y-a.y,s.z-a.z];r||(r=[0,0,1]),r[2]=Math.abs(r[2]),this.orientation=t0(l,r)}setPitchBearing(i,r){this.orientation=tQ(e.bC(i),e.bC(-r))}}class t2{constructor(i,r){this._transform=e.a6.mat4.identity([]),this.orientation=r,this.position=i}get mercatorPosition(){let i=this.position;return new e.a5(i[0],i[1],i[2])}get position(){let i=e.bD(this._transform,3);return[i[0],i[1],i[2]]}set position(i){i&&e.bF(this._transform,3,[i[0],i[1],i[2],1])}get orientation(){return this._orientation}set orientation(i){this._orientation=i||e.a6.quat.identity([]),i&&tK(this._transform,this._orientation)}getPitchBearing(){let e=this.forward(),i=this.right();return{bearing:Math.atan2(-i[1],i[0]),pitch:Math.atan2(Math.sqrt(e[0]*e[0]+e[1]*e[1]),-e[2])}}setPitchBearing(e,i){this._orientation=tQ(e,i),tK(this._transform,this._orientation)}forward(){let i=e.bD(this._transform,2);return[-i[0],-i[1],-i[2]]}up(){let i=e.bD(this._transform,1);return[-i[0],-i[1],-i[2]]}right(){let i=e.bD(this._transform,0);return[i[0],i[1],i[2]]}getCameraToWorld(i,r){let a=new Float64Array(16);return e.a6.mat4.invert(a,this.getWorldToCamera(i,r)),a}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(i,r,a){let n=this.position;e.a6.vec3.scale(n,n,-i);let s=new Float64Array(16);return e.a6.mat4.fromScaling(s,[a,a,a]),e.a6.mat4.translate(s,s,n),s[10]*=r,s}getWorldToCamera(i,r){let a=new Float64Array(16),n=new Float64Array(4),s=this.position;return e.a6.quat.conjugate(n,this._orientation),e.a6.vec3.scale(s,s,-i),e.a6.mat4.fromQuat(a,n),e.a6.mat4.translate(a,a,s),a[1]*=-1,a[5]*=-1,a[9]*=-1,a[13]*=-1,a[8]*=r,a[9]*=r,a[10]*=r,a[11]*=r,a}getCameraToClipPerspective(i,r,a,n){let s=new Float64Array(16);return e.a6.mat4.perspective(s,i,r,a,n),s}getCameraToClipOrthographic(i,r,a,n,s,l){let h=new Float64Array(16);return e.a6.mat4.ortho(h,i,r,a,n,s,l),h}getDistanceToElevation(i,r=!1){let a=0===i?0:e.bE(i,r?e.aN(this.position[1]):this.position[1]),n=this.forward();return(a-this.position[2])/n[2]}clone(){return new t2([...this.position],[...this.orientation])}}let t3={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,LUT:10,ShadowMap0:11};class t4{constructor(e=0,i=0,r=0,a=0){if(isNaN(e)||e<0||isNaN(i)||i<0||isNaN(r)||r<0||isNaN(a)||a<0)throw Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=i,this.left=r,this.right=a}interpolate(i,r,a){return null!=r.top&&null!=i.top&&(this.top=e.aa(i.top,r.top,a)),null!=r.bottom&&null!=i.bottom&&(this.bottom=e.aa(i.bottom,r.bottom,a)),null!=r.left&&null!=i.left&&(this.left=e.aa(i.left,r.left,a)),null!=r.right&&null!=i.right&&(this.right=e.aa(i.right,r.right,a)),this}getCenter(i,r){let a=e.ap((this.left+i-this.right)/2,0,i),n=e.ap((this.top+r-this.bottom)/2,0,r);return new e.P(a,n)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new t4(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}let t5=(e,i,r)=>(1-r)*e+r*i,t6=e=>e*e*e*e*e;class t8{constructor(i,r,a,n,s,l,h){this.tileSize=512,this._renderWorldCopies=void 0===s||s,this._minZoom=i||0,this._maxZoom=r||22,this._minPitch=a??0,this._maxPitch=n??60,this.setProjection(l),this.setMaxBounds(h),this.width=0,this.height=0,this._center=new e.bL(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new t4,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new t2,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._tileCoverLift=0,this.freezeTileCoverage=!1,this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1}clone(){let e=new t8(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection());return e._elevation=this._elevation,e._centerAltitude=this._centerAltitude,e._centerAltitudeValidForE
213xaggeration=this._centerAltitudeValidForExaggeration,e.tileSize=this.tileSize,e.mercatorFromTransition=this.mercatorFromTransition,e.width=this.width,e.height=this.height,e.cameraElevationReference=this.cameraElevationReference,e._center=this._center,e._setZoom(this.zoom),e._seaLevelZoom=this._seaLevelZoom,e.angle=this.angle,e._fov=this._fov,e._pitch=this._pitch,e._nearZ=this._nearZ,e._farZ=this._farZ,e._averageElevation=this._averageElevation,e._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,e._unmodified=this._unmodified,e._edgeInsets=this._edgeInsets.clone(),e._camera=this._camera.clone(),e._calcMatrices(),e.freezeTileCoverage=this.freezeTileCoverage,e.frustumCorners=this.frustumCorners,e}get isOrthographic(){return"globe"!==this.projection.name&&this._orthographicProjectionAtLowPitch&&this.pitch<15}get elevation(){return this._elevation}set elevation(e){this._elevation!==e&&(this._elevation=e,this._updateCameraOnTerrain(),this._calcMatrices())}get depthOcclusionForSymbolsAndCircles(){return"globe"!==this.projection.name&&!this.isOrthographic}updateElevation(e,i=!1){let r=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForE
213xaggeration;(null==this._seaLevelZoom||r)&&this._updateCameraOnTerrain(),(e||r)&&this._constrainCamera(i),this._calcMatrices()}getProjection(){return e.ar(this.projection,["name","center","parallels"])}setProjection(i){this.projectionOptions=i||{name:"mercator"};let r=this.projection?this.getProjection():void 0;this.projection=e.bM(this.projectionOptions);let a=this.getProjection(),n=!e.bi(r,a);return n&&this._calcMatrices(),this.mercatorFromTransition=!1,n}setOrthographicProjectionAtLowPitch(e){return this._orthographicProjectionAtLowPitch!==e&&(this._orthographicProjectionAtLowPitch=e,this._calcMatrices(),!0)}setMercatorFromTransition(){let i=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=e.bM({name:"mercator"});let r=i!==this.projection.name;return r&&this._calcMatrices(),r}get minZoom(){return this._minZoom}set minZoom(e){this._minZoom!==e&&(this._minZoom=e,this.zoom=Math.max(this.zoom,e))}get maxZoom(){return this._maxZoom}set maxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.zoom=Math.min(this.zoom,e))}get minPitch(){return this._minPitch}set minPitch(e){this._minPitch!==e&&(this._minPitch=e,this.pitch=Math.max(this.pitch,e))}get maxPitch(){return this._maxPitch}set maxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.pitch=Math.min(this.pitch,e))}get renderWorldCopies(){return this._renderWorldCopies&&!0===this.projection.supportsWorldCopies}set renderWorldCopies(e){void 0===e?e=!0:null===e&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){let e=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(e))}get cameraWorldSize(){let e=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(e))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return e.bE(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new e.P(this.width,this.height)}get bearing(){return e.bB(this.rotation,-180,180)}set bearing(e){this.rotation=e}get rotation(){return-this.angle/Math.PI*180}set rotation(i){let r=-i*Math.PI/180;this.angle!==r&&(this._unmodified=!1,this.angle=r,this._calcMatrices(),this.rotationMatrix=e.a6.mat2.create(),e.a6.mat2.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(i){let r=e.ap(i,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==r&&(this._unmodified=!1,this._pitch=r,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}get fovX(){return this._fov}get fovY(){let e=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/e)}set fov(i){i=Math.max(.01,Math.min(60,i)),this._fov!==i&&(this._unmodified=!1,this._fov=e.bC(i),this._calcMatrices())}get averageElevation(){return this._averageElevation}set averageElevation(e){this._averageElevation=e,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(e){let i=Math.min(Math.max(e,this.minZoom),this.maxZoom);this._zoom!==i&&(this._unmodified=!1,this._setZoom(i),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(e){this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom}get tileCoverLift(){return this._tileCoverLift}set tileCoverLift(e){this._tileCoverLift!==e&&(this._tileCoverLift=e)}_updateCameraOnTerrain(){let e=this.elevation?this.elevation.getAtPoint(this.locationCoordinate(this.center),Number.NEGATIVE_INFINITY):Number.NEGATIVE_INFINITY,i=this.elevation&&e===Number.NEGATIVE_INFINITY&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>
2130&&this._centerAltitudeValidForExaggeration;if(!this._elevation||e===Number.NEGATIVE_INFINITY&&(!i||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);let r=this._elevation;i||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&r.exaggeration()&&this._centerAltitudeValidForExaggeration!==r.exaggeration()?this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*r.exaggeration():this._centerAltitude=e||0,this._centerAltitudeValidForExaggeration=r.exaggeration(),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){void 0!==this._centerAltitudeValidForExaggeration&&(this._seaLevelZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize))}sampleAverageElevation(){if(!this._elevation)return 0;let i=this._elevation,r=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],a=this.horizonLineFromTop(),n=0,s=0;for(let l=0;l<r.length;l++){let h=new e.P(r[l][0]*this.width,a+r[l][1]*(this.height-a)),u=i.pointCoordinate(h);if(!u)continue;let c=1/Math.hypot(u[0]-this._camera.position[0],u[1]-this._camera.position[1]);n+=u[3]*c,s+=c}return 0===s?NaN:n/s}get center(){return this._center}set center(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._terrainEnabled()&&("ground"===this.cameraElevationReference?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(null==this._seaLevelZoom||!this._elevation)return;let e=this._seaLevelZoom,i=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),r=this.pixelsPerMeter/this.worldSize*i,a=Math.max(this._mercatorZfromZoom(e)-r,this._mercatorZfromZoom(this._maxZoom));this._setZoom(this._zoomFromMercatorZ(a))}get padding(){return this._edgeInsets.toJSON()}set padding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}computeZoomRelativeTo(i){let r;let a=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,i.toAltitude()));r=i.z<this._camera.position[2]?[a.x,a.y,a.z]:[i.x,i.y,i.z];let n=e.a6.vec3.length(e.a6.vec3.sub([],this._camera.position,r));return e.ap(this._zoomFromMercatorZ(n),this._minZoom,this._maxZoom)}setFreeCameraOptions(i){if(!this.height||!i.position&&!i.orientation)return;this._updateCameraState();let r=!1;if(i.orientation&&!e.a6.quat.exactEquals(i.orientation,this._camera.orientation)&&(r=this._setCameraOrientation(i.orientation)),i.position){let a=[i.position.x,i.position.y,i.position.z];e.a6.vec3.exactEquals(a,this._camera.position)||(this._setCameraPosition(a),r=!0)}r&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();let i=this._camera.position,r=new t1;return r.position=new e.a5(i[0],i[1],i[2]),r.orientation=this._camera.orientation,r._elevation=this.elevation,r._renderWorldCopies=this.renderWorldCopies,r}_setCameraOrientation(i){if(!e.a6.quat.length(i))return!1;e.a6.quat.normalize(i,i);let r=e.a6.vec3.transformQuat([],[0,0,-1],i),a=e.a6.vec3.transformQuat([],[0,-1,0],i);if(a[2]<0)return!1;let n=t0(r,a);return!!n&&(this._camera.orientation=n,!0)}_setCameraPosition(i){let r=this.zoomScale(this.minZoom)*this.tileSize,a=this.zoomScale(this.maxZoom)*this.tileSize,n=this.cameraToCenterDistance;i[2]=e.ap(i[2],n/a,n/r),this._camera.position=i}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,i,r){this._unmodified=!1,this._edgeInsets.interpolate(e,i,r),this._constrain(),this._calcMatrices()}coveringZoomLevel(e){return Math.max(0,(e.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/e.tileSize)))}getVisibleUnwrappedCoordinates(i){let r=[new e.bN(0,i)];if(this.renderWorldCopies){let a=this.pointCoordinate(new e.P(0,0)),n=this.pointCoordinate(new e.P(this.width,0)),s=this.pointCoordinate(new e.P(this.width,this.height)),l=this.pointCoordinate(new e.P(0,this.height)),h=Math.floor(Math.min(a.x,n.x,s.x,l.x)),u=Math.floor(Math.max(a.x,n.x,s.x,l.x));for(let a=h-1;a<=u+1;a++)0!==a&&r.push(new e.bN(a,i))}return r}isLODDisabled(e){return(!e||this.pitch<=60)&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace}extendTileCover(i,r,a){let n=[],s=void 0!==a,l=!s;if(l&&this.zoom<r||s&&0===a[0]&&0===a[1])return n;let h=new Set,u=(i,r,a,s,l)=>{let u=e.c2(r,i,a,s,l);h.has(u)||(n.push(new e.aA(i,r,a,s,l)),h.add(u))};for(let e=0;e<i.length;e++){let n=i[e];if(l&&n.canonical.z!==r)continue;let h=n.canonical,c=n.overscaledZ,d=n.wrap,p=1<<h.z,f=h.x+1<p,m=h.x>0,_=h.y+1<p,g=h.y>0,y=n.wrap-+!m,x=n.wrap+ +!f,v=m?h.x-1:p-1,b=f?h.x+1:0;if(s)a[0]<0?(u(c,x,h.z,b,h.y),a[1]<0&&_&&(u(c,d,h.z,h.x,h.y+1),u(c,x,h.z,b,h.y+1)),a[1]>0&&g&&(u(c,d,h.z,h.x,h.y-1),u(c,x,h.z,b,h.y-1))):a[0]>0?(u(c,y,h.z,v,h.y),a[1]<0&&_&&(u(c,d,h.z,h.x,h.y+1),u(c,y,h.z,v,h.y+1)),a[1]>0&&g&&(u(c,d,h.z,h.x,h.y-1),u(c,y,h.z,v,h.y-1))):a[1]<0&&_?u(c,d,h.z,h.x,h.y+1):g&&u(c,d,h.z,h.x,h.y-1);else{let e=n.visibleQuadrants;1&e&&(u(c,y,h.z,v,h.y),g&&(u(c,d,h.z,h.x,h.y-1),u(c,y,h.z,v,h.y-1))),2&e&&(u(c,x,h.z,b,h.y),g&&(u(c,d,h.z,h.x,h.y-1),u(c,x,h.z,b,h.y-1))),4&e&&(u(c,y,h.z,v,h.y),_&&(u(c,d,h.z,h.x,h.y+1),u(c,y,h.z,v,h.y+1))),8&e&&(u(c,x,h.z,b,h.y),_&&(u(c,d,h.z,h.x,h.y+1),u(c,x,h.z,b,h.y+1)))}}let c=[];for(let e of n)n.some(i=>e.isChildOf(i))||c.push(e);if(n=c.filter(e=>!i.some(i=>!!(e.overscaledZ<r&&i.isChildOf(e))||e.equals(i)||e.isChildOf(i))),l){let e=1<<r,i="globe"===this.projection.name?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),a=[e*i.x,e*i.y];n=n.filter(e=>{let i=e.canonical.x+.5-a[0],r=e.canonical.y+.5-a[1];return i*i+r*r<16})}return n}coveringTiles(i){let r,a=this.coveringZoomLevel(i),n=a,s=this.elevation&&this.elevation.exaggeration(),l=s&&!i.isTerrainDEM,h="mercator"===this.projection.name;if(void 0!==i.minzoom&&a<i.minzoom)return[];void 0!==i.maxzoom&&a>i.maxzoom&&(a=i.maxzoom);let u=this.locationCoordinate(this.center),c=this.center.lat,d=1<<a,p=[d*u.x,d*u.y,0],f="globe"===this.projection.name,m=!f,_=e.bO.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,a,m),g=f?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),y=d*e.bE(1,this.center.lat),x=this._camera.position[2]/e.bE(1,this.center.lat),v=[d*g.x,d*g.y,x*(m?1:y)],b=f||s,w=this.cameraToCenterDistance/i.tileSize*(i.roundZoom?1:.502),T=this.isLODDisabled(!0)?a:0;if(this._elevation&&i.isTerrainDEM)r=1e4*this._elevation.exaggeration();else if(this._elevation){let e=this._elevation.getMinMaxForVisibleTiles();r=e?e.max:this._centerAltitude}else r=this._centerAltitude;let S=i.isTerrainDEM?-r:this._elevation?this._elevation.getMinElevationBelowMSL():0,M=this.projection.isReprojectedInTileSpace?e.bP(this):1,E=i=>{let r=1/4e4,a=new e.a5(i.x+r,i.y,i.z),n=new e.a5(i.x,i.y+r,i.z),s=i.toLngLat(),l=a.toLngLat(),h=n.toLngLat(),u=this.locationCoordinate(s),c=this.locationCoordinate(l),d=this.locationCoordinate(h);return Math.sqrt(Math.hypot(c.x-u.x,c.y-u.y)*Math.hypot(d.x-u.x,d.y-u.y))*M/r},A=i=>{let a=r;return{aabb:e.bS(this,d,0,0,0,i,S,a,this.projection),zoom:0,x:0,y:0,minZ:S,maxZ:a,wrap:i,fullyVisible:!1}},I=[],C=[],P=a,L=i.reparseOverscaled?n:a,k=(x-this._centerAltitude)*y,R=e=>{if(!this._elevation||!e.tileID||!h)return;let i=this._elevation.getMinMaxForTile(e.tileID),r=e.aabb;i?(r.min[2]=i.min,r.max[2]=i.max,r.center[2]=(r.min[2]+r.max[2])/2):(e.shouldSplit=D(e),e.shouldSplit||(r.min[2]=r.max[2]=r.center[2]=this._centerAltitude))},z=(e,i)=>{if(.707*i<e)return 1;let r=i/e;return r/(1.4144271570014144+(Math.pow(1.1,r-1.4144271570014144+1)-1)/(1.1-1)-1)},D=i=>{if(i.zoom<T)return!0;
213if(i.zoom===P)return!1;if(null!=i.shouldSplit)return i.shouldSplit;let r=i.aabb.distanceX(v),a=i.aabb.distanceY(v),s=k,u=1;if(f){s=i.aabb.distanceZ(v);let r=Math.pow(2,i.zoom),a=Math.min(Math.max(c,e.aN((i.y+1)/r)),e.aN(i.y/r)),n=e.c6(a)/e.c6(c);if(u=a===c?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,n/this._mercatorScaleRatio),this.zoom<=e.c3&&i.zoom===P-1&&n>=.9)return!0}else if(l&&(s=i.aabb.distanceZ(v)*y),this.projection.isReprojectedInTileSpace&&n<=5){let r=Math.pow(2,i.zoom),a=E(new e.a5((i.x+.5)/r,(i.y+.5)/r));u=a>.85?1:a}if(!h){let e=Math.sqrt(r*r+a*a+s*s),n=(1<<P-i.zoom)*w*u;return n*=z(Math.max(s,k),e),e<n}let d=Number.MAX_VALUE,m=0,_=i.aabb.getCorners(),g=[];for(let i of _){e.a6.vec3.sub(g,i,v),f||(l?g[2]*=y:g[2]=k);let r=e.a6.vec3.dot(g,this._camera.forward());r<d&&(d=r,m=Math.abs(g[2]))}let x=(1<<P-i.zoom)*w*u;if(x*=z(Math.max(m,k),d),d<x)return!0;let b=i.aabb.closestPoint(p);return b[0]===p[0]&&b[1]===p[1]};if(this.renderWorldCopies)for(let e=1;e<=3;e++)I.push(A(-e)),I.push(A(e));for(I.push(A(0));I.length>0;){let r=I.pop(),n=r.x,s=r.y,u=r.fullyVisible,c=()=>"globe"===this.projection.name&&(0===r.y||r.y===(1<<r.zoom)-1);if(!u){let i=b?r.aabb.intersects(_):r.aabb.intersectsFlat(_);if(0===i&&c()){let a=new e.bQ(r.zoom,n,s);i=e.bR(this,d,a,!0).intersects(_)}if(0===i)continue;u=2===i}if(r.zoom!==P&&D(r))for(let i=0;i<4;i++){let a=(n<<1)+i%2,c=(s<<1)+(i>>1),p={aabb:h?r.aabb.quadrant(i):e.bS(this,d,r.zoom+1,a,c,r.wrap,r.minZ,r.maxZ,this.projection),zoom:r.zoom+1,x:a,y:c,wrap:r.wrap,fullyVisible:u,tileID:void 0,shouldSplit:void 0,minZ:r.minZ,maxZ:r.maxZ};l&&!f&&(p.tileID=new e.aA(r.zoom+1===P?L:r.zoom+1,r.wrap,r.zoom+1,a,c),R(p)),I.push(p)}else{let l=r.zoom===P?L:r.zoom;if(i.minzoom&&i.minzoom>l)continue;let h=0;if(!u){let a=b?r.aabb.intersectsPrecise(_):r.aabb.intersectsPreciseFlat(_);if(0===a&&c()){let i=new e.bQ(r.zoom,n,s);a=e.bR(this,d,i,!0).intersectsPrecise(_)}if(0===a)continue;if(i.calculateQuadrantVisibility){if(_.containsPoint(r.aabb.center))h=15;else for(let e=0;e<4;e++)0!==r.aabb.quadrant(e).intersects(_)&&(h|=1<<e)}}let f=p[0]-(.5+n+(r.wrap<<r.zoom))*(1<<a-r.zoom),m=p[1]-.5-s,g=r.tileID?r.tileID:new e.aA(l,r.wrap,r.zoom,n,s);i.calculateQuadrantVisibility&&(g.visibleQuadrants=h),C.push({tileID:g,distanceSq:f*f+m*m})}}if(this.fogCullDistSq){let a=this.fogCullDistSq,n=this.horizonLineFromTop();C=C.filter(s=>{let l=[0,0,0,1],h=[e.ab,e.ab,0,1],u=this.calculateFogTileMatrix(s.tileID.toUnwrapped());e.a6.vec4.transformMat4(l,l,u),e.a6.vec4.transformMat4(h,h,u);let c=e.a6.vec4.min([],l,h),d=e.a6.vec4.max([],l,h),p=e.bT(c,d);if(0===p)return!0;let f=!1,m=this._elevation;if(m&&p>a&&0!==n){let a;let l=this.calculateProjMatrix(s.tileID.toUnwrapped());i.isTerrainDEM||(a=m.getMinMaxForTile(s.tileID)),a||(a={min:S,max:r});let h=e.c4(this.rotation),u=[h[0]*e.ab,h[1]*e.ab,a.max];e.a6.vec3.transformMat4(u,u,l),f=(1-u[1])*this.height*.5<n}return p<a||f})}return C.sort((e,i)=>e.distanceSq-i.distanceSq).map(e=>e.tileID)}resize(e,i){this.width=e,this.height=i,this.pixelsToGLUnits=[2/e,-2/i],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(e){return Math.pow(2,e)}scaleZoom(e){return Math.log(e)/Math.LN2}project(i){let r=e.ap(i.lat,-e.bU,e.bU),a=this.projection.project(i.lng,r);return new e.P(a.x*this.worldSize,a.y*this.worldSize)}unproject(e){return this.projection.unproject(e.x/this.worldSize,e.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/e.bE(1,this.center.lat)/this.worldSize}setLocationAtPoint(i,r){let a,n;let s=this.centerPoint;if("globe"===this.projection.name){let e=this.worldSize;a=(r.x-s.x)/e,n=(r.y-s.y)/e}else{let e=this.pointCoordinate(r),i=this.pointCoordinate(s);a=e.x-i.x,n=e.y-i.y}let l=this.locationCoordinate(i);this.setLocation(new e.a5(l.x-a,l.y-n))}setLocation(e){this.center=this.coordinateLocation(e),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(e){return this.projection.locationPoint(this,e)}locationPoint3D(e){return this.projection.locationPoint(this,e,!0)}pointLocation(e){return this.coordinateLocation(this.pointCoordinate(e))}pointLocation3D(e){return this.coordinateLocation(this.pointCoordinate3D(e))}locationCoordinate(i,r){let a=r?e.bE(r,i.lat):void 0,n=this.projection.project(i.lng,i.lat);return new e.a5(n.x,n.y,a)}coordinateLocation(e){return this.projection.unproject(e.x,e.y)}pointRayIntersection(i,r){let a=null!=r?r:this._centerAltitude,n=[i.x,i.y,0,1],s=[i.x,i.y,1,1];e.a6.vec4.transformMat4(n,n,this.pixelMatrixInverse),e.a6.vec4.transformMat4(s,s,this.pixelMatrixInverse);let l=s[3];e.a6.vec4.scale(n,n,1/n[3]),e.a6.vec4.scale(s,s,1/l);let h=n[2],u=s[2];return{p0:n,p1:s,t:h===u?0:(a-h)/(u-h)}}screenPointToMercatorRay(i){let r=[i.x,i.y,0,1],a=[i.x,i.y,1,1];return e.a6.vec4.transformMat4(r,r,this.pixelMatrixInverse),e.a6.vec4.transformMat4(a,a,this.pixelMatrixInverse),e.a6.vec4.scale(r,r,1/r[3]),e.a6.vec4.scale(a,a,1/a[3]),r[2]=e.bE(r[2],this._center.lat)*this.worldSize,a[2]=e.bE(a[2],this._center.lat)*this.worldSize,e.a6.vec4.scale(r,r,1/this.worldSize),e.a6.vec4.scale(a,a,1/this.worldSize),new e.aj([r[0],r[1],r[2]],e.a6.vec3.normalize([],e.a6.vec3.sub([],a,r)))}rayIntersectionCoordinate(i){let{p0:r,p1:a,t:n}=i,s=e.bE(r[2],this._center.lat),l=e.bE(a[2],this._center.lat);return new e.a5(e.aa(r[0],a[0],n)/this.worldSize,e.aa(r[1],a[1],n)/this.worldSize,e.aa(s,l,n))}pointCoordinate(e,i=this._centerAltitude){return this.projection.pointCoordinate(this,e.x,e.y,i)}pointCoordinate3D(i){if(!this.elevation)return this.pointCoordinate(i);let r=this.projection.pointCoordinate3D(this,i.x,i.y);if(r)return new e.a5(r[0],r[1],r[2]);let a=0,n=this.horizonLineFromTop();if(i.y>n)return this.pointCoordinate(i);let s=.02*n,l=i.clone();for(let i=0;i<10&&n-a>s;i++){l.y=e.aa(a,n,.66);let i=this.projection.pointCoordinate3D(this,l.x,l.y);
213i?(n=l.y,r=i):a=l.y}return r?new e.a5(r[0],r[1],r[2]):this.pointCoordinate(i)}isPointAboveHorizon(e){return this.projection.isPointAboveHorizon(this,e)}isPointOnSurface(i){if(i.y<0||i.y>this.height||i.x<0||i.x>this.width)return!1;if(this.elevation||this.zoom>=e.bV)return!this.isPointAboveHorizon(i);let r=this.pointCoordinate(i);return r.y>=0&&r.y<=1}_coordinatePoint(i,r){let a=r&&this.elevation?this.elevation.getAtPointOrZero(i,this._centerAltitude):this._centerAltitude,n=[i.x*this.worldSize,i.y*this.worldSize,a+i.toAltitude(),1];return e.a6.vec4.transformMat4(n,n,this.pixelMatrix),n[3]>0?new e.P(n[0]/n[3],n[1]/n[3]):new e.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){let{top:i,left:r}=this._edgeInsets,a=this.height-this._edgeInsets.bottom,n=this.width-this._edgeInsets.right,s=this.pointLocation3D(new e.P(r,i)),l=this.pointLocation3D(new e.P(n,i)),h=this.pointLocation3D(new e.P(n,a)),u=this.pointLocation3D(new e.P(r,a)),c=Math.min(s.lng,l.lng,h.lng,u.lng),d=Math.max(s.lng,l.lng,h.lng,u.lng),p=Math.min(s.lat,l.lat,h.lat,u.lat),f=Math.max(s.lat,l.lat,h.lat,u.lat),m=Math.pow(2,-this.zoom)/16*270,_="globe"===this.projection.name?1:4,g=(i,r,a,n,s)=>{let l=(i+a)/2,h=(r+n)/2,u=new e.P(l,h),{lng:y,lat:x}=this.pointLocation3D(u),v=Math.max(0,c-y,p-x,y-d,x-f);c=Math.min(c,y),d=Math.max(d,y),p=Math.min(p,x),f=Math.max(f,x),(s<_||v>m)&&(g(i,r,l,h,s+1),g(l,h,a,n,s+1))};if(g(r,i,n,i,1),g(n,i,n,a,1),g(n,a,r,a,1),g(r,a,r,i,1),"globe"===this.projection.name){let[i,r]=e.bW(this);i?(f=90,d=180,c=-180):r&&(p=-90,d=180,c=-180)}return new e.as(new e.bL(c,p),new e.bL(d,f))}_getBoundsRectangular(i,r){let a,n,s,l;let{top:h,left:u}=this._edgeInsets,c=this.height-this._edgeInsets.bottom,d=this.width-this._edgeInsets.right,p=new e.P(u,h),f=new e.P(d,h),m=new e.P(d,c),_=new e.P(u,c),g=this.pointCoordinate(p,i),y=this.pointCoordinate(f,i),x=this.pointCoordinate(m,r),v=this.pointCoordinate(_,r);return g.y>1&&y.y>=0?g=new e.a5((1-v.y)/(((a=g).y-v.y)/(a.x-v.x))+v.x,1):g.y<0&&y.y<=1&&(g=new e.a5(-v.y/(((n=g).y-v.y)/(n.x-v.x))+v.x,0)),y.y>1&&g.y>=0?y=new e.a5((1-x.y)/(((s=y).y-x.y)/(s.x-x.x))+x.x,1):y.y<0&&g.y<=1&&(y=new e.a5(-x.y/(((l=y).y-x.y)/(l.x-x.x))+x.x,0)),(new e.as).extend(this.coordinateLocation(g)).extend(this.coordinateLocation(y)).extend(this.coordinateLocation(v)).extend(this.coordinateLocation(x))}_getBoundsRectangularTerrain(){let e=this.elevation;if(!e.visibleDemTiles.length||e.isUsingMockSource())return this._getBoundsRectangular(0,0);let i=e.visibleDemTiles.reduce((e,i)=>{if(i.dem){let r=i.dem.tree;e.min=Math.min(e.min,r.minimums[0]),e.max=Math.max(e.max,r.maximums[0])}return e},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(i.min*e.exaggeration(),i.max*e.exaggeration())}getBounds(){return"mercator"===this.projection.name||"equirectangular"===this.projection.name?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(e=!0){let i=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,r=this.height/2-i*(1-this._horizonShift);return e?Math.max(0,r):r}getMaxBounds(){return this.maxBounds}setMaxBounds(i){this.maxBounds=i,this.minLat=-e.bU,this.maxLat=e.bU,this.minLng=-180,this.maxLng=180,i&&(this.minLat=i.getSouth(),this.maxLat=i.getNorth(),this.minLng=i.getWest(),this.maxLng=i.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=e.am(this.minLng)*this.tileSize,this.worldMaxX=e.am(this.maxLng)*this.tileSize,this.worldMinY=e.at(this.maxLat)*this.tileSize,this.worldMaxY=e.at(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(e,i){return this.projection.createTileMatrix(this,i,e)}calculateDistanceTileData(i){let r=i.key,a=this._distanceTileDataCache;if(a[r])return a[r];let n=i.canonical,s=1/this.height,l=this.cameraWorldSize,h=l/this.zoomScale(n.z),u=(n.x+Math.pow(2,n.z)*i.wrap)*h,c=n.y*h,d=this.point;d.x*=l/this.worldSize,d.y*=l/this.worldSize;let p=this.angle,f=Math.sin(-p),m=-Math.cos(-p);return a[r]={bearing:[f,m],center:[(d.x-u)*s,(d.y-c)*s],scale:h/e.ab*s},a[r]}calculateFogTileMatrix(i){let r=i.key,a=this._fogTileMatrixCache;if(a[r])return a[r];let n=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,i);return e.a6.mat4.multiply(n,this.worldToFogMatrix,n),a[r]=new Float32Array(n),a[r]}calculateProjMatrix(i,r=!1,a=!1){let n,s;let l=i.key;if((n=a?this._expandedProjMatrixCache:r?this._alignedProjMatrixCache:this._projMatrixCache)[l])return n[l];let h=this.calculatePosMatrix(i,this.worldSize);return s=this.projection.isReprojectedInTileSpace?this.mercatorMatrix:a?this.expandedFarZProjMatrix:r?this.alignedProjMatrix:this.projMatrix,e.a6.mat4.multiply(h,s,h),n[l]=new Float32Array(h),n[l]}calculatePixelsToTileUnitsMatrix(i){let r=i.tileID.key,a=this._pixelsToTileUnitsCache;if(a[r])return a[r];let n=e.bX(i,this);return a[r]=n,a[r]}customLayerMatrix(){return this.mercatorMatrix.slice()}globeToMercatorMatrix(){if("globe"===this.projection.name){let i=1/this.worldSize,r=e.a6.mat4.fromScaling([],[i,i,i]);return e.a6.mat4.multiply(r,r,this.globeMatrix),r}}recenterOnTerrain(){if(!this._elevation||"globe"===this.projection.name)return;let i=this._elevation;this._updateCameraState();let r=e.bE(1,this._center.lat)*this.worldSize,a=this._computeCameraPosition(r),n=this._camera.forward(),s=e.bE(1,this._center.lat);a[2]/=s,n[2]/=s,e.a6.vec3.normalize(n,n);let l=i.raycast(a,n,i.exaggeration());if(l){let i=e.a6.vec3.scaleAndAdd([],a,n,l),r=new e.a5(i[0],i[1],e.bE(i[2],e.aN(i[1]))),h=(r.z+e.a6.vec3.length([r.x-a[0],r.y-a[1],r.z-a[2]*s]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(h),this._centerAltitude=r.toAltitude(),this._center=this.coordinateLocation(r),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCamera(i=!1){if(!this._elevation)return;let r=this._elevation,a=e.bE(1,this._center.lat)*this.worldSize,n=this._computeCameraPosition(a),s=r.getAtPointOrZero(new e.a5(...n)),l=this.pixelsPerMeter/this.worldSize*s,h=this._minimumHeightOverTerrain(),u=n[2]-l;if(u<=h){if(u<0||i){let i=this.locationCoordinate(this._center,this._centerAltitude),r=[n[0],n[1],i.z-n[2]],a=e.a6.vec3.length(r);r[2]-=(h-u)/this._pixelsPerMercatorPixel;let s=e.a6.vec3.length(r);if(0===s)return;e.a6.vec3.scale(r,r,a/s*this._pixelsPerMercatorPixel),this._camera.position=[n[0],n[1],i.z*this._pixelsPerMercatorPixel-r[2]],this._updateStateFromCamera()}else this._isCameraConstrained=!0}}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let i="globe"===this.projection.name||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||i){let r=this.center;return r.lat=e.ap(r.lat,this.minLat,this.maxLat),!this.maxBounds&&(this.renderWorldCopies||i)||(r.lng=e.ap(r.lng,this.minLng,this.maxLng)),this.center=r,void(this._constraining=!1)}let r=this._unmodified,{x:a,y:n}=this.point,s=0,l=a,h=n,u=this.width/2,c=this.height/2,d=this.worldMinY*this.scale,p=this.worldMaxY*this.scale;if(n-c<d&&(h=d+c),n+c>p&&(h=p-c),p-d<this.height&&(s=Math.max(s,this.height/(p-d)),h=(p+d)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){let e=this.worldMinX*this.scale,i=this.worldMaxX*this.scale,r=this.worldSize/2-(e+i)/2;(l=(a+r+this.worldSize)%this.worldSize-r)-u<e&&(l=e+u),l+u>i&&(l=i-u),i-e<this.width&&(s=Math.max(s,this.width/(i-e)),l=(i+e)/2)}l===a&&h===n||(this.center=this.unproject(new e.P(l,h))),s&&(this.zoom+=this.scaleZoom(s)),this._constrainCamera(),this._unmodified=r,this._constraining=!1}_minZoomForBounds(){let e=Math.max(0,this.scaleZoom(this.height/(this.worldMaxY-this.worldMinY)));return this.maxBounds&&(e=Math.max(e,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),e}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}_calcMatrices(){let i;if(!this.height)return;let r=this.centerOffset,a="globe"===this.projection.name,n=this.pixelsPerMeter;"globe"===this.projection.name&&(this._mercatorScaleRatio=e.bE(1,this.center.lat)/e.b
213E(1,e.c5));let s=e.bY(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,s),this.cameraToCenterDistance=.5/Math.tan(.5*this._fov)*this.height*this._pixelsPerMercatorPixel,this._updateCameraState(),this._farZ=this.projection.farthestPixelDistance(this),this._nearZ=this.height/50;let l="meters"===this.projection.zAxisUnit?n:1,h=this._camera.getWorldToCamera(this.worldSize,l),u=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);if(u[8]=-(2*r.x)/this.width,u[9]=2*r.y/this.height,this.isOrthographic){let e=.5*this.height/Math.tan(this._fov/2)*1*Math.tan(.5*this._fov),a=e*this.aspect,n=-a,s=-e;a-=r.x,n-=r.x,e+=r.y,s+=r.y,((e,i,r,a)=>{for(let n=0;n<16;n++)e[n]=t5(i[n],r[n],a)})(i=this._camera.getCameraToClipOrthographic(n,a,s,e,this._nearZ,this._farZ),i,u,t6(this.pitch>=15?1:this.pitch/15))}else i=u;let c=e.a6.mat4.mul([],u,h),d=e.a6.mat4.mul([],i,h);if(this.projection.isReprojectedInTileSpace){let i=this.locationCoordinate(this.center),r=e.a6.mat4.identity([]);e.a6.mat4.translate(r,r,[i.x*this.worldSize,i.y*this.worldSize,0]),e.a6.mat4.multiply(r,r,e.bZ(this)),e.a6.mat4.translate(r,r,[-i.x*this.worldSize,-i.y*this.worldSize,0]),e.a6.mat4.multiply(d,d,r),e.a6.mat4.multiply(c,c,r),this.inverseAdjustmentMatrix=e.b_(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=e.a6.mat4.scale([],d,[this.worldSize,this.worldSize,this.worldSize/l,1]),this.projMatrix=d,this.invProjMatrix=e.a6.mat4.invert(new Float64Array(16),this.projMatrix),a){let i=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);i[8]=-(2*r.x)/this.width,i[9]=2*r.y/this.height,this.expandedFarZProjMatrix=e.a6.mat4.mul([],i,h)}else this.expandedFarZProjMatrix=this.projMatrix;let p=e.a6.mat4.invert([],i);this.frustumCorners=e.b$.fromInvProjectionMatrix(p,this.horizonLineFromTop(),this.height),this.cameraFrustum=e.bO.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!a);let f=new Float32Array(16);e.a6.mat4.identity(f),e.a6.mat4.scale(f,f,[1,-1,1]),e.a6.mat4.rotateX(f,f,this._pitch),e.a6.mat4.rotateZ(f,f,this.angle);let m=e.a6.mat4.perspective(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=e.a6.mat4.clone(m);let _=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;m[8]=-(2*r.x)/this.width,m[9]=2*(r.y+_)/this.height,this.skyboxMatrix=e.a6.mat4.multiply(f,m,f);let g=this.point,y=g.x,x=g.y,v=this.width%2/2,b=this.height%2/2,w=Math.cos(this.angle),T=Math.sin(this.angle),S=y-Math.round(y)+w*v+T*b,M=x-Math.round(x)+w*b+T*v,E=new Float64Array(d);if(e.a6.mat4.translate(E,E,[S>.5?S-1:S,M>.5?M-1:M,0]),this.alignedProjMatrix=E,d=e.a6.mat4.create(),e.a6.mat4.scale(d,d,[this.width/2,-this.height/2,1]),e.a6.mat4.translate(d,d,[1,-1,0]),this.labelPlaneMatrix=d,d=e.a6.mat4.create(),e.a6.mat4.scale(d,d,[1,-1,1]),e.a6.mat4.translate(d,d,[-1,-1,0]),e.a6.mat4.scale(d,d,[2/this.width,2/this.height,1]),this.glCoordMatrix=d,this.pixelMatrix=e.a6.mat4.multiply(new Float64Array(16),this.labelPlaneMatrix,c),this._calcFogMatrices(),this._distanceTileDataCache={},!(d=e.a6.mat4.invert(new Float64Array(16),this.pixelMatrix)))throw Error("failed to invert matrix");if(this.pixelMatrixInverse=d,"globe"===this.projection.name||this.mercatorFromTransition){this.globeMatrix=e.c0(this);let i=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=e.a6.vec3.transformMat4(i,i,h),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=d;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};let i=this.cameraWorldSizeForFog,r=this.cameraPixelsPerMeter,a=this._camera.position,n=1/this.height/this._pixelsPerMercatorPixel,s=[i,i,r];e.a6.vec3.scale(s,s,n),e.a6.vec3.scale(a,a,-1),e.a6.vec3.multiply(a,a,s);let l=e.a6.mat4.create();e.a6.mat4.translate(l,l,a),e.a6.mat4.scale(l,l,s),this.mercatorFogMatrix=l,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(i,r,n)}_computeCameraPosition(e){let i=(e=e||this.pixelsPerMeter)/this.pixelsPerMeter,r=this._camera.forward(),a=this.point,
213n=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*i-e/this.worldSize*this._centerAltitude;return[a.x/this.worldSize-r[0]*n,a.y/this.worldSize-r[1]*n,e/this.worldSize*this._centerAltitude-r[2]*n]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(i){let r=this._maxCameraBoundsDistance()*Math.cos(this._pitch),a=this._camera.position[2],n=i[2],s=1;this.projection.wrap&&(this.center=this.center.wrap()),n>0&&(s=Math.min((r-a)/n,1)),this._camera.position=e.a6.vec3.scaleAndAdd([],this._camera.position,i,s),this._updateStateFromCamera()}_updateStateFromCamera(){let i=this._camera.position,r=this._camera.forward(),{pitch:a,bearing:n}=this._camera.getPitchBearing(),s=e.bE(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,l=this._mercatorZfromZoom(this._maxZoom)*Math.cos(e.bC(this._maxPitch)),h=Math.max((i[2]-s)/Math.cos(a),l),u=this._zoomFromMercatorZ(h);e.a6.vec3.scaleAndAdd(i,i,r,h),this._pitch=e.ap(a,e.bC(this.minPitch),e.bC(this.maxPitch)),this.angle=e.bB(n,-Math.PI,Math.PI),this._setZoom(e.ap(u,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new e.a5(i[0],i[1],i[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(e){return Math.pow(2,e)*this.tileSize}_mercatorZfromZoom(e){return this.cameraToCenterDistance/this._worldSizeFromZoom(e)}_minimumHeightOverTerrain(){let e=Math.min(null!=this._seaLevelZoom?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(e)}_zoomFromMercatorZ(e){return this.scaleZoom(this.cameraToCenterDistance/(e*this.tileSize))}zoomFromMercatorZAdjusted(i){let r=0,a=e.bV,n=0,s=1/0;for(;a-r>1e-6&&a>r;){let e=r+.5*(a-r),l=this.tileSize*Math.pow(2,e),h=this.getCameraToCenterDistance(this.projection,e,l),u=this.scaleZoom(h/(i*this.tileSize)),c=Math.abs(e-u);c<s&&(s=c,n=e),e<u?r=e:a=e}return n}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(e.w("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(i,r){let a=Math.min(i.x,r.x),n=Math.max(i.x,r.x),s=Math.min(i.y,r.y),l=Math.max(i.y,r.y);if(s<this.horizonLineFromTop(!1))return!0;if("mercator"!==this.projection.name)return!1;let h=[new e.P(a,s),new e.P(n,l),new e.P(a,l),new e.P(n,s)],u=this.renderWorldCopies?-3:0,c=this.renderWorldCopies?4:1;for(let e of h){let i=this.pointRayIntersection(e);if(i.t<0)return!0;let r=this.rayIntersectionCoordinate(i);if(r.x<u||r.y<0||r.x>c||r.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+e.c1(this.fovAboveCenter)>88||this.anyCornerOffEdge(new e.P(0,0),new e.P(this.width,this.height))}zoomDeltaToMovement(i,r){let a=e.a6.vec3.length(e.a6.vec3.sub([],this._camera.position,i)),n=this._zoomFromMercatorZ(a)+r;return a-this._mercatorZfromZoom(n)}getCameraPoint(){if("globe"===this.projection.name){let i=function([i,r,a],n){let s=[i,r,a,1];e.a6.vec4.transformMat4(s,s,n);let l=s[3]=Math.max(s[3],1e-6);return s[0]/=l,s[1]/=l,s[2]/=l,s}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new e.P(i[0],i[1])}{let i=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new e.P(0,i))}}getCameraToCenterDistance(i,r=this.zoom,a=this.worldSize){let n=e.bY(i,r,this.width,this.height,1024),s=i.pixelSpaceConversion(this.center.lat,a,n),l=.5/Math.tan(.5*this._fov)*this.height*s;return this.isOrthographic&&(l=t5(1,l,t6(this.pitch>=15?1:this.pitch/15))),l}getWorldToCameraMatrix(){let i=this._camera.getWorldToCamera(this.worldSize,"meters"===this.projection.zAxisUnit?this.pixelsPerMeter:1);return"globe"===this.projection.name&&e.a6.mat4.multiply(i,i,this.globeMatrix),i}getFrustum(i){return e.bO.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,i,"meters"===this.projection.zAxisUnit)}}let t9=(i,r)=>{if(r>0&&i.terrain&&e.w("Cutoff is currently disabled on terrain"),r<=0||i.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};let a=i.transform,n=Math.max(Math.abs(a._zoom-(i.minCutoffZoom-1)),1),s=a.isLODDisabled(!1)?e.a7(60,45,a.pitch):e.a7(30,15,a.pitch),l=a._farZ-a._nearZ,h=r*a.height,u=((1-s)*a.c
213ameraToCenterDistance+s*(a._farZ+h))*n;return{shouldRenderCutoff:s<1,uniformValues:{u_cutoff_params:[a._nearZ,a._farZ,(u-a._nearZ)/l,(u-h-a._nearZ)/l]}}},t7={cascadeCount:2,normalOffset:3,shadowMapResolution:2048};class ie{constructor(e,i){this.aabb=e,this.lastCascade=i}}class it{add(e,i){let r=this.receivers[e.key];void 0!==r?(r.aabb.min[0]=Math.min(r.aabb.min[0],i.min[0]),r.aabb.min[1]=Math.min(r.aabb.min[1],i.min[1]),r.aabb.min[2]=Math.min(r.aabb.min[2],i.min[2]),r.aabb.max[0]=Math.max(r.aabb.max[0],i.max[0]),r.aabb.max[1]=Math.max(r.aabb.max[1],i.max[1]),r.aabb.max[2]=Math.max(r.aabb.max[2],i.max[2])):this.receivers[e.key]=new ie(i,null)}clear(){this.receivers={}}get(e){return this.receivers[e.key]}computeRequiredCascades(i,r,a){let n=e.ca.fromPoints(i.points),s=0;for(let i in this.receivers){let l=this.receivers[i];if(!l||!n.intersectsAabb(l.aabb))continue;l.aabb.min=n.closestPoint(l.aabb.min),l.aabb.max=n.closestPoint(l.aabb.max);let h=l.aabb.getCorners();for(let i=0;i<a.length;i++){let n=!0;for(let s of h){let l=[s[0]*r,s[1]*r,s[2]];if(e.a6.vec3.transformMat4(l,l,a[i].matrix),l[0]<-1||l[0]>1||l[1]<-1||l[1]>1){n=!1;break}}if(l.lastCascade=i,s=Math.max(s,i),n)break}}return s+1}}class ii{constructor(e){this.painter=e,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new it,this._depthMode=new tX(e.context.gl.LEQUAL,tX.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this.useNormalOffset=!1,e.tp.registerParameter(this,["Shadows"],"_forceDisable",{label:"forceDisable"},()=>{this.painter.style.map.triggerRepaint()}),e.tp.registerParameter(t7,["Shadows"],"cascadeCount",{min:1,max:2,step:1}),e.tp.registerParameter(t7,["Shadows"],"normalOffset",{min:0,max:10,step:.05}),e.tp.registerParameter(t7,["Shadows"],"shadowMapResolution",{min:32,max:2048,step:32}),e.tp.registerBinding(this,["Shadows"],"_numCascadesToRender",{readonly:!0,label:"numCascadesToRender"})}destroy(){for(let e of this._cascades)e.texture.destroy(),e.framebuffer.destroy();this._cascades=[]}updateShadowParameters(i,r){let a=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!r||!r.properties)return;let n=r.properties.get("shadow-intensity");if(!r.shadowsEnabled()||n<=0||(this._shadowLayerCount=a.style.order.reduce((e,r)=>{let n=a.style._mergedLayers[r];return e+(n.hasShadowPass()&&!n.isHidden(i.zoom)?1:0)},0),this._enabled=this._shadowLayerCount>0,!this.enabled))return;let s=a.context,l=t7.shadowMapResolution,h=t7.shadowMapResolution;if(0===this._cascades.length||t7.shadowMapResolution!==this._cascades[0].texture.size[0]){this._cascades=[];for(let i=0;i<t7.cascadeCount;++i){let i=a._shadowMapDebug,r=s.gl,n=s.createFramebuffer(l,h,i,"texture"),u=new e.T(s,{width:l,height:h,data:null},r.DEPTH_COMPONENT16);if(n.depthAttachment.set(u.texture),i){let i=new e.T(s,{width:l,height:h,data:null},r.RGBA8);n.colorAttachment.set(i.texture)}this._cascades.push({framebuffer:n,texture:u,matrix:[],far:0,boundingSphereRadius:0,frustum:new e.bO,scale:0})}}this.shadowDirection=ia(r);let u=0;if(i.elevation){let e=i.elevation,r=[1e4,-1e4];e.visibleDemTiles.filter(e=>e.dem).forEach(e=>{let i=e.dem.tree;r[0]=Math.min(r[0],i.minimums[0]),r[1]=Math.max(r[1],i.maximums[0])}),1e4!==r[0]&&(u=(r[1]-r[0])*e.exaggeration())}let c=1.5*i.cameraToCenterDistance,d=3*c,p=new Float64Array(16);for(let r=0;r<this._cascades.length;++r){let a=this._cascades[r],n=i.height/50,s=1;1===t7.cascadeCount?s=d:0===r?s=c:(n=c,s=d);let[l,h]=function(i,r,a,n,s,l){let h,u;let c=i.zoom,d=i.scale,p=i.worldSize,f=1/p,m=i.aspect,_=Math.sqrt(1+m*m)*Math.tan(.5*i.fovX),g=_*_,y=n-a,x=n+a;g>y/x?(h=n,u=n*_):(h=.5*x*(1+g),u=.5*Math.sqrt(y*y+2*(n*n+a*a)*g+x*x*g*g));let v=i.projection.pixelsPerMeter(i.center.lat,p),b=i._camera.getCameraToWorldMercator(),w=[0,0,-h*f];e.a6.vec3.transformMat4(w,w,b);let T=u*f,S=i._edgeInsets;if((0!==S.left||0!==S.top||0!==S.right||0!==S.bottom)&&(S.left!==S.right||S.top!==S.bottom)){let r=i._camera.getWorldToCamera(i.worldSize,"meters"===i.projection.zAxisUnit?v:1),s=i._camera.getCameraToClipPerspective(i._fov,i.width/i.height,a,n);s[8]=-(2*i.centerOffset.x)/i.width,s[9]=2*i.centerOffset.y/i.height;let l=new Float64Array(16);e.a6.mat4.mul(l,s,r);let h=new Float64Array(16);for(let r of(e.a6.mat4.invert(h,l),e.bO.fromInvProjectionMatrix(h,p,c,!0).points)){let a=(r[0]/=d,r[1]/=d,r[2]=e.bE(r[2],i._center.lat),r);T=Math.max(T,e.a6.vec3.len(e.a6.vec3.subtract([],w,a)))}}T*=s/(s-1);let M=Math.acos(r[2]),E=Math.atan2(-r[0],-r[1]),A=new t2;
213A.position=w,A.setPitchBearing(M,E);let I=A.getWorldToCamera(p,v),C=T*p,P=Math.min(-(i._mercatorZfromZoom(17)*p*2),-2*C),L=A.getCameraToClipOrthographic(-C,C,-C,C,P,(C+l*v)/r[2]),k=new Float64Array(16);e.a6.mat4.multiply(k,L,I);let R=e.a6.vec3.fromValues(Math.floor(1e6*w[0])/1e6*p,Math.floor(1e6*w[1])/1e6*p,0),z=.5*s,D=[0,0,0];e.a6.vec3.transformMat4(D,R,k),e.a6.vec3.scale(D,D,z);let O=[Math.floor(D[0]),Math.floor(D[1]),Math.floor(D[2])],B=[0,0,0];e.a6.vec3.sub(B,D,O),e.a6.vec3.scale(B,B,-1/z);let F=new Float64Array(16);return e.a6.mat4.identity(F),e.a6.mat4.translate(F,F,B),e.a6.mat4.multiply(k,F,k),[k,C]}(i,this.shadowDirection,n,s,t7.shadowMapResolution,u);a.scale=i.scale,a.matrix=l,a.boundingSphereRadius=h,e.a6.mat4.invert(p,a.matrix),a.frustum=e.bO.fromInvProjectionMatrix(p,1,0,!0),a.far=s}let f=this._cascades.length-1;this._uniformValues.u_fade_range=[.75*this._cascades[f].far,this._cascades[f].far],this._uniformValues.u_shadow_intensity=n,this._uniformValues.u_shadow_direction=[this.shadowDirection[0],this.shadowDirection[1],this.shadowDirection[2]],this._uniformValues.u_shadow_texel_size=1/t7.shadowMapResolution,this._uniformValues.u_shadow_map_resolution=t7.shadowMapResolution,this._uniformValues.u_shadowmap_0=t3.ShadowMap0,this._uniformValues.u_shadowmap_1=t3.ShadowMap0+1,this._groundShadowTiles=a.transform.coveringTiles({tileSize:512,renderWorldCopies:!0});let m=a.transform.elevation;for(let e of this._groundShadowTiles){let i={min:0,max:0};if(m){let r=m.getMinMaxForTile(e);r&&(i=r)}this.addShadowReceiver(e.toUnwrapped(),i.min,i.max)}}get enabled(){return this._enabled&&!this._forceDisable}set enabled(e){this._enabled=e}drawShadowPass(i,r){if(!this.enabled)return;let a=this.painter,n=a.context;this._numCascadesToRender=this._receivers.computeRequiredCascades(a.transform.getFrustum(0),a.transform.worldSize,this._cascades),n.viewport.set([0,0,t7.shadowMapResolution,t7.shadowMapResolution]);for(let s=0;s<this._numCascadesToRender;++s)for(let l of(a.currentShadowCascade=s,n.bindFramebuffer.set(this._cascades[s].framebuffer.framebuffer),n.clear({color:e.bA.white,depth:1}),i.order)){let e=i._mergedLayers[l];if(!e.hasShadowPass()||e.isHidden(a.transform.zoom))continue;let n=i.getLayerSourceCache(e),s=n?r[n.id]:void 0;("model"===e.type||s&&s.length)&&a.renderLayer(a,n,e,s)}a.currentShadowCascade=0}drawGroundShadows(){if(!this.enabled)return;let e=this.painter,i=e.style,r=e.context,a=i.directionalLight,n=i.ambientLight;if(!a||!n)return;let s=[],l=t9(e,e.longestCutoffRange);l.shouldRenderCutoff&&s.push("RENDER_CUTOFF"),s.push("RENDER_SHADOWS","DEPTH_TEXTURE"),this.useNormalOffset&&s.push("NORMAL_OFFSET");let h=io(i,a,n),u=new tX(r.gl.LEQUAL,tX.ReadOnly,e.depthRangeFor3D);for(let i of this._groundShadowTiles){let a=i.toUnwrapped(),n=e.isTileAffectedByFog(i),c=e.getOrCreateProgram("groundShadow",{defines:s,overrideFog:n});this.setupShadows(a,c),e.uploadCommonUniforms(r,c,a,null,l);let d={u_matrix:e.transform.calculateProjMatrix(a),u_ground_shadow_factor:h};c.draw(e,r.gl.TRIANGLES,u,tY.disabled,tZ.multiply,tJ.disabled,d,"ground_shadow",e.tileExtentBuffer,e.quadTriangleIndexBuffer,e.tileExtentSegments,{},e.transform.zoom,null,null)}}getShadowPassColorMode(){return this.painter._shadowMapDebug?tZ.unblended:tZ.disabled}getShadowPassDepthMode(){return this._depthMode}getShadowCastingLayerCount(){return this._shadowLayerCount}calculateShadowPassMatrixFromTile(i){let r=this.painter.transform,a=r.calculatePosMatrix(i,r.worldSize);return e.a6.mat4.multiply(a,this._cascades[this.painter.currentShadowCascade].matrix,a),Float32Array.from(a)}calculateShadowPassMatrixFromMatrix(i){return e.a6.mat4.multiply(i,this._cascades[this.painter.currentShadowCascade].matrix,i),Float32Array.from(i)}setupShadows(i,r,a,n=0){if(!this.enabled)return;let s=this.painter.transform,l=this.painter.context,h=l.gl,u=this._uniformValues,c=new Float64Array(16),d=s.calculatePosMatrix(i,s.worldSize);for(let i=0;i<this._cascades.length;i++)e.a6.mat4.multiply(c,this._cascades[i].matrix,d),u[0===i?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(c),l.activeTexture.set(h.TEXTURE0+t3.ShadowMap0+i),this._cascades[i].texture.bind(h.NEAREST,h.CLAMP_TO_EDGE);if(this.useNormalOffset=!!a,this.useNormalOffset){let r=e.c9(i.canonical),l=2/s.tileSize*e.ab/t7.shadowMapResolution,h=l*this._cascades[0].boundingSphereRadius,c=l*this._cascades[this._cascades.length-1].boundingSphereRadius,d=("vector-tile"===a?1:3)/Math.pow(2,n-i.canonical.z-(1-s.zoom+Math.floor(s.zoom)));u.u_shadow_normal_offset=[r,h*d,c*d],u.u_shadow_bias=[6e-5,.0012,.012]}else u.u_shadow_bias=[36e-5,.0012,.012];r.setShadowUniformValues(l,u)}
213setupShadowsFromMatrix(i,r,a=!1){if(!this.enabled)return;let n=this.painter.context,s=n.gl,l=this._uniformValues,h=new Float64Array(16);for(let r=0;r<t7.cascadeCount;r++)e.a6.mat4.multiply(h,this._cascades[r].matrix,i),l[0===r?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(h),n.activeTexture.set(s.TEXTURE0+t3.ShadowMap0+r),this._cascades[r].texture.bind(s.NEAREST,s.CLAMP_TO_EDGE);if(this.useNormalOffset=a,a){let e=t7.normalOffset;l.u_shadow_normal_offset=[1,e,e],l.u_shadow_bias=[6e-5,.0012,.012]}else l.u_shadow_bias=[36e-5,.0012,.012];r.setShadowUniformValues(n,l)}getShadowUniformValues(){return this._uniformValues}getCurrentCascadeFrustum(){return this._cascades[this.painter.currentShadowCascade].frustum}computeSimplifiedTileShadowVolume(i,r,a,n){if(n[2]>=0)return{};let s=(function(i,r,a){let n=a/(1<<i.canonical.z);return new e.ca([i.canonical.x*n+i.wrap*a,i.canonical.y*n+i.wrap*a,0],[(i.canonical.x+1)*n+i.wrap*a,(i.canonical.y+1)*n+i.wrap*a,r])})(i,r,a).getCorners(),l=-(r/n[2]);n[0]<0?(e.a6.vec3.add(s[0],s[0],[n[0]*l,0,0]),e.a6.vec3.add(s[3],s[3],[n[0]*l,0,0])):n[0]>0&&(e.a6.vec3.add(s[1],s[1],[n[0]*l,0,0]),e.a6.vec3.add(s[2],s[2],[n[0]*l,0,0])),n[1]<0?(e.a6.vec3.add(s[0],s[0],[0,n[1]*l,0]),e.a6.vec3.add(s[1],s[1],[0,n[1]*l,0])):n[1]>0&&(e.a6.vec3.add(s[2],s[2],[0,n[1]*l,0]),e.a6.vec3.add(s[3],s[3],[0,n[1]*l,0]));let h={};return h.vertices=s,h.planes=[ir(s[1],s[0],s[4]),ir(s[2],s[1],s[5]),ir(s[3],s[2],s[6]),ir(s[0],s[3],s[7])],h}addShadowReceiver(i,r,a){this._receivers.add(i,e.ca.fromTileIdAndHeight(i,r,a))}getMaxCascadeForTile(e){let i=this._receivers.get(e);return i&&i.lastCascade?i.lastCascade:0}}function ir(i,r,a){let n=e.a6.vec3.sub([],a,r),s=e.a6.vec3.sub([],i,r),l=e.a6.vec3.cross([],n,s),h=e.a6.vec3.length(l);return 0===h?[0,0,1,0]:(e.a6.vec3.scale(l,l,1/h),[l[0],l[1],l[2],-e.a6.vec3.dot(l,r)])}function ia(i){let r=i.properties.get("direction"),a=e.c8(r.x,r.y,r.z);a[2]=e.ap(a[2],0,75);let n=e.cb([a[0],a[1],a[2]]);return e.a6.vec3.fromValues(n.x,n.y,n.z)}function io(i,r,a){let n=r.properties.get("color"),s=r.properties.get("intensity"),l=r.properties.get("direction"),h=[l.x,l.y,l.z],u=a.properties.get("color"),c=a.properties.get("intensity"),d=Math.max(e.a6.vec3.dot([0,0,1],h),0),p=[0,0,0];e.a6.vec3.scale(p,u.toRenderColor(i.getLut(r.scope)).toArray01Linear().slice(0,3),c);let f=[0,0,0];return e.a6.vec3.scale(f,n.toRenderColor(i.getLut(a.scope)).toArray01Linear().slice(0,3),d*s),e.cc([p[0]>0?p[0]/(p[0]+f[0]):0,p[1]>0?p[1]/(p[1]+f[1]):0,p[2]>0?p[2]/(p[2]+f[2]):0])}class is extends e.E{constructor(e){super(),this.requestManager=e,this.models={"":{}},this.numModelsLoading={}}loadModel(i,r){return e.aG(this.requestManager.transformRequest(r,e.R.Model).url).then(r=>{if(!r)return;let a=e.aH(r),n=new e.aI(i,void 0,void 0,a);return n.computeBoundsAndApplyParent(),n}).catch(a=>{if(a&&404===a.status)return null;this.fire(new e.t(Error(`Could not load model ${i} from ${r}: ${a.message}`)))})}load(i,r){this.models[r]||(this.models[r]={});let a=Object.keys(i);this.numModelsLoading[r]=(this.numModelsLoading[r]||0)+a.length;let n=[];for(let e of a)n.push(this.loadModel(e,i[e]));Promise.allSettled(n).then(i=>{for(let e=0;e<i.length;e++){let{status:n,value:s}=i[e];"fulfilled"===n&&s&&(this.models[r][a[e]]={model:s,numReferences:1})}this.numModelsLoading[r]-=a.length,this.fire(new e.x("data",{dataType:"style"}))}).catch(i=>{this.fire(new e.t(Error(`Could not load models: ${i.message}`)))})}isLoaded(){for(let e in this.numModelsLoading)if(this.numModelsLoading[e]>0)return!1;return!0}hasModel(e,i){return!!this.getModel(e,i)}getModel(e,i){return this.models[i]||(this.models[i]={}),this.models[i][e]?this.models[i][e].model:void 0}
213addModel(e,i,r){this.models[r]||(this.models[r]={}),this.hasModel(e,r)&&this.models[r][e].numReferences++,this.load({[e]:this.requestManager.normalizeModelURL(i)},r)}addModels(e,i){this.models[i]||(this.models[i]={});let r={};for(let a in e)this.models[i][a]={},r[a]=this.requestManager.normalizeModelURL(e[a]);this.load(r,i)}addModelsFromBucket(e,i){this.models[i]||(this.models[i]={});let r={};for(let a of e)this.hasModel(a,i)?this.models[i][a].numReferences++:r[a]=this.requestManager.normalizeModelURL(a);this.load(r,i)}removeModel(e,i){if(this.models[i]&&this.models[i][e]&&(this.models[i][e].numReferences--,0===this.models[i][e].numReferences)){let r=this.models[i][e].model;delete this.models[i][e],r.destroy()}}listModels(e){return this.models[e]||(this.models[e]={}),Object.keys(this.models[e])}upload(e,i){for(let r in this.models[i]||(this.models[i]={}),this.models[i])this.models[i][r].model&&this.models[i][r].model.upload(e.context)}}let il=new e.a0({data:new e.a1(e._.colorTheme.data)}),ih=(e,i)=>eC(e,i&&i.filter(e=>"source.canvas"!==e.identifier)),iu=e.ar(ti,["addLayer","removeLayer","setLights","setPaintProperty","setLayoutProperty","setSlot","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setProjection","setCamera","addImport","removeImport","updateImport"]),ic=e.ar(ti,["setCenter","setZoom","setBearing","setPitch"]),id={version:8,layers:[],sources:{}},ip={duration:300,delay:0};class im extends e.E{constructor(i,r={}){super(),this.map=i,this.scope=r.scope||"",this.globalId=null,this.fragments=[],this.importDepth=r.importDepth||0,this.importsCache=r.importsCache||new Map,this.resolvedImports=r.resolvedImports||new Set,this.transition=e.l({},ip),this._buildingIndex=new te(this),this.crossTileSymbolIndex=new tH,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers={},this._mergedSourceCaches={},this._mergedOtherSourceCaches={},this._mergedSymbolSourceCaches={},this._mergedLayerSelectors=new Map,this._clipLayerPresent=!1,this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._changes=r.styleChanges||new H,this.dispatcher=r.dispatcher?r.dispatcher:new e.ce(e.cf(),this),r.imageManager?this.imageManager=r.imageManager:(this.imageManager=new Z,this.imageManager.setEventedParent(this)),this.imageManager.createScope(this.scope),this.glyphManager=r.glyphManager?r.glyphManager:new e.cg(i._requestManager,r.localFontFamily?e.ch.all:r.localIdeographFontFamily?e.ch.ideographs:e.ch.none,r.localFontFamily||r.localIdeographFontFamily),r.modelManager?this.modelManager=r.modelManager:(this.modelManager=new is(i._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._precompileDone=!1,this._shouldPrecompile=!1,this._availableImages=[],this._order=[],this._markersNeedUpdate=!1,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null},this._styleColorThemeForScope={},this.options=r.configOptions?r.configOptions:new Map,this._configDependentLayers=r.configDependentLayers?r.configDependentLayers:new Set,this._config=r.config,this._initialConfig=r.initialConfig,this.dispatcher.broadcast("setReferrer",e.ci());let a=this;this._rtlTextPluginCallback=im.registerForPluginStateChange(i=>{a.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:i.pluginStatus,pluginURL:i.pluginURL},(i,r)=>{if(e.cj(i),r&&r.every(e=>e))for(let e in a._sourceCaches){let i=a._sourceCaches[e],r=i.getSource().type;"vector"!==r&&"geojson"!==r||i.reload()}})}),this.on("data",e=>{if("source"!==e.dataType||"metadata"!==e.sourceDataType)return;let i=this.getOwnSource(e.sourceId);if(i&&i.vectorLayerIds)for(let e in this._layers){let r=this._layers[e];r.source===i.id&&this._validateLayer(r)}})}load(e){return e&&("string"==typeof e?this.loadURL(e):this.loadJSON(e)),this}_getGlobalId(i){if(!i)return null;if("string"==typeof i){if(e.f(i))return i;let r=e.ck(i);if(!r.startsWith("http"))try{return new URL(r,location.href).toString()}catch(e){}return r}return`json://${e.cl(JSON.stringify(i))}`}_diffStyle(i,r,a){this.globalId=this._getGlobalId(i);let n=(e,i)=>{try{i(null,this.setState(e,a))}catch(e){i(e,!1)}};if("string"==typeof i){let a=this.map._requestManager.normalizeStyleURL(i),s=this.map._requestManager.transformRequest(a,e.R.Style);e.n(s,(i,a)=>{i?this.fire(new e.t(i)):a&&n(a,r)})}else"object"==typeof i&&n(i,r)}loadURL(i,r={}){this.fire(new e.x("dataloading",{dataType:"style"}));let a="boolean"==typeof r.validate?r.validate:!e.f(i);this.globalId=this._getGlobalId(i),i=this.map._requestManager.normalizeStyleURL(i,r.accessToken),this.resolvedImports.add(i);let n=this.importsCache.get(i);if(n)return this._load(n,a);let s=this.map._requestManager.transformRequest(i,e.R.Style);this._request=e.n(s,(r,n)=>{if(this._request=null,r)this.fire(new e.t(r));else if(n)return this.importsCache.set(i,n),this._load(n,a)})}loadJSON(i,r={}){this.fire(new e.x("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(i),this._request=e.q.frame(()=>{this._request=null,this._load(i,!1!==r.validate)})}loadEmpty(){this.fire(new e.x("dataloading",{dataType:"style"})),this._load(id,!1)}_loadImports(i,r,a){if(this.importDepth>=4)return e.w("Style doesn't support nesting deeper than 5"),Promise.resolve();let n=[];for(let e of i){let i=this._createFragmentStyle(e),s=new Promise(e=>{i.once("style.import.load",e),i.once("error",e)}).then(()=>this.mergeAll());if(n.push(s),this.resolvedImports.has(e.url)){i.loadEmpty();continue}let l=e.data||this.importsCache.get(e.url);l?(i.loadJSON(l,{validate:r}),this._isInternalStyle(l)&&(i.globalId=null)):e.url?i.loadURL(e.url,{validate:r}):i.loadEmpty();let h={style:i,id:e.id,config:e.config};if(a){let e=this.fragments.findIndex(({id:e})=>e===a);this.fragments=this.fragments.slice(0,e).concat(h).concat(this.fragments.slice(e))}else this.fragments.push(h)}return Promise.allSettled(n)}getImportGlobalIds(e=this,i=new Set){for(let r of e.fragments)r.style.globalId&&i.add(r.style.globalId),this.getImportGlobalIds(r.style,i);return[...i.values()]}_createFragmentStyle(i){let r;let a=this.scope?e.av(i.id,this.scope):i.id,n=this._initialConfig&&this._initialConfig[a];(i.config||n)&&(r=e.l({},i.config,n));let s=new im(this.map,{scope:a,styleChanges:this._changes,importDepth:this.importDepth+1,importsCache:this.importsCache,resolvedImports:new Set(this.resolvedImports),dispatcher:this.dispatcher,imageManager:this.imageManager,glyphManager:this.glyphManager,modelManager:this.modelManager,config:r,configOptions:this.options,configDependentLayers:this._configDependentLayers});return s.setEventedParent(this.map,{style:s}),s}_reloadImports(){this.mergeAll(),this._updateMapProjection(),this.updateConfigDependencies(),this.map._triggerCameraUpdate(this.camera),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),this._shouldPrecompile=this.map._precompilePrograms&&this.isRootStyle()}_isInternalStyle(e){return this.isRootStyle()&&(e.fragment||!!e.schema&&!1!==e.fragment)}_load(i,r){let a=i.schema;if(this._isInternalStyle(i)){let a=e.l({},id,{imports:[{id:"basemap",data:i,url:""}]});return void this._load(a,r)}if(this.updateConfig(this._config,a),r&&ih(this,eg(i)))return;this._loaded=!0,this.stylesheet=e.cm(i);let n=()=>{for(let e in i.sources)this.addSource(e,i.sources[e],{validate:!1,isInitialLoad:!0});i.sprite?this._loadSprite(i.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),this.glyphManager.setURL(i.glyphs,this.scope);
213let a=tt(this.stylesheet.layers);if(this._order=a.map(e=>e.id),this.stylesheet.light&&e.w("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights){if(1===this.stylesheet.lights.length&&"flat"===this.stylesheet.lights[0].type){let e=this.stylesheet.lights[0];this.light=new eP(e.properties,e.id)}else this.setLights(this.stylesheet.lights)}for(let i of(this.light||(this.light=new eP(this.stylesheet.light)),this._layers={},a)){let r=e.cq(i,this.scope,this._styleColorTheme.lut,this.options);0!==r.configDependencies.size&&this._configDependentLayers.add(r.fqid),r.setEventedParent(this,{layer:{id:r.id}}),this._layers[r.id]=r;let a=this.getOwnLayerSourceCache(r),n=!!this.directionalLight&&this.directionalLight.shadowsEnabled();a&&r.canCastShadows()&&n&&(a.castsShadows=!0)}this.stylesheet.models&&this.modelManager.addModels(this.stylesheet.models,this.scope);let n=this.stylesheet.terrain;n&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(n,1)),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this.stylesheet.transition&&this.setTransition(this.stylesheet.transition),this.fire(new e.x("data",{dataType:"style"}));let s=this.isRootStyle();i.imports?this._loadImports(i.imports,r).then(()=>{this._reloadImports(),this.fire(new e.x(s?"style.load":"style.import.load"))}):(this._reloadImports(),this.fire(new e.x(s?"style.load":"style.import.load")))},s=this.stylesheet["color-theme"];if(this._styleColorTheme.colorTheme=s,s){let i=this._evaluateColorThemeData(s);this._loadColorTheme(i).then(()=>{n()}).catch(i=>{e.w(`Couldn't load color theme from the stylesheet: ${i}`),n()})}else this._styleColorTheme.lut=null,n()}isRootStyle(){return 0===this.importDepth}mergeAll(){let i,r,a,n,s,l,h,u;let c={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(e=>{if(e.stylesheet){if(null!=e.light&&(i=e.light),e.stylesheet.lights)for(let i of e.stylesheet.lights)"ambient"===i.type&&null!=e.ambientLight&&(r=e.ambientLight),"directional"===i.type&&null!=e.directionalLight&&(a=e.directionalLight);n=this._prioritizeTerrain(n,e.terrain,e.stylesheet.terrain),e.stylesheet.fog&&null!=e.fog&&(s=e.fog),null!=e.stylesheet.camera&&(u=e.stylesheet.camera),null!=e.stylesheet.projection&&(l=e.stylesheet.projection),null!=e.stylesheet.transition&&(h=e.stylesheet.transition),c[e.scope]=e._styleColorTheme}}),this.light=i,this.ambientLight=r,this.directionalLight=a,this.fog=s,this._styleColorThemeForScope=c,null===n?delete this.terrain:this.terrain=n,this.camera=u||{"camera-projection":"perspective"},this.projection=l||{name:"mercator"},this.transition=e.l({},ip,h),this.mergeSources(),this.mergeLayers()}forEachFragmentStyle(e){let i=r=>{for(let e of r.fragments)i(e.style);e(r)};i(this)}_prioritizeTerrain(e,i,r){let a=e&&0===e.drapeRenderMode;return null===r?i&&0===i.drapeRenderMode?i:a?e:null:null!=i&&(!e||a||i&&1===i.drapeRenderMode)?i:e}mergeTerrain(){let e;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(i=>{e=this._prioritizeTerrain(e,i.terrain,i.stylesheet.terrain)}),null===e?delete this.terrain:this.terrain=e}mergeProjection(){let e;this.forEachFragmentStyle(i=>{null!=i.stylesheet.projection&&(e=i.stylesheet.projection)}),this.projection=e||{name:"mercator"}}mergeSources(){let i={},r={},a={};this.forEachFragmentStyle(n=>{for(let r in n._sourceCaches)i[e.av(r,n.scope)]=n._sourceCaches[r];for(let i in n._otherSourceCaches)r[e.av(i,n.scope)]=n._otherSourceCaches[i];for(let i in n._symbolSourceCaches)a[e.av(i,n.scope)]=n._symbolSourceCaches[i]}),this._mergedSourceCaches=i,this._mergedOtherSourceCaches=r,this._mergedSymbolSourceCaches=a}mergeLayers(){let i={},r=[],a={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._mergedLayerSelectors.clear(),this.forEachFragmentStyle(a=>{for(let n of a._order){let s=a._layers[n];if("slot"===s.type){let r=e.cn(n);if(i[r])continue;i[r]=[]}s.slot&&i[s.slot]?i[s.slot].push(s):r.push(s)}let{featuresets:n}=a.stylesheet||{};if(n)for(let i in n){let{selectors:r}=n[i];for(let n of r){let r;let s=a._layers[n.layer],l=this._mergedLayerSelectors.get(s.fqid)||[];if(n.properties)for(let i in n.properties){let a=e.M(n.properties[i]);"success"===a.result&&((r=r||{})[i]=a.value)}l.push({featuresetId:i,featureNamespace:n.featureNamespace,properties:r}),this._mergedLayerSelectors.set(s.fqid,l)}}}),this._mergedOrder=[];let n=(r=[])=>{for(let s of r)if("slot"===s.type){let r=e.cn(s.id);i[r]&&n(i[r]),this._mergedSlots.push(r)}else{let i=e.av(s.id,s.scope);this._mergedOrder.push(i),a[i]=s,s.is3D()&&(this._has3DLayers=!0),"circle"===s.type&&(this._hasCircleLayers=!0),"symbol"===s.type&&(this._hasSymbolLayers=!0),"clip"===s.type&&(this._clipLayerPresent=!0)}};n(r),this._mergedOrder.sort((e,i)=>{let r=a[e],n=a[i];return r.hasInitialOcclusionOpacityProperties?+!!n.is3D():r.is3D()&&n.hasInitialOcclusionOpacityProperties?-1:0}),this._mergedLayers=a,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged()}terrainSetForDrapingOnly(){return!!this.terrain&&0===this.terrain.drapeRenderMode}getCamera(){return this.stylesheet.camera}setCamera(i){return this.stylesheet.camera=e.l({},this.stylesheet.camera,i),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(i){return i.data?(function(i,r,a){let n=e.l({},r);for(let i of Object.keys(e._.colorTheme))void 0===n[i]&&(n[i]=e._.colorTheme[i].default);let s=new e.$(il,i,new Map(a));return s.setTransitionOrValue(n,a),s.untransitioned().possiblyEvaluate(new e.a3(0))})(this.scope,i,this.options).get("data"):null}_loadColorTheme(i){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;let r=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((a,n)=>{let s="data:image/png;base64,";if(!i||0===i.length)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void a();let l=i;l.startsWith(s)||(l=s+l);
213let h="mapbox-reserved-lut",u=new Image;u.src=l,u.onerror=()=>{this._styleColorTheme.lutLoading=!1,n(Error("Failed to load image data"))},u.onload=()=>{if(this._styleColorTheme.lutLoadingCorrelationID!==r)return void a();this._styleColorTheme.lutLoading=!1;let{width:s,height:l,data:c}=e.q.getImageData(u);if(l>32)return void n(Error("The height of the image must be less than or equal to 32 pixels."));if(s!==l*l)return void n(Error("The width of the image must be equal to the height squared."));this.getImage(h)&&this.removeImage(h),this.addImage(h,{data:new e.r({width:s,height:l},c),pixelRatio:1,sdf:!1,version:0});let d=this.imageManager.getImage(h,this.scope);d?(this._styleColorTheme.lut={image:d.data,data:i},a()):n(Error("Missing LUT image."))}})}getLut(e){let i=this._styleColorThemeForScope[e];return i?i.lut:null}setProjection(e){e?this.stylesheet.projection=e:delete this.stylesheet.projection,this.mergeProjection(),this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?(this.getTerrain()||this.stylesheet.terrain)&&!this.disableElevatedTerrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null,0))}_updateMapProjection(){this.isRootStyle()&&(this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.projection))}_loadSprite(i){this._spriteRequest=function(i,r,a){let n,s,l;let h=e.q.devicePixelRatio>1?"@2x":"",u=e.n(r.transformRequest(r.normalizeSpriteURL(i,h,".json"),e.R.SpriteJSON),(e,i)=>{u=null,l||(l=e,n=i,d())}),c=e.o(r.transformRequest(r.normalizeSpriteURL(i,h,".png"),e.R.SpriteImage),(e,i)=>{c=null,l||(l=e,s=i,d())});function d(){if(l)a(l);else if(n&&s){let i=e.q.getImageData(s),r={};for(let a in n){let{width:s,height:l,x:h,y:u,sdf:c,pixelRatio:d,stretchX:p,stretchY:f,content:m}=n[a],_=new e.r({width:s,height:l});e.r.copy(i,_,{x:h,y:u},{x:0,y:0},{width:s,height:l},null),r[a]={data:_,pixelRatio:d,sdf:c,stretchX:p,stretchY:f,content:m}}a(null,r)}}return{cancel(){u&&(u.cancel(),u=null),c&&(c.cancel(),c=null)}}}(i,this.map._requestManager,(i,r)=>{if(this._spriteRequest=null,i)this.fire(new e.t(i));else if(r)for(let e in r)this.imageManager.addImage(e,this.scope,r[e]);this.imageManager.setLoaded(!0,this.scope),this._availableImages=this.imageManager.listImages(this.scope),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages}),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new e.x("data",{dataType:"style"}))})}_validateLayer(i){let r=this.getOwnSource(i.source);if(!r)return;let a=i.sourceLayer;a&&("geojson"===r.type||r.vectorLayerIds&&-1===r.vectorLayerIds.indexOf(a))&&this.fire(new e.t(Error(`Source layer "${a}" does not exist on source "${r.id}" as specified by style layer "${i.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(let e in this._sourceCaches)if(!this._sourceCaches[e].loaded())return!1;if(!this.imageManager.isLoaded()||!this.modelManager.isLoaded()||this._styleColorTheme.lutLoading)return!1;for(let{style:e}of this.fragments)if(!e.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((e,i)=>{let r=this.fragments[i];return r&&r.style&&(e.data=r.style.serialize()),e})}_serializeSources(){let e={};for(let i in this._sourceCaches){let r=this._sourceCaches[i].getSource();e[r.id]||(e[r.id]=r.serialize())}return e}_serializeLayers(e){let i=[];for(let r of e){let e=this._layers[r];e&&"custom"!==e.type&&i.push(e.serialize())}return i}hasLightTransitions(){return!(!this.light||!this.light.hasTransition())||!(!this.ambientLight||!this.ambientLight.hasTransition())||!(!this.directionalLight||!this.directionalLight.hasTransition())}hasFogTransition(){return!!this.fog&&this.fog.hasTransition()}hasTransitions(){if(this.hasLightTransitions()||this.hasFogTransition())return!0;for(let e in this._sourceCaches)if(this._sourceCaches[e].hasTransition())return!0;for(let e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}_getOrder(e){return e?this.order:this._mergedOrder}isLayerDraped(e){return!!this.terrain&&e.isDraped(this.getLayerSourceCache(e))}_checkLoaded(){if(!this._loaded)throw Error("Style is not done loading")}_checkLayer(i){let r=this.getOwnLayer(i);if(r)return r;this.fire(new e.t(Error(`The layer '${i}' does not exist in the map's style.`)))}_checkSource(i){let r=this.getOwnSource(i);if(r)return r;this.fire(new e.t(Error(`The source '${i}' does not exist in the map's style.`)))}precompilePrograms(e,i){let r=this.map.painter;if(r)for(let a=e.minzoom||0;a<(e.maxzoom||25.5);a++){let a=e.getProgramIds();if(a)for(let n of a){let a=e.getDefaultProgramParams(n,i.zoom,this._styleColorTheme.lut);a&&(r.style=this,this.fog&&(r._fogVisible=!0,a.overrideFog=!0,r.getOrCreateProgram(n,a)),r._fogVisible=!1,a.overrideFog=!1,r.getOrCreateProgram(n,a),(this.stylesheet.terrain||this.stylesheet.projection&&"globe"===this.stylesheet.projection.name)&&(a.overrideRtt=!0,r.getOrCreateProgram(n,a)))}}}update(i){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(i),this.directionalLight&&this.directionalLight.recalculate(i);let r=this.calculateLightsBrightness();i.brightness=r||0,r!==this._brightness&&(this._brightness=r,this.dispatcher.broadcast("setBrightness",r));let a=this._changes.isDirty(),n=!1;if(this._changes.isDirty()){let e=this._changes.getLayerUpdatesByScope();for(let i in e){let{updatedIds:r,removedIds:a}=e[i];(r||a)&&(this._updateWorkerLayers(i,r,a),n=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(i),this.light&&this.light.updateTransitions(i),this.ambientLight&&this.ambientLight.updateTransitions(i),this.directionalLight&&this.directionalLight.updateTransitions(i),this.fog&&this.fog.updateTransitions(i),this._changes.reset()}let s={};for(let e in this._mergedSourceCaches){let i=this._mergedSourceCaches[e];s[e]=i.used,i.used=!1,i.tileCoverLift=0}for(let e of this._mergedOrder){let r=this._mergedLayers[e];if(r.recalculate(i,this._availableImages),!r.isHidden(i.zoom)){let e=this.getLayerSourceCache(r);e&&(e.used=!0,e.tileCoverLift=Math.max(e.tileCoverLift,r.tileCoverLift()))}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback(()=>
213{this.precompilePrograms(r,i)}):this.precompilePrograms(r,i))}for(let i in this._shouldPrecompile&&(this._precompileDone=!0),this.terrain&&n&&this.mergeLayers(),s){let r=this._mergedSourceCaches[i];s[i]!==r.used&&r.getSource().fire(new e.x("data",{sourceDataType:"visibility",dataType:"source",sourceId:r.getSource().id}))}this.light&&this.light.recalculate(i),this.terrain&&this.terrain.recalculate(i),this.fog&&this.fog.recalculate(i),this.z=i.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),a&&this.fire(new e.x("data",{dataType:"style"}))}_updateTilesForChangedImages(){let e=this._changes.getUpdatedImages();if(e.length){for(let i in this._sourceCaches)this._sourceCaches[i].reloadTilesForDependencies(["icons","patterns"],e);this._changes.resetUpdatedImages()}}_updateWorkerLayers(e,i,r){let a=this.getFragmentStyle(e);a&&this.dispatcher.broadcast("updateLayers",{layers:i?a._serializeLayers(i):[],scope:e,removedIds:r||[],options:a.options})}setState(i,r){if(this._checkLoaded(),ih(this,eg(i)))return!1;(i=e.cm(i)).layers=tt(i.layers);let a=(function(i,r){if(!i)return[{command:ti.setStyle,args:[r]}];let a=[];try{if(!e.bi(i.version,r.version)||(e.bi(i.center,r.center)||a.push({command:ti.setCenter,args:[r.center]}),e.bi(i.zoom,r.zoom)||a.push({command:ti.setZoom,args:[r.zoom]}),e.bi(i.bearing,r.bearing)||a.push({command:ti.setBearing,args:[r.bearing]}),e.bi(i.pitch,r.pitch)||a.push({command:ti.setPitch,args:[r.pitch]}),e.bi(i.sprite,r.sprite)||a.push({command:ti.setSprite,args:[r.sprite]}),e.bi(i.glyphs,r.glyphs)||a.push({command:ti.setGlyphs,args:[r.glyphs]}),e.bi(i.imports,r.imports)||function(i=[],r=[],a){let n,s,l,h;r=r||[];let u=(i=i||[]).map(to),c=r.map(to),d=i.reduce(ts,{}),p=r.reduce(ts,{}),f=u.slice();for(n=0,s=0;n<u.length;n++)l=u[n],p.hasOwnProperty(l)?s++:(a.push({command:ti.removeImport,args:[l]}),f.splice(f.indexOf(l,s),1));for(n=0,s=0;n<c.length;n++)l=c[c.length-1-n],f[f.length-1-n]!==l&&(d.hasOwnProperty(l)?(a.push({command:ti.removeImport,args:[l]}),f.splice(f.lastIndexOf(l,f.length-s),1)):s++,h=f[f.length-n],a.push({command:ti.addImport,args:[p[l],h]}),f.splice(f.length-n,0,l));for(let i of r){let r=d[i.id];r&&!e.bi(r,i)&&a.push({command:ti.updateImport,args:[i.id,i]})}}(i.imports,r.imports,a),e.bi(i.transition,r.transition)||a.push({command:ti.setTransition,args:[r.transition]}),e.bi(i.light,r.light)||a.push({command:ti.setLight,args:[r.light]}),e.bi(i.fog,r.fog)||a.push({command:ti.setFog,args:[r.fog]}),e.bi(i.projection,r.projection)||a.push({command:ti.setProjection,args:[r.projection]}),e.bi(i.lights,r.lights)||a.push({command:ti.setLights,args:[r.lights]}),e.bi(i.camera,r.camera)||a.push({command:ti.setCamera,args:[r.camera]}),!e.bi(i["color-theme"],r["color-theme"])))return[{command:ti.setStyle,args:[r]}];let n={},s=[];!function(i,r,a,n){let s;for(s in r=r||{},i=i||{})i.hasOwnProperty(s)&&(r.hasOwnProperty(s)||ta(s,a,n));for(s in r){var l;if(!r.hasOwnProperty(s))continue;let h=r[s];i.hasOwnProperty(s)?e.bi(i[s],h)||("geojson"===i[s].type&&"geojson"===h.type&&function(i,r,a){let n;for(n in i[a])if(i[a].hasOwnProperty(n)&&"data"!==n&&!e.bi(i[a][n],r[a][n]))return!1;for(n in r[a])if(r[a].hasOwnProperty(n)&&"data"!==n&&!e.bi(i[a][n],r[a][n]))return!1;return!0}(i,r,s)?a.push({command:ti.setGeoJSONSourceData,args:[s,h.data]}):(l=r,ta(s,a,n),tr(s,l,a))):tr(s,r,a)}}(i.sources,r.sources,s,n);let l=[];i.layers&&i.layers.forEach(e=>{e.source&&n[e.source]?a.push({command:ti.removeLayer,args:[e.id]}):l.push(e)});let h=i.terrain;h&&n[h.source]&&(a.push({command:ti.setTerrain,args:[void 0]}),h=void 0),a=a.concat(s),e.bi(h,r.terrain)||a.push({command:ti.setTerrain,args:[r.terrain]}),function(i,r,a){let n,s,l,h,u,c,d;r=r||[];let p=(i=i||[]).map(to),f=r.map(to),m=i.reduce(ts,{}),_=r.reduce(ts,{}),g=p.slice(),y=Object.create(null);for(n=0,s=0;n<p.length;n++)l=p[n],_.hasOwnProperty(l)?s++:(a.push({command:ti.removeLayer,args:[l]}),g.splice(g.indexOf(l,s),1));for(n=0,s=0;n<f.length;n++)l=f[f.length-1-n],g[g.length-1-n]!==l&&(m.hasOwnProperty(l)?(a.push({command:ti.removeLayer,args:[l]}),g.splice(g.lastIndexOf(l,g.length-s),1)):s++,c=g[g.length-n],a.push({command:ti.addLayer,args:[_[l],c]}),g.splice(g.length-n,0,l),y[l]=!0);for(n=0;n<f.length;n++)if(h=m[l=f[n]],u=_[l],!y[l]&&!e.bi(h,u)){if(e.bi(h.source,u.source)&&e.bi(h["source-layer"],u["source-layer"])&&e.bi(h.type,u.type)){for(d in tn(h.layout,u.layout,a,l,null,ti.setLayoutProperty),tn(h.paint,u.paint,a,l,null,ti.setPaintProperty),e.bi(h.slot,u.slot)||a.push({command:ti.setSlot,args:[l,u.slot]}),e.bi(h.filter,u.filter)||a.push({command:ti.setFilter,args:[l,u.filter]}),e.bi(h.minzoom,u.minzoom)&&e.bi(h.maxzoom,u.maxzoom)||a.push({command:ti.setLayerZoomRange,args:[l,u.minzoom,u.maxzoom]}),h)h.hasOwnProperty(d)&&"layout"!==d&&"paint"!==d&&"filter"!==d&&"metadata"!==d&&"minzoom"!==d&&"maxzoom"!==d&&"slot"!==d&&(0===d.indexOf("paint.")?tn(h[d],u[d],a,l,d.slice(6),ti.setPaintProperty):e.bi(h[d],u[d])||a.push({command:ti.setLayerProperty,args:[l,d,u[d]]}));for(d in u)u.hasOwnProperty(d)&&!h.hasOwnProperty(d)&&"layout"!==d&&"paint"!==d&&"filter"!==d&&"metadata"!==d&&"minzoom"!==d&&"maxzoom"!==d&&"slot"!==d&&(0===d.indexOf("paint.")?tn(h[d],u[d],a,l,d.slice(6),ti.setPaintProperty):e.bi(h[d],u[d])||a.push({command:ti.setLayerProperty,args:[l,d,u[d]]}))}else a.push({command:ti.removeLayer,args:[l]}),c=g[g.lastIndexOf(l)+1],a.push({command:ti.addLayer,args:[u,c]})}}(l,r.layers,a)}catch(e){console.warn("Unable to compute style diff:",e),a=[{command:ti.setStyle,args:[r]}]}return a})(this.serialize(),i).filter(e=>!(e.command in ic));if(0===a.length)return!1;let n=a.filter(e=>!(e.command in iu));if(n.length>0)throw Error(`Unimplemented: ${n.map(e=>e.command).join(", ")}.`);let s=[];
213return a.forEach(e=>{s.push(this[e.command].apply(this,e.args))}),r&&Promise.all(s).then(r),this.stylesheet=i,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}addImage(i,r){return this.getImage(i)?this.fire(new e.t(Error("An image with this name already exists."))):(this.imageManager.addImage(i,this.scope,r),this._afterImageUpdated(i),this)}updateImage(e,i){this.imageManager.updateImage(e,this.scope,i)}getImage(e){return this.imageManager.getImage(e,this.scope)}removeImage(i){return this.getImage(i)?(this.imageManager.removeImage(i,this.scope),this._afterImageUpdated(i),this):this.fire(new e.t(Error("No image with this name exists.")))}_afterImageUpdated(i){this._availableImages=this.imageManager.listImages(this.scope),this._changes.updateImage(i),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages}),this.fire(new e.x("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addModel(e,i,r={}){return this._checkLoaded(),this._validate(eA,`models.${e}`,i,null,r)||(this.modelManager.addModel(e,i,this.scope),this._changes.setDirty()),this}hasModel(e){return this.modelManager.hasModel(e,this.scope)}removeModel(i){return this.hasModel(i)?(this.modelManager.removeModel(i,this.scope),this):this.fire(new e.t(Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.scope)}addSource(i,r,a={}){if(this._checkLoaded(),void 0!==this.getOwnSource(i))throw Error(`There is already a source with ID "${i}".`);if(!r.type)throw 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(ey,`sources.${i}`,r,null,a))return;this.map&&this.map._collectResourceTiming&&(r.collectResourceTiming=!0);let n=eH(i,r,this.dispatcher,this);n.scope=this.scope,n.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(n.id),source:n.serialize(),sourceId:n.id}));let s=i=>{let r=(i?"symbol:":"other:")+n.id,a=e.av(r,this.scope),s=this._sourceCaches[r]=new e6(a,n,i);(i?this._symbolSourceCaches:this._otherSourceCaches)[n.id]=s,s.onAdd(this.map)};s(!1),"vector"!==r.type&&"geojson"!==r.type||s(!0),n.onAdd&&n.onAdd(this.map),a.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(i){this._checkLoaded();let r=this.getOwnSource(i);if(!r)throw Error("There is no source with this ID");for(let r in this._layers)if(this._layers[r].source===i)return this.fire(new e.t(Error(`Source "${i}" cannot be removed while layer "${r}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===i)return this.fire(new e.t(Error(`Source "${i}" cannot be removed while terrain is using it.`)));for(let r of this.getOwnSourceCaches(i)){let i=e.cn(r.id);delete this._sourceCaches[i],this._changes.discardSourceCacheUpdate(r.id),r.fire(new e.x("data",{sourceDataType:"metadata",dataType:"source",sourceId:r.getSource().id})),r.setEventedParent(null),r.clearTiles()}return delete this._otherSourceCaches[i],delete this._symbolSourceCaches[i],this.mergeSources(),r.setEventedParent(null),r.onRemove&&r.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(e,i){this._checkLoaded(),this.getOwnSource(e).setData(i),this._changes.setDirty()}getOwnSource(e){let i=this.getOwnSourceCache(e);return i&&i.getSource()}getOwnSources(){let e=[];for(let i in this._otherSourceCaches){let r=this.getOwnSourceCache(i);r&&e.push(r.getSource())}return e}areTilesLoaded(){let e=this._mergedSourceCaches;for(let i in e){let r=e[i]._tiles;for(let e in r){let i=r[e];if("loaded"!==i.state&&"errored"!==i.state)return!1}}return!0}setLights(i){if(this._checkLoaded(),!i)return delete this.ambientLight,void delete this.directionalLight;let r=this._getTransitionParameters();for(let s of i){if(this._validate(ev,"lights",s))return;switch(s.type){case"ambient":if(this.ambientLight){let e=this.ambientLight;e.set(s),e.updateTransitions(r)}else this.ambientLight=new eB(s,a||(a=new e.a0({color:new e.a1(e._.properties_light_ambient.color),intensity:new e.a1(e._.properties_light_ambient.intensity)})),this.scope,this.options);break;case"directional":if(this.directionalLight){let e=this.directionalLight;e.set(s),e.updateTransitions(r)}else this.directionalLight=new eB(s,n||(n=new e.a0({direction:new e.ad(e._.properties_light_directional.direction),color:new e.a1(e._.properties_light_directional.color),intensity:new e.a1(e._.properties_light_directional.intensity),"cast-shadows":new e.a1(e._.properties_light_directional["cast-shadows"]),"shadow-intensity":new e.a1(e._.properties_light_directional["shadow-intensity"])})),this.scope,this.options)}}let s=new e.a3(this.z||0,r);this.ambientLight&&this.ambientLight.recalculate(s),this.directionalLight&&this.directionalLight.recalculate(s),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){let i=this.directionalLight,r=this.ambientLight;if(!i||!r)return;let a=e=>.2126*(e[0]<=.03928?e[0]/12.92:Math.pow((e[0]+.055)/1.055,2.4))+.7152*(e[1]<=.03928?e[1]/12.92:Math.pow((e[1]+.055)/1.055,2.4))+.0722*(e[2]<=.03928?e[2]/12.92:Math.pow((e[2]+.055)/1.055,2.4)),n=i.properties.get("color").toRenderColor(null).toArray01(),s=i.properties.get("intensity"),l=i.properties.get("direction"),h=1-e.c8(l.x,l.y,l.z)[2]/90,u=a(n)*s*h,c=r.properties.get("color").toRenderColor(null).toArray01(),d=r.properties.get("intensity");return Number(((u+a(c)*d)/2).toFixed(6))}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;let e=[];return this.directionalLight&&e.push(this.directionalLight.get()),this.ambientLight&&e.push(this.ambientLight.get()),e}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(i){if(!i)return this;if(e.aK(i)){let r=e.co(i),a=this.fragments.find(({id:e})=>e===r);if(!a)throw Error(`Style import '${i}' not found`);let n=e.cn(i);return a.style.getFragmentStyle(n)}{let e=this.fragments.find(({id:e})=>e===i);if(!e)throw Error(`Style import '${i}' not found`);return e.style}}getFeaturesetDescriptors(e){let i=this.getFragmentStyle(e);
213if(!i||!i.stylesheet.featuresets)return[];let r=[];for(let e in i.stylesheet.featuresets)r.push({featuresetId:e,importId:i.scope?i.scope:void 0});return r}getFeaturesetLayers(i,r){let a=this.getFragmentStyle(r),n=a.stylesheet.featuresets;if(!n||!n[i])return this.fire(new e.t(Error(`The featureset '${i}' does not exist in the map's style and cannot be queried.`))),[];let s=[];for(let e of n[i].selectors){let i=a.getOwnLayer(e.layer);i&&s.push(i)}return s}getConfigProperty(i,r){let a=this.getFragmentStyle(i);if(!a)return null;let n=e.av(r,a.scope),s=a.options.get(n),l=s?s.value||s.default:null;return l?l.serialize():null}setConfigProperty(i,r,a){let n;let s=this.getFragmentStyle(i);if(!s)return;let l=s.stylesheet.schema;if(!l||!l[r])return;let h=e.M(a);if("success"!==h.result)return void ih(this,h.value);let u=h.value.expression,c=e.av(r,s.scope),d=s.options.get(c);if(!d)return;let{minValue:p,maxValue:f,stepValue:m,type:_,values:g}=l[r],y=e.M(l[r].default);"success"===y.result&&(n=y.value.expression),n?(this.options.set(c,{...d,value:u,default:n,minValue:p,maxValue:f,stepValue:m,type:_,values:g}),this.updateConfigDependencies(r)):this.fire(new e.t(Error(`No schema defined for the config option "${r}" in the "${i}" fragment.`)))}getConfig(i){let r=this.getFragmentStyle(i);if(!r)return null;let a=r.stylesheet.schema;if(!a)return null;let n={};for(let i in a){let a=e.av(i,r.scope),s=r.options.get(a),l=s?s.value||s.default:null;n[i]=l?l.serialize():null}return n}setConfig(e,i){let r=this.getFragmentStyle(e);r&&(r.updateConfig(i,r.stylesheet.schema),this.updateConfigDependencies())}getSchema(e){let i=this.getFragmentStyle(e);return i?i.stylesheet.schema:null}setSchema(e,i){let r=this.getFragmentStyle(e);r&&(r.stylesheet.schema=i,r.updateConfig(r._config,i),this.updateConfigDependencies())}updateConfig(i,r){if(this._config=i,i||r){if(r)for(let a in r){let n,s;let l=e.M(r[a].default);if("success"===l.result&&(n=l.value.expression),i&&void 0!==i[a]){let r=e.M(i[a]);"success"===r.result&&(s=r.value.expression)}let{minValue:h,maxValue:u,stepValue:c,type:d,values:p}=r[a];if(n){let i=e.av(a,this.scope);this.options.set(i,{default:n,value:s,minValue:h,maxValue:u,stepValue:c,type:d,values:p})}else this.fire(new e.t(Error(`No schema defined for config option "${a}".`)))}else this.fire(new e.t(Error("Attempting to set config for a style without schema.")))}}updateConfigDependencies(e){for(let i of this._configDependentLayers){let r=this.getLayer(i);if(r){if(e&&!r.configDependencies.has(e))continue;r.possiblyEvaluateVisibility(),this._updateLayer(r)}}this.ambientLight&&this.ambientLight.updateConfig(this.options),this.directionalLight&&this.directionalLight.updateConfig(this.options),this.fog&&this.fog.updateConfig(this.options),this.forEachFragmentStyle(e=>{if(e._styleColorTheme.colorTheme){let i=e._evaluateColorThemeData(e._styleColorTheme.colorTheme);(!e._styleColorTheme.lut&&""!==i||e._styleColorTheme.lut&&i!==e._styleColorTheme.lut.data)&&e.setColorTheme(e._styleColorTheme.colorTheme)}}),this._changes.setDirty()}addLayer(i,r,a={}){let n;this._checkLoaded();let s=i.id;if(this._layers[s])return void this.fire(new e.t(Error(`Layer with i
213d "${s}" already exists on this map`)));if("custom"===i.type){if(ih(this,e.cp(i)))return;n=e.cq(i,this.scope,this._styleColorTheme.lut,this.options)}else{if("object"==typeof i.source&&(this.addSource(s,i.source),i=e.cm(i),i=e.l(i,{source:s})),this._validate(eT,`layers.${s}`,i,{arrayIndex:-1},a))return;n=e.cq(i,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(n),n.setEventedParent(this,{layer:{id:s}})}0!==n.configDependencies.size&&this._configDependentLayers.add(n.fqid);let l=this._order.length;if(r){let i=this._order.indexOf(r);if(-1===i)return void this.fire(new e.t(Error(`Layer with id "${r}" does not exist on this map.`)));n.slot===this._layers[r].slot?l=i:e.w(`Layer with id "${r}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(l,0,s),this._layerOrderChanged=!0,this._layers[s]=n;let h=this.getOwnLayerSourceCache(n),u=!!this.directionalLight&&this.directionalLight.shadowsEnabled();h&&n.canCastShadows()&&u&&(h.castsShadows=!0);let c=this._changes.getRemovedLayer(n);if(c&&n.source&&h&&"custom"!==n.type){this._changes.discardLayerRemoval(n);let i=e.av(n.source,n.scope);c.type!==n.type?this._changes.updateSourceCache(i,"clear"):(this._changes.updateSourceCache(i,"reload"),h.pause())}this._updateLayer(n),n.onAdd&&n.onAdd(this.map),n.scope=this.scope,this.mergeLayers()}moveLayer(i,r){this._checkLoaded();let a=this._checkLayer(i);if(!a||i===r)return;let n=this._order.indexOf(i);this._order.splice(n,1);let s=this._order.length;if(r){let i=this._order.indexOf(r);
213if(-1===i)return void this.fire(new e.t(Error(`Layer with id "${r}" does not exist on this map.`)));a.slot===this._layers[r].slot?s=i:e.w(`Layer with id "${r}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(s,0,i),this._changes.setDirty(),this._layerOrderChanged=!0,this.mergeLayers()}removeLayer(e){this._checkLoaded();let i=this._checkLayer(e);if(!i)return;i.setEventedParent(null);let r=this._order.indexOf(e);this._order.splice(r,1),delete this._layers[e],this._changes.setDirty(),this._layerOrderChanged=!0,this._configDependentLayers.delete(i.fqid),this._changes.removeLayer(i);let a=this.getOwnLayerSourceCache(i);if(a&&a.castsShadows){let e=!1;for(let r in this._layers)if(this._layers[r].source===i.source&&this._layers[r].canCastShadows()){e=!0;break}a.castsShadows=e}i.onRemove&&i.onRemove(this.map),this.mergeLayers()}getOwnLayer(e){return this._layers[e]}hasLayer(e){return e in this._mergedLayers}hasLayerType(e){for(let i in this._layers)if(this._layers[i].type===e)return!0;return!1}setLayerZoomRange(e,i,r){this._checkLoaded();let a=this._checkLayer(e);a&&(a.minzoom===i&&a.maxzoom===r||(null!=i&&(a.minzoom=i),null!=r&&(a.maxzoom=r),this._updateLayer(a)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(e,i){this._checkLoaded();let r=this._checkLayer(e);r&&r.slot!==i&&(r.slot=i,this._updateLayer(r))}setFilter(i,r,a={}){this._checkLoaded();let n=this._checkLayer(i);if(n&&!e.bi(n.filter,r))return null==r?(n.filter=void 0,void this._updateLayer(n)):void(this._validate(eS,`layers.${n.id}.filter`,r,{layerType:n.type},a)||(n.filter=e.cm(r),this._updateLayer(n)))}getFilter(i){let r=this._checkLayer(i);if(r)return e.cm(r.filter)}setLayoutProperty(i,r,a,n={}){this._checkLoaded();let s=this._checkLayer(i);if(s&&!e.bi(s.getLayoutProperty(r),a)){if(null!=a&&(!n||!1!==n.validate)&&ih(s,eE.call(eg,{key:`layers.${i}.layout.${r}`,layerType:s.type,objectKey:r,value:a,styleSpec:e._,style:{glyphs:!0,sprite:!0}})))return;s.setLayoutProperty(r,a),0!==s.configDependencies.size&&this._configDependentLayers.add(s.fqid),this._updateLayer(s)}}getLayoutProperty(e,i){let r=this._checkLayer(e);if(r)return r.getLayoutProperty(i)}setPaintProperty(i,r,a,n={}){this._checkLoaded();let s=this._checkLayer(i);if(!s||e.bi(s.getPaintProperty(r),a)||null!=a&&(!n||!1!==n.validate)&&ih(s,eM.call(eg,{key:`layers.${i}.paint.${r}`,layerType:s.type,objectKey:r,value:a,styleSpec:e._})))return;let l=s.setPaintProperty(r,a);0!==s.configDependencies.size&&this._configDependentLayers.add(s.fqid),l&&this._updateLayer(s),this._changes.updatePaintProperties(s)}getPaintProperty(e,i){let r=this._checkLayer(e);if(r)return r.getPaintProperty(i)}setFeatureState(i,r){this._checkLoaded();let a=i.featureset;if(a){if("featuresetId"in a){let e=this.getFragmentStyle(a.importId);for(let{source:n,sourceLayer:s}of e.getFeaturesetLayers(a.featuresetId))e.setFeatureState({id:i.id,source:n,sourceLayer:s},r)}else if("layerId"in a){let e=this.getLayer(a.layerId);this.setFeatureState({id:i.id,source:e.source,sourceLayer:e.sourceLayer},r)}return}let n=i.source,s=i.sourceLayer,l=this._checkSource(n);if(!l)return;let h=l.type;if("geojson"===h&&s)return void this.fire(new e.t(Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===h&&!s)return void this.fire(new e.t(Error("The sourceLayer parameter must be provided for vector source types.")));for(let a of(void 0===i.id&&this.fire(new e.t(Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(n)))a.setFeatureState(s,i.id,r)}removeFeatureState(i,r){this._checkLoaded();let a=i.featureset;if(a){if("featuresetId"in a){let e=this.getFragmentStyle(a.importId);for(let{source:n,sourceLayer:s}of e.getFeaturesetLayers(a.featuresetId))e.removeFeatureState({id:i.id,source:n,sourceLayer:s},r)}else if("layerId"in a){let e=this.getLayer(a.layerId);this.removeFeatureState({id:i.id,source:e.source,sourceLayer:e.sourceLayer},r)}return}let n=i.source,s=this._checkSource(n);if(!s)return;let l=s.type,h="vector"===l?i.sourceLayer:void 0;if("vector"===l&&!h)return void this.fire(new e.t(Error("The sourceLayer parameter must be provided for vector source types.")));if(r&&"string"!=typeof i.id&&"number"!=typeof i.id)return void this.fire(new e.t(Error("A feature id is required to remove its specific state property.")));for(let e of this.getOwnSourceCaches(n))e.removeFeatureState(h,i.id,r)}getFeatureState(i){this._checkLoaded();let r=i.featureset;if(r){let a;if("featuresetId"in r){let n=this.getFragmentStyle(r.importId);for(let{source:s,sourceLayer:l}of n.getFeaturesetLayers(r.featuresetId)){let r=n.getFeatureState({id:i.id,source:s,sourceLayer:l});if(r&&!a)a=r;else if(!e.bi(a,r))return void this.fire(new e.t(Error("The same feature id exists in multiple sources in the featureset, but their feature states are not consistent through the sources.")))}}else if("layerId"in i){let e=this.getLayer(r.layerId);a=this.getFeatureState({id:i.id,source:e.source,sourceLayer:e.sourceLayer})}return a}let a=i.source,n=i.sourceLayer,s=this._checkSource(a);if(s){if("vector"!==s.type||n)return void 0===i.id&&this.fire(new e.t(Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(a)[0].getFeatureState(n,i.id);this.fire(new e.t(Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(i){return this.stylesheet.transition=e.l({},this.stylesheet.transition,i),this.transition=this.stylesheet.transition,this}getTransition(){return e.l({},this.stylesheet.transition)}serialize(){this._checkLoaded();let i=this.getTerrain(),r=i&&this.terrain&&this.terrain.scope===this.scope?i:this.stylesheet.terrain;return e.cr({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:r,fog:this.stylesheet.fog,center:this.stylesheet.center,"color-theme":this.stylesheet["color-theme"],zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:this._serializeSources(),layers:this._serializeLayers(this._order)},e=>void 0!==e)}_updateFilteredLayers(e){for(let i of Object.values(this._mergedLayers))e(i)&&this._updateLayer(i)}_updateLayer(i){this._changes.updateLayer(i);let r=this.getLayerSourceCache(i),a=e.av(i.source,i.scope),n=this._changes.getUpd
213atedSourceCaches();i.source&&!n[a]&&r&&"raster"!==r.getSource().type&&(this._changes.updateSourceCache(a,"reload"),r.pause()),i.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(e){let i=e=>this._mergedLayers[e].is3D(),r=this.order,a={},n=[];for(let s=r.length-1;s>=0;s--){let l=r[s];if(i(l))for(let i of(a[l]=s,e)){let e=i[l];if(e)for(let i of e)n.push(i)}}n.sort((e,i)=>i.intersectionZ-e.intersectionZ);let s=[];for(let l=r.length-1;l>=0;l--){let h=r[l];if(i(h))for(let e=n.length-1;e>=0;e--){let i=n[e].feature;if(i.layer&&a[i.layer.id]<l)break;s.push(i),n.pop()}else for(let i of e){let e=i[h];if(e)for(let i of e)s.push(i.feature)}}return s}queryRenderedFeatures(i,r,a){r&&!Array.isArray(r)&&r.filter&&this._validate(eS,"queryRenderedFeatures.filter",r.filter,null,r);let n,s=!1,l=new Set;if(r&&r.layers){if(!Array.isArray(r.layers))return this.fire(new e.t(Error("parameters.layers must be an Array."))),[];for(let i of(n=[],r.layers)){let r=this._mergedLayers[i];if(!r)return this.fire(new e.t(Error(`The layer '${i}' does not exist in the map's style and cannot be queried for features.`))),[];r.is3D()&&(s=!0),l.add(r.source),n.push(i)}}else s=this.has3DLayers();let h=this._queryRenderedFeatures(i,a,{layerIds:n,filter:r.filter,has3DLayers:s,includedSources:l}),u=this._flattenAndSortRenderedFeatures(h),c=[];for(let i of u)e.co(i.layer.id)===this.scope&&c.push(i);return c}queryRenderedFeaturesForInteractions(i,r,a){let n=[];for(let{featureset:s,filter:l,radius:h}of r){let r=!1,u=[],c=new Set;if("featuresetId"in s){let e=this.getFeaturesetLayers(s.featuresetId,s.importId);if(0===e.length)continue;for(let i of e)i.is3D()&&(r=!0),c.add(i.source),u.push(i.fqid)}else if("layerId"in s){let i=this._mergedLayers[s.layerId];if(!i)return this.fire(new e.t(Error(`The layer '${s.layerId}' does not exist in the map's style and cannot be queried for features.`))),[];i.is3D()&&(r=!0),c.add(i.source),u.push(s.layerId)}let d=i;if(h){if(i instanceof e.P||"number"==typeof i[0]){let r=e.P.convert(i);d=[[r.x-h,r.y-h],[r.x+h,r.y+h]]}else{let r=e.P.convert(i[0]),a=e.P.convert(i[1]);d=[[r.x-h,r.y-h],[a.x+h,a.y+h]]}}n=n.concat(this._queryRenderedFeatures(d,a,{layerIds:u,filter:l,has3DLayers:r,includedSources:c}))}let s=this._flattenAndSortRenderedFeatures(n),l=(e,i,r)=>{let a=e.clone();if(delete a.layer,a.featureset=i,r&&r.featureNamespace&&(a.namespace=r.featureNamespace),r&&r.properties){let i={},n=this.map.transform.zoom;for(let a of Object.keys(r.properties)){let s=r.properties[a].evaluate({zoom:n},e._vectorTileFeature,e.state,e.tile,this._availableImages);null!=s&&(i[a]=s)}a.properties=i}return a},h=[];for(let i of s){let a=i.layer.id,n=e.cn(a),s=e.co(a);for(let{featureset:e}of r)if(!("layerId"in e)||e.layerId===a){if("layerId"in e&&e.layerId===a){let r=l(i,e);h.push(r);continue}if(!("featuresetId"in e)||e.importId===s&&this.getFeaturesetLayers(e.featuresetId,e.importId).map(e=>e.id).includes(n))for(let r of this._mergedLayerSelectors.get(a)||[]){let a=l(i,e,r);h.push(a)}}}return h}_queryRenderedFeatures(i,r,a){let{layerIds:n,filter:s,has3DLayers:l,includedSources:h}=a,u=[],c=eF.createFromScreenPoints(i,r);for(let i in this._mergedSourceCaches){if(!this._mergedSourceCaches[i].getSource())continue;let a=this._mergedSourceCaches[i].getSource().id;n&&!h.has(a)||u.push(function(i,r,a,n,s,l,h,u,c=!1){let d=i.tilesIn(a,u,c);d.sort(eZ);let p=[];for(let a of d)p.push({wrappedTileID:a.tile.tileID.wrapped().key,queryResults:a.tile.queryRenderedFeatures(r,i._state,a,n,s,l,h,function(i,r){let a=e.a6.mat4.identity([]);return e.a6.mat4.scale(a,a,[.5*i.width,-(.5*i.height),1]),e.a6.mat4.translate(a,a,[1,-1,0]),e.a6.mat4.multiply(a,a,i.calculateProjMatrix(r.toUnwrapped())),Float32Array.from(a)}(i.transform,a.tile.tileID),c)});let f=function(e){let i={},r={};for(let a of e){let e=a.queryResults,n=a.wrappedTileID,s=r[n]=r[n]||{};for(let r in e){let a=e[r],n=s[r]=s[r]||{},l=i[r]=i[r]||[];for(let e of a)n[e.featureIndex]||(n[e.featureIndex]=!0,l.push(e))}}return i}(p);for(let r in f)f[r].forEach(a=>{let n=a.feature,s=n.layer;s&&"background"!==s.type&&"sky"!==s.type&&"slot"!==s.type&&(e.aK(r)||(n.source=s.source,s["source-layer"]&&(n.sourceLayer=s["source-layer"])),n.state=void 0!==n.id?i.getFeatureState(s["source-layer"],n.id):{})});return f}(this._mergedSourceCaches[i],this._mergedLayers,c,s,n||[],this._availableImages,r,l,!!this.map._showQueryGeometry))}return this.placement&&u.push(function(i,r,a,n,s,l,h,u){let c={},d=h.queryRenderedSymbols(a),p=[];for(let e of Object.keys(d).map(Number))p.push(u[e]);for(let e of(p.sort(eZ),p)){let r=e.featureIndex.lookupSymbolFeatures(d[e.bucketInstanceId],e.bucketIndex,e.sourceLayerIndex,n,s,l,i);for(let i in r){let a=c[i]=c[i]||[],n=r[i];for(let i of(n.sort((i,r)=>{let a=e.featureSortOrder;if(a){let e=a.indexOf(i.featureIndex);return a.indexOf(r.featureIndex)-e}return r.featureIndex-i.featureIndex}),n))a.push(i)}}
213for(let a in c)c[a].forEach(n=>{let s=n.feature,l=i[a],h=r(l);if(!h)return;let u=h.getFeatureState(s.layer["source-layer"],s.id);s.state=u,e.aK(l.id)||(s.source=s.layer.source,s.layer["source-layer"]&&(s.sourceLayer=s.layer["source-layer"]))});return c}(this._mergedLayers,this.getLayerSourceCache.bind(this),c.screenGeometry,s,n||[],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData)),u}querySourceFeatures(e,i){let r=i&&i.filter;r&&this._validate(eS,"querySourceFeatures.filter",r,null,i);let a=[];for(let r of this.getOwnSourceCaches(e))a=a.concat(function(e,i){let r=e.getRenderableIds().map(i=>e.getTileByID(i)),a=[],n={};for(let e=0;e<r.length;e++){let s=r[e],l=s.tileID.canonical.key;n[l]||(n[l]=!0,s.querySourceFeatures(a,i))}return a}(r,i));return a}addSourceType(e,i,r){return im.getSourceType(e)?r(Error(`A source type called "${e}" already exists.`)):(im.setSourceType(e,i),i.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:e,url:i.workerSourceURL},r):r(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(i,r,a={}){this._checkLoaded();let n=this.light.getLight(),s=!1;for(let r in i)if(!e.bi(i[r],n[r])){s=!0;break}if(!s)return;let l=this._getTransitionParameters();this.light.setLight(i,r,a),this.light.updateTransitions(l)}getTerrain(){return this.terrain&&1===this.terrain.drapeRenderMode?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}checkCanvasFingerprintNoise(){void 0===this.disableElevatedTerrain&&(this.disableElevatedTerrain=e.q.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&e.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(i,r=1){if(this._checkLoaded(),!i)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),0===r&&delete this.terrain,null===i?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let a=i,n=null==i.source;if(1===r){if(this.disableElevatedTerrain)return;if("object"==typeof a.source){let i="terrain-dem-src";this.addSource(i,a.source),a=e.cm(a),a=e.l(a,{source:i})}let i=e.l({},a),r={};if(this.terrain&&n){i.source=this.terrain.get().source;let e=this.terrain?this.getFragmentStyle(this.terrain.scope):null;e&&(r.style=e.serialize())}if(this._validate(eb,"terrain",i,r))return}if(this.terrain&&(this.terrain.scope===this.scope||n)&&(!this.terrain||r===this.terrain.drapeRenderMode)){let r=this.terrain,n=r.get();for(let i of Object.keys(e._.terrain))!a.hasOwnProperty(i)&&e._.terrain[i].default&&(a[i]=e._.terrain[i].default);for(let a in i)if(!e.bi(i[a],n[a])){r.set(i,this.options),this.stylesheet.terrain=i;let a=this._getTransitionParameters({duration:0});r.updateTransitions(a),this.fire(new e.x("data",{dataType:"style"}));break}}else{if(!a)return;this._createTerrain(a,r),this.fire(new e.x("data",{dataType:"style"}))}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(e){let i=this.fog=new eO(e,this.map.transform,this.scope,this.options);this.stylesheet.fog=i.get();let r=this._getTransitionParameters({duration:0});i.updateTransitions(r)}_updateMarkersOpacity(){0!==this.map._markers.length&&this.map._requestDomTask(()=>{for(let e of this.map._markers)e._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(i){if(this._checkLoaded(),!i)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){let r=this.fog;if(!e.bi(r.get(),i)){r.set(i,this.options),this.stylesheet.fog=r.get();let e=this._getTransitionParameters({duration:0});r.updateTransitions(e)}}else this._createFog(i);this._markersNeedUpdate=!0}setColorTheme(i){this._checkLoaded();let r=()=>{for(let e in this._layers)this._layers[e].lut=this._styleColorTheme.lut;for(let e in this._sourceCaches)this._sourceCaches[e].clearTiles()};if(this._styleColorTheme.colorTheme=i,!i)return this._styleColorTheme.lut=null,void r();let a=this._evaluateColorThemeData(i);this._loadColorTheme(a).then(()=>{this.fire(new e.x("colorthemeset")),r()}).catch(i=>{e.w(`Couldn't set color theme: ${i}`)})}_getTransitionParameters(i){return{now:e.q.now(),transition:e.l(this.transition,i)}}updateDrapeFirstLayers(){if(!this.terrain)return;let e=[],i=[];for(let r of this._mergedOrder)this.isLayerDraped(this._mergedLayers[r])?e.push(r):i.push(r);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...e),this._drapedFirstOrder.push(...i)}_createTerrain(e,i){let r=this.terrain=new eL(e,i,this.scope,this.options);1===i&&(this.stylesheet.terrain=e),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();let a=this._getTransitionParameters({duration:0});r.updateTransitions(a)}_force3DLayerUpdate(){for(let e in this._layers){let i=this._layers[e];
213"fill-extrusion"===i.type&&this._updateLayer(i)}}_forceSymbolLayerUpdate(){for(let e in this._layers){let i=this._layers[e];"symbol"===i.type&&this._updateLayer(i)}}_validate(i,r,a,n,s={}){if(s&&!1===s.validate)return!1;let l=e.l({},this.serialize());return ih(this,i.call(eg,e.l({key:r,style:l,value:a,styleSpec:e._},n)))}_remove(){for(let i in this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),e.cs.off("pluginStateChange",this._rtlTextPluginCallback),this._mergedLayers)this._mergedLayers[i].setEventedParent(null);for(let e in this._mergedSourceCaches)this._mergedSourceCaches[e].clearTiles(),this._mergedSourceCaches[e].setEventedParent(null);this.setEventedParent(null),delete this.fog,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.modelManager.setEventedParent(null),this.dispatcher.remove())}clearSource(e){for(let i of this.getSourceCaches(e))i.clearTiles()}clearSources(){for(let e in this._mergedSourceCaches)this._mergedSourceCaches[e].clearTiles()}
213reloadSource(e){for(let i of this.getSourceCaches(e))i.resume(),i.reload()}reloadSources(){for(let e of this.getSources())e.reload&&e.reload()}updateSources(e){let i;for(let r in this.directionalLight&&(i=ia(this.directionalLight)),this._mergedSourceCaches)this._mergedSourceCaches[r].update(e,void 0,void 0,i)}_generateCollisionBoxes(){for(let e in this._sourceCaches){let i=this._sourceCaches[e];i.resume(),i.reload()}}_updatePlacement(i,r,a,n,s,l,h=!1){let u=!1,c=!1,d={},p={};for(let i of this._mergedOrder){let a=this._mergedLayers[i];if("symbol"!==a.type)continue;let n=e.av(a.source,a.scope),s=d[n];if(!s){let e=this.getLayerSourceCache(a);if(!e)continue;let i=e.getRenderableIds(!0).map(i=>e.getTileByID(i));p[n]=i.slice(),s=d[n]=i.sort((e,i)=>i.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(i.tileID)?-1:1))}let l=this.crossTileSymbolIndex.addLayer(a,s,r.center.lng,r.projection);u=u||l}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),h=h||this._layerOrderChanged||0===n,this._layerOrderChanged&&this.fire(new e.x("neworder")),(h||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(e.q.now(),r.zoom))&&(this.pauseablePlacement=new tj(r,this._mergedOrder,h,a,n,s,this.placement,this.fog&&r.projection.supportsFog?this.fog.state:null,this._buildingIndex),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,d,p,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(e.q.now()),c=!0),u&&this.pauseablePlacement.placement.setStale()),c||u){this._buildingIndex.onNewFrame(r.zoom);for(let i=0;i<this._mergedOrder.length;i++){let r=this._mergedLayers[this._mergedOrder[i]];if("symbol"!==r.type)continue;let a=this.isLayerClipped(r);this.placement.updateLayerOpacities(r,d[e.av(r.source,r.scope)],i,a?l:null)}}return{needsRerender:!this.pauseablePlacement.isDone()||this.placement.hasTransitions(e.q.now())}}_releaseSymbolFadeTiles(){for(let e in this._sourceCaches)this._sourceCaches[e].releaseSymbolFadeTiles()}addImport(i,r){this._checkLoaded();let a=this.stylesheet.imports=this.stylesheet.imports||[];if(-1!==a.findIndex(({id:e})=>e===i.id))return void this.fire(new e.t(Error(`Import with id '${i.id}' already exists in the map's style.`)));if(!r)return a.push(i),this._loadImports([i],!0);let n=a.findIndex(({id:e})=>e===r);return -1===n&&this.fire(new e.t(Error(`Import with id "${r}" does not exist on this map.`))),this.stylesheet.imports=a.slice(0,n).concat(i).concat(a.slice(n)),this._loadImports([i],!0,r)}updateImport(i,r){this._checkLoaded();let a=this.stylesheet.imports||[],n=this.getImportIndex(i);return -1===n||("string"==typeof r?this.setImportUrl(i,r):(r.url&&r.url!==a[n].url&&this.setImportUrl(i,r.url),e.bi(r.config,a[n].config)||this.setImportConfig(i,r.config),e.bi(r.data,a[n].data)||this.setImportData(i,r.data))),this}moveImport(e,i){this._checkLoaded();let r=this.stylesheet.imports||[],a=this.getImportIndex(e);if(-1===a)return this;let n=this.getImportIndex(i);if(-1===n)return this;let s=r[a],l=this.fragments[a];return r=r.filter(({id:i})=>i!==e),this.fragments=this.fragments.filter(({id:i})=>i!==e),this.stylesheet.imports=r.slice(0,n).concat(s).concat(r.slice(n)),this.fragments=this.fragments.slice(0,n).concat(l).concat(this.fragments.slice(n)),this.mergeLayers(),this}setImportUrl(e,i){this._checkLoaded();let r=this.stylesheet.imports||[],a=this.getImportIndex(e);if(-1===a)return this;r[a].url=i;let n=this.fragments[a];return n.style=this._createFragmentStyle(r[a]),n.style.on("style.import.load",()=>this.mergeAll()),n.style.loadURL(i),this}setImportData(e,i){this._checkLoaded();let r=this.getImportIndex(e),a=this.stylesheet.imports||[];return -1===r?this:i?(this.fragments[r].style.setState(i),this._reloadImports(),this):(delete a[r].data,this.setImportUrl(e,a[r].url))}setImportConfig(e,i){this._checkLoaded();let r=this.getImportIndex(e),a=this.stylesheet.imports||[];if(-1===r)return this;i?a[r].config=i:delete a[r].config;let n=this.fragments[r],s=n.style.stylesheet&&n.style.stylesheet.schema;return n.config=i,n.style.updateConfig(i,s),this.updateConfigDependencies(),this}removeImport(e){this._checkLoaded();let i=this.stylesheet.imports||[],r=this.getImportIndex(e);-1!==r&&(i.splice(r,1),this.fragments[r].style._remove(),this.fragments.splice(r,1),this._reloadImports())}getImportIndex(i){let r=(this.stylesheet.imports||[]).findIndex(e=>e.id===i);return -1===r&&this.fire(new e.t(Error(`Import '${i}' does not exist in the map's style and cannot be updated.`))),r}getLayer(e){return this._mergedLayers[e]}getSources(){let e=[];for(let i in this._mergedOtherSourceCaches){let r=this._mergedOtherSourceCaches[i];r&&e.push(r.getSource())}return e}getSource(e,i){let r=this.getSourceCache(e,i);return r&&r.getSource()}getLayerSource(e){let i=this.getLayerSourceCache(e);return i&&i.getSource()}getSourceCache(i,r){let a=e.av(i,r);return this._mergedOtherSourceCaches[a]}getLayerSourceCache(i){let r=e.av(i.source,i.scope);return"symbol"===i.type?this._mergedSymbolSourceCaches[r]:this._mergedOtherSourceCaches[r]}getSourceCaches(e){if(null==e)return Object.values(this._mergedSourceCaches);let i=[];return this._mergedOtherSourceCaches[e]&&i.push(this._mergedOtherSourceCaches[e]),this._mergedSymbolSourceCaches[e]&&i.push(this._mergedSymbolSourceCaches[e]),i}
213updateSourceCaches(){let e=this._changes.getUpdatedSourceCaches();for(let i in e){let r=e[i];"reload"===r?this.reloadSource(i):"clear"===r&&this.clearSource(i)}}updateLayers(e){for(let i of this._changes.getUpdatedPaintProperties()){let r=this.getLayer(i);r&&r.updateTransitions(e)}}getImages(e,i,r){this.imageManager.getImages(i.icons,i.scope,r),this._updateTilesForChangedImages();let a=e=>{e&&e.setDependencies(i.tileID.key,i.type,i.icons)};a(this._otherSourceCaches[i.source]),a(this._symbolSourceCaches[i.source])}getGlyphs(e,i,r){this.glyphManager.getGlyphs(i.stacks,i.scope,r)}getResource(i,r,a){return e.ct(r,a)}getOwnSourceCache(e){return this._otherSourceCaches[e]}getOwnLayerSourceCache(e){return"symbol"===e.type?this._symbolSourceCaches[e.source]:this._otherSourceCaches[e.source]}getOwnSourceCaches(e){let i=[];return this._otherSourceCaches[e]&&i.push(this._otherSourceCaches[e]),this._symbolSourceCaches[e]&&i.push(this._symbolSourceCaches[e]),i}_isSourceCacheLoaded(i){let r=this.getOwnSourceCaches(i);return 0===r.length?(this.fire(new e.t(Error(`There is no source with ID '${i}'`))),!1):r.every(e=>e.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(e,i){if(!this._clipLayerPresent&&"fill-extrusion"!==e.type)return!1;let r="fill-extrusion"===e.type&&"building"===e.sourceLayer;if(e.is3D()){if(r||i&&"batched-model"===i.type||"model"===e.type)return!0}else if("symbol"===e.type)return!0;return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.fragments.forEach(e=>{e.style._remove()}),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}im.getSourceType=function(e){return e$[e]},im.setSourceType=function(e,i){e$[e]=i},im.registerForPluginStateChange=e.cd;var i_="\n#define EPSILON 0.0000001\n#define PI 3.141592653589793\n#ifdef RENDER_CUTOFF\nfloat cutoff_opacity(vec4 cutoff_params,float depth) {float near=cutoff_params.x;float far=cutoff_params.y;float cutoffStart=cutoff_params.z;float cutoffEnd=cutoff_params.w;float linearDepth=(depth-near)/(far-near);return clamp((linearDepth-cutoffStart)/(cutoffEnd-cutoffStart),0.0,1.0);}\n#endif",ig="\nout vec4 glFragColor;highp float unpack_depth(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}\n#ifdef INDICATOR_CUTOUT\nuniform vec2 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params;\n#endif\nvec4 applyCutout(vec4 color) {\n#ifdef INDICATOR_CUTOUT\nfloat holeMinOpacity=u_indicator_cutout_params.x;float holeRadius=max(u_indicator_cutout_params.y,0.0);float holeAspectRatio=u_indicator_cutout_params.z;float fadeStart=u_indicator_cutout_params.w;float distA=distance(vec2(gl_FragCoord.x,gl_FragCoord.y*holeAspectRatio),vec2(u_indicator_cutout_centers[0],u_indicator_cutout_centers[1]*holeAspectRatio));return color*min(smoothstep(fadeStart,holeRadius,distA)+holeMinOpacity,1.0);\n#else\nreturn color;\n#endif\n}\n#ifdef DEBUG_WIREFRAME\n#define HANDLE_WIREFRAME_DEBUG \\\nglFragColor=vec4(0.7,0.0,0.0,0.7); \\\ngl_FragDepth=gl_FragCoord.z-0.0001;\n#else\n#define HANDLE_WIREFRAME_DEBUG\n#endif\n#ifdef RENDER_CUTOFF\nuniform highp vec4 u_cutoff_params;in float v_cutoff_opacity;\n#endif\nvec4 textureLodCustom(sampler2D image,highp vec2 pos,highp vec2 lod_coord) {highp vec2 size=vec2(textureSize(image,0));highp vec2 dx=dFdx(lod_coord.xy*size);highp vec2 dy=dFdy(lod_coord.xy*size);highp float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));highp float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}vec4 applyLUT(highp sampler3D lut,vec4 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return vec4(texture(lut,uvw).rgb,col.a);}vec3 applyLUT(highp sampler3D lut,vec3 col) {return applyLUT(lut,vec4(col,1.0)).rgb;}",iy="\n#define EXTENT 8192.0\n#define RAD_TO_DEG 180.0/PI\n#define DEG_TO_RAD PI/180.0\n#define GLOBE_RADIUS EXTENT/PI/2.0\nfloat wrap(float n,float min,float max) {float d=max-min;
213float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {\n#ifndef PROJECTED_POS_ON_VIEWPORT\nfloat tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;\n#else\nreturn vec3(0.0);\n#endif\n}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(\nunpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const vec2 units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (units_to_pixels*pos+offset)/pattern_size;}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {return get_pattern_pos(pixel_coord_upper,pixel_coord_lower,pattern_size,vec2(tile_units_to_pixels),pos);}float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(PI/4.0+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);}\n#ifdef RENDER_CUTOFF\nuniform vec4 u_cutoff_params;out float v_cutoff_opacity;\n#endif\nconst vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt)\n{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}",ix="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",iv="\n#define ELEVATION_SCALE 7.0\n#define ELEVATION_OFFSET 450.0\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix(\nmix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;}\n#else\nvec3 elevationVector(vec2 pos) { return vec3(0,0,1); }\n#endif\n#ifdef TERRAIN\nuniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}
213float currentElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem,pos).r;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(dd,0)).r;float bl=texture(u_dem,pos+vec2(0,dd)).r;float br=texture(u_dem,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}float prevElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem_prev,pos).r;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem_prev,pos).r;float tr=texture(u_dem_prev,pos+vec2(dd,0)).r;float bl=texture(u_dem_prev,pos+vec2(0,dd)).r;float br=texture(u_dem_prev,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}\n#ifdef TERRAIN_VERTEX_MORPHING\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nfloat nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}\n#else\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nreturn currentElevation(apos);}\n#endif\nvec4 fourSample(vec2 pos,vec2 off) {float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(off.x,0.0)).r;float bl=texture(u_dem,pos+vec2(0.0,off.y)).r;float br=texture(u_dem,pos+off).r;return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);}\n#else\nfloat elevation(vec2 pos) { return 0.0; }\n#endif\n#ifdef DEPTH_OCCLUSION\nuniform highp sampler2D u_depth;uniform highp vec2 u_depth_size_inv;uniform highp vec2 u_depth_range_unpack;uniform highp float u_occluder_half_size;uniform highp float u_occlusion_depth_offset;\n#ifdef DEPTH_D24\nfloat unpack_depth(float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}vec4 unpack_depth4(vec4 depth) {return depth*u_depth_range_unpack.x+vec4(u_depth_range_unpack.y);}\n#else\nhighp float unpack_depth_rgba(vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}\n#endif\nbool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;\n#ifdef DEPTH_D24\nfloat depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r);\n#else\nfloat depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5));\n#endif\nreturn coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_
213size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5;\n#ifdef DEPTH_D24\nhighp vec4 depth=vec4(\ntexture(u_depth,uv-df.xz).r,texture(u_depth,uv+df.xz).r,texture(u_depth,uv-df.zy).r,texture(u_depth,uv+df.zy).r\n);depth=unpack_depth4(depth);\n#else\nhighp vec4 depth=vec4(\nunpack_depth_rgba(texture(u_depth,uv-df.xz)),unpack_depth_rgba(texture(u_depth,uv+df.xz)),unpack_depth_rgba(texture(u_depth,uv-df.zy)),unpack_depth_rgba(texture(u_depth,uv+df.zy))\n);\n#endif\nreturn depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5;int NX=3;int NY=4;highp vec2 df=u_occluder_half_size*u_depth_size_inv;highp vec2 oneStep=2.0*u_occluder_half_size*u_depth_size_inv/vec2(NX-1,NY-1);highp float res=0.0;for (int y=0; y < NY;++y) {for (int x=0; x < NX;++x) {\n#ifdef DEPTH_D24\nhighp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r);\n#else\nhighp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)));\n#endif\nres+=1.0-clamp(300.0*(coord.z+u_occlusion_depth_offset-depth),0.0,1.0);}}res=clamp(2.0*res/float(NX*NY)-0.5,0.0,1.0);return res;}highp float occlusionFade(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec4 depth=getCornerDepths(coord.xy);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z+u_occlusion_depth_offset)-depth),0.0,1.0));}\n#else\nbool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; }\n#endif//DEPTH_OCCLUSION",ib="#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;out vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);}\n#endif",iw="highp vec3 hash(highp vec2 p) {highp vec3 p3=fract(p.xyx*vec3(443.8975,397.2973,491.1871));p3+=dot(p3,p3.yxz+19.19);return fract((p3.xxy+p3.yzz)*p3.zyx);}vec3 dither(vec3 color,highp vec2 seed) {vec3 rnd=hash(seed)+hash(seed+0.59374)-0.5;return color+rnd/255.0;}\n#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos,float opacity_limit) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,min(opacity,opacity_limit));}vec3 fog_apply(vec3 color,vec3 pos) {return fog_apply(color,pos,1.0);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}
213vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x > 0.0 || u_fog_vertical_limit.y > 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) {\n#ifdef FOG_DITHERING\nvec2 dither_seed=gl_FragCoord.xy+u_fog_temporal_offset;return dither(color,dither_seed);\n#else\nreturn color;\n#endif\n}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}\n#endif",iT="#ifdef RASTER_ARRAY\nuniform highp sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);ivec4 _raTexLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}vec2 _raTexLinearMix(highp vec2 fxy,highp vec4 colorMix,highp float colorOffset,highp vec4 t00,highp vec4 t10,highp vec4 t01,highp vec4 t11) {vec2 c00=t00==NODATA ? vec2(0) : vec2(colorOffset+dot(t00,colorMix),1);vec2 c10=t10==NODATA ? vec2(0) : vec2(colorOffset+dot(t10,colorMix),1);vec2 c01=t01==NODATA ? vec2(0) : vec2(colorOffset+dot(t01,colorMix),1);vec2 c11=t11==NODATA ? vec2(0) : vec2(colorOffset+dot(t11,colorMix),1);return mix(mix(c01,c11,fxy.x),mix(c00,c10,fxy.x),fxy.y);}vec2 raTexture2D_image0_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image0,c.yz,0),texelFetch(u_image0,c.xz,0),texelFetch(u_image0,c.yw,0),texelFetch(u_image0,c.xw,0)\n);}vec2 raTexture2D_image1_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image1,c.yz,0),texelFetch(u_image1,c.xz,0),texelFetch(u_image1,c.yw,0),texelFetch(u_image1,c.xw,0)\n);}vec2 raTexture2D_image0_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image0,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}vec2 raTexture2D_image1_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image1,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}\n#endif",iS="#ifdef RASTER_ARRAY\nuniform sampler2D u_velocity;uniform mediump vec2 u_velocity_res;uniform mediump float u_max_speed;const vec4 NO_DATA=vec4(1);const vec2 INVALID_VELOCITY=vec2(-1);uniform highp vec2 u_uv_offset;uniform highp float u_data_offset;uniform highp vec2 u_data_scale;ivec4 rasterArrayLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}highp vec2 lookup_velocity(highp vec2 uv) {uv=u_uv_offset.x+u_uv_offset.y*uv;highp vec2 fxy;ivec4 c=rasterArrayLinearCoord(uv,u_velocity_res,fxy);highp vec4 tl=texelFetch(u_velocity,c.yz,0);highp vec4 tr=texelFetch(u_velocity,c.xz,0);highp vec4 bl=texelFetch(u_velocity,c.yw,0);highp vec4 br=texelFetch(u_velocity,c.xw,0);if (tl==NO_DATA) {return INVALID_VELOCITY;}if (tr==NO_DATA) {return INVALID_VELOCITY;}if (bl==NO_DATA) {return INVALID_VELOCITY;}if (br==NO_DATA) {return INVALID_VELOCITY;}highp vec4 t=mix(mix(bl,br,fxy.x),mix(tl,tr,fxy.x),fxy.y);highp vec2 velocity=u_data_offset+vec2(dot(t.rg,u_data_scale),dot(t.ba,u_data_scale));velocity.y=-velocity.y;velocity/=max(u_max_speed,length(velocity));return velocity;}\n#endif\nuniform highp float u_particle_pos_scale;uniform highp vec2 u_particle_pos_offset;highp vec4 pack_pos_to_rgba(highp vec2 p) {highp vec2 v=(p+u_particle_pos_offset)/u_particle_pos_scale;highp vec4 r=vec4(v.x,fract(v.x*255.0),v.y,fract(v.y*255.0));return vec4(r.x-r.y/255.0,r.y,r.z-r.w/255.0,r.w);}highp vec2 unpack_pos_from_rgba(highp vec4 v) {v=floor(v*255.0+0.5)/255.0;highp vec2 p=vec2(v.x+(v.y/255.0),v.z+(v.w/255.0));return u_particle_pos_scale*p-u_particle_pos_offset;}",iM="#ifdef RENDER_SHADOWS\nuniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_normal_offset;vec3 shadow_normal_offset(vec3 normal) {float tileInMeters=u_shadow_normal_offset[0];vec3 n=vec3(-normal.xy,tileInMeters*normal.z);float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return n*dotScale;}vec3 shadow_normal_offset_model(vec3 normal) {vec3 transformed_normal=vec3(-normal.xy,normal.z);float NDotL=dot(normalize(transformed_normal),u_shadow_direction);float dotScale=min(1.0-NDotL,1.0)*0.5+0.5;return normal*dotScale;}float shadow_normal_offset_multiplier0() {return u_shadow_normal_offset[1];}float shadow_normal_offset_multiplier1() {return u_shadow_normal_offset[2];}
213\n#endif//RENDER_SHADOWS",iE="#ifdef RENDER_SHADOWS\n#ifdef DEPTH_TEXTURE\nuniform highp sampler2D u_shadowmap_0;uniform highp sampler2D u_shadowmap_1;\n#else\nuniform sampler2D u_shadowmap_0;uniform sampler2D u_shadowmap_1;\n#endif\nuniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;highp float shadow_sample_1(highp vec2 uv,highp float compare) {highp float shadow_depth;\n#ifdef DEPTH_TEXTURE\nshadow_depth=texture(u_shadowmap_1,uv).r;\n#else\nshadow_depth=unpack_depth(texture(u_shadowmap_1,uv))*0.5+0.5;\n#endif\nreturn step(shadow_depth,compare);}highp float shadow_sample_0(highp vec2 uv,highp float compare) {highp float shadow_depth;\n#ifdef DEPTH_TEXTURE\nshadow_depth=texture(u_shadowmap_0,uv).r;\n#else\nshadow_depth=unpack_depth(texture(u_shadowmap_0,uv))*0.5+0.5;\n#endif\nreturn step(shadow_depth,compare);}float shadow_occlusion_1(highp vec4 pos,highp float bias) {highp vec2 uv=pos.xy;return shadow_sample_1(uv,pos.z-bias);}float shadow_occlusion_0(highp vec4 pos,highp float bias) {highp float compare0=pos.z-bias;\n#ifdef TEXTURE_GATHER\nhighp vec2 uv=pos.xy;highp vec4 samples=textureGather(u_shadowmap_0,uv,0);lowp vec4 stepSamples=step(samples,vec4(compare0));\n#else\nhighp vec2 uv00=pos.xy-vec2(0.5*u_shadow_texel_size);highp vec2 uv10=uv00+vec2(u_shadow_texel_size,0.0);highp vec2 uv01=uv00+vec2(0.0,u_shadow_texel_size);highp vec2 uv11=uv01+vec2(u_shadow_texel_size,0.0);lowp vec4 stepSamples=vec4(\nshadow_sample_0(uv01,compare0),shadow_sample_0(uv11,compare0),shadow_sample_0(uv10,compare0),shadow_sample_0(uv00,compare0)\n);\n#endif\nvec2 f=fract(pos.xy*u_shadow_map_resolution-vec2(0.5));lowp vec2 lerpx=mix(stepSamples.wx,stepSamples.zy,f.xx);return mix(lerpx.x,lerpx.y,f.y);}float shadow_occlusion(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,highp float bias) {\n#ifdef SHADOWS_SINGLE_CASCADE\nlight_view_pos0.xyz=light_view_pos0.xyz/light_view_pos0.w*0.5+0.5;return shadow_occlusion_0(light_view_pos0,bias);\n#else\nlight_view_pos0.xyz/=light_view_pos0.w;light_view_pos1.xyz/=light_view_pos1.w;vec4 uv=vec4(light_view_pos0.xy,light_view_pos1.xy);vec4 abs_bounds=abs(uv);if (abs_bounds.x < 1.0 && abs_bounds.y < 1.0) {light_view_pos0.xyz=light_view_pos0.xyz*0.5+0.5;return shadow_occlusion_0(light_view_pos0,bias);}if (abs_bounds.z >=1.0 || abs_bounds.w >=1.0) {return 0.0;}light_view_pos1.xyz=light_view_pos1.xyz*0.5+0.5;float occlusion1=shadow_occlusion_1(light_view_pos1,bias);return mix(occlusion1,0.0,smoothstep(u_fade_range.x,u_fade_range.y,view_depth));\n#endif\n}highp float calculate_shadow_bias(float NDotL) {\n#ifdef NORMAL_OFFSET\nreturn 0.5*u_shadow_bias.x;\n#else\nreturn 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z));\n#endif\n}float shadowed_light_factor_normal(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_opacity(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,float shadow_opacity) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias)*shadow_opacity;return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_unbiased(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadow_occlusion(float ndotl,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=calculate_shadow_bias(ndotl);return shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);}\n#endif";let iA=[];ik(i_,iA),ik(iy,iA),ik(ig,iA);let iI={"_prelude_fog.vertex.glsl":ib,"_prelude_terrain.vertex.glsl":iv,"_prelude_shadow.vertex.glsl":iM,"_prelude_fog.fragment.glsl":iw,"_prelude_shadow.fragment.glsl":iE,"_prelude_lighting.glsl":"\n#ifdef LIGHTING_3D_MODE\nuniform mediump vec3 u_lighting_ambient_color;uniform mediump vec3 u_lighting_directional_dir;uniform mediump vec3 u_lighting_directional_color;uniform mediump vec3 u_ground_radiance;float calculate_ambient_directional_factor(vec3 normal) {float NdotL=dot(normal,u_lighting_directional_dir);const float factor_reduction_max=0.3;float dir_luminance=dot(u_lighting_directional_color,vec3(0.2126,0.7152,0.0722));float directional_factor_min=1.0-factor_reduction_max*min(dir_luminance,1.0);float ambient_directional_factor=mix(directional_factor_min,1.0,min((NdotL+1.0),1.0
213));const float vertical_factor_min=0.92;float vertical_factor=mix(vertical_factor_min,1.0,normal.z*0.5+0.5);return vertical_factor*ambient_directional_factor;}vec3 linearProduct(vec3 srgbIn,vec3 k) {return srgbIn*pow(k,vec3(1./2.2));}vec3 apply_lighting(vec3 color,vec3 normal,float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return linearProduct(color,ambient_contrib+directional_contrib);}vec4 apply_lighting(vec4 color,vec3 normal,float dir_factor) {return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting(vec3 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return apply_lighting(color.rgb,normal,dir_factor);}vec4 apply_lighting(vec4 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting_ground(vec3 color) {return color*u_ground_radiance;}vec4 apply_lighting_ground(vec4 color) {return vec4(apply_lighting_ground(color.rgb),color.a);}float calculate_NdotL(vec3 normal) {const float ext=0.70710678118;return (clamp(dot(normal,u_lighting_directional_dir),-ext,1.0)+ext)/(1.0+ext);}vec4 apply_lighting_with_emission_ground(vec4 color,float emissive_strength) {return mix(apply_lighting_ground(color),color,emissive_strength);}vec3 compute_flood_lighting(vec3 flood_light_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=flood_light_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);float occlusion_ramp=smoothstep(0.0,0.2,1.0-occlusion);return mix(fully_occluded_color,flood_light_color,occlusion_ramp);}vec3 compute_emissive_draped(vec3 unlit_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=unlit_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);return mix(fully_occluded_color,unlit_color,1.0-occlusion);}\n#endif//LIGHTING_3D_MODE","_prelude_raster_array.glsl":iT,"_prelude_raster_particle.glsl":iS},iC={};iR("",iv),iR(iw,ib),iR(iE,iM),iR(iT,""),iR(iS,"");let iP=iR(ig,iy);var iL={background:iR('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec4 u_color;uniform float u_opacity;\n#ifdef LIGHTING_3D_MODE\nin vec4 v_color;\n#endif\nvoid main() {vec4 out_color;\n#ifdef LIGHTING_3D_MODE\nout_color=v_color;\n#else\nout_color=u_color;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_lighting.glsl"\nin vec2 a_pos;uniform mat4 u_matrix;\n#ifdef LIGHTING_3D_MODE\nuniform mediump vec4 u_color;out vec4 v_color;uniform float u_emissive_strength;\n#endif\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef LIGHTING_3D_MODE\nv_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),backgroundPattern:iR('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform float u_emissive_strength;uniform sampler2D u_image;in highp vec2 v_pos;void main() {highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=textureLodCustom(u_image,pos,v_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec2 u_pattern_units_to_pixels;in vec2 a_pos;out highp vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_pattern_units_to_pixels,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),circle:iR('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin 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\nuniform float u_emissive_strength;void 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 blur_positive=blur < 0.0 ? 0.0 : 1.0;lowp float antialiasblur=v_data.z;float extrude_length=length(extrude)+antialiasblur*(1.0-blur_positive);float antialiased_blur=-max(abs(blur),antialiasblur);float opacity_t=smoothstep((1.0-blur_positive)*antialiased_blur,blur_positive*antialiased_blur,extrude_length-1.0)-smoothstep(0.0,antialiasblur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(\nantialiased_blur,0.0,extrude_length-radius
213/(radius+stroke_width)\n);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_apply_premultiplied(out_color,v_fog_pos);\n#endif\nglFragColor=out_color*(v_visibility*opacity_t);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define NUM_VISIBILITY_RINGS 2\n#define INV_SQRT2 0.70710678\n#define ELEVATION_BIAS 0.0001\n#define NUM_SAMPLES_PER_RING 16\nuniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nout 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\nvec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {\n#if defined(TERRAIN)\nreturn elevation(pos)+ELEVATION_BIAS;\n#else\nreturn 0.0;\n#endif\n}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);\n#ifdef PITCH_WITH_MAP\n#ifdef PROJECTION_GLOBE_VIEW\nreturn u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );\n#else\nreturn u_matrix*( world_center+vec4(sample_offset,0,0) );\n#endif\n#else\nreturn projected_center+vec4(sample_offset,0,0);\n#endif\n}float get_sample_step() {\n#ifdef PITCH_WITH_MAP\nreturn 2.0*PI/float(NUM_SAMPLES_PER_RING);\n#else\nreturn PI/float(NUM_SAMPLES_PER_RING);\n#endif\n}void main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);vec4 world_center;mat3 surface_vectors;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1);\n#else \nsurface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1);\n#endif\nvec4 projected_center=u_matrix*world_center;float view_scale=0.0;\n#ifdef PITCH_WITH_MAP\n#ifdef SCALE_WITH_MAP\nview_scale=1.0;\n#else\nview_scale=projected_center.w/u_camera_to_center_distance;\n#endif\n#else\n#ifdef SCALE_WITH_MAP\nview_scale=u_camera_to_center_distance;\n#else\nview_scale=projected_center.w;\n#endif\n#endif\ngl_Position=project_vertex(extrude,world_center,projected_center,radiu
213s,stroke_width,view_scale,surface_vectors);float visibility=0.0;\n#ifdef TERRAIN\nfloat step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;\n#ifdef PITCH_WITH_MAP\nfloat cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center;\n#else\nocclusion_world_center=world_center;occlusion_projected_center=projected_center;\n#endif\nfor(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);\n#else\nvisibility=1.0;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nvisibility=1.0;\n#endif\nv_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);\n#ifdef FOG\nv_fog_pos=fog_position(world_center.xyz);\n#endif\n}'),clippingMask:iR("void main() {glFragColor=vec4(1.0);}","in vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:iR('#include "_prelude_fog.fragment.glsl"\nuniform 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);glFragColor=vec4(val,1.0,1.0,1.0);\n#ifdef FOG\nif (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nout vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(a_pos*0.5);vec3 pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#else\npos=vec3(tilePos+extrude,elevation(tilePos));\n#endif\ngl_Position=u_matrix*vec4(pos,1);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),heatmapTexture:iR("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));glFragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(0.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}","in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:iR("in float v_placed;in float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);glFragColor =mix(red,blue,step(0.5,v_placed))*0.5;glFragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}",'#include "_prelude_terrain.vertex.glsl"\nin vec3 a_pos;in vec2 a_anchor_pos;in vec2 a_extrude;in vec2 a_placed;in vec2 a_shift;in vec2 a_elevation_from_sea;in float a_size_scale;in vec2 a_padding;in float a_auto_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;out float v_placed;out float v_notUsed;void main() {float feature_elevation=a_elevation_from_sea.x+a_auto_z_offset;float terrain_elevation=(a_elevation_from_sea.y==1.0 ? 0.0 : elevation(a_anchor_pos));vec4 projectedPoint=u_matrix*vec4(a_pos+elevationVector(a_anchor_pos)*(feature_elevation+terrain_elevation),1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}'),collisionCircle:iR("in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);glFragColor=color*alpha*opacity_t;}","in vec2 a_pos_2f;in float a_radius;in vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(\nmix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:iR("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);glFragColor=mix(u_color,overlay_color,overlay_color.a);}",'#include "_prelude_terrain.vertex.glsl"\nin vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;\n#endif\nout vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0;\n#ifdef PROJECTION_GLOBE_VIEW\ngl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1
213);\n#else\ngl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);\n#endif\n}'),fill:iR('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nuniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nvec4 out_color=color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nuniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp float z_offset\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillOutline:iR('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nin highp vec2 v_pos;uniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\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);vec4 out_color=outline_color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nuniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp float z_offset\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillOutlinePattern:iR('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\nin highp vec2 v_pos;in highp vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
213\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nout highp vec2 v_pos;out highp vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\n#pragma mapbox: initialize highp float z_offset\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillPattern:iR('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;in highp vec2 v_pos;uniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\nout highp vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\n#pragma mapbox: initialize highp float z_offset\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillExtrusion:iR('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin vec4 v_color;in vec4 v_flat;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;\n#endif\nuniform lowp float u_opacity;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;in vec2 v_ao;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nin vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nin highp vec3 v_normal;\n#endif\nuniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor;\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\nin float v_flood_radiu
213s;in float v_has_floodlight;\n#endif\nin float v_height;\n#pragma mapbox: define highp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp float emissive_strength\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nvec3 normal=normalize(v_normal);\n#endif\nfloat z;vec4 color=v_color;\n#ifdef ZERO_ROOF_RADIUS\nz=float(normal.z > 0.00001);\n#ifdef LIGHTING_3D_MODE\nnormal=mix(normal,vec3(0.0,0.0,1.0),z);\n#else\ncolor=mix(v_color,v_roof_color,z);\n#endif\n#endif\nfloat h=max(0.0,v_height);float ao_shade=1.0;\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h_floors=h/(u_ao[1]*u_vertical_scale);float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);ao_shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;\n#ifdef ZERO_ROOF_RADIUS\nconcave*=(1.0-z);\n#endif\nfloat x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);ao_shade*=mix(1.0,x_shade*x_shade*x_shade,concave);\n#ifdef LIGHTING_3D_MODE\n#ifdef FLOOD_LIGHT\ncolor.rgb*=mix(ao_shade,1.0,v_has_floodlight);\n#else\ncolor.rgb*=ao_shade;\n#endif\n#else\ncolor.rgb*=ao_shade;\n#endif\n#endif\n#ifdef LIGHTING_3D_MODE\nfloat flood_radiance=0.0;\n#ifdef FLOOD_LIGHT\nflood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight;\n#endif\n#ifdef RENDER_SHADOWS\n#ifdef FLOOD_LIGHT\nfloat ndotl_unclamped=dot(normal,u_shadow_direction);float ndotl=max(0.0,ndotl_unclamped);float occlusion=ndotl_unclamped < 0.0 ? 1.0 : shadow_occlusion(ndotl,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 litColor=apply_lighting(color.rgb,normal,(1.0-u_shadow_intensity*occlusion)*ndotl);vec3 floodLitColor=compute_flood_lighting(u_flood_light_color*u_opacity,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=mix(litColor,floodLitColor,flood_radiance);\n#else\nfloat shadowed_lighting_factor;\n#ifdef RENDER_CUTOFF\nshadowed_lighting_factor=shadowed_light_factor_normal_opacity(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;}\n#else\nshadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);\n#endif\ncolor.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor);\n#endif\n#else\ncolor.rgb=apply_lighting(color.rgb,normal);\n#ifdef FLOOD_LIGHT\ncolor.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance);\n#endif\n#endif\ncolor.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity;\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h));\n#endif\n#ifdef INDICATOR_CUTOUT\ncolor=applyCutout(color);\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_lighting.glsl"\nuniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;uniform float u_width_scale;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\n#ifdef RENDER_WALL_MODE\nin vec3 a_join_normal_inside;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nuniform highp float u_vertical_scale;out vec4 v_color;out vec4 v_flat;\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nout vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nout highp vec3 v_normal;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;out vec2 v_ao;\n#endif\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\nout float v_flood_radiu
213s;out float v_has_floodlight;\n#endif\nout float v_height;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define highp float flood_light_wall_radius\n#pragma mapbox: define highp float line_width\n#pragma mapbox: define highp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize highp float flood_light_wall_radius\n#pragma mapbox: initialize highp float line_width\n#pragma mapbox: initialize highp float emissive_strength\nbase*=u_vertical_scale;height*=u_vertical_scale;vec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nv_normal=normal;\n#endif\nbase=max(0.0,base);float attr_height=height;height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos;\n#ifdef TERRAIN\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h);\n#else\nh=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat cutoff=1.0;vec3 scaled_pos=pos;\n#ifdef RENDER_CUTOFF\nvec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_pos.x==0.0 ? pos.xyz : (centroid_random/8.0);vec4 ground=u_matrix*vec4(ground_pos.xy,ele,1.0);cutoff=cutoff_opacity(u_cutoff_params,ground.z);if (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 g=floor(ground_pos);vec3 mod_=centroid_random-g*8.0;float seed=min(1.0,0.1*(min(3.5,max(mod_.x+mod_.y,0.2*attr_height))*0.35+mod_.z));if (cutoff < 0.8-seed) {cutoff=0.0;}}float cutoff_scale=cutoff;v_cutoff_opacity=cutoff;scaled_pos.z=mix(c_ele,h,cutoff_scale);\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0) || (color.a==0.0));\n#ifdef RENDER_WALL_MODE\nvec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);scaled_pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;scaled_pos.xy-=a_join_normal_inside.z*wall_offset*0.5;\n#endif\ngl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h;\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=pos;vec3 shd_pos1=pos;\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);\n#endif\nfloat NdotL=0.0;float colorvalue=0.0;\n#ifndef LIGHTING_3D_MODE\ncolorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);if (normal.y !=0.0) {float r=0.84;r=mix(0.7,0.98,1.0-u_lightintensity);NdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}
213\n#endif\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\n#ifdef FLOOD_LIGHT\nfloat is_wall=1.0-float(t > 0.0 && top_up_ny.y > 0.0);v_has_floodlight=float(flood_light_wall_radius > 0.0 && is_wall > 0.0);v_flood_radius=flood_light_wall_radius*u_vertical_scale;\n#endif\nv_color=vec4(color.rgb,1.0);v_flat=vec4(linearProduct(color.rgb,vec3(calculate_NdotL(normal))),1.0);\n#else\nv_color=vec4(0.0,0.0,0.0,1.0);v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nfloat roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color=vec4(0.0,0.0,0.0,1.0);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_roof_color*=u_opacity;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),fillExtrusionDepth:iR("in highp float v_depth;void main() {\n#ifndef DEPTH_TEXTURE\nglFragColor=pack_depth(v_depth);\n#endif\n}",'#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_width_scale;uniform float u_vertical_scale;\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nin vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\n#ifdef RENDER_WALL_MODE\nin vec3 a_join_normal_inside;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp float line_width\n#pragma mapbox: define highp vec4 color\nout highp float v_depth;void main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp float line_width\n#pragma mapbox: initialize highp vec4 color\nbase*=u_vertical_scale;height*=u_vertical_scale;vec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nvec3 pos;\n#ifdef TERRAIN\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;float ele=elevation(pos_nx.xy);float c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);float h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h);\n#else\npos=vec3(pos_nx.xy,t > 0.0 ? height : base);\n#endif\n#ifdef RENDER_WALL_MODE\nvec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;pos.xy-=a_join_normal_inside.z*wall_offset*0.5;\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);v_depth=gl_Position.z/gl_Position.w;}'),fillExtrusionPattern:iR('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;in vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nin vec3 v_normal;\n#endif\nin highp vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define mediump vec4 pattern\n#pragma mapbox: define highp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize highp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color,normalize(v_normal))*u_opacity;\n#else\nout_color=out_color*v_lighting;\n#endif\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0
213),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_lighting.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_width_scale;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\n#ifdef RENDER_WALL_MODE\nin vec3 a_join_normal_inside;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nout highp vec2 v_pos;out vec4 v_lighting;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;out vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nout vec3 v_normal;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump vec4 pattern\n#pragma mapbox: define highp float pixel_ratio\n#pragma mapbox: define highp float line_width\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize highp float pixel_ratio\n#pragma mapbox: initialize highp float line_width\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=z;vec3 p;float c_ele;\n#ifdef TERRAIN\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;p=vec3(pos_nx.xy,h);\n#else\np=vec3(pos_nx.xy,z);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\n#ifdef RENDER_WALL_MODE\nvec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);p.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;p.xy-=a_join_normal_inside.z*wall_offset*0.5;\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0\n? pos_nx.xy\n: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0;\n#ifdef LIGHTING_3D_MODE\nNdotL=calculate_NdotL(normal);\n#else\nNdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);\n#endif\nif (normal.y !=0.0) {float r=0.84;\n#ifndef LIGHTING_3D_MODE\nr=mix(0.7,0.98,1.0-u_lightintensity);
213\n#endif\nNdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\nv_normal=normal;\n#else\nv_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\n#endif \n#ifdef FOG\nv_fog_pos=fog_position(p);\n#endif\n}'),groundShadow:iR('#include "_prelude_shadow.fragment.glsl"\nprecision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;\n#ifdef FOG\nin float v_fog_opacity;\n#endif\nvoid main() {float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 shadow=mix(u_ground_shadow_factor,vec3(1.0),light);\n#ifdef RENDER_CUTOFF\nshadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w));\n#endif\n#ifdef FOG\nshadow=mix(shadow,vec3(1.0),v_fog_opacity);\n#endif\n#ifdef INDICATOR_CUTOUT\nshadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0)).r);\n#endif\nglFragColor=vec4(shadow,1.0);}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;in vec2 a_pos;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;\n#ifdef FOG\nout float v_fog_opacity;\n#endif\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0.0,1.0);v_pos_light_view_0=u_light_matrix_0*vec4(a_pos,0.0,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(a_pos,0.0,1.0);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);v_fog_opacity=fog(v_fog_pos);\n#endif\n}'),fillExtrusionGroundEffect:iR("uniform highp float u_ao_pass;uniform highp float u_opacity;uniform highp float u_flood_light_intensity;uniform highp vec3 u_flood_light_color;uniform highp float u_attenuation;uniform sampler2D u_fb;uniform float u_fb_size;\n#ifdef SDF_SUBPASS\nin highp vec2 v_pos;in highp vec4 v_line_segment;in highp float v_flood_light_radius_tile;in highp vec2 v_ao;float line_df(highp vec2 a,highp vec2 b,highp vec2 p) {highp vec2 ba=b-a;highp vec2 pa=p-a;highp float r=clamp(dot(pa,ba)/dot(ba,ba),0.0,1.0);return length(pa-r*ba);}\n#ifdef FOG\nin highp float v_fog;\n#endif\n#endif\nvoid main() {\n#ifdef CLEAR_SUBPASS\nvec4 color=vec4(1.0);\n#ifdef CLEAR_FROM_TEXTURE\ncolor=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size));\n#endif\nglFragColor=color;\n#else\n#ifdef SDF_SUBPASS\nhighp float d=line_df(v_line_segment.xy,v_line_segment.zw,v_pos);highp float effect_radius=mix(v_flood_light_radius_tile,v_ao.y,u_ao_pass);d/=effect_radius;d=min(d,1.0);d=1.0-pow(1.0-d,u_attenuation);highp float effect_intensity=mix(u_flood_light_intensity,v_ao.x,u_ao_pass);highp float fog=1.0;\n#ifdef FOG\nfog=v_fog;\n#endif\n#ifdef RENDER_CUTOFF\nfog*=v_cutoff_opacity;\n#endif\nglFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog));\n#else\nvec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass);\n#ifdef OVERDRAW_INSPECTOR\ncolor=vec4(1.0);\n#endif\nglFragColor=color;\n#endif\nHANDLE_WIREFRAME_DEBUG;\n#endif\n}",'#include "_prelude_fog.vertex.glsl"\nin highp vec4 a_pos_end;in highp float a_angular_offset_factor;in highp float a_hidden_by_landmark;\n#ifdef SDF_SUBPASS\nout highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao;\n#ifdef FOG\nout highp float v_fog;\n#endif\n#endif\nuniform highp float u_flood_light_intensity;uniform highp mat4 u_matrix;uniform highp float u_ao_pass;uniform highp float u_meter_to_tile;uniform highp float u_edge_radius;uniform highp float u_dynamic_offset;uniform highp vec2 u_ao;
213\n#pragma mapbox: define highp float flood_light_ground_radius\nconst float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() {\n#pragma mapbox: initialize highp float flood_light_ground_radius\nvec2 p=a_pos_end.xy;vec2 q=floor(a_pos_end.zw*0.5);vec2 start_bottom=a_pos_end.zw-q*2.0;float fl_ground_radius=flood_light_ground_radius;fl_ground_radius=abs(flood_light_ground_radius);float direction=flood_light_ground_radius < 0.0 ?-1.0 : 1.0;float flood_radius_tile=fl_ground_radius*u_meter_to_tile;vec2 v=normalize(q-p);float ao_radius=u_ao.y/3.5;float effect_radius=mix(flood_radius_tile,ao_radius,u_ao_pass)+u_edge_radius;float angular_offset_factor=a_angular_offset_factor/NORM*TANGENT_CUTOFF;float angular_offset=direction*angular_offset_factor*effect_radius;float top=1.0-start_bottom.y;float side=(0.5-start_bottom.x)*2.0;vec2 extrusion_parallel=v*side*mix(u_dynamic_offset,angular_offset,top);vec2 perp=vec2(v.y,-v.x);vec2 extrusion_perp=direction*perp*effect_radius*top;vec3 pos=vec3(mix(q,p,start_bottom.x),0.0);pos.xy+=extrusion_parallel+extrusion_perp;\n#ifdef SDF_SUBPASS\nv_pos=pos.xy;v_line_segment=vec4(p,q)+perp.xyxy*u_edge_radius;v_flood_light_radius_tile=flood_radius_tile;v_ao=vec2(u_ao.x,ao_radius);\n#ifdef FOG\nv_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos);\n#endif\n#endif\nfloat hidden_by_landmark=0.0;\n#ifdef HAS_CENTROID\nhidden_by_landmark=a_hidden_by_landmark;\n#endif\nfloat isFloodlit=float(fl_ground_radius > 0.0 && u_flood_light_intensity > 0.0);float hidden=mix(1.0-isFloodlit,isFloodlit,u_ao_pass);hidden+=hidden_by_landmark;gl_Position=mix(u_matrix*vec4(pos,1.0),AWAY,float(hidden > 0.0));\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n}'),hillshadePrepare:iR("precision highp float;uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;float getElevation(vec2 coord) {return texture(u_image,coord).r/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2(\n(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)\n)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4(\nderiv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);}","uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:iR('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;uniform float u_emissive_strength;void main() {vec4 pixel=texture(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);glFragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef LIGHTING_3D_MODE\nglFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength);\n#endif\n#ifdef FOG\nglFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos));\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
213\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),line:iR('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform lowp float u_device_pixel_ratio;uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec4 v_uv;\n#ifdef RENDER_LINE_DASH\nuniform sampler2D u_dash_image;in vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform sampler2D u_gradient_image;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\nfloat luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}uniform float u_emissive_strength;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float border_width\n#pragma mapbox: define lowp vec4 border_color\nfloat linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float border_width\n#pragma mapbox: initialize lowp vec4 border_color\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);\n#ifdef RENDER_LINE_DASH\nfloat sdfdist=texture(u_dash_image,v_tex).r;
213float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;alpha*=linearstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);\n#endif\nhighp vec4 out_color;\n#ifdef RENDER_LINE_GRADIENT\nout_color=texture(u_gradient_image,v_uv.xy);\n#else\nout_color=color;\n#endif\nfloat trim_alpha=1.0;\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);out_color=mix(out_color,u_trim_color,transition_factor);trim_alpha=out_color.a;}\n#endif\nif (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}}\n#ifdef RENDER_LINE_BORDER\nfloat edgeBlur=(border_width+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);if (border_color.a==0.0) {float Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}} else {out_color.rgb=mix(border_color.rgb*border_color.a*trim_alpha,out_color.rgb,smoothAlpha);}}\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nout_color*=(alpha*opacity);\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define EXTRUDE_SCALE 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\nin float a_z_offset;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nin highp vec4 a_packed;\n#endif\n#ifdef RENDER_LINE_DASH\nin float a_linesofar;\n#endif\nuniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;\n#ifdef ELEVATED\nuniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {\n#ifdef ELEVATION_REFERENCE_SEA\nreturn 0.0;\n#else\nreturn elevation(apos);\n#endif\n}\n#endif\nout vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec4 v_uv;\n#ifdef RENDER_LINE_DASH\nuniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform float u_image_height;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float border_width\n#pragma mapbox: define lowp vec4 border_color\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float border_width\n#pragma mapbox: initialize lowp vec4 border_color\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;
213vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;\n#ifdef ELEVATED_ROADS\ngl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset+0.01*step(0.01,a_z_offset),1.0)+projected_extrude;\n#else\n#ifdef ELEVATED\nvec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;\n#ifdef CROSS_SLOPE_VERTICAL\nfloat top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);\n#else\n#ifdef CROSS_SLOPE_HORIZONTAL\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset;\n#else\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset;\n#endif\n#endif\ngl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);\n#else\ngl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);\n#endif\n#endif\n#ifdef ELEVATED_ROADS\n#ifdef RENDER_SHADOWS\nvec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;\n#ifdef NORMAL_OFFSET\nvec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#endif\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude_xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur));\n#else\nv_gamma_scale=1.0;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nfloat a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3];\n#ifdef RENDER_LINE_GRADIENT\nhighp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec4(a_uv_x,a_split_index*texel_height-half_texel_height,a_clip_start,a_clip_end);\n#else\nv_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end);\n#endif\n#endif\n#ifdef RENDER_LINE_DASH\nfloat scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/floorwidth,(-normal.y*height+dash.x+0.5)/u_texsize.y);\n#endif\nv_width2=vec2(outset,inset);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),linePattern:iR('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform highp float u_device_pixel_ratio;uniform highp float u_alpha_discard_threshold;uniform highp vec2 u_texsize;uniform highp float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width;\n#ifdef RENDER_LINE_TRIM_OFFSET\nin highp vec4 v_uv;\n#endif\n#ifdef LINE_JOIN_NONE\nin vec2 v_pattern_data;\n#endif\n#ifdef RENDER_SHADOWS\nuniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\n#endif\nuniform float u_emissive_strength;\n#pragma mapbox: define mediump vec4 pattern\n#pragma mapbox: define mediump float pixel_ratio\n#pragma mapbox: define mediump float blur\n#pragma mapbox: define mediump float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize mediump float pixel_ratio\n#pragma mapbox: initialize mediump float blur\n#pragma mapbox: initialize mediump float opacity\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;float pattern_size=display_size.x/u_tile_units_to_pixels;float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);highp float pattern_x=v_linesofar/pattern_size*aspect;highp float x=mod(pattern_x,1.0);highp float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;highp vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));highp vec2 lod_pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(pattern_x,y));vec4 color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end > trim_start) {if (line_progress <=trim_end && line_progress >=trim_start) {color=vec4(0,0,0,0);}}\n#endif\n#ifdef LINE_JOIN_NONE\nfloat pattern_len=pattern_size/aspect;float segment_phase=pattern_len-mod(v_linesofar-v_pattern_data.x+pattern_len,pattern_len);float visible_start=segment_phase-step(pattern_len*0.5,segment_phase)*pattern_len;float visible_end=floor((v_pattern_data.y-segment_phase)/pattern_len)*pattern_len+segment_phase;visible_end+=step(pattern_len*0.5,v_pattern_data.y-visible_end)*pattern_len;if (v_pattern_data.x < visible_start || v_pattern_data.x >=visible_end) {color=vec4(0.0);}\n#endif\n#ifdef LIGHTING_3D_MODE\ncolor=apply_lighting_with_emission_ground(color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ncolor*=(alpha*opacity);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}}\n#ifdef INDICATOR_CUTOUT\ncolor=applyCutout(color);\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
213\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\nin float a_z_offset;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nin highp vec4 a_packed;\n#endif\nin highp float a_linesofar;\n#ifdef LINE_JOIN_NONE\nin highp vec3 a_pattern_data;out vec2 v_pattern_data;\n#endif\nuniform mat4 u_matrix;uniform float u_tile_units_to_pixels;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform float u_device_pixel_ratio;\n#ifdef ELEVATED\nuniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {\n#ifdef ELEVATION_REFERENCE_SEA\nreturn 0.0;\n#else\nreturn elevation(apos);\n#endif\n}\n#endif\nout vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width;\n#ifdef RENDER_LINE_TRIM_OFFSET\nout highp vec4 v_uv;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;\n#endif\n#pragma mapbox: define mediump float blur\n#pragma mapbox: define mediump float opacity\n#pragma mapbox: define mediump float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define mediump float floorwidth\n#pragma mapbox: define mediump vec4 pattern\n#pragma mapbox: define mediump float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize mediump float blur\n#pragma mapbox: initialize mediump float opacity\n#pragma mapbox: initialize mediump float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize mediump float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize mediump float pixel_ratio\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);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);vec2 dist=outset*a_extrude*scale;float u=0.5*a_direction;float t=1.0-abs(u);vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;\n#ifdef ELEVATED_ROADS\ngl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset+0.01*step(0.01,a_z_offset),1.0)+projected_extrude;\n#else\n#ifdef ELEVATED\nvec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;\n#ifdef CROSS_SLOPE_VERTICAL\nfloat top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);\n#else\n#ifdef CROSS_SLOPE_HORIZONTAL\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset;\n#else\nfloat ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset;\n#endif\n#endif\ngl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);\n#else\ngl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);\n#endif\n#endif\n#ifdef ELEVATED_ROADS\n#ifdef RENDER_SHADOWS\nvec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;\n#ifdef NORMAL_OFFSET\nvec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;\n#endif\n#endif\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude_xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur));\n#else\nv_gamma_scale=1.0;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nfloat a_uv_x=a_packed[0];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3];v_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end);\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;\n#ifdef LINE_JOIN_NONE\nv_width=floorwidth+ANTIALIASING;mediump float pixels_to_tile_units=1.0/u_tile_units_to_pixels;mediump float pixel_ratio_inverse=1.0/pixel_ratio;mediump float aspect=v_width/((pattern.w-pattern.y)*pixel_ratio_inverse);highp float subt_multiple=(pattern.z-pattern.x)*pixel_ratio_inverse*pixels_to_tile_units*aspect*32.0;highp float subt=floor(a_pattern_data.z/subt_multiple)*subt_multiple;float offset_sign=(fract(a_pattern_data.x)-0.5)*4.0;float line_progress_offset=offset_sign*v_width*0.5*pixels_to_tile_units;v_linesofar=(a_pattern_data.z-subt)+a_linesofar+line_progress_offset;v_pattern_data=vec2(a_pattern_data.x+line_progress_offset,a_pattern_data.y);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),raster:iR('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_raster_array.glsl"\nuniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;uniform highp float u_zoom_transition;in vec2 v_pos0;in vec2 v_pos1;in float v_depth;\n#ifdef PROJECTION_GLOBE_VIEW\nin float v_split_fade;\n#endif\nuniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;uniform float u_emissive_strength;\n#ifndef RASTER_ARRAY\nuniform highp sampler2D u_image0;uniform sampler2D u_image1;\n#endif\n#ifdef RASTER_COLOR\nuniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res;\n#endif\nvoid main() {vec4 color0,color1,color;vec2 value;\n#ifdef RASTER_COLOR\n#ifdef RASTER_ARRAY\n#ifdef RASTER_ARRAY_LINEAR\nvalue=mix(\nraTexture2D_image0_linear(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_linear(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t\n);\n#else\nvalue=mix(\nraTexture2D_image0_nearest(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_nearest(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t\n);\n#endif\nif (value.y > 0.0) value.x/=value.y;\n#else\ncolor=mix(texture(u_image0,v_pos0),texture(u_image1,v_pos1),u_fade_t);value=vec2(u_colorization_offset+dot(color.rgb,u_colorization_mix.rgb),color.a);\n#endif\ncolor=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y;\n#else\ncolor0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);\n#endif\ncolor.a*=u_opacity;\n#ifdef GLOBE_POLES\ncolor.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition);\n#endif\nvec3 rgb=color.rgb;rgb=vec3(\ndot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);vec3 out_color=mix(u_high_vec,u_low_vec,rgb);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb;\n#endif\n#ifdef FOG\nhighp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));\n#endif\nglFragColor=vec4(out_color*color.a,color.a);\n#ifdef PROJECTION_GLOBE_VIEW\nglFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade));\n#endif\n#ifdef RENDER_CUTOFF\nglFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
213\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;uniform vec2 u_texture_offset;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;\n#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8\n#ifdef GLOBE_POLES\nin vec3 a_globe_pos;in vec2 a_uv;\n#else\nin vec2 a_pos;in vec2 a_texture_pos;\n#endif\nout vec2 v_pos0;out vec2 v_pos1;out float v_depth;\n#ifdef PROJECTION_GLOBE_VIEW\nout float v_split_fade;\n#endif\nvoid main() {vec2 uv;\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos ,1.0);uv=a_uv;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz);\n#endif\n#else\nfloat w=1.0+dot(a_texture_pos,u_perspective_transform);uv=a_texture_pos/8192.0;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]); \nv_split_fade=0.0;if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;float opposite_merc_center=mod(u_merc_center.x+0.5,1.0);float dist_from_poles=(abs(mercatorY-0.5)*2.0);float range=0.1;v_split_fade=abs(opposite_merc_center-mercatorX);v_split_fade=clamp(1.0-v_split_fade,0.0,1.0);v_split_fade=max(smoothstep(1.0-range,1.0,dist_from_poles),max(smoothstep(1.0-range,1.0,v_split_fade),smoothstep(1.0-range,1.0,1.0-v_split_fade)));}float tiles=u_grid_matrix[0][2];
213if (tiles > 0.0) {float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvY=mercatorY*tiles-idy;float uvX=mercatorX*tiles-idx;uv=vec2(uvX,uvY);}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n#else\ngl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n#endif\n#endif\nv_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;v_pos0=u_texture_offset.x+u_texture_offset.y*v_pos0;v_pos1=u_texture_offset.x+u_texture_offset.y*v_pos1;\n#ifdef RENDER_CUTOFF\nv_depth=gl_Position.z;\n#endif\n}'),rasterParticle:iR('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;in vec2 v_pos0;in vec2 v_pos1;uniform sampler2D u_image0;uniform sampler2D u_image1;void main() {vec4 color0,color1,color;color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 out_color=color.rgb;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),0.0).rgb;\n#endif\n#ifdef FOG\nhighp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));\n#endif\nglFragColor=vec4(out_color*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;\n#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8\nin vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvX=mercatorX*tiles-idx;float uvY=mercatorY*tiles-idy;uv=vec2(uvX,uvY);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n#else\nuv=a_texture_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n#endif\nv_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}'),rasterParticleDraw:iR("uniform sampler2D u_color_ramp;in float v_particle_speed;void main() {glFragColor=texture(u_color_ramp,vec2(v_particle_speed,0.5));}",'#include "_prelude_raster_particle.glsl"\nin float a_index;uniform sampler2D u_particle_texture;uniform float u_particle_texture_side_len;uniform vec2 u_tile_offset;out float v_particle_speed;void main() {ivec2 pixel_coord=ivec2(\nmod(a_index,u_particle_texture_side_len),a_index/u_particle_texture_side_len);vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);vec2 pos=unpack_pos_from_rgba(pixel)+u_tile_offset;vec2 tex_coord=fract(pos);vec2 velocity=lookup_velocity(tex_coord);if (velocity==INVALID_VELOCITY) {gl_Position=AWAY;v_particle_speed=0.0;} else {gl_Position=vec4(2.0*pos-1.0,0,1);v_particle_speed=length(velocity);}gl_PointSize=1.0;}'),rasterParticleTexture:iR("uniform sampler2D u_texture;uniform float u_opacity;in vec2 v_tex_pos;void main() {vec4 color=texture(u_texture,v_tex_pos);glFragColor=vec4(floor(255.0*color*u_opacity)/255.0);}","in vec2 a_pos;out vec2 v_tex_pos;void main() {vec2 uv=0.5*a_pos+vec2(0.5);v_tex_pos=uv;gl_Position=vec4(a_pos,0.0,1.0);}"),rasterParticleUpdate:iR('#include "_prelude_raster_particle.glsl"\nuniform sampler2D u_particle_texture;uniform mediump float u_particle_texture_side_len;uniform mediump float u_speed_factor;uniform highp float u_reset_rate;uniform highp float u_rand_seed;in highp vec2 v_tex_coord;
213vec2 linearstep(vec2 edge0,vec2 edge1,vec2 x) {return clamp((x-edge0)/(edge1-edge0),vec2(0),vec2(1));}const highp vec3 rand_constants=vec3(12.9898,78.233,4375.85453);highp float rand(const highp vec2 co) {highp float t=dot(rand_constants.xy,co);return fract(sin(t)*(rand_constants.z+t));}void main() {ivec2 pixel_coord=ivec2(v_tex_coord*u_particle_texture_side_len);highp vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);highp vec2 pos=unpack_pos_from_rgba(pixel);highp vec2 velocity=lookup_velocity(clamp(pos,0.0,1.0));highp vec2 dp=velocity==INVALID_VELOCITY ? vec2(0) : velocity*u_speed_factor;pos=pos+dp;highp vec2 seed=(pos+v_tex_coord)*u_rand_seed;highp vec2 random_pos=vec2(rand(seed+1.3),rand(seed+2.1));highp vec2 persist_rate=pow(\nlinearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4)\n);highp vec2 per_frame_persist=pow(persist_rate,abs(dp)/u_particle_pos_offset);highp float drop_rate=1.0-per_frame_persist.x*per_frame_persist.y;drop_rate=any(greaterThanEqual(abs(pos-0.5),vec2(0.5+u_particle_pos_offset))) ? 1.0 : drop_rate;highp float drop=step(1.0-drop_rate-u_reset_rate,rand(seed));highp vec2 next_pos=mix(pos,random_pos,drop);glFragColor=pack_pos_to_rgba(next_pos);}',"in vec2 a_pos;out vec2 v_tex_coord;void main() {v_tex_coord=0.5*(a_pos+vec2(1.0));gl_Position=vec4(a_pos,0.0,1.0);}"),symbol:iR('#include "_prelude_lighting.glsl"\n#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_halo;uniform lowp float u_scale_factor;\n#ifdef ICON_TRANSITION\nuniform float u_icon_transition;\n#endif\n#ifdef COLOR_ADJUSTMENT\nuniform mat4 u_color_adj_mat;\n#endif\nin vec2 v_tex_a;\n#ifdef ICON_TRANSITION\nin vec2 v_tex_b;\n#endif\nin float v_draw_halo;in vec3 v_gamma_scale_size_fade_opacity;\n#ifdef RENDER_TEXT_AND_SYMBOL\nin float is_sdf;in vec2 v_tex_a_icon;\n#endif\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\n#pragma mapbox: define lowp float emissive_strength\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\n#pragma mapbox: initialize lowp float emissive_strength\nvec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2];\n#ifdef RENDER_TEXT_AND_SYMBOL\nif (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity;glFragColor=texture(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nreturn;}\n#endif\n#ifdef RENDER_SDF\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_gamma_scale_size_fade_opacity.x;float size=v_gamma_scale_size_fade_opacity.y;float fontScale=u_is_text ? size/24.0 : size;out_color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {out_color=halo_color;gamma=(halo_blur*u_scale_factor*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width*u_scale_factor/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,v_tex_a).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);out_color*=alpha;\n#else\n#ifdef ICON_TRANSITION\nvec4 a=texture(u_texture,v_tex_a)*(1.0-u_icon_transition);vec4 b=texture(u_texture,v_tex_b)*u_icon_transition;out_color=(a+b);\n#else\nout_color=texture(u_texture,v_tex_a);\n#endif\n#ifdef COLOR_ADJUSTMENT\nout_color=u_color_adj_mat*out_color;\n#endif\n#endif\nout_color*=opacity*fade_opacity;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,emissive_strength);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
213\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_terrain.vertex.glsl"\nin vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity;\n#ifdef Z_OFFSET\nin float a_auto_z_offset;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_globe_anchor;in vec3 a_globe_normal;\n#endif\n#ifdef ICON_TRANSITION\nin vec2 a_texb;\n#endif\n#ifdef OCCLUSION_QUERIES\nin float a_occlusion_query_opacity;\n#endif\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_elevation_from_sea;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform vec2 u_texsize_icon;uniform bool u_is_halo;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nout vec2 v_tex_a;\n#ifdef ICON_TRANSITION\nout vec2 v_tex_b;\n#endif\nout float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity;\n#ifdef RENDER_TEXT_AND_SYMBOL\nout float is_sdf;out vec2 v_tex_a_icon;\n#endif\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\n#pragma mapbox: define lowp float emissive_strength\n#pragma mapbox: define lowp float occlusion_opacity\n#pragma mapbox: define lowp float z_offset\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\n#pragma mapbox: initialize lowp float emissive_strength\n#pragma mapbox: initialize lowp float occlusion_opacity\n#pragma mapbox: initialize lowp float z_offset\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=u_elevation_from_sea ? z_offset : z_offset+elevation(tile_anchor);\n#ifdef Z_OFFSET\ne+=a_auto_z_offset;\n#endif\nvec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos_globe=a_globe_anchor+h;world_pos=mix_globe_mercator(world_pos_globe,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;vec2 a;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);vec4 projected_point_globe=u_matrix*vec4(world_pos_globe,1);a=projected_point_globe.xy/projected_point_globe.w;\n#else\noffsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w;\n#endif\nvec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\n#ifdef Z_OFFSET\nz+=u_pitch_with_map ? a_auto_z_offset+(u_elevation_from_sea ? z_offset : z_offset) : 0.0;\n#else\nz+=u_pitch_with_map ? (u_elevation_from_sea ? z_offset : z_offset) : 0.0;\n#endif\nfloat occlusion_fade=globe_occlusion_fade;float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nvec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));float out_fade_opacity=interpolated_fade_opacity*projection_transition_fade;\n#ifdef DEPTH_OCCLUSION\nfloat depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier;\n#endif\n#ifdef OCCLUSION_QUERIES\nfloat occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier;\n#endif\nfloat alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,hidden);\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,hidden);\n#endif\nfloat gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_gamma_scale_size_fade_opacity=vec3(gamma_scale,size,out_fade_opacity);v_tex_a=a_tex/u_texsize;\n#ifdef RENDER_TEXT_AND_SYMBOL\nis_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon;\n#endif\n#ifdef ICON_TRANSITION\nv_tex_b=a_texb/u_texsize;\n#endif\n}'),terrainRaster:iR('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image0;in vec2 v_pos0;\n#ifdef FOG\nin float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nin vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;\n#endif\nuniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color;\n#ifdef LIGHTING_3D_MODE\nconst vec3 normal=vec3(0.0,0.0,1.0);\n#ifdef RENDER_SHADOWS\nfloat cutoffOpacity=1.0;\n#ifdef RENDER_CUTOFF\ncutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w);\n#endif\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nvec3 unlit_base=image_color.rgb*(1.0-image_color.a);vec3 emissive_base=image_color.rgb*image_color.a;float ndotl=u_shadow_direction.z;float occlusion=ndotl < 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,0.0);ndotl=max(0.0,ndotl);vec3 lit=apply_lighting(unlit_base,normal,mix(1.0,(1.0-(u_shadow_intensity*occlusion))*ndotl,cutoffOpacity));vec3 emissive=compute_emissive_draped(emissive_base,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=lit+emissive;color.a=1.0;\n#else\nfloat lighting_factor=shadowed_light_factor_normal_unbiased(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);color=apply_lighting(image_color,normal,mix(1.0,lighting_factor,cutoffOpacity));\n#endif\n#else\nfloat lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor);\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\ncolor.rgb=mix(color.rgb,image_color.rgb,image_color.a);color.a=1.0;\n#endif\n#endif\n#else\ncolor=image_color;\n#endif\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#else\ncolor=fog_dither(fog_apply_from_vert(color,v_fog_opacity));\n#endif\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
213\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_skirt_height;in vec2 a_pos;out vec2 v_pos0;\n#ifdef FOG\nout float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;out float v_depth;\n#endif\nvoid main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;v_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\nv_fog_pos=fog_position(decodedPos);\n#else\nv_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.);\n#endif\n}'),terrainDepth:iR("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",'#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;in vec2 a_pos;out float v_depth;void main() {float elevation=elevation(a_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}'),skybox:iR('#include "_prelude_fog.fragment.glsl"\nin lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(\ncos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(e
213nd-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=texture(u_cubemap,uv).rgb;\n#ifdef FOG\nsky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);\n#endif\nsky_color.rgb=dither(sky_color.rgb,gl_FragCoord.xy+u_temporal_offset);sky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}',ix),skyboxGradient:iR('#include "_prelude_fog.fragment.glsl"\nin highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture(u_color_ramp,vec2(progress,0.5));\n#ifdef FOG\ncolor.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;\n#endif\ncolor*=u_opacity;color.rgb=dither(color.rgb,gl_FragCoord.xy+u_temporal_offset);glFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}',ix),skyboxCapture:iR
vendor: 3,689 bytes, line 213
213("\nin highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;precision highp float;\n#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6)\n#define BETA_M vec3(21e-6,21e-6,21e-6)\n#define MIE_G 0.76\n#define DENSITY_HEIGHT_SCALE_R 8000.0\n#define DENSITY_HEIGHT_SCALE_M 1200.0\n#define PLANET_RADIUS 6360e3\n#define ATMOSPHERE_RADIUS 6420e3\n#define SAMPLE_STEPS 10\n#define DENSITY_STEPS 4\nfloat ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;glFragColor=vec4(color,1.0);}","in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;
213v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globeRaster:iR('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image0;uniform float u_far_z_cutoff;in vec2 v_pos0;\n#ifndef FOG\nuniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport;\n#endif\nvoid main() {vec4 color;\n#ifdef CUSTOM_ANTIALIASING\nvec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);vec3 dir=normalize(ray_dir);vec3 closest_point=dot(u_globe_pos,dir)*dir;float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture(u_image0,v_pos0);\n#ifdef LIGHTING_3D_MODE\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nraster=apply_lighting_with_emission_ground(raster,raster.a);color=vec4(raster.rgb*antialias,antialias);\n#else\nraster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias);\n#endif\n#else\ncolor=vec4(raster.rgb*antialias,raster.a*antialias);\n#endif\n#else\ncolor=texture(u_image0,v_pos0);\n#ifdef LIGHTING_3D_MODE\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\ncolor=apply_lighting_with_emission_ground(color,color.a);color.a=1.0;\n#else\ncolor=apply_lighting_ground(color);\n#endif\n#endif\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ncolor*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height;\n#ifdef GLOBE_POLES\nin vec3 a_globe_pos;in vec2 a_uv;\n#else\nin vec2 a_pos;\n#endif\nout vec2 v_pos0;void main() {\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;vec2 uv=a_uv;\n#else\nfloat tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY);\n#endif\nv_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale;\n#ifdef GLOBE_POLES\nvec3 up_vector=globe_derived_up_vector;\n#else\nvec3 up_vector=elevationVector(tile_pos);\n#endif\nfloat height=elevation(tile_pos);globe_pos+=up_vector*height;\n#ifndef GLOBE_POLES\nglobe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z;\n#endif\n#ifdef GLOBE_POLES\nvec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);\n#else\nvec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);\n#endif\ngl_Position=u_proj_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n}'),globeAtmosphere:iR('#include "_prelude_fog.fragment.glsl"\nuniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir;\n#ifdef PROJECTION_GLOBE_VIEW\nglobe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {\n#ifdef ALPHA_PASS\nglFragColor=vec4(0,0,0,0);return;\n#else\n#ifdef NATIVE\nglFragColor=vec4(1,1,1,1);\n#else\nglFragColor=vec4(0,0,0,1);\n#endif\nreturn;\n#endif\n}\n#endif\nhighp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?\n0.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle;\n#ifdef PROJECTION_GLOBE_VIEW\nhighp vec3 closest_point=globe_pos_dot_dir*dir;highp float closest_point_to_center=length(closest_point-u_globe_pos);highp float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ?\nPI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t);\n#else\nhorizon_angle=horizon_angle_mercator;\n#endif\nhorizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_color.rgb;vec3 color_stop_1=u_high_color.rgb;
213vec3 color_stop_2=u_space_color.rgb;\n#ifdef ALPHA_PASS\nfloat a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);glFragColor=vec4(1.0,1.0,1.0,a);\n#else\nvec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c=c2;\n#ifndef NATIVE\nc=dither(c,gl_FragCoord.xy+u_temporal_offset);\n#endif\nglFragColor=vec4(c*t,t);\n#endif\n}',"in vec3 a_pos;in vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;out highp vec3 v_ray_dir;out highp vec3 v_horizon_dir;void main() {v_ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix(\nmix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}"),model:iR('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform float u_opacity;uniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;uniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows;\n#endif\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\nuniform vec4 u_occlusionTextureTransform;\n#endif\n#pragma mapbox: define-attribute highp vec3 normal_3f\n#pragma mapbox: define-attribute highp vec3 color_3f\n#pragma mapbox: define-attribute highp vec4 color_4f\n#pragma mapbox: define-attribute highp vec2 uv_2f\n#pragma mapbox: initialize-attribute highp vec3 normal_3f\n#pragma mapbox: initialize-attribute highp vec3 color_3f\n#pragma mapbox: initialize-attribute highp vec4 color_4f\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\n#ifdef HAS_ATTRIBUTE_a_pbr\nin lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params;\n#endif\n#ifdef HAS_TEXTURE_u_baseColorTexture\nuniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff;\n#endif\n#ifdef HAS_TEXTURE_u_metallicRoughnessTexture\nuniform sampler2D u_metallicRoughnessTexture;\n#endif\n#ifdef HAS_TEXTURE_u_occlusionTexture\nuniform sampler2D u_occlusionTexture;uniform float u_aoIntensity;\n#endif\n#ifdef HAS_TEXTURE_u_normalTexture\nuniform sampler2D u_normalTexture;\n#endif\n#ifdef HAS_TEXTURE_u_emissionTexture\nuniform sampler2D u_emissionTexture;\n#endif\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nin highp float v_depth;uniform highp sampler2D u_depthTexture;uniform highp vec2 u_inv_depth_size;uniform highp vec2 u_depth_range_unpack;\n#ifdef DEPTH_D24\nhighp float unpack_depth(highp float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}\n#else\nhighp float unpack_depth_rgba(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}\n#endif\nbool isOccluded() {highp vec2 coord=gl_FragCoord.xy*u_inv_depth_size;\n#ifdef DEPTH_D24\nhighp float depth=unpack_depth(texture(u_depthTexture,coord).r);\n#else\nhighp float depth=unpack_depth_rgba(texture(u_depthTexture,coord));\n#endif\nreturn v_depth > depth+0.0005;}\n#endif\n#define saturate(_x) clamp(_x,0.,1.)\nvec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}float calculate_NdotL(vec3 normal,vec3 lightDir) {const float ext=0.70710678118;return (clamp(dot(normal,lightDir),-ext,1.0)+ext)/(1.0+ext);}vec3 getDiffuseShadedColor(vec3 albedo,vec3 normal,vec3 lightDir,vec3 lightColor)\n{\n#ifdef LIGHTING_3D_MODE\nvec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor;\n#ifdef RENDER_SHADOWS\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\n#else\nlighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir));\n#endif\nreturn apply_lighting(albedo,transformed_normal,lighting_factor);\n#else\nvec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-light
213Color),vec3(1.0));return c3;\n#endif\n}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor;\n#ifdef HAS_ATTRIBUTE_a_color_3f\nalbedo*=vec4(color_3f,1.0);\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\n#else\n#ifdef HAS_ATTRIBUTE_a_color_4f\nalbedo*=color_4f;\n#endif\n#endif\n#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f)\nvec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}}\n#ifdef UNPREMULT_TEXTURE_IN_SHADER\nif(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=1.0;\n#endif\nif(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;}\n#endif\nvec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a);\n#ifdef APPLY_LUT_ON_GPU\ncolor=applyLUT(u_lutTexture,color);\n#endif\nreturn color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) {\n#ifdef HAS_TEXTURE_u_normalTexture\nhighp vec3 dp1=vec3(dFdx(p.x),dFdx(p.y),dFdx(p.z));highp vec3 dp2=vec3(dFdy(p.x),dFdy(p.y),dFdy(p.z));highp vec2 duv1=vec2(dFdx(uv.x),dFdx(uv.y));highp vec2 duv2=vec2(dFdy(uv.x),dFdy(uv.y));highp vec3 dp2perp=cross( dp2,N );highp vec3 dp1perp=cross( N,dp1 );highp vec3 T=dp2perp*duv1.x+dp1perp*duv2.x;highp vec3 B=dp2perp*duv1.y+dp1perp*duv2.y;highp float lengthT=dot(T,T);highp float lengthB=dot(B,B);highp float maxLength=max(lengthT,lengthB);highp float invmax=inversesqrt( maxLength );highp mat3 res=mat3( T*invmax,B*invmax,N );return res;\n#else\nreturn mat3(1.0);\n#endif\n}highp vec3 getNormal(){highp vec3 n;\n#ifdef HAS_ATTRIBUTE_a_normal_3f\nn=normalize(normal_3f);\n#else\nhighp vec3 fdx=vec3(dFdx(v_position_height.x),dFdx(v_position_height.y),dFdx(v_position_height.z));highp vec3 fdy=vec3(dFdy(v_position_height.x),dFdy(v_position_height.y),dFdy(v_position_height.z));n=normalize(cross(fdx,fdy))*-1.0;\n#endif\n#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nvec3 nMap=texture( u_normalTexture,uv_2f).xyz;nMap=normalize(2.0*nMap-vec3(1.0));highp vec3 v=normalize(-v_position_height.xyz);highp mat3 TBN=cotangentFrame(n,v,uv_2f);n=normalize(TBN*nMap);\n#endif\nreturn n;}struct Material {float perceptualRoughness;float alphaRoughness;float metallic;vec3 f90;vec4 baseColor;vec3 diffuseColor;vec3 specularColor;highp vec3 normal;};Material getPBRMaterial() {Material mat;mat.baseColor=getBaseColor();mat.perceptualRoughness=u_roughnessFactor;mat.metallic=u_metallicFactor;\n#ifdef HAS_ATTRIBUTE_a_pbr\nmat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w;\n#endif\n#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) \nvec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b;\n#endif\nconst float c_minRoughness=0.04;mat.perceptualRoughness=clamp(mat.perceptualRoughness,c_minRoughness,1.0);mat.metallic=saturate(mat.metallic);mat.alphaRoughness=mat.perceptualRoughness*mat.perceptualRoughness;const vec3 f0=vec3(0.04);mat.diffuseColor=mat.baseColor.rgb*(vec3(1.0)-f0);mat.diffuseColor*=1.0-mat.metallic;mat.specularColor=mix(f0,mat.baseColor.rgb,mat.metallic);highp float reflectance=max(max(mat.specularColor.r,mat.specularColor.g),mat.specularColor.b);highp float reflectance90=saturate(reflectance*25.0);mat.f90=vec3(reflectance90);mat.normal=getNormal();return mat;}float V_GGX(float NdotL,float NdotV,float roughness)\n{float a2=roughness*roughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-a2)+a2);float GGXL=NdotV*sqrt(NdotL*NdotL*(1.0-a2)+a2);return 0.5/(GGXV+GGXL);}float V_GGXFast(float NdotL,float NdotV,float roughness) {float a=roughness;float GGXV=NdotL*(NdotV*(1.0-a)+a);float GGXL=NdotV*(NdotL*(1.0-a)+a);return 0.5/(GGXV+GGXL);}vec3 F_Schlick(vec3 specularColor,vec3 f90,float VdotH)\n{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH)\n{float x=1.0-VdotH;float x4=x*x*x*x;return specularColor+(1.0-specularColor)*x4*x;}float D_GGX(highp float NdotH,float alphaRoughness)\n{highp float a4=alphaRoughness*alphaRoughness;highp float f=(NdotH*a4-NdotH)*NdotH+1.0;return a4/(PI*f*f);}vec3 diffuseBurley(Material mat,float LdotH,float NdotL,float NdotV)\n{float f90=2.0*LdotH*LdotH*mat.alphaRoughness-0.5;return (mat.diffuseColor/PI)*(1.0+f90*pow((1.0-NdotL),5.0))*(1.0+f90*pow((1.0-NdotV),5.0));}vec3 diffuseLambertian(Material mat)\n{\n#ifdef LIGHTING_3D_MODE\nreturn mat.diffuseColor;\n#else\nreturn mat.diffuseColor/PI;\n#endif\n}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV)\n{vec4 c0=vec4(-1,-0.0275,-0.572,0.022);vec4 c1=vec4(1,0.0425,1.04,-0.04);highp vec4 r=roughness*c0+c1;highp float a004=min(r.x*r.x,exp2(-9.28*NdotV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}vec3 computeIndirectLightContribution(Material mat,float NdotV,vec3 normal)\n{vec3 env_light=vec3(0.65,0.65,0.65);\n#ifdef LIGHTING_3D_MODE\nfloat ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor;\n#endif\nvec3 envBRDF=EnvBRDFApprox(mat.specularColor,mat.perceptualRoughness,NdotV);vec3 indirectSpecular= envBRDF*env_light;vec3 indirectDiffuse=mat.diffuseColor*env_light;return indirectSpecular+indirectDiffuse;}vec3 computeLightContribution(Material mat,vec3 lightPosition,vec3 lightColor)\n{highp vec3 n=mat.normal;highp vec3 v=normalize(-v_position_height.xyz);highp vec3 l=normalize(lightPosition);highp vec3 h=normalize(v+l);float NdotV=clamp(abs(dot(n,v)),0.001,1.0);float NdotL=saturate(dot(n,l));highp float NdotH=saturate(dot(n,h));float VdotH=saturate(dot(v,h));vec3 f=F_SchlickFast(mat.specularColor,VdotH);float g=V_GGXFast(NdotL,NdotV,mat.alphaRoughness);float d=D_GGX(NdotH,mat.alphaRoughness);vec3 diffuseTerm=(1.0-f)*diffuseLambertian(mat);vec3 specularTerm=f*g*d;vec3 transformed_normal=vec3(-n.xy,n.z);float lighting_factor;\n#ifdef RENDER_SHADOWS\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\n#else\nlighting_factor=NdotL;\n#endif\nvec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*light
213Color;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0;\n#if !defined(LIGHTING_3D_MODE)\nconst vec3 luminosityFactor=vec3(0.2126,0.7152,0.0722);float luminance=dot(diffuseTerm,luminosityFactor);intensityFactor=mix((1.0-u_lightintensity),max((1.0-luminance+u_lightintensity),1.0),NdotL);\n#endif\ncolor*=intensityFactor;return color;}void main() {\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nif (isOccluded()) {discard;}\n#endif\nvec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor;\n#ifdef LIGHTING_3D_MODE\nlightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color;\n#endif\nvec4 finalColor;\n#ifdef DIFFUSE_SHADED\nvec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor);\n#ifdef HAS_TEXTURE_u_occlusionTexture\nfloat ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao;\n#endif\nfinalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity;\n#else\nMaterial mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0;\n#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\nvec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy;\n#else\nvec2 uv=uv_2f;\n#endif\nao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao;\n#endif\nvec4 emissive=u_emissiveFactor;\n#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nemissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb);\n#endif\n#ifdef APPLY_LUT_ON_GPU\nfloat emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength;\n#endif\ncolor+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity;\n#ifdef HAS_ATTRIBUTE_a_pbr\nfloat resEmission=v_roughness_metallic_emissive_alpha.z;resEmission*=v_height_based_emission_params.z+v_height_based_emission_params.w*pow(clamp(v_height_based_emission_params.x,0.0,1.0),v_height_based_emission_params.y);vec3 color_mix=v_color_mix.rgb;\n#ifdef APPLY_LUT_ON_GPU\ncolor_mix=applyLUT(u_lutTexture,color_mix);\n#endif\ncolor=mix(color,color_mix,min(1.0,resEmission));\n#ifdef HAS_ATTRIBUTE_a_color_4f\nfloat distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.
213y));distance+= mix(0.5,0.0,clamp(resEmission-1.0,0.0,1.0));opacity*=v_roughness_metallic_emissive_alpha.w*saturate(1.0-distance*distance);\n#endif\n#endif\nvec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity);\n#endif\n#ifdef FOG\nfinalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w));\n#endif\n#ifdef RENDER_CUTOFF\nfinalColor*=v_cutoff_opacity;\n#endif\n#ifdef INDICATOR_CUTOUT\nfinalColor=applyCutout(finalColor);\n#endif\nglFragColor=finalColor;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec3 a_pos_3f;\n#pragma mapbox: define-attribute highp vec3 normal_3f\n#pragma mapbox: define-attribute highp vec2 uv_2f\n#pragma mapbox: define-attribute highp vec3 color_3f\n#pragma mapbox: define-attribute highp vec4 color_4f\n#pragma mapbox: define-attribute-vertex-shader-only highp vec4 pbr\n#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength\nuniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix;\n#ifdef INSTANCED_ARRAYS\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\n#else\nuniform highp mat4 u_normal_matrix;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth_shadows;\n#endif\nout vec4 v_position_height;out lowp vec4 v_color_mix;\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nout highp float v_depth;\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\nout lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params;\n#endif\nvec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {\n#pragma mapbox: initialize-attribute highp vec3 normal_3f\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\n#pragma mapbox: initialize-attribute highp vec3 color_3f\n#pragma mapbox: initialize-attribute highp vec4 color_4f\n#pragma mapbox: initialize-attribute-custom highp vec4 pbr\n#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength\nhighp mat4 normal_matrix;\n#ifdef INSTANCED_ARRAYS\nnormal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\n#else\nnormal_matrix=u_normal_matrix;\n#endif\nvec3 local_pos;mat3 rs;\n#ifdef MODEL_POSITION_ON_GPU\nvec3 pos_color=normal_matrix[0].xyz;vec4 translate=normal_matrix[1];vec3 pos_a=floor(pos_color);vec3 rgb=1.05*(pos_color-pos_a);float hidden=float(pos_a.x > EXTENT);float color_mix=pos_a.z/100.0;v_color_mix=vec4(sRGBToLinear(rgb),color_mix);float meter_to_tile=normal_matrix[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);rs[0].x=normal_matrix[1].w;rs[0].yz=normal_matrix[2].xy;rs[1].xy=normal_matrix[2].zw;rs[1].z=normal_matrix[3].x;rs[2].xyz=normal_matrix[3].yzw;vec4 pos_node=u_lighting_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;local_pos=pos.xyz;gl_Position=mix(u_matrix*pos,AWAY,hidden);pos.z*=meter_to_tile;v_position_height.xyz=pos.xyz-u_camera_pos;\n#else\nlocal_pos=a_pos_3f;gl_Position=u_matrix*vec4(a_pos_3f,1);v_position_height.xyz=vec3(u_lighting_matrix*vec4(a_pos_3f,1));v_color_mix=vec4(sRGBToLinear(u_color_mix.rgb),u_color_mix.a);\n#endif\nv_position_height.w=a_pos_3f.z;\n#ifdef HAS_ATTRIBUTE_a_pbr\nvec4 albedo_c=decode_color(pbr.xy);vec2 e_r_m=unpack_float(pbr.z);vec2 r_m= unpack_float(e_r_m.y*16.0);r_m.r=r_m.r*16.0;v_color_mix=vec4(albedo_c.rgb,1.0);v_roughness_metallic_emissive_alpha=vec4(vec3(r_m,e_r_m.x)/255.0,albedo_c.a);v_roughness_metallic_emissive_alpha.z*=2.0;float heightBasedRelativeIntepolation=a_pos_3f.z*heightBasedEmissiveStrength.x+heightBasedEmissiveStrength.y;v_height_based_emission_params.x=heightBasedRelativeIntepolation;v_height_based_emission_params.y=heightBasedEmissiveStrength.z;vec2 emissionMultiplierValues=unpack_float(pbr.w)/256.0;v_height_based_emission_params.z=emissionMultiplierValues.x;v_height_based_emission_params.w=emissionMultiplierValues.y-emissionMultiplierValues.x;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(local_pos);\n#endif\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef HAS_ATTRIBUTE_a_normal_3f\n#ifdef MODEL_POSITION_ON_GPU\nfloat x_squared_scale=dot(rs[0],rs[0]);float y_squared_scale=dot(rs[1],rs[1]);float z_squared_scale=dot(rs[2],rs[2]);vec3 squared_scale=vec3(x_squared_scale,y_squared_scale,z_squared_scale);normal_3f=rs*((u_lighting_matrix*vec4(normal_3f,0.0)).xyz/squared_scale);normal_3f=normalize(normal_3f);
213\n#else\nnormal_3f=vec3(normal_matrix*vec4(normal_3f,0));\n#endif\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\n#ifdef HAS_ATTRIBUTE_a_color_4f\nv_roughness_metallic_emissive_alpha.w=clamp(color_4f.a*v_roughness_metallic_emissive_alpha.w*(v_roughness_metallic_emissive_alpha.z-1.0),0.0,1.0);\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0);\n#ifdef NORMAL_OFFSET\n#ifdef HAS_ATTRIBUTE_a_normal_3f\n#ifdef MODEL_POSITION_ON_GPU\nvec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();\n#else\nvec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();\n#endif\n#endif\n#endif\nv_pos_light_view_0=u_light_matrix_0*shadow_pos;v_pos_light_view_1=u_light_matrix_1*shadow_pos;v_depth_shadows=gl_Position.w;\n#endif\n}'),modelDepth:iR("in highp float v_depth;void main() {\n#ifndef DEPTH_TEXTURE\nglFragColor=pack_depth(v_depth);\n#endif\n}","in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;\n#ifdef MODEL_POSITION_ON_GPU\n#ifdef INSTANCED_ARRAYS\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\n#else\nuniform highp mat4 u_instance;\n#endif\nuniform highp mat4 u_node_matrix;\n#endif\nvoid main() {\n#ifdef MODEL_POSITION_ON_GPU\nhighp mat4 instance;\n#ifdef INSTANCED_ARRAYS\ninstance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\n#else\ninstance=u_instance;\n#endif\nvec3 pos_color=instance[0].xyz;vec4 translate=instance[1];vec3 pos_a=floor(pos_color);float hidden=float(pos_a.x > EXTENT);float meter_to_tile=instance[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);mat3 rs;rs[0].x=instance[1].w;rs[0].yz=instance[2].xy;
213rs[1].xy=instance[2].zw;rs[1].z=instance[3].x;rs[2].xyz=instance[3].yzw;vec4 pos_node=u_node_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;gl_Position=mix(u_matrix*pos,AWAY,hidden);\n#else\ngl_Position=u_matrix*vec4(a_pos_3f,1);\n#endif\nv_depth=gl_Position.z/gl_Position.w;}"),stars:iR("in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv)\n{float beginFade=0.6;float lengthFromCenter=length(v_uv);return 1.0-clamp((lengthFromCenter-beginFade)/(1.0-beginFade),0.0,1.0);}void main() {float alpha=shapeCircle(v_uv);vec3 color=vec3(1.0,1.0,1.0);alpha*=v_intensity;glFragColor=vec4(color*alpha,alpha);HANDLE_WIREFRAME_DEBUG;}","\nin vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_fade_opacity;uniform mat4 u_matrix;uniform vec3 u_up;uniform vec3 u_right;uniform float u_intensity_multiplier;out highp vec2 v_uv;out mediump float v_intensity;void main() {v_uv=a_uv;v_intensity=a_fade_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}"),snowParticle:iR("in highp vec2 uv;in highp float alphaMultiplier;uniform vec4 u_particleColor;uniform vec2 u_simpleShapeParameters;void main() {float t=clamp((length(uv)-u_simpleShapeParameters.x)/(1.0-u_simpleShapeParameters.x),0.0,1.0);float alpha=1.0-pow(t,pow(10.0,u_simpleShapeParameters.y));alpha*=alphaMultiplier;alpha*=u_particleColor.a;vec3 color=u_particleColor.rgb*alpha;glFragColor=vec4(color,alpha) ;HANDLE_WIREFRAME_DEBUG;}","\nin highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_snowParticleData;in highp vec4 a_snowParticleDataHorizontalOscillation;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform vec2 u_screenSize;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; \nuniform float u_velocity;uniform vec3 u_direction;uniform float u_horizontalOscillationRadius; \nuniform float u_horizontalOscillationRate; \nuniform float u_billboardSize;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;out highp vec2 uv;out highp float alphaMultiplier;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos.xyz*=halfBoxSize;pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_snowParticleData.z;float coneAngleHeadingRad=a_snowParticleData.w*radians(360.0);vec3 localZ=normalize(u_direction);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 direction;direction.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.z=cos(coneAnglePichRad);direction=normalize(direction);vec3 simPosLocal=vec3(0,0,0);float velocityScale=(1.0+3.0*a_snowParticleData.y)*u_velocity;simPosLocal+=direction*velocityScale*u_time;float horizontalOscillationRadius=u_horizontalOscillationRadius*a_snowParticleDataHorizontalOscillation.x;float horizontalOscillationAngle=u_horizontalOscillationRate*u_time*(-1.0+2.0*a_snowParticleDataHorizontalOscillation.y);simPosLocal.xy+=horizontalOscillationRadius*vec2(cos(horizontalOscillationAngle),sin(horizontalOscillationAngle));vec3 simPos=localX*simPosLocal.x+\nlocalY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);float clipZ=-u_cam_pos.z+pos.z;vec4 posView=u_modelview*vec4(pos,1.0);float size=u_billboardSize;alphaMultiplier=1.0;vec4 posScreen=u_projection*posView;posScreen/=posScreen.w;posScreen.xy=vec2(0.5)+posScreen.xy*0.5;posScreen.xy*=u_screenSize;vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=u_screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-posScreen.xy)/(0.5*u_screenSize));screenDist+=a_snowParticleData.x*u_thinningParticleOffset;float scaleFactorMode=0.0;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);if (a_snowParticleData.x < u_thinningAffectedRatio) {scaleFactorMode=1.0-thinningFadeRatio;alphaMultiplier=thinningFadeRatio;}}vec4 posScreen1=u_projection*vec4(posView.x-size,posView.yzw);posScreen1/=posScreen1.w;vec4 posScreen2=u_projection*vec4(posView.x+size,posView.yzw);posScreen2/=posScreen2.w;posScreen1.xy=vec2(0.5)+posScreen1.xy*0.5;posScreen1.xy*=u_screenSize;posScreen2.xy=vec2(0.5)+posScreen2.xy*0.5;posScreen2.xy*=u_screenSize;float screenLength=length(posScreen1.xy-posScreen2.xy);float screenEpsilon=3.0;float scaleFactor=1.0;if (screenLength < screenEpsilon) {scaleFactor=screenEpsilon/max(screenLength,0.01);scaleFactor=mix(scaleFactor,1.0,scaleFactorMode);}float screenEpsilon2=15.0;if (screenLength > screenEpsilon2) {scaleFactor=screenEpsilon2/max(screenLength,0.01);}size*=scaleFactor;vec2 right=size*vec2(1,0);vec2 up=size*vec2(0,1);posView.xy+=right*a_uv.x;posView.xy+=up*a_uv.y;uv=a_uv;gl_Position=u_projection*posView;}"),rainParticle:iR("in highp vec2 uv;in highp float particleRandomValue;uniform sampler2D u_texScreen;uniform float u_distortionStrength;uniform vec4 u_color;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;uniform float u_shapeDirectionalPower;uniform float u_mode;void main() {vec2 st=uv*0.5+vec2(0.5);vec2 uvm=uv;uvm.y=-1.0+2.0*pow(st.y,u_shapeDirectionalPower);float shape=clamp(1.0-length(uvm),0.0,1.0);float alpha=abs(shape)*u_color.a;vec2 screenSize=vec2(textureSize(u_texScreen,0));vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-gl_FragCoord.xy)/(0.5*screenSize));screenDist+=(0.5+0.5*particleRandomValue)*u_thinningParticleOffset;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;float thinningAlpha=1.0;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);thinningAlpha*=thinningFadeRatio;}vec2 offsetXY=normalize(uvm)*abs(shape);vec2 stScreen=(gl_FragCoord.xy+offsetXY*u_distortionStrength*thinningAlpha)/screenSize;vec3 colorScreen=texture(u_texScreen,stScreen).rgb;alpha*=thinningAlpha;glFragColor=mix(vec4(colorScreen,1.0),vec4(u_color.rgb*alpha,alpha),u_mode);HANDLE_WIREFRAME_DEBUG;}","\nin highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_rainParticleData;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; \nuniform float u_velocity; \nuniform vec2 u_rainDropletSize;uniform vec3 u_rainDirection;out highp vec2 uv;out highp float particleRandomValue;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;
213pos*=halfBoxSize; \npos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_rainParticleData.z;float coneAngleHeadingRad=a_rainParticleData.w*radians(360.0);vec3 localZ=normalize(u_rainDirection);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 directionLocal;directionLocal.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.z=cos(coneAnglePichRad);directionLocal=normalize(directionLocal);vec3 directionWorld=localX*directionLocal.x+localY*directionLocal.y+localZ*directionLocal.z;float velocityScale=(1.0+3.0*a_rainParticleData.y)*u_velocity;vec3 simPosLocal=vec3(0,0,0);simPosLocal+=directionLocal*velocityScale*u_time;vec3 simPos=localX*simPosLocal.x+\nlocalY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);vec4 posView=u_modelview*vec4(pos,1.0);vec3 directionView=normalize((u_modelview*vec4(directionWorld,0.0)).xyz);vec3 side=cross(directionView,normalize(posView.xyz));posView.xyz+=side*a_uv.x*u_rainDropletSize.x;posView.xyz+=directionView*a_uv.y*u_rainDropletSize.y;uv=a_uv;particleRandomValue=a_rainParticleData.x;gl_Position=u_projection*posView;}"),occlusion:iR("uniform vec4 u_color;void main() {glFragColor=u_color;}",'#include "_prelude_terrain.vertex.glsl"\nin highp vec2 a_offset_xy;uniform highp vec3 u_anchorPos;uniform mat4 u_matrix;uniform vec2 u_screenSizePx;uniform vec2 u_occluderSizePx;void main() {vec3 world_pos=u_anchorPos;\n#ifdef TERRAIN\nfloat e=elevation(world_pos.xy);world_pos.z+=e;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1.0);projected_point.xy+=projected_point.w*a_offset_xy*0.5*u_occluderSizePx/u_screenSizePx;gl_Position=projected_point;}')};function ik(e,i){for(let r of e.replace(/\s*\/\/[^\n]*\n/g,"\n").split("\n"))if("#"===(r=r.trim())[0]&&r.includes("if")&&!r.includes("endif"))for(let e of(r=r.replace("#","").replace(/ifdef|ifndef|elif|if/g,"").replace(/!|defined|\(|\)|\|\||&&/g,"").replace(/\s+/g," ").trim()).split(" "))i.includes(e)||i.push(e)}function iR(e,i){let r=/#include\s+"([^"]+)"/g,a=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g,n=i.match(/(attribute(\S*)|(^\s*|;)in) (highp |mediump |lowp )?([\w]+) ([\w]+)/gm);n&&(n=[...new Set(n=n.map(e=>{let i=e.split(" ");return i[i.length-1]}))]);let s={},l=[],h=[];if(e=e.replace(r,(e,i)=>(h.push(i),"")),(i=i.replace(r,(e,i)=>(l.push(i),""))).includes("flat out"))return void console.error('The usage of "flat" qualifier is disallowed, see: https://bugs.webkit.org/show_bug.cgi?id=268071');let u=[...iA];for(let r of(ik(e,u),ik(i,u),[...l,...h]))iI[r]||console.error(`Undefined include: ${r}`),iC[r]||(iC[r]=[],ik(iI[r],iC[r])),u=[...u,...iC[r]];return{fragmentSource:e=e.replace(a,(e,i,r,a,n)=>(s[n]=!0,"define"===i?` 214#ifndef HAS_UNIFORM_u_${n} 215in ${r} ${a} ${n}; 216#else 217uniform ${r} ${a} u_${n}; 218#endif 219`:"initialize"===i?` 220#ifdef HAS_UNIFORM_u_${n} 221 ${r} ${a} ${n} = u_${n}; 222#endif 223`:"define-attribute"===i?` 224#ifdef HAS_ATTRIBUTE_a_${n} 225 in ${r} ${a} ${n}; 226#endif 227`:"initialize-attribute"===i?"":void 0)),vertexSource:i=i.replace(a,(e,i,r,a,n)=>{let l="float"===a?"vec2":a,h=n.match(/color/)?"color":l;return"define-attribute-vertex-shader-only"===i?` 228#ifdef HAS_ATTRIBUTE_a_${n} 229in ${r} ${a} a_${n}; 230#endif 231`:s[n]?"define"===i?` 232#ifndef HAS_UNIFORM_u_${n} 233uniform lowp float u_${n}_t; 234in ${r} ${l} a_${n}; 235out ${r} ${a} ${n}; 236#else 237uniform ${r} ${a} u_${n}; 238#endif 239`:"initialize"===i?"vec4"===h?` 240#ifndef HAS_UNIFORM_u_${n} 241 ${n} = a_${n}; 242#else 243 ${r} ${a} ${n} = u_${n}; 244#endif 245`:` 246#ifndef HAS_UNIFORM_u_${n} 247 ${n} = unpack_mix_${h}(a_${n}, u_${n}_t); 248#else 249 ${r} ${a} ${n} = u_${n}; 250#endif 251`:"define-attribute"===i?` 252#ifdef HAS_ATTRIBUTE_a_${n} 253 in ${r} ${a} a_${n}; 254 out ${r} ${a} ${n}; 255#endif 256`:"initialize-attribute"===i?` 257#ifdef HAS_ATTRIBUTE_a_${n} 258 ${n} = a_${n}; 259#endif 260`:void 0:"define"===i?` 261#ifndef HAS_UNIFORM_u_${n} 262uniform lowp float u_${n}_t; 263in ${r} ${l} a_${n}; 264#else 265uniform ${r} ${a} u_${n}; 266#endif 267`:"define-instanced"===i?"mat4"===h?` 268#ifdef INSTANCED_ARRAYS 269in vec4 a_${n}0; 270in vec4 a_${n}1; 271in vec4 a_${n}2; 272in vec4 a_${n}3; 273#else 274uniform ${r} ${a} u_${n}; 275#endif 276`:` 277#ifdef INSTANCED_ARRAYS 278in ${r} ${l} a_${n}; 279#else 280uniform ${r} ${a} u_${n}; 281#endif 282`:"initialize-attribute-custom"===i?` 283#ifdef HAS_ATTRIBUTE_a_${n} 284 ${r} ${a} ${n} = a_${n}; 285#endif 286`:"vec4"===h?` 287#ifndef HAS_UNIFORM_u_${n} 288 ${r} ${a} ${n} = a_${n}; 289#else 290 ${r} ${a} ${n} = u_${n}; 291#endif 292`:` 293#ifndef HAS_UNIFORM_u_${n} 294 ${r} ${a} ${n} = unpack_mix_${h}(a_${n}, u_${n}_t); 295#else 296 ${r} ${a} ${n} = u_${n}; 297#endif 298`}),staticAttributes:n,usedDefines:u,vertexIncludes:l,fragmentIncludes:h}}class iz{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(e,i,r,a,n,s,l,h){this.context=e;let u=this.boundPaintVertexBuffers.length!==a.length;for(let e=0;!u&&e<a.length;e++)this.boundPaintVertexBuffers[e]!==a[e]&&(u=!0);let c=this.boundDynamicVertexBuffers.length!==l.length;for(let e=0;!c&&e<l.length;e++)this.boundDynamicVertexBuffers[e]!==l[e]&&(c=!0);if(!this.vao||this.boundProgram!==i||this.boundLayoutVertexBuffer!==r||u||c||this.boundIndexBuffer!==n||this.boundVertexOffset!==s)this.freshBind(i,r,a,n,s,l,h);else{for(let r of(e.bindVertexArrayOES.set(this.vao),l))r&&(r.bind(),h&&r.instanceCount&&r.setVertexAttribDivisor(e.gl,i,h));n&&n.dynamicDraw&&n.bind()}}freshBind(e,i,r,a,n,s,l){let h=e.numAttributes,u=this.context,c=u.gl;for(let l of(this.vao&&this.destroy(),this.vao=u.gl.createVertexArray(),u.bindVertexArrayOES.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=i,this.boundPaintVertexBuffers=r,this.boundIndexBuffer=a,this.boundVertexOffset=n,this.boundDynamicVertexBuffers=s,i.enableAttributes(c,e),i.bind(),i.setVertexAttribPointers(c,e,n),r))l.enableAttributes(c,e),l.bind(),l.setVertexAttribPointers(c,e,n);for(let i of s)i&&(i.enableAttributes(c,e),i.bind(),i.setVertexAttribPointers(c,e,n),l&&i.instanceCount&&i.setVertexAttribDivisor(c,e,l));a&&a.bind(),u.currentNumAttributes=h}destroy(){this.vao&&(this.context.gl.deleteVertexArray(this.vao),this.vao=null)}}function iD(i,r,a){if(!r.needsDEMTextureUpload)return;let n=i.context,s=n.gl;n.pixelStoreUnpackPremultiplyAlpha.set(!1),r.demTexture=r.demTexture||i.getTileTexture(a.stride);let l=a.getPixels();r.demTexture?r.demTexture.update(l,{premultiply:!1}):r.demTexture=new e.T(n,l,s.R32F,{premultiply:!1}),r.needsDEMTextureUpload=!1}class iO{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 iB extends iO{getDefault(){return e.bA.transparent}set(e){let i=this.current;(e.r!==i.r||e.g!==i.g||e.b!==i.b||e.a!==i.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class iF extends iO{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class iN extends iO{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}
298class iV extends iO{getDefault(){return[!0,!0,!0,!0]}set(e){let i=this.current;(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2]||e[3]!==i[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class iU extends iO{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class ij extends iO{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class iG extends iO{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){let i=this.current;(e.func!==i.func||e.ref!==i.ref||e.mask!==i.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class iq extends iO{getDefault(){let e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){let i=this.current;(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class iW extends iO{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;e?i.enable(i.STENCIL_TEST):i.disable(i.STENCIL_TEST),this.current=e,this.dirty=!1}}class i$ extends iO{getDefault(){return[0,1]}set(e){let i=this.current;(e[0]!==i[0]||e[1]!==i[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class iH extends iO{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;e?i.enable(i.DEPTH_TEST):i.disable(i.DEPTH_TEST),this.current=e,this.dirty=!1}}class iZ extends iO{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class iX extends iO{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;e?i.enable(i.BLEND):i.disable(i.BLEND),this.current=e,this.dirty=!1}}class iY extends iO{getDefault(){let e=this.gl;return[e.ONE,e.ZERO,e.ONE,e.ZERO]}set(e){let i=this.current;(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2]||e[3]!==i[3]||this.dirty)&&(this.gl.blendFuncSeparate(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class iJ extends iO{getDefault(){return e.bA.transparent}set(e){let i=this.current;(e.r!==i.r||e.g!==i.g||e.b!==i.b||e.a!==i.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class iK extends iO{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(e,e),this.current=e,this.dirty=!1)}}class iQ extends iO{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;e?i.enable(i.CULL_FACE):i.disable(i.CULL_FACE),this.current=e,this.dirty=!1}}class i0 extends iO{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class i1 extends iO{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}let i2=class extends iO{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}};class i3 extends iO{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class i4 extends iO{getDefault(){let e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){let i=this.current;(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2]||e[3]!==i[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class i5 extends iO{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;i.bindFramebuffer(i.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class i6 extends iO{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;i.bindRenderbuffer(i.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class i8 extends iO{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;i.bindTexture(i.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class i9 extends iO{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;i.bindBuffer(i.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class i7 extends iO{getDefault(){return null}set(e){let i=this.gl;i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class re extends iO{getDefault(){return null}set(e){this.gl&&(e!==this.current||this.dirty)&&(this.gl.bindVertexArray(e),this.current=e,this.dirty=!1)}}class rt extends iO{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;i.pixelStorei(i.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class ri extends iO{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class rr extends iO{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let i=this.gl;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class ra extends iO{constructor(e,i){super(e),this.context=e,this.parent=i}getDefault(){return null}}class rn extends ra{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let i=this.gl;i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class ro extends ra{attachment(){return this.gl.DEPTH_ATTACHMENT}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let i=this.gl;i.framebufferRenderbuffer(i.FRAMEBUFFER,this.attachment(),i.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class rs extends ra{attachment(){return this.gl.DEPTH_ATTACHMENT}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let i=this.gl;i.framebufferTexture2D(i.FRAMEBUFFER,this.attachment(),i.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class rl extends ro{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}let rh=(e,i,r)=>({u_matrix:e,u_image0:0,u_skirt_height:i,u_ground_shadow_factor:r}),ru=(e,i,r,a,n,s,l,h,u,c,d,p,f,m,_,g)=>({u_proj_matrix:Float32Array.from(e),u_globe_matrix:i,u_normalize_matrix:Float32Array.from(a),u_merc_matrix:r,u_zoom_transition:n,u_merc_center:s,u_image0:0,u_frustum_tl:l,u_frustum_tr:h,u_frustum_br:u,u_frustum_bl:c,u_globe_pos:d,u_globe_radius:p,u_viewport:f,u_grid_matrix:g?Float32Array.from(g):new Float32Array(9),u_skirt_height:m,u_far_z_cutoff:_});function rc(e,i){return null!=e&&null!=i&&!(!e.hasData()||!i.hasData())&&null!=e.demTexture&&null!=i.demTexture&&e.tileID.key!==i.tileID.key}let rd=new class{constructor(){this.operations={}}newMorphing(e,i,r,a,n){if(e in this.operations){let i=this.operations[e];i.to.tileID.key!==r.tileID.key&&(i.queued=r)}else this.operations[e]={startTime:a,phase:0,duration:n,from:i,to:r,queued:null}}getMorphValuesForProxy(e){if(!(e in this.operations))return null;let i=this.operations[e];return{from:i.from,to:i.to,phase:i.phase}}update(e){for(let i in this.operations){let r=this.operations[i];for(r.phase=(e-r.startTime)/r.duration;r.phase>
298=1||!this._validOp(r);)if(!this._nextOp(r,e)){delete this.operations[i];break}}}_nextOp(e,i){return!!e.queued&&(e.from=e.to,e.to=e.queued,e.queued=null,e.phase=0,e.startTime=i,!0)}_validOp(e){return e.from.hasData()&&e.to.hasData()}},rp={0:null,1:"TERRAIN_VERTEX_MORPHING"};function rf(e,i,r){return 0===i?0:6*Math.pow(1.5,22-e)*Math.max(i,1)*(i<1&&514===r?.25/i:1)}let rm=e=>({u_matrix:e});function r_(i,r,a,n,s){if(s>0){let l=e.q.now(),h=(l-i.timeAdded)/s,u=r?(l-r.timeAdded)/s:-1,c=a.getSource(),d=n.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),p=!r||Math.abs(r.tileID.overscaledZ-d)>Math.abs(i.tileID.overscaledZ-d),f=p&&i.refreshedUponExpiration?1:e.ap(p?h:1-u,0,1);return i.refreshedUponExpiration&&h>=1&&(i.refreshedUponExpiration=!1),r?{opacity:1,mix:1-f}:{opacity:f,mix:0}}return{opacity:1,mix:0}}class rg extends e6{constructor(i){let r=eH("mock-dem",{type:"raster-dem",maxzoom:i.transform.maxZoom},new e.ce(e.cf(),null),i.style);super("mock-dem",r,!1),r.setEventedParent(this),this._sourceLoaded=!0}_loadTile(e,i){e.state="loaded",i(null)}}class ry extends e6{constructor(i){let r=eH("proxy",{type:"geojson",maxzoom:i.transform.maxZoom},new e.ce(e.cf(),null),i.style);super("proxy",r,!1),r.setEventedParent(this),this.map=this.getSource().map=i,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(e,i,r){if(e.freezeTileCoverage)return;this.transform=e;let a=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((i,r)=>{if(i[r.key]="",!this._tiles[r.key]){let i=new e2(r,this._source.tileSize*r.overscaleFactor(),e.tileZoom);i.state="loaded",this._tiles[r.key]=i}return i},{});for(let e in this._tiles)e in a||(this.freeFBO(e),this._tiles[e].unloadVectorData(),delete this._tiles[e])}freeFBO(e){let i=this.proxyCachedFBO[e];if(void 0!==i){let r=Object.values(i);this.renderCachePool.push(...r),delete this.proxyCachedFBO[e]}}deallocRenderCache(){this.renderCache.forEach(e=>e.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class rx extends e.aA{constructor(e,i,r){super(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y),this.proxyTileKey=i,this.projMatrix=r}}class rv extends e.cE{constructor(i,r){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},i.tp.registerParameter(this._debugParams,["Terrain"],"sortTilesHiZFirst",{},()=>{this._style.map.triggerRepaint()}),i.tp.registerParameter(this._debugParams,["Terrain"],"disableRenderCache",{},()=>{this._style.map.triggerRepaint()}),i.tp.registerButton(["Terrain"],"Invalidate Render Cache",()=>{this.invalidateRenderCache=!0,this._style.map.triggerRepaint()}),this.painter=i,this.terrainTileForTile={},this.prevTerrainTileForTile={};let[a,n,s]=function(i){let r=new e.a$,a=new e.aP;r.reserve(17161),a.reserve(33800);let n=e.ab/128,s=e.ab+n/2,l=s+n;for(let i=-n;i<l;i+=n)for(let a=-n;a<l;a+=n){let n=24575*(a<0||a>s||i<0||i>s),l=e.ap(Math.round(a),0,e.ab),h=e.ap(Math.round(i),0,e.ab);r.emplaceBack(l+n,h)}let h=(e,i)=>{let r=131*i+e;a.emplaceBack(r+1,r,r+131),a.emplaceBack(r+131,r+131+1,r+1)};for(let e=1;e<129;e++)for(let i=1;i<129;i++)h(i,e);return[0,129].forEach(e=>{for(let i=0;i<130;i++)h(i,e),h(e,i)}),[r,a,32768]}(),l=i.context;this.gridBuffer=l.createVertexBuffer(a,e.b1.members),this.gridIndexBuffer=l.createIndexBuffer(n),this.gridSegments=e.b2.simpleSegment(0,0,a.length,n.length),this.gridNoSkirtSegments=e.b2.simpleSegment(0,0,a.length,s),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new ry(r.map),this.orthoMatrix=e.a6.mat4.create(),e.a6.mat4.ortho(this.orthoMatrix,.015*("globe"===this.painter.transform.projection.name),e.ab,0,e.ab,0,1);let h=l.gl;this._overlapStencilMode=new tY({func:h.GEQUAL,mask:255},0,255,h.KEEP,h.KEEP,h.REPLACE),this._previousZoom=i.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=r,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new rg(r.map),this._pendingGroundEffectLayers=[]}set style(e){e.on("data",this._onStyleDataEvent.bind(this)),this._style=e,this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(i,r,a){if(i&&i.terrain){this._style!==i&&(this.style=i,this._evaluationZoom=void 0);let n=i.terrain.properties,s=0===i.terrain.drapeRenderMode,l=i.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=e.q.now();let h=i.terrain&&i.terrain.scope,u=n.get("source"),c=s?this._mockSourceCache:i.getSourceCache(u,h);if(!c)return void e.w(`Couldn't find terrain source "${u}".`);if(this.sourceCache=c,this._attenuationRange=i.terrain.getAttenuationRange(),this._exaggeration=l?this.calculateExaggeration(r):n.get("exaggeration"),!r.projection.requiresDraping&&l&&0===this._exaggeration)return void this._disable();this.enabled=!0;let d=()=>{this.sourceCache.used&&e.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source. 299This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);let i=this.getScaledDemTileSize();this.sourceCache.update(r,i,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,d(),this._initializing=!0),d(),r.updateElevation(!0,a),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(r),this._emptyDEMTextureDirty=!0,this._previousZoom=r.zoom}else this._disable()}calculateExaggeration(i){if(this._attenuationRange&&i.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(i.zoom);let r=this._previousCameraAltitude,a=i.getFreeCameraOptions().position.z/i.pixelsPerMeter*i.worldSize;this._previousCameraAltitude=a;let n=null!=r?a-r:Number.MAX_VALUE;if(2>Math.abs(n))return this._exaggeration;let s=i.zoom,l=this._style.terrain;if(!this._previousUpdateTimestamp)return l.getExaggeration(s);let h=s-this._previousZoom,u=this._previousUpdateTimestamp,c=s;null!=this._evaluationZoom&&(Math.abs(s-(c=this._evaluationZoom))>.5&&(h=.5*(s-c+h)),h*n<0&&(c+=h)),this._evaluationZoom=c;let d=l.getExaggeration(c),p=d===l.getExaggeration(Math.max(0,c-.1));if(p&&.01>Math.abs(d-this._exaggeration))return d;let f=Math.min(.1,.00375*(this._updateTimestamp-u));return(p||d<.1||1e-4>Math.abs(h))&&(f=Math.min(.2,4*f)),e.aa(this._exaggeration,d,f)}resetTileLookupCache(e){this._findCoveringTileCache[e]={}}attenuationRange(){return this._attenuationRange}getDemUpscale(){return this.proxySourceCache.getSource().tileSize/128}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(e){e.coord&&"source"===e.dataType?this._clearRenderCacheForTile(e.sourceCacheId,e.coord):"style"===e.dataType&&(this.invalidateRenderCache=!0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this._previousCameraAltitude=void 0)}_disable(){if(this.enabled&&(this.enabled=!1,this._emptyDEMTextureDirty=!0,this._sharedDepthStencil=void 0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(let e in this._style._mergedSourceCaches)this._style._mergedSourceCaches[e].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach(e
299=>e.fb.destroy()),this.pool=[],this.framebufferCopyTexture&&this.framebufferCopyTexture.destroy()}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this.enabled?this._exaggeration:0}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){let e=2*this.proxySourceCache.getSource().tileSize;return[e,e]}set useVertexMorphing(e){this._useVertexMorphing=e}updateTileBinding(i){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;let r=this.proxySourceCache,a=this.painter.transform;this._initializing&&(this._initializing=0===a._centerAltitude&&-1===this.getAtPointOrZero(e.a5.fromLngLat(a.center),-1),this._emptyDEMTextureDirty=!this._initializing);let n=this.proxyCoords=r.getIds().map(e=>{let i=r.getTileByID(e).tileID;return i.projMatrix=a.calculateProjMatrix(i.toUnwrapped()),i});!function(i,r){let a=r.transform.pointCoordinate(r.transform.getCameraPoint()),n=new e.P(a.x,a.y);i.sort((i,r)=>{if(r.overscaledZ-i.overscaledZ)return r.overscaledZ-i.overscaledZ;let a=new e.P(i.canonical.x+(1<<i.canonical.z)*i.wrap,i.canonical.y),s=new e.P(r.canonical.x+(1<<r.canonical.z)*r.wrap,r.canonical.y),l=n.mult(1<<i.canonical.z);return l.x-=.5,l.y-=.5,l.distSqr(a)-l.distSqr(s)})}(n,this.painter);let s=this.proxyToSource||{};this.proxyToSource={},n.forEach(e=>{this.proxyToSource[e.key]={}}),this.terrainTileForTile={};let l=this._style._mergedSourceCaches;for(let e in l){let r=l[e];if(!r.used||(r!==this.sourceCache&&this.resetTileLookupCache(r.id),this._setupProxiedCoordsForOrtho(r,i[e],s),r.usedForTerrain))continue;let a=i[e];r.getSource().reparseOverscaled&&this._assignTerrainTiles(a)}this.proxiedCoords[r.id]=n.map(e=>new rx(e,e.key,this.orthoMatrix)),this._assignTerrainTiles(n),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(s),this.renderingToTexture=!1;let h={};for(let e of(this._visibleDemTiles=[],this.proxyCoords)){let i=this.terrainTileForTile[e.key];if(!i)continue;let r=i.tileID.key;r in h||(this._visibleDemTiles.push(i),h[r]=r)}}_assignTerrainTiles(e){this._initializing||e.forEach(e=>{if(this.terrainTileForTile[e.key])return;let i=this._findTileCoveringTileID(e,this.sourceCache);i&&(this.terrainTileForTile[e.key]=i)})}_prepareDEMTextures(){let e=this.painter.context,i=e.gl;for(let r in this.terrainTileForTile){let a=this.terrainTileForTile[r],n=a.dem;n&&(!a.demTexture||a.needsDEMTextureUpload)&&(e.activeTexture.set(i.TEXTURE1),iD(this.painter,a,n))}}_prepareDemTileUniforms(e,i,r,a){if(!i||null==i.demTexture)return!1;let n=e.tileID.canonical,s=Math.pow(2,i.tileID.canonical.z-n.z),l=a||"";return r[`u_dem_tl${l}`]=[n.x*s%1,n.y*s%1],r[`u_dem_scale${l}`]=s,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let e=0,i=this._visibleDemTiles.reduce((i,r)=>{if(!r.dem)return i;let a=r.dem.tree.minimums[0];return a>0&&e++,i+a},0);return e?i/e:0}_updateEmptyDEMTexture(){let i=this.painter.context,r=i.gl;i.activeTexture.set(r.TEXTURE2);let a=this._getLoadedAreaMinimum(),n=new e.cF({width:1,height:1},new Float32Array([a]));this._emptyDEMTextureDirty=!1;let s=this._emptyDEMTexture;return s?s.update(n,{premultiply:!1}):s=this._emptyDEMTexture=new e.T(i,n,r.R32F,{premultiply:!1}),s}setupElevationDraw(i,r,a){var n;let s=this.painter.context,l=s.gl,h={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0};h.u_exaggeration=this.exaggeration();let u=null,c=null,d=1;if(a&&a.morphing&&this._useVertexMorphing){let e=a.morphing.srcDemTile,r=a.morphing.dstDemTile;d=a.morphing.phase,e&&r&&(this._prepareDemTileUniforms(i,e,h,"_prev")&&(c=e),this._prepareDemTileUniforms(i,r,h)&&(u=r))}let p=e=>e&&e.demTexture&&this.painter.linearFloatFilteringSupported()?l.LINEAR:l.NEAREST,f=null;if(this.enabled?c&&u?(f=u.demTexture,s.activeTexture.set(l.TEXTURE4),c.demTexture.bind(p(c),l.CLAMP_TO_EDGE),h.u_dem_lerp=d):(u=this.terrainTileForTile[i.tileID.key],f=this._prepareDemTileUniforms(i,u,h)?u.demTexture:this.empty
299DEMTexture):f=this.emptyDEMTexture,s.activeTexture.set(l.TEXTURE2),f&&(h.u_dem_size=1===(n=f).size[0]?1:n.size[0]-2,f.bind(p(u),l.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(a&&a.useDepthForOcclusion,r,h),a&&a.useMeterToDem&&u){let i=(1<<u.tileID.canonical.z)*e.bE(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;h.u_meter_to_dem=i}if(a&&a.labelPlaneMatrixInv&&(h.u_label_plane_matrix_inv=a.labelPlaneMatrixInv),r.setTerrainUniformValues(s,h),"globe"===this.painter.transform.projection.name){let e=this.globeUniformValues(this.painter.transform,i.tileID.canonical,a&&a.useDenormalizedUpVectorScale);r.setGlobeUniformValues(s,e)}}globeUniformValues(i,r,a){let n=i.projection;return{u_tile_tl_up:n.upVector(r,0,0),u_tile_tr_up:n.upVector(r,e.ab,0),u_tile_br_up:n.upVector(r,e.ab,e.ab),u_tile_bl_up:n.upVector(r,0,e.ab),u_tile_up_scale:a?e.cG(1):n.upVectorScale(r,i.center.lat,i.worldSize).metersToTile}}renderToBackBuffer(i){let r=this.painter,a=this.painter.context;0!==i.length&&(a.bindFramebuffer.set(null),a.viewport.set([0,0,r.width,r.height]),r.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,function(i,r,a,n,s){if("globe"===i.transform.projection.name)!function(i,r,a,n,s){let l,h;let u=i.context,c=u.gl,d=i.transform,p=e.cx(i,u,d),f=(e,r)=>{if(h===r)return;let a=[rp[r],"PROJECTION_GLOBE_VIEW"];p&&a.push("CUSTOM_ANTIALIASING");let n=i.isTileAffectedByFog(e);l=i.getOrCreateProgram("globeRaster",{defines:a,overrideFog:n}),h=r},m=i.colorModeForRenderPass(),_=new tX(c.LEQUAL,tX.ReadWrite,i.depthRangeFor3D);rd.update(s);let g=e.cy(d),y=[e.am(d.center.lng),e.at(d.center.lat)],x=i.globeSharedBuffers,v=[d.width*e.q.devicePixelRatio,d.height*e.q.devicePixelRatio],b=Float32Array.from(d.globeMatrix),w={useDenormalizedUpVectorScale:!0};{let d=i.transform,p=rf(d.zoom,r.exaggeration(),r.sourceCache._source.tileSize);h=-1;let T=c.TRIANGLES;for(let h of n){let n=a.getTile(h),S=tY.disabled,M=r.prevTerrainTileForTile[h.key],E=r.terrainTileForTile[h.key];rc(M,E)&&rd.newMorphing(h.key,M,E,s,250),u.activeTexture.set(c.TEXTURE0),n.texture&&n.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE);let A=rd.getMorphValuesForProxy(h.key),I=+!!A;A&&e.C(w,{morphing:{srcDemTile:A.from,dstDemTile:A.to,phase:e.cw(A.phase)}});let C=e.cz(h.canonical),P=e.cA(C.getCenter().lat),L=e.cB(h.canonical,C,P,d.worldSize/d._pixelsPerMercatorPixel),k=e.b6(e.cC(h.canonical)),R=ru(d.expandedFarZProjMatrix,b,g,k,e.a9(d.zoom),y,d.frustumCorners.TL,d.frustumCorners.TR,d.frustumCorners.BR,d.frustumCorners.BL,d.globeCenterInViewSpace,d.globeRadius,v,p,d._farZ,L);if(f(h,I),l&&(r.setupElevationDraw(n,l,w),i.uploadCommonUniforms(u,l,h.toUnwrapped()),x)){let[e,r,a]=x.getGridBuffers(P,0!==p);l.draw(i,T,_,S,m,tJ.backCCW,R,"globe_raster",e,r,a)}}}if(x&&(i.renderDefaultNorthPole||i.renderDefaultSouthPole)){let s=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];for(let h of(p&&s.push("CUSTOM_ANTIALIASING"),l=i.getOrCreateProgram("globeRaster",{defines:s}),n)){let{x:n,y:s,z:p}=h.canonical,f=0===s,g=s===(1<<p)-1,[b,T,S,M]=x.getPoleBuffers(p,!1);if(M&&(f||g)){let s=a.getTile(h);u.activeTexture.set(c.TEXTURE0),s.texture&&s.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE);let x=e.cD(p,n,d),E=e.b6(e.cC(h.canonical)),A=(e,r)=>e.draw(i,c.TRIANGLES,_,tY.disabled,m,tJ.disabled,ru(d.expandedFarZProjMatrix,x,x,E,0,y,d.frustumCorners.TL,d.frustumCorners.TR,d.frustumCorners.BR,d.frustumCorners.BL,d.globeCenterInViewSpace,d.globeRadius,v,0,d._farZ),"globe_pole_raster",r,S,M);r.setupElevationDraw(s,l,w),i.uploadCommonUniforms(u,l,h.toUnwrapped()),f&&i.renderDefaultNorthPole&&A(l,b),g&&i.renderDefaultSouthPole&&(x=e.a6.mat4.scale(e.a6.mat4.create(),x,[1,-1,1]),A(l,T))}}}}(i,r,a,n,s);else{let l,h;let u=i.context,c=u.gl,d=i.shadowRenderer,p=t9(i,i.longestCutoffRange),f=e=>{if(h===e)return;let r=[];r.push(rp[e]),p.shouldRenderCutoff&&r.push("RENDER_CUTOFF"),d&&(r.push("RENDER_SHADOWS","DEPTH_TEXTURE"),d.useNormalOffset&&r.push("NORMAL_OFFSET")),l=i.getOrCreateProgram("terrainRaster",{defines:r}),h=e},m=i.colorModeForRenderPass(),_=new tX(c.LEQUAL,tX.ReadWrite,i.depthRangeFor3D);rd.update(s);let g=i.transform,y=rf(g.zoom,r.exaggeration(),r.sourceCache._source.tileSize),x=[0,0,0];if(d){let e=i.style.directionalLight,r=i.style.ambientLight;e&&r&&(x=io(i.style,e,r))}{h=-1;let v=c.TRIANGLES,[b,w]=[r.gridIndexBuffer,r.gridSegments];for(let h of n){let n;let T=a.getTile(h),S=tY.disabled,M=r.prevTerrainTileForTile[h.key],E=r.terrainTileForTile[h.key];rc(M,E)&&rd.newMorphing(h.key,M,E,s,250),u.activeTexture.set(c.TEXTURE0),T.texture&&T.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE);let A=rd.getMorphValuesForProxy(h.key),I=+!!A;A&&(n={morphing:{srcDemTile:A.from,dstDemTile:A.to,phase:e.cw(A.phase)}});let C=rh(h.projMatrix,!function(e,i){let r=1<<e.z;return!i&&(0===e.x||e.x===r-1)||0===e.y||e.y===r-1}(h.canonical,g.renderWorldCopies)?y:y/10,x);if(f(I),!l)continue;r.setupElevationDraw(T,l,n);let P=h.toUnwrapped();d&&d.setupShadows(P,l),i.uploadCommonUniforms(u,l,P,null,p),l.draw(i,v,_,S,m,tJ.backCCW,C,"terrain_raster",r.gridBuffer,b,w)}}}}(r,this,this.proxySourceCache,i,this._updateTimestamp),this.renderingToTexture=!0,r.gpuTimingDeferredRenderEnd(),i.splice(0,i.length))}renderBatch(i){if(0===this._drapedRenderBatches.length)return i+1;this.renderingToTexture=!0;let r=this.painter,a=this.painter.context,n=this.proxySourceCache,s=this.proxiedCoords[n.id],l=this._drapedRenderBatches.shift(),h=r.style.order,u=[],c=0;for(let d of s){let s;let p=n.getTileByID(d.proxyTileKey),f=n.proxyCachedFBO[d.key]?n.proxyCachedFBO[d.key][i]:void 0,m=void 0!==f?n.renderCache[f]:this.pool[c++],_=void 0!==f;if(p.texture=m.tex,_&&!m.dirty){u.push(p.tileID);continue}a.bindFramebuffer.set(m.fb.framebuffer),this.renderedToTile=!1,m.dirty&&(a.clear({color:e.bA.transparent,stencil:0}),m.dirty=!1);for(let e=l.start;e<=l.end;++e){let i=r.style._mergedLayers[h[e]];if(i.isHidden(r.transform.zoom))continue;let n=r.style.getLayerSourceCache(i),l=n?this.proxyToSource[d.key][n.id]:[d];l&&(a.viewport.set([0,0,m.fb.width,m.fb.height]),s!==(n?n.id:null)&&(this._setupStencil(m,l,i,n),s=n?n.id:null),r.renderLayer(r,n,i,l))}if(0===this._drapedRenderBatches.length)for(let e of this._pendingGroundEffectLayers){let i=r.style._mergedLayers[h[e]];if(i.isHidden(r.transform.zoom))continue;let n=r.style.getLayerSourceCache(i),l=n?this.proxyToSource[d.key][n.id]:[d];l&&(a.viewport.set([0,0,m.fb.width,m.fb.height]),s!==(n?n.id:null)&&(this._setupStencil(m,l,i,n),s=n?n.id:null),r.renderLayer(r,n,i,l))}this.renderedToTile?(m.dirty=!0,u.push(p.tileID)):_||--c,5===c&&(c=0,this.renderToBackBuffer(u))}return this.renderToBackBuffer(u),this.renderingToTexture=!1,a.bindFramebuffer.set(null),a.viewport.set([0,0,r.width,r.height]),l.end+1}postRender(){}isLayerOrderingCorrect(e){let i=e.order.length,r=-1,a=i;for(let n=0;n<i;++n)this._style.isLayerDraped(e._mergedLayers[e.order[n]])?r=Math.max(r,n):a=Math.min(a,n);return a>r}getMinElevationBelowMSL(){let e=0;return this._visibleDemTiles.filter(e=>e.dem).forEach(i=>
299{e=Math.min(e,i.dem.tree.minimums[0])}),0===e?e:(e-30)*this._exaggeration}raycast(e,i,r){if(!this._visibleDemTiles)return null;let a=this._visibleDemTiles.filter(e=>e.dem).map(a=>{let n=a.tileID,s=1<<n.overscaledZ,{x:l,y:h}=n.canonical,u=l/s,c=(l+1)/s,d=h/s,p=(h+1)/s;return{minx:u,miny:d,maxx:c,maxy:p,t:a.dem.tree.raycastRoot(u,d,c,p,e,i,r),tile:a}});for(let n of(a.sort((e,i)=>(null!==e.t?e.t:Number.MAX_VALUE)-(null!==i.t?i.t:Number.MAX_VALUE)),a)){if(null==n.t)break;let a=n.tile.dem.tree.raycast(n.minx,n.miny,n.maxx,n.maxy,e,i,r);if(null!=a)return a}return null}_createFBO(){let i=this.painter.context,r=i.gl,a=this.drapeBufferSize;i.activeTexture.set(r.TEXTURE0);let n=new e.T(i,{width:a[0],height:a[1],data:null},r.RGBA8);n.bind(r.LINEAR,r.CLAMP_TO_EDGE);let s=i.createFramebuffer(a[0],a[1],!0,null);return s.colorAttachment.set(n.texture),s.depthAttachment=new rl(i,s.framebuffer),void 0===this._sharedDepthStencil?(this._sharedDepthStencil=i.createRenderbuffer(i.gl.DEPTH_STENCIL,a[0],a[1]),this._stencilRef=0,s.depthAttachment.set(this._sharedDepthStencil),i.clear({stencil:0})):s.depthAttachment.set(this._sharedDepthStencil),i.extTextureFilterAnisotropic&&r.texParameterf(r.TEXTURE_2D,i.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,i.extTextureFilterAnisotropicMax),{fb:s,tex:n,dirty:!1}}_initFBOPool(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())}_shouldDisableRenderCache(){if(this._debugParams.disableRenderCache||this._style.hasLightTransitions())return!0;for(let e in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[e].hasTransition())return!0;return this._style.order.some(e=>{let i=this._style._mergedLayers[e],r=i.isHidden(this.painter.transform.zoom);return"hillshade"===i.type||"custom"===i.type?!r&&i.shouldRedrape():!r&&i.hasTransition()})}_clearLineLayersFromRenderCache(){let i=!1;for(let e of this._style.getSources())if(e instanceof eG){i=!0;break}if(!i)return;let r={};for(let i=0;i<this._style.order.length;++i){let a=this._style._mergedLayers[this._style.order[i]],n=this._style.getLayerSourceCache(a);if(n&&!r[n.id]&&!a.isHidden(this.painter.transform.zoom)&&"line"===a.type&&a.widthExpression()instanceof e.a4)for(let e of(r[n.id]=!0,this.proxyCoords)){let i=this.proxyToSource[e.key][n.id];if(i)for(let e of i)this._clearRenderCacheForTile(n.id,e)}}}_clearRasterLayersFromRenderCache(){let e=!1;for(let i in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[i]._source instanceof eq){e=!0;break}if(!e)return;let i={};for(let e=0;e<this._style.order.length;++e){let r=this._style._mergedLayers[this._style.order[e]],a=this._style.getLayerSourceCache(r);if(!a||i[a.id]||r.isHidden(this.painter.transform.zoom)||"raster"!==r.type)continue;let n=r.paint.get("raster-fade-duration");for(let e of this.proxyCoords){let i=this.proxyToSource[e.key][a.id];if(i)for(let e of i){let i=r_(a.getTile(e),a.findLoadedParent(e,0),a,this.painter.transform,n);(1!==i.opacity||0!==i.mix)&&this._clearRenderCacheForTile(a.id,e)}}}}_setupDrapedRenderBatches(){let i=this._style.order,r=i.length;if(0===r)return;let a=[];this._pendingGroundEffectLayers=[];let n,s=0,l=this._style._mergedLayers[i[s]];for(;!this._style.isLayerDraped(l)&&l.isHidden(this.painter.transform.zoom)&&++s<r;)l=this._style._mergedLayers[i[s]];for(;s<r;++s){let e=this._style._mergedLayers[i[s]];e.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(e)?void 0===n&&(n=s):("fill-extrusion"===e.type&&this._pendingGroundEffectLayers.push(s),void 0!==n&&(a.push({start:n,end:s-1}),n=void 0)))}if(void 0!==n&&a.push({start:n,end:s-1}),0!==a.length){let i=a[a.length-1];this._pendingGroundEffectLayers.every(e=>e>i.end)||e.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=a}_setupRenderCache(e){let i=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,i.renderCache.length>i.renderCachePool.length){let e=Object.values(i.proxyCachedFBO);i.proxyCachedFBO={};for(let r=0;r<e.length;++r){let a=Object.values(e[r]);i.renderCachePool.push(...a)}}return}this._clearRasterLayersFromRenderCache();let r=this.proxyCoords,a=this._tilesDirty;for(let n=r.length-1;n>=0;n--){let s=r[n];if(i.getTileByID(s.key),void 0!==i.proxyCachedFBO[s.key]){let r=e[
299s.key],n=this.proxyToSource[s.key],l=0;for(let e in n){let i=n[e],s=r[e];if(!s||s.length!==i.length||i.some((i,r)=>i!==s[r]||a[e]&&a[e].hasOwnProperty(i.key))){l=-1;break}++l}for(let e in i.proxyCachedFBO[s.key])i.renderCache[i.proxyCachedFBO[s.key][e]].dirty=l<0||l!==Object.values(r).length}}let n=[...this._drapedRenderBatches];for(let e of(n.sort((e,i)=>i.end-i.start-(e.end-e.start)),n))for(let a of r){if(i.proxyCachedFBO[a.key])continue;let r=i.renderCachePool.pop();void 0===r&&i.renderCache.length<50&&(r=i.renderCache.length,i.renderCache.push(this._createFBO())),void 0!==r&&(i.proxyCachedFBO[a.key]={},i.proxyCachedFBO[a.key][e.start]=r,i.renderCache[r].dirty=!0)}this._tilesDirty={}}_setupStencil(e,i,r,a){let n;if(!a||!this._sourceTilesOverlap[a.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));let s=this.painter.context,l=s.gl;if(i.length<=1)return void(this._overlapStencilType=!1);if(r.isTileClipped())n=i.length,this._overlapStencilMode.test={func:l.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(i[0].overscaledZ>i[i.length-1].overscaledZ))return void(this._overlapStencilType=!1);n=1,this._overlapStencilMode.test={func:l.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+n>255&&(s.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=n,this._overlapStencilMode.ref=this._stencilRef,r.isTileClipped()&&this._renderTileClippingMasks(i,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return"Clip"===this._overlapStencilType||"Mask"===this._overlapStencilType}stencilModeForRTTOverlap(e){return this.renderingToTexture&&this._overlapStencilType?("Clip"===this._overlapStencilType&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[e.key]),this._overlapStencilMode):tY.disabled}_renderTileClippingMasks(e,i){let r=this.painter,a=this.painter.context,n=a.gl;r._tileClippingMaskIDs={},a.setColorMode(tZ.disabled),a.setDepthMode(tX.disabled);let s=r.getOrCreateProgram("clippingMask");for(let a of e){let e=r._tileClippingMaskIDs[a.key]=--i;s.draw(r,n.TRIANGLES,tX.disabled,new tY({func:n.ALWAYS,mask:0},e,255,n.KEEP,n.KEEP,n.REPLACE),tZ.disabled,tJ.disabled,rm(a.projMatrix),"$clipping",r.tileExtentBuffer,r.quadTriangleIndexBuffer,r.tileExtentSegments)}}pointCoordinate(i){let r=this.painter.transform;if(i.x<0||i.x>r.width||i.y<0||i.y>r.height)return null;let a=[i.x,i.y,1,1];e.a6.vec4.transformMat4(a,a,r.pixelMatrixInverse),e.a6.vec4.scale(a,a,1/a[3]),a[0]/=r.worldSize,a[1]/=r.worldSize;let n=r._camera.position,s=e.bE(1,r.center.lat),l=[n[0],n[1],n[2]/s,0],h=e.a6.vec3.subtract([],a.slice(0,3),l);e.a6.vec3.normalize(h,h);let u=this.raycast(l,h,this._exaggeration);return null!==u&&u?(e.a6.vec3.scaleAndAdd(l,l,h,u),l[3]=l[2],l[2]*=s,l):null}_setupProxiedCoordsForOrtho(i,r,a){if(i.getSource()instanceof e.aD)return this._setupProxiedCoordsForImageSource(i,r,a);this._findCoveringTileCache[i.id]=this._findCoveringTileCache[i.id]||{};let n=this.proxiedCoords[i.id]=[],s=this.proxyCoords;for(let e=0;e<s.length;e++){let r=s[e],l=this._findTileCoveringTileID(r,i);if(l){let e=this._createProxiedId(r,l,a[r.key]&&a[r.key][i.id]);n.push(e),this.proxyToSource[r.key][i.id]=[e]}}let l=!1,h=new Set;for(let e=0;e<r.length;e++){let s=i.getTile(r[e]);if(!s||!s.hasData())continue;let u=this._findTileCoveringTileID(s.tileID,this.proxySourceCache);if(u&&u.tileID.canonical.z!==s.tileID.canonical.z){let e=this.proxyToSource[u.tileID.key][i.id],r=this._createProxiedId(u.tileID,s,a[u.tileID.key]&&a[u.tileID.key][i.id]);e?e.splice(e.length-1,0,r):this.proxyToSource[u.tileID.key][i.id]=[r];let c=this.proxyToSource[u.tileID.key][i.id];h.has(c)||h.add(c),n.push(r),l=!0}}if(this._sourceTilesOverlap[i.id]=l,l&&this._debugParams.sortTilesHiZFirst)for(let e of h)e.sort((e,i)=>i.overscaledZ-e.overscaledZ)}
299_setupProxiedCoordsForImageSource(i,r,a){if(!i.getSource().loaded())return;let n=this.proxiedCoords[i.id]=[],s=this.proxyCoords,l=i.getSource(),h=l.tileID;if(!h)return;let u=new e.P(h.x,h.y)._div(1<<h.z),c=l.coordinates.map(e.a5.fromLngLat).reduce((e,i)=>(e.min.x=Math.min(e.min.x,i.x-u.x),e.min.y=Math.min(e.min.y,i.y-u.y),e.max.x=Math.max(e.max.x,i.x-u.x),e.max.y=Math.max(e.max.y,i.y-u.y),e),{min:new e.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new e.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),d=(i,r)=>{let a=i.wrap+i.canonical.x/(1<<i.canonical.z),n=i.canonical.y/(1<<i.canonical.z),s=e.ab/(1<<i.canonical.z),l=r.wrap+r.canonical.x/(1<<r.canonical.z),h=r.canonical.y/(1<<r.canonical.z);return a+s<l+c.min.x||a>l+c.max.x||n+s<h+c.min.y||n>h+c.max.y};for(let e=0;e<s.length;e++){let l=s[e];for(let e=0;e<r.length;e++){let s=i.getTile(r[e]);if(!s||!s.hasData()||d(l,s.tileID))continue;let h=this._createProxiedId(l,s,a[l.key]&&a[l.key][i.id]),u=this.proxyToSource[l.key][i.id];u?u.push(h):this.proxyToSource[l.key][i.id]=[h],n.push(h)}}}_createProxiedId(i,r,a){let n=this.orthoMatrix;if(a){let e=a.find(e=>e.key===r.tileID.key);if(e)return e}if(r.tileID.key!==i.key){let a,s,l;let h=i.canonical.z-r.tileID.canonical.z;n=e.a6.mat4.create();let u=r.tileID.wrap-i.wrap<<i.overscaledZ;h>0?(s=(a=e.ab>>h)*((r.tileID.canonical.x<<h)-i.canonical.x+u),l=a*((r.tileID.canonical.y<<h)-i.canonical.y)):(a=e.ab<<-h,s=e.ab*(r.tileID.canonical.x-(i.canonical.x+u<<-h)),l=e.ab*(r.tileID.canonical.y-(i.canonical.y<<-h))),e.a6.mat4.ortho(n,0,a,0,a,0,1),e.a6.mat4.translate(n,n,[s,l,0])}return new rx(r.tileID,i.key,n)}_findTileCoveringTileID(i,r){let a=r.getTile(i);if(a&&a.hasData())return a;let n=this._findCoveringTileCache[r.id],s=n[i.key];if((a=s?r.getTileByID(s):null)&&a.hasData()||null===s)return a;let l=a?a.tileID:i,h=l.overscaledZ,u=r.getSource().minzoom,c=[];if(!s){let n=r.getSource().maxzoom;if(i.canonical.z>=n){let a=i.canonical.z-n;r.getSource().reparseOverscaled?(h=Math.max(i.canonical.z+2,r.transform.tileZoom),l=new e.aA(h,i.wrap,n,i.canonical.x>>a,i.canonical.y>>a)):0!==a&&(h=n,l=new e.aA(h,i.wrap,n,i.canonical.x>>a,i.canonical.y>>a))}l.key!==i.key&&(c.push(l.key),a=r.getTile(l))}let d=e=>{c.forEach(i=>{n[i]=e}),c.length=0};for(h-=1;h>=u&&(!a||!a.hasData());h--){a&&d(a.tileID.key);let e=l.calculateScaledKey(h);if((a=r.getTileByID(e))&&a.hasData())break;let i=n[e];if(null===i)break;void 0===i?c.push(e):a=r.getTileByID(i)}return d(a?a.tileID.key:null),a&&a.hasData()?a:null}findDEMTileFor(e){return this.enabled?this._findTileCoveringTileID(e,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(e,i){let r=this._tilesDirty[e];r||(r=this._tilesDirty[e]={}),r[i.key]=!0}}let rb=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],rw=["stars","rain_particle","snow_particle","fillExtrusion","fillExtrusionGroundEffect","model","symbol"];class rT{static cacheKey(e,i,r,a){let n=`${i}${a?a.cacheKey:""}`;for(let i of r)e.usedDefines.includes(i)&&(n+=`/${i}`);return n}constructor(i,r,a,n,s,l){let h=i.gl;this.program=h.createProgram(),this.configuration=n,this.name=r,this.fixedDefines=[...l];let u=n?n.getBinderAttributes():[],c=(a.staticAttributes||[]).concat(u),d=n?n.defines():[];d=d.concat(l.map(e=>`#define ${e}`));let p="#version 300 es\n",f=p+d.concat("precision mediump float;",i_,iP.fragmentSource).join("\n");for(let e of a.fragmentIncludes)f+=` 300${iI[e]}`;f+=` 301${a.fragmentSource}`;let m=p+d.concat("precision highp float;",i_,iP.vertexSource).join("\n");for(let e of a.vertexIncludes)m+=` 302${iI[e]}`;m+=` 303${a.vertexSource}`;let _=h.createShader(h.FRAGMENT_SHADER);if(h.isContextLost())return void(this.failedToCreate=!0);h.shaderSource(_,f),h.compileShader(_),h.attachShader(this.program,_);let g=h.createShader(h.VERTEX_SHADER);if(h.isContextLost())this.failedToCreate=!0;else{h.shaderSource(g,m),h.compileShader(g),h.attachShader(this.program,g),this.attributes={},this.numAttributes=c.length;for(let e=0;e<this.numAttributes;e++)if(c[e]){let i=c[e].startsWith("a_")?c[e]:`a_${c[e]}`;h.bindAttribLocation(this.program,e,i),this.attributes[i]=e}h.linkProgram(this.program),h.deleteShader(g),h.deleteShader(_),this.fixedUniforms=s(i),this.binderUniforms=n?n.getUniforms(i):[],(l.includes("TERRAIN")||-1!==r.indexOf("symbol")||-1!==r.indexOf("circle"))&&(this.terrainUniforms={u_dem:new e.bK(i),u_dem_prev:new e.bK(i),u_dem_tl:new e.bH(i),u_dem_scale:new e.bJ(i),u_dem_tl_prev:new e.bH(i),u_dem_scale_prev:new e.bJ(i),u_dem_size:new e.bJ(i),u_dem_lerp:new e.bJ(i),u_exaggeration:new e.bJ(i),u_depth:new e.bK(i),u_depth_size_inv:new e.bH(i),u_depth_range_unpack:new e.bH(i),u_occluder_half_size:new e.bJ(i),u_occlusion_depth_offset:new e.bJ(i),u_meter_to_dem:new e.bJ(i),u_label_plane_matrix_inv:new e.bG(i)}),l.includes("GLOBE")&&(this.globeUniforms={u_tile_tl_up:new e.bI(i),u_tile_tr_up:new e.bI(i),u_tile_br_up:new e.bI(i),u_tile_bl_up:new e.bI(i),u_tile_up_scale:new e.bJ(i)}),l.includes("FOG")&&(this.fogUniforms={u_fog_matrix:new e.bG(i),u_fog_range:new e.bH(i),u_fog_color:new e.c7(i),u_fog_horizon_blend:new e.bJ(i),u_fog_vertical_limit:new e.bH(i),u_fog_temporal_offset:new e.bJ(i),u_frustum_tl:new e.bI(i),u_frustum_tr:new e.bI(i),u_frustum_br:new e.bI(i),u_frustum_bl:new e.bI(i),u_globe_pos:new e.bI(i),u_globe_radius:new e.bJ(i),u_globe_transition:new e.bJ(i),u_is_globe:new e.bK(i),u_viewport:new e.bH(i)}),l.includes("RENDER_CUTOFF")&&(this.cutoffUniforms={u_cutoff_params:new e.c7(i)}),l.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms={u_lighting_ambient_color:new e.bI(i),u_lighting_directional_dir:new e.bI(i),u_lighting_directional_color:new e.bI(i),u_ground_radiance:new e.bI(i)}),l.includes("RENDER_SHADOWS")&&(this.shadowUniforms={u_light_matrix_0:new e.bG(i),u_light_matrix_1:new e.bG(i),u_fade_range:new e.bH(i),u_shadow_normal_offset:new e.bI(i),u_shadow_intensity:new e.bJ(i),u_shadow_texel_size:new e.bJ(i),u_shadow_map_resolution:new e.bJ(i),u_shadow_direction:new e.bI(i),u_shadow_bias:new e.bI(i),u_shadowmap_0:new e.bK(i),u_shadowmap_1:new e.bK(i)})}}setTerrainUniformValues(e,i){if(!this.terrainUniforms)return;let r=this.terrainUniforms;if(!this.failedToCreate)for(let a in e.program.set(this.program),i)r[a]&&r[a].set(this.program,a,i[a])}setGlobeUniformValues(e,i){if(!this.globeUniforms)return;let r=this.globeUniforms;if(!this.failedToCreate)for(let a in e.program.set(this.program),i)r[a]&&r[a].set(this.program,a,i[a])}setFogUniformValues(e,i){if(!this.fogUniforms)return;let r=this.fogUniforms;if(!this.failedToCreate)for(let a in e.program.set(this.program),i)r[a].set(this.program,a,i[a])}setCutoffUniformValues(e,i){if(!this.cutoffUniforms)return;let r=this.cutoffUniforms;if(!this.failedToCreate)for(let a in e.program.set(this.program),i)r[a].set(this.program,a,i[a])}setLightsUniformValues(e,i){if(!this.lightsUniforms)return;let r=this.lightsUniforms;if(!this.failedToCreate)for(let a in e.program.set(this.program),i)r[a].set(this.program,a,i[a])}setShadowUniformValues(e,i){if(this.failedToCreate||!this.shadowUniforms)return;let r=this.shadowUniforms;for(let a in e.program.set(this.program),i)r[a].set(this.program,a,i[a])}_drawDebugWireframe(i,r,a,n,s,l,h,u,c,d){let p=i.options.wireframe;if(!1===p.terrain&&!1===p.layers2D&&!1===p.layers3D)return;let f=i.context;if(!(!(!p.terrain||"terrainRaster"!==this.name&&"globeRaster"!==this.name)||!(!p.layers2D||i._terrain&&i._terrain.renderingToTexture||!rb.includes(this.name))||!(!p.layers3D||!rw.includes(this.name))))return;let m=f.gl,_=i.wireframeDebugCache.getLinesFromTrianglesBuffer(i.frameCounter,s,f);if(!_)return;let g=[...this.fixedDefines];
303g.push("DEBUG_WIREFRAME");let y=i.getOrCreateProgram(this.name,{config:this.configuration,defines:g});f.program.set(y.program);let x=(e,i,r)=>{if(i[e]&&r[e])for(let a in i[e])r[e][a]&&r[e][a].set(r.program,a,i[e][a].current)};c&&c.setUniforms(y.program,f,y.binderUniforms,h,{zoom:u}),x("fixedUniforms",this,y),x("terrainUniforms",this,y),x("globeUniforms",this,y),x("fogUniforms",this,y),x("lightsUniforms",this,y),x("shadowUniforms",this,y),_.bind(),f.setColorMode(new tZ([m.ONE,m.ONE_MINUS_SRC_ALPHA,m.ZERO,m.ONE],e.bA.transparent,[!0,!0,!0,!1])),f.setDepthMode(new tX(r.func===m.LESS?m.LEQUAL:r.func,tX.ReadOnly,r.range)),f.setStencilMode(tY.disabled);let v=3*l.primitiveLength*2,b=3*l.primitiveOffset*4;d&&d>1?m.drawElementsInstanced(m.LINES,v,m.UNSIGNED_SHORT,b,d):m.drawElements(m.LINES,v,m.UNSIGNED_SHORT,b),s.bind(),f.program.set(this.program),f.setDepthMode(r),f.setStencilMode(a),f.setColorMode(n)}checkUniforms(e,i,r){if(this.fixedDefines.includes(i)){for(let a of Object.keys(r))if(!r[a].initialized)throw Error(`Program '${this.name}', from draw '${e}': uniform ${a} not set but required by ${i} being defined`)}}draw(e,i,r,a,n,s,l,h,u,c,d,p,f,m,_,g){let y=e.context,x=y.gl;if(this.failedToCreate)return;for(let e of(y.program.set(this.program),y.setDepthMode(r),y.setStencilMode(a),y.setColorMode(n),y.setCullFace(s),Object.keys(this.fixedUniforms)))this.fixedUniforms[e].set(this.program,e,l[e]);m&&m.setUniforms(this.program,y,this.binderUniforms,p,{zoom:f});let v={[x.POINTS]:1,[x.LINES]:2,[x.TRIANGLES]:3,[x.LINE_STRIP]:1}[i];this.checkUniforms(h,"RENDER_SHADOWS",this.shadowUniforms);let b=g&&g>0?1:void 0;for(let s of d.get()){let l=s.vaos||(s.vaos={});(l[h]||(l[h]=new iz)).bind(y,this,u,m?m.getPaintVertexBuffers():[],c,s.vertexOffset,_||[],b),g&&g>1?x.drawElementsInstanced(i,s.primitiveLength*v,x.UNSIGNED_SHORT,s.primitiveOffset*v*2,g):c?x.drawElements(i,s.primitiveLength*v,x.UNSIGNED_SHORT,s.primitiveOffset*v*2):x.drawArrays(i,s.vertexOffset,s.vertexLength),i===x.TRIANGLES&&c&&this._drawDebugWireframe(e,r,a,n,c,s,p,f,m,g)}}}function rS(i,r){let a=Math.pow(2,r.tileID.overscaledZ),n=r.tileSize*Math.pow(2,i.transform.tileZoom)/a,s=n*(r.tileID.canonical.x+r.tileID.wrap*a),l=n*r.tileID.canonical.y;return{u_image:0,u_texsize:r.imageAtlasTexture?r.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/e.ak(r,1,i.transform.tileZoom),u_pixel_coord_upper:[s>>16,l>>16],u_pixel_coord_lower:[65535&s,65535&l]}}let rM={terrain:0,flat:1},rE=e.a6.mat4.create(),rA=(i,r,a,n,s,l,h,u,c,d,p,f,m,_,g,y,x,v)=>{let b=r.style.light,w=b.properties.get("position"),T=[w.x,w.y,w.z],S=e.a6.mat3.create();"viewport"===b.properties.get("anchor")&&(e.a6.mat3.fromRotation(S,-r.transform.angle),e.a6.vec3.transformMat3(T,T,S));let M=b.properties.get("color"),E=r.transform,A={u_matrix:i,u_lightpos:T,u_lightintensity:b.properties.get("intensity"),u_lightcolor:[M.r,M.g,M.b],u_vertical_gradient:+a,u_opacity:n,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:rE,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:rM[d],u_base_type:rM[p],u_ao:s,u_edge_radius:l,u_width_scale:h,u_flood_light_color:g,u_vertical_scale:y,u_flood_light_intensity:x,u_ground_shadow_factor:v};return"globe"===E.projection.name&&(A.u_tile_id=[u.canonical.x,u.canonical.y,1<<u.canonical.z],A.u_zoom_transition=f,A.u_inv_rot_matrix=_,A.u_merc_center=m,A.u_up_dir=E.projection.upVector(new e.bQ(0,0,0),m[0]*e.ab,m[1]*e.ab),A.u_height_lift=c),A},rI=(e,i,r,a,n,s)=>({u_matrix:e,u_edge_radius:i,u_width_scale:r,u_vertical_scale:a,u_height_type:rM[n],u_base_type:rM[s]}),rC=(i,r,a,n,s,l,h,u,c,d,p,f,m,_,g,y,x)=>{let v=rA(i,r,a,n,s,l,h,u,d,p,f,m,_,g,y,x,1,[0,0,0]),b={u_height_factor:-Math.pow(2,u.overscaledZ)/c.tileSize/8};return e.l(v,rS(r,c),b)},rP=(e,i)=>({u_matrix:e,u_emissive_strength:i}),rL=(i,r,a,n)=>e.l(rP(i,r),rS(a,n)),rk=(e,i,r)=>({u_matrix:e,u_world:r,u_emissive_strength:i}),rR=(i,r,a,n,s)=>e.l(rL(i,r,a,n),{u_world:s}),rz=(i,r,a,n)=>{let s=e.ab/a.tileSize;return{u_matrix:i,u_camera_to_center_distance:r.getCameraToCenterDistance(n),u_extrude_scale:[r.pixelsToGLUnits[0]/s,r.pixelsToGLUnits[1]/s]}}
303,rD=(e,i,r=1)=>({u_matrix:e,u_color:i.toRenderColor(null),u_overlay:0,u_overlay_scale:r}),rO=e.a6.mat4.create(),rB=(i,r,a,n,s,l,h)=>{let u=i.transform,c="globe"===u.projection.name,d=c?e.cI(u.zoom,r.canonical)*u._pixelsPerMercatorPixel:e.ak(a,1,l),p={u_matrix:r.projMatrix,u_extrude_scale:d,u_intensity:h,u_inv_rot_matrix:rO,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(c){p.u_inv_rot_matrix=n,p.u_merc_center=s,p.u_tile_id=[r.canonical.x,r.canonical.y,1<<r.canonical.z],p.u_zoom_transition=e.a9(u.zoom);let i=s[0]*e.ab,a=s[1]*e.ab;p.u_up_dir=u.projection.upVector(new e.bQ(0,0,0),i,a)}return p};function rF(e,[i,r,a,n],[s,l]){if(s===l)return[0,0,0,0];let h=255*(e-1)/(e*(l-s));return[i*h,r*h,a*h,n*h]}function rN(e,i,[r,a]){return r===a?0:.5/e+(i-r)*(e-1)/(e*(a-r))}let rV=(i,r,a,n,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T)=>({u_matrix:i,u_normalize_matrix:r,u_globe_matrix:a,u_merc_matrix:n,u_grid_matrix:s,u_tl_parent:l,u_scale_parent:d,u_fade_t:p.mix,u_opacity:p.opacity*f.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:f.paint.get("raster-brightness-min"),u_brightness_high:f.paint.get("raster-brightness-max"),u_saturation_factor:e.cJ(f.paint.get("raster-saturation")),u_contrast_factor:e.cK(f.paint.get("raster-contrast")),u_spin_weights:function(e){let i=Math.sin(e*=Math.PI/180),r=Math.cos(e);return[(2*r+1)/3,(-Math.sqrt(3)*i-r+1)/3,(Math.sqrt(3)*i-r+1)/3]}(f.paint.get("raster-hue-rotate")),u_perspective_transform:m,u_raster_elevation:_,u_zoom_transition:h,u_merc_center:u,u_cutoff_params:c,u_colorization_mix:rF(e.cL,y,v),u_colorization_offset:rN(e.cL,x,v),u_color_ramp:g,u_texture_offset:[w/(b+2*w),b/(b+2*w)],u_texture_res:[b+2*w,b+2*w],u_emissive_strength:T}),rU=(e,i,r,a,n,s,l,h,u,c,d,p)=>({u_matrix:e,u_normalize_matrix:i,u_globe_matrix:r,u_merc_matrix:a,u_grid_matrix:n,u_tl_parent:s,u_scale_parent:c,u_fade_t:d.mix,u_opacity:d.opacity,u_image0:0,u_image1:1,u_raster_elevation:p,u_zoom_transition:l,u_merc_center:h,u_cutoff_params:u}),rj=(e,i,r,a,n,s,l,h,u,c)=>({u_particle_texture:e,u_particle_texture_side_len:i,u_tile_offset:r,u_velocity:a,u_color_ramp:s,u_velocity_res:n,u_max_speed:l,u_uv_offset:h,u_data_scale:[255*u[0],255*u[1]],u_data_offset:c,u_particle_pos_scale:1.1,u_particle_pos_offset:[.05,.05]}),rG=(e,i,r,a,n,s,l,h,u,c)=>({u_particle_texture:e,u_particle_texture_side_len:i,u_velocity:r,u_velocity_res:a,u_max_speed:n,u_speed_factor:s,u_reset_rate:l,u_rand_seed:Math.random(),u_uv_offset:h,u_data_scale:[255*u[0],255*u[1]],u_data_offset:c,u_particle_pos_scale:1.1,u_particle_pos_offset:[.05,.05]}),rq=e.a6.mat4.create(),rW=(i,r,a,n,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S)=>{let M=s.transform,E={u_is_size_zoom_constant:+("constant"===i||"source"===i),u_is_size_feature_constant:+("constant"===i||"camera"===i),u_size_t:r?r.uSizeT:0,u_size:r?r.uSize:0,u_camera_to_center_distance:M.getCameraToCenterDistance(b),u_rotate_symbol:+a,u_aspect_ratio:M.width/M.height,u_fade_change:s.options.fadeDuration?s.symbolFadeChange:1,u_matrix:l,u_label_plane_matrix:h,u_coord_matrix:u,u_is_text:+d,u_elevation_from_sea:+!!c,u_pitch_with_map:+n,u_texsize:p,u_texsize_icon:f,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:rq,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:rq,u_up_vector:[0,-1,0],u_color_adj_mat:w,u_icon_transition:T||0,u_gamma_scale:n?s.transform.getCameraToCenterDistance(b)*Math.cos(s.terrain?0:s.transform._pitch):1,u_device_pixel_ratio:e.q.devicePixelRatio,u_is_halo:+m,u_scale_factor:S||1};return"globe"===b.name&&(E.u_tile_id=[_.canonical.x,_.canonical.y,1<<_.canonical.z],E.u_zoom_transition=g,E.u_inv_rot_matrix=x,E.u_merc_center=y,E.u_camera_forward=M._camera.forward(),E.u_ecef_origin=e.cM(M.globeMatrix,_.toUnwrapped()),E.u_tile_matrix=Float32Array.from(M.globeMatrix),E.u_up_vector=v),E},r$=(e,i,r,a)=>({u_matrix:e,u_emissive_strength:i,u_opacity:r,u_color:a}),rH=(i,r,a,n,s,l,h,u,c)=>e.l(function(i,r,a,n,s,l){let{width:h,height:u}=n.imageManager.getPixelSize(r),c=Math.pow(2,l.tileID.overscaledZ),d=l.tileSize*Math.pow(2,n.transform.tileZoom)/c,p=d*(l.tileID.canonical.x+l.tileID.wrap*c),f=d*l.tileID.canonical.y;return{u_image:0,u_pattern_tl:a.tl,u_pattern_br:a.br,u_texsize:[h,u],u_pattern_size:a.displaySize,u_pattern_units_to_pixels:s?[n.transform.width,-1*n.transform.height]:[1/e.ak(l,1,n.transform.tileZoom),1/e.ak(l,1,n.transform.tileZoom)],u_pixel_coord_upper:[p>>16,f>>16],u_pixel_coord_lower:[65535&p,65535&f]}}(0,l,h,n,u,c),{u_matrix:i,u_emissive_strength:r,u_opacity:a}),rZ=new Float32Array(e.a6.mat4.identity([])),rX=(i,r,a,n,s,l,h,u,c,d,p,f,m,_=[0,0,0],g)=>{let y=s.style.light,x=y.properties.get("position"),v=[-x.x,-x.y,x.z],b=e.a6.mat3.create();"viewport"===y.properties.get("anchor")&&(e.a6.mat3.fromRotation(b,-s.transform.angle),e.a6.vec3.transformMat3(v,v,b));let w="MASK"===p.alphaMode,T=y.properties.get("color").toRenderColor(null),S=m.paint.get("model-ambient-occlusion-intensity"),M=m.paint.get("model-color").constantOr(e.bA.white).toRenderColor(null),E=m.paint.get("model-color-mix-intensity").constantOr(0);return{u_matrix:i,u_lighting_matrix:r,u_normal_matrix:a,u_node_matrix:n||rZ,u_lightpos:v,u_lightintensity:y.properties.get("intensity"),u_lightcolor:[T.r,T.g,T.b],u_camera_pos:_,u_opacity:l,u_baseTextureIsAlpha:0,u_alphaMask:+w,u_alphaCutoff:p.alphaCutoff,u_baseColorFactor:[h.r,h.g,h.b,h.a],u_emissiveFactor:[u[0],u[1],u[2],1],u_metallicFactor:c,u_roughnessFactor:d,u_baseColorTexture:t3.BaseColor,u_metallicRoughnessTexture:t3.MetallicRoughness,u_normalTexture:t3.Normal,u_occlusionTexture:t3.Occlusion,u_emissionTexture:t3.Emission,u_lutTexture:t3.LUT,u_color_mix:[M.r,M.g,M.b,E],u_aoIntensity:S,u_emissive_strength:f,u_occlusionTextureTransform:g||[0,0,0,0]}},rY=(e,i=rZ,r=rZ)=>({u_matrix:e,u_instance:i,u_node_matrix:r}),rJ={fillExtrusion:i=>({u_matrix:new e.bG(i),u_lightpos:new e.bI(i),u_lightintensity:new e.bJ(i),u_lightcolor:new e.bI(i),u_vertical_gradient:new e.bJ(i),u_opacity:new e.bJ(i),u_edge_radius:new e.bJ(i),u_width_scale:new e.bJ(i),u_ao:new e.bH(i),u_height_type:new e.bK(i),u_base_type:new e.bK(i),u_tile_id:new e.bI(i),u_zoom_transition:new e.bJ(i),u_inv_rot_matrix:new e.bG(i),u_merc_center:new e.bH(i),u_up_dir:new e.bI(i),u_height_lift:new e.bJ(i),u_flood_light_color:new e.bI(i),u_vertical_scale:new e.bJ(i),u_flood_light_intensity:new e.bJ(i),u_ground_shadow_factor:new e.bI(i)}),fillExtrusionDepth:i=>
303({u_matrix:new e.bG(i),u_edge_radius:new e.bJ(i),u_width_scale:new e.bJ(i),u_vertical_scale:new e.bJ(i),u_height_type:new e.bK(i),u_base_type:new e.bK(i)}),fillExtrusionPattern:i=>({u_matrix:new e.bG(i),u_lightpos:new e.bI(i),u_lightintensity:new e.bJ(i),u_lightcolor:new e.bI(i),u_vertical_gradient:new e.bJ(i),u_height_factor:new e.bJ(i),u_edge_radius:new e.bJ(i),u_width_scale:new e.bJ(i),u_ao:new e.bH(i),u_height_type:new e.bK(i),u_base_type:new e.bK(i),u_tile_id:new e.bI(i),u_zoom_transition:new e.bJ(i),u_inv_rot_matrix:new e.bG(i),u_merc_center:new e.bH(i),u_up_dir:new e.bI(i),u_height_lift:new e.bJ(i),u_image:new e.bK(i),u_texsize:new e.bH(i),u_pixel_coord_upper:new e.bH(i),u_pixel_coord_lower:new e.bH(i),u_tile_units_to_pixels:new e.bJ(i),u_opacity:new e.bJ(i)}),fillExtrusionGroundEffect:i=>({u_matrix:new e.bG(i),u_opacity:new e.bJ(i),u_ao_pass:new e.bJ(i),u_meter_to_tile:new e.bJ(i),u_ao:new e.bH(i),u_flood_light_intensity:new e.bJ(i),u_flood_light_color:new e.bI(i),u_attenuation:new e.bJ(i),u_edge_radius:new e.bJ(i),u_fb:new e.bK(i),u_fb_size:new e.bJ(i),u_dynamic_offset:new e.bJ(i)}),fill:i=>({u_matrix:new e.bG(i),u_emissive_strength:new e.bJ(i)}),fillPattern:i=>({u_matrix:new e.bG(i),u_emissive_strength:new e.bJ(i),u_image:new e.bK(i),u_texsize:new e.bH(i),u_pixel_coord_upper:new e.bH(i),u_pixel_coord_lower:new e.bH(i),u_tile_units_to_pixels:new e.bJ(i)}),fillOutline:i=>({u_matrix:new e.bG(i),u_emissive_strength:new e.bJ(i),u_world:new e.bH(i)}),fillOutlinePattern:i=>({u_matrix:new e.bG(i),u_emissive_strength:new e.bJ(i),u_world:new e.bH(i),u_image:new e.bK(i),u_texsize:new e.bH(i),u_pixel_coord_upper:new e.bH(i),u_pixel_coord_lower:new e.bH(i),u_tile_units_to_pixels:new e.bJ(i)}),circle:e.cN,collisionBox:i=>({u_matrix:new e.bG(i),u_camera_to_center_distance:new e.bJ(i),u_extrude_scale:new e.bH(i)}),collisionCircle:i=>({u_matrix:new e.bG(i),u_inv_matrix:new e.bG(i),u_camera_to_center_distance:new e.bJ(i),u_viewport_size:new e.bH(i)}),debug:i=>({u_color:new e.cu(i),u_matrix:new e.bG(i),u_overlay:new e.bK(i),u_overlay_scale:new e.bJ(i)}),clippingMask:i=>({u_matrix:new e.bG(i)}),heatmap:i=>({u_extrude_scale:new e.bJ(i),u_intensity:new e.bJ(i),u_matrix:new e.bG(i),u_inv_rot_matrix:new e.bG(i),u_merc_center:new e.bH(i),u_tile_id:new e.bI(i),u_zoom_transition:new e.bJ(i),u_up_dir:new e.bI(i)}),heatmapTexture:i=>({u_image:new e.bK(i),u_color_ramp:new e.bK(i),u_opacity:new e.bJ(i)}),hillshade:i=>({u_matrix:new e.bG(i),u_image:new e.bK(i),u_latrange:new e.bH(i),u_light:new e.bH(i),u_shadow:new e.cu(i),u_highlight:new e.cu(i),u_emissive_strength:new e.bJ(i),u_accent:new e.cu(i)}),hillshadePrepare:i=>({u_matrix:new e.bG(i),u_image:new e.bK(i),u_dimension:new e.bH(i),u_zoom:new e.bJ(i)}),line:e.cO,linePattern:e.cP,raster:i=>({u_matrix:new e.bG(i),u_normalize_matrix:new e.bG(i),u_globe_matrix:new e.bG(i),u_merc_matrix:new e.bG(i),u_grid_matrix:new e.cv(i),u_tl_parent:new e.bH(i),u_scale_parent:new e.bJ(i),u_fade_t:new e.bJ(i),u_opacity:new e.bJ(i),u_image0:new e.bK(i),u_image1:new e.bK(i),u_brightness_low:new e.bJ(i),u_brightness_high:new e.bJ(i),u_saturation_factor:new e.bJ(i),u_contrast_factor:new e.bJ(i),u_spin_weights:new e.bI(i),u_perspective_transform:new e.bH(i),u_raster_elevation:new e.bJ(i),u_zoom_transition:new e.bJ(i),u_merc_center:new e.bH(i),u_cutoff_params:new e.c7(i),u_colorization_mix:new e.c7(i),u_colorization_offset:new e.bJ(i),u_color_ramp:new e.bK(i),u_texture_offset:new e.bH(i),u_texture_res:new e.bH(i),u_emissive_strength:new e.bJ(i)}),rasterParticle:i=>({u_matrix:new e.bG(i),u_normalize_matrix:new e.bG(i),u_globe_matrix:new e.bG(i),u_merc_matrix:new e.bG(i),u_grid_matrix:new e.cv(i),u_tl_parent:new e.bH(i),u_scale_parent:new e.bJ(i),u_fade_t:new e.bJ(i),u_opacity:new e.bJ(i),u_image0:new e.bK(i),u_image1:new e.bK(i),u_raster_elevation:new e.bJ(i),u_zoom_transition:new e.bJ(i),u_merc_center:new e.bH(i),u_cutoff_params:new e.c7(i)}),rasterParticleTexture:i=>({u_texture:new e.bK(i),u_opacity:new e.bJ(i)}),rasterParticleDraw:i=>({u_particle_texture:new e.bK(i),u_particle_texture_side_len:new e.bJ(i),u_tile_offset:new e.bH(i),u_velocity:new e.bK(i),u_color_ramp:new e.bK(i),u_velocity_res:new e.bH(i),u_max_speed:new e.bJ(i),u_uv_offset:new e.bH(i),u_data_scale:new e.bH(i),u_data_offset:new e.bJ(i),u_particle_pos_scale:new e.bJ(i),u_particle_pos_offset:new e.bH(i)}),rasterParticleUpdate:i=>({u_particle_texture:new e.bK(i),u_particle_texture_side_len:new e.bJ(i),u_velocity:new e.bK(i),u_velocity_res:new e.bH(i),u_max_speed:new e.bJ(i),u_speed_factor:new e.bJ(i),u_reset_rate:new e.bJ(i),u_rand_seed:new e.bJ(i),u_uv_offset:new e.bH(i),u_data_scale:new e.bH(i),u_data_offset:new e.bJ(i),u_particle_pos_scale:new e.bJ(i),u_particle_pos_offset:new e.bH(i)}),symbol:i=>({u_is_size_zoom_constant:new e.bK(i),u_is_size_feature_constant:new e.bK(i),u_size_t:new e.bJ(i),u_size:new e.bJ(i),u_camera_to_center_distance:new e.bJ(i),u_rotate_symbol:new e.bK(i),u_aspect_ratio:new e.bJ(i),u_fade_change:new e.bJ(i),u_matrix:new e.bG(i),u_label_plane_matrix:new e.bG(i),u_coord_matrix:new e.bG(i),u_is_text:new e.bK(i),u_elevation_from_sea:new e.bK(i),u_pitch_with_map:new e.bK(i),u_texsize:new e.bH(i),u_texsize_icon:new e.bH(i),u_texture:new e.bK(i),u_texture_icon:new e.bK(i),u_gamma_scale:new e.bJ(i),u_device_pixel_ratio:new e.bJ(i),u_tile_id:new e.bI(i),u_zoom_transition:new e.bJ(i),u_inv_rot_matrix:new e.bG(i),u_merc_center:new e.bH(i),u_camera_forward:new e.bI(i),u_tile_matrix:new e.bG(i),u_up_vector:new e.bI(i),u_ecef_origin:new e.bI(i),u_is_halo:new e.bK(i),u_icon_transition:new e.bJ(i),u_color_adj_mat:new e.bG(i),u_scale_factor:new e.bJ(i)}),background:i=>({u_matrix:new e.bG(i),u_emissive_strength:new e.bJ(i),u_opacity:new e.bJ(i),u_color:new e.cu(i)}),backgroundPattern:i=>({u_matrix:new e.bG(i),u_emissive_strength:new e.bJ(i),u_opacity:new e.bJ(i),u_image:new e.bK(i),u_pattern_tl:new e.bH(i),u_pattern_br:new e.bH(i),u_texsize:new e.bH(i),u_pattern_size:new e.bH(i),u_pixel_coord_upper:new e.bH(i),u_pixel_coord_lower:new e.bH(i),u_pattern_units_to_pixels:new e.bH(i)}),terrainRaster:i=>({u_matrix:new e.bG(i),u_image0:new e.bK(i),u_skirt_height:new e.bJ(i),u_ground_shadow_factor:new e.bI(i)}),skybox:i=>({u_matrix:new e.bG(i),u_sun_direction:new e.bI(i),u_cubemap:new e.bK(i),u_opacity:new e.bJ(i),u_temporal_offset:new e.bJ(i)}),skyboxGradient:i=>({u_matrix:new e.bG(i),u_color_ramp:new e.bK(i),u_center_direction:new e.bI(i),u_radius:new e.bJ(i),u_opacity:new e.bJ(i),u_temporal_offset:new e.bJ(i)}),skyboxCapture:i=>({u_matrix_3f:new e.cv(i),u_sun_direction:new e.bI(i),u_sun_intensity:new e.bJ(i),u_color_tint_r:new e.c7(i),u_color_tint_m:new e.c7(i),u_luminance:new e.bJ(i)}),globeRaster:i=>({u_proj_matrix:new e.bG(i),u_globe_matrix:new e.bG(i),u_normalize_matrix:new e.bG(i),u_merc_matrix:new e.bG(i),u_zoom_transition:new e.bJ(i),u_merc_center:new e.bH(i),u_image0:new e.bK(i),u_grid_matrix:new e.cv(i),u_skirt_height:new e.bJ(i),u_far_z_cutoff:new e.bJ(i),u_frustum_tl:new e.bI(i),u_frustum_tr:new e.bI(i),u_frustum_br:new e.bI(i),u_frustum_bl:new e.bI(i),u_globe_pos:new e.bI(i),u_globe_radius:new e.bJ(i),u_viewport:new e.bH(i)}),globeAtmosphere:i=>({u_frustum_tl:new e.bI(i),u_frustum_tr:new e.bI(i),u_frustum_br:new e.bI(i),u_frustum_bl:new e.bI(i),u_horizon:new e.bJ(i),u_transition:new e.bJ(i),u_fadeout_range:new e.bJ(i),u_color:new e.c7(i),u_high_color:new e.c7(i),u_space_color:new e.c7(i),u_temporal_offset:new e.bJ(i),u_horizon_angle:new e.bJ(i)}),model:i=>({u_matrix:new e.bG(i),u_lighting_matrix:new e.bG(i),u_normal_matrix:new e.bG(i),u_node_matrix:new e.bG(i),u_lightpos:new e.bI(i),u_lightintensity:new e.bJ(i),u_lightcolor:new e.bI(i),u_camera_pos:new e.bI(i),u_opacity:new e.bJ(i),u_baseColorFactor:new e.c7(i),u_emissiveFactor:new e.c7(i),u_metallicFactor:new e.bJ(i),u_roughnessFactor:new e.bJ(i),u_baseTextureIsAlpha:new e.bK(i),u_alph
303aMask:new e.bK(i),u_alphaCutoff:new e.bJ(i),u_baseColorTexture:new e.bK(i),u_metallicRoughnessTexture:new e.bK(i),u_normalTexture:new e.bK(i),u_occlusionTexture:new e.bK(i),u_emissionTexture:new e.bK(i),u_lutTexture:new e.bK(i),u_color_mix:new e.c7(i),u_aoIntensity:new e.bJ(i),u_emissive_strength:new e.bJ(i),u_occlusionTextureTransform:new e.c7(i)}),modelDepth:i=>({u_matrix:new e.bG(i),u_instance:new e.bG(i),u_node_matrix:new e.bG(i)}),groundShadow:i=>({u_matrix:new e.bG(i),u_ground_shadow_factor:new e.bI(i)}),stars:i=>({u_matrix:new e.bG(i),u_up:new e.bI(i),u_right:new e.bI(i),u_intensity_multiplier:new e.bJ(i)}),snowParticle:i=>({u_modelview:new e.bG(i),u_projection:new e.bG(i),u_time:new e.bJ(i),u_cam_pos:new e.bI(i),u_velocityConeAperture:new e.bJ(i),u_velocity:new e.bJ(i),u_horizontalOscillationRadius:new e.bJ(i),u_horizontalOscillationRate:new e.bJ(i),u_boxSize:new e.bJ(i),u_billboardSize:new e.bJ(i),u_simpleShapeParameters:new e.bH(i),u_screenSize:new e.bH(i),u_thinningCenterPos:new e.bH(i),u_thinningShape:new e.bI(i),u_thinningAffectedRatio:new e.bJ(i),u_thinningParticleOffset:new e.bJ(i),u_particleColor:new e.c7(i),u_direction:new e.bI(i)}),rainParticle:i=>({u_modelview:new e.bG(i),u_projection:new e.bG(i),u_time:new e.bJ(i),u_cam_pos:new e.bI(i),u_texScreen:new e.bK(i),u_velocityConeAperture:new e.bJ(i),u_velocity:new e.bJ(i),u_boxSize:new e.bJ(i),u_rainDropletSize:new e.bH(i),u_distortionStrength:new e.bJ(i),u_rainDirection:new e.bI(i),u_color:new e.c7(i),u_screenSize:new e.bH(i),u_thinningCenterPos:new e.bH(i),u_thinningShape:new e.bI(i),u_thinningAffectedRatio:new e.bJ(i),u_thinningParticleOffset:new e.bJ(i),u_shapeDirectionalPower:new e.bJ(i),u_mode:new e.bJ(i)}),occlusion:i=>({u_matrix:new e.bG(i),u_anchorPos:new e.bI(i),u_screenSizePx:new e.bH(i),u_occluderSizePx:new e.bH(i),u_color:new e.c7(i)})};class rK{constructor(e,i,r,a){this.id=rK.uniqueIdxCounter,rK.uniqueIdxCounter++,this.context=e;let n=e.gl;this.buffer=n.createBuffer(),this.dynamicDraw=!!r,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||a||i.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){this.id=rK.uniqueIdxCounter,rK.uniqueIdxCounter++;let i=this.context.gl;this.context.unbindVAO(),this.bind(),i.bufferSubData(i.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}rK.uniqueIdxCounter=0;let rQ={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class r0{constructor(e,i,r,a,n,s){this.length=i.length,this.attributes=r,this.itemSize=i.bytesPerElement,this.dynamicDraw=a,this.instanceCount=s,this.context=e;let l=e.gl;this.buffer=l.createBuffer(),e.bindVertexBuffer.set(this.buffer),l.bufferData(l.ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?l.DYNAMIC_DRAW:l.STATIC_DRAW),this.dynamicDraw||n||i.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){let i=this.context.gl;this.bind(),i.bufferSubData(i.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,i){for(let r=0;r<this.attributes.length;r++){let a=i.attributes[this.attributes[r].name];void 0!==a&&e.enableVertexAttribArray(a)}}setVertexAttribPointers(e,i,r){for(let a=0;a<this.attributes.length;a++){let n=this.attributes[a],s=i.attributes[n.name];void 0!==s&&e.vertexAttribPointer(s,n.components,e[rQ[n.type]],!1,this.itemSize,n.offset+this.itemSize*(r||0))}}setVertexAttribDivisor(e,i,r){for(let a=0;a<this.attributes.length;a++){let n=i.attributes[this.attributes[a].name];void 0!==n&&this.instanceCount&&this.instanceCount>0&&e.vertexAttribDivisor(n,r)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class r1{constructor(e,i,r,a,n){this.context=e,this.width=i,this.height=r;let s=this.framebuffer=e.gl.createFramebuffer();a&&(this.colorAttachment=new rn(e,s)),n&&(this.depthAttachmentType=n,this.depthAttachment="renderbuffer"===n?new ro(e,s):new rs(e,s))}destroy(){let e=this.context.gl;if(this.colorAttachment){let i=this.colorAttachment.get();i&&e.deleteTexture(i)}if(this.depthAttachment&&this.depthAttachmentType){if("renderbuffer"===this.depthAttachmentType){let i=this.depthAttachment.get();i&&e.deleteRenderbuffer(i)}else{let i=this.depthAttachment.get();i&&e.deleteTexture(i)}}e.deleteFramebuffer(this.framebuffer)}}class r2{constructor(e,i){this.gl=e,this.clearColor=new iB(this),this.clearDepth=new iF(this),this.clearStencil=new iN(this),this.colorMask=new iV(this),this.depthMask=new iU(this),this.stencilMask=new ij(this),this.stencilFunc=new iG(this),this.stencilOp=new iq(this),this.stencilTest=new iW(this),this.depthRange=new i$(this),this.depthTest=new iH(this),this.depthFunc=new iZ(this),this.blend=new iX(this),this.blendFunc=new iY(this),this.blendColor=new iJ(this),this.blendEquation=new iK(this),this.cullFace=new iQ(this),this.cullFaceSide=new i0(this),this.frontFace=new i1(this),this.program=new i2(this),this.activeTexture=new i3(this),this.viewport=new i4(this),this.bindFramebuffer=new i5(this),this.bindRenderbuffer=new i6(this),this.bindTexture=new i8(this),this.bindVertexBuffer=new i9(this),this.bindElementBuffer=new i7(this),this.bindVertexArrayOES=new re(this),this.pixelStoreUnpack=new rt(this),this.pixelStoreUnpackPremultiplyAlpha=new ri(this),this.pixelStoreUnpackFlipY=new rr(this),this.options=i?{...i}:{},this.options.extTextureFilterAnisotropicForceOff||(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.extDebugRendererInfo=e.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=e.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=e.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=e.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=e.getExtension("EXT_color_buffer_half_float"),this.extTimerQuery=e.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),this.maxPointSize=e.getParameter(e.ALIASED_POINT_SIZE_RANGE)[1]}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(e,i,r){return new rK(this,e,i,r)}createVertexBuffer(e,i,r,a,n){return new r0(this,e,i,r,a,n)}createRenderbuffer(e,i,r){let a=this.gl,n=a.createRenderbuffer();return this.bindRenderbuffer.set(n),a.renderbufferStorage(a.RENDERBUFFER,e,i,r),this.bindRenderbuffer.set(null),n}createFramebuffer(e,i,r,a){return new r1(this,e,i,r,a)}clear({color:e,depth:i,stencil:r,colorMask:a}){let n=this.gl,s=0;e&&(s|=n.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set(a||[!0,!0,!0,!0])),void 0!==i&&(s|=n.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(i),this.depthMask.set(!0)),void 0!==r&&(s|=n.STENCIL_BUFFER_BIT,this.clearStencil.set(r),this.stencilMask.set(255)),n.clear(s)}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(i){e.bi(i.blendFunction,tZ.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(i.blendFunction),this.blendColor.set(i.blendColor),i.blendEquation?this.blendEquation.set(i.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(i.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}function r3(i,r,a,n,l,h,u){let c=i.context,d=c.gl,p=i.transform,f=i.getOrCreateProgram("collisionBox"),m=[],_=0,g=0;for(let s=0;s<n.length;s++){let c=n[s],y=r.getTile(c),x=y.getBucket(a);if(!x)continue;let v=function(e,i,r){if(i.projection.name===r.projection.name)return e.projMatrix;let a=r.clone();return a.setProjection(i.projection),tA(a,i.getProjection(),e)}(c,x,p),b=v;0===l[0]&&0===l[1]||(b=i.translatePosMatrix(v,y,l,h));let w=u?x.textCollisionBox:x.iconCollisionBox,T=x.collisionCircleArray;
303if(T.length>0){let i=e.a6.mat4.create(),r=b;e.a6.mat4.mul(i,x.placementInvProjMatrix,p.glCoordMatrix),e.a6.mat4.mul(i,i,x.placementViewportMatrix),m.push({circleArray:T,circleOffset:g,transform:r,invTransform:i,projection:x.getProjection()}),_+=T.length/4,g=_}w&&(i.terrain&&i.terrain.setupElevationDraw(y,f),f.draw(i,d.LINES,tX.disabled,tY.disabled,i.colorModeForRenderPass(),tJ.disabled,rz(b,p,y,x.getProjection()),a.id,w.layoutVertexBuffer,w.indexBuffer,w.segments,null,p.zoom,null,[w.collisionVertexBuffer,w.collisionVertexBufferExt]))}if(!u||!m.length)return;let y=i.getOrCreateProgram("collisionCircle"),x=new e.cQ;x.resize(4*_),x._trim();let v=0;for(let e of m)for(let i=0;i<e.circleArray.length/4;i++){let r=4*i,a=e.circleArray[r+0],n=e.circleArray[r+1],s=e.circleArray[r+2],l=e.circleArray[r+3];x.emplace(v++,a,n,s,l,0),x.emplace(v++,a,n,s,l,1),x.emplace(v++,a,n,s,l,2),x.emplace(v++,a,n,s,l,3)}(!s||s.length<2*_)&&(s=function(i){let r=2*i,a=new e.aP;a.resize(r),a._trim();for(let e=0;e<r;e++){let i=6*e;a.uint16[i+0]=4*e+0,a.uint16[i+1]=4*e+1,a.uint16[i+2]=4*e+2,a.uint16[i+3]=4*e+2,a.uint16[i+4]=4*e+3,a.uint16[i+5]=4*e+0}return a}(_));let b=c.createIndexBuffer(s,!0),w=c.createVertexBuffer(x,e.cR.members,!0);for(let r of m){let n={u_matrix:r.transform,u_inv_matrix:r.invTransform,u_camera_to_center_distance:p.getCameraToCenterDistance(r.projection),u_viewport_size:[p.width,p.height]};y.draw(i,d.TRIANGLES,tX.disabled,tY.disabled,i.colorModeForRenderPass(),tJ.disabled,n,a.id,w,b,e.b2.simpleSegment(0,2*r.circleOffset,r.circleArray.length,r.circleArray.length/2),null,p.zoom)}w.destroy(),b.destroy()}let r4=e.a6.mat4.create();function r5(i){let r=i._camera.getWorldToCamera(i.worldSize,1),a=e.a6.mat4.multiply([],r,i.globeMatrix);e.a6.mat4.invert(a,a);let n=[0,0,0],s=[0,1,0,0];return e.a6.vec4.transformMat4(s,s,a),n[0]=s[0],n[1]=s[1],n[2]=s[2],e.a6.vec3.normalize(n,n),n}function r6(i,r,a,n,s,l,h={}){let u=a.paint.get("icon-translate"),c=a.paint.get("text-translate"),d=a.paint.get("icon-translate-anchor"),p=a.paint.get("text-translate-anchor"),f=a.layout.get("icon-rotation-alignment"),m=a.layout.get("text-rotation-alignment"),_=a.layout.get("icon-pitch-alignment"),g=a.layout.get("text-pitch-alignment"),y=a.layout.get("icon-keep-upright"),x=a.layout.get("text-keep-upright"),v=a.paint.get("icon-color-saturation"),b=a.paint.get("icon-color-contrast"),w=a.paint.get("icon-color-brightness-min"),T=a.paint.get("icon-color-brightness-max"),S="sea"===a.layout.get("symbol-elevation-reference"),M=i.context,E=M.gl,A=i.transform,I="map"===f,C="map"===m,P="map"===_,L="map"===g,k=void 0!==a.layout.get("symbol-sort-key").constantOr(1),R=!1,z=i.depthModeForSublayer(0,tX.ReadOnly),D=[e.am(A.center.lng),e.at(A.center.lat)],O=a.layout.get("text-variable-anchor"),B="globe"===A.projection.name,F=[],N=[0,-1,0];for(let s of n){let n=r.getTile(s),l=n.getBucket(a);if(!l||"mercator"===l.projection.name&&B||l.fullyClipped)continue;let f="globe"===l.projection.name,m=f?e.a9(A.zoom):0,_=tI(s,l.getProjection(),A),g=A.calculatePixelsToTileUnitsMatrix(n),M=O&&l.hasTextData(),z=l.hasIconTextFit()&&M&&l.hasIconData(),V=l.getProjection().createInversionMatrix(A,s.canonical),U=e=>{A.depthOcclusionForSymbolsAndCircles&&(a.hasInitialOcclusionOpacityProperties||i.terrain)&&(e.push("DEPTH_D24"),e.push("DEPTH_OCCLUSION"))},j=()=>{let r=I&&"point"!==a.layout.get("symbol-placement"),h=[];U(h);let c=r||z,p=a.paint.get("icon-image-cross-fade").constantOr(0);i.terrainRenderModeElevated()&&P&&h.push("PITCH_WITH_MAP_TERRAIN"),f&&(h.push("PROJECTION_GLOBE_VIEW"),c&&h.push("PROJECTED_POS_ON_VIEWPORT")),p>0&&h.push("ICON_TRANSITION"),l.icon.zOffsetVertexBuffer&&h.push("Z_OFFSET"),0===v&&0===b&&0===w&&1===T||h.push("COLOR_ADJUSTMENT"),l.sdfIcons&&h.push("RENDER_SDF");let x=l.icon.programConfigurations.get(a.id),M=i.getOrCreateProgram("symbol",{config:x,defines:h}),C=n.imageAtlasTexture?n.imageAtlasTexture.size:[0,0],L=l.iconSizeData,k=e.bk(L,A.zoom),R=P||0!==A.pitch,O=td(_,n.tileID.canonical,P,I,A,l.getProjection(),g),F=tf(_,n.tileID.canonical,P,I,A,l.getProjection(),g),j=i.translatePosMatrix(F,n,u,d,!0),G=i.translatePosMatrix(_,n,u,d),q=c?r4:O,W=I&&!P&&!r,$=N;(B||A.mercatorFromTransition)&&!I&&($=r5(A));let H=f?$:N,Z=a.getColorAdjustmentMatrix(v,b,w,T),X=rW(L.kind,k,W,P,i,G,q,j,S,!1,C,[0,0],!0,s,m,D,
303V,H,l.getProjection(),Z,p),Y=n.imageAtlasTexture?n.imageAtlasTexture:null,J=1!==a.layout.get("icon-size").constantOr(0)||l.iconsNeedLinear,K=l.sdfIcons||i.options.rotating||i.options.zooming||J||R?E.LINEAR:E.NEAREST,Q=l.sdfIcons&&0!==a.paint.get("icon-halo-width").constantOr(1),ee=i.terrain&&P&&r?e.a6.mat4.invert(e.a6.mat4.create(),O):r4;if(r&&l.icon){let e=A.elevation,r=e?e.getAtTileOffsetFunc(s,A.center.lat,A.worldSize,l.getProjection()):null,a=tp(_,n.tileID.canonical,P,I,A,l.getProjection(),g);tg(l,_,i,!1,a,F,P,y,r,s)}return{program:M,buffers:l.icon,uniformValues:X,atlasTexture:Y,atlasTextureIcon:null,atlasInterpolation:K,atlasInterpolationIcon:null,isSDF:l.sdfIcons,hasHalo:Q,tile:n,labelPlaneMatrixInv:ee}},G=()=>{let r=C&&"point"!==a.layout.get("symbol-placement"),h=[],u=r||O||z;i.terrainRenderModeElevated()&&L&&h.push("PITCH_WITH_MAP_TERRAIN"),f&&(h.push("PROJECTION_GLOBE_VIEW"),u&&h.push("PROJECTED_POS_ON_VIEWPORT")),l.text.zOffsetVertexBuffer&&h.push("Z_OFFSET"),l.iconsInText&&h.push("RENDER_TEXT_AND_SYMBOL"),h.push("RENDER_SDF"),U(h);let d=l.text.programConfigurations.get(a.id),y=i.getOrCreateProgram("symbol",{config:d,defines:h}),v,b=[0,0],w=null,T=l.textSizeData;l.iconsInText&&(b=n.imageAtlasTexture?n.imageAtlasTexture.size:[0,0],w=n.imageAtlasTexture?n.imageAtlasTexture:null,v=L||0!==A.pitch||i.options.rotating||i.options.zooming||"composite"===T.kind||"camera"===T.kind?E.LINEAR:E.NEAREST);let M=n.glyphAtlasTexture?n.glyphAtlasTexture.size:[0,0],I=a.layout.get("text-size-scale-range"),P=e.ap(i.scaleFactor,I[0],I[1]),k=e.bk(T,A.zoom,P),R=td(_,n.tileID.canonical,L,C,A,l.getProjection(),g),F=tf(_,n.tileID.canonical,L,C,A,l.getProjection(),g),j=i.translatePosMatrix(F,n,c,p,!0),G=i.translatePosMatrix(_,n,c,p),q=u?r4:R,W=C&&!L&&!r,$=N;(B||A.mercatorFromTransition)&&!C&&($=r5(A));let H=rW(T.kind,k,W,L,i,G,q,j,S,!0,M,b,!0,s,m,D,V,f?$:N,l.getProjection(),null,null,P),Z=n.glyphAtlasTexture?n.glyphAtlasTexture:null,X=E.LINEAR,Y=0!==a.paint.get("text-halo-width").constantOr(1),J=i.terrain&&L&&r?e.a6.mat4.invert(e.a6.mat4.create(),R):r4;if(r&&l.text){let e=A.elevation,r=e?e.getAtTileOffsetFunc(s,A.center.lat,A.worldSize,l.getProjection()):null,a=tp(_,n.tileID.canonical,L,C,A,l.getProjection(),g);tg(l,_,i,!0,a,F,L,x,r,s)}return{program:y,buffers:l.text,uniformValues:H,atlasTexture:Z,atlasTextureIcon:w,atlasInterpolation:X,atlasInterpolationIcon:v,isSDF:!0,hasHalo:Y,tile:n,labelPlaneMatrixInv:J}},q=l.icon.segments.get().length,W=l.text.segments.get().length,$=q&&!h.onlyText?j():null,H=W&&!h.onlyIcons?G():null,Z=a.paint.get("icon-opacity").constantOr(1),X=a.paint.get("text-opacity").constantOr(1);if(k&&l.canOverlap){R=!0;let i=Z&&!h.onlyText?l.icon.segments.get():[],r=X&&!h.onlyIcons?l.text.segments.get():[];for(let r of i)F.push({segments:new e.b2([r]),sortKey:r.sortKey,state:$});for(let i of r)F.push({segments:new e.b2([i]),sortKey:i.sortKey,state:H})}else h.onlyText||F.push({segments:Z?l.icon.segments:new e.b2([]),sortKey:0,state:$}),h.onlyIcons||F.push({segments:X?l.text.segments:new e.b2([]),sortKey:0,state:H})}for(let e of(R&&F.sort((e,i)=>e.sortKey-i.sortKey),F)){let r=e.state;if(r){if(i.terrain?i.terrain.setupElevationDraw(r.tile,r.program,{useDepthForOcclusion:A.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:r.labelPlaneMatrixInv}):i.setupDepthForOcclusion(A.depthOcclusionForSymbolsAndCircles,r.program),M.activeTexture.set(E.TEXTURE0),r.atlasTexture&&r.atlasTexture.bind(r.atlasInterpolation,E.CLAMP_TO_EDGE,!0),r.atlasTextureIcon&&(M.activeTexture.set(E.TEXTURE1),r.atlasTextureIcon&&r.atlasTextureIcon.bind(r.atlasInterpolationIcon,E.CLAMP_TO_EDGE,!0)),i.uploadCommonLightUniforms(i.context,r.program),r.hasHalo){let n=r.uniformValues;n.u_is_halo=1,r8(r.buffers,e.segments,a,i,r.program,z,s,l,n,2),n.u_is_halo=0}else{if(r.isSDF){let n=r.uniformValues;r.hasHalo&&(n.u_is_halo=1,r8(r.buffers,e.segments,a,i,r.program,z,s,l,n,1)),n.u_is_halo=0}r8(r.buffers,e.segments,a,i,r.program,z,s,l,r.uniformValues,1)}}}}function r8(e,i,r,a,n,s,l,h,u,c){let d=[e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer,e.iconTransitioningVertexBuffer,e.globeExtVertexBuffer,e.zOffsetVertexBuffer];n.draw(a,a.context.gl.TRIANGLES,s,l,h,tJ.disabled,u,r.id,e.layoutVertexBuffer,e.indexBuffer,i,r.paint,a.transform.zoom,e.programConfigurations.get(r.id),d,c)}function r9(e,i,r,a,n,s,l){let h,u,c,d,p;
303let f=e.context.gl,m=r.paint.get("fill-pattern"),_=r.is3D(),g=_?e.stencilModeFor3D():tY.disabled,y=m&&m.constantOr(1);for(let x of(l?(u=y&&!r.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",h=f.LINES):(u=y?"fillPattern":"fill",h=f.TRIANGLES),a)){let a=i.getTile(x);if(y&&!a.patternsLoaded())continue;let v=a.getBucket(r);if(!v)continue;e.prepareDrawTile();let b=v.programConfigurations.get(r.id),w=e.isTileAffectedByFog(x),T=e.getOrCreateProgram(u,{config:b,overrideFog:w});y&&(e.context.activeTexture.set(f.TEXTURE0),a.imageAtlasTexture&&a.imageAtlasTexture.bind(f.LINEAR,f.CLAMP_TO_EDGE),b.updatePaintBuffers());let S=m.constantOr(null);if(S&&a.imageAtlas){let e=a.imageAtlas.patternPositions[S.toString()];e&&b.setConstantPatternPositions(e)}let M=e.translatePosMatrix(x.projMatrix,a,r.paint.get("fill-translate"),r.paint.get("fill-translate-anchor")),E=r.paint.get("fill-emissive-strength");if(l){d=v.indexBuffer2,p=v.segments2;let i=e.terrain&&e.terrain.renderingToTexture?e.terrain.drapeBufferSize:[f.drawingBufferWidth,f.drawingBufferHeight];c="fillOutlinePattern"===u&&y?rR(M,E,e,a,i):rk(M,E,i)}else d=v.indexBuffer,p=v.segments,c=y?rL(M,E,e,a):rP(M,E);e.uploadCommonUniforms(e.context,T,x.toUnwrapped()),T.draw(e,h,n,_?g:e.stencilModeForClipping(x),s,tJ.disabled,c,r.id,v.layoutVertexBuffer,d,p,r.paint,e.transform.zoom,b,void 0)}}function r7(i,r,a,n,s,l,h,u){let c;a.resetLayerRenderingStats(i);let d=i.context,p=d.gl,f=i.transform,m=a.paint.get("fill-extrusion-pattern"),_=m.constantOr(1),g=a.paint.get("fill-extrusion-opacity"),y=i.style.enable3dLights(),x=a.paint.get(y&&!_?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),v=[a.paint.get("fill-extrusion-ambient-occlusion-intensity"),x],b=a.layout.get("fill-extrusion-edge-radius"),w=b>0&&!a.paint.get("fill-extrusion-rounded-roof"),T=w?0:b,S="globe"===f.projection.name?e.c_():0,M="globe"===f.projection.name,E=M?e.a9(f.zoom):0,A=[e.am(f.center.lng),e.at(f.center.lat)],I=a.paint.get("fill-extrusion-flood-light-color").toRenderColor(a.lut).toArray01().slice(0,3),C=a.paint.get("fill-extrusion-flood-light-intensity"),P=a.paint.get("fill-extrusion-vertical-scale"),L=0!==a.paint.get("fill-extrusion-line-width").constantOr(1),k=a.paint.get("fill-extrusion-height-alignment"),R=a.paint.get("fill-extrusion-base-alignment"),z=t9(i,a.paint.get("fill-extrusion-cutoff-fade-range")),D=[];M&&D.push("PROJECTION_GLOBE_VIEW"),v[0]>0&&D.push("FAUX_AO"),w&&D.push("ZERO_ROOF_RADIUS"),u&&D.push("HAS_CENTROID"),C>0&&D.push("FLOOD_LIGHT"),z.shouldRenderCutoff&&D.push("RENDER_CUTOFF"),L&&D.push("RENDER_WALL_MODE");let O="shadow"===i.renderPass,B=i.shadowRenderer,F=O&&!!B;i.shadowRenderer&&(i.shadowRenderer.useNormalOffset=!0);let N=[0,0,0];if(B){let e=i.style.directionalLight,r=i.style.ambientLight;e&&r&&(N=io(i.style,e,r)),O||(D.push("RENDER_SHADOWS","DEPTH_TEXTURE"),B.useNormalOffset&&D.push("NORMAL_OFFSET")),c=D.concat(["SHADOWS_SINGLE_CASCADE"])}let V=F?"fillExtrusionDepth":_?"fillExtrusionPattern":"fillExtrusion",U=a.getLayerRenderingStats();for(let y of n){let n;let x=r.getTile(y),b=x.getBucket(a);if(!b||b.projection.name!==f.projection.name)continue;let w=!1;B&&(w=0===B.getMaxCascadeForTile(y.toUnwrapped()));let F=i.isTileAffectedByFog(y),j=b.programConfigurations.get(a.id),G=i.getOrCreateProgram(V,{config:j,defines:w?c:D,overrideFog:F});if(i.terrain&&i.terrain.setupElevationDraw(x,G,{useMeterToDem:!0}),!b.centroidVertexBuffer){let e=G.attributes.a_centroid_pos;void 0!==e&&p.vertexAttrib2f(e,0,0)}!O&&B&&B.setupShadows(x.tileID.toUnwrapped(),G,"vector-tile",x.tileID.overscaledZ),_&&(i.context.activeTexture.set(p.TEXTURE0),x.imageAtlasTexture&&x.imageAtlasTexture.bind(p.LINEAR,p.CLAMP_TO_EDGE),j.updatePaintBuffers());let q=m.constantOr(null);if(q&&x.imageAtlas){let e=x.imageAtlas.patternPositions[q.toString()];e&&j.setConstantPatternPositions(e)}let W=a.paint.get("fill-extrusion-vertical-gradient"),$=1/b.tileToMeter;if(O&&B){if(function(i,r,a){let n=a.transform,s=a.shadowRenderer;if(!s)return!0;let l=i.toUnwrapped(),h=n.tileSize*s._cascades[a.currentShadowCascade].scale,u=r.maxHeight;if(n.elevation){let e=n.elevation.getMinMaxForTile(i);e&&(u+=e.max)}let c=[...s.shadowDirection];c[2]=-c[2];let d=s.computeSimplifiedTileShadowVolume(l,u,h,c);if(!d)return!1;
303let p=[at,ai,ar,c,[c[0],0,c[2]],[0,c[1],c[2]]],f="globe"===n.projection.name,m=n.scaleZoom(h),_=e.bO.fromInvProjectionMatrix(n.invProjMatrix,n.worldSize,m,!f),g=s.getCurrentCascadeFrustum();return 0===_.intersectsPrecise(d.vertices,d.planes,p)||0===g.intersectsPrecise(d.vertices,d.planes,p)}(x.tileID,b,i))continue;n=rI(B.calculateShadowPassMatrixFromTile(x.tileID.toUnwrapped()),T,$,P,k,R)}else{let e=i.translatePosMatrix(y.expandedProjMatrix,x,a.paint.get("fill-extrusion-translate"),a.paint.get("fill-extrusion-translate-anchor")),r=f.projection.createInversionMatrix(f,y.canonical);n=_?rC(e,i,W,g,v,T,$,y,x,S,k,R,E,A,r,I,P):rA(e,i,W,g,v,T,$,y,S,k,R,E,A,r,I,P,C,N)}i.uploadCommonUniforms(d,G,y.toUnwrapped(),null,z);let H=b.segments;if("mercator"===f.projection.name&&!O&&!(H=b.getVisibleSegments(x.tileID,i.terrain,i.transform.getFrustum(0))).get().length)continue;if(U){if(O)for(let e of H.get())U.numRenderedVerticesInShadowPass+=e.primitiveLength;else for(let e of H.get())U.numRenderedVerticesInTransparentPass+=e.primitiveLength}let Z=[];(i.terrain||u)&&Z.push(b.centroidVertexBuffer),M&&Z.push(b.layoutVertexExtBuffer),L&&Z.push(b.wallVertexBuffer),G.draw(i,d.gl.TRIANGLES,s,l,h,tJ.backCCW,n,a.id,b.layoutVertexBuffer,b.indexBuffer,H,a.paint,i.transform.zoom,j,Z)}i.shadowRenderer&&(i.shadowRenderer.useNormalOffset=!1)}function ae(i,r,a,n,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b){let w=i.context,T=w.gl,S=i.transform,M=i.transform.zoom,E=[],A=t9(i,a.paint.get("fill-extrusion-cutoff-fade-range"));"clear"===d?(E.push("CLEAR_SUBPASS"),b&&(E.push("CLEAR_FROM_TEXTURE"),w.activeTexture.set(T.TEXTURE0),b.bind(T.LINEAR,T.CLAMP_TO_EDGE))):"sdf"===d&&E.push("SDF_SUBPASS"),x&&E.push("HAS_CENTROID"),A.shouldRenderCutoff&&E.push("RENDER_CUTOFF");let I=a.layout.get("fill-extrusion-edge-radius"),C=(e,r,n,d,v)=>{let T=r.programConfigurations.get(a.id),S=i.isTileAffectedByFog(e),C=i.getOrCreateProgram("fillExtrusionGroundEffect",{config:T,defines:E,overrideFog:S}),P={u_matrix:d,u_opacity:p,u_ao_pass:+!!c,u_meter_to_tile:v,u_ao:[f,m*v],u_flood_light_intensity:_,u_flood_light_color:g,u_attenuation:y,u_edge_radius:M>=17?0:I*v,u_fb:0,u_fb_size:b?b.size[0]:0,u_dynamic_offset:1},L=[];x&&L.push(r.hiddenByLandmarkVertexBuffer),i.uploadCommonUniforms(w,C,e.toUnwrapped(),null,A),C.draw(i,w.gl.TRIANGLES,s,l,h,u,P,a.id,r.vertexBuffer,r.indexBuffer,n,a.paint,M,T,L)};for(let s of n){let n=r.getTile(s),l=n.getBucket(a);if(!l||l.projection.name!==S.projection.name||!l.groundEffect||l.groundEffect&&!l.groundEffect.hasData())continue;let h=l.groundEffect,u=1/l.tileToMeter;{let e=i.translatePosMatrix(s.projMatrix,n,a.paint.get("fill-extrusion-translate"),a.paint.get("fill-extrusion-translate-anchor")),r=h.getDefaultSegment();C(s,h,r,e,u)}if(v)for(let l=0;l<4;l++){let h,c;let d=e.c$[l](s),p=r.getTile(d);if(!p)continue;let f=p.getBucket(a);if(!f||f.projection.name!==S.projection.name||!f.groundEffect||f.groundEffect&&!f.groundEffect.hasData())continue;let m=f.groundEffect;0===l?(h=[-e.ab,0,0],c=1):1===l?(h=[e.ab,0,0],c=0):2===l?(h=[0,-e.ab,0],c=3):(h=[0,e.ab,0],c=2);let _=m.regionSegments[c];if(!_)continue;let g=new Float32Array(16);e.a6.mat4.translate(g,s.projMatrix,h),C(s,m,_,i.translatePosMatrix(g,n,a.paint.get("fill-extrusion-translate"),a.paint.get("fill-extrusion-translate-anchor")),u)}}}let at=[1,0,0],ai=[0,1,0],ar=[0,0,1];function aa(i){return[i[0]*e.d4,i[1]*e.d4,i[2]*e.d4,0]}function an(i,r,a,n,s,l,h,u,c){let d,p,f,m,_,g,y,x;let v=n.getSource(),b=a.globeSharedBuffers;if(!b||(r&&(d=n.getTile(r)),v instanceof e.aD?(p=v.texture,f=e.cD(0,0,a.transform)):d&&r&&(p=d.texture,f=e.cD(r.canonical.z,r.canonical.x,a.transform)),!p||!f))return;i||(f=e.a6.mat4.scale(e.a6.mat4.create(),f,[1,-1,1]));let w=a.context,T=w.gl,S="nearest"===s.paint.get("raster-resampling")?T.NEAREST:T.LINEAR,M=a.colorModeForDrapableLayerRenderPass(l),E=h.defines;E.push("GLOBE_POLES");let A=new tX(T.LEQUAL,tX.ReadWrite,a.depthRangeFor3D),I=Float32Array.from(a.transform.expandedFarZProjMatrix),C=Float32Array.from(e.b6(e.cC(new e.bQ(0,0,0))));a.terrain&&a.terrain.prepareDrawTile(),w.activeTexture.set(T.TEXTURE0),p.bind(S,T.CLAMP_TO_EDGE),w.activeTexture.set(T.TEXTURE1),p.bind(S,T.CLAMP_TO_EDGE),p.useMipmap&&w.extTextureFilterAnisotropic&&a.transform.pitch>20&&T.texParameterf(T.TEXTURE_2D,w.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,w.extTextureFilterAnisotropicMax);let[P,L,k,R]=r?b.getPoleBuffers(r.canonical.z,!1):b.getPoleBuffers(0,!0),z=s.paint.get("raster-elevation");i?(m=P,a.renderDefaultNorthPole=0!==z):(m=L,a.renderDefaultSouthPole=0!==z);let D=aa(h.mix),O=(_=f,g=e.a9(a.transform.zoom),y=h.offset,x=h.range,rV(I,C,_,new Float32Array(16),new Float32Array(9),[0,0],g,[0,0],[0,0,0,0],1,{opacity:1,mix:0},s,[0,0],z,2,D,y,x,1,0,l)),B=a.getOrCreateProgram("raster",{defines:E});a.uploadCommonUniforms(w,B,null),B.draw(a,T.TRIANGLES,A,c,M,u,O,s.id,m,k,R)}var ao=e.d5([{name:"a_index",type:"Int16",components:1}]);class as{constructor(i,r,a,n){let s={width:a[0],height:a[1],data:null},l=i.gl;this.targetColorTexture=new e.T(i,s,l.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new e.T(i,s,l.RGBA8,{useMipmap:!1}
303),this.context=i,this.updateParticleTexture(r,n),this.lastInvalidatedAt=0}updateParticleTexture(i,r){if(this.particleTextureDimension===r.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());let a=this.context.gl,n=r.width*r.height;this.particleTexture0=new e.T(this.context,r,a.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new e.T(this.context,r,a.RGBA8,{premultiply:!1,useMipmap:!1});let s=new e.d6;s.reserve(n);for(let e=0;e<n;e++)s.emplaceBack(e);this.particleIndexBuffer=this.context.createVertexBuffer(s,ao.members,!0),this.particleSegment=e.b2.simpleSegment(0,0,this.particleIndexBuffer.length,0),this.particleTextureDimension=r.width}update(i){return!(this.lastInvalidatedAt<i&&(this.lastInvalidatedAt=e.q.now(),1))}destroy(){this.targetColorTexture.destroy(),this.backgroundColorTexture.destroy(),this.particleIndexBuffer.destroy(),this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleSegment.destroy()}}let al=new e.bA(1,0,0,1),ah=new e.bA(0,1,0,1),au=new e.bA(0,0,1,1),ac=new e.bA(1,0,1,1),ad=new e.bA(0,1,1,1);function ap(i,r,a,n,s,l,h){let u=i.context,c=i.transform,d=u.gl,p="globe"===c.projection.name,f=e.a6.mat4.clone(a.projMatrix);if(p&&e.a9(c.zoom)>0){let i=e.b5(a.canonical,c),r=e.d8(i);f=e.a6.mat4.multiply(new Float32Array(16),c.globeMatrix,r),e.a6.mat4.multiply(f,c.projMatrix,f)}let m=e.a6.mat4.create();m[12]+=2*s/(e.q.devicePixelRatio*c.width),m[13]+=2*l/(e.q.devicePixelRatio*c.height),e.a6.mat4.multiply(f,m,f);let _=i.getOrCreateProgram("debug",{defines:p?["PROJECTION_GLOBE_VIEW"]:[]}),g=r.getTileByID(a.key);i.terrain&&i.terrain.setupElevationDraw(g,_);let y=tX.disabled,x=tY.disabled,v=i.colorModeForRenderPass(),b="$debug";u.activeTexture.set(d.TEXTURE0),i.emptyTexture.bind(d.LINEAR,d.CLAMP_TO_EDGE),p?g._makeGlobeTileDebugBuffers(i.context,c):g._makeDebugTileBoundsBuffers(i.context,c.projection);let w=g._tileDebugBuffer||i.debugBuffer,T=g._tileDebugIndexBuffer||i.debugIndexBuffer,S=g._tileDebugSegments||i.debugSegments;if(_.draw(i,d.LINE_STRIP,y,x,v,tJ.disabled,rD(f,n),b,w,T,S,null,null,null,[g._globeTileDebugBorderBuffer]),h){let e=g.latestRawTileData,r=Math.floor((e&&e.byteLength||0)/1024),n=a.canonical.toString();a.overscaledZ!==a.canonical.z&&(n+=` => ${a.overscaledZ}`),n+=` ${g.state}`,function(e,i){e.initDebugOverlayCanvas();let r=e.debugOverlayCanvas,a=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(i,5,5),n.strokeText(i,5,5),e.debugOverlayTexture.update(r),e.debugOverlayTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE)}(i,n+=` ${r}kb`)}let M=512/Math.min(r.getTile(a).tileSize,512)*(a.overscaledZ/c.zoom)*.5,E=g._tileDebugTextBuffer||i.debugBuffer,A=g._tileDebugTextIndexBuffer||i.quadTriangleIndexBuffer,I=g._tileDebugTextSegments||i.debugSegments;_.draw(i,d.TRIANGLES,y,x,tZ.alphaBlended,tJ.disabled,rD(f,e.bA.transparent,M),b,E,A,I,null,null,null,[g._globeTileDebugTextBuffer])}function af(e,i,r,a){a_(e,0,i+r/2,e.transform.width,r,a)}function am(e,i,r,a){a_(e,i-r/2,0,r,e.transform.height,a)}function a_(i,r,a,n,s,l){let h=i.context,u=h.gl;u.enable(u.SCISSOR_TEST),u.scissor(r*e.q.devicePixelRatio,a*e.q.devicePixelRatio,n*e.q.devicePixelRatio,s*e.q.devicePixelRatio),h.clear({color:l}),u.disable(u.SCISSOR_TEST)}let{members:ag}=e.d5([{name:"a_pos_3f",components:3,type:"Float32"}]);function ay(e,i,r,a){e.emplaceBack(i,r,a)}class ax{constructor(i){this.vertexArray=new e.d9,this.indices=new e.aP,ay(this.vertexArray,-1,-1,1),ay(this.vertexArray,1,-1,1),ay(this.vertexArray,-1,1,1),ay(this.vertexArray,1,1,1),ay(this.vertexArray,-1,-1,-1),ay(this.vertexArray,1,-1,-1),ay(this.vertexArray,-1,1,-1),ay(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=i.createVertexBuffer(this.vertexArray,ag),this.indexBuffer=i.createIndexBuffer(this.indices),this.segment=e.b2.simpleSegment(0,0,36,12)}}function av(i,r,a,n,s,l){let h=i.context.gl,u=r.paint.get("sky-atmosphere-color"),c=r.paint.get("sky-atmosphere-halo-color"),d=r.paint.get("sky-atmosphere-sun-intensity"),p={u_matrix_3f:e.a6.mat3.fromMat4(e.a6.mat3.create(),n),u_sun_direction:s,u_sun_intensity:d,u_color_tint_r:[u.r,u.g,u.b,u.a],u_color_tint_m:[c.r,c.g,c.b,c.a],u_luminance:5e-5};h.framebufferTexture2D(h.FRAMEBUFFER,h.COLOR_ATTACHMENT0,h.TEXTURE_CUBE_MAP_POSITIVE_X+l,r.skyboxTexture,0),a.draw(i,h.TRIANGLES,tX.disabled,tY.disabled,tZ.unblended,tJ.frontCW,p,"skyboxCapture",r.skyboxGeometry.vertexBuffer,r.skyboxGeometry.indexBuffer,r.skyboxGeometry.segment)}let ab=e.d5([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class aw{constructor(i){let r=new e.da;r.emplaceBack(-1,1,1,0,0),r.emplaceBack(1,1,1,1,0),r.emplaceBack(1,-1,1,1,1),r.emplaceBack(-1,-1,1,0,1);let a=new e.aP;a.emplaceBack(0,1,2),a.emplaceBack(2,3,0),this.vertexBuffer=i.createVertexBuffer(r,ab.members),this.indexBuffer=i.createIndexBuffer(a),this.segments=e.b2.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}let aT=e.d5([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_size_scale",components:1},{type:"Float32",name:"a_fade_opacity",components:1}]);class aS{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class aM{constructor(i){this.colorModeAlphaBlendedWriteRGB=new tZ([1,771,1,771],e.bA.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new tZ([1,0,1,0],e.bA.transparent,[!1,!1,!1,!0]),this.params=new aS,this.updateNeeded=!0,i.tp.registerParameter(this.params,["Stars"],"starsCount",{min:100,max:16e3,step:1},()=>{this.updateNeeded=!0}),i.tp.registerParameter(this.params,["Stars"],"sizeMultiplier",{min:.01,max:2,step:.01}),i.tp.registerParameter(this.params,["Stars"],"sizeRange",{min:0,max:200,step:1},()=>{this.updateNeeded=!0}),i.tp.registerParameter(this.params,["Stars"],"intensityRange",{min:0,max:200,step:1},()=>{this.updateNeeded=!0})}update(i){let r=i.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new aw(r);let i=this.params.sizeRange,a=this.params.intensityRange,n=function(i){let r=e.dd(30),a=[];for(let n=0;n<i;++n){let i=2*Math.PI*r(),n=Math.acos(1-2*r())-.5*Math.PI;a.push(e.a6.vec3.fromValues(Math.cos(n)*Math.cos(i),Math.cos(n)*Math.sin(i),Math.sin(n)))}return a}(this.params.starsCount),s=e.dd(300),l=new e.db,h=new e.aP,u=0;for(let r=0;r<n.length;++r){let c=e.a6.vec3.scale([],n[r],200),d=Math.max(0,1+.01*i*(+s()-.5)),p=Math.max(0,1+.01*a*(+s()-.5));l.emplaceBack(c[0],c[1],c[2],-1,-1,d,p),l.emplaceBack(c[0],c[1],c[2],1,-1,d,p),l.emplaceBack(c[0],c[1],c[2],1,1,d,p),l.emplaceBack(c[0],c[1],c[2],-1,1,d,p),h.emplaceBack(u+0,u+1,u+2),h.emplaceBack(u+0,u+2,u+3),u+=4}this.starsVx=r.createVertexBuffer(l,aT.members),this.starsIdx=r.createIndexBuffer(h),this.starsSegments=e.b2.simpleSegment(0,0,l.length,h.length)}}destroy(){this.atmosphereBuffer&&this.atmosphereBuffer.destroy(),this.starsVx&&this.starsVx.destroy(),this.starsIdx&&this.starsIdx.destroy()}drawAtmosphereGlow(i,r){let a=i.context,n=a.gl,s=i.transform,l=new tX(n.LEQUAL,tX.ReadOnly,[0,1]),h=e.a9(s.zoom),u=i.style.getLut(r.scope),c=r.properties.get("color").toRenderColor(u).toArray01(),d=r.properties.get("high-color").toRenderColor(u).toArray01(),p=r.properties.get("space-color").toRenderColor(u).toArray01PremultipliedAlpha(),f=e.dc(r.properties.get("horizon-blend"),0,1,5e-4,.25),m=e.cx(i,a,s)&&5e-4===f?s.worldSize/(2*Math.PI*1.025)-1:s.globeRadius,_=i.frameCounter/1e3%1,g=e.a6.vec3.length(s.globeCenterInViewSpace),y=Math.acos(Math.sqrt(Math.pow(g,2)-Math.pow(m,2))/g),x=e=>{let r,u,m;let g="globe"===s.projection.name?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];
303e&&g.push("ALPHA_PASS");let x=i.getOrCreateProgram("globeAtmosphere",{defines:g}),v=(r=s.frustumCorners.TL,u=s.frustumCorners.TR,m=s.frustumCorners.BR,{u_frustum_tl:r,u_frustum_tr:u,u_frustum_br:m,u_frustum_bl:s.frustumCorners.BL,u_horizon:s.frustumCorners.horizon,u_transition:h,u_fadeout_range:f,u_color:c,u_high_color:d,u_space_color:p,u_temporal_offset:_,u_horizon_angle:y});i.uploadCommonUniforms(a,x);let b=this.atmosphereBuffer;b&&x.draw(i,n.TRIANGLES,l,tY.disabled,e?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,tJ.backCW,v,e?"atmosphere_glow_alpha":"atmosphere_glow",b.vertexBuffer,b.indexBuffer,b.segments)};x(!1),x(!0)}drawStars(i,r){let a=e.ap(r.properties.get("star-intensity"),0,1);if(0===a)return;let n=i.context,s=n.gl,l=i.transform,h=i.getOrCreateProgram("stars"),u=e.a6.quat.identity([]);e.a6.quat.rotateX(u,u,-l._pitch),e.a6.quat.rotateZ(u,u,-l.angle),e.a6.quat.rotateX(u,u,e.bC(l._center.lat)),e.a6.quat.rotateY(u,u,-e.bC(l._center.lng));let c=e.a6.mat4.fromQuat(new Float32Array(16),u),d=e.a6.mat4.multiply([],l.starsProjMatrix,c),p=e.a6.mat3.fromMat4([],c),f=e.a6.mat3.invert([],p),m=[0,1,0];e.a6.vec3.transformMat3(m,m,f),e.a6.vec3.scale(m,m,this.params.sizeMultiplier);let _=[1,0,0];e.a6.vec3.transformMat3(_,_,f),e.a6.vec3.scale(_,_,this.params.sizeMultiplier);let g={u_matrix:Float32Array.from(d),u_up:m,u_right:_,u_intensity_multiplier:a};i.uploadCommonUniforms(n,h),this.starsVx&&this.starsIdx&&h.draw(i,s.TRIANGLES,tX.disabled,tY.disabled,this.colorModeAlphaBlendedWriteRGB,tJ.disabled,g,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}function aE(i,r){let a=[...i],n=r.cameraWorldSizeForFog/r.worldSize,s=e.a6.mat4.identity([]);return e.a6.mat4.scale(s,s,[n,n,1]),e.a6.mat4.multiply(a,s,a),e.a6.mat4.multiply(a,r.worldToFogMatrix,a),a}function aA(i,r,a,n,s){let l=a.material,h=n.context,{baseColorTexture:u,metallicRoughnessTexture:c}=l.pbrMetallicRoughness,{normalTexture:d,occlusionTexture:p,emissionTexture:f}=l;function m(e,r,a){if(e&&(i.push(r),h.activeTexture.set(h.gl.TEXTURE0+a),e.gfxTexture)){let{minFilter:i,magFilter:r,wrapS:a,wrapT:n}=e.sampler;e.gfxTexture.bindExtraParam(i,r,a,n)}}m(u,"HAS_TEXTURE_u_baseColorTexture",t3.BaseColor),m(c,"HAS_TEXTURE_u_metallicRoughnessTexture",t3.MetallicRoughness),m(d,"HAS_TEXTURE_u_normalTexture",t3.Normal),m(p,"HAS_TEXTURE_u_occlusionTexture",t3.Occlusion),m(f,"HAS_TEXTURE_u_emissionTexture",t3.Emission),s&&(s.texture||(s.texture=new e.df(n.context,s.image,[s.image.height,s.image.height,s.image.height],h.gl.RGBA8)),h.activeTexture.set(h.gl.TEXTURE0+t3.LUT),s.texture&&s.texture.bind(h.gl.LINEAR,h.gl.CLAMP_TO_EDGE),i.push("APPLY_LUT_ON_GPU")),a.texcoordBuffer&&(i.push("HAS_ATTRIBUTE_a_uv_2f"),r.push(a.texcoordBuffer)),a.colorBuffer&&(i.push(12===a.colorBuffer.itemSize?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),r.push(a.colorBuffer)),a.normalBuffer&&(i.push("HAS_ATTRIBUTE_a_normal_3f"),r.push(a.normalBuffer)),a.pbrBuffer&&(i.push("HAS_ATTRIBUTE_a_pbr"),i.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),r.push(a.pbrBuffer)),"OPAQUE"!==l.alphaMode&&"MASK"!==l.alphaMode||i.push("UNPREMULT_TEXTURE_IN_SHADER"),l.defined||i.push("DIFFUSE_SHADED"),i.push("USE_STANDARD_DERIVATIVES");let _=n.shadowRenderer;_&&(i.push("RENDER_SHADOWS","DEPTH_TEXTURE"),_.useNormalOffset&&i.push("NORMAL_OFFSET"))}function aI(i,r,a,n,s,l){let h;let u=a.paint.get("model-opacity"),c=r.context,d=new tX(r.context.gl.LEQUAL,tX.ReadWrite,r.depthRangeFor3D),p=r.transform,f=i.mesh,m=f.material,_=m.pbrMetallicRoughness,g=r.style.fog;h="pixels"===r.transform.projection.zAxisUnit?[...i.nodeModelMatrix]:e.a6.mat4.multiply([],n.zScaleMatrix,i.nodeModelMatrix),e.a6.mat4.multiply(h,n.negCameraPosMatrix,h);let y=e.a6.mat4.invert([],h);e.a6.mat4.transpose(y,y);let x=a.paint.get("model-emissive-strength").constantOr(0),v=rX(new Float32Array(i.worldViewProjection),new Float32Array(h),new Float32Array(y),null,r,u,_.baseColorFactor.toRenderColor(null),m.emissiveFactor,_.metallicFactor,_.roughnessFactor,m,x,a),b={defines:[]},w=[],T=r.shadowRenderer;T&&(T.useNormalOffset=!1),aA(b.defines,w,f,r,a.lut);let S=null;if(g){let e=aE(i.nodeModelMatrix,r.transform);if(S=new Float32Array(e),"globe"!==p.projection.name){let i=f.aabb.min,r=f.aabb.max,[a,n]=g.getOpacityForBounds(e,i[0],i[1],r[0],r[1]);b.overrideFog=a>=.05||n>=.05}}let M=t9(r,a.paint.get("model-cutoff-fade-range"));M.shouldRenderCutoff&&b.defines.push("RENDER_CUTOFF");let E=r.getOrCreateProgram("model",b);r.uploadCommonUniforms(c,E,null,S,M),"shadow"!==r.renderPass&&T&&T.setupShadowsFromMatr
303ix(i.nodeModelMatrix,E),E.draw(r,c.gl.TRIANGLES,d,s,l,f.material.doubleSided?tJ.disabled:tJ.backCCW,v,a.id,f.vertexBuffer,f.indexBuffer,f.segments,a.paint,r.transform.zoom,void 0,w)}function aC(e,i,r,a){let n=r.shadowRenderer;if(!n)return;let s=n.getShadowPassDepthMode(),l=n.getShadowPassColorMode(),h=rY(n.calculateShadowPassMatrixFromMatrix(i));r.getOrCreateProgram("modelDepth",{defines:r._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(r,r.context.gl.TRIANGLES,s,tY.disabled,l,tJ.backCCW,h,a.id,e.vertexBuffer,e.indexBuffer,e.segments,a.paint,r.transform.zoom,void 0,void 0)}let aP={shadowUniformsInitialized:!1,useSingleShadowCascade:!1,tileMatrix:new Float64Array(16),shadowTileMatrix:new Float32Array(16),aabb:new e.ca([0,0,0],[e.ab,e.ab,0])},aL=[1,-1,1];class ak{}class aR{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(i,r,a){{let e=this._storage.get(r.id);if(e)return e.lastUsedFrameIdx=i,e.buf}let n=a.gl,s=n.getBufferParameter(n.ELEMENT_ARRAY_BUFFER,n.BUFFER_SIZE),l=new ArrayBuffer(s),h=new Int16Array(l);n.getBufferSubData(n.ELEMENT_ARRAY_BUFFER,0,new Int16Array(l));let u=new e.dk;for(let e=0;e<s/2;e+=3){let i=h[e],r=h[e+1],a=h[e+2];u.emplaceBack(i,r),u.emplaceBack(r,a),u.emplaceBack(a,i)}let c=a.bindVertexArrayOES.current,d=new ak;return d.buf=new rK(a,u),d.lastUsedFrameIdx=i,this._storage.set(r.id,d),a.bindVertexArrayOES.set(c),d.buf}update(e){for(let[i,r]of this._storage)e-r.lastUsedFrameIdx>30&&(r.buf.destroy(),this._storage.delete(i))}destroy(){for(let[e,i]of this._storage)i.buf.destroy(),this._storage.delete(e)}}class az{constructor(e){this.occluderSize=30,this.depthOffset=-1e-4,e.registerParameter(this,["Occlusion"],"occluderSize",{min:1,max:100,step:1}),e.registerParameter(this,["Occlusion"],"depthOffset",{min:-.05,max:0,step:1e-5})}}class aD{registerParameter(){}registerButton(){}registerBinding(){}refreshUI(){}}let aO={symbol:function(i,r,a,n,s){if("translucent"!==i.renderPass)return;let l=tY.disabled,h=i.colorModeForRenderPass(),u=a.layout.get("text-variable-anchor"),c=a.layout.get("text-size-scale-range"),d=e.ap(i.scaleFactor,c[0],c[1]);u&&function(i,r,a,n,s,l,h,u){let c=r.transform,d="map"===s,p="map"===l;for(let r of i){let i=n.getTile(r),s=i.getBucket(a);if(!s||!s.text||!s.text.segments.get().length)continue;let l=e.bk(s.textSizeData,c.zoom,u),f=tI(r,s.getProjection(),c),m=c.calculatePixelsToTileUnitsMatrix(i),_=td(f,i.tileID.canonical,p,d,c,s.getProjection(),m),g=s.hasIconTextFit()&&s.hasIconData();if(l){let a=Math.pow(2,c.zoom-i.tileID.overscaledZ);!function(i,r,a,n,s,l,h,u,c,d,p){let f=i.text.placedSymbolArray,m=i.text.dynamicLayoutVertexArray,_=i.icon.dynamicLayoutVertexArray,g={},y=i.getProjection(),x=tI(u,y,l),v=l.elevation,b=y.upVectorScale(u.canonical,l.center.lat,l.worldSize).metersToTile;m.clear();for(let _=0;_<f.length;_++){let w=f.get(_),{tileAnchorX:T,tileAnchorY:S,numGlyphs:M}=w,E=w.hidden||!w.crossTileID||i.allowVerticalPlacement&&!w.placedOrientation?null:n[w.crossTileID];if(E){let n=0,f=0,_=0;if(v){let e=v?v.getAtTileOffset(u,T,S):0,[i,r,a]=y.upVector(u.canonical,T,S);n=e*i*b,f=e*r*b,_=e*a*b}let[A,I,C,P]=tm(w.projectedAnchorX+n,w.projectedAnchorY+f,w.projectedAnchorZ+_,a?x:h),L=t_(l.getCameraToCenterDistance(y),P),k=s.evaluateSizeForFeature(i.textSizeData,d,w)*L/e.br;a&&(k*=i.tilePixelRatio/c);let R=function({width:i,height:r,anchor:a,textOffset:n,textScale:s},l){let{horizontalAlign:h,verticalAlign:u}=e.by(a),c=e.bx(a,n);return new e.P((-(h-.5)*i/s+c[0])*l,(-(u-.5)*r/s+c[1])*l)}(E,k);a?({x:A,y:I,z:C}=y.projectTilePoint(T+R.x,S+R.y,u.canonical),[A,I,C]=tm(A+n,I+f,C+_,h)):(r&&R._rotate(-l.angle),A+=R.x,I+=R.y,C=0);let z=i.allowVerticalPlacement&&w.placedOrientation===e.bl.vertical?Math.PI/2:0;for(let i=0;i<M;i++)e.bo(m,A,I,C,z);p&&w.associatedIconIndex>=0&&(g[w.associatedIconIndex]={x:A,y:I,z:C,angle:z})}else tS(M,m)}if(p){_.clear();let r=i.icon.placedSymbolArray;for(let i=0;i<r.length;i++){let a=r.get(i),{numGlyphs:n}=a,s=g[i];if(a.hidden||!s)tS(n,_);else{let{x:i,y:r,z:a,angle:l}=s;for(let s=0;s<n;s++)e.bo(_,i,r,a,l)}}i.icon.dynamicLayoutVertexBuffer.updateData(_)}i.text.dynamicLayoutVertexBuffer.updateData(m)}(s,d,p,h,e.cS,c,_,r,a,l,g)}}}(n,i,a,r,a.layout.get("text-rotation-alignment"),a.layout.get("text-pitch-alignment"),s,d);let p=0!==a.paint.get("icon-opacity").constantOr(1),f=0!==a.paint.get("text-opacity").constantOr(1);void 0!==a.layout.get("symbol-sort-key").constantOr(1)&&(p||f)?r6(i,r,a,n,l,h):(p&&r6(i,r,a,n,l,h,{onlyIcons:!0}),f&&r6(i,r,a,n,l,h,{onlyText:!0})),r.map.showCollisionBoxes&&(r3(i,r,a,n,a.paint.get("text-translate"),a.paint.get("text-translate-anchor"),!0),r3(i,r,a,n,a.paint.get("icon-translate"),a.paint.get("icon-translate-anchor"),!1))},circle:function(i,r,a,n){if("translucent"!==i.renderPass)return;let s=a.paint.get("circle-opacity"),l=a.paint.get("circle-stroke-width"),h=a.paint.get("circle-stroke-opacity"),u=void 0!==a.layout.get("
303circle-sort-key").constantOr(1),c=a.paint.get("circle-emissive-strength");if(0===s.constantOr(1)&&(0===l.constantOr(1)||0===h.constantOr(1)))return;let d=i.context,p=d.gl,f=i.transform,m=i.depthModeForSublayer(0,tX.ReadOnly),_=tY.disabled,g=i.colorModeForDrapableLayerRenderPass(c),y="globe"===f.projection.name,x=[e.am(f.center.lng),e.at(f.center.lat)],v=[];for(let s=0;s<n.length;s++){let l=n[s],h=r.getTile(l),c=h.getBucket(a);if(!c||c.projection.name!==f.projection.name)continue;let d=c.programConfigurations.get(a.id),p=e.cT(a),m=i.isTileAffectedByFog(l);y&&p.push("PROJECTION_GLOBE_VIEW"),p.push("DEPTH_D24"),i.terrain&&f.depthOcclusionForSymbolsAndCircles&&p.push("DEPTH_OCCLUSION");let _=i.getOrCreateProgram("circle",{config:d,defines:p,overrideFog:m}),g=c.layoutVertexBuffer,b=c.globeExtVertexBuffer,w=c.indexBuffer,T=f.projection.createInversionMatrix(f,l.canonical),S={programConfiguration:d,program:_,layoutVertexBuffer:g,globeExtVertexBuffer:b,indexBuffer:w,uniformValues:e.cU(i,l,h,T,x,a),tile:h};if(u)for(let i of c.segments.get())v.push({segments:new e.b2([i]),sortKey:i.sortKey,state:S});else v.push({segments:c.segments,sortKey:0,state:S})}u&&v.sort((e,i)=>e.sortKey-i.sortKey);let b={useDepthForOcclusion:f.depthOcclusionForSymbolsAndCircles};for(let e of v){let{programConfiguration:r,program:n,layoutVertexBuffer:s,globeExtVertexBuffer:l,indexBuffer:h,uniformValues:u,tile:c}=e.state,y=e.segments;i.terrain&&i.terrain.setupElevationDraw(c,n,b),i.uploadCommonUniforms(d,n,c.tileID.toUnwrapped()),n.draw(i,p.TRIANGLES,m,_,g,tJ.disabled,u,a.id,s,h,y,a.paint,f.zoom,r,[l])}},heatmap:function(i,r,a,n){if(0!==a.paint.get("heatmap-opacity")){if("offscreen"===i.renderPass){let s=i.context,l=s.gl,h=tY.disabled,u=new tZ([l.ONE,l.ONE,l.ONE,l.ONE],e.bA.transparent,[!0,!0,!0,!0]);(function(e,i,r,a){let n=e.gl,s=i.width*a,l=i.height*a;e.activeTexture.set(n.TEXTURE1),e.viewport.set([0,0,s,l]);let h=r.heatmapFbo;if(!h||h&&(h.width!==s||h.height!==l)){h&&h.destroy();let i=n.createTexture();n.bindTexture(n.TEXTURE_2D,i),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.L
303INEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),h=r.heatmapFbo=e.createFramebuffer(s,l,!0,null),function(e,i,r,a,n,s){let l=e.gl;l.texImage2D(l.TEXTURE_2D,0,e.extRenderToTextureHalfFloat?l.RGBA16F:l.RGBA,n,s,0,l.RGBA,e.extRenderToTextureHalfFloat?l.HALF_FLOAT:l.UNSIGNED_BYTE,null),a.colorAttachment.set(r)}(e,0,i,h,s,l)}else n.bindTexture(n.TEXTURE_2D,h.colorAttachment.get()),e.bindFramebuffer.set(h.framebuffer)})(s,i,a,"globe"===i.transform.projection.name?.5:.25),s.clear({color:e.bA.transparent});let c=i.transform,d="globe"===c.projection.name,p=d?["PROJECTION_GLOBE_VIEW"]:[],f=d?tJ.frontCCW:tJ.disabled,m=[e.am(c.center.lng),e.at(c.center.lat)];for(let e=0;e<n.length;e++){let _=n[e];if(r.hasRenderableParent(_))continue;let g=r.getTile(_),y=g.getBucket(a);if(!y||y.projection.name!==c.projection.name)continue;let x=i.isTileAffectedByFog(_),v=y.programConfigurations.get(a.id),b=i.getOrCreateProgram("heatmap",{config:v,defines:p,overrideFog:x}),{zoom:w}=i.transform;i.terrain&&i.terrain.setupElevationDraw(g,b),i.uploadCommonUniforms(s,b,_.toUnwrapped());let T=c.projection.createInversionMatrix(c,_.canonical);b.draw(i,l.TRIANGLES,tX.disabled,h,u,f,rB(i,_,g,T,m,w,a.paint.get("heatmap-intensity")),a.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,a.paint,i.transform.zoom,v,d?[y.globeExtVertexBuffer]:null)}s.viewport.set([0,0,i.width,i.height])}else"translucent"===i.renderPass&&(i.context.setColorMode(i.colorModeForRenderPass()),function(i,r){let a=i.context,n=a.gl,s=r.heatmapFbo;if(!s)return;a.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,s.colorAttachment.get()),a.activeTexture.set(n.TEXTURE1);let l=r.colorRampTexture;l||(l=r.colorRampTexture=new e.T(a,r.colorRamp,n.RGBA8)),l.bind(n.LINEAR,n.CLAMP_TO_EDGE),i.getOrCreateProgram("heatmapTexture").draw(i,n.TRIANGLES,tX.disabled,tY.disabled,i.colorModeForRenderPass(),tJ.disabled,{u_image:0,u_color_ramp:1,u_opacity:r.paint.get("heatmap-opacity")},r.id,i.viewportBuffer,i.quadTriangleIndexBuffer,i.viewportSegments,r.paint,i.transform.zoom)}(i,a))}},line:function(i,r,a,n){let s;if("translucent"!==i.renderPass)return;let l=a.paint.get("line-opacity"),h=a.paint.get("line-width");if(0===l.constantOr(1)||0===h.constantOr(1))return;let u=a.paint.get("line-emissive-strength"),c=a.paint.get("line-occlusion-opacity"),d="sea"===a.layout.get("line-elevation-reference"),p=i.context,f=p.gl,m=!a.isDraped();if(m&&"globe"===i.transform.projection.name)return;let _=a.layout.get("line-cross-slope"),g=m?new tX(i.depthOcclusion?f.GREATER:f.LEQUAL,tX.ReadOnly,i.depthRangeFor3D):i.depthModeForSublayer(0,tX.ReadOnly),y=i.colorModeForDrapableLayerRenderPass(u),x=i.terrain&&i.terrain.renderingToTexture,v=x?1:e.q.devicePixelRatio,b=a.paint.get("line-dasharray"),w=b.constantOr(1),T=a.layout.get("line-cap"),S=b.constantOr(null),M=T.constantOr(null),E=a.paint.get("line-pattern"),A=E.constantOr(1),I=E.constantOr(null),C=a.paint.get("line-opacity").constantOr(1),P=!A&&1!==C||i.depthOcclusion&&c>0&&c<1,L=a.paint.get("line-gradient"),k=A?"linePattern":"line",R=e.cV(a);if(x&&i.terrain&&i.terrain.clipOrMaskOverlapStencilType()&&(P=!1),0!==c&&i.depthOcclusion){let i=a.paint._values["line-opacity"];i&&i.value&&"constant"===i.value.kind?s=i.value:e.w(`Occlusion opacity for layer ${a.id} is supported only when line-opacity isn't data-driven.`)}if(m&&(i.forceTerrainMode=!0),!m&&0!==c&&i.terrain&&!x)return void e.w(`Occlusion opacity for layer ${a.id} is supported on terrain only if the layer has line-z-offset enabled.`);let z=P&&m?i.stencilModeFor3D():tY.disabled;for(let l of(m&&(R.push("ELEVATED"),void 0!==_&&R.push(_<1?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),d&&R.push("ELEVATION_REFERENCE_SEA")),n)){let n=r.getTile(l);if(A&&!n.patternsLoaded())continue;let h=n.getBucket(a);if(!h)continue;i.prepareDrawTile();let u=h.programConfigurations.get(a.id),_=i.isTileAffectedByFog(l),b=i.getOrCreateProgram(k,{config:u,defines:R,overrideFog:_,overrideRtt:!m&&void 0});if(I&&n.imageAtlas){let e=n.imageAtlas.patternPositions[I.toString()];e&&u.setConstantPatternPositions(e)}if(!A&&S&&M&&n.lineAtlas){let e=n.lineAtlas.getDash(S,M);e&&u.setConstantPatternPositions(e)}let[T,E]=a.paint.get("line-trim-offset");("round"===M||"square"===M)&&T!==E&&(0===T&&(T-=1),1===E&&(E+=1));let D=x?l.projMatrix:null,O=A?e.cW(i,n,a,D,v,[T,E]):e.cX(i,n,a,D,h.lineClipsArray.length,v,[T,E]);if(L){let n=h.gradients[a.id],s=n.texture;if(a.gradientVersion!==n.version){let u=256;if(a.stepInterpolant){let a=r.getSource().maxzoom,n=l.canonical.z===a?Math.
303ceil(1<<i.transform.maxZoom-l.canonical.z):1;u=e.ap(e.cY(h.maxLineLength/e.ab*1024*n),256,p.maxTextureSize)}n.gradient=e.cZ({expression:a.gradientExpression(),evaluationKey:"lineProgress",resolution:u,image:n.gradient||void 0,clips:h.lineClipsArray}),n.texture?n.texture.update(n.gradient):n.texture=new e.T(p,n.gradient,f.RGBA8),n.version=a.gradientVersion,s=n.texture}p.activeTexture.set(f.TEXTURE1),s.bind(a.stepInterpolant?f.NEAREST:f.LINEAR,f.CLAMP_TO_EDGE)}w&&(p.activeTexture.set(f.TEXTURE0),n.lineAtlasTexture&&n.lineAtlasTexture.bind(f.LINEAR,f.REPEAT),u.updatePaintBuffers()),A&&(p.activeTexture.set(f.TEXTURE0),n.imageAtlasTexture&&n.imageAtlasTexture.bind(f.LINEAR,f.CLAMP_TO_EDGE),u.updatePaintBuffers()),m&&!d&&i.terrain.setupElevationDraw(n,b),i.uploadCommonUniforms(p,b,l.toUnwrapped());let B=e=>{null!=s&&(s.value=C*c),b.draw(i,f.TRIANGLES,g,e,y,tJ.disabled,O,a.id,h.layoutVertexBuffer,h.indexBuffer,h.segments,a.paint,i.transform.zoom,u,[h.layoutVertexBuffer2,h.patternVertexBuffer,h.zOffsetVertexBuffer]),null!=s&&(s.value=C)};if(P&&!m){let e=i.stencilModeForClipping(l).ref;0===e&&x&&p.clear({stencil:0});let r={func:f.EQUAL,mask:255};O.u_alpha_discard_threshold=.8,B(new tY(r,e,255,f.KEEP,f.KEEP,f.INVERT)),O.u_alpha_discard_threshold=0,B(new tY(r,e,255,f.KEEP,f.KEEP,f.KEEP))}else P&&m&&(O.u_alpha_discard_threshold=.001),B(m?z:i.stencilModeForClipping(l))}m&&(i.forceTerrainMode=!1),P&&(i.resetStencilClippingMasks(),x&&p.clear({stencil:0})),0===c||i.depthOcclusion||x||i.layersWithOcclusionOpacity.push(i.currentLayer)},fill:function(i,r,a,n){let s=a.paint.get("fill-color"),l=a.paint.get("fill-opacity"),h=a.is3D(),u=new tX(i.context.gl.LEQUAL,tX.ReadWrite,i.depthRangeFor3D);if(0===l.constantOr(1))return;let c=a.paint.get("fill-emissive-strength"),d=i.colorModeForDrapableLayerRenderPass(c),p=a.paint.get("fill-pattern"),f=i.opaquePassEnabledForLayer()&&!p.constantOr(1)&&1===s.constantOr(e.bA.transparent).a&&1===l.constantOr(0)?"opaque":"translucent";if(i.renderPass===f){let e=h?u:i.depthModeForSublayer(1,"opaque"===i.renderPass?tX.ReadWrite:tX.ReadOnly);r9(i,r,a,n,e,d,!1)}if(!h&&"translucent"===i.renderPass&&a.paint.get("fill-antialias")){let e=h?u:i.depthModeForSublayer(2*!!a.getPaintProperty("fill-outline-color"),tX.ReadOnly);r9(i,r,a,n,e,d,!0)}},"fill-extrusion":function(i,r,a,n){let s=a.paint.get("fill-extrusion-opacity"),l=i.context,h=l.gl,u=i.terrain,c=u&&u.renderingToTexture;if(0===s)return;let d=i.conflationActive&&i.style.isLayerClipped(a,r.getSource()),p=i.style.order.indexOf(a.fqid);if(d&&function(e,i,r,a,n){for(let s of a){let a=i.getTile(s).getBucket(r);a&&(a.updateReplacement(s,e.replacementSource,n),a.uploadCentroid(e.context))}}(i,r,a,n,p),u||d)for(let s of n){let n=r.getTile(s).getBucket(a);n&&function(i,r,a,n,s,l,h){0===n.centroidVertexArray.length&&n.createCentroidsBuffer();let u=l?l.findDEMTileFor(a):null;if(!(u&&u.dem||h))return;let c=i=>new e.P(Math.ceil((i+e.d2)*e.d3),0),d=e=>{let i=r.getSource().minzoom,a=e=>{let i=r.getTileByID(e);if(i&&i.hasData())return i.getBucket(s)};
303for(let r of[0,-1,1]){if(e.overscaledZ+r<i)continue;let n=a(e.calculateScaledKey(e.overscaledZ+r));if(n)return n}},p=[0,0,0],f=(i,r)=>(p[0]=Math.min(i.min.y,r.min.y),p[1]=Math.max(i.max.y,r.max.y),p[2]=e.ab-r.min.x>i.max.x?r.min.x-e.ab:i.max.x,p),m=(i,r)=>(p[0]=Math.min(i.min.x,r.min.x),p[1]=Math.max(i.max.x,r.max.x),p[2]=e.ab-r.min.y>i.max.y?r.min.y-e.ab:i.max.y,p),_=[(e,i)=>f(e,i),(e,i)=>f(i,e),(e,i)=>m(e,i),(e,i)=>m(i,e)],g=(i,r,n,s,h,c,d)=>{if(!l)return 0;let p=[[c?n:i,c?i:n,0],[c?n:r,c?r:n,0]],f=d<0?e.ab+d:d,m=[c?f:(i+r)/2,c?(i+r)/2:f,0];return 0===n&&d<0||0!==n&&d>0?l.getForTilePoints(h,[m],!0,s):p.push(m),l.getForTilePoints(a,p,!0,u),Math.max(p[0][2],p[1][2],m[2])/l.exaggeration()};for(let i=0;i<4;i++){let r=n.borderFeatureIndices[i];if(0===r.length)continue;let s=e.c$[i](a),u=d(s);if(!(u&&u instanceof e.d0)||n.borderDoneWithNeighborZ[i]===u.canonical.z)continue;0===u.centroidVertexArray.length&&u.createCentroidsBuffer();let p=l?l.findDEMTileFor(s):null;if(!(p&&p.dem||h))continue;let f=(i<2?1:5)-i,m=u.borderDoneWithNeighborZ[f]!==n.canonical.z,y=u.borderFeatureIndices[f],x=0;if(n.canonical.z!==u.canonical.z){for(let e of r)n.showCentroid(n.featuresOnBorder[e]);if(m)for(let e of y)u.showCentroid(u.featuresOnBorder[e]);n.borderDoneWithNeighborZ[i]=u.canonical.z,u.borderDoneWithNeighborZ[f]=n.canonical.z}for(let a of r){let r;let l=n.featuresOnBorder[a],d=n.centroidData[l.centroidDataIndex],m=l.borders[i];for(;x<y.length;){let e=(r=u.featuresOnBorder[y[x]]).borders[f];if(e[1]>m[0]+3||e[0]>m[0]-3)break;u.showCentroid(r),x++}if(r&&x<y.length){let a=x,v=0;for(;!(r.borders[f][0]>m[1]-3)&&(v++,++x!==y.length);)r=u.featuresOnBorder[y[x]];r=u.featuresOnBorder[y[a]];let b=!1;if(v>=1){let e=r.borders[f];3>Math.abs(m[0]-e[0])&&3>Math.abs(m[1]-e[1])&&(v=1,b=!0,x=a+1)}else if(0===v){n.showCentroid(l);continue}let w=u.centroidData[r.centroidDataIndex];h&&b&&((d.flags|w.flags)&e.d1?(d.flags|=e.d1,w.flags|=e.d1):(d.flags&=~e.d1,w.flags&=~e.d1));let T=l.intersectsCount()>1||r.intersectsCount()>1;if(v>1)x=a,d.centroidXY=w.centroidXY=new e.P(0,0);else if(p&&p.dem&&!T){let r=_[i](d,w),a=i%2?e.ab-1:0,n=g(r[0],Math.min(e.ab-1,r[1]),a,p,s,i<2,r[2]);d.centroidXY=w.centroidXY=c(n)}else T?d.centroidXY=w.centroidXY=new e.P(0,0):(d.centroidXY=n.encodeBorderCentroid(l),w.centroidXY=u.encodeBorderCentroid(r));n.writeCentroidToBuffer(d),u.writeCentroidToBuffer(w)}else n.showCentroid(l)}n.borderDoneWithNeighborZ[i]=u.canonical.z,u.borderDoneWithNeighborZ[f]=n.canonical.z}(n.needsCentroidUpdate||!n.centroidVertexBuffer&&0!==n.centroidVertexArray.length)&&n.uploadCentroid(i)}(i.context,r,s,n,a,u,d)}if("shadow"===i.renderPass&&i.shadowRenderer){let l=i.shadowRenderer;if(u&&s<.65&&a._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof e.a4)return;let h=l.getShadowPassDepthMode(),c=l.getShadowPassColorMode();r7(i,r,a,n,h,tY.disabled,c,d)}else if("translucent"===i.renderPass){let p=!a.paint.get("fill-extrusion-pattern").constantOr(1),f=a.paint.get("fill-extrusion-color").constantOr(e.bA.white);if(!c&&0!==f.a){let e=new tX(i.context.gl.LEQUAL,tX.ReadWrite,i.depthRangeFor3D);1===s&&p?r7(i,r,a,n,e,tY.disabled,tZ.unblended,d):(r7(i,r,a,n,e,tY.disabled,tZ.disabled,d),r7(i,r,a,n,e,i.stencilModeFor3D(),i.colorModeForRenderPass(),d),i.resetStencilClippingMasks())}if(i.style.enable3dLights()&&p&&(!u&&"globe"!==i.transform.projection.name||c)){let s=a.paint.get("fill-extrusion-opacity"),p=a.paint.get("fill-extrusion-ambient-occlusion-intensity"),f=a.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),m=a.paint.get("fill-extrusion-flood-light-intensity"),_=a.paint.get("fill-extrusion-flood-light-color").toRenderColor(a.lut).toArray01().slice(0,3),g=p>0&&f>0,y=m>0,x=(e,i,r)=>(1-r)*e+r*i,v=l=>{let u=i.depthModeForSublayer(1,tX.ReadOnly,h.LEQUAL,!0),c=x(.1,3,a.paint.get(l?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation")),g=i._showOverdrawInspector;g||ae(i,r,a,n,u,new tY({func:h.ALWAYS,mask:255},255,255,h.KEEP,h.KEEP,h.REPLACE),new tZ([h.ONE,h.ONE,h.ONE,h.ONE],e.bA.transparent,[!1,!1,!1,!0],h.MIN),tJ.disabled,l,"sdf",s,p,f,m,_,c,d,!1);{let y=g?tY.disabled:new tY({func:h.EQUAL,mask:255},255,255,h.KEEP,h.DECR,h.DECR),x=g?i.colorModeForRenderPass():new tZ([h.ONE_MINUS_DST_ALPHA,h.DST_ALPHA,h.ONE,h.ONE],e.bA.transparent,[!0,!0,!0,!0]);ae(i,r,a,n,u,y,x,tJ.disabled,l,"color",s,p,f,m,_,c,d,!1)}};if(c){let c=(l,u,c)=>{let g=i.depthModeForSublayer(1,tX.ReadOnly,h.LEQUAL,!1),y=x(.1,3,a.paint.get(l?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"));{let c=new tZ([h.ONE,h.ONE,h.ONE,h.ONE],e.bA.transparent,[!1,!1,!1,!0]);ae(i,r,a,n,g,tY.disabled,c,tJ.disabled,l,"clear",s,p,f,m,_,y,d,u)}ae(i,r,a,n,g,new tY({func:h.ALWAYS,mask:255},255,255,h.KEEP,h.KEEP,h.REPLACE),new tZ([h.ONE,h.ONE,h.ONE,h.ONE],e.bA.transparent,[!1,!1,!1,!0],h.MIN),tJ.disabled,l,"sdf",s,p,f,m,_,y,d,u);
303{let c=l?h.ZERO:h.ONE_MINUS_DST_ALPHA;ae(i,r,a,n,g,new tY({func:h.EQUAL,mask:255},255,255,h.KEEP,h.DECR,h.DECR),new tZ([c,h.DST_ALPHA,h.ONE_MINUS_DST_ALPHA,h.ZERO],e.bA.transparent,[!0,!0,!0,!0]),tJ.disabled,l,"color",s,p,f,m,_,y,d,u)}{let x=new tZ([h.ONE,h.ONE,h.ONE,l?h.ZERO:h.ONE],e.bA.transparent,[!1,!1,!1,!0],l?h.FUNC_ADD:h.MAX);ae(i,r,a,n,g,tY.disabled,x,tJ.disabled,l,"clear",s,p,f,m,_,y,d,u,c)}};if(g||y){let r;if(i.prepareDrawTile(),u){let i=u.drapeBufferSize[0],a=u.drapeBufferSize[1];(r=u.framebufferCopyTexture)&&(!r||r.size[0]===i&&r.size[1]===a)||(r&&r.destroy(),r=u.framebufferCopyTexture=new e.T(l,new e.r({width:i,height:a}),h.RGBA8)),r.bind(h.LINEAR,h.CLAMP_TO_EDGE),h.copyTexSubImage2D(h.TEXTURE_2D,0,0,0,0,0,i,a)}g&&c(!0,!1,r),y&&c(!1,!0,r)}}else g&&v(!0),y&&v(!1),(g||y)&&i.resetStencilClippingMasks()}}},hillshade:function(i,r,a,n){if("offscreen"!==i.renderPass&&"translucent"!==i.renderPass||i.style.disableElevatedTerrain)return;let s=i.context,l=i.terrain&&i.terrain.renderingToTexture,[h,u]="translucent"!==i.renderPass||l?[{},n]:i.stencilConfigForOverlap(n);for(let n of u){let s=r.getTile(n);if(s.needsHillshadePrepare&&"offscreen"===i.renderPass)!function(i,r,a){let n=i.context,s=n.gl;if(!r.dem)return;let l=r.dem;if(n.activeTexture.set(s.TEXTURE1),iD(i,r,l),!r.demTexture)return;r.demTexture.bind(s.NEAREST,s.CLAMP_TO_EDGE);let h=l.dim;n.activeTexture.set(s.TEXTURE0);let u=r.hillshadeFBO;if(!u){let i=new e.T(n,{width:h,height:h,data:null},s.RGBA8);i.bind(s.LINEAR,s.CLAMP_TO_EDGE),(u=r.hillshadeFBO=n.createFramebuffer(h,h,!0,"renderbuffer")).colorAttachment.set(i.texture)}n.bindFramebuffer.set(u.framebuffer),n.viewport.set([0,0,h,h]);let{tileBoundsBuffer:c,tileBoundsIndexBuffer:d,tileBoundsSegments:p}=i.getMercatorTileBoundsBuffers(),f=[];i.linearFloatFilteringSupported()&&f.push("TERRAIN_DEM_FLOAT_FORMAT"),i.getOrCreateProgram("hillshadePrepare",{defines:f}).draw(i,s.TRIANGLES,tX.disabled,tY.disabled,tZ.unblended,tJ.disabled,((i,r)=>{let a=r.stride,n=e.a6.mat4.create();return e.a6.mat4.ortho(n,0,e.ab,-e.ab,0,0,1),e.a6.mat4.translate(n,n,[0,-e.ab,0]),{u_matrix:n,u_image:1,u_dimension:[a,a],u_zoom:i.overscaledZ}})(r.tileID,l),a.id,c,d,p),r.needsHillshadePrepare=!1}(i,s,a);else if("translucent"===i.renderPass){let r=i.depthModeForSublayer(0,tX.ReadOnly),u=a.paint.get("hillshade-emissive-strength"),c=i.colorModeForDrapableLayerRenderPass(u),d=l&&i.terrain?i.terrain.stencilModeForRTTOverlap(n):h[n.overscaledZ];!function(i,r,a,n,s,l,h){let u=i.context,c=u.gl,d=a.hillshadeFBO;if(!d)return;i.prepareDrawTile();let p=i.isTileAffectedByFog(r),f=i.getOrCreateProgram("hillshade",{overrideFog:p});u.activeTexture.set(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,d.colorAttachment.get());let m=((i,r,a,n)=>{let s=a.paint.get("hillshade-shadow-color"),l=a.paint.get("hillshade-highlight-color"),h=a.paint.get("hillshade-accent-color"),u=a.paint.get("hillshade-emissive-strength"),c=e.bC(a.paint.get("hillshade-illumination-direction"));if("viewport"===a.paint.get("hillshade-illumination-anchor"))c-=i.transform.angle;else if(i.style&&i.style.enable3dLights()&&i.style.directionalLight){let r=i.style.directionalLight.properties.get("direction"),a=e.c8(r.x,r.y,r.z);c=e.bC(a[1])}let d=!i.options.moving;return{u_matrix:n||i.transform.calculateProjMatrix(r.tileID.toUnwrapped(),d),u_image:0,u_latrange:function(i,r){let a=Math.pow(2,r.canonical.z),n=r.canonical.y;return[new e.a5(0,n/a).toLngLat().lat,new e.a5(0,(n+1)/a).toLngLat().lat]}(0,r.tileID),u_light:[a.paint.get("hillshade-exaggeration"),c],u_shadow:s.toRenderColor(a.lut),u_highlight:l.toRenderColor(a.lut),u_emissive_strength:u,u_accent:h.toRenderColor(a.lut)}})(i,a,n,i.terrain?r.projMatrix:null);i.uploadCommonUniforms(u,f,r.toUnwrapped());let{tileBoundsBuffer:_,tileBoundsIndexBuffer:g,tileBoundsSegments:y}=i.getTileBoundsBuffers(a);f.draw(i,c.TRIANGLES,s,l,h,tJ.disabled,m,n.id,_,g,y)}(i,n,s,a,r,d,c)}}s.viewport.set([0,0,i.width,i.height]),i.resetStencilClippingMasks()},raster:function(i,r,a,n,s,l){if("translucent"!==i.renderPass||0===a.paint.get("raster-opacity"))return;let h="globe"===i.transform.projection.name,u=0!==a.paint.get("raster-elevation"),c=u&&h;if(i.renderElevatedRasterBackface&&!c)return;let d=i.context,p=d.gl,f=r.getSource(),m=function(i,r,a,n){let s=r.paint.get("raster-color"),l="raster-array"===i.t
303ype,h=[],u=r.paint.get("raster-resampling"),c=r.paint.get("raster-color-mix"),d=r.paint.get("raster-color-range"),p=[c[0],c[1],c[2],0],f=c[3],m="nearest"===u?n.NEAREST:n.LINEAR;if(l&&(h.push("RASTER_ARRAY"),s||h.push("RASTER_COLOR"),"linear"===u&&h.push("RASTER_ARRAY_LINEAR"),m=n.NEAREST,!d&&i.rasterLayers)){let e=i.rasterLayers.find(({id:e})=>e===r.sourceLayer);e&&e.fields&&e.fields.range&&(d=e.fields.range)}if(d=d||[0,1],s){h.push("RASTER_COLOR"),a.activeTexture.set(n.TEXTURE2),r.updateColorRamp(d);let i=r.colorRampTexture;i||(i=r.colorRampTexture=new e.T(a,r.colorRamp,n.RGBA8)),i.bind(n.LINEAR,n.CLAMP_TO_EDGE)}return{mix:p,range:d,offset:f,defines:h,resampling:m}}(f,a,d,p);if(f instanceof e.aD&&!n.length&&!h)return;let _=a.paint.get("raster-emissive-strength"),g=i.colorModeForDrapableLayerRenderPass(_),y=i.terrain&&i.terrain.renderingToTexture,x=!i.options.moving,v="nearest"===a.paint.get("raster-resampling")?p.NEAREST:p.LINEAR;if(f instanceof e.aD&&!n.length&&(f.onNorthPole||f.onSouthPole)){let e=u?i.stencilModeFor3D():tY.disabled;return void an(!!f.onNorthPole,null,i,r,a,_,m,tJ.disabled,e)}if(!n.length)return;let[b,w]=f instanceof e.aD||y?[{},n]:i.stencilConfigForOverlap(n),T=w[w.length-1].overscaledZ;c&&m.defines.push("PROJECTION_GLOBE_VIEW"),u&&m.defines.push("RENDER_CUTOFF");let S=(n,s,w)=>{for(let S of n){let n,M,E,A,I;let C=S.toUnwrapped(),P=r.getTile(S);if(y&&(!P||!P.hasData()))continue;d.activeTexture.set(p.TEXTURE0);let L=function(e,i,r,a){if(e)return i instanceof eW&&e instanceof e3?i.getTextureDescriptor(e,r,!0):{texture:e.texture,mix:aa(a.mix),offset:a.offset,buffer:0,tileSize:1}}(P,f,a,m);if(!L||!L.texture)continue;let{texture:k,mix:R,offset:z,tileSize:D,buffer:O}=L;y?(n=tX.disabled,M=S.projMatrix):u?(n=new tX(p.LEQUAL,tX.ReadWrite,i.depthRangeFor3D),M=h?Float32Array.from(i.transform.expandedFarZProjMatrix):i.transform.calculateProjMatrix(C,x)):(n=i.depthModeForSublayer(S.overscaledZ-T,1===a.paint.get("raster-opacity")?tX.ReadWrite:tX.ReadOnly,p.LESS),M=i.transform.calculateProjMatrix(C,x));let B=i.terrain&&y?i.terrain.stencilModeForRTTOverlap(S):b[S.overscaledZ],F=l?0:a.paint.get("raster-fade-duration");P.registerFadeDuration(F);let N=r.findLoadedParent(S,0),V=r_(P,N,r,i.transform,F);i.terrain&&i.terrain.prepareDrawTile(),d.activeTexture.set(p.TEXTURE0),k.bind(v,p.CLAMP_TO_EDGE),d.activeTexture.set(p.TEXTURE1),N?(N.texture&&N.texture.bind(v,p.CLAMP_TO_EDGE),E=Math.pow(2,N.tileID.overscaledZ-P.tileID.overscaledZ),A=[P.tileID.canonical.x*E%1,P.tileID.canonical.y*E%1]):k.bind(v,p.CLAMP_TO_EDGE),k.useMipmap&&d.extTextureFilterAnisotropic&&i.transform.pitch>20&&p.texParameterf(p.TEXTURE_2D,d.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,d.extTextureFilterAnisotropicMax);let U=i.transform,j=u?function(e){let i=e._nearZ,r=e.projection.farthestPixelDistance(e),a=r-i,n=.2*e.height,s=i+n;return[i,r,(s-n-i)/a,(s-i)/a]}(U):[0,0,0,0],G,q,W,$,H,Z=0;if(c&&f instanceof e.aD&&f.coordinates.length>3)G=Float32Array.from(e.b6(e.cC(new e.bQ(0,0,0)))),q=Float32Array.from(U.globeMatrix),W=Float32Array.from(e.cy(U)),$=[e.am(U.center.lng),e.at(U.center.lat)],I=f.elevatedGlobePerspectiveTransform,H=f.elevatedGlobeGridMatrix||new Float32Array(9);else if(c){let i=e.cz(S.canonical);Z=e.cA(i.getCenter().lat),G=Float32Array.from(e.b6(e.cC(S.canonical))),q=Float32Array.from(U.globeMatrix),W=Float32Array.from(e.cy(U)),$=[e.am(U.center.lng),e.at(U.center.lat)],I=[0,0],H=Float32Array.from(e.cB(S.canonical,i,Z,U.worldSize/U._pixelsPerMercatorPixel))}else I=f instanceof e.aD?f.perspectiveTransform:[0,0],G=new Float32Array(16),q=new Float32Array(9),W=new Float32Array(16),$=[0,0],H=new Float32Array(9);let X=rV(M,G,q,W,H,A||[0,0],e.a9(i.transform.zoom),$,j,E||1,V,a,I,u?a.paint.get("raster-elevation"):0,2,R,z,m.range,D,O,_),Y=i.isTileAffectedByFog(S),J=i.getOrCreateProgram("raster",{defines:m.defines,overrideFog:Y});if(i.uploadCommonUniforms(d,J,C),f instanceof e.aD){let r=f.elevatedGlobeVertexBuffer,l=f.elevatedGlobeIndexBuffer;if(y||!h)f.boundsBuffer&&f.boundsSegments&&J.draw(i,p.TRIANGLES,n,tY.disabled,g,tJ.disabled,X,a.id,f.boundsBuffer,i.quadTriangleIndexBuffer,f.boundsSegments);else if(r&&l){let h=U.zoom<=e.c3?f.elevatedGlobeSegments:f.getSegmentsForLongitude(U.center.lng);h&&J.draw(i,p.TRIANGLES,n,tY.disabled,g,s,X,a.id,r,l,h)}}else if(c){n=new tX(p.LEQUAL,tX.ReadOnly,i.depthRangeFor3D);let e=i.globeSharedBuffers;if(e){let[r,l,h]=e.getGridBuffers(Z,!1);J.draw(i,p.TRIANGLES,n,w||B,i.colorModeForRenderPass(),s,X,a.id,r,l,h)}}else{let{tileBoundsBuffer:e,tileBoundsIndexBuffer:r,tileBoundsSegments:s}=i.getTileBoundsBuffers(P);J.draw(i,p.TRIANGLES,n,B,g,tJ.disabled,X,a.id,e,r,s)}}if(!(f instanceof e.aD)&&c)for(let e of n){let n=e.canonical.y===(1<<e.canonical.z)-1;0===e.canonical.y&&an(!0,e,i,r,a,_,m,s,w||tY.disabled),n&&an(!1,e,i,r,a,_,m,s===tJ.frontCW?tJ.backCW:tJ.frontCW,w||tY.disabled)}};c?S(w,i.renderElevatedRasterBackface?tJ.backCW:tJ.frontCW,i.stencilModeFor3D()):S(w,tJ.disabled,void 0),i.resetStencilClippingMasks()},"raster-particle":function(i,r,a,n,s,l){"offscreen"===i.renderPass&&function(i,r,a,n){if(!n.length)return;let s=i.context,l=s.gl,h=r.getSource();if(!(h instanceof eW))return;let u=Math.ceil(Math.sqrt(a.paint.get("raster-particle-count"))),c=a.particlePositionRGBAImage;if(!c||c.width!==u){let i=function(e){let i=e*e,r=new Uint8Array(4*i),a=function(e){return e|=0,((e
303=Math.imul((e=Math.imul((e=Math.imul(0xa3c59ac3^e,0x9e3779b9))^e>>>16,0x9e3779b9))^e>>>16,0x9e3779b9))>>>0)/0x100000000},n=1/1.1;for(let e=0;e<i;e++){let i=n*(a(2*e+0)+.05),s=n*(a(2*e+1)+.05),l=255*i%1,h=255*s%1,u=s-h/255;r[4*e+0]=255*(i-l/255),r[4*e+1]=255*l,r[4*e+2]=255*u,r[4*e+3]=255*h}return r}(u);c=a.particlePositionRGBAImage=new e.r({width:u,height:u},i)}let d=a.particleFramebuffer;d?d.width!==u&&(d.destroy(),d=a.particleFramebuffer=s.createFramebuffer(u,u,!0,null)):d=a.particleFramebuffer=s.createFramebuffer(u,u,!0,null);let p=[];for(let i of n){let n=r.getTile(i);if(!(n instanceof e3))continue;let l=function(i,r,a){if(!i)return null;let n=r.getTextureDescriptor(i,a,!0);if(!n)return null;let{texture:s,mix:l,offset:h,tileSize:u,buffer:c,format:d}=n;if(!s||!d)return null;let p=!1;return"uint32"===d&&(p=!0,l[3]=0,l=rF(e.d7,l,[0,a.paint.get("raster-particle-max-speed")]),h=rN(e.d7,h,[0,a.paint.get("raster-particle-max-speed")])),{texture:s,textureOffset:[c/(u+2*c),u/(u+2*c)],tileSize:u,scalarData:p,scale:l,offset:h,defines:["RASTER_ARRAY",{uint8:"DATA_FORMAT_UINT8",uint16:"DATA_FORMAT_UINT16",uint32:"DATA_FORMAT_UINT32"}[d]]}}(n,h,a);if(!l)continue;let d=[n.tileSize,n.tileSize],f=a.tileFramebuffer;f||(f=a.tileFramebuffer=s.createFramebuffer(d[0],d[1],!0,null));let m=n.rasterParticleState;m||(m=n.rasterParticleState=new as(s,i,d,c));let _=m.update(a.lastInvalidatedAt);m.particleTextureDimension!==u&&m.updateParticleTexture(i,c);let g=m.targetColorTexture;m.targetColorTexture=m.backgroundColorTexture,m.backgroundColorTexture=g;let y=m.particleTexture0;m.particleTexture0=m.particleTexture1,m.particleTexture1=y,p.push([i,l,m,_])}if(0===p.length)return;let f=e.q.now(),m=a.previousDrawTimestamp?.001*(f-a.previousDrawTimestamp):.0167;if(a.previousDrawTimestamp=f,a.hasColorMap()){s.activeTexture.set(l.TEXTURE0+2);let i=a.colorRampTexture;i||(i=a.colorRampTexture=new e.T(s,a.colorRamp,l.RGBA8)),i.bind(l.LINEAR,l.CLAMP_TO_EDGE)}s.bindFramebuffer.set(a.tileFramebuffer.framebuffer),function(i,r,a){var n;let s=i.context,l=s.gl,h=r.tileFramebuffer;s.activeTexture.set(l.TEXTURE0);let u={u_texture:0,u_opacity:1.05*(n=r.paint.get("raster-particle-fade-opacity-factor"))/(n+.05)},c=i.getOrCreateProgram("rasterParticleTexture",{defines:[],overrideFog:!1});for(let n of a){let[,,a,d]=n;h.colorAttachment.set(a.targetColorTexture.texture),s.viewport.set([0,0,h.width,h.height]),s.clear({color:e.bA.transparent}),d&&(a.backgroundColorTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE),c.draw(i,l.TRIANGLES,tX.disabled,tY.disabled,tZ.alphaBlended,tJ.disabled,u,r.id,i.viewportBuffer,i.quadTriangleIndexBuffer,i.viewportSegments))}}(i,a,p),function(i,r,a,n){let s=i.context,l=s.gl,h=a.tileFramebuffer,u="globe"===i.transform.projection.name,c=a.paint.get("raster-particle-max-speed");for(let d of n){let[n,p,f]=d;s.activeTexture.set(l.TEXTURE0+0),p.texture.bind(l.LINEAR,l.CLAMP_TO_EDGE),h.colorAttachment.set(f.targetColorTexture.texture);let m=i.getOrCreateProgram("rasterParticleDraw",{defines:p.defines,overrideFog:!1});s.activeTexture.set(l.TEXTURE0+1);let _=p.scalarData?[]:[0,1,2,3].map(i=>e.c$[i](n));_.push(n);let g=n.canonical.x,y=n.canonical.y;for(let e of _){let s=r.getTile(u?e.wrapped():e);if(!s)continue;let h=s.rasterParticleState;if(!h)continue;let d=e.canonical.x+(1<<e.canonical.z)*(e.wrap-n.wrap),f=e.canonical.y;h.particleTexture0.bind(l.NEAREST,l.CLAMP_TO_EDGE);let _=rj(1,h.particleTexture0.size[0],[d-g,f-y],0,p.texture.size,2,c,p.textureOffset,p.scale,p.offset);m.draw(i,l.POINTS,tX.disabled,tY.disabled,tZ.alphaBlended,tJ.disabled,_,a.id,h.particleIndexBuffer,void 0,h.particleSegment)}}}(i,r,a,p),s.bindFramebuffer.set(a.particleFramebuffer.framebuffer),function(i,r,a,n){let s=i.context,l=s.gl,h=r.paint.get("raster-particle-max-speed"),u=n*r.paint.get("raster-particle-speed-factor")*.15,c=Math.pow(.01+ +r.paint.get("raster-particle-reset-rate-factor"),6),d=r.particleFramebuffer;for(let n of(s.viewport.set([0,0,d.width,d.height]),a)){let[,a,p]=n;s.activeTexture.set(l.TEXTURE0+0),a.texture.bind(l.LINEAR,l.CLAMP_TO_EDGE),s.activeTexture.set(l.TEXTURE0+1);let f=p.particleTexture0;f.bind(l.NEAREST,l.CLAMP_TO_EDGE);let m=rG(1,f.size[0],0,a.texture.size,h,u,c,a.textureOffset,a.scale,a.offset);d.colorAttachment.set(p.particleTexture1.texture),s.clear({color:e.bA.transparent}),i.getOrCreateProgram("rasterParticleUpdate",{defines:a.defines}).draw(i,l.TRIANGLES,tX.disabled,tY.disabled,tZ.unblended,tJ.disabled,m,r.id,i.viewportBuffer,i.quadTriangleIndexBuffer,i.viewportSegments)}}(i,a,p,m)}(i,r,a,n),"translucent"===i.renderPass&&(function(i,r,a,n,s){let l=i.context,h=l.gl,u=r.getSource().tileSize,c=5*(1-e.a7(e.bV,e.bV+1,i.transform.zoom))*u+a.paint.get("raster-particle-elevation"),d=!i.options.moving,p="globe"===i.transform.projection.name;if(!n.length)return;let[f,m]=i.stencilConfigForOverlap(n),_=[];p&&_.push("PROJECTION_GLOBE_VIEW");let g=i.stencilModeFor3D();for(let n of m){let s,u,m,y,x,v,b;let w=n.toUnwrapped(),T=r.getTile(n);if(!T.rasterParticleState)continue;let S=T.rasterParticleState;T.registerFadeDuration(100);let M=r.findLoadedParent(n,0),E=r_(T,M,r,i.transform,100);i.terrain&&i.terrain.prepareDrawTile(),l.activeTexture.set(h.TEXTURE0),S.targetColorTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE),l.activeTexture.set(h.TEXTURE1),M&&M.rasterParticleState?(M.rasterParticleState.targetColorTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE),s=Math.pow(2,M.tileID.overscaledZ-T.tileID.overscaledZ
303),u=[T.tileID.canonical.x*s%1,T.tileID.canonical.y*s%1]):S.targetColorTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE);let A=p?Float32Array.from(i.transform.expandedFarZProjMatrix):i.transform.calculateProjMatrix(w,d),I=i.transform,C=function(e){let i=e._nearZ,r=e.projection.farthestPixelDistance(e),a=r-i,n=.2*e.height,s=i+n;return[i,r,(s-n-i)/a,(s-i)/a]}(I),P=e.cz(n.canonical),L=e.cA(P.getCenter().lat);p?(m=Float32Array.from(e.b6(e.cC(n.canonical))),y=Float32Array.from(I.globeMatrix),x=Float32Array.from(e.cy(I)),v=[e.am(I.center.lng),e.at(I.center.lat)],b=Float32Array.from(e.cB(n.canonical,P,L,I.worldSize/I._pixelsPerMercatorPixel))):(m=new Float32Array(16),y=new Float32Array(9),x=new Float32Array(16),v=[0,0],b=new Float32Array(9));let k=rU(A,m,y,x,b,u||[0,0],e.a9(i.transform.zoom),v,C,s||1,E,c),R=i.isTileAffectedByFog(n),z=i.getOrCreateProgram("rasterParticle",{defines:_,overrideFog:R});if(i.uploadCommonUniforms(l,z,w),p){let e=new tX(h.LEQUAL,tX.ReadOnly,i.depthRangeFor3D),r=i.globeSharedBuffers;if(r){let[n,s,l]=r.getGridBuffers(L,!1);z.draw(i,h.TRIANGLES,e,g,tZ.alphaBlended,i.renderElevatedRasterBackface?tJ.frontCCW:tJ.backCCW,k,a.id,n,s,l)}}else{let e=i.depthModeForSublayer(0,tX.ReadOnly),r=f[n.overscaledZ],{tileBoundsBuffer:s,tileBoundsIndexBuffer:l,tileBoundsSegments:u}=i.getTileBoundsBuffers(T);z.draw(i,h.TRIANGLES,e,r,tZ.alphaBlended,tJ.disabled,k,a.id,s,l,u)}}i.resetStencilClippingMasks()}(i,r,a,n),i.style.map.triggerRepaint())},background:function(i,r,a,n){let s;let l=a.paint.get("background-color"),h=a.paint.get("background-opacity"),u=a.paint.get("background-emissive-strength"),c="viewport"===a.paint.get("background-pitch-alignment");if(0===h)return;let d=i.context,p=d.gl,f=i.transform,m=f.tileSize,_=a.paint.get("background-pattern");if(void 0!==_&&(null===_||!(s=i.imageManager.getPattern(_.toString(),a.scope,i.style.getLut(a.scope)))))return;let g=!_&&1===l.a&&1===h&&i.opaquePassEnabledForLayer()?"opaque":"translucent";if(i.renderPass!==g)return;let y=tY.disabled,x=i.depthModeForSublayer(0,"opaque"===g?tX.ReadWrite:tX.ReadOnly),v=i.colorModeForDrapableLayerRenderPass(u),b=_?"backgroundPattern":"background",w,T=n;if(T||(T=Object.values(w=i.getBackgroundTiles()).map(e=>e.tileID)),_&&(d.activeTexture.set(p.TEXTURE0),i.imageManager.bind(i.context,a.scope)),c){let r=i.getOrCreateProgram(b,{overrideFog:!1,overrideRtt:!0}),n=new Float32Array(e.a6.mat4.identity([])),d=new e.aA(0,0,0,0,0),f=_?rH(n,u,h,i,0,a.scope,s,c,{tileID:d,tileSize:m}):r$(n,u,h,l.toRenderColor(a.lut));r.draw(i,p.TRIANGLES,x,y,v,tJ.disabled,f,a.id,i.viewportBuffer,i.quadTriangleIndexBuffer,i.viewportSegments)}else for(let e of T){let g=i.isTileAffectedByFog(e),T=i.getOrCreateProgram(b,{overrideFog:g}),S=e.toUnwrapped(),M=n?e.projMatrix:i.transform.calculateProjMatrix(S);i.prepareDrawTile();let E=r?r.getTile(e):w?w[e.key]:new e2(e,m,f.zoom,i),A=_?rH(M,u,h,i,0,a.scope,s,c,{tileID:e,tileSize:m}):r$(M,u,h,l.toRenderColor(a.lut));i.uploadCommonUniforms(d,T,S);let{tileBoundsBuffer:I,tileBoundsIndexBuffer:C,tileBoundsSegments:P}=i.getTileBoundsBuffers(E);T.draw(i,p.TRIANGLES,x,y,v,tJ.disabled,A,a.id,I,C,P)}},sky:function(i,r,a){let n=i._atmosphere?e.a9(i.transform.zoom):1,s=a.paint.get("sky-opacity")*n;if(0===s)return;let l=i.context,h=a.paint.get("sky-type"),u=new tX(l.gl.LEQUAL,tX.ReadOnly,[0,1]),c=i.frameCounter/1e3%1;"atmosphere"===h?"offscreen"===i.renderPass?a.needsSkyboxCapture(i)&&(function(i,r,a,n){let s=i.context,l=s.gl,h=r.skyboxFbo;if(!h){h=r.skyboxFbo=s.createFramebuffer(32,32,!0,null),r.skyboxGeometry=new ax(s),r.skyboxTexture=s.gl.createTexture(),l.bindTexture(l.TEXTURE_CUBE_MAP,r.skyboxTexture),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_MIN_FILTER,l.LINEAR),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_MAG_FILTER,l.LINEAR);for(let e=0;e<6;++e)l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,l.RGBA,32,32,0,l.RGBA,l.UNSIGNED_BYTE,null)}s.bindFramebuffer.set(h.framebuffer),s.viewport.set([0,0,32,32]);let u=r.getCenter(i,!0),c=i.getOrCreateProgram("skyboxCapture"),d=new Float64Array(16);e.a6.mat4.identity(d),e.a6.mat4.rotateY(d,d,-(.5*Math.PI)),av(i,r,c,d,u,0),e.a6.mat4.identity(d),e.a6.mat4.rotateY(d,d,.5*Math.PI),av(i,r,c,d,u,1),e.a6.mat4.identity(d),e.a6.mat4.rotateX(d,d,-(.5*Math.PI)),av(i,r,c,d,u,2),e.a6.mat4.identity(d),e.a6.mat4.rotateX(d,d,.5*Math.PI),av(i,r,c,d,u,3),e.a6.mat4.identity(d),av(i,r,c,d,u,4),e.a6.mat4.identity(d),e.a6.mat4.rotateY(d,d,Math.PI),av(i,r,c,d,u,5),s.viewport.set([0,0,i.width,i.height])}(i,a),a.markSkyboxValid(i)):"sky"===i.renderPass&&function(e,i,r,a,n){let s=e.context,l=s.gl,h=e.transform,u=e.getOrCreateProgram("skybox");s.activeTexture.set(l.TEXTURE0),l.bindTexture(l.TEXTURE_CUBE_MAP,i.skyboxTexture);let c={u_matrix:h.skyboxMatrix,u_sun_direction:i.getCenter(e,!1),u_cubemap:0,u_opacity:a,u_temporal_offset:n};e.uploadCommonUniforms(s,u),u.draw(e,l.TRIANGLES,r,tY.disabled,e.colorModeForRenderPass(),tJ.backCW,c,"skybox",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}(i,a,u,s,c):"gradient"===h&&"sky"===i.renderPass&&function(i,r,a,n,s){let l,h,u;let c=i.context,d=c.gl,p=i.transform,f=i.getOrCreateProgram("skyboxGradient");r.skyboxGeometry||(r.skyboxGeometry=new ax(c)),c.activeTexture.set(d.TEXTURE0);let m=r.colorRampTexture;m||(m=r.colorRampTexture=new e.T(c,r.colorRamp,d.RGBA8)),m.bind(d.LINEAR,d.CLAMP_TO_EDGE);let _=(l=p.skyboxMatrix,h=r.getCenter(i,!1),u=r.paint.get("sky-gradient-radius"),{u_matrix:l,u_color_ramp:0,u_center_direction:h,u_radius:e.bC(u),u_opacity:n,u_temporal_offset:s});i.uploadCommonUniforms(c,f),f.draw(i,d.TRIANGLES,a,tY.disabled,i.colorModeForRenderPass(),tJ.backCW,_,"skyboxGradient",r.skyboxGeometry.vertexBuffer,r.skyboxGeometry.indexBuffer,r.skyboxGeometry.segment)}(i,a,u,s,c)},debug:function(i,r,a,n,s,l){for(let h=0;h<a.length;h++)if(s){let s=new e.bA(.8*n.r,.8*n.g,.8*n.b,1);ap(i,r,a[h],n,-1,-1,l),ap(i,r,a[h],n,-1,1,l),ap(i,r,a[h],n,1,1,l),ap(i,r,a[h],n,1,-1,l),ap(i,r,a[h],s,0,0,l)}else ap(i,r,a[h],n,0,0,l)},custom:function(i,r,a,n){let s=i.context,l=a.implementation;if(!i.transform.projection.unsupportedLayers||!i.transform.projection.unsupportedLayers.includes("custom")||i.terrain&&(i.terrain.renderingToTexture||"offscreen"===i.renderPass)&&a.isDraped(r)){if("offscreen"===i.renderPass){let r=l.prerender;if(r){if(i.setCustomLayerDefaults(),s.setColorMode(i.colorModeForRenderPass()),"globe"===i.transform.projection.name){let a=i.transform.pointMerc;r.call(l,s.gl,i.transform.customLayerMatrix(),i.transform.getProjection(),i.transform.globeToMercatorMatrix(),e.a9(i.transform.zoom),[a.x,a.y],i.transform.pixelsPerMeterRatio)}else r.call(l,s.gl,i.transform.customLayerMatrix());s.setDirty(),i.setBaseState()}}else if("translucent"===i.renderPass){if(i.terrain&&i.terrain.renderingToTexture){let r=l.renderToTile;if(r){let a=n[0].canonical,h=new e.a5(a.x+n[0].wrap*(1<<a.z),a.y,a.z);s.setDepthMode(tX.disabled),s.setStencilMode(tY.disabled),s.setColorMode(i.colorModeForRenderPass()),i.setCustomLayerDefaults(),r.call(l,s.gl,h),s.setDirty(),i.setBaseState()}return}i.setCustomLayerDefaults(),s.setColorMode(i.colorModeForRenderPass()),s.setStencilMode(tY.disabled);let r="3d"===l.renderingMode?new tX(i.context.gl.LEQUAL,tX.ReadWrite,i.depthRangeFor3D):i.depthModeForSublayer(0,tX.ReadOnly);if(s.setDepthMode(r),"globe"===i.transform.projection.name){let r=i.transform.pointMerc;l.render(s.gl,i.transform.customLayerMatrix(),i.transform.getProjection(),i.transform.globeToMercatorMatrix(),e.a9(i.transform.zoom),[r.x,r.y],i.transform.pixelsPerMeterRatio)}else l.render(s.gl,i.transform.customLayerMatrix());s.setDirty(),i.setBaseState(),s.bindFramebuffer.set(null)}}else e.w("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers.")},model:function(i,r,a,n){if("opaque"===i.renderPass)return;let s=a.paint.get("model-opacity");if(0===s)return;let l=a.paint.get("model-cast-shadows");
303if("shadow"===i.renderPass&&(!l||i.terrain&&s<.65&&a._transitionablePaint._values["model-opacity"].value.expression instanceof e.a4))return;let h=i.shadowRenderer,u=a.paint.get("model-receive-shadows");h&&(h.useNormalOffset=!0,u||(h.enabled=!1));let c=()=>{h&&(h.useNormalOffset=!0,u||(h.enabled=!0))},d=r.getSource();if("light-beam"===i.renderPass&&"batched-model"!==d.type)return;if("vector"===d.type||"geojson"===d.type)return function(i,r,a,n,s){let l=i.transform;if("mercator"!==l.projection.name)return void e.w(`Drawing 3D models for ${l.projection.name} projection is not yet implemented`);let h=l.getFreeCameraOptions().position;if(!i.modelManager)return;let u=i.modelManager;a.modelManager=u;let c=i.shadowRenderer;if(!a._unevaluatedLayout._values.hasOwnProperty("model-id"))return;let d=a._unevaluatedLayout._values["model-id"],p={...a.layout.get("model-id").parameters},f=i.style.order.indexOf(a.fqid);for(let m of n){let n=r.getTile(m).getBucket(a);if(!n||n.projection.name!==l.projection.name)continue;let _=n.getModelUris();_&&!n.modelsRequested&&(u.addModelsFromBucket(_,s),n.modelsRequested=!0);let g=function(i,r){let a=1<<i.canonical.z,n=r.getFreeCameraOptions().position,s=r.elevation,l=i.canonical.x/a,h=(i.canonical.x+1)/a,u=i.canonical.y/a,c=(i.canonical.y+1)/a,d=r._centerAltitude;if(s){let e=s.getMinMaxForTile(i);e&&e.max>d&&(d=e.max)}let p=e.ap(n.x,l,h)-n.x,f=e.ap(n.y,u,c)-n.y,m=e.bE(d,r.center.lat)-n.z;return r._zoomFromMercatorZ(Math.sqrt(p*p+f*f+m*m))}(m,l);p.zoom=g;let y=d.possiblyEvaluate(p);if(function(i,r,a){let n=r.updateZoomBasedPaintProperties(),s=function(i,r,a){let n,s,l,h=i.terrain?i.terrain.exaggeration():0;if(i.terrain&&h>0){let r=i.terrain,s=r.findDEMTileFor(a);s&&s.dem?n=e.di.create(r,a,s):h=0}if(0===h&&(r.terrainElevationMin=0,r.terrainElevationMax=0),h===r.validForExaggeration&&(0===h||n&&n._demTile&&n._demTile.tileID===r.validForDEMTile.id&&n._dem._timestamp===r.validForDEMTile.timestamp))return!1;for(let e in r.instancesPerModel){let i=r.instancesPerModel[e];for(let e=0;e<i.instancedDataArray.length;++e){let a=(n?h*n.getElevationAt(0|i.instancedDataArray.float32[16*e],0|i.instancedDataArray.float32[16*e+1],!0,!0):0)+i.instancesEvaluatedElevation[e];i.instancedDataArray.float32[16*e+6]=a,s=s?Math.min(r.terrainElevationMin,a):a,l=l?Math.max(r.terrainElevationMax,a):a}}return r.terrainElevationMin=s||0,r.terrainElevationMax=l||0,r.validForExaggeration=h,r.validForDEMTile=n&&n._demTile?{id:n._demTile.tileID,timestamp:n._dem._timestamp}:{id:void 0,timestamp:0},!0}(i,r,a);(n||s)&&(r.uploaded=!1,r.upload(i.context))}(i,n,m),aP.shadowUniformsInitialized=!1,aP.useSingleShadowCascade=!!c&&0===c.getMaxCascadeForTile(m.toUnwrapped()),"shadow"===i.renderPass&&c){if(1===i.currentShadowCascade&&n.isInsideFirstShadowMapFrustum)continue;let r=l.calculatePosMatrix(m.toUnwrapped(),l.worldSize);if(aP.tileMatrix.set(r),aP.shadowTileMatrix=Float32Array.from(c.calculateShadowPassMatrixFromMatrix(r)),aP.aabb.min.fill(0),aP.aabb.max[0]=aP.aabb.max[1]=e.ab,aP.aabb.max[2]=0,function(i,r,a,n){if(!a.modelManager)return!0;let s=a.modelManager;if(!a.shadowRenderer)return!0;let l=a.shadowRenderer,h=r.aabb,u=!0,c=i.maxHeight;if(0===c){let e=0;for(let r in i.instancesPerModel){let i=s.getModel(r,n);i?e=Math.max(e,Math.max(Math.max(i.aabb.max[0],i.aabb.max[1]),i.aabb.max[2])):u=!1}c=i.maxScale*e*1.41+i.maxVerticalOffset,u&&(i.maxHeight=c)}h.max[2]=c,h.min[2]+=i.terrainElevationMin,h.max[2]+=i.terrainElevationMax,e.a6.vec3.transformMat4(h.min,h.min,r.tileMatrix),e.a6.vec3.transformMat4(h.max,h.max,r.tileMatrix);let d=h.intersects(l.getCurrentCascadeFrustum());return 0===a.currentShadowCascade&&(i.isInsideFirstShadowMapFrustum=2===d),0===d}(n,aP,i,a.scope))continue}let x=1<<m.canonical.z,v=[((h.x-m.wrap)*x-m.canonical.x)*e.ab,(h.y*x-m.canonical.y)*e.ab,h.z*x*e.ab];for(let e in i.conflationActive&&Object.keys(n.instancesPerModel).length>0&&i.style.isLayerClipped(a,r.getSource())&&n.updateReplacement(m,i.replacementSource,f,s)&&(n.uploaded=!1,n.upload(i.context)),n.instancesPerModel){let r=n.instancesPerModel[e];r.features.length>0&&(e=y.evaluate(r.features[0].feature,{}));let l=u.getModel(e,s);if(l&&l.uploaded)for(let e of l.nodes)(function e(i,r,a,n,s,l,h){let u=i.context,c="shadow"===i.renderPass,d=i.shadowRenderer,p=c&&d?d.get
303ShadowPassDepthMode():new tX(u.gl.LEQUAL,tX.ReadWrite,i.depthRangeFor3D),f=i.isTileAffectedByFog(l);if(a.meshes)for(let e of a.meshes){let m,_,g;let y=["MODEL_POSITION_ON_GPU"],x=[];n.instancedDataArray.length>20&&y.push("INSTANCED_ARRAYS");let v=t9(i,r.paint.get("model-cutoff-fade-range"));if(v.shouldRenderCutoff&&y.push("RENDER_CUTOFF"),c&&d)m=i.getOrCreateProgram("modelDepth",{defines:y}),_=rY(h.shadowTileMatrix,h.shadowTileMatrix,Float32Array.from(a.matrix)),g=d.getShadowPassColorMode();else{aA(y,x,e,i,r.lut),m=i.getOrCreateProgram("model",{defines:y,overrideFog:f});let n=e.material,c=n.pbrMetallicRoughness,p=r.paint.get("model-opacity"),b=r.paint.get("model-emissive-strength").constantOr(0);_=rX(l.expandedProjMatrix,Float32Array.from(a.matrix),new Float32Array(16),null,i,p,c.baseColorFactor.toRenderColor(null),n.emissiveFactor,c.metallicFactor,c.roughnessFactor,n,b,r,s),d&&(h.shadowUniformsInitialized?m.setShadowUniformValues(u,d.getShadowUniformValues()):(d.setupShadows(l.toUnwrapped(),m,"model-tile",l.overscaledZ
303),h.shadowUniformsInitialized=!0)),g=v.shouldRenderCutoff||p<1||"OPAQUE"!==n.alphaMode?tZ.alphaBlended:tZ.unblended}i.uploadCommonUniforms(u,m,l.toUnwrapped(),null,v);let b=e.material.doubleSided?tJ.disabled:tJ.backCCW;if(n.instancedDataArray.length>20)x.push(n.instancedDataBuffer),m.draw(i,u.gl.TRIANGLES,p,tY.disabled,g,b,_,r.id,e.vertexBuffer,e.indexBuffer,e.segments,r.paint,i.transform.zoom,void 0,x,n.instancedDataArray.length);else{let a=c?"u_instance":"u_normal_matrix";for(let s=0;s<n.instancedDataArray.length;++s)_[a]=new Float32Array(n.instancedDataArray.arrayBuffer,64*s,16),m.draw(i,u.gl.TRIANGLES,p,tY.disabled,g,b,_,r.id,e.vertexBuffer,e.indexBuffer,e.segments,r.paint,i.transform.zoom,void 0,x)}}if(a.children)for(let u of a.children)e(i,r,u,n,s,l,h)})(i,a,e,r,v,m,aP)}}}(i,r,a,n,"vector"===d.type?a.scope:""),void c();if(!d.loaded())return;if("batched-model"===d.type)return function(i,r,a,n){a.resetLayerRenderingStats(i);let s=i.context,l=i.transform,h=i.style.fog,u=i.shadowRenderer;if("mercator"!==l.projection.name)return void e.w(`Drawing 3D landmark models for ${l.projection.name} projection is not yet implemented`);let c=i.transform.getFreeCameraOptions().position,d=e.a6.vec3.scale([],[c.x,c.y,c.z],i.transform.worldSize),p=e.a6.vec3.negate([],d),f=e.a6.mat4.identity([]),m=e.de(l.center.lat,l.zoom),_=e.a6.mat4.fromScaling([],[1,1,1/m]);e.a6.mat4.translate(f,f,p);let g=a.paint.get("model-opacity"),y=new tX(s.gl.LEQUAL,tX.ReadWrite,i.depthRangeFor3D),x=new tX(s.gl.LEQUAL,tX.ReadOnly,i.depthRangeFor3D),v=new e.ca([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),b="shadow"===i.renderPass,w=b&&u?u.getCurrentCascadeFrustum():l.getFrustum(l.scaleZoom(l.worldSize)),T=a.paint.get("model-front-cutoff"),S=T[2]<1,M=t9(i,a.paint.get("model-cutoff-fade-range")),E=a.getLayerRenderingStats();(function(e,i,r,a){let n=e.terrain?e.terrain.exaggeration():0,s=e.transform.zoom;for(let l of a){let a=i.getTile(l).getBucket(r);a&&(e.conflationActive&&a.updateReplacement(l,e.replacementSource),a.evaluateScale(e,r),e.terrain&&n>0&&a.elevationUpdate(e.terrain,n,l,r.source),a.needsReEvaluation(e,s,r)&&a.evaluate(r))}})(i,r,a,n),function(){let c,p,A;S?(c=n.length-1,p=-1,A=-1):(c=0,p=n.length,A=1);let I=new Float64Array(16),C=e.a6.vec3.create(),P=new e.P(0,0);for(let L=c;L!==p;L+=A){let c=n[L],p=r.getTile(c).getBucket(a);if(!p||!p.uploaded)continue;let A=!1;u&&(A=0===u.getMaxCascadeForTile(c.toUnwrapped()));let k=l.calculatePosMatrix(c.toUnwrapped(),l.worldSize),R=p.modelTraits;!b&&S&&(e.a6.mat4.invert(I,k),e.a6.vec3.transformMat4(C,d,I),P.x=C[0],P.y=C[1]);let z=[];for(let r of p.getNodesInfo()){if(r.hiddenByReplacement||!r.node.meshes)continue;let a=r.node,n=0;i.terrain&&a.elevation&&(n=a.elevation*i.terrain.exaggeration());let s=(()=>{let i=r.aabb;return v.min=[...i.min],v.max=[...i.max],v.min[2]+=n,v.max[2]+=n,e.a6.vec3.transformMat4(v.min,v.min,k),e.a6.vec3.transformMat4(v.max,v.max,k),v})(),h=r.evaluatedScale;if(h[0]<=1&&h[1]<=1&&h[2]<=1&&0===s.intersects(w))continue;if(!b&&S){let i=1/6;r.cameraCollisionOpacity=d[0]>s.min[0]&&d[0]<s.max[0]&&d[1]>s.min[1]&&d[1]<s.max[1]&&d[2]*m<s.max[2]&&a.footprint&&e.bv(P,a.footprint)?Math.max(r.cameraCollisionOpacity-i,0):Math.min(1,r.cameraCollisionOpacity+i)}let u=[...k],c=a.anchor?a.anchor[0]:0,p=a.anchor?a.anchor[1]:0;e.a6.mat4.translate(u,u,[c*(h[0]-1),p*(h[1]-1),n]),e.a6.vec3.exactEquals(h,e.dh)||e.a6.mat4.scale(u,u,h);let f=e.a6.mat4.multiply([],u,a.matrix),_=e.a6.mat4.multiply([],l.expandedFarZProjMatrix,f),y=e.a6.mat4.multiply([],l.expandedFarZProjMatrix,u),x=e.a6.vec4.transformMat4([],[c,p,n,1],_)[2];a.hidden=!1;let E=g;b||(S&&(E*=r.cameraCollisionOpacity*function(i,r,a,n){let s,l;if(r.pitch<20)return 1;let h=r.getWorldToCameraMatrix();e.a6.mat4.multiply(h,h,i);let u=e.a6.vec4.fromValues(a.min[0],a.min[1],a.min[2],1),c=e.a6.vec4.transformMat4(e.a6.vec4.create(),u,h),d=c,p=c;u[1]=a.max[1],d=(c=e.a6.vec4.transformMat4(e.a6.vec4.create(),u,h))[1]<d[1]?c:d,p=c[1]>p[1]?c:p,u[0]=a.max[0],d=(c=e.a6.vec4.transformMat4(e.a6.vec4.create(),u,h))[1]<d[1]?c:d,p=c[1]>p[1]?c:p,u[1]=a.min[1],d=(c=e.a6.vec4.transformMat4(e.a6.vec4.create(),u,h))[1]<d[1]?c:d,p=c[1]>p[1]?c:p;let f=e.ap(n[0],0,1),m=100*r.pixelsPerMeter*e.ap(n[1],0,1),_=e.ap(n[2],0,1),g=e.a6.vec4.lerp(e.a6.vec4.create(),d,p,f),y=Math.tan(.5*r.fovX),x=-g[2]*y;if(0===m)return g[1]<-Math.abs(x)?_:1;let v=(-Math.abs(x)-g[1])/m;
303return s=e.ap((1-v)*1+v*_,_,1),(1-(l=e.ap((r.pitch-20)/20,0,1)))*1+l*s}(u,l,r.aabb,T)),E*=function(i,r){let a=i.uniformValues.u_cutoff_params[0],n=i.uniformValues.u_cutoff_params[1],s=i.uniformValues.u_cutoff_params[2],l=i.uniformValues.u_cutoff_params[3];return n===a||l===s?1:e.ap(((r-a)/(n-a)-s)/(l-s),0,1)}(M,x)),0!==E?z.push({nodeInfo:r,depth:x,opacity:E,wvpForNode:_,wvpForTile:y,nodeModelMatrix:f,tileModelMatrix:u}):a.hidden=!0}for(let r of(b||z.sort((e,i)=>S&&(1!==e.opacity||1!==i.opacity)?1===e.opacity?-1:1===i.opacity?1:e.depth>i.depth?-1:1:e.depth<i.depth?-1:1),z)){let n=r.nodeInfo,c=n.node,d=e.a6.mat4.multiply([],_,r.tileModelMatrix);e.a6.mat4.multiply(d,f,d);let p=e.a6.mat4.invert([],d);e.a6.mat4.transpose(p,p),e.a6.mat4.scale(p,p,aL),d=e.a6.mat4.multiply(d,d,c.matrix);let m="light-beam"===i.renderPass,g=R&e.dj.HasMapboxMeshFeatures,v=g?0:n.evaluatedRMEA[0][2];for(let e=0;e<c.meshes.length;++e){let f;let _=c.meshes[e],w=e===c.lightMeshIndex,T=r.wvpForNode;if(w){if(!m&&!i.terrain&&i.shadowRenderer){i.currentLayer<i.firstLightBeamLayer&&(i.firstLightBeamLayer=i.currentLayer);continue}T=r.wvpForTile}else if(m)continue;let S={defines:[]},M=[];if(!b&&u&&(u.useNormalOffset=!!_.normalBuffer),aA(S.defines,M,_,i,a.lut),g||S.defines.push("DIFFUSE_SHADED"),A&&S.defines.push("SHADOWS_SINGLE_CASCADE"),E&&(b?E.numRenderedVerticesInShadowPass+=_.vertexArray.length:E.numRenderedVerticesInTransparentPass+=_.vertexArray.length),b){aC(_,r.nodeModelMatrix,i,a);continue}let I=null;if(h){let e=aE(r.nodeModelMatrix,i.transform);if(I=new Float32Array(e),"globe"!==l.projection.name){let i=_.aabb.min,r=_.aabb.max,[a,n]=h.getOpacityForBounds(e,i[0],i[1],r[0],r[1]);S.overrideFog=a>=.05||n>=.05}}let C=_.material;C.occlusionTexture&&C.occlusionTexture.offsetScale&&(f=C.occlusionTexture.offsetScale,S.defines.push("OCCLUSION_TEXTURE_TRANSFORM"));let P=i.getOrCreateProgram("model",S);!b&&u&&u.setupShadowsFromMatrix(r.tileModelMatrix,P,u.useNormalOffset),i.uploadCommonUniforms(s,P,null,I);let L=C.pbrMetallicRoughness;L.metallicFactor=.9,L.roughnessFactor=.5;let k=rX(new Float32Array(T),new Float32Array(d),new Float32Array(p),new Float32Array(c.matrix),i,r.opacity,L.baseColorFactor.toRenderColor(null),C.emissiveFactor,L.metallicFactor,L.roughnessFactor,C,v,a,[0,0,0],f);!w&&(n.hasTranslucentParts||r.opacity<1)&&P.draw(i,s.gl.TRIANGLES,y,tY.disabled,tZ.disabled,tJ.backCCW,k,a.id,_.vertexBuffer,_.indexBuffer,_.segments,a.paint,i.transform.zoom,void 0,M),P.draw(i,s.gl.TRIANGLES,w?x:y,tY.disabled,w||r.opacity<1||n.hasTranslucentParts?tZ.alphaBlended:tZ.unblended,tJ.backCCW,k,a.id,_.vertexBuffer,_.indexBuffer,_.segments,a.paint,i.transform.zoom,void 0,M)}}}}()}(i,r,a,n),void c();if("model"!==d.type)return;let p=d.getModels(),f=[],m=i.transform.getFreeCameraOptions().position,_=e.a6.vec3.scale([],[m.x,m.y,m.z],i.transform.worldSize);e.a6.vec3.negate(_,_);let g=[],y=[],x=0;for(let r of p){let n=a.paint.get("model-rotation").constantOr(null),s=a.paint.get("model-scale").constantOr(null),l=a.paint.get("model-translation").constantOr(null);r.computeModelMatrix(i,n,s,l,!0,!0,!1);let h=e.a6.mat4.identity([]),u=e.de(r.position.lat,i.transform.zoom),c=e.a6.mat4.fromScaling([],[1,1,1/u]);for(let a of(e.a6.mat4.translate(h,h,_),f.push({zScaleMatrix:c,negCameraPosMatrix:h}),r.nodes))!function i(r,a,n,s,l,h,u){let c;c="globe"===r.projection.name?e.dg(n,r):[...n],e.a6.mat4.multiply(c,c,a.matrix);let d=e.a6.mat4.multiply([],s,c);if(a.meshes)for(let i of a.meshes){if("BLEND"!==i.material.alphaMode){u.push({mesh:i,depth:0,modelIndex:l,worldViewProjection:d,nodeModelMatrix:c});continue}let r=e.a6.vec3.transformMat4([],i.centroid,d);r[2]>0&&h.push({mesh:i,depth:r[2],modelIndex:l,worldViewProjection:d,nodeModelMatrix:c})}if(a.children)for(let e of a.children)i(r,e,n,s,l,h,u)}(i.transform,a,r.matrix,i.transform.expandedFarZProjMatrix,x,g,y);x++}if(g.sort((e,i)=>i.depth-e.depth),"shadow"!==i.renderPass){if(1===s)for(let e of y)aI(e,i,a,f[e.modelIndex],tY.disabled,i.colorModeForRenderPass());else{for(let e of y)aI(e,i,a,f[e.modelIndex],tY.disabled,tZ.disabled);for(let e of y)aI(e,i,a,f[e.modelIndex],i.stencilModeFor3D(),i.colorModeForRenderPass());i.resetStencilClippingMasks()}for(let e of g)aI(e,i,a,f[e.modelIndex],tY.disabled,i.colorModeForRenderPass());c()}else{for(let e of y)aC(e.mesh,e.nodeModelMatrix,i,a);for(let e of g)aC(e.mesh,e.nodeModelMatrix,i,a);c()}}},aB={model:function(e,i,r){let a=i.getSource();if(a.loaded()){if("vector"===a.type||"geojson"===a.type)return void(r.modelManager&&r.modelManager.upload(r,"vector"===a.type?e.scope:""));if("batched-model"!==a.type&&"model"===a.type)for(let e of a.getModels())e.upload(r.context)}},raster:function(e,i,r){let a=i.getSource();if(!(a instanceof eW&&a.loaded()))return;let n=e.sourceLayer||a.rasterLayerIds&&a.rasterLayerIds[0];if(!n)return;let s=e.paint.get("raster-array-band")||a.getInitialBand(n);if(null!=s)for(let e of i.getIds().map(e=>i.getTileByID(e)))e.updateNeeded(n,s)&&a.prepareTile(e,n,s)},"raster-particle":function(e,i,r){let a=i.getSource();if(!(a instanceof eW&&a.loaded()))return;let n=e.sourceLayer||a.rasterLayerIds&&a.rasterLayerIds[0];if(!n)return;let s=e.paint.get("raster-particle-array-band")||a.getInitialBand(n);if(null!=s)for(let e of i.getIds().map(e=>i.getTileByID(e)))e.updateNeeded(n,s)&&a.prepareTile(e,n,s)}};class aF{constructor(i,r,a,n,s){this.context=new r2(i,r),this.transform=a,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.tp=s,this._timeStamp=e.q.now(),this._averageFPS=0,this._fpsHistory=[],this._dt=0,this._debugParams={forceEnablePrecipitation:!1,showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,enabledLayers:{}};let l=["fill","line","symbol","circle","heatmap","fill-extrusion","raster","raster-particle","hillshade","model","background","sky"];for(let e of l)this._debugParams.enabledLayers[e]=!0;for(let e of(s.registerParameter(this._debugParams,["Terrain"],"showTerrainProxyTiles",{},()=>{this.style.map.triggerRepaint()}),s.registerParameter(this._debugParams,["Precipitation"],"forceEnablePrecipitation"),s.registerParameter(this._debugParams,["FPS"],"fpsWindow",{min:1,max:100,step:1}),s.registerBinding(this._debugParams,["FPS"],"continousRedraw",{readonly:!0,label:"continuous redraw"}),s.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"value"}),s.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"graph",view:"graph",min:0,max:200}),l))s.registerParameter(this._debugParams.enabledLayers,["Debug","Layers"],e);this.occlusionParams=new az(s),this.setup(),this.numSublayers=e6.maxUnderzooming+e6.maxOverzooming+1,this.depthEpsilon=1/65536,this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new e.dl,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new ii(this),this._wireframeDebugCache=new aR,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];let h=new e.r({width:1,height:1},Uint8Array.of(0,0,0,0));
303this.emptyDepthTexture=new e.T(this.context,h,i.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=n}updateTerrain(e,i){let r=!!e&&!!e.terrain&&this.transform.projection.supportsTerrain;if(!(r||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new rv(this,e));let a=this._terrain;this.transform.elevation=r?a:null,a.update(e,this.transform,i),this.transform.elevation&&!a.enabled&&(this.transform.elevation=null)}_updateFog(e){let i=e.fog;if(!i||"globe"===this.transform.projection.name||1>i.getOpacity(this.transform.pitch)||.03>i.properties.get("horizon-blend"))return void(this.transform.fogCullDistSq=null);let[r,a]=i.getFovAdjustedRange(this.transform._fov);if(r>a)return void(this.transform.fogCullDistSq=null);let n=r+.78*(a-r);this.transform.fogCullDistSq=n*n}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled||this._forceTerrainMode?this._terrain:null}get forceTerrainMode(){return this._forceTerrainMode}set forceTerrainMode(e){e&&!this._terrain&&(this._terrain=new rv(this,this.style)),this._forceTerrainMode=e}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(i,r){if(this.width=i*e.q.devicePixelRatio,this.height=r*e.q.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let e of this.style.order)this.style._mergedLayers[e].resize()}setup(){let i=this.context,r=new e.a$;r.emplaceBack(0,0),r.emplaceBack(e.ab,0),r.emplaceBack(0,e.ab),r.emplaceBack(e.ab,e.ab),this.tileExtentBuffer=i.createVertexBuffer(r,e.b1.members),this.tileExtentSegments=e.b2.simpleSegment(0,0,4,2);let a=new e.a$;a.emplaceBack(0,0),a.emplaceBack(e.ab,0),a.emplaceBack(0,e.ab),a.emplaceBack(e.ab,e.ab),this.debugBuffer=i.createVertexBuffer(a,e.b1.members),this.debugSegments=e.b2.simpleSegment(0,0,4,5);let n=new e.a$;n.emplaceBack(-1,-1),n.emplaceBack(1,-1),n.emplaceBack(-1,1),n.emplaceBack(1,1),this.viewportBuffer=i.createVertexBuffer(n,e.b1.members),this.viewportSegments=e.b2.simpleSegment(0,0,4,2);let s=new e.aO;s.emplaceBack(0,0,0,0),s.emplaceBack(e.ab,0,e.ab,0),s.emplaceBack(0,e.ab,0,e.ab),s.emplaceBack(e.ab,e.ab,e.ab,e.ab),this.mercatorBoundsBuffer=i.createVertexBuffer(s,e.b4.members),this.mercatorBoundsSegments=e.b2.simpleSegment(0,0,4,2);let l=new e.aP;l.emplaceBack(0,1,2),l.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=i.createIndexBuffer(l);let h=new e.b0;for(let e of[0,1,3,2,0])h.emplaceBack(e);this.debugIndexBuffer=i.createIndexBuffer(h),this.emptyTexture=new e.T(i,new e.r({width:1,height:1},Uint8Array.of(0,0,0,0)),i.gl.RGBA8),this.identityMat=e.a6.mat4.create();let u=this.context.gl;this.stencilClearMode=new tY({func:u.ALWAYS,mask:0},0,255,u.ZERO,u.ZERO,u.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(e){return e._makeTileBoundsBuffers(this.context,this.transform.projection),e._tileBoundsBuffer?{tileBoundsBuffer:e._tileBoundsBuffer,tileBoundsIndexBuffer:e._tileBoundsIndexBuffer,tileBoundsSegments:e._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){let e=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,e.TRIANGLES,tX.disabled,this.stencilClearMode,tZ.disabled,tJ.disabled,rm(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(e,i,r){if(!i||this.currentStencilSource===i.id||!e.isTileClipped()||!r||0===r.length)return;if(this._tileClippingMaskIDs&&!this.terrain){let e=!1;for(let i of r)if(void 0===this._tileClippingMaskIDs[i.key]){e=!0;break}if(!e)return}this.currentStencilSource=i.id;let a=this.context,n=a.gl;this.nextStencilID+r.length>256&&this.clearStencil(),a.setColorMode(tZ.disabled),a.setDepthMode(tX.disabled);let s=this.getOrCreateProgram("clippingMask");for(let e of(this._tileClippingMaskIDs={},r)){let r=i.getTile(e),a=this._tileClippingMaskIDs[e.key]=this.nextStencilID++,{tileBoundsBuffer:l,tileBoundsIndexBuffer:h,tileBoundsSegments:u}=this.getTileBoundsBuffers(r);s.draw(this,n.TRIANGLES,tX.disabled,new tY({func:n.ALWAYS,mask:0},a,255,n.KEEP,n.KEEP,n.REPLACE),tZ.disabled,tJ.disabled,rm(e.projMatrix),"$clipping",l,h,u)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let e=this.nextStencilID++,i=this.context.gl;return new tY({func:i.NOTEQUAL,mask:255},e,255,i.KEEP,i.KEEP,i.REPLACE)}stencilModeForClipping(e){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(e);let i=this.context.gl;return new tY({func:i.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,i.KEEP,i.KEEP,i.REPLACE)}stencilConfigForOverlap(e){let i=this.context.gl,r=e.sort((e,i)=>
303i.overscaledZ-e.overscaledZ),a=r[r.length-1].overscaledZ,n=r[0].overscaledZ-a+1;if(n>1){this.currentStencilSource=void 0,this.nextStencilID+n>256&&this.clearStencil();let e={};for(let r=0;r<n;r++)e[r+a]=new tY({func:i.GEQUAL,mask:255},r+this.nextStencilID,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID+=n,[e,r]}return[{[a]:tY.disabled},r]}colorModeForRenderPass(){let i=this.context.gl;if(this._showOverdrawInspector){let r=1/8;return new tZ([i.CONSTANT_COLOR,i.ONE,i.CONSTANT_COLOR,i.ONE],new e.bA(r,r,r,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?tZ.unblended:tZ.alphaBlended}colorModeForDrapableLayerRenderPass(i){let r=this.context.gl;return this.style&&this.style.enable3dLights()&&this.terrain&&this.terrain.renderingToTexture&&"translucent"===this.renderPass?new tZ([r.ONE,r.ONE_MINUS_SRC_ALPHA,r.CONSTANT_ALPHA,r.ONE_MINUS_SRC_ALPHA],new e.bA(0,0,0,void 0===i?0:i),[!0,!0,!0,!0]):this.colorModeForRenderPass()}depthModeForSublayer(e,i,r,a=!1){if(this.depthOcclusion)return new tX(this.context.gl.GREATER,tX.ReadOnly,this.depthRangeFor3D);if(!this.opaquePassEnabledForLayer()&&!a)return tX.disabled;let n=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new tX(r||this.context.gl.LEQUAL,i,[n,n])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}blitDepth(){let i=this.context.gl,r=Math.ceil(this.width),a=Math.ceil(this.height),n=this.context.bindFramebuffer.get(),s=i.getParameter(i.TEXTURE_BINDING_2D);this.depthFBO&&this.depthFBO.width===r&&this.depthFBO.height===a||(this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),0!==r&&0!==a&&(this.depthFBO=new r1(this.context,r,a,!1,"texture"),this.depthTexture=new e.T(this.context,{width:r,height:a,data:null},i.DEPTH24_STENCIL8),this.depthFBO.depthAttachment.set(this.depthTexture.texture))),this.context.bindFramebuffer.set(n),i.bindTexture(i.TEXTURE_2D,s),this.depthFBO&&(i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,this.depthFBO.framebuffer),i.blitFramebuffer(0,0,r,a,0,0,r,a,i.DEPTH_BUFFER_BIT,i.NEAREST),i.bindFramebuffer(i.FRAMEBUFFER,this.context.bindFramebuffer.current))}updateAverageFPS(){this._fpsHistory.push(0===this._dt?0:1e3/this._dt),this._fpsHistory.length>this._debugParams.fpsWindow&&this._fpsHistory.splice(0,this._fpsHistory.length-this._debugParams.fpsWindow),this._averageFPS=Math.round(this._fpsHistory.reduce((e,i)=>e+i/this._fpsHistory.length,0))}render(i,r){let a=e.q.now();this._dt=a-this._timeStamp,this._timeStamp=a,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=i.map.repaint,this.style=i,this.options=r;let n=this.style._mergedLayers,s=this.style._getOrder(!(!this.terrain||!this.terrain.enabled)).filter(e=>{let i=n[e];return!(i.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[i.type]}),l=!1,h=!1;for(let e of s){let i=n[e];"circle"===i.type&&(l=!0),"symbol"===i.type&&(i.hasInitialOcclusionOpacityProperties?h=!0:l=!0)}let u=s.map(e=>n[e]),c=this.style._mergedSourceCaches;this.imageManager=i.imageManager,this.modelManager=i.modelManager,this.symbolFadeChange=i.placement.symbolFadeChange(e.q.now()),this.imageManager.beginFrame();let d=0,p=!1;for(let e in c){let i=c[e];i.used&&(i.prepare(this.context),i.getSource().usedInConflation&&++d)}let f=!1;for(let e of u)e.isHidden(this.transform.zoom)||("clip"===e.type&&(f=!0),this.prepareLayer(e));let m={},_={},g={},y={},x={};for(let e in c){let i=c[e];m[e]=i.getVisibleCoordinates(),_[e]=m[e].slice().reverse(),g[e]=i.getVisibleCoordinates(!0).reverse(),y[e]=i.getShadowCasterCoordinates(),x[e]=i.sortCoordinatesByDistance(m[e])}let v=e=>{let i=this.style.getLayerSourceCache(e);return i&&i.used?i.getSource():null};if(d||f||this._clippingActiveLastFrame){let i=[],r=[],a=0;for(let e of u)this.isSourceForClippingOrConflation(e,v(e))&&(i.push(e),r.push(a)),a++;if(i&&(f||i.length>1)||this._clippingActiveLastFrame){f=!1;let a=[];for(let n=0;n<i.length;n++){let s=i[n],l=r[n],h=this.style.getLayerSourceCache(s);if(!h||!h.used||!h.getSource().usedInConflation&&"clip"!==s.type)continue;let u=e.dn,c=e.bt.None,d=[],p=!0;
303if("clip"===s.type){for(let i of(u=l,s.layout.get("clip-layer-types")))c|="model"===i?e.bt.Model:"symbol"===i?e.bt.Symbol:e.bt.FillExtrusion;for(let e of s.layout.get("clip-layer-scope"))d.push(e);s.isHidden(this.transform.zoom)?p=!1:f=!0}p&&a.push({layer:s.fqid,cache:h,order:u,clipMask:c,clipScope:d})}this.replacementSource.setSources(a),p=!0}}this._clippingActiveLastFrame=f,p||this.replacementSource.clear(),this.conflationActive=p,this.minCutoffZoom=0,this.longestCutoffRange=0,this.opaquePassCutoff=1/0,this._lastOcclusionLayer=-1,this.layersWithOcclusionOpacity=[];for(let e=0;e<u.length;e++){let i=u[e],r=i.cutoffRange();if(this.longestCutoffRange=Math.max(r,this.longestCutoffRange),r>0){let e=v(i);e&&(this.minCutoffZoom=Math.max(e.minzoom,this.minCutoffZoom)),i.minzoom&&(this.minCutoffZoom=Math.max(i.minzoom,this.minCutoffZoom))}i.is3D()&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=e),this._lastOcclusionLayer=e)}let b=this.style&&this.style.fog;b?(this._fogVisible=0!==b.getOpacity(this.transform.pitch),this._fogVisible&&"globe"!==this.transform.projection.name&&(this._fogVisible=b.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(g),this.opaquePassCutoff=0);let w=this._shadowRenderer;if(w)for(let e in w.updateShadowParameters(this.transform,this.style.directionalLight),c)for(let i of m[e]){let e={min:0,max:0};this.terrain&&(e=this.terrain.getMinMaxForTile(i)||e),w.addShadowReceiver(i.toUnwrapped(),e.min,e.max)}if("globe"!==this.transform.projection.name||this.globeSharedBuffers||(this.globeSharedBuffers=new e.dm(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new aM(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),!W.has(this.context.gl))return;for(let e of(this.renderPass="offscreen",u)){let r=i.getLayerSourceCache(e);if(!e.hasOffscreenPass()||e.isHidden(this.transform.zoom))continue;let a=r?_[r.id]:void 0;("custom"===e.type||"raster"===e.type||"raster-particle"===e.type||e.isSky()||a&&a.length)&&this.renderLayer(this,r,e,a)}this.depthRangeFor3D=[0,1-(u.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,y)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);let T="globe"===this.transform.projection.name||this.transform.isHorizonVisible(),S=(()=>{if(r.showOverdrawInspector)return e.bA.black;let i=this.style.fog;if(i&&this.transform.projection.supportsFog){let r=this.style.getLut(i.scope);if(!T){let a=i.properties.get("color").toRenderColor(r).toArray01();return new e.bA(...a)}if(T){let a=i.properties.get("space-color").toRenderColor(r).toArray01();return new e.bA(...a)}}return e.bA.transparent})();if(this.context.clear({color:S,depth:1}),this.clearStencil(),this._showOverdrawInspector=r.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&T&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=s.length-1;this.currentLayer>=0;this.currentLayer--){let e=u[this.currentLayer],r=i.getLayerSourceCache(e);if(e.isSky())continue;let a=r?(e.is3D()?x:_)[r.id]:void 0;this._renderTileClippingMasks(e,r,a),this.renderLayer(this,r,e,a)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&T&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||e.a9(this.transform.zoom)>0)&&("globe"===this.transform.projection.name||this.transform.isHorizonVisible()))for(this.currentLayer=0;this.currentLayer<s.length;this.currentLayer++){let e=u[this.currentLayer],r=i.getLayerSourceCache(e);e.isSky()&&this.renderLayer(this,r,e,r?_[r.id]:void 0)}function M(e,i){let r;return i&&(r=("symbol"===e.type?g:e.is3D()?x:_)[i.id]),r}if(this.renderPass="translucent","globe"===this.transform.projection.name){for(this.renderElevatedRasterBackface=!0,this.currentLayer=0;this.currentLayer<s.length;){let e=u[this.currentLayer];if("raster"===e.type||"raster-particle"===e.type){let r=i.getLayerSourceCache(e);this.renderLayer(this,r,e,M(e,r))}++this.currentLayer}this.renderElevatedRasterBackface=!1}this.currentLayer=0,this.firstLightBeamLayer=Number.MAX_SAFE_INTEGER;let E=0;w&&(E=w.getShadowCastingLayerCount());let A=!1,I=-1;for(let e=0;e<s.length;++e){let i=u[e];i.isHidden(this.transform.zoom)||i.is3D()&&(I=e)}for(h&&-1===I&&(l=!0);this.currentLayer<s.length;){let e=u[this.currentLayer],r=i.getLayerSourceCache(e);if(e.isSky())++this.currentLayer;else if(this.terrain&&this.style.isLayerDraped(e)){if(e.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer),this._lastOcclusionLayer=Math.max(this.currentLayer,this._lastOcclusionLayer)}else{if(l&&!A&&this.terrain&&!this.transform.isOrthographic&&(A=!0,this.blitDepth()),h&&-1!==I&&this.currentLayer===I+1&&!this.transform.isOrthographic&&this.blitDepth(),e.is3D()||this.terrain||this._renderTileClippingMasks(e,r,r?m[r.id]:void 0),this.renderLayer(this,r,e,M(e,r)),!this.terrain&&w&&E>0&&e.hasShadowPass()&&0==--E&&(w.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer)){let e=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=e;this.currentLayer++){let e=u[this.currentLayer];if(!e.hasLightBeamPass())continue;let r=i.getLayerSourceCache(e);this.renderLayer(this,r,e,r?_[r.id]:void 0)}this.currentLayer=e,this.renderPass="translucent"}if(this.currentLayer>=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){let e=this.currentLayer;for(let e of(this.depthOcclusion=!0,this.layersWithOcclusionOpacity)){this.currentLayer=e;let r=u[this.currentLayer],a=i.getLayerSourceCache(r),n=a?_[a.id]:void 0;r.is3D()||this.terrain||this._renderTileClippingMasks(r,a,a?m[a.id]:void 0),this.renderLayer(this,a,r,n)}this.depthOcclusion=!1,this.currentLayer=e,this.renderPass="translucent",this.layersWithOcclusionOpacity=[]}++this.currentLayer}}if(this.terrain&&this.terrain.postRender(),this.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){let r=null;
303u.forEach(e=>{let a=i.getLayerSourceCache(e);a&&!e.isHidden(this.transform.zoom)&&a.getVisibleCoordinates().length&&(!r||r.getSource().maxzoom<a.getSource().maxzoom)&&(r=a)}),r&&this.options.showTileBoundaries&&aO.debug(this,r,r.getVisibleCoordinates(),e.bA.red,!1,this.options.showParseStatus)}this.terrain&&this._debugParams.showTerrainProxyTiles&&aO.debug(this,this.terrain.proxySourceCache,this.terrain.proxyCoords,new e.bA(1,.8,.1,1),!0,this.options.showParseStatus),this.options.showPadding&&function(e){var i,r;let a=e.transform.padding;af(e,e.transform.height-(a.top||0),3,al),af(e,a.bottom||0,3,ah),am(e,a.left||0,3,au),am(e,e.transform.width-(a.right||0),3,ac);let n=e.transform.centerPoint;i=n.x,r=e.transform.height-n.y,a_(e,i-1,r-10,2,20,ad),a_(e,i-10,r-1,20,2,ad)}(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(performance.now()),this.saveCanvasCopy()),p||(this.conflationActive=!1)}prepareLayer(e){this.gpuTimingStart(e);let{unsupportedLayers:i}=this.transform.projection,r=!i||!i.includes(e.type);if(aB[e.type]&&(r||this.terrain&&"custom"===e.type)){let i=this.style.getLayerSourceCache(e);aB[e.type](e,i,this)}this.gpuTimingEnd()}renderLayer(e,i,r,a){r.isHidden(this.transform.zoom)||("background"===r.type||"sky"===r.type||"custom"===r.type||"model"===r.type||"raster"===r.type||"raster-particle"===r.type||a&&a.length)&&(this.id=r.id,this.gpuTimingStart(r),e.transform.projection.unsupportedLayers&&e.transform.projection.unsupportedLayers.includes(r.type)&&(!e.terrain||"custom"!==r.type)||"clip"===r.type||aO[r.type](e,i,r,a,this.style.placement.variableOffsets,this.options.isInitialLoad),this.gpuTimingEnd())}gpuTimingStart(e){if(!this.options.gpuTiming)return;let i=this.context.extTimerQuery,r=this.context.gl,a=this.gpuTimers[e.id];a||(a=this.gpuTimers[e.id]={calls:0,cpuTime:0,query:r.createQuery()}),a.calls++,r.beginQuery(i.TIME_ELAPSED_EXT,a.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){let e=this.context.extTimerQuery,i=this.context.gl,r=i.createQuery();this.deferredRenderGpuTimeQueries.push(r),i.beginQuery(e.TIME_ELAPSED_EXT,r)}}gpuTimingDeferredRenderEnd(){this.options.gpuTimingDeferredRender&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}gpuTimingEnd(){this.options.gpuTiming&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}collectGpuTimers(){let e=this.gpuTimers;return this.gpuTimers={},e}collectDeferredRenderGpuQueries(){let e=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],e}queryGpuTimers(e){let i={};for(let r in e){let a=e[r],n=this.context.extTimerQuery,s=n.getQueryParameter(a.query,this.context.gl.QUERY_RESULT)/1e6;n.deleteQueryEXT(a.query),i[r]=s}return i}queryGpuTimeDeferredRender(e){if(!this.options.gpuTimingDeferredRender)return 0;let i=this.context.gl,r=0;for(let a of e)r+=i.getQueryParameter(a,i.QUERY_RESULT)/1e6,i.deleteQuery(a);return r}translatePosMatrix(i,r,a,n,s){if(!a[0]&&!a[1])return i;let l=s?"map"===n?this.transform.angle:0:"viewport"===n?-this.transform.angle:0;if(l){let e=Math.sin(l),i=Math.cos(l);a=[a[0]*i-a[1]*e,a[0]*e+a[1]*i]}let h=[s?a[0]:e.ak(r,a[0],this.transform.zoom),s?a[1]:e.ak(r,a[1],this.transform.zoom),0],u=new Float32Array(16);return e.a6.mat4.translate(u,i,h),u}saveTileTexture(e){let i=e.size[0],r=this._tileTextures[i];r?r.push(e):this._tileTextures[i]=[e]}getTileTexture(e){let i=this._tileTextures[e];return i&&i.length>0?i.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return null!=this.context.extTextureFloatLinear}currentGlobalDefines(e,i,r){let a=void 0===r?this.terrain&&this.terrain.renderingToTexture:r,n=[];return this.style&&this.style.enable3dLights()&&("globeRaster"===e||"terrainRaster"===e?(n.push("LIGHTING_3D_MODE"),n.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):a||n.push("LIGHTING_3D_MODE")),"shadow"===this.renderPass&&(this._shadowMapDebug||n.push("DEPTH_TEXTURE")),this.terrainRenderModeElevated()&&(n.push("TERRAIN"),this.linearFloatFilteringSupported()&&n.push("TERRAIN_DEM_FLOAT_FORMAT")),"globe"===this.transform.projection.name&&n.push("GLOBE"),this._fogVisible&&!a&&(void 0===i||i)&&n.push("FOG","FOG_DITHERING"),a&&n.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&n.push("OVERDRAW_INSPECTOR"),n}getOrCreateProgram(e,i){this.cache=this.cache||{};let r=i&&i.defines||[],a=i&&i.config,n=this.currentGlobalDefines(e,i&&i.overrideFog,i&&i.overrideRtt).concat(r),s=rT.cacheKey(iL[e],e,n,a);
303return this.cache[s]||(this.cache[s]=new rT(this.context,e,iL[e],a,rJ[e],n)),this.cache[s]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){let 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 e.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA8))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy(),this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),this.emptyDepthTexture&&this.emptyDepthTexture.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(i,r){if(this.style.enable3dLights()){let a=this.style.directionalLight,n=this.style.ambientLight;if(a&&n){let s=((i,r,a)=>{let n=i.properties.get("direction"),s=i.properties.get("color").toRenderColor(a.getLut(i.scope)).toArray01(),l=i.properties.get("intensity"),h=r.properties.get("color").toRenderColor(a.getLut(r.scope)).toArray01(),u=r.properties.get("intensity"),c=[n.x,n.y,n.z],d=e.cH(h,u),p=e.cH(s,l);return{u_lighting_ambient_color:d,u_lighting_directional_dir:c,u_lighting_directional_color:p,u_ground_radiance:function(i,r,a){let n=function(i,r,a){let n,s,l;let h=e.a6.vec3.dot(r,i),u=(n=1-.3*Math.min(e.a6.vec3.dot(a,[.2126,.7152,.0722]),1),(1-(s=Math.min(h+1,1)))*n+ +s);return((1-(l=Math.asin(e.ap(r[2],-1,1))/Math.PI+.5))*.92+ +l)*u}(i,[0,0,1],r),s=[0,0,0];e.a6.vec3.scale(s,a.slice(0,3),n);let l=[0,0,0];e.a6.vec3.scale(l,r.slice(0,3),i[2]);let h=[0,0,0];return e.a6.vec3.add(h,s,l),e.cc(h)}(c,p,d)}})(a,n,this.style);r.setLightsUniformValues(i,s)}}}uploadCommonUniforms(i,r,a,n,s){if(this.uploadCommonLightUniforms(i,r),this.terrain&&this.terrain.renderingToTexture)return;let l=this.style.fog;if(l){let s=l.getOpacity(this.transform.pitch),h=((i,r,a,n,s,l,h,u,c,d,p,f)=>{let m=i.transform,_=r.properties.get("color").toRenderColor(i.style.getLut(r.scope)).toArray01();_[3]=n;let g=i.frameCounter/1e3%1,[y,x]=r.properties.get("vertical-range");return{u_fog_matrix:a?m.calculateFogTileMatrix(a):f||i.identityMat,u_fog_range:r.getFovAdjustedRange(m._fov),u_fog_color:_,u_fog_horizon_blend:r.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(y,x),x],u_fog_temporal_offset:g,u_frustum_tl:s,u_frustum_tr:l,u_frustum_br:h,u_frustum_bl:u,u_globe_pos:c,u_globe_radius:d,u_viewport:p,u_globe_transition:e.a9(m.zoom),u_is_globe:+("globe"===m.projection.name)}})(this,l,a,s,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*e.q.devicePixelRatio,this.transform.height*e.q.devicePixelRatio],n);r.setFogUniformValues(i,h)}s&&r.setCutoffUniformValues(i,s.uniformValues)}setTileLoadedFlag(e){this.tileLoaded=e}saveCanvasCopy(){let e=this.canvasCopy();e&&(this.frameCopies.push(e),this.tileLoaded=!1)}canvasCopy(){let e=this.context.gl,i=e.createTexture();return e.bindTexture(e.TEXTURE_2D,i),e.copyTexImage2D(e.TEXTURE_2D,0,e.RGBA,0,0,e.drawingBufferWidth,e.drawingBufferHeight,0),i}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;let e=this.style&&this.style.fog;return!!e&&0!==e.getOpacity(this.transform.pitch)}
303getBackgroundTiles(){let e=this._backgroundTiles,i=this._backgroundTiles={};for(let r of this.transform.coveringTiles({tileSize:512}))i[r.key]=e[r.key]||new e2(r,512,this.transform.tileZoom,this);return i}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(e,i){return!(!e.is3D()||"clip"!==e.type&&(e.minzoom&&e.minzoom>this.transform.zoom||(this.style._clipLayerPresent||"building"!==e.sourceLayer)&&(!i||"batched-model"!==i.type)))}isTileAffectedByFog(e){if(!this.style||!this.style.fog)return!1;if("globe"===this.transform.projection.name)return!0;let i=this._cachedTileFogOpacities[e.key];return i||(this._cachedTileFogOpacities[e.key]=i=this.style.fog.getOpacityForTile(e)),i[0]>=.05||i[1]>=.05}setupDepthForOcclusion(e,i,r){var a;let n=this.context,s=n.gl,l=!!r;r||(r={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0}),n.activeTexture.set(s.TEXTURE3),e&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(s.NEAREST,s.CLAMP_TO_EDGE),r.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],r.u_depth_range_unpack=[2/((a=this.depthRangeFor3D)[1]-a[0]),-1-2*a[0]/(a[1]-a[0])],r.u_occluder_half_size=.5*this.occlusionParams.occluderSize,r.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.emptyDepthTexture.bind(s.NEAREST,s.CLAMP_TO_EDGE),n.activeTexture.set(s.TEXTURE0),l||i.setTerrainUniformValues(n,r)}}function aN(e,i){let r=!1,a=null,n=()=>{a=null,r&&(e(),a=setTimeout(n,i),r=!1)};return()=>(r=!0,a||n(),a)}class aV{constructor(i){this._hashName=i&&encodeURIComponent(i),e.aJ(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=aN(this._updateHashUnthrottled.bind(this),300)}addTo(e){return this._map=e,window.addEventListener("hashchange",this._onHashChange,!1),e.on("moveend",this._updateHash),this}remove(){return this._map&&(this._map.off("moveend",this._updateHash),window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0),this}getHashString(){let e=this._map;if(!e)return"";let i=aU(e);if(this._hashName){let e=this._hashName,r=!1,a=location.hash.slice(1).split("&").map(a=>{let n=a.split("=")[0];return n===e?(r=!0,`${n}=${i}`):a}).filter(e=>e);return r||a.push(`${e}=${i}`),`#${a.join("&")}`}return`#${i}`}_getCurrentHash(){let e=location.hash.replace("#","");if(this._hashName){let i;return e.split("&").map(e=>e.split("=")).forEach(e=>{e[0]===this._hashName&&(i=e)}),(i&&i[1]||"").split("/")}return e.split("/")}_onHashChange(){let e=this._map;if(!e)return!1;let i=this._getCurrentHash();if(i.length>=3&&!i.some(e=>isNaN(e))){let r=e.dragRotate.isEnabled()&&e.touchZoomRotate.isEnabled()?+(i[3]||0):e.getBearing();return e.jumpTo({center:[+i[2],+i[1]],zoom:+i[0],bearing:r,pitch:+(i[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function aU(e,i){let r=e.getCenter(),a=Math.round(100*e.getZoom())/100,n=Math.pow(10,Math.ceil((a*Math.LN2+Math.log(512/360/.5))/Math.LN10)),s=Math.round(r.lng*n)/n,l=Math.round(r.lat*n)/n,h=e.getBearing(),u=e.getPitch(),c=i?`/${s}/${l}/${a}`:`${a}/${l}/${s}`;return(h||u)&&(c+="/"+Math.round(10*h)/10),u&&(c+=`/${Math.round(u)}`),c}let aj={linearity:.3,easing:e.dp(0,0,.3,1)},aG=e.l({deceleration:2500,maxSpeed:1400},aj),aq=e.l({deceleration:20,maxSpeed:1400},aj),aW=e.l({deceleration:1e3,maxSpeed:360},aj),a$=e.l({deceleration:1e3,maxSpeed:90},aj);class aH{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(i){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:e.q.now(),settings:i})}_drainInertiaBuffer(){let i=this._inertiaBuffer,r=e.q.now();for(;i.length>0&&r-i[0].time>160;)i.shift()}_onMoveEnd(i){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;let r={zoom:0,bearing:0,pitch:0,pan:new e.P(0,0),pinchAround:void 0,around:void 0};for(let{settings:e}of this._inertiaBuffer)r.zoom+=e.zoomDelta||0,r.bearing+=e.bearingDelta||0,r.pitch+=e.pitchDelta||0,e.panDelta&&r.pan._add(e.panDelta),e.around&&(r.around=e.around),e.pinchAround&&(r.pinchAround=e.pinchAround);let a=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,n={};if(r.pan.mag()){let s=aX(r.pan.mag(),a,e.l({},aG,i||{}));n.offset=r.pan.mult(s.amount/r.pan.mag()),n.center=this._map.transform.center,aZ(n,s)}if(r.zoom){let e=aX(r.zoom,a,aq);n.zoom=this._map.transform.zoom+e.amount,aZ(n,e)}if(r.bearing){let i=aX(r.bearing,a,aW);
303n.bearing=this._map.transform.bearing+e.ap(i.amount,-179,179),aZ(n,i)}if(r.pitch){let e=aX(r.pitch,a,a$);n.pitch=this._map.transform.pitch+e.amount,aZ(n,e)}if(n.zoom||n.bearing){let e=void 0===r.pinchAround?r.around:r.pinchAround;n.around=e?this._map.unproject(e):this._map.getCenter()}return this.clear(),n.noMoveStart=!0,n}}function aZ(e,i){(!e.duration||e.duration<i.duration)&&(e.duration=i.duration,e.easing=i.easing)}function aX(i,r,a){let{maxSpeed:n,linearity:s,deceleration:l}=a,h=e.ap(i*s/(r/1e3),-n,n),u=Math.abs(h)/(l*s);return{easing:a.easing,duration:1e3*u,amount:u/2*h}}class aY extends e.x{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,r,a,n={}){let s=T(r.getCanvasContainer(),a);super(i,e.l({point:s,lngLat:r.unproject(s),originalEvent:a},n)),this._defaultPrevented=!1,this.target=r}}class aJ extends e.x{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,r,a){let n="touchend"===i?a.changedTouches:a.touches,s=S(r.getCanvasContainer(),n),l=s.map(e=>r.unproject(e)),h=s.reduce((e,i,r,a)=>e.add(i.div(a.length)),new e.P(0,0));super(i,{points:s,point:h,lngLats:l,lngLat:r.unproject(h),originalEvent:a}),this._defaultPrevented=!1}}class aK extends e.x{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i){super("wheel",{originalEvent:i}),this._defaultPrevented=!1}}class aQ{constructor(e,i){this._map=e,this._clickTolerance=i.clickTolerance}reset(){this._mousedownPos=void 0}wheel(e){return this._firePreventable(new aK(this._map,e))}mousedown(e,i){return this._mousedownPos=i,this._firePreventable(new aY(e.type,this._map,e))}mouseup(e){this._map.fire(new aY(e.type,this._map,e))}preclick(i){let r=e.l({},i);r.type="preclick",this._map.fire(new aY(r.type,this._map,r))}click(e,i){this._mousedownPos&&this._mousedownPos.dist(i)>=this._clickTolerance||(this.preclick(e),this._map.fire(new aY(e.type,this._map,e)))}dblclick(e){return this._firePreventable(new aY(e.type,this._map,e))}mouseover(e){this._map.fire(new aY(e.type,this._map,e))}mouseout(e){this._map.fire(new aY(e.type,this._map,e))}touchstart(e){return this._firePreventable(new aJ(e.type,this._map,e))}touchmove(e){this._map.fire(new aJ(e.type,this._map,e))}touchend(e){this._map.fire(new aJ(e.type,this._map,e))}touchcancel(e){this._map.fire(new aJ(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class a0{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(e){this._map.fire(new aY(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new aY("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._map.fire(new aY(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class a1{constructor(e,i){this._map=e,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=i.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,i){this.isEnabled()&&e.shiftKey&&0===e.button&&(x(),this._startPos=this._lastPos=i,this._active=!0)}mousemoveWindow(e,i){if(!this._active)return;let r=this._startPos,a=this._lastPos;if(!r||!a||a.equals(i)||!this._box&&i.dist(r)<this._clickTolerance)return;this._lastPos=i,this._box||(this._box=m("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",e));let n=Math.min(r.x,i.x),s=Math.max(r.x,i.x),l=Math.min(r.y,i.y),h=Math.max(r.y,i.y);this._map._requestDomTask(()=>{this._box&&(this._box.style.transform=`translate(${n}px,${l}px)`,this._box.style.width=s-n+"px",this._box.style.height=h-l+"px")})}mouseupWindow(i,r){if(!this._active)return;let a=this._startPos;if(a&&0===i.button){if(this.reset(),w(),a.x!==r.x||a.y!==r.y)return this._map.fire(new e.x("boxzoomend",{originalEvent:i})),{cameraAnimation:e=>e.fitScreenCoordinates(a,r,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",i)}}
303keydown(e){this._active&&27===e.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",e))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),v(),delete this._startPos,delete this._lastPos}_fireEvent(i,r){return this._map.fire(new e.x(i,{originalEvent:r}))}}function a2(e,i){let r={};for(let a=0;a<e.length;a++)r[e[a].identifier]=i[a];return r}class a3{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(i,r,a){(this.centroid||a.length>this.numTouches)&&(this.aborted=!0),this.aborted||(0===this.startTime&&(this.startTime=i.timeStamp),a.length===this.numTouches&&(this.centroid=function(i){let r=new e.P(0,0);for(let e of i)r._add(e);return r.div(i.length)}(r),this.touches=a2(a,r)))}touchmove(e,i,r){if(this.aborted||!this.centroid)return;let a=a2(r,i);for(let e in this.touches){let i=a[e];(!i||i.dist(this.touches[e])>30)&&(this.aborted=!0)}}touchend(e,i,r){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),0===r.length){let e=!this.aborted&&this.centroid;if(this.reset(),e)return e}}}class a4{constructor(e){this.singleTap=new a3(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(e,i,r){this.singleTap.touchstart(e,i,r)}touchmove(e,i,r){this.singleTap.touchmove(e,i,r)}touchend(e,i,r){let a=this.singleTap.touchend(e,i,r);if(a){let i=e.timeStamp-this.lastTime<500,r=!this.lastTap||30>this.lastTap.dist(a);if(i&&r||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=a,this.count===this.numTaps)return this.reset(),a}}}class a5{constructor(){this._zoomIn=new a4({numTouches:1,numTaps:2}),this._zoomOut=new a4({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,i,r){this._zoomIn.touchstart(e,i,r),this._zoomOut.touchstart(e,i,r)}touchmove(e,i,r){this._zoomIn.touchmove(e,i,r),this._zoomOut.touchmove(e,i,r)}touchend(e,i,r){let a=this._zoomIn.touchend(e,i,r),n=this._zoomOut.touchend(e,i,r);return a?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:i=>i.easeTo({duration:300,zoom:i.getZoom()+1,around:i.unproject(a)},{originalEvent:e})}):n?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:i=>i.easeTo({duration:300,zoom:i.getZoom()-1,around:i.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}}let a6={0:1,2:2};class a8{constructor(e){this.reset(),this._clickTolerance=e.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(e,i){return!1}_move(e,i){return{}}mousedown(e,i){if(this._lastPoint)return;let r=M(e);this._correctButton(e,r)&&(this._lastPoint=i,this._eventButton=r)}mousemoveWindow(e,i){let r=this._lastPoint;if(r){if(e.preventDefault(),null!=this._eventButton&&function(e,i){let r=a6[i];return void 0===e.buttons||(e.buttons&r)!==r}(e,this._eventButton))this.reset();else if(this._moved||!(i.dist(r)<this._clickTolerance))return this._moved=!0,this._lastPoint=i,this._move(r,i)}}mouseupWindow(e){this._lastPoint&&M(e)===this._eventButton&&(this._moved&&w(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class a9 extends a8{mousedown(e,i){super.mousedown(e,i),this._lastPoint&&(this._active=!0)}_correctButton(e,i){return 0===i&&!e.ctrlKey}_move(e,i){return{around:i,panDelta:i.sub(e)}}}class a7 extends a8{_correctButton(e,i){return 0===i&&e.ctrlKey||2===i}_move(e,i){let r=.8*(i.x-e.x);if(r)return this._active=!0,{bearingDelta:r}}contextmenu(e){e.preventDefault()}}class ne extends a8{_correctButton(e,i){return 0===i&&e.ctrlKey||2===i}_move(e,i){let r=-.5*(i.y-e.y);if(r)return this._active=!0,{pitchDelta:r}}contextmenu(e){e.preventDefault()}}class nt{constructor(i,r){this._map=i,this._el=i.getCanvasContainer(),this._minTouches=1,this._clickTolerance=r.clickTolerance||1,this.reset(),e.aJ(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new e.P(0,0)}touchstart(e,i,r){return this._calculateTransform(e,i,r)}touchmove(i,r,a){if(this._active&&!(a.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(1===a.length&&!e.dq())return void this._showTouchPanBlockerAlert();
303"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return i.cancelable&&i.preventDefault(),this._calculateTransform(i,r,a)}}touchend(e,i,r){this._calculateTransform(e,i,r),this._active&&r.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(i,r,a){a.length>0&&(this._active=!0);let n=a2(a,r),s=new e.P(0,0),l=new e.P(0,0),h=0;for(let e in n){let i=n[e],r=this._touches[e];r&&(s._add(i),l._add(i.sub(r)),h++,n[e]=i)}if(this._touches=n,h<this._minTouches||!l.mag())return;let u=l.div(h);return this._sum._add(u),this._sum.mag()<this._clickTolerance?void 0:{around:s.div(h),panDelta:u}}enable(){this._enabled=!0,this._map._cooperativeGestures&&(this._addTouchPanBlocker(),this._el.classList.add("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page"))}disable(){this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove(),this._el.classList.remove("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page")),this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}_addTouchPanBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=m("div","mapboxgl-touch-pan-blocker",this._map._container),this._alertContainer.textContent=this._map._getUIString("TouchPanBlocker.Message"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showTouchPanBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-touch-pan-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.removeAttribute("role")},500)}}class ni{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(e){}_move(e,i,r){return{}}touchstart(e,i,r){this._firstTwoTouches||r.length<2||(this._firstTwoTouches=[r[0].identifier,r[1].identifier],this._start([i[0],i[1]]))}touchmove(e,i,r){let a=this._firstTwoTouches;if(!a)return;e.preventDefault();let[n,s]=a,l=nr(r,i,n),h=nr(r,i,s);if(!l||!h)return;let u=this._aroundCenter?null:l.add(h).div(2);return this._move([l,h],u,e)}touchend(e,i,r){if(!this._firstTwoTouches)return;let[a,n]=this._firstTwoTouches,s=nr(r,i,a),l=nr(r,i,n);s&&l||(this._active&&w(),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 nr(e,i,r){for(let a=0;a<e.length;a++)if(e[a].identifier===r)return i[a]}function na(e,i){return Math.log(e/i)/Math.LN2}class nn extends ni{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,i){let r=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(.1>Math.abs(na(this._distance,this._startDistance))))return this._active=!0,{zoomDelta:na(this._distance,r),pinchAround:i}}}function no(e,i){return 180*e.angleWith(i)/Math.PI}class ns extends ni{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,i){let r=this._vector;if(this._vector=e[0].sub(e[1]),r&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:no(this._vector,r),pinchAround:i}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let i=25/(Math.PI*this._minDiameter)*360,r=this._startVector;return!!r&&Math.abs(no(e,r))<i}}function nl(e){return Math.abs(e.y)>Math.abs(e.x)}class nh extends ni{constructor(e){super(),this._map=e}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(e){this._lastPoints=e,nl(e[0].sub(e[1]))&&(this._valid=!1)}_move(i,r,a){let n=this._lastPoints;if(!n)return;let s=i[0].sub(n[0]),l=i[1].sub(n[1]);return this._map._cooperativeGestures&&!e.dq()&&a.touches.length<3||(this._val
303id=this.gestureBeginsVertically(s,l,a.timeStamp),!this._valid)?void 0:(this._lastPoints=i,this._active=!0,{pitchDelta:-((s.y+l.y)/2*.5)})}gestureBeginsVertically(e,i,r){if(void 0!==this._valid)return this._valid;let a=e.mag()>=2,n=i.mag()>=2;if(!a&&!n)return;if(!a||!n)return null==this._firstMove&&(this._firstMove=r),r-this._firstMove<100&&void 0;let s=e.y>0==i.y>0;return nl(e)&&nl(i)&&s}}class nu{constructor(){this._panStep=100,this._bearingStep=15,this._pitchStep=10,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let i=0,r=0,a=0,n=0,s=0;switch(e.keyCode){case 61:case 107:case 171:case 187:i=1;break;case 189:case 109:case 173:i=-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?a=1:(e.preventDefault(),s=-1);break;case 40:e.shiftKey?a=-1:(e.preventDefault(),s=1);break;default:return}return this._rotationDisabled&&(r=0,a=0),{cameraAnimation:l=>{let h=l.getZoom();l.easeTo({duration:300,easeId:"keyboardHandler",easing:nc,zoom:i?Math.round(h)+i*(e.shiftKey?2:1):h,bearing:l.getBearing()+r*this._bearingStep,pitch:l.getPitch()+a*this._pitchStep,offset:[-n*this._panStep,-s*this._panStep],center:l.getCenter()},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function nc(e){return e*(2-e)}let nd=1/450;class np{constructor(i,r){this._map=i,this._el=i.getCanvasContainer(),this._handler=r,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=nd,e.aJ(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around,this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(i){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(i.ctrlKey||i.metaKey||this.isZooming()||e.dq()))return void this._showBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let r=i.deltaMode===WheelEvent.DOM_DELTA_LINE?40*i.deltaY:i.deltaY,a=e.q.now(),n=a-(this._lastWheelEventTime||0);this._lastWheelEventTime=a,0!==r&&r%4.000244140625==0?this._type="wheel":0!==r&&4>Math.abs(r)?this._type="trackpad":n>400?(this._type=null,this._lastValue=r,this._timeout=window.setTimeout(this._onTimeout,40,i)):this._type||(this._type=200>Math.abs(n*r)?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,r+=this._lastValue)),i.shiftKey&&r&&(r/=4),this._type&&(this._lastWheelEvent=i,this._delta-=r,this._active||this._start(i)),i.preventDefault()}_onTimeout(e){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let i=T(this._el,e);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:i,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;let i=this._map.transform;"wheel"===this._type&&i.projection.wrap&&(i._center.lng>=180||i._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);let r=()=>i._terrainEnabled()&&this._aroundCoord?i.computeZoomRelativeTo(this._aroundCoord):i.zoom;if(0!==this._delta){let e="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate,a=2/(1+Math.exp(-Math.abs(this._delta*e)));this._delta<0&&0!==a&&(a=1/a);let n=r(),s=Math.pow(2,n),l="number"==typeof this._targetZoom?i.zoomScale(this._targetZoom):s;this._targetZoom=Math.min(i.maxZoom,Math.max(i.minZoom,i.scaleZoom(l*a))),"wheel"===this._type&&(this._startZoom=n,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}let a="number"==typeof this._targetZoom?this._targetZoom:r(),n=this._startZoom,s=this._easing,l,h=!1;if("wheel"===this._type&&n&&s){let i=Math.min((e.q.now()-this._lastWheelEventTime)/200,1),r=s(i);l=e.aa(n,a,r),i<1?this._frameId||(this._frameId=!0):h=!0}else l=a,h=!0;this._active=!0,h&&(this._active=!1,this._finishTimeout=window.setTimeout(()=>
303{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let u=l-r();return u*this._lastDelta<0&&(u=0),{noInertia:!0,needsRenderFrame:!h,zoomDelta:u,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(i){let r=e.dr;if(this._prevEase){let i=this._prevEase,a=(e.q.now()-i.start)/i.duration,n=i.easing(a+.01)-i.easing(a),s=.27/Math.sqrt(n*n+1e-4)*.01,l=Math.sqrt(.0729-s*s);r=e.dp(s,l,.25,1)}return this._prevEase={start:e.q.now(),duration:i,easing:r},r}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=m("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.removeAttribute("role")},200)}}class nf{constructor(e,i){this._clickZoom=e,this._tapZoom=i}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 nm{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(e,i){return e.preventDefault(),{cameraAnimation:r=>{r.easeTo({duration:300,zoom:r.getZoom()+(e.shiftKey?-1:1),around:r.unproject(i)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class n_{constructor(){this._tap=new a4({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(e,i,r){this._swipePoint||(this._tapTime&&e.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?r.length>0&&(this._swipePoint=i[0],this._swipeTouch=r[0].identifier):this._tap.touchstart(e,i,r))}touchmove(e,i,r){if(this._tapTime){if(this._swipePoint){if(r[0].identifier!==this._swipeTouch)return;let a=i[0],n=a.y-this._swipePoint.y;return this._swipePoint=a,e.preventDefault(),this._active=!0,{zoomDelta:n/128}}}else this._tap.touchmove(e,i,r)}touchend(e,i,r){this._tapTime?this._swipePoint&&0===r.length&&this.reset():this._tap.touchend(e,i,r)&&(this._tapTime=e.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ng{constructor(e,i,r){this._el=e,this._mousePan=i,this._touchPan=r}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class ny{constructor(e,i,r){this._pitchWithRotate=e.pitchWithRotate,this._mouseRotate=i,this._mousePitch=r}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class nx{constructor(e,i,r,a){this._el=e,this._touchZoom=i,this._touchRotate=r,this._tapDragZoom=a,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}let nv=e=>e.zoom||e.drag||e.pitch||e.rotate;class nb extends e.x{}class nw{constructor(){this.constants=[1,1,.01],this.radius=0}setup(i,r){let a=e.a6.vec3.sub([],r,i);this.radius=e.a6.vec3.length(a[2]<0?e.a6.vec3.div([],a,this.constants):[a[0],a[1],0])}projectRay(i){e.a6.vec3.div(i,i,this.constants),e.a6.vec3.normalize(i,i),e.a6.vec3.mul(i,i,this.constants);let r=e.a6.vec3.scale([],i,this.radius);if(r[2]>0){let i=e.a6.vec3.scale([],[0,0,1],e.a6.vec3.dot(r,[0,0,1])),a=e.a6.vec3.scale([],e.a6.vec3.normalize([],[r[0],r[1],0]),this.radius),n=e.a6.vec3.add([],r,e.a6.vec3.scale([],e.a6.vec3.sub([],e.a6.vec3.add([],a,i),r),2));r[0]=n[0],r[1]=n[1]}return r}}function nT(e){return e.panDelta&&e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta}class nS{constructor(i,r){this._map=i,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new aH(i),this._bearingSnap=r.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new nw,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(r),e.aJ(["handleEvent","handleWindowEvent"],this);let a=this._el;for(let[e,i,r]of(this._listeners=[[a,"touchstart",{passive:!0}],[a,"touchmove",{passive:!1}],[a,"touchend",void 0],[a,"touchcancel",void 0],[a,"mousedown",void 0],[a,"mousemove",void 0],[a,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[a,"mouseover",void 0],[a,"mouseout",void 0],[a,"dblclick",void 0],[a,"click",void 0],[a,"keydown",{capture:!1}],[a,"keyup",void 0],[a,"wheel",{passive:!1}],[a,"contextmenu",void 0],[window,"blur",void 0]],this._listeners)){let a=e===document?this.handleWindowEvent:this.handleEvent;e.addEventListener(i,a,r)}}destroy(){for(let[e,i,r]of this._listeners){let a=e===document?this.handleWindowEvent:this.handleEvent;e.removeEventListener(i,a,r)}}_addDefaultHandlers(e){let i=this._map,r=i.getCanvasContainer();this._add("mapEvent",new aQ(i,e));let a=i.boxZoom=new a1(i,e);this._add("boxZoom",a);let n=new a5,s=new nm;i.doubleClickZoom=new nf(s,n),this._add("tapZoom",n),this._add("clickZoom",s);let l=new n_;this._add("tapDragZoom",l);let h=i.touchPitch=new nh(i);this._add("touchPitch",h);let u=new a7(e),c=new ne(e);i.dragRotate=new ny(e,u,c),this._add("mouseRotate",u,["mousePitch"]),this._add("mousePitch",c,["mouseRotate"]);let d=new a9(e),p=new nt(i,e);i.dragPan=new ng(r,d,p),this._add("mousePan",d),this._add("touchPan",p,["touchZoom","touchRotate"]);let f=new ns,m=new nn;i.touchZoomRotate=new nx(r,m,f,l),this._add("touchRotate",f,["touchPan","touchZoom"]),this._add("touchZoom",m,["touchPan","touchRotate"]),this._add("blockableMapEvent",new a0(i));let _=i.scrollZoom=new np(i,this);this._add("scrollZoom",_,["mousePan"]);let g=i.keyboard=new nu;for(let r of(this._add("keyboard",g),["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"]))e.interactive&&e[r]&&i[r].enable(e[r])}_add(e,i,r){this._handlers.push({handlerName:e,handler:i,allowed:r}),this._handlersById[e]=i}stop(e){if(!this._updatingCamera){for(let{handler:e}of this._handlers)e.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[],this._originalZoom=void 0}}isActive(){for(let{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!!nv(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(e,i,r){for(let a in e)if(a!==r&&(!i||0>i.indexOf(a)))return!0;return!1}handleWindowEvent(e){this.handleEvent(e,`${e.type}Window`)}_getMapTouches(e){let i=[];for(let r of e)this._el.contains(r.target)&&i.push(r);return i}handleEvent(e,i){this._updatingCamera=!0;let r="renderFrame"===e.type,a=r?void 0:e,n={needsRenderFrame:!1},s={},l={},h=e.touches?this._getMapTouches(e.touches):void 0,u=h?S(this._el,h):r?void 0:T(this._el,e);for(let{handlerName:r,handler:c,allowed:d}of this._handlers){let p;c.isEnabled()&&(this._blockedByActive(l,d,r)?c.reset():c[i||e.type]&&(p=c[i||e.type](e,u,h),this.mergeHandlerResult(n,s,p,r,a),p&&p.needsRenderFrame&&this._triggerRe
303nderFrame()),(p||c.isActive())&&(l[r]=c))}let c={};for(let e in this._previousActiveHandlers)l[e]||(c[e]=a);this._previousActiveHandlers=l,(Object.keys(c).length||nT(n))&&(this._changes.push([n,s,c]),this._triggerRenderFrame()),(Object.keys(l).length||nT(n))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:d}=n;d&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],d(this._map))}mergeHandlerResult(i,r,a,n,s){if(!a)return;e.l(i,a);let l={handlerName:n,originalEvent:a.originalEvent||s};void 0!==a.zoomDelta&&(r.zoom=l),void 0!==a.panDelta&&(r.drag=l),void 0!==a.pitchDelta&&(r.pitch=l),void 0!==a.bearingDelta&&(r.rotate=l)}_applyChanges(){let i={},r={},a={};for(let[n,s,l]of this._changes)n.panDelta&&(i.panDelta=(i.panDelta||new e.P(0,0))._add(n.panDelta)),n.zoomDelta&&(i.zoomDelta=(i.zoomDelta||0)+n.zoomDelta),n.bearingDelta&&(i.bearingDelta=(i.bearingDelta||0)+n.bearingDelta),n.pitchDelta&&(i.pitchDelta=(i.pitchDelta||0)+n.pitchDelta),void 0!==n.around&&(i.around=n.around),void 0!==n.aroundCoord&&(i.aroundCoord=n.aroundCoord),void 0!==n.pinchAround&&(i.pinchAround=n.pinchAround),n.noInertia&&(i.noInertia=n.noInertia),e.l(r,s),e.l(a,l);this._updateMapTransform(i,r,a),this._changes=[]}_updateMapTransform(i,r,a){let n;let s=this._map,l=s.transform,h=e=>[e.x,e.y,e.z];if((e=>{let i=this._eventsInProgress.drag;return i&&!this._handlersById[i.handlerName].isActive()})()&&!nT(i)){let e=l.zoom;l.cameraElevationReference="sea",null!=this._originalZoom&&l._orthographicProjectionAtLowPitch&&"globe"!==l.projection.name&&0===l.pitch?(l.cameraElevationReference="ground",l.zoom=this._originalZoom):(l.recenterOnTerrain(),l.cameraElevationReference="ground"),e!==l.zoom&&this._map._update(!0)}if(l._isCameraConstrained&&s._stop(!0),!nT(i))return void this._fireEvents(r,a,!0);let{panDelta:u,zoomDelta:c,bearingDelta:d,pitchDelta:p,around:f,aroundCoord:m,pinchAround:_}=i;l._isCameraConstrained&&(c>0&&(c=0),l._isCameraConstrained=!1),void 0!==_&&(f=_),(c||r[n="drag"]&&!this._eventsInProgress[n])&&f&&(this._dragOrigin=h(l.pointCoordinate3D(f)),this._originalZoom=l.zoom,this._trackingEllipsoid.setup(l._camera.position,this._dragOrigin)),l.cameraElevationReference="sea",s._stop(!0),f=f||s.transform.centerPoint,d&&(l.bearing+=d),p&&(l.pitch+=p),l._updateCameraState();let g=[0,0,0];if(u){if("mercator"===l.projection.name){let e=this._trackingEllipsoid.projectRay(l.screenPointToMercatorRay(f).dir),i=this._trackingEllipsoid.projectRay(l.screenPointToMercatorRay(f.sub(u)).dir);g[0]=i[0]-e[0],g[1]=i[1]-e[1]}else{let i=l.pointCoordinate(f);if("globe"===l.projection.name){u=u.rotate(-l.angle);let r=l._pixelsPerMercatorPixel/l.worldSize;g[0]=-u.x*e.ds(e.aN(i.y))*r,g[1]=-u.y*e.ds(l.center.lat)*r}else{let e=l.pointCoordinate(f.sub(u));i&&e&&(g[0]=e.x-i.x,g[1]=e.y-i.y)}}}let y=l.zoom,x=[0,0,0];if(c){let i=h(m||l.pointCoordinate3D(f)),r={dir:e.a6.vec3.normalize([],e.a6.vec3.sub([],i,l._camera.position))};if(r.dir[2]<0){let a=l.zoomDeltaToMovement(i,c);e.a6.vec3.scale(x,r.dir,a)}}let v=e.a6.vec3.add(g,g,x);l._translateCameraConstrained(v),c&&Math.abs(l.zoom-y)>1e-4&&l.recenterOnTerrain(),l.cameraElevationReference="ground",this._map._update(),i.noInertia||this._inertia.record(i),this._fireEvents(r,a,!0)}_fireEvents(i,r,a){let n;let s=nv(this._eventsInProgress),l=nv(i),h={};for(let e in i){let{originalEvent:r}=i[e];this._eventsInProgress[e]||(h[`${e}start`]=r),this._eventsInProgress[e]=i[e]}for(let e in!s&&l&&this._fireEvent("movestart",l.originalEvent),h)this._fireEvent(e,h[e]);for(let e in l&&this._fireEvent("move",l.originalEvent),i){let{originalEvent:r}=i[e];this._fireEvent(e,r)}let u={};for(let e in this._eventsInProgress){let{handlerName:i,originalEvent:a}=this._eventsInProgress[e];this._handlersById[i].isActive()||(delete this._eventsInProgress[e],n=r[i]||a,u[`${e}end`]=n)}for(let e in u)this._fireEvent(e,u[e]);let c=nv(this._eventsInProgress);if(a&&(s||l)&&!c){let i,r;this._updatingCamera=!0;let a=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions);a?(0!==(i=a.bearing||this._map.getBearing())&&-this._bearingSnap<i&&i<this._bearingSnap&&(a.bearing=0),this._map.easeTo(a,{originalEvent:n})):(this._map.fire(new e.x("moveend",{originalEvent:n})),0!==(r=this._map.getBearing())&&-this._bearingSnap<r&&r<this._bearingSnap&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(i,r){this._map.fire(new e.x(i,r?{originalEvent:r}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{this._frameId=void 0,this.handleEvent(new nb("renderFrame",{timeStamp:e})),this._applyChanges()})}
303_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}let nM="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class nE extends e.E{constructor(i,r){super(),this._moving=!1,this._zooming=!1,this.transform=i,this._bearingSnap=r.bearingSnap,this._respectPrefersReducedMotion=!1!==r.respectPrefersReducedMotion,e.aJ(["_renderFrameCallback"],this)}getCenter(){return new e.bL(this.transform.center.lng,this.transform.center.lat)}setCenter(e,i){return this.jumpTo({center:e},i)}panBy(i,r,a){return i=e.P.convert(i).mult(-1),this.panTo(this.transform.center,e.l({offset:i},r),a)}panTo(i,r,a){return this.easeTo(e.l({center:i},r),a)}getZoom(){return this.transform.zoom}setZoom(e,i){return this.jumpTo({zoom:e},i),this}zoomTo(i,r,a){return this.easeTo(e.l({zoom:i},r),a)}zoomIn(e,i){return this.zoomTo(this.getZoom()+1,e,i),this}zoomOut(e,i){return this.zoomTo(this.getZoom()-1,e,i),this}getBearing(){return this.transform.bearing}setBearing(e,i){return this.jumpTo({bearing:e},i),this}getPadding(){return this.transform.padding}setPadding(e,i){return this.jumpTo({padding:e},i),this}rotateTo(i,r,a){return this.easeTo(e.l({bearing:i},r),a)}resetNorth(i,r){return this.rotateTo(0,e.l({duration:1e3},i),r),this}resetNorthPitch(i,r){return this.easeTo(e.l({bearing:0,pitch:0,duration:1e3},i),r),this}snapToNorth(e,i){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,i):this}getPitch(){return this.transform.pitch}setPitch(e,i){return this.jumpTo({pitch:e},i),this}cameraForBounds(i,r){i=e.as.convert(i);let a=r&&r.bearing||0,n=r&&r.pitch||0,s=i.getNorthWest(),l=i.getSouthEast();return this._cameraForBounds(this.transform,s,l,a,n,r)}_extendPadding(i){let r={top:0,right:0,bottom:0,left:0};return null==i?e.l({},r,this.transform.padding):"number"==typeof i?{top:i,bottom:i,right:i,left:i}:e.l({},r,i)}_extendCameraOptions(i){return(i=e.l({offset:[0,0],maxZoom:this.transform.maxZoom},i)).padding=this._extendPadding(i.padding),i}_minimumAABBFrustumDistance(e,i){let r=i.max[0]-i.min[0],a=i.max[1]-i.min[1];return r/a>e.aspect?r/(2*Math.tan(.5*e.fovX)*e.aspect):a/(2*Math.tan(.5*e.fovY)*e.aspect)}_cameraForBoundsOnGlobe(i,r,a,n,s,l){let h=i.clone(),u=this._extendCameraOptions(l);h.bearing=n,h.pitch=s;let c=e.bL.convert(r),d=e.bL.convert(a),p=.5*(c.lat+d.lat),f=.5*(c.lng+d.lng),m=e.dt(p,f),_=e.a6.vec3.normalize([],m),g=e.a6.vec3.normalize([],e.a6.vec3.cross([],_,[0,1,0])),y=e.a6.vec3.cross([],g,_),x=[g[0],g[1],g[2],0,y[0],y[1],y[2],0,_[0],_[1],_[2],0,0,0,0,1],v=[m,e.dt(c.lat,c.lng),e.dt(d.lat,c.lng),e.dt(d.lat,d.lng),e.dt(c.lat,d.lng),e.dt(p,c.lng),e.dt(p,d.lng),e.dt(c.lat,f),e.dt(d.lat,f)],b=e.ca.fromPoints(v.map(i=>[e.a6.vec3.dot(g,i),e.a6.vec3.dot(y,i),e.a6.vec3.dot(_,i)])),w=e.a6.vec3.transformMat4([],b.center,x);0===e.a6.vec3.squaredLength(w)&&e.a6.vec3.set(w,0,0,1),e.a6.vec3.normalize(w,w),e.a6.vec3.scale(w,w,e.aq),h.center=e.du(w);let T=h.getWorldToCameraMatrix(),S=e.a6.mat4.invert(new Float64Array(16),T);b=e.ca.applyTransform(b,e.a6.mat4.multiply([],T,x));let M=this._extendAABB(b,h,u,n);if(!M)return void e.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");b=M,e.a6.vec3.transformMat4(w,w,T);let E=.5*(b.max[2]-b.min[2]),A=this._minimumAABBFrustumDistance(h,b),I=e.a6.vec3.scale([],[0,0,1],E),C=e.a6.vec3.add(I,w,I),P=A+(0===h.pitch?0:e.a6.vec3.distance(w,C)),L=h.globeCenterInViewSpace,k=e.a6.vec3.sub([],w,[L[0],L[1],L[2]]);e.a6.vec3.normalize(k,k),e.a6.vec3.scale(k,k,P);let R=e.a6.vec3.add([],w,k);e.a6.vec3.transformMat4(R,R,S);let z=e.dw/e.aq,D=e.a6.vec3.length(R),O=e.bE(Math.max(D*z-e.dw,Number.EPSILON),0),B=Math.min(h.zoomFromMercatorZAdjusted(O),u.maxZoom);return B>.5*(e.c3+e.bV)?(h.setProjection({name:"mercator"}),h.zoom=B,this._cameraForBounds(h,r,a,n,s,l)):{center:h.center,zoom:B,bearing:n,pitch:s}}_extendAABB(i,r,a,n){let s=.5*((a.padding.left||0)+(a.padding.right||0)),l=.5*((a.padding.top||0)+(a.padding.bottom||0)),h=r.width-(s+s),u=r.height-(l+l),c=e.a6.vec3.sub([],i.max,i.min),d=Math.min(h/c[0],u/c[1]),p=Math.min(r.scaleZoom(r.scale*d),a.maxZoom);if(isNaN(p))return null;let f=r.scale/r.zoomScale(p),m=new e.ca([i.min[0]-s*f,i.min[1]-l*f,i.min[2]],[i.max[0]+s*f,i.max[1]+l*f,i.max[2]]),_=("number"==typeof a.offset.x&&"number"==typeof a.offset.y?new e.P(a.offset.x,a.offset.y):e.P.convert(a.offset)).rotate(-e.bC(n));return m.center[0]-=_.x*f,m.center[1]+=_.y*f,m}queryTerrainElevation(i,r){let a=this.transform.elevation;return a?(r=e.l({},{exaggerated:!0},r),a.getAtPoint(e.a5.fromLngLat(i),null,r.exaggerated)):null}_cameraForBounds(i,r,a,n,s,l){if("globe"===i.projection.name)return this._cameraForBoundsOnGlobe(i,r,a,n,s,l);let h=i.clone(),u=this._extendCameraOptions(l);h.bearing=n,h.pitch=s;let c=e.bL.convert(r),d=e.bL.convert(a),p=new e.bL(c.lng,d.lat),f=new e.b
303L(d.lng,c.lat),m=h.project(c),_=h.project(d),g=this.queryTerrainElevation(c),y=this.queryTerrainElevation(d),x=this.queryTerrainElevation(p),v=this.queryTerrainElevation(f),b=[[m.x,m.y,Math.min(g||0,y||0,x||0,v||0)],[_.x,_.y,Math.max(g||0,y||0,x||0,v||0)]],w=e.ca.fromPoints(b),T=h.getWorldToCameraMatrix(),S=e.a6.mat4.invert(new Float64Array(16),T);w=e.ca.applyTransform(w,T);let M=this._extendAABB(w,h,u,n);if(!M)return void e.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");w=M;let E=.5*e.a6.vec3.sub([],w.max,w.min)[2],A=this._minimumAABBFrustumDistance(h,w),I=[0,0,1,0];e.a6.vec4.transformMat4(I,I,T),e.a6.vec4.normalize(I,I);let C=e.a6.vec3.scale([],I,A+E),P=e.a6.vec3.add([],w.center,C);e.a6.vec3.transformMat4(w.center,w.center,S),e.a6.vec3.transformMat4(P,P,S);let L=h.unproject(new e.P(w.center[0],w.center[1])),k=Math.pow(2,e.dv(h.projection,L)),R=Math.min(h._zoomFromMercatorZ(P[2]*h.pixelsPerMeter*k/h.worldSize),u.maxZoom);return h.mercatorFromTransition&&R<.5*(e.c3+e.bV)?(h.setProjection({name:"globe"}),h.zoom=R,this._cameraForBounds(h,r,a,n,s,l)):{center:L,zoom:R,bearing:n,pitch:s}}fitBounds(e,i,r){let a=this.cameraForBounds(e,i);return this._fitInternal(a,i,r)}fitScreenCoordinates(i,r,a,n,s){let l=e.P.convert(i),h=e.P.convert(r),u=new e.P(Math.min(l.x,h.x),Math.min(l.y,h.y)),c=new e.P(Math.max(l.x,h.x),Math.max(l.y,h.y));if("mercator"===this.transform.projection.name&&this.transform.anyCornerOffEdge(l,h))return this;let d=this.transform.pointLocation3D(u),p=this.transform.pointLocation3D(c),f=this.transform.pointLocation3D(new e.P(u.x,c.y)),m=this.transform.pointLocation3D(new e.P(c.x,u.y)),_=[Math.min(d.lng,p.lng,f.lng,m.lng),Math.min(d.lat,p.lat,f.lat,m.lat)],g=[Math.max(d.lng,p.lng,f.lng,m.lng),Math.max(d.lat,p.lat,f.lat,m.lat)],y=n&&n.pitch?n.pitch:this.getPitch(),x=this._cameraForBounds(this.transform,_,g,a,y,n);return this._fitInternal(x,n,s)}_fitInternal(i,r,a){return i?(r=e.l(i,r)).linear?this.easeTo(r,a):this.flyTo(r,a):this}jumpTo(i,r){this.stop();let a=i.preloadOnly?this.transform.clone():this.transform,n=!1,s=!1,l=!1;"zoom"in i&&a.zoom!==+i.zoom&&(n=!0,a.zoom=+i.zoom),void 0!==i.center&&(a.center=e.bL.convert(i.center)),"bearing"in i&&a.bearing!==+i.bearing&&(s=!0,a.bearing=+i.bearing),"pitch"in i&&a.pitch!==+i.pitch&&(l=!0,a.pitch=+i.pitch);let h="number"==typeof i.padding?this._extendPadding(i.padding):i.padding;
303if(null!=i.padding&&!a.isPaddingEqual(h)){if(!1===i.retainPadding){let e=a.clone();e.padding=h,a.setLocationAtPoint(a.center,e.centerPoint)}else a.padding=h}return i.preloadOnly?(this._preloadTiles(a),this):(this.fire(new e.x("movestart",r)).fire(new e.x("move",r)),n&&this.fire(new e.x("zoomstart",r)).fire(new e.x("zoom",r)).fire(new e.x("zoomend",r)),s&&this.fire(new e.x("rotatestart",r)).fire(new e.x("rotate",r)).fire(new e.x("rotateend",r)),l&&this.fire(new e.x("pitchstart",r)).fire(new e.x("pitch",r)).fire(new e.x("pitchend",r)),this.fire(new e.x("moveend",r)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||e.w(nM),this.transform.getFreeCameraOptions()}setFreeCameraOptions(i,r){let a=this.transform;if(!a.projection.supportsFreeCamera)return e.w(nM),this;this.stop();let n=a.zoom,s=a.pitch,l=a.bearing;a.setFreeCameraOptions(i);let h=n!==a.zoom,u=s!==a.pitch,c=l!==a.bearing;return this.fire(new e.x("movestart",r)).fire(new e.x("move",r)),h&&this.fire(new e.x("zoomstart",r)).fire(new e.x("zoom",r)).fire(new e.x("zoomend",r)),c&&this.fire(new e.x("rotatestart",r)).fire(new e.x("rotate",r)).fire(new e.x("rotateend",r)),u&&this.fire(new e.x("pitchstart",r)).fire(new e.x("pitch",r)).fire(new e.x("pitchend",r)),this.fire(new e.x("moveend",r)),this}easeTo(i,r){let a,n,s,l,h;this._stop(!1,i.easeId),(!1===(i=e.l({offset:[0,0],duration:500,easing:e.dr},i)).animate||this._prefersReducedMotion(i))&&(i.duration=0);let u=this.transform,c=this.getZoom(),d=this.getBearing(),p=this.getPitch(),f=this.getPadding(),m="zoom"in i?+i.zoom:c,_="bearing"in i?this._normalizeBearing(i.bearing,d):d,g="pitch"in i?+i.pitch:p,y=this._extendPadding(i.padding),x=e.P.convert(i.offset);if("globe"===u.projection.name){let r=e.a5.fromLngLat(u.center),l=x.rotate(-u.angle);r.x+=l.x/u.worldSize,r.y+=l.y/u.worldSize;let h=r.toLngLat(),c=e.bL.convert(i.center||h);this._normalizeCenter(c),a=u.centerPoint.add(l),n=new e.P(r.x,r.y).mult(u.worldSize),s=new e.P(e.am(c.lng),e.at(c.lat)).mult(u.worldSize).sub(n)}else{a=u.centerPoint.add(x);let r=u.pointLocation(a),l=e.bL.convert(i.center||r);this._normalizeCenter(l),n=u.project(r),s=u.project(l).sub(n)}let v=u.zoomScale(m-c);i.around&&(l=e.bL.convert(i.around),h=u.locationPoint(l));let b=this._zooming||m!==c,w=this._rotating||d!==_,T=this._pitching||g!==p,S=!u.isPaddingEqual(y),M=!1===i.retainPadding?u.clone():u,E=u=>E=>{if(b&&(u.zoom=e.aa(c,m,E)),w&&(u.bearing=e.aa(d,_,E)),T&&(u.pitch=e.aa(p,g,E)),S&&(M.interpolatePadding(f,y,E),a=M.centerPoint.add(x)),l)u.setLocationAtPoint(l,h);else{let e=u.zoomScale(u.zoom-c),i=Math.pow(m>c?Math.min(2,v):Math.max(.5,v),1-E),r=u.unproject(n.add(s.mult(E*i)).mult(e));u.setLocationAtPoint(u.renderWorldCopies?r.wrap():r,a)}return i.preloadOnly||this._fireMoveEvents(r),u};if(i.preloadOnly){let e=this._emulate(E,i.duration,u);return this._preloadTiles(e),this}let A={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=b,this._rotating=w,this._pitching=T,this._padding=S,this._easeId=i.easeId,this._prepareEase(r,i.noMoveStart,A),this._ease(E(u),e=>{"sea"===u.cameraElevationReference&&u.recenterOnTerrain(),this._afterEase(r,e)},i),this}_prepareEase(i,r,a={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&0===this.transform.pitch&&"globe"!==this.transform.projection.name&&(this.transform.cameraElevationReference="ground"),r||a.moving||this.fire(new e.x("movestart",i)),this._zooming&&!a.zooming&&this.fire(new e.x("zoomstart",i)),this._rotating&&!a.rotating&&this.fire(new e.x("rotatestart",i)),this._pitching&&!a.pitching&&this.fire(new e.x("pitchstart",i))}_fireMoveEvents(i){this.fire(new e.x("move",i)),this._zooming&&this.fire(new e.x("zoom",i)),this._rotating&&this.fire(new e.x("rotate",i)),this._pitching&&this.fire(new e.x("pitch",i))}_afterEase(i,r){if(this._easeId&&r&&this._easeId===r)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";let a=this._zooming,n=this._rotating,s=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,a&&this.fire(new e.x("zoomend",i)),n&&this.fire(new e.x("rotateend",i)),s&&this.fire(new e.x("pitchend",
303i)),this.fire(new e.x("moveend",i))}flyTo(i,r){if(this._prefersReducedMotion(i)){let a=e.ar(i,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(a,r)}this.stop(),i=e.l({offset:[0,0],speed:1.2,curve:1.42,easing:e.dr},i);let a=this.transform,n=this.getZoom(),s=this.getBearing(),l=this.getPitch(),h=this.getPadding(),u="zoom"in i?e.ap(+i.zoom,a.minZoom,a.maxZoom):n,c="bearing"in i?this._normalizeBearing(i.bearing,s):s,d="pitch"in i?+i.pitch:l,p=this._extendPadding(i.padding),f=a.zoomScale(u-n),m=e.P.convert(i.offset),_=a.centerPoint.add(m),g=a.pointLocation(_),y=e.bL.convert(i.center||g);this._normalizeCenter(y);let x=a.project(g),v=a.project(y).sub(x),b=i.curve,w=Math.max(a.width,a.height),T=w/f,S=v.mag();if("minZoom"in i){let r=e.ap(Math.min(i.minZoom,n,u),a.minZoom,a.maxZoom);b=Math.sqrt(w/a.zoomScale(r-n)/S*2)}let M=b*b;function E(e){let i=(T*T-w*w+(e?-1:1)*M*M*S*S)/(2*(e?T:w)*M*S);return Math.log(Math.sqrt(i*i+1)-i)}function A(e){return(Math.exp(e)-Math.exp(-e))/2}function I(e){return(Math.exp(e)+Math.exp(-e))/2}let C=E(0),P=function(e){return I(C)/I(C+b*e)},L=function(e){var i;return w*((I(C)*(A(i=C+b*e)/I(i))-A(C))/M)/S},k=(E(1)-C)/b;if(1e-6>Math.abs(S)||!isFinite(k)){if(1e-6>Math.abs(w-T))return this.easeTo(i,r);let e=T<w?-1:1;k=Math.abs(Math.log(T/w))/b,L=function(){return 0},P=function(i){return Math.exp(e*b*i)}}i.duration="duration"in i?+i.duration:1e3*k/("screenSpeed"in i?+i.screenSpeed/b:+i.speed),i.maxDuration&&i.duration>i.maxDuration&&(i.duration=0);let R=s!==c,z=d!==l,D=!a.isPaddingEqual(p),O=!1===i.retainPadding?a.clone():a,B=a=>f=>{let g=f*k,b=1/P(g);a.zoom=1===f?u:n+a.scaleZoom(b),R&&(a.bearing=e.aa(s,c,f)),z&&(a.pitch=e.aa(l,d,f)),D&&(O.interpolatePadding(h,p,f),_=O.centerPoint.add(m));let w=1===f?y:a.unproject(x.add(v.mult(L(g))).mult(b));return a.setLocationAtPoint(a.renderWorldCopies?w.wrap():w,_),a._updateCameraOnTerrain(),i.preloadOnly||this._fireMoveEvents(r),a};if(i.preloadOnly){let e=this._emulate(B,i.duration,a);return this._preloadTiles(e),this}return this._zooming=!0,this._rotating=R,this._pitching=z,this._padding=D,this._prepareEase(r,!1),this._ease(B(a),()=>this._afterEase(r),i),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(e){}_cancelRenderFrame(e){}_stop(e,i){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){let e=this._onEaseEnd;this._onEaseEnd=void 0,e.call(this,i)}if(!e){let e=this.handlers;e&&e.stop(!1)}return this}_ease(i,r,a){!1===a.animate||0===a.duration?(i(1),r()):(this._easeStart=e.q.now(),this._easeOptions=a,this._onEaseFrame=i,this._onEaseEnd=r,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){let i=Math.min((e.q.now()-this._easeStart)/this._easeOptions.duration,1),r=this._onEaseFrame;r&&r(this._easeOptions.easing(i)),i<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(i,r){let a=Math.abs((i=e.bB(i,-180,180))-r);return Math.abs(i-360-r)<a&&(i-=360),Math.abs(i+360-r)<a&&(i+=360),i}_normalizeCenter(e){let i=this.transform;if(i.maxBounds||"globe"!==i.projection.name&&!i.renderWorldCopies)return;let r=e.lng-i.center.lng;e.lng+=r>180?-360:360*(r<-180)}_prefersReducedMotion(i){return this._respectPrefersReducedMotion&&e.q.prefersReducedMotion&&!(i&&i.essential)}_emulate(e,i,r){let a=Math.ceil(15*i/1e3),n=[],s=e(r.clone());for(let e=0;e<=a;e++){let i=s(e/a);n.push(i.clone())}return n}_preloadTiles(e,i){}}class nA{constructor(i={}){this.options=i,e.aJ(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(e){let i=this.options&&this.options.compact,r=e._getUIString("AttributionControl.ToggleAttribution");this._map=e,this._container=m("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=m("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",r);let a=m("span","mapboxgl-ctrl-icon",this._compactButton);return a.setAttribute("aria-hidden","true"),a.setAttribute("title",r),this._innerContainer=m("div","mapboxgl-ctrl-attrib-inner",this._container),i&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===i&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","fal
303se")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let i=this._editLink;i||(i=this._editLink=this._container.querySelector(".mapbox-improve-map"));let r=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||e.e.ACCESS_TOKEN}];if(i){let a=r.reduce((e,i,a)=>(i.value&&(e+=`${i.key}=${i.value}${a<r.length-1?"&":""}`),e),"?");i.href=`${e.e.FEEDBACK_URL}/${a}#${aU(this._map,!0)}`,i.rel="noopener nofollow"}}_updateData(e){e&&("metadata"===e.sourceDataType||"visibility"===e.sourceDataType||"style"===e.dataType)&&(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let e=[];if(this._map.style.stylesheet){let e=this._map.style.stylesheet;this.styleOwner=e.owner,this.styleId=e.id}let i=this._map.style._mergedSourceCaches;for(let r in i){let a=i[r];if(a.used){let i=a.getSource();i.attribution&&0>e.indexOf(i.attribution)&&e.push(i.attribution)}}e.sort((e,i)=>e.length-i.length),e=e.filter((i,r)=>{for(let a=r+1;a<e.length;a++)if(e[a].indexOf(i)>=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=[...this.options.customAttribution,...e]:e.unshift(this.options.customAttribution));let r=e.join(" | ");r!==this._attribHTML&&(this._attribHTML=r,e.length?(this._innerContainer.innerHTML=r,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class nI{constructor(){e.aJ(["_updateLogo","_updateCompact"],this)}onAdd(e){this._map=e,this._container=m("div","mapboxgl-ctrl");let i=m("a","mapboxgl-ctrl-logo");return i.target="_blank",i.rel="noopener nofollow",i.href="https://www.mapbox.com/",i.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),i.setAttribute("rel","noopener nofollow"),this._container.appendChild(i),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(e){e&&"metadata"!==e.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;let e=this._map.style._sourceCaches;if(0===Object.entries(e).length)return!0;for(let i in e){let r=e[i].getSource();if(r.hasOwnProperty("mapbox_logo")&&!r.mapbox_logo)return!1}return!0}_updateCompact(){let e=this._container.children;if(e.length){let i=e[0];this._map.getCanvasContainer().offsetWidth<250?i.classList.add("mapboxgl-compact"):i.classList.remove("mapboxgl-compact")}}}class nC{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){let i=++this._id;return this._queue.push({callback:e,id:i,cancelled:!1}),i}remove(e){let i=this._currentlyRunning;for(let r of i?this._queue.concat(i):this._queue)if(r.id===e)return void(r.cancelled=!0)}run(e=0){let i=this._currentlyRunning=this._queue;for(let r of(this._queue=[],i))if(!r.cancelled&&(r.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}class nP{constructor(e){this.jumpTo(e)}getValue(i){if(i<=this._startTime)return this._start;if(i>=this._endTime)return this._end;let r=e.cw((i-this._startTime)/(this._endTime-this._startTime));return this._start*(1-r)+this._end*r}isEasing(e){return e>=this._startTime&&e<=this._endTime}jumpTo(e){this._startTime=-1/0,this._endTime=-1/0,this._start=e,this._end=e}easeTo(e,i,r){this._start=this.getValue(i),this._end=e,this._startTime=i,this._endTime=i+r}}let nL={"AttributionControl.ToggleAttribution":"Toggle attribution","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox homepage","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use â + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"},nk=["mouseenter","mouseover","mouseleave","mouseout"];class nR extends e.x{constructor(e,i,r,a){let{point:n,lngLat:s,originalEvent:l,target:h}=e;super(e.type,{point:n,lngLat:s,originalEvent:l,target:h}),this.preventDefault=()=>{e.preventDefault()},this.id=i,this.interaction=r,this.feature=a}}class nz{constructor(e){this.map=e,this.interactionsByType=new Map,this.typeById=new Map,this.filters=new Map,this.handleType=this.handleType.bind(this)}
303add(i,r){if(this.typeById.has(i))throw Error(`Interaction id "${i}" already exists.`);let{type:a,filter:n}=r;if(n){let r=e.M(n,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===r.result)throw Error(r.value.map(e=>`${e.key}: ${e.message}`).join(", "));this.filters.set(i,r.value)}let s=this.interactionsByType.get(a)||new Map;0===s.size&&(nk.includes(a)?this.map.on(a,r.featureset,this.handleType):this.map.on(a,this.handleType),this.interactionsByType.set(a,s)),s.set(i,r),this.typeById.set(i,a)}remove(e){let i=this.typeById.get(e);if(!i)return;this.typeById.delete(e),this.filters.delete(e);let r=this.interactionsByType.get(i);r&&(r.delete(e),0===r.size&&this.map.off(i,this.handleType))}handleType(i){let r=Array.from(this.interactionsByType.get(i.type)).reverse(),a=[];for(let[,e]of r)e.featureset&&a.push({featureset:e.featureset,filter:e.filter,radius:e.radius});let n=this.map.style.queryRenderedFeaturesForInteractions(i.point,a,this.map.transform);!n.length&&nk.includes(i.type)&&(n=[null]);let s=!1;for(let a of n){for(let[n,l]of r){let{handler:r,featureset:h}=l;if(h&&(null==a||e.bi(a.featureset,h))&&!1!==r(new nR(i,n,l,a))){s=!0;break}}if(s)break}if(!s)for(let[e,a]of r){let{handler:r,featureset:n}=a;if(!n&&!1!==r(new nR(i,e,a,null)))break}}}let nD={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,antialias:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1,precompilePrograms:!0,scaleFactor:1},nO={showCompass:!0,showZoom:!0,visualizePitch:!1};class nB{constructor(i,r,a=!1){this._clickTolerance=10,this.element=r,this.mouseRotate=new a7({clickTolerance:i.dragRotate._mouseRotate._clickTolerance}),this.map=i,a&&(this.mousePitch=new ne({clickTolerance:i.dragRotate._mousePitch._clickTolerance})),e.aJ(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),r.addEventListener("mousedown",this.mousedown),r.addEventListener("touchstart",this.touchstart,{passive:!1}),r.addEventListener("touchmove",this.touchmove),r.addEventListener("touchend",this.touchend),r.addEventListener("touchcancel",this.reset)}down(e,i){this.mouseRotate.mousedown(e,i),this.mousePitch&&this.mousePitch.mousedown(e,i),x()}move(e,i){let r=this.map,a=this.mouseRotate.mousemoveWindow(e,i),n=a&&a.bearingDelta;if(n&&r.setBearing(r.getBearing()+n),this.mousePitch){let a=this.mousePitch.mousemoveWindow(e,i),n=a&&a.pitchDelta;n&&r.setPitch(r.getPitch()+n)}}off(){let e=this.element;e.removeEventListener("mousedown",this.mousedown),e.removeEventListener("touchstart",this.touchstart,{passive:!1}),e.removeEventListener("touchmove",this.touchmove),e.removeEventListener("touchend",this.touchend),e.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){v(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(i){this.down(e.l({},i,{ctrlKey:!0,preventDefault:()=>i.preventDefault()}),T(this.element,i)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(e){this.move(e,T(this.element,e))}mouseup(e){this.mouseRotate.mouseupWindow(e),this.mousePitch&&this.mousePitch.mouseupWindow(e),this.offTemp()}touchstart(e){1!==e.targetTouches.length?this.reset():(this._startPos=this._lastPos=S(this.element,e.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>e.preventDefault()},this._startPos))}touchmove(e){1!==e.targetTouches.length?this.reset():(this._lastPos=S(this.element,e.targetTouches)[0],this.move({preventDefault:()=>e.preventDefault()},this._lastPos))}touchend(e){0===e.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}function nF(i,r,a){if(i=new e.bL(i.lng,i.lat),r){let n=new e.bL(i.lng-360,i.lat),s=new e.bL(i.lng+360,i.lat),l=360*Math.ceil(Math.abs(i.lng-a.center.lng)/360),h=a.locationPoint(i).distSqr(r),u=r.x<0||r.y<0||r.x>a.width||r.y>a.height;a.locationPoint(n).distSqr(r)<h&&(u||Math.abs(n.lng-a.center.lng)<l)?i=n:a.locationPoint(s).distSqr(r)<h&&(u||Math.abs(s.lng-a.center.lng)<l)&&(i=s)}for(;Math.abs(i.lng-a.center.lng)>180;){let e=a.locationPoint(i);if(e.x>=0&&e.y>=0&&e.x<=a.width&&e.y<=a.height)break;
303i.lng>a.center.lng?i.lng-=360:i.lng+=360}return i}let nN={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};class nV extends e.E{constructor(i,r){if(super(),(i instanceof HTMLElement||r)&&(i=e.l({element:i},r)),e.aJ(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this),this._anchor=i&&i.anchor||"center",this._color=i&&i.color||"#3FB1CE",this._scale=i&&i.scale||1,this._draggable=i&&i.draggable||!1,this._clickTolerance=i&&i.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=i&&i.rotation||0,this._rotationAlignment=i&&i.rotationAlignment||"auto",this._pitchAlignment=i&&i.pitchAlignment&&i.pitchAlignment||"auto",this._updateMoving=()=>this._update(!0),this._occludedOpacity=i&&i.occludedOpacity||.2,i&&i.element)this._element=i.element,this._offset=e.P.convert(i&&i.offset||[0,0]);else{this._defaultMarker=!0,this._element=m("div");let r=_("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},this._element),a=_("radialGradient",{id:"shadowGradient"},_("defs",{},r));_("stop",{offset:"10%","stop-opacity":.4},a),_("stop",{offset:"100%","stop-opacity":.05},a),_("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},r),_("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},r),_("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},r),_("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},r),this._offset=e.P.convert(i&&i.offset||[0,-14])}this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.hasAttribute("role")||this._element.setAttribute("role","img"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",e=>{e.preventDefault()}),this._element.addEventListener("mousedown",e=>{e.preventDefault()});let a=this._element.classList;for(let e in nN)a.remove(`mapboxgl-marker-anchor-${e}`);a.add(`mapboxgl-marker-anchor-${this._anchor}`);let n=i&&i.className?i.className.trim().split(/\s+/):[];a.add(...n),this._popup=null}addTo(e){return e===this._map||(this.remove(),this._map=e,e.getCanvasContainer().appendChild(this._element),e.on("move",this._updateMoving),e.on("moveend",this._update),e.on("remove",this._clearFadeTimer),e._addMarker(this),this.setDraggable(this._draggable),this._update(),e.on("click",this._onMapClick)),this}remove(){let e=this._map;return e&&(e.off("click",this._onMapClick),e.off("move",this._updateMoving),e.off("moveend",this._update),e.off("mousedown",this._addDragHandler),e.off("touchstart",this._addDragHandler),e.off("mouseup",this._onUp),e.off("touchend",this._onUp),e.off("mousemove",this._onMove),e.off("touchmove",this._onMove),e.off("remove",this._clearFadeTimer),e._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(i){return this._lngLat=e.bL.convert(i),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){let i=Math.sqrt(91.125);e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[
3030,-38.1],"bottom-left":[i,-1*(24.6+i)],"bottom-right":[-i,-1*(24.6+i)],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=e,e._marker=this,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(e){let i=e.code,r=e.charCode||e.keyCode;"Space"!==i&&"Enter"!==i&&32!==r&&13!==r||this.togglePopup()}_onMapClick(e){let i=e.originalEvent.target,r=this._element;this._popup&&(i===r||r.contains(i))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){let e=this._popup;return e&&(e.isOpen()?(e.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(e.addTo(this._map),this._element.setAttribute("aria-expanded","true"))),this}_behindTerrain(){let e=this._map,i=this._pos;if(!e||!i)return!1;let r=e.unproject(i),a=e.getFreeCameraOptions();if(!a.position)return!1;let n=a.position.toLngLat();return n.distanceTo(r)<.9*n.distanceTo(this._lngLat)}_evaluateOpacity(){let i;let r=this._map;if(!r)return;let a=this._pos;if(!a||a.x<0||a.x>r.transform.width||a.y<0||a.y>r.transform.height)return void this._clearFadeTimer();let n=r.unproject(a);r._showingGlobe()&&e.dz(r.transform,this._lngLat)?i=0:(i=1-r._queryFogOpacity(n),r.transform._terrainEnabled()&&r.getTerrain()&&this._behindTerrain()&&(i*=this._occludedOpacity)),this._element.style.opacity=`${i}`,this._element.style.pointerEvents=i>0?"auto":"none",this._popup&&this._popup._setOpacity(i),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){let e=this._pos;if(!e||!this._map)return;let i=this._offset.mult(this._scale);this._element.style.transform=` 304 translate(${e.x}px,${e.y}px) 305 ${nN[this._anchor]} 306 ${this._calculateXYTransform()} ${this._calculateZTransform()} 307 translate(${i.x}px,${i.y}px) 308 `}_calculateXYTransform(){let i=this._pos,r=this._map,a=this.getPitchAlignment();if(!r||!i||"map"!==a)return"";if(!r._showingGlobe()){let e=r.getPitch();return e?`rotateX(${e}deg)`:""}let n=e.c1(e.dA(r.transform,this._lngLat)),s=i.sub(e.dB(r.transform)),l=Math.abs(s.x)+Math.abs(s.y);if(0===l)return"";let h=n/l;return`rotateX(${-s.y*h}deg) rotateY(${s.x*h}deg)`}_calculateZTransform(){let i=this._pos,r=this._map;if(!r||!i)return"";let a=0,n=this.getRotationAlignment();if("map"===n){if(r._showingGlobe()){let i=r.project(new e.bL(this._lngLat.lng,this._lngLat.lat+.001)),n=r.project(new e.bL(this._lngLat.lng,this._lngLat.lat-.001)).sub(i);a=e.c1(Math.atan2(n.y,n.x))-90}else a=-r.getBearing()}else if("horizon"===n){let n=e.a7(4,6,r.getZoom()),s=e.dB(r.transform);s.y+=n*r.transform.height;let l=i.sub(s),h=e.c1(Math.atan2(l.y,l.x));a=(h>90?h-270:h+90)*(1-n)}return(a+=this._rotation)?`rotateZ(${a}deg)`:""}_update(e){cancelAnimationFrame(this._updateFrameId);let i=this._map;
308i&&(i.transform.renderWorldCopies&&(this._lngLat=nF(this._lngLat,this._pos,i.transform)),this._pos=i.project(this._lngLat),!0===e?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),i._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(i._showingGlobe()||i.getTerrain()||i.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(i){return this._offset=e.P.convert(i),this._update(),this}addClassName(e){return this._element.classList.add(e),this}removeClassName(e){return this._element.classList.remove(e),this}toggleClassName(e){return this._element.classList.toggle(e)}_onMove(i){let r=this._map;if(!r)return;let a=this._pointerdownPos,n=this._positionDelta;if(a&&n){if(!this._isDragging){let e=this._clickTolerance||r._clickTolerance;if(i.point.dist(a)<e)return;this._isDragging=!0}this._pos=i.point.sub(n),this._lngLat=r.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new e.x("dragstart"))),this.fire(new e.x("drag"))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;let i=this._map;i&&(i.off("mousemove",this._onMove),i.off("touchmove",this._onMove)),"active"===this._state&&this.fire(new e.x("dragend")),this._state="inactive"}_addDragHandler(e){let i=this._map,r=this._pos;i&&r&&this._element.contains(e.originalEvent.target)&&(e.preventDefault(),this._positionDelta=e.point.sub(r),this._pointerdownPos=e.point,this._state="pending",i.on("mousemove",this._onMove),i.on("touchmove",this._onMove),i.once("mouseup",this._onUp),i.once("touchend",this._onUp))}setDraggable(e){this._draggable=!!e;let i=this._map;return i&&(e?(i.on("mousedown",this._addDragHandler),i.on("touchstart",this._addDragHandler)):(i.off("mousedown",this._addDragHandler),i.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"auto"===this._rotationAlignment||"horizon"===this._rotationAlignment&&this._map&&!this._map._showingGlobe()?"viewport":this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e||"auto",this._update(),this}getPitchAlignment(){return"auto"===this._pitchAlignment?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(e){return this._occludedOpacity=e||.2,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}let nU={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1},nj={maxWidth:100,unit:"metric"},nG={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"},nq={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"};function nW(i=new e.P(0,0),r="bottom"){if("number"==typeof i){let a=Math.round(Math.sqrt(.5*Math.pow(i,2)));switch(r){case"top":return new e.P(0,i);case"top-left":return new e.P(a,a);case"top-right":return new e.P(-a,a);case"bottom":return new e.P(0,-i);case"bottom-left":return new e.P(a,-a);case"bottom-right":return new e.P(-a,-a);case"left":return new e.P(i,0);case"right":return new e.P(-i,0)}return new e.P(0,0)}return i instanceof e.P||Array.isArray(i)?e.P.convert(i):e.P.convert(i[r]||[0,0])}return{version:l,supported:f.supported,setRTLTextPlugin:e.dC,getRTLTextPluginStatus:e.dD,Map:class extends nE{constructor(i){u.mark(h.create);let r=i;if(null!=(i=e.l({},nD,i)).minZoom&&null!=i.maxZoom&&i.minZoom>i.maxZoom)throw Error("maxZoom must be greater than or equal to minZoom");if(null!=i.minPitch&&null!=i.maxPitch&&i.minPitch>i.maxPitch)throw Error("maxPitch must be greater than or equal to minPitch");if(null!=i.minPitch&&i.minPitch<0)throw Error("minPitch must be greater than or equal to 0");if(null!=i.maxPitch&&i.maxPitch>85)throw Error("maxPitch must be less than or equal to 85");if(i.antialias&&e.dx(window)&&(i.antialias=!1,e.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new t8(i.minZoom,i.maxZoom,i.minPitch,i.maxPitch,i.renderWorldCopies),i),this._repaint=!!i.repaint,this._interactive=i.interactive,this._minTileCacheSize=i.minTileCacheSize,this._maxTileC
308acheSize=i.maxTileCacheSize,this._failIfMajorPerformanceCaveat=i.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=i.preserveDrawingBuffer,this._antialias=i.antialias,this._trackResize=i.trackResize,this._bearingSnap=i.bearingSnap,this._refreshExpiredTiles=i.refreshExpiredTiles,this._fadeDuration=i.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=i.crossSourceCollisions,this._collectResourceTiming=i.collectResourceTiming,this._language=this._parseLanguage(i.language),this._worldview=i.worldview,this._renderTaskQueue=new nC,this._domRenderTaskQueue=new nC,this._controls=[],this._markers=[],this._popups=[],this._mapId=e.aQ(),this._locale=e.l({},nL,i.locale),this._clickTolerance=i.clickTolerance,this._cooperativeGestures=i.cooperativeGestures,this._performanceMetricsCollection=i.performanceMetricsCollection,this._tessellationStep=i.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=i.precompilePrograms,this._scaleFactorChanged=!1,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new nP(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=i.scaleFactor,this._requestManager=new I(i.transformRequest,i.accessToken,i.testMode),this._silenceAuthErrors=!!i.testMode,this._contextCreateOptions=i.contextCreateOptions?{...i.contextCreateOptions}:{},"string"==typeof i.container){let e=document.getElementById(i.container);if(!e)throw Error(`Container '${i.container.toString()}' not found.`);this._container=e}else{if(!(i.container instanceof HTMLElement))throw Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=i.container}if(this._container.childNodes.length>0&&e.w("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),i.maxBounds&&this.setMaxBounds(i.maxBounds),e.aJ(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._tp||(this._tp=new aD),this._tp.registerParameter(this,["Debug"],"showOverdrawInspector"),this._tp.registerParameter(this,["Debug"],"showTileBoundaries"),this._tp.registerParameter(this,["Debug"],"showParseStatus"),this._tp.registerParameter(this,["Debug"],"repaint"),this._tp.registerParameter(this,["Debug"],"showTileAABBs"),this._tp.registerParameter(this,["Debug"],"showPadding"),this._tp.registerParameter(this,["Debug"],"showCollisionBoxes",{noSave:!0}),this._tp.registerParameter(this.transform,["Debug"],"freezeTileCoverage",{noSave:!0},()=>{this._update()}),this._tp.registerParameter(this,["Debug","Wireframe"],"showTerrainWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers2DWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers3DWireframe"),this._tp.registerParameter(this,["Scaling"],"_scaleFactor",{min:.1,max:10,step:.1},()=>{this.setScaleFactor(this._scaleFactor)}),this._setupPainter(),void 0===this.painter)throw Error("Failed to initialize WebGL.");if(this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this._fullscreenchangeEvent="onfullscreenchange"in document?"fullscreenchange":"webkitfullscreenchange",window.addEventListener("online",this._onWindowOnline,!1),window.addEventListener("resize",this._onWindowResize,!1),window.addEventListener("orientationchange",this._onWindowResize,!1),window.addEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.addEventListener("visibilitychange",this._onVisibilityChange,!1),this.handlers=new nS(this,i),this._localFontFamily=i.localFontFamily,this._localIdeographFontFamily=i.localIdeographFontFamily,(i.style||!i.testMode)&&this.setStyle(i.style||e.e.DEFAULT_STYLE,{config:i.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),i.projection&&this.setProjection(i.projection),i.hash&&(this._hash=new aV("string"==typeof i.hash&&i.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){null==r.center&&null==r.zoom||(this.transform._unmodified=!1),this.jumpTo({center:i.center,zoom:i.zoom,bearing:i.bearing,pitch:i.pitch});let a=i.bounds;a&&(this.resize(),this.fitBounds(a,e.l({},i.fitBoundsOptions,{duration:0})))}this.resize(),i.attributionControl&&this.addControl(new nA({customAttribution:i.customAttribution}
308)),this._logoControl=new nI,this.addControl(this._logoControl,i.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent()}),this.on("data",i=>{this._update("style"===i.dataType),this.fire(new e.x(`${i.dataType}data`,i))}),this.on("dataloading",i=>{this.fire(new e.x(`${i.dataType}dataloading`,i))}),this._interactions=new nz(this)}_getMapId(){return this._mapId}addControl(i,r){if(void 0===r&&(r=i.getDefaultPosition?i.getDefaultPosition():"top-right"),!i||!i.onAdd)return this.fire(new e.t(Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let a=i.onAdd(this);this._controls.push(i);let n=this._controlPositions[r];return -1!==r.indexOf("bottom")?n.insertBefore(a,n.firstChild):n.appendChild(a),this}removeControl(i){if(!i||!i.onRemove)return this.fire(new e.t(Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let r=this._controls.indexOf(i);return r>-1&&this._controls.splice(r,1),i.onRemove(this),this}hasControl(e){return this._controls.indexOf(e)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(i){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));let r=!this._moving;return r&&this.fire(new e.x("movestart",i)).fire(new e.x("move",i)),this.fire(new e.x("resize",i)),r&&this.fire(new e.x("moveend",i)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(i){return this.transform.setMaxBounds(e.as.convert(i)),this._update()}setMinZoom(i){if((i=i??-2)>=-2&&i<=this.transform.maxZoom)return this.transform.minZoom=i,this._update(),this.getZoom()<i?this.setZoom(i):this.fire(new e.x("zoomstart")).fire(new e.x("zoom")).fire(new e.x("zoomend")),this;throw Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(i){if((i=i??22)>=this.transform.minZoom)return this.transform.maxZoom=i,this._update(),this.getZoom()>i?this.setZoom(i):this.fire(new e.x("zoomstart")).fire(new e.x("zoom")).fire(new e.x("zoomend")),this;throw Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(i){if((i=i??0)<0)throw Error("minPitch must be greater than or equal to 0");if(i>=0&&i<=this.transform.maxPitch)return this.transform.minPitch=i,this._update(),this.getPitch()<i?this.setPitch(i):this.fire(new e.x("pitchstart")).fire(new e.x("pitch")).fire(new e.x("pitchend")),this;throw Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(i){if((i=i??85)>85)throw Error("maxPitch must be less than or equal to 85");if(i>=this.transform.minPitch)return this.transform.maxPitch=i,this._update(),this.getPitch()>i?this.setPitch(i):this.fire(new e.x("pitchstart")).fire(new e.x("pitch")).fire(new e.x("pitchend")),this;throw Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getScaleFactor(){return this._scaleFactor}setScaleFactor(e){return this._scaleFactor=e,this.painter.scaleFactor=e,this._tp.refreshUI(),this._scaleFactorChanged=!0,this.style._updateFilteredLayers(e=>"symbol"===e.type),this._update(!0),this}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.renderWorldCopies=e,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(e){return"auto"===e?navigator.language:Array.isArray(e)?0===e.length?void 0:e.map(e=>"auto"===e?navigator.language:e):e}setLanguage(e){let i=this._parseLanguage(e);if(!this.style||i===this._language)return this;for(let e of(this._language=i,this.style.reloadSources(),this._controls))e._setLanguage&&e._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(e){return this.style&&e!==this._worldview&&(this._worldview=e,this.style.reloadSources()),this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return"globe"===this.transform.projection.name}setProjection(e){return this._lazyInitEmptyStyle(),e?"string"==typeof e&&(e={name:e}):e=null,this._useExplicitProjection=!!e,this._prioritizeAndUpdateProjection(e,this.style.projection)}_updateProjectionTransition(){let i;if("globe"!==this.getProjection().name)return;let r=this.transform,a=r.projection.name;"globe"===a&&r.zoom>=e.bV?(r.setMercatorFromTransition(),i=!0):"mercator"===a&&r.zoom<e.bV&&(r.setProjection({name:"globe"}),i=!0),i&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayer
308Update())}_prioritizeAndUpdateProjection(e,i){return this._updateProjection(e||i||{name:"mercator"})}_updateProjection(i){let r;return r="globe"===i.name&&this.transform.zoom>=e.bV?this.transform.setMercatorFromTransition():this.transform.setProjection(i),this.style.applyProjectionUpdate(),r&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(i){return this.transform.locationPoint3D(e.bL.convert(i))}unproject(i){return this.transform.pointLocation3D(e.P.convert(i))}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(e,i,r){let a=e=>{let r=[];if(Array.isArray(i)){let a=i.filter(e=>this.getLayer(e));r=a.length?this.queryRenderedFeatures(e,{layers:a}):[]}else r=this.queryRenderedFeatures(e,{featureset:i});return r};if("mouseenter"===e||"mouseover"===e){let n=!1;return{listener:r,targets:i,delegates:{mousemove:i=>{let s=a(i.point);s.length?n||(n=!0,r.call(this,new aY(e,this,i.originalEvent,{features:s}))):n=!1},mouseout:()=>{n=!1}}}}if("mouseleave"===e||"mouseout"===e){let n=!1;return{listener:r,targets:i,delegates:{mousemove:i=>{a(i.point).length?n=!0:n&&(n=!1,r.call(this,new aY(e,this,i.originalEvent)))},mouseout:i=>{n&&(n=!1,r.call(this,new aY(e,this,i.originalEvent)))}}}}return{listener:r,targets:i,delegates:{[e]:e=>{let i=a(e.point);i.length&&(e.features=i,r.call(this,e),delete e.features)}}}}on(e,i,r){if("function"==typeof i||void 0===r)return super.on(e,i);if("string"==typeof i&&(i=[i]),!this._areTargetsValid(i))return this;let a=this._createDelegatedListener(e,i,r);for(let i in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(a),a.delegates)this.on(i,a.delegates[i]);return this}once(e,i,r){if("function"==typeof i||void 0===r)return super.once(e,i);if("string"==typeof i&&(i=[i]),!this._areTargetsValid(i))return this;let a=this._createDelegatedListener(e,i,r);for(let e in a.delegates)this.once(e,a.delegates[e]);return this}off(i,r,a){if("function"==typeof r||void 0===a)return super.off(i,r);if("string"==typeof r&&(r=[r]),!this._areTargetsValid(r))return this;let n=this._delegatedListeners?this._delegatedListeners[i]:void 0;return n&&(i=>{for(let n=0;n<i.length;n++){let s=i[n];if(s.listener===a&&function(i,r){if(Array.isArray(i)&&Array.isArray(r)){let e=new Set(i),a=new Set(r);return e.size===a.size&&i.every(e=>a.has(e))}return e.bi(i,r)}(s.targets,r)){for(let e in s.delegates)this.off(e,s.delegates[e]);return i.splice(n,1),this}}})(n),this}queryRenderedFeatures(i,r){if(!this.style)return[];if(void 0!==r||void 0===i||i instanceof e.P||Array.isArray(i)||(r=i,i=void 0),i=i||[[0,0],[this.transform.width,this.transform.height]],"featureset"in(r=r||{}))return this._isFeaturesetDescriptorValid(r.featureset)?this.style.queryRenderedFeaturesForInteractions(i,[r],this.transform):[];if(r.layers&&Array.isArray(r.layers)){for(let e of r.layers)if(!this._isValidId(e))return[]}return this.style.queryRenderedFeatures(i,r,this.transform)}querySourceFeatures(e,i){return e&&("string"!=typeof e||this._isValidId(e))?this.style.querySourceFeatures(e,i):[]}isPointOnSurface(i){let{name:r}=this.transform.projection;return"globe"!==r&&"mercator"!==r&&e.w(`${r} projection does not support isPointOnSurface, this API may behave unexpectedly.`),this.transform.isPointOnSurface(e.P.convert(i))}addInteraction(e,i){return this._interactions.add(e,i),this}removeInteraction(e){return this._interactions.remove(e),this}setStyle(i,r){return r=e.l({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily},r),this.style&&i&&!1!==r.diff&&r.localFontFamily===this._localFontFamily&&r.localIdeographFontFamily===this._localIdeographFontFamily&&!r.config?(this.style._diffStyle(i,(a,n)=>{a?(e.w(`Unable to perform style diff: ${String(a.message||a.error||a)}. Rebuilding the style from scratch.`),this._updateStyle(i,r)):n&&this._update(!0)},()=>{this._postStyleLoadEvent()}),this):(this._localIdeographFontFamily=r.localIdeographFontFamily,this._localFontFamily=r.localFontFamily,this._updateStyle(i,r))}_getUIString(e){let i=this._locale[e];if(null==i)throw Error(`Missing UI string '${e}'`);return i}_updateStyle(i,r){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),i){let a=e.l({},r);r&&r.config&&(a.initialConfig=r.config,delete a.config),this.style=new im(this,a).load(i),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new im(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(e.w("There is no style added to the map."),!1)}_isValidId(i){return null==i?(this.fire(new e.t(Error("IDs can't be empty."))),!1):!e.aK(i)||(this.fire(new e.t(Error(`IDs can't
308contain special symbols: "${i}".`))),!1)}_isFeaturesetDescriptorValid(e){return"featuresetId"in e?this._isValidId(e.featuresetId):"layerId"in e&&this._isValidId(e.layerId)}_areTargetsValid(e){if(Array.isArray(e)){for(let i of e)if(!this._isValidId(i))return!1;return!0}return this._isFeaturesetDescriptorValid(e)}addSource(e,i){return this._isValidId(e)?(this._lazyInitEmptyStyle(),this.style.addSource(e,i),this._update(!0)):this}isSourceLoaded(e){return!!this._isValidId(e)&&!!this.style&&this.style._isSourceCacheLoaded(e)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(e,i,r){this._lazyInitEmptyStyle(),this.style.addSourceType(e,i,r)}removeSource(e){return this._isValidId(e)?(this.style.removeSource(e),this._updateTerrain(),this._update(!0)):this}getSource(e){return this._isValidId(e)?this.style.getOwnSource(e):null}addImage(i,r,{pixelRatio:a=1,sdf:n=!1,stretchX:s,stretchY:l,content:h}={}){if(this._lazyInitEmptyStyle(),r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap){let{width:u,height:c,data:d}=e.q.getImageData(r);this.style.addImage(i,{data:new e.r({width:u,height:c},d),pixelRatio:a,stretchX:s,stretchY:l,content:h,sdf:n,version:0})}else if(void 0===r.width||void 0===r.height)this.fire(new e.t(Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{let{width:u,height:c}=r;this.style.addImage(i,{data:new e.r({width:u,height:c},new Uint8Array(r.data)),pixelRatio:a,stretchX:s,stretchY:l,content:h,sdf:n,version:0,userImage:r}),r.onAdd&&r.onAdd(this,i)}}updateImage(i,r){this._lazyInitEmptyStyle();let a=this.style.getImage(i);if(!a)return void this.fire(new e.t(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let{width:n,height:s,data:l}=r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap?e.q.getImageData(r):r;if(void 0===n||void 0===s)return void this.fire(new e.t(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(n!==a.data.width||s!==a.data.height)return void this.fire(new e.t(Error(`The width and height of the updated image (${n}, ${s}) 309 must be that same as the previous version of the image 310 (${a.data.width}, ${a.data.height})`)));let h=!(r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap);a.data.replace(l,h),this.style.updateImage(i,a)}hasImage(i){return i?!!this.style&&!!this.style.getImage(i):(this.fire(new e.t(Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}loadImage(i,r){e.o(this._requestManager.transformRequest(i,e.R.Image),(i,a)=>{r(i,a instanceof HTMLImageElement?e.q.getImageData(a):a)})}listImages(){return this.style.listImages()}addModel(e,i){this._lazyInitEmptyStyle(),this.style.addModel(e,i)}hasModel(i){return i?this.style.hasModel(i):(this.fire(new e.t(Error("Missing required model id"))),!1)}removeModel(e){this.style.removeModel(e)}listModels(){return this.style.listModels()}addLayer(e,i){return this._isValidId(e.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(e,i),this._update(!0)):this}getSlot(e){let i=this.getLayer(e);return i&&i.slot||null}setSlot(e,i){return this.style.setSlot(e,i),this.style.mergeLayers(),this._update(!0)}addImport(e,i){return this.style.addImport(e,i),this}updateImport(e,i){return"string"!=typeof i&&i.id!==e?(this.removeImport(e),this.addImport(i)):(this.style.updateImport(e,i),this._update(!0))}removeImport(e){return this.style.removeImport(e),this}moveImport(e,i){return this.style.moveImport(e,i),this._update(!0)}moveLayer(e,i){return this._isValidId(e)?(this.style.moveLayer(e,i),this._update(!0)):this}removeLayer(e){return this._isValidId(e)?(this.style.removeLayer(e),this._update(!0)):this}getLayer(e){if(!this._isValidId(e))return null;let i=this.style.getOwnLayer(e);return i?"custom"===i.type?i.implementation:i.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(e,i,r){return this._isValidId(e)?(this.style.setLayerZoomRange(e,i,r),this._update(!0)):this}setFilter(e,i,r={}){return this._isValidId(e)?(this.style.setFilter(e,i,r),this._update(!0)):this}getFilter(e){return this._isValidId(e)?this.style.getFilter(e):null}setPaintProperty(e,i,r,a={}){return this._isValidId(e)?(this.style.setPaintProperty(e,i,r,a),this._update(!0)):this}getPaintProperty(e,i){return this._isValidId(e)?this.style.getPaintProperty(e,i):null}setLayoutProperty(e,i,r,a={}){return this._isValidId(e)?(this.style.setLayoutProperty(e,i,r,a),this._update(!0)):this}getLayoutProperty(e,i){return this._isValidId(e)?this.style.getLayoutProperty(e,i):null}getSchema(e){return this.style.getSchema(e)}setSchema(e,i){return this.style.setSchema(e,i),this._update(!0)}getConfig(e){return this.style.getConfig(e)}setConfig(e,i){return this.style.setConfig(e,i),this._update(!0)}getConfigProperty(e,i){return this.style.getConfigProperty(e,i)}setConfigProperty(e,i,r){return this.style.setConfigProperty(e,i,r),this._update(!0)}getFeaturesetDescriptors(e){return this.style.getFeaturesetDescriptors(e)}setLights(e){if(this._lazyInitEmptyStyle(),e&&1===e.length&&"flat"===e[0].type){let i=e[0];i.properties?this.style.setFlatLight(i.properties,i.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(e),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){let e=this.style.getLights()||[];return 0===e.length&&e.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),e}setLight(e,i={}
310){return console.log("The `map.setLight` function is deprecated, prefer using `map.setLights` with `flat` light type instead."),this.setLights([{id:"flat",type:"flat",properties:e}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(e){return this._lazyInitEmptyStyle(),!e&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(e),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(e){return this._lazyInitEmptyStyle(),this.style.setFog(e),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setColorTheme(e){return this._lazyInitEmptyStyle(),this.style.setColorTheme(e),this._update(!0)}setCamera(e){return this.style.setCamera(e),this._triggerCameraUpdate(e)}_triggerCameraUpdate(e){return this._update(this.transform.setOrthographicProjectionAtLowPitch("orthographic"===e["camera-projection"]))}getCamera(){return this.style.camera}_queryFogOpacity(i){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(e.bL.convert(i),this.transform):0}setFeatureState(e,i){return e.source&&!this._isValidId(e.source)?this:(this.style.setFeatureState(e,i),this._update())}removeFeatureState(e,i){return e.source&&!this._isValidId(e.source)?this:(this.style.removeFeatureState(e,i),this._update())}getFeatureState(e){return e.source&&!this._isValidId(e.source)?null:this.style.getFeatureState(e)}_updateContainerDimensions(){if(!this._container)return;let e=this._container.getBoundingClientRect().width||400,i=this._container.getBoundingClientRect().height||300,r,a,n,s=this._container;for(;s&&(!a||!n);){let e=window.getComputedStyle(s).transform;e&&"none"!==e&&((r=e.match(/matrix.*\((.+)\)/)[1].split(", "))[0]&&"0"!==r[0]&&"1"!==r[0]&&(a=r[0]),r[3]&&"0"!==r[3]&&"1"!==r[3]&&(n=r[3])),s=s.parentElement}this._containerWidth=a?Math.abs(e/a):e,this._containerHeight=n?Math.abs(i/n):i}_detectMissingCSS(){"rgb(250, 128, 114)"!==window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&e.w("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){let e=this._container;e.classList.add("mapboxgl-map"),(this._missingCSSCanary=m("div","mapboxgl-canary",e)).style.visibility="hidden",this._detectMissingCSS();let i=this._canvasContainer=m("div","mapboxgl-canvas-container",e);this._canvas=m("canvas","mapboxgl-canvas",i),this._interactive&&(i.classList.add("mapboxgl-interactive"),this._canvas.setAttribute("tabindex","0")),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);let r=this._controlContainer=m("div","mapboxgl-control-container",e),a=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(e=>{a[e]=m("div",`mapboxgl-ctrl-${e}`,r)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(i,r){let a=e.q.devicePixelRatio||1;this._canvas.width=a*Math.ceil(i),this._canvas.height=a*Math.ceil(r),this._canvas.style.width=`${i}px`,this._canvas.style.height=`${r}px`}_addMarker(e){this._markers.push(e)}_removeMarker(e){let i=this._markers.indexOf(e);-1!==i&&this._markers.splice(i,1)}_addPopup(e){this._popups.push(e)}_removePopup(e){let i=this._popups.indexOf(e);-1!==i&&this._popups.splice(i,1)}_setupPainter(){let i=e.l({},f.supported.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),r=this._canvas.getContext("webgl2",i);r?($(r,!0),this.painter=new aF(r,this._contextCreateOptions,this.transform,this._scaleFactor,this._tp),this.on("data",e=>{"source"===e.dataType&&this.painter.setTileLoadedFlag(!0)}),e.m.testSupport(r)):this.fire(new e.t(Error("Failed to initialize WebGL")))}_contextLost(i){i.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new e.x("webglcontextlost",{originalEvent:i}))}_contextRestored(i){this._setupPainter(),this.resize(),this._update(),this.fire(new e.x("webglcontextrestored",{originalEvent:i}))}_onMapScroll(e){if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}idle(){return!this.isMoving()&&this.loaded()}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}frameReady(){return this.loaded()&&!this._placementDirty}_update(e){return this.style&&(this._styleDirty=this._styleDirty||e,this._sourcesDirty=!0,this.triggerRepaint()),this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_requestDomTask(e){!this.loaded()||this.loaded()&&!this.isMoving()?e():this._domRenderTaskQueue.add(e)}_render(i){let r;this.fire(new e.x("renderstart")),++this._frameId;let a=this.painter.context.extTimerQuery,n=e.q.now(),s=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(r=s.createQuery(),s.beginQuery(a.TIME_ELAPSED_EXT,r)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&
310(this._interactionRange[0]=Math.min(this._interactionRange[0],performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],performance.now())),this._renderTaskQueue.run(i),this._domRenderTaskQueue.run(i),this._removed)return;this._updateProjectionTransition();let l=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;let i=this.transform.zoom,r=this.transform.pitch,a=e.q.now(),n=new e.a3(i,{now:a,fadeDuration:l,pitch:r,transition:this.style.transition});this.style.update(n)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let c=!1;this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),c=this._updateAverageElevation(n),this.style.updateSources(this.transform),this._forceMarkerAndPopupUpdate()):c=this._updateAverageElevation(n);let d=this.style&&this.style._updatePlacement(this.painter,this.painter.transform,this.showCollisionBoxes,l,this._crossSourceCollisions,this.painter.replacementSource,this._scaleFactorChanged);if(this._scaleFactorChanged&&(this._scaleFactorChanged=!1),d&&(this._placementDirty=d.needsRerender),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showParseStatus:this.showParseStatus,wireframe:{terrain:this.showTerrainWireframe,layers2D:this.showLayers2DWireframe,layers3D:this.showLayers3DWireframe},showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:l,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new e.x("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,u.mark(h.load),this.fire(new e.x("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),r){let i=e.q.now()-n;s.endQuery(a.TIME_ELAPSED_EXT),setTimeout(()=>{let a=s.getQueryParameter(r,s.QUERY_RESULT)/1e6;s.deleteQuery(r),this.fire(new e.x("gpu-timing-frame",{cpuTime:i,gpuTime:a}))},50)}if(this.listens("gpu-timing-layer")){let i=this.painter.collectGpuTimers();setTimeout(()=>{let r=this.painter.queryGpuTimers(i);this.fire(new e.x("gpu-timing-layer",{layerTimes:r}))},50)}if(this.listens("gpu-timing-deferred-render")){let i=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{let r=this.painter.queryGpuTimeDeferredRender(i);this.fire(new e.x("gpu-timing-deferred-render",{gpuTime:r}))},50)}let p=this._sourcesDirty||this._styleDirty||this._placementDirty||c;if(p||this._repaint)this.triggerRepaint();else{let i=this.idle();if(i&&(c=this._updateAverageElevation(n,!0)),c)this.triggerRepaint();else if(this._triggerFrame(!1),i&&(this.fire(new e.x("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){let i=this._calculateSpeedIndex();this.fire(new e.x("speedindexcompleted",{speedIndex:i})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||p||(this._fullyLoaded=!0,u.mark(h.fullLoad),this._performanceMetricsCollection&&j(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(e){for(let i of this._markers)e&&!this.getRenderWorldCopies()&&(i._lngLat=i._lngLat.wrap()),i._update();for(let i of this._popups)!e||this.getRenderWorldCopies()||i._trackPointer||(i._lngLat=i._lngLat.wrap()),i._update()}_updateAverageElevation(e,i=!1){let r=e=>(this.transform.averageElevation=e,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return 0!==this.transform.averageElevation&&r(0);let a=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(a||(i||e-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(e)){let i=this.transform.averageElevation,n=this.transform.sampleAverageElevation();null!=this.transform.elevation&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(n)?n=0:this._averageElevationLastSampledAt=e;let s=Math.abs(i-n);if(s>
3101){if(this._isInitialLoad||a)return this._averageElevation.jumpTo(n),r(n);this._averageElevation.easeTo(n,e,300)}else if(s>1e-4)return this._averageElevation.jumpTo(n),r(n)}return!!this._averageElevation.isEasing(e)&&r(this._averageElevation.getValue(e))}_authenticate(){q(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,i=>{if(i&&(i.message===A||401===i.status)){let i=this.painter.context.gl;$(i,!1),this._logoControl instanceof nI&&this._logoControl._updateLogo(),i&&i.clear(i.DEPTH_BUFFER_BIT|i.COLOR_BUFFER_BIT|i.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new e.t(Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}}),F(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&V(this._requestManager._customAccessToken,{map:this,skuToken:this._requestManager._skuToken,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_updateTerrain(){let e=this._isDragging();this.painter.updateTerrain(this.style,e)}_calculateSpeedIndex(){let e=this.painter.canvasCopy(),i=this.painter.getCanvasCopiesAndTimestamps();i.timeStamps.push(performance.now());let r=this.painter.context.gl,a=r.createFramebuffer();function n(e){r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,e,0);let i=new Uint8Array(r.drawingBufferWidth*r.drawingBufferHeight*4);return r.readPixels(0,0,r.drawingBufferWidth,r.drawingBufferHeight,r.RGBA,r.UNSIGNED_BYTE,i),i}return r.bindFramebuffer(r.FRAMEBUFFER,a),this._canvasPixelComparison(n(e),i.canvasCopies.map(n),i.timeStamps)}_canvasPixelComparison(e,i,r){let a=r[1]-r[0],n=e.length/4;for(let s=0;s<i.length;s++){let l=i[s],h=0;for(let i=0;i<l.length;i+=4)l[i]===e[i]&&l[i+1]===e[i+1]&&l[i+2]===e[i+2]&&l[i+3]===e[i+3]&&(h+=1);a+=(r[s+2]-r[s+1])*(1-h/n)}return a}remove(){for(let e of(this._hash&&this._hash.remove(),this._controls))e.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this._domRenderTaskQueue.clear(),this.style&&this.style.destroy(),this.painter.destroy(),this.handlers&&this.handlers.destroy(),this.handlers=void 0,this.setStyle(null),window.removeEventListener("resize",this._onWindowResize,!1),window.removeEventListener("orientationchange",this._onWindowResize,!1),window.removeEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.removeEventListener("online",this._onWindowOnline,!1),window.removeEventListener("visibilitychange",this._onVisibilityChange,!1);let i=this.painter.context.gl.getExtension("WEBGL_lose_context");i&&i.loseContext(),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._missingCSSCanary.remove(),this._canvas=void 0,this._canvasContainer=void 0,this._controlContainer=void 0,this._missingCSSCanary=void 0,this._container.classList.remove("mapboxgl-map"),this._container.removeEventListener("scroll",this._onMapScroll,!1),W.delete(this.painter.context.gl),G.remove(),B.remove(),this._removed=!0,this.fire(new e.x("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(i){this._renderNextFrame=this._renderNextFrame||i,this.style&&!this._frame&&(this._frame=e.q.frame(e=>{let i=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,i&&this._render(e)}))}_preloadTiles(i){let r=this.style?this.style.getSourceCaches():[];return e.bg(r,(e,r)=>e._preloadTiles(i,r),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(e){this._trackResize&&this.resize({originalEvent:e})._update()}_onVisibilityChange(){"hidden"===document.visibilityState&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._tp.refreshUI(),this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(e){this._showParseStatus!==e&&(this._showParseStatus=e,this._tp.refreshUI(),this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(e){this._showTerrainWireframe!==e&&(this._showTerrainWireframe=e,this._tp.refreshUI(),this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(e){this._showLayers2DWireframe!==e&&(this._showLayers2DWireframe=e,this._tp.refreshUI(),this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(e){this._showLayers3DWireframe!==e&&(this._showLayers3DWireframe=e,this._tp.refreshUI(),this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(e){this._speedIndexTiming!==e&&(this._speedIndexTiming=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._tp.refreshUI(),this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,this._tp.refreshUI(),e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._tp.refreshUI(),this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this._tp.refreshUI(),this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(e){this._showTileAABBs!==e&&(this._showTileAABBs=e,this._tp.refreshUI(),e&&this._update())}_setCacheLimits(i,r){e.dy(i,r)}get version(){return l}},NavigationControl:class{constructor(i={}){this.options=e.l({},nO,i),this._container=m("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(e.aJ(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",e=>{this._map&&this._map.zoomIn({},{originalEvent:e})}),m("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",e=>{this._map&&this._map.zoomOut({},{originalEvent:e})}),m("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(e.aJ(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",e=>{let i=this._map;i&&(this.options.visualizePitch?i.resetNorthPitch({},{originalEvent:e}):i.resetNorth({},{originalEvent:e}))}),this._compassIcon=m("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){let e=this._map;if(!e)return;
310let i=e.getZoom(),r=i===e.getMaxZoom(),a=i===e.getMinZoom();this._zoomInButton.disabled=r,this._zoomOutButton.disabled=a,this._zoomInButton.setAttribute("aria-disabled",r.toString()),this._zoomOutButton.setAttribute("aria-disabled",a.toString())}_rotateCompassArrow(){let e=this._map;if(!e)return;let i=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(e.transform.pitch*(Math.PI/180)),.5)}) rotateX(${e.transform.pitch}deg) rotateZ(${e.transform.angle*(180/Math.PI)}deg)`:`rotate(${e.transform.angle*(180/Math.PI)}deg)`;e._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=i)})}onAdd(e){return this._map=e,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),e.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&e.on("pitch",this._rotateCompassArrow),e.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new nB(e,this._compass,this.options.visualizePitch)),this._container}onRemove(){let e=this._map;e&&(this._container.remove(),this.options.showZoom&&e.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&e.off("pitch",this._rotateCompassArrow),e.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(e,i){let r=m("button",e,this._container);return r.type="button",r.addEventListener("click",i),r}_setButtonTitle(e,i){if(!this._map)return;let r=this._map._getUIString(`NavigationControl.${i}`);e.setAttribute("aria-label",r),e.firstElementChild&&e.firstElementChild.setAttribute("title",r)}},GeolocateControl:class extends e.E{constructor(i={}){super();let r=navigator.geolocation;this.options=e.l({geolocation:r},nU,i),e.aJ(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=aN(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(e){return this._map=e,this._container=m("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){void 0!==this._geolocationWatchID&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(e){let i=(i=!!this.options.geolocation)=>{this._supportsGeolocation=i,e(i)};void 0!==this._supportsGeolocation?e(this._supportsGeolocation):void 0!==navigator.permissions?navigator.permissions.query({name:"geolocation"}).then(e=>i("denied"!==e.state)).catch(()=>i()):i()}_isOutOfMapMaxBounds(e){let i=this._map.getMaxBounds(),r=e.coords;return!!i&&(r.longitude<i.getWest()||r.longitude>i.getEast()||r.latitude<i.getSouth()||r.latitude>i.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(i){if(this._map){if(this._isOutOfMapMaxBounds(i))return this._setErrorState(),this.fire(new e.x("outofmaxbounds",i)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=i,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_E
310RROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(i),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(i),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new e.x("geolocate",i)),this._finish()}}_updateCamera(i){let r=new e.bL(i.coords.longitude,i.coords.latitude),a=i.coords.accuracy,n=this._map.getBearing(),s=e.l({bearing:n},this.options.fitBoundsOptions);this._map.fitBounds(r.toBounds(a),s,{geolocateSource:!0})}_updateMarker(i){if(i){let r=new e.bL(i.coords.longitude,i.coords.latitude);this._accuracyCircleMarker.setLngLat(r).addTo(this._map),this._userLocationDotMarker.setLngLat(r).addTo(this._map),this._accuracy=i.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){let i=this._map.transform,r=e.bE(1,i._center.lat)*i.worldSize,a=Math.ceil(2*this._accuracy*r);this._circleElement.style.width=`${a}px`,this._circleElement.style.height=`${a}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&"number"==typeof this._heading?(this._userLocationDotMarker.setRotation(this._heading),this._userLocationDotMarker.addClassName("mapboxgl-user-location-show-heading")):(this._userLocationDotMarker.removeClassName("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(i){if(this._map){if(this.options.trackUserLocation){if(1===i.code){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;let e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",e),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",e),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===i.code&&this._noTimeout)return;this._setErrorState()}}"OFF"!==this._watchState&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new e.x("error",i)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(i){if(void 0!==this._map){if(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=m("button","mapboxgl-ctrl-geolocate",this._container),m("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===i){e.w("Geolocation support is not available so the GeolocateControl will be disabled.");let i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",i),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",i)}else{let e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",e),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","fal
310se"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=m("div","mapboxgl-user-location"),this._dotElement.appendChild(m("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(m("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new nV({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=m("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new nV({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",i=>{i.geolocateSource||"ACTIVE_LOCK"!==this._watchState||i.originalEvent&&"resize"===i.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new e.x("trackuserlocationend")))})}}_onDeviceOrientation(e){this._userLocationDotMarker&&(e.webkitCompassHeading?this._heading=e.webkitCompassHeading:!0===e.absolute&&(this._heading=-1*e.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return e.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 e.x("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new e.x("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new e.x("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let e;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(e={maximumAge:6e5,timeout:0},this._noTimeout=!0):(e=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,e),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=window.setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){let e=()=>{"ondeviceorientationabsolute"in window?window.addEventListener("deviceorientationabsolute",this._onDeviceOrientation):window.addEventListener("deviceorientation",this._onDeviceOrientation)};"undefined"!=typeof DeviceMotionEvent&&"function"==typeof DeviceMotionEvent.requestPermission?DeviceOrientationEvent.requestPermission().then(i=>{"granted"===i&&e()}).catch(console.error):e()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","fal
310se"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:nA,ScaleControl:class{constructor(i={}){this.options=e.l({},nj,i),this._isNumberFormatSupported=function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"short",unit:"meter"}),!0}catch(e){return!1}}(),e.aJ(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){let e=this.options.maxWidth||100,i=this._map,r=i._containerHeight/2,a=i._containerWidth/2-e/2,n=i.unproject([a,r]),s=i.unproject([a+e,r]),l=n.distanceTo(s);if("imperial"===this.options.unit){let i=3.2808*l;i>5280?this._setScale(e,i/5280,"mile"):this._setScale(e,i,"foot")}else"nautical"===this.options.unit?this._setScale(e,l/1852,"nautical-mile"):l>=1e3?this._setScale(e,l/1e3,"kilometer"):this._setScale(e,l,"meter")}_setScale(e,i,r){this._map._requestDomTask(()=>{let a=function(e){let i=Math.pow(10,`${Math.floor(e)}`.length-1),r=e/i;return i*(r=r>=10?10:r>=5?5:r>=3?3:r>=2?2:r>=1?1:function(e){let i=Math.pow(10,Math.ceil(-Math.log(e)/Math.LN10));return Math.round(e*i)/i}(r))}(i),n=a/i;this._container.innerHTML=this._isNumberFormatSupported&&"nautical-mile"!==r?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:r}).format(a):`${a} ${nG[r]}`,this._container.style.width=e*n+"px"})}onAdd(e){return this._map=e,this._language=e.getLanguage(),this._container=m("div","mapboxgl-ctrl mapboxgl-ctrl-scale",e.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(e){this._language=e,this._update()}setUnit(e){this.options.unit=e,this._update()}},FullscreenControl:class{constructor(i={}){this._fullscreen=!1,i&&i.container&&(i.container instanceof HTMLElement?this._container=i.container:e.w("Full screen control 'container' must be a DOM element.")),e.aJ(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(i){return this._map=i,this._container||(this._container=this._map.getContainer()),this._controlContainer=m("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",e.w("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!document.fullscreenEnabled&&!document.webkitFullscreenEnabled)}_setupUI(){let e=this._fullscreenButton=m("button","mapboxgl-ctrl-fullscreen",this._controlContainer);m("span","mapboxgl-ctrl-icon",e).setAttribute("aria-hidden","true"),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){let e=this._getTitle();this._fullscreenButton.setAttribute("aria-label",e),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",e)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(document.fullscreenElement||document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends e.E{constructor(i){super(),this.options=e.l(Object.create(nq),i),e.aJ(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(i&&i.className?i.className.trim().split(/\s+/):[])}addTo(i){return this._map&&this.remove(),this._map=i,this.options.closeOnClick&&i.on("preclick",this._onClose),this.options.closeOnMove&&i.on("move",this._onClose),i.on("remove",this.remove),this._update(),i._addPopup(this),this._focusFirstElement(),this._trackPointer?(i.on("mousemove",this._onMouseEvent),i.on("mouseup",this._onMouseEvent),i._canvasContainer.classList.add("mapboxgl-track-pointer")):i.on("move",this._update),this.fire(new e.x("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);let i=this._map;return i&&(i.off("move",this._update),i.off("move",this._onClose),i.off("preclick",this._onClose),i.off("click",this._onClose),i.off("remove",this.remove),i.off("mousemove",this._onMouseEvent),i.off("mouseup",this._onMouseEvent),i.off("drag",this._onMouseEvent),i._canvasContainer&&i._canvasContainer.classList.remove("mapboxgl-track-pointer"),i._removePopup(this),this._map=void 0),this.fire(new e.x("close")),this}getLngLat(){return this._lngLat}setLngLat(i){this._lngLat=e.bL.convert(i),this._pos=null,this._trackPointer=!1,this._update();let r=this._map;return r&&(r.on("move",this._update),r.off("mousemove",this._onMouseEvent),r._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();let e=this._map;return e&&(e.off("move",this._update),e.on("mousemove",this._onMouseEvent),e.on("drag",this._onMouseEvent),e._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(e){return this.setDOMContent(document.createTextNode(e))}setHTML(e){let i;let r=document.createDocumentFragment(),a=document.createElement("body");for(a.innerHTML=e;i=a.firstChild;)r.appendChild(i);return this.setDOMContent(r)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){let i=this._content;if(i)for(;i.hasChildNodes();)i.firstChild&&i.removeChild(i.firstChild);else i=this._content=m("div","mapboxgl-popup-content",this._container||void 0);if(i.appendChild(e),this.options.closeButton){let e=this._closeButton=m("button","mapboxgl-popup-close-button",i);e.type="button",e.setAttribute("aria-label","Close popup"),e.setAttribute("aria-hidden","true"),e.innerHTML="×",e.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(e){return this._classList.add(e),this._updateClassList(),this}removeClassName(e){return this._classList.delete(e),this._updateClassList(),this}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){let i;return this._classList.delete(e)?i=!1:(this._classList.add(e),i=!0),this._updateClassList(),i}_onMouseEvent(e){this._update(e.point)}_getAnchor(e){if(this.options.anchor)return this.options.anchor;let i=this._map,r=this._container,a=this._pos;if(!i||!r||!a)return"bottom";let n=r.offsetWidth,s=r.offsetHeight,l=a.x<n/2,h=a.x>i.transform.width-n/2;if(a.y+e<s)return l?"top-left":h?"top-right":"top";if(a.y>i.transform.height-s){if(l)return"bottom-left";if(h)return"bottom-right"}return l?"left":h?"right":"bottom"}_updateClassList(){let e=this._container;if(!e)return;let i=[...this._classList];i.push("mapboxgl-popup"),this._anchor&&i.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&i.push("mapboxgl-popup-track-pointer"),e.className=i.join(" ")}_update(i){let r=this._map,a=this._content;if(!r||!this._lngLat&&!this._trackPointer||!a)return;let n=this._container;if(n||(n=this._container=m("div","mapboxgl-popup",r.getContainer()),this._tip=m("div","mapboxgl-popup-tip",n),n.appendChild(a)),this.options.maxWidth&&n.style.maxWidth!==this.options.maxWidth&&(n.style.maxWidth=this.options.maxWidth),r.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=nF(this._lngLat,this._pos,r.transform)),!this._trackPointer||i){let a=this._pos=this._trackPointer&&i instanceof e.P?i:r.project(this._lngLat),n=nW(this.options.offset),s=this._anchor=this._getAnchor(n.y),l=nW(this.options.offset,s),h=a.add(l).round();r._requestDomTask(()=>{this._container&&s&&(this._container.style.transform=`${nN[s]} translate(${h.x}px,${h.y}px)`)})}if(!this._marker&&r._showingGlobe()){let i=+!e.dz(r.transform,this._lngLat);this._setOpacity(i)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;
310let e=this._container.querySelector("a[href], [tabindex]:not([tabindex='-1']), [contenteditable]:not([contenteditable='false']), button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])");e&&e.focus()}_onClose(){this.remove()}_setOpacity(e){this._container&&(this._container.style.opacity=`${e}`),this._content&&(this._content.style.pointerEvents=e?"auto":"none")}},Marker:nV,Style:im,LngLat:e.bL,LngLatBounds:e.as,Point:e.P,MercatorCoordinate:e.a5,FreeCameraOptions:t1,Evented:e.E,config:e.e,prewarm:e.dE,clearPrewarmedResources:e.dF,get accessToken(){return e.e.ACCESS_TOKEN},set accessToken(t){e.e.ACCESS_TOKEN=t},get baseApiUrl(){return e.e.API_URL},set baseApiUrl(t){e.e.API_URL=t},get workerCount(){return e.dG.workerCount},set workerCount(t){e.dG.workerCount=t},get maxParallelImageRequests(){return e.e.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(t){e.e.MAX_PARALLEL_IMAGE_REQUESTS=t},clearStorage(i){e.dH(i)},get workerUrl(){return e.dI.workerUrl},set workerUrl(t){e.dI.workerUrl=t},get workerClass(){return e.dI.workerClass},set workerClass(t){e.dI.workerClass=t},get workerParams(){return e.dI.workerParams},set workerParams(t){e.dI.workerParams=t},get dracoUrl(){return e.dJ()},set dracoUrl(t){e.dK(t)},get meshoptUrl(){return e.dL()},set meshoptUrl(t){e.dM(t)},setNow:e.q.setNow,restoreNow:e.q.restoreNow}}),r},e.exports=i()},596(e){let i,r,a;var n=Object.defineProperty,s=Object.defineProperties,l=Object.getOwnPropertyDescriptor,h=Object.getOwnPropertyDescriptors,u=Object.getOwnPropertyNames,c=Object.getOwnPropertySymbols,d=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable,f=(e,i,r)=>i in e?n(e,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[i]=r,m=(e,i)=>{for(var r in i||(i={}))d.call(i,r)&&f(e,r,i[r]);if(c)for(var r of c(i))p.call(i,r)&&f(e,r,i[r]);return e},_=(e,i)=>s(e,h(i)),g=e=>n(e,"__esModule",{value:!0}),y=(e,i)=>{var r={};for(var a in e)d.call(e,a)&&0>i.indexOf(a)&&(r[a]=e[a]);if(null!=e&&c)for(var a of c(e))0>i.indexOf(a)&&p.call(e,a)&&(r[a]=e[a]);return r},x=(e,i,r,a)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let s of u(i))!d.call(e,s)&&(r||"default"!==s)&&n(e,s,{get:()=>i[s],enumerable:!(a=l(i,s))||a.enumerable});return e},v=(i="undefined"!=typeof WeakMap?new WeakMap:0,(e,r)=>i&&i.get(e)||(r=x(g({}),e,1),i&&i.set(e,r),r)),b=(e,i,r)=>{if(!i.has(e))throw TypeError("Cannot "+r)},w=(e,i,r)=>(b(e,i,"read from private field"),r?r.call(e):i.get(e)),T=(e,i,r)=>{if(i.has(e))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(e):i.set(e,r)},S=(e,i,r,a)=>(b(e,i,"write to private field"),a?a.call(e,r):i.set(e,r),r),M=(e,i,r,a)=>({set _(o){S(e,i,o,r)},get _(){return w(e,i,a)}}),E=(e,i,r)=>(b(e,i,"access private method"),r),A=(e,i,r)=>new Promise((a,n)=>{var s=e=>{try{h(r.next(e))}catch(e){n(e)}},l=e=>{try{h(r.throw(e))}catch(e){n(e)}},h=e=>e.done?a(e.value):Promise.resolve(e.value).then(s,l);h((r=r.apply(e,i)).next())}),I={};((e,i)=>{for(var r in i)n(e,r,{get:i[r],enumerable:!0})})(I,{AddressAutofillCore:()=>$,Evented:()=>ey,GeocodingCore:()=>ef,LngLat:()=>k,LngLatBounds:()=>R,MapboxAutofill:()=>$,MapboxError:()=>D,MapboxGeocode:()=>ef,MapboxValidate:()=>en,MatchCodeConfidence:()=>eg,MatchCodeType:()=>e_,SearchBoxCore:()=>et,SearchSession:()=>eA,SessionToken:()=>z,ValidationCore:()=>en,debounce:()=>ex,featureToSuggestion:()=>eI,polyfillFetch:()=>N});var C="https://api.mapbox.com/autofill/v1",P=`${C}/suggest`,L=`${C}/retrieve`,k=class{constructor(e,i){if(isNaN(e)||isNaN(i))throw Error(`Invalid LngLat object: (${e}, ${i})`);if(this.lng=+e,this.lat=+i,this.lat>90||this.lat<-90)throw Error("Invalid LngLat latitude value: must be between -90 and 90");if(this.lng>180||this.lng<-180)throw Error("Invalid LngLat longitude value: must be between -180 and 180")}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}static convert(e){if(e instanceof k)return new k(e.lng,e.lat);if(Array.isArray(e)&&2===e.length)return new k(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&"object"==typeof e&&null!==e&&("lng"in e||"lon"in e)&&"lat"in e)return new k(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw Error("`LngLatLike` argument must be specified as an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}},R=class{constructor(e,i){this._sw=k.convert(e),this._ne=k.convert(i)}
310getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new k(this.getWest(),this.getNorth())}getSouthEast(){return new k(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()]}toFlatArray(){return[this._sw.lng,this._sw.lat,this._ne.lng,this._ne.lat]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}static convert(e){if(!e)throw Error("Invalid LngLatBounds convert value: falsy");if(e instanceof R)return new R(e.getSouthWest(),e.getNorthEast());if(Array.isArray(e)&&2===e.length)return new R(k.convert(e[0]),k.convert(e[1]));if(Array.isArray(e)&&4===e.length)return new R(k.convert([e[0],e[1]]),k.convert([e[2],e[3]]));throw Error("`LngLatBoundsLike` argument must be specified as an array [<LngLatLike>, <LngLatLike>] or an array [<west>, <south>, <east>, <north>]")}},z=class{constructor(e){let i;this.id=null!=e?e:[(i=(Math.random().toString(16)+Date.now().toString(16)+Math.random().toString(16)).replace(/\./g,"")).slice(0,8),i.slice(8,12),"4"+i.slice(12,15)+"-8"+i.slice(15,18),i.slice(18,30)].join("-")}toString(){return this.id}static convert(e){return new z(e instanceof z?e.id:e.toString())}},D=class extends Error{constructor(e,i){super(String(e.message||e.error||"Unknown error")),this.name="MapboxError",this.statusCode=i}toString(){return`${this.name} (${this.statusCode}): ${this.message}`}};function O(e){return A(this,null,function*(){if(!e.ok)throw new D((yield e.json()),e.status)})}var B=globalThis.fetch,F=globalThis.AbortController;function N({fetch:e,AbortController:i},r=!1){if(!e)throw Error("Fetch implementation must include implementations of `fetch`.");B&&!r||(B=e,F=i)}function V(){if(!B)throw Error("Fetch implementation not found. Please include a fetch polyfill in your application or use `polyfillFetch` from `@mapbox/search-js-core` to fix this issue.");return{fetch:B,AbortController:F}}function U(...e){let i=[];for(let r of e)if(r)for(let[e,a]of Object.entries(r))null!=a&&i.push(`${e}=${encodeURIComponent(String(a))}`);return i.join("&")}var j,G,q,W=class{constructor(e={}){T(this,G),T(this,j,void 0);let{accessToken:i}=e,r=y(e,["accessToken"]);this.accessToken=i,this.defaults=m(m({},W.defaults),r)}get responseHeaders(){return w(this,j)}suggest(e,i){return A(this,null,function*(){if(!e)throw Error("searchText is required");let{sessionToken:r,signal:a}=i,n=_(m(m({},this.defaults),i),{sessionToken:r}),s=new URL(`${P}/${encodeURIComponent(e)}`);s.search=E(this,G,q).call(this,n);let{fetch:l}=V(),h=yield l(s.toString(),{signal:a});S(this,j,h.headers),yield O(h);let u=yield h.json();return _(m({},u),{suggestions:u.suggestions.map(i=>_(m({},i),{original_search_text:e})),url:s.toString()})})}retrieve(e,i){return A(this,null,function*(){if(!e)throw Error("suggestion is required");if(!this.canRetrieve(e))throw Error("suggestion cannot be retrieved");let{sessionToken:r,signal:a}=i,n=z.convert(r),s=new URL(`${L}/${e.action.id}`);s.search=U({access_token:this.accessToken,session_token:n.id});let{fetch:l}=V(),h=yield l(s.toString(),{signal:a});yield O(h);let u=yield h.json();return u.url=s.toString(),u})}canRetrieve(e){let i=e.action;return"string"==typeof(null==i?void 0:i.id)}},$=W;j=new WeakMap,G=new WeakSet,q=function(e){return U({types:"address",access_token:this.accessToken,streets:e.streets,language:e.language,country:e.country,limit:e.limit},e.sessionToken&&{session_token:z.convert(e.sessionToken).id},e.proximity&&{proximity:"string"==typeof e.proximity?e.proximity:k.convert(e.proximity).toArray().join(",")},e.bbox&&{bbox:"string"==typeof e.bbox?e.bbox:R.convert(e.bbox).toFlatArray().join(",")})},$.defaults={language:"en",proximity:"ip",streets:!0};var H,Z,X="https://api.mapbox.com/search/searchbox/v1",Y=`${X}/suggest`,J=`${X}/retrieve`,K=`${X}/category`,Q=`${X}/reverse`,ee=class{constructor(e={}){T(this,H);let{accessToken:i}=e,r=y(e,["accessToken"]);this.accessToken=i,this.defaults=m(m({},ee.defaults),r)}suggest(e,i){return A(this,null,function*(){if(!e)throw Error("searchText is required");let{sessionToken:r,signal:a}=i,n=_(m(m({},this.defaults),i),{q:e,sessionToken:r});if(n.eta_type&&(!n.origin||!n.navigation_profile))throw Error("to provide eta estimate: eta, navigation_profile, and origin are required");if(n.origin&&!n.navigation_profile)throw Error("to provide distance estimate: both navigation_profile and origin are required");let s=new URL(Y);s.search=E(this,H,Z).call(this,n);let{fetch:l}=V(),h=yield l(s.toString(),{signal:a});yield O(h);let u=yield h.json();return u.url=s.toString(),u})}retrieve(e,i){return A(this,null,function*(){if(!e)throw Error("suggestion is required");let{sessionToken:r,signal:a}=i,n=z.convert(r),s=new URL(`${J}/${encodeURIComponent(e.mapbox_id)}`);s.search=U({access_token:this.accessToken,session_token:n.id});let{fetch:l}=V(),h=yield l(s.toString(),{signal:a});yield O(h);let u=yield h.json();return u.url=s.toString(),u})}category(e){return A(this,arguments,function*(e,i={}){if(!e)throw Error("category is required");let r=m(m({},this.defaults),i),a=new URL(`${K}/${encodeURIComponent(e)}`);a.search=E(this,H,Z).call(this,r);let{fetch:n}=V(),s=yield n(a.toString(),{signal:r.signal});yield O(s);let l=yield s.json();return l.url=a.toString(),l})}reverse(e){return A(this,arguments,function*(e,i={}){if(!e)throw Error("lngLat is required");let[r,a]="string"==typeof e?e.split(",").map(e=>parseFloat(e)):k.convert(e).toArray();if(isNaN(r)||isNaN(a))throw Error("lngLat is required");let n=m(m({},this.defaults),i),s=new URL(Q);s.search=U({access_token:this.accessToken,language:n.language,limit:n.limit,longitude:r,latitude:a},n.types&&{types:"string"==typeof n.types?n.types:[...n.types].join(",")});let{fetch:l}=V(),h=yield l(s.toString(),{signal:n.signal});yield O(h);let u=yield h.json();return u.url=s.toString(),u})}},et=ee;H=new WeakSet,Z=function(e){return U({q:e.q,access_token:this.accessToken,language:e.language,limit:e.limit,navigation_profile:e.navigation_profile,route:e.route,route_geometry:e.route_geometry,sar_type:e.sar_type,time_deviation:e.time_deviation,eta_type:e.eta_type,country:e.country,poi_category:e.poi_category,radius:e.radius,rich_metadata_provider:e.rich_metadata_provider,poi_category_exclusions:e.poi_category_exclusions},e.sessionToken&&{session_token:z.convert(e.sessionToken).id},e.proximity&&{proximity:"string"==typeof e.proximity?e.proximity:k.convert(e.proximity).toArray().join(",")},e.origin&&{origin:"string"==typeof e.origin?e.origin:k.convert(e.origin).toArray().join(",")},e.bbox&&{bbox:"string"==typeof e.bbox?e.bbox:R.convert(e.bbox).toFlatArray().join(",")},e.types&&{types:"string"==typeof e.types?e.types:[...e.types].join(",")})},et.defaults={language:"en"};var ei,er,ea=class{constructor(e={}){T(this,ei);let{accessToken:i}=e,r=y(e,["accessToken"]);this.accessToken=i,this.defaults=m(m({},ea.defaults),r)}validate(e,i){return A(this,null,function*(){if(!e)throw Error("searchText is required");let{sessionToken:r,signal:a}=i,n=_(m(m({},this.defaults),i),{sessionToken:r}),s=new URL(`https://api.mapbox.com/autofill/v1/retrieve/${encodeURIComponent(e)}`);s.search=E(this,ei,er).call(this,n);let{fetch:l}=V(),h=yield l(s.toString(),{signal:a});yield O(h);let u=yield h.json();return u.url=s.toString(),u.features.length>0&&(u.features=[u.features[0]]),u})}},en=ea;ei=new WeakSet,er=function(e){return U({access_token:this.accessToken,language:e.language,country:e.country},e.sessionToken&&{session_token:z.convert(e.sessionToken).id},e.proximity&&{proximity:"string"==typeof e.proximity?e.proximity:k.convert(e.proximity).toArray().join(",")},e.bbox&&{bbox:"string"==typeof e.bbox?e.bbox:R.convert(e.bbox).toFlatArray().join(",")})},en.defaults={language:"en",proximity:"ip"};var eo,es,el,eh="https://api.mapbox.com/search/geocode/v6",eu=`${eh}/forward`,ec=`${eh}/reverse`,ed=/^[ ]*(-?\d{1,3}(\.\d{0,256})?)[, ]+(-?\d{1,3}(\.\d{0,256})?)[ ]*$/,ep=/[\s,]+/,ef=class{constructor(e={}){T(this,es),T(this,eo,void 0);let{accessToken:i}=e,r=y(e,["accessToken"]);this.accessToken=i,this.defaults=m({},r)}get responseHeaders(){return w(this,eo)}forward(e,i){return A(this,null,function*(){let r;if(!e)throw Error("searchText is required");i&&({signal:r}=i);let a=_(m(m({},this.defaults),i),{q:e}),n=new URL(`${eu}`);n.search=E(this,es,el).call(this,a);let{fetch:s}=V(),l=r?{signal:r}:{},h=yield s(n.toString(),l);S(this,eo,h.headers),yield O(h);let u=yield h.json();return u.url=n.toString(),u})}reverse(e,i){return A(this,null,function*(){let r,a;
310if(!e)throw Error("lngLat is required");if(i&&({signal:r}=i),"string"==typeof e){let[i,r]=e.split(",");a=new k(Number(i),Number(r))}else a=k.convert(e);let n=_(m(m({},this.defaults),i),{longitude:a.lng,latitude:a.lat}),s=new URL(`${ec}`);s.search=E(this,es,el).call(this,n,!0);let{fetch:l}=V(),h=r?{signal:r}:{},u=yield l(s.toString(),h);S(this,eo,u.headers),yield O(u);let c=yield u.json();return c.url=s.toString(),c})}suggest(e,i){return A(this,null,function*(){if(!ed.test(e))return this.forward(e,i);{let r=e.trim().split(ep).map(e=>e.trim()).join(",");return this.reverse(r,i)}})}retrieve(e){return A(this,null,function*(){return e})}};eo=new WeakMap,es=new WeakSet,el=function(e,i=!1){return i&&["proximity","autocomplete","bbox"].forEach(i=>{i in e&&delete e[i]}),U({q:e.q,longitude:e.longitude,latitude:e.latitude,access_token:this.accessToken,permanent:e.permanent,language:e.language,country:e.country,limit:e.limit,autocomplete:e.autocomplete,worldview:e.worldview},e.sessionToken&&{session_token:z.convert(e.sessionToken).id},e.proximity&&{proximity:"string"==typeof e.proximity?e.proximity:k.convert(e.proximity).toArray().join(",")},e.bbox&&{bbox:"string"==typeof e.bbox?e.bbox:R.convert(e.bbox).toFlatArray().join(",")},e.types&&{types:"string"==typeof e.types?e.types:[...e.types].join(",")})};var em,e_=((r=e_||{}).matched="matched",r.unmatched="unmatched",r.plausible="plausible",r.not_applicable="not_applicable",r.inferred="inferred",r),eg=((a=eg||{}).exact="exact",a.high="high",a.medium="medium",a.low="low",a),ey=class{constructor(){T(this,em,{})}addEventListener(e,i){let r=w(this,em);r[e]||(r[e]=[]),r[e].push(i)}removeEventListener(e,i){let r=w(this,em);if(!r[e])return;let a=r[e],n=a.indexOf(i);-1!==n&&a.splice(n,1)}fire(e,i){let r=w(this,em);if(r[e])for(let a of r[e])a(i)}};function ex(e,i,r){let a=null;return(...n)=>{null!==a&&clearTimeout(a);let s=r&&r();a=setTimeout(()=>{a=null,(null==s?void 0:s.aborted)||e(...n)},i)}}function ev(){let{AbortController:e}=V();return new e}em=new WeakMap;var eb,ew,eT,eS,eM,eE,eA=class extends ey{constructor(e,i=0){super(),T(this,eb,new z),T(this,ew,0),T(this,eT,!1),T(this,eS,void 0),T(this,eM,ev()),T(this,eE,void 0),S(this,eE,ex((e,...i)=>A(this,[e,...i],function*(e,i={}){if(w(this,eM).abort(),S(this,eM,ev()),!e){S(this,eS,null),this.fire("suggest",w(this,eS));return}try{let r=yield this.search.suggest(e,_(m({sessionToken:this.sessionToken},i),{signal:w(this,eM).signal}));S(this,eS,r),this.fire("suggest",r)}catch(e){if("AbortError"===e.name)return;this.fire("suggesterror",e)}}),i,()=>w(this,eM).signal)),Object.defineProperties(this,{search:{value:e,writable:!1},debounce:{value:i,writable:!1}})}get sessionToken(){return w(this,eT)?w(this,eb).id:`${w(this,eb).id}.${w(this,ew)}`}set sessionToken(e){S(this,eT,!0),S(this,eb,new z(e))}get suggestions(){return w(this,eS)}suggest(e,i){return w(this,eE).call(this,e,i),new Promise((e,i)=>{let r,a;r=i=>{this.removeEventListener("suggest",r),this.removeEventListener("suggesterror",a),e(i)},a=e=>{this.removeEventListener("suggest",r),this.removeEventListener("suggesterror",a),i(e)},this.addEventListener("suggest",r),this.addEventListener("suggesterror",a)})}clear(){this.suggest("")}retrieve(e,i){return A(this,null,function*(){let r=yield this.search.retrieve(e,m({sessionToken:this.sessionToken},i));return this.fire("retrieve",r),r})}canRetrieve(e){return!this.search.canRetrieve||this.search.canRetrieve(e)}canSuggest(e){return!this.search.canSuggest||this.search.canSuggest(e)}
310abort(){w(this,eM).abort(),S(this,eM,ev())}incrementSession(){M(this,ew)._++}};function eI(e){let{properties:i}=e;return m({},i)}eb=new WeakMap,ew=new WeakMap,eT=new WeakMap,eS=new WeakMap,eM=new WeakMap,eE=new WeakMap,e.exports=v(I)},654(e){!function(i){var r,a,n=!1;function s(e){if("undefined"!=typeof document&&!n){var i=document.documentElement;a=window.pageYOffset,document.documentElement.scrollHeight>window.innerHeight?i.style.width="calc(100% - "+function(){if(void 0!==r)return r;var e=document.documentElement,i=document.createElement("div");return i.setAttribute("style","width:99px;height:99px;position:absolute;top:-9999px;overflow:scroll;"),e.appendChild(i),r=i.offsetWidth-i.clientWidth,e.removeChild(i),r}()+"px)":i.style.width="100%",i.style.position="fixed",i.style.top=-a+"px",i.style.overflow="hidden",n=!0}}function l(){if("undefined"!=typeof document&&n){var e=document.documentElement;e.style.width="",e.style.position="",e.style.top="",e.style.overflow="",window.scroll(0,a),n=!1}}var h={on:s,off:l,toggle:function(){if(n){l();return}s()}};void 0!==e.exports?e.exports=h:i.noScroll=h}(this)},669(e,i){var r=function(){var e={},i=Math.PI/180,r=180/Math.PI;function a(e){return Number(e)===e&&e%1!=0}function n(i){if(i=i||{},this.size=i.size||256,this.expansion=!0===i.antimeridian?2:1,!e[this.size]){var r=this.size,a=e[this.size]={};a.Bc=[],a.Cc=[],a.zc=[],a.Ac=[];for(var n=0;n<30;n++)a.Bc.push(r/360),a.Cc.push(r/(2*Math.PI)),a.zc.push(r/2),a.Ac.push(r),r*=2}this.Bc=e[this.size].Bc,this.Cc=e[this.size].Cc,this.zc=e[this.size].zc,this.Ac=e[this.size].Ac}return n.prototype.px=function(e,r){if(a(r)){var n=this.size*Math.pow(2,r),s=n/2,l=n/(2*Math.PI),h=Math.min(Math.max(Math.sin(i*e[1]),-.9999),.9999),u=s+e[0]*(n/360),c=s+-(.5*Math.log((1+h)/(1-h))*l);return u>n*this.expansion&&(u=n*this.expansion),c>n&&(c=n),[u,c]}var s=this.zc[r],h=Math.min(Math.max(Math.sin(i*e[1]),-.9999),.9999),u=Math.round(s+e[0]*this.Bc[r]),c=Math.round(s+-(.5*Math.log((1+h)/(1-h))*this.Cc[r]));return u>this.Ac[r]*this.expansion&&(u=this.Ac[r]*this.expansion),c>this.Ac[r]&&(c=this.Ac[r]),[u,c]},n.prototype.ll=function(e,i){if(a(i)){var n=this.size*Math.pow(2,i),s=n/(2*Math.PI),l=n/2,h=-((e[1]-l)/s),u=(e[0]-l)/(n/360),c=r*(2*Math.atan(Math.exp(h))-.5*Math.PI);return[u,c]}var h=-((e[1]-this.zc[i])/this.Cc[i]),u=(e[0]-this.zc[i])/this.Bc[i],c=r*(2*Math.atan(Math.exp(h))-.5*Math.PI);return[u,c]},n.prototype.bbox=function(e,i,r,a,n){a&&(i=Math.pow(2,r)-1-i);var s=[e*this.size,(+i+1)*this.size],l=[(+e+1)*this.size,i*this.size],h=this.ll(s,r).concat(this.ll(l,r));return"900913"===n?this.convert(h,"900913"):h},n.prototype.xyz=function(e,i,r,a){"900913"===a&&(e=this.convert(e,"WGS84"));var n=[e[0],e[1]],s=[e[2],e[3]],l=this.px(n,i),h=this.px(s,i),u=[Math.floor(l[0]/this.size),Math.floor((h[0]-1)/this.size)],c=[Math.floor(h[1]/this.size),Math.floor((l[1]-1)/this.size)],d={minX:0>Math.min.apply(Math,u)?0:Math.min.apply(Math,u),minY:0>Math.min.apply(Math,c)?0:Math.min.apply(Math,c),maxX:Math.max.apply(Math,u),maxY:Math.max.apply(Math,c)};if(r){var p={minY:Math.pow(2,i)-1-d.maxY,maxY:Math.pow(2,i)-1-d.minY};d.minY=p.minY,d.maxY=p.maxY}return d},n.prototype.convert=function(e,i){return"900913"===i?this.forward(e.slice(0,2)).concat(this.forward(e.slice(2,4))):this.inverse(e.slice(0,2)).concat(this.inverse(e.slice(2,4)))},n.prototype.forward=function(e){var r=[6378137*e[0]*i,6378137*Math.log(Math.tan(.25*Math.PI+.5*e[1]*i))];return r[0]>20037508.342789244&&(r[0]=20037508.342789244),r[0]<-20037508.342789244&&(r[0]=-20037508.342789244),r[1]>20037508.342789244&&(r[1]=20037508.342789244),r[1]<-20037508.342789244&&(r[1]=-20037508.342789244),r},n.prototype.inverse=function(e){return[e[0]*r/6378137,(.5*Math.PI-2*Math.atan(Math.exp(-e[1]/6378137)))*r]},n}();e.exports=r},875(e,i){!function(e){"use strict";function i(e){return e.split("-")[0]}function r(e){return e.split("-")[1]}function a(e){return["top","bottom"].includes(i(e))?"x":"y"}function n(e){return"y"===e?"height":"width"}function s(e,s,l){let h,{reference:u,floating:c}=e,d=u.x+u.width/2-c.width/2,p=u.y+u.height/2-c.height/2,f=a(s),m=n(f),_=u[m]/2-c[m]/2,g=i(s),y="x"===f;switch(g){case"top":h={x:d,y:u.y-c.height};break;case"bottom":h={x:d,y:u.y+u.height};break;case"right":h={x:u.x+u.width,y:p};break;case"left":h={x:u.x-c.width,y:p};break;default:h={x:u.x,y:u.y}}switch(r(s)){case"start":h[f]-=_*(l&&y?-1:1);break;case"end":h[f]+=_*(l&&y?-1:1)}return h}let l=async(e,i,r)=>{let{placement:a="bottom",strategy:n="absolute",middleware:l=[],platform:h}=r,u=await (null==h.isRTL?void 0:h.isRTL(i));if(null==h&&console.error("Floating UI: `platform` property was not passed to config. If you want to use Floating UI on the web, install @floating-ui/dom instead of the /core package. Otherwise, you can create your own `platform`: https://floating-ui.com/docs/platform"),l.filter(e=>{let{name:i}=e;return"autoPlacement"===i||"flip"===i}).length>1)throw Error("Floating UI: duplicate `flip` and/or `autoPlacement` middleware detected. This will lead to an infinite loop. Ensure only one of either has been passed to the `middleware` array.");let c=await h.getElementRects({reference:e,floating:i,strategy:n}),{x:d,y:p}=s(c,a,u),f=a,m={},_=0;for(let r=0;r<l.length;r++){let{name:g,fn:y}=l[r],{x:x,y:v,data:b,reset:w}=await y({x:d,y:p,initialPlacement:a,placement:f,strategy:n,middlewareData:m,rects:c,platform:h,elements:{reference:e,floating:i}});if(d=null!=x?x:d,p=null!=v?v:p,m={...m,[g]:{...m[g],...b}},_>50&&console.warn("Floating UI: The middleware lifecycle appears to be running in an infinite loop. This is usually caused by a `reset` continually being returned without a break condition."),w&&_<=50){_++,"object"==typeof w&&(w.placement&&(f=w.placement),w.rects&&(c=!0===w.rects?await h.getElementRects({reference:e,floating:i,strategy:n}):w.rects),{x:d,y:p}=s(c,f,u)),r=-1;continue}}return{x:d,y:p,placement:f,strategy:n,middlewareData:m}};function h(e){return"number"!=typeof e?{top:0,right:0,bottom:0,left:0,...e}:{top:e,right:e,bottom:e,left:e}}
310function u(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}async function c(e,i){var r;void 0===i&&(i={});let{x:a,y:n,platform:s,rects:l,elements:c,strategy:d}=e,{boundary:p="clippingAncestors",rootBoundary:f="viewport",elementContext:m="floating",altBoundary:_=!1,padding:g=0}=i,y=h(g),x=c[_?"floating"===m?"reference":"floating":m],v=u(await s.getClippingRect({element:null==(r=await (null==s.isElement?void 0:s.isElement(x)))||r?x:x.contextElement||await (null==s.getDocumentElement?void 0:s.getDocumentElement(c.floating)),boundary:p,rootBoundary:f,strategy:d})),b=u(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({rect:"floating"===m?{...l.floating,x:a,y:n}:l.reference,offsetParent:await (null==s.getOffsetParent?void 0:s.getOffsetParent(c.floating)),strategy:d}):l[m]);return{top:v.top-b.top+y.top,bottom:b.bottom-v.bottom+y.bottom,left:v.left-b.left+y.left,right:b.right-v.right+y.right}}let d=Math.min,p=Math.max,f={left:"right",right:"left",bottom:"top",top:"bottom"};function m(e){return e.replace(/left|right|bottom|top/g,e=>f[e])}function _(e,i,s){void 0===s&&(s=!1);let l=r(e),h=a(e),u=n(h),c="x"===h?l===(s?"end":"start")?"right":"left":"start"===l?"bottom":"top";return i.reference[u]>i.floating[u]&&(c=m(c)),{main:c,cross:m(c)}}let g={start:"end",end:"start"};function y(e){return e.replace(/start|end/g,e=>g[e])}let x=["top","right","bottom","left"],v=x.reduce((e,i)=>e.concat(i,i+"-start",i+"-end"),[]);function b(e,i){return{top:e.top-i.height,right:e.right-i.width,bottom:e.bottom-i.height,left:e.left-i.width}}function w(e){return x.some(i=>e[i]>=0)}async function T(e,n){let{placement:s,platform:l,elements:h}=e,u=await (null==l.isRTL?void 0:l.isRTL(h.floating)),c=i(s),d=r(s),p="x"===a(s),f=["left","top"].includes(c)?-1:1,m=u&&p?-1:1,_="function"==typeof n?n(e):n,{mainAxis:g,crossAxis:y,alignmentAxis:x}="number"==typeof _?{mainAxis:_,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,..._};return d&&"number"==typeof x&&(y="end"===d?-1*x:x),p?{x:y*m,y:g*f}:{x:g*f,y:y*m}}function S(e){return"x"===e?"y":"x"}e.arrow=e=>({name:"arrow",options:e,async fn(i){let{element:s,padding:l=0}=null!=e?e:{},{x:u,y:c,placement:f,rects:m,platform:_}=i;if(null==s)return console.warn("Floating UI: No `element` was passed to the `arrow` middleware."),{};let g=h(l),y={x:u,y:c},x=a(f),v=r(f),b=n(x),w=await _.getDimensions(s),T="y"===x?"top":"left",S="y"===x?"bottom":"right",M=m.reference[b]+m.reference[x]-y[x]-m.floating[b],E=y[x]-m.reference[x],A=await (null==_.getOffsetParent?void 0:_.getOffsetParent(s)),I=A?"y"===x?A.clientHeight||0:A.clientWidth||0:0;0===I&&(I=m.floating[b]);let C=g[T],P=I-w[b]-g[S],L=I/2-w[b]/2+(M/2-E/2),k=p(C,d(L,P)),R=("start"===v?g[T]:g[S])>0&&L!==k&&m.reference[b]<=m.floating[b]?L<C?C-L:P-L:0;return{[x]:y[x]-R,data:{[x]:k,centerOffset:L-k}}}}),e.autoPlacement=function(e){return void 0===e&&(e={}),{name:"autoPlacement",options:e,async fn(a){var n,s,l,h,u;let{x:d,y:p,rects:f,middlewareData:m,placement:g,platform:x,elements:b}=a,{alignment:w=null,allowedPlacements:T=v,autoAlignment:S=!0,...M}=e,E=(w?[...T.filter(e=>r(e)===w),...T.filter(e=>r(e)!==w)]:T.filter(e=>i(e)===e)).filter(e=>!w||r(e)===w||!!S&&y(e)!==e),A=await c(a,M),I=null!=(n=null==(s=m.autoPlacement)?void 0:s.index)?n:0,C=E[I];if(null==C)return{};let{main:P,cross:L}=_(C,f,await (null==x.isRTL?void 0:x.isRTL(b.floating)));if(g!==C)return{x:d,y:p,reset:{placement:E[0]}};let k=[A[i(C)],A[P],A[L]],R=[...null!=(l=null==(h=m.autoPlacement)?void 0:h.overflows)?l:[],{placement:C,overflows:k}],z=E[I+1];if(z)return{data:{index:I+1,overflows:R},reset:{placement:z}};let D=R.slice().sort((e,i)=>e.overflows[0]-i.overflows[0]),O=null==(u=D.find(e=>{let{overflows:i}=e;return i.every(e=>e<=0)}))?void 0:u.placement,B=null!=O?O:D[0].placement;return B!==g?{data:{index:I+1,overflows:R},reset:{placement:B}}:{}}}},e.computePosition=l,e.detectOverflow=c,e.flip=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(r){var a,n,s,l;let{placement:h,middlewareData:u,rects:d,initialPlacement:p,platform:f,elements:g}=r,{mainAxis:x=!0,crossAxis:v=!0,fallbackPlacements:b,fallbackStrategy:w="bestFit",flipAlignment:T=!0,...S}=e,M=i(h),E=M===p,A=b||(E||!T?[m(p)]:function(e){let i=m(e);return[y(e),i,y(i)]}(p)),I=[p,...A],C=await c(r,S),P=[],L=(null==(a=u.flip)?void 0:a.overflows)||[];if(x&&P.push(C[M]),v){let{main:e,cross:i}=_(h,d,await (null==f.isRTL?void 0:f.isRTL(g.floating)));P.push(C[e],C[i])}if(L=[...L,{placement:h,overflows:P}],!P.every(e=>e<=0)){let e=(null!=(n=null==(s=u.flip)?void 0:s.index)?n:0)+1,i=I[e];if(i)return{data:{index:e,overflows:L},reset:{placement:i}};let r="bottom";switch(w){case"bestFit":{let e=null==(l=L.map(e=>[e,e.overflows.filter(e=>e>0).reduce((e,i)=>e+i,0)]).sort((e,i)=>e[1]-i[1])[0])?void 0:l[0].placement;e&&(r=e);break}case"initialPlacement":r=p}if(h!==r)return{reset:{placement:r}}}return{}}}},e.hide=function(e){let{strategy:i="referenceHidden",...r}=void 0===e?{}:e;return{name:"hide",async fn(e){let{rects:a}=e;switch(i){case"referenceHidden":{let i=b(await c(e,{...r,elementContext:"reference"}),a.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:w(i)}}}case"escaped":{let i=b(await c(e,{...r,altBoundary:!0}),a.floating);return{data:{escapedOffsets:i,escaped:w(i)}}}default:return{}}}}},e.inline=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(r){var n;let{placement:s,elements:l,rects:c,platform:f,strategy:m}=r,{padding:_=2,x:g,y}=e,x=u(f.convertOffsetParentRelativeRectToViewportRelativeRect?await f.convertOffsetParentRelativeRectToViewportRelativeRect({rect:c.reference,offsetParent:await (null==f.getOffsetParent?void 0:f.getOffsetParent(l.floating)),strategy:m}):c.reference),v=null!=(n=await (null==f.getClientRects?void 0:f.getClientRects(l.reference)))?n:[],b=h(_),w=await f.getElementRects({reference:{getBoundingClientRect:function(){if(2===v.length&&v[0].left>v[1].right&&null!=g&&null!=y){var e;return null!=(e=v.find(e=>g>e.left-b.left&&g<e.right+b.right&&y>
310e.top-b.top&&y<e.bottom+b.bottom))?e:x}if(v.length>=2){if("x"===a(s)){let e=v[0],r=v[v.length-1],a="top"===i(s),n=e.top,l=r.bottom,h=a?e.left:r.left,u=a?e.right:r.right;return{top:n,bottom:l,left:h,right:u,width:u-h,height:l-n,x:h,y:n}}let e="left"===i(s),r=p(...v.map(e=>e.right)),n=d(...v.map(e=>e.left)),l=v.filter(i=>e?i.left===n:i.right===r),h=l[0].top,u=l[l.length-1].bottom;return{top:h,bottom:u,left:n,right:r,width:r-n,height:u-h,x:n,y:h}}return x}},floating:l.floating,strategy:m});return c.reference.x!==w.reference.x||c.reference.y!==w.reference.y||c.reference.width!==w.reference.width||c.reference.height!==w.reference.height?{reset:{rects:w}}:{}}}},e.limitShift=function(e){return void 0===e&&(e={}),{options:e,fn(r){let{x:n,y:s,placement:l,rects:h,middlewareData:u}=r,{offset:c=0,mainAxis:d=!0,crossAxis:p=!0}=e,f={x:n,y:s},m=a(l),_=S(m),g=f[m],y=f[_],x="function"==typeof c?c({...h,placement:l}):c,v="number"==typeof x?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(d){let e="y"===m?"height":"width",i=h.reference[m]-h.floating[e]+v.mainAxis,r=h.reference[m]+h.reference[e]-v.mainAxis;g<i?g=i:g>r&&(g=r)}if(p){var b,w,T,M;let e="y"===m?"width":"height",r=["top","left"].includes(i(l)),a=h.reference[_]-h.floating[e]+(r&&null!=(b=null==(w=u.offset)?void 0:w[_])?b:0)+(r?0:v.crossAxis),n=h.reference[_]+h.reference[e]+(r?0:null!=(T=null==(M=u.offset)?void 0:M[_])?T:0)-(r?v.crossAxis:0);y<a?y=a:y>n&&(y=n)}return{[m]:g,[_]:y}}}},e.offset=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(i){let{x:r,y:a}=i,n=await T(i,e);return{x:r+n.x,y:a+n.y,data:n}}}},e.rectToClientRect=u,e.shift=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(r){let{x:n,y:s,placement:l}=r,{mainAxis:h=!0,crossAxis:u=!1,limiter:f={fn:e=>{let{x:i,y:r}=e;return{x:i,y:r}}},...m}=e,_={x:n,y:s},g=await c(r,m),y=a(i(l)),x=S(y),v=_[y],b=_[x];if(h){let e="y"===y?"top":"left",i="y"===y?"bottom":"right",r=v+g[e],a=v-g[i];v=p(r,d(v,a))}if(u){let e="y"===x?"top":"left",i="y"===x?"bottom":"right",r=b+g[e],a=b-g[i];b=p(r,d(b,a))}let w=f.fn({...r,[y]:v,[x]:b});return{...w,data:{x:w.x-n,y:w.y-s}}}}},e.size=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(a){let n,s;let{placement:l,rects:h,platform:u,elements:d}=a,{apply:f,...m}=e,_=await c(a,m),g=i(l),y=r(l);"top"===g||"bottom"===g?(n=g,s=y===(await (null==u.isRTL?void 0:u.isRTL(d.floating))?"start":"end")?"left":"right"):(s=g,n="end"===y?"top":"bottom");let x=p(_.left,0),v=p(_.right,0),b=p(_.top,0),w=p(_.bottom,0),T={availableHeight:h.floating.height-(["left","right"].includes(l)?2*(0!==b||0!==w?b+w:p(_.top,_.bottom)):_[n]),availableWidth:h.floating.width-(["top","bottom"].includes(l)?2*(0!==x||0!==v?x+v:p(_.left,_.right)):_[s])},S=await u.getDimensions(d.floating);null==f||f({...a,...T});let M=await u.getDimensions(d.floating);return S.width!==M.width||S.height!==M.height?{reset:{rects:!0}}:{}}}},Object.defineProperty(e,"__esModule",{value:!0})}(i)},886(e,i,r){"use strict";r.r(i),r.d(i,{default:()=>c});var a=r(373),n=r(68),s=r(379),l=r(588),h=r.n(l);class u{static isSupported(){return"undefined"!==document.cookie}static setItem(e,i,r){if(null==e)throw Error("You must specify a key to set a cookie");let a=new Date;a.setTime(a.getTime()+864e5*r);let n="";"https:"===location.protocol&&(n="secure"),document.cookie=`${e}=${i};expires=${a.toUTCString()};path=/;sameSite=lax;${n}`}static getItem(e){if(!e)return!1;let i=e+"=",r=document.cookie.split(";");for(let e=0;e<r.length;e++){let a=r[e];for(;" "===a.charAt(0);)a=a.substring(1);if(0===a.indexOf(i))return a.substring(i.length,a.length)}return!1}static removeItem(e){document.cookie=`${e}= ; expires = Thu, 01 Jan 1970 00:00:00 GMT;path=/`}static key(){return""}static clear(){}}class c extends a.A{static #e=this.options={cookieName:"adpd-mapbox",cookieExpiration:30};init(){if(this.options.sidebarTemplate=this.el.querySelector(".dpd-parcel-shop-finder__sidebar-template"),this.options.errorTemplate=this.el.querySelector(".dpd-parcel-shop-finder__error-template"),this.options.cookieOverlayTemplate=this.el.querySelector(".dpd-parcel-shop-finder__cookie-overlay-template"),this.options.popupButtonTemplate=this.el.querySelector(".dpd-parcel-shop-finder__popup-button-template"),this._mapInitialized=!1,!u.getItem(this.options.cookieName)){this._showCookieOverlay();return}this._initializeMap()}_initializeMap(){var e=this;if(this._mapInitialized)return;this._mapInitialized=!0;let i=this.el.dataset.mapboxAccessToken,r=this.el.dataset.mapboxAccessTokenMissingError??"Please add your Mapbox API key to the DPD plugin configuration.",a=this.el.dataset.mapCenterLatitude??10.451526,l=this.el.dataset.mapCenterLongitude??51.165691,u=this.el.dataset.mapZoom??5.5,c=this.el.dataset.mapStyle??"mapbox://styles/mapbox/standard",d=this.el.dataset.mapLanguage??"de",p=this.el.dataset.mapQuery??"",f=this.el.dataset.mapMarkerImageSrc??null,m=this.el.dataset.labelClosed??"Closed",_=this.el.dataset.dpdLocaleCode??null,g=this.el.dataset.setParcelShopUrl??null,y=this.el.dataset.f
310indDpdParcelShopsGeodataUrl??null,x=(1==this.el.dataset.skipCartUpdate)??!1,v=this.el.querySelector(".dpd-parcel-shop-finder__map"),b=this.el.querySelector(".dpd-parcel-shop-finder__sidebar-content"),w=this.el.querySelector(".dpd-parcel-shop-finder__geocoder"),T=this.el.querySelector(".dpd-parcel-shop-finder__loader"),S=new Set,M=null,E=0,A=e=>{if(!this.options.errorTemplate||!this.options.errorTemplate.content)return;let i=this.options.errorTemplate.content.cloneNode(!0),r=i.querySelector(".dpd-parcel-shop-finder__error");r&&(r.textContent=e),this.el.innerHTML="",this.el.appendChild(i)},I=()=>{!(0===E||T.classList.contains("dpd-parcel-shop-finder__loader--is-visible"))&&T&&T.classList.add("dpd-parcel-shop-finder__loader--is-visible")},C=()=>{!(E>0)&&T.classList.contains("dpd-parcel-shop-finder__loader--is-visible")&&T&&T.classList.remove("dpd-parcel-shop-finder__loader--is-visible")},P=function(e,i){let r=i.currentTarget;r.classList.contains("dpd-parcel-shop-finder__button--is-loading")||r.classList.contains("dpd-parcel-shop-finder__button--is-success")||(r.classList.add("dpd-parcel-shop-finder__button--is-loading"),window.parent.postMessage({event:"parcel-shop-selected",...e},"*"),x?(r.classList.add("dpd-parcel-shop-finder__button--is-success"),r.classList.remove("dpd-parcel-shop-finder__button--is-loading"),setTimeout(()=>{r.classList.remove("dpd-parcel-shop-finder__button--is-success")},5e3)):k(e).then(i=>{r.classList.add("dpd-parcel-shop-finder__button--is-success"),setTimeout(()=>{r.classList.remove("dpd-parcel-shop-finder__button--is-success")},5e3),setTimeout(()=>{window.parent.postMessage({event:"parcel-shop-added-to-cart",...e},"*")},1e3)}).finally(()=>{r.classList.remove("dpd-parcel-shop-finder__button--is-loading")}))},L=e=>{var i;if(!b||!this.el||!this.options.sidebarTemplate)return;let r=this.options.sidebarTemplate.content.cloneNode(!0);r.querySelector('[data-field="company"]').textContent=e.company,r.querySelector('[data-field="street"]').textContent=e.street,r.querySelector('[data-field="houseNo"]').textContent=e.houseNo,r.querySelector('[data-field="zipCode"]').textContent=e.zipCode,r.querySelector('[data-field="city"]').textContent=e.city,r.querySelector(".dpd-parcel-shop-finder__button").addEventListener("click",function(i){P(e,i)});let a=r.querySelector('[data-field="opening-hours"]');Array.isArray(i=e.openingHours)&&a&&(a.innerHTML="",i.forEach(e=>{let i=document.createElement("tr"),r=document.createElement("td");r.textContent=e.weekday;let n=document.createElement("td"),s="00:00"===e.openMorning&&"00:00"===e.closeMorning;n.textContent=s?m:`${e.openMorning} â ${e.closeMorning}`,i.appendChild(r),i.appendChild(n),a.appendChild(i)})),b.classList.add("dpd-parcel-shop-finder__sidebar-content--is-updating"),setTimeout(()=>{b.innerHTML="",b.appendChild(r)},150),setTimeout(()=>{b.classList.remove("dpd-parcel-shop-finder__sidebar-content--is-updating")},300)},k=async e=>g?new Promise((i,r)=>{new n.A().post(g,JSON.stringify({parcelShop:e}),e=>{i(JSON.parse(e))})}):Promise.reject(),R=(e,i)=>{setTimeout(()=>{L(e)},10),M&&M.classList.remove("dpd-parcel-shop-finder__marker--is-selected"),i&&(i.classList.add("dpd-parcel-shop-finder__marker--is-selected"),M=i)},z=function(i,r){let a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];E++,I(),new n.A().post(y,JSON.stringify({latitude:i,longitude:r,localeCode:_}),i=>{let r=JSON.parse(i),n=r.response||[],s=r.error||!1;if(s){A(s);return}n.forEach(i=>{if(S.has(i.parcelShopId))return;S.add(i.parcelShopId);let r=!1;if(i&&i.services&&Array.isArray(i.services.service)&&(r=!!i.services.service.find(e=>100===e.code||"100"===e.code)),!r)return;let n={},s=null;if(f){s=document.createElement("div");let e=document.createElement("img");e.src=f,e.alt=i.company,e.title=i.company,e.style.width="60px",e.style.height="auto",s.classList.add("dpd-parcel-shop-finder__marker"),s.appendChild(e),n={element:s}}let l=e.options.popupButtonTemplate?.content?.firstElementChild?.cloneNode(!0),u=new(h()).Popup({offset:42}),c=document.createElement("div");l.addEventListener("click",function(e){P(i,e)}),c.appendChild(l),u.setDOMContent(c),new(h()).Marker(n).setLngLat([i.longitude,i.latitude]).setPo
310pup(u).addTo(D).getElement().addEventListener("click",()=>{R(i,s)}),a&&!M&&(s.click(),setTimeout(()=>{D.flyTo({center:[i.longitude,i.latitude],zoom:14})},320))}),E--,C()})};if(!i){A(r);return}let D=new(h()).Map({accessToken:i,container:v,center:[a,l],zoom:u,style:c});D.on("error",e=>{e&&e.error&&e.error.message&&A("Error"+e.error.message)});let O=new s.MapboxGeocoder;O.accessToken=i,O.options={language:d},O.mapboxgl=h(),O.marker=!0,O.bindMap(D),w.appendChild(O),p&&p.length>0&&D.on("load",()=>{fetch(`https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURIComponent(p)}.json?access_token=${i}&language=${d}`).then(e=>e.json()).then(e=>{let i=e.features[0]?.center;i&&(D.flyTo({center:i,zoom:14}),z(i[1],i[0],!0))})}),O.addEventListener("retrieve",e=>{let i=e.detail;z(i.geometry.coordinates[1],i.geometry.coordinates[0],!0)}),D.on("moveend",()=>{let e=D.getCenter();z(e.lat,e.lng)})}_showCookieOverlay(){this.el.dataset.cookieRequiredText,this.el.dataset.cookieAcceptButtonText;let e=this.options.cookieOverlayTemplate.content.cloneNode(!0);e.querySelector(".btn").addEventListener("click",()=>{u.setItem(this.options.cookieName,"1",this.options.cookieExpiration),this._hideCookieOverlay(),this._initializeMap()}),this.el.appendChild(e)}_hideCookieOverlay(){let e=this.el.querySelector(".dpd-parcel-shop-finder__cookie-overlay");e&&e.remove()}}},907(e,i,r){"use strict";r.r(i),r.d(i,{createFocusTrap:()=>f});var a,n=r(557);/*! 311* focus-trap 6.9.4 312* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE 313*/function s(e,i){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);i&&(a=a.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,a)}return r}function l(e){for(var i=1;i<arguments.length;i++){var r=null!=arguments[i]?arguments[i]:{};i%2?s(Object(r),!0).forEach(function(i){var a;a=r[i],i in e?Object.defineProperty(e,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}var h=(a=[],{activateTrap:function(e){if(a.length>0){var i=a[a.length-1];i!==e&&i.pause()}var r=a.indexOf(e);-1===r||a.splice(r,1),a.push(e)},deactivateTrap:function(e){var i=a.indexOf(e);-1!==i&&a.splice(i,1),a.length>0&&a[a.length-1].unpause()}}),u=function(e){return setTimeout(e,0)},c=function(e,i){var r=-1;return e.every(function(e,a){return!i(e)||(r=a,!1)}),r},d=function(e){for(var i=arguments.length,r=Array(i>1?i-1:0),a=1;a<i;a++)r[a-1]=arguments[a];return"function"==typeof e?e.apply(void 0,r):e},p=function(e){return e.target.shadowRoot&&"function"==typeof e.composedPath?e.composedPath()[0]:e.target},f=function(e,i){var r,a=(null==i?void 0:i.document)||document,s=l({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0},i),f={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0},m=function(e,i,r){return e&&void 0!==e[i]?e[i]:s[r||i]},_=function(e){return f.containerGroups.findIndex(function(i){var r=i.container,a=i.tabbableNodes;return r.contains(e)||a.find(function(i){return i===e})})},g=function(e){var i=s[e];if("function"==typeof i){for(var r=arguments.length,n=Array(r>1?r-1:0),l=1;l<r;l++)n[l-1]=arguments[l];i=i.apply(void 0,n)}if(!0===i&&(i=void 0),!i){if(void 0===i||!1===i)return i;throw Error("`".concat(e,"` was specified but was not a node, or did not return a node"))}var h=i;if("string"==typeof i&&!(h=a.querySelector(i)))throw Error("`".concat(e,"` as selector refers to no known node"));return h},y=function(){var e=g("initialFocus");if(!1===e)return!1;if(void 0===e){if(_(a.activeElement)>=0)e=a.activeElement;else{var i=f.tabbableGroups[0];e=i&&i.firstTabbableNode||g("fallbackFocus")}}if(!e)throw Error("Your focus-trap needs to have at least one focusable element");return e},x=function(){if(f.containerGroups=f.containers.map(function(e){var i=(0,n.Kr)(e,s.tabbableOptions),r=(0,n.nq)(e,s.tabbableOptions);return{container:e,tabbableNodes:i,focusableNodes:r,firstTabbableNode:i.length>0?i[0]:null,lastTabbableNode:i.length>0?i[i.length-1]:null,nextTabbableNode:function(e){var i=!(arguments.length>1)||void 0===arguments[1]||arguments[1],a=r.findIndex(function(i){return i===e});return a<0?void 0:i?r.slice(a+1).find(function(e){return(0,n.AO)(e,s.tabbableOptions)}):r.slice(0,a).reverse().find(function(e){return(0,n.AO)(e,s.tabbableOptions)})}}}),f.tabbableGroups=f.containerGroups.filter(function(e){return e.tabbableNodes.length>0}),f.tabbableGroups.length<=0&&!g("fallbackFocus"))throw Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times")},v=function e(i){if(!1!==i&&i!==a.activeElement){if(!i||!i.focus){e(y());return}i.focus({preventScroll:!!s.preventScroll}),f.mostRecentlyFocusedNode=i,i.tagName&&"input"===i.tagName.toLowerCase()&&"function"==typeof i.select&&i.select()}},b=function(e){var i=g("setReturnFocus",e);return i||!1!==i&&e},w=function(e){var i=p(e);if(!(_(i)>
313=0)){if(d(s.clickOutsideDeactivates,e)){r.deactivate({returnFocus:s.returnFocusOnDeactivate&&!(0,n.tp)(i,s.tabbableOptions)});return}d(s.allowOutsideClick,e)||e.preventDefault()}},T=function(e){var i=p(e),r=_(i)>=0;r||i instanceof Document?r&&(f.mostRecentlyFocusedNode=i):(e.stopImmediatePropagation(),v(f.mostRecentlyFocusedNode||y()))},S=function(e){var i=p(e);x();var r=null;if(f.tabbableGroups.length>0){var a=_(i),l=a>=0?f.containerGroups[a]:void 0;if(a<0)r=e.shiftKey?f.tabbableGroups[f.tabbableGroups.length-1].lastTabbableNode:f.tabbableGroups[0].firstTabbableNode;else if(e.shiftKey){var h=c(f.tabbableGroups,function(e){return i===e.firstTabbableNode});if(h<0&&(l.container===i||(0,n.tp)(i,s.tabbableOptions)&&!(0,n.AO)(i,s.tabbableOptions)&&!l.nextTabbableNode(i,!1))&&(h=a),h>=0){var u=0===h?f.tabbableGroups.length-1:h-1;r=f.tabbableGroups[u].lastTabbableNode}}else{var d=c(f.tabbableGroups,function(e){return i===e.lastTabbableNode});if(d<0&&(l.container===i||(0,n.tp)(i,s.tabbableOptions)&&!(0,n.AO)(i,s.tabbableOptions)&&!l.nextTabbableNode(i))&&(d=a),d>=0){var m=d===f.tabbableGroups.length-1?0:d+1;r=f.tabbableGroups[m].firstTabbableNode}}}else r=g("fallbackFocus");r&&(e.preventDefault(),v(r))},M=function(e){if(("Escape"===e.key||"Esc"===e.key||27===e.keyCode)&&!1!==d(s.escapeDeactivates,e)){e.preventDefault(),r.deactivate();return}if("Tab"===e.key||9===e.keyCode){S(e);return}},E=function(e){_(p(e))>=0||d(s.clickOutsideDeactivates,e)||d(s.allowOutsideClick,e)||(e.preventDefault(),e.stopImmediatePropagation())},A=function(){if(f.active)return h.activateTrap(r),f.delayInitialFocusTimer=s.delayInitialFocus?u(function(){v(y())}):v(y()),a.addEventListener("focusin",T,!0),a.addEventListener("mousedown",w,{capture:!0,passive:!1}),a.addEventListener("touchstart",w,{capture:!0,passive:!1}),a.addEventListener("click",E,{capture:!0,passive:!1}),a.addEventListener("keydown",M,{capture:!0,passive:!1}),r},I=function(){if(f.active)return a.removeEventListener("focusin",T,!0),a.removeEventListener("mousedown",w,!0),a.removeEventListener("touchstart",w,!0),a.removeEventListener("click",E,!0),a.removeEventListener("keydown",M,!0),r};return(r={get active(){return f.active},get paused(){return f.paused},activate:function(e){if(f.active)return this;var i=m(e,"onActivate"),r=m(e,"onPostActivate"),n=m(e,"checkCanFocusTrap");n||x(),f.active=!0,f.paused=!1,f.nodeFocusedBeforeActivation=a.activeElement,i&&i();var s=function(){n&&x(),A(),r&&r()};return n?n(f.containers.concat()).then(s,s):s(),this},deactivate:function(e){if(!f.active)return this;var i=l({onDeactivate:s.onDeactivate,onPostDeactivate:s.onPostDeactivate,checkCanReturnFocus:s.checkCanReturnFocus},e);clearTimeout(f.delayInitialFocusTimer),f.delayInitialFocusTimer=void 0,I(),f.active=!1,f.paused=!1,h.deactivateTrap(r);var a=m(i,"onDeactivate"),n=m(i,"onPostDeactivate"),c=m(i,"checkCanReturnFocus"),d=m(i,"returnFocus","returnFocusOnDeactivate");a&&a();var p=function(){u(function(){d&&v(b(f.nodeFocusedBeforeActivation)),n&&n()})};return d&&c?c(b(f.nodeFocusedBeforeActivation)).then(p,p):p(),this},pause:function(){return f.paused||!f.active||(f.paused=!0,I()),this},unpause:function(){return f.paused&&f.active&&(f.paused=!1,x(),A()),this}
313,updateContainerElements:function(e){var i=[].concat(e).filter(Boolean);return f.containers=i.map(function(e){return"string"==typeof e?a.querySelector(e):e}),f.active&&x(),this}}).updateContainerElements(e),r}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.